Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pab/aldor patches #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/interp/hashcode.boot
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,20 @@ hashString str ==

-- Combine two hash codes to make a new one. Must be the same as in
-- the hashCombine function in aslib/runtime.as in asharp.

-- 419AC241: 1100661313
-- 5577F8E1: 1433925857
-- 440BADFC05072367: 4903203917250634599


$hashZ1 := 1100661313
$hashZ2 := 1433925857
$hashZZ := 4903203917250634599


hashCombine(hash1, hash2) ==
MOD(ASH(LOGAND(hash2, 16777215), 6) + hash1, $hashModulus)
h1 := LOGAND(hash1, ASH(1, 32) - 1)
h2 := LOGAND(hash2, ASH(1, 32) - 1)
LOGAND(ASH((h1*$hashZ1 + h2*$hashZ2) * $hashZZ, -32), 1073741823)

$VoidHash := hashString '"Void"
20 changes: 15 additions & 5 deletions src/interp/interop.boot
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ oldAxiomCategoryDefaultPackage(catform, dom) ==
oldAxiomPreCategoryDevaluate([op,:args], env) ==
SExprToDName([op,:devaluateList args], T)

oldAxiomCategoryDevaluate([[op,:args],:.], env) ==
SExprToDName([op,:devaluateList args], T)

$oldAxiomPreCategoryDispatch :=
VECTOR('oldAxiomPreCategory,
[function oldAxiomPreCategoryDevaluate],
Expand All @@ -174,17 +177,24 @@ $oldAxiomPreCategoryDispatch :=
[function oldAxiomPreCategoryBuild],
[nil])

oldAxiomCategoryDevaluate([[op,:args],:.], env) ==
SExprToDName([op,:devaluateList args], T)

oldAxiomPreCategoryParents(catform,dom) ==
vars := ["$",:rest GETDATABASE(opOf catform, 'CONSTRUCTORFORM)]
vals := [dom,:rest catform]
-- parents := GETDATABASE(opOf catform, 'PARENTS)
parents := parentsOf opOf catform
-- strip out forms listed both conditionally and unconditionally
unconditionalParents := []
filteredParents := []
for [cat, :pred] in parents repeat
if pred = true then
unconditionalParents := [cat,:unconditionalParents]
filteredParents := [[cat,:pred], :filteredParents]
for [cat, :pred] in parents repeat
if not pred = true and not member(cat, unconditionalParents) then
filteredParents=[[cat,:pred], :filteredParents]
PROGV(vars, vals,
LIST2VEC
[EVAL quoteCatOp cat for [cat,:pred] in parents | EVAL pred])
LIST2VEC [EVAL quoteCatOp cat for [cat,:pred] in filteredParents | EVAL pred])


quoteCatOp cat ==
atom cat => MKQ cat
Expand Down