source: asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecs/TECSInfo/nTECSInfo_tTECSInfoSub.c@ 374

Last change on this file since 374 was 374, checked in by coas-nagasima, 5 years ago

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 21.1 KB
Line 
1/*
2 * Copyright (C) 2008-2017 by TOPPERS Project
3 *
4 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
5 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
6 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
7 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
8 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
9 * スコード中に含まれていること.
10 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
11 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
12 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
13 * の無保証規定を掲載すること.
14 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
15 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
16 * と.
17 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
18 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
19 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
20 * 報告すること.
21 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
22 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
23 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
24 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
25 * 免責すること.
26 *
27 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
28 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
29 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
30 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
31 * の責任を負わない.
32 *
33 * @(#) $Id$
34 */
35
36/* #[<PREAMBLE>]#
37 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
38 * tecsmerge によるマージに使用されます
39 *
40 * 属性アクセスマクロ #_CAAM_#
41 * name_len int32_t ATTR_name_len
42 * path_len int32_t ATTR_path_len
43 * name1 char_t* VAR_name1
44 * name2 char_t* VAR_name2
45 * path char_t* VAR_path
46 *
47 * 呼び口関数 #_TCPF_#
48 * call port: cNamespaceInfo signature: nTECSInfo_sNamespaceInfo context:task
49 * ER cNamespaceInfo_getName( char_t* name, int_t max_len );
50 * uint16_t cNamespaceInfo_getNameLength( );
51 * uint32_t cNamespaceInfo_getNNamespace( );
52 * ER cNamespaceInfo_getNamespaceInfo( uint32_t ith, Descriptor( nTECSInfo_sNamespaceInfo )* des );
53 * uint32_t cNamespaceInfo_getNSignature( );
54 * ER cNamespaceInfo_getSignatureInfo( uint32_t ith, Descriptor( nTECSInfo_sSignatureInfo )* des );
55 * uint32_t cNamespaceInfo_getNCelltype( );
56 * ER cNamespaceInfo_getCelltypeInfo( uint32_t ith, Descriptor( nTECSInfo_sCelltypeInfo )* des );
57 * [ref_desc]
58 * Descriptor( nTECSInfo_sNamespaceInfo ) cNamespaceInfo_refer_to_descriptor();
59 * Descriptor( nTECSInfo_sNamespaceInfo ) cNamespaceInfo_ref_desc() (same as above; abbreviated version);
60 * call port: cRegionInfo signature: nTECSInfo_sRegionInfo context:task
61 * ER cRegionInfo_getName( char_t* name, int_t max_len );
62 * uint16_t cRegionInfo_getNameLength( );
63 * uint32_t cRegionInfo_getNCell( );
64 * ER cRegionInfo_getCellInfo( uint32_t ith, Descriptor( nTECSInfo_sCellInfo )* des );
65 * uint32_t cRegionInfo_getNRegion( );
66 * ER cRegionInfo_getRegionInfo( uint32_t ith, Descriptor( nTECSInfo_sRegionInfo )* des );
67 * [ref_desc]
68 * Descriptor( nTECSInfo_sRegionInfo ) cRegionInfo_refer_to_descriptor();
69 * Descriptor( nTECSInfo_sRegionInfo ) cRegionInfo_ref_desc() (same as above; abbreviated version);
70 * call port: cNamespaceInfoTemp signature: nTECSInfo_sNamespaceInfo context:task optional:true
71 * bool_t is_cNamespaceInfoTemp_joined() check if joined
72 * ER cNamespaceInfoTemp_getName( char_t* name, int_t max_len );
73 * uint16_t cNamespaceInfoTemp_getNameLength( );
74 * uint32_t cNamespaceInfoTemp_getNNamespace( );
75 * ER cNamespaceInfoTemp_getNamespaceInfo( uint32_t ith, Descriptor( nTECSInfo_sNamespaceInfo )* des );
76 * uint32_t cNamespaceInfoTemp_getNSignature( );
77 * ER cNamespaceInfoTemp_getSignatureInfo( uint32_t ith, Descriptor( nTECSInfo_sSignatureInfo )* des );
78 * uint32_t cNamespaceInfoTemp_getNCelltype( );
79 * ER cNamespaceInfoTemp_getCelltypeInfo( uint32_t ith, Descriptor( nTECSInfo_sCelltypeInfo )* des );
80 * [dynamic, optional]
81 * void cNamespaceInfoTemp_set_descriptor( Descriptor( nTECSInfo_sNamespaceInfo ) desc );
82 * void cNamespaceInfoTemp_unjoin( );
83 * call port: cRegionInfoTemp signature: nTECSInfo_sRegionInfo context:task optional:true
84 * bool_t is_cRegionInfoTemp_joined() check if joined
85 * ER cRegionInfoTemp_getName( char_t* name, int_t max_len );
86 * uint16_t cRegionInfoTemp_getNameLength( );
87 * uint32_t cRegionInfoTemp_getNCell( );
88 * ER cRegionInfoTemp_getCellInfo( uint32_t ith, Descriptor( nTECSInfo_sCellInfo )* des );
89 * uint32_t cRegionInfoTemp_getNRegion( );
90 * ER cRegionInfoTemp_getRegionInfo( uint32_t ith, Descriptor( nTECSInfo_sRegionInfo )* des );
91 * [dynamic, optional]
92 * void cRegionInfoTemp_set_descriptor( Descriptor( nTECSInfo_sRegionInfo ) desc );
93 * void cRegionInfoTemp_unjoin( );
94 * call port: cCelltypeInfoTemp signature: nTECSInfo_sCelltypeInfo context:task optional:true
95 * bool_t is_cCelltypeInfoTemp_joined() check if joined
96 * ER cCelltypeInfoTemp_getName( char_t* name, int_t max_len );
97 * uint16_t cCelltypeInfoTemp_getNameLength( );
98 * uint32_t cCelltypeInfoTemp_getNAttr( );
99 * ER cCelltypeInfoTemp_getAttrInfo( uint32_t ith, Descriptor( nTECSInfo_sVarDeclInfo )* desc );
100 * uint32_t cCelltypeInfoTemp_getNVar( );
101 * ER cCelltypeInfoTemp_getVarInfo( uint32_t ith, Descriptor( nTECSInfo_sVarDeclInfo )* desc );
102 * uint32_t cCelltypeInfoTemp_getNCall( );
103 * ER cCelltypeInfoTemp_getCallInfo( uint32_t ith, Descriptor( nTECSInfo_sCallInfo )* desc );
104 * uint32_t cCelltypeInfoTemp_getNEntry( );
105 * ER cCelltypeInfoTemp_getEntryInfo( uint32_t ith, Descriptor( nTECSInfo_sEntryInfo )* desc );
106 * bool_t cCelltypeInfoTemp_isSingleton( );
107 * bool_t cCelltypeInfoTemp_isIDX_is_ID( );
108 * uint32_t cCelltypeInfoTemp_sizeOfCB( );
109 * uint32_t cCelltypeInfoTemp_sizeOfINIB( );
110 * [dynamic, optional]
111 * void cCelltypeInfoTemp_set_descriptor( Descriptor( nTECSInfo_sCelltypeInfo ) desc );
112 * void cCelltypeInfoTemp_unjoin( );
113 * call port: cCellInfoTemp signature: nTECSInfo_sCellInfo context:task optional:true
114 * bool_t is_cCellInfoTemp_joined() check if joined
115 * ER cCellInfoTemp_getName( char_t* name, int_t max_len );
116 * uint16_t cCellInfoTemp_getNameLength( );
117 * uint32_t cCellInfoTemp_getNRawEntryDescriptorInfo( );
118 * ER cCellInfoTemp_getRawEntryDescriptorInfo( int_t index, Descriptor( nTECSInfo_sRawEntryDescriptorInfo )* desc );
119 * void cCellInfoTemp_getCelltypeInfo( Descriptor( nTECSInfo_sCelltypeInfo )* desc );
120 * void cCellInfoTemp_getCBP( void** cbp );
121 * void cCellInfoTemp_getINIBP( void** inibp );
122 * [dynamic, optional]
123 * void cCellInfoTemp_set_descriptor( Descriptor( nTECSInfo_sCellInfo ) desc );
124 * void cCellInfoTemp_unjoin( );
125 * call port: cEntryInfoTemp signature: nTECSInfo_sEntryInfo context:task optional:true
126 * bool_t is_cEntryInfoTemp_joined() check if joined
127 * ER cEntryInfoTemp_getName( char_t* name, int_t max_len );
128 * uint16_t cEntryInfoTemp_getNameLength( );
129 * void cEntryInfoTemp_getSignatureInfo( Descriptor( nTECSInfo_sSignatureInfo )* desc );
130 * uint32_t cEntryInfoTemp_getArraySize( );
131 * bool_t cEntryInfoTemp_isInline( );
132 * [dynamic, optional]
133 * void cEntryInfoTemp_set_descriptor( Descriptor( nTECSInfo_sEntryInfo ) desc );
134 * void cEntryInfoTemp_unjoin( );
135 *
136 * #[</PREAMBLE>]# */
137
138/* Put prototype declaration and/or variale definition here #_PAC_# */
139#include <string.h>
140#include "nTECSInfo_tTECSInfoSub_tecsgen.h"
141
142#ifndef E_OK
143#define E_OK 0 /* success */
144#define E_ID (-18) /* illegal ID */
145#endif
146
147static ER
148separate_basename( const char_t **namespace_path, char_t **basename );
149
150
151/*
152 * VAR_name1 … 引数として渡されたものをコピーする。ただし、途中の '::' を '\0' に書き換えることはある。
153 * VAR_name2 … 都度上書きして使用する
154 */
155
156/* entry port function #_TEPF_# */
157/* #[<ENTRY_PORT>]# eTECSInfo
158 * entry port: eTECSInfo
159 * signature: nTECSInfo_sTECSInfo
160 * context: task
161 * #[</ENTRY_PORT>]# */
162
163/* #[<ENTRY_FUNC>]# eTECSInfo_findNamespace
164 * name: eTECSInfo_findNamespace
165 * global_name: nTECSInfo_tTECSInfoSub_eTECSInfo_findNamespace
166 * oneway: false
167 * #[</ENTRY_FUNC>]# */
168ER
169eTECSInfo_findNamespace(const char_t* namespace_path, Descriptor( nTECSInfo_sNamespaceInfo )* nsDesc)
170{
171 const char_t *p = namespace_path;
172 char_t *p2;
173 Descriptor( nTECSInfo_sNamespaceInfo ) desc, desc2;
174 int i;
175 int n;
176
177 if( p[ 0 ] == ':' && p[ 1 ] == ':' ){
178 p += 2;
179 }
180 desc = cNamespaceInfo_refer_to_descriptor(); // root name space
181 while( *p != '\0' ){
182 p2 = VAR_name1;
183 for( i = 0; i < ATTR_name_len; i++ ){
184 if( *p == '\0' || *p == ':' ){
185 *p2 = '\0';
186 break;
187 }
188 *p2++ = *p++;
189 }
190 if( i == ATTR_name_len )
191 return E_NORES;
192
193 desc2 = desc;
194 cNamespaceInfoTemp_set_descriptor( desc2 );
195 n = cNamespaceInfoTemp_getNNamespace( );
196 for( i = 0; i < n; i++ ){
197 cNamespaceInfoTemp_set_descriptor( desc2 );
198 cNamespaceInfoTemp_getNamespaceInfo( i, &desc );
199 cNamespaceInfoTemp_set_descriptor( desc );
200 cNamespaceInfoTemp_getName( VAR_name2, ATTR_name_len );
201 if( strcmp( VAR_name1, VAR_name2 ) == 0 )
202 break;
203 }
204 if( i == n )
205 return E_NOID;
206
207 if( p[ 0 ] == ':' ){
208 if( p[ 1 ] == ':' )
209 p += 2;
210 else
211 return E_OBJ;
212 }
213 }
214 *nsDesc = desc;
215 return E_OK;
216}
217
218/* #[<ENTRY_FUNC>]# eTECSInfo_findRegion
219 * name: eTECSInfo_findRegion
220 * global_name: nTECSInfo_tTECSInfoSub_eTECSInfo_findRegion
221 * oneway: false
222 * #[</ENTRY_FUNC>]# */
223ER
224eTECSInfo_findRegion(const char_t* namespace_path, Descriptor( nTECSInfo_sRegionInfo )* regionDesc)
225{
226 const char_t *p = namespace_path;
227 char_t *p2;
228 Descriptor( nTECSInfo_sRegionInfo ) desc, desc2;
229 int i;
230 int n;
231
232 if( p[ 0 ] == ':' && p[ 1 ] == ':' ){
233 p += 2;
234 }
235 desc = cRegionInfo_refer_to_descriptor();
236 while( *p != '\0' ){
237 p2 = VAR_name1;
238 for( i = 0; i < ATTR_name_len; i++ ){
239 if( *p == '\0' || *p == ':' ){
240 *p2 = '\0';
241 break;
242 }
243 *p2++ = *p++;
244 }
245 if( i == ATTR_name_len )
246 return E_NORES;
247
248 desc2 = desc;
249 cRegionInfoTemp_set_descriptor( desc2 );
250 n = cRegionInfoTemp_getNRegion( );
251 for( i = 0; i < n; i++ ){
252 // syslog_3( LOG_NOTICE, "tTECSInfo.eTECSInfo.findRegion 2 %s i=%d n=%d", VAR_name1, i, n );
253 cRegionInfoTemp_set_descriptor( desc2 );
254 cRegionInfoTemp_getRegionInfo( i, &desc );
255 cRegionInfoTemp_set_descriptor( desc );
256 cRegionInfoTemp_getName( VAR_name2, ATTR_name_len );
257 if( strcmp( VAR_name1, VAR_name2 ) == 0 )
258 break;
259 }
260 if( i == n )
261 return E_NOID;
262
263 if( p[ 0 ] == ':' ){
264 if( p[ 1 ] == ':' )
265 p += 2;
266 else
267 return E_OBJ;
268 }
269 }
270 *regionDesc = desc;
271 return E_OK;
272}
273
274/* #[<ENTRY_FUNC>]# eTECSInfo_findSignature
275 * name: eTECSInfo_findSignature
276 * global_name: nTECSInfo_tTECSInfoSub_eTECSInfo_findSignature
277 * oneway: false
278 * #[</ENTRY_FUNC>]# */
279ER
280eTECSInfo_findSignature(const char_t* namespace_path, Descriptor( nTECSInfo_sSignatureInfo )* signatureDesc)
281{
282 Descriptor( nTECSInfo_sNamespaceInfo ) nsDesc;
283 Descriptor( nTECSInfo_sSignatureInfo ) desc;
284 ER ercd;
285 char_t *pname;
286 int i, n;
287
288 ercd = separate_basename( &namespace_path, &pname );
289 if( ercd != E_OK )
290 return ercd;
291
292 ercd = eTECSInfo_findNamespace( namespace_path, &nsDesc);
293 if( ercd != E_OK )
294 return ercd;
295
296 // syslog_0( LOG_NOTICE, "tTECSInfo.eTECSInfo.findCell 4" );
297 cNamespaceInfoTemp_set_descriptor( nsDesc );
298 n = cNamespaceInfoTemp_getNSignature( );
299 for( i = 0; i < n; i++ ){
300 cNamespaceInfoTemp_getSignatureInfo( i, &desc );
301 cSignatureInfoTemp_set_descriptor( desc );
302 cSignatureInfoTemp_getName( VAR_name1, ATTR_name_len );
303 if( strcmp( pname, VAR_name1 ) == 0 )
304 break;
305 }
306 // syslog_0( LOG_NOTICE, "tTECSInfo.eTECSInfo.findCell 5" );
307 if( i == n )
308 return E_NOEXS;
309
310 *signatureDesc = desc;
311 return E_OK;
312}
313
314/* #[<ENTRY_FUNC>]# eTECSInfo_findCelltype
315 * name: eTECSInfo_findCelltype
316 * global_name: nTECSInfo_tTECSInfoSub_eTECSInfo_findCelltype
317 * oneway: false
318 * #[</ENTRY_FUNC>]# */
319ER
320eTECSInfo_findCelltype(const char_t* namespace_path, Descriptor( nTECSInfo_sCelltypeInfo )* celltypeDesc)
321{
322 return E_NOSPT;
323}
324
325/* #[<ENTRY_FUNC>]# eTECSInfo_findCell
326 * name: eTECSInfo_findCell
327 * global_name: nTECSInfo_tTECSInfoSub_eTECSInfo_findCell
328 * oneway: false
329 * #[</ENTRY_FUNC>]# */
330ER
331eTECSInfo_findCell(const char_t* namespace_path, Descriptor( nTECSInfo_sCellInfo )* cellDesc)
332{
333 char_t *p, *pname;
334 Descriptor( nTECSInfo_sRegionInfo ) RegionDesc;
335 Descriptor( nTECSInfo_sCellInfo ) desc;
336 int i, n, len;
337 ER ercd;
338
339#if 0
340 // syslog_0( LOG_NOTICE, "tTECSInfo.eTECSInfo.findCell 1" );
341 len = strnlen( namespace_path, ATTR_path_len );
342 if( len >= ATTR_path_len ){
343 return E_NOMEM;
344 }
345 if( VAR_path != namespace_path ) // findRawEntryDescriptorInfo から呼ばれた時、VAR_path に入っているのでコピー不要
346 strcpy( VAR_path, namespace_path );
347 p = &VAR_path[ len - 1 ];
348 while( p > VAR_path ){
349 if( *p == ':' )
350 break;
351 p--;
352 }
353 if( *p == ':' ){
354 p--;
355 if( p < VAR_path || *p != ':' )
356 return E_PAR; // :: ではなく、: であった
357 if( p == VAR_path ){
358 namespace_path = "::";
359 }
360 else{
361 *p = '\0';
362 namespace_path = VAR_path;
363 }
364 pname = &p[2];
365 }
366 else{
367 namespace_path = "::";
368 pname = VAR_path;
369 }
370#endif
371 ercd = separate_basename( &namespace_path, &pname );
372 if( ercd != E_OK )
373 return ercd;
374
375 // syslog_2( LOG_NOTICE, "tTECSInfo.eTECSInfo.findCell 2 %s %s", namespace_path, pname );
376
377 // syslog_0( LOG_NOTICE, "tTECSInfo.eTECSInfo.findCell 3" );
378 ercd = eTECSInfo_findRegion( namespace_path, &RegionDesc);
379 if( ercd != E_OK )
380 return ercd;
381
382 // syslog_0( LOG_NOTICE, "tTECSInfo.eTECSInfo.findCell 4" );
383 cRegionInfoTemp_set_descriptor( RegionDesc );
384 n = cRegionInfoTemp_getNCell( );
385 for( i = 0; i < n; i++ ){
386 cRegionInfoTemp_getCellInfo( i, &desc );
387 cCellInfoTemp_set_descriptor( desc );
388 cCellInfoTemp_getName( VAR_name1, ATTR_name_len );
389 if( strcmp( pname, VAR_name1 ) == 0 )
390 break;
391 }
392 // syslog_0( LOG_NOTICE, "tTECSInfo.eTECSInfo.findCell 5" );
393 if( i == n )
394 return E_NOEXS;
395
396 *cellDesc = desc;
397 return E_OK;
398}
399
400/* #[<ENTRY_FUNC>]# eTECSInfo_findRawEntryDescriptor
401 * name: eTECSInfo_findRawEntryDescriptor
402 * global_name: nTECSInfo_tTECSInfoSub_eTECSInfo_findRawEntryDescriptor
403 * oneway: false
404 * #[</ENTRY_FUNC>]# */
405ER
406eTECSInfo_findRawEntryDescriptor(const char_t* namespace_path, int_t ith, Descriptor( nTECSInfo_sRawEntryDescriptorInfo )* rawEntryDescDesc, Descriptor( nTECSInfo_sEntryInfo )* entryDesc)
407{
408 int_t len;
409 Descriptor( nTECSInfo_sCelltypeInfo ) celltypeDesc;
410 Descriptor( nTECSInfo_sCellInfo ) cellDesc;
411 Descriptor( nTECSInfo_sEntryInfo ) entDesc;
412 char_t *p;
413 int_t i, n;
414 ER ercd;
415
416 len = strnlen( namespace_path, ATTR_path_len );
417 if( len >= ATTR_path_len ){
418 return E_NOMEM;
419 }
420 strcpy( VAR_path, namespace_path );
421 p = &VAR_path[len-1];
422 while( *p != '.' && p != &VAR_path[0] )
423 p--;
424 if( *p != '.' )
425 return E_PAR; // '.' が見つからない
426 *p = '\0';
427 ercd = eTECSInfo_findCell( VAR_path, &cellDesc);
428 if( ercd != E_OK )
429 return ercd;
430 cCellInfoTemp_set_descriptor( cellDesc );
431 cCellInfoTemp_getCelltypeInfo( &celltypeDesc );
432 cCelltypeInfoTemp_set_descriptor( celltypeDesc );
433 n = cCelltypeInfoTemp_getNEntry();
434 p += 1;
435 //syslog_1( LOG_NOTICE, "tTECSInfo.eTECSInfo.findRawEntryDescriptor 4 n_entry=%d", n );
436 // dly_tsk( 10000 );
437 for( i = 0; i < n; i++ ){
438 ercd = cCelltypeInfoTemp_getEntryInfo( i, &entDesc ); // エラーはみない
439 //syslog_2( LOG_NOTICE, "tTECSInfo.eTECSInfo.findRawEntryDescriptor 5 ercd=%d entDesc=%x", ercd, entDesc.vdes );
440 cEntryInfoTemp_set_descriptor( entDesc );
441 ercd = cEntryInfoTemp_getName( VAR_name1, ATTR_name_len );
442 //dly_tsk( 5 );
443 //syslog_4( LOG_NOTICE, "tTECSInfo.eTECSInfo.findRawEntryDescriptor 6 ercd=%d entDesc=%x nm=%s p=%s", ercd, entDesc.vdes, VAR_name1, p );
444 //dly_tsk( 5 );
445 if( ercd != E_OK )
446 return ercd;
447 if( strcmp( VAR_name1, p ) == 0 )
448 break;
449 }
450 if( i != n ){
451 cCellInfoTemp_getRawEntryDescriptorInfo( ith, rawEntryDescDesc );
452 *entryDesc = entDesc;
453 }
454 else{
455 ercd = E_NOEXS;
456 }
457 return ercd;
458}
459
460/* #[<ENTRY_FUNC>]# eTECSInfo_findRawEntryDescriptor_unsafe
461 * name: eTECSInfo_findRawEntryDescriptor_unsafe
462 * global_name: nTECSInfo_tTECSInfoSub_eTECSInfo_findRawEntryDescriptor_unsafe
463 * oneway: false
464 * #[</ENTRY_FUNC>]# */
465ER
466eTECSInfo_findRawEntryDescriptor_unsafe(const char_t* namespace_path, void** rawDesc)
467{
468 ER ercd;
469 Descriptor( nTECSInfo_sRawEntryDescriptorInfo ) rawEntryDescDesc;
470 Descriptor( nTECSInfo_sEntryInfo ) entryDesc;
471 ercd = eTECSInfo_findRawEntryDescriptor(namespace_path, 0, &rawEntryDescDesc, &entryDesc);
472 if( ercd != E_OK )
473 return ercd;
474 cRawEntryDescriptorInfoTemp_set_descriptor( rawEntryDescDesc );
475 ercd = cRawEntryDescriptorInfoTemp_getRawDescriptor( 0, rawDesc );
476 return ercd;
477}
478
479/* #[<POSTAMBLE>]#
480 * これより下に非受け口関数を書きます
481 * #[</POSTAMBLE>]#*/
482
483/*
484 * namespace_path を VAR_path へコピーし、ディレクトリパス部とオブジェクト名部に分割する
485 * namespace_path "::namespace::subnamespace::object_name"
486 * VAR_path "::namespace::subnamespace\0:object_name" 一番右の '::' を '\0:' に置き換える
487 * basename "object_name" へのポインタを返す
488 */
489static ER
490separate_basename( const char_t **namespace_path, char_t **basename )
491{
492 int i, len;
493 char_t *p;
494 static const char_t *root_namespacepath = "::";
495
496 len = strnlen( *namespace_path, ATTR_path_len );
497 if( len >= ATTR_path_len ){
498 return E_NOMEM;
499 }
500 if( VAR_path != *namespace_path ) // findRawEntryDescriptorInfo から呼ばれた時、VAR_path に入っているのでコピー不要
501 strcpy( VAR_path, *namespace_path );
502 p = &VAR_path[ len - 1 ];
503 while( p > VAR_path ){
504 if( *p == ':' )
505 break;
506 p--;
507 }
508 if( *p == ':' ){
509 p--;
510 if( p < VAR_path || *p != ':' )
511 return E_PAR; // :: ではなく、: であった
512 if( p == VAR_path ){
513 *namespace_path = root_namespacepath;
514 }
515 else{
516 *p = '\0';
517 *namespace_path = VAR_path;
518 }
519 *basename = &p[2];
520 }
521 else{
522 *namespace_path = root_namespacepath;
523 *basename = VAR_path;
524 }
525 return E_OK;
526}
Note: See TracBrowser for help on using the repository browser.