89
90
class_chain * file_cls;
91
93
} file_stack_entry;
92
94
file_stack_entry *current_file;
93
void push_file(FILE * file_handle, char * filename, int keep_symtab);
95
void push_file(FILE * file_handle, char * filename, int keep_symtab, int instmig);
180
182
file_handle = try_open_file( incfilename );
181
183
if ( file_handle ) {
182
push_file( file_handle, incfilename, 0 );
184
push_file( file_handle, incfilename, 0, 0 );
184
186
fprintf(stderr,"include file %s not found\n",
203
205
fclose(current_file -> file_handle);
205
207
current_file = current_file -> next_file;
208
g_instmig = current_file -> instmig;
206
209
file_name = current_file -> file_name;
207
210
line_number = current_file -> line_number;
208
211
cls_chain_current = current_file -> file_cls;
224
227
int init_scanner(char * parsefiles[], int numfiles, const char * includedir,
225
const char * extrafile, int verbose)
228
const char * extrafile, const char * instmigfile, int verbose)
227
230
FILE * file_handle;
261
264
inst_chain_current = calloc(sizeof(class_chain),1);
262
265
qual_chain_current = calloc(sizeof(qual_chain),1);
263
266
current_file = NULL;
267
/* Must push instanceMigration file prior to other files,
268
so it gets installed last.
269
This will cause any instances that are in both MOF and static
270
(ie previous MOF, then modified), the MOF version will be
271
written first, then the static instance version will be written
272
after, causing an overwrite, so the static instance wins
274
if (instmigfile && *instmigfile) {
275
file_handle = try_open_file( instmigfile );
277
push_file(file_handle, (char *)instmigfile,1,1);
279
fprintf(stderr,"instance import/migration file %s not found\n",
264
284
for (i=numfiles-1; i >=0; i--) {
265
285
file_handle = fopen(parsefiles[i],"r");
266
286
if (file_handle == NULL) {
267
287
fprintf(stderr,"could not open %s\n",parsefiles[i]);
270
push_file(file_handle,parsefiles[i],1);
290
push_file(file_handle,parsefiles[i],1,0);
272
292
includepath = (char*) includedir;
273
293
extrainclude = (char*) extrafile;
274
294
if (extrainclude) {
275
295
file_handle = try_open_file( extrainclude );
276
296
if (file_handle) {
277
push_file(file_handle, extrainclude,0);
297
push_file(file_handle, extrainclude,0,0);
279
299
fprintf(stderr,"extra file %s not found\n",
291
311
htdelete( current_symtab );
294
void push_file( FILE *file_handle, char * filename, int keep_symtab )
314
void push_file( FILE *file_handle, char * filename, int keep_symtab, int instmig )
296
316
file_stack_entry * fse =
297
317
calloc( sizeof(file_stack_entry), 1);
298
318
fse -> file_handle = file_handle;
299
319
fse -> file_name = strdup( filename );
320
fse -> instmig = instmig;
300
321
fse -> yybuffer =
301
322
yy_create_buffer( file_handle, YY_BUF_SIZE );
302
323
if (current_file) {