2011-03-09 10:51 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbqt/hbmk2_qt.hbs
  * contrib/hbqt/qtcore/hbqt_pointer.cpp
    % Deleted HB_FUNC_EXTERN for locally defined function. Pls review me.
    ! Fixed formatting in generated code.
    + Added local __instantiate() function. Commented yet.
    % Converted method names to uppercase on invocation.
    + Added QUESTION about 'return;' in HB_<QCLASS>() functions.
      "INSTANCE" method is not called the first
      time this function is called.
This commit is contained in:
Viktor Szakats
2011-03-09 09:55:36 +00:00
parent e6a18ea0ba
commit 7382ee93a6
3 changed files with 57 additions and 24 deletions

View File

@@ -16,6 +16,17 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-03-09 10:51 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/hbmk2_qt.hbs
* contrib/hbqt/qtcore/hbqt_pointer.cpp
% Deleted HB_FUNC_EXTERN for locally defined function. Pls review me.
! Fixed formatting in generated code.
+ Added local __instantiate() function. Commented yet.
% Converted method names to uppercase on invocation.
+ Added QUESTION about 'return;' in HB_<QCLASS>() functions.
"INSTANCE" method is not called the first
time this function is called.
2011-03-09 09:30 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/qtgui/hbqtgui.hbx
* contrib/hbqt/qtwebkit/hbqtwebkit.hbx

View File

@@ -1378,8 +1378,8 @@ METHOD HbQtSource:build()
aadd( aLine, "HB_FUNC_EXTERN( " + uQtObject + " );" )
aadd( aLine, "" )
aadd( aLine, "HB_INIT_SYMBOLS_BEGIN( __HBQT_CLS_" + uQtObject + "__ )" )
// aadd( aLine, ' { "' + uQtObject + '", { HB_FS_PUBLIC | HB_FS_LOCAL }, { HB_FUNCNAME( ' + uQtObject + ' ) }, NULL },' )
aadd( aLine, ' { "HB_' + uQtObject + '", { HB_FS_PUBLIC | HB_FS_LOCAL }, { HB_FUNCNAME( HB_' + uQtObject + ' ) }, NULL }' )
// aadd( aLine, ' { "' + uQtObject + '", { HB_FS_PUBLIC | HB_FS_LOCAL }, { HB_FUNCNAME( ' + uQtObject + ' ) }, NULL },' )
aadd( aLine, ' { "HB_' + uQtObject + '", { HB_FS_PUBLIC | HB_FS_LOCAL }, { HB_FUNCNAME( HB_' + uQtObject + ' ) }, NULL }' )
aadd( aLine, "HB_INIT_SYMBOLS_END( __HBQT_CLS_" + uQtObject + "__ )" )
aadd( aLine, "" )
@@ -1389,32 +1389,54 @@ METHOD HbQtSource:build()
n := ascan( ::cls_, {|e_| left( lower( e_[ 1 ] ), 7 ) == "inherit" .and. !empty( e_[ 2 ] ) } )
s := upper( "HbQtObjectHandler" + iif( n > 0, ", " + strtran( ::cls_[ n, 2 ], "Q", "HB_Q" ), "" ) )
FOR EACH k IN hb_aTokens( s, "," )
aadd( aLine, "HB_FUNC_EXTERN( " + upper(alltrim(k)) + " );" )
aadd( aLine, "HB_FUNC_EXTERN( " + upper( alltrim( k ) ) + " );" )
NEXT
aadd( aLine, "HB_FUNC_EXTERN( HB_" + uQtObject + " );" )
// aadd( aLine, "HB_FUNC_EXTERN( HB_" + uQtObject + " );" )
aadd( aLine, "" )
#if 0
aadd( aLine, "static PHB_ITEM __instantiate()" )
aadd( aLine, "{" )
aadd( aLine, " static PHB_ITEM s_oClass = NULL;" )
aadd( aLine, " if( s_oClass == NULL )" )
aadd( aLine, " {" )
aadd( aLine, " s_oClass = hb_itemNew( NULL );" )
FOR EACH k IN hb_aTokens( s, "," )
aadd( aLine, " HB_FUNC_EXEC( " + Upper( AllTrim( k ) ) + " );" )
NEXT
aadd( aLine, ' PHB_ITEM oClass = hbqt_defineClassBegin( "' + uQtObject + '", s_oClass, "' + s + '" );' )
aadd( aLine, " if( oClass )" )
aadd( aLine, " {" )
aadd( aLine, " s_registerMethods( hb_objGetClass( hb_stackReturnItem() ) );" )
aadd( aLine, " hbqt_defineClassEnd( s_oClass, oClass );" )
aadd( aLine, " }" )
aadd( aLine, " return;" ) /* QUESTION: Is this intended here? */
aadd( aLine, " }" )
aadd( aLine, ' return s_oClass;' )
aadd( aLine, "}" )
aadd( aLine, "" )
#endif
aadd( aLine, "HB_FUNC( HB_" + uQtObject + " )" )
aadd( aLine, "{" )
aadd( aLine, " static PHB_ITEM s_oClass = NULL;" )
aadd( aLine, " if( s_oClass == NULL )" )
aadd( aLine, " {" )
aadd( aLine, " s_oClass = hb_itemNew( NULL );" )
aadd( aLine, " static PHB_ITEM s_oClass = NULL;" )
aadd( aLine, " if( s_oClass == NULL )" )
aadd( aLine, " {" )
aadd( aLine, " s_oClass = hb_itemNew( NULL );" )
FOR EACH k IN hb_aTokens( s, "," )
aadd( aLine, " HB_FUNC_EXEC( " + upper( alltrim( k ) ) + " );" )
aadd( aLine, " HB_FUNC_EXEC( " + Upper( AllTrim( k ) ) + " );" )
NEXT
aadd( aLine, ' PHB_ITEM oClass = hbqt_defineClassBegin( "' + uQtObject + '", s_oClass, "' + s + '" );' )
aadd( aLine, " if( oClass )" )
aadd( aLine, " {" )
aadd( aLine, " s_registerMethods( hb_objGetClass( hb_stackReturnItem() ) );" )
aadd( aLine, " hbqt_defineClassEnd( s_oClass, oClass );" )
aadd( aLine, " }" )
aadd( aLine, " return;" )
aadd( aLine, " }" )
aadd( aLine, ' hb_objSendMsg( s_oClass, "Instance", 0 );' )
aadd( aLine, ' PHB_ITEM oClass = hbqt_defineClassBegin( "' + uQtObject + '", s_oClass, "' + s + '" );' )
aadd( aLine, " if( oClass )" )
aadd( aLine, " {" )
aadd( aLine, " s_registerMethods( hb_objGetClass( hb_stackReturnItem() ) );" )
aadd( aLine, " hbqt_defineClassEnd( s_oClass, oClass );" )
aadd( aLine, " }" )
aadd( aLine, " return;" ) /* QUESTION: Is this intended here? */
aadd( aLine, " }" )
aadd( aLine, ' hb_objSendMsg( s_oClass, "INSTANCE", 0 );' )
aadd( aLine, "}" )
aadd( aLine, "" )
FOR EACH s IN ::hRef
IF s:__enumKey() == "QList" /* TOFIX: Ugly hack */
@@ -1434,7 +1456,7 @@ METHOD HbQtSource:build()
/* Insert user defined code - INCLUDEs */
aadd( aLine, "#include <QtCore/QPointer>" )
IF !empty( ::code_ )
aeval( ::code_, {|e| aadd( aLine, strtran( e, chr( 13 ) ) ) } )
aeval( ::code_, {| e | aadd( aLine, StrTran( e, chr( 13 ) ) ) } )
aadd( aLine, "" )
ENDIF

View File

@@ -451,7 +451,7 @@ PHB_ITEM hbqt_defineClassBegin( const char* szClsName, PHB_ITEM s_oClass, const
static PHB_DYNS s___HBCLASS = NULL;
char * pszParentClsBuffer = hb_strdup( szParentClsStr );
char* szSingleClsName;
char * szSingleClsName;
if( s___HBCLASS == NULL )
s___HBCLASS = hb_dynsymGetCase( "HBCLASS" );
@@ -491,7 +491,7 @@ PHB_ITEM hbqt_defineClassBegin( const char* szClsName, PHB_ITEM s_oClass, const
hb_itemPutSymbol( pSym_ClsFunc, hb_dynsymGetCase( test )->pSymbol );
hb_objSendMsg( hb_stackReturnItem(), "New", 3, pClsName, pSuper, pSym_ClsFunc );
hb_objSendMsg( hb_stackReturnItem(), "NEW", 3, pClsName, pSuper, pSym_ClsFunc );
oClass = hb_itemNew( hb_stackReturnItem() );
@@ -499,8 +499,8 @@ PHB_ITEM hbqt_defineClassBegin( const char* szClsName, PHB_ITEM s_oClass, const
hb_itemRelease( pSuper );
hb_itemRelease( pClsName );
hb_objSendMsg( oClass, "Create", 0 );
hb_objSendMsg( oClass, "Instance", 0 );
hb_objSendMsg( oClass, "CREATE", 0 );
hb_objSendMsg( oClass, "INSTANCE", 0 );
}
return oClass;