[go: up one dir, main page]

Menu

[9c90d7]: / src / dvutil.c  Maximize  Restore  History

Download this file

694 lines (630 with data), 25.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
/*
* Copyright (C) 2006 Bill Cox
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
*/
/*--------------------------------------------------------------------------------------------------
Random support functions.
--------------------------------------------------------------------------------------------------*/
#include <ctype.h>
#include "dv.h"
/*--------------------------------------------------------------------------------------------------
Find the module from the prefix.
--------------------------------------------------------------------------------------------------*/
dvModule dvFindModuleFromPrefix(
utSym prefix)
{
dvModule module;
dvForeachRootModule(dvTheRoot, module) {
if(dvModuleGetPrefixSym(module) == prefix) {
return module;
}
} dvEndRootModule;
return dvModuleNull;
}
/*--------------------------------------------------------------------------------------------------
Find out how many args are used in a template.
--------------------------------------------------------------------------------------------------*/
static uint32 countArgs(
char *temp)
{
char c;
uint32 maxArg = 0, xArg;
while (*temp) {
c = *temp++;
if (c == '%') {
c = *temp;
if (c == 'l' || c == 'u' || c == 'c') {
temp++;
c = *temp;
}
if(isdigit((unsigned char)c)) {
temp++;
xArg = c - '0';
if (xArg >= maxArg) {
maxArg = xArg + 1;
}
} else if (c == '%') {
temp++;
}
}
}
return maxArg;
}
/*--------------------------------------------------------------------------------------------------
This code manages a simple string buffer.
--------------------------------------------------------------------------------------------------*/
static char *prStringBuffer;
static uint32 prStringBufferSize;
static uint32 prStringBufferPosition;
/*--------------------------------------------------------------------------------------------------
Append a string to the string buffer.
--------------------------------------------------------------------------------------------------*/
static void appendString(
char *string)
{
uint32 length = strlen(string);
if(prStringBufferPosition + length + 1 >= prStringBufferSize) {
prStringBufferSize = ((prStringBufferPosition + length + 1)*3) >> 1;
utResizeArray(prStringBuffer, prStringBufferSize);
}
strcpy(prStringBuffer + prStringBufferPosition, string);
prStringBufferPosition += length;
}
/*--------------------------------------------------------------------------------------------------
Append a character to the string buffer.
--------------------------------------------------------------------------------------------------*/
static void appendChar(
char c)
{
char string[2];
string[0] = c;
string[1] = '\0';
appendString(string);
}
/*--------------------------------------------------------------------------------------------------
Initialize the utility module, allocating buffers.
--------------------------------------------------------------------------------------------------*/
void prUtilStart(void)
{
prStringBufferSize = 42;
prStringBuffer = utNewA(char, prStringBufferSize);
prStringBufferPosition = 0;
}
/*--------------------------------------------------------------------------------------------------
Free memory used by the utility module.
--------------------------------------------------------------------------------------------------*/
void prUtilStop(void)
{
utFree(prStringBuffer);
}
/*--------------------------------------------------------------------------------------------------
Write a template to a string.
--------------------------------------------------------------------------------------------------*/
static void wrtemp(
char *temp,
va_list ap)
{
uint32 sArg = countArgs(temp), xArg;
char *(args[10]);
char *string, *arg;
char c;
bool lowerCase = false, upperCase = false, caps = false;
prStringBufferPosition = 0;
prStringBuffer[0] = '\0';
for (xArg = 0; xArg < sArg; xArg++) {
args[xArg] = va_arg(ap, char *);
}
string = temp;
while (*string) {
c = *string++;
if (c == '%') {
c = *string;
if(c == 'l') {
lowerCase = true;
c = *++string;
} else if(c == 'u') {
upperCase = true;
c = *++string;
} else if(c == 'c') {
caps = true;
c = *++string;
}
if(isdigit((unsigned char)c)) {
string++;
xArg = c - '0';
if(xArg >= sArg) {
utExit("exWrtemp: not enough args");
}
if (*args[xArg]) {
if(lowerCase) {
appendChar((char)tolower((unsigned char)*(args[xArg])));
appendString((args[xArg]) + 1);
lowerCase = false;
} else if(upperCase) {
appendChar((char)toupper((unsigned char)*(args[xArg])));
appendString((args[xArg]) + 1);
upperCase = false;
} else if(caps) {
arg = args[xArg];
while(*arg) {
appendChar((char)toupper((unsigned char)*arg));
arg++;
}
caps = false;
} else {
appendString(args[xArg]);
}
}
} else if (c == '%') {
string++;
appendChar('%');
}
} else {
appendChar(c);
}
}
}
/*--------------------------------------------------------------------------------------------------
Write a template to a string.
--------------------------------------------------------------------------------------------------*/
char *dvSwrtemp(
char *temp,
...)
{
va_list ap;
va_start(ap, temp);
wrtemp(temp, ap);
va_end(ap);
return utCopyString(prStringBuffer);
}
/*--------------------------------------------------------------------------------------------------
Write a template to a string.
--------------------------------------------------------------------------------------------------*/
void dvWrtemp(
FILE *file,
char *temp,
...)
{
va_list ap;
va_start(ap, temp);
wrtemp(temp, ap);
va_end(ap);
fputs(prStringBuffer, file);
}
/*--------------------------------------------------------------------------------------------------
Get the property type name.
--------------------------------------------------------------------------------------------------*/
char *dvPropertyGetTypeName(
dvProperty property)
{
dvClass theClass;
dvEnum theEnum;
dvTypedef theTypedef;
switch(dvPropertyGetType(property)) {
case PROP_INT: return utSprintf("int%u", dvPropertyGetWidth(property));
case PROP_UINT: return utSprintf("uint%u", dvPropertyGetWidth(property));
case PROP_FLOAT: return "float";
case PROP_DOUBLE: return "double";
case PROP_BIT: case PROP_BOOL:
return "uint8";
case PROP_CHAR: return "char";
case PROP_SYM: return "utSym";
case PROP_ENUM:
theEnum = dvPropertyGetEnumProp(property);
return utSprintf("%s%s", dvModuleGetPrefix(dvEnumGetModule(theEnum)),
dvEnumGetName(theEnum));
case PROP_TYPEDEF: return dvTypedefGetName(dvPropertyGetTypedefProp(property));
theTypedef = dvPropertyGetTypedefProp(property);
return utSprintf("%s%s", dvModuleGetPrefix(dvTypedefGetModule(theTypedef)),
dvTypedefGetName(theTypedef));
case PROP_POINTER:
theClass = dvPropertyGetClassProp(property);
return utSprintf("%s%s", dvClassGetPrefix(theClass), dvClassGetName(theClass));
default:
utExit("Unknown property type");
}
return NULL; /* Dummy return */
}
/*--------------------------------------------------------------------------------------------------
Get the property type name as a utility library field type.
--------------------------------------------------------------------------------------------------*/
char *dvPropertyGetFieldTypeName(
dvProperty property)
{
switch(dvPropertyGetType(property)) {
case PROP_INT: return "UT_INT";
case PROP_UINT: return "UT_UINT";
case PROP_FLOAT: return "UT_FLOAT";
case PROP_DOUBLE: return "UT_DOUBLE";
case PROP_BIT: return "UT_BIT";
case PROP_BOOL: return "UT_BOOL";
case PROP_CHAR: return "UT_CHAR";
case PROP_SYM: return "UT_SYM";
case PROP_ENUM: return "UT_ENUM";
case PROP_TYPEDEF: return "UT_TYPEDEF";
case PROP_POINTER: return "UT_POINTER";
default:
utExit("Unknown property type");
}
return NULL; /* Dummy return */
}
/*--------------------------------------------------------------------------------------------------
Find a hash summary of the enumerated type.
--------------------------------------------------------------------------------------------------*/
static uint32 findEnumHash(
dvEnum theEnum)
{
dvEntry entry;
uint32 hash = utSymGetHashValue(dvEnumGetSym(theEnum));
hash = utHashValues(hash, utSymGetHashValue(dvEnumGetPrefixSym(theEnum)));
dvForeachEnumEntry(theEnum, entry) {
hash ^= utSymGetHashValue(dvEntryGetSym(entry));
} dvEndEnumEntry;
return hash;
}
/*--------------------------------------------------------------------------------------------------
Find a hash signature for the class.
--------------------------------------------------------------------------------------------------*/
static uint32 findPropertyHash(
dvProperty property)
{
uint32 hash = utSymGetHashValue(dvPropertyGetSym(property));
hash = utHashValues(hash, dvPropertyGetType(property));
hash = utHashValues(hash, dvPropertyArray(property));
switch(dvPropertyGetType(property)) {
case PROP_INT:
case PROP_UINT:
hash = utHashValues(hash, dvPropertyGetWidth(property));
break;
case PROP_FLOAT:
case PROP_DOUBLE:
case PROP_BIT:
case PROP_BOOL:
case PROP_CHAR:
case PROP_SYM:
break;
case PROP_ENUM:
hash = utHashValues(hash, utSymGetHashValue(dvEnumGetSym(dvPropertyGetEnumProp(property))));
break;
case PROP_TYPEDEF:
hash = utHashValues(hash, utSymGetHashValue(dvTypedefGetSym(dvPropertyGetTypedefProp(property))));
break;
case PROP_POINTER:
hash = utHashValues(hash, utSymGetHashValue(dvClassGetSym(dvPropertyGetClassProp(property))));
break;
default:
utExit("Unknown property type");
}
return hash;
}
/*--------------------------------------------------------------------------------------------------
Find a hash signature for the union.
--------------------------------------------------------------------------------------------------*/
static uint32 findUnionHash(
dvUnion theUnion)
{
dvProperty property;
uint32 hash = 0;
dvForeachUnionProperty(theUnion, property) {
hash ^= utSymGetHashValue(dvPropertyGetSym(property));
} dvEndUnionProperty;
return hash;
}
/*--------------------------------------------------------------------------------------------------
Find a hash signature for the relationship.
--------------------------------------------------------------------------------------------------*/
static uint32 findRelationshipHash(
dvRelationship relationship)
{
uint32 hash = utSymGetHashValue(dvClassGetSym(dvRelationshipGetParentClass(relationship)));
hash = utHashValues(hash, utSymGetHashValue(dvClassGetSym(dvRelationshipGetChildClass(relationship))));
hash = utHashValues(hash, dvRelationshipGetType(relationship));
hash = utHashValues(hash, utSymGetHashValue(dvRelationshipGetParentLabelSym(relationship)));
hash = utHashValues(hash, utSymGetHashValue(dvRelationshipGetChildLabelSym(relationship)));
hash = utHashValues(hash, dvRelationshipMandatory(relationship));
hash = utHashValues(hash, dvRelationshipCascade(relationship));
hash = utHashValues(hash, dvRelationshipAccessChild(relationship));
hash = utHashValues(hash, dvRelationshipAccessParent(relationship));
return hash;
}
/*--------------------------------------------------------------------------------------------------
Find a hash signature for the class.
--------------------------------------------------------------------------------------------------*/
static uint32 findClassHash(
dvClass theClass)
{
dvProperty property;
dvUnion theUnion;
dvRelationship relationship;
uint32 hash = utSymGetHashValue(dvClassGetSym(theClass));
if(dvClassGetBaseClass(theClass) != dvClassNull) {
hash = utHashValues(hash, utSymGetHashValue(dvClassGetSym(dvClassGetBaseClass(theClass))));
}
hash = utHashValues(hash, dvClassGetMemoryStyle(theClass));
hash = utHashValues(hash, dvClassGetReferenceSize(theClass));
dvForeachClassProperty(theClass, property) {
hash ^= findPropertyHash(property);
} dvEndClassProperty;
dvForeachClassUnion(theClass, theUnion) {
hash ^= findUnionHash(theUnion);
} dvEndClassUnion;
dvForeachClassChildRelationship(theClass, relationship) {
hash ^= findRelationshipHash(relationship);
} dvEndClassChildRelationship;
return hash;
}
/*--------------------------------------------------------------------------------------------------
Find a hash summary of the entire module.
--------------------------------------------------------------------------------------------------*/
static uint32 findModuleHash(
dvModule module)
{
dvEnum theEnum;
dvClass theClass;
dvTypedef theTypedef;
uint32 hash = utSymGetHashValue(dvModuleGetSym(module));
hash = utHashValues(hash, dvModulePersistent(module));
hash = utHashValues(hash, utSymGetHashValue(dvModuleGetPrefixSym(module)));
dvForeachModuleEnum(module, theEnum) {
hash ^= findEnumHash(theEnum);
} dvEndModuleEnum;
dvForeachModuleTypedef(module, theTypedef) {
hash ^= utSymGetHashValue(dvTypedefGetSym(theTypedef));
} dvEndModuleTypedef;
dvForeachModuleClass(module, theClass) {
hash ^= findClassHash(theClass);
} dvEndModuleClass;
return hash;
}
/*--------------------------------------------------------------------------------------------------
Compute a hash value that depends on every aspect of the database. Two databases with the same
hash value should be 100% compatible.
--------------------------------------------------------------------------------------------------*/
uint32 dvComputeDatabaseHash(void)
{
dvModule module;
uint32 hash = 0;
dvForeachRootModule(dvTheRoot, module) {
hash ^= findModuleHash(module);
} dvEndRootModule;
return hash;
}
/*--------------------------------------------------------------------------------------------------
Find the module prefix to use for the class. It is the prefix of the base class, if defined,
otherwise the prefix of the owning module.
--------------------------------------------------------------------------------------------------*/
char *dvClassGetPrefix(
dvClass theClass)
{
dvClass baseClass;
utDo {
baseClass = dvClassGetBaseClass(theClass);
} utWhile(baseClass != dvClassNull) {
theClass = baseClass;
} utRepeat;
return dvModuleGetPrefix(dvClassGetModule(theClass));
}
/*--------------------------------------------------------------------------------------------------
Find the module prefix to use for the property. It is the prefix of the owning module which
can be different from the prefix of the owningClass
--------------------------------------------------------------------------------------------------*/
char *dvPropertyGetPrefix(
dvProperty property)
{
return dvModuleGetPrefix(dvClassGetModule(dvPropertyGetClass(property)));
}
/*--------------------------------------------------------------------------------------------------
Return a symbol with the same name, but the first letter capitalized.
--------------------------------------------------------------------------------------------------*/
utSym dvUpperSym(
utSym sym)
{
char *name;
if(sym == utSymNull) {
return utSymNull;
}
name = utCopyString(utSymGetName(sym));
*name = toupper((unsigned char)*name);
return utSymCreate(name);
}
/*--------------------------------------------------------------------------------------------------
Return the format string for printing a property value.
--------------------------------------------------------------------------------------------------*/
char *dvFindPropertyFormatString(
dvProperty property)
{
switch(dvPropertyGetType(property)) {
case PROP_INT: return "%d";
case PROP_UINT: return "%u";
case PROP_FLOAT: return "%g";
case PROP_DOUBLE: return "%g";
case PROP_BIT: return "%u";
case PROP_BOOL: return "%u";
case PROP_CHAR:
if(dvPropertyArray(property)) {
return "\\\"%s\\\"";
}
return "%c";
case PROP_SYM: return "0x%x \\\"%s\\\"";
case PROP_ENUM: return "%u";
case PROP_TYPEDEF:
return "???";
case PROP_POINTER: return "0x%x";
default:
utExit("Unknown property type");
}
return NULL; /* Dummy return */
}
/*--------------------------------------------------------------------------------------------------
Just return a string representing the object reference type.
--------------------------------------------------------------------------------------------------*/
char *dvClassGetReferenceTypeName(
dvClass theClass)
{
return utSprintf("uint%u", dvClassGetReferenceSize(theClass));
}
/*--------------------------------------------------------------------------------------------------
Just determine if any class in the module was declared with the "attributes" class option.
--------------------------------------------------------------------------------------------------*/
bool dvModuleHasClassAttributes(
dvModule module)
{
dvClass theClass;
dvForeachModuleClass(module, theClass) {
if(dvClassGenerateAttributes(theClass)) {
return true;
}
} dvEndModuleClass;
return false;
}
/*--------------------------------------------------------------------------------------------------
Determine if this is a name-based hash relationship.
--------------------------------------------------------------------------------------------------*/
bool dvRelationshipHashedByName(
dvRelationship relationship)
{
dvProperty property;
dvKey key = dvRelationshipGetFirstKey(relationship);
dvKeyproperty keyproperty = dvKeyGetFirstKeyproperty(key);
if(dvKeyGetNextRelationshipKey(key) != dvKeyNull) {
return false;
}
if(dvKeypropertyGetNextKeyKeyproperty(keyproperty) != dvKeypropertyNull) {
return false;
}
property = dvKeypropertyGetProperty(key);
if(strcmp(dvPropertyGetName(property), utSprintf("%sSym", dvRelationshipGetChildLabel(relationship)))) {
return false;
}
return dvPropertyGetType(property) == PROP_SYM;
}
/*--------------------------------------------------------------------------------------------------
Find the initial value for a property.
--------------------------------------------------------------------------------------------------*/
char *dvPropertyFindInitializer(
dvProperty property)
{
dvPropertyType type = dvPropertyGetType(property);
dvTypedef theTypedef;
dvEnum theEnum;
if(dvPropertyGetNumInitializer(property) != 0) {
return dvPropertyGetInitializer(property);
}
if(type == PROP_POINTER) {
return utSprintf("%s%sNull", dvClassGetPrefix(dvPropertyGetClassProp(property)),
dvClassGetName(dvPropertyGetClassProp(property)));
} else if(type == PROP_SYM) {
return "utSymNull";
} else if(type == PROP_TYPEDEF) {
theTypedef = dvPropertyGetTypedefProp(property);
if(dvTypedefGetNumInitializer(theTypedef) != 0) {
return dvTypedefGetInitializer(theTypedef);
}
} else if(type == PROP_ENUM) {
theEnum = dvPropertyGetEnumProp(property);
return utSprintf("%s%s", utSymGetName(dvEnumGetPrefixSym(theEnum)), dvEntryGetName(dvEnumGetFirstEntry(theEnum)));
}
return "0";
}
/*--------------------------------------------------------------------------------------------------
Format a access function for just this property.
--------------------------------------------------------------------------------------------------*/
char *dvPropertyGetAccessMacro(
dvProperty property,
bool useParamName,
char * param)
{
dvClass childClass = dvPropertyGetClass(property);
dvPropertyType type = dvPropertyGetType(property);
char *accessMacro;
if(useParamName) {
accessMacro = dvPropertyGetName(property);
} else {
if(!dvPropertyArray(property) && (type == PROP_BOOL || type == PROP_BIT)) {
accessMacro = utSprintf("%s%s%s(%s)", dvPropertyGetPrefix(property), dvClassGetName(childClass),
dvPropertyGetName(property), param);
} else {
accessMacro = utSprintf("%s%sGet%s(%s)", dvPropertyGetPrefix(property), dvClassGetName(childClass),
dvPropertyGetName(property), param);
}
}
return accessMacro;
}
/*--------------------------------------------------------------------------------------------------
Format a length function for just this property.
--------------------------------------------------------------------------------------------------*/
char *dvPropertyGetLengthMacro(
dvProperty property,
bool useParamName,
char * param)
{
dvClass childClass = dvPropertyGetClass(property);
char *lengthMacro;
if(useParamName) {
if(!dvPropertyFixedSize(property)) {
lengthMacro = utSprintf("%sLength", dvPropertyGetName(property));
} else {
lengthMacro = utSprintf("(%s)", dvPropertyGetIndex(property));
}
} else {
if(!dvPropertyFixedSize(property)) {
lengthMacro = utSprintf("%s%sGetNum%s(%s)", dvPropertyGetPrefix(property), dvClassGetName(childClass),
dvPropertyGetName(property), param);
} else {
lengthMacro = utSprintf("(%s)", dvPropertyGetIndex(property));
}
}
return lengthMacro;
}
/*--------------------------------------------------------------------------------------------------
Format a access function for just this key.
--------------------------------------------------------------------------------------------------*/
char *dvKeyGetAccessMacro(
dvKey key,
bool useParamName,
char * param)
{
dvKeyproperty keyproperty = dvKeyGetLastKeyproperty(key);
dvProperty property = dvKeypropertyGetProperty(keyproperty);
char *accessMacro = param;
dvForeachKeyKeyproperty(key, keyproperty) {
property = dvKeypropertyGetProperty(keyproperty);
accessMacro = dvPropertyGetAccessMacro(property, useParamName, accessMacro);
} dvEndKeyKeyproperty;
return accessMacro;
}
/*--------------------------------------------------------------------------------------------------
Format a length function for just this key.
--------------------------------------------------------------------------------------------------*/
char *dvKeyGetLengthMacro(
dvKey key,
bool useParamName,
char *param)
{
dvKeyproperty keyproperty = dvKeyGetLastKeyproperty(key);
dvProperty property = dvKeypropertyGetProperty(keyproperty);
char *lengthMacro = param;
dvForeachKeyKeyproperty(key, keyproperty) {
property = dvKeypropertyGetProperty(keyproperty);
if(dvKeypropertyGetNextKeyKeyproperty(keyproperty) != dvKeypropertyNull) {
lengthMacro = dvPropertyGetAccessMacro(property, useParamName, lengthMacro);
}
else {
lengthMacro = dvPropertyGetLengthMacro(property, useParamName, lengthMacro);
}
} dvEndKeyKeyproperty;
return lengthMacro;
}