globally remove all trailing whitespace from ardour code base.
[ardour.git] / libs / backends / wavesaudio / portmidi / src / pm_mac / readbinaryplist.h
1 /* readbinaryplist.h -- header to read preference files
2
3    Roger B. Dannenberg, Jun 2008
4 */
5
6 #include <stdint.h> /* for uint8_t ... */
7
8 #ifndef TRUE
9     #define TRUE 1
10     #define FALSE 0
11 #endif
12
13 #define MAX_KEY_SIZE 256
14
15 enum
16 {
17     // Object tags (high nybble)
18     kTAG_SIMPLE = 0x00,        // Null, true, false, filler, or invalid
19     kTAG_INT = 0x10,
20     kTAG_REAL = 0x20,
21     kTAG_DATE = 0x30,
22     kTAG_DATA = 0x40,
23     kTAG_ASCIISTRING = 0x50,
24     kTAG_UNICODESTRING = 0x60,
25     kTAG_UID = 0x80,
26     kTAG_ARRAY = 0xA0,
27     kTAG_DICTIONARY = 0xD0,
28
29     // "simple" object values
30     kVALUE_NULL = 0x00,
31     kVALUE_FALSE = 0x08,
32     kVALUE_TRUE = 0x09,
33     kVALUE_FILLER = 0x0F,
34
35     kVALUE_FULLDATETAG = 0x33        // Dates are tagged with a whole byte.
36 };
37
38
39 typedef struct pldata_struct {
40     uint8_t *data;
41     size_t len;
42 } pldata_node, *pldata_ptr;
43
44
45 typedef struct array_struct {
46     struct value_struct **array;
47     uint64_t length;
48 } array_node, *array_ptr;
49
50
51 // a dict_node is a list of <key, value> pairs
52 typedef struct dict_struct {
53     struct value_struct *key;
54     struct value_struct *value;
55     struct dict_struct *next;
56 } dict_node, *dict_ptr;
57
58
59 // an value_node is a value with a tag telling the type
60 typedef struct value_struct {
61     int tag;
62     union {
63         int64_t integer;
64         uint64_t uinteger;
65         double real;
66         char *string;
67         pldata_ptr data;
68         array_ptr array;
69         struct dict_struct *dict;
70     };
71 } value_node, *value_ptr;
72
73
74 value_ptr bplist_read_file(char *filename);
75 value_ptr bplist_read_user_pref(char *filename);
76 value_ptr bplist_read_system_pref(char *filename);
77 void bplist_free_data();
78
79 /*************** functions for accessing values ****************/
80
81 char *value_get_asciistring(value_ptr v);
82 value_ptr value_dict_lookup_using_string(value_ptr v, char *key);
83 value_ptr value_dict_lookup_using_path(value_ptr v, char *path);
84
85 /*************** functions for debugging ***************/
86
87 void plist_print(value_ptr v);
88