diff options
Diffstat (limited to 'src/interp/nruncomp.boot')
-rw-r--r-- | src/interp/nruncomp.boot | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/interp/nruncomp.boot b/src/interp/nruncomp.boot index 48e18254..e9709f63 100644 --- a/src/interp/nruncomp.boot +++ b/src/interp/nruncomp.boot @@ -32,7 +32,6 @@ -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import nrunopt import simpbool import profile import functor @@ -404,6 +403,55 @@ washFunctorBody form == main form where x is ['%list] => nil x +--======================================================================= +-- Instantiation Code (Stuffslots) +--======================================================================= +stuffSlot(dollar,i,item) == + dollar.i := + atom item => [symbolFunction item,:dollar] + item is [n,:op] and integer? n => ['newGoGet,dollar,:item] + item is ['CONS,.,['FUNCALL,a,b]] => + b = '$ => ['makeSpadConstant,eval a,dollar,i] + sayBrightlyNT '"Unexpected constant environment!!" + pp devaluate b + nil + item + +stuffDomainSlots dollar == + domname := devaluate dollar + infovec := GETL(opOf domname,'infovec) + lookupFunction := getLookupFun infovec + lookupFunction := + lookupFunction = 'lookupIncomplete => function lookupIncomplete + function lookupComplete + template := infovec.0 + if template.5 then stuffSlot(dollar,5,template.5) + for i in (6 + # rest domname)..MAXINDEX template | item := template.i repeat + stuffSlot(dollar,i,item) + dollar.1 := LIST(lookupFunction,dollar,infovec.1) + dollar.2 := infovec.2 + proto4 := infovec.3 + dollar.4 := + vector? CDDR proto4 => [COPY_-SEQ first proto4,:rest proto4] --old style + bitVector := dollar.3 + predvec := first proto4 + packagevec := second proto4 + auxvec := LIST2VEC [fn for i in 0..MAXINDEX predvec] where fn() == + not testBitVector(bitVector,predvec.i) => nil + packagevec.i or true + [auxvec,:CDDR proto4] + +getLookupFun infovec == + MAXINDEX infovec = 4 => infovec.4 + 'lookupIncomplete + +makeSpadConstant [fn,dollar,slot] == + val := FUNCALL(fn,dollar) + u:= dollar.slot + u.first := function IDENTITY + u.rest := val + val + buildFunctor($definition is [name,:args],sig,code,$locals,$e) == --PARAMETERS -- $definition: constructor form, e.g. (SquareMatrix 10 (RationalNumber)) |