Debian Codegraph @

terps/tads/tads3/resfind.h

raw symbols SCIP
1 /*
2 * Copyright (c) 2001, 2002 Michael J. Roberts. All Rights Reserved.
3 *
4 * Please see the accompanying license file, LICENSE.TXT, for information
5 * on using and copying this software.
6 */
7 /*
8 Name
9 resfind.cpp - find a multimedia resource in a tads 2 or tads 3 game file
10 Function
11 Searches a compiled tads 2 game file or a compiled tads 3 image file
12 for a multimedia resource of a given name. The caller doesn't have to
13 know which tads version created the file; we'll sense the file type and
14 parse it accordingly.
15
16 This implementation is independent of any tads 2 or tads 3 subsystem
17 except osifc, which it uses for portable file I/O and portable byte format
18 conversions.
19 Notes
20
21 Modified
22 09/24/01 MJRoberts - Creation
23 */
24
25 #ifndef RESFIND_H
26 #define RESFIND_H
27
28 /*
29 * Resource locator. This gives the seek offset and size of a resource
30 * within a larger file.
31 */
32 struct tads_resinfo
33 {
34 /* seek location of start of resource */
35 unsigned long seek_pos;
36
37 /* size of resource in bytes */
38 unsigned long siz;
39 };
40
41 /*
42 * Find a multimedia resource with the given name in the given file. The
43 * file must be positioned at the start of the tads game file when we're
44 * invoked - this allows searching for a resource within a game file that
45 * is embedded in a larger file stream, since we don't care where within
46 * the osfildef stream the tads game file starts.
47 *
48 * Fills in the resource information structure with the seek offset and
49 * size of the resource in the file and returns true if the resource is
50 * found; returns false if a resource with the given name doesn't exist in
51 * the file.
52 */
53 int tads_find_resource_fp(osfildef *fp, const char *resname,
54 tads_resinfo *info);
55
56 /*
57 * Find a resource in a file, given the filename.
58 *
59 * Fills in the resource information structure with the seek offset and
60 * size of the resource in the file and returns true if the resource is
61 * found; returns false if a resource with the given name doesn't exist in
62 * the file.
63 */
64 int tads_find_resource(const char *fname, const char *resname,
65 tads_resinfo *info);
66
67
68 #endif /* RESFIND_H */