2012-10-31 20:57 UTC+0100 Viktor Szakats (harbour syenar.net)

* contrib/gtalleg/*.[c|h]
  * contrib/hbamf/*.[c|h]
  * contrib/hbbz2/*.[c|h]
  * contrib/hbcairo/*.[c|h]
    * uncrustified. pretty good results, without 
      any or very minimal manual touching up.

  * src/vm/classes.c
  * src/vm/dynsym.c
  * src/vm/garbage.c
    * reverted patch targeting macros ending with ';' 
      where it could cause double ';' in final source 
      when the macro is defined to an empty value.

  * src/debug/dbgentry.c
    % deleted inactive code for non-MT build mode.
This commit is contained in:
Viktor Szakats
2012-10-31 20:06:49 +00:00
parent 86cf2bc04f
commit d59ab2ae54
23 changed files with 1027 additions and 940 deletions

View File

@@ -16,6 +16,24 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-10-31 20:57 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/gtalleg/*.[c|h]
* contrib/hbamf/*.[c|h]
* contrib/hbbz2/*.[c|h]
* contrib/hbcairo/*.[c|h]
* uncrustified. pretty good results, without
any or very minimal manual touching up.
* src/vm/classes.c
* src/vm/dynsym.c
* src/vm/garbage.c
* reverted patch targeting macros ending with ';'
where it could cause double ';' in final source
when the macro is defined to an empty value.
* src/debug/dbgentry.c
% deleted inactive code for non-MT build mode.
2012-10-31 18:54 UTC+0100 Viktor Szakats (harbour syenar.net)
- config/hb_c.cfg
+ bin/harbour.ucf
@@ -191,7 +209,7 @@
utils/hbtest/*.prg
*.ch, *.c, *.h
* src/rtl/cdpapihb.c
* src/rtl/cdpapi.c
* src/rtl/hbadler.c
* src/rtl/hbsocket.c
* src/rtl/sha1.c

View File

@@ -3,55 +3,55 @@
*/
/*
* xHarbour Project source code:
* Allegro based virtual GT with graphic extensions.
*
* Copyright 2004 Mauricio Abre <maurifull@datafull.com>
* www - http://www.xharbour.org
* www - http://harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
* xHarbour Project source code:
* Allegro based virtual GT with graphic extensions.
*
* Copyright 2004 Mauricio Abre <maurifull@datafull.com>
* www - http://www.xharbour.org
* www - http://harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#define HB_GT_NAME ALLEG
#define HB_GT_NAME ALLEG
#include "hbgtcore.h"
#include "hbinit.h"
@@ -66,10 +66,10 @@
#include "inkey.ch"
#include "hbgfxdef.ch"
static int s_GtId;
static HB_GT_FUNCS SuperTable;
#define HB_GTSUPER (&SuperTable)
#define HB_GTID_PTR (&s_GtId)
static int s_GtId;
static HB_GT_FUNCS SuperTable;
#define HB_GTSUPER ( &SuperTable )
#define HB_GTID_PTR ( &s_GtId )
static HB_BOOL s_fInit;
@@ -77,7 +77,7 @@ static HB_BOOL s_fMakeInit;
static HB_BOOL s_fGtError;
/* font definition */
static ssfFont s_ssfDefaultFont;
static ssfFont s_ssfDefaultFont;
static unsigned short s_byFontSize = 16;
static int s_byFontWidth = 8;
@@ -88,10 +88,10 @@ static HB_GT_RECT s_mouseBound;
static HB_GT_CORD s_mousePos;
/* screen size in characters */
static int s_iScrWidth = 80;
static int s_iScrWidth = 80;
static int s_iScrHeight = 25;
/* screen size in pixels */
static int s_iGFXWidth = 0;
static int s_iGFXWidth = 0;
static int s_iGFXHeight = 0;
/* update region in pixels */
@@ -119,8 +119,8 @@ static AL_BITMAP * s_bmp = NULL;
*
* NOTE: This is only a Linux fb & DOS issue, where we don't have windows
*/
#define s_iHBorder 0
#define s_iVBorder 0
#define s_iHBorder 0
#define s_iVBorder 0
typedef struct
@@ -129,20 +129,20 @@ typedef struct
int xhb_key;
} gtAllegKey;
#define GT_KEY_TABLE_SIZE 49
#define GT_KEY_TABLE_SIZE 49
static const gtAllegKey s_KeyTable[ GT_KEY_TABLE_SIZE ] =
{
{ AL_KEY_ESC, K_ESC },
{ AL_KEY_INSERT, K_INS },
{ AL_KEY_HOME, K_HOME },
{ AL_KEY_PGUP, K_PGUP },
{ AL_KEY_PGDN, K_PGDN },
{ AL_KEY_END, K_END },
{ AL_KEY_DEL, K_DEL },
{ AL_KEY_UP, K_UP },
{ AL_KEY_DOWN, K_DOWN },
{ AL_KEY_LEFT, K_LEFT },
{ AL_KEY_ESC, K_ESC },
{ AL_KEY_INSERT, K_INS },
{ AL_KEY_HOME, K_HOME },
{ AL_KEY_PGUP, K_PGUP },
{ AL_KEY_PGDN, K_PGDN },
{ AL_KEY_END, K_END },
{ AL_KEY_DEL, K_DEL },
{ AL_KEY_UP, K_UP },
{ AL_KEY_DOWN, K_DOWN },
{ AL_KEY_LEFT, K_LEFT },
{ AL_KEY_RIGHT, K_RIGHT },
{ AL_KEY_A, K_ALT_A },
{ AL_KEY_B, K_ALT_B },
@@ -170,46 +170,46 @@ static const gtAllegKey s_KeyTable[ GT_KEY_TABLE_SIZE ] =
{ AL_KEY_X, K_ALT_X },
{ AL_KEY_Y, K_ALT_Y },
{ AL_KEY_Z, K_ALT_Z },
{ AL_KEY_F1, K_F1 },
{ AL_KEY_F2, K_F2 },
{ AL_KEY_F3, K_F3 },
{ AL_KEY_F4, K_F4 },
{ AL_KEY_F5, K_F5 },
{ AL_KEY_F6, K_F6 },
{ AL_KEY_F7, K_F7 },
{ AL_KEY_F8, K_F8 },
{ AL_KEY_F9, K_F9 },
{ AL_KEY_F10, K_F10 },
{ AL_KEY_F11, K_F11 },
{ AL_KEY_F12, K_F12 }
{ AL_KEY_F1, K_F1 },
{ AL_KEY_F2, K_F2 },
{ AL_KEY_F3, K_F3 },
{ AL_KEY_F4, K_F4 },
{ AL_KEY_F5, K_F5 },
{ AL_KEY_F6, K_F6 },
{ AL_KEY_F7, K_F7 },
{ AL_KEY_F8, K_F8 },
{ AL_KEY_F9, K_F9 },
{ AL_KEY_F10, K_F10 },
{ AL_KEY_F11, K_F11 },
{ AL_KEY_F12, K_F12 }
};
#define GT_CTRL_TABLE_SIZE 11
#define GT_CTRL_TABLE_SIZE 11
static const gtAllegKey s_CtrlTable[ GT_CTRL_TABLE_SIZE ] =
{
{ AL_KEY_LEFT, K_CTRL_LEFT },
{ AL_KEY_RIGHT, K_CTRL_RIGHT },
{ AL_KEY_UP, K_CTRL_UP },
{ AL_KEY_DOWN, K_CTRL_DOWN },
{ AL_KEY_LEFT, K_CTRL_LEFT },
{ AL_KEY_RIGHT, K_CTRL_RIGHT },
{ AL_KEY_UP, K_CTRL_UP },
{ AL_KEY_DOWN, K_CTRL_DOWN },
{ AL_KEY_QUOTE, K_CTRL_PRTSCR },
{ AL_KEY_INSERT, K_CTRL_INS },
{ AL_KEY_DEL, K_CTRL_DEL },
{ AL_KEY_HOME, K_CTRL_HOME },
{ AL_KEY_END, K_CTRL_END },
{ AL_KEY_PGUP, K_CTRL_PGUP },
{ AL_KEY_PGDN, K_CTRL_PGDN }
{ AL_KEY_INSERT, K_CTRL_INS },
{ AL_KEY_DEL, K_CTRL_DEL },
{ AL_KEY_HOME, K_CTRL_HOME },
{ AL_KEY_END, K_CTRL_END },
{ AL_KEY_PGUP, K_CTRL_PGUP },
{ AL_KEY_PGDN, K_CTRL_PGDN }
};
#define GT_UPD_GFXRECT(t,l,b,r) do { if( t < s_GFXUpd.iTop ) s_GFXUpd.iTop = t; \
if( l < s_GFXUpd.iLeft ) s_GFXUpd.iLeft = l; \
if( b > s_GFXUpd.iBottom ) s_GFXUpd.iBottom = b; \
if( r > s_GFXUpd.iRight ) s_GFXUpd.iRight = r; \
} while( 0 )
#define GT_SCREENINIT() do { if( !s_fInit ) \
hb_gt_alleg_InitializeScreen( pGT, s_iScrHeight, s_iScrWidth, HB_TRUE ); \
} while( 0 )
#define MK_GT8BCOLOR( n ) ( ( n & 0xFF ) / 16 | ( n & 0xFF00 ) / 256 )
#define GT_UPD_GFXRECT( t, l, b, r ) do { if( t < s_GFXUpd.iTop ) s_GFXUpd.iTop = t; \
if( l < s_GFXUpd.iLeft ) s_GFXUpd.iLeft = l; \
if( b > s_GFXUpd.iBottom ) s_GFXUpd.iBottom = b; \
if( r > s_GFXUpd.iRight ) s_GFXUpd.iRight = r; \
} while( 0 )
#define GT_SCREENINIT() do { if( ! s_fInit ) \
hb_gt_alleg_InitializeScreen( pGT, s_iScrHeight, s_iScrWidth, HB_TRUE ); \
} while( 0 )
#define MK_GT8BCOLOR( n ) ( ( n & 0xFF ) / 16 | ( n & 0xFF00 ) / 256 )
static void hb_gt_alleg_Error( const char * szMsg )
@@ -222,21 +222,21 @@ static HB_BOOL hb_gt_alleg_CursorRect( int iRow, int iCol, int iStyle,
int * piTop, int * piLeft,
int * piBottom, int * piRight )
{
*piLeft = s_iHBorder + iCol * s_byFontWidth;
*piRight = *piLeft + s_byFontWidth - 1;
*piTop = s_iVBorder + iRow * s_byFontSize;
*piLeft = s_iHBorder + iCol * s_byFontWidth;
*piRight = *piLeft + s_byFontWidth - 1;
*piTop = s_iVBorder + iRow * s_byFontSize;
*piBottom = *piTop;
switch( iStyle )
{
case SC_NORMAL:
*piBottom += s_byFontSize - 1;
*piTop = *piBottom - 1;
*piTop = *piBottom - 1;
break;
case SC_INSERT:
*piBottom += s_byFontSize - 1;
*piTop = *piBottom - ( s_byFontSize / 2 ) + 1;
*piTop = *piBottom - ( s_byFontSize / 2 ) + 1;
break;
case SC_UNDEF:
@@ -279,17 +279,17 @@ static void hb_gt_alleg_DoCursor( int iRow, int iCol, int iStyle )
al_unscare_mouse();
al_drawing_mode( DRAW_MODE_SOLID, NULL, 0, 0 );
}
s_iCurRow = iRow;
s_iCurCol = iCol;
s_iCurRow = iRow;
s_iCurCol = iCol;
s_iCursorStyle = iStyle;
}
static void hb_gt_alleg_ScreenUpdate( PHB_GT pGT )
{
int iRow, iCol, iStyle;
int iRow, iCol, iStyle;
HB_BOOL fPix, fCursor;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_ScreenUpdate(%p)", pGT));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_ScreenUpdate(%p)", pGT ) );
HB_GTSELF_GETSCRCURSOR( pGT, &iRow, &iCol, &iStyle );
fPix = s_GFXUpd.iTop <= s_GFXUpd.iBottom &&
@@ -305,9 +305,9 @@ static void hb_gt_alleg_ScreenUpdate( PHB_GT pGT )
al_scare_mouse_area( s_GFXUpd.iLeft, s_GFXUpd.iTop,
s_GFXUpd.iRight, s_GFXUpd.iBottom );
al_blit( s_bmp, al_screen, s_GFXUpd.iLeft, s_GFXUpd.iTop,
s_GFXUpd.iLeft, s_GFXUpd.iTop,
s_GFXUpd.iRight - s_GFXUpd.iLeft + 1,
s_GFXUpd.iBottom - s_GFXUpd.iTop + 1 );
s_GFXUpd.iLeft, s_GFXUpd.iTop,
s_GFXUpd.iRight - s_GFXUpd.iLeft + 1,
s_GFXUpd.iBottom - s_GFXUpd.iTop + 1 );
al_unscare_mouse();
}
if( fCursor )
@@ -315,21 +315,21 @@ static void hb_gt_alleg_ScreenUpdate( PHB_GT pGT )
al_release_screen();
s_GFXUpd.iTop = s_iScrHeight * s_byFontSize;
s_GFXUpd.iLeft = s_iScrWidth * s_byFontWidth;
s_GFXUpd.iTop = s_iScrHeight * s_byFontSize;
s_GFXUpd.iLeft = s_iScrWidth * s_byFontWidth;
s_GFXUpd.iBottom = 0;
s_GFXUpd.iRight = 0;
s_GFXUpd.iRight = 0;
}
}
static HB_BOOL hb_gt_alleg_InitializeScreen( PHB_GT pGT, int iRows, int iCols, HB_BOOL lClearInit )
{
PHB_FNAME pFileName;
int iRet = 1, iWidth, iHeight; /* Don't remove iRet, ixFP and iyFP initializers! */
short ixFP = 0, iyFP = 0;
HB_BOOL lMode = HB_FALSE, lPrev = s_fInit;
int iRet = 1, iWidth, iHeight; /* Don't remove iRet, ixFP and iyFP initializers! */
short ixFP = 0, iyFP = 0;
HB_BOOL lMode = HB_FALSE, lPrev = s_fInit;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_InitializeScreen(%p,%d,%d,%d)", pGT, iRows, iCols, (int) lClearInit ));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_InitializeScreen(%p,%d,%d,%d)", pGT, iRows, iCols, ( int ) lClearInit ) );
if( s_fGtError )
return HB_FALSE;
@@ -342,42 +342,42 @@ static HB_BOOL hb_gt_alleg_InitializeScreen( PHB_GT pGT, int iRows, int iCols, H
if( s_iGFXWidth != 0 && s_iGFXHeight != 0 )
{
iWidth = ( int ) s_iGFXWidth;
iWidth = ( int ) s_iGFXWidth;
iHeight = ( int ) s_iGFXHeight;
}
else
{
iWidth = s_byFontWidth * iCols;
iWidth = s_byFontWidth * iCols;
iHeight = s_byFontSize * iRows;
}
if( iRows > 11 && iCols > 23 && iRows < 129 && iCols < 257 )
{
#if defined( AL_GFX_XWINDOWS )
HB_TRACE(HB_TR_DEBUG, ("trying X DGA2 mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying X DGA2 mode" ) );
iRet = al_set_gfx_mode( AL_GFX_XDGA2, iWidth, iHeight, 0, 0 );
if( iRet != 0 )
{
HB_TRACE(HB_TR_DEBUG, ("trying X DGA mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying X DGA mode" ) );
iRet = al_set_gfx_mode( AL_GFX_XDGA, iWidth, iHeight, 0, 0 );
}
if( iRet != 0 )
{
HB_TRACE(HB_TR_DEBUG, ("trying X Windows mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying X Windows mode" ) );
iRet = al_set_gfx_mode( AL_GFX_XWINDOWS, iWidth, iHeight, 0, 0 );
}
#endif
#if defined( ALLEGRO_UNIX ) || defined( ALLEGRO_LINUX ) || defined( ALLEGRO_DOS )
if( iRet != 0 )
{
HB_TRACE(HB_TR_DEBUG, ("trying VBE/AF mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying VBE/AF mode" ) );
iRet = al_set_gfx_mode( AL_GFX_VBEAF, iWidth, iHeight, 0, 0 );
}
#endif
#if ( defined( ALLEGRO_UNIX ) || defined( ALLEGRO_LINUX ) ) && defined( AL_GFX_FBCON )
if( iRet != 0 )
{
HB_TRACE(HB_TR_DEBUG, ("trying fb console mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying fb console mode" ) );
iRet = al_set_gfx_mode( AL_GFX_FBCON, iWidth, iHeight, 0, 0 );
}
#endif
@@ -385,32 +385,32 @@ static HB_BOOL hb_gt_alleg_InitializeScreen( PHB_GT pGT, int iRows, int iCols, H
/* Try a windowed mode first */
if( iRet != 0 )
{
HB_TRACE(HB_TR_DEBUG, ("trying autodetect windowed mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying autodetect windowed mode" ) );
iRet = al_set_gfx_mode( AL_GFX_AUTODETECT_WINDOWED, iWidth, iHeight, 0, 0 );
}
#ifdef ALLEGRO_WINDOWS
/* GDI is slower, but it is more likely to bring a windowed mode than DirectX */
if( iRet != 0 )
{
HB_TRACE(HB_TR_DEBUG, ("trying GDI windowed mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying GDI windowed mode" ) );
iRet = al_set_gfx_mode( AL_GFX_GDI, iWidth, iHeight, 0, 0 );
}
if( iRet != 0 )
{
HB_TRACE(HB_TR_DEBUG, ("trying DirectX windowed mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying DirectX windowed mode" ) );
iRet = al_set_gfx_mode( AL_GFX_DIRECTX_WIN, iWidth, iHeight, 0, 0 );
}
#endif
if( iRet != 0 )
{
HB_TRACE(HB_TR_DEBUG, ("trying autodetect console mode"));
HB_TRACE( HB_TR_DEBUG, ( "trying autodetect console mode" ) );
iRet = al_set_gfx_mode( AL_GFX_AUTODETECT, iWidth, iHeight, 0, 0 );
}
if( iRet != 0 )
{
/* If that fails (ie, plain DOS or Linux VESA Framebuffer)
ensure to get any available gfx mode */
HB_TRACE(HB_TR_DEBUG, ("trying safe mode"));
/* If that fails (ie, plain DOS or Linux VESA Framebuffer)
ensure to get any available gfx mode */
HB_TRACE( HB_TR_DEBUG, ( "trying safe mode" ) );
iRet = al_set_gfx_mode( AL_GFX_SAFE, iWidth, iHeight, 0, 0 );
}
if( iRet != 0 ) /* Doh! */
@@ -438,13 +438,13 @@ static HB_BOOL hb_gt_alleg_InitializeScreen( PHB_GT pGT, int iRows, int iCols, H
}
s_fInit = HB_TRUE;
s_mouseBound.iLeft = 0;
s_mouseBound.iTop = 0;
s_mouseBound.iRight = AL_SCREEN_W - 1;
s_mouseBound.iLeft = 0;
s_mouseBound.iTop = 0;
s_mouseBound.iRight = AL_SCREEN_W - 1;
s_mouseBound.iBottom = AL_SCREEN_H - 1;
s_mouseButtonsState = al_mouse_b;
s_mouseButtonsState = al_mouse_b;
al_show_mouse( al_screen );
s_iScrWidth = iCols;
s_iScrWidth = iCols;
s_iScrHeight = iRows;
/* WAS: Center console in screen if we got a larger resolution than requested
@@ -470,35 +470,35 @@ static HB_BOOL hb_gt_alleg_InitializeScreen( PHB_GT pGT, int iRows, int iCols, H
if( ! iyFP )
iyFP = ixFP;
s_byFontSize = ( ixFP < iyFP ? ixFP : iyFP );
s_byFontSize = ( ixFP < iyFP ? ixFP : iyFP );
s_byFontWidth = s_byFontSize / 2;
}
s_mousePos.iCol = al_mouse_x / s_byFontWidth;
s_mousePos.iRow = al_mouse_y / s_byFontSize;
s_GFXUpd.iTop = s_iScrHeight;
s_GFXUpd.iLeft = s_iScrWidth;
s_mousePos.iCol = al_mouse_x / s_byFontWidth;
s_mousePos.iRow = al_mouse_y / s_byFontSize;
s_GFXUpd.iTop = s_iScrHeight;
s_GFXUpd.iLeft = s_iScrWidth;
s_GFXUpd.iBottom = 0;
s_GFXUpd.iRight = 0;
s_CLIP.iTop = 0;
s_CLIP.iLeft = 0;
s_CLIP.iBottom = AL_SCREEN_H - 1;
s_CLIP.iRight = AL_SCREEN_W - 1;
s_iCurCol = 0;
s_iCurRow = 0;
s_iCursorStyle = SC_NONE;
s_GFXUpd.iRight = 0;
s_CLIP.iTop = 0;
s_CLIP.iLeft = 0;
s_CLIP.iBottom = AL_SCREEN_H - 1;
s_CLIP.iRight = AL_SCREEN_W - 1;
s_iCurCol = 0;
s_iCurRow = 0;
s_iCursorStyle = SC_NONE;
ssfSetFontSize( &s_ssfDefaultFont, s_byFontSize );
s_pClr[ 0 ] = al_make_color( 0x00, 0x00, 0x00 ); /* black */
s_pClr[ 1 ] = al_make_color( 0x00, 0x00, 0xAA ); /* blue */
s_pClr[ 2 ] = al_make_color( 0x00, 0xAA, 0x00 ); /* green */
s_pClr[ 3 ] = al_make_color( 0x00, 0xAA, 0xAA ); /* cyan */
s_pClr[ 4 ] = al_make_color( 0xAA, 0x00, 0x00 ); /* red */
s_pClr[ 5 ] = al_make_color( 0xAA, 0x00, 0xAA ); /* magenta */
s_pClr[ 6 ] = al_make_color( 0xAA, 0x55, 0x00 ); /* brown */
s_pClr[ 7 ] = al_make_color( 0xAA, 0xAA, 0xAA ); /* white */
s_pClr[ 8 ] = al_make_color( 0x55, 0x55, 0x55 ); /* gray */
s_pClr[ 9 ] = al_make_color( 0x55, 0x55, 0xFF ); /* bright blue */
s_pClr[ 0 ] = al_make_color( 0x00, 0x00, 0x00 ); /* black */
s_pClr[ 1 ] = al_make_color( 0x00, 0x00, 0xAA ); /* blue */
s_pClr[ 2 ] = al_make_color( 0x00, 0xAA, 0x00 ); /* green */
s_pClr[ 3 ] = al_make_color( 0x00, 0xAA, 0xAA ); /* cyan */
s_pClr[ 4 ] = al_make_color( 0xAA, 0x00, 0x00 ); /* red */
s_pClr[ 5 ] = al_make_color( 0xAA, 0x00, 0xAA ); /* magenta */
s_pClr[ 6 ] = al_make_color( 0xAA, 0x55, 0x00 ); /* brown */
s_pClr[ 7 ] = al_make_color( 0xAA, 0xAA, 0xAA ); /* white */
s_pClr[ 8 ] = al_make_color( 0x55, 0x55, 0x55 ); /* gray */
s_pClr[ 9 ] = al_make_color( 0x55, 0x55, 0xFF ); /* bright blue */
s_pClr[ 10 ] = al_make_color( 0x55, 0xFF, 0x55 ); /* bright green */
s_pClr[ 11 ] = al_make_color( 0x55, 0xFF, 0xFF ); /* bright cyan */
s_pClr[ 12 ] = al_make_color( 0xFF, 0x55, 0x55 ); /* bright red */
@@ -526,7 +526,7 @@ static HB_BOOL hb_gt_alleg_InitializeScreen( PHB_GT pGT, int iRows, int iCols, H
HB_GTSELF_REFRESH( pGT );
}
s_iGFXWidth = 0;
s_iGFXWidth = 0;
s_iGFXHeight = 0;
return lMode;
@@ -536,12 +536,12 @@ static void hb_gt_alleg_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hF
{
int iRet;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRDIFF ) hFilenoStdin, ( void * ) ( HB_PTRDIFF ) hFilenoStdout, ( void * ) ( HB_PTRDIFF ) hFilenoStderr));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRDIFF ) hFilenoStdin, ( void * ) ( HB_PTRDIFF ) hFilenoStdout, ( void * ) ( HB_PTRDIFF ) hFilenoStderr ) );
ssfCreateThinFont( &s_ssfDefaultFont );
s_iCursorStyle = SC_NONE;
s_fMakeInit = s_fGtError = HB_FALSE;
s_fMakeInit = s_fGtError = HB_FALSE;
if( allegro_init() != 0 )
hb_gt_alleg_Error( "Screen driver initialization failure" );
@@ -557,7 +557,7 @@ static void hb_gt_alleg_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hF
static void hb_gt_alleg_Exit( PHB_GT pGT )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_Exit(%p)", pGT));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_Exit(%p)", pGT ) );
HB_GTSUPER_EXIT( pGT );
@@ -580,7 +580,7 @@ static const char * hb_gt_alleg_Version( PHB_GT pGT, int iType )
static HB_BOOL hb_gt_alleg_SetMode( PHB_GT pGT, int iRows, int iCols )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_SetMode(%p,%d,%d)", pGT, iRows, iCols));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_SetMode(%p,%d,%d)", pGT, iRows, iCols ) );
HB_SYMBOL_UNUSED( pGT );
@@ -592,7 +592,7 @@ static int hb_gt_alleg_ReadKey( PHB_GT pGT, int iEventMask )
int nKey = 0;
int i, iMseCol, iMseRow;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_ReadKey(%p,%d)", pGT, iEventMask));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_ReadKey(%p,%d)", pGT, iEventMask ) );
HB_SYMBOL_UNUSED( iEventMask );
@@ -649,11 +649,11 @@ static int hb_gt_alleg_ReadKey( PHB_GT pGT, int iEventMask )
if( nKey != 0 )
{
/* Good standard debuging... */
printf("gtAlleg: Scancode: %d (0x%0x) ascii: %d (0x%0x) raw: %d (0x%0x)\n", nKey>>8, nKey>>8, nKey&0xff, nKey&0xff, nKey, nKey);
printf( "gtAlleg: Scancode: %d (0x%0x) ascii: %d (0x%0x) raw: %d (0x%0x)\n", nKey >> 8, nKey >> 8, nKey & 0xff, nKey & 0xff, nKey, nKey );
}
#endif
if( ( ( nKey & 255 ) == 2 || ( nKey & 255 ) == 3 ) && ( nKey >> 8 ) > 31 ) /* K_CTRL_ + navigation key */
if( ( ( nKey & 255 ) == 2 || ( nKey & 255 ) == 3 ) && ( nKey >> 8 ) > 31 ) /* K_CTRL_ + navigation key */
{
for( i = 0; i < GT_CTRL_TABLE_SIZE; i++ )
{
@@ -667,24 +667,24 @@ static int hb_gt_alleg_ReadKey( PHB_GT pGT, int iEventMask )
else if( ( nKey != 0 ) && ( ( nKey & 255 ) < 32 ) && ( ( nKey & 255 ) == ( nKey >> 8 ) ) ) /* K_CTRL_A .. Z */
{
#ifdef HB_NEW_KCTRL
nKey = 512 + ( nKey & 255 );
nKey = 512 + ( nKey & 255 );
#else
nKey = nKey & 255;
nKey = nKey & 255;
#endif
}
else if( ( ( ( nKey & 255 ) == 1 ) || ( ( nKey & 255 ) == 4 ) ) && ( ( ( nKey >> 8 ) >= AL_KEY_F1 ) && ( ( nKey >> 8 ) <= AL_KEY_F12 ) ) ) /* K_SH_F1 .. F12, K_ALT_F1..F12 */
{
if( ( nKey & 255 ) == 1 )
{
int iFKeys[ 12 ] = { K_SH_F1, K_SH_F2, K_SH_F2, K_SH_F4, K_SH_F5, K_SH_F6,
int iFKeys[ 12 ] = { K_SH_F1, K_SH_F2, K_SH_F2, K_SH_F4, K_SH_F5, K_SH_F6,
K_SH_F7, K_SH_F8, K_SH_F9, K_SH_F10, K_SH_F11, K_SH_F12 };
nKey = iFKeys[ ( nKey >> 8 ) - AL_KEY_F1 ];
nKey = iFKeys[ ( nKey >> 8 ) - AL_KEY_F1 ];
}
else
{
int iFKeys[ 12 ] = { K_ALT_F1, K_ALT_F2, K_ALT_F2, K_ALT_F4, K_ALT_F5, K_ALT_F6,
int iFKeys[ 12 ] = { K_ALT_F1, K_ALT_F2, K_ALT_F2, K_ALT_F4, K_ALT_F5, K_ALT_F6,
K_ALT_F7, K_ALT_F8, K_ALT_F9, K_ALT_F10, K_ALT_F11, K_ALT_F12 };
nKey = iFKeys[ ( nKey >> 8 ) - AL_KEY_F1 ];
nKey = iFKeys[ ( nKey >> 8 ) - AL_KEY_F1 ];
}
}
else if( nKey & 255 )
@@ -773,17 +773,17 @@ static void hb_gt_alleg_mouse_GetBounds( PHB_GT pGT, int * piTop, int * piLeft,
{
GT_SCREENINIT();
*piTop = s_mouseBound.iTop;
*piLeft = s_mouseBound.iLeft;
*piTop = s_mouseBound.iTop;
*piLeft = s_mouseBound.iLeft;
*piBottom = s_mouseBound.iBottom;
*piRight = s_mouseBound.iRight;
*piRight = s_mouseBound.iRight;
}
static HB_BOOL hb_gt_alleg_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
int iWidth, iHeight, iValue;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_Info(%p,%d,%p)", pGT, iType, pInfo));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_Info(%p,%d,%p)", pGT, iType, pInfo ) );
switch( iType )
{
@@ -799,7 +799,7 @@ static HB_BOOL hb_gt_alleg_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_SCREENWIDTH:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_fInit ?
AL_SCREEN_W : s_byFontWidth * s_iScrWidth );
AL_SCREEN_W : s_byFontWidth * s_iScrWidth );
iWidth = hb_itemGetNI( pInfo->pNewVal );
if( iWidth > 0 )
{
@@ -810,7 +810,7 @@ static HB_BOOL hb_gt_alleg_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_SCREENHEIGHT:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_fInit ?
AL_SCREEN_H : s_byFontSize * s_iScrHeight );
AL_SCREEN_H : s_byFontSize * s_iScrHeight );
iHeight = hb_itemGetNI( pInfo->pNewVal );
if( iHeight > 0 )
{
@@ -821,7 +821,7 @@ static HB_BOOL hb_gt_alleg_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_SCREENDEPTH:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_fInit ?
al_bitmap_color_depth( al_screen ) : al_desktop_color_depth() );
al_bitmap_color_depth( al_screen ) : al_desktop_color_depth() );
iValue = hb_itemGetNI( pInfo->pNewVal );
if( iValue == 8 || iValue == 15 || iValue == 16 ||
iValue == 24 || iValue == 32 )
@@ -833,10 +833,10 @@ static HB_BOOL hb_gt_alleg_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_FONTSIZE:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_byFontSize );
iValue = hb_itemGetNI( pInfo->pNewVal );
iValue = hb_itemGetNI( pInfo->pNewVal );
if( iValue > 0 && iValue < 256 )
{
s_byFontSize = ( unsigned short ) iValue;
s_byFontSize = ( unsigned short ) iValue;
s_byFontWidth = s_byFontSize / 2;
hb_gt_alleg_InitializeScreen( pGT, s_iScrHeight, s_iScrWidth, s_fInit );
}
@@ -897,7 +897,7 @@ static int hb_gt_alleg_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft
{
int iRet = 1;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", pGT, iType, iTop, iLeft, iBottom, iRight, iColor));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) );
GT_SCREENINIT();
HB_GTSELF_REFRESH( pGT );
@@ -934,10 +934,10 @@ static int hb_gt_alleg_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft
case HB_GFX_SETCLIP:
al_set_clip( s_bmp, iLeft, iTop, iRight, iBottom );
s_CLIP.iTop = iTop;
s_CLIP.iLeft = iLeft;
s_CLIP.iTop = iTop;
s_CLIP.iLeft = iLeft;
s_CLIP.iBottom = iBottom;
s_CLIP.iRight = iRight;
s_CLIP.iRight = iRight;
break;
case HB_GFX_DRAWINGMODE:
@@ -952,7 +952,7 @@ static int hb_gt_alleg_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft
al_acquire_bitmap( s_bmp );
al_put_pixel( s_bmp, iLeft, iTop, iBottom );
al_release_bitmap( s_bmp );
GT_UPD_GFXRECT( iTop,iLeft,iTop,iLeft );
GT_UPD_GFXRECT( iTop, iLeft, iTop, iLeft );
break;
case HB_GFX_LINE:
@@ -1030,7 +1030,7 @@ static void hb_gt_alleg_gfx_Text( PHB_GT pGT, int iTop, int iLeft, const char *
{
int iBottom, iRight;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_gfx_Text(%p,%d,%d,%s,%d,%d,%d)", pGT, iTop, iLeft, cBuf, iColor, iSize, iWidth));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_gfx_Text(%p,%d,%d,%s,%d,%d,%d)", pGT, iTop, iLeft, cBuf, iColor, iSize, iWidth ) );
HB_SYMBOL_UNUSED( iWidth );
@@ -1038,9 +1038,9 @@ static void hb_gt_alleg_gfx_Text( PHB_GT pGT, int iTop, int iLeft, const char *
HB_GTSELF_REFRESH( pGT );
if( iSize )
ssfSetFontSize( &s_ssfDefaultFont, (unsigned short) iSize );
ssfSetFontSize( &s_ssfDefaultFont, ( unsigned short ) iSize );
iRight = iLeft + ( int ) strlen( cBuf ) * ( s_ssfDefaultFont.fsize / 2 ) - 1;
iRight = iLeft + ( int ) strlen( cBuf ) * ( s_ssfDefaultFont.fsize / 2 ) - 1;
iBottom = iTop + s_ssfDefaultFont.fsize - 1;
al_acquire_bitmap( s_bmp );
@@ -1059,8 +1059,8 @@ static void hb_gt_alleg_gfx_Text( PHB_GT pGT, int iTop, int iLeft, const char *
static void hb_gt_alleg_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
{
int iColor;
HB_BYTE bAttr;
int iColor;
HB_BYTE bAttr;
HB_UCHAR uc;
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) );
@@ -1079,7 +1079,7 @@ static void hb_gt_alleg_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
{
if( ! HB_GTSELF_GETSCRUC( pGT, iRow, iCol++, &iColor, &bAttr, &uc, HB_TRUE ) )
break;
al_draw_rect_fill( s_bmp, iPosX, iPosY, iPosX + s_byFontWidth - 1, iPosY + s_byFontSize - 1, s_pClr[ ( iColor >> 4 ) & 0x0F ] );
al_draw_rect_fill( s_bmp, iPosX, iPosY, iPosX + s_byFontWidth - 1, iPosY + s_byFontSize - 1, s_pClr[ ( iColor >> 4 ) & 0x0F ] );
ssfDrawChar( s_bmp, &s_ssfDefaultFont, uc, iPosX, iPosY, s_pClr[ iColor & 0x0F ] );
iPosX += s_byFontWidth;
}
@@ -1133,27 +1133,27 @@ static void hb_gt_alleg_Refresh( PHB_GT pGT )
static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_FuncInit(%p)", pFuncTable));
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) );
pFuncTable->Init = hb_gt_alleg_Init;
pFuncTable->Exit = hb_gt_alleg_Exit;
pFuncTable->SetMode = hb_gt_alleg_SetMode;
pFuncTable->Redraw = hb_gt_alleg_Redraw;
pFuncTable->Refresh = hb_gt_alleg_Refresh;
pFuncTable->Version = hb_gt_alleg_Version;
pFuncTable->Info = hb_gt_alleg_Info;
pFuncTable->Init = hb_gt_alleg_Init;
pFuncTable->Exit = hb_gt_alleg_Exit;
pFuncTable->SetMode = hb_gt_alleg_SetMode;
pFuncTable->Redraw = hb_gt_alleg_Redraw;
pFuncTable->Refresh = hb_gt_alleg_Refresh;
pFuncTable->Version = hb_gt_alleg_Version;
pFuncTable->Info = hb_gt_alleg_Info;
pFuncTable->ReadKey = hb_gt_alleg_ReadKey;
pFuncTable->ReadKey = hb_gt_alleg_ReadKey;
pFuncTable->MouseIsPresent = hb_gt_alleg_mouse_IsPresent;
pFuncTable->MouseGetPos = hb_gt_alleg_mouse_GetPos;
pFuncTable->MouseSetPos = hb_gt_alleg_mouse_SetPos;
pFuncTable->MouseSetBounds = hb_gt_alleg_mouse_SetBounds;
pFuncTable->MouseGetBounds = hb_gt_alleg_mouse_GetBounds;
pFuncTable->MouseCountButton = hb_gt_alleg_mouse_CountButton;
pFuncTable->MouseButtonState = hb_gt_alleg_mouse_ButtonState;
pFuncTable->GfxPrimitive = hb_gt_alleg_gfx_Primitive;
pFuncTable->GfxText = hb_gt_alleg_gfx_Text;
pFuncTable->MouseIsPresent = hb_gt_alleg_mouse_IsPresent;
pFuncTable->MouseGetPos = hb_gt_alleg_mouse_GetPos;
pFuncTable->MouseSetPos = hb_gt_alleg_mouse_SetPos;
pFuncTable->MouseSetBounds = hb_gt_alleg_mouse_SetBounds;
pFuncTable->MouseGetBounds = hb_gt_alleg_mouse_GetBounds;
pFuncTable->MouseCountButton = hb_gt_alleg_mouse_CountButton;
pFuncTable->MouseButtonState = hb_gt_alleg_mouse_ButtonState;
pFuncTable->GfxPrimitive = hb_gt_alleg_gfx_Primitive;
pFuncTable->GfxText = hb_gt_alleg_gfx_Text;
return HB_TRUE;
}
@@ -1165,19 +1165,19 @@ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
/* ******************************************************************* */
/*
* this is necessary if you want to link with .so Allegro libs
* or when link statically and your linker will force to link main()
* from Allegro library not the Harbour one
*/
* this is necessary if you want to link with .so Allegro libs
* or when link statically and your linker will force to link main()
* from Allegro library not the Harbour one
*/
int _mangled_main( int argc, char * argv[] )
{
HB_TRACE(HB_TR_DEBUG, ("_mangled_main(%d, %p)", argc, argv));
HB_TRACE( HB_TR_DEBUG, ( "_mangled_main(%d, %p)", argc, argv ) );
hb_cmdargInit( argc, argv );
hb_vmInit( HB_TRUE );
return hb_vmQuit();
}
typedef int ( * _hballeg_main_t ) ( int argc, char * argv[] );
typedef int ( *_hballeg_main_t )( int argc, char * argv[] );
_hballeg_main_t _mangled_main_address = _mangled_main;

View File

@@ -65,14 +65,14 @@
#include "ssf.h"
#include "fixedth.sfc"
#define _F_LEFT 0
#define _F_TOP 1
#define _F_RIGHT 2
#define _F_BOTTOM 3
#define _F_LEFT2 4
#define _F_TOP2 5
#define _F_RIGHT2 6
#define _F_BOTTOM2 7
#define _F_LEFT 0
#define _F_TOP 1
#define _F_RIGHT 2
#define _F_BOTTOM 3
#define _F_LEFT2 4
#define _F_TOP2 5
#define _F_RIGHT2 6
#define _F_BOTTOM2 7
void ssfCreateThinFont( ssfFont * sfont )
{
@@ -87,16 +87,16 @@ void ssfSetFontSize( ssfFont * sfont, unsigned short fsize )
unsigned short ssfDrawChar( AL_BITMAP * dst, ssfFont * sfont, char c, int x, int y, int color )
{
HB_BYTE p;
int i, j, thick;
HB_BYTE p;
int i, j, thick;
ssfGlyph charGlyph;
ssfFrame charFrame;
int points[ 8 ];
float fScale;
int points[ 8 ];
float fScale;
p = ( HB_BYTE ) c;
p = ( HB_BYTE ) c;
charGlyph = *sfont->chars[ p ];
fScale = ( float ) ( ( float ) sfont->fsize / ( float ) 65535 );
fScale = ( float ) ( ( float ) sfont->fsize / ( float ) 65535 );
for( i = 0; i < charGlyph.num; i++ )
{
@@ -110,92 +110,92 @@ unsigned short ssfDrawChar( AL_BITMAP * dst, ssfFont * sfont, char c, int x, int
}
else
{
points[ _F_LEFT ] = x + ( int ) ( fScale * charFrame.left );
points[ _F_TOP ] = y + ( int ) ( fScale * charFrame.top );
points[ _F_RIGHT ] = x + ( int ) ( fScale * charFrame.right );
points[ _F_BOTTOM ] = y + ( int ) ( fScale * charFrame.bottom );
points[ _F_LEFT ] = x + ( int ) ( fScale * charFrame.left );
points[ _F_TOP ] = y + ( int ) ( fScale * charFrame.top );
points[ _F_RIGHT ] = x + ( int ) ( fScale * charFrame.right );
points[ _F_BOTTOM ] = y + ( int ) ( fScale * charFrame.bottom );
}
switch( charFrame.ftype )
{
case SSF_SPLINE2:
thick = ( int ) ( fScale * charFrame.thick );
case SSF_SPLINE2:
thick = ( int ) ( fScale * charFrame.thick );
if( thick == 0 )
thick++;
if( thick == 0 )
thick++;
for( j = 0; j < thick; j++ )
{
al_draw_spline( dst, points, color );
switch( charFrame.thickdir )
for( j = 0; j < thick; j++ )
{
case THICK_LEFT:
points[ _F_LEFT ]--;
points[ _F_RIGHT ]--;
points[ _F_LEFT2 ]--;
points[ _F_RIGHT2 ]--;
break;
case THICK_UP:
points[ _F_TOP ]--;
points[ _F_BOTTOM ]--;
points[ _F_TOP2 ]--;
points[ _F_BOTTOM2 ]--;
break;
case THICK_RIGHT:
points[ _F_LEFT ]++;
points[ _F_RIGHT ]++;
points[ _F_LEFT2 ]++;
points[ _F_RIGHT2 ]++;
break;
case THICK_DOWN:
points[ _F_TOP ]++;
points[ _F_BOTTOM ]++;
points[ _F_TOP2 ]++;
points[ _F_BOTTOM2 ]++;
break;
al_draw_spline( dst, points, color );
switch( charFrame.thickdir )
{
case THICK_LEFT:
points[ _F_LEFT ]--;
points[ _F_RIGHT ]--;
points[ _F_LEFT2 ]--;
points[ _F_RIGHT2 ]--;
break;
case THICK_UP:
points[ _F_TOP ]--;
points[ _F_BOTTOM ]--;
points[ _F_TOP2 ]--;
points[ _F_BOTTOM2 ]--;
break;
case THICK_RIGHT:
points[ _F_LEFT ]++;
points[ _F_RIGHT ]++;
points[ _F_LEFT2 ]++;
points[ _F_RIGHT2 ]++;
break;
case THICK_DOWN:
points[ _F_TOP ]++;
points[ _F_BOTTOM ]++;
points[ _F_TOP2 ]++;
points[ _F_BOTTOM2 ]++;
break;
}
}
}
break;
break;
case SSF_LINE:
thick = ( int ) ( fScale * charFrame.thick );
case SSF_LINE:
thick = ( int ) ( fScale * charFrame.thick );
if( thick == 0 )
thick++;
if( thick == 0 )
thick++;
for( j = 0; j < thick; j++ )
{
al_draw_line( dst, points[ _F_LEFT ], points[ _F_TOP ], points[ _F_RIGHT ], points[ _F_BOTTOM ], color );
switch( charFrame.thickdir )
for( j = 0; j < thick; j++ )
{
case THICK_LEFT:
points[ _F_LEFT ]--;
points[ _F_RIGHT ]--;
break;
case THICK_UP:
points[ _F_TOP ]--;
points[ _F_BOTTOM ]--;
break;
case THICK_RIGHT:
points[ _F_LEFT ]++;
points[ _F_RIGHT ]++;
break;
case THICK_DOWN:
points[ _F_TOP ]++;
points[ _F_BOTTOM ]++;
break;
al_draw_line( dst, points[ _F_LEFT ], points[ _F_TOP ], points[ _F_RIGHT ], points[ _F_BOTTOM ], color );
switch( charFrame.thickdir )
{
case THICK_LEFT:
points[ _F_LEFT ]--;
points[ _F_RIGHT ]--;
break;
case THICK_UP:
points[ _F_TOP ]--;
points[ _F_BOTTOM ]--;
break;
case THICK_RIGHT:
points[ _F_LEFT ]++;
points[ _F_RIGHT ]++;
break;
case THICK_DOWN:
points[ _F_TOP ]++;
points[ _F_BOTTOM ]++;
break;
}
}
}
break;
break;
case SSF_BOX:
al_draw_rect_fill( dst, points[ _F_LEFT ], points[ _F_TOP ], points[ _F_RIGHT ], points[ _F_BOTTOM ], color );
break;
case SSF_BOX:
al_draw_rect_fill( dst, points[ _F_LEFT ], points[ _F_TOP ], points[ _F_RIGHT ], points[ _F_BOTTOM ], color );
break;
case SSF_TRIANGLE:
thick = x + ( int ) ( fScale * charFrame.thick );
al_draw_triangle( dst, points[ _F_LEFT ], points[ _F_TOP ], points[ _F_RIGHT ], points[ _F_BOTTOM ], thick, y + ( int ) ( fScale * charFrame.thickdir ), color );
break;
case SSF_TRIANGLE:
thick = x + ( int ) ( fScale * charFrame.thick );
al_draw_triangle( dst, points[ _F_LEFT ], points[ _F_TOP ], points[ _F_RIGHT ], points[ _F_BOTTOM ], thick, y + ( int ) ( fScale * charFrame.thickdir ), color );
break;
}
}

View File

@@ -89,134 +89,134 @@
/* Hack to use old Allegro branches */
#ifndef AL_GFX_NONE
#define AL_GFX_NONE GFX_NONE
#define AL_GFX_SAFE GFX_SAFE
#define AL_GFX_NONE GFX_NONE
#define AL_GFX_SAFE GFX_SAFE
#ifdef GFX_XWINDOWS
#define AL_GFX_XDGA GFX_XDGA
#define AL_GFX_XDGA2 GFX_XDGA2
#define AL_GFX_XWINDOWS GFX_XWINDOWS
#define AL_GFX_XDGA GFX_XDGA
#define AL_GFX_XDGA2 GFX_XDGA2
#define AL_GFX_XWINDOWS GFX_XWINDOWS
#endif
#define AL_GFX_VBEAF GFX_VBEAF
#define AL_GFX_VBEAF GFX_VBEAF
#ifdef GFX_FBCON
#define AL_GFX_FBCON GFX_FBCON
#define AL_GFX_FBCON GFX_FBCON
#endif
#define AL_GFX_AUTODETECT_WINDOWED GFX_AUTODETECT_WINDOWED
#define AL_GFX_AUTODETECT GFX_AUTODETECT
#define AL_GFX_AUTODETECT_WINDOWED GFX_AUTODETECT_WINDOWED
#define AL_GFX_AUTODETECT GFX_AUTODETECT
#ifdef GFX_GDI
#define AL_GFX_GDI GFX_GDI
#define AL_GFX_DIRECTX_WIN GFX_DIRECTX_WIN
#define AL_GFX_GDI GFX_GDI
#define AL_GFX_DIRECTX_WIN GFX_DIRECTX_WIN
#endif
#define AL_BITMAP BITMAP
#define AL_SCREEN_W SCREEN_W
#define AL_SCREEN_H SCREEN_H
#define AL_KEY_ESC KEY_ESC
#define AL_KEY_INSERT KEY_INSERT
#define AL_KEY_HOME KEY_HOME
#define AL_KEY_PGUP KEY_PGUP
#define AL_KEY_PGDN KEY_PGDN
#define AL_KEY_END KEY_END
#define AL_KEY_DEL KEY_DEL
#define AL_KEY_UP KEY_UP
#define AL_KEY_DOWN KEY_DOWN
#define AL_KEY_LEFT KEY_LEFT
#define AL_KEY_RIGHT KEY_RIGHT
#define AL_KEY_QUOTE KEY_QUOTE
#define AL_KEY_A KEY_A
#define AL_KEY_B KEY_B
#define AL_KEY_C KEY_C
#define AL_KEY_D KEY_D
#define AL_KEY_E KEY_E
#define AL_KEY_F KEY_F
#define AL_KEY_G KEY_G
#define AL_KEY_H KEY_H
#define AL_KEY_I KEY_I
#define AL_KEY_J KEY_J
#define AL_KEY_K KEY_K
#define AL_KEY_L KEY_L
#define AL_KEY_M KEY_M
#define AL_KEY_N KEY_N
#define AL_KEY_O KEY_O
#define AL_KEY_P KEY_P
#define AL_KEY_Q KEY_Q
#define AL_KEY_R KEY_R
#define AL_KEY_S KEY_S
#define AL_KEY_T KEY_T
#define AL_KEY_U KEY_U
#define AL_KEY_V KEY_V
#define AL_KEY_W KEY_W
#define AL_KEY_X KEY_X
#define AL_KEY_Y KEY_Y
#define AL_KEY_Z KEY_Z
#define AL_KEY_F1 KEY_F1
#define AL_KEY_F2 KEY_F2
#define AL_KEY_F3 KEY_F3
#define AL_KEY_F4 KEY_F4
#define AL_KEY_F5 KEY_F5
#define AL_KEY_F6 KEY_F6
#define AL_KEY_F7 KEY_F7
#define AL_KEY_F8 KEY_F8
#define AL_KEY_F9 KEY_F9
#define AL_KEY_F10 KEY_F10
#define AL_KEY_F11 KEY_F11
#define AL_KEY_F12 KEY_F12
#define al_desktop_color_depth desktop_color_depth
#define al_set_color_depth set_color_depth
#define al_bitmap_color_depth bitmap_color_depth
#define al_get_desktop_resolution get_desktop_resolution
#define al_install_timer install_timer
#define al_screen screen
#define al_set_gfx_mode set_gfx_mode
#define al_set_window_title set_window_title
#define al_text_mode text_mode
#define al_make_color makecol
#define al_key_shifts key_shifts
#define al_install_keyboard install_keyboard
#define al_keyboard_needs_poll keyboard_needs_poll
#define al_poll_keyboard poll_keyboard
#define al_key_pressed keypressed
#define al_read_key readkey
#define al_set_keyboard_leds set_leds
#define al_install_mouse install_mouse
#define al_show_mouse show_mouse
#define al_mouse_needs_poll mouse_needs_poll
#define al_poll_mouse poll_mouse
#define al_mouse_x mouse_x
#define al_mouse_y mouse_y
#define al_mouse_b mouse_b
#define al_scare_mouse scare_mouse
#define al_scare_mouse_area scare_mouse_area
#define al_unscare_mouse unscare_mouse
#define al_position_mouse position_mouse
#define al_set_mouse_range set_mouse_range
#define al_create_bitmap create_bitmap
#define al_create_system_bitmap create_system_bitmap
#define al_destroy_bitmap destroy_bitmap
#define al_acquire_screen acquire_screen
#define al_release_screen release_screen
#define al_acquire_bitmap acquire_bitmap
#define al_release_bitmap release_bitmap
#define al_drawing_mode drawing_mode
#define al_get_pixel getpixel
#define al_put_pixel putpixel
#define al_draw_line line
#define al_draw_vline vline
#define al_draw_hline hline
#define al_draw_rect rect
#define al_draw_rect_fill rectfill
#define al_draw_spline spline
#define al_draw_circle circle
#define al_draw_circle_fill circlefill
#define al_draw_ellipse ellipse
#define al_draw_ellipse_fill ellipsefill
#define al_floodfill floodfill
#define al_draw_triangle triangle
#define al_blit blit
#define al_clear_to_color clear_to_color
#define AL_BITMAP BITMAP
#define AL_SCREEN_W SCREEN_W
#define AL_SCREEN_H SCREEN_H
#define AL_KEY_ESC KEY_ESC
#define AL_KEY_INSERT KEY_INSERT
#define AL_KEY_HOME KEY_HOME
#define AL_KEY_PGUP KEY_PGUP
#define AL_KEY_PGDN KEY_PGDN
#define AL_KEY_END KEY_END
#define AL_KEY_DEL KEY_DEL
#define AL_KEY_UP KEY_UP
#define AL_KEY_DOWN KEY_DOWN
#define AL_KEY_LEFT KEY_LEFT
#define AL_KEY_RIGHT KEY_RIGHT
#define AL_KEY_QUOTE KEY_QUOTE
#define AL_KEY_A KEY_A
#define AL_KEY_B KEY_B
#define AL_KEY_C KEY_C
#define AL_KEY_D KEY_D
#define AL_KEY_E KEY_E
#define AL_KEY_F KEY_F
#define AL_KEY_G KEY_G
#define AL_KEY_H KEY_H
#define AL_KEY_I KEY_I
#define AL_KEY_J KEY_J
#define AL_KEY_K KEY_K
#define AL_KEY_L KEY_L
#define AL_KEY_M KEY_M
#define AL_KEY_N KEY_N
#define AL_KEY_O KEY_O
#define AL_KEY_P KEY_P
#define AL_KEY_Q KEY_Q
#define AL_KEY_R KEY_R
#define AL_KEY_S KEY_S
#define AL_KEY_T KEY_T
#define AL_KEY_U KEY_U
#define AL_KEY_V KEY_V
#define AL_KEY_W KEY_W
#define AL_KEY_X KEY_X
#define AL_KEY_Y KEY_Y
#define AL_KEY_Z KEY_Z
#define AL_KEY_F1 KEY_F1
#define AL_KEY_F2 KEY_F2
#define AL_KEY_F3 KEY_F3
#define AL_KEY_F4 KEY_F4
#define AL_KEY_F5 KEY_F5
#define AL_KEY_F6 KEY_F6
#define AL_KEY_F7 KEY_F7
#define AL_KEY_F8 KEY_F8
#define AL_KEY_F9 KEY_F9
#define AL_KEY_F10 KEY_F10
#define AL_KEY_F11 KEY_F11
#define AL_KEY_F12 KEY_F12
#define al_desktop_color_depth desktop_color_depth
#define al_set_color_depth set_color_depth
#define al_bitmap_color_depth bitmap_color_depth
#define al_get_desktop_resolution get_desktop_resolution
#define al_install_timer install_timer
#define al_screen screen
#define al_set_gfx_mode set_gfx_mode
#define al_set_window_title set_window_title
#define al_text_mode text_mode
#define al_make_color makecol
#define al_key_shifts key_shifts
#define al_install_keyboard install_keyboard
#define al_keyboard_needs_poll keyboard_needs_poll
#define al_poll_keyboard poll_keyboard
#define al_key_pressed keypressed
#define al_read_key readkey
#define al_set_keyboard_leds set_leds
#define al_install_mouse install_mouse
#define al_show_mouse show_mouse
#define al_mouse_needs_poll mouse_needs_poll
#define al_poll_mouse poll_mouse
#define al_mouse_x mouse_x
#define al_mouse_y mouse_y
#define al_mouse_b mouse_b
#define al_scare_mouse scare_mouse
#define al_scare_mouse_area scare_mouse_area
#define al_unscare_mouse unscare_mouse
#define al_position_mouse position_mouse
#define al_set_mouse_range set_mouse_range
#define al_create_bitmap create_bitmap
#define al_create_system_bitmap create_system_bitmap
#define al_destroy_bitmap destroy_bitmap
#define al_acquire_screen acquire_screen
#define al_release_screen release_screen
#define al_acquire_bitmap acquire_bitmap
#define al_release_bitmap release_bitmap
#define al_drawing_mode drawing_mode
#define al_get_pixel getpixel
#define al_put_pixel putpixel
#define al_draw_line line
#define al_draw_vline vline
#define al_draw_hline hline
#define al_draw_rect rect
#define al_draw_rect_fill rectfill
#define al_draw_spline spline
#define al_draw_circle circle
#define al_draw_circle_fill circlefill
#define al_draw_ellipse ellipse
#define al_draw_ellipse_fill ellipsefill
#define al_floodfill floodfill
#define al_draw_triangle triangle
#define al_blit blit
#define al_clear_to_color clear_to_color
#ifndef al_set_clip
#if ALLEGRO_SUB_VERSION < 2
#define al_set_clip set_clip
#define al_set_clip set_clip
#else
#define al_set_clip set_clip_rect
#define al_set_clip set_clip_rect
#endif
#endif
#endif
@@ -233,13 +233,13 @@ typedef enum
} ssfType;
#ifndef SSF_MAXFRAMES
#define SSF_MAXFRAMES 128
#define SSF_MAXFRAMES 128
#endif
#define THICK_LEFT 0
#define THICK_UP 1
#define THICK_RIGHT 2
#define THICK_DOWN 3
#define THICK_LEFT 0
#define THICK_UP 1
#define THICK_RIGHT 2
#define THICK_DOWN 3
typedef struct _ssfFrame
{
@@ -250,13 +250,13 @@ typedef struct _ssfFrame
typedef struct _ssfGlyph
{
int num;
int num;
ssfFrame frames[ SSF_MAXFRAMES ];
} ssfGlyph;
typedef struct _ssfFont
{
unsigned short fsize;
unsigned short fsize;
const ssfGlyph ** chars;
} ssfFont;

View File

@@ -3,16 +3,16 @@
*/
/*******
*
* amf.h
*
* Aleksander Czajczynski <hb/at/fki.pl> 2011-2012
*
* amf.h - AMF3 headers
*
* Based on a AmFast C library for Python by Dave Thompson
*
********/
*
* amf.h
*
* Aleksander Czajczynski <hb/at/fki.pl> 2011-2012
*
* amf.h - AMF3 headers
*
* Based on a AmFast C library for Python by Dave Thompson
*
********/
#ifndef __HBAMF_H
#define __HBAMF_H
@@ -24,44 +24,44 @@
/* ---- Harbour support */
#define OBJAMF_VER 0
#define OBJAMF_VER 0
#define OBJAMF_VAR_COUNT 5
#define OBJAMF_VAR_VER 1
#define OBJAMF_VAR_NAME 2
#define OBJAMF_VAR_HASH 3
#define OBJAMF_VAR_COUNT 5
#define OBJAMF_VAR_VER 1
#define OBJAMF_VAR_NAME 2
#define OBJAMF_VAR_HASH 3
/* ---- AMF3 */
/* Valid AMF3 integer range */
#define MIN_INT -268435457
#define MAX_INT 268435456
#define MIN_INT -268435457
#define MAX_INT 268435456
/* Reference bit */
#define REFERENCE_BIT 0x01
#define REFERENCE_BIT 0x01
/* Empty string */
#define EMPTY_STRING_TYPE 0x01
#define EMPTY_STRING_TYPE 0x01
/* Object Headers */
#define STATIC 0x03
#define DYNAMIC 0x0B
#define EXTERNALIZABLE 0x07
#define STATIC 0x03
#define DYNAMIC 0x0B
#define EXTERNALIZABLE 0x07
/* Type markers */
#define UNDEFINED_TYPE 0x00
#define NULL_TYPE 0x01
#define FALSE_TYPE 0x02
#define TRUE_TYPE 0x03
#define INT_TYPE 0x04
#define DOUBLE_TYPE 0x05
#define STRING_TYPE 0x06
#define XML_DOC_TYPE 0x07
#define DATE_TYPE 0x08
#define ARRAY_TYPE 0x09
#define OBJECT_TYPE 0x0A
#define XML_TYPE 0x0B
#define BYTE_ARRAY_TYPE 0x0C
#define AMF3_AMF0 0x11
#define UNDEFINED_TYPE 0x00
#define NULL_TYPE 0x01
#define FALSE_TYPE 0x02
#define TRUE_TYPE 0x03
#define INT_TYPE 0x04
#define DOUBLE_TYPE 0x05
#define STRING_TYPE 0x06
#define XML_DOC_TYPE 0x07
#define DATE_TYPE 0x08
#define ARRAY_TYPE 0x09
#define OBJECT_TYPE 0x0A
#define XML_TYPE 0x0B
#define BYTE_ARRAY_TYPE 0x0C
#define AMF3_AMF0 0x11
#endif

View File

@@ -29,12 +29,12 @@
typedef struct
{
const char * cBuf;
HB_ISIZ position;
HB_ISIZ length;
PHB_ITEM obj_ref;
PHB_ITEM str_ref;
PHB_ITEM class_ref;
PHB_ITEM conv_function;
HB_ISIZ position;
HB_ISIZ length;
PHB_ITEM obj_ref;
PHB_ITEM str_ref;
PHB_ITEM class_ref;
PHB_ITEM conv_function;
} amfContext;
static HB_BOOL amf3_getItem( amfContext * context, PHB_ITEM pItem );
@@ -78,26 +78,26 @@ static PHB_ITEM hbamf_cls_externalizable_instance( PHB_ITEM pClassFuncStr )
static char * readByte( amfContext * context )
{
HB_ISIZ new_position = context->position + 1;
char * byte_ref;
HB_ISIZ new_position = context->position + 1;
char * byte_ref;
if( new_position < 0 || new_position > context->length )
return NULL;
byte_ref = ( char * ) ( context->cBuf + context->position );
byte_ref = ( char * ) ( context->cBuf + context->position );
context->position = new_position;
return byte_ref;
}
static char * readBytes( amfContext * context, HB_ISIZ len )
{
HB_ISIZ new_position = context->position + len;
char * result;
HB_ISIZ new_position = context->position + len;
char * result;
if( new_position < 0 || new_position > context->length )
return NULL;
result = ( char * ) ( context->cBuf + context->position );
result = ( char * ) ( context->cBuf + context->position );
context->position = new_position;
return result;
}
@@ -105,9 +105,9 @@ static char * readBytes( amfContext * context, HB_ISIZ len )
static HB_BOOL amfX_decode_double( amfContext * context, double * val )
{
#ifndef HB_BIG_ENDIAN
char c_val[ 8 ];
char c_val[ 8 ];
#endif
const char * bytes = readBytes( context, 8 );
const char * bytes = readBytes( context, 8 );
if( ! bytes )
return HB_FALSE;
@@ -127,14 +127,14 @@ static HB_BOOL amfX_decode_double( amfContext * context, double * val )
memcpy( val, bytes, 8 );
#else
/* Flip endianness */
c_val[ 0 ] = bytes[ 7 ];
c_val[ 1 ] = bytes[ 6 ];
c_val[ 2 ] = bytes[ 5 ];
c_val[ 3 ] = bytes[ 4 ];
c_val[ 4 ] = bytes[ 3 ];
c_val[ 5 ] = bytes[ 2 ];
c_val[ 6 ] = bytes[ 1 ];
c_val[ 7 ] = bytes[ 0 ];
c_val[ 0 ] = bytes[ 7 ];
c_val[ 1 ] = bytes[ 6 ];
c_val[ 2 ] = bytes[ 5 ];
c_val[ 3 ] = bytes[ 4 ];
c_val[ 4 ] = bytes[ 3 ];
c_val[ 5 ] = bytes[ 2 ];
c_val[ 6 ] = bytes[ 1 ];
c_val[ 7 ] = bytes[ 0 ];
memcpy( val, c_val, 8 );
#endif
@@ -143,10 +143,10 @@ static HB_BOOL amfX_decode_double( amfContext * context, double * val )
static HB_BOOL amf3_decode_int( amfContext * context, int * iVal )
{
int result = 0;
int byte_cnt = 0;
char * byte_ref;
char byte;
int result = 0;
int byte_cnt = 0;
char * byte_ref;
char byte;
byte_ref = readByte( context );
if( ! byte_ref )
@@ -157,25 +157,25 @@ static HB_BOOL amf3_decode_int( amfContext * context, int * iVal )
/* If 0x80 is set, int includes the next byte, up to 4 total bytes */
while( ( byte & 0x80 ) && ( byte_cnt < 3 ) )
{
result <<= 7;
result |= byte & 0x7F;
result <<= 7;
result |= byte & 0x7F;
byte_ref = readByte( context );
if( ! byte_ref )
return HB_FALSE;
byte = byte_ref[ 0 ];
byte = byte_ref[ 0 ];
byte_cnt++;
}
/* shift bits in last byte */
if( byte_cnt < 3 )
{
result <<= 7; /* shift by 7, since the 1st bit is reserved for next byte flag */
result |= byte & 0x7F;
result <<= 7; /* shift by 7, since the 1st bit is reserved for next byte flag */
result |= byte & 0x7F;
}
else
{
result <<= 8; /* shift by 8, since no further bytes are possible and 1st bit is not used for flag. */
result |= byte & 0xff;
result <<= 8; /* shift by 8, since no further bytes are possible and 1st bit is not used for flag. */
result |= byte & 0xff;
}
/* Move sign bit, since we're converting 29bit->32bit */
@@ -191,7 +191,7 @@ static HB_BOOL amf3_decode_int( amfContext * context, int * iVal )
static HB_BOOL amf3_decode_reference( PHB_ITEM pHash, int val, PHB_ITEM pRefItem )
{
/* Check for index reference */
if( (val & REFERENCE_BIT) == 0 )
if( ( val & REFERENCE_BIT ) == 0 )
{
PHB_ITEM pKey = hb_itemNew( NULL );
hb_itemPutNI( pKey, val >> 1 );
@@ -229,8 +229,8 @@ static PHB_ITEM amf3_decode_reference( PHB_ITEM pHash, int val )
static void amf3_add_reference( PHB_ITEM pHash, PHB_ITEM pItem )
{
HB_SIZE iRef = hb_hashLen( pHash );
PHB_ITEM pKey = hb_itemNew( NULL );
HB_SIZE iRef = hb_hashLen( pHash );
PHB_ITEM pKey = hb_itemNew( NULL );
/* the reference id in AMF starts from 0, and increase
sequentially - this means we can also use an array,
@@ -258,7 +258,7 @@ static HB_BOOL amf3_deserialize_string( amfContext * context, PHB_ITEM pItem )
int header;
int * header_p = &header;
PHB_ITEM pRefItem;
PHB_ITEM pHash = context->str_ref;
PHB_ITEM pHash = context->str_ref;
if( ! amf3_decode_int( context, header_p ) )
return HB_FALSE;
@@ -337,8 +337,8 @@ static HB_BOOL amf3_decode_dynamic_dict( amfContext * context, PHB_ITEM pItem )
/* Populate an array with vals from the buffer. */
static HB_BOOL decode_dynamic_array_AMF3( amfContext * context, PHB_ITEM pItem, int array_len, HB_BOOL dict )
{
int i;
HB_BOOL lRet;
int i;
HB_BOOL lRet;
if( dict )
{
@@ -394,7 +394,7 @@ static HB_BOOL amf3_deserialize_array( amfContext * context, PHB_ITEM pItem, HB_
int header;
int * header_p = &header;
PHB_ITEM pRefItem;
PHB_ITEM pHash = context->obj_ref;
PHB_ITEM pHash = context->obj_ref;
int array_len;
HB_BOOL mixed; /* if the result will be a Hash with both numbers and strings as keys */
char * byte_ref;
@@ -507,7 +507,7 @@ static HB_BOOL amf3_deserialize_date( amfContext * context, PHB_ITEM pItem )
int header;
int * header_p = &header;
PHB_ITEM pRefItem;
PHB_ITEM pHash = context->obj_ref;
PHB_ITEM pHash = context->obj_ref;
if( ! amf3_decode_int( context, header_p ) )
return HB_FALSE;
@@ -554,7 +554,7 @@ static HB_BOOL amf3_deserialize_byte_array( amfContext * context, PHB_ITEM pItem
int header;
int * header_p = &header;
PHB_ITEM pRefItem;
PHB_ITEM pHash = context->obj_ref;
PHB_ITEM pHash = context->obj_ref;
if( ! amf3_decode_int( context, header_p ) )
return HB_FALSE;
@@ -586,12 +586,12 @@ static HB_BOOL amf3_deserialize_byte_array( amfContext * context, PHB_ITEM pItem
/* Get an object's class def - nearly a copy/paste from decoder */
static PHB_ITEM class_def_from_classname( /* amfContext * context, */ PHB_ITEM pClassName )
{
HB_USHORT uiClass;
PHB_ITEM pClass;
PHB_ITEM pKey;
PHB_ITEM pValue;
char * pszBuffer = hb_itemGetC( pClassName );
HB_SIZE nLen = hb_itemGetCLen( pClassName );
HB_USHORT uiClass;
PHB_ITEM pClass;
PHB_ITEM pKey;
PHB_ITEM pValue;
char * pszBuffer = hb_itemGetC( pClassName );
HB_SIZE nLen = hb_itemGetCLen( pClassName );
hb_strUpper( pszBuffer, nLen );
@@ -604,10 +604,10 @@ static PHB_ITEM class_def_from_classname( /* amfContext * context, */ PHB_ITEM p
if( ! uiClass )
return NULL;
pClass = hb_hashNew( NULL );
pClass = hb_hashNew( NULL );
pKey = hb_itemPutC( NULL, "CLASS_DEF" );
pValue = hb_itemNew( NULL );
pKey = hb_itemPutC( NULL, "CLASS_DEF" );
pValue = hb_itemNew( NULL );
if( ! hb_hashAdd( pClass, pKey, pValue ) )
{
hb_itemRelease( pKey );
@@ -618,8 +618,8 @@ static PHB_ITEM class_def_from_classname( /* amfContext * context, */ PHB_ITEM p
hb_itemRelease( pKey );
hb_itemRelease( pValue );
pKey = hb_itemPutC( NULL, "alias" );
pValue = hb_itemPutC( NULL, hb_clsName( uiClass ) );
pKey = hb_itemPutC( NULL, "alias" );
pValue = hb_itemPutC( NULL, hb_clsName( uiClass ) );
if( ! hb_hashAdd( pClass, pKey, pValue ) )
{
hb_itemRelease( pKey );
@@ -632,8 +632,8 @@ static PHB_ITEM class_def_from_classname( /* amfContext * context, */ PHB_ITEM p
if( hbamf_is_cls_externalizable( uiClass ) )
{
pKey = hb_itemPutC( NULL, "EXTERNALIZABLE_CLASS_DEF" );
pValue = hb_itemNew( NULL );
pKey = hb_itemPutC( NULL, "EXTERNALIZABLE_CLASS_DEF" );
pValue = hb_itemNew( NULL );
if( ! hb_hashAdd( pClass, pKey, pValue ) )
{
hb_itemRelease( pKey );
@@ -655,8 +655,8 @@ static PHB_ITEM class_def_from_classname( /* amfContext * context, */ PHB_ITEM p
*/
static HB_BOOL amf3_decode_class_def( amfContext * context, PHB_ITEM pClass, int header )
{
PHB_ITEM pStrAlias = hb_itemNew( NULL );
PHB_ITEM pMappedClassDef = NULL;
PHB_ITEM pStrAlias = hb_itemNew( NULL );
PHB_ITEM pMappedClassDef = NULL;
PHB_ITEM pKey;
PHB_ITEM pValue;
PHB_ITEM pAttrs;
@@ -729,8 +729,8 @@ static HB_BOOL amf3_decode_class_def( amfContext * context, PHB_ITEM pClass, int
/* Set dynamic flag */
pKey = hb_itemPutC( NULL, "dynamic" );
pValue = hb_itemPutL( NULL, ( header & DYNAMIC ) == DYNAMIC );
pKey = hb_itemPutC( NULL, "dynamic" );
pValue = hb_itemPutL( NULL, ( header & DYNAMIC ) == DYNAMIC );
if( ! hb_hashAdd( pClass, pKey, pValue ) )
{
hb_itemRelease( pKey );
@@ -741,8 +741,8 @@ static HB_BOOL amf3_decode_class_def( amfContext * context, PHB_ITEM pClass, int
hb_itemRelease( pValue );
/* Decode static attr names */
static_attr_len = ( int ) ( header >> 4 );
pAttrs = hb_itemNew( NULL );
static_attr_len = ( int ) ( header >> 4 );
pAttrs = hb_itemNew( NULL );
hb_arrayNew( pAttrs, static_attr_len );
for( i = 0; i < static_attr_len; i++ )
@@ -787,7 +787,7 @@ static HB_BOOL amf3_decode_class_def( amfContext * context, PHB_ITEM pClass, int
*/
static HB_BOOL amf3_deserialize_class_def( amfContext * context, PHB_ITEM pClass, int header )
{
PHB_ITEM pHash = context->class_ref;
PHB_ITEM pHash = context->class_ref;
PHB_ITEM pRefItem;
/* Check for reference */
@@ -877,8 +877,8 @@ static HB_BOOL amf3_decode_obj_attrs( amfContext * context, PHB_ITEM pHash, PHB_
/* Decode an anonymous obj. */
static HB_BOOL amf3_decode_anon_obj( amfContext * context, PHB_ITEM pItem, PHB_ITEM pClass )
{
PHB_ITEM pAnonHash = hb_itemNew( NULL );
HB_BOOL result = HB_FALSE;
PHB_ITEM pAnonHash = hb_itemNew( NULL );
HB_BOOL result = HB_FALSE;
/* Original python comment which I don't understand:
We're using merge instead of populating the dict
@@ -896,11 +896,11 @@ static HB_BOOL amf3_decode_anon_obj( amfContext * context, PHB_ITEM pItem, PHB_I
static HB_BOOL amf3_decode_externalizable( amfContext * context, PHB_ITEM pItem )
{
const char * position;
PHB_ITEM pRetCopy = hb_itemNew( NULL );
PHB_ITEM pStr, pPos;
HB_BOOL result = HB_TRUE;
PHB_ITEM pObject;
const char * position;
PHB_ITEM pRetCopy = hb_itemNew( NULL );
PHB_ITEM pStr, pPos;
HB_BOOL result = HB_TRUE;
PHB_ITEM pObject;
if( pItem == hb_stackReturnItem() )
pObject = pRetCopy;
@@ -940,9 +940,9 @@ static HB_BOOL amf3_decode_externalizable( amfContext * context, PHB_ITEM pItem
static HB_BOOL amf3_deserialize_obj( amfContext * context, PHB_ITEM pItem, HB_BOOL proxy )
{
int header;
int * header_p = &header;
int * header_p = &header;
PHB_ITEM pRefItem;
PHB_ITEM pHash = context->obj_ref;
PHB_ITEM pHash = context->obj_ref;
PHB_ITEM pClass;
PHB_ITEM pMappedClassDef;
PHB_ITEM pValue;
@@ -1028,13 +1028,13 @@ static HB_BOOL amf3_deserialize_obj( amfContext * context, PHB_ITEM pItem, HB_BO
/* performance TOFIX, cache class id (in context maybe)
to not scan all classes by name everytime */
hb_objSetClass( pItem, "AMF_OBJ", "AMF_OBJ" );
pValue = hb_itemPutNI( NULL, OBJAMF_VER );
pValue = hb_itemPutNI( NULL, OBJAMF_VER );
hb_arraySet( pItem, OBJAMF_VAR_VER, pValue );
hb_itemRelease( pValue );
pValue = hb_itemPutC( NULL, "ANONYMOUS" );
pValue = hb_itemPutC( NULL, "ANONYMOUS" );
hb_arraySet( pItem, OBJAMF_VAR_NAME, pValue );
hb_itemRelease( pValue );
pValue = hb_hashNew( NULL );
pValue = hb_hashNew( NULL );
hb_arraySet( pItem, OBJAMF_VAR_HASH, pValue );
hb_itemRelease( pValue );
}
@@ -1140,9 +1140,9 @@ static void amf3_conversion_in( amfContext * context, PHB_ITEM pItem )
static HB_BOOL amf3_getItem( amfContext * context, PHB_ITEM pItem )
{
char byte;
const char * byte_ref;
HB_BOOL lRet = HB_TRUE;
char byte;
const char * byte_ref;
HB_BOOL lRet = HB_TRUE;
byte_ref = readByte( context );
@@ -1235,29 +1235,30 @@ static HB_BOOL amf3_getItem( amfContext * context, PHB_ITEM pItem )
HB_FUNC( AMF3_DECODE )
{
PHB_ITEM pItem = hb_stackReturnItem();
PHB_ITEM pItem = hb_stackReturnItem();
#if defined( _DEBUG )
PHB_ITEM pDebugBlock = hb_param( 2, HB_IT_BLOCK );
#endif
PHB_ITEM pFuncSym = hb_param( 2, HB_IT_SYMBOL );
PHB_ITEM pFuncSym = hb_param( 2, HB_IT_SYMBOL );
amfContext * context;
amfContext * context;
const char * szBuffer = hb_parc( 1 );
const char * szBuffer = hb_parc( 1 );
if( ! szBuffer )
return;
context = ( amfContext * ) hb_xgrab( sizeof( amfContext ) );
context = ( amfContext * ) hb_xgrab( sizeof( amfContext ) );
memset( context, 0, sizeof( amfContext ) );
context->cBuf = szBuffer;
context->position = 0;
context->length = hb_parclen( 1 );
context->obj_ref = hb_hashNew( NULL );
context->str_ref = hb_hashNew( NULL );
context->class_ref = hb_hashNew( NULL );
context->conv_function = pFuncSym;
context->cBuf = szBuffer;
context->position = 0;
context->length = hb_parclen( 1 );
context->obj_ref = hb_hashNew( NULL );
context->str_ref = hb_hashNew( NULL );
context->class_ref = hb_hashNew( NULL );
context->conv_function = pFuncSym;
amf3_getItem( context, pItem );

View File

@@ -33,19 +33,19 @@
typedef struct
{
char * cBuf;
HB_ISIZ position;
HB_ISIZ length;
HB_BOOL use_refs;
HB_BOOL use_strstr;
HB_BOOL str_rtrim;
HB_SIZE strstr_count; /* used only when str_ref is disabled */
char * cBuf;
HB_ISIZ position;
HB_ISIZ length;
HB_BOOL use_refs;
HB_BOOL use_strstr;
HB_BOOL str_rtrim;
HB_SIZE strstr_count; /* used only when str_ref is disabled */
PHB_ITEM obj_ref;
PHB_ITEM str_ref;
PHB_ITEM strstr_ref;
PHB_ITEM class_ref;
PHB_ITEM conv_function;
HB_BOOL encode_ba;
HB_BOOL encode_ba;
} amfContext;
static HB_BOOL amf3_encode( amfContext * context, PHB_ITEM pItem );
@@ -113,11 +113,11 @@ static HB_ISIZ writeBuffer( amfContext * context, const char * str, HB_ISIZ len
static HB_BOOL amfX_encode_double( amfContext * context, double value )
{
char c_value[ 8 ];
char * c_value_ref = &c_value[ 0 ];
char c_value[ 8 ];
char * c_value_ref = &c_value[ 0 ];
#ifndef HB_BIG_ENDIAN
char flipped[ 8 ];
char flipped[ 8 ];
#endif
memcpy( c_value_ref, &value, 8 );
@@ -126,14 +126,14 @@ static HB_BOOL amfX_encode_double( amfContext * context, double value )
if( writeBuffer( context, c_value_ref, 8 ) == 0 )
return HB_FALSE;
#else
flipped[ 0 ] = c_value[ 7 ];
flipped[ 1 ] = c_value[ 6 ];
flipped[ 2 ] = c_value[ 5 ];
flipped[ 3 ] = c_value[ 4 ];
flipped[ 4 ] = c_value[ 3 ];
flipped[ 5 ] = c_value[ 2 ];
flipped[ 6 ] = c_value[ 1 ];
flipped[ 7 ] = c_value[ 0 ];
flipped[ 0 ] = c_value[ 7 ];
flipped[ 1 ] = c_value[ 6 ];
flipped[ 2 ] = c_value[ 5 ];
flipped[ 3 ] = c_value[ 4 ];
flipped[ 4 ] = c_value[ 3 ];
flipped[ 5 ] = c_value[ 2 ];
flipped[ 6 ] = c_value[ 1 ];
flipped[ 7 ] = c_value[ 0 ];
if( writeBuffer( context, flipped, 8 ) == 0 )
return HB_FALSE;
#endif
@@ -152,8 +152,8 @@ static HB_BOOL amfX_write_double( amfContext * context, PHB_ITEM pItem )
static HB_BOOL amf3_encode_int( amfContext * context, int value )
{
char tmp[ 4 ];
HB_SIZE tmp_size;
char tmp[ 4 ];
HB_SIZE tmp_size;
/*
* Int can be up to 4 bytes long.
@@ -208,9 +208,9 @@ static HB_BOOL amf3_encode_int( amfContext * context, int value )
static HB_BOOL amf3_write_int( amfContext * context, PHB_ITEM pItem )
{
#ifndef HB_LONG_LONG_OFF
HB_LONGLONG n = hb_itemGetNLL( pItem );
HB_LONGLONG n = hb_itemGetNLL( pItem );
#else
long n = hb_itemGetNL( pItem );
long n = hb_itemGetNL( pItem );
#endif
if( n > MIN_INT && n < MAX_INT )
@@ -228,11 +228,11 @@ static HB_BOOL amf3_write_int( amfContext * context, PHB_ITEM pItem )
}
/*
static HB_BOOL amf3_encode_float(amfContext * context, PHB_ITEM pItem)
{
static HB_BOOL amf3_encode_float(amfContext * context, PHB_ITEM pItem)
{
float n = (float)hb_itemGetND(pItem);
return amfX_encode_double(context, (double)n);
}
}
*/
static HB_BOOL amf3_encode_nil( amfContext * context )
@@ -250,10 +250,10 @@ static HB_BOOL amf3_encode_bool( amfContext * context, PHB_ITEM pItem )
static HB_BOOL amf3_encode_string( amfContext * context, PHB_ITEM pItem )
{
void * hStr = NULL; /* = hb_itemGetCPtr(pItem); not needed with UTF8 conversion */
HB_SIZE len;
const char * utf8str = hb_itemGetStrUTF8( pItem, &hStr, &len );
HB_BOOL result;
void * hStr = NULL; /* = hb_itemGetCPtr(pItem); not needed with UTF8 conversion */
HB_SIZE len;
const char * utf8str = hb_itemGetStrUTF8( pItem, &hStr, &len );
HB_BOOL result;
if( ! hStr )
return HB_FALSE;
@@ -394,8 +394,8 @@ static int amf3_encode_reference( amfContext * context, PHB_ITEM pHash, PHB_ITEM
static HB_BOOL amf3_serialize_string( amfContext * context, PHB_ITEM pItem )
{
int result;
HB_SIZE len = hb_itemGetCLen( pItem );
int result;
HB_SIZE len = hb_itemGetCLen( pItem );
if( len == 0 )
return writeByte( context, EMPTY_STRING_TYPE );
@@ -410,8 +410,8 @@ static HB_BOOL amf3_serialize_string( amfContext * context, PHB_ITEM pItem )
}
/*
static HB_BOOL amf3_serialize_object_as_string(amfContext * context, PHB_ITEM pItem)
{
static HB_BOOL amf3_serialize_object_as_string(amfContext * context, PHB_ITEM pItem)
{
PHB_ITEM pStr;
HB_BOOL result;
@@ -425,7 +425,7 @@ static HB_BOOL amf3_serialize_object_as_string(amfContext * context, PHB_ITEM pI
hb_itemRelease(pStr);
return result;
}
}
*/
@@ -454,8 +454,8 @@ static HB_BOOL amf3_encode_hash( amfContext * context, PHB_ITEM pItem )
for( i = 1; i <= len; i++ )
{
pKey = hb_hashGetKeyAt( pItem, i );
pVal = hb_hashGetValueAt( pItem, i );
pKey = hb_hashGetKeyAt( pItem, i );
pVal = hb_hashGetValueAt( pItem, i );
if( HB_IS_STRING( pKey ) )
{
if( ! amf3_encode_string( context, pKey ) )
@@ -472,8 +472,8 @@ static HB_BOOL amf3_encode_hash( amfContext * context, PHB_ITEM pItem )
{
for( i = 1; i <= len; i++ )
{
pKey = hb_hashGetKeyAt( pItem, i );
pVal = hb_hashGetValueAt( pItem, i );
pKey = hb_hashGetKeyAt( pItem, i );
pVal = hb_hashGetValueAt( pItem, i );
if( HB_IS_INTEGER( pKey ) )
{
if( ! amf3_encode( context, pVal ) )
@@ -494,8 +494,8 @@ static HB_BOOL amf3_encode_dynamic_dict( amfContext * context, PHB_ITEM pItem )
for( i = 1; i <= len; i++ )
{
pKey = hb_hashGetKeyAt( pItem, i );
pVal = hb_hashGetValueAt( pItem, i );
pKey = hb_hashGetKeyAt( pItem, i );
pVal = hb_hashGetValueAt( pItem, i );
if( HB_IS_STRING( pKey ) )
{
if( ! amf3_serialize_string( context, pKey ) )
@@ -533,8 +533,8 @@ static HB_BOOL amf3_write_hash( amfContext * context, PHB_ITEM pItem )
static HB_ISIZ amf3_encode_byte_array( amfContext * context, PHB_ITEM pItem )
{
HB_ISIZ item_len;
const char * bytes;
HB_ISIZ item_len;
const char * bytes;
if( HB_IS_STRING( pItem ) || HB_IS_MEMO( pItem ) )
{
@@ -736,10 +736,10 @@ static int amf3_serialize_class_def( amfContext * context, PHB_ITEM pClass )
/* Get an object's class def. */
static PHB_ITEM class_def_from_class( /* amfContext * context, */ PHB_ITEM pItem )
{
HB_USHORT uiClass;
PHB_ITEM pClass;
PHB_ITEM pKey;
PHB_ITEM pValue;
HB_USHORT uiClass;
PHB_ITEM pClass;
PHB_ITEM pKey;
PHB_ITEM pValue;
/* get Harbour's class id/handle */
uiClass = hb_objGetClass( pItem );
@@ -752,10 +752,10 @@ static PHB_ITEM class_def_from_class( /* amfContext * context, */ PHB_ITEM pItem
"tags" which are put into the Harbour class definitions
right now */
pClass = hb_hashNew( NULL );
pClass = hb_hashNew( NULL );
pKey = hb_itemPutC( NULL, "CLASS_DEF" );
pValue = hb_itemNew( NULL );
pKey = hb_itemPutC( NULL, "CLASS_DEF" );
pValue = hb_itemNew( NULL );
if( ! hb_hashAdd( pClass, pKey, pValue ) )
{
hb_itemRelease( pKey );
@@ -766,8 +766,8 @@ static PHB_ITEM class_def_from_class( /* amfContext * context, */ PHB_ITEM pItem
hb_itemRelease( pKey );
hb_itemRelease( pValue );
pKey = hb_itemPutC( NULL, "alias" );
pValue = hb_itemPutC( NULL, hb_clsName( uiClass ) );
pKey = hb_itemPutC( NULL, "alias" );
pValue = hb_itemPutC( NULL, hb_clsName( uiClass ) );
if( ! hb_hashAdd( pClass, pKey, pValue ) )
{
hb_itemRelease( pKey );
@@ -780,8 +780,8 @@ static PHB_ITEM class_def_from_class( /* amfContext * context, */ PHB_ITEM pItem
if( hbamf_is_cls_externalizable( uiClass ) )
{
pKey = hb_itemPutC( NULL, "EXTERNALIZABLE_CLASS_DEF" );
pValue = hb_itemNew( NULL );
pKey = hb_itemPutC( NULL, "EXTERNALIZABLE_CLASS_DEF" );
pValue = hb_itemNew( NULL );
if( ! hb_hashAdd( pClass, pKey, pValue ) )
{
hb_itemRelease( pKey );
@@ -968,9 +968,9 @@ static HB_BOOL amf3_serialize_object( amfContext * context, PHB_ITEM pItem )
static void amf3_conversion_out( amfContext * context, PHB_ITEM pItem )
{
PHB_ITEM pRetCopy = hb_itemNew( NULL );
PHB_ITEM pOuterContext = hb_itemPutPtr( NULL, context );
PHB_SYMB pSym = hb_itemGetSymbol( context->conv_function );
PHB_ITEM pRetCopy = hb_itemNew( NULL );
PHB_ITEM pOuterContext = hb_itemPutPtr( NULL, context );
PHB_SYMB pSym = hb_itemGetSymbol( context->conv_function );
if( pItem == hb_stackReturnItem() )
{
@@ -1067,28 +1067,28 @@ static amfContext * context_setup( PHB_ITEM pFuncSym, HB_BOOL use_refs, HB_BOOL
{
amfContext * context;
context = ( amfContext * ) hb_xgrab( sizeof( amfContext ) );
context = ( amfContext * ) hb_xgrab( sizeof( amfContext ) );
memset( context, 0, sizeof( amfContext ) );
context->cBuf = ( char * ) hb_xgrab( sizeof( char ) * 8 );
context->cBuf = ( char * ) hb_xgrab( sizeof( char ) * 8 );
/* memset( context->cBuf, 0, sizeof( char ) * 8 ); */
context->position = 0;
context->length = sizeof( char ) * 8;
context->str_rtrim = str_rtrim;
context->use_refs = use_refs;
context->position = 0;
context->length = sizeof( char ) * 8;
context->str_rtrim = str_rtrim;
context->use_refs = use_refs;
if( use_refs )
{
if( outer_context && outer_context->use_refs )
{
context->obj_ref = outer_context->obj_ref;
context->str_ref = outer_context->str_ref;
context->class_ref = outer_context->class_ref;
context->obj_ref = outer_context->obj_ref;
context->str_ref = outer_context->str_ref;
context->class_ref = outer_context->class_ref;
}
else
{
context->obj_ref = hb_hashNew( NULL );
context->str_ref = hb_hashNew( NULL );
context->class_ref = hb_hashNew( NULL );
context->obj_ref = hb_hashNew( NULL );
context->str_ref = hb_hashNew( NULL );
context->class_ref = hb_hashNew( NULL );
hb_hashSetFlags( context->obj_ref, HB_HASH_KEEPORDER );
hb_hashSetFlags( context->str_ref, HB_HASH_KEEPORDER );
hb_hashSetFlags( context->class_ref, HB_HASH_KEEPORDER );
@@ -1096,17 +1096,17 @@ static amfContext * context_setup( PHB_ITEM pFuncSym, HB_BOOL use_refs, HB_BOOL
}
else
{
context->obj_ref = NULL;
context->str_ref = NULL;
context->class_ref = NULL;
context->obj_ref = NULL;
context->str_ref = NULL;
context->class_ref = NULL;
}
context->conv_function = pFuncSym;
context->conv_function = pFuncSym;
/* "strstr" is another optional idea of catching similar strings,
key in this hash is not the pointer to C char, but the string
itself and the value is id of the reference */
context->use_strstr = HB_TRUE;
context->use_strstr = HB_TRUE;
if( outer_context )
{
@@ -1121,8 +1121,8 @@ static amfContext * context_setup( PHB_ITEM pFuncSym, HB_BOOL use_refs, HB_BOOL
}
else
{
context->strstr_count = 0;
context->strstr_ref = hb_hashNew( NULL );
context->strstr_count = 0;
context->strstr_ref = hb_hashNew( NULL );
}
return context;
@@ -1156,44 +1156,44 @@ static void context_release( amfContext * context, amfContext * outer_context )
HB_FUNC( AMF3_FROMWA )
{
PHB_ITEM pWhile = hb_param( 1, HB_IT_BLOCK );
PHB_ITEM pFor = hb_param( 2, HB_IT_BLOCK );
PHB_ITEM pFields = hb_param( 3, HB_IT_ARRAY );
HB_ULONG nCount = hb_parnldef( 4, 0 );
HB_BOOL str_rtrim = hb_parldef( 5, HB_TRUE );
HB_USHORT nPkg = ( HB_USHORT ) hb_parnidef( 6, 0 );
amfContext * outer_context = ( amfContext * ) hb_parptr( 7 );
PHB_ITEM pWhile = hb_param( 1, HB_IT_BLOCK );
PHB_ITEM pFor = hb_param( 2, HB_IT_BLOCK );
PHB_ITEM pFields = hb_param( 3, HB_IT_ARRAY );
HB_ULONG nCount = hb_parnldef( 4, 0 );
HB_BOOL str_rtrim = hb_parldef( 5, HB_TRUE );
HB_USHORT nPkg = ( HB_USHORT ) hb_parnidef( 6, 0 );
amfContext * outer_context = ( amfContext * ) hb_parptr( 7 );
DBORDERINFO pInfo;
int iOrd;
HB_USHORT uiFields;
HB_ULONG uiRecCount = 0;
HB_ULONG uiRecNo = 0;
HB_BOOL bNoFieldPassed = ( pFields == NULL || hb_arrayLen( pFields ) == 0 );
HB_BOOL bEof = HB_FALSE;
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
PHB_ITEM pItem;
HB_USHORT uiFieldCopy = 0; /* GCC knows better (warns) */
HB_USHORT uiIter;
amfContext * context;
HB_BOOL bPredictLen = ( ! pWhile && ! pFor );
DBORDERINFO pInfo;
int iOrd;
HB_USHORT uiFields;
HB_ULONG uiRecCount = 0;
HB_ULONG uiRecNo = 0;
HB_BOOL bNoFieldPassed = ( pFields == NULL || hb_arrayLen( pFields ) == 0 );
HB_BOOL bEof = HB_FALSE;
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
PHB_ITEM pItem;
HB_USHORT uiFieldCopy = 0; /* GCC knows better (warns) */
HB_USHORT uiIter;
amfContext * context;
HB_BOOL bPredictLen = ( ! pWhile && ! pFor );
HB_BOOL bAsArray = ! nPkg;
PHB_ITEM pFieldNames = NULL; /* again GCC knows better */
PHB_ITEM pField;
HB_BOOL bAsArray = ! nPkg;
PHB_ITEM pFieldNames = NULL; /* again GCC knows better */
PHB_ITEM pField;
if( pArea )
{
memset( &pInfo, 0, sizeof( pInfo ) );
pInfo.itmResult = hb_itemPutNI( NULL, 0 );
pInfo.itmResult = hb_itemPutNI( NULL, 0 );
SELF_ORDINFO( pArea, DBOI_NUMBER, &pInfo );
iOrd = hb_itemGetNI( pInfo.itmResult );
iOrd = hb_itemGetNI( pInfo.itmResult );
if( iOrd > 0 )
{
SELF_ORDINFO( pArea, DBOI_KEYCOUNT, &pInfo );
uiRecCount = hb_itemGetNL( pInfo.itmResult );
uiRecCount = hb_itemGetNL( pInfo.itmResult );
SELF_ORDINFO( pArea, DBOI_POSITION, &pInfo );
uiRecNo = hb_itemGetNL( pInfo.itmResult );
uiRecNo = hb_itemGetNL( pInfo.itmResult );
hb_itemRelease( pInfo.itmResult );
}
@@ -1208,9 +1208,9 @@ HB_FUNC( AMF3_FROMWA )
return;
}
pItem = hb_itemNew( NULL );
pItem = hb_itemNew( NULL );
context = context_setup( NULL, HB_FALSE, str_rtrim, outer_context );
context = context_setup( NULL, HB_FALSE, str_rtrim, outer_context );
if( bPredictLen )
{
@@ -1240,8 +1240,8 @@ HB_FUNC( AMF3_FROMWA )
if( iOrd > 0 )
{
memset( &pInfo, 0, sizeof( pInfo ) );
pInfo.itmNewVal = hb_itemPutNL( NULL, uiRecNo );
pInfo.itmResult = hb_itemPutL( NULL, HB_FALSE );
pInfo.itmNewVal = hb_itemPutNL( NULL, uiRecNo );
pInfo.itmResult = hb_itemPutL( NULL, HB_FALSE );
SELF_ORDINFO( pArea, DBOI_POSITION, &pInfo );
hb_itemRelease( pInfo.itmNewVal );
hb_itemRelease( pInfo.itmResult );
@@ -1419,30 +1419,30 @@ HB_FUNC( AMF3_FROMWA )
HB_FUNC( AMF3_ENCODE )
{
PHB_ITEM pItem = hb_param( 1, HB_IT_ANY );
PHB_ITEM pFuncSym = hb_param( 2, HB_IT_SYMBOL );
HB_BOOL lBA = hb_parldef( 3, HB_FALSE );
HB_BOOL lRetval;
PHB_ITEM pItem = hb_param( 1, HB_IT_ANY );
PHB_ITEM pFuncSym = hb_param( 2, HB_IT_SYMBOL );
HB_BOOL lBA = hb_parldef( 3, HB_FALSE );
HB_BOOL lRetval;
amfContext * context;
amfContext * context;
if( ! pItem )
return;
context = ( amfContext * ) hb_xgrab( sizeof( amfContext ) );
context = ( amfContext * ) hb_xgrab( sizeof( amfContext ) );
memset( context, 0, sizeof( amfContext ) );
context->cBuf = ( char * ) hb_xgrab( sizeof( char ) * 8 );
context->cBuf = ( char * ) hb_xgrab( sizeof( char ) * 8 );
/* memset( context->cBuf, 0, sizeof( char ) * 8 ); */
context->position = 0;
context->length = sizeof( char ) * 8;
context->str_rtrim = HB_FALSE;
context->obj_ref = hb_hashNew( NULL );
context->str_ref = hb_hashNew( NULL );
context->class_ref = hb_hashNew( NULL );
context->use_refs = HB_TRUE;
context->conv_function = pFuncSym;
context->encode_ba = lBA;
context->position = 0;
context->length = sizeof( char ) * 8;
context->str_rtrim = HB_FALSE;
context->obj_ref = hb_hashNew( NULL );
context->str_ref = hb_hashNew( NULL );
context->class_ref = hb_hashNew( NULL );
context->use_refs = HB_TRUE;
context->conv_function = pFuncSym;
context->encode_ba = lBA;
hb_hashSetFlags( context->obj_ref, HB_HASH_KEEPORDER );
hb_hashSetFlags( context->str_ref, HB_HASH_KEEPORDER );
hb_hashSetFlags( context->class_ref, HB_HASH_KEEPORDER );
@@ -1450,11 +1450,11 @@ HB_FUNC( AMF3_ENCODE )
/* "strstr" is another optional idea of catching similar strings,
key in this hash is not the pointer to C char, but the string
itself and the value is id of the reference */
context->use_strstr = HB_TRUE;
context->strstr_count = 0;
context->strstr_ref = hb_hashNew( NULL );
context->use_strstr = HB_TRUE;
context->strstr_count = 0;
context->strstr_ref = hb_hashNew( NULL );
lRetval = amf3_encode( context, pItem );
lRetval = amf3_encode( context, pItem );
if( context->use_refs )
{

View File

@@ -17,8 +17,8 @@
#include "hbapigt.h"
#include "hbapifs.h"
#define SINGLEBUF 32768
#define MAXLEN ( 16 * 1024 * 1024 )
#define SINGLEBUF 32768
#define MAXLEN ( 16 * 1024 * 1024 )
static int s_nCount = 0;
@@ -37,30 +37,30 @@ static void countCheck( int n )
HB_FUNC( AMFSTDIO_READ )
{
char * pszStrIn = ( char * ) hb_xgrab( SINGLEBUF );
char * pszLenPrefix = ( char * ) hb_xgrab( 5 );
char * pszStrIn = ( char * ) hb_xgrab( SINGLEBUF );
char * pszLenPrefix = ( char * ) hb_xgrab( 5 );
char * pszBuf; /* = ( char * ) hb_xgrab( SINGLEBUF ); */
char * pszTmp = pszLenPrefix;
char * pszTmp = pszLenPrefix;
HB_USHORT nBytes;
int nTotal = 0;
int nTotal = 0;
int nLen;
int nToRead;
HB_FHANDLE hStdIn = hb_fsGetOsHandle( HB_STDIN_HANDLE );
HB_FHANDLE hStdIn = hb_fsGetOsHandle( HB_STDIN_HANDLE );
while( nTotal < 4 )
{
nToRead = ( s_nCount + 4 - nTotal > SINGLEBUF ? SINGLEBUF - s_nCount : 4 - nTotal );
nBytes = hb_fsRead( hStdIn, pszStrIn, ( HB_USHORT ) nToRead );
nToRead = ( s_nCount + 4 - nTotal > SINGLEBUF ? SINGLEBUF - s_nCount : 4 - nTotal );
nBytes = hb_fsRead( hStdIn, pszStrIn, ( HB_USHORT ) nToRead );
countCheck( nBytes );
memcpy( pszTmp, pszStrIn, nBytes );
nTotal += nBytes;
pszTmp = pszLenPrefix + nTotal;
nTotal += nBytes;
pszTmp = pszLenPrefix + nTotal;
}
pszLenPrefix[ 4 ] = '\0';
nLen = HB_GET_LE_UINT32( pszLenPrefix );
nLen = HB_GET_LE_UINT32( pszLenPrefix );
if( nLen >= MAXLEN )
{
@@ -68,9 +68,9 @@ HB_FUNC( AMFSTDIO_READ )
return;
}
nTotal = 0;
pszBuf = ( char * ) hb_xgrab( nLen + 1 );
pszTmp = pszBuf;
nTotal = 0;
pszBuf = ( char * ) hb_xgrab( nLen + 1 );
pszTmp = pszBuf;
while( nTotal < nLen )
{
@@ -89,8 +89,8 @@ HB_FUNC( AMFSTDIO_READ )
countCheck( nBytes );
memcpy( pszTmp, pszStrIn, nBytes );
nTotal += nBytes;
pszTmp = pszBuf + nTotal;
nTotal += nBytes;
pszTmp = pszBuf + nTotal;
}
hb_xfree( pszStrIn );

View File

@@ -18,8 +18,8 @@
HB_BOOL hbamf_is_cls_externalizable( HB_USHORT uiClass )
{
PHB_DYNS pSymbol = hb_dynsymGet( "__CLSMSGTYPE" );
HB_BOOL result = HB_FALSE;
PHB_DYNS pSymbol = hb_dynsymGet( "__CLSMSGTYPE" );
HB_BOOL result = HB_FALSE;
/* as far as i know, there is no exported Harbour C level api for this */

View File

@@ -80,6 +80,7 @@ static void hb_bz2Free( void * cargo, void * ptr )
static HB_SIZE hb_bz2CompressBound( HB_SIZE nLen )
{
HB_SIZE nSize = nLen + nLen / 100 + 600;
return nSize < nLen ? HB_SIZE_MAX - 1 : nSize;
}
@@ -87,25 +88,27 @@ static int hb_bz2Compress( const char * szSrc, HB_SIZE nSrc,
char * szDst, HB_SIZE * pnDst, int iBlockSize )
{
bz_stream stream;
int iResult;
int iResult;
memset( &stream, 0, sizeof( stream ) );
stream.next_in = ( char * ) szSrc;
stream.avail_in = ( unsigned int ) nSrc;
stream.next_in = ( char * ) szSrc;
stream.avail_in = ( unsigned int ) nSrc;
stream.next_out = szDst;
stream.avail_out = ( unsigned int ) *pnDst;
stream.bzalloc = hb_bz2Alloc;
stream.bzfree = hb_bz2Free;
/* stream.opaque = NULL; */
stream.bzalloc = hb_bz2Alloc;
stream.bzfree = hb_bz2Free;
/* stream.opaque = NULL; */
iResult = BZ2_bzCompressInit( &stream, iBlockSize, 0, 0 );
if( iResult == BZ_OK )
{
do
{
iResult = BZ2_bzCompress( &stream, BZ_FINISH );
}
while( iResult == BZ_FINISH_OK );
if( iResult == BZ_STREAM_END )
@@ -114,7 +117,7 @@ static int hb_bz2Compress( const char * szSrc, HB_SIZE nSrc,
*pnDst = ( HB_SIZE ) stream.total_out_lo32;
#else
*pnDst = ( ( HB_SIZE ) stream.total_out_hi32 << 32 ) |
stream.total_out_lo32;
stream.total_out_lo32;
#endif
iResult = BZ_OK;
}
@@ -128,18 +131,18 @@ static int hb_bz2Compress( const char * szSrc, HB_SIZE nSrc,
static HB_SIZE hb_bz2UncompressedSize( const char * szSrc, HB_SIZE nLen,
int * piResult )
{
char buffer[ 1024 ];
char buffer[ 1024 ];
bz_stream stream;
HB_SIZE nDest = 0;
HB_SIZE nDest = 0;
memset( &stream, 0, sizeof( stream ) );
stream.next_in = ( char * ) szSrc;
stream.avail_in = ( unsigned int ) nLen;
stream.next_in = ( char * ) szSrc;
stream.avail_in = ( unsigned int ) nLen;
stream.bzalloc = hb_bz2Alloc;
stream.bzfree = hb_bz2Free;
/* stream.opaque = NULL; */
stream.bzalloc = hb_bz2Alloc;
stream.bzfree = hb_bz2Free;
/* stream.opaque = NULL; */
*piResult = BZ2_bzDecompressInit( &stream, 0, 0 );
if( *piResult == BZ_OK )
@@ -148,7 +151,7 @@ static HB_SIZE hb_bz2UncompressedSize( const char * szSrc, HB_SIZE nLen,
{
stream.next_out = buffer;
stream.avail_out = sizeof( buffer );
*piResult = BZ2_bzDecompress( &stream );
*piResult = BZ2_bzDecompress( &stream );
}
while( *piResult == BZ_OK );
@@ -162,7 +165,7 @@ static HB_SIZE hb_bz2UncompressedSize( const char * szSrc, HB_SIZE nLen,
nDest = ( HB_SIZE ) stream.total_out_lo32;
#else
nDest = ( ( HB_SIZE ) stream.total_out_hi32 << 32 ) |
stream.total_out_lo32;
stream.total_out_lo32;
#endif
}
BZ2_bzDecompressEnd( &stream );
@@ -175,25 +178,27 @@ static int hb_bz2Uncompress( const char * szSrc, HB_SIZE nSrc,
char * szDst, HB_SIZE * pnDst )
{
bz_stream stream;
int iResult;
int iResult;
memset( &stream, 0, sizeof( stream ) );
stream.next_in = ( char * ) szSrc;
stream.avail_in = ( unsigned int ) nSrc;
stream.next_in = ( char * ) szSrc;
stream.avail_in = ( unsigned int ) nSrc;
stream.next_out = szDst;
stream.avail_out = ( unsigned int ) *pnDst;
stream.bzalloc = hb_bz2Alloc;
stream.bzfree = hb_bz2Free;
/* stream.opaque = NULL; */
stream.bzalloc = hb_bz2Alloc;
stream.bzfree = hb_bz2Free;
/* stream.opaque = NULL; */
iResult = BZ2_bzDecompressInit( &stream, 0, 0 );
if( iResult == BZ_OK )
{
do
{
iResult = BZ2_bzDecompress( &stream );
}
while( iResult == BZ_OK );
if( iResult == BZ_STREAM_END )
@@ -202,7 +207,7 @@ static int hb_bz2Uncompress( const char * szSrc, HB_SIZE nSrc,
*pnDst = ( HB_SIZE ) stream.total_out_lo32;
#else
*pnDst = ( ( HB_SIZE ) stream.total_out_hi32 << 32 ) |
stream.total_out_lo32;
stream.total_out_lo32;
#endif
iResult = BZ_OK;
}
@@ -243,8 +248,8 @@ HB_FUNC( HB_BZ2_UNCOMPRESSLEN )
if( szData )
{
HB_SIZE nLen = hb_parclen( 1 );
int iResult = BZ_OK;
HB_SIZE nLen = hb_parclen( 1 );
int iResult = BZ_OK;
if( nLen )
nLen = hb_bz2UncompressedSize( szData, nLen, &iResult );
@@ -267,6 +272,7 @@ HB_FUNC( HB_BZ2_UNCOMPRESSLEN )
HB_FUNC( HB_BZ2_COMPRESS )
{
const char * szData = hb_parc( 1 );
if( szData )
{
HB_SIZE nLen = hb_parclen( 1 );
@@ -274,19 +280,19 @@ HB_FUNC( HB_BZ2_COMPRESS )
if( nLen )
{
PHB_ITEM pBuffer = HB_ISBYREF( 2 ) ? hb_param( 2, HB_IT_STRING ) : NULL;
HB_SIZE nDstLen;
char * pDest;
int iResult;
HB_SIZE nDstLen;
char * pDest;
int iResult;
if( pBuffer )
{
if( !hb_itemGetWriteCL( pBuffer, &pDest, &nDstLen ) )
if( ! hb_itemGetWriteCL( pBuffer, &pDest, &nDstLen ) )
pDest = NULL;
}
else
{
nDstLen = HB_ISNUM( 2 ) ? ( HB_SIZE ) hb_parnint( 2 ) :
( HB_SIZE ) hb_bz2CompressBound( nLen );
( HB_SIZE ) hb_bz2CompressBound( nLen );
pDest = ( char * ) hb_xalloc( nDstLen + 1 );
}
@@ -294,7 +300,7 @@ HB_FUNC( HB_BZ2_COMPRESS )
{
iResult = hb_bz2Compress( szData, nLen, pDest, &nDstLen,
hb_parnidef( 4, HB_BZ_COMPRESSION_DEFAULT ) );
if( !pBuffer )
if( ! pBuffer )
{
if( iResult == BZ_OK )
hb_retclen_buffer( pDest, nDstLen );
@@ -325,8 +331,8 @@ HB_FUNC( HB_BZ2_COMPRESS )
*/
HB_FUNC( HB_BZ2_UNCOMPRESS )
{
PHB_ITEM pBuffer = HB_ISBYREF( 2 ) ? hb_param( 2, HB_IT_STRING ) : NULL;
const char * szData = hb_parc( 1 );
PHB_ITEM pBuffer = HB_ISBYREF( 2 ) ? hb_param( 2, HB_IT_STRING ) : NULL;
const char * szData = hb_parc( 1 );
if( szData )
{
@@ -335,22 +341,22 @@ HB_FUNC( HB_BZ2_UNCOMPRESS )
if( nLen )
{
HB_SIZE nDstLen;
char * pDest = NULL;
int iResult = BZ_OK;
char * pDest = NULL;
int iResult = BZ_OK;
if( pBuffer )
{
if( !hb_itemGetWriteCL( pBuffer, &pDest, &nDstLen ) )
if( ! hb_itemGetWriteCL( pBuffer, &pDest, &nDstLen ) )
iResult = BZ_MEM_ERROR;
}
else
{
nDstLen = HB_ISNUM( 2 ) ? ( HB_SIZE ) hb_parnint( 2 ) :
hb_bz2UncompressedSize( szData, nLen, &iResult );
hb_bz2UncompressedSize( szData, nLen, &iResult );
if( iResult == BZ_OK )
{
pDest = ( char * ) hb_xalloc( nDstLen + 1 );
if( !pDest )
if( ! pDest )
iResult = BZ_MEM_ERROR;
}
}
@@ -359,7 +365,7 @@ HB_FUNC( HB_BZ2_UNCOMPRESS )
{
iResult = hb_bz2Uncompress( szData, nLen, pDest, &nDstLen );
if( !pBuffer )
if( ! pBuffer )
{
if( iResult == BZ_OK )
hb_retclen_buffer( pDest, nDstLen );

View File

@@ -58,7 +58,8 @@
HB_FUNC( CAIRO_CLIP )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_clip( pCairo );
}
@@ -66,11 +67,12 @@ HB_FUNC( CAIRO_CLIP )
HB_FUNC( CAIRO_CLIP_EXTENTS )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem = hb_stackReturnItem();
double x1, y1, x2, y2;
PHB_ITEM pItem = hb_stackReturnItem();
double x1, y1, x2, y2;
cairo_clip_extents( pCairo, &x1, &y1, &x2, &y2 );
hb_arrayNew( pItem, 4 );
@@ -84,7 +86,8 @@ HB_FUNC( CAIRO_CLIP_EXTENTS )
HB_FUNC( CAIRO_CLIP_PRESERVE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_clip_preserve( pCairo );
}
@@ -92,7 +95,8 @@ HB_FUNC( CAIRO_CLIP_PRESERVE )
HB_FUNC( CAIRO_COPY_PAGE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_copy_page( pCairo );
}
@@ -100,7 +104,8 @@ HB_FUNC( CAIRO_COPY_PAGE )
HB_FUNC( CAIRO_CREATE )
{
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
if( pSurface )
hb_cairo_ret( cairo_create( pSurface ) );
}
@@ -108,7 +113,8 @@ HB_FUNC( CAIRO_CREATE )
HB_FUNC( CAIRO_FILL )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_fill( pCairo );
}
@@ -116,7 +122,8 @@ HB_FUNC( CAIRO_FILL )
HB_FUNC( CAIRO_FILL_PRESERVE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_fill_preserve( pCairo );
}
@@ -124,14 +131,15 @@ HB_FUNC( CAIRO_FILL_PRESERVE )
HB_FUNC( CAIRO_GET_DASH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem;
int i, iCount;
double * pDashes, dOffset;
PHB_ITEM pItem;
int i, iCount;
double * pDashes, dOffset;
iCount = cairo_get_dash_count( pCairo );
iCount = cairo_get_dash_count( pCairo );
pDashes = ( double * ) hb_xgrab( iCount * sizeof( double ) );
cairo_get_dash( pCairo, pDashes, &dOffset );
hb_stornd( dOffset, 3 );
@@ -149,7 +157,8 @@ HB_FUNC( CAIRO_GET_DASH )
HB_FUNC( CAIRO_GET_LINE_WIDTH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
hb_retnd( cairo_get_line_width( pCairo ) );
}
@@ -157,7 +166,8 @@ HB_FUNC( CAIRO_GET_LINE_WIDTH )
HB_FUNC( CAIRO_IN_FILL )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
hb_retl( cairo_in_fill( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ) );
}
@@ -165,7 +175,8 @@ HB_FUNC( CAIRO_IN_FILL )
HB_FUNC( CAIRO_IN_STROKE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
hb_retl( cairo_in_stroke( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ) );
}
@@ -173,7 +184,8 @@ HB_FUNC( CAIRO_IN_STROKE )
HB_FUNC( CAIRO_PAINT )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_paint( pCairo );
}
@@ -181,7 +193,8 @@ HB_FUNC( CAIRO_PAINT )
HB_FUNC( CAIRO_PAINT_WITH_ALPHA )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_paint_with_alpha( pCairo, hb_parnd( 2 ) );
}
@@ -189,7 +202,8 @@ HB_FUNC( CAIRO_PAINT_WITH_ALPHA )
HB_FUNC( CAIRO_RESET_CLIP )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_reset_clip( pCairo );
}
@@ -197,7 +211,8 @@ HB_FUNC( CAIRO_RESET_CLIP )
HB_FUNC( CAIRO_RESTORE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_restore( pCairo );
}
@@ -205,7 +220,8 @@ HB_FUNC( CAIRO_RESTORE )
HB_FUNC( CAIRO_SAVE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_save( pCairo );
}
@@ -213,15 +229,16 @@ HB_FUNC( CAIRO_SAVE )
HB_FUNC( CAIRO_SET_DASH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem;
PHB_ITEM pItem;
if( ( pItem = hb_param( 2, HB_IT_ARRAY ) ) != NULL )
{
int i, iCount = ( int ) hb_arrayLen( pItem );
double * pDashes = NULL;
int i, iCount = ( int ) hb_arrayLen( pItem );
double * pDashes = NULL;
if( iCount )
pDashes = ( double * ) hb_xgrab( iCount * sizeof( double ) );
@@ -241,7 +258,8 @@ HB_FUNC( CAIRO_SET_DASH )
HB_FUNC( CAIRO_SET_FILL_RULE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_fill_rule( pCairo, ( cairo_fill_rule_t ) hb_parni( 2 ) );
}
@@ -249,7 +267,8 @@ HB_FUNC( CAIRO_SET_FILL_RULE )
HB_FUNC( CAIRO_SET_LINE_CAP )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_line_cap( pCairo, ( cairo_line_cap_t ) hb_parni( 2 ) );
}
@@ -257,7 +276,8 @@ HB_FUNC( CAIRO_SET_LINE_CAP )
HB_FUNC( CAIRO_SET_LINE_JOIN )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_line_join( pCairo, ( cairo_line_join_t ) hb_parni( 2 ) );
}
@@ -265,7 +285,8 @@ HB_FUNC( CAIRO_SET_LINE_JOIN )
HB_FUNC( CAIRO_SET_LINE_WIDTH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_line_width( pCairo, hb_parnd( 2 ) );
}
@@ -273,7 +294,8 @@ HB_FUNC( CAIRO_SET_LINE_WIDTH )
HB_FUNC( CAIRO_SET_MITER_LIMIT )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_miter_limit( pCairo, hb_parnd( 2 ) );
}
@@ -281,7 +303,8 @@ HB_FUNC( CAIRO_SET_MITER_LIMIT )
HB_FUNC( CAIRO_SET_OPERATOR )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_operator( pCairo, ( cairo_operator_t ) hb_parni( 2 ) );
}
@@ -289,7 +312,8 @@ HB_FUNC( CAIRO_SET_OPERATOR )
HB_FUNC( CAIRO_SET_SOURCE_RGB )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_source_rgb( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ) );
}
@@ -297,7 +321,8 @@ HB_FUNC( CAIRO_SET_SOURCE_RGB )
HB_FUNC( CAIRO_SET_SOURCE_RGBA )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_source_rgba( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) );
}
@@ -305,14 +330,16 @@ HB_FUNC( CAIRO_SET_SOURCE_RGBA )
HB_FUNC( CAIRO_SET_TOLERANCE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_tolerance( pCairo, hb_parnd( 2 ) );
}
HB_FUNC( CAIRO_SHOW_PAGE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_show_page( pCairo );
}
@@ -320,7 +347,8 @@ HB_FUNC( CAIRO_SHOW_PAGE )
HB_FUNC( CAIRO_STROKE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_stroke( pCairo );
}
@@ -328,7 +356,8 @@ HB_FUNC( CAIRO_STROKE )
HB_FUNC( CAIRO_STATUS )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
hb_retni( cairo_status( pCairo ) );
}
@@ -336,11 +365,12 @@ HB_FUNC( CAIRO_STATUS )
HB_FUNC( CAIRO_STROKE_EXTENTS )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem = hb_stackReturnItem();
double x1, y1, x2, y2;
PHB_ITEM pItem = hb_stackReturnItem();
double x1, y1, x2, y2;
cairo_stroke_extents( pCairo, &x1, &y1, &x2, &y2 );
hb_arrayNew( pItem, 4 );
@@ -354,7 +384,8 @@ HB_FUNC( CAIRO_STROKE_EXTENTS )
HB_FUNC( CAIRO_STROKE_PRESERVE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_stroke_preserve( pCairo );
}

View File

@@ -77,6 +77,7 @@ static const HB_GC_FUNCS s_gcCairoFuncs =
cairo_t * hb_cairoItemGet( PHB_ITEM pItem )
{
cairo_t ** ppCairo = ( cairo_t ** ) hb_itemGetPtrGC( pItem, &s_gcCairoFuncs );
return ppCairo ? *ppCairo : NULL;
}
@@ -144,6 +145,7 @@ static const HB_GC_FUNCS s_gcSurfaceFuncs =
cairo_surface_t * hb_cairoSurfaceItemGet( PHB_ITEM pItem )
{
cairo_surface_t ** ppSurface = ( cairo_surface_t ** ) hb_itemGetPtrGC( pItem, &s_gcSurfaceFuncs );
return ppSurface ? *ppSurface : NULL;
}
@@ -211,6 +213,7 @@ static const HB_GC_FUNCS s_gcPathFuncs =
cairo_path_t * hb_cairoPathItemGet( PHB_ITEM pItem )
{
cairo_path_t ** ppPath = ( cairo_path_t ** ) hb_itemGetPtrGC( pItem, &s_gcPathFuncs );
return ppPath ? *ppPath : NULL;
}
@@ -266,13 +269,13 @@ HB_FUNC( CAIRO_PATH_DESTROY )
typedef struct
{
cairo_path_t ** ppPath;
int iPos;
int iPos;
} HB_CAIRO_PATH_ITERATOR, * PHB_CAIRO_PATH_ITERATOR;
static HB_GARBAGE_FUNC( hb_cairo_path_iterator_destructor )
{
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) Cargo;
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) Cargo;
if( pIterator->ppPath )
{
@@ -284,7 +287,7 @@ static HB_GARBAGE_FUNC( hb_cairo_path_iterator_destructor )
static HB_GARBAGE_FUNC( hb_cairo_path_iterator_mark )
{
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) Cargo;
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) Cargo;
if( pIterator->ppPath )
hb_gcMark( pIterator->ppPath );
@@ -304,7 +307,7 @@ HB_FUNC( CAIRO_PATH_ITERATOR_CREATE )
if( ppPath && *ppPath )
{
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_gcAllocate( sizeof( HB_CAIRO_PATH_ITERATOR ), &s_gcIteratorFuncs );
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_gcAllocate( sizeof( HB_CAIRO_PATH_ITERATOR ), &s_gcIteratorFuncs );
pIterator->ppPath = ppPath;
hb_gcRefInc( ppPath );
pIterator->iPos = -1;
@@ -317,7 +320,7 @@ HB_FUNC( CAIRO_PATH_ITERATOR_CREATE )
HB_FUNC( CAIRO_PATH_ITERATOR_DESTROY )
{
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 );
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 );
if( pIterator && pIterator->ppPath )
{
@@ -331,10 +334,10 @@ HB_FUNC( CAIRO_PATH_ITERATOR_DESTROY )
HB_FUNC( CAIRO_PATH_ITERATOR_NEXT )
{
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 );
cairo_path_t * pPath;
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 );
cairo_path_t * pPath;
if( pIterator && pIterator->ppPath && ( pPath = * ( pIterator->ppPath ) ) != NULL )
if( pIterator && pIterator->ppPath && ( pPath = *( pIterator->ppPath ) ) != NULL )
{
/* Skip */
if( pIterator->iPos == -1 )
@@ -355,19 +358,19 @@ HB_FUNC( CAIRO_PATH_ITERATOR_NEXT )
HB_FUNC( CAIRO_PATH_ITERATOR_GET_POINTS )
{
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 );
cairo_path_t * pPath;
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 );
cairo_path_t * pPath;
if( pIterator && pIterator->ppPath && ( pPath = * ( pIterator->ppPath ) ) != NULL )
if( pIterator && pIterator->ppPath && ( pPath = *( pIterator->ppPath ) ) != NULL )
{
cairo_path_data_t * pData;
if( pIterator->iPos < pPath->num_data && pIterator->iPos != -1 )
{
PHB_ITEM pItem, pArray;
int i;
PHB_ITEM pItem, pArray;
int i;
pData = pPath->data + pIterator->iPos;
pData = pPath->data + pIterator->iPos;
pArray = hb_itemArrayNew( pData->header.length - 1 );
for( i = 1; i < pData->header.length; i++ )
{
@@ -387,21 +390,21 @@ HB_FUNC( CAIRO_PATH_ITERATOR_GET_POINTS )
HB_FUNC( CAIRO_PATH_ITERATOR_SET_POINTS )
{
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 );
PHB_ITEM pArray = hb_param( 2, HB_IT_ARRAY );
cairo_path_t * pPath;
PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 );
PHB_ITEM pArray = hb_param( 2, HB_IT_ARRAY );
cairo_path_t * pPath;
if( pIterator && pIterator->ppPath && ( pPath = * ( pIterator->ppPath ) ) != NULL && pArray )
if( pIterator && pIterator->ppPath && ( pPath = *( pIterator->ppPath ) ) != NULL && pArray )
{
cairo_path_data_t * pData;
HB_SIZE nLen;
HB_SIZE nLen;
nLen = hb_arrayLen( pArray );
if( pIterator->iPos < pPath->num_data && pIterator->iPos != -1 &&
( HB_SIZE ) pPath->data[ pIterator->iPos ].header.length == nLen + 1 )
{
PHB_ITEM pItem;
int i;
PHB_ITEM pItem;
int i;
pData = pPath->data + pIterator->iPos;
for( i = 1; i < pData->header.length; i++ )

View File

@@ -57,8 +57,9 @@
HB_FUNC( CAIRO_APPEND_PATH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_path_t * pPath = hb_cairo_path_param( 2 );
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_path_t * pPath = hb_cairo_path_param( 2 );
if( pCairo && pPath )
cairo_append_path( pCairo, pPath );
}
@@ -66,7 +67,8 @@ HB_FUNC( CAIRO_APPEND_PATH )
HB_FUNC( CAIRO_ARC )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_arc( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) );
}
@@ -74,7 +76,8 @@ HB_FUNC( CAIRO_ARC )
HB_FUNC( CAIRO_ARC_NEGATIVE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_arc_negative( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) );
}
@@ -82,7 +85,8 @@ HB_FUNC( CAIRO_ARC_NEGATIVE )
HB_FUNC( CAIRO_CLOSE_PATH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_close_path( pCairo );
}
@@ -90,7 +94,8 @@ HB_FUNC( CAIRO_CLOSE_PATH )
HB_FUNC( CAIRO_COPY_PATH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
hb_cairo_path_ret( cairo_copy_path( pCairo ) );
}
@@ -98,7 +103,8 @@ HB_FUNC( CAIRO_COPY_PATH )
HB_FUNC( CAIRO_COPY_PATH_FLAT )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
hb_cairo_path_ret( cairo_copy_path_flat( pCairo ) );
}
@@ -106,7 +112,8 @@ HB_FUNC( CAIRO_COPY_PATH_FLAT )
HB_FUNC( CAIRO_CURVE_TO )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_curve_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ), hb_parnd( 7 ) );
}
@@ -114,11 +121,12 @@ HB_FUNC( CAIRO_CURVE_TO )
HB_FUNC( CAIRO_GET_CURRENT_POINT )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem = hb_stackReturnItem();
double x, y;
PHB_ITEM pItem = hb_stackReturnItem();
double x, y;
hb_arrayNew( pItem, 2 );
cairo_get_current_point( pCairo, &x, &y );
hb_arraySetND( pItem, 1, x );
@@ -129,7 +137,8 @@ HB_FUNC( CAIRO_GET_CURRENT_POINT )
HB_FUNC( CAIRO_HAS_CURRENT_POINT )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
hb_retl( cairo_has_current_point( pCairo ) );
@@ -139,7 +148,8 @@ HB_FUNC( CAIRO_HAS_CURRENT_POINT )
HB_FUNC( CAIRO_LINE_TO )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_line_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) );
}
@@ -147,7 +157,8 @@ HB_FUNC( CAIRO_LINE_TO )
HB_FUNC( CAIRO_MOVE_TO )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_move_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) );
}
@@ -155,7 +166,8 @@ HB_FUNC( CAIRO_MOVE_TO )
HB_FUNC( CAIRO_NEW_PATH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_new_path( pCairo );
}
@@ -163,11 +175,12 @@ HB_FUNC( CAIRO_NEW_PATH )
HB_FUNC( CAIRO_PATH_EXTENTS )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem = hb_stackReturnItem();
double x1, y1, x2, y2;
PHB_ITEM pItem = hb_stackReturnItem();
double x1, y1, x2, y2;
cairo_path_extents( pCairo, &x1, &y1, &x2, &y2 );
hb_arrayNew( pItem, 4 );
@@ -181,7 +194,8 @@ HB_FUNC( CAIRO_PATH_EXTENTS )
HB_FUNC( CAIRO_RECTANGLE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_rectangle( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) );
}
@@ -189,7 +203,8 @@ HB_FUNC( CAIRO_RECTANGLE )
HB_FUNC( CAIRO_REL_CURVE_TO )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_rel_curve_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ), hb_parnd( 7 ) );
}
@@ -197,7 +212,8 @@ HB_FUNC( CAIRO_REL_CURVE_TO )
HB_FUNC( CAIRO_REL_LINE_TO )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_rel_line_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) );
}
@@ -205,7 +221,8 @@ HB_FUNC( CAIRO_REL_LINE_TO )
HB_FUNC( CAIRO_REL_MOVE_TO )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_rel_move_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) );
}
@@ -213,7 +230,8 @@ HB_FUNC( CAIRO_REL_MOVE_TO )
HB_FUNC( CAIRO_TEXT_PATH )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
void * hText;

View File

@@ -68,7 +68,7 @@ HB_FUNC( CAIRO_PDF_SURFACE_CREATE )
HB_FUNC( CAIRO_PDF_SURFACE_SET_SIZE )
{
#ifdef CAIRO_HAS_PDF_SURFACE
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
if( pSurface )
cairo_pdf_surface_set_size( pSurface, hb_parnd( 2 ), hb_parnd( 3 ) );
#else

View File

@@ -67,7 +67,7 @@ HB_FUNC( CAIRO_IMAGE_SURFACE_CREATE_FROM_PNG )
HB_FUNC( CAIRO_SURFACE_WRITE_TO_PNG )
{
#ifdef CAIRO_HAS_PNG_FUNCTIONS
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
if( pSurface )
hb_retni( cairo_surface_write_to_png( pSurface, hb_parc( 2 ) ) );
#else

View File

@@ -68,7 +68,7 @@ HB_FUNC( CAIRO_PS_SURFACE_CREATE )
HB_FUNC( CAIRO_PS_SURFACE_SET_SIZE )
{
#ifdef CAIRO_HAS_PS_SURFACE
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
if( pSurface )
cairo_ps_surface_set_size( pSurface, hb_parnd( 2 ), hb_parnd( 3 ) );
#else
@@ -81,7 +81,7 @@ HB_FUNC( CAIRO_PS_SURFACE_SET_SIZE )
HB_FUNC( CAIRO_PS_SURFACE_SET_EPS )
{
#ifdef CAIRO_HAS_PS_SURFACE
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
if( pSurface )
cairo_ps_surface_set_eps( pSurface, hb_parl( 2 ) );
#else
@@ -94,7 +94,7 @@ HB_FUNC( CAIRO_PS_SURFACE_SET_EPS )
HB_FUNC( CAIRO_PS_SURFACE_GET_EPS )
{
#ifdef CAIRO_HAS_PS_SURFACE
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
if( pSurface )
hb_retl( cairo_ps_surface_get_eps( pSurface ) );
#else

View File

@@ -56,7 +56,8 @@
HB_FUNC( CAIRO_SURFACE_STATUS )
{
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
cairo_surface_t * pSurface = hb_cairo_surface_param( 1 );
if( pSurface )
hb_retni( cairo_surface_status( pSurface ) );
}

View File

@@ -58,10 +58,11 @@
HB_FUNC( CAIRO_FONT_EXTENTS )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem = hb_stackReturnItem();
PHB_ITEM pItem = hb_stackReturnItem();
cairo_font_extents_t fe;
cairo_font_extents( pCairo, &fe );
@@ -77,11 +78,12 @@ HB_FUNC( CAIRO_FONT_EXTENTS )
HB_FUNC( CAIRO_GET_FONT_MATRIX )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem = hb_stackReturnItem();
cairo_matrix_t m;
PHB_ITEM pItem = hb_stackReturnItem();
cairo_matrix_t m;
cairo_get_font_matrix( pCairo, &m );
hb_arrayNew( pItem, 6 );
@@ -97,7 +99,8 @@ HB_FUNC( CAIRO_GET_FONT_MATRIX )
HB_FUNC( CAIRO_SELECT_FONT_FACE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
void * hFamily;
@@ -109,14 +112,15 @@ HB_FUNC( CAIRO_SELECT_FONT_FACE )
HB_FUNC( CAIRO_SET_FONT_MATRIX )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem;
if( ( pItem = hb_param( 2, HB_IT_ARRAY ) ) != NULL && hb_arrayLen( pItem ) == 6 )
{
cairo_matrix_t m;
cairo_matrix_t m;
m.xx = hb_arrayGetND( pItem, 1 );
m.yx = hb_arrayGetND( pItem, 2 );
m.xy = hb_arrayGetND( pItem, 3 );
@@ -133,7 +137,8 @@ HB_FUNC( CAIRO_SET_FONT_MATRIX )
HB_FUNC( CAIRO_SET_FONT_SIZE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_set_font_size( pCairo, hb_parnd( 2 ) );
}
@@ -141,7 +146,8 @@ HB_FUNC( CAIRO_SET_FONT_SIZE )
HB_FUNC( CAIRO_SHOW_TEXT )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
void * hText;
@@ -153,11 +159,12 @@ HB_FUNC( CAIRO_SHOW_TEXT )
HB_FUNC( CAIRO_TEXT_EXTENTS )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
void * hText;
PHB_ITEM pItem = hb_stackReturnItem();
void * hText;
PHB_ITEM pItem = hb_stackReturnItem();
cairo_text_extents_t te;
cairo_text_extents( pCairo, hb_parstr_utf8( 2, &hText, NULL ), &te );

View File

@@ -58,11 +58,12 @@
HB_FUNC( CAIRO_GET_MATRIX )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem = hb_stackReturnItem();
cairo_matrix_t m;
PHB_ITEM pItem = hb_stackReturnItem();
cairo_matrix_t m;
cairo_get_matrix( pCairo, &m );
hb_arrayNew( pItem, 6 );
@@ -78,7 +79,8 @@ HB_FUNC( CAIRO_GET_MATRIX )
HB_FUNC( CAIRO_IDENTITY_MATRIX )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_identity_matrix( pCairo );
}
@@ -86,22 +88,24 @@ HB_FUNC( CAIRO_IDENTITY_MATRIX )
HB_FUNC( CAIRO_ROTATE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_rotate( pCairo, hb_parnd( 2 ) );
cairo_rotate( pCairo, hb_parnd( 2 ) );
}
HB_FUNC( CAIRO_SET_MATRIX )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem;
if( ( pItem = hb_param( 2, HB_IT_ARRAY ) ) != NULL && hb_arrayLen( pItem ) == 6 )
{
cairo_matrix_t m;
cairo_matrix_t m;
m.xx = hb_arrayGetND( pItem, 1 );
m.yx = hb_arrayGetND( pItem, 2 );
m.xy = hb_arrayGetND( pItem, 3 );
@@ -118,22 +122,24 @@ HB_FUNC( CAIRO_SET_MATRIX )
HB_FUNC( CAIRO_SCALE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_scale( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) );
cairo_scale( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) );
}
HB_FUNC( CAIRO_TRANSFORM )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
{
PHB_ITEM pItem;
if( ( pItem = hb_param( 2, HB_IT_ARRAY ) ) != NULL && hb_arrayLen( pItem ) == 6 )
{
cairo_matrix_t m;
cairo_matrix_t m;
m.xx = hb_arrayGetND( pItem, 1 );
m.yx = hb_arrayGetND( pItem, 2 );
m.xy = hb_arrayGetND( pItem, 3 );
@@ -150,7 +156,8 @@ HB_FUNC( CAIRO_TRANSFORM )
HB_FUNC( CAIRO_TRANSLATE )
{
cairo_t * pCairo = hb_cairo_param( 1 );
cairo_t * pCairo = hb_cairo_param( 1 );
if( pCairo )
cairo_translate( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) );
cairo_translate( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) );
}

View File

@@ -84,14 +84,9 @@ static HB_BOOL hb_clsSetScope( HB_BOOL fScope ) { return fScope; }
memmove( array + index, array + index + 1, sizeof( type ) * ( length - index ) ); \
} while( 0 )
#if 1
# define HB_DBGCOMMON_LOCK() hb_threadEnterCriticalSection( &s_dbgMtx )
# define HB_DBGCOMMON_UNLOCK() hb_threadLeaveCriticalSection( &s_dbgMtx )
static HB_CRITICAL_NEW( s_dbgMtx );
#else
# define HB_DBGCOMMON_LOCK()
# define HB_DBGCOMMON_UNLOCK()
#endif
#define HB_DBGCOMMON_LOCK() hb_threadEnterCriticalSection( &s_dbgMtx )
#define HB_DBGCOMMON_UNLOCK() hb_threadLeaveCriticalSection( &s_dbgMtx )
static HB_CRITICAL_NEW( s_dbgMtx );
typedef struct
{

View File

@@ -388,15 +388,15 @@ static HB_USHORT s_uiObjectClass = 0;
# include "hbthread.h"
# define HB_CLASS_POOL_SIZE 16384
# define HB_CLASS_LOCK() hb_threadEnterCriticalSection( &s_clsMtx )
# define HB_CLASS_UNLOCK() hb_threadLeaveCriticalSection( &s_clsMtx )
# define HB_CLASS_LOCK hb_threadEnterCriticalSection( &s_clsMtx );
# define HB_CLASS_UNLOCK hb_threadLeaveCriticalSection( &s_clsMtx );
static HB_CRITICAL_NEW( s_clsMtx );
#else
# define HB_CLASS_POOL_SIZE 0
# define HB_CLASS_LOCK()
# define HB_CLASS_UNLOCK()
# define HB_CLASS_LOCK
# define HB_CLASS_UNLOCK
#endif
@@ -3229,7 +3229,7 @@ static HB_USHORT hb_clsNew( const char * szClassName, HB_USHORT uiDatas,
pNewCls = ( PCLASS ) hb_xgrab( sizeof( CLASS ) );
memset( pNewCls, 0, sizeof( CLASS ) );
HB_CLASS_LOCK();
HB_CLASS_LOCK
if( s_uiClasses == s_uiClsSize )
{
@@ -3240,7 +3240,7 @@ static HB_USHORT hb_clsNew( const char * szClassName, HB_USHORT uiDatas,
s_pClasses[ ++s_uiClasses ] = pNewCls;
pNewCls->uiClass = s_uiClasses;
HB_CLASS_UNLOCK();
HB_CLASS_UNLOCK
pNewCls->szName = hb_strdup( szClassName );
pNewCls->pClassSym = hb_dynsymGet( pNewCls->szName );
@@ -5060,7 +5060,7 @@ HB_FUNC( __CLSPREALLOCATE )
if( lNewSize > ( HB_LONG ) USHRT_MAX )
lNewSize = USHRT_MAX;
HB_CLASS_LOCK();
HB_CLASS_LOCK
if( lNewSize > ( HB_LONG ) s_uiClsSize )
{
@@ -5069,7 +5069,7 @@ HB_FUNC( __CLSPREALLOCATE )
( ( HB_SIZE ) s_uiClsSize + 1 ) );
}
HB_CLASS_UNLOCK();
HB_CLASS_UNLOCK
hb_retnl( s_uiClsSize );
}

View File

@@ -74,15 +74,15 @@ HB_SYM_HOLDER, * PHB_SYM_HOLDER;
# include "hbthread.h"
static HB_CRITICAL_NEW( s_dynsMtx );
# define HB_DYNSYM_LOCK() hb_threadEnterCriticalSection( &s_dynsMtx )
# define HB_DYNSYM_UNLOCK() hb_threadLeaveCriticalSection( &s_dynsMtx )
# define HB_DYNSYM_LOCK hb_threadEnterCriticalSection( &s_dynsMtx );
# define HB_DYNSYM_UNLOCK hb_threadLeaveCriticalSection( &s_dynsMtx );
# define hb_dynsymHandles( p ) hb_stackGetDynHandle( p )
#else
# define HB_DYNSYM_LOCK()
# define HB_DYNSYM_UNLOCK()
# define HB_DYNSYM_LOCK
# define HB_DYNSYM_UNLOCK
# define hb_dynsymHandles( p ) ( p )
@@ -99,7 +99,7 @@ static PDYNHB_ITEM s_pDynIndex = NULL;
static int s_iDynIdxSize = 0;
/* Insert new symbol into dynamic symbol table.
* In MT mode caller should protected it by HB_DYNSYM_LOCK()
* In MT mode caller should protected it by HB_DYNSYM_LOCK
*/
static PHB_DYNS hb_dynsymInsert( PHB_SYMB pSymbol, HB_UINT uiPos )
{
@@ -135,7 +135,7 @@ static PHB_DYNS hb_dynsymInsert( PHB_SYMB pSymbol, HB_UINT uiPos )
/* Find symbol in dynamic symbol table and set it's position.
* If not found set position for insert operation.
* In MT mode caller should protected it by HB_DYNSYM_LOCK()
* In MT mode caller should protected it by HB_DYNSYM_LOCK
*/
static PHB_DYNS hb_dynsymPos( const char * szName, HB_UINT * puiPos )
{
@@ -169,7 +169,7 @@ static PHB_DYNS hb_dynsymPos( const char * szName, HB_UINT * puiPos )
}
/* Create new symbol.
* In MT mode caller should protected it by HB_DYNSYM_LOCK()
* In MT mode caller should protected it by HB_DYNSYM_LOCK
*/
static PHB_SYMB hb_symbolAlloc( const char * szName )
{
@@ -199,7 +199,7 @@ PHB_DYNS hb_dynsymFind( const char * szName )
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymFind(%s)", szName));
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
uiFirst = 0;
uiLast = s_uiDynSymbols;
@@ -211,7 +211,7 @@ PHB_DYNS hb_dynsymFind( const char * szName )
if( iCmp == 0 )
{
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return s_pDynItems[ uiMiddle ].pDynSym;
}
else if( iCmp < 0 )
@@ -220,7 +220,7 @@ PHB_DYNS hb_dynsymFind( const char * szName )
uiFirst = uiMiddle + 1;
}
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return NULL;
}
@@ -232,11 +232,11 @@ PHB_SYMB hb_symbolNew( const char * szName )
HB_TRACE(HB_TR_DEBUG, ("hb_symbolNew(%s)", szName));
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
pSymbol = hb_symbolAlloc( szName );
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return pSymbol;
}
@@ -249,7 +249,7 @@ PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol )
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymNew(%p)", pSymbol));
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
pDynSym = hb_dynsymPos( pSymbol->szName, &uiPos ); /* Find position */
if( ! pDynSym )
@@ -305,7 +305,7 @@ PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol )
* In such case update pDynSym address in the new symbol but
* do not register it as the main one
*/
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return pDynSym; /* Return pointer to DynSym */
}
/* The multiple symbols comes from single binaries - we have to
@@ -356,7 +356,7 @@ PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol )
}
}
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return pDynSym;
}
@@ -369,13 +369,13 @@ PHB_DYNS hb_dynsymGetCase( const char * szName )
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymGetCase(%s)", szName));
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
pDynSym = hb_dynsymPos( szName, &uiPos );
if( ! pDynSym )
pDynSym = hb_dynsymInsert( hb_symbolAlloc( szName ), uiPos );
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return pDynSym;
}
@@ -515,12 +515,12 @@ static PHB_DYNS hb_dynsymGetByIndex( HB_LONG lIndex )
{
PHB_DYNS pDynSym = NULL;
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
if( lIndex >= 1 && lIndex <= s_uiDynSymbols )
pDynSym = s_pDynItems[ lIndex - 1 ].pDynSym;
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return pDynSym;
}
@@ -538,7 +538,7 @@ int hb_dynsymToNum( PHB_DYNS pDynSym )
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymToNum(%p)", pDynSym));
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
iSymNum = pDynSym->uiSymNum;
@@ -554,7 +554,7 @@ int hb_dynsymToNum( PHB_DYNS pDynSym )
if( s_pDynIndex[ iSymNum - 1 ].pDynSym == NULL )
s_pDynIndex[ iSymNum - 1 ].pDynSym = pDynSym;
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return iSymNum;
}
@@ -565,12 +565,12 @@ PHB_DYNS hb_dynsymFromNum( int iSymNum )
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymFromNum(%d)", iSymNum));
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
pDynSym = iSymNum > 0 && iSymNum <= s_iDynIdxSize ?
s_pDynIndex[ iSymNum - 1 ].pDynSym : NULL;
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
return pDynSym;
}
@@ -585,7 +585,7 @@ void hb_dynsymEval( PHB_DYNS_FUNC pFunction, void * Cargo )
for( ;; )
{
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
if( pDynSym )
{
@@ -603,7 +603,7 @@ void hb_dynsymEval( PHB_DYNS_FUNC pFunction, void * Cargo )
else
pDynSym = NULL;
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
if( !pDynSym || !( pFunction )( pDynSym, Cargo ) )
break;
@@ -616,7 +616,7 @@ void hb_dynsymProtectEval( PHB_DYNS_FUNC pFunction, void * Cargo )
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymProtectEval(%p, %p)", pFunction, Cargo));
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
while( uiPos < s_uiDynSymbols )
{
@@ -624,14 +624,14 @@ void hb_dynsymProtectEval( PHB_DYNS_FUNC pFunction, void * Cargo )
break;
}
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
}
void hb_dynsymRelease( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymRelease()"));
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
if( s_iDynIdxSize )
{
@@ -656,7 +656,7 @@ void hb_dynsymRelease( void )
hb_xfree( pHolder );
}
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
}
HB_FUNC( __DYNSCOUNT ) /* How much symbols do we have: dsCount = __dynsymCount() */
@@ -685,10 +685,10 @@ HB_FUNC( __DYNSGETINDEX ) /* Gimme index number of symbol: dsIndex = __dynsymGet
pDynSym = hb_dynsymFindName( szName );
if( pDynSym )
{
HB_DYNSYM_LOCK();
HB_DYNSYM_LOCK
if( !hb_dynsymPos( pDynSym->pSymbol->szName, &uiPos ) )
uiPos = 0;
HB_DYNSYM_UNLOCK();
HB_DYNSYM_UNLOCK
}
}

View File

@@ -76,21 +76,21 @@
# if defined( HB_SPINLOCK_INIT ) && 1
HB_SPINLOCK_T s_gcSpinLock = HB_SPINLOCK_INIT;
# define HB_GC_LOCK() HB_SPINLOCK_ACQUIRE( &s_gcSpinLock )
# define HB_GC_UNLOCK() HB_SPINLOCK_RELEASE( &s_gcSpinLock )
# define HB_GC_LOCK HB_SPINLOCK_ACQUIRE( &s_gcSpinLock );
# define HB_GC_UNLOCK HB_SPINLOCK_RELEASE( &s_gcSpinLock );
# else
static HB_CRITICAL_NEW( s_gcMtx );
# define HB_GC_LOCK() hb_threadEnterCriticalSection( &s_gcMtx )
# define HB_GC_UNLOCK() hb_threadLeaveCriticalSection( &s_gcMtx )
# define HB_GC_LOCK hb_threadEnterCriticalSection( &s_gcMtx );
# define HB_GC_UNLOCK hb_threadLeaveCriticalSection( &s_gcMtx );
#endif
#else
# define HB_GC_LOCK()
# define HB_GC_UNLOCK()
# define HB_GC_LOCK
# define HB_GC_UNLOCK
#endif /* HB_MT_VM */
@@ -204,9 +204,9 @@ void * hb_gcAllocate( HB_SIZE nSize, const HB_GC_FUNCS * pFuncs )
pAlloc->pFuncs = pFuncs;
pAlloc->locked = 1;
pAlloc->used = s_uUsedFlag;
HB_GC_LOCK();
HB_GC_LOCK
hb_gcLink( &s_pLockedBlock, pAlloc );
HB_GC_UNLOCK();
HB_GC_UNLOCK
return HB_BLOCK_PTR( pAlloc ); /* hide the internal data */
}
@@ -221,19 +221,19 @@ void * hb_gcAllocRaw( HB_SIZE nSize, const HB_GC_FUNCS * pFuncs )
pAlloc->locked = 0;
pAlloc->used = s_uUsedFlag;
HB_GC_LOCK();
HB_GC_LOCK
#ifdef HB_GC_AUTO
if( s_ulBlocks > s_ulBlocksCheck )
{
HB_GC_UNLOCK();
HB_GC_UNLOCK
hb_gcCollectAll( HB_TRUE );
HB_GC_LOCK();
HB_GC_LOCK
pAlloc->used = s_uUsedFlag;
}
HB_GC_AUTO_INC
#endif
hb_gcLink( &s_pCurrBlock, pAlloc );
HB_GC_UNLOCK();
HB_GC_UNLOCK
return HB_BLOCK_PTR( pAlloc ); /* hide the internal data */
}
@@ -248,7 +248,7 @@ void hb_gcFree( void *pBlock )
/* Don't release the block that will be deleted during finalization */
if( !( pAlloc->used & HB_GC_DELETE ) )
{
HB_GC_LOCK();
HB_GC_LOCK
if( pAlloc->locked )
hb_gcUnlink( &s_pLockedBlock, pAlloc );
else
@@ -256,7 +256,7 @@ void hb_gcFree( void *pBlock )
hb_gcUnlink( &s_pCurrBlock, pAlloc );
HB_GC_AUTO_DEC
}
HB_GC_UNLOCK();
HB_GC_UNLOCK
HB_GARBAGE_FREE( pAlloc );
}
@@ -296,7 +296,7 @@ void hb_gcRefFree( void * pBlock )
/* unlink the block first to avoid possible problems
* if cleanup function activate GC
*/
HB_GC_LOCK();
HB_GC_LOCK
if( pAlloc->locked )
hb_gcUnlink( &s_pLockedBlock, pAlloc );
else
@@ -304,7 +304,7 @@ void hb_gcRefFree( void * pBlock )
hb_gcUnlink( &s_pCurrBlock, pAlloc );
HB_GC_AUTO_DEC
}
HB_GC_UNLOCK();
HB_GC_UNLOCK
pAlloc->used |= HB_GC_DELETE;
@@ -345,10 +345,10 @@ void hb_gcRefCheck( void * pBlock )
pAlloc->used = s_uUsedFlag;
pAlloc->locked = 0;
HB_GC_LOCK();
HB_GC_LOCK
hb_gcLink( &s_pCurrBlock, pAlloc );
HB_GC_AUTO_INC
HB_GC_UNLOCK();
HB_GC_UNLOCK
if( hb_vmRequestQuery() == 0 )
hb_errRT_BASE( EG_DESTRUCTOR, 1301, NULL, "Reference to freed block", 0 );
@@ -390,9 +390,9 @@ PHB_ITEM hb_gcGripGet( PHB_ITEM pOrigin )
pItem->type = HB_IT_NIL;
HB_GC_LOCK();
HB_GC_LOCK
hb_gcLink( &s_pLockedBlock, pAlloc );
HB_GC_UNLOCK();
HB_GC_UNLOCK
if( pOrigin )
hb_itemCopy( pItem, pOrigin );
@@ -414,7 +414,7 @@ void * hb_gcLock( void * pBlock )
{
HB_GARBAGE_PTR pAlloc = HB_GC_PTR( pBlock );
HB_GC_LOCK();
HB_GC_LOCK
if( ! pAlloc->locked )
{
hb_gcUnlink( &s_pCurrBlock, pAlloc );
@@ -422,7 +422,7 @@ void * hb_gcLock( void * pBlock )
HB_GC_AUTO_DEC
}
++pAlloc->locked;
HB_GC_UNLOCK();
HB_GC_UNLOCK
}
return pBlock;
@@ -439,7 +439,7 @@ void * hb_gcUnlock( void * pBlock )
if( pAlloc->locked )
{
HB_GC_LOCK();
HB_GC_LOCK
if( pAlloc->locked )
{
if( --pAlloc->locked == 0 )
@@ -451,7 +451,7 @@ void * hb_gcUnlock( void * pBlock )
HB_GC_AUTO_INC
}
}
HB_GC_UNLOCK();
HB_GC_UNLOCK
}
}
return pBlock;
@@ -463,7 +463,7 @@ void hb_gcAttach( void * pBlock )
if( pAlloc->locked )
{
HB_GC_LOCK();
HB_GC_LOCK
if( pAlloc->locked )
{
if( --pAlloc->locked == 0 )
@@ -476,7 +476,7 @@ void hb_gcAttach( void * pBlock )
pAlloc = NULL;
}
}
HB_GC_UNLOCK();
HB_GC_UNLOCK
}
if( pAlloc )
hb_xRefInc( pAlloc );
@@ -717,10 +717,10 @@ void hb_gcCollectAll( HB_BOOL fForce )
{
pDelete->used = s_uUsedFlag;
pDelete->locked = 0;
HB_GC_LOCK();
HB_GC_LOCK
hb_gcLink( &s_pCurrBlock, pDelete );
HB_GC_AUTO_INC
HB_GC_UNLOCK();
HB_GC_UNLOCK
if( hb_vmRequestQuery() == 0 )
hb_errRT_BASE( EG_DESTRUCTOR, 1301, NULL, "Reference to freed block", 0 );
}
@@ -808,7 +808,7 @@ HB_FUNC( HB_GCSETAUTO )
nBlocks = fSet ? hb_parnint( 1 ) * 1000 : 0;
HB_GC_LOCK();
HB_GC_LOCK
nPrevBlocks = s_ulBlocksAuto;
if( fSet )
{
@@ -822,7 +822,7 @@ HB_FUNC( HB_GCSETAUTO )
s_ulBlocksCheck = HB_GC_AUTO_MAX;
}
}
HB_GC_UNLOCK();
HB_GC_UNLOCK
hb_retnint( nPrevBlocks / 1000 );
}