Debian Codegraph @

support/babel/tads2.c

raw symbols SCIP
1 /*
2 * tads2.c - Treaty of Babel module for Tads 2 files
3 *
4 * This file depends on treaty_builder.h
5 *
6 * This file is public domain, but note that any changes to this file may
7 * render it noncompliant with the Treaty of Babel
8 *
9 * Modified
10 *. 04/15/2006 LRRaszewski - Separated tads2.c and tads3.c
11 *. 04/08/2006 LRRaszewski - changed babel API calls to threadsafe versions
12 *. 04/08/2006 MJRoberts - initial implementation
13 */
14
15 #define FORMAT tads2
16 #define HOME_PAGE "http://www.tads.org"
17 #define FORMAT_EXT ".gam"
18
19
20 #include "treaty_builder.h"
21 #include "tads.h"
22
23 #define T2_SIGNATURE "TADS2 bin\012\015\032"
24
25 #ifndef FALSE
26 #define FALSE 0
27 #endif
28 #ifndef TRUE
29 #define TRUE 1
30 #endif
31
32 /*
33 * get a story file's IFID
34 */
35 static int32 get_story_file_IFID(void *story_file, int32 extent,
36 char *output, int32 output_extent)
37 {
38 /* use the common tads IFID extractor/generator */
39 return tads_get_story_file_IFID(story_file, extent,
40 output, output_extent);
41 }
42
43 /*
44 * determine if a given story file is one of ours
45 */
46 static int32 claim_story_file(void *story_file, int32 extent)
47 {
48 /* check our signature */
49 if (tads_match_sig(story_file, extent, T2_SIGNATURE))
50 return VALID_STORY_FILE_RV;
51
52 /* not one of ours */
53 return INVALID_STORY_FILE_RV;
54 }
55
56 /*
57 * Get the size of the iFiction metadata for the game
58 */
59 static int32 get_story_file_metadata_extent(void *story_file, int32 extent)
60 {
61 /* use the common tads iFiction synthesizer */
62 return tads_get_story_file_metadata_extent(story_file, extent);
63 }
64
65 /*
66 * Get the iFiction metadata for the game
67 */
68 static int32 get_story_file_metadata(void *story_file, int32 extent,
69 char *buf, int32 bufsize)
70 {
71 /* use the common tads iFiction synthesizer */
72 return tads_get_story_file_metadata(story_file, extent, buf, bufsize);
73 }
74
75 static int32 get_story_file_cover_extent(void *story_file, int32 story_len)
76 {
77 /* use the common tads cover file extractor */
78 return tads_get_story_file_cover_extent(story_file, story_len);
79 }
80
81 /*
82 * Get the format of the cover art
83 */
84 static int32 get_story_file_cover_format(void *story_file, int32 story_len)
85 {
86 /* use the common tads cover file extractor */
87 return tads_get_story_file_cover_format(story_file, story_len);
88 }
89
90 /*
91 * Get the cover art data
92 */
93 static int32 get_story_file_cover(void *story_file, int32 story_len,
94 void *outbuf, int32 output_extent)
95 {
96 /* use the common tads cover file extractor */
97 return tads_get_story_file_cover(story_file, story_len,
98 outbuf, output_extent);
99 }
100