#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define MAXLEN 100
FILE *out;
char token[20],s[20];
char filename[25],outfile[25];
char ch;
FILE *fp = NULL;
char buff[MAXLEN];
int bufflen = 0;
int buffpos = -1;
char blank[32][10]={"main","int","double","char","if","then","do",
"else","float","for","switch","continue","void","break","while"};
int readchar(char * filename)
{
if (fp == NULL)
{
if ((fp = fopen(filename,"r")) == NULL)
{
printf("File open error!\n");
return 0;
}
}
if (buffpos == -1)
{
if (feof(fp))
{
fclose(fp);
return -1;
}
bufflen=fread(buff,sizeof(char),MAXLEN,fp);
buffpos = 0;
}
if (buffpos < bufflen)
ch = buff[buffpos++];
if (buffpos >= bufflen)
buffpos = -1;
return ch;
}
void getbc( )
{
while(isspace(ch))
ch=readchar(filename);
}
void concatenate(char ch)
{
strcat(token,&ch);
}
void error( )
{
if(ch!=-1)
fputs("\n DATA ERROR!",out);
}