Skip to content

Commit

Permalink
start actors5.d cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pzinn committed Nov 28, 2024
1 parent a0c7a5f commit 092541f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 133 deletions.
131 changes: 0 additions & 131 deletions M2/Macaulay2/d/actors5.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,6 @@ export makeKeywordFun(e:Expr):Expr := (
);
setupfun("makeKeyword",makeKeywordFun);

LongDoubleRightArrowFun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,LongDoubleRightArrowS);
setup(LongDoubleRightArrowS,LongDoubleRightArrowFun);

LongLongDoubleRightArrowFun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,LongLongDoubleRightArrowS);
setup(LongLongDoubleRightArrowS,LongLongDoubleRightArrowFun);

LongDoubleLeftArrowFun1(rhs:Code):Expr := unarymethod(rhs,LongDoubleLeftArrowS);
LongDoubleLeftArrowFun2(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,LongDoubleLeftArrowS);
setup(LongDoubleLeftArrowS,LongDoubleLeftArrowFun1,LongDoubleLeftArrowFun2);

LongLongDoubleLeftArrowFun1(rhs:Code):Expr := unarymethod(rhs,LongLongDoubleLeftArrowS);
LongLongDoubleLeftArrowFun2(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,LongLongDoubleLeftArrowS);
setup(LongLongDoubleLeftArrowS,LongLongDoubleLeftArrowFun1,LongLongDoubleLeftArrowFun2);

LongBiDoubleArrowFun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,LongBiDoubleArrowS);
setup(LongBiDoubleArrowS,LongBiDoubleArrowFun);

binaryDeductionFun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,DeductionS);
unaryDeductionFun(rhs:Code):Expr := unarymethod(rhs,DeductionS);
setup(DeductionS,unaryDeductionFun,binaryDeductionFun);

-- doublePointerfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,DoubleArrowS);
optionFun(lhs:Code,rhs:Code):Expr := (
-- # typical value: symbol =>, Thing, Thing, Option
Expand Down Expand Up @@ -147,108 +126,6 @@ integermod(e:Expr):Expr := (
else WrongNumArgs(2));
installMethod(PercentS,ZZClass,ZZClass,integermod);

modC(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,PercentS);
setup(PercentS,modC);

AtAtfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,AtAtS);
setup(AtAtS,AtAtfun);

StarStarfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,StarStarS);
setup(StarStarS,StarStarfun);

doubleplusfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,PlusPlusS);
setup(PlusPlusS,doubleplusfun);

lesslessfun2(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,LessLessS);
lesslessfun1(rhs:Code):Expr := unarymethod(rhs,LessLessS);
setup(LessLessS,lesslessfun1,lesslessfun2);

greatergreaterfun2(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,GreaterGreaterS);
setup(GreaterGreaterS,greatergreaterfun2);

barfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,BarS);
setup(BarS,barfun);

BarUnderscorefun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,BarUnderscoreS);
setup(BarUnderscoreS,BarUnderscorefun);

UnderscoreGreaterfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,UnderscoreGreaterS);
setup(UnderscoreGreaterS,UnderscoreGreaterfun);

UnderscoreGreaterEqualfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,UnderscoreGreaterEqualS);
setup(UnderscoreGreaterEqualS,UnderscoreGreaterEqualfun);

UnderscoreLessfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,UnderscoreLessS);
setup(UnderscoreLessS,UnderscoreLessfun);

UnderscoreLessEqualfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,UnderscoreLessEqualS);
setup(UnderscoreLessEqualS,UnderscoreLessEqualfun);

PowerGreaterfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,PowerGreaterS);
setup(PowerGreaterS,PowerGreaterfun);

PowerGreaterEqualfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,PowerGreaterEqualS);
setup(PowerGreaterEqualS,PowerGreaterEqualfun);

PowerLessfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,PowerLessS);
setup(PowerLessS,PowerLessfun);

PowerLessEqualfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,PowerLessEqualS);
setup(PowerLessEqualS,PowerLessEqualfun);

PowerStarStarfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,PowerStarStarS);
setup(PowerStarStarS,PowerStarStarfun);

colonfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,ColonS);
setup(ColonS,colonfun);

ampersandfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,AmpersandS);
setup(AmpersandS,ampersandfun);

hathatfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,HatHatS);
setup(HatHatS,hathatfun);

interpunctfun(lhs:Code, rhs:Code):Expr := binarymethod(lhs, rhs, InterpunctS);
setup(InterpunctS, interpunctfun);

boxtimesfun(lhs:Code, rhs:Code):Expr := binarymethod(lhs, rhs, BoxTimesS);
setup(BoxTimesS, boxtimesfun);

shuffleproductfun(lhs:Code, rhs:Code):Expr := binarymethod(lhs, rhs, ShuffleProductS);
setup(ShuffleProductS, shuffleproductfun);

Tildefun(rhs:Code):Expr := unarymethod(rhs,TildeS);
setuppostfix(TildeS,Tildefun);

PowerTildefun(rhs:Code):Expr := unarymethod(rhs,PowerTildeS);
setuppostfix(PowerTildeS,PowerTildefun);

UnderscoreTildefun(rhs:Code):Expr := unarymethod(rhs,UnderscoreTildeS);
setuppostfix(UnderscoreTildeS,UnderscoreTildefun);

ParenStarParenfun(rhs:Code):Expr := unarymethod(rhs,ParenStarParenS);
setuppostfix(ParenStarParenS,ParenStarParenfun);

UnderscoreStarfun(rhs:Code):Expr := unarymethod(rhs,UnderscoreStarS);
setuppostfix(UnderscoreStarS,UnderscoreStarfun);

PowerStarfun(rhs:Code):Expr := unarymethod(rhs,PowerStarS);
setuppostfix(PowerStarS,PowerStarfun);

--PowerSharpfun(rhs:Code):Expr := unarymethod(rhs,PowerSharpS);
--setuppostfix(PowerSharpS,PowerSharpfun);

--UnderscoreSharpfun(rhs:Code):Expr := unarymethod(rhs,UnderscoreSharpS);
--setuppostfix(UnderscoreSharpS,UnderscoreSharpfun);

Exclamationfun(rhs:Code):Expr := unarymethod(rhs,ExclamationS);
setuppostfix(ExclamationS,Exclamationfun);

PowerExclamationfun(rhs:Code):Expr := unarymethod(rhs,PowerExclamationS);
setuppostfix(PowerExclamationS,PowerExclamationfun);

UnderscoreExclamationfun(rhs:Code):Expr := unarymethod(rhs,UnderscoreExclamationS);
setuppostfix(UnderscoreExclamationS,UnderscoreExclamationfun);

factorial(x:Expr):Expr := (
when x
Expand All @@ -266,9 +143,6 @@ installMethod(ExclamationS,RRClass,factorial);
installMethod(ExclamationS,ZZClass,factorial);
installMethod(ExclamationS,QQClass,factorial);

underscorefun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,UnderscoreS);
setup(UnderscoreS,underscorefun);

dotfun(lhs:Code,rhs:Code):Expr := (
left := eval(lhs);
when left is Error do left
Expand All @@ -290,11 +164,6 @@ dotQfun(lhs:Code,rhs:Code):Expr := (
else False);
setup(DotQuestionS,dotQfun);

atfun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,AtS);
setup(AtS,atfun);

leftDividefun(lhs:Code,rhs:Code):Expr := binarymethod(lhs,rhs,LeftDivideS);
setup(LeftDivideS,leftDividefun);

header "
#ifdef HAVE_SYS_IOCTL_H
Expand Down
17 changes: 15 additions & 2 deletions M2/Macaulay2/d/convertr.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export InstallValueFun := dummyMultaryFun;
export UnaryInstallValueFun := dummyTernaryFun;

export binarymethod1 := dummyTernaryFun; -- temporary, will be redefined in evaluate.d
export unarymethod1 := dummyBinaryFun; -- temporary, will be redefined in evaluate.d

convert(e:ParseTree):Code;
CodeSequenceLength(e:ParseTree,separator:Word):int := (
Expand Down Expand Up @@ -316,8 +317,20 @@ export convert0(e:ParseTree):Code := (
is u:Unary do (
if u.Operator.word == CommaW then Code(sequenceCode(makeCodeSequence(e, CommaW), pos)) else
if u.Operator.word == SemicolonW then Code(semiCode( makeCodeSequence(e, SemicolonW), pos))
else Code(unaryCode(u.Operator.entry.unary, convert(u.rhs), pos)))
is u:Postfix do Code(unaryCode(u.Operator.entry.postfix, convert(u.lhs), pos))
else (
f:=u.Operator.entry.unary;
if f==dummyUnaryFun then
Code(binaryCode(unarymethod1,convert(u.rhs), globalSymbolClosureCode(u.Operator.entry, dummyPosition),pos))
else
Code(unaryCode(f, convert(u.rhs), pos))
))
is u:Postfix do (
f:=u.Operator.entry.postfix;
if f==dummyPostfixFun then
Code(binaryCode(unarymethod1,convert(u.lhs), globalSymbolClosureCode(u.Operator.entry, dummyPosition),pos))
else
Code(unaryCode(f, convert(u.lhs), pos))
)
is q:Quote do (
token := q.rhs;
sym := token.entry;
Expand Down
6 changes: 6 additions & 0 deletions M2/Macaulay2/d/evaluate.d
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,11 @@ export binarymethodCode(lhs:Code,rhs:Code,methodkey:Code):Expr := (
s:globalSymbolClosureCode do binarymethod(lhs,rhs,SymbolClosure(globalFrame,s.symbol))
else nullE
);
export unarymethodCode(rhs:Code,methodkey:Code):Expr := (
when methodkey is
s:globalSymbolClosureCode do unarymethod(rhs,SymbolClosure(globalFrame,s.symbol))
else nullE
);


-----------------------------------------------------------------------------
Expand Down Expand Up @@ -2118,6 +2123,7 @@ nullCoalescion(lhs:Code,rhs:Code):Expr := (
setup(QuestionQuestionS, nullify, nullCoalescion);

binarymethod1=binarymethodCode;
unarymethod1=unarymethodCode;

-- Local Variables:
-- compile-command: "echo \"make: Entering directory \\`$M2BUILDDIR/Macaulay2/d'\" && make -C $M2BUILDDIR/Macaulay2/d evaluate.o "
Expand Down

0 comments on commit 092541f

Please sign in to comment.