BEGIN_METHOD

#define BEGIN_METHOD ( name , arguments ) ...

Begins the implementation of a method.

Be careful ! As the implementation function will receive its arguments as a pointer at the interpreter stack, arguments is in fact the inside of a structure describing the stack contents.

Consequently :

The Gambas datatypes can be :

Gambas datatype Signature pattern Corresponding structure
Boolean "b" GB_BOOLEAN
Integer "i" GB_INTEGER
Float "f" GB_FLOAT
String "s" GB_STRING
Date "d" GB_DATE
Object "o" GB_OBJECT
Variant "v" GB_VARIANT
a class named Abc "Abc" GB_OBJECT

Example :

A method named foo declared this way :

  ...
  GB_METHOD("foo", NULL, "iisvbInteger[];d", do_foo),
  ...

will be implemented this way :

  BEGIN_METHOD(do_foo,
    GB_INTEGER param1;
    GB_INTEGER param2;
    GB_STRING param3;
    GB_VARIANT param4;
    GB_BOOLEAN param5;
    GB_OBJECT param6;
    GB_DATE param7)

  ...

  END_METHOD

Note that semicolons delimitate arguments, and that the last argument has no semicolon at its end.


Referenced by :