Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 28, 2009, 7:46:37 PM (15 years ago)
Author:
rgrieder
Message:

Merged buildsystem3 containing buildsystem2 containing Adi's buildsystem branch back to the trunk.
Please update the media directory if you were not using buildsystem3 before.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/tolua/lua/typedef.lua

    r2087 r2710  
    2121--   mod = modifiers to the 'de facto' type
    2222classTypedef = {
    23  utype = '',
    24  mod = '',
    25  type = ''
     23    utype = '',
     24    mod = '',
     25    type = ''
    2626}
    2727classTypedef.__index = classTypedef
     
    2929-- Print method
    3030function classTypedef:print (ident,close)
    31  print(ident.."Typedef{")
    32  print(ident.." utype = '"..self.utype.."',")
    33  print(ident.." mod = '"..self.mod.."',")
    34  print(ident.." type = '"..self.type.."',")
    35  print(ident.."}"..close)
     31    print(ident.."Typedef{")
     32    print(ident.." utype = '"..self.utype.."',")
     33    print(ident.." mod = '"..self.mod.."',")
     34    print(ident.." type = '"..self.type.."',")
     35    print(ident.."}"..close)
    3636end
    3737
    3838-- Return it's not a variable
    3939function classTypedef:isvariable ()
    40  return false
     40    return false
    4141end
    4242
    4343-- Internal constructor
    4444function _Typedef (t)
    45  setmetatable(t,classTypedef)
    46  t.type = resolve_template_types(t.type)
    47  appendtypedef(t)
    48  return t
     45    setmetatable(t,classTypedef)
     46    t.type = resolve_template_types(t.type)
     47    appendtypedef(t)
     48    return t
    4949end
    5050
     
    5252-- Expects one string representing the type definition.
    5353function Typedef (s)
    54  if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then
    55   tolua_error("#invalid typedef: pointers (and references) are not supported")
    56  end
    57  local o = {mod = ''}
    58  if string.find(s, "[<>]") then
    59         _,_,o.type,o.utype = string.find(s, "^%s*([^<>]+%b<>[^%s]*)%s+(.-)$")
    60  else
    61         local t = split(gsub(s,"%s%s*"," ")," ")
    62         o = {
    63           utype = t[t.n],
    64           type = t[t.n-1],
    65           mod = concat(t,1,t.n-2),
    66         }
    67  end
    68  return _Typedef(o)
     54    if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then
     55        tolua_error("#invalid typedef: pointers (and references) are not supported")
     56    end
     57    local o = {mod = ''}
     58    if string.find(s, "[<>]") then
     59        _,_,o.type,o.utype = string.find(s, "^%s*([^<>]+%b<>[^%s]*)%s+(.-)$")
     60    else
     61        local t = split(gsub(s,"%s%s*"," ")," ")
     62        o = {
     63            utype = t[t.n],
     64            type = t[t.n-1],
     65            mod = concat(t,1,t.n-2),
     66        }
     67    end
     68    return _Typedef(o)
    6969end
    7070
Note: See TracChangeset for help on using the changeset viewer.