[][src]Trait glk::gidispatch::Handlers

pub trait Handlers {
    fn gidispatch_set_object_registry(&mut self, _registry: ObjRegistry);
fn gidispatch_get_objrock(&mut self, _obj: objref, _objclass: u32) -> rock;
fn gidispatch_set_retained_registry(&mut self, _registry: RetainedRegistry); fn gidispatch_set_autorestore_registry(
        &mut self,
        _locatearr: Option<AutoLocateFunc>,
        _restorearr: Option<AutoRestoreFunc>
    ) { ... } }

GI dispatch handler functions. See

  • https://www.eblong.com/zarf/glk/glk-spec-075_12.html#s.1.5.1 and

Required methods

fn gidispatch_set_object_registry(&mut self, _registry: ObjRegistry)

The object registry holds an opaque "rock" value for every

  • (obj, objclass) pair. This is used to keep track of internal identifiers
  • of the VM for objects. These can be requested back using
  • gidispatch_get_objrock. It is required to implement these.
    • "regi" should be called for new objects created by the Glk implementation, returning the
  • gidisp rock to be stored with the object.
    • "unregi" should be called before an object is deleted to clean up the rock.

fn gidispatch_get_objrock(&mut self, _obj: objref, _objclass: u32) -> rock

Request back the previously stored "dispatch rock" for an object.

  • Note: glulxe will turn it into a pointer and dereference this without checking,
  • so leaving this unimplemented will crash.

fn gidispatch_set_retained_registry(&mut self, _registry: RetainedRegistry)

Sets the "retained registry". This is a set of functions like the object registry, but meant to be called for arrays that the Glk implementation holds on to. It is required to implement these for the functions to work.

These is used for the following:

  • glk_stream_open_memory[_uni]
  • glk_request_line_event[_uni]
Loading content...

Provided methods

fn gidispatch_set_autorestore_registry(
    &mut self,
    _locatearr: Option<AutoLocateFunc>,
    _restorearr: Option<AutoRestoreFunc>
)

Registers handlers for saving/restoring the interpreter state

  • without cooporation of the game, this is used on mobile platforms where
  • the application might have to go to the background unexpectedly.
    • locatearr needs to be called for every retained array on autosave; it is passed the
  • array address (as the Glk library knows it), length, typecode and dispatch rock. It returns
  • a bufkey (opaque C long) and a element size that need to be stored with the array.
    • restorearr needs to be called for every retained array on autorestore; it is passed the
  • bufkey (returned by locatearr), length, typecode, and restores the array
  • address and dispatch rock.
  • @note Implementing this is optional: it only needs to be implemented if the interpreter does
  • autosave and autorestore.
Loading content...

Implementors

Loading content...