]> 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: 132216f)
Improve code documentation
2021年9月15日 19:40:36 +0000 (21:40 +0200)
2021年9月15日 19:44:59 +0000 (21:44 +0200)

diff --git a/tic.c b/tic.c
index 3edc43f882dae8786e57bd7abcdb36ceda852361..016ec003f2bf5533927f3f72ec8085670d0bb5f9 100644 (file)
--- a/tic.c
+++ b/tic.c
@@ -17,7 +17,7 @@
#include "tic.h"
-bool filter_mode;
+bool filter_mode; ///< if true, switch lexers to configuration parsing
bool *etiq_en; ///< when non-NULL, a token-indexed array, where the related token is emitted if the value is true. @note This could be made a bit field if memory is a concern
void make_field(struct tic_field *field, const struct tic_etiquette *etiq, char *horodate, char *data)
diff --git a/tic.h b/tic.h
index 0f12e746578307274d1442e2222acf4dd797f9e3..f01670a09f1bd48a2c84c35744bc0ced42db8d29 100644 (file)
--- a/tic.h
+++ b/tic.h
@@ -9,7 +9,7 @@
/**
* @file
* Interface for TIC parsers
- * Users of this interface must implement the functions listed at the bottom:
+ * Users of this interface must implement the functions declared at the bottom:
* - print_field()
* - frame_sep()
* - frame_err()
@@ -55,20 +55,22 @@ enum tic_unit {
T_HEX = 0x20,
};
+/** Internal parser representation of a TIC etiquette */
struct tic_etiquette {
- uint8_t tok;
- uint8_t unittype;
- const char *label;
- const char *desc;
+ uint8_t tok; ///< bison token number
+ uint8_t unittype; ///< combined unit and type (see @tic_unit @data_type)
+ const char *label; ///< TIC "etiquette", as an ASCII string
+ const char *desc; ///< corresponding TIC long description
};
+/** Internal parser representation of a TIC field (i.e. body of a dataset) */
struct tic_field {
- struct tic_etiquette etiq;
+ struct tic_etiquette etiq; ///< the field "etiquette"
union {
char *s;
int i;
- } data;
- char *horodate;
+ } data; ///< the field data, if any
+ char *horodate; ///< the field horodate, if any
};
void make_field(struct tic_field *field, const struct tic_etiquette *etiq, char *horodate, char *data);
diff --git a/tic2json.c b/tic2json.c
index 4aa31e89fe98d3880e951bc255e29f2399cd96d7..f841c18b61258cfbf54914b38560751619e5e0c8 100644 (file)
--- a/tic2json.c
+++ b/tic2json.c
@@ -50,6 +50,7 @@
extern bool filter_mode;
extern bool *etiq_en;
+/** Global configuration details */
static struct {
const char *idtag;
char framedelims[2];
@@ -59,6 +60,7 @@ static struct {
char ferr;
} tp;
+/** enum for optflags bitfield */
enum {
OPT_MASKZEROES = 0x01,
OPT_CRFIELD = 0x02,
@@ -68,6 +70,7 @@ enum {
OPT_PARSESTGE = 0x20,
};
+/** TIC units representation strings */
static const char * tic_units[] = {
[U_SANS] = "",
[U_WH] = "Wh",
diff --git a/ticv01.l b/ticv01.l
index f280bcd71c6fc4e71d4a9a3e1112c6b523a08589..a9d3350e04d5deb5c45d4cf237a9babf7455082c 100644 (file)
--- a/ticv01.l
+++ b/ticv01.l
@@ -8,8 +8,8 @@
/**
* @file
- * Complete lexer for ENEDIS' TIC protocol.
- * Supports version 01, a.k.a "historique" as found on ENEDIS' LINKY smart meter.
+ * Complete lexer for ENEDIS' TIC protocol version 01.
+ * Supports version 01, a.k.a "historique" as found on ENEDIS' Linky and Bleus meters.
* Ref doc: https://www.enedis.fr/media/2027/download
*
* "le champ « étiquette » ne contient aucun caractère ayant une valeur égale à celle
diff --git a/ticv02.l b/ticv02.l
index e3cdb9a3ae8180639d328dbd3f68e8d2c94c1961..492bdbf300794be369c9facf1f711aea8caf0317 100644 (file)
--- a/ticv02.l
+++ b/ticv02.l
@@ -6,9 +6,10 @@
// License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html
*/
-/*
- * Complete lexer for ENEDIS' TIC protocol.
- * Supports version 02, a.k.a "standard" as found on ENEDIS' LINKY smart meter.
+/**
+ * @file
+ * Complete lexer for ENEDIS' TIC protocol version 02.
+ * Supports version 02, a.k.a "standard" as found on ENEDIS' Linky smart meter.
* Ref doc: https://www.enedis.fr/media/2035/download
*/
tic2json TIC parser/converter
RSS Atom

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