Initial revision
[ssr] / StraySrc / Libraries / Steel / h / res
1 /*
2 * res
3 *
4 * Access to resources
5 *
6 * © 1991-1998 Straylight
7 */
8
9 /*----- Licensing note ----------------------------------------------------*
10 *
11 * This file is part of Straylight's Steel library.
12 *
13 * Steel is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * Steel is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with Steel. If not, write to the Free Software Foundation,
25 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 */
27
28 #ifndef __res_h
29 #define __res_h
30
31 #ifndef __stdio_h
32 #include <stdio.h>
33 #endif
34
35 #ifndef BOOL
36 #define BOOL int
37 #define TRUE 1
38 #define FALSE 0
39 #endif
40
41 /*
42 *
43 * void res_init(char *progname)
44 *
45 * Use
46 * Sets up res to use a certain path for resources. Mainly for
47 * compatibility with older applications.
48 *
49 * Parameters
50 * char *progname == the program name (sets up path as <progname$Dir>)
51 */
52
53 void res_init(char *progname);
54
55 /*
56 * void res_setPrefix(char *prefix)
57 *
58 * Use
59 * Sets up a full prefix for resources. This means you can keep resources
60 * in separate directories.
61 *
62 * Parameters
63 * char *prefix == the prefix
64 */
65
66 void res_setPrefix(char *prefix);
67
68 /*
69 * BOOL res_fileExists(char *name)
70 *
71 * Use
72 * Informs the caller if a given file exists
73 *
74 * Parameters
75 * char *name == the name of the file
76 *
77 * Returns
78 * TRUE if the file really does exist
79 */
80
81 BOOL res_fileExists(char *name);
82
83 /*
84 * int res_findname(const char *resname,char *buf)
85 *
86 * Use
87 * Returns a full pathname for the resource file as given in the buffer.
88 * This is for compatibility reasons. If I was writing this fresh, I
89 * would return a pointer to an internal static object, but Acorn know
90 * best...
91 *
92 * Some new functionality has been added. It will look for files first in
93 * the directory set up using res_init or res_setPrefix, and then in the
94 * 'Resources' subdirectory. If neither is present, then the name returned
95 * is in the main application directory.
96 *
97 * Also, under RISC OS 3, it will search for files with mode prefixes, so
98 * you can use multiple sprite files for different resolutions. Isn't this
99 * fun!
100 *
101 * Parameters
102 * const char *resname == the leafname of the resource file.
103 * char *buf == where to put the result.
104 *
105 * Returns
106 * TRUE for compatibility with the Acorn version. What good it does, I
107 * don't know. This is in all a very odd routine indeed.
108 */
109
110 int res_findname(const char *resname,char *buf);
111
112 /*
113 * char *res_name(const char *resname)
114 *
115 * Use
116 * Translates the name given as for res_findname and returns a pointer to
117 * the translated string
118 */
119
120 char *res_name(const char *resname);
121
122 /*
123 * FILE *res_openfile(const char *resname,const char *mode)
124 *
125 * Use
126 * Opens a resource file in a given ANSI mode. It does this without the
127 * odd adding on of numbers to the end that the Acorn one does (I hope!)
128 *
129 * Parameters
130 * const char *resname == leafname of file to open
131 * const char *mode == pointer to ANSI mode string
132 *
133 * Returns
134 * A standard ANSI-type FILE pointer.
135 */
136
137 FILE *res_openfile(const char *resname,const char *mode);
138
139 #endif