implement Gatherengine; include "spree.m"; include "spree/gather.m"; Clique, Member: import Spree; init: fn(m: Spree, c: ref Clique, argv: list of string, archived: int): string; clienttype: fn(): string; maxmembers: fn(): int; propose: fn(members: array of string): string; start: fn(members: array of ref Member, archived: int); command: fn(member: ref Member, c: string): string; archive: fn(); readfile: fn(f: int, offset: big, n: int): array of byte;
Init is called first, with m, the spree module, and c, the new clique. Argv gives a list of arguments to the engine (the first being the name of the engine itself); archived is non-zero if the engine has been restored from an archive. If init returns a non-nil string, it is taken to describe an error, and the engine will be discarded. Maxmembers should return the maximum number of members that the engine can accept; clienttype should return the kind of client that is expected by the engine (e.g. cards for a card game engine).
Propose proposes that a clique consisting of members (the names of the proposed members) be started. It returns an error string: if this is non-nil, then the clique is not started, otherwise the proposed members are accepted into the clique, and start is called, where members is the array of actual members (corresponding to the members passed to propose), and archived is non-zero if the clique is being restored from an archive (same as passed to init).
Once a clique has been successfully started, command is called when a member sends a command to the engine; member has sent the command, and c is the command itself. Command should return a non-nil error string if the command fails.
When a clique is being archived, archive will be called to request the engine to store all its internal state into the object hierarchy (this is the moment, for instance, to call cardlib->archive).
|SPREE-GATHER(2 )||Rev: Thu Feb 15 14:43:26 GMT 2007|