... |
... |
@@ -42,6 +42,7 @@ typedef enum OutputFormat_ |
42
|
42
|
|
43
|
43
|
} OutputFormat;
|
44
|
44
|
|
|
45
|
+#define SUFFIX_VMS_64ADDR "64__"
|
45
|
46
|
|
46
|
47
|
static void
|
47
|
48
|
panic( const char* fmt,
|
... |
... |
@@ -76,11 +77,12 @@ static int max_names; |
76
|
77
|
|
77
|
78
|
|
78
|
79
|
static void
|
79
|
|
-names_add( const char* name,
|
80
|
|
- const char* end )
|
|
80
|
+names_add( const char* name,
|
|
81
|
+ const char* end,
|
|
82
|
+ OutputFormat format )
|
81
|
83
|
{
|
82
|
84
|
unsigned int h;
|
83
|
|
- int nn, len;
|
|
85
|
+ int nn, len, len_suffix;
|
84
|
86
|
Name nm;
|
85
|
87
|
|
86
|
88
|
|
... |
... |
@@ -116,8 +118,18 @@ names_add( const char* name, |
116
|
118
|
}
|
117
|
119
|
nm = &the_names[num_names++];
|
118
|
120
|
|
|
121
|
+ switch ( format )
|
|
122
|
+ {
|
|
123
|
+ case OUTPUT_VMS_OPT:
|
|
124
|
+ /* VMS mode would join the symbol name with a suffix */
|
|
125
|
+ len_suffix = sizeof ( SUFFIX_VMS_64ADDR );
|
|
126
|
+ break;
|
|
127
|
+ default:
|
|
128
|
+ len_suffix = 0;
|
|
129
|
+ }
|
|
130
|
+
|
119
|
131
|
nm->hash = h;
|
120
|
|
- nm->name = (char*)malloc( len + 1 );
|
|
132
|
+ nm->name = (char*)malloc( len + len_suffix + 1 );
|
121
|
133
|
if ( !nm->name )
|
122
|
134
|
panic( "not enough memory" );
|
123
|
135
|
|
... |
... |
@@ -229,7 +241,7 @@ names_dump( FILE* out, |
229
|
241
|
|
230
|
242
|
/* Also emit a 64-bit symbol, as created by the `vms_auto64` tool. */
|
231
|
243
|
/* It has the string '64__' appended to its name. */
|
232
|
|
- strcat( the_names[nn].name , "64__" );
|
|
244
|
+ strcat( the_names[nn].name , SUFFIX_VMS_64ADDR );
|
233
|
245
|
if ( vms_shorten_symbol( the_names[nn].name, short_symbol, 1 ) == -1 )
|
234
|
246
|
panic( "could not shorten name '%s'", the_names[nn].name );
|
235
|
247
|
fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol );
|
... |
... |
@@ -277,8 +289,9 @@ typedef enum State_ |
277
|
289
|
|
278
|
290
|
|
279
|
291
|
static int
|
280
|
|
-read_header_file( FILE* file,
|
281
|
|
- int verbose )
|
|
292
|
+read_header_file( FILE* file,
|
|
293
|
+ int verbose,
|
|
294
|
+ OutputFormat format )
|
282
|
295
|
{
|
283
|
296
|
static char buff[LINEBUFF_SIZE + 1];
|
284
|
297
|
State state = STATE_START;
|
... |
... |
@@ -350,7 +363,7 @@ read_header_file( FILE* file, |
350
|
363
|
if ( verbose )
|
351
|
364
|
fprintf( stderr, ">>> %.*s\n", (int)( p - name ), name );
|
352
|
365
|
|
353
|
|
- names_add( name, p );
|
|
366
|
+ names_add( name, p, format );
|
354
|
367
|
}
|
355
|
368
|
|
356
|
369
|
state = STATE_START;
|
... |
... |
@@ -519,7 +532,7 @@ main( int argc, |
519
|
532
|
} /* end of while loop */
|
520
|
533
|
|
521
|
534
|
if ( from_stdin )
|
522
|
|
- read_header_file( stdin, verbose );
|
|
535
|
+ read_header_file( stdin, verbose, format );
|
523
|
536
|
else
|
524
|
537
|
{
|
525
|
538
|
for ( --argc, argv++; argc > 0; argc--, argv++ )
|
... |
... |
@@ -534,7 +547,7 @@ main( int argc, |
534
|
547
|
if ( verbose )
|
535
|
548
|
fprintf( stderr, "opening '%s'\n", argv[0] );
|
536
|
549
|
|
537
|
|
- read_header_file( file, verbose );
|
|
550
|
+ read_header_file( file, verbose, format );
|
538
|
551
|
fclose( file );
|
539
|
552
|
}
|
540
|
553
|
}
|