diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 71a8d1fe65..4715cc7fac 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-10-23 13:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + + contrib/libnf/ftisprn.c + + contrib/libnf/setkeys.c + + contrib/libnf/setlastk.c + * contrib/libnf/Makefile + * contrib/libnf/makefile.bc + * contrib/libnf/makefile.vc + * contrib/libnf/readme.txt + + Added FT_SETKEYS(), FT_ISPRINTER() (not 100% compatible + in all situations), FT_LASTKEY(). + 2007-10-23 13:30 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/directx/w32_ddrw.cpp * contrib/directx/w32_ddrw.h diff --git a/harbour/contrib/libnf/Makefile b/harbour/contrib/libnf/Makefile index d4a9731a2a..0adb4088a7 100644 --- a/harbour/contrib/libnf/Makefile +++ b/harbour/contrib/libnf/Makefile @@ -14,6 +14,7 @@ C_SOURCES = \ dispc.c \ ftattr.c \ ftidle.c \ + ftisprn.c \ fttext.c \ ftshadow.c \ getenvrn.c \ @@ -30,6 +31,8 @@ C_SOURCES = \ prtscr.c \ putkey.c \ rmdir.c \ + setkeys.c \ + setlastk.c \ shift.c \ stod.c \ diff --git a/harbour/contrib/libnf/ftisprn.c b/harbour/contrib/libnf/ftisprn.c new file mode 100644 index 0000000000..a95173523f --- /dev/null +++ b/harbour/contrib/libnf/ftisprn.c @@ -0,0 +1,151 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * FT_ISPRINT() + * + * Copyright 1999-2007 Viktor Szakats + * www - http://www.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. + * +*/ + +/* File......: ISPRINT.ASM +* Author....: Ted Means +* CIS ID....: 73067,3332 +* +* This function is an original work by Ted Means and is placed in the +* public domain. I got the idea from Norm Mongeau, but the code is +* all mine. +* +* Modification history: +* --------------------- +* +* Rev 1.3 16 Jul 1993 00:00:18 GLENN +* Modified for compatibility in protected mode under ExoSpace. Should +* work in real mode as well. +* +* Rev 1.2 15 Aug 1991 23:07:56 GLENN +* Forest Belt proofread/edited/cleaned up doc +* +* Rev 1.1 14 Jun 1991 19:54:38 GLENN +* Minor edit to file header +* +* Rev 1.0 01 Apr 1991 01:03:26 GLENN +* Nanforum Toolkit +* +*/ + + +/* $DOC$ +* $FUNCNAME$ +* FT_ISPRINT() +* $CATEGORY$ +* DOS/BIOS +* $ONELINER$ +* Check printer status +* $SYNTAX$ +* FT_ISPRINT( [ ] ) -> lResult +* $ARGUMENTS$ +* is optional and is the device to test (LPT2, COM1, etc.). +* If omitted, the function will default to the PRN device. +* $RETURNS$ +* .T. if device is ready for output. +* .F. if one of the following conditions occurs: +* 1) The device is not ready. +* 2) The device does not exist. +* 3) DOS couldn't open the device for some reason +* (such as no file handles available). +* $DESCRIPTION$ +* The Clipper IsPrinter() function is somewhat limited because it only +* works with LPT1. Furthermore, it talks directly to the hardware, so +* if you have redirected LPT1 via the DOS MODE command, the IsPrinter() +* function will return erroneous results. +* +* This function offers a better alternative. Instead of talking to the +* hardware, it issues a DOS call that checks to see if the device is +* ready or not. That gives DOS an opportunity to deal with any +* redirections, and since you pass the device name as a parameter, you +* can test any device, not just LPT1 (note that the function defaults +* to PRN if you fail to pass a valid parameter). +* +* The function also temporarily traps the DOS critical error handler so +* you don't get any nasty error messages if the device isn't ready. It +* restores the old critical error handler before exiting. +* +* Note that although this function is mainly designed for testing +* printers, you can also check to see if a drive is ready. Since DOS +* thinks the NUL device exists on every drive, you can pass a drive +* letter followed by NUL as a parameter. If DOS is able to open the +* NUL device, then the drive is ready, otherwise the door is open or +* something else is wrong. +* +* The source code is written to adhere to Turbo Assembler's IDEAL mode. +* To use another assembler, you will need to rearrange the PROC and +* SEGMENT directives, and also the ENDP and ENDS directives (a very +* minor task). +* $EXAMPLES$ +* IF ! FT_ISPRINT() +* Qout( "PRN is not ready!" ) +* ENDIF +* +* IF ! FT_ISPRINT( "COM2" ) +* Qout( "Check the device on COM2. Something is wrong." ) +* ENDIF +* +* IF ! FT_ISPRINT( "A:\NUL" ) +* Qout( "Oops, better check drive A!" ) +* ENDIF +* $END$ +*/ + +#include "hbapi.h" + +/* TOFIX: Has different behaviour depending on platform/parameter. [vszakats] */ + +HB_FUNC_EXTERN( HB_ISPRINT ); + +HB_FUNC( FT_ISPRINT ) +{ + HB_FUNC_EXEC( HB_ISPRINT ) +} diff --git a/harbour/contrib/libnf/makefile.bc b/harbour/contrib/libnf/makefile.bc index 8df793c0f1..24f76466e0 100644 --- a/harbour/contrib/libnf/makefile.bc +++ b/harbour/contrib/libnf/makefile.bc @@ -201,8 +201,11 @@ NANFOR_LIB_OBJ = \ $(OBJ_DIR)\getver.obj \ $(OBJ_DIR)\ftattr.obj \ $(OBJ_DIR)\dispc.obj \ + $(OBJ_DIR)\setkeys.obj \ + $(OBJ_DIR)\setlastk.obj \ $(OBJ_DIR)\iamidle.obj \ $(OBJ_DIR)\ftidle.obj \ + $(OBJ_DIR)\ftisprn.obj \ $(OBJ_DIR)\fttext.obj \ $(OBJ_DIR)\ftshadow.obj \ $(OBJ_DIR)\putkey.obj @@ -926,6 +929,18 @@ $(OBJ_DIR)\getver.obj : getver.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(NANFOR_LIB) $(ARFLAGS) -+$@,, +$(OBJ_DIR)\setkeys.obj : setkeys.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(NANFOR_LIB) $(ARFLAGS) -+$@,, + +$(OBJ_DIR)\setlastk.obj : setlastk.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(NANFOR_LIB) $(ARFLAGS) -+$@,, + +$(OBJ_DIR)\ftisprn.obj : ftisprn.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(NANFOR_LIB) $(ARFLAGS) -+$@,, + $(OBJ_DIR)\ftidle.obj : ftidle.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(NANFOR_LIB) $(ARFLAGS) -+$@,, diff --git a/harbour/contrib/libnf/makefile.vc b/harbour/contrib/libnf/makefile.vc index 659e2a1724..91aa39c87d 100644 --- a/harbour/contrib/libnf/makefile.vc +++ b/harbour/contrib/libnf/makefile.vc @@ -118,6 +118,9 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\shift.obj \ $(OBJ_DIR)\mouse.obj \ $(OBJ_DIR)\getvid.obj \ + $(OBJ_DIR)\setkeys.obj \ + $(OBJ_DIR)\setlastk.obj \ + $(OBJ_DIR)\ftisprn.obj \ $(OBJ_DIR)\ftidle.obj \ $(OBJ_DIR)\iamidle.obj \ $(OBJ_DIR)\chdir.obj \ @@ -260,6 +263,9 @@ CLEAN: -@if exist $(OBJ_DIR)\shift.obj del $(OBJ_DIR)\shift.obj -@if exist $(OBJ_DIR)\mouse.obj del $(OBJ_DIR)\mouse.obj -@if exist $(OBJ_DIR)\getvid.obj del $(OBJ_DIR)\getvid.obj + -@if exist $(OBJ_DIR)\setkeys.obj del $(OBJ_DIR)\setkeys.obj + -@if exist $(OBJ_DIR)\setlastk.obj del $(OBJ_DIR)\setlastk.obj + -@if exist $(OBJ_DIR)\ftisprn.obj del $(OBJ_DIR)\ftisprn.obj -@if exist $(OBJ_DIR)\ftidle.obj del $(OBJ_DIR)\ftidle.obj -@if exist $(OBJ_DIR)\iamidle.obj del $(OBJ_DIR)\iamidle.obj -@if exist $(OBJ_DIR)\chdir.obj del $(OBJ_DIR)\chdir.obj diff --git a/harbour/contrib/libnf/readme.txt b/harbour/contrib/libnf/readme.txt index bb59c1b94f..dda597febe 100644 --- a/harbour/contrib/libnf/readme.txt +++ b/harbour/contrib/libnf/readme.txt @@ -8,30 +8,17 @@ This library has been ported to Harbour by Luiz Rafael Culik The follow functions must be rewrite in C asm\ADAPTER.ASM ; FT_ADAPTER() asm\DEFAULT.ASM ; FT_DEFAULT() -asm\IAMIDLE.ASM ; FT_IAmIdle() asm\INP.ASM ; FT_INP() -asm\ISPRINT.ASM ; FT_ISPRINT() asm\OUTP.ASM ; FT_OUTP() -asm\PUTKEY.ASM ; FT_PUTKEY() asm\REBOOT.ASM ; FT_REBOOT() asm\RESTATT.ASM ; FT_RESTATT() asm\SAVEATT.ASM ; FT_SAVEATT() -asm\SETKEYS.ASM ; FT_SETKEYS() -asm\SETLASTK.ASM ; FT_LASTKEY() -asm\SHADOW.ASM ; FT_SHADOW() - -//TOFIX The follow functions need to be fixed. -CINT86.C ; FT_INT86() - - This function is Called from many prg source code -fttext.c - I never could compiler this file under BCC +CINT86.C ; FT_INT86() The follow functions Need that FT_INT86() been fixed or writed a "C" Wrapper - SETDATE.PRG FT_SETDATE() SETTIME.PRG FT_SETTIME() SYSMEM.PRG FT_SYSMEM() diff --git a/harbour/contrib/libnf/setkeys.c b/harbour/contrib/libnf/setkeys.c new file mode 100644 index 0000000000..83ab11c099 --- /dev/null +++ b/harbour/contrib/libnf/setkeys.c @@ -0,0 +1,112 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * FT_SETKEYS() + * + * Copyright 1999-2007 Viktor Szakats + * www - http://www.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. + * +*/ + +/* File......: SETLASTK.ASM +* Author....: Ted Means +* CIS ID....: 73067,3332 +* +* This is an original work by Ted Means and is placed in the +* public domain. +* +* Modification history: +* --------------------- +* +* Rev 1.0 01 Jul 1992 01:23:06 GLENN +* Initial revision. +* +*/ + +/* $DOC$ +* $FUNCNAME$ +* FT_LASTKEY() +* $CATEGORY$ +* Keyboard/Mouse +* $ONELINER$ +* Force LastKey() to return a programmer-defined value. +* $SYNTAX$ +* FT_LastKey( ) -> NIL +* $ARGUMENTS$ +* is the Inkey() value of the desired key. +* $RETURNS$ +* NIL +* $DESCRIPTION$ +* It is occasionally useful to force LastKey() to return a known value. +* This is easily accomplishing by using the KEYBOARD command, but this +* has undesireable side effects (the keyboard buffer is cleared, and +* the keystroke is processed whether you needed it to be or not). This +* function accomplishes the same task but without the side effects. It +* does so by directly modifying the memory location where Clipper stores +* the LastKey() value. +* +* Some highly unorthodox programming techniques, not to mention rather +* strange use of Clipper internals, was necessary to make this function +* work. If this makes you uncomfortable, then don't use this function, +* you worthless crybaby. +* $EXAMPLES$ +* keyboard chr( K_ESC ) +* +* ? lastkey() // returns 27 +* +* FT_LastKey( K_F1 ) +* +* ? lastkey() // now returns 28 +* $END$ +*/ + +#include "hbapi.h" + +HB_FUNC_EXTERN( HB_SETKEYSAVE ); + +HB_FUNC( FT_SETKEYS ) +{ + HB_FUNC_EXEC( HB_SETKEYSAVE ) +} diff --git a/harbour/contrib/libnf/setlastk.c b/harbour/contrib/libnf/setlastk.c new file mode 100644 index 0000000000..880b5597b8 --- /dev/null +++ b/harbour/contrib/libnf/setlastk.c @@ -0,0 +1,112 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * FT_LASTKEY() + * + * Copyright 1999-2007 Viktor Szakats + * www - http://www.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. + * +*/ + +/* File......: SETLASTK.ASM +* Author....: Ted Means +* CIS ID....: 73067,3332 +* +* This is an original work by Ted Means and is placed in the +* public domain. +* +* Modification history: +* --------------------- +* +* Rev 1.0 01 Jul 1992 01:23:06 GLENN +* Initial revision. +* +*/ + +/* $DOC$ +* $FUNCNAME$ +* FT_LASTKEY() +* $CATEGORY$ +* Keyboard/Mouse +* $ONELINER$ +* Force LastKey() to return a programmer-defined value. +* $SYNTAX$ +* FT_LastKey( ) -> NIL +* $ARGUMENTS$ +* is the Inkey() value of the desired key. +* $RETURNS$ +* NIL +* $DESCRIPTION$ +* It is occasionally useful to force LastKey() to return a known value. +* This is easily accomplishing by using the KEYBOARD command, but this +* has undesireable side effects (the keyboard buffer is cleared, and +* the keystroke is processed whether you needed it to be or not). This +* function accomplishes the same task but without the side effects. It +* does so by directly modifying the memory location where Clipper stores +* the LastKey() value. +* +* Some highly unorthodox programming techniques, not to mention rather +* strange use of Clipper internals, was necessary to make this function +* work. If this makes you uncomfortable, then don't use this function, +* you worthless crybaby. +* $EXAMPLES$ +* keyboard chr( K_ESC ) +* +* ? lastkey() // returns 27 +* +* FT_LastKey( K_F1 ) +* +* ? lastkey() // now returns 28 +* $END$ +*/ + +#include "hbapi.h" + +HB_FUNC_EXTERN( HB_SETLASTKEY ); + +HB_FUNC( FT_LASTKEY ) +{ + HB_FUNC_EXEC( HB_SETLASTKEY ) +}