<idProcedure> is the name of the user-defined procedure to declare. Please see the CA-Clipper guides for more information.
<idParam> is the declaration of one or more parameter variables. Variables specified in this list are declared local.
AS|ASREF indicates whether the parameter is expected to be normal or passed by reference. AS specifies a normal parameter and ASREF specifies a parameter that is expected to be passed by reference. If you specify AS, and the parameter is passed by reference, then no error will be given, as program behaviour is not effected.
<idType> is the type of the parameter. For the PROCEDURE statement, this is called every time the procedure is called.
Description
This allows you to define a procedure which will, at run time, check the parameter types that have been passed to it. For example, if you define a procedure as:
PROCEDURE Foo(nNumber1 AS INT, nNumber2 AS INT) RETURN
And you call this procedure with:
Foo(1, 1.1)
The MrDebug will pop up with the following message in the Assert/Trace window:
Param 2 is not type INT
And the program will stop at that point for your inspection. So you can take a look at the calling routine to see what has caused the problem.
Notes
The allowable types for <idType> are:
CHARACTER A character string STRING A character string (Same as CHARACTER) NUMERIC A number of any specification INTEGER A numeric integer (no decimal places) INT A numeric integer (no decimal places) FLOAT A floating pointer number LOGICAL A logical value DATE A date value BLOCK A code block CODEBLOCK A code block ARRAY An array of any length OBJECT An object of any class ANY Any data type USUAL Any data type (Same as ANY)
Example
■ This example shows a function declaration with the second parameter passed by reference.
PROCEDURE Message(nCounter AS INT, cPrompt AS REF)