Skip to content

Commit

Permalink
Remove redundant setupop in favor of setup (they were identical)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-torrance committed Sep 1, 2024
1 parent f46668a commit 421482f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
8 changes: 4 additions & 4 deletions M2/Macaulay2/d/chrono.dd
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ showtimefun(a:Code):Expr := (
<< threadEnd - threadStart << "s (thread); "
<< gcEnd - gcStart << "s (gc)" << endl;
ret);
setupop(timeS,showtimefun);
setup(timeS,showtimefun);

-- TODO: should "timing" return thread and gc times like "time"?
timingfun(c:Code):Expr := (
s := cpuTimer(c);
when s.1 is Error do s.1 else list(timeClass, s));
setupop(timingS, timingfun);
setup(timingS, timingfun);

elapsedTimefun(c:Code):Expr := (
s := wallTimer(c);
when s.0 is dT:RRcell do (
stdError << " -- " << tostringRR(dT.v) << "s elapsed" << endl;)
else nothing; s.1);
setupop(elapsedTimeS,elapsedTimefun);
setup(elapsedTimeS,elapsedTimefun);

elapsedTimingfun(c:Code):Expr := (
s := wallTimer(c);
when s.1 is Error do s.1 else list(timeClass, s));
setupop(elapsedTimingS,elapsedTimingfun);
setup(elapsedTimingS,elapsedTimingfun);
4 changes: 0 additions & 4 deletions M2/Macaulay2/d/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ export setup(e:SymbolClosure,fun1:unop,fun2:unop):void := (
e.symbol.unary = fun1;
e.symbol.postfix = fun2;
);
export setupop(s:SymbolClosure,fun:unop):void := (
unopNameList = unopNameListCell(fun,s.symbol,unopNameList);
s.symbol.unary = fun;
);
export setup(e:SymbolClosure,fn:ternop):void := (
ternopNameList = ternopNameListCell(fn,e.symbol,ternopNameList);
);
Expand Down
14 changes: 7 additions & 7 deletions M2/Macaulay2/d/evaluate.d
Original file line number Diff line number Diff line change
Expand Up @@ -1631,45 +1631,45 @@ shieldfun(a:Code):Expr := (
exit(1);
);
ret));
setupop(shieldS,shieldfun);
setup(shieldS,shieldfun);

returnFun(a:Code):Expr := (
e := if a == dummyCode then nullE else eval(a);
when e is Error do e else Expr(Error(dummyPosition,returnMessage,e,false,dummyFrame)));
setupop(returnS,returnFun);
setup(returnS,returnFun);

throwFun(a:Code):Expr := (
e := eval(a);
when e is Error do e else Expr(Error(dummyPosition,throwMessage,e,false,dummyFrame)));
setupop(throwS,throwFun);
setup(throwS,throwFun);

continueFun(a:Code):Expr := (
e := if a == dummyCode then nullE else eval(a);
when e is Error do e else Expr(Error(dummyPosition,
if a == dummyCode then continueMessage else continueMessageWithArg,
e,false,dummyFrame)));
setupop(continueS,continueFun);
setup(continueS,continueFun);

stepFun(a:Code):Expr := (
e := if a == dummyCode then nullE else eval(a);
when e is Error do e else (
Expr(Error(dummyPosition,
if a == dummyCode then stepMessage else stepMessageWithArg,
e,false,dummyFrame))));
setupop(stepS,stepFun);
setup(stepS,stepFun);

breakFun(a:Code):Expr := (
e := if a == dummyCode then dummyExpr else eval(a);
when e is Error do e else Expr(Error(dummyPosition,breakMessage,e,false,dummyFrame)));
setupop(breakS,breakFun);
setup(breakS,breakFun);

addTestS := setupvar("addTest", nullE); -- will be overwritten in testing.m2
testfun(c:Code):Expr := (
r := applyEE(
getGlobalVariable(addTestS),
seq(eval(c), locate(codePosition(c))));
when r is Error do r else nullE);
setupop(TestS, testfun);
setup(TestS, testfun);

assigntofun(lhs:Code,rhs:Code):Expr := (
left := eval(lhs);
Expand Down

0 comments on commit 421482f

Please sign in to comment.