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/verbatim.lua

    r2087 r2509  
    1717--   line = line text
    1818classVerbatim = {
    19  line = '',
    20         cond = nil,    -- condition: where to generate the code (s=suport, r=register)
     19    line = '',
     20    cond = nil,    -- condition: where to generate the code (s=suport, r=register)
    2121}
    2222classVerbatim.__index = classVerbatim
     
    2525-- preamble verbatim
    2626function classVerbatim:preamble ()
    27  if self.cond == '' then
    28   write(self.line)
    29  end
     27    if self.cond == '' then
     28        write(self.line)
     29    end
    3030end
    3131
    3232-- support code
    3333function classVerbatim:supcode ()
    34  if strfind(self.cond,'s') then
    35   write(self.line)
    36   write('\n')
    37  end
     34    if strfind(self.cond,'s') then
     35        write(self.line)
     36        write('\n')
     37    end
    3838end
    3939
    4040-- register code
    4141function classVerbatim:register (pre)
    42  if strfind(self.cond,'r') then
    43   write(self.line)
    44  end
     42    if strfind(self.cond,'r') then
     43        write(self.line)
     44    end
    4545end
    4646
     
    4848-- Print method
    4949function classVerbatim:print (ident,close)
    50  print(ident.."Verbatim{")
    51  print(ident.." line = '"..self.line.."',")
    52  print(ident.."}"..close)
    53 end
     50    print(ident.."Verbatim{")
     51    print(ident.." line = '"..self.line.."',")
     52    print(ident.."}"..close)
     53    end
    5454
    5555
    5656-- Internal constructor
    5757function _Verbatim (t)
    58  setmetatable(t,classVerbatim)
    59  append(t)
    60  return t
     58    setmetatable(t,classVerbatim)
     59    append(t)
     60    return t
    6161end
    6262
     
    6464-- Expects a string representing the text line
    6565function Verbatim (l,cond)
    66  if strsub(l,1,1) == "'" then
    67   l = strsub(l,2)
    68  elseif strsub(l,1,1) == '$' then
    69   cond = 'sr'       -- generates in both suport and register fragments
    70   l = strsub(l,2)
    71  end
    72  return _Verbatim {
    73   line = l,
    74   cond = cond or '',
    75  }
     66    if strsub(l,1,1) == "'" then
     67        l = strsub(l,2)
     68    elseif strsub(l,1,1) == '$' then
     69        cond = 'sr'       -- generates in both suport and register fragments
     70        l = strsub(l,2)
     71    end
     72    return _Verbatim {
     73        line = l,
     74        cond = cond or '',
     75    }
    7676end
    7777
Note: See TracChangeset for help on using the changeset viewer.