1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "templatizer.h"
22 using namespace NLMISC
;
24 extern CTemplatizer Templatizer
;
26 int main(int argc
, char **argv
)
28 new CApplicationContext
;
33 for (arg
=1; (sint
)arg
<argc
; ++arg
)
35 if (strcmp(argv
[arg
], "-hauto") == 0)
39 else if (strcmp(argv
[arg
], "-dbgmsg") == 0)
42 GenerateDebugMessages
= true;
44 else if (strcmp(argv
[arg
], "-onlylogs") == 0)
46 GenerateOnlyLogs
= true;
50 inputfile
= argv
[arg
];
54 if (inputfile
.empty())
56 nlwarning("Error: missing input file(s)");
63 string templateFile = argv[2];
66 if (!f.open(templateFile))
68 nlwarning("Error: failed to open template input file '%s'", templateFile.c_str());
73 uint size = f.getFileSize();
74 char *buffer = new char[size+1];
75 f.serialBuffer((uint8*)buffer, size);
79 if (!Templatizer.build(buffer))
81 nlwarning("Error: failed to parse template input file '%s'", templateFile.c_str());
88 Templatizer.build("root{}");
92 Templatizer
.build("root{}");
94 CParseNode
*main
= parse(inputfile
);
102 //Templatizer.eval();
105 printf("Code generation done");
112 nlwarning("Error: missing input file(s)");
116 if (!Templatizer.build("root{}"))
122 CParseNode *main = parse(argv[1]);