Commit 2583be7c authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl

use PutCOutFile macro instead of FPutc (..,OutFile) in backend

parent db92f120
...@@ -118,7 +118,7 @@ Bool OpenABCFile (char *fname) ...@@ -118,7 +118,7 @@ Bool OpenABCFile (char *fname)
void WriteLastNewlineToABCFile (void) void WriteLastNewlineToABCFile (void)
{ {
FPutC ('\n',OutFile); PutCOutFile ('\n');
} }
void CloseABCFile (char *fname) void CloseABCFile (char *fname)
...@@ -275,11 +275,11 @@ static void TreatWaitListAfterFill (int offset, FillKind fkind) ...@@ -275,11 +275,11 @@ static void TreatWaitListAfterFill (int offset, FillKind fkind)
static void put_n (long n) static void put_n (long n)
{ {
while (!(n>=-64 && n<=63)){ while (!(n>=-64 && n<=63)){
FPutC (128+(n & 127),OutFile); PutCOutFile (128+(n & 127));
n=n>>7; n=n>>7;
} }
FPutC (n+64,OutFile); PutCOutFile (n+64);
} }
static long integer_string_to_integer (char *s_p) static long integer_string_to_integer (char *s_p)
...@@ -395,7 +395,7 @@ static void put_arguments__n_b (long n1) ...@@ -395,7 +395,7 @@ static void put_arguments__n_b (long n1)
if (DoDebug) if (DoDebug)
FPrintF (OutFile," %d",(n1)); FPrintF (OutFile," %d",(n1));
else { else {
FPutC (' ',OutFile); PutCOutFile (' ',OutFile);
put_n (n1); put_n (n1);
} }
} }
...@@ -405,7 +405,7 @@ static void put_arguments__n__b (long n1) ...@@ -405,7 +405,7 @@ static void put_arguments__n__b (long n1)
if (DoDebug) if (DoDebug)
FPrintF (OutFile," %d ",(n1)); FPrintF (OutFile," %d ",(n1));
else { else {
FPutC (' ',OutFile); PutCOutFile (' ',OutFile);
put_n (n1); put_n (n1);
} }
} }
...@@ -425,7 +425,7 @@ static void put_arguments__nn_b (long n1,long n2) ...@@ -425,7 +425,7 @@ static void put_arguments__nn_b (long n1,long n2)
if (DoDebug) if (DoDebug)
FPrintF (OutFile," %d %d",(n1),(n2)); FPrintF (OutFile," %d %d",(n1),(n2));
else { else {
FPutC (' ',OutFile); PutCOutFile (' ',OutFile);
put_n (n1); put_n (n1);
put_n (n2); put_n (n2);
} }
...@@ -650,22 +650,22 @@ enum { ...@@ -650,22 +650,22 @@ enum {
static void put_instruction (char *instruction) static void put_instruction (char *instruction)
{ {
FPutC ('\n',OutFile); PutCOutFile ('\n');
FPutC ('\t',OutFile); PutCOutFile ('\t');
FPutS (instruction,OutFile); FPutS (instruction,OutFile);
} }
static void put_instruction_ (char *instruction) static void put_instruction_ (char *instruction)
{ {
FPutC ('\n',OutFile); PutCOutFile ('\n');
FPutC ('\t',OutFile); PutCOutFile ('\t');
FPutS (instruction,OutFile); FPutS (instruction,OutFile);
FPutC (' ',OutFile); PutCOutFile (' ');
} }
static void put_instruction_code (int instruction_code) static void put_instruction_code (int instruction_code)
{ {
FPutC (instruction_code,OutFile); PutCOutFile (instruction_code);
} }
#define Da "a" #define Da "a"
...@@ -704,24 +704,24 @@ static void put_instruction_code (int instruction_code) ...@@ -704,24 +704,24 @@ static void put_instruction_code (int instruction_code)
static void put_directive (char *directive) static void put_directive (char *directive)
{ {
FPutC ('\n',OutFile); PutCOutFile ('\n');
FPutC ('.',OutFile); PutCOutFile ('.');
FPutS (directive,OutFile); FPutS (directive,OutFile);
} }
static void put_directive_ (char *directive) static void put_directive_ (char *directive)
{ {
FPutC ('\n',OutFile); PutCOutFile ('\n');
FPutC ('.',OutFile); PutCOutFile ('.');
FPutS (directive,OutFile); FPutS (directive,OutFile);
FPutC (' ',OutFile); PutCOutFile (' ');
} }
static void put_first_directive_ (char *directive) static void put_first_directive_ (char *directive)
{ {
FPutC ('.',OutFile); PutCOutFile ('.');
FPutS (directive,OutFile); FPutS (directive,OutFile);
FPutC (' ',OutFile); PutCOutFile (' ');
} }
void BuildBasicFromB (ObjectKind kind,int b_offset) void BuildBasicFromB (ObjectKind kind,int b_offset)
...@@ -1039,7 +1039,7 @@ static void GenBStackElems (StateS state) ...@@ -1039,7 +1039,7 @@ static void GenBStackElems (StateS state)
{ {
if (IsSimpleState (state)){ if (IsSimpleState (state)){
if (state.state_kind == OnB) if (state.state_kind == OnB)
FPutC (BElems [(int) state.state_object], OutFile); PutCOutFile (BElems [(int) state.state_object]);
} else { } else {
int arity; int arity;
States argstates; States argstates;
...@@ -1066,9 +1066,9 @@ static void GenABStackElems (StateS state) ...@@ -1066,9 +1066,9 @@ static void GenABStackElems (StateS state)
{ {
if (IsSimpleState (state)){ if (IsSimpleState (state)){
if (state.state_kind == OnB) if (state.state_kind == OnB)
FPutC (BElems [(int) state.state_object], OutFile); PutCOutFile (BElems [(int) state.state_object]);
else else
FPutC ('a', OutFile); PutCOutFile ('a');
} else { } else {
int arity; int arity;
States argstates; States argstates;
...@@ -1076,25 +1076,25 @@ static void GenABStackElems (StateS state) ...@@ -1076,25 +1076,25 @@ static void GenABStackElems (StateS state)
switch (state.state_type){ switch (state.state_type){
case TupleState: case TupleState:
argstates = state.state_tuple_arguments; argstates = state.state_tuple_arguments;
FPutC ('(', OutFile); PutCOutFile ('(');
if (state.state_arity>0){ if (state.state_arity>0){
GenABStackElems (argstates[0]); GenABStackElems (argstates[0]);
for (arity=1; arity < state.state_arity; arity++){ for (arity=1; arity < state.state_arity; arity++){
FPutC (',', OutFile); PutCOutFile (',');
GenABStackElems (argstates[arity]); GenABStackElems (argstates[arity]);
} }
} }
FPutC (')', OutFile); PutCOutFile (')');
break; break;
case RecordState: case RecordState:
argstates = state.state_record_arguments; argstates = state.state_record_arguments;
FPutC ('(', OutFile); PutCOutFile ('(');
for (arity=0; arity < state.state_arity; arity++) for (arity=0; arity < state.state_arity; arity++)
GenABStackElems (argstates[arity]); GenABStackElems (argstates[arity]);
FPutC (')', OutFile); PutCOutFile (')');
return; return;
case ArrayState: case ArrayState:
FPutC ('a', OutFile); PutCOutFile ('a');
return; return;
default: default:
error_in_function ("GenABStackElems"); error_in_function ("GenABStackElems");
...@@ -1107,9 +1107,9 @@ static void GenABStackElemsForRecordDesc (StateS state) ...@@ -1107,9 +1107,9 @@ static void GenABStackElemsForRecordDesc (StateS state)
{ {
if (IsSimpleState (state)){ if (IsSimpleState (state)){
if (state.state_kind == OnB) if (state.state_kind == OnB)
FPutC (BElems [(int) state.state_object], OutFile); PutCOutFile (BElems [(int) state.state_object]);
else else
FPutC ('a', OutFile); PutCOutFile ('a');
} else { } else {
int arity; int arity;
States argstates; States argstates;
...@@ -1117,25 +1117,25 @@ static void GenABStackElemsForRecordDesc (StateS state) ...@@ -1117,25 +1117,25 @@ static void GenABStackElemsForRecordDesc (StateS state)
switch (state.state_type){ switch (state.state_type){
case TupleState: case TupleState:
argstates = state.state_tuple_arguments; argstates = state.state_tuple_arguments;
FPutC ('(', OutFile); PutCOutFile ('(');
if (state.state_arity>0){ if (state.state_arity>0){
GenABStackElemsForRecordDesc (argstates[0]); GenABStackElemsForRecordDesc (argstates[0]);
for (arity=1; arity < state.state_arity; ++arity){ for (arity=1; arity < state.state_arity; ++arity){
FPutC (',', OutFile); PutCOutFile (',');
GenABStackElemsForRecordDesc (argstates[arity]); GenABStackElemsForRecordDesc (argstates[arity]);
} }
} }
FPutC (')', OutFile); PutCOutFile (')');
return; return;
case RecordState: case RecordState:
argstates = state.state_record_arguments; argstates = state.state_record_arguments;
FPutC ('{', OutFile); PutCOutFile ('{');
for (arity=0; arity < state.state_arity; ++arity) for (arity=0; arity < state.state_arity; ++arity)
GenABStackElemsForRecordDesc (argstates[arity]); GenABStackElemsForRecordDesc (argstates[arity]);
FPutC ('}', OutFile); PutCOutFile ('}');
return; return;
case ArrayState: case ArrayState:
FPutC ('a', OutFile); PutCOutFile ('a');
return; return;
default: default:
error_in_function ("GenABStackElemsForRecordDesc"); error_in_function ("GenABStackElemsForRecordDesc");
...@@ -1297,12 +1297,12 @@ static void GenABCInstructions (Instructions ilist) ...@@ -1297,12 +1297,12 @@ static void GenABCInstructions (Instructions ilist)
instruction_name=ilist->instr_this; instruction_name=ilist->instr_this;
FPutC ('\n',OutFile); PutCOutFile ('\n');
if (instruction_name[0]==':') if (instruction_name[0]==':')
FPutS (&instruction_name[1],OutFile); FPutS (&instruction_name[1],OutFile);
else { else {
if (instruction_name[0]!='.') if (instruction_name[0]!='.')
FPutC ('\t',OutFile); PutCOutFile ('\t');
FPutS (instruction_name,OutFile); FPutS (instruction_name,OutFile);
} }
} }
...@@ -2254,14 +2254,14 @@ void GenDumpString (char *str) ...@@ -2254,14 +2254,14 @@ void GenDumpString (char *str)
void GenLabelDefinition (Label lab) void GenLabelDefinition (Label lab)
{ {
if (lab){ if (lab){
FPutC ('\n', OutFile); PutCOutFile ('\n');
GenLabel (lab); GenLabel (lab);
} }
} }
void GenNodeEntryLabelDefinition (Label lab) void GenNodeEntryLabelDefinition (Label lab)
{ {
FPutC ('\n', OutFile); PutCOutFile ('\n');
GenDescriptorOrNodeEntryLabel (lab); GenDescriptorOrNodeEntryLabel (lab);
} }
...@@ -2631,7 +2631,7 @@ void GenNodeEntryDirective (int arity,Label label,Label label2) ...@@ -2631,7 +2631,7 @@ void GenNodeEntryDirective (int arity,Label label,Label label2)
FPutS (empty_lab.lab_name, OutFile); FPutS (empty_lab.lab_name, OutFile);
if (label2){ if (label2){
FPutC (' ', OutFile); PutCOutFile (' ');
GenLabel (label2); GenLabel (label2);
} }
#ifdef MEMORY_PROFILING_WITH_N_STRING #ifdef MEMORY_PROFILING_WITH_N_STRING
...@@ -2658,7 +2658,7 @@ void GenApplyInstanceEntryDirective (int arity,Label label,Label label2) ...@@ -2658,7 +2658,7 @@ void GenApplyInstanceEntryDirective (int arity,Label label,Label label2)
FPutS (empty_lab.lab_name, OutFile); FPutS (empty_lab.lab_name, OutFile);
else else
GenLabel (label); GenLabel (label);
FPutC (' ', OutFile); PutCOutFile (' ');
GenLabel (label2); GenLabel (label2);
} }
...@@ -2674,7 +2674,7 @@ void GenLazyRecordNodeEntryDirective (int arity,Label label,Label label2) ...@@ -2674,7 +2674,7 @@ void GenLazyRecordNodeEntryDirective (int arity,Label label,Label label2)
FPutS (empty_lab.lab_name, OutFile); FPutS (empty_lab.lab_name, OutFile);
if (label2){ if (label2){
FPutC (' ', OutFile); PutCOutFile (' ');
GenLabel (label2); GenLabel (label2);
} }
...@@ -2696,7 +2696,7 @@ void GenNodeEntryDirectiveForLabelWithoutSymbol (int arity,Label label,Label lab ...@@ -2696,7 +2696,7 @@ void GenNodeEntryDirectiveForLabelWithoutSymbol (int arity,Label label,Label lab
GenLabel (label); GenLabel (label);
if (label2){ if (label2){
FPutC (' ', OutFile); PutCOutFile (' ');
GenLabel (label2); GenLabel (label2);
} }
...@@ -2721,7 +2721,7 @@ void GenNodeEntryDirectiveUnboxed (int a_size,int b_size,Label label,Label label ...@@ -2721,7 +2721,7 @@ void GenNodeEntryDirectiveUnboxed (int a_size,int b_size,Label label,Label label
FPutS (empty_lab.lab_name, OutFile); FPutS (empty_lab.lab_name, OutFile);
if (label2){ if (label2){
FPutC (' ', OutFile); PutCOutFile (' ');
GenLabel (label2); GenLabel (label2);
} }
...@@ -2746,7 +2746,7 @@ void GenFieldNodeEntryDirective (int arity,Label label,Label label2,char *record ...@@ -2746,7 +2746,7 @@ void GenFieldNodeEntryDirective (int arity,Label label,Label label2,char *record
FPutS (empty_lab.lab_name, OutFile); FPutS (empty_lab.lab_name, OutFile);
if (label2!=NULL){ if (label2!=NULL){
FPutC (' ', OutFile); PutCOutFile (' ');
if (label2==&empty_lab) if (label2==&empty_lab)
FPutS (empty_lab.lab_name, OutFile); FPutS (empty_lab.lab_name, OutFile);
else else
...@@ -2877,8 +2877,8 @@ void GenUnboxedConsRecordDescriptor (SymbDef sdef,int tail_strict) ...@@ -2877,8 +2877,8 @@ void GenUnboxedConsRecordDescriptor (SymbDef sdef,int tail_strict)
FPrintF (OutFile, "%s%s ",unboxed_record_cons_prefix,name); FPrintF (OutFile, "%s%s ",unboxed_record_cons_prefix,name);
} }
FPutC ('l', OutFile); PutCOutFile ('l');
FPutC ('R', OutFile); PutCOutFile ('R');
GenABStackElemsOfRecord (tuple_arguments_state[0]); GenABStackElemsOfRecord (tuple_arguments_state[0]);
GenABStackElems (tuple_arguments_state[1]); GenABStackElems (tuple_arguments_state[1]);
...@@ -2931,7 +2931,7 @@ void GenStrictConstructorDescriptor (SymbDef sdef,StateP constructor_arg_states) ...@@ -2931,7 +2931,7 @@ void GenStrictConstructorDescriptor (SymbDef sdef,StateP constructor_arg_states)
FPrintF (OutFile, CONSTRUCTOR_R_PREFIX "%u ",sdef->sdef_number); FPrintF (OutFile, CONSTRUCTOR_R_PREFIX "%u ",sdef->sdef_number);
} }
FPutC ('d', OutFile); PutCOutFile ('d');
for (arg_n=0,constructor_arg_state_p=constructor_arg_states; arg_n<state_arity; ++arg_n,++constructor_arg_state_p) for (arg_n=0,constructor_arg_state_p=constructor_arg_states; arg_n<state_arity; ++arg_n,++constructor_arg_state_p)
GenABStackElemsForRecordDesc (*constructor_arg_state_p); GenABStackElemsForRecordDesc (*constructor_arg_state_p);
...@@ -2975,9 +2975,9 @@ void GenArrayFunctionDescriptor (SymbDef arr_fun_def, Label desclab, int arity) ...@@ -2975,9 +2975,9 @@ void GenArrayFunctionDescriptor (SymbDef arr_fun_def, Label desclab, int arity)
else else
GenLabel (&descriptor_label); GenLabel (&descriptor_label);
FPutC (' ', OutFile); PutCOutFile (' ');
GenLabel (&empty_lab); GenLabel (&empty_lab);
FPutC (' ', OutFile); PutCOutFile (' ');
if (arr_fun_def->sdef_mark & SDEF_USED_CURRIED_MASK){ if (arr_fun_def->sdef_mark & SDEF_USED_CURRIED_MASK){
LabDef lazylab; LabDef lazylab;
...@@ -3086,7 +3086,7 @@ void GenFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef) ...@@ -3086,7 +3086,7 @@ void GenFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef)
FPrintF (OutFile,"%s.%u",name,sdef->sdef_number); FPrintF (OutFile,"%s.%u",name,sdef->sdef_number);
} else } else
PrintSymbolOfIdent (name, 0, OutFile); PrintSymbolOfIdent (name, 0, OutFile);
FPutC ('\"',OutFile); PutCOutFile ('\"');
} }
void GenConstructorFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef) void GenConstructorFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef)
...@@ -3164,7 +3164,7 @@ void GenConstructorFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef) ...@@ -3164,7 +3164,7 @@ void GenConstructorFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef)
FPrintF (OutFile, "%d 0 \"", sdef->sdef_arity); FPrintF (OutFile, "%d 0 \"", sdef->sdef_arity);
PrintSymbolOfIdent (name, 0, OutFile); PrintSymbolOfIdent (name, 0, OutFile);
FPutC ('\"',OutFile); PutCOutFile ('\"');
} }
#if OPTIMIZE_LAZY_TUPLE_RECURSION #if OPTIMIZE_LAZY_TUPLE_RECURSION
...@@ -3189,7 +3189,7 @@ void GenFunctionDescriptorForLazyTupleRecursion (SymbDef sdef,int tuple_result_a ...@@ -3189,7 +3189,7 @@ void GenFunctionDescriptorForLazyTupleRecursion (SymbDef sdef,int tuple_result_a
FPrintF (OutFile, "%d 0 \"",sdef->sdef_arity+tuple_result_arity); FPrintF (OutFile, "%d 0 \"",sdef->sdef_arity+tuple_result_arity);
PrintSymbolOfIdent (name,0,OutFile); PrintSymbolOfIdent (name,0,OutFile);
FPutC ('\"',OutFile); PutCOutFile ('\"');
# if 1 # if 1
put_directive_ (Ddescn); put_directive_ (Ddescn);
...@@ -3207,7 +3207,7 @@ void GenFunctionDescriptorForLazyTupleRecursion (SymbDef sdef,int tuple_result_a ...@@ -3207,7 +3207,7 @@ void GenFunctionDescriptorForLazyTupleRecursion (SymbDef sdef,int tuple_result_a
FPrintF (OutFile, "%d 0 \"",sdef->sdef_arity+tuple_result_arity); FPrintF (OutFile, "%d 0 \"",sdef->sdef_arity+tuple_result_arity);
PrintSymbolOfIdent (name,0,OutFile); PrintSymbolOfIdent (name,0,OutFile);
FPutC ('\"',OutFile); PutCOutFile ('\"');
# endif # endif
} }
#endif #endif
...@@ -3416,10 +3416,10 @@ void GenModuleDescriptor ( ...@@ -3416,10 +3416,10 @@ void GenModuleDescriptor (
#if WRITE_DCL_MODIFICATION_TIME #if WRITE_DCL_MODIFICATION_TIME
if (WriteModificationTimes){ if (WriteModificationTimes){
FPutC (' ',OutFile); PutCOutFile (' ');
FPutC ('\"',OutFile); PutCOutFile ('\"');
FPutS (file_time,OutFile); FPutS (file_time,OutFile);
FPutC ('\"',OutFile); PutCOutFile ('\"');
} }
#endif #endif
} }
...@@ -3435,10 +3435,10 @@ void GenDepend (char *modname ...@@ -3435,10 +3435,10 @@ void GenDepend (char *modname
#if WRITE_DCL_MODIFICATION_TIME #if WRITE_DCL_MODIFICATION_TIME
if (WriteModificationTimes){ if (WriteModificationTimes){
FPutC (' ',OutFile); PutCOutFile (' ');
FPutC ('\"',OutFile); PutCOutFile ('\"');
FPutS (file_time,OutFile); FPutS (file_time,OutFile);
FPutC ('\"',OutFile); PutCOutFile ('\"');
} }
#endif #endif
} }
...@@ -3854,7 +3854,7 @@ void GenerateForeignExports (struct foreign_export_list *foreign_export_list) ...@@ -3854,7 +3854,7 @@ void GenerateForeignExports (struct foreign_export_list *foreign_export_list)
FPrintF (OutFile,"\n\tcentry %s e_%s_s%s \"",function_sdef->sdef_name,CurrentModule,function_sdef->sdef_name); FPrintF (OutFile,"\n\tcentry %s e_%s_s%s \"",function_sdef->sdef_name,CurrentModule,function_sdef->sdef_name);
if (foreign_export_list->fe_stdcall) if (foreign_export_list->fe_stdcall)
FPutC ('P',OutFile); PutCOutFile ('P');
rule_type_p=function_sdef->sdef_rule->rule_type; rule_type_p=function_sdef->sdef_rule->rule_type;
...@@ -3884,7 +3884,7 @@ void GenParameters (Bool input, Parameters params, int asp, int bsp) ...@@ -3884,7 +3884,7 @@ void GenParameters (Bool input, Parameters params, int asp, int bsp)
node_id=params->par_node_id; node_id=params->par_node_id;
if (!is_first_parameter) if (!is_first_parameter)
FPutC (' ',OutFile); PutCOutFile (' ');
if (IsSimpleState (node_id->nid_state) && node_id->nid_state.state_kind==OnB) if (IsSimpleState (node_id->nid_state) && node_id->nid_state.state_kind==OnB)
FPrintF (OutFile, "b%d:%s",bsp-node_id->nid_b_index,params->par_loc_name); FPrintF (OutFile, "b%d:%s",bsp-node_id->nid_b_index,params->par_loc_name);
else else
...@@ -3900,12 +3900,12 @@ void GenInstructions (Instructions ilist) ...@@ -3900,12 +3900,12 @@ void GenInstructions (Instructions ilist)
instruction_name=ilist->instr_this; instruction_name=ilist->instr_this;
FPutC ('\n',OutFile); PutCOutFile ('\n');
if (instruction_name[0]==':') if (instruction_name[0]==':')
FPutS (&instruction_name[1],OutFile); FPutS (&instruction_name[1],OutFile);
else { else {
if (instruction_name[0]!='.') if (instruction_name[0]!='.')
FPutC ('\t',OutFile); PutCOutFile ('\t');
FPutS (instruction_name,OutFile); FPutS (instruction_name,OutFile);
} }
} }
......
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