home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / calculat / doit.zip / DO.DOC < prev    next >
Text File  |  1989-11-17  |  4KB  |  118 lines

  1.  
  2.   21 Sep 1989                                               Bernardo Zamora
  3.  
  4.  
  5.  
  6.         Manual for the units to convert to RPN and evaluate functions
  7.         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8.  
  9.  
  10.         The self_unarcing file contains several units and a demo program.
  11.         The demo is called DO.PAS, and the executable DO.EXE.
  12.  
  13.         This units aid in converting a function to RPN and later
  14.         evaluate it, optionally substituting all the 'x' in the
  15.         function for a passed parameter.
  16.  
  17.         The demo program receives a parameter, it evaluates it
  18.         and prints the result (it's very useful as a desk accesory,
  19.         like a portable calculator with LOTS of functions).
  20.  
  21.         The units are precompiled for TP5.5, if you want them for
  22.         other pascals (TP4 or TP5.0) recompile the source code for
  23.         all the units.
  24.  
  25.  
  26.                 Brief explanation of the programs included
  27.                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  28.  
  29. ........DO.EXE/DO.PAS = demo file, shows how easy is to evaluate
  30.           a function (only 50 lines to ask for the function, concatenate it
  31.           evaluate it, and print a table with the original function, the
  32.           converted function [rpn] and the result).
  33.  
  34. ........DO_TYPE.TPU/DO_TYPE.PAS = unit that has all the declarations
  35.           of variables, constants and types that you should know about
  36.           to convert a function to RPN (see the demo program to see how
  37.           to define a RPN variable).
  38.           You SHOULD INCLUDE this file to do any conversion/evaluation.
  39.  
  40. ........DO_MATE.TPU/DO_MATE.PAS = unit with several mathematical functions
  41.           like tan, exp, log, etc.. you can use it alone in your
  42.           programs.. you DONT NEED to include it (it is automatically done).
  43.  
  44. ........DO_RPN = main unit that receives a function in the rpn-variable
  45.           and converts it to rpn (leaving a simple string in rpn_string and
  46.           the real stack conversion in s1). This unit has only one function :
  47.  
  48.           Procedure Convierte_a_polaca(var rpn:rpn_type);
  49.  
  50.           to use it, declare a variable type rpn_type and fill the
  51.           fun_string with the function to be converted.. then pass that
  52.           variable as a parameter. You NEED to include this unit.
  53.  
  54.           The error field will contain 0 if no error occured, and if an
  55.           error occured, the MESSAGE field will contain the error (see
  56.           the unit DO_TYPE.PAS that contains all error messages).
  57.  
  58. ........DO_EVAL = unit that evaluates the pre-converted function. The only
  59.           procedure (public) declared here is :
  60.  
  61.           Function Evalua_polaca(var rpn : rpn_type, value : real) : real;
  62.  
  63.           This function returns the value of the function evaluated. For
  64.           example if the function (4-1) was converted and then evaluated,
  65.           it would return (3).
  66.  
  67.           The error field will contain 0 if no error occured, and if an
  68.           error occured, the MESSAGE field will contain the error (see
  69.           the unit DO_TYPE.PAS that contains all error messages).
  70.  
  71.           The VALUE parameter is a value that is to be substituted for
  72.           all occurences of the letter 'X'. Check the field ERROR to
  73.           verify that the result is a meaningful one.
  74.  
  75.  
  76.  
  77.                     EASY EXPLANTATION OF USAGE
  78.                     ~~~~~~~~~~~~~~~~~~~~~~~~~~
  79.  
  80.  
  81.   To make a program that receives a function, converts it and shows
  82.   the evaluated result you must include the DO_TYPE, DO_RPN and
  83.   DO_EVAL units.
  84.  
  85.   The you should ask the function, put it into the field fun_string
  86.   of a rpn_type variable.
  87.  
  88.   Call the procedure to convert fun_string to rpn. That function also
  89.   fills the field rpn_string.
  90.  
  91.   Call the evaluating function with a value to substitute for 'X'.
  92.  
  93.   Print the result.
  94.  
  95.  
  96. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  97.  
  98. Any questions? Forward them to
  99.  
  100. ===========================
  101. Bernardo Zamora
  102. Paseo de la Herradura #126
  103. La herradura
  104. CP 53920
  105. Mexico, DF
  106. MEXICO
  107. ===========================
  108.  
  109. ... or through BITNET
  110.  
  111. =======================
  112. Bernardo Zamora  BL306971@TECMTYVM  (nick : "BEAR")
  113. or
  114. Bernardo Zamora  PL306971@TECMTYVM
  115. or ask for me with
  116. Fausto Ibarra    EM304599@VMTECMEX
  117. =======================
  118.