static void sax_cb( mxml_node_t * node, mxml_sax_event_t event, void * data ) { HB_CBS_VAR * pCbs = ( HB_CBS_VAR * ) hb_stackTestTSD( &s_cbs_var ); if( node != NULL && pCbs != NULL ) { PHB_ITEM pCallback = pCbs->sax_cb; if( pCallback && hb_vmRequestReenter() ) { HB_USHORT uPCount = 2; hb_vmPushEvalSym(); hb_vmPush( pCallback ); mxml_node_push( node, 0 ); hb_vmPushInteger( ( int ) ( event + 1 ) ); if( data != NULL ) { hb_vmPush( ( PHB_ITEM ) data ); uPCount++; } hb_vmSend( uPCount ); hb_vmRequestRestore(); } } }
static int hb_ssl_pem_password_cb( char * buf, int size, int rwflag, void * userdata ) { int retsize = 0; if( size > 0 && userdata && hb_vmRequestReenter() ) { hb_vmPushEvalSym(); hb_vmPush( ( PHB_ITEM ) userdata ); hb_vmPushLogical( rwflag ); hb_vmSend( 1 ); buf[ 0 ] = '\0'; retsize = ( int ) hb_parclen( -1 ); if( retsize > 0 ) { if( retsize > size ) retsize = size; memcpy( buf, hb_parc( -1 ), retsize ); } hb_vmRequestRestore(); } return retsize; }
static const char * save_cb( mxml_node_t * node, int where ) { HB_CBS_VAR * pCbs = ( HB_CBS_VAR * ) hb_stackTestTSD( &s_cbs_var ); if( node != NULL && pCbs != NULL ) { PHB_ITEM pCallback = pCbs->save_cb; if( pCbs->hText ) { hb_strfree( pCbs->hText ); pCbs->hText = NULL; } if( pCallback && hb_vmRequestReenter() ) { const char * pszResult; hb_vmPushEvalSym(); hb_vmPush( pCallback ); mxml_node_push( node, 0 ); hb_vmPushInteger( where ); hb_vmSend( 2 ); pszResult = hb_itemGetStrUTF8( hb_param( -1, HB_IT_ANY ), &pCbs->hText, NULL ); hb_vmRequestRestore(); return pszResult; } } return NULL; }
LRESULT CALLBACK ControlWindowProcedure( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { PHB_ITEM pBlock = ( PHB_ITEM ) GetProp( hwnd, TEXT( "BLOCKCALLBACK" ) ); long lRet; if( pBlock ) { if( hb_itemType( pBlock ) == HB_IT_POINTER ) { hb_vmPushSymbol( hb_dynsymSymbol( ( ( PHB_SYMB ) pBlock )->pDynSym ) ); hb_vmPushNil(); } else { hb_vmPushEvalSym(); hb_vmPush( pBlock ); } hb_vmPushNumInt( ( HB_PTRUINT ) hwnd ); hb_vmPushInteger( msg ); hb_vmPushNumInt( ( HB_PTRUINT ) wParam ); hb_vmPushNumInt( ( HB_PTRUINT ) lParam ); hb_vmDo( 4 ); lRet = ( long ) hb_parnint( -1 ); return lRet; } return DefWindowProc( hwnd, msg, wParam, lParam ); }
static mxml_type_t type_cb( mxml_node_t * node ) { HB_CBS_VAR * pCbs = ( HB_CBS_VAR * ) hb_stackTestTSD( &s_cbs_var ); if( pCbs != NULL ) { PHB_ITEM pCallback = pCbs->type_cb; if( pCallback && hb_vmRequestReenter() ) { int iResult; hb_vmPushEvalSym(); hb_vmPush( pCallback ); mxml_node_push( node, 0 ); hb_vmSend( 1 ); iResult = hb_parnidef( -1, MXML_TEXT ); hb_vmRequestRestore(); return ( mxml_type_t ) iResult; } } return MXML_TEXT; }
/* undocumented Clipper _cEval1() */ void hb_evalBlock1( PHB_ITEM pCodeBlock, PHB_ITEM pParam ) { hb_vmPushEvalSym(); hb_vmPush( pCodeBlock ); hb_vmPush( pParam ); hb_vmSend( 1 ); }
/* Control handler function */ static VOID WINAPI hbwin_SvcControlHandler( DWORD fdwControl ) { if( s_pHarbourControlFunc ) { if( hb_vmRequestReenterExt() ) { hb_vmPushEvalSym(); hb_vmPush( s_pHarbourControlFunc ); hb_vmPushNumInt( ( HB_MAXINT ) fdwControl ); hb_vmSend( 1 ); hb_vmRequestRestore(); } else HB_TRACE( HB_TR_DEBUG, ( "HVM stack not available" ) ); return; } switch( fdwControl ) { case SERVICE_CONTROL_STOP: s_ServiceStatus.dwWin32ExitCode = 0; s_ServiceStatus.dwCurrentState = SERVICE_STOPPED; break; case SERVICE_CONTROL_SHUTDOWN: s_ServiceStatus.dwWin32ExitCode = 0; s_ServiceStatus.dwCurrentState = SERVICE_STOPPED; break; default: return; } SetServiceStatus( s_hStatus, &s_ServiceStatus ); /* Report current status */ }
static char * custom_save_cb( mxml_node_t * node ) { HB_CUSTOM_CBS_VAR * pCCbs = ( HB_CUSTOM_CBS_VAR * ) hb_stackTestTSD( &s_custom_cbs_var ); if( node != NULL && pCCbs != NULL ) { PHB_ITEM pCallback = pCCbs->save_cb; if( pCallback && hb_vmRequestReenter() ) { char * pszResult; const char * pszText; void * hText; hb_vmPushEvalSym(); hb_vmPush( pCallback ); mxml_node_push( node, 0 ); hb_vmSend( 1 ); pszText = hb_parstr_utf8( -1, &hText, NULL ); pszResult = pszText ? strdup( pszText ) : NULL; hb_strfree( hText ); hb_vmRequestRestore(); return pszResult; } } return NULL; }
static int custom_load_cb( mxml_node_t * node, const char * data ) { HB_CUSTOM_CBS_VAR * pCCbs = ( HB_CUSTOM_CBS_VAR * ) hb_stackTestTSD( &s_custom_cbs_var ); if( node != NULL && pCCbs != NULL && data != NULL ) { PHB_ITEM pCallback = pCCbs->load_cb; if( pCallback && hb_vmRequestReenter() ) { int iResult; hb_vmPushEvalSym(); hb_vmPush( pCallback ); mxml_node_push( node, 0 ); hb_itemPutC( hb_stackAllocItem(), data ); hb_vmSend( 2 ); iResult = hb_parnidef( -1, 1 ); hb_vmRequestRestore(); return iResult; } } return 1; }
static VOID WINAPI hbwin_SvcMainFunction( DWORD dwArgc, LPTSTR * lpszArgv ) { s_ServiceStatus.dwServiceType = SERVICE_WIN32; s_ServiceStatus.dwCurrentState = SERVICE_START_PENDING; s_ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; s_ServiceStatus.dwWin32ExitCode = 0; s_ServiceStatus.dwServiceSpecificExitCode = 0; s_ServiceStatus.dwCheckPoint = 0; s_ServiceStatus.dwWaitHint = 0; s_hStatus = RegisterServiceCtrlHandler( s_lpServiceName, ( LPHANDLER_FUNCTION ) hbwin_SvcControlHandler ); if( s_hStatus != ( SERVICE_STATUS_HANDLE ) 0 ) { if( s_pHarbourEntryFunc != NULL ) { if( hb_vmRequestReenterExt() ) { DWORD i; int iArgCount = 0; if( ! s_pHarbourControlFunc ) { /* We report the running status to SCM. */ s_ServiceStatus.dwCurrentState = SERVICE_RUNNING; SetServiceStatus( s_hStatus, &s_ServiceStatus ); } hb_vmPushEvalSym(); hb_vmPush( s_pHarbourEntryFunc ); for( i = 1; i < dwArgc; ++i ) { PHB_ITEM pItem = hb_stackAllocItem(); HB_ITEMPUTSTR( pItem, lpszArgv[ i ] ); if( hb_cmdargIsInternal( hb_itemGetCPtr( pItem ), NULL ) ) hb_stackPop(); else ++iArgCount; } hb_vmSend( ( HB_USHORT ) iArgCount ); hb_vmRequestRestore(); } else HB_TRACE( HB_TR_DEBUG, ( "HVM stack not available" ) ); } else HB_TRACE( HB_TR_DEBUG, ( "Harbour service entry function not found" ) ); } else HB_TRACE( HB_TR_DEBUG, ( "Error registering service" ) ); }
static void hbqt_SlotsExecQMediaContent( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QMediaContent( ( *reinterpret_cast< QMediaContent( * ) >( arguments[ 1 ] ) ) ), "HB_QMEDIACONTENT", hbqt_del_QMediaContent, HBQT_BIT_OWNER ); if( p0 ) { hb_vmPushEvalSym(); hb_vmPush( codeBlock ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); } }
static void hbqt_SlotsExecQAudioBuffer( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QAudioBuffer( ( *reinterpret_cast< QAudioBuffer( * ) >( arguments[ 1 ] ) ) ), "HB_QAUDIOBUFFER", hbqt_del_QAudioBuffer, HBQT_BIT_OWNER ); if( p0 ) { hb_vmPushEvalSym(); hb_vmPush( codeBlock ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); } }
static void hbqt_SlotsExecQVideoFrame( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QVideoFrame( ( *reinterpret_cast< QVideoFrame( * ) >( arguments[ 1 ] ) ) ), "HB_QVIDEOFRAME", hbqt_del_QVideoFrame, HBQT_BIT_OWNER ); if( p0 ) { hb_vmPushEvalSym(); hb_vmPush( codeBlock ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); } }
static void hb_zebra_draw_codeblock_callback( void * pDrawBlock, double dX, double dY, double dWidth, double dHeight ) { if( pDrawBlock && HB_IS_BLOCK( pDrawBlock ) && hb_vmRequestReenter() ) { hb_vmPushEvalSym(); hb_vmPush( ( PHB_ITEM ) pDrawBlock ); hb_vmPushDouble( dX, HB_DEFAULT_DECIMALS ); hb_vmPushDouble( dY, HB_DEFAULT_DECIMALS ); hb_vmPushDouble( dWidth, HB_DEFAULT_DECIMALS ); hb_vmPushDouble( dHeight, HB_DEFAULT_DECIMALS ); hb_vmSend( 4 ); hb_vmRequestRestore(); } }
static void xml_errorHandler( void * unused, xmlErrorPtr pError ) { if( ! unused && pError && pHandler ) { /* HB_TRACE( HB_TR_ERROR, ( "libxml2 error: file=%s domain=%d code=%d message=%s line=%d col=%d s1=%s s2=%s s3=%s", pError->file, pError->domain, pError->code, pError->message, pError->line, pError->int2, pError->str1, pError->str2, pError->str3 ) ); */ /* codeblock */ PHB_ITEM pCallback = pHandler->pErrorBlock; if( HB_IS_BLOCK( pCallback ) ) { if( hb_vmRequestReenter() ) { //int iResult; hb_vmPushEvalSym(); hb_vmPush( pCallback ); hb_vmPushPointer( pError ); hb_vmSend( 1 ); //iResult = hb_parni( -1 ); hb_vmRequestRestore(); } } } }
static void hb_ssl_msg_callback( int write_p, int version, int content_type, const void * buf, size_t len, SSL * ssl, void * userdata ) { HB_SYMBOL_UNUSED( ssl ); if( userdata && hb_vmRequestReenter() ) { hb_vmPushEvalSym(); hb_vmPush( ( PHB_ITEM ) userdata ); hb_vmPushLogical( write_p ); hb_vmPushInteger( version ); hb_vmPushInteger( content_type ); hb_vmPushString( ( const char * ) buf, ( HB_SIZE ) len ); hb_vmSend( 4 ); hb_vmRequestRestore(); } }
/* same functionality but with a NULL terminated list of parameters */ void hb_evalBlock( PHB_ITEM pCodeBlock, ... ) { va_list args; HB_USHORT uiParams = 0; PHB_ITEM pParam; hb_vmPushEvalSym(); hb_vmPush( pCodeBlock ); va_start( args, pCodeBlock ); while( ( pParam = va_arg( args, PHB_ITEM ) ) != NULL ) { hb_vmPush( pParam ); uiParams++; } va_end( args ); hb_vmSend( uiParams ); }
static void error_cb( const char * pszErrorMsg ) { HB_ERROR_CB_VAR * pError_cb = ( HB_ERROR_CB_VAR * ) hb_stackTestTSD( &s_error_cb_var ); if( pError_cb != NULL ) { PHB_ITEM pCallback = pError_cb->error_cb; if( pCallback && hb_vmRequestReenter() ) { hb_vmPushEvalSym(); hb_vmPush( pCallback ); hb_itemPutC( hb_stackAllocItem(), pszErrorMsg ); hb_vmSend( 1 ); hb_vmRequestRestore(); } } }
static HRESULT STDMETHODCALLTYPE classCreateInstance( IClassFactory * lpThis, IUnknown * punkOuter, REFIID riid, void ** ppvObj ) { HRESULT hr; HB_SYMBOL_UNUSED( lpThis ); *ppvObj = NULL; if( punkOuter ) hr = CLASS_E_NOAGGREGATION; else { PHB_ITEM pAction = NULL; HB_BOOL fGuids = HB_FALSE; if( s_pAction ) { if( HB_IS_EVALITEM( s_pAction ) ) { if( hb_vmRequestReenter() ) { hb_vmPushEvalSym(); hb_vmPush( s_pAction ); hb_vmProc( 0 ); pAction = hb_itemNew( hb_stackReturnItem() ); hb_vmRequestRestore(); } } else if( HB_IS_HASH( s_pAction ) ) { if( s_fHashClone ) pAction = hb_itemClone( s_pAction ); else if( ! s_pMsgHash && s_hashWithNumKeys( s_pAction ) ) fGuids = HB_TRUE; } } hr = s_createHbOleObject( riid, ppvObj, pAction, fGuids ); } return hr; }
HB_EXTERN_END /*----------------------------------------------------------------------*/ #if QT_VERSION >= 0x050300 static void hbqt_SlotsExecIntQVideoFrame( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QVideoFrame( ( *reinterpret_cast< QVideoFrame( * ) >( arguments[ 2 ] ) ) ), "HB_QVIDEOFRAME", hbqt_del_QVideoFrame, HBQT_BIT_OWNER ); if( p0 ) { hb_vmPushEvalSym(); hb_vmPush( codeBlock ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 1 ] ) ); hb_vmPush( p0 ); hb_vmSend( 2 ); hb_itemRelease( p0 ); } }
BOOL CALLBACK WvgDialogProcChooseFont( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { HB_BOOL bret = HB_FALSE; HB_BOOL binit = HB_FALSE; PHB_ITEM block; if( msg == WM_INITDIALOG ) { CHOOSEFONT * cf = ( CHOOSEFONT * ) lParam; PHB_ITEM pBlock = ( PHB_ITEM ) hb_itemNew( ( PHB_ITEM ) cf->lCustData ); SetProp( hwnd, TEXT( "DIALOGPROC" ), pBlock ); binit = HB_TRUE; } block = ( PHB_ITEM ) GetProp( hwnd, TEXT( "DIALOGPROC" ) ); if( block ) { hb_vmPushEvalSym(); hb_vmPush( block ); hb_vmPushNumInt( ( HB_PTRUINT ) hwnd ); hb_vmPushInteger( msg ); hb_vmPushNumInt( ( HB_PTRUINT ) wParam ); hb_vmPushNumInt( ( HB_PTRUINT ) lParam ); hb_vmDo( 4 ); bret = hb_parnl( -1 ); if( msg == WM_NCDESTROY ) { RemoveProp( hwnd, TEXT( "DIALOGPROC" ) ); hb_itemRelease( block ); } } if( binit ) return HB_TRUE; return bret; }
static INT_PTR CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { PHB_GTWVT _s = hb_wvt_gtGetWVT(); INT_PTR lReturn = 0; if( _s ) { int iIndex, iType; PHB_ITEM pFunc = NULL; int iFirst = ( int ) lParam; if( iFirst > 0 && iFirst <= ( int ) HB_SIZEOFARRAY( _s->hDlgModal ) ) { _s->hDlgModal[ iFirst - 1 ] = hDlg; SendMessage( hDlg, WM_INITDIALOG, 0, 0 ); return lReturn; } iType = 0; for( iIndex = 0; iIndex < ( int ) HB_SIZEOFARRAY( _s->hDlgModal ); iIndex++ ) { if( _s->hDlgModal[ iIndex ] != NULL && _s->hDlgModal[ iIndex ] == hDlg ) { if( _s->pFuncModal[ iIndex ] != NULL ) { pFunc = _s->pFuncModal[ iIndex ]; iType = _s->iTypeModal[ iIndex ]; } break; } } if( pFunc ) { switch( iType ) { case 1: /* Function Name */ if( hb_vmRequestReenter() ) { hb_vmPushDynSym( ( PHB_DYNS ) pFunc ); hb_vmPushNil(); hbwapi_vmPush_HANDLE( hDlg ); hb_vmPushNumInt( message ); hb_vmPushNumInt( wParam ); hb_vmPushNumInt( lParam ); hb_vmDo( 4 ); lReturn = ( INT_PTR ) hbwapi_par_RESULT( -1 ); hb_vmRequestRestore(); } break; case 2: /* Block */ /* eval the codeblock */ if( HB_IS_EVALITEM( pFunc ) ) { if( hb_vmRequestReenter() ) { hb_vmPushEvalSym(); hb_vmPush( pFunc ); hbwapi_vmPush_HANDLE( hDlg ); hb_vmPushNumInt( message ); hb_vmPushNumInt( wParam ); hb_vmPushNumInt( lParam ); hb_vmSend( 4 ); lReturn = ( INT_PTR ) hbwapi_par_RESULT( -1 ); hb_vmRequestRestore(); } } else { /* TODO: internal error: missing codeblock */ } break; } switch( message ) { case WM_COMMAND: switch( LOWORD( wParam ) ) { case IDOK: EndDialog( hDlg, IDOK ); lReturn = 0; break; case IDCANCEL: EndDialog( hDlg, IDCANCEL ); lReturn = 0; break; } break; #if ! defined( HB_OS_WIN_CE ) case WM_NCDESTROY: #else case WM_DESTROY: #endif if( _s->pFuncModal[ iIndex ] != NULL && _s->iTypeModal[ iIndex ] == 2 ) hb_itemRelease( ( PHB_ITEM ) _s->pFuncModal[ iIndex ] ); _s->hDlgModal[ iIndex ] = NULL; _s->pFuncModal[ iIndex ] = NULL; _s->iTypeModal[ iIndex ] = 0; lReturn = 0; break; } } } return lReturn; }
/* undocumented Clipper _cEval0() */ void hb_evalBlock0( PHB_ITEM pCodeBlock ) { hb_vmPushEvalSym(); hb_vmPush( pCodeBlock ); hb_vmSend( 0 ); }