GEOS SDK TechDocs
|
|
|
3 The GEOS Object System
|
4.1 Defining a New Class or Subclass
The previous sections dealt with the internals of the GEOS object system. This section describes how you can create classes and objects and manage them during execution using Goc keywords and kernel routines. Almost all Goc keywords begin with "
@
" (one notable exception is
gcnList
).
All the most useful keywords available in Goc are shown in Goc Keywords . This display is for initial reference; all the keywords are detailed in depth in the following sections of this chapter and in the Routines Book.
/* Including .goh files */ @include <fname>;
/* Defining New Classes and Subclasses */ @class <cname>, <super> [, master [, variant]]; @endc
/* Declaring a class */ @classdecl <cname> [, <cflags>];
/* Defining messages for a class */ @message <retType> <mname>([@stack] <param>*); @reserveMessages <num>; @exportMessages <expName>, <num>; @importMessage <expName>, <messageDef>; @alias(<protoMsg>) <messageDef>; @prototype <messageDef>;
/* Defining instance data fields for a class */ @instance <insType> <iname> [ = <default>]; gcnList(<manufID>, <ltype>) = <oname> [, <oname>]*; @instance @composite <iname> [ = <linkName>]; @instance @link <iname> [ = <default>]; @instance @visMoniker <iname> [ = <default>]; @instance @kbdAccelerator <iname> [ = <default>]; @reloc <iname>, [ (<count>, <struct>), ] <ptrType>; @noreloc <iname>; @default <iname> = <default>;
/* Defining vardata fields for a class */ @vardata <type> <vname>; @vardataAlias (<origName>) <newType> <newName>; @reloc <vname>, <fn>, [ (<count>, <struct>), ] <ptrType>;
/* Defining methods (message handlers) */ @method [ <hname>, ] <cname>[, <mname>+]; @method [ <hname>, ] <cname>, _reloc;
/* Defining library code */ @optimize @deflib <libname> @endlib
/* Defining resources */
@start <segname> [ , <flags> ];
@header <type> [ = <init> ];
@end <segname>
@chunk <type> <name> [ = <init> ];
@localize <string>;
@localize { <string> <length>};
@localize { <string> <minLength>-<maxLength> };
@localize not;
@chunkArray <stype> <aname> [ = {<init>} ];
@elementArray <stype> <aname> [ = {<init>} ];
@extern <type> <name>;
@gstring <name> = {[<command> [, <command>]+]} ;
/* Declaring an object */
@object <class> <name> <flags>* = {
[<fieldName> = <init>];*
[<varName> [ = <init> ]]*;
}
/* Accessing an object's instance data from one of its methods */ @self-><iname>
/* Sending and calling messages */
@send [<flags>,+] <obj>::[{<cast>}] <msg>(<params>*);
<ret> = @call [<flags>,+] [{<cast>}] <obj>::[{<cast2>}]<msg>(<params>*);
@callsuper();
@callsuper <obj>::<class>::<msg>(<params>*) [<flags>,];
<event> = @record <obj>::<msg>(<params>*);
@dispatch [noFree] <nObj>::<nMsg>::<event>;
<ret> = @dispatchcall [noFree] [{<cast>}] <nobj>::<nMsg>::<event>;
/* Using conditional code */ @if <cond> @if defined(<item>) @ifdef <cond> @ifndef <cond>
/* Creating Goc macros */ @define <mname> <macro>
/* Esoteric Source-Code Management */ @optimize @protominor <name>
Defining a New Class or Subclass
GEOS SDK TechDocs
|
|
|
3 The GEOS Object System
|
4.1 Defining a New Class or Subclass