From: ian Date: Tue, 27 May 2008 18:40:06 +0000 (+0000) Subject: #define STR in the conventional way (and rename it in record-l.l); also define port... X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=3bb27e0a6e36511f2f71ca970165321609ac062a;p=trains.git #define STR in the conventional way (and rename it in record-l.l); also define port number --- diff --git a/hostside/common.h b/hostside/common.h index debc084..c6f95e1 100644 --- a/hostside/common.h +++ b/hostside/common.h @@ -18,6 +18,8 @@ typedef struct Client Client; extern const char *progname; +#define TRAINMX_PORT 2883 + /*---------- types ----------*/ typedef unsigned char Byte; @@ -155,4 +157,7 @@ void nmra_encodeforpic(const Nmra *packet, PicInsn *pi_out); #define CTYPE(isfoobar,ch) (isfoobar((unsigned char)(ch))) #define COMMA , +#define STR2(x) #x +#define STR(x) STR2(x) + #endif /*COMMON_H*/ diff --git a/hostside/record-l.l b/hostside/record-l.l index 330c70c..c514a09 100644 --- a/hostside/record-l.l +++ b/hostside/record-l.l @@ -12,26 +12,26 @@ %option header-file="record-l.h" %{ -#define STR record_yylval.name= record_tempzone_strdup(yytext); return +#define STRT record_yylval.name= record_tempzone_strdup(yytext); return %} %% -train { STR TRAIN; } -seg { STR SEG; } -feature { STR FEATURE; } -is { STR IS; } -at { STR AT; } -has { STR HAS; } -inverted { STR INVERTED; } -step { STR STEP; } -stops { STR STOPS; } -home { STR HOME; } -end { STR END; } +train { STRT TRAIN; } +seg { STRT SEG; } +feature { STRT FEATURE; } +is { STRT IS; } +at { STRT AT; } +has { STRT HAS; } +inverted { STRT INVERTED; } +step { STRT STEP; } +stops { STRT STOPS; } +home { STRT HOME; } +end { STRT END; } /* new keywords must be added to %token and ident: in record-y.y */ -[A-Za-z][A-Za-z0-9_]+ { STR IDENT; } -[a-z] { STR FEATLETTER; } +[A-Za-z][A-Za-z0-9_]+ { STRT IDENT; } +[a-z] { STRT FEATLETTER; } [0-9]{0,8} { record_yylval.num= strtoul(yytext,0,10); return NUM; } [0-9]{9} { record_yyerror("number too long"); }