added defines to parser

This commit is contained in:
Илья Колбин 2022-01-08 15:15:04 +03:00
parent 549ca669aa
commit 1d7ff04923
5 changed files with 793 additions and 3 deletions

View File

@ -2485,6 +2485,216 @@
]
}
],
"defs": [
{
"name": "RAYLIB_H",
"type": "GUARD"
},
{
"name": "RAYLIB_VERSION",
"type": "STRING"
},
{
"name": "RLAPI",
"type": "UNKNOWN"
},
{
"name": "PI",
"type": "FLOAT"
},
{
"name": "DEG2RAD",
"type": "UNKNOWN"
},
{
"name": "RAD2DEG",
"type": "UNKNOWN"
},
{
"name": "RL_MALLOC(sz)",
"type": "MACRO"
},
{
"name": "RL_CALLOC(n,sz)",
"type": "MACRO"
},
{
"name": "RL_REALLOC(ptr,sz)",
"type": "MACRO"
},
{
"name": "RL_FREE(ptr)",
"type": "MACRO"
},
{
"name": "CLITERAL(type)",
"type": "MACRO"
},
{
"name": "RL_COLOR_TYPE",
"type": "GUARD"
},
{
"name": "RL_RECTANGLE_TYPE",
"type": "GUARD"
},
{
"name": "RL_VECTOR2_TYPE",
"type": "GUARD"
},
{
"name": "RL_VECTOR3_TYPE",
"type": "GUARD"
},
{
"name": "RL_VECTOR4_TYPE",
"type": "GUARD"
},
{
"name": "RL_QUATERNION_TYPE",
"type": "GUARD"
},
{
"name": "RL_MATRIX_TYPE",
"type": "GUARD"
},
{
"name": "LIGHTGRAY",
"type": "COLOR"
},
{
"name": "GRAY",
"type": "COLOR"
},
{
"name": "DARKGRAY",
"type": "COLOR"
},
{
"name": "YELLOW",
"type": "COLOR"
},
{
"name": "GOLD",
"type": "COLOR"
},
{
"name": "ORANGE",
"type": "COLOR"
},
{
"name": "PINK",
"type": "COLOR"
},
{
"name": "RED",
"type": "COLOR"
},
{
"name": "MAROON",
"type": "COLOR"
},
{
"name": "GREEN",
"type": "COLOR"
},
{
"name": "LIME",
"type": "COLOR"
},
{
"name": "DARKGREEN",
"type": "COLOR"
},
{
"name": "SKYBLUE",
"type": "COLOR"
},
{
"name": "BLUE",
"type": "COLOR"
},
{
"name": "DARKBLUE",
"type": "COLOR"
},
{
"name": "PURPLE",
"type": "COLOR"
},
{
"name": "VIOLET",
"type": "COLOR"
},
{
"name": "DARKPURPLE",
"type": "COLOR"
},
{
"name": "BEIGE",
"type": "COLOR"
},
{
"name": "BROWN",
"type": "COLOR"
},
{
"name": "DARKBROWN",
"type": "COLOR"
},
{
"name": "WHITE",
"type": "COLOR"
},
{
"name": "BLACK",
"type": "COLOR"
},
{
"name": "BLANK",
"type": "COLOR"
},
{
"name": "MAGENTA",
"type": "COLOR"
},
{
"name": "RAYWHITE",
"type": "COLOR"
},
{
"name": "RL_BOOL_TYPE",
"type": "GUARD"
},
{
"name": "MOUSE_LEFT_BUTTON",
"type": "UNKNOWN"
},
{
"name": "MOUSE_RIGHT_BUTTON",
"type": "UNKNOWN"
},
{
"name": "MOUSE_MIDDLE_BUTTON",
"type": "UNKNOWN"
},
{
"name": "MATERIAL_MAP_DIFFUSE",
"type": "UNKNOWN"
},
{
"name": "MATERIAL_MAP_SPECULAR",
"type": "UNKNOWN"
},
{
"name": "SHADER_LOC_MAP_DIFFUSE",
"type": "UNKNOWN"
},
{
"name": "SHADER_LOC_MAP_SPECULAR",
"type": "UNKNOWN"
}
],
"functions": [
{
"name": "InitWindow",

View File

@ -2485,6 +2485,216 @@ return {
}
}
},
defs = {
{
name = "RAYLIB_H",
type = "GUARD"
},
{
name = "RAYLIB_VERSION",
type = "STRING"
},
{
name = "RLAPI",
type = "UNKNOWN"
},
{
name = "PI",
type = "FLOAT"
},
{
name = "DEG2RAD",
type = "UNKNOWN"
},
{
name = "RAD2DEG",
type = "UNKNOWN"
},
{
name = "RL_MALLOC(sz)",
type = "MACRO"
},
{
name = "RL_CALLOC(n,sz)",
type = "MACRO"
},
{
name = "RL_REALLOC(ptr,sz)",
type = "MACRO"
},
{
name = "RL_FREE(ptr)",
type = "MACRO"
},
{
name = "CLITERAL(type)",
type = "MACRO"
},
{
name = "RL_COLOR_TYPE",
type = "GUARD"
},
{
name = "RL_RECTANGLE_TYPE",
type = "GUARD"
},
{
name = "RL_VECTOR2_TYPE",
type = "GUARD"
},
{
name = "RL_VECTOR3_TYPE",
type = "GUARD"
},
{
name = "RL_VECTOR4_TYPE",
type = "GUARD"
},
{
name = "RL_QUATERNION_TYPE",
type = "GUARD"
},
{
name = "RL_MATRIX_TYPE",
type = "GUARD"
},
{
name = "LIGHTGRAY",
type = "COLOR"
},
{
name = "GRAY",
type = "COLOR"
},
{
name = "DARKGRAY",
type = "COLOR"
},
{
name = "YELLOW",
type = "COLOR"
},
{
name = "GOLD",
type = "COLOR"
},
{
name = "ORANGE",
type = "COLOR"
},
{
name = "PINK",
type = "COLOR"
},
{
name = "RED",
type = "COLOR"
},
{
name = "MAROON",
type = "COLOR"
},
{
name = "GREEN",
type = "COLOR"
},
{
name = "LIME",
type = "COLOR"
},
{
name = "DARKGREEN",
type = "COLOR"
},
{
name = "SKYBLUE",
type = "COLOR"
},
{
name = "BLUE",
type = "COLOR"
},
{
name = "DARKBLUE",
type = "COLOR"
},
{
name = "PURPLE",
type = "COLOR"
},
{
name = "VIOLET",
type = "COLOR"
},
{
name = "DARKPURPLE",
type = "COLOR"
},
{
name = "BEIGE",
type = "COLOR"
},
{
name = "BROWN",
type = "COLOR"
},
{
name = "DARKBROWN",
type = "COLOR"
},
{
name = "WHITE",
type = "COLOR"
},
{
name = "BLACK",
type = "COLOR"
},
{
name = "BLANK",
type = "COLOR"
},
{
name = "MAGENTA",
type = "COLOR"
},
{
name = "RAYWHITE",
type = "COLOR"
},
{
name = "RL_BOOL_TYPE",
type = "GUARD"
},
{
name = "MOUSE_LEFT_BUTTON",
type = "UNKNOWN"
},
{
name = "MOUSE_RIGHT_BUTTON",
type = "UNKNOWN"
},
{
name = "MOUSE_MIDDLE_BUTTON",
type = "UNKNOWN"
},
{
name = "MATERIAL_MAP_DIFFUSE",
type = "UNKNOWN"
},
{
name = "MATERIAL_MAP_SPECULAR",
type = "UNKNOWN"
},
{
name = "SHADER_LOC_MAP_DIFFUSE",
type = "UNKNOWN"
},
{
name = "SHADER_LOC_MAP_SPECULAR",
type = "UNKNOWN"
},
},
functions = {
{
name = "InitWindow",

View File

@ -3693,3 +3693,162 @@ Function 491: SetAudioStreamBufferSizeDefault() (1 input parameters)
Return type: void
Description: Default size for new audio streams
Param[1]: size (type: int)
Defines found: 52
Define 001: RAYLIB_H
Name: RAYLIB_H
Type: GUARD
Define 002: RAYLIB_VERSION
Name: RAYLIB_VERSION
Type: STRING
Define 003: RLAPI
Name: RLAPI
Type: UNKNOWN
Define 004: PI
Name: PI
Type: FLOAT
Define 005: DEG2RAD
Name: DEG2RAD
Type: UNKNOWN
Define 006: RAD2DEG
Name: RAD2DEG
Type: UNKNOWN
Define 007: RL_MALLOC(sz)
Name: RL_MALLOC(sz)
Type: MACRO
Define 008: RL_CALLOC(n,sz)
Name: RL_CALLOC(n,sz)
Type: MACRO
Define 009: RL_REALLOC(ptr,sz)
Name: RL_REALLOC(ptr,sz)
Type: MACRO
Define 010: RL_FREE(ptr)
Name: RL_FREE(ptr)
Type: MACRO
Define 011: CLITERAL(type)
Name: CLITERAL(type)
Type: MACRO
Define 012: RL_COLOR_TYPE
Name: RL_COLOR_TYPE
Type: GUARD
Define 013: RL_RECTANGLE_TYPE
Name: RL_RECTANGLE_TYPE
Type: GUARD
Define 014: RL_VECTOR2_TYPE
Name: RL_VECTOR2_TYPE
Type: GUARD
Define 015: RL_VECTOR3_TYPE
Name: RL_VECTOR3_TYPE
Type: GUARD
Define 016: RL_VECTOR4_TYPE
Name: RL_VECTOR4_TYPE
Type: GUARD
Define 017: RL_QUATERNION_TYPE
Name: RL_QUATERNION_TYPE
Type: GUARD
Define 018: RL_MATRIX_TYPE
Name: RL_MATRIX_TYPE
Type: GUARD
Define 019: LIGHTGRAY
Name: LIGHTGRAY
Type: COLOR
Define 020: GRAY
Name: GRAY
Type: COLOR
Define 021: DARKGRAY
Name: DARKGRAY
Type: COLOR
Define 022: YELLOW
Name: YELLOW
Type: COLOR
Define 023: GOLD
Name: GOLD
Type: COLOR
Define 024: ORANGE
Name: ORANGE
Type: COLOR
Define 025: PINK
Name: PINK
Type: COLOR
Define 026: RED
Name: RED
Type: COLOR
Define 027: MAROON
Name: MAROON
Type: COLOR
Define 028: GREEN
Name: GREEN
Type: COLOR
Define 029: LIME
Name: LIME
Type: COLOR
Define 030: DARKGREEN
Name: DARKGREEN
Type: COLOR
Define 031: SKYBLUE
Name: SKYBLUE
Type: COLOR
Define 032: BLUE
Name: BLUE
Type: COLOR
Define 033: DARKBLUE
Name: DARKBLUE
Type: COLOR
Define 034: PURPLE
Name: PURPLE
Type: COLOR
Define 035: VIOLET
Name: VIOLET
Type: COLOR
Define 036: DARKPURPLE
Name: DARKPURPLE
Type: COLOR
Define 037: BEIGE
Name: BEIGE
Type: COLOR
Define 038: BROWN
Name: BROWN
Type: COLOR
Define 039: DARKBROWN
Name: DARKBROWN
Type: COLOR
Define 040: WHITE
Name: WHITE
Type: COLOR
Define 041: BLACK
Name: BLACK
Type: COLOR
Define 042: BLANK
Name: BLANK
Type: COLOR
Define 043: MAGENTA
Name: MAGENTA
Type: COLOR
Define 044: RAYWHITE
Name: RAYWHITE
Type: COLOR
Define 045: RL_BOOL_TYPE
Name: RL_BOOL_TYPE
Type: GUARD
Define 046: MOUSE_LEFT_BUTTON
Name: MOUSE_LEFT_BUTTON
Type: UNKNOWN
Define 047: MOUSE_RIGHT_BUTTON
Name: MOUSE_RIGHT_BUTTON
Type: UNKNOWN
Define 048: MOUSE_MIDDLE_BUTTON
Name: MOUSE_MIDDLE_BUTTON
Type: UNKNOWN
Define 049: MATERIAL_MAP_DIFFUSE
Name: MATERIAL_MAP_DIFFUSE
Type: UNKNOWN
Define 050: MATERIAL_MAP_SPECULAR
Name: MATERIAL_MAP_SPECULAR
Type: UNKNOWN
Define 051: SHADER_LOC_MAP_DIFFUSE
Name: SHADER_LOC_MAP_DIFFUSE
Type: UNKNOWN
Define 052: SHADER_LOC_MAP_SPECULAR
Name: SHADER_LOC_MAP_SPECULAR
Type: UNKNOWN

View File

@ -542,6 +542,60 @@
<Value name="NPATCH_THREE_PATCH_HORIZONTAL" integer="2" desc="Npatch layout: 3x1 tiles" />
</Enum>
</Enums>
<Defines count="52">
<Define name="RAYLIB_H" type="GUARD" />
<Define name="RAYLIB_VERSION" type="STRING" />
<Define name="RLAPI" type="UNKNOWN" />
<Define name="PI" type="FLOAT" />
<Define name="DEG2RAD" type="UNKNOWN" />
<Define name="RAD2DEG" type="UNKNOWN" />
<Define name="RL_MALLOC(sz)" type="MACRO" />
<Define name="RL_CALLOC(n,sz)" type="MACRO" />
<Define name="RL_REALLOC(ptr,sz)" type="MACRO" />
<Define name="RL_FREE(ptr)" type="MACRO" />
<Define name="CLITERAL(type)" type="MACRO" />
<Define name="RL_COLOR_TYPE" type="GUARD" />
<Define name="RL_RECTANGLE_TYPE" type="GUARD" />
<Define name="RL_VECTOR2_TYPE" type="GUARD" />
<Define name="RL_VECTOR3_TYPE" type="GUARD" />
<Define name="RL_VECTOR4_TYPE" type="GUARD" />
<Define name="RL_QUATERNION_TYPE" type="GUARD" />
<Define name="RL_MATRIX_TYPE" type="GUARD" />
<Define name="LIGHTGRAY" type="COLOR" />
<Define name="GRAY" type="COLOR" />
<Define name="DARKGRAY" type="COLOR" />
<Define name="YELLOW" type="COLOR" />
<Define name="GOLD" type="COLOR" />
<Define name="ORANGE" type="COLOR" />
<Define name="PINK" type="COLOR" />
<Define name="RED" type="COLOR" />
<Define name="MAROON" type="COLOR" />
<Define name="GREEN" type="COLOR" />
<Define name="LIME" type="COLOR" />
<Define name="DARKGREEN" type="COLOR" />
<Define name="SKYBLUE" type="COLOR" />
<Define name="BLUE" type="COLOR" />
<Define name="DARKBLUE" type="COLOR" />
<Define name="PURPLE" type="COLOR" />
<Define name="VIOLET" type="COLOR" />
<Define name="DARKPURPLE" type="COLOR" />
<Define name="BEIGE" type="COLOR" />
<Define name="BROWN" type="COLOR" />
<Define name="DARKBROWN" type="COLOR" />
<Define name="WHITE" type="COLOR" />
<Define name="BLACK" type="COLOR" />
<Define name="BLANK" type="COLOR" />
<Define name="MAGENTA" type="COLOR" />
<Define name="RAYWHITE" type="COLOR" />
<Define name="RL_BOOL_TYPE" type="GUARD" />
<Define name="MOUSE_LEFT_BUTTON" type="UNKNOWN" />
<Define name="MOUSE_RIGHT_BUTTON" type="UNKNOWN" />
<Define name="MOUSE_MIDDLE_BUTTON" type="UNKNOWN" />
<Define name="MATERIAL_MAP_DIFFUSE" type="UNKNOWN" />
<Define name="MATERIAL_MAP_SPECULAR" type="UNKNOWN" />
<Define name="SHADER_LOC_MAP_DIFFUSE" type="UNKNOWN" />
<Define name="SHADER_LOC_MAP_SPECULAR" type="UNKNOWN" />
</Defines>
<Functions count="491">
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
<Param type="int" name="width" desc="" />

View File

@ -2,12 +2,13 @@
raylib API parser
This parser scans raylib.h to get API information about structs, enums and functions.
This parser scans raylib.h to get API information about structs, enums, functions and defines.
All data is divided into pieces, usually as strings. The following types are used for data:
- struct FunctionInfo
- struct StructInfo
- struct EnumInfo
- struct DefInfo
CONSTRAINTS:
@ -62,10 +63,12 @@
#include <stdlib.h> // Required for: malloc(), calloc(), realloc(), free(), atoi(), strtol()
#include <stdio.h> // Required for: printf(), fopen(), fseek(), ftell(), fread(), fclose()
#include <stdbool.h> // Required for: bool
#include <ctype.h> // Required for: isdigit()
#define MAX_FUNCS_TO_PARSE 512 // Maximum number of functions to parse
#define MAX_STRUCTS_TO_PARSE 64 // Maximum number of structures to parse
#define MAX_ENUMS_TO_PARSE 64 // Maximum number of enums to parse
#define MAX_DEFINES_TO_PARSE 512
#define MAX_LINE_LENGTH 512 // Maximum length of one line (including comments)
#define MAX_STRUCT_LINE_LENGTH 2048 // Maximum length of one struct (multiple lines)
@ -108,6 +111,14 @@ typedef struct EnumInfo {
char valueDesc[MAX_ENUM_VALUES][128]; // Value description
} EnumInfo;
typedef enum { UNKNOWN, MACRO, GUARD, INT, FLOAT, DOUBLE, CHAR, STRING, COLOR } DefineType;
// Define info data
typedef struct DefineInfo {
char name[64];
DefineType type;
} DefineInfo;
// Output format for parsed data
typedef enum { DEFAULT = 0, JSON, XML, LUA } OutputFormat;
@ -117,9 +128,11 @@ typedef enum { DEFAULT = 0, JSON, XML, LUA } OutputFormat;
static int funcCount = 0;
static int structCount = 0;
static int enumCount = 0;
static int defCount = 0;
static FunctionInfo *funcs = NULL;
static StructInfo *structs = NULL;
static EnumInfo *enums = NULL;
static DefineInfo *defs = NULL;
static char apiDefine[32] = "RLAPI\0";
// Command line variables
@ -140,6 +153,7 @@ static unsigned int TextLength(const char *text); // Get text length i
static bool IsTextEqual(const char *text1, const char *text2, unsigned int count);
static void MemoryCopy(void *dest, const void *src, unsigned int count);
static char *EscapeBackslashes(char *text); // Replace '\' by "\\" when exporting to JSON and XML
static const char *StrDefineType(DefineType type); // Get string of define type
static void ExportParsedData(const char *fileName, int format); // Export parsed data in desired format
@ -169,6 +183,9 @@ int main(int argc, char* argv[])
// Enums lines pointers, selected from buffer "lines"
int *enumLines = (int *)malloc(MAX_ENUMS_TO_PARSE*sizeof(int));
// Defines lines pointers, selected from buffer "lines"
int *defLines = (int *)malloc(MAX_DEFINES_TO_PARSE*sizeof(int));
// Prepare required lines for parsing
//--------------------------------------------------------------------------------------------------
@ -228,7 +245,22 @@ int main(int argc, char* argv[])
}
}
// At this point we have all raylib structs, enums, functions lines data to start parsing
// Read const lines
for (int i = 0; i < linesCount; i++)
{
int j = 0;
while (lines[i][j] == ' ' || lines[i][j] == '\t') j++; // skip spaces and tabs in the begining
// Read define line
if (IsTextEqual(lines[i]+j, "#define ", 8))
{
// Keep the line position in the array of lines,
// so, we can scan that position and following lines
defLines[defCount] = i;
defCount++;
}
}
// At this point we have all raylib structs, enums, functions, defs lines data to start parsing
free(buffer); // Unload text buffer
@ -402,9 +434,72 @@ int main(int argc, char* argv[])
}
}
}
free(enumLines);
// Define info data
defs = (DefineInfo *)calloc(MAX_DEFINES_TO_PARSE, sizeof(DefineInfo));
int defineIndex = 0;
for (int i = 0; i < defCount; i++)
{
char *linePtr = lines[defLines[i]];
int j = 0;
int constNameStart, constNameEnd;
while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs in the begining
j += 8; // Skip "#define "
while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs after "#define "
constNameStart = j;
while (linePtr[j] != ' ' && linePtr[j] != '\t' && linePtr[j] != '\0') j++; // Extract name
constNameEnd = j-1;
// Functional macros
if (linePtr[constNameEnd] == ')') {
defs[defineIndex].type = MACRO;
}
while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs after name
// Empty
if (linePtr[j] == '\0' || linePtr == "/") {
defs[defineIndex].type = GUARD;
}
if (linePtr[j] == '"') defs[defineIndex].type = STRING;
else if (linePtr[j] == '\'') defs[defineIndex].type = CHAR;
else if (IsTextEqual(linePtr+j, "CLITERAL(Color)", 15)) defs[defineIndex].type = COLOR;
// Parsing numbers
else if (isdigit(linePtr[j])) {
bool isFloat = false;
while (linePtr[j] != ' ' && linePtr[j] != '\t' && linePtr[j] != '\n' && linePtr[j] != '\r') {
j++;
if (linePtr[j] == '.') isFloat = true;
}
if (isFloat) {
defs[defineIndex].type = linePtr[j-1] == 'f' ? FLOAT : DOUBLE;
} else {
defs[defineIndex].type = INT;
}
}
// Skip duplicates
int len = constNameEnd - constNameStart + 1;
bool isDuplicate = false;
for (int k = 0; k < defineIndex; k++) {
if (len == TextLength(defs[k].name) && IsTextEqual(defs[k].name, linePtr + constNameStart, len)) {
isDuplicate = true;
break;
}
}
if (isDuplicate) continue;
MemoryCopy(defs[defineIndex].name, linePtr + constNameStart, len);
defineIndex++;
}
defCount = defineIndex;
free(defLines);
// Functions info data
funcs = (FunctionInfo *)calloc(MAX_FUNCS_TO_PARSE, sizeof(FunctionInfo));
@ -486,6 +581,7 @@ int main(int argc, char* argv[])
// structs[] -> We have all the structs decomposed into pieces for further analysis
// enums[] -> We have all the enums decomposed into pieces for further analysis
// funcs[] -> We have all the functions decomposed into pieces for further analysis
// defs[] -> We have all the defines decomposed into pieces for further analysis
// Process input file to output
if (outFileName[0] == '\0') MemoryCopy(outFileName, "raylib_api.txt\0", 15);
@ -759,6 +855,23 @@ static char *EscapeBackslashes(char *text)
return buffer;
}
static const char *StrDefineType(DefineType type)
{
switch (type)
{
case UNKNOWN: return "UNKNOWN";
case GUARD: return "GUARD";
case MACRO: return "MACRO";
case INT: return "INT";
case FLOAT: return "FLOAT";
case DOUBLE: return "DOUBLE";
case CHAR: return "CHAR";
case STRING: return "STRING";
case COLOR: return "COLOR";
}
return "";
}
/*
// Replace text string
// REQUIRES: strlen(), strstr(), strncpy(), strcpy() -> TODO: Replace by custom implementations!
@ -851,6 +964,14 @@ static void ExportParsedData(const char *fileName, int format)
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");
}
fprintf(outFile, "\nDefines found: %i\n\n", defCount);
for (int i = 0; i < defCount; i++)
{
fprintf(outFile, "Define %03i: %s\n", i + 1, defs[i].name);
fprintf(outFile, " Name: %s\n", defs[i].name);
fprintf(outFile, " Type: %s\n", StrDefineType(defs[i].type));
}
} break;
case LUA:
{
@ -906,6 +1027,20 @@ static void ExportParsedData(const char *fileName, int format)
}
fprintf(outFile, " },\n");
// Print defs info
fprintf(outFile, " defs = {\n");
for (int i = 0; i < defCount; i++)
{
fprintf(outFile, " {\n");
fprintf(outFile, " name = \"%s\",\n", defs[i].name);
fprintf(outFile, " type = \"%s\"\n", StrDefineType(defs[i].type));
fprintf(outFile, " }");
if (i < funcCount - 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++)
@ -989,6 +1124,20 @@ static void ExportParsedData(const char *fileName, int format)
}
fprintf(outFile, " ],\n");
// Print defs info
fprintf(outFile, " \"defs\": [\n");
for (int i = 0; i < defCount; i++)
{
fprintf(outFile, " {\n");
fprintf(outFile, " \"name\": \"%s\",\n", defs[i].name);
fprintf(outFile, " \"type\": \"%s\"\n", StrDefineType(defs[i].type));
fprintf(outFile, " }");
if (i < defCount - 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++)
@ -1077,6 +1226,14 @@ static void ExportParsedData(const char *fileName, int format)
}
fprintf(outFile, " </Enums>\n");
// Print defs info
fprintf(outFile, " <Defines count=\"%i\">\n", defCount);
for (int i = 0; i < defCount; i++)
{
fprintf(outFile, " <Define name=\"%s\" type=\"%s\" />\n", defs[i].name, StrDefineType(defs[i].type));
}
fprintf(outFile, " </Defines>\n");
// Print functions info
fprintf(outFile, " <Functions count=\"%i\">\n", funcCount);
for (int i = 0; i < funcCount; i++)