root/test/unit/getgr/cmd.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 #include <stdio.h>
   2 #include "assemble.h"
   3 #include "cerr.h"
   4 
   5 WORD getgr(const char *str, bool is_x);
   6 
   7 int main(){
   8     int i, j;
   9     char *title = malloc(64);
  10     WORD r;
  11     bool is_x[] = {
  12         false, true
  13     };
  14     char *str[] = {
  15         "", "0", "aaa", "GR", "GR8", "GR20",
  16         "GR0", "GR1", "GR2", "GR3", "GR4", "GR5", "GR6", "GR7"
  17     };
  18     static CERR cerr_getgr[] = {
  19         { 120, "GR0 in operand x" },
  20     };
  21 
  22     cerr_init();    /* エラーの初期化 */
  23     addcerrlist(ARRAYSIZE(cerr_getgr), cerr_getgr);
  24     for(i = 0; i <= 1; i++) {
  25         title = (is_x[i] == false) ? "Generel Register" : "Index Register";
  26         printf("== %s ==\n", title);
  27         for(j = 0; j < ARRAYSIZE(str); j++) {
  28             cerr->num = 0;
  29             r = getgr(str[j], is_x[i]);
  30             printf("%s\t#%04X", str[j], r);
  31             if(cerr->num > 0) {
  32                 printf("\tError - %d\t%s", cerr->num, cerr->msg);
  33             }
  34             printf("\n");
  35         }
  36     }
  37     freecerr();
  38     return 0;
  39 }

/* [<][>][^][v][top][bottom][index][help] */