xref: /plan9-contrib/sys/src/games/music/jukefs/object.h (revision 6ca6a3e703ee2ec4aed99c2177f71d7f127da6d9)
1 enum {
2 	STACKSIZE = 2048 * sizeof(void*),
3 };
4 
5 /* Keywords */
6 
7 typedef enum {
8 	Category,
9 	Cddata,
10 	Cmd,
11 	File,
12 	Include,
13 	Key,
14 	Lyrics,
15 	Part,
16 	Path,
17 	Performance,
18 	Recording,
19 	Root,
20 	Search,
21 	Soloists,
22 	Time,
23 	Track,
24 	Work,
25 	Ntoken,	/* Initializer for ntoken */
26 	Eof	=	-1,
27 	Txt	=	-2,
28 	BraceO	=	-3,
29 	BraceC	=	-4,
30 	Equals	=	-5,
31 	Newcat	=	-6,
32 } Type;
33 
34 typedef struct Object Object;
35 typedef struct Catset Catset;
36 typedef struct Token Token;
37 typedef struct Cmdlist Cmdlist;
38 
39 /* Token-only types */
40 
41 typedef enum {
42 	Obj,
43 	Cat,
44 } Kind;
45 
46 struct Catset {
47 	uchar *bitpiece;	/* mallocated */
48 	int nbitpiece;
49 };
50 
51 
52 struct Token {
53 	char	*name;
54 	Kind	kind;
55 	long	value;
56 	char	*kname;
57 	Catset	categories;
58 };
59 
60 typedef enum {
61 	Hierarchy,
62 	Typelist,
63 	Nlisttype,
64 } Listtype;
65 
66 struct Cmdlist {
67 	int	flag;
68 	char	*name;
69 };
70 
71 #define KEYLEN 128
72 
73 struct Object {
74 	Type	type;
75 	int	tabno;		/* entry in object table */
76 	Object	*parent;
77 	Object	**children;	/* mallocated */
78 	Object	**catparents;
79 	Object	*orig;		/* back pointer from search object */
80 	int	nchildren;
81 	int	ncatparents;
82 	Catset	categories;	/* was int */
83 	int	flags;
84 	int	num;		/* for enumerations */
85 	char	*value;		/* mallocated */
86 	char	key[KEYLEN];
87 	char	*path;		/* mallocated */
88 };
89 
90 #define Sort	0x01
91 #define Enum	0x02
92 #define Hier	0x04
93 #define Elab	0x10	/* elaborated rune string */
94 
95 extern	Token	*tokenlist;
96 extern	int	ncat;
97 extern	Object	**catobjects;
98 extern	Biobuf	*f;
99 extern	char	*file;
100 extern	Object	*root;
101 extern	int	ntoken;
102 
103 extern	Object	**otab;	// object table
104 extern	int	notab;	// no of entries used
105 extern	int	sotab;	// no of entries mallocated
106 extern	int	hotab;	// no of holes in tab
107 extern	char	*user;
108 
109 void	io(void *);
110 long	printchildren(char*, int, Object*);
111 long	printdigest(char*, int, Object*);
112 long	printfiles(char*, int, Object*);
113 long	printfulltext(char*, int, Object*);
114 long	printkey(char*, int, Object*);
115 long	printminiparentage(char*, int, Object*);
116 long	printparent(char*, int, Object*);
117 long	printparentage(char*, int, Object*);
118 long	printtext(char*, int, Object*);
119 long	printtype(char*, int, Object*);
120 void	reread(void);
121 void	listfiles(Object *o);
122