version 1.20, 2018/11/02 01:33:26 |
version 1.21, 2020/10/07 23:53:25 |
|
|
/* $OpenXM: OpenXM/src/k097/d.c,v 1.19 2016/04/02 08:20:09 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/k097/d.c,v 1.20 2018/11/02 01:33:26 takayama Exp $ */ |
/* simple.c, 1996, 1/1 --- 1/5 */ |
/* simple.c, 1996, 1/1 --- 1/5 */ |
#include <stdio.h> |
#include <stdio.h> |
#include <ctype.h> |
#include <ctype.h> |
#include <setjmp.h> |
#include <setjmp.h> |
#include <stdlib.h> |
#include <stdlib.h> |
|
#include <unistd.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
#include "d.h" |
#include "d.h" |
Line 49 int Interactive = 1; |
|
Line 50 int Interactive = 1; |
|
static int isThereStdin(); |
static int isThereStdin(); |
#define MARK_CHAR 3 |
#define MARK_CHAR 3 |
|
|
main2(int argc, char *argv[]) { |
void main2(int argc, char *argv[]) { |
FILE *f; |
FILE *f; |
FILE *outf; |
FILE *outf; |
char name[1024]; |
char name[1024]; |
Line 79 main2(int argc, char *argv[]) { |
|
Line 80 main2(int argc, char *argv[]) { |
|
} |
} |
} |
} |
|
|
repl(FILE *inFile,FILE *outFile) { |
void repl(FILE *inFile,FILE *outFile) { |
int c; |
int c; |
int t; |
int t; |
Inop = newObject_d(); |
Inop = newObject_d(); |
Line 160 repl(FILE *inFile,FILE *outFile) { |
|
Line 161 repl(FILE *inFile,FILE *outFile) { |
|
case INCREMENT: printf("\nKClex returns --- ++."); break; |
case INCREMENT: printf("\nKClex returns --- ++."); break; |
case DECREMENT: printf("\nKClex returns --- --."); break; |
case DECREMENT: printf("\nKClex returns --- --."); break; |
case MEMBER: printf("\nKClex returns --- ->."); break; |
case MEMBER: printf("\nKClex returns --- ->."); break; |
case RESIDUEPUT: printf("\nKClex returns --- %=."); break; |
case RESIDUEPUT: printf("\nKClex returns --- %%=."); break; |
case NEGATEPUT: printf("\nKClex returns --- ^=."); break; |
case NEGATEPUT: printf("\nKClex returns --- ^=."); break; |
case MULTPUT: printf("\nKClex returns --- *=."); break; |
case MULTPUT: printf("\nKClex returns --- *=."); break; |
|
|
|
|
|
|
} |
} |
|
|
KCerror(char *s) /* You need this function. Otherwise, you get core. */ |
int KCerror(char *s) /* You need this function. Otherwise, you get core. */ |
{ |
{ |
K00recoverFromError(); |
K00recoverFromError(); |
fprintf(stderr,"\nSyntax Error in the line %d:%s\n",Linenumber,s); |
fprintf(stderr,"\nSyntax Error in the line %d:%s\n",Linenumber,s); |
Line 610 KCerror(char *s) /* You need this function. Otherwis |
|
Line 611 KCerror(char *s) /* You need this function. Otherwis |
|
exit(1); |
exit(1); |
} |
} |
|
|
readcomment() { |
int readcomment() { |
int c; |
int c; |
while (1) { |
while (1) { |
c = fsgetc(Inop); |
c = fsgetc(Inop); |
Line 674 char *readstring() { |
|
Line 675 char *readstring() { |
|
} |
} |
|
|
|
|
readchar() { |
int readchar() { |
int c; |
int c; |
if (Replace) putchar0('\''); |
if (Replace) putchar0('\''); |
c = fsgetc(Inop); /* 'c.' '\.c' */ |
c = fsgetc(Inop); /* 'c.' '\.c' */ |
|
|
return(c); |
return(c); |
} |
} |
|
|
putchar0(c) |
void putchar0(c) |
int c; |
int c; |
{ |
{ |
if (c > 0) fputc(c,outfile); |
if (c > 0) fputc(c,outfile); |
} |
} |
|
|
printf0(s) |
void printf0(s) |
char *s; |
char *s; |
{ |
{ |
int i = 0; |
int i = 0; |
while (s[i] != '\0') putchar0(s[i++]); |
while (s[i] != '\0') putchar0(s[i++]); |
} |
} |
|
|
printf1(s) |
void printf1(s) |
char *s; |
char *s; |
{ |
{ |
int i = 0; |
int i = 0; |
|
|
while (s[i] != '\0') putchar0(s[i++]); |
while (s[i] != '\0') putchar0(s[i++]); |
} |
} |
|
|
isReserved(s) |
int isReserved(s) |
char *s; |
char *s; |
{ |
{ |
char *r[] = {"auto","break","case","char","const","continue", |
char *r[] = {"auto","break","case","char","const","continue", |
|
|
|
|
} |
} |
|
|
shouldReplace(s) |
int shouldReplace(s) |
char *s; |
char *s; |
{ |
{ |
char *r[] = {"dummy"}; |
char *r[] = {"dummy"}; |
Line 1021 objectp checkIfTheFileExists(objectp op) { |
|
Line 1022 objectp checkIfTheFileExists(objectp op) { |
|
} |
} |
} |
} |
} |
} |
close(fp); |
fclose(fp); |
op = newObject_d(); |
op = newObject_d(); |
op->tag = Sstring; |
op->tag = Sstring; |
s = (char *)GC_malloc(sizeof(char)*(strlen(fname)+1)); |
s = (char *)GC_malloc(sizeof(char)*(strlen(fname)+1)); |
Line 1137 void showStringBuff(objectp op) |
|
Line 1138 void showStringBuff(objectp op) |
|
if (K00_verbose) { |
if (K00_verbose) { |
fprintf(stderr,"stringBuff ptr = %d, ",ptr); |
fprintf(stderr,"stringBuff ptr = %d, ",ptr); |
fprintf(stderr,"sb[ptr] = %x,%d",(sb->str)[ptr],(sb->str)[ptr]); |
fprintf(stderr,"sb[ptr] = %x,%d",(sb->str)[ptr],(sb->str)[ptr]); |
fprintf(stderr,"Saki(yomi) = %x \n",Saki,Saki); |
fprintf(stderr,"Saki(yomi) = %x,%d \n",Saki,Saki); |
} |
} |
if (ptr == 0 && Saki == -1) { |
if (ptr == 0 && Saki == -1) { |
fprintf(stderr," ; was expected.\n"); |
fprintf(stderr," ; was expected.\n"); |