make libjson from /sys/src/cmd/btc/json.c

This commit is contained in:
BurnZeZ 2013-10-27 15:44:33 -04:00
parent 632b7adffb
commit 2dc7e311f4
6 changed files with 16 additions and 5 deletions

35
sys/include/json.h Normal file
View 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 *);