Added FCNS, GLOB, TMPL, and rsmp parsers to the iff library

This commit is contained in:
Fatbag 2012-05-24 01:53:56 -05:00
parent bc51bb4aad
commit 783227a630
15 changed files with 484 additions and 74 deletions

View file

@ -1,42 +0,0 @@
# macros --------------------------------------------------------------------
CC = gcc
LD = gcc
CFLAGS = -m32 -Wall -Wextra -Wabi -Os -march=i686 -fomit-frame-pointer -ffast-math -funsafe-loop-optimizations -fmerge-all-constants -g0 -fno-exceptions
LDFLAGS = -m32 -s -fwhole-program
AR = ar rcs
WINDRES = windres -F pe-i386
LIBRARY_OBJS = obj/libfar.o obj/qfsdecompress.o
RESOURCE_OBJ = obj/resource.o
FAREXTRACT_OBJ = obj/farextract.o
# These will rebuild the entire library upon edit.
DEPS = Makefile \
config.h \
include/libfar.h
# dependencies --------------------------------------------------------------
all: libfar.a libfar-10.dll farextract.exe
$(LIBRARY_OBJS): $(DEPS)
libfar.a: $(LIBRARY_OBJS)
$(AR) $@ $(LIBRARY_OBJS)
libfar-10.dll: $(LIBRARY_OBJS) $(RESOURCE_OBJ)
$(CC) $(LDFLAGS) -shared -o $@ $(LIBRARY_OBJS) $(RESOURCE_OBJ)
farextract.exe: libfar.a $(FAREXTRACT_OBJ)
$(CC) $(LDFLAGS) -o $@ $(FAREXTRACT_OBJ) libfar.a
# make rules ----------------------------------------------------------------
obj/%.o: %.c
$(CC) -c -ansi -pedantic $(CFLAGS) -o $@ $<
obj/%.o: %.rc
$(WINDRES) -i $< -o $@
# maintenance ---------------------------------------------------------------
clean:
del /Q /S obj libfar.a libfar-10.dll farextract.exe

View file

@ -106,29 +106,21 @@ int far_identify(const uint8_t * Buffer, unsigned FileSize)
FARFile * far_create_archive(int Type)
{
FARFile *ptr = malloc(sizeof(FARFile));
FARFile *ptr = calloc(1, sizeof(FARFile));
if(ptr == NULL) return NULL;
memset(ptr, 0, sizeof(FARFile));
ptr->Type = Type;
return ptr;
}
PersistFile * far_create_persist()
{
PersistFile *ptr = malloc(sizeof(PersistFile));
if(ptr == NULL) return NULL;
memset(ptr, 0, sizeof(PersistFile));
return ptr;
return calloc(1, sizeof(PersistFile));
}
FAREntryNode * far_add_entry(FARFile * FARFileInfo, int Position)
{
FAREntryNode *ptr = malloc(sizeof(FAREntryNode)), *node;
FAREntryNode *ptr = calloc(1, sizeof(FAREntryNode)), *node;
if(ptr == NULL) return NULL;
memset(ptr, 0, sizeof(FAREntryNode));
if(FARFileInfo == NULL) return ptr;
if(Position >= 0){