akimbo bug fixed; some new bugs added
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4598 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+92
-54
@@ -179,36 +179,45 @@ char *cvecstr(vector<char *> &cvec, const char *substr, int *rline = NULL)
|
||||
return r;
|
||||
}
|
||||
|
||||
void listundoneidents(vector<const char *> &inames, int allidents)
|
||||
{
|
||||
enumeratekt(*idents, const char *, name, ident, id,
|
||||
{
|
||||
if((allidents > 0) || id.type != ID_ALIAS)
|
||||
{
|
||||
docident *id = docidents.access(name);
|
||||
if(id) // search for substrings that indicate undoneness
|
||||
{
|
||||
cvector srch;
|
||||
srch.add(id->name);
|
||||
srch.add(id->desc);
|
||||
loopvj(id->remarks) srch.add(id->remarks[j]);
|
||||
loopvj(id->arguments)
|
||||
{
|
||||
srch.add(id->arguments[j].token);
|
||||
srch.add(id->arguments[j].desc);
|
||||
srch.add(id->arguments[j].values);
|
||||
}
|
||||
loopvj(id->references)
|
||||
{
|
||||
srch.add(id->references[j].ident);
|
||||
srch.add(id->references[j].name);
|
||||
srch.add(id->references[j].url);
|
||||
}
|
||||
if(cvecstr(srch, "TODO") || cvecstr(srch, "UNDONE")) id = NULL;
|
||||
}
|
||||
if(!id) inames.add(name);
|
||||
}
|
||||
});
|
||||
inames.sort(stringsort);
|
||||
}
|
||||
|
||||
void docundone(int allidents)
|
||||
{
|
||||
vector<const char *> inames;
|
||||
identnames(inames, !(allidents > 0));
|
||||
listundoneidents(inames, allidents);
|
||||
inames.sort(stringsort);
|
||||
loopv(inames)
|
||||
{
|
||||
docident *id = docidents.access(inames[i]);
|
||||
if(id) // search for substrings that indicate undoneness
|
||||
{
|
||||
cvector srch;
|
||||
srch.add(id->name);
|
||||
srch.add(id->desc);
|
||||
loopvj(id->remarks) srch.add(id->remarks[j]);
|
||||
loopvj(id->arguments)
|
||||
{
|
||||
srch.add(id->arguments[j].token);
|
||||
srch.add(id->arguments[j].desc);
|
||||
srch.add(id->arguments[j].values);
|
||||
}
|
||||
loopvj(id->references)
|
||||
{
|
||||
srch.add(id->references[j].ident);
|
||||
srch.add(id->references[j].name);
|
||||
srch.add(id->references[j].url);
|
||||
}
|
||||
if(!cvecstr(srch, "TODO") && !cvecstr(srch, "UNDONE")) continue;
|
||||
}
|
||||
conoutf("%s", inames[i]);
|
||||
}
|
||||
loopv(inames) conoutf("%s", inames[i]);
|
||||
}
|
||||
|
||||
void docinvalid()
|
||||
@@ -273,72 +282,101 @@ char *xmlstringenc(char *d, const char *s, size_t len)
|
||||
return d;
|
||||
}
|
||||
|
||||
void docwritebaseref(char *ref, char *schemalocation, char *transformation)
|
||||
void docwriteref(int allidents, const char *ref, const char *schemalocation, const char *transformation)
|
||||
{
|
||||
FILE *f = openfile(path("docs/autogenerated_base_reference.xml", true), "w");
|
||||
FILE *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>";
|
||||
|
||||
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");
|
||||
vector<const char *> inames;
|
||||
if(allidents < 0) identnames(inames, true); // -1: all builtin
|
||||
else listundoneidents(inames, allidents); // 0: todo builtin, 1: todo builtin + alias
|
||||
inames.sort(stringsort);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
static const int bases[] = { ARG_1INT, ARG_1STR, ARG_1EXP, ARG_1EXPF, ARG_1EST };
|
||||
string name;
|
||||
enumerate(*idents, ident, id,
|
||||
loopv(inames)
|
||||
{
|
||||
if(id.type != ID_COMMAND) continue;
|
||||
fprintf(f, "\t\t\t\t<command name=\"%s\">\n", xmlstringenc(name, id.name, _MAXDEFSTR));
|
||||
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, _MAXDEFSTR));
|
||||
fprintf(f, "\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)
|
||||
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");
|
||||
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");
|
||||
else
|
||||
{
|
||||
int base = -1;
|
||||
loopj(sizeof(bases)/sizeof(bases[0]))
|
||||
{
|
||||
if(id.narg < bases[j]) { if(j) base = bases[j-1]; break; }
|
||||
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) fprintf(f, "\t\t\t\t\t\t<argument token=\"%c\" description=\"TODO\"/>\n", (char)(*"A")+j);
|
||||
}
|
||||
fprintf(f, "\t\t\t\t\t</arguments>\n");
|
||||
}
|
||||
fprintf(f, "\t\t\t\t</command>\n");
|
||||
});
|
||||
enumerate(*idents, ident, id,
|
||||
}
|
||||
loopv(inames)
|
||||
{
|
||||
if(id.type != ID_VAR && id.type != ID_FVAR) continue;
|
||||
fprintf(f, "\t\t\t\t<variable name=\"%s\">\n", xmlstringenc(name, id.name, _MAXDEFSTR));
|
||||
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, _MAXDEFSTR));
|
||||
fprintf(f, "\t\t\t\t\t<description>TODO</description>\n");
|
||||
switch(id.type)
|
||||
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\"" : "");
|
||||
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\"" : "");
|
||||
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\"",
|
||||
floatstr(id.minvalf), floatstr(id.maxvalf), floatstr(*id.storage.f),
|
||||
id.minvalf>id.maxvalf ? "readOnly=\"true\"" : "");
|
||||
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\"",
|
||||
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");
|
||||
});
|
||||
}
|
||||
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, _MAXDEFSTR));
|
||||
fprintf(f, "\t\t\t\t\t%s\n", desc);
|
||||
fprintf(f, "\t\t\t\t</command>\n");
|
||||
}
|
||||
|
||||
fprintf(f, "\t\t\t</identifiers>\n\t\t</section>\n\t</sections>\n</cuberef>\n");
|
||||
if(allidents < 0) fprintf(f, "\t\t\t</identifiers>\n\t\t</section>\n\t</sections>\n</cuberef>\n");
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void docwritebaseref(char *ref, char *schemalocation, char *transformation)
|
||||
{
|
||||
docwriteref(-1, ref, schemalocation, transformation);
|
||||
}
|
||||
|
||||
void docwritetodoref(int allidents)
|
||||
{
|
||||
docwriteref(allidents ? 1 : 0, "", "", "");
|
||||
}
|
||||
|
||||
COMMAND(docundone, ARG_1INT);
|
||||
COMMAND(docinvalid, ARG_NONE);
|
||||
COMMAND(docfind, ARG_1STR);
|
||||
COMMAND(docwritebaseref, ARG_3STR);
|
||||
COMMAND(docwritetodoref, ARG_1INT);
|
||||
VAR(docvisible, 0, 1, 1);
|
||||
VAR(docskip, 0, 0, 1000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user