diff options
author | Filippos Karapetis | 2010-06-27 20:38:43 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-27 20:38:43 +0000 |
commit | bb992b0b93f3ee9dfad6524fd0721a350f12085a (patch) | |
tree | 410ea12cc90e24f2f05b6f16d38650024b2cb01a /engines/sci/engine/segment.h | |
parent | 0436f2823d7c83fa76d68fba3c18a7fcc4a29173 (diff) | |
download | scummvm-rg350-bb992b0b93f3ee9dfad6524fd0721a350f12085a.tar.gz scummvm-rg350-bb992b0b93f3ee9dfad6524fd0721a350f12085a.tar.bz2 scummvm-rg350-bb992b0b93f3ee9dfad6524fd0721a350f12085a.zip |
SCI: Moved all the script-related code inside script.cpp/.h, and all script opcode-related code inside vm.cpp/.h
svn-id: r50396
Diffstat (limited to 'engines/sci/engine/segment.h')
-rw-r--r-- | engines/sci/engine/segment.h | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h index 24d27e367f..b621e53412 100644 --- a/engines/sci/engine/segment.h +++ b/engines/sci/engine/segment.h @@ -331,182 +331,6 @@ private: reg_t _pos; /**< Object offset within its script; for clones, this is their base */ }; -typedef Common::HashMap<uint16, Object> ObjMap; - -class Script : public SegmentObj { -public: - int _nr; /**< Script number */ - byte *_buf; /**< Static data buffer, or NULL if not used */ - byte *_heapStart; /**< Start of heap if SCI1.1, NULL otherwise */ - - uint32 getScriptSize() { return _scriptSize; } - uint32 getHeapSize() { return _heapSize; } - uint32 getBufSize() { return _bufSize; } - -protected: - int _lockers; /**< Number of classes and objects that require this script */ - -private: - size_t _scriptSize; - size_t _heapSize; - uint16 _bufSize; - - const uint16 *_exportTable; /**< Abs. offset of the export table or 0 if not present */ - uint16 _numExports; /**< Number of entries in the exports table */ - - const byte *_synonyms; /**< Synonyms block or 0 if not present*/ - uint16 _numSynonyms; /**< Number of entries in the synonyms block */ - - int _localsOffset; - uint16 _localsCount; - -public: - /** - * Table for objects, contains property variables. - * Indexed by the TODO offset. - */ - ObjMap _objects; - - int getLocalsOffset() const { return _localsOffset; } - uint16 getLocalsCount() const { return _localsCount; } - SegmentId _localsSegment; /**< The local variable segment */ - LocalVariables *_localsBlock; - - bool _markedAsDeleted; - -public: - Script(); - ~Script(); - - void freeScript(); - void init(int script_nr, ResourceManager *resMan); - void load(ResourceManager *resMan); - - virtual bool isValidOffset(uint16 offset) const; - virtual SegmentRef dereference(reg_t pointer); - virtual reg_t findCanonicAddress(SegManager *segMan, reg_t sub_addr) const; - virtual void freeAtAddress(SegManager *segMan, reg_t sub_addr); - virtual void listAllDeallocatable(SegmentId segId, void *param, NoteCallback note) const; - virtual void listAllOutgoingReferences(reg_t object, void *param, NoteCallback note) const; - - virtual void saveLoadWithSerializer(Common::Serializer &ser); - - Object *allocateObject(uint16 offset); - Object *getObject(uint16 offset); - const Object *getObject(uint16 offset) const; - - /** - * Initializes an object within the segment manager - * @param obj_pos Location (segment, offset) of the object. It must - * point to the beginning of the script/class block - * (as opposed to what the VM considers to be the - * object location) - * @returns A newly created Object describing the object, - * stored within the relevant script - */ - Object *scriptObjInit(reg_t obj_pos, bool fullObjectInit = true); - - /** - * Removes a script object - * @param obj_pos Location (segment, offset) of the object. - */ - void scriptObjRemove(reg_t obj_pos); - - /** - * Processes a relocation block witin a script - * This function is idempotent, but it must only be called after all - * objects have been instantiated, or a run-time error will occur. - * @param obj_pos Location (segment, offset) of the block - * @return Location of the relocation block - */ - void relocate(reg_t block); - -private: - bool relocateLocal(SegmentId segment, int location); - -public: - // script lock operations - - /** Increments the number of lockers of this script by one. */ - void incrementLockers(); - - /** Decrements the number of lockers of this script by one. */ - void decrementLockers(); - - /** - * Retrieves the number of locks held on this script. - * @return the number of locks held on the previously identified script - */ - int getLockers() const; - - /** Sets the number of locks held on this script. */ - void setLockers(int lockers); - - /** - * Retrieves a pointer to the exports of this script - * @return pointer to the exports. - */ - const uint16 *getExportTable() const { return _exportTable; } - - /** - * Retrieves the number of exports of script. - * @return the number of exports of this script - */ - uint16 getExportsNr() const { return _numExports; } - - /** - * Retrieves a pointer to the synonyms associated with this script - * @return pointer to the synonyms, in non-parsed format. - */ - const byte *getSynonyms() const { return _synonyms; } - - /** - * Retrieves the number of synonyms associated with this script. - * @return the number of synonyms associated with this script - */ - uint16 getSynonymsNr() const { return _numSynonyms; } - - /** - * Validate whether the specified public function is exported by - * the script in the specified segment. - * @param pubfunct Index of the function to validate - * @return NULL if the public function is invalid, its - * offset into the script's segment otherwise - */ - uint16 validateExportFunc(int pubfunct); - - /** - * Marks the script as deleted. - * This will not actually delete the script. If references remain present on the - * heap or the stack, the script will stay in memory in a quasi-deleted state until - * either unreachable (resulting in its eventual deletion) or reloaded (resulting - * in its data being updated). - */ - void markDeleted() { - _markedAsDeleted = true; - } - - /** - * Determines whether the script is marked as being deleted. - */ - bool isMarkedAsDeleted() const { - return _markedAsDeleted; - } - - /** - * Copies a byte string into a script's heap representation. - * @param dst script-relative offset of the destination area - * @param src pointer to the data source location - * @param n number of bytes to copy - */ - void mcpyInOut(int dst, const void *src, size_t n); - - /** - * Finds the pointer where a block of a specific type starts from - */ - byte *findBlock(int type); -}; - /** Data stack */ struct DataStack : SegmentObj { int _capacity; /**< Number of stack entries */ |