-%option noyywrap
+/*
+ * We don't use unput, so don't generate code for it.
+ */
%option nounput
-%option outfile="dtd_parse.c"
-%option prefix="Dtd_Parse_"
+
+/*
+ * We don't read from the terminal.
+ */
%option never-interactive
+/*
+ * Prefix scanner routines with "Dtd_Parse_" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
+%option prefix="Dtd_Parse_"
+
+%option outfile="dtd_parse.c"
+
%{
/* dtd_parse.l
* an XML dissector for Wireshark
* lexical analyzer for DTDs
*
- * Copyright 2004, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
+ * Copyright 2004, Luis E. Garcia Ontanon <luis@ontanon.org>
*
* $Id$
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <glib.h>
#include "dtd.h"
#include "dtd_grammar.h"
#include "dtd_parse.h"
+#include "dtd_parse_lex.h"
struct _proto_xmlpi_attr {
gchar* name;
static void set_media_type (gchar* val) { if(build_data->media_type) g_free(build_data->media_type); build_data->media_type = g_strdup(val); }
static void set_proto_root (gchar* val) { if(build_data->proto_root) g_free(build_data->proto_root); build_data->proto_root = g_strdup(val); }
static void set_description (gchar* val) { if(build_data->description) g_free(build_data->description); build_data->description = g_strdup(val); }
- static void set_recursive (gchar* val) { build_data->recursion = ( g_strcasecmp(val,"yes") == 0 ) ? TRUE : FALSE; }
+ static void set_recursive (gchar* val) { build_data->recursion = ( g_ascii_strcasecmp(val,"yes") == 0 ) ? TRUE : FALSE; }
static struct _proto_xmlpi_attr proto_attrs[] =
{
#define YY_INPUT(buff,result,max_size) ( (result) = my_yyinput((buff),(max_size)) )
+/*
+ * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
+ */
+#ifdef _WIN32
+#define YY_NO_UNISTD_H
+#endif
+
%}
comment_start "<!--"
<GET_ATTR_QUOTE>{get_attr_quote} { BEGIN GET_ATTR_VAL; }
<GET_ATTR_QUOTE>. {
- g_string_sprintfa(build_data->error,
+ g_string_append_printf(build_data->error,
"error in wireshark:protocol xmpli at %s : could not find attribute value!",
location);
yyterminate();
gboolean got_it = FALSE;
for(pa = proto_attrs; pa->name; pa++) {
- if (g_strcasecmp(attr_name,pa->name) == 0) {
+ if (g_ascii_strcasecmp(attr_name,pa->name) == 0) {
pa->act(yytext);
got_it = TRUE;
break;
}
if (! got_it) {
- g_string_sprintfa(build_data->error,
+ g_string_append_printf(build_data->error,
"error in wireshark:protocol xmpli at %s : no such parameter %s!",
location, attr_name);
g_free(attr_name);
input_string = s;
offset = 0;
- len = input_string->len;
+ len = (guint) input_string->len;
pParser = DtdParseAlloc(g_malloc);
return build_data;
}
+
+/*
+ * We want to stop processing when we get to the end of the input.
+ * (%option noyywrap is not used because if used then
+ * some flex versions (eg: 2.5.35) generate code which causes
+ * warnings by the Windows VC compiler).
+ */
+
+int yywrap(void) {
+ return 1;
+}