summaryrefslogtreecommitdiff
path: root/lib/memoire.c
diff options
context:
space:
mode:
authorPixel <>2001-04-17 04:05:52 +0000
committerPixel <>2001-04-17 04:05:52 +0000
commit5aed7634c8993e3366817c4b20fca1aa18eacf21 (patch)
treecfb6c00a13b8f213255ea231a3d814f61ab2964b /lib/memoire.c
parent55f981c9fca048fba18d0538be4ed5dc1cc3fe11 (diff)
Indentation plus faible
Diffstat (limited to 'lib/memoire.c')
-rw-r--r--lib/memoire.c158
1 files changed, 79 insertions, 79 deletions
diff --git a/lib/memoire.c b/lib/memoire.c
index e38f0d7..067f8f8 100644
--- a/lib/memoire.c
+++ b/lib/memoire.c
@@ -25,113 +25,113 @@ Uint32 *memoire_principale;
void InitMemoire(void)
{
- memoire_principale = (Uint32 *) Emalloc(TAILLE_MEMOIRE * sizeof(Uint32));
+ memoire_principale = (Uint32 *) Emalloc(TAILLE_MEMOIRE * sizeof(Uint32));
}
void FlushMemoire(void)
{
- free(memoire_principale);
+ free(memoire_principale);
}
/* Lit le mot qui se trouve à l'offset 'offset' en mémoire */
Uint32 LD(Uint32 offset)
{
- Uint32 i;
+ Uint32 i;
- switch (offset) {
- case 0xffffff00:
- initterm();
- i = !feof(input);
- clearterm();
- return (i);
- case 0xffffff01:
- initterm();
- i = fgetc(input);
- clearterm();
- break;
- case 0xffffff05:
- fscanf(input, "%i", &i);
- break;
- default:
- if (offset >= TAILLE_MEMOIRE) {
- exception(1, _("Invalid Memory Adress"));
- } else {
- i = memoire_principale[offset];
- }
- break;
+ switch (offset) {
+ case 0xffffff00:
+ initterm();
+ i = !feof(input);
+ clearterm();
+ return (i);
+ case 0xffffff01:
+ initterm();
+ i = fgetc(input);
+ clearterm();
+ break;
+ case 0xffffff05:
+ fscanf(input, "%i", &i);
+ break;
+ default:
+ if (offset >= TAILLE_MEMOIRE) {
+ exception(1, _("Invalid Memory Adress"));
+ } else {
+ i = memoire_principale[offset];
}
- return i;
+ break;
+ }
+ return i;
}
static void copychaine(Uint32 * t, char *s)
{
- while (*s) {
- *(t++) = *(s++);
- }
+ while (*s) {
+ *(t++) = *(s++);
+ }
}
static void litchaine(char *s, Uint32 * t)
{
- while (*t) {
- *(s++) = *(t++);
- }
- *s = 0;
+ while (*t) {
+ *(s++) = *(t++);
+ }
+ *s = 0;
}
static void AfficheBinaire(Uint32 valeur)
{
- if (valeur) {
- AfficheBinaire(valeur >> 1);
- fprintf(stdout, "%i", valeur & 1);
- }
+ if (valeur) {
+ AfficheBinaire(valeur >> 1);
+ fprintf(stdout, "%i", valeur & 1);
+ }
}
/* Ecrit le mot 'valeur' à l'offset 'offset' en mémoire */
void ST(Uint32 offset, Uint32 valeur)
{
- Uint32 oldOC;
+ Uint32 oldOC;
- switch (offset) {
- case 0xffffff02:
- fgets(temp, BUFSIZ, stdin);
- copychaine(&memoire_principale[valeur], temp);
- break;
- case 0xffffff03:
- fprintf(stdout, "%c", valeur);
- break;
- case 0xffffff04:
- litchaine(temp, &memoire_principale[valeur]);
- fprintf(stdout, "%s", temp);
- break;
- case 0xffffff06:
- fprintf(stdout, "%i", valeur);
- break;
- case 0xffffff07:
- fprintf(stdout, "%x", valeur);
- break;
- case 0xffffff08:
- fprintf(stdout, "%o", valeur);
- break;
- case 0xffffff09:
- if (valeur) {
- AfficheBinaire(valeur);
- } else {
- fprintf(stdout, "0");
- }
- break;
- case 0xffffff0a:
- litchaine(temp, &memoire_principale[valeur]);
- oldOC = LireRegistrePC();
- ChargeBinaire(temp);
- EcrireRegistrePC(oldOC);
- HasToRun = 1;
- break;
- default:
- if (offset < 0 || offset >= TAILLE_MEMOIRE)
- exception(1, _("Invalid Memory Adress"));
- else
- memoire_principale[offset] = valeur;
- break;
+ switch (offset) {
+ case 0xffffff02:
+ fgets(temp, BUFSIZ, stdin);
+ copychaine(&memoire_principale[valeur], temp);
+ break;
+ case 0xffffff03:
+ fprintf(stdout, "%c", valeur);
+ break;
+ case 0xffffff04:
+ litchaine(temp, &memoire_principale[valeur]);
+ fprintf(stdout, "%s", temp);
+ break;
+ case 0xffffff06:
+ fprintf(stdout, "%i", valeur);
+ break;
+ case 0xffffff07:
+ fprintf(stdout, "%x", valeur);
+ break;
+ case 0xffffff08:
+ fprintf(stdout, "%o", valeur);
+ break;
+ case 0xffffff09:
+ if (valeur) {
+ AfficheBinaire(valeur);
+ } else {
+ fprintf(stdout, "0");
}
- fflush(stdout);
+ break;
+ case 0xffffff0a:
+ litchaine(temp, &memoire_principale[valeur]);
+ oldOC = LireRegistrePC();
+ ChargeBinaire(temp);
+ EcrireRegistrePC(oldOC);
+ HasToRun = 1;
+ break;
+ default:
+ if (offset < 0 || offset >= TAILLE_MEMOIRE)
+ exception(1, _("Invalid Memory Adress"));
+ else
+ memoire_principale[offset] = valeur;
+ break;
+ }
+ fflush(stdout);
}