diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/interp/database.boot | 29 | ||||
-rw-r--r-- | src/interp/define.boot | 11 |
3 files changed, 22 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 690a1a26..fcc6e8b7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,8 +2,12 @@ * interp/define.boot (compDefineCategory2): Compute dual signature early on. + (compDefineFunctor1): Likewise. * interp/database.boot (modemapsFromCategory): Take a first argument as a DB. Tidy. Adjust caller. + (modemapsFromFunctor): Likewise. Lose last argument. + (mkDatabasePred): Remove. + (formal2Pattern): Likewise. 2011-10-30 Gabriel Dos Reis <gdr@cs.tamu.edu> diff --git a/src/interp/database.boot b/src/interp/database.boot index e24d6a2b..831de579 100644 --- a/src/interp/database.boot +++ b/src/interp/database.boot @@ -203,10 +203,11 @@ modemapsFromCategory(db,form,body,signature) == ++ of the function `form.op' with `signature'. Return a list of modemaps ++ for operations from `opAlist' explicitly exported by the functor. ++ Note: the structure of modemaps same as for modemapsFromCategory. -modemapsFromFunctor(form,opAlist,signature) == - form := [.,:argl] := formal2Pattern form - opAlist := formal2Pattern opAlist - signature := formal2Pattern signature +modemapsFromFunctor(db,form,opAlist) == + f2p := pairList(form.args,rest $PatternVariableList) -- "*1" is for "$" + form := [.,:argl] := applySubst(f2p,form) + opAlist := applySubst(f2p,opAlist) + signature := applySubst(f2p,dbConstructorModemap(db).mmSignature) for u in form for v in signature repeat if symbolMember?(u,$PatternVariableList) then -- we are going to be EVALing categories containing these @@ -221,20 +222,21 @@ modemapsFromFunctor(form,opAlist,signature) == skip := argl ~= nil and CONTAINED("$",sig.source) => 'SKIP nil - sel := substitute(form,"$",sel) patternList := listOfPatternIds sig --get relevant predicates predList := - [[a,m] for a in argl for m in signature.source - | symbolMember?(a,$PatternVariableList)] - sig := substitute(form,"$",sig) - pred' := MKPF([pred,:[mkDatabasePred y for y in predList]],'AND) + [[(cat? => 'ofCategory; 'ofType),a,m] + for a in argl for m in signature.source + for cat? in dbDualSignature(db).source + | symbolMember?(a,$PatternVariableList)] l := listOfPatternIds predList if "OR"/[not symbolMember?(u,l) for u in argl] then sayMSG ['"cannot handle modemap for",:bright op, '"by pattern match" ] skip := 'SKIP - modemap := [[form,:sig],[pred',sel,:skip]] + modemap := [[form,:substitute(form,"$",sig)], + [mkpf([pred,:predList],'AND), + substitute(form,"$",sel),:skip]] mms := [[op,:interactiveModemapForm modemap],:mms] mms @@ -607,13 +609,6 @@ flattenSignatureList(x) == ll nil -mkDatabasePred [a,t] == - isCategoryForm(t,$e) => ['ofCategory,a,t] - ['ofType,a,t] - -formal2Pattern x == - applySubst(pairList($FormalMapVariableList,rest $PatternVariableList),x) - updateDatabase(fname,cname,systemdir?) == -- for now in NRUNTIME do database update only if forced not $forceDatabaseUpdate => nil diff --git a/src/interp/define.boot b/src/interp/define.boot index 8c8a5562..ce4b8bbc 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -1380,8 +1380,11 @@ compDefineFunctor1(df is ['DEF,form,signature,body], signature':= [signature.target,:[getArgumentModeOrMoan(a,form,$e) for a in argl]] $functorForm := $form := [$op,:argl] - if null signature'.target then signature':= - modemap2Signature getModemap($form,$e) + if signature'.target = nil then + signature' := modemap2Signature getModemap($form,$e) + dbDualSignature(db) := + [false,:[isCategoryForm(t,$e) for t in signature'.source]] + $functorTarget := target := signature'.target $e := giveFormalParametersValues(argl,$e) [ds,.,$e] := compMakeCategoryObject(target,$e) or return @@ -1414,8 +1417,6 @@ compDefineFunctor1(df is ['DEF,form,signature,body], modemap := [[parForm,:parSignature],[buildConstructorCondition db,$op]] dbConstructorModemap(db) := modemap dbCategory(db) := modemap.mmTarget - dbDualSignature(db) := - [false,:[isCategoryForm(t,$e) for t in modemap.mmSource]] -- (3.1) now make a list of the functor's local parameters; for -- domain D in argl,check its signature: if domain, its type is Join(A1,..,An); @@ -1448,7 +1449,7 @@ compDefineFunctor1(df is ['DEF,form,signature,body], fun := compile dbSubstituteFormals(db,[op',[lamOrSlam,argl,body']]) --The above statement stops substitutions gettting in one another's way operationAlist := dbSubstituteFormals(db,$lisplibOperationAlist) - dbModemaps(db) := modemapsFromFunctor(parForm,operationAlist,parSignature) + dbModemaps(db) := modemapsFromFunctor(db,parForm,operationAlist) reportOnFunctorCompilation() -- 5. |