-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjsemtblgen.h
98 lines (80 loc) · 2.11 KB
/
jsemtblgen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* jsemtblgen - generate JSON semantics table
*
* "Because specs w/o version numbers are forced to commit to their original design flaws." :-)
*
* This JSON parser was co-developed in 2022 by:
*
* @xexyl
* https://xexyl.net Cody Boone Ferguson
* https://ioccc.xexyl.net
* and:
* chongo (Landon Curt Noll, http://www.isthe.com/chongo/index.html) /\oo/\
*
* "Because sometimes even the IOCCC Judges need some help." :-)
*
* The concept of the JSON semantics tables was developed by Landon Curt Noll.
*
* "Share and Enjoy!"
* -- Sirius Cybernetics Corporation Complaints Division, JSON spec department. :-)
*/
#if !defined(INCLUDE_JSEMTBLGEN_H)
# define INCLUDE_JSEMTBLGEN_H
#include <ctype.h>
/*
* dbg - info, debug, warning, error, and usage message facility
*/
#if defined(INTERNAL_INCLUDE)
#include "../dbg/dbg.h"
#elif defined(INTERNAL_INCLUDE_2)
#include "dbg/dbg.h"
#else
#include <dbg.h>
#endif
/*
* util - common utility functions for the JSON parser
*/
#include "util.h"
/*
* dyn_array - dynamic array facility
*/
#if defined(INTERNAL_INCLUDE)
#include "../dyn_array/dyn_array.h"
#elif defined(INTERNAL_INCLUDE_2)
#include "dyn_array/dyn_array.h"
#else
#include <dyn_array.h>
#endif
/*
* json_util - general JSON parser utility support functions
*/
#include "json_util.h"
/*
* jparse - JSON parser
*/
#include "jparse.h"
/*
* version - JSON parser API and tool version
*/
#include "version.h"
/*
* json_sem - JSON semantics support
*/
#include "json_sem.h"
/*
* official jsemtblgen version
*/
#define JSEMTBLGEN_VERSION "1.2.1 2025-01-18" /* format: major.minor YYYY-MM-DD */
/*
* jsemtblgen tool basename
*/
#define JSEMTBLGEN_BASENAME "jsemtblgen"
/*
* static functions
*/
static void gen_sem_tbl(struct json *tree, unsigned int max_depth, ...);
static void vupdate_tbl(struct json *node, unsigned int depth, va_list ap);
static int sem_cmp(void const *a, void const *b);
static void print_sem_c_src(struct dyn_array *tbl, char *tbl_name, char *cap_tbl_name);
static void print_sem_h_src(struct dyn_array *tbl, char *tbl_name, char *cap_tbl_name);
#endif /* INCLUDE_JSEMTBLGEN_H */