Commit 100008ae authored by dcw's avatar dcw

added @@ in EXPORT and GLOBAL sections

parent d990f4d2
......@@ -50,7 +50,10 @@ static FILE *outfile;
#define indent() numtabs++
#define outdent() numtabs--
#define usefile(f) outfile = f, numtabs = 0
#define nl() fputc( '\n', outfile )
#define outchar(c) fputc( c, outfile )
#define usefile(f) outfile = f, numtabs = 0
/*VARARGS*/
......@@ -60,7 +63,7 @@ static void line( fmt, a, b, c, d ) char *fmt; long a, b, c, d;
for( i=numtabs; i; i-- ) fputc( '\t', outfile );
fprintf( outfile, fmt, a, b, c, d );
fputc( '\n', outfile );
nl();
}
......@@ -224,7 +227,7 @@ static void cons_fn_hdr( name, s ) char *name; shapelist s;
{
fprintf( outfile, "%s %s; ", p->type, p->name );
}
fputc( '\n', outfile );
nl();
}
......@@ -449,6 +452,7 @@ void make_declns( exports, globals, d, basename ) declnlist d; char *exports, *g
static void h_declns( basename, exports, d ) char *basename, *exports; declnlist d;
{
char tempname[256];
char *exportptr;
FILE *hfile;
declnlist dl;
......@@ -467,7 +471,25 @@ static void h_declns( basename, exports, d ) char *basename, *exports; declnlist
line( "#define FALSE 0\n" );
line( "#define NEW(t) ((t)malloc(sizeof(struct t)))\n\n" );
line( exports );
if( *exports != '\0' )
{
int i;
line( "/* Contents of EXPORT section */" );
for( exportptr=exports; *exportptr; exportptr++ )
{
if( *exportptr == '@' && exportptr[1] == '@'
&& exportptr[2] == '\n' )
{
exportptr += 2;
break;
}
outchar( *exportptr );
}
nl();
nl();
}
data_decls( d );
......@@ -485,6 +507,14 @@ static void h_declns( basename, exports, d ) char *basename, *exports; declnlist
protos( d, FALSE );
line( "#endif" );
if( *exportptr != '\0' )
{
nl();
line( "/* Remaining contents of EXPORT section */" );
line( exportptr );
nl();
}
fclose( hfile );
}
......@@ -493,6 +523,7 @@ static void c_declns( basename, globals, d ) char *basename, *globals; declnlist
{
char tempname[256];
FILE *cfile;
char *globalptr;
sprintf( tempname, "%s.c", basename );
cfile = fopen( tempname, "w" );
......@@ -507,11 +538,36 @@ static void c_declns( basename, globals, d ) char *basename, *globals; declnlist
line( "#include <malloc.h>" );
line( "#include \"%s.h\"\n\n", basename );
line( globals );
if( *globals != '\0' )
{
line( "/* Contents of GLOBAL section */" );
for( globalptr=globals; *globalptr; globalptr++ )
{
if( *globalptr == '@' && globalptr[1] == '@'
&& globalptr[2] == '\n' )
{
globalptr += 2;
break;
}
outchar( *globalptr );
}
nl();
nl();
}
cons_fns( d );
print_fns( d );
if( *globalptr != '\0' )
{
nl();
nl();
line( "/* Remaining contents of GLOBAL section */" );
line( globalptr );
nl();
}
fclose( cfile );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment