chiark / gitweb /
@@@ man wip
[mLib] / test / tvec.3
1 .\" -*-nroff-*-
2 .de VS
3 .sp 1
4 .RS
5 .nf
6 .ft B
7 ..
8 .de VE
9 .ft R
10 .fi
11 .RE
12 .sp 1
13 ..
14 .de hP
15 .IP
16 .ft B
17 \h'-\w'\\$1\ 'u'\\$1\ \c
18 .ft P
19 ..
20 .ie t \{\
21 .  ds o \(bu
22 .  de VP
23 .    sp .4v
24 ..
25 \}
26 .el \{\
27 .  ds o o
28 .  de VP
29 .    sp
30 ..
31 \}
32 ..
33 .TH tvec 3 "11 March 2024" "Straylight/Edgeware" "mLib utilities library"
34 .SH NAME
35 tvec \- test vector framework
36 .\" @tvec_begin
37 .\" @tvec_end
38 .\" @tvec_read
39 .\" @tvec_humanoutput
40 .\" @tvec_tapoutput
41 .\" @tvec_dfltoutput
42 .
43 .SH SYNOPSIS
44 .nf
45 .B "#include <mLib/tvec.h>"
46 .PP
47 .ta 2n
48 .B "union tvec_misc {"
49 .B "    const void *p;"
50 .B "    long i;"
51 .B "    unsigned long u;"
52 .B "    double f;"
53 .B "};"
54 .B "enum {"
55 .B "    TVMISC_PTR,"
56 .B "    TVMISC_INT,"
57 .B "    TVMISC_UINT,"
58 .B "    TVMISC_FLT,"
59 .B "    ...,"
60 .B "    TVMISC_LIMIT,"
61 .B "};"
62 .PP
63 .ta 2n +2n
64 .B "union tvec_regval {"
65 .B "    long i;"
66 .B "    unsigned long u;"
67 .B "    void *p;"
68 .B "    double f;"
69 .B "    struct { char *p; size_t sz; } text;"
70 .B "    struct { unsigned char *p; size_t sz; } bytes;"
71 .B "    struct {"
72 .B "            unsigned char *p; size_t sz;"
73 .B "            size_t a, m;"
74 .B "            size_t off;"
75 .B "    } buf;"
76 .B "    TVEC_REGSLOTS"
77 .B "};"
78 .B "struct tvec_reg {"
79 .B "    unsigned f;"
80 .B "    union tvec_regval v;"
81 .B "};"
82 .B "#define TVRF_LIVE ..."
83 .PP
84 .ta 2n
85 .B "struct tvec_regdef {"
86 .B "    const char *name;"
87 .B "    const struct tvec_regty *ty;"
88 .B "    unsigned i;"
89 .B "    unsigned f;"
90 .B "    union tvec_misc arg;"
91 .B "};"
92 .B "#define TVRF_OPT ..."
93 .B "#define TVRF_ID ..."
94 .B "#define TVEC_ENDREGS ..."
95 .PP
96 .B "struct tvec_state;"
97 .PP
98 .B "struct tvec_env;"
99 .ta \w'\fBtypedef void tvec_testfn('u
100 .BI "typedef void tvec_testfn(const struct tvec_reg *" in ,
101 .BI "   struct tvec_reg *" out ,
102 .BI "   void *" ctx );
103 .B "struct tvec_test {"
104 .B "    const char *name;"
105 .B "    const struct tvec_regdef *regs;"
106 .B "    const struct tvec_env *env;"
107 .B "    tvec_testfn *fn;"
108 .B "};"
109 .B "#define TVEC_ENDTESTS ..."
110 .PP
111 .ta 2n
112 .B "struct tvec_config {"
113 .B "    const struct tvec_test *tests;"
114 .B "    unsigned nrout, nreg;"
115 .B "    size_t regsz;"
116 .B "};"
117 .B "struct tvec_output;"
118 .PP
119 .ta \w'\fBvoid tvec_begin('u
120 .BI "void tvec_begin(struct tvec_state *" tv_out ,
121 .BI "   const struct tvec_config *" config ,
122 .BI "   struct tvec_output *" o );
123 .BI "int tvec_end(struct tvec_state *" tv );
124 .BI "int tvec_read(struct tvec_state *" tv ", const char *" infile ", FILE *" fp );
125 .PP
126 .BI "extern struct tvec_output *tvec_humanoutput(FILE *" fp );
127 .BI "extern struct tvec_output *tvec_tapoutput(FILE *" fp );
128 .BI "extern struct tvec_output *tvec_dfltoutput(FILE *" fp );
129 .fi