From e35305bbf96cb3a561a23ff04e4badb8204ffb51 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 14 Feb 2023 14:39:26 -0800 Subject: [PATCH] working on 1.5h. --- src/flight.re.c | 19 ++++++++++++++----- src/pair.c | 5 +++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/flight.re.c b/src/flight.re.c index 55000d7..2e10ef5 100644 --- a/src/flight.re.c +++ b/src/flight.re.c @@ -47,7 +47,7 @@ static int scan(struct flights *const f, //unix_control = [\x01-\x08\x0b-\x1f\x7f]; ws = [ \t]; - glyph = [^\x00-\x20\x7f]; // [^\n\t ] + all the other weird + glyph = [^\x00-\x20\x7f]; // [^\x00\n\t ] + all weird semitext = glyph \ ";"; natural = [1-9][0-9]*; minutes = [0-5][0-9]; @@ -148,10 +148,11 @@ static int scan(struct flights *const f, * { why = "airports unrecognized"; goto catch; } * { why = "pic unrecognized"; goto catch; } * { why = "sic unrecognized"; goto catch; } - * { why = "dual unrecognized"; goto catch; } - * { why = "pilot unrecognized"; goto catch; } - * { why = "simulated ifr unrecognized"; goto catch; } - * { why = "ifr unrecognized"; goto catch; } + * { why = "dual time unrecognized"; goto catch; } + * { why = "pilot time unrecognized"; goto catch; } + * { why = "simulated ifr time unrecognized"; + goto catch; } + * { why = "ifr time unrecognized"; goto catch; } * { why = "remarks unrecognized"; goto catch; } ws* @s0 semitext+ @s1 ws* ";" => flight_reg { const union line64 key @@ -174,6 +175,14 @@ static int scan(struct flights *const f, flight->power.landing.a = t0, flight->power.landing.b = t1; continue; } + ws* @s0 semitext+ (ws+ semitext+)* @s1 ws* ";" + => flight_sic { flight->power.pilot.a = s0, + flight->power.pilot.b = s1; continue; } + ws* ";" => flight_dual + { flight->power.copilot.a = flight->power.copilot.b = 0; continue; } + ws* @s0 semitext+ (ws+ semitext+)* @s1 ws* ";" + => flight_dual { flight->power.copilot.a = s0, + flight->power.copilot.b = s1; continue; } */ } diff --git a/src/pair.c b/src/pair.c index 3e5bd16..a3b001f 100644 --- a/src/pair.c +++ b/src/pair.c @@ -39,6 +39,11 @@ int pair_to_minutes(const char *h0, const char *const h1, ? (*n = hours * 60 + minutes, 1) : 0; } +/** `h0` "1" `h1` "." `m0` "5" `m1` -> 90 `n` @return Valid. */ +int pair_hours_to_minutes(const char *h0, const char *const h1, + const char *m0, const char *const m1, uint32_t *const n) { +} + int pair_is_equal(struct pair x, struct pair y) { assert(x.a <= x.b && y.a <= y.b); if(!x.a) return !y.a;