From 59700401f3ffb81cfc273400e6348f02be679e92 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 27 May 2009 11:23:36 +0000 Subject: [PATCH] 2009-05-27 13:23 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbwin/win_prn2.c * Cleaned hb_parcx() vs. hb_parc() usage in one function. (hb_parcx() is only needed if there is no preceding HB_ISCHAR() check. If there is hb_parc() will also always return a valid pointer). + contrib/hbwin/tests/testprn2.prg + Added raw printing test. --- harbour/ChangeLog | 10 ++++++ harbour/contrib/hbwin/tests/testprn2.prg | 40 ++++++++++++++++++++++++ harbour/contrib/hbwin/win_prn2.c | 6 ++-- 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 harbour/contrib/hbwin/tests/testprn2.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 51cec1b10e..cd29527dd2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,16 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-27 13:23 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/hbwin/win_prn2.c + * Cleaned hb_parcx() vs. hb_parc() usage in one function. + (hb_parcx() is only needed if there is no preceding HB_ISCHAR() + check. If there is hb_parc() will also always return a valid + pointer). + + + contrib/hbwin/tests/testprn2.prg + + Added raw printing test. + 2009-05-27 12:59 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg % -undef/-D Harbour options will be reduced in cross-compilation diff --git a/harbour/contrib/hbwin/tests/testprn2.prg b/harbour/contrib/hbwin/tests/testprn2.prg new file mode 100644 index 0000000000..a938355707 --- /dev/null +++ b/harbour/contrib/hbwin/tests/testprn2.prg @@ -0,0 +1,40 @@ +/* + * $Id$ + */ + +PROCEDURE Main() + LOCAL nPrn := 1 + LOCAL cFileName := Space( 40 ) + LOCAL aPrn := GetPrinters() + LOCAL GetList := {} + + CLS + + IF Empty( aPrn ) + Alert("No printers installed - Cannot continue") + QUIT + ENDIF + + DO WHILE nPrn != 0 + CLS + @ 0, 0 SAY "PrintFileRaw() test program. Choose a printer to test" + @ 1, 0 SAY "File name" GET cFileName 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 ], cFileName ) + ENDIF + ENDDO + + RETURN + +STATIC PROCEDURE PrnTest( cPrinter, cFileName ) + + IF Empty( cFileName ) + hb_MemoWrit( cFileName := "_hbtest.prn", "Hello World!" + Chr( 12 ) ) + ENDIF + + Alert( PrintFileRaw( cPrinter, cFileName, "testing raw printing" ) ) + + RETURN diff --git a/harbour/contrib/hbwin/win_prn2.c b/harbour/contrib/hbwin/win_prn2.c index 2d3e98794e..72047ce91c 100644 --- a/harbour/contrib/hbwin/win_prn2.c +++ b/harbour/contrib/hbwin/win_prn2.c @@ -481,9 +481,9 @@ HB_FUNC( PRINTFILERAW ) LONG Result = -1; if( ISCHAR( 1 ) && ISCHAR( 2 ) ) - Result = hb_PrintFileRaw( ( UCHAR * ) hb_parcx( 1 ) /* cPrinterName */, - ( UCHAR * ) hb_parcx( 2 ) /* cFileName */, - ISCHAR( 3 ) ? ( UCHAR * ) hb_parcx( 3 ) : ( UCHAR * ) hb_parcx( 2 ) /* cDocName */ ); + Result = hb_PrintFileRaw( ( UCHAR * ) hb_parc( 1 ) /* cPrinterName */, + ( UCHAR * ) hb_parc( 2 ) /* cFileName */, + ISCHAR( 3 ) ? ( UCHAR * ) hb_parc( 3 ) : ( UCHAR * ) hb_parc( 2 ) /* cDocName */ ); hb_retnl( Result ); }