REVO2700 rpncalc @ - function double p1 return p1 * 2 end double function list repeat with x = 1 to paramcount() put param(x) & cr after t1 end repeat delete char -1 of t1 return t1 end list function pp pList replace cr with ", " in pList delete char -1 to -2 of pList return "(" & pList & ")" end pp function cons pItem, @pList put cr & pItem after pList if char 1 of pList is cr then put empty into char 1 of pList return pList end cons function car pList get line 1 of pList return it end car function cdr pList if the number of lines in pList > 1 then return line 2 to -1 of pList else return empty end if end cdr function cs_push pItem @pList put cons(pItem, pList) into pList return pList end cs_push function cs_pop @pList put pList into t1 repeat with x = 1 to the number of lines in pList - 1 get cons(car(t1), t2) put cdr(t1) into t1 end repeat get car(t1) put t2 into pList if pList is "t2" then put empty into pList return it end cs_pop function swap @pList put cs_pop(pList) into t1 put cs_pop(pList) into t2 get cs_push(t1, pList) get cs_push(t2, pList) return pList end swap function reverse pList put pList into tList repeat with x = 1 to the number of lines in pList get cons(cs_pop(tList), t1) end repeat return t1 end reverse function mapcar pFunc, @pList put reverse(pList) into pList repeat with x = 1 to the number of lines in pList get cs_pop(pList) put "get" && pfunc & "(" & it & ")" into tTemp do tTemp put cons(it, t2) into t2 end repeat put t2 into pList return pList end mapcar function cs_max pList put car(pList) into tMax repeat while the number of lines in pList > 1 put car(cdr(pList)) into t2 put max(tMax, t2) into tMax put cdr(pList) into pList end repeat return tMax end cs_max function cs_min pList put car(pList) into tMin repeat while the number of lines in pList > 1 put car(cdr(pList)) into t2 put min(tMin, t2) into tMin put cdr(pList) into pList end repeat return tMin end cs_min function cs_FIFO_pop @pList put reverse(pList) into pList get cs_pop(pList) put reverse(pList) into pList return it end cs_FIFO_pop command rpn_set_register @pStack, pRegister, pValue put pValue into pStack["register"][pRegister] end rpn_set_register function rpn_get_register @pStack, pRegister return pStack["register"][pRegister] end rpn_get_register on keydown pKey switch pKey case "c" send "mouseup" to btn "CLx" break case "C" send "mouseup" to btn "CLA" break case "n" send "mouseup" to btn "Neg" break case "," send "mouseup" to btn "." break case "*" send "mouseup" to btn "x" break case "0" send "mouseup" to btn "zero" break default if there is a btn pKey then send "mouseup" to btn pKey end if end switch end keydown on returnKey send "mouseup" to btn "enter" end returnKey on deleteKey send "mouseup" to btn "CLx" end deleteKey on backspaceKey deleteKey end backspaceKey on arrowkey pKey switch pKey case "down" send "mouseup" to btn "Rdn" break case "up" repeat 4 times send "mouseup" to btn "Rdn" end repeat break end switch end arrowkey on enterKey returnkey end enterKey command rpn_push @pStack, pValue rpn_set_register pStack, "T", rpn_get_register(pStack, "Z") rpn_set_register pStack, "Z", rpn_get_register(pStack, "Y") rpn_set_register pStack, "Y", rpn_get_register(pStack, "X") rpn_set_register pStack, "X", pValue end rpn_push function rpn_pop @pStack put rpn_get_register(pStack, "X") into pStack["Last X"] rpn_set_register pStack, "X", rpn_get_register(pStack, "Y") rpn_set_register pStack, "Y", rpn_get_register(pStack, "Z") rpn_set_register pStack, "Z", rpn_get_register(pStack, "T") rpn_set_register pStack, "T", rpn_get_register(pStack, "T") return pStack["Last X"] end rpn_pop command rpn_rotate_down @pStack get rpn_get_register(pStack, "X") rpn_set_register pStack, "X", rpn_get_register(pStack, "Y") rpn_set_register pStack, "Y", rpn_get_register(pStack, "Z") rpn_set_register pStack, "Z", rpn_get_register(pStack, "T") rpn_set_register pStack, "T", it end rpn_rotate_down command rpn_init pStack rpn_set_register pStack, "T", 0 rpn_set_register pStack, "Z", 0 rpn_set_register pStack, "Y", 0 rpn_set_register pStack, "X", 0 end rpn_init 4S RPN Calc U Lucida Grande W Lucida Grande U monaco U monaco U Helvetica U Lucida Grande U Helvetica U Helvetica U Helvetica U Lucida Grande cREVGeometryCache stackID 1050 cRevOnline id 518 cRevStandaloneSettings 'scriptLibraries Internet Geometry PrintingMacOSX false OSX,name rpncalcUNIX,fileSelector trueWindows falseWindows,LegalCopyright #2010 All rights reserved worldwideUNIX,pageSetup trueOSX,documentType Linux trueinclusions searchWindows,documenticonFile S/opt/runrev/livecode-4.5/Runtime/Windows/x86-32/Support/Sample Icons/genericdoc.ico answerDialog trueOSX,documentExtension Windows,FileDescription rpncalc 1.0.0.0 for WindowsOSX,longVersion rpncalc 1.0.0.0OSX,copyright #2010 All rights reserved worldwideUNIX,printerChooser trueOSX,identifier com..rpncalcname rpncalcOSX,shortVersion 1.0.0.0Windows,fileversion1 1Windows,fileversion2 0Windows,productversion1 1Windows,fileversion3 0Windows,productversion2 0Windows,productversion3 0cursors falseWindows,fileversion4 0Windows,productversion4 0 OSX,info rpncalc Version 1.0.0.0MacOSX PowerPC-32 false askDialog trueWindows,iconFile S/opt/runrev/livecode-4.5/Runtime/Windows/x86-32/Support/Sample Icons/genericapp.icoOSX,signature ????defaultBuildFolder /home/agarzia/DesktopWindows,ProductName rpncalcUNIX,colorChooser trueMacOSX x86-32 falseWindows,companyname cREVGeneral breakpointconditions scripteditorvscroll 2309breakpoints scripteditorselection 2864breakpointstates stackfileversion 2.7AlreadyHidden false Pglobal gStack on updateDisplay lock screen put empty into fld "entryField" -- put gStack into fld "display" put empty into fld "display" put "T: " && rpn_get_register(gStack, "T") & cr after fld "display" put "Z: " && rpn_get_register(gStack, "Z") & cr after fld "display" put "Y: " && rpn_get_register(gStack, "Y") & cr after fld "display" put "X: " && rpn_get_register(gStack, "X") after fld "display" end updateDisplay on preopencard rpn_init gStack end preopencard - cREVGeometryCacheIDs #1123101499542 10231123101504937 10251123100937109 10051287006031509 10471123101469589 10181123101297478 10131123101942645 10361287009031962 10481123100993632 10091123101905801 10331123101553941 10291123101905807 10341287002365922 10441123101884015 10301123100987247 10081123101884017 10311123101499493 10211123101499494 10221112947059396 10101123101504968 10261123101470068 10191101851612413 10061123103099661 10411123101942669 10371123101304213 10141123100977546 10071123101172418 10121102288214562 10171123101905842 10351123101553897 10271123101504924 10241123101942692 10381123101884053 10321123102217414 10391123101553916 1028 cREVGeometrycache total 35order cREVGeneral scriptChecksum N]lj*D@7handlerList updateDisplayscriptSelection char 49 to 48scripteditorvscroll 0 bookmarks scripteditorselection 31tempScript prevHandler updateDisplayscript J
global gStack
on updateDisplay
put empty into fld "entryField"
put gStack into fld "display"
end updateDisplay
BG Noise.PNG @ B locLoc true 8%PNG IHDR >a pHYs gAMA |Q cHRM z% u0 ` : o_F 7IDATxڬױn(cwly8Oqdwcq텭* MZSb7Pw_f~Yz)vNNQEvQ""bGٌnZ-FhZn#"x