Page 140 - Standard Handbook Of Petroleum & Natural Gas Engineering
P. 140

Computer Applications   125

                      Pointer-Each  value  of  a  variable  declared  to  be  of  a  pointer  type  gives  the
                    memory  location  of  the  element  to  which  it  points.
                    Statements. A  Pascal  statement may be shorter than or may continue over more
                    than  one line, since a  semi-colon separates  statements. Reserved  words  are not
                    separated from statements; therefore the statement preceding the word  END (see
                    later  sections)  requires  no  punctuation.  END  of  the  main  program  unit  is
                    followed  by  a  period.  Comment  lines  are  included  in  the  program  by  placing
                    them  between  the  symbols  (*  and  *).  Statements  may  be  simple  (single) or
                    compound, i.e., a  series  of  simple statements joined  together  in  a  block  which
                    is  introduced  by  BEGIN  and  completed  by  END.

                      Nonexecutable Statements
                      Program unit heading-Program,  procedure, or function name; the forms are:
                      PROGRAM  name  (input file name(s), output file  name(s));

                    whete one input and one output file name, designated as INPUT and OUTPUT,
                    are  assigned  to  default  devices.  For  example,

                      PROGRAM  TEST(INPUT,OUTPUT);
                      PROGRAM  EDITOR(EDFILE, INPUT,OUTPUT);
                    and

                      FUN(:TION  name(parameter list:type,  . . .):function type;
                      PROCEDURE  name(parameter  list:type, . .  .);
                    The  declaration  \:4R  preceding  a  variable  name(s) in  a  parameter  list  allows
                    the sub-program to modify the value of  the variable stored in memory; if  there
                    is  no VAR  preceding a variable  name, the sub-program is passed only  the value
                    of  the parameter  at the  time  of  calling  and cannot  modify  the stored value  of
                    that  variable  in  the  calling unit, e.g.,
                      PROCEDURE  SAMPLE(X:REAL; YCHAR);
                      PROCEDURE  LOOP(VAR A,B,C:INTEGER;  YCHAR);
                      FUNCTION  CHECK(VAR NUM:REAL;  VAR  PNR:INTEGER):REAL;
                      FUNCTION  BOUND(TEMP:REAL):BOOLEAN;
                    In standard  Pascal, although  only in  a  few  implementations  of  the language,  a
                    function  or procedure  name  may  also  be  a  parameter  to  a  sub-program. The
                    constants,  types,  and  variables  used  in  a  sub-program, as  well  as  those  in  the
                    main  program, must  be declared  (see following  declarations).
                      Label  declaration-Labels  identify  an  executable  statement  which  may  then
                    be  referenced  by  GOTO; they  may  be  1-4  digits and  must  be declared  by

                      LABEI,  unsigned  integer(s);
                    For  example,

                      LABEL 50,999;
   135   136   137   138   139   140   141   142   143   144   145