From fa876ddc8acc7a2f62caedb654948da7e335b9a0 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 13 Sep 2017 11:51:47 +0000 Subject: [PATCH] 2017-09-13 11:40 UTC Viktor Szakats (vszakats users.noreply.github.com) * config/*/*.mk * config/*.mk * config/postinst.hb * ChangeLog.txt * src/rdd/usrrdd/rdds/*.prg * sync with 3.4 fork minor code changes, comments, some strings --- ChangeLog.txt | 206 ++++++++-------- config/aix/gcc.mk | 2 +- config/aix/libs.mk | 2 +- config/bsd/pcc.mk | 2 +- config/common/watcom.mk | 10 +- config/detect.mk | 2 +- config/dos/djgpp.mk | 2 +- config/global.mk | 30 +-- config/globsh.mk | 10 +- config/hpux/gcc.mk | 2 +- config/linux/sunpro.mk | 2 +- config/os2/gcc.mk | 2 +- config/postinst.hb | 4 +- config/rules.mk | 6 +- config/sunos/sunpro.mk | 4 +- src/rdd/usrrdd/rdds/arrayrdd.prg | 393 +++++++++++++++---------------- src/rdd/usrrdd/rdds/dbtcdx.prg | 5 +- src/rdd/usrrdd/rdds/fptcdx.prg | 7 +- src/rdd/usrrdd/rdds/hscdx.prg | 75 +++--- src/rdd/usrrdd/rdds/logrdd.prg | 232 ++++++++---------- src/rdd/usrrdd/rdds/rlcdx.prg | 41 ++-- src/rdd/usrrdd/rdds/smtcdx.prg | 7 +- src/rdd/usrrdd/rdds/vfpcdx.prg | 6 +- 23 files changed, 498 insertions(+), 554 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 8aa6a982c2..3bc441454e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,14 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2017-09-13 11:40 UTC Viktor Szakats (vszakats users.noreply.github.com) + * config/*/*.mk + * config/*.mk + * config/postinst.hb + * ChangeLog.txt + * src/rdd/usrrdd/rdds/*.prg + * sync with 3.4 fork minor code changes, comments, some strings + 2017-09-12 23:01 UTC Viktor Szakats (vszakats users.noreply.github.com) * utils/hbmk2/hbmk2.prg * sync with 3.4 fork minor code changes, comments, some strings @@ -661,17 +669,17 @@ 2017-05-10 12:27 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbwin/olecore.c - + automatically add WIN_VT_ARRAY bit in 1-st parameter of - __oleVariantNew() when 2-nd parameter is an array + + automatically add WIN_VT_ARRAY bit in 1st parameter of + __oleVariantNew() when 2nd parameter is an array + added support for typed variant arrays to __oleVariantNew() Now it's possible to create strong typed one dimensional arrays and pass them as parameters to foreign OLE code, i.e. oOle:setArrayOfStrings( ; - __oleVariantNew( WIN_VT_BSTR, { "1-st", "2-nd", "3-rd" } ) ) + __oleVariantNew( WIN_VT_BSTR, { "1st", "2nd", "3rd" } ) ) oOle:setArrayOfIntegers( ; __oleVariantNew( WIN_VT_INT, { 1, 2, 3, 4 } ) + added support for array of integers initialization from strings - passed to __oleVariantNew() in 2-nd parameter. + passed to __oleVariantNew() in 2nd parameter. Now it's possible to create strong typed one dimensional OLE array initialized with string bytes ASCII values, i.e. oOle:setUcharStr( ; @@ -1313,7 +1321,7 @@ * contrib/hbmisc/dates.c ! fixed WOY() to return some reasonable results. I have no idea what author wanted to reach but now WOY() be default returns ISO 8601 - week number and simple week number if 2-nd parameter is .F. + week number and simple week number if 2nd parameter is .F. 2016-12-15 12:51 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/harbour.hbx @@ -1354,7 +1362,7 @@ * src/rdd/dbfntx/dbfntx1.c * discard buffers when next free page is changed even without touching - version number - minor protection for potentially broken 3-rd party + version number - minor protection for potentially broken 3rd party NTX code or very old [x]Harbour NTX RDDs which do not increment version number on update. @@ -1817,8 +1825,8 @@ by SSL_up_ref() This modification also fixes possible GPF trap when SSL filter socket was created dynamically from C code without SSL pointer - item on HVM stack in 2-nd parameter and removes old hack which - saved internally 2-nd HVM stack parameter. + item on HVM stack in 2nd parameter and removes old hack which + saved internally 2nd HVM stack parameter. + allow to pass SSL_CTX instead of SSL in "ssl", "ctx" or "key" items of hash array used to initialize SSL socket filter. Using SSL_CTX allows to use the same hash array to set SSL socket filter for @@ -1859,7 +1867,7 @@ * src/3rd/jpeg/Makefile * src/3rd/jpeg/jconfig.h - ! moved definitions which interacts with 3-rd party code using libjpeg + ! moved definitions which interacts with 3rd party code using libjpeg header files to jconfig.h 2016-09-23 09:47 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -2063,7 +2071,7 @@ ! fixed yet another RDDI_SETHEADER clearing in internal DBF RDD code * clear few passed variables before internal SELF_INFO() and SELF_RDDINFO() read calls - they were safe in current code but - potentially may badly interact with 3-rd party DBF RDD wrappers. + potentially may badly interact with 3rd party DBF RDD wrappers. 2016-06-22 23:58 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/dbinfo.ch @@ -2192,7 +2200,7 @@ 2016-04-18 18:05 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/strrepl.c ! fixed hb_strReplace() for strings longer then 1024 bytes and - array used in 3-rd parameter. + array used in 3rd parameter. 2016-04-18 17:33 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/gtqtc/gtqtc1.cpp @@ -2316,7 +2324,7 @@ * src/rtl/direct.c ! removed set of MS-Windows attributes passed unconditionally to hb_fsFind*() functions in Directory() PRG function. - It fixes "L" attribute passed in 2-d parameter of Directory() + It fixes "L" attribute passed in 2nd parameter of Directory() function in *nix builds. When "L" is given in attribute list then Directory() do not follow links. @@ -3450,7 +3458,7 @@ 2015-12-04 23:05 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbexpra.c - ! accept strings passed in 2-nd parameter of _GET_() function + ! accept strings passed in 2nd parameter of _GET_() function with the highest priority for macro and macroalias expressions ! fixed late evaluation of macroalias expressions in GET variables. Thanks to Volodimyr for information about the problem and self @@ -3535,7 +3543,7 @@ JSON data. If this parameter is NULL then strings are decoded in raw form and unicode character with code over 255 are converted to '?' char. - + added optional 3-rd parameter with codepage ID to PRG functions + + added optional 3rd parameter with codepage ID to PRG functions hb_jsonEncode() and hb_jsonDecode(). If this parameter is not given then above functions works like before this modification: hb_jsonEncode() uses raw string encoding and hb_jsonDecode() uses @@ -3573,14 +3581,14 @@ 2015-11-24 09:05 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbapirdd.h * src/rdd/wacore.c - * changed 4-th parameter of hb_rddRequestArea() from HB_BOOL fWait to + * changed 4th parameter of hb_rddRequestArea() from HB_BOOL fWait to HB_ULONG ulMilliSec [INCOMPATIBLE] * src/rdd/dbdetach.c - + accept optionally as 4-th parameter of hb_dbRequest() numeric value + + accept optionally as 4th parameter of hb_dbRequest() numeric value with timeout in seconds. The previous version using xBase++ compatible - parameters (logical value in 4-th parameter) is still working. + parameters (logical value in 4th parameter) is still working. ; above modifications are based on request and patch sent to harbour-devel list by Rolf (many thanks), ref: @@ -3779,7 +3787,7 @@ 2015-10-21 19:26 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbfoxpro/hbfoxpro.hbx * contrib/hbfoxpro/occurs.prg - + added FoxPro compatible At() function with 3-rd + + added FoxPro compatible At() function with 3rd parameter: fox_At( , , ) -> @@ -3844,7 +3852,7 @@ 2015-10-12 12:56 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/hbsocket.c - ! added casting to 2-nd parameter of inet_ntop() as workaround for + ! added casting to 2nd parameter of inet_ntop() as workaround for wrong declaration inet_ntop() in MSVC header file 2015-10-09 13:38 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -4005,7 +4013,7 @@ * contrib/hbct/files.c ! do not allow to remove empty directories by FileDelete() function even if user explicitly sets directory attribute - CT3 compatible fix. - ! remove READONLY attribute before deleting READONLY files if 2-nd + ! remove READONLY attribute before deleting READONLY files if 2nd parameter of FileDelete() contains READONLY bit * src/rtl/filesys.c @@ -4474,7 +4482,7 @@ used to operate on socket filters. At PRG level standard hb_socket*() functions can be used. The following things has been changed in PRG hb_socket*() functions: - hb_socketErorrString() can accept as 1-st or 2-nd parameter + hb_socketErorrString() can accept as 1st or 2nd parameter and redirect call to socket filter errorStr() method. hb_socketClose() executes automatically shutdown() for connected sockets - it is important in windows only where without explicit @@ -4831,8 +4839,8 @@ so it can work like hb_FSize() but for virtual FS not only for local files. Now this function has the following syntax: hb_vfSize( | [, ] ) -> - The 2-nd parameter is significant only when - the 1-st one is character value. + The 2nd parameter is significant only when + the 1st one is character value. * src/rtl/gttrm/gttrm.c * replaced C++ comments with ANSI ones @@ -5561,10 +5569,10 @@ [], @nCount ) -> (From Viktor's branch: 2014-01-19 13:42 UTC+0100 Viktor Szakats) ! fixed connection handle parameter position in AdsDDRemoveTable() - It was 4-th: + It was 4th: AdsDDRemoveTable( , , , [ ] ) -> - Now is 3-rd: + Now is 3rd: AdsDDRemoveTable( , , [ ] ) -> (From Viktor's branch: 2014-01-14 23:53 UTC+0100 Viktor Szakats) @@ -6021,8 +6029,8 @@ + added support for SSL/TLS encryption in hb_inet*() sockets. To enable SSL/TLS encryption on such socket it's enough to call hb_inetSSL_connect() or hb_inetSSL_accept() passing as - 1-st parameter hb_inet socket item with already established - connection and in in the 2-nd parameter SSL item. The peer + 1st parameter hb_inet socket item with already established + connection and in in the 2nd parameter SSL item. The peer should call second function. In general hb_inetSSL_connect() should be called by client and hb_inetSSL_accept() by server. To use hb_inetSSL_accept() it's necessary to also set @@ -6126,7 +6134,7 @@ still supported but I had to rewrite this code so please make real life test and verify me. In few cases I slightly change the code and now it can be a little bit more restrictive, i.e. typos in "AtutoInc" - field type will be detected (previous code checked only for 1-st + field type will be detected (previous code checked only for 1st letter "A"). 2015-02-07 21:02 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -6540,7 +6548,7 @@ * src/rtl/dirscan.prg * src/rtl/filebuf.c + added lTime member to HB_FFIND structure - + added 3-rd parmeter to hb_fsDirectory() + + added 3rd parmeter to hb_fsDirectory() + extended default maximum number of Harbour file IO redirecros to 128 * use hb_xgrabz() * formatting @@ -7310,7 +7318,7 @@ FieldName() function and in all other cases only HB_SYMBOL_NAME_LEN characters is significant for Harbour so such decision should be well thought by RDD authors because it may confuse users. - Warning: all 3-rd party RDDs which need to force shorter names + Warning: all 3rd party RDDs which need to force shorter names should update uiMaxFieldNameLength in their NEW() method just after SUPER_NEW() call, i.e. like in core DBF RDD. ! respect uiMaxFieldNameLength when new fields are added @@ -7327,9 +7335,9 @@ * minor modification in adsFieldName() * contrib/hbwin/wapi_winbase.c - + added support for FORMAT_MESSAGE_ALLOCATE_BUFFER and 6-th - parameter to wapi_FormatMessage() function. The 6-th parameter - has higher priority than size of string passed in the 5-th parameter. + + added support for FORMAT_MESSAGE_ALLOCATE_BUFFER and 6th + parameter to wapi_FormatMessage() function. The 6th parameter + has higher priority than size of string passed in the 5th parameter. ! fixed potential memory leak 2014-10-02 22:55 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -7389,14 +7397,14 @@ win_PrintDataRaw( , [, ] ) -> It's similar to win_PrintFileRaw() but sends to given printer passed - in 2-nd parameter instead of file body. + in 2nd parameter instead of file body. On error it returns negative value. * cleaned casting and minor formatting * src/rtl/gtxwc/gtxwc.c + added support for HB_GTI_DISPIMAGE. It's slightly modified code sent by Rolf to Harbour devel list. In comparison to original version it - supports as 4-th item of array with bitmap description to use + supports as 4th item of array with bitmap description to use with some other GTs which can support different color depths or can make conversion. It also supports bitmaps passed as strings. % slightly improved HB_GFX_GETPIXEL @@ -7474,7 +7482,7 @@ * prepare the code to return error object when evaluated expression fails as proposed by Teo. This functionality is not enabled yet. I'm waiting for information about current public debugger API used - in 3-rd party projects before I decide to change it. + in 3rd party projects before I decide to change it. 2014-09-18 00:23 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com) * contrib/gtwvg/gtwgud.c @@ -7549,7 +7557,7 @@ exists * src/vm/hashfunc.c - ! set default value before decoding 2-nd logical parameter in + ! set default value before decoding 2nd logical parameter in hb_HAutoAdd() function. It fixes ambiguity reported by Mindaugas. 2014-09-11 14:41 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -7576,7 +7584,7 @@ This function tries to execute given block or function inside BEGIN SEQUENCE / RECOVER oErr / END SEQUENCE statement. It return HB_TRUE if it was executed without any problem and - HB_FALSE otherwise. Result or RTE object is stored in 1-st + HB_FALSE otherwise. Result or RTE object is stored in 1st parameter and should be freed by the caller using hb_itemRelese() * src/debug/dbgentry.c @@ -7600,7 +7608,7 @@ and updating locally any information about debugger state. All such information can be accessed at any time using __dbg*() functions. - It should greatly simplify creating 3-rd party debuggers like + It should greatly simplify creating 3rd party debuggers like HWDebug or HBQTDebug. * src/debug/debugger.prg @@ -7708,7 +7716,7 @@ 2014-08-21 01:11 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbtip/mail.prg - ! fixed missing 1-st adress in CC and BCC parameters - many + ! fixed missing 1st adress in CC and BCC parameters - many for information about the bug and patch * contrib/hbtip/sendmail.prg @@ -7741,7 +7749,7 @@ as used in Cl*pper and Harbour PP. ! fixed input line size in SET edit window ! fixed validation in some input boxes - * process only 1-st parameter in some commands just like Cl*pper does + * process only 1st parameter in some commands just like Cl*pper does + added support for FILE OPEN command ! fixed CALLSTACK ON | OFF command ! fixed NUM command @@ -8079,7 +8087,7 @@ 2014-05-20 19:49 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/debug/dbgbrwsr.prg ! update current row position after resizing - It should fix 2-nd problem reported by Rolf. + It should fix 2nd problem reported by Rolf. 2014-05-20 17:03 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/debug/debugger.prg @@ -8300,7 +8308,7 @@ I do not remember why I added code to remove the STOP signal - probably I was experimenting with some new things working on Harbour MT code and I forgot to deactivate it. - NOTE: 3-rd party developers who use GC collectible pointer items + NOTE: 3rd party developers who use GC collectible pointer items must not activate any PRG code execution inside their mark functions. @@ -8489,7 +8497,7 @@ Please remember that redirectors like NETIO can be used as wrapper to other redirectors so code like: pFile := hb_vfOpen( "NET:192.168.0.1:::COM1:9600,8N1" ) - opens 1-st serial port on the server and + opens 1st serial port on the server and pFile := hb_vfOpen( "NET:192.168.0.1:::COM$/dev/ttyUSB0:9600,8N1" ) opens "/dev/ttyUSB0" serial device on the server. @@ -8577,7 +8585,7 @@ 2014-03-04 19:12 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/xhb/hbserv.c - * pacified CLANG warning reported by Francek + * pacified CLANG warning reported by Franček 2014-03-04 18:15 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/debug/debugger.prg @@ -9045,7 +9053,7 @@ * src/3rd/png/png.dif * updated libpng 1.6.1 -> 1.6.8 ; modifications below taken from Viktor branch - Warning: some of them may cause problems with 3-rd party + Warning: some of them may cause problems with 3rd party code which needs fully functional libpng. * disabled PNG_CONSOLE_IO_SUPPORTED build option. (MSVS 2013 doesn't support 'stderr' constant) @@ -9271,7 +9279,7 @@ * variable name synced with Viktor branch * contrib/hbct/strswap.c - ! fixed NULL reference when neither 1-st nor 2-nd parameter is passed + ! fixed NULL reference when neither 1st nor 2nd parameter is passed by reference * contrib/hbct/fcopy.prg @@ -9426,7 +9434,7 @@ * include/harbour.hbx * src/rtl/hbdef.c + added new PRG function hb_defaultValue(). It's similar to hb_default() - but it returns expected value instead of setting 1-st parameter. + but it returns expected value instead of setting 1st parameter. New function can be used to replace code like: hb_default( @lParam, .T. ) IF lParam @@ -9443,7 +9451,7 @@ * contrib/hbfship/stroccur.prg ! do not generate error when wrong parameters are passed to StrOccurs() function (FS compatible behavior) - ! set default value of 3-rd parameter in StrOccurs() to .T. only if it's not + ! set default value of 3rd parameter in StrOccurs() to .T. only if it's not passed at all, otherwise set it to .F. (FS compatible behavior) % small simplification @@ -9499,7 +9507,7 @@ * include/hbapicdp.h * include/hbapiitm.h * src/rtl/itemseri.c - * changed 2-nd parameter in hb_itemSerialize() and hb_itemSerializeCP() + * changed 2nd parameter in hb_itemSerialize() and hb_itemSerializeCP() from HB_BOOL fNumSize parameter to int iFlags. Previous fNumSize is replaced by HB_SERIALIZE_NUMSIZE flag. Warning: declaration is not backward compatible though existing code @@ -9507,7 +9515,7 @@ without recompilation. + added support for optional compression of serialized values. It can be enabled in C code by HB_SERIALIZE_COMPRESS flag. - + added support for serialization flags passed in 2-nd parameter to + + added support for serialization flags passed in 2nd parameter to hb_Serialize() PRG function. ; Info: support for compression and decompression exists only in programs which are linked with ZLIB library. Programmers @@ -9529,7 +9537,7 @@ 2013-12-20 00:24 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbexpra.c - ! fixed silly copy and past typo + ! fixed silly copy and paste typo 2013-12-19 09:31 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + src/rtl/hbzlibc.c @@ -9655,11 +9663,11 @@ 2013-11-28 03:04 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbmxml/3rd/minixml/mxml_fil.c - ! fixed mxmlLoadString() with top node - patch by Francek Prijatelj + ! fixed mxmlLoadString() with top node - patch by Franček Prijatelj * contrib/hbmxml/core.c - ! fixed mxml node reference counter in mxmlAdd() - it fixes 2-dn - problem reported by Francek Prijatelj + ! fixed mxml node reference counter in mxmlAdd() - it fixes 2nd + problem reported by Franček Prijatelj 2013-11-27 20:32 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/gtxwc/gtxwc.c @@ -9723,7 +9731,7 @@ * src/rtl/gtxwc/gtxwc.c * src/rtl/gtxwc/gtxwc.h - % use 32 bit screen buffer items also in 64bit systems + % use 32-bit screen buffer items also in 64-bit systems ! fixed race condition in SetMode() ! fixed infinite loop with size updating in fullscreen and maximized modes @@ -9898,7 +9906,7 @@ * tests/video.prg ! fixed CLIP and xHarbour compilation + added support for testing UTF8 screen output - (non empty 1-st parameter) and HB_GTI_COMPATBUFFER (non empty + (non empty 1st parameter) and HB_GTI_COMPATBUFFER (non empty second parameter) 2013-10-30 23:12 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -10036,7 +10044,7 @@ 2013-09-24 16:59 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbvm.h * src/vm/hvm.c - * added new 7-th parameter fOverLoad to hb_vmRegisterSymbols() function. + * added new 7th parameter fOverLoad to hb_vmRegisterSymbols() function. When it's TRUE then new public function symbols overload existing ones. * src/vm/runner.c @@ -10059,7 +10067,8 @@ 2013-09-19 09:52 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/hbgtcore.c + added support for GT parameters passed in //GT - parameter after ":", i.e. //GT: + parameter after ":", i.e. //GT: or + --hb:gt: * src/rtl/gttrm/gttrm.c + added new parameters set in //GTTRM: @@ -10147,7 +10156,7 @@ 2013-08-26 20:56 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/compiler/hbdbginf.c ! fixed module names generated for debugger line info when user compiles - files passing path with drive letters, i.e. hbmk2 c:\temp\test.prg + files passing path with drive letters, i.e. hbmk2 C:\temp\test.prg Thanks to Anton Ryzhov for the information about the problem. 2013-08-26 15:51 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -10188,7 +10197,7 @@ * src/rtl/mtran.c * updated to show strict Clipper compatible behavior - Clipper - ignores 3-rd cSoftCR parameter if 2-nd one cHardCR is not given + ignores 3rd cSoftCR parameter if 2nd one cHardCR is not given (strict compatibility is covered by HB_CLP_STRICT macro and disabled by default - undocumented feature which may confuse users) @@ -10266,8 +10275,8 @@ ! fixed tip_TimeStamp() using hb_timeStampUTCOffset() instead of hb_timeUTCOffset() to correctly calculate UTC offset for dates different then current one. - ! decode time passed as numeric second() value in 2-nd parameter of - tip_TimeStamp() only when the 1-st one contains pure date value. + ! decode time passed as numeric second() value in 2nd parameter of + tip_TimeStamp() only when the 1st one contains pure date value. 2013-07-08 23:34 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/debug/dbgentry.c @@ -10300,7 +10309,7 @@ * src/debug/debugger.prg ! keep RunAtStartup flag synced with menu ! fixed options decoding from init.cld file. - Thanks to Francek Prijatelj for locating the problem though fix + Thanks to Franček Prijatelj for locating the problem though fix should be a little bit different. * src/debug/tbrwtext.prg @@ -10480,12 +10489,13 @@ * utils/hbmk2/hbmk2.prg ! reverted 2nd hunk of 2013-06-03 16:45 UTC+0200. It introduced unnecessary and confusing disparity between - command-line and .hbp/.hbm while they are supposed to + command-line and .hbp/.hbm while these are supposed to be working similarly. It also breaks syntax supported - in .hbc directives, and it also makes behavior contracting - with the way documented in hbmk2 help and hbmk2 examples. + in .hbc directives, and it also makes behavior contradicting + the way documented in hbmk2 help and hbmk2 examples. All this, to resolve the problem of space containing option - values for one specific and rare subcase of reverted apostrophs. + values for the one specific and rare subcase of reverted + apostrophs. To pass option/directive value containing a space, put the whole option (or the option value) in double quotes (as documented in help), this works equally well on the @@ -10498,7 +10508,7 @@ 2013-06-12 00:28 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/wvgcore.c * contrib/gtwvg/wvgcuig.c - ! Fixed to compile for 64 bits, reported by Maurizio, thanks. + ! Fixed to compile for 64-bit, reported by Maurizio, thanks. 2013-06-11 20:26 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbpp.h @@ -10582,14 +10592,14 @@ 2013-06-05 23:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/wvgcore.c - + Added: function WVT_DRAWPICTUREEX - WVT_LOADPICTUREFROMRESOURCEEX + + Added: function WVT_DRAWPICTUREEX() + WVT_LOADPICTUREFROMRESOURCEEX() * contrib/gtwvg/wvgcuig.c - + Added: function WVG_PICTUREEX + + Added: function WVG_PICTUREEX() * contrib/gtwvg/wvgwin.c - + Added: function WVG_FORCEWINDOWTOTOP + + Added: function WVG_FORCEWINDOWTOTOP() 2013-06-05 19:15 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/gtqtc/gtqtc1.cpp @@ -10752,12 +10762,12 @@ 2013-05-21 07:55 UTC-0300 Antonio Carlos Pantaglione (toninho/at/fwi.com.br) * contrib/rddads/adsfunc.c - + Enable function ADSSETINDEXDIRECTION only for ADS 9.0 or newer - % small optmizations in ADSSETINDEXDIRECTION + + Enable function ADSSETINDEXDIRECTION() only for ADS 9.0 or newer + % small optmizations in ADSSETINDEXDIRECTION() 2013-05-17 14:20 UTC+0200 Jfl mafact (jfl/at/mafact.com) * contrib/rddads/adsfunc.c - + Adding new function ADSSETINDEXDIRECTION + + Adding new function ADSSETINDEXDIRECTION() 2013-05-17 02:57 UTC+0200 Tamas TEVESZ (ice extreme.hu) * contrib/3rd/sqlite3/sqlite3.c @@ -10778,8 +10788,8 @@ 2013-05-16 17:00 UTC+0200 Jfl mafact (jfl/at/mafact.com) * contrib/rddads/adsfunc.c - ! Adding 2nd param to function ADSCOPYTABLECONTENT to allow filtering - like in ADSCOPYTABLE + ! Adding 2nd param to function ADSCOPYTABLECONTENT() to allow filtering + like in ADSCOPYTABLE() 2013-05-15 19:54 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/pp/hbpp.c @@ -10792,7 +10802,7 @@ * src/rtl/hbprocfn.c + added support merged stdout and stderr output in hb_processRun() PRG function. To extract merged stdin and stdout application output - it's enough to pass by reference in 3-rd and 4-th parameters the same + it's enough to pass by reference in 3rd and 4th parameters the same variable, i.e.: nResult := hb_processRun( cCommand,, @cOutErr, @cOutErr ) @@ -10973,7 +10983,7 @@ 2013-04-25 12:18 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/hbgtcore.c - ! updated INKEYPOOL() code to respect extended key code in ALT+C and + ! updated INKEYPOLL() code to respect extended key code in ALT+C and ALT+D detection 2013-04-24 23:58 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -11052,7 +11062,7 @@ It's pure QT code so now is the most portable Harbour GT driver which can be used on platforms where we haven't native any GT so far or current GTs like GTXWC do not have native appearance. - Because it uses only high level GUI interface then it should be quite + Because it uses only high-level GUI interface then it should be quite easy to convert it to other GUI libraries, i.e. GTK. 2013-04-23 14:00 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) @@ -11099,7 +11109,7 @@ * include/hbgtinfo.ch + added new HB_GTI_* actions: - HB_GTI_WINHANDLE - Get console window low level handle + HB_GTI_WINHANDLE - Get console window low-level handle HB_GTI_MOUSEPOS_XY - Get mouse position in pixels HB_GTI_DISPIMAGE - Display image with given name @@ -11231,7 +11241,7 @@ + added new paragraph: DECLARATION AND INITIALIZATION OF VARIABLES * src/rtl/hbcom.c - * added 3-rd parameter to TIOCEXCL and TIOCNXCL ioctl() codes + * added 3rd parameter to TIOCEXCL and TIOCNXCL ioctl() codes to pacify valgrind warnings * include/hbexpra.c @@ -45850,7 +45860,7 @@ 2011-06-03 13:15 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/idebrowse.prg % Set vertical scrollbars of XbpBrowse() class to honor thumb - positioning per open index. Pointed out by Francek. + positioning per open index. Pointed out by Franček. 2011-06-03 13:11 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/hbqtgui.hbx @@ -90264,7 +90274,7 @@ 2010-02-23 08:26 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt_hbslots.cpp - ! Applied patch provided by Francek. + ! Applied patch provided by Franček. This removes the 128 nesting loop limit in MSVC. * contrib/hbide/ideharbourhelp.prg @@ -136430,7 +136440,7 @@ subtrees to libpath also. From the user side, it looks like this (without any extra configuration or any path specs): - > hbmk2 myprogram.prg hbwin.hbc hbct.hbc + $ hbmk2 myprogram.prg hbwin.hbc hbct.hbc ; QUESTION: Where such contribs (with libs and headers) could go on a *nix system? While developing above stuff I had the unified Windows installer @@ -141501,10 +141511,10 @@ * utils/hbmk2/hbmk2.prg + Added support for wildcarded project specs: - This command will build each .hbp file found in current dir: - > hbmk2 *.hbp + $ hbmk2 *.hbp - This command will build all .prg files in current dir, each into a separate executable as separate projects: - > hbmk2 -target=*.prg + $ hbmk2 -target=*.prg 2009-05-30 01:12 UTC+0200 Viktor Szakats (vszakats.net/harbour) * INSTALL @@ -144465,9 +144475,9 @@ of translation will be attempted from hbmk2..hbl file (not final name yet). You can compile such .hbl file by using command: - > hbi18n -g -ohbmk2..hbl hbmk2..pot + $ hbi18n -g -ohbmk2..hbl hbmk2..pot You can create .pot using this command: - > ..\..\bin\harbour hbmk2.prg /jhbmk2-.pot /i..\..\include + $ ..\..\bin\harbour hbmk2.prg /jhbmk2-.pot /i..\..\include Where is preferable the std ISO language ID, like: pt_BR. 2009-05-02 10:52 UTC+0200 Viktor Szakats (vszakats.net/harbour) @@ -147061,11 +147071,11 @@ work as a plugin replacement for clipper, rtlink/blinker/exospace when renamed to these names. Example: --- - > copy hbmk2.exe clipper.exe - > copy hbmk2.exe rtlink.exe - > clipper hello.prg - > echo OUT myhello FI hello > rtl.lnk - > rtlink @rtl.lnk + $ copy hbmk2.exe clipper.exe + $ copy hbmk2.exe rtlink.exe + $ clipper hello.prg + $ echo OUT myhello FI hello > rtl.lnk + $ rtlink @rtl.lnk --- 2009-04-04 17:06 UTC+0200 Viktor Szakats (vszakats.net/harbour) @@ -148401,9 +148411,9 @@ ; IOW this means that it's now possible to create a unified, self-contained install kit, which is able to easily build x64, WinCE and x86 executables with command below: - > hbmk2 test.prg => test.exe for x86 - > hbmk2 -comp=mingw64 a.prg => test.exe for x64 - > hbmk2 -comp=mingwce a.prg => test.exe for ARM/WinCE + $ hbmk2 test.prg => test.exe for x86 + $ hbmk2 -comp=mingw64 a.prg => test.exe for x64 + $ hbmk2 -comp=mingwce a.prg => test.exe for ARM/WinCE Can it be any simpler than that? My sample install .zip is 322 MB and it contains Harbour libs diff --git a/config/aix/gcc.mk b/config/aix/gcc.mk index 4f549ce3fc..ae97d9d7a2 100644 --- a/config/aix/gcc.mk +++ b/config/aix/gcc.mk @@ -16,7 +16,7 @@ CC_OUT := -o CFLAGS += -I. -I$(HB_HOST_INC) -# uncomment this if you want to force creating 64bit binaries +# uncomment this if you want to force creating 64-bit binaries #CFLAGS += -maix64 #LDFLAGS += -maix64 -Wl,-b64 #DFLAGS += -maix64 -Wl,-b64 diff --git a/config/aix/libs.mk b/config/aix/libs.mk index 42d5d2c51d..05fd9cb2d0 100644 --- a/config/aix/libs.mk +++ b/config/aix/libs.mk @@ -1,6 +1,6 @@ # When compiling and linking with -pthread, the library search path should # include -L/usr/lib/threads at the beginning of the path. -# http://www.ibm.com/developerworks/aix/library/au-gnu.html +# https://www.ibm.com/developerworks/aix/library/au-gnu.html # (libc is there) ifeq ($(HB_LINKING_VMMT),yes) SYSLIBPATHS := /usr/lib/threads diff --git a/config/bsd/pcc.mk b/config/bsd/pcc.mk index e25454ec25..a055d3c06d 100644 --- a/config/bsd/pcc.mk +++ b/config/bsd/pcc.mk @@ -1,4 +1,4 @@ -# TODO: No autodetection +# TODO: No auto-detection ifeq ($(HB_BUILD_MODE),cpp) HB_BUILD_MODE := c diff --git a/config/common/watcom.mk b/config/common/watcom.mk index a14ca2d454..80ed71a615 100644 --- a/config/common/watcom.mk +++ b/config/common/watcom.mk @@ -1,12 +1,10 @@ # GNU Make file for Open Watcom C/C++ compiler # (shell specific rules) -# --------------------------------------------------------------- # See option docs here: -# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/cpopts.html -# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/wlink.html -# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/wlib.html -# --------------------------------------------------------------- +# https://users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/cpopts.html +# https://users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/wlink.html +# https://users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/wlib.html # NOTE: Hack to force no extension for Linux binaries created on non-Linux hosts. # Otherwise they become '.elf'. [vszakats] @@ -94,7 +92,7 @@ ifeq ($(ANYDOS),yes) # disable DOS/32A Banner export DOS32A := /NOC - # work arround to DOS command line size limit + # workaround for MS-DOS command-line length limit ifneq ($(findstring wcc386,$(CC)),) export WCC386 := $(strip $(subst $(CC_DIRSEPFROM),$(CC_DIRSEPTO),$(CC_FLAGS))) else diff --git a/config/detect.mk b/config/detect.mk index 17ca748644..b2b38a0661 100644 --- a/config/detect.mk +++ b/config/detect.mk @@ -74,7 +74,7 @@ _DET_INC_HEAD := /gpm.h include $(TOP)$(ROOT)config/detfun.mk -# Detect slang +# Detect s-lang _DET_DSP_NAME := slang _DET_VAR_INC_ := HB_INC_SLANG diff --git a/config/dos/djgpp.mk b/config/dos/djgpp.mk index 5ee5b95567..6e7e011236 100644 --- a/config/dos/djgpp.mk +++ b/config/dos/djgpp.mk @@ -77,7 +77,7 @@ define lib_object endef # We have to use script to overcome the MS-DOS limit of max 128 characters -# in commmand line +# in command-line define create_library @$(ECHO) $(ECHOQUOTE)CREATE $(LIB_DIR)/$@$(ECHOQUOTE) > __lib__.tmp $(foreach file,$(^F),$(lib_object)) diff --git a/config/global.mk b/config/global.mk index 58f2c799a7..9d23a88bfd 100644 --- a/config/global.mk +++ b/config/global.mk @@ -148,7 +148,7 @@ ifeq ($(HB_INIT_DONE),) export HB_REBUILD_PARSER := no endif - # Can't build shared tools if we don't create dlls + # Cannot build shared tools if we don't create dlls ifeq ($(HB_BUILD_DYN),no) export HB_BUILD_SHARED := no endif @@ -1822,36 +1822,36 @@ ifneq ($(HB_INSTALL_PREFIX),) endif endif - LIBPOSTFIX := - INCPOSTFIX := + LIBSUFFIX := + INCSUFFIX := ifeq ($(HB_PLATFORM),beos) ifeq ($(HB_SYSLOC),yes) - LIBPOSTFIX := $(DIRSEP)harbour - INCPOSTFIX := $(DIRSEP)harbour + LIBSUFFIX := $(DIRSEP)harbour + INCSUFFIX := $(DIRSEP)harbour endif else ifeq ($(HB_PLATFORM_UNIX),) - LIBPOSTFIX := $(DIRSEP)$(subst /,$(DIRSEP),$(PLAT_COMP)) + LIBSUFFIX := $(DIRSEP)$(subst /,$(DIRSEP),$(PLAT_COMP)) else - LIBPOSTFIX := + LIBSUFFIX := # Use 'lib64' instead of 'lib' for 64-bit targets where lib64 dir exists ifneq ($(wildcard $(HB_INSTALL_PREFIX)$(DIRSEP)lib64),) ifneq ($(filter $(HB_CPU),x86_64),) - LIBPOSTFIX := 64 + LIBSUFFIX := 64 endif endif # Not perfect, please enhance it. ifneq ($(findstring |/usr,|$(HB_INSTALL_PREFIX)),) ifeq ($(findstring |/usr/home,|$(HB_INSTALL_PREFIX)),) - LIBPOSTFIX := $(LIBPOSTFIX)$(DIRSEP)harbour - INCPOSTFIX := $(DIRSEP)harbour + LIBSUFFIX := $(LIBSUFFIX)$(DIRSEP)harbour + INCSUFFIX := $(DIRSEP)harbour endif else ifneq ($(findstring |/opt,|$(HB_INSTALL_PREFIX)),) - LIBPOSTFIX := $(LIBPOSTFIX)$(DIRSEP)harbour - INCPOSTFIX := $(DIRSEP)harbour + LIBSUFFIX := $(LIBSUFFIX)$(DIRSEP)harbour + INCSUFFIX := $(DIRSEP)harbour else - LIBPOSTFIX := + LIBSUFFIX := endif endif endif @@ -1863,7 +1863,7 @@ ifneq ($(HB_INSTALL_PREFIX),) endif # Standard name: LIBDIR ifeq ($(HB_INSTALL_LIB),) - export HB_INSTALL_LIB := $(HB_INSTALL_PREFIX)$(DIRSEP)lib$(LIBPOSTFIX) + export HB_INSTALL_LIB := $(HB_INSTALL_PREFIX)$(DIRSEP)lib$(LIBSUFFIX) endif ifeq ($(HB_INSTALL_DYN),) ifeq ($(HB_PLATFORM_UNIX),) @@ -1878,7 +1878,7 @@ ifneq ($(HB_INSTALL_PREFIX),) endif # Standard name: INCLUDEDIR ifeq ($(HB_INSTALL_INC),) - export HB_INSTALL_INC := $(HB_INSTALL_PREFIX)$(DIRSEP)include$(INCPOSTFIX) + export HB_INSTALL_INC := $(HB_INSTALL_PREFIX)$(DIRSEP)include$(INCSUFFIX) endif # Standard name: DOCDIR ifeq ($(HB_INSTALL_DOC),) diff --git a/config/globsh.mk b/config/globsh.mk index 1d628c94d1..793739fded 100644 --- a/config/globsh.mk +++ b/config/globsh.mk @@ -79,8 +79,8 @@ endif ifeq ($(HB_SHELL),nt) -# NOTE: According to http://support.microsoft.com/kb/830473 -# The command line length limit for cmd.exe is 8191 chars +# NOTE: According to https://support.microsoft.com/kb/830473 +# The command-line length limit for cmd.exe is 8191 chars # for Windows XP and upper and 2047 for Windows NT and 2000. # This is true for commands which are recognized as shell # commands (by using an internal list). For the rest @@ -134,7 +134,7 @@ endif ifeq ($(HB_SHELL),os2) -# NOTE: Maximum size of command line in OS/2 is limited to 1024 +# NOTE: Maximum size of command-line in OS/2 is limited to 1024 # characters. # NOTE: Comment on included OS/2 GNU tools: @@ -184,9 +184,9 @@ endif ifeq ($(HB_SHELL),dos) -# NOTE: MS-DOS command line length has a limit of 126 characters. +# NOTE: MS-DOS command-line length has a limit of 126 characters. # When using DJGPP GNU Make to invoke other DJGPP tools this limit -# is about 13KB, as they do special trick to overcome it. +# is about 13 kB, as they do special trick to overcome it. # See these DJGPP FAQs: # http://www.delorie.com/djgpp/v2faq/faq16_4.html # http://www.delorie.com/djgpp/v2faq/faq16_5.html diff --git a/config/hpux/gcc.mk b/config/hpux/gcc.mk index c80d9ec6ee..525a578fc4 100644 --- a/config/hpux/gcc.mk +++ b/config/hpux/gcc.mk @@ -16,7 +16,7 @@ CC_OUT := -o CFLAGS += -I. -I$(HB_HOST_INC) -# uncomment this if you want to force creating 64bit binaries on IA64 +# uncomment this if you want to force creating 64-bit binaries on IA64 #CFLAGS += -mlp64 #LDFLAGS += -mlp64 diff --git a/config/linux/sunpro.mk b/config/linux/sunpro.mk index 1f45c3d700..6cb5136e91 100644 --- a/config/linux/sunpro.mk +++ b/config/linux/sunpro.mk @@ -27,7 +27,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_OPTIM),no) # Together with $(HB_ISAOPT) above, these are supposed to (somewhat) # conform to the Blastwave build standards, see - # http://wiki.blastwave.org/mediawiki/index.php/Build_Standards + # https://web.archive.org/web/wiki.blastwave.org/mediawiki/index.php/Build_Standards # Try to keep them this way. CFLAGS += -fast CFLAGS += -xnolibmopt diff --git a/config/os2/gcc.mk b/config/os2/gcc.mk index 0932715a27..4b55872cda 100644 --- a/config/os2/gcc.mk +++ b/config/os2/gcc.mk @@ -87,7 +87,7 @@ else endef # We have to use a script to overcome the AR limit of max 850 characters - # in commmand line + # in command-line define create_library $(if $(wildcard $(subst /,$(DIRSEP),$(LIB_FILE))),@$(RM) $(subst /,$(DIRSEP),$(LIB_FILE)),) @$(ECHO) $(ECHOQUOTE)CREATE $(LIB_DIR)/$@$(ECHOQUOTE) > __lib__.tmp diff --git a/config/postinst.hb b/config/postinst.hb index 55b49bab65..6766618941 100644 --- a/config/postinst.hb +++ b/config/postinst.hb @@ -273,7 +273,7 @@ PROCEDURE Main( ... ) ELSEIF Empty( query_stdout( "tar --version" ) ) cBin_Tar := "" ELSEIF "bsdtar" $ query_stdout( "tar --version" ) - /* tar is mapped to bsdtar starting OS X 10.6 */ + /* tar is mapped to bsdtar starting Mac OS X 10.6 */ lGNU_Tar := .F. ENDIF @@ -654,7 +654,7 @@ STATIC FUNCTION __hb_extern_get_list( cInputName ) hExtern := { => } FOR EACH tmp IN aResult tmp[ 2 ] := hb_asciiUpper( tmp[ 2 ] ) - IF !( tmp[ 2 ] $ hExtern ) + IF ! tmp[ 2 ] $ hExtern AAdd( aExtern, tmp[ 2 ] ) hExtern[ tmp[ 2 ] ] := NIL ENDIF diff --git a/config/rules.mk b/config/rules.mk index b863174260..623ae04e95 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -11,9 +11,9 @@ else endif ifeq ($(HB_DYN_COPT),) - OBJ_DYN_POSTFIX := + OBJ_DYN_SUFFIX := else - OBJ_DYN_POSTFIX := _dyn + OBJ_DYN_SUFFIX := _dyn endif # How to run Harbour @@ -34,7 +34,7 @@ ifeq ($(CC_RULE),) ifneq ($(filter $(LIBNAME),$(HB_DYN_LIBS)),) define cc_comp_all $(CC) $(subst $(CC_DIRSEPFROM),$(CC_DIRSEPTO),$(CC_FLAGS) $(HB_USER_CFLAGS) $(CC_OUT)$( ) => ( Eval( ErrorBlock(), ), Break( ) ) @@ -118,8 +114,8 @@ STATIC s_nRddID := -1 /* * non work area methods receive RDD ID as first parameter - * Methods INIT and EXIT does not have to execute SUPER methods - these is - * always done by low level USRRDD code + * Methods INIT and EXIT does not have to execute SUPER methods - this is + * always done by low-level USRRDD code */ STATIC FUNCTION AR_INIT( nRDD ) @@ -133,7 +129,6 @@ STATIC FUNCTION AR_INIT( nRDD ) #if 0 STATIC FUNCTION AR_RDDDATAINIT() - RETURN { ; NIL ; /* RDDDATA_DATABASE */ } @@ -141,7 +136,6 @@ STATIC FUNCTION AR_RDDDATAINIT() #endif STATIC FUNCTION AR_DATABASEINIT() - RETURN { ; NIL, ; /* DATABASE_FILENAME */ {}, ; /* DATABASE_RECORDS */ @@ -153,7 +147,6 @@ STATIC FUNCTION AR_DATABASEINIT() } STATIC FUNCTION AR_WADATAINIT() - RETURN { ; NIL, ; /* WADATA_DATABASE */ 0, ; /* WADATA_WORKAREA */ @@ -174,14 +167,12 @@ STATIC FUNCTION AR_WADATAINIT() } STATIC FUNCTION AR_RECDATAINIT() - RETURN { ; .F., ; /* RECDATA_DELETED */ 0; /* RECDATA_LOCKED (Number of area) */ } STATIC FUNCTION AR_INDEXINIT() - RETURN { ; NIL, ; /* INDEX_TAG */ NIL, ; /* INDEX_ORCR */ @@ -189,14 +180,12 @@ STATIC FUNCTION AR_INDEXINIT() } STATIC FUNCTION AR_INDEXKEYINIT() - RETURN { ; NIL, ; /* INDEXKEY_KEY */ NIL ; /* INDEXKEY_RECORD */ } STATIC FUNCTION AR_WAOIINIT() - RETURN { ; NIL, ; /* WAOI_SCOPE_0 */ NIL ; /* WAOI_SCOPE_1 */ @@ -206,8 +195,8 @@ STATIC FUNCTION AR_WAOIINIT() * methods: NEW and RELEASE receive pointer to work area structure * not work area number. It's necessary because the can be executed * before work area is allocated - * these methods does not have to execute SUPER methods - these is - * always done by low level USRRDD code + * these methods does not have to execute SUPER methods - this is + * always done by low-level USRRDD code */ STATIC FUNCTION AR_NEW( pWA ) @@ -231,7 +220,7 @@ STATIC FUNCTION AR_CREATEFIELDS( nWA, aStruct ) LOCAL nResult := HB_SUCCESS LOCAL aFieldStruct, aField - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, aStruct = %2$s", nWA, hb_ValToExp( aStruct ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, aStruct: %2$s", nWA, hb_ValToExp( aStruct ) ) ) /* Setting WA number to current WorkArea */ aWAData[ WADATA_WORKAREA ] := nWA @@ -270,7 +259,7 @@ STATIC FUNCTION AR_CREATE( nWA, aOpenInfo ) LOCAL cName LOCAL cFullName, aDBFData, nResult /*, aFieldStruct, aField, aStruct */ - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, aOpenInfo = %2$s", nWA, hb_ValToExp( aOpenInfo ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, aOpenInfo: %2$s", nWA, hb_ValToExp( aOpenInfo ) ) ) /* getting database infos from current workarea */ aDBFData := aWAData[ WADATA_DATABASE ] @@ -287,16 +276,17 @@ STATIC FUNCTION AR_CREATE( nWA, aOpenInfo ) /* Check if database is already present in memory slots */ /* 2008-11-07 FSG - dbCreate() doesn't check if a dbf file exists. So I will not check it. - If you need to check if a table exists use hb_FileArrayRdd() function that works in - similar way of File(), i.e.: - IF hb_FileArrayRdd( cFullName ) + If you need to check if a table exists use hb_dbExists() function that works in + similar way of hb_vfExists(), i.e.: + IF ! hb_dbExists( cFullName ) dbCreate( cFullName, aStructure, "ARRAYRDD" ) - .... - */ + ... + ENDIF + */ /* Setting file attribs */ aDBFData[ DATABASE_FILENAME ] := cFullName - aDBFData[ DATABASE_LOCKED ] := .T. /* I need Exclusive mode in creation */ + aDBFData[ DATABASE_LOCKED ] := .T. /* I need Exclusive mode in creation */ /* Adding new database in RDD memory slots using filename as key */ hRDDData[ cFullName ] := aDBFData @@ -323,7 +313,7 @@ STATIC FUNCTION AR_OPEN( nWA, aOpenInfo ) LOCAL cFullName, cName, hRDDData, aWAData, aDBFData LOCAL aStruct, oError, aFieldStruct, aField, nResult - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, aOpenInfo = %2$s", nWA, hb_ValToExp( aOpenInfo ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, aOpenInfo: %2$s", nWA, hb_ValToExp( aOpenInfo ) ) ) cFullName := Upper( aOpenInfo[ UR_OI_NAME ] ) @@ -356,9 +346,9 @@ STATIC FUNCTION AR_OPEN( nWA, aOpenInfo ) /* Set WorkArea Infos */ aWAData := USRRDD_AREADATA( nWA ) - aWAData[ WADATA_DATABASE ] := aDBFData /* Put a reference to database */ + aWAData[ WADATA_DATABASE ] := aDBFData /* Put a reference to database */ aWAData[ WADATA_WORKAREA ] := nWA - aWAData[ WADATA_OPENINFO ] := aOpenInfo /* Put open informations */ + aWAData[ WADATA_OPENINFO ] := aOpenInfo /* Put open informations */ /* Set fields */ UR_SUPER_SETFIELDEXTENT( nWA, Len( aStruct ) ) @@ -371,7 +361,6 @@ STATIC FUNCTION AR_OPEN( nWA, aOpenInfo ) aField[ UR_FI_LEN ] := aFieldStruct[ DBS_LEN ] aField[ UR_FI_DEC ] := aFieldStruct[ DBS_DEC ] UR_SUPER_ADDFIELD( nWA, aField ) - NEXT /* Call SUPER OPEN to finish allocating work area (f.e.: alias settings) */ @@ -393,14 +382,12 @@ STATIC FUNCTION AR_OPEN( nWA, aOpenInfo ) NetErr( .T. ) UR_SUPER_ERROR( nWA, oError ) RETURN HB_FAILURE - ENDIF /* Open file in exclusive mode */ IF ! aOpenInfo[ UR_OI_SHARED ] IF aDBFData[ DATABASE_OPENNUMBER ] == 1 - aDBFData[ DATABASE_LOCKED ] := .T. - + aDBFData[ DATABASE_LOCKED ] := .T. ELSE oError := ErrorNew() oError:GenCode := EG_OPEN @@ -412,7 +399,6 @@ STATIC FUNCTION AR_OPEN( nWA, aOpenInfo ) UR_SUPER_ERROR( nWA, oError ) NetErr( .T. ) RETURN HB_FAILURE - ENDIF ENDIF @@ -428,14 +414,14 @@ STATIC FUNCTION AR_CLOSE( nWA ) LOCAL aWAData := USRRDD_AREADATA( nWA ) LOCAL aDBFData := aWAData[ WADATA_DATABASE ] - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d", nWA ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d", nWA ) ) IF HB_ISARRAY( aDBFData ) /* decrease open number */ - aDBFData[ DATABASE_OPENNUMBER ]-- + --aDBFData[ DATABASE_OPENNUMBER ] /* unlock file */ - aDBFData[ DATABASE_LOCKED ] := .F. /* Exclusive mode */ + aDBFData[ DATABASE_LOCKED ] := .F. /* Exclusive mode */ ENDIF RETURN UR_SUPER_CLOSE( nWA ) @@ -445,10 +431,10 @@ STATIC FUNCTION AR_GETVALUE( nWA, nField, xValue ) LOCAL aWAData := USRRDD_AREADATA( nWA ) LOCAL aDBFData := aWAData[ WADATA_DATABASE ] LOCAL aRecords := aDBFData[ DATABASE_RECORDS ] - LOCAL aStruct := aDBFData[ DATABASE_STRUCT ] + LOCAL aStruct := aDBFData[ DATABASE_STRUCT ] LOCAL nRecNo := aWAData[ WADATA_RECNO ] - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nField = %2$d, xValue = %3$s", nWA, nField, hb_ValToExp( xValue ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nField: %2$d, xValue: %3$s", nWA, nField, hb_ValToExp( xValue ) ) ) IF nField > 0 .AND. nField <= Len( aStruct ) IF aWAData[ WADATA_EOF ] @@ -467,29 +453,28 @@ STATIC FUNCTION AR_PUTVALUE( nWA, nField, xValue ) LOCAL aWAData := USRRDD_AREADATA( nWA ) LOCAL aDBFData := aWAData[ WADATA_DATABASE ] LOCAL aRecords := aDBFData[ DATABASE_RECORDS ] - LOCAL aStruct := aDBFData[ DATABASE_STRUCT ] + LOCAL aStruct := aDBFData[ DATABASE_STRUCT ] LOCAL nRecNo := aWAData[ WADATA_RECNO ] LOCAL aIndexes := aDBFData[ DATABASE_INDEX ] LOCAL aKeys[ Len( aIndexes ) ] LOCAL xVal - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nField = %2$d, xValue = %3$s", nWA, nField, hb_ValToExp( xValue ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nField: %2$d, xValue: %3$s", nWA, nField, hb_ValToExp( xValue ) ) ) IF nField > 0 .AND. nField <= Len( aStruct ) .AND. ; iif( HB_ISSTRING( xValue ) .AND. aStruct[ nField ][ DBS_TYPE ] == "M", .T., ValType( xValue ) == aStruct[ nField ][ DBS_TYPE ] ) xVal := PutValue( xValue, aStruct[ nField ][ DBS_TYPE ], aStruct[ nField ][ DBS_LEN ], aStruct[ nField ][ DBS_DEC ] ) - AEval( aIndexes, {| aInd, n | aKeys[ n ] := Eval( aInd[ INDEX_ORCR, UR_ORCR_BKEY ] ) } ) + AEval( aIndexes, {| aInd, n | aKeys[ n ] := Eval( aInd[ INDEX_ORCR ][ UR_ORCR_BKEY ] ) } ) IF ! aWAData[ WADATA_EOF ] aRecords[ nRecNo ][ nField ] := xVal ENDIF - AEval( aIndexes, {| aInd, n | ModifyIndex( n, Eval( aInd[ INDEX_ORCR, UR_ORCR_BKEY ] ), aInd, aWAData, aKeys[ n ] ) } ) + AEval( aIndexes, {| aInd, n | ModifyIndex( n, Eval( aInd[ INDEX_ORCR ][ UR_ORCR_BKEY ] ), aInd, aWAData, aKeys[ n ] ) } ) RETURN HB_SUCCESS - ENDIF RETURN HB_FAILURE @@ -501,38 +486,34 @@ STATIC FUNCTION AR_GOTO( nWA, nRecord ) LOCAL aRecords := aDBFData[ DATABASE_RECORDS ] LOCAL nRecCount := Len( aRecords ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nRecord = %2$d, nRecCount = %3$d", nWA, nRecord, nRecCount ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nRecord: %2$d, nRecCount: %3$d", nWA, nRecord, nRecCount ) ) IF nRecord >= 1 .AND. nRecord <= nRecCount aWAData[ WADATA_EOF ] := aWAData[ WADATA_BOF ] := .F. aWAData[ WADATA_RECNO ] := nRecord - ELSEIF nRecCount == 0 aWAData[ WADATA_EOF ] := aWAData[ WADATA_BOF ] := .T. aWAData[ WADATA_RECNO ] := 1 - ELSEIF nRecord < 0 aWAData[ WADATA_BOF ] := .T. aWAData[ WADATA_EOF ] := .F. aWAData[ WADATA_RECNO ] := 1 - ELSEIF nRecord == 0 .OR. nRecord > nRecCount aWAData[ WADATA_BOF ] := .F. aWAData[ WADATA_EOF ] := .T. aWAData[ WADATA_RECNO ] := nRecCount + 1 - ENDIF AR_UNLOCK( nWA ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "aWAData[ WADATA_BOF ] = %1$s, aWAData[ WADATA_EOF ] = %2$s, aWAData[ WADATA_RECNO ] = %3$d", ; + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "aWAData[ WADATA_BOF ]: %1$s, aWAData[ WADATA_EOF ]: %2$s, aWAData[ WADATA_RECNO ]: %3$d", ; hb_ValToExp( aWAData[ WADATA_BOF ] ), hb_ValToExp( aWAData[ WADATA_EOF ] ), aWAData[ WADATA_RECNO ] ) ) RETURN HB_SUCCESS STATIC FUNCTION AR_GOTOID( nWA, nRecord ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nRecord = %2$d", nWA, nRecord ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nRecord: %2$d", nWA, nRecord ) ) RETURN AR_GOTO( nWA, nRecord ) @@ -547,7 +528,7 @@ STATIC FUNCTION AR_GOTOP( nWA ) LOCAL nIndex := aWAData[ WADATA_INDEX ] LOCAL nResult := HB_SUCCESS - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d", nWA ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d", nWA ) ) IF nRecCount == 0 aWAData[ WADATA_EOF ] := aWAData[ WADATA_BOF ] := .T. @@ -557,17 +538,17 @@ STATIC FUNCTION AR_GOTOP( nWA ) aWAData[ WADATA_EOF ] := .F. IF nIndex == 0 aWAData[ WADATA_RECNO ] := 1 - ELSEIF aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] == NIL - IF Empty( aIndexes[ nIndex, INDEX_RECORDS ] ) + ELSEIF aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] == NIL + IF Empty( aIndexes[ nIndex ][ INDEX_RECORDS ] ) aWAData[ WADATA_ORDRECNO ] := 0 nResult := AR_GOTO( nWA, 0 ) ELSE aWAData[ WADATA_ORDRECNO ] := 1 - nResult := AR_GOTO( nWA, aIndexes[ nIndex, INDEX_RECORDS, 1, INDEXKEY_RECORD ] ) + nResult := AR_GOTO( nWA, aIndexes[ nIndex ][ INDEX_RECORDS ][ 1 ][ INDEXKEY_RECORD ] ) ENDIF ELSE - aWAData[ WADATA_ORDRECNO ] := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO, nIndex ], .F. ) - nResult := AR_GOTO( nWA, aIndexes[ nIndex, INDEX_RECORDS, aWAData[ WADATA_ORDRECNO ], INDEXKEY_RECORD ] ) + aWAData[ WADATA_ORDRECNO ] := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO ][ nIndex ], .F. ) + nResult := AR_GOTO( nWA, aIndexes[ nIndex ][ INDEX_RECORDS ][ aWAData[ WADATA_ORDRECNO ] ][ INDEXKEY_RECORD ] ) ENDIF IF Set( _SET_DELETED ) .AND. aRecInfo[ aWAData[ WADATA_RECNO ] ][ RECDATA_DELETED ] @@ -589,7 +570,7 @@ STATIC FUNCTION AR_GOBOTTOM( nWA ) LOCAL nIndex := aWAData[ WADATA_INDEX ] LOCAL nResult := HB_SUCCESS - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d", nWA ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d", nWA ) ) IF Len( aRecords ) == 0 aWAData[ WADATA_EOF ] := aWAData[ WADATA_BOF ] := .T. @@ -599,23 +580,22 @@ STATIC FUNCTION AR_GOBOTTOM( nWA ) aWAData[ WADATA_EOF ] := .F. IF nIndex == 0 aWAData[ WADATA_RECNO ] := Len( aRecords ) - ELSEIF aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] == NIL - IF Empty( aIndexes[ nIndex, INDEX_RECORDS ] ) + ELSEIF aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] == NIL + IF Empty( aIndexes[ nIndex ][ INDEX_RECORDS ] ) aWAData[ WADATA_ORDRECNO ] := 0 nResult := AR_GOTO( nWA, 0 ) ELSE - aWAData[ WADATA_ORDRECNO ] := Len( ATail( aIndexes[ nIndex, INDEX_RECORDS ] ) ) - nResult := AR_GOTO( nWA, ATail( aIndexes[ nIndex, INDEX_RECORDS ] )[ INDEXKEY_RECORD ] ) + aWAData[ WADATA_ORDRECNO ] := Len( ATail( aIndexes[ nIndex ][ INDEX_RECORDS ] ) ) + nResult := AR_GOTO( nWA, ATail( aIndexes[ nIndex ][ INDEX_RECORDS ] )[ INDEXKEY_RECORD ] ) ENDIF ELSE - aWAData[ WADATA_ORDRECNO ] := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO, nIndex ], .T. ) - nResult := AR_GOTO( nWA, aIndexes[ nIndex, INDEX_RECORDS, aWAData[ WADATA_ORDRECNO ], INDEXKEY_RECORD ] ) + aWAData[ WADATA_ORDRECNO ] := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO ][ nIndex ], .T. ) + nResult := AR_GOTO( nWA, aIndexes[ nIndex ][ INDEX_RECORDS ][ aWAData[ WADATA_ORDRECNO ] ][ INDEXKEY_RECORD ] ) ENDIF IF Set( _SET_DELETED ) .AND. aRecInfo[ aWAData[ WADATA_RECNO ] ][ RECDATA_DELETED ] RETURN AR_SKIPFILTER( nWA, -1 ) ENDIF - ENDIF AR_UNLOCK( nWA ) @@ -624,7 +604,7 @@ STATIC FUNCTION AR_GOBOTTOM( nWA ) STATIC FUNCTION AR_SETFILTER( nWa, aDbFilterInfo ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, aDbFilterInfo = %2$s", nWA, hb_ValToExp( aDbFilterInfo ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, aDbFilterInfo: %2$s", nWA, hb_ValToExp( aDbFilterInfo ) ) ) USRRDD_AREADATA( nWA )[ WADATA_FILTERINFO ] := aDbFilterInfo @@ -632,7 +612,7 @@ STATIC FUNCTION AR_SETFILTER( nWa, aDbFilterInfo ) STATIC FUNCTION AR_CLEARFILTER( nWA ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d", nWA ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d", nWA ) ) USRRDD_AREADATA( nWA )[ WADATA_FILTERINFO ] := NIL @@ -645,15 +625,15 @@ STATIC FUNCTION AR_SKIPFILTER( nWA, nRecords ) LOCAL aRecInfo := aDBFData[ DATABASE_RECINFO ] LOCAL lBof, nToSkip - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nRecords = %2$d", nWA, nRecords ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nRecords: %2$d", nWA, nRecords ) ) nToSkip := iif( nRecords > 0, 1, iif( nRecords < 0, -1, 0 ) ) IF nToSkip != 0 DO WHILE ! aWAData[ WADATA_BOF ] .AND. ! aWAData[ WADATA_EOF ] IF ( Set( _SET_DELETED ) .AND. aRecInfo[ aWAData[ WADATA_RECNO ] ][ RECDATA_DELETED ] ) .OR. ; - ( aWAData[ WADATA_FILTERINFO ] != NIL .AND. ! Eval( aWAData[ WADATA_FILTERINFO, UR_FRI_BEXPR ] ) ) - IF !( AR_SKIPRAW( nWA, nToSkip ) == HB_SUCCESS ) + ( aWAData[ WADATA_FILTERINFO ] != NIL .AND. ! Eval( aWAData[ WADATA_FILTERINFO ][ UR_FRI_BEXPR ] ) ) + IF AR_SKIPRAW( nWA, nToSkip ) != HB_SUCCESS RETURN HB_FAILURE ENDIF IF nToSkip < 0 .AND. aWAData[ WADATA_BOF ] @@ -673,7 +653,6 @@ STATIC FUNCTION AR_SKIPFILTER( nWA, nRecords ) IF lBof != NIL aWAData[ WADATA_BOF ] := .T. ENDIF - ENDIF RETURN HB_SUCCESS @@ -682,12 +661,12 @@ STATIC FUNCTION AR_SKIPRAW( nWA, nRecords ) LOCAL aWAData := USRRDD_AREADATA( nWA ) LOCAL nIndex := aWAData[ WADATA_INDEX ] - LOCAL aIndexes := aWAData[ WADATA_DATABASE, DATABASE_INDEX ] + LOCAL aIndexes := aWAData[ WADATA_DATABASE ][ DATABASE_INDEX ] LOCAL lBof, lEof LOCAL nResult, nRec, nEnd, lScope0, lScope1 LOCAL nIni := 0 - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nRecords = %2$d", nWA, nRecords ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nRecords: %2$d", nWA, nRecords ) ) IF nRecords == 0 lBof := aWAData[ WADATA_BOF ] @@ -700,45 +679,45 @@ STATIC FUNCTION AR_SKIPRAW( nWA, nRecords ) ELSEIF nIndex > 0 nRec := ordKeyNo() - lScope0 := aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] != NIL - lScope1 := aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] != NIL + lScope0 := aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] != NIL + lScope1 := aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] != NIL nEnd := ordKeyCount() IF nRec == 0 nRec := nEnd + 1 ENDIF IF lScope0 - nIni := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO, nIndex ], .F. ) + nIni := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO ][ nIndex ], .F. ) nIni-- ENDIF - IF nIni == -1 .OR. Empty( aIndexes[ nIndex, INDEX_RECORDS ] ) + IF nIni == -1 .OR. Empty( aIndexes[ nIndex ][ INDEX_RECORDS ] ) nResult := AR_GOTO( nWA, 0 ) aWAData[ WADATA_ORDRECNO ] := 0 ELSEIF nRecords < 0 .AND. -nRecords >= nRec - nResult := AR_GOTO( nWA, aIndexes[ nIndex, INDEX_RECORDS, nIni + 1, INDEXKEY_RECORD ] ) + nResult := AR_GOTO( nWA, aIndexes[ nIndex ][ INDEX_RECORDS ][ nIni + 1 ][ INDEXKEY_RECORD ] ) aWAData[ WADATA_ORDRECNO ] := 1 aWAData[ WADATA_BOF ] := .T. ELSEIF nRecords > 0 .AND. nRec + nRecords > nEnd nResult := AR_GOTO( nWA, 0 ) aWAData[ WADATA_ORDRECNO ] := 0 ELSE - nResult := AR_GOTO( nWA, aIndexes[ nIndex, INDEX_RECORDS, nRec + nRecords + nIni, INDEXKEY_RECORD ] ) + nResult := AR_GOTO( nWA, aIndexes[ nIndex ][ INDEX_RECORDS ][ nRec + nRecords + nIni ][ INDEXKEY_RECORD ] ) aWAData[ WADATA_ORDRECNO ] := nRec + nRecords + nIni - IF aIndexes[ nIndex, INDEX_ORCR, UR_ORCR_CONDINFO, UR_ORC_DESCEND ] + IF aIndexes[ nIndex ][ INDEX_ORCR ][ UR_ORCR_CONDINFO ][ UR_ORC_DESCEND ] IF nRecords < 0 - IF aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] != NIL .AND. aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] < aIndexes[ nIndex, INDEX_RECORDS, aWAData[ WADATA_ORDRECNO ], INDEXKEY_KEY ] - nResult := AR_GOTO( nWA, aIndexes[ nIndex, INDEX_RECORDS, 1, INDEXKEY_RECORD ] ) + IF aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] != NIL .AND. aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] < aIndexes[ nIndex ][ INDEX_RECORDS ][ aWAData[ WADATA_ORDRECNO ] ][ INDEXKEY_KEY ] + nResult := AR_GOTO( nWA, aIndexes[ nIndex ][ INDEX_RECORDS ][ 1 ][ INDEXKEY_RECORD ] ) aWAData[ WADATA_ORDRECNO ] := 1 aWAData[ WADATA_BOF ] := .T. ENDIF - ELSEIF aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] != NIL .AND. aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] > aIndexes[ nIndex, INDEX_RECORDS, aWAData[ WADATA_ORDRECNO ], INDEXKEY_KEY ] + ELSEIF aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] != NIL .AND. aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] > aIndexes[ nIndex ][ INDEX_RECORDS ][ aWAData[ WADATA_ORDRECNO ] ][ INDEXKEY_KEY ] nResult := AR_GOTO( nWA, 0 ) aWAData[ WADATA_ORDRECNO ] := 0 ENDIF - ELSEIF lScope0 .AND. ! aIndexes[ nIndex, INDEX_RECORDS, nRec + nRecords + nIni, INDEXKEY_KEY ] >= aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] .OR. lScope1 .AND. ! aIndexes[ nIndex, INDEX_RECORDS, nRec + nRecords + nIni, INDEXKEY_KEY ] <= aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] + ELSEIF lScope0 .AND. ! aIndexes[ nIndex ][ INDEX_RECORDS ][ nRec + nRecords + nIni ][ INDEXKEY_KEY ] >= aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] .OR. lScope1 .AND. ! aIndexes[ nIndex ][ INDEX_RECORDS ][ nRec + nRecords + nIni ][ INDEXKEY_KEY ] <= aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] IF nRecords < 0 - IF aIndexes[ nIndex, INDEX_RECORDS, nIni + 1, INDEXKEY_KEY ] + IF aIndexes[ nIndex ][ INDEX_RECORDS ][ nIni + 1 ][ INDEXKEY_KEY ] ENDIF - aWAData[ WADATA_ORDRECNO ] := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO, nIndex ], .F. ) + aWAData[ WADATA_ORDRECNO ] := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO ][ nIndex ], .F. ) aWAData[ WADATA_BOF ] := aWAData[ WADATA_EOF ] ELSE nResult := AR_GOTO( nWA, 0 ) @@ -760,7 +739,7 @@ STATIC FUNCTION AR_BOF( nWA, lBof ) LOCAL aWAData := USRRDD_AREADATA( nWA ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, lBof = %2$s", nWA, hb_ValToExp( lBof ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, lBof: %2$s", nWA, hb_ValToExp( lBof ) ) ) /* This is a hack to protect from dbf1.c skipraw hack */ IF aWAData[ WADATA_FORCEBOF ] .AND. lBof @@ -776,7 +755,7 @@ STATIC FUNCTION AR_EOF( nWA, lEof ) LOCAL aWAData := USRRDD_AREADATA( nWA ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, lEof = %2$s", nWA, hb_ValToExp( lEof ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, lEof: %2$s", nWA, hb_ValToExp( lEof ) ) ) lEof := aWAData[ WADATA_EOF ] @@ -792,12 +771,12 @@ STATIC FUNCTION AR_DELETE( nWA ) LOCAL aKeys[ Len( aIndexes ) ] LOCAL oError - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d", nWA ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d", nWA ) ) IF aOpenInfo[ UR_OI_READONLY ] oError := ErrorNew() oError:GenCode := EG_READONLY - oError:SubCode := 1025 /* EDBF_READONLY */ + oError:SubCode := 1025 /* EDBF_READONLY */ oError:Description := hb_langErrMsg( EG_READONLY ) oError:FileName := aOpenInfo[ UR_OI_NAME ] UR_SUPER_ERROR( nWA, oError ) @@ -805,27 +784,24 @@ STATIC FUNCTION AR_DELETE( nWA ) ENDIF IF ! aWAData[ WADATA_EOF ] - IF aOpenInfo[ UR_OI_SHARED ] .AND. AScan( aWAData[ WADATA_LOCKS ], aWAData[ WADATA_RECNO ] ) == 0 + IF aOpenInfo[ UR_OI_SHARED ] .AND. AScan( aWAData[ WADATA_LOCKS ], aWAData[ WADATA_RECNO ] ) == 0 oError := ErrorNew() oError:GenCode := EG_UNLOCKED - oError:SubCode := 1022 /* EDBF_UNLOCKED */ + oError:SubCode := 1022 /* EDBF_UNLOCKED */ oError:Description := hb_langErrMsg( EG_UNLOCKED ) oError:FileName := aOpenInfo[ UR_OI_NAME ] UR_SUPER_ERROR( nWA, oError ) RETURN HB_FAILURE - ENDIF IF Len( aRecInfo ) > 0 .AND. aWAData[ WADATA_RECNO ] <= Len( aRecInfo ) - AEval( aIndexes, {| aInd, n | aKeys[ n ] := Eval( aInd[ INDEX_ORCR, UR_ORCR_BKEY ] ) } ) + AEval( aIndexes, {| aInd, n | aKeys[ n ] := Eval( aInd[ INDEX_ORCR ][ UR_ORCR_BKEY ] ) } ) aRecInfo[ aWAData[ WADATA_RECNO ] ][ RECDATA_DELETED ] := .T. - AEval( aIndexes, {| aInd, n | ModifyIndex( n, Eval( aInd[ INDEX_ORCR, UR_ORCR_BKEY ] ), aInd, aWAData, aKeys[ n ] ) } ) - + AEval( aIndexes, {| aInd, n | ModifyIndex( n, Eval( aInd[ INDEX_ORCR ][ UR_ORCR_BKEY ] ), aInd, aWAData, aKeys[ n ] ) } ) ENDIF - ENDIF RETURN HB_SUCCESS @@ -836,7 +812,7 @@ STATIC FUNCTION AR_DELETED( nWA, lDeleted ) LOCAL aDBFData := aWAData[ WADATA_DATABASE ] LOCAL aRecInfo := aDBFData[ DATABASE_RECINFO ] - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, lDeleted = %2$s", nWA, hb_ValToExp( lDeleted ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, lDeleted: %2$s", nWA, hb_ValToExp( lDeleted ) ) ) IF Len( aRecInfo ) > 0 .AND. aWAData[ WADATA_RECNO ] <= Len( aRecInfo ) lDeleted := aRecInfo[ aWAData[ WADATA_RECNO ] ][ RECDATA_DELETED ] @@ -851,17 +827,17 @@ STATIC FUNCTION AR_RECALL( nWA ) LOCAL aWAData := USRRDD_AREADATA( nWA ) LOCAL aDBFData := aWAData[ WADATA_DATABASE ] LOCAL aRecInfo := aDBFData[ DATABASE_RECINFO ] - LOCAL aIndexes := aDBFData[ DATABASE_INDEX ] LOCAL aOpenInfo := aWAData[ WADATA_OPENINFO ] + LOCAL aIndexes := aDBFData[ DATABASE_INDEX ] LOCAL aKeys[ Len( aIndexes ) ] LOCAL oError - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d", nWA ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d", nWA ) ) IF aOpenInfo[ UR_OI_READONLY ] oError := ErrorNew() oError:GenCode := EG_READONLY - oError:SubCode := 1025 /* EDBF_READONLY */ + oError:SubCode := 1025 /* EDBF_READONLY */ oError:Description := hb_langErrMsg( EG_READONLY ) oError:FileName := aOpenInfo[ UR_OI_NAME ] UR_SUPER_ERROR( nWA, oError ) @@ -869,10 +845,11 @@ STATIC FUNCTION AR_RECALL( nWA ) ENDIF IF ! aWAData[ WADATA_EOF ] + IF aOpenInfo[ UR_OI_SHARED ] .AND. AScan( aWAData[ WADATA_LOCKS ], aWAData[ WADATA_RECNO ] ) == 0 oError := ErrorNew() oError:GenCode := EG_UNLOCKED - oError:SubCode := 1022 /* EDBF_UNLOCKED */ + oError:SubCode := 1022 /* EDBF_UNLOCKED */ oError:Description := hb_langErrMsg( EG_UNLOCKED ) oError:FileName := aOpenInfo[ UR_OI_NAME ] UR_SUPER_ERROR( nWA, oError ) @@ -880,9 +857,9 @@ STATIC FUNCTION AR_RECALL( nWA ) ENDIF IF Len( aRecInfo ) > 0 .AND. aWAData[ WADATA_RECNO ] <= Len( aRecInfo ) - AEval( aIndexes, {| aInd, n | aKeys[ n ] := Eval( aInd[ INDEX_ORCR, UR_ORCR_BKEY ] ) } ) + AEval( aIndexes, {| aInd, n | aKeys[ n ] := Eval( aInd[ INDEX_ORCR ][ UR_ORCR_BKEY ] ) } ) aRecInfo[ aWAData[ WADATA_RECNO ] ][ RECDATA_DELETED ] := .F. - AEval( aIndexes, {| aInd, n | ModifyIndex( n, Eval( aInd[ INDEX_ORCR, UR_ORCR_BKEY ] ), aInd, aWAData, aKeys[ n ] ) } ) + AEval( aIndexes, {| aInd, n | ModifyIndex( n, Eval( aInd[ INDEX_ORCR ][ UR_ORCR_BKEY ] ), aInd, aWAData, aKeys[ n ] ) } ) ENDIF ENDIF @@ -894,14 +871,14 @@ STATIC FUNCTION AR_APPEND( nWA, nRecords ) LOCAL aDBFData := aWAData[ WADATA_DATABASE ] LOCAL aRecords := aDBFData[ DATABASE_RECORDS ] LOCAL aRecInfo := aDBFData[ DATABASE_RECINFO ] - LOCAL aStruct := aDBFData[ DATABASE_STRUCT ] + LOCAL aStruct := aDBFData[ DATABASE_STRUCT ] LOCAL aIndexes := aDBFData[ DATABASE_INDEX ] LOCAL aOpenInfo := aWAData[ WADATA_OPENINFO ] LOCAL oError, aRecord, aRecDataInit HB_SYMBOL_UNUSED( nRecords ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nRecords = %2$s", nWA, hb_ValToExp( nRecords ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nRecords: %2$s", nWA, hb_ValToExp( nRecords ) ) ) IF aOpenInfo[ UR_OI_READONLY ] oError := ErrorNew() @@ -927,10 +904,10 @@ STATIC FUNCTION AR_APPEND( nWA, nRecords ) NetErr( .F. ) AR_GOTO( nWa, Len( aRecords ) ) - AEval( aIndexes, {| aIndex, n | ModifyIndex( n, Eval( aIndex[ INDEX_ORCR, UR_ORCR_BKEY ] ), aIndex, aWAData ) } ) + AEval( aIndexes, {| aIndex, n | ModifyIndex( n, Eval( aIndex[ INDEX_ORCR ][ UR_ORCR_BKEY ] ), aIndex, aWAData ) } ) /* SHARED ACCESS */ - IF aWAData[ WADATA_OPENINFO, UR_OI_SHARED ] + IF aWAData[ WADATA_OPENINFO ][ UR_OI_SHARED ] aRecDataInit[ RECDATA_LOCKED ] := nWA AAdd( aWAData[ WADATA_LOCKS ], aWAData[ WADATA_RECNO ] ) ENDIF @@ -943,14 +920,14 @@ STATIC FUNCTION AR_LOCK( nWA, aLock ) LOCAL nRec := iif( aLock[ UR_LI_RECORD ] == NIL, aWAData[ WADATA_RECNO ], aLock[ UR_LI_RECORD ] ) LOCAL aRecInfo - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, aLock = %2$s", nWA, hb_ValToExp( aLock ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, aLock: %2$s", nWA, hb_ValToExp( aLock ) ) ) IF aWAData[ WADATA_EOF ] aLock[ UR_LI_RESULT ] := .T. ELSE - aRecInfo := aWAData[ WADATA_DATABASE, DATABASE_RECINFO, nRec ] - IF aWAData[ WADATA_OPENINFO, UR_OI_SHARED ] + aRecInfo := aWAData[ WADATA_DATABASE ][ DATABASE_RECINFO ][ nRec ] + IF aWAData[ WADATA_OPENINFO ][ UR_OI_SHARED ] IF aRecInfo[ RECDATA_LOCKED ] == nWA aLock[ UR_LI_RESULT ] := .T. ELSEIF aRecInfo[ RECDATA_LOCKED ] != 0 @@ -971,21 +948,20 @@ STATIC FUNCTION AR_UNLOCK( nWA, nRec ) LOCAL aWAData := USRRDD_AREADATA( nWA ) LOCAL aRecords := aWAData[ WADATA_LOCKS ] - LOCAL aRecInfo := aWAData[ WADATA_DATABASE, DATABASE_RECINFO ] + LOCAL aRecInfo := aWAData[ WADATA_DATABASE ][ DATABASE_RECINFO ] LOCAL nPos - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nRec = %2$d", nWA, nRec ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nRec: %2$d", nWA, nRec ) ) IF ! Empty( aRecords ) IF nRec == NIL /* Unlock All */ FOR EACH nRec IN aRecords - aRecInfo[ nRec, RECDATA_LOCKED ] := 0 + aRecInfo[ nRec ][ RECDATA_LOCKED ] := 0 NEXT ASize( aRecords, 0 ) ELSE - nPos := AScan( aRecords, nRec ) - IF nPos > 0 - aRecInfo[ nRec, RECDATA_LOCKED ] := 0 + IF ( nPos := AScan( aRecords, nRec ) ) > 0 + aRecInfo[ nRec ][ RECDATA_LOCKED ] := 0 hb_ADel( aRecords, nPos, .T. ) ENDIF ENDIF @@ -1000,7 +976,7 @@ STATIC FUNCTION AR_RECID( nWA, nRecNo ) LOCAL aRecords := aDBFData[ DATABASE_RECORDS ] LOCAL nRecCount := Len( aRecords ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nRecNo = %2$s", nWA, hb_ValToExp( nRecNo ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nRecNo: %2$s", nWA, hb_ValToExp( nRecNo ) ) ) IF aWAData[ WADATA_EOF ] nRecNo := nRecCount + 1 @@ -1016,11 +992,11 @@ STATIC FUNCTION AR_RECCOUNT( nWA, nRecords ) LOCAL aDBFData := aWAData[ WADATA_DATABASE ] LOCAL aRecords := aDBFData[ DATABASE_RECORDS ] - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nRecords = %2$s", nWA, hb_ValToExp( nRecords ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nRecords: %2$s", nWA, hb_ValToExp( nRecords ) ) ) nRecords := Len( aRecords ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nRecords = %1$d", nRecords ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nRecords: %1$d", nRecords ) ) RETURN HB_SUCCESS @@ -1034,12 +1010,12 @@ STATIC FUNCTION AR_PACK( nWA ) LOCAL aIndexes := aDBFData[ DATABASE_INDEX ] LOCAL nDel := 0 - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d", nWA ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d", nWA ) ) IF ! aDBFData[ DATABASE_LOCKED ] oError := ErrorNew() oError:GenCode := EG_UNLOCKED - oError:SubCode := 1022 /* EDBF_UNLOCKED */ + oError:SubCode := 1022 /* EDBF_UNLOCKED */ oError:Description := hb_langErrMsg( EG_UNLOCKED ) UR_SUPER_ERROR( nWA, oError ) RETURN FAILURE @@ -1061,7 +1037,7 @@ STATIC FUNCTION AR_PACK( nWA ) NEXT FOR nRec := Len( aRecInfo ) TO 1 STEP -1 - IF aRecInfo[ nRec, RECDATA_DELETED ] + IF aRecInfo[ nRec ][ RECDATA_DELETED ] ADel( aRecInfo, nRec ) ADel( aRecords, nRec ) nDel++ @@ -1071,6 +1047,7 @@ STATIC FUNCTION AR_PACK( nWA ) ASize( aRecInfo, Len( aRecInfo ) - nDel ) ASize( aRecords, Len( aRecInfo ) ) ENDIF + AR_GOTOP( nWA ) RETURN SUCCESS @@ -1082,7 +1059,7 @@ STATIC FUNCTION AR_ZAP( nWA ) LOCAL aOpenInfo := aWAData[ WADATA_OPENINFO ] LOCAL oError - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d", nWA ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d", nWA ) ) IF aOpenInfo[ UR_OI_READONLY ] oError := ErrorNew() @@ -1121,7 +1098,7 @@ STATIC FUNCTION AR_GOCOLD( nWA ) STATIC FUNCTION AR_FOUND( nWa, lFound ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, lFound = %2$s", nWa, hb_ValToExp( lFound ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, lFound: %2$s", nWa, hb_ValToExp( lFound ) ) ) lFound := USRRDD_AREADATA( nWA )[ WADATA_FOUND ] @@ -1130,19 +1107,19 @@ STATIC FUNCTION AR_FOUND( nWa, lFound ) STATIC FUNCTION AR_SEEK( nWa, lSoftSeek, xSeek, lLast ) LOCAL aWAData := USRRDD_AREADATA( nWA ) - LOCAL aIndexes := aWAData[ WADATA_DATABASE, DATABASE_INDEX ] + LOCAL aIndexes := aWAData[ WADATA_DATABASE ][ DATABASE_INDEX ] LOCAL nIndex := aWAData[ WADATA_INDEX ] LOCAL nResult /* := HB_SUCCESS */ - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, lSoftSeek = %2$s, xSeek = %3$s, lLast = %4$s", nWa, hb_ValToExp( lSoftSeek ), hb_ValToExp( xSeek ), hb_ValToExp( lLast ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, lSoftSeek: %2$s, xSeek: %3$s, lLast: %4$s", nWa, hb_ValToExp( lSoftSeek ), hb_ValToExp( xSeek ), hb_ValToExp( lLast ) ) ) aWAData[ WADATA_ORDRECNO ] := Seek( xSeek, lSoftSeek, lLast, aIndexes[ nIndex ] ) - IF aWAData[ WADATA_ORDRECNO ] == 0 .OR. aWAData[ WADATA_ORDRECNO ] > Len( aIndexes[ nIndex, INDEX_RECORDS ] ) + IF aWAData[ WADATA_ORDRECNO ] == 0 .OR. aWAData[ WADATA_ORDRECNO ] > Len( aIndexes[ nIndex ][ INDEX_RECORDS ] ) aWAData[ WADATA_FOUND ] := .F. nResult := AR_GOTO( nWA, 0 ) ELSE - aWAData[ WADATA_FOUND ] := LEFTEQUAL( aIndexes[ nIndex, INDEX_RECORDS, aWAData[ WADATA_ORDRECNO ], INDEXKEY_KEY ], xSeek ) - nResult := AR_GOTO( nWA, aIndexes[ nIndex, INDEX_RECORDS, aWAData[ WADATA_ORDRECNO ], INDEXKEY_RECORD ] ) + aWAData[ WADATA_FOUND ] := LEFTEQUAL( aIndexes[ nIndex ][ INDEX_RECORDS ][ aWAData[ WADATA_ORDRECNO ] ][ INDEXKEY_KEY ], xSeek ) + nResult := AR_GOTO( nWA, aIndexes[ nIndex ][ INDEX_RECORDS ][ aWAData[ WADATA_ORDRECNO ] ][ INDEXKEY_RECORD ] ) ENDIF RETURN nResult @@ -1152,7 +1129,7 @@ STATIC FUNCTION AR_INFO( nWA, nMsg, xValue ) LOCAL aWAData := USRRDD_AREADATA( nWA ) LOCAL aDBFData := aWAData[ WADATA_DATABASE ] - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nMsg = %2$s, xValue = %3$s", nWA, hb_ValToExp( nMsg ), hb_ValToExp( xValue ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nMsg: %2$s, xValue: %3$s", nWA, hb_ValToExp( nMsg ), hb_ValToExp( xValue ) ) ) SWITCH nMsg CASE DBI_TABLEEXT @@ -1175,15 +1152,14 @@ STATIC FUNCTION AR_ORDLSTADD( nWA, aOrderInfo ) HB_SYMBOL_UNUSED( aOrderInfo ) - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, aOrderInfo = %2$s", nWA, hb_ValToExp( aOrderInfo ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, aOrderInfo: %2$s", nWA, hb_ValToExp( aOrderInfo ) ) ) IF Empty( aIndexes ) aWAData[ WADATA_INDEX ] := 0 - ELSE aWAData[ WADATA_INDEX ] := 1 IF Empty( aWAData[ WADATA_WAORDINFO ] ) - AEval( aWAData[ WADATA_WAORDINFO ] := Array( Len( aIndexes ) ), {| x, y | HB_SYMBOL_UNUSED( x ), aWAData[ WADATA_WAORDINFO, y ] := AR_WAOIINIT() } ) + AEval( aWAData[ WADATA_WAORDINFO ] := Array( Len( aIndexes ) ), {| x, y | HB_SYMBOL_UNUSED( x ), aWAData[ WADATA_WAORDINFO ][ y ] := AR_WAOIINIT() } ) ENDIF ENDIF @@ -1197,7 +1173,7 @@ STATIC FUNCTION AR_ORDLSTFOCUS( nWA, aOrderInfo ) LOCAL aIndexes := aDBFData[ DATABASE_INDEX ] LOCAL xIndex := aOrderInfo[ UR_ORI_TAG ] - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, aOrderInfo = %2$s", nWA, hb_ValToExp( aOrderInfo ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, aOrderInfo: %2$s", nWA, hb_ValToExp( aOrderInfo ) ) ) aOrderInfo[ UR_ORI_RESULT ] := iif( aWAData[ WADATA_INDEX ] > 0, aIndexes[ aWAData[ WADATA_INDEX ], INDEX_TAG ], "" ) @@ -1219,7 +1195,7 @@ STATIC FUNCTION AR_ORDCREATE( nWA, aOrderCreate ) LOCAL aIndexes, nContNext, nContStep LOCAL bWhile, nRec, bNext, bEval, bEvalOCI, nStep, nIndex, cIndex, aIndex - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, aOrderCreate = %2$s", nWA, hb_ValToExp( aOrderCreate ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, aOrderCreate: %2$s", nWA, hb_ValToExp( aOrderCreate ) ) ) aWAData := USRRDD_AREADATA( nWA ) aDBFData := aWAData[ WADATA_DATABASE ] @@ -1264,10 +1240,9 @@ STATIC FUNCTION AR_ORDCREATE( nWA, aOrderCreate ) ENDIF cIndex := aOrderCreate[ UR_ORCR_TAGNAME ] := Upper( aOrderCreate[ UR_ORCR_TAGNAME ] ) aIndex := AR_INDEXINIT() - aIndex[ INDEX_TAG ] := cIndex - aIndex[ INDEX_ORCR ] := aOrderCreate - nIndex := AScan( aIndexes, {| x | x[ INDEX_TAG ] == cIndex } ) - IF nIndex > 0 + aIndex[ INDEX_TAG ] := cIndex + aIndex[ INDEX_ORCR ] := aOrderCreate + IF ( nIndex := AScan( aIndexes, {| x | x[ INDEX_TAG ] == cIndex } ) ) > 0 ADel( aIndexes, nIndex ) aIndexes[ Len( aIndexes ) ] := aIndex ELSE @@ -1322,10 +1297,10 @@ STATIC FUNCTION AR_ORDCREATE( nWA, aOrderCreate ) STATIC FUNCTION AR_ORDINFO( nWA, nMsg, aOrderInfo ) LOCAL aWAData := USRRDD_AREADATA( nWA ) - LOCAL aIndexes := aWAData[ WADATA_DATABASE, DATABASE_INDEX ] + LOCAL aIndexes := aWAData[ WADATA_DATABASE ][ DATABASE_INDEX ] LOCAL nIndex, nPos - HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA = %1$d, nMsg = %2$s, aOrderInfo = %3$s", nWA, hb_ValToExp( nMsg ), hb_ValToExp( aOrderInfo ) ) ) + HB_TRACE( HB_TR_DEBUG, hb_StrFormat( "nWA: %1$d, nMsg: %2$s, aOrderInfo: %3$s", nWA, hb_ValToExp( nMsg ), hb_ValToExp( aOrderInfo ) ) ) IF Empty( aOrderInfo[ UR_ORI_TAG ] ) aOrderInfo[ UR_ORI_TAG ] := aOrderInfo[ UR_ORI_BAG ] @@ -1344,26 +1319,26 @@ STATIC FUNCTION AR_ORDINFO( nWA, nMsg, aOrderInfo ) ENDSWITCH SWITCH nMsg - CASE DBOI_EXPRESSION /* 2 */ + CASE DBOI_EXPRESSION IF nIndex < 1 .OR. Empty( aIndexes ) .OR. nIndex > Len( aIndexes[ nIndex ] ) aOrderInfo[ UR_ORI_RESULT ] := "" ELSE - aOrderInfo[ UR_ORI_RESULT ] := aIndexes[ nIndex, INDEX_ORCR, UR_ORCR_CKEY ] + aOrderInfo[ UR_ORI_RESULT ] := aIndexes[ nIndex ][ INDEX_ORCR ][ UR_ORCR_CKEY ] ENDIF EXIT - CASE DBOI_POSITION /* 3 */ - IF nIndex < 1 .OR. Empty( aIndexes ) .OR. nIndex > Len( aIndexes[ nIndex ] ) .OR. Empty( aIndexes[ nIndex, INDEX_RECORDS ] ) .OR. aWAData[ WADATA_ORDRECNO ] == 0 + CASE DBOI_POSITION + IF nIndex < 1 .OR. Empty( aIndexes ) .OR. nIndex > Len( aIndexes[ nIndex ] ) .OR. Empty( aIndexes[ nIndex ][ INDEX_RECORDS ] ) .OR. aWAData[ WADATA_ORDRECNO ] == 0 aOrderInfo[ UR_ORI_RESULT ] := 0 ELSE - IF aIndexes[ nIndex, INDEX_RECORDS, aWAData[ WADATA_ORDRECNO ], INDEXKEY_RECORD ] != aWAData[ WADATA_RECNO ] - aWAData[ WADATA_ORDRECNO ] := Seek( Eval( aIndexes[ nIndex, INDEX_ORCR, UR_ORCR_BKEY ] ), .F., .F., aIndexes[ nIndex ], aWAData[ WADATA_RECNO ] ) + IF aIndexes[ nIndex ][ INDEX_RECORDS ][ aWAData[ WADATA_ORDRECNO ] ][ INDEXKEY_RECORD ] != aWAData[ WADATA_RECNO ] + aWAData[ WADATA_ORDRECNO ] := Seek( Eval( aIndexes[ nIndex ][ INDEX_ORCR ][ UR_ORCR_BKEY ] ), .F., .F., aIndexes[ nIndex ], aWAData[ WADATA_RECNO ] ) ENDIF - IF aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] == NIL + IF aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] == NIL aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_ORDRECNO ] ELSE - nPos := Seek( aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ], .T., .F., aIndexes[ nIndex ] ) - IF nPos > 0 .AND. ! LEFTEQUAL( aIndexes[ nIndex, INDEX_RECORDS, nPos, INDEXKEY_KEY ], aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] ) - IF nPos > 1 .AND. aIndexes[ nIndex, INDEX_RECORDS, nPos - 1, INDEXKEY_KEY ] >= aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] + nPos := Seek( aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ], .T., .F., aIndexes[ nIndex ] ) + IF nPos > 0 .AND. ! LEFTEQUAL( aIndexes[ nIndex ][ INDEX_RECORDS ][ nPos ][ INDEXKEY_KEY ], aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] ) + IF nPos > 1 .AND. aIndexes[ nIndex ][ INDEX_RECORDS ][ nPos - 1 ][ INDEXKEY_KEY ] >= aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] nPos-- ELSE aOrderInfo[ UR_ORI_RESULT ] := 0 @@ -1374,26 +1349,26 @@ STATIC FUNCTION AR_ORDINFO( nWA, nMsg, aOrderInfo ) ENDIF ENDIF EXIT - CASE DBOI_BAGNAME /* 7 */ + CASE DBOI_BAGNAME aOrderInfo[ UR_ORI_RESULT ] := "" EXIT - CASE DBOI_KEYCOUNT /* 26 */ - IF nIndex > 0 .AND. ! Empty( aWAData[ WADATA_DATABASE, DATABASE_RECORDS ] ) - IF aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] == NIL + CASE DBOI_KEYCOUNT + IF nIndex >= 1 .AND. ! Empty( aWAData[ WADATA_DATABASE ][ DATABASE_RECORDS ] ) + IF aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] == NIL nPos := 0 ELSE - nPos := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO, nIndex ], .F. ) + nPos := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO ][ nIndex ], .F. ) IF nPos == 0 aOrderInfo[ UR_ORI_RESULT ] := 0 EXIT ENDIF ENDIF - IF aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] == NIL + IF aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] == NIL IF nPos > 0 - nPos := Len( aIndexes[ nIndex, INDEX_RECORDS ] ) - nPos + 1 + nPos := Len( aIndexes[ nIndex ][ INDEX_RECORDS ] ) - nPos + 1 ENDIF ELSE - nMsg := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO, nIndex ], .T. ) + nMsg := SeekScope( aIndexes[ nIndex ], aWAData[ WADATA_WAORDINFO ][ nIndex ], .T. ) IF nMsg > 0 IF nPos == 0 nPos := nMsg @@ -1405,35 +1380,34 @@ STATIC FUNCTION AR_ORDINFO( nWA, nMsg, aOrderInfo ) IF nPos > 0 aOrderInfo[ UR_ORI_RESULT ] := nPos ELSE - aOrderInfo[ UR_ORI_RESULT ] := Len( aIndexes[ nIndex, INDEX_RECORDS ] ) + aOrderInfo[ UR_ORI_RESULT ] := Len( aIndexes[ nIndex ][ INDEX_RECORDS ] ) ENDIF ELSE aOrderInfo[ UR_ORI_RESULT ] := 0 ENDIF EXIT - CASE DBOI_SCOPETOP /* 39 */ - aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] + CASE DBOI_SCOPETOP + aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] IF aOrderInfo[ UR_ORI_ALLTAGS ] != NIL - aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] := aOrderInfo[ UR_ORI_NEWVAL ] + aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] := aOrderInfo[ UR_ORI_NEWVAL ] ENDIF EXIT - CASE DBOI_SCOPEBOTTOM /* 40 */ - aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] + CASE DBOI_SCOPEBOTTOM + aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] IF aOrderInfo[ UR_ORI_ALLTAGS ] != NIL - aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] := aOrderInfo[ UR_ORI_NEWVAL ] + aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] := aOrderInfo[ UR_ORI_NEWVAL ] ENDIF EXIT - CASE DBOI_SCOPETOPCLEAR /* 41 */ - aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] - aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_0 ] := NIL + CASE DBOI_SCOPETOPCLEAR + aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] + aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_0 ] := NIL EXIT - CASE DBOI_SCOPEBOTTOMCLEAR /* 42 */ - aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] - aWAData[ WADATA_WAORDINFO, nIndex, WAOI_SCOPE_1 ] := NIL + CASE DBOI_SCOPEBOTTOMCLEAR + aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] + aWAData[ WADATA_WAORDINFO ][ nIndex ][ WAOI_SCOPE_1 ] := NIL EXIT OTHERWISE RETURN HB_FAILURE - ENDSWITCH RETURN HB_SUCCESS @@ -1612,10 +1586,10 @@ FUNCTION hb_EraseArrayRdd( cFullName ) oError:GenCode := EG_UNSUPPORTED oError:SubCode := 1000 /* EDBF_UNSUPPORTED */ oError:Description := hb_langErrMsg( EG_UNSUPPORTED ) + " (" + ; - "ARRAYRDD not in use)" + "ARRAYRDD not inizialized)" oError:FileName := cFullName oError:CanDefault := .T. - Throw( oError ) + THROW( oError ) nReturn := HB_FAILURE @@ -1677,10 +1651,8 @@ FUNCTION hb_FileArrayRdd( cFullName ) RETURN nReturn == HB_SUCCESS -/* - hb_SetArrayRdd( aArray ) --> NIL - This function set DBF with aArray like APPEND FROM aArray in an empty DBF -*/ +/* hb_SetArrayRdd( aArray ) --> NIL + This function set DBF with aArray like APPEND FROM aArray in an empty DBF */ PROCEDURE hb_SetArrayRdd( aArray ) LOCAL aRecInfo @@ -1949,16 +1921,16 @@ STATIC PROCEDURE ModifyIndex( nIndex, xValue, aIndex, aWAData, xValorAnt ) AAdd( aIndex[ INDEX_RECORDS ], NIL ) ENDIF IF nPos > 0 - IF aIndex[ INDEX_RECORDS, nPos ] != NIL .AND. aIndex[ INDEX_RECORDS, nPos, INDEXKEY_KEY ] <= xValue + IF aIndex[ INDEX_RECORDS ][ nPos ] != NIL .AND. aIndex[ INDEX_RECORDS ][ nPos ][ INDEXKEY_KEY ] <= xValue nPos++ ENDIF ELSE nPos := Len( aIndex[ INDEX_RECORDS ] ) ENDIF AIns( aIndex[ INDEX_RECORDS ], nPos ) - aIndex[ INDEX_RECORDS, nPos ] := AR_INDEXKEYINIT() - aIndex[ INDEX_RECORDS, nPos, INDEXKEY_KEY ] := xValue - aIndex[ INDEX_RECORDS, nPos, INDEXKEY_RECORD ] := aWAData[ WADATA_RECNO ] + aIndex[ INDEX_RECORDS ][ nPos ] := AR_INDEXKEYINIT() + aIndex[ INDEX_RECORDS ][ nPos ][ INDEXKEY_KEY ] := xValue + aIndex[ INDEX_RECORDS ][ nPos ][ INDEXKEY_RECORD ] := aWAData[ WADATA_RECNO ] IF nIndex == aWAData[ WADATA_INDEX ] aWAData[ WADATA_ORDRECNO ] := nPos ENDIF @@ -1968,7 +1940,6 @@ STATIC PROCEDURE ModifyIndex( nIndex, xValue, aIndex, aWAData, xValorAnt ) IF nIndex == aWAData[ WADATA_INDEX ] aWAData[ WADATA_ORDRECNO ] := 0 ENDIF - ENDIF RETURN @@ -1985,23 +1956,28 @@ STATIC FUNCTION Seek( xSeek, lSoft, lLast, aIndexInfo, nRec ) nPos := 0 EXIT CASE 1 /* Archive with 1 record */ - IF aIndex[ 1 ] == NIL .OR. iif( lSoft, iif( aIndexInfo[ INDEX_ORCR, UR_ORCR_CONDINFO, UR_ORC_DESCEND ], aIndex[ 1, INDEXKEY_KEY ] <= xSeek, aIndex[ 1, INDEXKEY_KEY ] >= xSeek ), LEFTEQUAL( aIndex[ 1, INDEXKEY_KEY ], xSeek ) ) + IF aIndex[ 1 ] == NIL .OR. ; + iif( lSoft, ; + iif( aIndexInfo[ INDEX_ORCR ][ UR_ORCR_CONDINFO ][ UR_ORC_DESCEND ], ; + aIndex[ 1 ][ INDEXKEY_KEY ] <= xSeek, ; + aIndex[ 1 ][ INDEXKEY_KEY ] >= xSeek ), ; + LEFTEQUAL( aIndex[ 1 ][ INDEXKEY_KEY ], xSeek ) ) nPos := 1 ELSE nPos := 0 ENDIF EXIT OTHERWISE /* Archive with 2 or more records */ - IF aIndexInfo[ INDEX_ORCR, UR_ORCR_CONDINFO, UR_ORC_DESCEND ] - bFirst := {|| aIndex[ 2, INDEXKEY_KEY ] >= xSeek } - bBefore := {|| xSeek > aIndex[ nPos, INDEXKEY_KEY ] } - bAfter := {|| xSeek < aIndex[ nPos, INDEXKEY_KEY ] } - bAjust := {|| ! aIndex[ nPos, INDEXKEY_KEY ] <= xSeek } + IF aIndexInfo[ INDEX_ORCR ][ UR_ORCR_CONDINFO ][ UR_ORC_DESCEND ] + bFirst := {|| aIndex[ 2 ][ INDEXKEY_KEY ] >= xSeek } + bBefore := {|| xSeek > aIndex[ nPos ][ INDEXKEY_KEY ] } + bAfter := {|| xSeek < aIndex[ nPos ][ INDEXKEY_KEY ] } + bAjust := {|| ! aIndex[ nPos ][ INDEXKEY_KEY ] <= xSeek } ELSE - bFirst := {|| aIndex[ 2, INDEXKEY_KEY ] <= xSeek } - bBefore := {|| ! aIndex[ nPos, INDEXKEY_KEY ] <= xSeek } - bAfter := {|| xSeek > aIndex[ nPos, INDEXKEY_KEY ] } - bAjust := {|| ! aIndex[ nPos, INDEXKEY_KEY ] >= xSeek } + bFirst := {|| aIndex[ 2 ][ INDEXKEY_KEY ] <= xSeek } + bBefore := {|| ! aIndex[ nPos ][ INDEXKEY_KEY ] <= xSeek } + bAfter := {|| xSeek > aIndex[ nPos ][ INDEXKEY_KEY ] } + bAjust := {|| ! aIndex[ nPos ][ INDEXKEY_KEY ] >= xSeek } ENDIF IF aIndex[ 2 ] != NIL .AND. Eval( bFirst ) @@ -2013,7 +1989,7 @@ STATIC FUNCTION Seek( xSeek, lSoft, lLast, aIndexInfo, nRec ) nIni := nPos + 1 ELSE IF lLast - IF nPos < nEnd .AND. aIndex[ nPos + 1 ] != NIL .AND. LEFTEQUAL( aIndex[ nPos + 1, INDEXKEY_KEY ], xSeek ) + IF nPos < nEnd .AND. aIndex[ nPos + 1 ] != NIL .AND. LEFTEQUAL( aIndex[ nPos + 1 ][ INDEXKEY_KEY ], xSeek ) nIni := nPos + 1 ELSE EXIT @@ -2021,7 +1997,7 @@ STATIC FUNCTION Seek( xSeek, lSoft, lLast, aIndexInfo, nRec ) ELSE nEnd := nPos - 1 ENDIF - IF nRec != NIL .AND. nRec == aIndex[ nPos, INDEXKEY_RECORD ] + IF nRec != NIL .AND. nRec == aIndex[ nPos ][ INDEXKEY_RECORD ] EXIT ENDIF ENDIF @@ -2033,13 +2009,13 @@ STATIC FUNCTION Seek( xSeek, lSoft, lLast, aIndexInfo, nRec ) nPos := 1 ENDIF IF nRec != NIL - IF nIni <= nEnd .AND. ! Empty( aIndex ) .AND. aIndex[ nPos ] != NIL .AND. nRec != aIndex[ nPos, INDEXKEY_RECORD ] + IF nIni <= nEnd .AND. ! Empty( aIndex ) .AND. aIndex[ nPos ] != NIL .AND. nRec != aIndex[ nPos ][ INDEXKEY_RECORD ] nEnd := Len( aIndex ) FOR nPos := nIni TO nEnd - IF aIndex[ nPos ] == NIL .OR. ! LEFTEQUAL( xSeek, aIndex[ nPos, INDEXKEY_KEY ] ) + IF aIndex[ nPos ] == NIL .OR. ! LEFTEQUAL( xSeek, aIndex[ nPos ][ INDEXKEY_KEY ] ) nPos := 0 EXIT - ELSEIF aIndex[ nPos, INDEXKEY_RECORD ] == nRec + ELSEIF aIndex[ nPos ][ INDEXKEY_RECORD ] == nRec EXIT ENDIF NEXT @@ -2048,11 +2024,10 @@ STATIC FUNCTION Seek( xSeek, lSoft, lLast, aIndexInfo, nRec ) ENDIF ENDIF ELSEIF ! lSoft - IF nPos > Len( aIndex ) .OR. ! LEFTEQUAL( aIndex[ nPos, INDEXKEY_KEY ], xSeek ) + IF nPos > Len( aIndex ) .OR. ! LEFTEQUAL( aIndex[ nPos ][ INDEXKEY_KEY ], xSeek ) nPos := 0 ENDIF ENDIF - EXIT ENDSWITCH @@ -2062,8 +2037,8 @@ STATIC FUNCTION SeekScope( aIndex, aOrdInfo, lBottom ) LOCAL nPos := Seek( aOrdInfo[ WAOI_SCOPE_0 ], .T., lBottom, aIndex ) - IF nPos > 0 .AND. ! LEFTEQUAL( aIndex[ INDEX_RECORDS, nPos, INDEXKEY_KEY ], aOrdInfo[ WAOI_SCOPE_1 ] ) - IF nPos > 1 .AND. aIndex[ INDEX_RECORDS, nPos - 1, INDEXKEY_KEY ] >= aOrdInfo[ WAOI_SCOPE_0 ] + IF nPos > 0 .AND. ! LEFTEQUAL( aIndex[ INDEX_RECORDS ][ nPos ][ INDEXKEY_KEY ], aOrdInfo[ WAOI_SCOPE_1 ] ) + IF nPos > 1 .AND. aIndex[ INDEX_RECORDS ][ nPos - 1 ][ INDEXKEY_KEY ] >= aOrdInfo[ WAOI_SCOPE_0 ] nPos-- ELSE nPos := 0 diff --git a/src/rdd/usrrdd/rdds/dbtcdx.prg b/src/rdd/usrrdd/rdds/dbtcdx.prg index c6aecca926..91e0d82320 100644 --- a/src/rdd/usrrdd/rdds/dbtcdx.prg +++ b/src/rdd/usrrdd/rdds/dbtcdx.prg @@ -44,9 +44,9 @@ * */ -#include "rddsys.ch" -#include "hbusrrdd.ch" #include "dbinfo.ch" +#include "hbusrrdd.ch" +#include "rddsys.ch" /* * DBTCDX RDD @@ -62,7 +62,6 @@ REQUEST DBFFPT ANNOUNCE DBTCDX FUNCTION DBTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) - RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; "DBFCDX", {}, pSuperRddID ) /* We are inheriting from DBFCDX */ diff --git a/src/rdd/usrrdd/rdds/fptcdx.prg b/src/rdd/usrrdd/rdds/fptcdx.prg index 94b6ef2d65..fd99e1c8a2 100644 --- a/src/rdd/usrrdd/rdds/fptcdx.prg +++ b/src/rdd/usrrdd/rdds/fptcdx.prg @@ -44,9 +44,9 @@ * */ -#include "rddsys.ch" -#include "hbusrrdd.ch" #include "dbinfo.ch" +#include "hbusrrdd.ch" +#include "rddsys.ch" /* * FPTCDX RDD @@ -58,11 +58,10 @@ REQUEST DBFCDX REQUEST DBFFPT -/* Announce our RDD for forign REQUESTs */ +/* Announce our RDD for foreign REQUESTs */ ANNOUNCE FPTCDX FUNCTION FPTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) - RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; "DBFCDX", {}, pSuperRddID ) /* We are inheriting from DBFCDX */ diff --git a/src/rdd/usrrdd/rdds/hscdx.prg b/src/rdd/usrrdd/rdds/hscdx.prg index 0389dfe617..4cc46b7782 100644 --- a/src/rdd/usrrdd/rdds/hscdx.prg +++ b/src/rdd/usrrdd/rdds/hscdx.prg @@ -46,16 +46,16 @@ /* * A simple RDD which adds automatically update HSX indexes to DBFCDX - * To create new HSX index for current work area use: HSX_CREATE() - * To open already existing one use HSX_OPEN(), - * To close use: HSX_CLOSE() - * To retieve an handle use: HSX_HANDLE() + * To create new HSX index for current work area use: hsx_Create() + * To open already existing one use hsx_Open(), + * To close use: hsx_Close() + * To retrieve an handle use: hsx_Handle() */ -#include "rddsys.ch" -#include "hbusrrdd.ch" -#include "fileio.ch" #include "dbinfo.ch" +#include "fileio.ch" +#include "hbusrrdd.ch" +#include "rddsys.ch" ANNOUNCE HSCDX @@ -63,8 +63,8 @@ ANNOUNCE HSCDX * methods: NEW and RELEASE receive pointer to work area structure * not work area number. It's necessary because the can be executed * before work area is allocated - * these methods does not have to execute SUPER methods - these is - * always done by low level USRRDD code + * these methods does not have to execute SUPER methods - this is + * always done by low-level USRRDD code */ STATIC FUNCTION _HSX_NEW( pWA ) @@ -72,7 +72,7 @@ STATIC FUNCTION _HSX_NEW( pWA ) LOCAL aWData := { .F., {}, {} } /* - * Set in our private AREA item the array where we will kepp HSX indexes + * Set in our private AREA item the array where we will keep HSX indexes * and HOT buffer flag */ @@ -102,8 +102,7 @@ STATIC FUNCTION _HSX_GOCOLD( nWA ) LOCAL nResult, aWData, nHSX, nRecNo, nKeyNo - nResult := UR_SUPER_GOCOLD( nWA ) - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_GOCOLD( nWA ) ) == HB_SUCCESS aWData := USRRDD_AREADATA( nWA ) IF aWData[ 1 ] IF ! Empty( aWData[ 2 ] ) @@ -129,8 +128,7 @@ STATIC FUNCTION _HSX_GOHOT( nWA ) LOCAL nResult, aWData - nResult := UR_SUPER_GOHOT( nWA ) - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_GOHOT( nWA ) ) == HB_SUCCESS aWData := USRRDD_AREADATA( nWA ) aWData[ 1 ] := .T. ENDIF @@ -141,8 +139,7 @@ STATIC FUNCTION _HSX_APPEND( nWA, lUnlockAll ) LOCAL nResult, aWData - nResult := UR_SUPER_APPEND( nWA, lUnlockAll ) - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_APPEND( nWA, lUnlockAll ) ) == HB_SUCCESS aWData := USRRDD_AREADATA( nWA ) aWData[ 1 ] := .T. ENDIF @@ -154,7 +151,7 @@ STATIC FUNCTION _HSX_APPEND( nWA, lUnlockAll ) * with current work are and automatically updated. */ -FUNCTION HSX_CREATE( cFile, cExpr, nKeySize, nBufSize, lCase, nFiltSet ) +FUNCTION hsx_Create( cFile, cExpr, nKeySize, nBufSize, lCase, nFiltSet ) LOCAL aWData, nHsx := -1, nOpenMode @@ -164,9 +161,7 @@ FUNCTION HSX_CREATE( cFile, cExpr, nKeySize, nBufSize, lCase, nFiltSet ) aWData := USRRDD_AREADATA( Select() ) nOpenMode := iif( dbInfo( DBI_SHARED ), 1, 0 ) + ; iif( dbInfo( DBI_ISREADONLY ), 2, 0 ) - nHsx := hs_Index( cFile, cExpr, nKeySize, nOpenMode, ; - nBufSize, lCase, nFiltSet ) - IF nHsx >= 0 + IF ( nHsx := hs_Index( cFile, cExpr, nKeySize, nOpenMode, nBufSize, lCase, nFiltSet ) ) >= 0 AAdd( aWData[ 2 ], nHsx ) AAdd( aWData[ 3 ], cFile ) ENDIF @@ -174,7 +169,7 @@ FUNCTION HSX_CREATE( cFile, cExpr, nKeySize, nBufSize, lCase, nFiltSet ) RETURN nHsx -PROCEDURE HSX_OPEN( cFile, nBufSize ) +PROCEDURE hsx_Open( cFile, nBufSize ) LOCAL aWData, nHsx, nOpenMode @@ -184,8 +179,7 @@ PROCEDURE HSX_OPEN( cFile, nBufSize ) aWData := USRRDD_AREADATA( Select() ) nOpenMode := iif( dbInfo( DBI_SHARED ), 1, 0 ) + ; iif( dbInfo( DBI_ISREADONLY ), 2, 0 ) - nHsx := hs_Open( cFile, nBufSize, nOpenMode ) - IF nHsx >= 0 + IF ( nHsx := hs_Open( cFile, nBufSize, nOpenMode ) ) >= 0 AAdd( aWData[ 2 ], nHsx ) AAdd( aWData[ 3 ], cFile ) ENDIF @@ -193,20 +187,21 @@ PROCEDURE HSX_OPEN( cFile, nBufSize ) RETURN -PROCEDURE HSX_CLOSE( xHSX ) +PROCEDURE hsx_Close( xHSX ) LOCAL aWData, nSlot IF Used() .AND. rddName() == "HSCDX" aWData := USRRDD_AREADATA( Select() ) - IF HB_ISNUMERIC( xHSX ) + DO CASE + CASE HB_ISNUMERIC( xHSX ) nSlot := AScan( aWData[ 2 ], xHSX ) - ELSEIF HB_ISSTRING( xHSX ) + CASE HB_ISSTRING( xHSX ) nSlot := AScan( aWData[ 3 ], {| _1 | _1 == xHSX } ) - ELSE + OTHERWISE nSlot := 0 - ENDIF - IF nSlot != 0 + ENDCASE + IF nSlot > 0 hb_ADel( aWData[ 2 ], nSlot, .T. ) hb_ADel( aWData[ 3 ], nSlot, .T. ) ENDIF @@ -214,7 +209,7 @@ PROCEDURE HSX_CLOSE( xHSX ) RETURN -FUNCTION HSX_HANDLE( cFile ) +FUNCTION hsx_Handle( cFile ) LOCAL aWData, nSlot @@ -222,13 +217,13 @@ FUNCTION HSX_HANDLE( cFile ) aWData := USRRDD_AREADATA( Select() ) nSlot := AScan( aWData[ 3 ], {| _1 | _1 == cFile } ) IF nSlot != 0 - RETURN aWData[ 2, nSlot ] + RETURN aWData[ 2 ][ nSlot ] ENDIF ENDIF RETURN -1 -FUNCTION HSX_FILE( nHsx ) +FUNCTION hsx_File( nHsx ) LOCAL aWData, nSlot @@ -236,20 +231,20 @@ FUNCTION HSX_FILE( nHsx ) aWData := USRRDD_AREADATA( Select() ) nSlot := AScan( aWData[ 3 ], nHsx ) IF nSlot != 0 - RETURN aWData[ 3, nSlot ] + RETURN aWData[ 3 ][ nSlot ] ENDIF ENDIF RETURN "" -FUNCTION HSX_GET( nSlot ) +FUNCTION hsx_Get( nSlot ) LOCAL aWData IF Used() .AND. rddName() == "HSCDX" aWData := USRRDD_AREADATA( Select() ) IF nSlot > 0 .AND. nSlot <= Len( aWData[ 2 ] ) - RETURN aWData[ 2, nSlot ] + RETURN aWData[ 2 ][ nSlot ] ENDIF ENDIF @@ -269,11 +264,11 @@ FUNCTION HSCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuper LOCAL cSuperRDD := "DBFCDX" /* We are inheriting from DBFCDX */ LOCAL aMyFunc[ UR_METHODCOUNT ] - aMyFunc[ UR_NEW ] := ( @_HSX_NEW() ) - aMyFunc[ UR_CLOSE ] := ( @_HSX_CLOSE() ) - aMyFunc[ UR_GOCOLD ] := ( @_HSX_GOCOLD() ) - aMyFunc[ UR_GOHOT ] := ( @_HSX_GOHOT() ) - aMyFunc[ UR_APPEND ] := ( @_HSX_APPEND() ) + aMyFunc[ UR_NEW ] := @_HSX_NEW() + aMyFunc[ UR_CLOSE ] := @_HSX_CLOSE() + aMyFunc[ UR_GOCOLD ] := @_HSX_GOCOLD() + aMyFunc[ UR_GOHOT ] := @_HSX_GOHOT() + aMyFunc[ UR_APPEND ] := @_HSX_APPEND() RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; cSuperRDD, aMyFunc, pSuperRddID ) diff --git a/src/rdd/usrrdd/rdds/logrdd.prg b/src/rdd/usrrdd/rdds/logrdd.prg index 73837cc624..781024ecf8 100644 --- a/src/rdd/usrrdd/rdds/logrdd.prg +++ b/src/rdd/usrrdd/rdds/logrdd.prg @@ -45,45 +45,43 @@ */ /* - * A simple RDD which introduce logging to file. It inheriths from + * A simple RDD which introduce logging to file. It inherits from * any existent RDD but if you write / replace / delete something * on tables it writes changes in a log file. */ -#include "rddsys.ch" -#include "hbusrrdd.ch" -#include "fileio.ch" #include "dbinfo.ch" +#include "fileio.ch" +#include "hbusrrdd.ch" +#include "rddsys.ch" -#define ARRAY_FILENAME 1 -#define ARRAY_FHANDLE 2 -#define ARRAY_TAG 3 -#define ARRAY_ACTIVE 4 -#define ARRAY_RDDNAME 5 -#define ARRAY_MSGLOGBLOCK 6 -#define ARRAY_USERLOGBLOCK 7 +#define ARRAY_FILENAME 1 +#define ARRAY_FHANDLE 2 +#define ARRAY_TAG 3 +#define ARRAY_ACTIVE 4 +#define ARRAY_RDDNAME 5 +#define ARRAY_MSGLOGBLOCK 6 +#define ARRAY_USERLOGBLOCK 7 ANNOUNCE LOGRDD -DYNAMIC HB_LOGRDDINHERIT /* To be defined at user level */ +DYNAMIC hb_LogRddInherit /* To be defined at user level */ STATIC s_nRddID := -1 STATIC FUNCTION LOGRDD_INIT( nRDD ) - LOCAL lActive, cFileName, cTag, cRDDName - /* Defaults */ - cFileName := "changes.log" - lActive := .F. - cTag := NetName() + "\" + hb_UserName() - cRDDName := hb_LogRddInherit() + LOCAL cFileName := "changes.log" + LOCAL lActive := .F. + LOCAL cTag := NetName() + "\" + hb_UserName() + LOCAL cRDDName := hb_LogRddInherit() /* Log File will be open later so user can change parameters */ /* Store data in RDD cargo */ - /* cFileName, nHandle, cTag, lActive, cRDDName, bMsgLogBlock, bUserLogBlock */ + /* cFileName, hFile, cTag, lActive, cRDDName, bMsgLogBlock, bUserLogBlock */ USRRDD_RDDDATA( nRDD, { cFileName, NIL, cTag, lActive, cRDDName, NIL, NIL } ) RETURN HB_SUCCESS @@ -105,9 +103,9 @@ STATIC FUNCTION LOGRDD_EXIT( nRDD ) STATIC FUNCTION LOGRDD_CREATE( nWA, aOpenInfo ) - LOCAL nResult := UR_SUPER_CREATE( nWA, aOpenInfo ) + LOCAL nResult - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_CREATE( nWA, aOpenInfo ) ) == HB_SUCCESS ToLog( "CREATE", nWA, aOpenInfo ) ENDIF @@ -117,9 +115,9 @@ STATIC FUNCTION LOGRDD_CREATE( nWA, aOpenInfo ) STATIC FUNCTION LOGRDD_CREATEFIELDS( nWA, aStruct ) - LOCAL nResult := UR_SUPER_CREATEFIELDS( nWA, aStruct ) + LOCAL nResult - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_CREATEFIELDS( nWA, aStruct ) ) == HB_SUCCESS ToLog( "CREATEFIELDS", nWA, aStruct ) ENDIF @@ -129,9 +127,9 @@ STATIC FUNCTION LOGRDD_CREATEFIELDS( nWA, aStruct ) STATIC FUNCTION LOGRDD_OPEN( nWA, aOpenInfo ) - LOCAL nResult := UR_SUPER_OPEN( nWA, aOpenInfo ) + LOCAL nResult - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_OPEN( nWA, aOpenInfo ) ) == HB_SUCCESS ToLog( "OPEN", nWA, aOpenInfo ) ENDIF @@ -141,11 +139,11 @@ STATIC FUNCTION LOGRDD_OPEN( nWA, aOpenInfo ) STATIC FUNCTION LOGRDD_CLOSE( nWA ) - LOCAL cFile := dbInfo( DBI_FULLPATH ) - LOCAL cAlias := Alias() - LOCAL nResult := UR_SUPER_CLOSE( nWA ) + LOCAL cFile := dbInfo( DBI_FULLPATH ) + LOCAL cAlias := Alias() + LOCAL nResult - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_CLOSE( nWA ) ) == HB_SUCCESS ToLog( "CLOSE", nWA, cFile, cAlias ) ENDIF @@ -153,9 +151,9 @@ STATIC FUNCTION LOGRDD_CLOSE( nWA ) STATIC FUNCTION LOGRDD_APPEND( nWA, lUnlockAll ) - LOCAL nResult := UR_SUPER_APPEND( nWA, lUnlockAll ) + LOCAL nResult - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_APPEND( nWA, lUnlockAll ) ) == HB_SUCCESS ToLog( "APPEND", nWA, lUnlockAll ) ENDIF @@ -163,9 +161,9 @@ STATIC FUNCTION LOGRDD_APPEND( nWA, lUnlockAll ) STATIC FUNCTION LOGRDD_DELETE( nWA ) - LOCAL nResult := UR_SUPER_DELETE( nWA ) + LOCAL nResult - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_DELETE( nWA ) ) == HB_SUCCESS ToLog( "DELETE", nWA ) ENDIF @@ -173,9 +171,9 @@ STATIC FUNCTION LOGRDD_DELETE( nWA ) STATIC FUNCTION LOGRDD_RECALL( nWA ) - LOCAL nResult := UR_SUPER_RECALL( nWA ) + LOCAL nResult - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_RECALL( nWA ) ) == HB_SUCCESS ToLog( "RECALL", nWA ) ENDIF @@ -186,9 +184,9 @@ STATIC FUNCTION LOGRDD_PUTVALUE( nWA, nField, xValue ) LOCAL xOldValue := FieldGet( nField ) LOCAL nResult := UR_SUPER_PUTVALUE( nWA, nField, xValue ) - // Log Only Changes + // Log changes only - IF !( xOldValue == xValue ) + IF ! xOldValue == xValue ToLog( "PUTVALUE", nWA, nField, xValue, xOldValue ) ENDIF @@ -196,9 +194,9 @@ STATIC FUNCTION LOGRDD_PUTVALUE( nWA, nField, xValue ) STATIC FUNCTION LOGRDD_ZAP( nWA ) - LOCAL nResult := UR_SUPER_ZAP( nWA ) + LOCAL nResult - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_ZAP( nWA ) ) == HB_SUCCESS ToLog( "ZAP", nWA ) ENDIF @@ -220,17 +218,17 @@ FUNCTION LOGRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSupe s_nRddID := nRddID - aMyFunc[ UR_INIT ] := ( @LOGRDD_INIT() ) - aMyFunc[ UR_EXIT ] := ( @LOGRDD_EXIT() ) - aMyFunc[ UR_CREATE ] := ( @LOGRDD_CREATE() ) - aMyFunc[ UR_CREATEFIELDS ] := ( @LOGRDD_CREATEFIELDS() ) - aMyFunc[ UR_OPEN ] := ( @LOGRDD_OPEN() ) - aMyFunc[ UR_CLOSE ] := ( @LOGRDD_CLOSE() ) - aMyFunc[ UR_APPEND ] := ( @LOGRDD_APPEND() ) - aMyFunc[ UR_DELETE ] := ( @LOGRDD_DELETE() ) - aMyFunc[ UR_RECALL ] := ( @LOGRDD_RECALL() ) - aMyFunc[ UR_PUTVALUE ] := ( @LOGRDD_PUTVALUE() ) - aMyFunc[ UR_ZAP ] := ( @LOGRDD_ZAP() ) + aMyFunc[ UR_INIT ] := @LOGRDD_INIT() + aMyFunc[ UR_EXIT ] := @LOGRDD_EXIT() + aMyFunc[ UR_CREATE ] := @LOGRDD_CREATE() + aMyFunc[ UR_CREATEFIELDS ] := @LOGRDD_CREATEFIELDS() + aMyFunc[ UR_OPEN ] := @LOGRDD_OPEN() + aMyFunc[ UR_CLOSE ] := @LOGRDD_CLOSE() + aMyFunc[ UR_APPEND ] := @LOGRDD_APPEND() + aMyFunc[ UR_DELETE ] := @LOGRDD_DELETE() + aMyFunc[ UR_RECALL ] := @LOGRDD_RECALL() + aMyFunc[ UR_PUTVALUE ] := @LOGRDD_PUTVALUE() + aMyFunc[ UR_ZAP ] := @LOGRDD_ZAP() RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; cSuperRDD, aMyFunc, pSuperRddID ) @@ -241,9 +239,7 @@ INIT PROCEDURE _LOGRDD_INIT() RETURN -/* -------------------------------------------------- */ -/* USER UTILITY FUNCTIONS */ -/* -------------------------------------------------- */ +/* User utility functions */ FUNCTION hb_LogRddLogFileName( cFileName ) @@ -259,7 +255,6 @@ FUNCTION hb_LogRddLogFileName( cFileName ) IF HB_ISSTRING( cFileName ) aRDDData[ ARRAY_FILENAME ] := cFileName ENDIF - ENDIF RETURN cOldFileName @@ -278,7 +273,6 @@ FUNCTION hb_LogRddTag( cTag ) IF HB_ISSTRING( cTag ) aRDDData[ ARRAY_TAG ] := cTag ENDIF - ENDIF RETURN cOldTag @@ -297,7 +291,6 @@ FUNCTION hb_LogRddActive( lActive ) IF HB_ISLOGICAL( lActive ) aRDDData[ ARRAY_ACTIVE ] := lActive ENDIF - ENDIF RETURN lOldActive @@ -316,7 +309,6 @@ FUNCTION hb_LogRddMsgLogBlock( bMsgLogBlock ) IF HB_ISEVALITEM( bMsgLogBlock ) aRDDData[ ARRAY_MSGLOGBLOCK ] := bMsgLogBlock ENDIF - ENDIF RETURN bOldMsgLogBlock @@ -335,114 +327,102 @@ FUNCTION hb_LogRddUserLogBlock( bUserLogBlock ) IF HB_ISEVALITEM( bUserLogBlock ) aRDDData[ ARRAY_USERLOGBLOCK ] := bUserLogBlock ENDIF - ENDIF RETURN bOldUserLogBlock FUNCTION hb_LogRddValueToText( uValue ) - LOCAL cType := ValType( uValue ) + LOCAL cType LOCAL cText - DO CASE - CASE cType == "C" - cText := hb_StrToExp( uValue ) - - CASE cType == "N" - cText := hb_ntos( uValue ) - - CASE cType == "D" - cText := DToS( uValue ) - cText := "0d" + iif( Empty( cText ), "00000000", cText ) - - OTHERWISE - cText := hb_ValToStr( uValue ) - ENDCASE + SWITCH cType := ValType( uValue ) + CASE "C" ; cText := hb_StrToExp( uValue ) ; EXIT + CASE "N" ; cText := hb_ntos( uValue ) ; EXIT + CASE "D" ; cText := DToS( uValue ) ; cText := "0d" + iif( Empty( cText ), "00000000", cText ) ; EXIT + OTHERWISE ; cText := hb_ValToStr( uValue ) + ENDSWITCH RETURN "[" + cType + "]>>>" + cText + "<<<" -/* -------------------------------------------------- */ -/* LOCAL UTILITY FUNCTIONS */ -/* -------------------------------------------------- */ +/* Local utility functions */ STATIC PROCEDURE OpenLogFile( nWA ) LOCAL aRDDData := USRRDD_RDDDATA( USRRDD_ID( nWA ) ) LOCAL cFileName := aRDDData[ ARRAY_FILENAME ] - LOCAL nHandle := aRDDData[ ARRAY_FHANDLE ] - LOCAL lActive := aRDDData[ ARRAY_ACTIVE ] + LOCAL hFile := aRDDData[ ARRAY_FHANDLE ] + LOCAL lActive := aRDDData[ ARRAY_ACTIVE ] - // TraceLog( "nHandle " + CStr( nHandle ) ) +#if 0 + TraceLog( "hFile " + CStr( hFile ) ) +#endif - IF lActive .AND. nHandle == NIL + IF lActive .AND. hFile == NIL /* Open Access Log File */ IF hb_FileExists( cFileName ) - nHandle := FOpen( cFileName, FO_READWRITE + FO_SHARED ) + hFile := FOpen( cFileName, FO_READWRITE + FO_SHARED ) ELSE - nHandle := FCreate( cFileName ) + hFile := FCreate( cFileName ) /* Close and reopen in shared mode */ - IF FError() == 0 .AND. nHandle != F_ERROR - FClose( nHandle ) - nHandle := FOpen( cFileName, FO_READWRITE + FO_SHARED ) + IF FError() == 0 .AND. hFile != F_ERROR + FClose( hFile ) + hFile := FOpen( cFileName, FO_READWRITE + FO_SHARED ) ENDIF ENDIF - IF FError() == 0 .AND. nHandle != F_ERROR + IF FError() == 0 .AND. hFile != F_ERROR /* Move to end of file */ - FSeek( nHandle, 0, FS_END ) + FSeek( hFile, 0, FS_END ) ELSE - nHandle := NIL + hFile := NIL ENDIF - aRDDData[ ARRAY_FHANDLE ] := nHandle - + aRDDData[ ARRAY_FHANDLE ] := hFile ENDIF RETURN STATIC FUNCTION ToString( cCmd, nWA, xPar1, xPar2, xPar3 ) - LOCAL cString - - DO CASE - CASE cCmd == "CREATE" - // Parameters received: xPar1 = aOpenInfo - cString := xPar1[ UR_OI_NAME ] - CASE cCmd == "CREATEFIELDS" - // Parameters received: xPar1 = aStruct - cString := hb_ValToExp( xPar1 ) - CASE cCmd == "OPEN" - // Parameters received: xPar1 = aOpenInfo - cString := 'Table : "' + xPar1[ UR_OI_NAME ] + '", Alias : "' + Alias() + '", WorkArea : ' + hb_ntos( nWA ) - CASE cCmd == "CLOSE" - // Parameters received: xPar1 = cTableName, xPar2 = cAlias - cString := 'Table : "' + xPar1 + '", Alias : "' + xPar2 + '", WorkArea : ' + hb_ntos( nWA ) - CASE cCmd == "APPEND" - // Parameters received: xPar1 = lUnlockAll - cString := Alias() + "->RecNo() = " + hb_ntos( RecNo() ) - CASE cCmd == "DELETE" + SWITCH cCmd + CASE "CREATE" + // Parameters received: xPar1: aOpenInfo + RETURN xPar1[ UR_OI_NAME ] + CASE "CREATEFIELDS" + // Parameters received: xPar1: aStruct + RETURN hb_ValToExp( xPar1 ) + CASE "OPEN" + // Parameters received: xPar1: aOpenInfo + RETURN 'Table: "' + xPar1[ UR_OI_NAME ] + '", Alias: "' + Alias() + '", WorkArea: ' + hb_ntos( nWA ) + CASE "CLOSE" + // Parameters received: xPar1: cTableName, xPar2: cAlias + RETURN 'Table: "' + xPar1 + '", Alias: "' + xPar2 + '", WorkArea: ' + hb_ntos( nWA ) + CASE "APPEND" + // Parameters received: xPar1: lUnlockAll + RETURN Alias() + "->RecNo() == " + hb_ntos( RecNo() ) + CASE "DELETE" // Parameters received: none - cString := Alias() + "->RecNo() = " + hb_ntos( RecNo() ) - CASE cCmd == "RECALL" + RETURN Alias() + "->RecNo() == " + hb_ntos( RecNo() ) + CASE "RECALL" // Parameters received: none - cString := Alias() + "->RecNo() = " + hb_ntos( RecNo() ) - CASE cCmd == "PUTVALUE" - // Parameters received: xPar1 = nField, xPar2 = xValue, xPar3 = xOldValue + RETURN Alias() + "->RecNo() == " + hb_ntos( RecNo() ) + CASE "PUTVALUE" + // Parameters received: xPar1: nField, xPar2: xValue, xPar3: xOldValue HB_SYMBOL_UNUSED( xPar3 ) // Here don't log previous value - cString := Alias() + "(" + hb_ntos( RecNo() ) + ")->" + PadR( FieldName( xPar1 ), 10 ) + " := " + hb_LogRddValueToText( xPar2 ) - CASE cCmd == "ZAP" + RETURN Alias() + "(" + hb_ntos( RecNo() ) + ")->" + PadR( FieldName( xPar1 ), 10 ) + " := " + hb_LogRddValueToText( xPar2 ) + CASE "ZAP" // Parameters received: none - cString := 'Alias : "' + Alias() + ' Table : "' + dbInfo( DBI_FULLPATH ) + '"' - ENDCASE + RETURN 'Alias: "' + Alias() + ' Table: "' + dbInfo( DBI_FULLPATH ) + '"' + ENDSWITCH - RETURN cString + RETURN NIL STATIC PROCEDURE ToLog( cCmd, nWA, xPar1, xPar2, xPar3 ) LOCAL aRDDData := USRRDD_RDDDATA( USRRDD_ID( nWA ) ) LOCAL lActive := aRDDData[ ARRAY_ACTIVE ] - LOCAL nHandle, cTag, cRDDName, bMsgLogBlock, bUserLogBlock, cLog + LOCAL hFile, cTag, cRDDName, bMsgLogBlock, bUserLogBlock, cLog // Check if logging system is active @@ -455,14 +435,14 @@ STATIC PROCEDURE ToLog( cCmd, nWA, xPar1, xPar2, xPar3 ) // If not defined a User codeblock IF ! HB_ISEVALITEM( bUserLogBlock ) - nHandle := aRDDData[ ARRAY_FHANDLE ] + hFile := aRDDData[ ARRAY_FHANDLE ] // If log file is not already open I open now - IF nHandle == NIL + IF hFile == NIL OpenLogFile( nWA ) ENDIF - IF nHandle != NIL + IF hFile != NIL bMsgLogBlock := aRDDData[ ARRAY_MSGLOGBLOCK ] @@ -475,17 +455,13 @@ STATIC PROCEDURE ToLog( cCmd, nWA, xPar1, xPar2, xPar3 ) ENDIF // Log to file only if cLog is a valid string IF HB_ISSTRING( cLog ) - FWrite( nHandle, cLog + hb_eol() ) + FWrite( hFile, cLog + hb_eol() ) ENDIF ENDIF - ELSE - // Otherwise I send all to user that is responsible to log everywhere Eval( bUserLogBlock, cTag, cRDDName, cCmd, nWA, xPar1, xPar2, xPar3 ) - ENDIF - ENDIF RETURN diff --git a/src/rdd/usrrdd/rdds/rlcdx.prg b/src/rdd/usrrdd/rdds/rlcdx.prg index 1b0f3c9189..5e839df89c 100644 --- a/src/rdd/usrrdd/rdds/rlcdx.prg +++ b/src/rdd/usrrdd/rdds/rlcdx.prg @@ -46,14 +46,14 @@ /* * A simple RDD which introduce lock counters. It has full DBFCDX - * functionality from which it inherits but if you execute dbRLock(100) - * twice then you will have to also repeat call to dbRUnlock(100) to + * functionality from which it inherits but if you execute dbRLock( 100 ) + * twice then you will have to also repeat call to dbRUnlock( 100 ) to * really unlock the record 100. The same if for FLock() * This idea comes from one of messages sent by Mindaugas Kavaliauskas. */ -#include "rddsys.ch" #include "hbusrrdd.ch" +#include "rddsys.ch" ANNOUNCE RLCDX @@ -61,8 +61,8 @@ ANNOUNCE RLCDX * methods: NEW and RELEASE receive pointer to work area structure * not work area number. It's necessary because the can be executed * before work area is allocated - * these methods does not have to execute SUPER methods - these is - * always done by low level USRRDD code + * these methods does not have to execute SUPER methods - this is + * always done by low-level USRRDD code */ STATIC FUNCTION RLCDX_NEW( pWA ) @@ -86,10 +86,8 @@ STATIC FUNCTION RLCDX_LOCK( nWA, aLockInfo ) /* Convert EXCLUSIVE locks to DBLM_MULTIPLE */ IF aLockInfo[ UR_LI_METHOD ] == DBLM_EXCLUSIVE - aLockInfo[ UR_LI_METHOD ] := DBLM_MULTIPLE aLockInfo[ UR_LI_RECORD ] := RecNo() - ENDIF IF aLockInfo[ UR_LI_METHOD ] == DBLM_MULTIPLE /* RLOCK */ @@ -107,14 +105,13 @@ STATIC FUNCTION RLCDX_LOCK( nWA, aLockInfo ) IF aWData[ 1 ] > 0 aLockInfo[ UR_LI_RESULT ] := .T. RETURN HB_SUCCESS - ELSEIF ( i := AScan( aWData[ 2 ], {| x | x[ 1 ] == xRecID } ) ) != 0 - ++aWData[ 2, i, 2 ] + ELSEIF ( i := AScan( aWData[ 2 ], {| x | x[ 1 ] == xRecID } ) ) > 0 + ++aWData[ 2 ][ i ][ 2 ] aLockInfo[ UR_LI_RESULT ] := .T. RETURN HB_SUCCESS ENDIF - nResult := UR_SUPER_LOCK( nWA, aLockInfo ) - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_LOCK( nWA, aLockInfo ) ) == HB_SUCCESS IF aLockInfo[ UR_LI_RESULT ] AAdd( aWData[ 2 ], { xRecID, 1 } ) ENDIF @@ -129,8 +126,7 @@ STATIC FUNCTION RLCDX_LOCK( nWA, aLockInfo ) RETURN HB_SUCCESS ENDIF - nResult := UR_SUPER_LOCK( nWA, aLockInfo ) - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_LOCK( nWA, aLockInfo ) ) == HB_SUCCESS /* FLOCK always first remove all RLOCKs, even if it fails */ ASize( aWData[ 2 ], 0 ) @@ -153,8 +149,8 @@ STATIC FUNCTION RLCDX_UNLOCK( nWA, xRecID ) LOCAL aWData := USRRDD_AREADATA( nWA ), i IF HB_ISNUMERIC( xRecID ) .AND. xRecID > 0 - IF ( i := AScan( aWData[ 2 ], {| x | x[ 1 ] == xRecID } ) ) != 0 - IF --aWData[ 2, i, 2 ] > 0 + IF ( i := AScan( aWData[ 2 ], {| x | x[ 1 ] == xRecID } ) ) > 0 + IF --aWData[ 2 ][ i ][ 2 ] > 0 RETURN HB_SUCCESS ENDIF hb_ADel( aWData[ 2 ], i, .T. ) @@ -180,16 +176,15 @@ STATIC FUNCTION RLCDX_APPEND( nWA, lUnlockAll ) lUnlockAll := .F. - nResult := UR_SUPER_APPEND( nWA, lUnlockAll ) - IF nResult == HB_SUCCESS + IF ( nResult := UR_SUPER_APPEND( nWA, lUnlockAll ) ) == HB_SUCCESS aWData := USRRDD_AREADATA( nWA ) IF aWData[ 1 ] == 0 xRecId := RecNo() /* Some RDDs may allow to set phantom locks with RLOCK so we should check if it's not the case and increase the counter when it is */ - IF ( i := AScan( aWData[ 2 ], {| x | x[ 1 ] == xRecID } ) ) != 0 - ++aWData[ 2, i, 2 ] + IF ( i := AScan( aWData[ 2 ], {| x | x[ 1 ] == xRecID } ) ) > 0 + ++aWData[ 2 ][ i ][ 2 ] ELSE AAdd( aWData[ 2 ], { xRecID, 1 } ) ENDIF @@ -212,10 +207,10 @@ FUNCTION RLCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuper LOCAL cSuperRDD := "DBFCDX" /* We are inheriting from DBFCDX */ LOCAL aMethods[ UR_METHODCOUNT ] - aMethods[ UR_NEW ] := ( @RLCDX_NEW() ) - aMethods[ UR_LOCK ] := ( @RLCDX_LOCK() ) - aMethods[ UR_UNLOCK ] := ( @RLCDX_UNLOCK() ) - aMethods[ UR_APPEND ] := ( @RLCDX_APPEND() ) + aMethods[ UR_NEW ] := @RLCDX_NEW() + aMethods[ UR_LOCK ] := @RLCDX_LOCK() + aMethods[ UR_UNLOCK ] := @RLCDX_UNLOCK() + aMethods[ UR_APPEND ] := @RLCDX_APPEND() RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; cSuperRDD, aMethods, pSuperRddID ) diff --git a/src/rdd/usrrdd/rdds/smtcdx.prg b/src/rdd/usrrdd/rdds/smtcdx.prg index 1e03806d48..7befe78a51 100644 --- a/src/rdd/usrrdd/rdds/smtcdx.prg +++ b/src/rdd/usrrdd/rdds/smtcdx.prg @@ -50,19 +50,18 @@ * set default memo type to SMT */ -#include "rddsys.ch" -#include "hbusrrdd.ch" #include "dbinfo.ch" +#include "hbusrrdd.ch" +#include "rddsys.ch" /* Force linking DBFCDX and DBFFPT from which our RDD inherits */ REQUEST DBFCDX REQUEST DBFFPT -/* Announce our RDD for forign REQUESTs */ +/* Announce our RDD for foreign REQUESTs */ ANNOUNCE SMTCDX FUNCTION SMTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) - RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; "DBFCDX", {}, pSuperRddID ) /* We are inheriting from DBFCDX */ diff --git a/src/rdd/usrrdd/rdds/vfpcdx.prg b/src/rdd/usrrdd/rdds/vfpcdx.prg index f9dfa6df1e..c1c4706bbb 100644 --- a/src/rdd/usrrdd/rdds/vfpcdx.prg +++ b/src/rdd/usrrdd/rdds/vfpcdx.prg @@ -44,9 +44,9 @@ * */ -#include "rddsys.ch" #include "dbinfo.ch" #include "hbusrrdd.ch" +#include "rddsys.ch" /* Force linking DBFCDX from which our RDD inherits */ REQUEST DBFCDX @@ -54,10 +54,8 @@ REQUEST DBFFPT ANNOUNCE VFPCDX +/* We are inheriting from DBFCDX */ FUNCTION VFPCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) - - /* We are inheriting from DBFCDX */ - RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, "DBFCDX", {}, pSuperRddID ) INIT PROCEDURE VFPCDX_INIT()