SelfManagedCell

Based on net.ponder2.DomainP2Adaptor

The top level root domain of the whole system. Contains main() to start the whole thing off

Factory Messages
OperationDescription
ping: location boolean Pings remote SMC to see if it is alive. Answers true if it is.
create creates a new SelfManagedCell domain. This is normally the root domain of an SMC. It contains code for loading other objects, printing etc.

Operational Messages
OperationReturnDescription
argsAsHash P2Object answers with a hash containing the user supplied arguments to the SMC. User supplied arguments are those after an argument of '-' by itself.

The arguments are interpreted as key=>value pairs where the key is an argument starting with a '-'. A value cannot start with a '-', it is taken to be the next key instead. The hash is indexed with the names of the keys without the '-'. If a value follows a key then it is included as the value in the hash. If a value is found without a preceding key, it is ignored. In the following example "copper" will be lost.

-a -b gold -c silver copper -d

becomes

 a => "" b => gold c => silver d => "" 
argsAsArray P2Object answers with an array containing all the user supplied arguments to the SMC. User supplied arguments are those after an argument of '-' by itself. All arguments are added to the array as-is, any '-' characters are left intact.
sleep: secs self Sleeps for secs seconds
exit self Terminates the Ponder2 SMC with a zero status
exit: exitStatus self Terminates the Ponder2 SMC with exitStatus
address: anAddress self Loads a communications protocol and sets the SMC's local address to anAddress. This is functionally the same as using the -address argument when running Ponder2, however, it means that communications can be delayed until the domain structure is setup correctly
load: anObject P2Object Loads the code necessary for creating an instance of anObject. Answers the factory for creating instances of anObject.
ping: location boolean Pings remote SMC to see if it is alive. Answers true if it is.
import: aName from: aLocation P2Object Answers the remote managed object which has aName belonging to an SMC at aLocation.
memory long answers with the amount of free memory in the Java VM
read: aUrl self Reads and executes PonderTalk from aUrl.
read: aUrl withVars: varHash self Reads and executes PonderTalk from aUrl. The parser is initialized with the variables in the P2Hash varHash
readString: aPonderTalkString P2Object Reads and executes PonderTalk from aPonderTalkString.
readString: aPonderTalkString withVars: varHash P2Object Reads and executes PonderTalk from aPonderTalkString. The parser is initialised with the variables in the P2Hash varHash
getFile: aFileName String Reads a text file called aFileName into a string and returns it.
trace: aBoolean boolean Answers aBoolean. Set system tracing on or off.
print: aString String Answers aString. Displays aString on the console.
execute: aBlock P2Object Executes aBlock with no arguments. Answers with the answer from aBlock. Used to force execution of a block within a particular SMC.
execute: aBlock withHash: aHash P2Object Executes aBlock with the values of its arguments being taken by name from aHash. Answers the value of the last statement executed by the block. Throws an error if aHash does not satisfy the block's arguments. Used to force execution of a block within a particular SMC.
execute: aBlock args: anArray P2Object Executes aBlock with anArray of arguments. Answers with the result of the last statement executed by the block. Used to force execution of a block within a particular SMC.