mirror of https://github.com/yasm/yasm.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
861 B
53 lines
861 B
#include <stdio.h> |
|
#include <stdlib.h> |
|
|
|
#include "globals.h" |
|
#include "parse.h" |
|
#include "dfa.h" |
|
|
|
char *fileName; |
|
int sFlag = 0; |
|
int bFlag = 0; |
|
|
|
int main(int argc, char *argv[]){ |
|
FILE *f; |
|
|
|
fileName = NULL; |
|
if(argc == 1) |
|
goto usage; |
|
while(--argc > 1){ |
|
char *p = *++argv; |
|
while(*++p != '\0'){ |
|
switch(*p){ |
|
case 'e': |
|
xlat = asc2ebc; |
|
talx = ebc2asc; |
|
break; |
|
case 's': |
|
sFlag = 1; |
|
break; |
|
case 'b': |
|
sFlag = 1; |
|
bFlag = 1; |
|
break; |
|
default: |
|
goto usage; |
|
} |
|
} |
|
} |
|
fileName = *++argv; |
|
if(fileName[0] == '-' && fileName[1] == '\0'){ |
|
fileName = "<stdin>"; |
|
f = stdin; |
|
} else { |
|
if((f = fopen(fileName, "rt")) < 0){ |
|
fprintf(stderr, "can't open %s\n", fileName); |
|
return 1; |
|
} |
|
} |
|
parse(f, stdout); |
|
return 0; |
|
usage: |
|
fputs("usage: re2c [-esb] name\n", stderr); |
|
return 2; |
|
}
|
|
|