zotnet/tws/lexedit.sed does not work correctly with HP-UX 11.00 lex.
Attached below is a copy of the C code generated by lex against
zotnet/tws/dtimep.lex.
The part that matters is:
#ifdef YYREENTRANT
__thread int yylineno;
#else
int yylineno = 1;
#endif /* reentrant */
According to zotnet/tws/lexedit.sed, everything from 'int yylineno '
onward will be deleted, leaving a hanging #ifdef. A quick solution is
to apply the following patch:
--- lexedit.sed.origMon Apr 24 16:25:01 2000
+++ lexedit.sed Mon Apr 24 16:25:15 2000
@@ -8,6 +8,7 @@
default: return(0);\
} }
/^struct yysvf *yybgin = yysvec+1;$/d
+/^#ifdef YYREENTRANT/,$d
/^int yylineno /,$d
/^# define YYTYPE short/c\
# define YYTYPE int
This seems prone to future hiccups though. Is it possible to get rid
of the sed hackery altogether?
--
albert chin ([EMAIL PROTECTED])
-- snip snip
# include "stdio.h"
#if defined(__cplusplus)
extern "C" {
#endif
#if (defined(__cplusplus) || defined(__STDC__))
extern int yyreject();
extern int yywrap();
extern int yylook();
extern int yyback(int *, int);
extern int yyinput();
extern void yyoutput(int);
extern void yyunput(int);
extern int yylex();
extern int yyless(int);
#ifdef LEXDEBUG
extern void allprint();
extern void sprint();
#endif
#if defined(__cplusplus)
}
#endif
#endif /* __cplusplus or __STDC__ */
# define U(x) x
# define NLSTATE yyprevious=YYNEWLINE
# define BEGIN yybgin = yysvec + 1 +
# define INITIAL 0
# define YYLERR yysvec
# define YYSTATE (yyestate-yysvec-1)
# define YYOPTIM 1
# define YYLMAX 200
# define output(c) putc(c,yyout)
# define input()
(((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
# define yymore() (yymorfg=1)
# define ECHO fprintf(yyout, "%s",yytext)
# define REJECT { nstr = yyreject(); goto yyfussy;}
long yyleng;
long yylenguc;
extern unsigned char yytextarr[];
# ifdef YYCHAR_ARRAY
extern char yytext[];
# else
extern unsigned char yytext[];
# endif
int yyposix_point=0;
int yynls16=0;
int yynls_wchar=0;
char *yylocale = "C C C C C C";
int yymorfg;
extern unsigned char *yysptr, yysbuf[];
int yytchar;
FILE *yyin = {stdin}, *yyout = {stdout};
extern int yylineno;
struct yysvf {
int yystoff;
struct yysvf *yyother;
int *yystops;};
struct yysvf *yyestate;
extern struct yysvf yysvec[], *yybgin;
# define Z 2
#include
#include
#if !defined(HAVE_TM_GMTOFF) && !defined(HAVE_TZSET)
# include
#endif
#if !defined(HAVE_TM_GMTOFF) && defined(HAVE_TZSET)
extern int daylight;
extern long timezone;
extern char *tzname[];
#endif
/*
* Patchable flag that says how to interpret NN/NN/NN dates. When
* true, we do it European style: DD/MM/YY. When false, we do it
* American style: MM/DD/YY. Of course, these are all non-RFC822
* compliant.
*/
int europeandate = 0;
/*
* Table to convert month names to numeric month. We use the
* fact that the low order 5 bits of the sum of the 2nd & 3rd
* characters of the name is a hash with no collisions for the 12
* valid month names. (The mask to 5 bits maps any combination of
* upper and lower case into the same hash value).
*/
static int month_map[] = {
0,
6, /* 1 - Jul */
3, /* 2 - Apr */
5, /* 3 - Jun */
0,
10, /* 5 - Nov */
0,
1, /* 7 - Feb */
11, /* 8 - Dec */
0,
0,
0,
0,
0,
0,
0, /*15 - Jan */
0,
0,
0,
2, /*19 - Mar */
0,
8, /*21 - Sep */
0,
9, /*23 - Oct */
0,
0,
4, /*26 - May */
0,
7 /*28 - Aug */
};
/*
* Same trick for day-of-week using the hash function
* (c1 & 7) + (c2 & 4)
*/
static int day_map[] = {
0,
0,
0,
6, /* 3 - Sat */
4, /* 4 - Thu */
0,
5, /* 6 - Fri */
0, /* 7 - Sun */
2, /* 8 - Tue */
1 /* 9 - Mon */,
0,
3 /*11 - Wed */
};
#define SETDAY { tw.tw_wday= day_map[(cp[0] & 7) + (cp[1] & 4)];\
tw.tw_flags &= ~TW_SDAY; tw.tw_flags |= TW_SEXP;\
cp += 2; }
#define SETMONTH { tw.tw_mon = month_map[(cp[0] + cp[1]) & 0x1f]; gotdate++;\
cp += 2;\
SKIPD;}
#define CVT1OR2 (i=(*cp++ - '0'), isdigit(*cp)? i*10 + (*cp++ - '0') : i)
#define CVT2 ((cp[0] - '0')*10 + (cp[1] - '0'))
#define CVT4cp[0] - '0')*10 + (cp[1] - '0'))*10 + \
(cp[2] - '0'))*10 + (cp[3] - '0'))
#define SKIPD { while ( !isdigit(*cp++) ) ; --cp; }
#define EXPZONE { tw.tw_flags &= ~TW_SZONE; tw.tw_flags |= TW_SZEXP; }
#define ZONE(x) { tw.tw_zone=(x); EXPZONE; }
#define ZONED(x) { ZONE(x); tw.tw_flags |= TW_D