diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2020-10-15 11:39:59 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2020-10-15 15:06:48 -0400 |
commit | 30d0e5f95410fb7590b134e5a816da98d0bdaf2a (patch) | |
tree | f2a8a2e1bd0a82531ca78d902fac39a662a9252a /src/misc.c | |
parent | d658c1c167023d74ae8332f8d1b9d62435dbf8f5 (diff) | |
download | flex-git-30d0e5f95410fb7590b134e5a816da98d0bdaf2a.tar.gz |
Push some C-specific assumptions out of filter.c to the skel file.
The way this is done is by adding a capabiiliy to mine string-valued
properties out of skel files in Flex's binary.
Also, some reorganization to improve the encapsulation of
knowledge about skel files.
No changes in generated test files from this patch.
Diffstat (limited to 'src/misc.c')
-rw-r--r-- | src/misc.c | 67 |
1 files changed, 0 insertions, 67 deletions
@@ -606,57 +606,6 @@ void *reallocate_array (void *array, int size, size_t element_size) } -/* skelout - write out one section of the skeleton file - * - * Description - * Copies skelfile or skel array to stdout until a line beginning with - * "%%" or EOF is found. - */ -void skelout (bool announce) -{ - char buf_storage[MAXLINE]; - char *buf = buf_storage; - bool do_copy = true; - - /* Loop pulling lines either from the skelfile, if we're using - * one, or from the selected back end's skel[] array. - */ - while (env.skelfile != NULL ? - (fgets (buf, MAXLINE, env.skelfile) != NULL) : - ((buf = (char *) backend->skel[skel_ind++]) != 0)) { - - if (env.skelfile != NULL) - chomp (buf); - - /* copy from skel array */ - if (buf[0] == '%') { /* control line */ - /* print the control line as a comment. */ - if (ctrl.ddebug && buf[1] != '#') { - comment(buf); - outc ('\n'); - } - if (buf[1] == '#') { - /* %# indicates comment line to be ignored */ - } - else if (buf[1] == '%') { - /* %% is a break point for skelout() */ - if (announce) { - comment(buf); - outc ('\n'); - } - return; - } - else { - flexfatal (_("bad line in skeleton file")); - } - } - - else if (do_copy) - outn (buf); - } /* end while */ -} - - /* transition_struct_out - output a yy_trans_info structure * * outputs the yy_trans_info structure with the two elements, element_v and @@ -740,20 +689,4 @@ void comment(const char *txt) outc ('\n'); } -/* Search for a string in the skeleton prolog, where macros are defined. - */ -bool boneseeker(const char *bone) -{ - int i; - - for (i = 0; i < sizeof(backend->skel)/sizeof(backend->skel[0]); i++) { - const char *line = backend->skel[i]; - if (strstr(line, bone) != NULL) - return true; - else if (strncmp(line, "%%", 2) == 0) - break; - } - return false; -} - |