Author: pfg Date: Tue May 12 03:27:06 2015 New Revision: 282803 URL: https://svnweb.freebsd.org/changeset/base/282803
Log: Update to ficl 4.1.0 (latest release on sourceforge) Added: vendor/ficl/dist/Makefile (contents, props changed) vendor/ficl/dist/Makefile.ansi (contents, props changed) vendor/ficl/dist/bit.c (contents, props changed) vendor/ficl/dist/callback.c (contents, props changed) vendor/ficl/dist/compatibility.c (contents, props changed) vendor/ficl/dist/contrib/ vendor/ficl/dist/contrib/xclasses/ vendor/ficl/dist/contrib/xclasses/readme.txt (contents, props changed) vendor/ficl/dist/contrib/xclasses/xclasses.py (contents, props changed) vendor/ficl/dist/dictionary.c - copied, changed from r282801, vendor/ficl/dist/dict.c vendor/ficl/dist/doc/api.html (contents, props changed) vendor/ficl/dist/doc/articles/ vendor/ficl/dist/doc/articles/ficlddj.pdf (contents, props changed) vendor/ficl/dist/doc/articles/jwsforml.pdf (contents, props changed) vendor/ficl/dist/doc/articles/oo_in_c.html (contents, props changed) vendor/ficl/dist/doc/articles/sigplan9906.doc (contents, props changed) vendor/ficl/dist/doc/debugger.html (contents, props changed) vendor/ficl/dist/doc/dpans.html (contents, props changed) vendor/ficl/dist/doc/graphics/ vendor/ficl/dist/doc/graphics/4ring.gif (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.128.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.64.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.96.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl_oop.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl_top.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/sourceforge.jpg (contents, props changed) vendor/ficl/dist/doc/license.html (contents, props changed) vendor/ficl/dist/doc/links.html (contents, props changed) vendor/ficl/dist/doc/locals.html (contents, props changed) vendor/ficl/dist/doc/oop.html (contents, props changed) vendor/ficl/dist/doc/parsesteps.html (contents, props changed) vendor/ficl/dist/doc/releases.html (contents, props changed) vendor/ficl/dist/doc/source/ vendor/ficl/dist/doc/source/api.ht vendor/ficl/dist/doc/source/debugger.ht vendor/ficl/dist/doc/source/dpans.ht vendor/ficl/dist/doc/source/ficl.ht vendor/ficl/dist/doc/source/generate.py (contents, props changed) vendor/ficl/dist/doc/source/index.ht vendor/ficl/dist/doc/source/license.ht vendor/ficl/dist/doc/source/links.ht vendor/ficl/dist/doc/source/locals.ht vendor/ficl/dist/doc/source/oop.ht vendor/ficl/dist/doc/source/parsesteps.ht vendor/ficl/dist/doc/source/releases.ht vendor/ficl/dist/doc/source/upgrading.ht vendor/ficl/dist/doc/upgrading.html (contents, props changed) vendor/ficl/dist/double.c - copied, changed from r282801, vendor/ficl/dist/math64.c vendor/ficl/dist/extras.c (contents, props changed) vendor/ficl/dist/ficlcompatibility.h (contents, props changed) vendor/ficl/dist/ficldll.def vendor/ficl/dist/ficldll.dsp vendor/ficl/dist/ficlexe.dsp vendor/ficl/dist/ficllib.dsp vendor/ficl/dist/ficllocal.h (contents, props changed) vendor/ficl/dist/ficlplatform/ vendor/ficl/dist/ficlplatform/alpha.h (contents, props changed) vendor/ficl/dist/ficlplatform/ansi.c (contents, props changed) vendor/ficl/dist/ficlplatform/ansi.h (contents, props changed) vendor/ficl/dist/ficlplatform/ficlexports.txt (contents, props changed) vendor/ficl/dist/ficlplatform/makedef.py (contents, props changed) vendor/ficl/dist/ficlplatform/unix.c (contents, props changed) vendor/ficl/dist/ficlplatform/unix.h (contents, props changed) vendor/ficl/dist/ficlplatform/win32.c (contents, props changed) vendor/ficl/dist/ficlplatform/win32.h (contents, props changed) vendor/ficl/dist/ficltokens.h (contents, props changed) vendor/ficl/dist/hash.c (contents, props changed) vendor/ficl/dist/lzcompress.c (contents, props changed) vendor/ficl/dist/lzuncompress.c (contents, props changed) vendor/ficl/dist/main.c (contents, props changed) vendor/ficl/dist/primitives.c - copied, changed from r282801, vendor/ficl/dist/words.c vendor/ficl/dist/softcore/ - copied from r282801, vendor/ficl/dist/softwords/ vendor/ficl/dist/softcore/ficl.fr vendor/ficl/dist/softcore/make.bat vendor/ficl/dist/softcore/makesoftcore.c (contents, props changed) vendor/ficl/dist/system.c - copied, changed from r282801, vendor/ficl/dist/ficl.c vendor/ficl/dist/utility.c (contents, props changed) vendor/ficl/dist/word.c (contents, props changed) Deleted: vendor/ficl/dist/dict.c vendor/ficl/dist/doc/Logo.jpg vendor/ficl/dist/doc/ficl1.ico vendor/ficl/dist/doc/ficl_debug.html vendor/ficl/dist/doc/ficl_guts.htm vendor/ficl/dist/doc/ficl_loc.html vendor/ficl/dist/doc/ficl_logo.jpg vendor/ficl/dist/doc/ficl_oop.html vendor/ficl/dist/doc/ficl_oop.jpg vendor/ficl/dist/doc/ficl_parse.html vendor/ficl/dist/doc/ficl_rel.html vendor/ficl/dist/doc/ficl_top.jpg vendor/ficl/dist/doc/ficlddj.PDF vendor/ficl/dist/doc/ficlheader.js vendor/ficl/dist/doc/jwsforml.PDF vendor/ficl/dist/doc/oo_in_c.html vendor/ficl/dist/doc/primer.txt vendor/ficl/dist/doc/sigplan9906.doc vendor/ficl/dist/doc/skey.gif vendor/ficl/dist/ficl.c vendor/ficl/dist/ficl.dsp vendor/ficl/dist/math64.c vendor/ficl/dist/math64.h vendor/ficl/dist/softcore/oo.fr.bak vendor/ficl/dist/softcore/softcore.bat vendor/ficl/dist/softcore/softcore.pl vendor/ficl/dist/softcore/softcore.py vendor/ficl/dist/softcore/softcore.py.bat vendor/ficl/dist/softwords/ vendor/ficl/dist/sysdep.c vendor/ficl/dist/sysdep.h vendor/ficl/dist/testmain.c vendor/ficl/dist/unix.c vendor/ficl/dist/win32.c vendor/ficl/dist/words.c Modified: vendor/ficl/dist/Makefile.linux vendor/ficl/dist/ReadMe.txt vendor/ficl/dist/doc/favicon.ico vendor/ficl/dist/doc/ficl.html vendor/ficl/dist/doc/index.html vendor/ficl/dist/ficl.dsw vendor/ficl/dist/ficl.h vendor/ficl/dist/fileaccess.c vendor/ficl/dist/float.c vendor/ficl/dist/prefix.c vendor/ficl/dist/search.c vendor/ficl/dist/softcore.c vendor/ficl/dist/softcore/classes.fr vendor/ficl/dist/softcore/ficlclass.fr vendor/ficl/dist/softcore/ficllocal.fr vendor/ficl/dist/softcore/fileaccess.fr vendor/ficl/dist/softcore/forml.fr vendor/ficl/dist/softcore/ifbrack.fr vendor/ficl/dist/softcore/jhlocal.fr vendor/ficl/dist/softcore/makefile vendor/ficl/dist/softcore/marker.fr vendor/ficl/dist/softcore/oo.fr vendor/ficl/dist/softcore/prefix.fr vendor/ficl/dist/softcore/softcore.fr vendor/ficl/dist/softcore/string.fr vendor/ficl/dist/softcore/win32.fr vendor/ficl/dist/stack.c vendor/ficl/dist/test/asm68k.4th vendor/ficl/dist/test/core.fr vendor/ficl/dist/test/fib.fr vendor/ficl/dist/test/ficltest.fr vendor/ficl/dist/test/ooptest.fr vendor/ficl/dist/test/prefix.fr vendor/ficl/dist/test/sarray.fr vendor/ficl/dist/test/testcase.fr vendor/ficl/dist/test/tester.fr vendor/ficl/dist/test/vocab.fr vendor/ficl/dist/tools.c vendor/ficl/dist/vm.c Added: vendor/ficl/dist/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/Makefile Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,60 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o unix.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/unix.h +# +# Flags for shared library +#TARGET= -Dlinux # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) -Wall +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) $(CFLAGS) $(LDFLAGS) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) $(LDFLAGS) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) $(CFLAGS) $(LDFLAGS) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +# depend explicitly to help finding source files in another subdirectory, +# and repeat commands since gmake doesn't understand otherwise +ansi.o: ficlplatform/ansi.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +unix.o: ficlplatform/unix.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* ficl Added: vendor/ficl/dist/Makefile.ansi ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/Makefile.ansi Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,56 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o ansi.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/ansi.h +# +# Flags for shared library +TARGET= -ansi -DFICL_ANSI # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +ansi.o: ficlplatform/ansi.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ficlplatform/ansi.c + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* Modified: vendor/ficl/dist/Makefile.linux ============================================================================== --- vendor/ficl/dist/Makefile.linux Tue May 12 02:38:48 2015 (r282802) +++ vendor/ficl/dist/Makefile.linux Tue May 12 03:27:06 2015 (r282803) @@ -1,19 +1,20 @@ -OBJECTS= dict.o ficl.o fileaccess.o float.o math64.o prefix.o search.o softcore.o stack.o sysdep.o tools.o unix.o vm.o words.o -HEADERS= ficl.h math64.h sysdep.h +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o unix.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/unix.h # # Flags for shared library TARGET= -Dlinux # riscos MOTO_CPU32 SHFLAGS = -fPIC -CFLAGS= -O -c $(SHFLAGS) $(TARGET) -CC=gcc +CFLAGS= -O $(SHFLAGS) +CPPFLAGS= $(TARGET) -I. +CC = cc LIB = ar cr RANLIB = ranlib -MAJOR = 3 -MINOR = 0.1 +MAJOR = 4 +MINOR = 1.0 -ficl: testmain.o ficl.h sysdep.h libficl.a - $(CC) testmain.o -o ficl -L. -lficl -lm +ficl: main.o $(HEADERS) libficl.a + $(CC) main.o -o ficl -L. -lficl -lm lib: libficl.so.$(MAJOR).$(MINOR) @@ -28,23 +29,26 @@ libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so -testmain: testmain.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) - $(CC) testmain.o -o testmain -L. -lficl -lm +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) main.o -o main -L. -lficl -lm ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) +unix.o: ficlplatform/unix.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ficlplatform/unix.c + # # generic object code # .SUFFIXES: .cxx .cc .c .o .c.o: - $(CC) $(CFLAGS) -c $*.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< .cxx.o: - $(CPP) $(CPFLAGS) -c $*.cxx + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< .cc.o: - $(CPP) $(CPFLAGS) -c $*.cc + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< # # generic cleanup code # Modified: vendor/ficl/dist/ReadMe.txt ============================================================================== --- vendor/ficl/dist/ReadMe.txt Tue May 12 02:38:48 2015 (r282802) +++ vendor/ficl/dist/ReadMe.txt Tue May 12 03:27:06 2015 (r282803) @@ -1,5 +1,5 @@ -FICL 3.03 -April 2002 +FICL 4.1.0 +October 2010 ________ OVERVIEW @@ -10,18 +10,22 @@ and development prototype language. Fic Command Language". For more information, please see the "doc" directory. -For release notes, please see "doc/ficl_rel.html". +For release notes, please see "doc/releases.html". ____________ INSTALLATION Ficl builds out-of-the-box on the following platforms: - * Linux: use "Makefile.linux". - * RiscOS: use "Makefile.riscos". + * NetBSD, FreeBSD: use "Makefile". + * Linux: use "Makefile.linux", but it should work with + "Makefile" as well. * Win32: use "ficl.dsw" / "ficl.dsp". -To port to other platforms, be sure to examine "sysdep.h", and -we suggest you start with the Linux makefile. (And please--feel -free to submit your portability changes!) +To port to other platforms, we suggest you start with the generic +"Makefile" and the "unix.c" / "unix.h" platform-specific implementation +files. (And please--feel free to submit your portability changes!) + +(Note: Ficl used to build under RiscOS, but we broke everything +for the 4.0 release. Please fix it and send us the diffs!) ____________ FICL LICENSE Added: vendor/ficl/dist/bit.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/bit.c Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,49 @@ +#include "ficl.h" + +int ficlBitGet(const unsigned char *bits, size_t index) + { + int byteIndex = index >> 3; + int bitIndex = index & 7; + unsigned char mask = (unsigned char)(128 >> bitIndex); + + return ((mask & bits[byteIndex]) ? 1 : 0); + } + + + +void ficlBitSet(unsigned char *bits, size_t index, int value) + { + int byteIndex = index >> 3; + int bitIndex = index & 7; + unsigned char mask = (unsigned char)(128 >> bitIndex); + + if (value) + bits[byteIndex] |= mask; + else + bits[byteIndex] &= ~mask; + } + + +void ficlBitGetString(unsigned char *destination, const unsigned char *source, int offset, int count, int destAlignment) + { + int bit = destAlignment - count; + while (count--) + ficlBitSet(destination, bit++, ficlBitGet(source, offset++)); + } + + +/* +** This will actually work correctly *regardless* of the local architecture. +** --lch +**/ +ficlUnsigned16 ficlNetworkUnsigned16(ficlUnsigned16 number) +{ + ficlUnsigned8 *pointer = (ficlUnsigned8 *)&number; + return (ficlUnsigned16)(((ficlUnsigned16)(pointer[0] << 8)) | (pointer[1])); +} + +ficlUnsigned32 ficlNetworkUnsigned32(ficlUnsigned32 number) +{ + ficlUnsigned16 *pointer = (ficlUnsigned16 *)&number; + return ((ficlUnsigned32)(ficlNetworkUnsigned16(pointer[0]) << 16)) | ficlNetworkUnsigned16(pointer[1]); +} Added: vendor/ficl/dist/callback.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/callback.c Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,76 @@ +#include "ficl.h" + + +extern ficlSystem *ficlSystemGlobal; + +/************************************************************************** + f i c l C a l l b a c k T e x t O u t +** Feeds text to the vm's output callback +**************************************************************************/ +void ficlCallbackTextOut(ficlCallback *callback, char *text) +{ + ficlOutputFunction textOut = NULL; + + if (callback != NULL) + { + if (callback->textOut != NULL) + textOut = callback->textOut; + else if ((callback->system != NULL) && (callback != &(callback->system->callback))) + { + ficlCallbackTextOut(&(callback->system->callback), text); + return; + } + } + + if ((textOut == NULL) && (ficlSystemGlobal != NULL)) + { + callback = &(ficlSystemGlobal->callback); + textOut = callback->textOut; + } + + if (textOut == NULL) + textOut = ficlCallbackDefaultTextOut; + + (textOut)(callback, text); + + return; +} + + +/************************************************************************** + f i c l C a l l b a c k E r r o r O u t +** Feeds text to the vm's error output callback +**************************************************************************/ +void ficlCallbackErrorOut(ficlCallback *callback, char *text) +{ + ficlOutputFunction errorOut = NULL; + + if (callback != NULL) + { + if (callback->errorOut != NULL) + errorOut = callback->errorOut; + else if ((callback->system != NULL) && (callback != &(callback->system->callback))) + { + ficlCallbackErrorOut(&(callback->system->callback), text); + return; + } + } + + if ((errorOut == NULL) && (ficlSystemGlobal != NULL)) + { + callback = &(ficlSystemGlobal->callback); + errorOut = callback->errorOut; + } + + if (errorOut == NULL) + { + ficlCallbackTextOut(callback, text); + return; + } + + (errorOut)(callback, text); + + return; +} + + Added: vendor/ficl/dist/compatibility.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/compatibility.c Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,284 @@ +#define FICL_FORCE_COMPATIBILITY 1 +#include "ficl.h" + + +FICL_PLATFORM_EXTERN ficlStack *stackCreate (unsigned cells) { return ficlStackCreate(NULL, "unknown", cells); } +FICL_PLATFORM_EXTERN void stackDelete (ficlStack *stack) { ficlStackDestroy(stack); } +FICL_PLATFORM_EXTERN int stackDepth (ficlStack *stack) { return ficlStackDepth(stack); } +FICL_PLATFORM_EXTERN void stackDrop (ficlStack *stack, int n) { ficlStackDrop(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackFetch (ficlStack *stack, int n) { return ficlStackFetch(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackGetTop (ficlStack *stack) { return ficlStackFetch(stack, 0); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN void stackLink (ficlStack *stack, int cells) { ficlStackLink(stack, cells); } +FICL_PLATFORM_EXTERN void stackUnlink (ficlStack *stack) { ficlStackUnlink(stack); } +#endif /* FICL_WANT_LOCALS */ +FICL_PLATFORM_EXTERN void stackPick (ficlStack *stack, int n) { ficlStackPick(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackPop (ficlStack *stack) { return ficlStackPop(stack); } +FICL_PLATFORM_EXTERN void *stackPopPtr (ficlStack *stack) { return ficlStackPopPointer(stack); } +FICL_PLATFORM_EXTERN ficlUnsigned stackPopUNS (ficlStack *stack) { return ficlStackPopUnsigned(stack); } +FICL_PLATFORM_EXTERN ficlInteger stackPopINT (ficlStack *stack) { return ficlStackPopInteger(stack); } +FICL_PLATFORM_EXTERN void stackPush (ficlStack *stack, ficlCell cell) { ficlStackPush(stack, cell); } +FICL_PLATFORM_EXTERN void stackPushPtr (ficlStack *stack, void *pointer) { ficlStackPushPointer(stack, pointer); } +FICL_PLATFORM_EXTERN void stackPushUNS (ficlStack *stack, ficlUnsigned u) { ficlStackPushUnsigned(stack, u); } +FICL_PLATFORM_EXTERN void stackPushINT (ficlStack *stack, ficlInteger i) { ficlStackPushInteger(stack, i); } +FICL_PLATFORM_EXTERN void stackReset (ficlStack *stack) { ficlStackReset(stack); } +FICL_PLATFORM_EXTERN void stackRoll (ficlStack *stack, int n) { ficlStackRoll(stack, n); } +FICL_PLATFORM_EXTERN void stackSetTop (ficlStack *stack, ficlCell cell) { ficlStackSetTop(stack, cell); } +FICL_PLATFORM_EXTERN void stackStore (ficlStack *stack, int n, ficlCell cell) { ficlStackStore(stack, n, cell); } + +#if (FICL_WANT_FLOAT) +FICL_PLATFORM_EXTERN ficlFloat stackPopFloat (ficlStack *stack) { return ficlStackPopFloat(stack); } +FICL_PLATFORM_EXTERN void stackPushFloat(ficlStack *stack, ficlFloat f) { ficlStackPushFloat(stack, f); } +#endif + +FICL_PLATFORM_EXTERN int wordIsImmediate(ficlWord *word) { return ficlWordIsImmediate(word); } +FICL_PLATFORM_EXTERN int wordIsCompileOnly(ficlWord *word) { return ficlWordIsCompileOnly(word); } + + +FICL_PLATFORM_EXTERN void vmBranchRelative(ficlVm *vm, int offset) { ficlVmBranchRelative(vm, offset); } +FICL_PLATFORM_EXTERN ficlVm *vmCreate (ficlVm *vm, unsigned nPStack, unsigned nRStack) { return ficlVmCreate(vm, nPStack, nRStack); } +FICL_PLATFORM_EXTERN void vmDelete (ficlVm *vm) { ficlVmDestroy(vm); } +FICL_PLATFORM_EXTERN void vmExecute (ficlVm *vm, ficlWord *word) { ficlVmExecuteWord(vm, word); } +FICL_PLATFORM_EXTERN ficlDictionary *vmGetDict (ficlVm *vm) { return ficlVmGetDictionary(vm); } +FICL_PLATFORM_EXTERN char * vmGetString (ficlVm *vm, ficlCountedString *spDest, char delimiter) { return ficlVmGetString(vm, spDest, delimiter); } +FICL_PLATFORM_EXTERN ficlString vmGetWord (ficlVm *vm) { return ficlVmGetWord(vm); } +FICL_PLATFORM_EXTERN ficlString vmGetWord0 (ficlVm *vm) { return ficlVmGetWord0(vm); } +FICL_PLATFORM_EXTERN int vmGetWordToPad (ficlVm *vm) { return ficlVmGetWordToPad(vm); } +FICL_PLATFORM_EXTERN ficlString vmParseString (ficlVm *vm, char delimiter) { return ficlVmParseString(vm, delimiter); } +FICL_PLATFORM_EXTERN ficlString vmParseStringEx(ficlVm *vm, char delimiter, char skipLeading) { return ficlVmParseStringEx(vm, delimiter, skipLeading); } +FICL_PLATFORM_EXTERN ficlCell vmPop (ficlVm *vm) { return ficlVmPop(vm); } +FICL_PLATFORM_EXTERN void vmPush (ficlVm *vm, ficlCell cell) { ficlVmPush(vm, cell); } +FICL_PLATFORM_EXTERN void vmPopIP (ficlVm *vm) { ficlVmPopIP(vm); } +FICL_PLATFORM_EXTERN void vmPushIP (ficlVm *vm, ficlIp newIP) { ficlVmPushIP(vm, newIP); } +FICL_PLATFORM_EXTERN void vmQuit (ficlVm *vm) { ficlVmQuit(vm); } +FICL_PLATFORM_EXTERN void vmReset (ficlVm *vm) { ficlVmReset(vm); } +FICL_PLATFORM_EXTERN void vmThrow (ficlVm *vm, int except) { ficlVmThrow(vm, except); } +FICL_PLATFORM_EXTERN void vmThrowErr (ficlVm *vm, char *fmt, ...) { va_list list; va_start(list, fmt); ficlVmThrowErrorVararg(vm, fmt, list); va_end(list); } + +FICL_PLATFORM_EXTERN void vmCheckStack(ficlVm *vm, int popCells, int pushCells) { FICL_IGNORE(vm); FICL_IGNORE(popCells); FICL_IGNORE(pushCells); FICL_STACK_CHECK(vm->dataStack, popCells, pushCells); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void vmCheckFStack(ficlVm *vm, int popCells, int pushCells) { FICL_IGNORE(vm); FICL_IGNORE(popCells); FICL_IGNORE(pushCells); FICL_STACK_CHECK(vm->floatStack, popCells, pushCells); } +#endif + +FICL_PLATFORM_EXTERN void vmPushTib (ficlVm *vm, char *text, ficlInteger nChars, ficlTIB *pSaveTib) { ficlVmPushTib(vm, text, nChars, pSaveTib); } +FICL_PLATFORM_EXTERN void vmPopTib (ficlVm *vm, ficlTIB *pTib) { ficlVmPopTib(vm, pTib); } + +FICL_PLATFORM_EXTERN int isPowerOfTwo(ficlUnsigned u) { return ficlIsPowerOfTwo(u); } + +#if defined(_WIN32) +/* #SHEESH +** Why do Microsoft Meatballs insist on contaminating +** my namespace with their string functions??? +*/ +#pragma warning(disable: 4273) +#endif +char *ltoa(ficlInteger value, char *string, int radix ) { return ficlLtoa(value, string, radix); } +char *ultoa(ficlUnsigned value, char *string, int radix ) { return ficlUltoa(value, string, radix); } +char *strrev( char *string ) { return ficlStringReverse(string); } +#if defined(_WIN32) +#pragma warning(default: 4273) +#endif +FICL_PLATFORM_EXTERN char digit_to_char(int value) { return ficlDigitToCharacter(value); } +FICL_PLATFORM_EXTERN char *skipSpace(char *cp, char *end) { return ficlStringSkipSpace(cp, end); } +FICL_PLATFORM_EXTERN char *caseFold(char *cp) { return ficlStringCaseFold(cp); } +FICL_PLATFORM_EXTERN int strincmp(char *cp1, char *cp2, ficlUnsigned count) { return ficlStrincmp(cp1, cp2, count); } + +FICL_PLATFORM_EXTERN void hashForget (ficlHash *hash, void *where) { ficlHashForget(hash, where); } +FICL_PLATFORM_EXTERN ficlUnsigned16 hashHashCode (ficlString string) { return ficlHashCode(string); } +FICL_PLATFORM_EXTERN void hashInsertWord(ficlHash *hash, ficlWord *word) { ficlHashInsertWord(hash, word); } +FICL_PLATFORM_EXTERN ficlWord *hashLookup (ficlHash *hash, ficlString string, ficlUnsigned16 hashCode) { return ficlHashLookup(hash, string, hashCode); } +FICL_PLATFORM_EXTERN void hashReset (ficlHash *hash) { ficlHashReset(hash); } + + +FICL_PLATFORM_EXTERN void *alignPtr(void *ptr) { return ficlAlignPointer(ptr); } +FICL_PLATFORM_EXTERN void dictAbortDefinition(ficlDictionary *dictionary) { ficlDictionaryAbortDefinition(dictionary); } +FICL_PLATFORM_EXTERN void dictAlign (ficlDictionary *dictionary) { ficlDictionaryAlign(dictionary); } +FICL_PLATFORM_EXTERN int dictAllot (ficlDictionary *dictionary, int n) { ficlDictionaryAllot(dictionary, n); return 0; } +FICL_PLATFORM_EXTERN int dictAllotCells (ficlDictionary *dictionary, int cells) { ficlDictionaryAllotCells(dictionary, cells); return 0; } +FICL_PLATFORM_EXTERN void dictAppendCell (ficlDictionary *dictionary, ficlCell cell) { ficlDictionaryAppendCell(dictionary, cell); } +FICL_PLATFORM_EXTERN void dictAppendChar (ficlDictionary *dictionary, char c) { ficlDictionaryAppendCharacter(dictionary, c); } +FICL_PLATFORM_EXTERN ficlWord *dictAppendWord (ficlDictionary *dictionary, + char *name, + ficlPrimitive code, + ficlUnsigned8 flags) + { return ficlDictionaryAppendPrimitive(dictionary, name, code, flags); } +FICL_PLATFORM_EXTERN ficlWord *dictAppendWord2(ficlDictionary *dictionary, + ficlString name, + ficlPrimitive code, + ficlUnsigned8 flags) + { return ficlDictionaryAppendWord(dictionary, name, code, flags); } +FICL_PLATFORM_EXTERN void dictAppendUNS (ficlDictionary *dictionary, ficlUnsigned u) { ficlDictionaryAppendUnsigned(dictionary, u); } +FICL_PLATFORM_EXTERN int dictCellsAvail (ficlDictionary *dictionary) { return ficlDictionaryCellsAvailable(dictionary); } +FICL_PLATFORM_EXTERN int dictCellsUsed (ficlDictionary *dictionary) { return ficlDictionaryCellsUsed(dictionary); } +FICL_PLATFORM_EXTERN void dictCheck (ficlDictionary *dictionary, ficlVm *vm, int n) { FICL_IGNORE(dictionary); FICL_IGNORE(vm); FICL_IGNORE(n); FICL_VM_DICTIONARY_CHECK(vm, dictionary, n); } +FICL_PLATFORM_EXTERN ficlDictionary *dictCreate(unsigned cells) { return ficlDictionaryCreate(NULL, cells); } +FICL_PLATFORM_EXTERN ficlDictionary *dictCreateHashed(unsigned cells, unsigned hash) { return ficlDictionaryCreateHashed(NULL, cells, hash); } +FICL_PLATFORM_EXTERN ficlHash *dictCreateWordlist(ficlDictionary *dictionary, int nBuckets) { return ficlDictionaryCreateWordlist(dictionary, nBuckets); } +FICL_PLATFORM_EXTERN void dictDelete (ficlDictionary *dictionary) { ficlDictionaryDestroy(dictionary); } +FICL_PLATFORM_EXTERN void dictEmpty (ficlDictionary *dictionary, unsigned nHash) { ficlDictionaryEmpty(dictionary, nHash); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void ficlPrimitiveHashSummary(ficlVm *vm); +FICL_PLATFORM_EXTERN void dictHashSummary(ficlVm *vm) { ficlPrimitiveHashSummary(vm); } +#endif +FICL_PLATFORM_EXTERN int dictIncludes (ficlDictionary *dictionary, void *p) { return ficlDictionaryIncludes(dictionary, p); } +FICL_PLATFORM_EXTERN ficlWord *dictLookup (ficlDictionary *dictionary, ficlString name) { return ficlDictionaryLookup(dictionary, name); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN ficlWord *ficlLookupLoc (ficlSystem *system, ficlString name) { return ficlDictionaryLookup(ficlSystemGetLocals(system), name); } +#endif +FICL_PLATFORM_EXTERN void dictResetSearchOrder(ficlDictionary *dictionary) { ficlDictionaryResetSearchOrder(dictionary); } +FICL_PLATFORM_EXTERN void dictSetFlags (ficlDictionary *dictionary, ficlUnsigned8 set, ficlUnsigned8 clear) { ficlDictionarySetFlags(dictionary, set); ficlDictionaryClearFlags(dictionary, clear); } +FICL_PLATFORM_EXTERN void dictSetImmediate(ficlDictionary *dictionary) { ficlDictionarySetImmediate(dictionary); } +FICL_PLATFORM_EXTERN void dictUnsmudge (ficlDictionary *dictionary) { ficlDictionaryUnsmudge(dictionary); } +FICL_PLATFORM_EXTERN ficlCell *dictWhere (ficlDictionary *dictionary) { return ficlDictionaryWhere(dictionary); } + +FICL_PLATFORM_EXTERN int ficlAddParseStep(ficlSystem *system, ficlWord *word) { return ficlSystemAddParseStep(system, word); } +FICL_PLATFORM_EXTERN void ficlAddPrecompiledParseStep(ficlSystem *system, char *name, ficlParseStep pStep) { ficlSystemAddPrimitiveParseStep(system, name, pStep); } +FICL_PLATFORM_EXTERN void ficlPrimitiveParseStepList(ficlVm *vm); +FICL_PLATFORM_EXTERN void ficlListParseSteps(ficlVm *vm) { ficlPrimitiveParseStepList(vm); } + +FICL_PLATFORM_EXTERN void ficlTermSystem(ficlSystem *system) { ficlSystemDestroy(system); } +FICL_PLATFORM_EXTERN int ficlEvaluate(ficlVm *vm, char *pText) { return ficlVmEvaluate(vm, pText); } +FICL_PLATFORM_EXTERN int ficlExec (ficlVm *vm, char *pText) { ficlString s; FICL_STRING_SET_FROM_CSTRING(s, pText); return ficlVmExecuteString(vm, s); } +FICL_PLATFORM_EXTERN int ficlExecC(ficlVm *vm, char *pText, ficlInteger nChars) { ficlString s; FICL_STRING_SET_POINTER(s, pText); FICL_STRING_SET_LENGTH(s, nChars); return ficlVmExecuteString(vm, s); } +FICL_PLATFORM_EXTERN int ficlExecXT(ficlVm *vm, ficlWord *word) { return ficlVmExecuteXT(vm, word); } +FICL_PLATFORM_EXTERN void ficlFreeVM(ficlVm *vm) { ficlVmDestroy(vm); } + + + + + +static void thunkTextOut(ficlCallback *callback, char *text) + { + ficlCompatibilityOutputFunction outputFunction; + if ((callback->vm != NULL) && (callback->vm->thunkedTextout != NULL)) + outputFunction = callback->system->thunkedTextout; + else if (callback->system->thunkedTextout != NULL) + outputFunction = callback->system->thunkedTextout; + else + { + ficlCallbackDefaultTextOut(callback, text); + return; + } + ficlCompatibilityTextOutCallback(callback, text, outputFunction); + } + + +FICL_PLATFORM_EXTERN void vmSetTextOut(ficlVm *vm, ficlCompatibilityOutputFunction textOut) + { + vm->thunkedTextout = textOut; + ficlVmSetTextOut(vm, thunkTextOut); + } + +FICL_PLATFORM_EXTERN void vmTextOut (ficlVm *vm, char *text, int fNewline) + { + ficlVmTextOut(vm, text); + if (fNewline) + ficlVmTextOut(vm, "\n"); + } + + +FICL_PLATFORM_EXTERN void ficlTextOut (ficlVm *vm, char *text, int fNewline) + { + vmTextOut(vm, text, fNewline); + } + +extern ficlSystem *ficlSystemGlobal; +static defaultStackSize = FICL_DEFAULT_STACK_SIZE; +FICL_PLATFORM_EXTERN int ficlSetStackSize(int nStackCells) +{ + if (defaultStackSize < nStackCells) + defaultStackSize = nStackCells; + if ((ficlSystemGlobal != NULL) && (ficlSystemGlobal->stackSize < nStackCells)) + ficlSystemGlobal->stackSize = nStackCells; + return defaultStackSize; +} + + +FICL_PLATFORM_EXTERN ficlSystem *ficlInitSystemEx(ficlSystemInformation *fsi) +{ + ficlSystem *returnValue; + ficlCompatibilityOutputFunction thunkedTextout; + ficlSystemInformation clone; + + memcpy(&clone, fsi, sizeof(clone)); + thunkedTextout = (ficlCompatibilityOutputFunction)clone.textOut; + clone.textOut = clone.errorOut = thunkTextOut; + + returnValue = ficlSystemCreate(&clone); + if (returnValue != NULL) + { + returnValue->thunkedTextout = thunkedTextout; + } + return returnValue; +} + + +FICL_PLATFORM_EXTERN ficlSystem *ficlInitSystem(int nDictCells) +{ + ficlSystemInformation fsi; + ficlSystemInformationInitialize(&fsi); + fsi.dictionarySize = nDictCells; + if (fsi.stackSize < defaultStackSize) + fsi.stackSize = defaultStackSize; + return ficlSystemCreate(&fsi); +} + + + + +FICL_PLATFORM_EXTERN ficlVm *ficlNewVM(ficlSystem *system) +{ + ficlVm *returnValue = ficlSystemCreateVm(system); + if (returnValue != NULL) + { + if ((returnValue->callback.textOut != NULL) && (returnValue->callback.textOut != thunkTextOut)) + { + returnValue->thunkedTextout = (ficlCompatibilityOutputFunction)returnValue->callback.textOut; + returnValue->callback.textOut = thunkTextOut; + } + if ((returnValue->callback.errorOut != NULL) && (returnValue->callback.errorOut != thunkTextOut)) + { + if (returnValue->thunkedTextout == NULL) + returnValue->thunkedTextout = (ficlCompatibilityOutputFunction)returnValue->callback.errorOut; + returnValue->callback.errorOut = thunkTextOut; + } + } + return returnValue; +} + + + +FICL_PLATFORM_EXTERN ficlWord *ficlLookup(ficlSystem *system, char *name) { return ficlSystemLookup(system, name); } +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetDict(ficlSystem *system) { return ficlSystemGetDictionary(system); } +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetEnv (ficlSystem *system) { return ficlSystemGetEnvironment(system); } +FICL_PLATFORM_EXTERN void ficlSetEnv (ficlSystem *system, char *name, ficlInteger value) { ficlDictionarySetConstant(ficlSystemGetDictionary(system), name, value); } +FICL_PLATFORM_EXTERN void ficlSetEnvD(ficlSystem *system, char *name, ficlInteger high, ficlInteger low) { ficl2Unsigned value; FICL_2UNSIGNED_SET(low, high, value); ficlDictionarySet2Constant(ficlSystemGetDictionary(system), name, FICL_2UNSIGNED_TO_2INTEGER(value)); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetLoc (ficlSystem *system) { return ficlSystemGetLocals(system); } +#endif +FICL_PLATFORM_EXTERN int ficlBuild(ficlSystem *system, char *name, ficlPrimitive code, char flags) { ficlDictionary *dictionary = ficlSystemGetDictionary(system); ficlDictionaryLock(dictionary, FICL_TRUE); ficlDictionaryAppendPrimitive(dictionary, name, code, flags); ficlDictionaryLock(dictionary, FICL_FALSE); return 0; } +FICL_PLATFORM_EXTERN void ficlCompileCore(ficlSystem *system) { ficlSystemCompileCore(system); } +FICL_PLATFORM_EXTERN void ficlCompilePrefix(ficlSystem *system) { ficlSystemCompilePrefix(system); } +FICL_PLATFORM_EXTERN void ficlCompileSearch(ficlSystem *system) { ficlSystemCompileSearch(system); } +FICL_PLATFORM_EXTERN void ficlCompileSoftCore(ficlSystem *system) { ficlSystemCompileSoftCore(system); } +FICL_PLATFORM_EXTERN void ficlCompileTools(ficlSystem *system) { ficlSystemCompileTools(system); } +FICL_PLATFORM_EXTERN void ficlCompileFile(ficlSystem *system) { ficlSystemCompileFile(system); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void ficlCompileFloat(ficlSystem *system) { ficlSystemCompileFloat(system); } +FICL_PLATFORM_EXTERN int ficlParseFloatNumber( ficlVm *vm, ficlString string) { return ficlVmParseFloatNumber(vm, string); } +#endif +#if FICL_WANT_PLATFORM +FICL_PLATFORM_EXTERN void ficlCompilePlatform(ficlSystem *system) { ficlSystemCompilePlatform(system); } +#endif +FICL_PLATFORM_EXTERN int ficlParsePrefix(ficlVm *vm, ficlString string) { return ficlVmParsePrefix(vm, string); } + +FICL_PLATFORM_EXTERN int ficlParseNumber(ficlVm *vm, ficlString string) { return ficlVmParseNumber(vm, string); } +FICL_PLATFORM_EXTERN void ficlTick(ficlVm *vm) { ficlPrimitiveTick(vm); } +FICL_PLATFORM_EXTERN void parseStepParen(ficlVm *vm) { ficlPrimitiveParseStepParen(vm); } + +FICL_PLATFORM_EXTERN int isAFiclWord(ficlDictionary *dictionary, ficlWord *word) { return ficlDictionaryIsAWord(dictionary, word); } + + +FICL_PLATFORM_EXTERN void buildTestInterface(ficlSystem *system) { ficlSystemCompileExtras(system); } + + Added: vendor/ficl/dist/contrib/xclasses/readme.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/contrib/xclasses/readme.txt Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,111 @@ +XClasses is a simple IDL written in Python. +You declare your classes, methods, and members as Python objects, +and XClasses will generate the .c, .h, and .f files for you. +Not only do the Forth classes line up with their C counterparts +exactly, but all non-static methods (virtual and non-virtual) +are *automatically* thunked. In other words, any method +declared in XClasses and implemented in C can be called from +the matching Ficl class, and the C method will be automatically +called with the correct arguments. XClasses handles floating-point +arguments too! + +Known limitations: + * All arguments must be one cell wide. (That means + only single-precision floats, too.) + + + +To use: + * Declare all your classes in a .py script + * Include "xclasses.h" everywhere you need your classes + * Include xclasses.cpp in your project somewhere + * Call + "xclasses.f" included + from your Ficl initialization script + +And you're mostly done! + +Simply including xclasses.f is not enough, though. You must +explicitly instantiate your classes. This is to allow you a +chance to add your own methods to the class. For a class +named "myCallback", it would look like this: + + declare-myCallback + end-myCallback + +You also have to define the "init" function for the class. +Most of the time this will work fine: + + declare-myCallback + use-default-init + end-myCallback + + +The "default" init function calls the super class's init +function, then sets all data members to 0. If this isn't +what you want, roll your own. The init function takes +the usual 2-cell "this" pointer as its argument: + + declare-myCallback + : init ( 2:this ) ... + ; + end-myCallback + +For a do-nothing init function, you'll want this: + + declare-myCallback + : init 2drop ; + end-myCallback + + +Here's a random example from the simple game I'm working on: + +----------------------------------------------------------------- +skinStream = xMethod("stream", "void").setVirtual(1) +gjeSkin.addMethod(skinStream) + +## +## gjeTexture +## +## +gjeTexture = xClass("gjeTexture") +gjeTexture.setParent(gjeSkin) +gjeTexture.addMethod(skinStream) +gjeTexture.addMethod(xMethod("clear", "void")) +gjeTexture.addMember(xVariable("texture", "LPDIRECT3DTEXTURE8")) +gjeTexture.addMember(xVariable("name", "char *")) +gjeTexture.addMember(xVariable("variation", "int")) +gjeTexture.addMember(xVariable("material", "D3DMATERIAL8 *")) + +----------------------------------------------------------------- + +I sure hope that's enough to get you started. + + + +Random notes: +* XClasses doesn't deal well with struct-packing issues. It assumes + pretty much everything will be 4-byte aligned. This can bite you + if you add a 64-bit int... the C compiler may align it for you, + and XClasses won't know about it. (This could be fixed in a future + release... are you volunteering?) For now, it's best to declare + your classes such that 64-bit ints are naturally 8-byte aligned. + +* If you don't want to have to declare each class in turn, + you can add something like this to the end of your Python script: +----- +def declare(name): + xAddFiclFooter("\t\"" + name + ".constant\" \" sfind swap drop 0= [if] declare-" + name + " use-default-init end-" + name + " [endif] \" evaluate") + + +xAddFiclFooter(": xclassesDeclare") +for c in classes: + declare(c.name) +xAddFiclFooter("\t;") +----- + and then call "xclassesDeclare" from your Ficl script just after + including "xclasses.f". + + +--lch +la...@hastings.org Added: vendor/ficl/dist/contrib/xclasses/xclasses.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/contrib/xclasses/xclasses.py Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,870 @@ +import copy +import string +import sys +import time +import types + + +def capitalize(s): + return string.upper(s[0]) + s[1:] + +def fprint(f, s): + print >> f, s + + +def fprintHeader(f, comment = "//"): + fprint(f, comment) + fprint(f, comment + " Generated by xclasses.py at " + time.strftime("%Y/%m/%d %H:%M:%S")) + fprint(f, comment) + fprint(f, comment) + fprint(f, "") + +def fprintFooter(f, comment = "//"): + fprint(f, "") + fprint(f, "") + fprint(f, comment + " end of file") + fprint(f, "") + +multicallCallTypeFunction = 0 +multicallCallTypeMethod = 1 +multicallCallTypeVirtualMethod = 2 + +multicallReturnTypeVoid = 0 +multicallReturnTypeInteger = 16 +multicallReturnTypeCstring = 32 +multicallReturnTypeFloat = 48 + +multicallExplicitVtable = 512 + + +ficlVmName = "ficlVm" + +h_headers = [] +def xAddHHeader(line): + h_headers.append(line) + +h_footers = [] +def xAddHFooter(line): + h_footers.append(line) + +ficl_headers = [] +def xAddFiclHeader(line): + ficl_headers.append(line) + +ficl_footers = [] +def xAddFiclFooter(line): + ficl_footers.append(line) + +c_headers = [] +def xAddCHeader(line): + c_headers.append(line) + +c_footers = [] +def xAddCFooter(line): + c_footers.append(line) + + +classes = [] + +class xVariable: + def __init__(self, name, typeCPP = None, cells = None, count = None, defaultValue = None, cstring = None): + self.comments = [] + self.setName(name) + self.setCells(cells) + self.setCount(count) + self.setDefaultValue(defaultValue) + self.setCString(cstring) + self.setTypeCPP(typeCPP) + + def setName(self, name): + self.name = name + return self + + def setTypeCPP(self, typeCPP): + self.typeCPP = typeCPP + if (typeCPP == "char *"): + self.setCString(1) + return self + + def setCells(self, cells): + if cells == None: + self.cells = 1 + else: + self.cells = cells + return self + + def setCString(self, cstring): + self.cstring = cstring + return self + + def isCString(self): + return self.cstring + + def getTotalSize(self): + return self.cells * self.count + + def setCount(self, count): + if type(count) != types.IntType: + count = 1 + self.count = count + return self + + def setDefaultValue(self, defaultValue): + if (defaultValue != None) and (type(defaultValue) != types.StringType): + defaultValue = str(defaultValue) + self.defaultValue = defaultValue + return self + + def addComment(self, c): + self.comments.append(c) + return self + + def isFloat(self): + return self.typeCPP == "float" + + def stringCPP(self, wantDefaultValues=1): + if (type(self.typeCPP) != types.StringType): + sys.exit("didn't set a CPP type on variable " + self.name + "!") + output = self.typeCPP + if (self.typeCPP[-1] != "*") and (self.typeCPP[-1] != "&"): + output += " " + output += self.name + if self.count > 1: + output += "[" + str(self.count) + "]" + if self.count == 0: + output += "[]" + if wantDefaultValues and (self.defaultValue != None): + output += " = " + self.defaultValue + return output + + def printH(self, f): + if len(self.comments): + for comment in self.comments: + fprint(f, "\t" + "// " + comment) + fprint(f, "\t" + self.stringCPP() + ";") + + def printF(self, f): + totalCells = self.count * self.cells + if (totalCells <= 1): + typeF = "cell:" + else: + typeF = str(totalCells) + " cells:" + if len(self.comments): + for comment in self.comments: + fprint(f, "\t" + "// " + comment) + fprint(f, "\t" + "S\" " + typeF + " ." + self.name + " \" evaluate") + + +class xMethod: + def __init__(self, name, returnType = None, virtual = None, static = None, body = None): + self.arguments = [] + self.comments = [] + + self.setName(name) + self.setReturnType(returnType) + self.setVirtual(virtual) + self.setStatic(static) + self.setBody(body) + self.setThunkVariable(None) + self.vtableOffset = 0 + + def copy(): + clone = xMethod(self.name, self.returnType, self.virtual, self.static) + clone.arguments = self.arguments + clone.comments = self.comments + + def setName(self, name): + self.name = name + return self + + def setReturnType(self, returnType): + if returnType.__class__ == xVariable: + self.returnType = returnType + elif type(returnType) == types.StringType: + self.returnType = xVariable("ignored", returnType) + else: + self.returnType = None + return self + + def returnTypeIsVoid(self): + return(self.returnType == None) or (self.returnType.typeCPP == None) or (self.returnType.typeCPP == "") or (self.returnType.typeCPP == "void") + + def setVirtual(self, virtual): + self.virtual = virtual + return self + + def isVirtual(self): + return self.virtual > 0 + + def isPureVirtual(self): + return self.virtual > 1 + + def setStatic(self, static): + self.static = static + return self + + def setThunkVariable(self, thunkVariable): + self.thunkVariable = thunkVariable + return self + + def isStatic(self): + return self.static + + # a constructor or a destructor + def isClassSpecial(self): + return (self.returnType == None) or (self.returnType.typeCPP == None) or (self.returnType.typeCPP == "") + + def setBody(self, body): + self.body = body + return self + + def addArgument(self, argument): + self.arguments.append(argument) + return self + + def addComment(self, c): + self.comments.append(c) + return self + + def prototype(self, isDefinition=None): + arguments = "" + for a in self.arguments: + if len(arguments): + arguments += ", " + arguments += a.stringCPP(not isDefinition) + + if len(arguments) == 0: + arguments = "void" + className = "" + if (isDefinition): + className = self.memberOf.name + "::" + modifiers = "" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"