summaryrefslogtreecommitdiff
path: root/doc_parser.lua
diff options
context:
space:
mode:
authorjussi2022-11-27 16:25:25 +0200
committerjussi2022-11-27 16:25:25 +0200
commit08ef5b435273eaa3de860eac1c031219cd815587 (patch)
tree921570cddf499c1ac5f10b55342300c190edac55 /doc_parser.lua
parentdeda5fb9170295133444809618835e8b9aa61512 (diff)
downloadreilua-enhanced-08ef5b435273eaa3de860eac1c031219cd815587.tar.gz
reilua-enhanced-08ef5b435273eaa3de860eac1c031219cd815587.tar.bz2
reilua-enhanced-08ef5b435273eaa3de860eac1c031219cd815587.zip
RL_LoadDirectoryFilesEx and separate option for doc_parser.
Diffstat (limited to 'doc_parser.lua')
-rw-r--r--doc_parser.lua49
1 files changed, 36 insertions, 13 deletions
diff --git a/doc_parser.lua b/doc_parser.lua
index 09227cf..d7383e4 100644
--- a/doc_parser.lua
+++ b/doc_parser.lua
@@ -1,5 +1,12 @@
--Create api.md file from c sources.
+-- Export each module as separate .md file.
+local separate = false
+
+if arg[1] ~= nil and arg[1] == "-s" then
+ separate = true
+end
+
local function split( str, sep )
if sep == nil then
sep = "%s"
@@ -34,6 +41,8 @@ Note: Engine will call Raylib functions 'BeginDrawing()' before this function ca
You can still use RL_BeginDrawing() and RL_EndDrawing() manually from anywhere.\n\n---\n" )
apiFile:write( "\n> function log( logLevel, message )\n\
This function can be used for custom log message handling.\n\n---\n" )
+apiFile:write( "\n> function exit()\n\
+This function will be called on program close. Cleanup could be done here.\n\n---\n" )
-- Globals.
@@ -142,27 +151,35 @@ apiFile:write( "\n> NPatchInfo = { { 0, 0, 24, 24 }, 0, 0, 0, 0, NPATCH_NINE_PAT
apiFile:write( "\n> ModelAnimations = ModelAnimationsId\n\
int id. ModelAnimations\n\n---\n" )
+if separate then
+ apiFile:close()
+end
+
-- Functions.
local sourceFiles = {
- "src/core.c",
- "src/shapes.c",
- "src/textures.c",
- "src/text.c",
- "src/models.c",
- "src/audio.c",
- "src/rmath.c",
- "src/rgui.c",
- "src/lights.c",
- "src/rlgl.c",
- "src/easings.c",
+ "core",
+ "shapes",
+ "textures",
+ "text",
+ "models",
+ "audio",
+ "rmath",
+ "rgui",
+ "lights",
+ "rlgl",
+ "easings",
}
for _, src in ipairs( sourceFiles ) do
- srcFile = io.open( src, "r" )
+ srcFile = io.open( "src/"..src..".c", "r" )
local line = ""
local p = false
+ if separate then
+ apiFile = io.open( src..".md", "w" )
+ end
+
repeat
line = srcFile:read( "*l" )
@@ -182,6 +199,12 @@ for _, src in ipairs( sourceFiles ) do
until line == nil
srcFile:close()
+
+ if separate then
+ apiFile:close()
+ end
end
-apiFile:close()
+if not separate then
+ apiFile:close()
+end