2007-09-18 00:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbapicls.h
  * harbour/source/vm/hvm.c
    + added hb_clsDoInit() function to initialize classy .prg functions

  * harbour/source/compiler/complex.c
    * allow to use NIL as class name

  * harbour/source/compiler/harbour.yyc
  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/harbour.yyh
    % optimize automatically var[0] declaration and generate the same
      PCODE as for var:={}

  * harbour/source/rtl/tscalar.prg
    + added HASH, POINTER and SYMBOL scalar classes
    * changed NIL class to not use any instance variables

  * harbour/source/vm/classes.c
    + added support for scalar classes. Now at startup classy code looks
      for hb<TYPENAME> functions and try to execute them to register
      scalar classes. It's Class(y) compatible behavior and only the prefix
      of scalar ceases class function is different: 'CSY' in class(y) and
      'HB' in Harbour, f.e.: hbNumeric()
      If you prefer xHarbour like not automatic scalar class registration
      with some PP commands:
         ASSOCIATE CLASS <ClassName> WITH TYPE
                           ARRAY|BLOCK|CHARACTER|DATE|HASH|LOGICAL|NIL|
                           NUMERIC|POINTER|SYMBOL
         ENABLE CLASS TYPE ALL
         ENABLE TYPE CLASS ARRAY|BLOCK|CHARACTER|DATE|HASH|LOGICAL|NIL|
                           NUMERIC|POINTER|SYMBOL
         EXTEND [TYPE] ARRAY|BLOCK|CHARACTER|DATE|HASH|LOGICAL|NIL|
                       NUMERIC|POINTER|SYMBOL WITH METHOD <SomeFunc>
      Then I can replace current code with it. If not then we should
      divide scalar cases definitions into separated files to allow
      easier overloading. I'm interesting in your opinions.
This commit is contained in:
Przemyslaw Czerpak
2007-09-17 22:45:30 +00:00
parent 683744e6ca
commit 72eca3d3e9
9 changed files with 925 additions and 665 deletions

View File

@@ -8,6 +8,44 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-09-18 00:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapicls.h
* harbour/source/vm/hvm.c
+ added hb_clsDoInit() function to initialize classy .prg functions
* harbour/source/compiler/complex.c
* allow to use NIL as class name
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyh
% optimize automatically var[0] declaration and generate the same
PCODE as for var:={}
* harbour/source/rtl/tscalar.prg
+ added HASH, POINTER and SYMBOL scalar classes
* changed NIL class to not use any instance variables
* harbour/source/vm/classes.c
+ added support for scalar classes. Now at startup classy code looks
for hb<TYPENAME> functions and try to execute them to register
scalar classes. It's Class(y) compatible behavior and only the prefix
of scalar ceases class function is different: 'CSY' in class(y) and
'HB' in Harbour, f.e.: hbNumeric()
If you prefer xHarbour like not automatic scalar class registration
with some PP commands:
ASSOCIATE CLASS <ClassName> WITH TYPE
ARRAY|BLOCK|CHARACTER|DATE|HASH|LOGICAL|NIL|
NUMERIC|POINTER|SYMBOL
ENABLE CLASS TYPE ALL
ENABLE TYPE CLASS ARRAY|BLOCK|CHARACTER|DATE|HASH|LOGICAL|NIL|
NUMERIC|POINTER|SYMBOL
EXTEND [TYPE] ARRAY|BLOCK|CHARACTER|DATE|HASH|LOGICAL|NIL|
NUMERIC|POINTER|SYMBOL WITH METHOD <SomeFunc>
Then I can replace current code with it. If not then we should
divide scalar cases definitions into separated files to allow
easier overloading. I'm interesting in your opinions.
2007-09-17 18:41 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* source/rtl/tbrowsys.prg
* source/rtl/getsys.prg

View File

@@ -90,6 +90,7 @@ HB_EXTERN_BEGIN
#define HB_OO_MAX_OPERATOR 26
extern void hb_clsInit( void ); /* initialize Classy/OO system at HVM startup */
extern void hb_clsDoInit( void ); /* initialize Classy/OO system .prg functions */
extern void hb_clsReleaseAll( void ); /* releases all defined classes */
extern void hb_clsIsClassRef( void ); /* classes.c - mark all class internals as used */
extern BOOL hb_clsHasDestructor( USHORT uiClass );

View File

@@ -94,6 +94,7 @@
#define LARRAY -7
#define RARRAY -8
#define AS_TYPE -9
#define DECLARE_TYPE -10
typedef struct
@@ -383,6 +384,7 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
case RETURN:
case WITH:
case WHILE:
case DECLARE_TYPE:
pLex->iState = LITERAL;
hb_pp_tokenToString( pLex->pPP, pToken );
pLex->lasttok = hb_comp_tokenString( yylval_ptr, HB_COMP_PARAM,
@@ -1075,6 +1077,7 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
int iAs = hb_comp_asType( pToken->pNext, FALSE );
if( iAs )
{
pLex->iState = DECLARE_TYPE;
pToken = hb_pp_tokenGet( pLex->pPP );
if( iAs == AS_ARRAY && pToken->pNext &&
HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_KEYWORD &&
@@ -1094,6 +1097,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
break;
}
case DECLARE_CLASS:
pLex->iState = DECLARE_TYPE;
return iType;
case DECLARE_MEMBER:
pLex->iState = OPERATOR;
return iType;
@@ -1107,9 +1112,12 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
}
break;
case NIL:
if( pLex->iState == DECLARE_TYPE )
iType = IDENTIFIER;
break;
case IN:
case LOOP:
case NIL:
case STEP:
case TO:
case ANNOUNCE:

View File

@@ -75,6 +75,7 @@ static void hb_compElseIfFix( HB_COMP_DECL, void * pIfElseIfs ); /* implements t
static void hb_compRTVariableAdd( HB_COMP_DECL, HB_EXPR_PTR, BOOL );
static void hb_compRTVariableGen( HB_COMP_DECL, char * );
static HB_EXPR_PTR hb_compArrayDimPush( HB_EXPR_PTR pInitValue, HB_COMP_DECL );
static void hb_compVariableDim( char *, HB_EXPR_PTR, HB_COMP_DECL );
static void hb_compForStart( HB_COMP_DECL, char *szVarName, BOOL bForEach );
@@ -1127,9 +1128,7 @@ ExtVarDef : VarDef
}
| MacroVar DimList AsArrayType
{
USHORT uCount = (USHORT) hb_compExprListLen( $2 );
HB_COMP_EXPR_DELETE( hb_compExprGenPush( $2, HB_COMP_PARAM ) );
hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM );
HB_COMP_EXPR_DELETE( hb_compArrayDimPush( $2, HB_COMP_PARAM ) );
hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), TRUE );
}
;
@@ -2345,50 +2344,59 @@ void hb_compRTVariableKill( HB_COMP_DECL )
HB_COMP_PARAM->rtvars = NULL;
}
static HB_EXPR_PTR hb_compArrayDimPush( HB_EXPR_PTR pInitValue, HB_COMP_DECL )
{
USHORT uCount = (USHORT) hb_compExprListLen( pInitValue );
if( uCount == 1 && hb_compExprIsInteger( pInitValue->value.asList.pExprList ) &&
hb_compExprAsInteger( pInitValue->value.asList.pExprList ) == 0 )
{
hb_compGenPCode3( HB_P_ARRAYGEN, 0, 0, HB_COMP_PARAM );
}
else
{
pInitValue = hb_compExprGenPush( pInitValue, HB_COMP_PARAM );
hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM );
}
return pInitValue;
}
static void hb_compVariableDim( char * szName, HB_EXPR_PTR pInitValue, HB_COMP_DECL )
{
if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE )
{
USHORT uCount = (USHORT) hb_compExprListLen( pInitValue );
hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' );
HB_COMP_EXPR_DELETE( hb_compExprGenPush( pInitValue, HB_COMP_PARAM ) );
hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM );
hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( szName, NULL, HB_COMP_PARAM ), TRUE );
}
else if( HB_COMP_PARAM->iVarScope == VS_STATIC )
{
USHORT uCount = (USHORT) hb_compExprListLen( pInitValue );
HB_EXPR_PTR pVar = hb_compExprNewVar( szName, HB_COMP_PARAM );
HB_EXPR_PTR pAssign;
if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE )
{
hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' );
HB_COMP_EXPR_DELETE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) );
hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( szName, NULL, HB_COMP_PARAM ), TRUE );
}
else if( HB_COMP_PARAM->iVarScope == VS_STATIC )
{
HB_EXPR_PTR pVar = hb_compExprNewVar( szName, HB_COMP_PARAM );
HB_EXPR_PTR pAssign;
/* create a static variable */
hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' );
hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */
/* create an array */
hb_compExprGenPush( pInitValue, HB_COMP_PARAM );
hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM );
/* check if valid initializers were used but don't generate any code */
pAssign = hb_compExprAssignStatic( pVar, pInitValue, HB_COMP_PARAM );
/* now pop an array */
hb_compExprGenPop( pVar, HB_COMP_PARAM );
/* delete all used expressions */
HB_COMP_EXPR_DELETE( pAssign );
hb_compStaticDefEnd( HB_COMP_PARAM, szName );
}
else
{
USHORT uCount = (USHORT) hb_compExprListLen( pInitValue );
hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' );
HB_COMP_EXPR_DELETE( hb_compExprGenPush( pInitValue, HB_COMP_PARAM ) );
hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM );
if( HB_COMP_PARAM->iVarScope != VS_LOCAL ||
!( HB_COMP_PARAM->functions.pLast->bFlags & FUN_EXTBLOCK ) )
{
HB_COMP_EXPR_DELETE( hb_compExprGenPop( hb_compExprNewVar( szName, HB_COMP_PARAM ), HB_COMP_PARAM ) );
}
}
/* create a static variable */
hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' );
hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */
/* create an array */
pInitValue = hb_compArrayDimPush( pInitValue, HB_COMP_PARAM );
/* check if valid initializers were used but don't generate any code */
pAssign = hb_compExprAssignStatic( pVar, pInitValue, HB_COMP_PARAM );
/* now pop an array */
hb_compExprGenPop( pVar, HB_COMP_PARAM );
/* delete all used expressions */
HB_COMP_EXPR_DELETE( pAssign );
hb_compStaticDefEnd( HB_COMP_PARAM, szName );
}
else
{
hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' );
HB_COMP_EXPR_DELETE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) );
if( HB_COMP_PARAM->iVarScope != VS_LOCAL ||
!( HB_COMP_PARAM->functions.pLast->bFlags & FUN_EXTBLOCK ) )
{
HB_COMP_EXPR_DELETE( hb_compExprGenPop( hb_compExprNewVar( szName, HB_COMP_PARAM ), HB_COMP_PARAM ) );
}
}
}
static void hb_compForStart( HB_COMP_DECL, char *szVarName, BOOL bForEach )

File diff suppressed because it is too large Load Diff

View File

@@ -262,7 +262,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 106 "harbour.y"
#line 107 "harbour.y"
{
char * string; /* to hold a string returned by lex */
int iNumber; /* to hold a temporary integer number */

View File

@@ -64,7 +64,7 @@ CREATE CLASS ScalarObject FUNCTION HBScalar
METHOD AsString()
METHOD AsExpStr()
MESSAGE Become METHOD BecomeErr() // a scalar cannot "become" another object
MESSAGE Become METHOD BecomeErr() /* a scalar cannot "become" another object */
MESSAGE DeepCopy METHOD Copy()
ENDCLASS
@@ -79,10 +79,14 @@ METHOD AsString() CLASS ScalarObject
SWITCH ValType( Self )
CASE "B" ; RETURN "{ || ... }"
CASE "M"
CASE "C" ; RETURN Self
CASE "D" ; RETURN DToC( Self )
CASE "H" ; RETURN "{ ... => ... }"
CASE "L" ; RETURN iif( Self, ".T.", ".F." )
CASE "N" ; RETURN LTrim( Str( Self ) )
CASE "S" ; RETURN "@" + Self:name + "()"
CASE "P" ; RETURN "<0x...>"
CASE "U" ; RETURN "NIL"
ENDSWITCH
@@ -91,6 +95,7 @@ METHOD AsString() CLASS ScalarObject
METHOD AsExpStr() CLASS ScalarObject
SWITCH ValType( Self )
CASE "M"
CASE "C" ; RETURN '"' + Self + '"'
CASE "D" ; RETURN 'CToD("' + DToC( Self ) + '")'
ENDSWITCH
@@ -209,12 +214,11 @@ METHOD Do( b ) CLASS Array
METHOD IndexOf( x ) CLASS Array
LOCAL nElems := Len( Self )
LOCAL i
LOCAL elem
FOR i := 1 TO nElems
IF Self[ i ] == x
RETURN i
FOR EACH elem IN Self
IF elem == x
RETURN elem:__enumIndex()
ENDIF
NEXT
@@ -278,6 +282,17 @@ METHOD AsExpStr() CLASS Date
/* -------------------------------------------- */
CREATE CLASS Hash INHERIT HBScalar FUNCTION HBHash
METHOD AsString()
ENDCLASS
METHOD AsString() CLASS Hash
RETURN "{ ... => ... }"
/* -------------------------------------------- */
CREATE CLASS Logical INHERIT HBScalar FUNCTION HBLogical
METHOD AsString()
@@ -289,15 +304,13 @@ METHOD AsString() CLASS Logical
/* -------------------------------------------- */
CREATE CLASS HBNil INHERIT HBScalar
VAR ClassName INIT "NIL"
CREATE CLASS Nil INHERIT HBScalar FUNCTION HBNil
METHOD AsString()
ENDCLASS
METHOD AsString() CLASS HBNil
METHOD AsString() CLASS Nil
RETURN "NIL"
/* -------------------------------------------- */
@@ -312,3 +325,25 @@ METHOD AsString() CLASS Numeric
RETURN LTrim( Str( Self ) )
/* -------------------------------------------- */
CREATE CLASS Symbol INHERIT HBScalar FUNCTION HBSymbol
METHOD AsString()
ENDCLASS
METHOD AsString() CLASS Symbol
RETURN "@" + Self:name + "()"
/* -------------------------------------------- */
CREATE CLASS Pointer INHERIT HBScalar FUNCTION HBPointer
METHOD AsString()
ENDCLASS
METHOD AsString() CLASS Pointer
RETURN "<0x...>"
/* -------------------------------------------- */

View File

@@ -339,6 +339,20 @@ static HB_SYMB s___msgWithObjectPop = { "___WITHOBJECT", {HB_FS_MESSAGE}, {hb__
static PCLASS s_pClasses = NULL;
static USHORT s_uiClasses = 0;
/*
* Scalar classes' handles
*/
static USHORT s_uiArrayClass = 0;
static USHORT s_uiBlockClass = 0;
static USHORT s_uiCharacterClass = 0;
static USHORT s_uiDateClass = 0;
static USHORT s_uiHashClass = 0;
static USHORT s_uiLogicalClass = 0;
static USHORT s_uiNilClass = 0;
static USHORT s_uiNumericClass = 0;
static USHORT s_uiSymbolClass = 0;
static USHORT s_uiPointerClass = 0;
/* ================================================ */
@@ -984,6 +998,39 @@ void hb_clsInit( void )
s___msgWithObjectPop.pDynSym = hb_dynsymGetCase( s___msgWithObjectPop.szName );
}
/*
* initialize Classy/OO system .prg functions
*/
void hb_clsDoInit( void )
{
static const char * s_pszFuncNames[] =
{ "HBARRAY", "HBBLOCK", "HBCHARACTER", "HBDATE",
"HBHASH", "HBLOGICAL", "HBNIL", "HBNUMERIC",
"HBSYMBOL", "HBPOINTER" };
static USHORT * s_puiHandles[] =
{ &s_uiArrayClass, &s_uiBlockClass, &s_uiCharacterClass, &s_uiDateClass,
&s_uiHashClass, &s_uiLogicalClass, &s_uiNilClass, &s_uiNumericClass,
&s_uiSymbolClass, &s_uiPointerClass };
int i;
HB_TRACE(HB_TR_DEBUG, ("hb_clsDoInit()"));
for( i = 0; i < ( int ) ( sizeof( s_puiHandles ) / sizeof( USHORT * ) ); ++i )
{
PHB_DYNS pFuncSym = hb_dynsymFindName( s_pszFuncNames[i] );
if( pFuncSym && hb_dynsymIsFunction( pFuncSym ) )
{
PHB_ITEM pObject;
hb_vmPushDynSym( pFuncSym );
hb_vmPushNil();
hb_vmDo(0);
pObject = hb_stackReturnItem();
if( HB_IS_OBJECT( pObject ) )
*( s_puiHandles[i] ) = pObject->item.asArray.value->uiClass;
}
}
}
/*
* hb_clsRelease( <pClass> )
*
@@ -1407,6 +1454,26 @@ static PHB_SYMB hb_clsValidScope( PMETHOD pMethod, PHB_STACK_STATE pStack )
return pMethod->pFuncSym;
}
static PHB_SYMB hb_clsScalarMethod( PCLASS pClass, PHB_DYNS pMsg,
PHB_STACK_STATE pStack )
{
PMETHOD pMethod = hb_clsFindMsg( pClass, pMsg );
if( pStack )
{
pStack->uiClass = pClass - s_pClasses;
if( pMethod )
{
pStack->uiMethod = ( USHORT ) ( pMethod - pClass->pMethods );
return hb_clsValidScope( pMethod, pStack );
}
}
else if( pMethod )
return pMethod->pFuncSym;
return NULL;
}
static void hb_clsMakeSuperObject( PHB_ITEM pDest, PHB_ITEM pObject,
USHORT uiSuperClass )
{
@@ -1445,18 +1512,23 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage,
pClass = &s_pClasses[ pObject->item.asArray.value->uiClass ];
if( pStack )
{
pStack->uiClass = pObject->item.asArray.value->uiClass;
if( pObject->item.asArray.value->uiPrevCls )
{
/*
* Copy real object - do not move! the same super casted
* object can be used more then once and we mustn't destroy it.
* We can safely use hb_stackReturnItem() here.
*/
hb_itemCopy( hb_stackReturnItem(), pObject->item.asArray.value->pItems );
/* move real object back to the stack */
hb_itemMove( pObject, hb_stackReturnItem() );
if( pObject->item.asArray.value->ulLen )
{
/*
* Copy real object - do not move! the same super casted
* object can be used more then once and we mustn't
* destroy it. We can safely use hb_stackReturnItem() here.
*/
hb_itemCopy( hb_stackReturnItem(), pObject->item.asArray.value->pItems );
/* move real object back to the stack */
hb_itemMove( pObject, hb_stackReturnItem() );
}
else
/* Someone tried to manipulate with supercast array */
hb_itemClear( pObject );
}
#ifdef HB_MSG_POOL
{
@@ -1493,11 +1565,25 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage,
return pMethod->pFuncSym;
}
}
else if( s_uiArrayClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiArrayClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
}
else if( HB_IS_BLOCK( pObject ) )
{
if( pMsg == hb_symEval.pDynSym )
return &hb_symEval;
else if( s_uiBlockClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiBlockClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
}
else if( HB_IS_BYREF( pObject ) )
{
@@ -1561,6 +1647,13 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage,
}
else if( HB_IS_SYMBOL( pObject ) )
{
if( s_uiSymbolClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiSymbolClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
if( pMsg == s___msgExec.pDynSym || pMsg == hb_symEval.pDynSym )
{
if( ! pObject->item.asSymbol.value->value.pFunPtr &&
@@ -1578,6 +1671,14 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage,
}
else if( HB_IS_HASH( pObject ) )
{
if( s_uiHashClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiHashClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
if( pMsg == s___msgKeys.pDynSym )
{
hb_itemRelease( hb_itemReturnForward( hb_hashGetKeys( pObject ) ) );
@@ -1618,6 +1719,66 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage,
}
#endif
}
else if( HB_IS_STRING( pObject ) )
{
if( s_uiCharacterClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiCharacterClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
}
else if( HB_IS_DATE( pObject ) )
{
if( s_uiDateClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiDateClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
}
else if( HB_IS_NUMERIC( pObject ) )
{
if( s_uiNumericClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiNumericClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
}
else if( HB_IS_LOGICAL( pObject ) )
{
if( s_uiLogicalClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiLogicalClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
}
else if( HB_IS_POINTER( pObject ) )
{
if( s_uiPointerClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiPointerClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
}
else if( HB_IS_NIL( pObject ) )
{
if( s_uiNilClass )
{
PHB_SYMB pExecSym = hb_clsScalarMethod( &s_pClasses[ s_uiNilClass ],
pMsg, pStack );
if( pExecSym )
return pExecSym;
}
}
/* Default messages here */
if( pMsg == s___msgWithObjectPush.pDynSym )

View File

@@ -439,6 +439,7 @@ HB_EXPORT void hb_vmInit( BOOL bStartMainProc )
* and not depends on INIT clause.
*/
hb_vmDoInitClip();
hb_clsDoInit(); /* initialize Classy .prg functions */
hb_vmDoModuleInitFunctions(); /* process AtInit registered functions */
hb_vmDoInitFunctions(); /* process defined INIT functions */