make libjson from /sys/src/cmd/btc/json.c
This commit is contained in:
parent
632b7adffb
commit
2dc7e311f4
6 changed files with 16 additions and 5 deletions
35
sys/include/json.h
Normal file
35
sys/include/json.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#pragma src "/sys/src/libjson"
|
||||
#pragma lib "libjson.a"
|
||||
|
||||
typedef struct JSONEl JSONEl;
|
||||
typedef struct JSON JSON;
|
||||
|
||||
enum {
|
||||
JSONNull,
|
||||
JSONBool,
|
||||
JSONNumber,
|
||||
JSONString,
|
||||
JSONArray,
|
||||
JSONObject,
|
||||
};
|
||||
|
||||
struct JSONEl {
|
||||
char *name;
|
||||
JSON *val;
|
||||
JSONEl *next;
|
||||
};
|
||||
|
||||
struct JSON
|
||||
{
|
||||
int t;
|
||||
union {
|
||||
double n;
|
||||
char *s;
|
||||
JSONEl *first;
|
||||
};
|
||||
};
|
||||
|
||||
JSON* jsonparse(char *);
|
||||
void jsonfree(JSON *);
|
||||
JSON* jsonbyname(JSON *, char *);
|
||||
char* jsonstr(JSON *);
|
Loading…
Add table
Add a link
Reference in a new issue