Platform Integration - KidneyThief/TinScript1.0 GitHub Wiki
Ideally, the goal of TinScript is to use platform independent C++, no assembler, no overly complex templated implementations that might not be supported on all platforms.
However, as I have only ever integrated TinScript on two platforms (PS/4 and Windows 7), There are a few quirks that have been consolidated into the header file integration.h.
There are more than a few constants - these are actually defined in TinScript.h, and not in the integration header. They define such things as:
- kMaxArgLength: The maximum string length of any parsed identifier/token/argument...
- kLocalVarTableSize: The default size of the hash table used to store a function's local variables
- kExecStackSize: Every function call uses a stack for pushing/popping during execution.
- The following has been included, to increase the default stack size in Windows 7. This was added in case someone gets overly ambitious with deep recursive functions. It was tested using an implementation of Fibonacci(), to the 30th element.
TinScript uses only typedefs which specify the bit width. Examples:
- bool8: an 8-bit boolean
- uint16: an unsigned 16-bit integer
- float32: a 32-bit float
Defines to perform pointer arithmetic, calculate offsets, etc...
- kPointerToUInt32()
- kPointerDiffUInt32()
All TinScript allocations are directed through the macro TinAlloc(). For more details, see Memory Usage.
Two macros, and two typedefs for registering handlers have been defined:
-
TinAssertHandler: A typedef to register how to handle asserts.
- A default assert handler has been provided in /external/cmdshell.h
- ScriptAssert_(): The macro used to implement all asserts.
-
TinPrintHandler: A typedef to register how to handle a standard formated printf statement.
- printf is the default handler in this case.
- TinPrint(): The macro used to implement all formatted messages.