torque Torque Game Engine Documentation
TGE Version 1.5.2

StringStack Struct Reference

#include <stringStack.h>


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.


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.
void setFloatValue (F64 v)
 Set the top of the stack to be a float value.
char * getReturnBuffer (U32 size)
 Return a temporary buffer we can use to return data.
char * getArgBuffer (U32 size)
 Return a buffer we can use for arguments.
void clearFunctionOffset ()
 Clear the function offset.
void setStringValue (const char *s)
 Set a string value on the top of the stack.
StringTableEntry getSTValue ()
 Get the top of the stack, as a StringTableEntry.
U32 getIntValue ()
 Get an integer representation of the top of the stack.
F64 getFloatValue ()
 Get a float representation of the top of the stack.
const char * getStringValue ()
 Get a string representation of the top of the stack.
void advance ()
 Advance the start stack, placing a zero length string on the top.
void advanceChar (char c)
 Advance the start stack, placing a single character, null-terminated strong on the top.
void push ()
 Push the stack, placing a zero-length string on the top.
void setLen (U32 newlen)
void rewind ()
 Pop the start stack.
void rewindTerminate ()
U32 compare ()
 Compare 1st and 2nd items on stack, consuming them in the process, and returning true if they matched, false if they didn't.
void pushFrame ()
void getArgcArgv (StringTableEntry name, U32 *argc, const char ***in_argv)
 Get the arguments for a function call from the stack.

Data Fields

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


Member Enumeration Documentation

anonymous enum

Enumerator:
MaxStackDepth 
MaxArgs 
ReturnBufferSpace 


Constructor & Destructor Documentation

StringStack::StringStack (  )  [inline]


Member Function Documentation

void StringStack::validateBufferSize ( U32  size  )  [inline]

void StringStack::validateArgBufferSize ( U32  size  )  [inline]

void StringStack::setIntValue ( U32  i  )  [inline]

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

void StringStack::setFloatValue ( F64  v  )  [inline]

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

char* StringStack::getReturnBuffer ( U32  size  )  [inline]

Return a temporary buffer we can use to return data.

Note:
This clobbers anything in our buffers!

char* StringStack::getArgBuffer ( U32  size  )  [inline]

Return a buffer we can use for arguments.

This updates the function offset.

void StringStack::clearFunctionOffset (  )  [inline]

Clear the function offset.

void StringStack::setStringValue ( const char *  s  )  [inline]

Set a string value on the top of the stack.

StringTableEntry StringStack::getSTValue (  )  [inline]

Get the top of the stack, as a StringTableEntry.

Note:
Don't free this memory!

U32 StringStack::getIntValue (  )  [inline]

Get an integer representation of the top of the stack.

F64 StringStack::getFloatValue (  )  [inline]

Get a float representation of the top of the stack.

const char* StringStack::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!

void StringStack::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 StringStack::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 StringStack::push (  )  [inline]

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

void StringStack::setLen ( U32  newlen  )  [inline]

void StringStack::rewind (  )  [inline]

Pop the start stack.

void StringStack::rewindTerminate (  )  [inline]

U32 StringStack::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.

void StringStack::pushFrame (  )  [inline]

void StringStack::getArgcArgv ( StringTableEntry  name,
U32 argc,
const char ***  in_argv 
)

Get the arguments for a function call from the stack.


Field Documentation

const char* StringStack::mArgV[MaxArgs]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen