Commit de185aee authored by css1dw's avatar css1dw

KANDR and ANSI (default) function syntax generation now

parent fd7b8b6d
......@@ -138,11 +138,15 @@ static void h_declns( base, exports, init, d ) char *base, *exports; BOOL init;
data_decls( d );
line( "\n/* Prototypes for all types */\n" );
#ifdef KANDR
line( "#ifdef HASPROTOS" );
#endif
protos( init, base, d, TRUE );
#ifdef KANDR
line( "#else" );
protos( init, base, d, FALSE );
line( "#endif" );
#endif
if( *exportptr != '\0' )
{
......@@ -479,6 +483,8 @@ static void cons_fn( d, s ) decln d; shapelist s;
fprintf( outfile, "%s %s_%s( ", d->name, d->name, s->name );
first = TRUE;
#ifdef KANDR
for( p=s->params; p != NULL; p=p->next, first=FALSE )
{
if( !first ) fputs( ", ", outfile );
......@@ -489,6 +495,18 @@ static void cons_fn( d, s ) decln d; shapelist s;
{
fprintf( outfile, " %s %s;", p->type, p->name );
}
#else
if( s->params == NULL )
{
fprintf( outfile, "void" );
}
for( p=s->params; p != NULL; p=p->next, first = FALSE )
{
if( !first ) fputs( ", ", outfile );
fprintf( outfile, "%s %s", p->type, p->name );
}
fputs( " )", outfile );
#endif
line( "\n{" );
indent();
......@@ -684,6 +702,7 @@ static void decons_fn( d, s ) decln d; shapelist s;
exit(1);
}
#ifdef KANDR
fprintf( outfile, "void get_%s_%s( this", d->name, s->name );
for( p=s->params; p != NULL; p=p->next )
{
......@@ -694,6 +713,14 @@ static void decons_fn( d, s ) decln d; shapelist s;
{
fprintf( outfile, " %s *%s;", p->type, p->name );
}
#else
fprintf( outfile, "void get_%s_%s( %s this", d->name, s->name, d->name );
for( p=s->params; p != NULL; p=p->next )
{
fprintf( outfile, ", %s *%s", p->type, p->name );
}
fprintf( outfile, " )" );
#endif
line( "\n{" );
indent();
......@@ -731,7 +758,7 @@ static void print_fn_proto( name, prot ) char *name; BOOL prot;
fprintf( outfile, "extern void print_%s(", name );
if( prot )
{
fprintf( outfile, " %s ", name );
fprintf( outfile, " FILE *, %s ", name );
}
fputs( ");\n", outfile );
}
......@@ -743,7 +770,11 @@ static void print_fns( d ) declnlist d;
{
shapelist s;
#ifdef KANDR
line( "void print_%s( f, p ) FILE *f; %s p;",d->name, d->name );
#else
line( "void print_%s( FILE *f, %s p )",d->name, d->name );
#endif
line( "{" );
indent();
s = d->shapes;
......
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