From 43124616c4c055c80f4cd9fc4e0afcbe2b733928 Mon Sep 17 00:00:00 2001 From: Pixel <> Date: Mon, 16 Apr 2001 14:56:10 +0000 Subject: Commentaires --- lib/linker.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/linker.c') diff --git a/lib/linker.c b/lib/linker.c index 5fe1162..f28bc0f 100644 --- a/lib/linker.c +++ b/lib/linker.c @@ -10,6 +10,8 @@ #include "exceptions.h" #include "hash.h" +/* Les quelques structures de données utiles */ + typedef struct object_t { Uint32 s_text, s_data, s_bss, * text, * data, textstart, datastart, bssstart; } object_t; @@ -22,6 +24,8 @@ typedef struct symbol_t { struct symbol_t * next; } symbol_t; +/* Et les variables globales */ + Uint32 startpoint = -1, textsize = 0, datasize = 0, bsssize = 0; object_t ** objects; @@ -30,6 +34,8 @@ int objindex = 0, nbrsymbs = 0; _TableauVariable symbs; +/* Quelques fonctions pour nous simplifier la vie... */ + static FILE * openfilewriting(char * name) { FILE * f; @@ -82,6 +88,8 @@ static char * readstring(FILE * f) { return r; } +/* Rajoute un symbole dans la pile */ + static void addsymbol(char * name, int offset, int type) { symbol_t * newsymbol; @@ -102,6 +110,8 @@ static void addsymbol(char * name, int offset, int type) { } } +/* Rajoute un fichier dans les structures */ + void addfile(char * nom) { FILE * f; Uint32 start, nbsymbols, type, offset; @@ -164,6 +174,8 @@ void addfile(char * nom) { popcontext(); } +/* Simplification de vie... */ + static void dumptab(Uint32 * tab, int s, FILE * f) { int i; @@ -172,6 +184,8 @@ static void dumptab(Uint32 * tab, int s, FILE * f) { } } +/* Nous dumpons la mémoire dans le fichier */ + static void dumptext(object_t * obj, FILE * f) { dumptab(obj->text, obj->s_text, f); } @@ -180,6 +194,8 @@ static void dumpdata(object_t * obj, FILE * f) { dumptab(obj->data, obj->s_data, f); } +/* Cette fonction va calculer les quelques relogements statiques et dynamiques que nous a laissé l'assembleur */ + static void dumprelog(FILE * f) { symbol_t * s = symbols, * t; char trouve, err[BUFSIZ]; @@ -234,6 +250,8 @@ static void dumprelog(FILE * f) { } } +/* Cette fonction sert à écrire le fichier de sortie. */ + void dumpfile(char * nom) { FILE * f; int i; @@ -273,6 +291,8 @@ void dumpfile(char * nom) { fclose(f); } +/* Fonctions d'initialisations et de libération de mémoire */ + void init(int n) { int i; -- cgit v1.2.3