From b586360129ceca373a7b7f523fac4c18af5f4092 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 17 Oct 2012 08:26:43 +0000 Subject: [PATCH] 2012-10-17 10:23 UTC+0200 Viktor Szakats (harbour syenar.net) - tests/hbdocext.prg + tests/hbdocext.hb * renamed to .hb * contrib/hbnf/hbnf.hbp * contrib/hbnf/hbnf.hbx + contrib/hbnf/adapter.prg + added FT_ADAPTER() + contrib/hbnf/doc/en/cint86.txt + added one more missing doc (formatted a bit) * contrib/hbnf/cint86.c ! fixed to return .F. instead of NIL * contrib/hbnf/doc/en/outp.txt * contrib/hbnf/doc/en/prtscr.txt * contrib/hbnf/doc/en/reboot.txt * contrib/hbnf/doc/en/round.txt * formatting. * contrib/hbnf/support.c + added dummy versions of FT_INP(), FT_OUTP(), FT_REBOOT() all returning permanent failure. * contrib/hbnf/readme.txt * updated --- harbour/ChangeLog | 29 ++++ harbour/contrib/hbnf/adapter.prg | 54 +++++++ harbour/contrib/hbnf/cint86.c | 4 +- harbour/contrib/hbnf/doc/en/cint86.txt | 152 ++++++++++++++++++++ harbour/contrib/hbnf/doc/en/outp.txt | 6 +- harbour/contrib/hbnf/doc/en/prtscr.txt | 6 +- harbour/contrib/hbnf/doc/en/reboot.txt | 10 +- harbour/contrib/hbnf/doc/en/round.txt | 10 +- harbour/contrib/hbnf/hbnf.hbp | 1 + harbour/contrib/hbnf/hbnf.hbx | 4 + harbour/contrib/hbnf/readme.txt | 6 +- harbour/contrib/hbnf/support.c | 24 ++++ harbour/tests/{hbdocext.prg => hbdocext.hb} | 0 13 files changed, 283 insertions(+), 23 deletions(-) create mode 100644 harbour/contrib/hbnf/adapter.prg create mode 100644 harbour/contrib/hbnf/doc/en/cint86.txt rename harbour/tests/{hbdocext.prg => hbdocext.hb} (100%) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d981f0625f..f8644fa056 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,35 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-17 10:23 UTC+0200 Viktor Szakats (harbour syenar.net) + - tests/hbdocext.prg + + tests/hbdocext.hb + * renamed to .hb + + * contrib/hbnf/hbnf.hbp + * contrib/hbnf/hbnf.hbx + + contrib/hbnf/adapter.prg + + added FT_ADAPTER() + + + contrib/hbnf/doc/en/cint86.txt + + added one more missing doc (formatted a bit) + + * contrib/hbnf/cint86.c + ! fixed to return .F. instead of NIL + + * contrib/hbnf/doc/en/outp.txt + * contrib/hbnf/doc/en/prtscr.txt + * contrib/hbnf/doc/en/reboot.txt + * contrib/hbnf/doc/en/round.txt + * formatting. + + * contrib/hbnf/support.c + + added dummy versions of FT_INP(), FT_OUTP(), FT_REBOOT() + all returning permanent failure. + + * contrib/hbnf/readme.txt + * updated + 2012-10-17 09:56 UTC+0200 Viktor Szakats (harbour syenar.net) * utils/hbmk2/hbmk2.prg + added note about the requirement of GPL license next to all diff --git a/harbour/contrib/hbnf/adapter.prg b/harbour/contrib/hbnf/adapter.prg new file mode 100644 index 0000000000..da898942b1 --- /dev/null +++ b/harbour/contrib/hbnf/adapter.prg @@ -0,0 +1,54 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * FT_ADAPTER() + * + * Copyright 2012 Viktor Szakats (harbour syenar.net) + * 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. + * + */ + +FUNCTION FT_ADAPTER() + RETURN iif( IsColor(), 3 /* VGA */, 0 /* monochrome */ ) diff --git a/harbour/contrib/hbnf/cint86.c b/harbour/contrib/hbnf/cint86.c index 9e529a4cbe..190118560d 100644 --- a/harbour/contrib/hbnf/cint86.c +++ b/harbour/contrib/hbnf/cint86.c @@ -4,10 +4,10 @@ #include "hbapi.h" -/* TODO */ - HB_FUNC( FT_INT86 ) { #if defined( HB_OS_DOS ) + /* TODO */ #endif + hb_retl( HB_FALSE ); } diff --git a/harbour/contrib/hbnf/doc/en/cint86.txt b/harbour/contrib/hbnf/doc/en/cint86.txt new file mode 100644 index 0000000000..2ba2a14291 --- /dev/null +++ b/harbour/contrib/hbnf/doc/en/cint86.txt @@ -0,0 +1,152 @@ +/* + * $Id$ + */ + +/* $DOC$ + * $FUNCNAME$ + * FT_INT86() + * $CATEGORY$ + * DOS/BIOS + * $ONELINER$ + * Execute a software interrupt + * $SYNTAX$ + * FT_INT86( , ) -> lResult + * $ARGUMENTS$ + * is the interrupt to execute. + * + * is an array that contains values to be loaded + * into the various CPU registers. The correspondence between + * registers and array elements is as follows: + * + * aElement[1] == AX register + * aElement[2] == BX register + * aElement[3] == CX register + * aElement[4] == DX register + * aElement[5] == SI register + * aElement[6] == DI register + * aElement[7] == BP register + * aElement[8] == DS register + * aElement[9] == ES register + * aElement[10] == Flags register + * $RETURNS$ + * .T. if all parameters valid and the function was able + * to execute the desired interrupt. + * .F. if invalid parameters passed. If you call this function in + * protected mode, .F. may also be returned if an allocation + * of low DOS memory fails. + * + * n addition, the array elements will contain whatever values were in + * he CPU registers immediately after the interrupt was executed. If + * ither of the string parameters were altered by the interrupt, these + * hanges will be reflected as well. + * $DESCRIPTION$ + * It is occasionally useful to be able to call interrupts directly from + * Clipper, without having to write a separate routine in C or ASM. This + * function allows you that capability. + * + * Given Clipper's high-level orientation, this function is necessarily + * somewhat messy to use. First, declare an array of ten elements to + * hold the eight values for the CPU registers and two string parameters. + * Then initialize the array elements with the values that you want the + * CPU registers to contain when the interrupt is executed. You need not + * initialize all the elements. For example, if the interrupt requires + * you to specify values for AX, DX, and DS, you would only need to + * initialize elements 1, 4, and 8. + * + * Once you have done the required register setup, call FT_INT86(), + * passing the interrupt number and the register array as parameters. + * The function will load the CPU with your specified values, execute the + * interrupt, and then store the contents of the CPU registers back into + * your array. This will allow you to evaluate the results of the + * interrupt. + * + * Some interrupt services require you to pass the address of a string in + * a pair of registers. This function is capable of handling these sorts + * of situations, but it will take a little work on your part. If you need + * to pass a string that uses the DS register, store the string in element + * 8; if you need to pass a string that uses the ES register, store the + * string in element 9. FT_INT86() will detect that you've supplied a + * string instead of a numeric value and will behave accordingly. + * + * That takes care of obtaining the segment portion of the pointer. To + * specify which register is to contain the offset, use the values REG_DS + * and REG_ES which are defined in the FTINT86.CH file. When one of these + * values is found in an array element, it alerts FT_Int86() to use the + * offset portion of a pointer instead of a numeric value. REG_DS tells + * FT_Int86() to use the offset of the string in element 8, while REG_ES + * tells FT_Int86() to use the offset of the string in element 9. + * + * All the CPU registers are sixteen bits in size. Some, however, are + * also split into two 8-bit registers. This function is only capable of + * receiving and returning registers that are 16 bits in size. To split + * a 16-bit register into two 8-bit values, you can use the + * pseudo-functions HighByte() and LowByte(), contained in the .CH file. + * + * To alter an 8-bit number so it will appear in the high-order byte of a + * register when passed to the FT_INT86() function, use the MakeHI() + * pseudo-function contained in the .CH file. + * + * When run in real mode, this function is a shell for __ftint86(), + * which is written in assembler and does the actual work of executing + * the interrupt. __ftint86() is callable from C, so feel free to + * incorporate it into any C routines for which it might be useful. The + * source for __ftint86() can be found in the file AINT86.ASM. + * + * When run in protected mode, this function is a shell for cpmiInt86(), + * which is written in assembler and makes a DPMI call to drop into + * real mode and execute the interrupt. cpmiInt86() is also callable + * from C, so feel free to incorporate it into any C routines for which + * it might be useful. cpmiInt86() is part of the CPMI API. See the + * CPMI documentation for more information. + * $EXAMPLES$ + * * This example shows how to call the DOS "create file" service. Take + * * special note of how to set up string parameters. + * + * #include "ftint86.ch" + * + * LOCAL aRegs[ 10 ] // Declare the register array + * aRegs[ AX ] := makehi( 60 ) // DOS service, create file + * aRegs[ CX ] := 0 // Specify file attribute + * + * * Pay attention here, this is crucial. Note how to set up the string + * * so it appears in DS:DX. + * + * aRegs[ DS ] := "C:\MISC\MYFILE.XXX" + * aRegs[ DX ] := REG_DS + * FT_INT86( 33, aRegs ) // Make the call to the DOS interrupt + * + * + * * This example shows how to call the DOS "get current directory" + * * service. This one also uses a string parameter, but note that it + * * uses a different offset register. + * + * #include "ftint86.ch" + * + * LOCAL aRegs[ 10 ] + * aRegs[ AX ] := makehi( 71 ) + * aRegs[ DX ] := 0 // Choose default drive + * + * * This service requires a 64-byte buffer whose address is in DS:SI. DOS + * * will fill the buffer with the current directory. + * + * aRegs[ DS ] := Space( 64 ) + * aRegs[ SI ] := REG_DS + * FT_INT86( 33, aRegs ) + * + * ? aRegs[ DS ] // Display the directory name + * + * + * + * * For the sake of completeness, here's an example that doesn't use a + * * string. This one changes the video mode. + * + * #include "ftint86.ch" + * + * LOCAL aRegs[ 10 ] + * + * aRegs[ AX ] := 16 // Choose hi-res graphics + * FT_INT86( 16, aRegs ) + * $INCLUDE$ + * ftint86.ch + * $END$ + */ diff --git a/harbour/contrib/hbnf/doc/en/outp.txt b/harbour/contrib/hbnf/doc/en/outp.txt index d45800dfa3..3eeea42038 100644 --- a/harbour/contrib/hbnf/doc/en/outp.txt +++ b/harbour/contrib/hbnf/doc/en/outp.txt @@ -13,7 +13,7 @@ * FT_OUTP( , ) -> lResult * $ARGUMENTS$ * is the port from which to retrieve the byte. - * + * * is the value between 0 and 255 to write to the port. * $RETURNS$ * .T. if all parameters were valid and the byte was written to @@ -22,13 +22,13 @@ * $DESCRIPTION$ * It may sometimes be useful to write a byte to a port without having * to resort to C or assembler. This function allows you to do so. - * + * * 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$ - * lOk := FT_OUTP( 100, 0 ) // send a Chr(0) to port 100 (064h) + * lOk := FT_OUTP( 100, 0 ) // send a Chr( 0 ) to port 100 (064h) * $SEEALSO$ * FT_INP() * $END$ diff --git a/harbour/contrib/hbnf/doc/en/prtscr.txt b/harbour/contrib/hbnf/doc/en/prtscr.txt index d1a0442d0a..d3d0cbf5af 100644 --- a/harbour/contrib/hbnf/doc/en/prtscr.txt +++ b/harbour/contrib/hbnf/doc/en/prtscr.txt @@ -22,9 +22,9 @@ * a printscreen is already in progress. The BIOS will then refuse * to invoke the printscreen handler. * $EXAMPLES$ - * FT_PRTSCR( .F. ) && Disable the printscreen key - * FT_PRTSCR( .T. ) && Enable the printscreen key - * MemVar := FT_PRTSCR() && Get the current status + * FT_PRTSCR( .F. ) // Disable the printscreen key + * FT_PRTSCR( .T. ) // Enable the printscreen key + * MemVar := FT_PRTSCR() // Get the current status * $SEEALSO$ * FT_CAPLOCK() FT_CTRL() FT_NUMLOCK() FT_SHIFT() FT_ALT() * $END$ diff --git a/harbour/contrib/hbnf/doc/en/reboot.txt b/harbour/contrib/hbnf/doc/en/reboot.txt index 22b9b81ddf..998cc7c73f 100644 --- a/harbour/contrib/hbnf/doc/en/reboot.txt +++ b/harbour/contrib/hbnf/doc/en/reboot.txt @@ -20,7 +20,7 @@ * This function is valuable if you need to reboot the PC for some * reason; e.g. an installation routine that modifies CONFIG.SYS or * AUTOEXEC.BAT. - * + * * 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 @@ -28,10 +28,10 @@ * $EXAMPLES$ * #define COLD 0 * #define WARM 1 - * + * * // Issue a warm boot - * - * FT_Reboot(WARM) - * + * + * FT_Reboot( WARM ) + * * $END$ */ diff --git a/harbour/contrib/hbnf/doc/en/round.txt b/harbour/contrib/hbnf/doc/en/round.txt index e56379f4a0..57e87b7718 100644 --- a/harbour/contrib/hbnf/doc/en/round.txt +++ b/harbour/contrib/hbnf/doc/en/round.txt @@ -49,18 +49,18 @@ * c. Amount (100's, 5 decimals, 16th, etc.) * $EXAMPLES$ * // round normal to 2 decimal places - * nDollars := FT_ROUND(nDollars) + * nDollars := FT_ROUND( nDollars ) * * // round normal to 6 decimal places - * nIntRate := FT_ROUND(nIntRate, 6) + * nIntRate := FT_ROUND( nIntRate, 6 ) * * // round to nearest thousands - * nPrice := FT_ROUND(nPrice, 3, NEAREST_WHOLE_NUMBER) + * nPrice := FT_ROUND( nPrice, 3, NEAREST_WHOLE_NUMBER ) * * // round Up to nearest third - * nAmount := FT_ROUND(nAmount, 3, NEAREST_FRACTION, ROUND_UP) + * nAmount := FT_ROUND( nAmount, 3, NEAREST_FRACTION, ROUND_UP ) * * // round down to 3 decimals Within .005 - * nAvg := FT_ROUND(nAvg, 3, , ROUND_DOWN, .005) + * nAvg := FT_ROUND( nAvg, 3, , ROUND_DOWN, .005 ) * $END$ */ diff --git a/harbour/contrib/hbnf/hbnf.hbp b/harbour/contrib/hbnf/hbnf.hbp index 5dce574c2a..36385f8740 100644 --- a/harbour/contrib/hbnf/hbnf.hbp +++ b/harbour/contrib/hbnf/hbnf.hbp @@ -59,6 +59,7 @@ acctmnth.prg acctqtr.prg acctweek.prg acctyear.prg +adapter.prg adessort.prg aemaxlen.prg aeminlen.prg diff --git a/harbour/contrib/hbnf/hbnf.hbx b/harbour/contrib/hbnf/hbnf.hbx index d6de267a18..24e6e8e435 100644 --- a/harbour/contrib/hbnf/hbnf.hbx +++ b/harbour/contrib/hbnf/hbnf.hbx @@ -33,6 +33,7 @@ DYNAMIC FT_ACCTMONTH DYNAMIC FT_ACCTQTR DYNAMIC FT_ACCTWEEK DYNAMIC FT_ACCTYEAR +DYNAMIC FT_ADAPTER DYNAMIC FT_ADDER DYNAMIC FT_ADDWKDY DYNAMIC FT_ADESSORT @@ -113,6 +114,7 @@ DYNAMIC FT_GETVPG DYNAMIC FT_HEX2DEC DYNAMIC FT_IAMIDLE DYNAMIC FT_IDLE +DYNAMIC FT_INP DYNAMIC FT_INT86 DYNAMIC FT_INVCLR DYNAMIC FT_ISBIT @@ -174,6 +176,7 @@ DYNAMIC FT_NWSEMWAIT DYNAMIC FT_NWUID DYNAMIC FT_ONTICK DYNAMIC FT_ORIGIN +DYNAMIC FT_OUTP DYNAMIC FT_PCHR DYNAMIC FT_PEEK DYNAMIC FT_PEGS @@ -189,6 +192,7 @@ DYNAMIC FT_PUTKEY DYNAMIC FT_QTR DYNAMIC FT_RAND1 DYNAMIC FT_RAT2 +DYNAMIC FT_REBOOT DYNAMIC FT_RESTARR DYNAMIC FT_RESTATT DYNAMIC FT_RESTSETS diff --git a/harbour/contrib/hbnf/readme.txt b/harbour/contrib/hbnf/readme.txt index fb55d9c8f1..147c788e98 100644 --- a/harbour/contrib/hbnf/readme.txt +++ b/harbour/contrib/hbnf/readme.txt @@ -4,11 +4,7 @@ Functions to be rewritten: -asm\adapter.asm FT_ADAPTER() -asm\inp.asm FT_INP() -asm\outp.asm FT_OUTP() -asm\reboot.asm FT_REBOOT() -c\video1.c FT_VIDSTR(), FT_WRTCHR(), FT_CLS(), FT_SETATTR(), FT_REVATTR(), FT_REVCHR() +c\video1.c FT_VIDSTR(), FT_WRTCHR(), FT_CLS(), FT_REVATTR(), FT_REVCHR() Functions to be fixed: diff --git a/harbour/contrib/hbnf/support.c b/harbour/contrib/hbnf/support.c index c847ef7617..378088acea 100644 --- a/harbour/contrib/hbnf/support.c +++ b/harbour/contrib/hbnf/support.c @@ -115,3 +115,27 @@ HB_FUNC( _FT_TEMPFIL ) hb_itemReturnRelease( pArray ); } } + +HB_FUNC( FT_INP ) +{ +#if defined( HB_OS_DOS ) + /* TODO */ +#endif + hb_retni( 0 ); +} + +HB_FUNC( FT_OUTP ) +{ +#if defined( HB_OS_DOS ) + /* TODO */ +#endif + hb_retl( HB_FALSE ); +} + +HB_FUNC( FT_REBOOT ) +{ +#if defined( HB_OS_DOS ) + /* TODO */ +#endif + hb_ret(); +} diff --git a/harbour/tests/hbdocext.prg b/harbour/tests/hbdocext.hb similarity index 100% rename from harbour/tests/hbdocext.prg rename to harbour/tests/hbdocext.hb