Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2008, 8:59:48 PM (16 years ago)
Author:
rgrieder
Message:

Merged revisions 1875-2278 of the buildsystem branch to buildsystem2.

Location:
code/branches/buildsystem2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem2

  • code/branches/buildsystem2/src/tolua/lua/custom_hide.lua

    r2087 r2509  
    11-- extract code with tolua_hide, and also
    22function extract_code(fn,s)
    3         local code = '\n$#include "'..fn..'"\n'
    4         s= "\n" .. s .. "\n" -- add blank lines as sentinels
    5         local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n")
    6         while e do
    7                 t = strlower(t)
    8                 if t == "begin" then
    9                         _,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e)
    10                         if not e then
    11                         tolua_error("Unbalanced 'tolua_begin' directive in header file")
    12                         end
    13                 end
    14                 c = c.."\n"
    15                 c = string.gsub(c, "\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[hH][iI][Dd][eE][^\n]*\n", "\n");
    16                 c = string.gsub(c, "#define[^%(\n]*%(.-\n", "\n")
    17                 code = code .. c
    18         _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e)
    19         end
    20         return code
     3    local code = '\n$#include "'..fn..'"\n'
     4    s= "\n" .. s .. "\n" -- add blank lines as sentinels
     5    local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n")
     6    while e do
     7        t = strlower(t)
     8        if t == "begin" then
     9            _,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e)
     10            if not e then
     11            tolua_error("Unbalanced 'tolua_begin' directive in header file")
     12            end
     13        end
     14        c = c.."\n"
     15        c = string.gsub(c, "\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[hH][iI][Dd][eE][^\n]*\n", "\n");
     16        c = string.gsub(c, "#define[^%(\n]*%(.-\n", "\n")
     17        code = code .. c
     18    _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e)
     19    end
     20    return code
    2121end
Note: See TracChangeset for help on using the changeset viewer.