1 : //==============================================================================
2 : // File <$/test/cpp/unit/idlc/syn/TestSyn.cpp>
3 : // This file is part of YaOrb : Yet Another Object Request Broker,
4 : // Copyright (c) 2000-2003, Marc Alff.
5 : //
6 : // This program is free software; you can redistribute it and/or
7 : // modify it under the terms of the GNU General Public License
8 : // as published by the Free Software Foundation; either version 2
9 : // of the License, or (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program; if not, write to the Free Software
18 : // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 : //
20 : //==============================================================================
21 :
22 : // Portability
23 : #include "yaorb/config.h"
24 : #include "src/cpp/prod/port/port_stdlib.h"
25 :
26 : #include <stdio.h>
27 : #include <iostream>
28 : #include <new>
29 :
30 : #include "src/cpp/prod/tool/String.h"
31 : #include "src/cpp/dev/idlc/yyutils.h"
32 : #include "src/cpp/dev/idlc/compiler.h"
33 : #include "src/cpp/dev/idlc/sym_tab.h"
34 :
35 0 : void MemHandler(void)
36 : {
37 0 : fprintf(stderr, " MEMORY HANDLER\n") ;
38 0 : IDLCompileError("MEMORY") ;
39 : }
40 :
41 15 : void DumpSymbolTable(SymbolTable *symTab)
42 : {
43 15 : std::cout << "======== Dump of the Symbol Table ===========" << std::endl ;
44 15 : symTab->print(std::cout) ;
45 : }
46 :
47 15 : int main(int argc, char *argv[])
48 : {
49 15 : std::set_new_handler(MemHandler) ;
50 :
51 15 : if (argc != 2)
52 : {
53 0 : fprintf(stderr, "usage : TestSyn <filename>\n");
54 0 : exit(1);
55 : }
56 :
57 15 : String fileName = argv[1] ;
58 15 : int err = 0 ;
59 15 : int warn = 0 ;
60 : SymbolTable *symTab = NULL ;
61 :
62 : StringList includeDirs ;
63 15 : symTab = CompileIDL(fileName, includeDirs, err, warn, false) ;
64 :
65 15 : DumpSymbolTable(symTab) ;
66 :
67 15 : delete symTab ;
68 :
69 0 : return 0 ;
70 15 : }
71 15 :
|