StringStack

Engine/source/console/stringStack.h

Core stack for interpreter operations.

More...

Public Types

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

Public Functions

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

advanceChar(char c)

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

Clear the function offset.

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

char *

Return a buffer we can use for arguments.

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

Get the arguments for a function call from the stack.

Get a float representation of the top of the stack.

Get an integer representation of the top of the stack.

char *

Return a temporary buffer we can use to return data.

const char *

Get a string representation of the top of the stack.

Get the top of the stack, as a StringTableEntry.

push()

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

Pop the start stack.

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

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

setLen(U32 newlen)

Set a string value on the top of the stack.

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

@64

Enumerator

MaxStackDepth = 1024
MaxArgs = 20
ReturnBufferSpace = 512

Public Attributes

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 

Public Functions

StringStack()

~StringStack()

advance()

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.

advanceChar(char c)

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.

clearFrames()

clearFunctionOffset()

Clear the function offset.

compare()

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

getArgBuffer(U32 size)

Return a buffer we can use for arguments.

This updates the function offset.

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

Get the arguments for a function call from the stack.

getFloatValue()

Get a float representation of the top of the stack.

getIntValue()

Get an integer representation of the top of the stack.

getPreviousStringValue()

getPreviousStringValuePtr()

getReturnBuffer(U32 size)

Return a temporary buffer we can use to return data.

getStringValue()

Get a string representation of the top of the stack.

note:

This returns a pointer to the actual top of the stack, be careful!

getStringValuePtr()

getSTValue()

Get the top of the stack, as a StringTableEntry.

note:

Don't free this memory!

popFrame()

push()

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

pushFrame()

rewind()

Pop the start stack.

rewindTerminate()

setFloatValue(F64 v)

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

setIntValue(U32 i)

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

setLen(U32 newlen)

setStringValue(const char * s)

Set a string value on the top of the stack.

validateArgBufferSize(U32 size)

validateBufferSize(U32 size)