From 565319184cbba9ba76fd855d5d23fa2691e9d75f Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 31 May 2021 12:37:03 +0200 Subject: [PATCH] Reviewed struct field name --- parser/README.md | 4 ++-- parser/raylib_parser.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/parser/README.md b/parser/README.md index 85c21266..a21d6787 100644 --- a/parser/README.md +++ b/parser/README.md @@ -32,7 +32,7 @@ This parser is specifically designed to work with raylib.h, so, it has some cons ``` typedef enum { - = , + = , , , @@ -41,7 +41,7 @@ This parser is specifically designed to work with raylib.h, so, it has some cons _NOTE: For enums, multiple options are supported:_ - - If value is not provided, ( + 1) is assigned + - If value is not provided, ( + 1) is assigned - Value description can be provided or not ## Additional notes diff --git a/parser/raylib_parser.c b/parser/raylib_parser.c index 4655fd14..da426a97 100644 --- a/parser/raylib_parser.c +++ b/parser/raylib_parser.c @@ -32,14 +32,14 @@ typedef enum { - = , + = , , , } ; NOTE: Multiple options are supported: - - If value is not provided, ( + 1) is assigned + - If value is not provided, ( + 1) is assigned - Value description can be provided or not This parser could work with other C header files if mentioned constraints are followed. @@ -95,7 +95,7 @@ typedef struct EnumInfo { char desc[64]; // Enum description int valueCount; // Number of values in enumerator char valueName[128][64]; // Value name definition (max: 128 values) - int valueInt[128]; // Value integer (max: 128 values) + int valueInteger[128]; // Value integer (max: 128 values) char valueDesc[128][64]; // Value description (max: 128 values) } EnumInfo; @@ -362,14 +362,14 @@ int main() c++; n++; } - if (integer[1] == 'x') enums[i].valueInt[enums[i].valueCount] = (int)strtol(integer, NULL, 16); - else enums[i].valueInt[enums[i].valueCount] = atoi(integer); + if (integer[1] == 'x') enums[i].valueInteger[enums[i].valueCount] = (int)strtol(integer, NULL, 16); + else enums[i].valueInteger[enums[i].valueCount] = atoi(integer); } - else enums[i].valueInt[enums[i].valueCount] = (enums[i].valueInt[enums[i].valueCount - 1] + 1); + else enums[i].valueInteger[enums[i].valueCount] = (enums[i].valueInteger[enums[i].valueCount - 1] + 1); // TODO: Parse value description if any } - else enums[i].valueInt[enums[i].valueCount] = (enums[i].valueInt[enums[i].valueCount - 1] + 1); + else enums[i].valueInteger[enums[i].valueCount] = (enums[i].valueInteger[enums[i].valueCount - 1] + 1); enums[i].valueCount++; } @@ -480,7 +480,7 @@ int main() { printf("Enum %02i: %s (%i values)\n", i + 1, enums[i].name, enums[i].valueCount); //printf("Description: %s\n", enums[i].desc); - for (int e = 0; e < enums[i].valueCount; e++) printf(" Value %s: %i\n", enums[i].valueName[e], enums[i].valueInt[e]); + for (int e = 0; e < enums[i].valueCount; e++) printf(" Value %s: %i\n", enums[i].valueName[e], enums[i].valueInteger[e]); } // Print function info