X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=babel%2Fblorb.c;fp=babel%2Fblorb.c;h=0000000000000000000000000000000000000000;hb=3c59ba5eef5cb4d39c06eb7f523b9c3b026bdc9b;hp=ebb84e4ba31806995316ba31ebed7aa07027a811;hpb=ed91d840318ed6ebfe3a5a77fa17114ddbf56640;p=projects%2Fchimara%2Fchimara.git diff --git a/babel/blorb.c b/babel/blorb.c deleted file mode 100644 index ebb84e4..0000000 --- a/babel/blorb.c +++ /dev/null @@ -1,245 +0,0 @@ -/* blorb.c Babel interface to blorb files - * Copyright 2006 by L. Ross Raszewski - * - * This code is freely usable for all purposes. - * - * This work is licensed under the Creative Commons Attribution2.5 License. - * To view a copy of this license, visit - * http://creativecommons.org/licenses/by/2.5/ or send a letter to - * Creative Commons, - * 543 Howard Street, 5th Floor, - * San Francisco, California, 94105, USA. - * - * This file depends upon treaty_builder.h, misc.c and ifiction.c - * - * Header note: to add support for new executable chunk types, see - * TranslateExec. - * - * This file defines a Treaty of Babel compatable module for handling blorb - * files. However, blorb files are not themselves a babel format. This module - * is used internally by the babel program to handle blorbs. - * - * As a result, if GET_STORY_FILE_IFID_SEL returns NO_REPLY_RV, - * you should check the story file against the babel registry before resorting - * to the default IFID calculation. - * - */ -#define FORMAT blorb -#define HOME_PAGE "http://eblong.com/zarf/blorb" -#define FORMAT_EXT ".blorb,.blb,.zblorb,.zlb,.gblorb,.glb" -#define CONTAINER_FORMAT -#include "treaty_builder.h" -#include -#include - -extern TREATY treaty_registry[]; -/* The following is the translation table of Blorb chunk types to - babel formats. it is NULL-terminated. */ -static char *TranslateExec[] = { "ZCOD", "zcode", - "GLUL", "glulx", - "TAD2", "tads2", - "TAD3", "tads3", - NULL, NULL }; - -void *my_malloc(int32, char *); -int32 ifiction_get_IFID(char *, char *, int32); - -static int32 read_int(void *inp) -{ - unsigned char *mem=(unsigned char *)inp; - int32 i4 = mem[0], - i3 = mem[1], - i2 = mem[2], - i1 = mem[3]; - return i1 | (i2<<8) | (i3<<16) | (i4<<24); -} - - -static int32 blorb_get_chunk(void *blorb_file, int32 extent, char *id, int32 *begin, int32 *output_extent) -{ - int32 i=12, j; - while(i extent) return NO_REPLY_RV; - *begin=i+8; - return 1; - } - - j=read_int((char *)blorb_file+i+4); - if (j%2) j++; - i+=j+8; - - } - return NO_REPLY_RV; -} -static int32 blorb_get_resource(void *blorb_file, int32 extent, char *rid, int32 number, int32 *begin, int32 *output_extent) -{ - int32 ridx_len; - int32 i,j; - void *ridx; - if (blorb_get_chunk(blorb_file, extent,"RIdx",&i,&ridx_len)==NO_REPLY_RV) - return NO_REPLY_RV; - - ridx=(char *)blorb_file+i+4; - ridx_len=read_int((char *)blorb_file+i); - for(i=0;i