From b9cc575e8c7a408c24ed18673d42845a770bb715 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 9 Nov 2010 14:00:44 +0000 Subject: [PATCH] 2010-11-09 14:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/common/hbver.c + Added support for hb_iswin*() and HB_OSISWIN*() functions on MS-DOS platforms. Please test them. ; TODO: Detection of 2K and Vista isn't currently implemented, but can be added if someone knows how to detect them. --- harbour/ChangeLog | 34 ++++++++++++++---------- harbour/src/common/hbver.c | 53 +++++++++++++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 18c5091f0f..61db4d6b86 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-09 14:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * src/common/hbver.c + + Added support for hb_iswin*() and HB_OSISWIN*() functions + on MS-DOS platforms. + Please test them. + ; TODO: Detection of 2K and Vista isn't currently implemented, + but can be added if someone knows how to detect them. + 2010-11-09 15:20 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) + harbour/contrib/hbzebra + harbour/contrib/hbzebra/hbzebra.ch @@ -31,12 +39,12 @@ + harbour/contrib/hbzebra/msi.c + harbour/contrib/hbzebra/hbzebra.hbc + harbour/contrib/hbzebra/hbzebra.hbp - + added barcode library. It supports these types of barcodes: EAN-13, - EAN-8, UPC-A, UPC-E, Code 128, Code 93, Code 39, Code 11, Codabar, + + added barcode library. It supports these types of barcodes: EAN-13, + EAN-8, UPC-A, UPC-E, Code 128, Code 93, Code 39, Code 11, Codabar, Interleave 2 of 5 (ITF), MSI. - Library has both C and Harbour level API functions. GC pointers + Library has both C and Harbour level API functions. GC pointers are used to store Zebra structures in Harbour items. - Current impementation has Cairo draw backend only. Draw A different + Current impementation has Cairo draw backend only. Draw A different backends can be added Harbour level API: hb_zebra_create_( cCode [, nFlags ] ) --> hZebra @@ -57,19 +65,19 @@ - 2D barcode support - PDF417 - ; If someone has real scanner it would be nice to do tests and get feedback. + ; If someone has real scanner it would be nice to do tests and get feedback. - ; I guess I've implemented Code 128 encoding (code set selection, etc) that - generates the optimal (shortest) barcode. If someone can find a sample of - barcode that encodes the same data and is shorter than hbzebra's barcode, + ; I guess I've implemented Code 128 encoding (code set selection, etc) that + generates the optimal (shortest) barcode. If someone can find a sample of + barcode that encodes the same data and is shorter than hbzebra's barcode, please inform me. - ; Make system is not working and a requires to be fixed by someone! - This library has properties that possibly could not be solved in current + ; Make system is not working and a requires to be fixed by someone! + This library has properties that possibly could not be solved in current make implementation. It can have multiple draw backends: Cairo, Win32 GDI, - GD, ASCII art, libharu, etc. These depends on system and installed - packages. I do not know howto put all backends into the same hbzebra - library. A separate library for each backend seems to be wasteful way to + GD, ASCII art, libharu, etc. These depends on system and installed + packages. I do not know howto put all backends into the same hbzebra + library. A separate library for each backend seems to be wasteful way to solve a problem, because draw backend implements only one function (a few more functions should be implemented to support EAN/UPC native draw, some 2D barcodes, but backend code size is small). diff --git a/harbour/src/common/hbver.c b/harbour/src/common/hbver.c index 3fdff2d9f4..3d7f8ba234 100644 --- a/harbour/src/common/hbver.c +++ b/harbour/src/common/hbver.c @@ -464,6 +464,7 @@ char * hb_verPlatform( void ) } #if defined( HB_OS_WIN ) + static HB_BOOL s_fWinVerInit = HB_FALSE; static HB_BOOL s_fWinVista = HB_FALSE; @@ -485,11 +486,55 @@ static void s_hb_winVerInit( void ) } s_fWinVerInit = HB_TRUE; } + +#elif defined( HB_OS_DOS ) + +static HB_BOOL s_fWinVerInit = HB_FALSE; + +static HB_BOOL s_fWinVista = HB_FALSE; +static HB_BOOL s_fWin2K = HB_FALSE; +static HB_BOOL s_fWinNT = HB_FALSE; +static HB_BOOL s_fWin9x = HB_FALSE; + +static void s_hb_winVerInit( void ) +{ + union REGS regs; + + /* TODO */ + s_fWinVista = HB_FALSE; + s_fWin2K = HB_FALSE; + + /* Host OS detection: Windows NT family */ + + { + regs.HB_XREGS.ax = 0x3306; + HB_DOS_INT86( 0x21, ®s, ®s ); + + s_fWinNT = ( regs.HB_XREGS.bx == 0x3205 ); + } + + /* Host OS detection: 95/98 */ + + if( ! s_fWinNT ) + { + regs.HB_XREGS.ax = 0x1600; + HB_DOS_INT86( 0x2F, ®s, ®s ); + + s_fWin9x = ( regs.h.al != 0x80 && + regs.h.al != 0xFF && + regs.h.al >= 4 ); + } + else + s_fWin9x = HB_FALSE; + + s_fWinVerInit = HB_TRUE; +} + #endif HB_BOOL hb_iswinvista( void ) { -#if defined( HB_OS_WIN ) +#if defined( HB_OS_WIN ) || defined( HB_OS_DOS ) if( ! s_fWinVerInit ) s_hb_winVerInit(); return s_fWinVista; @@ -500,7 +545,7 @@ HB_BOOL hb_iswinvista( void ) HB_BOOL hb_iswin2k( void ) { -#if defined( HB_OS_WIN ) +#if defined( HB_OS_WIN ) || defined( HB_OS_DOS ) if( ! s_fWinVerInit ) s_hb_winVerInit(); return s_fWin2K; @@ -511,7 +556,7 @@ HB_BOOL hb_iswin2k( void ) HB_BOOL hb_iswinnt( void ) { -#if defined( HB_OS_WIN ) +#if defined( HB_OS_WIN ) || defined( HB_OS_DOS ) if( ! s_fWinVerInit ) s_hb_winVerInit(); return s_fWinNT; @@ -522,7 +567,7 @@ HB_BOOL hb_iswinnt( void ) HB_BOOL hb_iswin9x( void ) { -#if defined( HB_OS_WIN ) +#if defined( HB_OS_WIN ) || defined( HB_OS_DOS ) if( ! s_fWinVerInit ) s_hb_winVerInit(); return s_fWin9x;