X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=babel%2Ftads3.c;fp=babel%2Ftads3.c;h=23d8fb5c58cf5398999e4ec99c8e1564c41527b5;hb=6fd0347f330cb24ef6145662023053a1c0f81a64;hp=0000000000000000000000000000000000000000;hpb=7d14a66ee234db0898de6fabb8f850ebc4bb733a;p=projects%2Fchimara%2Fchimara.git diff --git a/babel/tads3.c b/babel/tads3.c new file mode 100644 index 0000000..23d8fb5 --- /dev/null +++ b/babel/tads3.c @@ -0,0 +1,100 @@ +/* + * tads3.c - Treaty of Babel module for Tads 3 files + * + * This file depends on treaty_builder.h + * + * This file is public domain, but note that any changes to this file may + * render it noncompliant with the Treaty of Babel + * + * Modified + *. 04/15/2006 LRRaszewski - Separated tads2.c and tads3.c + *. 04/08/2006 LRRaszewski - changed babel API calls to threadsafe versions + *. 04/08/2006 MJRoberts - initial implementation + */ + +#define FORMAT tads3 +#define HOME_PAGE "http://www.tads.org" +#define FORMAT_EXT ".t3" + + +#include "treaty_builder.h" +#include "tads.h" + +#define T3_SIGNATURE "T3-image\015\012\032" + +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif + +/* + * get a story file's IFID + */ +static int32 get_story_file_IFID(void *story_file, int32 extent, + char *output, int32 output_extent) +{ + /* use the common tads IFID extractor/generator */ + return tads_get_story_file_IFID(story_file, extent, + output, output_extent); +} + +/* + * determine if a given story file is one of ours + */ +static int32 claim_story_file(void *story_file, int32 extent) +{ + /* check our signature */ + if (tads_match_sig(story_file, extent, T3_SIGNATURE)) + return VALID_STORY_FILE_RV; + + /* not one of ours */ + return INVALID_STORY_FILE_RV; +} + +/* + * Get the size of the iFiction metadata for the game + */ +static int32 get_story_file_metadata_extent(void *story_file, int32 extent) +{ + /* use the common tads iFiction synthesizer */ + return tads_get_story_file_metadata_extent(story_file, extent); +} + +/* + * Get the iFiction metadata for the game + */ +static int32 get_story_file_metadata(void *story_file, int32 extent, + char *buf, int32 bufsize) +{ + /* use the common tads iFiction synthesizer */ + return tads_get_story_file_metadata(story_file, extent, buf, bufsize); +} + +static int32 get_story_file_cover_extent(void *story_file, int32 story_len) +{ + /* use the common tads cover file extractor */ + return tads_get_story_file_cover_extent(story_file, story_len); +} + +/* + * Get the format of the cover art + */ +static int32 get_story_file_cover_format(void *story_file, int32 story_len) +{ + /* use the common tads cover file extractor */ + return tads_get_story_file_cover_format(story_file, story_len); +} + +/* + * Get the cover art data + */ +static int32 get_story_file_cover(void *story_file, int32 story_len, + void *outbuf, int32 output_extent) +{ + /* use the common tads cover file extractor */ + return tads_get_story_file_cover(story_file, story_len, + outbuf, output_extent); +} +