From: Thibaut VARÈNE Date: 2021年8月21日 13:41:02 +0000 (+0200) Subject: rename tic2json.h -> tic.h X-Git-Tag: v2.0~14 X-Git-Url: http://vcs.slashdirt.org/git/?a=commitdiff_plain;h=0634c0bde53bfff573cf883043981688ad5c789a;p=sw%2Ftic2json.git rename tic2json.h -> tic.h --- diff --git a/tic.h b/tic.h new file mode 100644 index 0000000..6889196 --- /dev/null +++ b/tic.h @@ -0,0 +1,66 @@ +// +// tic.h +// +// +// (C) 2021 Thibaut VARENE +// License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html +// + +#ifndef tic_h +#define tic_h + +#include +#include +#include + +#ifdef BAREBUILD + #define pr_err(format, ...) /* nothing */ +#else + #define pr_err(format, ...) fprintf(stderr, "ERREUR: " format, ## __VA_ARGS__) +#endif + +#define TIC2JSON_VER "1.1" + +// The code assumes this fits on 4 bits +enum tic_unit { + U_SANS = 0x00, + U_WH, + U_VARH, + U_A, + U_V, + U_KVA, + U_VA, + U_W, + U_MIN, +}; + +// this is to be packed in the upper 4 bits of a byte: must increment by 0x10 +// by default everything is an int +enum data_type { + T_STRING = 0x10, + T_HEX = 0x20, +}; + +struct tic_etiquette { + uint8_t tok; + uint8_t unittype; + const char *label; + const char *desc; +}; + +struct tic_field { + struct tic_etiquette etiq; + union { + char *s; + int i; + } data; + char *horodate; +}; + +void make_field(struct tic_field *field, const struct tic_etiquette *etiq, char *horodate, char *data); +void print_field(struct tic_field *field); +void free_field(struct tic_field *field); +void frame_sep(void); +void frame_err(void); + +#endif /* tic_h */ diff --git a/tic2json.c b/tic2json.c index 7fef597..896ded4 100644 --- a/tic2json.c +++ b/tic2json.c @@ -29,7 +29,7 @@ #include #include -#include "tic2json.h" +#include "tic.h" #ifdef TICV01 #include "ticv01.tab.h" int ticv01yylex_destroy(); diff --git a/tic2json.h b/tic2json.h deleted file mode 100644 index e986cc6..0000000 --- a/tic2json.h +++ /dev/null @@ -1,66 +0,0 @@ -// -// tic2json.h -// -// -// (C) 2021 Thibaut VARENE -// License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html -// - -#ifndef tic2json_h -#define tic2json_h - -#include -#include -#include - -#ifdef BAREBUILD - #define pr_err(format, ...) /* nothing */ -#else - #define pr_err(format, ...) fprintf(stderr, "ERREUR: " format, ## __VA_ARGS__) -#endif - -#define TIC2JSON_VER "1.1" - -// The code assumes this fits on 4 bits -enum tic_unit { - U_SANS = 0x00, - U_WH, - U_VARH, - U_A, - U_V, - U_KVA, - U_VA, - U_W, - U_MIN, -}; - -// this is to be packed in the upper 4 bits of a byte: must increment by 0x10 -// by default everything is an int -enum data_type { - T_STRING = 0x10, - T_HEX = 0x20, -}; - -struct tic_etiquette { - uint8_t tok; - uint8_t unittype; - const char *label; - const char *desc; -}; - -struct tic_field { - struct tic_etiquette etiq; - union { - char *s; - int i; - } data; - char *horodate; -}; - -void make_field(struct tic_field *field, const struct tic_etiquette *etiq, char *horodate, char *data); -void print_field(struct tic_field *field); -void free_field(struct tic_field *field); -void frame_sep(void); -void frame_err(void); - -#endif /* tic2json_h */ diff --git a/ticv01.l b/ticv01.l index 2fac10a..e9269bd 100644 --- a/ticv01.l +++ b/ticv01.l @@ -61,7 +61,7 @@ CHKSUM [\x20-\x5f] SEP \x20 %{ - #include "tic2json.h" + #include "tic.h" #include "ticv01.tab.h" extern bool filter_mode; diff --git a/ticv01.y b/ticv01.y index d5cac26..cfe3740 100644 --- a/ticv01.y +++ b/ticv01.y @@ -20,7 +20,7 @@ %{ #include -#include "tic2json.h" +#include "tic.h" int ticv01yylex(); int ticv01yylex_destroy(); diff --git a/ticv02.l b/ticv02.l index 6917930..05293c7 100644 --- a/ticv02.l +++ b/ticv02.l @@ -46,7 +46,7 @@ CHKSUM [\x20-\x5f] SEP \x09 %{ - #include "tic2json.h" + #include "tic.h" #include "ticv02.tab.h" extern bool filter_mode; diff --git a/ticv02.y b/ticv02.y index ab16afa..5fa22ca 100644 --- a/ticv02.y +++ b/ticv02.y @@ -20,7 +20,7 @@ %{ #include -#include "tic2json.h" +#include "tic.h" int ticv02yylex(); int ticv02yylex_destroy();

AltStyle によって変換されたページ (->オリジナル) /