root/test/unit/linetok/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 "cmem.h"
   4 #include "cerr.h"
   5 #include "word.h"
   6 
   7 int main(){
   8     int i, j;
   9     char *testline[] = {
  10         /* "IOTEST START\n", */
  11         "       OUT OBUF1,OLEN1\n",
  12         "       OUT OBUF2,OLEN2 ;comment\n",
  13         "       OUT OBUF1,OLEN1 \n",
  14         "       OUT OBUF1,OLEN1 \n",
  15         "       OUT OBUF2,OLEN2 \n",
  16         "       OUT OBUF1, OLEN1 \n",
  17         "BEGIN  LD      GR1, A\n",
  18         "\n",
  19         ";comment\n",
  20         "       ;comment\n"
  21     };
  22 
  23     CMDLINE *testcl = malloc(sizeof(CMDLINE));
  24     addcerrlist_tok();
  25     for(i = 0; i < sizeof testline /sizeof testline[0]; i++) {
  26         cerr_init();    /* エラーの初期化 */
  27         printf("%d: %s", i, testline[i]);
  28         testcl = linetok(testline[i]);
  29         if(testcl == NULL) {
  30             puts("cl is NULL");
  31         } else {
  32             if(testcl->label != NULL){
  33                 printf("cl->label: %s\n", testcl->label);
  34             }
  35             if(testcl->cmd != NULL){
  36                 printf("cl->cmd: %s\n", testcl->cmd);
  37                 printf("cl->opdc: %d\n", testcl->opd->opdc);
  38                 for(j = 0; j < testcl->opd->opdc; j++) {
  39                     printf("cl->opdv[%d]: %s\n", j, testcl->opd->opdv[j]);
  40                 }
  41             }
  42         }
  43         if(cerr->num != 0) {
  44             printf("\terror - %d: %s\n", cerr->num, cerr->msg);
  45         }
  46         printf("\n");
  47     }
  48     freecerr();
  49     return 0;
  50 }

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