Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Public Attributes | List of all members
StringStack Struct Reference

#include <stringStack.h>

Public Types

enum  { MaxStackDepth = 1024, MaxArgs = 20, ReturnBufferSpace = 512 }
 

Public Member Functions

void validateBufferSize (U32 size)
 
void validateArgBufferSize (U32 size)
 
 StringStack ()
 
void setIntValue (U32 i)
 Set the top of the stack to be an integer value. More...
 
void setFloatValue (F64 v)
 Set the top of the stack to be a float value. More...
 
char * getReturnBuffer (U32 size)
 
char * getArgBuffer (U32 size)
 
void clearFunctionOffset ()
 Clear the function offset. More...
 
void setStringValue (const char *s)
 Set a string value on the top of the stack. More...
 
StringTableEntry getSTValue ()
 
U32 getIntValue ()
 Get an integer representation of the top of the stack. More...
 
F64 getFloatValue ()
 Get a float representation of the top of the stack. More...
 
const char * getStringValue ()
 
void advance ()
 
void advanceChar (char c)
 
void push ()
 Push the stack, placing a zero-length string on the top. More...
 
void setLen (U32 newlen)
 
void rewind ()
 Pop the start stack. More...
 
void rewindTerminate ()
 
U32 compare ()
 
void pushFrame ()
 
void popFrame ()
 
void getArgcArgv (StringTableEntry name, U32 *argc, const char ***in_argv, bool popStackFrame=false)
 Get the arguments for a function call from the stack. More...
 

Public Attributes

char * mBuffer
 
U32 mBufferSize
 
const char * mArgV [MaxArgs]
 
U32 mFrameOffsets [MaxStackDepth]
 
U32 mStartOffsets [MaxStackDepth]
 
U32 mNumFrames
 
U32 mArgc
 
U32 mStart
 
U32 mLen
 
U32 mStartStackSize
 
U32 mFunctionOffset
 
U32 mArgBufferSize
 
char * mArgBuffer
 

Detailed Description

Core stack for interpreter operations.

This class provides some powerful semantics for working with strings, and is used heavily by the console interpreter.

Member Enumeration Documentation

anonymous enum
Enumerator
MaxStackDepth 
MaxArgs 
ReturnBufferSpace 

Constructor & Destructor Documentation

StringStack ( )
inline

Member Function Documentation

void advance ( )
inline

Advance the start stack, placing a zero length string on the top.

Note
You should use StringStack::push, not this, if you want to properly push the stack.
void advanceChar ( char  c)
inline

Advance the start stack, placing a single character, null-terminated strong on the top.

Note
You should use StringStack::push, not this, if you want to properly push the stack.
void clearFunctionOffset ( )
inline

Clear the function offset.

U32 compare ( )
inline

Compare 1st and 2nd items on stack, consuming them in the process, and returning true if they matched, false if they didn't.

char* getArgBuffer ( U32  size)
inline

Return a buffer we can use for arguments.

This updates the function offset.

void getArgcArgv ( StringTableEntry  name,
U32 *  argc,
const char ***  in_argv,
bool  popStackFrame = false 
)

Get the arguments for a function call from the stack.

F64 getFloatValue ( )
inline

Get a float representation of the top of the stack.

U32 getIntValue ( )
inline

Get an integer representation of the top of the stack.

char* getReturnBuffer ( U32  size)
inline

Return a temporary buffer we can use to return data.

Note
This clobbers anything in our buffers!
const char* getStringValue ( )
inline

Get a string representation of the top of the stack.

Note
This returns a pointer to the actual top of the stack, be careful!
StringTableEntry getSTValue ( )
inline

Get the top of the stack, as a StringTableEntry.

Note
Don't free this memory!
void popFrame ( )
inline
void push ( )
inline

Push the stack, placing a zero-length string on the top.

void pushFrame ( )
inline
void rewind ( )
inline

Pop the start stack.

void rewindTerminate ( )
inline
void setFloatValue ( F64  v)
inline

Set the top of the stack to be a float value.

void setIntValue ( U32  i)
inline

Set the top of the stack to be an integer value.

void setLen ( U32  newlen)
inline
void setStringValue ( const char *  s)
inline

Set a string value on the top of the stack.

void validateArgBufferSize ( U32  size)
inline
void validateBufferSize ( U32  size)
inline

Member Data Documentation

char* mArgBuffer
U32 mArgBufferSize
U32 mArgc
const char* mArgV[MaxArgs]
char* mBuffer
U32 mBufferSize
U32 mFrameOffsets[MaxStackDepth]
U32 mFunctionOffset
U32 mLen
U32 mNumFrames
U32 mStart
U32 mStartOffsets[MaxStackDepth]
U32 mStartStackSize

The documentation for this struct was generated from the following files: