+2005-08-09 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/sun_map_parse.y: Moved license below special yacc bracket to
+ be portable with HPUX's yacc. Clean up externs.
+
+ * amd/sun_map_tok.l: Moved license below special lex bracket to be
+ portable with HPUX's lex. Fixed definitions to allow for a
+ non-flex lex to parse strings instead of files. Added some casts
+ to strlcpy usage to silence warnings. Moved the % options because
+ HPUX was complaining,
+
2005-08-08 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
* amd/sun_map_tok.l: Applied some definition goop to handle the
+%{
/*
* Copyright (c) 1997-2005 Erez Zadok
* Copyright (c) 2005 Daniel P. Ottavio
*
*/
-%{
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <sun_map.h>
extern int sun_map_lex(void);
-extern int sun_map_error(const char* s);
+extern int sun_map_error(const char *);
extern void sun_map_tok_setbuff(const char *);
extern int sun_map_parse(void);
-struct sun_entry *sun_map_parse_read(const char *map_data);
+struct sun_entry *sun_map_parse_read(const char *);
static struct sun_list *sun_entry_list = NULL;
static struct sun_list *sun_include_list = NULL;
+%{
/*
* Copyright (c) 1997-2005 Erez Zadok
* Copyright (c) 2005 Daniel P. Ottavio
*
*/
-%{
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
* instead of a file. Each version of lex has it's
* own way of doing this (sigh).
*/
-#ifdef FLEX_SCANNER
/* assign the buffer to parse */
void sun_map_tok_setbuff(const char* buff);
/* buffer that contains the string to parse */
const char *sun_map_tok_buff = NULL;
+#ifdef FLEX_SCANNER
+/*
+ * The flex scanner uses the YY_INPUT to parse the input.
+ * We need to redefine it so that it can parse strings.
+ * In addition to the above string buffer we need to have
+ * a position pointer and a end pointer.
+ */
+
/* current position of the buffer */
const char *sun_map_tok_pos = NULL;
# undef YY_INPUT
# define YY_INPUT(buff,result,maxsize) (result = sun_map_input(buff,maxsize))
-#else /* not FLEX_SCANNER */
-# warning "Currently flex is the only supported version of lex."
+
+#else
+/*
+ * If this is not Flex than fall back to an AT&T style lex.
+ * We can parse strings by redefining input and unput.
+ */
+#undef input
+#undef unput
+#define input() (*(char *)sun_map_tok_buff++)
+#define unput(c) (*(char *)--sun_map_tok_buff = c)
#endif /* FLEX_SCANNER */
%}
+/* This option causes Solaris lex to fail. Use flex. See BUGS file */
+/* no need to use yyunput() */
+%option nounput
+
+/* allocate more output slots so lex scanners don't run out of mem */
+%o 1024
+
+
WORD_REX ([A-Za-z0-9_/&".""$"=""-"]+)|"*"
COMMENT_REX ^#.*\n
WSPACE_REX [ \t]*
NEWLINE_REX [ \t]*\n
CONTINUE_REX "\\"\n
-/*
- * This option causes Solaris lex to fail. Use flex. See BUGS file
- * no need to use yyunput()
- */
-%option nounput
-
-/* allocate more output slots so lex scanners don't run out of mem */
-%o 1024
-
%%
{WORD_REX} {
sun_map_tokpos += yyleng;
- xstrlcpy(yylval.strval,yytext,sizeof(yylval.strval));
+ xstrlcpy((char *)yylval.strval,(const char *)yytext,sizeof(yylval.strval));
return WORD;
}
return size;
}
+#else
+void
+sun_map_tok_setbuff(const char* buff)
+{
+ sun_map_tok_buff = buff;
+}
+
#endif /* FLEX_SCANNER */
/*