diff options
author | ragge <ragge> | 2005-04-04 16:49:47 +0000 |
---|---|---|
committer | ragge <ragge> | 2005-04-04 16:49:47 +0000 |
commit | f99233ae505726308ffbad580a658166ed089899 (patch) | |
tree | c055b87d0380c6f70091137ca64fb68a9bd300d7 /token.c | |
parent | d9bd4f92f6037ffe2f65d1b3368e5b9eceb131d8 (diff) |
Start working on newnew buffer handling.
Diffstat (limited to 'token.c')
-rw-r--r-- | token.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -393,6 +393,42 @@ gotid: while (isalnum(c) || c == '_') { return rval; } +#ifdef NEW_READFILE +/* + * A new file included. Read buffers are allocated on the stack and + * all subroutines are called from here. This function will be called + * recursive when multiple files are included. + */ +int +pushfile(char *file) +{ + struct includ incl, *ic = &incl; + + ic->lineno = 1; + if (ifiles != NULL) { /* not if first file */ + if ((ic->infil = open(file, O_RDONLY)) < 0) + return -1; + } else + ic->infil = 0; /* STDIN_FILENO */ + + ic->fname = savstr(file); /* XXX - will loose space */ + savch('\0'); + ic->curptr = ic->buffer; + ic->next = ifiles; + ifiles = ic; + + while ((c = qscan()) != 0) { + switch (c) { + case CONTROL: + control(); + break; + + + + + +} +#else /* * A new file included. * If ifiles == NULL, this is the first file and already opened (stdin). @@ -432,6 +468,7 @@ pushfile(char *file) return 0; } +#endif /* * End of included file (or everything). |