HELPLIB.HLB  —  PASCAL  Declaration Section, Module Initialization
  The TO BEGIN DO section allows you to specify a statement, in  a
  module,  that is to be executed before the executable section of
  the main program.

  Syntax:

     TO BEGIN DO statement;

  The 'statement' is a VSI Pascal statement.

  The TO BEGIN DO section can only appear  in  modules,  can  only
  appear  once in a module, and must appear as the last section in
  the declaration section.  (If appearing together, the  TO  BEGIN
  DO  section must precede the TO END DO section at the end of the
  declaration section.)

  As  a  general  rule,  if  a  program  or  module  inherits   an
  environment  file,  the  initialization section in the inherited
  module must be executed before the initialization section in the
  program  or  module  that  inherited it.  If a module or program
  inherits more than one module that  contains  an  initialization
  section,  the order of execution of the inherited modules cannot
  be determined.

  Example:

  MODULE X( INPUT, OUTPUT );

  VAR
     Debug : Boolean;

  PROCEDURE Test(...); {Executable section...}

  TO BEGIN DO
     BEGIN
     WRITE( 'Debug Module x?   ' );
     READLN( Debug );
     END;
  END.

  This TO BEGIN DO section contains statements that write a string
  and test the validity of the Debug variable.
Close Help