Go to the source code of this file.
int CountTokens |
( |
INP char ** |
Tokens | ) |
|
Definition at line 19 of file ReadLine.c.
25 while (Tokens[count]) {
void FreeTokens |
( |
INOUTP char *** |
TokensPtr | ) |
|
char** ReadLineTokens |
( |
INOUTP FILE * |
InFile, |
|
|
INOUTP int * |
LineNum |
|
) |
| |
Definition at line 39 of file ReadLine.c.
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;
static void * my_malloc(int ibytes)