From 2e3cfdcc2f5c70e82536caa57d4aa72e3f00fd40 Mon Sep 17 00:00:00 2001 From: gtrxAC <59177874+gtrxAC@users.noreply.github.com> Date: Tue, 4 Jan 2022 15:06:10 +0200 Subject: 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 --- parser/raylib_parser.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'parser/raylib_parser.c') 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, " }"); -- cgit v1.2.3