Download Self Handbook Documentation
Transcript
Self Handbook Documentation, Release 2 for Self 4.4 foreign routine. It understands messages for calling the foreign routine and has associated with it a foreignCode object. The foreignFct and foreignCode objects cooperate with the linker, to ensure that object files are transparently loaded when necessary and that fctProxies depending on an object file are killed when the object file is unloaded, etc. The foreignCodeDB object ensures that foreignCode objects are unique, given a path. It also allows for specifying initializers and finalizers on foreignCode objects. An initializer is a foreign routine that is called whenever the object file is loaded. Initializers take no arguments and do not return values. Typically, they initialize global data structures. Finalizers are called when an object file is unloaded. When debugging foreign routines, foreignCodeDB printStatus outputs a useful overview. Normal use of a foreign routine simply involves cloning a foreignFct object to represent the foreign routine. When cloning it, the name of the function and the path of the object file is specified. It is then not necessary to worry about proxy, fctProxy and linker objects, etc. In fact, it is recommended not to send messages directly to these objects, since this may break the higher level invariants that foreignFct objects rely on. Relevant oddballs: linker sunLinker foreignCodeDB dynamic linker for current platform dynamic linker implementation for SunOS/Solaris registry for foreignCode objects Modules: foreign 3.11 I/O and Unix oddball unix clonable proxy unixFile (mixes in traits unixFile currentOsVariant) The oddball object unix provides access to selected Unix system calls. The most common calls are the file operations: creat(), open(), close(), read(), write(), lseek() and unlink(). tcpConnectToHost:Port:IfFail: opens a TCP connection. The select() call and the indirect system call are also supported (taking a variable number of integer, float or byte vector arguments, the latter being passed as C pointers). unixFile provides a higher level interface to the Unix file operations. The oddball object tty implements terminal control facilities such as cursor positioning and highlighting. Relevant oddballs: stdin, stdout, stderr tty standard Unix streams console terminal capabilities Modules: unix, stdin, tty, ttySupport, termcap 3.12 Other Objects Here are some interesting oddball objects not discussed elsewhere: 34 Chapter 3. The Self World