Commit 63bf8e68 authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl

remove function FPrintF, use fprintf in backend

parent b9e8205f
......@@ -847,8 +847,11 @@ static void CodeRule (ImpRuleP rule)
if (OptimizeTailCallModuloCons && rule->rule_alts->alt_kind==Contractum && (rule->rule_mark & RULE_TAIL_MODULO_CONS_ENTRY_MASK)){
tail_call_modulo_cons=1;
if (ListOptimizations)
printf ("Optimize tail call modulo cons of %s\n",rule_sdef->sdef_name);
if (ListOptimizations){
PutSStdError ("Optimize tail call modulo cons of ");
PutSStdError (rule_sdef->sdef_name);
PutCStdError ('\n');
}
call_code_generator_again=1;
} else
tail_call_modulo_cons=0;
......
......@@ -250,7 +250,7 @@ void int_to_string (char *s,long i)
void PutIStdError (long i)
{
FPrintF (StdError,"%ld",i);
fprintf (StdError,"%ld",i);
}
/* The environment to leave the compiler if a fatal error occurs */
......
......@@ -52,10 +52,10 @@ void PrintState (StateS state, File file)
int i,arity;
arity=state.state_arity;
FPrintF (file,"t%d",arity);
fprintf (file,"t%d",arity);
for (i=0; i<arity; ++i){
FPrintF (file," ");
fprintf (file," ");
PrintState (state.state_tuple_arguments[i],file);
}
......@@ -77,31 +77,31 @@ void DPrintNodeId (NodeId nid, File file)
{
if (nid){
if (nid->nid_name){
FPrintF (file, "%s",nid->nid_name);
fprintf (file, "%s",nid->nid_name);
#ifdef PRINT_ALL_NODE_ID_ADDRESSES
FPrintF (file, "@i_%lx", (long) nid);
fprintf (file, "@i_%lx", (long) nid);
#endif
} else
FPrintF (file, "i_%lx", (long) nid);
fprintf (file, "i_%lx", (long) nid);
#ifdef PRINT_NODE_ID_REF_COUNT
FPrintF (file, "<%d>", nid->nid_refcount);
fprintf (file, "<%d>", nid->nid_refcount);
#endif
} else
FPrintF (file," 00000000");
fprintf (file," 00000000");
}
void DPrintNodeIdS (char *s,NodeId node_id,File file)
{
FPrintF (file,"%s",s);
fprintf (file,"%s",s);
DPrintNodeId (node_id,file);
FPrintF (file,"\n");
fprintf (file,"\n");
}
static void DPrintTypeVar (TypeVar tv, Node follow, File file)
{
if (tv){
FPrintF (file, "i_%lx", (long) tv);
fprintf (file, "i_%lx", (long) tv);
if (follow)
FPutS (" = ", file);
}
......@@ -113,7 +113,7 @@ static void PrintArgument (Args arg,Bool brackets,int n_leading_spaces,File file
PrintState (arg->arg_state, file);
if ((arg->arg_state.state_mark & STATE_UNIQUE_MASK)!=0)
FPrintF (file,"*");
fprintf (file,"*");
*/
if (arg->arg_node->node_kind==NodeIdNode)
......@@ -161,7 +161,7 @@ static void print_compiler_generated_function_name (char *name, char *name_end,
}
if (line_nr>0){
FPrintF (file,"[line: %u]", line_nr);
fprintf (file,"[line: %u]", line_nr);
if (parsed_digits)
name_end=parsed_digits;
} else
......@@ -208,7 +208,7 @@ static void PrintSymbolOfIdent (char *name, unsigned line_nr, File file)
for (end_name = name_end + 2; *end_name!=';' && *end_name!='\0'; end_name++)
;
FPrintF (file, " [line: %u]", line_nr);
fprintf (file, " [line: %u]", line_nr);
if (*end_name == '\0')
return;
......@@ -396,12 +396,12 @@ void PrintRuleNode (Node node,Bool brackets,int n_leading_spaces,File file)
node_id=node->node_node_id;
if (node_id->nid_name){
FPrintF (file, " %s<%d>",node_id->nid_name,node_id->nid_refcount);
fprintf (file, " %s<%d>",node_id->nid_name,node_id->nid_refcount);
#ifdef PRINT_ALL_NODE_ID_ADDRESSES
FPrintF (file, " i_%lx",(long) node_id);
fprintf (file, " i_%lx",(long) node_id);
#endif
} else
FPrintF (file, " i_%lx<%d>",(long) node_id,node_id->nid_refcount);
fprintf (file, " i_%lx<%d>",(long) node_id,node_id->nid_refcount);
break;
}
case UpdateNode:
......@@ -573,7 +573,7 @@ void PrintRuleNode (Node node,Bool brackets,int n_leading_spaces,File file)
break;
default:
FPutC ('?',file);
FPrintF (file,"%d",(int)node->node_kind);
fprintf (file,"%d",(int)node->node_kind);
}
}
......@@ -581,7 +581,7 @@ void PrintNodeDef (NodeDefP def_p,int n_leading_spaces,File file)
{
int n;
/* FPrintF (file, "%d: ", (int) def_p->def_number); */
/* fprintf (file, "%d: ", (int) def_p->def_number); */
for (n=n_leading_spaces; n>0; --n)
FPutC (' ',file);
......@@ -693,11 +693,11 @@ void PrintTypeNode (TypeNode node, File file)
FPutC (':', file);
}
else
FPrintF (file, "%u:", node_attr);
fprintf (file, "%u:", node_attr);
}
if (node->type_node_is_var)
FPrintF (file, "%d:", node->type_node_tv_argument_n);
fprintf (file, "%d:", node->type_node_tv_argument_n);
else if (node->type_node_symbol->symb_kind == tuple_type)
{ FPutC ('(', file);
PrintTypeArguments (node->type_node_arguments, ',', file);
......@@ -745,7 +745,7 @@ static void PrintAttribute (AttributeKind attr, File file)
else if (attr == UniqueAttr)
FPutC ('*', file);
else
FPrintF (file, "%d", attr - UniqueAttr, file);
fprintf (file, "%d", attr - UniqueAttr, file);
}
......
......@@ -30,7 +30,7 @@ File OutFile;
void PutIOutFile (long i)
{
FPrintF (OutFile,"%ld",i);
fprintf (OutFile,"%ld",i);
}
static void error_in_function (char *m)
......@@ -797,7 +797,7 @@ static void write_compiler_generated_function_name_to_out_file (char *name, char
{
char *parsed_digits;
FPutS (name,OutFile);
PutSOutFile (name);
parsed_digits=NULL;
if (name_end[0]==';' && isdigit (name_end[1])){
......@@ -870,7 +870,7 @@ static void WriteSymbolOfIdentToOutFile (char *name, unsigned line_nr)
name = end_name;
}
FPutS (name, OutFile);
PutSOutFile (name);
}
void WriteSymbolToOutFile (Symbol symbol)
......
......@@ -1581,8 +1581,11 @@ static void DecrRefCountCopiesOfArg (Args arg IF_OPTIMIZE_LAZY_TUPLE_RECURSION(i
if (roots_are_tuples_or_calls_to_this_function (rule_alt_p->alt_rhs_root,rule_alt_p->alt_rhs_defs,function_sdef_p)){
node_id->nid_node_def->def_id->nid_mark2 |= NID_CALL_VIA_LAZY_SELECTIONS_ONLY;
node_id_def_node->node_symbol->symb_def->sdef_rule->rule_mark |= RULE_CALL_VIA_LAZY_SELECTIONS_ONLY;
if (ListOptimizations)
printf ("Optimize lazy tuple recursion of %s\n",node_id_def_node->node_symbol->symb_def->sdef_name);
if (ListOptimizations){
PutSStdError ("Optimize lazy tuple recursion of ");
PutSStdError (node_id_def_node->node_symbol->symb_def->sdef_name);
PutCStdError ('\n');
}
}
}
}
......
......@@ -35,11 +35,6 @@ extern int FDelete (char *fname);
extern int FClose (File f);
extern int FPutS (char *s, File f);
#ifdef _VARARGS_
extern int FPrintF (File f, char *fmt,...);
#else
extern int FPrintF (); /* (File w, char *fmt,...) */
#endif
extern void DoFatalError (char *s);
extern void CmdError (char *errormsg1,char *errormsg2);
......
......@@ -26,7 +26,6 @@ typedef unsigned Bool;
#define FileNameMax 256
#ifdef _WINDOWS_
# include <stdarg.h>
# ifdef _WIN64
# undef _WINDOWS_
# include <windows.h>
......
......@@ -37,19 +37,6 @@ int FPutC (int c, File f)
}
#endif
int FPrintF (File f, char *fmt, ...)
{
int n;
va_list args;
va_start (args, fmt);
n = vfprintf ((FILE*)f, fmt, args);
va_end (args);
return n;
}
int FPutS (char *s, File f)
{
return fputs (s, (FILE *) f);
......
......@@ -35,18 +35,6 @@ int FDelete (char *fname)
return remove (fname);
}
int FPrintF (File f, char *fmt, ...)
{ int n;
va_list args;
va_start (args, fmt);
n = vfprintf ((FILE*)f, fmt, args);
va_end (args);
return n;
}
int FPutS (char *s, File f)
{
return fputs (s, (FILE *) f);
......
......@@ -20,7 +20,6 @@ extern int MACVAR;
#endif
#include <setjmp.h>
#include <stdarg.h>
typedef FILE *File;
......
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