/* * Copyright (c) 1995, 1996, 1997, 1999 The University of Utah and * the Computer Systems Laboratory at the University of Utah (CSL). * * This file is part of Flick, the Flexible IDL Compiler Kit. * * Flick is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Flick is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Flick; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place #330, Boston, MA 02111, USA. */ #include #include #include #include #include #include #include #include #include #include #include "lexxer.h" #include "xlate_util.h" #include "global.h" #include "type.h" #include "error.h" char *progname; static char *cpp_args = NULL; static int cpp_args_size = 0; static int cpp_args_length = 0; extern void translate(); /* Translation of types, routines */ extern int yyparse(); void gen_error_mappings( pres_c_1 * ); extern int yydebug; extern FILE *yyin; extern char *ihead_name; int make_ihead; char *infilename; FILE *fin; FILE *fout; pres_c_1 out_pres_c; int gen_client = 1; int gen_server = 1; extern void make_iheader(void); static FILE *f_open(const char *file_name, const char *mode) { FILE *ret; if ( (ret = fopen(file_name,mode)) ) return ret; else perror(file_name); return NULL; } static void add_to_cpp_args(char *arg); /* * Open input file, run thorugh C preprocessor */ static void open_input(char *infile) { infilename = (infile == NULL) ? "" : infile; yyin = call_c_preprocessor(infile, cpp_args); if (!yyin) panic("Can't open file `%s' for reading.", infilename); } /* * Print the standard usage to stderr */ static void print_usage(void) { fprintf(stderr,"Flick MIG IDL front end usage:\n"); fprintf(stderr,"\tflick_fe_mig [] []\n"); fprintf(stderr,"If is unspecified, defaults to stdin.\n"); fprintf(stderr,"Options:\n"); fprintf(stderr,"\t -?, -h, --help: Print this message.\n"); fprintf(stderr,"\t -v, -V, --version: Print program version number.\n"); fprintf(stderr,"\t -c, --client: Generate client presentation only.\n"); fprintf(stderr,"\t\t (Default is both)\n"); fprintf(stderr,"\t -s, --server: Generate server presentation only.\n"); fprintf(stderr,"\t\t (Default is both)\n"); fprintf(stderr,"\t -o, -o , --output : Output to .\n"); fprintf(stderr,"\t\t Defaults to .prc, stdout if unspecified.\n"); fprintf(stderr,"\t-I: Specify include directories for cpp.\n"); fprintf(stderr,"\t-D[=]: Define to be (Defaults to 1)\n"); fprintf(stderr,"\t-U: Undefine symbol.\n"); fprintf(stderr,"\t-Xcpp