summaryrefslogtreecommitdiffhomepage
path: root/parser/raylib_parser.c
diff options
context:
space:
mode:
authorEthan Conneely <[email protected]>2022-03-17 10:52:13 +0000
committerGitHub <[email protected]>2022-03-17 11:52:13 +0100
commit3d812f8d0c0f3a854311f73957740c7aa846c5a4 (patch)
tree7636922967b3903476a254eb523f344f630c381d /parser/raylib_parser.c
parent4954778f684b41046e72743fc32d29c74ea639f4 (diff)
downloadraylib-3d812f8d0c0f3a854311f73957740c7aa846c5a4.tar.gz
raylib-3d812f8d0c0f3a854311f73957740c7aa846c5a4.zip
Fix inline enum (#2393)
Diffstat (limited to 'parser/raylib_parser.c')
-rw-r--r--parser/raylib_parser.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/parser/raylib_parser.c b/parser/raylib_parser.c
index e7ee901b..f4d1ad08 100644
--- a/parser/raylib_parser.c
+++ b/parser/raylib_parser.c
@@ -241,7 +241,7 @@ int main(int argc, char* argv[])
for (int i = 0; i < linesCount; i++)
{
// Read enum line
- if (IsTextEqual(lines[i], "typedef enum {", 14))
+ if (IsTextEqual(lines[i], "typedef enum {", 14) && lines[i][TextLength(lines[i])-1] != ';') // ignore inline enums
{
// Keep the line position in the array of lines,
// so, we can scan that position and following lines
@@ -401,17 +401,17 @@ int main(int argc, char* argv[])
{
if (linePtr[c + 1] == ' ') c += 2;
else c++;
-
+
// Parse integer value
int n = 0;
char integer[16] = { 0 };
-
+
while ((linePtr[c] != ',') && (linePtr[c] != ' ') && (linePtr[c] != '\0'))
{
integer[n] = linePtr[c];
c++; n++;
}
-
+
if (integer[1] == 'x') enums[i].valueInteger[enums[i].valueCount] = (int)strtol(integer, NULL, 16);
else enums[i].valueInteger[enums[i].valueCount] = atoi(integer);
}
@@ -869,22 +869,22 @@ static bool IsTextEqual(const char *text1, const char *text2, unsigned int count
static char *EscapeBackslashes(char *text)
{
static char buffer[256] = { 0 };
-
+
int count = 0;
-
+
for (int i = 0; (text[i] != '\0') && (i < 255); i++, count++)
{
buffer[count] = text[i];
-
- if (text[i] == '\\')
+
+ if (text[i] == '\\')
{
buffer[count + 1] = '\\';
count++;
}
}
-
+
buffer[count] = '\0';
-
+
return buffer;
}