added value and description for defines in parser

This commit is contained in:
Ilya 2022-01-10 18:43:19 +03:00
parent 1d7ff04923
commit 5097077597
5 changed files with 617 additions and 261 deletions

View File

@ -2485,214 +2485,318 @@
] ]
} }
], ],
"defs": [ "defines": [
{ {
"name": "RAYLIB_H", "name": "RAYLIB_H",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "RAYLIB_VERSION", "name": "RAYLIB_VERSION",
"type": "STRING" "type": "STRING",
"value": "4.1-dev",
"description": ""
}, },
{ {
"name": "RLAPI", "name": "RLAPI",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "__declspec(dllexport)",
"description": "We are building the library as a Win32 shared library (.dll)"
}, },
{ {
"name": "PI", "name": "PI",
"type": "FLOAT" "type": "FLOAT",
"value": 3.14159265358979323846,
"description": ""
}, },
{ {
"name": "DEG2RAD", "name": "DEG2RAD",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "(PI/180.0f)",
"description": ""
}, },
{ {
"name": "RAD2DEG", "name": "RAD2DEG",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "(180.0f/PI)",
"description": ""
}, },
{ {
"name": "RL_MALLOC(sz)", "name": "RL_MALLOC(sz)",
"type": "MACRO" "type": "MACRO",
"value": "malloc(sz)",
"description": ""
}, },
{ {
"name": "RL_CALLOC(n,sz)", "name": "RL_CALLOC(n,sz)",
"type": "MACRO" "type": "MACRO",
"value": "calloc(n,sz)",
"description": ""
}, },
{ {
"name": "RL_REALLOC(ptr,sz)", "name": "RL_REALLOC(ptr,sz)",
"type": "MACRO" "type": "MACRO",
"value": "realloc(ptr,sz)",
"description": ""
}, },
{ {
"name": "RL_FREE(ptr)", "name": "RL_FREE(ptr)",
"type": "MACRO" "type": "MACRO",
"value": "free(ptr)",
"description": ""
}, },
{ {
"name": "CLITERAL(type)", "name": "CLITERAL(type)",
"type": "MACRO" "type": "MACRO",
"value": "type",
"description": ""
}, },
{ {
"name": "RL_COLOR_TYPE", "name": "RL_COLOR_TYPE",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "RL_RECTANGLE_TYPE", "name": "RL_RECTANGLE_TYPE",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "RL_VECTOR2_TYPE", "name": "RL_VECTOR2_TYPE",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "RL_VECTOR3_TYPE", "name": "RL_VECTOR3_TYPE",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "RL_VECTOR4_TYPE", "name": "RL_VECTOR4_TYPE",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "RL_QUATERNION_TYPE", "name": "RL_QUATERNION_TYPE",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "RL_MATRIX_TYPE", "name": "RL_MATRIX_TYPE",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "LIGHTGRAY", "name": "LIGHTGRAY",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 200, 200, 200, 255 }",
"description": "Light Gray"
}, },
{ {
"name": "GRAY", "name": "GRAY",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 130, 130, 130, 255 }",
"description": "Gray"
}, },
{ {
"name": "DARKGRAY", "name": "DARKGRAY",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 80, 80, 80, 255 }",
"description": "Dark Gray"
}, },
{ {
"name": "YELLOW", "name": "YELLOW",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 253, 249, 0, 255 }",
"description": "Yellow"
}, },
{ {
"name": "GOLD", "name": "GOLD",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 255, 203, 0, 255 }",
"description": "Gold"
}, },
{ {
"name": "ORANGE", "name": "ORANGE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 255, 161, 0, 255 }",
"description": "Orange"
}, },
{ {
"name": "PINK", "name": "PINK",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 255, 109, 194, 255 }",
"description": "Pink"
}, },
{ {
"name": "RED", "name": "RED",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 230, 41, 55, 255 }",
"description": "Red"
}, },
{ {
"name": "MAROON", "name": "MAROON",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 190, 33, 55, 255 }",
"description": "Maroon"
}, },
{ {
"name": "GREEN", "name": "GREEN",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 0, 228, 48, 255 }",
"description": "Green"
}, },
{ {
"name": "LIME", "name": "LIME",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 0, 158, 47, 255 }",
"description": "Lime"
}, },
{ {
"name": "DARKGREEN", "name": "DARKGREEN",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 0, 117, 44, 255 }",
"description": "Dark Green"
}, },
{ {
"name": "SKYBLUE", "name": "SKYBLUE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 102, 191, 255, 255 }",
"description": "Sky Blue"
}, },
{ {
"name": "BLUE", "name": "BLUE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 0, 121, 241, 255 }",
"description": "Blue"
}, },
{ {
"name": "DARKBLUE", "name": "DARKBLUE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 0, 82, 172, 255 }",
"description": "Dark Blue"
}, },
{ {
"name": "PURPLE", "name": "PURPLE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 200, 122, 255, 255 }",
"description": "Purple"
}, },
{ {
"name": "VIOLET", "name": "VIOLET",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 135, 60, 190, 255 }",
"description": "Violet"
}, },
{ {
"name": "DARKPURPLE", "name": "DARKPURPLE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 112, 31, 126, 255 }",
"description": "Dark Purple"
}, },
{ {
"name": "BEIGE", "name": "BEIGE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 211, 176, 131, 255 }",
"description": "Beige"
}, },
{ {
"name": "BROWN", "name": "BROWN",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 127, 106, 79, 255 }",
"description": "Brown"
}, },
{ {
"name": "DARKBROWN", "name": "DARKBROWN",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 76, 63, 47, 255 }",
"description": "Dark Brown"
}, },
{ {
"name": "WHITE", "name": "WHITE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 255, 255, 255, 255 }",
"description": "White"
}, },
{ {
"name": "BLACK", "name": "BLACK",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 0, 0, 0, 255 }",
"description": "Black"
}, },
{ {
"name": "BLANK", "name": "BLANK",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 0, 0, 0, 0 }",
"description": "Blank (Transparent)"
}, },
{ {
"name": "MAGENTA", "name": "MAGENTA",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 255, 0, 255, 255 }",
"description": "Magenta"
}, },
{ {
"name": "RAYWHITE", "name": "RAYWHITE",
"type": "COLOR" "type": "COLOR",
"value": "CLITERAL(Color){ 245, 245, 245, 255 }",
"description": "My own White (raylib logo)"
}, },
{ {
"name": "RL_BOOL_TYPE", "name": "RL_BOOL_TYPE",
"type": "GUARD" "type": "GUARD",
"value": "",
"description": ""
}, },
{ {
"name": "MOUSE_LEFT_BUTTON", "name": "MOUSE_LEFT_BUTTON",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "MOUSE_BUTTON_LEFT",
"description": ""
}, },
{ {
"name": "MOUSE_RIGHT_BUTTON", "name": "MOUSE_RIGHT_BUTTON",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "MOUSE_BUTTON_RIGHT",
"description": ""
}, },
{ {
"name": "MOUSE_MIDDLE_BUTTON", "name": "MOUSE_MIDDLE_BUTTON",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "MOUSE_BUTTON_MIDDLE",
"description": ""
}, },
{ {
"name": "MATERIAL_MAP_DIFFUSE", "name": "MATERIAL_MAP_DIFFUSE",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "MATERIAL_MAP_ALBEDO",
"description": ""
}, },
{ {
"name": "MATERIAL_MAP_SPECULAR", "name": "MATERIAL_MAP_SPECULAR",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "MATERIAL_MAP_METALNESS",
"description": ""
}, },
{ {
"name": "SHADER_LOC_MAP_DIFFUSE", "name": "SHADER_LOC_MAP_DIFFUSE",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "SHADER_LOC_MAP_ALBEDO",
"description": ""
}, },
{ {
"name": "SHADER_LOC_MAP_SPECULAR", "name": "SHADER_LOC_MAP_SPECULAR",
"type": "UNKNOWN" "type": "UNKNOWN",
"value": "SHADER_LOC_MAP_METALNESS",
"description": ""
} }
], ],
"functions": [ "functions": [

View File

@ -2485,214 +2485,318 @@ return {
} }
} }
}, },
defs = { defines = {
{ {
name = "RAYLIB_H", name = "RAYLIB_H",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "RAYLIB_VERSION", name = "RAYLIB_VERSION",
type = "STRING" type = "STRING",
value = "4.1-dev",
description = ""
}, },
{ {
name = "RLAPI", name = "RLAPI",
type = "UNKNOWN" type = "UNKNOWN",
value = "__declspec(dllexport)",
description = "We are building the library as a Win32 shared library (.dll)"
}, },
{ {
name = "PI", name = "PI",
type = "FLOAT" type = "FLOAT",
value = 3.14159265358979323846,
description = ""
}, },
{ {
name = "DEG2RAD", name = "DEG2RAD",
type = "UNKNOWN" type = "UNKNOWN",
value = "(PI/180.0f)",
description = ""
}, },
{ {
name = "RAD2DEG", name = "RAD2DEG",
type = "UNKNOWN" type = "UNKNOWN",
value = "(180.0f/PI)",
description = ""
}, },
{ {
name = "RL_MALLOC(sz)", name = "RL_MALLOC(sz)",
type = "MACRO" type = "MACRO",
value = "malloc(sz)",
description = ""
}, },
{ {
name = "RL_CALLOC(n,sz)", name = "RL_CALLOC(n,sz)",
type = "MACRO" type = "MACRO",
value = "calloc(n,sz)",
description = ""
}, },
{ {
name = "RL_REALLOC(ptr,sz)", name = "RL_REALLOC(ptr,sz)",
type = "MACRO" type = "MACRO",
value = "realloc(ptr,sz)",
description = ""
}, },
{ {
name = "RL_FREE(ptr)", name = "RL_FREE(ptr)",
type = "MACRO" type = "MACRO",
value = "free(ptr)",
description = ""
}, },
{ {
name = "CLITERAL(type)", name = "CLITERAL(type)",
type = "MACRO" type = "MACRO",
value = "type",
description = ""
}, },
{ {
name = "RL_COLOR_TYPE", name = "RL_COLOR_TYPE",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "RL_RECTANGLE_TYPE", name = "RL_RECTANGLE_TYPE",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "RL_VECTOR2_TYPE", name = "RL_VECTOR2_TYPE",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "RL_VECTOR3_TYPE", name = "RL_VECTOR3_TYPE",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "RL_VECTOR4_TYPE", name = "RL_VECTOR4_TYPE",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "RL_QUATERNION_TYPE", name = "RL_QUATERNION_TYPE",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "RL_MATRIX_TYPE", name = "RL_MATRIX_TYPE",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "LIGHTGRAY", name = "LIGHTGRAY",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 200, 200, 200, 255 }",
description = "Light Gray"
}, },
{ {
name = "GRAY", name = "GRAY",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 130, 130, 130, 255 }",
description = "Gray"
}, },
{ {
name = "DARKGRAY", name = "DARKGRAY",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 80, 80, 80, 255 }",
description = "Dark Gray"
}, },
{ {
name = "YELLOW", name = "YELLOW",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 253, 249, 0, 255 }",
description = "Yellow"
}, },
{ {
name = "GOLD", name = "GOLD",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 255, 203, 0, 255 }",
description = "Gold"
}, },
{ {
name = "ORANGE", name = "ORANGE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 255, 161, 0, 255 }",
description = "Orange"
}, },
{ {
name = "PINK", name = "PINK",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 255, 109, 194, 255 }",
description = "Pink"
}, },
{ {
name = "RED", name = "RED",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 230, 41, 55, 255 }",
description = "Red"
}, },
{ {
name = "MAROON", name = "MAROON",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 190, 33, 55, 255 }",
description = "Maroon"
}, },
{ {
name = "GREEN", name = "GREEN",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 0, 228, 48, 255 }",
description = "Green"
}, },
{ {
name = "LIME", name = "LIME",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 0, 158, 47, 255 }",
description = "Lime"
}, },
{ {
name = "DARKGREEN", name = "DARKGREEN",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 0, 117, 44, 255 }",
description = "Dark Green"
}, },
{ {
name = "SKYBLUE", name = "SKYBLUE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 102, 191, 255, 255 }",
description = "Sky Blue"
}, },
{ {
name = "BLUE", name = "BLUE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 0, 121, 241, 255 }",
description = "Blue"
}, },
{ {
name = "DARKBLUE", name = "DARKBLUE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 0, 82, 172, 255 }",
description = "Dark Blue"
}, },
{ {
name = "PURPLE", name = "PURPLE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 200, 122, 255, 255 }",
description = "Purple"
}, },
{ {
name = "VIOLET", name = "VIOLET",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 135, 60, 190, 255 }",
description = "Violet"
}, },
{ {
name = "DARKPURPLE", name = "DARKPURPLE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 112, 31, 126, 255 }",
description = "Dark Purple"
}, },
{ {
name = "BEIGE", name = "BEIGE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 211, 176, 131, 255 }",
description = "Beige"
}, },
{ {
name = "BROWN", name = "BROWN",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 127, 106, 79, 255 }",
description = "Brown"
}, },
{ {
name = "DARKBROWN", name = "DARKBROWN",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 76, 63, 47, 255 }",
description = "Dark Brown"
}, },
{ {
name = "WHITE", name = "WHITE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 255, 255, 255, 255 }",
description = "White"
}, },
{ {
name = "BLACK", name = "BLACK",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 0, 0, 0, 255 }",
description = "Black"
}, },
{ {
name = "BLANK", name = "BLANK",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 0, 0, 0, 0 }",
description = "Blank (Transparent)"
}, },
{ {
name = "MAGENTA", name = "MAGENTA",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 255, 0, 255, 255 }",
description = "Magenta"
}, },
{ {
name = "RAYWHITE", name = "RAYWHITE",
type = "COLOR" type = "COLOR",
value = "CLITERAL(Color){ 245, 245, 245, 255 }",
description = "My own White (raylib logo)"
}, },
{ {
name = "RL_BOOL_TYPE", name = "RL_BOOL_TYPE",
type = "GUARD" type = "GUARD",
value = "",
description = ""
}, },
{ {
name = "MOUSE_LEFT_BUTTON", name = "MOUSE_LEFT_BUTTON",
type = "UNKNOWN" type = "UNKNOWN",
value = "MOUSE_BUTTON_LEFT",
description = ""
}, },
{ {
name = "MOUSE_RIGHT_BUTTON", name = "MOUSE_RIGHT_BUTTON",
type = "UNKNOWN" type = "UNKNOWN",
value = "MOUSE_BUTTON_RIGHT",
description = ""
}, },
{ {
name = "MOUSE_MIDDLE_BUTTON", name = "MOUSE_MIDDLE_BUTTON",
type = "UNKNOWN" type = "UNKNOWN",
value = "MOUSE_BUTTON_MIDDLE",
description = ""
}, },
{ {
name = "MATERIAL_MAP_DIFFUSE", name = "MATERIAL_MAP_DIFFUSE",
type = "UNKNOWN" type = "UNKNOWN",
value = "MATERIAL_MAP_ALBEDO",
description = ""
}, },
{ {
name = "MATERIAL_MAP_SPECULAR", name = "MATERIAL_MAP_SPECULAR",
type = "UNKNOWN" type = "UNKNOWN",
value = "MATERIAL_MAP_METALNESS",
description = ""
}, },
{ {
name = "SHADER_LOC_MAP_DIFFUSE", name = "SHADER_LOC_MAP_DIFFUSE",
type = "UNKNOWN" type = "UNKNOWN",
value = "SHADER_LOC_MAP_ALBEDO",
description = ""
}, },
{ {
name = "SHADER_LOC_MAP_SPECULAR", name = "SHADER_LOC_MAP_SPECULAR",
type = "UNKNOWN" type = "UNKNOWN",
value = "SHADER_LOC_MAP_METALNESS",
description = ""
}, },
}, },
functions = { functions = {

View File

@ -3699,156 +3699,260 @@ Defines found: 52
Define 001: RAYLIB_H Define 001: RAYLIB_H
Name: RAYLIB_H Name: RAYLIB_H
Type: GUARD Type: GUARD
Value:
Description:
Define 002: RAYLIB_VERSION Define 002: RAYLIB_VERSION
Name: RAYLIB_VERSION Name: RAYLIB_VERSION
Type: STRING Type: STRING
Value: "4.1-dev"
Description:
Define 003: RLAPI Define 003: RLAPI
Name: RLAPI Name: RLAPI
Type: UNKNOWN Type: UNKNOWN
Value: __declspec(dllexport)
Description: We are building the library as a Win32 shared library (.dll)
Define 004: PI Define 004: PI
Name: PI Name: PI
Type: FLOAT Type: FLOAT
Value: 3.14159265358979323846f
Description:
Define 005: DEG2RAD Define 005: DEG2RAD
Name: DEG2RAD Name: DEG2RAD
Type: UNKNOWN Type: UNKNOWN
Value: (PI/180.0f)
Description:
Define 006: RAD2DEG Define 006: RAD2DEG
Name: RAD2DEG Name: RAD2DEG
Type: UNKNOWN Type: UNKNOWN
Value: (180.0f/PI)
Description:
Define 007: RL_MALLOC(sz) Define 007: RL_MALLOC(sz)
Name: RL_MALLOC(sz) Name: RL_MALLOC(sz)
Type: MACRO Type: MACRO
Value: malloc(sz)
Description:
Define 008: RL_CALLOC(n,sz) Define 008: RL_CALLOC(n,sz)
Name: RL_CALLOC(n,sz) Name: RL_CALLOC(n,sz)
Type: MACRO Type: MACRO
Value: calloc(n,sz)
Description:
Define 009: RL_REALLOC(ptr,sz) Define 009: RL_REALLOC(ptr,sz)
Name: RL_REALLOC(ptr,sz) Name: RL_REALLOC(ptr,sz)
Type: MACRO Type: MACRO
Value: realloc(ptr,sz)
Description:
Define 010: RL_FREE(ptr) Define 010: RL_FREE(ptr)
Name: RL_FREE(ptr) Name: RL_FREE(ptr)
Type: MACRO Type: MACRO
Value: free(ptr)
Description:
Define 011: CLITERAL(type) Define 011: CLITERAL(type)
Name: CLITERAL(type) Name: CLITERAL(type)
Type: MACRO Type: MACRO
Value: type
Description:
Define 012: RL_COLOR_TYPE Define 012: RL_COLOR_TYPE
Name: RL_COLOR_TYPE Name: RL_COLOR_TYPE
Type: GUARD Type: GUARD
Value:
Description:
Define 013: RL_RECTANGLE_TYPE Define 013: RL_RECTANGLE_TYPE
Name: RL_RECTANGLE_TYPE Name: RL_RECTANGLE_TYPE
Type: GUARD Type: GUARD
Value:
Description:
Define 014: RL_VECTOR2_TYPE Define 014: RL_VECTOR2_TYPE
Name: RL_VECTOR2_TYPE Name: RL_VECTOR2_TYPE
Type: GUARD Type: GUARD
Value:
Description:
Define 015: RL_VECTOR3_TYPE Define 015: RL_VECTOR3_TYPE
Name: RL_VECTOR3_TYPE Name: RL_VECTOR3_TYPE
Type: GUARD Type: GUARD
Value:
Description:
Define 016: RL_VECTOR4_TYPE Define 016: RL_VECTOR4_TYPE
Name: RL_VECTOR4_TYPE Name: RL_VECTOR4_TYPE
Type: GUARD Type: GUARD
Value:
Description:
Define 017: RL_QUATERNION_TYPE Define 017: RL_QUATERNION_TYPE
Name: RL_QUATERNION_TYPE Name: RL_QUATERNION_TYPE
Type: GUARD Type: GUARD
Value:
Description:
Define 018: RL_MATRIX_TYPE Define 018: RL_MATRIX_TYPE
Name: RL_MATRIX_TYPE Name: RL_MATRIX_TYPE
Type: GUARD Type: GUARD
Value:
Description:
Define 019: LIGHTGRAY Define 019: LIGHTGRAY
Name: LIGHTGRAY Name: LIGHTGRAY
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 200, 200, 200, 255 }
Description: Light Gray
Define 020: GRAY Define 020: GRAY
Name: GRAY Name: GRAY
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 130, 130, 130, 255 }
Description: Gray
Define 021: DARKGRAY Define 021: DARKGRAY
Name: DARKGRAY Name: DARKGRAY
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 80, 80, 80, 255 }
Description: Dark Gray
Define 022: YELLOW Define 022: YELLOW
Name: YELLOW Name: YELLOW
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 253, 249, 0, 255 }
Description: Yellow
Define 023: GOLD Define 023: GOLD
Name: GOLD Name: GOLD
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 255, 203, 0, 255 }
Description: Gold
Define 024: ORANGE Define 024: ORANGE
Name: ORANGE Name: ORANGE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 255, 161, 0, 255 }
Description: Orange
Define 025: PINK Define 025: PINK
Name: PINK Name: PINK
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 255, 109, 194, 255 }
Description: Pink
Define 026: RED Define 026: RED
Name: RED Name: RED
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 230, 41, 55, 255 }
Description: Red
Define 027: MAROON Define 027: MAROON
Name: MAROON Name: MAROON
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 190, 33, 55, 255 }
Description: Maroon
Define 028: GREEN Define 028: GREEN
Name: GREEN Name: GREEN
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 0, 228, 48, 255 }
Description: Green
Define 029: LIME Define 029: LIME
Name: LIME Name: LIME
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 0, 158, 47, 255 }
Description: Lime
Define 030: DARKGREEN Define 030: DARKGREEN
Name: DARKGREEN Name: DARKGREEN
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 0, 117, 44, 255 }
Description: Dark Green
Define 031: SKYBLUE Define 031: SKYBLUE
Name: SKYBLUE Name: SKYBLUE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 102, 191, 255, 255 }
Description: Sky Blue
Define 032: BLUE Define 032: BLUE
Name: BLUE Name: BLUE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 0, 121, 241, 255 }
Description: Blue
Define 033: DARKBLUE Define 033: DARKBLUE
Name: DARKBLUE Name: DARKBLUE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 0, 82, 172, 255 }
Description: Dark Blue
Define 034: PURPLE Define 034: PURPLE
Name: PURPLE Name: PURPLE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 200, 122, 255, 255 }
Description: Purple
Define 035: VIOLET Define 035: VIOLET
Name: VIOLET Name: VIOLET
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 135, 60, 190, 255 }
Description: Violet
Define 036: DARKPURPLE Define 036: DARKPURPLE
Name: DARKPURPLE Name: DARKPURPLE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 112, 31, 126, 255 }
Description: Dark Purple
Define 037: BEIGE Define 037: BEIGE
Name: BEIGE Name: BEIGE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 211, 176, 131, 255 }
Description: Beige
Define 038: BROWN Define 038: BROWN
Name: BROWN Name: BROWN
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 127, 106, 79, 255 }
Description: Brown
Define 039: DARKBROWN Define 039: DARKBROWN
Name: DARKBROWN Name: DARKBROWN
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 76, 63, 47, 255 }
Description: Dark Brown
Define 040: WHITE Define 040: WHITE
Name: WHITE Name: WHITE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 255, 255, 255, 255 }
Description: White
Define 041: BLACK Define 041: BLACK
Name: BLACK Name: BLACK
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 0, 0, 0, 255 }
Description: Black
Define 042: BLANK Define 042: BLANK
Name: BLANK Name: BLANK
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 0, 0, 0, 0 }
Description: Blank (Transparent)
Define 043: MAGENTA Define 043: MAGENTA
Name: MAGENTA Name: MAGENTA
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 255, 0, 255, 255 }
Description: Magenta
Define 044: RAYWHITE Define 044: RAYWHITE
Name: RAYWHITE Name: RAYWHITE
Type: COLOR Type: COLOR
Value: CLITERAL(Color){ 245, 245, 245, 255 }
Description: My own White (raylib logo)
Define 045: RL_BOOL_TYPE Define 045: RL_BOOL_TYPE
Name: RL_BOOL_TYPE Name: RL_BOOL_TYPE
Type: GUARD Type: GUARD
Value:
Description:
Define 046: MOUSE_LEFT_BUTTON Define 046: MOUSE_LEFT_BUTTON
Name: MOUSE_LEFT_BUTTON Name: MOUSE_LEFT_BUTTON
Type: UNKNOWN Type: UNKNOWN
Value: MOUSE_BUTTON_LEFT
Description:
Define 047: MOUSE_RIGHT_BUTTON Define 047: MOUSE_RIGHT_BUTTON
Name: MOUSE_RIGHT_BUTTON Name: MOUSE_RIGHT_BUTTON
Type: UNKNOWN Type: UNKNOWN
Value: MOUSE_BUTTON_RIGHT
Description:
Define 048: MOUSE_MIDDLE_BUTTON Define 048: MOUSE_MIDDLE_BUTTON
Name: MOUSE_MIDDLE_BUTTON Name: MOUSE_MIDDLE_BUTTON
Type: UNKNOWN Type: UNKNOWN
Value: MOUSE_BUTTON_MIDDLE
Description:
Define 049: MATERIAL_MAP_DIFFUSE Define 049: MATERIAL_MAP_DIFFUSE
Name: MATERIAL_MAP_DIFFUSE Name: MATERIAL_MAP_DIFFUSE
Type: UNKNOWN Type: UNKNOWN
Value: MATERIAL_MAP_ALBEDO
Description:
Define 050: MATERIAL_MAP_SPECULAR Define 050: MATERIAL_MAP_SPECULAR
Name: MATERIAL_MAP_SPECULAR Name: MATERIAL_MAP_SPECULAR
Type: UNKNOWN Type: UNKNOWN
Value: MATERIAL_MAP_METALNESS
Description:
Define 051: SHADER_LOC_MAP_DIFFUSE Define 051: SHADER_LOC_MAP_DIFFUSE
Name: SHADER_LOC_MAP_DIFFUSE Name: SHADER_LOC_MAP_DIFFUSE
Type: UNKNOWN Type: UNKNOWN
Value: SHADER_LOC_MAP_ALBEDO
Description:
Define 052: SHADER_LOC_MAP_SPECULAR Define 052: SHADER_LOC_MAP_SPECULAR
Name: SHADER_LOC_MAP_SPECULAR Name: SHADER_LOC_MAP_SPECULAR
Type: UNKNOWN Type: UNKNOWN
Value: SHADER_LOC_MAP_METALNESS
Description:

View File

@ -543,58 +543,58 @@
</Enum> </Enum>
</Enums> </Enums>
<Defines count="52"> <Defines count="52">
<Define name="RAYLIB_H" type="GUARD" /> <Define name="RAYLIB_H" type="GUARD" value="" desc="" />
<Define name="RAYLIB_VERSION" type="STRING" /> <Define name="RAYLIB_VERSION" type="STRING" value=""4.1-dev"" desc="" />
<Define name="RLAPI" type="UNKNOWN" /> <Define name="RLAPI" type="UNKNOWN" value="__declspec(dllexport)" desc="// We are building the library as a Win32 shared library (.dll)" />
<Define name="PI" type="FLOAT" /> <Define name="PI" type="FLOAT" value="3.14159265358979323846f" desc="" />
<Define name="DEG2RAD" type="UNKNOWN" /> <Define name="DEG2RAD" type="UNKNOWN" value="(PI/180.0f)" desc="" />
<Define name="RAD2DEG" type="UNKNOWN" /> <Define name="RAD2DEG" type="UNKNOWN" value="(180.0f/PI)" desc="" />
<Define name="RL_MALLOC(sz)" type="MACRO" /> <Define name="RL_MALLOC(sz)" type="MACRO" value="malloc(sz)" desc="" />
<Define name="RL_CALLOC(n,sz)" type="MACRO" /> <Define name="RL_CALLOC(n,sz)" type="MACRO" value="calloc(n,sz)" desc="" />
<Define name="RL_REALLOC(ptr,sz)" type="MACRO" /> <Define name="RL_REALLOC(ptr,sz)" type="MACRO" value="realloc(ptr,sz)" desc="" />
<Define name="RL_FREE(ptr)" type="MACRO" /> <Define name="RL_FREE(ptr)" type="MACRO" value="free(ptr)" desc="" />
<Define name="CLITERAL(type)" type="MACRO" /> <Define name="CLITERAL(type)" type="MACRO" value="type" desc="" />
<Define name="RL_COLOR_TYPE" type="GUARD" /> <Define name="RL_COLOR_TYPE" type="GUARD" value="" desc="" />
<Define name="RL_RECTANGLE_TYPE" type="GUARD" /> <Define name="RL_RECTANGLE_TYPE" type="GUARD" value="" desc="" />
<Define name="RL_VECTOR2_TYPE" type="GUARD" /> <Define name="RL_VECTOR2_TYPE" type="GUARD" value="" desc="" />
<Define name="RL_VECTOR3_TYPE" type="GUARD" /> <Define name="RL_VECTOR3_TYPE" type="GUARD" value="" desc="" />
<Define name="RL_VECTOR4_TYPE" type="GUARD" /> <Define name="RL_VECTOR4_TYPE" type="GUARD" value="" desc="" />
<Define name="RL_QUATERNION_TYPE" type="GUARD" /> <Define name="RL_QUATERNION_TYPE" type="GUARD" value="" desc="" />
<Define name="RL_MATRIX_TYPE" type="GUARD" /> <Define name="RL_MATRIX_TYPE" type="GUARD" value="" desc="" />
<Define name="LIGHTGRAY" type="COLOR" /> <Define name="LIGHTGRAY" type="COLOR" value="CLITERAL(Color){ 200, 200, 200, 255 }" desc="// Light Gray" />
<Define name="GRAY" type="COLOR" /> <Define name="GRAY" type="COLOR" value="CLITERAL(Color){ 130, 130, 130, 255 }" desc="// Gray" />
<Define name="DARKGRAY" type="COLOR" /> <Define name="DARKGRAY" type="COLOR" value="CLITERAL(Color){ 80, 80, 80, 255 }" desc="// Dark Gray" />
<Define name="YELLOW" type="COLOR" /> <Define name="YELLOW" type="COLOR" value="CLITERAL(Color){ 253, 249, 0, 255 }" desc="// Yellow" />
<Define name="GOLD" type="COLOR" /> <Define name="GOLD" type="COLOR" value="CLITERAL(Color){ 255, 203, 0, 255 }" desc="// Gold" />
<Define name="ORANGE" type="COLOR" /> <Define name="ORANGE" type="COLOR" value="CLITERAL(Color){ 255, 161, 0, 255 }" desc="// Orange" />
<Define name="PINK" type="COLOR" /> <Define name="PINK" type="COLOR" value="CLITERAL(Color){ 255, 109, 194, 255 }" desc="// Pink" />
<Define name="RED" type="COLOR" /> <Define name="RED" type="COLOR" value="CLITERAL(Color){ 230, 41, 55, 255 }" desc="// Red" />
<Define name="MAROON" type="COLOR" /> <Define name="MAROON" type="COLOR" value="CLITERAL(Color){ 190, 33, 55, 255 }" desc="// Maroon" />
<Define name="GREEN" type="COLOR" /> <Define name="GREEN" type="COLOR" value="CLITERAL(Color){ 0, 228, 48, 255 }" desc="// Green" />
<Define name="LIME" type="COLOR" /> <Define name="LIME" type="COLOR" value="CLITERAL(Color){ 0, 158, 47, 255 }" desc="// Lime" />
<Define name="DARKGREEN" type="COLOR" /> <Define name="DARKGREEN" type="COLOR" value="CLITERAL(Color){ 0, 117, 44, 255 }" desc="// Dark Green" />
<Define name="SKYBLUE" type="COLOR" /> <Define name="SKYBLUE" type="COLOR" value="CLITERAL(Color){ 102, 191, 255, 255 }" desc="// Sky Blue" />
<Define name="BLUE" type="COLOR" /> <Define name="BLUE" type="COLOR" value="CLITERAL(Color){ 0, 121, 241, 255 }" desc="// Blue" />
<Define name="DARKBLUE" type="COLOR" /> <Define name="DARKBLUE" type="COLOR" value="CLITERAL(Color){ 0, 82, 172, 255 }" desc="// Dark Blue" />
<Define name="PURPLE" type="COLOR" /> <Define name="PURPLE" type="COLOR" value="CLITERAL(Color){ 200, 122, 255, 255 }" desc="// Purple" />
<Define name="VIOLET" type="COLOR" /> <Define name="VIOLET" type="COLOR" value="CLITERAL(Color){ 135, 60, 190, 255 }" desc="// Violet" />
<Define name="DARKPURPLE" type="COLOR" /> <Define name="DARKPURPLE" type="COLOR" value="CLITERAL(Color){ 112, 31, 126, 255 }" desc="// Dark Purple" />
<Define name="BEIGE" type="COLOR" /> <Define name="BEIGE" type="COLOR" value="CLITERAL(Color){ 211, 176, 131, 255 }" desc="// Beige" />
<Define name="BROWN" type="COLOR" /> <Define name="BROWN" type="COLOR" value="CLITERAL(Color){ 127, 106, 79, 255 }" desc="// Brown" />
<Define name="DARKBROWN" type="COLOR" /> <Define name="DARKBROWN" type="COLOR" value="CLITERAL(Color){ 76, 63, 47, 255 }" desc="// Dark Brown" />
<Define name="WHITE" type="COLOR" /> <Define name="WHITE" type="COLOR" value="CLITERAL(Color){ 255, 255, 255, 255 }" desc="// White" />
<Define name="BLACK" type="COLOR" /> <Define name="BLACK" type="COLOR" value="CLITERAL(Color){ 0, 0, 0, 255 }" desc="// Black" />
<Define name="BLANK" type="COLOR" /> <Define name="BLANK" type="COLOR" value="CLITERAL(Color){ 0, 0, 0, 0 }" desc="// Blank (Transparent)" />
<Define name="MAGENTA" type="COLOR" /> <Define name="MAGENTA" type="COLOR" value="CLITERAL(Color){ 255, 0, 255, 255 }" desc="// Magenta" />
<Define name="RAYWHITE" type="COLOR" /> <Define name="RAYWHITE" type="COLOR" value="CLITERAL(Color){ 245, 245, 245, 255 }" desc="// My own White (raylib logo)" />
<Define name="RL_BOOL_TYPE" type="GUARD" /> <Define name="RL_BOOL_TYPE" type="GUARD" value="" desc="" />
<Define name="MOUSE_LEFT_BUTTON" type="UNKNOWN" /> <Define name="MOUSE_LEFT_BUTTON" type="UNKNOWN" value="MOUSE_BUTTON_LEFT" desc="" />
<Define name="MOUSE_RIGHT_BUTTON" type="UNKNOWN" /> <Define name="MOUSE_RIGHT_BUTTON" type="UNKNOWN" value="MOUSE_BUTTON_RIGHT" desc="" />
<Define name="MOUSE_MIDDLE_BUTTON" type="UNKNOWN" /> <Define name="MOUSE_MIDDLE_BUTTON" type="UNKNOWN" value="MOUSE_BUTTON_MIDDLE" desc="" />
<Define name="MATERIAL_MAP_DIFFUSE" type="UNKNOWN" /> <Define name="MATERIAL_MAP_DIFFUSE" type="UNKNOWN" value="MATERIAL_MAP_ALBEDO" desc="" />
<Define name="MATERIAL_MAP_SPECULAR" type="UNKNOWN" /> <Define name="MATERIAL_MAP_SPECULAR" type="UNKNOWN" value="MATERIAL_MAP_METALNESS" desc="" />
<Define name="SHADER_LOC_MAP_DIFFUSE" type="UNKNOWN" /> <Define name="SHADER_LOC_MAP_DIFFUSE" type="UNKNOWN" value="SHADER_LOC_MAP_ALBEDO" desc="" />
<Define name="SHADER_LOC_MAP_SPECULAR" type="UNKNOWN" /> <Define name="SHADER_LOC_MAP_SPECULAR" type="UNKNOWN" value="SHADER_LOC_MAP_METALNESS" desc="" />
</Defines> </Defines>
<Functions count="491"> <Functions count="491">
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context"> <Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">

View File

@ -68,7 +68,7 @@
#define MAX_FUNCS_TO_PARSE 512 // Maximum number of functions to parse #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_STRUCTS_TO_PARSE 64 // Maximum number of structures to parse
#define MAX_ENUMS_TO_PARSE 64 // Maximum number of enums to parse #define MAX_ENUMS_TO_PARSE 64 // Maximum number of enums to parse
#define MAX_DEFINES_TO_PARSE 512 #define MAX_DEFINES_TO_PARSE 2048 // Maximum number of defines to parse
#define MAX_LINE_LENGTH 512 // Maximum length of one line (including comments) #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) #define MAX_STRUCT_LINE_LENGTH 2048 // Maximum length of one struct (multiple lines)
@ -111,12 +111,15 @@ typedef struct EnumInfo {
char valueDesc[MAX_ENUM_VALUES][128]; // Value description char valueDesc[MAX_ENUM_VALUES][128]; // Value description
} EnumInfo; } EnumInfo;
typedef enum { UNKNOWN, MACRO, GUARD, INT, FLOAT, DOUBLE, CHAR, STRING, COLOR } DefineType; // Type of parsed define
typedef enum { UNKNOWN = 0, MACRO, GUARD, INT, FLOAT, DOUBLE, CHAR, STRING, COLOR } DefineType;
// Define info data // Define info data
typedef struct DefineInfo { typedef struct DefineInfo {
char name[64]; char name[64]; // Define name
DefineType type; DefineType type; // Define type
char value[256]; // Define value
char desc[128]; // Define description
} DefineInfo; } DefineInfo;
// Output format for parsed data // Output format for parsed data
@ -128,11 +131,11 @@ typedef enum { DEFAULT = 0, JSON, XML, LUA } OutputFormat;
static int funcCount = 0; static int funcCount = 0;
static int structCount = 0; static int structCount = 0;
static int enumCount = 0; static int enumCount = 0;
static int defCount = 0; static int defineCount = 0;
static FunctionInfo *funcs = NULL; static FunctionInfo *funcs = NULL;
static StructInfo *structs = NULL; static StructInfo *structs = NULL;
static EnumInfo *enums = NULL; static EnumInfo *enums = NULL;
static DefineInfo *defs = NULL; static DefineInfo *defines = NULL;
static char apiDefine[32] = "RLAPI\0"; static char apiDefine[32] = "RLAPI\0";
// Command line variables // Command line variables
@ -153,10 +156,11 @@ static unsigned int TextLength(const char *text); // Get text length i
static bool IsTextEqual(const char *text1, const char *text2, unsigned int count); static bool IsTextEqual(const char *text1, const char *text2, unsigned int count);
static void MemoryCopy(void *dest, const void *src, 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 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 static void ExportParsedData(const char *fileName, int format); // Export parsed data in desired format
static const char *StrDefineType(DefineType type); // Get string of define type
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -184,7 +188,7 @@ int main(int argc, char* argv[])
int *enumLines = (int *)malloc(MAX_ENUMS_TO_PARSE*sizeof(int)); int *enumLines = (int *)malloc(MAX_ENUMS_TO_PARSE*sizeof(int));
// Defines lines pointers, selected from buffer "lines" // Defines lines pointers, selected from buffer "lines"
int *defLines = (int *)malloc(MAX_DEFINES_TO_PARSE*sizeof(int)); int *defineLines = (int *)malloc(MAX_DEFINES_TO_PARSE*sizeof(int));
// Prepare required lines for parsing // Prepare required lines for parsing
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -255,12 +259,12 @@ int main(int argc, char* argv[])
{ {
// Keep the line position in the array of lines, // Keep the line position in the array of lines,
// so, we can scan that position and following lines // so, we can scan that position and following lines
defLines[defCount] = i; defineLines[defineCount] = i;
defCount++; defineCount++;
} }
} }
// At this point we have all raylib structs, enums, functions, defs lines data to start parsing // At this point we have all raylib structs, enums, functions, defines lines data to start parsing
free(buffer); // Unload text buffer free(buffer); // Unload text buffer
@ -437,68 +441,83 @@ int main(int argc, char* argv[])
free(enumLines); free(enumLines);
// Define info data // Define info data
defs = (DefineInfo *)calloc(MAX_DEFINES_TO_PARSE, sizeof(DefineInfo)); defines = (DefineInfo *)calloc(MAX_DEFINES_TO_PARSE, sizeof(DefineInfo));
int defineIndex = 0; int defineIndex = 0;
for (int i = 0; i < defCount; i++) for (int i = 0; i < defineCount; i++)
{ {
char *linePtr = lines[defLines[i]]; char *linePtr = lines[defineLines[i]];
int j = 0; int j = 0;
int constNameStart, constNameEnd;
while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs in the begining while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs in the begining
j += 8; // Skip "#define " j += 8; // Skip "#define "
while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs after "#define " while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs after "#define "
constNameStart = j; // Extract name
while (linePtr[j] != ' ' && linePtr[j] != '\t' && linePtr[j] != '\0') j++; // Extract name int defineNameStart = j;
constNameEnd = j-1; while (linePtr[j] != ' ' && linePtr[j] != '\t' && linePtr[j] != '\0') j++;
int defineNameEnd = 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 // Skip duplicates
int len = constNameEnd - constNameStart + 1; int nameLen = defineNameEnd - defineNameStart + 1;
bool isDuplicate = false; bool isDuplicate = false;
for (int k = 0; k < defineIndex; k++) { for (int k = 0; k < defineIndex; k++) {
if (len == TextLength(defs[k].name) && IsTextEqual(defs[k].name, linePtr + constNameStart, len)) { if (nameLen == TextLength(defines[k].name) && IsTextEqual(defines[k].name, linePtr + defineNameStart, nameLen)) {
isDuplicate = true; isDuplicate = true;
break; break;
} }
} }
if (isDuplicate) continue; if (isDuplicate) continue;
MemoryCopy(defs[defineIndex].name, linePtr + constNameStart, len); MemoryCopy(defines[defineIndex].name, linePtr + defineNameStart, nameLen);
// Determine type
if (linePtr[defineNameEnd] == ')') defines[defineIndex].type = MACRO;
while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs after name
int defineValueStart = j;
if (linePtr[j] == '\0' || linePtr == "/") defines[defineIndex].type = GUARD;
if (linePtr[j] == '"') defines[defineIndex].type = STRING;
else if (linePtr[j] == '\'') defines[defineIndex].type = CHAR;
else if (IsTextEqual(linePtr+j, "CLITERAL(Color)", 15)) defines[defineIndex].type = COLOR;
else if (isdigit(linePtr[j])) { // Parsing numbers
bool isFloat = false;
while (linePtr[j] != ' ' && linePtr[j] != '\t' && linePtr[j] != '\n' && linePtr[j] != '\r') {
j++;
if (linePtr[j] == '.') isFloat = true;
}
if (isFloat) {
defines[defineIndex].type = linePtr[j-1] == 'f' ? FLOAT : DOUBLE;
} else {
defines[defineIndex].type = INT;
}
}
// Extracting value
while (linePtr[j] != '\\' && linePtr[j] != '\0' && !(linePtr[j] == '/' && linePtr[j+1] == '/')) j++;
int defineValueEnd = j-1;
while (linePtr[defineValueEnd] == ' ' || linePtr[defineValueEnd] == '\t') defineValueEnd--; // Remove trailing spaces and tabs
int valueLen = defineValueEnd - defineValueStart + 1;
if (valueLen > 255) valueLen = 255;
if (valueLen > 0) MemoryCopy(defines[defineIndex].value, linePtr + defineValueStart, valueLen);
// Extracting description
if (linePtr[j] == '/') {
int commentStart = j;
while (linePtr[j] != '\\' && linePtr[j] != '\0') j++;
int commentEnd = j-1;
int commentLen = commentEnd - commentStart + 1;
if (commentLen > 127) commentLen = 127;
MemoryCopy(defines[defineIndex].desc, linePtr + commentStart, commentLen);
}
defineIndex++; defineIndex++;
} }
defCount = defineIndex; defineCount = defineIndex;
free(defLines); free(defineLines);
// Functions info data // Functions info data
funcs = (FunctionInfo *)calloc(MAX_FUNCS_TO_PARSE, sizeof(FunctionInfo)); funcs = (FunctionInfo *)calloc(MAX_FUNCS_TO_PARSE, sizeof(FunctionInfo));
@ -581,7 +600,7 @@ int main(int argc, char* argv[])
// structs[] -> We have all the structs decomposed into pieces for further analysis // structs[] -> We have all the structs decomposed into pieces for further analysis
// enums[] -> We have all the enums 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 // funcs[] -> We have all the functions decomposed into pieces for further analysis
// defs[] -> We have all the defines decomposed into pieces for further analysis // defines[] -> We have all the defines decomposed into pieces for further analysis
// Process input file to output // Process input file to output
if (outFileName[0] == '\0') MemoryCopy(outFileName, "raylib_api.txt\0", 15); if (outFileName[0] == '\0') MemoryCopy(outFileName, "raylib_api.txt\0", 15);
@ -855,6 +874,7 @@ static char *EscapeBackslashes(char *text)
return buffer; return buffer;
} }
// Get string of define type
static const char *StrDefineType(DefineType type) static const char *StrDefineType(DefineType type)
{ {
switch (type) switch (type)
@ -965,12 +985,14 @@ static void ExportParsedData(const char *fileName, int format)
if (funcs[i].paramCount == 0) fprintf(outFile, " No input parameters\n"); if (funcs[i].paramCount == 0) fprintf(outFile, " No input parameters\n");
} }
fprintf(outFile, "\nDefines found: %i\n\n", defCount); fprintf(outFile, "\nDefines found: %i\n\n", defineCount);
for (int i = 0; i < defCount; i++) for (int i = 0; i < defineCount; i++)
{ {
fprintf(outFile, "Define %03i: %s\n", i + 1, defs[i].name); fprintf(outFile, "Define %03i: %s\n", i + 1, defines[i].name);
fprintf(outFile, " Name: %s\n", defs[i].name); fprintf(outFile, " Name: %s\n", defines[i].name);
fprintf(outFile, " Type: %s\n", StrDefineType(defs[i].type)); fprintf(outFile, " Type: %s\n", StrDefineType(defines[i].type));
fprintf(outFile, " Value: %s\n", defines[i].value);
fprintf(outFile, " Description: %s\n", defines[i].desc + 3);
} }
} break; } break;
case LUA: case LUA:
@ -1027,13 +1049,24 @@ static void ExportParsedData(const char *fileName, int format)
} }
fprintf(outFile, " },\n"); fprintf(outFile, " },\n");
// Print defs info // Print defines info
fprintf(outFile, " defs = {\n"); fprintf(outFile, " defines = {\n");
for (int i = 0; i < defCount; i++) for (int i = 0; i < defineCount; i++)
{ {
fprintf(outFile, " {\n"); fprintf(outFile, " {\n");
fprintf(outFile, " name = \"%s\",\n", defs[i].name); fprintf(outFile, " name = \"%s\",\n", defines[i].name);
fprintf(outFile, " type = \"%s\"\n", StrDefineType(defs[i].type)); fprintf(outFile, " type = \"%s\",\n", StrDefineType(defines[i].type));
if (defines[i].type == INT || defines[i].type == DOUBLE || defines[i].type == STRING) {
fprintf(outFile, " value = %s,\n", defines[i].value);
} else if (defines[i].type == FLOAT) {
int n = TextLength(defines[i].value);
defines[i].value[n-1] = '\0';
fprintf(outFile, " value = %s,\n", defines[i].value);
defines[i].value[n-1] = 'f';
} else {
fprintf(outFile, " value = \"%s\",\n", defines[i].value);
}
fprintf(outFile, " description = \"%s\"\n", defines[i].desc + 3);
fprintf(outFile, " }"); fprintf(outFile, " }");
if (i < funcCount - 1) fprintf(outFile, ",\n"); if (i < funcCount - 1) fprintf(outFile, ",\n");
@ -1124,16 +1157,27 @@ static void ExportParsedData(const char *fileName, int format)
} }
fprintf(outFile, " ],\n"); fprintf(outFile, " ],\n");
// Print defs info // Print defines info
fprintf(outFile, " \"defs\": [\n"); fprintf(outFile, " \"defines\": [\n");
for (int i = 0; i < defCount; i++) for (int i = 0; i < defineCount; i++)
{ {
fprintf(outFile, " {\n"); fprintf(outFile, " {\n");
fprintf(outFile, " \"name\": \"%s\",\n", defs[i].name); fprintf(outFile, " \"name\": \"%s\",\n", defines[i].name);
fprintf(outFile, " \"type\": \"%s\"\n", StrDefineType(defs[i].type)); fprintf(outFile, " \"type\": \"%s\",\n", StrDefineType(defines[i].type));
if (defines[i].type == INT || defines[i].type == DOUBLE || defines[i].type == STRING) {
fprintf(outFile, " \"value\": %s,\n", defines[i].value);
} else if (defines[i].type == FLOAT) {
int n = TextLength(defines[i].value);
defines[i].value[n-1] = '\0';
fprintf(outFile, " \"value\": %s,\n", defines[i].value);
defines[i].value[n-1] = 'f';
} else {
fprintf(outFile, " \"value\": \"%s\",\n", defines[i].value);
}
fprintf(outFile, " \"description\": \"%s\"\n", defines[i].desc + 3);
fprintf(outFile, " }"); fprintf(outFile, " }");
if (i < defCount - 1) fprintf(outFile, ",\n"); if (i < defineCount - 1) fprintf(outFile, ",\n");
else fprintf(outFile, "\n"); else fprintf(outFile, "\n");
} }
fprintf(outFile, " ],\n"); fprintf(outFile, " ],\n");
@ -1226,11 +1270,11 @@ static void ExportParsedData(const char *fileName, int format)
} }
fprintf(outFile, " </Enums>\n"); fprintf(outFile, " </Enums>\n");
// Print defs info // Print defines info
fprintf(outFile, " <Defines count=\"%i\">\n", defCount); fprintf(outFile, " <Defines count=\"%i\">\n", defineCount);
for (int i = 0; i < defCount; i++) for (int i = 0; i < defineCount; i++)
{ {
fprintf(outFile, " <Define name=\"%s\" type=\"%s\" />\n", defs[i].name, StrDefineType(defs[i].type)); fprintf(outFile, " <Define name=\"%s\" type=\"%s\" value=\"%s\" desc=\"%s\" />\n", defines[i].name, StrDefineType(defines[i].type), defines[i].value, defines[i].desc);
} }
fprintf(outFile, " </Defines>\n"); fprintf(outFile, " </Defines>\n");