first commit

This commit is contained in:
hinomori_minori
2026-09-12 05:38:04 +09:00
commit 3e167c7e13
1844 changed files with 841995 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
Copyright (c) 2021-2026 Ramon Santamaria (@raysan5)
This software is provided "as-is", without any express or implied warranty. In no event
will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you
wrote the original software. If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented
as being the original software.
3. This notice may not be removed or altered from any source distribution.
+118
View File
@@ -0,0 +1,118 @@
EXTENSION?=txt
FORMAT?=DEFAULT
.PHONY: all parse clean raylib_api
# Determine PLATFORM_OS
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
PLATFORM_OS = WINDOWS
else
UNAMEOS = $(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS = LINUX
endif
ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS = BSD
endif
ifeq ($(UNAMEOS),OpenBSD)
PLATFORM_OS = BSD
endif
ifeq ($(UNAMEOS),NetBSD)
PLATFORM_OS = BSD
endif
ifeq ($(UNAMEOS),DragonFly)
PLATFORM_OS = BSD
endif
ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS = OSX
endif
endif
# Define default C compiler: CC
#------------------------------------------------------------------------------------------------
CC = gcc
ifeq ($(PLATFORM_OS),OSX)
# OSX default compiler
CC = clang
endif
ifeq ($(PLATFORM_OS),BSD)
# FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
CC = clang
endif
# Define default make program: MAKE
#------------------------------------------------------------------------------------------------
MAKE ?= make
ifeq ($(PLATFORM_OS),WINDOWS)
MAKE = mingw32-make
endif
# Define compiler flags: CFLAGS
#------------------------------------------------------------------------------------------------
CFLAGS = -Wall -std=c99
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(BUILD_MODE),DEBUG)
CFLAGS += -g -D_DEBUG
else
ifeq ($(PLATFORM_OS),OSX)
CFLAGS += -O2
else
CFLAGS += -s -O2
endif
endif
ifeq ($(PLATFORM_OS),WINDOWS)
# NOTE: The resource .rc file contains windows executable icon and properties
CFLAGS += rlparser.rc.data
endif
# Define processes to execute
#------------------------------------------------------------------------------------------------
# rlparser compilation
rlparser: rlparser.c
$(CC) rlparser.c -o rlparser $(CFLAGS)
# rlparser execution: [raylib.h] parse, generating some output files
raylib_api: ../../src/raylib.h rlparser
FORMAT=DEFAULT EXTENSION=txt $(MAKE) raylib_api.txt
FORMAT=JSON EXTENSION=json $(MAKE) raylib_api.json
FORMAT=XML EXTENSION=xml $(MAKE) raylib_api.xml
FORMAT=LUA EXTENSION=lua $(MAKE) raylib_api.lua
# rlparser execution: [raylib.h] parse, generating some output files
raylib_api.$(EXTENSION): ../../src/raylib.h rlparser
./rlparser -i ../../src/raylib.h -o raylib_api.$(EXTENSION) -f $(FORMAT) -d RLAPI
# rlparser execution: [rlgl.h] parse, generating some output files
rlgl_api.$(EXTENSION): ../../src/rlgl.h rlparser
./rlparser -i ../../src/rlgl.h -o rlgl_api.$(EXTENSION) -f $(FORMAT) -d RLAPI -t "RLGL IMPLEMENTATION"
# rlparser execution: [raymath.h] parse, generating some output files
raymath_api.$(EXTENSION): ../../src/raymath.h rlparser
./rlparser -i ../../src/raymath.h -o raymath_api.$(EXTENSION) -f $(FORMAT) -d RMAPI
# rlparser execution: [reasings.h] parse, generating some output files
reasings_api.$(EXTENSION): ../../examples/others/reasings.h rlparser
./rlparser -i ../../examples/others/reasings.h -o reasings_api.$(EXTENSION) -f $(FORMAT) -d EASEDEF
# rlparser execution: [raygui.h] parse, generating some output files
raygui_api.$(EXTENSION): ../raygui.h rlparser
./rlparser -i ../raygui.h -o raygui_api.$(EXTENSION) -f $(FORMAT) -d RAYGUIAPI -t "RAYGUI IMPLEMENTATION"
# Target to generate required APIs output files
parse: raylib_api.$(EXTENSION) raymath_api.$(EXTENSION) rlgl_api.$(EXTENSION) raygui_api.$(EXTENSION)
# "make parse" (and therefore "make all") requires
# raygui.h and reasings_api.h to exist in the correct directory
# API files for individual headers can be created likeso, provided the relevant header exists:
# FORMAT=JSON EXTENSION=json make raygui_api.json
all: rlparser
FORMAT=DEFAULT EXTENSION=txt $(MAKE) parse
FORMAT=JSON EXTENSION=json $(MAKE) parse
FORMAT=XML EXTENSION=xml $(MAKE) parse
FORMAT=LUA EXTENSION=lua $(MAKE) parse
# Clean rlparser and generated output files
clean:
rm -f rlparser *.json *.txt *.xml *.lua
+109
View File
@@ -0,0 +1,109 @@
# rlparser - raylib parser
This parser scans [`raylib.h`](../src/raylib.h) to get information about `defines`, `structs`, `enums` and `functions`.
All data is separated into parts, usually as strings. The following types are used for data:
- `struct DefineInfo`
- `struct FunctionInfo`
- `struct StructInfo`
- `struct EnumInfo`
Check `rlparser.c` for details about those structs.
## Command Line
```
//////////////////////////////////////////////////////////////////////////////////
// //
// rlparser - raylib header API parser //
// //
// more info and bugs-report: github.com/raysan5/raylib/tools/rlparser //
// //
// Copyright (c) 2021-2026 Ramon Santamaria (@raysan5) //
// //
//////////////////////////////////////////////////////////////////////////////////
USAGE:
> rlparser [--help] [--input <filename.h>] [--output <filename.ext>] [--format <type>]
OPTIONS:
-h, --help : Show tool version and command line usage help
-i, --input <filename.h> : Define input header file to parse.
NOTE: If not specified, defaults to: raylib.h
-o, --output <filename.ext> : Define output file and format.
Supported extensions: .txt, .json, .xml, .h
NOTE: If not specified, defaults to: raylib_api.txt
-f, --format <type> : Define output format for parser data.
Supported types: DEFAULT, JSON, XML, LUA
-d, --define <DEF> : Define functions specifiers (i.e. RLAPI for raylib.h, RMAPI for raymath.h, etc.)
NOTE: If no specifier defined, defaults to: RLAPI
-t, --truncate <after> : Define string to truncate input after (i.e. "RLGL IMPLEMENTATION" for rlgl.h)
NOTE: If not specified, the full input file is parsed.
EXAMPLES:
> rlparser --input raylib.h --output api.json
Process <raylib.h> to generate <api.json>
> rlparser --output raylib_data.info --format XML
Process <raylib.h> to generate <raylib_data.info> as XML text data
> rlparser --input raymath.h --output raymath_data.info --format XML --define RMAPI
Process <raymath.h> to generate <raymath_data.info> as XML text data
```
## Constraints
`rlparser` is specifically designed to work with `raylib.h`, so, it has some constraints:
- Functions are expected as a single line with the following structure:
```
<retType> <name>(<paramType[0]> <paramName[0]>, <paramType[1]> <paramName[1]>); <desc>
```
Be careful with functions broken into several lines, it breaks the process!
- Structures are expected as several lines with the following form:
```
<desc>
typedef struct <name> {
<fieldType[0]> <fieldName[0]>; <fieldDesc[0]>
<fieldType[1]> <fieldName[1]>; <fieldDesc[1]>
<fieldType[2]> <fieldName[2]>; <fieldDesc[2]>
} <name>;
```
- Enums are expected as several lines with the following form:
```
<desc>
typedef enum {
<valueName[0]> = <valueInteger[0]>, <valueDesc[0]>
<valueName[1]>,
<valueName[2]>, <valueDesc[2]>
<valueName[3]> <valueDesc[3]>
} <name>;
```
_NOTE: For enums, multiple options are supported:_
- If value is not provided, (<valueInteger[i -1]> + 1) is assigned
- Value description can be provided or not
## Additional notes
This parser _could_ work with other C header files if mentioned constraints are followed.
This parser **does not require `<string.h>` library**, all data is parsed directly from char buffers.
### LICENSE: zlib/libpng
raylib-parser is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software.
Check [LICENSE](LICENSE) for further details.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

+24
View File
@@ -0,0 +1,24 @@
IDI_APP_ICON ICON "rlparser.ico"
1 VERSIONINFO
FILEVERSION 6,0,0,0
PRODUCTVERSION 6,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4" // English US
BEGIN
VALUE "CompanyName", "raylib technologies"
VALUE "FileDescription", "rlparser | raylib header API parser"
VALUE "FileVersion", "1.0"
VALUE "InternalName", "rlparser"
VALUE "LegalCopyright", "(c) 2026 Ramon Santamaria (@raysan5)"
VALUE "OriginalFilename", "rlparser"
VALUE "ProductName", "rlparser"
VALUE "ProductVersion", "1.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252 // English US
END
END
Binary file not shown.