Commit 793c5046 authored by dcw's avatar dcw
Browse files

write -> print throughout! eg. PrintFred -> WriteFred

parent 9595df80
...@@ -32,14 +32,14 @@ static void deconskind_body( decln ); ...@@ -32,14 +32,14 @@ static void deconskind_body( decln );
static void deconskind_inner( decln ); static void deconskind_inner( decln );
static void deconsproc_header( char * , shape ); static void deconsproc_header( char * , shape );
static void deconsproc_body( decln , shape ); static void deconsproc_body( decln , shape );
static void printproc_header( char * ); static void writeproc_header( char * );
static void printproc_body( decln ); static void writeproc_body( decln );
static void print_using_case( char * , char * , shapelist ); static void write_using_case( char * , char * , shapelist );
static void print_param( char * , param ); static void write_param( char * , param );
static void print_all_params( char * , shape ); static void write_all_params( char * , shape );
static void write_bool( void ); static void write_bool( void );
static char * lookup_type( char * ); static char * lookup_type( char * );
static char * lookup_print_proc( char * ); static char * lookup_write_proc( char * );
static int predefined_type( char * ); static int predefined_type( char * );
#else #else
static void line(); static void line();
...@@ -56,14 +56,14 @@ static void deconskind_body(); ...@@ -56,14 +56,14 @@ static void deconskind_body();
static void deconskind_inner(); static void deconskind_inner();
static void deconsproc_header(); static void deconsproc_header();
static void deconsproc_body(); static void deconsproc_body();
static void printproc_header(); static void writeproc_header();
static void printproc_body(); static void writeproc_body();
static void print_using_case(); static void write_using_case();
static void print_param(); static void write_param();
static void print_all_params(); static void write_all_params();
static void write_bool(); static void write_bool();
static char * lookup_type(); static char * lookup_type();
static char * lookup_print_proc(); static char * lookup_write_proc();
static int predefined_type(); static int predefined_type();
#endif #endif
...@@ -216,8 +216,8 @@ static void defn_onetype( d ) decln d; ...@@ -216,8 +216,8 @@ static void defn_onetype( d ) decln d;
nl(); nl();
} }
line( "(* Print function for %s *)", d->name ); line( "(* write function for %s *)", d->name );
printproc_header( d->name ); writeproc_header( d->name );
nl(); nl();
nl(); nl();
} }
...@@ -340,7 +340,7 @@ static void impln_onetype( d ) decln d; ...@@ -340,7 +340,7 @@ static void impln_onetype( d ) decln d;
} }
} }
printproc_body( d ); writeproc_body( d );
} }
...@@ -541,21 +541,21 @@ static void deconsproc_body( d, s ) decln d; shape s; ...@@ -541,21 +541,21 @@ static void deconsproc_body( d, s ) decln d; shape s;
} }
/* --------------------------- Print procedure --------------------------- */ /* --------------------------- Write procedure --------------------------- */
static void printproc_header( name ) char *name; static void writeproc_header( name ) char *name;
{ {
line( "PROCEDURE Print%s( f : File; this : %s );", name, name ); line( "PROCEDURE Write%s( f : File; this : %s );", name, name );
} }
static void printproc_body( d ) decln d; static void writeproc_body( d ) decln d;
{ {
shapelist s; shapelist s;
shapelist shapes; shapelist shapes;
printproc_header( d->name ); writeproc_header( d->name );
nl(); nl();
line( "BEGIN" ); line( "BEGIN" );
indent(); indent();
...@@ -565,7 +565,7 @@ static void printproc_body( d ) decln d; ...@@ -565,7 +565,7 @@ static void printproc_body( d ) decln d;
line( "IF this = NIL" ); line( "IF this = NIL" );
line( "THEN" ); line( "THEN" );
indent(); indent();
print_all_params( d->name, shapes ); write_all_params( d->name, shapes );
line( "RETURN;" ); line( "RETURN;" );
outdent(); outdent();
line( "END; (* IF *)" ); line( "END; (* IF *)" );
...@@ -573,49 +573,49 @@ static void printproc_body( d ) decln d; ...@@ -573,49 +573,49 @@ static void printproc_body( d ) decln d;
} }
if( d->TagField ) if( d->TagField )
{ {
print_using_case( "this^.tag", d->name, shapes ); write_using_case( "this^.tag", d->name, shapes );
} else if( d->Struct ) /* only one shape left */ } else if( d->Struct ) /* only one shape left */
{ {
print_all_params( d->name, shapes ); write_all_params( d->name, shapes );
} else /* enumerated type */ } else /* enumerated type */
{ {
char tag[256]; char tag[256];
sprintf( tag, "VAL(KindOf%s, this)", d->name ); sprintf( tag, "VAL(KindOf%s, this)", d->name );
print_using_case( tag, d->name, shapes ); write_using_case( tag, d->name, shapes );
} }
outdent(); outdent();
line( "END Print%s;", d->name ); line( "END Write%s;", d->name );
nl(); nl();
} }
static void print_using_case( tag, dname, s ) char *tag, *dname; shapelist s; static void write_using_case( tag, dname, s ) char *tag, *dname; shapelist s;
{ {
line( "CASE %s OF", tag ); line( "CASE %s OF", tag );
for( ; s != NULL; s = s->next ) for( ; s != NULL; s = s->next )
{ {
line( "|%sIs%s:", dname, s->name ); line( "|%sIs%s:", dname, s->name );
indent(); indent();
print_all_params( dname, s ); write_all_params( dname, s );
outdent(); outdent();
} }
line( "ELSE" ); line( "ELSE" );
indent(); indent();
line( "Abort( \"Print%s: impossible tag\" );", dname ); line( "Abort( \"Write%s: impossible tag\" );", dname );
outdent(); outdent();
line( "END; (* CASE *)" ); line( "END; (* CASE *)" );
} }
static void print_param( sname, p ) char *sname; param p; static void write_param( sname, p ) char *sname; param p;
{ {
line( "%s( f, this^.%s%s );", line( "%s( f, this^.%s%s );",
lookup_print_proc(p->type), sname, p->name ); lookup_write_proc(p->type), sname, p->name );
} }
static void print_all_params( dname, s ) char *dname; shape s; static void write_all_params( dname, s ) char *dname; shape s;
{ {
printlist pl; printlist pl;
paramlist p; paramlist p;
...@@ -629,7 +629,7 @@ static void print_all_params( dname, s ) char *dname; shape s; ...@@ -629,7 +629,7 @@ static void print_all_params( dname, s ) char *dname; shape s;
line( "WriteChar( f, '(' );" ); line( "WriteChar( f, '(' );" );
for( p = s->params; p != NULL; p = p->next ) for( p = s->params; p != NULL; p = p->next )
{ {
print_param( s->name, p ); write_param( s->name, p );
} }
line( "WriteChar( f, ')' );" ); line( "WriteChar( f, ')' );" );
} }
...@@ -651,7 +651,7 @@ static void print_all_params( dname, s ) char *dname; shape s; ...@@ -651,7 +651,7 @@ static void print_all_params( dname, s ) char *dname; shape s;
ASSERT( p != NULL, ASSERT( p != NULL,
("m2datadec: bad printitem number in shape %s of type %s\n", s->name, dname)); ("m2datadec: bad printitem number in shape %s of type %s\n", s->name, dname));
} }
print_param( s->name, p ); write_param( s->name, p );
} }
} }
} }
...@@ -686,7 +686,7 @@ struct typelookup ...@@ -686,7 +686,7 @@ struct typelookup
{ {
char *name; char *name;
char *type_name; char *type_name;
char *print_name; char *write_name;
}; };
...@@ -723,7 +723,7 @@ static char *lookup_type( typename ) char *typename; ...@@ -723,7 +723,7 @@ static char *lookup_type( typename ) char *typename;
} }
static char *lookup_print_proc( typename ) char *typename; static char *lookup_write_proc( typename ) char *typename;
{ {
int predef; int predef;
static char tmp[256]; static char tmp[256];
...@@ -731,11 +731,11 @@ static char *lookup_print_proc( typename ) char *typename; ...@@ -731,11 +731,11 @@ static char *lookup_print_proc( typename ) char *typename;
predef = predefined_type( typename ); predef = predefined_type( typename );
if( predef == -1 ) if( predef == -1 )
{ {
sprintf( tmp, "Print%s", typename ); sprintf( tmp, "Write%s", typename );
return tmp; return tmp;
} else } else
{ {
return lookup[predef].print_name; return lookup[predef].write_name;
} }
} }
......
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