Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 10, 2009, 4:01:42 PM (15 years ago)
Author:
rgrieder
Message:

Tolua update to v1.0.93 is not working properly and I would not know how to fix it. I have created a patch however, just in case we need it after all.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pch/src/tolua/lua/package.lua

    r3129 r3138  
    146146            output('{')
    147147            output(' '..i..'* self = ('..i..'*) tolua_tousertype(tolua_S,1,0);')
    148             output('    Mtolua_delete(self);')
     148            output('    delete self;')
    149149            output('    return 0;')
    150150            output('}')
     
    157157    output('static void tolua_reg_types (lua_State* tolua_S)')
    158158    output('{')
    159 
     159    foreach(_usertype,function(n,v) output(' tolua_usertype(tolua_S,"',v,'");') end)
    160160    if flags.t then
    161161        output("#ifndef Mtolua_typeid\n#define Mtolua_typeid(L,TI,T)\n#endif\n")
    162     end
    163     foreach(_usertype,function(n,v)
    164         if (not _global_classes[v]) or _global_classes[v]:check_public_access() then
    165             output(' tolua_usertype(tolua_S,"',v,'");')
    166             if flags.t then
    167                 output(' Mtolua_typeid(tolua_S,typeid(',v,'), "',v,'");')
    168             end
    169         end
    170     end)
    171  output('}')
     162        foreach(_usertype,function(n,v) output(' Mtolua_typeid(tolua_S,typeid(',v,'), "',v,'");') end)
     163    end
     164    output('}')
    172165    output('\n')
    173166end
     
    256249
    257250    -- open input file, if any
    258     local st,msg
    259251    if fn then
    260252        local file
     
    268260            file = flags.f
    269261        end
    270         st, msg = readfrom(file)
     262        local st, msg = readfrom(file)
    271263        if not st then
    272264            error('#'..msg..' path: '..flags.f)
     
    274266        local _; _, _, ext = strfind(fn,".*%.(.*)$")
    275267    end
    276     local code
    277     if ext == 'pkg' then
    278         code = prep(st)
    279     else
    280         code = "\n" .. read('*a')
    281         if ext == 'h' or ext == 'hpp' then
    282             code = extract_code(fn,code)
    283         end
     268    local code = "\n" .. read('*a')
     269    if ext == 'h' or ext == 'hpp' then
     270        code = extract_code(fn,code)
    284271    end
    285272
     
    313300                    error('#'..msg..': '..fn)
    314301                end
    315                 if kind == 'p' then
    316                     local s = prep(fp)
    317                     closefile(fp)
    318                     return s
    319                 end
    320302                local s = read(fp,'*a')
    321303                closefile(fp)
    322304                if kind == 'c' or kind == 'h' then
    323305                    return extract_code(fn,s)
     306                elseif kind == 'p' then
     307                    return "\n\n" .. s
    324308                elseif kind == 'l' then
    325309                    return "\n$[--##"..fn.."\n" .. s .. "\n$]\n"
     
    353337
    354338
    355 setmetatable(_extra_parameters, { __index = _G })
    356 
    357 function prep(file)
    358 
    359     local chunk = {'local __ret = {"\\n"}\n'}
    360     for line in file:lines() do
    361         if string.find(line, "^##") then
    362             table.insert(chunk, string.sub(line, 3) .. "\n")
    363         else
    364             local last = 1
    365             for text, expr, index in string.gfind(line, "(.-)$(%b())()") do
    366                 last = index
    367                 if text ~= "" then
    368                     table.insert(chunk, string.format('table.insert(__ret, %q )', text))
    369                 end
    370                 table.insert(chunk, string.format('table.insert(__ret, %s )', expr))
    371             end
    372             table.insert(chunk, string.format('table.insert(__ret, %q)\n',
    373                                 string.sub(line, last).."\n"))
    374         end
    375     end
    376     table.insert(chunk, '\nreturn table.concat(__ret)\n')
    377     local f,e = loadstring(table.concat(chunk))
    378     if e then
    379         error("#"..e)
    380     end
    381     setfenv(f, _extra_parameters)
    382     return f()
    383 end
Note: See TracChangeset for help on using the changeset viewer.