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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/**
* @ingroup file68_lib
* @file sc68/rsc68.h
* @author Benjamin Gerard
* @date 1998-10-07
* @brief Resources access header.
*
*/
/* $Id: rsc68.h 102 2009-03-14 17:21:58Z benjihan $ */
/* Copyright (C) 1998-2009 Benjamin Gerard */
/** @defgroup file68_rsc Resource access
* @ingroup file68_lib
*
* Provides resource access functions.
*
* @{
*/
/** Resource type. */
typedef enum
rsc68_t;
/** Resource specific information. */
typedef struct rsc68_info_t;
/** Resource handle function type. */
typedef istream68_t * ;
/** Initialize resource.
*
* Initialized internal data and reset all pathes to
* default.
*
* @return error-code
* @retval -1 error
*/
int ;
/** Shutdown resource.
*
* Clean up and free all pathes.
*
*/
void ;
/** Set shared resource path.
*
* The rsc68_set_share() function set the shared resource
* path. The path will be duplicate by SC68strdup(). If path is
* null the current path is freed.
*
* @param path New shared resource path (0 for free).
*
* @return new path (duplicated string).
* @retval 0 error (except for freeing)
*
*/
const char * ;
/** Set user resource path.
*
* The rsc68_set_user() function set the user resource path. The
* path will be duplicate by SC68strdup(). If path is null the
* current path is freed.
*
* @param path New user resource path (0 for free).
*
* @return new path (duplicated string).
* @retval 0 error (except for freeing)
*/
const char * ;
/** Set sc68 local music database path.
*
* The rsc68_set_music() function set the local music database
* path. The path will be duplicate by SC68strdup(). If path is
* null the current path is freed.
*
* @param path New local music database path (0 for free).
*
* @return new path (duplicated string).
* @retval 0 error (except for freeing)
*/
const char * ;
/** Set sc68 remote music database path.
*
* The rsc68_set_remote_music() function set the remote music
* database path. The path will be duplicate by SC68strdup(). If
* path is null the current path is freed.
*
* @param path New remote music database path (0 for free).
*
* @return new path (duplicated string).
* @retval 0 error (except for freeing)
*/
const char * ;
/** Get resource pathes.
*
* @param share Get the shared resource path (0 to ignore).
* @param user Get the user resource path (0 to ignore).
* @param lmusic Get the local music database path (0 to ignore).
* @param rmusic Get the remote music database path (0 to ignore).
*/
void ;
/** Set/Get resource handler.
*
* The rsc68_set_handler() function set the current resource
* handler. If 0 is given as fct parameter the function does not
* set the handler. In all case the function returns the current
* handler. See below for more information about the default
* resource handler.
*
* @par Resource handler
* The resource handler is a function called by the rsc68_open()
* function. Some preliminary tests has already been performed. So
* the handler can assume that the name is not a NULL pointer and
* the mode is valid (either 1:reading or 2:writing). The resource
* handler @b must return an @b already opened istream68_t or 0 in
* error case.
*
* @par Default resource handler
* The Default handler use a the istream68_file_create() function.
* - If open mode is 2 (write mode) the default handler use the user
* resource path.
* - If open mode is 1 (read mode) the default handler tries in this
* order the user resource path and the shared resource path.
*
* @param fct New resource handler (0 for reading current value).
* @return previous value.
*/
rsc68_handler_t ;
/** Open a resource in given mode.
*
* The function rsc68_open() function opens an istream68_t to
* access a resource.
*
* @param type Type of resource to open.
* @param name Name of resource.
* @param mode 1:read-access, 2:write-access.
* @param info Get additionnal info (depends on type)
*
* @return already opened istream68_t stream.
* @retval 0 error.
*
* @see rsc68_set_handler() for more info on resource handler.
*/
istream68_t * ;
/** Open a resource URL in given mode.
*
* @param url Any valid rsc68://type/ URL
* @param mode 1:read-access, 2:write-access.
* @param info Get additionnal info (depends on type)
*
* @return already opened istream68_t stream.
* @retval 0 error.
*
* @see rsc68_open()
*/
istream68_t * ;
/** Create a resource from URL in given mode.
*
* @param url Any valid rsc68://type/ URL
* @param mode 1:read-access, 2:write-access.
* @param info Get additionnal info (depends on type)
*
* @return istream68_t stream.
* @retval 0 error.
*
* @see rsc68_open_url()
*/
istream68_t * ;
/** Get music parameters from string.
*
* The rsc68_get_music_params() function parses the str string and
* stores track loop and time in the info struct. If it successes the
* info::type is set to rsc68_music else it is set rsc68_last.
*
* @param info info to fill (0:parse only)
* @param str URL part containing music parameter ":track:loop:time"
*
* @return Parsing stop position
* @retval str on invalid string
* @retval >str next '/' or end of string
*/
const char * ;
/**
* @}
*/
/* #ifndef _FILE68_RSC68_H_ */