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 INTERNAL–ENTRIES attribute, which lists the procedure file’s internal procedures and user-defined functions. At run time, the programmer can examine the INTERNAL–ENTRIES attribute, and for each routine on the list, can invoke the GET–SIGNATURE 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 INTERNAL–ENTRIES attribute of a procedure file other than the original, and the routine’s signature is not returned by the GET–SIGNATURE 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:
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, GET–SIGNATURE(proc–name) returns the signature in the following format:
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:
function–name
The name of the user-defined function.
return–type
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 INTERNAL–ENTRIES attribute of the super procedure, and invoke the GET–SIGNATURE method for the function, GET–SIGNATURE returns the signature in the following format:
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 |