You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(39) |
Dec
(23) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(4) |
Feb
(8) |
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
|
Nov
(2) |
Dec
(21) |
2004 |
Jan
(57) |
Feb
|
Mar
|
Apr
|
May
(49) |
Jun
|
Jul
(8) |
Aug
(5) |
Sep
(2) |
Oct
(2) |
Nov
(2) |
Dec
|
2005 |
Jan
(2) |
Feb
|
Mar
(12) |
Apr
|
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(17) |
2006 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
(3) |
Feb
|
Mar
|
Apr
(18) |
May
(13) |
Jun
(17) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
|
From: <to...@us...> - 2004-01-20 17:08:51
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/Build_GNU In directory sc8-pr-cvs1:/tmp/cvs-serv10228/OSLib/!OsLib/Tools/DefMod2/defmod/Build_GNU Modified Files: Tag: unix-build .cvsignore GNUmakefile Log Message: Unix Build Index: .cvsignore =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/Build_GNU/Attic/.cvsignore,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** .cvsignore 14 Jan 2004 18:10:55 -0000 1.1.2.1 --- .cvsignore 20 Jan 2004 17:08:47 -0000 1.1.2.2 *************** *** 1,2 **** --- 1,3 ---- defmod .directory + defmod.c Index: GNUmakefile =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/Build_GNU/Attic/GNUmakefile,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** GNUmakefile 14 Jan 2004 14:34:29 -0000 1.1.2.2 --- GNUmakefile 20 Jan 2004 17:08:47 -0000 1.1.2.3 *************** *** 9,30 **** TARGET = defmod - MODULES = \ ${TARGET} \ - lookup \ asmhelp \ chelp \ def \ - cheader \ - objasm \ - realloc \ hdr \ ! cstrong \ ! x \ ! unix \ os \ osfile \ ! kernel TRACEMODULES = \ trace \ --- 9,33 ---- TARGET = defmod MODULES = \ ${TARGET} \ asmhelp \ + cheader \ chelp \ + cstrong \ def \ hdr \ ! objasm ! ! # modules from support ! SUPPORTMODULES= \ ! kernel \ ! lookup \ os \ osfile \ ! realloc \ ! unix \ ! x + # modules required if tracing TRACEMODULES = \ trace \ *************** *** 34,47 **** osgbpb - #INCLUDES = -I. -I../sources -I../../.. -I../../../support -I../../../oslib INCLUDES = -I. -I../sources -I../../.. -I../../../support ! DEFINES = -DUNIX -DEXECUTE_ON_UNIX -DASMCMD=${ASMCMD} -DTRACE=${TRACE} -D__swi VPATH = ../sources ../../../support ../../../oslib/unix ! #ifeq (${TRACE},1) ! OBJS = $(patsubst %,%.o,${MODULES}) $(patsubst %,%.o,${TRACEMODULES}) ! #else ! OBJS = $(patsubst %,%.o,${MODULES}) ! #endif #define which assembler DefMod should use --- 37,53 ---- osgbpb INCLUDES = -I. -I../sources -I../../.. -I../../../support ! DEFINES = -DUNIX -DEXECUTE_ON_UNIX -DASMCMD=${ASMCMD} -D__swi VPATH = ../sources ../../../support ../../../oslib/unix ! SUPPORTOBJS = $(patsubst %,%.o,${SUPPORTMODULES}) ! TRACEOBJS = $(patsubst %,%.o,${TRACEMODULES}) ! TARGETOBJS = $(patsubst %,%.o,${MODULES}) ! ! OBJS = ${TARGETOBJS} ${SUPPORTOBJS} ! ! ifneq (${TRACE},0) ! OBJS += ${TRACEOBJS} ! endif #define which assembler DefMod should use *************** *** 63,79 **** #------------------------------------------------------------------------ #targets ! .PHONY: all ! all: ${TARGET} ! ${TARGET}: ${OBJS} ! ${LD} ${LDFLAGS} -o $@ ${OBJS} ! ${CP} $@ ../../../../Bin ! .PHONY: clean ! clean: ;rm -f $(patsubst %,%.o,${MODULES}) $(patsubst %,%.o,${TRACEMODULES}) ${TARGET} ${TARGET}.c ! .PHONY: realclean ! realclean: clean ! find . -type l -exec rm -f {} \; #------------------------------------------------------------------------ --- 69,84 ---- #------------------------------------------------------------------------ #targets ! .PHONY: all clean realclean ! all: ${TARGET} ! ${TARGET}: ${OBJS} defmod.c ! ${LD} ${LDFLAGS} -o $@ ${OBJS} ! ${CP} $@ ../../../../Bin ! support: ! clean: ;rm -f ${TARGETOBJS} ${SUPPORTOBJS} ${TRACEOBJS} ${TARGET} ${TARGET}.c ! realclean: clean ! find . -type l -exec rm -f {} \; #------------------------------------------------------------------------ *************** *** 81,88 **** .SUFFIXES: ! .SUFFIXES: .o .c .y ! .c.o: ;${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -o $@ -c $< ! .y.c: ;${YACC} -y -o $@ $< --- 86,93 ---- .SUFFIXES: ! .SUFFIXES: .o .c .y ! .c.o: ;${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -DTRACE=${TRACE} -o $@ -c $< ! .y.c: ;${YACC} -y -o $@ $< |
From: <to...@us...> - 2004-01-20 17:08:51
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/BindHelp In directory sc8-pr-cvs1:/tmp/cvs-serv10228/OSLib/!OsLib/Tools/BindHelp Modified Files: Tag: unix-build GNUmakefile Log Message: Unix Build Index: GNUmakefile =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/BindHelp/Attic/GNUmakefile,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** GNUmakefile 14 Jan 2004 18:10:54 -0000 1.1.2.1 --- GNUmakefile 20 Jan 2004 17:08:47 -0000 1.1.2.2 *************** *** 2,6 **** # Makefile for BindHelp for UNIX. # - #------------------------------------------------------------------------ #target-specific macros --- 2,5 ---- *************** *** 12,48 **** VPATH = ../support ../oslib/unix ! #------------------------------------------------------------------------ ! # tools ! CC = gcc ! CFLAGS = -Wall ! LD = gcc ! LDFLAGS = ! CP = cp -f ! RM = rm -f ! ! OBJS = $(patsubst %,%.o,${MODULES}) ! ! #------------------------------------------------------------------------ ! #targets ! ! all: ${TARGET} ! ! ${TARGET}: ${OBJS} ! ${LD} ${LDFLAGS} -o $@ ${OBJS} ! ${CP} $@ ../../bin ! ! .PHONY: clean ! ! clean: ! - ${RM} ${OBJS} ${TARGET} ! ! ! #------------------------------------------------------------------------ ! # general rules: ! ! .SUFFIXES: .o .c ! ! .c.o: ! ${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -o $@ -c $< ! ! #------------------------------------------------------------------------ --- 11,14 ---- VPATH = ../support ../oslib/unix ! # all the general rules are in ../GNUmakefile.source ! include ../GNUmakefile.source |
From: <to...@us...> - 2004-01-20 17:08:51
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools In directory sc8-pr-cvs1:/tmp/cvs-serv10228/OSLib/!OsLib/Tools Added Files: Tag: unix-build GNUmakefile.source Log Message: Unix Build --- NEW FILE: GNUmakefile.source --- # # Include Makefile for Tools under UNIX. # # caller must define TARGET, MODULES, INCLUDES # caller may define DEFINES, VPATH #TARGET = reduceaof #OBJS = ${TARGET}.o #INCLUDES = #VPATH = BINDIR ?= ../../Bin #------------------------------------------------------------------------ #tools CC = gcc LD = gcc CP = cp -f RM = rm -f #------------------------------------------------------------------------ #macros DEFINES ?= -DUNIX -DEXECUTE_ON_UNIX -D__swi CFLAGS = -Wall OBJS = $(patsubst %,%.o,${MODULES}) #------------------------------------------------------------------------ #rules .PHONY: all clean install all: ${TARGET} ${TARGET}: ${OBJS} ${LD} ${LDFLAGS} -o $@ ${OBJS} ${CP} $@ ${BINDIR} install: ${TARGET} ${CP} ${TARGET} ${BINDIR} clean: ;-${RM} ${OBJS} ${TARGET} #------------------------------------------------------------------------ .SUFFIXES: .o .c .c.o: ;${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -o $@ -c $< #------------------------------------------------------------------------ |
From: <to...@us...> - 2004-01-20 17:08:51
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Source/Toolbox/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv10228/OSLib/!OsLib/Source/Toolbox/oslib Modified Files: Tag: unix-build .cvsignore Added Files: Tag: unix-build GNUmakefile Modules Log Message: Unix Build --- NEW FILE: GNUmakefile --- # OSLib/Source/Toolbox/oslib/GNUmakefile TV 20040120 # Makefile for Computer/oslib under GNU # SOURCEDIR = ../.. include Modules include ${SOURCEDIR}/GNUmakefile.source #------------------------------------------------------------------------ .PHONY: ${OSLIB32} ${OSLIB} ${OSLIB}: ${LIBS} ${HDRS} ${OBJS} ${OSLIB32}: ${LIBS32} ${HDRS} ${OBJS32} --- NEW FILE: Modules --- # OSLib/Source/Toolbox/oslib/Modules # Modules definition for Toolbox Make # modules containing SWIs SWIMODULES = \ ActionButton \ Button \ ColourDbox \ ColourMenu \ DCS \ DDEUtils \ DisplayField \ DragAnObject \ Draggable \ FileInfo \ FontDbox \ FontMenu \ FrontEnd \ Gadget \ Iconbar \ Menu \ NumberRange \ OptionButton \ PopUp \ PrintDbox \ ProgInfo \ Quit \ RadioButton \ SaveAs \ Scale \ Scrollbar \ ScrollList \ Slider \ StringSet \ TextArea \ TextGadgets \ ToolAction \ Toolbox \ Window \ WindowSupportExternal \ WritableField \ # modules with no SWIs MODULES = \ Adjuster \ FileDbox \ KeyboardShortcut \ Label \ LabelledBox \ ResEd \ # modules defined other than by SWI definition CMODULES = \ Index: .cvsignore =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Source/Toolbox/oslib/.cvsignore,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** .cvsignore 31 Dec 2003 14:42:39 -0000 1.5 --- .cvsignore 20 Jan 2004 17:08:47 -0000 1.5.2.1 *************** *** 1,3 **** - l Hdr help --- 1,2 ---- *************** *** 16,19 **** --- 15,19 ---- *.o *.o,* + *.o32 *.o32,* *.s |
From: <to...@us...> - 2004-01-20 17:08:49
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Source In directory sc8-pr-cvs1:/tmp/cvs-serv10228/OSLib/!OsLib/Source Modified Files: Tag: unix-build .cvsignore Added Files: Tag: unix-build GNUmakefile GNUmakefile.source Log Message: Unix Build --- NEW FILE: GNUmakefile --- # # Makefile for SOURCES under GNU # #------------------------------------------------------------------------ #SOURCEDIR = ${CURDIR} #include GNUmakefile.source #------------------------------------------------------------------------ # paths & directories BINDIR = ${SOURCEDIR}/../Bin CROSSPATH = /home/riscos/cross #------------------------------------------------------------------------ # tools LIBFILE = ${CROSSPATH}/bin/libfile #------------------------------------------------------------------------ #target-specific macros SOURCES = Computer Core Toolbox User OSLIB = OSLib.o OSLIB32 = OSLib32.o HELP = OSLib,3d6 LIST = OSLib.list LIST32 = OSLib32.list #------------------------------------------------------------------------ #targets .PHONY: all help Computer Core Toolbox User Test oslib libs clean all: oslib Test help help: ${HELP} Computer: ;${MAKE} -C $@/oslib all Core: ;${MAKE} -C $@/oslib all Toolbox: ;${MAKE} -C $@/oslib all User: ;${MAKE} -C $@/oslib all Test: ;${MAKE} -C $@ all oslib: ;$(foreach dir, ${SOURCES}, ${MAKE} -C ${dir}/oslib all; ) ${MAKE} list ${MAKE} list32 list: ${OSLIB} ${LIBFILE} -s ${OSLIB} > ${LIST} list32: ${OSLIB32} ${LIBFILE} -s ${OSLIB} > ${LIST32} libs: ;$(foreach dir, ${SOURCES}, ${MAKE} -C ${dir}/oslib libs; ) ${HELP}: $(foreach dir, ${SOURCES}, ${MAKE} -C ${dir}/oslib help; ) ${INDEXHELP} HelpData.action_ -p Action ${INDEXHELP} HelpData.class_ -p Class ${INDEXHELP} HelpData.error_ -p Error ${INDEXHELP} HelpData.message_ -p Message ${INDEXHELP} HelpData.service_ -p Service ${BINDHELP} HelpData $@ clean: ;$(foreach dir, ${SOURCES}, ${MAKE} -C ${dir}/oslib clean; ) -${RM} oslib.o oslib32.o ${LIST} ${LIST32} ${HELP} --- NEW FILE: GNUmakefile.source --- # # Makefile for to include in oslib source GNUmakefiles # # SORURCEDIR must be defined by the caller, and must # point to the top of the source tree. #define MALLOC_CHECK to enable malloc debugging hooks while running defmod #MALLOC_CHECK = MALLOC_CHECK_=1 #------------------------------------------------------------------------ # paths & directories BINDIR = ${SOURCEDIR}/../Bin CROSSPATH = /home/riscos/cross ASPATH = ${CROSSPATH}/bin/arm-riscos-aof/3_3 #------------------------------------------------------------------------ # Source Directories SOURCES = Computer Core Toolbox User INCLUDES = Macros Types ${SOURCES} #------------------------------------------------------------------------ # tools DEFMOD = ${BINDIR}/defmod -q REDUCEAOF = ${BINDIR}/reduceaof INDEXHELP = ${BINDIR}/IndexHelp BINDHELP = ${BINDIR}/BindHelp CP = cp -f RM = rm -f DIFF = diff AS = ${ASPATH}/as -objasm CC = ${CROSSPATH}/bin/gcc LINK = ${CROSSPATH}/bin/gcc LIBFILE = ${CROSSPATH}/bin/libfile #------------------------------------------------------------------------ # macros ALL = ${SWIMODULES} ${MODULES} ${CMODULES} HDRS = $(patsubst %, %.Hdr,${SWIMODULES} ${MODULES}) OBJASM = $(patsubst %, %.s,${SWIMODULES}) OBJASM32 = $(patsubst %, %.s32,${SWIMODULES}) LIBS = $(patsubst %, %.o,${SWIMODULES}) LIBS32 = $(patsubst %, %.o32,${SWIMODULES}) CHEADERS = $(patsubst %, %.h,${SWIMODULES} ${MODULES}) CSTRONG = $(patsubst %, %.help,${SWIMODULES} ${MODULES}) OBJS = $(patsubst %, %.o,${CMODULES}) OBJS32 = $(patsubst %, %.o32,${CMODULES}) FILES = ${LIBS} ${LIBS32} ${OBJASM} ${OBJASM32} ${HDRS} ${CHEADERS} #------------------------------------------------------------------------ # file locations BYTEWIDE = ${SOURCEDIR}/ByteWide HELPDATA = ${SOURCEDIR}/HelpData OSLIB = ${SOURCEDIR}/OSLib.o OSLIB32 = ${SOURCEDIR}/OSLib32.o UNIXLIB = ${CROSSPATH}/bin/arm-riscos-aof/3_3_0/apcs32/arch3/unixlib/unixlib.o #------------------------------------------------------------------------ #helper functions # convert arg to lower case tolower = $(shell echo $(1) | tr '[A-Z]' '[a-z]';) #------------------------------------------------------------------------ # Targets .PHONY: all cstrong hdrs cheaders objasm objasm32 clean regression regression32 all: libs libs32 objasm objasm32 hdrs cheaders objs objs32 libs: ${OSLIB} libs32: ${OSLIB32} cstrong: ${CSTRONG} hdrs: ${HDRS} cheaders: ${CHEADERS} objasm: ${OBJASM} objasm32: ${OBJASM32} objs: ${HDRS} ${OBJS} objs32: ${HDRS} ${OBJS32} clean: @- ${RM} -r l/* @- ${RM} ${FILES} ${CSTRONG} ViaFile @- ${RM} $(call tolower, ${CHEADERS}) regression: -@$(foreach TARGET, ${OBJASM}, \ echo ---- Diffing ${TARGET} against $(basename, $(call tolower, ${TARGET} ) ) ; \ ${DIFF} -y --suppress-common-lines ${TARGET} 's; \ 0/$(basename, $(call tolower, ${TARGET} ) )'; ) regression32: -@$(foreach TARGET, ${OBJASM32}, \ echo ---- Diffing ${TARGET} against $(basename, $(call tolower, ${TARGET} ) ) ; \ ${DIFF} -y --suppress-common-lines ${TARGET} 's32; \ 0/$(basename, $(call tolower, ${TARGET} ) )'; ) #------------------------------------------------------------------------ # general rules: .SUFFIXES: .SUFFIXES: .o .o32 .h .h++ .swi .ch .Hdr .ah .help .s .s32 .asm .swi.s: ;${DEFMOD} -s -byte_wide ${BYTEWIDE} < $< > $@ .swi.s32: ;${DEFMOD} -s -byte_wide ${BYTEWIDE} -32bit < $< > $@ .swi.h++: ;${DEFMOD} -h++ < $< > $@ .swi.Hdr: ;${DEFMOD} -hdr < $< > $@ .swi.ch: ;${DEFMOD} -chelp < $< > $@ .swi.ah: ;${DEFMOD} -asmhelp < $< > $@ .swi.h: ;${DEFMOD} -h < $< > $(call tolower, $@) @touch $@ .swi.o: ;@echo making $@ @if [ ! -d l ]; then mkdir l; fi; @env PATH=${ASPATH}:${PATH} ${MALLOC_CHECK} \ ${DEFMOD} -l -o l/$* -byte_wide ${BYTEWIDE} < $< ${REDUCEAOF} -via ViaFile ${LIBFILE} -c $@ -v ViaFile @-if [ -a ${OSLIB} ]; then ${LIBFILE} -d ${OSLIB} -v ViaFile; fi; ${LIBFILE} -i ${OSLIB} -v ViaFile ${RM} ViaFile ${RM} -r l/$* .swi.o32: ;@echo making $@ @if [ ! -d l ]; then mkdir l; fi; @env PATH=${ASPATH}:$PATH ${MALLOC_CHECK} \ ${DEFMOD} -l -o l/$* -byte_wide ${BYTEWIDE} -32bit < $< ${REDUCEAOF} -via ViaFile ${LIBFILE} -c $@ -v ViaFile @-if [ -a ${OSLIB32} ]; then ${LIBFILE} -d ${OSLIB32} -v ViaFile; fi; ${LIBFILE} -i ${OSLIB32} -v ViaFile ${RM} ViaFile ${RM} -r l/$* .swi.help: @if [ ! -d ${HELPDATA} ]; then mkdir ${HELPDATA}; fi; ${DEFMOD} -cstrong -o ${HELPDATA} < $< @touch $@ .asm.o: ;${AS} -I.. -I${SOURCEDIR}/Types -o $@ $< .asm.o32: ;${AS} -target SA110 -apcs32 -I.. -I${SOURCEDIR}/Types -o $@ $< #------------------------------------------------------------------------ Index: .cvsignore =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Source/.cvsignore,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -C2 -d -r1.5 -r1.5.4.1 *** .cvsignore 27 Nov 2002 22:10:58 -0000 1.5 --- .cvsignore 20 Jan 2004 17:08:46 -0000 1.5.4.1 *************** *** 4,5 **** --- 4,6 ---- *.o,* o + *.list |
From: <to...@us...> - 2004-01-14 18:12:43
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools In directory sc8-pr-cvs1:/tmp/cvs-serv31769/!OsLib/Tools Added Files: Tag: unix-build GNUmakefile Log Message: Unix Build --- NEW FILE: GNUmakefile --- # # Makefile for OSLib Tools for UNIX. # MAKE = make RM = rm -f #------------------------------------------------------------------------ #targets ALL = BindHelp DefMod2 IndexHelp ReduceAOF .PHONY: ${ALL} clean all: ${ALL} BindHelp: ${MAKE} -C BindHelp DefMod2: ${MAKE} -C DefMod2 IndexHelp: ${MAKE} -C IndexHelp ReduceAOF: ${MAKE} -C ReduceAOF clean: ;$(foreach TARGET, ${ALL}, ${MAKE} -C ${TARGET} clean; ) #------------------------------------------------------------------------ |
From: <to...@us...> - 2004-01-14 18:10:59
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/ReduceAOF In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib/Tools/ReduceAOF Modified Files: Tag: unix-build .cvsignore reduceaof.c Added Files: Tag: unix-build GNUmakefile Log Message: Unix Build --- NEW FILE: GNUmakefile --- # # Makefile for ReduceAOF for UNIX. # TARGET = reduceaof OBJS = ${TARGET}.o INCLUDES = VPATH = #------------------------------------------------------------------------ #tools CC = gcc CFLAGS = -DUNIX -DEXECUTE_ON_UNIX LD = gcc LDFLAGS = CP = cp -f RM = rm -f #------------------------------------------------------------------------ all: ${TARGET} ${TARGET}: ${OBJS} ${LD} ${LDFLAGS} -o $@ ${OBJS} ${CP} $@ ../../bin .PHONY: clean clean: - ${RM} ${OBJS} ${TARGET} #------------------------------------------------------------------------ .SUFFIXES: .o .c .c.o: ${CC} ${CFLAGS} -o $@ -c $< #------------------------------------------------------------------------ Index: .cvsignore =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/ReduceAOF/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** .cvsignore 27 Nov 2002 22:11:01 -0000 1.2 --- .cvsignore 14 Jan 2004 18:10:55 -0000 1.2.4.1 *************** *** 1 **** --- 1,3 ---- o + reduceaof + Index: reduceaof.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/ReduceAOF/reduceaof.c,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** reduceaof.c 7 Mar 2002 16:04:28 -0000 1.1 --- reduceaof.c 14 Jan 2004 18:10:55 -0000 1.1.4.1 *************** *** 7,9 **** #include <stdio.h> #include <string.h> ! typedef struct { unsigned int ChunkFileId; unsigned int maxChunks; unsigned int numChunks; } ChunkFileHdr; typedef struct { unsigned char chunkId[8]; unsigned int fileOffset; unsigned int size; } ChunkEntryHdr; typedef struct { ChunkFileHdr CFH; ChunkEntryHdr *CEH; char **DAT; } ChunkInfoStr; static int bite(ChunkInfoStr *I, FILE *fp) { size_t m = fread(I->CEH, sizeof(*I->CEH), I->CFH.maxChunks, fp); if (m == I->CFH.maxChunks) { int n; for (n=0; n < I->CFH.maxChunks; ++n) { char name[9]; strncpy(name, (const char *) I->CEH[n].chunkId, 8); name[8]='\0'; I->DAT[n] = NULL; if ( I->CEH[n].fileOffset != 0 ) { I->DAT[n] = malloc(I->CEH[n].size); if (I->DAT[n] == NULL) { fprintf(stderr, "malloc() failed\n"); abort(); } fseek(fp, I->CEH[n].fileOffset, SEEK_SET); if (fread((I->DAT[n]), 1, I->CEH[n].size, fp) != I->CEH[n].size) { free(I->DAT[n]); I->DAT[n] = NULL; m--; } } } } return m == I->CFH.maxChunks; } static void strip(ChunkInfoStr *I) { unsigned int n; for (n=0; n < I->CFH.maxChunks; ++n) { char name[9]; strncpy(name, (const char *) I->CEH[n].chunkId, 8); name[8]='\0'; if ( I->DAT[n] != NULL && !strcmp(name, "OBJ_IDFN") ) { free(I->DAT[n]); I->DAT[n] = NULL; } } } static unsigned int brush(ChunkInfoStr *I) { unsigned int n, to = 0; for (n=0; n < I->CFH.maxChunks; ++n) { if (I->DAT[n] != NULL && to != n) { memcpy(&I->CEH[to], &I->CEH[n], sizeof(*I->CEH)); I->DAT[to] = I->DAT[n]; I->DAT[n] = NULL; } if (I->DAT[to] != NULL) to++; else { memcpy( I->CEH[n].chunkId, "SpareNow", 8); I->CEH[n].fileOffset = 0; I->CEH[n].size = 0; } } return to; } static void reorganise(ChunkInfoStr *I, unsigned int got) { unsigned int n, place; I->CFH.maxChunks = I->CFH.numChunks = got; place = sizeof(I->CFH) + sizeof(*I->CEH) * I->CFH.maxChunks; for (n=0; n < I->CFH.numChunks; ++n) { I->CEH[n].fileOffset = place; place += I->CEH[n].size + 3 & ~3; } } static int get_CFH(ChunkInfoStr *I, FILE *fp) { if (fread(&I->CFH, sizeof(I->CFH), 1, fp) != 1) return 0; return I->CFH.ChunkFileId == 0xC3CBC6C5; } static void operate(const char *fname) { FILE *fp; if ((fp = fopen(fname, "rb")) != NULL) { ChunkInfoStr CIS; if (get_CFH(&CIS, fp) != 0 && CIS.CFH.numChunks > 0) { CIS.CEH = malloc(sizeof(*CIS.CEH) * CIS.CFH.maxChunks); CIS.DAT = malloc(sizeof(char*) * CIS.CFH.maxChunks); if (!CIS.CEH || !CIS.DAT) { fprintf(stderr, "malloc() failed\n"); abort(); } if (bite(&CIS, fp) != 0) { int n; fclose(fp); fp = NULL; strip(&CIS); reorganise(&CIS, brush(&CIS)); fp = fopen(fname, "wb"); if (fp) { fwrite(&CIS.CFH, sizeof(CIS.CFH), 1, fp); fwrite(CIS.CEH, sizeof(*CIS.CEH), CIS.CFH.maxChunks, fp); for (n=0; n < CIS.CFH.maxChunks; ++n) { fseek(fp, CIS.CEH[n].fileOffset, SEEK_SET); fwrite((CIS.DAT[n]), sizeof(char), CIS.CEH[n].size, fp); } } else { fprintf(stderr, "Could not write %s\n", fname); exit(EXIT_FAILURE); } for (n=0; n < CIS.CFH.maxChunks; ++n) { free(CIS.DAT[n]); } } else { fprintf(stderr, "Error reading %s\n", fname); exit(EXIT_FAILURE); } free(CIS.CEH); } if (fp) { if (fclose(fp) != 0) { fprintf(stderr, "Error closing %s\n", fname); exit(EXIT_FAILURE); } } else { fprintf(stderr, "Wrong format %s\n", fname); exit(EXIT_FAILURE); } } else { fprintf(stderr, "Could not read %s\n", fname); exit(EXIT_FAILURE); } } static void plenty(const char *n) { FILE *fp; if ((fp = fopen(n, "r")) != NULL) { char s[256]; while (!feof(fp)) { if (fgets(s, sizeof(s), fp) != NULL) { char *t = strchr(s, '\n'); if (t != NULL) *t = '\0'; operate(s); } } fclose(fp); } else { fprintf(stderr, "Error reading %s\n", n); exit(EXIT_FAILURE); } } int main(int argc, char *argv[]) { int n, go = argc > 1; for (n = 1; n < argc; ++n) { if (!strcmp(argv[n], "-?") || !strcmp(argv[n], "-h") || !strcmp(argv[n], "-help")) go = 0; if (!strcmp(argv[n], "-via")) { if (argv[++n] == NULL) go = 0; } } if (go) for (n = 1; n < argc; ++n) { if (!strcmp(argv[n], "-via")) { plenty(argv[++n]); continue; } operate(argv[n]); } else { fprintf(stderr, "ReduceAOF " __DATE__ ". " "Copyright © Richard Sargeant, 1999.\n" "ReduceAOF comes with ABSOLUTELY NO WARRANTY.\n"); } return n == argc ? EXIT_SUCCESS : EXIT_FAILURE; } /* Just written for OSLib :-) mailto:os...@ar... */ --- 7,278 ---- #include <stdio.h> #include <string.h> ! ! typedef struct ! { ! unsigned int ChunkFileId; ! unsigned int maxChunks; ! unsigned int numChunks; ! } ChunkFileHdr; ! ! typedef struct ! { ! unsigned char chunkId[8]; ! unsigned int fileOffset; ! unsigned int size; ! } ChunkEntryHdr; ! ! typedef struct ! { ! ChunkFileHdr CFH; ! ChunkEntryHdr *CEH; ! char **DAT; ! } ChunkInfoStr; ! ! static int verbose; ! ! static int bite(ChunkInfoStr *I, FILE *fp) ! { ! size_t m = fread(I->CEH, sizeof(*I->CEH), I->CFH.maxChunks, fp); ! ! if (m == I->CFH.maxChunks) ! { ! int n; ! for (n=0; n < I->CFH.maxChunks; ++n) ! { ! char name[9]; ! strncpy(name, (const char *) I->CEH[n].chunkId, 8); ! name[8]='\0'; ! I->DAT[n] = NULL; ! ! if ( I->CEH[n].fileOffset != 0 ) ! { ! I->DAT[n] = malloc(I->CEH[n].size); ! if (I->DAT[n] == NULL) ! { ! fprintf(stderr, "malloc() failed\n"); ! abort(); ! } ! ! fseek(fp, I->CEH[n].fileOffset, SEEK_SET); ! if (fread((I->DAT[n]), 1, I->CEH[n].size, fp) != I->CEH[n].size) ! { ! free(I->DAT[n]); I->DAT[n] = NULL; m--; ! } ! } ! } ! } ! ! return m == I->CFH.maxChunks; ! } ! ! static void strip(ChunkInfoStr *I) ! { ! unsigned int n; ! for (n=0; n < I->CFH.maxChunks; ++n) ! { ! char name[9]; ! strncpy(name, (const char *) I->CEH[n].chunkId, 8); ! name[8]='\0'; ! ! if ( I->DAT[n] != NULL && !strcmp(name, "OBJ_IDFN") ) ! { ! free(I->DAT[n]); I->DAT[n] = NULL; ! } ! } ! } ! ! static unsigned int brush(ChunkInfoStr *I) ! { ! unsigned int n, to = 0; ! ! for (n=0; n < I->CFH.maxChunks; ++n) ! { ! if (I->DAT[n] != NULL && to != n) ! { ! memcpy(&I->CEH[to], &I->CEH[n], ! sizeof(*I->CEH)); I->DAT[to] = I->DAT[n]; ! I->DAT[n] = NULL; ! } ! ! if (I->DAT[to] != NULL) ! to++; ! else ! { ! memcpy( I->CEH[n].chunkId, "SpareNow", 8); ! I->CEH[n].fileOffset = 0; ! I->CEH[n].size = 0; ! } ! } return to; ! } ! ! static void reorganise(ChunkInfoStr *I, unsigned int got) ! { ! unsigned int n, place; ! I->CFH.maxChunks = I->CFH.numChunks = got; ! place = sizeof(I->CFH) + sizeof(*I->CEH) * I->CFH.maxChunks; ! ! for (n=0; n < I->CFH.numChunks; ++n) ! { ! I->CEH[n].fileOffset = place; ! place += I->CEH[n].size + 3 & ~3; ! } ! } ! ! static int get_CFH(ChunkInfoStr *I, FILE *fp) ! { ! if (fread(&I->CFH, sizeof(I->CFH), 1, fp) != 1) ! return 0; ! ! return I->CFH.ChunkFileId == 0xC3CBC6C5; ! } ! ! static void operate(const char *fname) ! { ! FILE *fp; ! ! if (verbose) ! fprintf(stderr, "ReduceAOF %s \n", fname ); ! ! if ((fp = fopen(fname, "rb")) != NULL) ! { ! ChunkInfoStr CIS; ! ! if (get_CFH(&CIS, fp) != 0 && CIS.CFH.numChunks > 0) ! { ! CIS.CEH = malloc(sizeof(*CIS.CEH) * CIS.CFH.maxChunks); ! CIS.DAT = malloc(sizeof(char*) * CIS.CFH.maxChunks); ! ! if (!CIS.CEH || !CIS.DAT) ! { ! fprintf(stderr, "malloc() failed\n"); abort(); ! } ! ! if (bite(&CIS, fp) != 0) ! { ! int n; ! fclose(fp); ! fp = NULL; ! strip(&CIS); ! reorganise(&CIS, brush(&CIS)); ! ! fp = fopen(fname, "wb"); ! if (fp) ! { ! fwrite(&CIS.CFH, sizeof(CIS.CFH), 1, fp); ! fwrite(CIS.CEH, sizeof(*CIS.CEH), CIS.CFH.maxChunks, fp); ! ! for (n=0; n < CIS.CFH.maxChunks; ++n) ! { ! fseek(fp, CIS.CEH[n].fileOffset, SEEK_SET); ! fwrite((CIS.DAT[n]), sizeof(char), CIS.CEH[n].size, fp); ! } ! } ! else ! { ! fprintf(stderr, "Could not write %s\n", fname); ! exit(EXIT_FAILURE); ! } ! ! for (n=0; n < CIS.CFH.maxChunks; ++n) ! { ! free(CIS.DAT[n]); ! } ! } ! else ! { ! fprintf(stderr, "Error reading %s\n", fname); ! exit(EXIT_FAILURE); ! } ! ! free(CIS.CEH); ! } ! ! if (fp) ! { ! if (fclose(fp) != 0) ! { ! fprintf(stderr, "Error closing %s\n", fname); ! exit(EXIT_FAILURE); ! } ! } ! else ! { ! fprintf(stderr, "Wrong format %s\n", fname); ! exit(EXIT_FAILURE); ! } ! } ! else ! { ! fprintf(stderr, "Could not read %s\n", fname); ! exit(EXIT_FAILURE); ! } ! } ! ! static void plenty(const char *n) ! { ! FILE *fp; ! ! if ((fp = fopen(n, "r")) != NULL) ! { ! char s[256]; ! while (!feof(fp)) ! { ! if (fgets(s, sizeof(s), fp) != NULL) ! { ! char *t = strchr(s, '\n'); ! if (t != NULL) *t = '\0'; operate(s); ! } ! } ! fclose(fp); ! } ! else ! { ! fprintf(stderr, "Error reading %s\n", n); ! exit(EXIT_FAILURE); ! } ! } ! ! int main(int argc, char *argv[]) ! { ! int n, go = argc > 1; ! ! for (n = 1; n < argc; ++n) ! { ! if (!strcmp(argv[n], "-?") || !strcmp(argv[n], "-h") || !strcmp(argv[n], "-help")) ! go = 0; ! ! if (!strcmp(argv[n], "-via")) ! { ! if (argv[++n] == NULL) go = 0; ! } ! ! if ( !strcmp( argv[n], "-v" ) ) ! verbose = 1; ! } ! ! if (go) ! { ! for (n = 1; n < argc; ++n) ! { ! if (!strcmp(argv[n], "-via")) ! { ! plenty(argv[++n]); ! continue; ! } ! if ( *argv[n] != '-' ) ! operate(argv[n]); ! } ! } ! else ! { ! fprintf(stderr, "ReduceAOF " ! __DATE__ ! ". " ! "Copyright © Richard Sargeant, 1999.\n" ! "ReduceAOF comes with ABSOLUTELY NO WARRANTY.\n" ! ); ! } ! ! return n == argc ? EXIT_SUCCESS : EXIT_FAILURE; ! } /* Just written for OSLib :-) mailto:os...@ar... */ ! |
From: <to...@us...> - 2004-01-14 18:10:59
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib/Tools/support Added Files: Tag: unix-build kernel.h swis.h Log Message: Unix Build --- NEW FILE: kernel.h --- /* Simple stub kernel.h header file required by defmod builds */ #ifndef kernel_H #define kernel_H //#define __swi(n) typedef struct { int errnum; char errmess[252]; } _kernel_oserror; extern _kernel_oserror const *last_error; extern const _kernel_oserror *_kernel_last_oserror(void); extern const _kernel_oserror *_kernel_set_perror(void); # endif --- NEW FILE: swis.h --- /* Empty file required for UNIX builds */ |
From: <to...@us...> - 2004-01-14 18:10:59
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib/Tools/oslib Modified Files: Tag: unix-build osfile.h Log Message: Unix Build Index: osfile.h =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/oslib/Attic/osfile.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** osfile.h 14 Jan 2004 13:33:16 -0000 1.1.2.1 --- osfile.h 14 Jan 2004 18:10:55 -0000 1.1.2.2 *************** *** 98,104 **** --- 98,317 ---- #ifdef EXECUTE_ON_UNIX + /* ------------------------------------------------------------------------ + * Function: osfile_set_type() + * + * Description: Writes the file type for an object + * + * Input: file_name - value of R1 on entry + * file_type - value of R2 on entry + * + * Other notes: Calls SWI 0x8 with R0 = 0x12. + */ + + extern os_error *xosfile_set_type (char const *file_name, + bits file_type); + + extern void osfile_set_type (char const *file_name, + bits file_type); + + /* ------------------------------------------------------------------------ + * Function: osfile_create_dir() + * + * Description: Creates a directory + * + * Input: dir_name - value of R1 on entry + * entry_count - value of R4 on entry + * + * Other notes: Calls SWI 0x8 with R0 = 0x8. + */ + extern os_error *xosfile_create_dir(char const *, int); extern void osfile_create_dir(char const *, int); + /* ------------------------------------------------------------------------ + * Function: osfile_create() + * + * Description: Creates an empty untyped file - prefer + * OSFile_CreateStamped + * + * Input: file_name - value of R1 on entry + * load_addr - value of R2 on entry + * exec_addr - value of R3 on entry + * size - value of R5 on entry + * + * Other notes: Calls SWI 0x8 with R0 = 0x7, R4 = 0x0. + */ + + extern os_error *xosfile_create (char const *file_name, + bits load_addr, + bits exec_addr, + int size); + + extern void osfile_create (char const *file_name, + bits load_addr, + bits exec_addr, + int size); + + /* ------------------------------------------------------------------------ + * Function: osfile_read_stamped() + * + * Description: Reads catalogue information and file type for an object + * using the directory list in File$Path + * + * Input: file_name - value of R1 on entry + * + * Output: obj_type - value of R0 on exit (X version only) + * load_addr - value of R2 on exit + * exec_addr - value of R3 on exit + * size - value of R4 on exit + * attr - value of R5 on exit + * file_type - value of R6 on exit + * + * Returns: R0 (non-X version only) + * + * Other notes: Calls SWI 0x8 with R0 = 0x14. + */ + + os_error *xosfile_read_stamped (char const *file_name, + fileswitch_object_type *obj_type, + bits *load_addr, + bits *exec_addr, + int *size, + fileswitch_attr *attr, + bits *file_type); + + fileswitch_object_type osfile_read_stamped (char const *file_name, + bits *load_addr, + bits *exec_addr, + int *size, + fileswitch_attr *attr, + bits *file_type); + + /* ------------------------------------------------------------------------ + * Function: osfile_load_stamped() + * + * Description: Loads a file using the directory list in File$Path + * + * Input: file_name - value of R1 on entry + * addr - value of R2 on entry + * + * Output: obj_type - value of R0 on exit (X version only) + * load_addr - value of R2 on exit + * exec_addr - value of R3 on exit + * size - value of R4 on exit + * attr - value of R5 on exit + * + * Returns: R0 (non-X version only) + * + * Other notes: Calls SWI 0x8 with R0 = 0xFF, R3 = 0x0. + */ + + os_error *xosfile_load_stamped (char const *file_name, + byte *addr, + fileswitch_object_type *obj_type, + bits *load_addr, + bits *exec_addr, + int *size_, + fileswitch_attr *attr); + + fileswitch_object_type osfile_load_stamped (char const *file_name, + byte *addr, + bits *load_addr, + bits *exec_addr, + int *size, + fileswitch_attr *attr); + + /* ------------------------------------------------------------------------ + * Function: osfile_load_stamped_no_path() + * + * Description: Calls OS_File 16 to load a file + * + * Input: file_name - value of R1 on entry + * addr - value of R2 on entry + * + * Output: obj_type - value of R0 on exit (X version only) + * load_addr - value of R2 on exit + * exec_addr - value of R3 on exit + * size - value of R4 on exit + * attr - value of R5 on exit + * + * Returns: R0 (non-X version only) + * + * Other notes: Calls SWI 0x8 with R0 = 0x10, R3 = 0x0. + */ + + extern os_error *xosfile_load_stamped_no_path (char const *file_name, + byte *addr, + fileswitch_object_type *obj_type, + bits *load_addr, + bits *exec_addr, + int *size, + fileswitch_attr *attr); + + extern fileswitch_object_type osfile_load_stamped_no_path (char const *file_name, + byte *addr, + bits *load_addr, + bits *exec_addr, + int *size, + fileswitch_attr *attr); + + /* ------------------------------------------------------------------------ + * Function: osfile_delete() + * + * Description: Calls OS_File 6 to delete an object + * + * Input: file_name - value of R1 on entry + * + * Output: obj_type - value of R0 on exit (X version only) + * load_addr - value of R2 on exit + * exec_addr - value of R3 on exit + * size - value of R4 on exit + * attr - value of R5 on exit + * + * Returns: R0 (non-X version only) + * + * Other notes: Calls SWI 0x8 with R0 = 0x6. + */ + + extern os_error *xosfile_delete (char const *file_name, + fileswitch_object_type *obj_type_, + bits *load_addr_, + bits *exec_addr_, + int *size_, + fileswitch_attr *attr_); + + extern fileswitch_object_type osfile_delete (char const *file_name, + bits *load_addr, + bits *exec_addr, + int *size, + fileswitch_attr *attr); + + /* ------------------------------------------------------------------------ + * Function: osfile_save() + * + * Description: Saves a block of memory as an untyped file - prefer + * OSFile_SaveStamped + * + * Input: file_name - value of R1 on entry + * load_addr - value of R2 on entry + * exec_addr - value of R3 on entry + * data - value of R4 on entry + * end - value of R5 on entry + * + * Other notes: Calls SWI 0x8 with R0 = 0x0. + */ + + extern os_error *xosfile_save (char const *file_name, + bits load_addr, + bits exec_addr, + byte const *data, + byte const *end); + + extern void osfile_save (char const *file_name, + bits load_addr, + bits exec_addr, + byte const *data, + byte const *end); + #if 0 /* in os.h */ extern void os_generate_error(_kernel_oserror *); |
From: <to...@us...> - 2004-01-14 18:10:59
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/docs In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib/docs Modified Files: Tag: unix-build Unix_Build Log Message: Unix Build Index: Unix_Build =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/docs/Attic/Unix_Build,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -C2 -d -r1.1.4.2 -r1.1.4.3 *** Unix_Build 14 Jan 2004 13:33:17 -0000 1.1.4.2 --- Unix_Build 14 Jan 2004 18:10:55 -0000 1.1.4.3 *************** *** 94,100 **** Needed a bit more work. This was mainly in the Tools/support and Tools/oslib hierarchy. ! In oslib/unix/ ! added kernel.h from Stewart's DefMod. ! added swis.h from Stewart's DefMod. 1.7 IndexHelp --- 94,100 ---- Needed a bit more work. This was mainly in the Tools/support and Tools/oslib hierarchy. ! In Tools/support ! added kernel.h from Stewart's DefMod. ! added swis.h from Stewart's DefMod. 1.7 IndexHelp |
From: <to...@us...> - 2004-01-14 18:10:58
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/IndexHelp In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib/Tools/IndexHelp Modified Files: Tag: unix-build .cvsignore IndexHelp.c Added Files: Tag: unix-build GNUmakefile Log Message: Unix Build --- NEW FILE: GNUmakefile --- # # Makefile for IndexHelp for UNIX. # #------------------------------------------------------------------------ #target-specific macros TARGET = IndexHelp MODULES = ${TARGET} os osgbpb osfile x kernel unix INCLUDES = -I.. -I../support DEFINES = -DUNIX -DEXECUTE_ON_UNIX -D__swi VPATH = ../support ../oslib/unix #------------------------------------------------------------------------ # tools CC = gcc CFLAGS = -Wall LD = gcc LDFLAGS = CP = cp -f RM = rm -f OBJS = $(patsubst %,%.o,${MODULES}) #------------------------------------------------------------------------ #targets all: ${TARGET} ${TARGET}: ${OBJS} ${LD} ${LDFLAGS} -o $@ ${OBJS} ${CP} $@ ../../bin .PHONY: clean clean: - ${RM} ${OBJS} ${TARGET} #------------------------------------------------------------------------ # general rules: .SUFFIXES: .o .c .c.o: ${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -o $@ -c $< #------------------------------------------------------------------------ Index: .cvsignore =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/IndexHelp/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** .cvsignore 27 Nov 2002 22:11:01 -0000 1.2 --- .cvsignore 14 Jan 2004 18:10:55 -0000 1.2.4.1 *************** *** 1 **** --- 1,3 ---- o + IndexHelp + Index: IndexHelp.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/IndexHelp/IndexHelp.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** IndexHelp.c 29 Dec 2003 11:40:21 -0000 1.5 --- IndexHelp.c 14 Jan 2004 18:10:55 -0000 1.5.2.1 *************** *** 55,59 **** /* From OSLibSupport */ ! #include "X.h" #include "trace.h" --- 55,59 ---- /* From OSLibSupport */ ! #include "x.h" #include "trace.h" |
From: <to...@us...> - 2004-01-14 18:10:58
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2 In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib/Tools/DefMod2 Added Files: Tag: unix-build GNUmakefile Log Message: Unix Build --- NEW FILE: GNUmakefile --- # # Makefile for defmod for UNIX. # #------------------------------------------------------------------------ #------------------------------------------------------------------------ # tools CC = gcc CFLAGS = -Wall -funsigned-char LD = gcc LDFLAGS = YACC = bison YFLAGS = CP = cp -f #------------------------------------------------------------------------ #targets .PHONY: all clean all: ;${MAKE} -C defmod/Build_GNU all clean: ;${MAKE} -C defmod/Build_GNU clean |
From: <to...@us...> - 2004-01-14 18:10:58
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/BindHelp In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib/Tools/BindHelp Modified Files: Tag: unix-build .cvsignore BindHelp.c Added Files: Tag: unix-build GNUmakefile Log Message: Unix Build --- NEW FILE: GNUmakefile --- # # Makefile for BindHelp for UNIX. # #------------------------------------------------------------------------ #target-specific macros TARGET = BindHelp MODULES = ${TARGET} os osgbpb osfile osargs osfind x kernel unix INCLUDES = -I.. -I../support DEFINES = -DUNIX -DEXECUTE_ON_UNIX -D__swi VPATH = ../support ../oslib/unix #------------------------------------------------------------------------ # tools CC = gcc CFLAGS = -Wall LD = gcc LDFLAGS = CP = cp -f RM = rm -f OBJS = $(patsubst %,%.o,${MODULES}) #------------------------------------------------------------------------ #targets all: ${TARGET} ${TARGET}: ${OBJS} ${LD} ${LDFLAGS} -o $@ ${OBJS} ${CP} $@ ../../bin .PHONY: clean clean: - ${RM} ${OBJS} ${TARGET} #------------------------------------------------------------------------ # general rules: .SUFFIXES: .o .c .c.o: ${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -o $@ -c $< #------------------------------------------------------------------------ Index: .cvsignore =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/BindHelp/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** .cvsignore 27 Nov 2002 22:11:00 -0000 1.2 --- .cvsignore 14 Jan 2004 18:10:54 -0000 1.2.4.1 *************** *** 1 **** --- 1,2 ---- o + BindHelp Index: BindHelp.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/BindHelp/BindHelp.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** BindHelp.c 29 Dec 2003 11:40:20 -0000 1.6 --- BindHelp.c 14 Jan 2004 18:10:54 -0000 1.6.2.1 *************** *** 96,100 **** /* From OSLibSupport */ ! #include "X.h" #include "trace.h" --- 96,100 ---- /* From OSLibSupport */ ! #include "x.h" #include "trace.h" *************** *** 429,433 **** header.length = entry -> size + sizeof( data_header ); ! //tracef( "write_dir_entry: offset: %08x; length: %08x; %s\n" \ _ offset \ _ header.length \ --- 429,433 ---- header.length = entry -> size + sizeof( data_header ); ! tracef( "write_dir_entry: offset: %08x; length: %08x; %s\n" \ _ offset \ _ header.length \ |
From: <to...@us...> - 2004-01-14 18:10:58
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/Build_GNU In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib/Tools/DefMod2/defmod/Build_GNU Added Files: Tag: unix-build .cvsignore Removed Files: Tag: unix-build kernel.h swis.h Log Message: Unix Build --- NEW FILE: .cvsignore --- defmod .directory --- kernel.h DELETED --- --- swis.h DELETED --- |
From: <to...@us...> - 2004-01-14 18:10:57
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib In directory sc8-pr-cvs1:/tmp/cvs-serv31394/!OsLib Modified Files: Tag: unix-build .cvsignore Log Message: Unix Build Index: .cvsignore =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/.cvsignore,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** .cvsignore 14 Jan 2004 13:33:15 -0000 1.7.2.1 --- .cvsignore 14 Jan 2004 18:10:54 -0000 1.7.2.2 *************** *** 1,3 **** ! bin release Submissions --- 1,3 ---- ! Bin release Submissions |
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/sources In directory sc8-pr-cvs1:/tmp/cvs-serv31713/!OsLib/Tools/DefMod2/defmod/sources Modified Files: Tag: unix-build cheader.c chelp.c cstrong.c def.c defmod.y hdr.c Log Message: Unix Build Index: cheader.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/sources/cheader.c,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** cheader.c 11 Mar 2002 15:07:59 -0000 1.1 --- cheader.c 14 Jan 2004 13:44:31 -0000 1.1.4.1 *************** *** 315,318 **** --- 315,321 ---- } break; + + default: + break; } Index: chelp.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/sources/chelp.c,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** chelp.c 11 Mar 2002 15:08:13 -0000 1.1 --- chelp.c 14 Jan 2004 13:44:31 -0000 1.1.4.1 *************** *** 243,246 **** --- 243,249 ---- } break; + + default: + break; } Index: cstrong.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/sources/cstrong.c,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** cstrong.c 11 Mar 2002 15:08:25 -0000 1.1 --- cstrong.c 14 Jan 2004 13:44:31 -0000 1.1.4.1 *************** *** 655,658 **** --- 655,661 ---- } break; + + default: + break; } Index: def.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/sources/def.c,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** def.c 11 Mar 2002 15:08:38 -0000 1.1 --- def.c 14 Jan 2004 13:44:31 -0000 1.1.4.1 *************** *** 250,253 **** --- 250,256 ---- } break; + + default: + break; } Index: defmod.y =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/sources/defmod.y,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** defmod.y 27 Nov 2002 22:11:00 -0000 1.2 --- defmod.y 14 Jan 2004 13:44:31 -0000 1.2.4.1 *************** *** 1160,1166 **** #else int f; #endif enum {Copying, Skipping} state = Skipping; - bits psr; i++; --- 1160,1166 ---- #else int f; + bits psr; #endif enum {Copying, Skipping} state = Skipping; i++; *************** *** 1168,1172 **** #ifdef EXECUTE_ON_UNIX if ((f = fopen(argv[i],"r")) == NULL) { ! error = _kernel_last_oserror(); goto finish; } --- 1168,1172 ---- #ifdef EXECUTE_ON_UNIX if ((f = fopen(argv[i],"r")) == NULL) { ! error = (os_error *)_kernel_last_oserror(); goto finish; } *************** *** 1185,1189 **** *cc = c = getc(f); if (ferror(f)) { ! error = _kernel_last_oserror(); goto finish; } --- 1185,1189 ---- *cc = c = getc(f); if (ferror(f)) { ! error = (os_error *)_kernel_last_oserror(); goto finish; } *************** *** 1306,1309 **** --- 1306,1312 ---- goto finish; break; + + default: + break; } Index: hdr.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/sources/hdr.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** hdr.c 29 Dec 2003 11:40:21 -0000 1.3 --- hdr.c 14 Jan 2004 13:44:31 -0000 1.3.2.1 *************** *** 509,512 **** --- 509,515 ---- goto finish; break; + + default: + break; } |
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/oslib Added Files: Tag: unix-build OS.Hdr Types.Hdr fileswitch.h font.h hostfs.h macros.h messagetrans.h os.h osargs.h osfile.h osfind.h osgbpb.h osmodule.h osspriteop.h taskwindow.h territory.h types.h wimp.h Log Message: Unix Build --- NEW FILE: OS.Hdr --- [ :LNOT: :DEF: Get_Types GBLS Get_Types ] [ :LNOT: :DEF: Types_Hdr Get_Types SETS "GET Hdr.Types" | Get_Types SETS "" ] $Get_Types [ :LNOT: :DEF: OS_Hdr GBLS OS_Hdr XOS_ReadVarVal * &20023 OS_ReadVarVal * &23 ;Entry ; R0 -> var (String) ; R1 = value (pointer to String) ; R2 = size (Int) ; R3 = context (Int) ; R4 = var_type (OS_VarType) ;Exit ; R0 corrupted ; R2 = used (Int) ; R3 = context_out (Int) ; R4 = var_type_out (OS_VarType) ] END --- NEW FILE: Types.Hdr --- [ :LNOT: :DEF: Types_Hdr GBLL Types_Hdr R0 RN 0 R1 RN 1 R2 RN 2 R3 RN 3 R4 RN 4 R5 RN 5 R6 RN 6 R7 RN 7 R8 RN 8 R9 RN 9 R10 RN 10 R11 RN 11 R12 RN 12 R13 RN 13 R14 RN 14 R15 RN 15 A1 RN 0 A2 RN 1 A3 RN 2 A4 RN 3 V1 RN 4 V2 RN 5 V3 RN 6 V4 RN 7 V5 RN 8 V6 RN 9 R RN 0 SL RN 10 FP RN 11 IP RN 12 SP RN 13 LR RN 14 PC RN 15 Int * 4 Bits * 4 Bool * 4 Short * 2 Char * 1 Byte * 1 Ptr * 4 Float * 4 Double * 8 Null * 0 False * 0 True * 1 None * 0 All * &FFFFFFFF Skip * 0 ;may be used as a "don't care" value V * 1 :SHL: 28 C * 1 :SHL: 29 Z * 1 :SHL: 30 N * 1 :SHL: 31 Error * -2 ] END --- NEW FILE: fileswitch.h --- #ifndef fileswitch_H #define fileswitch_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #ifndef types_H #include "oslib/types.h" #endif #ifndef os_H #include "oslib/os.h" #endif /********************************** * SWI names and SWI reason codes * **********************************/ #undef OS_BGet #define OS_BGet 0xA #undef XOS_BGet #define XOS_BGet 0x2000A #undef BGetV #define BGetV 0xA #undef OS_BPut #define OS_BPut 0xB #undef XOS_BPut #define XOS_BPut 0x2000B #undef BPutV #define BPutV 0xB #undef Service_StartUpFS #define Service_StartUpFS 0x12 #undef Service_FSRedeclare #define Service_FSRedeclare 0x40 #undef Service_CloseFile #define Service_CloseFile 0x68 /************************************ * Structure and union declarations * ************************************/ typedef union fileswitch_info_words fileswitch_info_words; /******************** * Type definitions * ********************/ typedef byte fileswitch_fs_no; typedef bits fileswitch_fs_info; typedef bits fileswitch_fs_extra_info; typedef int fileswitch_object_type; typedef bits fileswitch_attr; union fileswitch_info_words { os_date_and_time date_and_time; struct { bits exec_addr; bits load_addr; } addrs; }; /************************ * Constant definitions * ************************/ #define error_FILE_SWITCH_NO_CLAIM 0x400u /*Unable to claim FileSwitch workspace*/ #define error_BAD_FS_CONTROL_REASON 0x401u /*Bad FSControl call*/ #define error_BAD_OS_FILE_REASON 0x402u /*Bad OSFile call*/ #define error_BAD_OS_ARGS_REASON 0x403u /*Bad OSArgs call*/ #define error_BAD_OSGBPB_REASON 0x404u /*Bad OSGBPB call*/ #define error_BAD_MODE_FOR_OS_FIND 0x405u /*Bad mode for OSFind*/ #define error_NO_ROOM_FOR_TRANSIENT 0x406u /*No room to run transient*/ #define error_EXEC_ADDR_NOT_IN_CODE 0x407u /*Execution address not within code*/ #define error_EXEC_ADDR_TOO_LOW 0x408u /*Code runs too low*/ #define error_UNKNOWN_ACTION_TYPE 0x409u /*No run action for this file type*/ #define error_TOO_MANY_LEVELS 0x40Au /*Too many levels*/ #define error_NO_SELECTED_FILING_SYSTEM 0x40Bu /*No selected filing system*/ #define error_CANT_REMOVE_FS_BY_NUMBER 0x40Cu /*Can't remove filing system by number*/ #define error_UNALIGNED_FS_ENTRY 0x40Du /*Unaligned filing system entry point*/ #define error_UNSUPPORTED_FS_ENTRY 0x40Eu /*Filing system does not support this operation*/ #define error_FS_NOT_SPECIAL 0x40Fu /*Filing system does not support special fields*/ #define error_CORE_NOT_READABLE 0x410u /*No readable memory at this address*/ #define error_CORE_NOT_WRITEABLE 0x411u /*No writable memory at this address*/ #define error_BAD_BUFFER_SIZE_FOR_STREAM 0x412u /*Bad buffer size*/ #define error_NOT_OPEN_FOR_READING 0x413u /*Not open for reading*/ #define error_NOT_ENOUGH_STACK_FOR_FS_ENTRY 0x414u /*Not enough stack to call filing system*/ #define error_NOTHING_TO_COPY 0x415u /*Nothing to copy*/ #define error_NOTHING_TO_DELETE 0x416u /*Nothing to delete*/ #define error_FILE_SWITCH_CANT_BE_KILLED_WHILST_THREADED 0x417u /*FileSwitch can not be killed whilst it is threaded*/ #define error_INVALID_ERROR_BLOCK 0x418u /*Invalid error block*/ #define error_FS_FILE_TOO_BIG 0x419u /*File too big , Clashed with ROMFS FileTooBig*/ #define error_CANT_RM_FASTER_FILE_SWITCH 0x41Au /*Can't RMFaster FileSwitch*/ #define error_INCONSISTENT_HANDLE_SET 0x41Bu /*Inconsistent handle set*/ #define error_IS_AFILE 0x41Cu /*Object is a file*/ #define error_BAD_FILE_TYPE 0x41Du /*Bad file type*/ #define error_LIBRARY_SOMEWHERE_ELSE 0x41Eu /*The library is somewhere else*/ #define error_PATH_IS_SELF_CONTRADICTORY 0x41Fu /*Path is self contradictory*/ #define error_WASNT_DOLLAR_AFTER_DISC 0x420u /*Disc was specified, but absolute wasn't $*/ #define error_NOT_ENOUGH_MEMORY_FOR_WILDCARD_RESOLUTION 0x421u /*Not enough memory for wildcard resolution*/ #define error_NOT_ENOUGH_STACK_FOR_WILDCARD_RESOLUTION 0x422u /*Not enough stack for wildcard resolution*/ #define error_DIR_WANTED_FILE_FOUND 0x423u /*Directory wanted, but file found*/ #define error_NOT_FOUND 0x424u /*Not found, &0100D6*/ #define error_MULTIPART_PATH_USED 0x425u /*Path variable had multiple entries and was used for a write operation*/ #define error_RECURSIVE_PATH 0x426u /*One of the path variables used refers to itself*/ #define error_MULTI_FS_DOES_NOT_SUPPORT_GBPB11 0x427u /*The OS_GBPB 11 call is not supported by image filing systems*/ #define error_FILE_SWITCH_DATA_LOST 0x428u /*Data lost, &4AC , Consistent with ADFS*/ #define error_TOO_MANY_ERROR_LOOKUPS 0x429u /*Too many error lookups happening at once - recursion assumed*/ #define error_MESSAGE_FILE_BUSY 0x42Au /*FileSwitch message file busy*/ #define error_PARTITION_BUSY 0x42Bu /*Partition not ready*/ #define fileswitch_FS_NUMBER_NONE ((fileswitch_fs_no) 0x0u) #define fileswitch_FS_NUMBER_ROMFS ((fileswitch_fs_no) 0x3u) #define fileswitch_FS_NUMBER_NETFS ((fileswitch_fs_no) 0x5u) #define fileswitch_FS_NUMBER_ADFS ((fileswitch_fs_no) 0x8u) #define fileswitch_FS_NUMBER_NETPRINT ((fileswitch_fs_no) 0xCu) #define fileswitch_FS_NUMBER_NULL ((fileswitch_fs_no) 0xDu) #define fileswitch_FS_NUMBER_PRINTER ((fileswitch_fs_no) 0xEu) #define fileswitch_FS_NUMBER_SERIAL ((fileswitch_fs_no) 0xFu) #define fileswitch_FS_NUMBER_VDU ((fileswitch_fs_no) 0x11u) #define fileswitch_FS_NUMBER_RAWVDU ((fileswitch_fs_no) 0x12u) #define fileswitch_FS_NUMBER_KBD ((fileswitch_fs_no) 0x13u) #define fileswitch_FS_NUMBER_RAWKBD ((fileswitch_fs_no) 0x14u) #define fileswitch_FS_NUMBER_DESKFS ((fileswitch_fs_no) 0x15u) #define fileswitch_FS_NUMBER_RAMFS ((fileswitch_fs_no) 0x17u) #define fileswitch_FS_NUMBER_RISCIXFS ((fileswitch_fs_no) 0x18u) #define fileswitch_FS_NUMBER_STREAMER ((fileswitch_fs_no) 0x19u) #define fileswitch_FS_NUMBER_SCSIFS ((fileswitch_fs_no) 0x1Au) #define fileswitch_FS_NUMBER_DIGITISER ((fileswitch_fs_no) 0x1Bu) #define fileswitch_FS_NUMBER_SCANNER ((fileswitch_fs_no) 0x1Cu) #define fileswitch_FS_NUMBER_MULTIFS ((fileswitch_fs_no) 0x1Du) #define fileswitch_FS_NUMBER_NFS ((fileswitch_fs_no) 0x21u) #define fileswitch_FS_NUMBER_CDFS ((fileswitch_fs_no) 0x25u) #define fileswitch_FS_NUMBER_DOSFS ((fileswitch_fs_no) 0x2Bu) #define fileswitch_FS_NUMBER_RESOURCEFS ((fileswitch_fs_no) 0x2Eu) #define fileswitch_FS_NUMBER_PIPEFS ((fileswitch_fs_no) 0x2Fu) #define fileswitch_FS_NUMBER_DEVICEFS ((fileswitch_fs_no) 0x35u) #define fileswitch_FS_NUMBER_PARALLEL ((fileswitch_fs_no) 0x36u) #define fileswitch_FS_NUMBER_PCCARDFS ((fileswitch_fs_no) 0x59u) #define fileswitch_FS_NUMBER_SHAREFS ((fileswitch_fs_no) 0x63u) #define fileswitch_FS_NUMBER ((fileswitch_fs_info) 0xFFu) #define fileswitch_FS_OPEN_FILE_LIMIT ((fileswitch_fs_info) 0xFF00u) #define fileswitch_FS_READ_ONLY ((fileswitch_fs_info) 0x10000u) #define fileswitch_HAS_EXTRA_FLAGS ((fileswitch_fs_info) 0x20000u) #define fileswitch_NO_FILE_ENTRIES ((fileswitch_fs_info) 0x40000u) #define fileswitch_NO_SAVE_ENTRY ((fileswitch_fs_info) 0x80000u) #define fileswitch_NO_LOAD_ENTRY ((fileswitch_fs_info) 0x100000u) #define fileswitch_IMPLICIT_DIRECTORIES ((fileswitch_fs_info) 0x200000u) #define fileswitch_NEEDS_URD_AND_LIB ((fileswitch_fs_info) 0x400000u) #define fileswitch_SUPPORTS_IMAGE ((fileswitch_fs_info) 0x800000u) #define fileswitch_RESERVED ((fileswitch_fs_info) 0x1000000u) #define fileswitch_SUPPORTS_FILE_INFO ((fileswitch_fs_info) 0x2000000u) #define fileswitch_SUPPORTS_STAMP_NAMED ((fileswitch_fs_info) 0x4000000u) #define fileswitch_NEEDS_FLUSH ((fileswitch_fs_info) 0x8000000u) #define fileswitch_NEEDS_CREATE ((fileswitch_fs_info) 0x10000000u) #define fileswitch_SUPPORTS_EMPTY_NAMES ((fileswitch_fs_info) 0x20000000u) #define fileswitch_INTERACTIVE ((fileswitch_fs_info) 0x40000000u) #define fileswitch_SUPPORTS_SPECIAL ((fileswitch_fs_info) 0x80000000u) #define fileswitch_SUPPORTS_DIR_CHANGE ((fileswitch_fs_extra_info) 0x1u) #define fileswitch_NEEDS_CAT ((fileswitch_fs_extra_info) 0x2u) #define fileswitch_NEEDS_EX ((fileswitch_fs_extra_info) 0x4u) #define fileswitch_NOT_FOUND ((fileswitch_object_type) 0x0u) #define fileswitch_IS_FILE ((fileswitch_object_type) 0x1u) #define fileswitch_IS_DIR ((fileswitch_object_type) 0x2u) #define fileswitch_IS_IMAGE ((fileswitch_object_type) 0x3u) #define fileswitch_ATTR_OWNER_READ ((fileswitch_attr) 0x1u) #define fileswitch_ATTR_OWNER_WRITE ((fileswitch_attr) 0x2u) #define fileswitch_ATTR_OWNER_SPECIAL ((fileswitch_attr) 0x4u) #define fileswitch_ATTR_OWNER_LOCKED ((fileswitch_attr) 0x8u) #define fileswitch_ATTR_WORLD_READ ((fileswitch_attr) 0x10u) #define fileswitch_ATTR_WORLD_WRITE ((fileswitch_attr) 0x20u) #define fileswitch_ATTR_WORLD_SPECIAL ((fileswitch_attr) 0x40u) #define fileswitch_ATTR_WORLD_LOCKED ((fileswitch_attr) 0x80u) #define error_NOT_SUPPORTED 0xF8u /*Bad operation on ...:*/ #define error_FS_WRITE_ONLY 0xFAu /*...: is a write only filing system*/ #define error_FS_READ_ONLY 0xFCu /*...: is a read only filing system*/ #define xos_bget(file, c, psr) \ _swix (OS_BGet, _IN (1) | _OUT (0) | _OUT (_FLAGS), file, c, psr) #define xos_bput(c, file) \ _swix (OS_BPut, _IN (0) | _IN (1), c, file) #endif --- NEW FILE: font.h --- #ifndef font_H #define font_H #include <swis.h> #ifndef types_H #include "oslib/types.h" #endif #ifndef os_H #include "oslib/os.h" #endif #define font_COMMAND_NUL 0 #define font_COMMAND_MOVE_HORIZONTAL 9 #define font_COMMAND_LF 10 #define font_COMMAND_MOVE_VERTICAL 11 #define font_COMMAND_CR 13 #define font_COMMAND_GCOL 17 #define font_COMMAND_COLOURS 18 #define font_COMMAND_TRUE_COLOURS 19 #define font_COMMAND_COMMENT 21 #define font_COMMAND_UNDERLINE 25 #define font_COMMAND_FONT 26 #define font_COMMAND_MATRIX 27 #define font_COMMAND_MATRIX_WITH_OFFSET 28 #define font_PAINT_JUSTIFY (1U << 0) #define font_PAINT_RUBOUT (1U << 1) #define font_PAINT_OS_UNITS (1U << 4) #define font_PAINT_GIVEN_COORDS (1U << 5) #define font_PAINT_GIVEN_TRFM (1U << 6) #define font_PAINT_GIVEN_LENGTH (1U << 7) #define font_PAINT_GIVEN_FONT (1U << 8) #define font_PAINT_KERN (1U << 9) #define font_PAINT_RIGHT_TO_LEFT (1U << 10) #define font_NO_OUTPUT (1U << 0) #define font_ADD_HINTS (1U << 1) #define font_OUTPUT_SKELETON (1U << 2) #define font_CONVERT_BITMAP (1U << 3) #define font_ERROR_IF_BITMAP (1U << 4) typedef int font_f; typedef struct { os_coord space_offset; os_coord letter_offset; os_box rubout; } font_coords; #define xfont_cache_addr(version, cache, used) \ _swix (Font_CacheAddr, _OUT (0) | _OUT (2) | _OUT (3), \ (int *) (version), (int *) (cache), (int *) (used)) #define xfont_find_font(font_name, xsize, ysize, xres, yres, f) \ _swix (Font_FindFont, _IN (1) | _IN (2) | _IN (3) | _IN (4) | _IN (5) | \ _OUT (0) | _OUT (4) | _OUT (5), \ (char *) (font_name), (int) (xsize), (int) (ysize), \ *(int *) (xres), *(int *) (yres), \ (font_f *) (f), (int *) (xres), (int *) (yres)) #define xfont_lose_font(f) \ _swix (Font_LoseFont, _IN (0), (font_f) (f)) #define xfont_read_defn() \ _swix (Font_ReadDefn, ) #define xfont_read_info() \ _swix (Font_ReadInfo, ) #define xfont_string_width() \ _swix (Font_StringWidth, ) #define xfont_paint(f, string, paint, xpos, ypos, coords, trfm, length) \ _swix (Font_Paint, _IN (0) | _IN (1) | _IN (2) | _IN (3) | _IN (4) | \ _IN (5) | _IN (6) | _IN (7), \ (font_f) (f), (char *) (string), (int) (paint), (int) (xpos), \ (int) (ypos), (font_coords *) (coords), (os_trfm_mat *) (trfm), \ (int) (length)) #define xfont_caret() \ _swix (Font_Caret, ) #define xfont_convert_to_os() \ _swix (Font_ConverttoOS, ) #define xfont_convert_to_points() \ _swix (Font_Converttopoints, ) #define xfont_set_font() \ _swix (Font_SetFont, ) #define xfont_current_font() \ _swix (Font_CurrentFont, ) #define xfont_future_font() \ _swix (Font_FutureFont, ) #define xfont_find_caret() \ _swix (Font_FindCaret, ) #define xfont_char_bbox() \ _swix (Font_CharBBox, ) #define xfont_read_scale_factor() \ _swix (Font_ReadScaleFactor, ) #define xfont_set_scale_factor() \ _swix (Font_SetScaleFactor, ) #define xfont_list_fonts() \ _swix (Font_ListFonts, ) #define xfont_set_font_colours() \ _swix (Font_SetFontColours, ) #define xfont_set_palette() \ _swix (Font_SetPalette, ) #define xfont_read_thresholds() \ _swix (Font_ReadThresholds, ) #define xfont_set_thresholds() \ _swix (Font_SetThresholds, ) #define xfont_find_caret_j() \ _swix (Font_FindCaretJ, ) #define xfont_string_bbox() \ _swix (Font_StringBBox, ) #define xfont_read_colour_table() \ _swix (Font_ReadColourTable, ) #define xfont_make_bitmap() \ _swix (Font_MakeBitmap, ) #define xfont_uncache_file() \ _swix (Font_UnCacheFile, ) #define xfont_set_font_max() \ _swix (Font_SetFontMax, ) #define xfont_read_font_max() \ _swix (Font_ReadFontMax, ) #define xfont_read_font_prefix() \ _swix (Font_ReadFontPrefix, ) #define xfont_switch_output_to_buffer(flags, buffer, end) \ _swix (Font_SwitchOutputToBuffer, _IN (0) | _IN (1) | _OUT (1), \ (int) (flags), (int *) (buffer), (int *) (end)) #define xfont_read_font_metrics() \ _swix (Font_ReadFontMetrics, ) #define xfont_decode_menu() \ _swix (Font_DecodeMenu, ) #define xfont_scan_string() \ _swix (Font_ScanString, ) #define xfont_set_colour_table() \ _swix (Font_SetColourTable, ) #define xfont_current_rgb() \ _swix (Font_CurrentRGB, ) #define xfont_future_rgb() \ _swix (Font_FutureRGB, ) #define xfont_read_encoding_filename() \ _swix (Font_ReadEncodingFilename, ) #define xfont_find_field() \ _swix (Font_FindField, ) #define xfont_apply_fields() \ _swix (Font_ApplyFields, ) #define xfont_lookup_font() \ _swix (Font_LookupFont, ) #endif --- NEW FILE: hostfs.h --- #ifndef hostfs_H #define hostfs_H #include <swis.h> #ifndef types_H #include "types.h" #endif #undef HostFS_HostVdu #define HostFS_HostVdu 0x40100 #undef HostFS_TubeVdu #define HostFS_TubeVdu 0x40101 #undef HostFS_WriteC #define HostFS_WriteC 0x40102 #define xhostfs_host_vdu() \ _swix (HostFS_HostVdu, 0) #define xhostfs_tube_vdu() \ _swix (HostFS_TubeVdu, 0) #define xhostfs_writec(c) \ _swix (HostFS_WriteC, _IN (0), (int) (c)) #endif --- NEW FILE: macros.h --- #ifndef macros_H #define macros_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ /************************ * Constant definitions * ************************/ #ifndef SIG_LIMIT #define SIG_LIMIT 11 #endif #ifndef DEC_WIDTH #define DEC_WIDTH 10 #endif #ifndef SHORT_DEC_WIDTH #define SHORT_DEC_WIDTH 5 #endif #ifndef LONG_DEC_WIDTH #define LONG_DEC_WIDTH 10 #endif #ifndef OCT_WIDTH #define OCT_WIDTH 11 #endif #ifndef SHORT_OCT_WIDTH #define SHORT_OCT_WIDTH 6 #endif #ifndef LONG_OCT_WIDTH #define LONG_OCT_WIDTH 11 #endif #ifndef UNSIGNED_WIDTH #define UNSIGNED_WIDTH 10 #endif #ifndef SHORT_UNSIGNED_WIDTH #define SHORT_UNSIGNED_WIDTH 5 #endif #ifndef LONG_UNSIGNED_WIDTH #define LONG_UNSIGNED_WIDTH 10 #endif #ifndef HEX_WIDTH #define HEX_WIDTH 8 #endif #ifndef SHORT_HEX_WIDTH #define SHORT_HEX_WIDTH 4 #endif #ifndef LONG_HEX_WIDTH #define LONG_HEX_WIDTH 8 #endif #ifndef FLT_WIDTH #define FLT_WIDTH 7 #endif #ifndef DBL_WIDTH #define DBL_WIDTH 17 #endif #ifndef LDBL_WIDTH #define LDBL_WIDTH 17 #endif #ifndef FLT_EXP_WIDTH #define FLT_EXP_WIDTH 2 #endif #ifndef DBL_EXP_WIDTH #define DBL_EXP_WIDTH 3 #endif #ifndef LDBL_EXP_WIDTH #define LDBL_EXP_WIDTH 3 #endif /********************* * Macro definitions * *********************/ /* ------------------------------------------------------------------------ * Macro: ABS() * * Description: Absolute value of a number */ #define ABS(a) ((a) >= 0? (a): -(a)) /* ------------------------------------------------------------------------ * Macro: ALIGN() * * Description: Rounds an integer up to the next multiple of 4 */ #define ALIGN(b) ((b) + 3 & ~3) /* ------------------------------------------------------------------------ * Macro: BINEXP() * * Description: 2 to the power of an integer */ #define BINEXP(n) (1 << (n)) /* ------------------------------------------------------------------------ * Macro: BIT() * * Description: The value of a bit at an offset from a pointer (cf CLR, * SET) */ #define BIT(p, i) (((bits *) (p)) [(i) >> 5] & 1 << ((i) & 31)) /* ------------------------------------------------------------------------ * Macro: BOOL() * * Description: Converts non-0 values to 1 */ #define BOOL(c) ((c) != 0? TRUE: FALSE) /* ------------------------------------------------------------------------ * Macro: CLEAR() * * Description: Clears the contents of a string */ #define CLEAR(s) ((s) [0] = '\0') /* ------------------------------------------------------------------------ * Macro: CLR() * * Description: Clears the bit at an offset from a pointer (cf BIT, SET) * * Other notes: 5 = x: 2^^x == CHAR_BIT*sizeof (bits); 31 = * CHAR_BIT*sizeof (bits) - 1 */ #define CLR(p, i) (((bits *) (p)) [(i) >> 5] &= ~(1 << ((i) & 31))) /* ------------------------------------------------------------------------ * Macro: COUNT() * * Description: The number of elements in an array */ #define COUNT(a) (sizeof (a)/sizeof *(a)) /* ------------------------------------------------------------------------ * Macro: DBLEQ() * * Description: Tests floating point numbers for approximate equality */ #define DBLEQ(a, b, e) (fabs ((a) - (b)) <= (e)*(fabs (a) + fabs (b))) /* ------------------------------------------------------------------------ * Macro: DIGIT() * * Description: The decimal digit corresponding to a character */ #define DIGIT(c) ((c) - '0') /* ------------------------------------------------------------------------ * Macro: DIM() * * Description: Positive difference */ #define DIM(a, b) ((a) > (b)? (a) - (b): 0) /* ------------------------------------------------------------------------ * Macro: EMPTY() * * Description: Is a string empty? */ #define EMPTY(s) ((s) [0] == '\0') /* ------------------------------------------------------------------------ * Macro: ISDIGIT() * * Description: A decimal digit? */ #define ISDIGIT(c) ('0' <= (c) && (c) <= '9') /* ------------------------------------------------------------------------ * Macro: ISXDIGIT() * * Description: A hexadecimal digit? */ #define ISXDIGIT(c) (('0' <= (c) && (c) <= '9') || \ ('a' <= (c) && (c) <= 'f') || ('A' <= (c) && (c) <= 'F')) /* ------------------------------------------------------------------------ * Macro: LCHAR() * * Description: The character corresponding to a digit, preferring lower * case */ #define LCHAR(i) ("0123456789abcdef" [i]) /* ------------------------------------------------------------------------ * Macro: MAX() * * Description: The larger of two values */ #define MAX(a, b) ((a) > (b)? (a): (b)) /* ------------------------------------------------------------------------ * Macro: MAXAB() * * Description: The larger of two values and assign */ #define MAXAB(a, b) ((a) < (b)? (a) = (b): (a)) /* ------------------------------------------------------------------------ * Macro: MIN() * * Description: The smaller of two values */ #define MIN(a, b) ((a) < (b)? (a): (b)) /* ------------------------------------------------------------------------ * Macro: MINAB() * * Description: The smaller of two values and assign */ #define MINAB(a, b) ((a) > (b)? (a) = (b): (a)) /* ------------------------------------------------------------------------ * Macro: NCOPY() * * Description: Copy a string of limited length */ #define NCOPY(s1, s2, n) (sprintf (s1, "%.*s", n, s2), s1) /* ------------------------------------------------------------------------ * Macro: RATIO() * * Description: Integer division, rounding to nearest */ #define RATIO(a, b) ((2*(a) + (b))/(2*(b))) /* ------------------------------------------------------------------------ * Macro: SET() * * Description: Sets the bit at an offset from a pointer (cf BIT, CLR) */ #define SET(p, i) (((bits *) (p)) [(i) >> 5] |= 1 << ((i) & 31)) /* ------------------------------------------------------------------------ * Macro: SGN() * * Description: Signum */ #define SGN(a) ((a) > 0? 1: (a) < 0? -1: 0) /* ------------------------------------------------------------------------ * Macro: SHORT() * * Description: Assembles a short from an unaligned pointer */ #define SHORT(ptr) ((int) (((byte *) (ptr)) [0] | \ ((byte *) (ptr)) [1] << 8) << 16 >> 16) /* ------------------------------------------------------------------------ * Macro: SQR() * * Description: Square */ #define SQR(a) ((a)*(a)) /* ------------------------------------------------------------------------ * Macro: STR_() * * Description: Helper macro for STR */ #define STR_(s) #s /* ------------------------------------------------------------------------ * Macro: STR() * * Description: Stringise a macro */ #define STR(s) STR_ (s) /* ------------------------------------------------------------------------ * Macro: UCHAR() * * Description: The character corresponding to a hexadecimal digit, * preferring upper case */ #define UCHAR(i) ("0123456789ABCDEF" [i]) /* ------------------------------------------------------------------------ * Macro: WORD() * * Description: Assembles a word at an unaligned character pointer */ #define WORD(ptr) ((int) (((byte *) (ptr)) [0] | \ ((byte *) (ptr)) [1] << 8 | ((byte *) (ptr)) [2] << 16 | \ ((byte *) (ptr)) [3] << 24)) /* ------------------------------------------------------------------------ * Macro: XDIGIT() * * Description: The hexadecimal digit corresponding to a character */ #define XDIGIT(c) ((byte) (c) < 'A'? (c) - '0': \ (byte) (c) < 'a'? (c) - 'A' + 10: (c) - 'a' + 10) /* ------------------------------------------------------------------------ * Macro: WHETHER() * * Description: Converts a boolean value to a string */ #define WHETHER(c) ((c)? "TRUE": "FALSE") #endif --- NEW FILE: messagetrans.h --- #ifndef messagetrans_H #define messagetrans_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #include <kernel.h> #include <swis.h> #ifndef types_H #include "oslib/types.h" #endif #ifndef os_H #include "oslib/os.h" #endif #define messagetrans_DIRECT_ACCESS (1 << 0) typedef struct {int cb [4];} messagetrans_control_block; #ifdef EXECUTE_ON_UNIX /* ------------------------------------------------------------------------ * Function: messagetrans_error_lookup() * * Description: Translates a message token within an error block * * Input: error - value of R0 on entry * cb - value of R1 on entry * buffer - value of R2 on entry * size - value of R3 on entry * arg0 - value of R4 on entry * arg1 - value of R5 on entry * arg2 - value of R6 on entry * arg3 - value of R7 on entry * * Other notes: Calls SWI 0x41506. */ extern os_error *xmessagetrans_error_lookup (os_error const *error, messagetrans_control_block const *cb, os_error *buffer, int size, char const *arg0, char const *arg1, char const *arg2, char const *arg3); extern void messagetrans_error_lookup (os_error const *error, messagetrans_control_block const *cb, os_error *buffer, int size, char const *arg0, char const *arg1, char const *arg2, char const *arg3); #else /* EXECUTE_ON_UNIX */ #define xmessagetrans_file_info(file_name, flags, size) \ _swix (MessageTrans_FileInfo, _IN (1) | _OUT (0) | _OUT (2), \ (char *) (file_name), (int *) (flags), (int *) (size)) #define xmessagetrans_open_file(cb, file_name, buffer) \ _swix (MessageTrans_OpenFile, _IN (0) | _IN (1) | _IN (2), \ (messagetrans_control_block *) (cb), (char *) (file_name), \ (char *) (buffer)) #define xmessagetrans_lookup(cb, token, buffer, size_in, arg0, arg1, arg2, \ arg3, result, size_out) \ _swix (MessageTrans_Lookup, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _IN (4) | _IN (5) | _IN (6) | _IN (7) | _OUT (2) | _OUT (3), \ (messagetrans_control_block *) (cb), (char *) (token), \ (char *) (buffer), (int) (size_in), (char *) (arg0), \ (char *) (arg1), (char *) (arg2), (char *) (arg3), \ (char **) (result), (int *) (size_out)) #define xmessagetrans_make_menus(cb, menus, buffer, size_in, size_out) \ _swix (MessageTrans_MakeMenus, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _OUT (3), \ (messagetrans_control_block *) (cb), (char *) (menus), \ (char *) (buffer), (int) (size_in), (int *) (size_out)) #define xmessagetrans_close_file(cb) \ _swix (MessageTrans_CloseFile, _IN (0), \ (messagetrans_control_block *) (cb)) #define xmessagetrans_enumerate_tokens(cb, token, buffer, size, index, \ cont, size_out, index_out) \ _swix (MessageTrans_EnumerateTokens, \ _IN (0) | _IN (1) | _IN (2) | _IN (3) | _IN (4) | \ _OUT (2) | _OUT (3) | _OUT (4), \ (messagetrans_control_block *) (cb), (char *) (token), \ (char *) (buffer), (int) (size), (int) (index), \ (osbool *) (cont), (int *) (size_out), (int *) (index_out)) #define xmessagetrans_error_lookup(error, cb, buffer, size_in, arg0, arg1, \ arg2, arg3) \ _swix (MessageTrans_ErrorLookup, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _IN (4) | _IN (5) | _IN (6) | _IN (7), \ (_kernel_oserror *) (error), (messagetrans_control_block *) (cb), \ (char *) (buffer), (int) (size_in), (char *) (arg0), \ (char *) (arg1), (char *) (arg2), (char *) (arg3)) #define messagetrans_error_lookup(error, cb, buffer, size_in, arg0, arg1, \ arg2, arg3) \ _swi (MessageTrans_ErrorLookup, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _IN (4) | _IN (5) | _IN (6) | _IN (7), \ (_kernel_oserror *) (error), (messagetrans_control_block *) (cb), \ (char *) (buffer), (int) (size_in), (char *) (arg0), \ (char *) (arg1), (char *) (arg2), (char *) (arg3)) #define xmessagetrans_gs_lookup(cb, token, buffer, size_in, arg0, arg1, \ arg2, arg3, result, size_out) \ _swix (MessageTrans_GSLookup, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _IN (4) | _IN (5) | _IN (6) | _IN (7) | _OUT (2) | _OUT (3), \ (messagetrans_control_block *) (cb), (char *) (token), \ (char *) (buffer), (int) (size_in), (char *) (arg0), \ (char *) (arg1), (char *) (arg2), (char *) (arg3), \ (char **) (result), (int *) (size_out)) #define xmessagetrans_copy_error(error, copy) \ _swix (MessageTrans_CopyError, _IN (0) | _OUT (0), \ (os_error *) (error), (os_error **) (copy)) #endif /* EXECUTE_ON_UNIX */ #endif --- NEW FILE: os.h --- #ifndef os_H #define os_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License [...5783 lines suppressed...] _swix (OS_ConvertSpacedInteger4, \ _IN (0) | _IN (1) | _IN (2) | _OUT (1) | _OUT (2), \ (int) (value), (char *) (buffer), (int) (size), (char **) (end), \ (int *) (free)) #define xos_convert_fixed_net_station() \ _swix (OS_ConvertFixedNetStation, ) #define xos_convert_net_station() \ _swix (OS_ConvertNetStation, ) #define xos_convert_fixed_file_size() \ _swix (OS_ConvertFixedFileSize, ) #define xos_convert_file_size() \ _swix (OS_ConvertFileSize, ) #endif /* EXECUTE_ON_UNIX */ #endif --- NEW FILE: osargs.h --- #ifndef osargs_H #define osargs_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #ifndef types_H #include "types.h" #endif #ifndef fileswitch_H #include "oslib/fileswitch.h" #endif #ifndef os_H #include "os.h" #endif /********************************** * SWI names and SWI reason codes * **********************************/ #define OSArgs_ReadPtr 0x0 #define OSArgs_ReadTemporaryFS 0x0 #define OSArgs_SetPtr 0x1 #define OSArgs_ReadExt 0x2 #define OSArgs_SetExt 0x3 #define OSArgs_ReadAllocation 0x4 #define OSArgs_ReadEOFStatus 0x5 #define OSArgs_SetAllocation 0x6 #define OSArgs_ReadPath 0x7 #define OSArgs_ImageStamped 0x8 #define OSArgs_ReadInfo 0xFE #define OSArgs_Ensure 0xFF /******************** * Type definitions * ********************/ typedef bits osargs_stream_status; /************************ * Constant definitions * ************************/ #define osargs_STREAM_INTERACTIVE ((bits) 0x8u) #define osargs_STREAM_SUPPORTS_GBPB ((bits) 0x10u) #define osargs_STREAM_DIRECTORY ((bits) 0x20u) #define osargs_STREAM_READABLE ((bits) 0x40u) #define osargs_STREAM_WRITABLE ((bits) 0x80u) #define osargs_STREAM_WRITTEN ((bits) 0x100u) #define osargs_STREAM_EOF_ERROR_ON_NEXT_READ ((bits) 0x200u) #define osargs_STREAM_UNBUFFERED ((bits) 0x400u) #define osargs_STREAM_UNALLOCATED ((bits) 0x800u) #define osargs_STREAM_CRITICAL ((bits) 0x1000u) #define osargs_STREAM_DATA_LOST ((bits) 0x2000u) #define osargs_STREAM_IMAGE_FILE_BUSY ((bits) 0x4000u) #if defined EXECUTE_ON_UNIX #ifdef __cplusplus extern "C" { #endif /* ------------------------------------------------------------------------ * Function: osargs_read_ptr() * * Description: Reads a file's sequential file pointer. Prefer * OSArgs_ReadPtrW * * Input: file - value of R1 on entry * * Output: ptr - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x0. */ extern os_error *xosargs_read_ptr (os_f file, int *ptr); extern int osargs_read_ptr (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_read_ptrw() * * Description: Reads a file's sequential file pointer. Uses 32-bit file * handle * * Input: file - value of R1 on entry * * Output: ptr - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x0. */ extern os_error *xosargs_read_ptrw (os_fw file, int *ptr); extern int osargs_read_ptrw (os_fw file); /* ------------------------------------------------------------------------ * Function: osargs_read_temporary_fs() * * Description: Reads the temporary filing system number * * Output: temp_fs_no - value of R0 on exit (X version only) * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x0, R1 = 0x0. */ extern os_error *xosargs_read_temporary_fs (fileswitch_fs_no *temp_fs_no); extern fileswitch_fs_no osargs_read_temporary_fs (void); /* ------------------------------------------------------------------------ * Function: osargs_set_ptr() * * Description: Writes an open file's sequential file pointer Prefer * OSArgs_SetPtrW * * Input: file - value of R1 on entry * ptr - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x1. */ extern os_error *xosargs_set_ptr (os_f file, int ptr); extern void osargs_set_ptr (os_f file, int ptr); /* ------------------------------------------------------------------------ * Function: osargs_set_ptrw() * * Description: Writes an open file's sequential file pointer. Uses * 32-bit file handle * * Input: file - value of R1 on entry * ptr - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x1. */ extern os_error *xosargs_set_ptrw (os_fw file, int ptr); extern void osargs_set_ptrw (os_fw file, int ptr); /* ------------------------------------------------------------------------ * Function: osargs_read_ext() * * Description: Reads an open file's extent. Prefer OSArgs_ReadExtW * * Input: file - value of R1 on entry * * Output: ext - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x2. */ extern os_error *xosargs_read_ext (os_f file, int *ext); extern int osargs_read_ext (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_read_extw() * * Description: Reads an open file's extent. Uses 32-bit file handle * * Input: file - value of R1 on entry * * Output: ext - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x2. */ extern os_error *xosargs_read_extw (os_fw file, int *ext); extern int osargs_read_extw (os_fw file); /* ------------------------------------------------------------------------ * Function: osargs_set_ext() * * Description: Writes an open file's extent. Prefer OSArgs_SetExtW * * Input: file - value of R1 on entry * ext - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x3. */ extern os_error *xosargs_set_ext (os_f file, int ext); extern void osargs_set_ext (os_f file, int ext); /* ------------------------------------------------------------------------ * Function: osargs_set_extw() * * Description: Writes an open file's extent. Uses 32-bit file handle. * * Input: file - value of R1 on entry * ext - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x3. */ extern os_error *xosargs_set_extw (os_fw file, int ext); extern void osargs_set_extw (os_fw file, int ext); /* ------------------------------------------------------------------------ * Function: osargs_read_allocation() * * Description: Reads an open file's allocated size. Prefer * OSArgs_ReadAllocationW * * Input: file - value of R1 on entry * * Output: allocation - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x4. */ extern os_error *xosargs_read_allocation (os_f file, int *allocation); extern int osargs_read_allocation (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_read_allocationw() * * Description: Reads an open file's allocated size. Uses 32-bit file * handle. * * Input: file - value of R1 on entry * * Output: allocation - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x4. */ extern os_error *xosargs_read_allocationw (os_fw file, int *allocation); extern int osargs_read_allocationw (os_fw file); /* ------------------------------------------------------------------------ * Function: osargs_read_eof_status() * * Description: Reads an open file's end-of-file (EOF) status. Prefer * OSArgs_ReadEOFStatusW * * Input: file - value of R1 on entry * * Output: eof_status - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x5. */ extern os_error *xosargs_read_eof_status (os_f file, osbool *eof_status); extern osbool osargs_read_eof_status (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_read_eof_statusw() * * Description: Reads an open file's end-of-file (EOF) status. Uses * 32-bit file handle. * * Input: file - value of R1 on entry * * Output: eof_status - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x5. */ extern os_error *xosargs_read_eof_statusw (os_fw file, osbool *eof_status); extern osbool osargs_read_eof_statusw (os_fw file); /* ------------------------------------------------------------------------ * Function: osargs_set_allocation() * * Description: Ensures an open file's size. Prefer OSArgs_SetAllocationW * * Input: file - value of R1 on entry * allocation - value of R2 on entry * * Output: allocation_out - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x6. */ extern os_error *xosargs_set_allocation (os_f file, int allocation, int *allocation_out); extern int osargs_set_allocation (os_f file, int allocation); /* ------------------------------------------------------------------------ * Function: osargs_set_allocationw() * * Description: Ensures an open file's size. Uses 32-bit file handle. * * Input: file - value of R1 on entry * allocation - value of R2 on entry * * Output: allocation_out - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x6. */ extern os_error *xosargs_set_allocationw (os_fw file, int allocation, int *allocation_out); extern int osargs_set_allocationw (os_fw file, int allocation); /* ------------------------------------------------------------------------ * Function: osargs_read_path() * * Description: Converts a file handle to a canonical name. Prefer * OSArgs_ReadPathW * * Input: file - value of R1 on entry * buffer - value of R2 on entry * size - value of R5 on entry * * Output: spare - value of R5 on exit (X version only) * * Returns: R5 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x7. */ extern os_error *xosargs_read_path (os_f file, char *buffer, int size, int *spare); extern int osargs_read_path (os_f file, char *buffer, int size); /* ------------------------------------------------------------------------ * Function: osargs_read_pathw() * * Description: Converts a file handle to a canonical name. Uses 32-bit * file handle. * * Input: file - value of R1 on entry * buffer - value of R2 on entry * size - value of R5 on entry * * Output: spare - value of R5 on exit (X version only) * * Returns: R5 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x7. */ extern os_error *xosargs_read_pathw (os_fw file, char *buffer, int size, int *spare); extern int osargs_read_pathw (os_fw file, char *buffer, int size); /* ------------------------------------------------------------------------ * Function: osargs_image_stamped() * * Description: Used by an image filing system to inform of a change to * an image stamp. Prefer OSArgs_ImageStampedW * * Input: file - value of R1 on entry * image_stamp - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x8. */ extern os_error *xosargs_image_stamped (os_f file, int image_stamp); extern void osargs_image_stamped (os_f file, int image_stamp); /* ------------------------------------------------------------------------ * Function: osargs_image_stampedw() * * Description: Used by an image filing system to inform of a change to * an image stamp. Uses 32-bit file handle. * * Input: file - value of R1 on entry * image_stamp - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x8. */ extern os_error *xosargs_image_stampedw (os_fw file, int image_stamp); extern void osargs_image_stampedw (os_fw file, int image_stamp); /* ------------------------------------------------------------------------ * Function: osargs_read_info() * * Description: Reads information on a file handle. Prefer * OSArgs_ReadInfoW * * Input: file - value of R1 on entry * * Output: stream_status - value of R0 on exit * fs_info - value of R2 on exit * * Other notes: Calls SWI 0x9 with R0 = 0xFE. */ extern os_error *xosargs_read_info (os_f file, osargs_stream_status *stream_status, fileswitch_fs_info *fs_info); extern void osargs_read_info (os_f file, osargs_stream_status *stream_status, fileswitch_fs_info *fs_info); /* ------------------------------------------------------------------------ * Function: osargs_read_infow() * * Description: Reads information on a file handle. Uses 32-bit file * handle. * * Input: file - value of R1 on entry * * Output: stream_status - value of R0 on exit * fs_info - value of R2 on exit * * Other notes: Calls SWI 0x9 with R0 = 0xFE. */ extern os_error *xosargs_read_infow (os_fw file, osargs_stream_status *stream_status, fileswitch_fs_info *fs_info); extern void osargs_read_infow (os_fw file, osargs_stream_status *stream_status, fileswitch_fs_info *fs_info); /* ------------------------------------------------------------------------ * Function: osargs_ensure() * * Description: Ensures data has been written to a file, or to all files * on the temporary filing system. Prefer OSArgs_EnsureW * * Input: file - value of R1 on entry * * Other notes: Calls SWI 0x9 with R0 = 0xFF. */ extern os_error *xosargs_ensure (os_f file); extern void osargs_ensure (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_ensurew() * * Description: Ensures data has been written to a file, or to all files * on the temporary filing system. Uses 32-bit file handle. * * Input: file - value of R1 on entry * * Other notes: Calls SWI 0x9 with R0 = 0xFF. */ extern os_error *xosargs_ensurew (os_fw file); extern void osargs_ensurew (os_fw file); #ifdef __cplusplus } #endif #else /* EXECUTE_ON_UNIX */ #define xosargs_ensure(file) _swix (OS_Args, _IN (0) | _IN (1), \ OSArgs_Ensure, (os_f) (file)) #endif /* EXECUTE_ON_UNIX */ #endif --- NEW FILE: osfile.h --- #ifndef osfile_H #define osfile_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #include <swis.h> #ifndef types_H #include "types.h" #endif #ifndef fileswitch_H #include "oslib/fileswitch.h" #endif #define OSFile_Load 255 #define OSFile_Save 0 #define OSFile_WriteInfo 1 #define OSFile_WriteLoad 2 #define OSFile_WriteExec 3 #define OSFile_WriteAttr 4 #define OSFile_Read 5 #define OSFile_Delete 6 #define OSFile_Create 7 #define OSFile_CreateDir 8 #define OSFile_SetStamp 9 #define OSFile_SaveStamp 10 #define OSFile_CreateStamp 11 #define OSFile_LoadPath 12 #define OSFile_ReadPath 13 #define OSFile_LoadPathVar 14 #define OSFile_ReadPathVar 15 #define OSFile_LoadNoPath 16 #define OSFile_ReadNoPath 17 #define OSFile_SetType 18 #define OSFile_MakeError 19 #define OSFile_ReadWithType 20 #define OSFile_ReadWithTypePath 21 #define OSFile_ReadWithTypePathVar 22 #define OSFile_ReadWithTypeNoPath 23 #define OSFile_ReadBlockSize 24 #define osfile_NOT_FOUND 0 #define osfile_IS_FILE 1 #define osfile_IS_DIR 2 #define osfile_TYPE_DRAW 0xAFF #define osfile_TYPE_BBC_ROM 0xBBC #define osfile_TYPE_DOS_DISC 0xFC8 #define osfile_TYPE_DEVICE 0xFCC #define osfile_TYPE_CACHE 0xFCF #define osfile_TYPE_TASK_EXEC 0xFD6 #define osfile_TYPE_TASK_OBEY 0xFD7 #define osfile_TYPE_DOS 0xFE4 #define osfile_TYPE_DESKTOP 0xFEA #define osfile_TYPE_OBEY 0xFEB #define osfile_TYPE_TEMPLATE 0xFEC #define osfile_TYPE_PALETTE 0xFED #define osfile_TYPE_CONFIG 0xFF2 #define osfile_TYPE_PRINTOUT 0xFF4 #define osfile_TYPE_POSTSCRIPT 0xFF5 #define osfile_TYPE_FONT 0xFF6 #define osfile_TYPE_BBC_FONT 0xFF7 #define osfile_TYPE_ABSOLUTE 0xFF8 #define osfile_TYPE_SPRITE 0xFF9 #define osfile_TYPE_MODULE 0xFFA #define osfile_TYPE_BASIC 0xFFB #define osfile_TYPE_UTILITY 0xFFC #define osfile_TYPE_DATA 0xFFD #define osfile_TYPE_COMMAND 0xFFE #define osfile_TYPE_TEXT 0xFFF #define osfile_TYPE_DIRECTORY 0x1000 #define osfile_TYPE_APPLICATION 0x2000 #define osfile_TYPE_UNTYPED 0xFFFFFFFF #define osfile_TYPE(load_addr) ((load_addr & 0xFFF00000) == 0xFFF00000? \ (load_addr) >> 8 & 0xFFF: osfile_TYPE_UNTYPED) #ifdef EXECUTE_ON_UNIX extern os_error *xosfile_create_dir(char const *, int); extern void osfile_create_dir(char const *, int); #if 0 /* in os.h */ extern void os_generate_error(_kernel_oserror *); #endif #else /* EXECUTE_ON_UNIX */ #define xosfile_load(file_name, addr, load_addr, exec_addr, size, attr) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (3) | _OUT (2) | \ _OUT (3) | _OUT (4) | _OUT (5), OSFile_Load, (char *) (file_name), \ (void *) (addr), 0, (int *) (load_addr), (int *) (exec_addr), \ (int *) (size), (int *) (attr)) #define xosfile_save(file_name, load_addr, exec_addr, start, end) \ _swix (OS_File, \ _IN (0) | _IN (1) | _IN (2) | _IN (3) | _IN (4) | _IN (5), \ OSFile_Save, (char *) (file_name), (int) (load_addr), \ (int) (exec_addr), (char *) (start), (char *) (end)) #define xosfile_write_info() ... #define xosfile_write_load() ... #define xosfile_write_exec() ... #define xosfile_write_attr() ... #define xosfile_read(file_name, obj_type, load_addr, exec_addr, size, \ attr) \ _swix (OS_File, _IN (0) | _IN (1) | _OUT (0) | _OUT (2) | _OUT (3) | \ _OUT (4) | _OUT (5), OSFile_Read, (char *) (file_name), \ (int *) (obj_type), (int *) (load_addr), (int *) (exec_addr), \ (int *) (size), (int *) (attr)) #define xosfile_delete(file_name, obj_type, load_addr, exec_addr, size, \ attr) \ _swix (OS_File, _IN (0) | _IN (1) | _OUT (0) | _OUT (2) | _OUT (3) | \ _OUT (4) | _OUT (5), OSFile_Delete, (char *) (file_name), \ (int *) (obj_type), (int *) (load_addr), (int *) (exec_addr), \ (int *) (size), (int *) (attr)) #define xosfile_create() ... #define xosfile_create_dir(dir_name, no_entries) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (4), \ OSFile_CreateDir, (char *) (dir_name), (int) (no_entries)) #define osfile_create_dir(dir_name, no_entries) \ _swi (OS_File, _IN (0) | _IN (1) | _IN (4), \ OSFile_CreateDir, (char *) (dir_name), (int) (no_entries)) #define xosfile_set_stamp() ... #define xosfile_save_stamped(file_name, osfile_type, start, end) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (4) | _IN (5), \ OSFile_SaveStamp, (char *) (file_name), (int) (osfile_type), \ (char *) (start), (char *) (end)) #define xosfile_create_stamp(file_name, file_type, size) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (4) | _IN (5), \ OSFile_CreateStamp, (char *) (file_name), (int) (file_type), \ 0, (int) (size)) #define xosfile_load_path() ... #define xosfile_read_path() ... #define xosfile_load_path_var() ... #define xosfile_read_path_var() ... #define xosfile_load_no_path(file_name, addr, load_addr, exec_addr, size, \ attr) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (3) | _OUT (2) | \ _OUT (3) | _OUT (4) | _OUT (5), OSFile_LoadNoPath, \ (char *) (file_name), (void *) (addr), 0, (int *) (load_addr), \ (int *) (exec_addr), (int *) (size), (int *) (attr)) #define xosfile_read_no_path(file_name, obj_type, load_addr, exec_addr, size, \ attr) \ _swix (OS_File, _IN (0) | _IN (1) | _OUT (0) | _OUT (2) | _OUT (3) | \ _OUT (4) | _OUT (5), OSFile_ReadNoPath, (char *) (file_name), \ (int *) (obj_type), (int *) (load_addr), (int *) (exec_addr), \ (int *) (size), (int *) (attr)) #define xosfile_set_type(file_name, file_type) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2), OSFile_SetType, \ (char *) (file_name), (int) (file_type)) #define xosfile_make_error(file_name, obj_type) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2), OSFile_MakeError, \ (char *) (file_name), (int) (obj_type)) #define xosfile_read_with_type() ... #define xosfile_read_with_type_path() ... #define xosfile_read_with_type_path_var() ... #define xosfile_read_with_type_no_path() ... #define xosfile_read_block_size() ... #endif /* EXECUTE_ON_UNIX */ #endif --- NEW FILE: osfind.h --- #ifndef osfind_H #define osfind_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #ifndef types_H #include "types.h" #endif #ifndef fileswitch_H #include "fileswitch.h" #endif #ifndef os_H #include "os.h" #endif /********************************** * SWI names and SWI reason codes * **********************************/ #define OSFind_Close 0x0 #define OSFind_Openin 0x40 #define OSFind_OpeninPath 0x41 #define OSFind_OpeninPathVar 0x42 #define OSFind_OpeninNoPath 0x43 #define OSFind_Openout 0x80 #define OSFind_OpenoutPath 0x81 #define OSFind_OpenoutPathVar 0x82 #define OSFind_OpenoutNoPath 0x83 #define OSFind_Openup 0xC0 #define OSFind_OpenupPath 0xC1 #define OSFind_OpenupPathVar 0xC2 #define OSFind_OpenupNoPath 0xC3 /******************** * Type definitions * ********************/ typedef bits osfind_flags; /************************ * Constant definitions * ************************/ #define osfind_PATH 0x1u #define osfind_PATH_VAR 0x2u #define osfind_NO_PATH 0x3u #define osfind_ERROR_IF_ABSENT ((bits) 0x8u) #define osfind_ERROR_IF_DIR ((bits) 0x4u) #if defined EXECUTE_ON_UNIX #ifdef __cplusplus extern "C" { #endif /* ----... [truncated message content] |
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/oslib/unix In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/oslib/unix Added Files: Tag: unix-build kernel.c messagetrans.c os.c osargs.c osfile.c osfind.c osgbpb.c osword.c territory.c Log Message: Unix Build --- NEW FILE: kernel.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: messagetrans.c --- /* * OS Lib very limited port */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include "oslib/messagetrans.h" #include "oslib/osfile.h" /* --- types ------------------------------------------------------------- */ typedef struct s__msgtrans { struct s__msgtrans *next; char *token; char *value; } s_msgtrans; /* --- gloabl data ------------------------------------------------------- */ extern os_error oserr; /* ------------------------------------------------------------------------ * Function: messagetrans_file_info() * * Description: Gives information about a message file * * Input: file_name - value of R1 on entry * * Output: flags - value of R0 on exit * size - value of R2 on exit * * Other notes: Calls SWI 0x41500. */ extern os_error *xmessagetrans_file_info (char const *file_name, messagetrans_file_flags *flags, int *size) { os_error *perr = NULL; fileswitch_object_type obj_type; bits load_addr; bits exec_addr; fileswitch_attr attr; bits file_type; if((perr = xosfile_read_stamped( file_name, &obj_type, &load_addr, &exec_addr, size, &attr, &file_type ) )==NULL) { if(obj_type==osfile_NOT_FOUND) { perr = &oserr; oserr.errnum = error_MESSAGE_TRANS_FILE_OPEN; strcpy(oserr.errmess, "Unable to find Messagetrans file"); } else { /* request 1 byte larger to allow 0 termination */ (*size)++; } } if (flags) *flags=messagetrans_DIRECT_ACCESS; return perr; } extern void messagetrans_file_info (char const *file_name, messagetrans_file_flags *flags, int *size) { xmessagetrans_file_info (file_name, flags, size); } /* ------------------------------------------------------------------------ * Function: messagetrans_open_file() * * Description: Opens a message file * * Input: cb - value of R0 on entry * file_name - value of R1 on entry * buffer - value of R2 on entry * * Other notes: Calls SWI 0x41501. */ extern os_error *xmessagetrans_open_file (messagetrans_control_block *cb, char const *file_name, char *buffer) { os_error *perr = NULL; fileswitch_object_type obj_type; bits load_addr; bits exec_addr; int size; fileswitch_attr attr; if((perr = xosfile_load_stamped (file_name, (byte*)buffer, &obj_type, &load_addr, &exec_addr, &size, &attr))==NULL) { if(obj_type==osfile_NOT_FOUND) { perr = &oserr; oserr.errnum = error_MESSAGE_TRANS_FILE_OPEN; strcpy(oserr.errmess, "Unable to read Messagetrans file"); } else { s_msgtrans *m = NULL; s_msgtrans *om = NULL; char *s = buffer; int line = 1; /* * zero terminate buffer - size should be 1 bigger than file * as return from messagetrans_file_info */ buffer[size] = 0; cb->cb[0] = (int)buffer; cb->cb[1] = 0; do { /* skip comment or blank lines */ if(*s=='#' || *s==' ' || *s=='\r' || *s=='\n') { if(*s!='\n') s = strchr(s+1, '\n'); if(s) { s++; line++; if(*s=='\r') s++; } } else { /* make list entry */ if((m = malloc(sizeof(*m)))==NULL) { perr = &oserr; oserr.errnum = error_MESSAGE_TRANS_FILE_OPEN; strcpy(oserr.errmess, "No memory for Messagetrans list"); s = NULL; } else { m->next = NULL; m->token = s; /* find token value seperator */ s = strchr(s, ':'); if(s) { /* terminate token */ *s = 0; /* add to tail, or set head of list */ if(om) om->next = m; else cb->cb[1] = (int)m; om = m; m->value = ++s; if((s=strchr(s, '\n'))!=NULL) { /* terminate value string on NL/LF */ if(*(s-1)=='\r') *(s-1) = 0; *(s++) = 0; } else { /* end of file, so advance s to end */ s = buffer+size; } } else { free(m); } } /* endif if malloc */ } /* endelse '#' '\r' '\n' */ } while(s!=NULL && s<(buffer+size)); /* report and tidy up after invalid file */ if(s==NULL) { perr = &oserr; oserr.errnum = error_MESSAGE_TRANS_SYNTAX; sprintf(oserr.errmess, "Messagetrans syntax error at line %d", line); m = (s_msgtrans*)cb->cb[1]; while(m) { om = m->next; free(m); m = om; } cb->cb[1]=0; } } /* endelse osfile_NOT_FOUND */ } /* endif perr */ return perr; } void messagetrans_open_file (messagetrans_control_block *cb, char const *file_name, char *buffer) { xmessagetrans_open_file (cb, file_name, buffer); } /* ------------------------------------------------------------------------ * Function: messagetrans_lookup() * * Description: Translates a message token into a string * * Input: cb - value of R0 on entry * token - value of R1 on entry * buffer - value of R2 on entry * size - value of R3 on entry * arg0 - value of R4 on entry * arg1 - value of R5 on entry * arg2 - value of R6 on entry * arg3 - value of R7 on entry * * Output: result - value of R2 on exit (X version only) * used - value of R3 on exit * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x41502. */ extern os_error *xmessagetrans_lookup (messagetrans_control_block const *cb, char const *token, char *buffer, int size, char const *arg0, char const *arg1, char const *arg2, char const *arg3, char **result, int *used) { osbool found = FALSE; NOT_USED(buffer); NOT_USED(arg0); NOT_USED(arg1); NOT_USED(arg2); NOT_USED(arg3); if(cb!=NULL && cb->cb[0]!=0 && cb->cb[1]!=0) { /* * #### non zero token termination, wild card and args not supported, * lookup horribly inefficent */ s_msgtrans *m = (s_msgtrans*)cb->cb[1]; while(m && !found) { if(strcmp(m->token, token)==0) { found = TRUE; *result = m->value; if(buffer) { *used = strlen(*result); if((*used) >= size) *used = size-1; strncpy(buffer, m->value, *used); buffer[*used] = 0; } else { *used = 0; } } else { m = m->next; } } } if(!found) { oserr.errnum = error_MESSAGE_TRANS_TOKEN_NOT_FOUND; sprintf(oserr.errmess, "Token '%s' not found", token); return &oserr; } else { return NULL; } } extern char *messagetrans_lookup (messagetrans_control_block const *cb, char const *token, char *buffer, int size, char const *arg0, char const *arg1, char const *arg2, char const *arg3, int *used) { char *result; if(xmessagetrans_lookup (cb, token, buffer, size, arg0, arg1, arg2, arg3, &result, used)) return NULL; else return result; } /* ------------------------------------------------------------------------ * Function: messagetrans_error_lookup() * * Description: Translates a message token within an error block * * Input: error - value of R0 on entry * cb - value of R1 on entry * buffer - value of R2 on entry * size - value of R3 on entry * arg0 - value of R4 on entry * arg1 - value of R5 on entry * arg2 - value of R6 on entry * arg3 - value of R7 on entry * * Other notes: Calls SWI 0x41506. */ /* ------------------------------------------------------------------------ * Function: messagetrans_close_file() * * Description: Closes a message file * * Input: cb - value of R0 on entry * * Other notes: Calls SWI 0x41504. */ extern os_error *xmessagetrans_close_file (messagetrans_control_block const *cb) { s_msgtrans *m = (s_msgtrans*)cb->cb[1]; s_msgtrans *om; while(m) { om = m->next; free(m); m = om; } return NULL; } void messagetrans_close_file (messagetrans_control_block const *cb) { xmessagetrans_close_file(cb); } --- NEW FILE: os.c --- /* * OS Lib very limited port */ #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "oslib/os.h" //#include "support/unix.h" #include <signal.h> #define SIGOSERROR 10 /* --- types ------------------------------------------------------------- */ typedef struct { char *name; int value; } s_table; /* --- gloabl data ------------------------------------------------------- */ os_error oserr; /* --- static data ------------------------------------------------------- */ static s_table swi_names[] = { {"OS_WriteC", 0x0}, {"OS_WriteS", 0x1}, {"OS_Write0", 0x2}, {"OS_NewLine", 0x3}, {"OS_ReadC", 0x4}, {"OS_CLI", 0x5}, {"OS_Byte", 0x6}, {"OS_Word", 0x7}, {"OS_File", 0x8}, {"OS_Args", 0x9}, {"OS_BGet", 0xA}, {"OS_BPut", 0xB}, {"OS_GBPB", 0xC}, {"OS_Find", 0xD}, {"OS_ReadLine", 0xE}, {"OS_Control", 0xF}, {"OS_GetEnv", 0x10}, {"OS_Exit", 0x11}, {"OS_SetEnv", 0x12}, {"OS_IntOn", 0x13}, {"OS_IntOff", 0x14}, {"OS_CallBack", 0x15}, {"OS_EnterOS", 0x16}, {"OS_BreakPt", 0x17}, {"OS_BreakCtrl", 0x18}, {"OS_UnusedSWI", 0x19}, {"OS_UpdateMEMC", 0x1A}, {"OS_SetCallBack", 0x1B}, {"OS_Mouse", 0x1C}, {"OS_Heap", 0x1D}, {"OS_Module", 0x1E}, {"OS_Claim", 0x1F}, {"OS_Release", 0x20}, {"OS_ReadUnsigned", 0x21}, {"OS_GenerateEvent", 0x22}, {"OS_ReadVarVal", 0x23}, {"OS_SetVarVal", 0x24}, {"OS_GSInit", 0x25}, {"OS_GSRead", 0x26}, {"OS_GSTrans", 0x27}, {"OS_BinaryToDecimal", 0x28}, {"OS_FSControl", 0x29}, {"OS_ChangeDynamicArea", 0x2A}, {"OS_GenerateError", 0x2B}, {"OS_ReadEscapeState", 0x2C}, {"OS_EvaluateExpression", 0x2D}, {"OS_SpriteOp", 0x2E}, {"OS_ReadPalette", 0x2F}, {"OS_ServiceCall", 0x30}, {"OS_ReadVduVariables", 0x31}, {"OS_ReadPoint", 0x32}, {"OS_UpCall", 0x33}, {"OS_CallAVector", 0x34}, {"OS_ReadModeVariable", 0x35}, {"OS_RemoveCursors", 0x36}, {"OS_RestoreCursors", 0x37}, {"OS_SWINumberToString", 0x38}, {"OS_SWINumberFromString", 0x39}, {"OS_ValidateAddress", 0x3A}, {"OS_CallAfter", 0x3B}, {"OS_CallEvery", 0x3C}, {"OS_RemoveTickerEvent", 0x3D}, {"OS_InstallKeyHandler", 0x3E}, {"OS_CheckModeValid", 0x3F}, {"OS_ChangeEnvironment", 0x40}, {"OS_ClaimScreenMemory", 0x41}, {"OS_ReadMonotonicTime", 0x42}, {"OS_SubstituteArgs", 0x43}, {"OS_PrettyPrint", 0x44}, {"OS_Plot", 0x45}, {"OS_WriteN", 0x46}, {"OS_AddToVector", 0x47}, {"OS_WriteEnv", 0x48}, {"OS_ReadArgs", 0x49}, {"OS_ReadRAMFsLimits", 0x4A}, {"OS_ClaimDeviceVector", 0x4B}, {"OS_ReleaseDeviceVector", 0x4C}, {"OS_DelinkApplication", 0x4D}, {"OS_RelinkApplication", 0x4E}, {"OS_HeapSort", 0x4F}, {"OS_ExitAndDie", 0x50}, {"OS_ReadMemMapInfo", 0x51}, {"OS_ReadMemMapEntries", 0x52}, {"OS_SetMemMapEntries", 0x53}, {"OS_AddCallBack", 0x54}, {"OS_ReadDefaultHandler", 0x55}, {"OS_SetECFOrigin", 0x56}, {"OS_SerialOp", 0x57}, {"OS_ReadSysInfo", 0x58}, {"OS_Confirm", 0x59}, {"OS_ChangedBox", 0x5A}, {"OS_CRC", 0x5B}, {"OS_ReadDynamicArea", 0x5C}, {"OS_PrintChar", 0x5D}, {"OS_ChangeRedirection", 0x5E}, {"OS_RemoveCallBack", 0x5F}, {"OS_FindMemMapEntries", 0x60}, {"OS_SetColour", 0x61}, {"OS_Pointer", 0x64}, {"OS_ScreenMode", 0x65}, {"OS_DynamicArea", 0x66}, {"OS_Memory", 0x68}, {"OS_ClaimProcessorVector", 0x69}, {"OS_Reset", 0x6A}, {"OS_MMUControl", 0x6B}, {"OS_PlatformFeatures", 0x6D}, {"OS_SynchroniseCodeAreas", 0x6E}, {"OS_CallASWI", 0x6F}, {"OS_AMBControl", 0x70}, {"OS_CallASWIR12", 0x71}, {"OS_EnterUSR32", 0x73}, {"OS_EnterUSR26", 0x74}, {"OS_Hardware", 0x7A}, {"OS_LeaveOS", 0x7C}, {"OS_ReadLine32", 0x7D}, {"OS_SubstituteArgs32", 0x7E}, {"OS_HeapSort32", 0x7F}, {"OS_ConvertStandardDateAndTime", 0xC0}, {"OS_ConvertDateAndTime", 0xC1}, {"OS_ConvertHex1", 0xD0}, {"OS_ConvertHex2", 0xD1}, {"OS_ConvertHex4", 0xD2}, {"OS_ConvertHex6", 0xD3}, {"OS_ConvertHex8", 0xD4}, {"OS_ConvertCardinal1", 0xD5}, {"OS_ConvertCardinal2", 0xD6}, {"OS_ConvertCardinal3", 0xD7}, {"OS_ConvertCardinal4", 0xD8}, {"OS_ConvertInteger1", 0xD9}, {"OS_ConvertInteger2", 0xDA}, {"OS_ConvertInteger3", 0xDB}, {"OS_ConvertInteger4", 0xDC}, {"OS_ConvertBinary1", 0xDD}, {"OS_ConvertBinary2", 0xDE}, {"OS_ConvertBinary3", 0xDF}, {"OS_ConvertBinary4", 0xE0}, {"OS_ConvertSpacedCardinal1", 0xE1}, {"OS_ConvertSpacedCardinal2", 0xE2}, {"OS_ConvertSpacedCardinal3", 0xE3}, {"OS_ConvertSpacedCardinal4", 0xE4}, {"OS_ConvertSpacedInteger1", 0xE5}, {"OS_ConvertSpacedInteger2", 0xE6}, {"OS_ConvertSpacedInteger3", 0xE7}, {"OS_ConvertSpacedInteger4", 0xE8}, {"OS_ConvertFixedNetStation", 0xE9}, {"OS_ConvertNetStation", 0xEA}, {"OS_ConvertFixedFileSize", 0xEB}, {"OS_ConvertFileSize", 0xEC}, {"OS_WriteI", 0x100}, {"Font_CacheAddr", 0x40080}, {"Font_FindFont", 0x40081}, {"Font_LoseFont", 0x40082}, {"Font_ReadDefn", 0x40083}, {"Font_ReadIdentifier", 0x40083}, {"Font_ReadInfo", 0x40084}, {"Font_StringWidth", 0x40085}, {"Font_Paint", 0x40086}, {"Font_Caret", 0x40087}, {"Font_ConverttoOS", 0x40088}, {"Font_Converttopoints", 0x40089}, {"Font_SetFont", 0x4008A}, {"Font_CurrentFont", 0x4008B}, {"Font_FutureFont", 0x4008C}, {"Font_FindCaret", 0x4008D}, {"Font_CharBBox", 0x4008E}, {"Font_ReadScaleFactor", 0x4008F}, {"Font_SetScaleFactor", 0x40090}, {"Font_ListFonts", 0x40091}, {"Font_SetFontColours", 0x40092}, {"Font_SetPalette", 0x40093}, {"Font_SetTruePalette", 0x40093}, {"Font_ReadThresholds", 0x40094}, {"Font_SetThresholds", 0x40095}, {"Font_FindCaretJ", 0x40096}, {"Font_StringBBox", 0x40097}, {"Font_ReadColourTable", 0x40098}, {"Font_MakeBitmap", 0x40099}, {"Font_UnCacheFile", 0x4009A}, {"Font_SetFontMax", 0x4009B}, {"Font_ReadFontMax", 0x4009C}, {"Font_ReadFontPrefix", 0x4009D}, {"Font_SwitchOutputToBuffer", 0x4009E}, {"Font_SwitchOutputToBufferFlags", 0x4009E}, {"Font_ReadFontMetrics", 0x4009F}, {"Font_DecodeMenu", 0x400A0}, {"Font_ScanString", 0x400A1}, {"Font_SetColourTable", 0x400A2}, {"Font_CurrentRGB", 0x400A3}, {"Font_FutureRGB", 0x400A4}, {"Font_ReadEncodingFilename", 0x400A5}, {"Font_FindField", 0x400A6}, {"Font_ApplyFields", 0x400A7}, {"Font_LookupFont", 0x400A8}, {"Wimp_Initialise", 0x400C0}, {"Wimp_CreateWindow", 0x400C1}, {"Wimp_CreateIcon", 0x400C2}, {"Wimp_CreateIconRelative", 0x400C2}, {"Wimp_CreateIconPrioritised", 0x400C2}, {"Wimp_DeleteWindow", 0x400C3}, {"Wimp_DeleteIcon", 0x400C4}, {"Wimp_OpenWindow", 0x400C5}, {"Wimp_OpenWindowNested", 0x400C5}, {"Wimp_OpenWindowNestedWithFlags", 0x400C5}, {"Wimp_CloseWindow", 0x400C6}, {"Wimp_Poll", 0x400C7}, {"Wimp_RedrawWindow", 0x400C8}, {"Wimp_UpdateWindow", 0x400C9}, {"Wimp_GetRectangle", 0x400CA}, {"Wimp_GetWindowState", 0x400CB}, {"Wimp_GetWindowStateAndNesting", 0x400CB}, {"Wimp_GetWindowInfo", 0x400CC}, {"Wimp_GetWindowInfoHeaderOnly", 0x400CC}, {"Wimp_SetIconState", 0x400CD}, {"Wimp_GetIconState", 0x400CE}, {"Wimp_GetPointerInfo", 0x400CF}, {"Wimp_DragBox", 0x400D0}, {"Wimp_DragBoxWithFlags", 0x400D0}, {"Wimp_ForceRedraw", 0x400D1}, {"Wimp_ForceRedrawFurniture", 0x400D1}, {"Wimp_ForceRedrawTitle", 0x400D1}, {"Wimp_SetCaretPosition", 0x400D2}, {"Wimp_GetCaretPosition", 0x400D3}, {"Wimp_CreateMenu", 0x400D4}, {"Wimp_DecodeMenu", 0x400D5}, {"Wimp_WhichIcon", 0x400D6}, {"Wimp_SetExtent", 0x400D7}, {"Wimp_SetPointerShape", 0x400D8}, {"Wimp_OpenTemplate", 0x400D9}, {"Wimp_CloseTemplate", 0x400DA}, {"Wimp_LoadTemplate", 0x400DB}, {"Wimp_ProcessKey", 0x400DC}, {"Wimp_CloseDown", 0x400DD}, {"Wimp_StartTask", 0x400DE}, {"Wimp_ReportError", 0x400DF}, {"Wimp_ReportErrorByCategory", 0x400DF}, {"Wimp_GetWindowOutline", 0x400E0}, {"Wimp_PollIdle", 0x400E1}, {"Wimp_PlotIcon", 0x400E2}, {"Wimp_SetMode", 0x400E3}, {"Wimp_SetPalette", 0x400E4}, {"Wimp_ReadPalette", 0x400E5}, {"Wimp_ReadTruePalette", 0x400E5}, {"Wimp_SetColour", 0x400E6}, {"Wimp_SendMessage", 0x400E7}, {"Wimp_SendMessageToWindow", 0x400E7}, {"Wimp_CreateSubMenu", 0x400E8}, {"Wimp_BaseOfSprites", 0x400EA}, {"Wimp_BlockCopy", 0x400EB}, {"Wimp_SlotSize", 0x400EC}, {"Wimp_ReadPixTrans", 0x400ED}, {"Wimp_ClaimFreeMemory", 0x400EE}, {"Wimp_CommandWindow", 0x400EF}, {"Wimp_TextColour", 0x400F0}, {"Wimp_TransferBlock", 0x400F1}, {"Wimp_SetFontColours", 0x400F3}, {"Wimp_GetMenuState", 0x400F4}, {"Wimp_RegisterFilter", 0x400F5}, {"Wimp_AddMessages", 0x400F6}, {"Wimp_RemoveMessages", 0x400F7}, {"Wimp_SetColourMapping", 0x400F8}, {"Wimp_TextOp", 0x400F9}, {"Wimp_SetWatchdogState", 0x400FA}, {"Wimp_ResizeIcon", 0x400FC}, {"Wimp_AutoScroll", 0x400FD}, {"Sound_Configure", 0x40140}, {"Sound_Enable", 0x40141}, {"Sound_Stereo", 0x40142}, {"Sound_Speaker", 0x40143}, {"Sound_Mode", 0x40144}, {"Sound_LinearHandler", 0x40145}, {"Sound_SampleRate", 0x40146}, {"Sound_Volume", 0x40180}, {"Sound_SoundLog", 0x40181}, {"Sound_LogScale", 0x40182}, {"Sound_InstallVoice", 0x40183}, {"Sound_RemoveVoice", 0x40184}, {"Sound_AttachVoice", 0x40185}, {"Sound_ControlPacked", 0x40186}, {"Sound_Tuning", 0x40187}, {"Sound_Pitch", 0x40188}, {"Sound_Control", 0x40189}, {"Sound_AttachNamedVoice", 0x4018A}, {"Sound_ReadControlBlock", 0x4018B}, {"Sound_WriteControlBlock", 0x4018C}, {"Sound_QInit", 0x401C0}, {"Sound_QSchedule", 0x401C1}, {"Sound_QRemove", 0x401C2}, {"Sound_QFree", 0x401C3}, {"Sound_QSDispatch", 0x401C4}, {"Sound_QTempo", 0x401C5}, {"Sound_QBeat", 0x401C6}, {"Sound_QInterface", 0x401C7}, {"Socket_Creat", 0x41200}, {"Socket_Bind", 0x41201}, {"Socket_Listen", 0x41202}, {"Socket_Accept", 0x41203}, {"Socket_Connect", 0x41204}, {"Socket_Recv", 0x41205}, {"Socket_Recvfrom", 0x41206}, {"Socket_Recvmsg", 0x41207}, {"Socket_Send", 0x41208}, {"Socket_Sendto", 0x41209}, {"Socket_Sendmsg", 0x4120A}, {"Socket_Shutdown", 0x4120B}, {"Socket_Setsockopt", 0x4120C}, {"Socket_Getsockopt", 0x4120D}, {"Socket_Getpeername", 0x4120E}, {"Socket_Getsockname", 0x4120F}, {"Socket_Close", 0x41210}, {"Socket_Select", 0x41211}, {"Socket_Ioctl", 0x41212}, {"Socket_Read", 0x41213}, {"Socket_Write", 0x41214}, {"Socket_Stat", 0x41215}, {"Socket_Readv", 0x41216}, {"Socket_Writev", 0x41217}, {"Socket_Gettsize", 0x41218}, {"Socket_Sendtosm", 0x41219}, {"Socket_Sysctl", 0x4121A}, {"Socket_Accept_1", 0x4121B}, {"Socket_Recvfrom_1", 0x4121C}, {"Socket_Recvmsg_1", 0x4121D}, {"Socket_Sendmsg_1", 0x4121E}, {"Socket_Getpeername_1", 0x4121F}, {"Socket_Getsockname_1", 0x41220}, {"Socket_InternalLookup", 0x41221}, {"Socket_Version", 0x41222}, {"MessageTrans_FileInfo", 0x41500}, {"MessageTrans_OpenFile", 0x41501}, {"MessageTrans_Lookup", 0x41502}, {"MessageTrans_MakeMenus", 0x41503}, {"MessageTrans_CloseFile", 0x41504}, {"MessageTrans_EnumerateTokens", 0x41505}, {"MessageTrans_ErrorLookup", 0x41506}, {"MessageTrans_GSLookup", 0x41507}, {"MessageTrans_CopyError", 0x41508}, {"MessageTrans_Dictionary", 0x41509}, {"ResourceFS_RegisterFiles", 0x41B40}, {"ResourceFS_DeregisterFiles", 0x41B41}, {"Filter_RegisterPreFilter", 0x42640}, {"Filter_RegisterPostFilter", 0x42641}, {"Filter_DeRegisterPreFilter", 0x42642}, {"Filter_DeRegisterPostFilter", 0x42643}, {"Filter_RegisterRectFilter", 0x42644}, {"Filter_DeRegisterRectFilter", 0x42645}, {"Filter_RegisterCopyFilter", 0x42646}, {"Filter_DeRegisterCopyFilter", 0x42647}, {"Filter_RegisterPostRectFilter", 0x42648}, {"Filter_DeRegisterPostRectFilter", 0x42649}, {"Filter_RegisterPostIconFilter", 0x4264A}, {"Filter_DeRegisterPostIconFilter", 0x4264B}, {"SharedCLibrary_LibInitAPCS_A", 0x80680}, {"SharedCLibrary_LibInitAPCS_R", 0x80681}, {"SharedCLibrary_LibInitModule", 0x80682}, {"SharedCLibrary_LibInitAPCS_32", 0x80683}, {"SharedCLibrary_LibInitModule32", 0x80684}, {NULL, 0} }; #if 0 /* in kernel.c */ static os_error const *last_error; const os_error *_kernel_last_oserror(void) { if (errno == 0) { last_error = NULL; } else { last_error = riscos_error_lookup(0, strerror(errno)); } return last_error; } #endif /* ------------------------------------------------------------------------ * Function: os_generate_error() * * Description: Generates an error and invokes the error handler * * Input: error - value of R0 on entry * * Other notes: Calls SWI 0x2B. */ void os_generate_error(os_error const *e) { last_error = (_kernel_oserror *)e; raise(SIGOSERROR); } /* ------------------------------------------------------------------------ * Function: os_cli() * * Description: Processes a supervisor command * * Input: command - value of R0 on entry * * Other notes: Calls SWI 0x5. */ extern os_error *xos_cli (char const *command) { NOT_USED(command); return NULL; } void os_cli (char const *command) { NOT_USED(command); } /* ------------------------------------------------------------------------ * Function: os_swi_number_to_string() * * Description: Converts a SWI number to a string containing its name * * Input: swi - value of R0 on entry * buffer - value of R1 on entry * size - value of R2 on entry * * Output: used - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x38. */ os_error *xos_swi_number_to_string (int swi, char *buffer, int size, int *used_) { int index = -1; int nox_swi = swi & ~(1<<17); int used = 0; if( buffer ) { do { index++; } while(swi_names[index].value<nox_swi && swi_names[index].name!=NULL); if(swi_names[index].value==nox_swi) used = size - sprintf(buffer, swi & (1<<17) ? "X%s" : "%s", swi_names[index].name); else used = size - sprintf(buffer, swi & (1<<17) ? "XUser" : "User"); } if (used_) *used_=used; return NULL; } int os_swi_number_to_string (int swi, char *buffer, int size) { int used; xos_swi_number_to_string (swi, buffer, size, &used); return used; } /* ------------------------------------------------------------------------ * Function: os_swi_number_from_string() * * Description: Converts a string to a SWI number if valid * * Input: swi_name - value of R1 on entry * * Output: swi - value of R0 on exit (X version only) * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x39. */ extern os_error *xos_swi_number_from_string (char const *swi_name, int *swi) { int index = -1; osbool x = swi_name[0]=='X'; const char *nonx_name = swi_name + (x ? 1:0); do { index++; } while(swi_names[index].name!=NULL && strcmp(nonx_name, swi_names[index].name)!=0); if(swi_names[index].name==NULL) { if (swi) *swi = 0xFFFFFFFF; oserr.errnum = 0x1E6; strcpy(oserr.errmess, "Unknown SWI"); return &oserr; } else { if (swi) *swi = swi_names[index].value + (x ? (1<<17) : 0); return NULL; } } extern int os_swi_number_from_string (char const *swi_name) { int swi; xos_swi_number_from_string (swi_name, &swi); return swi; } /* ------------------------------------------------------------------------ * Function: os_writen() * * Description: Writes a counted string to all of the active output * streams * * Input: s - value of R0 on entry * size - value of R1 on entry * * Other notes: Calls SWI 0x46. */ extern os_error *xos_writen (char const *s, int size) { char *temp = malloc( size + 1); if (temp) { strncpy( temp, s, size ); *(temp + size) = '\0'; fprintf( stderr, "%s\n", temp ); free( temp ); } return NULL; } extern void os_writen (char const *s, int size) { xos_writen( s, size ); } /* ------------------------------------------------------------------------ * Function: os_pretty_print() * * Description: Writes a string with some formatting to all of the active * output streams * * Input: string - value of R0 on entry * dictionary - value of R1 on entry * special - value of R2 on entry * * Other notes: Calls SWI 0x44. */ os_error *xos_pretty_print(char const *string, byte const *arg1, char const *arg2) { for (;;) { char *s = strchr(string, '\r'); if (!s) { puts(string); return NULL; } fwrite(string, s - string, 1, stdout); putc('\n', stdout); string = s + 1; } } void os_pretty_print(char const *string, byte const *arg1, char const *arg2) { xos_pretty_print( string, arg1, arg2 ); } --- NEW FILE: osargs.c --- /* * OS Lib very limited port */ #include <stdio.h> #include "oslib/osargs.h" /* ------------------------------------------------------------------------ * Function: osargs_set_ptrw() * * Description: Writes an open file's sequential file pointer * * Input: file - value of R1 on entry * ptr - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x1. */ extern os_error *xosargs_set_ptrw (os_fw file, int ptr) { fseek((FILE*)file, ptr, SEEK_SET); return NULL; } extern void osargs_set_ptrw (os_fw file, int ptr) { xosargs_set_ptrw(file, ptr); } /* ------------------------------------------------------------------------ * Function: osargs_read_extw() * * Description: Reads an open file's extent * * Input: file - value of R1 on entry * * Output: ext - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x2. */ extern os_error *xosargs_read_extw (os_fw file, int *ext) { fseek((FILE*)file, 0, SEEK_END); if (ext) *ext = ftell((FILE*)file); return NULL; } extern int osargs_read_extw (os_fw file) { int ext; xosargs_read_extw(file, &ext); return ext; } /* ------------------------------------------------------------------------ * Function: osargs_read_eof_statusw() * * Description: Reads an open file's end-of-file (EOF) status * * Input: file - value of R1 on entry * * Output: eof_status - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x5. */ extern os_error *xosargs_read_eof_statusw (os_fw file, osbool *eof_status) { if (eof_status) *eof_status = feof((FILE*)file); return NULL; } extern osbool osargs_read_eof_statusw (os_fw file) { osbool eof_status; xosargs_read_eof_statusw(file, &eof_status); return eof_status; } /* ------------------------------------------------------------------------ * Function: osargs_ensurew() * * Description: Ensures data has been written to a file, or to all files * on the temporary filing system. Uses 32-bit file handle. * * Input: file - value of R1 on entry * * Other notes: Calls SWI 0x9 with R0 = 0xFF. */ extern os_error *xosargs_ensurew (os_fw file) { fflush( (FILE*)file ); return NULL; } extern void osargs_ensurew (os_fw file) { xosargs_ensurew( file ); } --- NEW FILE: osfile.c --- /* * OS Lib very limited port */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <errno.h> #if defined(WIN32) && !defined(_WIN32_WCE) # include "direct.h" # define mkdir _mkdir #elif defined (UNIX) # include <sys/stat.h> /* for mkdir */ #endif #include "oslib/osfile.h" extern const char *uname(const char *file_name, bits load_addr, bits exec_addr); /* --- gloabl data ------------------------------------------------------- */ extern os_error oserr; /* ------------------------------------------------------------------------ * Function: osfile_set_type() * * Description: Writes the file type for an object * * Input: file_name - value of R1 on entry * file_type - value of R2 on entry * * Other notes: Calls SWI 0x8 with R0 = 0x12. */ extern os_error *xosfile_set_type (char const *file_name, bits file_type) { /* do nothing */ return NULL; } extern void osfile_set_type (char const *file_name, bits file_type) { xosfile_set_type (file_name, file_type); } /* ------------------------------------------------------------------------ * Function: osfile_create_dir() * * Description: Creates a directory * * Input: dir_name - value of R1 on entry * entry_count - value of R4 on entry * * Other notes: Calls SWI 0x8 with R0 = 0x8. */ extern os_error *xosfile_create_dir (char const *dir_name, int entry_count) { NOT_USED(entry_count); #if defined (UNIX) if ( mkdir( uname(dir_name,0,0), S_IRUSR | S_IWUSR | S_IXUSR | S_IROTH | S_IWOTH | S_IXOTH ) !=0 && errno!=17 ) #else if(mkdir(uname(dir_name,0,0))!=0 && errno!=17) #endif { oserr.errnum = 0x10001; sprintf(oserr.errmess, "Mkdir error %d", errno); return &oserr; } return NULL; } extern void osfile_create_dir (char const *dir_name, int entry_count) { xosfile_create_dir (dir_name, entry_count); } /* ------------------------------------------------------------------------ * Function: osfile_create() * * Description: Creates an empty untyped file - prefer * OSFile_CreateStamped * * Input: file_name - value of R1 on entry * load_addr - value of R2 on entry * exec_addr - value of R3 on entry * size - value of R5 on entry * * Other notes: Calls SWI 0x8 with R0 = 0x7, R4 = 0x0. */ extern os_error *xosfile_create (char const *file_name, bits load_addr, bits exec_addr, int size) { /* dont use load & exec or open file wont find it */ FILE *f = fopen(uname(file_name, 0, 0), "w"); if(f==NULL) { oserr.errnum=0x10001; strcpy(oserr.errmess, "Unable to create file"); return &oserr; } fseek(f, size-1, SEEK_SET); fputc(0, f); fclose(f); return NULL; } extern void osfile_create (char const *file_name, bits load_addr, bits exec_addr, int size) { xosfile_create (file_name, load_addr, exec_addr, size); } /* ------------------------------------------------------------------------ * Function: osfile_read_stamped() * * Description: Reads catalogue information and file type for an object * using the directory list in File$Path * * Input: file_name - value of R1 on entry * * Output: obj_type - value of R0 on exit (X version only) * load_addr - value of R2 on exit * exec_addr - value of R3 on exit * size - value of R4 on exit * attr - value of R5 on exit * file_type - value of R6 on exit * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x8 with R0 = 0x14. */ os_error *xosfile_read_stamped (char const *file_name, fileswitch_object_type *obj_type, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr, bits *file_type) { FILE *f = fopen(uname(file_name,0,0), "rb"); char *s = strrchr(file_name, ','); NOT_USED(attr); if(f==NULL) { if (obj_type) *obj_type = osfile_NOT_FOUND; return(NULL); } fseek(f, 0, SEEK_END); if (size) *size = ftell(f); fclose(f); if (obj_type) *obj_type = osfile_IS_FILE; if (file_type) *file_type = osfile_TYPE_UNTYPED; if(s!=NULL) { sscanf(s, ",%x", file_type); if(*file_type==osfile_TYPE_ABSOLUTE) { if (load_addr) *load_addr = 0x8000; if (exec_addr) *exec_addr = 0x8000; } else if(*file_type==0xfd3) { if (load_addr) *load_addr = 0x8000; if (exec_addr) *exec_addr = 0x8000; } else { if (load_addr) *load_addr = 0; if (exec_addr) *exec_addr = 0; } } return NULL; } fileswitch_object_type osfile_read_stamped (char const *file_name, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr, bits *file_type) { fileswitch_object_type obj_type; xosfile_read_stamped (file_name, &obj_type, load_addr, exec_addr, size, attr, file_type); return obj_type; } /* ------------------------------------------------------------------------ * Function: osfile_load_stamped() * * Description: Loads a file using the directory list in File$Path * * Input: file_name - value of R1 on entry * addr - value of R2 on entry * * Output: obj_type - value of R0 on exit (X version only) * load_addr - value of R2 on exit * exec_addr - value of R3 on exit * size - value of R4 on exit * attr - value of R5 on exit * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x8 with R0 = 0xFF, R3 = 0x0. */ os_error *xosfile_load_stamped (char const *file_name, byte *addr, fileswitch_object_type *obj_type, bits *load_addr, bits *exec_addr, int *size_, fileswitch_attr *attr) { FILE *f = fopen(uname(file_name,0,0), "rb"); os_error *perr = NULL; size_t size; NOT_USED(attr); NOT_USED(load_addr); NOT_USED(exec_addr); #if 0 /* no output after error */ if (obj_type) *obj_type = osfile_IS_FILE; #endif if(f==NULL) { #if 0 /* no output after error */ if (obj_type) *obj_type = osfile_NOT_FOUND; #endif oserr.errnum = 1; strcpy(oserr.errmess, "Unable to open file"); return(&oserr); } fseek(f, 0, SEEK_END); size = ftell(f); fseek(f, 0, SEEK_SET); if(fread(addr, (size_t)size, 1, f)!=1) { #if 0 /* no output after error */ *obj_type = osfile_NOT_FOUND; #endif perr = &oserr; oserr.errnum = 2; strcpy(oserr.errmess, "Unable to read file"); } fclose(f); if (obj_type) *obj_type = osfile_IS_FILE; if (size_) *size_ = size; return perr; } fileswitch_object_type osfile_load_stamped (char const *file_name, byte *addr, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr) { fileswitch_object_type obj_type; os_error *perr = xosfile_load_stamped(file_name, addr, &obj_type, load_addr, exec_addr, size, attr); if(perr) fprintf(stderr, "%s\r\n", perr->errmess); return obj_type; } #if 0 /* ------------------------------------------------------------------------ * Function: osfile_load_stamped_path() * * Description: Calls OS_File 12 to load a file using a specified * directory list * * Input: file_name - value of R1 on entry * addr - value of R2 on entry * path - value of R4 on entry * * Output: obj_type - value of R0 on exit (X version only) * load_addr - value of R2 on exit * exec_addr - value of R3 on exit * size - value of R4 on exit * attr - value of R5 on exit * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x8 with R0 = 0xC, R3 = 0x0. */ extern os_error *xosfile_load_stamped_path (char const *file_name, byte *addr, char const *path, fileswitch_object_type *obj_type, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr); extern fileswitch_object_type osfile_load_stamped_path (char const *file_name, byte *addr, char const *path, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr); /* ------------------------------------------------------------------------ * Function: osfile_load_stamped_path_var() * * Description: Calls OS_File 14 to load a file using the directory list * in a specified variable * * Input: file_name - value of R1 on entry * addr - value of R2 on entry * var - value of R4 on entry * * Output: obj_type - value of R0 on exit (X version only) * load_addr - value of R2 on exit * exec_addr - value of R3 on exit * size - value of R4 on exit * attr - value of R5 on exit * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x8 with R0 = 0xE, R3 = 0x0. */ extern os_error *xosfile_load_stamped_path_var (char const *file_name, byte *addr, char const *var, fileswitch_object_type *obj_type, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr); extern fileswitch_object_type osfile_load_stamped_path_var (char const *file_name, byte *addr, char const *var, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr); #endif /* ------------------------------------------------------------------------ * Function: osfile_load_stamped_no_path() * * Description: Calls OS_File 16 to load a file * * Input: file_name - value of R1 on entry * addr - value of R2 on entry * * Output: obj_type - value of R0 on exit (X version only) * load_addr - value of R2 on exit * exec_addr - value of R3 on exit * size - value of R4 on exit * attr - value of R5 on exit * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x8 with R0 = 0x10, R3 = 0x0. */ extern os_error *xosfile_load_stamped_no_path (char const *file_name, byte *addr, fileswitch_object_type *obj_type, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr) { return xosfile_load_stamped( file_name, addr, obj_type, load_addr, exec_addr, size, attr ); } extern fileswitch_object_type osfile_load_stamped_no_path (char const *file_name, byte *addr, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr) { return osfile_load_stamped( file_name, addr, load_addr, exec_addr, size, attr ); } /* ------------------------------------------------------------------------ * Function: osfile_delete() * * Description: Calls OS_File 6 to delete an object * * Input: file_name - value of R1 on entry * * Output: obj_type - value of R0 on exit (X version only) * load_addr - value of R2 on exit * exec_addr - value of R3 on exit * size - value of R4 on exit * attr - value of R5 on exit * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x8 with R0 = 0x6. */ extern os_error *xosfile_delete (char const *file_name, fileswitch_object_type *obj_type_, bits *load_addr_, bits *exec_addr_, int *size_, fileswitch_attr *attr_) { fileswitch_object_type obj_type; bits load_addr; bits exec_addr; int size; fileswitch_attr attr; os_error *err = xosfile_read_stamped( file_name, &obj_type, &load_addr, &exec_addr, &size, &attr, 0 ); if (!err) { if ( remove( file_name ) != 0 ) { // failed oserr.errnum = 1; sprintf( oserr.errmess, "%s", strerror(errno) ); err = &oserr; } else { if (obj_type_) *obj_type_ = obj_type; if (load_addr_) *load_addr_ = load_addr; if (exec_addr_) *exec_addr_ = exec_addr; if (size_) *size_ = size; if (attr_) *attr_ = attr; } } return err; } extern fileswitch_object_type osfile_delete (char const *file_name, bits *load_addr, bits *exec_addr, int *size, fileswitch_attr *attr) { fileswitch_object_type type; xosfile_delete( file_name, &type, load_addr, exec_addr, size, attr ); return type; } /* ------------------------------------------------------------------------ * Function: osfile_save() * * Description: Saves a block of memory as an untyped file - prefer * OSFile_SaveStamped * * Input: file_name - value of R1 on entry * load_addr - value of R2 on entry * exec_addr - value of R3 on entry * data - value of R4 on entry * end - value of R5 on entry * * Other notes: Calls SWI 0x8 with R0 = 0x0. */ extern os_error *xosfile_save (char const *file_name, bits load_addr, bits exec_addr, byte const *data, byte const *end) { FILE *f = fopen(uname(file_name,load_addr,exec_addr), "w"); if(f==NULL) { oserr.errnum=0x10001; strcpy(oserr.errmess, "Unable to save file"); return &oserr; } fwrite(data, (end-data), 1, f); fclose(f); return NULL; } extern void osfile_save (char const *file_name, bits load_addr, bits exec_addr, byte const *data, byte const *end) { xosfile_save (file_name, load_addr, exec_addr, data, end); } --- NEW FILE: osfind.c --- /* * OS Lib very limited port */ #include <stdio.h> #include <string.h> #include <ctype.h> #include "oslib/osfind.h" /* --- gloabl functoin --------------------------------------------------- */ /* * Function: uname * * Input: file_name - modified on exit * load_addr * exec_addr * * Output: static output buffer * * Description: Detects and converts a RISC OS filename to UNIX equivelent * Adds NFS style filetype extension from load & exec addresses * * Other notes: NOTE extremely primative implementation */ const char *uname(const char *file_name, bits load_addr, bits exec_addr) { static char buffer[1024]; char *s = strchr(file_name, '$'); char *d = buffer; if(!s) return file_name; while(*s) { switch(*s) { case '$': /* ignore */ break; case '.': *(d++) = '/'; break; case '/': *(d++) = '.'; break; case '^': *(d++) = '.'; *(d++) = '.'; break; default: *(d++) = *s; break; } s++; } *d = 0; NOT_USED(exec_addr) if((load_addr&0xFFF00000)==0xFFF00000) sprintf(d, ",%03X", (load_addr>>8) & 0xFFF); return buffer; } /* ------------------------------------------------------------------------ * Function: osfind_openinw() * * Description: Opens an existing file with read access only * * Input: flags - value of R0 on entry * file_name - value of R1 on entry * path - value of R2 on entry * * Output: file - value of R0 on exit (X version only) * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0xD with R0 |= 0x40. */ os_error *xosfind_openinw (osfind_flags flags, char const *file_name, char const *path, os_fw *file_) { os_fw file; NOT_USED(flags); NOT_USED(path); file = (os_fw)fopen(uname(file_name,0,0), "rb"); if (file_) *file_ = file; return NULL; } os_fw osfind_openinw (osfind_flags flags, char const *file_name, char const *path) { os_fw file; xosfind_openinw(flags, file_name, path, &file); return file; } /* ------------------------------------------------------------------------ * Function: osfind_openoutw() * * Description: Creates a new file with read/write access * * Input: flags - value of R0 on entry * file_name - value of R1 on entry * path - value of R2 on entry * * Output: file - value of R0 on exit (X version only) * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0xD with R0 |= 0x80. */ extern os_error *xosfind_openoutw (osfind_flags flags, char const *file_name, char const *path, os_fw *file_) { os_fw file; NOT_USED(flags); NOT_USED(path); file = (os_fw)fopen(uname(file_name,0,0), "w+b"); if (file_) *file_ = file; return NULL; } extern os_fw osfind_openoutw (osfind_flags flags, char const *file_name, char const *path) { os_fw file; xosfind_openoutw(flags, file_name, path, &file); return file; } /* ------------------------------------------------------------------------ * Function: osfind_openupw() * * Description: Opens an existing file with read/write access * * Input: flags - value of R0 on entry * file_name - value of R1 on entry * path - value of R2 on entry * * Output: file - value of R0 on exit (X version only) * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0xD with R0 |= 0xC0. */ extern os_error *xosfind_openupw (osfind_flags flags, char const *file_name, char const *path, os_fw *file_) { os_fw file; NOT_USED(flags); NOT_USED(path); file = (os_fw)fopen(uname(file_name,0,0), "r+b"); if (file_) *file_ = file; return NULL; } extern os_fw osfind_openupw (osfind_flags flags, char const *file_name, char const *path) { os_fw file; xosfind_openupw(flags, file_name, path, &file); return file; } /* ------------------------------------------------------------------------ * Function: osfind_closew() * * Description: Closes a file or files * * Input: file - value of R1 on entry * * Other notes: Calls SWI 0xD with R0 = 0x0. */ os_error *xosfind_closew (os_fw file) { fclose((FILE*)file); return NULL; } void osfind_closew (os_fw file) { xosfind_closew (file); } --- NEW FILE: osgbpb.c --- /* osgbpb.c * * OS Lib very limited port */ #include <ctype.h> #include <dirent.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "oslib/osfile.h" #include "oslib/osgbpb.h" extern os_error oserr; /* ------------------------------------------------------------------------ * Function: wild_strcoll() * * Description: Performs strcoll using RISC OS wildcards * * Input: s1 - pointer to search string * s2 - pointer to (wildcarded) reference string * * Output: * * Returns: zero if s1 == s2 * * Other notes: This implementation takes no account of the current locale */ static int wild_strcoll( const char *s1, const char* s2 ) { int stat = 0; if( s1 == 0 && s2 == 0 ) stat = 0; else if ( s1 == 0 && s2 != 0 ) stat = -1; else if ( s1 != 0 && s2 == 0 ) stat = 1; else { do { if( *s2 == '#' ) stat = 0; else if ( *s2 == '*' ) stat = wild_strcoll( strchr( s1, *(s2+1) ), s2+1 ); else stat = *s1 - *s2; } while ( (!stat) && (*++s1 != '\0') && (*++s2 != '\0') ); } return stat; } /* ------------------------------------------------------------------------ * Function: osgbpb_readw() * * Description: Reads bytes from an open file * * Input: file - value of R1 on entry * buffer - value of R2 on entry * size - value of R3 on entry * * Output: unread - value of R3 on exit (X version only) * * Returns: R3 (non-X version only) * * Other notes: Calls SWI 0xC with R0 = 0x4. */ os_error *xosgbpb_readw (os_fw file, byte *buffer, int size, int *unread_) { int unread = size; if (buffer) unread = size - fread(buffer, 1, size, (FILE*)file); if (unread_) *unread_ = unread; return NULL; /* should check for error */ } int osgbpb_readw (os_fw file, byte *buffer, int size) { int unread; xosgbpb_readw(file, buffer, size, &unread); return unread; } /* ------------------------------------------------------------------------ * Function: osgbpb_read_atw() * * Description: Reads bytes from an open file at the specified file * pointer * * Input: file - value of R1 on entry * buffer - value of R2 on entry * size - value of R3 on entry * ptr - value of R4 on entry * * Output: unread - value of R3 on exit (X version only) * * Returns: R3 (non-X version only) * * Other notes: Calls SWI 0xC with R0 = 0x3. */ os_error *xosgbpb_read_atw (os_fw file, byte *buffer, int size, int ptr, int *unread) { fseek((FILE*)file, ptr, SEEK_SET); return xosgbpb_readw(file, buffer, size, unread); } int osgbpb_read_atw (os_fw file, byte *buffer, int size, int ptr) { int unread; xosgbpb_read_atw(file, buffer, size, ptr, &unread); return unread; } /* ------------------------------------------------------------------------ * Function: osgbpb_writew() * * Description: Writes bytes to an open file * * Input: file - value of R1 on entry * data - value of R2 on entry * size - value of R3 on entry * * Output: unwritten - value of R3 on exit (X version only) * * Returns: R3 (non-X version only) * * Other notes: Calls SWI 0xC with R0 = 0x2. */ extern os_error *xosgbpb_writew (os_fw file, byte const *data, int size, int *unwritten_) { int unwritten = size; unwritten = size - fwrite(data, 1, size, (FILE*)file); if (unwritten_) *unwritten_ = unwritten; return NULL; } extern int osgbpb_writew (os_fw file, byte const *data, int size) { int unwritten; xosgbpb_writew(file, data, size, &unwritten); return unwritten; } /* ------------------------------------------------------------------------ * Function: osgbpb_write_atw() * * Description: Writes bytes to an open file at the specified file * pointer * * Input: file - value of R1 on entry * data - value of R2 on entry * size - value of R3 on entry * ptr - value of R4 on entry * * Output: unwritten - value of R3 on exit (X version only) * * Returns: R3 (non-X version only) * * Other notes: Calls SWI 0xC with R0 = 0x1. */ extern os_error *xosgbpb_write_atw (os_fw file, byte const *data, int size, int ptr, int *unwritten) { fseek((FILE*)file, ptr, SEEK_SET); return xosgbpb_writew(file, data, size, unwritten); } extern int osgbpb_write_atw (os_fw file, byte const *data, int size, int ptr) { int unwritten; xosgbpb_write_atw(file, data, size, ptr, &unwritten); return unwritten; } /* ------------------------------------------------------------------------ * Function: osgbpb_dir_entries_info() * * Description: Reads entries and file information from a specified * directory * * Input: dir_name - value of R1 on entry * info_list - value of R2 on entry * count - value of R3 on entry * context - value of R4 on entry * size - valu... [truncated message content] |
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/support Added Files: Tag: unix-build callback.c callback.h hostfs.h lookup.c lookup.h m.c m.h realloc.c realloc.h resource.c resource.h riscos.c riscos.h riscosa.s trace.c trace.h unix.c unix.h x.c x.h Log Message: Unix Build --- NEW FILE: callback.c --- /*callback.c - dynamically extensible multi-way, multi-level switch facility*/ /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ /* First implementation: hold callbacks in a tree structure reflecting their structure. Note: since all callbacks are called back with non-null |unclaimed| pointer, and this is initialised to TRUE, you never need to assign TRUE to |unclaimed|. You can assign FALSE to it without checking for nullness, too. */ /*From CLib*/ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> /*From OSLib*/ #include "oslib/types.h" /*From Support*/ #include "callback.h" #include "m.h" #include "riscos.h" #include "trace.h" #ifdef TRACE /*#define XTRACE*/ #endif /* Useful types needed by |callback_| Type Fn == (the type of a callback function); Type SH == (the type of the static handle); Type DH == (the type of the dynamic handle) Type Level == List [Fn × SH] × List [Int × Level]; implemented in C via Type Function == List [Fn × SH]; Type Entry == List [Int × Level]; (where List [T] == Opt [T × List [T]]) */ struct callback_l {struct Level *root;}; typedef struct Function { callback_fn *fn; void *sh; struct Function *next; } *Function; typedef struct Entry { int key; struct Level *level; struct Entry *next; } *Entry; typedef struct Level { struct Function *fns; struct Entry *list; } *Level; #if TRACE /*------------------------------------------------------------------------*/ /*The name of a function.*/ static char *Function_Name ( callback_fn *fn ) { char *name = (char *) fn - 4; static char Fn [80 + 1]; if (name [3] == 0xFF) riscos_strncpy (Fn, name - *name, 80); else sprintf (Fn, "(unnamed at 0x%X)" _ (unsigned) fn); return Fn; } #endif /*------------------------------------------------------------------------*/ os_error *callback_new ( callback_l *l_out ) { callback_l l; os_error *error = NULL; tracef ("callback_new\n"); if ((l = m_ALLOC (sizeof *l)) == NULL) { error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem"); goto finish; } l->root = NULL; if (l_out != NULL) *l_out = l; finish: return error; } /*------------------------------------------------------------------------*/ static void Delete_Function ( Function f ) { if (f != NULL) { #ifdef XTRACE tracef ("Delete_Function\n"); #endif Delete_Function (f->next); m_FREE (f, sizeof *f); } } /*------------------------------------------------------------------------*/ static void Delete_Level (Level); /*------------------------------------------------------------------------*/ void Delete_Entry ( Entry e ) { if (e != NULL) { #ifdef XTRACE tracef ("Delete_Entry\n"); #endif Delete_Level (e->level); Delete_Entry (e->next); m_FREE (e, sizeof *e); } } /*------------------------------------------------------------------------*/ void Delete_Level ( Level level ) { if (level != NULL) { #ifdef XTRACE tracef ("Delete_Level\n"); #endif Delete_Function (level->fns); Delete_Entry (level->list); m_FREE (level, sizeof *level); } } /*------------------------------------------------------------------------*/ os_error *callback_delete ( callback_l l ) { tracef ("callback_delete\n"); if (l != NULL) { Delete_Level (l->root); m_FREE (l, sizeof *l); } return NULL; } /*------------------------------------------------------------------------*/ static os_error *Callback ( void *dh, Level level, osbool *unclaimed, int limit, int *k ) { Function f; osbool u = TRUE; os_error *error = NULL; #ifdef XTRACE { int i; tracef ("Callback: dh 0x%X, level 0x%X, limit %d, key {" _ dh _ level _ limit); for (i = 0; i < limit; i++) trace_f (NULL _ 0 _ "%s%d" _ i == 0? "": ", " _ k [i]); trace_f (NULL _ 0 _ "} ...\n"); } #endif if (level != NULL) { if (limit > 0) { /*Try to match this key.*/ Entry e; /*It's important that we process the deepest ones first, as they are the most specialised for their purpose (all in a highly abstract sense ...).*/ for (e = level->list; e != NULL; e = e->next) if (e->key == *k) { if ((error = Callback (dh, e->level, &u, limit - 1, k + 1)) != NULL) goto finish; if (!u) break; } } if (u) /*Reached the end of the line - call all the functions until one handles the keys.*/ for (f = level->fns; f != NULL; f = f->next) { tracef ("callback %s (0x%X, 0x%X, 0x%X)\n" _ Function_Name (f->fn) _ f->sh _ dh _ &u); if ((error = (*f->fn) (f->sh, dh, &u)) != NULL) goto finish; tracef ("callback %s\n" _ u? "unclaimed": "claimed"); if (!u) break; } } if (!u) *unclaimed = FALSE; finish: return error; } /*------------------------------------------------------------------------*/ os_error *callback ( callback_l l, void *dh, osbool *unclaimed, int limit, ... ) { /*Makes the non-portable assumption that the arguments after |limit| are on the stack in order of increasing address.*/ osbool u = TRUE; os_error *error = NULL; tracef ("callback ...\n"); if ((error = Callback (dh, l->root, &u, limit, &limit + 1)) != NULL) goto finish; if (unclaimed != NULL) *unclaimed = u; finish: return error; } /*------------------------------------------------------------------------*/ os_error *callback_register ( callback_l l, callback_fn *fn, void *sh, int limit, ... ) { /*Makes the non-portable assumption that the arguments after |limit| are on the stack in order of increasing address.*/ Level *level; int i, *k = &limit + 1; os_error *error = NULL; tracef ("callback_register\n"); /*Descend the hierarchy, creating new |Level|'s if necessary.*/ level = &l->root; for (i = 0; i < limit; i++) { Entry e; osbool found = FALSE; if (*level == NULL) { /*Need a new one for this level. First create the new |Level|.*/ Level t; if ((t = m_ALLOC (sizeof *t)) == NULL) { error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem"); goto finish; } t->fns = NULL; t->list = NULL; *level = t; } /*Now look along the current level for the given key. This won't take long if the level was just created.*/ for (e = (*level)->list; e != NULL; e = e->next) if (e->key == k [i]) { found = TRUE; break; } if (!found) { /*Must create a new entry for this key.*/ if ((e = m_ALLOC (sizeof *e)) == NULL) { error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem"); goto finish; } e->key = k [i]; e->level = NULL; e->next = (*level)->list; (*level)->list = e; } level = &e->level; } if (*level == NULL) { /*Need a new one here too.*/ Level t; if ((t = m_ALLOC (sizeof *t)) == NULL) { error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem"); goto finish; } t->fns = NULL; t->list = NULL; *level = t; } /*Append the new function to the function list for |level|.*/ #if 1 /*this adds it at the end*/ { Function *f; for (f = &(*level)->fns; *f != NULL; f = &(*f)->next) ; if ((*f = m_ALLOC (sizeof **f)) == NULL) { error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem"); goto finish; } (*f)->fn = fn; (*f)->sh = sh; (*f)->next = NULL; } #else /*this adds it at the beginning*/ { Function f; if ((f = m_ALLOC (sizeof *f)) == NULL) { error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem"); goto finish; } f->fn = fn; f->sh = sh; f->next = (*level)->fns; (*level)->fns = f; } #endif finish: return error; } /*------------------------------------------------------------------------*/ static void Deregister_Level (Level *l, void *sh), Deregister_Entry (Entry *e, void *sh); /*------------------------------------------------------------------------*/ static void Deregister_Function ( Function *ff, void *sh ) { Function f = *ff; if (f != NULL) { #ifdef XTRACE tracef ("Deregister_Function\n"); #endif Deregister_Function (&f->next, sh); if (f->sh == sh) { *ff = f->next; m_FREE (f, sizeof *f); } } } /*------------------------------------------------------------------------*/ void Deregister_Entry (Entry *ee, void *sh) { Entry e = *ee; if (e != NULL) { #ifdef XTRACE tracef ("Deregister_Entry\n"); #endif Deregister_Level (&e->level, sh); Deregister_Entry (&e->next, sh); if (e->level == NULL) { *ee = e->next; m_FREE (e, sizeof *e); } } } /*------------------------------------------------------------------------*/ void Deregister_Level ( Level *ll, void *sh ) { Level l = *ll; if (l != NULL) { #ifdef XTRACE tracef ("Deregister_Level\n"); #endif Deregister_Function (&l->fns, sh); Deregister_Entry (&l->list, sh); if (l->fns == NULL && l->list == NULL) { *ll = NULL; m_FREE (l, sizeof *l); } } } /*------------------------------------------------------------------------*/ os_error *callback_deregister ( callback_l l, void *sh, int limit, ... ) { /*Makes the non-portable assumption that the arguments after |limit| are on the stack in order of increasing address.*/ /*No error is flagged if the given (fn, handle, keys) combination does not exist.*/ /*We only free the |Function|'s that record this callback, though it would be possible to free the |Level| that they depend on (provided that there were no sub-|Level|'s or other |Function|'s).*/ Level *ll; Entry *ee = NULL; int i, *k = &limit + 1; os_error *error = NULL; tracef ("callback_deregister\n"); /*Descend the hierarchy.*/ ll = &l->root; for (i = 0; i < limit && *ll != NULL; i++) { /*Look along the current level for the given key.*/ for (ee = &(*ll)->list; *ee != NULL; ee = &(*ee)->next) if ((*ee)->key == k [i]) break; if (*ee == NULL) goto finish; ll = &(*ee)->level; } Deregister_Level (ll, sh); if (*ll == NULL && ee != NULL) { /*We've just killed the level of a certain entry, so we should remove it too.*/ Entry e = *ee; *ee = e->next; m_FREE (e, sizeof *e); } finish: return error; } /*------------------------------------------------------------------------*/ #if TRACE static void Trace_Level (Level, int); void Trace_Entry ( Entry entry, int indent ) { if (entry != NULL) { trace_f (NULL _ 0 _ "%*s%d:\n" _ indent _ "" _ entry->key); Trace_Level (entry->level, indent + 3); Trace_Entry (entry->next, indent); } } /*------------------------------------------------------------------------*/ static void Trace_Function ( Function fns, int indent ) { Function f; osbool first = TRUE; for (f = fns; f != NULL; f = f->next) { if (first) { trace_f (NULL _ 0 _ "%*sFunctions:" _ indent _ ""); first = FALSE; } else trace_f (NULL _ 0 _ ", "); trace_f (NULL _ 0 _ " %s (0x%X,)" _ Function_Name (f->fn) _ f->sh); } if (first) trace_f (NULL _ 0 _ "%*sNo functions" _ indent _ ""); trace_f (NULL _ 0 _ "\n"); } /*------------------------------------------------------------------------*/ void Trace_Level ( Level level, int indent ) { if (level != NULL) { Trace_Function (level->fns, indent); Trace_Entry (level->list, indent); } } /*------------------------------------------------------------------------*/ void callback_trace ( callback_l l ) { tracef ("callback_trace\n"); if (l != NULL) Trace_Level (l->root, 0); } #endif --- NEW FILE: callback.h --- #ifndef callback_H #define callback_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ /* Changed by J R C 16th Aug 1994 to return |os_error *|. TV 20000503 |bool| replaced by |osbool| */ #if !defined types_H #include "oslib/types.h" #endif #ifndef os_H #include "oslib/os.h" #endif #ifndef trace_H #include "trace.h" #endif /* The type of a callback function. */ typedef os_error *callback_fn (void *, void *, osbool *); /* The type of a callback list. */ typedef struct callback_l *callback_l; /* Function to create a new, empty callback list. */ extern os_error *callback_new (callback_l *); /* Function to delete a callback list. */ extern os_error *callback_delete (callback_l); /* Function to make all the callbacks registered in a given list for * the given key values. * * callback_l the callback list to be scanned * void * a handle to be passed to the functions called * int the number of key values to be matched * ... the keys themselves * * Every function registered in the callback list with the given key * values will be called, and passed the given handle, until * one is claimed. */ extern os_error *callback (callback_l, void *, osbool *, int, ...); /* Function to register a new callback function. * * callback_l the callback list to be extended * callback_fn * the function to call * void * a handle to be passed to the function when it is called * int the number of key values provided * ... a list of integer key values * * The function and handle will be registered in the callback list. */ extern os_error *callback_register (callback_l, callback_fn *, void *, int, ...); /* Function to deregister a callback function. The callback list is * scanned for a single match to the (function, handle) pair at the given * key values, and it is deleted. */ extern os_error *callback_deregister (callback_l, void *, int, ...); #if TRACE extern void callback_trace (callback_l); #else #define callback_trace(l) SKIP #endif #endif --- NEW FILE: hostfs.h --- #ifndef hostfs_H #define hostfs_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #ifndef types_H #include "oslib/types.h" #endif #ifndef os_H #include "oslib/os.h" #endif /********************************** * SWI names and SWI reason codes * **********************************/ #undef HostFS_HostVdu #define HostFS_HostVdu 0x40100 #undef XHostFS_HostVdu #define XHostFS_HostVdu 0x60100 #undef HostFS_TubeVdu #define HostFS_TubeVdu 0x40101 #undef XHostFS_TubeVdu #define XHostFS_TubeVdu 0x60101 #undef HostFS_WriteC #define HostFS_WriteC 0x40102 #undef XHostFS_WriteC #define XHostFS_WriteC 0x60102 /************************* * Function declarations * *************************/ #ifdef __cplusplus extern "C" { #endif /* ------------------------------------------------------------------------ * Function: hostfs_host_vdu() * * Description: Calls SWI 0x40100 */ extern os_error *xhostfs_host_vdu (void); __swi (0x40100) void hostfs_host_vdu (void); /* ------------------------------------------------------------------------ * Function: hostfs_tube_vdu() * * Description: Calls SWI 0x40101 */ extern os_error *xhostfs_tube_vdu (void); __swi (0x40101) void hostfs_tube_vdu (void); /* ------------------------------------------------------------------------ * Function: hostfs_writec() * * Description: Calls SWI 0x40102 * * Input: c - value of R0 on entry */ extern os_error *xhostfs_writec (char c); __swi (0x40102) void hostfs_writec (char c); #ifdef __cplusplus } #endif #endif --- NEW FILE: lookup.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lookup.h --- #ifndef lookup_H #define lookup_H /*lookup.h - simple lookup facilities*/ /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #ifndef os_H #include "oslib/os.h" #endif /* Implement ation of an abstract lookup table consisting of a token ** and a pointer to an associated data item */ typedef struct lookup_t *lookup_t; /* create a new abstract lookup table */ extern os_error *lookup_new( lookup_t *, /* updated with pointer to new table */ int /* initial size of table */ ); /* delete the entire table */ extern os_error *lookup_delete (lookup_t); /* search the table for a specific item */ extern os_error *lookup(lookup_t, /* pointer to table */ char *, /* token to match */ void ** /* pointer to destination for result: NULL if entry not found else pointer to data item */ ); /* add an entry to the table */ extern os_error *lookup_insert( lookup_t, /* table */ char *, /* pointer to token */ void * /* pointer to data item */ ); /* sequentially retrieve all tokens in the table */ extern os_error *lookup_enumerate( lookup_t, /* table */ char **, /* destination for pointer to token */ void **, /* destination for pointer to data item */ void ** /* context pointer; start with 0; ** updated to for each iteration ** 0 if no more found */ ); #endif --- NEW FILE: m.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: m.h --- #ifndef m_H #define m_H /*m.h - redirection for memory allocation functions*/ /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ /*From CLib*/ #include <stdlib.h> /*From Support*/ #ifndef realloc_H #include "realloc.h" #endif #ifndef trace_H #include "trace.h" #endif /*To use this module, you must call m_ALLOC, m_FREE, m_REALLOC in place of malloc, free, realloc at ALL PLACES in the programme. Then it is possible to change your allocation discipline by changing the values of these macros.*/ #if TRACE extern void *m_alloc (char *file, int line, int); extern void *m_calloc (char *file, int line, int, int); extern void m_free (char *file, int line, void *ptr, int size); extern void *m_realloc (char *file, int line, void *ptr, int old_size, int size); extern void m_summary (char *file, int line); extern void *m_validate_address (char *file, int line, void *ptr); #define m_ALLOC(size) \ m_alloc (__FILE__, __LINE__, size) #define m_CALLOC(count, size) \ m_calloc (__FILE__, __LINE__, count, size) #define m_FREE(ptr, size) \ m_free (__FILE__, __LINE__, ptr, size) #define m_REALLOC(ptr, old_size, size) \ m_realloc (__FILE__, __LINE__, ptr, old_size, size) #define m_SUMMARY() \ m_summary (__FILE__, __LINE__) #define m_VALIDATE_ADDRESS(ptr) \ m_validate_address (__FILE__, __LINE__, ptr) #else #define m_ALLOC(size) malloc (size) #define m_CALLOC(count, size) calloc (count, size) #define m_FREE(ptr, size) free (ptr) #define m_REALLOC(ptr, old_size, size) REALLOC (ptr, size) #define m_SUMMARY() SKIP #define m_VALIDATE_ADDRESS(ptr) ((void *) (ptr)) #endif #endif --- NEW FILE: realloc.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: realloc.h --- #ifndef realloc_H #define realloc_H /*realloc.c - portable realloc with no bugs!*/ /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #include <stddef.h> extern void *REALLOC (void *ptr, size_t size); #endif --- NEW FILE: resource.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: resource.h --- #ifndef resource_H #define resource_H /*resource.h---generic handling of resources*/ /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #ifndef os_H #include "oslib/os.h" #endif #ifndef wimp_H #include "oslib/wimp.h" #endif #ifndef lookup_H #include "lookup.h" #endif /* Types for the functions declared in this header. */ typedef os_error *resource_loader (lookup_t, char *); typedef os_error *resource_unloader (lookup_t); typedef struct resource_template { int data_size; char *data; wimp_window window; /*data lives here*/ } resource_template; /* Function to open a message file and copy it into memory if neccesary. All the tokens in the file are added to the lookup table: if the file was on disc, the lookup table will contain pointers into a block of heap memory, oherwise into the R M A or ROM. The message file is then closed, which means that MessageTrans_Lookup etc cannot be used. */ extern resource_loader resource_messages_alloc; /* Function to free the memory used by a messages resource. It is the client's responsibility to delete the lookup table. */ extern resource_unloader resource_messages_free; /* Function to open a sprite file and read it into memory if necessary, merging it with any sprite ares there may be from earlier calls to this function, using OSSpriteOp_MergeSpriteFile. All the sprite names in the merged file are inserted into the lookup table: the result of looking them up is a pointer to the OSSpriteOp_Header structure, ready to be passed to any OSSpriteOp SWI that requires one. */ extern resource_loader resource_sprites_alloc; /* Function to frees the memory used by this sprite resource. It is the client's responsibility to delete the lookup table. */ extern resource_unloader resource_sprites_free; /* Function to open a template file and read it into memory. Because of the way the WIMP works, a copy must be made even if the original is in memory already. Each template in the file is inserted into the lookup table, and stored in a block of malloc memory along with its indirected data. The result of looking up a name is a pointer to a structure containing the wimp_window and the indirected data. Resource_create_window() should be used to open the window. */ extern resource_loader resource_templates_alloc; /* Function to free the memory used by a template resource. It is the client's responsibility to delete the lookup table. */ extern resource_unloader resource_templates_free; extern os_error *resource_create_window (resource_template *, wimp_w *, char **); extern os_error *resource_delete_window (wimp_w, char *); extern os_error *resource_error_lookup (lookup_t, bits errnum, char *token, ...); extern os_error *resource_lookup (lookup_t, char *s, int n, char *token, ...); #endif --- NEW FILE: riscos.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: riscos.h --- #ifndef riscos_H #define riscos_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ /*From OSLib*/ #ifndef os_H #include "oslib/os.h" #endif #ifndef territory_H #include "oslib/territory.h" #endif /* Function to change the territory in use for |riscos_{scan/format}_fixed. */ extern os_error *riscos_territory (territory_t); /* Macro to provide an assertion facility using Wimp_ReportError. */ #define riscos_assert(c) \ (!(c)? riscos__assert (__FILE__, __LINE__, #c): (void) SKIP) /* Function to be used by |riscos_assert()| - not for external use. */ extern void riscos__assert (char *file, int line, char *msg); /* Function to return an |os_error *| from an error token in the global * messages file. */ extern os_error *riscos_error_lookup (int errnum, char *token, ...); /* Trivial functions to do things "the RISC O S way" rather than "the C * way." This means treating strings as control-char terminated, rather * than 0-terminated. These can be printed using a format of * "%.*s" and passing in the length of the string, as calculated by * |riscos_strlen|, as a argument to the printing function. Note that * riscos_strncpy() is not like strncpy(): it always terminates its output. */ extern int riscos_strlen (char *s); extern char *riscos_strcpy (char *s1, char *s); extern int riscos_strcmp (char *s0, char *s1); extern char *riscos_strncpy (char *s1, char *s, int n); /* Useful string processing functions, designed to allow safe in-line use * by taking a buffer argument, the pointer to which they return. */ extern char *riscos_format_dec (char *s, int i, int width, int prec); /*sprintf (s, "%*.*d", width, prec, i)*/ extern char *riscos_format_hex (char *s, int i, int width, int prec); /*sprintf (s, "%*.*X", width, prec, i)*/ extern char *riscos_format_char (char *s, char c); /*sprintf (s, "%c", c)*/ extern char *riscos_format_fixed (char *s, int mul, int div, int width, int prec); /*sprintf (s, "*.*f", width, prec, mul/div)*/ /* Functions to read back the items above - these return the number of * characters successfully read, 0 for error. */ extern int riscos_scan_dec (char *s, int *i_out); /*sscanf (s, "%d", i)*/ extern int riscos_scan_hex (char *s, int *i_out); /*sscanf (s, "%x", i)*/ extern int riscos_scan_fixed (char *s, int *mul_out, int div); /*sscanf (s, "%lf", mul), mul *= div*/ extern os_error *riscos_var_val_alloc (char *var, char **val); /*returns a new heap pointer to the value, or NULL if not found*/ extern int riscos_var_len (char *var, os_var_type); /*length of variable value, or -1 if not found*/ extern os_error *riscos_vdu (int vdu, ...); /*Performs a single V D U sequence, as follows.*/ /*riscos_vdu (os_VDU_CHAR_TO_PRINTER, c)*/ /*riscos_vdu (os_VDU_SET_TEXT_COLOUR, colour)*/ /*riscos_vdu (os_VDU_MODE, mode)*/ /*riscos_vdu (os_VDU_SET_GCOL, action, colour)*/ /*riscos_vdu (os_VDU_SET_TEXT_CURSOR, x, y)*/ /*riscos_vdu (os_VDU_SET_PALETTE, colour, mode, red, green, blue)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_INTERLACE, action, mode)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_CURSOR_MOVEMENT, eor_value, and_value)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_CURSOR, mode)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_ON, duration)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_OFF, duration)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_ECFx, ecf)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_DOT_STYLE, style)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_UNPACKED_ECFx, ecf)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SCROLL, extent, direction, movement)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_CLEAR_REGION, start, end, x0, y0, x1, y1)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_BBCEOF)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_TEXT_FG_TINT, tint)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_TEXT_FG_TINT, tint)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_TEXT_FG_TINT, tint)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_TEXT_FG_TINT, tint)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_ECF_INTERPRETATION, patterns)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_INVERT_TEXT)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_ECF_ORIGIN, x, y)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_CHAR_SIZE, flags, x, y)*/ /*riscos_vdu (os_VDU_MISC, c, definition)*/ /*riscos_vdu (os_VDU_SET_GRAPHICS_WINDOW, x0, y0, x1, y1)*/ /*riscos_vdu (os_VDU_PLOT, plot_type, x, y)*/ /*riscos_vdu (os_VDU_SET_TEXT_WINDOW, x0, y0, x1, y1)*/ /*riscos_vdu (os_VDU_SET_GRAPHICS_ORIGIN, x, y)*/ #endif --- NEW FILE: riscosa.s --- ;riscosa.asm - length of a variable ;written by Jonathan Coxhead, 15th Aug 1995 ;OSLib---efficient, type-safe, transparent, extensible, ; register-safe A P I coverage of RISC O S ;Copyright © 1994 Jonathan Coxhead ; ; OSLib is free software; you can redistribute it and/or modify ;it under the terms of the GNU General Public License as published by ;the Free Software Foundation; either version 1, or (at your option) ;any later version. ; ; OSLib is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ;along with this programme; if not, write to the Free Software ;Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. GET Hdr.OS EXPORT riscos_var_len AREA |C$$code|, CODE, READONLY riscos_var_len ROUT ;Entry R0 -> name of a variable ; R1 = variable type (os_VARTYPE_EXPANDED or 0) ;Exit R0 = length of variable value, or -1 if not found STMFD SP!, {R4, LR} MOV R4, R1 MOV R3, #0 MOV R2, #1 << 31 MOV R1, #Null SWI XOS_ReadVarVal ;Ignore error MVN R0, R2 [ {CONFIG}=26 LDMFD SP!, {R4, PC}^ | LDMFD SP!, {R4, PC} ] END --- NEW FILE: trace.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: trace.h --- #ifndef trace_H #define trace_H /*tracef.h*/ /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ #ifndef TRACE #define TRACE 0 #endif #ifndef os_H #include "oslib/os.h" #endif #if TRACE #define tracef(args) trace_f (__FILE__, __LINE__, args) #define tracevdu(s, n) trace_vdu (s, n) #define tracewait(t) trace_wait (__FILE__, __LINE__, t) #define trace_FINISH \ { trace_file = __FILE__; \ trace_line = __LINE__; \ goto finish; \ } #define trace_ASSIGN(e, f) \ { if (((e) = (f)) != NULL) \ { trace_file = __FILE__; \ trace_line = __LINE__; \ } } #define trace_RETURN(e) \ { if ((e) != NULL) \ trace_f (trace_file, trace_line, "<%s>\n", \ (e)->errmess); \ return e; \ } #define trace_ERROR(e) \ { if ((e) != NULL) \ trace_f (trace_file, trace_line, "<%s>\n", \ (e)->errmess); \ } extern os_error *trace_initialise (char *var); extern os_error *trace_terminate (void); extern void trace_f (char *file, int line, char *, ...); extern void trace_vdu (char *, int); extern void trace_wait (char *file, int line, int t); extern char *trace_file; extern int trace_line; #else #define tracef(args) #define tracevdu(args) #define tracewait(args) #define trace_initialise(var) #define trace_terminate() #define trace_f(args) #define trace_vdu(s, n) #define trace_wait(t) #define trace_FINISH {goto finish;} #define trace_ASSIGN(e,f) {(e) = (f);} #define trace_RETURN(e) {return e;} #define trace_ERROR(e) ; #endif #endif --- NEW FILE: unix.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: unix.h --- #ifndef unix_H #define unix_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ /*From OSLib*/ #ifndef os_H #include "oslib/os.h" #endif #ifndef territory_H #include "oslib/territory.h" #endif /* Function to change the territory in use for |riscos_{scan/format}_fixed. */ extern os_error *riscos_territory (territory_t); /* Macro to provide an assertion facility using Wimp_ReportError. */ #define riscos_assert(c) \ (!(c)? riscos__assert (__FILE__, __LINE__, #c): (void) SKIP) /* Function to be used by |riscos_assert()| - not for external use. */ extern void riscos__assert (char *file, int line, char *msg); /* Function to return an |os_error *| from an error token in the global * messages file. */ extern os_error *riscos_error_lookup (int errnum, char *token, ...); /* Trivial functions to do things "the RISC O S way" rather than "the C * way." This means treating strings as control-char terminated, rather * than 0-terminated. These can be printed using a format of * "%.*s" and passing in the length of the string, as calculated by * |riscos_strlen|, as a argument to the printing function. Note that * riscos_strncpy() is not like strncpy(): it always terminates its output. */ extern int riscos_strlen (char *s); extern char *riscos_strcpy (char *s1, char *s); extern int riscos_strcmp (char *s0, char *s1); extern char *riscos_strncpy (char *s1, char *s, int n); /* Useful string processing functions, designed to allow safe in-line use * by taking a buffer argument, the pointer to which they return. */ extern char *riscos_format_dec (char *s, int i, int width, int prec); /*sprintf (s, "%*.*d", width, prec, i)*/ extern char *riscos_format_hex (char *s, int i, int width, int prec); /*sprintf (s, "%*.*X", width, prec, i)*/ extern char *riscos_format_char (char *s, char c); /*sprintf (s, "%c", c)*/ extern char *riscos_format_fixed (char *s, int mul, int div, int width, int prec); /*sprintf (s, "*.*f", width, prec, mul/div)*/ /* Functions to read back the items above - these return the number of * characters successfully read, 0 for error. */ extern int riscos_scan_dec (char *s, int *i_out); /*sscanf (s, "%d", i)*/ extern int riscos_scan_hex (char *s, int *i_out); /*sscanf (s, "%x", i)*/ extern int riscos_scan_fixed (char *s, int *mul_out, int div); /*sscanf (s, "%lf", mul), mul *= div*/ extern os_error *riscos_var_val_alloc (char *var, char **val); /*returns a new heap pointer to the value, or NULL if not found*/ extern int riscos_var_len (char *var, os_var_type); /*length of variable value, or -1 if not found*/ extern os_error *riscos_vdu (int vdu, ...); /*Performs a single V D U sequence, as follows.*/ /*riscos_vdu (os_VDU_CHAR_TO_PRINTER, c)*/ /*riscos_vdu (os_VDU_SET_TEXT_COLOUR, colour)*/ /*riscos_vdu (os_VDU_MODE, mode)*/ /*riscos_vdu (os_VDU_SET_GCOL, action, colour)*/ /*riscos_vdu (os_VDU_SET_TEXT_CURSOR, x, y)*/ /*riscos_vdu (os_VDU_SET_PALETTE, colour, mode, red, green, blue)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_INTERLACE, action, mode)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_CURSOR_MOVEMENT, eor_value, and_value)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_CURSOR, mode)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_ON, duration)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_OFF, duration)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_ECFx, ecf)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_DOT_STYLE, style)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_UNPACKED_ECFx, ecf)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SCROLL, extent, direction, movement)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_CLEAR_REGION, start, end, x0, y0, x1, y1)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_SET_BBCEOF)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_TEXT_FG_TINT, tint)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_TEXT_FG_TINT, tint)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_TEXT_FG_TINT, tint)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_TEXT_FG_TINT, tint)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_ECF_INTERPRETATION, patterns)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_INVERT_TEXT)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_ECF_ORIGIN, x, y)*/ /*riscos_vdu (os_VDU_MISC, os_MISC_MISC, os_MISC_SET_CHAR_SIZE, flags, x, y)*/ /*riscos_vdu (os_VDU_MISC, c, definition)*/ /*riscos_vdu (os_VDU_SET_GRAPHICS_WINDOW, x0, y0, x1, y1)*/ /*riscos_vdu (os_VDU_PLOT, plot_type, x, y)*/ /*riscos_vdu (os_VDU_SET_TEXT_WINDOW, x0, y0, x1, y1)*/ /*riscos_vdu (os_VDU_SET_GRAPHICS_ORIGIN, x, y)*/ #endif --- NEW FILE: x.c --- /**************************************************************** ** Title : SupportLib.c.x.c.x ** ** Purpose: RiscOs Exception Handling ** ** Copyright: ©OSLib ** ** History: 970913 TV Port from OSLib x with StrongArm amendments ** 981221 TV fixed bug giving wrong offsets in International_Error ** *****************************************************************/ /* OSLib is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. OSLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this programme; if not, write to the Free Software Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A. */ /*x.c*/ /*From CLib*/ #include "kernel.h" #include <setjmp.h> #include <signal.h> #include <stdlib.h> #include <string.h> /*From OSLib*/ #include "oslib/macros.h" #include "oslib/messagetrans.h" #include "oslib/os.h" /*From Support*/ #include "x.h" /* For bootstrap builds */ #ifndef error_ESCAPE # define error_ESCAPE 0x11u #endif #ifndef error_STK_OFLO # define error_STK_OFLO 0x163u #endif typedef struct { os_error* dflt; os_error* token; } International_Error; /*A macro to declare them*/ #define LOCAL_INTERNATIONAL_ERROR(id, token, num, mess) \ static struct \ { \ bits defaultnum; \ char errmess [sizeof mess + 1]; \ } id ## _dflt_ = { num, mess }; \ \ static struct \ { \ bits errnum; \ char errtoken [sizeof token + 1]; \ } id ## _token_ = {num, token}; \ \ static International_Error id ## _ = { ( os_error *) &id ## _dflt_ , (os_error*) &id ## _token_ }; \ static International_Error *id = &id ## _ #if 0 /* international error blocks (for use with Copy_Error())*/ LOCAL_INTERNATIONAL_ERROR( Error_Stack, "C64", error_STK_OFLO, "Not enough memory, allocate failed" ); #endif LOCAL_INTERNATIONAL_ERROR( Error_Unknown, "C35", 1, "No error (errno = 0)" ); /* synchronisation error */ x_LOCAL_ERROR( Error_Sync, 1 + (1U<<30), "Try/Catch Synchronisation Error" ); /* exception stack overflow */ x_LOCAL_ERROR( Error_XStack, 2 + (1U<<30), "Too many nested x_TRY blocks" ); /* error blocks with tokens in (for use with MessageTrans).*/ x_LOCAL_ERROR( Error_Escape, error_ESCAPE, "Escape" ); x_LOCAL_ERROR( Error_No_Memory, os_GLOBAL_NO_MEM, "NoMem" ); static int Signals [] = { SIGINT, #ifdef SIGSTAK SIGSTAK, #endif SIGOSERROR }; /*------------------------------------------------------------------------*/ static os_error *Copy_Error (International_Error *ie) { #ifndef EXECUTE_ON_UNIX messagetrans_control_block cb; #endif os_error *e; /*This code is what the SharedCLibrary does, except that this happens every time a message is to be looked up, and the module only opens the file at most once. We don't really care about this.*/ #ifndef EXECUTE_ON_UNIX if( xmessagetrans_open_file( &cb, "SharedCLibrary:Messages", NULL ) == NULL ) { e = xmessagetrans_error_lookup( ie -> token, &cb, NULL, 0, "SharedCLibrary", NULL, NULL, NULL ); xmessagetrans_close_file( &cb ); } else #endif e = ie -> dflt; return e; } // start off with a stack chunk of adequate size to hold initial exception blocks static x_exception* gapxX[ x_MAXDEPTH ]; // stack static x_exception** gppxX = gapxX; // stack pointer /*------------------------------------------------------------------------*/ // signal handler static void SigHandler( int iSignal ) { os_error *pxError = NULL /**/; /*Save this condition in the buffer.*/ switch( iSignal ) { case SIGINT: #ifdef EXECUTE_ON_UNIX pxError = Error_Escape; #else pxError = xmessagetrans_error_lookup( Error_Escape, NULL, NULL, 0, SKIP, SKIP, SKIP, SKIP ); #endif break; #ifdef SIGSTAK case SIGSTAK: pxError = Copy_Error( Error_Stack ); break; #endif case SIGOSERROR: pxError = x__last_error(); break; } /*Longjump back to the x_TRY() call.*/ longjmp( (*(gppxX - 1)) -> buf, (int)( (*(gppxX - 1)) -> error = pxError)); } /*------------------------------------------------------------------------*/ void x__try( x_exception* pxX ) { int sig; // enter on exception stack if( gppxX < gapxX + x_MAXDEPTH ) *gppxX++ = pxX; else x_THROW( Error_XStack ); // throw an error on exception stack overflow /* Register handlers for each of the signal types which we're prepared to handle ** We maintain a record of the previous handlers so that we can restore them. ** It is more efficient to place the pointers on the caller's stack than to ** allocate our own memory */ for( sig = 0; sig < COUNT (Signals); sig++ ) { pxX -> previous[sig] = signal( Signals[sig], SigHandler ); if( pxX -> previous[sig] == SIG_ERR ) pxX -> previous[sig] = NULL; } /*error*/ pxX -> error = NULL; /*buf*/ /*Done in calling macro.*/ } /*------------------------------------------------------------------------*/ void x__catch( x_exception* pxX ) { int sig; /*Restore the caller's handlers.*/ for( sig = 0; sig < COUNT (Signals); sig++ ) { if( pxX -> previous[sig] != NULL ) signal( Signals [sig], pxX -> previous [sig] ); } /* remove the x_exception entry from the exception stack */ if( pxX == *(--gppxX) ) *gppxX = NULL; else x_THROW( Error_Sync ); // try/catch blocks out of sync } /*------------------------------------------------------------------------*/ os_error *x__last_error (void) { os_error *last_error; static os_error *Last_Error; /*Messing about here because _kernel_last_oserror() returns NULL the second time it's called*/ if ((last_error = (os_error *) _kernel_last_oserror() ) != NULL ) Last_Error = last_error; if (Last_Error == NULL) Last_Error = Copy_Error (Error_Unknown); return Last_Error; /*never NULL*/ } /*------------------------------------------------------------------------*/ void *x__alloc (int size) { void *ptr; if ((ptr = malloc (size)) == NULL && size != 0) { #ifndef EXECUTE_ON_UNIX messagetrans_error_lookup (Error_No_Memory, NULL, NULL, 0, SKIP, SKIP, SKIP, SKIP); #else os_generate_error( Error_No_Memory ); #endif } return ptr; } /*------------------------------------------------------------------------*/ void *x__calloc (int count, int size) { void *ptr; if ((ptr = calloc (count, size)) == NULL && size != 0 && count != 0) { #ifndef EXECUTE_ON_UNIX messagetrans_error_lookup (Error_No_Memory, NULL, NULL, 0, SKIP, SKIP, SKIP, SKIP); #else os_generate_error( Error_No_Memory ); #endif } return ptr; } /*------------------------------------------------------------------------*/ void x__free (void *ptr, int size) {NOT_USED (size) free (ptr);} /*------------------------------------------------------------------------*/ void *x__realloc (void *ptr, int old_size, int size) { // NOT_USED (old_size) // NOT_USED (size) if ((ptr = realloc (ptr, size)) == NULL && size != 0) { #ifndef EXECUTE_ON_UNIX messagetrans_error_lookup (Error_No_Memory, NULL, NULL, 0, SKIP, SKIP, SKIP, SKIP); #else os_generate_error( Error_No_Memory ); #endif } return ptr; } --- NEW FILE: x.h --- #ifndef x_H #define x_H /* x.h - exception handling header */ // Revision History: // From OSLib // 970926 TV Strongarm Compatible version // #include <stdio.h> #include <stdlib.h> #include <setjmp.h> #include <signal.h> #ifndef os_H #include "oslib/os.h" #endif #define x_MAXDEPTH 256 //#define TRACE 0 #ifdef EXECUTE_ON_UNIX # define SIGOSERROR (SIGUSR1) #else /* the following signals are defined in CLib, but not in UNIXLib */ /* Stack overflow. */ # if !defined SIGSTAK # define SIGSTAK 7 # endif /* Operating system error. */ # if !defined SIGOSERROR # define SIGOSERROR 10 # endif #endif typedef struct x_exception { void (*previous [3]) (int); os_error *error; jmp_buf buf; } x_exception; #ifdef __cplusplus extern "C" { #endif /* (Pseudo-)function to be called before a group of statements which * could throw an exception. */ #define x_TRY(x) \ if (x__try (x), setjmp ((x)->buf) == 0) extern void x__try (x_exception *); /* Function to allow the exception type to be examined. MUST be * called to balance a call to x_TRY. */ #define x_CATCH(x) \ if (x__catch (x), (x)->error != NULL) extern void x__catch (x_exception *); /* Function to re-throw exceptions. Used in exception handlers or in tidy- * up code to throw the error to the next-higher level that needs it. If * there was no exception, this does nothing. */ #define x_RETHROW(x) \ (((x)->error) != NULL ? ((void)os_generate_error((x)->error)):((void) SKIP)) /* Strange pseudo-declaration thing to make an |os_error *| from an error * number and a message. Declares |id| to be an |os_error *| pointing at the * block {num, mess}, without wasting 252 bytes of empty error block. Can * also be used if you want an international message that will be passed to * messagetrans_error_lookup. */ #define x_LOCAL_ERROR(id, num, mess) \ static struct {int errnum; char errmess [sizeof mess + 1];} id ## _ = \ {num, mess}; \ static os_error *id = (os_error *) &id ## _ /* Another declaration, to make an |os_error *| from an error * number and a message. Declares |id| to be an |os_error *| pointing at the * block {num, mess}, without wasting 252 bytes of empty error block. Can * also be used if you want an international message that will be passed to * messagetrans_error_lookup. */ #define x_GLOBAL_ERROR(id, num, mess) \ static struct {int errnum; char errmess [sizeof mess + 1];} id ## _ = \ {num, mess}; \ os_error *id = (os_error *) &id ## _; /* Function to throw exceptions. Used anywhere that obtains an * |os_error *| (usually from x_LOCAL_ERROR), and wants to turn it into an * exception. Undefined if its argument is NULL. */ #define x_THROW(error) \ os_generate_error (error) /* Function to throw an error after one has been detected by the run-time * system. Use after (e g) fopen, printf fail. */ #define x_THROW_LAST_ERROR() \ os_generate_error (x__last_error ()) extern os_error *x__last_error (void); /* Function to give the error responsible. Useful only at the top, where the * error is be reported. */ #define x_ERROR(x) ((x)->error) /* Function to exit from the programme, with an appropriate message and * return value (not useful for desktop programmes). */ #define x_EXIT(x) \ ( (x)->error != NULL? \ ( fprintf (stderr, "%s\n", (x)->error->errmess), \ exit (EXIT_FAILURE) \ ): \ exit (0) \ ) /* Function to exit from a desktop programme with an appropriate message and * return value. */ #define x_REPORT_EXIT(x, programme) \ ( (x)->error != NULL? \ ( wimp_report_error ((x)->error, NONE, programme), \ exit (EXIT_FAILURE) \ ): \ exit (0) \ ) /* A set of functions to do exception-throwing memory allocation. If they * return, they have succeeded, so they can be used in expressions, etc. */ extern os_error *x_no_memory; #if 0 #if TRACE #define x_ALLOC(size) x__alloc (size) #define x_CALLOC(count, size) x__calloc (count, size) #define x_FREE(ptr, size) x__free (ptr, size) #define x_REALLOC(ptr, old_size, size) x__realloc (ptr, old_size, size) #endif #else #define x_ALLOC(size) x__alloc (size) #define x_CALLOC(count, size) x__calloc (count, size) #define x_FREE(ptr) x__free (ptr, 0) #define x_REALLOC(ptr, size) x__realloc (ptr, 0, size) #endif extern void *x__alloc (int size); extern void *x__calloc (int count, int size); extern void x__free (void *ptr, int size); extern void *x__realloc (void *ptr, int old_size, int size); #ifdef __cplusplus } #endif #endif |
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support/doc In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/support/doc Added Files: Tag: unix-build callback lookup m realloc resource riscos trace Log Message: Unix Build --- NEW FILE: callback --- callback.c ---------- History ------- 26th October 1992 J R C Started The |callback_| module provides a dynamically extensible multi-way, multi-level switch facility. It was initially coded as an experiment, to see if the resulting, somewhat unconventional, data structure was useful. Use in the two entirely different contexts of the |riscos_| module and the internal working of the DrawFile module are indications that it is a useful tool. The module implements a data type, called a "callback list," which allows functions to be associated with integer lists. Each callback list is entirely unrelated to any others there may be: it is possible for a cluent of |callback_| to use different callback lists for unrelated purposes. The use of integer lists as the unit of association is pragmatic, based on what seemed like the likely set of uses for the module. The callback list --- -------- ---- In abstract terms, if |Fn| is the type of a callback function (i e, a function pointer type), and |SH|, |DH| are "handle" types, the the type of a callback list is implemented as Type Callback == Leval; Type Level == List [Fn × SH] × List [Int × Level]; Type List == Opt [Level] × DH; (where List [T] == Opt [T × List [T]] and Opt [T] is either a T or NULL) This is implemented in C via Type Function == List [Fn × SH]; Type Entry == List [Int × Level]; In other words, a callback list is a list of (Fn, SH) pairs and a list of (int, Level) pairs. The module has been implemented in such a way as to use no RISC O S-specific features: in particular, it does not use |os_error *| values to return errors. The only error that can be returned by any of the functions described here is "not enough memory;" this is flagged by returning a NULL pointer, in the way that |malloc| does. The entry points are |callback_new| to create an empty callback list and |callback_delete| to dispose of one; and others to insert, delete and make callbacks. |Callback_register| is used to add a new function into the list. Its prototype is callback_l callback_register (callback_l l, callback_fn *fn, void *sh, int limit, ...) The client provides a callback list to contain the new callback, the function pointer to call back to, a handle to call it with, and an integer list (the length of the list being given in |limit|). Extra levels are created in the callback list as neccessary, and a callback record (of type Fn × SH) is inserted. Callbacks may be deleted from the list with |callback_deregister. Its prototype is void callback_deregister (callback_l l, void *sh, int limit, ...) It deletes ALL callbacks that have the given handle, and whose integer list starts with the |limit| integers provided. Callbacks with longer lists that start in the same way as the one given are also deleted. (This means that all callbacks on a given window can be deleted easily, for example.) To make the callbacks, the client must call |callback|. It has the prototype void callback (callback_l l, void *dh, int limit, ...) All callbacks which have lists starting with the |limit| integers provided will be called, util one returss |TRUE|, to indicate that it has dealt with the callback successfully. So the only communication between a called-back function and the rest of the client programme is in the handle |sh| registered in the callback list, at the time the function was registered; the handle |dh| provided when the callback is made; the boolean value returned by the function. So the protype of a callback must be |callback_fn|, defined in callback.h as typedef bool callback_fn (void *, void *); The two handles provided are again based on pragmatic evidence. The |riscos_| module passes the Wimp_Block structure to the callback: this allows functions called back from the main function |riscos| to get at all the information in the block returned from Wimp_Poll (or Wimp_PollIdle). The application is free to pass its own information to the function as well, using the other handle. This will usually be a structure of window-specific data. ViewDraw uses this technique successfully. On the other hand, the DrawData module has no data to be registered with the functions - after all, when the module is initialised, it has no way of finding out which files it will be asked to render - so all the functions in |render_| or |declare_| are passed a null pointer as one of the handles. The other handle is used to hold the per-diagram state, as documented with those modules. --- NEW FILE: lookup --- lookup.c -------- History ------- 26th October 1992 J R C Started This module provides an extensible lookup table. The programmer interface allows any number of entries to be added to a lookup table without needing memory management to be done by the calling programme. There are functions |lookup_new| to create a lookup table; |lookup_delete| to dispose of an unwanted one; |lookup_insert| to add an entry to a table; and |lookup| to do the actual searching; |lookup_enumerate| to retrieve all the tokens currently in the lookup table. The interface allows for a hashing system to be used, providing that one can be designed that allows for an extensible table: I have experimented with this, but don't have such in a bug-free form at the moment. The module stores only a |void *| value for each entry in the table. This would normally be a pointer (suitably cast) to some application-specific data associated with the name. It is the applications responsibility to ensure that if this pointer changes (because of flex movement, for example), the value in the table is updated to refer to the new location of the data. See the |resource| module for how this can be done in two different ways. It relies on the fact that a |lookup_insert| of a value with a token already known to the |lookup_| module will replace the previous value. The implementation of the lookup table is as an array of (char *, void*) pairs, of a length which is a power of 2. When a table is filled, it is |realloc|'d to the next power of 2. Pointers to tokens are held in the first word of each array element, and the data pointer in the other half. This allows only linear searching in the table; many improvements are possible here, but have not been attempted. However, the interface specified here is general enough to provide the facilities that are required without being specific enough to prohibit the various abvious enhancements. The obvious ones would be either hold the array sorted by token, cutting access time to O (log N), where N is the number of entries; or hash the token values, cutting access time to O (1). Unfortunately, one of |lookup_|'s clients makes use of a fact not intended by its interface: this is that a call to |lookup_enumerate| returns the tokens in the order they were inserted into the table. If this property were to be maintained by either of these implementations, extra work would be needed internally. (I do have a hashing implementation of the module, but it is not bug-free.) --- NEW FILE: m --- m.c --- This module provides a more secure environment for programmes that need to check their usage of memory allocation. It must be used consistently throughout a whole programme. To use it, each call to one of the memory management functions must be replaced by a call to the macro provided by the module, as follows: malloc (size) m_ALLOC (size) calloc (count, size) m_CALLOC (count, size) free (ptr) m_FREE (ptr, size) realloc (ptr, size) m_REALLOC (ptr, old_size, size) and "m.h" must be included. When you do this, if you have -DTRACE=0 (or nothing) on the command line, all the macros map straight back to the calls on the left; but when you do -DTRACE=1, they turn into calls to the checking functions defined in m.c. These have the following effects. Whenever a block of memory is allocated, it is filled with a junk byte (0xA5), so that code that relies on the contents being anything in particular will fail. Also, 4 extra bytes are allocated on the end, and these are filled with a different junk byte (0xA7). Just before memory is freed, it is filled with a third junk byte (0xA9), and the extra bytes are checked to see that they still contain the junk written in at the beginning. Also, each block has a header invisibly preceding it that links all the blocks together, in order of allocation. Each block also contains the file name and line number at which it was allocated, and a guard word (0xACCE55ED) at the very beginning to protect against overwriting at the beginning of the block. The integrity of the system is checked on every call to any of the functions. Two of the calls have extra arguments: the call m_FREE (ptr, size) allows the client to specify the size it believes the block to have been allocated with: the module checks this. If the client doesn't know, the call m_FREE (ptr, 0) disables the check. Similary, m_REALLOC (ptr, old_size, new_size) checks the size of the block before resizing it, unless old_size == 0. The call m_SUMMARY () traces all this information to the current trace destination. If the compiling was done with -DTRACE=0, it does nothing. --- NEW FILE: realloc --- realloc.c --------- Just a portable realloc with no bugs. It's called REALLOC, though. --- NEW FILE: resource --- resource.c ---------- History ------- 26th October 1992 J R C Started This module is not used by DrawFile; however, it is usd by the test programme ViewDraw. It provides functions to allow different parts (modules or shared libraries) of an application to load resources into shared structures, and access them in linear time. It uses the |lookup_| module to to this: |resource_| is the WIMP-specific part of resource loading only. The structure provided by the |lookup_| module is a tale that supplies a mapping between tokens (supplied as strings) and data pointers. This facility is used in slightly different ways by the different resource types. Messages files -------- ----- |Resource_messages| is used by an application to load a Messages file into a lookup table. On successful completion, all the tokens in the file will be in the lookup table and a buffer of messages will have been allocated. Multiple messages files may be loaded into the same lookup table. All will be subsequently deleted by a call to |resource_messages_delete|. The function works by reading the messages file into a buffer, using MessageTrans to enumerate the tokens, and storing pointers to them in the lookup table. Subsequent calls to |resource_messages| cause this block to be |realloc|'d; the call to |resource_messages_delete| frees it. Access to the messages loaded so far is therefore provided by |lookup|: this call is given a lookup table and a token, and it returns the pointer stored in the table. In this case, it is a string pointer to the message, and so should be cast to |char *| before use. Sprites files ------- ----- |Resource_sprites| is similar, but works for sprites instead. All the sprites are loaded into a sprite area which is extended using |realloc| as necessary. Multiple sprites files may be loaded into the same lookup table, and subsequently deleted by |resource_sprites_delete|. The sprites are combined using OS_SpriteOp 'merge sprite file', so duplicates are deleted. On return from |lookup|, a pointer should therefore be cast to |osspriteop_header *|. Templates files --------- ----- |Resource_templates| is alos similar, but it works on Templates files via Wimp_{Open,Load,Close}Template. Again, multiple templates files may be loaded into the same lookup table, and subsequently deleted by |resource_templates_delete|. However, in this case, each template is loaded into a separate |malloc| buffer: all are freed on deletion. Returns from |lookup| should be cast to |wimp_window *|. Future development ------ ----------- Obviously, this is all tied in with the concept of the Resource Editor. I think it would be a good idea to define a Menus resource file type along the lines of the Templates one, and define |resource_menus| etc for that file type. This would simply be a binary file containing the |wimp_menu| structure needed by Wimp_CreateMenu. File formats of each type can refer to entries in files of the other types: for example, a template in a Templates file can refer to a message in the Messages file, or to a sprite in the Sprites file; a menu in the Menus file could refer to a template in the templates file (or vice versa). In general, the dependency graph is not acyclic between the different sorts of file (though it must be at the token level). This implies that this extra looking up is done after all the files have been opened (by |resource_<something>|): this would be a new function |resource_initialise| called after all resource_<...>| calls have been made. It could even be deferred until the token is actually looked up, but that would mean that a common function (|lookup|) could no longer be used for all file formats. This would allow (e g) the message tokens in an application resources files to refer not only to text defined in the applications own Messages file, but also to text defined by modules that the application was going to use. This means that the resources exported by a module become part of its programming interface; this seems entirely reasonable. It implies that an application has to make some kind of initial call to a module that it will use: this may be undesirable. (Maybe this whole module is a Bad Thing, since it encourages data from all kinds of places to appear in the same table: it might be better for an application to maintain its own resources only, and to let each of the modules/shared libraries it uses take care of their own resources as they wish. This wouod lose a lot of the flexibility described above, however.) --- NEW FILE: riscos --- riscos.c -------- History ------- 26th October 1992 J R C Started This module uses the |callback_| module to provide a callback list and a useful set of callbacks specific to Wimp_Poll. It also provides various of the usual functions without which no application is complete and some non-function external symbols. These are used to provide access to the module in the following way: |riscos_callback| is a callback list, initially empty, which is examined every time Wimp_Poll returns to get the application to do the work appropriate for that event. If an application wants only to install an icon bar icon, and then wait for a QUIT message from the WIMP, it would look like this (ignoring all error checking): static wimp_message_list Messages = ...; static bool Quit (void *null, void *block) { riscos_quit = TRUE; return TRUE; } main (void) { riscos_initialise ("Small", &Messages, NULL, &myself); callback_register (riscos_callback, &Quit, NULL, 2, wimp_MESSAGE, message_QUIT); callback_register (riscos_callback, &Quit, NULL, 2, wimp_MESSAGE_RECORDED, message_QUIT); ... put icon on the icon bar ... riscos (); riscos_terminate (); } The function |riscos| returns only when the extern |riscos_quit| is set. |Riscos_initialise| simply creates the empty callback list |riscos_callback| and remembers the programme name for use by |riscos_complain|. By adding and removing callbacks, any combination of events can be handled by any module. The convention of the |callback_| module is that any callback (e g, |Quit| above) that return |TRUE| is considered to have "handled" the event: no other calls back are made. In addition to regiatering and deregistering callbacks, an application may need access to the following variables. (Access to these should probably be centralised further to allow usage counts to be maintained for mask bits, etc): |riscos_mask| is the mask used by Wimp_Poll or Wimp_PollIdle (type |int|); |riscos_timeout| is the timeout to be handed to Wimp_PollIdle, if used; |riscos_quit| is to be set to TRUE to close down the application; |riscos_polling_idle|, if set to |TRUE|, causes Wimp_PollIdle to be used instead of Wimp_Poll; |riscos_pollword| is set to the word to use for event PollwordNonZero (if used). The module also exports other functions,as alluded to above. These are: |riscos_error_lookup| which takes an error token with a variable number of arguments and formats it into an error block; |riscos__assert|, usually used via the macro |riscos_assert|, which provides an assertion facility that uses Wimp_ReportError; |riscos_complain| to report an error. |riscos_terminate| to delete the callback list creted by |riscos_initialise|. So, the main function is |riscos|. It works by calling Wimp_Poll (or Wimp_PollIdle), and then calling |callback| with a certain list of integers appropriate to the event just returned to find out wht the user wants done with that event. The integers it uses are as follows: wimp_NULL_REASON_CODE, wimp_DRAG_BOX: event number only wimp_REDRAW_WINDOW_REQUEST: event number, window handle wimp_OPEN_WINDOW_REQUEST: event number, window handle wimp_CLOSE_WINDOW_REQUEST: event number, window handle, mouse buttons, shifting keys wimp_POINTER_LEAVING_WINDOW: event number, window handle wimp_POINTER_ENTERING_WINDOW: event number, window handle wimp_MOUSE_CLICK: event number, window handle, icon handle, mouse buttons, shifting keys wimp_KEY_PRESSED: event number, window handle, icon handle, character (this allows different handlers to be provided for different keys - e g, F1, F2 etc, while another handler takes everything else. wimp_MENU_SELECTION: event number, main menu entry number, submenu entry number, subsubmenu entry number, ... (as many as provided) wimp_SCROLL_REQUEST: event number, window handle, mouse buttons, shifting keys wimp_LOSE_CARET, wimp_GAIN_CARET: event number, window handle, icon handle wimp_POLLWORD_NON_ZERO: event number, pollword address wimp_MESSAGE, wimp_MESSAGE_RECORDED, wimp_MESSAGE_ACKNOWLEDGE: depends on the message type message_DATA_SAVE, message_DATA_SAVE_ACK, message_DATA_LOAD, message_DATA_LOAD_ACK, message_DATA_OPEN: event number, action code, window handle, icon handle, file type message_DEVICE_CLAIM, message_DEVICE_IN_USE: event number, action code, major device, minor device message_MENU_WARNING: event number, action code, main menu entry number, submenu entry number, subsubmenu entry number, ... (as many as provided) default: event number, action code default: callback (riscos_callback, &Block, 0); The list here seems to work well; it is possible that some of these sequences are not long enough. For example, the original version did not use the file type word on the callbacks for wimp_MESSAGE_DATA_LOAD etc; but by providing it, the user can register separate callbacks for different file types arriving on windows (without losing the ability to specify a default callback to be used when there is no more specific one). (ViewDraw does this, and so ignores non-drawfiles dropped onto its icon bar icon.) There are two cases here of using information that the WIMP does not actually return in the Wimp_Block structure. The mouse button state, although returned in the structure for a Wimp_MouseClick event, are not returned for Wimp_CloseWindowRequest or Wimp_ScrollRequest. Neverthless, they are useful in these cases as they allow the application to take different action depending on (e g) whether a window was closed with SELECT or ADJUST. In addition, the states of the shifting keys are returned for Wimp_CloseWindowRequest, Wimp_MouseClick and Wimp_ScrollRequest. These are read by calling OS_Byte 129 and disjoining the states together into a word of bits: bit 0 <=> SHIFT is down bit 1 <=> CTRL is down bit 2 <=> ALT is down (constants riscos_SHIFT, riscos_CTRL and riscos_ALT are defined with these values). This could also encourage more uniformity in the treatment of these keys. There are also two auxiliary functions: |Shifting_Keys| returns the states of the SHIFT, CTRL and ALT keys, while |Mouse_Buttons| returns the state of the mouse buttons. These are used when the information is not returned via Wimp_Poll: this fact is indicated in the list above by the phrases "shifting keys" and "mouse buttons". --- NEW FILE: trace --- trace.c ------- History ------- 26th October 1992 JRC Started 23rd May 1995 JRC Updated for multiple destinations This is a simplified version of various other tracing modules that have been written at various other times. It provides an initialisation function trace_initialise(), which takes the name of an operating system variable, and sets up tracing in a way that depends on its contents as follows: e128.5 Econet (AUN) station 128.5 f$.trace File $.trace i136.170.128.5 Internet address 136.170.128.5 n null: s Standard output (may be redirected on the programme command line by '> file') t Tube (HostFS or TML) v vdu: (may be redirected by '{ > file }') There is also a function trace_terminate() whcih closes the trace output, and should be called before the programme exits. There is only one tracing function, tracef(), which takes a |printf|-like argument line and sends it to the destination. This is implemtned as a macro. If the compiling is done with -DTRACE=1, everything workd as above. Otherwise (-DTRACE=0, or nothing), all the calls macro-expand to nothing. Because you can't write a macro with a variable number of arguments, you have to play a trick to get tracef() to work with more than one argument: you have to use a macro _, defined as #define _ , and use _ instead of , in the argument list: tracef ("Window handle 0x%X, icon handle %d\n" _ w _ i); |
From: <to...@us...> - 2004-01-14 13:33:20
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/docs In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/docs Modified Files: Tag: unix-build Unix_Build Log Message: Unix Build Index: Unix_Build =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/docs/Attic/Unix_Build,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** Unix_Build 9 Jan 2004 17:50:33 -0000 1.1.4.1 --- Unix_Build 14 Jan 2004 13:33:17 -0000 1.1.4.2 *************** *** 7,11 **** In general, I have applied the following rules: i. All file names with ,xxx extensions are the RISC OS versions; this is in ! particular important for Makefiles. --- 7,15 ---- In general, I have applied the following rules: i. All file names with ,xxx extensions are the RISC OS versions; this is in ! particular important for Makefiles, TaskObey, and Obey files. ! ii The GNU/Linux make files are called GNUmakefile. ! iii A third category of make, obey, and taskobey files, intended to be used ! under RISC OS, but using the unix-type directory structre are entitled ! UMakefile, etc. *************** *** 27,40 **** and adding to it, the tools can now all be built under UNIX. Changes made to this port include: ! made all functions which can provide an output test the pointer for NULL ! implemented osfile_load_stamped_no_path ! implemented osfile_delete ! implemented osgbpb_dir_entries_info ! implemented os_writen ! implemented osargs_ensurew 1.1 DefMod ---------- ! DefMod is built in from defmod/Build_GNU, and defmod/Build_RISCOS, depending on the environment. The final target is copied to oslib/bin as before. DefMod's makefile has been changed to allow for the relocations of it and the support --- 31,45 ---- and adding to it, the tools can now all be built under UNIX. Changes made to this port include: ! made all functions which can provide an output test the pointer for NULL ! implemented osfile_load_stamped_no_path ! implemented osfile_delete ! implemented osgbpb_dir_entries_info ! implemented os_writen ! implemented os_pretty_print ! implemented osargs_ensurew 1.1 DefMod ---------- ! DefMod is built from defmod/Build_GNU, and defmod/Build_RISCOS, depending on the environment. The final target is copied to oslib/bin as before. DefMod's makefile has been changed to allow for the relocations of it and the support *************** *** 59,72 **** 1.2 StripDepends ---------------- ! StripDepends is not really required to build OSLib; hence it is no longer ! supplied as part of the OSLib build; however, it remains available from ! http://www.mk-net.demon.co.uk/software/riscos/stripdepends.zip. 1.3 bison ---------------- ! Bison is considered a standard tool, and is inappropriate to distribute as ! part of OSLib. There is a port available with the GCCSDK, or alternatively, ! my version of this, which can be linked with the standard C library ! stubs is available from http://www.mk-net.demon.co.uk/software/riscos/bison.zip 1.4 rm --- 64,74 ---- 1.2 StripDepends ---------------- ! StripDepends is not required to build OSLib under UNIX; hence it is not ! ported to the OSLib build. 1.3 bison ---------------- ! Bison is considered a standard UNIX tool, and the version supplied with ! the OSLib distribution is RISC OS only. 1.4 rm |
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/support/doc In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/DefMod2/defmod/support/doc Removed Files: Tag: unix-build callback lookup m realloc resource riscos trace Log Message: Unix Build --- callback DELETED --- --- lookup DELETED --- --- m DELETED --- --- realloc DELETED --- --- resource DELETED --- --- riscos DELETED --- --- trace DELETED --- |
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/support In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/DefMod2/defmod/support Removed Files: Tag: unix-build callback.c callback.h hostfs.h lookup.c lookup.h m.c m.h realloc.c realloc.h resource.c resource.h riscos.c riscos.h riscosa.s trace.c trace.h unix.c x.c x.h Log Message: Unix Build --- callback.c DELETED --- --- callback.h DELETED --- --- hostfs.h DELETED --- --- lookup.c DELETED --- --- lookup.h DELETED --- --- m.c DELETED --- --- m.h DELETED --- --- realloc.c DELETED --- --- realloc.h DELETED --- --- resource.c DELETED --- --- resource.h DELETED --- --- riscos.c DELETED --- --- riscos.h DELETED --- --- riscosa.s DELETED --- --- trace.c DELETED --- --- trace.h DELETED --- --- unix.c DELETED --- --- x.c DELETED --- --- x.h DELETED --- |
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/DefMod2/defmod/oslib Removed Files: Tag: unix-build OS.Hdr Types.Hdr fileswitch.h font.h hostfs.h macros.h messagetrans.h os.h osargs.h osfile.h osfind.h osgbpb.h osmodule.h osspriteop.h taskwindow.h territory.h types.h wimp.h Log Message: Unix Build --- OS.Hdr DELETED --- --- Types.Hdr DELETED --- --- fileswitch.h DELETED --- --- font.h DELETED --- --- hostfs.h DELETED --- --- macros.h DELETED --- --- messagetrans.h DELETED --- --- os.h DELETED --- --- osargs.h DELETED --- --- osfile.h DELETED --- --- osfind.h DELETED --- --- osgbpb.h DELETED --- --- osmodule.h DELETED --- --- osspriteop.h DELETED --- --- taskwindow.h DELETED --- --- territory.h DELETED --- --- types.h DELETED --- --- wimp.h DELETED --- |
From: <to...@us...> - 2004-01-14 13:33:19
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/DefMod2/defmod/Build_GNU In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/DefMod2/defmod/Build_GNU Added Files: Tag: unix-build GNUmakefile kernel.h swis.h Log Message: Unix Build --- NEW FILE: GNUmakefile --- # # Makefile for defmod for UNIX. # #------------------------------------------------------------------------ #target-specific macros TRACE ?= 0 TARGET = defmod MODULES = \ ${TARGET} \ lookup \ asmhelp \ chelp \ def \ cheader \ objasm \ realloc \ hdr \ cstrong \ x \ unix \ os \ osfile \ kernel TRACEMODULES = \ trace \ m \ osfind \ osargs \ osgbpb #INCLUDES = -I. -I../sources -I../../.. -I../../../support -I../../../oslib INCLUDES = -I. -I../sources -I../../.. -I../../../support DEFINES = -DUNIX -DEXECUTE_ON_UNIX -DASMCMD=${ASMCMD} -DTRACE=${TRACE} -D__swi VPATH = ../sources ../../../support ../../../oslib/unix #ifeq (${TRACE},1) OBJS = $(patsubst %,%.o,${MODULES}) $(patsubst %,%.o,${TRACEMODULES}) #else OBJS = $(patsubst %,%.o,${MODULES}) #endif #define which assembler DefMod should use # as for GCC # armasm for PACE/solaris # ObjAsm for RISC OS ASMCMD = as #------------------------------------------------------------------------ # tools CC = gcc CFLAGS = -Wall -funsigned-char LD = gcc LDFLAGS = YACC = bison YFLAGS = CP = cp -f #------------------------------------------------------------------------ #targets .PHONY: all all: ${TARGET} ${TARGET}: ${OBJS} ${LD} ${LDFLAGS} -o $@ ${OBJS} ${CP} $@ ../../../../bin .PHONY: clean clean: ;rm -f $(patsubst %,%.o,${MODULES}) $(patsubst %,%.o,${TRACEMODULES}) ${TARGET} ${TARGET}.c .PHONY: realclean realclean: clean find . -type l -exec rm -f {} \; #------------------------------------------------------------------------ # general rules: .SUFFIXES: .SUFFIXES: .o .c .y .c.o: ;${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -o $@ -c $< .y.c: ;${YACC} -y -o $@ $< #defmod.o: defmod.c #defmod.c: defmod.y --- NEW FILE: kernel.h --- /* Simple stub kernel.h header file required by defmod builds */ #ifndef kernel_H #define kernel_H //#define __swi(n) typedef struct { int errnum; char errmess[252]; } _kernel_oserror; extern _kernel_oserror const *last_error; extern const _kernel_oserror *_kernel_last_oserror(void); extern const _kernel_oserror *_kernel_set_perror(void); # endif --- NEW FILE: swis.h --- /* Empty file required for UNIX builds */ |