TPUHELP.HLB  —  EXECUTE
  EXECUTE

     Does one of the following:

     o  Executes a program that you have previously compiled

     o  Compiles and then executes any executable statements in a specified
        buffer, range, or string

     o  Replays or executes a learn sequence

     o  Executes the program, procedure, or learn sequence bound to a key.

  Syntax

     EXECUTE ({program | buffer | range | string1
              | learn | keyword [,string2]})

  Parameters

     program              The program you want to execute.

     buffer               The buffer whose contents you want to execute.
                          The buffer must contain only valid DECTPU
                          statements.

     range                The range whose contents you want execute.  The
                          range must contain only valid DECTPU statements.

     string1              The string whose contents you want to execute.
                          The string must contain only valid DECTPU
                          statements.  The string cannot be longer than 132
                          characters.

     learn                The learn sequence you want to replay.

     keyword              The key (or key combination) whose definition you
                          want to execute.  See help on KEYNAMES TABLE.

     string2              Optionally, a key map or key-map list in which a
                          key is defined.  If you specify a keyname as the
                          required parameter for EXECUTE, you may optionally
                          specify the key map or key map list from which
                          DECTPU should get the key definition.  If this
                          parameter is not specified, DECTPU uses the first
                          definition found in the key map list bound to the
                          current buffer.

  Comments

     To specify a value to be returned by the EXECUTE statement, use a
     RETURN statement as the last statement in the code, string, or learn
     sequence passed to EXECUTE.  For example, the following statement
     assigns to the variable "a" the value of the program returned by the
     LOOKUP_KEY built-in:

     a := EXECUTE ("RETURN LOOKUP_KEY (ENTER, PROGRAM)");

     If you specify the name of an undefined, self-inserting key as the
     first parameter, DECTPU inserts the appropriate character into the
     current buffer.

  Examples

     1.  EXECUTE (main_buffer);

         Compiles the contents of the main buffer, and then executes any
         executable statements.  If there is text in the main buffer other
         than DECTPU statements, you get an error message.  If there are
         procedure definitions in the main buffer, they are compiled, but
         they are not executed until you run the procedure.  Once compiled
         by the EXECUTE built-in, procedures in the main buffer can be
         called by other DECTPU statements, programs, or procedures.

     2.  EXECUTE (RET_KEY, "TPU$KEY_MAP_LIST");

         The following statement looks up the program bound to the RETURN
         key in the default DECTPU key map list and executes the code or
         learn sequence found.

     3.  The following procedure prompts the user for a DECTPU statement to
         execute, and then executes the statement:

         PROCEDURE user_do
            command_string := READ_LINE ("DECTPU statement to execute:  ")
            EXECUTE (command_string);
         ENDPROCEDURE

  Related Topics

     COMPILE    RETURN
Close Help