Changeset 2509 for code/branches/buildsystem2/src/tolua/lua/custom.lua
- Timestamp:
- Dec 17, 2008, 8:59:48 PM (16 years ago)
- Location:
- code/branches/buildsystem2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem2
- Property svn:ignore deleted
- Property svn:mergeinfo changed
/code/branches/buildsystem (added) merged: 1875,1882-1886,1975-1982,1991,1999,2054,2061,2135,2137-2139,2197-2199,2204,2214-2220,2223-2224,2229,2233-2244,2248-2249,2252-2253,2260,2275
-
code/branches/buildsystem2/src/tolua/lua/custom.lua
r2087 r2509 1 1 2 2 function extract_code(fn,s) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 3 local code = "" 4 if fn then 5 code = '\n$#include "'..fn..'"\n' 6 end 7 s= "\n" .. s .. "\n" -- add blank lines as sentinels 8 local _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n") 9 while e do 10 t = strlower(t) 11 if t == "bind_begin" then 12 _,e,c = strfind(s,"(.-)\n[^\n]*SCRIPT_BIND_END[^\n]*\n",e) 13 if not e then 14 tolua_error("Unbalanced 'SCRIPT_BIND_BEGIN' directive in header file") 15 end 16 end 17 if t == "bind_class" or t == "bind_block" then 18 local b 19 _,e,c,b = string.find(s, "([^{]-)(%b{})", e) 20 c = c..'{\n'..extract_code(nil, b)..'\n};\n' 21 end 22 code = code .. c .. "\n" 23 _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n",e) 24 end 25 return code 26 26 end 27 27 … … 33 33 34 34 function include_file_hook(p, filename) 35 35 do return end 36 36 --print("FILENAME is "..filename) 37 38 39 40 41 42 43 37 p.code = string.gsub(p.code, "\n%s*SigC::Signal", "\n\ttolua_readonly SigC::Signal") 38 p.code = string.gsub(p.code, "#ifdef __cplusplus\nextern \"C\" {\n#endif", "") 39 p.code = string.gsub(p.code, "#ifdef __cplusplus\n};?\n#endif", "") 40 p.code = string.gsub(p.code, "DECLSPEC", "") 41 p.code = string.gsub(p.code, "SDLCALL", "") 42 p.code = string.gsub(p.code, "DLLINTERFACE", "") 43 p.code = string.gsub(p.code, "#define[^\n]*_[hH]_?%s*\n", "\n") 44 44 --print("code is "..p.code) 45 45 end
Note: See TracChangeset
for help on using the changeset viewer.