home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
CLIPPER
/
OBJECT
/
OBJECTS.CH
< prev
next >
Wrap
Text File
|
1992-12-04
|
3KB
|
57 lines
// (c) Antonio Linares, 1992 - Spain
// I give this version to Public Domain. Feel free to use it.
// You can create new classes, you can use the debugger and you have
// multiple inheritance. It is very fast and usefull.
// Some prgs are included as examples. I would like to get your feedback
// and instructions to join it to NanForum Lib. I will give all the source
// code.
// CompuServe Id: 100114, 1776. I would like to get your messages!
// Objects.ch
//----------------------------------------------------------------------------//
#xcommand DEFAULT <uVar1> = <uDefaultValue1> ;
[, <uVarN> = <uDefaultValueN> ] => ;
<uVar1> = If( <uVar1> == nil, <uDefaultValue1>, <uVar1> ) ;;
[ <uVarN> = If( <uVarN> == nil, <uDefaultValueN>, <uVarN> );]
#xcommand CLASS <cClassName> [ FROM <cSuperNam1>] [ ,<cSuperNamN> ] => ;
function <cClassName>() ;;
static nClassHandle, abParents ;;
if nClassHandle == nil ;;
ClsNew( <"cClassName"> , ;
abParents := { [ { || <cSuperNam1>() } ] ;
[,{ || <cSuperNamN>() } ] } ) ;;
[#define PARENT <"cSuperNam1">]
#xcommand DATA <cVar1> [,<cVarN>] => ;
ClsAddData( <"cVar1">, 0 ) ;
[; ClsAddData( <"cVarN">, 0 ) ]
#xcommand METHOD <cMethodName>( [<uParms,...>] ) => ;
ClsAddMethod( Upper( <"cMethodName"> ), ;
{ | Self [, <uParms> ] | <cMethodName>( Self [, <uParms> ] ) } )
#xcommand METHOD <cMethodName>( [<parms,...>] ) VIRTUAL => ;
ClsAddMethod( Upper( <"cMethodName"> ), { || nil } )
#xcommand ENDCLASS => ;
nClassHandle = nClsMake() ;;
end ;;
return __ClassIns( nClassHandle )
#xtranslate :: => Self:
#xtranslate METHOD <cClassName>::<cMethodName>( [<uParms,...>] ) => ;
static function <cMethodName>( Self[, <uParms>] )
#xtranslate ::Parent:<method>([<uParms,...>]) => ;
Eval( bClsMethod( Upper( PARENT ), Upper( <"method"> ) ), ;
Self [,<uParms>] )
//----------------------------------------------------------------------------//