CALC The Professional Calculator for Clipper (tm) by Touchstone Business Creations Version 1.6 April 1993 (c) Copyright 1991,92,93 Touchstone Business Creations All rights reserved. 1 INTRODUCTION .....................................1-1 1.1 Purpose ......................................1-1 1.2 Trademarks ...................................1-1 1.3 Technical Support ............................1-1 1.4 License Agreement ............................1-2 1.5 Programming ..................................1-4 1.6 Linking ......................................1-5 1.7 Credits ......................................1-6 1.8 Changes ......................................1-6 1.9 Coming Attractions ...........................1-7 2 THE CALC PROGRAM .................................2-1 2.1 Usage ........................................2-1 2.2 Running the demos ............................2-1 2.3 Functions ....................................2-1 Calculator() .................................2-2 CalcReg() ....................................2-5 CalcInit() ...................................2-6 CalcPos() ....................................2-8 CalcUDF() ....................................2-10 CalcMemory() .................................2-13 CalcPrint() ..................................2-14 CalcPTape() ..................................2-17 3 3.1 Order Form ...................................3-1 1 INTRODUCTION 1.1 Purpose CALC has been developed for the programmer, to add a natural, yet powerful calculator to her application. CALC works with the Clipper 5.01 and 5.2 development system on IBM compatible computers. 1.2 Trademarks. Clipper is a registered trademark of Computer Associates, International, Inc. IBM is a registered trademark of International Business Machines. 1.3 Technical Support. As a registered user, you retain the right to technical support regarding CALC's use for a period of 45 days from purchase. After this, your support is at the discretion of the technical supervisor at Touchstone Business Creations. To receive technical support: You may send your questions, requests, and other important information to CompuServe address 73670,2561 or call Touchstone Business Creations at (909) 679-3364 or write Touchstone at 28613 River Glen Ct. #1 Menifee, CA 92584-8987 Be sure to have your registration number at hand (or if writing, include it, please). Page 1-1 1.4 License Agreement. 1.4.1 License Touchstone Business Creations ("Touchstone") grants you a non-exclusive license of unlimited duration to use the Touchstone Software Programs, Documentation and Permitted Copies ("Software") as specified in the agreement. This agreement specifically does not grant you any rights to patents, copyrights, trade secrets and trademarks. 1.4.2 Runtime You may distribute the Software in your executable programs without any additional license from Touchstone provided that no part of the software can be separated in whole or in part from your executable program. You may not distribute the Software as part of a Runtime Link Library ("RTL"), a Dynamic Link Library ("DLL") or a similar runtime system. 1.4.3 Copyright You acknowledge and agree that the Software (including permitted copies) is owned by Touchstone and its suppliers. This Software is protected by United States copyright law and international treaty provisions. You agree to safeguard the Software as copyrighted material. 1.4.4 Permitted Use You may use the Software on a single computer or terminal at a time. Each user of the Software must have their own licensed copy. Provided the copy is exact (including copyright notices and serial numbers) you may make copies of the diskette(s) for backup or achival purposes only. We recommend that you do this. In addition you may transfer one copy of the information on the diskette(s) to a single hard disk provided that you keep and use the original diskette(s) solely for backup or archival purposes. You may transfer your rights under this agreement on a permanent basis provided that you transfer all the Software and the recipient agrees to the terms of this agreement. Any transfer must include the most recent update and all prior versions. Transfer of out-of-date or obsolete versions of the software is expressly prohibited. 1.4.5 Restrictions on use You may not network the Software or otherwise use it on more than one computer or terminal at the same time. You may not loan, sublicense, rent, lease, sublease, or otherwise transfer any right to use the Software. You may not make copies of the Software, or any portion thereof, except as specifically provided in this agreement. You may not reproduce, transmit, transcribe, store in a retrieval system, or translate into any language the Software or any part thereof. You may not, under any circumstances, copy the documentation supplied with the Software. You may not disassemble, decompile, reverse engineer or create derivative works based on the software or any portion therof. You acknowledge that the structure and organization of the Software are the valuable trade secrets of Touchstone. You agree to hold such trade secrets in confidence. Page 1-2 1.4.6 Limited warranty The software is provided "as is" and without warranty of any kind. Touchstone does warrant the diskette(s) on which the Software is recorded shall be free from defects in materials and workmanship under normal use and service for a period of thirty days from date of delivery of this package as evidenced by a copy of your receipt. To execise your rights under this warranty you must return the defective material to Touchstone at your expense within the warranty period or first notify Touchstone in writing within the warranty period that you have found a defect and return the material immediately thereafter to Touchstone at your expense. Touchstone's liability and your exclusive remedy and sole measure of recoverable damages under the foregoing warranty for any diskettes which are determined to be defective shall be, at Touchstones options (1) return of the price paid, or (2) repair or replacement of the defective materials. In the event of replacement of a diskette, the replacement will be warranted for the remainder of the thirty days or fourteen days, whichever is longer. THIS WARRANTY AS SET FORTH ABOVE IS THE ONLY WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, ORIGINALITY OR FITNESS OF A PARTICULAR PURPOSE. 1.4.7 Limitation of liability NEITHER TOUCHSTONE NOR ANYONE WHO HAS BEEN INVOLVED IN THE CREATION, PRODUCTION, OR DELIVERY OF THE SOFTWARE SHALL BE LIABLE FOR ANY LOST PROFITS OR ANY INCIDENTAL, INDIRECT, CONSEQUENTIAL, EXEMPLARY OR SPECIAL DAMAGES OR COSTS (INCLUDING LEGAL EXPENSES, OR LOSS OF GOODWILL) ARISING OUT OF OR RELATING TO THE USE OF, THE RESULTS OF, OR THE INABILITY TO USE THE SOFTWARE, EVEN IF TOUCHSTONE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR CLAIM. 1.4.8 Indemnity You agree to indemnify and defend Touchstone from and against any and all claims, suits, damages, and expenses (including legal expenses) brought against or suffered by Touchstone Business Creations as a result of and failure or malfunctions of an application within which or into which you have compiled or incorporated the Software and/or the Software runtime modules. 1.4.9 US Government Restricted Rights The Software and documentation are supplied with restriced rights. Use, duplications or a disclosure by the Government is subject to restrictions as set forth in subparagraph (c) (1) (ii) of the rights in Technical Data and Computer Software Clause at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the Commercial Computer Software - restricted Rights at 48 CFR 52.227-19, as applicable. Contractor/manufacturer is Touchstone Business Creations, 28613 River Glen Ct. #1, Menifee, CA 92584-8987. 1.4.10 Updates Touchstone reserves the right, at its sole discretion, to change, modify or update the Software at any time without the obligation of notifying anyone. Touchstone reserves the right to offer updates to the Software either free of charge or for an additional charge. In order to be eligible to obtain updates or information on updates you must complete and return the supplied registration card to Touchstone. Page 1-3 1.5 Programming 1.5.1 Easiest Use (SET KEY ... TO CALCULATOR) #include "inkey.ch" Function Test() CALCREG(00000) //insert your registration number SET KEY K_ALT_O TO CALCULATOR //this is all you need nValue := 0 @ 5,5 Get nValue Read //while in read, press ALT_O for the calculator Return NIL First, the above example sets your registration number (once you receive it from Touchstone Business Creations). Then, it sets the key K_ALT_O to call the CALCULATOR function when it is in a wait state (i.e. READ, MENU TO, MEMOEDIT, etc). Once you are in any wait state (until you choose to turn it off), pressing ALT_O will call up the calculator function. If you are on a numeric value at the time, it will become the display in the calculator. When finished calculating, you may press CTRL_ENTER and transfer or paste the value back into where you were editing. 1.5.2 Adding Keys ( SetKey(... , {||...}) ) Adding keys are useful for any type of specific calculations. nTax := 1.0775 SetKey(K_ALT_T, {|cProc,nVer,cVar,nVal| ; If(c1="CALCULATOR",nVal*nTax,NIL)}) For example, the above two lines can be added anywhere in the code prior to using the calculator. While using it, you can press ALT_T and the current calculator value will be multiplied by (nTax) giving you the price with tax immediately in the display as your current calculated value. You can also be specific about the variables you use keys upon: nTax := 1.0775 SetKey(K_ALT_T, {|cProc,nVer,cVar,nVal| ; If(c1="CALCULATOR" .and. Upper(cVar)="SUBTOTAL",; nVal*nTax,NIL)}) For example, the above two lines will verify (1) that we are operating from the calculator, and (2) the variable that the calculator was called from was named "SUBTOTAL". Once those are true, the calculator value will be multiplied by (nTax) giving you the price with tax. SEE "CALCULATOR()" information for more. Page 1-4 1.6 Linking CALC.LIB Library CALC.LIB - This is the library that contains all the calculator and supporting functions. It can be *COMPLETELY* overlayed. When prelinking, use the REFER names of "CALC15" and "NUMLOCK". Linking (Non-overlaid use) Microsoft: LINK , , , + CALC Borland: TLINK , , , + CALC Blink, Inc: Blinker FI LIB CALC Pocket Soft: RTLink FI LIB CALC Linking (Overlaid use) When overlaying with Blinker, the following sample script file can be used: FILE BEGIN FILE ALLOCATE CALC END LIB CLIPPER, TERMINAL, DBFNTX Page 1-5 1.7 Credits The Professional Calculator for Clipper (tm) was written and produced by Jim Gale of Touchstone Business Creations. The CALC and all included functions are written entirely in Clipper 5.01; however, one additional function has been added to the CALC.LIB taken from the public domain library called NANFOR.LIB. The function is FT_NUMLOCK() which allows CALC to get/set the status of the numlock. This is written in C and was added to CALC.LIB under the same name to prevent function duplication for developers who use NANFOR.LIB. Incidentally, this function can also be completely overlayed. Thanks to Ted Means for his donation of FT_NUMLOCK() to NANFOR.LIB and to Glenn Scott for the production of NANFOR.LIB. Also, special thanks to the current users of CALC that have sent in their requests for desired abilities. 1.8 Changes The Professional Calculator for Clipper (tm) Rev 1.0 - 5/91 Initial release tested on CompuServe Rev 1.1,1.2 - 6/91 Bug fixes Rev 1.3 - 6/91 Clean version with DOUBLE lines in calculator with NG file. Rev 1.4 - 9/91 Changed to SINGLE lines for international compat. Rev 1.5 - 9/92 Added positioning CalcPos(), code block exception handling, CalcMemory() to access memory directly, paper scrolling, better NG docs. Rev 1.51 - 4/93 Changed Address/Phone, Compiled under Clipper 5.2 Rev 1.6 - 4/93 Added Network Printing functions CalcPrint() and CalcPTape(). Calc also compiled under 5.2. ** ALL REGISTRATIONS OF PREVIOUS REVISIONS WORK AUTOMATICALLY WITH THE NEWEST REVISIONS ** Revision 1.5 represents a significant change over 1.4 in the respect that you, the programmer, have more power to control your calculator environment. Users have been asking for calculator positioning, and paper scrolling which have been added; however, additional capabilities such as the code block exception handler (CalcUDF()) allow tremendous capabilities from within the calculator. ** YOUR REGISTRATION OF 1.6 WILL WORK FOR ADDITIONAL REVISIONS ** Page 1-6 1.9 Coming Attractions! ** COMING REALLY REALLY SOON ** Other products to be released soon are: SciCalc() -full-featured scientific calculator with trig and full trig functions you may call in your programs. Calendar() -pop-up full-featured calendar, scroll through days, months, years, see and set holidays, calculate no. of work days, and upon pressing Ctrl-Enter transfers date back to date field. * Please express your interest and specific wishes for these and other products. MUCH MORE! Register to receive all notices & updates! ** REGISTERED USERS OF CALC WILL RECEIVE DISCOUNTS TOWARDS ** ** ANY OTHER TOUCHSTONE BUSINESS CREATIONS PRODUCT ** Page 1-7 2.1 Usage Assuming that you have written a program, such as a sample program included in this package, DEMO and DEMO2, you must compile and link as follows (included in DEMO.rmk) rmake demo and rmake demo2 2.2 Running Demo The program begins with three variables, two numeric and one character. To begin a calculation, press F5. The current value transferred into the calculator. To receive calculator help, press H. When finished with your calculation, either press Esc to exit, or Ctrl-Enter to paste the result back to the field. Detailed information is available in the following reference pages. 2.3 Functions The following calculator functions are formatted in the standard form as set by the Clipper manual. This allows you to print these pages and place them with your manual. The following pages are a reference to the functions available in CALC. Page 2-1 Name CALCULATOR() Purpose On-screen Full-Function Calculator Syntax CALCULATOR( [,] [] ) -> nResult Arguments is a numeric value which becomes the initial value to display in the calculator. Defaults to zero, unless called from a READMODAL numeric variable. is a logical value; if set to true, will attempt to grab from a numeric variable (if called from one) and will paste if exited by pressing Ctrl-Enter. If, however, you have reason to prevent the numeric grabbing and the paste-back, set it to false. Defaults to whether (1) called from a numeric variable or (2) a numeric value was passed in . Returns A numeric result of the calculations. If the user presses Ctrl-Enter to exit the Calculator, the keyboard will also be stuffed with the result. Description At its most basic use (SET KEY ... TO CALCULATOR) the calculator will pop up on screen (with a numeric if called from a get) allowing calculations, percentages, parenthesized calculations, memory (static), printing, fixed decimals, and a help screen. When pressing Ctrl-Enter to exit, it will paste the result to your variable. In its more advanced use, you may set keys to do your own special functions and calculations (SET KEY K_F9 TO FINANCIAL), or train the calculator to search for and change to a separate color scheme, or call a special procedure before entering the calculator, or call the calculator as a function and return the result. Requirements You must call CalcReg( ) to bypass the copyright screen. SEE CALCREG() Page 2-2 Examples * Example 1 #include "inkey.ch" CalcReg(12345) // example registration number Set Key K_ALT_O to Calculator n1:=5 c1:=Space(8) @ 5,5 Get n1 @ 6,5 Get c1 READ // press ALT_O for calculator *------------------------* * Example 2 #include "inkey.ch" CalcReg(12345) // F5 will multiply n by 2 and return it (from calculator) SetKey(K_F5,{|p,l,v,n| If( p="CALCULATOR", n*2, NIL ) }) // F6 will automatically keyboard any character returns, // in this case, setting fixed decimals to 2 SetKey(K_F6,{|p| If( p="CALCULATOR", "F2", NIL) }) // F1 will call the calculator's help SetKey(K_F1,{|p| If( p="CALCULATOR", "H", NIL) }) nResult := Calculator(5) // pops up with a 5, returns a result Notes (FOR ADVANCED USE) SETKEY PROCEDURES When it calls your set key procedure, it will pass five parameters: þ Procedure name (always CALCULATOR) þ Version number (always 13 in version 1.3) þ The variable name when the Calculator hotkey was pressed or NIL þ Numeric representation of the current display þ Character representation of the current display Page 2-3 When you return a result, it may be numeric, character, or other: þ If you return a numeric, it will become the current display þ If you return a character, it will be "keyboarded" as if the user typed it himself (be aware of your current SET TYPEAHEAD) þ If you return any other value, it will be ignored Keys Available: KEY OPERATION þ 0-9 (standard numeric keys) þ +,-,/,* (standard arithmetic keys) þ % Perform percentage calculation þ ( Begin a sub-calculation (may be nested) þ ) End a sub-calculation þ = End a calculation (and all sub-calculations) þ[Enter] End a calculation (and all sub-calculations) þ[Bksp] backup, erase last keystroke þ AC Clear all (except memory) þ C Clear Entry þ H Display calculator help. þ P Toggle printing; if printing is used, upon exit of the calculator, a form feed will occur. þ F n Set fixed decimals to (n). 0-9 to fix, other key for floating point. þ M+ Add to memory (static - will keep throughout program) þ M- Subtract from memory þ M* Multiply to memory þ M/ Divide into memory þ MR Recall memory þ MC Clear memory þ [Ctrl-Left / Ctrl-Right] Move Calculator þ [Esc] Exit calculator (do not paste) þ [Ctrl-Enter] Exit calculator (PASTE RESULT TO FIELD) (applicable when called from a variable, or when first parameter is numeric and second parameter is true) Files: CALC.LIB See Also: CALCREG() CALCINIT() Author: Touchstone Business Creations CompuServe ID: 73670,2561 28613 River Glen Ct. #1 Menifee, CA 92584-8987 (909) 679-3364 Owner : (c) Copyright, 1991, Touchstone Business Creations. Page 2-4 Name CALCREG() Purpose To Register the On-screen Full-Function Calculator Syntax CALCREG( ) -> NIL Arguments is a numeric value representing your registration number. This function will bypass the copyright screen on initial use of the calculator. Returns CALCREG() always returns NIL Description Use CALCREG() to register your calculator and prevent the copyright message from appearing on the initial call to the calculator. Requirements You must have a valid registration number. You may obtain one from Touchstone Business Creations, 28613 River Glen Ct. #1, Menifee, California 92584 USA. The phone number is (909) 679-3364. Examples CalcReg(12345) Files: CALC.LIB See Also: CALCULATOR() CALCINIT() Author: Touchstone Business Creations CompuServe ID: 73670,2561 28613 River Glen Ct. #1 Menifee, CA 92584-8987 (909) 679-3364 Owner : (c) Copyright, 1991, Touchstone Business Creations Page 2-5 Name CALCINIT() Purpose To set the calculator colors or a set of colors to recognize and replace. Syntax CALCINIT( [] ) -> NIL Arguments may be a character color value, an array of colors, or other data type. Defaults to NIL (automatically setting the colors to "W+/B" on a color adapter) Returns CALCINIT() always returns NIL Description You may use CALCINIT() to set the calculator colors or to search and replace set of colors, or to default to current colors. Regarding the parameter : þ If it is a character color value, it must be in the standard color format (i.e. "W+/R") (SEE EXAMPLE 1) þ If it is an array, it must be two dimensional, the first to search and match the current colorset (it must contain one comma); the second to set the color upon finding a match (SEE EXAMPLE 2) þ If it is NIL (the default), it will set the calculator colors to "N/W" (SEE EXAMPLE 3) þ If it is any other data type (such as logical), it will keep the colors that it was called with (SEE EXAMPLE 4) Examples ** Example 1 - character parameter CALCINIT( "W+/R" ) // calculator will now operate as white on blue Calculator() Page 2-6 ** Example 2 - array aColors := { {"W+/N," , "N/W" } ,; //color must include comma {"R+/B," , "B+/R"} ,; {"" , "W/N" } } //all non-matched colors // will match with "" CalcInit( aColors ) The above example will (upon calling the calculator), check the current color against "W+/N," and, if found, set the color to "N/W". If not, will compare against "R+/B," and, if found set the color to "B+/R". If neither is found, the "" will be matched and the color set to "W/N". ** Example 3 - NIL (default) CalcInit(NIL) // or never issuing a CalcInit() SetColor("W/R") Calculator() // this will operate the calculator in the default // color of W+/B ** Example 4 - other, (logical) CalcInit(.T.) SetColor("W/R") Calculator() // this will operate the calculator in W/R Files: CALC.LIB See Also: CALCPOS() CALCUDF() CALCULATOR() CALCREG() Author: Touchstone Business Creations CompuServe ID: 73670,2561 28613 River Glen Ct. #1 Menifee, CA 92584-8987 (909) 679-3364 Owner : (c) Copyright, 1991,92,93 Touchstone Business Creations Page 2-7 Name CALCPOS() Purpose To get/set the calculator initial screen position. Syntax CALCPOS( [] ) -> aOldPosition Arguments is an optional array parameter containing {,}. If you specify an empty array ({}), CALCPOS() will default the calculator position to the following: Defaults to {} (automatically setting the position to a row of MaxRow()-12, and the column to 0 if your cursor is >=40 or to MaxCol()-24 if your cursor is <40). Returns CALCPOS() returns the current CALCPOS() array setting of {,}. Description You may use CALCPOS() to get/set the calculator initial screen position. Regarding the parameter : þ If it is an empty array (the default), it will set the row to MaxRow()-12, and the column to 0 if your current screen cursor position is greater than or equal to 40, or to MaxCol()-24 if your cursor is less than 40. ( i.e. CALCPOS({}) ) Page 2-8 Examples ** Example 1 - array with positions //Positions the initial display of //the calculator at MaxRow()-13,4. aOldPos := CALCPOS( MaxRow()-13, 4 ) Calculator() ** Example 2 - empty array aOldPos := CALCPOS( {} ) Calculator() Defaults the row to MaxRow()-12 and the col to If( Col() > (MaxCol()+1)/2, 0, MaxCol()-24 ) Files: CALC.LIB See Also: CALCINIT() CALCUDF() CALCULATOR() CALCREG() Author: Touchstone Business Creations CompuServe ID: 73670,2561 28613 River Glen Ct. #1 Menifee, CA 92584-8987 (909) 679-3364 Owner : (c) Copyright, 1991,92,93 Touchstone Business Creations Page 2-9 Name CALCUDF() Purpose To get/set the calculator key handler block. Syntax CALCUDF( [], [] ) -> bOldCalcUDF Arguments is an optional block parameter containing a code block to evaluate upon (0) initialization, (1) operational keys, (2) keyboard exceptions, and (3) termination. DEFAULTS TO NIL. is an optional logical parameter denoting whether to call the code block upon operational keys (i.e. not only keyboard exceptions). DEFAULTS TO FALSE. Returns CALCUDF() returns the current CALCUDF() code block. Description You may use CALCUDF() to get/set the calculator key handler block. Regarding the code block (If it is not NIL): þ Will be evaluated with 7 parameters: þ Procedure name (always CALCULATOR) þ Version number (always 16 in version 1.6) þ The variable name when the Calculator hotkey was pressed or NIL þ Numeric representation of the current display þ Character representation of the current display þ Numeric mode (0=initialization call, 1=a key was pressed, 2=key exception, 3=termination) þ Character representation of the current calculator color þ Numeric representation of the last key pressed (valid for mode #1 and 2 only) (same as LastKey()) þ Will send as the 6th parameter the numeric mode: 0 = called upon entering the calculator (best time to set up your own help screen for your keys) 2 = called upon a key exception (a key not recognized by the calculator operation and no setkey exists) 3 = called upon exiting the calculator (best time to take down your help) (If is true, then mode 1 will be called, else if will not be called): 1 = called upon any keypress in the calulator, prior to executing any operation that the key represents Page 2-10 þ Return Values of the code block (The following applies to mode 0, 1, and 2 only - not 3): þ If your code block returns a TRUE, the calcuator will immediately return without further processing. þ If your code block returns a NUMERIC, the calculator will display the numeric as the last result of the calculator. þ If your code block returns a CHARACTER, it will be "keyboarded" into the calculator as if the user had typed it him/herself (Be aware of the current SET TYPEAHEAD). þ Any other data type will be ignored and processing will continue normally. Examples ** Example Function Test() //Sets the UDF to call during the calculator // but (.F.) do not call with ALL keys bOldUDF := CALCUDF( {|x1,x2,x3,x4,x5,x6,x7,x8| ; MyCalcUDF(x1,x2,x3,x4,x5,x6,x7,x8) } , .F. ) Calculator() RETURN NIL Function MyCalcUDF(cProc,nVer,cVar,nValue,cValue,nMode,cColor,nKey) Local xRetCode := .F. //continue normally Do Case Case nMode = 0 //Initialization call //put up extra help menu for *MY* keys & save screen Case nMode = 3 //Termination call //take down my help screen Case nMode = 2 //Key Exception call Do Case Case nKey == K_ALT_F2 //my Square Root xRetCode := SQRT(nValue) Case nKey == K_ALT_T //my add tax key! xRetCode := nValue * 1.0775 Case nKey == "~" //my sign reverse key! xRetCode := -nValue Case nKey == K_ALT_M //my memory counter key! CalcMemory( CalcMemory()+1 ) Endcase Endcase Return xRetCode Page 2-11 * NOTE * (When initially entering the calculator, or during keyboard calls): þ If your code block returns a TRUE, it will immediately abandon the calculator without further processing. þ If your code block returns a NUMERIC, the calculator will display the numeric as the last result of the calculator. þ If your code block returns a CHARACTER, it will be "keyboarded" into the calculator as if the user had typed it him/herself (Be aware of the current SET TYPEAHEAD). þ Any other data type will be ignored and processing will continue normally. This NOTE does not apply to the call when exiting the calculator. Files: CALC.LIB See Also: CALCPOS() CALCINIT() CALCULATOR() CALCREG() Author: Touchstone Business Creations CompuServe ID: 73670,2561 28613 River Glen Ct. #1 Menifee, CA 92584-8987 (909) 679-3364 Owner : (c) Copyright, 1991,92,93 Touchstone Business Creations Page 2-12 Name CALCMEMORY() Purpose To get/set the calculator static memory. Syntax CALCMEMORY( [] ) -> nOldMemory Arguments is an optional numeric parameter containing the new value for the calculator memory functions (M+,M-,M*,M/,MR,MC). Returns CALCMEMORY() returns the current static memory value. Description You may use CALCMEMORY() to get/set the calculator static memory value. Examples ** Example - adding to memory all sales //upon pressing ALT_M, the value+tax will be added to memory. SetKey(K_ALT_M,{|cProc,n1,c1,nValue| ; If(cProc="CALCULATOR",CalcMemory( CalcMemory() + (nValue * 1.0775) ),NIL)}) Calculator() Files: CALC.LIB See Also: CALCULATOR() Author: Touchstone Business Creations CompuServe ID: 73670,2561 28613 River Glen Ct. #1 Menifee, CA 92584-8987 (909) 679-3364 Owner : (c) Copyright, 1991,92,93 Touchstone Business Creations Page 2-13 Name CALCPRINT() Purpose To get/set the calculator printing status. Syntax CALCPRINT( [] ) -> nOldStatus Arguments is an optional numeric parameter containing the new printing status. If you specify 0, all printing will occur normally. (When "Printing" is turned on, all lines will be printed as they are entered). If you specify 1, all printing will be held until you exit the calculator - then all lines will be printed at once. If you specify 2, all calculator printing will be held during the entire execution of the application. You must then specify CalcPrint(-1) to force a print, or CalcPrint(-2) to cancel a print, or CalcPrint(1) to allow the calculator to print all lines at the end of the next use. If you specify 3, all printing will be suspended, and not kept in memory. Defaults to 0 if no network is detected, or 1 is a network is detected. Returns CALCPRINT() returns the current CALCPRINT() printing status. Page 2-14 Description * NOTE * Printing must be turned on by user pressing the "P" key during use for any printing to occur. You may use CALCPRINT() to get/set the calculator printing status. Regarding the parameter : þ If it is 0, all printing will occur normally. After the user presses "P" to begin printing, each line will be sent to the printer whenever the paper scrolls. ^B(NON-NETWORK DEFAULT)^B þ If it is 1, all printing will be held until the user exits the calculator. At that time, all lines (during that specific use of the calculator) will be printed. The tape is then purged and recording starts again at the next iteration. ^B(NETWORK DEFAULT)^B þ If it is 2, all printing will be held throughout the execution of the application regardless of how many times the user enters and exits the calculator. To affect printing while in this status, you may: þ Call CALCPRINT(-1) with the -1 parameter: This will force a print of the tape and purge it for the next or current use. þ Call CALCPRINT(-2) with the -2 parameter: This will purge the tape for the next or current use. þ Call CALCPRINT(1) with the 1 parameter: This will 'tell' the Calculator to print the tape at the end of the next or current use of the calculator. * NOTE * The current CALCPRINT() status DOES NOT CHANGE if you call it with a -1 or -2. For example, if you first issue CalcPrint(2) and later print the tape by issuing CalcPrint(-1), if you then print the status ( ? CalcPrint() ), it will return a 2. * NOTE * Although highly unlikely, if the length of the calculator tape exceeds 32,000 characters, it will cease to record further lines until purged. Page 2-15 Examples ** Example - adding to memory all sales //upon pressing ALT_M, the value+tax will be added to memory. SetKey(K_ALT_M,{|cProc,n1,c1,nValue| ; If(cProc="CALCULATOR",CalcMemory( CalcMemory() + (nValue * 1.0775) ),NIL)}) Calculator() Files: CALC.LIB See Also: CALCPTAPE() Author: Touchstone Business Creations CompuServe ID: 73670,2561 28613 River Glen Ct. #1 Menifee, CA 92584-8987 (909) 679-3364 Owner : (c) Copyright, 1991,92,93 Touchstone Business Creations Page 2-16 Name CALCPTAPE() Purpose To get/set the calculator printing tape. Syntax CALCPTAPE( [] ) -> nOldTape Arguments is an optional character parameter containing the new printing tape. * NOTE * This IS NOT the scrolling tape found at the top of the calculator. This IS the tape accumulated by using a CALCPRINT(2) or CALCPRINT(1) printing status (See CALCPRINT). Returns CALCPTAPE() returns the current calculator printing tape. (This tape will be printed according to the current CALCPRINT printing status). Description * NOTE * Printing must be turned on by user pressing the "P" key during use for any printing to occur. You may use CALCPTAPE() to get/set the calculator printing status. Regarding the tape: þ Each line is separated by a CRLF combination. þ Each iteration (use) of the calculator is separated by a Chr(12) Eject character. þ CALCPRINT(-1) forces a complete print and purge of the tape. þ CALCPRINT(-2) purges the tape. * NOTE * Although highly unlikely, if the length of the calculator tape exceeds 32,000 characters, it will cease to record further lines until purged. Page 2-17 Examples ** Example 1 - Adding a Header CalcPrint(1) //hold printing throughout use of the calculator. //Holds a header CalcPTape("Calculator 1.6 (c) Touchstone"+Chr(13)+Chr(10)) Calculator() // (printing is performed upon escape or exit) ** Example 2 - Print Tape Later CalcPrint(2) //hold printing until further commands change it Calculator() // (nothing is printed) ... //Adds a footer to the tape CalcPTape( CalcPTape()+" --- from Touchstone "+Chr(13)+Chr(10) ) //Prints the complete tape (with footer) CalcPrint(-1) Files: CALC.LIB See Also: CALCPRINT() Author: Touchstone Business Creations CompuServe ID: 73670,2561 28613 River Glen Ct. #1 Menifee, CA 92584-8987 USA (909) 679-3364 Owner : (c) Copyright, 1991,92,93 Touchstone Business Creations Page 2-18 ORDER FORM Make and send CHECK or MONEY ORDER payable to: TO: Touchstone Business Creations 28613 River Glen Ct. #1 Menifee, CA 92584-8987 U.S.A. (909) 679-3364 CompuServe #: 73670,2561 From: Full Name: ____________________________________ Company Name (if any): ____________________________________ Street Address: ____________________________________ City, State, Zip: ____________________________________ Country: ____________________________________ VOICE Phone: ____________________________________ FAX Phone: ____________________________________ CompuServe #: ____________________________________ Desired Registration & Disk: CALC ver 1.6 Registration only: $59.95 x Qty____ = $_____ CALC next version automatic UPGRADE: $39.95 x Qty____ = $_____ (adding this amount will guarantee your receiving the next version immediately when available) (INCLUDES DISK AND SHIPPING) OFFER ONLY VALID WITH CALC VER 1.x REGISTRATION CALC Disk (if necessary) (SPECIFY TYPE) $7 $_____ circle one: 3 1/2" 5 1/4" California residents, add sales tax (Riverside County) $_____ (currently 7.75%) --------------------------- TOTAL Enclosed: $_____ When you register, we will send you your registration number to use in your program to inhibit the copyright notice. This will be a simple one sheet letter. If you require the disks sent to you, there is an additional $7 charge for postage, handling and material (listed above). Page 3-1