diff --git a/harbour/ChangeLog b/harbour/ChangeLog index aee3e299fe..0ac26fb5d3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,28 @@ +20000326-03:37 GMT+1 Victor Szakats + + - make_tpl.* + - bin/bld_tpl.* + + make_gnu.* + + bin/bld.* + + GNU-make starters renamed to better show their purpose. + + GNU-make starters modified to work like bld_gnu.*, so that they don't + need to be modified, instead they expect the HB_ envvars to be set. Now + they also throw a help screen when something is not set. + + BLD.SH bash script added to build Harbour executables. + + Other small improvements. + + * source/rtl/console.c + % DISPOUT(), DISPOUTAT(), DEVOUT() optimized + % DISPOUTAT() made even more CA-Cl*pper compatible. + ! SETPRC() made even more CA-Cl*pper compatible. + * Some variables renamed. + * source/rtl/box.c + % Small optimization. + * source/rtl/gtapi.c + + s_bInit variable added. + * utils/hbdoc/Makefile + - runner lib removed (again). + 20000325-09:22 EST Paul Tucker * include/hbapigt.h source/rtl/gtcrs/gtcrs.c diff --git a/harbour/bin/bld_tpl.bat b/harbour/bin/bld.bat similarity index 62% rename from harbour/bin/bld_tpl.bat rename to harbour/bin/bld.bat index e98749434f..02d476b2d5 100644 --- a/harbour/bin/bld_tpl.bat +++ b/harbour/bin/bld.bat @@ -14,21 +14,21 @@ rem Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) rem See doc/license.txt for licensing terms. rem --------------------------------------------------------------- -rem set HB_ARCHITECTURE= -rem set HB_COMPILER= -rem set HB_GT_LIB= +rem if "%HB_ARCHITECTURE%" == "" set HB_ARCHITECTURE=dos +rem if "%HB_COMPILER%" == "" set HB_COMPILER=djgpp +rem if "%HB_GT_LIB%" == "" set HB_GT_LIB= :START - if "%HB_ARCHITECTURE%" == "" goto BAD_ARCH - if "%HB_COMPILER%" == "" goto BAD_COMP + if "%HB_ARCHITECTURE%" == "" goto NO_ARCH + if "%HB_COMPILER%" == "" goto NO_COMP if not "%1" == "" goto COMPILE :HELP echo. - echo Usage: bld_tpl.bat filename + echo Usage: bld.bat filename echo. echo Notes: echo. @@ -36,58 +36,68 @@ rem set HB_GT_LIB= echo - Don't forget to make a MAIN() function for you application. echo - This batch file assumes you are in some directory off the main echo harbour directory. - echo - Environment variables HB_ARCHITECTURE, HB_COMPILER, HB_GT_LIB should - echo be set. Setting HB_GT_LIB is optional. + echo - Environment variables HB_ARCHITECTURE, HB_COMPILER, HB_GT_LIB + echo should be set. Setting HB_GT_LIB is optional. echo The following values are currently supported: echo. - echo HB_ARCHITECTURE: - echo - dos (HB_GT_LIB=gtdos by default) - echo - w32 (HB_GT_LIB=gtw32 by default) - echo - linux (HB_GT_LIB=gtstd by default) - echo - os2 (HB_GT_LIB=gtos2 by default) - echo. - pause - echo HB_COMPILER: - echo - When HB_ARCHITECTURE=dos - echo - bcc16 (Borland C++ 3.x, 16-bit DOS) - echo - djgpp (GCC (DJGPP), 32-bit Windows) - echo - watcom - echo - When HB_ARCHITECTURE=w32 - echo - bcc32 (Borland C++ 4.x,5.x, 32-bit Windows) - echo - gcc (GCC (Cygnus), 32-bit Windows) - echo - mingw32 (GCC (Cygnus/MingW32), Windows 32 bit (console mode)) - echo - icc - echo - msvc (Microsoft Visual C++, Windows 32 bit (console mode)) - echo - When HB_ARCHITECTURE=linux - echo - gcc - echo - When HB_ARCHITECTURE=os2 - echo - gcc (GCC (EMX), 32-bit OS/2) - echo - icc (ICC (IBM Visual Age C++ 3.0), 32-bit OS/2) - echo. - pause - echo HB_GT_LIB: - echo - gtstd (Standard streaming) (for all architectures) - echo - gtdos (DOS console) (for dos architecture) - echo - gtwin (Win32 console) (for w32 architecture) - echo - gtos2 (OS/2 console) (for os2 architecture) - echo - gtpca (PC ANSI console) (for all architectures) - echo - gtcrs (Curses console) (for linux, w32 architectures) - echo - gtsln (Slang console) (for linux, w32 architectures) + echo HB_ARCHITECTURE: + echo - dos (HB_GT_LIB=gtdos by default) + echo - w32 (HB_GT_LIB=gtw32 by default) + echo - linux (HB_GT_LIB=gtstd by default) + echo - os2 (HB_GT_LIB=gtos2 by default) + echo. + pause + echo HB_COMPILER: + echo - When HB_ARCHITECTURE=dos + echo - bcc16 (Borland C++ 3.x, 16-bit DOS) + echo - djgpp (GCC (DJGPP), 32-bit Windows) + echo - watcom + echo - When HB_ARCHITECTURE=w32 + echo - bcc32 (Borland C++ 4.x,5.x, 32-bit Windows) + echo - gcc (GCC (Cygnus), 32-bit Windows) + echo - mingw32 (GCC (Cygnus/MingW32), Windows 32 bit) + echo - icc + echo - msvc (Microsoft Visual C++, Windows 32 bit) + echo - When HB_ARCHITECTURE=linux + echo - gcc + echo - When HB_ARCHITECTURE=os2 + echo - gcc (GCC (EMX), 32-bit OS/2) + echo - icc (ICC (IBM Visual Age C++ 3.0), 32-bit OS/2) + echo. + pause + echo HB_GT_LIB: + echo - gtstd (Standard streaming) (for all architectures) + echo - gtdos (DOS console) (for dos architecture) + echo - gtwin (Win32 console) (for w32 architecture) + echo - gtos2 (OS/2 console) (for os2 architecture) + echo - gtpca (PC ANSI console) (for all architectures) + echo - gtcrs (Curses console) (for linux, w32 architectures) + echo - gtsln (Slang console) (for linux, w32 architectures) goto END -:BAD_ARCH +:NO_ARCH echo Error: HB_ARCHITECTURE is not set. goto HELP -:BAD_COMP +:NO_COMP echo Error: HB_COMPILER is not set. goto HELP +:BAD_ARCH + + echo Error: HB_ARCHITECTURE value is unsupported. + goto HELP + +:BAD_COMP + + echo Error: HB_COMPILER value is unsupported. + goto HELP + :COMPILE - harbour %1.prg /n /i..\include + harbour %1.prg -n -i..\include :A_DOS @@ -120,12 +130,11 @@ rem set HB_GT_LIB= if "%HB_COMPILER%" == "gcc" gcc %1.c -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -l%HB_GT_LIB% -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon if "%HB_COMPILER%" == "icc" icc /Gs+ /W2 /Se /Sd+ /Ti+ -I..\include /C- /Tp %1.c ..\lib\tools.lib ..\lib\debug.lib ..\lib\vm.lib ..\lib\rtl.lib ..\lib\%HB_GT_LIB%.lib ..\lib\rdd.lib ..\lib\rtl.lib ..\lib\vm.lib ..\lib\macro.lib ..\lib\pp.lib ..\lib\dbfntx.lib ..\lib\dbfcdx.lib ..\lib\common.lib - goto END :A_LINUX - if not "%HB_ARCHITECTURE%" == "linux" goto CLEANUP + if not "%HB_ARCHITECTURE%" == "linux" goto BAD_ARCH if "%HB_GT_LIB%" == "" set HB_GT_LIB=gtstd diff --git a/harbour/bin/bld_tpl.cmd b/harbour/bin/bld.cmd similarity index 62% rename from harbour/bin/bld_tpl.cmd rename to harbour/bin/bld.cmd index 7ee1134286..0d8492c321 100644 --- a/harbour/bin/bld_tpl.cmd +++ b/harbour/bin/bld.cmd @@ -14,21 +14,21 @@ rem Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) rem See doc/license.txt for licensing terms. rem --------------------------------------------------------------- -rem set HB_ARCHITECTURE= -rem set HB_COMPILER= -rem set HB_GT_LIB= +rem if "%HB_ARCHITECTURE%" == "" set HB_ARCHITECTURE=os2 +rem if "%HB_COMPILER%" == "" set HB_COMPILER=gcc +rem if "%HB_GT_LIB%" == "" set HB_GT_LIB= :START - if "%HB_ARCHITECTURE%" == "" goto BAD_ARCH - if "%HB_COMPILER%" == "" goto BAD_COMP + if "%HB_ARCHITECTURE%" == "" goto NO_ARCH + if "%HB_COMPILER%" == "" goto NO_COMP if not "%1" == "" goto COMPILE :HELP echo. - echo Usage: bld_tpl.cmd filename + echo Usage: bld.cmd filename echo. echo Notes: echo. @@ -36,58 +36,68 @@ rem set HB_GT_LIB= echo - Don't forget to make a MAIN() function for you application. echo - This batch file assumes you are in some directory off the main echo harbour directory. - echo - Environment variables HB_ARCHITECTURE, HB_COMPILER, HB_GT_LIB should - echo be set. Setting HB_GT_LIB is optional. + echo - Environment variables HB_ARCHITECTURE, HB_COMPILER, HB_GT_LIB + echo should be set. Setting HB_GT_LIB is optional. echo The following values are currently supported: echo. - echo HB_ARCHITECTURE: - echo - dos (HB_GT_LIB=gtdos by default) - echo - w32 (HB_GT_LIB=gtw32 by default) - echo - linux (HB_GT_LIB=gtstd by default) - echo - os2 (HB_GT_LIB=gtos2 by default) - echo. - pause - echo HB_COMPILER: - echo - When HB_ARCHITECTURE=dos - echo - bcc16 (Borland C++ 3.x, 16-bit DOS) - echo - djgpp (GCC (DJGPP), 32-bit Windows) - echo - watcom - echo - When HB_ARCHITECTURE=w32 - echo - bcc32 (Borland C++ 4.x,5.x, 32-bit Windows) - echo - gcc (GCC (Cygnus), 32-bit Windows) - echo - mingw32 (GCC (Cygnus/MingW32), Windows 32 bit (console mode)) - echo - icc - echo - msvc (Microsoft Visual C++, Windows 32 bit (console mode)) - echo - When HB_ARCHITECTURE=linux - echo - gcc - echo - When HB_ARCHITECTURE=os2 - echo - gcc (GCC (EMX), 32-bit OS/2) - echo - icc (ICC (IBM Visual Age C++ 3.0), 32-bit OS/2) - echo. - pause - echo HB_GT_LIB: - echo - gtstd (Standard streaming) (for all architectures) - echo - gtdos (DOS console) (for dos architecture) - echo - gtwin (Win32 console) (for w32 architecture) - echo - gtos2 (OS/2 console) (for os2 architecture) - echo - gtpca (PC ANSI console) (for all architectures) - echo - gtcrs (Curses console) (for linux, w32 architectures) - echo - gtsln (Slang console) (for linux, w32 architectures) + echo HB_ARCHITECTURE: + echo - dos (HB_GT_LIB=gtdos by default) + echo - w32 (HB_GT_LIB=gtw32 by default) + echo - linux (HB_GT_LIB=gtstd by default) + echo - os2 (HB_GT_LIB=gtos2 by default) + echo. + pause + echo HB_COMPILER: + echo - When HB_ARCHITECTURE=dos + echo - bcc16 (Borland C++ 3.x, 16-bit DOS) + echo - djgpp (GCC (DJGPP), 32-bit Windows) + echo - watcom + echo - When HB_ARCHITECTURE=w32 + echo - bcc32 (Borland C++ 4.x,5.x, 32-bit Windows) + echo - gcc (GCC (Cygnus), 32-bit Windows) + echo - mingw32 (GCC (Cygnus/MingW32), Windows 32 bit) + echo - icc + echo - msvc (Microsoft Visual C++, Windows 32 bit) + echo - When HB_ARCHITECTURE=linux + echo - gcc + echo - When HB_ARCHITECTURE=os2 + echo - gcc (GCC (EMX), 32-bit OS/2) + echo - icc (ICC (IBM Visual Age C++ 3.0), 32-bit OS/2) + echo. + pause + echo HB_GT_LIB: + echo - gtstd (Standard streaming) (for all architectures) + echo - gtdos (DOS console) (for dos architecture) + echo - gtwin (Win32 console) (for w32 architecture) + echo - gtos2 (OS/2 console) (for os2 architecture) + echo - gtpca (PC ANSI console) (for all architectures) + echo - gtcrs (Curses console) (for linux, w32 architectures) + echo - gtsln (Slang console) (for linux, w32 architectures) goto END -:BAD_ARCH +:NO_ARCH echo Error: HB_ARCHITECTURE is not set. goto HELP -:BAD_COMP +:NO_COMP echo Error: HB_COMPILER is not set. goto HELP +:BAD_ARCH + + echo Error: HB_ARCHITECTURE value is unsupported. + goto HELP + +:BAD_COMP + + echo Error: HB_COMPILER value is unsupported. + goto HELP + :COMPILE - harbour %1.prg /n /i..\include + harbour %1.prg -n -i..\include :A_DOS @@ -120,12 +130,11 @@ rem set HB_GT_LIB= if "%HB_COMPILER%" == "gcc" gcc %1.c -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -l%HB_GT_LIB% -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon if "%HB_COMPILER%" == "icc" icc /Gs+ /W2 /Se /Sd+ /Ti+ -I..\include /C- /Tp %1.c ..\lib\tools.lib ..\lib\debug.lib ..\lib\vm.lib ..\lib\rtl.lib ..\lib\%HB_GT_LIB%.lib ..\lib\rdd.lib ..\lib\rtl.lib ..\lib\vm.lib ..\lib\macro.lib ..\lib\pp.lib ..\lib\dbfntx.lib ..\lib\dbfcdx.lib ..\lib\common.lib - goto END :A_LINUX - if not "%HB_ARCHITECTURE%" == "linux" goto CLEANUP + if not "%HB_ARCHITECTURE%" == "linux" goto BAD_ARCH if "%HB_GT_LIB%" == "" set HB_GT_LIB=gtstd diff --git a/harbour/bin/bld.sh b/harbour/bin/bld.sh new file mode 100644 index 0000000000..2155876827 --- /dev/null +++ b/harbour/bin/bld.sh @@ -0,0 +1,137 @@ +#!/bin/bash +# +# $Id$ +# + +# Flavour: Bash script + +# --------------------------------------------------------------- +# Template to build a final Harbour executable, using Harbour +# with the C code generation feature, then calling the proper C +# linker/compiler. +# +# Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) +# See doc/license.txt for licensing terms. +# --------------------------------------------------------------- + +# if [ -z "$HB_ARCHITECTURE" ]; then export HB_ARCHITECTURE=linux; fi +# if [ -z "$HB_COMPILER" ]; then export HB_COMPILER=gcc; fi +# if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=; fi + +if [ -z "$HB_ARCHITECTURE" ]; then + echo Error: HB_ARCHITECTURE is not set. +fi +if [ -z "$HB_COMPILER" ]; then + echo Error: HB_COMPILER is not set. +fi + +if [ -z "$1" ] || [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then + + echo + echo Usage: bld.sh filename + echo + echo Notes: + echo + echo " - 'filename' is the .prg filename *without* extension." + echo " - Don't forget to make a MAIN() function for you application." + echo " - This batch file assumes you are in some directory off the main" + echo " harbour directory." + echo " - Environment variables HB_ARCHITECTURE, HB_COMPILER, HB_GT_LIB" + echo " should be set. Setting HB_GT_LIB is optional." + echo " The following values are currently supported:" + echo + echo " HB_ARCHITECTURE:" + echo " - dos (HB_GT_LIB=gtdos by default)" + echo " - w32 (HB_GT_LIB=gtw32 by default)" + echo " - linux (HB_GT_LIB=gtstd by default)" + echo " - os2 (HB_GT_LIB=gtos2 by default)" + echo + read + echo " HB_COMPILER:" + echo " - When HB_ARCHITECTURE=dos" + echo " - bcc16 (Borland C++ 3.x, 16-bit DOS)" + echo " - djgpp (GCC (DJGPP), 32-bit Windows)" + echo " - watcom" + echo " - When HB_ARCHITECTURE=w32" + echo " - bcc32 (Borland C++ 4.x,5.x, 32-bit Windows)" + echo " - gcc (GCC (Cygnus), 32-bit Windows)" + echo " - mingw32 (GCC (Cygnus/MingW32), Windows 32 bit)" + echo " - icc" + echo " - msvc (Microsoft Visual C++, Windows 32 bit)" + echo " - When HB_ARCHITECTURE=linux" + echo " - gcc" + echo " - When HB_ARCHITECTURE=os2" + echo " - gcc (GCC (EMX), 32-bit OS/2)" + echo " - icc (ICC (IBM Visual Age C++ 3.0), 32-bit OS/2)" + echo + read + echo " HB_GT_LIB:" + echo " - gtstd (Standard streaming) (for all architectures)" + echo " - gtdos (DOS console) (for dos architecture)" + echo " - gtwin (Win32 console) (for w32 architecture)" + echo " - gtos2 (OS/2 console) (for os2 architecture)" + echo " - gtpca (PC ANSI console) (for all architectures)" + echo " - gtcrs (Curses console) (for linux, w32 architectures)" + echo " - gtsln (Slang console) (for linux, w32 architectures)" + exit + +else + + harbour $1.prg -n -i../include + + if [ "$HB_ARCHITECTURE" == "dos" ]; then + + if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=gtdos; fi + + if [ "$HB_COMPILER" == "bcc16" ]; then + bcc -O2 -mh -I..\include -L..\lib $1.c tools.lib debug.lib vm.lib rtl.lib $HB_GT_LIB.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib + elif [ "$HB_COMPILER" == "djgpp" ]; then + gcc $1.c -o$1.exe -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -l$HB_GT_LIB -lrdd -lrtl -lvm -lmacro -lpp -ldbfnt -ldbfcd -lcommon + else + echo Error: HB_COMPILER value is unsupported. + fi + + elif [ "$HB_ARCHITECTURE" == "w32" ]; then + + if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=gtwin; fi + + if [ "$HB_COMPILER" == "bcc32" ]; then + bcc32 -O2 -I..\include -L..\lib $1.c tools.lib debug.lib vm.lib rtl.lib $HB_GT_LIB.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib + elif [ "$HB_COMPILER" == "gcc" ]; then + gcc $1.c -o$1.exe -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -l$HB_GT_LIB -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon + elif [ "$HB_COMPILER" == "mingw32" ]; then + gcc $1.c -o$1.exe -mno-cygwin -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -l$HB_GT_LIB -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon + elif [ "$HB_COMPILER" == "msvc" ]; then + cl -Fd..\bin\harbour -w -Zi -TP -GZ -GA -I..\include $1.c /link /subsystem:CONSOLE ..\lib\tools.lib ..\lib\debug.lib ..\lib\vm.lib ..\lib\rtl.lib ..\lib\$HB_GT_LIB.lib ..\lib\rdd.lib ..\lib\macro.lib ..\lib\pp.lib ..\lib\dbfntx.lib ..\lib\dbfcdx. + echo Ignore LNK4033 warning + else + echo Error: HB_COMPILER value is unsupported. + fi + + elif [ "$HB_ARCHITECTURE" == "os2" ]; then + + if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=gtos2; fi + + if [ "$HB_COMPILER" == "gcc" ]; then + gcc $1.c -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -l$HB_GT_LIB -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon + elif [ "$HB_COMPILER" == "icc" ]; then + icc /Gs+ /W2 /Se /Sd+ /Ti+ -I..\include /C- /Tp $1.c ..\lib\tools.lib ..\lib\debug.lib ..\lib\vm.lib ..\lib\rtl.lib ..\lib\$HB_GT_LIB.lib ..\lib\rdd.lib ..\lib\rtl.lib ..\lib\vm.lib ..\lib\macro.lib ..\lib\pp.lib ..\lib\dbfntx.lib ..\lib\dbfcdx.l + else + echo Error: HB_COMPILER value is unsupported. + fi + + elif [ "$HB_ARCHITECTURE" == "linux" ]; then + + if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=gtstd; fi + + if [ "$HB_COMPILER" == "gcc" ]; then + gcc $1.c -I../include -L../lib -ltools -ldebug -lvm -lrtl -l$HB_GT_LIB -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon + else + echo Error: HB_COMPILER value is unsupported. + fi + + else + echo Error: HB_ARCHITECTURE value is unsupported. + unlink $1.c + fi +fi diff --git a/harbour/make_gnu.bat b/harbour/make_gnu.bat new file mode 100644 index 0000000000..c5ffb36bec --- /dev/null +++ b/harbour/make_gnu.bat @@ -0,0 +1,116 @@ +@echo off +rem +rem $Id$ +rem + +rem Flavour: DOS/Windows batch file + +rem --------------------------------------------------------------- +rem Template to initialize the environment before starting +rem the GNU make system for Harbour +rem +rem For further information about the GNU make system please +rem check doc/gmake.txt +rem +rem Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) +rem See doc/license.txt for licensing terms. +rem --------------------------------------------------------------- + +if "%HB_ARCHITECTURE%" == "" set HB_ARCHITECTURE=dos +if "%HB_COMPILER%" == "" set HB_COMPILER=djgpp +if "%HB_GT_LIB%" == "" set HB_GT_LIB= + +rem set PRG_USR= +rem set C_USR= +rem set L_USR= + +rem Set to constant value to be consistent with the non-GNU make files. + +set HB_BIN_INSTALL=bin\ +set HB_LIB_INSTALL=lib\ +set HB_INC_INSTALL=include\ + +:START + + if "%HB_ARCHITECTURE%" == "" goto BAD_ARCH + if "%HB_COMPILER%" == "" goto BAD_COMP + + goto MAKE + +:HELP + + echo. + echo Usage: make_gnu.bat [command] + echo. + echo The following commands are supported: + echo - all (default) + echo - clean + echo - install + echo. + echo Notes: + echo. + echo - HB_ARCHITECTURE and HB_COMPILER envvars must be set. + echo The following values are currently supported: + echo. + echo HB_ARCHITECTURE: + echo - dos (HB_GT_LIB=gtdos by default) + echo - w32 (HB_GT_LIB=gtw32 by default) + echo - linux (HB_GT_LIB=gtstd by default) + echo - os2 (HB_GT_LIB=gtos2 by default) + echo. + pause + echo HB_COMPILER: + echo - When HB_ARCHITECTURE=dos + echo - bcc16 (Borland C++ 3.x, 16-bit DOS) + echo - djgpp (GCC (DJGPP), 32-bit Windows) + echo - watcom + echo - When HB_ARCHITECTURE=w32 + echo - bcc32 (Borland C++ 4.x,5.x, 32-bit Windows) + echo - gcc (GCC (Cygnus), 32-bit Windows) + echo - mingw32 (GCC (Cygnus/MingW32), Windows 32 bit) + echo - icc + echo - msvc (Microsoft Visual C++, Windows 32 bit) + echo - When HB_ARCHITECTURE=linux + echo - gcc + echo - When HB_ARCHITECTURE=os2 + echo - gcc (GCC (EMX), 32-bit OS/2) + echo - icc (ICC (IBM Visual Age C++ 3.0), 32-bit OS/2) + echo. + pause + echo HB_GT_LIB: + echo - gtstd (Standard streaming) (for all architectures) + echo - gtdos (DOS console) (for dos architecture) + echo - gtwin (Win32 console) (for w32 architecture) + echo - gtos2 (OS/2 console) (for os2 architecture) + echo - gtpca (PC ANSI console) (for all architectures) + echo - gtcrs (Curses console) (for linux, w32 architectures) + echo - gtsln (Slang console) (for linux, w32 architectures) + echo. + echo - Use these optional envvars to configure the make process + echo when using the 'all' command: + echo. + echo PRG_USR - Extra Harbour compiler options + echo C_USR - Extra C compiler options + echo L_USR - Extra linker options + goto END + +:BAD_ARCH + + echo Error: HB_ARCHITECTURE is not set. + goto HELP + +:BAD_COMP + + echo Error: HB_COMPILER is not set. + goto HELP + +:MAKE + + rem --------------------------------------------------------------- + rem Start the GNU make system + + make %1 %2 %3 %4 %5 %6 %7 %8 %9 + goto END + +:END + diff --git a/harbour/make_gnu.cmd b/harbour/make_gnu.cmd new file mode 100644 index 0000000000..4ce0766eb8 --- /dev/null +++ b/harbour/make_gnu.cmd @@ -0,0 +1,116 @@ +@echo off +rem +rem $Id$ +rem + +rem Flavour: OS/2 command file + +rem --------------------------------------------------------------- +rem Template to initialize the environment before starting +rem the GNU make system for Harbour +rem +rem For further information about the GNU make system please +rem check doc/gmake.txt +rem +rem Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) +rem See doc/license.txt for licensing terms. +rem --------------------------------------------------------------- + +if "%HB_ARCHITECTURE%" == "" set HB_ARCHITECTURE=os2 +if "%HB_COMPILER%" == "" set HB_COMPILER=gcc +if "%HB_GT_LIB%" == "" set HB_GT_LIB= + +rem set PRG_USR= +rem set C_USR= +rem set L_USR= + +rem Set to constant value to be consistent with the non-GNU make files. + +set HB_BIN_INSTALL=bin\ +set HB_LIB_INSTALL=lib\ +set HB_INC_INSTALL=include\ + +:START + + if "%HB_ARCHITECTURE%" == "" goto BAD_ARCH + if "%HB_COMPILER%" == "" goto BAD_COMP + + goto MAKE + +:HELP + + echo. + echo Usage: make_gnu.cmd [command] + echo. + echo The following commands are supported: + echo - all (default) + echo - clean + echo - install + echo. + echo Notes: + echo. + echo - HB_ARCHITECTURE and HB_COMPILER envvars must be set. + echo The following values are currently supported: + echo. + echo HB_ARCHITECTURE: + echo - dos (HB_GT_LIB=gtdos by default) + echo - w32 (HB_GT_LIB=gtw32 by default) + echo - linux (HB_GT_LIB=gtstd by default) + echo - os2 (HB_GT_LIB=gtos2 by default) + echo. + pause + echo HB_COMPILER: + echo - When HB_ARCHITECTURE=dos + echo - bcc16 (Borland C++ 3.x, 16-bit DOS) + echo - djgpp (GCC (DJGPP), 32-bit Windows) + echo - watcom + echo - When HB_ARCHITECTURE=w32 + echo - bcc32 (Borland C++ 4.x,5.x, 32-bit Windows) + echo - gcc (GCC (Cygnus), 32-bit Windows) + echo - mingw32 (GCC (Cygnus/MingW32), Windows 32 bit) + echo - icc + echo - msvc (Microsoft Visual C++, Windows 32 bit) + echo - When HB_ARCHITECTURE=linux + echo - gcc + echo - When HB_ARCHITECTURE=os2 + echo - gcc (GCC (EMX), 32-bit OS/2) + echo - icc (ICC (IBM Visual Age C++ 3.0), 32-bit OS/2) + echo. + pause + echo HB_GT_LIB: + echo - gtstd (Standard streaming) (for all architectures) + echo - gtdos (DOS console) (for dos architecture) + echo - gtwin (Win32 console) (for w32 architecture) + echo - gtos2 (OS/2 console) (for os2 architecture) + echo - gtpca (PC ANSI console) (for all architectures) + echo - gtcrs (Curses console) (for linux, w32 architectures) + echo - gtsln (Slang console) (for linux, w32 architectures) + echo. + echo - Use these optional envvars to configure the make process + echo when using the 'all' command: + echo. + echo PRG_USR - Extra Harbour compiler options + echo C_USR - Extra C compiler options + echo L_USR - Extra linker options + goto END + +:BAD_ARCH + + echo Error: HB_ARCHITECTURE is not set. + goto HELP + +:BAD_COMP + + echo Error: HB_COMPILER is not set. + goto HELP + +:MAKE + + rem --------------------------------------------------------------- + rem Start the GNU make system + + make %1 %2 %3 %4 %5 %6 %7 %8 %9 + goto END + +:END + diff --git a/harbour/make_gnu.sh b/harbour/make_gnu.sh new file mode 100644 index 0000000000..7acd50aa7c --- /dev/null +++ b/harbour/make_gnu.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# +# $Id$ +# + +# Flavour: Bash script + +# --------------------------------------------------------------- +# Template to initialize the environment before starting +# the GNU make system for Harbour +# +# For further information about the GNU make system please +# check doc/gmake.txt +# +# Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) +# See doc/license.txt for licensing terms. +# --------------------------------------------------------------- + +if [ -z "$HB_ARCHITECTURE" ]; then export HB_ARCHITECTURE=linux; fi +if [ -z "$HB_COMPILER" ]; then export HB_COMPILER=gcc; fi +if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=; fi + +# export PRG_USR= +# export C_USR= +# export L_USR= + +# Set to constant value to be consistent with the non-GNU make files. + +export HB_BIN_INSTALL=bin/ +export HB_LIB_INSTALL=lib/ +export HB_INC_INSTALL=include/ + +if [ -z "$HB_ARCHITECTURE" ]; then + echo Error: HB_ARCHITECTURE is not set. +fi +if [ -z "$HB_COMPILER" ]; then + echo Error: HB_COMPILER is not set. +fi + +if [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then + + echo + echo Usage: make_gnu.sh [command] + echo + echo The following commands are supported: + echo " - all (default)" + echo " - clean" + echo " - install" + echo + echo Notes: + echo + echo " - HB_ARCHITECTURE and HB_COMPILER envvars must be set." + echo " The following values are currently supported:" + echo + echo " HB_ARCHITECTURE:" + echo " - dos (HB_GT_LIB=gtdos by default)" + echo " - w32 (HB_GT_LIB=gtw32 by default)" + echo " - linux (HB_GT_LIB=gtstd by default)" + echo " - os2 (HB_GT_LIB=gtos2 by default)" + echo + read + echo " HB_COMPILER:" + echo " - When HB_ARCHITECTURE=dos" + echo " - bcc16 (Borland C++ 3.x, 16-bit DOS)" + echo " - djgpp (GCC (DJGPP), 32-bit Windows)" + echo " - watcom" + echo " - When HB_ARCHITECTURE=w32" + echo " - bcc32 (Borland C++ 4.x,5.x, 32-bit Windows)" + echo " - gcc (GCC (Cygnus), 32-bit Windows)" + echo " - mingw32 (GCC (Cygnus/MingW32), Windows 32 bit)" + echo " - icc" + echo " - msvc (Microsoft Visual C++, Windows 32 bit)" + echo " - When HB_ARCHITECTURE=linux" + echo " - gcc" + echo " - When HB_ARCHITECTURE=os2" + echo " - gcc (GCC (EMX), 32-bit OS/2)" + echo " - icc (ICC (IBM Visual Age C++ 3.0), 32-bit OS/2)" + echo + read + echo " HB_GT_LIB:" + echo " - gtstd (Standard streaming) (for all architectures)" + echo " - gtdos (DOS console) (for dos architecture)" + echo " - gtwin (Win32 console) (for w32 architecture)" + echo " - gtos2 (OS/2 console) (for os2 architecture)" + echo " - gtpca (PC ANSI console) (for all architectures)" + echo " - gtcrs (Curses console) (for linux, w32 architectures)" + echo " - gtsln (Slang console) (for linux, w32 architectures)" + echo + echo " - Use these optional envvars to configure the make process" + echo " when using the 'all' command:" + echo + echo " PRG_USR - Extra Harbour compiler options" + echo " C_USR - Extra C compiler options" + echo " L_USR - Extra linker options" + exit + +else + + # --------------------------------------------------------------- + # Start the GNU make system + + make $* + +fi diff --git a/harbour/make_tpl.bat b/harbour/make_tpl.bat deleted file mode 100644 index 090b7906ec..0000000000 --- a/harbour/make_tpl.bat +++ /dev/null @@ -1,74 +0,0 @@ -@echo off -rem -rem $Id$ -rem - -rem Flavour: DOS/Windows batch file - -rem --------------------------------------------------------------- -rem Template to initialize the environment before starting -rem the GNU make system for Harbour -rem -rem For further information about the GNU make system please -rem check doc/gmake.txt -rem -rem Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) -rem See doc/license.txt for licensing terms. -rem --------------------------------------------------------------- - -rem --------------------------------------------------------------- -rem Usage: make_tpl -rem -rem The following commands are currently supported: -rem - all (default) -rem - clean -rem - install -rem --------------------------------------------------------------- - -rem --------------------------------------------------------------- -rem Configuration for "install" command: - -set HB_BIN_INSTALL=bin\ -set HB_LIB_INSTALL=lib\ -set HB_INC_INSTALL=include\ - -rem --------------------------------------------------------------- -rem The following HB_ARCHITECTURE values are currently supported: -rem - dos -rem - w32 -rem - linux -rem - os2 - -set HB_ARCHITECTURE=dos - -rem --------------------------------------------------------------- -rem The following HB_COMPILER values are currently supported: -rem - When HB_ARCHITECTURE=dos -rem - bcc16 -rem - djgpp -rem - watcom -rem - When HB_ARCHITECTURE=w32 -rem - bcc32 -rem - gcc -rem - mingw32 -rem - icc -rem - msvc -rem - When HB_ARCHITECTURE=linux -rem - gcc -rem - When HB_ARCHITECTURE=os2 -rem - gcc -rem - icc - -set HB_COMPILER=djgpp - -rem --------------------------------------------------------------- -rem Fine tuning the compiler parameters for "all" command: - -set PRG_USR= -set C_USR= -set L_USR= - -rem --------------------------------------------------------------- -rem Start the GNU make system - -make %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/harbour/make_tpl.cmd b/harbour/make_tpl.cmd deleted file mode 100644 index bfd6d7a749..0000000000 --- a/harbour/make_tpl.cmd +++ /dev/null @@ -1,74 +0,0 @@ -@echo off -rem -rem $Id$ -rem - -rem Flavour: OS/2 command file - -rem --------------------------------------------------------------- -rem Template to initialize the environment before starting -rem the GNU make system for Harbour -rem -rem For further information about the GNU make system please -rem check doc/gmake.txt -rem -rem Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) -rem See doc/license.txt for licensing terms. -rem --------------------------------------------------------------- - -rem --------------------------------------------------------------- -rem Usage: make_tpl -rem -rem The following commands are currently supported: -rem - all (default) -rem - clean -rem - install -rem --------------------------------------------------------------- - -rem --------------------------------------------------------------- -rem Configuration for "install" command: - -set HB_BIN_INSTALL=bin\ -set HB_LIB_INSTALL=lib\ -set HB_INC_INSTALL=include\ - -rem --------------------------------------------------------------- -rem The following HB_ARCHITECTURE values are currently supported: -rem - dos -rem - w32 -rem - linux -rem - os2 - -set HB_ARCHITECTURE=os2 - -rem --------------------------------------------------------------- -rem The following HB_COMPILER values are currently supported: -rem - When HB_ARCHITECTURE=dos -rem - bcc16 -rem - djgpp -rem - watcom -rem - When HB_ARCHITECTURE=w32 -rem - bcc32 -rem - gcc -rem - mingw32 -rem - icc -rem - msvc -rem - When HB_ARCHITECTURE=linux -rem - gcc -rem - When HB_ARCHITECTURE=os2 -rem - gcc -rem - icc - -set HB_COMPILER=gcc - -rem --------------------------------------------------------------- -rem Fine tuning the compiler parameters for "all" command: - -set PRG_USR= -set C_USR= -set L_USR= - -rem --------------------------------------------------------------- -rem Start the GNU make system - -make %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/harbour/make_tpl.sh b/harbour/make_tpl.sh deleted file mode 100644 index cbc0d65ec3..0000000000 --- a/harbour/make_tpl.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# -# $Id$ -# - -# Flavour: Bash script - -# --------------------------------------------------------------- -# Template to initialize the environment before starting -# the GNU make system for Harbour -# -# For further information about the GNU make system please -# check doc/gmake.txt -# -# Copyright 1999-2000 Victor Szakats (info@szelvesz.hu) -# See doc/license.txt for licensing terms. -# --------------------------------------------------------------- - -# --------------------------------------------------------------- -# Usage: make_tpl.sh -# -# The following commands are currently supported: -# - all (default) -# - clean -# - install -# --------------------------------------------------------------- - -# --------------------------------------------------------------- -# Configuration for "install" command: - -export HB_BIN_INSTALL=bin/ -export HB_LIB_INSTALL=lib/ -export HB_INC_INSTALL=include/ - -# --------------------------------------------------------------- -# The following HB_ARCHITECTURE values are currently supported: -# - dos -# - w32 -# - linux -# - os2 - -export HB_ARCHITECTURE=linux - -# --------------------------------------------------------------- -# The following HB_COMPILER values are currently supported: -# - When HB_ARCHITECTURE=dos -# - bcc16 -# - djgpp -# - watcom -# - When HB_ARCHITECTURE=w32 -# - bcc32 -# - gcc -# - mingw32 -# - icc -# - msvc -# - When HB_ARCHITECTURE=linux -# - gcc -# - When HB_ARCHITECTURE=os2 -# - gcc -# - icc - -export HB_COMPILER=gcc - -# --------------------------------------------------------------- -# Fine tuning the compiler parameters for "all" command: - -export PRG_USR= -export C_USR= -export L_USR= - -# --------------------------------------------------------------- -# Start the GNU make system - -make $* diff --git a/harbour/source/rtl/box.c b/harbour/source/rtl/box.c index da44329cee..3a8791174a 100644 --- a/harbour/source/rtl/box.c +++ b/harbour/source/rtl/box.c @@ -35,27 +35,46 @@ #include "hbapi.h" #include "hbapigt.h" +#include "hbapiitm.h" HB_FUNC( DISPBOX ) { - if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) + PHB_ITEM pTop = hb_param( 1, IT_NUMERIC ); + PHB_ITEM pLeft = hb_param( 2, IT_NUMERIC ); + PHB_ITEM pBottom = hb_param( 3, IT_NUMERIC ); + PHB_ITEM pRight = hb_param( 4, IT_NUMERIC ); + + if( pTop && pLeft && pBottom && pRight ) { + char * pszColor = ISCHAR( 6 ) ? hb_parc( 6 ) : NULL; char szOldColor[ CLR_STRLEN ]; - if( ISCHAR( 6 ) ) + if( pszColor ) { hb_gtGetColorStr( szOldColor ); - hb_gtSetColorStr( hb_parc( 6 ) ); + hb_gtSetColorStr( pszColor ); } if( ISCHAR( 5 ) ) - hb_gtBox( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( BYTE * ) hb_parc( 5 )); - else if( ISNUM( 5 ) && hb_parni( 5 ) == 2 ) - hb_gtBoxD( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ); - else - hb_gtBoxS( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ); + hb_gtBox( hb_itemGetNI( pTop ), + hb_itemGetNI( pLeft), + hb_itemGetNI( pBottom ), + hb_itemGetNI( pRight ), + ( BYTE * ) hb_parc( 5 ) ); - if( ISCHAR( 6 ) ) + else if( ISNUM( 5 ) && hb_parni( 5 ) == 2 ) + hb_gtBoxD( hb_itemGetNI( pTop ), + hb_itemGetNI( pLeft), + hb_itemGetNI( pBottom ), + hb_itemGetNI( pRight ) ); + + else + hb_gtBoxS( hb_itemGetNI( pTop ), + hb_itemGetNI( pLeft), + hb_itemGetNI( pBottom ), + hb_itemGetNI( pRight ) ); + + if( pszColor ) hb_gtSetColorStr( szOldColor ); } } diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 0aa74ac6e4..061a09a7e0 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -82,8 +82,6 @@ static int s_iFilenoStderr; void hb_consoleInitialize( void ) { - int iStderr; - HB_TRACE(HB_TR_DEBUG, ("hb_consoleInitialize()")); #if defined(OS_UNIX_COMPATIBLE) @@ -97,22 +95,24 @@ void hb_consoleInitialize( void ) s_uiPRow = s_uiPCol = 0; + s_iFilenoStdin = fileno( stdin ); + s_iFilenoStdout = fileno( stdout ); + + { + int iStderr = hb_cmdargNum( "STDERR" ); /* Undocumented CA-Clipper switch //STDERR:x */ + + if( iStderr < 0 ) /* //STDERR not used or invalid */ + s_iFilenoStderr = fileno( stderr ); + else if( iStderr == 0 ) /* //STDERR with no parameter or 0 */ + s_iFilenoStderr = s_iFilenoStdout; + else /* //STDERR:x */ + s_iFilenoStderr = iStderr; + } + /* Some compilers open stdout and stderr in text mode, but Harbour needs them to be open in binary mode. */ - s_iFilenoStdin = fileno( stdin ); - s_iFilenoStdout = fileno( stdout ); hb_fsSetDevMode( s_iFilenoStdout, FD_BINARY ); - - iStderr = hb_cmdargNum( "STDERR" ); /* Undocumented CA-Clipper switch //STDERR:x */ - - if( iStderr < 0 ) /* //STDERR not used or invalid */ - s_iFilenoStderr = fileno( stderr ); - else if( iStderr == 0 ) /* //STDERR with no parameter or 0 */ - s_iFilenoStderr = s_iFilenoStdout; - else /* //STDERR:x */ - s_iFilenoStderr = iStderr; - hb_fsSetDevMode( s_iFilenoStderr, FD_BINARY ); s_bInit = TRUE; @@ -152,28 +152,28 @@ HB_FUNC( HB_OSNEWLINE ) typedef void hb_out_func_typedef( char *, ULONG ); /* Format items for output, then call specified output function */ -static void hb_out( USHORT uiParam, hb_out_func_typedef * hb_out_func ) +static void hb_out( USHORT uiParam, hb_out_func_typedef * pOutFunc ) { + PHB_ITEM pItem; + char * pszString; ULONG ulLen; BOOL bFreeReq; - PHB_ITEM pItem; - char * pString; HB_TRACE(HB_TR_DEBUG, ("hb_out(%hu, %p)", uiParam, hb_out_func)); pItem = hb_param( uiParam, IT_ANY ); - pString = hb_itemString( pItem, &ulLen, &bFreeReq ); + pszString = hb_itemString( pItem, &ulLen, &bFreeReq ); - hb_out_func( pString, ulLen ); + pOutFunc( pszString, ulLen ); if( bFreeReq ) - hb_xfree( pString ); + hb_xfree( pszString ); } /* Output an item to STDOUT */ void hb_outstd( char * pStr, ULONG ulLen ) { - USHORT user_ferror; + USHORT uiErrorOld; HB_TRACE(HB_TR_DEBUG, ("hb_outstd(%s, %lu)", pStr, ulLen)); @@ -183,9 +183,9 @@ void hb_outstd( char * pStr, ULONG ulLen ) if( s_bInit ) hb_gtPreExt(); - user_ferror = hb_fsError(); /* Save current user file error code */ + uiErrorOld = hb_fsError(); /* Save current user file error code */ hb_fsWriteLarge( s_iFilenoStdout, ( BYTE * ) pStr, ulLen ); - hb_fsSetError( user_ferror ); /* Restore last user file error code */ + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ if( s_bInit ) { @@ -197,7 +197,7 @@ void hb_outstd( char * pStr, ULONG ulLen ) /* Output an item to STDERR */ void hb_outerr( char * pStr, ULONG ulLen ) { - USHORT user_ferror; + USHORT uiErrorOld; HB_TRACE(HB_TR_DEBUG, ("hb_outerr(%s, %lu)", pStr, ulLen)); @@ -207,9 +207,9 @@ void hb_outerr( char * pStr, ULONG ulLen ) if( s_bInit ) hb_gtPreExt(); - user_ferror = hb_fsError(); /* Save current user file error code */ + uiErrorOld = hb_fsError(); /* Save current user file error code */ hb_fsWriteLarge( s_iFilenoStderr, ( BYTE * ) pStr, ulLen ); - hb_fsSetError( user_ferror ); /* Restore last user file error code */ + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ if( s_bInit ) { @@ -229,25 +229,25 @@ static void hb_altout( char * pStr, ULONG ulLen ) if( hb_set.HB_SET_ALTERNATE && hb_set.hb_set_althan != FS_ERROR ) { /* Print to alternate file if SET ALTERNATE ON and valid alternate file */ - USHORT user_ferror = hb_fsError(); /* Save current user file error code */ + USHORT uiErrorOld = hb_fsError(); /* Save current user file error code */ hb_fsWriteLarge( hb_set.hb_set_althan, ( BYTE * ) pStr, ulLen ); - hb_fsSetError( user_ferror ); /* Restore last user file error code */ + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ } if( hb_set.hb_set_extrahan != FS_ERROR ) { /* Print to extra file if valid alternate file */ - USHORT user_ferror = hb_fsError(); /* Save current user file error code */ + USHORT uiErrorOld = hb_fsError(); /* Save current user file error code */ hb_fsWriteLarge( hb_set.hb_set_extrahan, ( BYTE * ) pStr, ulLen ); - hb_fsSetError( user_ferror ); /* Restore last user file error code */ + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ } if( hb_set.HB_SET_PRINTER && hb_set.hb_set_printhan != FS_ERROR ) { /* Print to printer if SET PRINTER ON and valid printer file */ - USHORT user_ferror = hb_fsError(); /* Save current user file error code */ + USHORT uiErrorOld = hb_fsError(); /* Save current user file error code */ hb_fsWriteLarge( hb_set.hb_set_printhan, ( BYTE * ) pStr, ulLen ); - hb_fsSetError( user_ferror ); /* Restore last user file error code */ + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ s_uiPCol += ( USHORT ) ulLen; } } @@ -260,9 +260,9 @@ static void hb_devout( char * pStr, ULONG ulLen ) if( hb_set.hb_set_printhan != FS_ERROR && hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 ) { /* Display to printer if SET DEVICE TO PRINTER and valid printer file */ - USHORT user_ferror = hb_fsError(); /* Save current user file error code */ + USHORT uiErrorOld = hb_fsError(); /* Save current user file error code */ hb_fsWriteLarge( hb_set.hb_set_printhan, ( BYTE * ) pStr, ulLen ); - hb_fsSetError( user_ferror ); /* Restore last user file error code */ + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ s_uiPCol += ( USHORT ) ulLen; } else @@ -276,51 +276,10 @@ static void hb_devout( char * pStr, ULONG ulLen ) static void hb_dispout( char * pStr, ULONG ulLen ) { HB_TRACE(HB_TR_DEBUG, ("hb_dispout(%s, %lu)", pStr, ulLen)); + hb_gtWrite( ( BYTE * ) pStr, ulLen ); } -void hb_devpos( SHORT row, SHORT col ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_devpos(%hd, %hd)", row, col)); - - /* Position printer if SET DEVICE TO PRINTER and valid printer file - otherwise position console */ - if( hb_set.hb_set_printhan != FS_ERROR && hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 ) - { - USHORT uiCount, uiProw = ( USHORT ) row, uiPcol = ( USHORT ) col; - USHORT user_ferror = hb_fsError(); /* Save current user file error code */ - - if( uiProw < s_uiPRow ) - { - hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) "\x0C\x0D", 2 ); - s_uiPRow = s_uiPCol = 0; - } - - for( uiCount = s_uiPRow; uiCount < uiProw; uiCount++ ) - hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) s_szCrLf, CRLF_BUFFER_LEN-1 ); - - if( uiProw > s_uiPRow ) s_uiPCol = 0; - uiPcol += hb_set.HB_SET_MARGIN; - - for( uiCount = s_uiPCol; uiCount < uiPcol; uiCount++ ) - hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) " ", 1 ); - - s_uiPRow = uiProw; - s_uiPCol = uiPcol; - hb_fsSetError( user_ferror ); /* Restore last user file error code */ - } - else - hb_gtSetPos( row, col ); -} - -/* NOTE: This should be placed after the hb_devpos() definition. */ - -HB_FUNC( DEVPOS ) /* Sets the screen and/or printer position */ -{ - if( ISNUM( 1 ) && ISNUM( 2 ) ) - hb_devpos( hb_parni( 1 ), hb_parni( 2 ) ); -} - HB_FUNC( OUTSTD ) /* writes a list of values to the standard output device */ { USHORT uiPCount = hb_pcount(); @@ -366,49 +325,30 @@ HB_FUNC( QOUT ) if( hb_set.HB_SET_PRINTER && hb_set.hb_set_printhan != FS_ERROR ) { - USHORT user_ferror = hb_fsError(); /* Save current user file error code */ + USHORT uiErrorOld = hb_fsError(); /* Save current user file error code */ USHORT uiCount; s_uiPRow++; + uiCount = s_uiPCol = hb_set.HB_SET_MARGIN; while( uiCount-- > 0 ) hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) " ", 1 ); - hb_fsSetError( user_ferror ); /* Restore last user file error code */ + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ } HB_FUNCNAME( QQOUT )(); } -HB_FUNC( DEVOUT ) /* writes a single value to the current device (screen or printer), but is not affected by SET ALTERNATE */ -{ - if( hb_pcount() >= 1 ) - { - if( ISCHAR( 2 ) ) - { - char szOldColor[ CLR_STRLEN ]; - - hb_gtGetColorStr( szOldColor ); - hb_gtSetColorStr( hb_parc( 2 ) ); - - hb_out( 1, hb_devout ); - - hb_gtSetColorStr( szOldColor ); - } - else - hb_out( 1, hb_devout ); - } -} - /* TOFIX: CA-Cl*pper will print an eject even if SET DEVICE=SCREEN */ HB_FUNC( __EJECT ) /* Ejects the current page from the printer */ { if( hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set.hb_set_printhan != FS_ERROR ) { - USHORT user_ferror = hb_fsError(); /* Save current user file error code */ + USHORT uiErrorOld = hb_fsError(); /* Save current user file error code */ hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) "\x0C\x0D", 2 ); - hb_fsSetError( user_ferror ); /* Restore last user file error code */ + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ } s_uiPRow = s_uiPCol = 0; @@ -416,65 +356,124 @@ HB_FUNC( __EJECT ) /* Ejects the current page from the printer */ HB_FUNC( PROW ) /* Returns the current printer row position */ { - hb_retni( s_uiPRow ); + hb_retni( ( int ) s_uiPRow ); } HB_FUNC( PCOL ) /* Returns the current printer row position */ { - hb_retni( s_uiPCol ); + hb_retni( ( int ) s_uiPCol ); +} + +void hb_devpos( SHORT iRow, SHORT iCol ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_devpos(%hd, %hd)", row, col)); + + /* Position printer if SET DEVICE TO PRINTER and valid printer file + otherwise position console */ + + if( hb_set.hb_set_printhan != FS_ERROR && hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 ) + { + USHORT uiCount; + USHORT uiProw = ( USHORT ) iRow; + USHORT uiPcol = ( USHORT ) iCol; + USHORT uiErrorOld = hb_fsError(); /* Save current user file error code */ + + if( uiProw < s_uiPRow ) + { + hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) "\x0C\x0D", 2 ); + s_uiPRow = s_uiPCol = 0; + } + + for( uiCount = s_uiPRow; uiCount < uiProw; uiCount++ ) + hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) s_szCrLf, CRLF_BUFFER_LEN - 1 ); + + if( uiProw > s_uiPRow ) + s_uiPCol = 0; + + uiPcol += hb_set.HB_SET_MARGIN; + + for( uiCount = s_uiPCol; uiCount < uiPcol; uiCount++ ) + hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) " ", 1 ); + + s_uiPRow = uiProw; + s_uiPCol = uiPcol; + + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ + } + else + hb_gtSetPos( iRow, iCol ); +} + +/* NOTE: This should be placed after the hb_devpos() definition. */ + +HB_FUNC( DEVPOS ) /* Sets the screen and/or printer position */ +{ + if( ISNUM( 1 ) && ISNUM( 2 ) ) + hb_devpos( hb_parni( 1 ), hb_parni( 2 ) ); } HB_FUNC( SETPRC ) /* Sets the current printer row and column positions */ { - if( ISNUM( 1 ) && ISNUM( 2 ) ) + if( hb_pcount() == 2 && ISNUM( 1 ) && ISNUM( 2 ) ) { s_uiPRow = ( USHORT ) hb_parni( 1 ); s_uiPCol = ( USHORT ) hb_parni( 2 ); } } +HB_FUNC( DEVOUT ) /* writes a single value to the current device (screen or printer), but is not affected by SET ALTERNATE */ +{ + if( ISCHAR( 2 ) ) + { + char szOldColor[ CLR_STRLEN ]; + + hb_gtGetColorStr( szOldColor ); + hb_gtSetColorStr( hb_parc( 2 ) ); + + hb_out( 1, hb_devout ); + + hb_gtSetColorStr( szOldColor ); + } + else if( hb_pcount() >= 1 ) + hb_out( 1, hb_devout ); +} + HB_FUNC( DISPOUT ) /* writes a single value to the screen, but is not affected by SET ALTERNATE */ { - if( hb_pcount() >= 1 ) + if( ISCHAR( 2 ) ) { - if( ISCHAR( 2 ) ) - { - char szOldColor[ CLR_STRLEN ]; + char szOldColor[ CLR_STRLEN ]; - hb_gtGetColorStr( szOldColor ); - hb_gtSetColorStr( hb_parc( 2 ) ); + hb_gtGetColorStr( szOldColor ); + hb_gtSetColorStr( hb_parc( 2 ) ); - hb_out( 1, hb_dispout ); + hb_out( 1, hb_dispout ); - hb_gtSetColorStr( szOldColor ); - } - else - hb_out( 1, hb_dispout ); + hb_gtSetColorStr( szOldColor ); } + else if( hb_pcount() >= 1 ) + hb_out( 1, hb_dispout ); } /* Undocumented Clipper function */ HB_FUNC( DISPOUTAT ) /* writes a single value to the screen at speficic position, but is not affected by SET ALTERNATE */ { - if( hb_pcount() >= 3 ) + /* NOTE: Clipper does no checks here. [vszakats] */ + hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ) ); + + if( ISCHAR( 4 ) ) { - /* NOTE: Clipper does no checks here. [vszakats] */ - hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ) ); + char szOldColor[ CLR_STRLEN ]; - if( ISCHAR( 4 ) ) - { - char szOldColor[ CLR_STRLEN ]; + hb_gtGetColorStr( szOldColor ); + hb_gtSetColorStr( hb_parc( 4 ) ); - hb_gtGetColorStr( szOldColor ); - hb_gtSetColorStr( hb_parc( 4 ) ); + hb_out( 3, hb_dispout ); - hb_out( 3, hb_dispout ); - - hb_gtSetColorStr( szOldColor ); - } - else - hb_out( 3, hb_dispout ); + hb_gtSetColorStr( szOldColor ); } + else if( hb_pcount() >= 3 ) + hb_out( 3, hb_dispout ); } diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 1d5cdb6853..372d11cb60 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -69,6 +69,7 @@ #include "hbapigt.h" #include "hbset.h" +static BOOL s_bInit = FALSE; static SHORT s_iCurrentRow; static SHORT s_iCurrentCol; static USHORT s_uiPreCount; @@ -107,6 +108,8 @@ void hb_gtInit( int s_iFilenoStdin, int s_iFilenoStdout, int s_iFilenoStderr ) s_uiColorIndex = 0; s_uiCursorShape = 0; + s_bInit = TRUE; + if( hb_cmdargCheck( "INFO" ) ) { hb_outerr( hb_gtVersion(), 0 ); @@ -118,6 +121,8 @@ void hb_gtExit( void ) { HB_TRACE(HB_TR_DEBUG, ("hb_gtExit()")); + s_bInit = FALSE; + while( hb_gt_DispCount() ) hb_gt_DispEnd(); diff --git a/harbour/utils/hbdoc/Makefile b/harbour/utils/hbdoc/Makefile index 3e60e88143..19dbe437af 100644 --- a/harbour/utils/hbdoc/Makefile +++ b/harbour/utils/hbdoc/Makefile @@ -30,7 +30,6 @@ LIBS=\ vm \ macro \ pp \ - runner \ common \ include $(TOP)$(ROOT)config/bin.cf