




 (c) Copyright 1991-94 Touchstone Business Creations, All rights reserved



                                      CALC

                  The Professional Calculator for Clipper (tm)
                                       by
                         Touchstone Business Creations



                                  Version 2.2

                                  January 1994



               (c) Copyright 1991-94 Touchstone Business Creations,
                              All rights reserved.






 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.x;
  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.

  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.









 Changes


   The Professional Calculator for Clipper (tm)

Version 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.

Version 2.0    - 10/93   Added Mouse Support, English/Spanish ability, and
                           Trigonometry functions.  Also tested and made
                           all functions protected mode compatible.

   Rev  2.1    - 12/93   Added CALCDEC()

   Rev  2.2    -  1/94   Added German.

 Registration Form


                                     ORDER FORM

     Make and send CHECK or MONEY ORDER payable to:


     TO:  Touchstone Business Creations
          28613 River Glen Ct. #1
          Menifee, CA 92584-8987
          (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 2.1 Registration only:          $69.95 x Qty____ =  $_____

     CALC Disk (if necessary) (SPECIFY TYPE)  $5                  $_____
      circle one:    3 1/2"    5 1/4"

     California residents, add sales tax for Riverside county     $_____
      (currently 7.75% - adjust if necessary)

                                              ---------------------------

     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 $5  charge for postage, handling and material (listed above).






 Purpose, Trademarks, Technical Support...


         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.x 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).






 License and Royalty Agreements


         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.

         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.







 Coming Attractions


         1.5 Coming Attractions!

              Other products to be released soon are:

         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.

         Demo & Security Library -make your executable as safe as
         can be from copy protection.  These methods are already being
         used in the industry.  Now you can have them in your program.

         Games Library -while your computer works (indexing, or
         report building), you can be playing games with your computer.
         These "extras" give your program a well-rounded feel.

         MUCH MORE!   Register to receive all notices & updates!

         * Please express your interest and specific wishes for these
           and other products. *

         ** REGISTERED USERS OF CALC WILL RECEIVE DISCOUNTS TOWARDS **
         **    ANY OTHER TOUCHSTONE BUSINESS CREATIONS PRODUCT      **


 Calculator Functions:


 CALCINIT()
 To set the calculator colors or a set of colors to recognize and replace.


 Syntax

      CALCINIT( [<caColors>] )  -> NIL

 Arguments

      <caColors> 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 <caColors>:

       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 red
        Calculator()





     ** 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/R


     ** Example 4 - other, (logical)

        CalcInit(.T.)

        SetColor("W/R")
        Calculator()        // this will operate the calculator in W/R



 Files: CALC.LIB

 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
   See Also: CALCPOS() CALCUDF() CALCULATOR() CALCREG()






 CALCPOS()
 To get/set the calculator initial screen position.


 Syntax

      CALCPOS( [<aPosition>] )  -> aOldPosition

 Arguments

      <aPosition> is an optional array parameter containing {<nRow>,<nCol>}.

      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 {<nRow>,<nCol>}.

 Description

      You may use CALCPOS() to get/set the calculator initial screen
      position.

      Regarding the parameter <aPosition>:

       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({}) )

 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

 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
   See Also: CALCINIT() CALCUDF() CALCULATOR() CALCREG()







 CALCDEC()
 To get/set the calculator predefined decimal positions.


 Syntax

      CALCDEC( [<nDecimals>] )  -> aOldDecimals

 Arguments

      <nDecimals> is an optional numeric parameter containing decimals
      to set for calculator operation.

      Defaults to -2 (automatically setting the decimals to whatever it
       receives through the get variable or the initialization parameter)

 Returns

      CALCDEC() returns the current CALCDEC() numeric setting.

 Description

      You may use CALCDEC() to get/set the calculator predefined decimal
      positions.

      Regarding the parameter <nDecimals>:

       In the range zero to nine (0-9), it will FIX the decimals to
        that number, regardless of how it was received.

       If it is a -1, it will FLOAT the decimals, regardless of how
        it was received.

       If it is a -2, it will be floating unless the received value
        contains a decimal position in which it will fix that position.
        (This is the default behavior)




 Examples

     ** Example 1 - set decimals to 2

        //Positions the calculator to two decimals

        nOldDec := CALCDEC( 2 )

        Calculator(1.23456)       //shows 1.23 only!


     ** Example 2 - set decimals to 0

        //Positions the calculator to no decimals

        nOldDec := CALCDEC( 0 )

        Calculator(1.23456)       //shows 1 only!


     ** Example 3 - set decimals to FLOATING

        //Positions the calculator to floating decimal

        nOldDec := CALCDEC( -1 )

        Calculator(1.23456)       //shows 1.23456 without being fixed.


     ** Example 4 - set decimals to DEFAULT

        //Positions the calculator to default behavior

        nOldDec := CALCDEC( -2 )

        Calculator(1.23456)       //shows 1.23456 fixed!
        Calculator(1)             //shows 1       floating!



 Files: CALC.LIB

 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
   See Also: CALCULATOR()






 CALCUDF()
 To get/set the calculator key handler block.


 Syntax

      CALCUDF( [<bCalcUDF>], [<lAllKeys>] )  -> bOldCalcUDF

 Arguments

      <bCalcUDF> 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.

      <lAllKeys> 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 <bCalcUDF> (If it is not NIL):

       Will be evaluated with 7 parameters:

          Procedure name (always CALCULATOR)
          Version number (always 21 in version 2.1)
          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 <lAllKeys> 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

       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

     
      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

 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
   See Also: CALCPOS CALCINIT() CALCULATOR() CALCREG()






 CALCMEMORY()
 To get/set the calculator static memory.


 Syntax

      CALCMEMORY( [<nNewMemory>] )  -> nOldMemory

 Arguments

      <nNewMemory> 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

 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
   See Also: CALCULATOR()






 CALCPRINT()
 To get/set the calculator printing status.


 Syntax

      CALCPRINT( [<nNewStatus>] )  -> nOldStatus

 Arguments

      <nNewStatus> 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.

 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 <nNewStatus>:

       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.
        (NON-NETWORK DEFAULT)

       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.
        (NETWORK DEFAULT)

       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.

     

 Examples

     ** Example 1 - normal printing (line by line)

        CalcPrint(0)  //print each line as received
        Calculator()




     ** Example 2 - hold printing until end of each calculator use

        CalcPrint(1)  //hold until end of calculator
        Calculator()  // (prints at end)

     ** Example 3 - hold printing indefinitely

        CalcPrint(2)  //hold printing until further commands change it
        Calculator()  // (nothing is printed)

        ...

        CalcPrint(-1) //forces a complete print of all calculator uses
     or CalcPrint(-2) //purges print tape in memory.

 Files: CALC.LIB

 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
   See Also: CALCPTAPE






 CALCPTAPE()
 To get/set the calculator printing tape.


 Syntax

      CALCPTAPE( [<cNewTape>] )  -> nOldTape

 Arguments

      <nNewTape> 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.

     

 Examples

     ** Example 1 - Adding a Header


        CalcPrint(1)  //hold printing throughout use of the calculator.

        //Holds a header
        CalcPTape("Calculator 2.1 (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

 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
   See Also: CALCPRINT






 CALCREG()
 To Register the On-screen Full-Function Calculator


 Syntax

      CALCREG( <nRegisteration> )  -> NIL

 Arguments

      <nRegisteration> 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

 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
   See Also: CALCULATOR() CALCINIT()






 CALCLANGUAGE()
 To Change the Calculator Language (ENGLISH/SPANISH/GERMAN)


 Syntax

      CALCLANGUAGE( <cNewLanguage> )  -> cOldLanguage

 Arguments

      <cNewLanguage> is a character value representing the language
      for the calculator to begin using whenever the next screens popup.

      NOTE: Only the first three letters of the passed parameter are
      used.

      Currently, the only valid values are:

          "ENG" (English)
      and "SPA" (Spanish)
      and "GER" (German)

 Returns

      CALCREG() returns the current language (either ENGLISH or SPANISH or
       GERMAN)

 Description

      Use CALCLANGUAGE() to set the language of the calculator for the
      help screen, printer messages, error messages, and other necessary
      keywords for complete calculator use.

      You can change the language at any time during use of the calculator.
      The messages *ALREADY ON-SCREEN* will not change. You need to cause
      the calculator to redisplay or exit and reenter.  For this reason,
      we suggest changing languages prior to calling the calculator.

 Advanced Notes

      If you wish to change the language *WHILE* using the calculator,
      there is a right way and wrong way to do it...

      The wrong way:

          SetKey(K_ALT_S, {|| CalcLanguage("SPA") })
          SetKey(K_ALT_E, {|| CalcLanguage("ENG") })
          SetKey(K_ALT_G, {|| CalcLanguage("GER") })

          This will fail because the function CalcLanguage() returns the

          of "SPANISH" or "ENGLISH".  Since the function was called from
          within the calculator... it will try to 'keyboard' the result
          into the calculator causing problems.





      The right way:

          SetKey(K_ALT_S, {|| CalcLanguage("SPA"),"" })
          SetKey(K_ALT_E, {|| CalcLanguage("ENG"),"" })
          SetKey(K_ALT_G, {|| CalcLanguage("GER"),"" })

          This will return a null string for the calculator to ignore.

 Examples

      CalcReg(12345)            //register your calculator

      CALCLANGUAGE( "SPANISH" ) //choose Spanish

      Calculator()              //call the calculator (or hotkey it)

 Files: CALC.LIB

 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
   See Also: CALCULATOR()






 CALCULATOR()
 On-screen Full-Function Calculator


 Syntax

    CALCULATOR( [<nInitialValue>,] [<lAutoGrabAndPaste>] )  -> nResult

 Arguments

    <nInitialValue> is a numeric value which becomes the initial value
      to display in the calculator.
      Defaults to zero, unless called from a READMODAL numeric variable.

    <lAutoGrabAndPaste> 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 <nInitialValue>.

 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( <nRegistration> ) to bypass the copyright screen.
      SEE CALCREG()


 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 21 in version 2.1)
          The variable name when the Calculator hotkey was pressed or NIL
          Numeric representation of the current display
          Character representation of the current display

         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

 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.
   See Also: CALCREG() CALCINIT() CALCPOS() CALCUDF() CALCMEMORY()

 Trigonometrical Functions:







 SIN()
 To return the SINE of a degree.


 Syntax

      SIN( <nDegree> ) -> nSin

 Arguments

      <nDegree> is a numeric value representing a degree value.

 Returns

      SIN() returns the sine value of <nDegree>.

 Description

      SIN() is a trigonometrical function that returns the sine value of
      a degree.

      For radians, see SINR().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( SIN(45), 11,  9)  // returns 0.707106781
      ? Str( SIN(60), 11,  9)  // returns 0.866025403

 Files: CALC.LIB

 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
   See Also: SINR() COS() TAN() ASIN() SEC()






 SINR()
 To return the SINE of a radian.


 Syntax

      SINR( <nRadian> ) -> nSin

 Arguments

      <nRadian> is a numeric value representing a radian value.

 Returns

      SINR() returns the sine value of <nRadian>.

 Description

      SINR() is a trigonometrical function that returns the sine value of
      a radian.

      For degrees, see SIN().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      nPI := PI()                  // returns 3.141592653589792
      ? Str( SINR(nPI/2), 11,  9)  // returns 1.000000000
      ? Str( SINR(nPI), 11,  9)    // returns 0.000000000

 Notes



 Files: CALC.LIB

 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
   See Also: SIN() COSR() TANR() ASINR() SECR()






 COS()
 To return the COSINE of a degree.


 Syntax

      COS( <nDegree> ) -> nCos

 Arguments

      <nDegree> is a numeric value representing a degree value.

 Returns

      COS() returns the cosine value of <nDegree>.

 Description

      COS() is a trigonometrical function that returns the cosine value of
      a degree.

      For radians, see COSR().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( COS(45), 11,  9)  // returns 0.707106781
      ? Str( COS(60), 11,  9)  // returns 0.500000000

 Files: CALC.LIB

 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
   See Also: COSR() SIN() TAN() ACOS() CSC()






 COSR()
 To return the COSINE of a radian.


 Syntax

      COSR( <nRadian> ) -> nCos

 Arguments

      <nRadian> is a numeric value representing a radian value.

 Returns

      COSR() returns the cosine value of <nRadian>.

 Description

      COSR() is a trigonometrical function that returns the cosine value of
      a radian.

      For radians, see COS().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      nPI := PI()                  // returns  3.141592653589792
      ? Str( COSR(nPI/2), 12,  9)  // returns  0.000000000
      ? Str( COSR(nPI), 12,  9)    // returns -1.000000000

 Files: CALC.LIB

 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
   See Also: COS() SINR() TANR() ACOSR() CSCR()






 TAN()
 To return the TANGENT of a degree.


 Syntax

      TAN( <nDegree> ) -> nTan

 Arguments

      <nDegree> is a numeric value representing a degree value.

 Returns

      TAN() returns the tangent value of <nDegree>.

 Description

      TAN() is a trigonometrical function that returns the tangent value of
      a degree.

      For radians, see TANR().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( TAN(45), 11,  9)  // returns 1.000000000
      ? Str( TAN(60), 11,  9)  // returns 1.732050808

 Files: CALC.LIB

 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
   See Also: TANR() SIN() COS() ATAN() COT()






 TANR()
 To return the TANGENT of a radian.


 Syntax

      TANR( <nRadian> ) -> nTan

 Arguments

      <nRadian> is a numeric value representing a radian value.

 Returns

      TANR() returns the tangent value of <nRadian>.

 Description

      TANR() is a trigonometrical function that returns the tangent value of
      a radian.

      For radians, see TAN().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( TANR( 1), 12,  9)  // returns  1.557407725
      ? Str( TANR(-1), 12,  9)  // returns -1.557407725

 Files: CALC.LIB

 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
   See Also: TAN() SINR() COSR() ATANR() COTR()






 ASIN()
 To return the ARCSINE in degrees of a sine value.


 Syntax

      ASIN( <nSin> ) -> nDegree

 Arguments

      <nSin> is a numeric value representing a sine value.

      NOTE: Since a parameter of greater than 1 result in a math overflow,
            this function returns 0 as a result instead of a math overflow.

 Returns

      ASIN() returns the arcsine value (reverse sine) in degrees of <nSin>.

 Description

      ASIN() is a trigonometrical function that returns the arcsine value
      in degrees of a sine value.

      For radians, see ASINR().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( ASIN(.707106781), 5,  2)  // returns 45.00
      ? Str( ASIN(.866025403), 5,  2)  // returns 60.00

 Files: CALC.LIB

 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
   See Also: ASINR() ACOS() ATAN() SIN() SEC()






 ASINR()
 To return the ARCSINE in radians of a sine value.


 Syntax

      ASINR( <nSin> ) -> nRadian

 Arguments

      <nSin> is a numeric value representing a sine value.

      NOTE: Since a parameter of greater than 1 result in a math overflow,
            this function returns 0 as a result instead of a math overflow.

 Returns

      ASINR() returns the arcsine value (reverse sine) in radians of <nSin>.

 Description

      ASINR() is a trigonometrical function that returns the arcsine value
      in radians of a sine value.

      For degrees, see ASIN().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( ASINR(.707106781), 8,  6)  // returns 0.785398
      ? Str( ASINR(.866025403), 8,  6)  // returns 1.047198

 Files: CALC.LIB

 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
   See Also: ASIN() ACOSR() ATANR() SINR() SECR()






 ACOS()
 To return the ARCCOSINE in degrees of a cosine value.


 Syntax

      ACOS( <nCos> ) -> nDegree

 Arguments

      <nCos> is a numeric value representing a cosine value.

      NOTE: Since a parameter of greater than 1 result in a math overflow,
            this function returns 0 as a result instead of a math overflow.

 Returns

      ACOS() returns the arccosine value (reverse cosine) in degrees of
      <nCos>.

 Description

      ACOS() is a trigonometrical function that returns the arccosine value
      in degrees of a cosine value.

      For radians, see ACOSR().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( ACOS(.707106781), 5,  2)  // returns 45.00
      ? Str( ACOS(.866025403), 5,  2)  // returns 30.00

 Files: CALC.LIB

 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
   See Also: ACOSR() ASIN() ATAN() COS() SEC()






 ACOSR()
 To return the ARCCOSINE in radians of a cosine value.


 Syntax

      ACOSR( <nCos> ) -> nRadian

 Arguments

      <nCos> is a numeric value representing a cosine value.

      NOTE: Since a parameter of greater than 1 result in a math overflow,
            this function returns 0 as a result instead of a math overflow.

 Returns

      ACOSR() returns the arccosine value (reverse cosign) in radians of
      <nCos>.

 Description

      ACOSR() is a trigonometrical function that returns the arccosine value
      in radians of a cosine value.

      For degrees, see ACOS().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( ACOSR(.707106781), 8,  6)  // returns 0.785398
      ? Str( ACOSR(.866025403), 8,  6)  // returns 0.523599

 Files: CALC.LIB

 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
   See Also: ACOS() ASINR() ATANR() COS() SEC()






 ATAN()
 To return the ARCTANGENT in degrees of a tangent value.


 Syntax

      ATAN( <nTan> ) -> nDegree

 Arguments

      <nTan> is a numeric value representing a tangent value.

      NOTE: Since a parameter of greater than 1 result in a math overflow,
            this function returns 0 as a result instead of a math overflow.

 Returns

      ATAN() returns the arctangent value (reverse tangent) in degrees of
      <nTan>.

 Description

      ATAN() is a trigonometrical function that returns the arctangent value
      in degrees of a tangent value.

      For radians, see ATANR().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( ATAN(.707106781), 5,  2)  // returns 35.26
      ? Str( ATAN(.866025403), 5,  2)  // returns 40.89

 Files: CALC.LIB

 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
   See Also: ATANR() ASIN() ACOS() TAN() SEC()






 ATANR()
 To return the ARCTANGENT in radians of a tangent value.


 Syntax

      ATANR( <nTan> ) -> nRadian

 Arguments

      <nTan> is a numeric value representing a tangent value.

      NOTE: Since a parameter of greater than 1 result in a math overflow,
            this function returns 0 as a result instead of a math overflow.

 Returns

      ATANR() returns the arctangent value (reverse tangent) in radians of
      <nTan>.

 Description

      ATANR() is a trigonometrical function that returns the arctangent value
      in radians of a tangent value.

      For degrees, see ATAN().

      Accuracy is to the twelfth decimal (i.e. .00000000001)

 Examples

      ? Str( ATANR(.707106781), 8,  6)  // returns 0.615480
      ? Str( ATANR(.866025403), 8,  6)  // returns 0.713724

 Files: CALC.LIB

 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
   See Also: ATAN() ASINR() ACOSR() TANR() SECR()






 PI()
 To return the value of PI.


 Syntax

      PI() -> 3.141592653589792

 Arguments

      none

 Returns

      PI() returns the value of PI (3.141592653589792)

 Description

      PI() returns the value of PI which is used to convert from
      degrees to radians and back.

      Accuracy is to the fifteenth decimal (i.e. .00000000000001)

 Examples

      ? Str( PI(), 17,15)  // returns 3.141592653589792

 Files: CALC.LIB

 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
   See Also:






 FACTORIAL()
 To return the value of a factorial.


 Syntax

      FACTORIAL(<nInteger>) -> nFactorial

 Arguments

      <nInteger> is a numeric integer that is used to compute a factorial.

 Returns

      FACTORIAL() returns the value of a factorial

 Description

      A factorial value is the result of multiplying an integer by every
      integer below it.

      For example, the factorial of 6 is equal to (6*5*4*3*2*1 = 720).

 Examples

      ? Str( FACTORIAL(6), 5,0)  // returns   720

 Files: CALC.LIB

 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
   See Also:






 INVLOG()
 To return the value of an inverse logarithm.


 Syntax

      INVLOG(<nLog>) -> nValue

 Arguments

      <nLog> is a logarithmic value.

 Returns

      INVLOG() returns the value of an inverse logarithm.

 Description

      INVLOG() returns the value of an inverse logarithm.

 Examples

      ? Str( INVLOG(2), 5,0)  // returns   100

      Accuracy is beyond the twelfth decimal (i.e. .00000000001)

 Files: CALC.LIB

 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
   See Also:






 DTOR()
 To convert degrees to radians.


 Syntax

      DTOR(<nDegrees>) -> nRadians

 Arguments

      <nDegrees> is a numeric value representing degrees.

 Returns

      DTOR() returns the radian measure of nDegrees.

 Description

      DTOR() returns the radian measure of nDegrees.

 Examples

      ? Str( DTOR(180), 17, 15)  // returns 3.141592653589792

 Files: CALC.LIB

 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
   See Also:






 RTOD()
 To convert radians to degrees.


 Syntax

      RTOD(<nRadians>) -> nDegrees

 Arguments

      <nRadians> is a numeric value representing radians.

 Returns

      RTOD() returns the degree measure of nRadians.

 Description

      RTOD() returns the degree measure of nRadians.

 Examples

      ? Str( RTOD(PI()), 3, 0)  // returns 180

 Files: CALC.LIB

 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
   See Also:






 SIGN()
 To return the sign of a number.


 Syntax

      SIGN(<nValue>) -> nSign

 Arguments

      <nValue> is a numeric value.

 Returns

      SIGN() returns the sign of a value.

      For a positive value, SIGN() returns +1.
      For a negative value, SIGN() returns -1.
      For zero, SIGN() returns 0.

 Description

      SIGN() is used to determine if a number is positive, negative, or
      neutral (zero).

 Examples

      ? Str( SIGN( 5), 2, 0)  // returns  1
      ? Str( SIGN(-5), 2, 0)  // returns -1
      ? Str( SIGN( 0), 2, 0)  // returns  0

 Files: CALC.LIB

 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
   See Also:






 CSC()
 To return the COSECANT of a degree.


 Syntax

      CSC(<nValue>) -> nCosecant

 Arguments

      <nValue> is a numeric degree.

 Returns

      CSC() returns the cosecant of a degree.

 Description

      CSC() returns the cosecant of a degree.

 Examples

      ? Str( CSC(30), 8, 5)  // returns  2.00000

 Files: CALC.LIB

 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
   See Also:






 CSCR()
 To return the COSECANT of a radian.


 Syntax

      CSCR(<nValue>) -> nCosecant

 Arguments

      <nValue> is a numeric radian.

 Returns

      CSCR() returns the cosecant of a radian.

 Description

      CSCR() returns the cosecant of a radian.

 Examples

      ? Str( CSCR(.5236), 8, 5)  // returns  2.00000

 Files: CALC.LIB

 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
   See Also:






 SEC()
 To return the SECANT of a degree.


 Syntax

      SEC(<nValue>) -> nSecant

 Arguments

      <nValue> is a numeric degree.

 Returns

      SEC() returns the secant of a degree.

 Description

      SEC() returns the secant of a degree.

 Examples

      ? Str( SEC(30), 8, 5)  // returns  1.15470

 Files: CALC.LIB

 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
   See Also:






 SECR()
 To return the SECANT of a radian.


 Syntax

      SECR(<nValue>) -> nSecant

 Arguments

      <nValue> is a numeric radian.

 Returns

      SECR() returns the secant of a radian.

 Description

      SECR() returns the secant of a radian.

 Examples

      ? Str( SECR(.5236), 8, 5)  // returns  1.15470

 Files: CALC.LIB

 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
   See Also:






 COT()
 To return the COTANGENT of a degree.


 Syntax

      COT(<nValue>) -> nCotangent

 Arguments

      <nValue> is a numeric degree.

 Returns

      COT() returns the cotangent of a degree.

 Description

      COT() returns the cotangent of a degree.

 Examples

      ? Str( COT(30), 8, 5)  // returns  1.73205

 Files: CALC.LIB

 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
   See Also:






 COTR()
 To return the COTANGENT of a radian.


 Syntax

      COTR(<nValue>) -> nCotangent

 Arguments

      <nValue> is a numeric radian.

 Returns

      COTR() returns the cotangent of a radian.

 Description

      COTR() returns the cotangent of a radian.

 Examples

      ? Str( COTR(.5236), 8, 5)  // returns  1.73205

 Files: CALC.LIB

 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
   See Also:


 Programming



  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.


  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.










 Linking CALC.LIB



  Library

      CALC.LIB   -  This is the library that contains all the calculator
                    and supporting functions.
                    It can be *COMPLETELY* overlaid.

                    When prelinking, use the REFER names of "CALC20",
                    "TRIG" and "NUMLOCK".


  Linking (Non-overlaid use)

      Microsoft:

          LINK <yourObj>, <yourExe>, <yourMap>, <yourLib> + CALC

      Borland:

          TLINK <yourObj>, <yourExe>, <yourMap>, <yourLib> + CALC

      Blinker:

          Blinker FI <yourObj> LIB CALC

      Pocket Soft:

          RTLink FI <yourObj> LIB CALC


  Linking (Overlaid use)

      When overlaying with Blinker,
      the following sample script
      files can be used:


      Clipper 5.x:

          FILE <yourObj>

          BEGIN

              FILE <yourFiles>
              FILE <mousefile>   #see next section for choice of mouse files
              ALLOCATE CALC

          END
          LIB CLIPPER, TERMINAL, DBFNTX










 Using FUNMOUSE, FUNMOUSX, DCLMOUSE, NANMOUSE or NOMOUSE


  Overview

    In order to use a mouse driver, you must have a library that support
    mouse control.  The interfaces that are supplied with CALC 2.1 are for
    Funcky, dCLIP, and NANFOR.

    By default, NOMOUSE is linked into your system (through CALC.LIB),
    defining "no mouse support" for the calculator.

    If you choose to use a mouse driver, use one of the following:

  Funcky II

    When using Funcky II mouse system, you currently have two types of
    mouse support: one for protected mode (like ExoSpace or Blinker 3),
    and one without protected mode.

    The difference between protected mode (FUNMOUSX.OBJ) and non-protected
    mode (FUNMOUSE.OBJ) is support for the graphical cursor.  As this
    piece of documentation is being written, there is no protected mode
    support for Funcky II's graphical cursor.  This may change.  If it
    does, simply use FUNMOUSE instead of FUNMOUSX in your link script.

    For Protected Mode Funcky:          For Non-Protected Mode Funcky:

    fi <your.obj>                       fi <your.obj>
    BEGINAREA                           BEGINAREA

       fi FUNMOUSX            <=====>      fi FUNMOUSE
       allocate CALC                       allocate CALC

    ENDAREA                             ENDAREA
    @funcky        #your funcky libs    @funcky        #your funcky libs
    lib CLIPPER, TERMINAL, ...          lib CLIPPER, TERMINAL, ...

    Source code is included for the Funcky interface in FUNMOUSE.PRG



  dCLIP

    When using dCLIP mouse system, simply link in the DCLMOUSE.OBJ file
    prior to the library CALC:

    For dCLIP:

    fi <your.obj>
    BEGINAREA

       fi DCLMOUSE
       allocate CALC

    ENDAREA
    @dclip               #your dclip modules, files and libraries
    lib CLIPPER, TERMINAL, ...

  NANFOR

    When using NANFOR mouse system, simply link in the NANMOUSE.OBJ file
    prior to the library CALC:

    For dCLIP:

    fi <your.obj>
    BEGINAREA

       fi NANMOUSE
       allocate CALC

    ENDAREA
    @nanfor              #your nanfor library
    lib CLIPPER, TERMINAL, ...

  NOMOUSE

    NOMOUSE.OBJ is the default of the CALC.LIB and does not need to be
    explicitly included.  However, for posterity, here it is:

    fi <your.obj>
    BEGINAREA

       fi NOMOUSE
       allocate CALC

    ENDAREA
    lib CLIPPER, TERMINAL, ...
