diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4ef5e4f3c6..bdbe798bb1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,34 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-10-21 02:52 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * source/rtl/set.c + ! Fixed SET DEVICE TO PRINTER not to add an extension (".prn") + to the filename specified by SET PRINTER TO (the extension + is only added by the SET PRINTER TO command). + ! Fixed SET DEVICE TO PRINTER to point to "LPT1" by default + (instead of "PRN") under Win32 (this is now in sync with + ISPRINTER() logic). Added "PRN" for the rest of OSes (TOFIX). + ; Pls test. + + * source/rtl/isprint.c + ! Cleaned up platform branches in ISPRINTER(). Non DOS/Win32 + branch is a dummy TODO now. + + * contrib/libnf/fttext.c + ! Some fixes reported by Mike Evans. Pls test. + Not all reported bugs were fixed. (ft_FError() returns + a constant zero, ft_FUse() still needs ft_FSelect()) + + - contrib/directx/HB_DDraw.cpp + + contrib/directx/w32_ddrw.cpp + - contrib/directx/HB_DDraw.h + + contrib/directx/w32_ddrw.h + * contrib/directx/readme.1st + ! Harbour API updates to this severly outdated code. + ! Fixed warnings. + + Added SVN headers. + 2007-10-19 16:16 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapicdp.h * harbour/source/rtl/cdpapi.c diff --git a/harbour/contrib/directx/HB_DDraw.h b/harbour/contrib/directx/HB_DDraw.h deleted file mode 100644 index 3a7c9de59e..0000000000 --- a/harbour/contrib/directx/HB_DDraw.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright(C) 1999 by Jesus Salas - * - * 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 of the License, 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 program; if not, write to: - * - * The Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. - * - * You can contact me at: jsalas@gruposp.com jsalas@sp-editores.es - * - */ - -#define INITGUID -#include "windows.h" -#include "winuser.h" -#include "hbapi.h" -#include "hbvm.h" -#include "errno.h" -#include "objbase.h" -#include "tchar.h" -#include "stdio.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" -#include ".\include\ddraw.h" -#include ".\include\ddutil.h" - - - - // Main Message Loop - - long _stdcall hb_dd_DDWndProc ( HWND , UINT , WPARAM , LPARAM ); - void hb_dd_g_Error ( char *, long , char *); - void hb_dd_CreateWindow ( void ); - - // DDraw initialize - - void HB_DD_DDRAWSTARTUP ( HWND ); - void hb_dd_StartWindow ( void ); - void hb_dd_CreateOffScreenBitmap ( void ); - void hb_dd_ReleaseAllObjects ( void ); - void hb_dd_RestoreAll ( void ); - void hb_dd_checkError ( HRESULT ); - - HRESULT hb_dd_DDCopyBitmap ( IDirectDrawSurface4 * pdds, HBITMAP hbm, int x, int y, int dx, int dy); - void hb_dd_RenderSprites ( long ); - -extern "C" DWORD hb_dd_DDColorMatch ( IDirectDrawSurface4 * pdds, COLORREF rgb ); - -//-------------------------------------------------------// -// API Functions -//-------------------------------------------------------// - - void DD_MsgBox ( void ); - void WinError ( void ); - diff --git a/harbour/contrib/directx/readme.1st b/harbour/contrib/directx/readme.1st index a1d77bea86..9aa551818e 100644 --- a/harbour/contrib/directx/readme.1st +++ b/harbour/contrib/directx/readme.1st @@ -1,3 +1,7 @@ +/* + * $Id$ + */ + /* * Copyright(C) 1999 by Jesus Salas * diff --git a/harbour/contrib/directx/HB_DDraw.cpp b/harbour/contrib/directx/w32_ddrw.c similarity index 89% rename from harbour/contrib/directx/HB_DDraw.cpp rename to harbour/contrib/directx/w32_ddrw.c index 547c406eb2..69255c4b63 100644 --- a/harbour/contrib/directx/HB_DDraw.cpp +++ b/harbour/contrib/directx/w32_ddrw.c @@ -1,3 +1,7 @@ +/* + * $Id$ + */ + /* * Copyright(C) 1999 by Jesus Salas * @@ -22,10 +26,10 @@ */ #define INITGUID -#include "HB_DDraw.h" +#include "w32_ddrw.h" - BOOL hb_dd_g_handling_events=FALSE; // painting? + BOOL hb_dd_g_handling_events = FALSE; // painting? #define HB_DD_TIMER_ID 1 #define HB_DD_TIMER_RATE 100 @@ -36,8 +40,8 @@ LPDIRECTDRAW4 hb_dd_g_pDD = NULL; // DirectDraw object HWND hb_dd_g_DDHwnd; // Our hWnd - long hb_dd_g_xWindow=0; - long hb_dd_g_yWindow=0; + long hb_dd_g_xWindow = 0; + long hb_dd_g_yWindow = 0; //------------------------------------------------------------------------------// // Management Structs for surfaces... @@ -94,10 +98,9 @@ short int hb_dd_g_KeyDown[256]; - HARBOUR HB_DD_ISKEYPRESSED( void ) + HB_FUNC( HB_DD_ISKEYPRESSED ) { - long nKey = hb_parnl( 1 ); - if ( hb_dd_g_KeyDown[ nKey ] ) + if ( hb_dd_g_KeyDown[ hb_parnl( 1 ) ] ) hb_retl( 1 ); else hb_retl( 0 ); @@ -105,7 +108,7 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_SPGETXY( void ) + HB_FUNC( HB_DD_SPGETXY ) { // This function is Broken ( hb_stornl fail ); @@ -118,46 +121,40 @@ hb_stornl( hb_dd_Sprites[ n ].y, -1, 1 ); } - HARBOUR HB_DD_SPGETX( void ) + HB_FUNC( HB_DD_SPGETX ) { - - long n =hb_parnl( 1 ); - hb_retnl( hb_dd_Sprites[ n ].x ); + hb_retnl( hb_dd_Sprites[ hb_parnl( 1 ) ].x ); } - HARBOUR HB_DD_SPGETY( void ) + HB_FUNC( HB_DD_SPGETY ) { - - long n =hb_parnl( 1 ); - hb_retnl( hb_dd_Sprites[ n ].y ); + hb_retnl( hb_dd_Sprites[ hb_parnl( 1 ) ].y ); } //------------------------------------------------------------------// - HARBOUR HB_DD_SPGETVISIBLE( void ) + HB_FUNC( HB_DD_SPGETVISIBLE ) { hb_retl( hb_dd_Sprites[ hb_parnl( 1 ) ].Visible ); } //------------------------------------------------------------------// - void HB_DD_SPSETVISIBLE( void ) + HB_FUNC( HB_DD_SPSETVISIBLE ) { - long n = hb_parnl( 1 ); - hb_dd_Sprites[ n ].Visible = hb_parl( 2 ); + hb_dd_Sprites[ hb_parnl( 1 ) ].Visible = hb_parl( 2 ); } //------------------------------------------------------------------// - HARBOUR HB_DD_SPONRENDER( void ) + HB_FUNC( HB_DD_SPONRENDER ) { - long n = hb_parnl( 1 ); - hb_dd_Sprites[ n ].OnRender = strdup( hb_parc(1) ); + hb_dd_Sprites[ hb_parnl( 1 ) ].OnRender = strdup( hb_parc(1) ); } //------------------------------------------------------------------// - HARBOUR HB_DD_SPCLEARDIRECTION( void ) + HB_FUNC( HB_DD_SPCLEARDIRECTION ) { long n = hb_parnl( 1 ); hb_dd_Sprites[ n ].xIncrement = 0; @@ -167,23 +164,21 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_SPSETSOLID( void ) + HB_FUNC( HB_DD_SPSETSOLID ) { - long n =hb_parnl( 1 ); hb_dd_Sprites[hb_parnl( 1 ) ].Solid = hb_parl( 2 ); } //------------------------------------------------------------------// - HARBOUR HB_DD_SPSETMASKED( void ) + HB_FUNC( HB_DD_SPSETMASKED ) { - long n =hb_parnl( 1 ); hb_dd_Sprites[hb_parnl( 1 ) ].Masked = hb_parl( 2 ); } //------------------------------------------------------------------// - HARBOUR HB_DD_SPSETDIRECTION( void ) + HB_FUNC( HB_DD_SPSETDIRECTION ) { long n =hb_parnl( 1 ); @@ -194,7 +189,7 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_SPONFIRSTFRAME( void ) + HB_FUNC( HB_DD_SPONFIRSTFRAME ) { long n =hb_parnl( 1 ); hb_dd_Sprites[ n ].OnFirstFrame = strdup( hb_parc(2) ); @@ -202,7 +197,7 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_SPONOUTSCREEN( void ) + HB_FUNC( HB_DD_SPONOUTSCREEN ) { long n =hb_parnl( 1 ); hb_dd_Sprites[ n ].OnOutScreen = strdup( hb_parc(2) ); @@ -210,7 +205,7 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_SPONCOLLISION( void ) + HB_FUNC( HB_DD_SPONCOLLISION ) { long n =hb_parnl( 1 ); hb_dd_Sprites[ n ].OnCollision = strdup( hb_parc(2) ); @@ -219,8 +214,7 @@ //------------------------------------------------------------------// - - HARBOUR HB_DD_CREATESPRITE( void ) + HB_FUNC( HB_DD_CREATESPRITE ) { long n = hb_dd_g_SpritesCount; @@ -242,7 +236,7 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_SPSETXY( void ) + HB_FUNC( HB_DD_SPSETXY ) { long n =hb_parnl( 1 ); long x =hb_parnl( 2 ); @@ -253,7 +247,7 @@ //------------------------------------------------------------------// - HARBOUR DD_SPSETINVERTED( void ) + HB_FUNC( DD_SPSETINVERTED ) { LPDIRECTDRAWSURFACE4 pdds; long n =hb_parnl(1); @@ -280,11 +274,8 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_MSGBOX( void ) + HB_FUNC( HB_DD_MSGBOX ) { - char buff[20]=""; - long dwVal=0; - char *m1; char *m2; char deftitle [100] = ""; @@ -301,7 +292,6 @@ m2 = deftitle; MessageBox( hb_dd_g_DDHwnd, m1, m2, NULL); - } //------------------------------------------------------------------// @@ -373,21 +363,17 @@ HRESULT hRet; long cont,cont2; RECT rcRect; - LPDIRECTDRAWSURFACE4 pdds; - long o =0 ; - PSYMBOL pVMCall; - PDYNSYM pDynSym; - - pDynSym = hb_FindDynSym( "DDONRENDER" ); + LPDIRECTDRAWSURFACE4 pdds; + PHB_DYNS pDynSym; + pDynSym = hb_dynsymFindName( "DDONRENDER" ); + if( pDynSym ) - { - pVMCall = pDynSym->pSymbol; - PushSymbol( pVMCall ); - PushNil(); - Do( 0 ); - } - + { + hb_vmPushSymbol( hb_dynsymSymbol( pDynSym ) ); + hb_vmPushNil(); + hb_vmDo(0); + } for( cont=0; contpSymbol; - PushSymbol( pVMCall ); - PushNil(); - PushLong( cont ); - PushLong( cont2 ); - Do( 2 ); - } + pDynSym = hb_dynsymFindName( hb_dd_Sprites[ cont ].OnCollision ); + + if( pDynSym ) + { + hb_vmPushSymbol( hb_dynsymSymbol( pDynSym ) ); + hb_vmPushNil(); + hb_vmPushLong( cont ); + hb_vmPushLong( cont2 ); + hb_vmDo(2); + } } } @@ -447,14 +432,14 @@ if ( hb_dd_Sprites[ cont ].OnFirstFrame != NULL ) { - pDynSym = hb_FindDynSym( hb_dd_Sprites[ cont ].OnFirstFrame ); - if( pDynSym ) - { - pVMCall = pDynSym->pSymbol; - PushSymbol( pVMCall ); - PushNil(); - Do( 0 ); - } + pDynSym = hb_dynsymFindName( hb_dd_Sprites[ cont ].OnFirstFrame ); + + if( pDynSym ) + { + hb_vmPushSymbol( hb_dynsymSymbol( pDynSym ) ); + hb_vmPushNil(); + hb_vmDo(0); + } } hb_dd_Sprites[ cont ].Frame = 1; } @@ -507,16 +492,15 @@ { if ( hb_dd_Sprites[ cont ].OnOutScreen != NULL ) { - pDynSym = hb_FindDynSym( hb_dd_Sprites[ cont ].OnOutScreen ); - - if( pDynSym ) - { - pVMCall = pDynSym->pSymbol; - PushSymbol( pVMCall ); - PushNil(); - PushLong( cont ); - Do( 1 ); - } + pDynSym = hb_dynsymFindName( hb_dd_Sprites[ cont ].OnOutScreen ); + + if( pDynSym ) + { + hb_vmPushSymbol( hb_dynsymSymbol( pDynSym ) ); + hb_vmPushNil(); + hb_vmPushLong( cont ); + hb_vmDo( 1 ); + } } @@ -595,10 +579,10 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_CREATEWINDOW( void ) + HB_FUNC( HB_DD_CREATEWINDOW ) { - HWND m_hWnd = NULL; + HWND m_hWnd; HINSTANCE m_hInstance = GetModuleHandle(NULL); long x,y; @@ -649,7 +633,7 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_LOADBMPINTOSURFACE( void ) + HB_FUNC( HB_DD_LOADBMPINTOSURFACE ) { long nSurface = hb_parnl( 1 ); char * cBitmap = hb_parc ( 2 ); @@ -683,7 +667,7 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_CREATEOFFSCREENBITMAP( void ) + HB_FUNC( HB_DD_CREATEOFFSCREENBITMAP ) { DDSURFACEDESC2 ddsd; HRESULT hRet; @@ -758,7 +742,7 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_DDRAWSTARTUP( HWND hWnd ) + void HB_DD_DDRAWSTARTUP( HWND hWnd ) { @@ -823,9 +807,8 @@ //------------------------------------------------------------------// - HARBOUR HB_DD_STARTWINDOW( void ) + HB_FUNC( HB_DD_STARTWINDOW ) { - HWND m_hWnd = ( HWND ) hb_parnl(1); MSG msg; BOOL loop = TRUE; @@ -881,9 +864,10 @@ HRESULT hb_dd_DDCopyBitmap(IDirectDrawSurface4 * pdds, HBITMAP hbm, int x, int y return hr; } -void hb_dd_checkError( HRESULT hr ) +long hb_dd_checkError( HRESULT hr ) { - long p=0; + long p = 0; + switch( hr ) { case DDERR_EXCEPTION : p++;break; @@ -901,6 +885,8 @@ void hb_dd_checkError( HRESULT hr ) case DDERR_INVALIDSURFACETYPE :p++;;break; } + + return p; } diff --git a/harbour/contrib/libnf/fttext.c b/harbour/contrib/libnf/fttext.c index f38bbd1a53..35b28167f0 100644 --- a/harbour/contrib/libnf/fttext.c +++ b/harbour/contrib/libnf/fttext.c @@ -88,13 +88,14 @@ HB_FUNC( FT_FSKIP ); HB_FUNC( FT_FBOF ); HB_FUNC( FT_FEOF ); HB_FUNC( FT_FGOTOP ); -HB_FUNC( FT_FGOBOTTOM ); +HB_FUNC( FT_FGOBOT ); HB_FUNC( FT_FWRITELN ); HB_FUNC( FT_FREADLN ); HB_FUNC( FT_FREADLN_EX ); HB_FUNC( FT_FDELETED ); HB_FUNC( FT_FCLOSE ); HB_FUNC( FT_FCLOSEALL ); +HB_FUNC( FT_FERROR ); HB_FUNC_EXTERN( ASCAN ); HB_FUNC_EXTERN( HB_RASCAN ); @@ -187,7 +188,7 @@ HB_FUNC( FT_FUSE ) // Area already used if ( pTemp && pTemp->bActive) { - hb_retl( FALSE ); + hb_retni( -1 ); return; } @@ -292,7 +293,7 @@ HB_FUNC( FT_FUSE ) hb_itemRelease( pClone ); - pTemp->nCurrent = nCurrent ; + pTemp->nCurrent = nCurrent; pTemp->bActive = TRUE; pCurFile = pTemp; @@ -318,11 +319,11 @@ HB_FUNC( FT_FUSE ) hb_xfree( ft_FileName ); hb_itemRelease( pArray ); - hb_retl( TRUE ); + hb_retni( iSelect ); } else { - hb_retl( FALSE ); + hb_retni( -1 ); } } else @@ -337,7 +338,7 @@ HB_FUNC( FT_FUSE ) HB_FUNCNAME( FT_FCLOSEALL )(); } - hb_retl( FALSE ); + hb_retni( 0 ); } } @@ -867,7 +868,7 @@ HB_FUNC( FT_FGOTOP ) } //------------------------------------------------------------------------------ -HB_FUNC( FT_FGOBOTTOM ) +HB_FUNC( FT_FGOBOT ) { if( pCurFile ) { @@ -1051,6 +1052,12 @@ HB_FUNC( FT_FCLOSEALL ) pCurFile = NULL; } +//------------------------------------------------------------------------------ +HB_FUNC( FT_FERROR ) +{ + hb_retni( 0 ); // TOFIX: return error after FT_FUSE() +} + //------------------------------------------------------------------------------ HB_FUNC_EXIT( FT_FEXIT ) { diff --git a/harbour/source/rtl/isprint.c b/harbour/source/rtl/isprint.c index 2ba9780940..43cafd1ed4 100644 --- a/harbour/source/rtl/isprint.c +++ b/harbour/source/rtl/isprint.c @@ -57,9 +57,6 @@ HB_EXPORT BOOL hb_printerIsReady( char * pszPrinterName ) { BOOL bIsPrinter; - if( pszPrinterName == NULL ) - pszPrinterName = "LPT1"; - #if defined(HB_OS_DOS) /* NOTE: DOS specific solution, using BIOS interrupt */ @@ -67,6 +64,9 @@ HB_EXPORT BOOL hb_printerIsReady( char * pszPrinterName ) { USHORT uiPort; + if( pszPrinterName == NULL ) + pszPrinterName = "LPT1"; + if( hb_strnicmp( pszPrinterName, "PRN", 3 ) == 0 ) { union REGS regs; @@ -95,7 +95,7 @@ HB_EXPORT BOOL hb_printerIsReady( char * pszPrinterName ) bIsPrinter = FALSE; } -#else +#elif defined(HB_OS_WIN_32) /* NOTE: Platform independent method, at least it will compile and run on any platform, but the result may not be the expected one, @@ -105,11 +105,26 @@ HB_EXPORT BOOL hb_printerIsReady( char * pszPrinterName ) [vszakats] */ { - FHANDLE fhnd = hb_fsOpen( ( BYTE * ) pszPrinterName, FO_WRITE | FO_SHARED | FO_PRIVATE ); + FHANDLE fhnd; + + if( pszPrinterName == NULL ) + pszPrinterName = "LPT1"; + + fhnd = hb_fsOpen( ( BYTE * ) pszPrinterName, FO_WRITE | FO_SHARED | FO_PRIVATE ); bIsPrinter = ( fhnd != FS_ERROR ); hb_fsClose( fhnd ); } +#else + + { + /* TODO */ + + HB_SYMBOL_UNUSED( pszPrinterName ); + + bIsPrinter = FALSE; + } + #endif return bIsPrinter; diff --git a/harbour/source/rtl/set.c b/harbour/source/rtl/set.c index 331ca61753..af16c6bcd7 100644 --- a/harbour/source/rtl/set.c +++ b/harbour/source/rtl/set.c @@ -564,7 +564,7 @@ HB_FUNC( SET ) hb_set.HB_SET_DEVICE = set_string( pArg2, hb_set.HB_SET_DEVICE ); if( hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set.hb_set_printhan == FS_ERROR && hb_set.HB_SET_PRINTFILE && strlen( hb_set.HB_SET_PRINTFILE ) > 0 ) - hb_set.hb_set_printhan = open_handle( hb_set.HB_SET_PRINTFILE, FALSE, ".prn", HB_SET_PRINTFILE ); + hb_set.hb_set_printhan = open_handle( hb_set.HB_SET_PRINTFILE, FALSE, NULL, HB_SET_PRINTFILE ); } break; case HB_SET_EOF : @@ -972,10 +972,15 @@ void hb_setInitialize( void ) hb_set.HB_SET_OPTIMIZE = TRUE; hb_set.HB_SET_PATH = hb_strdup( "" ); hb_set.HB_SET_PRINTER = FALSE; -#ifdef HB_OS_UNIX - hb_set.HB_SET_PRINTFILE = hb_strdup( "|lpr" ); /* Default printer device */ + /* Default printer device */ +#if defined(HB_OS_UNIX) + hb_set.HB_SET_PRINTFILE = hb_strdup( "|lpr" ); +#elif defined(HB_OS_DOS) + hb_set.HB_SET_PRINTFILE = hb_strdup( "PRN" ); +#elif defined(HB_OS_WIN_32) + hb_set.HB_SET_PRINTFILE = hb_strdup( "LPT1" ); #else - hb_set.HB_SET_PRINTFILE = hb_strdup( "PRN" ); /* Default printer device */ + hb_set.HB_SET_PRINTFILE = hb_strdup( "PRN" ); /* TOFIX */ #endif hb_set.hb_set_printhan = FS_ERROR; hb_set.HB_SET_SCOREBOARD = TRUE;