From aafef187ef856a36c3f8e599afea2dee44f08904 Mon Sep 17 00:00:00 2001 From: faketruth Date: Mon, 3 Oct 2011 19:25:04 +0000 Subject: Source for additional projects -jsoncpp -lua -tolua++ -WebServer -zlib -iniFile git-svn-id: http://mc-server.googlecode.com/svn/trunk@4 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- tolua++-1.0.93/src/bin/lua/verbatim.lua | 78 +++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 tolua++-1.0.93/src/bin/lua/verbatim.lua (limited to 'tolua++-1.0.93/src/bin/lua/verbatim.lua') diff --git a/tolua++-1.0.93/src/bin/lua/verbatim.lua b/tolua++-1.0.93/src/bin/lua/verbatim.lua new file mode 100644 index 000000000..fd3b29b35 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/verbatim.lua @@ -0,0 +1,78 @@ +-- tolua: verbatim class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: verbatim.lua,v 1.3 2000/01/24 20:41:16 celes Exp $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + + +-- Verbatim class +-- Represents a line translated directed to the binding file. +-- The following filds are stored: +-- line = line text +classVerbatim = { + line = '', + cond = nil, -- condition: where to generate the code (s=suport, r=register) +} +classVerbatim.__index = classVerbatim +setmetatable(classVerbatim,classFeature) + +-- preamble verbatim +function classVerbatim:preamble () + if self.cond == '' then + write(self.line) + end +end + +-- support code +function classVerbatim:supcode () + if strfind(self.cond,'s') then + write(self.line) + write('\n') + end +end + +-- register code +function classVerbatim:register (pre) + if strfind(self.cond,'r') then + write(self.line) + end +end + + +-- Print method +function classVerbatim:print (ident,close) + print(ident.."Verbatim{") + print(ident.." line = '"..self.line.."',") + print(ident.."}"..close) +end + + +-- Internal constructor +function _Verbatim (t) + setmetatable(t,classVerbatim) + append(t) + return t +end + +-- Constructor +-- Expects a string representing the text line +function Verbatim (l,cond) + if strsub(l,1,1) == "'" then + l = strsub(l,2) + elseif strsub(l,1,1) == '$' then + cond = 'sr' -- generates in both suport and register fragments + l = strsub(l,2) + end + return _Verbatim { + line = l, + cond = cond or '', + } +end + + -- cgit v1.2.3