Add aliases to parser (#2444)
* Fix parser indentation * Fix parser comments * Add aliases to parser * Regenerate parser output * Fix parser handling of multiple fields on one line * Regenerate parser output * Fix parser code style
This commit is contained in:
parent
666aa44a84
commit
6f044c57ac
5 changed files with 531 additions and 92 deletions
|
@ -69,22 +69,82 @@
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"name": "m0, m4, m8, m12",
|
"name": "m0",
|
||||||
"description": "Matrix first row (4 components)"
|
"description": "Matrix first row (4 components)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"name": "m1, m5, m9, m13",
|
"name": "m4",
|
||||||
|
"description": "Matrix first row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m8",
|
||||||
|
"description": "Matrix first row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m12",
|
||||||
|
"description": "Matrix first row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m1",
|
||||||
"description": "Matrix second row (4 components)"
|
"description": "Matrix second row (4 components)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"name": "m2, m6, m10, m14",
|
"name": "m5",
|
||||||
|
"description": "Matrix second row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m9",
|
||||||
|
"description": "Matrix second row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m13",
|
||||||
|
"description": "Matrix second row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m2",
|
||||||
"description": "Matrix third row (4 components)"
|
"description": "Matrix third row (4 components)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"name": "m3, m7, m11, m15",
|
"name": "m6",
|
||||||
|
"description": "Matrix third row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m10",
|
||||||
|
"description": "Matrix third row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m14",
|
||||||
|
"description": "Matrix third row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m3",
|
||||||
|
"description": "Matrix fourth row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m7",
|
||||||
|
"description": "Matrix fourth row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m11",
|
||||||
|
"description": "Matrix fourth row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "m15",
|
||||||
"description": "Matrix fourth row (4 components)"
|
"description": "Matrix fourth row (4 components)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -907,6 +967,33 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"aliases": [
|
||||||
|
{
|
||||||
|
"type": "Vector4",
|
||||||
|
"name": "Quaternion",
|
||||||
|
"description": "Quaternion, 4 components (Vector4 alias)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Texture",
|
||||||
|
"name": "Texture2D",
|
||||||
|
"description": "Texture2D, same as Texture"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Texture",
|
||||||
|
"name": "TextureCubemap",
|
||||||
|
"description": "TextureCubemap, same as Texture"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "RenderTexture",
|
||||||
|
"name": "RenderTexture2D",
|
||||||
|
"description": "RenderTexture2D, same as RenderTexture"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Camera3D",
|
||||||
|
"name": "Camera",
|
||||||
|
"description": "Camera type fallback, defaults to Camera3D"
|
||||||
|
}
|
||||||
|
],
|
||||||
"enums": [
|
"enums": [
|
||||||
{
|
{
|
||||||
"name": "ConfigFlags",
|
"name": "ConfigFlags",
|
||||||
|
@ -4101,11 +4188,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "dataLength"
|
"name": "dataSize"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int *",
|
"type": "int *",
|
||||||
"name": "compDataLength"
|
"name": "compDataSize"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -4120,11 +4207,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "compDataLength"
|
"name": "compDataSize"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int *",
|
"type": "int *",
|
||||||
"name": "dataLength"
|
"name": "dataSize"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -4139,11 +4226,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "dataLength"
|
"name": "dataSize"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int *",
|
"type": "int *",
|
||||||
"name": "outputLength"
|
"name": "outputSize"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -4158,7 +4245,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int *",
|
"type": "int *",
|
||||||
"name": "outputLength"
|
"name": "outputSize"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -69,22 +69,82 @@ return {
|
||||||
fields = {
|
fields = {
|
||||||
{
|
{
|
||||||
type = "float",
|
type = "float",
|
||||||
name = "m0, m4, m8, m12",
|
name = "m0",
|
||||||
description = "Matrix first row (4 components)"
|
description = "Matrix first row (4 components)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "float",
|
type = "float",
|
||||||
name = "m1, m5, m9, m13",
|
name = "m4",
|
||||||
|
description = "Matrix first row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m8",
|
||||||
|
description = "Matrix first row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m12",
|
||||||
|
description = "Matrix first row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m1",
|
||||||
description = "Matrix second row (4 components)"
|
description = "Matrix second row (4 components)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "float",
|
type = "float",
|
||||||
name = "m2, m6, m10, m14",
|
name = "m5",
|
||||||
|
description = "Matrix second row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m9",
|
||||||
|
description = "Matrix second row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m13",
|
||||||
|
description = "Matrix second row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m2",
|
||||||
description = "Matrix third row (4 components)"
|
description = "Matrix third row (4 components)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "float",
|
type = "float",
|
||||||
name = "m3, m7, m11, m15",
|
name = "m6",
|
||||||
|
description = "Matrix third row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m10",
|
||||||
|
description = "Matrix third row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m14",
|
||||||
|
description = "Matrix third row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m3",
|
||||||
|
description = "Matrix fourth row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m7",
|
||||||
|
description = "Matrix fourth row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m11",
|
||||||
|
description = "Matrix fourth row (4 components)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "float",
|
||||||
|
name = "m15",
|
||||||
description = "Matrix fourth row (4 components)"
|
description = "Matrix fourth row (4 components)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -907,6 +967,33 @@ return {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
aliases = {
|
||||||
|
{
|
||||||
|
type = "Vector4",
|
||||||
|
name = "Quaternion",
|
||||||
|
description = "Quaternion, 4 components (Vector4 alias)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "Texture",
|
||||||
|
name = "Texture2D",
|
||||||
|
description = "Texture2D, same as Texture"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "Texture",
|
||||||
|
name = "TextureCubemap",
|
||||||
|
description = "TextureCubemap, same as Texture"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "RenderTexture",
|
||||||
|
name = "RenderTexture2D",
|
||||||
|
description = "RenderTexture2D, same as RenderTexture"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "Camera3D",
|
||||||
|
name = "Camera",
|
||||||
|
description = "Camera type fallback, defaults to Camera3D"
|
||||||
|
}
|
||||||
|
},
|
||||||
enums = {
|
enums = {
|
||||||
{
|
{
|
||||||
name = "ConfigFlags",
|
name = "ConfigFlags",
|
||||||
|
@ -3736,8 +3823,8 @@ return {
|
||||||
returnType = "unsigned char *",
|
returnType = "unsigned char *",
|
||||||
params = {
|
params = {
|
||||||
{type = "const unsigned char *", name = "data"},
|
{type = "const unsigned char *", name = "data"},
|
||||||
{type = "int", name = "dataLength"},
|
{type = "int", name = "dataSize"},
|
||||||
{type = "int *", name = "compDataLength"}
|
{type = "int *", name = "compDataSize"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3746,8 +3833,8 @@ return {
|
||||||
returnType = "unsigned char *",
|
returnType = "unsigned char *",
|
||||||
params = {
|
params = {
|
||||||
{type = "const unsigned char *", name = "compData"},
|
{type = "const unsigned char *", name = "compData"},
|
||||||
{type = "int", name = "compDataLength"},
|
{type = "int", name = "compDataSize"},
|
||||||
{type = "int *", name = "dataLength"}
|
{type = "int *", name = "dataSize"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3756,8 +3843,8 @@ return {
|
||||||
returnType = "char *",
|
returnType = "char *",
|
||||||
params = {
|
params = {
|
||||||
{type = "const unsigned char *", name = "data"},
|
{type = "const unsigned char *", name = "data"},
|
||||||
{type = "int", name = "dataLength"},
|
{type = "int", name = "dataSize"},
|
||||||
{type = "int *", name = "outputLength"}
|
{type = "int *", name = "outputSize"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3766,7 +3853,7 @@ return {
|
||||||
returnType = "unsigned char *",
|
returnType = "unsigned char *",
|
||||||
params = {
|
params = {
|
||||||
{type = "const unsigned char *", name = "data"},
|
{type = "const unsigned char *", name = "data"},
|
||||||
{type = "int *", name = "outputLength"}
|
{type = "int *", name = "outputSize"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,13 +19,25 @@ Struct 03: Vector4 (4 fields)
|
||||||
Field[2]: float y // Vector y component
|
Field[2]: float y // Vector y component
|
||||||
Field[3]: float z // Vector z component
|
Field[3]: float z // Vector z component
|
||||||
Field[4]: float w // Vector w component
|
Field[4]: float w // Vector w component
|
||||||
Struct 04: Matrix (4 fields)
|
Struct 04: Matrix (16 fields)
|
||||||
Name: Matrix
|
Name: Matrix
|
||||||
Description: Matrix, 4x4 components, column major, OpenGL style, right handed
|
Description: Matrix, 4x4 components, column major, OpenGL style, right handed
|
||||||
Field[1]: float m0, m4, m8, m12 // Matrix first row (4 components)
|
Field[1]: float m0 // Matrix first row (4 components)
|
||||||
Field[2]: float m1, m5, m9, m13 // Matrix second row (4 components)
|
Field[2]: float m4 // Matrix first row (4 components)
|
||||||
Field[3]: float m2, m6, m10, m14 // Matrix third row (4 components)
|
Field[3]: float m8 // Matrix first row (4 components)
|
||||||
Field[4]: float m3, m7, m11, m15 // Matrix fourth row (4 components)
|
Field[4]: float m12 // Matrix first row (4 components)
|
||||||
|
Field[5]: float m1 // Matrix second row (4 components)
|
||||||
|
Field[6]: float m5 // Matrix second row (4 components)
|
||||||
|
Field[7]: float m9 // Matrix second row (4 components)
|
||||||
|
Field[8]: float m13 // Matrix second row (4 components)
|
||||||
|
Field[9]: float m2 // Matrix third row (4 components)
|
||||||
|
Field[10]: float m6 // Matrix third row (4 components)
|
||||||
|
Field[11]: float m10 // Matrix third row (4 components)
|
||||||
|
Field[12]: float m14 // Matrix third row (4 components)
|
||||||
|
Field[13]: float m3 // Matrix fourth row (4 components)
|
||||||
|
Field[14]: float m7 // Matrix fourth row (4 components)
|
||||||
|
Field[15]: float m11 // Matrix fourth row (4 components)
|
||||||
|
Field[16]: float m15 // Matrix fourth row (4 components)
|
||||||
Struct 05: Color (4 fields)
|
Struct 05: Color (4 fields)
|
||||||
Name: Color
|
Name: Color
|
||||||
Description: Color, 4 components, R8G8B8A8 (32bit)
|
Description: Color, 4 components, R8G8B8A8 (32bit)
|
||||||
|
@ -239,6 +251,29 @@ Struct 31: VrStereoConfig (8 fields)
|
||||||
Field[7]: float scale[2] // VR distortion scale
|
Field[7]: float scale[2] // VR distortion scale
|
||||||
Field[8]: float scaleIn[2] // VR distortion scale in
|
Field[8]: float scaleIn[2] // VR distortion scale in
|
||||||
|
|
||||||
|
Aliases found: 5
|
||||||
|
|
||||||
|
Alias 001: Quaternion
|
||||||
|
Type: Vector4
|
||||||
|
Name: Quaternion
|
||||||
|
Description: Quaternion, 4 components (Vector4 alias)
|
||||||
|
Alias 002: Texture2D
|
||||||
|
Type: Texture
|
||||||
|
Name: Texture2D
|
||||||
|
Description: Texture2D, same as Texture
|
||||||
|
Alias 003: TextureCubemap
|
||||||
|
Type: Texture
|
||||||
|
Name: TextureCubemap
|
||||||
|
Description: TextureCubemap, same as Texture
|
||||||
|
Alias 004: RenderTexture2D
|
||||||
|
Type: RenderTexture
|
||||||
|
Name: RenderTexture2D
|
||||||
|
Description: RenderTexture2D, same as RenderTexture
|
||||||
|
Alias 005: Camera
|
||||||
|
Type: Camera3D
|
||||||
|
Name: Camera
|
||||||
|
Description: Camera type fallback, defaults to Camera3D
|
||||||
|
|
||||||
Enums found: 21
|
Enums found: 21
|
||||||
|
|
||||||
Enum 01: ConfigFlags (14 values)
|
Enum 01: ConfigFlags (14 values)
|
||||||
|
@ -1284,28 +1319,28 @@ Function 129: CompressData() (3 input parameters)
|
||||||
Return type: unsigned char *
|
Return type: unsigned char *
|
||||||
Description: Compress data (DEFLATE algorithm)
|
Description: Compress data (DEFLATE algorithm)
|
||||||
Param[1]: data (type: const unsigned char *)
|
Param[1]: data (type: const unsigned char *)
|
||||||
Param[2]: dataLength (type: int)
|
Param[2]: dataSize (type: int)
|
||||||
Param[3]: compDataLength (type: int *)
|
Param[3]: compDataSize (type: int *)
|
||||||
Function 130: DecompressData() (3 input parameters)
|
Function 130: DecompressData() (3 input parameters)
|
||||||
Name: DecompressData
|
Name: DecompressData
|
||||||
Return type: unsigned char *
|
Return type: unsigned char *
|
||||||
Description: Decompress data (DEFLATE algorithm)
|
Description: Decompress data (DEFLATE algorithm)
|
||||||
Param[1]: compData (type: const unsigned char *)
|
Param[1]: compData (type: const unsigned char *)
|
||||||
Param[2]: compDataLength (type: int)
|
Param[2]: compDataSize (type: int)
|
||||||
Param[3]: dataLength (type: int *)
|
Param[3]: dataSize (type: int *)
|
||||||
Function 131: EncodeDataBase64() (3 input parameters)
|
Function 131: EncodeDataBase64() (3 input parameters)
|
||||||
Name: EncodeDataBase64
|
Name: EncodeDataBase64
|
||||||
Return type: char *
|
Return type: char *
|
||||||
Description: Encode data to Base64 string
|
Description: Encode data to Base64 string
|
||||||
Param[1]: data (type: const unsigned char *)
|
Param[1]: data (type: const unsigned char *)
|
||||||
Param[2]: dataLength (type: int)
|
Param[2]: dataSize (type: int)
|
||||||
Param[3]: outputLength (type: int *)
|
Param[3]: outputSize (type: int *)
|
||||||
Function 132: DecodeDataBase64() (2 input parameters)
|
Function 132: DecodeDataBase64() (2 input parameters)
|
||||||
Name: DecodeDataBase64
|
Name: DecodeDataBase64
|
||||||
Return type: unsigned char *
|
Return type: unsigned char *
|
||||||
Description: Decode Base64 string data
|
Description: Decode Base64 string data
|
||||||
Param[1]: data (type: const unsigned char *)
|
Param[1]: data (type: const unsigned char *)
|
||||||
Param[2]: outputLength (type: int *)
|
Param[2]: outputSize (type: int *)
|
||||||
Function 133: SaveStorageValue() (2 input parameters)
|
Function 133: SaveStorageValue() (2 input parameters)
|
||||||
Name: SaveStorageValue
|
Name: SaveStorageValue
|
||||||
Return type: bool
|
Return type: bool
|
||||||
|
|
|
@ -16,11 +16,23 @@
|
||||||
<Field type="float" name="z" desc="Vector z component" />
|
<Field type="float" name="z" desc="Vector z component" />
|
||||||
<Field type="float" name="w" desc="Vector w component" />
|
<Field type="float" name="w" desc="Vector w component" />
|
||||||
</Struct>
|
</Struct>
|
||||||
<Struct name="Matrix" fieldCount="4" desc="Matrix, 4x4 components, column major, OpenGL style, right handed">
|
<Struct name="Matrix" fieldCount="16" desc="Matrix, 4x4 components, column major, OpenGL style, right handed">
|
||||||
<Field type="float" name="m0, m4, m8, m12" desc="Matrix first row (4 components)" />
|
<Field type="float" name="m0" desc="Matrix first row (4 components)" />
|
||||||
<Field type="float" name="m1, m5, m9, m13" desc="Matrix second row (4 components)" />
|
<Field type="float" name="m4" desc="Matrix first row (4 components)" />
|
||||||
<Field type="float" name="m2, m6, m10, m14" desc="Matrix third row (4 components)" />
|
<Field type="float" name="m8" desc="Matrix first row (4 components)" />
|
||||||
<Field type="float" name="m3, m7, m11, m15" desc="Matrix fourth row (4 components)" />
|
<Field type="float" name="m12" desc="Matrix first row (4 components)" />
|
||||||
|
<Field type="float" name="m1" desc="Matrix second row (4 components)" />
|
||||||
|
<Field type="float" name="m5" desc="Matrix second row (4 components)" />
|
||||||
|
<Field type="float" name="m9" desc="Matrix second row (4 components)" />
|
||||||
|
<Field type="float" name="m13" desc="Matrix second row (4 components)" />
|
||||||
|
<Field type="float" name="m2" desc="Matrix third row (4 components)" />
|
||||||
|
<Field type="float" name="m6" desc="Matrix third row (4 components)" />
|
||||||
|
<Field type="float" name="m10" desc="Matrix third row (4 components)" />
|
||||||
|
<Field type="float" name="m14" desc="Matrix third row (4 components)" />
|
||||||
|
<Field type="float" name="m3" desc="Matrix fourth row (4 components)" />
|
||||||
|
<Field type="float" name="m7" desc="Matrix fourth row (4 components)" />
|
||||||
|
<Field type="float" name="m11" desc="Matrix fourth row (4 components)" />
|
||||||
|
<Field type="float" name="m15" desc="Matrix fourth row (4 components)" />
|
||||||
</Struct>
|
</Struct>
|
||||||
<Struct name="Color" fieldCount="4" desc="Color, 4 components, R8G8B8A8 (32bit)">
|
<Struct name="Color" fieldCount="4" desc="Color, 4 components, R8G8B8A8 (32bit)">
|
||||||
<Field type="unsigned char" name="r" desc="Color red value" />
|
<Field type="unsigned char" name="r" desc="Color red value" />
|
||||||
|
@ -208,6 +220,13 @@
|
||||||
<Field type="float" name="scaleIn[2]" desc="VR distortion scale in" />
|
<Field type="float" name="scaleIn[2]" desc="VR distortion scale in" />
|
||||||
</Struct>
|
</Struct>
|
||||||
</Structs>
|
</Structs>
|
||||||
|
<Aliases count="5">
|
||||||
|
<Alias type="Quaternion" name="Vector4" desc="Quaternion, 4 components (Vector4 alias)" />
|
||||||
|
<Alias type="Texture2D" name="Texture" desc="Texture2D, same as Texture" />
|
||||||
|
<Alias type="TextureCubemap" name="Texture" desc="TextureCubemap, same as Texture" />
|
||||||
|
<Alias type="RenderTexture2D" name="RenderTexture" desc="RenderTexture2D, same as RenderTexture" />
|
||||||
|
<Alias type="Camera" name="Camera3D" desc="Camera type fallback, defaults to Camera3D" />
|
||||||
|
</Aliases>
|
||||||
<Enums count="21">
|
<Enums count="21">
|
||||||
<Enum name="ConfigFlags" valueCount="14" desc="System/Window config flags">
|
<Enum name="ConfigFlags" valueCount="14" desc="System/Window config flags">
|
||||||
<Value name="FLAG_VSYNC_HINT" integer="64" desc="Set to try enabling V-Sync on GPU" />
|
<Value name="FLAG_VSYNC_HINT" integer="64" desc="Set to try enabling V-Sync on GPU" />
|
||||||
|
@ -977,22 +996,22 @@
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="CompressData" retType="unsigned char *" paramCount="3" desc="Compress data (DEFLATE algorithm)">
|
<Function name="CompressData" retType="unsigned char *" paramCount="3" desc="Compress data (DEFLATE algorithm)">
|
||||||
<Param type="const unsigned char *" name="data" desc="" />
|
<Param type="const unsigned char *" name="data" desc="" />
|
||||||
<Param type="int" name="dataLength" desc="" />
|
<Param type="int" name="dataSize" desc="" />
|
||||||
<Param type="int *" name="compDataLength" desc="" />
|
<Param type="int *" name="compDataSize" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="DecompressData" retType="unsigned char *" paramCount="3" desc="Decompress data (DEFLATE algorithm)">
|
<Function name="DecompressData" retType="unsigned char *" paramCount="3" desc="Decompress data (DEFLATE algorithm)">
|
||||||
<Param type="const unsigned char *" name="compData" desc="" />
|
<Param type="const unsigned char *" name="compData" desc="" />
|
||||||
<Param type="int" name="compDataLength" desc="" />
|
<Param type="int" name="compDataSize" desc="" />
|
||||||
<Param type="int *" name="dataLength" desc="" />
|
<Param type="int *" name="dataSize" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="EncodeDataBase64" retType="char *" paramCount="3" desc="Encode data to Base64 string">
|
<Function name="EncodeDataBase64" retType="char *" paramCount="3" desc="Encode data to Base64 string">
|
||||||
<Param type="const unsigned char *" name="data" desc="" />
|
<Param type="const unsigned char *" name="data" desc="" />
|
||||||
<Param type="int" name="dataLength" desc="" />
|
<Param type="int" name="dataSize" desc="" />
|
||||||
<Param type="int *" name="outputLength" desc="" />
|
<Param type="int *" name="outputSize" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="DecodeDataBase64" retType="unsigned char *" paramCount="2" desc="Decode Base64 string data">
|
<Function name="DecodeDataBase64" retType="unsigned char *" paramCount="2" desc="Decode Base64 string data">
|
||||||
<Param type="const unsigned char *" name="data" desc="" />
|
<Param type="const unsigned char *" name="data" desc="" />
|
||||||
<Param type="int *" name="outputLength" desc="" />
|
<Param type="int *" name="outputSize" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="SaveStorageValue" retType="bool" paramCount="2" desc="Save integer value to storage file (to defined position), returns true on success">
|
<Function name="SaveStorageValue" retType="bool" paramCount="2" desc="Save integer value to storage file (to defined position), returns true on success">
|
||||||
<Param type="unsigned int" name="position" desc="" />
|
<Param type="unsigned int" name="position" desc="" />
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
raylib API parser
|
raylib API parser
|
||||||
|
|
||||||
This parser scans raylib.h to get API information about structs, enums, functions and defines.
|
This parser scans raylib.h to get API information about structs, aliases, enums, functions and defines.
|
||||||
All data is divided into pieces, usually as strings. The following types are used for data:
|
All data is divided into pieces, usually as strings. The following types are used for data:
|
||||||
|
|
||||||
- struct FunctionInfo
|
- struct FunctionInfo
|
||||||
- struct StructInfo
|
- struct StructInfo
|
||||||
|
- struct AliasInfo
|
||||||
- struct EnumInfo
|
- struct EnumInfo
|
||||||
- struct DefInfo
|
- struct DefInfo
|
||||||
|
|
||||||
|
@ -67,6 +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_ALIASES_TO_PARSE 64 // Maximum number of aliases 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 2048 // Maximum number of defines to parse
|
#define MAX_DEFINES_TO_PARSE 2048 // Maximum number of defines to parse
|
||||||
|
|
||||||
|
@ -101,6 +103,13 @@ typedef struct StructInfo {
|
||||||
char fieldDesc[MAX_STRUCT_FIELDS][128]; // Field description
|
char fieldDesc[MAX_STRUCT_FIELDS][128]; // Field description
|
||||||
} StructInfo;
|
} StructInfo;
|
||||||
|
|
||||||
|
// Alias info data
|
||||||
|
typedef struct AliasInfo {
|
||||||
|
char type[64]; // Alias type
|
||||||
|
char name[64]; // Alias name
|
||||||
|
char desc[128]; // Alias description
|
||||||
|
} AliasInfo;
|
||||||
|
|
||||||
// Enum info data
|
// Enum info data
|
||||||
typedef struct EnumInfo {
|
typedef struct EnumInfo {
|
||||||
char name[64]; // Enum name
|
char name[64]; // Enum name
|
||||||
|
@ -131,10 +140,12 @@ 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 aliasCount = 0;
|
||||||
static int enumCount = 0;
|
static int enumCount = 0;
|
||||||
static int defineCount = 0;
|
static int defineCount = 0;
|
||||||
static FunctionInfo *funcs = NULL;
|
static FunctionInfo *funcs = NULL;
|
||||||
static StructInfo *structs = NULL;
|
static StructInfo *structs = NULL;
|
||||||
|
static AliasInfo *aliases = NULL;
|
||||||
static EnumInfo *enums = NULL;
|
static EnumInfo *enums = NULL;
|
||||||
static DefineInfo *defines = NULL;
|
static DefineInfo *defines = NULL;
|
||||||
static char apiDefine[32] = "RLAPI\0";
|
static char apiDefine[32] = "RLAPI\0";
|
||||||
|
@ -182,9 +193,12 @@ int main(int argc, char* argv[])
|
||||||
// Function lines pointers, selected from buffer "lines"
|
// Function lines pointers, selected from buffer "lines"
|
||||||
char **funcLines = (char **)malloc(MAX_FUNCS_TO_PARSE*sizeof(char *));
|
char **funcLines = (char **)malloc(MAX_FUNCS_TO_PARSE*sizeof(char *));
|
||||||
|
|
||||||
// Structs data (multiple lines), selected from "buffer"
|
// Structs lines pointers, selected from buffer "lines"
|
||||||
int *structLines = (int *)malloc(MAX_STRUCTS_TO_PARSE*sizeof(int));
|
int *structLines = (int *)malloc(MAX_STRUCTS_TO_PARSE*sizeof(int));
|
||||||
|
|
||||||
|
// Aliases lines pointers, selected from buffer "lines"
|
||||||
|
int *aliasLines = (int *)malloc(MAX_ALIASES_TO_PARSE*sizeof(int));
|
||||||
|
|
||||||
// Enums lines pointers, selected from buffer "lines"
|
// Enums lines pointers, selected from buffer "lines"
|
||||||
int *enumLines = (int *)malloc(MAX_ENUMS_TO_PARSE*sizeof(int));
|
int *enumLines = (int *)malloc(MAX_ENUMS_TO_PARSE*sizeof(int));
|
||||||
|
|
||||||
|
@ -215,9 +229,6 @@ int main(int argc, char* argv[])
|
||||||
int j = 0;
|
int j = 0;
|
||||||
bool validStruct = false;
|
bool validStruct = false;
|
||||||
|
|
||||||
// WARNING: Typedefs between types: typedef Vector4 Quaternion;
|
|
||||||
// (maybe we could export these too?)
|
|
||||||
|
|
||||||
for (int c = 0; c < MAX_LINE_LENGTH; c++)
|
for (int c = 0; c < MAX_LINE_LENGTH; c++)
|
||||||
{
|
{
|
||||||
char v = lines[i][c];
|
char v = lines[i][c];
|
||||||
|
@ -237,6 +248,28 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read alias lines
|
||||||
|
for (int i = 0; i < linesCount; i++)
|
||||||
|
{
|
||||||
|
// Find aliases (lines with "typedef ... ...;")
|
||||||
|
if (IsTextEqual(lines[i], "typedef", 7))
|
||||||
|
{
|
||||||
|
int spaceCount = 0;
|
||||||
|
bool validAlias = false;
|
||||||
|
|
||||||
|
for (int c = 0; c < MAX_LINE_LENGTH; c++)
|
||||||
|
{
|
||||||
|
char v = lines[i][c];
|
||||||
|
if (v == ' ') spaceCount++;
|
||||||
|
if (v == ';' && spaceCount == 2) validAlias = true;
|
||||||
|
if (v == ';' || v == '(' || v == '\0') break;
|
||||||
|
}
|
||||||
|
if (!validAlias) continue;
|
||||||
|
aliasLines[aliasCount] = i;
|
||||||
|
aliasCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Read enum lines
|
// Read enum lines
|
||||||
for (int i = 0; i < linesCount; i++)
|
for (int i = 0; i < linesCount; i++)
|
||||||
{
|
{
|
||||||
|
@ -328,6 +361,47 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
structs[i].fieldCount++;
|
structs[i].fieldCount++;
|
||||||
|
|
||||||
|
// Split field names containing multiple fields (like Matrix)
|
||||||
|
int originalIndex = structs[i].fieldCount - 1;
|
||||||
|
int originalLength = -1;
|
||||||
|
int lastStart;
|
||||||
|
for (int c = 0; c < TextLength(structs[i].fieldName[originalIndex]) + 1; c++)
|
||||||
|
{
|
||||||
|
char v = structs[i].fieldName[originalIndex][c];
|
||||||
|
bool isEndOfString = v == '\0';
|
||||||
|
if ((v == ',') || isEndOfString)
|
||||||
|
{
|
||||||
|
if (originalLength == -1)
|
||||||
|
{
|
||||||
|
// Save length of original field name
|
||||||
|
// Don't truncate yet, still needed for copying
|
||||||
|
originalLength = c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Copy field data from original field
|
||||||
|
int nameLength = c - lastStart;
|
||||||
|
MemoryCopy(structs[i].fieldName[structs[i].fieldCount], &(structs[i].fieldName[originalIndex][lastStart]), nameLength);
|
||||||
|
MemoryCopy(structs[i].fieldType[structs[i].fieldCount], &(structs[i].fieldType[originalIndex][0]), TextLength(structs[i].fieldType[originalIndex]));
|
||||||
|
MemoryCopy(structs[i].fieldDesc[structs[i].fieldCount], &(structs[i].fieldDesc[originalIndex][0]), TextLength(structs[i].fieldDesc[originalIndex]));
|
||||||
|
structs[i].fieldCount++;
|
||||||
|
}
|
||||||
|
if (!isEndOfString)
|
||||||
|
{
|
||||||
|
// Skip comma and spaces
|
||||||
|
c++;
|
||||||
|
while (structs[i].fieldName[originalIndex][c] == ' ') c++;
|
||||||
|
|
||||||
|
// Save position for next field
|
||||||
|
lastStart = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Set length of original field
|
||||||
|
// This has no effect on fields that are on their own line
|
||||||
|
// But it truncates the first field name of fields that share a line
|
||||||
|
structs[i].fieldName[originalIndex][originalLength] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,9 +409,44 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(structLines);
|
free(structLines);
|
||||||
|
|
||||||
|
// Alias info data
|
||||||
|
aliases = (AliasInfo *)calloc(MAX_ALIASES_TO_PARSE, sizeof(AliasInfo));
|
||||||
|
int aliasIndex = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < aliasCount; i++)
|
||||||
|
{
|
||||||
|
// Description from previous line
|
||||||
|
char *previousLinePtr = lines[aliasLines[i] - 1];
|
||||||
|
if (previousLinePtr[0] == '/') MemoryCopy(aliases[i].desc, previousLinePtr, MAX_LINE_LENGTH);
|
||||||
|
|
||||||
|
char *linePtr = lines[aliasLines[i]];
|
||||||
|
|
||||||
|
// Skip "typedef "
|
||||||
|
int c = 8;
|
||||||
|
|
||||||
|
// Type
|
||||||
|
int typeStart = c;
|
||||||
|
while(linePtr[c] != ' ') c++;
|
||||||
|
int typeLen = c - typeStart;
|
||||||
|
MemoryCopy(aliases[i].type, linePtr + typeStart, typeLen);
|
||||||
|
|
||||||
|
// Skip space
|
||||||
|
c++;
|
||||||
|
|
||||||
|
// Name
|
||||||
|
int nameStart = c;
|
||||||
|
while(linePtr[c] != ';') c++;
|
||||||
|
int nameLen = c - nameStart;
|
||||||
|
MemoryCopy(aliases[i].name, linePtr + nameStart, nameLen);
|
||||||
|
|
||||||
|
// Description
|
||||||
|
while((linePtr[c] != '\0') && (linePtr[c] != '/')) c++;
|
||||||
|
if (linePtr[c] == '/') MemoryCopy(aliases[i].desc, linePtr + c, MAX_LINE_LENGTH);
|
||||||
|
}
|
||||||
|
free(aliasLines);
|
||||||
|
|
||||||
// Enum info data
|
// Enum info data
|
||||||
enums = (EnumInfo *)calloc(MAX_ENUMS_TO_PARSE, sizeof(EnumInfo));
|
enums = (EnumInfo *)calloc(MAX_ENUMS_TO_PARSE, sizeof(EnumInfo));
|
||||||
|
|
||||||
|
@ -376,7 +485,11 @@ int main(int argc, char* argv[])
|
||||||
while ((linePtr[c] != ',') &&
|
while ((linePtr[c] != ',') &&
|
||||||
(linePtr[c] != ' ') &&
|
(linePtr[c] != ' ') &&
|
||||||
(linePtr[c] != '=') &&
|
(linePtr[c] != '=') &&
|
||||||
(linePtr[c] != '\0')) { enums[i].valueName[enums[i].valueCount][c] = linePtr[c]; c++; }
|
(linePtr[c] != '\0'))
|
||||||
|
{
|
||||||
|
enums[i].valueName[enums[i].valueCount][c] = linePtr[c];
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
// After the name we can have:
|
// After the name we can have:
|
||||||
// '=' -> value is provided
|
// '=' -> value is provided
|
||||||
|
@ -393,7 +506,11 @@ int main(int argc, char* argv[])
|
||||||
bool foundValue = false;
|
bool foundValue = false;
|
||||||
while ((linePtr[c] != '\0') && (linePtr[c] != '/'))
|
while ((linePtr[c] != '\0') && (linePtr[c] != '/'))
|
||||||
{
|
{
|
||||||
if (linePtr[c] == '=') { foundValue = true; break; }
|
if (linePtr[c] == '=')
|
||||||
|
{
|
||||||
|
foundValue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +537,7 @@ int main(int argc, char* argv[])
|
||||||
else enums[i].valueInteger[enums[i].valueCount] = (enums[i].valueInteger[enums[i].valueCount - 1] + 1);
|
else enums[i].valueInteger[enums[i].valueCount] = (enums[i].valueInteger[enums[i].valueCount - 1] + 1);
|
||||||
|
|
||||||
// Look for description or end of line
|
// Look for description or end of line
|
||||||
while ((linePtr[c] != '/') && (linePtr[c] != '\0')) { c++; }
|
while ((linePtr[c] != '/') && (linePtr[c] != '\0')) c++;
|
||||||
if (linePtr[c] == '/')
|
if (linePtr[c] == '/')
|
||||||
{
|
{
|
||||||
// Parse value description
|
// Parse value description
|
||||||
|
@ -433,7 +550,11 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Get enum name from typedef
|
// Get enum name from typedef
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while (linePtr[2 + c] != ';') { enums[i].name[c] = linePtr[2 + c]; c++; }
|
while (linePtr[2 + c] != ';')
|
||||||
|
{
|
||||||
|
enums[i].name[c] = linePtr[2 + c];
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
break; // Enum ended, break for() loop
|
break; // Enum ended, break for() loop
|
||||||
}
|
}
|
||||||
|
@ -450,20 +571,22 @@ int main(int argc, char* argv[])
|
||||||
char *linePtr = lines[defineLines[i]];
|
char *linePtr = lines[defineLines[i]];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
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 "
|
||||||
|
|
||||||
// Extract name
|
// Extract name
|
||||||
int defineNameStart = j;
|
int defineNameStart = j;
|
||||||
while (linePtr[j] != ' ' && linePtr[j] != '\t' && linePtr[j] != '\0') j++;
|
while ((linePtr[j] != ' ') && (linePtr[j] != '\t') && (linePtr[j] != '\0')) j++;
|
||||||
int defineNameEnd = j-1;
|
int defineNameEnd = j-1;
|
||||||
|
|
||||||
// Skip duplicates
|
// Skip duplicates
|
||||||
int nameLen = defineNameEnd - defineNameStart + 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 (nameLen == TextLength(defines[k].name) && IsTextEqual(defines[k].name, linePtr + defineNameStart, nameLen)) {
|
{
|
||||||
|
if ((nameLen == TextLength(defines[k].name)) && IsTextEqual(defines[k].name, linePtr + defineNameStart, nameLen))
|
||||||
|
{
|
||||||
isDuplicate = true;
|
isDuplicate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -475,26 +598,39 @@ int main(int argc, char* argv[])
|
||||||
// Determine type
|
// Determine type
|
||||||
if (linePtr[defineNameEnd] == ')') defines[defineIndex].type = MACRO;
|
if (linePtr[defineNameEnd] == ')') defines[defineIndex].type = MACRO;
|
||||||
|
|
||||||
while (linePtr[j] == ' ' || linePtr[j] == '\t') j++; // Skip spaces and tabs after name
|
while ((linePtr[j] == ' ') || (linePtr[j] == '\t')) j++; // Skip spaces and tabs after name
|
||||||
|
|
||||||
int defineValueStart = j;
|
int defineValueStart = j;
|
||||||
if (linePtr[j] == '\0' || linePtr == "/") defines[defineIndex].type = GUARD;
|
if ((linePtr[j] == '\0') || (linePtr == "/")) defines[defineIndex].type = GUARD;
|
||||||
if (linePtr[j] == '"') defines[defineIndex].type = STRING;
|
if (linePtr[j] == '"') defines[defineIndex].type = STRING;
|
||||||
else if (linePtr[j] == '\'') defines[defineIndex].type = CHAR;
|
else if (linePtr[j] == '\'') defines[defineIndex].type = CHAR;
|
||||||
else if (IsTextEqual(linePtr+j, "CLITERAL(Color)", 15)) defines[defineIndex].type = COLOR;
|
else if (IsTextEqual(linePtr+j, "CLITERAL(Color)", 15)) defines[defineIndex].type = COLOR;
|
||||||
else if (isdigit(linePtr[j])) { // Parsing numbers
|
else if (isdigit(linePtr[j])) // Parsing numbers
|
||||||
|
{
|
||||||
bool isFloat = false, isNumber = true, isHex = false;
|
bool isFloat = false, isNumber = true, isHex = false;
|
||||||
while (linePtr[j] != ' ' && linePtr[j] != '\t' && linePtr[j] != '\0') {
|
while ((linePtr[j] != ' ') && (linePtr[j] != '\t') && (linePtr[j] != '\0'))
|
||||||
|
{
|
||||||
char ch = linePtr[j];
|
char ch = linePtr[j];
|
||||||
if (ch == '.') isFloat = true;
|
if (ch == '.') isFloat = true;
|
||||||
if (ch == 'x') isHex = true;
|
if (ch == 'x') isHex = true;
|
||||||
if (!(isdigit(ch)||(ch >= 'a' && ch <= 'f')||(ch >= 'A' && ch <= 'F')||ch=='x'||ch=='L'||ch=='.'||ch=='+'||ch=='-')) isNumber = false;
|
if (!(isdigit(ch) ||
|
||||||
|
((ch >= 'a') && (ch <= 'f')) ||
|
||||||
|
((ch >= 'A') && (ch <= 'F')) ||
|
||||||
|
(ch == 'x') ||
|
||||||
|
(ch == 'L') ||
|
||||||
|
(ch == '.') ||
|
||||||
|
(ch == '+') ||
|
||||||
|
(ch == '-'))) isNumber = false;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if (isNumber) {
|
if (isNumber)
|
||||||
if (isFloat) {
|
{
|
||||||
|
if (isFloat)
|
||||||
|
{
|
||||||
defines[defineIndex].type = linePtr[j-1] == 'f' ? FLOAT : DOUBLE;
|
defines[defineIndex].type = linePtr[j-1] == 'f' ? FLOAT : DOUBLE;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
defines[defineIndex].type = linePtr[j-1] == 'L' ? LONG : INT;
|
defines[defineIndex].type = linePtr[j-1] == 'L' ? LONG : INT;
|
||||||
defines[defineIndex].isHex = isHex;
|
defines[defineIndex].isHex = isHex;
|
||||||
}
|
}
|
||||||
|
@ -502,19 +638,20 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extracting value
|
// Extracting value
|
||||||
while (linePtr[j] != '\\' && linePtr[j] != '\0' && !(linePtr[j] == '/' && linePtr[j+1] == '/')) j++;
|
while ((linePtr[j] != '\\') && (linePtr[j] != '\0') && !((linePtr[j] == '/') && (linePtr[j+1] == '/'))) j++;
|
||||||
int defineValueEnd = j-1;
|
int defineValueEnd = j-1;
|
||||||
while (linePtr[defineValueEnd] == ' ' || linePtr[defineValueEnd] == '\t') defineValueEnd--; // Remove trailing spaces and tabs
|
while ((linePtr[defineValueEnd] == ' ') || (linePtr[defineValueEnd] == '\t')) defineValueEnd--; // Remove trailing spaces and tabs
|
||||||
if (defines[defineIndex].type == LONG || defines[defineIndex].type == FLOAT) defineValueEnd--; // Remove number postfix
|
if ((defines[defineIndex].type == LONG) || (defines[defineIndex].type == FLOAT)) defineValueEnd--; // Remove number postfix
|
||||||
int valueLen = defineValueEnd - defineValueStart + 1;
|
int valueLen = defineValueEnd - defineValueStart + 1;
|
||||||
if (valueLen > 255) valueLen = 255;
|
if (valueLen > 255) valueLen = 255;
|
||||||
|
|
||||||
if (valueLen > 0) MemoryCopy(defines[defineIndex].value, linePtr + defineValueStart, valueLen);
|
if (valueLen > 0) MemoryCopy(defines[defineIndex].value, linePtr + defineValueStart, valueLen);
|
||||||
|
|
||||||
// Extracting description
|
// Extracting description
|
||||||
if (linePtr[j] == '/') {
|
if (linePtr[j] == '/')
|
||||||
|
{
|
||||||
int commentStart = j;
|
int commentStart = j;
|
||||||
while (linePtr[j] != '\\' && linePtr[j] != '\0') j++;
|
while ((linePtr[j] != '\\') && (linePtr[j] != '\0')) j++;
|
||||||
int commentEnd = j-1;
|
int commentEnd = j-1;
|
||||||
int commentLen = commentEnd - commentStart + 1;
|
int commentLen = commentEnd - commentStart + 1;
|
||||||
if (commentLen > 127) commentLen = 127;
|
if (commentLen > 127) commentLen = 127;
|
||||||
|
@ -606,6 +743,7 @@ int main(int argc, char* argv[])
|
||||||
// At this point, all raylib data has been parsed!
|
// At this point, all raylib data has been parsed!
|
||||||
//-----------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------
|
||||||
// structs[] -> We have all the structs decomposed into pieces for further analysis
|
// structs[] -> We have all the structs decomposed into pieces for further analysis
|
||||||
|
// aliases[] -> We have all the aliases 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
|
||||||
// defines[] -> We have all the defines decomposed into pieces for further analysis
|
// defines[] -> We have all the defines decomposed into pieces for further analysis
|
||||||
|
@ -624,7 +762,9 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
free(funcs);
|
free(funcs);
|
||||||
free(structs);
|
free(structs);
|
||||||
|
free(aliases);
|
||||||
free(enums);
|
free(enums);
|
||||||
|
free(defines);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -807,7 +947,7 @@ static void GetDataTypeAndName(const char *typeName, int typeNameLen, char *type
|
||||||
{
|
{
|
||||||
for (int k = typeNameLen; k > 0; k--)
|
for (int k = typeNameLen; k > 0; k--)
|
||||||
{
|
{
|
||||||
if (typeName[k] == ' ' && typeName[k - 1] != ',')
|
if ((typeName[k] == ' ') && (typeName[k - 1] != ','))
|
||||||
{
|
{
|
||||||
// Function name starts at this point (and ret type finishes at this point)
|
// Function name starts at this point (and ret type finishes at this point)
|
||||||
MemoryCopy(type, typeName, k);
|
MemoryCopy(type, typeName, k);
|
||||||
|
@ -820,7 +960,7 @@ static void GetDataTypeAndName(const char *typeName, int typeNameLen, char *type
|
||||||
MemoryCopy(name, typeName + k + 1, typeNameLen - k - 1);
|
MemoryCopy(name, typeName + k + 1, typeNameLen - k - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (typeName[k] == '.' && typeNameLen == 3) // Handle varargs ...);
|
else if ((typeName[k] == '.') && (typeNameLen == 3)) // Handle varargs ...);
|
||||||
{
|
{
|
||||||
MemoryCopy(type, "...", 3);
|
MemoryCopy(type, "...", 3);
|
||||||
MemoryCopy(name, "args", 4);
|
MemoryCopy(name, "args", 4);
|
||||||
|
@ -978,6 +1118,16 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
for (int f = 0; f < structs[i].fieldCount; f++) fprintf(outFile, " Field[%i]: %s %s %s\n", f + 1, structs[i].fieldType[f], structs[i].fieldName[f], structs[i].fieldDesc[f]);
|
for (int f = 0; f < structs[i].fieldCount; f++) fprintf(outFile, " Field[%i]: %s %s %s\n", f + 1, structs[i].fieldType[f], structs[i].fieldName[f], structs[i].fieldDesc[f]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print aliases info
|
||||||
|
fprintf(outFile, "\nAliases found: %i\n\n", aliasCount);
|
||||||
|
for (int i = 0; i < aliasCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, "Alias %03i: %s\n", i + 1, aliases[i].name);
|
||||||
|
fprintf(outFile, " Type: %s\n", aliases[i].type);
|
||||||
|
fprintf(outFile, " Name: %s\n", aliases[i].name);
|
||||||
|
fprintf(outFile, " Description: %s\n", aliases[i].desc + 3);
|
||||||
|
}
|
||||||
|
|
||||||
// Print enums info
|
// Print enums info
|
||||||
fprintf(outFile, "\nEnums found: %i\n\n", enumCount);
|
fprintf(outFile, "\nEnums found: %i\n\n", enumCount);
|
||||||
for (int i = 0; i < enumCount; i++)
|
for (int i = 0; i < enumCount; i++)
|
||||||
|
@ -1000,6 +1150,7 @@ 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print defines info
|
||||||
fprintf(outFile, "\nDefines found: %i\n\n", defineCount);
|
fprintf(outFile, "\nDefines found: %i\n\n", defineCount);
|
||||||
for (int i = 0; i < defineCount; i++)
|
for (int i = 0; i < defineCount; i++)
|
||||||
{
|
{
|
||||||
|
@ -1039,6 +1190,21 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
}
|
}
|
||||||
fprintf(outFile, " },\n");
|
fprintf(outFile, " },\n");
|
||||||
|
|
||||||
|
// Print aliases info
|
||||||
|
fprintf(outFile, " aliases = {\n");
|
||||||
|
for (int i = 0; i < aliasCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " type = \"%s\",\n", aliases[i].type);
|
||||||
|
fprintf(outFile, " name = \"%s\",\n", aliases[i].name);
|
||||||
|
fprintf(outFile, " description = \"%s\"\n", aliases[i].desc + 3);
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
|
||||||
|
if (i < aliasCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " },\n");
|
||||||
|
|
||||||
// Print enums info
|
// Print enums info
|
||||||
fprintf(outFile, " enums = {\n");
|
fprintf(outFile, " enums = {\n");
|
||||||
for (int i = 0; i < enumCount; i++)
|
for (int i = 0; i < enumCount; i++)
|
||||||
|
@ -1071,9 +1237,16 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
fprintf(outFile, " {\n");
|
fprintf(outFile, " {\n");
|
||||||
fprintf(outFile, " name = \"%s\",\n", defines[i].name);
|
fprintf(outFile, " name = \"%s\",\n", defines[i].name);
|
||||||
fprintf(outFile, " type = \"%s\",\n", StrDefineType(defines[i].type));
|
fprintf(outFile, " type = \"%s\",\n", StrDefineType(defines[i].type));
|
||||||
if (defines[i].type == INT || defines[i].type == LONG || defines[i].type == FLOAT || defines[i].type == DOUBLE || defines[i].type == STRING) {
|
if ((defines[i].type == INT) ||
|
||||||
|
(defines[i].type == LONG) ||
|
||||||
|
(defines[i].type == FLOAT) ||
|
||||||
|
(defines[i].type == DOUBLE) ||
|
||||||
|
(defines[i].type == STRING))
|
||||||
|
{
|
||||||
fprintf(outFile, " value = %s,\n", defines[i].value);
|
fprintf(outFile, " value = %s,\n", defines[i].value);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fprintf(outFile, " value = \"%s\",\n", defines[i].value);
|
fprintf(outFile, " value = \"%s\",\n", defines[i].value);
|
||||||
}
|
}
|
||||||
fprintf(outFile, " description = \"%s\"\n", defines[i].desc + 3);
|
fprintf(outFile, " description = \"%s\"\n", defines[i].desc + 3);
|
||||||
|
@ -1142,6 +1315,21 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
}
|
}
|
||||||
fprintf(outFile, " ],\n");
|
fprintf(outFile, " ],\n");
|
||||||
|
|
||||||
|
// Print aliases info
|
||||||
|
fprintf(outFile, " \"aliases\": [\n");
|
||||||
|
for (int i = 0; i < aliasCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " {\n");
|
||||||
|
fprintf(outFile, " \"type\": \"%s\",\n", aliases[i].type);
|
||||||
|
fprintf(outFile, " \"name\": \"%s\",\n", aliases[i].name);
|
||||||
|
fprintf(outFile, " \"description\": \"%s\"\n", aliases[i].desc + 3);
|
||||||
|
fprintf(outFile, " }");
|
||||||
|
|
||||||
|
if (i < aliasCount - 1) fprintf(outFile, ",\n");
|
||||||
|
else fprintf(outFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(outFile, " ],\n");
|
||||||
|
|
||||||
// Print enums info
|
// Print enums info
|
||||||
fprintf(outFile, " \"enums\": [\n");
|
fprintf(outFile, " \"enums\": [\n");
|
||||||
for (int i = 0; i < enumCount; i++)
|
for (int i = 0; i < enumCount; i++)
|
||||||
|
@ -1174,11 +1362,20 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
fprintf(outFile, " {\n");
|
fprintf(outFile, " {\n");
|
||||||
fprintf(outFile, " \"name\": \"%s\",\n", defines[i].name);
|
fprintf(outFile, " \"name\": \"%s\",\n", defines[i].name);
|
||||||
fprintf(outFile, " \"type\": \"%s\",\n", StrDefineType(defines[i].type));
|
fprintf(outFile, " \"type\": \"%s\",\n", StrDefineType(defines[i].type));
|
||||||
if (defines[i].isHex) { // INT or LONG
|
if (defines[i].isHex) // INT or LONG
|
||||||
|
{
|
||||||
fprintf(outFile, " \"value\": %ld,\n", strtol(defines[i].value, NULL, 16));
|
fprintf(outFile, " \"value\": %ld,\n", strtol(defines[i].value, NULL, 16));
|
||||||
} else if (defines[i].type == INT || defines[i].type == LONG || defines[i].type == FLOAT || defines[i].type == DOUBLE || defines[i].type == STRING) {
|
}
|
||||||
|
else if ((defines[i].type == INT) ||
|
||||||
|
(defines[i].type == LONG) ||
|
||||||
|
(defines[i].type == FLOAT) ||
|
||||||
|
(defines[i].type == DOUBLE) ||
|
||||||
|
(defines[i].type == STRING))
|
||||||
|
{
|
||||||
fprintf(outFile, " \"value\": %s,\n", defines[i].value);
|
fprintf(outFile, " \"value\": %s,\n", defines[i].value);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fprintf(outFile, " \"value\": \"%s\",\n", defines[i].value);
|
fprintf(outFile, " \"value\": \"%s\",\n", defines[i].value);
|
||||||
}
|
}
|
||||||
fprintf(outFile, " \"description\": \"%s\"\n", defines[i].desc + 3);
|
fprintf(outFile, " \"description\": \"%s\"\n", defines[i].desc + 3);
|
||||||
|
@ -1229,16 +1426,22 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
<raylibAPI>
|
<raylibAPI>
|
||||||
<Structs count="">
|
<Structs count="">
|
||||||
<Struct name="" fieldCount="" desc="">
|
<Struct name="" fieldCount="" desc="">
|
||||||
<Field type="" name="" desc="">
|
<Field type="" name="" desc="" />
|
||||||
<Field type="" name="" desc="">
|
<Field type="" name="" desc="" />
|
||||||
</Struct>
|
</Struct>
|
||||||
<Structs>
|
<Structs>
|
||||||
|
<Aliases count="">
|
||||||
|
<Alias type="" name="" desc="" />
|
||||||
|
</Aliases>
|
||||||
<Enums count="">
|
<Enums count="">
|
||||||
<Enum name="" valueCount="" desc="">
|
<Enum name="" valueCount="" desc="">
|
||||||
<Value name="" integer="" desc="">
|
<Value name="" integer="" desc="" />
|
||||||
<Value name="" integer="" desc="">
|
<Value name="" integer="" desc="" />
|
||||||
</Enum>
|
</Enum>
|
||||||
</Enums>
|
</Enums>
|
||||||
|
<Defines count="">
|
||||||
|
<Define name="" type="" value="" desc="" />
|
||||||
|
</Defines>
|
||||||
<Functions count="">
|
<Functions count="">
|
||||||
<Function name="" retType="" paramCount="" desc="">
|
<Function name="" retType="" paramCount="" desc="">
|
||||||
<Param type="" name="" desc="" />
|
<Param type="" name="" desc="" />
|
||||||
|
@ -1264,6 +1467,14 @@ static void ExportParsedData(const char *fileName, int format)
|
||||||
}
|
}
|
||||||
fprintf(outFile, " </Structs>\n");
|
fprintf(outFile, " </Structs>\n");
|
||||||
|
|
||||||
|
// Print aliases info
|
||||||
|
fprintf(outFile, " <Aliases count=\"%i\">\n", aliasCount);
|
||||||
|
for (int i = 0; i < aliasCount; i++)
|
||||||
|
{
|
||||||
|
fprintf(outFile, " <Alias type=\"%s\" name=\"%s\" desc=\"%s\" />\n", aliases[i].name, aliases[i].type, aliases[i].desc + 3);
|
||||||
|
}
|
||||||
|
fprintf(outFile, " </Aliases>\n");
|
||||||
|
|
||||||
// Print enums info
|
// Print enums info
|
||||||
fprintf(outFile, " <Enums count=\"%i\">\n", enumCount);
|
fprintf(outFile, " <Enums count=\"%i\">\n", enumCount);
|
||||||
for (int i = 0; i < enumCount; i++)
|
for (int i = 0; i < enumCount; i++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue