/* @(#)open_files.c 2.1 93/05/18 */ /******************************************************************************/ /* function : open_files.c */ /* */ /* subsystem : chgen */ /* */ /* input : */ /* */ /* output : (opens all output files) */ /* */ /* returns : void */ /* */ /* author : Steve Smith / Craig Smith */ /* */ /* created : July, 1991 */ /* */ /* revisions : */ /* 11/30/00 kmiu -NT port: included prototypes.h */ /* 11/30/00 kmiu -Replaced hardcoded filenames with variables */ /* 11/30/00 kmiu -Replaced hardcoded file extension with outfile_ext */ /* */ /* description : This routine simply opens all output files. The open of the */ /* schema text file is not included here (it is opened by the */ /* main). This is done so that output files can be opened */ /* after parsing and validation are complete. Thus, if the */ /* schema doesn't pass validation, no output files are created. */ /* */ /******************************************************************************/ /******************************************************************************/ /* Modified 5/7/96 by Genlog to open pr_log.c if cli_log == TRUE */ /******************************************************************************/ #include #include #include "chgen_define.h" #include "chgen_externs.h" #include "prototypes.h" void open_files() { static char rcsid[] = "$Id: open_files.c,v 1.3.4.1 1999/05/04 17:00:16 jkarner Exp $"; char XXsch_header_file_name[10] ; /* added by ntansala 042800 */ char XXops_file_name[10] ; /* added by ntansala 042800 */ int i ; /* added by ntansala 042800 */ if ((schh_fp=fopen(sch_header_file_name, "w")) == NULL ) { printf("%CHGEN-F-ERROPNOUT, can not create output file %s\n", sch_header_file_name); exit(1); } /* kmiu- replace hardcoded filenames (see chgen_define.h) */ if ((prload_fp=fopen(load_filename, "w")) == NULL ) { printf("%CHGEN-F-ERROPNOUT, can not create output file pr_load.c\n"); exit(1); } if ((prdump_fp=fopen(dump_filename, "w")) == NULL ) { printf("%CHGEN-F-ERROPNOUT, can not create output file pr_dump.c\n"); exit(1); } if ((prfree_fp=fopen(free_filename, "w")) == NULL ) { printf("%CHGEN-F-ERROPNOUT, can not create output file pr_free.c\n"); exit(1); } if ((prdel_fp=fopen(delete_filename, "w")) == NULL ) { printf("%CHGEN-F-ERROPNOUT, can not create output file pr_delete.c\n"); exit(1); } if ((prstats_fp=fopen(stats_filename, "w")) == NULL ) { printf("%CHGEN-F-ERROPNOUT, can not create output file pr_stats.c\n"); exit(1); } if (cli_log == TRUE) { if ((prlog_fp=fopen(log_filename, "w")) == NULL) { printf("%CHGEN-F-ERROPNOUT, can not create output file pr_log.c\n"); exit(1); } } /* add by ntansala 04282000 */ tt_curr = tt; while (tt_curr != NULL) { i = encoding(tt_curr->TTabbr); strcpy(XXsch_header_file_name, tt_curr->TTabbr); strcat(XXsch_header_file_name, "schema"); change_file_exten (XXsch_header_file_name , "h" ); printf ("...%s\n", XXsch_header_file_name) ; if ((XXschh_fp[i]=fopen(XXsch_header_file_name, "w")) == NULL ) { printf("%CHGEN-F-ERROPNOUT, can not create output file %s\n", XXsch_header_file_name); exit(1); } strcpy(XXops_file_name, tt_curr->TTabbr); strcat(XXops_file_name, "ops"); /* kmiu- use mach dep var for file ext */ /* change_file_exten (XXops_file_name , "cc" ); */ change_file_exten (XXops_file_name , outfile_ext ); printf ("...%s\n", XXops_file_name) ; if ((XXops_fp[i]=fopen(XXops_file_name, "w")) == NULL ) { printf("%CHGEN-F-ERROPNOUT, can not create output file %s\n", XXops_file_name); exit(1); } tt_curr = tt_curr->next_ptr; } /* end while tt_cur */ }