Progress
Programming
Handbook


Super Procedure Prototyping

A procedure file can include a prototype—as in “function prototype”—for each internal procedure and user-defined function invoked by (or in) the procedure file and implemented (at run time) in a super procedure. At compile time, Progress adds information from each prototype to the procedure file’s INTERNALENTRIES attribute, which lists the procedure file’s internal procedures and user-defined functions. At run time, the programmer can examine the INTERNALENTRIES attribute, and for each routine on the list, can invoke the GETSIGNATURE method to get the routine’s signature.

NOTE: If the definition of an internal procedure or user-defined function uses the PRIVATE option, the routine does not appear in the INTERNALENTRIES attribute of a procedure file other than the original, and the routine’s signature is not returned by the GETSIGNATURE method of a procedure file other than the original.

Prototyping Internal Procedures

To write a prototype for an internal procedure whose implementation resides (at run time) in a super procedure, use the PROCEDURE statement with the IN SUPER option. The syntax is as follows:

SYNTAX
PROCEDURE proc-name IN SUPER: 

proc-name

The name of the internal procedure.

For each parameter, code a DEFINE PARAMETER statement the regular way.

If your program includes such a prototype, GETSIGNATURE(proc–name) returns the signature in the following format:

PROCEDURE,,parameters 

Prototyping User-defined Functions

To write a prototype for a user-defined function whose implementation resides (at run time) in a super procedure, use the FUNCTION statement with the IN SUPER option. The syntax is as follows:

SYNTAX
FUNCTION function-name RETURNS return-type 
  [ ( parameters ) ] IN SUPER 

functionname

The name of the user-defined function.

returntype

The data type of the item the function returns. For a list of data types, see the reference entry for the FUNCTION statement in the Progress Language Reference .

parameters

The parameters of the user defined function. For the parameter syntax, see the reference entry for the FUNCTION statement in the Progress Language Reference .

If you include the prototype in your program, compile the program, examine the INTERNALENTRIES attribute of the super procedure, and invoke the GETSIGNATURE method for the function, GETSIGNATURE returns the signature in the following format:

FUNCTION,return-type,parameters 

Prototyping Routines Implemented IN SUPER and Locally

A program might define a user-defined function IN SUPER and also implement the function locally. The local implementation might invoke its super version (by using the SUPER function), or might override it entirely. The programmer might write two prototypes, one FORWARD and the other IN SUPER. The Progress compiler permits this, and also verifies that the parameters of the prototype match those of the local definition.

Similarly, a program might define an internal procedure IN SUPER and also implement the internal procedure locally. (In this case, the program contains only one prototype, since internal procedures do not normally have prototypes.) The Progress compiler permits this.

In both cases, at run time, Progress invokes the local implementation.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095