summaryrefslogtreecommitdiff
path: root/sys/src/games/music/jukefs/object.h
blob: 30a776f3fd64c3eb2ecc712f470b646af1355f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* Keywords */

typedef enum {
	Category,
	Cddata,
	Cmd,
	File,
	Include,
	Key,
	Lyrics,
	Part,
	Path,
	Performance,
	Recording,
	Root,
	Search,
	Soloists,
	Time,
	Track,
	Work,
	Ntoken,	/* Initializer for ntoken */
	Eof	=	-1,
	Txt	=	-2,
	BraceO	=	-3,
	BraceC	=	-4,
	Equals	=	-5,
	Newcat	=	-6,
} Type;

typedef struct Object Object;
typedef struct Catset Catset;
typedef struct Token Token;
typedef struct Cmdlist Cmdlist;

/* Token-only types */

typedef enum {
	Obj,
	Cat,
} Kind;

struct Catset {
	uchar *bitpiece;	/* mallocated */
	int nbitpiece;
};


struct Token {
	char	*name;
	Kind	kind;
	long	value;
	char	*kname;
	Catset	categories;
};

typedef enum {
	Hierarchy,
	Typelist,
	Nlisttype,
} Listtype;

struct Cmdlist {
	int	flag;
	char	*name;
};

#define KEYLEN 128

struct Object {
	Type	type;
	int	tabno;		/* entry in object table */
	Object	*parent;
	Object	**children;	/* mallocated */
	Object	**catparents;
	Object	*orig;		/* back pointer from search object */
	int	nchildren;
	int	ncatparents;
	Catset	categories;	/* was int */
	int	flags;
	int	num;		/* for enumerations */
	char	*value;		/* mallocated */
	char	key[KEYLEN];
	char	*path;		/* mallocated */
};

#define Sort	0x01
#define Enum	0x02
#define Hier	0x04
#define Elab	0x10	/* elaborated rune string */

extern	Token	*tokenlist;
extern	int	ncat;
extern	Object	**catobjects;
extern	Biobuf	*f;
extern	char	*file;
extern	Object	*root;
extern	int	ntoken;

extern	Object	**otab;	// object table
extern	int	notab;	// no of entries used
extern	int	sotab;	// no of entries mallocated
extern	int	hotab;	// no of holes in tab
extern	char	*user;

void	io(void *);
long	printchildren(char*, int, Object*);
long	printdigest(char*, int, Object*);
long	printfiles(char*, int, Object*);
long	printfulltext(char*, int, Object*);
long	printkey(char*, int, Object*);
long	printminiparentage(char*, int, Object*);
long	printparent(char*, int, Object*);
long	printparentage(char*, int, Object*);
long	printtext(char*, int, Object*);
long	printtype(char*, int, Object*);
void	reread(void);
void	listfiles(Object *o);