~ubuntu-branches/ubuntu/trusty/portmidi/trusty

« back to all changes in this revision

Viewing changes to pm_mac/readbinaryplist.h

  • Committer: Bazaar Package Importer
  • Author(s): Paul Brossier
  • Date: 2009-09-16 06:50:57 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090916065057-lz24lbrrygyev85b
Tags: 1:131-1
* New upstream version, uses epoch (closes: #501132)
* debian/watch: update to match new download location and version
  numbering (closes: #450055), but still fails due to zip format
* Add depends on quilt, move patches to debian/patches
* Add Homepage to debian/control
* debian/control: use ${binary:Version}, bump to S-V 3.8.3
* debian/compat: bump to 5
* debian/copyright: update to match license.txt and add missing copyrights
* debian/patches/02_pmlinuxalsa.diff: remove merged hunks
* debian/patches/04_ptlinux.diff: remove merged hunks
* debian/patches/05_makefile.diff: merge and link portmidi to porttime,
  thanks to Willem van Engen (closes: #515712)
* debian/rules: use pm_linux/Makefile, ship CHANGELOG.txt and make sure
  source and header files are not executable
* debian/README.source: refer to quilt documentation
* debian/libportmidi-dev.install: do not try to install unexisting files
* debian/patches/{06_pm_test_mm,07_pm_test_sysex,08_pm_test_qtest}.diff:
  get rid of missing include and parenthesis, fix long int formatting
* debian/rules: do not compress header files

Show diffs side-by-side

added added

removed removed

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