The <tt>DEFMETHOD</tt> Statement



next up previous contents
Next: The ENDMETHOD Statement Up: C.3 The VOOPS Syntax Previous: The DEFFLAG Statement

The DEFMETHOD Statement

   

The method name is defined on class with this statement which should appear only in template source files. The return type is determined by type-expr, and the method is documented through the documentation string. Possible arguments are declared through arg-def (see page gif for the syntax of type-expr and arg-def).

When evaluating the DEFMETHOD statement, VOOPS first searches for an existent class. If class is not found, possible class aliases are searched and expanded. However, no error occurs if the class does not exist already, since VOOPS may be run on the template source file before it is run on the template header file without any harm, provided that class is no alias! This makes VOOPS more error-tolerant, but the above restriction should be kept in mind. The current class is then set to class so that class-specific VOOPS statements (like SENDSELF, page gif) can be used too.

The new method is appended to the list of methods belonging to class, and code production starts with a function documentation comment according to VISTA conventions. The function is marked as being TACable using a ***TF documentation comment [Hala94]. A C function header is then generated, followed by the translation of the individual arguments arg-def. The documentation string of each argument is searched for a TAC argument type identifier enclosed in square brackets, and, if not found, is automatically inserted assuming the argument is of input type. Although there should never be an argument documentation without a TAC type specifier, this is also an error-tolerant feature of VOOPS. However, it may cause havoc when TACing the resulting code and the argument is not of the expected default input type.

The C function body is opened afterwards, and an error system start call to VeStart() is automatically inserted. If the first argument is of type SELF, code for checking the validity of the given object is produced and included between an #if CHECK - #endif pair.

The C code following the DEFMETHOD statement is considered to be the method implementation, where all arg-defs are available with their verbose names and their declared type.



next up previous contents
Next: The ENDMETHOD Statement Up: C.3 The VOOPS Syntax Previous: The DEFFLAG Statement



Martin Stiftinger
Tue Nov 29 19:41:50 MET 1994