|
@@ -8,7 +8,9 @@ extern "C" {
|
8
|
8
|
enum
|
9
|
9
|
{
|
10
|
10
|
kOkDtRC = cmOkRC,
|
11
|
|
- kCvtErrDtRC
|
|
11
|
+ kCvtErrDtRC,
|
|
12
|
+ kVarArgErrDtRC,
|
|
13
|
+ kEolDtRC
|
12
|
14
|
};
|
13
|
15
|
|
14
|
16
|
enum
|
|
@@ -79,9 +81,8 @@ extern "C" {
|
79
|
81
|
cmDataFmtId_t tid; // data format id
|
80
|
82
|
unsigned flags; //
|
81
|
83
|
struct cmData_str* parent; // this childs parent
|
82
|
|
- struct cmData_str* sibling; // this childs sibling
|
83
|
|
- unsigned allocCnt; // allocated count
|
84
|
|
- unsigned cnt; // actual count
|
|
84
|
+ struct cmData_str* sibling; // this childs left sibling
|
|
85
|
+ unsigned cnt; // array ele count
|
85
|
86
|
|
86
|
87
|
union
|
87
|
88
|
{
|
|
@@ -120,9 +121,59 @@ extern "C" {
|
120
|
121
|
|
121
|
122
|
typedef unsigned cmDtRC_t;
|
122
|
123
|
|
|
124
|
+ extern cmData_t cmDataNull;
|
|
125
|
+
|
123
|
126
|
bool cmDataIsValue( const cmData_t* p );
|
124
|
127
|
bool cmDataIsPtr( const cmData_t* p );
|
125
|
128
|
bool cmDataIsStruct( const cmData_t* p );
|
|
129
|
+
|
|
130
|
+ /*
|
|
131
|
+ TODO:
|
|
132
|
+ 0) Figure out a error handling scheme that does not rely on
|
|
133
|
+ a global errno. This is not useful in multi-thread environments.
|
|
134
|
+ It might be ok to go with an 'all errors are fatal' model
|
|
135
|
+ (except in the var-args functions).
|
|
136
|
+ Consider the use of a context object for use with functions
|
|
137
|
+ that can have runtime errors or need to allocate memory.
|
|
138
|
+
|
|
139
|
+ 1) Implement the canConvert and willTruncate functions.
|
|
140
|
+
|
|
141
|
+ 2) Make a set of cmDataAllocXXXPtr() functions which take
|
|
142
|
+ a flag indicating whether or not to dynamically allocate
|
|
143
|
+ the array space. This will allow dynamic allocattion to
|
|
144
|
+ occur at runtime. Make var args functions for list and
|
|
145
|
+ record objects which also take this flag.
|
|
146
|
+ Where ever a function may be implemented using
|
|
147
|
+ static/dynamic allocation this flag should be present.
|
|
148
|
+ (e.g. string allocation for pair labels)
|
|
149
|
+ This choice is common enough that it may be worth
|
|
150
|
+ suffixing function names with a capital letter to
|
|
151
|
+ be clear what the functions memory policy is.
|
|
152
|
+
|
|
153
|
+ 3) Come up with a var-args format which allows a
|
|
154
|
+ hierchy of records to be defined in one line.
|
|
155
|
+
|
|
156
|
+ 4) Implement the serialization functions.
|
|
157
|
+
|
|
158
|
+ 5) Implement an ascii string/parse format for writing/reading.
|
|
159
|
+
|
|
160
|
+ 6) Implement fast lookup of record fields.
|
|
161
|
+
|
|
162
|
+ 7) Allow for user defined types. For example a 'matrix'
|
|
163
|
+ data type. This might be as simple as adding an extra 'user_tid'
|
|
164
|
+ field to cmData_t.
|
|
165
|
+
|
|
166
|
+ 8) Implement type specific cmDataGetRecordValueXXX() functions.
|
|
167
|
+
|
|
168
|
+ 9) Implement cmDataIsEqual(), cmDataIsLtE(), ...
|
|
169
|
+
|
|
170
|
+ */
|
|
171
|
+
|
|
172
|
+ bool canConvertType( cmDataFmtId_t srcId, cmDataFmtId_t dstId );
|
|
173
|
+ bool willTruncate( cmDataFmtId_t srcId, cmDataFmtId_t dstId );
|
|
174
|
+ bool canConvertObj( const cmData_t* srcObj, cmData_t* dstObj );
|
|
175
|
+ bool willTruncateObj(const cmData_t* srcObj, cmData_t* dstObj );
|
|
176
|
+
|
126
|
177
|
|
127
|
178
|
|
128
|
179
|
// Get the value of an object without conversion.
|
|
@@ -179,7 +230,8 @@ extern "C" {
|
179
|
230
|
double* cmDataGetDoublePtr( const cmData_t* p );
|
180
|
231
|
|
181
|
232
|
|
182
|
|
- // Set the value of an existing data object.
|
|
233
|
+ // Set the value of an existing scalar data object.
|
|
234
|
+ cmData_t* cmDataSetNull( cmData_t* p );
|
183
|
235
|
cmData_t* cmDataSetChar( cmData_t* p, char v );
|
184
|
236
|
cmData_t* cmDataSetUChar( cmData_t* p, unsigned char v );
|
185
|
237
|
cmData_t* cmDataSetShort( cmData_t* p, short v );
|
|
@@ -194,7 +246,8 @@ extern "C" {
|
194
|
246
|
cmData_t* cmDataSetConstStr( cmData_t* p, const cmChar_t* s );
|
195
|
247
|
|
196
|
248
|
// Set the value of an existing data object to an external array.
|
197
|
|
- // The array is not copied.
|
|
249
|
+ // 'vp' is assigned as the data space for the object and therefore must remain
|
|
250
|
+ // valid for the life of the object.
|
198
|
251
|
cmData_t* cmDataSetVoidPtr( cmData_t* p, void* vp, unsigned cnt );
|
199
|
252
|
cmData_t* cmDataSetCharPtr( cmData_t* p, char* vp, unsigned cnt );
|
200
|
253
|
cmData_t* cmDataSetUCharPtr( cmData_t* p, unsigned char* vp, unsigned cnt );
|
|
@@ -208,7 +261,7 @@ extern "C" {
|
208
|
261
|
cmData_t* cmDataSetDoublePtr( cmData_t* p, double* vp, unsigned cnt );
|
209
|
262
|
|
210
|
263
|
// Set the value of an existing array based data object.
|
211
|
|
- // Allocate the internal array and copy the array into it.
|
|
264
|
+ // Dynamically allocate the internal array and copy the array data into it.
|
212
|
265
|
cmData_t* cmDataSetStrAlloc( cmData_t* p, const cmChar_t* s );
|
213
|
266
|
cmData_t* cmDataSetConstStrAlloc( cmData_t* p, const cmChar_t* s );
|
214
|
267
|
cmData_t* cmDataSetVoidAllocPtr( cmData_t* p, const void* vp, unsigned cnt );
|
|
@@ -219,78 +272,112 @@ extern "C" {
|
219
|
272
|
cmData_t* cmDataSetIntAllocPtr( cmData_t* p, const int* vp, unsigned cnt );
|
220
|
273
|
cmData_t* cmDataSetUIntAllocPtr( cmData_t* p, const unsigned int* vp, unsigned cnt );
|
221
|
274
|
cmData_t* cmDataSetLongAllocPtr( cmData_t* p, const long* vp, unsigned cnt );
|
222
|
|
-
|
223
|
275
|
cmData_t* cmDataSetULongAllocPtr( cmData_t* p, const unsigned long* vp, unsigned cnt );
|
224
|
276
|
cmData_t* cmDataSetFloatAllocPtr( cmData_t* p, const float* vp, unsigned cnt );
|
225
|
277
|
cmData_t* cmDataSetDoubleAllocPtr( cmData_t* p, const double* vp, unsigned cnt );
|
226
|
278
|
|
227
|
279
|
|
228
|
280
|
// Dynamically allocate a data object and set it's value.
|
229
|
|
- cmData_t* cmDataAllocChar( char v );
|
230
|
|
- cmData_t* cmDataAllocUChar( unsigned char v );
|
231
|
|
- cmData_t* cmDataAllocShort( short v );
|
232
|
|
- cmData_t* cmDataAllocUShort( unsigned short v );
|
233
|
|
- cmData_t* cmDataAllocInt( int v );
|
234
|
|
- cmData_t* cmDataAllocUInt( unsigned int v );
|
235
|
|
- cmData_t* cmDataAllocLong( long v );
|
236
|
|
- cmData_t* cmDataAllocULong( unsigned long v );
|
237
|
|
- cmData_t* cmDataAllocFloat( float v );
|
238
|
|
- cmData_t* cmDataAllocDouble( double v );
|
239
|
|
- cmData_t* cmDataAllocStr( cmChar_t* str );
|
240
|
|
- cmData_t* cmDataAllocConstStr( const cmChar_t* str );
|
|
281
|
+ cmData_t* cmDataAllocNull( cmData_t* parent );
|
|
282
|
+ cmData_t* cmDataAllocChar( cmData_t* parent, char v );
|
|
283
|
+ cmData_t* cmDataAllocUChar( cmData_t* parent, unsigned char v );
|
|
284
|
+ cmData_t* cmDataAllocShort( cmData_t* parent, short v );
|
|
285
|
+ cmData_t* cmDataAllocUShort( cmData_t* parent, unsigned short v );
|
|
286
|
+ cmData_t* cmDataAllocInt( cmData_t* parent, int v );
|
|
287
|
+ cmData_t* cmDataAllocUInt( cmData_t* parent, unsigned int v );
|
|
288
|
+ cmData_t* cmDataAllocLong( cmData_t* parent, long v );
|
|
289
|
+ cmData_t* cmDataAllocULong( cmData_t* parent, unsigned long v );
|
|
290
|
+ cmData_t* cmDataAllocFloat( cmData_t* parent, float v );
|
|
291
|
+ cmData_t* cmDataAllocDouble( cmData_t* parent, double v );
|
241
|
292
|
|
242
|
293
|
// Dynamically allocate a data object and set its array value to an external
|
243
|
|
- // array. The data is not copied.
|
244
|
|
- cmData_t* cmDataAllocVoidPtr( const void* v, unsigned cnt );
|
245
|
|
- cmData_t* cmDataAllocCharPtr( const char* v, unsigned cnt );
|
246
|
|
- cmData_t* cmDataAllocUCharPtr( const unsigned char* v, unsigned cnt );
|
247
|
|
- cmData_t* cmDataAllocShortPtr( const short* v, unsigned cnt );
|
248
|
|
- cmData_t* cmDataAllocUShortPtr( const unsigned short* v, unsigned cnt );
|
249
|
|
- cmData_t* cmDataAllocIntPtr( const int* v, unsigned cnt );
|
250
|
|
- cmData_t* cmDataAllocUIntPtr( const unsigned int* v, unsigned cnt );
|
251
|
|
- cmData_t* cmDataAllocLongPtr( const long* v, unsigned cnt );
|
252
|
|
- cmData_t* cmDataAllocULongPtr( const unsigned long* v, unsigned cnt );
|
253
|
|
- cmData_t* cmDataAllocFloatPtr( const float* v, unsigned cnt );
|
254
|
|
- cmData_t* cmDataAllocDoublePtr( const double* v, unsigned cnt );
|
|
294
|
+ // array. v[cnt] is assigned as the internal data space for the object and
|
|
295
|
+ // therefore must remain valid for the life of the object.
|
|
296
|
+ // See the cmDataXXXAlocPtr() for equivalent functions which dynamically
|
|
297
|
+ // allocate the intenal data space.
|
|
298
|
+ cmData_t* cmDataAllocStr( cmData_t* parent, cmChar_t* str );
|
|
299
|
+ cmData_t* cmDataAllocConstStr( cmData_t* parent, const cmChar_t* str );
|
|
300
|
+ cmData_t* cmDataAllocCharPtr( cmData_t* parent, char* v, unsigned cnt );
|
|
301
|
+ cmData_t* cmDataAllocUCharPtr( cmData_t* parent, unsigned char* v, unsigned cnt );
|
|
302
|
+ cmData_t* cmDataAllocShortPtr( cmData_t* parent, short* v, unsigned cnt );
|
|
303
|
+ cmData_t* cmDataAllocUShortPtr( cmData_t* parent, unsigned short* v, unsigned cnt );
|
|
304
|
+ cmData_t* cmDataAllocIntPtr( cmData_t* parent, int* v, unsigned cnt );
|
|
305
|
+ cmData_t* cmDataAllocUIntPtr( cmData_t* parent, unsigned int* v, unsigned cnt );
|
|
306
|
+ cmData_t* cmDataAllocLongPtr( cmData_t* parent, long* v, unsigned cnt );
|
|
307
|
+ cmData_t* cmDataAllocULongPtr( cmData_t* parent, unsigned long* v, unsigned cnt );
|
|
308
|
+ cmData_t* cmDataAllocFloatPtr( cmData_t* parent, float* v, unsigned cnt );
|
|
309
|
+ cmData_t* cmDataAllocDoublePtr( cmData_t* parent, double* v, unsigned cnt );
|
|
310
|
+ cmData_t* cmDataAllocVoidPtr( cmData_t* parent, void* v, unsigned cnt );
|
255
|
311
|
|
256
|
312
|
|
257
|
313
|
// Dynamically allocate a data object and its array value.
|
258
|
|
- // v[cnt] is copied into the allocated array.
|
259
|
|
- cmData_t* cmDataVoidAllocPtr( const void* v, unsigned cnt );
|
260
|
|
- cmData_t* cmDataCharAllocPtr( const char* v, unsigned cnt );
|
261
|
|
- cmData_t* cmDataUCharAllocPtr( const unsigned char* v, unsigned cnt );
|
262
|
|
- cmData_t* cmDataShortAllocPtr( const short* v, unsigned cnt );
|
263
|
|
- cmData_t* cmDataUShortAllocPtr( const unsigned short* v, unsigned cnt );
|
264
|
|
- cmData_t* cmDataIntAllocPtr( const int* v, unsigned cnt );
|
265
|
|
- cmData_t* cmDataUIntAllocPtr( const unsigned int* v, unsigned cnt );
|
266
|
|
- cmData_t* cmDataLongAllocPtr( const long* v, unsigned cnt );
|
267
|
|
- cmData_t* cmDataULongAllocPtr( const unsigned long* v, unsigned cnt );
|
268
|
|
- cmData_t* cmDataFloatAllocPtr( const float* v, unsigned cnt );
|
269
|
|
- cmData_t* cmDataDoubleAllocPtr( const double* v, unsigned cnt );
|
|
314
|
+ // These functions dynamically allocate the internal array data space
|
|
315
|
+ // and copy v[cnt] into it.
|
|
316
|
+ cmData_t* cmDataStrAlloc( cmData_t* parent, cmChar_t* str );
|
|
317
|
+ cmData_t* cmDataConstStrAlloc( cmData_t* parent, const cmChar_t* str );
|
|
318
|
+ cmData_t* cmDataCharAllocPtr( cmData_t* parent, const char* v, unsigned cnt );
|
|
319
|
+ cmData_t* cmDataUCharAllocPtr( cmData_t* parent, const unsigned char* v, unsigned cnt );
|
|
320
|
+ cmData_t* cmDataShortAllocPtr( cmData_t* parent, const short* v, unsigned cnt );
|
|
321
|
+ cmData_t* cmDataUShortAllocPtr( cmData_t* parent, const unsigned short* v, unsigned cnt );
|
|
322
|
+ cmData_t* cmDataIntAllocPtr( cmData_t* parent, const int* v, unsigned cnt );
|
|
323
|
+ cmData_t* cmDataUIntAllocPtr( cmData_t* parent, const unsigned int* v, unsigned cnt );
|
|
324
|
+ cmData_t* cmDataLongAllocPtr( cmData_t* parent, const long* v, unsigned cnt );
|
|
325
|
+ cmData_t* cmDataULongAllocPtr( cmData_t* parent, const unsigned long* v, unsigned cnt );
|
|
326
|
+ cmData_t* cmDataFloatAllocPtr( cmData_t* parent, const float* v, unsigned cnt );
|
|
327
|
+ cmData_t* cmDataDoubleAllocPtr( cmData_t* parent, const double* v, unsigned cnt );
|
|
328
|
+ cmData_t* cmDataVoidAllocPtr( cmData_t* parent, const void* v, unsigned cnt );
|
270
|
329
|
|
271
|
330
|
//----------------------------------------------------------------------------
|
272
|
331
|
// Structure related functions
|
273
|
332
|
//
|
274
|
333
|
|
|
334
|
+ // Release an object and any resources held by it.
|
|
335
|
+ // Note the this function does not unlink the object
|
|
336
|
+ // from it's parent. Use cmDataUnlinkAndFree()
|
|
337
|
+ // to remove a object from it's parent list prior
|
|
338
|
+ // to releasing it.
|
|
339
|
+ void cmDataFree( cmData_t* p );
|
|
340
|
+
|
275
|
341
|
// Unlink 'p' from its parents and siblings.
|
276
|
342
|
// Asserts if parent is not a structure.
|
277
|
343
|
// Returns 'p'.
|
278
|
344
|
cmData_t* cmDataUnlink( cmData_t* p );
|
279
|
345
|
|
|
346
|
+ // Wrapper function to cmDataUnlink() and cmDataFree().
|
|
347
|
+ void cmDataUnlinkAndFree( cmData_t* p );
|
|
348
|
+
|
|
349
|
+ // Replace the 'dst' node with the 'src' node and
|
|
350
|
+ // return 'src'. This operation does not duplicate
|
|
351
|
+ // 'src' it simply links in 'src' at the location of
|
|
352
|
+ // 'dst' and then unlinks and free's 'dst'.
|
|
353
|
+ cmData_t* cmDataReplace( cmData_t* dst, cmData_t* src );
|
|
354
|
+
|
|
355
|
+ // Return the count of child nodes.
|
|
356
|
+ // 1. Array nodes have one child per array element.
|
|
357
|
+ // 2. List nodes have one child pair.
|
|
358
|
+ // 3. Pair nodes have two children.
|
|
359
|
+ // 4. Leaf nodes have 0 children.
|
280
|
360
|
unsigned cmDataChildCount( const cmData_t* p );
|
281
|
361
|
|
|
362
|
+ // Returns the ith child of 'p'.
|
282
|
363
|
// Returns NULL if p has no children or index is invalid.
|
283
|
364
|
cmData_t* cmDataChild( cmData_t* p, unsigned index );
|
284
|
365
|
|
285
|
366
|
// Prepend 'p' to 'parents' child list.
|
|
367
|
+ // The source node 'p' is not duplicated it is simply linked in.
|
|
368
|
+ // Returns 'p'.
|
286
|
369
|
cmData_t* cmDataPrependChild(cmData_t* parent, cmData_t* p );
|
287
|
370
|
|
288
|
371
|
// Append 'p' to the end of 'parent' child list.
|
|
372
|
+ // The source node 'p' is not duplicated it is simply linked in.
|
|
373
|
+ // Returns 'p'.
|
289
|
374
|
cmData_t* cmDataAppendChild( cmData_t* parent, cmData_t* p );
|
290
|
375
|
|
291
|
376
|
// Insert 'p' at index. Index must be in the range:
|
292
|
377
|
// 0 to cmDataChildCount(parent).
|
293
|
|
- cmData_t* cmDataInsertChild( cmData_t* parent, cmData_t* p, unsigned index );
|
|
378
|
+ // The source node 'p' is not duplicated it is simply linked in.
|
|
379
|
+ // Returns 'p'.
|
|
380
|
+ cmData_t* cmDataInsertChild( cmData_t* parent, unsigned index, cmData_t* p );
|
294
|
381
|
|
295
|
382
|
|
296
|
383
|
//----------------------------------------------------------------------------
|
|
@@ -298,32 +385,44 @@ extern "C" {
|
298
|
385
|
//
|
299
|
386
|
|
300
|
387
|
// Get the key/value of a pair
|
301
|
|
- cmData_t* cmDataPairKey( cmData_t* p );
|
302
|
|
- cmData_t* cmDataPairValue( cmData_t* p );
|
|
388
|
+ cmData_t* cmDataPairKey( cmData_t* p );
|
|
389
|
+ unsigned cmDataPairKeyId( cmData_t* p );
|
|
390
|
+ const cmChar_t* cmDataPairKeyLabel( cmData_t* p );
|
|
391
|
+
|
|
392
|
+ cmData_t* cmDataPairValue( cmData_t* p );
|
303
|
393
|
|
304
|
|
- // Set the key or value of an existing pair node.
|
|
394
|
+ // Set the value of an existing pair node.
|
|
395
|
+ // 'value' is not duplicated it is simply linked in place of the
|
|
396
|
+ // previous pair value node. The previous pair value node is
|
|
397
|
+ // unlinked and freed.
|
|
398
|
+ // Returns 'p'.
|
305
|
399
|
cmData_t* cmDataPairSetValue( cmData_t* p, cmData_t* value );
|
306
|
|
- cmData_t* cmDataPairAllocValue( cmData_t* p, const cmData_t* value );
|
307
|
400
|
|
|
401
|
+ // Set the key of an existing pair node.
|
|
402
|
+ //
|
|
403
|
+ // Returns 'p'.
|
308
|
404
|
cmData_t* cmDataPairSetKey( cmData_t* p, cmData_t* key );
|
309
|
405
|
cmData_t* cmDataPairSetKeyId( cmData_t* p, unsigned id );
|
|
406
|
+ // The data space for the 'label' string is dynamically allocated.
|
310
|
407
|
cmData_t* cmDataPairSetKeyLabel( cmData_t* p, const cmChar_t* label );
|
311
|
|
- cmData_t* cmDataPairAllocKey( cmData_t* p, const cmData_t* key );
|
|
408
|
+
|
|
409
|
+ cmData_t* cmDataMakePair( cmData_t* parent, cmData_t* p, cmData_t* key, cmData_t* value );
|
312
|
410
|
|
313
|
411
|
// Dynamically allocate a pair node
|
314
|
412
|
cmData_t* cmDataAllocPair( cmData_t* parent, const cmData_t* key, const cmData_t* value );
|
315
|
|
- cmData_t* cmDataAllocPairId( cmData_t* parent, unsigned keyId, cmData_t* value );
|
316
|
|
- cmData_t* cmDataAllocPairLabel( cmData_t* parent, const cmChar_t label, cmData_t* value );
|
|
413
|
+ cmData_t* cmDataAllocPairId( cmData_t* parent, unsigned keyId, cmData_t* value );
|
|
414
|
+ // The data space for the 'label' string is dynamically allocated.
|
|
415
|
+ cmData_t* cmDataAllocPairLabel( cmData_t* parent, const cmChar_t* label, cmData_t* value );
|
317
|
416
|
|
318
|
417
|
//----------------------------------------------------------------------------
|
319
|
418
|
// List related functions
|
320
|
419
|
//
|
321
|
420
|
|
322
|
421
|
// Return the count of ele's in the list.
|
323
|
|
- cmData_t* cmDataListCount( const cmData_t* p );
|
|
422
|
+ unsigned cmDataListCount( const cmData_t* p );
|
324
|
423
|
|
325
|
424
|
// Return the ith element in the list.
|
326
|
|
- cmData_t* cmDataListEle( const cmData_t* p, unsigned index );
|
|
425
|
+ cmData_t* cmDataListEle( cmData_t* p, unsigned index );
|
327
|
426
|
|
328
|
427
|
cmData_t* cmDataListMake( cmData_t* parent, cmData_t* p );
|
329
|
428
|
cmData_t* cmDataListAlloc( cmData_t* parent);
|
|
@@ -332,22 +431,22 @@ extern "C" {
|
332
|
431
|
// Var-args fmt:
|
333
|
432
|
// <typeId> <value> {<cnt>}
|
334
|
433
|
// scalar types: <value> is literal,<cnt> is not included
|
|
434
|
+ // null has no <value> or <cnt>
|
335
|
435
|
// ptr types: <value> is pointer,<cnt> is element count
|
336
|
436
|
// struct types: <value> is cmData_t, <cnt> is not included
|
|
437
|
+ // Indicate the end of argument list by setting <typeId> to kInvalidDtId.
|
|
438
|
+ // The memory for array based data types is dynamically allocated.
|
337
|
439
|
cmData_t* cmDataListAllocV(cmData_t* parent, va_list vl );
|
338
|
440
|
cmData_t* cmDataListAllocA(cmData_t* parent, ... );
|
339
|
441
|
|
340
|
|
-
|
|
442
|
+ // Returns a ptr to 'ele'.
|
341
|
443
|
cmData_t* cmDataListAppendEle( cmData_t* p, cmData_t* ele );
|
342
|
|
- cmData_t* cmDataListAppendEleN(cmData_t* p, cmData_t* ele[], unsigned n );
|
343
|
444
|
cmDtRC_t cmDataListAppendV( cmData_t* p, va_list vl );
|
344
|
445
|
cmDtRC_t cmDataListAppend( cmData_t* p, ... );
|
345
|
446
|
|
|
447
|
+ // Return 'p'.
|
346
|
448
|
cmData_t* cmDataListInsertEle( cmData_t* p, unsigned index, cmData_t* ele );
|
347
|
|
- cmData_t* cmDataListInsertEleN(cmData_t* p, cmData_t* ele[], unsigned n );
|
348
|
|
- cmDtRC_t cmDataListInsertV( cmData_t* p, va_list vl );
|
349
|
|
- cmDtRC_t cmDataListInsert( cmData_t* p, unsigned index, ... );
|
350
|
|
-
|
|
449
|
+ cmData_t* cmDataListInsertEleN(cmData_t* p, unsigned index, cmData_t* ele[], unsigned n );
|
351
|
450
|
|
352
|
451
|
cmData_t* cmDataListUnlink( cmData_t* p, unsigned index );
|
353
|
452
|
cmData_t* cmDataListFree( cmData_t* p, unsigned index );
|
|
@@ -357,26 +456,42 @@ extern "C" {
|
357
|
456
|
//
|
358
|
457
|
|
359
|
458
|
// Return count of pairs.
|
360
|
|
- cmData_t* cmDataRecdCount( const cmData_t* p );
|
|
459
|
+ unsigned cmDataRecdCount( const cmData_t* p );
|
361
|
460
|
|
362
|
461
|
// Return the ith pair.
|
363
|
|
- cmData_t* cmDataRecdEle( const cmData_t* p, unsigned index );
|
|
462
|
+ cmData_t* cmDataRecdEle( cmData_t* p, unsigned index );
|
364
|
463
|
|
365
|
464
|
// Return the ith value.
|
366
|
|
- cmData_t* cmDataRecdValue( const cmData_t* p, unsigned index );
|
|
465
|
+ cmData_t* cmDataRecdValueFromIndex( cmData_t* p, unsigned index );
|
|
466
|
+ cmData_t* cmDataRecdValueFromId( cmData_t* p, unsigned id );
|
|
467
|
+ cmData_t* cmDataRecdValueFromLabel( cmData_t* p, const cmChar_t* label );
|
367
|
468
|
|
368
|
469
|
// Return the ith key
|
369
|
|
- cmData_t* cmDataRecdKey( const cmData_t* p, unsigned index );
|
370
|
|
- unsigned cmDataRecdKeyId( const cmData_t* p, unsigned index );
|
371
|
|
- const cmChar_t* cmDataRecdKeyLabel( const cmData_t* p, unsigned index );
|
|
470
|
+ cmData_t* cmDataRecdKey( cmData_t* p, unsigned index );
|
|
471
|
+ unsigned cmDataRecdKeyId( cmData_t* p, unsigned index );
|
|
472
|
+ const cmChar_t* cmDataRecdKeyLabel( cmData_t* p, unsigned index );
|
372
|
473
|
|
373
|
|
- cmData_t* cmRecdMake( cmData_t* p );
|
374
|
|
- cmData_t* cmRecdAlloc();
|
|
474
|
+ cmData_t* cmRecdMake( cmData_t* parent, cmData_t* p );
|
|
475
|
+ cmData_t* cmRecdAlloc( cmData_t* parent );
|
375
|
476
|
|
|
477
|
+ cmData_t* cmRecdAppendPair( cmData_t* p, cmData_t* pair );
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+ // Var-args fmt:
|
|
481
|
+ // <label|id> <typeId> <value> {<cnt>}
|
|
482
|
+ // scalar types: <value> is literal,<cnt> is not included
|
|
483
|
+ // null has no <value> or <cnt>
|
|
484
|
+ // ptr types: <value> is pointer,<cnt> is element count
|
|
485
|
+ // struct types: <value> is cmData_t, <cnt> is not included
|
|
486
|
+ // Indicate the end of argument list by setting <typeId> to kInvalidDtId.
|
|
487
|
+ // The memory for array based data types is dynamically allocated.
|
|
488
|
+ cmData_t* cmDataRecdAllocLabelV( cmData_t* parent, va_list vl );
|
|
489
|
+ cmData_t* cmDataRecdAllocLabelA( cmData_t* parent, ... );
|
376
|
490
|
|
|
491
|
+ cmData_t* cmDataRecdAllocIdV( cmData_t* parent, va_list vl );
|
|
492
|
+ cmData_t* cmDataRecdAllocIdA( cmData_t* parent, ... );
|
377
|
493
|
|
378
|
494
|
|
379
|
|
- void cmDataFree( cmData_t* p );
|
380
|
495
|
|
381
|
496
|
|
382
|
497
|
unsigned cmDataSerializeByteCount( const cmData_t* p );
|