~ubuntu-branches/ubuntu/trusty/sblim-sfcb/trusty-proposed

« back to all changes in this revision

Viewing changes to mofc/mofs.l

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2009-06-08 12:04:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090608120449-byfplk09rqz8rtg6
Tags: 1.3.3-0ubuntu1
* New upstream release.
* debian/rules: Removed rpath hacks, SFCB default build handles that now.
* Removed 1934753-remove-assignment.diff, now upstream.
* Refreshed patch cim-schema-location.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: mofs.l,v 1.6 2007/06/22 10:34:44 sschuetz Exp $
 
2
 * $Id: mofs.l,v 1.8 2009/01/08 16:46:33 buccella Exp $
3
3
 *
4
4
 * (C) Copyright IBM Corp. 2004
5
5
 * 
24
24
# include <ctype.h>
25
25
# include <hash.h>
26
26
 
27
 
 
 
27
#define YY_NO_INPUT
28
28
# if defined SCANDEBUG    /* for debugging */
29
29
#   undef YY_DECL
30
30
    typedef YY_CHAR * TOKENTYPE;
78
78
char * upyytext;
79
79
char * includepath = NULL;
80
80
char * extrainclude = NULL;
 
81
int g_instmig = 0;
81
82
 
82
83
typedef struct file_stack_struct {
83
84
  char                     * file_name;
88
89
#ifndef SCANDEBUG
89
90
  class_chain              * file_cls;
90
91
#endif
 
92
  int                        instmig;
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);
94
96
void pop_file();
95
97
 
96
98
%}
179
181
                             }
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 );
183
185
                             } else {
184
186
                               fprintf(stderr,"include file %s not found\n", 
185
187
                                       incfilename);
203
205
                                 fclose(current_file -> file_handle);
204
206
                              }
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;
222
225
*/
223
226
 
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)
226
229
{
227
230
  FILE * file_handle;
228
231
  int i;
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
 
273
  */
 
274
  if (instmigfile && *instmigfile) {
 
275
    file_handle = try_open_file( instmigfile );
 
276
    if (file_handle) {
 
277
      push_file(file_handle, (char *)instmigfile,1,1);
 
278
    } else {
 
279
      fprintf(stderr,"instance import/migration file %s not found\n", 
 
280
                      instmigfile);
 
281
      return -1;
 
282
    }
 
283
  }
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]);   
268
288
      return -1;
269
289
    }
270
 
    push_file(file_handle,parsefiles[i],1);
 
290
    push_file(file_handle,parsefiles[i],1,0);
271
291
  }
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);
278
298
    } else {
279
299
      fprintf(stderr,"extra file %s not found\n", 
280
300
                      extrainclude);
291
311
  htdelete( current_symtab );
292
312
}
293
313
 
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 )
295
315
{
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) {