Sheep
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
Classes | Macros | Typedefs | Enumerations | Functions
sheepc.h File Reference
#include <string.h>
#include "sheepCommon.h"

Go to the source code of this file.

Classes

struct  SHP_Symbol
 
struct  SHP_StringConstant
 
struct  SHP_Function
 
struct  SHP_CompilerOutput
 
struct  SheepVM
 Handle to a virtual machine object. More...
 
struct  SheepVMContext
 Handle to a virtual machine context object. More...
 
struct  SheepImportFunction
 
struct  SheepScript
 Handle to a Sheep script object. More...
 
struct  SHP_Allocator
 
struct  SheepDisassembly
 
struct  SheepCompiler
 

Macros

#define SHEEP_TRUE   1
 
#define SHEEP_FALSE   0
 
#define SHEEP_VERSION_MAJOR   0
 
#define SHEEP_VERSION_MINOR   4
 
#define SHEEP_VERSION_REVISION   0
 
#define SHEEP_VERBOSITY_SILENT   0
 
#define SHEEP_VERBOSITY_POLITE   1
 
#define SHEEP_VERBOSITY_ANNOYING   2
 
#define SHEEP_VERBOSITY_EXTREME   3
 

Typedefs

typedef unsigned char byte
 
typedef struct SHP_Allocator SHP_Allocator
 
typedef void(SHP_CALLBACK * SHP_MessageCallback )(int linenumber, const char *message)
 
typedef void(SHP_CALLBACK * SHP_ImportCallback )(SheepVM *vm)
 
typedef void(SHP_CALLBACK * SHP_EndWaitCallback )(SheepVM *vm, SheepVMContext *context)
 

Enumerations

enum  SHP_SymbolType { Void = 0, Int = 1, Float = 2, String = 3 }
 

Functions

SHP_DECLSPEC SheepVM *SHP_LIB_CALL SHP_CreateNewVM (int languageVersion)
 Creates a new virtual machine.
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_DestroyVM (SheepVM *vm)
 Destroys an existing virtual machine.
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_SetVMTag (SheepVM *vm, void *tag)
 
SHP_DECLSPEC void *SHP_LIB_CALL SHP_GetVMTag (SheepVM *vm)
 Gets the "tag" data.
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_SetAllocator (SHP_Allocator *allocator)
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_SetOutputCallback (SheepVM *vm, SHP_MessageCallback callback)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_PrepareScriptForExecution (SheepVM *vm, SheepScript *script, const char *function, SheepVMContext **context)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_Execute (SheepVMContext *context)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_GetNumVariables (SheepVMContext *context)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_GetVariableName (SheepVMContext *context, int index, const char **name)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_GetVariableI (SheepVMContext *context, int index, int *value)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_GetVariableF (SheepVMContext *context, int index, float *value)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_SetVariableI (SheepVMContext *context, int index, int value)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_SetVariableF (SheepVMContext *context, int index, float value)
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_SetImportCallback (SheepVM *vm, const char *name, SHP_ImportCallback callback)
 
SHP_DECLSPEC int SHP_LIB_CALL SHP_PopIntFromStack (SheepVMContext *vm, int *result)
 
SHP_DECLSPEC int SHP_LIB_CALL SHP_PopFloatFromStack (SheepVMContext *vm, float *result)
 
SHP_DECLSPEC int SHP_LIB_CALL SHP_PopStringFromStack (SheepVMContext *vm, const char **result)
 
SHP_DECLSPEC int SHP_LIB_CALL SHP_PushIntOntoStack (SheepVMContext *vm, int i)
 
SHP_DECLSPEC SheepVMContext
*SHP_LIB_CALL 
SHP_GetCurrentContext (SheepVM *vm)
 
SHP_DECLSPEC int SHP_LIB_CALL SHP_GetNumContexts (SheepVM *vm)
 
SHP_DECLSPEC int SHP_LIB_CALL SHP_GetCurrentContextStackSize (SheepVM *vm)
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_SetVerbosity (SheepVM *vm, int verbosity)
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_PrintMemoryUsage ()
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_PrintStackTrace (SheepVM *vm)
 
SHP_DECLSPEC int SHP_LIB_CALL SHP_IsInWaitSection (SheepVM *vm)
 
SHP_DECLSPEC int SHP_LIB_CALL SHP_Suspend (SheepVMContext *context)
 
SHP_DECLSPEC void SHP_LIB_CALL SHP_SetEndWaitCallback (SheepVM *vm, SHP_EndWaitCallback callback)
 
SHP_DECLSPEC SheepDisassemblySHP_GetDisassembly (SheepScript *script)
 
SHP_DECLSPEC const char * SHP_GetDisassemblyText (const SheepDisassembly *disassembly)
 
SHP_DECLSPEC void SHP_FreeDisassembly (const SheepDisassembly *disassembly)
 
SHP_DECLSPEC SheepCompiler
*SHP_LIB_CALL 
shp_CreateNewCompiler (int languageVersion)
 
SHP_DECLSPEC void SHP_LIB_CALL shp_DestroyCompiler (SheepCompiler *compiler)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_DefineImportFunction (SheepCompiler *compiler, const char *name, SHP_SymbolType returnType, SHP_SymbolType parameters[], int numParameters)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_CompileScript (SheepCompiler *compiler, const char *script, SheepScript **result)
 
SHP_DECLSPEC int SHP_LIB_CALL shp_LoadScriptFromBytecode (const char *bytecode, int length, SheepScript **result)
 
SHP_DECLSPEC void SHP_LIB_CALL shp_ReleaseSheepScript (SheepScript *script)
 

Function Documentation

SHP_DECLSPEC void SHP_LIB_CALL SHP_SetVMTag ( SheepVM vm,
void *  tag 
)

Sets the "tag" data. A tag can be a pointer whatever you want (including NULL). The VM doesn't use it for anything; it's only for your convenience.