/*
....[@@@..[@@@..............[@.................. 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@van.ml.org
------------------------------------------------------------------------------
vmobject.h
*/
#ifndef _VMOBJECT_H
#define _VMOBJECT_H
#include "vmtypes.h"
#include "garbcoll.h"
#include "erratum.h"
typedef struct
{
int length;
vmstack val[1];
} extra_values;
#define GC_MARKED 1
#define IN_C_WORLD 2
class VMObject
{
private:
int gc_color;
protected:
extra_values * evalues;
public:
VMObject() :
gc_color(0), evalues(0)
{
toCWorld();
GC_register(this);
}
VMObject( VMObject & ) :
gc_color(0), evalues(0)
{
toCWorld();
GC_register(this);
}
virtual ~VMObject();
virtual vmtype getVMType() { return VMT_VMOBJECT; }
void fromCWorld() { gc_color &= ~IN_C_WORLD; }
void toCWorld() { gc_color |= IN_C_WORLD; }
bool inCWorld() { return (gc_color & IN_C_WORLD); }
void GCunmark() { gc_color &= ~GC_MARKED; }
int getGCColor() { return gc_color; }
void mark_evalues();
void GCMark()
{
if ( gc_color & GC_MARKED )
return;
gc_color |= GC_MARKED;
if ( evalues )
mark_evalues();
}
void fordelete() { fromCWorld(); }
const char * getVMTypeName() { return vmtype_table[getVMType()].name; }
};
#endif