chiark / gitweb /
#define STR in the conventional way (and rename it in record-l.l); also define port...
authorian <ian>
Tue, 27 May 2008 18:40:06 +0000 (18:40 +0000)
committerian <ian>
Tue, 27 May 2008 18:40:06 +0000 (18:40 +0000)
hostside/common.h
hostside/record-l.l

index debc0849c7c138a95f26018747826c30750013f9..c6f95e1e26798761f736fb9041c4dca31c959bbe 100644 (file)
@@ -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*/
index 330c70c97f4491dc1e764af971b6b5eeb68121fe..c514a098ad660078ecb399dee81c6b63c0eafee8 100644 (file)
 %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<name> 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"); }