Synopsis - Cross-Reference

File: /Synopsis/Parsers/IDL/idlc.cc
 1// -*- c++ -*-
 2//                          Package   : omniidl
 3// idlc.cc                  Created on: 1999/10/20
 4//			    Author    : Duncan Grisby (dpg1)
 5//
 6//    Copyright (C) 1999 AT&T Laboratories Cambridge
 7//
 8//  This file is part of omniidl.
 9//
10//  omniidl is free software; you can redistribute it and/or modify it
11//  under the terms of the GNU General Public License as published by
12//  the Free Software Foundation; either version 2 of the License, or
13//  (at your option) any later version.
14//
15//  This program is distributed in the hope that it will be useful,
16//  but WITHOUT ANY WARRANTY; without even the implied warranty of
17//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18//  General Public License for more details.
19//
20//  You should have received a copy of the GNU General Public License
21//  along with this program; if not, write to the Free Software
22//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23//  02111-1307, USA.
24//
25// Description:
26//   
27//   Simple main() function to test front-end
28
29// $Id: idlc.cc,v 1.6.2.1 2003/03/23 21:01:47 dgrisby Exp $
30// $Log: idlc.cc,v $
31// Revision 1.6.2.1  2003/03/23 21:01:47  dgrisby
32// Start of omniORB 4.1.x development branch.
33//
34// Revision 1.3.2.2  2000/10/27 16:31:08  dpg1
35// Clean up of omniidl dependencies and types, from omni3_develop.
36//
37// Revision 1.3.2.1  2000/07/17 10:36:02  sll
38// Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0.
39//
40// Revision 1.4  2000/07/13 15:25:53  dpg1
41// Merge from omni3_develop for 3.0 release.
42//
43// Revision 1.1  1999/10/27 14:05:59  dpg1
44// *** empty log message ***
45//
46
47#include <stdlib.h>
48#include <stdio.h>
49#include <iostream.h>
50
51#include <idlerr.h>
52#include <idlutil.h>
53#include <idlrepoId.h>
54#include <idlast.h>
55#include <idlscope.h>
56#include <idldump.h>
57
58extern int yydebug;
59
60int main(int argc, char** argv)
61{
62  if (argc != 1 && argc != 2) {
63    cerr << "Usage: " << argv[0] << " [idl file]" << endl;
64    exit(2);
65  }
66
67  //  yydebug = 1;
68
69  FILE*       f;
70  const char* name;
71
72  if (argc == 2) {
73    name = argv[1];
74
75    if (!((f = fopen(name, "r")))) {
76      cerr << "Can't open " << name << endl;
77      exit(2);
78    }
79  }
80  else {
81    name = "<stdin>";
82    f    = stdin;
83  }
84
85  IDL_Boolean success = AST::process(f, name);
86
87  fclose(f);
88
89  if (!success) exit(1);
90
91  DumpVisitor v;
92  AST::tree()->accept(v);
93
94  cout << "Done." << endl;
95
96  return 0;
97}