23 char *indexMaxStr =
"INDEX_MAX";
24 char *uriMaxStr =
"URI_MAX";
25 char *lnMaxStr =
"LN_MAX";
29 strcpy(indexStrings->
typeIdStr, indexMaxStr);
37 strcpy(indexStrings->
uriIdStr, uriMaxStr);
45 strcpy(indexStrings->
lnIdStr, lnMaxStr);
55 Index charIter, charMax;
61 fprintf(out,
"CONST CharType %s[] = {", varName);
62 for(charIter = 0; charIter < charMax; charIter++)
64 fprintf(out,
"0x%x", str->
str[charIter]);
65 if(charIter < charMax - 1)
68 strncpy(displayStr, str->
str, str->
length);
69 displayStr[str->
length] =
'\0';
70 fprintf(out,
"}; /* %s */\n", displayStr);
76 Index uriIter, pfxIter, lnIter;
79 fprintf(out,
"/** START_STRINGS_DEFINITONS */\n\n");
81 for(uriIter = 0; uriIter < uriTbl->
count; uriIter++)
84 sprintf(varName,
"%sURI_%u", prefix, (
unsigned int) uriIter);
90 sprintf(varName,
"%sPFX_%u_%u", prefix, (
unsigned int) uriIter, (
unsigned int) pfxIter);
97 sprintf(varName,
"%sLN_%u_%u", prefix, (
unsigned int) uriIter, (
unsigned int) lnIter);
102 fprintf(out,
"\n/** END_STRINGS_DEFINITONS */\n\n");
112 for(ruleIter = 0; ruleIter < gr->
count; ruleIter++)
117 sprintf(varName,
"%sprod_%u_%u", prefix, (
unsigned int) grId, (
unsigned int) ruleIter);
119 fprintf(out,
"static CONST Production %s[%u] =\n{\n", varName, (
unsigned int) gr->
rule[ruleIter].
pCount);
121 for(prodIter = 0; prodIter < gr->
rule[ruleIter].
pCount; prodIter++)
123 setProdStrings(&indexStrings, &gr->
rule[ruleIter].
production[prodIter]);
125 " {\n %u, %s,\n {%s, %s}}%s",
130 prodIter==(gr->
rule[ruleIter].
pCount - 1) ?
"\n};\n\n" :
",\n");
141 "static CONST GrammarRule %srule_%u[%u] =\n{",
144 (
unsigned int) gr->
count);
146 for(ruleIter = 0; ruleIter < gr->
count; ruleIter++)
148 fprintf(out,
"\n {");
155 (
unsigned int) ruleIter);
158 fprintf(out,
"NULL, ");
160 fprintf(out,
"%u, ", (
unsigned int) gr->
rule[ruleIter].
pCount);
161 fprintf(out,
"%u", (
unsigned int) gr->
rule[ruleIter].
meta);
162 fprintf(out,
"}%s", ruleIter != (gr->
count-1)?
",":
"");
166 fprintf(out,
"\n};\n\n");
177 sprintf(varNameContent,
"%sprod_doc_content", prefix);
181 fprintf(out,
"static CONST Production %s[%u] =\n{\n", varNameContent, (
unsigned int) docGr->
rule[
GR_DOC_CONTENT].
pCount);
185 setProdStrings(&indexStrings, &docGr->
rule[GR_DOC_CONTENT].
production[prodIter]);
187 " {\n %u, %s,\n {%s, %s}}%s",
192 prodIter==(docGr->
rule[GR_DOC_CONTENT].
pCount - 1) ?
"\n};\n\n" :
",\n");
196 sprintf(varNameEnd,
"%sprod_doc_end", prefix);
200 fprintf(out,
"static CONST Production %s[%u] =\n{\n", varNameEnd, 1);
201 fprintf(out,
" {\n 0xAFFFFFF, INDEX_MAX,\n {URI_MAX, LN_MAX}}\n};\n\n");
204 fprintf(out,
"static CONST GrammarRule %sdocGrammarRule[2] =\n{\n", prefix);
205 fprintf(out,
" {%s, %u, 0},\n\
206 {%s, 1, 0}\n};\n\n", varNameContent, (
unsigned int) docGr->
rule[GR_DOC_CONTENT].
pCount, varNameEnd);
212 if(pfxTbl->
count > 0)
214 fprintf(out,
"static CONST String %sPfxEntry_%u[%u] =\n{\n", prefix, (
unsigned int) uriId, (
unsigned int) pfxTbl->
count + dvis.
pfx);
216 for(pfxIter = 0; pfxIter < pfxTbl->
count; pfxIter++)
219 fprintf(out,
" {%sPFX_%u_%u, %u}%s", prefix, (
unsigned int) uriId, (
unsigned int) pfxIter, (
unsigned int) pfxTbl->
pfx[pfxIter].
length,
220 pfxIter==pfxTbl->
count + dvis.
pfx - 1?
"\n};\n\n" :
",\n");
222 fprintf(out,
" {NULL, 0}%s", pfxIter==pfxTbl->
count + dvis.
pfx - 1?
"\n};\n\n" :
",\n");
225 for(pfxIter = 0; pfxIter < dvis.
pfx; pfxIter++)
227 fprintf(out,
" {NULL, 0}%s", pfxIter==dvis.
pfx - 1?
"\n};\n\n" :
",\n");
240 fprintf(out,
"static CONST LnEntry %sLnEntry_%u[%u] =\n{\n", prefix, (
unsigned int) uriId, (
unsigned int) lnTbl->
count + dvis.
ln);
242 for(lnIter = 0; lnIter < lnTbl->
count; lnIter++)
245 strcpy(elemGrammar,
"INDEX_MAX");
247 sprintf(elemGrammar,
"%u", (
unsigned int) lnTbl->
ln[lnIter].
elemGrammar);
250 strcpy(typeGrammar,
"INDEX_MAX");
252 sprintf(typeGrammar,
"%u", (
unsigned int) lnTbl->
ln[lnIter].
typeGrammar);
254 fprintf(out,
" {\n#if VALUE_CROSSTABLE_USE\n NULL,\n#endif\n");
256 fprintf(out,
" {%sLN_%u_%u, %u},\n %s, %s\n", prefix, (
unsigned int) uriId, (
unsigned int) lnIter, (
unsigned int) lnTbl->
ln[lnIter].
lnStr.
length, elemGrammar, typeGrammar);
258 fprintf(out,
" {NULL, 0},\n %s, %s\n", elemGrammar, typeGrammar);
259 fprintf(out,
"%s", lnIter==(lnTbl->
count-1) + dvis.
ln?
" }\n};\n\n":
" },\n");
262 strcpy(elemGrammar,
"INDEX_MAX");
263 strcpy(typeGrammar,
"INDEX_MAX");
265 for(lnIter = 0; lnIter < dvis.
ln; lnIter++)
267 fprintf(out,
" {\n#if VALUE_CROSSTABLE_USE\n NULL,\n#endif\n");
268 fprintf(out,
" {NULL, 0},\n %s, %s\n", elemGrammar, typeGrammar);
269 fprintf(out,
"%s", lnIter==dvis.
ln - 1?
" }\n};\n\n":
" },\n");
277 fprintf(out,
"static CONST UriEntry %suriEntry[%u] =\n{\n", prefix, (
unsigned int) uriTbl->
count + dvis.
url);
279 for(uriIter = 0; uriIter < uriTbl->
count; uriIter++)
284 " {\n {{sizeof(LnEntry), %u, %u}, %sLnEntry_%u, %u},\n",
288 (
unsigned int) uriIter,
293 fprintf(out,
" {\n {{sizeof(LnEntry), %d, %d}, NULL, 0},\n", 0, 0);
298 fprintf(out,
" {{sizeof(String), %u, %u}, %sPfxEntry_%u, %u},\n",
302 (
unsigned int) uriIter,
307 fprintf(out,
" {{sizeof(String), %d, %d}, NULL, 0},\n", 0, 0);
311 fprintf(out,
" {%sURI_%u, %u}%s", prefix, (
unsigned int) uriIter, (
unsigned int) uriTbl->
uri[uriIter].
uriStr.
length,
312 uriIter==(uriTbl->
count-1) + dvis.
url?
"\n }\n};\n\n":
"\n },\n");
314 fprintf(out,
" {NULL, 0}%s", uriIter==(uriTbl->
count-1) + dvis.
url?
"\n }\n};\n\n":
"\n },\n");
317 for(uriIter = 0; uriIter < dvis.
url; uriIter++)
319 fprintf(out,
" {\n {{sizeof(LnEntry), %d, %d}, NULL, 0},\n", dvis.
ln, dvis.
ln);
320 fprintf(out,
" {{sizeof(String), %d, %d}, NULL, 0},\n", 0, 0);
321 fprintf(out,
" {NULL, 0}%s", uriIter==dvis.
url - 1?
"\n }\n};\n\n":
"\n },\n");
342 for(j = 0; j < tmpDef->
count; j++)
345 sprintf(varName,
"%sENUM_%u_%u", prefix, (
unsigned int) i, (
unsigned int) j);
348 fprintf(out,
"\nstatic CONST String %senumValues_%u[%u] = { \n", prefix, (
unsigned int) i, (
unsigned int) tmpDef->
count);
349 for(j = 0; j < tmpDef->
count; j++)
353 fprintf(out,
" {%sENUM_%u_%u, %u}", prefix, (
unsigned int) i, (
unsigned int) j, (
unsigned int) tmpStr->
length);
355 fprintf(out,
" {NULL, 0}");
357 if(j < tmpDef->count - 1)
360 fprintf(out,
"\n};\n\n");
392 fprintf(out,
"\nstatic CONST UnsignedInteger %senumValues_%u[%u] = { \n", prefix, (
unsigned int) i, (
unsigned int) tmpDef->
count);
393 for(j = 0; j < tmpDef->
count; j++)
397 if(j < tmpDef->count - 1)
400 fprintf(out,
"\n};\n\n");
406 fprintf(out,
"static CONST EnumDefinition %senumTable[%u] = { \n", prefix, (
unsigned int) schema->
enumTable.
count);
410 fprintf(out,
" {%u, %senumValues_%u, %u}", (
unsigned int) tmpDef->
typeId, prefix, (
unsigned int) i, (
unsigned int) tmpDef->
count);
412 if(i < schema->enumTable.count - 1)
415 fprintf(out,
"\n};\n\n");