Tcl method invocation functions
Description
The functions in this file are responsible for actually executing
the messages sent to objects. They find out which method to call
for a given object/message and call this method with the appropriate
attributes. There are also routines that handle error reporting and
debugging.
Copyright (c) 1995 by softWorks. All Rights Reserved.
File: method.c
Author: Richard Schwaninger
Date: 30/10/1995
System: ithron.softworks.co.at
RCS: $Id: c_method.c,v 1.1 1996/08/30 08:48:44 /SW/app Exp /SW/app $
OO_ThatCmd - call some method in parent
Description
This function is responsible for calling a message in the parent
context. It notes the current context of the object, finds the
method corresponding to the given message in one of the parents
and executes that message with the given arguments.
If more than one parent has a method for the given message then
they are all executed (in an arbitrary order). If a TCL_ERROR or
a TCL_BREAK code is returned from a call then this chaining is
aborted and in the first case an error is returned.
This function implements the tcl command OO_That and in turn the
call sequence $That msg ...
Here is an example:
Method bla { a1 a2 } {
$That bla $a1
puts "$a2"
}
Arguments
This command has the standard tcl call syntax.
Return Value
Returns a standard tcl result code and sets interp->result.
OO_EvalMethod - evaluate method command
Description
This function takes the given arguments, find's a method to call for the
give message, builds up the corresponding tcl string and then evaluates
this string. If an error happens then the corresponding error message
is tried and called, otherwise the error is returned.
If the method cannot be found anywhere in the inheritance chain then
the Unknown message is sent to the current object (if that does not
exist too then an error happens).
Just before and just after the method invocation the object debugger
entry is called (if enabled) so we can check and modify arguments.
Arguments.
- interp
- Pointer to current interpreter
- Class
- Name of class for the current object
- This
- Object name for the current object
- Msg
- The message signature that was sent to the current object
- argc
- number of arguments for this message
- argv
- list of actual arguments for this message
Return Value
This function returns a Tcl_Result-code, either obtained by calling
OO_Eval() or from the method lookup. It returns TCL_BREAK to
signify something special, but I don't know what.
OO_EvalMethodCmd - method evaluator
Description
This routine is the procedure visible in the tcl interpreter. It does
some simple housekeeping and allows for debugging before calling the
main evaluator routine OO_EvalMethod.
Arguments
This command has the standard tcl call syntax
Return Value
The function returns either TCL_OK or TCL_ERROR to indicate
success or failure of the call.