home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / basic / QBEVAL20.ZIP / EVAL.DOC < prev    next >
Encoding:
Text File  |  1992-08-13  |  18.0 KB  |  776 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.                                    EVAL
  16.  
  17.                  An expression evaluator for QuickBasic 4.5
  18.  
  19.                                Version  2.00
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.    [c] 1991,1992 Applied Design Group, E 3707 Pacific, Spokane, WA 99202
  51.  
  52.                                (509) 535-7829
  53.  
  54.  
  55.  
  56.  
  57.  
  58.                         Table Of Contents
  59.                 ____________________________________
  60.  
  61.  
  62.             License Policy                              1
  63.  
  64.             Disclaimer                                  2
  65.  
  66.             Introduction                                4
  67.  
  68.             Using EVAL                                  5
  69.  
  70.             Function Reference                          7
  71.  
  72.             Registration Information                    13
  73.  
  74.             Other Applied Design Group Products         14
  75.  
  76.             Order Form
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. License Policy:                                                 Page 1
  84.  
  85.  
  86.  
  87.  
  88.  
  89.      EVAL and its documentation are copyright [c] 1991,1992  by
  90.      Applied Design Group all rights reserved.  EVAL may not be
  91.      circulated in any incomplete or modified form, nor sold for
  92.      profit, without written permission of the author.  You may
  93.      use the unregistered shareware version of EVAL for a reasonable
  94.      evaluation period.  After the evaluation period, you must either
  95.      register EVAL or discontinue its use.  If you register EVAL,
  96.      you may continue to use the unregistered EVAL program until
  97.      you receive the registered version.
  98.  
  99.  
  100.  
  101.      If you distribute this software to others, you are required to
  102.      distribute the ENTIRE package consisting of the following files:
  103.  
  104.  
  105.                EVAL20.QLB     -    EVAL Quick Library
  106.                EVAL20.LIB     -    Standard Microsoft Library
  107.                EVAL720.QLB    -    Same as above except for
  108.                EVAL720.LIB    -    PDS 7.1 instead of QB 4.5
  109.                EVAL.BI        -    Include file for your application program
  110.                EVAL.DOC       -    EVAL Documentation
  111.                CALC.BAS       -    Sample EVAL application
  112.                CALC.EXE       -    Sample executable
  113.                CALC.MAK       -    QuickBasic make file
  114.                CALC.BAT       -    Batch file to load calc and the quick lib
  115.                README         -    Read file
  116.  
  117.  
  118.  
  119. Commercial sale:                                                Page 2
  120.  
  121.  
  122.      Any software dealer or library may distribute the entire
  123.      EVAL Shareware package in an unmodified form for a fee as long as the
  124.      price charged for the disk containing EVAL Shareware does
  125.      not exceed US $10.00.
  126.  
  127.  
  128.      With this single exception, the sale of EVAL or its parts for profit,
  129.      either by itself or as part of a compiliation or development tool
  130.      or library which includes all or a portion of EVAL requires a licensing
  131.      agreement providing for royalty payments. Please write for terms.
  132.  
  133.  
  134.      The use of EVAL routines in your commercial or shareware programs
  135.      requires you to register your copy prior to distributing said
  136.      programs, in addition your program must contain a valid copyright
  137.      notice, your copyright notice or the letter 'c' enclosed in
  138.      parenthesis and the word "Copyright" and the year(s) of publication
  139.      is sufficient.
  140.  
  141.  
  142.      In NO EVENT may you use any of the routines in EVAL for commercial
  143.      purposes until you register your copy.
  144.  
  145.  
  146.  
  147.  
  148.      In other words:
  149.  
  150.         You cannot sell or distribute any program which contains EVAL
  151.         routines either commercial, public domain, or shareware, whithout
  152.         registering your copy prior to distribution.
  153.  
  154.  
  155.  
  156.  
  157.  
  158. Disclaimer:                                                     Page 3
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.      This software (EVAL Shareware) is provided on an "as is" basis without
  170.  
  171.      warranty of any kind, expressed or implied, including but not limited
  172.  
  173.      to the implied warranties of merchantability and fitness for a
  174.  
  175.      particular purpose.  The person using the software bears all risk as to
  176.  
  177.      the quality and performance of the software.  Should the software
  178.  
  179.      prove defective, the user assumes the entire cost of all necessary
  180.  
  181.      repair, servicing, or correction.  The author will not be liable for
  182.  
  183.      any special, incidental, consequential, indirect or similar damages
  184.  
  185.      due to loss of data or any other reason, even if the author or an
  186.  
  187.      agent of the author has been advised of the possibility of such
  188.  
  189.      damages.  In no event shall the author's liability for any damages
  190.  
  191.      ever exceed the price paid for the license to use the software,
  192.  
  193.      regardless of the form of the claim.
  194.  
  195.  
  196.  
  197. Introduction                                                    Page 4
  198.  
  199.  
  200. EVAL 2.00
  201.  
  202.  
  203. EVAL is an expression evaluator for the QuickBasic programmer.
  204. With EVAL your program can evaluate user entered mathematical formulas
  205. and expressions.  You simply pass a string containing the formula to
  206. EVAL and the numeric value is returned :
  207.  
  208.  
  209.                 expr$ = "4*(3.14*2)^2*(3+4) + sin(rad(24)* sqr(2))"
  210.  
  211.                 Anser# = Eval#(expr$, err$)
  212.  
  213. It's that simple !
  214.  
  215.  
  216. This is a shareware product,  you may try EVAL to see if it fits
  217. your needs.  If after a reasonable period of time you find you
  218. are still using EVAL you must register.  By registering this product
  219. you will receive the latest version and COMPLETE SOURCE CODE you
  220. will also recieve a printed manual, technical support and a subscription
  221. to our quarterly newsletter for  one year.
  222.  
  223.  
  224.  
  225. Compatibility
  226.  
  227.  
  228. EVAL can be used with QuickBasic 4.5 or PDS 7.1.  The QB 4.5
  229. libraries are EVAL20.QLB and EVAL20.LIB the PDS libraries are
  230. EVAL720.QLB and EVAL720.QLB.
  231.  
  232. If you have the source code it may also be compatible with the
  233. following versions of BASIC.
  234.  
  235.  
  236.                         Turbo Basic
  237.  
  238.                         Power Basic
  239.  
  240.  
  241. If there is a question of compatibility just drop us a line or call
  242. 8:00 AM to 5:00 PM Pacific Time.
  243.  
  244.  
  245.                         Applied Design Group
  246.  
  247.                            (509) 535-7829
  248.  
  249. Using EVAL                                                      Page  5
  250.  
  251.  
  252.  
  253. EVAL is contained in a quick library.  To use simply include the quick
  254. libary on the command line when you load your application program.
  255.  
  256.  
  257.  
  258.                 QB myapp /leval20
  259.                          _________
  260.                             |
  261.                              -------------- The libarary spec
  262.  
  263.  
  264.  
  265. The EVAL Function takes two string arguments and returns a DOUBLE
  266. precision float.  The string arguments are :
  267.  
  268.  
  269.  
  270.                  1: the expression to be analyzed
  271.                  2: an error variable (should be "" on entry)
  272.  
  273.  
  274. If an error occured during evaluation the error variable will contain a
  275. string representation of the error.  Otherwise, the error variable will
  276. be NULL or empty.
  277.  
  278.  
  279. EVAL can handle the following operators:
  280.  
  281.                      +          -       addition
  282.                      -          -       subtraction
  283.                      *          -       multiplication
  284.                      /          -       division
  285.                      ^          -       exponentiation
  286.                      ()         -       parenthesies
  287.  
  288.  
  289. And the following functions:
  290.  
  291.         SIN     COS     TAN     ASIN    ACOS    ATAN    HSIN
  292.         HCOS    HTAN    AHSIN   AHCOS   AHTAN   RAD     DEG
  293.         ANGLE   SANGLE  RADIUS  POLX    POLY    LN      LOG
  294.         LOGN    SQR     ABS     CEIL    FLOOR   EXP     FRAC
  295.         INT     MOD     SGN     FIX     RND     FACT    RES
  296.         PI
  297.  
  298.                                                                 Page 6
  299.  
  300.  
  301. EVAL can handle full floating point syntax, All of the following are
  302. legal numbers in EVAL expressions:
  303.  
  304.                         4
  305.                         4.5
  306.                         -2.3
  307.                         67.9809E23
  308.                         34.45E-2
  309.                         -3.4E-2
  310.                         0.001
  311.  
  312.  
  313. The following is NOT a legal number:
  314.  
  315.                         .001
  316.  
  317. EVAL requires fractional values to be preceeded by a zero.
  318.  
  319.                         ie:  0.001
  320.  
  321.  
  322. You only need to include EVAL.BI in your application and call EVAL when
  323. you need expression evaluation:
  324.  
  325.  
  326.                 '$include 'eval.bi'
  327.  
  328.                 ...
  329.                 ...
  330.  
  331.                 Result# = Eval# (expression$, expression.error$)
  332.  
  333.  
  334.                         Thats all there is to it !
  335.  
  336.  
  337.        --------------------- WARNING ----------------------
  338.  
  339.  
  340.           With version 2.0 of QBEVAL you may experience
  341.           "Out of Stack Space" errors when nesting the
  342.           additional functions
  343.  
  344.                 ie:   sin(cos(sin(cos(1))))
  345.  
  346.           If this occurs link your application
  347.           from the command line using the ST switch.
  348.           With a stack size of least 16k you should
  349.           experience no problems with normal operation.
  350.  
  351.           For more information refer to page 368 of your
  352.           "Programming in Basic" manual.
  353.  
  354.        ----------------------------------------------------
  355.  
  356. Function Reference                                              Page 7
  357.  
  358.  
  359.         All functions require arguments to be enclosed in
  360.         parenthesis and if there are more than one to be
  361.         separated by a comma.
  362.  
  363.         ie:
  364.                 sin(0.5)
  365.  
  366.                 polx(0.5,13)
  367.  
  368.  
  369.         Functions may be nested to any level
  370.  
  371.         ie:
  372.                 deg(sin(angle(5,5)))
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.         Trig Functions
  380.         ---------------------------------------
  381.  
  382.         The trig functions all take arguments as
  383.         and return values as radians.  To specify
  384.         degrees use the conversion functions DEG
  385.         and RAD.
  386.  
  387.  
  388.  
  389.         SIN
  390.  
  391.           Returns the sine of an angle.
  392.  
  393.  
  394.         COS
  395.  
  396.           Returns the cosine of an angle.
  397.  
  398.  
  399.         TAN
  400.  
  401.           Returns the tangent of an angle.
  402.  
  403.  
  404.                                                                 Page 8
  405.         ASIN
  406.  
  407.           Returns the arcsine of an angle.
  408.  
  409.  
  410.         ACOS
  411.  
  412.           Returns the arccosine of an angle.
  413.  
  414.  
  415.         ATAN
  416.  
  417.           Retuns the arctangent of an angle.
  418.  
  419.  
  420.         HSIN
  421.  
  422.           Returns the hyperbolic sin of an angle.
  423.  
  424.  
  425.         HCOS
  426.  
  427.           Returns the hyperbolic cosine of an angle.
  428.  
  429.  
  430.         HTAN
  431.  
  432.           Returns the hyperbolic tangent of an angle
  433.  
  434.  
  435.         AHSIN
  436.  
  437.           Returns the hyperbolic arcsine of an angle.
  438.  
  439.  
  440.         AHCOS
  441.  
  442.           Returns the hyperbolic arccosine of an angle.
  443.  
  444.  
  445.         AHTAN
  446.  
  447.           Returns the hyperbolic arctangent of an angle.
  448.  
  449.  
  450.         RAD
  451.  
  452.           Converts an expression from degrees to radians.
  453.  
  454.  
  455.         DEG
  456.  
  457.           Converts an expression from radians to degrees.
  458.  
  459.  
  460.                                                                 Page 9
  461.         ANGLE
  462.  
  463.           Takes an x and y coordinate and returns the polar angle
  464.           from 0 to 359.999 degrees.
  465.  
  466.  
  467.         SANGLE
  468.  
  469.           Takes an x and y coordinate and returns the signed polar
  470.           angle from 0 to 180 and -0.00001 to -179.99999 degrees.
  471.  
  472.  
  473.         RADIUS
  474.  
  475.           Takes an x and y coordinate and returns the distance to
  476.           the origin.
  477.  
  478.  
  479.         POLX
  480.  
  481.           Takes an angle and radius and returns the rectangualar x
  482.           coordinate.
  483.  
  484.  
  485.         POLY
  486.  
  487.           Takes an angle and radius and returns the rectangualar y
  488.           coordinate.
  489.  
  490.  
  491.  
  492.                                                                 Page 10
  493.         Logarithmic/Exponential functions
  494.         ---------------------------------
  495.  
  496.  
  497.         LN
  498.  
  499.           Returns the natural logarithm of an expression.
  500.  
  501.  
  502.         LOG
  503.  
  504.           Returns the common logarithm of an expression.
  505.  
  506.  
  507.         LOGN
  508.  
  509.           Returns the logarithm of base n, where n is the second
  510.           argument, of an expression.
  511.  
  512.  
  513.         SQR
  514.  
  515.           Returns the square root of an expression.
  516.  
  517.  
  518.         EXP
  519.  
  520.           Returns the natural anti-logarithm of an expression.
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                                                                 Page 11
  527.         Misc Functions
  528.         ------------------------------------
  529.  
  530.  
  531.         ABS
  532.  
  533.           Returns the absolute value of an expression.
  534.  
  535.  
  536.         CEIL
  537.  
  538.           Returns the smallest integer greater than or
  539.           equal to the argument.
  540.  
  541.  
  542.         FLOOR
  543.  
  544.           Returns the greatest integer less than or equal
  545.           to the argument.  FLOOR and INT are identical
  546.           functions.
  547.  
  548.  
  549.         FRAC
  550.  
  551.           Returns the fractional part of the argument.
  552.  
  553.  
  554.         INT
  555.  
  556.           Returns the greatest integer less than or equal
  557.           to the argument.  FLOOR and INT are identical
  558.           functions.
  559.  
  560.  
  561.         MOD
  562.  
  563.           Returns the remainder after dividing the first
  564.           argument by the second.
  565.  
  566.                 ie:    mod(10,3) = 1
  567.  
  568.                         10/3  = 3 remainder 1
  569.  
  570.  
  571.         SGN
  572.  
  573.           Returns the sign of the argument.
  574.  
  575.                 negative = -1
  576.                 positive =  1
  577.                 zero     =  0
  578.  
  579.  
  580.                                                                 Page 12
  581.         FIX
  582.  
  583.           Returns the integer portion of the argument.
  584.  
  585.  
  586.         RND
  587.  
  588.           Returns a random number.  The argument is a seed and
  589.           can be anything but zero.  We reccomend you use the
  590.           RES system variable as a seed.
  591.  
  592.                 ie:
  593.                         rnd(res)
  594.  
  595.  
  596.         FACT
  597.  
  598.           Returns the factorial of a number.  The argument must
  599.           be between 0 and 170.
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.         System Variables and constants
  607.         --------------------------------------
  608.  
  609.  
  610.         RES
  611.  
  612.           Returns the result of the last expression evaluated.
  613.  
  614.  
  615.         PI
  616.  
  617.  
  618.           Returns the value of PI to 15 digits.
  619.  
  620.  
  621.  
  622. Registration Information                                        Page  13
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.         EVAL is NOT FREE Software.  If you wish to continue using EVAL
  632.         you must register.
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.         Q : What do I get if I register ?
  644.  
  645.         A : EVAL is a complete and usable package  as is however, by
  646.             registering you will recieve the latest version of EVAL as
  647.             well as COMPLETE SOURCE CODE for the entire package.
  648.             So this is what you will recieve
  649.  
  650.  
  651.                         - EVAL with SOURCE CODE on disk
  652.                         - A Printed manual
  653.                         - Unlimited Technical Support
  654.                         - Quarterly Newsletter
  655.                                (for 1 year)
  656.  
  657.                                                              $19.95
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665. Other Applied Design Group Products                             Page  14
  666.  
  667.  
  668.  
  669.  
  670. BPREP Preprocessor for the BASIC language
  671.  
  672.         Adds features to BASIC such as 'conditional compilation',
  673.         'defined constants', and 'include files'.  Makes programming in
  674.         BASIC much easier.  Works with just about any version of BASIC
  675.         and it comes in two versions.
  676.  
  677.                                      Shareware Version   $19.95
  678.                                      Profesional Version $34.95
  679.  
  680.  
  681.  
  682.  
  683.  
  684. ASM51 8051/8031 Macro Cross Assembler
  685.  
  686.         A full featured Cross Assembler for the Intel 8051/8031
  687.         series of microprocessors.  Generates Intel HEX files or
  688.         binary image output.
  689.                                                          $39.95
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696. BAS51 8051/8031 Basic Cross Compiler
  697.  
  698.         A BASIC compiler for the 8051 that supports most features
  699.         of the BASIC language.  Use structured contstructs
  700.         while/wend, do/loop, block if/then.  Generates good tight
  701.         code and no line numbers are required. Get those 8051
  702.         projects done in less time.
  703.  
  704.                                                          $99.95
  705.  
  706.  
  707.  
  708.  
  709.  
  710. BAS51 Professional
  711.  
  712.         A complete package including BAS51 Compiler, ASM51 Assembler
  713.         and BPREP Professional, as well as several other utilities to
  714.         help you write 8051 code.
  715.                                                         $149.95
  716.  
  717.  
  718.  
  719.  
  720.    EVAL version 1.01                                      Order Form
  721.    -----------------------------------------------------------------
  722.      Make checks payable to:
  723.        Applied Design Group
  724.        E 3707 Pacific
  725.        Spokane, WA 99202
  726.    -----------------------------------------------------------------
  727.    Qty
  728.  
  729.    [ ] EVAL                              @  $19.95 each      $______
  730.  
  731.    [ ] BPREP Shareware                   @  $19.95 each      $______
  732.  
  733.    [ ] BPREP Professional                @  $34.95 each      $______
  734.  
  735.    [ ] ASM51
  736.        8051/8031 Macro Cross Assembler   @  $39.95 each      $______
  737.  
  738.    [ ] BAS51
  739.        8051/8031 Basic Cross Compiler    @  $99.95 each      $______
  740.  
  741.    [ ] BAS51 Professional 8051/8031 Basic Cross Compiler
  742.        Includes Macro Assembler
  743.        and BPREP Professional            @ $149.95 each      $______
  744.  
  745.                                                 Subtotal     $______
  746.  
  747.        Washington residents please add 8.0% sales tax.       $______
  748.  
  749.        Shipping and handling                                   $3.50
  750.  
  751.                                                      Total   $______
  752.  
  753.        Diskette type :  [ ] 5.25"         [ ] 3.5"
  754.  
  755.        Payment       :  [ ] Check         [ ] Money Order
  756.  
  757.    Checks and Money Orders must be drawn on U.S. banks in U.S. funds
  758.    -----------------------------------------------------------------
  759.  
  760.    Name      _______________________________________________________
  761.  
  762.    Company   _______________________________________________________
  763.  
  764.    Address   _______________________________________________________
  765.  
  766.              _______________________________________________________
  767.  
  768.    Phone     _____________________  Business  ______________________
  769.  
  770.  
  771.    Where did you obtain EVAL?
  772.  
  773.              _______________________________________________________
  774.  
  775.    Comments  _______________________________________________________
  776.