| OCR Text |
Show (defun --move (obj arg-list) (let ((tmp (---allocate-temp))) (set tmp (move (symbol-value obj) tmp)) (---import-float (nth 0 arg-list)) (---import-float (nth 1 arg-list)))) 14 We allocate a symbol table slot, convert arguments (unpacking if necessary), execute the function capturing the return value, and return the handle. 9.3.3 Smalltalk The Smalltalk implementation is based on GNU Smalltalk 1.2. The code gen-erator is similar to the Lisp code generator due mainly to the similar outlook of Smalltalk and Lisp. Both of these are tagged languages with a symbol table and garbage collection. The actual syntax of Smalltalk is quit different from that of Lisp, but this is a relatively minor part of the code generator. GNU Smalltalk does not support foreign functions calling Smalltalk, only Smalltalk calling foreign functions. The foreign function interface is very similar to that of UCL. Foreign functions have special declarations which describe the function symbol, its corresponding Smalltalk name, the arguments and their types, and the return type. For instance, Behavior defineCFunc: 'shapeArea' withSelectorArgs: 'shapeArea: anObject' forClass: SystemDictionary returning: #double args: #(cObject)! This describes the C++ method stub for shape: :area(). The C++ function name is shapeArea and the Smalltalk selector is shapeArea: anObj ect. This method is associated with the system dictionary, Smalltalk. It could be associated with any object, another good choice is the shape object. Smalltalk knows how to pass some types into C. Here the language converts doubles into C format for us. |