vmtypes.h
mud++0.33/src/vmtypes.h · 2.6 KB
From the archive mud++0.33.tar.gz
Download the archive « Back to the archive contents
/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project. All
................................................ contributions are welcome.
....Copyright(C).1995.Melvin.Smith.............. Enjoy.
------------------------------------------------------------------------------
Melvin Smith (aka Fusion) msmith@hom.net
MUD++ development mailing list mudpp-list@mailhost.net
------------------------------------------------------------------------------
vmtypes.h
*/
#ifndef _VMTYPES_H
#define _VMTYPES_H
#include "osdepend.h"
class VMObject;
class VMachine;
class String;
typedef s32 vmint;
typedef float vmfloat;
enum vmtype
{
VMT_NULL=0,
// Normal types
VMT_TOPOFSTACK, VMT_INT, VMT_FLOAT, VMT_STRING,
// has to be first VmObj type
VMT_VMOBJECT,
VMT_MUDOBJECT,VMT_THING, VMT_CHAR,
VMT_NPC, VMT_SHOPKEEPER, VMT_PC, VMT_OBJECT, VMT_ROOM,
VMT_EXIT, VMT_ACTION, VMT_AFFECT,VMT_REPOP, VMT_AREA,
VMT_ATTACK, VMT_OBJ_TRASH, VMT_OBJ_JEWEL, VMT_OBJ_GOLD,
VMT_OBJ_CONTAINER,VMT_OBJ_LIQUID_CONTAINER, VMT_OBJ_ARMOR,
VMT_OBJ_CLOTH, VMT_OBJ_WEAPON, VMT_OBJ_WAND, VMT_OBJ_ORB,
VMT_OBJ_CORPSE,VMT_OBJ_ENERGY, VMT_OBJ_SCROLL, VMT_OBJ_POTION,
VMT_OBJ_FOOD, VMT_OBJ_KEY, VMT_OBJ_STAFF, VMT_OBJ_COMPASS,
VMT_MAX_VMOBJECT,
// native arrays
VMT_ARRAY,
VMT_ARRAY_INT, VMT_ARRAY_FLOAT, VMT_ARRAY_STRING, VMT_ARRAY_VMOBJECT,
VMT_MAX_ARRAY,
// Asm object file only
VMT_EXPORT_FUN, VMT_IMPORT_FUN, VMT_IMPORT_INTERFACE,
VMT_CONST_STRING, VMT_IMPORT_STATIC, VMT_FIELD_DATA,
VMT_MAX_TYPE
};
#define IS_VMOBJ( type ) ((type >= VMT_VMOBJECT) && ( type < VMT_MAX_VMOBJECT))
#define IS_ARRAY( type ) ((type >= VMT_ARRAY) && (type < VMT_MAX_ARRAY))
class VMarray;
typedef union
{
vmint i;
vmfloat f;
VMObject * o;
String * s;
VMarray * a;
} vmptr;
typedef struct
{
vmtype type;
vmptr val;
} vmstack;
typedef struct
{
char * name;
int id;
} fieldmap;
struct s_vmtype_table
{
const char * name;
vmtype parent;
vmptr (*clone) (vmptr); // (VM) get new reference to same object
void (*del) (vmptr); // (VM) delete reference to object
char * (*setfield) (VMachine * vm, void * obj, int fieldnum, vmptr);
bool (*getfield) ( VMachine * vm, void * obj, int fieldnum);
fieldmap * fieldnames;
};
int vmtype_lookup( const char * );
int fieldname_lookup( vmtype, const char * );
extern struct s_vmtype_table vmtype_table[];
#endif