diff options
| author | gtrxAC <[email protected]> | 2022-01-04 15:06:10 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-04 14:06:10 +0100 |
| commit | 2e3cfdcc2f5c70e82536caa57d4aa72e3f00fd40 (patch) | |
| tree | e7ca42dc27f43b0e4fd58e3c90db48521eab2147 /parser/raylib_parser.c | |
| parent | 2116a987456e07c3d1ed4e7ef8be3e4864e229cc (diff) | |
| download | raylib-2e3cfdcc2f5c70e82536caa57d4aa72e3f00fd40.tar.gz raylib-2e3cfdcc2f5c70e82536caa57d4aa72e3f00fd40.zip | |
JSON parser: Use array for function params (#2255) (#2264)
* JSON parser: Use array for function params (#2255)
* Parser: follow C convention of type before name
Diffstat (limited to 'parser/raylib_parser.c')
| -rw-r--r-- | parser/raylib_parser.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/parser/raylib_parser.c b/parser/raylib_parser.c index a4171f80..6f07e76f 100644 --- a/parser/raylib_parser.c +++ b/parser/raylib_parser.c @@ -867,8 +867,8 @@ static void ExportParsedData(const char *fileName, int format) for (int f = 0; f < structs[i].fieldCount; f++) { fprintf(outFile, " {\n"); - fprintf(outFile, " name = \"%s\",\n", structs[i].fieldName[f]); 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] + 3)); fprintf(outFile, " }"); if (f < structs[i].fieldCount - 1) fprintf(outFile, ",\n"); @@ -921,7 +921,7 @@ static void ExportParsedData(const char *fileName, int format) fprintf(outFile, ",\n params = {\n"); for (int p = 0; p < funcs[i].paramCount; p++) { - fprintf(outFile, " {name = \"%s\", type = \"%s\"}", funcs[i].paramName[p], funcs[i].paramType[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"); } @@ -950,8 +950,8 @@ static void ExportParsedData(const char *fileName, int format) for (int f = 0; f < structs[i].fieldCount; f++) { fprintf(outFile, " {\n"); - fprintf(outFile, " \"name\": \"%s\",\n", structs[i].fieldName[f]); 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] + 3)); fprintf(outFile, " }"); if (f < structs[i].fieldCount - 1) fprintf(outFile, ",\n"); @@ -1001,14 +1001,17 @@ static void ExportParsedData(const char *fileName, int format) if (funcs[i].paramCount == 0) fprintf(outFile, "\n"); else { - fprintf(outFile, ",\n \"params\": {\n"); + fprintf(outFile, ",\n \"params\": [\n"); for (int p = 0; p < funcs[i].paramCount; p++) { - fprintf(outFile, " \"%s\": \"%s\"", funcs[i].paramName[p], funcs[i].paramType[p]); + fprintf(outFile, " {\n"); + fprintf(outFile, " \"type\": \"%s\",\n", funcs[i].paramType[p]); + fprintf(outFile, " \"name\": \"%s\"\n", funcs[i].paramName[p]); + fprintf(outFile, " }"); if (p < funcs[i].paramCount - 1) fprintf(outFile, ",\n"); else fprintf(outFile, "\n"); } - fprintf(outFile, " }\n"); + fprintf(outFile, " ]\n"); } fprintf(outFile, " }"); |
