Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/src/tolua/lua/namespace.lua @ 2641

Last change on this file since 2641 was 2509, checked in by rgrieder, 16 years ago

Merged revisions 1875-2278 of the buildsystem branch to buildsystem2.

  • Property svn:eol-style set to native
File size: 1.2 KB
RevLine 
[1650]1-- tolua: namespace class
2-- Written by Waldemar Celes
3-- TeCGraf/PUC-Rio
4-- Jul 2003
5-- $Id: $
6
7-- This code is free software; you can redistribute it and/or modify it.
8-- The software provided hereunder is on an "as is" basis, and
9-- the author has no obligation to provide maintenance, support, updates,
10-- enhancements, or modifications.
11
12
13-- Namespace class
14-- Represents a namesapce definition.
15-- Stores the following fields:
16--    name = class name
17--    {i}  = list of members
18classNamespace = {
[2509]19    classtype = 'namespace',
20    name = '',
[1650]21}
22classNamespace.__index = classNamespace
23setmetatable(classNamespace,classModule)
24
25-- Print method
26function classNamespace:print (ident,close)
[2509]27    print(ident.."Namespace{")
28    print(ident.." name = '"..self.name.."',")
29    local i=1
30    while self[i] do
31        self[i]:print(ident.." ",",")
32        i = i+1
33    end
34    print(ident.."}"..close)
[1650]35end
36
37-- Internal constructor
38function _Namespace (t)
[2509]39    setmetatable(t,classNamespace)
40    append(t)
41    return t
[1650]42end
43
44-- Constructor
45-- Expects the name and the body of the namespace.
46function Namespace (n,b)
[2509]47    local c = _Namespace(_Container{name=n})
48    push(c)
49    c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
50    pop()
[1650]51end
52
Note: See TracBrowser for help on using the repository browser.