support for loading from zip files
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4717 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+26
-26
@@ -283,7 +283,7 @@ char *xmlstringenc(char *d, const char *s, size_t len)
|
||||
|
||||
void docwriteref(int allidents, const char *ref, const char *schemalocation, const char *transformation)
|
||||
{
|
||||
FILE *f = openfile(path(allidents < 0 ? "docs/autogenerated_base_reference.xml" : "docs/autogenerated_todo_reference.xml", true), "w");
|
||||
stream *f = openfile(path(allidents < 0 ? "docs/autogenerated_base_reference.xml" : "docs/autogenerated_todo_reference.xml", true), "w");
|
||||
if(!f) return;
|
||||
char desc[] = "<description>TODO: Description</description>";
|
||||
|
||||
@@ -294,14 +294,14 @@ void docwriteref(int allidents, const char *ref, const char *schemalocation, con
|
||||
|
||||
if(allidents < 0)
|
||||
{
|
||||
fprintf(f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
fprintf(f, "<?xml-stylesheet type=\"text/xsl\" href=\"%s\"?>\n", transformation && strlen(transformation) ? transformation : "transformations/cuberef2xhtml.xslt");
|
||||
fprintf(f, "<cuberef name=\"%s\" version=\"v0.1\" xsi:schemaLocation=\"%s\" xmlns=\"http://cubers.net/Schemas/CubeRef\">\n", ref && strlen(ref) ? ref : "Unnamed Reference", schemalocation && strlen(schemalocation) ? schemalocation : "http://cubers.net/Schemas/CubeRef schemas/cuberef.xsd");
|
||||
fprintf(f, "\t%s\n", desc);
|
||||
fprintf(f, "\t<sections>\n");
|
||||
fprintf(f, "\t\t<section name=\"Main\">\n");
|
||||
fprintf(f, "\t\t\t%s\n", desc);
|
||||
fprintf(f, "\t\t\t<identifiers>\n");
|
||||
f->printf("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
f->printf("<?xml-stylesheet type=\"text/xsl\" href=\"%s\"?>\n", transformation && strlen(transformation) ? transformation : "transformations/cuberef2xhtml.xslt");
|
||||
f->printf("<cuberef name=\"%s\" version=\"v0.1\" xsi:schemaLocation=\"%s\" xmlns=\"http://cubers.net/Schemas/CubeRef\">\n", ref && strlen(ref) ? ref : "Unnamed Reference", schemalocation && strlen(schemalocation) ? schemalocation : "http://cubers.net/Schemas/CubeRef schemas/cuberef.xsd");
|
||||
f->printf("\t%s\n", desc);
|
||||
f->printf("\t<sections>\n");
|
||||
f->printf("\t\t<section name=\"Main\">\n");
|
||||
f->printf("\t\t\t%s\n", desc);
|
||||
f->printf("\t\t\t<identifiers>\n");
|
||||
}
|
||||
|
||||
static const int bases[] = { ARG_1INT, ARG_1STR, ARG_1EXP, ARG_1EXPF, ARG_1EST };
|
||||
@@ -310,12 +310,12 @@ void docwriteref(int allidents, const char *ref, const char *schemalocation, con
|
||||
{
|
||||
ident *id = idents->access(inames[i]);
|
||||
if(!id || id->type != ID_COMMAND) continue;
|
||||
fprintf(f, "\t\t\t\t<command name=\"%s\">\n", xmlstringenc(name, id->name, MAXSTRLEN));
|
||||
fprintf(f, "\t\t\t\t\t%s\n", desc);
|
||||
f->printf("\t\t\t\t<command name=\"%s\">\n", xmlstringenc(name, id->name, MAXSTRLEN));
|
||||
f->printf("\t\t\t\t\t%s\n", desc);
|
||||
if(id->narg != ARG_NONE && id->narg != ARG_DOWN && id->narg != ARG_IVAL && id->narg != ARG_FVAL && id->narg != ARG_SVAL)
|
||||
{
|
||||
fprintf(f, "\t\t\t\t\t<arguments>\n");
|
||||
if(id->narg == ARG_CONC || id->narg == ARG_CONCW || id->narg == ARG_VARI) fprintf(f, "\t\t\t\t\t\t<variableArgument token=\"...\" description=\"TODO\"/>\n");
|
||||
f->printf("\t\t\t\t\t<arguments>\n");
|
||||
if(id->narg == ARG_CONC || id->narg == ARG_CONCW || id->narg == ARG_VARI) f->printf("\t\t\t\t\t\t<variableArgument token=\"...\" description=\"TODO\"/>\n");
|
||||
else
|
||||
{
|
||||
int base = -1;
|
||||
@@ -323,42 +323,42 @@ void docwriteref(int allidents, const char *ref, const char *schemalocation, con
|
||||
{
|
||||
if(id->narg < bases[j]) { if(j) base = bases[j-1]; break; }
|
||||
}
|
||||
if(base >= 0) loopj(id->narg-base+1) fprintf(f, "\t\t\t\t\t\t<argument token=\"%c\" description=\"TODO\"/>\n", (char)(*"A")+j);
|
||||
if(base >= 0) loopj(id->narg-base+1) f->printf("\t\t\t\t\t\t<argument token=\"%c\" description=\"TODO\"/>\n", (char)(*"A")+j);
|
||||
}
|
||||
fprintf(f, "\t\t\t\t\t</arguments>\n");
|
||||
f->printf("\t\t\t\t\t</arguments>\n");
|
||||
}
|
||||
fprintf(f, "\t\t\t\t</command>\n");
|
||||
f->printf("\t\t\t\t</command>\n");
|
||||
}
|
||||
loopv(inames)
|
||||
{
|
||||
ident *id = idents->access(inames[i]);
|
||||
if(!id || (id->type != ID_VAR && id->type != ID_FVAR)) continue;
|
||||
fprintf(f, "\t\t\t\t<variable name=\"%s\">\n", xmlstringenc(name, id->name, MAXSTRLEN));
|
||||
fprintf(f, "\t\t\t\t\t<description>TODO</description>\n");
|
||||
f->printf("\t\t\t\t<variable name=\"%s\">\n", xmlstringenc(name, id->name, MAXSTRLEN));
|
||||
f->printf("\t\t\t\t\t<description>TODO</description>\n");
|
||||
switch(id->type)
|
||||
{
|
||||
case ID_VAR:
|
||||
fprintf(f, "\t\t\t\t\t<value %s description=\"TODO\" minValue=\"%i\" maxValue=\"%i\" defaultValue=\"%i\" %s/>\n", id->minval>id->maxval ? "" : "token=\"N\"", id->minval, id->maxval, *id->storage.i, id->minval>id->maxval ? "readOnly=\"true\"" : "");
|
||||
f->printf("\t\t\t\t\t<value %s description=\"TODO\" minValue=\"%i\" maxValue=\"%i\" defaultValue=\"%i\" %s/>\n", id->minval>id->maxval ? "" : "token=\"N\"", id->minval, id->maxval, *id->storage.i, id->minval>id->maxval ? "readOnly=\"true\"" : "");
|
||||
break;
|
||||
case ID_FVAR:
|
||||
fprintf(f, "\t\t\t\t\t<value %s description=\"TODO\" minValue=\"%s\" maxValue=\"%s\" defaultValue=\"%s\" %s/>\n", id->minvalf>id->maxvalf ? "" : "token=\"N\"",
|
||||
f->printf("\t\t\t\t\t<value %s description=\"TODO\" minValue=\"%s\" maxValue=\"%s\" defaultValue=\"%s\" %s/>\n", id->minvalf>id->maxvalf ? "" : "token=\"N\"",
|
||||
floatstr(id->minvalf), floatstr(id->maxvalf), floatstr(*id->storage.f),
|
||||
id->minvalf>id->maxvalf ? "readOnly=\"true\"" : "");
|
||||
break;
|
||||
}
|
||||
fprintf(f, "\t\t\t\t</variable>\n");
|
||||
f->printf("\t\t\t\t</variable>\n");
|
||||
}
|
||||
loopv(inames)
|
||||
{
|
||||
ident *id = idents->access(inames[i]);
|
||||
if(!id || id->type != ID_ALIAS) continue;
|
||||
fprintf(f, "\t\t\t\t<command name=\"%s\">\n", xmlstringenc(name, id->name, MAXSTRLEN));
|
||||
fprintf(f, "\t\t\t\t\t%s\n", desc);
|
||||
fprintf(f, "\t\t\t\t</command>\n");
|
||||
f->printf("\t\t\t\t<command name=\"%s\">\n", xmlstringenc(name, id->name, MAXSTRLEN));
|
||||
f->printf("\t\t\t\t\t%s\n", desc);
|
||||
f->printf("\t\t\t\t</command>\n");
|
||||
}
|
||||
|
||||
if(allidents < 0) fprintf(f, "\t\t\t</identifiers>\n\t\t</section>\n\t</sections>\n</cuberef>\n");
|
||||
fclose(f);
|
||||
if(allidents < 0) f->printf("\t\t\t</identifiers>\n\t\t</section>\n\t</sections>\n</cuberef>\n");
|
||||
delete f;
|
||||
}
|
||||
|
||||
void docwritebaseref(char *ref, char *schemalocation, char *transformation)
|
||||
|
||||
Reference in New Issue
Block a user