From 7c8fcec7f38741e419d11a475d493454204d9288 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 29 Nov 2012 00:30:07 +0000 Subject: [PATCH] 2012-11-29 01:20 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/rddads/ads.ch ! added missing self-guard * contrib/hbmagic/tests/hbmagit.prg * contrib/hbmxml/tests/custom.prg * contrib/hbmxml/tests/reminder.prg * contrib/hbmxml/tests/testmxml.prg % no longer use #include to include standard package headers. Rely on autoload triggered by .hbc file or #require directive. (missed from prev) * contrib/rddads/tests/datad.prg * contrib/rddads/tests/testmg.prg ! fixed to run properly as scripts (need to register RDDs manually in such scenario, maybe this could be automatized?) * contrib/hbwin/hbwin.hbc * contrib/rddads/rddads.hbc + set hbwin.ch and ads.ch as standard headers ; NOTE: Seems that hbct, hbxpp and xhb contribs do not have such what could be called common standard headers. For gtwvg I cannot tell, but probably all three .ch files should be standard. * contrib/hbwin/tests/testax.prg * contrib/hbwin/tests/testcom1.prg * contrib/hbwin/tests/testcom2.prg * contrib/hbwin/tests/testcopy.prg * contrib/hbwin/tests/testevnt.prg * contrib/hbwin/tests/testgdi.prg * contrib/hbwin/tests/testmapi.prg * contrib/hbwin/tests/testprn.prg * contrib/hbwin/tests/testreg.prg * contrib/hbwin/tests/testsvc.prg * contrib/hbzebra/tests/testwin.prg * contrib/rddads/tests/datad.prg * contrib/rddads/tests/testmg.prg % no longer use #include to include standard package headers. Rely on autoload triggered by .hbc file or #require directive. ; WARNING: The autoload feature for standard package headers should be generally harmless, but it might as well pose an INCOMPATIBILITY if user code redefines or simply uses macro names/commands in user code that collide with the ones defined in these standard headers. If this comes up, avoid using .hbc files, until your code is changed/fixed to avoid name collisions either by renames or undeffing the standard ones. As consequence it's even more important to pay attention to macro namespaces used in package headers to avoid accidental collision with user code. This was standard practice for function/class names, now it is extended for macros/user commands. --- harbour/ChangeLog.txt | 64 +++++++++++++++++++++++ harbour/contrib/hbmagic/tests/hbmagit.prg | 2 - harbour/contrib/hbmxml/tests/custom.prg | 2 - harbour/contrib/hbmxml/tests/reminder.prg | 2 - harbour/contrib/hbmxml/tests/testmxml.prg | 1 - harbour/contrib/hbwin/hbwin.hbc | 2 + harbour/contrib/hbwin/tests/testax.prg | 1 - harbour/contrib/hbwin/tests/testcom1.prg | 2 - harbour/contrib/hbwin/tests/testcom2.prg | 2 - harbour/contrib/hbwin/tests/testcopy.prg | 2 - harbour/contrib/hbwin/tests/testevnt.prg | 2 - harbour/contrib/hbwin/tests/testgdi.prg | 2 - harbour/contrib/hbwin/tests/testmapi.prg | 2 - harbour/contrib/hbwin/tests/testprn.prg | 2 - harbour/contrib/hbwin/tests/testreg.prg | 2 - harbour/contrib/hbwin/tests/testsvc.prg | 2 - harbour/contrib/hbzebra/tests/testwin.prg | 2 - harbour/contrib/rddads/ads.ch | 5 ++ harbour/contrib/rddads/rddads.hbc | 2 + harbour/contrib/rddads/tests/datad.prg | 5 +- harbour/contrib/rddads/tests/testmg.prg | 5 +- 21 files changed, 81 insertions(+), 30 deletions(-) diff --git a/harbour/ChangeLog.txt b/harbour/ChangeLog.txt index db768596d3..e3280519b1 100644 --- a/harbour/ChangeLog.txt +++ b/harbour/ChangeLog.txt @@ -10,6 +10,70 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2012-11-29 01:20 UTC+0100 Viktor Szakats (harbour syenar.net) + * contrib/rddads/ads.ch + ! added missing self-guard + + * contrib/hbmagic/tests/hbmagit.prg + * contrib/hbmxml/tests/custom.prg + * contrib/hbmxml/tests/reminder.prg + * contrib/hbmxml/tests/testmxml.prg + % no longer use #include to include standard + package headers. Rely on autoload triggered + by .hbc file or #require directive. + (missed from prev) + + * contrib/rddads/tests/datad.prg + * contrib/rddads/tests/testmg.prg + ! fixed to run properly as scripts + (need to register RDDs manually in such scenario, + maybe this could be automatized?) + + * contrib/hbwin/hbwin.hbc + * contrib/rddads/rddads.hbc + + set hbwin.ch and ads.ch as standard headers + + ; NOTE: Seems that hbct, hbxpp and xhb contribs + do not have such what could be called + common standard headers. + For gtwvg I cannot tell, but probably + all three .ch files should be standard. + + * contrib/hbwin/tests/testax.prg + * contrib/hbwin/tests/testcom1.prg + * contrib/hbwin/tests/testcom2.prg + * contrib/hbwin/tests/testcopy.prg + * contrib/hbwin/tests/testevnt.prg + * contrib/hbwin/tests/testgdi.prg + * contrib/hbwin/tests/testmapi.prg + * contrib/hbwin/tests/testprn.prg + * contrib/hbwin/tests/testreg.prg + * contrib/hbwin/tests/testsvc.prg + * contrib/hbzebra/tests/testwin.prg + * contrib/rddads/tests/datad.prg + * contrib/rddads/tests/testmg.prg + % no longer use #include to include standard + package headers. Rely on autoload triggered + by .hbc file or #require directive. + + ; WARNING: The autoload feature for standard package + headers should be generally harmless, but + it might as well pose an INCOMPATIBILITY + if user code redefines or simply uses + macro names/commands in user code that + collide with the ones defined in these + standard headers. + If this comes up, avoid using .hbc files, + until your code is changed/fixed to avoid + name collisions either by renames or + undeffing the standard ones. + As consequence it's even more important + to pay attention to macro namespaces used + in package headers to avoid accidental + collision with user code. This was standard + practice for function/class names, now it + is extended for macros/user commands. + 2012-11-29 00:49 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbwin/hbole.ch ! missing svn props diff --git a/harbour/contrib/hbmagic/tests/hbmagit.prg b/harbour/contrib/hbmagic/tests/hbmagit.prg index 121d450d5c..e8c9478a66 100644 --- a/harbour/contrib/hbmagic/tests/hbmagit.prg +++ b/harbour/contrib/hbmagic/tests/hbmagit.prg @@ -52,8 +52,6 @@ #require "hbmagic" -#include "hbmagic.ch" - #xcommand T( <(title)>, <(subject)> ) => ; magic_setflags( hMagic, MAGIC_NONE ) ;; OutStd( hb_StrFormat( + ": t: [%s] ", magic_buffer( hMagic, <subject> ) ) ) ;; diff --git a/harbour/contrib/hbmxml/tests/custom.prg b/harbour/contrib/hbmxml/tests/custom.prg index 367f051563..fa3c990185 100644 --- a/harbour/contrib/hbmxml/tests/custom.prg +++ b/harbour/contrib/hbmxml/tests/custom.prg @@ -6,8 +6,6 @@ #xtranslate _ENCODE( <xData> ) => ( hb_base64Encode( hb_Serialize( mxmlGetCustom( <xData> ) ) ) ) -#include "hbmxml.ch" - PROCEDURE Main() LOCAL tree, node diff --git a/harbour/contrib/hbmxml/tests/reminder.prg b/harbour/contrib/hbmxml/tests/reminder.prg index f1d6f778b7..2b3aa14bf6 100644 --- a/harbour/contrib/hbmxml/tests/reminder.prg +++ b/harbour/contrib/hbmxml/tests/reminder.prg @@ -4,8 +4,6 @@ #require "hbmxml" -#include "hbmxml.ch" - STATIC s_mxml_error := .F. STATIC s_mxml_error_msg := "" diff --git a/harbour/contrib/hbmxml/tests/testmxml.prg b/harbour/contrib/hbmxml/tests/testmxml.prg index 7c8d8fe6fc..0fb9485aa6 100644 --- a/harbour/contrib/hbmxml/tests/testmxml.prg +++ b/harbour/contrib/hbmxml/tests/testmxml.prg @@ -21,7 +21,6 @@ #require "hbmxml" -#include "hbmxml.ch" #include "simpleio.ch" REQUEST HB_GT_CGI_DEFAULT diff --git a/harbour/contrib/hbwin/hbwin.hbc b/harbour/contrib/hbwin/hbwin.hbc index 430c0d4b44..dd25e7935c 100644 --- a/harbour/contrib/hbwin/hbwin.hbc +++ b/harbour/contrib/hbwin/hbwin.hbc @@ -8,6 +8,8 @@ skip={!allwin} incpaths=. +headers=${hb_name}.ch + libs=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF} libs=png {wce}libs=sms CellCore diff --git a/harbour/contrib/hbwin/tests/testax.prg b/harbour/contrib/hbwin/tests/testax.prg index 807bb26cff..dd77627b53 100644 --- a/harbour/contrib/hbwin/tests/testax.prg +++ b/harbour/contrib/hbwin/tests/testax.prg @@ -6,7 +6,6 @@ #include "hbgtinfo.ch" #include "hbclass.ch" -#include "hbwin.ch" #if ! defined( __HBSCRIPT__HBSHELL ) REQUEST HB_GT_WVT_DEFAULT diff --git a/harbour/contrib/hbwin/tests/testcom1.prg b/harbour/contrib/hbwin/tests/testcom1.prg index ddb56d9543..b4399b7086 100644 --- a/harbour/contrib/hbwin/tests/testcom1.prg +++ b/harbour/contrib/hbwin/tests/testcom1.prg @@ -52,8 +52,6 @@ #require "hbwin" -#include "hbwin.ch" - PROCEDURE Main( cPortName ) LOCAL oWinPort := win_com():Init( cPortName, WIN_CBR_9600, WIN_NOPARITY, 8, WIN_ONESTOPBIT ) diff --git a/harbour/contrib/hbwin/tests/testcom2.prg b/harbour/contrib/hbwin/tests/testcom2.prg index ef6f68aaef..db190acd38 100644 --- a/harbour/contrib/hbwin/tests/testcom2.prg +++ b/harbour/contrib/hbwin/tests/testcom2.prg @@ -52,8 +52,6 @@ #require "hbwin" -#include "hbwin.ch" - PROCEDURE Main( cPortName ) LOCAL oWinPort diff --git a/harbour/contrib/hbwin/tests/testcopy.prg b/harbour/contrib/hbwin/tests/testcopy.prg index dc80695147..e6867d74b1 100644 --- a/harbour/contrib/hbwin/tests/testcopy.prg +++ b/harbour/contrib/hbwin/tests/testcopy.prg @@ -12,8 +12,6 @@ #require "hbwin" -#include "hbwin.ch" - #include "simpleio.ch" PROCEDURE Main() diff --git a/harbour/contrib/hbwin/tests/testevnt.prg b/harbour/contrib/hbwin/tests/testevnt.prg index 27782aef5a..a0baba9509 100644 --- a/harbour/contrib/hbwin/tests/testevnt.prg +++ b/harbour/contrib/hbwin/tests/testevnt.prg @@ -12,8 +12,6 @@ #require "hbwin" -#include "hbwin.ch" - PROCEDURE Main() ? win_ReportEvent( NIL, "Application", WIN_EVENTLOG_SUCCESS, 0, 0, "hello" ) diff --git a/harbour/contrib/hbwin/tests/testgdi.prg b/harbour/contrib/hbwin/tests/testgdi.prg index beb5ea8193..41b16cdaae 100644 --- a/harbour/contrib/hbwin/tests/testgdi.prg +++ b/harbour/contrib/hbwin/tests/testgdi.prg @@ -15,8 +15,6 @@ #include "simpleio.ch" -#include "hbwin.ch" - PROCEDURE Main() LOCAL cPrinterName := "Microsoft XPS Document Writer" diff --git a/harbour/contrib/hbwin/tests/testmapi.prg b/harbour/contrib/hbwin/tests/testmapi.prg index 39ea3bf682..6c35acaeb1 100644 --- a/harbour/contrib/hbwin/tests/testmapi.prg +++ b/harbour/contrib/hbwin/tests/testmapi.prg @@ -6,8 +6,6 @@ #include "simpleio.ch" -#include "hbwin.ch" - PROCEDURE Main() LOCAL cSubject := "Test subject" diff --git a/harbour/contrib/hbwin/tests/testprn.prg b/harbour/contrib/hbwin/tests/testprn.prg index 17b8915251..87b18d9152 100644 --- a/harbour/contrib/hbwin/tests/testprn.prg +++ b/harbour/contrib/hbwin/tests/testprn.prg @@ -4,8 +4,6 @@ #require "hbwin" -#include "hbwin.ch" - PROCEDURE Main( cPar1 ) LOCAL nPrn := 1 diff --git a/harbour/contrib/hbwin/tests/testreg.prg b/harbour/contrib/hbwin/tests/testreg.prg index 9c44b799e3..70a50f35d2 100644 --- a/harbour/contrib/hbwin/tests/testreg.prg +++ b/harbour/contrib/hbwin/tests/testreg.prg @@ -4,8 +4,6 @@ #require "hbwin" -#include "hbwin.ch" - #define KEY_WOW64_64KEY 0x0100 #define KEY_WOW64_32KEY 0x0200 diff --git a/harbour/contrib/hbwin/tests/testsvc.prg b/harbour/contrib/hbwin/tests/testsvc.prg index 69c2d0a0d2..183973f042 100644 --- a/harbour/contrib/hbwin/tests/testsvc.prg +++ b/harbour/contrib/hbwin/tests/testsvc.prg @@ -52,8 +52,6 @@ #if ! defined( __HBSCRIPT__HBSHELL ) -#include "hbwin.ch" - #define _SERVICE_NAME "Harbour_Test_Service" PROCEDURE Main( cMode ) diff --git a/harbour/contrib/hbzebra/tests/testwin.prg b/harbour/contrib/hbzebra/tests/testwin.prg index bafe23f04c..68d8f20619 100644 --- a/harbour/contrib/hbzebra/tests/testwin.prg +++ b/harbour/contrib/hbzebra/tests/testwin.prg @@ -13,8 +13,6 @@ #require "hbzebra" #require "hbwin" -#include "hbwin.ch" - PROCEDURE Main() LOCAL hDC diff --git a/harbour/contrib/rddads/ads.ch b/harbour/contrib/rddads/ads.ch index 310fae6640..af22b1071e 100644 --- a/harbour/contrib/rddads/ads.ch +++ b/harbour/contrib/rddads/ads.ch @@ -70,6 +70,9 @@ -DADS_LIB_VERSION=500 */ +#ifndef ADS_CH_ +#define ADS_CH_ + /* Supported file types */ #define ADS_NTX 1 #define ADS_CDX 2 @@ -321,3 +324,5 @@ [; dbSetIndex( <(index1)> )] ; [; dbSetIndex( <(indexn)> )] ; ; END + +#endif diff --git a/harbour/contrib/rddads/rddads.hbc b/harbour/contrib/rddads/rddads.hbc index 65c37568c5..d0d8b72304 100644 --- a/harbour/contrib/rddads/rddads.hbc +++ b/harbour/contrib/rddads/rddads.hbc @@ -11,6 +11,8 @@ skip={!(linux|win)} incpaths=. +headers=ads.ch + {HB_DYNLOAD_RDDADS}prgflags=-D__HBDYNLOAD__RDDADS__ # Dynamic loading requires -shared executable, but # let's leave enabling that to the host project. diff --git a/harbour/contrib/rddads/tests/datad.prg b/harbour/contrib/rddads/tests/datad.prg index d32f4d0d82..fa473ac2f7 100644 --- a/harbour/contrib/rddads/tests/datad.prg +++ b/harbour/contrib/rddads/tests/datad.prg @@ -8,7 +8,6 @@ #require "rddads" -#include "ads.ch" REQUEST ADS #if defined( __HBDYNLOAD__RDDADS__ ) @@ -22,6 +21,10 @@ PROCEDURE Main() LOCAL aStru := { { "ID", "A", 1, 0 }, { "Name", "C", 50, 0 }, { "address", "C", 50, 0 }, { "city", "C", 30, 0 }, { "Age", "n", 3, 0 } } LOCAL hConnection1 +#if defined( __HBSCRIPT__HBSHELL ) + rddRegister( "ADSADT" ) +#endif + #if defined( __HBDYNLOAD__RDDADS__ ) LOCAL l := hb_libLoad( hb_libName( "rddads" + hb_libPostfix() ) ) diff --git a/harbour/contrib/rddads/tests/testmg.prg b/harbour/contrib/rddads/tests/testmg.prg index 834585b8bb..69ef51ed7d 100644 --- a/harbour/contrib/rddads/tests/testmg.prg +++ b/harbour/contrib/rddads/tests/testmg.prg @@ -53,7 +53,6 @@ #require "rddads" #include "ord.ch" -#include "ads.ch" REQUEST ADS @@ -66,6 +65,10 @@ PROCEDURE Main() LOCAL i LOCAL aRay +#if defined( __HBSCRIPT__HBSHELL ) + rddRegister( "ADS" ) +#endif + #if defined( __HBDYNLOAD__RDDADS__ ) LOCAL l := hb_libLoad( hb_libName( "rddads" + hb_libPostfix() ) )