├── .gitattributes ├── .gitignore ├── Flatland Standalone.sln ├── Flatland Standalone ├── Bitmaps │ ├── ARROW_E.CUR │ ├── ARROW_N.CUR │ ├── ARROW_NE.CUR │ ├── ARROW_NW.CUR │ ├── ARROW_S.CUR │ ├── ARROW_SE.CUR │ ├── ARROW_SW.CUR │ ├── ARROW_W.CUR │ ├── Builder0.gif │ ├── Builder1.gif │ ├── Directory0.gif │ ├── Directory1.gif │ ├── HAND.CUR │ ├── History0.gif │ ├── History1.gif │ ├── Light0.gif │ ├── Light1.gif │ ├── Logo.gif │ ├── Options0.gif │ ├── Options1.gif │ ├── Right.gif │ ├── Splash.gif │ ├── Title_bg.gif │ ├── Title_end.gif │ ├── command0.gif │ └── command1.gif ├── Classes.cpp ├── Classes.h ├── Collision │ ├── Col.cpp │ ├── Col.h │ ├── Collision.cpp │ ├── Collision.h │ ├── Mat.cpp │ ├── Mat.h │ ├── Maths.cpp │ ├── Maths.h │ ├── Vec.cpp │ └── Vec.h ├── Expat │ ├── COPYING │ ├── ascii.h │ ├── asciitab.h │ ├── expat.h │ ├── expat_external.h │ ├── iasciitab.h │ ├── internal.h │ ├── latin1tab.h │ ├── nametab.h │ ├── siphash.h │ ├── utf8tab.h │ ├── winconfig.h │ ├── xmlparse.c │ ├── xmlrole.c │ ├── xmlrole.h │ ├── xmltok.c │ ├── xmltok.h │ ├── xmltok_impl.c │ ├── xmltok_impl.h │ └── xmltok_ns.c ├── Fileio.cpp ├── Fileio.h ├── Flatland Standalone.cpp ├── Flatland Standalone.ico ├── Flatland Standalone.rc ├── Flatland Standalone.vcxproj ├── Flatland Standalone.vcxproj.filters ├── Image.cpp ├── Image.h ├── Jpeg │ ├── JCAPIMIN.C │ ├── JCAPISTD.C │ ├── JCCOEFCT.C │ ├── JCCOLOR.C │ ├── JCDCTMGR.C │ ├── JCHUFF.C │ ├── JCHUFF.H │ ├── JCINIT.C │ ├── JCMAINCT.C │ ├── JCMARKER.C │ ├── JCMASTER.C │ ├── JCOMAPI.C │ ├── JCPARAM.C │ ├── JCPHUFF.C │ ├── JCPREPCT.C │ ├── JCSAMPLE.C │ ├── JCTRANS.C │ ├── JDAPIMIN.C │ ├── JDAPISTD.C │ ├── JDATADST.C │ ├── JDATASRC.C │ ├── JDCOEFCT.C │ ├── JDCOLOR.C │ ├── JDCT.H │ ├── JDDCTMGR.C │ ├── JDHUFF.C │ ├── JDHUFF.H │ ├── JDINPUT.C │ ├── JDMAINCT.C │ ├── JDMARKER.C │ ├── JDMASTER.C │ ├── JDMERGE.C │ ├── JDPHUFF.C │ ├── JDPOSTCT.C │ ├── JDSAMPLE.C │ ├── JDTRANS.C │ ├── JERROR.C │ ├── JERROR.H │ ├── JFDCTFLT.C │ ├── JFDCTFST.C │ ├── JFDCTINT.C │ ├── JIDCTFLT.C │ ├── JIDCTFST.C │ ├── JIDCTINT.C │ ├── JIDCTRED.C │ ├── JINCLUDE.H │ ├── JMEMMGR.C │ ├── JMEMNOBS.C │ ├── JMEMSYS.H │ ├── JMORECFG.H │ ├── JPEGINT.H │ ├── JPEGLIB.H │ ├── JQUANT1.C │ ├── JQUANT2.C │ ├── JUTILS.C │ ├── JVERSION.H │ ├── README │ └── jconfig.h ├── LibPNG │ ├── example.c │ ├── png.c │ ├── png.h │ ├── pngconf.h │ ├── pngdebug.h │ ├── pngerror.c │ ├── pngget.c │ ├── pnginfo.h │ ├── pnglibconf.h │ ├── pngmem.c │ ├── pngpread.c │ ├── pngpriv.h │ ├── pngread.c │ ├── pngrio.c │ ├── pngrtran.c │ ├── pngrutil.c │ ├── pngset.c │ ├── pngstruct.h │ ├── pngtrans.c │ ├── pngwio.c │ ├── pngwrite.c │ ├── pngwtran.c │ └── pngwutil.c ├── Light.cpp ├── Light.h ├── Main.cpp ├── Main.h ├── Memory.cpp ├── Memory.h ├── Parser.cpp ├── Parser.h ├── Platform.h ├── Plugin.cpp ├── Plugin.h ├── Plugin │ ├── jni.h │ ├── jni_md.h │ ├── jri.h │ ├── jri_md.h │ ├── jritypes.h │ ├── npapi.h │ ├── npupp.h │ └── npwin.cpp ├── ReadMe.txt ├── Render.cpp ├── Render.h ├── Resource.h ├── SimKin.cpp ├── SimKin.h ├── Simkin │ ├── LGPL.txt │ ├── skAlist.cpp │ ├── skAlist.h │ ├── skAlist.inl │ ├── skAttribute.cpp │ ├── skAttribute.h │ ├── skBoundsException.h │ ├── skCDataNode.cpp │ ├── skCDataNode.h │ ├── skConstants.cpp │ ├── skConstants.h │ ├── skElement.cpp │ ├── skElement.h │ ├── skElementExecutable.cpp │ ├── skElementExecutable.h │ ├── skElementObject.cpp │ ├── skElementObject.h │ ├── skElementObjectEnumerator.cpp │ ├── skElementObjectEnumerator.h │ ├── skException.h │ ├── skExecutable.cpp │ ├── skExecutable.h │ ├── skExecutableContext.cpp │ ├── skExecutableContext.h │ ├── skExecutableIterator.cpp │ ├── skExecutableIterator.h │ ├── skExpatParser.cpp │ ├── skExpatParser.h │ ├── skGeneral.h │ ├── skHashTable.cpp │ ├── skHashTable.h │ ├── skHashTable.inl │ ├── skInputSource.cpp │ ├── skInputSource.h │ ├── skInterpreter.cpp │ ├── skInterpreter.h │ ├── skInterpreterByte.cpp │ ├── skInterpreterNode.cpp │ ├── skKeywords.inl │ ├── skLang_tab.cpp │ ├── skMethodTable.h │ ├── skNode.cpp │ ├── skNode.h │ ├── skNull.h │ ├── skOutputDestination.cpp │ ├── skOutputDestination.h │ ├── skParseException.h │ ├── skParseNode.cpp │ ├── skParseNode.h │ ├── skParseNode.inl │ ├── skParser.cpp │ ├── skParser.h │ ├── skRValue.cpp │ ├── skRValue.h │ ├── skRValue.inl │ ├── skRValueArray.h │ ├── skRValueTable.h │ ├── skRuntimeException.h │ ├── skSHashTable.cpp │ ├── skSHashTable.h │ ├── skSHashTable.inl │ ├── skStackFrame.cpp │ ├── skStackFrame.h │ ├── skStatementStepper.h │ ├── skString.cpp │ ├── skString.h │ ├── skString.inl │ ├── skStringBuffer.cpp │ ├── skStringBuffer.h │ ├── skStringList.h │ ├── skStringTokenizer.cpp │ ├── skStringTokenizer.h │ ├── skTextNode.cpp │ ├── skTextNode.h │ ├── skTraceCallback.h │ ├── skTracer.cpp │ ├── skTracer.h │ ├── skValist.h │ ├── skXMLParseException.h │ ├── skiExecutable.h │ └── skosfcn.h ├── Spans.cpp ├── Spans.h ├── Tags.h ├── Tokens.h ├── Unzip │ ├── crypt.h │ ├── ioapi.c │ ├── ioapi.h │ ├── unzip.c │ ├── unzip.h │ ├── zip.c │ └── zip.h ├── Utils.cpp ├── Utils.h ├── Win32.cpp ├── roverresource.h ├── roverresources.rc ├── small.ico ├── stdafx.cpp ├── stdafx.h ├── targetver.h └── zlib │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Flatland Standalone.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Flatland Standalone", "Flatland Standalone\Flatland Standalone.vcxproj", "{17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}.Debug|x64.ActiveCfg = Debug|x64 17 | {17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}.Debug|x64.Build.0 = Debug|x64 18 | {17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}.Debug|x86.ActiveCfg = Debug|Win32 19 | {17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}.Debug|x86.Build.0 = Debug|Win32 20 | {17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}.Release|x64.ActiveCfg = Release|x64 21 | {17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}.Release|x64.Build.0 = Release|x64 22 | {17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}.Release|x86.ActiveCfg = Release|Win32 23 | {17CFF0D6-FDA7-4916-A946-1F6C70F29FCE}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/ARROW_E.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/ARROW_E.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/ARROW_N.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/ARROW_N.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/ARROW_NE.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/ARROW_NE.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/ARROW_NW.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/ARROW_NW.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/ARROW_S.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/ARROW_S.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/ARROW_SE.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/ARROW_SE.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/ARROW_SW.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/ARROW_SW.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/ARROW_W.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/ARROW_W.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Builder0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Builder0.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Builder1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Builder1.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Directory0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Directory0.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Directory1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Directory1.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/HAND.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/HAND.CUR -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/History0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/History0.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/History1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/History1.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Light0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Light0.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Light1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Light1.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Logo.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Options0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Options0.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Options1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Options1.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Right.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Right.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Splash.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Splash.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Title_bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Title_bg.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/Title_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/Title_end.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/command0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/command0.gif -------------------------------------------------------------------------------- /Flatland Standalone/Bitmaps/command1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Bitmaps/command1.gif -------------------------------------------------------------------------------- /Flatland Standalone/Collision/Collision.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | /******************************************************************** 7 | 8 | DESCRIPTION : Header file 9 | 10 | AUTHOR : Matt Wilkinson 11 | 12 | ********************************************************************/ 13 | 14 | 15 | #ifndef _COLLISION_H 16 | #define _COLLISION_H 17 | 18 | /*-------------------------------------------------------------- 19 | 20 | Includes 21 | 22 | --------------------------------------------------------------*/ 23 | 24 | #include "col.h" 25 | struct block; 26 | struct block_def; 27 | 28 | 29 | /*-------------------------------------------------------------- 30 | 31 | Defines 32 | 33 | --------------------------------------------------------------*/ 34 | 35 | 36 | /*-------------------------------------------------------------- 37 | 38 | Structures & Classes 39 | 40 | --------------------------------------------------------------*/ 41 | 42 | 43 | /*-------------------------------------------------------------- 44 | 45 | Prototypes 46 | 47 | --------------------------------------------------------------*/ 48 | 49 | bool 50 | COL_createBlockColMesh(block *block_ptr); 51 | 52 | void 53 | COL_convertBlockToColMesh(block *block_ptr); 54 | 55 | bool 56 | COL_createSpriteColMesh(block *block_ptr); 57 | 58 | void 59 | COL_convertSpriteToColMesh(COL_MESH *mesh_ptr, float minX, float minY, 60 | float minZ, float maxX, float maxY, float maxZ); 61 | 62 | /*-------------------------------------------------------------- 63 | 64 | Externs 65 | 66 | --------------------------------------------------------------*/ 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /Flatland Standalone/Collision/Mat.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | #ifndef _MAT_H 7 | #define _MAT_H 8 | 9 | /*-------------------------------------------------------------- 10 | 11 | Structures & Classes 12 | 13 | --------------------------------------------------------------*/ 14 | 15 | struct MAT33 16 | { 17 | float Xx; 18 | float Xy; 19 | float Xz; 20 | 21 | float Yx; 22 | float Yy; 23 | float Yz; 24 | 25 | float Zx; 26 | float Zy; 27 | float Zz; 28 | }; 29 | 30 | 31 | /*-------------------------------------------------------------- 32 | 33 | Prototypes 34 | 35 | --------------------------------------------------------------*/ 36 | 37 | void MAT_setIdentity(MAT33 *mat_p); 38 | void MAT_mulInv(MAT33 *mat1_p, MAT33 *mat2_p, MAT33 *destMat_p); 39 | void MAT_mul(MAT33 *mat1_p, MAT33 *mat2_p, MAT33 *destMat_p); 40 | void MAT_setRot(MAT33 *mat_p, float az, float el, float tw); 41 | void MAT_copyInv(MAT33 *mat_p, MAT33 *destMat_p); 42 | 43 | 44 | /*-------------------------------------------------------------- 45 | 46 | Externs 47 | 48 | --------------------------------------------------------------*/ 49 | 50 | 51 | #endif -------------------------------------------------------------------------------- /Flatland Standalone/Collision/Maths.cpp: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | /*-------------------------------------------------------------- 7 | 8 | Include files 9 | 10 | --------------------------------------------------------------*/ 11 | 12 | #include 13 | #include 14 | #include 15 | #include "maths.h" 16 | #include "../Classes.h" 17 | #include "../Memory.h" 18 | 19 | /*-------------------------------------------------------------- 20 | 21 | Private Variables 22 | 23 | --------------------------------------------------------------*/ 24 | 25 | float *cosTab = NULL, 26 | *sinTab = NULL, 27 | MATHS_gSqrtTable[NUM_SQRT_ENTRIES]; 28 | uMATHS_FLOAT_INT MATHS_gFloatInt; 29 | 30 | 31 | /*-------------------------------------------------------------- 32 | 33 | Initialise the maths tables, etc. 34 | 35 | --------------------------------------------------------------*/ 36 | 37 | void MATHS_init(void) 38 | { 39 | int i; 40 | double num; 41 | 42 | NEWARRAY(cosTab, float, COSTAB_ENTRIES); 43 | NEWARRAY(sinTab, float, SINTAB_ENTRIES); 44 | 45 | //------ Now set up the tables ----------------------------- 46 | 47 | num = 0; 48 | for (i=0; i> 13) & 0xffff]); 129 | } 130 | 131 | 132 | -------------------------------------------------------------------------------- /Flatland Standalone/Collision/Maths.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | #ifndef _MATHS_H 7 | #define _MATHS_H 8 | 9 | /*-------------------------------------------------------------- 10 | 11 | Defines 12 | 13 | --------------------------------------------------------------*/ 14 | 15 | #define COSTAB_ENTRIES 65536 16 | #define SINTAB_ENTRIES 65536 17 | #define COSTAB_MASK 0xffff 18 | #define SINTAB_MASK 0xffff 19 | 20 | #define TWOPI (float)6.283185307 21 | #define TWOPI_D (double)6.283185307 22 | 23 | #define COSTAB_SCALE (float)(COSTAB_ENTRIES/TWOPI) 24 | #define SINTAB_SCALE (float)(SINTAB_ENTRIES/TWOPI) 25 | 26 | #define NUM_SQRT_ENTRIES 65536 27 | #define HALF_SQRT_ENTRIES (NUM_SQRT_ENTRIES / 2) 28 | 29 | 30 | /*-------------------------------------------------------------- 31 | 32 | Macros 33 | 34 | --------------------------------------------------------------*/ 35 | 36 | #define SIGN(a) ((a)>0.0 ? (true) : (false)) 37 | #define BNEG(a) ((a)>0.0 ? (false) : (true)) 38 | 39 | 40 | //------ Swaps two variables of the same type ----------------- 41 | 42 | #define swap( a, b, type ) { type temp(a); a=b; b=temp; } 43 | 44 | 45 | //------ Returns the maximum of two values --------------------- 46 | 47 | #define MAX2( a, b ) (((a) > (b)) ? (a) : (b)) 48 | 49 | //------ Returns the maximum of three values ------------------- 50 | 51 | #define MAX3(a,b,c) (MAX2(a,MAX2(b,c))) 52 | 53 | 54 | /*-------------------------------------------------------------- 55 | 56 | Structures & Classes 57 | 58 | --------------------------------------------------------------*/ 59 | 60 | typedef union _uMATHS_FLOAT_INT 61 | { 62 | 63 | float f; 64 | unsigned int i; 65 | 66 | } uMATHS_FLOAT_INT; 67 | 68 | 69 | /*-------------------------------------------------------------- 70 | 71 | Prototypes 72 | 73 | --------------------------------------------------------------*/ 74 | 75 | void MATHS_init(void); 76 | void MATHS_exit(void); 77 | float MATHS_cos(float num); 78 | float MATHS_sin(float num); 79 | float MATHS_sqrt(float num); 80 | 81 | 82 | /*-------------------------------------------------------------- 83 | 84 | Externs 85 | 86 | --------------------------------------------------------------*/ 87 | 88 | 89 | #endif -------------------------------------------------------------------------------- /Flatland Standalone/Collision/Vec.cpp: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | /*-------------------------------------------------------------- 7 | 8 | Include files 9 | 10 | --------------------------------------------------------------*/ 11 | 12 | #include "vec.h" 13 | #include "maths.h" 14 | 15 | 16 | /*-------------------------------------------------------------- 17 | 18 | Set the values of a vector 19 | 20 | --------------------------------------------------------------*/ 21 | 22 | void VEC_set(VEC3 *vec_p, float x, float y, float z) 23 | { 24 | vec_p->x = x; 25 | vec_p->y = y; 26 | vec_p->z = z; 27 | } 28 | 29 | 30 | /*-------------------------------------------------------------- 31 | 32 | Subtract two vectors 33 | 34 | --------------------------------------------------------------*/ 35 | 36 | void VEC_sub(VEC3 *vec1, VEC3 *vec2, VEC3 *vec3) 37 | { 38 | vec3->x = vec1->x-vec2->x; 39 | vec3->y = vec1->y-vec2->y; 40 | vec3->z = vec1->z-vec2->z; 41 | } 42 | 43 | 44 | /*-------------------------------------------------------------- 45 | 46 | Add two vectors 47 | 48 | --------------------------------------------------------------*/ 49 | 50 | void VEC_add(VEC3 *vec1, VEC3 *vec2, VEC3 *vec3) 51 | { 52 | vec3->x = vec1->x+vec2->x; 53 | vec3->y = vec1->y+vec2->y; 54 | vec3->z = vec1->z+vec2->z; 55 | } 56 | 57 | 58 | /*-------------------------------------------------------------- 59 | 60 | Multiply a vector by a matrix 61 | 62 | --------------------------------------------------------------*/ 63 | 64 | void VEC_mulMat(VEC3 *vec_p, MAT33 *mat_p, VEC3 *destVec_p) 65 | { 66 | destVec_p->x = (vec_p->x * mat_p->Xx) + (vec_p->y * mat_p->Yx) + (vec_p->z * mat_p->Zx); 67 | destVec_p->y = (vec_p->x * mat_p->Xy) + (vec_p->y * mat_p->Yy) + (vec_p->z * mat_p->Zy); 68 | destVec_p->z = (vec_p->x * mat_p->Xz) + (vec_p->y * mat_p->Yz) + (vec_p->z * mat_p->Zz); 69 | } 70 | 71 | 72 | /*-------------------------------------------------------------- 73 | 74 | Inversely multiply a vector by a matrix 75 | 76 | --------------------------------------------------------------*/ 77 | 78 | void VEC_mulMatInv(VEC3 *vec_p, MAT33 *mat_p, VEC3 *destVec_p) 79 | { 80 | destVec_p->x = (vec_p->x * mat_p->Xx) + (vec_p->y * mat_p->Xy) + (vec_p->z * mat_p->Xz); 81 | destVec_p->y = (vec_p->x * mat_p->Yx) + (vec_p->y * mat_p->Yy) + (vec_p->z * mat_p->Yz); 82 | destVec_p->z = (vec_p->x * mat_p->Zx) + (vec_p->y * mat_p->Zy) + (vec_p->z * mat_p->Zz); 83 | } 84 | 85 | 86 | /*-------------------------------------------------------------- 87 | 88 | Return the dot product of two vectors 89 | 90 | --------------------------------------------------------------*/ 91 | 92 | float VEC_dot(VEC3 *vec1_p, VEC3 *vec2_p) 93 | { 94 | return ((vec1_p->x*vec2_p->x) + (vec1_p->y*vec2_p->y) + (vec1_p->z*vec2_p->z)); 95 | } 96 | 97 | 98 | /*-------------------------------------------------------------- 99 | 100 | Normalise the vector 101 | 102 | --------------------------------------------------------------*/ 103 | 104 | void VEC_normalise(VEC3 *vec_p) 105 | { 106 | float norm; 107 | 108 | 109 | norm = (float)MATHS_sqrt(vec_p->x*vec_p->x + vec_p->y*vec_p->y + vec_p->z*vec_p->z); 110 | 111 | vec_p->x = vec_p->x / norm; 112 | vec_p->y = vec_p->y / norm; 113 | vec_p->z = vec_p->z / norm; 114 | } 115 | 116 | 117 | /*-------------------------------------------------------------- 118 | 119 | Return the length of the vector 120 | 121 | --------------------------------------------------------------*/ 122 | 123 | float VEC_length(VEC3 *vec_p) 124 | { 125 | return((float)MATHS_sqrt(vec_p->x*vec_p->x + vec_p->y*vec_p->y + vec_p->z*vec_p->z)); 126 | } -------------------------------------------------------------------------------- /Flatland Standalone/Collision/Vec.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | #ifndef _VEC_H 7 | #define _VEC_H 8 | 9 | /*-------------------------------------------------------------- 10 | 11 | Includes 12 | 13 | --------------------------------------------------------------*/ 14 | 15 | #include "mat.h" 16 | 17 | /*-------------------------------------------------------------- 18 | 19 | Macros 20 | 21 | --------------------------------------------------------------*/ 22 | 23 | //------ This converts the signs of the vector elements ---- 24 | //------ into a numerical value ---------------------------- 25 | 26 | #define VEC3_SIGNS(vecX, vecY, vecZ) ((BNEG(vecX)<<2) + (BNEG(vecY)<<1) + BNEG(vecZ)); 27 | 28 | 29 | /*-------------------------------------------------------------- 30 | 31 | Structures & Classes 32 | 33 | --------------------------------------------------------------*/ 34 | 35 | struct VEC3 36 | { 37 | float x; 38 | float y; 39 | float z; 40 | }; 41 | 42 | 43 | /*-------------------------------------------------------------- 44 | 45 | Prototypes 46 | 47 | --------------------------------------------------------------*/ 48 | 49 | void VEC_set(VEC3 *vec_p, float x, float y, float z); 50 | void VEC_sub(VEC3 *vec1, VEC3 *vec2, VEC3 *vec3); 51 | void VEC_add(VEC3 *vec1, VEC3 *vec2, VEC3 *vec3); 52 | void VEC_mulMat(VEC3 *vec_p, MAT33 *mat_p, VEC3 *destVec_p); 53 | void VEC_mulMatInv(VEC3 *vec_p, MAT33 *mat_p, VEC3 *destVec_p); 54 | float VEC_dot(VEC3 *vec1_p, VEC3 *vec2_p); 55 | void VEC_normalise(VEC3 *vec_p); 56 | float VEC_length(VEC3 *vec_p); 57 | 58 | 59 | /*-------------------------------------------------------------- 60 | 61 | Externs 62 | 63 | --------------------------------------------------------------*/ 64 | 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper 2 | Copyright (c) 2001-2017 Expat maintainers 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included 13 | in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/ascii.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | #define ASCII_A 0x41 6 | #define ASCII_B 0x42 7 | #define ASCII_C 0x43 8 | #define ASCII_D 0x44 9 | #define ASCII_E 0x45 10 | #define ASCII_F 0x46 11 | #define ASCII_G 0x47 12 | #define ASCII_H 0x48 13 | #define ASCII_I 0x49 14 | #define ASCII_J 0x4A 15 | #define ASCII_K 0x4B 16 | #define ASCII_L 0x4C 17 | #define ASCII_M 0x4D 18 | #define ASCII_N 0x4E 19 | #define ASCII_O 0x4F 20 | #define ASCII_P 0x50 21 | #define ASCII_Q 0x51 22 | #define ASCII_R 0x52 23 | #define ASCII_S 0x53 24 | #define ASCII_T 0x54 25 | #define ASCII_U 0x55 26 | #define ASCII_V 0x56 27 | #define ASCII_W 0x57 28 | #define ASCII_X 0x58 29 | #define ASCII_Y 0x59 30 | #define ASCII_Z 0x5A 31 | 32 | #define ASCII_a 0x61 33 | #define ASCII_b 0x62 34 | #define ASCII_c 0x63 35 | #define ASCII_d 0x64 36 | #define ASCII_e 0x65 37 | #define ASCII_f 0x66 38 | #define ASCII_g 0x67 39 | #define ASCII_h 0x68 40 | #define ASCII_i 0x69 41 | #define ASCII_j 0x6A 42 | #define ASCII_k 0x6B 43 | #define ASCII_l 0x6C 44 | #define ASCII_m 0x6D 45 | #define ASCII_n 0x6E 46 | #define ASCII_o 0x6F 47 | #define ASCII_p 0x70 48 | #define ASCII_q 0x71 49 | #define ASCII_r 0x72 50 | #define ASCII_s 0x73 51 | #define ASCII_t 0x74 52 | #define ASCII_u 0x75 53 | #define ASCII_v 0x76 54 | #define ASCII_w 0x77 55 | #define ASCII_x 0x78 56 | #define ASCII_y 0x79 57 | #define ASCII_z 0x7A 58 | 59 | #define ASCII_0 0x30 60 | #define ASCII_1 0x31 61 | #define ASCII_2 0x32 62 | #define ASCII_3 0x33 63 | #define ASCII_4 0x34 64 | #define ASCII_5 0x35 65 | #define ASCII_6 0x36 66 | #define ASCII_7 0x37 67 | #define ASCII_8 0x38 68 | #define ASCII_9 0x39 69 | 70 | #define ASCII_TAB 0x09 71 | #define ASCII_SPACE 0x20 72 | #define ASCII_EXCL 0x21 73 | #define ASCII_QUOT 0x22 74 | #define ASCII_AMP 0x26 75 | #define ASCII_APOS 0x27 76 | #define ASCII_MINUS 0x2D 77 | #define ASCII_PERIOD 0x2E 78 | #define ASCII_COLON 0x3A 79 | #define ASCII_SEMI 0x3B 80 | #define ASCII_LT 0x3C 81 | #define ASCII_EQUALS 0x3D 82 | #define ASCII_GT 0x3E 83 | #define ASCII_LSQB 0x5B 84 | #define ASCII_RSQB 0x5D 85 | #define ASCII_UNDERSCORE 0x5F 86 | #define ASCII_LPAREN 0x28 87 | #define ASCII_RPAREN 0x29 88 | #define ASCII_FF 0x0C 89 | #define ASCII_SLASH 0x2F 90 | #define ASCII_HASH 0x23 91 | #define ASCII_PIPE 0x7C 92 | #define ASCII_COMMA 0x2C 93 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/asciitab.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 6 | /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 7 | /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, 8 | /* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, 9 | /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 10 | /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 11 | /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 12 | /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 13 | /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, 14 | /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, 15 | /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, 16 | /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, 17 | /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, 18 | /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, 19 | /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, 20 | /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, 21 | /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, 22 | /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, 23 | /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 24 | /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 25 | /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 26 | /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 27 | /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, 28 | /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, 29 | /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, 30 | /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, 31 | /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 32 | /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 33 | /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 34 | /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 35 | /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, 36 | /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, 37 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/expat_external.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | #ifndef Expat_External_INCLUDED 6 | #define Expat_External_INCLUDED 1 7 | 8 | /* External API definitions */ 9 | 10 | #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) 11 | #define XML_USE_MSC_EXTENSIONS 1 12 | #endif 13 | 14 | /* Expat tries very hard to make the API boundary very specifically 15 | defined. There are two macros defined to control this boundary; 16 | each of these can be defined before including this header to 17 | achieve some different behavior, but doing so it not recommended or 18 | tested frequently. 19 | 20 | XMLCALL - The calling convention to use for all calls across the 21 | "library boundary." This will default to cdecl, and 22 | try really hard to tell the compiler that's what we 23 | want. 24 | 25 | XMLIMPORT - Whatever magic is needed to note that a function is 26 | to be imported from a dynamically loaded library 27 | (.dll, .so, or .sl, depending on your platform). 28 | 29 | The XMLCALL macro was added in Expat 1.95.7. The only one which is 30 | expected to be directly useful in client code is XMLCALL. 31 | 32 | Note that on at least some Unix versions, the Expat library must be 33 | compiled with the cdecl calling convention as the default since 34 | system headers may assume the cdecl convention. 35 | */ 36 | #ifndef XMLCALL 37 | #if defined(_MSC_VER) 38 | #define XMLCALL __cdecl 39 | #elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) 40 | #define XMLCALL __attribute__((cdecl)) 41 | #else 42 | /* For any platform which uses this definition and supports more than 43 | one calling convention, we need to extend this definition to 44 | declare the convention used on that platform, if it's possible to 45 | do so. 46 | 47 | If this is the case for your platform, please file a bug report 48 | with information on how to identify your platform via the C 49 | pre-processor and how to specify the same calling convention as the 50 | platform's malloc() implementation. 51 | */ 52 | #define XMLCALL 53 | #endif 54 | #endif /* not defined XMLCALL */ 55 | 56 | 57 | #if !defined(XML_STATIC) && !defined(XMLIMPORT) 58 | #ifndef XML_BUILDING_EXPAT 59 | /* using Expat from an application */ 60 | 61 | #ifdef XML_USE_MSC_EXTENSIONS 62 | #define XMLIMPORT __declspec(dllimport) 63 | #endif 64 | 65 | #endif 66 | #endif /* not defined XML_STATIC */ 67 | 68 | #if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4) 69 | #define XMLIMPORT __attribute__ ((visibility ("default"))) 70 | #endif 71 | 72 | /* If we didn't define it above, define it away: */ 73 | #ifndef XMLIMPORT 74 | #define XMLIMPORT 75 | #endif 76 | 77 | #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) 78 | #define XML_ATTR_MALLOC __attribute__((__malloc__)) 79 | #else 80 | #define XML_ATTR_MALLOC 81 | #endif 82 | 83 | #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) 84 | #define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) 85 | #else 86 | #define XML_ATTR_ALLOC_SIZE(x) 87 | #endif 88 | 89 | #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL 90 | 91 | #ifdef __cplusplus 92 | extern "C" { 93 | #endif 94 | 95 | #ifdef XML_UNICODE_WCHAR_T 96 | # define XML_UNICODE 97 | # if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2) 98 | # error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc" 99 | # endif 100 | #endif 101 | 102 | #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ 103 | #ifdef XML_UNICODE_WCHAR_T 104 | typedef wchar_t XML_Char; 105 | typedef wchar_t XML_LChar; 106 | #else 107 | typedef unsigned short XML_Char; 108 | typedef char XML_LChar; 109 | #endif /* XML_UNICODE_WCHAR_T */ 110 | #else /* Information is UTF-8 encoded. */ 111 | typedef char XML_Char; 112 | typedef char XML_LChar; 113 | #endif /* XML_UNICODE */ 114 | 115 | #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ 116 | #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 117 | typedef __int64 XML_Index; 118 | typedef unsigned __int64 XML_Size; 119 | #else 120 | typedef long long XML_Index; 121 | typedef unsigned long long XML_Size; 122 | #endif 123 | #else 124 | typedef long XML_Index; 125 | typedef unsigned long XML_Size; 126 | #endif /* XML_LARGE_SIZE */ 127 | 128 | #ifdef __cplusplus 129 | } 130 | #endif 131 | 132 | #endif /* not Expat_External_INCLUDED */ 133 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/iasciitab.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ 6 | /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 7 | /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 8 | /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, 9 | /* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, 10 | /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 11 | /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 12 | /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 13 | /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 14 | /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, 15 | /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, 16 | /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, 17 | /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, 18 | /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, 19 | /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, 20 | /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, 21 | /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, 22 | /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, 23 | /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, 24 | /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 25 | /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 26 | /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 27 | /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 28 | /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, 29 | /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, 30 | /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, 31 | /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, 32 | /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 33 | /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 34 | /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 35 | /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 36 | /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, 37 | /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, 38 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/internal.h: -------------------------------------------------------------------------------- 1 | /* internal.h 2 | 3 | Internal definitions used by Expat. This is not needed to compile 4 | client code. 5 | 6 | The following calling convention macros are defined for frequently 7 | called functions: 8 | 9 | FASTCALL - Used for those internal functions that have a simple 10 | body and a low number of arguments and local variables. 11 | 12 | PTRCALL - Used for functions called though function pointers. 13 | 14 | PTRFASTCALL - Like PTRCALL, but for low number of arguments. 15 | 16 | inline - Used for selected internal functions for which inlining 17 | may improve performance on some platforms. 18 | 19 | Note: Use of these macros is based on judgement, not hard rules, 20 | and therefore subject to change. 21 | */ 22 | 23 | #if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) 24 | /* We'll use this version by default only where we know it helps. 25 | 26 | regparm() generates warnings on Solaris boxes. See SF bug #692878. 27 | 28 | Instability reported with egcs on a RedHat Linux 7.3. 29 | Let's comment out: 30 | #define FASTCALL __attribute__((stdcall, regparm(3))) 31 | and let's try this: 32 | */ 33 | #define FASTCALL __attribute__((regparm(3))) 34 | #define PTRFASTCALL __attribute__((regparm(3))) 35 | #endif 36 | 37 | /* Using __fastcall seems to have an unexpected negative effect under 38 | MS VC++, especially for function pointers, so we won't use it for 39 | now on that platform. It may be reconsidered for a future release 40 | if it can be made more effective. 41 | Likely reason: __fastcall on Windows is like stdcall, therefore 42 | the compiler cannot perform stack optimizations for call clusters. 43 | */ 44 | 45 | /* Make sure all of these are defined if they aren't already. */ 46 | 47 | #ifndef FASTCALL 48 | #define FASTCALL 49 | #endif 50 | 51 | #ifndef PTRCALL 52 | #define PTRCALL 53 | #endif 54 | 55 | #ifndef PTRFASTCALL 56 | #define PTRFASTCALL 57 | #endif 58 | 59 | #ifndef XML_MIN_SIZE 60 | #if !defined(__cplusplus) && !defined(inline) 61 | #ifdef __GNUC__ 62 | #define inline __inline 63 | #endif /* __GNUC__ */ 64 | #endif 65 | #endif /* XML_MIN_SIZE */ 66 | 67 | #ifdef __cplusplus 68 | #define inline inline 69 | #else 70 | #ifndef inline 71 | #define inline 72 | #endif 73 | #endif 74 | 75 | #ifndef UNUSED_P 76 | # ifdef __GNUC__ 77 | # define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__)) 78 | # else 79 | # define UNUSED_P(p) UNUSED_ ## p 80 | # endif 81 | #endif 82 | 83 | 84 | #ifdef __cplusplus 85 | extern "C" { 86 | #endif 87 | 88 | 89 | void 90 | align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef); 91 | 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/latin1tab.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 6 | /* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 7 | /* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 8 | /* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 9 | /* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 10 | /* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 11 | /* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 12 | /* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 13 | /* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 14 | /* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 15 | /* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, 16 | /* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 17 | /* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 18 | /* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, 19 | /* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, 20 | /* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 21 | /* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 22 | /* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 23 | /* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 24 | /* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 25 | /* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 26 | /* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, 27 | /* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 28 | /* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 29 | /* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 30 | /* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 31 | /* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 32 | /* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 33 | /* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 34 | /* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, 35 | /* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 36 | /* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 37 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/utf8tab.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | 6 | /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 7 | /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 8 | /* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 9 | /* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 10 | /* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 11 | /* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 12 | /* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 13 | /* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 14 | /* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 15 | /* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 16 | /* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 17 | /* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 18 | /* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 19 | /* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 20 | /* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 21 | /* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 22 | /* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 23 | /* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 24 | /* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 25 | /* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 26 | /* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 27 | /* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 28 | /* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 29 | /* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 30 | /* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, 31 | /* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, 32 | /* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, 33 | /* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, 34 | /* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, 35 | /* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, 36 | /* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 37 | /* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, 38 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/winconfig.h: -------------------------------------------------------------------------------- 1 | /*================================================================ 2 | ** Copyright 2000, Clark Cooper 3 | ** All rights reserved. 4 | ** 5 | ** This is free software. You are permitted to copy, distribute, or modify 6 | ** it under the terms of the MIT/X license (contained in the COPYING file 7 | ** with this distribution.) 8 | */ 9 | 10 | #ifndef WINCONFIG_H 11 | #define WINCONFIG_H 12 | 13 | #define WIN32_LEAN_AND_MEAN 14 | #include 15 | #undef WIN32_LEAN_AND_MEAN 16 | 17 | #include 18 | #include 19 | 20 | 21 | #if defined(HAVE_EXPAT_CONFIG_H) /* e.g. MinGW */ 22 | # include 23 | #else /* !defined(HAVE_EXPAT_CONFIG_H) */ 24 | 25 | 26 | #define XML_NS 1 27 | #define XML_DTD 1 28 | #define XML_CONTEXT_BYTES 1024 29 | 30 | /* we will assume all Windows platforms are little endian */ 31 | #define BYTEORDER 1234 32 | 33 | /* Windows has memmove() available. */ 34 | #define HAVE_MEMMOVE 35 | 36 | 37 | #endif /* !defined(HAVE_EXPAT_CONFIG_H) */ 38 | 39 | 40 | #endif /* ndef WINCONFIG_H */ 41 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/xmlrole.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | #ifndef XmlRole_INCLUDED 6 | #define XmlRole_INCLUDED 1 7 | 8 | #ifdef __VMS 9 | /* 0 1 2 3 0 1 2 3 10 | 1234567890123456789012345678901 1234567890123456789012345678901 */ 11 | #define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt 12 | #endif 13 | 14 | #include "xmltok.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | enum { 21 | XML_ROLE_ERROR = -1, 22 | XML_ROLE_NONE = 0, 23 | XML_ROLE_XML_DECL, 24 | XML_ROLE_INSTANCE_START, 25 | XML_ROLE_DOCTYPE_NONE, 26 | XML_ROLE_DOCTYPE_NAME, 27 | XML_ROLE_DOCTYPE_SYSTEM_ID, 28 | XML_ROLE_DOCTYPE_PUBLIC_ID, 29 | XML_ROLE_DOCTYPE_INTERNAL_SUBSET, 30 | XML_ROLE_DOCTYPE_CLOSE, 31 | XML_ROLE_GENERAL_ENTITY_NAME, 32 | XML_ROLE_PARAM_ENTITY_NAME, 33 | XML_ROLE_ENTITY_NONE, 34 | XML_ROLE_ENTITY_VALUE, 35 | XML_ROLE_ENTITY_SYSTEM_ID, 36 | XML_ROLE_ENTITY_PUBLIC_ID, 37 | XML_ROLE_ENTITY_COMPLETE, 38 | XML_ROLE_ENTITY_NOTATION_NAME, 39 | XML_ROLE_NOTATION_NONE, 40 | XML_ROLE_NOTATION_NAME, 41 | XML_ROLE_NOTATION_SYSTEM_ID, 42 | XML_ROLE_NOTATION_NO_SYSTEM_ID, 43 | XML_ROLE_NOTATION_PUBLIC_ID, 44 | XML_ROLE_ATTRIBUTE_NAME, 45 | XML_ROLE_ATTRIBUTE_TYPE_CDATA, 46 | XML_ROLE_ATTRIBUTE_TYPE_ID, 47 | XML_ROLE_ATTRIBUTE_TYPE_IDREF, 48 | XML_ROLE_ATTRIBUTE_TYPE_IDREFS, 49 | XML_ROLE_ATTRIBUTE_TYPE_ENTITY, 50 | XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, 51 | XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, 52 | XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, 53 | XML_ROLE_ATTRIBUTE_ENUM_VALUE, 54 | XML_ROLE_ATTRIBUTE_NOTATION_VALUE, 55 | XML_ROLE_ATTLIST_NONE, 56 | XML_ROLE_ATTLIST_ELEMENT_NAME, 57 | XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, 58 | XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, 59 | XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, 60 | XML_ROLE_FIXED_ATTRIBUTE_VALUE, 61 | XML_ROLE_ELEMENT_NONE, 62 | XML_ROLE_ELEMENT_NAME, 63 | XML_ROLE_CONTENT_ANY, 64 | XML_ROLE_CONTENT_EMPTY, 65 | XML_ROLE_CONTENT_PCDATA, 66 | XML_ROLE_GROUP_OPEN, 67 | XML_ROLE_GROUP_CLOSE, 68 | XML_ROLE_GROUP_CLOSE_REP, 69 | XML_ROLE_GROUP_CLOSE_OPT, 70 | XML_ROLE_GROUP_CLOSE_PLUS, 71 | XML_ROLE_GROUP_CHOICE, 72 | XML_ROLE_GROUP_SEQUENCE, 73 | XML_ROLE_CONTENT_ELEMENT, 74 | XML_ROLE_CONTENT_ELEMENT_REP, 75 | XML_ROLE_CONTENT_ELEMENT_OPT, 76 | XML_ROLE_CONTENT_ELEMENT_PLUS, 77 | XML_ROLE_PI, 78 | XML_ROLE_COMMENT, 79 | #ifdef XML_DTD 80 | XML_ROLE_TEXT_DECL, 81 | XML_ROLE_IGNORE_SECT, 82 | XML_ROLE_INNER_PARAM_ENTITY_REF, 83 | #endif /* XML_DTD */ 84 | XML_ROLE_PARAM_ENTITY_REF 85 | }; 86 | 87 | typedef struct prolog_state { 88 | int (PTRCALL *handler) (struct prolog_state *state, 89 | int tok, 90 | const char *ptr, 91 | const char *end, 92 | const ENCODING *enc); 93 | unsigned level; 94 | int role_none; 95 | #ifdef XML_DTD 96 | unsigned includeLevel; 97 | int documentEntity; 98 | int inEntityValue; 99 | #endif /* XML_DTD */ 100 | } PROLOG_STATE; 101 | 102 | void XmlPrologStateInit(PROLOG_STATE *); 103 | #ifdef XML_DTD 104 | void XmlPrologStateInitExternalEntity(PROLOG_STATE *); 105 | #endif /* XML_DTD */ 106 | 107 | #define XmlTokenRole(state, tok, ptr, end, enc) \ 108 | (((state)->handler)(state, tok, ptr, end, enc)) 109 | 110 | #ifdef __cplusplus 111 | } 112 | #endif 113 | 114 | #endif /* not XmlRole_INCLUDED */ 115 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/xmltok_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 3 | See the file COPYING for copying permission. 4 | */ 5 | 6 | enum { 7 | BT_NONXML, 8 | BT_MALFORM, 9 | BT_LT, 10 | BT_AMP, 11 | BT_RSQB, 12 | BT_LEAD2, 13 | BT_LEAD3, 14 | BT_LEAD4, 15 | BT_TRAIL, 16 | BT_CR, 17 | BT_LF, 18 | BT_GT, 19 | BT_QUOT, 20 | BT_APOS, 21 | BT_EQUALS, 22 | BT_QUEST, 23 | BT_EXCL, 24 | BT_SOL, 25 | BT_SEMI, 26 | BT_NUM, 27 | BT_LSQB, 28 | BT_S, 29 | BT_NMSTRT, 30 | BT_COLON, 31 | BT_HEX, 32 | BT_DIGIT, 33 | BT_NAME, 34 | BT_MINUS, 35 | BT_OTHER, /* known not to be a name or name start character */ 36 | BT_NONASCII, /* might be a name or name start character */ 37 | BT_PERCNT, 38 | BT_LPAR, 39 | BT_RPAR, 40 | BT_AST, 41 | BT_PLUS, 42 | BT_COMMA, 43 | BT_VERBAR 44 | }; 45 | 46 | #include 47 | -------------------------------------------------------------------------------- /Flatland Standalone/Expat/xmltok_ns.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | /* This file is included! */ 6 | #ifdef XML_TOK_NS_C 7 | 8 | const ENCODING * 9 | NS(XmlGetUtf8InternalEncoding)(void) 10 | { 11 | return &ns(internal_utf8_encoding).enc; 12 | } 13 | 14 | const ENCODING * 15 | NS(XmlGetUtf16InternalEncoding)(void) 16 | { 17 | #if BYTEORDER == 1234 18 | return &ns(internal_little2_encoding).enc; 19 | #elif BYTEORDER == 4321 20 | return &ns(internal_big2_encoding).enc; 21 | #else 22 | const short n = 1; 23 | return (*(const char *)&n 24 | ? &ns(internal_little2_encoding).enc 25 | : &ns(internal_big2_encoding).enc); 26 | #endif 27 | } 28 | 29 | static const ENCODING * const NS(encodings)[] = { 30 | &ns(latin1_encoding).enc, 31 | &ns(ascii_encoding).enc, 32 | &ns(utf8_encoding).enc, 33 | &ns(big2_encoding).enc, 34 | &ns(big2_encoding).enc, 35 | &ns(little2_encoding).enc, 36 | &ns(utf8_encoding).enc /* NO_ENC */ 37 | }; 38 | 39 | static int PTRCALL 40 | NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, 41 | const char **nextTokPtr) 42 | { 43 | return initScan(NS(encodings), (const INIT_ENCODING *)enc, 44 | XML_PROLOG_STATE, ptr, end, nextTokPtr); 45 | } 46 | 47 | static int PTRCALL 48 | NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, 49 | const char **nextTokPtr) 50 | { 51 | return initScan(NS(encodings), (const INIT_ENCODING *)enc, 52 | XML_CONTENT_STATE, ptr, end, nextTokPtr); 53 | } 54 | 55 | int 56 | NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, 57 | const char *name) 58 | { 59 | int i = getEncodingIndex(name); 60 | if (i == UNKNOWN_ENC) 61 | return 0; 62 | SET_INIT_ENC_INDEX(p, i); 63 | p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); 64 | p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); 65 | p->initEnc.updatePosition = initUpdatePosition; 66 | p->encPtr = encPtr; 67 | *encPtr = &(p->initEnc); 68 | return 1; 69 | } 70 | 71 | static const ENCODING * 72 | NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) 73 | { 74 | #define ENCODING_MAX 128 75 | char buf[ENCODING_MAX]; 76 | char *p = buf; 77 | int i; 78 | XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); 79 | if (ptr != end) 80 | return 0; 81 | *p = 0; 82 | if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) 83 | return enc; 84 | i = getEncodingIndex(buf); 85 | if (i == UNKNOWN_ENC) 86 | return 0; 87 | return NS(encodings)[i]; 88 | } 89 | 90 | int 91 | NS(XmlParseXmlDecl)(int isGeneralTextEntity, 92 | const ENCODING *enc, 93 | const char *ptr, 94 | const char *end, 95 | const char **badPtr, 96 | const char **versionPtr, 97 | const char **versionEndPtr, 98 | const char **encodingName, 99 | const ENCODING **encoding, 100 | int *standalone) 101 | { 102 | return doParseXmlDecl(NS(findEncoding), 103 | isGeneralTextEntity, 104 | enc, 105 | ptr, 106 | end, 107 | badPtr, 108 | versionPtr, 109 | versionEndPtr, 110 | encodingName, 111 | encoding, 112 | standalone); 113 | } 114 | 115 | #endif /* XML_TOK_NS_C */ 116 | -------------------------------------------------------------------------------- /Flatland Standalone/Fileio.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | // Spot parsing functions. 7 | 8 | void 9 | add_block_symbols(blockset *blockset_ptr); 10 | 11 | blockset * 12 | parse_blockset(char *blockset_URL, bool show_title = true); 13 | 14 | void 15 | parse_spot_file(); 16 | 17 | // Spot saving function. 18 | 19 | void 20 | save_spot_file(const char *spot_file_path); 21 | 22 | // Generic read string function. 23 | 24 | bool 25 | read_string(FILE *fp, char *buffer, int max_buffer_length); 26 | 27 | // Configuration file functions. 28 | 29 | void 30 | load_config_file(void); 31 | 32 | void 33 | save_config_file(void); 34 | 35 | // Blockset cache file functions. 36 | 37 | void 38 | delete_cached_blockset_list(void); 39 | 40 | cached_blockset * 41 | new_cached_blockset(const char *path, const char *href, int size, time_t updated); 42 | 43 | bool 44 | load_cached_blockset_list(void); 45 | 46 | void 47 | save_cached_blockset_list(void); 48 | 49 | void 50 | create_cached_blockset_list(void); 51 | 52 | cached_blockset * 53 | find_cached_blockset(const char *href); 54 | 55 | bool 56 | delete_cached_blockset(const char *href); 57 | 58 | bool 59 | check_for_blockset_update(const char *version_file_URL, const char *blockset_name, 60 | unsigned int blockset_version); 61 | 62 | // Rover version file parsing function. 63 | 64 | bool 65 | parse_rover_version_file(unsigned int &version_number, string &message); 66 | -------------------------------------------------------------------------------- /Flatland Standalone/Flatland Standalone.cpp: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | #include "stdafx.h" 7 | #include 8 | #include "Classes.h" 9 | #include "Platform.h" 10 | #include "Plugin.h" 11 | 12 | int APIENTRY WinMain(_In_ HINSTANCE hInstance, 13 | _In_opt_ HINSTANCE hPrevInstance, 14 | _In_ LPSTR lpCmdLine, 15 | _In_ int nCmdShow) 16 | { 17 | LPWSTR *argument_list; 18 | int arguments; 19 | char file_path[_MAX_PATH]; 20 | 21 | // Parse the command line into arguments and extract the first argument as the spot file path. 22 | 23 | argument_list = CommandLineToArgvW(GetCommandLineW(), &arguments); 24 | if (arguments > 1) { 25 | WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, argument_list[1], -1, file_path, _MAX_PATH, NULL, NULL); 26 | } else { 27 | *file_path = '\0'; 28 | } 29 | LocalFree(argument_list); 30 | 31 | // Run the app. 32 | 33 | return run_app(hInstance, nCmdShow, file_path); 34 | } 35 | -------------------------------------------------------------------------------- /Flatland Standalone/Flatland Standalone.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Flatland Standalone.ico -------------------------------------------------------------------------------- /Flatland Standalone/Flatland Standalone.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Flatland Standalone.rc -------------------------------------------------------------------------------- /Flatland Standalone/Image.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | // Externally visible functions. 7 | 8 | bool 9 | load_image(const char *URL, const char *file_path, texture *texture_ptr, bool force_32_bit_pixels = false); -------------------------------------------------------------------------------- /Flatland Standalone/Jpeg/JCHUFF.H: -------------------------------------------------------------------------------- 1 | /* 2 | * jchuff.h 3 | * 4 | * Copyright (C) 1991-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains declarations for Huffman entropy encoding routines 9 | * that are shared between the sequential encoder (jchuff.c) and the 10 | * progressive encoder (jcphuff.c). No other modules need to see these. 11 | */ 12 | 13 | /* Derived data constructed for each Huffman table */ 14 | 15 | typedef struct { 16 | unsigned int ehufco[256]; /* code for each symbol */ 17 | char ehufsi[256]; /* length of code for each symbol */ 18 | /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ 19 | } c_derived_tbl; 20 | 21 | /* Short forms of external names for systems with brain-damaged linkers. */ 22 | 23 | #ifdef NEED_SHORT_EXTERNAL_NAMES 24 | #define jpeg_make_c_derived_tbl jMkCDerived 25 | #define jpeg_gen_optimal_table jGenOptTbl 26 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ 27 | 28 | /* Expand a Huffman table definition into the derived format */ 29 | EXTERN(void) jpeg_make_c_derived_tbl 30 | JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, c_derived_tbl ** pdtbl)); 31 | 32 | /* Generate an optimal table definition given the specified counts */ 33 | EXTERN(void) jpeg_gen_optimal_table 34 | JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); 35 | -------------------------------------------------------------------------------- /Flatland Standalone/Jpeg/JCINIT.C: -------------------------------------------------------------------------------- 1 | /* 2 | * jcinit.c 3 | * 4 | * Copyright (C) 1991-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains initialization logic for the JPEG compressor. 9 | * This routine is in charge of selecting the modules to be executed and 10 | * making an initialization call to each one. 11 | * 12 | * Logically, this code belongs in jcmaster.c. It's split out because 13 | * linking this routine implies linking the entire compression library. 14 | * For a transcoding-only application, we want to be able to use jcmaster.c 15 | * without linking in the whole library. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | 22 | 23 | /* 24 | * Master selection of compression modules. 25 | * This is done once at the start of processing an image. We determine 26 | * which modules will be used and give them appropriate initialization calls. 27 | */ 28 | 29 | GLOBAL(void) 30 | jinit_compress_master (j_compress_ptr cinfo) 31 | { 32 | /* Initialize master control (includes parameter checking/processing) */ 33 | jinit_c_master_control(cinfo, FALSE /* full compression */); 34 | 35 | /* Preprocessing */ 36 | if (! cinfo->raw_data_in) { 37 | jinit_color_converter(cinfo); 38 | jinit_downsampler(cinfo); 39 | jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); 40 | } 41 | /* Forward DCT */ 42 | jinit_forward_dct(cinfo); 43 | /* Entropy encoding: either Huffman or arithmetic coding. */ 44 | if (cinfo->arith_code) { 45 | ERREXIT(cinfo, JERR_ARITH_NOTIMPL); 46 | } else { 47 | if (cinfo->progressive_mode) { 48 | #ifdef C_PROGRESSIVE_SUPPORTED 49 | jinit_phuff_encoder(cinfo); 50 | #else 51 | ERREXIT(cinfo, JERR_NOT_COMPILED); 52 | #endif 53 | } else 54 | jinit_huff_encoder(cinfo); 55 | } 56 | 57 | /* Need a full-image coefficient buffer in any multi-pass mode. */ 58 | jinit_c_coef_controller(cinfo, 59 | (cinfo->num_scans > 1 || cinfo->optimize_coding)); 60 | jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); 61 | 62 | jinit_marker_writer(cinfo); 63 | 64 | /* We can now tell the memory manager to allocate virtual arrays. */ 65 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); 66 | 67 | /* Write the datastream header (SOI) immediately. 68 | * Frame and scan headers are postponed till later. 69 | * This lets application insert special markers after the SOI. 70 | */ 71 | (*cinfo->marker->write_file_header) (cinfo); 72 | } 73 | -------------------------------------------------------------------------------- /Flatland Standalone/Jpeg/JCOMAPI.C: -------------------------------------------------------------------------------- 1 | /* 2 | * jcomapi.c 3 | * 4 | * Copyright (C) 1994-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains application interface routines that are used for both 9 | * compression and decompression. 10 | */ 11 | 12 | #define JPEG_INTERNALS 13 | #include "jinclude.h" 14 | #include "jpeglib.h" 15 | 16 | 17 | /* 18 | * Abort processing of a JPEG compression or decompression operation, 19 | * but don't destroy the object itself. 20 | * 21 | * For this, we merely clean up all the nonpermanent memory pools. 22 | * Note that temp files (virtual arrays) are not allowed to belong to 23 | * the permanent pool, so we will be able to close all temp files here. 24 | * Closing a data source or destination, if necessary, is the application's 25 | * responsibility. 26 | */ 27 | 28 | GLOBAL(void) 29 | jpeg_abort (j_common_ptr cinfo) 30 | { 31 | int pool; 32 | 33 | /* Releasing pools in reverse order might help avoid fragmentation 34 | * with some (brain-damaged) malloc libraries. 35 | */ 36 | for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) { 37 | (*cinfo->mem->free_pool) (cinfo, pool); 38 | } 39 | 40 | /* Reset overall state for possible reuse of object */ 41 | cinfo->global_state = (cinfo->is_decompressor ? DSTATE_START : CSTATE_START); 42 | } 43 | 44 | 45 | /* 46 | * Destruction of a JPEG object. 47 | * 48 | * Everything gets deallocated except the master jpeg_compress_struct itself 49 | * and the error manager struct. Both of these are supplied by the application 50 | * and must be freed, if necessary, by the application. (Often they are on 51 | * the stack and so don't need to be freed anyway.) 52 | * Closing a data source or destination, if necessary, is the application's 53 | * responsibility. 54 | */ 55 | 56 | GLOBAL(void) 57 | jpeg_destroy (j_common_ptr cinfo) 58 | { 59 | /* We need only tell the memory manager to release everything. */ 60 | /* NB: mem pointer is NULL if memory mgr failed to initialize. */ 61 | if (cinfo->mem != NULL) 62 | (*cinfo->mem->self_destruct) (cinfo); 63 | cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ 64 | cinfo->global_state = 0; /* mark it destroyed */ 65 | } 66 | 67 | 68 | /* 69 | * Convenience routines for allocating quantization and Huffman tables. 70 | * (Would jutils.c be a more reasonable place to put these?) 71 | */ 72 | 73 | GLOBAL(JQUANT_TBL *) 74 | jpeg_alloc_quant_table (j_common_ptr cinfo) 75 | { 76 | JQUANT_TBL *tbl; 77 | 78 | tbl = (JQUANT_TBL *) 79 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); 80 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ 81 | return tbl; 82 | } 83 | 84 | 85 | GLOBAL(JHUFF_TBL *) 86 | jpeg_alloc_huff_table (j_common_ptr cinfo) 87 | { 88 | JHUFF_TBL *tbl; 89 | 90 | tbl = (JHUFF_TBL *) 91 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); 92 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ 93 | return tbl; 94 | } 95 | -------------------------------------------------------------------------------- /Flatland Standalone/Jpeg/JDTRANS.C: -------------------------------------------------------------------------------- 1 | /* 2 | * jdtrans.c 3 | * 4 | * Copyright (C) 1995-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains library routines for transcoding decompression, 9 | * that is, reading raw DCT coefficient arrays from an input JPEG file. 10 | * The routines in jdapimin.c will also be needed by a transcoder. 11 | */ 12 | 13 | #define JPEG_INTERNALS 14 | #include "jinclude.h" 15 | #include "jpeglib.h" 16 | 17 | 18 | /* Forward declarations */ 19 | LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); 20 | 21 | 22 | /* 23 | * Read the coefficient arrays from a JPEG file. 24 | * jpeg_read_header must be completed before calling this. 25 | * 26 | * The entire image is read into a set of virtual coefficient-block arrays, 27 | * one per component. The return value is a pointer to the array of 28 | * virtual-array descriptors. These can be manipulated directly via the 29 | * JPEG memory manager, or handed off to jpeg_write_coefficients(). 30 | * To release the memory occupied by the virtual arrays, call 31 | * jpeg_finish_decompress() when done with the data. 32 | * 33 | * Returns NULL if suspended. This case need be checked only if 34 | * a suspending data source is used. 35 | */ 36 | 37 | GLOBAL(jvirt_barray_ptr *) 38 | jpeg_read_coefficients (j_decompress_ptr cinfo) 39 | { 40 | if (cinfo->global_state == DSTATE_READY) { 41 | /* First call: initialize active modules */ 42 | transdecode_master_selection(cinfo); 43 | cinfo->global_state = DSTATE_RDCOEFS; 44 | } else if (cinfo->global_state != DSTATE_RDCOEFS) 45 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 46 | /* Absorb whole file into the coef buffer */ 47 | for (;;) { 48 | int retcode; 49 | /* Call progress monitor hook if present */ 50 | if (cinfo->progress != NULL) 51 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 52 | /* Absorb some more input */ 53 | retcode = (*cinfo->inputctl->consume_input) (cinfo); 54 | if (retcode == JPEG_SUSPENDED) 55 | return NULL; 56 | if (retcode == JPEG_REACHED_EOI) 57 | break; 58 | /* Advance progress counter if appropriate */ 59 | if (cinfo->progress != NULL && 60 | (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { 61 | if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { 62 | /* startup underestimated number of scans; ratchet up one scan */ 63 | cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; 64 | } 65 | } 66 | } 67 | /* Set state so that jpeg_finish_decompress does the right thing */ 68 | cinfo->global_state = DSTATE_STOPPING; 69 | return cinfo->coef->coef_arrays; 70 | } 71 | 72 | 73 | /* 74 | * Master selection of decompression modules for transcoding. 75 | * This substitutes for jdmaster.c's initialization of the full decompressor. 76 | */ 77 | 78 | LOCAL(void) 79 | transdecode_master_selection (j_decompress_ptr cinfo) 80 | { 81 | /* Entropy decoding: either Huffman or arithmetic coding. */ 82 | if (cinfo->arith_code) { 83 | ERREXIT(cinfo, JERR_ARITH_NOTIMPL); 84 | } else { 85 | if (cinfo->progressive_mode) { 86 | #ifdef D_PROGRESSIVE_SUPPORTED 87 | jinit_phuff_decoder(cinfo); 88 | #else 89 | ERREXIT(cinfo, JERR_NOT_COMPILED); 90 | #endif 91 | } else 92 | jinit_huff_decoder(cinfo); 93 | } 94 | 95 | /* Always get a full-image coefficient buffer. */ 96 | jinit_d_coef_controller(cinfo, TRUE); 97 | 98 | /* We can now tell the memory manager to allocate virtual arrays. */ 99 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); 100 | 101 | /* Initialize input side of decompressor to consume first scan. */ 102 | (*cinfo->inputctl->start_input_pass) (cinfo); 103 | 104 | /* Initialize progress monitoring. */ 105 | if (cinfo->progress != NULL) { 106 | int nscans; 107 | /* Estimate number of scans to set pass_limit. */ 108 | if (cinfo->progressive_mode) { 109 | /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ 110 | nscans = 2 + 3 * cinfo->num_components; 111 | } else if (cinfo->inputctl->has_multiple_scans) { 112 | /* For a nonprogressive multiscan file, estimate 1 scan per component. */ 113 | nscans = cinfo->num_components; 114 | } else { 115 | nscans = 1; 116 | } 117 | cinfo->progress->pass_counter = 0L; 118 | cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; 119 | cinfo->progress->completed_passes = 0; 120 | cinfo->progress->total_passes = 1; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /Flatland Standalone/Jpeg/JINCLUDE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * jinclude.h 3 | * 4 | * Copyright (C) 1991-1994, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file exists to provide a single place to fix any problems with 9 | * including the wrong system include files. (Common problems are taken 10 | * care of by the standard jconfig symbols, but on really weird systems 11 | * you may have to edit this file.) 12 | * 13 | * NOTE: this file is NOT intended to be included by applications using the 14 | * JPEG library. Most applications need only include jpeglib.h. 15 | */ 16 | 17 | 18 | /* Include auto-config file to find out which system include files we need. */ 19 | 20 | #include "jconfig.h" /* auto configuration options */ 21 | #define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ 22 | 23 | /* 24 | * We need the NULL macro and size_t typedef. 25 | * On an ANSI-conforming system it is sufficient to include . 26 | * Otherwise, we get them from or ; we may have to 27 | * pull in as well. 28 | * Note that the core JPEG library does not require ; 29 | * only the default error handler and data source/destination modules do. 30 | * But we must pull it in because of the references to FILE in jpeglib.h. 31 | * You can remove those references if you want to compile without . 32 | */ 33 | 34 | #ifdef HAVE_STDDEF_H 35 | #include 36 | #endif 37 | 38 | #ifdef HAVE_STDLIB_H 39 | #include 40 | #endif 41 | 42 | #ifdef NEED_SYS_TYPES_H 43 | #include 44 | #endif 45 | 46 | #include 47 | 48 | /* 49 | * We need memory copying and zeroing functions, plus strncpy(). 50 | * ANSI and System V implementations declare these in . 51 | * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). 52 | * Some systems may declare memset and memcpy in . 53 | * 54 | * NOTE: we assume the size parameters to these functions are of type size_t. 55 | * Change the casts in these macros if not! 56 | */ 57 | 58 | #ifdef NEED_BSD_STRINGS 59 | 60 | #include 61 | #define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) 62 | #define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) 63 | 64 | #else /* not BSD, assume ANSI/SysV string lib */ 65 | 66 | #include 67 | #define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) 68 | #define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) 69 | 70 | #endif 71 | 72 | /* 73 | * In ANSI C, and indeed any rational implementation, size_t is also the 74 | * type returned by sizeof(). However, it seems there are some irrational 75 | * implementations out there, in which sizeof() returns an int even though 76 | * size_t is defined as long or unsigned long. To ensure consistent results 77 | * we always use this SIZEOF() macro in place of using sizeof() directly. 78 | */ 79 | 80 | #define SIZEOF(object) ((size_t) sizeof(object)) 81 | 82 | /* 83 | * The modules that use fread() and fwrite() always invoke them through 84 | * these macros. On some systems you may need to twiddle the argument casts. 85 | * CAUTION: argument order is different from underlying functions! 86 | */ 87 | 88 | #define JFREAD(file,buf,sizeofbuf) \ 89 | ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) 90 | #define JFWRITE(file,buf,sizeofbuf) \ 91 | ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) 92 | -------------------------------------------------------------------------------- /Flatland Standalone/Jpeg/JMEMNOBS.C: -------------------------------------------------------------------------------- 1 | /* 2 | * jmemnobs.c 3 | * 4 | * Copyright (C) 1992-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file provides a really simple implementation of the system- 9 | * dependent portion of the JPEG memory manager. This implementation 10 | * assumes that no backing-store files are needed: all required space 11 | * can be obtained from malloc(). 12 | * This is very portable in the sense that it'll compile on almost anything, 13 | * but you'd better have lots of main memory (or virtual memory) if you want 14 | * to process big images. 15 | * Note that the max_memory_to_use option is ignored by this implementation. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | #include "jmemsys.h" /* import the system-dependent declarations */ 22 | 23 | #ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ 24 | extern void * malloc JPP((size_t size)); 25 | extern void free JPP((void *ptr)); 26 | #endif 27 | 28 | 29 | /* 30 | * Memory allocation and freeing are controlled by the regular library 31 | * routines malloc() and free(). 32 | */ 33 | 34 | GLOBAL(void *) 35 | jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) 36 | { 37 | return (void *) malloc(sizeofobject); 38 | } 39 | 40 | GLOBAL(void) 41 | jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) 42 | { 43 | free(object); 44 | } 45 | 46 | 47 | /* 48 | * "Large" objects are treated the same as "small" ones. 49 | * NB: although we include FAR keywords in the routine declarations, 50 | * this file won't actually work in 80x86 small/medium model; at least, 51 | * you probably won't be able to process useful-size images in only 64KB. 52 | */ 53 | 54 | GLOBAL(void FAR *) 55 | jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) 56 | { 57 | return (void FAR *) malloc(sizeofobject); 58 | } 59 | 60 | GLOBAL(void) 61 | jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) 62 | { 63 | free(object); 64 | } 65 | 66 | 67 | /* 68 | * This routine computes the total memory space available for allocation. 69 | * Here we always say, "we got all you want bud!" 70 | */ 71 | 72 | GLOBAL(long) 73 | jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, 74 | long max_bytes_needed, long already_allocated) 75 | { 76 | return max_bytes_needed; 77 | } 78 | 79 | 80 | /* 81 | * Backing store (temporary file) management. 82 | * Since jpeg_mem_available always promised the moon, 83 | * this should never be called and we can just error out. 84 | */ 85 | 86 | GLOBAL(void) 87 | jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, 88 | long total_bytes_needed) 89 | { 90 | ERREXIT(cinfo, JERR_NO_BACKING_STORE); 91 | } 92 | 93 | 94 | /* 95 | * These routines take care of any system-dependent initialization and 96 | * cleanup required. Here, there isn't any. 97 | */ 98 | 99 | GLOBAL(long) 100 | jpeg_mem_init (j_common_ptr cinfo) 101 | { 102 | return 0; /* just set max_memory_to_use to 0 */ 103 | } 104 | 105 | GLOBAL(void) 106 | jpeg_mem_term (j_common_ptr cinfo) 107 | { 108 | /* no work */ 109 | } 110 | -------------------------------------------------------------------------------- /Flatland Standalone/Jpeg/JVERSION.H: -------------------------------------------------------------------------------- 1 | /* 2 | * jversion.h 3 | * 4 | * Copyright (C) 1991-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains software version identification. 9 | */ 10 | 11 | 12 | #define JVERSION "6a 7-Feb-96" 13 | 14 | #define JCOPYRIGHT "Copyright (C) 1996, Thomas G. Lane" 15 | -------------------------------------------------------------------------------- /Flatland Standalone/LibPNG/pngrio.c: -------------------------------------------------------------------------------- 1 | 2 | /* pngrio.c - functions for data input 3 | * 4 | * Last changed in libpng 1.6.24 [August 4, 2016] 5 | * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson 6 | * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 7 | * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 8 | * 9 | * This code is released under the libpng license. 10 | * For conditions of distribution and use, see the disclaimer 11 | * and license in png.h 12 | * 13 | * This file provides a location for all input. Users who need 14 | * special handling are expected to write a function that has the same 15 | * arguments as this and performs a similar function, but that possibly 16 | * has a different input method. Note that you shouldn't change this 17 | * function, but rather write a replacement function and then make 18 | * libpng use it at run time with png_set_read_fn(...). 19 | */ 20 | 21 | #include "pngpriv.h" 22 | 23 | #ifdef PNG_READ_SUPPORTED 24 | 25 | /* Read the data from whatever input you are using. The default routine 26 | * reads from a file pointer. Note that this routine sometimes gets called 27 | * with very small lengths, so you should implement some kind of simple 28 | * buffering if you are using unbuffered reads. This should never be asked 29 | * to read more than 64K on a 16-bit machine. 30 | */ 31 | void /* PRIVATE */ 32 | png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length) 33 | { 34 | png_debug1(4, "reading %d bytes", (int)length); 35 | 36 | if (png_ptr->read_data_fn != NULL) 37 | (*(png_ptr->read_data_fn))(png_ptr, data, length); 38 | 39 | else 40 | png_error(png_ptr, "Call to NULL read function"); 41 | } 42 | 43 | #ifdef PNG_STDIO_SUPPORTED 44 | /* This is the function that does the actual reading of data. If you are 45 | * not reading from a standard C stream, you should create a replacement 46 | * read_data function and use it at run time with png_set_read_fn(), rather 47 | * than changing the library. 48 | */ 49 | void PNGCBAPI 50 | png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) 51 | { 52 | png_size_t check; 53 | 54 | if (png_ptr == NULL) 55 | return; 56 | 57 | /* fread() returns 0 on error, so it is OK to store this in a png_size_t 58 | * instead of an int, which is what fread() actually returns. 59 | */ 60 | check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr)); 61 | 62 | if (check != length) 63 | png_error(png_ptr, "Read Error"); 64 | } 65 | #endif 66 | 67 | /* This function allows the application to supply a new input function 68 | * for libpng if standard C streams aren't being used. 69 | * 70 | * This function takes as its arguments: 71 | * 72 | * png_ptr - pointer to a png input data structure 73 | * 74 | * io_ptr - pointer to user supplied structure containing info about 75 | * the input functions. May be NULL. 76 | * 77 | * read_data_fn - pointer to a new input function that takes as its 78 | * arguments a pointer to a png_struct, a pointer to 79 | * a location where input data can be stored, and a 32-bit 80 | * unsigned int that is the number of bytes to be read. 81 | * To exit and output any fatal error messages the new write 82 | * function should call png_error(png_ptr, "Error msg"). 83 | * May be NULL, in which case libpng's default function will 84 | * be used. 85 | */ 86 | void PNGAPI 87 | png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr, 88 | png_rw_ptr read_data_fn) 89 | { 90 | if (png_ptr == NULL) 91 | return; 92 | 93 | png_ptr->io_ptr = io_ptr; 94 | 95 | #ifdef PNG_STDIO_SUPPORTED 96 | if (read_data_fn != NULL) 97 | png_ptr->read_data_fn = read_data_fn; 98 | 99 | else 100 | png_ptr->read_data_fn = png_default_read_data; 101 | #else 102 | png_ptr->read_data_fn = read_data_fn; 103 | #endif 104 | 105 | #ifdef PNG_WRITE_SUPPORTED 106 | /* It is an error to write to a read device */ 107 | if (png_ptr->write_data_fn != NULL) 108 | { 109 | png_ptr->write_data_fn = NULL; 110 | png_warning(png_ptr, 111 | "Can't set both read_data_fn and write_data_fn in the" 112 | " same structure"); 113 | } 114 | #endif 115 | 116 | #ifdef PNG_WRITE_FLUSH_SUPPORTED 117 | png_ptr->output_flush_fn = NULL; 118 | #endif 119 | } 120 | #endif /* READ */ 121 | -------------------------------------------------------------------------------- /Flatland Standalone/Light.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | // The limit on the number of active lights allowed. 7 | 8 | #define ACTIVE_LIGHTS_LIMIT 8 9 | 10 | // Maximum active lights. 11 | 12 | extern int max_active_lights; 13 | 14 | // Externally visible functions. 15 | 16 | void 17 | get_ambient_light(float *brightness, RGBcolour *colour); 18 | 19 | void 20 | set_ambient_light(float brightness, RGBcolour colour); 21 | 22 | void 23 | set_master_intensity(float brightness); 24 | 25 | void 26 | set_active_lights(light_ref *active_light_list, vertex *vertex_ptr); 27 | 28 | void 29 | compute_vertex_colour(light_ref *active_light_list, vertex *vertex_ptr, 30 | vector *normal_ptr, RGBcolour *colour_ptr); 31 | 32 | float 33 | compute_vertex_brightness(light_ref *active_light_list, vertex *vertex_ptr, 34 | vector *normal_ptr); 35 | -------------------------------------------------------------------------------- /Flatland Standalone/Memory.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | #ifdef MEM_TRACE 7 | 8 | // Macros for allocating and freeing memory. 9 | 10 | #define NEW(ptr, type) \ 11 | { \ 12 | ptr = new type; \ 13 | trace_new(ptr, sizeof(type), #type, __FILE__, __LINE__); \ 14 | } 15 | 16 | #define NEWARRAY(ptr, type, elements) \ 17 | { \ 18 | ptr = new type[elements]; \ 19 | trace_newarray(ptr, sizeof(type), elements, #type, __FILE__, __LINE__); \ 20 | } 21 | 22 | #define DEL(ptr, type) \ 23 | { \ 24 | trace_del(ptr, sizeof(type), #type, __FILE__, __LINE__); \ 25 | delete ptr; \ 26 | } 27 | 28 | #define DELARRAY(ptr, type, elements) \ 29 | { \ 30 | trace_delarray(ptr, 4, sizeof(type), elements, #type, __FILE__, __LINE__); \ 31 | delete []ptr; \ 32 | } 33 | 34 | #define DELBASEARRAY(ptr, type, elements) \ 35 | { \ 36 | trace_delarray(ptr, 0, sizeof(type), elements, #type, __FILE__, __LINE__); \ 37 | delete []ptr; \ 38 | } 39 | 40 | #else 41 | 42 | #define NEW(ptr, type) ptr = new type 43 | #define NEWARRAY(ptr, type, elements) ptr = new type[elements] 44 | #define DEL(ptr, type) delete ptr 45 | #define DELARRAY(ptr, type, elements) delete []ptr 46 | #define DELBASEARRAY(ptr, type, elements) delete []ptr 47 | 48 | #endif 49 | 50 | #ifdef MEM_TRACE 51 | 52 | // Functions for tracing memory allocations and frees. 53 | 54 | void 55 | start_trace(); 56 | 57 | void 58 | trace_new(void *ptr, int bytes, char *type, char *file_name, int line_no); 59 | 60 | void 61 | trace_newarray(void *ptr, int bytes, int elements, char *type, char *file_name, 62 | int line_no); 63 | 64 | void 65 | trace_del(void *ptr, int bytes, char *type, char *file_name, int line_no); 66 | 67 | void 68 | trace_delarray(void *ptr, int offset, int bytes, int elements, char *type, 69 | char *file_name, int line_no); 70 | 71 | void 72 | end_trace(); 73 | 74 | #endif 75 | 76 | // Functions for managing free spans. 77 | 78 | void 79 | init_free_span_list(void); 80 | 81 | void 82 | delete_free_span_list(void); 83 | 84 | span * 85 | new_span(void); 86 | 87 | span * 88 | dup_span(span *old_span_ptr); 89 | 90 | span * 91 | del_span(span *span_ptr); 92 | 93 | // Functions for managing free transformed vertices. 94 | 95 | void 96 | init_free_tvertex_list(void); 97 | 98 | void 99 | delete_free_tvertex_list(void); 100 | 101 | tvertex * 102 | new_tvertex(void); 103 | 104 | tvertex * 105 | del_tvertex(tvertex *tvertex_ptr); 106 | 107 | // Functions for managing free transformed polygons. 108 | 109 | void 110 | init_free_tpolygon_list(void); 111 | 112 | void 113 | delete_free_tpolygon_list(void); 114 | 115 | tpolygon * 116 | new_tpolygon(void); 117 | 118 | tpolygon * 119 | del_tpolygon(tpolygon *tpolygon_ptr); 120 | 121 | // Functions for managing screen polygons. 122 | 123 | void 124 | init_screen_polygon_list(int set_max_spoints); 125 | 126 | void 127 | delete_screen_polygon_list(void); 128 | 129 | void 130 | reset_screen_polygon_list(void); 131 | 132 | spolygon * 133 | get_next_screen_polygon(void); 134 | 135 | // Functions for managing free triggers. 136 | 137 | void 138 | init_free_trigger_list(void); 139 | 140 | void 141 | delete_free_trigger_list(void); 142 | 143 | trigger * 144 | new_trigger(void); 145 | 146 | trigger * 147 | dup_trigger(trigger *old_trigger_ptr); 148 | 149 | trigger * 150 | del_trigger(trigger *trigger_ptr); 151 | -------------------------------------------------------------------------------- /Flatland Standalone/Plugin/jni_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)jni_md.h 1.3 97/01/10 3 | * 4 | * Copyright (c) 1993-1996 Sun Microsystems, Inc. All Rights Reserved. 5 | * 6 | * Permission to use, copy, modify, and distribute this software 7 | * and its documentation for NON-COMMERCIAL purposes and without 8 | * fee is hereby granted provided that this copyright notice 9 | * appears in all copies. 10 | * 11 | * The Java source code is the confidential and proprietary information 12 | * of Sun Microsystems, Inc. ("Confidential Information"). You shall 13 | * not disclose such Confidential Information and shall use it only in 14 | * accordance with the terms of the license agreement you entered into 15 | * with Sun. 16 | * 17 | * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF 18 | * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR 21 | * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR 22 | * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. 23 | */ 24 | 25 | #ifndef JNI_MD_H 26 | #define JNI_MD_H 27 | 28 | #include "jri_md.h" 29 | 30 | #define JNICALL JRI_CALLBACK 31 | 32 | /* XXX don't use this -- it doesn't work for Win16 */ 33 | #ifdef XP_WIN 34 | #define JNIEXPORT __declspec(dllexport) 35 | #else 36 | #define JNIEXPORT 37 | #endif 38 | 39 | 40 | 41 | #endif /* JNI_MD_H */ 42 | -------------------------------------------------------------------------------- /Flatland Standalone/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | WIN32 APPLICATION : Flatland Standalone Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Flatland Standalone application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your Flatland Standalone application. 9 | 10 | 11 | Flatland Standalone.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | Flatland Standalone.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | Flatland Standalone.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | AppWizard has created the following resources: 29 | 30 | Flatland Standalone.rc 31 | This is a listing of all of the Microsoft Windows resources that the 32 | program uses. It includes the icons, bitmaps, and cursors that are stored 33 | in the RES subdirectory. This file can be directly edited in Microsoft 34 | Visual C++. 35 | 36 | Resource.h 37 | This is the standard header file, which defines new resource IDs. 38 | Microsoft Visual C++ reads and updates this file. 39 | 40 | Flatland Standalone.ico 41 | This is an icon file, which is used as the application's icon (32x32). 42 | This icon is included by the main resource file Flatland Standalone.rc. 43 | 44 | small.ico 45 | This is an icon file, which contains a smaller version (16x16) 46 | of the application's icon. This icon is included by the main resource 47 | file Flatland Standalone.rc. 48 | 49 | ///////////////////////////////////////////////////////////////////////////// 50 | Other standard files: 51 | 52 | StdAfx.h, StdAfx.cpp 53 | These files are used to build a precompiled header (PCH) file 54 | named Flatland Standalone.pch and a precompiled types file named StdAfx.obj. 55 | 56 | ///////////////////////////////////////////////////////////////////////////// 57 | Other notes: 58 | 59 | AppWizard uses "TODO:" comments to indicate parts of the source code you 60 | should add to or customize. 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | -------------------------------------------------------------------------------- /Flatland Standalone/Render.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | // Externally visible functions. 7 | 8 | void 9 | init_renderer(void); 10 | 11 | void 12 | set_up_renderer(void); 13 | 14 | void 15 | clean_up_renderer(void); 16 | 17 | void 18 | translate_vertex(vertex *old_vertex_ptr, vertex *new_vertex_ptr); 19 | 20 | void 21 | rotate_vertex(vertex *old_vertex_ptr, vertex *new_vertex_ptr); 22 | 23 | void 24 | transform_vertex(vertex *old_vertex_ptr, vertex *new_vertex_ptr); 25 | 26 | void 27 | render_frame(void); 28 | 29 | void 30 | render_builder_icons_for_blockset(blockset *blockset_ptr); 31 | 32 | void 33 | activate_builder_render_target(); 34 | 35 | void 36 | deactivate_builder_render_target(); -------------------------------------------------------------------------------- /Flatland Standalone/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/Resource.h -------------------------------------------------------------------------------- /Flatland Standalone/SimKin.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | bool 7 | start_up_simkin(void); 8 | 9 | void 10 | shut_down_simkin(void); 11 | 12 | void 13 | set_global_script(const char *script); 14 | 15 | void 16 | create_block_simkin_object(block *block_ptr, const char *script); 17 | 18 | void 19 | destroy_block_simkin_object(block *block_ptr); 20 | 21 | void 22 | create_vertex_simkin_object(block *block_ptr); 23 | 24 | void 25 | destroy_vertex_simkin_object(block *block_ptr); 26 | 27 | script_def * 28 | create_script_def(const char *script); 29 | 30 | bool 31 | execute_script(block *block_ptr, script_def *script_def_ptr); 32 | 33 | bool 34 | call_global_method(const char *method_name); 35 | 36 | bool 37 | resume_script(void); 38 | 39 | void 40 | terminate_script(void); -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skAttribute.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skAttribute.cpp,v 1.3 2003/05/19 17:58:33 simkin_cvs Exp $ 20 | */ 21 | #include "skAttribute.h" 22 | #include "skStringBuffer.h" 23 | #include "skNode.h" 24 | #include "skOutputDestination.h" 25 | 26 | skNAMED_LITERAL(equals_start,skSTR("=\"")); 27 | skNAMED_LITERAL(equals_end,skSTR("\"")); 28 | //------------------------------------------ 29 | EXPORT_C skString skAttribute::toString() const 30 | //------------------------------------------ 31 | { 32 | skStringBuffer buffer(100); 33 | buffer.append(getName()); 34 | buffer.append(s_equals_start); 35 | buffer.append(skNode::escapeXMLDelimiters(getValue(),true)); 36 | buffer.append(s_equals_end); 37 | return buffer.toString(); 38 | } 39 | //------------------------------------------ 40 | EXPORT_C void skAttribute::write(skOutputDestination& out) 41 | //------------------------------------------ 42 | { 43 | out.write(m_Name); 44 | out.write(s_equals_start); 45 | out.write(skNode::escapeXMLDelimiters(m_Value,true)); 46 | out.write(s_equals_end); 47 | } 48 | //------------------------------------------ 49 | EXPORT_C bool skAttributeList::removeAttribute(const skString& name) 50 | //------------------------------------------ 51 | { 52 | bool removed=false; 53 | skAttribute * attr=findAttribute(name); 54 | if (attr){ 55 | removeAndDestroy(attr); 56 | removed=true; 57 | } 58 | return removed; 59 | } 60 | //------------------------------------------ 61 | EXPORT_C void skAttributeList::setAttribute(const skString& name,const skString& value) 62 | //------------------------------------------ 63 | { 64 | skAttribute * attr=findAttribute(name); 65 | if (attr) 66 | attr->setValue(value); 67 | else 68 | append(new skAttribute(name,value)); 69 | } 70 | //------------------------------------------ 71 | EXPORT_C skAttribute * skAttributeList::findAttribute(const skString& name) const 72 | //------------------------------------------ 73 | { 74 | skAttribute * ret=0; 75 | for (USize i=0;igetName()==name){ 78 | ret=attr; 79 | break; 80 | } 81 | } 82 | return ret; 83 | } 84 | //------------------------------------------ 85 | EXPORT_C skString skAttributeList::getAttribute(const skString& name) const 86 | //------------------------------------------ 87 | { 88 | skString value; 89 | skAttribute * attr=findAttribute(name); 90 | if (attr) 91 | value=attr->getValue(); 92 | return value; 93 | } 94 | //------------------------------------------ 95 | EXPORT_C skString skAttributeList::getAttribute(const skString& name,const skString& default_value) const 96 | //------------------------------------------ 97 | { 98 | skString value=default_value; 99 | skAttribute * attr=findAttribute(name); 100 | if (attr) 101 | value=attr->getValue(); 102 | return value; 103 | } 104 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skAttribute.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skAttribute.h,v 1.12 2003/05/19 17:58:33 simkin_cvs Exp $ 20 | */ 21 | #ifndef skATTRIBUTE_H 22 | #define skATTRIBUTE_H 23 | 24 | #include "skAlist.h" 25 | #include "skString.h" 26 | class CLASSEXPORT skOutputDestination; 27 | /** 28 | * This class represents an attribute of an element in an XML document. The class forms part of the Simkin DOM class library. 29 | */ 30 | class CLASSEXPORT skAttribute 31 | #ifdef __SYMBIAN32__ 32 | : public CBase 33 | #endif 34 | { 35 | public: 36 | /** Constructs a new attribute with the given name and value 37 | * @param name - the name of the attribute 38 | * @param value - the value of the attribute 39 | */ 40 | inline skAttribute(const skString& name,const skString& value) 41 | : m_Name(name),m_Value(value){ 42 | } 43 | /** this returns the name of the attribute 44 | * @return the name of the attribute 45 | */ 46 | inline skString getName() const { 47 | return m_Name; 48 | } 49 | /** this returns the value of the attribute 50 | * @return the value of the attribute 51 | */ 52 | inline skString getValue() const { 53 | return m_Value; 54 | } 55 | /** this method sets the value of the attribute */ 56 | inline void setValue(const skString& name){ 57 | m_Value=name; 58 | } 59 | /** 60 | * This method returns a string representation of the attribute, in the form ="" 61 | * @exception Symbian - a leaving function 62 | */ 63 | IMPORT_C skString toString() const; 64 | /** 65 | * This method writes the arribute out to the given destination, in the form ="" 66 | * @exception Symbian - a leaving function 67 | */ 68 | IMPORT_C void write(skOutputDestination& out); 69 | private: 70 | skString m_Name; 71 | skString m_Value; 72 | }; 73 | 74 | #ifdef INSTANTIATE_TEMPLATES 75 | EXTERN_TEMPLATE template class CLASSEXPORT skTAList; 76 | #endif 77 | 78 | /** 79 | * This class holds a list of attributes - it is used by the Element class. 80 | */ 81 | class CLASSEXPORT skAttributeList : public skTAList 82 | { 83 | public: 84 | /** 85 | * This sets an attribute in this list. The attribute is added, if not already present. 86 | * @param name - the name of the attribute. If one already exists with this name, its value is overwritten. 87 | * @param value - the value for the attribute 88 | * @exception Symbian - a leaving function 89 | */ 90 | IMPORT_C void setAttribute(const skString& name,const skString& value); 91 | /** 92 | * This returns the value of an attribute. If the attribute does not exist, a blank string is returned. 93 | * @param name - the name of the attribute being accessed 94 | * @return the value associated with the name, or a blank string. 95 | */ 96 | IMPORT_C skString getAttribute(const skString& name) const; 97 | /** 98 | * This returns the value of an attribute. If the attribute does not exist, the default value is returned. 99 | * @param name - the name of the attribute being accessed 100 | * @param default_value - the default value for the attribute 101 | * @return the value associated with the name, or a blank string. 102 | */ 103 | IMPORT_C skString getAttribute(const skString& name,const skString& default_value) const; 104 | /** 105 | * This removes an attribute from the list. 106 | * @param name - the name of the attribute being accessed 107 | * @return true if the attribute was removed, false if it was not in the list 108 | */ 109 | IMPORT_C bool removeAttribute(const skString& name); 110 | /** this method finds a named attribute 111 | * @return the attribute, or 0 if there was no attribute with that name 112 | */ 113 | IMPORT_C skAttribute * findAttribute(const skString& name) const; 114 | }; 115 | #endif 116 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skBoundsException.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skBoundsException.h,v 1.16 2003/04/14 15:24:57 simkin_cvs Exp $ 20 | */ 21 | #ifndef SKBOUNDSEXCEPTION_H 22 | #define SKBOUNDSEXCEPTION_H 23 | 24 | #include "skString.h" 25 | #include "skConstants.h" 26 | 27 | const int skBoundsException_Code=1; 28 | 29 | /** 30 | * this class represents an exception thrown by the collection classes 31 | */ 32 | class CLASSEXPORT skBoundsException { 33 | public: 34 | /** 35 | * Constructor 36 | */ 37 | skBoundsException(const skString& msg,const Char * file,int linenum) 38 | : m_Msg(msg),m_File(file),m_LineNum(linenum){ 39 | } 40 | /** 41 | * produces a string describing the exception 42 | * @exception Symbian - a leaving function 43 | */ 44 | skString toString() const{ 45 | skString file; 46 | file=m_File; 47 | return skString::addStrings(file.ptr(),s_colon,skString::from(m_LineNum).ptr(),m_Msg.ptr()); 48 | } 49 | private: 50 | skString m_Msg; 51 | const Char * m_File; 52 | int m_LineNum; 53 | 54 | }; 55 | #endif 56 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skCDataNode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skCDataNode.cpp,v 1.8 2003/04/17 16:00:59 simkin_cvs Exp $ 20 | */ 21 | #include "skCDataNode.h" 22 | #include "skOutputDestination.h" 23 | skNAMED_LITERAL(cdata_start,skSTR("![CDATA[")); 24 | skNAMED_LITERAL(cdata_end,skSTR("!]]")); 25 | 26 | //------------------------------------------ 27 | EXPORT_C skCDataNode::skCDataNode(const skString& text) 28 | //------------------------------------------ 29 | : skTextNode(text) 30 | { 31 | } 32 | //------------------------------------------ 33 | EXPORT_C skCDataNode::~skCDataNode() 34 | //------------------------------------------ 35 | { 36 | } 37 | //------------------------------------------ 38 | EXPORT_C skNode::NodeType skCDataNode::getNodeType() const 39 | //------------------------------------------ 40 | { 41 | return CDATA_SECTION_NODE; 42 | } 43 | //------------------------------------------ 44 | EXPORT_C skNode * skCDataNode::clone() 45 | //------------------------------------------ 46 | { 47 | return new skCDataNode(m_Text); 48 | } 49 | //------------------------------------------ 50 | EXPORT_C void skCDataNode::write(skOutputDestination& out) const 51 | //------------------------------------------ 52 | { 53 | out.write(s_cdata_start); 54 | out.write(m_Text); 55 | out.write(s_cdata_end); 56 | } 57 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skCDataNode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skCDataNode.h,v 1.9 2003/04/19 13:22:23 simkin_cvs Exp $ 20 | */ 21 | #ifndef skCDATANODE_H 22 | #define skCDATANODE_H 23 | 24 | #include "skTextNode.h" 25 | 26 | /** 27 | * This node represents a CData node in an XML document 28 | */ 29 | class CLASSEXPORT skCDataNode : public skTextNode 30 | { 31 | public: 32 | /** 33 | * Constructs a new CData node with the given text 34 | * @param text - the text for the CData node 35 | */ 36 | IMPORT_C skCDataNode(const skString& text); 37 | /** 38 | * Virtual destructor 39 | */ 40 | IMPORT_C virtual ~skCDataNode(); 41 | /** 42 | * Returns the type of this node 43 | * @return returns CDATA_NODE 44 | */ 45 | IMPORT_C virtual NodeType getNodeType() const; 46 | /** 47 | * Returns a new CData node with the same text 48 | * @return a new CData node that's a copy of this one 49 | * @exception Symbian - a leaving function 50 | */ 51 | IMPORT_C virtual skNode * clone(); 52 | /** 53 | * writes the CData text in this node to the given destination 54 | * @param out - the destination to write to 55 | * @exception Symbian - a leaving function 56 | */ 57 | IMPORT_C virtual void write(skOutputDestination& out) const; 58 | }; 59 | #endif 60 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skConstants.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skConstants.cpp,v 1.5 2003/11/20 17:20:24 sdw Exp $ 20 | */ 21 | 22 | 23 | #include "skConstants.h" 24 | skLITERAL(trace); 25 | skLITERAL(isObject); 26 | skLITERAL(length); 27 | skLITERAL(charAt); 28 | skNAMED_LITERAL(one,skSTR("1")); 29 | skNAMED_LITERAL(colon,skSTR(":")); 30 | skNAMED_LITERAL(cr,skSTR("\n")); 31 | skNAMED_LITERAL(tab,skSTR("\t")); 32 | skLITERAL(true); 33 | skLITERAL(false); 34 | skLITERAL(function); 35 | skLITERAL(name); 36 | skLITERAL(null); 37 | skLITERAL(next); 38 | skLITERAL(reset); 39 | skLITERAL(numChildren); 40 | skLITERAL(enumerate); 41 | skLITERAL(label); 42 | skLITERAL(self); 43 | skLITERAL(toInt); 44 | skLITERAL(toFloat); 45 | skLITERAL(toString); 46 | skLITERAL(toChar); 47 | skLITERAL(toBool); 48 | skNAMED_LITERAL(leftbracket,skSTR("[")); 49 | skNAMED_LITERAL(rightbracket,skSTR("]")); 50 | skNAMED_LITERAL(left_bracket,skSTR(" [")); 51 | skNAMED_LITERAL(right_bracket,skSTR("] ")); 52 | skNAMED_LITERAL(left_brace,skSTR(" {\n")); 53 | skNAMED_LITERAL(right_brace,skSTR(" }\n")); 54 | skLITERAL(Interpreter); 55 | skLITERAL(debugBreak); 56 | skLITERAL(breakpoint); 57 | skLITERAL(tracing); 58 | skNAMED_LITERAL(Dash,skSTR("-")); 59 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skConstants.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skConstants.h,v 1.10 2003/11/20 17:20:24 sdw Exp $ 20 | */ 21 | 22 | 23 | #ifndef skCONSTANTS_H 24 | #define skCONSTANTS_H 25 | 26 | #include "skString.h" 27 | 28 | /** 29 | * This file contains literal strings that are used in the Simkin library 30 | */ 31 | 32 | xskNAMED_LITERAL(one,skSTR("1")); 33 | xskNAMED_LITERAL(colon,skSTR(":")); 34 | xskNAMED_LITERAL(cr,skSTR("\n")); 35 | xskNAMED_LITERAL(tab,skSTR("\t")); 36 | xskLITERAL(true); 37 | xskLITERAL(false); 38 | xskLITERAL(function); 39 | xskLITERAL(name); 40 | xskLITERAL(null); 41 | xskLITERAL(trace); 42 | xskLITERAL(isObject); 43 | xskLITERAL(length); 44 | xskLITERAL(charAt); 45 | xskLITERAL(next); 46 | xskLITERAL(reset); 47 | xskLITERAL(numChildren); 48 | xskLITERAL(enumerate); 49 | xskLITERAL(label); 50 | xskLITERAL(self); 51 | xskLITERAL(tracing); 52 | xskLITERAL(Interpreter); 53 | xskLITERAL(debugBreak); 54 | xskLITERAL(breakpoint); 55 | xskLITERAL(toInt); 56 | xskLITERAL(toFloat); 57 | xskLITERAL(toString); 58 | xskLITERAL(toChar); 59 | xskLITERAL(toBool); 60 | 61 | xskNAMED_LITERAL(leftbracket,skSTR("[")); 62 | xskNAMED_LITERAL(rightbracket,skSTR("]")); 63 | 64 | xskNAMED_LITERAL(left_bracket,skSTR(" [")); 65 | xskNAMED_LITERAL(right_bracket,skSTR("] ")); 66 | xskNAMED_LITERAL(left_brace,skSTR(" {\n")); 67 | xskNAMED_LITERAL(right_brace,skSTR(" }\n")); 68 | xskLITERAL_STRING(Dash,"-"); 69 | 70 | #define c_colon ':' 71 | #define c_leftbrace '{' 72 | #define c_rightbrace '}' 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skElementExecutable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skElementExecutable.cpp,v 1.16 2003/05/14 22:00:10 simkin_cvs Exp $ 20 | */ 21 | 22 | #include "skElementExecutable.h" 23 | #include "skExpatParser.h" 24 | #include "skInputSource.h" 25 | #include "skOutputDestination.h" 26 | //------------------------------------------ 27 | skElementExecutable::skElementExecutable() 28 | //------------------------------------------ 29 | { 30 | } 31 | //------------------------------------------ 32 | skElementExecutable::skElementExecutable(const skString& scriptLocation, skInputSource& in,skExecutableContext& context) 33 | //------------------------------------------ 34 | { 35 | load(scriptLocation,in,context); 36 | } 37 | //------------------------------------------ 38 | skElementExecutable::skElementExecutable(const skString& fileName,skExecutableContext& context) 39 | //------------------------------------------ 40 | { 41 | load(fileName,context); 42 | } 43 | //------------------------------------------ 44 | void skElementExecutable::load(const skString& scriptLocation,skInputSource& in,skExecutableContext& context) 45 | //------------------------------------------ 46 | { 47 | skExpatParser parser; 48 | skElement * elem=parser.parse(in,context); 49 | setElement(scriptLocation,elem,true); 50 | } 51 | //------------------------------------------ 52 | void skElementExecutable::load(const skString& fileName,skExecutableContext& context) 53 | //------------------------------------------ 54 | { 55 | skInputFile in(fileName); 56 | load(fileName,in,context); 57 | } 58 | //------------------------------------------ 59 | void skElementExecutable::save(skOutputDestination& out) 60 | //------------------------------------------ 61 | { 62 | getElement()->write(out); 63 | } 64 | //------------------------------------------ 65 | void skElementExecutable::save(const skString& fileName) 66 | //------------------------------------------ 67 | { 68 | skOutputFile out(fileName); 69 | save(out); 70 | } 71 | //------------------------------------------ 72 | skElementExecutable::skElementExecutable(const skElementExecutable& other) 73 | //------------------------------------------ 74 | { 75 | } 76 | //------------------------------------------ 77 | skElementExecutable& skElementExecutable::operator=(const skElementExecutable& other) 78 | //------------------------------------------ 79 | { 80 | return *this; 81 | } 82 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skElementExecutable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skElementExecutable.h,v 1.10 2003/01/20 18:48:18 simkin_cvs Exp $ 20 | */ 21 | 22 | #ifndef skELEMENTEXECUTABLE_H 23 | #define skELEMENTEXECUTABLE_H 24 | 25 | #include "skElementObject.h" 26 | class CLASSEXPORT skInputSource; 27 | 28 | /** 29 | * This class is a base class for objects which store their data and methods in an XML document 30 | * Each instance is associated with an XML document which is loaded on construction. 31 | * This version uses the Expat XML parser to read documents. 32 | */ 33 | class CLASSEXPORT skElementExecutable : public skElementObject { 34 | public: 35 | /** 36 | * Default Constructor. 37 | */ 38 | skElementExecutable(); 39 | /** 40 | * Constructor - passed the name of a file to load an XML document from 41 | * @param fileName name of XML file 42 | * @param context context object to receive errors 43 | */ 44 | skElementExecutable(const skString& fileName,skExecutableContext& context); 45 | /** 46 | * Constructor taking an input source containing an XML document 47 | * @param scriptLocation the name of the XML source 48 | * @param in an input source containing the document 49 | * @param context context object to receive errors 50 | */ 51 | skElementExecutable(const skString& scriptLocation,skInputSource& in,skExecutableContext& context); 52 | /** 53 | * This method causes the to be reloaded 54 | * @param scriptLocation the name of the XML source 55 | * @param in an input source containing the document 56 | * @param context context object to receive errors 57 | */ 58 | void load(const skString& scriptLocation,skInputSource& in,skExecutableContext& context); 59 | /** 60 | * This method causes the to be loaded from a file 61 | * @param fileName name of XML file 62 | * @param context context object to receive errors 63 | */ 64 | void load(const skString& fileName,skExecutableContext& context); 65 | /** 66 | * Call this method to save the state of the object back to a destination 67 | */ 68 | void save(skOutputDestination& out); 69 | /** 70 | * This method saves the current state as an document out to the given file 71 | */ 72 | void save(const skString& fileName); 73 | private: 74 | /** 75 | * ElementExecutables can't be copied 76 | */ 77 | skElementExecutable(const skElementExecutable&); 78 | /** 79 | * ElementExecutables can't be copied 80 | */ 81 | skElementExecutable& operator=(const skElementExecutable&); 82 | }; 83 | #endif 84 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skElementObjectEnumerator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skElementObjectEnumerator.cpp,v 1.10 2003/04/19 13:22:23 simkin_cvs Exp $ 20 | */ 21 | 22 | #include "skElementObjectEnumerator.h" 23 | #include "skElementObject.h" 24 | #include "skRValue.h" 25 | #include "skInterpreter.h" 26 | 27 | //----------------------------------------------------------------- 28 | EXPORT_C skElementObjectEnumerator::skElementObjectEnumerator(skElementObject * element,const skString& location) 29 | //----------------------------------------------------------------- 30 | : m_Object(element),m_NodeNum(0),m_Location(location) 31 | { 32 | // first wind forward to the first occurrence of the tag 33 | findNextNode(); 34 | } 35 | //----------------------------------------------------------------- 36 | EXPORT_C skElementObjectEnumerator::skElementObjectEnumerator(skElementObject * element,const skString& location,const skString& tag) 37 | //----------------------------------------------------------------- 38 | : m_Object(element),m_NodeNum(0),m_Tag(tag),m_Location(location) 39 | { 40 | // first wind forward to the first occurrence of the tag 41 | findNextNode(); 42 | } 43 | //----------------------------------------------------------------- 44 | EXPORT_C skElementObjectEnumerator::~skElementObjectEnumerator() 45 | //----------------------------------------------------------------- 46 | { 47 | } 48 | //------------------------------------------ 49 | EXPORT_C bool skElementObjectEnumerator::method(const skString& s,skRValueArray& args,skRValue& r,skExecutableContext& context) 50 | //------------------------------------------ 51 | { 52 | bool bRet=false; 53 | if (s==s_next){ 54 | if (next(r)==false) 55 | r.assignObject(&context.getInterpreter()->getNull(),false); 56 | bRet=true; 57 | }else if (s==s_reset){ 58 | m_NodeNum=0; 59 | findNextNode(); 60 | bRet=true; 61 | }else 62 | bRet=skExecutable::method(s,args,r,context); 63 | return bRet; 64 | } 65 | /** 66 | * this method winds m_NodeNum onto the next matching element - or beyond the end of the list for the end of enumeration 67 | */ 68 | //------------------------------------------ 69 | void skElementObjectEnumerator::findNextNode() 70 | //------------------------------------------ 71 | { 72 | skNodeList& nodes=m_Object->getElement()->getChildNodes(); 73 | for (;m_NodeNumgetNodeType()==skNode::ELEMENT_NODE && (m_Tag.length()==0 || ((skElement *)node)->getTagName()==m_Tag)){ 76 | break; 77 | } 78 | } 79 | } 80 | //------------------------------------------ 81 | EXPORT_C bool skElementObjectEnumerator::next(skRValue& r) 82 | //------------------------------------------ 83 | { 84 | bool ret=false; 85 | skNodeList& nodes=m_Object->getElement()->getChildNodes(); 86 | if (m_NodeNum(nodes[m_NodeNum]); 88 | skElementObject * obj=m_Object->createElementObject(m_Location,element,false); 89 | r.assignObject(obj,true); 90 | m_NodeNum++; 91 | findNextNode(); 92 | ret=true; 93 | } 94 | return ret; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skElementObjectEnumerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skElementObjectEnumerator.h,v 1.11 2003/04/19 13:22:23 simkin_cvs Exp $ 20 | */ 21 | #ifndef ELEMENTOBJECTENUMERATOR_H 22 | #define ELEMENTOBJECTENUMERATOR_H 23 | 24 | #include "skExecutable.h" 25 | #include "skExecutableIterator.h" 26 | #include "skElement.h" 27 | 28 | class CLASSEXPORT skElementObject; 29 | 30 | /** 31 | * This class enumerates the element children of an skElementObject 32 | */ 33 | class CLASSEXPORT skElementObjectEnumerator : public skExecutable, public skExecutableIterator{ 34 | public: 35 | /** This contructs an skElementObject enumerator over all the children 36 | * @param element - the element to enumerate the children of 37 | * @param location - the owning XML element name 38 | */ 39 | IMPORT_C skElementObjectEnumerator(skElementObject * element,const skString& location); 40 | /** This contructs an skElementObject enumerator over children with a particular tag name 41 | * @param element - the element to enumerate the children of 42 | * @param location - the owning XML element name 43 | * @param tag - the tag name to look for 44 | */ 45 | IMPORT_C skElementObjectEnumerator(skElementObject * element,const skString& location,const skString& tag); 46 | /** 47 | * Destructor 48 | */ 49 | IMPORT_C virtual ~skElementObjectEnumerator(); 50 | /** 51 | * This method exposes the following methods to Simkin scripts: 52 | * "next" - returns the next element in the enumeration - or null if there are no more 53 | * "reset" - resets the iterator 54 | * @param s method name 55 | * @param args arguments to the function 56 | * @param r return value 57 | * @param ctxt context object to receive errors 58 | * @exception Symbian - a leaving function 59 | * @exception skParseException - if a syntax error is encountered while the script is running 60 | * @exception skRuntimeException - if an error occurs while the script is running 61 | */ 62 | IMPORT_C bool method(const skString& s,skRValueArray& args,skRValue& r,skExecutableContext& ctxt); 63 | /** 64 | * This method implements the method in skExecutableIterator 65 | * @exception Symbian - a leaving function 66 | */ 67 | IMPORT_C bool next(skRValue&); 68 | private: 69 | void findNextNode(); 70 | 71 | skElementObject * m_Object; 72 | skString m_Location; 73 | int m_NodeNum; 74 | skString m_Tag; 75 | }; 76 | #endif 77 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skException.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skException.h,v 1.5 2003/04/07 21:59:14 simkin_cvs Exp $ 20 | */ 21 | #ifndef SKEXCEPTION_H 22 | #define SKEXCEPTION_H 23 | 24 | #include "skGeneral.h" 25 | #include "skString.h" 26 | 27 | /** 28 | * This class is a base class for exceptions thrown by Simkin 29 | */ 30 | 31 | class CLASSEXPORT skException 32 | #ifdef __SYMBIAN32__ 33 | : public CBase 34 | #endif 35 | { 36 | public: 37 | /** 38 | * Gets a verbose version of the exception including location and line number information 39 | */ 40 | virtual skString toString() const=0; 41 | /** 42 | * Gets just the error message, with no location information 43 | */ 44 | virtual skString getMessage() const=0; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skExecutableContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skExecutableContext.cpp,v 1.3 2003/01/20 18:48:18 simkin_cvs Exp $ 20 | */ 21 | 22 | #include "skExecutableContext.h" 23 | #include "skStackFrame.h" 24 | //------------------------------------------ 25 | void skExecutableContext::pushStackFrame(skStackFrame * frame) 26 | //------------------------------------------ 27 | { 28 | if (m_TopFrame) 29 | frame->setParentFrame(m_TopFrame); 30 | m_TopFrame=frame; 31 | } 32 | //------------------------------------------ 33 | void skExecutableContext::popStackFrame() 34 | //------------------------------------------ 35 | { 36 | if (m_TopFrame){ 37 | skStackFrame * parent=m_TopFrame->getParentFrame(); 38 | m_TopFrame->setParentFrame(0); 39 | m_TopFrame=parent; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skExecutableContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skExecutableContext.h,v 1.7 2003/04/14 15:24:57 simkin_cvs Exp $ 20 | */ 21 | #ifndef SKEXECUTABLECONTEXT_H 22 | #define SKEXECUTABLECONTEXT_H 23 | 24 | #include "skGeneral.h" 25 | #ifndef EXCEPTIONS_DEFINED 26 | #include "skScriptError.h" 27 | #endif 28 | 29 | class CLASSEXPORT skInterpreter; 30 | class CLASSEXPORT skStackFrame; 31 | 32 | /** 33 | * This class holds information passed to all methods via the siExecutable interface 34 | */ 35 | class CLASSEXPORT skExecutableContext 36 | #ifdef __SYMBIAN32__ 37 | : public CBase 38 | #endif 39 | { 40 | public: 41 | /** 42 | * Constructs a new context 43 | * @param interp the interpreter within the context 44 | */ 45 | skExecutableContext(skInterpreter * interp) 46 | : m_TopFrame(0),m_Interpreter(interp) 47 | { 48 | } 49 | skInterpreter * getInterpreter(); 50 | #ifndef EXCEPTIONS_DEFINED 51 | /** holds a reference to an error encountered while a script was executing. 52 | * \remarks This is only available if EXCEPTIONS_DEFINED is undefined. It replaces the default mechanism of throwing exceptions 53 | */ 54 | skScriptError& getError(); 55 | #endif 56 | 57 | /** 58 | * called when a new stack frame is created 59 | */ 60 | void pushStackFrame(skStackFrame * frame); 61 | /** 62 | * called when a method has finished 63 | */ 64 | void popStackFrame(); 65 | /** 66 | * returns the current top frame 67 | */ 68 | skStackFrame * getTopFrame(); 69 | /** 70 | * set the top frame 71 | */ 72 | void setTopFrame(skStackFrame * frame); 73 | private: 74 | skStackFrame * m_TopFrame; 75 | /** holds a reference to the calling interpreter */ 76 | skInterpreter * m_Interpreter; 77 | #ifndef EXCEPTIONS_DEFINED 78 | /** holds a reference to an error encountered - where exception support is not available */ 79 | skScriptError m_Error; 80 | #endif 81 | }; 82 | 83 | //------------------------------------------ 84 | inline skInterpreter * skExecutableContext::getInterpreter() 85 | //------------------------------------------ 86 | { 87 | return m_Interpreter; 88 | } 89 | //------------------------------------------ 90 | inline void skExecutableContext::setTopFrame(skStackFrame * frame) 91 | //------------------------------------------ 92 | { 93 | m_TopFrame=frame; 94 | } 95 | //------------------------------------------ 96 | inline skStackFrame * skExecutableContext::getTopFrame() 97 | //------------------------------------------ 98 | { 99 | return m_TopFrame; 100 | } 101 | #ifndef EXCEPTIONS_DEFINED 102 | //------------------------------------------ 103 | inline skScriptError& skExecutableContext::getError() 104 | //------------------------------------------ 105 | { 106 | return m_Error; 107 | } 108 | #endif 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skExecutableIterator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skExecutableIterator.cpp,v 1.4 2003/01/20 18:48:18 simkin_cvs Exp $ 20 | */ 21 | #include "skExecutableIterator.h" 22 | 23 | //------------------------------------------ 24 | skExecutableIterator::~skExecutableIterator() 25 | //------------------------------------------ 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skExecutableIterator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skExecutableIterator.h,v 1.8 2003/04/10 16:20:15 simkin_cvs Exp $ 20 | */ 21 | 22 | #ifndef skEXECUTABLEITERATOR_H 23 | #define skEXECUTABLEITERATOR_H 24 | 25 | 26 | #include "skGeneral.h" 27 | 28 | class CLASSEXPORT skRValue; 29 | 30 | /** 31 | * This class is used to iterate over a set of values whilst in the foreach statement 32 | */ 33 | class CLASSEXPORT skExecutableIterator 34 | { 35 | public: 36 | /** Destructor */ 37 | virtual ~skExecutableIterator()=0; 38 | /** This method returns the next value in the enumeration. It is implemented in the actual base class 39 | * @param value - a value to receive the next item in the iteration (if present) 40 | * @return true if the iteration can continue, otherwise false to indicate it is finished and the value variable is underined. 41 | */ 42 | virtual bool next(skRValue& value)=0; 43 | }; 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skExpatParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skExpatParser.h,v 1.17 2003/05/15 19:20:06 simkin_cvs Exp $ 20 | */ 21 | 22 | #ifndef skEXPATPARSER_H 23 | #define skEXPATPARSER_H 24 | 25 | #include "skString.h" 26 | #include "skElement.h" 27 | #include "..\expat\expat.h" 28 | #include "skExecutableContext.h" 29 | 30 | class CLASSEXPORT skInputSource; 31 | 32 | /** 33 | * This class gives an interface to the Expat parser. It can be used to parse an XML document and return a Simkin Element class. 34 | *

(Note: Expat is an Open Source XML parser library. You can obtain it from http://expat.sourceforge.net/) 35 | */ 36 | class CLASSEXPORT skExpatParser 37 | #ifdef __SYMBIAN32__ 38 | : public CBase 39 | #endif 40 | { 41 | public: 42 | /** Construct a parser */ 43 | IMPORT_C skExpatParser(); 44 | /** Destructor */ 45 | IMPORT_C virtual ~skExpatParser(); 46 | /** Parse an input stream and construct an element from it 47 | * @param in the input stream containing the XML document 48 | * @param context a context object - this can be used to pass back exceptions where exception handling is disabled 49 | * @return the root of the document in the stream, or 0 if a parse error occurred 50 | * @exception XMLParseException thrown if there was an error and exceptions are enabled. Otherwise this is returned in the context object 51 | * @exception Symbian - a leaving function 52 | */ 53 | IMPORT_C skElement * parse(skInputSource& in,skExecutableContext& context); 54 | IMPORT_C skElement * parse(skInputSource& in,skExecutableContext& context,skString encoding); 55 | private: 56 | /** prevent C++ from making copies of the parser */ 57 | skExpatParser(const skExpatParser&); 58 | skExpatParser& operator=(const skExpatParser&); 59 | 60 | static void startElementHandler(void * userData,const Char *name, const Char **atts); 61 | void startElement(const Char *name, const Char **atts); 62 | 63 | static void endElementHandler(void * userData,const Char *name); 64 | void endElement(const Char *name); 65 | 66 | static void characterDataHandler(void *userData, const XML_Char *s,int len); 67 | void characterData(const XML_Char *s,int len); 68 | 69 | static void startCDataHandler(void *userData); 70 | void startCData(); 71 | 72 | static void endCDataHandler(void *userData); 73 | void endCData (); 74 | 75 | skNodeList m_ElementStack; 76 | bool m_InCData; 77 | skElement * m_RootElement; 78 | }; 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skInputSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skInputSource.h,v 1.12 2003/11/20 16:24:22 sdw Exp $ 20 | */ 21 | #ifndef skInputSource_h 22 | #define skInputSource_h 23 | 24 | 25 | #include "skString.h" 26 | #include 27 | 28 | #ifdef STREAMS_ENABLED 29 | #ifdef STL_STREAMS 30 | #include 31 | using std::istream; 32 | using std::ifstream; 33 | #else 34 | #include 35 | #endif 36 | #endif 37 | 38 | /** 39 | * this interface encapsulates a source from which an object can be read 40 | * It is implemented by concrete classes 41 | */ 42 | class CLASSEXPORT skInputSource 43 | #ifdef __SYMBIAN32__ 44 | : public CBase 45 | #endif 46 | { 47 | public: 48 | IMPORT_C virtual ~skInputSource(); 49 | /** 50 | * Returns whether the source has reached the end 51 | */ 52 | virtual bool eof() const=0; 53 | /** 54 | * Returns and consumes the next character in the input 55 | */ 56 | virtual int get()=0; 57 | /** 58 | * Returns, but does not consume the next character in the input 59 | */ 60 | virtual int peek()=0; 61 | /** 62 | * Reads the whole source into a string 63 | */ 64 | virtual skString readAllToString()=0; 65 | }; 66 | 67 | class CLASSEXPORT skInputFile : public skInputSource 68 | { 69 | public: 70 | /** 71 | * Constructor. Opens the given file 72 | * @param filename the name of the file to open 73 | */ 74 | IMPORT_C skInputFile(const skString& filename); 75 | /** 76 | * Blank Constructor. 77 | */ 78 | IMPORT_C skInputFile(); 79 | /** 80 | * Opens the file 81 | * @param filename the name of the file to open 82 | */ 83 | IMPORT_C void open(const skString& filename); 84 | #ifdef __SYMBIAN32__ 85 | /** 86 | * Opens the file 87 | * \remarks only available in Symbian version 88 | * @param filename the name of the file to open 89 | */ 90 | IMPORT_C void open(const TDesC& file); 91 | #endif 92 | IMPORT_C virtual ~skInputFile(); 93 | /** 94 | * Returns whether the file has reached the end 95 | */ 96 | IMPORT_C virtual bool eof() const; 97 | /** 98 | * Returns and consumes the next character in the file 99 | */ 100 | IMPORT_C virtual int get(); 101 | /** 102 | * Returns, but does not consume the next character in the file 103 | */ 104 | IMPORT_C virtual int peek(); 105 | /** 106 | * Reads the whole source into a string 107 | * @exception Symbian - a leaving function 108 | */ 109 | IMPORT_C virtual skString readAllToString(); 110 | private: 111 | #ifdef STREAMS_ENABLED 112 | ifstream m_In; 113 | #else 114 | FILE * m_In; 115 | bool m_Peeked; 116 | int m_PeekedChar; 117 | #endif 118 | #ifdef UNICODE_STRINGS 119 | bool m_FileIsUnicode; 120 | #endif 121 | }; 122 | class CLASSEXPORT skInputString : public skInputSource 123 | { 124 | public: 125 | /** 126 | * Constructor. Wraps an input source around a string 127 | * @param in the string to read in 128 | */ 129 | IMPORT_C skInputString(const skString& in); 130 | /** 131 | * Destructor 132 | */ 133 | IMPORT_C virtual ~skInputString(); 134 | /** 135 | * Returns whether the input has reached the end of the string 136 | */ 137 | IMPORT_C virtual bool eof() const; 138 | /** 139 | * Returns and consumes the next character in the string 140 | */ 141 | IMPORT_C virtual int get(); 142 | /** 143 | * Returns, but does not consume the next character in the string 144 | */ 145 | IMPORT_C virtual int peek(); 146 | /** 147 | * Returns the input string in its entirety 148 | */ 149 | IMPORT_C virtual skString readAllToString(); 150 | private: 151 | skString m_In; 152 | unsigned int m_Pos; 153 | bool m_Peeked; 154 | int m_PeekedChar; 155 | }; 156 | 157 | #endif 158 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skMethodTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skMethodTable.h,v 1.9 2003/04/03 16:21:17 simkin_cvs Exp $ 20 | */ 21 | #ifndef skMETHODTABLE_H 22 | #define skMETHODTABLE_H 23 | 24 | #include "skSHashTable.h" 25 | #include "skParseNode.h" 26 | 27 | #ifdef INSTANTIATE_TEMPLATES 28 | EXTERN_TEMPLATE template class CLASSEXPORT skTSHashTable; 29 | #endif 30 | 31 | /** 32 | * This class can be used to cache parse trees. It is a hashtable mapping method name to parse tree 33 | */ 34 | class CLASSEXPORT skMethodTable : public skTSHashTable 35 | { 36 | }; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skNode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skNode.cpp,v 1.14 2003/04/23 14:34:51 simkin_cvs Exp $ 20 | */ 21 | #include "skNode.h" 22 | #include "skStringBuffer.h" 23 | 24 | //------------------------------------------ 25 | skNode::skNode() 26 | //------------------------------------------ 27 | :m_Parent(0) 28 | { 29 | } 30 | //------------------------------------------ 31 | skNode::skNode(const skNode& other) 32 | //------------------------------------------ 33 | :m_Parent(0) 34 | { 35 | } 36 | //------------------------------------------ 37 | EXPORT_C skNode::~skNode() 38 | //------------------------------------------ 39 | { 40 | } 41 | //------------------------------------------ 42 | skNode& skNode::operator=(const skNode& other) 43 | //------------------------------------------ 44 | { 45 | return *this; 46 | } 47 | //------------------------------------------ 48 | EXPORT_C skString skNode::getNodeValue() const 49 | //------------------------------------------ 50 | { 51 | return skString(); 52 | } 53 | //------------------------------------------ 54 | EXPORT_C void skNode::setNodeValue(const skString& ) 55 | //------------------------------------------ 56 | { 57 | } 58 | static const Char g_SpecialChars[]={'&','<','>','"'}; 59 | static const Char * const g_SpecialCharEscapes[]={skSTR("&"),skSTR("<"),skSTR(">"),skSTR(""")}; 60 | static const USize g_NumSpecialChars=sizeof(g_SpecialChars)/sizeof(Char); 61 | //------------------------------------------ 62 | EXPORT_C skString skNode::escapeXMLDelimiters(const skString& text,bool include_quote) 63 | //------------------------------------------ 64 | { 65 | skString out=text; 66 | bool need_to_scan=false; 67 | USize num_to_scan=g_NumSpecialChars; 68 | // don't replace the quote sign - so ignore the final special character 69 | if (include_quote==false) 70 | num_to_scan--; 71 | // first check if the text has any special characters in it 72 | for (USize i=0;i; 107 | #endif 108 | 109 | /** 110 | * This class represents a list of nodes 111 | */ 112 | class CLASSEXPORT skNodeList : public skTAList{ 113 | }; 114 | 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skNull.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skNull.h,v 1.6 2003/01/20 18:48:18 simkin_cvs Exp $ 20 | */ 21 | #ifndef skNULL_H 22 | #define skNULL_H 23 | 24 | #include "skExecutable.h" 25 | 26 | /** 27 | * This class provides a null object 28 | */ 29 | 30 | class CLASSEXPORT skNull : public skExecutable { 31 | }; 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skOutputDestination.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed out the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skOutputDestination.cpp,v 1.11 2003/04/14 15:24:57 simkin_cvs Exp $ 20 | */ 21 | #include "skOutputDestination.h" 22 | 23 | //----------------------------------------------------------------- 24 | skOutputDestination::~skOutputDestination() 25 | //----------------------------------------------------------------- 26 | { 27 | } 28 | //----------------------------------------------------------------- 29 | EXPORT_C skOutputFile::skOutputFile(const skString& filename) 30 | //----------------------------------------------------------------- 31 | : 32 | #ifdef STREAMS_ENABLED 33 | m_Out(filename) 34 | #else 35 | m_Out(0) 36 | #endif 37 | { 38 | #ifndef STREAMS_ENABLED 39 | #ifdef UNICODE_STRINGS 40 | #ifdef __SYMBIAN32__ 41 | // SYMBIAN_QUESTION: does this function leave??? 42 | m_Out=wfopen(filename.c_str(),skSTR("wb")); 43 | #else 44 | m_Out=_wfopen(filename,skSTR("wb")); 45 | #endif 46 | // write out a unicode tag 47 | if (m_Out){ 48 | fputc(0xFF,m_Out); 49 | fputc(0xFE,m_Out); 50 | } 51 | #else 52 | m_Out=fopen(filename,skSTR("w")); 53 | #endif 54 | #endif 55 | } 56 | //----------------------------------------------------------------- 57 | EXPORT_C skOutputFile::~skOutputFile() 58 | //----------------------------------------------------------------- 59 | { 60 | #ifndef STREAMS_ENABLED 61 | if (m_Out) 62 | fclose(m_Out); 63 | #endif 64 | } 65 | //----------------------------------------------------------------- 66 | EXPORT_C void skOutputFile::write(const skString& s) 67 | //----------------------------------------------------------------- 68 | { 69 | #ifdef STREAMS_ENABLED 70 | m_Out << s; 71 | #else 72 | // SYMBIAN_QUESTION: does this function leave??? 73 | fwrite(s.c_str(),s.length()*sizeof(Char),1,m_Out); 74 | #endif 75 | } 76 | #ifdef __SYMBIAN32__ 77 | // Symbian-friendly version 78 | //----------------------------------------------------------------- 79 | EXPORT_C void skOutputFile::write(const TDesC& s) 80 | //----------------------------------------------------------------- 81 | { 82 | #ifdef STREAMS_ENABLED 83 | m_Out << s; 84 | #else 85 | // SYMBIAN_QUESTION: does this function leave??? 86 | fwrite((const Char *)s.Ptr(),s.Length()*sizeof(Char),1,m_Out); 87 | #endif 88 | } 89 | #endif 90 | //----------------------------------------------------------------- 91 | EXPORT_C skOutputString::skOutputString(skStringBuffer& out) 92 | //----------------------------------------------------------------- 93 | : m_Out(out) 94 | { 95 | } 96 | //----------------------------------------------------------------- 97 | EXPORT_C skOutputString::~skOutputString() 98 | //----------------------------------------------------------------- 99 | { 100 | } 101 | //----------------------------------------------------------------- 102 | EXPORT_C void skOutputString::write(const skString& s) 103 | //----------------------------------------------------------------- 104 | { 105 | m_Out.append(s); 106 | } 107 | #ifdef __SYMBIAN32__ 108 | // Symbian-friendly version 109 | //----------------------------------------------------------------- 110 | EXPORT_C void skOutputString::write(const TDesC& s) 111 | //----------------------------------------------------------------- 112 | { 113 | m_Out.append(s); 114 | } 115 | #endif 116 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skOutputDestination.h: -------------------------------------------------------------------------------- 1 | /* 2 | copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skOutputDestination.h,v 1.11 2003/11/20 16:24:22 sdw Exp $ 20 | */ 21 | #ifndef skOutputDestination_h 22 | #define skOutputDestination_h 23 | 24 | #include "skStringBuffer.h" 25 | #include 26 | 27 | #ifdef STREAMS_ENABLED 28 | #ifdef STL_STREAMS 29 | #include 30 | using std::ofstream; 31 | #else 32 | #include 33 | #endif 34 | #endif 35 | 36 | /** 37 | * this interface encapsulates a destination to which an object can be written 38 | * It is implemented by concrete classes 39 | */ 40 | class CLASSEXPORT skOutputDestination 41 | #ifdef __SYMBIAN32__ 42 | : public CBase 43 | #endif 44 | { 45 | public: 46 | /** 47 | * Virtual destructor 48 | */ 49 | virtual ~skOutputDestination(); 50 | /** 51 | * Writes a string out 52 | */ 53 | virtual void write(const skString& s)=0; 54 | #ifdef __SYMBIAN32__ 55 | /** 56 | * Writes a string out 57 | * \remarks only available in Symbian version 58 | */ 59 | virtual void write(const TDesC& s)=0; 60 | #endif 61 | }; 62 | class CLASSEXPORT skOutputFile : public skOutputDestination 63 | { 64 | public: 65 | /** 66 | * Opens a file for writing to 67 | * @param file the name of the file to open 68 | */ 69 | IMPORT_C skOutputFile(const skString& file); 70 | /** 71 | * Destructor - closes the file 72 | */ 73 | virtual IMPORT_C ~skOutputFile(); 74 | /** 75 | * Writes a string to a file 76 | */ 77 | virtual IMPORT_C void write(const skString& s); 78 | #ifdef __SYMBIAN32__ 79 | /** 80 | * Writes a string to a file 81 | * \remarks only available in Symbian version 82 | */ 83 | virtual IMPORT_C void write(const TDesC& s); 84 | #endif 85 | private: 86 | #ifdef STREAMS_ENABLED 87 | ofstream m_Out; 88 | #else 89 | FILE * m_Out; 90 | #endif 91 | }; 92 | class CLASSEXPORT skOutputString : public skOutputDestination 93 | { 94 | public: 95 | /** 96 | * Creates an output wrapped around a string buffer 97 | * @param out the string buffer to be wrapped 98 | */ 99 | IMPORT_C skOutputString(skStringBuffer& out); 100 | virtual IMPORT_C ~skOutputString(); 101 | /** 102 | * Adds a string to the buffer 103 | * @exception Symbian - a leaving function 104 | */ 105 | virtual IMPORT_C void write(const skString& s); 106 | #ifdef __SYMBIAN32__ 107 | /** 108 | * Adds a string to the buffer 109 | * \remarks only available in Symbian version 110 | * @exception Symbian - a leaving function 111 | */ 112 | virtual IMPORT_C void write(const TDesC& s); 113 | #endif 114 | private: 115 | skStringBuffer& m_Out; 116 | }; 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skParseNode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skParseNode.cpp,v 1.7 2003/04/04 17:04:25 simkin_cvs Exp $ 20 | */ 21 | #include "skParseNode.h" 22 | #ifdef USE_BYTECODES 23 | #ifdef _DEBUG 24 | #include "skTracer.h" 25 | #endif 26 | #ifdef _DEBUG_BYTECODES 27 | static const Char * g_ByteCodeNames[]={ 28 | skSTR("NullStat"), 29 | skSTR("StatList"), 30 | skSTR("Switch"), 31 | skSTR("If"), 32 | skSTR("Return"), 33 | skSTR("While"), 34 | skSTR("ForEach"), 35 | skSTR("QualifierIndex"), 36 | skSTR("For"), 37 | skSTR("Assign"), 38 | skSTR("Method"), 39 | skSTR("IdList"), 40 | skSTR("IdWithMethod"), 41 | skSTR("Id"), 42 | skSTR("ExprList"), 43 | skSTR("String"), 44 | skSTR("Int"), 45 | skSTR("IntInline"), 46 | skSTR("Char"), 47 | #ifdef USE_FLOATING_POINT 48 | skSTR("Float"), 49 | #endif 50 | skSTR("Op"), 51 | skSTR("CaseList") 52 | }; 53 | #endif 54 | #endif 55 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skRValueArray.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2002 Simon Whiteside 3 | 4 | * $Id: skRValueArray.h,v 1.12 2003/04/11 18:05:39 simkin_cvs Exp $ 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | 20 | */ 21 | #ifndef skRVALUEARRAY_H 22 | #define skRVALUEARRAY_H 23 | 24 | #include "skRValue.h" 25 | #include "skValist.h" 26 | 27 | #ifdef INSTANTIATE_TEMPLATES 28 | EXTERN_TEMPLATE template class CLASSEXPORT skTVAList; 29 | #endif 30 | /** 31 | * This class provides an array of RValues 32 | */ 33 | class CLASSEXPORT skRValueArray : public skTVAList 34 | { 35 | public: 36 | /** 37 | * Default Constructor: creates an array of zero size 38 | */ 39 | inline skRValueArray() 40 | { 41 | } 42 | virtual ~skRValueArray(){ 43 | } 44 | }; 45 | #endif 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skRValueTable.h: -------------------------------------------------------------------------------- 1 | /** 2 | $Id: skRValueTable.h,v 1.11 2003/04/11 18:05:39 simkin_cvs Exp $ 3 | Copyright 1996-2003 4 | Simon Whiteside 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | 20 | */ 21 | #ifndef skRVALUETABLE_H 22 | #define skRVALUETABLE_H 23 | 24 | #include "skSHashTable.h" 25 | #include "skRValue.h" 26 | 27 | #ifdef INSTANTIATE_TEMPLATES 28 | EXTERN_TEMPLATE template class CLASSEXPORT skTSHashTable; 29 | EXTERN_TEMPLATE template class CLASSEXPORT skTSHashTableIterator; 30 | #endif 31 | 32 | /** This class is used to hold a hash table of skRValue's based on name. It is used to store local or global variables in the interpreter 33 | */ 34 | class CLASSEXPORT skRValueTable: public skTSHashTable 35 | { 36 | public: 37 | /** This method constructs a blank RValueTable 38 | * @param size - the initial size of the table 39 | */ 40 | inline skRValueTable(unsigned short size) 41 | : skTSHashTable(size){ 42 | } 43 | /** Default constructor */ 44 | inline skRValueTable(){ 45 | } 46 | /** Destructor */ 47 | inline virtual ~skRValueTable(){ 48 | } 49 | 50 | }; 51 | class CLASSEXPORT skRValueTableIterator: public skTSHashTableIterator 52 | { 53 | public: 54 | inline skRValueTableIterator(const skRValueTable& table) 55 | : skTSHashTableIterator(table){ 56 | } 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skRuntimeException.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skRuntimeException.h,v 1.16 2003/04/14 15:24:57 simkin_cvs Exp $ 20 | */ 21 | #ifndef SKRUNTIMEEXCEPTION_H 22 | #define SKRUNTIMEEXCEPTION_H 23 | 24 | #include "skException.h" 25 | #include "skString.h" 26 | 27 | /** 28 | * This exception is thrown when there are execution errors in a Simkin script 29 | */ 30 | class CLASSEXPORT skRuntimeException : public skException 31 | { 32 | public: 33 | /** 34 | * Constructor - receives information about the exception 35 | */ 36 | skRuntimeException(const skString& location,int line_num,const skString& msg) 37 | : m_LineNum(line_num),m_Msg(msg),m_Location(location){ 38 | } 39 | /** 40 | * this method returns the description of the exception 41 | */ 42 | skString getMessage() const { 43 | return m_Msg; 44 | } 45 | 46 | /** 47 | * this method returns a verbose description of the exception 48 | */ 49 | skString toString() const { 50 | return skString::addStrings(m_Location.ptr(),s_colon,skString::from(m_LineNum).ptr(),s_Dash,m_Msg.ptr()); 51 | } 52 | /** 53 | * returns the location of the script 54 | */ 55 | skString location() const{ 56 | return m_Location; 57 | } 58 | /** 59 | * shows the line number where the runtime error occurred 60 | */ 61 | int lineNum() const{ 62 | return m_LineNum; 63 | } 64 | private: 65 | int m_LineNum; 66 | skString m_Msg; 67 | skString m_Location; 68 | }; 69 | #endif 70 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skSHashTable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skSHashTable.cpp,v 1.6 2003/07/01 12:06:05 sdw Exp $ 20 | */ 21 | #include "skSHashTable.h" 22 | 23 | 24 | //--------------------------------------------------- 25 | void skSHashTable::createSlots() 26 | //--------------------------------------------------- 27 | { 28 | m_Slots=skARRAY_NEW(skSHashEntryList,m_Size); 29 | } 30 | //--------------------------------------------------- 31 | EXPORT_C void skSHashTable::clear() 32 | //--------------------------------------------------- 33 | { 34 | if (m_Slots){ 35 | for (USize x=0;xm_Value); 50 | } 51 | m_Slots[x].clearAndDestroy(); 52 | } 53 | } 54 | m_NumEntries=0; 55 | } 56 | //--------------------------------------------------- 57 | EXPORT_C void skSHashTable::clearAndDestroy() 58 | //--------------------------------------------------- 59 | { 60 | if (m_Slots){ 61 | for (USize x=0;xm_Value); 66 | } 67 | m_Slots[x].clearAndDestroy(); 68 | } 69 | } 70 | m_NumEntries=0; 71 | } 72 | //--------------------------------------------------- 73 | EXPORT_C void skSHashTable::insertKeyAndValue(const skString& key, void * value) 74 | //--------------------------------------------------- 75 | { 76 | if (m_Slots==0) 77 | createSlots(); 78 | assert(value); 79 | USize slot=0; 80 | skSHashEntry * pentry=findEntry(key,slot); 81 | if (pentry){ 82 | // replace existing key and value 83 | deleteValue(pentry->m_Value); 84 | pentry->m_Key=key; 85 | pentry->m_Value=value; 86 | }else{ 87 | // add key and value 88 | skSHashEntry * entry=skNEW(skSHashEntry(key,value)); 89 | SAVE_POINTER(entry); 90 | m_Slots[slot].append(entry); 91 | RELEASE_POINTER(entry); 92 | m_NumEntries++; 93 | } 94 | } 95 | //--------------------------------------------------- 96 | EXPORT_C void skSHashTable::del(const skString& key) 97 | //--------------------------------------------------- 98 | { 99 | USize slot=0; 100 | skSHashEntry * pentry=findEntry(key,slot); 101 | if (pentry){ 102 | deleteValue(pentry->m_Value); 103 | m_Slots[slot].removeAndDestroy(pentry); 104 | m_NumEntries--; 105 | } 106 | } 107 | //--------------------------------------------------- 108 | EXPORT_C void skSHashTable::remove(const skString& key) 109 | //--------------------------------------------------- 110 | { 111 | USize slot=0; 112 | skSHashEntry * pentry=findEntry(key,slot); 113 | if (pentry){ 114 | m_Slots[slot].removeAndDestroy(pentry); 115 | m_NumEntries--; 116 | } 117 | } 118 | //--------------------------------------------------- 119 | EXPORT_C int skSHashTableIterator::operator()() 120 | //--------------------------------------------------- 121 | { 122 | int ret=0; 123 | if (m_Table.m_NumEntries){ 124 | while (m_Slotoperator()(); 129 | if (pentry==0){ 130 | // no more in this slot, go to the next one 131 | m_Slot++; 132 | delete m_ListIterator; 133 | m_ListIterator=0; 134 | }else{ 135 | m_Value=pentry->m_Value; 136 | m_Key=pentry->m_Key; 137 | ret=1; 138 | break; 139 | } 140 | } 141 | } 142 | return ret; 143 | } 144 | 145 | 146 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skStackFrame.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skStackFrame.cpp,v 1.3 2003/04/14 15:24:57 simkin_cvs Exp $ 20 | */ 21 | 22 | #include "skStackFrame.h" 23 | #include "skExecutableContext.h" 24 | 25 | //--------------------------------------------------- 26 | skStackFrame::skStackFrame(const skString& location, 27 | skiExecutable * obj, 28 | skRValueTable& vars, 29 | skExecutableContext& context) 30 | //--------------------------------------------------- 31 | : m_Location(location),m_LineNum(0),m_Context(context),m_Object(obj), 32 | m_Vars(vars),m_ParentFrame(0) 33 | { 34 | m_Context.pushStackFrame(this); 35 | } 36 | //--------------------------------------------------- 37 | skStackFrame::~skStackFrame() 38 | //--------------------------------------------------- 39 | { 40 | m_Context.popStackFrame(); 41 | } 42 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skStatementStepper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skStatementStepper.h,v 1.10 2003/03/18 19:36:13 simkin_cvs Exp $ 20 | */ 21 | #ifndef skSTATEMENTSTEPPER_H 22 | #define skSTATEMENTSTEPPER_H 23 | 24 | #include "skGeneral.h" 25 | 26 | class CLASSEXPORT skStackFrame; 27 | class CLASSEXPORT skException; 28 | 29 | /** 30 | * This abstract class is used to provide an interface for the Interpreter to call 31 | * each time a statement is executed 32 | */ 33 | 34 | class CLASSEXPORT skStatementStepper { 35 | public: 36 | /** This method is called each time a statement is executed by the interpreter, just before the statement is performed 37 | * @return false to halt the execution of the current method 38 | * @param stack_frame the current stack frame 39 | * @param statement_type an integer indicating the type of statement, a constant s_ value from skParseNode.h 40 | */ 41 | virtual bool statementExecuted(const skStackFrame& stack_frame,int statement_type)=0; 42 | /** This method is called each time a compound statement is executed by the interpreter, just before the statement is performed 43 | * @param stack_frame the current stack frame 44 | * @return false to halt the execution of the current method 45 | */ 46 | virtual bool compoundStatementExecuted(const skStackFrame& stack_frame)=0; 47 | /** 48 | * This method is called if an exception is encountered while executing a script. 49 | * @param stack_frame the current stack frame 50 | * @param e the exception that has occurred 51 | * @return true to throw the exception, false to ignore and continue 52 | */ 53 | virtual bool exceptionEncountered(const skStackFrame * stack_frame,const skException& e)=0; 54 | /** 55 | * This method is called if the interpreter encounters a breakpoint command. 56 | * @param stack_frame the current stack frame 57 | */ 58 | virtual void breakpoint(const skStackFrame * stack_frame)=0; 59 | }; 60 | #endif 61 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skStringList.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | $Id: skStringList.h,v 1.10 2003/03/24 19:02:16 simkin_cvs Exp $ 20 | */ 21 | #ifndef STRINGLIST_H 22 | #define STRINGLIST_H 23 | 24 | #include "skString.h" 25 | #include "skValist.h" 26 | 27 | #ifdef INSTANTIATE_TEMPLATES 28 | EXTERN_TEMPLATE template class CLASSEXPORT skTVAList; 29 | #endif 30 | 31 | /** 32 | * This class is a list of Strings, held by value 33 | */ 34 | class skStringList : public skTVAList { 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skTextNode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skTextNode.cpp,v 1.11 2003/04/19 13:22:24 simkin_cvs Exp $ 20 | */ 21 | #include "skTextNode.h" 22 | #include "skOutputDestination.h" 23 | //------------------------------------------ 24 | EXPORT_C skTextNode::skTextNode(const skString& text) 25 | //------------------------------------------ 26 | :m_Text(text) 27 | { 28 | } 29 | //------------------------------------------ 30 | EXPORT_C skTextNode::~skTextNode() 31 | //------------------------------------------ 32 | { 33 | } 34 | //------------------------------------------ 35 | EXPORT_C skString skTextNode::getNodeValue() const 36 | //------------------------------------------ 37 | { 38 | return m_Text; 39 | } 40 | //------------------------------------------ 41 | EXPORT_C void skTextNode::setNodeValue(const skString& text) 42 | //------------------------------------------ 43 | { 44 | m_Text=text; 45 | } 46 | //------------------------------------------ 47 | EXPORT_C skNode::NodeType skTextNode::getNodeType() const 48 | //------------------------------------------ 49 | { 50 | return TEXT_NODE; 51 | } 52 | //------------------------------------------ 53 | EXPORT_C skNode * skTextNode::clone() 54 | //------------------------------------------ 55 | { 56 | return new skTextNode(m_Text); 57 | } 58 | //------------------------------------------ 59 | EXPORT_C void skTextNode::write(skOutputDestination& out) const 60 | //------------------------------------------ 61 | { 62 | out.write(escapeXMLDelimiters(m_Text,false)); 63 | } 64 | //------------------------------------------ 65 | EXPORT_C skString skTextNode::toString() const 66 | //------------------------------------------ 67 | { 68 | return escapeXMLDelimiters(m_Text,false); 69 | } 70 | //------------------------------------------ 71 | EXPORT_C bool skTextNode::equals(const skNode& other) const 72 | //------------------------------------------ 73 | { 74 | bool equals=false; 75 | if (other.getNodeType()==getNodeType()){ 76 | equals=(m_Text==((skTextNode *)&other)->m_Text); 77 | } 78 | return equals; 79 | } 80 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skTextNode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skTextNode.h,v 1.11 2003/04/19 13:22:24 simkin_cvs Exp $ 20 | */ 21 | #ifndef skTEXTNODE_H 22 | #define skTEXTNODE_H 23 | 24 | #include "skNode.h" 25 | 26 | /** 27 | * This class represents a text node. This holds the text within or between two elements in an XML document 28 | */ 29 | class CLASSEXPORT skTextNode : public skNode 30 | { 31 | public: 32 | /** Contructs a new text node with the given text 33 | * @param text - the text to use as the node's value 34 | */ 35 | IMPORT_C skTextNode(const skString& text); 36 | /** 37 | * Virtual destructor 38 | */ 39 | IMPORT_C virtual ~skTextNode(); 40 | /** 41 | * returns the text within the text node 42 | *@return the text for this node 43 | */ 44 | IMPORT_C virtual skString getNodeValue() const; 45 | /** 46 | * sets the text in this node 47 | *@param s - the new text for this node 48 | */ 49 | IMPORT_C virtual void setNodeValue(const skString& s); 50 | /** 51 | * this returns the type of this node 52 | * @return returns TEXT_NODE 53 | */ 54 | IMPORT_C virtual NodeType getNodeType() const; 55 | /** 56 | * this method returns a new skTextNode that has the same text value as this one 57 | * @return a new copy of this node 58 | * @exception Symbian - a leaving function 59 | */ 60 | IMPORT_C virtual skNode * clone(); 61 | /** 62 | * writes the text in this node to the given destination 63 | * @param out - the destination to write to 64 | * @exception Symbian - a leaving function 65 | */ 66 | IMPORT_C virtual void write(skOutputDestination& out) const; 67 | /** 68 | * writes the text in this node to a string 69 | * @return the string containing the text 70 | * @exception Symbian - a leaving function 71 | */ 72 | IMPORT_C virtual skString toString() const; 73 | /** 74 | * Does a deep comparison against another node 75 | */ 76 | IMPORT_C virtual bool equals(const skNode& other) const; 77 | protected: 78 | /** this member variable holds the text for this node */ 79 | skString m_Text; 80 | }; 81 | #endif 82 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skTraceCallback.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skTraceCallback.h,v 1.5 2003/01/20 18:48:18 simkin_cvs Exp $ 20 | */ 21 | #ifndef skTRACECALLBACK_H 22 | #define skTRACECALLBACK_H 23 | #include "skString.h" 24 | 25 | /** 26 | * This abstract class is used to provide an interface for the Interpreter to pass 27 | * trace messages to 28 | */ 29 | 30 | class CLASSEXPORT skTraceCallback { 31 | public: 32 | /** This method receives trace messages from the interpreter and Simkin scripts 33 | * @param msg the trace message 34 | */ 35 | virtual void trace(const skString& msg)=0; 36 | }; 37 | #endif 38 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skTracer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skTracer.cpp,v 1.17 2003/11/20 16:24:22 sdw Exp $ 20 | */ 21 | #include "skTracer.h" 22 | #ifdef STL_STREAMS 23 | #include 24 | #endif 25 | 26 | //------------------------------------------ 27 | void skTracer::trace(const skString& s) 28 | //------------------------------------------ 29 | { 30 | #ifdef STREAMS_ENABLED 31 | std::cout << s; 32 | std::cout.flush(); 33 | #else 34 | #ifdef UNICODE_STRINGS 35 | #ifdef _WIN32_WCE 36 | NKDbgPrintfW((Char *)(const Char *)s); 37 | #else 38 | #ifdef __SYMBIAN32__ 39 | // TO BE IMPLEMENTED 40 | #else 41 | wprintf((const Char *)s); 42 | #endif 43 | #endif 44 | #else 45 | printf((const Char *)s); 46 | #endif 47 | #endif 48 | } 49 | //------------------------------------------ 50 | void skTracer::trace(const Char * s) 51 | //------------------------------------------ 52 | { 53 | #ifdef STREAMS_ENABLED 54 | std::cout << s; 55 | std::cout.flush(); 56 | #else 57 | #ifdef UNICODE_STRINGS 58 | #ifdef _WIN32_WCE 59 | NKDbgPrintfW((Char *)(const Char *)s); 60 | #else 61 | #ifdef __SYMBIAN32__ 62 | // TO BE IMPLEMENTED 63 | #else 64 | wprintf((const Char *)s); 65 | #endif 66 | #endif 67 | #else 68 | printf((const Char *)s); 69 | #endif 70 | #endif 71 | } 72 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skTracer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skTracer.h,v 1.11 2003/04/11 18:05:39 simkin_cvs Exp $ 20 | */ 21 | 22 | #ifndef skTRACER_H 23 | #define skTRACER_H 24 | 25 | #include "skString.h" 26 | 27 | /** 28 | * This class is used to provide output to a trace 29 | */ 30 | class CLASSEXPORT skTracer 31 | #ifdef __SYMBIAN32__ 32 | : public CBase 33 | #endif 34 | { 35 | public: 36 | /** 37 | * this function outputs its arguments to stdout 38 | */ 39 | IMPORT_C static void trace(const skString& s); 40 | /** 41 | * this function outputs its arguments to stdout 42 | */ 43 | IMPORT_C static void trace(const Char * s); 44 | }; 45 | #endif 46 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skXMLParseException.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1996-2003 3 | Simon Whiteside 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | * $Id: skXMLParseException.h,v 1.7 2003/03/06 13:05:14 simkin_cvs Exp $ 20 | */ 21 | 22 | #ifndef sk_XMLPARSEEXCEPTION_H 23 | #define sk_XMLPARSEEXCEPTION_H 24 | 25 | #include "skException.h" 26 | 27 | const int skXMLParseException_Code=5; 28 | 29 | /** 30 | * This class represents an exception during the parsing of an XML document - using the Simkin DOM classes. 31 | */ 32 | class CLASSEXPORT skXMLParseException : public skException 33 | { 34 | public: 35 | /** Constructs a new exception */ 36 | skXMLParseException (const skString& error,int line_num): m_Error(error),m_LineNum(line_num) {} 37 | /** returns the line number within the document where the error occurred */ 38 | int getLineNum() const { return m_LineNum; } 39 | /** returns a string describing the error */ 40 | skString getErrorMessage() const { return m_Error; } 41 | skString getMessage() const { return m_Error; } 42 | skString toString() const { return m_Error; } 43 | private: 44 | int m_LineNum; 45 | skString m_Error; 46 | }; 47 | #endif 48 | -------------------------------------------------------------------------------- /Flatland Standalone/Simkin/skosfcn.h: -------------------------------------------------------------------------------- 1 | #include 2 | extern "C" int read(int handle, void *buf, unsigned len); 3 | void yyerror(char * msg); 4 | int yylex ( YYSTYPE * lvalp ); 5 | extern "C" void *alloca(size_t size); 6 | -------------------------------------------------------------------------------- /Flatland Standalone/Spans.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | // Dimensions of each image size. 7 | 8 | extern int image_dimensions_list[IMAGE_SIZES]; 9 | 10 | #ifdef STREAMING_MEDIA 11 | 12 | // Semaphore for pixmap image updating. 13 | 14 | extern void *image_updated_semaphore; 15 | 16 | #endif 17 | 18 | // Externally visible functions. 19 | 20 | cache_entry * 21 | get_cache_entry(pixmap *pixmap_ptr, int brightness_index); 22 | 23 | bool 24 | create_image_caches(void); 25 | 26 | void 27 | delete_image_caches(void); 28 | 29 | int 30 | get_size_index(int texture_width, int texture_height); 31 | 32 | void 33 | set_size_indices(texture *texture_ptr); 34 | 35 | bool 36 | add_span(int sy, edge *left_edge_ptr, edge *right_edge_ptr, pixmap *pixmap_ptr, 37 | pixel colour_pixel, int brightness_index, bool is_popup); 38 | 39 | void 40 | add_movable_span(int sy, edge *left_edge_ptr, edge *right_edge_ptr, 41 | pixmap *pixmap_ptr, pixel colour_pixel, int brightness_index); 42 | -------------------------------------------------------------------------------- /Flatland Standalone/Unzip/ioapi.c: -------------------------------------------------------------------------------- 1 | /* ioapi.c -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "..\zlib\zlib.h" 14 | #include "ioapi.h" 15 | 16 | 17 | 18 | /* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ 19 | 20 | #ifndef SEEK_CUR 21 | #define SEEK_CUR 1 22 | #endif 23 | 24 | #ifndef SEEK_END 25 | #define SEEK_END 2 26 | #endif 27 | 28 | #ifndef SEEK_SET 29 | #define SEEK_SET 0 30 | #endif 31 | 32 | voidpf ZCALLBACK fopen_file_func OF(( 33 | voidpf opaque, 34 | const char* filename, 35 | int mode)); 36 | 37 | uLong ZCALLBACK fread_file_func OF(( 38 | voidpf opaque, 39 | voidpf stream, 40 | void* buf, 41 | uLong size)); 42 | 43 | uLong ZCALLBACK fwrite_file_func OF(( 44 | voidpf opaque, 45 | voidpf stream, 46 | const void* buf, 47 | uLong size)); 48 | 49 | long ZCALLBACK ftell_file_func OF(( 50 | voidpf opaque, 51 | voidpf stream)); 52 | 53 | long ZCALLBACK fseek_file_func OF(( 54 | voidpf opaque, 55 | voidpf stream, 56 | uLong offset, 57 | int origin)); 58 | 59 | int ZCALLBACK fclose_file_func OF(( 60 | voidpf opaque, 61 | voidpf stream)); 62 | 63 | int ZCALLBACK ferror_file_func OF(( 64 | voidpf opaque, 65 | voidpf stream)); 66 | 67 | 68 | voidpf ZCALLBACK fopen_file_func (opaque, filename, mode) 69 | voidpf opaque; 70 | const char* filename; 71 | int mode; 72 | { 73 | FILE* file = NULL; 74 | const char* mode_fopen = NULL; 75 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 76 | mode_fopen = "rb"; 77 | else 78 | if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 79 | mode_fopen = "r+b"; 80 | else 81 | if (mode & ZLIB_FILEFUNC_MODE_CREATE) 82 | mode_fopen = "wb"; 83 | 84 | if ((filename!=NULL) && (mode_fopen != NULL)) 85 | file = fopen(filename, mode_fopen); 86 | return file; 87 | } 88 | 89 | 90 | uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) 91 | voidpf opaque; 92 | voidpf stream; 93 | void* buf; 94 | uLong size; 95 | { 96 | uLong ret; 97 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); 98 | return ret; 99 | } 100 | 101 | 102 | uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) 103 | voidpf opaque; 104 | voidpf stream; 105 | const void* buf; 106 | uLong size; 107 | { 108 | uLong ret; 109 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); 110 | return ret; 111 | } 112 | 113 | long ZCALLBACK ftell_file_func (opaque, stream) 114 | voidpf opaque; 115 | voidpf stream; 116 | { 117 | long ret; 118 | ret = ftell((FILE *)stream); 119 | return ret; 120 | } 121 | 122 | long ZCALLBACK fseek_file_func (opaque, stream, offset, origin) 123 | voidpf opaque; 124 | voidpf stream; 125 | uLong offset; 126 | int origin; 127 | { 128 | int fseek_origin=0; 129 | long ret; 130 | switch (origin) 131 | { 132 | case ZLIB_FILEFUNC_SEEK_CUR : 133 | fseek_origin = SEEK_CUR; 134 | break; 135 | case ZLIB_FILEFUNC_SEEK_END : 136 | fseek_origin = SEEK_END; 137 | break; 138 | case ZLIB_FILEFUNC_SEEK_SET : 139 | fseek_origin = SEEK_SET; 140 | break; 141 | default: return -1; 142 | } 143 | ret = 0; 144 | fseek((FILE *)stream, offset, fseek_origin); 145 | return ret; 146 | } 147 | 148 | int ZCALLBACK fclose_file_func (opaque, stream) 149 | voidpf opaque; 150 | voidpf stream; 151 | { 152 | int ret; 153 | ret = fclose((FILE *)stream); 154 | return ret; 155 | } 156 | 157 | int ZCALLBACK ferror_file_func (opaque, stream) 158 | voidpf opaque; 159 | voidpf stream; 160 | { 161 | int ret; 162 | ret = ferror((FILE *)stream); 163 | return ret; 164 | } 165 | 166 | void fill_fopen_filefunc (pzlib_filefunc_def) 167 | zlib_filefunc_def* pzlib_filefunc_def; 168 | { 169 | pzlib_filefunc_def->zopen_file = fopen_file_func; 170 | pzlib_filefunc_def->zread_file = fread_file_func; 171 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; 172 | pzlib_filefunc_def->ztell_file = ftell_file_func; 173 | pzlib_filefunc_def->zseek_file = fseek_file_func; 174 | pzlib_filefunc_def->zclose_file = fclose_file_func; 175 | pzlib_filefunc_def->zerror_file = ferror_file_func; 176 | pzlib_filefunc_def->opaque = NULL; 177 | } 178 | -------------------------------------------------------------------------------- /Flatland Standalone/Unzip/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | */ 8 | 9 | #ifndef _ZLIBIOAPI_H 10 | #define _ZLIBIOAPI_H 11 | 12 | 13 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 14 | #define ZLIB_FILEFUNC_SEEK_END (2) 15 | #define ZLIB_FILEFUNC_SEEK_SET (0) 16 | 17 | #define ZLIB_FILEFUNC_MODE_READ (1) 18 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 19 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 20 | 21 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 22 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 23 | 24 | 25 | #ifndef ZCALLBACK 26 | 27 | #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 28 | #define ZCALLBACK CALLBACK 29 | #else 30 | #define ZCALLBACK 31 | #endif 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 39 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 40 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 41 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 42 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 43 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 44 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 45 | 46 | typedef struct zlib_filefunc_def_s 47 | { 48 | open_file_func zopen_file; 49 | read_file_func zread_file; 50 | write_file_func zwrite_file; 51 | tell_file_func ztell_file; 52 | seek_file_func zseek_file; 53 | close_file_func zclose_file; 54 | testerror_file_func zerror_file; 55 | voidpf opaque; 56 | } zlib_filefunc_def; 57 | 58 | 59 | 60 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 61 | 62 | #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 63 | #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 64 | #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 65 | #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 66 | #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 67 | #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 68 | 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /Flatland Standalone/Utils.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // Copyright (C) 2018 Flatland Online Inc., Philip Stephens, Michael Powers. 3 | // This code is licensed under the MIT license (see LICENCE file for details). 4 | //****************************************************************************** 5 | 6 | // Current load index for textures and waves. 7 | 8 | extern int curr_load_index; 9 | 10 | // Flag indicating whether current URL has been opened. 11 | 12 | extern bool curr_URL_opened; 13 | 14 | // Externally visible functions. 15 | 16 | block_def * 17 | get_block_def(char block_symbol); 18 | 19 | block_def * 20 | get_block_def(word block_symbol); 21 | 22 | block_def * 23 | get_block_def(const char *block_identifier); 24 | 25 | texture * 26 | load_texture(blockset *blockset_ptr, char *texture_URL, bool add_to_blockset, bool force_32_bit_pixels = false); 27 | 28 | #ifdef STREAMING_MEDIA 29 | 30 | char * 31 | create_stream_URL(string stream_URL); 32 | 33 | texture * 34 | create_video_texture(char *name, video_rect *rect_ptr, bool unlimited_size); 35 | 36 | #endif 37 | 38 | bool 39 | load_wave_file(const char *URL, const char *file_path, wave *wave_ptr); 40 | 41 | wave * 42 | load_wave(blockset *blockset_ptr, char *wave_URL); 43 | 44 | entrance * 45 | find_entrance(const char *name); 46 | 47 | imagemap * 48 | find_imagemap(const char *name); 49 | 50 | imagemap * 51 | add_imagemap(const char *name); 52 | 53 | bool 54 | check_for_popup_selection(popup *popup_ptr, int popup_width, int popup_height); 55 | 56 | void 57 | add_trigger_to_global_list(trigger *trigger_ptr, int column, int row, int level); 58 | 59 | void 60 | init_global_trigger(trigger *trigger_ptr); 61 | 62 | void 63 | init_sprite_polygon(block *block_ptr, polygon *polygon_ptr, part *part_ptr); 64 | 65 | void 66 | compute_light_list_bounding_box(light *light_list, vertex translation, 67 | int &min_column, int &min_row, int &min_level, 68 | int &max_column, int &max_row, int &max_level); 69 | 70 | void 71 | reset_active_lights(int min_column, int min_row, int min_level, 72 | int max_column, int max_row, int max_level); 73 | 74 | void 75 | set_trigger_delay(trigger *trigger_ptr, int curr_time_ms); 76 | 77 | int 78 | compute_active_polygons(block *block_ptr, int column, int row, int level, 79 | bool check_all_sides); 80 | 81 | void 82 | reset_active_polygons(int column, int row, int level); 83 | 84 | bool 85 | square_has_entrance(square *square_ptr); 86 | 87 | void 88 | add_clock_action(action *action_ptr); 89 | 90 | void 91 | remove_clock_action(action *action_ptr); 92 | 93 | void 94 | remove_clock_action_by_block(block *block_ptr); 95 | 96 | void 97 | remove_clock_action_by_type(action *action_ptr, int type); 98 | 99 | block * 100 | add_fixed_block(block_def *block_def_ptr, square *square_ptr, bool update_active_polygons); 101 | 102 | block * 103 | add_movable_block(block_def *block_def_ptr, square *square_ptr, vertex translation); 104 | 105 | void 106 | remove_block_from_square(square *square_ptr); 107 | 108 | void 109 | remove_movable_block(block *block_ptr); 110 | 111 | int 112 | get_brightness_index(float brightness); 113 | 114 | float 115 | get_brightness(int brightness_index); 116 | 117 | void 118 | set_player_size(void); 119 | 120 | bool 121 | create_player_block(void); 122 | 123 | block * 124 | create_new_block(block_def *block_def_ptr, square *square_ptr, vertex translation); 125 | 126 | block_def * 127 | create_exact_dup_block_def(block_def *block_def_ptr); 128 | 129 | void 130 | create_sprite_polygon(block_def *block_def_ptr, part *part_ptr); 131 | 132 | void 133 | init_spot(void); 134 | 135 | void 136 | request_URL(const char *URL, const char *file_path, const char *target, bool no_cache); 137 | 138 | bool 139 | download_URL(const char *URL, const char *file_path, bool no_cache); 140 | 141 | void 142 | update_texture_dependancies(texture *custom_texture_ptr); 143 | 144 | void 145 | update_wave_dependancies(wave *wave_ptr); 146 | 147 | void 148 | initiate_first_download(void); 149 | 150 | void 151 | initiate_next_download(void); 152 | 153 | void 154 | handle_current_download(void); 155 | 156 | light * 157 | find_light(light *light_list, const char *light_name); 158 | 159 | sound * 160 | find_sound(sound *sound_list, const char *sound_name); 161 | 162 | popup * 163 | find_popup(popup *popup_list, const char *popup_name); 164 | 165 | string 166 | get_symbol(word symbol); -------------------------------------------------------------------------------- /Flatland Standalone/roverresources.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/roverresources.rc -------------------------------------------------------------------------------- /Flatland Standalone/small.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/powerspowers/flatland/731cc2101889135fbd749f4e2edc2d9d82946cc0/Flatland Standalone/small.ico -------------------------------------------------------------------------------- /Flatland Standalone/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Flatland Standalone.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /Flatland Standalone/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | #include 14 | 15 | // C RunTime Header Files 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | // TODO: reference additional headers your program requires here 23 | -------------------------------------------------------------------------------- /Flatland Standalone/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /Flatland Standalone/zlib/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) 23 | Bytef *dest; 24 | uLongf *destLen; 25 | const Bytef *source; 26 | uLong sourceLen; 27 | int level; 28 | { 29 | z_stream stream; 30 | int err; 31 | const uInt max = (uInt)-1; 32 | uLong left; 33 | 34 | left = *destLen; 35 | *destLen = 0; 36 | 37 | stream.zalloc = (alloc_func)0; 38 | stream.zfree = (free_func)0; 39 | stream.opaque = (voidpf)0; 40 | 41 | err = deflateInit(&stream, level); 42 | if (err != Z_OK) return err; 43 | 44 | stream.next_out = dest; 45 | stream.avail_out = 0; 46 | stream.next_in = (z_const Bytef *)source; 47 | stream.avail_in = 0; 48 | 49 | do { 50 | if (stream.avail_out == 0) { 51 | stream.avail_out = left > (uLong)max ? max : (uInt)left; 52 | left -= stream.avail_out; 53 | } 54 | if (stream.avail_in == 0) { 55 | stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen; 56 | sourceLen -= stream.avail_in; 57 | } 58 | err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); 59 | } while (err == Z_OK); 60 | 61 | *destLen = stream.total_out; 62 | deflateEnd(&stream); 63 | return err == Z_STREAM_END ? Z_OK : err; 64 | } 65 | 66 | /* =========================================================================== 67 | */ 68 | int ZEXPORT compress (dest, destLen, source, sourceLen) 69 | Bytef *dest; 70 | uLongf *destLen; 71 | const Bytef *source; 72 | uLong sourceLen; 73 | { 74 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 75 | } 76 | 77 | /* =========================================================================== 78 | If the default memLevel or windowBits for deflateInit() is changed, then 79 | this function needs to be updated. 80 | */ 81 | uLong ZEXPORT compressBound (sourceLen) 82 | uLong sourceLen; 83 | { 84 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 85 | (sourceLen >> 25) + 13; 86 | } 87 | -------------------------------------------------------------------------------- /Flatland Standalone/zlib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /Flatland Standalone/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /Flatland Standalone/zlib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of the dynamic table. The maximum number of code structures is 39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance 40 | codes. These values were found by exhaustive searches using the program 41 | examples/enough.c found in the zlib distribtution. The arguments to that 42 | program are the number of symbols, the initial root table size, and the 43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes 44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592. 45 | The initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in inflate.c and infback.c. If the root table size is 47 | changed, then these maximum sizes would be need to be recalculated and 48 | updated. */ 49 | #define ENOUGH_LENS 852 50 | #define ENOUGH_DISTS 592 51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 52 | 53 | /* Type of code to build for inflate_table() */ 54 | typedef enum { 55 | CODES, 56 | LENS, 57 | DISTS 58 | } codetype; 59 | 60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, 61 | unsigned codes, code FAR * FAR *table, 62 | unsigned FAR *bits, unsigned short FAR *work)); 63 | -------------------------------------------------------------------------------- /Flatland Standalone/zlib/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. *sourceLen is 13 | the byte length of the source buffer. Upon entry, *destLen is the total size 14 | of the destination buffer, which must be large enough to hold the entire 15 | uncompressed data. (The size of the uncompressed data must have been saved 16 | previously by the compressor and transmitted to the decompressor by some 17 | mechanism outside the scope of this compression library.) Upon exit, 18 | *destLen is the size of the decompressed data and *sourceLen is the number 19 | of source bytes consumed. Upon return, source + *sourceLen points to the 20 | first unused input byte. 21 | 22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough 23 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, or 24 | Z_DATA_ERROR if the input data was corrupted, including if the input data is 25 | an incomplete zlib stream. 26 | */ 27 | int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) 28 | Bytef *dest; 29 | uLongf *destLen; 30 | const Bytef *source; 31 | uLong *sourceLen; 32 | { 33 | z_stream stream; 34 | int err; 35 | const uInt max = (uInt)-1; 36 | uLong len, left; 37 | Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ 38 | 39 | len = *sourceLen; 40 | if (*destLen) { 41 | left = *destLen; 42 | *destLen = 0; 43 | } 44 | else { 45 | left = 1; 46 | dest = buf; 47 | } 48 | 49 | stream.next_in = (z_const Bytef *)source; 50 | stream.avail_in = 0; 51 | stream.zalloc = (alloc_func)0; 52 | stream.zfree = (free_func)0; 53 | stream.opaque = (voidpf)0; 54 | 55 | err = inflateInit(&stream); 56 | if (err != Z_OK) return err; 57 | 58 | stream.next_out = dest; 59 | stream.avail_out = 0; 60 | 61 | do { 62 | if (stream.avail_out == 0) { 63 | stream.avail_out = left > (uLong)max ? max : (uInt)left; 64 | left -= stream.avail_out; 65 | } 66 | if (stream.avail_in == 0) { 67 | stream.avail_in = len > (uLong)max ? max : (uInt)len; 68 | len -= stream.avail_in; 69 | } 70 | err = inflate(&stream, Z_NO_FLUSH); 71 | } while (err == Z_OK); 72 | 73 | *sourceLen -= len + stream.avail_in; 74 | if (dest != buf) 75 | *destLen = stream.total_out; 76 | else if (stream.total_out && err == Z_BUF_ERROR) 77 | left = 1; 78 | 79 | inflateEnd(&stream); 80 | return err == Z_STREAM_END ? Z_OK : 81 | err == Z_NEED_DICT ? Z_DATA_ERROR : 82 | err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : 83 | err; 84 | } 85 | 86 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 87 | Bytef *dest; 88 | uLongf *destLen; 89 | const Bytef *source; 90 | uLong sourceLen; 91 | { 92 | return uncompress2(dest, destLen, source, &sourceLen); 93 | } 94 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Flatland Online Inc., Philip Stephens, Michael Powers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flatland 2 | 3D grid and building block engine supporting the 3DML text format, similar to but predates Minecraft 3 | 4 | ## Quickstart 5 | 6 | To run the latest Flatland app for Windows 10 / DirectX 11 just download the zip file with the executable from [Flatland.com](http://www.flatland.com). You can also find 3D spots there to load and tutorial and guide information. 7 | 8 | ## Compiling 9 | 10 | If you want to compiled the source the project file for Visual Studio 2017 is included. 11 | 12 | ## Want to help? Here are some ideas for extending the feature set 13 | 14 | * Native VR support 15 | * Ports to other platforms via Emscripten (we are working on readying the engine for conversion) 16 | * Cloud support for spot storage and delivery 17 | * More natural first person player movement 18 | * 3rd person player character support 19 | 20 | ## Authors 21 | 22 | * **Philip Stephens** - *Initial work* 23 | * **Michael Powers** - *Original design and version 3.5 additions* 24 | * **TC Chang** - *Block models and textures* 25 | 26 | See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. 27 | 28 | ## License 29 | 30 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details 31 | 32 | --------------------------------------------------------------------------------