]> 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: 199d913)
doc
2021年8月21日 14:17:39 +0000 (16:17 +0200)
2021年8月21日 14:31:06 +0000 (16:31 +0200)

diff --git a/tic.c b/tic.c
index db7a295a1450bf3850464fda67102da17edd5218..3200bfdf357276ae1db19777abb6f8abc05cbf1c 100644 (file)
--- a/tic.c
+++ b/tic.c
@@ -6,6 +6,12 @@
// License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html
//
+/**
+ * @file
+ * Common routines used by the TIC parsers.
+ * The code making use of the parsers must provide extra functions as mentioned in the header.
+ */
+
#include <stdlib.h>
#include <string.h>
diff --git a/tic.h b/tic.h
index 2c66d6b2f295ae2c9cf961c986143319aab1dbc4..b09a775e97094366cb6ee2be3e09e04197b12acb 100644 (file)
--- a/tic.h
+++ b/tic.h
@@ -6,6 +6,15 @@
// License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html
//
+/**
+ * @file
+ * Interface for TIC parsers
+ * Users of this interface must implement the functions listed at the bottom:
+ * - print_field()
+ * - frame_sep()
+ * - frame_err()
+ */
+
#ifndef tic_h
#define tic_h
@@ -19,7 +28,10 @@
#define pr_err(format, ...) fprintf(stderr, "ERREUR: " format, ## __VA_ARGS__)
#endif
-// The code assumes this fits on 4 bits
+/**
+ * TIC units.
+ * @warning The code assumes this fits on 4 bits
+ */
enum tic_unit {
U_SANS = 0x00,
U_WH,
@@ -32,9 +44,12 @@ enum tic_unit {
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 {
+/**
+ * TIC data types.
+ * By default everything is an int.
+ * @warning The code assumes this is packed in the upper 4 bits of a byte: must increment by 0x10.
+ */
+ enum data_type {
T_STRING = 0x10,
T_HEX = 0x20,
};
@@ -59,8 +74,24 @@ void make_field(struct tic_field *field, const struct tic_etiquette *etiq, char
void free_field(struct tic_field *field);
// The following functions must be provided by the output interface
+
+/**
+ * Called for each valid dataset.
+ * Used to print a TIC dataset in the desired output format.
+ * @param field the dataset to print
+ */
void print_field(const struct tic_field *field);
+
+/**
+ * Called after each frame, valid or not.
+ * Used to print a frame separator in the desired output format.
+ */
void frame_sep(void);
+
+/**
+ * Called whenever a frame error condition occurs.
+ * When frames or datasets have errors.
+ */
void frame_err(void);
#endif /* tic_h */
tic2json TIC parser/converter
RSS Atom

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