]> vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

git git / sw / tic2json.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7449c62)
rename tic2json.h -> tic.h
2021年8月21日 13:41:02 +0000 (15:41 +0200)
2021年8月21日 14:31:06 +0000 (16:31 +0200)
tic.h [new file with mode: 0644] patch | blob
tic2json.h [deleted file] patch | blob | history

diff --git a/tic.h b/tic.h
new file mode 100644 (file)
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 <stdio.h>
+#include <inttypes.h>
+#include <stdbool.h>
+
+#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 7fef597910e0943b0aac625ed95c40237bbfed5f..896ded48dae48b9dc20d10157325da18def14f83 100644 (file)
--- a/tic2json.c
+++ b/tic2json.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include <err.h>
-#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 (file)
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 <stdio.h>
-#include <inttypes.h>
-#include <stdbool.h>
-
-#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 2fac10a24bbc8d115661ba43c078549d90eace25..e9269bd1398c0b3cab7b23e2d225cdf44399a351 100644 (file)
--- 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 d5cac26f61aab82e5b4ea6244725b922ba63b8c0..cfe37403e2c006571983860ee8fbaa18f5044468 100644 (file)
--- a/ticv01.y
+++ b/ticv01.y
@@ -20,7 +20,7 @@
%{
#include <stdlib.h>
-#include "tic2json.h"
+#include "tic.h"
int ticv01yylex();
int ticv01yylex_destroy();
diff --git a/ticv02.l b/ticv02.l
index 69179300bfbd562203ebb64f4d142890381ed30b..05293c711163a35f041a4caa0dcac32083e4d425 100644 (file)
--- 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 ab16afaa7e496c03a284d2c23d97dd65c7e472b2..5fa22cace51ec80a47f3fd2f9661ad52e3d0cd44 100644 (file)
--- a/ticv02.y
+++ b/ticv02.y
@@ -20,7 +20,7 @@
%{
#include <stdlib.h>
-#include "tic2json.h"
+#include "tic.h"
int ticv02yylex();
int ticv02yylex_destroy();
tic2json TIC parser/converter
RSS Atom

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