Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-02 - decus/20-0072/scat2.doc
There are 2 other files named scat2.doc in the archive. Click here to see a list.
                                                  umnt-1
                                                  27Mar74


                           SCAT2


                       VERSION  2  OF


       STANDARD COMPLEX ALGEBRA TRANSLATOR FOR PDP-10


AUTHOR: C.J.  ANDREWS
DATE: 26-MAR-74






































                             1

                                                  umnt-1
                                                  27Mar74


                     1.0  INTRODUCTION





          SCAT2 is a program written in MACRO-10 for the pdp-10 and is
     the  second  version  of  SCAT  previously  described [1].  It is
     designed  particularly  for  those  who  make   many   repetitive
     calculations  using  complex  numbers, for example, in electrical
     circuit theory, and in antenna, transmission line  and  waveguide
     theory.  Such calculations are tedious to perform, and subject to
     error.  SCAT2 enables the user  to  operate  the  computer  as  a
     sophisticated desk calculator with predefined functions.

          Where SCAT [1] would only accept a single  operator  between
     numbers   and   variables,  SCAT2  will  accept  full  arithmetic
     expressions with  operator  precedence,  and  use  of  braces  to
     indicate  evaluation  precedence  of  sub-expressions.   Its only
     minor  limitation  is  that  the  unary  minus  operator  is  not
     permitted.

          the input format has been altered to allow  a  more  logical
     command  construction,  with assignment (if desired) appearing at
     the beginning of the command.  a full range of switches  is  also
     permitted.

          Each of these facilities is described in subsequent sections
     of this manual.













[1]   andrews, c.j., "Standard Complex Algebra Translater for PDP-10",
     Computer Centre Bulletin, June 73.





                            1-1

                                                  umnt-1
                                                  27Mar74


                    2.0 COMMAND ELEMENTS





          This section describes the various  elements  which  may  be
     included  in  a command, except switches, which are dealt with in
     section 4.

   2.1  COMPLEX NUMBERS

          Complex numbers are input to SCAT2 enclosed in  parentheses,
     the  real  and  imaginary  parts  being separated by a comma.  If
     either part is ommitted, it is assumed  zero,  provided  that  if
     only  one number appears between the parentheses it is assumed to
     be the real part of the complex  pair,  and  the  imaginary  part
     zero.

          The numbers themselves may be integers, floating  point,  or
     E-format,  or  a  mixture  of these.  All calculation is, however
     performed in floating point.

          The following are legal complex pairs:
            (1.0,2.0)         (1,2)            (.01E2,20.E-1)
            (1.0,)            (1,)             (.001E+3,)
            (,2.0)            (,2)             (,2.0E0)
            (1.0)             (1)              (.1E+1)

   2.2  VARIABLES

          Values may be assigned to variables (see  section  2.3)  and
     these used in subsequent commands.

          The variables are referenced by name, which must start  with
     an  alphabetic  character,  and  may  be  up to six characters in
     length.  Subsequent characters may be numeric or alphabetic.

          Examples of legal names are:

               a  abc  a12  abcdef  zby3

   2.3  OPERATORS

          Five arithmetic  operators  are  permitted  between  command
     elements, and they are:



                            2-1

umnt-1
27Mar74


                       +  -  /  *  ^

          Assignment  is  achieved  by  preceding  the  command  by  a
     variable name followed by the assignment operator, _.

          SCAT2 indicates when assignment has been made  (see  section
     3.2).

          To separate the command  into  sub-expressions  to  indicate
     precedence  in  evaluation,  the  user  types  the sub-expression
     inside braces, [ (shift-k) and ] (shift-m).

   2.4  FUNCTIONS

          Certain predefined trigonometric functions  are  allowed  in
     SCAT2.    These  are  shortened  to  three  characters,  and  are
     indicative of the commonly known functions.  they are:

                   SNH[] - sinh function
                   CSH[] - cosh function
                   TNH[] - tanh function
                 MAG[] - magnitude function
                   ANG[] - angle function
             CAR[] - convert to cartesian form
               POL[] - convert to polar form


          Suggestions for other needed  functions  are  welcomed,  and
     endeavour will be made to incorporate them.

   2.5  EXAMPLES

          The following are examples of valid commands:

       (1,2)+(3,4)-(7.01,9.86)/(2.3,8.6)
       [[(1.0,)+(,9.3)]*(8.1,3.2)]^(2.1,3.6)
       abcd1_[(2.6e1,3.1e-2)*snh[ab+(2.6,5.1)*z1]]^(2,3)












                            2-2

                                                  umnt-1
                                                  27Mar74


         3.0  OPERATING  INSTRUCTIONS  AND  OUTPUT





     3.1  OPERATION

          SCAT2 is set in operation in the following manner:
          .RU SCAT2[111,132]

          SCAT2 (19-MAR-74) READY
          *


          The asterisk indicates readiness  for  a  command.   Once  a
     command is input SCAT2processes the command in the following way:

       (i)  It carries out a single pass processing of the command  to
       "compile" a polish string from it.
       (ii) This polish string is then subject to a single  scan,  and
       is executed.
       (iii)the results are then output.

          SCAT2 inputs the command character by  character.   This  is
     done  so  that  immediate  processing of switch characters can be
     made.   This  carries  with  it  the  limitation  that  a  rubout
     character  cannot  be  issued.   If an error condition or mistake
     occurs an R switch should be used to  restart  the  command  (see
     section 4.0).

   3.2  OUTPUT

    3.2.1  ASSIGNMENT

          SCAT2 indicates when assignment has been made by  outputting
     the  result  of  its  calculation, and the variable name to which
     assignment has been made.  For example,

          ABC12  = (1.032,-4.301)

    3.2.2  NO  ASSIGNMENT

          When no assignment has been  made  SCAT2  merely  types  the
     result in the following form:




                            3-1

umnt-1
27Mar74


          RESULT = (1.032e+6,-4.301e-2)

   3.3  LIMITATIONS

          The operating limitations of SCAT2 are as follows:
       (i)  Commands may not be extended beyond one line
       (ii) No more than 40 variables may be assigned.
       (iii)No unary minus is permitted.









































                            3-2

                                                  umnt-1
                                                  27Mar74


                       4.0  SWITCHES





          A number of single letter switches can be used  to  instruct
     SCAT2  to  perform  specific functions to assist the user.  These
     are given in section 4.3.

   4.1  SPECIFYING A SWITCH

          To specify a switch the user types an "altmode" or  "escape"
     character.   This  places SCAT2 in switch mode, and the character
     immediately following the altmode or escape is interpreted  as  a
     switch.   It  is  then  processed  immediately, and in most cases
     causes some output.  The command string however is unaffected  by
     the  action  of a switch and may be continued upon termination of
     the switch list (see section 4.2).

   4.2  TERMINATING  THE  SWITCH  LIST

          After processing a switch SCAT2  will  accept,  and  expect,
     another.   If  no  further  switches are required, an altmode, or
     escape, terminates the list.

   4.3  SWITCH  ACTIONS

    4.3.1  D  switch

          The D switch causes a dump  of  all  variables  assigned  to
     date, and their current values.

    4.3.2  E  switch

          The E switch causes SCAT2 to exit to monitor.

    4.3.3  R  switch

          The R switch causes SCAT2 to restart a command.  This switch
     causes the current command to be lost.

    4.3.4  Q  switch

          When typing a long command, a user  may  wish  to  query  if
     errors  do exist in what has already been typed.  The Q switch is
     implemented to enable him to do this.


                            4-1

umnt-1
27Mar74


          If no errors exist, SCAT2  automatically  outputs  a  switch
     list terminator,and expects the user to continue the command.

          If errors do exist, the user  is  informed,  and  asked  for
     another switch, most likely the L switch.

    4.3.5  L  switch

          The L switch will list any errors existing  in  the  current
     command.  If no errors exist, a switch list terminator is output,
     and the command continued.  After listing the errors, the program
     automatically performs an R switch function.

    4.3.6  C  switch

          The C switch clears the  count  of  errors  in  the  current
     command.   It  does  not remedy the errors themselves, but merely
     clears the count.   For  this  reason  peculiar  results  may  be
     encountered when this switch is used, and a command continued.

    4.3.7  H  switch

          The H switch issues a help text to the user, detailing  each
     of these switches.

    4.3.8  X  switch

          The X switch enables a user to delete  variables  previously
     stored.  SCAT2 will ask:

               confirm:


          to which is typed the list of variables  it  is  desired  to
     delete.  If a '*' is typed in reply, all variables are deleted.

    4.3.9  altmode  or  escape

          The altmode, or escape, terminates a switch list and  allows
     the continuation of a command.









                            4-2

                                                  umnt-1
                                                  27Mar74


                    5.0  ERROR DETECTION





          SCAT2 outputs a number of diagnostic error messages  in  the
     event of the occurrence of error conditions.

   5.1  "COMPILE"  TIME  ERRORS

          When translating  the  command  into  a  polish  string  the
     following error messages may occur:

       ILL. CHAR IN INPUT
       TOO MANY CHARS
       UNDEFINED VARIABLE
       DELIMITER EXPECTED
       EXP OUT OF RANGE
       UNBAL PARENTH

   5.2  "EXECUTION"  TIME  ERRORS

          During execution of the polish string, the  following  error
     conditions may occur:

       too many variables
       exec ov/und flow
       udf fcn


            These are thought to be self-explanatory.

















                            5-1