/* ....[@@@..[@@@..............[@.................. 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 ------------------------------------------------------------------------------ asmobjfile.h */ #ifndef _ASMOBJFILE_H #define _ASMOBJFILE_H #include "streamable.h" #include "memoryblock.h" #include "array.h" #include "io.h" #include "vmtypes.h" #define ASMOBJ_MAGIC "mo++" typedef struct { char magic[4]; int code_length; int consts_length; } asmobjheader; typedef struct { vmtype type; int offset; } asmobjconst; typedef struct { int start; int end; int name; } vmfilefun; class AsmObjFile : public MemoryCellBlock { public: Array< asmobjconst > constants_def; Array< int > relocation_table; ConstantsBlock constants; AsmObjFile() { enlargeMemBlock(32000); constants.allocMemBlock( 100 ); } virtual ~AsmObjFile() { } virtual int readFrom( StaticInput & ); virtual int writeTo( Output & ) const; int addConstant( vmtype type, const void * src_ptr, int size); void addRelocation( int offset ) { relocation_table.add(offset); } void addRelocation() { addRelocation(getUsedSize()); } int numberOfConstants() { return constants_def.length(); } int importLookup( vmtype, const char * ); bool canLink( AsmObjFile & ); void link( AsmObjFile & ); }; #endif