Reorder parser output
This commit is contained in:
parent
df6caea25d
commit
f40fdbaedc
|
|
@ -1288,6 +1288,17 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
{
|
{
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
{
|
{
|
||||||
|
// Print defines info
|
||||||
|
fprintf(outFile, "\nDefines found: %i\n\n", defineCount);
|
||||||
|
for (int i = 0; i < defineCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, "Define %03i: %s\n", i + 1, defines[i].name);
|
||||||
|
fprintf(outFile, " Name: %s\n", defines[i].name);
|
||||||
|
fprintf(outFile, " Type: %s\n", StrDefineType(defines[i].type));
|
||||||
|
fprintf(outFile, " Value: %s\n", defines[i].value);
|
||||||
|
fprintf(outFile, " Description: %s\n", defines[i].desc);
|
||||||
|
}
|
||||||
|
|
||||||
// Print structs info
|
// Print structs info
|
||||||
fprintf(outFile, "\nStructures found: %i\n\n", structCount);
|
fprintf(outFile, "\nStructures found: %i\n\n", structCount);
|
||||||
for (int i = 0; i < structCount; i++)
|
for (int i = 0; i < structCount; i++)
|
||||||
|
|
@ -1323,18 +1334,6 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
for (int e = 0; e < enums[i].valueCount; e++) fprintf(outFile, " Value[%s]: %i\n", enums[i].valueName[e], enums[i].valueInteger[e]);
|
for (int e = 0; e < enums[i].valueCount; e++) fprintf(outFile, " Value[%s]: %i\n", enums[i].valueName[e], enums[i].valueInteger[e]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print functions info
|
|
||||||
fprintf(outFile, "\nFunctions found: %i\n\n", funcCount);
|
|
||||||
for (int i = 0; i < funcCount; i++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, "Function %03i: %s() (%i input parameters)\n", i + 1, funcs[i].name, funcs[i].paramCount);
|
|
||||||
fprintf(outFile, " Name: %s\n", funcs[i].name);
|
|
||||||
fprintf(outFile, " Return type: %s\n", funcs[i].retType);
|
|
||||||
fprintf(outFile, " Description: %s\n", funcs[i].desc);
|
|
||||||
for (int p = 0; p < funcs[i].paramCount; p++) fprintf(outFile, " Param[%i]: %s (type: %s)\n", p + 1, funcs[i].paramName[p], funcs[i].paramType[p]);
|
|
||||||
if (funcs[i].paramCount == 0) fprintf(outFile, " No input parameters\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print callbacks info
|
// Print callbacks info
|
||||||
fprintf(outFile, "\nCallbacks found: %i\n\n", callbackCount);
|
fprintf(outFile, "\nCallbacks found: %i\n\n", callbackCount);
|
||||||
for (int i = 0; i < callbackCount; i++)
|
for (int i = 0; i < callbackCount; i++)
|
||||||
|
|
@ -1347,173 +1346,52 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
if (callbacks[i].paramCount == 0) fprintf(outFile, " No input parameters\n");
|
if (callbacks[i].paramCount == 0) fprintf(outFile, " No input parameters\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print defines info
|
// Print functions info
|
||||||
fprintf(outFile, "\nDefines found: %i\n\n", defineCount);
|
fprintf(outFile, "\nFunctions found: %i\n\n", funcCount);
|
||||||
for (int i = 0; i < defineCount; i++)
|
for (int i = 0; i < funcCount; i++)
|
||||||
{
|
{
|
||||||
fprintf(outFile, "Define %03i: %s\n", i + 1, defines[i].name);
|
fprintf(outFile, "Function %03i: %s() (%i input parameters)\n", i + 1, funcs[i].name, funcs[i].paramCount);
|
||||||
fprintf(outFile, " Name: %s\n", defines[i].name);
|
fprintf(outFile, " Name: %s\n", funcs[i].name);
|
||||||
fprintf(outFile, " Type: %s\n", StrDefineType(defines[i].type));
|
fprintf(outFile, " Return type: %s\n", funcs[i].retType);
|
||||||
fprintf(outFile, " Value: %s\n", defines[i].value);
|
fprintf(outFile, " Description: %s\n", funcs[i].desc);
|
||||||
fprintf(outFile, " Description: %s\n", defines[i].desc);
|
for (int p = 0; p < funcs[i].paramCount; p++) fprintf(outFile, " Param[%i]: %s (type: %s)\n", p + 1, funcs[i].paramName[p], funcs[i].paramType[p]);
|
||||||
|
if (funcs[i].paramCount == 0) fprintf(outFile, " No input parameters\n");
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case LUA:
|
case JSON:
|
||||||
{
|
{
|
||||||
fprintf(outFile, "return {\n");
|
fprintf(outFile, "{\n");
|
||||||
|
|
||||||
// Print structs info
|
|
||||||
fprintf(outFile, " structs = {\n");
|
|
||||||
for (int i = 0; i < structCount; i++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " name = \"%s\",\n", structs[i].name);
|
|
||||||
fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(structs[i].desc));
|
|
||||||
fprintf(outFile, " fields = {\n");
|
|
||||||
for (int f = 0; f < structs[i].fieldCount; f++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " type = \"%s\",\n", structs[i].fieldType[f]);
|
|
||||||
fprintf(outFile, " name = \"%s\",\n", structs[i].fieldName[f]);
|
|
||||||
fprintf(outFile, " description = \"%s\"\n", EscapeBackslashes(structs[i].fieldDesc[f]));
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
if (f < structs[i].fieldCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " }\n");
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
if (i < structCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " },\n");
|
|
||||||
|
|
||||||
// Print aliases info
|
|
||||||
fprintf(outFile, " aliases = {\n");
|
|
||||||
for (int i = 0; i < aliasCount; i++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " type = \"%s\",\n", aliases[i].type);
|
|
||||||
fprintf(outFile, " name = \"%s\",\n", aliases[i].name);
|
|
||||||
fprintf(outFile, " description = \"%s\"\n", aliases[i].desc);
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
|
|
||||||
if (i < aliasCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " },\n");
|
|
||||||
|
|
||||||
// Print enums info
|
|
||||||
fprintf(outFile, " enums = {\n");
|
|
||||||
for (int i = 0; i < enumCount; i++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " name = \"%s\",\n", enums[i].name);
|
|
||||||
fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(enums[i].desc));
|
|
||||||
fprintf(outFile, " values = {\n");
|
|
||||||
for (int e = 0; e < enums[i].valueCount; e++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " name = \"%s\",\n", enums[i].valueName[e]);
|
|
||||||
fprintf(outFile, " value = %i,\n", enums[i].valueInteger[e]);
|
|
||||||
fprintf(outFile, " description = \"%s\"\n", EscapeBackslashes(enums[i].valueDesc[e]));
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
if (e < enums[i].valueCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " }\n");
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
if (i < enumCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " },\n");
|
|
||||||
|
|
||||||
// Print defines info
|
// Print defines info
|
||||||
fprintf(outFile, " defines = {\n");
|
fprintf(outFile, " \"defines\": [\n");
|
||||||
for (int i = 0; i < defineCount; i++)
|
for (int i = 0; i < defineCount; i++)
|
||||||
{
|
{
|
||||||
fprintf(outFile, " {\n");
|
fprintf(outFile, " {\n");
|
||||||
fprintf(outFile, " name = \"%s\",\n", defines[i].name);
|
fprintf(outFile, " \"name\": \"%s\",\n", defines[i].name);
|
||||||
fprintf(outFile, " type = \"%s\",\n", StrDefineType(defines[i].type));
|
fprintf(outFile, " \"type\": \"%s\",\n", StrDefineType(defines[i].type));
|
||||||
if ((defines[i].type == INT) ||
|
if (defines[i].isHex) // INT or LONG
|
||||||
(defines[i].type == LONG) ||
|
|
||||||
(defines[i].type == FLOAT) ||
|
|
||||||
(defines[i].type == DOUBLE) ||
|
|
||||||
(defines[i].type == STRING))
|
|
||||||
{
|
{
|
||||||
fprintf(outFile, " value = %s,\n", defines[i].value);
|
fprintf(outFile, " \"value\": %ld,\n", strtol(defines[i].value, NULL, 16));
|
||||||
|
}
|
||||||
|
else if ((defines[i].type == INT) ||
|
||||||
|
(defines[i].type == LONG) ||
|
||||||
|
(defines[i].type == FLOAT) ||
|
||||||
|
(defines[i].type == DOUBLE) ||
|
||||||
|
(defines[i].type == STRING))
|
||||||
|
{
|
||||||
|
fprintf(outFile, " \"value\": %s,\n", defines[i].value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(outFile, " value = \"%s\",\n", defines[i].value);
|
fprintf(outFile, " \"value\": \"%s\",\n", defines[i].value);
|
||||||
}
|
}
|
||||||
fprintf(outFile, " description = \"%s\"\n", defines[i].desc);
|
fprintf(outFile, " \"description\": \"%s\"\n", defines[i].desc);
|
||||||
fprintf(outFile, " }");
|
fprintf(outFile, " }");
|
||||||
|
|
||||||
if (i < defineCount - 1) fprintf(outFile, ",\n");
|
if (i < defineCount - 1) fprintf(outFile, ",\n");
|
||||||
else fprintf(outFile, "\n");
|
else fprintf(outFile, "\n");
|
||||||
}
|
}
|
||||||
fprintf(outFile, " },\n");
|
fprintf(outFile, " ],\n");
|
||||||
|
|
||||||
// Print functions info
|
|
||||||
fprintf(outFile, " functions = {\n");
|
|
||||||
for (int i = 0; i < funcCount; i++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " name = \"%s\",\n", funcs[i].name);
|
|
||||||
fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(funcs[i].desc));
|
|
||||||
fprintf(outFile, " returnType = \"%s\"", funcs[i].retType);
|
|
||||||
|
|
||||||
if (funcs[i].paramCount == 0) fprintf(outFile, "\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(outFile, ",\n params = {\n");
|
|
||||||
for (int p = 0; p < funcs[i].paramCount; p++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {type = \"%s\", name = \"%s\"}", funcs[i].paramType[p], funcs[i].paramName[p]);
|
|
||||||
if (p < funcs[i].paramCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " }\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
|
|
||||||
if (i < funcCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " },\n");
|
|
||||||
|
|
||||||
// Print callbacks info
|
|
||||||
fprintf(outFile, " callbacks = {\n");
|
|
||||||
for (int i = 0; i < callbackCount; i++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " name = \"%s\",\n", callbacks[i].name);
|
|
||||||
fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(callbacks[i].desc));
|
|
||||||
fprintf(outFile, " returnType = \"%s\"", callbacks[i].retType);
|
|
||||||
|
|
||||||
if (callbacks[i].paramCount == 0) fprintf(outFile, "\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(outFile, ",\n params = {\n");
|
|
||||||
for (int p = 0; p < callbacks[i].paramCount; p++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {type = \"%s\", name = \"%s\"}", callbacks[i].paramType[p], callbacks[i].paramName[p]);
|
|
||||||
if (p < callbacks[i].paramCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " }\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
|
|
||||||
if (i < callbackCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " }\n");
|
|
||||||
fprintf(outFile, "}\n");
|
|
||||||
} break;
|
|
||||||
case JSON:
|
|
||||||
{
|
|
||||||
fprintf(outFile, "{\n");
|
|
||||||
|
|
||||||
// Print structs info
|
// Print structs info
|
||||||
fprintf(outFile, " \"structs\": [\n");
|
fprintf(outFile, " \"structs\": [\n");
|
||||||
|
|
@ -1580,33 +1458,33 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
}
|
}
|
||||||
fprintf(outFile, " ],\n");
|
fprintf(outFile, " ],\n");
|
||||||
|
|
||||||
// Print defines info
|
// Print callbacks info
|
||||||
fprintf(outFile, " \"defines\": [\n");
|
fprintf(outFile, " \"callbacks\": [\n");
|
||||||
for (int i = 0; i < defineCount; i++)
|
for (int i = 0; i < callbackCount; i++)
|
||||||
{
|
{
|
||||||
fprintf(outFile, " {\n");
|
fprintf(outFile, " {\n");
|
||||||
fprintf(outFile, " \"name\": \"%s\",\n", defines[i].name);
|
fprintf(outFile, " \"name\": \"%s\",\n", callbacks[i].name);
|
||||||
fprintf(outFile, " \"type\": \"%s\",\n", StrDefineType(defines[i].type));
|
fprintf(outFile, " \"description\": \"%s\",\n", EscapeBackslashes(callbacks[i].desc));
|
||||||
if (defines[i].isHex) // INT or LONG
|
fprintf(outFile, " \"returnType\": \"%s\"", callbacks[i].retType);
|
||||||
{
|
|
||||||
fprintf(outFile, " \"value\": %ld,\n", strtol(defines[i].value, NULL, 16));
|
if (callbacks[i].paramCount == 0) fprintf(outFile, "\n");
|
||||||
}
|
|
||||||
else if ((defines[i].type == INT) ||
|
|
||||||
(defines[i].type == LONG) ||
|
|
||||||
(defines[i].type == FLOAT) ||
|
|
||||||
(defines[i].type == DOUBLE) ||
|
|
||||||
(defines[i].type == STRING))
|
|
||||||
{
|
|
||||||
fprintf(outFile, " \"value\": %s,\n", defines[i].value);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(outFile, " \"value\": \"%s\",\n", defines[i].value);
|
fprintf(outFile, ",\n \"params\": [\n");
|
||||||
|
for (int p = 0; p < callbacks[i].paramCount; p++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " \"type\": \"%s\",\n", callbacks[i].paramType[p]);
|
||||||
|
fprintf(outFile, " \"name\": \"%s\"\n", callbacks[i].paramName[p]);
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
if (p < callbacks[i].paramCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " ]\n");
|
||||||
}
|
}
|
||||||
fprintf(outFile, " \"description\": \"%s\"\n", defines[i].desc);
|
|
||||||
fprintf(outFile, " }");
|
fprintf(outFile, " }");
|
||||||
|
|
||||||
if (i < defineCount - 1) fprintf(outFile, ",\n");
|
if (i < callbackCount - 1) fprintf(outFile, ",\n");
|
||||||
else fprintf(outFile, "\n");
|
else fprintf(outFile, "\n");
|
||||||
}
|
}
|
||||||
fprintf(outFile, " ],\n");
|
fprintf(outFile, " ],\n");
|
||||||
|
|
@ -1640,37 +1518,6 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
if (i < funcCount - 1) fprintf(outFile, ",\n");
|
if (i < funcCount - 1) fprintf(outFile, ",\n");
|
||||||
else fprintf(outFile, "\n");
|
else fprintf(outFile, "\n");
|
||||||
}
|
}
|
||||||
fprintf(outFile, " ],\n");
|
|
||||||
|
|
||||||
// Print callbacks info
|
|
||||||
fprintf(outFile, " \"callbacks\": [\n");
|
|
||||||
for (int i = 0; i < callbackCount; i++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " \"name\": \"%s\",\n", callbacks[i].name);
|
|
||||||
fprintf(outFile, " \"description\": \"%s\",\n", EscapeBackslashes(callbacks[i].desc));
|
|
||||||
fprintf(outFile, " \"returnType\": \"%s\"", callbacks[i].retType);
|
|
||||||
|
|
||||||
if (callbacks[i].paramCount == 0) fprintf(outFile, "\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(outFile, ",\n \"params\": [\n");
|
|
||||||
for (int p = 0; p < callbacks[i].paramCount; p++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " {\n");
|
|
||||||
fprintf(outFile, " \"type\": \"%s\",\n", callbacks[i].paramType[p]);
|
|
||||||
fprintf(outFile, " \"name\": \"%s\"\n", callbacks[i].paramName[p]);
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
if (p < callbacks[i].paramCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " ]\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " }");
|
|
||||||
|
|
||||||
if (i < callbackCount - 1) fprintf(outFile, ",\n");
|
|
||||||
else fprintf(outFile, "\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " ]\n");
|
fprintf(outFile, " ]\n");
|
||||||
fprintf(outFile, "}\n");
|
fprintf(outFile, "}\n");
|
||||||
} break;
|
} break;
|
||||||
|
|
@ -1680,6 +1527,9 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
/*
|
/*
|
||||||
<?xml version="1.0" encoding="Windows-1252" ?>
|
<?xml version="1.0" encoding="Windows-1252" ?>
|
||||||
<raylibAPI>
|
<raylibAPI>
|
||||||
|
<Defines count="">
|
||||||
|
<Define name="" type="" value="" desc="" />
|
||||||
|
</Defines>
|
||||||
<Structs count="">
|
<Structs count="">
|
||||||
<Struct name="" fieldCount="" desc="">
|
<Struct name="" fieldCount="" desc="">
|
||||||
<Field type="" name="" desc="" />
|
<Field type="" name="" desc="" />
|
||||||
|
|
@ -1695,27 +1545,41 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
<Value name="" integer="" desc="" />
|
<Value name="" integer="" desc="" />
|
||||||
</Enum>
|
</Enum>
|
||||||
</Enums>
|
</Enums>
|
||||||
<Defines count="">
|
|
||||||
<Define name="" type="" value="" desc="" />
|
|
||||||
</Defines>
|
|
||||||
<Functions count="">
|
|
||||||
<Function name="" retType="" paramCount="" desc="">
|
|
||||||
<Param type="" name="" desc="" />
|
|
||||||
<Param type="" name="" desc="" />
|
|
||||||
</Function>
|
|
||||||
</Functions>
|
|
||||||
<Callbacks count="">
|
<Callbacks count="">
|
||||||
<Callback name="" retType="" paramCount="" desc="">
|
<Callback name="" retType="" paramCount="" desc="">
|
||||||
<Param type="" name="" desc="" />
|
<Param type="" name="" desc="" />
|
||||||
<Param type="" name="" desc="" />
|
<Param type="" name="" desc="" />
|
||||||
</Callback>
|
</Callback>
|
||||||
</Callbacks>
|
</Callbacks>
|
||||||
|
<Functions count="">
|
||||||
|
<Function name="" retType="" paramCount="" desc="">
|
||||||
|
<Param type="" name="" desc="" />
|
||||||
|
<Param type="" name="" desc="" />
|
||||||
|
</Function>
|
||||||
|
</Functions>
|
||||||
</raylibAPI>
|
</raylibAPI>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fprintf(outFile, "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\n");
|
fprintf(outFile, "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\n");
|
||||||
fprintf(outFile, "<raylibAPI>\n");
|
fprintf(outFile, "<raylibAPI>\n");
|
||||||
|
|
||||||
|
// Print defines info
|
||||||
|
fprintf(outFile, " <Defines count=\"%i\">\n", defineCount);
|
||||||
|
for (int i = 0; i < defineCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " <Define name=\"%s\" type=\"%s\" ", defines[i].name, StrDefineType(defines[i].type));
|
||||||
|
if (defines[i].type == STRING)
|
||||||
|
{
|
||||||
|
fprintf(outFile, "value=%s", defines[i].value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(outFile, "value=\"%s\"", defines[i].value);
|
||||||
|
}
|
||||||
|
fprintf(outFile, " desc=\"%s\" />\n", defines[i].desc);
|
||||||
|
}
|
||||||
|
fprintf(outFile, " </Defines>\n");
|
||||||
|
|
||||||
// Print structs info
|
// Print structs info
|
||||||
fprintf(outFile, " <Structs count=\"%i\">\n", structCount);
|
fprintf(outFile, " <Structs count=\"%i\">\n", structCount);
|
||||||
for (int i = 0; i < structCount; i++)
|
for (int i = 0; i < structCount; i++)
|
||||||
|
|
@ -1750,22 +1614,18 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
}
|
}
|
||||||
fprintf(outFile, " </Enums>\n");
|
fprintf(outFile, " </Enums>\n");
|
||||||
|
|
||||||
// Print defines info
|
// Print callbacks info
|
||||||
fprintf(outFile, " <Defines count=\"%i\">\n", defineCount);
|
fprintf(outFile, " <Callbacks count=\"%i\">\n", callbackCount);
|
||||||
for (int i = 0; i < defineCount; i++)
|
for (int i = 0; i < callbackCount; i++)
|
||||||
{
|
{
|
||||||
fprintf(outFile, " <Define name=\"%s\" type=\"%s\" ", defines[i].name, StrDefineType(defines[i].type));
|
fprintf(outFile, " <Callback name=\"%s\" retType=\"%s\" paramCount=\"%i\" desc=\"%s\">\n", callbacks[i].name, callbacks[i].retType, callbacks[i].paramCount, callbacks[i].desc);
|
||||||
if (defines[i].type == STRING)
|
for (int p = 0; p < callbacks[i].paramCount; p++)
|
||||||
{
|
{
|
||||||
fprintf(outFile, "value=%s", defines[i].value);
|
fprintf(outFile, " <Param type=\"%s\" name=\"%s\" desc=\"%s\" />\n", callbacks[i].paramType[p], callbacks[i].paramName[p], callbacks[i].paramDesc[p]);
|
||||||
}
|
}
|
||||||
else
|
fprintf(outFile, " </Callback>\n");
|
||||||
{
|
|
||||||
fprintf(outFile, "value=\"%s\"", defines[i].value);
|
|
||||||
}
|
|
||||||
fprintf(outFile, " desc=\"%s\" />\n", defines[i].desc);
|
|
||||||
}
|
}
|
||||||
fprintf(outFile, " </Defines>\n");
|
fprintf(outFile, " </Callbacks>\n");
|
||||||
|
|
||||||
// Print functions info
|
// Print functions info
|
||||||
fprintf(outFile, " <Functions count=\"%i\">\n", funcCount);
|
fprintf(outFile, " <Functions count=\"%i\">\n", funcCount);
|
||||||
|
|
@ -1780,22 +1640,162 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
}
|
}
|
||||||
fprintf(outFile, " </Functions>\n");
|
fprintf(outFile, " </Functions>\n");
|
||||||
|
|
||||||
// Print callbacks info
|
|
||||||
fprintf(outFile, " <Callbacks count=\"%i\">\n", callbackCount);
|
|
||||||
for (int i = 0; i < callbackCount; i++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " <Callback name=\"%s\" retType=\"%s\" paramCount=\"%i\" desc=\"%s\">\n", callbacks[i].name, callbacks[i].retType, callbacks[i].paramCount, callbacks[i].desc);
|
|
||||||
for (int p = 0; p < callbacks[i].paramCount; p++)
|
|
||||||
{
|
|
||||||
fprintf(outFile, " <Param type=\"%s\" name=\"%s\" desc=\"%s\" />\n", callbacks[i].paramType[p], callbacks[i].paramName[p], callbacks[i].paramDesc[p]);
|
|
||||||
}
|
|
||||||
fprintf(outFile, " </Callback>\n");
|
|
||||||
}
|
|
||||||
fprintf(outFile, " </Callbacks>\n");
|
|
||||||
|
|
||||||
fprintf(outFile, "</raylibAPI>\n");
|
fprintf(outFile, "</raylibAPI>\n");
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
case LUA:
|
||||||
|
{
|
||||||
|
fprintf(outFile, "return {\n");
|
||||||
|
|
||||||
|
// Print defines info
|
||||||
|
fprintf(outFile, " defines = {\n");
|
||||||
|
for (int i = 0; i < defineCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", defines[i].name);
|
||||||
|
fprintf(outFile, " type = \"%s\",\n", StrDefineType(defines[i].type));
|
||||||
|
if ((defines[i].type == INT) ||
|
||||||
|
(defines[i].type == LONG) ||
|
||||||
|
(defines[i].type == FLOAT) ||
|
||||||
|
(defines[i].type == DOUBLE) ||
|
||||||
|
(defines[i].type == STRING))
|
||||||
|
{
|
||||||
|
fprintf(outFile, " value = %s,\n", defines[i].value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(outFile, " value = \"%s\",\n", defines[i].value);
|
||||||
|
}
|
||||||
|
fprintf(outFile, " description = \"%s\"\n", defines[i].desc);
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
|
||||||
|
if (i < defineCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " },\n");
|
||||||
|
|
||||||
|
// Print structs info
|
||||||
|
fprintf(outFile, " structs = {\n");
|
||||||
|
for (int i = 0; i < structCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", structs[i].name);
|
||||||
|
fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(structs[i].desc));
|
||||||
|
fprintf(outFile, " fields = {\n");
|
||||||
|
for (int f = 0; f < structs[i].fieldCount; f++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " type = \"%s\",\n", structs[i].fieldType[f]);
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", structs[i].fieldName[f]);
|
||||||
|
fprintf(outFile, " description = \"%s\"\n", EscapeBackslashes(structs[i].fieldDesc[f]));
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
if (f < structs[i].fieldCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " }\n");
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
if (i < structCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " },\n");
|
||||||
|
|
||||||
|
// Print aliases info
|
||||||
|
fprintf(outFile, " aliases = {\n");
|
||||||
|
for (int i = 0; i < aliasCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " type = \"%s\",\n", aliases[i].type);
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", aliases[i].name);
|
||||||
|
fprintf(outFile, " description = \"%s\"\n", aliases[i].desc);
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
|
||||||
|
if (i < aliasCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " },\n");
|
||||||
|
|
||||||
|
// Print enums info
|
||||||
|
fprintf(outFile, " enums = {\n");
|
||||||
|
for (int i = 0; i < enumCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", enums[i].name);
|
||||||
|
fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(enums[i].desc));
|
||||||
|
fprintf(outFile, " values = {\n");
|
||||||
|
for (int e = 0; e < enums[i].valueCount; e++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", enums[i].valueName[e]);
|
||||||
|
fprintf(outFile, " value = %i,\n", enums[i].valueInteger[e]);
|
||||||
|
fprintf(outFile, " description = \"%s\"\n", EscapeBackslashes(enums[i].valueDesc[e]));
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
if (e < enums[i].valueCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " }\n");
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
if (i < enumCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " },\n");
|
||||||
|
|
||||||
|
// Print callbacks info
|
||||||
|
fprintf(outFile, " callbacks = {\n");
|
||||||
|
for (int i = 0; i < callbackCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", callbacks[i].name);
|
||||||
|
fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(callbacks[i].desc));
|
||||||
|
fprintf(outFile, " returnType = \"%s\"", callbacks[i].retType);
|
||||||
|
|
||||||
|
if (callbacks[i].paramCount == 0) fprintf(outFile, "\n");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(outFile, ",\n params = {\n");
|
||||||
|
for (int p = 0; p < callbacks[i].paramCount; p++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {type = \"%s\", name = \"%s\"}", callbacks[i].paramType[p], callbacks[i].paramName[p]);
|
||||||
|
if (p < callbacks[i].paramCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " }\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
|
||||||
|
if (i < callbackCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " },\n");
|
||||||
|
|
||||||
|
// Print functions info
|
||||||
|
fprintf(outFile, " functions = {\n");
|
||||||
|
for (int i = 0; i < funcCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", funcs[i].name);
|
||||||
|
fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(funcs[i].desc));
|
||||||
|
fprintf(outFile, " returnType = \"%s\"", funcs[i].retType);
|
||||||
|
|
||||||
|
if (funcs[i].paramCount == 0) fprintf(outFile, "\n");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(outFile, ",\n params = {\n");
|
||||||
|
for (int p = 0; p < funcs[i].paramCount; p++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {type = \"%s\", name = \"%s\"}", funcs[i].paramType[p], funcs[i].paramName[p]);
|
||||||
|
if (p < funcs[i].paramCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " }\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
|
||||||
|
if (i < funcCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " }\n");
|
||||||
|
fprintf(outFile, "}\n");
|
||||||
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user