.DATE 21:09:44 RID 86I 09 JUL 08 GORT .Run Name: CALC By: Rob Haeuser Lvl 8.800 (c)1993-2008 *Function: Calculator can be run independently or called as a subroutine. * The calculated total is returned to the calling run. *=============================================================================== :L1=14,5=48,10=59,15=64,18=66,20=67,22=68,24=69,26=70,28=71,30=72,32=73,34=74 :L36=75,38=76,40=77,42=78,44=79,46=81,48=82,50=83,52=84,54=85,56=88,58=89,60=90 :L62=91,64=92,66=93,68=94,70=95,72=96,74=97,76=98,78=99,80=100,82=101,84=102 :L86=103,88=104,90=105,92=106,94=107,96=108,98=109,100=110,102=111,104=112 :L106=113,108=114,110=116,112=117,151=118,152=119,153=120,154=121,155=122 :L160=123,188=124,190=225,198=226,199=228 @ IF DLINE$ > 0 RNM -1 CHG
i6 DLINE$ ;CALL 0001*('') . @ IF DRW1$ > 0 DSX,-1,
;REL . @0001:() RAR 0199 RER,EDRW$,2 0001 . @ IF WS$ > 0 . ;GTO 0198 . <- can only run on a station that supports GUI @ RSR,EDRW$,4 0011 . <- get screen colors @ LDV,r a15=0,a15,h1=+,a15,h1,h1=+,i1,a15,\ I2=23 IF SCNV$ GE 30 . ;LDV =22 . @ FON,r,'Courier New',,b . @ WIN,,5,25,17,31,,hio ' GURU Calculator' i6 . <- main window @ MNU,, MENUBAR,"E&xit",,0199 MENUBAR,"&Help",,0188 @ TXT,"",,2,4,1,1,,3b i6 . <- memory flag @ EDT,"",,02,09,1,15,,3r i6 . <- input area @ TXT,"",,02,28,1,1,,3b i6 . <- operation @ BTN,,04,03,2,4 'C' i6 BTN,,04,09,2,5 '7' <7>i6 . @ BTN,,04,14,2,5 '8' <8>i6 BTN,,04,19,2,5 '9' <9>i6 . @ BTN,,04,26,2,4 '+' i6 BTN,,06,03,2,4 'CE' i6 . @ BTN,,06,09,2,5 '4' <4>i6 BTN,,06,14,2,5 '5' <5>i6 . @ BTN,,06,19,2,5 '6' <6>i6 BTN,,06,26,2,4 '-' i6 . @ BTN,,08,03,2,4 'MC' i6 BTN,,08,09,2,5 '1' <1>i6 . @ BTN,,08,14,2,5 '2' <2>i6 BTN,,08,19,2,5 '3' <3>i6 . @ BTN,,08,26,2,4 '*' i6 BTN,,10,03,2,4 'MR' i6 . @ BTN,,10,09,2,5 '0' <0>i6 BTN,,10,14,2,5 '.'

i6 . @ BTN,,10,19,2,5 '=' i6 BTN,,10,26,2,4 '/' i6 . @ BTN,,12,03,2,4 'M+' i6 BTN,,13,09,1,3 'Ab' i6 . @ BTN,,13,12,1,3 'Ac' i6 BTN,,13,15,1,3 'As' i6 . @ BTN,,13,18,1,3 'At' i6 BTN,,13,21,1,3 'Cr' i6 . @ BTN,,13,24,1,3 'Cs' i6 BTN,,13,27,1,3 'Ct' i6 . @ BTN,,14,03,2,4 'M-' i6 BTN,,14,09,1,3 'Dr' i6 . @ BTN,,14,12,1,3 'Ex' i6 BTN,,14,15,1,3 'Fp' i6 . @ BTN,,14,18,1,3 'Hc' i6 BTN,,14,21,1,3 'Hs' i6 . @ BTN,,14,24,1,3 'Ht' i6 BTN,,14,27,1,3 'Ip' i6 . @ BTN,,15,09,1,3 'Le' i6 BTN,,15,12,1,3 'Lt' i6 . @ BTN,,15,15,1,3 'Pi' i6 BTN,,15,18,1,3 'Rd' i6 . @ BTN,,15,21,1,3 'Si' i6 BTN,,15,24,1,3 'Sr' i6 . @ BTN,,15,27,1,3 'Ta' i6 . @0005:TXT,"", IF > 0 JUV,r ;. @ CLS, EDT,"",,2,9,1,15,,3r SHW, . @ INP, ,(0010),,(0020),<0>,(0022),<1>,(0024),<2>,(0026),\ <3>,(0028),<4>,(0030),<5>,(0032),<6>,(0034),<7>,(0036),<8>,(0038),\ <9>,(0040),

= Displayed Line # . = Equals handle (=) . = Edit box handle . = Mathematical function . = Font Size . = Grand Total . = Help Window handle . = Input . = Packed version of . = Last Operation . = Multiply handle (*) . = Memory add handle . = Memory flag (equals X if memory is active) . = Memory flag handle . = Memory subtract handle . = Memory total . = Current operation (+, -, *, /) . = Current operation handle .

= Period handle (.) . = Subtract handle (-) . = Edit Box handle . = Function . = Temporary Holder . = Window handle . . All the variables initialized for the scientific function buttons . represent their associated handles. . .V194 - V199 = Error routine

,(0042),,(0046),,(0048),,(0050),,(0052),\ ,(0054),,(0110),,(0112),,(0056),,(0058),,(0060),\ ,(0062),,(0064),,(0066),,(0068),,(0070),,(0072),\ ,(0074),,(0076),,(0078),,(0080),,(0082),,(0084),\ ,(0086),,(0088),,(0090),,(0092),,(0094),,(0096),\ ,(0098),,(0100),,(0100),,(0102),,(0104) ;. @ IF INPUT$ = 0188,(0188),0199,(0199) ;GTO 0151 . @0010:CHG INPUT$ LCV '' ','/'' LDV,r DEF , . <- kill commas @ IF = 1,(0018),2,4,(LIN1),5,(0015) ;GTO 0151 . <- valid input? @ LDV,l IF = +,-,*,/ LDV = GTO 0054 ;. <- keyed operation? @ IF = C,(0110),CE,(0112),MC,(0098),MR,(0100),M+,(0102),M-,(0104) ;. @ GTO 0151 . @0015:IF (15-1) = +,-,*,/ LDV =(15-1),(15-1)='' GTO 0020 ;. @ GTO 0151 . @0018:LDV,l IF (1-1) = +,-,*,/ LDV =(1-1),(1-1)=,= ;. @0020:LDV,r ,= GTO 0054 . @0022:LDV =0 GTO 0044 . @0024:LDV =1 GTO 0044 . @0026:LDV =2 GTO 0044 . @0028:LDV =3 GTO 0044 . @0030:LDV =4 GTO 0044 . @0032:LDV =5 GTO 0044 . @0034:LDV =6 GTO 0044 . @0036:LDV =7 GTO 0044 . @0038:LDV =8 GTO 0044 . @0040:LDV =9 GTO 0044 . @0042:LDV ='.' . @0044:LDV,l LDV (0-1)= LCV T@ ' '/'' LDV,r ,= . @ GTO 0005 . <- accumulate input @0046:LDV =+ GTO 0054 . @0048:LDV =- GTO 0054 . @0050:LDV =* GTO 0054 . @0052:LDV =/ . @0054:IF ne 0 IF ne '' ART . ;\ <- calculate IF ne '' LDV = ;. @ LDV =,=,='' GTO 0005 . <- show new total @0056:LDV h3=ABS GTO 0108 . <- absolute value or magnitude @0058:IF ge -1 & le 1 LDV h4=ACOS GTO 0108 ;GTO 0152 . <- arc cosine @0060:IF ge -1 & le 1 LDV h4=ASIN GTO 0108 ;GTO 0152 . <- arc sine @0062:LDV h4=ATAN GTO 0108 . <- arc tangent @0064:LDV h4=CBRT GTO 0108 . <- cube root @0066:LDV h3=COS GTO 0108 . <- cosine @0068:LDV h3=CTN GTO 0108 . <- cotangent @0070:LDV h3=DEG GTO 0108 . <- radians expressed in degrees @0072:IF ge 0 & le 709 LDV h3=EXP GTO 0108 ;GTO 0153 . <-exponent(E to n) @0074:LDV h4=FRAC GTO 0108 . <- fractional portion @0076:IF ge -710 & le 710 LDV h4=HCOS GTO 0108 ;GTO 0154 . <- hyprblc cs @0078:IF ge -710 & le 710 LDV h4=HSIN GTO 0108 ;GTO 0154 . <- hyprblc sn @0080:LDV h4=HTAN GTO 0108 . <- hyperbolic tangent @0082:LDV h3=INT GTO 0108 . <- integer portion @0084:IF > 0 LDV h3=LOG GTO 0108 ;GTO 0155 . <- logarith in base e @0086:IF > 0 LDV h5=LOG10 GTO 0108 ;GTO 0155 . <- logarith in base 10 @0088:ART PI LDV = GTO 0005 . <- pi @0090:LDV h3=RAD GTO 0108 . <- degrees in radians @0092:LDV h3=SIN GTO 0108 . <- sine @0094:IF > 0 LDV h4=SQRT GTO 0108 ;GTO 0155 . <- square root @0096:LDV h3=TAN GTO 0108 . <- tangent @0098:TXT," ", LDV ='',=,= GTO 0005 . clear the memory flag @0100:LDV =,= GTO 0005 . <- recall memory @0102:IF ne '' ART + LDV = ;GTO 0106 . <- memory + @0104:IF ne '' ART - LDV = ;. <- memory - @0106:IF = '' TXT,"M", LDV =X ;GTO 0005 . @0108:IF ne '' LDV,p a15= . ;LDV i1=1 . @ XQT '@ART ''('') GTO 0005 . ' . <- scientific calculation @0110:LDV,r =0,=0,=+,=+,='' GTO 0005 . <- clear all @0112:LDV =,='' GTO 0005 . <- clear entry @0151:LDV s55='I do not understand your input. Please try again.' GTO 0160 @0152:LDV s28='Valid range is -1 to +1' GTO 0160 . @0153:LDV s28='Valid range is 0 to 709' GTO 0160 . @0154:LDV s31='Valid range is -710 to 710' GTO 0160 . @0155:LDV s34='Number must be greater than 0' . @0160:LDV =,='' MBX,,s,'Input error' o,(0005) . <- show error @0188:BRK . CALC starts in add mode. The active operation is displayed to the right of the entry area. Enter numbers by clicking the number buttons or via the keyboard. If you use the keyboard, you MUST transmit your input, or it will be discarded. You can also type C (Clear), CE (Clear Entry), MR (Memory Recall), MC (Memory Clear), M+ (Add to Memory), and M- (Subtract from Memory). Remember, any entry from the keyboard must be transmitted. When entering from the keyboard, you can change the active operation for either the current entry or for subsequent entries. For example, if in add mode and you transmit -15, the active operation changes to subtraction, reducing the total by 15. If you enter 15-, 15 is added to the total, and the active operation becomes subtraction for the following entries. You cannot enter equations, such as (12*45)+77.8, all at once. To perform this equation, you would enter 12* and transmit. Next enter 45+ and transmit. Then enter 77.8 and transmit, yielding the total 617.8. To activate memory, make an entry and then click M+ or M-. If you use the number buttons, simply click M+/M- immediately. If you enter via the keyboard, transmit prior to clicking M+/M- or your entry will be discarded. When memory is active an "M" will display in the box to the to the left of the input area. Once activated, clicking M+/M- will add to or subtract from stored memory. To recall and display stored memory click MR or the "M" in the "Memory Active" box to the left of the input area. The stored number will be displayed, but you must still process it by transmitting or clicking an operation (+,-,*,/). If the total exceeds 15 digits, it will display in scientific notation, where the letter E, followed by a number (representing the power of 10) indicates which direction and how many positions to move the decimal point. For example, 173E6 would represent 173,000,000. In this case, E6 indicates six zeroes to the right. Another example is .12345E-3, which represents .00012345, where E-3 indicates three zeroes to the left. Please note that the number may be rounded. Also, you cannot enter scientific notation as input. And now for some really fuzzy logic. The Active Operation Box (AOB) to the right of the Input Area can be clicked. Its function varies, depending on what was just done. For example, if you enter a number and then click the AOB, it is the equivalent of clicking "=". However, if you click the AOB a second time, it is the equivalent of transmitting from the keyboard, and the currently active action will be performed. For example, if you run CALC and click on the "5" button, a 5 is displayed. If you then click the AOB, it acts as an "=", and the 5 is re-displayed. If you click the AOB again, it acts as a transmit, and 5 is added to 5, yielding 10. Subsequent clicks of the AOB will continue to add the number to itself, just as transmitting from the keyboard would (5, 10, 20, 40, 80, 160, and so on). So what is this good for? Excellent question! Essentially, it is a shortcut to entering the same number over again, and depending on the operation, might prove useful. If all this is too fuzzy, just don''t click it! And remember: you can do pretty much the same thing with the transmit key. The 3 rows of buttons on the bottom are for scientific calculations and are defined as follows: Ab = Absolute value Ac = Arc cosine As = Arc sine At = Arc tangent Cr = Cube root Cc = cosine Ct = Cotangent Dr = Degrees radian Ex = Exponentiate "e" Fp = Fractional portion Hc = Hyperbolic cosine Hs = Hyperbolic sine Ht = Hyperbolic tangent Ip = Integer portion Le = Logarithm base "e" Lt = Logarithm base 10 Pi = Value of PI Rd = Radian degrees Si = Sine Sr = Square root Ta = Tangent Congratulations! You read the whole thing, or at least scrolled down here out of curiosity. @ BRK WIN,,4,14,24,61,,hio ' GURU Calculator Help' i6 . @ MNU,, MENUBAR,"&Return",,0190 . @ EDT,-0,2,99,,2,3,20,55,,3bt HID, SHW, INP . @0190:CLS, GTO 0005 . @0198:SC Q ATT;EEL;FLD,1,1,,SCNH$,C,(WHI/RED),,\ TIC$'<< Sorry, but CALC can only be run on a GUI Workstation >>'TIC$ WAT 4000 . @0199:RETURN . ................................ Variable Table ................................ .<0> - <9> = 0 thru 9 handles . = Add handle (+) . - = screen colors . = Clear handle (C) . = Clear Entry handle (CE) . = Divide handle (/) .