Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 14, 2009, 10:53:45 PM (16 years ago)
Author:
rgrieder
Message:

Merged buildsystem2 to buildsystem3.

Note: Bare merge, just resolved conflicts. To testing, no nothing.

Location:
code/branches/buildsystem3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem3

  • code/branches/buildsystem3/src/tolua/lua/compat.lua

    r2087 r2664  
    3434
    3535function do_ (f, err)
    36   if not f then print(err); return end
    37   local a,b = pcall(f)
    38   if not a then print(b); return nil
    39   else return b or true
    40   end
     36    if not f then print(err); return end
     37    local a,b = pcall(f)
     38    if not a then print(b); return nil
     39    else return b or true
     40    end
    4141end
    4242
     
    141141
    142142function flush (f)
    143   if f then f:flush()
    144   else _OUTPUT:flush()
    145   end
     143    if f then f:flush()
     144    else _OUTPUT:flush()
     145    end
    146146end
    147147
    148148function readfrom (name)
    149   if name == nil then
    150     local f, err, cod = io.close(_INPUT)
    151     _INPUT = io.stdin
    152     return f, err, cod
    153   else
    154     local f, err, cod = io.open(name, "r")
    155     _INPUT = f or _INPUT
    156     return f, err, cod
    157   end
     149    if name == nil then
     150        local f, err, cod = io.close(_INPUT)
     151        _INPUT = io.stdin
     152        return f, err, cod
     153    else
     154        local f, err, cod = io.open(name, "r")
     155        _INPUT = f or _INPUT
     156        return f, err, cod
     157    end
    158158end
    159159
    160160function writeto (name)
    161   if name == nil then
    162     local f, err, cod = io.close(_OUTPUT)
    163     _OUTPUT = io.stdout
    164     return f, err, cod
    165   else
    166     local f, err, cod = io.open(name, "w")
    167     _OUTPUT = f or _OUTPUT
    168     return f, err, cod
    169   end
     161    if name == nil then
     162        local f, err, cod = io.close(_OUTPUT)
     163        _OUTPUT = io.stdout
     164        return f, err, cod
     165    else
     166        local f, err, cod = io.open(name, "w")
     167        _OUTPUT = f or _OUTPUT
     168        return f, err, cod
     169    end
    170170end
    171171
    172172function appendto (name)
    173   local f, err, cod = io.open(name, "a")
    174   _OUTPUT = f or _OUTPUT
    175   return f, err, cod
     173    local f, err, cod = io.open(name, "a")
     174    _OUTPUT = f or _OUTPUT
     175    return f, err, cod
    176176end
    177177
    178178function read (...)
    179   local f = _INPUT
    180   if rawtype(arg[1]) == 'userdata' then
    181     f = tab.remove(arg, 1)
    182   end
    183   return f:read(unpack(arg))
     179    local f = _INPUT
     180    if rawtype(arg[1]) == 'userdata' then
     181        f = tab.remove(arg, 1)
     182    end
     183    return f:read(unpack(arg))
    184184end
    185185
    186186function write (...)
    187   local f = _OUTPUT
    188   if rawtype(arg[1]) == 'userdata' then
    189     f = tab.remove(arg, 1)
    190   end
    191   return f:write(unpack(arg))
     187    local f = _OUTPUT
     188    if rawtype(arg[1]) == 'userdata' then
     189        f = tab.remove(arg, 1)
     190    end
     191    return f:write(unpack(arg))
    192192end
    193193
Note: See TracChangeset for help on using the changeset viewer.