power: supply: bq24190_charger: Add disable-reset device-property
[linux/fpc-iii.git] / tools / perf / pmu-events / jsmn.h
blobd666b10cf25b889d6692c8a7249a783fef1a9c3e
1 #ifndef __JSMN_H_
2 #define __JSMN_H_
4 /*
5 * JSON type identifier. Basic types are:
6 * o Object
7 * o Array
8 * o String
9 * o Other primitive: number, boolean (true/false) or null
11 typedef enum {
12 JSMN_PRIMITIVE = 0,
13 JSMN_OBJECT = 1,
14 JSMN_ARRAY = 2,
15 JSMN_STRING = 3
16 } jsmntype_t;
18 typedef enum {
19 /* Not enough tokens were provided */
20 JSMN_ERROR_NOMEM = -1,
21 /* Invalid character inside JSON string */
22 JSMN_ERROR_INVAL = -2,
23 /* The string is not a full JSON packet, more bytes expected */
24 JSMN_ERROR_PART = -3,
25 /* Everything was fine */
26 JSMN_SUCCESS = 0
27 } jsmnerr_t;
30 * JSON token description.
31 * @param type type (object, array, string etc.)
32 * @param start start position in JSON data string
33 * @param end end position in JSON data string
35 typedef struct {
36 jsmntype_t type;
37 int start;
38 int end;
39 int size;
40 } jsmntok_t;
43 * JSON parser. Contains an array of token blocks available. Also stores
44 * the string being parsed now and current position in that string
46 typedef struct {
47 unsigned int pos; /* offset in the JSON string */
48 int toknext; /* next token to allocate */
49 int toksuper; /* superior token node, e.g parent object or array */
50 } jsmn_parser;
53 * Create JSON parser over an array of tokens
55 void jsmn_init(jsmn_parser *parser);
58 * Run JSON parser. It parses a JSON data string into and array of tokens,
59 * each describing a single JSON object.
61 jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js,
62 size_t len,
63 jsmntok_t *tokens, unsigned int num_tokens);
65 const char *jsmn_strerror(jsmnerr_t err);
67 #endif /* __JSMN_H_ */