diff options
author | Pixel <> | 2001-04-17 04:03:02 +0000 |
---|---|---|
committer | Pixel <> | 2001-04-17 04:03:02 +0000 |
commit | 55f981c9fca048fba18d0538be4ed5dc1cc3fe11 (patch) | |
tree | 830ee90912ac88515a6b6bc68be033ca79b5dccf /lib | |
parent | a19da7ded119713b955816f1de69d71eef191ab0 (diff) |
Indent large
Diffstat (limited to 'lib')
-rw-r--r-- | lib/alu.c | 15 | ||||
-rw-r--r-- | lib/assembler.c | 88 | ||||
-rw-r--r-- | lib/linker.c | 12 | ||||
-rw-r--r-- | lib/meta.c | 32 | ||||
-rw-r--r-- | lib/simulator.c | 15 |
5 files changed, 55 insertions, 107 deletions
@@ -55,8 +55,7 @@ Uint32 RAdditionSigne(long int a, long int b) tr += b; - if (((a & 0x80000000) && (b & 0x80000000) && !(tr & 0x80000000)) || - (!(a & 0x80000000) && !(b & 0x80000000) && (tr & 0x80000000))) { + if (((a & 0x80000000) && (b & 0x80000000) && !(tr & 0x80000000)) || (!(a & 0x80000000) && !(b & 0x80000000) && (tr & 0x80000000))) { SetOverflow(); } else { ResetOverflow(); @@ -518,8 +517,7 @@ Uint32 NSoustractionNonSigne(Uint32 x, Uint32 y) for (i = 0; i < 32; i++) { a = ValeurIbitsAuDeb(x, i); b = ValeurIbitsAuDeb(y, i); - if (((a == 0) && (b == 0) && (ret == 0)) || - ((a == 1) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 0) && (ret == 1))) { + if (((a == 0) && (b == 0) && (ret == 0)) || ((a == 1) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 0) && (ret == 1))) { ret = 0; tp = 0; tp <<= i; @@ -527,8 +525,7 @@ Uint32 NSoustractionNonSigne(Uint32 x, Uint32 y) } else { - if (((a == 0) && (b == 0) && (ret == 1)) || - ((a == 0) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 1) && (ret == 1))) { + if (((a == 0) && (b == 0) && (ret == 1)) || ((a == 0) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 1) && (ret == 1))) { ret = 1; tp = 1; tp <<= i; @@ -569,8 +566,7 @@ Uint32 NSoustractionSigne(Uint32 x, Uint32 y) for (i = 0; i < 32; i++) { a = ValeurIbitsAuDeb(x, i); b = ValeurIbitsAuDeb(y, i); - if (((a == 0) && (b == 0) && (ret == 0)) || - ((a == 1) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 0) && (ret == 1))) { + if (((a == 0) && (b == 0) && (ret == 0)) || ((a == 1) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 0) && (ret == 1))) { ret = 0; tp = 0; tp <<= i; @@ -578,8 +574,7 @@ Uint32 NSoustractionSigne(Uint32 x, Uint32 y) } else { - if (((a == 0) && (b == 0) && (ret == 1)) || - ((a == 0) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 1) && (ret == 1))) { + if (((a == 0) && (b == 0) && (ret == 1)) || ((a == 0) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 1) && (ret == 1))) { ret = 1; tp = 1; tp <<= i; diff --git a/lib/assembler.c b/lib/assembler.c index 043b28f..e3a49bf 100644 --- a/lib/assembler.c +++ b/lib/assembler.c @@ -793,8 +793,7 @@ static void evaluate(expression_t * e) et si c'est le cas, il ne faut pas que ce soit - C. Sinon nous ne devons pas avoir de labels pour B ou C */ - if ((e->child->child->next->child->next->e_subtype == E_PATTERN) && - (e->child->child->next->op == OP_MOINS)) { + if ((e->child->child->next->child->next->e_subtype == E_PATTERN) && (e->child->child->next->op == OP_MOINS)) { exception(1, _("Address type not supported")); } @@ -804,8 +803,7 @@ static void evaluate(expression_t * e) /* Si B et C sont du même type, on jette l'éponge... */ - if (e->child->child->next->child->e_subtype == - e->child->child->next->child->next->e_subtype) { + if (e->child->child->next->child->e_subtype == e->child->child->next->child->next->e_subtype) { exception(1, _("Expression too complex or invalid")); } @@ -830,8 +828,7 @@ static void evaluate(expression_t * e) et si c'est le cas, il ne faut pas que ce soit - C. Sinon nous ne devons pas avoir de patterns pour B ou C. */ - if ((e->child->child->next->child->next->e_subtype == E_LABEL) && - (e->child->child->next->op == OP_MOINS)) { + if ((e->child->child->next->child->next->e_subtype == E_LABEL) && (e->child->child->next->op == OP_MOINS)) { exception(1, _("Address type not supported")); } @@ -841,8 +838,7 @@ static void evaluate(expression_t * e) /* Si B et C sont du même type, on jette l'éponge... */ - if (e->child->child->next->child->e_subtype == - e->child->child->next->child->next->e_subtype) { + if (e->child->child->next->child->e_subtype == e->child->child->next->child->next->e_subtype) { exception(1, _("Expression too complex or invalid")); } @@ -901,11 +897,9 @@ static void evaluate(expression_t * e) } else if (e->child->child->next->child->next->e_subtype == E_VALUE) { /* Quasiment la même chose qu'au dessus... */ if (e->child->child->next->op == OP_MOINS) { - e->child->child->avalue -= - e->child->child->next->child->avalue; + e->child->child->avalue -= e->child->child->next->child->avalue; } else { - e->child->child->avalue += - e->child->child->next->child->avalue; + e->child->child->avalue += e->child->child->next->child->avalue; } t = e->child->child->next; e->child->child->next = t->child; @@ -915,8 +909,7 @@ static void evaluate(expression_t * e) } else { /* Si B et C sont du même type, on jette l'éponge... */ - if (e->child->child->next->child->e_subtype == - e->child->child->next->child->next->e_subtype) { + if (e->child->child->next->child->e_subtype == e->child->child->next->child->next->e_subtype) { exception(1, _("Expression too complex or invalid")); } @@ -1296,29 +1289,23 @@ static instruct_t *e_match_i(phon_t * phons, instruct_t * instructs, expression_ } #ifdef DEBUG if (instructs) { - fprintf(stderr, " o Instruction contenant %i champs explicites et %i champs implicites.\n", - instructs->nbexplicit, instructs->nbimplicit); + fprintf(stderr, " o Instruction contenant %i champs explicites et %i champs implicites.\n", instructs->nbexplicit, instructs->nbimplicit); fprintf(stderr, " => Champs explicites.\n"); for (i = 0; i < instructs->nbexplicit; i++) { fprintf(stderr, " + %s <= %s (type %s)\n", - instructs->names[i], - instructs->strings[i] ? instructs->strings[i] : "Pas de chaîne associée", - instructs->etypes[i] ? "prédéfinit" : "direct"); + instructs->names[i], instructs->strings[i] ? instructs->strings[i] : "Pas de chaîne associée", instructs->etypes[i] ? "prédéfinit" : "direct"); } fprintf(stderr, " => Champs implicites.\n"); for (i = 0; i < instructs->nbimplicit; i++) { switch (instructs->itypes[i]) { case 0: - fprintf(stderr, " + %s <= %s (type direct)\n", instructs->implicits[i], - instructs->istrings[i]); + fprintf(stderr, " + %s <= %s (type direct)\n", instructs->implicits[i], instructs->istrings[i]); break; case 1: - fprintf(stderr, " + %s <= %s (type prédéfinit)\n", instructs->implicits[i], - instructs->istrings[i]); + fprintf(stderr, " + %s <= %s (type prédéfinit)\n", instructs->implicits[i], instructs->istrings[i]); break; case 2: - fprintf(stderr, " + %s <= %i (type valeur)\n", instructs->implicits[i], - instructs->ivalues[i]); + fprintf(stderr, " + %s <= %i (type valeur)\n", instructs->implicits[i], instructs->ivalues[i]); break; } } @@ -1354,9 +1341,8 @@ static void evaluate_pattern(_TableauVariable * it, expression_t * e) } else { if (m->string) { if (m->string[0] != 'P') { - exception(1, - _ - ("Error in the metalanguage (pattern should be here if not a constant type)"));} + exception(1, _("Error in the metalanguage (pattern should be here if not a constant type)")); + } t = (expression_t *) Emalloc(sizeof(expression_t)); t->next = t->child = t->prev = t->father = NULL; t->e_type = t->e_subtype = E_VALUE; @@ -1396,9 +1382,8 @@ static void evaluate_pattern(_TableauVariable * it, expression_t * e) } else { if (m->string) { if (m->string[0] != 'P') { - exception(1, - _ - ("Error in the metalanguage (pattern should be here if not a constant type)"));} + exception(1, _("Error in the metalanguage (pattern should be here if not a constant type)")); + } t = (expression_t *) Emalloc(sizeof(expression_t)); t->next = t->child = t->prev = t->father = NULL; t->e_type = t->e_subtype = E_VALUE; @@ -1423,9 +1408,8 @@ static void evaluate_pattern(_TableauVariable * it, expression_t * e) } else { if (m->string) { if (m->string[0] != 'P') { - exception(1, - _ - ("Error in the metalanguage (pattern should be here if not a constant type)"));} + exception(1, _("Error in the metalanguage (pattern should be here if not a constant type)")); + } t = (expression_t *) Emalloc(sizeof(expression_t)); t->next = t->child = t->prev = t->father = NULL; t->e_type = t->e_subtype = E_VALUE; @@ -1623,12 +1607,11 @@ void asm_eol(void) pushdword(0, e_current); } } else { - exception(1, - _ - ("Unknow constant type in the meta language"));} + exception(1, _("Unknow constant type in the meta language")); + } } else { - InsererVarDansTab(&it, - CreerElement(instr->names[i], e_current));} + InsererVarDansTab(&it, CreerElement(instr->names[i], e_current)); + } break; case 'O': if (instr->etypes) { @@ -1639,9 +1622,8 @@ void asm_eol(void) pushdword(0, e_current); } } else { - exception(1, - _ - ("Unknow constant type in the meta language"));} + exception(1, _("Unknow constant type in the meta language")); + } } break; case 'P': @@ -1653,8 +1635,7 @@ void asm_eol(void) t->symbol = NULL; InsererVarDansTab(&it, CreerElement(instr->names[i], t)); #ifdef DEBUG - fprintf(stderr, "On a %s qui vaut %i\n", instr->names[i], - e_current->index); + fprintf(stderr, "On a %s qui vaut %i\n", instr->names[i], e_current->index); #endif evaluate_pattern(&it, e_current); break; @@ -1831,8 +1812,7 @@ void asm_eof(FILE * f) pushcontext(_("Dumping text segment")); for (ttext = ttext->next; ttext; ttext = ttext->next) { - sprintf(errctx, _("Processing word number %i coming from line %i of the file %s."), - ttext->offset, ttext->line, ttext->filename); + sprintf(errctx, _("Processing word number %i coming from line %i of the file %s."), ttext->offset, ttext->line, ttext->filename); #ifdef DEBUG fprintf(stderr, "%s\n", errctx); #endif @@ -1887,8 +1867,7 @@ void asm_eof(FILE * f) && (ttext->Expr->child->next->e_subtype == E_LABEL))) { if (ttext->Expr->child->e_subtype == E_LABEL) { #ifdef DEBUG - fprintf(stderr, "Symbole externe %s\n", - ttext->Expr->child->symbol); + fprintf(stderr, "Symbole externe %s\n", ttext->Expr->child->symbol); #endif a = ttext->Expr->child->next->avalue; nbsymbols++; @@ -1899,8 +1878,7 @@ void asm_eof(FILE * f) nbe++; } else { #ifdef DEBUG - fprintf(stderr, "Symbole externe %s\n", - ttext->Expr->child->next->symbol); + fprintf(stderr, "Symbole externe %s\n", ttext->Expr->child->next->symbol); #endif a = ttext->Expr->child->avalue; nbsymbols++; @@ -1973,8 +1951,7 @@ void asm_eof(FILE * f) pushcontext(_("Dumping data segment")); for (tdata = tdata->next; tdata; tdata = tdata->next) { - sprintf(errctx, _("Processing word number %i coming from line %i of the file %s."), - tdata->offset, tdata->line, tdata->filename); + sprintf(errctx, _("Processing word number %i coming from line %i of the file %s."), tdata->offset, tdata->line, tdata->filename); #ifdef DEBUG fprintf(stderr, "%s\n", errctx); #endif @@ -2059,8 +2036,7 @@ void asm_eof(FILE * f) pushcontext(_("Dumping bss segment")); for (tbss = tbss->next; tbss; tbss = tbss->next) { - sprintf(errctx, _("Processing word number %i coming from line %i of the file %s."), - tbss->offset, tbss->line, tbss->filename); + sprintf(errctx, _("Processing word number %i coming from line %i of the file %s."), tbss->offset, tbss->line, tbss->filename); pushcontext(errctx); if (!tbss->size) { @@ -2105,9 +2081,7 @@ void asm_eof(FILE * f) unlink("__text__"); fprintf(stderr, - _ - ("Statistics: %i words of text, %i words of data, and %i words reserved.\n%i symbols generated with %i internal and %i external.\n"), - s_text, s_data, s_bss, nbsymbols, nbi, nbe); + _("Statistics: %i words of text, %i words of data, and %i words reserved.\n%i symbols generated with %i internal and %i external.\n"), s_text, s_data, s_bss, nbsymbols, nbi, nbe); } /* Diverses fonctions pour faire plein de free() partout */ diff --git a/lib/linker.c b/lib/linker.c index 8582142..e748a2a 100644 --- a/lib/linker.c +++ b/lib/linker.c @@ -236,8 +236,7 @@ static void dumprelog(FILE * f) break; } #ifdef DEBUG - fprintf(stderr, "Relogement effectué sur %i (text), de %i octets pour le symbole %s\n", - s->offset, decal, s->name); + fprintf(stderr, "Relogement effectué sur %i (text), de %i octets pour le symbole %s\n", s->offset, decal, s->name); #endif objects[s->objindex]->text[s->offset] += decal; writeword(objects[s->objindex]->textstart + s->offset, f); @@ -258,8 +257,7 @@ static void dumprelog(FILE * f) break; } #ifdef DEBUG - fprintf(stderr, "Relogement effectué sur %i (data), de %i octets pour le symbole %s\n", - s->offset, decal, s->name); + fprintf(stderr, "Relogement effectué sur %i (data), de %i octets pour le symbole %s\n", s->offset, decal, s->name); #endif objects[s->objindex]->data[s->offset] += decal; writeword(textsize + objects[s->objindex]->datastart + s->offset, f); @@ -310,8 +308,7 @@ void dumpfile(char *nom) popcontext(); popcontext(); - fprintf(stderr, _("Statistics: %i words of text, %i words of data and reserving %i words\n"), textsize, - datasize, bsssize); + fprintf(stderr, _("Statistics: %i words of text, %i words of data and reserving %i words\n"), textsize, datasize, bsssize); fprintf(stderr, _("Output file size: %i words containing %i relocating offsets.\n"), ftell(f), nbrsymbs); fclose(f); } @@ -329,8 +326,7 @@ void init(int n) for (i = 0; i < n; i++) { objects[i] = (object_t *) Emalloc(sizeof(object_t)); - objects[i]->s_text = objects[i]->s_data = objects[i]->s_bss = objects[i]->textstart = - objects[i]->datastart = 0; + objects[i]->s_text = objects[i]->s_data = objects[i]->s_bss = objects[i]->textstart = objects[i]->datastart = 0; objects[i]->text = objects[i]->data = NULL; } @@ -63,8 +63,7 @@ découpage en sous routines. */ void meta_parse_line(char *line) { - char buffer[BUFSIZ], *first = NULL, m = 0, *p1 = NULL, *p2 = NULL, *Fnames[MAXF], *Fimplicits[MAXF], - *Snames[MAXF], *Sinames[MAXF], gotname = 0, goteoi = 0, errbuff[BUFSIZ]; + char buffer[BUFSIZ], *first = NULL, m = 0, *p1 = NULL, *p2 = NULL, *Fnames[MAXF], *Fimplicits[MAXF], *Snames[MAXF], *Sinames[MAXF], gotname = 0, goteoi = 0, errbuff[BUFSIZ]; phon_t *phon = NULL; field_t *field = NULL; pattern_t *pattern = NULL; @@ -200,8 +199,7 @@ void meta_parse_line(char *line) pattern->next = patterns->next; patterns->next = pattern; pattern->name = first; - pattern->expr = - (metaexpr_t **) Emalloc(nbfields * sizeof(metaexpr_t *)); + pattern->expr = (metaexpr_t **) Emalloc(nbfields * sizeof(metaexpr_t *)); for (i = 0; i < nbfields; i++) { pattern->expr[i] = tabmetaexpr[i]; } @@ -579,20 +577,16 @@ void main(void) fprintf(stderr, " + %s (%s) type: %s\n", pattern->expr[i]->name ? pattern->expr[i]->name : "Opérateur [", pattern->expr[i]->string ? pattern->expr[i]->string : "Aucune chaîne associée", - pattern->expr[i]->type ? "Constante prédéfinie" : pattern->expr[i]-> - left ? "Binaire" : pattern->expr[i]->right ? "Unaire" : "Feuille"); + pattern->expr[i]->type ? "Constante prédéfinie" : pattern->expr[i]->left ? "Binaire" : pattern->expr[i]->right ? "Unaire" : "Feuille"); if (pattern->expr[i]->left) { fprintf(stderr, " - gauche: %s (%s) type: %s\n", pattern->expr[i]->left->name ? pattern->expr[i]->left->name : "Opérateur [", - pattern->expr[i]->left->string ? pattern->expr[i]->left-> - string : "Aucune chaîne associée", - pattern->expr[i]->left->type ? "Constante prédéfinie" : "Feuille"); + pattern->expr[i]->left->string ? pattern->expr[i]->left->string : "Aucune chaîne associée", pattern->expr[i]->left->type ? "Constante prédéfinie" : "Feuille"); } if (pattern->expr[i]->right) { fprintf(stderr, " - droite: %s (%s) type: %s\n", pattern->expr[i]->right->name ? pattern->expr[i]->right->name : "Opérateur [", - pattern->expr[i]->right->string ? pattern->expr[i]->right-> - string : "Aucune chaîne associée", + pattern->expr[i]->right->string ? pattern->expr[i]->right->string : "Aucune chaîne associée", pattern->expr[i]->right->type ? "Constante prédéfinie" : "Feuille"); } } @@ -600,29 +594,23 @@ void main(void) fprintf(stderr, "\nListe des instructions:\n"); for (instruct = instructs->next; instruct; instruct = instruct->next) { - fprintf(stderr, " o Instruction contenant %i champs explicites et %i champs implicites.\n", - instruct->nbexplicit, instruct->nbimplicit); + fprintf(stderr, " o Instruction contenant %i champs explicites et %i champs implicites.\n", instruct->nbexplicit, instruct->nbimplicit); fprintf(stderr, " => Champs explicites.\n"); for (i = 0; i < instruct->nbexplicit; i++) { fprintf(stderr, " + %s <= %s (type %s)\n", - instruct->names[i], - instruct->strings[i] ? instruct->strings[i] : "Pas de chaîne associée", - instruct->etypes[i] ? "prédéfinit" : "direct"); + instruct->names[i], instruct->strings[i] ? instruct->strings[i] : "Pas de chaîne associée", instruct->etypes[i] ? "prédéfinit" : "direct"); } fprintf(stderr, " => Champs implicites.\n"); for (i = 0; i < instruct->nbimplicit; i++) { switch (instruct->itypes[i]) { case 0: - fprintf(stderr, " + %s <= %s (type direct)\n", instruct->implicits[i], - instruct->istrings[i]); + fprintf(stderr, " + %s <= %s (type direct)\n", instruct->implicits[i], instruct->istrings[i]); break; case 1: - fprintf(stderr, " + %s <= %s (type prédéfinit)\n", instruct->implicits[i], - instruct->istrings[i]); + fprintf(stderr, " + %s <= %s (type prédéfinit)\n", instruct->implicits[i], instruct->istrings[i]); break; case 2: - fprintf(stderr, " + %s <= %i (type valeur)\n", instruct->implicits[i], - instruct->ivalues[i]); + fprintf(stderr, " + %s <= %i (type valeur)\n", instruct->implicits[i], instruct->ivalues[i]); break; } } diff --git a/lib/simulator.c b/lib/simulator.c index 380c705..661ccd3 100644 --- a/lib/simulator.c +++ b/lib/simulator.c @@ -228,8 +228,7 @@ void DecodeExec(Uint32 instruction) if (champ(Champ1(instruction), 2) == 0) { /* r/m de arg1 = 0 */ EcrireRegistre(Champ3(instruction), LireRegistre(Champ2(instruction))); } else { - ST(Adresse(Champ1(instruction), instruction), - LireRegistre(Champ2(instruction))); + ST(Adresse(Champ1(instruction), instruction), LireRegistre(Champ2(instruction))); } } else { /* arg2 = imm32 */ if (champ(Champ1(instruction), 2) == 0) { /* r/m de arg1 = 0 */ @@ -246,8 +245,7 @@ void DecodeExec(Uint32 instruction) if (champ(Champ1(instruction), 2) == 0) { /* r/m de arg1 = 0 */ EcrireRegistre(Champ2(instruction), LireRegistre(Champ3(instruction))); } else { - EcrireRegistre(Champ2(instruction), - LD(Adresse(Champ1(instruction), instruction))); + EcrireRegistre(Champ2(instruction), LD(Adresse(Champ1(instruction), instruction))); } } else { /* arg2 = imm32 */ exception(1, _("MOV: Memory to Memory Forbidden On This Type Of Processor")); @@ -402,8 +400,7 @@ void AfficheReg(void) // affiche reg } fprintf(stderr, "\n"); } - fprintf(stderr, "Rg: %08lX | Rd: %08lX | Flag: %08lX | PC: %08lX\n", LireRegistreRG(), LireRegistreRD(), - LireRegistreFLAG(), LireRegistrePC()); + fprintf(stderr, "Rg: %08lX | Rd: %08lX | Flag: %08lX | PC: %08lX\n", LireRegistreRG(), LireRegistreRD(), LireRegistreFLAG(), LireRegistrePC()); } void Debogueur(void) @@ -415,10 +412,8 @@ void Debogueur(void) while (!out) { AfficheReg(); fprintf(stderr, "Opcode: %02X, extension: %02X, champ1: %02X, champ2: %02X, champ3: %02X\n", - Opcode(instruction), Extension(instruction), Champ1(instruction), Champ2(instruction), - Champ3(instruction)); - fprintf(stderr, "%08lX:%08lX - %08lX - %08lX > ", LireRegistrePC(), instruction, - LD(LireRegistrePC() + 1), LD(LireRegistrePC() + 2)); + Opcode(instruction), Extension(instruction), Champ1(instruction), Champ2(instruction), Champ3(instruction)); + fprintf(stderr, "%08lX:%08lX - %08lX - %08lX > ", LireRegistrePC(), instruction, LD(LireRegistrePC() + 1), LD(LireRegistrePC() + 2)); switch (fgetc(input)) { case 'G': |