2011-01-12 01:23 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbsqlit3/hbsqlit3.c
    + Enabled function pointers. It's even easier I thought since 
      the block calling method also supports function pointers 
      automatically.

  * contrib/hbxdiff/hbxdiff.c
    % Deleted separate (original) function symbol support, and 
      enabled it on the codeblock branch. Now it supports both 
      without redundant code.

  * contrib/hbxdiff/tests/test3.prg
    + Added back function pointer example.
This commit is contained in:
Viktor Szakats
2011-01-12 00:24:15 +00:00
parent 205594c2e6
commit b2bacdfcef
4 changed files with 36 additions and 106 deletions

View File

@@ -16,6 +16,20 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-01-12 01:23 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbsqlit3/hbsqlit3.c
+ Enabled function pointers. It's even easier I thought since
the block calling method also supports function pointers
automatically.
* contrib/hbxdiff/hbxdiff.c
% Deleted separate (original) function symbol support, and
enabled it on the codeblock branch. Now it supports both
without redundant code.
* contrib/hbxdiff/tests/test3.prg
+ Added back function pointer example.
2011-01-12 01:13 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbmxml/hbmxml.c
+ First round to switch to supporting codeblocks and storing

View File

@@ -788,10 +788,10 @@ HB_FUNC( SQLITE3_EXEC )
char * pszErrMsg = NULL;
int rc;
if( HB_ISBLOCK( 3 ) )
if( HB_ISBLOCK( 3 ) || HB_ISSYMBOL( 3 ) )
{
rc = sqlite3_exec( pHbSqlite3->db, hb_parstr_utf8( 2, &hSQLText,
NULL ), callback, ( void * ) hb_param( 3, HB_IT_BLOCK ),
NULL ), callback, ( void * ) hb_param( 3, HB_IT_BLOCK | HB_IT_SYMBOL ),
&pszErrMsg );
}
else
@@ -1872,9 +1872,9 @@ HB_FUNC( SQLITE3_BUSY_HANDLER )
pHbSqlite3->cbBusyHandler = NULL;
}
if( HB_ISBLOCK( 2 ) )
if( HB_ISBLOCK( 2 ) || HB_ISSYMBOL( 2 ) )
{
pHbSqlite3->cbBusyHandler = hb_itemNew( hb_param( 2, HB_IT_BLOCK ) );
pHbSqlite3->cbBusyHandler = hb_itemNew( hb_param( 2, HB_IT_BLOCK | HB_IT_SYMBOL ) );
hb_gcUnlock( pHbSqlite3->cbBusyHandler );
sqlite3_busy_handler( pHbSqlite3->db, busy_handler,
@@ -1905,7 +1905,7 @@ HB_FUNC( SQLITE3_PROGRESS_HANDLER )
if( HB_ISNUM( 2 ) && HB_ISBLOCK( 3 ) )
{
pHbSqlite3->cbProgressHandler = hb_itemNew( hb_param( 3, HB_IT_BLOCK ) );
pHbSqlite3->cbProgressHandler = hb_itemNew( hb_param( 3, HB_IT_BLOCK | HB_IT_SYMBOL ) );
hb_gcUnlock( pHbSqlite3->cbProgressHandler );
sqlite3_progress_handler( pHbSqlite3->db, hb_parni( 2 ), progress_handler,
@@ -1935,9 +1935,9 @@ HB_FUNC( SQLITE3_COMMIT_HOOK )
pHbSqlite3->cbHookCommit = NULL;
}
if( HB_ISBLOCK( 2 ) )
if( HB_ISBLOCK( 2 ) || HB_ISSYMBOL( 2 ) )
{
pHbSqlite3->cbHookCommit = hb_itemNew( hb_param( 2, HB_IT_BLOCK ) );
pHbSqlite3->cbHookCommit = hb_itemNew( hb_param( 2, HB_IT_BLOCK | HB_IT_SYMBOL ) );
hb_gcUnlock( pHbSqlite3->cbHookCommit );
sqlite3_commit_hook( pHbSqlite3->db, hook_commit, ( void * ) pHbSqlite3->cbHookCommit );
@@ -1959,9 +1959,9 @@ HB_FUNC( SQLITE3_ROLLBACK_HOOK )
pHbSqlite3->cbHookRollback = NULL;
}
if( HB_ISBLOCK( 2 ) )
if( HB_ISBLOCK( 2 ) || HB_ISSYMBOL( 2 ) )
{
pHbSqlite3->cbHookRollback = hb_itemNew( hb_param( 2, HB_IT_BLOCK ) );
pHbSqlite3->cbHookRollback = hb_itemNew( hb_param( 2, HB_IT_BLOCK | HB_IT_SYMBOL ) );
hb_gcUnlock( pHbSqlite3->cbHookRollback );
sqlite3_rollback_hook( pHbSqlite3->db, hook_rollback,
@@ -1990,9 +1990,9 @@ HB_FUNC( SQLITE3_SET_AUTHORIZER )
pHbSqlite3->cbAuthorizer = NULL;
}
if( HB_ISBLOCK( 2 ) )
if( HB_ISBLOCK( 2 ) || HB_ISSYMBOL( 2 ) )
{
pHbSqlite3->cbAuthorizer = hb_itemNew( hb_param( 2, HB_IT_BLOCK ) );
pHbSqlite3->cbAuthorizer = hb_itemNew( hb_param( 2, HB_IT_BLOCK | HB_IT_SYMBOL ) );
hb_gcUnlock( pHbSqlite3->cbAuthorizer );
hb_retni( sqlite3_set_authorizer( pHbSqlite3->db, authorizer,
@@ -2265,9 +2265,9 @@ HB_FUNC( SQLITE3_CREATE_FUNCTION )
pHbSqlite3->cbFunc = NULL;
}
if( HB_ISBLOCK( 4 ) )
if( HB_ISBLOCK( 4 ) || HB_ISSYMBOL( 4 ) )
{
pHbSqlite3->cbFunc = hb_itemNew( hb_param( 4, HB_IT_BLOCK ) );
pHbSqlite3->cbFunc = hb_itemNew( hb_param( 4, HB_IT_BLOCK | HB_IT_SYMBOL ) );
hb_gcUnlock( pHbSqlite3->cbFunc );
hb_retni(

View File

@@ -69,9 +69,6 @@
#define XDLT_STD_BLKSIZE ( 1024 * 8 )
#define XDLT_MAX_LINE_SIZE 80
static int xdlt_outf( void * priv, mmbuffer_t * mb, int nbuf );
static int xdlt_outh( void * priv, mmbuffer_t * mb, int nbuf );
static PHB_ITEM hb_mmf_itemPut( PHB_ITEM pItem, void * pMemAddr, int iType );
static void * hb_mmf_itemGet( PHB_ITEM pItem, int iType, HB_BOOL fError );
static void hb_mmf_ret( void * pMemAddr, int iType );
@@ -407,32 +404,6 @@ static int xdlt_outb( void * priv, mmbuffer_t * mb, int nbuf )
return -1;
}
static int xdlt_outh( void * priv, mmbuffer_t * mb, int nbuf )
{
PHB_DYNS pSym = ( PHB_DYNS ) priv;
if( pSym && hb_vmRequestReenter() )
{
int iResult;
int i;
hb_vmPushDynSym( pSym );
hb_vmPushNil();
for( i = 0; i < nbuf; i++ )
hb_vmPushString( ( const char * ) mb[ i ].ptr, mb[ i ].size );
hb_vmFunction( ( HB_USHORT ) nbuf );
iResult = hb_parnidef( -1, 0 );
hb_vmRequestRestore();
return iResult;
}
else
return -1;
}
/* int xdl_diff(mmfile_t *mmf1, mmfile_t *mmf2, xpparam_t const *xpp, xdemitconf_t const *xecfg, xdemitcb_t *ecb) */
HB_FUNC( XDL_DIFF )
@@ -456,29 +427,15 @@ HB_FUNC( XDL_DIFF )
hb_retni( xdl_diff( phb_mmf1->mmf, phb_mmf2->mmf, &xpp, &xecfg, &ecb ) );
}
else if( HB_ISBLOCK( 5 ) )
else if( HB_ISBLOCK( 5 ) || HB_ISSYMBOL( 5 ) )
{
PHB_ITEM pBlock = hb_param( 5, HB_IT_BLOCK );
PHB_ITEM pBlock = hb_param( 5, HB_IT_BLOCK | HB_IT_SYMBOL );
ecb.priv = ( void * ) pBlock;
ecb.outf = xdlt_outb;
hb_retni( xdl_diff( phb_mmf1->mmf, phb_mmf2->mmf, &xpp, &xecfg, &ecb ) );
}
else if( HB_ISSYMBOL( 5 ) )
{
PHB_DYNS pDynSym = hb_dynsymNew( hb_itemGetSymbol( hb_param( 5, HB_IT_SYMBOL ) ) );
if( pDynSym && hb_dynsymIsFunction( pDynSym ) )
{
ecb.priv = pDynSym;
ecb.outf = xdlt_outh;
hb_retni( xdl_diff( phb_mmf1->mmf, phb_mmf2->mmf, &xpp, &xecfg, &ecb ) );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
@@ -542,29 +499,15 @@ HB_FUNC( XDL_BDIFF )
hb_retni( xdl_bdiff( phb_mmf1->mmf, phb_mmf2->mmf, &bdp, &ecb ) );
}
else if( HB_ISBLOCK( 4 ) )
else if( HB_ISBLOCK( 4 ) || HB_ISSYMBOL( 4 ) )
{
PHB_ITEM pBlock = hb_param( 4, HB_IT_BLOCK );
PHB_ITEM pBlock = hb_param( 4, HB_IT_BLOCK | HB_IT_SYMBOL );
ecb.priv = ( void * ) pBlock;
ecb.outf = xdlt_outb;
hb_retni( xdl_bdiff( phb_mmf1->mmf, phb_mmf2->mmf, &bdp, &ecb ) );
}
else if( HB_ISSYMBOL( 4 ) )
{
PHB_DYNS pDynSym = hb_dynsymNew( hb_itemGetSymbol( hb_param( 3, HB_IT_SYMBOL ) ) );
if( pDynSym && hb_dynsymIsFunction( pDynSym ) )
{
ecb.priv = ( void * ) pDynSym;
ecb.outf = xdlt_outh;
hb_retni( xdl_bdiff( phb_mmf1->mmf, phb_mmf2->mmf, &bdp, &ecb ) );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
@@ -594,29 +537,15 @@ HB_FUNC( XDL_RABDIFF )
hb_retni( xdl_rabdiff( phb_mmf1->mmf, phb_mmf2->mmf, &ecb ) );
}
else if( HB_ISBLOCK( 3 ) )
else if( HB_ISBLOCK( 3 ) || HB_ISSYMBOL( 3 ) )
{
PHB_ITEM pBlock = hb_param( 3, HB_IT_BLOCK );
PHB_ITEM pBlock = hb_param( 3, HB_IT_BLOCK | HB_IT_SYMBOL );
ecb.priv = ( void * ) pBlock;
ecb.outf = xdlt_outb;
hb_retni( xdl_rabdiff( phb_mmf1->mmf, phb_mmf2->mmf, &ecb ) );
}
else if( HB_ISSYMBOL( 3 ) )
{
PHB_DYNS pDynSym = hb_dynsymNew( hb_itemGetSymbol( hb_param( 3, HB_IT_SYMBOL ) ) );
if( pDynSym && hb_dynsymIsFunction( pDynSym ) )
{
ecb.priv = ( void * ) pDynSym;
ecb.outf = xdlt_outh;
hb_retni( xdl_rabdiff( phb_mmf1->mmf, phb_mmf2->mmf, &ecb ) );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
@@ -642,29 +571,15 @@ HB_FUNC( XDL_BPATCH )
hb_retni( xdl_bpatch( phb_mmf1->mmf, phb_mmf2->mmf, &ecb ) );
}
else if( HB_ISBLOCK( 3 ) )
else if( HB_ISBLOCK( 3 ) || HB_ISSYMBOL( 3 ) )
{
PHB_ITEM pBlock = hb_param( 3, HB_IT_BLOCK );
PHB_ITEM pBlock = hb_param( 3, HB_IT_BLOCK | HB_IT_SYMBOL );
ecb.priv = ( void * ) pBlock;
ecb.outf = xdlt_outb;
hb_retni( xdl_bpatch( phb_mmf1->mmf, phb_mmf2->mmf, &ecb ) );
}
else if( HB_ISSYMBOL( 3 ) )
{
PHB_DYNS pDynSym = hb_dynsymNew( hb_itemGetSymbol( hb_param( 3, HB_IT_SYMBOL ) ) );
if( pDynSym && hb_dynsymIsFunction( pDynSym ) )
{
ecb.priv = ( void * ) pDynSym;
ecb.outf = xdlt_outh;
hb_retni( xdl_bpatch( phb_mmf1->mmf, phb_mmf2->mmf, &ecb ) );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}

View File

@@ -31,5 +31,6 @@ PROCEDURE main()
xdl_write_mmfile( pMMFNew, cFileCtx + hb_eol() + Space( 3 ) + "RETURN NIL" + hb_eol() )
xdl_diff( pMMFOld, pMMFNew, 0, 3, {| ... | Diff( ... ) } )
xdl_diff( pMMFOld, pMMFNew, 0, 3, @Diff() )
RETURN