From 5a18c3748dfe8c4afc17108e7aec041253179c77 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 26 Jan 1989 13:32:57 +0000 Subject: [PATCH] hide names, and remap public ones --- util/ceg/ce_back/obj_back/Makefile | 5 +- util/ceg/ce_back/obj_back/back.h | 39 ++++++++++++- util/ceg/ce_back/obj_back/common.c | 9 ++- util/ceg/ce_back/obj_back/con4.c | 2 + util/ceg/ce_back/obj_back/data.c | 4 +- util/ceg/ce_back/obj_back/data.h | 79 +++++++++++++------------- util/ceg/ce_back/obj_back/do_close.c | 1 + util/ceg/ce_back/obj_back/do_open.c | 2 +- util/ceg/ce_back/obj_back/extnd.c | 4 +- util/ceg/ce_back/obj_back/gen1.c | 1 - util/ceg/ce_back/obj_back/gen2.c | 5 +- util/ceg/ce_back/obj_back/gen4.c | 7 ++- util/ceg/ce_back/obj_back/init_back.c | 4 +- util/ceg/ce_back/obj_back/label.c | 14 ++--- util/ceg/ce_back/obj_back/memory.c | 6 +- util/ceg/ce_back/obj_back/reloc1.c | 1 - util/ceg/ce_back/obj_back/reloc2.c | 1 - util/ceg/ce_back/obj_back/reloc4.c | 1 - util/ceg/ce_back/obj_back/relocation.c | 1 - util/ceg/ce_back/obj_back/rom2.c | 2 +- util/ceg/ce_back/obj_back/rom4.c | 4 +- util/ceg/ce_back/obj_back/set_global.c | 2 +- util/ceg/ce_back/obj_back/set_local.c | 2 +- util/ceg/ce_back/obj_back/switchseg.c | 4 +- util/ceg/ce_back/obj_back/symboldef.c | 1 - util/ceg/ce_back/obj_back/text2.c | 2 +- util/ceg/ce_back/obj_back/text4.c | 4 +- 27 files changed, 121 insertions(+), 86 deletions(-) diff --git a/util/ceg/ce_back/obj_back/Makefile b/util/ceg/ce_back/obj_back/Makefile index 0e507e0e6..67e94d2c2 100644 --- a/util/ceg/ce_back/obj_back/Makefile +++ b/util/ceg/ce_back/obj_back/Makefile @@ -13,7 +13,7 @@ IDIRS=-I.\ LIBS=$(EM)/modules/lib/*.a all : data.o con2.o con4.o relocation.o end_back.o gen1.o gen2.o\ - gen4.o init_back.o mysprint.o output.o reloc1.o reloc2.o reloc4.o\ + gen4.o init_back.o output.o reloc1.o reloc2.o reloc4.o\ rom2.o rom4.o set_global.o set_local.o switchseg.o symboldef.o text2.o\ text4.o do_open.o do_close.o memory.o label.o misc.o extnd.o symtable.o\ common.o @@ -54,9 +54,6 @@ init_back.o : data.h back.h ../mach.h $(SOURCE)/init_back.c end_back.o : data.h back.h ../mach.h $(SOURCE)/end_back.c $(CC) $(CFLAGS) -c $(IDIRS) -I.. $(SOURCE)/end_back.c -mysprint.o : data.h back.h data.h $(SOURCE)/mysprint.c - $(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/mysprint.c - output.o : data.h back.h ../mach.h $(SOURCE)/output.c $(CC) $(CFLAGS) -c $(IDIRS) -I.. $(SOURCE)/output.c diff --git a/util/ceg/ce_back/obj_back/back.h b/util/ceg/ce_back/obj_back/back.h index 7df6c5bff..7addc9147 100644 --- a/util/ceg/ce_back/obj_back/back.h +++ b/util/ceg/ce_back/obj_back/back.h @@ -4,7 +4,7 @@ extern char *extnd_name(), *extnd_dnam(), *extnd_dlb(), *extnd_ilb(), *extnd_hol(), *extnd_ext(), *extnd_pro(), *extnd_start(), *extnd_part(), *extnd_cont(); - +#include #include "data.h" /* These routines are called very often, thus we turned them into macros. */ @@ -14,6 +14,41 @@ extern char *extnd_name(), *extnd_dnam(), *extnd_dlb(), *extnd_ilb(), #define rom1(b) {if (--data_cnt < 0) mem_data(); *data++ = b;} #define bss( n) ( nbss += n) +/* Macros to change interface names */ + +#define common B_common +#define con2 B_con2 +#define con4 B_con4 +#define rom2 B_rom2 +#define rom4 B_rom4 +#define text2 B_txt2 +#define text4 B_txt4 +#define close_back B_close_back +#define open_back B_open_back +#define end_back B_end_back +#define init_back B_init_back +#define extnd_pro B_ex_pro +#define extnd_start B_ex_start +#define extnd_name B_ex_name +#define extnd_dnam B_ex_dnam +#define extnd_dlb B_ex_dlb +#define extnd_ilb B_ex_ilb +#define extnd_hol B_ex_hol +#define extnd_part B_ex_part +#define extnd_cont B_ex_cont +#define gen1 B_gen1 +#define gen2 B_gen2 +#define gen4 B_gen4 +#define save_label B_save_label +#define dump_label B_dump_label +#define align_word B_align_word +#define reloc1 B_rlc1 +#define reloc2 B_rlc2 +#define reloc4 B_rlc4 +#define set_global_visible B_stglobvis +#define set_local_visible B_stlocvis +#define symbol_definition B_symdef + /* Numbering of the segments and some global constants */ @@ -25,7 +60,7 @@ extern char *extnd_name(), *extnd_dnam(), *extnd_dlb(), *extnd_ilb(), #define swtxt() switchseg( SEGTXT) -#define switchseg(seg) if ((seg) != cur_seg) _swtchsg(seg); else +#define switchseg(seg) if ((seg) != cur_seg) B_swtchsg(seg); else #define PC_REL 1 #define ABSOLUTE !PC_REL diff --git a/util/ceg/ce_back/obj_back/common.c b/util/ceg/ce_back/obj_back/common.c index 59d3bea68..4b142cb6e 100644 --- a/util/ceg/ce_back/obj_back/common.c +++ b/util/ceg/ce_back/obj_back/common.c @@ -1,14 +1,13 @@ #include -#include #include "back.h" common(n) arith n; { - extern int _Label, _Label_waiting; - register struct outname *nm = &symbol_table[_Label]; + extern int Label, Label_waiting; + register struct outname *nm = &symbol_table[Label]; - if (_Label_waiting) { + if (Label_waiting) { /* If possible, generate a common. Local commons must be delt with later. */ @@ -16,7 +15,7 @@ arith n; if (n > nm->on_valu) { nm->on_valu = n; } - _Label_waiting = 0; + Label_waiting = 0; return; } switchseg(SEGBSS); diff --git a/util/ceg/ce_back/obj_back/con4.c b/util/ceg/ce_back/obj_back/con4.c index a720e4754..b01795422 100644 --- a/util/ceg/ce_back/obj_back/con4.c +++ b/util/ceg/ce_back/obj_back/con4.c @@ -1,6 +1,8 @@ #include "mach.h" #include "back.h" +#undef con2 + #ifdef BYTES_REVERSED #define con2(w) { *data++ = ((w) >> 8); *data++ = (w);} #else diff --git a/util/ceg/ce_back/obj_back/data.c b/util/ceg/ce_back/obj_back/data.c index 5963a84a2..b5270be07 100644 --- a/util/ceg/ce_back/obj_back/data.c +++ b/util/ceg/ce_back/obj_back/data.c @@ -1,6 +1,6 @@ #include #include -#include "data.h" +#include "back.h" #include "mach.h" /* Global datastructures : @@ -34,7 +34,7 @@ struct outname *symbol_table; int cur_seg = -1 , nname = 0; long nbss = 0, size_text, size_data, size_reloc, size_symbol, - size_string, _text_cnt, _data_cnt; + size_string, text_cnt, data_cnt; put2(sect,addr,w) diff --git a/util/ceg/ce_back/obj_back/data.h b/util/ceg/ce_back/obj_back/data.h index cd9e49e9f..2be0c0612 100644 --- a/util/ceg/ce_back/obj_back/data.h +++ b/util/ceg/ce_back/obj_back/data.h @@ -1,41 +1,44 @@ /* The global datastructures (see "data.c"). */ -#define cur_value _cur_value -#define get4 _get4 -#define cur_seg _cur_seg -#define text _text -#define data _data -#define string _string -#define nname _nname -#define nbss _nbss -#define size_text _size_text -#define size_data _size_data -#define size_reloc _size_reloc -#define size_symbol _size_symbol -#define size_string _size_string -#define text_cnt _text_cnt -#define data_cnt _data_cnt -#define text_area _text_area -#define data_area _data_area -#define string_area _string_area -#define reloc_info _reloc_info -#define relo _relo -#define symbol_table _symbol_table -#define mem_text _mem_text -#define mem_data _mem_data -#define mem_relo _mem_relo -#define mem_string _mem_string -#define mem_symbol_hash _mem_symbol_hash -#define put1 _put1 -#define put2 _put2 -#define put4 _put4 -#define get1 _get1 -#define get2 _get2 -#define get4 _get4 -#define do_local_relocation _do_local_relocation -#define string_lengte _string_length -#define index_symbol_table _index_symbol_table -#define output_back _output_back +#define cur_value B_cur_value +#define get4 B_get4 +#define cur_seg B_cur_seg +#define text B_text +#define data B_data +#define string B_string +#define nname B_nname +#define nbss B_nbss +#define size_text B_size_text +#define size_data B_size_data +#define size_reloc B_size_reloc +#define size_symbol B_size_symbol +#define size_string B_size_string +#define text_cnt B_text_cnt +#define data_cnt B_data_cnt +#define text_area B_text_area +#define data_area B_data_area +#define string_area B_string_area +#define reloc_info B_reloc_info +#define relo B_relo +#define symbol_table B_symbol_table +#define mem_text B_mm_text +#define mem_data B_mm_data +#define mem_relo B_mm_relo +#define mem_string B_mm_string +#define mem_symbol_hash B_mm_symbol_hash +#define put1 B_put1 +#define put2 B_put2 +#define put4 B_put4 +#define get1 B_get1 +#define get2 B_get2 +#define get4 B_get4 +#define do_local_relocation B_do_local_relocation +#define string_lengte B_string_length +#define index_symbol_table B_index_symbol_table +#define output_back B_output_back +#define find_sym B_find_sym +#define Label B_lab +#define Label_waiting B_lab_waiting extern long cur_value(); extern long get4(); @@ -51,5 +54,5 @@ extern char *text_area, *data_area, *string_area; extern struct outrelo *reloc_info, *relo; extern struct outname *symbol_table; -#define _put1(buf, off, w) ((buf)[off] = (w)) -#define _get1(buf, off) ((buf)[off]) +#define B_put1(buf, off, w) ((buf)[off] = (w)) +#define B_get1(buf, off) ((buf)[off]) diff --git a/util/ceg/ce_back/obj_back/do_close.c b/util/ceg/ce_back/obj_back/do_close.c index 72f4c2c6e..cb28ca41f 100644 --- a/util/ceg/ce_back/obj_back/do_close.c +++ b/util/ceg/ce_back/obj_back/do_close.c @@ -1,6 +1,7 @@ #include #include #include +#include "back.h" close_back() { diff --git a/util/ceg/ce_back/obj_back/do_open.c b/util/ceg/ce_back/obj_back/do_open.c index 95b74ba42..a50f59a7b 100644 --- a/util/ceg/ce_back/obj_back/do_open.c +++ b/util/ceg/ce_back/obj_back/do_open.c @@ -1,7 +1,7 @@ #include #include #include -#include "data.h" +#include "back.h" #include "header.h" open_back( filename) diff --git a/util/ceg/ce_back/obj_back/extnd.c b/util/ceg/ce_back/obj_back/extnd.c index 7995d62b1..5cccc4f0f 100644 --- a/util/ceg/ce_back/obj_back/extnd.c +++ b/util/ceg/ce_back/obj_back/extnd.c @@ -1,8 +1,8 @@ #include -#include #include +#include #include "header.h" -#include "data.h" +#include "back.h" #include "mach.h" #include diff --git a/util/ceg/ce_back/obj_back/gen1.c b/util/ceg/ce_back/obj_back/gen1.c index ec40fce17..293addcb1 100644 --- a/util/ceg/ce_back/obj_back/gen1.c +++ b/util/ceg/ce_back/obj_back/gen1.c @@ -1,5 +1,4 @@ #include -#include #include "mach.h" #include "back.h" diff --git a/util/ceg/ce_back/obj_back/gen2.c b/util/ceg/ce_back/obj_back/gen2.c index 786b3faa5..d98ca8640 100644 --- a/util/ceg/ce_back/obj_back/gen2.c +++ b/util/ceg/ce_back/obj_back/gen2.c @@ -1,5 +1,4 @@ #include -#include #include "mach.h" #include "back.h" @@ -8,7 +7,7 @@ TWO_BYTES w; { switch ( cur_seg) { case SEGTXT : - if ((_text_cnt -= 2) < 0) mem_text(); + if ((text_cnt -= 2) < 0) mem_text(); #ifdef BYTES_REVERSED *text++ = w>>8; *text++ = w; @@ -19,7 +18,7 @@ TWO_BYTES w; return; case SEGCON : case SEGROM : - if ((_data_cnt -= 2) < 0) mem_data(); + if ((data_cnt -= 2) < 0) mem_data(); #ifdef BYTES_REVERSED *data++ = w>>8; *data++ = w; diff --git a/util/ceg/ce_back/obj_back/gen4.c b/util/ceg/ce_back/obj_back/gen4.c index 7c76726b9..d9aadb786 100644 --- a/util/ceg/ce_back/obj_back/gen4.c +++ b/util/ceg/ce_back/obj_back/gen4.c @@ -1,7 +1,8 @@ #include -#include #include "mach.h" #include "back.h" +#undef text2 +#undef con2 #ifdef BYTES_REVERSED #define text2(w) { *text++ = ((w) >> 8); *text++ = (w);} #define con2(w) { *data++ = ((w) >> 8); *data++ = (w);} @@ -15,7 +16,7 @@ FOUR_BYTES l; { switch ( cur_seg) { case SEGTXT : - if ((_text_cnt -= 4) < 0) mem_text(); + if ((text_cnt -= 4) < 0) mem_text(); #ifdef WORDS_REVERSED text2( (int) (l>>16)); text2( (int) l); @@ -26,7 +27,7 @@ FOUR_BYTES l; return; case SEGCON : case SEGROM : - if ((_data_cnt -= 4) < 0) mem_data(); + if ((data_cnt -= 4) < 0) mem_data(); #ifdef WORDS_REVERSED con2( (int)(l>>16)); con2( (int) l); diff --git a/util/ceg/ce_back/obj_back/init_back.c b/util/ceg/ce_back/obj_back/init_back.c index 003e54490..b97d8d5b6 100644 --- a/util/ceg/ce_back/obj_back/init_back.c +++ b/util/ceg/ce_back/obj_back/init_back.c @@ -24,9 +24,9 @@ init_back() relo = reloc_info; size_text = MAXTEXT; - _text_cnt = MAXTEXT; + text_cnt = MAXTEXT; size_data = MAXDATA; - _data_cnt = MAXDATA; + data_cnt = MAXDATA; size_reloc = MAXRELO; size_symbol = MAXNAME; size_string = MAXSTRING; diff --git a/util/ceg/ce_back/obj_back/label.c b/util/ceg/ce_back/obj_back/label.c index 379749871..19737749a 100644 --- a/util/ceg/ce_back/obj_back/label.c +++ b/util/ceg/ce_back/obj_back/label.c @@ -2,7 +2,7 @@ #include "header.h" #include "back.h" -int _Label, _Label_waiting; +int Label, Label_waiting; save_label( lab) char *lab; @@ -13,18 +13,18 @@ char *lab; * is not allowed. */ { - _Label = find_sym( lab, SYMBOL_DEFINITION); - _Label_waiting = 1; + Label = find_sym( lab, SYMBOL_DEFINITION); + Label_waiting = 1; } dump_label() { - if ( _Label_waiting) { + if ( Label_waiting) { align_word(); - symbol_table[ _Label].on_valu = cur_value(); - symbol_table[ _Label].on_type |= ( S_MIN + conv_seg( cur_seg)); - _Label_waiting = 0; + symbol_table[ Label].on_valu = cur_value(); + symbol_table[ Label].on_type |= ( S_MIN + conv_seg( cur_seg)); + Label_waiting = 0; } } diff --git a/util/ceg/ce_back/obj_back/memory.c b/util/ceg/ce_back/obj_back/memory.c index beae6fc4f..17fb68dd8 100644 --- a/util/ceg/ce_back/obj_back/memory.c +++ b/util/ceg/ce_back/obj_back/memory.c @@ -1,6 +1,6 @@ #include #include -#include "data.h" +#include "back.h" #include "hash.h" #include @@ -16,7 +16,7 @@ mem_text() text_area = Realloc( text_area, sizeof( char) * 2 * size_text); text = text_area + diff; - _text_cnt += size_text; + text_cnt += size_text; size_text = 2 * size_text; } @@ -28,7 +28,7 @@ mem_data() data_area = Realloc( data_area, sizeof( char) * 2 * size_data); data = data_area + diff; - _data_cnt += size_data; + data_cnt += size_data; size_data = 2 * size_data; } diff --git a/util/ceg/ce_back/obj_back/reloc1.c b/util/ceg/ce_back/obj_back/reloc1.c index af5747146..04e43a3d5 100644 --- a/util/ceg/ce_back/obj_back/reloc1.c +++ b/util/ceg/ce_back/obj_back/reloc1.c @@ -1,5 +1,4 @@ #include -#include #include "mach.h" #include "back.h" #include "header.h" diff --git a/util/ceg/ce_back/obj_back/reloc2.c b/util/ceg/ce_back/obj_back/reloc2.c index 938c8684f..26aea55f6 100644 --- a/util/ceg/ce_back/obj_back/reloc2.c +++ b/util/ceg/ce_back/obj_back/reloc2.c @@ -1,5 +1,4 @@ #include -#include #include "mach.h" #include "back.h" #include "header.h" diff --git a/util/ceg/ce_back/obj_back/reloc4.c b/util/ceg/ce_back/obj_back/reloc4.c index 009a553cc..d2546783c 100644 --- a/util/ceg/ce_back/obj_back/reloc4.c +++ b/util/ceg/ce_back/obj_back/reloc4.c @@ -1,4 +1,3 @@ -#include #include #include #include "mach.h" diff --git a/util/ceg/ce_back/obj_back/relocation.c b/util/ceg/ce_back/obj_back/relocation.c index 764efdd1b..98b0ee2bd 100644 --- a/util/ceg/ce_back/obj_back/relocation.c +++ b/util/ceg/ce_back/obj_back/relocation.c @@ -1,7 +1,6 @@ #include #include #include "back.h" -#include "data.h" /* Solve the local references. */ diff --git a/util/ceg/ce_back/obj_back/rom2.c b/util/ceg/ce_back/obj_back/rom2.c index 216decd1d..e877b1f66 100644 --- a/util/ceg/ce_back/obj_back/rom2.c +++ b/util/ceg/ce_back/obj_back/rom2.c @@ -4,7 +4,7 @@ rom2( w) TWO_BYTES w; { - if ((_data_cnt -= 2) < 0) mem_data(); + if ((data_cnt -= 2) < 0) mem_data(); #ifdef BYTES_REVERSED *data++ = w>>8; *data++ = w; diff --git a/util/ceg/ce_back/obj_back/rom4.c b/util/ceg/ce_back/obj_back/rom4.c index 351ec7d67..6816e3a5b 100644 --- a/util/ceg/ce_back/obj_back/rom4.c +++ b/util/ceg/ce_back/obj_back/rom4.c @@ -1,6 +1,8 @@ #include "mach.h" #include "back.h" +#undef rom2 + #ifdef BYTES_REVERSED #define rom2(w) { *data++ = ((w) >> 8); *data++ = (w);} #else @@ -10,7 +12,7 @@ rom4( l) FOUR_BYTES l; { - if ((_data_cnt -= 4) < 0) mem_data(); + if ((data_cnt -= 4) < 0) mem_data(); #ifdef WORDS_REVERSED rom2( (int)(l>>16)); rom2( (int) l); diff --git a/util/ceg/ce_back/obj_back/set_global.c b/util/ceg/ce_back/obj_back/set_global.c index 82809c10c..000539612 100644 --- a/util/ceg/ce_back/obj_back/set_global.c +++ b/util/ceg/ce_back/obj_back/set_global.c @@ -1,5 +1,5 @@ #include -#include "data.h" +#include "back.h" #include "header.h" set_global_visible(sym) diff --git a/util/ceg/ce_back/obj_back/set_local.c b/util/ceg/ce_back/obj_back/set_local.c index 841fa764f..358bf1dcc 100644 --- a/util/ceg/ce_back/obj_back/set_local.c +++ b/util/ceg/ce_back/obj_back/set_local.c @@ -1,5 +1,5 @@ #include -#include "data.h" +#include "back.h" #include "header.h" set_local_visible(sym) diff --git a/util/ceg/ce_back/obj_back/switchseg.c b/util/ceg/ce_back/obj_back/switchseg.c index bb63cdbca..d9b97a8cf 100644 --- a/util/ceg/ce_back/obj_back/switchseg.c +++ b/util/ceg/ce_back/obj_back/switchseg.c @@ -1,6 +1,6 @@ -#include "data.h" +#include "back.h" -_swtchsg( seg) +B_swtchsg( seg) int seg; /* The EM definition demands that pseudo instructions are aligned diff --git a/util/ceg/ce_back/obj_back/symboldef.c b/util/ceg/ce_back/obj_back/symboldef.c index 99fe2a067..f2016a15c 100644 --- a/util/ceg/ce_back/obj_back/symboldef.c +++ b/util/ceg/ce_back/obj_back/symboldef.c @@ -1,6 +1,5 @@ #include #include -#include "data.h" #include "back.h" #include "header.h" diff --git a/util/ceg/ce_back/obj_back/text2.c b/util/ceg/ce_back/obj_back/text2.c index f93389aaa..8cfd4d77a 100644 --- a/util/ceg/ce_back/obj_back/text2.c +++ b/util/ceg/ce_back/obj_back/text2.c @@ -4,7 +4,7 @@ text2( w) TWO_BYTES w; { - if ((_text_cnt -= 2) < 0) mem_text(); + if ((text_cnt -= 2) < 0) mem_text(); #ifdef BYTES_REVERSED *text++ = w>>8; *text++ = w; diff --git a/util/ceg/ce_back/obj_back/text4.c b/util/ceg/ce_back/obj_back/text4.c index 81167f4b8..041059e76 100644 --- a/util/ceg/ce_back/obj_back/text4.c +++ b/util/ceg/ce_back/obj_back/text4.c @@ -1,6 +1,8 @@ #include "mach.h" #include "back.h" +#undef text2 + #ifdef BYTES_REVERSED #define text2(w) { *text++ = ((w) >> 8); *text++ = (w);} #else @@ -10,7 +12,7 @@ text4( l) FOUR_BYTES l; { - if ((_text_cnt -= 4) < 0) mem_text(); + if ((text_cnt -= 4) < 0) mem_text(); #ifdef WORDS_REVERSED text2( (int) (l>>16)); text2( (int) l);