From 6cec6c9644f9b81d6ed00502dd787cd6282fa9c9 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 29 Oct 2007 10:22:06 +0000 Subject: [PATCH] 2007-10-29 11:21 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * doc/howtosvn.txt + Added few propset command. Would need some more cleanup. * contrib/win32/test/testw32p.prg ; Formatting * source/common/hbfsapi.c ! Minor fixes. * source/compiler/hbusage.c + Added (c) after copyright. - lib/b16 - obj/b16 - Removed not needed directories. --- harbour/ChangeLog | 17 ++ harbour/contrib/win32/test/testw32p.prg | 262 +++++++++++++----------- harbour/doc/howtosvn.txt | 3 +- harbour/lib/b16/empty | 1 - harbour/obj/b16/empty | 1 - harbour/source/common/hbfsapi.c | 20 +- harbour/source/compiler/hbusage.c | 2 +- 7 files changed, 167 insertions(+), 139 deletions(-) delete mode 100644 harbour/lib/b16/empty delete mode 100644 harbour/obj/b16/empty diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 10ddf8a4bc..980dc3c8cf 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,23 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-10-29 11:21 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * doc/howtosvn.txt + + Added few propset command. Would need some more cleanup. + + * contrib/win32/test/testw32p.prg + ; Formatting + + * source/common/hbfsapi.c + ! Minor fixes. + + * source/compiler/hbusage.c + + Added (c) after copyright. + + - lib/b16 + - obj/b16 + - Removed not needed directories. + 2007-10-27 17:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbpp/pragma.c * source/rtl/binnum.c diff --git a/harbour/contrib/win32/test/testw32p.prg b/harbour/contrib/win32/test/testw32p.prg index 5755b96f58..92eee5ec7d 100644 --- a/harbour/contrib/win32/test/testw32p.prg +++ b/harbour/contrib/win32/test/testw32p.prg @@ -17,138 +17,150 @@ #define BROWN RGB( 0x85,0x85,0x0 ) #define WHITE RGB( 0xC6,0xC6,0xC6 ) -FUNCTION Main() - LOCAL nPrn:=1, cBMPFile:= SPACE( 40 ) - LOCAL aPrn:= GetPrinters() - LOCAL GetList:= {} - CLS - IF EMPTY(aPrn) - Alert("No printers installed - Cannot continue") - QUIT - ENDIF - DO WHILE !EMPTY(nPrn) - CLS - @ 0,0 SAY 'Win32Prn() Class test program. Choose a printer to test' - @ 1,0 SAY 'Bitmap file name' GET cBMPFile PICT '@!K' - READ - @ 2,0 TO maxRow(),maxCol() - nPrn:= ACHOICE(3,1,maxRow()-1,maxCol()-1,aPrn,.T.,,nPrn) - IF !EMPTY(nPrn) - PrnTest(aPrn[nPrn], cBMPFile) - ENDIF - ENDDO - RETURN(NIL) +PROCEDURE Main() + LOCAL nPrn := 1 + LOCAL cBMPFile := Space( 40 ) + LOCAL aPrn := GetPrinters() + LOCAL GetList := {} -STATIC FUNCTION PrnTest(cPrinter, cBMPFile) - LOCAL oPrinter:= Win32Prn():New(cPrinter), aFonts, x, nColFixed, nColTTF, nColCharSet - oPrinter:Landscape:= .F. - oPrinter:FormType := FORM_A4 - oPrinter:Copies := 1 - IF !oPrinter:Create() - Alert("Cannot Create Printer") - ELSE - IF !oPrinter:startDoc('Win32Prn(Doc name in Printer Properties)') - Alert("StartDoc() failed") - ELSE - oPrinter:SetPen(PS_SOLID, 1, RED) - oPrinter:Bold(800) - oPrinter:TextOut(oPrinter:PrinterName+': MaxRow() = '+STR(oPrinter:MaxRow(),4)+' MaxCol() = '+STR(oPrinter:MaxCol(),4)) - oPrinter:Bold(0) // Normal - oPrinter:NewLine() - oPrinter:TextOut(' Partial list of available fonts that are available for OEM_') - oPrinter:NewLine() - oPrinter:UnderLine(.T.) - oPrinter:Italic(.T.) -// oPrinter:SetFont('Courier New',7,{3,-50}) // Compressed print - nColFixed:= 40 * oPrinter:CharWidth - nColTTF := 48 * oPrinter:CharWidth - nColCharSet := 60 * oPrinter:CharWidth - oPrinter:TextOut('FontName') - oPrinter:SetPos(nColFixed) - oPrinter:TextOut('Fixed?') - oPrinter:SetPos(nColTTF) - oPrinter:TextOut('TrueType?') - oPrinter:SetPos(nColCharset) - oPrinter:TextOut('CharSet#',.T.) - oPrinter:NewLine() - oPrinter:Italic(.F.) - oPrinter:UnderLine(.F.) - aFonts:= oPrinter:GetFonts() - oPrinter:NewLine() - FOR x:= 1 TO LEN(aFonts) STEP 2 - oPrinter:CharSet(aFonts[x,4]) - IF oPrinter:SetFont(aFonts[x,1]) // Could use "IF oPrinter:SetFontOk" after call to oPrinter:SetFont() - IF oPrinter:FontName == aFonts[x,1] // Make sure Windows didn't pick a different font - oPrinter:TextOut(aFonts[x,1]) - oPrinter:SetPos(nColFixed) - oPrinter:TextOut(IIF(aFonts[x,2],'Yes','No')) - oPrinter:SetPos(nColTTF) - oPrinter:TextOut(IIF(aFonts[x,3],'Yes','No')) - oPrinter:SetPos(nColCharSet) - oPrinter:TextOut(STR(aFonts[x,4],5)) - oPrinter:SetPos(oPrinter:LeftMargin, oPrinter:PosY + (oPrinter:CharHeight*2)) - IF oPrinter:PRow() > oPrinter:MaxRow() - 10 // Could use "oPrinter:NewPage()" to start a new page - EXIT - ENDIF - ENDIF - ENDIF - oPrinter:Line(0, oPrinter:PosY+5, 2000, oPrinter:PosY+5) - NEXT x - oPrinter:SetFont('Lucida Console',8,{3,-50}) // Alternative Compressed print - oPrinter:CharSet(0) // Reset default charset - oPrinter:Bold(800) - oPrinter:NewLine() - oPrinter:TextOut('This is on line'+STR(oPrinter:Prow(),4)+', Printed bold, ' ) - oPrinter:TextOut(' finishing at Column: ') - oPrinter:TextOut(STR(oPrinter:Pcol(),4)) - oPrinter:SetPrc(oPrinter:Prow()+3, 0) - oPrinter:Bold(0) - oPrinter:TextOut("Notice: UNDERLINE only prints correctly if there is a blank line after",.T.) - oPrinter:TextOut(" it. This is because of ::LineHeight and the next line",.T.) - oPrinter:TextOut(" printing over top of the underline. To avoid this happening",.T.) - oPrinter:TextOut(" you can to alter ::LineHeight or use a smaller font") - oPrinter:NewLine() - oPrinter:NewLine() - oPrinter:SetFont('Lucida Console',18, 0) // Large print - oPrinter:SetColor( GREEN ) - oPrinter:TextOut("Finally some larger print") - oPrinter:Box( 0, oPrinter:PosY+100, 100, oPrinter:PosY+200) - oPrinter:Arc(200, oPrinter:PosY+100, 300, oPrinter:PosY+200) - oPrinter:Ellipse(400, oPrinter:PosY+100, 500, oPrinter:PosY+200) - oPrinter:FillRect(600, oPrinter:PosY+100, 700, oPrinter:PosY+200, RED) + CLS -// To print a barcode; -// Replace 'BCod39HN' with your own bar code font or any other font -// oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(60 ), '1234567890', 'BCod39HN', 24, 0 ) -// - PrintBitMap( oPrinter, cBMPFile ) + IF Empty( aPrn ) + Alert("No printers installed - Cannot continue") + QUIT + ENDIF - oPrinter:EndDoc() - ENDIF - oPrinter:Destroy() - ENDIF - RETURN(NIL) + DO WHILE nPrn != 0 + CLS + @ 0, 0 SAY "Win32Prn() Class test program. Choose a printer to test" + @ 1, 0 SAY "Bitmap file name" GET cBMPFile PICT "@!K" + READ + @ 2, 0 TO MaxRow(), MaxCol() + nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn ) + IF nPrn != 0 + PrnTest( aPrn[ nPrn ], cBMPFile ) + ENDIF + ENDDO + RETURN -procedure PrintBitMap( oPrn, cBitFile ) - LOCAL oBMP +STATIC PROCEDURE PrnTest( cPrinter, cBMPFile ) + LOCAL oPrinter := Win32Prn():New( cPrinter ) + LOCAL aFonts + LOCAL x + LOCAL nColFixed + LOCAL nColTTF + LOCAL nColCharSet - IF EMPTY( cBitFile ) - * - ELSEIF !FILE( cBitFile ) - Alert( cBitFile + ' not found ' ) - ELSE - oBMP:= Win32BMP():new() - IF oBmp:loadFile( cBitFile ) + oPrinter:Landscape := .F. + oPrinter:FormType := FORM_A4 + oPrinter:Copies := 1 - oBmp:Draw( oPrn, { 200,200, 2000, 1500 } ) + IF !oPrinter:Create() + Alert( "Cannot Create Printer" ) + ELSE + IF !oPrinter:startDoc( "Win32Prn(Doc name in Printer Properties)" ) + Alert( "StartDoc() failed" ) + ELSE + oPrinter:SetPen(PS_SOLID, 1, RED) + oPrinter:Bold(800) + oPrinter:TextOut(oPrinter:PrinterName+": MaxRow() = "+STR(oPrinter:MaxRow(),4)+" MaxCol() = "+STR(oPrinter:MaxCol(),4)) + oPrinter:Bold(0) // Normal + oPrinter:NewLine() + oPrinter:TextOut(" Partial list of available fonts that are available for OEM_") + oPrinter:NewLine() + oPrinter:UnderLine(.T.) + oPrinter:Italic(.T.) +// oPrinter:SetFont("Courier New",7,{3,-50}) // Compressed print + nColFixed:= 40 * oPrinter:CharWidth + nColTTF := 48 * oPrinter:CharWidth + nColCharSet := 60 * oPrinter:CharWidth + oPrinter:TextOut("FontName") + oPrinter:SetPos(nColFixed) + oPrinter:TextOut("Fixed?") + oPrinter:SetPos(nColTTF) + oPrinter:TextOut("TrueType?") + oPrinter:SetPos(nColCharset) + oPrinter:TextOut("CharSet#",.T.) + oPrinter:NewLine() + oPrinter:Italic(.F.) + oPrinter:UnderLine(.F.) + aFonts:= oPrinter:GetFonts() + oPrinter:NewLine() + FOR x:= 1 TO LEN(aFonts) STEP 2 + oPrinter:CharSet(aFonts[x,4]) + IF oPrinter:SetFont(aFonts[x,1]) // Could use "IF oPrinter:SetFontOk" after call to oPrinter:SetFont() + IF oPrinter:FontName == aFonts[x,1] // Make sure Windows didn't pick a different font + oPrinter:TextOut(aFonts[x,1]) + oPrinter:SetPos(nColFixed) + oPrinter:TextOut(IIF(aFonts[x,2],"Yes","No")) + oPrinter:SetPos(nColTTF) + oPrinter:TextOut(IIF(aFonts[x,3],"Yes","No")) + oPrinter:SetPos(nColCharSet) + oPrinter:TextOut(STR(aFonts[x,4],5)) + oPrinter:SetPos(oPrinter:LeftMargin, oPrinter:PosY + (oPrinter:CharHeight*2)) + IF oPrinter:PRow() > oPrinter:MaxRow() - 10 // Could use "oPrinter:NewPage()" to start a new page + EXIT + ENDIF + ENDIF + ENDIF + oPrinter:Line(0, oPrinter:PosY+5, 2000, oPrinter:PosY+5) + NEXT x + oPrinter:SetFont("Lucida Console",8,{3,-50}) // Alternative Compressed print + oPrinter:CharSet(0) // Reset default charset + oPrinter:Bold(800) + oPrinter:NewLine() + oPrinter:TextOut("This is on line"+STR(oPrinter:Prow(),4)+", Printed bold, " ) + oPrinter:TextOut(" finishing at Column: ") + oPrinter:TextOut(STR(oPrinter:Pcol(),4)) + oPrinter:SetPrc(oPrinter:Prow()+3, 0) + oPrinter:Bold(0) + oPrinter:TextOut("Notice: UNDERLINE only prints correctly if there is a blank line after",.T.) + oPrinter:TextOut(" it. This is because of ::LineHeight and the next line",.T.) + oPrinter:TextOut(" printing over top of the underline. To avoid this happening",.T.) + oPrinter:TextOut(" you can to alter ::LineHeight or use a smaller font") + oPrinter:NewLine() + oPrinter:NewLine() + oPrinter:SetFont("Lucida Console",18, 0) // Large print + oPrinter:SetColor( GREEN ) + oPrinter:TextOut("Finally some larger print") + oPrinter:Box( 0, oPrinter:PosY+100, 100, oPrinter:PosY+200) + oPrinter:Arc(200, oPrinter:PosY+100, 300, oPrinter:PosY+200) + oPrinter:Ellipse(400, oPrinter:PosY+100, 500, oPrinter:PosY+200) + oPrinter:FillRect(600, oPrinter:PosY+100, 700, oPrinter:PosY+200, RED) + +// To print a barcode; +// Replace 'BCod39HN' with your own bar code font or any other font +// oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(60 ), "1234567890", "BCod39HN", 24, 0 ) +// + PrintBitMap( oPrinter, cBMPFile ) + + oPrinter:EndDoc() + ENDIF + oPrinter:Destroy() + ENDIF - // Note: Can also use this method to print bitmap - // oBmp:Rect:= { 200,2000, 2000, 1500 } - // oPrn:DrawBitMap( oBmp ) + RETURN - ENDIF - oBMP:Destroy() - ENDIF - RETURN +STATIC PROCEDURE PrintBitMap( oPrn, cBitFile ) + LOCAL oBMP + + IF Empty( cBitFile ) + * + ELSEIF !File( cBitFile ) + Alert( cBitFile + " not found " ) + ELSE + oBMP := Win32BMP():New() + IF oBmp:loadFile( cBitFile ) + + oBmp:Draw( oPrn, { 200, 200, 2000, 1500 } ) + + // Note: Can also use this method to print bitmap + // oBmp:Rect := { 200, 200, 2000, 1500 } + // oPrn:DrawBitMap( oBmp ) + + ENDIF + oBMP:Destroy() + ENDIF + RETURN diff --git a/harbour/doc/howtosvn.txt b/harbour/doc/howtosvn.txt index f13dd7344b..6321551547 100644 --- a/harbour/doc/howtosvn.txt +++ b/harbour/doc/howtosvn.txt @@ -185,5 +185,6 @@ by SVN server to full length. Note that last dollar sign is mandatory. -Run this command and commit: +Run these commands and commit: svn propset svn:keywords Id "filename" +svn propset svn:eol-style native "filename" diff --git a/harbour/lib/b16/empty b/harbour/lib/b16/empty deleted file mode 100644 index c6cac69265..0000000000 --- a/harbour/lib/b16/empty +++ /dev/null @@ -1 +0,0 @@ -empty diff --git a/harbour/obj/b16/empty b/harbour/obj/b16/empty deleted file mode 100644 index c6cac69265..0000000000 --- a/harbour/obj/b16/empty +++ /dev/null @@ -1 +0,0 @@ -empty diff --git a/harbour/source/common/hbfsapi.c b/harbour/source/common/hbfsapi.c index aba9621eba..be868362f9 100644 --- a/harbour/source/common/hbfsapi.c +++ b/harbour/source/common/hbfsapi.c @@ -211,7 +211,7 @@ HB_EXPORT PHB_FNAME hb_fsFNameSplit( const char * pszFileName ) /* This function joins path, name and extension into a string with a filename */ HB_EXPORT char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName ) { - static char szPathSep[] = {OS_PATH_DELIMITER,0}; /* see NOTE below */ + static char s_szPathSep[] = { OS_PATH_DELIMITER, 0 }; /* see NOTE below */ char * pszName; HB_TRACE(HB_TR_DEBUG, ("hb_fsFNameMerge(%p, %p)", pszFileName, pFileName)); @@ -229,9 +229,9 @@ HB_EXPORT char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName ) hb_strncat( pszFileName, pFileName->szPath, _POSIX_PATH_MAX - 1 ); /* - NOTE: be _very_ careful about 'optimising' this next section code! - (specifically, initialising szPathSep) as MSVC with /Ni - (or anything that infers it like /Ox) will cause you trouble. + NOTE: be _very_ careful about "optimizing" this next section code! + (specifically, initialising s_szPathSep) as MSVC with /Ni + (or anything that infers it like /Ox) will cause you trouble. */ /* If we have a path, append a path separator to the path if there @@ -243,13 +243,13 @@ HB_EXPORT char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName ) if( strchr( OS_PATH_DELIMITER_LIST, pszFileName[ iLen ] ) == NULL ) { /* - char szPathSep[2]; + char s_szPathSep[ 2 ]; - szPathSep[ 0 ] = OS_PATH_DELIMITER; - szPathSep[ 1 ] = '\0'; + s_szPathSep[ 0 ] = OS_PATH_DELIMITER; + s_szPathSep[ 1 ] = '\0'; */ - hb_strncat( pszFileName, szPathSep, _POSIX_PATH_MAX - 1 ); + hb_strncat( pszFileName, s_szPathSep, _POSIX_PATH_MAX - 1 ); } } @@ -279,6 +279,8 @@ HB_EXPORT char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName ) HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName ) { + HB_TRACE(HB_TR_DEBUG, ("hb_fsFileExists(%p)", pszFileName)); + if( pszFileName == NULL ) return FALSE; @@ -307,8 +309,6 @@ HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName ) } #else { - HB_SYMBOL_UNUSED( pszFileName ); - return FALSE; } #endif diff --git a/harbour/source/compiler/hbusage.c b/harbour/source/compiler/hbusage.c index 87ab3e9eb9..2584c442c9 100644 --- a/harbour/source/compiler/hbusage.c +++ b/harbour/source/compiler/hbusage.c @@ -220,6 +220,6 @@ void hb_compPrintLogo( HB_COMP_DECL ) hb_compOutStd( HB_COMP_PARAM, szVer ); hb_compOutStd( HB_COMP_PARAM, - "\nCopyright 1999-2007, http://www.harbour-project.org/\n" ); + "\nCopyright (c) 1999-2007, http://www.harbour-project.org/\n" ); hb_xfree( szVer ); }