home *** CD-ROM | disk | FTP | other *** search
- /*
-
- XCLASS
- Librería-extensión Orientada al Objeto para Clipper 5.01
- (x) 1993 Carlos Ruiz Ruiz
-
- Versión 2.0 - Marzo, 1993
- */
-
- #ifndef _SET_DEFINED
- #include "set.ch"
- #endif
-
- #define XCTRL ,,,,,,,,,,,,,,,,.f.
-
- #command CLASS <name> [Inherit] [FROM <parent> [, <parentN>] ] => ;
- FUNCTION <name>( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, _Xinit );;
- STATIC hClass, __bErr, bCons;;
- LOCAL oNew, OldSetExact;;
- if hClass == NIL;;
- __bErr := ErrorBlock( { | oError | Eval( __bErr, oError ) } ) ;;
- OldSetExact := set( _SET_EXACT, .t. );;
- __DefineClass( <"name">,{ [{|| <parent>( XCTRL ) }] [, {|| <parentN>( XCTRL ) } ] } );;
- [#define PARENTCLASS #<parent>]
-
- #command protected => //Protected
- #command Exported => //Exported
- #command Read Only => //Read Only
-
- #command Protected Methods => //Protected Methods
- #command Public Methods => //Public Methods
- #command Private Methods => //Private Methods
-
- #xcommand VAR <var1> [HIDDEN] [READONLY] [, <*VarN*>] => ;
- __AddVar( <"var1"> ) [; VAR <VarN>]
-
- #xcommand DATA <*formals*> => VAR <formals>
-
-
- #command MESSAGE <mess> METHOD <udf> [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <udf>();
- [ ;MESSAGE <formals> ]
-
- #command MESSAGE <mess> METHOD <udf>() [, <*formals*> ] => ;
- __AddMethod( { <"mess">, <"udf">, { | Self | <udf>( Self ) } } );
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess> METHOD <udf>( <arg> [, <argN>] ) [, <*formals*> ] => ;
- __AddMethod( { <"mess">, <"udf">, { | Self, <arg> [, <argN>] | <udf>( <arg> [, <argN> ], Self ) } } );
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess> [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <mess>();
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess>() METHOD <udf> [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <udf>;
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess>(<arg,...>) METHOD <udf> [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <udf>( [<arg>] );
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess>([<arg,...>]) METHOD <udf>() [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <udf>( [<arg>] );
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess>([<u,...>]) METHOD <udf>( [<arg>,...> ] ) [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <udf>( [<arg>] );
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess>([<arg,...>]) [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <mess>( [<arg>] );
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess>() [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <mess>();
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess> BLOCK <cblock> [, <*formals*> ] => ;
- __AddMethod( { <"mess">, ,<cblock> } );
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess>([<u,...>]) BLOCK <cblock> [, <*formals*> ] =>;
- MESSAGE <mess> BLOCK <cblock>;
- [ ;MESSAGE <formals> ]
-
-
- #command MESSAGE <mess> = <udf> [, <*formals*> ] => ;
- MESSAGE <mess> METHOD <udf>;
- [ ;MESSAGE <formals> ]
-
- #command MESSAGE <mess> VIRTUAL [, <*formals*>] => ;
- MESSAGE <mess> BLOCK {||NIL};
- [ ;MESSAGE <formals> ]
-
- #xcommand CONSTRUCTOR <Mess> METHOD <Meth>( [<arg1>] [,<argN>] ) => ;
- bCons := {| Self [, <arg1>][, <argN> ] | <Meth>( [<arg1>,][<argN>,] Self ) };;
- MESSAGE <Mess> METHOD <Meth>( [<arg1>] [,<argN>] )
-
- #xcommand CONSTRUCTOR <Mess>( [<x,...>] ) => CONSTRUCTOR <Mess> METHOD <Mess>( [<x>] )
-
- #xcommand RENAME [METHOD] [MESSAGE] <OldMess> [=] [TO] [AS] <NewMess> [, <*MessN*> ] => ;
- __RenMethod( <"OldMess">, <"NewMess"> ) [; RENAME <MessN>]
-
- #xcommand RENAME VAR <OldVar> [=] [TO] [AS] <NewVar> [, <*VarN*> ] => ;
- __RenVar( <"OldVar">, <"NewVar"> ) [; RENAME VAR <VarN>]
-
- #xcommand DELETE MESSAGE <mess> => __DelMethod( <"mess"> )
- #xcommand DELETE METHOD <mess> => __DelMethod( <"mess"> )
-
- #xcommand DELETE VAR <Var> => __DelVar( <"Var"> )
-
-
- #xcommand END CLASS [<*formals*>] => ENDCLASS
-
- #xcommand ENDCLASS [<*formals*>] => ;
- hClass := __XClassNew();;
- set( _SET_EXACT, OldSetExact );;
- end;;
- oNew := __ClassIns(hClass);;
- if bCons != NIL .and. _XInit == NIL;;
- eval( bCons, oNew, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16 );;
- end;;
- RETURN oNew
-
- #xtranslate :: => self:
-
- #ifdef DEBUG
- #command METHOD [FUNCTION] <MName>( [<arg,...>] ) => ;
- FUNCTION <MName>( [<arg>, ] xSelf );;
- LOCAL Self := if( xSelf == NIL, Qself(), xSelf );;
- LOCAL __bErr := ErrorBlock( { | oError | Eval( __bErr, oError ) } )
-
- #command METHOD PROCEDURE <MName>( [<arg,...>] ) => ;
- PROCEDURE <MName>( [<arg>, ] xSelf );;
- LOCAL Self := if( xSelf == NIL, Qself(), xSelf );;
- LOCAL __bErr := ErrorBlock( { | oError | Eval( __bErr, oError ) } )
-
- #else
- #command METHOD [FUNCTION] <MName>( [<arg,...>] ) => ;
- FUNCTION <MName>( [<arg>, ] xSelf );;
- LOCAL Self := if( xSelf == NIL, Qself(), xSelf )
-
- #command METHOD PROCEDURE <MName>( [<arg,...>] ) => ;
- PROCEDURE <MName>( [<arg>, ] xSelf );;
- LOCAL Self := if( xSelf == NIL, Qself(), xSelf )
-
- #endif
-
- #translate :super( <pcl> ):<mess>( [<argN, ...>] ) => eval( superBlock( <(pcl)>, upper(<(mess)>) ), self [, <argN>] )
-
- #translate :super():<mess>( [<argN, ...>] ) => eval( superBlock( PARENTCLASS, upper(<(mess)>) ), self [, <argN>] )
-
- #translate :qsuper( <pcl>, <static> ):<mess>( [<argN, ...>] ) => eval( if( <static> == nil, <static> := superBlock( <(pcl)>, upper(<(mess)>), @<static> ), <static>), self [,<argN>] )
- #translate :qsuper( <static> ):<mess>( [<argN, ...>] ) => eval( if( <static> == nil, <static> := superBlock( PARENTCLASS, upper(<(mess)>), @<static> ), <static>), self [,<argN>] )
-
- #translate ::parent:<mess>( [<args,...>] ) => ;
- :super():<mess>( [<args>] )
-
-