From 6603c2e83b70793fd4b39f30ba1c4c406eeac032 Mon Sep 17 00:00:00 2001 From: April White Date: Sat, 7 Nov 2009 02:13:20 +0000 Subject: [PATCH] * harbour/examples/hbdoc2/genhtml.prg * harbour/examples/hbdoc2/gentpl.prg * harbour/examples/hbdoc2/gentxt.prg * harbour/examples/hbdoc2/genxml.prg * harbour/examples/hbdoc2/hbdoc2.ch * harbour/examples/hbdoc2/hbdoc2.prg * harbour/examples/hbdoc2/tmplates.prg * internal refactoring * harbour/doc/en-EN/cmdline.txt * harbour/doc/en-EN/compiler.txt * harbour/doc/en-EN/gnulice.txt * harbour/doc/en-EN/license.txt * harbour/doc/en-EN/macro.txt * harbour/doc/en-EN/rdddb.txt * harbour/doc/en-EN/strtotype.txt * minor formatting --- harbour/ChangeLog | 216 ++++++----- harbour/doc/en-EN/cmdline.txt | 2 + harbour/doc/en-EN/compiler.txt | 2 + harbour/doc/en-EN/gnulice.txt | 5 +- harbour/doc/en-EN/license.txt | 4 +- harbour/doc/en-EN/macro.txt | 2 + harbour/doc/en-EN/rdddb.txt | 14 +- harbour/doc/en-EN/strotype.txt | 2 + harbour/examples/hbdoc2/genhtml.prg | 155 +++++--- harbour/examples/hbdoc2/gentpl.prg | 78 ++-- harbour/examples/hbdoc2/gentxt.prg | 109 ++++-- harbour/examples/hbdoc2/genxml.prg | 115 +++--- harbour/examples/hbdoc2/hbdoc2.ch | 12 +- harbour/examples/hbdoc2/hbdoc2.prg | 507 +++++++++++++------------ harbour/examples/hbdoc2/tmplates.prg | 533 ++++++++++++++------------- 15 files changed, 976 insertions(+), 780 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 400ccf1943..bb25d33329 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,24 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-07 03:11 UTC+0600 April White (april users.sourceforge.net) + * harbour/examples/hbdoc2/genhtml.prg + * harbour/examples/hbdoc2/gentpl.prg + * harbour/examples/hbdoc2/gentxt.prg + * harbour/examples/hbdoc2/genxml.prg + * harbour/examples/hbdoc2/hbdoc2.ch + * harbour/examples/hbdoc2/hbdoc2.prg + * harbour/examples/hbdoc2/tmplates.prg + * internal refactoring + * harbour/doc/en-EN/cmdline.txt + * harbour/doc/en-EN/compiler.txt + * harbour/doc/en-EN/gnulice.txt + * harbour/doc/en-EN/license.txt + * harbour/doc/en-EN/macro.txt + * harbour/doc/en-EN/rdddb.txt + * harbour/doc/en-EN/strtotype.txt + * minor formatting + 2009-11-06 16:15 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contib/rddads/adsfunc.c * AdsIsConnectionAlive() guarded using #if ADS_LIB_VERSION >= 800 @@ -48,20 +66,20 @@ 2009-11-05 19:25 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg - ! Deleted 'lib' prefix for os2/gcc targets to sync it + ! Deleted 'lib' prefix for os2/gcc targets to sync it with Harbour GNU make build setup. See my mail on dev list for other options. 2009-11-05 15:10 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg * config/os2/gcc.mk - ! Fixed to use .lib extension in gccomf mode. As far I could - debunk it from lenghty e-mail, this is the default extension for + ! Fixed to use .lib extension in gccomf mode. As far I could + debunk it from lenghty e-mail, this is the default extension for libs, used by OS/2 GCC in OMF mode. If not, don't blame me. ! Fixed to not use lib prefix in gccomf mode. - It does seem alright but due to no testing again give me - *very short correction information*, if this turns out to be + It does seem alright but due to no testing again give me + *very short correction information*, if this turns out to be false. * contrib/hbct/disk.c @@ -82,18 +100,18 @@ 2009-11-04 17:06 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg * config/os2/gcc.mk - * Changed to use GCC default extensions for objects and libs + * Changed to use GCC default extensions for objects and libs even in OMF mode. ! This fixed hbmk2 problems reported by David Arturo Macias Corona. - ; Please verify if now also changed lib extension didn't create + ; Please verify if now also changed lib extension didn't create any new problem in hbmk2, f.e. when using -strip option. 2009-11-04 09:14 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * INSTALL - + Added EXAMPLEs for Windows SDK 7. There is included compiler - there for almost all combinations, only Itanium didn't work + + Added EXAMPLEs for Windows SDK 7. There is included compiler + there for almost all combinations, only Itanium didn't work for me out of the box. - This is the simplest and most slim way to use MSVC compiler, + This is the simplest and most slim way to use MSVC compiler, and also free. 2009-11-03 13:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -114,7 +132,7 @@ 2009-11-02 12:06 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * config/win/bcc.mk - ! Fixed -I order after recent change to not interfere with + ! Fixed -I order after recent change to not interfere with embedded pcre headers. 2009-11-02 10:26 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) @@ -124,9 +142,9 @@ 2009-11-02 10:21 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * config/win/bcc.mk - + Added hack to automatically configure bcc compilers - which makes proper setup of bcc32.cfg and ilink32.cfg - unnecessary. NOTE: This only works if you use compiler + + Added hack to automatically configure bcc compilers + which makes proper setup of bcc32.cfg and ilink32.cfg + unnecessary. NOTE: This only works if you use compiler autodetection, which means DON'T set HB_COMPILER to bcc manually. ; Please make tests, f.e. I didn't test .dll creation. @@ -135,11 +153,11 @@ + Exporting autodetected compiler PATH. * config/rules.mk - * Moved linker flags before output name option to make + * Moved linker flags before output name option to make some tools happy (bcc in this case). * INSTALL - - Deleted just added extra NOTE for bcc users. Now it should + - Deleted just added extra NOTE for bcc users. Now it should be configured automatically. 2009-11-01 20:11 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) @@ -418,17 +436,17 @@ + Added few more debug constructs. + Replaced delete ( QObject * ) obj => ( ( QObject * ) obj )->~QObject(). - This is the documented method. But nevertheless there is no difference - in the two approaches. Actually "delete" operator redirects the call to + This is the documented method. But nevertheless there is no difference + in the two approaches. Actually "delete" operator redirects the call to ~Qobject(). ! Reworked the sequence of Class destuction logic. - Lorenzo, please rebuild and report back if exiting demoxbp still GPFs + Lorenzo, please rebuild and report back if exiting demoxbp still GPFs on Ubuntu. - + 2009-11-02 02:14 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * config/global.mk - + Added autodetection of x86_64 architecture on win platform + + Added autodetection of x86_64 architecture on win platform even when using 32-bit build of GNU Make. (This makes usage of 64-bit build of GNU Make less important.) @@ -446,9 +464,9 @@ 2009-11-01 17:02 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * include/hbdefs.h - * Changed HB_SIZE to ULONG. Added TOFIX to later change it - to 'long'. With its current setup it's possible to gradually - change 'ULONG' usages to 'HB_SIZE' when used as string/array + * Changed HB_SIZE to ULONG. Added TOFIX to later change it + to 'long'. With its current setup it's possible to gradually + change 'ULONG' usages to 'HB_SIZE' when used as string/array length ot index. This can be a gradual process. 2009-11-01 16:58 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) @@ -462,31 +480,31 @@ * config/detect.mk - Disabled OpenSSL detection for bcc. For some reason it's building with errors now. - I can't figure what change caused this as it was building - fine a month ago. It's not the hbssl source code, openssl + I can't figure what change caused this as it was building + fine a month ago. It's not the hbssl source code, openssl sources are the same, I have no time to figure it out. Anyway it wasn't working with bcc at link time anyway. 2009-11-01 11:35 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * include/hbdefs.h - + Added new planned types. These are meant to replace previous - proposition with the format 'hb'. New ones use usual + + Added new planned types. These are meant to replace previous + proposition with the format 'hb'. New ones use usual 'HB_' format. Also added HB_TRUE and HB_FALSE. - These new names don't look alien at all in code, so hopefully - we can go into the transition with more courage. As a plus, - some of the HB_TYPE format types are already implemented and + These new names don't look alien at all in code, so hopefully + we can go into the transition with more courage. As a plus, + some of the HB_TYPE format types are already implemented and used (HB_WCHAR, HB_LONG, HB_ULONG, etc). - A new important type is HB_SIZE, which I hope will replace + A new important type is HB_SIZE, which I hope will replace ULONG for string and array indices. * Changed HB_CHAR to be declared as 'char' instead of 'BYTE'. - (this type was added long ago, but is not yet used anywhere + (this type was added long ago, but is not yet used anywhere in code) * Changed HB_COLOR to be declared as 'int' instead of 'BYTE'. - (this type was added long ago, but is not yet used anywhere - in code, since then we've settled to 'int' to represent - colors. Pbly we should move to use this abstract type instead + (this type was added long ago, but is not yet used anywhere + in code, since then we've settled to 'int' to represent + colors. Pbly we should move to use this abstract type instead of int in code.) - ; I left hb code as of yet, but if there is no objection, + ; I left hb code as of yet, but if there is no objection, I'd like to remove them. ; Here are the new types: @@ -504,12 +522,12 @@ HB_ULONGLONG HB_I8 HB_U8 - HB_I16 ( HB_I16_MIN, HB_I16_MAX ) + HB_I16 ( HB_I16_MIN, HB_I16_MAX ) HB_U16 ( HB_U16_MAX ) HB_I32 ( HB_I32_MIN, HB_I32_MAX ) - HB_U32 ( HB_U32_MAX ) + HB_U32 ( HB_U32_MAX ) HB_I64 ( HB_I64_MIN, HB_I64_MAX ) - HB_U64 ( HB_U64_MAX ) + HB_U64 ( HB_U64_MAX ) HB_SCHAR HB_UCHAR HB_SIZE @@ -524,13 +542,13 @@ 2009-11-01 09:41 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added plans (TODO) for next gen compiler autodetection. - This will surpass currently implemented autodetection in - build system. The basic feature added is detection of all - compilers supported by Harbour installation, so it's not - possible to select one which is not installed, plus more - feedback can be given to user. It also cleans embedded vs - in-PATH compilers and gives an easier way to prioritize - found compilers. This is definitely scheduled after + This will surpass currently implemented autodetection in + build system. The basic feature added is detection of all + compilers supported by Harbour installation, so it's not + possible to select one which is not installed, plus more + feedback can be given to user. It also cleans embedded vs + in-PATH compilers and gives an easier way to prioritize + found compilers. This is definitely scheduled after 2.0.0 release, and when I have (more) time. 2009-10-31 10:23 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) @@ -549,7 +567,7 @@ * contrib/qtgui/QTableView.cpp * contrib/qtgui/TQTableView.prg ! Some more debug information included. - Please note that the build may be broken, so bear with me for a + Please note that the build may be broken, so bear with me for a couple of days. Lorenzo, you can continue with experiments. 2009-10-31 16:42 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -577,10 +595,10 @@ 2009-10-31 10:45 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + w64-make.exe + Added win64 build of GNU Make 3.81.90-CVS-20090901. - Experimental. On 64-bit Windows systems it's generally - recommended to use this version, but please be aware of - the experimental nature of this build yet. There are - some pending patches in GNU Make bug tracker, plus latest + Experimental. On 64-bit Windows systems it's generally + recommended to use this version, but please be aware of + the experimental nature of this build yet. There are + some pending patches in GNU Make bug tracker, plus latest CVS is broken so I used the latest good one. 2009-10-31 02:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -593,10 +611,10 @@ 2009-10-31 00:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * INSTALL - + Added NOTE for Borland C++ users how to setup their + + Added NOTE for Borland C++ users how to setup their compiler. This is repetition of Borland readme content - which seemingly nobody reads and do this day many users - get wrong. I'm not sure if these same users will read + which seemingly nobody reads and do this day many users + get wrong. I'm not sure if these same users will read INSTALL, but let's give it a try. * ChangeLog @@ -609,7 +627,7 @@ 2009-10-30 22:25 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * package/winuni/RELNOTES + Provisions for next version: MinGW 4.4.1 updated documented. - Now at TDM-2, fixing some seriously looking performance + Now at TDM-2, fixing some seriously looking performance problem. (tdragon.net distro) 2009-10-30 21:07 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) @@ -708,9 +726,9 @@ FILEFINDDATE( ) -> FILEFINDTIME( ) -> (as "HH:MM:SS") It's an alternative to DIRECTORY()/FILE() functions. - ; NOTE: To release the file find handle on some platforms - (like Windows), and allow deletion of the dir we've - been scanning, should go out of scope or + ; NOTE: To release the file find handle on some platforms + (like Windows), and allow deletion of the dir we've + been scanning, should go out of scope or be explicitly release by freeing variable. To make this easy, some may want to add: #xtranslate FILEFINDCLOSE( ) => \( := NIL \) @@ -796,13 +814,13 @@ 2009-10-29 08:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg ! Fixes to lib dependency detection code. - It should now work on darwin/bsd/hpux/beos gcc/clang/sunpro + It should now work on darwin/bsd/hpux/beos gcc/clang/sunpro platforms/compilers but obviously I didn't test them all (only darwin/clang). - There was one typo hitting generic branch of lib detection + There was one typo hitting generic branch of lib detection plus lib prefix was not taken into account at all there. - Probably on some platforms it would be better to implement - target specific lib searching algorithm to mimic actual + Probably on some platforms it would be better to implement + target specific lib searching algorithm to mimic actual linker behaviour. Currently, differences are to be expected. - Deleted gccomf from a win/wce only branch in LibExists(). @@ -850,14 +868,14 @@ * contrib/hbxbp/xbpwindow.prg * contrib/hbxbp/tests/demoxbp.prg - + ! Fixes to release objects in proper order. - Now demoxbp.exe terminates fine. Also you can + Now demoxbp.exe terminates fine. Also you can open as many dialogs as you want. Closing next dialog releases the memory belonging to Qt objects but still - I have to investigate why whole of thread memory is not - released. So I have kept debug code intact. Just play with - current code, may be you can pin-point where Xbp*classes + I have to investigate why whole of thread memory is not + released. So I have kept debug code intact. Just play with + current code, may be you can pin-point where Xbp*classes need more tweaks. 2009-10-28 09:13 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -884,13 +902,13 @@ * Replaced duplicated constant with HB_SIZEOFARRAY() macro. * utils/hbmk2/hbmk2.prg - + C compiler autodetection will now make sure to skip compilers + + C compiler autodetection will now make sure to skip compilers where required Harbour core libraries aren't installed. - This autodetection is disabled when HB_LIB_INSTALL is set - manually and also when lib/ dir is missing altogether, - assuming there is a single-compiler installation used in this + This autodetection is disabled when HB_LIB_INSTALL is set + manually and also when lib/ dir is missing altogether, + assuming there is a single-compiler installation used in this case (where such autodetection cannot work reliably). - When using -info option, a screen message is shown if + When using -info option, a screen message is shown if autodetected C compiler is skipped for above reason. 2009-10-27 11:51 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -953,12 +971,12 @@ * contrib/hbwin/win_dll.c % Deleted cDLL structure member. - - Deleted __XHARBOUR__ guarded parts (related to C structure handling, + - Deleted __XHARBOUR__ guarded parts (related to C structure handling, probably never tested, plus it didn't look something mature anyway) - ; TOFIX: win64 .dll support, strangely testdll gives slightly - different results for BCC and MSVC builds (and MINGW - builds where it GPFs), also UNICODE isn't supported at all. + ; TOFIX: win64 .dll support, strangely testdll gives slightly + different results for BCC and MSVC builds (and MINGW + builds where it GPFs), also UNICODE isn't supported at all. So I guess Harbour .dll handling would better be rewritten. 2009-10-27 00:01 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -1015,7 +1033,7 @@ 2009-10-26 14:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/vm/maindllp.c ! Using hb_getProcAddress() instead of GetProcAddress(). - Idea submitted to the list, I didn't make any tests, so + Idea submitted to the list, I didn't make any tests, so review it and change it as needed. * contrib/xhb/hbcompat.ch @@ -1313,7 +1331,7 @@ ! Optimized CLASS code. ! Reworked some classes. - TODO: demoxbp.exe terminates with GPF. I know what is that. + TODO: demoxbp.exe terminates with GPF. I know what is that. It will take another couple of days to fix. Now Harbour has a native GUI framework we can build upon our castles. @@ -1840,7 +1858,7 @@ * contrib/hbqt/qtwebkit/QWebPage.cpp * contrib/hbqt/qtwebkit/QWebSecurityOrigin.cpp * contrib/hbqt/qtwebkit/QWebView.cpp - + ! Updated to recent GC upgrade plus more classes brought to the GC. 2009-10-23 21:01 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -1975,7 +1993,7 @@ * contrib/hbqt/qtnetwork/Makefile * contrib/hbqt/Makefile + contrib/hbqt/detect.mk - % Moved QT detection and common setup task to separate .mk file + % Moved QT detection and common setup task to separate .mk file to avoid redundancy. 2009-10-23 09:46 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -2163,7 +2181,7 @@ ! Minor cleanups and fixes after recent restructuring. Nice job Pritpal. - ; TODO: Since now QT detection .mk code will be replicated + ; TODO: Since now QT detection .mk code will be replicated in 10 places, this will have to be optimized. [DONE] ; TOFIX: static mode. [DONE] @@ -3261,10 +3279,10 @@ + contrib/hbqt/qtwebkit/TQWebView.prg * contrib/hbqt/tests/demoqt.prg - + ! A lot of changes. Please expect some instability for some time. demoqt.prg compiles and executes fine. HBXBP is in the pipeline. - + Viktor, please set the make system in place. 2009-10-21 17:09 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) @@ -3309,7 +3327,7 @@ * contrib/rddads/adsfunc.c * contrib/rddads/rddads.h * contrib/rddads/ads1.c - ! Fixed fatal errors for 64-bit builds. I don't know if there exist + ! Fixed fatal errors for 64-bit builds. I don't know if there exist a 64-bit version of ACE, but anyway. 2009-10-20 13:48 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) @@ -3327,20 +3345,20 @@ 2009-10-20 01:20 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added option to control C compiler warning level: - -warn=yes mode will set the warning level exactly - the same way as it's set for Harbour builds. This + -warn=yes mode will set the warning level exactly + the same way as it's set for Harbour builds. This is also the default setting. - This setting is usually the highest useful setting, - which sometimes equals to C compiler default, sometimes + This setting is usually the highest useful setting, + which sometimes equals to C compiler default, sometimes not. - -warn=no mode will try to turn off warnings. This works - exactly the same way as disabling warnings in Harbour - builds. Notice this isn't supported with all C compilers, - and with some compilers this equals to default C compiler - mode. This mode isn't recommended for any sort of serious + -warn=no mode will try to turn off warnings. This works + exactly the same way as disabling warnings in Harbour + builds. Notice this isn't supported with all C compilers, + and with some compilers this equals to default C compiler + mode. This mode isn't recommended for any sort of serious work. - -warn=def mode will leave everything as is, IOW to - C compiler defaults. There is no equivalent setting in + -warn=def mode will leave everything as is, IOW to + C compiler defaults. There is no equivalent setting in Harbour builds. * config/wce/poccarm.mk @@ -3455,7 +3473,7 @@ * Renamed few macros in hbwin / win_com implementation: FCN* -> WIN_COM_FUN_* WPDBG* -> WIN_COM_DBG_* - ; TOFIX: Some errors are left in hbgd/test_out.prg and + ; TOFIX: Some errors are left in hbgd/test_out.prg and gtwvg to be fixed, now the can't be built. Please do it. @@ -3522,8 +3540,8 @@ * contrib/hbbtree/tests/hbmk.hbm + Added -w3 Harbour switch to all test dirs. (in few places just formatted because it was there) - ; TOFIX: All tests should be eventually made fully - warning free, so in the future expect -es2 + ; TOFIX: All tests should be eventually made fully + warning free, so in the future expect -es2 switch to be added as well. [DONE] * contrib/hbwin/tests/testprn.prg diff --git a/harbour/doc/en-EN/cmdline.txt b/harbour/doc/en-EN/cmdline.txt index c6a5a2b273..ebe6149234 100644 --- a/harbour/doc/en-EN/cmdline.txt +++ b/harbour/doc/en-EN/cmdline.txt @@ -9,6 +9,8 @@ * Command line utility * $CATEGORY$ * Document + * $SUBCATEGORY$ + * Compiler * $ONELINER$ * Compiler Options * $DESCRIPTION$ diff --git a/harbour/doc/en-EN/compiler.txt b/harbour/doc/en-EN/compiler.txt index 487b2df783..e58e5dde94 100644 --- a/harbour/doc/en-EN/compiler.txt +++ b/harbour/doc/en-EN/compiler.txt @@ -9,6 +9,8 @@ * Compiler Options * $CATEGORY$ * Document + * $SUBCATEGORY$ + * Compiler * $ONELINER$ * Compiler Options * $DESCRIPTION$ diff --git a/harbour/doc/en-EN/gnulice.txt b/harbour/doc/en-EN/gnulice.txt index 6462963cec..2068340d20 100644 --- a/harbour/doc/en-EN/gnulice.txt +++ b/harbour/doc/en-EN/gnulice.txt @@ -9,6 +9,8 @@ * GNU License * $CATEGORY$ * Document + * $SUBCATEGORY$ + * License * $ONELINER$ * Gnu License File Part 1 * $DESCRIPTION$ @@ -224,6 +226,8 @@ * GNU License * $CATEGORY$ * Document + * $SUBCATEGORY$ + * License * $ONELINER$ * Gnu License File Part 2 * $DESCRIPTION$ @@ -383,7 +387,6 @@ * to do, use the GNU Library General Public License instead of this * License. * - * * FSF & GNU inquiries & questions to gnu@gnu.org. * Copyright notice above. * diff --git a/harbour/doc/en-EN/license.txt b/harbour/doc/en-EN/license.txt index 707b5a0de7..38fcae5901 100644 --- a/harbour/doc/en-EN/license.txt +++ b/harbour/doc/en-EN/license.txt @@ -6,9 +6,11 @@ * $TEMPLATE$ * Document * $NAME$ - * License + * Harbour License * $CATEGORY$ * Document + * $SUBCATEGORY$ + * License * $ONELINER$ * Harbour License * $DESCRIPTION$ diff --git a/harbour/doc/en-EN/macro.txt b/harbour/doc/en-EN/macro.txt index 77b51d013e..d7c4a75e46 100644 --- a/harbour/doc/en-EN/macro.txt +++ b/harbour/doc/en-EN/macro.txt @@ -9,6 +9,8 @@ * Macro compiler * $CATEGORY$ * Document + * $SUBCATEGORY$ + * Compiler * $ONELINER$ * Macro compiler * $DESCRIPTION$ diff --git a/harbour/doc/en-EN/rdddb.txt b/harbour/doc/en-EN/rdddb.txt index 09e9bf2be4..2799a4ed3d 100644 --- a/harbour/doc/en-EN/rdddb.txt +++ b/harbour/doc/en-EN/rdddb.txt @@ -739,15 +739,15 @@ * $SUBCATEGORY$ * Database * $ONELINER$ - * This function locks the record basedon identify + * This function locks the record based on identity * $SYNTAX$ * DBRLOCK([]) --> lSuccess * $ARGUMENTS$ - * Record indetifier + * Record identifier * $RETURNS$ * DBRLOCK() returns a logical true (.T.) if lock was successful * $DESCRIPTION$ - * This function attempts to lock a record which is indentified + * This function attempts to lock a record which is identified * by in the active data set. If the lock is successful * the function will return a logical true (.T.) value; otherwise * a logical false (.F.) will be returned. If is not @@ -784,7 +784,7 @@ * $SUBCATEGORY$ * Database * $ONELINER$ - * This function return a list of records in the database work area + * This function return a list of locked records in the database work area * $SYNTAX$ * DBRLOCKLIST() --> aRecordLocks * $RETURNS$ @@ -792,7 +792,7 @@ * $DESCRIPTION$ * This function will return an array of locked records in a given * and active work area. If the return array is an empty array - * (meaning no elements in it), then there are no locked record in that + * (meaning no elements in it), then there are no locked records in that * work area. * $EXAMPLES$ * FUNCTION Main() @@ -830,11 +830,11 @@ * $SUBCATEGORY$ * Database * $ONELINER$ - * Unlocks a record base on its indentifier + * Unlocks a record based on its identifier * $SYNTAX$ * DBRUNLOCK([]) * $ARGUMENTS$ - * Record indentifier,tipicaly a record number + * Record identifier, typically a record number * $DESCRIPTION$ * This function will attempt to unlock the record specified as * , which in a .dbf format is the record number. If not diff --git a/harbour/doc/en-EN/strotype.txt b/harbour/doc/en-EN/strotype.txt index b2ab9f51fc..9157d50637 100644 --- a/harbour/doc/en-EN/strotype.txt +++ b/harbour/doc/en-EN/strotype.txt @@ -9,6 +9,8 @@ * Strong Typing * $CATEGORY$ * Document + * $SUBCATEGORY$ + * Compiler * $ONELINER$ * Compile-Time type checking * $DESCRIPTION$ diff --git a/harbour/examples/hbdoc2/genhtml.prg b/harbour/examples/hbdoc2/genhtml.prg index 3004f69797..7f8a179364 100644 --- a/harbour/examples/hbdoc2/genhtml.prg +++ b/harbour/examples/hbdoc2/genhtml.prg @@ -65,112 +65,176 @@ svn propset svn:eol-style native "filename" #include "fileio.ch" #include "hbdoc2.ch" -STATIC s_lCreateStyleDocument := .T. - #ifdef __PLATFORM__DOS #define EXTENSION "htm" #else #define EXTENSION "html" #endif - CLASS GenerateHTML2 FROM GenerateHTML - - METHOD New( cFolder, cFilename, cTitle, cDescription ) - + METHOD NewIndex( cFolder, cFilename, cTitle ) + METHOD NewDocument( cFolder, cFilename, cTitle ) ENDCLASS -METHOD New( cFolder, cFilename, cTitle, cDescription ) CLASS GenerateHTML2 - +METHOD NewDocument( cFolder, cFilename, cTitle ) CLASS GenerateHTML2 ::lNewDocumentModel := .T. + super:NewDocument( cFolder, cFilename, cTitle, EXTENSION ) + RETURN self - super:New( cFolder, cFilename, cTitle, cDescription, EXTENSION ) - +METHOD NewIndex( cFolder, cFilename, cTitle ) CLASS GenerateHTML2 + ::lNewDocumentModel := .T. + super:NewIndex( cFolder, cFilename, cTitle, EXTENSION ) RETURN self CLASS GenerateHTML FROM TPLGenerate - HIDDEN: METHOD RecreateStyleDocument( cStyleFile ) - //~ METHOD AddEntry( cCaption, cEntry, lPreformatted ) METHOD OpenTag( cText ) METHOD Tagged( cText ) METHOD CloseTag( cText ) METHOD Append( cText, cFormat ) + METHOD Newline() INLINE FWrite( ::nHandle, "
" + HB_OSNewLine() ), self + + CLASSDATA lCreateStyleDocument AS LOGICAL INIT .T. + DATA TargetFilename AS STRING INIT "" PROTECTED: - DATA lNewDocumentModel INIT .F. + DATA lNewDocumentModel AS LOGICAL INIT .F. EXPORTED: - METHOD New( cFolder, cFilename, cTitle, cDescription ) + METHOD NewFile() HIDDEN + METHOD NewIndex( cFolder, cFilename, cTitle ) + METHOD NewDocument( cFolder, cFilename, cTitle ) + METHOD AddEntry( oEntry ) + //~ METHOD AddIndex( oEntry ) HIDDEN + METHOD AddReference( oEntry ) + METHOD BeginSection( cSection, cFilename ) + METHOD EndSection( cSection, cFilename ) METHOD Generate() - METHOD Close() - METHOD WriteEntry( cCaption, cEntry, lPreformatted, nIndent ) + METHOD WriteEntry( cField, oEntry, lPreformatted, nIndent ) HIDDEN ENDCLASS -METHOD New( cFolder, cFilename, cTitle, cDescription ) CLASS GenerateHTML - - super:New( cFolder, cFilename, cTitle, cDescription, EXTENSION ) - +METHOD NewFile() CLASS GenerateHTML IF ::lNewDocumentModel - FWrite( ::nHandle, '' + /* "2" + */ HB_OSNewLine() ) + FWrite( ::nHandle, '' + HB_OSNewLine() ) ELSE - FWrite( ::nHandle, '' + /* "2" + */ HB_OSNewLine() ) + FWrite( ::nHandle, '' + HB_OSNewLine() ) ENDIF ::OpenTag( "html" ) ::OpenTag( "head" ) - ::Append( cTitle + IIf( Empty( ::cDescription ), "", " - " + ::cDescription ), "title" ) + ::Append( ::cTitle /* + IIf( Empty( ::cDescription ), "", " - " + ::cDescription ) */, "title" ) ::OpenTag( "meta", "name", "generator", "content", "Harbour examples/hbdoc2" ) ::OpenTag( "meta", "name", "keywords", "content", "Harbour project, Clipper, xBase, database, Free Software, GNU, compiler, cross platform, 32-bit, FiveWin" ) IF ::lNewDocumentModel #define STYLEFILE "hrb_doc.css" - IF s_lCreateStyleDocument - s_lCreateStyleDocument := .F. + IF ::lCreateStyleDocument + ::lCreateStyleDocument := .F. ::RecreateStyleDocument( STYLEFILE ) ENDIF ::OpenTag( "link", "rel", "stylesheet", "type", "text/css", "href", STYLEFILE ) +#undef STYLEFILE ENDIF ::CloseTag( "head" ) ::OpenTag( "body" ) ::Append( ::cTitle, "h1" ) - IF .NOT. Empty( ::cDescription ) + /* IF .NOT. Empty( ::cDescription ) ::Append( ::cDescription, "h2" ) - ENDIF + ENDIF */ RETURN self -METHOD PROCEDURE Close CLASS GenerateHTML +METHOD NewDocument( cFolder, cFilename, cTitle ) CLASS GenerateHTML + super:NewDocument( cFolder, cFilename, cTitle, EXTENSION ) + ::NewFile() + RETURN self + +METHOD NewIndex( cFolder, cFilename, cTitle ) CLASS GenerateHTML + super:NewIndex( cFolder, cFilename, cTitle, EXTENSION ) + ::NewFile() + RETURN self + +METHOD BeginSection( cSection, cFilename ) CLASS GenerateHTML +//~ HB_SYMBOL_UNUSED( cFilename ) + IF ::IsIndex() + If cFilename == ::cFilename + ::OpenTag( "a", "name", cSection ):Append( cSection, "h" + HB_NTOS( ::Depth + 2 ) ):CloseTag( "a" )//:Newline() + ELSE + ::OpenTag( "a", "href", cFilename + "." + ::cExtension + "#" + cSection ):Append( cSection, "h" + HB_NTOS( ::Depth + 2 ) ):CloseTag( "a" )//:Newline() + ENDIF + ELSE + ::OpenTag( "a", "name", cSection ):Append( cSection, "h" + HB_NTOS( ::Depth + 2 ) ):CloseTag( "a" )//:Newline() + ENDIF + ::TargetFilename := cFilename + ::Depth++ + RETURN self + +METHOD EndSection( cSection, cFilename ) CLASS GenerateHTML +HB_SYMBOL_UNUSED( cSection ) +HB_SYMBOL_UNUSED( cFilename ) + ::Depth-- + //~ FWrite( ::nHandle, Replicate( Chr(9), ::Depth ) + [] + HB_OSNewLine() ) + RETURN self + +METHOD AddReference( oEntry, cReference, cSubReference ) CLASS GenerateHTML + IF HB_IsObject( oEntry ) .AND. oEntry:ClassName == "ENTRY" + ::OpenTag( "a", "href", ::TargetFilename + "." + ::cExtension + "#" + oEntry:Filename ):Append( oEntry:Name ):CloseTag( "a" ):Append( oEntry:OneLiner ):Newline() + ELSE + IF cSubReference == NIL + ::OpenTag( "a", "href", cReference + "." + ::cExtension /* + "#" + oEntry:Filename */ ):Append( oEntry ):CloseTag( "a" ):Newline() + ELSE + ::OpenTag( "a", "href", cReference + "." + ::cExtension + "#" + cSubReference ):Append( oEntry ):CloseTag( "a" ):Newline() + ENDIF + ENDIF + RETURN self + +//~ METHOD AddIndex( oEntry ) CLASS GenerateHTML + //~ ::OpenTag( "a", "href", ::TargetFilename + "." + ::cExtension + "#" + oEntry:Filename ):Append( oEntry:Name ):CloseTag( "a" ):Append( oEntry:OneLiner ):Newline() + //~ RETURN self + +METHOD AddEntry( oEntry ) CLASS GenerateHTML + LOCAL idx + + FOR idx := 1 TO Len( oEntry:Fields ) + IF oEntry:Fields[ idx ][ 1 ] == "NAME" + ::OpenTag( "a", "name", oEntry:filename ):OpenTag( "h4" ):Append( oEntry:Name ):CloseTag( "h4" ):CloseTag( "a" ) + ELSEIF oEntry:IsField( oEntry:Fields[ idx ][ 1 ] ) .AND. oEntry:IsOutput( oEntry:Fields[ idx ][ 1 ] ) .AND. Len( oEntry:&( oEntry:Fields[ idx ][ 1 ] ) ) > 0 + ::WriteEntry( oEntry:Fields[ idx ][ 1 ], oEntry, oEntry:IsPreformatted( oEntry:Fields[ idx ][ 1 ] ) ) + ENDIF + NEXT + + RETURN self + +METHOD Generate() CLASS GenerateHTML IF .NOT. Empty( ::nHandle ) ::CloseTag( "body" ) ::CloseTag( "html" ) FClose( ::nHandle ) ::nHandle := 0 ENDIF - super:Close() - RETURN - -METHOD Generate() CLASS GenerateHTML - AEval( ::Buffer, {|ac| ::WriteEntry( ac[ 1 ], ac[ 2 ], ::IsPreformatted( ac[ 1 ], ac[ 2 ] ), ::IsIndented( ac[ 1 ], ac[ 2 ] ) ) } ) RETURN self -METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted, nIndent ) CLASS GenerateHTML - LOCAL cTagClass := IIf( lower( cCaption ) + "|" $ "oneliner|examples|tests|", lower( cCaption ), "itemtext" ) +METHOD PROCEDURE WriteEntry( cField, oEntry, lPreformatted, nIndent ) CLASS GenerateHTML + LOCAL cCaption := oEntry:FieldName( cField ) + LOCAL cEntry := oEntry:&( cField ) +// TODO: change this to search the CSS document itself + LOCAL cTagClass := IIf( LOWER( cField ) + "|" $ "name|oneliner|examples|tests|", LOWER( cField ), "itemtext" ) IF .NOT. Empty( cEntry ) DEFAULT cCaption TO "" + DEFAULT nIndent TO 0 //~ DEFAULT lPreformatted TO .F. //~ DEFAULT cTagClass TO "itemtext" - IF Len( cCaption ) > 0 .AND. nIndent > 0 + IF Len( cCaption ) > 0 /* .AND. nIndent > 0 */ IF ::lNewDocumentModel ::Tagged( cCaption, "div", "class", "itemtitle" ) ELSE - ::Append( cCaption, "h3" ) + ::Append( cCaption, "h5" ) ENDIF ENDIF @@ -187,9 +251,9 @@ METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted, nIndent ) CLASS Ge ENDIF DO WHILE Len( cEntry ) > 0 ::Append( Indent( Parse( @cEntry, HB_OSNewLine() ), 0, , .T. ), "" ) - IF Len( cEntry ) > 0 - FWrite( ::nHandle, HB_OSNewLine() ) - ENDIF + //~ IF Len( cEntry ) > 0 .AND. .NOT. lPreformatted + //~ FWrite( ::nHandle, HB_OSNewLine() ) + //~ ENDIF ENDDO IF ::lNewDocumentModel ::CloseTag( "pre" ) @@ -203,7 +267,7 @@ METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted, nIndent ) CLASS Ge ELSE ::OpenTag( "dd" ):OpenTag( "p" ) ENDIF - ::Append( Indent( Parse( @cEntry, HB_OSNewLine() ), 0, 70 ), "" ) + ::Append( Indent( Parse( @cEntry, HB_OSNewLine() ), 0, 70 ), "" ):Newline() IF ::lNewDocumentModel ::CloseTag( "div" ) ELSE @@ -226,7 +290,7 @@ METHOD OpenTag( cText, ... ) CLASS GenerateHTML cTag += " " + aArgs[ idx ] + "=" + Chr(34) + aArgs[ idx + 1 ] + Chr(34) NEXT - FWrite( ::nHandle, "<" + cTag + ">" + /* "3" + */ HB_OSNewLine() ) + FWrite( ::nHandle, "<" + cTag + ">" + HB_OSNewLine() ) RETURN self @@ -244,11 +308,11 @@ METHOD Tagged( cText, cTag, ... ) CLASS GenerateHTML RETURN self METHOD CloseTag( cText ) CLASS GenerateHTML - FWrite( ::nHandle, "" + /* "6" + */ HB_OSNewLine() ) + FWrite( ::nHandle, "" + HB_OSNewLine() ) IF cText == "html" FClose( ::nHandle ) - ::nHandle := NIL + ::nHandle := 0 ENDIF RETURN self @@ -276,7 +340,7 @@ METHOD Append( cText, cFormat ) CLASS GenerateHTML cResult := SubStr( cResult, 1, Len( cResult ) - Len( HB_OSNewLine() ) ) ENDDO - FWrite( ::nHandle, cResult + /* "7" + */ HB_OSNewLine() ) + FWrite( ::nHandle, cResult + HB_OSNewLine() ) ENDIF @@ -290,6 +354,7 @@ METHOD RecreateStyleDocument( cStyleFile ) CLASS GenerateHTML "/* Harbour Documents Stylesheet (" + cStyleFile + ") */" + HB_OSNewLine() + ; "body {font-family:arial;font-size:14px;line-height:18px;}" + HB_OSNewLine() + ; /* ".classtitle {font-weight:bold;font-size:22px;padding-bottom:4px;}" + HB_OSNewLine() + */ ; + ".name {font-weight:bold;font-size:18px;margin-left:0px;padding-top:0px;padding-bottom:4px;}" + HB_OSNewLine() + ; ".oneliner {font-style:italic;margin-bottom:12px;}" + HB_OSNewLine() + ; ".itemtitle {font-weight:bold;margin-left:0px;padding-top:0px;padding-bottom:4px;}" + HB_OSNewLine() + ; ".itemtext {margin-left:10px;padding-bottom:4px;}" + HB_OSNewLine() + ; diff --git a/harbour/examples/hbdoc2/gentpl.prg b/harbour/examples/hbdoc2/gentpl.prg index 5a03a093ae..fa24a3ed66 100644 --- a/harbour/examples/hbdoc2/gentpl.prg +++ b/harbour/examples/hbdoc2/gentpl.prg @@ -63,42 +63,50 @@ svn propset svn:eol-style native "filename" #include "hbclass.ch" #include "hbdoc2.ch" +#define DOCUMENT_ 1 +#define INDEX_ 2 + CLASS TPLGenerate EXPORTED: //~ PROTECTED: - DATA nHandle - DATA cFolder - DATA cFilename - DATA cTitle - DATA cDescription - DATA cExtension - DATA Buffer + DATA nHandle AS NUMERIC + DATA cFolder AS STRING + DATA cFilename AS STRING + DATA cTitle AS STRING + DATA cExtension AS STRING - METHOD New( cFolder, cFilename, cTitle, cDescription, cExtension ) + METHOD NewIndex( cFolder, cFilename, cTitle, cExtension ) + METHOD NewDocument( cFolder, cFilename, cTitle, cExtension ) + METHOD AddEntry( oEntry ) INLINE HB_SYMBOL_UNUSED( oEntry ), NIL + METHOD AddReference( oEntry ) INLINE HB_SYMBOL_UNUSED( oEntry ), NIL + METHOD BeginSection( cSection, cFilename ) INLINE HB_SYMBOL_UNUSED( cSection ), HB_SYMBOL_UNUSED( cFilename ), ::Depth++ + METHOD EndSection( cSection, cFilename ) INLINE HB_SYMBOL_UNUSED( cSection ), HB_SYMBOL_UNUSED( cFilename ), ::Depth-- METHOD Generate() INLINE NIL - METHOD Close() - - METHOD AddEntry( cCaption, cEntry ) - METHOD WriteEntry( cCaption, cEntry, lPreformatted, nIndent ) INLINE ; - HB_SYMBOL_UNUSED( cCaption ), ; - HB_SYMBOL_UNUSED( cEntry ), ; - HB_SYMBOL_UNUSED( lPreformatted ), ; - HB_SYMBOL_UNUSED( nIndent ), ; - NIL - - METHOD IsPreformatted( cCaption, cEntry ) - METHOD IsIndented( cCaption, cEntry ) + METHOD IsIndex() INLINE ( ::nType == INDEX_ ) +PROTECTED: + METHOD New( cFolder, cFilename, cTitle, cExtension, nType ) HIDDEN + DATA nType AS INTEGER + DATA Depth AS INTEGER INIT 0 ENDCLASS -METHOD New( cFolder, cFilename, cTitle, cDescription, cExtension ) CLASS TPLGenerate +METHOD NewIndex( cFolder, cFilename, cTitle, cExtension ) CLASS TPLGenerate + self:New( cFolder, cFilename, cTitle, cExtension, INDEX_ ) + RETURN self +METHOD NewDocument( cFolder, cFilename, cTitle, cExtension ) CLASS TPLGenerate + self:New( cFolder, cFilename, cTitle, cExtension, DOCUMENT_ ) + RETURN self + +METHOD New( cFolder, cFilename, cTitle, cExtension, nType ) CLASS TPLGenerate + + ::nHandle := 0 ::cFolder := cFolder ::cFilename := cFilename ::cTitle := cTitle - ::cDescription := cDescription ::cExtension := cExtension + ::nType := nType IF EMPTY( DIRECTORY( ::cFolder, "D" ) ) ? "Creating folder " + ::cFolder @@ -107,30 +115,4 @@ METHOD New( cFolder, cFilename, cTitle, cDescription, cExtension ) CLASS TPLGene ::nHandle := FCreate( ::cFolder + p_hsSwitches[ "PATH_SEPARATOR" ] + ::cFilename + "." + ::cExtension ) - ::Buffer := {} - RETURN self - -METHOD PROCEDURE Close() CLASS TPLGenerate - IF ::nHandle > 0 - FClose( ::nHandle ) - ::nHandle := 0 - ENDIF - ::Buffer := NIL - RETURN - -METHOD PROCEDURE AddEntry( cCaption, cEntry ) CLASS TPLGenerate - IF Empty( cCaption ) .OR. .NOT. ( Upper( cCaption ) + "|" $ "TEMPLATE|NAME|CATEGORY|SUBCATEGORY|" ) - IF .NOT. Empty( cEntry ) - DEFAULT cCaption TO "" - AAdd( ::Buffer, { cCaption, cEntry } ) - ENDIF - ENDIF - -METHOD IsPreformatted( cCaption, cEntry ) CLASS TPLGenerate -HB_SYMBOL_UNUSED( cEntry ) - RETURN Lower( cCaption + "|" ) $ "examples|tests|" - -METHOD IsIndented( cCaption, cEntry ) CLASS TPLGenerate -HB_SYMBOL_UNUSED( cEntry ) - RETURN IIf( Lower( cCaption + "|" ) $ "oneliner|", 0, 6 ) diff --git a/harbour/examples/hbdoc2/gentxt.prg b/harbour/examples/hbdoc2/gentxt.prg index e8d8c52d4d..de89b8bd74 100644 --- a/harbour/examples/hbdoc2/gentxt.prg +++ b/harbour/examples/hbdoc2/gentxt.prg @@ -66,62 +66,103 @@ svn propset svn:eol-style native "filename" #include "hbdoc2.ch" CLASS GenerateAscii FROM GenerateText - - METHOD New() - + METHOD NewIndex( cFolder, cFilename, cTitle, cDescription ) + METHOD NewDocument( cFolder, cFilename, cTitle, cDescription ) ENDCLASS -METHOD New( cFolder, cFilename, cTitle, cDescription ) CLASS GenerateAscii - +METHOD NewDocument( cFolder, cFilename, cTitle, cDescription ) CLASS GenerateAscii ::lContinuous := .T. + super:NewDocument( cFolder, cFilename, cTitle, cDescription ) + RETURN self - super:New( cFolder, cFilename, cTitle, cDescription ) - +METHOD NewIndex( cFolder, cFilename, cTitle, cDescription ) CLASS GenerateAscii + ::lContinuous := .T. + super:NewIndex( cFolder, cFilename, cTitle, cDescription ) RETURN self CLASS GenerateText FROM TPLGenerate - HIDDEN: PROTECTED: - VAR lContinuous INIT .F. + DATA lContinuous AS LOGICAL INIT .F. EXPORTED: - METHOD New( cFolder, cFilename, cTitle, cDescription ) + METHOD NewIndex( cFolder, cFilename, cTitle, cDescription ) + METHOD NewDocument( cFolder, cFilename, cTitle, cDescription ) + METHOD AddEntry( oEntry ) + METHOD AddIndex( oEntry ) HIDDEN + METHOD BeginSection( cSection, cFilename ) + //~ METHOD EndSection( cSection, cFilename ) // will use inherited method METHOD Generate() - METHOD Close() - METHOD WriteEntry( cCaption, cEntry, lPreformatted, nIndent ) + METHOD WriteEntry( cCaption, cEntry, lPreformatted ) HIDDEN ENDCLASS -METHOD New( cFolder, cFilename, cTitle, cDescription ) CLASS GenerateText - super:New( cFolder, cFilename, cTitle, cDescription, "txt" ) - ::AddEntry( "", cTitle ) - ::AddEntry( "", cDescription ) +METHOD NewDocument( cFolder, cFilename, cTitle ) CLASS GenerateText + super:NewDocument( cFolder, cFilename, cTitle, "txt" ) + ::WriteEntry( "", cTitle + HB_OSNewLine(), .F. ) RETURN self -METHOD PROCEDURE Close CLASS GenerateText - IF .NOT. Empty( ::nHandle ) - FClose( ::nHandle ) - ::nHandle := 0 - ENDIF - super:Close() - RETURN - -METHOD Generate() CLASS GenerateText - AEval( ::Buffer, {|ac| ::WriteEntry( ac[ 1 ], ac[ 2 ], ::IsPreformatted( ac[ 1 ], ac[ 2 ] ), ::IsIndented( ac[ 1 ], ac[ 2 ] ) ) } ) - IF .NOT. ::lContinuous - FWrite( ::nHandle, Chr( K_CTRL_L ) + HB_OSNewLine() ) - ENDIF +METHOD NewIndex( cFolder, cFilename, cTitle ) CLASS GenerateText + super:NewIndex( cFolder, cFilename, cTitle, "txt" ) + ::WriteEntry( "", cTitle + HB_OSNewLine(), .F. ) RETURN self -METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted, nIndent ) CLASS GenerateText - IF .NOT. Empty( cEntry ) - DEFAULT cCaption TO "" - IF Len( cCaption ) > 0 .AND. nIndent > 0 - FWrite( ::nHandle, cCaption + ": " + HB_OSNewLine() ) +METHOD BeginSection( cSection, cFilename ) CLASS GenerateText + IF ::Depth == 0 + ::WriteEntry( "", cSection + " (see " + cFilename + "." + ::cExtension + "):", .F. ) + ELSE + ::WriteEntry( "", cSection + ":", .F. ) + ENDIF + ::Depth++ + RETURN self + +METHOD AddIndex( oEntry ) CLASS GenerateText + ::WriteEntry( oEntry:FieldName( "NAME" ), oEntry:Name + " - " + oEntry:OneLiner, .F. ) + RETURN self + +METHOD AddEntry( oEntry ) CLASS GenerateText + LOCAL idx + + IF self:IsIndex() + self:AddIndex( oEntry ) + ELSE + FOR idx := 1 TO Len( oEntry:Fields ) + IF oEntry:IsField( oEntry:Fields[ idx ][ 1 ] ) .AND. oEntry:IsOutput( oEntry:Fields[ idx ][ 1 ] ) .AND. Len( oEntry:&( oEntry:Fields[ idx ][ 1 ] ) ) > 0 + ::WriteEntry( oEntry:FieldName( oEntry:Fields[ idx ][ 1 ] ), oEntry:&( oEntry:Fields[ idx ][ 1 ] ), oEntry:IsPreformatted( oEntry:Fields[ idx ][ 1 ] ) ) + ENDIF + NEXT + + IF .NOT. ::lContinuous + FWrite( ::nHandle, Chr( K_CTRL_L ) + HB_OSNewLine() ) ENDIF + ENDIF + + RETURN self + +METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted ) CLASS GenerateText + LOCAL nIndent + IF .NOT. Empty( cEntry ) + nIndent := IIf( Len( cCaption ) > 0, 6, 0 ) + IF Len( cCaption ) > 0 .AND. nIndent > 0 + FWrite( ::nHandle, Space( ::Depth * 6 ) + cCaption + ": " + HB_OSNewLine() ) + ENDIF + nIndent += ::Depth * 6 DO WHILE Len( cEntry ) > 0 FWrite( ::nHandle, Indent( Parse( @cEntry, HB_OSNewLine() ), nIndent, 70, lPreformatted ) ) ENDDO ENDIF + +METHOD Generate() CLASS GenerateText + IF ::IsIndex() + IF .NOT. ::lContinuous + FWrite( ::nHandle, Chr( K_CTRL_L ) + HB_OSNewLine() ) + ENDIF + ENDIF + + IF .NOT. Empty( ::nHandle ) + FClose( ::nHandle ) + ::nHandle := 0 + ENDIF + + RETURN self diff --git a/harbour/examples/hbdoc2/genxml.prg b/harbour/examples/hbdoc2/genxml.prg index d5be7c9cc4..2e5106baf4 100644 --- a/harbour/examples/hbdoc2/genxml.prg +++ b/harbour/examples/hbdoc2/genxml.prg @@ -65,82 +65,97 @@ svn propset svn:eol-style native "filename" #include "fileio.ch" #include "hbdoc2.ch" -//~ CLASS GenerateAscii FROM GenerateXML - - //~ METHOD New() - -//~ ENDCLASS - -//~ METHOD New( cFolder, cFilename, cTitle, cDescription ) CLASS GenerateAscii - - //~ ::lContinuous := .T. - - //~ super:New( cFolder, cFilename, cTitle, cDescription ) - - //~ RETURN self - CLASS GenerateXML FROM TPLGenerate - HIDDEN: PROTECTED: - //~ VAR lContinuous INIT .F. EXPORTED: - METHOD New( cFolder, cFilename, cTitle, cDescription ) + METHOD NewIndex( cFolder, cFilename, cTitle ) + METHOD NewDocument( cFolder, cFilename, cTitle ) + METHOD AddEntry( oEntry ) + METHOD AddIndex( oEntry ) HIDDEN + METHOD BeginSection( cSection, cFilename ) + METHOD EndSection( cSection, cFilename ) METHOD Generate() - METHOD Close() - METHOD WriteEntry( cCaption, cEntry, lPreformatted, nIndent ) + METHOD WriteEntry( cCaption, cEntry, lPreformatted ) HIDDEN ENDCLASS -METHOD New( cFolder, cFilename, cTitle, cDescription ) CLASS GenerateXML - super:New( cFolder, cFilename, cTitle, cDescription, "xml" ) - AAdd( ::Buffer, { "Title", cTitle, , 0 } ) - AAdd( ::Buffer, { "Description", cDescription, , 0 } ) +METHOD NewDocument( cFolder, cFilename, cTitle ) CLASS GenerateXML + super:NewDocument( cFolder, cFilename, cTitle, "xml" ) + FWrite( ::nHandle, '' + HB_OSNewLine() ) + FWrite( ::nHandle, '' + HB_OSNewLine() ) RETURN self -METHOD PROCEDURE Close CLASS GenerateXML +METHOD NewIndex( cFolder, cFilename, cTitle ) CLASS GenerateXML + super:NewIndex( cFolder, cFilename, cTitle, "xml" ) + FWrite( ::nHandle, '' + HB_OSNewLine() ) + FWrite( ::nHandle, '' + HB_OSNewLine() ) + RETURN self + +METHOD BeginSection( cSection, cFilename ) CLASS GenerateXML + IF ::Depth == 0 + FWrite( ::nHandle, Replicate( Chr(9), ::Depth ) + [
] + HB_OSNewLine() ) + ELSE + FWrite( ::nHandle, Replicate( Chr(9), ::Depth ) + [
] + HB_OSNewLine() ) + ENDIF + ::Depth++ + RETURN self + +METHOD EndSection( cSection, cFilename ) CLASS GenerateXML +HB_SYMBOL_UNUSED( cSection ) +HB_SYMBOL_UNUSED( cFilename ) + ::Depth-- + FWrite( ::nHandle, Replicate( Chr(9), ::Depth ) + [
] + HB_OSNewLine() ) + RETURN self + +METHOD AddIndex( oEntry ) CLASS GenerateXML + ::WriteEntry( "ENTRY", oEntry:Name + " - " + oEntry:OneLiner, .F. ) + RETURN self + +METHOD AddEntry( oEntry ) CLASS GenerateXML + LOCAL idx + + IF self:IsIndex() + self:AddIndex( oEntry ) + ELSE + FWrite( ::nHandle, '' + HB_OSNewLine() ) + ::Depth++ + FOR idx := 1 TO Len( oEntry:Fields ) + ::WriteEntry( oEntry:Fields[ idx ][ 1 ], oEntry:&( oEntry:Fields[ idx ][ 1 ] ), oEntry:IsPreformatted( oEntry:Fields[ idx ][ 1 ] ) ) + NEXT + ::Depth-- + FWrite( ::nHandle, '' + HB_OSNewLine() ) + ENDIF + + RETURN self + +METHOD Generate() CLASS GenerateXML + FWrite( ::nHandle, '' + HB_OSNewLine() ) + + IF ::IsIndex() + ENDIF + IF .NOT. Empty( ::nHandle ) FClose( ::nHandle ) ::nHandle := 0 ENDIF - super:Close() - RETURN -METHOD Generate() CLASS GenerateXML - FWrite( ::nHandle, '' + HB_OSNewLine() ) - FWrite( ::nHandle, '' + HB_OSNewLine() ) - AEval( ::Buffer, {|ac| ::WriteEntry( ac[ 1 ], ac[ 2 ], ::IsPreformatted( ac[ 1 ], ac[ 2 ] ), ::IsIndented( ac[ 1 ], ac[ 2 ] ) ) } ) - FWrite( ::nHandle, '' + HB_OSNewLine() ) RETURN self -METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted , nIndent ) CLASS GenerateXML +METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted ) CLASS GenerateXML LOCAL cResult LOCAL idx -HB_SYMBOL_UNUSED( nIndent ) IF .NOT. Empty( cEntry ) - DEFAULT lPreformatted TO .F. - - FWrite( ::nHandle, "<" + cCaption + IIf( lPreformatted, ' preformatted="yes"', "") + ">" ) - - IF HB_OSNewLine() $ cEntry - FWrite( ::nHandle, HB_OSNewLine() ) - ENDIF - - cResult := cEntry + cResult := IIf( HB_OSNewLine() $ cEntry, HB_OSNewLine() + cEntry, cEntry ) FOR idx := 1 TO Len( p_aConversionList ) STEP 2 cResult := StrTran( cResult, Chr( p_aConversionList[ idx ] ), "&" + p_aConversionList[ idx + 1 ] + ";" ) NEXT cEntry := cResult - DO WHILE Len( cEntry ) > 0 - //~ FWrite( ::nHandle, Indent( Parse( @cEntry, HB_OSNewLine() ), nIndent, 70, lPreformatted ) ) - FWrite( ::nHandle, Parse( @cEntry, HB_OSNewLine() ) ) - IF Len( cEntry ) > 0 - FWrite( ::nHandle, HB_OSNewLine() + HB_OSNewLine() ) - ENDIF - ENDDO - FWrite( ::nHandle, "" + HB_OSNewLine() ) + FWrite( ::nHandle, Replicate( Chr(9), ::Depth ) + "<" + cCaption + IIf( lPreformatted, ' preformatted="yes"', "") + ">" ) + FWrite( ::nHandle, cEntry ) + FWrite( ::nHandle, /* Replicate( Chr(9), ::Depth ) + */ "" + HB_OSNewLine() ) ENDIF diff --git a/harbour/examples/hbdoc2/hbdoc2.ch b/harbour/examples/hbdoc2/hbdoc2.ch index 13a3e3ef49..f9f077a0a1 100644 --- a/harbour/examples/hbdoc2/hbdoc2.ch +++ b/harbour/examples/hbdoc2/hbdoc2.ch @@ -63,17 +63,19 @@ MEMVAR p_aCategories MEMVAR p_aNonConformingSources MEMVAR p_hsSwitches -MEMVAR p_hsTemplates MEMVAR p_aCompliance MEMVAR p_aPlatforms +MEMVAR p_aStatus MEMVAR p_aConversionList // Template definitions #define TPL_START 1 #define TPL_END 2 -#define TPL_REQUIRED 4 -#define TPL_OPTIONAL 0 -#define TPL_PREFORMATTED 8 -#define TPL_CONSTRAINTLIST 16 +#define TPL_REQUIRED 4 // intentially has a 'required' and 'optional' flag +#define TPL_OPTIONAL 8 +#define TPL_PREFORMATTED 16 +#define TPL_CONSTRAINTLIST 32 +#define TPL_TEMPLATE 64 +#define TPL_OUTPUT 128 #endif diff --git a/harbour/examples/hbdoc2/hbdoc2.prg b/harbour/examples/hbdoc2/hbdoc2.prg index 68b8016c40..e12db16c5e 100644 --- a/harbour/examples/hbdoc2/hbdoc2.prg +++ b/harbour/examples/hbdoc2/hbdoc2.prg @@ -125,10 +125,11 @@ STATIC s_aExclusions := { "class_tp.txt", "hdr_tpl.txt" } PROCEDURE Main( ... ) LOCAL aArgs := HB_AParams() - LOCAL idx, idx2 //, idx3 + LOCAL idx, idx2, idx3, idx4 LOCAL arg LOCAL cArgName - LOCAL oFormat + LOCAL cFormat + LOCAL oDocument, oIndex LOCAL aContent PUBLIC p_aNonConformingSources := {} @@ -140,9 +141,10 @@ PROCEDURE Main( ... ) "source", .F., ; "contribs", .F., ; "format", {}, ; - "by-", "method", ; + "output", "entry", ; "include-doc-source", .F., ; "include-doc-version", .F., ; + "immediate-errors", .F., ; ; /* internal settings, values, etc */ ; "PATH_SEPARATOR", PATH_SEPARATOR, ; @@ -191,10 +193,12 @@ PROCEDURE Main( ... ) AAdd( p_hsSwitches[ "format" ], arg ) ENDIF END - CASE cArgName == "-by-category" ; p_hsSwitches[ "by-" ] := "category" - CASE cArgName == "-by-method" ; p_hsSwitches[ "by-" ] := "method" + CASE cArgName == "-output-single" ; p_hsSwitches[ "output" ] := "single" + CASE cArgName == "-output-category" ; p_hsSwitches[ "output" ] := "category" + CASE cArgName == "-output-entry" ; p_hsSwitches[ "output" ] := "entry" CASE cArgName == "-include-doc-source" ; p_hsSwitches[ "include-doc-source" ] := .T. - CASE cArgName == "-include-doc-version" ; p_hsSwitches[ "include-doc-version" ] := .T. + CASE cArgName == "-include-doc-version" ; p_hsSwitches[ "include-doc-version" ] := .T. + CASE cArgName == "" ; p_hsSwitches[ "include-doc-version" ] := .T. OTHERWISE IF HB_AScan( p_hsSwitches[ "format-list" ], SubStr( cArgName, 2 ), , , .T. ) > 0 IF SubStr( cArgName, 2 ) == "all" @@ -230,38 +234,31 @@ PROCEDURE Main( ... ) ? HB_NTOS( Len( aContent ) ) + " items found" ? - ASort( aContent, , , {|hsL,hsR| ; - HB_HGetDef( hsL, "CATEGORY", "" ) + Chr(1) + HB_HGetDef( hsL, "SUBCATEGORY", "" ) + Chr(1) + HB_HGetDef( hsL, "NAME", "" ) + Chr(1) ; + ASort( aContent, , , {|oL,oR| ; + HB_NTOS( oL:CategoryIndex( oL:Category ) ) + Chr(1) + HB_NTOS( oL:SubcategoryIndex( oL:Category, oL:Subcategory ) ) + Chr(1) + oL:Name + Chr(1) ; <= ; - HB_HGetDef( hsR, "CATEGORY", "" ) + Chr(1) + HB_HGetDef( hsR, "SUBCATEGORY", "" ) + Chr(1) + HB_HGetDef( hsR, "NAME", "" ) + Chr(1) ; + HB_NTOS( oR:CategoryIndex( oR:Category ) ) + Chr(1) + HB_NTOS( oR:SubcategoryIndex( oR:Category, oR:Subcategory ) ) + Chr(1) + oR:Name + Chr(1) ; } ) + // TODO: what is this for? it is sorting the category sub-arrays and removing empty (?) sub-arrays, but why? FOR idx := 1 TO Len( p_aCategories ) IF .NOT. Empty( p_aCategories[ idx ] ) - IF Len( p_aCategories[ idx ] ) == 3 // category, list of subcategory, list of entries - IF ValType( p_aCategories[ idx ][ 3 ] ) == "A" - FOR idx2 := Len( p_aCategories[ idx ][ 3 ] ) TO 1 STEP -1 - IF ValType( p_aCategories[ idx ][ 3 ][ idx2 ] ) == "A" - ASort( p_aCategories[ idx ][ 3 ][ idx2 ], ; - {|hsL,hsR| ; - HB_HGetDef( hsL, "CATEGORY", "" ) + HB_HGetDef( hsL, "SUBCATEGORY", "" ) + HB_HGetDef( hsL, "NAME", "" ) ; - <= ; - HB_HGetDef( hsR, "CATEGORY", "" ) + HB_HGetDef( hsR, "SUBCATEGORY", "" ) + HB_HGetDef( hsR, "NAME", "" ) ; - } ) - ELSEIF p_aCategories[ idx ][ 2 ][ idx2 ] != NIL - //~ ? p_aCategories[ idx ][ 1 ] + " " + p_aCategories[ idx ][ 2 ][ idx2 ] + " has no subcategories populated" - ASize( ADel( p_aCategories[ idx ][ 2 ], idx2 ), Len( p_aCategories[ idx ][ 2 ] ) - 1 ) - ASize( ADel( p_aCategories[ idx ][ 3 ], idx2 ), Len( p_aCategories[ idx ][ 3 ] ) - 1 ) - ELSE - ASize( ADel( p_aCategories[ idx ][ 2 ], idx2 ), Len( p_aCategories[ idx ][ 2 ] ) - 1 ) - ASize( ADel( p_aCategories[ idx ][ 3 ], idx2 ), Len( p_aCategories[ idx ][ 3 ] ) - 1 ) - ENDIF - NEXT - ELSE - //~ ? "expecting an array, found", ValType( p_aCategories[ idx ][ 3 ] ) - ENDIF + IF Len( p_aCategories[ idx ] ) == 4 // category, list of subcategory, list of entries, handle + FOR idx2 := Len( p_aCategories[ idx ][ 3 ] ) TO 1 STEP -1 + IF ValType( p_aCategories[ idx ][ 3 ][ idx2 ] ) == "A" + ASort( p_aCategories[ idx ][ 3 ][ idx2 ], , , ; + {|oL,oR| ; + HB_NTOS( oL:CategoryIndex( oL:Category ) ) + Chr(1) + HB_NTOS( oL:SubcategoryIndex( oL:Category, oL:Subcategory ) ) + Chr(1) + oL:Name ; + <= ; + HB_NTOS( oR:CategoryIndex( oR:Category ) ) + Chr(1) + HB_NTOS( oR:SubcategoryIndex( oR:Category, oR:Subcategory ) ) + Chr(1) + oR:Name ; + } ) + ELSE + ASize( ADel( p_aCategories[ idx ][ 2 ], idx2 ), Len( p_aCategories[ idx ][ 2 ] ) - 1 ) + ASize( ADel( p_aCategories[ idx ][ 3 ], idx2 ), Len( p_aCategories[ idx ][ 3 ] ) - 1 ) + ENDIF + NEXT ELSE - //~ ? "Index", idx, " is not length 3 but rather", Len( p_aCategories[ idx ] ) + ? "Index", idx, " is not length 4 but rather", Len( p_aCategories[ idx ] ) ENDIF ENDIF NEXT @@ -270,54 +267,121 @@ PROCEDURE Main( ... ) p_hsSwitches[ "format" ] := { "text" } ENDIF - DO CASE - CASE p_hsSwitches[ "by-" ] == "category" + FOR idx2 := 1 TO Len( p_hsSwitches[ "format" ] ) + cFormat := p_hsSwitches[ "format" ][ idx2 ] + IF cFormat != "all" + ? "Output as " + cFormat - CASE p_hsSwitches[ "by-" ] == "method" + DO CASE + CASE p_hsSwitches[ "output" ] == "single" + + oDocument := &("Generate" + cFormat + "()"):NewDocument( cFormat, "harbour", "Harbour Reference Guide" ) - FOR idx2 := 1 TO Len( p_hsSwitches[ "format" ] ) - IF p_hsSwitches[ "format" ][ idx2 ] != "all" - ? "Output as " + p_hsSwitches[ "format" ][ idx2 ] FOR idx := 1 TO Len( aContent ) - arg := aContent[ idx ] - - IF .NOT. HB_HHasKey( arg, "filename" ) .OR. Empty( arg[ "filename" ] ) - arg[ "filename" ] := Filename( arg[ "NAME" ] ) + IF SubStr( aContent[ idx ]:sourcefile_, -Len( "1stread.txt" ) ) == "1stread.txt" + oDocument:AddEntry( aContent[ idx ] ) + idx := Len( aContent ) ENDIF - - //~ ? "<< " + arg[ "NAME" ], arg[ "filename" - // create an instance of the class using the format as part of the class name - oFormat := &("Generate" + p_hsSwitches[ "format" ][ idx2 ] + "()") - oFormat:New( p_hsSwitches[ "format" ][ idx2 ], arg[ "filename" ], "Harbour Reference Guide", arg[ "NAME" ] ) - AEval( p_hsTemplates[ "orderby" ], {|c| IIf( HB_HHasKey( arg, c ), oFormat:AddEntry( c, Decode( c, arg, arg[ c ] ) ), NIL ) } ) - IF p_hsSwitches[ "include-doc-source" ] - oFormat:AddEntry( "SOURCE", arg[ "source-file" ] ) - IF p_hsSwitches[ "include-doc-version" ] - oFormat:AddEntry( "SOURCEVERSION", arg[ "source-file-version" ] ) - ENDIF - ENDIF - oFormat:Generate() - oFormat:Close() NEXT - oFormat := NIL + + FOR idx := 1 TO Len( aContent ) + IF SubStr( aContent[ idx ]:sourcefile_, -Len( "1stread.txt" ) ) == "1stread.txt" + ELSE + oDocument:AddEntry( aContent[ idx ] ) + ENDIF + NEXT + + oDocument:Generate() + oDocument := NIL + + CASE p_hsSwitches[ "output" ] == "category" + + oIndex := &("Generate" + cFormat + "()"):NewIndex( cFormat, "harbour", "Harbour Reference Guide" ) + + FOR idx := 1 TO Len( aContent ) + IF SubStr( aContent[ idx ]:sourcefile_, -Len( "1stread.txt" ) ) == "1stread.txt" + oIndex:AddEntry( aContent[ idx ] ) + idx := Len( aContent ) + ENDIF + NEXT + + FOR idx3 := 1 TO Len( p_aCategories ) + IF .NOT. Empty( p_aCategories[ idx3 ] ) + p_aCategories[ idx3 ][ 4 ] := Filename( p_aCategories[ idx3 ][ 1 ] ) + //~ oIndex:BeginSection( p_aCategories[ idx3 ][ 1 ], p_aCategories[ idx3 ][ 4 ] ) + //~ oIndex:EndSection( p_aCategories[ idx3 ][ 1 ], p_aCategories[ idx3 ][ 4 ] ) + ENDIF + NEXT + + FOR idx3 := 1 TO Len( p_aCategories ) + IF .NOT. Empty( p_aCategories[ idx3 ] ) + oDocument := &("Generate" + cFormat + "()"):NewDocument( cFormat, p_aCategories[ idx3 ][ 4 ], "Harbour Reference Guide - " + p_aCategories[ idx3 ][ 1 ] ) + + oIndex:BeginSection( p_aCategories[ idx3 ][ 1 ], oDocument:cFilename ) + oDocument:BeginSection( p_aCategories[ idx3 ][ 1 ], oDocument:cFilename ) + + FOR idx := 1 TO Len( p_aCategories[ idx3 ][ 3 ] ) + IF .NOT. Empty( p_aCategories[ idx3 ][ 3 ][ idx ] ) + ASort( p_aCategories[ idx3 ][ 3 ][ idx ], , , {|oL,oR| oL:Name <= oR:Name } ) + IF Len( p_aCategories[ idx3 ][ 2 ][ idx ] ) > 1 .OR. Len( p_aCategories[ idx3 ][ 2 ][ idx ] ) > 0 + oIndex:BeginSection( p_aCategories[ idx3 ][ 2 ][ idx ], oDocument:cFilename ) + oDocument:BeginSection( p_aCategories[ idx3 ][ 2 ][ idx ], oDocument:cFilename ) + ENDIF + FOR idx4 := 1 TO Len( p_aCategories[ idx3 ][ 3 ][ idx ] ) + IF .NOT. Empty( p_aCategories[ idx3 ][ 3 ][ idx ][ idx4 ] ) + IF SubStr( p_aCategories[ idx3 ][ 3 ][ idx ][ idx4 ]:sourcefile_, -Len( "1stread.txt" ) ) == "1stread.txt" + ELSE + oIndex:AddReference( p_aCategories[ idx3 ][ 3 ][ idx ][ idx4 ] ) + oDocument:AddEntry( p_aCategories[ idx3 ][ 3 ][ idx ][ idx4 ] ) + oDocument:AddReference( "Index", oIndex:cFilename ) +// this kind of works; the reference is outputed but it is not what I meant + oDocument:AddReference( p_aCategories[ idx3 ][ 1 ], oIndex:cFilename, p_aCategories[ idx3 ][ 4 ] ) + ENDIF + ENDIF + NEXT + IF Len( p_aCategories[ idx3 ][ 2 ][ idx ] ) > 1 .OR. Len( p_aCategories[ idx3 ][ 2 ][ idx ] ) > 0 + oIndex:EndSection( p_aCategories[ idx3 ][ 2 ][ idx ], oDocument:cFilename ) + oDocument:EndSection( p_aCategories[ idx3 ][ 2 ][ idx ], oDocument:cFilename ) + ENDIF + ENDIF + NEXT + oIndex:EndSection( p_aCategories[ idx3 ][ 1 ], oDocument:cFilename ) + oDocument:EndSection( p_aCategories[ idx3 ][ 1 ], oDocument:cFilename ) + oDocument:Generate() + ENDIF + NEXT + + CASE p_hsSwitches[ "output" ] == "entry" + + FOR idx := 1 TO Len( aContent ) + oDocument := &("Generate" + cFormat + "()"):NewDocument( cFormat, aContent[ idx ]:filename, "Harbour Reference Guide" ) + oIndex:AddEntry( aContent[ idx ] ) + oDocument:AddEntry( aContent[ idx ] ) + oDocument:Generate() + NEXT + + ENDCASE + + oDocument := NIL + + IF oIndex != NIL + oIndex:Generate() + oIndex := NIL ENDIF - NEXT - OTHERWISE - ENDCASE + ENDIF + NEXT -/* IF Len( p_aNonConformingSources ) > 0 ? "Non-conforming sources:" - AEval( p_aNonConformingSources, {|a| qout( a[ 1 ] + ":" + HB_NTOS( a[ 3 ] ) + ": " +a[ 2 ] ) } ) + AEval( p_aNonConformingSources, {|a| qout( a[ 1 ] + ":" + HB_NTOS( a[ 3 ] ) + ": " + a[ 2 ] ) } ) ENDIF -*/ ? RETURN -STATIC PROCEDURE ProcessFolder( cFolder, aContent ) +STATIC PROCEDURE ProcessFolder( cFolder, aContent ) // this is a recursive procedure LOCAL aFiles LOCAL nLen LOCAL idx @@ -331,10 +395,10 @@ STATIC PROCEDURE ProcessFolder( cFolder, aContent ) FOR idx := 1 TO nLen IF aFiles[ idx ][F_ATTR ] == "D" IF ( p_hsSwitches[ "source" ] .OR. p_hsSwitches[ "contribs" ] ) /*.AND. ; - HB_AScan( s_aSkipDirs, {|d| Lower(d) == Lower( aFiles[ idx ][ F_NAME ] ) } ) == 0*/ + HB_AScan( s_aSkipDirs, {|d| LOWER(d) == LOWER( aFiles[ idx ][ F_NAME ] ) } ) == 0*/ ProcessFolder( cFolder + aFiles[ idx ][ F_NAME ], @aContent ) ENDIF - ELSEIF HB_AScan( s_aExclusions, {|f| Lower(f) == Lower( aFiles[ idx ][ F_NAME ] ) } ) == 0 + ELSEIF HB_AScan( s_aExclusions, {|f| LOWER(f) == LOWER( aFiles[ idx ][ F_NAME ] ) } ) == 0 IF .NOT. ProcessFile( cFolder + aFiles[ idx ][ F_NAME ], @aContent ) EXIT ENDIF @@ -345,12 +409,17 @@ STATIC PROCEDURE ProcessFolder( cFolder, aContent ) RETURN STATIC FUNCTION ProcessFile( cFile, aContent ) - LOCAL aHandle := { 0, 0 } + LOCAL aHandle := { 0, 0 } // file handle and position LOCAL cSectionName LOCAL cVersion + LOCAL o + LOCAL nOldContentLen := Len( aContent ) // debug code to keep output small -//~ if .not. "1st" $ lower(cFile) +//~ if .not. "dir.txt" $ LOWER(cFile) +//~ if .not. "subcodes.txt" $ LOWER(cFile) +//~ if .not. "command.txt" $ LOWER(cFile) +//~ if .not. "rddmisc.txt" $ LOWER(cFile) //~ return .t. //~ endif @@ -371,26 +440,27 @@ STATIC FUNCTION ProcessFile( cFile, aContent ) //~ RETURN .F. ENDIF - DO WHILE FReadSection( aHandle, @cSectionName, , p_hsTemplates[ "Template" ] ) - IF HB_HHasKey( p_hsTemplates[ "Template" ], cSectionName ) .AND. ; - p_hsTemplates[ "Template" ][ cSectionName ][ 1 ] == TPL_START - ProcessBlock( aHandle, @aContent, cFile, cSectionName, @cVersion ) + o := Entry():New( "Template" ) + + DO WHILE FReadSection( aHandle, @cSectionName, , o ) + IF o:IsField( @cSectionName, TPL_START ) + o := Entry():New( "Template" ) + ProcessBlock( aHandle, @aContent, cFile, cSectionName, @cVersion, @o ) ENDIF ENDDO FClose( aHandle[ 1 ] ) + ?? " (" + HB_NTOS( Len( aContent ) - nOldContentLen ) + " items)" + RETURN .T. -STATIC PROCEDURE ProcessBlock( aHandle, aContent, cFile, cType, cVersion ) +STATIC PROCEDURE ProcessBlock( aHandle, aContent, cFile, cType, cVersion, o ) LOCAL cSectionName LOCAL cSection - LOCAL hsBlock LOCAL lAccepted := .T. LOCAL cSource LOCAL idxCategory := -1 LOCAL idxSubCategory := -1 - LOCAL idx - LOCAL hsTemplate := p_hsTemplates[ "Template" ] LOCAL cSourceFile #ifdef __PLATFORM__UNIX @@ -399,113 +469,90 @@ STATIC PROCEDURE ProcessBlock( aHandle, aContent, cFile, cType, cVersion ) cSourceFile := StrTran( "../" + cFile /* SubStr( cFile, Len( p_hsSwitches[ "basedir" ] + PATH_SEPARATOR ) ) */, "\", "/" ) #endif - hsBlock := HB_Hash( ; - "type", cType, ; - "source-file", cSourceFile, ; - "source-file-version", cVersion ; - ) + o:type_ = cType + o:sourcefile_ = cSourceFile + o:sourcefileversion_ = cVersion - DO WHILE FReadSection( aHandle, @cSectionName, @cSection, hsTemplate ) - idx := HB_HPos( hsTemplate, cSectionName ) + DO WHILE FReadSection( aHandle, @cSectionName, @cSection, @o ) + //~ idx := HB_HPos( hsTemplate, cSectionName ) DO CASE CASE cSectionName == "TEMPLATE" - - IF HB_HHasKey( p_hsTemplates, cSection ) - hsTemplate := p_hsTemplates[ cSection ] - - FOR idx := 1 TO Len( hsTemplate ) - IF HB_HValueAt( hsTemplate, idx ) != NIL - DO CASE - CASE HB_HKeyAt( hsTemplate, idx ) == "TEMPLATE" - hsBlock[ HB_HKeyAt( hsTemplate, idx ) ] := HB_HValueAt( hsTemplate, idx )[ 2 ][ 1 ] - CASE HB_BitAnd( HB_HValueAt( hsTemplate, idx )[ 1 ], TPL_REQUIRED ) == TPL_REQUIRED - hsBlock[ HB_HKeyAt( hsTemplate, idx ) ] := NIL - OTHERWISE - hsBlock[ HB_HKeyAt( hsTemplate, idx ) ] := "" - ENDCASE - ENDIF - NEXT + IF o:IsTemplate( cSection ) + o:SetTemplate( cSection ) ELSE - AddErrorCondition( cFile, "Unknown TYPE '" + cSection + "'" ) // + "' (line " + HB_NTOS( aHandle[ 2 ] ) + ")" // exclude link number, it reports tonnes of entries + AddErrorCondition( cFile, "Unknown TEMPLATE '" + cSection + "'" ) // + "' (line " + HB_NTOS( aHandle[ 2 ] ) + ")" // exclude link number, it reports tonnes of entries lAccepted := .F. EXIT ENDIF - CASE hsTemplate == NIL +/* CASE hsTemplate == NIL ? "should not be here" //? - + */ OTHERWISE IF Len( cSectionName ) == 0 - ELSEIF HB_HHasKey( hsBlock, cSectionName ) + ELSEIF o:IsField( cSectionName ) DO CASE - CASE hsTemplate[ cSectionName ][ 1 ] == TPL_START + CASE o:IsField( cSectionName, TPL_START ) AddErrorCondition( cFile, "Encountered another section '" + cSection, aHandle[ 2 ] ) lAccepted := .F. EXIT - CASE hsTemplate[ cSectionName ][ 1 ] == TPL_END + CASE o:IsField( cSectionName, TPL_END ) EXIT - CASE .NOT. Empty( hsBlock[ cSectionName ] ) + CASE .NOT. Empty( o:&cSectionName ) AddErrorCondition( cFile, "Duplicate " + cSectionName, aHandle[ 2 ] ) lAccepted := .F. CASE cSectionName == "CATEGORY" - IF ( idxCategory := HB_AScan( p_aCategories, {|c| .NOT. Empty( c ) .AND. ( IIf( ValType( c ) == "C", Lower( c ) == Lower( cSection ), Lower( c[ 1 ] ) == Lower( cSection ) ) ) } ) ) == 0 - AddErrorCondition( cFile, "Unknown CATEGORY '" + cSection + "' for template '" + hsTemplate[ "TEMPLATE" ][ 2 ], aHandle[ 2 ] ) + IF ( idxCategory := HB_AScan( p_aCategories, {|c| .NOT. Empty( c ) .AND. ( IIf( ValType( c ) == "C", LOWER( c ) == LOWER( cSection ), LOWER( c[ 1 ] ) == LOWER( cSection ) ) ) } ) ) == 0 + AddErrorCondition( cFile, "Unknown CATEGORY '" + cSection + "' for template '" + o:Template, aHandle[ 2 ] ) lAccepted := .F. ENDIF - CASE HB_HHasKey( hsTemplate, "SUBCATEGORY" ) .AND. cSectionName == "SUBCATEGORY" + CASE cSectionName == "SUBCATEGORY" .AND. o:IsField( "SUBCATEGORY" ) - IF idxCategory <= 0 .OR. hsBlock[ "CATEGORY" ] == "" + IF idxCategory <= 0 .OR. o:Category == "" AddErrorCondition( cFile, "SUBCATEGORY '" + cSection + "' defined before CATEGORY", aHandle[ 2 ] ) lAccepted := .F. - ELSEIF ValType( p_aCategories[ idxCategory ] ) == "C" - - AddErrorCondition( cFile, "CATEGORY '" + p_aCategories[ idxCategory ] + " has no SUBCATEGORY listed, found '" + cSection, aHandle[ 2 ] ) - lAccepted := .F. - - ELSEIF ( idxSubCategory := HB_AScan( p_aCategories[ idxCategory ][ 2 ], {|c| .NOT. ( c == NIL ) .AND. ( IIf( ValType( c ) == "C", Lower( c ) == Lower( cSection ), Lower( c[ 1 ] ) == Lower( cSection ) ) ) } ) ) == 0 + ELSEIF ( idxSubCategory := HB_AScan( p_aCategories[ idxCategory ][ 2 ], {|c| .NOT. ( c == NIL ) .AND. ( IIf( ValType( c ) == "C", LOWER( c ) == LOWER( cSection ), LOWER( c[ 1 ] ) == LOWER( cSection ) ) ) } ) ) == 0 AddErrorCondition( cFile, "Unknown SUBCATEGORY '" + p_aCategories[ idxCategory ][ 1 ] + "-" + cSection, aHandle[ 2 ] ) lAccepted := .F. ENDIF - CASE .NOT. HB_HHasKey( hsTemplate, "RETURNS" ) .AND. cSectionName == "RETURNS" + //~ CASE cSectionName == "RETURNS" .AND. .NOT. o:IsField( "RETURNS" ) - AddErrorCondition( cFile, "'" + hsBlock[ "NAME" ] + "' is identified as template FUNCTION but has no RETURNS value", aHandle[ 2 ] ) - lAccepted := .F. + //~ AddErrorCondition( cFile, "'" + o:Name + "' is identified as template " + o:Template + " but has no RETURNS field", aHandle[ 2 ] ) + //~ lAccepted := .F. - CASE HB_HHasKey( hsTemplate, "RETURNS" ) .AND. cSectionName == "RETURNS" .AND. ( ; + CASE o:IsField( "RETURNS" ) .AND. cSectionName == "RETURNS" .AND. ( ; Empty( cSection ) .OR. ; - Lower( cSection ) == "nil" .OR. ; - Lower( cSection ) == "none" .OR. ; - Lower( cSection ) == "none." ) + LOWER( cSection ) == "nil" .OR. ; + LOWER( cSection ) == "none" .OR. ; + LOWER( cSection ) == "none." ) - AddErrorCondition( cFile, "'" + hsBlock[ "NAME" ] + "' is identified as template FUNCTION but has no RETURNS value", aHandle[ 2 ] - 1 ) + AddErrorCondition( cFile, "'" + o:Name + "' is identified as template " + o:Template + " but has no RETURNS value (" + cSection + ")", aHandle[ 2 ] - 1 ) lAccepted := .F. - CASE HB_BitAnd( HB_HValueAt( hsTemplate, idx )[ 1 ], TPL_CONSTRAINTLIST ) == TPL_CONSTRAINTLIST .AND. ; - HB_AScan( HB_HValueAt( hsTemplate, idx )[ 2 ], cSection ) == 0 .AND. ; - HB_AScan( HB_HValueAt( hsTemplate, idx )[ 2 ], Parse( ( cSection ), "," ) ) == 0 + CASE .NOT. o:IsConstraint( cSectionName, cSection ) - cSource := HB_HKeyAt( hsTemplate, idx ) + " is '" + IIf( Len( cSection ) <= 20, cSection, SubStr( StrTran( cSection, HB_OSNewLine(), "" ), 1, 20 ) + "..." ) + "', should be one of: " + cSource := cSectionName + " is '" + IIf( Len( cSection ) <= 20, cSection, SubStr( StrTran( cSection, HB_OSNewLine(), "" ), 1, 20 ) + "..." ) + "', should be one of: " //~ cSource := HB_HKeyAt( hsTemplate, idx ) + " should be one of: " - AEval( HB_HValueAt( hsTemplate, idx )[ 2 ], {|c,n| cSource += IIf( n == 1, "", "," ) + c } ) + AEval( &( "p_a" + cSectionName ), {|c,n| cSource += IIf( n == 1, "", "," ) + c } ) AddErrorCondition( cFile, cSource, aHandle[ 2 ] - 1 ) OTHERWISE @@ -513,16 +560,12 @@ STATIC PROCEDURE ProcessBlock( aHandle, aContent, cFile, cType, cVersion ) ENDCASE IF lAccepted - //~ IF ATail( hsTemplate[ cSectionName ] ) > 0 - hsBlock[ cSectionName ] := cSection - //~ ELSE - //~ ? "bypassing " + cSectionName + ": " + SubStr(cSection, 1, 30 ) - //~ ENDIF + o:&cSectionName := Decode( cSectionName, , cSection ) ENDIF ELSE - AddErrorCondition( cFile, "Using template '" + hsTemplate[ "TEMPLATE" ][ 2 ] + "' encountered an unexpected section '" + cSectionName, aHandle[ 2 ] ) + AddErrorCondition( cFile, "Using template '" + o:Template + "' encountered an unexpected section '" + cSectionName, aHandle[ 2 ] ) lAccepted := .F. ENDIF @@ -530,51 +573,32 @@ STATIC PROCEDURE ProcessBlock( aHandle, aContent, cFile, cType, cVersion ) ENDDO IF lAccepted - cSource := "" - FOR idx := 1 TO Len( hsBlock ) - IF .NOT. HB_HHasKey( hsTemplate, HB_HKeyAt( hsBlock, idx ) ) .OR. ; - hsTemplate[ HB_HKeyAt( hsBlock, idx ) ][ 1 ] == TPL_START .OR. hsTemplate[ HB_HKeyAt( hsBlock, idx ) ][ 1 ] == TPL_END - - ELSEIF HB_HValueAt( hsBlock, idx ) == NIL - cSource += "," + HB_HKeyAt( hsBlock, idx ) - ENDIF - NEXT - IF Len( cSource ) > 0 - AddErrorCondition( cFile, "Missing sections: '" + SubStr( cSource, 2 ), aHandle[ 2 ] ) + lAccepted := o:IsComplete( @cSource ) + IF .NOT. lAccepted + AddErrorCondition( cFile, "Missing sections: '" + cSource + "'", aHandle[ 2 ] ) lAccepted := .F. ENDIF ENDIF IF .NOT. lAccepted - ELSEIF Len( hsBlock[ "NAME" ] ) == 0 + ELSEIF o:Template == "Function" .AND. ( ; + Empty( o:Returns ) .OR. ; + LOWER( o:Returns ) == "nil" .OR. ; + LOWER( o:Returns ) == "none" .OR. ; + LOWER( o:Returns ) == "none." ) - AddErrorCondition( cFile, "Section NAME missing", aHandle[ 2 ] ) - //~ lAccepted := .F. - - //~ ELSEIF hsTemplate[ "TEMPLATE" ][ 2 ][ 1 ] == "Function" .AND. ( ; - ELSEIF hsBlock[ "TEMPLATE" ] == "Function" .AND. ( ; - Empty( hsBlock[ "RETURNS" ] ) .OR. ; - Lower( hsBlock[ "RETURNS" ] ) == "nil" .OR. ; - Lower( hsBlock[ "RETURNS" ] ) == "none" .OR. ; - Lower( hsBlock[ "RETURNS" ] ) == "none." ) - - AddErrorCondition( cFile, "'" + hsBlock[ "NAME" ] + "' is identified as template FUNCTION but has no RETURNS value", aHandle[ 2 ] ) + AddErrorCondition( cFile, "'" + o:Name + "' is identified as template " + o:Template + " but has no RETURNS value (" + o:Returns + ")", aHandle[ 2 ] ) //~ lAccepted := .F. ELSE IF .NOT. ( ; - /* Lower( hsBlock[ "CATEGORY" ] ) == "document" .OR. */ ; + /* LOWER( hsBlock[ "CATEGORY" ] ) == "document" .OR. */ ; /* .NOT. ( hsBlock[ "SUBCODE" ] == "" ) .OR. */ ; .F. ) - cSectionName := Upper( hsBlock[ "NAME" ] ) - - //~ cSectionName := Upper( Decode( "Name", hsBlock ) ) - //~ Parse( @cSectionName, " " ) - - cSectionName := Parse( cSectionName, "(" ) + cSectionName := Parse( UPPER( o:Name ), "(" ) IF HB_AScan( p_hsSwitches[ "hbextern.ch" ], cSectionName, , , .T. ) > 0 AAdd( p_hsSwitches[ "in hbextern" ], cSectionName ) @@ -586,11 +610,19 @@ STATIC PROCEDURE ProcessBlock( aHandle, aContent, cFile, cType, cVersion ) ENDIF - AAdd( aContent, hsBlock ) + IF p_hsSwitches[ "include-doc-source" ] + o:Files += HB_OSNewLine() + o:sourcefile_ + IIf( p_hsSwitches[ "include-doc-version" ], " (" + o:sourcefileversion_ + ")", "" ) + ENDIF - IF .NOT. HB_HHasKey( hsTemplate, "SUBCATEGORY" ) .OR. ; - HB_BitAnd( hsTemplate[ "SUBCATEGORY" ][ 1 ], TPL_REQUIRED ) == 0 //.AND. idxSubCategory == -1 - idxSubCategory := 1 + o:filename := Filename( o:Name ) + + AAdd( aContent, o ) + + IF idxSubCategory == -1 .AND. ( .NOT. o:IsField( "SUBCATEGORY" ) .OR. .NOT. o:IsRequired( "SUBCATEGORY" ) ) //.AND. idxSubCategory == -1 + idxSubCategory := o:SubcategoryIndex( o:Category, "" ) + IF idxSubCategory == -1 + idxSubCategory := 1 + ENDIF ENDIF //~ if 1 <= idxCategory .and. idxCategory < Len( p_aCategories ) @@ -615,16 +647,22 @@ STATIC PROCEDURE ProcessBlock( aHandle, aContent, cFile, cType, cVersion ) //~ endif +//~ if idxCategory < 1 .or. idxCategory > len( p_aCategories ) + //~ AddErrorCondition( cFile, "'" + o:Name + "' of " + o:Template + " has bad idxCategory " + HB_NTOS( idxCategory ), aHandle[ 2 ] ) +//~ elseif idxSubCategory < 1 .or. idxSubCategory > len( p_aCategories[ idxCategory ][ 3 ] ) +//~ ? idxCategory, idxSubCategory, len( p_aCategories[ idxCategory ][ 3 ] ) + //~ AddErrorCondition( cFile, "'" + o:Name + "' of " + o:Template + "." + o:Category + " has bad idxSubCategory " + HB_NTOS( idxSubCategory ), aHandle[ 2 ] ) +//~ endif IF ValType( p_aCategories[ idxCategory ][ 3 ][ idxSubCategory ] ) != "A" p_aCategories[ idxCategory ][ 3 ][ idxSubCategory ] := {} ENDIF - AAdd( p_aCategories[ idxCategory ][ 3 ][ idxSubCategory ], hsBlock ) + AAdd( p_aCategories[ idxCategory ][ 3 ][ idxSubCategory ], o ) ENDIF RETURN -STATIC FUNCTION FReadSection( aHandle, cSectionName, cSection, hsTemplate ) +STATIC FUNCTION FReadSection( aHandle, cSectionName, cSection, o ) LOCAL nPosition LOCAL cBuffer LOCAL nLastIndent @@ -639,8 +677,8 @@ STATIC FUNCTION FReadSection( aHandle, cSectionName, cSection, hsTemplate ) SubStr( cSectionName, -1, 1 ) == p_hsSwitches[ "DELIMITER" ] cSectionName := SubStr( cSectionName, 1 + Len( p_hsSwitches[ "DELIMITER" ] ), Len( cSectionName ) - ( 2 * Len( p_hsSwitches[ "DELIMITER" ] ) ) ) - IF HB_HHasKey( hsTemplate, cSectionName ) - lLastPreformatted := lPreformatted := ( HB_BitAnd( hsTemplate[ cSectionName ][ 1 ], TPL_PREFORMATTED ) != 0 ) + IF o:IsField( cSectionName ) + lLastPreformatted := lPreformatted := o:IsPreformatted( cSectionName ) nLastIndent := -1 DO WHILE ( nPosition := FSeek( aHandle[ 1 ], 0, FS_RELATIVE ) ), FReadLn( @aHandle, @cBuffer ) // TOFIX: this assumes that every line starts with " *" @@ -696,7 +734,7 @@ STATIC FUNCTION FReadSection( aHandle, cSectionName, cSection, hsTemplate ) cSection := SubStr( cSection, 1, Len( cSection ) - Len( HB_OSNewLine() ) ) ENDDO - IF lPreformatted .AND. Lower( SubStr( cSection, -Len( "" ) ) ) == "" + IF lPreformatted .AND. LOWER( SubStr( cSection, -Len( "" ) ) ) == "" cSection := SubStr( cSection, 1, Len( cSection ) - Len( "" ) ) DO WHILE SubStr( cSection, -Len( HB_OSNewLine() ) ) == HB_OSNewLine() cSection := SubStr( cSection, 1, Len( cSection ) - Len( HB_OSNewLine() ) ) @@ -800,13 +838,13 @@ STATIC s_aEOL := { chr(13) + chr(10), chr(10), chr(13) } ENDIF aHandle[ 2 ]++ -//~ ? hb_ntos(aHandle[ 2 ]) + ": " + cBuffer RETURN nNumRead != 0 FUNCTION Decode( cType, hsBlock, cKey ) LOCAL cCode LOCAL cResult + LOCAL idx IF cKey != NIL .AND. hsBlock != NIL .AND. HB_HHasKey( hsBlock, cKey ) cCode := hsBlock[ cKey ] @@ -816,16 +854,22 @@ FUNCTION Decode( cType, hsBlock, cKey ) DO CASE CASE cType == "STATUS" - IF LEN( cCode ) > 1 .OR. Empty( cCode ) + IF "," $ cCode .AND. HB_AScan( p_aStatus, Parse( ( cCode ), "," ) ) > 0 + cResult := "" + DO WHILE LEN( cCode ) > 0 + cResult += HB_OSNewLine() + Decode( cType, hsBlock, Parse( @cCode, "," ) ) + ENDDO + RETURN SubStr( cResult, LEN( HB_OSNewLine() ) + 1 ) + ENDIF + + IF ( idx := HB_AScan( p_aStatus, {|a| a[1] == cCode } ) ) > 0 + RETURN p_aStatus[ idx ][ 2 ] + ELSEIF LEN( cCode ) > 1 RETURN cCode - ELSEIF cCode == "R" - RETURN "Ready" - ELSEIF cCode == "S" - RETURN "Started" ELSEIF Len( cCode ) > 0 - RETURN "Unknown 'STATUS': '" + cCode + '"' + RETURN "Unknown 'STATUS' code: '" + cCode + "'" ELSE - RETURN "Not started" + RETURN ATail( p_aStatus )[ 2 ] ENDIF CASE cType == "PLATFORMS" @@ -837,32 +881,11 @@ FUNCTION Decode( cType, hsBlock, cKey ) RETURN SubStr( cResult, LEN( HB_OSNewLine() ) + 1 ) ENDIF - DO CASE - CASE Empty( cCode ) ; RETURN cCode - CASE cCode == "All" ; RETURN "This is available on all platforms" - CASE cCode == "All(64K)" ; RETURN "This is available on all platforms though some platforms have a string length limit of 64KB" - CASE cCode == "All(GT)" ; RETURN "This part of the GT API and supported only by some platforms." - CASE cCode == "All(LFN)" ; RETURN ; - "This is available on all platforms." + HB_OSNewLine() + ; - "If long file names are available Harbour will use/display the first 15 characters " +; - "else Harbour will use/display a 8.3 file name consistent with CA-Cl*pper" - CASE cCode == "Linux(GT)" ; RETURN "Under Linux the number of columns avaliable depends of the current Terminal screen size." - CASE cCode == "OS2(GT)" ; RETURN "Under OS/2 the number of columns avaliable depends of the current Terminal screen size." - CASE cCode == "Win(GT)" ; RETURN "Under Windows, the return value of MAXROW() function is only affected if called after an SETMODE() function" - CASE cCode == "BSD" ; RETURN "This is available on the BSD platform" - CASE cCode == "DARWIN" ; RETURN "This is available on the DARWIN platform" - CASE cCode == "DOS" ; RETURN "This is available on the MS-DOS platform" - CASE cCode == "HPUX" ; RETURN "This is available on the HPUX platform" - CASE cCode == "LINUX" ; RETURN "This is available on the LINUX platform" - CASE cCode == "OS2" ; RETURN "This is available on the OS/2 platform" - CASE cCode == "SUNOS" ; RETURN "This is available on the SUNOS platform" - CASE cCode == "Unix" ; RETURN "This is available on the Unix platform(s)" - CASE cCode == "Win" ; RETURN "This is available on the MS-Windows platform(s)" - CASE cCode == "Win32" ; RETURN "This is available on the MS-Windows (32-bit) platform(s)" - CASE cCode == "Win64" ; RETURN "This is available on the MS-Windows (64-bit) platform(s)" - CASE cCode == "WinCE" ; RETURN "This is available on the MS-Windows-CE platform" - OTHERWISE ; RETURN "Unknown 'PLATFORMS' code: '" + cCode + "'" - ENDCASE + IF ( idx := HB_AScan( p_aPlatforms, {|a| a[1] == cCode } ) ) > 0 + RETURN p_aPlatforms[ idx ][ 2 ] + ELSE + RETURN "Unknown 'PLATFORMS' code: '" + cCode + "'" + ENDIF CASE cType == "COMPLIANCE" IF "," $ cCode .AND. HB_AScan( p_aCompliance, Parse( ( cCode ), "," ) ) > 0 @@ -873,6 +896,13 @@ FUNCTION Decode( cType, hsBlock, cKey ) RETURN SubStr( cResult, LEN( HB_OSNewLine() ) + 1 ) ENDIF +<<<<<<< .mine + IF ( idx := HB_AScan( p_aCompliance, {|a| a[1] == cCode } ) ) > 0 + RETURN p_aCompliance[ idx ][ 2 ] + ELSE + RETURN "Unknown 'COMPLIANCE' code: '" + cCode + "'" + ENDIF +======= DO CASE CASE Empty( cCode ) ; RETURN cCode CASE cCode == "C" ; RETURN "This is CA-Cl*pper v5.2 compliant" @@ -887,22 +917,25 @@ FUNCTION Decode( cType, hsBlock, cKey ) CASE cCode == "XPP" ; RETURN "This an Xbase++ compatibility function and is only visible if source was compiled with the HB_COMPAT_XPP flag" OTHERWISE ; RETURN "Unknown 'COMPLIANCE' code: '" + cCode + "'" ENDCASE +>>>>>>> .r12826 CASE cType == "NAME" - IF .NOT. HB_HHasKey( hsBlock, "RETURNS" ) + IF hsBlock == NIL + RETURN cCode + ELSEIF .NOT. HB_HHasKey( hsBlock, "RETURNS" ) RETURN hsBlock[ "NAME" ] ELSEIF Empty( hsBlock[ "RETURNS" ] ) .OR. ; - Lower( hsBlock[ "RETURNS" ] ) == "nil" .OR. ; - Lower( hsBlock[ "RETURNS" ] ) == "none" .OR. ; - Lower( hsBlock[ "RETURNS" ] ) == "none." + LOWER( hsBlock[ "RETURNS" ] ) == "nil" .OR. ; + LOWER( hsBlock[ "RETURNS" ] ) == "none" .OR. ; + LOWER( hsBlock[ "RETURNS" ] ) == "none." hsBlock[ "RETURNS" ] = "" DO CASE - CASE Lower( hsBlock[ "CATEGORY" ] ) == "document" + CASE LOWER( hsBlock[ "CATEGORY" ] ) == "document" RETURN hsBlock[ "NAME" ] OTHERWISE - IF Lower( hsBlock[ "TEMPLATE" ] ) == "function" .OR. Lower( hsBlock[ "TEMPLATE" ] ) == "procedure" + IF LOWER( hsBlock[ "TEMPLATE" ] ) == "function" .OR. LOWER( hsBlock[ "TEMPLATE" ] ) == "procedure" RETURN "Procedure " + hsBlock[ "NAME" ] ELSE RETURN LTrim( hsBlock[ "SUBCATEGORY" ] + " " ) + hsBlock[ "CATEGORY" ] + " " + hsBlock[ "NAME" ] @@ -913,7 +946,7 @@ FUNCTION Decode( cType, hsBlock, cKey ) CASE .NOT. Empty( hsBlock[ "NAME" ] ) RETURN "Function " + hsBlock[ "NAME" ] OTHERWISE - RETURN "unknown: " + hsBlock[ "CATEGORY" ] + RETURN "Unknown 'CATEGORY': " + hsBlock[ "CATEGORY" ] ENDCASE ENDIF @@ -983,8 +1016,9 @@ PROCEDURE ShowHelp( cExtraMessage, aArgs ) 2, ; p_hsSwitches[ "format-list" ], ; 1, ; - "-by-method // output is one file per method (function, command, etc)" + IsDefault( p_hsSwitches[ "by-" ] == "method" ), ; - "-by-category // output is one file per category" + IsDefault( p_hsSwitches[ "by-" ] == "category" ), ; + "-output-single // output is one file" + IsDefault( p_hsSwitches[ "output" ] == "single" ), ; + "-output-category // output is one file per category" + IsDefault( p_hsSwitches[ "output" ] == "category" ), ; + "-output-entry // output is one file per entry (function, command, etc)" + IsDefault( p_hsSwitches[ "output" ] == "entry" ), ; "-source= // source folder, default is .." + PATH_SEPARATOR + "..", ; "-include-doc-source // output is to indicate the document source file name", ; "-include-doc-version // output is to indicate the document source file version", ; @@ -1052,12 +1086,12 @@ FUNCTION Parse(cVar, xDelimiter) RETURN cResult -FUNCTION Split(cVar, cDelimiter) +FUNCTION Split(cVar, xDelimiter) LOCAL aResult := {} LOCAL clVar := cVar DO WHILE Len(clVar) > 0 - AAdd(aResult, Parse( @clVar, cDelimiter ) ) + AAdd(aResult, Parse( @clVar, xDelimiter ) ) ENDDO RETURN aResult @@ -1069,12 +1103,13 @@ FUNCTION Join(aVar, cDelimiter) RETURN cResult -FUNCTION ProperCase( cSource ) - RETURN Upper( SubStr( cSource, 1, 1 ) ) + Lower( SubStr( cSource, 2 ) ) - STATIC PROCEDURE AddErrorCondition( cFile, cMessage, nLine ) If HB_AScan( p_aNonConformingSources, {|a| a[ 1 ] == cFile .AND. a[ 2 ] == cMessage .AND. a[ 3 ] == nLine } ) == 0 - AAdd( p_aNonConformingSources, { cFile, cMessage, nLine } ) + IF p_hsSwitches[ "immediate-errors" ] + qout( cFile + ":" + HB_NTOS( nLine ) + ": " + cMessage ) + ELSE + AAdd( p_aNonConformingSources, { cFile, cMessage, nLine } ) + ENDIF ENDIF RETURN @@ -1111,27 +1146,27 @@ FUNCTION Indent( cText, nLeftMargin, nWidth, lRaw ) DO CASE CASE At( SubStr( cLine, idx, 1 ), " ,;.!?" ) == 0 // - CASE Upper( SubStr( cLine, idx, 3 ) ) == ".T." .OR. Upper( SubStr( cLine, idx, 3 ) ) == ".F." + CASE UPPER( SubStr( cLine, idx, 3 ) ) == ".T." .OR. UPPER( SubStr( cLine, idx, 3 ) ) == ".F." idx-- - CASE Upper( SubStr( cLine, idx - 2, 3 ) ) == ".T." .OR. Upper( SubStr( cLine, idx - 1, 3 ) ) == ".F." + CASE UPPER( SubStr( cLine, idx - 2, 3 ) ) == ".T." .OR. UPPER( SubStr( cLine, idx - 1, 3 ) ) == ".F." idx -= 3 - CASE Upper( SubStr( cLine, idx, 5 ) ) == ".AND." .OR. Upper( SubStr( cLine, idx, 5 ) ) == ".NOT." + CASE UPPER( SubStr( cLine, idx, 5 ) ) == ".AND." .OR. UPPER( SubStr( cLine, idx, 5 ) ) == ".NOT." idx-- - CASE Upper( SubStr( cLine, idx - 4, 5 ) ) == ".AND." .OR. Upper( SubStr( cLine, idx - 4, 5 ) ) == ".NOT." + CASE UPPER( SubStr( cLine, idx - 4, 5 ) ) == ".AND." .OR. UPPER( SubStr( cLine, idx - 4, 5 ) ) == ".NOT." idx -= 5 - CASE Upper( SubStr( cLine, idx, 4 ) ) == ".OR." + CASE UPPER( SubStr( cLine, idx, 4 ) ) == ".OR." idx-- - CASE Upper( SubStr( cLine, idx - 3, 4 ) ) == ".OR." + CASE UPPER( SubStr( cLine, idx - 3, 4 ) ) == ".OR." idx -= 4 - CASE Upper( SubStr( cLine, idx - 1, 4 ) ) == "i.e." + CASE UPPER( SubStr( cLine, idx - 1, 4 ) ) == "i.e." idx -= 2 - CASE Upper( SubStr( cLine, idx - 3, 4 ) ) == "i.e." + CASE UPPER( SubStr( cLine, idx - 3, 4 ) ) == "i.e." idx -= 4 - CASE Upper( SubStr( cLine, idx - 1, 4 ) ) == "e.g." + CASE UPPER( SubStr( cLine, idx - 1, 4 ) ) == "e.g." idx -= 2 - CASE Upper( SubStr( cLine, idx - 3, 4 ) ) == "e.g." + CASE UPPER( SubStr( cLine, idx - 3, 4 ) ) == "e.g." idx -= 4 - CASE Upper( SubStr( cLine, idx - 1, 2 ) ) == "*." + CASE UPPER( SubStr( cLine, idx - 1, 2 ) ) == "*." idx -= 2 OTHERWISE EXIT @@ -1171,10 +1206,10 @@ STATIC s_Files := {} #endif DO CASE - CASE Lower( cFormat ) == "alnum" + CASE LOWER( cFormat ) == "alnum" FOR idx := 1 TO Len( cFile ) - char := Lower( SubStr( cFile, idx, 1 ) ) + char := LOWER( SubStr( cFile, idx, 1 ) ) IF "0" <= char .AND. char <= "9" .or. "a" <= char .AND. char <= "z" .or. char == "_" cResult += char IF nLength > 0 .AND. Len( cResult ) == nLength diff --git a/harbour/examples/hbdoc2/tmplates.prg b/harbour/examples/hbdoc2/tmplates.prg index 947ae4a5ca..06b9f4ad2e 100644 --- a/harbour/examples/hbdoc2/tmplates.prg +++ b/harbour/examples/hbdoc2/tmplates.prg @@ -57,7 +57,7 @@ /* #xcommand TEXT TO VAR => #pragma __stream|:=%s -#xcommand TEXT INTO => #pragma __text|+=%s+HB_OSNEWLINE();:="" +#xcommand TEXT INTO => #pragma __text|+=%s+HB_OSNewLine();:="" text into p_hsTemplates this is line 1 @@ -67,7 +67,190 @@ endtext ? */ +#include "hbclass.ch" + +/* a class that will hold one entry */ +CLASS Entry +EXPORTED: + CLASSDATA Fields AS ARRAY INIT { ; + { "DOC", "Doc" }, ; + { "TEMPLATE", "Template" }, ; + { "NAME", "" }, ; + { "CATEGORY", "Category" }, ; + { "SUBCATEGORY", "Sub category" }, ; + { "ONELINER", "" },; + { "SYNTAX", "Syntax" },; + { "ARGUMENTS", "Argument(s)" },; + { "RETURNS", "Returns" },; + { "DESCRIPTION", "Description" },; + { "DATALINK", "Data link" },; + { "DATANOLINK", "Data no link" },; + { "METHODSLINK", "Methods link" },; + { "METHODSNOLINK","Methods no link" },; + { "EXAMPLES", "Example(s)" },; + { "TESTS", "Test(s)" },; + { "STATUS", "Status" },; /* p_aStatus is the constraint list */ + { "COMPLIANCE", "Compliance" },; /* p_aCompliance is the constraint list */ + { "PLATFORMS", "Platform(s)" },; /* p_aPlatforms is the constraint list */ + { "FILES", "File(s)" },; + { "SEEALSO", "See also" }, ; + { "END", "End" } ; + } + +#define S TPL_START +#define E TPL_END +#define T TPL_TEMPLATE +#define R TPL_REQUIRED +#define O TPL_OPTIONAL +#define P TPL_PREFORMATTED +#define U TPL_OUTPUT +#define x 0 + + // this is best viewed with a fixed-width font + // the columns of this array correspond to the elements of Fields + CLASSDATA Templates AS ARRAY INIT { ; + { "Template" , { S, T, x+U, x, O, x+U, x+U, x+U, x+U, x+U, x+U, x+U, x+U, x+U, x +U, x +U, x+U, x+U, x+U, x+U, x+U, E } }, ; + { "Document" , { S, T, R+U, R, O+U, O+U, x+U, x+U, x+U, R+U, x+U, x+U, x+U, x+U, x +U, x +U, x+U, x+U, O+U, O+U, O+U, E } }, ; + { "Function" , { S, T, R+U, R, R, O+U, O+U, O+U, O+U, O+U, x+U, x+U, x+U, x+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; + { "Procedure" , { S, T, R+U, R, R, O+U, O+U, O+U, x, O+U, x+U, x+U, x+U, x+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; + { "Command" , { S, T, R+U, R, R, O+U, R+U, R+U, x+U, R+U, x+U, x+U, x+U, x+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; + { "Class" , { S, T, R+U, R, R, O+U, R+U, R+U, R+U, R+U, O+U, O+U, O+U, O+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; + { "Class method" , { S, T, R+U, R, R, O+U, R+U, R+U, R+U, R+U, x+U, x+U, x+U, x+U, P+O+U, x +U, x+U, x+U, x+U, x+U, O+U, E } }, ; + { "Class data" , { S, T, R+U, R, R, O+U, R+U, x+U, x+U, R+U, x+U, x+U, x+U, x+U, P+O+U, x +U, x+U, x+U, x+U, x+U, O+U, E } }, ; + { "Run time error", { S, T, R+U, R, x, O+U, x+U, x+U, x+U, R+U, x+U, x+U, x+U, x+U, P+O+U, x +U, x+U, O+U, x+U, x+U, O+U, E } }, ; + } + +#undef S +#undef E +#undef T +#undef R +#undef O +#undef P +#undef U +#undef x + + METHOD New( cType ) CONSTRUCTOR + METHOD IsField( c, nType ) + METHOD IsTemplate( c ) + METHOD SetTemplate( cType ) + METHOD IsConstraint( cSectionName, cSection ) + METHOD IsComplete( cIncompleteFielsList ) + METHOD IsPreformatted( cField ) + METHOD IsRequired( cField ) + METHOD IsOptional( cField ) + METHOD IsOutput( cField ) + METHOD FieldName( cField ) + METHOD CategoryIndex( cCategory ) + METHOD SubcategoryIndex( cCategory ) + + DATA Group AS ARRAY + DATA filename AS STRING + DATA type_ AS STRING + DATA sourcefile_ AS STRING + DATA sourcefileversion_ AS STRING + DATA uid_ AS STRING + CLASSDATA uid__ AS INTEGER INIT 0 +ENDCLASS + +METHOD New( cType ) CLASS Entry + ::uid_ = HB_NTOS( ++::uid__ ) + IF .NOT. __ObjHasData( self, self:Fields[ 1 ][ 1 ] ) + AEval( self:Fields, {|a| __objAddData( self, a[ 1 ] ) } ) + ENDIF + IF cType != NIL + self:Group := self:Templates[ HB_AScan( self:Templates, {|a| UPPER( a[ 1 ] ) == UPPER( cType ) } ) ][ 2 ] + ENDIF + RETURN self + +METHOD IsField( c, nType ) CLASS Entry + LOCAL idx + LOCAL lResult + + IF ( lResult := ( idx := HB_AScan( self:Fields, {|a| UPPER( a[ 1 ] ) == UPPER( c ) } ) ) > 0 ) + IF self:Group[ idx ] == 0 + lResult := .F. + ELSEIF nType != NIL .AND. HB_BitAnd( self:Group[ idx ], nType ) != nType + lResult := .F. + ELSE + ENDIF + ENDIF + + RETURN lResult + +METHOD IsTemplate( cType ) CLASS Entry + RETURN HB_AScan( self:Templates, {|a| UPPER( a[ 1 ] ) == UPPER( cType ) } ) > 0 + +METHOD SetTemplate( cTemplate ) CLASS Entry + LOCAL aData := Array( Len( self:Fields ) ) + LOCAL idx + + self:Group := self:Templates[ HB_AScan( self:Templates, {|a| UPPER( a[ 1 ] ) == UPPER( cTemplate ) } ) ][ 2 ] + FOR idx := 1 TO Len( aData ) + IF self:Fields[ idx ][ 1 ] == "TEMPLATE" + aData[ idx ] := { self:Fields[ idx ][ 1 ], cTemplate } + ELSE + aData[ idx ] := { self:Fields[ idx ][ 1 ], IIf( self:Group[ idx ] == TPL_REQUIRED, NIL, "" ) } + ENDIF + NEXT + __ObjSetValueList( self, aData ) + RETURN self + +METHOD IsConstraint( cSectionName, cSection ) CLASS Entry + LOCAL lResult + LOCAL idx := HB_AScan( self:Fields, {|a| a[ 1 ] == cSectionName } ) + + IF HB_BitAnd( self:Group[ idx ], HB_BitAnd( TPL_REQUIRED, TPL_OPTIONAL ) ) == 0 + lResult := .T. + ELSEIF Type( "p_a" + cSectionName ) == "A" + lResult := HB_AScan( &( "p_a" + cSectionName ), cSection ) .OR. ; + HB_AScan( &( "p_a" + cSectionName ), Parse( ( cSection ), "," ) ) + ELSE + lResult := .T. + ENDIF + + RETURN lResult + +METHOD IsComplete( cIncompleteFielsList ) CLASS Entry + LOCAL lResult := .T. + LOCAL idx + + cIncompleteFielsList := "" + + FOR idx := 1 TO Len( self:Fields ) + IF HB_BitAnd( self:Group[ idx ], TPL_REQUIRED ) != 0 .AND. Empty( self:&( self:Fields[ idx ][ 1 ] ) ) + cIncompleteFielsList += "," + self:Fields[ idx ][ 1 ] + lResult := .F. + ENDIF + NEXT + + cIncompleteFielsList := SUBSTR( cIncompleteFielsList, 2 ) + + RETURN lResult + +METHOD IsPreformatted( cField ) CLASS Entry + RETURN HB_BitAnd( self:Group[ HB_AScan( self:Fields, {|a| a[ 1 ] == cField } ) ], TPL_PREFORMATTED ) != 0 + +METHOD IsRequired( cField ) CLASS Entry + RETURN HB_BitAnd( self:Group[ HB_AScan( self:Fields, {|a| a[ 1 ] == cField } ) ], TPL_REQUIRED ) != 0 + +METHOD IsOptional( cField ) CLASS Entry + RETURN HB_BitAnd( self:Group[ HB_AScan( self:Fields, {|a| a[ 1 ] == cField } ) ], TPL_OPTIONAL ) != 0 + +METHOD IsOutput( cField ) CLASS Entry + RETURN HB_BitAnd( self:Group[ HB_AScan( self:Fields, {|a| a[ 1 ] == cField } ) ], TPL_OUTPUT ) != 0 + +METHOD FieldName( cField ) CLASS Entry + RETURN self:Fields[ HB_AScan( self:Fields, {|a| a[ 1 ] == cField } ) ][ 2 ] + +METHOD CategoryIndex( cCategory ) CLASS Entry + RETURN HB_AScan( p_aCategories, {|a| a[ 1 ] == cCategory } ) + +METHOD SubcategoryIndex( cCategory, cSubcategory ) CLASS Entry + RETURN HB_AScan( p_aCategories[ ::CategoryIndex( cCategory ) ][ 2 ], cSubcategory, , , .T. ) + //~ RETURN HB_AScan( p_aCategories[ ::CategoryIndex( cCategory ) ][ 2 ], {|c| c == cSubcategory } ) + INIT PROCEDURE Templates() + LOCAL idx LOCAL aSubCategories := { ; "Application", ; "Array", ; @@ -85,6 +268,7 @@ INIT PROCEDURE Templates() "Garbage collector", ; "Hash table", ; "Idle states", ; + "INET", ; "Internal", ; "Item", ; "Language and Nation", ; @@ -103,238 +287,80 @@ INIT PROCEDURE Templates() } PUBLIC p_aCategories := { ; - { "API", AClone( aSubCategories ), Array( Len( aSubCategories ) ) }, ; - { "C level API", AClone( aSubCategories ), Array( Len( aSubCategories ) ) }, ; - { "C level API compatability", AClone( aSubCategories ), Array( Len( aSubCategories ) ) }, ; - { "Class", { ; - "", ; - "Access", ; - "Assign", ; - "Data", ; - "Method", ; - "Destructor", ; - "Var", ; - }, Array( 7 ) }, ; - { "Command", AClone( aSubCategories ), Array( Len( aSubCategories ) ) }, ; - /* { "Compile time errors", { {} } }, */ ; - { "Document", { "" }, Array( 1 ) }, ; - { "Run time errors", { "" }, Array( 1 ) }, ; - } + { "Document", { "License", "Compiler", "" } }, ; + { "API", AClone( aSubCategories ) }, ; + { "C level API", AClone( aSubCategories ) }, ; + { "C level API compatability", AClone( aSubCategories ) }, ; + { "Class", { ; + "", ; + "Access", ; + "Assign", ; + "Constructor", ; + "Data", ; + "Definition", ; + "Destructor", ; + "Method", ; + "Var", ; + } }, ; + { "Command", AClone( aSubCategories ) }, ; + /* { "Compile time errors", { {} } }, */ ; + { "Run time errors", { "" } }, ; + } + + FOR idx := 1 TO Len( p_aCategories ) + IF .NOT. Empty( p_aCategories[ idx ] ) + AAdd( p_aCategories[ idx ], Array( Len( p_aCategories[ idx ][ 2 ] ) ) ) // holder array of sub-category entries + AAdd( p_aCategories[ idx ], "" ) // holder for sub-category file name + ENDIF + NEXT PUBLIC p_aCompliance := { ; - "C", ; - "C(array)", ; - "C(menu)", ; - "C52S", ; - "C52U", ; - "C53", ; - "FS", ; - "H", ; - "NA", ; - "XPP" ; + { "", "" }, ; + { "C", "This is CA-Cl*pper v5.2 compliant" }, ; + { "C(array)", "This is CA-Cl*pper v5.2 compliant except that arrays in Harbour can have an unlimited number of elements" }, ; + { "C(menu)", "This is CA-Cl*pper v5.2 compliant except that menus (internally arrays) in Harbour can have an unlimited number of elements" }, ; + { "C(arrayblock)", "Codeblock calling frequency and order differs from CA-Cl*pper, since Harbour uses a different (faster) sorting algorithm (quicksort)" }, ; + { "C52S", "? verbage: This is an CA-Cl*pper v5.2 compliant and is only visible if source was compiled with the HB_C52_STRICT flag" }, ; + { "C52U", "This is an undocumented CA-Cl*pper v5.2 function and is only visible if source was compiled with the HB_C52_UNDOC flag" }, ; + { "C53", "This is CA-Cl*pper v5.3 compliant and is only visible if source was compiled with the HB_COMPAT_C53 flag" }, ; + { "FS", "This a Flagship compatibility function and is only visible if source was compiled with the HB_COMPAT_FLAGSHIP flag" }, ; + { "H", "This is Harbour specific" }, ; + { "NA", "Not applicable" }, ; + { "XPP", "This an Xbase++ compatibility function and is only visible if source was compiled with the HB_COMPAT_XPP flag" } ; } PUBLIC p_aPlatforms := { ; - "All", ; - "All(64K)", ; - "All(GT)", ; - "All(LFN)", ; - "Linux(GT)", ; - "OS2(GT)", ; - "Win(GT)", ; - "BSD", ; - "DARWIN", ; - "DOS", ; - "HPUX", ; - "LINUX", ; - "OS2", ; - "SUNOS", ; - "Unix", ; - "Win", ; - "Win32", ; - "Win64", ; - "WinCE" ; + { "", "" }, ; + { "All", "This is available on all platforms" }, ; + { "All(64K)", "This is available on all platforms though some platforms have a string length limit of 64KB" }, ; + { "All(GT)", "This part of the GT API and supported only by some platforms." }, ; + { "All(LFN)", "This is available on all platforms." + HB_OSNewLine() + ; + "If long file names are available Harbour will use/display the first 15 characters " +; + "else Harbour will use/display a 8.3 file name consistent with CA-Cl*pper" }, ; + { "Linux(GT)", "Under Linux the number of columns avaliable depends of the current Terminal screen size." }, ; + { "OS2(GT)", "Under OS/2 the number of columns avaliable depends of the current Terminal screen size." }, ; + { "Win(GT)", "Under Windows, the return value of MAXROW() function is only affected if called after an SETMODE() function" }, ; + { "BSD", "This is available on the BSD platform" }, ; + { "DARWIN", "This is available on the DARWIN platform" }, ; + { "DOS", "This is available on the MS-DOS platform" }, ; + { "HPUX", "This is available on the HPUX platform" }, ; + { "LINUX", "This is available on the LINUX platform" }, ; + { "OS2", "This is available on the OS/2 platform" }, ; + { "SUNOS", "This is available on the SUNOS platform" }, ; + { "Unix", "This is available on the Unix platform(s)" }, ; + { "Win", "This is available on the MS-Windows platform(s)" }, ; + { "Win32", "This is available on the MS-Windows (32-bit) platform(s)" }, ; + { "Win64", "This is available on the MS-Windows (64-bit) platform(s)" }, ; + { "WinCE", "This is available on the MS-Windows-CE platform" } ; } - PUBLIC p_hsTemplates := HB_Hash() - - p_hsTemplates[ "orderby" ] := { ; - "DOC", ; - "TEMPLATE", ; - "NAME", ; - "CATEGORY", ; - "SUBCATEGORY", ; - "ONELINER", ; - "SYNTAX", ; - "ARGUMENTS", ; - "RETURNS", ; - "DESCRIPTION", ; - "DATALINK", ; - "DATANOLINK", ; - "METHODSLINK", ; - "METHODSNOLINK", ; - "EXAMPLES", ; - "TESTS", ; - "STATUS", ; - "COMPLIANCE", ; - "PLATFORMS", ; - "FILES", ; - "SEEALSO", ; - "END" ; + PUBLIC p_aStatus := { ; + { "", "" }, ; + { "R", "Ready" }, ; + { "S", "Started" }, ; + { "N", "Not started" } ; } - p_hsTemplates[ "Template" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Template" } }, ; - "END", { TPL_END } ; - ) - - p_hsTemplates[ "Document" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Document" } }, ; - "NAME", { TPL_REQUIRED }, ; - "CATEGORY", { TPL_REQUIRED }, ; - "SUBCATEGORY", { TPL_OPTIONAL }, ; - "ONELINER", { TPL_REQUIRED }, ; - "DESCRIPTION", { TPL_REQUIRED }, ; - "PLATFORMS", { TPL_OPTIONAL + TPL_CONSTRAINTLIST, p_aPlatforms }, ; - "FILES", { TPL_OPTIONAL }, ; - "SEEALSO", { TPL_OPTIONAL }, ; - "END", { TPL_END } ; - ) - - p_hsTemplates[ "Function" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Function" } }, ; - "NAME", { TPL_REQUIRED }, ; - "CATEGORY", { TPL_REQUIRED }, ; - "SUBCATEGORY", { TPL_REQUIRED }, ; - "ONELINER", { TPL_REQUIRED }, ; - "SYNTAX", { TPL_OPTIONAL }, ; - "ARGUMENTS", { TPL_OPTIONAL }, ; - "RETURNS", { TPL_OPTIONAL }, ; - "DESCRIPTION", { TPL_OPTIONAL }, ; - "EXAMPLES", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "TESTS", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "STATUS", { TPL_OPTIONAL }, ; - "COMPLIANCE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, p_aCompliance }, ; - "PLATFORMS", { TPL_OPTIONAL + TPL_CONSTRAINTLIST, p_aPlatforms }, ; - "FILES", { TPL_OPTIONAL }, ; - "SEEALSO", { TPL_OPTIONAL }, ; - "END", { TPL_END } ; - ) - - p_hsTemplates[ "Procedure" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Procedure" } }, ; - "NAME", { TPL_REQUIRED }, ; - "CATEGORY", { TPL_REQUIRED }, ; - "SUBCATEGORY", { TPL_REQUIRED }, ; - "ONELINER", { TPL_REQUIRED }, ; - "SYNTAX", { TPL_OPTIONAL }, ; - "ARGUMENTS", { TPL_OPTIONAL }, ; - "DESCRIPTION", { TPL_OPTIONAL }, ; - "EXAMPLES", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "TESTS", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "STATUS", { TPL_OPTIONAL }, ; - "COMPLIANCE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, p_aCompliance }, ; - "PLATFORMS", { TPL_OPTIONAL + TPL_CONSTRAINTLIST, p_aPlatforms }, ; - "FILES", { TPL_OPTIONAL }, ; - "SEEALSO", { TPL_OPTIONAL }, ; - "END", { TPL_END } ; - ) - - p_hsTemplates[ "Command" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Command" } }, ; - "NAME", { TPL_REQUIRED }, ; - "CATEGORY", { TPL_REQUIRED }, ; - "SUBCATEGORY", { TPL_REQUIRED }, ; - "ONELINER", { TPL_REQUIRED }, ; - "SYNTAX", { TPL_REQUIRED }, ; - "ARGUMENTS", { TPL_REQUIRED }, ; - "DESCRIPTION", { TPL_REQUIRED }, ; - "EXAMPLES", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "TESTS", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "STATUS", { TPL_OPTIONAL }, ; - "COMPLIANCE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, p_aCompliance }, ; - "PLATFORMS", { TPL_OPTIONAL + TPL_CONSTRAINTLIST, p_aPlatforms }, ; - "FILES", { TPL_OPTIONAL }, ; - "SEEALSO", { TPL_OPTIONAL }, ; - "END", { TPL_END } ; - ) - - p_hsTemplates[ "Class" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Class" } }, ; - "NAME", { TPL_REQUIRED }, ; - "CATEGORY", { TPL_REQUIRED }, ; - "SUBCATEGORY", { TPL_REQUIRED }, ; - "ONELINER", { TPL_REQUIRED }, ; - /* "CONSTRUCTOR", { TPL_REQUIRED }, */ ; - "SYNTAX", { TPL_REQUIRED }, ; - "ARGUMENTS", { TPL_REQUIRED }, ; - "RETURNS", { TPL_REQUIRED }, ; - "DESCRIPTION", { TPL_REQUIRED }, ; - "DATALINK", { TPL_REQUIRED }, ; - "DATANOLINK", { TPL_REQUIRED }, ; - "METHODSLINK", { TPL_REQUIRED }, ; - "METHODSNOLINK", { TPL_REQUIRED }, ; - "EXAMPLES", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "TESTS", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "STATUS", { TPL_OPTIONAL }, ; - "COMPLIANCE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, p_aCompliance }, ; - "PLATFORMS", { TPL_OPTIONAL + TPL_CONSTRAINTLIST, p_aPlatforms }, ; - "FILES", { TPL_OPTIONAL }, ; - "SEEALSO", { TPL_OPTIONAL }, ; - "END", { TPL_END } ; - ) - - p_hsTemplates[ "Class method" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Class method" } }, ; - "NAME", { TPL_REQUIRED }, ; - "CATEGORY", { TPL_REQUIRED }, ; - "ONELINER", { TPL_REQUIRED }, ; - "SYNTAX", { TPL_REQUIRED }, ; - "ARGUMENTS", { TPL_REQUIRED }, ; - "RETURNS", { TPL_REQUIRED }, ; - "DESCRIPTION", { TPL_REQUIRED }, ; - "END", { TPL_END } ; - ) - - //~ VAR - //~ *METHOD - //~ *DATA - //~ ACCESS - //~ ASSIGN - //~ FRIEND - - p_hsTemplates[ "Class data" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Class data" } }, ; - "NAME", { TPL_REQUIRED }, ; - /* "DATA", { TPL_REQUIRED }, */ ; - "SYNTAX", { TPL_REQUIRED }, ; - "CATEGORY", { TPL_REQUIRED }, ; - "ONELINER", { TPL_REQUIRED }, ; - "DESCRIPTION", { TPL_REQUIRED }, ; - "END", { TPL_END } ; - ) - - p_hsTemplates[ "Run time error" ] := HB_Hash( ; - "DOC", { TPL_START }, ; - "TEMPLATE", { TPL_REQUIRED + TPL_CONSTRAINTLIST, { "Run time error" } }, ; - "NAME", { TPL_REQUIRED }, ; - "CATEGORY", { TPL_REQUIRED }, ; - "ONELINER", { TPL_REQUIRED }, ; - "DESCRIPTION", { TPL_REQUIRED }, ; - "EXAMPLES", { TPL_PREFORMATTED + TPL_OPTIONAL }, ; - "COMPLIANCE", { TPL_OPTIONAL + TPL_CONSTRAINTLIST, p_aCompliance }, ; - "SEEALSO", { TPL_OPTIONAL }, ; - "END", { TPL_END } ; - ) - PUBLIC p_aConversionList := { ; 38, "amp", ; 34, "quot", ; @@ -473,17 +499,14 @@ RETURN PROCEDURE ShowTemplatesHelp( cTemplate ) - LOCAL idxTemplates, nFrom := 1, nTo := Len( p_hsTemplates ) + LOCAL o := Entry():New() + LOCAL idxTemplates, nFrom := 1, nTo := Len( o:Templates ) LOCAL cDelimiter := p_hsSwitches[ "DELIMITER" ] - LOCAL aKeyValue - LOCAL cSection - LOCAL nFlags - LOCAL nSections - LOCAL idxSection + LOCAL idx IF .NOT. Empty( cTemplate ) .AND. cTemplate != "Template" - IF HB_HHasKey( p_hsTemplates, cTemplate ) - nFrom := nTo := HB_HPos( p_hsTemplates, cTemplate ) + IF o:IsTemplate( cTemplate ) + nFrom := nTo := HB_AScan( o:Templates, {|a| UPPER( a[ 1 ] ) == UPPER( cTemplate ) } ) ELSE ShowHelp( "Unknown template '" + cTemplate + "'" ) RETURN @@ -491,25 +514,27 @@ PROCEDURE ShowTemplatesHelp( cTemplate ) ENDIF FOR idxTemplates := nFrom TO nTo - aKeyValue := HB_HPairAt( p_hsTemplates, idxTemplates ) - IF aKeyValue[ 1 ] != "Template" - AAdd( aKeyValue, {} ) - HB_HEval( aKeyValue[ 2 ], {|k,v| AAdd( ATail( aKeyValue ), { cDelimiter + k + cDelimiter, v[ 1 ], HB_AScan( p_hsTemplates[ "orderby" ], k ) } ) } ) - ASort( ATail( aKeyValue ), , , {|lv,rv| lv[ 3 ] < rv[ 3 ] } ) - nSections := Len( ATail( aKeyValue ) ) + IF .NOT. Empty( o:Templates[ idxTemplates ] ) .AND. ; + .NOT. Empty( o:Templates[ idxTemplates ][ 1 ] ) .AND. ; + o:Templates[ idxTemplates ][ 1 ] != "Template" - FOR idxSection := 1 TO nSections - cSection := ATail( aKeyValue )[ idxSection ][ 1 ] - nFlags := ATail( aKeyValue )[ idxSection ][ 2 ] - ShowSubHelp( IIf( idxSection == 1, "/", " " ) + "* " + cSection, 1, 0 ) - IF cSection == cDelimiter + "TEMPLATE" + cDelimiter - ShowSubHelp( " * " + aKeyValue[ 1 ], 1, 0 ) - ELSEIF 1 < idxSection .AND. idxSection < nSections - ShowSubHelp( " * " + IIf( HB_BitAnd( nFlags, TPL_REQUIRED ) == TPL_REQUIRED, "", "" ), 1, 0 ) - ELSEIF idxSection == nSections - ShowSubHelp( " */", 1, 0 ) + //~ IF nFrom != nTo + //~ ShowSubHelp( o:Templates[ idxTemplates ][ 1 ], 1, 0 ) + //~ ENDIF + + o:SetTemplate( o:Templates[ idxTemplates ][ 1 ] ) + + FOR idx := 1 TO Len( o:Fields ) + IF o:Group[ idx ] != 0 + ShowSubHelp( IIf( idx == 1, "/", " " ) + "* " + cDelimiter + o:Fields[ idx ][ 1 ] + cDelimiter, 1, 0 ) + IF o:Fields[ idx ][ 1 ] == "TEMPLATE" + ShowSubHelp( " * " + o:Template, 1, 0 ) + ELSEIF o:Group[ idx ] != TPL_START .AND. o:Group[ idx ] != TPL_END .AND. .T. + ShowSubHelp( " * " + IIf( o:IsRequired( o:Fields[ idx ][ 1 ] ), "", "" ), 1, 0 ) + ENDIF ENDIF NEXT + ShowSubHelp( " */", 1, 0 ) ShowSubHelp( "", 1, 0 ) ENDIF NEXT @@ -520,16 +545,16 @@ PROCEDURE ShowComplianceHelp() LOCAL idx FOR idx := 1 TO Len( p_aCompliance ) - ShowSubHelp( p_aCompliance[ idx ], 1, 0, idx ) - ShowSubHelp( Decode( "Compliance", NIL, p_aCompliance[ idx ] ), 1, 6, idx ) - OutStd( HB_OSNewLine() ) + ShowSubHelp( p_aCompliance[ idx ][ 1 ], 1, 0, idx ) + ShowSubHelp( Decode( "COMPLIANCE", NIL, p_aCompliance[ idx ][ 1 ] ), 1, 6, idx ) + ShowSubHelp( "", 1, 0 ) NEXT PROCEDURE ShowPlatformsHelp LOCAL idx FOR idx := 1 TO Len( p_aPlatforms ) - ShowSubHelp( p_aPlatforms[ idx ], 1, 0, idx ) - ShowSubHelp( Decode( "Platforms", NIL, p_aPlatforms[ idx ] ), 1, 6, idx ) - OutStd( HB_OSNewLine() ) + ShowSubHelp( p_aPlatforms[ idx ][ 1 ], 1, 0, idx ) + ShowSubHelp( Decode( "PLATFORMS", NIL, p_aPlatforms[ idx ][ 1 ] ), 1, 6, idx ) + ShowSubHelp( "", 1, 0 ) NEXT