X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/ae8ef7d3f4cfcab63518ea97a5eb2d03f2da9b53..62b9266aa31b2baced3252987b256b4e43ec9573:/sbr/dtimep.l?ds=inline diff --git a/sbr/dtimep.l b/sbr/dtimep.l index e9dd8153..455d4039 100644 --- a/sbr/dtimep.l +++ b/sbr/dtimep.l @@ -10,8 +10,11 @@ %n2500 %a5000 %{ -#include -#include +#include "h/nmh.h" +#include "h/mh.h" +#include "sbr/dtime.h" +#include "h/utils.h" +#include "h/tws.h" /* Since we're looking at a string at a time, don't worry about * wrapping to the next buffer. @@ -43,13 +46,13 @@ #define yyterminate() (void)yy_delete_buffer(lexhandle); \ if(!(tw.tw_flags & TW_SUCC)) { \ - return (struct tws *)NULL; \ + return NULL; \ } \ if(tw.tw_year < 1970) \ tw.tw_year += 1900; \ if(tw.tw_year < 1970) \ tw.tw_year += 100; \ - return(&tw) + return &tw /* * Table to convert month names to numeric month. We use the @@ -127,14 +130,14 @@ static int day_map[] = { SKIPA(); } #define SETMON() { cp++; \ tw.tw_mon = month_map[(((unsigned char) cp[0]) + ((unsigned char) cp[1])) & 0x1f]; \ - SKIPA(); } + SKIPA(); } #define SETMON_NUM() { tw.tw_mon = atoi(cp)-1; \ - SKIPD(); } + SKIPD(); } #define SETYEAR() { tw.tw_year = atoi(cp); \ - SKIPD(); } + SKIPD(); } #define SETDAY() { tw.tw_mday = atoi(cp); \ tw.tw_flags |= TW_SUCC; \ - SKIPD(); } + SKIPD(); } #define SETTIME() { tw.tw_hour = atoi(cp); \ cp += 2; \ SKIPTOD(); \ @@ -154,10 +157,6 @@ static int day_map[] = { --cp; } #define SKIPTOA() { while ( !isalpha((unsigned char) *cp++) ) ; \ --cp; } -#define SKIPSP() { while ( isspace((unsigned char) *cp++) ) ; \ - --cp; } -#define SKIPTOSP() { while ( !isspace((unsigned char) *cp++) ) ; \ - --cp; } # ifdef HAVE_SYS_TIME_H # include @@ -231,7 +230,7 @@ nl [ \t\n()] char *cp; static struct tws tw; - memset(&tw,0,sizeof(struct tws)); + ZERO(&tw); lexhandle = yy_scan_string(lexstr); %} @@ -380,7 +379,8 @@ nl [ \t\n()] * "%option nounput" which is flex-specific * makefile hackery just to compile dtimep.c with different flags */ -void dtimep_yyunput(int c) +void +dtimep_yyunput(int c) { unput(c); }