hide names, and remap public ones

This commit is contained in:
ceriel 1989-01-26 13:32:57 +00:00
parent e92f8ac398
commit 5a18c3748d
27 changed files with 121 additions and 86 deletions

View file

@ -13,7 +13,7 @@ IDIRS=-I.\
LIBS=$(EM)/modules/lib/*.a LIBS=$(EM)/modules/lib/*.a
all : data.o con2.o con4.o relocation.o end_back.o gen1.o gen2.o\ 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\ 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\ text4.o do_open.o do_close.o memory.o label.o misc.o extnd.o symtable.o\
common.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 end_back.o : data.h back.h ../mach.h $(SOURCE)/end_back.c
$(CC) $(CFLAGS) -c $(IDIRS) -I.. $(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 output.o : data.h back.h ../mach.h $(SOURCE)/output.c
$(CC) $(CFLAGS) -c $(IDIRS) -I.. $(SOURCE)/output.c $(CC) $(CFLAGS) -c $(IDIRS) -I.. $(SOURCE)/output.c

View file

@ -4,7 +4,7 @@
extern char *extnd_name(), *extnd_dnam(), *extnd_dlb(), *extnd_ilb(), extern char *extnd_name(), *extnd_dnam(), *extnd_dlb(), *extnd_ilb(),
*extnd_hol(), *extnd_ext(), *extnd_pro(), *extnd_start(), *extnd_hol(), *extnd_ext(), *extnd_pro(), *extnd_start(),
*extnd_part(), *extnd_cont(); *extnd_part(), *extnd_cont();
#include <em.h>
#include "data.h" #include "data.h"
/* These routines are called very often, thus we turned them into macros. */ /* 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 rom1(b) {if (--data_cnt < 0) mem_data(); *data++ = b;}
#define bss( n) ( nbss += n) #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 */ /* 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 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 PC_REL 1
#define ABSOLUTE !PC_REL #define ABSOLUTE !PC_REL

View file

@ -1,14 +1,13 @@
#include <out.h> #include <out.h>
#include <em.h>
#include "back.h" #include "back.h"
common(n) common(n)
arith n; arith n;
{ {
extern int _Label, _Label_waiting; extern int Label, Label_waiting;
register struct outname *nm = &symbol_table[_Label]; register struct outname *nm = &symbol_table[Label];
if (_Label_waiting) { if (Label_waiting) {
/* If possible, generate a common. Local commons must /* If possible, generate a common. Local commons must
be delt with later. be delt with later.
*/ */
@ -16,7 +15,7 @@ arith n;
if (n > nm->on_valu) { if (n > nm->on_valu) {
nm->on_valu = n; nm->on_valu = n;
} }
_Label_waiting = 0; Label_waiting = 0;
return; return;
} }
switchseg(SEGBSS); switchseg(SEGBSS);

View file

@ -1,6 +1,8 @@
#include "mach.h" #include "mach.h"
#include "back.h" #include "back.h"
#undef con2
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
#define con2(w) { *data++ = ((w) >> 8); *data++ = (w);} #define con2(w) { *data++ = ((w) >> 8); *data++ = (w);}
#else #else

View file

@ -1,6 +1,6 @@
#include <system.h> #include <system.h>
#include <out.h> #include <out.h>
#include "data.h" #include "back.h"
#include "mach.h" #include "mach.h"
/* Global datastructures : /* Global datastructures :
@ -34,7 +34,7 @@ struct outname *symbol_table;
int cur_seg = -1 , nname = 0; int cur_seg = -1 , nname = 0;
long nbss = 0, size_text, size_data, size_reloc, size_symbol, 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) put2(sect,addr,w)

View file

@ -1,41 +1,44 @@
/* The global datastructures (see "data.c"). */ /* The global datastructures (see "data.c"). */
#define cur_value _cur_value #define cur_value B_cur_value
#define get4 _get4 #define get4 B_get4
#define cur_seg _cur_seg #define cur_seg B_cur_seg
#define text _text #define text B_text
#define data _data #define data B_data
#define string _string #define string B_string
#define nname _nname #define nname B_nname
#define nbss _nbss #define nbss B_nbss
#define size_text _size_text #define size_text B_size_text
#define size_data _size_data #define size_data B_size_data
#define size_reloc _size_reloc #define size_reloc B_size_reloc
#define size_symbol _size_symbol #define size_symbol B_size_symbol
#define size_string _size_string #define size_string B_size_string
#define text_cnt _text_cnt #define text_cnt B_text_cnt
#define data_cnt _data_cnt #define data_cnt B_data_cnt
#define text_area _text_area #define text_area B_text_area
#define data_area _data_area #define data_area B_data_area
#define string_area _string_area #define string_area B_string_area
#define reloc_info _reloc_info #define reloc_info B_reloc_info
#define relo _relo #define relo B_relo
#define symbol_table _symbol_table #define symbol_table B_symbol_table
#define mem_text _mem_text #define mem_text B_mm_text
#define mem_data _mem_data #define mem_data B_mm_data
#define mem_relo _mem_relo #define mem_relo B_mm_relo
#define mem_string _mem_string #define mem_string B_mm_string
#define mem_symbol_hash _mem_symbol_hash #define mem_symbol_hash B_mm_symbol_hash
#define put1 _put1 #define put1 B_put1
#define put2 _put2 #define put2 B_put2
#define put4 _put4 #define put4 B_put4
#define get1 _get1 #define get1 B_get1
#define get2 _get2 #define get2 B_get2
#define get4 _get4 #define get4 B_get4
#define do_local_relocation _do_local_relocation #define do_local_relocation B_do_local_relocation
#define string_lengte _string_length #define string_lengte B_string_length
#define index_symbol_table _index_symbol_table #define index_symbol_table B_index_symbol_table
#define output_back _output_back #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 cur_value();
extern long get4(); extern long get4();
@ -51,5 +54,5 @@ extern char *text_area, *data_area, *string_area;
extern struct outrelo *reloc_info, *relo; extern struct outrelo *reloc_info, *relo;
extern struct outname *symbol_table; extern struct outname *symbol_table;
#define _put1(buf, off, w) ((buf)[off] = (w)) #define B_put1(buf, off, w) ((buf)[off] = (w))
#define _get1(buf, off) ((buf)[off]) #define B_get1(buf, off) ((buf)[off])

View file

@ -1,6 +1,7 @@
#include <out.h> #include <out.h>
#include <arch.h> #include <arch.h>
#include <ranlib.h> #include <ranlib.h>
#include "back.h"
close_back() close_back()
{ {

View file

@ -1,7 +1,7 @@
#include <out.h> #include <out.h>
#include <arch.h> #include <arch.h>
#include <ranlib.h> #include <ranlib.h>
#include "data.h" #include "back.h"
#include "header.h" #include "header.h"
open_back( filename) open_back( filename)

View file

@ -1,8 +1,8 @@
#include <system.h> #include <system.h>
#include <em.h>
#include <out.h> #include <out.h>
#include <em.h>
#include "header.h" #include "header.h"
#include "data.h" #include "back.h"
#include "mach.h" #include "mach.h"
#include <varargs.h> #include <varargs.h>

View file

@ -1,5 +1,4 @@
#include <system.h> #include <system.h>
#include <em.h>
#include "mach.h" #include "mach.h"
#include "back.h" #include "back.h"

View file

@ -1,5 +1,4 @@
#include <system.h> #include <system.h>
#include <em.h>
#include "mach.h" #include "mach.h"
#include "back.h" #include "back.h"
@ -8,7 +7,7 @@ TWO_BYTES w;
{ {
switch ( cur_seg) { switch ( cur_seg) {
case SEGTXT : case SEGTXT :
if ((_text_cnt -= 2) < 0) mem_text(); if ((text_cnt -= 2) < 0) mem_text();
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
*text++ = w>>8; *text++ = w>>8;
*text++ = w; *text++ = w;
@ -19,7 +18,7 @@ TWO_BYTES w;
return; return;
case SEGCON : case SEGCON :
case SEGROM : case SEGROM :
if ((_data_cnt -= 2) < 0) mem_data(); if ((data_cnt -= 2) < 0) mem_data();
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
*data++ = w>>8; *data++ = w>>8;
*data++ = w; *data++ = w;

View file

@ -1,7 +1,8 @@
#include <system.h> #include <system.h>
#include <em.h>
#include "mach.h" #include "mach.h"
#include "back.h" #include "back.h"
#undef text2
#undef con2
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
#define text2(w) { *text++ = ((w) >> 8); *text++ = (w);} #define text2(w) { *text++ = ((w) >> 8); *text++ = (w);}
#define con2(w) { *data++ = ((w) >> 8); *data++ = (w);} #define con2(w) { *data++ = ((w) >> 8); *data++ = (w);}
@ -15,7 +16,7 @@ FOUR_BYTES l;
{ {
switch ( cur_seg) { switch ( cur_seg) {
case SEGTXT : case SEGTXT :
if ((_text_cnt -= 4) < 0) mem_text(); if ((text_cnt -= 4) < 0) mem_text();
#ifdef WORDS_REVERSED #ifdef WORDS_REVERSED
text2( (int) (l>>16)); text2( (int) (l>>16));
text2( (int) l); text2( (int) l);
@ -26,7 +27,7 @@ FOUR_BYTES l;
return; return;
case SEGCON : case SEGCON :
case SEGROM : case SEGROM :
if ((_data_cnt -= 4) < 0) mem_data(); if ((data_cnt -= 4) < 0) mem_data();
#ifdef WORDS_REVERSED #ifdef WORDS_REVERSED
con2( (int)(l>>16)); con2( (int)(l>>16));
con2( (int) l); con2( (int) l);

View file

@ -24,9 +24,9 @@ init_back()
relo = reloc_info; relo = reloc_info;
size_text = MAXTEXT; size_text = MAXTEXT;
_text_cnt = MAXTEXT; text_cnt = MAXTEXT;
size_data = MAXDATA; size_data = MAXDATA;
_data_cnt = MAXDATA; data_cnt = MAXDATA;
size_reloc = MAXRELO; size_reloc = MAXRELO;
size_symbol = MAXNAME; size_symbol = MAXNAME;
size_string = MAXSTRING; size_string = MAXSTRING;

View file

@ -2,7 +2,7 @@
#include "header.h" #include "header.h"
#include "back.h" #include "back.h"
int _Label, _Label_waiting; int Label, Label_waiting;
save_label( lab) save_label( lab)
char *lab; char *lab;
@ -13,18 +13,18 @@ char *lab;
* is not allowed. * is not allowed.
*/ */
{ {
_Label = find_sym( lab, SYMBOL_DEFINITION); Label = find_sym( lab, SYMBOL_DEFINITION);
_Label_waiting = 1; Label_waiting = 1;
} }
dump_label() dump_label()
{ {
if ( _Label_waiting) { if ( Label_waiting) {
align_word(); align_word();
symbol_table[ _Label].on_valu = cur_value(); symbol_table[ Label].on_valu = cur_value();
symbol_table[ _Label].on_type |= ( S_MIN + conv_seg( cur_seg)); symbol_table[ Label].on_type |= ( S_MIN + conv_seg( cur_seg));
_Label_waiting = 0; Label_waiting = 0;
} }
} }

View file

@ -1,6 +1,6 @@
#include <out.h> #include <out.h>
#include <system.h> #include <system.h>
#include "data.h" #include "back.h"
#include "hash.h" #include "hash.h"
#include <alloc.h> #include <alloc.h>
@ -16,7 +16,7 @@ mem_text()
text_area = Realloc( text_area, sizeof( char) * 2 * size_text); text_area = Realloc( text_area, sizeof( char) * 2 * size_text);
text = text_area + diff; text = text_area + diff;
_text_cnt += size_text; text_cnt += size_text;
size_text = 2 * size_text; size_text = 2 * size_text;
} }
@ -28,7 +28,7 @@ mem_data()
data_area = Realloc( data_area, sizeof( char) * 2 * size_data); data_area = Realloc( data_area, sizeof( char) * 2 * size_data);
data = data_area + diff; data = data_area + diff;
_data_cnt += size_data; data_cnt += size_data;
size_data = 2 * size_data; size_data = 2 * size_data;
} }

View file

@ -1,5 +1,4 @@
#include <out.h> #include <out.h>
#include <em.h>
#include "mach.h" #include "mach.h"
#include "back.h" #include "back.h"
#include "header.h" #include "header.h"

View file

@ -1,5 +1,4 @@
#include <out.h> #include <out.h>
#include <em.h>
#include "mach.h" #include "mach.h"
#include "back.h" #include "back.h"
#include "header.h" #include "header.h"

View file

@ -1,4 +1,3 @@
#include <em.h>
#include <out.h> #include <out.h>
#include <system.h> #include <system.h>
#include "mach.h" #include "mach.h"

View file

@ -1,7 +1,6 @@
#include <system.h> #include <system.h>
#include <out.h> #include <out.h>
#include "back.h" #include "back.h"
#include "data.h"
/* Solve the local references. /* Solve the local references.
*/ */

View file

@ -4,7 +4,7 @@
rom2( w) rom2( w)
TWO_BYTES w; TWO_BYTES w;
{ {
if ((_data_cnt -= 2) < 0) mem_data(); if ((data_cnt -= 2) < 0) mem_data();
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
*data++ = w>>8; *data++ = w>>8;
*data++ = w; *data++ = w;

View file

@ -1,6 +1,8 @@
#include "mach.h" #include "mach.h"
#include "back.h" #include "back.h"
#undef rom2
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
#define rom2(w) { *data++ = ((w) >> 8); *data++ = (w);} #define rom2(w) { *data++ = ((w) >> 8); *data++ = (w);}
#else #else
@ -10,7 +12,7 @@
rom4( l) rom4( l)
FOUR_BYTES l; FOUR_BYTES l;
{ {
if ((_data_cnt -= 4) < 0) mem_data(); if ((data_cnt -= 4) < 0) mem_data();
#ifdef WORDS_REVERSED #ifdef WORDS_REVERSED
rom2( (int)(l>>16)); rom2( (int)(l>>16));
rom2( (int) l); rom2( (int) l);

View file

@ -1,5 +1,5 @@
#include <out.h> #include <out.h>
#include "data.h" #include "back.h"
#include "header.h" #include "header.h"
set_global_visible(sym) set_global_visible(sym)

View file

@ -1,5 +1,5 @@
#include <out.h> #include <out.h>
#include "data.h" #include "back.h"
#include "header.h" #include "header.h"
set_local_visible(sym) set_local_visible(sym)

View file

@ -1,6 +1,6 @@
#include "data.h" #include "back.h"
_swtchsg( seg) B_swtchsg( seg)
int seg; int seg;
/* The EM definition demands that pseudo instructions are aligned /* The EM definition demands that pseudo instructions are aligned

View file

@ -1,6 +1,5 @@
#include <out.h> #include <out.h>
#include <system.h> #include <system.h>
#include "data.h"
#include "back.h" #include "back.h"
#include "header.h" #include "header.h"

View file

@ -4,7 +4,7 @@
text2( w) text2( w)
TWO_BYTES w; TWO_BYTES w;
{ {
if ((_text_cnt -= 2) < 0) mem_text(); if ((text_cnt -= 2) < 0) mem_text();
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
*text++ = w>>8; *text++ = w>>8;
*text++ = w; *text++ = w;

View file

@ -1,6 +1,8 @@
#include "mach.h" #include "mach.h"
#include "back.h" #include "back.h"
#undef text2
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
#define text2(w) { *text++ = ((w) >> 8); *text++ = (w);} #define text2(w) { *text++ = ((w) >> 8); *text++ = (w);}
#else #else
@ -10,7 +12,7 @@
text4( l) text4( l)
FOUR_BYTES l; FOUR_BYTES l;
{ {
if ((_text_cnt -= 4) < 0) mem_text(); if ((text_cnt -= 4) < 0) mem_text();
#ifdef WORDS_REVERSED #ifdef WORDS_REVERSED
text2( (int) (l>>16)); text2( (int) (l>>16));
text2( (int) l); text2( (int) l);