// C A L C O P T . S R // shur, 8/24/76 // Calculator Options Command: // Subcommands: // 0-9: Precision // F,S,R: Mode (Fixed, Scientific, Engineering) // R: Radix // + = - * _ / % \ operate on stack get "bravo1.df" get "calc.df" get "char.df" get "st.df" get "doc.df" get "display.df" get "rn1.df" get "com.df" // incoming procedures external [ RealRadixConvert SetRegionSys SetRegionW updatedisplay uc stsize FChInSb StFromReal RealFromInt ConvertRealRadix PushCalc MakeCurrentBuf InsertBuf insertc deleted bravochar move FCalc ] // incoming statics external [ vrlwsys vintradix vrealx vrealy vrealz vrealw frealmode cdigitpoint ] // outgoing procedures external [ CalcOpt FixDispReal ] //-=-=-=-=-=-=--=-=-=-=-= let CalcOpt(cf) = valof //-=-=-=-=-=-=-=-=-=-=-=- [ SetRegionSys(risyspast,rinil) SetRegionSys(risysstate,190) updatedisplay() let ch= uc(bravochar()) if ch eq chdel then [ SetRegionSys(risyspast, 188, 50) resultis abmsg ] if FChInSb(ch,"+=-**_/%") then [ cf>>CF.w0= ch; resultis FCalc(cf,fhpoptor) ] if ch eq $\ then [ PushCalc(); FixDispReal(); resultis abnil ] if (ch ge $0) & (ch le $9) then [ setprecision(ch- #60); resultis abmsg ] if ch eq $R then [ setradix(); resultis abmsg ] if FChInSb(ch,"FSE") then [ setmode(ch); resultis abmsg ] SetRegionSys(risyspast, 157, 50) //illegal option resultis abmsg ] //-=-=-=-=-=-=--=-=-=-=-= and setprecision(int) be //-=-=-=-=-=-=-=-=-=-=-=- [ cdigitpoint = int FixDispReal() let tsb= vec 1 tsb>>SB.cch=1 tsb>>SB.ch^0= int + #60 SetRegionW(vrlwsys,0,tsb) let trid=0 trid<>SB.cch=1 tsb>>SB.ch^0= vintradix + $0 SetRegionW(vrlwsys,0,tsb) trid<