25 while (Tokens[count]) {
45 char Buffer[BUFFSIZE];
58 Res = fgets(Buffer, BUFFSIZE, InFile);
63 vpr_printf(TIO_MESSAGE_ERROR,
"Unexpected error reading file\n");
70 Last = Buffer + strlen(Buffer);
71 if ((Last > Buffer) && (
'\n' == Last[-1])) {
74 if ((Last > Buffer) && (
'\r' == Last[-1])) {
79 while ((Last > Buffer) && (
'\\' == Last[-1])) {
84 Res = fgets(Last, (BUFFSIZE - (Last - Buffer)), InFile);
90 "Unexpected error reading file\n");
97 Last = Buffer + strlen(Buffer);
98 if ((Last > Buffer) && (
'\n' == Last[-1])) {
101 if ((Last > Buffer) && (
'\r' == Last[-1])) {
117 assert(Last < (Buffer + BUFFSIZE));
124 if ((
' ' == *Cur) || (
'\t' == *Cur)) {
130 if ((
' ' != *Cur) && (
'\t' != *Cur)) {
138 }
while (0 == TokenCount);
142 Len = (
sizeof(char) * Len) +
143 (
sizeof(char) * TokenCount);
147 Tokens = (
char **)
my_malloc(
sizeof(
char *) * (TokenCount + 1));
148 *Tokens = (
char *)
my_malloc(
sizeof(
char) * Len);
157 if ((
' ' == *Cur) || (
'\t' == *Cur)) {
167 if ((
' ' != *Cur) && (
'\t' != *Cur)) {
168 Tokens[CurToken] = Dst;
181 assert(CurToken == TokenCount);
184 Tokens[CurToken] = NULL;
char ** ReadLineTokens(INOUTP FILE *InFile, INOUTP int *LineNum)
static void * my_malloc(int ibytes)
int CountTokens(INP char **Tokens)
void FreeTokens(INOUTP char ***TokensPtr)