From 5a2a287752bfffefea112e55c390398568dbb8fa Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 8 Sep 2017 16:25:13 +0000 Subject: [PATCH] 2017-09-08 16:00 UTC Viktor Szakats (vszakats users.noreply.github.com) * * * partial sync with the 3.4 fork codebase. These are the things synces for the most part: - copyright headers - grammar/typos in comments and some readmes - comment/whitespace/decorations - variable scoping in C files - DO CASE/SWITCH and some other alternate syntax usage - minimal amount of human readable text in strings - minor code updates - HB_TRACE() void * casts for pointers and few other changes to avoid C compiler warnings - various other, minor code cleanups - only Harbour/C code/headers were touched in src, utils, contrib, include. No 3rd party code, no make files, and with just a few exceptions, no 'tests' code was touched. - certain components were not touched were 3.4 diverged too much already, like f.e. hbmk2, hbssl, hbcurl, hbexpat - the goal was that no actual program logic should be altered by these changes. Except some possible minor exceptions, any such change is probably a bug in this patch. It's a massive patch, if you find anything broken after it, please open an Issue with the details. Build test was done on macOS. The goal is make it easier to see what actual code/logic was changed in 3.4 compared to 3.2 and to make patches easier to apply in both ways. --- ChangeLog.txt | 28 ++ contrib/gtqtc/gtqtc.h | 19 +- contrib/gtqtc/gtqtc1.cpp | 106 ++--- contrib/gtwvg/3state.prg | 12 +- contrib/gtwvg/activex.prg | 14 +- contrib/gtwvg/bitmap.prg | 27 +- contrib/gtwvg/checkbox.prg | 12 +- contrib/gtwvg/class.prg | 26 +- contrib/gtwvg/combobox.prg | 18 +- contrib/gtwvg/crt.prg | 14 +- contrib/gtwvg/dataref.prg | 10 +- contrib/gtwvg/dialog.prg | 12 +- contrib/gtwvg/drawarea.prg | 12 +- contrib/gtwvg/genrc.prg | 14 +- contrib/gtwvg/gtwgu.h | 44 +- contrib/gtwvg/gtwgud.c | 123 ++---- contrib/gtwvg/gtwvg.h | 120 +++--- contrib/gtwvg/gtwvgd.c | 288 ++++++------- contrib/gtwvg/htmlview.prg | 10 +- contrib/gtwvg/listbox.prg | 12 +- contrib/gtwvg/menubar.prg | 10 +- contrib/gtwvg/mle.prg | 10 +- contrib/gtwvg/paint.prg | 17 +- contrib/gtwvg/parthdlr.prg | 10 +- contrib/gtwvg/pushbut.prg | 12 +- contrib/gtwvg/radiobut.prg | 12 +- contrib/gtwvg/scrollbr.prg | 12 +- contrib/gtwvg/sle.prg | 10 +- contrib/gtwvg/statbar.prg | 12 +- contrib/gtwvg/static.prg | 10 +- contrib/gtwvg/syswnd.prg | 10 +- contrib/gtwvg/tabpage.prg | 12 +- contrib/gtwvg/toolbar.prg | 12 +- contrib/gtwvg/treeview.prg | 12 +- contrib/gtwvg/wnd.prg | 17 +- contrib/gtwvg/wvgcore.c | 44 +- contrib/gtwvg/wvgcuig.c | 44 +- contrib/gtwvg/wvgutils.c | 16 +- contrib/gtwvg/wvgwin.c | 18 +- contrib/gtwvg/wvgwing.c | 22 +- contrib/hbamf/amf.h | 3 +- contrib/hbamf/amfdec.c | 58 ++- contrib/hbamf/amfenc.c | 89 ++-- contrib/hbamf/hbamfobj.prg | 9 +- contrib/hbamf/readme.txt | 56 ++- contrib/hbblink/blinker.prg | 2 +- contrib/hbblink/hbblink.ch | 2 +- contrib/hbbz2/core.c | 38 +- contrib/hbcairo/context.c | 35 -- contrib/hbcairo/core.c | 57 +-- contrib/hbcairo/image.c | 2 - contrib/hbcairo/paths.c | 19 - contrib/hbcairo/pattern.c | 24 +- contrib/hbcairo/pdf.c | 3 - contrib/hbcairo/png.c | 3 - contrib/hbcairo/ps.c | 5 - contrib/hbcairo/surface.c | 2 - contrib/hbcairo/text.c | 8 - contrib/hbcairo/transfor.c | 8 - contrib/hbcairo/util.c | 4 - contrib/hbcomio/comio.c | 3 +- contrib/hbct/addascii.c | 3 +- contrib/hbct/atnum.c | 1 - contrib/hbct/atrepl.c | 10 +- contrib/hbct/bitnum.c | 24 +- contrib/hbct/bitstr.c | 9 +- contrib/hbct/blank.c | 4 +- contrib/hbct/charlihb.c | 4 +- contrib/hbct/charlist.c | 1 - contrib/hbct/charmirr.c | 2 +- contrib/hbct/charmix.c | 7 +- contrib/hbct/charone.c | 12 +- contrib/hbct/charonly.c | 22 +- contrib/hbct/charop.c | 3 +- contrib/hbct/charophb.c | 10 +- contrib/hbct/charrepl.c | 3 +- contrib/hbct/charswap.c | 2 +- contrib/hbct/color.c | 3 +- contrib/hbct/count.c | 6 +- contrib/hbct/ct.ch | 3 +- contrib/hbct/ctcom.ch | 2 +- contrib/hbct/ctcom1.c | 70 +-- contrib/hbct/ctcom2.c | 24 +- contrib/hbct/ctcrypt.c | 3 + contrib/hbct/ctmath.c | 2 +- contrib/hbct/ctmath.h | 4 +- contrib/hbct/ctmath2.c | 35 +- contrib/hbct/ctnet.c | 26 +- contrib/hbct/ctrand.prg | 1 - contrib/hbct/ctstr.c | 42 +- contrib/hbct/ctstr.h | 2 +- contrib/hbct/ctstrfil.c | 5 +- contrib/hbct/cttime.prg | 2 +- contrib/hbct/ctwfunc.c | 19 +- contrib/hbct/ctwin.c | 153 +++---- contrib/hbct/cursor.c | 4 +- contrib/hbct/datetime.c | 16 +- contrib/hbct/dattime2.c | 29 +- contrib/hbct/dattime3.c | 2 +- contrib/hbct/dbftools.c | 5 +- contrib/hbct/disk.c | 31 +- contrib/hbct/dummy.c | 2 +- contrib/hbct/envparam.c | 10 +- contrib/hbct/exponent.c | 6 +- contrib/hbct/fcopy.prg | 12 +- contrib/hbct/files.c | 17 +- contrib/hbct/finan.c | 16 +- contrib/hbct/ftoc.c | 3 +- contrib/hbct/getinfo.prg | 9 +- contrib/hbct/getinput.prg | 4 +- contrib/hbct/getsecrt.prg | 10 +- contrib/hbct/justify.c | 6 +- contrib/hbct/keysave.prg | 4 +- contrib/hbct/keysec.prg | 4 +- contrib/hbct/keyset.c | 14 +- contrib/hbct/keytime.prg | 27 +- contrib/hbct/kxlat.prg | 2 +- contrib/hbct/like.c | 3 +- contrib/hbct/misc1.c | 4 +- contrib/hbct/misc3.c | 2 +- contrib/hbct/num1.c | 15 +- contrib/hbct/numat.c | 2 +- contrib/hbct/numbase.c | 3 +- contrib/hbct/pos1.c | 15 +- contrib/hbct/pos2.c | 8 +- contrib/hbct/posdiff.c | 6 +- contrib/hbct/print.c | 2 +- contrib/hbct/range.c | 12 +- contrib/hbct/relation.c | 4 +- contrib/hbct/remove.c | 10 +- contrib/hbct/replace.c | 2 +- contrib/hbct/screen1.c | 34 +- contrib/hbct/screen3.prg | 5 +- contrib/hbct/scrmark.prg | 4 +- contrib/hbct/setlast.c | 2 +- contrib/hbct/showtime.prg | 2 +- contrib/hbct/strswap.c | 4 +- contrib/hbct/tab.c | 4 +- contrib/hbct/token1.c | 2 +- contrib/hbct/token2.c | 8 +- contrib/hbct/video.c | 6 +- contrib/hbexpat/core.c | 30 +- contrib/hbexpat/internal.c | 3 + contrib/hbfbird/firebird.c | 18 +- contrib/hbfbird/readme.txt | 18 +- contrib/hbfbird/tfirebrd.prg | 78 ++-- contrib/hbformat/hbfmtcls.prg | 8 +- contrib/hbformat/utils/hbformat.prg | 7 +- contrib/hbfoxpro/dbfunc.c | 2 +- contrib/hbfoxpro/hbfoxpro.ch | 18 +- contrib/hbfoxpro/miscfunc.c | 2 +- contrib/hbfoxpro/occurs.prg | 10 +- contrib/hbfship/dbsetloc.c | 2 +- contrib/hbfship/exec.c | 4 +- contrib/hbfship/index.c | 4 +- contrib/hbfship/isbegseq.c | 2 +- contrib/hbfship/isdb.prg | 6 +- contrib/hbfship/isfunc.c | 4 +- contrib/hbfship/secondfs.c | 2 +- contrib/hbfship/stroccur.prg | 3 +- contrib/hbfship/strpeek.c | 4 +- contrib/hbfship/users.c | 2 +- contrib/hbgd/gd.ch | 16 +- contrib/hbgd/gd.prg | 2 +- contrib/hbgd/gdbar.prg | 9 +- contrib/hbgd/gdbarcod.prg | 21 +- contrib/hbgd/gdchart.prg | 3 +- contrib/hbgd/gdimage.prg | 4 +- contrib/hbgd/gdwrp.c | 29 +- contrib/hbgs/core.c | 2 +- contrib/hbgt/asciisgt.c | 5 +- contrib/hbgt/ascposgt.c | 7 +- contrib/hbgt/atdiff.c | 14 +- contrib/hbgt/bitflags.c | 2 - contrib/hbgt/chareven.c | 7 +- contrib/hbgt/charmixg.c | 7 +- contrib/hbgt/charodd.c | 7 +- contrib/hbgt/chrcount.c | 5 +- contrib/hbgt/chrfirst.c | 5 +- contrib/hbgt/chrtotal.c | 5 +- contrib/hbgt/strasint.c | 17 +- contrib/hbgt/strcount.c | 8 +- contrib/hbgt/strcspn.c | 5 +- contrib/hbgt/strdiffg.c | 14 +- contrib/hbgt/strexpan.c | 20 +- contrib/hbgt/strleft.c | 5 +- contrib/hbgt/strpbrk.c | 5 +- contrib/hbgt/strright.c | 5 +- contrib/hbhpdf/annot.c | 224 +++++----- contrib/hbhpdf/core.c | 578 +++++++++---------------- contrib/hbhpdf/enccns.c | 16 +- contrib/hbhpdf/enccnt.c | 16 +- contrib/hbhpdf/encjp.c | 16 +- contrib/hbhpdf/enckr.c | 16 +- contrib/hbhpdf/errstr.prg | 4 +- contrib/hbhpdf/font.c | 22 +- contrib/hbhpdf/fontcns.c | 16 +- contrib/hbhpdf/fontcnt.c | 16 +- contrib/hbhpdf/fontjp.c | 16 +- contrib/hbhpdf/fontkr.c | 16 +- contrib/hbhpdf/harupdf.ch | 303 ++++++------- contrib/hbhpdf/hbhpdf.h | 25 +- contrib/hbhpdf/image.c | 59 +-- contrib/hbhpdf/misc.prg | 9 +- contrib/hbhpdf/pdfa.c | 22 +- contrib/hbhpdf/tests/harupdf.prg | 286 ++++++------- contrib/hbhttpd/readme.txt | 56 +-- contrib/hbhttpd/widgets.prg | 179 ++++---- contrib/hblzf/core.c | 4 +- contrib/hbmagic/hbmagic.ch | 4 +- contrib/hbmemio/memio.c | 32 +- contrib/hbmisc/bbabble.c | 11 +- contrib/hbmisc/calldll.prg | 6 +- contrib/hbmisc/dates.c | 23 +- contrib/hbmisc/fcomma.prg | 40 +- contrib/hbmisc/hbedit.prg | 15 +- contrib/hbmisc/hbeditc.c | 631 ++++++++++++---------------- contrib/hbmisc/irm.c | 26 +- contrib/hbmisc/nconvert.prg | 8 +- contrib/hbmisc/numtxten.prg | 6 +- contrib/hbmisc/numtxthu.prg | 4 +- contrib/hbmisc/numtxtru.prg | 32 +- contrib/hbmisc/spd.c | 91 ++-- contrib/hbmisc/strfmt.c | 2 +- contrib/hbmisc/stringp.prg | 7 +- contrib/hbmisc/stringsx.c | 8 +- contrib/hbmisc/twirler.prg | 8 +- contrib/hbmisc/udpds.prg | 36 +- contrib/hbmlzo/core.c | 17 +- contrib/hbmxml/core.c | 211 +++++----- contrib/hbmysql/mysql.c | 18 +- contrib/hbmysql/mysql.ch | 32 +- contrib/hbmysql/readme.txt | 37 +- contrib/hbmysql/tmysql.prg | 107 ++--- contrib/hbmzip/mzip.c | 33 +- contrib/hbmzip/readme.txt | 10 +- contrib/hbnetio/netio.h | 10 +- contrib/hbnetio/netiocli.c | 107 ++--- contrib/hbnetio/netiomt.prg | 22 +- contrib/hbnetio/netiosrv.c | 89 ++-- contrib/hbnetio/readme.txt | 70 ++- contrib/hbodbc/odbc.c | 157 +++---- contrib/hbodbc/todbc.prg | 18 +- contrib/hbpgsql/postgres.c | 5 +- contrib/hbpgsql/postgres.ch | 7 +- contrib/hbpgsql/rddcopy.c | 11 +- contrib/hbpgsql/tpostgre.prg | 14 +- contrib/hbpipeio/pipeio.c | 4 +- contrib/hbsms/sms.prg | 14 +- contrib/hbsqlit3/core.c | 178 ++++---- contrib/hbtest/hbtest.ch | 2 +- contrib/hbtip/client.prg | 6 +- contrib/hbtip/encoder.prg | 2 +- contrib/hbtip/httpcli.prg | 6 +- contrib/hbtip/mail.prg | 6 +- contrib/hbtip/mailassy.prg | 2 +- contrib/hbtip/mailsend.prg | 2 +- contrib/hbtip/mime.c | 2 +- contrib/hbtip/misc.c | 9 +- contrib/hbtip/sessid.prg | 2 +- contrib/hbtip/thtml.ch | 4 +- contrib/hbtip/thtml.prg | 7 +- contrib/hbtip/url.prg | 4 +- contrib/hbtpathy/telepath.ch | 2 +- contrib/hbtpathy/telepath.prg | 23 +- contrib/hbunix/chroot.c | 2 +- contrib/hbunix/daemon.c | 2 +- contrib/hbwin/axcore.c | 17 +- contrib/hbwin/hbolesrv.c | 27 +- contrib/hbwin/hbsim.ch | 6 +- contrib/hbwin/hbwinole.h | 12 +- contrib/hbwin/oleauto.prg | 2 +- contrib/hbwin/olecore.c | 20 +- contrib/hbwin/wapi_commctrl.c | 492 ++++++---------------- contrib/hbwin/wapi_misc.c | 28 +- contrib/hbwin/wapi_wingdi.c | 2 +- contrib/hbwin/wapi_winuser_dlg.c | 34 +- contrib/hbwin/wce_simc.c | 2 +- contrib/hbwin/win_bmp.c | 2 +- contrib/hbwin/win_dlg.c | 17 +- contrib/hbwin/win_os.prg | 11 +- contrib/hbwin/win_prn1.c | 8 +- contrib/hbwin/win_prn2.c | 2 +- contrib/hbwin/win_prn3.c | 4 +- contrib/hbwin/win_shell.c | 8 +- contrib/hbwin/win_tprn.prg | 38 +- contrib/hbxdiff/core.c | 14 +- contrib/hbxdiff/hbxdiff.ch | 12 +- contrib/hbxpp/dbcmdx.c | 4 +- contrib/hbxpp/dbdetacx.c | 2 +- contrib/hbxpp/dbfuncsx.prg | 22 +- contrib/hbxpp/dbjoinx.prg | 2 +- contrib/hbxpp/dblistx.prg | 4 +- contrib/hbxpp/dbsortx.prg | 2 +- contrib/hbxpp/dbstruxx.prg | 2 +- contrib/hbxpp/dbtotalx.prg | 2 +- contrib/hbxpp/dbupdatx.prg | 2 +- contrib/hbxpp/dll.ch | 2 +- contrib/hbxpp/dmlb.ch | 2 +- contrib/hbxpp/hbxpp.ch | 2 +- contrib/hbxpp/oemansix.c | 2 +- contrib/hbxpp/runshell.prg | 2 +- contrib/hbxpp/tbrowsex.prg | 11 +- contrib/hbxpp/tgetx.prg | 2 +- contrib/hbxpp/thfuncx.prg | 7 +- contrib/hbxpp/tthreadx.prg | 82 ++-- contrib/hbxpp/typefilx.prg | 2 +- contrib/hbxpp/wafuncx.c | 5 +- contrib/hbzebra/codabar.c | 20 +- contrib/hbzebra/code11.c | 16 +- contrib/hbzebra/code128.c | 209 +++++---- contrib/hbzebra/code39.c | 8 +- contrib/hbzebra/code93.c | 14 +- contrib/hbzebra/core.c | 8 +- contrib/hbzebra/coredraw.c | 5 +- contrib/hbzebra/datamtrx.c | 23 +- contrib/hbzebra/eanupc.c | 8 +- contrib/hbzebra/hbzebra.h | 3 + contrib/hbzebra/itf.c | 16 +- contrib/hbzebra/msi.c | 6 +- contrib/hbzebra/pdf417.c | 40 +- contrib/hbzebra/qrcode.c | 74 ++-- contrib/hbziparc/ziparc.prg | 29 +- contrib/rddads/ads.ch | 21 +- contrib/rddads/ads1.c | 298 +++++++------ contrib/rddads/adsfunc.c | 13 +- contrib/rddads/adsmgmnt.c | 163 ++++--- contrib/rddads/adsx.c | 37 +- contrib/rddads/rddads.h | 19 +- contrib/rddads/readme.txt | 22 +- contrib/rddbm/bmdbfx.c | 39 +- contrib/rddsql/hbrddsql.h | 26 +- contrib/rddsql/readme.txt | 8 +- contrib/rddsql/sqlbase.c | 20 +- contrib/rddsql/sqlmix.c | 42 +- contrib/sddfb/core.c | 38 +- contrib/sddmy/core.c | 26 +- contrib/sddoci/core.c | 17 +- contrib/sddodbc/core.c | 52 ++- contrib/sddpg/core.c | 32 +- contrib/sddsqlt3/core.c | 27 +- contrib/xhb/arrayblk.prg | 4 +- contrib/xhb/bkgtsks.c | 12 +- contrib/xhb/cgi.ch | 13 +- contrib/xhb/classex.ch | 2 +- contrib/xhb/cstruct.ch | 17 +- contrib/xhb/cstruct.prg | 60 +-- contrib/xhb/cstructc.c | 153 +------ contrib/xhb/datesxhb.c | 8 +- contrib/xhb/dirrec.prg | 8 +- contrib/xhb/dumpvar.prg | 34 +- contrib/xhb/filestat.c | 30 +- contrib/xhb/fparse.c | 47 +-- contrib/xhb/freadlin.c | 5 +- contrib/xhb/hbcommon.ch | 2 +- contrib/xhb/hbcompat.ch | 18 +- contrib/xhb/hbcomprs.prg | 32 +- contrib/xhb/hbcrypt.c | 41 +- contrib/xhb/hbctypes.ch | 48 ++- contrib/xhb/hbdll.ch | 4 +- contrib/xhb/hblog.prg | 55 ++- contrib/xhb/hblogdef.ch | 2 +- contrib/xhb/hblognet.prg | 115 ++--- contrib/xhb/hbnxs.h | 9 +- contrib/xhb/hboutdbg.c | 14 +- contrib/xhb/hbrpc.ch | 3 +- contrib/xhb/hbserv.c | 192 ++++----- contrib/xhb/hbserv.ch | 54 +-- contrib/xhb/hbserv.h | 45 +- contrib/xhb/hbstruct.ch | 2 +- contrib/xhb/hbstruct.prg | 1 - contrib/xhb/hbsyslog.c | 18 +- contrib/xhb/hbxml.c | 245 ++++------- contrib/xhb/hbxml.ch | 3 +- contrib/xhb/hbxml.h | 15 +- contrib/xhb/hjwindow.prg | 90 +--- contrib/xhb/hterrsys.prg | 24 +- contrib/xhb/htjlist.prg | 33 +- contrib/xhb/html.ch | 198 +++++---- contrib/xhb/htmlclrs.ch | 11 +- contrib/xhb/htmlform.ch | 11 +- contrib/xhb/inet.h | 2 +- contrib/xhb/regexrpl.prg | 23 +- contrib/xhb/stream.prg | 2 +- contrib/xhb/tcgi.prg | 30 +- contrib/xhb/tedit.prg | 107 ++--- contrib/xhb/trpccli.prg | 3 +- contrib/xhb/ttable.prg | 13 +- contrib/xhb/txtline.c | 19 +- contrib/xhb/win32prn.ch | 2 - contrib/xhb/wintypes.ch | 4 +- contrib/xhb/xcstr.prg | 19 +- contrib/xhb/xdbmodst.prg | 2 +- contrib/xhb/xhb.ch | 2 +- contrib/xhb/xhb.h | 2 +- contrib/xhb/xhbarr.c | 21 +- contrib/xhb/xhbarrex.c | 21 +- contrib/xhb/xhbat.c | 9 +- contrib/xhb/xhbcls.ch | 2 +- contrib/xhb/xhbcomp.prg | 5 +- contrib/xhb/xhbcopyf.c | 2 +- contrib/xhb/xhbdate.c | 4 +- contrib/xhb/xhberr.prg | 13 +- contrib/xhb/xhberrc.c | 1 - contrib/xhb/xhbfs.c | 4 +- contrib/xhb/xhbfunc.c | 16 +- contrib/xhb/xhbfunp.prg | 2 +- contrib/xhb/xhbgt.c | 4 +- contrib/xhb/xhbhash.c | 2 +- contrib/xhb/xhbhasha.c | 20 +- contrib/xhb/xhbhashp.c | 10 +- contrib/xhb/xhbi18n.c | 4 +- contrib/xhb/xhbinet.c | 4 +- contrib/xhb/xhbini.c | 4 +- contrib/xhb/xhbinkey.ch | 76 ++-- contrib/xhb/xhbkey.c | 8 +- contrib/xhb/xhbmemo.prg | 5 +- contrib/xhb/xhbmisc.prg | 4 +- contrib/xhb/xhbmsgs.c | 4 +- contrib/xhb/xhbmt.prg | 14 +- contrib/xhb/xhbmtc.c | 4 +- contrib/xhb/xhbprn.c | 2 +- contrib/xhb/xhbproc.c | 4 +- contrib/xhb/xhbregx.c | 4 +- contrib/xhb/xhbtedit.prg | 45 +- contrib/xhb/xhbtrim.c | 4 +- contrib/xhb/xhbver.ch | 68 +-- contrib/xhb/xhbver.prg | 2 +- contrib/xhb/xhwinprn.prg | 21 +- contrib/xhb/xstrdel.c | 12 +- include/achoice.ch | 18 +- include/assert.ch | 22 +- include/blob.ch | 2 +- include/clipdefs.h | 2 +- include/common.ch | 2 +- include/dbedit.ch | 14 +- include/dbinfo.ch | 136 +++--- include/error.ch | 14 +- include/fileio.ch | 37 +- include/hb.ch | 3 +- include/hb_io.h | 2 +- include/hbapi.h | 57 +-- include/hbapicom.h | 2 +- include/hbapidbg.h | 2 +- include/hbapifs.h | 42 +- include/hbapigt.h | 28 +- include/hbapiitm.h | 4 +- include/hbapirdd.h | 10 +- include/hbapistr.h | 2 +- include/hbatomic.h | 5 +- include/hbbfish.h | 14 +- include/hbcdpreg.h | 2 +- include/hbchksum.h | 2 +- include/hbclass.ch | 22 +- include/hbcomp.h | 18 +- include/hbcompdf.h | 40 +- include/hbdate.h | 6 +- include/hbdbf.h | 6 +- include/hbdebug.ch | 8 +- include/hbdefs.h | 21 +- include/hbdyn.ch | 6 +- include/hbexpra.c | 23 +- include/hbexprb.c | 33 +- include/hbextcdp.ch | 3 +- include/hbextern.ch | 3 +- include/hbextlng.ch | 5 +- include/hbfloat.h | 2 +- include/hbgfx.ch | 4 +- include/hbgfxdef.ch | 10 +- include/hbgtcore.h | 4 +- include/hbgtinfo.ch | 20 +- include/hbgtreg.h | 2 +- include/hbhash.ch | 2 +- include/hbhash.h | 2 +- include/hbhrb.ch | 2 +- include/hbiniseg.h | 3 +- include/hbinit.h | 6 +- include/hbiousr.ch | 2 +- include/hbmacro.ch | 2 +- include/hbmacro.h | 4 +- include/hbmath.ch | 10 +- include/hbmath.h | 2 +- include/hbmather.h | 22 +- include/hbmsgreg.h | 2 +- include/hboo.ch | 19 +- include/hbpcode.h | 16 +- include/hbpers.ch | 2 +- include/hbpp.h | 16 +- include/hbrddcdx.h | 46 +- include/hbrdddbf.h | 10 +- include/hbrdddel.h | 2 +- include/hbrddfpt.h | 36 +- include/hbrddnsx.h | 44 +- include/hbrddntx.h | 44 +- include/hbrddsdf.h | 2 +- include/hbregex.h | 11 +- include/hbserial.ch | 2 +- include/hbsetup.h | 69 ++- include/hbsix.ch | 36 +- include/hbsocket.ch | 6 +- include/hbsocket.h | 2 +- include/hbstack.h | 4 +- include/hbstdgen.ch | 2 +- include/hbsxdef.ch | 14 +- include/hbsxfunc.h | 2 +- include/hbtask.h | 4 +- include/hbthread.ch | 2 +- include/hbthread.h | 4 +- include/hbtrace.ch | 14 +- include/hbtrace.h | 2 +- include/hbusrrdd.ch | 3 +- include/hbvm.h | 4 +- include/hbvmpub.h | 2 +- include/hbwince.h | 2 +- include/hbwinuni.h | 2 +- include/hbwmain.c | 2 +- include/hbxvm.h | 10 +- include/hbzlib.h | 2 +- include/inkey.ch | 355 ++++++++-------- include/memoedit.ch | 30 +- include/ord.ch | 20 +- include/set.ch | 4 + include/setcurs.ch | 2 +- include/std.ch | 6 +- include/tbrowse.ch | 12 +- include/vm.api | 6 +- src/codepage/big5.c | 2 +- src/codepage/cp950.c | 2 +- src/codepage/cp_950.c | 2 +- src/codepage/cp_big5.c | 2 +- src/codepage/cp_u16le.c | 2 +- src/codepage/cp_utf8.c | 2 +- src/codepage/cpcs852.c | 3 +- src/codepage/cpcsiso.c | 3 +- src/codepage/cpcswin.c | 3 +- src/codepage/cpdeiso.c | 3 +- src/codepage/cpdewin.c | 3 +- src/codepage/cpeliso.c | 3 +- src/codepage/cpelwin.c | 3 +- src/codepage/cpes850.c | 2 +- src/codepage/cpesiso.c | 2 +- src/codepage/cpesmwin.c | 3 +- src/codepage/cpeswin.c | 3 +- src/codepage/cphr852.c | 5 +- src/codepage/cphriso.c | 5 +- src/codepage/cphrwin.c | 5 +- src/codepage/cpit437.c | 2 +- src/codepage/cpitisb.c | 3 +- src/codepage/cplt775.c | 4 +- src/codepage/cpltwin.c | 4 +- src/codepage/cppl852.c | 3 +- src/codepage/cppliso.c | 3 +- src/codepage/cpplmaz.c | 3 +- src/codepage/cpplwin.c | 3 +- src/codepage/cppt850.c | 4 +- src/codepage/cpptiso.c | 4 +- src/codepage/cpsl646.c | 3 +- src/codepage/cpsl852.c | 3 +- src/codepage/cpsliso.c | 3 +- src/codepage/cpslwin.c | 3 +- src/codepage/cpsrwin.c | 3 +- src/codepage/cpsv437c.c | 8 +- src/codepage/cpua866.c | 8 +- src/codepage/uckam.c | 2 +- src/codepage/uckoi8.c | 1 - src/codepage/uckoi8u.c | 1 - src/codepage/utf8sort.c | 2 +- src/common/expropt1.c | 57 ++- src/common/expropt2.c | 47 +-- src/common/funcid.c | 2 +- src/common/hbarch.c | 32 +- src/common/hbdate.c | 70 ++- src/common/hbffind.c | 20 +- src/common/hbfopen.c | 2 +- src/common/hbfsapi.c | 12 +- src/common/hbhash.c | 9 +- src/common/hbmem.c | 2 +- src/common/hbprintf.c | 43 +- src/common/hbstr.c | 93 ++-- src/common/hbstrbm.c | 6 +- src/common/hbtrace.c | 4 +- src/common/hbver.c | 8 +- src/common/strwild.c | 2 +- src/compiler/cmdcheck.c | 9 +- src/compiler/compi18n.c | 3 - src/compiler/complex.c | 12 +- src/compiler/expropta.c | 2 +- src/compiler/exproptb.c | 2 +- src/compiler/genc.c | 17 +- src/compiler/gencc.c | 8 +- src/compiler/genhrb.c | 11 +- src/compiler/harbour.y | 14 +- src/compiler/hbcmplib.c | 1 - src/compiler/hbcomp.c | 11 +- src/compiler/hbdbginf.c | 2 +- src/compiler/hbdead.c | 4 +- src/compiler/hbfunchk.c | 20 +- src/compiler/hbgenerr.c | 14 +- src/compiler/hbident.c | 11 +- src/compiler/hblbl.c | 4 +- src/compiler/hbmain.c | 105 +++-- src/compiler/hbopt.c | 36 +- src/compiler/hbpcode.c | 16 +- src/compiler/hbstripl.c | 2 +- src/compiler/hbusage.c | 17 +- src/compiler/ppcomp.c | 7 +- src/debug/dbgbrwsr.prg | 2 +- src/debug/dbgentry.c | 5 +- src/debug/dbghelp.prg | 11 +- src/debug/dbgmenu.prg | 4 +- src/debug/dbgtarr.prg | 6 +- src/debug/dbgthsh.prg | 6 +- src/debug/dbgtinp.prg | 20 +- src/debug/dbgtmenu.prg | 2 +- src/debug/dbgtmitm.prg | 2 +- src/debug/dbgtobj.prg | 10 +- src/debug/dbgtwin.prg | 2 +- src/debug/dbgwa.prg | 4 +- src/debug/debugger.prg | 44 +- src/debug/en.txt | 22 +- src/debug/tbrwtext.prg | 2 +- src/hbextern/hbextern.prg | 2 +- src/lang/l_de_at.c | 4 +- src/macro/macro.y | 10 +- src/macro/macro.yyc | 2 +- src/macro/macroa.c | 2 +- src/macro/macrob.c | 2 +- src/macro/macrolex.c | 2 +- src/main/harbour.c | 2 +- src/nortl/nortl.c | 16 +- src/pp/hbpp.1 | 2 +- src/pp/hbpp.c | 12 +- src/pp/ppcore.c | 54 +-- src/pp/pplib.c | 22 +- src/pp/pplib2.c | 8 +- src/rdd/dbcmd.c | 102 ++--- src/rdd/dbcmd53.c | 11 +- src/rdd/dbcmdhb.c | 2 +- src/rdd/dbdelim.prg | 1 - src/rdd/dbdetach.c | 4 +- src/rdd/dbdrop.c | 4 +- src/rdd/dbexists.c | 4 +- src/rdd/dbf1.c | 460 ++++++++++---------- src/rdd/dbfcdx/dbfcdx1.c | 179 ++++---- src/rdd/dbffpt/dbffpt1.c | 228 ++++------ src/rdd/dbfnsx/dbfnsx1.c | 196 +++++---- src/rdd/dbfntx/dbfntx1.c | 184 ++++---- src/rdd/dbjoin.prg | 7 +- src/rdd/dblist.prg | 16 +- src/rdd/dbrename.c | 4 +- src/rdd/dbsdf.prg | 5 +- src/rdd/dbsort.prg | 2 +- src/rdd/dbsql.c | 10 +- src/rdd/dbstrux.prg | 26 +- src/rdd/dbtotal.prg | 24 +- src/rdd/delim1.c | 70 +-- src/rdd/fieldhb.c | 2 +- src/rdd/hbsix/sxcompat.prg | 168 ++++---- src/rdd/hbsix/sxcompr.c | 60 ++- src/rdd/hbsix/sxdate.c | 18 +- src/rdd/hbsix/sxfname.c | 2 +- src/rdd/hbsix/sxini.prg | 4 +- src/rdd/hbsix/sxord.c | 76 ++-- src/rdd/hbsix/sxredir.c | 8 +- src/rdd/hbsix/sxsem.c | 12 +- src/rdd/hbsix/sxtrig.prg | 4 +- src/rdd/hbsix/sxutil.c | 8 +- src/rdd/hsx/cftsfunc.c | 8 +- src/rdd/hsx/hsx.c | 85 ++-- src/rdd/ordwldsk.c | 7 +- src/rdd/rddinfo.c | 2 +- src/rdd/rddshort.c | 2 +- src/rdd/sdf1.c | 67 +-- src/rdd/usrrdd/usrrdd.c | 261 ++++++------ src/rdd/wacore.c | 14 +- src/rdd/wafunc.c | 39 +- src/rdd/workarea.c | 137 +++--- src/rtl/accept.c | 13 +- src/rtl/achoice.prg | 13 +- src/rtl/alert.prg | 38 +- src/rtl/altd.prg | 11 +- src/rtl/arc4.c | 61 +-- src/rtl/at.c | 4 +- src/rtl/ati.c | 6 +- src/rtl/base64d.c | 2 +- src/rtl/browdb.prg | 15 +- src/rtl/browse.prg | 9 +- src/rtl/cdpapihb.c | 3 +- src/rtl/cdpdet.prg | 2 +- src/rtl/cdpdetc.c | 2 +- src/rtl/checkbox.prg | 2 +- src/rtl/chrasc.c | 2 +- src/rtl/chruni.c | 64 +-- src/rtl/colorind.c | 3 +- src/rtl/console.c | 38 +- src/rtl/cputime.c | 2 +- src/rtl/datec.c | 5 +- src/rtl/dates.c | 32 +- src/rtl/dateshb.c | 25 +- src/rtl/dbedit.prg | 43 +- src/rtl/defpath.c | 3 +- src/rtl/defpathu.c | 2 +- src/rtl/descend.c | 2 +- src/rtl/direct.c | 4 +- src/rtl/diskspac.c | 7 +- src/rtl/einstv52.prg | 8 +- src/rtl/einstvar.prg | 6 +- src/rtl/einstvau.prg | 2 +- src/rtl/errapi.c | 34 +- src/rtl/errapiu.c | 2 +- src/rtl/errint.c | 6 +- src/rtl/errintlo.c | 7 +- src/rtl/errsys.prg | 8 +- src/rtl/file.c | 2 +- src/rtl/filebuf.c | 29 +- src/rtl/filebufd.c | 2 +- src/rtl/filehb.c | 2 +- src/rtl/filesys.c | 125 +++--- src/rtl/fmhb.c | 2 +- src/rtl/fscopy.c | 4 +- src/rtl/fserr.c | 2 +- src/rtl/fssize.c | 9 +- src/rtl/fstemp.c | 10 +- src/rtl/gete.c | 11 +- src/rtl/getlist.prg | 2 +- src/rtl/getsys.prg | 17 +- src/rtl/gt_tpl/gt_tpl.c | 18 +- src/rtl/gtapi.c | 193 ++++----- src/rtl/gtapiu.c | 2 +- src/rtl/gtcgi/gtcgi.c | 20 +- src/rtl/gtchrmap.c | 17 +- src/rtl/gtclip.c | 2 +- src/rtl/gtcrs/gtcrs.c | 143 ++++--- src/rtl/gtcrs/gtcrs.h | 10 +- src/rtl/gtcrs/hb-charmap.def | 2 +- src/rtl/gtdos/gtdos.c | 128 +++--- src/rtl/gtgui/gtgui.c | 12 +- src/rtl/gtkbstat.c | 4 +- src/rtl/gtkeycod.c | 11 +- src/rtl/gtos2/gtos2.c | 118 +++--- src/rtl/gtpca/gtpca.c | 40 +- src/rtl/gtsln/gtsln.c | 58 +-- src/rtl/gtsln/gtsln.h | 4 +- src/rtl/gtsln/kbsln.c | 18 +- src/rtl/gtsln/keytrans.c | 18 +- src/rtl/gtsln/mousesln.c | 4 +- src/rtl/gtstd/gtstd.c | 34 +- src/rtl/gtsys.c | 12 +- src/rtl/gttone.c | 18 +- src/rtl/gttrm/gttrm.c | 146 +++---- src/rtl/gtwin/gtwin.c | 74 ++-- src/rtl/gtwvt/gtwvt.c | 125 +++--- src/rtl/gtwvt/gtwvt.h | 60 +-- src/rtl/gtxwc/gtxwc.c | 104 ++--- src/rtl/gtxwc/gtxwc.h | 17 +- src/rtl/gx.c | 11 +- src/rtl/hbadler.c | 1 - src/rtl/hbbffnc.c | 22 +- src/rtl/hbbfish.c | 14 +- src/rtl/hbbfsock.c | 2 +- src/rtl/hbcom.c | 10 +- src/rtl/hbcomhb.c | 2 +- src/rtl/hbcrc.c | 6 +- src/rtl/hbdyn.c | 10 +- src/rtl/hbfilehi.prg | 8 +- src/rtl/hbgtcore.c | 80 ++-- src/rtl/hbhex.c | 7 +- src/rtl/hbi18n1.c | 13 +- src/rtl/hbinet.c | 57 +-- src/rtl/hbini.prg | 62 +-- src/rtl/hbjson.c | 17 +- src/rtl/hblpp.c | 27 +- src/rtl/hblpphb.c | 22 +- src/rtl/hbmd5.c | 15 +- src/rtl/hbmd5enc.c | 12 +- src/rtl/hbproces.c | 10 +- src/rtl/hbprocfn.c | 11 +- src/rtl/hbrand.c | 1 - src/rtl/hbregex.c | 16 +- src/rtl/hbregexc.c | 6 +- src/rtl/hbrunfun.c | 4 +- src/rtl/hbsocket.c | 34 +- src/rtl/hbsockhb.c | 4 +- src/rtl/hbstrfmt.c | 10 +- src/rtl/hbtoken.c | 13 +- src/rtl/hbzlib.c | 14 +- src/rtl/hbzlibc.c | 2 +- src/rtl/hbzlibgz.c | 2 +- src/rtl/hbznet.c | 2 +- src/rtl/hbzsock.c | 2 +- src/rtl/idle.c | 13 +- src/rtl/inkey.c | 15 +- src/rtl/inkeyapi.c | 21 +- src/rtl/iousr.c | 8 +- src/rtl/isprint.c | 23 +- src/rtl/itemseri.c | 16 +- src/rtl/langapi.c | 6 +- src/rtl/libnamec.c | 29 +- src/rtl/listbox.prg | 51 ++- src/rtl/math.c | 110 ++--- src/rtl/memoedit.prg | 2 +- src/rtl/memofile.c | 2 +- src/rtl/memvarhb.prg | 4 +- src/rtl/menusys.prg | 16 +- src/rtl/menuto.prg | 12 +- src/rtl/minmax.c | 4 +- src/rtl/mlcfunc.c | 26 +- src/rtl/mod.c | 5 +- src/rtl/mouseapi.c | 21 +- src/rtl/mtran.c | 6 +- src/rtl/natmsg.c | 12 +- src/rtl/natmsgu.c | 14 +- src/rtl/net.c | 11 +- src/rtl/netusr.c | 10 - src/rtl/objfunc.prg | 26 +- src/rtl/philes.c | 4 +- src/rtl/profiler.prg | 89 ++-- src/rtl/pushbtn.prg | 12 +- src/rtl/radiobhb.prg | 2 +- src/rtl/radiobtn.prg | 15 +- src/rtl/radiogrp.prg | 57 +-- src/rtl/readkey.prg | 12 +- src/rtl/readvar.prg | 1 + src/rtl/round.c | 15 +- src/rtl/rtlshort.c | 2 +- src/rtl/run.c | 6 +- src/rtl/samples.c | 6 +- src/rtl/savebuff.prg | 2 +- src/rtl/scrollbr.prg | 41 +- src/rtl/setkey.c | 4 +- src/rtl/setpos.c | 17 +- src/rtl/sha1.c | 8 +- src/rtl/sha1.h | 4 +- src/rtl/sha1hmac.c | 2 +- src/rtl/sha1hmac.h | 2 +- src/rtl/sha2.c | 4 +- src/rtl/sha2hmac.c | 4 +- src/rtl/shadowu.c | 2 +- src/rtl/space.c | 2 +- src/rtl/spfiles.c | 10 +- src/rtl/strc.c | 4 +- src/rtl/strrepl.c | 2 +- src/rtl/strtoexp.c | 2 +- src/rtl/strtran.c | 3 +- src/rtl/strxor.c | 8 +- src/rtl/tbrowse.prg | 48 +-- src/rtl/tbrowsys.prg | 56 +-- src/rtl/tclass.prg | 60 ++- src/rtl/teditor.prg | 8 +- src/rtl/tmenuitm.prg | 2 +- src/rtl/tmenusys.prg | 99 ++--- src/rtl/tpersist.prg | 2 +- src/rtl/trace.c | 4 +- src/rtl/transfrm.c | 61 +-- src/rtl/treport.prg | 72 ++-- src/rtl/trim.c | 4 +- src/rtl/tscalar.prg | 53 +-- src/rtl/version.c | 1 + src/rtl/vfile.c | 76 ++-- src/rtl/xhelp.c | 2 +- src/rtl/xsavescr.c | 11 +- src/vm/arrays.c | 161 ++++--- src/vm/arrayshb.c | 2 +- src/vm/asort.c | 19 +- src/vm/classes.c | 525 +++++++++-------------- src/vm/cmdarg.c | 26 +- src/vm/codebloc.c | 53 +-- src/vm/debug.c | 24 +- src/vm/dlmalloc.c | 8 +- src/vm/dynlibhb.c | 9 +- src/vm/dynsym.c | 35 +- src/vm/estack.c | 26 +- src/vm/eval.c | 41 +- src/vm/extend.c | 34 +- src/vm/extrap.c | 35 +- src/vm/fm.c | 28 +- src/vm/garbage.c | 13 +- src/vm/harbinit.prg | 2 +- src/vm/hashes.c | 85 ++-- src/vm/hashfunc.c | 20 +- src/vm/hvm.c | 296 +++++++------ src/vm/hvmall.c | 8 +- src/vm/initexit.c | 5 - src/vm/initsymb.c | 2 +- src/vm/itemapi.c | 233 +++++----- src/vm/macro.c | 62 ++- src/vm/main.c | 2 +- src/vm/maindllh.c | 5 - src/vm/maindllp/dllext.c | 9 +- src/vm/mainstd.c | 6 +- src/vm/mainwin.c | 2 +- src/vm/memvars.c | 152 ++++--- src/vm/proc.c | 22 +- src/vm/pvaluehb.c | 4 +- src/vm/runner.c | 85 ++-- src/vm/set.c | 51 +-- src/vm/short.c | 2 +- src/vm/strapi.c | 94 ++--- src/vm/task.c | 6 +- src/vm/thread.c | 61 +-- src/vm/vm.c | 6 +- utils/hbi18n/hbi18n.prg | 34 +- utils/hbmk2/examples/plug_bis.hb | 6 +- utils/hbmk2/examples/plug_tpl.hb | 6 +- utils/hbmk2/hbmk2.hbp | 2 + utils/hbmk2/pkg_dynl.hbm | 2 + utils/hbmk2/pkg_inst.hbm | 2 + utils/hbtest/hbtest.prg | 130 +++--- utils/hbtest/rt_class.prg | 76 ++-- utils/hbtest/rt_file.prg | 7 +- utils/hbtest/rt_hvm.prg | 8 +- utils/hbtest/rt_hvma.prg | 16 +- utils/hbtest/rt_misc.prg | 18 +- utils/hbtest/rt_mt.prg | 6 +- utils/hbtest/rt_str.prg | 12 +- utils/hbtest/rt_trans.prg | 32 +- 916 files changed, 10432 insertions(+), 13266 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5e7c2ea839..f78c1e96bd 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,34 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2017-09-08 16:00 UTC Viktor Szakats (vszakats users.noreply.github.com) + * * + * partial sync with the 3.4 fork codebase. These are the things + synces for the most part: + - copyright headers + - grammar/typos in comments and some readmes + - comment/whitespace/decorations + - variable scoping in C files + - DO CASE/SWITCH and some other alternate syntax usage + - minimal amount of human readable text in strings + - minor code updates + - HB_TRACE() void * casts for pointers and few other changes to + avoid C compiler warnings + - various other, minor code cleanups + - only Harbour/C code/headers were touched in src, utils, contrib, + include. No 3rd party code, no make files, and with just a few + exceptions, no 'tests' code was touched. + - certain components were not touched were 3.4 diverged too much + already, like f.e. hbmk2, hbssl, hbcurl, hbexpat + - the goal was that no actual program logic should be altered by + these changes. Except some possible minor exceptions, any such + change is probably a bug in this patch. + It's a massive patch, if you find anything broken after it, please + open an Issue with the details. Build test was done on macOS. + The goal is make it easier to see what actual code/logic was changed + in 3.4 compared to 3.2 and to make patches easier to apply in both + ways. + 2017-09-07 08:38 UTC Viktor Szakats (vszakats users.noreply.github.com) * contrib/hbct/charsprd.c * contrib/hbct/dattime3.c diff --git a/contrib/gtqtc/gtqtc.h b/contrib/gtqtc/gtqtc.h index 506e493063..45c1d3eddb 100644 --- a/contrib/gtqtc/gtqtc.h +++ b/contrib/gtqtc/gtqtc.h @@ -1,5 +1,6 @@ /* * QT Console + * * Copyright 2013 Przemyslaw Czerpak * Slightly based on GTQTC * Copyright 2009-2011 Pritpal Bedi @@ -15,9 +16,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -164,11 +165,11 @@ #define HB_BOXCH_SNG_V_DBL_L 0x255E /* BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE (Single Vertical double left junction) */ #define HB_BOXCH_SNG_V_DBL_R 0x2561 /* BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE (Single vertical double right junction) */ -#define HB_BOXCH_SNG_DBL_CRS 0x256A /* BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE (Single cross (double horiz) */ +#define HB_BOXCH_SNG_DBL_CRS 0x256A /* BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE (Single cross (double horizontal) */ #define HB_BOXCH_DBL_L_SNG_T 0x2553 /* BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE (Double left single top angle) */ -#define HB_BOXCH_DBL_T_SNG_D 0x2564 /* BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE (Double top signle junction down) */ +#define HB_BOXCH_DBL_T_SNG_D 0x2564 /* BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE (Double top single junction down) */ #define HB_BOXCH_DBL_R_SNG_T 0x2555 /* BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE (Double right single top angle) */ #define HB_BOXCH_DBL_L_SNG_B 0x2559 /* BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE (Double left single bottom angle) */ @@ -177,7 +178,7 @@ #define HB_BOXCH_DBL_V_SNG_R 0x2562 /* BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE (Double Vertical single left junction) */ #define HB_BOXCH_DBL_V_SNG_L 0x255F /* BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE (Double vertical single right junction) */ -#define HB_BOXCH_DBL_SNG_CRS 0x256B /* BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE (Double cross (single horiz) */ +#define HB_BOXCH_DBL_SNG_CRS 0x256B /* BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE (Double cross (single horizontal) */ #define HB_BOXCH_FULL 0x2588 /* FULL BLOCK */ #define HB_BOXCH_FULL_B 0x2584 /* LOWER HALF BLOCK */ @@ -315,7 +316,7 @@ typedef struct QBitmap * boxImage[ HB_BOXCH_TRANS_MAX ]; /* bitmaps with box drawing characters */ HB_UCHAR boxIndex[ HB_BOXCH_TRANS_COUNT ]; /* indexes to bitmap array */ - int boxCount; /* numebr of defined box characters */ + int boxCount; /* number of defined box characters */ QIcon * qIcon; /* application icon */ QString * wndTitle; /* window title */ @@ -323,8 +324,8 @@ typedef struct HB_BOOL fAltEnter; /* ALT+ENTER switch between fullscreen mode */ HB_BOOL fResizable; /* enable/disable window resizing */ HB_BOOL fResizeInc; /* enable/disable resize progression */ - HB_BOOL fMaximized; /* enter/leave mximize mode */ - HB_BOOL fMinimized; /* enter/leave mximize ( e.g. as icon in taskbar ) mode */ + HB_BOOL fMaximized; /* enter/leave maximize mode */ + HB_BOOL fMinimized; /* enter/leave maximize (e.g. as icon in TaskBar) mode */ HB_BOOL fFullScreen; /* enable/disable fullscreen mode */ HB_BOOL fSelectCopy; /* allow marking texts by mouse left button with shift */ HB_BOOL fRepaint; /* force internal image repainting */ diff --git a/contrib/gtqtc/gtqtc1.cpp b/contrib/gtqtc/gtqtc1.cpp index 3e2f27aae6..633a7fc938 100644 --- a/contrib/gtqtc/gtqtc1.cpp +++ b/contrib/gtqtc/gtqtc1.cpp @@ -1,5 +1,6 @@ /* * QT Console + * * Copyright 2013 Przemyslaw Czerpak * Slightly based on GTQTC * Copyright 2009-2011 Pritpal Bedi @@ -15,9 +16,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -75,7 +76,7 @@ static HB_GT_FUNCS SuperTable; static QApplication * s_qtapp = NULL; -/* *********************************************************************** */ +/* --- */ static void hb_gt_qtc_appFree( void * cargo ) { @@ -115,7 +116,7 @@ static PHB_ITEM hb_gt_qtc_itemPutQString( PHB_ITEM pItem, const QString * pqStr #endif } -/* *********************************************************************** */ +/* --- */ #define hb_bm_paint_begin( qBitMap ) do { \ QPainter painter( qBitMap ); \ @@ -191,7 +192,7 @@ static QBitmap * hb_gt_qtc_defineBoxChar( PHB_GTQTC pQTC, HB_USHORT usCh ) QBitmap * qBitMap = NULL; int cellx = pQTC->cellX; int celly = pQTC->cellY; - int i, y, x, yy, xx, skip, start, mod; + int i, y, x, yy, xx; QPoint pts[ 3 ]; if( usCh >= HB_BOXCH_RC_MIN && usCh <= HB_BOXCH_RC_MAX ) @@ -700,6 +701,9 @@ static QBitmap * hb_gt_qtc_defineBoxChar( PHB_GTQTC pQTC, HB_USHORT usCh ) case HB_BOXCH_FILLER1: case HB_BOXCH_FILLER2: case HB_BOXCH_FILLER3: + { + int skip, start, mod; + qBitMap = hb_gt_qtc_bitmap_char( cellx, celly ); hb_bm_paint_begin( qBitMap ); @@ -728,7 +732,7 @@ static QBitmap * hb_gt_qtc_defineBoxChar( PHB_GTQTC pQTC, HB_USHORT usCh ) hb_bm_invertrect( 0, 0, cellx, celly ); hb_bm_paint_end(); break; - + } case HB_BOXCH_ARROW_R: qBitMap = hb_gt_qtc_bitmap_char( cellx, celly ); hb_bm_paint_begin( qBitMap ); @@ -1301,7 +1305,7 @@ static void hb_gt_qtc_resetBoxCharBitmaps( PHB_GTQTC pQTC ) pQTC->boxIndex[ i ] = HB_BOXCH_TRANS_MAX; } -/* *********************************************************************** */ +/* --- */ static void hb_gt_qtc_free( PHB_GTQTC pQTC ) { @@ -1633,7 +1637,7 @@ static void hb_gt_qtc_createConsoleWindow( PHB_GTQTC pQTC ) pQTC->qWnd->update(); } -/* *********************************************************************** */ +/* --- */ static void hb_gt_qtc_InitMT( void ); @@ -1681,13 +1685,13 @@ static void hb_gt_qtc_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil HB_GTSELF_SEMICOLD( pGT ); } -/* *********************************************************************** */ +/* --- */ static void hb_gt_qtc_Exit( PHB_GT pGT ) { PHB_GTQTC pQTC; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Exit(%p)", ( void * ) pGT ) ); pQTC = HB_GTQTC_GET( pGT ); HB_GTSUPER_EXIT( pGT ); @@ -1696,13 +1700,13 @@ static void hb_gt_qtc_Exit( PHB_GT pGT ) hb_gt_qtc_free( pQTC ); } -/* *********************************************************************** */ +/* --- */ static void hb_gt_qtc_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { PHB_GTQTC pQTC; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); pQTC = HB_GTQTC_GET( pGT ); if( pQTC ) @@ -1717,13 +1721,13 @@ static void hb_gt_qtc_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) } } -/* *********************************************************************** */ +/* --- */ static void hb_gt_qtc_Refresh( PHB_GT pGT ) { PHB_GTQTC pQTC; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); @@ -1737,14 +1741,14 @@ static void hb_gt_qtc_Refresh( PHB_GT pGT ) } } -/* *********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_qtc_SetMode( PHB_GT pGT, int iRows, int iCols ) { PHB_GTQTC pQTC; HB_BOOL fResult, fCenter; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_SetMode(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_SetMode(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); pQTC = HB_GTQTC_GET( pGT ); fCenter = iRows != pQTC->iRows || iCols != pQTC->iCols; @@ -1763,11 +1767,11 @@ static HB_BOOL hb_gt_qtc_SetMode( PHB_GT pGT, int iRows, int iCols ) return fResult; } -/* *********************************************************************** */ +/* --- */ static const char * hb_gt_qtc_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1777,13 +1781,13 @@ static const char * hb_gt_qtc_Version( PHB_GT pGT, int iType ) return "Harbour Terminal: QT GUI console (QTC)"; } -/* *********************************************************************** */ +/* --- */ static int hb_gt_qtc_ReadKey( PHB_GT pGT, int iEventMask ) { PHB_GTQTC pQTC; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( iEventMask ); @@ -1805,25 +1809,25 @@ static int hb_gt_qtc_ReadKey( PHB_GT pGT, int iEventMask ) return 0; } -/* *********************************************************************** */ +/* --- */ static void hb_gt_qtc_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); HB_SYMBOL_UNUSED( dFrequency ); HB_SYMBOL_UNUSED( dDuration ); - /* TODO: add support for sth more advanced then simple system beep */ + /* TODO: add support for something more advanced then simple system beep */ QApplication::beep(); } -/* *********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_qtc_mouse_IsPresent( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_mouse_IsPresent(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_mouse_IsPresent(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1834,7 +1838,7 @@ static void hb_gt_qtc_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) { PHB_GTQTC pQTC; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_mouse_GetPos(%p,%p,%p)", pGT, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_mouse_GetPos(%p,%p,%p)", ( void * ) pGT, piRow, piCol ) ); pQTC = HB_GTQTC_GET( pGT ); *piRow = pQTC->mouseRow; @@ -1843,7 +1847,7 @@ static void hb_gt_qtc_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) static HB_BOOL hb_gt_qtc_mouse_ButtonState( PHB_GT pGT, int iButton ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_mouse_ButtonState(%p,%i)", pGT, iButton ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_mouse_ButtonState(%p,%i)", ( void * ) pGT, iButton ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1861,21 +1865,21 @@ static HB_BOOL hb_gt_qtc_mouse_ButtonState( PHB_GT pGT, int iButton ) static int hb_gt_qtc_mouse_CountButton( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_mouse_CountButton(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_mouse_CountButton(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); return 3; } -/* *********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { PHB_GTQTC pQTC; int iVal; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); pQTC = HB_GTQTC_GET( pGT ); @@ -2293,7 +2297,7 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) qImg = QImage( qStr ); } else if( hb_arrayLen( pInfo->pNewVal ) == static_cast< HB_SIZE > - ( hb_arrayGetType( pInfo->pNewVal, 4 ) & HB_IT_NUMERIC ? 4 : 3 ) && + ( ( hb_arrayGetType( pInfo->pNewVal, 4 ) & HB_IT_NUMERIC ) ? 4 : 3 ) && ( hb_arrayGetType( pInfo->pNewVal, 1 ) & ( HB_IT_POINTER | HB_IT_STRING ) ) && ( hb_arrayGetType( pInfo->pNewVal, 2 ) & HB_IT_NUMERIC ) && ( hb_arrayGetType( pInfo->pNewVal, 3 ) & HB_IT_NUMERIC ) ) @@ -2408,14 +2412,16 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static int hb_gt_qtc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) { PHB_GTQTC pQTC; - int iRet = 1, iTmp; + int iRet = 1; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", ( void * ) pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) ); pQTC = HB_GTQTC_GET( pGT ); if( pQTC->qWnd ) { + int iTmp; + switch( iType ) { case HB_GFX_MAKECOLOR: @@ -2501,11 +2507,11 @@ static int hb_gt_qtc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, return iRet; } -/* *********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_qtc_Init; pFuncTable->Exit = hb_gt_qtc_Exit; @@ -2527,7 +2533,7 @@ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) return HB_TRUE; } -/* *********************************************************************** */ +/* --- */ static const HB_GT_INIT gtInit = { HB_GT_DRVNAME( HB_GT_NAME ), hb_gt_FuncInit, @@ -2551,7 +2557,7 @@ HB_CALL_ON_STARTUP_END( _hb_startup_gt_Init_ ) #pragma data_seg() #endif -/* *********************************************************************** */ +/* --- */ QTConsole::QTConsole( PHB_GTQTC pStructQTC, QWidget *parnt ) : QWidget( parnt ) { @@ -2572,7 +2578,7 @@ QTConsole::QTConsole( PHB_GTQTC pStructQTC, QWidget *parnt ) : QWidget( parnt ) /* Qt::WA_InputMethodEnabled disables support for * national characters in few European countries - * (f.e. Polish characters with ALT in MacOSX) + * (f.e. Polish characters with ALT in macOS) * If some Asian users needs it then we will have * to enable it optionally [druzus] */ @@ -2616,7 +2622,7 @@ void QTConsole::resetWindowSize( void ) void QTConsole::setFontSize( int iFH, int iFW ) { - int iDec = 0, iDir, iHeight, iWidth, iAscent; + int iDec = 0, iHeight, iWidth, iAscent; bool bStretch = ( pQTC->fontAttribute & HB_GTI_FONTA_NOSTRETCH ) == 0; bool bMaxSize = ( pQTC->qWnd->windowState() & ( Qt::WindowMaximized | Qt::WindowFullScreen ) ) != 0; @@ -2644,6 +2650,8 @@ void QTConsole::setFontSize( int iFH, int iFW ) if( iWidth != iFW ) { + int iDir; + iDec = ( iFW * 100 ) / iWidth; if( iDec < 1 ) iDec = 1; @@ -2818,7 +2826,7 @@ void QTConsole::copySelection( void ) void QTConsole::repaintChars( const QRect & rx ) { - int iCol, iRow, iStartCol, iLen, iColor, iTextColor = 0; + int iRow, iColor, iTextColor = 0; HB_BYTE bAttr; HB_USHORT usChar; bool bClrBkg = ( pQTC->fontAttribute & HB_GTI_FONTA_CLRBKG ) != 0; @@ -2834,6 +2842,8 @@ void QTConsole::repaintChars( const QRect & rx ) for( iRow = rc.top(); iRow <= rc.bottom(); ++iRow ) { + int iCol, iStartCol, iLen; + iCol = iStartCol = rc.left(); iLen = 0; @@ -2943,7 +2953,7 @@ void QTConsole::paintEvent( QPaintEvent * evt ) if( rSel.intersects( rEvt ) ) { #if defined( HB_OS_DARWIN ) - /* RasterOp operations are not supported in MacOSX */ + /* RasterOp operations are not supported in macOS */ rEvt &= rSel; image->invertPixels(); painter.drawImage( rEvt, *image, rEvt.translated( -pQTC->marginLeft, -pQTC->marginTop ) ); @@ -2963,7 +2973,7 @@ void QTConsole::paintEvent( QPaintEvent * evt ) if( rEvt.intersects( rCrs ) ) { #if defined( HB_OS_DARWIN ) - /* RasterOp operations are not supported in MacOSX, + /* RasterOp operations are not supported in macOS, * use foreground cell color like hardware VGA cursor */ HB_BYTE bAttr; @@ -3202,7 +3212,7 @@ void QTConsole::keyReleaseEvent( QKeyEvent * evt ) void QTConsole::keyPressEvent( QKeyEvent * evt ) { int iKey = 0, iFlags = hb_gt_qtc_getKeyFlags( evt->modifiers() ), - iSize, i; + iSize; /* support for national characters */ if( ( iSize = evt->text().size() ) > 0 ) @@ -3212,6 +3222,8 @@ void QTConsole::keyPressEvent( QKeyEvent * evt ) if( iSize > 1 || ( wc >= 32 && wc != 127 ) ) { + int i; + if( ( iFlags & HB_KF_CTRL ) != 0 && ( iFlags & HB_KF_ALT ) != 0 ) /* workaround for AltGR and German keyboard */ iFlags &= ~( HB_KF_CTRL | HB_KF_ALT ); @@ -3550,7 +3562,7 @@ void QTConsole::keyPressEvent( QKeyEvent * evt ) QWidget::keyPressEvent( evt ); } -/* *********************************************************************** */ +/* --- */ QTCWindow::QTCWindow( PHB_GTQTC pQTC ) { @@ -3662,7 +3674,7 @@ void QTCWindow::setResizing( void ) } } -/* *********************************************************************** */ +/* --- */ #ifdef HB_XLIB_NEEDLOCKS @@ -3683,4 +3695,4 @@ static void hb_gt_qtc_InitMT( void ) { } #endif -/* *********************************************************************** */ +/* --- */ diff --git a/contrib/gtwvg/3state.prg b/contrib/gtwvg/3state.prg index 136c66a719..d41333f75f 100644 --- a/contrib/gtwvg/3state.prg +++ b/contrib/gtwvg/3state.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbp3State Compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbp3State Compatible Class - * - * Pritpal Bedi - * 07Dec2008 */ #include "hbclass.ch" @@ -66,7 +60,7 @@ #xtranslate hb_traceLog( [] ) => #endif -CREATE CLASS Wvg3State INHERIT WvgWindow, WvgDataRef +CREATE CLASS Wvg3State INHERIT WvgWindow, WvgDataRef VAR autosize INIT .F. VAR caption INIT "" diff --git a/contrib/gtwvg/activex.prg b/contrib/gtwvg/activex.prg index d5951e863a..221bdf7dda 100644 --- a/contrib/gtwvg/activex.prg +++ b/contrib/gtwvg/activex.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ Compatible xbpActiveXControl Class * * Copyright 2008 Andy Wos * Copyright 2008-2012 Pritpal Bedi @@ -45,14 +45,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ Compatible xbpActiveXControl Class - * - * Pritpal Bedi - * 08Nov2008 */ #include "hbclass.ch" @@ -67,7 +61,7 @@ #xtranslate hb_traceLog( [] ) => #endif -CREATE CLASS WvgActiveXControl FROM WvgWindow +CREATE CLASS WvgActiveXControl INHERIT WvgWindow VAR oOLE VAR CLSID INIT "" @@ -107,7 +101,7 @@ CREATE CLASS WvgActiveXControl FROM WvgWindow METHOD mouseMove() METHOD activate() - ERROR HANDLER OnError + ERROR HANDLER OnError() ENDCLASS diff --git a/contrib/gtwvg/bitmap.prg b/contrib/gtwvg/bitmap.prg index 40fbdf85f9..03ce614f56 100644 --- a/contrib/gtwvg/bitmap.prg +++ b/contrib/gtwvg/bitmap.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpBitmap compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpBitmap compatible Class - * - * Pritpal Bedi - * 06Dec2008 */ #include "hbclass.ch" @@ -64,12 +58,12 @@ CREATE CLASS WvgBitmap - VAR bits INIT 0 READONLY - VAR bufferOffset INIT 0 READONLY - VAR planes INIT 0 READONLY + VAR bits INIT 0 READONLY + VAR bufferOffset INIT 0 READONLY + VAR planes INIT 0 READONLY VAR transparentClr INIT 0 - VAR xSize INIT 0 READONLY - VAR ySize INIT 0 READONLY + VAR xSize INIT 0 READONLY + VAR ySize INIT 0 READONLY VAR hBitmap VAR hDCcompat @@ -94,11 +88,10 @@ CREATE CLASS WvgBitmap ENDCLASS -METHOD new() CLASS WvgBitmap - +METHOD WvgBitmap:new() RETURN Self -METHOD create( oPScompat ) CLASS WvgBitmap +METHOD WvgBitmap:create( oPScompat ) IF oPScompat == NIL ::hDCComp := Wvg_GetDC() @@ -109,7 +102,7 @@ METHOD create( oPScompat ) CLASS WvgBitmap RETURN Self -METHOD destroy() CLASS WvgBitmap +METHOD WvgBitmap:destroy() IF ::hBitmap != nil Wvg_DeleteObject( ::hBitmap ) diff --git a/contrib/gtwvg/checkbox.prg b/contrib/gtwvg/checkbox.prg index a7d5d39656..a84e402856 100644 --- a/contrib/gtwvg/checkbox.prg +++ b/contrib/gtwvg/checkbox.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpPushButton Compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpPushButton Compatible Class - * - * Pritpal Bedi - * 05Dec2008 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgCheckBox INHERIT WvgWindow, WvgDataRef +CREATE CLASS WvgCheckBox INHERIT WvgWindow, WvgDataRef VAR autosize INIT .F. VAR caption INIT "" diff --git a/contrib/gtwvg/class.prg b/contrib/gtwvg/class.prg index 2d89e0efc3..87e5ba8cce 100644 --- a/contrib/gtwvg/class.prg +++ b/contrib/gtwvg/class.prg @@ -1,28 +1,26 @@ /* + * Wvt*Classes * - * GUI Components * Copyright 2007-2012 Pritpal Bedi * Based On: - * * Video subsystem for Windows using GUI windows instead of Console * Copyright 2003 Peter Rees * Rees Software and Systems Ltd * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -40,7 +38,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -50,12 +48,6 @@ * */ -/* - * Wvt*Classes - * 2004 - * Pritpal Bedi - */ - #include "hbclass.ch" #include "inkey.ch" #include "setcurs.ch" @@ -105,7 +97,7 @@ CREATE CLASS WvtDialog VAR oldMenuBlock VAR lGui - /* Dialog Parameters */ + /* Dialog parameters */ VAR nRows VAR nCols VAR cFont @@ -116,7 +108,7 @@ CREATE CLASS WvtDialog VAR cTitle VAR cColor - /* Objects handelling */ + /* Objects handling */ VAR aObjects INIT {} VAR oCurObj VAR oLastObj diff --git a/contrib/gtwvg/combobox.prg b/contrib/gtwvg/combobox.prg index e86cf4021f..a3bf782703 100644 --- a/contrib/gtwvg/combobox.prg +++ b/contrib/gtwvg/combobox.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpTreeView compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpTreeView compatible Class - * - * Pritpal Bedi - * 26Nov2008 */ #include "hbclass.ch" @@ -62,11 +56,11 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgComboBox INHERIT WvgWindow, WvgDataRef +CREATE CLASS WvgComboBox INHERIT WvgWindow, WvgDataRef - VAR type INIT WVGCOMBO_DROPDOWN - VAR drawMode INIT WVG_DRAW_NORMAL - VAR nCurSelected INIT 0 + VAR type INIT WVGCOMBO_DROPDOWN + VAR drawMode INIT WVG_DRAW_NORMAL + VAR nCurSelected INIT 0 VAR aInfo INIT NIL diff --git a/contrib/gtwvg/crt.prg b/contrib/gtwvg/crt.prg index c071c821ab..3ea5676b7d 100644 --- a/contrib/gtwvg/crt.prg +++ b/contrib/gtwvg/crt.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ Compatible xbpCrt Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,13 +44,9 @@ * */ -// EkOnkar -// ( The LORD is ONE ) -// -// Xbase++ Compatible xbpCrt Class -// -// Pritpal Bedi -// 08Nov2008 +/* EkOnkar + * ( The LORD is ONE ) + */ #include "hbclass.ch" #include "inkey.ch" @@ -60,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgCrt INHERIT WvgWindow, WvgPartHandler +CREATE CLASS WvgCrt INHERIT WvgWindow, WvgPartHandler VAR oMenu diff --git a/contrib/gtwvg/dataref.prg b/contrib/gtwvg/dataref.prg index 69dcd4fade..cfe8e344b7 100644 --- a/contrib/gtwvg/dataref.prg +++ b/contrib/gtwvg/dataref.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ dataRef Compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ dataRef Compatible Class - * - * Pritpal Bedi - * 06Dec2008 */ #include "hbclass.ch" diff --git a/contrib/gtwvg/dialog.prg b/contrib/gtwvg/dialog.prg index 1470409756..cddb08e20e 100644 --- a/contrib/gtwvg/dialog.prg +++ b/contrib/gtwvg/dialog.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ Compatible xbpDialog Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ Compatible xbpDialog Class - * - * Pritpal Bedi - * 17Nov2008 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgDialog FROM WvgWindow +CREATE CLASS WvgDialog INHERIT WvgWindow VAR oMenu VAR aRect diff --git a/contrib/gtwvg/drawarea.prg b/contrib/gtwvg/drawarea.prg index 180e343953..dcc96e3afd 100644 --- a/contrib/gtwvg/drawarea.prg +++ b/contrib/gtwvg/drawarea.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ WvgDialog's Helper Class * * Copyright 2009-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ WvgDialog's Helper Class - * - * Pritpal Bedi - * 15Feb2009 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgDrawingArea INHERIT WvgWindow +CREATE CLASS WvgDrawingArea INHERIT WvgWindow VAR caption INIT "" VAR clipParent INIT .T. diff --git a/contrib/gtwvg/genrc.prg b/contrib/gtwvg/genrc.prg index e9a6b51218..c27df5473a 100644 --- a/contrib/gtwvg/genrc.prg +++ b/contrib/gtwvg/genrc.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ Parts Compatible functions * * Copyright 2011 Pritpal Bedi * @@ -44,14 +44,10 @@ * */ -// EkOnkar -// ( The LORD is ONE ) -// -// Xbase++ Parts Compatible functions -// -// Pritpal Bedi -// 03Dec2011 -// +/* EkOnkar + * ( The LORD is ONE ) + */ + #include "hbclass.ch" #include "inkey.ch" #include "hbgtinfo.ch" diff --git a/contrib/gtwvg/gtwgu.h b/contrib/gtwvg/gtwgu.h index 96a281dc83..07979bf9b5 100644 --- a/contrib/gtwvg/gtwgu.h +++ b/contrib/gtwvg/gtwgu.h @@ -1,7 +1,7 @@ /* * Header File for Video subsystem for Windows using GUI windows instead of Console - * Copyright 2003 Peter Rees - * Rees Software & Systems Ltd + * + * Copyright 2003 Peter Rees Rees Software & Systems Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,8 +44,8 @@ * */ -#ifndef HB_WVT_H_ -#define HB_WVT_H_ +#ifndef HB_WGU_H_ +#define HB_WGU_H_ #define HB_GT_NAME WGU @@ -303,34 +303,34 @@ typedef struct HB_BOOL bResizable; HB_BOOL bClosable; - /* To Be Split in 2 Structures <1 GUI dynamic> <2 GUI fixed> */ + /* To Be Split in 2 Structures <1 GUI dynamic> <2 GUI fixed> */ - int rowStart; /* Holds nTop of last WM_PAINT rectangle returned by Wvt_GetPaintRect()*/ - int rowStop; /* Holds nBottom of last WM_PAINT rectangle */ - int colStart; /* Holds nLeft of last WM_PAINT rectangle */ - int colStop; /* Holds nRight of last WM_PAINT rectangle */ + int rowStart; /* Holds nTop of last WM_PAINT rectangle returned by wvt_GetPaintRect() */ + int rowStop; /* Holds nBottom of last WM_PAINT rectangle */ + int colStart; /* Holds nLeft of last WM_PAINT rectangle */ + int colStop; /* Holds nRight of last WM_PAINT rectangle */ - int iFactor; /* Transparency factor 0~255 */ + int iFactor; /* Transparency factor 0~255 */ - int LastMenuEvent; /* Last menu item selected */ - int MenuKeyEvent; /* User definable event number for windows menu command */ - HB_BOOL InvalidateWindow; /* Flag for controlling whether to use ScrollWindowEx() */ - HB_BOOL EnableShortCuts; /* Determines whether ALT key enables menu or system menu */ + int LastMenuEvent; /* Last menu item selected */ + int MenuKeyEvent; /* User definable event number for windows menu command */ + HB_BOOL InvalidateWindow; /* Flag for controlling whether to use ScrollWindowEx() */ + HB_BOOL EnableShortCuts; /* Determines whether ALT key enables menu or system menu */ HB_BOOL bPaint; HB_BOOL bGetFocus; HB_BOOL bSetFocus; HB_BOOL bKillFocus; - HINSTANCE hMSImg32; /* Handle to the loaded library msimg32.dll */ - wvtGradientFill pfnGF; /* Pointer to Address of the GradientFill function in MSImg32.dll*/ - HINSTANCE hUser32; /* Handle to the loaded library user32.dll */ - wvtSetLayeredWindowAttributes pfnLayered;/* Pointer to set Windows attribute - transparency. */ + HINSTANCE hMSImg32; /* Handle to the loaded library msimg32.dll */ + wvtGradientFill pfnGF; /* Pointer to Address of the GradientFill function in MSImg32.dll */ + HINSTANCE hUser32; /* Handle to the loaded library user32.dll */ + wvtSetLayeredWindowAttributes pfnLayered;/* Pointer to set Windows attribute - transparency. */ - PHB_GT_PARAMS pPP; /* Presentation Parameters */ + PHB_GT_PARAMS pPP; /* Presentation Parameters */ - HB_BOOL bTracking; /* To track if mouse has eneter or left the window area */ - HB_BOOL bResizing; /* To know when it is in resizing mode */ + HB_BOOL bTracking; /* To track if mouse has entered or left the window area */ + HB_BOOL bResizing; /* To know when it is in resizing mode */ int width; int height; @@ -423,4 +423,4 @@ extern void wvt_Size2ArrayEx( SIZE * siz, PHB_ITEM aSize ); HB_EXTERN_END -#endif /* HB_WVT_H_ */ +#endif /* HB_WGU_H_ */ diff --git a/contrib/gtwvg/gtwgud.c b/contrib/gtwvg/gtwgud.c index 393a02c23e..6779899fd4 100644 --- a/contrib/gtwvg/gtwgud.c +++ b/contrib/gtwvg/gtwgud.c @@ -12,29 +12,29 @@ * * Copyright 2006 Przemyslaw Czerpak * Adopted to new GT API - * - * The following parts are Copyright of the individual authors. - * - * * Copyright 1999 David G. Holm * hb_gt_Tone() - * - * See COPYING.txt for licensing terms. + * Copyright 2003-2004 Giancarlo Niccolai + * Standard xplatform GT Info system, + * Graphical object system and event system. + * GTINFO() And GTO_* implementation. + * Copyright 2004 Mauricio Abre + * Cross-GT, multi-platform Graphics API * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -52,7 +52,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -62,18 +62,6 @@ * */ -/* - * Individual authors: - * (C) 2003-2004 Giancarlo Niccolai - * Standard xplatform GT Info system, - * Graphical object system and event system. - * GTINFO() And GTO_* implementation. - * - * (C) 2004 Mauricio Abre - * Cross-GT, multiplatform Graphics API - * - */ - #include "gtwgu.h" static int s_GtId; @@ -92,7 +80,7 @@ static int s_wvtCount = 0; static const TCHAR s_szClassName[] = TEXT( "Harbour_WVGGUI_Class" ); -static const int K_Ctrl[] = +static const int s_K_Ctrl[] = { K_CTRL_A, K_CTRL_B, K_CTRL_C, K_CTRL_D, K_CTRL_E, K_CTRL_F, K_CTRL_G, K_CTRL_H, K_CTRL_I, K_CTRL_J, K_CTRL_K, K_CTRL_L, K_CTRL_M, K_CTRL_N, @@ -117,7 +105,7 @@ static void hb_gt_wvt_RegisterClass( HINSTANCE hInstance ) wndclass.hInstance = hInstance; /* wndclass.hIcon = NULL; */ wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); - wndclass.hbrBackground = NULL; /*( HBRUSH ) ( COLOR_BTNFACE + 1 ); */ + wndclass.hbrBackground = NULL; /* ( HBRUSH ) ( COLOR_BTNFACE + 1 ); */ /* wndclass.lpszMenuName = NULL; */ wndclass.lpszClassName = s_szClassName; @@ -264,13 +252,12 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) { PHB_ITEM pItem = hb_itemPutCPtr( NULL, hb_cmdargBaseProgName() ); - pWVT->lpWindowTitle = HB_ITEMGETSTR( pItem, &pWVT->hWindowTitle, NULL ); hb_itemRelease( pItem ); } pWVT->pPP = ( HB_GT_PARAMS * ) hb_xgrab( sizeof( HB_GT_PARAMS ) ); - pWVT->pPP->style = WS_THICKFRAME|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX; + pWVT->pPP->style = WS_THICKFRAME | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; pWVT->pPP->exStyle = 0; pWVT->pPP->x = 0; pWVT->pPP->y = 0; @@ -332,22 +319,19 @@ static void hb_gt_wvt_FireMenuEvent( PHB_GTWVT pWVT, int iMode, int menuIndex ) hb_gt_wvt_FireEvent( pWVT, HB_GTE_MENU, pEvParams ); } -/* - * functions for handling the input queues for the mouse and keyboard - */ +/* functions for handling the input queues for the mouse and keyboard */ static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey ) { int iPos = pWVT->keyPointerIn; if( iKey == K_MOUSEMOVE || iKey == K_NCMOUSEMOVE ) { - /* Clipper strips repeated mouse movemnt - let's do the same */ + /* Clipper strips repeated mouse movement - let's do the same */ if( pWVT->keyLast == iKey && pWVT->keyPointerIn != pWVT->keyPointerOut ) return; } - /* - * When the buffer is full new event overwrite the last one + /* When the buffer is full new event overwrite the last one * in the buffer - it's Clipper behavior, [druzus] */ pWVT->Keys[ iPos ] = pWVT->keyLast = iKey; @@ -443,7 +427,6 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L { POINT xy; SHORT keyCode = 0; - SHORT keyState; HB_SYMBOL_UNUSED( wParam ); if( ! pWVT->MouseMove && ( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ) ) @@ -491,9 +474,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L break; case WM_MOUSEMOVE: - keyState = ( SHORT ) wParam; - - switch( keyState ) + switch( ( SHORT ) wParam ) { case MK_LBUTTON: keyCode = K_MMLEFTDOWN; @@ -511,7 +492,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L if( ! pWVT->bTracking ) { TRACKMOUSEEVENT tmi; - tmi.cbSize = sizeof( TRACKMOUSEEVENT ); + tmi.cbSize = sizeof( tmi ); tmi.dwFlags = TME_LEAVE | TME_HOVER; tmi.hwndTrack = pWVT->hWnd; tmi.dwHoverTime = 1; @@ -520,8 +501,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L #endif break; case WM_MOUSEWHEEL: - keyState = HIWORD( wParam ); - keyCode = keyState > 0 ? K_MWFORWARD : K_MWBACKWARD; + keyCode = ( SHORT ) HIWORD( wParam ) > 0 ? K_MWFORWARD : K_MWBACKWARD; break; case WM_NCMOUSEMOVE: @@ -633,7 +613,7 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, { HB_BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; HB_BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; - int iScanCode = HIWORD( lParam ) & 0xFF; + int iScanCode = HIWORD( lParam ) & 0xFF; if( bCtrl && iScanCode == 76 ) /* CTRL_VK_NUMPAD5 */ hb_gt_wvt_AddCharToInputQueue( pWVT, KP_CTRL_5 ); @@ -691,8 +671,8 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, { if( bCtrl && iScanCode == 28 ) /* K_CTRL_RETURN */ hb_gt_wvt_AddCharToInputQueue( pWVT, K_CTRL_RETURN ); - else if( bCtrl && ( c >= 1 && c <= 26 ) ) /* K_CTRL_A - Z */ - hb_gt_wvt_AddCharToInputQueue( pWVT, K_Ctrl[ c - 1 ] ); + else if( bCtrl && c >= 1 && c <= 26 ) /* K_CTRL_A - K_CTRL_Z */ + hb_gt_wvt_AddCharToInputQueue( pWVT, s_K_Ctrl[ c - 1 ] ); else { switch( c ) @@ -734,8 +714,8 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, case WM_SYSCHAR: if( ! pWVT->IgnoreWM_SYSCHAR ) { - int c, iScanCode = HIWORD( lParam ) & 0xFF; - switch( iScanCode ) + int c; + switch( HIWORD( lParam ) & 0xFF ) { case 2: c = K_ALT_1; @@ -956,7 +936,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara if( lParam == WM_RBUTTONUP ) { NOTIFYICONDATA tnid; - tnid.cbSize = sizeof( NOTIFYICONDATA ); + tnid.cbSize = sizeof( tnid ); tnid.hWnd = hWnd; tnid.uID = HB_ID_NOTIFYICON; tnid.uCallbackMessage = HB_MSG_NOTIFYICON; @@ -1194,11 +1174,7 @@ static HB_BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) return HB_TRUE; } -/* ********************************************************************** */ -/* - * GT Specific Functions - */ -/* ********************************************************************** */ +/* GT Specific Functions */ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { @@ -1206,7 +1182,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil int iCmdShow; PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); if( ! hb_winmainArgGet( &hInstance, NULL, &iCmdShow ) ) { @@ -1231,13 +1207,13 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil #endif } -/* ********************************************************************** */ +/* --- */ static void hb_gt_wvt_Exit( PHB_GT pGT ) { PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Exit(%p)", ( void * ) pGT ) ); pWVT = HB_GTWVT_GET( pGT ); HB_GTSUPER_EXIT( pGT ); @@ -1246,7 +1222,7 @@ static void hb_gt_wvt_Exit( PHB_GT pGT ) hb_gt_wvt_Free( pWVT ); } -/* ********************************************************************** */ +/* --- */ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) { @@ -1254,9 +1230,9 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) int c = 0; HB_BOOL fKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); - HB_SYMBOL_UNUSED( iEventMask ); /* we ignore the eventmask! */ + HB_SYMBOL_UNUSED( iEventMask ); /* we ignore the event mask! */ pWVT = HB_GTWVT_GET( pGT ); @@ -1268,25 +1244,22 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) return fKey ? c : 0; } -/* ********************************************************************** */ /* dDuration is in 'Ticks' (18.2 per second) */ static void hb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); hb_gt_winapi_tone( dFrequency, dDuration ); } -/* ********************************************************************** */ - static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { PHB_GTWVT pWVT; int iVal; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", ( void * ) pGT, iType, pInfo ) ); pWVT = HB_GTWVT_GET( pGT ); @@ -1456,7 +1429,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } break; case HB_GTI_ICONFILE: - if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) ) + if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { HICON hIconToFree = pWVT->bIconToFree ? pWVT->hIcon : NULL; void * hImageName; @@ -1646,8 +1619,8 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_SETPOS_ROWCOL: if( pWVT->hWnd ) { - int i1 = -1; - int i2 = -1; + int i1; + int i2; RECT rect = { 0, 0, 0, 0 }; GetWindowRect( pWVT->hWnd, &rect ); @@ -1656,8 +1629,8 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( iType == HB_GTI_SETPOS_ROWCOL ) { - hb_arraySetNI( pInfo->pResult, 1, rect.top / pWVT->fontHeight ); /* Will only return approx value */ - hb_arraySetNI( pInfo->pResult, 2, rect.left / pWVT->fontWidth ); /* Will only return approx value */ + hb_arraySetNI( pInfo->pResult, 1, rect.top / pWVT->fontHeight ); /* Will only return approximate value */ + hb_arraySetNI( pInfo->pResult, 2, rect.left / pWVT->fontWidth ); /* Will only return approximate value */ } else { @@ -1666,7 +1639,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) && - ( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC ) ) + ( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC ) ) { i1 = hb_itemGetNI( pInfo->pNewVal ); i2 = hb_itemGetNI( pInfo->pNewVal2 ); @@ -1842,9 +1815,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTS_WNDSTATE: if( pWVT->hWnd ) { - int iSpec = hb_itemGetNI( pInfo->pNewVal2 ); - - switch( iSpec ) + switch( hb_itemGetNI( pInfo->pNewVal2 ) ) { case HB_GTS_WS_SETONTOP: { @@ -2013,11 +1984,11 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) return HB_TRUE; } -/* ********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_wvt_Init; pFuncTable->Exit = hb_gt_wvt_Exit; @@ -2029,8 +2000,6 @@ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) return HB_TRUE; } -/* ********************************************************************** */ +/* --- */ #include "hbgtreg.h" - -/* ********************************************************************** */ diff --git a/contrib/gtwvg/gtwvg.h b/contrib/gtwvg/gtwvg.h index 20bbd45a77..b37fd6b8e5 100644 --- a/contrib/gtwvg/gtwvg.h +++ b/contrib/gtwvg/gtwvg.h @@ -1,7 +1,7 @@ /* * Header File for Video subsystem for Windows using GUI windows instead of Console - * Copyright 2003 Peter Rees - * Rees Software & Systems Ltd + * + * Copyright 2003 Peter Rees Rees Software & Systems Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,8 +44,8 @@ * */ -#ifndef HB_WVT_H_ -#define HB_WVT_H_ +#ifndef HB_WVG_H_ +#define HB_WVG_H_ #define HB_GT_NAME WVG @@ -266,7 +266,7 @@ typedef struct _tag_GOBJS HPEN hPen; HBRUSH hBrush; #if ! defined( HB_OS_WIN_CE ) - IPicture * iPicture; + IPicture * pPicture; #endif HB_BOOL bDestroyFont; HB_BOOL bDestroyPen; @@ -297,24 +297,24 @@ typedef struct typedef struct { - HPEN penWhite; /* White pen to draw GDI elements */ - HPEN penBlack; /* Black pen to draw GDI elements */ - HPEN penWhiteDim; /* White dim pen to draw GDI elements */ - HPEN penDarkGray; /* Dark gray pen to draw GDI elements */ - HPEN penGray; /* Gray pen equivilant to Clipper White */ - HPEN penNull; /* Null pen */ - HBRUSH diagonalBrush; /* Handle to diaoganl brush to draw scrollbars */ - HBRUSH solidBrush; /* Handle to solid brush */ - HBRUSH whiteBrush; /* Wvt specific White colored brush */ + HPEN penWhite; /* White pen to draw GDI elements */ + HPEN penBlack; /* Black pen to draw GDI elements */ + HPEN penWhiteDim; /* White dim pen to draw GDI elements */ + HPEN penDarkGray; /* Dark gray pen to draw GDI elements */ + HPEN penGray; /* Gray pen equivalent to Clipper White */ + HPEN penNull; /* Null pen */ + HBRUSH diagonalBrush; /* Handle to diagonal brush to draw scrollbars */ + HBRUSH solidBrush; /* Handle to solid brush */ + HBRUSH whiteBrush; /* Wvt specific White colored brush */ #if ! defined( HB_OS_WIN_CE ) - IPicture *iPicture[ WVT_PICTURES_MAX ]; /* Array to hold the Picture Streams to avoid recurring loading and unloading */ + IPicture * pPicture[ 50 ]; /* Array to hold the Picture Streams to avoid recurring loading and unloading */ #endif - HFONT hUserFonts[ WVT_FONTS_MAX ]; /* User defined font handles */ - HPEN hUserPens[ WVT_PENS_MAX ]; /* User defined pens */ - HINSTANCE hMSImg32; /* Handle to the loaded library msimg32.dll */ - wvtGradientFill pfnGF; /* Pointer to Address of the GradientFill function in MSImg32.dll */ - HINSTANCE hUser32; /* Handle to the loaded library user32.dll */ - wvtSetLayeredWindowAttributes pfnLayered;/* Pointer to set Windows attribute - transparency. */ + HFONT hUserFonts[ 50 ]; /* User defined font handles */ + HPEN hUserPens[ 50 ]; /* User defined pens */ + HINSTANCE hMSImg32; /* Handle to the loaded library msimg32.dll */ + wvtGradientFill pfnGF; /* Pointer to Address of the GradientFill function in MSImg32.dll */ + HINSTANCE hUser32; /* Handle to the loaded library user32.dll */ + wvtSetLayeredWindowAttributes pfnLayered;/* Pointer to set Windows attribute - transparency. */ } HB_GUIDATA, * PHB_GUIDATA; @@ -332,7 +332,7 @@ typedef struct COLORREF COLORS[ 16 ]; /* colors */ HB_BOOL CaretExist; /* HB_TRUE if a caret has been created */ - HB_BOOL CaretHidden; /* HB_TRUE if a caret has been hiden */ + HB_BOOL CaretHidden; /* HB_TRUE if a caret has been hidden */ int CaretSize; /* Height of solid caret */ int CaretWidth; /* Width of solid caret */ @@ -377,7 +377,7 @@ typedef struct HB_BOOL IgnoreWM_SYSCHAR; HB_BOOL bMaximized; /* Flag is set when window has been maximized */ - HB_BOOL bBeingMarked; /* Flag to control DOS window like copy operation */ + HB_BOOL bBeingMarked; /* Flag to control CUI window like copy operation */ HB_BOOL bBeginMarked; HB_BOOL bResizable; @@ -397,21 +397,21 @@ typedef struct RECT sRectNew; RECT sRectOld; - /* To Be Split in 2 Structures <1 GUI dynamic> <2 GUI fixed> */ + /* To Be Split in 2 Structures <1 GUI dynamic> <2 GUI fixed> */ - int rowStart; /* Holds nTop of last WM_PAINT rectangle returned by Wvt_GetPaintRect()*/ - int rowStop; /* Holds nBottom of last WM_PAINT rectangle */ - int colStart; /* Holds nLeft of last WM_PAINT rectangle */ - int colStop; /* Holds nRight of last WM_PAINT rectangle */ + int rowStart; /* Holds nTop of last WM_PAINT rectangle returned by wvt_GetPaintRect() */ + int rowStop; /* Holds nBottom of last WM_PAINT rectangle */ + int colStart; /* Holds nLeft of last WM_PAINT rectangle */ + int colStop; /* Holds nRight of last WM_PAINT rectangle */ - int iFactor; /* Transparency factor 0~255 */ + int iFactor; /* Transparency factor 0~255 */ - HDC hdc; /* Handle to Windows Device Context */ + HDC hdc; /* Handle to Windows Device Context */ - int LastMenuEvent; /* Last menu item selected */ - int MenuKeyEvent; /* User definable event number for windows menu command */ - HB_BOOL InvalidateWindow; /* Flag for controlling whether to use ScrollWindowEx() */ - HB_BOOL EnableShortCuts; /* Determines whether ALT key enables menu or system menu */ + int LastMenuEvent; /* Last menu item selected */ + int MenuKeyEvent; /* User definable event number for windows menu command */ + HB_BOOL InvalidateWindow; /* Flag for controlling whether to use ScrollWindowEx() */ + HB_BOOL EnableShortCuts; /* Determines whether ALT key enables menu or system menu */ HB_BOOL bGui; HDC hGuiDC; @@ -424,51 +424,51 @@ typedef struct HB_BOOL bSetFocus; HB_BOOL bKillFocus; - PHB_DYNS pSymWVT_PAINT; /* Stores pointer to WVT_PAINT function */ - PHB_DYNS pSymWVT_SETFOCUS; /* Stores pointer to WVT_SETFOCUS function */ - PHB_DYNS pSymWVT_KILLFOCUS; /* Stores pointer to WVT_KILLFOCUS function */ - PHB_DYNS pSymWVT_MOUSE; /* Stores pointer to WVT_MOUSE function */ - PHB_DYNS pSymWVT_TIMER; /* Stores pointer to WVT_TIMER function */ + PHB_DYNS pSymWVT_PAINT; /* Stores pointer to WVT_PAINT function */ + PHB_DYNS pSymWVT_SETFOCUS; /* Stores pointer to WVT_SETFOCUS function */ + PHB_DYNS pSymWVT_KILLFOCUS; /* Stores pointer to WVT_KILLFOCUS function */ + PHB_DYNS pSymWVT_MOUSE; /* Stores pointer to WVT_MOUSE function */ + PHB_DYNS pSymWVT_TIMER; /* Stores pointer to WVT_TIMER function */ PHB_DYNS pSymWVT_KEY; - HPEN currentPen; /* Handle to current pen settable at runtime */ - HBRUSH currentBrush; /* Handle to current brush settable by runtime */ + HPEN currentPen; /* Handle to current pen settable at runtime */ + HBRUSH currentBrush; /* Handle to current brush settable by runtime */ - PHB_GUIDATA pGUI; /* GUI Data Structure */ + PHB_GUIDATA pGUI; /* GUI Data Structure */ - HMENU hPopup; /* Handle of context menu invokable with right click */ - HWND hWndTT; /* Handle to hold tooltip information */ - HB_BOOL bToolTipActive; /* Flag to set whether tooltip is active or not */ + HMENU hPopup; /* Handle of context menu invokable with right click */ + HWND hWndTT; /* Handle to hold tooltip information */ + HB_BOOL bToolTipActive; /* Flag to set whether tooltip is active or not */ - HWND hDlgModeless[ WVT_DLGML_MAX ]; /* Handle to a modeless dialog */ - PHB_ITEM pFunc[ WVT_DLGML_MAX ]; /* Function pointer for WndProc */ + HWND hDlgModeless[ WVT_DLGML_MAX ]; /* Handle to a modeless dialog */ + PHB_ITEM pFunc[ WVT_DLGML_MAX ]; /* Function pointer for WndProc */ /* TODO: pcbFunc is redundant and should be removed */ - PHB_ITEM pcbFunc[ WVT_DLGML_MAX ]; /*codeblock for WndProc */ + PHB_ITEM pcbFunc[ WVT_DLGML_MAX ]; /* codeblock for WndProc */ int iType[ WVT_DLGML_MAX ]; /* Type of Function Pointers - Function 1, Block 2, Method 3 */ - HWND hDlgModal[ WVT_DLGMD_MAX ]; /* Handle to a modeless dialog */ - PHB_ITEM pFuncModal[ WVT_DLGMD_MAX ]; /* Function pointer for WndProc */ + HWND hDlgModal[ WVT_DLGMD_MAX ]; /* Handle to a modeless dialog */ + PHB_ITEM pFuncModal[ WVT_DLGMD_MAX ]; /* Function pointer for WndProc */ /* TODO: pcbFuncModal is redundant and should be removed */ - PHB_ITEM pcbFuncModal[ WVT_DLGMD_MAX ]; /* codeblock for WndProc */ + PHB_ITEM pcbFuncModal[ WVT_DLGMD_MAX ]; /* codeblock for WndProc */ int iTypeModal[ WVT_DLGMD_MAX ]; /* Type of Function Pointers - Function 1, Block 2, Method 3 */ - PHB_GT_PARAMS pPP; /* Presentation Parameters */ + PHB_GT_PARAMS pPP; /* Presentation Parameters */ - HB_BOOL bDeferPaint; /* To create pure Windows dialogs */ - HB_BOOL bTracking; /* To track if mouse has eneter or left the window area */ + HB_BOOL bDeferPaint; /* To create pure Windows dialogs */ + HB_BOOL bTracking; /* To track if mouse has entered or left the window area */ - HB_BOOL bResizing; /* To know when it is in resizing mode */ + HB_BOOL bResizing; /* To know when it is in resizing mode */ HB_BOOL bAlreadySizing; HB_BOOL bComposited; int CloseMode; - PHB_GOBJS gObjs; /* Graphic Objects */ + PHB_GOBJS gObjs; /* Graphic Objects */ - HWND hWndParent; /* Parent Window Handle, if any */ + HWND hWndParent; /* Parent Window Handle, if any */ - PHB_ITEM pNotifierGUI; /* Notifier to Wvg*Parts if embedded into a GT Window */ + PHB_ITEM pNotifierGUI; /* Notifier to Wvg*Parts if embedded into a GT Window */ - HB_THREAD_NO threadNO; /* Will hold the current THREAD No */ + HB_THREAD_NO threadNO; /* Will hold the current THREAD No */ } HB_GTWVT, * PHB_GTWVT; @@ -609,4 +609,4 @@ extern void wvt_Size2ArrayEx( SIZE * siz, PHB_ITEM aSize ); HB_EXTERN_END -#endif /* HB_WVT_H_ */ +#endif /* HB_WVG_H_ */ diff --git a/contrib/gtwvg/gtwvgd.c b/contrib/gtwvg/gtwvgd.c index c360e70a54..1dcd4850a9 100644 --- a/contrib/gtwvg/gtwvgd.c +++ b/contrib/gtwvg/gtwvgd.c @@ -12,29 +12,29 @@ * * Copyright 2006 Przemyslaw Czerpak * Adopted to new GT API - * - * The following parts are Copyright of the individual authors. - * - * * Copyright 1999 David G. Holm * hb_gt_Tone() - * - * See COPYING.txt for licensing terms. + * Copyright 2003-2004 Giancarlo Niccolai + * Standard xplatform GT Info system, + * Graphical object system and event system. + * GTINFO() And GTO_* implementation. + * Copyright 2004 Mauricio Abre + * Cross-GT, multi-platform Graphics API * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -52,7 +52,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -62,18 +62,6 @@ * */ -/* - * Individual authors: - * (C) 2003-2004 Giancarlo Niccolai - * Standard xplatform GT Info system, - * Graphical object system and event system. - * GTINFO() And GTO_* implementation. - * - * (C) 2004 Mauricio Abre - * Cross-GT, multiplatform Graphics API - * - */ - #include "hbwinole.h" #include "gtwvg.h" @@ -107,15 +95,15 @@ static HB_CRITICAL_NEW( s_wvtMtx ); #if ( ( defined( _MSC_VER ) && ( _MSC_VER <= 1200 || defined( HB_OS_WIN_CE ) ) ) || \ defined( __DMC__ ) ) && ! defined( HB_ARCH_64BIT ) -# ifndef GetWindowLongPtr -# define GetWindowLongPtr GetWindowLong -# endif -# ifndef SetWindowLongPtr -# define SetWindowLongPtr SetWindowLong -# endif -# define HB_GTWVT_LONG_PTR LONG + #ifndef GetWindowLongPtr + #define GetWindowLongPtr GetWindowLong + #endif + #ifndef SetWindowLongPtr + #define SetWindowLongPtr SetWindowLong + #endif + #define HB_GTWVT_LONG_PTR LONG #else -# define HB_GTWVT_LONG_PTR LONG_PTR + #define HB_GTWVT_LONG_PTR LONG_PTR #endif #ifndef WS_OVERLAPPEDWINDOW @@ -280,7 +268,7 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) pWVT->pSymWVT_MOUSE = NULL; pWVT->pSymWVT_TIMER = NULL; pWVT->pSymWVT_KEY = NULL; - for( iIndex = 0; iIndex < WVT_DLGML_MAX; iIndex++ ) + for( iIndex = 0; iIndex < ( int ) HB_SIZEOFARRAY( pWVT->pFunc ); iIndex++ ) { if( pWVT->pFunc[ iIndex ] != NULL && pWVT->iType[ iIndex ] == 2 ) { @@ -322,9 +310,9 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) if( pWVT->gObjs->bBlock ) hb_itemRelease( pWVT->gObjs->bBlock ); #if ! defined( HB_OS_WIN_CE ) - if( pWVT->gObjs->iPicture ) + if( pWVT->gObjs->pPicture ) if( pWVT->gObjs->bDestroyPicture ) - HB_VTBL( pWVT->gObjs->iPicture )->Release( HB_THIS( pWVT->gObjs->iPicture ) ); + HB_VTBL( pWVT->gObjs->pPicture )->Release( HB_THIS( pWVT->gObjs->pPicture ) ); #endif hb_xfree( pWVT->gObjs ); pWVT->gObjs = gObj; @@ -440,7 +428,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) pWVT->bComposited = HB_FALSE; pWVT->pPP = ( HB_GT_PARAMS * ) hb_xgrab( sizeof( HB_GT_PARAMS ) ); - pWVT->pPP->style = WS_THICKFRAME|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX; + pWVT->pPP->style = WS_THICKFRAME | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; pWVT->pPP->exStyle = 0; pWVT->pPP->x = 0; pWVT->pPP->y = 0; @@ -503,9 +491,7 @@ static void hb_gt_wvt_FireMenuEvent( PHB_GTWVT pWVT, int iMode, int menuIndex ) hb_gt_wvt_FireEvent( pWVT, HB_GTE_MENU, pEvParams ); } -/* - * use the standard fixed oem font, unless the caller has requested set size fonts - */ +/* use the standard fixed OEM font, unless the caller has requested set size fonts */ static HFONT hb_gt_wvt_GetFont( LPCTSTR lpFace, int iHeight, int iWidth, int iWeight, int iQuality, int iCodePage ) { if( iHeight > 0 ) @@ -640,22 +626,19 @@ static void hb_gt_wvt_KillCaret( PHB_GTWVT pWVT ) } } -/* - * functions for handling the input queues for the mouse and keyboard - */ +/* functions for handling the input queues for the mouse and keyboard */ static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey ) { int iPos = pWVT->keyPointerIn; if( iKey == K_MOUSEMOVE || iKey == K_NCMOUSEMOVE ) { - /* Clipper strips repeated mouse movemnt - let's do the same */ + /* Clipper strips repeated mouse movement - let's do the same */ if( pWVT->keyLast == iKey && pWVT->keyPointerIn != pWVT->keyPointerOut ) return; } - /* - * When the buffer is full new event overwrite the last one + /* When the buffer is full new event overwrite the last one * in the buffer - it's Clipper behavior, [druzus] */ pWVT->Keys[ iPos ] = pWVT->keyLast = iKey; @@ -785,8 +768,8 @@ static HB_BOOL hb_gt_wvt_FitRows( PHB_GTWVT pWVT ) GetWindowRect( pWVT->hWnd, &wi ); - borderWidth = ( wi.right - wi.left - ( ci.right - ci.left ) ); - borderHeight = ( wi.bottom - wi.top - ( ci.bottom - ci.top ) ); + borderWidth = wi.right - wi.left - ( ci.right - ci.left ); + borderHeight = wi.bottom - wi.top - ( ci.bottom - ci.top ); if( pWVT->bMaximized ) { @@ -805,7 +788,7 @@ static HB_BOOL hb_gt_wvt_FitRows( PHB_GTWVT pWVT ) { HB_BOOL bOldCentre = pWVT->CentreWindow; pWVT->CentreWindow = pWVT->bMaximized ? HB_TRUE : HB_FALSE; - HB_GTSELF_SETMODE( pWVT->pGT, ( maxHeight / pWVT->PTEXTSIZE.y ), ( maxWidth / pWVT->PTEXTSIZE.x ) ); + HB_GTSELF_SETMODE( pWVT->pGT, maxHeight / pWVT->PTEXTSIZE.y, maxWidth / pWVT->PTEXTSIZE.x ); pWVT->CentreWindow = bOldCentre; return HB_TRUE; } @@ -824,16 +807,15 @@ static HB_BOOL hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) int top; GetClientRect( pWVT->hWnd, &ci ); - if( ! pWVT->bMaximized && ( ci.right - ci.left ) == ( pWVT->PTEXTSIZE.x * pWVT->COLS ) - && - ( ci.bottom - ci.top ) == ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + if( ! pWVT->bMaximized && ( ci.right - ci.left ) == ( pWVT->PTEXTSIZE.x * pWVT->COLS ) && + ( ci.bottom - ci.top ) == ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) { return HB_FALSE; } GetWindowRect( pWVT->hWnd, &wi ); - borderWidth = ( wi.right - wi.left - ( ci.right - ci.left ) ); - borderHeight = ( wi.bottom - wi.top - ( ci.bottom - ci.top ) ); + borderWidth = wi.right - wi.left - ( ci.right - ci.left ); + borderHeight = wi.bottom - wi.top - ( ci.bottom - ci.top ); if( pWVT->bMaximized ) { @@ -855,11 +837,9 @@ static HB_BOOL hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) } { /* Just a block */ - HFONT hOldFont; HFONT hFont; int fontHeight; int fontWidth; - int n; fontHeight = maxHeight / pWVT->ROWS; fontWidth = maxWidth / pWVT->COLS; @@ -867,6 +847,7 @@ static HB_BOOL hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) hFont = hb_gt_wvt_GetFont( pWVT->fontFace, fontHeight, fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage ); if( hFont ) { + HFONT hOldFont; HDC hdc; int width; int height; @@ -887,6 +868,8 @@ static HB_BOOL hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) tm.tmAveCharWidth >= 3 && tm.tmHeight >= 4 ) { + int n; + #if ! defined( UNICODE ) if( pWVT->hFontBox && pWVT->hFontBox != pWVT->hFont ) DeleteObject( pWVT->hFontBox ); @@ -925,11 +908,11 @@ static HB_BOOL hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) if( pWVT->bMaximized ) { - left = ( ( wi.right - width ) / 2 ); - top = ( ( wi.bottom - height ) / 2 ); + left = ( wi.right - width ) / 2; + top = ( wi.bottom - height ) / 2; - left = ( left < 0 ? 0 : left ); - top = ( top < 0 ? 0 : top ); + left = left < 0 ? 0 : left; + top = top < 0 ? 0 : top; } if( ! pWVT->bFullScreen ) @@ -1140,8 +1123,8 @@ static HB_BOOL hb_gt_wvt_SetWindowSize( PHB_GTWVT pWVT, int iRow, int iCol ) pWVT->COLS = iCol; return HB_TRUE; } - - return HB_FALSE; + else + return HB_FALSE; } static HB_BOOL hb_gt_wvt_InitWindow( PHB_GTWVT pWVT, int iRow, int iCol ) @@ -1197,9 +1180,9 @@ static RECT hb_gt_wvt_GetColRowFromXYRect( PHB_GTWVT pWVT, RECT xy ) colrow.left = xy.left / pWVT->PTEXTSIZE.x; colrow.top = xy.top / pWVT->PTEXTSIZE.y; colrow.right = xy.right / pWVT->PTEXTSIZE.x - - ( xy.right % pWVT->PTEXTSIZE.x ? 0 : 1 ); /* Adjust for when rectangle */ + ( ( xy.right % pWVT->PTEXTSIZE.x ) ? 0 : 1 ); /* Adjust for when rectangle */ colrow.bottom = xy.bottom / pWVT->PTEXTSIZE.y - - ( xy.bottom % pWVT->PTEXTSIZE.y ? 0 : 1 ); /* EXACTLY overlaps characters */ + ( ( xy.bottom % pWVT->PTEXTSIZE.y ) ? 0 : 1 ); /* EXACTLY overlaps characters */ return colrow; } @@ -1214,7 +1197,6 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L { POINT xy, colrow; SHORT keyCode = 0; - SHORT keyState; HB_SYMBOL_UNUSED( wParam ); @@ -1300,7 +1282,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L right = colrowRC.right; bottom = colrowRC.bottom; - nSize = ( ( bottom - top + 1 ) * ( right - left + 1 + 2 ) ); + nSize = ( bottom - top + 1 ) * ( right - left + 1 + 2 ); sBuffer = ( TCHAR * ) hb_xgrab( nSize * sizeof( TCHAR ) + 1 ); for( j = 0, irow = top; irow <= bottom; irow++ ) @@ -1316,7 +1298,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L #if defined( UNICODE ) usChar = hb_cdpGetU16Ctrl( usChar ); #else - usChar = hb_cdpGetUC( bAttr & HB_GT_ATTR_BOX ? cdpBox : cdpHost, usChar, '?' ); + usChar = hb_cdpGetUC( ( bAttr & HB_GT_ATTR_BOX ) ? cdpBox : cdpHost, usChar, '?' ); #endif sBuffer[ j++ ] = ( TCHAR ) usChar; } @@ -1412,9 +1394,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L } else { - keyState = ( SHORT ) wParam; - - switch( keyState ) + switch( ( SHORT ) wParam ) { case MK_LBUTTON: keyCode = K_MMLEFTDOWN; @@ -1432,7 +1412,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L { #if ! defined( HB_OS_WIN_CE ) TRACKMOUSEEVENT tmi; - tmi.cbSize = sizeof( TRACKMOUSEEVENT ); + tmi.cbSize = sizeof( tmi ); tmi.dwFlags = TME_LEAVE | TME_HOVER; tmi.hwndTrack = pWVT->hWnd; tmi.dwHoverTime = 1; @@ -1442,8 +1422,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L break; } case WM_MOUSEWHEEL: - keyState = HIWORD( wParam ); - keyCode = keyState > 0 ? K_MWFORWARD : K_MWBACKWARD; + keyCode = ( SHORT ) HIWORD( wParam ) > 0 ? K_MWFORWARD : K_MWBACKWARD; break; case WM_NCMOUSEMOVE: @@ -1563,7 +1542,7 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, { HB_BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; HB_BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; - int iScanCode = HIWORD( lParam ) & 0xFF; + int iScanCode = HIWORD( lParam ) & 0xFF; if( bCtrl && iScanCode == 76 ) /* CTRL_VK_NUMPAD5 */ hb_gt_wvt_AddCharToInputQueue( pWVT, KP_CTRL_5 ); @@ -1621,7 +1600,7 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, { if( bCtrl && iScanCode == 28 ) /* K_CTRL_RETURN */ hb_gt_wvt_AddCharToInputQueue( pWVT, K_CTRL_RETURN ); - else if( bCtrl && ( c >= 1 && c <= 26 ) ) /* K_CTRL_A - Z */ + else if( bCtrl && c >= 1 && c <= 26 ) /* K_CTRL_A - K_CTRL_Z */ hb_gt_wvt_AddCharToInputQueue( pWVT, K_Ctrl[ c - 1 ] ); else { @@ -1665,8 +1644,8 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, case WM_SYSCHAR: if( ! pWVT->IgnoreWM_SYSCHAR ) { - int c, iScanCode = HIWORD( lParam ) & 0xFF; - switch( iScanCode ) + int c; + switch( HIWORD( lParam ) & 0xFF ) { case 2: c = K_ALT_1; @@ -1801,7 +1780,7 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, } /* - * hb_gt_wvt_TextOut converts col and row to x and y ( pixels ) and calls + * Convert col and row to x and y ( pixels ) and calls * the Windows function TextOut with the expected coordinates */ static HB_BOOL hb_gt_wvt_TextOut( PHB_GTWVT pWVT, HDC hdc, int col, int row, int iColor, LPCTSTR lpString, UINT cbString ) @@ -1828,7 +1807,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) PAINTSTRUCT ps; HDC hdc; RECT rcRect; - int iRow, iCol, startCol, len; + int iRow; int iColor, iOldColor = 0; HB_BYTE bAttr; @@ -1895,6 +1874,8 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) for( iRow = rcRect.top; iRow <= rcRect.bottom; ++iRow ) { + int iCol, startCol, len; + iCol = startCol = rcRect.left; len = 0; @@ -1958,10 +1939,10 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) updateRect.right - updateRect.left, updateRect.bottom - updateRect.top, pWVT->hGuiDC, updateRect.left, updateRect.top, SRCCOPY ); - /* Paint Graphic Objects Supporting CUI Elements */ + /* Paint Graphic Objects Supporting CUI Elements */ hb_gt_wvt_PaintGObjects( pWVT, &updateRect ); - /* Tell PRG code to execute paint objects - Wvt_Draw*() */ + /* Tell PRG code to execute paint objects - wvt_Draw*() */ if( pWVT->bPaint ) { if( pWVT->pSymWVT_PAINT ) @@ -1976,9 +1957,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) } } else - { pWVT->bPaint = HB_TRUE; - } EndPaint( pWVT->hWnd, &ps ); } @@ -2093,7 +2072,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara { pWVT->bGetFocus = HB_TRUE; } - { /* For mixing gui/cui items */ + { /* For mixing GUI/CUI items */ PHB_ITEM pEvParams = hb_itemNew( NULL ); hb_arrayNew( pEvParams, 3 ); @@ -2382,7 +2361,7 @@ static HB_BOOL hb_gt_wvt_IsDialogMessage( PHB_GTWVT pWVT, LPMSG lpMsg ) /* P { int iIndex; - for( iIndex = 0; iIndex < WVT_DLGML_MAX; iIndex++ ) + for( iIndex = 0; iIndex < ( int ) HB_SIZEOFARRAY( pWVT->hDlgModeless ); iIndex++ ) { if( pWVT->hDlgModeless[ iIndex ] != 0 ) { @@ -2446,7 +2425,7 @@ static void hb_gt_wvt_ShowWindow( PHB_GTWVT pWVT ) /* * If you wish to show window the way you want, put somewhere in your application * ANNOUNCE HB_NOSTARTUPWINDOW - * If so compiled, then you need to issue Wvt_ShowWindow( SW_RESTORE ) + * If so compiled, then you need to issue wvt_ShowWindow( SW_RESTORE ) * at the point you desire in your code. */ if( hb_dynsymFind( "HB_NOSTARTUPWINDOW" ) != NULL ) @@ -2511,7 +2490,7 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, HB_BOOL bResizable ) pWVT->fontWeight = pWVTp->fontWeight; pWVT->fontQuality = pWVTp->fontQuality; pWVT->CodePage = pWVTp->CodePage; - HB_STRNCPY( pWVT->fontFace, pWVTp->fontFace, sizeof( pWVTp->fontFace ) - 1 ); + HB_STRNCPY( pWVT->fontFace, pWVTp->fontFace, HB_SIZEOFARRAY( pWVTp->fontFace ) - 1 ); pWVT->hFont = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage ); @@ -2539,8 +2518,8 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, HB_BOOL bResizable ) pWVT->ROWS = pWVT->pPP->width; pWVT->COLS = pWVT->pPP->height; - pt.x = ( pWVTp->PTEXTSIZE.x * pWVT->pPP->y ); - pt.y = ( pWVTp->PTEXTSIZE.y * pWVT->pPP->x ); + pt.x = pWVTp->PTEXTSIZE.x * pWVT->pPP->y; + pt.y = pWVTp->PTEXTSIZE.y * pWVT->pPP->x; } else { @@ -2585,15 +2564,15 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, HB_BOOL bResizable ) } /* This can happen if the pGTp is alien to this GT */ - /* TOFIX: */ + /* FIXME: */ if( ! bByConf ) { POINT pt; if( pWVT->pPP->bRowCols ) { - pt.x = ( pWVT->PTEXTSIZE.x * pWVT->pPP->y ); - pt.y = ( pWVT->PTEXTSIZE.y * pWVT->pPP->x ); + pt.x = pWVT->PTEXTSIZE.x * pWVT->pPP->y; + pt.y = pWVT->PTEXTSIZE.y * pWVT->pPP->x; pWVT->ROWS = pWVT->pPP->width; pWVT->COLS = pWVT->pPP->height; @@ -2611,7 +2590,7 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, HB_BOOL bResizable ) } if( ! bResizable ) - pWVT->pPP->style = ( ( pWVT->pPP->style & ~( WS_THICKFRAME | WS_MAXIMIZEBOX ) ) | WS_BORDER ); + pWVT->pPP->style = ( pWVT->pPP->style & ~( WS_THICKFRAME | WS_MAXIMIZEBOX ) ) | WS_BORDER; hWnd = CreateWindowEx( pWVT->pPP->exStyle, /* extended style */ @@ -2767,11 +2746,7 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT ) return HB_TRUE; } -/* ********************************************************************** */ -/* - * GT Specific Functions - */ -/* ********************************************************************** */ +/* GT Specific Functions */ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { @@ -2779,7 +2754,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil int iCmdShow; PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); if( ! hb_winmainArgGet( &hInstance, NULL, &iCmdShow ) ) { @@ -2801,7 +2776,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil /* hb_gt_wvt_CreateConsoleWindow( pWVT ); */ } -/* ********************************************************************** */ +/* --- */ static void hb_gt_wvt_Exit( PHB_GT pGT ) { @@ -2831,14 +2806,14 @@ static void hb_gt_wvt_Exit( PHB_GT pGT ) } } -/* ********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol ) { PHB_GTWVT pWVT; HB_BOOL fResult = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_SetMode(%p,%d,%d)", pGT, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_SetMode(%p,%d,%d)", ( void * ) pGT, iRow, iCol ) ); pWVT = HB_GTWVT_GET( pGT ); @@ -2873,7 +2848,7 @@ static HB_BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol ) return fResult; } -/* ********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_wvt_PutChar( PHB_GT pGT, int iRow, int iCol, int iColor, HB_BYTE bAttr, HB_USHORT usChar ) @@ -2890,14 +2865,15 @@ static HB_BOOL hb_gt_wvt_PutChar( PHB_GT pGT, int iRow, int iCol, return HB_TRUE; } - return HB_FALSE; + else + return HB_FALSE; } -/* ********************************************************************** */ +/* --- */ static const char * hb_gt_wvt_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2907,7 +2883,7 @@ static const char * hb_gt_wvt_Version( PHB_GT pGT, int iType ) return "Harbour Terminal: Windows GUI console (WVG)"; } -/* ********************************************************************** */ +/* --- */ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) { @@ -2915,9 +2891,9 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) int c = 0; HB_BOOL fKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); - HB_SYMBOL_UNUSED( iEventMask ); /* we ignore the eventmask! */ + HB_SYMBOL_UNUSED( iEventMask ); /* we ignore the event mask! */ pWVT = HB_GTWVT_GET( pGT ); @@ -2929,22 +2905,19 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) return fKey ? c : 0; } -/* ********************************************************************** */ /* dDuration is in 'Ticks' (18.2 per second) */ static void hb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); hb_gt_winapi_tone( dFrequency, dDuration ); } -/* ********************************************************************** */ - static HB_BOOL hb_gt_wvt_mouse_IsPresent( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_IsPresent(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_IsPresent(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2955,7 +2928,7 @@ static void hb_gt_wvt_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) { PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_GetPos(%p,%p,%p)", pGT, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_GetPos(%p,%p,%p)", ( void * ) pGT, piRow, piCol ) ); pWVT = HB_GTWVT_GET( pGT ); *piRow = pWVT->MousePos.y; @@ -2964,7 +2937,7 @@ static void hb_gt_wvt_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) static HB_BOOL hb_gt_wvt_mouse_ButtonState( PHB_GT pGT, int iButton ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_ButtonState(%p,%i)", pGT, iButton ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_ButtonState(%p,%i)", ( void * ) pGT, iButton ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2982,21 +2955,21 @@ static HB_BOOL hb_gt_wvt_mouse_ButtonState( PHB_GT pGT, int iButton ) static int hb_gt_wvt_mouse_CountButton( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_CountButton(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_CountButton(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); return GetSystemMetrics( SM_CMOUSEBUTTONS ); } -/* ********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { PHB_GTWVT pWVT; int iVal; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); pWVT = HB_GTWVT_GET( pGT ); @@ -3218,7 +3191,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) GetWindowRect( pWVT->hWnd, &wi ); borderWidth = ( wi.right - wi.left - ( ci.right - ci.left ) ) / 2; - borderHeight = ( wi.bottom - wi.top - ( ci.bottom - ci.top ) ); + borderHeight = wi.bottom - wi.top - ( ci.bottom - ci.top ); pInfo->pResult = hb_itemNew( NULL ); hb_arrayNew( pInfo->pResult, 4 ); @@ -3357,7 +3330,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_ICONFILE: - if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) ) + if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { HICON hIconToFree = pWVT->bIconToFree ? pWVT->hIcon : NULL; void * hImageName; @@ -3463,8 +3436,6 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_SCREENSIZE: { - int iX, iY; - if( ! pInfo->pResult ) pInfo->pResult = hb_itemNew( NULL ); @@ -3474,8 +3445,8 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY ) && hb_arrayLen( pInfo->pNewVal ) == 2 ) { - iY = hb_arrayGetNI( pInfo->pNewVal, 2 ); - iX = hb_arrayGetNI( pInfo->pNewVal, 1 ); + int iY = hb_arrayGetNI( pInfo->pNewVal, 2 ); + int iX = hb_arrayGetNI( pInfo->pNewVal, 1 ); if( iY > 0 ) { @@ -3530,10 +3501,10 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) BOOL bMax = hb_itemGetL( pInfo->pNewVal ); HB_GTWVT_LONG_PTR style = GetWindowLongPtr( pWVT->hWnd, GWL_STYLE ); - if( bMax && ( ! pWVT->bMaximizable ) ) - style = style | WS_MAXIMIZEBOX; - else if( ( ! bMax ) && pWVT->bMaximizable ) - style = style & ~WS_MAXIMIZEBOX; + if( bMax && ! pWVT->bMaximizable ) + style |= WS_MAXIMIZEBOX; + else if( ! bMax && pWVT->bMaximizable ) + style &= ~WS_MAXIMIZEBOX; SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, style ); SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0, @@ -3553,7 +3524,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { HB_GTWVT_LONG_PTR style = GetWindowLongPtr( pWVT->hWnd, GWL_STYLE ); if( pWVT->bResizable ) - style = style | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME; + style |= WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME; else style = ( style & ~( WS_MAXIMIZEBOX | WS_THICKFRAME ) ) | WS_BORDER; @@ -3902,9 +3873,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( pWVT->hWnd ) { - int iSpec = hb_itemGetNI( pInfo->pNewVal2 ); - - switch( iSpec ) + switch( hb_itemGetNI( pInfo->pNewVal2 ) ) { case HB_GTS_WS_SETONTOP: { @@ -4099,15 +4068,12 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) return HB_TRUE; } -/* ********************************************************************** */ +/* --- Graphics API --- */ -/* ********** Graphics API ********** */ -/* - * NOTE: +/* NOTE: * GfxPrimitive() parameters may have different meanings * ie: - Desired color is 'iBottom' for PUTPIXEL and 'iRight' for CIRCLE * - Red is iTop, Green iLeft and Blue is iBottom for MAKECOLOR - * */ #define SetGFXContext( c ) \ @@ -4132,18 +4098,19 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) { PHB_GTWVT pWVT; - HDC hdc; - HPEN hPen, hOldPen; - HBRUSH hBrush, hOldBrush; RECT r; int iRet = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", ( void * ) pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) ); pWVT = HB_GTWVT_GET( pGT ); if( pWVT->hWnd ) { + HDC hdc; + HPEN hPen, hOldPen; + HBRUSH hBrush, hOldBrush; + if( pWVT->bComposited ) hb_gt_wvt_Composited( pWVT, HB_FALSE ); @@ -4260,13 +4227,13 @@ static void hb_gt_wvt_gfx_Text( PHB_GT pGT, int iTop, int iLeft, const char *cBu } #endif -/* ********************************************************************** */ +/* --- */ static void hb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); pWVT = HB_GTWVT_GET( pGT ); if( pWVT ) @@ -4288,13 +4255,13 @@ static void hb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) } } -/* ********************************************************************** */ +/* --- */ static void hb_gt_wvt_Refresh( PHB_GT pGT ) { PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); @@ -4335,11 +4302,11 @@ static void hb_gt_wvt_Refresh( PHB_GT pGT ) } } -/* ********************************************************************** */ +/* --- */ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_wvt_Init; pFuncTable->Exit = hb_gt_wvt_Exit; @@ -4364,16 +4331,13 @@ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) return HB_TRUE; } -/* ********************************************************************** */ +/* --- */ #include "hbgtreg.h" -/* ********************************************************************** */ +/* --- */ - -/* - * WVT specific functions - */ +/* WVT specific functions */ static void hb_wvt_gtLoadGuiData( void ) { @@ -4442,10 +4406,10 @@ static void hb_wvt_gtReleaseGuiData( void ) #if ! defined( HB_OS_WIN_CE ) for( i = 0; i < WVT_PICTURES_MAX; i++ ) { - if( s_guiData->iPicture[ i ] ) + if( s_guiData->pPicture[ i ] ) { - HB_VTBL( s_guiData->iPicture[ i ] )->Release( HB_THIS( s_guiData->iPicture[ i ] ) ); - s_guiData->iPicture[ i ] = NULL; + HB_VTBL( s_guiData->pPicture[ i ] )->Release( HB_THIS( s_guiData->pPicture[ i ] ) ); + s_guiData->pPicture[ i ] = NULL; } } #endif @@ -4473,7 +4437,7 @@ static void hb_wvt_gtReleaseGuiData( void ) static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT ) { - int iIndex; + int iIndex; pWVT->bDeferPaint = HB_FALSE; pWVT->bTracking = HB_FALSE; @@ -4482,9 +4446,9 @@ static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT ) #if ! defined( HB_OS_WIN_CE ) { - LOGBRUSH lb; + LOGBRUSH lb; lb.lbStyle = BS_NULL; - lb.lbColor = RGB( 198,198,198 ); + lb.lbColor = RGB( 198, 198, 198 ); lb.lbHatch = 0; pWVT->currentBrush = CreateBrushIndirect( &lb ); } @@ -4671,11 +4635,7 @@ static void hb_wvt_gtCreateToolTipWindow( PHB_GTWVT pWVT ) pWVT->hWndTT = hwndTT; } -/* - * - * Exported functions for API calls - * - */ +/* Exported functions for API calls */ PHB_GTWVT hb_wvt_gtGetWVT( void ) { diff --git a/contrib/gtwvg/htmlview.prg b/contrib/gtwvg/htmlview.prg index 337a161d63..617d206e45 100644 --- a/contrib/gtwvg/htmlview.prg +++ b/contrib/gtwvg/htmlview.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpHtmlViewer compatible Class * * Copyright 2008 Andy Wos * Copyright 2008-2012 Pritpal Bedi @@ -45,14 +45,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpHtmlViewer compatible Class - * - * Pritpal Bedi - * 08Dec2008 */ #include "hbclass.ch" diff --git a/contrib/gtwvg/listbox.prg b/contrib/gtwvg/listbox.prg index 39fe917943..b14c2f3a76 100644 --- a/contrib/gtwvg/listbox.prg +++ b/contrib/gtwvg/listbox.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpTreeView compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpTreeView compatible Class - * - * Pritpal Bedi - * 26Nov2008 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgListBox INHERIT WvgWindow, WvgDataRef +CREATE CLASS WvgListBox INHERIT WvgWindow, WvgDataRef VAR adjustHeight INIT .F. VAR horizScroll INIT .F. diff --git a/contrib/gtwvg/menubar.prg b/contrib/gtwvg/menubar.prg index f6e71e2e58..fc32529dcf 100644 --- a/contrib/gtwvg/menubar.prg +++ b/contrib/gtwvg/menubar.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ Compatible xbpMenuBar Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ Compatible xbpMenuBar Class - * - * Pritpal Bedi - * 22Nov2008 */ #include "hbclass.ch" diff --git a/contrib/gtwvg/mle.prg b/contrib/gtwvg/mle.prg index 1cabd985ba..91407b46d9 100644 --- a/contrib/gtwvg/mle.prg +++ b/contrib/gtwvg/mle.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpMLE compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpMLE compatible Class - * - * Pritpal Bedi - * 07Dec2008 */ #include "hbclass.ch" diff --git a/contrib/gtwvg/paint.prg b/contrib/gtwvg/paint.prg index fccce9225d..88dc607e02 100644 --- a/contrib/gtwvg/paint.prg +++ b/contrib/gtwvg/paint.prg @@ -1,21 +1,22 @@ /* + * Routines to manage Wvt*Classes Gui Painting * * Copyright 2004 Pritpal Bedi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +34,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -51,9 +52,7 @@ THREAD STATIC t_paint_ := { { "", {} } } -/* - * This function must have to be defined in your appls - */ +/* This function must have to be defined in your applications */ #if 0 FUNCTION Wvt_Paint() diff --git a/contrib/gtwvg/parthdlr.prg b/contrib/gtwvg/parthdlr.prg index 709be276d9..c7a8d27772 100644 --- a/contrib/gtwvg/parthdlr.prg +++ b/contrib/gtwvg/parthdlr.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ Compatible xbpPartHandler Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ Compatible xbpPartHandler Class - * - * Pritpal Bedi - * 08Nov2008 */ #include "hbclass.ch" diff --git a/contrib/gtwvg/pushbut.prg b/contrib/gtwvg/pushbut.prg index 4d2deafe8a..926956cec8 100644 --- a/contrib/gtwvg/pushbut.prg +++ b/contrib/gtwvg/pushbut.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpPushButton Compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpPushButton Compatible Class - * - * Pritpal Bedi - * 26Nov2008 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgPushButton INHERIT WvgWindow +CREATE CLASS WvgPushButton INHERIT WvgWindow VAR autosize INIT .F. VAR border INIT .T. diff --git a/contrib/gtwvg/radiobut.prg b/contrib/gtwvg/radiobut.prg index 9abd87e920..788bf08cb3 100644 --- a/contrib/gtwvg/radiobut.prg +++ b/contrib/gtwvg/radiobut.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpPushButton Compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpPushButton Compatible Class - * - * Pritpal Bedi - * 06Dec2008 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgRadioButton INHERIT WvgWindow, WvgDataRef +CREATE CLASS WvgRadioButton INHERIT WvgWindow, WvgDataRef VAR autosize INIT .F. VAR caption INIT "" diff --git a/contrib/gtwvg/scrollbr.prg b/contrib/gtwvg/scrollbr.prg index cfe35fd983..04a3be0e30 100644 --- a/contrib/gtwvg/scrollbr.prg +++ b/contrib/gtwvg/scrollbr.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpScrollBar Compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpScrollBar Compatible Class - * - * Pritpal Bedi - * 17Feb2009 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgScrollBar INHERIT WvgWindow, WvgDataRef +CREATE CLASS WvgScrollBar INHERIT WvgWindow, WvgDataRef VAR autoTrack INIT .T. VAR range INIT { 0, 1 } diff --git a/contrib/gtwvg/sle.prg b/contrib/gtwvg/sle.prg index 7d8da035eb..7803fa88af 100644 --- a/contrib/gtwvg/sle.prg +++ b/contrib/gtwvg/sle.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpSLE compatible Class * * Copyright 2008-2011 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpSLE compatible Class - * - * Pritpal Bedi - * 07Dec2008 */ #include "hbclass.ch" diff --git a/contrib/gtwvg/statbar.prg b/contrib/gtwvg/statbar.prg index 64d037b21d..7d85b68cf6 100644 --- a/contrib/gtwvg/statbar.prg +++ b/contrib/gtwvg/statbar.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpStatusBar Compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpStatusBar Compatible Class - * - * Pritpal Bedi - * 25Nov2008 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgStatusBar INHERIT WvgWindow /* WvgActiveXControl */ +CREATE CLASS WvgStatusBar INHERIT WvgWindow /* WvgActiveXControl */ VAR caption INIT "" VAR sizeGrip INIT .T. diff --git a/contrib/gtwvg/static.prg b/contrib/gtwvg/static.prg index e7a9c43a77..c024e71052 100644 --- a/contrib/gtwvg/static.prg +++ b/contrib/gtwvg/static.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpTreeView compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpTreeView compatible Class - * - * Pritpal Bedi - * 26Nov2008 */ #include "hbclass.ch" diff --git a/contrib/gtwvg/syswnd.prg b/contrib/gtwvg/syswnd.prg index f41ff8d0d3..5b9be489ee 100644 --- a/contrib/gtwvg/syswnd.prg +++ b/contrib/gtwvg/syswnd.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ Compatible xbpPartHandler Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ Compatible xbpPartHandler Class - * - * Pritpal Bedi - * 08Nov2008 */ #include "hbclass.ch" diff --git a/contrib/gtwvg/tabpage.prg b/contrib/gtwvg/tabpage.prg index 2143281bfa..fc9b2832ad 100644 --- a/contrib/gtwvg/tabpage.prg +++ b/contrib/gtwvg/tabpage.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpTabPage compatible Class * * Copyright 2009-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpTabPage compatible Class - * - * Pritpal Bedi - * 01Mar2009 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgTabPage INHERIT WvgWindow +CREATE CLASS WvgTabPage INHERIT WvgWindow VAR caption INIT NIL /* Character string, Numeric, Object ("") */ VAR clipChildren INIT .T. /* Determines whether Xbase Parts in the child list are clipped during graphic output. */ diff --git a/contrib/gtwvg/toolbar.prg b/contrib/gtwvg/toolbar.prg index 29564b29cc..9e2a0b76b9 100644 --- a/contrib/gtwvg/toolbar.prg +++ b/contrib/gtwvg/toolbar.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpToolBar Compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpToolBar Compatible Class - * - * Pritpal Bedi - * 23Nov2008 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgToolBar INHERIT WvgWindow /*WvgActiveXControl*/ +CREATE CLASS WvgToolBar INHERIT WvgWindow /*WvgActiveXControl*/ VAR appearance VAR style INIT WVGTOOLBAR_STYLE_STANDARD diff --git a/contrib/gtwvg/treeview.prg b/contrib/gtwvg/treeview.prg index c9692e039e..c6f490bf5d 100644 --- a/contrib/gtwvg/treeview.prg +++ b/contrib/gtwvg/treeview.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ xbpTreeView compatible Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,14 +44,8 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ xbpTreeView compatible Class - * - * Pritpal Bedi - * 26Nov2008 */ #include "hbclass.ch" @@ -62,7 +56,7 @@ #include "wvtwin.ch" #include "wvgparts.ch" -CREATE CLASS WvgTreeView INHERIT WvgWindow, WvgDataRef +CREATE CLASS WvgTreeView INHERIT WvgWindow, WvgDataRef VAR alwaysShowSelection INIT .F. VAR hasButtons INIT .F. diff --git a/contrib/gtwvg/wnd.prg b/contrib/gtwvg/wnd.prg index f882cccdc4..e56eefba35 100644 --- a/contrib/gtwvg/wnd.prg +++ b/contrib/gtwvg/wnd.prg @@ -1,5 +1,5 @@ /* - * Source file for the Wvg*Classes + * Xbase++ Compatible xbpWindow Class * * Copyright 2008-2012 Pritpal Bedi * @@ -44,16 +44,9 @@ * */ -/* - * EkOnkar +/* EkOnkar * ( The LORD is ONE ) - * - * Xbase++ Compatible xbpWindow Class - * - * Pritpal Bedi - * 08Nov2008 */ -// #include "hbclass.ch" #include "inkey.ch" @@ -63,16 +56,14 @@ #include "wvtwin.ch" #include "wvgparts.ch" -// -// To Switch Over from ASCALLBACK() to SET/GET_Prop() calls -// +/* To Switch Over from ASCALLBACK() to SET/GET_Prop() calls */ #if 0 #define __BYASCALLBACK__ #else #define __BYSETPROP__ #endif -CREATE CLASS WvgWindow INHERIT WvgPartHandler +CREATE CLASS WvgWindow INHERIT WvgPartHandler /* CONFIGURATION */ VAR animate INIT .F. diff --git a/contrib/gtwvg/wvgcore.c b/contrib/gtwvg/wvgcore.c index 1dfe0b444d..c4f3eeb3ad 100644 --- a/contrib/gtwvg/wvgcore.c +++ b/contrib/gtwvg/wvgcore.c @@ -1,5 +1,4 @@ /* - * * Copyright 2007-2012 Pritpal Bedi * Based on: * @@ -14,22 +13,20 @@ * Copyright 1999-2000 Paul Tucker * Copyright 2002 Przemyslaw Czerpak * - * See COPYING.txt for licensing terms. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -47,7 +44,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -57,10 +54,7 @@ * */ -/* - * GUI Drawing Functions - * Pritpal Bedi - */ +/* GUI Drawing Function */ #include "hbwinole.h" #include "gtwvg.h" @@ -86,7 +80,7 @@ void hb_wvt_GetStringAttrib( int top, int left, int bottom, int right, HB_BYTE * { int irow, icol, j; - HB_TRACE( HB_TR_DEBUG, ( "hb_wvt_GetStringAttrib( %d, %d, %d, %d, %p, %p )", top, left, bottom, right, sBuffer, sAttrib ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wvt_GetStringAttrib( %d, %d, %d, %d, %p, %p )", top, left, bottom, right, ( void * ) sBuffer, ( void * ) sAttrib ) ); for( j = 0, irow = top; irow <= bottom; irow++ ) { @@ -110,7 +104,7 @@ void hb_wvt_PutStringAttrib( int top, int left, int bottom, int right, HB_BYTE * { int irow, icol, j; - HB_TRACE( HB_TR_DEBUG, ( "hb_wvt_PutStringAttrib( %d, %d, %d, %d, %p, %p )", top, left, bottom, right, sBuffer, sAttrib ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wvt_PutStringAttrib( %d, %d, %d, %d, %p, %p )", top, left, bottom, right, ( void * ) sBuffer, ( void * ) sAttrib ) ); hb_gtBeginWrite(); for( j = 0, irow = top; irow <= bottom; irow++ ) @@ -1035,7 +1029,7 @@ HB_FUNC( WVT_DRAWIMAGE ) iRight = xy.x - 1 + hb_parvni( 6, 4 ); if( HB_ISNUM( 5 ) ) - hb_wvt_gtRenderPicture( iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, _s->pGUI->iPicture[ hb_parni( 5 ) - 1 ], hb_parl( 7 ) ); + hb_wvt_gtRenderPicture( iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, _s->pGUI->pPicture[ hb_parni( 5 ) - 1 ], hb_parl( 7 ) ); else { void * hImage; @@ -1737,7 +1731,7 @@ HB_FUNC( WVT_DRAWBUTTON ) if( HB_ISNUM( 6 ) ) { - IPicture * iPicture = _s->pGUI->iPicture[ hb_parni( 6 ) - 1 ]; + IPicture * iPicture = _s->pGUI->pPicture[ hb_parni( 6 ) - 1 ]; hb_wvt_gtRenderPicture( iLeft + 4, iTop + 4, iImageWidth, iImageHeight, iPicture, FALSE ); } else @@ -1840,7 +1834,7 @@ HB_FUNC( WVT_DRAWPICTURE ) if( iSlot < WVT_PICTURES_MAX ) { - if( _s->pGUI->iPicture[ iSlot ] ) + if( _s->pGUI->pPicture[ iSlot ] ) { xy = hb_wvt_gtGetXYFromColRow( hb_parni( 2 ), hb_parni( 1 ) ); iTop = xy.y + hb_parvni( 6, 1 ); @@ -1850,7 +1844,7 @@ HB_FUNC( WVT_DRAWPICTURE ) iBottom = xy.y - 1 + hb_parvni( 6, 3 ); iRight = xy.x - 1 + hb_parvni( 6, 4 ); - hb_retl( hb_wvt_gtRenderPicture( iLeft, iTop, iRight - iLeft + 1, iBottom - iTop + 1, _s->pGUI->iPicture[ iSlot ], hb_parl( 7 ) ) ); + hb_retl( hb_wvt_gtRenderPicture( iLeft, iTop, iRight - iLeft + 1, iBottom - iTop + 1, _s->pGUI->pPicture[ iSlot ], hb_parl( 7 ) ) ); } } #endif @@ -2746,9 +2740,9 @@ HB_FUNC( WVT_LOADPICTURE ) hb_strfree( hImage ); if( iPicture ) { - if( _s->pGUI->iPicture[ iSlot ] ) - hb_wvt_gtDestroyPicture( _s->pGUI->iPicture[ iSlot ] ); - _s->pGUI->iPicture[ iSlot ] = iPicture; + if( _s->pGUI->pPicture[ iSlot ] ) + hb_wvt_gtDestroyPicture( _s->pGUI->pPicture[ iSlot ] ); + _s->pGUI->pPicture[ iSlot ] = iPicture; bResult = HB_TRUE; } #endif @@ -2793,9 +2787,9 @@ HB_FUNC( WVT_LOADPICTUREFROMRESOURCE ) hb_strfree( hSection ); if( iPicture ) { - if( _s->pGUI->iPicture[ iSlot ] ) - hb_wvt_gtDestroyPicture( _s->pGUI->iPicture[ iSlot ] ); - _s->pGUI->iPicture[ iSlot ] = iPicture; + if( _s->pGUI->pPicture[ iSlot ] ) + hb_wvt_gtDestroyPicture( _s->pGUI->pPicture[ iSlot ] ); + _s->pGUI->pPicture[ iSlot ] = iPicture; bResult = HB_TRUE; } #endif diff --git a/contrib/gtwvg/wvgcuig.c b/contrib/gtwvg/wvgcuig.c index b62ae609d3..7e8e5fdb22 100644 --- a/contrib/gtwvg/wvgcuig.c +++ b/contrib/gtwvg/wvgcuig.c @@ -1,5 +1,4 @@ /* - * * Copyright 2009-2012 Pritpal Bedi * Based on: * @@ -14,22 +13,20 @@ * Copyright 1999-2000 Paul Tucker * Copyright 2002 Przemyslaw Czerpak * - * See COPYING.txt for licensing terms. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -47,7 +44,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -65,9 +62,6 @@ * CUI Enhancement Oriented * No Callbacks etc. * Pure Statics - * . - * Pritpal Bedi - * 28Feb2009 */ #include "hbwinole.h" @@ -139,9 +133,9 @@ HB_FUNC( WVG_CLEARGUIOBJECTS ) if( pWVT->gObjs->bBlock ) hb_itemRelease( pWVT->gObjs->bBlock ); #if ! defined( HB_OS_WIN_CE ) - if( pWVT->gObjs->iPicture ) + if( pWVT->gObjs->pPicture ) if( pWVT->gObjs->bDestroyPicture ) - HB_VTBL( pWVT->gObjs->iPicture )->Release( HB_THIS( pWVT->gObjs->iPicture ) ); + HB_VTBL( pWVT->gObjs->pPicture )->Release( HB_THIS( pWVT->gObjs->pPicture ) ); #endif hb_xfree( pWVT->gObjs ); pWVT->gObjs = gObj; @@ -214,11 +208,11 @@ HB_FUNC( WVG_SETGOBJDATA ) #if ! defined( HB_OS_WIN_CE ) case GOBJ_OBJDATA_PICTUREEX: if( HB_ISNUM( 3 ) ) - gObj->iPicture = ( IPicture * ) ( HB_PTRUINT ) hb_parni( 3 ); + gObj->pPicture = ( IPicture * ) ( HB_PTRUINT ) hb_parni( 3 ); break; case GOBJ_OBJDATA_PICTURE: if( HB_ISNUM( 3 ) && hb_parni( 3 ) <= WVT_PICTURES_MAX ) - gObj->iPicture = pWVT->pGUI->iPicture[ hb_parni( 3 ) - 1 ]; + gObj->pPicture = pWVT->pGUI->pPicture[ hb_parni( 3 ) - 1 ]; break; case GOBJ_OBJDATA_IMAGE: { @@ -227,7 +221,7 @@ HB_FUNC( WVG_SETGOBJDATA ) if( HB_ISNUM( 3 ) ) { if( hb_parni( 3 ) <= WVT_PICTURES_MAX ) - iPicture = pWVT->pGUI->iPicture[ hb_parni( 3 ) - 1 ]; + iPicture = pWVT->pGUI->pPicture[ hb_parni( 3 ) - 1 ]; } else { @@ -245,9 +239,9 @@ HB_FUNC( WVG_SETGOBJDATA ) } if( iPicture ) { - if( gObj->bDestroyPicture && gObj->iPicture ) - HB_VTBL( gObj->iPicture )->Release( HB_THIS( gObj->iPicture ) ); - gObj->iPicture = iPicture; + if( gObj->bDestroyPicture && gObj->pPicture ) + HB_VTBL( gObj->pPicture )->Release( HB_THIS( gObj->pPicture ) ); + gObj->pPicture = iPicture; gObj->bDestroyPicture = HB_TRUE; } break; @@ -1386,7 +1380,7 @@ HB_FUNC( WVG_PICTURE ) gObj->aOffset.iBottom = hb_parvni( 5, 3 ); gObj->aOffset.iRight = hb_parvni( 5, 4 ); - gObj->iPicture = pWVT->pGUI->iPicture[ hb_parni( 6 ) - 1 ]; + gObj->pPicture = pWVT->pGUI->pPicture[ hb_parni( 6 ) - 1 ]; gObj->iData = ( hb_parl( 7 ) ? 1 : 0 ); gObj->bDestroyPicture = HB_FALSE; @@ -1420,7 +1414,7 @@ HB_FUNC( WVG_PICTUREEX ) gObj->aOffset.iBottom = hb_parvni( 5, 3 ); gObj->aOffset.iRight = hb_parvni( 5, 4 ); - gObj->iPicture = ( IPicture * ) ( HB_PTRUINT ) hb_parnint( 6 ); + gObj->pPicture = ( IPicture * ) ( HB_PTRUINT ) hb_parnint( 6 ); gObj->iData = ( hb_parl( 7 ) ? 1 : 0 ); gObj->bDestroyPicture = HB_FALSE; @@ -1454,7 +1448,7 @@ HB_FUNC( WVG_IMAGE ) { case GOBJ_IMAGESOURCE_SLOT: if( HB_ISNUM( 7 ) && hb_parni( 7 ) <= WVT_PICTURES_MAX ) - iPicture = pWVT->pGUI->iPicture[ hb_parni( 7 ) - 1 ]; + iPicture = pWVT->pGUI->pPicture[ hb_parni( 7 ) - 1 ]; break; case GOBJ_IMAGESOURCE_RESOURCE: { @@ -1490,7 +1484,7 @@ HB_FUNC( WVG_IMAGE ) gObj->aOffset.iBottom = hb_parvni( 5, 3 ); gObj->aOffset.iRight = hb_parvni( 5, 4 ); - gObj->iPicture = iPicture; + gObj->pPicture = iPicture; gObj->iData = ( hb_parl( 9 ) ? 1 : 0 ); if( iSource == GOBJ_IMAGESOURCE_SLOT ) @@ -1517,7 +1511,7 @@ static void hb_wvg_RenderPicture( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int POINT lpp = { 0, 0 }; HDC hdc = pWVT->hGuiDC; - IPicture * iPicture = gObj->iPicture; + IPicture * iPicture = gObj->pPicture; if( iPicture ) { diff --git a/contrib/gtwvg/wvgutils.c b/contrib/gtwvg/wvgutils.c index af21a07a81..c00fa1e541 100644 --- a/contrib/gtwvg/wvgutils.c +++ b/contrib/gtwvg/wvgutils.c @@ -14,22 +14,20 @@ * Copyright 1999-2000 Paul Tucker * Copyright 2002 Przemyslaw Czerpak * - * See COPYING.txt for licensing terms. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -47,7 +45,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -59,7 +57,7 @@ #include "gtwvg.h" -/* workaround for missing declaration in MinGW32 */ +/* workaround for missing declaration in MinGW */ #if ! defined( TTM_SETTITLE ) && defined( TTM_SETTITLEA ) #define TTM_SETTITLE TTM_SETTITLEA #endif diff --git a/contrib/gtwvg/wvgwin.c b/contrib/gtwvg/wvgwin.c index 969dd6a5db..c968e24a07 100644 --- a/contrib/gtwvg/wvgwin.c +++ b/contrib/gtwvg/wvgwin.c @@ -14,22 +14,20 @@ * Copyright 1999-2000 Paul Tucker * Copyright 2002 Przemyslaw Czerpak * - * See COPYING.txt for licensing terms. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -47,7 +45,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -57,9 +55,7 @@ * */ -/* - * Direct WinApi Functions - Prefixed WIN_*() - */ +/* Direct WinApi Functions - Prefixed wvg_*() */ #include "gtwvg.h" #include "hbwapi.h" diff --git a/contrib/gtwvg/wvgwing.c b/contrib/gtwvg/wvgwing.c index 1a430275eb..5b08433365 100644 --- a/contrib/gtwvg/wvgwing.c +++ b/contrib/gtwvg/wvgwing.c @@ -14,22 +14,20 @@ * Copyright 1999-2000 Paul Tucker * Copyright 2002 Przemyslaw Czerpak * - * See COPYING.txt for licensing terms. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -47,7 +45,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -57,9 +55,7 @@ * */ -/* - * Direct WinApi Functions - Prefixed WIN_*() - */ +/* Direct WinApi Functions - Prefixed wvg_*() */ #if defined( __BORLANDC__ ) # if ! defined( NONAMELESSUNION ) @@ -87,8 +83,8 @@ #include -#if defined( __BORLANDC__ ) && ( __BORLANDC__ >= 0x610 ) -# undef NONAMELESSUNION +#if defined( __BORLANDC__ ) && __BORLANDC__ >= 0x0610 + #undef NONAMELESSUNION #endif #if defined( NONAMELESSUNION ) diff --git a/contrib/hbamf/amf.h b/contrib/hbamf/amf.h index bb89e82695..524dc921e3 100644 --- a/contrib/hbamf/amf.h +++ b/contrib/hbamf/amf.h @@ -1,6 +1,5 @@ /* - * AMF3 headers - * Based on a AmFast C library for Python by Dave Thompson + * AMF3 headers - based on a AmFast C library for Python by Dave Thompson * * Copyright 2011-2012 Aleksander Czajczynski * diff --git a/contrib/hbamf/amfdec.c b/contrib/hbamf/amfdec.c index f5c07fd76a..fe30d89771 100644 --- a/contrib/hbamf/amfdec.c +++ b/contrib/hbamf/amfdec.c @@ -1,14 +1,11 @@ -/******* +/* by Aleksander Czajczynski 2011-2012 * - * by Aleksander Czajczynski 2011-2012 + * Decoding AMF3 to Harbour items * - * Decoding AMF3 to Harbour items - * - * Contains portions from - * Dave Thompson's MIT licensed - * AmFast C library for Python - * - ********/ + * Contains portions from + * Dave Thompson's MIT licensed + * AmFast C library for Python + */ #include "hbapi.h" #include "hbapiitm.h" @@ -109,7 +106,7 @@ static HB_BOOL amfX_decode_double( amfContext * context, double * val ) /* * Put bytes from byte array into double - * TOFIX: does this aligment work on any platform? + * FIXME: does this alignment work on any platform? union aligned { @@ -175,7 +172,7 @@ static HB_BOOL amf3_decode_int( amfContext * context, int * iVal ) result |= byte & 0xff; } - /* Move sign bit, since we're converting 29bit->32bit */ + /* Move sign bit, since we're converting 29-bit -> 32-bit */ if( result & 0x10000000 ) result -= 0x20000000; @@ -295,12 +292,12 @@ static HB_BOOL amf3_deserialize_string( amfContext * context, PHB_ITEM pItem ) /* Add the dynamic attributes of an encoded obj to a dict. */ static HB_BOOL amf3_decode_dynamic_dict( amfContext * context, PHB_ITEM pItem ) { - PHB_ITEM pKey; - PHB_ITEM pValue; - HB_BOOL result; - for( ;; ) { + PHB_ITEM pKey; + PHB_ITEM pValue; + HB_BOOL result; + pKey = hb_itemNew( NULL ); if( ! amf3_deserialize_string( context, pKey ) ) { @@ -331,7 +328,7 @@ static HB_BOOL amf3_decode_dynamic_dict( amfContext * context, PHB_ITEM pItem ) } } -/* Populate an array with vals from the buffer. */ +/* Populate an array with values from the buffer. */ static HB_BOOL decode_dynamic_array_AMF3( amfContext * context, PHB_ITEM pItem, int array_len, HB_BOOL dict ) { int i; @@ -423,8 +420,8 @@ static HB_BOOL amf3_deserialize_array( amfContext * context, PHB_ITEM pItem, HB_ } array_len = ( int ) ( header >> 1 ); - /* Original python comment was: - Can't use array_len to create a list of known + /* Original Python comment was: + Cannot use array_len to create a list of known length, see ticket #46 I think that this is not a problem for Harbour */ @@ -666,8 +663,8 @@ static HB_BOOL amf3_decode_class_def( amfContext * context, PHB_ITEM pClass, int hb_hashNew( pMappedClassDef ); /* empty hash emulation for now */ } - /* PyObject_CallMethodObjArgs(context->class_mapper, - context->class_def_name, alias, NULL); */ + /* PyObject_CallMethodObjArgs( context->class_mapper, + context->class_def_name, alias, NULL ); */ } hb_itemRelease( pStrAlias ); @@ -709,7 +706,7 @@ static HB_BOOL amf3_decode_class_def( amfContext * context, PHB_ITEM pClass, int the raw bytes. */ /* TODO: introduce similar RTE? - PyErr_SetString(amfast_DecodeError, "Encoded class is externalizable, but ClassDef is not."); */ + PyErr_SetString( amfast_DecodeError, "Encoded class is externalizable, but ClassDef is not." ); */ return HB_FALSE; } @@ -800,13 +797,11 @@ static HB_BOOL amf3_deserialize_class_def( amfContext * context, PHB_ITEM pClass return HB_TRUE; } -/* Returns a dict with vals from an obj. */ +/* Returns a dict with values from an object. */ static HB_BOOL amf3_decode_obj_attrs( amfContext * context, PHB_ITEM pHash, PHB_ITEM pClass ) { PHB_ITEM pArray; - PHB_ITEM pKey; PHB_ITEM pValue; - HB_BOOL result; HB_SIZE static_attr_len; HB_SIZE i; @@ -817,12 +812,15 @@ static HB_BOOL amf3_decode_obj_attrs( amfContext * context, PHB_ITEM pHash, PHB_ if( ! pArray ) return HB_FALSE; - /* maybe hb_arrayGetItemPtr(?) could be used */ + /* maybe hb_arrayGetItemPtr() could be used? */ static_attr_len = hb_arrayLen( pArray ); for( i = 0; i < static_attr_len; i++ ) { + PHB_ITEM pKey; + HB_BOOL result; + pValue = hb_itemNew( NULL ); if( ! amf3_getItem( context, pValue ) ) { @@ -866,12 +864,12 @@ static HB_BOOL amf3_decode_anon_obj( amfContext * context, PHB_ITEM pItem, PHB_I PHB_ITEM pAnonHash = hb_itemNew( NULL ); HB_BOOL result = HB_FALSE; - /* Original python comment which I don't understand: + /* Original Python comment which I don't understand: We're using merge instead of populating the dict directly, because we have to setup a reference to the object before decoding it. ?????? */ - /* we (Harbourers) are supplying already initialized hash to next func */ + /* we (Harbourers) are supplying already initialized hash to next function */ if( hb_arrayGet( pItem, OBJAMF_VAR_HASH, pAnonHash ) ) result = amf3_decode_obj_attrs( context, pAnonHash, pClass ); @@ -1003,8 +1001,8 @@ static HB_BOOL amf3_deserialize_obj( amfContext * context, PHB_ITEM pItem, HB_BO { /* Anonymous obj == OBJAMF */ hb_arrayNew( pItem, OBJAMF_VAR_COUNT ); - /* performance TOFIX, cache class id (in context maybe) - to not scan all classes by name everytime */ + /* performance FIXME, cache class id (in context maybe) + to not scan all classes by name every time */ hb_objSetClass( pItem, "AMF_OBJ", "AMF_OBJ" ); pValue = hb_itemPutNI( NULL, OBJAMF_VER ); hb_arraySet( pItem, OBJAMF_VAR_VER, pValue ); @@ -1042,7 +1040,7 @@ static HB_BOOL amf3_deserialize_obj( amfContext * context, PHB_ITEM pItem, HB_BO } else { - /* Create obj_val for all typed objs. */ + /* Create obj_val for all typed objects. */ #if 0 obj_val = PyObject_CallMethod( class_def, "getInstance", NULL ); #endif diff --git a/contrib/hbamf/amfenc.c b/contrib/hbamf/amfenc.c index 042baf4614..45f17a03d8 100644 --- a/contrib/hbamf/amfenc.c +++ b/contrib/hbamf/amfenc.c @@ -1,15 +1,12 @@ -/******* +/* Ilina Stoilkovska 2011 + * Aleksander Czajczynski 2011-2012 * - * Ilina Stoilkovska 2011 - * Aleksander Czajczynski 2011-2012 + * Encoding Harbour items to AMF3 * - * Encoding Harbour items to AMF3 - * - * Contains portions from - * Dave Thompson's MIT licensed - * AmFast C library for Python - * - ********/ + * Contains portions from + * Dave Thompson's MIT licensed + * AmFast C library for Python + */ #include "hbapi.h" #include "hbapiitm.h" @@ -154,7 +151,7 @@ static HB_BOOL amf3_encode_int( amfContext * context, int value ) * * The int is negative if the 1st bit of the 29 int is set. */ - value &= 0x1fffffff; /* Ignore 1st 3 bits of 32 bit int, since we're encoding to 29 bit. */ + value &= 0x1fffffff; /* Ignore 1st 3 bits of 32-bit int, since we're encoding to 29 bit. */ if( value < 0x80 ) { tmp_size = 1; @@ -236,7 +233,7 @@ static HB_BOOL amf3_encode_bool( amfContext * context, PHB_ITEM pItem ) static HB_BOOL amf3_encode_string( amfContext * context, PHB_ITEM pItem ) { - void * hStr = NULL; /* = hb_itemGetCPtr(pItem); not needed with UTF8 conversion */ + void * hStr = NULL; /* = hb_itemGetCPtr( pItem ); not needed with UTF-8 conversion */ HB_SIZE len; const char * utf8str = hb_itemGetStrUTF8( pItem, &hStr, &len ); HB_BOOL result; @@ -259,14 +256,13 @@ static HB_BOOL amf3_encode_string( amfContext * context, PHB_ITEM pItem ) static int amf3_add_index( amfContext * context, PHB_ITEM pHash, PHB_ITEM pItem ) { - PHB_ITEM pKey; PHB_ITEM pVal; int result = 0; - HB_SIZE str_len; if( context->use_refs ) { - pKey = hb_itemNew( NULL ); + PHB_ITEM pKey = hb_itemNew( NULL ); + _ref_realItemPtr( pKey, pItem ); if( ! HB_IS_POINTER( pKey ) && ! HB_IS_DATETIME( pKey ) ) { @@ -288,12 +284,12 @@ static int amf3_add_index( amfContext * context, PHB_ITEM pHash, PHB_ITEM pItem result = ( int ) ( hb_hashLen( pHash ) - 1 + context->strstr_count ); /* used only when some inner context inside * conversion function uses only strstr mode - * like AMF3_FROMWA function f.e. */ + * like amf3_FromWA() function f.e. */ } if( ( HB_IS_STRING( pItem ) || HB_IS_MEMO( pItem ) ) && context->use_strstr ) { - str_len = hb_itemGetCLen( pItem ); + HB_SIZE str_len = hb_itemGetCLen( pItem ); if( str_len > 3 && str_len < 32 ) /* do this only for mid-sized strings */ { if( ! context->use_refs ) @@ -312,14 +308,11 @@ static int amf3_add_index( amfContext * context, PHB_ITEM pHash, PHB_ITEM pItem static int amf3_get_index( amfContext * context, PHB_ITEM pHash, PHB_ITEM pItem ) { - PHB_ITEM pKey; - PHB_ITEM pStrIdx; - HB_SIZE nPos; - HB_SIZE str_len; - if( context->use_refs ) { - pKey = hb_itemNew( NULL ); + PHB_ITEM pKey = hb_itemNew( NULL ); + HB_SIZE nPos; + _ref_realItemPtr( pKey, pItem ); if( ! HB_IS_POINTER( pKey ) && ! HB_IS_DOUBLE( pKey ) ) { @@ -337,17 +330,13 @@ static int amf3_get_index( amfContext * context, PHB_ITEM pHash, PHB_ITEM pItem if( ( HB_IS_STRING( pItem ) || HB_IS_MEMO( pItem ) ) && context->use_strstr ) { - str_len = hb_itemGetCLen( pItem ); - if( str_len > 3 && str_len < 32 ) /* do this only for mid-sized strings */ + HB_SIZE str_len = hb_itemGetCLen( pItem ); + if( str_len > 3 && str_len < 32 ) /* do this only for mid-sized strings */ { - pStrIdx = hb_hashGetItemPtr( context->strstr_ref, pItem, 0 ); + PHB_ITEM pStrIdx = hb_hashGetItemPtr( context->strstr_ref, pItem, 0 ); if( pStrIdx ) return ( int ) hb_itemGetNS( pStrIdx ); - else - return -1; } - else - return -1; } return -1; @@ -374,7 +363,6 @@ static int amf3_encode_reference( amfContext * context, PHB_ITEM pHash, PHB_ITEM if( amf3_add_index( context, pHash, pItem ) == -1 ) return 0; - return -1; } @@ -472,15 +460,13 @@ static HB_BOOL amf3_encode_hash( amfContext * context, PHB_ITEM pItem ) static HB_BOOL amf3_encode_dynamic_dict( amfContext * context, PHB_ITEM pItem ) { - PHB_ITEM pKey; - PHB_ITEM pVal; - HB_ISIZ i; - HB_ISIZ len = hb_hashLen( pItem ); + HB_ISIZ i; + HB_ISIZ len = hb_hashLen( pItem ); for( i = 1; i <= len; i++ ) { - pKey = hb_hashGetKeyAt( pItem, i ); - pVal = hb_hashGetValueAt( pItem, i ); + PHB_ITEM pKey = hb_hashGetKeyAt( pItem, i ); + PHB_ITEM pVal = hb_hashGetValueAt( pItem, i ); if( HB_IS_STRING( pKey ) ) { if( ! amf3_serialize_string( context, pKey ) ) @@ -574,10 +560,8 @@ static int amf3_serialize_date( amfContext * context, PHB_ITEM pItem ) static HB_BOOL amf3_encode_array( amfContext * context, PHB_ITEM pItem ) { - HB_SIZE item_len = hb_arrayLen( pItem ); - PHB_ITEM pArrayItem; - int i; - int result; + HB_SIZE item_len = hb_arrayLen( pItem ); + int i; if( ! amf3_encode_int( context, ( ( int ) item_len << 1 ) | REFERENCE_BIT ) ) return HB_FALSE; @@ -587,6 +571,9 @@ static HB_BOOL amf3_encode_array( amfContext * context, PHB_ITEM pItem ) for( i = 1; i <= ( int ) item_len; i++ ) { + PHB_ITEM pArrayItem; + int result; + pArrayItem = hb_itemNew( NULL ); hb_arrayGet( pItem, i, pArrayItem ); if( ! pArrayItem ) @@ -618,8 +605,9 @@ static int amf3_encode_class_def( amfContext * context, PHB_ITEM pClass ) HB_ISIZ i; PHB_ITEM class_alias; PHB_ITEM static_attrs; -/* PHB_ITEM attr_len = NULL; */ - PHB_ITEM attr_name; +#if 0 + PHB_ITEM attr_len = NULL; +#endif if( ! pClass ) { @@ -658,7 +646,7 @@ static int amf3_encode_class_def( amfContext * context, PHB_ITEM pClass ) if( ! static_attrs ) return 0; - static_attr_len = hb_arrayLen( static_attrs ); /* array this is -- hb_itemGetCLen(static_attrs); */ + static_attr_len = hb_arrayLen( static_attrs ); /* array this is -- hb_itemGetCLen( static_attrs ); */ if( static_attr_len == -1 || static_attr_len > ( MAX_INT >> 4 ) ) return 0; @@ -667,13 +655,13 @@ static int amf3_encode_class_def( amfContext * context, PHB_ITEM pClass ) return 0; result = amf3_serialize_string( context, class_alias ); - /* not needed hb_itemRelease(class_alias); */ + /* not needed hb_itemRelease( class_alias ); */ if( ! result ) return 0; for( i = 0; i < static_attr_len; i++ ) { - attr_name = hb_itemArrayGet( static_attrs, i ); + PHB_ITEM attr_name = hb_itemArrayGet( static_attrs, i ); if( ! attr_name ) { /* not needed hb_itemRelease( static_attrs ); */ @@ -685,7 +673,7 @@ static int amf3_encode_class_def( amfContext * context, PHB_ITEM pClass ) return 0; } - /* not needed hb_itemRelease( static_attrs ); */ + /* not needed hb_itemRelease( static_attrs ); */ return 1; } @@ -1025,9 +1013,6 @@ static amfContext * context_setup( PHB_ITEM pFuncSym, HB_BOOL use_refs, HB_BOOL memset( context, 0, sizeof( amfContext ) ); context->cBuf = ( char * ) hb_xgrab( sizeof( char ) * 8 ); -#if 0 - memset( context->cBuf, 0, sizeof( char ) * 8 ); -#endif context->position = 0; context->length = sizeof( char ) * 8; context->str_rtrim = str_rtrim; @@ -1241,7 +1226,6 @@ HB_FUNC( AMF3_FROMWA ) } } - if( ! bAsArray ) { pFieldNames = hb_itemNew( NULL ); @@ -1385,9 +1369,6 @@ HB_FUNC( AMF3_ENCODE ) memset( context, 0, sizeof( amfContext ) ); context->cBuf = ( char * ) hb_xgrab( sizeof( char ) * 8 ); -#if 0 - memset( context->cBuf, 0, sizeof( char ) * 8 ); -#endif context->position = 0; context->length = sizeof( char ) * 8; context->str_rtrim = HB_FALSE; diff --git a/contrib/hbamf/hbamfobj.prg b/contrib/hbamf/hbamfobj.prg index a0cb2b0f4f..7f90a2a154 100644 --- a/contrib/hbamf/hbamfobj.prg +++ b/contrib/hbamf/hbamfobj.prg @@ -50,8 +50,8 @@ CREATE CLASS amf_Obj METHOD New( hCachedData ) CONSTRUCTOR - ERROR HANDLER noMessage - METHOD msgNotFound + ERROR HANDLER noMessage( ... ) + METHOD msgNotFound( cMessage, ... ) PROTECTED: @@ -67,7 +67,7 @@ CREATE CLASS amf_Obj ACCESS RealClass INLINE ::cRealClass ACCESS RpcOid INLINE ::nRpcOid -END CLASS +ENDCLASS METHOD New( hCachedData ) CLASS amf_Obj @@ -76,7 +76,6 @@ METHOD New( hCachedData ) CLASS amf_Obj RETURN self METHOD noMessage( ... ) CLASS amf_Obj - RETURN ::msgNotFound( __GetMessage(), ... ) METHOD msgNotFound( cMessage, ... ) CLASS amf_Obj @@ -102,7 +101,7 @@ CREATE CLASS amf_Raw PROTECTED: VAR cData -END CLASS +ENDCLASS METHOD New( cData ) CLASS amf_Raw diff --git a/contrib/hbamf/readme.txt b/contrib/hbamf/readme.txt index 2b04c8f920..0af9e6ba62 100644 --- a/contrib/hbamf/readme.txt +++ b/contrib/hbamf/readme.txt @@ -1,6 +1,4 @@ --------------------------------------- -Short description of Harbour functions --------------------------------------- +Short description of Harbour functions: cAMF := amf3_Encode( xVal, symConvOut, lBinaryStrings ) xVal - any supported datatype: @@ -32,7 +30,7 @@ Short description of Harbour functions bWhile - COPY TO like WHILE codeblock bFor - COPY TO like FOR codeblock - aFields - array of fieldnames (codeblocks are going to be supported here too) + aFields - array of field names (codeblocks are going to be supported here too) nCount - NEXT like, process only specified count of records lStrTrim - RTrim() strings, default is .T. @@ -46,19 +44,51 @@ Short description of Harbour functions outbound conversion function, you must pass pointer to encoding context, otherwise AMF3 references will encoded incorrectly. Example code of such case: + STATIC FUNCTION ConvOut( xVal, pOuterContext ) + LOCAL lClose - IF HB_ISOBJECT( xVal ) - IF xVal:className() == "WORKAREAEXPORT" - lClose := xVal:lCloseWA - SELECT ( xVal:nWorkArea ) + IF HB_ISOBJECT( xVal ) .AND. xVal:className() == "WORKAREAEXPORT" + lClose := xVal:lCloseWA + dbSelectArea( xVal:nWorkArea ) - xVal := amf_Raw():New( amf3_FromWA( xVal:bWhile, xVal:bFor, xVal:aFields, xVal:nCount, xVal:lStrTrim, 1, pOuterContext ) ) - IF lClose - CLOSE - ENDIF + xVal := amf_Raw():New( amf3_FromWA( xVal:bWhile, xVal:bFor, xVal:aFields, xVal:nCount, xVal:lStrTrim, 1, pOuterContext ) ) + IF lClose + dbCloseArea() ENDIF ENDIF - RETURN xVal + RETURN xVal + +Issues +====== + + ; amf3_Encode(), amf3_Decode() + - there is no real serialization class-mapping included at the moment, + due to lack of time to make a concept of it complete. + Only anonymous (emulated on Harbour side using ObjAMF class) + and externalizable objects are supported. + + - context->positon-- decrements should be removed from the .c code, + before we make the functions able to work on real streams without + buffering. There is no rewind in such situations. + + ; amf3_FromWA() - generates AMF3 array from current workarea, + but the function doesn't have an idea of SET DELETED switch! + It should have, because it tries to predict the number of records. + As a workaround parameter could be used, because it switches + off the prediction. Another option could be creating temporary INDEX FOR, + it should have correct ordKeyCount(). + + ; amf3_Decode() - really doesn't need a hash for references, because + reference id in AMF increase sequentially. It could be okay and faster + to use some array with decent resize schema. Other than that benchmarks (in + ST mode) showed that decoding speed is a little bit faster in this + implementation than with Flash's built-in. + + ; .c function amf3_encode_string() does string hb_strRTrimLen() + on a UTF-8 values. so far i haven't found a string that was broken + by this, but i have a feeling that it is possible... + +Note your issues too! diff --git a/contrib/hbblink/blinker.prg b/contrib/hbblink/blinker.prg index feca80c1c3..d818de81ec 100644 --- a/contrib/hbblink/blinker.prg +++ b/contrib/hbblink/blinker.prg @@ -246,7 +246,7 @@ FUNCTION BliMgrSts( nParam ) CASE BliCacheSize CASE BliExtMemAvail CASE BliOverlayLoc - CASE BliVirMemAvail /* fall through */ + CASE BliVirMemAvail /* fallthrough */ ENDSWITCH RETURN 0 diff --git a/contrib/hbblink/hbblink.ch b/contrib/hbblink/hbblink.ch index f53c09a327..4fe9dd8665 100644 --- a/contrib/hbblink/hbblink.ch +++ b/contrib/hbblink/hbblink.ch @@ -55,7 +55,7 @@ #define BliCacheLoc 1 /* Get location of real mode overlay cache (EMS/XMS) */ #define BliCacheSize 2 /* Get size of overlay cache */ #define BliExtMemAvail 3 /* Get bytes extended memory available to the extender */ -#define BliHostMode 4 /* Get DOS extender host mode (DPMI/VCPI/XMS) */ +#define BliHostMode 4 /* Get MS-DOS extender host mode (DPMI/VCPI/XMS) */ #define BliMachineMode 5 /* Get current machine mode (real, protected) */ #define BliOverlayLoc 6 /* Get location of overlay area */ #define BliOverlaySize 7 /* Get size of overlay area */ diff --git a/contrib/hbbz2/core.c b/contrib/hbbz2/core.c index 3ec0532620..6c05c88f74 100644 --- a/contrib/hbbz2/core.c +++ b/contrib/hbbz2/core.c @@ -90,7 +90,9 @@ static int hb_bz2Compress( const char * szSrc, HB_SIZE nSrc, stream.bzalloc = hb_bz2Alloc; stream.bzfree = hb_bz2Free; -/* stream.opaque = NULL; */ +#if 0 + stream.opaque = NULL; +#endif iResult = BZ2_bzCompressInit( &stream, iBlockSize, 0, 0 ); if( iResult == BZ_OK ) @@ -132,7 +134,9 @@ static HB_SIZE hb_bz2UncompressedSize( const char * szSrc, HB_SIZE nLen, stream.bzalloc = hb_bz2Alloc; stream.bzfree = hb_bz2Free; -/* stream.opaque = NULL; */ +#if 0 + stream.opaque = NULL; +#endif *piResult = BZ2_bzDecompressInit( &stream, 0, 0 ); if( *piResult == BZ_OK ) @@ -180,7 +184,9 @@ static int hb_bz2Uncompress( const char * szSrc, HB_SIZE nSrc, stream.bzalloc = hb_bz2Alloc; stream.bzfree = hb_bz2Free; -/* stream.opaque = NULL; */ +#if 0 + stream.opaque = NULL; +#endif iResult = BZ2_bzDecompressInit( &stream, 0, 0 ); if( iResult == BZ_OK ) @@ -207,17 +213,13 @@ static int hb_bz2Uncompress( const char * szSrc, HB_SIZE nSrc, return iResult; } -/* - * hb_bz2_Version() -> - */ +/* hb_bz2_Version() --> */ HB_FUNC( HB_BZ2_VERSION ) { hb_retc( BZ2_bzlibVersion() ); } -/* - * hb_bz2_CompressBound( | ) -> - */ +/* hb_bz2_CompressBound( | ) --> */ HB_FUNC( HB_BZ2_COMPRESSBOUND ) { if( HB_ISCHAR( 1 ) ) @@ -228,10 +230,8 @@ HB_FUNC( HB_BZ2_COMPRESSBOUND ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * hb_bz2_UncompressLen( , [<@nResult>] ) - * -> or -1 on error - */ +/* hb_bz2_UncompressLen( , [<@nResult>] ) + --> or -1 on error */ HB_FUNC( HB_BZ2_UNCOMPRESSLEN ) { const char * szData = hb_parc( 1 ); @@ -255,10 +255,8 @@ HB_FUNC( HB_BZ2_UNCOMPRESSLEN ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * hb_bz2_Compress( , [|<@cBuffer>], [<@nResult>], [] ) - * => or NIL on Error - */ +/* hb_bz2_Compress( , [|<@cBuffer>], [<@nResult>], [] ) + --> or NIL on Error */ HB_FUNC( HB_BZ2_COMPRESS ) { const char * szData = hb_parc( 1 ); @@ -315,10 +313,8 @@ HB_FUNC( HB_BZ2_COMPRESS ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * hb_bz2_Uncompress( , [|<@cBuffer>], [<@nResult>] ) - * => or NIL on Error - */ +/* hb_bz2_Uncompress( , [|<@cBuffer>], [<@nResult>] ) + --> or NIL on Error */ HB_FUNC( HB_BZ2_UNCOMPRESS ) { PHB_ITEM pBuffer = HB_ISBYREF( 2 ) ? hb_param( 2, HB_IT_STRING ) : NULL; diff --git a/contrib/hbcairo/context.c b/contrib/hbcairo/context.c index de5e7af55e..1f5f34e33e 100644 --- a/contrib/hbcairo/context.c +++ b/contrib/hbcairo/context.c @@ -44,12 +44,10 @@ * */ - #include "hbcairo.h" #include "hbapiitm.h" #include "hbapierr.h" - HB_FUNC( CAIRO_CLIP ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -58,7 +56,6 @@ HB_FUNC( CAIRO_CLIP ) cairo_clip( pCairo ); } - HB_FUNC( CAIRO_CLIP_EXTENTS ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -77,7 +74,6 @@ HB_FUNC( CAIRO_CLIP_EXTENTS ) } } - HB_FUNC( CAIRO_CLIP_PRESERVE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -86,7 +82,6 @@ HB_FUNC( CAIRO_CLIP_PRESERVE ) cairo_clip_preserve( pCairo ); } - HB_FUNC( CAIRO_COPY_PAGE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -95,7 +90,6 @@ HB_FUNC( CAIRO_COPY_PAGE ) cairo_copy_page( pCairo ); } - HB_FUNC( CAIRO_CREATE ) { cairo_surface_t * pSurface = hb_cairo_surface_param( 1 ); @@ -104,7 +98,6 @@ HB_FUNC( CAIRO_CREATE ) hb_cairo_ret( cairo_create( pSurface ) ); } - HB_FUNC( CAIRO_FILL ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -113,7 +106,6 @@ HB_FUNC( CAIRO_FILL ) cairo_fill( pCairo ); } - HB_FUNC( CAIRO_FILL_PRESERVE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -122,7 +114,6 @@ HB_FUNC( CAIRO_FILL_PRESERVE ) cairo_fill_preserve( pCairo ); } - HB_FUNC( CAIRO_GET_DASH ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -147,7 +138,6 @@ HB_FUNC( CAIRO_GET_DASH ) } } - HB_FUNC( CAIRO_GET_LINE_WIDTH ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -156,7 +146,6 @@ HB_FUNC( CAIRO_GET_LINE_WIDTH ) hb_retnd( cairo_get_line_width( pCairo ) ); } - HB_FUNC( CAIRO_IN_FILL ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -165,7 +154,6 @@ HB_FUNC( CAIRO_IN_FILL ) hb_retl( cairo_in_fill( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ) ); } - HB_FUNC( CAIRO_IN_STROKE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -174,7 +162,6 @@ HB_FUNC( CAIRO_IN_STROKE ) hb_retl( cairo_in_stroke( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ) ); } - HB_FUNC( CAIRO_PAINT ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -183,7 +170,6 @@ HB_FUNC( CAIRO_PAINT ) cairo_paint( pCairo ); } - HB_FUNC( CAIRO_PAINT_WITH_ALPHA ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -192,7 +178,6 @@ HB_FUNC( CAIRO_PAINT_WITH_ALPHA ) cairo_paint_with_alpha( pCairo, hb_parnd( 2 ) ); } - HB_FUNC( CAIRO_RESET_CLIP ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -201,7 +186,6 @@ HB_FUNC( CAIRO_RESET_CLIP ) cairo_reset_clip( pCairo ); } - HB_FUNC( CAIRO_RESTORE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -210,7 +194,6 @@ HB_FUNC( CAIRO_RESTORE ) cairo_restore( pCairo ); } - HB_FUNC( CAIRO_SAVE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -219,7 +202,6 @@ HB_FUNC( CAIRO_SAVE ) cairo_save( pCairo ); } - HB_FUNC( CAIRO_SET_DASH ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -248,7 +230,6 @@ HB_FUNC( CAIRO_SET_DASH ) } } - HB_FUNC( CAIRO_SET_FILL_RULE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -257,7 +238,6 @@ HB_FUNC( CAIRO_SET_FILL_RULE ) cairo_set_fill_rule( pCairo, ( cairo_fill_rule_t ) hb_parni( 2 ) ); } - HB_FUNC( CAIRO_SET_LINE_CAP ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -266,7 +246,6 @@ HB_FUNC( CAIRO_SET_LINE_CAP ) cairo_set_line_cap( pCairo, ( cairo_line_cap_t ) hb_parni( 2 ) ); } - HB_FUNC( CAIRO_SET_LINE_JOIN ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -275,7 +254,6 @@ HB_FUNC( CAIRO_SET_LINE_JOIN ) cairo_set_line_join( pCairo, ( cairo_line_join_t ) hb_parni( 2 ) ); } - HB_FUNC( CAIRO_SET_LINE_WIDTH ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -284,7 +262,6 @@ HB_FUNC( CAIRO_SET_LINE_WIDTH ) cairo_set_line_width( pCairo, hb_parnd( 2 ) ); } - HB_FUNC( CAIRO_SET_MITER_LIMIT ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -293,7 +270,6 @@ HB_FUNC( CAIRO_SET_MITER_LIMIT ) cairo_set_miter_limit( pCairo, hb_parnd( 2 ) ); } - HB_FUNC( CAIRO_SET_OPERATOR ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -302,7 +278,6 @@ HB_FUNC( CAIRO_SET_OPERATOR ) cairo_set_operator( pCairo, ( cairo_operator_t ) hb_parni( 2 ) ); } - HB_FUNC( CAIRO_SET_SOURCE_RGB ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -311,7 +286,6 @@ HB_FUNC( CAIRO_SET_SOURCE_RGB ) cairo_set_source_rgb( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ) ); } - HB_FUNC( CAIRO_SET_SOURCE_RGBA ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -320,7 +294,6 @@ HB_FUNC( CAIRO_SET_SOURCE_RGBA ) cairo_set_source_rgba( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ); } - HB_FUNC( CAIRO_SET_TOLERANCE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -337,7 +310,6 @@ HB_FUNC( CAIRO_SHOW_PAGE ) cairo_show_page( pCairo ); } - HB_FUNC( CAIRO_STROKE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -346,7 +318,6 @@ HB_FUNC( CAIRO_STROKE ) cairo_stroke( pCairo ); } - HB_FUNC( CAIRO_STATUS ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -355,7 +326,6 @@ HB_FUNC( CAIRO_STATUS ) hb_retni( cairo_status( pCairo ) ); } - HB_FUNC( CAIRO_STROKE_EXTENTS ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -374,7 +344,6 @@ HB_FUNC( CAIRO_STROKE_EXTENTS ) } } - HB_FUNC( CAIRO_STROKE_PRESERVE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -383,7 +352,6 @@ HB_FUNC( CAIRO_STROKE_PRESERVE ) cairo_stroke_preserve( pCairo ); } - HB_FUNC( CAIRO_PUSH_GROUP ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -392,7 +360,6 @@ HB_FUNC( CAIRO_PUSH_GROUP ) cairo_push_group( pCairo ); } - HB_FUNC( CAIRO_POP_GROUP_TO_SOURCE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -401,7 +368,6 @@ HB_FUNC( CAIRO_POP_GROUP_TO_SOURCE ) cairo_pop_group_to_source( pCairo ); } - HB_FUNC( CAIRO_SET_SOURCE_SURFACE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -410,7 +376,6 @@ HB_FUNC( CAIRO_SET_SOURCE_SURFACE ) cairo_set_source_surface( pCairo, pSurface, hb_parnd( 3 ), hb_parnd( 4 ) ); } - HB_FUNC( CAIRO_SET_SOURCE ) { cairo_t * pCairo = hb_cairo_param( 1 ); diff --git a/contrib/hbcairo/core.c b/contrib/hbcairo/core.c index 20a3048392..15bf4fb9ab 100644 --- a/contrib/hbcairo/core.c +++ b/contrib/hbcairo/core.c @@ -48,8 +48,7 @@ #include "hbapiitm.h" #include "hbapierr.h" - -/* ============ cairo_t * support ============ */ +/* --- cairo_t * support --- */ static HB_GARBAGE_FUNC( hb_cairo_destructor ) { cairo_t ** ppCairo = ( cairo_t ** ) Cargo; @@ -67,7 +66,6 @@ static const HB_GC_FUNCS s_gcCairoFuncs = hb_gcDummyMark }; - cairo_t * hb_cairoItemGet( PHB_ITEM pItem ) { cairo_t ** ppCairo = ( cairo_t ** ) hb_itemGetPtrGC( pItem, &s_gcCairoFuncs ); @@ -75,7 +73,6 @@ cairo_t * hb_cairoItemGet( PHB_ITEM pItem ) return ppCairo ? *ppCairo : NULL; } - PHB_ITEM hb_cairoItemPut( PHB_ITEM pItem, cairo_t * pCairo ) { cairo_t ** ppCairo = ( cairo_t ** ) hb_gcAllocate( sizeof( cairo_t * ), &s_gcCairoFuncs ); @@ -84,7 +81,6 @@ PHB_ITEM hb_cairoItemPut( PHB_ITEM pItem, cairo_t * pCairo ) return hb_itemPutPtrGC( pItem, ppCairo ); } - cairo_t * hb_cairo_param( int iParam ) { cairo_t ** ppCairo = ( cairo_t ** ) hb_parptrGC( &s_gcCairoFuncs, iParam ); @@ -96,13 +92,11 @@ cairo_t * hb_cairo_param( int iParam ) return NULL; } - void hb_cairo_ret( cairo_t * pCairo ) { hb_cairoItemPut( hb_stackReturnItem(), pCairo ); } - HB_FUNC( CAIRO_DESTROY ) { cairo_t ** ppCairo = ( cairo_t ** ) hb_parptrGC( &s_gcCairoFuncs, 1 ); @@ -116,8 +110,7 @@ HB_FUNC( CAIRO_DESTROY ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - -/* ============ cairo_surface_t * support ============ */ +/* --- cairo_surface_t * support --- */ static HB_GARBAGE_FUNC( hb_cairo_surface_destructor ) { cairo_surface_t ** ppSurface = ( cairo_surface_t ** ) Cargo; @@ -135,7 +128,6 @@ static const HB_GC_FUNCS s_gcSurfaceFuncs = hb_gcDummyMark }; - cairo_surface_t * hb_cairoSurfaceItemGet( PHB_ITEM pItem ) { cairo_surface_t ** ppSurface = ( cairo_surface_t ** ) hb_itemGetPtrGC( pItem, &s_gcSurfaceFuncs ); @@ -143,7 +135,6 @@ cairo_surface_t * hb_cairoSurfaceItemGet( PHB_ITEM pItem ) return ppSurface ? *ppSurface : NULL; } - PHB_ITEM hb_cairoSurfaceItemPut( PHB_ITEM pItem, cairo_surface_t * pSurface ) { cairo_surface_t ** ppSurface = ( cairo_surface_t ** ) hb_gcAllocate( sizeof( cairo_surface_t * ), &s_gcSurfaceFuncs ); @@ -152,7 +143,6 @@ PHB_ITEM hb_cairoSurfaceItemPut( PHB_ITEM pItem, cairo_surface_t * pSurface ) return hb_itemPutPtrGC( pItem, ppSurface ); } - void hb_cairoSurfaceStor( cairo_surface_t * pSurface, int iParam ) { cairo_surface_t ** ppSurface = ( cairo_surface_t ** ) hb_gcAllocate( sizeof( cairo_surface_t * ), &s_gcSurfaceFuncs ); @@ -161,7 +151,6 @@ void hb_cairoSurfaceStor( cairo_surface_t * pSurface, int iParam ) hb_storptrGC( ppSurface, iParam ); } - cairo_surface_t * hb_cairo_surface_param( int iParam ) { cairo_surface_t ** ppSurface = ( cairo_surface_t ** ) hb_parptrGC( &s_gcSurfaceFuncs, iParam ); @@ -173,13 +162,11 @@ cairo_surface_t * hb_cairo_surface_param( int iParam ) return NULL; } - void hb_cairo_surface_ret( cairo_surface_t * pSurface ) { hb_cairoSurfaceItemPut( hb_stackReturnItem(), pSurface ); } - HB_FUNC( CAIRO_SURFACE_DESTROY ) { cairo_surface_t ** ppSurface = ( cairo_surface_t ** ) hb_parptrGC( &s_gcSurfaceFuncs, 1 ); @@ -193,8 +180,7 @@ HB_FUNC( CAIRO_SURFACE_DESTROY ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - -/* ============ cairo_path_t * support ============ */ +/* --- cairo_path_t * support --- */ static HB_GARBAGE_FUNC( hb_cairo_path_destructor ) { cairo_path_t ** ppPath = ( cairo_path_t ** ) Cargo; @@ -212,7 +198,6 @@ static const HB_GC_FUNCS s_gcPathFuncs = hb_gcDummyMark }; - cairo_path_t * hb_cairoPathItemGet( PHB_ITEM pItem ) { cairo_path_t ** ppPath = ( cairo_path_t ** ) hb_itemGetPtrGC( pItem, &s_gcPathFuncs ); @@ -220,7 +205,6 @@ cairo_path_t * hb_cairoPathItemGet( PHB_ITEM pItem ) return ppPath ? *ppPath : NULL; } - PHB_ITEM hb_cairoPathItemPut( PHB_ITEM pItem, cairo_path_t * pPath ) { cairo_path_t ** ppPath = ( cairo_path_t ** ) hb_gcAllocate( sizeof( cairo_path_t * ), &s_gcPathFuncs ); @@ -229,7 +213,6 @@ PHB_ITEM hb_cairoPathItemPut( PHB_ITEM pItem, cairo_path_t * pPath ) return hb_itemPutPtrGC( pItem, ppPath ); } - cairo_path_t * hb_cairo_path_param( int iParam ) { cairo_path_t ** ppPath = ( cairo_path_t ** ) hb_parptrGC( &s_gcPathFuncs, iParam ); @@ -241,13 +224,11 @@ cairo_path_t * hb_cairo_path_param( int iParam ) return NULL; } - void hb_cairo_path_ret( cairo_path_t * pPath ) { hb_cairoPathItemPut( hb_stackReturnItem(), pPath ); } - HB_FUNC( CAIRO_PATH_DESTROY ) { cairo_path_t ** ppPath = ( cairo_path_t ** ) hb_parptrGC( &s_gcPathFuncs, 1 ); @@ -261,13 +242,10 @@ HB_FUNC( CAIRO_PATH_DESTROY ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } +/* --- cairo_path_t * iterator support --- */ -/* ============ cairo_path_t * iterator support ============ */ - -/* - * NOTE: Path iterator functions are is not cairo functions. - * This is only a way to pass path data to .prg level - */ +/* NOTE: Path iterator functions are is not cairo functions. + This is only a way to pass path data to .prg level */ typedef struct { @@ -275,7 +253,6 @@ typedef struct int iPos; } HB_CAIRO_PATH_ITERATOR, * PHB_CAIRO_PATH_ITERATOR; - static HB_GARBAGE_FUNC( hb_cairo_path_iterator_destructor ) { PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) Cargo; @@ -287,7 +264,6 @@ static HB_GARBAGE_FUNC( hb_cairo_path_iterator_destructor ) } } - static HB_GARBAGE_FUNC( hb_cairo_path_iterator_mark ) { PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) Cargo; @@ -296,14 +272,12 @@ static HB_GARBAGE_FUNC( hb_cairo_path_iterator_mark ) hb_gcMark( pIterator->ppPath ); } - static const HB_GC_FUNCS s_gcIteratorFuncs = { hb_cairo_path_iterator_destructor, hb_cairo_path_iterator_mark }; - HB_FUNC( CAIRO_PATH_ITERATOR_CREATE ) { cairo_path_t ** ppPath = ( cairo_path_t ** ) hb_parptrGC( &s_gcPathFuncs, 1 ); @@ -320,7 +294,6 @@ HB_FUNC( CAIRO_PATH_ITERATOR_CREATE ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - HB_FUNC( CAIRO_PATH_ITERATOR_DESTROY ) { PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 ); @@ -334,7 +307,6 @@ HB_FUNC( CAIRO_PATH_ITERATOR_DESTROY ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - HB_FUNC( CAIRO_PATH_ITERATOR_NEXT ) { PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 ); @@ -358,7 +330,6 @@ HB_FUNC( CAIRO_PATH_ITERATOR_NEXT ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - HB_FUNC( CAIRO_PATH_ITERATOR_GET_POINTS ) { PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 ); @@ -366,18 +337,18 @@ HB_FUNC( CAIRO_PATH_ITERATOR_GET_POINTS ) if( pIterator && pIterator->ppPath && ( pPath = *( pIterator->ppPath ) ) != NULL ) { - cairo_path_data_t * pData; - if( pIterator->iPos < pPath->num_data && pIterator->iPos != -1 ) { - PHB_ITEM pItem, pArray; + cairo_path_data_t * pData; + PHB_ITEM pArray; int i; pData = pPath->data + pIterator->iPos; pArray = hb_itemArrayNew( pData->header.length - 1 ); for( i = 1; i < pData->header.length; i++ ) { - hb_arrayNew( pItem = hb_arrayGetItemPtr( pArray, i ), 2 ); + PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, i ); + hb_arrayNew( pItem, 2 ); hb_arraySetND( pItem, 1, pData[ i ].point.x ); hb_arraySetND( pItem, 2, pData[ i ].point.y ); } @@ -390,7 +361,6 @@ HB_FUNC( CAIRO_PATH_ITERATOR_GET_POINTS ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - HB_FUNC( CAIRO_PATH_ITERATOR_SET_POINTS ) { PHB_CAIRO_PATH_ITERATOR pIterator = ( PHB_CAIRO_PATH_ITERATOR ) hb_parptrGC( &s_gcIteratorFuncs, 1 ); @@ -399,20 +369,19 @@ HB_FUNC( CAIRO_PATH_ITERATOR_SET_POINTS ) if( pIterator && pIterator->ppPath && ( pPath = *( pIterator->ppPath ) ) != NULL && pArray ) { - cairo_path_data_t * pData; HB_SIZE nLen; nLen = hb_arrayLen( pArray ); if( pIterator->iPos < pPath->num_data && pIterator->iPos != -1 && ( HB_SIZE ) pPath->data[ pIterator->iPos ].header.length == nLen + 1 ) { - PHB_ITEM pItem; - int i; + cairo_path_data_t * pData; + int i; pData = pPath->data + pIterator->iPos; for( i = 1; i < pData->header.length; i++ ) { - pItem = hb_arrayGetItemPtr( pArray, i ); + PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, i ); if( hb_arrayLen( pItem ) == 2 ) { pData[ i ].point.x = hb_arrayGetND( pItem, 1 ); diff --git a/contrib/hbcairo/image.c b/contrib/hbcairo/image.c index 83b45f28c9..432fe9ca8b 100644 --- a/contrib/hbcairo/image.c +++ b/contrib/hbcairo/image.c @@ -44,10 +44,8 @@ * */ - #include "hbcairo.h" - HB_FUNC( CAIRO_IMAGE_SURFACE_CREATE ) { #ifdef CAIRO_HAS_IMAGE_SURFACE diff --git a/contrib/hbcairo/paths.c b/contrib/hbcairo/paths.c index 2ebaaba351..9220594538 100644 --- a/contrib/hbcairo/paths.c +++ b/contrib/hbcairo/paths.c @@ -44,11 +44,9 @@ * */ - #include "hbcairo.h" #include "hbapistr.h" - HB_FUNC( CAIRO_APPEND_PATH ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -58,7 +56,6 @@ HB_FUNC( CAIRO_APPEND_PATH ) cairo_append_path( pCairo, pPath ); } - HB_FUNC( CAIRO_ARC ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -67,7 +64,6 @@ HB_FUNC( CAIRO_ARC ) cairo_arc( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) ); } - HB_FUNC( CAIRO_ARC_NEGATIVE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -76,7 +72,6 @@ HB_FUNC( CAIRO_ARC_NEGATIVE ) cairo_arc_negative( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) ); } - HB_FUNC( CAIRO_CLOSE_PATH ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -85,7 +80,6 @@ HB_FUNC( CAIRO_CLOSE_PATH ) cairo_close_path( pCairo ); } - HB_FUNC( CAIRO_COPY_PATH ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -94,7 +88,6 @@ HB_FUNC( CAIRO_COPY_PATH ) hb_cairo_path_ret( cairo_copy_path( pCairo ) ); } - HB_FUNC( CAIRO_COPY_PATH_FLAT ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -103,7 +96,6 @@ HB_FUNC( CAIRO_COPY_PATH_FLAT ) hb_cairo_path_ret( cairo_copy_path_flat( pCairo ) ); } - HB_FUNC( CAIRO_CURVE_TO ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -112,7 +104,6 @@ HB_FUNC( CAIRO_CURVE_TO ) cairo_curve_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ), hb_parnd( 7 ) ); } - HB_FUNC( CAIRO_GET_CURRENT_POINT ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -128,7 +119,6 @@ HB_FUNC( CAIRO_GET_CURRENT_POINT ) } } - HB_FUNC( CAIRO_HAS_CURRENT_POINT ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -139,7 +129,6 @@ HB_FUNC( CAIRO_HAS_CURRENT_POINT ) } } - HB_FUNC( CAIRO_LINE_TO ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -148,7 +137,6 @@ HB_FUNC( CAIRO_LINE_TO ) cairo_line_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ); } - HB_FUNC( CAIRO_MOVE_TO ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -157,7 +145,6 @@ HB_FUNC( CAIRO_MOVE_TO ) cairo_move_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ); } - HB_FUNC( CAIRO_NEW_PATH ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -166,7 +153,6 @@ HB_FUNC( CAIRO_NEW_PATH ) cairo_new_path( pCairo ); } - HB_FUNC( CAIRO_PATH_EXTENTS ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -185,7 +171,6 @@ HB_FUNC( CAIRO_PATH_EXTENTS ) } } - HB_FUNC( CAIRO_RECTANGLE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -194,7 +179,6 @@ HB_FUNC( CAIRO_RECTANGLE ) cairo_rectangle( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ); } - HB_FUNC( CAIRO_REL_CURVE_TO ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -203,7 +187,6 @@ HB_FUNC( CAIRO_REL_CURVE_TO ) cairo_rel_curve_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ), hb_parnd( 7 ) ); } - HB_FUNC( CAIRO_REL_LINE_TO ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -212,7 +195,6 @@ HB_FUNC( CAIRO_REL_LINE_TO ) cairo_rel_line_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ); } - HB_FUNC( CAIRO_REL_MOVE_TO ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -221,7 +203,6 @@ HB_FUNC( CAIRO_REL_MOVE_TO ) cairo_rel_move_to( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ); } - HB_FUNC( CAIRO_TEXT_PATH ) { cairo_t * pCairo = hb_cairo_param( 1 ); diff --git a/contrib/hbcairo/pattern.c b/contrib/hbcairo/pattern.c index 8a8c4f96ad..f3e1f8b718 100644 --- a/contrib/hbcairo/pattern.c +++ b/contrib/hbcairo/pattern.c @@ -44,13 +44,11 @@ * */ - #include "hbcairo.h" #include "hbapiitm.h" #include "hbapierr.h" - -/* ============ cairo_pattern_t * support ============ */ +/* --- cairo_pattern_t * support --- */ static HB_GARBAGE_FUNC( hb_cairo_pattern_destructor ) { cairo_pattern_t ** ppPattern = ( cairo_pattern_t ** ) Cargo; @@ -62,14 +60,12 @@ static HB_GARBAGE_FUNC( hb_cairo_pattern_destructor ) } } - static const HB_GC_FUNCS s_gcPatternFuncs = { hb_cairo_pattern_destructor, hb_gcDummyMark }; - cairo_pattern_t * hb_cairoPatternItemGet( PHB_ITEM pItem ) { cairo_pattern_t ** ppPattern = ( cairo_pattern_t ** ) hb_itemGetPtrGC( pItem, &s_gcPatternFuncs ); @@ -77,7 +73,6 @@ cairo_pattern_t * hb_cairoPatternItemGet( PHB_ITEM pItem ) return ppPattern ? *ppPattern : NULL; } - PHB_ITEM hb_cairoPatternItemPut( PHB_ITEM pItem, cairo_pattern_t * pPattern ) { cairo_pattern_t ** ppPattern = ( cairo_pattern_t ** ) hb_gcAllocate( sizeof( cairo_pattern_t * ), &s_gcPatternFuncs ); @@ -86,7 +81,6 @@ PHB_ITEM hb_cairoPatternItemPut( PHB_ITEM pItem, cairo_pattern_t * pPattern ) return hb_itemPutPtrGC( pItem, ppPattern ); } - cairo_pattern_t * hb_cairo_pattern_param( int iParam ) { cairo_pattern_t ** ppPattern = ( cairo_pattern_t ** ) hb_parptrGC( &s_gcPatternFuncs, iParam ); @@ -98,13 +92,11 @@ cairo_pattern_t * hb_cairo_pattern_param( int iParam ) return NULL; } - void hb_cairo_pattern_ret( cairo_pattern_t * pPattern ) { hb_cairoPatternItemPut( hb_stackReturnItem(), pPattern ); } - HB_FUNC( CAIRO_PATTERN_DESTROY ) { cairo_pattern_t ** ppPattern = ( cairo_pattern_t ** ) hb_parptrGC( &s_gcPatternFuncs, 1 ); @@ -118,7 +110,6 @@ HB_FUNC( CAIRO_PATTERN_DESTROY ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - HB_FUNC( CAIRO_PATTERN_ADD_COLOR_STOP_RGB ) { cairo_pattern_t * pPattern = hb_cairo_pattern_param( 1 ); @@ -127,7 +118,6 @@ HB_FUNC( CAIRO_PATTERN_ADD_COLOR_STOP_RGB ) cairo_pattern_add_color_stop_rgb( pPattern, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ); } - HB_FUNC( CAIRO_PATTERN_ADD_COLOR_STOP_RGBA ) { cairo_pattern_t * pPattern = hb_cairo_pattern_param( 1 ); @@ -136,7 +126,6 @@ HB_FUNC( CAIRO_PATTERN_ADD_COLOR_STOP_RGBA ) cairo_pattern_add_color_stop_rgba( pPattern, hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) ); } - HB_FUNC( CAIRO_PATTERN_GET_COLOR_STOP_COUNT ) { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE( 1, 4, 0 ) @@ -157,7 +146,6 @@ HB_FUNC( CAIRO_PATTERN_GET_COLOR_STOP_COUNT ) #endif } - HB_FUNC( CAIRO_PATTERN_GET_COLOR_STOP_RGBA ) { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE( 1, 4, 0 ) @@ -187,19 +175,16 @@ HB_FUNC( CAIRO_PATTERN_GET_COLOR_STOP_RGBA ) #endif } - HB_FUNC( CAIRO_PATTERN_CREATE_RGB ) { hb_cairo_pattern_ret( cairo_pattern_create_rgb( hb_parnd( 1 ), hb_parnd( 2 ), hb_parnd( 3 ) ) ); } - HB_FUNC( CAIRO_PATTERN_CREATE_RGBA ) { hb_cairo_pattern_ret( cairo_pattern_create_rgba( hb_parnd( 1 ), hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 3 ) ) ); } - HB_FUNC( CAIRO_PATTERN_GET_RGBA ) { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE( 1, 4, 0 ) @@ -227,13 +212,11 @@ HB_FUNC( CAIRO_PATTERN_GET_RGBA ) #endif } - HB_FUNC( CAIRO_PATTERN_CREATE_FOR_SURFACE ) { hb_cairo_pattern_ret( cairo_pattern_create_for_surface( hb_cairo_surface_param( 1 ) ) ); } - HB_FUNC( CAIRO_PATTERN_GET_SURFACE ) { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE( 1, 4, 0 ) @@ -255,13 +238,11 @@ HB_FUNC( CAIRO_PATTERN_GET_SURFACE ) #endif } - HB_FUNC( CAIRO_PATTERN_CREATE_LINEAR ) { hb_cairo_pattern_ret( cairo_pattern_create_linear( hb_parnd( 1 ), hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ) ) ); } - HB_FUNC( CAIRO_PATTERN_GET_LINEAR_POINTS ) { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE( 1, 4, 0 ) @@ -289,13 +270,11 @@ HB_FUNC( CAIRO_PATTERN_GET_LINEAR_POINTS ) #endif } - HB_FUNC( CAIRO_PATTERN_CREATE_RADIAL ) { hb_cairo_pattern_ret( cairo_pattern_create_radial( hb_parnd( 1 ), hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) ) ); } - HB_FUNC( CAIRO_PATTERN_GET_RADIAL_CIRCLES ) { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE( 1, 4, 0 ) @@ -327,7 +306,6 @@ HB_FUNC( CAIRO_PATTERN_GET_RADIAL_CIRCLES ) #endif } - HB_FUNC( CAIRO_PATTERN_STATUS ) { cairo_pattern_t * pPattern = hb_cairo_pattern_param( 1 ); diff --git a/contrib/hbcairo/pdf.c b/contrib/hbcairo/pdf.c index 5cff0b3d7c..dc6cfd5550 100644 --- a/contrib/hbcairo/pdf.c +++ b/contrib/hbcairo/pdf.c @@ -44,11 +44,9 @@ * */ - #include "hbcairo.h" #include "cairo-pdf.h" - HB_FUNC( CAIRO_PDF_SURFACE_CREATE ) { #ifdef CAIRO_HAS_PDF_SURFACE @@ -58,7 +56,6 @@ HB_FUNC( CAIRO_PDF_SURFACE_CREATE ) #endif } - HB_FUNC( CAIRO_PDF_SURFACE_SET_SIZE ) { #ifdef CAIRO_HAS_PDF_SURFACE diff --git a/contrib/hbcairo/png.c b/contrib/hbcairo/png.c index a0603551c9..551e4dc9ea 100644 --- a/contrib/hbcairo/png.c +++ b/contrib/hbcairo/png.c @@ -44,10 +44,8 @@ * */ - #include "hbcairo.h" - HB_FUNC( CAIRO_IMAGE_SURFACE_CREATE_FROM_PNG ) { #ifdef CAIRO_HAS_PNG_FUNCTIONS @@ -57,7 +55,6 @@ HB_FUNC( CAIRO_IMAGE_SURFACE_CREATE_FROM_PNG ) #endif } - HB_FUNC( CAIRO_SURFACE_WRITE_TO_PNG ) { #ifdef CAIRO_HAS_PNG_FUNCTIONS diff --git a/contrib/hbcairo/ps.c b/contrib/hbcairo/ps.c index fd67752f7b..d7e2634d24 100644 --- a/contrib/hbcairo/ps.c +++ b/contrib/hbcairo/ps.c @@ -44,11 +44,9 @@ * */ - #include "hbcairo.h" #include "cairo-ps.h" - HB_FUNC( CAIRO_PS_SURFACE_CREATE ) { #ifdef CAIRO_HAS_PS_SURFACE @@ -58,7 +56,6 @@ HB_FUNC( CAIRO_PS_SURFACE_CREATE ) #endif } - HB_FUNC( CAIRO_PS_SURFACE_SET_SIZE ) { #ifdef CAIRO_HAS_PS_SURFACE @@ -71,7 +68,6 @@ HB_FUNC( CAIRO_PS_SURFACE_SET_SIZE ) #endif } - HB_FUNC( CAIRO_PS_SURFACE_SET_EPS ) { #ifdef CAIRO_HAS_PS_SURFACE @@ -84,7 +80,6 @@ HB_FUNC( CAIRO_PS_SURFACE_SET_EPS ) #endif } - HB_FUNC( CAIRO_PS_SURFACE_GET_EPS ) { #ifdef CAIRO_HAS_PS_SURFACE diff --git a/contrib/hbcairo/surface.c b/contrib/hbcairo/surface.c index 9b74e80f23..1e1058f582 100644 --- a/contrib/hbcairo/surface.c +++ b/contrib/hbcairo/surface.c @@ -44,10 +44,8 @@ * */ - #include "hbcairo.h" - HB_FUNC( CAIRO_SURFACE_STATUS ) { cairo_surface_t * pSurface = hb_cairo_surface_param( 1 ); diff --git a/contrib/hbcairo/text.c b/contrib/hbcairo/text.c index 548ec63ca0..46656238f1 100644 --- a/contrib/hbcairo/text.c +++ b/contrib/hbcairo/text.c @@ -44,12 +44,10 @@ * */ - #include "hbcairo.h" #include "hbapistr.h" #include "hbapierr.h" - HB_FUNC( CAIRO_FONT_EXTENTS ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -69,7 +67,6 @@ HB_FUNC( CAIRO_FONT_EXTENTS ) } } - HB_FUNC( CAIRO_GET_FONT_MATRIX ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -90,7 +87,6 @@ HB_FUNC( CAIRO_GET_FONT_MATRIX ) } } - HB_FUNC( CAIRO_SELECT_FONT_FACE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -103,7 +99,6 @@ HB_FUNC( CAIRO_SELECT_FONT_FACE ) } } - HB_FUNC( CAIRO_SET_FONT_MATRIX ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -128,7 +123,6 @@ HB_FUNC( CAIRO_SET_FONT_MATRIX ) } } - HB_FUNC( CAIRO_SET_FONT_SIZE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -137,7 +131,6 @@ HB_FUNC( CAIRO_SET_FONT_SIZE ) cairo_set_font_size( pCairo, hb_parnd( 2 ) ); } - HB_FUNC( CAIRO_SHOW_TEXT ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -150,7 +143,6 @@ HB_FUNC( CAIRO_SHOW_TEXT ) } } - HB_FUNC( CAIRO_TEXT_EXTENTS ) { cairo_t * pCairo = hb_cairo_param( 1 ); diff --git a/contrib/hbcairo/transfor.c b/contrib/hbcairo/transfor.c index 3e68d1e731..a565a47368 100644 --- a/contrib/hbcairo/transfor.c +++ b/contrib/hbcairo/transfor.c @@ -44,12 +44,10 @@ * */ - #include "hbcairo.h" #include "hbapiitm.h" #include "hbapierr.h" - HB_FUNC( CAIRO_GET_MATRIX ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -70,7 +68,6 @@ HB_FUNC( CAIRO_GET_MATRIX ) } } - HB_FUNC( CAIRO_IDENTITY_MATRIX ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -79,7 +76,6 @@ HB_FUNC( CAIRO_IDENTITY_MATRIX ) cairo_identity_matrix( pCairo ); } - HB_FUNC( CAIRO_ROTATE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -88,7 +84,6 @@ HB_FUNC( CAIRO_ROTATE ) cairo_rotate( pCairo, hb_parnd( 2 ) ); } - HB_FUNC( CAIRO_SET_MATRIX ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -113,7 +108,6 @@ HB_FUNC( CAIRO_SET_MATRIX ) } } - HB_FUNC( CAIRO_SCALE ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -122,7 +116,6 @@ HB_FUNC( CAIRO_SCALE ) cairo_scale( pCairo, hb_parnd( 2 ), hb_parnd( 3 ) ); } - HB_FUNC( CAIRO_TRANSFORM ) { cairo_t * pCairo = hb_cairo_param( 1 ); @@ -147,7 +140,6 @@ HB_FUNC( CAIRO_TRANSFORM ) } } - HB_FUNC( CAIRO_TRANSLATE ) { cairo_t * pCairo = hb_cairo_param( 1 ); diff --git a/contrib/hbcairo/util.c b/contrib/hbcairo/util.c index 18cede3edc..bd1a33fb89 100644 --- a/contrib/hbcairo/util.c +++ b/contrib/hbcairo/util.c @@ -44,22 +44,18 @@ * */ - #include "hbcairo.h" - HB_FUNC( CAIRO_STATUS_TO_STRING ) { hb_retc( cairo_status_to_string( ( cairo_status_t ) hb_parni( 1 ) ) ); } - HB_FUNC( CAIRO_VERSION ) { hb_retni( cairo_version() ); } - HB_FUNC( CAIRO_VERSION_STRING ) { hb_retc( cairo_version_string() ); diff --git a/contrib/hbcomio/comio.c b/contrib/hbcomio/comio.c index b5d03c651d..ae9f60129e 100644 --- a/contrib/hbcomio/comio.c +++ b/contrib/hbcomio/comio.c @@ -62,8 +62,7 @@ typedef struct _HB_FILE HB_MAXINT timeout; HB_BOOL fRead; HB_BOOL fWrite; -} -HB_FILE; +} HB_FILE; static PHB_FILE s_fileNew( int port, HB_MAXINT timeout, HB_BOOL fRead, HB_BOOL fWrite ); diff --git a/contrib/hbct/addascii.c b/contrib/hbct/addascii.c index 528ba34431..2d8c2d0ee0 100644 --- a/contrib/hbct/addascii.c +++ b/contrib/hbct/addascii.c @@ -87,11 +87,10 @@ HB_FUNC( ADDASCII ) if( iCarryOver ) { HB_SIZE sCurrent; - HB_LONG lResult; for( sCurrent = sPos; sCurrent > 0 && lValue != 0; sCurrent-- ) { - lResult = ( HB_LONG ) pcSource[ sCurrent - 1 ] + ( lValue % 256 ); + HB_LONG lResult = ( HB_LONG ) pcSource[ sCurrent - 1 ] + ( lValue % 256 ); lValue /= 256; if( lResult > 255 ) diff --git a/contrib/hbct/atnum.c b/contrib/hbct/atnum.c index b92db1f88c..20b89561bc 100644 --- a/contrib/hbct/atnum.c +++ b/contrib/hbct/atnum.c @@ -1,6 +1,5 @@ /* * CT3 string functions - * * - AfterAtNum() * - BeforAtNum() * - AtNum() diff --git a/contrib/hbct/atrepl.c b/contrib/hbct/atrepl.c index 1687fe8703..f8ad12743d 100644 --- a/contrib/hbct/atrepl.c +++ b/contrib/hbct/atrepl.c @@ -99,10 +99,10 @@ HB_FUNC( ATREPL ) if( nCounter != 0 ) { - /* depending on iReplaceMode: replace all occurences including the nth one - or only the nth occurence - NOTE: if iReplaceMode = false and the nth occurence does not exist, - all occurences are replaced */ + /* depending on iReplaceMode: replace all occurrences including the nth one + or only the nth occurrence + NOTE: if iReplaceMode = false and the nth occurrence does not exist, + all occurrences are replaced */ char * pcRetSubStr; HB_SIZE sRetSubStrLen; HB_SIZE nMatchCounter = 0; @@ -141,7 +141,7 @@ HB_FUNC( ATREPL ) nMatchCounter++; /* replace match ? */ - if( ( iReplaceMode == 0 ) || ( nMatchCounter == nCounter ) ) + if( iReplaceMode == 0 || nMatchCounter == nCounter ) { if( nMatchStrLen < nReplaceLen ) { diff --git a/contrib/hbct/bitnum.c b/contrib/hbct/bitnum.c index fad7493233..559684d851 100644 --- a/contrib/hbct/bitnum.c +++ b/contrib/hbct/bitnum.c @@ -89,11 +89,13 @@ HB_BOOL ct_numParam( int iParam, HB_MAXINT * plNum ) HB_FUNC( NUMAND ) { - int iPCount = hb_pcount(), i = 1; + int iPCount = hb_pcount(); HB_MAXINT lValue = -1, lNext = 0; if( iPCount && ct_numParam( 1, &lValue ) ) { + int i = 1; + while( --iPCount && ct_numParam( ++i, &lNext ) ) lValue &= lNext; @@ -105,11 +107,13 @@ HB_FUNC( NUMAND ) HB_FUNC( NUMOR ) { - int iPCount = hb_pcount(), i = 1; + int iPCount = hb_pcount(); HB_MAXINT lValue = -1, lNext = 0; if( iPCount && ct_numParam( 1, &lValue ) ) { + int i = 1; + while( --iPCount && ct_numParam( ++i, &lNext ) ) lValue |= lNext; @@ -121,11 +125,13 @@ HB_FUNC( NUMOR ) HB_FUNC( NUMXOR ) { - int iPCount = hb_pcount(), i = 1; + int iPCount = hb_pcount(); HB_MAXINT lValue = -1, lNext = 0; if( iPCount && ct_numParam( 1, &lValue ) ) { + int i = 1; + while( --iPCount && ct_numParam( ++i, &lNext ) ) lValue ^= lNext; @@ -218,14 +224,16 @@ HB_FUNC( NUMMIRR ) HB_FUNC( CLEARBIT ) { - int iPCount = hb_pcount(), iBit, i = 1; + int iPCount = hb_pcount(); HB_MAXINT lValue; if( ct_numParam( 1, &lValue ) ) { + int i = 1; + while( --iPCount ) { - iBit = hb_parni( ++i ); + int iBit = hb_parni( ++i ); if( iBit < 1 || iBit > 64 ) break; lValue &= ~( ( ( HB_MAXINT ) 1 ) << ( iBit - 1 ) ); @@ -240,14 +248,16 @@ HB_FUNC( CLEARBIT ) HB_FUNC( SETBIT ) { - int iPCount = hb_pcount(), iBit, i = 1; + int iPCount = hb_pcount(); HB_MAXINT lValue; if( ct_numParam( 1, &lValue ) ) { + int i = 1; + while( --iPCount ) { - iBit = hb_parni( ++i ); + int iBit = hb_parni( ++i ); if( iBit < 1 || iBit > 64 ) break; lValue |= ( ( HB_MAXINT ) 1 ) << ( iBit - 1 ); diff --git a/contrib/hbct/bitstr.c b/contrib/hbct/bitstr.c index 5420a0a48c..983f89bee6 100644 --- a/contrib/hbct/bitstr.c +++ b/contrib/hbct/bitstr.c @@ -49,14 +49,17 @@ HB_FUNC( CTOBIT ) { - HB_SIZE nString = hb_parclen( 1 ), nPattern, n; + HB_SIZE nString = hb_parclen( 1 ); int iResult = 0; if( nString > 0 ) { - nPattern = hb_parclen( 2 ); + HB_SIZE nPattern = hb_parclen( 2 ); + if( nPattern >= 1 && nPattern <= 16 ) { + HB_SIZE n; + const char * pszString = hb_parc( 1 ), * pszPattern = hb_parc( 2 ); @@ -101,7 +104,7 @@ HB_FUNC( BITTOC ) { while( nPattern-- > 0 ) { - *--pszResult = iValue & 1 ? pszPattern[ nPattern ] : ' '; + *--pszResult = ( iValue & 1 ) ? pszPattern[ nPattern ] : ' '; ++iLen; iValue >>= 1; } diff --git a/contrib/hbct/blank.c b/contrib/hbct/blank.c index 37c3dec1ba..5a025cff60 100644 --- a/contrib/hbct/blank.c +++ b/contrib/hbct/blank.c @@ -2,7 +2,6 @@ * CT3 Blank() function * * Copyright 2009 Pavel Tsarenko - * http://www.xharbour.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +90,8 @@ HB_FUNC( BLANK ) HB_SIZE nLen = hb_itemGetCLen( pItem ); char * szResult = ( char * ) hb_xgrab( nLen + 1 ); - hb_xmemset( szResult, ' ', nLen ); + if( nLen > 0 ) + hb_xmemset( szResult, ' ', nLen ); if( bRef ) hb_storclen( szResult, nLen, 1 ); if( bRet ) diff --git a/contrib/hbct/charlihb.c b/contrib/hbct/charlihb.c index 3957ba140c..1b82060b2a 100644 --- a/contrib/hbct/charlihb.c +++ b/contrib/hbct/charlihb.c @@ -49,12 +49,12 @@ #include "ct.h" -HB_FUNC( CHARSLIST ) /* HB_EXTENSION */ +HB_FUNC( CHARSLIST ) /* HB_EXTENSION */ { ct_charlist( CT_CHARLIST_CHARSLIST ); } -HB_FUNC( CHARHIST ) /* HB_EXTENSION */ +HB_FUNC( CHARHIST ) /* HB_EXTENSION */ { ct_charlist( CT_CHARLIST_CHARHIST ); } diff --git a/contrib/hbct/charlist.c b/contrib/hbct/charlist.c index 37f4b05074..b2e144674c 100644 --- a/contrib/hbct/charlist.c +++ b/contrib/hbct/charlist.c @@ -106,7 +106,6 @@ void ct_charlist( int iMode ) if( acCharCnt[ sCnt ] == cScan ) acCharCnt[ sRetStrLen++ ] = ( HB_UCHAR ) sCnt; } - } hb_retclen( acCharCnt, sRetStrLen ); } diff --git a/contrib/hbct/charmirr.c b/contrib/hbct/charmirr.c index baa3f09257..6156984741 100644 --- a/contrib/hbct/charmirr.c +++ b/contrib/hbct/charmirr.c @@ -82,7 +82,7 @@ HB_FUNC( CHARMIRR ) if( iDontMirrorSpaces ) { pc2 = pcRet + sStrLen - 1; - while( ( pc1 >= pcString ) && ( *pc1 == 0x20 ) ) + while( pc1 >= pcString && *pc1 == 0x20 ) { *pc2 = 0x20; pc1--; diff --git a/contrib/hbct/charmix.c b/contrib/hbct/charmix.c index 3b45f21a0b..8a2a51af69 100644 --- a/contrib/hbct/charmix.c +++ b/contrib/hbct/charmix.c @@ -1,10 +1,9 @@ /* * CharMix() CT3 function * - * Initial code: Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * - * CT3 conformity: Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany - * Author: Martin Vogel + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (Initial code) + * Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany + * Author: Martin Vogel (CT3 conformity) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/contrib/hbct/charone.c b/contrib/hbct/charone.c index 7fb4344282..b9c8aafe76 100644 --- a/contrib/hbct/charone.c +++ b/contrib/hbct/charone.c @@ -56,14 +56,14 @@ /* helper function for the *one functions */ static void do_charone( int iSwitch ) { - const char * pcString; - HB_SIZE sStrLen; - const char * pcDeleteSet; - HB_SIZE sDeleteSetLen; - /* param check */ if( HB_ISCHAR( 1 ) ) { + const char * pcString; + const char * pcDeleteSet; + HB_SIZE sStrLen; + HB_SIZE sDeleteSetLen; + if( HB_ISCHAR( 2 ) ) { pcString = hb_parc( 2 ); @@ -161,7 +161,7 @@ static void do_charone( int iSwitch ) } } - /* copy last character if string len is odd */ + /* copy last character if string length is odd */ if( sStrLen & 1 ) pcRet[ sRetStrLen++ ] = pcString[ sStrLen - 1 ]; diff --git a/contrib/hbct/charonly.c b/contrib/hbct/charonly.c index e312b77770..3bc8f64b47 100644 --- a/contrib/hbct/charonly.c +++ b/contrib/hbct/charonly.c @@ -69,10 +69,10 @@ static void do_charonly( int iSwitch ) HB_SIZE sOnlySetLen = hb_parclen( 1 ); char * pcRet; HB_SIZE sRetStrLen = 0; - int iShift, iBool; - const char * pcSub, * pc; + int iShift; + const char * pcSub; - /* check for zero-length strings */ + /* check for zero-length strings */ switch( iSwitch ) { case DO_CHARONLY_CHARONLY: @@ -109,19 +109,17 @@ static void do_charonly( int iSwitch ) for( pcSub = pcString; pcSub < pcString + sStrLen + 1 - iShift; pcSub += iShift ) { - pc = ct_at_exact_forward( pcOnlySet, sOnlySetLen, pcSub, iShift, NULL ); - iBool = ( ( pc != NULL ) && ( ( ( pc - pcOnlySet ) % iShift ) == 0 ) ); - if( iBool ? ( iSwitch == DO_CHARONLY_CHARONLY || - iSwitch == DO_CHARONLY_WORDONLY ) - : ( iSwitch == DO_CHARONLY_CHARREM || - iSwitch == DO_CHARONLY_WORDREM ) ) + const char * pc = ct_at_exact_forward( pcOnlySet, sOnlySetLen, pcSub, iShift, NULL ); + HB_BOOL fBool = ( pc != NULL && ( ( pc - pcOnlySet ) % iShift ) == 0 ); + if( fBool ? iSwitch == DO_CHARONLY_CHARONLY || iSwitch == DO_CHARONLY_WORDONLY + : iSwitch == DO_CHARONLY_CHARREM || iSwitch == DO_CHARONLY_WORDREM ) { for( pc = pcSub; pc < pcSub + iShift; pc++ ) pcRet[ sRetStrLen++ ] = *pc; } } - /* copy last character if string len is odd */ + /* copy last character if string length is odd */ if( iShift == 2 && sStrLen % 2 == 1 ) pcRet[ sRetStrLen++ ] = pcString[ sStrLen - 1 ]; @@ -131,10 +129,12 @@ static void do_charonly( int iSwitch ) else { PHB_ITEM pSubst = NULL; - int iArgErrorMode = ct_getargerrormode(), iError = 0; + int iArgErrorMode = ct_getargerrormode(); if( iArgErrorMode != CT_ARGERR_IGNORE ) { + int iError = 0; + switch( iSwitch ) { case DO_CHARONLY_CHARONLY: diff --git a/contrib/hbct/charop.c b/contrib/hbct/charop.c index 28a69eaed9..02dc06e599 100644 --- a/contrib/hbct/charop.c +++ b/contrib/hbct/charop.c @@ -295,10 +295,11 @@ void ct_charop( int iMode ) { PHB_ITEM pSubst = NULL; int iArgErrorMode = ct_getargerrormode(); - int iError = 0; if( iArgErrorMode != CT_ARGERR_IGNORE ) { + int iError = 0; + switch( iMode ) { case CT_CHAROP_CHARADD: diff --git a/contrib/hbct/charophb.c b/contrib/hbct/charophb.c index cf0dda603b..3e5e60a2e2 100644 --- a/contrib/hbct/charophb.c +++ b/contrib/hbct/charophb.c @@ -52,27 +52,27 @@ #include "ct.h" -HB_FUNC( CHARSUB ) /* HB_EXTENSION */ +HB_FUNC( CHARSUB ) /* HB_EXTENSION */ { ct_charop( CT_CHAROP_CHARSUB ); } -HB_FUNC( CHARSHL ) /* HB_EXTENSION */ +HB_FUNC( CHARSHL ) /* HB_EXTENSION */ { ct_charop( CT_CHAROP_CHARSHL ); } -HB_FUNC( CHARSHR ) /* HB_EXTENSION */ +HB_FUNC( CHARSHR ) /* HB_EXTENSION */ { ct_charop( CT_CHAROP_CHARSHR ); } -HB_FUNC( CHARRLL ) /* HB_EXTENSION */ +HB_FUNC( CHARRLL ) /* HB_EXTENSION */ { ct_charop( CT_CHAROP_CHARRLL ); } -HB_FUNC( CHARRLR ) /* HB_EXTENSION */ +HB_FUNC( CHARRLR ) /* HB_EXTENSION */ { ct_charop( CT_CHAROP_CHARRLR ); } diff --git a/contrib/hbct/charrepl.c b/contrib/hbct/charrepl.c index 1aacedc87f..af71e9eb4f 100644 --- a/contrib/hbct/charrepl.c +++ b/contrib/hbct/charrepl.c @@ -83,7 +83,6 @@ HB_FUNC( CHARREPL ) for( sIndex = 0; sIndex < sSearchLen; sIndex++ ) { HB_SIZE sMatchStrLen; - const char * pc; HB_SIZE sReplIndex = sIndex; if( sReplIndex > sReplaceLen - 1 ) @@ -93,7 +92,7 @@ HB_FUNC( CHARREPL ) { /* no multiple replacements: searching in pcString, replacing in pcRet */ - pc = pcString; + const char * pc = pcString; while( ( pc = ct_at_exact_forward( pc, sStrLen - ( pc - pcString ), pcSearch + sIndex, 1, diff --git a/contrib/hbct/charswap.c b/contrib/hbct/charswap.c index bf0efd5a19..1d4f3823cf 100644 --- a/contrib/hbct/charswap.c +++ b/contrib/hbct/charswap.c @@ -54,7 +54,7 @@ #define DO_CHARSWAP_WORDSWAP 1 #define DO_CHARSWAP_WORDSWAP_CHARSWAP 2 -/* helper function for the charswap and wordswap functions */ +/* helper function for the CharSwap() and WordSwap() functions */ static void do_charswap( int iSwitch ) { /* suppress return value ? */ diff --git a/contrib/hbct/color.c b/contrib/hbct/color.c index 77c9511943..97a32b8acf 100644 --- a/contrib/hbct/color.c +++ b/contrib/hbct/color.c @@ -80,11 +80,12 @@ HB_FUNC( COLORTON ) HB_FUNC( NTOCOLOR ) { - char szColorString[ 10 ]; int iColor = hb_parnidef( 1, -1 ); if( iColor >= 0x00 && iColor <= 0xff ) { + char szColorString[ 10 ]; + if( hb_parl( 2 ) ) hb_gtColorsToString( &iColor, 1, szColorString, sizeof( szColorString ) ); else diff --git a/contrib/hbct/count.c b/contrib/hbct/count.c index dc4b7ec16c..2baba944f4 100644 --- a/contrib/hbct/count.c +++ b/contrib/hbct/count.c @@ -51,7 +51,7 @@ #define DO_COUNT_COUNTLEFT 0 #define DO_COUNT_COUNTRIGHT 1 -/* helper function for the countxxx functions */ +/* helper function for the Count*() functions */ static void do_count( int iSwitch ) { /* param check */ @@ -76,7 +76,7 @@ static void do_count( int iSwitch ) { case DO_COUNT_COUNTLEFT: pc = pcString; - while( ( *pc == cSearch ) && ( pc < pcString + sStrLen ) ) + while( *pc == cSearch && pc < ( pcString + sStrLen ) ) { sRetVal++; pc++; @@ -85,7 +85,7 @@ static void do_count( int iSwitch ) case DO_COUNT_COUNTRIGHT: pc = pcString + sStrLen - 1; - while( ( *pc == cSearch ) && ( pc >= pcString ) ) + while( *pc == cSearch && pc >= pcString ) { sRetVal++; pc--; diff --git a/contrib/hbct/ct.ch b/contrib/hbct/ct.ch index b2f2ff3e37..03c15cf784 100644 --- a/contrib/hbct/ct.ch +++ b/contrib/hbct/ct.ch @@ -45,12 +45,11 @@ * */ - #ifndef _CT_CH #define _CT_CH 1 /* subsystem name */ -#define CT_SUBSYSTEM "CT" +#define CT_SUBSYSTEM "CT" /* CSetArgErr() argument error behaviour */ #include "error.ch" diff --git a/contrib/hbct/ctcom.ch b/contrib/hbct/ctcom.ch index ee62713ace..8735f75bdc 100644 --- a/contrib/hbct/ctcom.ch +++ b/contrib/hbct/ctcom.ch @@ -1,5 +1,5 @@ /* - * constant values for CT3 serial communication com_*() functions + * Constant values for CT3 serial communication com_*() functions * * Copyright 2010 Przemyslaw Czerpak * diff --git a/contrib/hbct/ctcom1.c b/contrib/hbct/ctcom1.c index ff38a3609a..a6f0b959ba 100644 --- a/contrib/hbct/ctcom1.c +++ b/contrib/hbct/ctcom1.c @@ -77,63 +77,63 @@ static void hb_ctComTestMSR( int iLine ) hb_retl( fResult ); } -/* com_Count( ) -> +/* com_Count( ) --> */ HB_FUNC( COM_COUNT ) { hb_retni( hb_comInputCount( hb_parni( 1 ) ) ); } -/* com_SCount( ) -> +/* com_SCount( ) --> */ HB_FUNC( COM_SCOUNT ) { hb_retni( hb_comOutputCount( hb_parni( 1 ) ) ); } -/* com_Flush( ) -> +/* com_Flush( ) --> */ HB_FUNC( COM_FLUSH ) { hb_retl( hb_comFlush( hb_parni( 1 ), HB_COM_IFLUSH ) != -1 ); } -/* com_SFlush( ) -> +/* com_SFlush( ) --> */ HB_FUNC( COM_SFLUSH ) { hb_retl( hb_comFlush( hb_parni( 1 ), HB_COM_OFLUSH ) != -1 ); } -/* com_CTS( ) -> +/* com_CTS( ) --> */ HB_FUNC( COM_CTS ) { hb_ctComTestMSR( HB_COM_MSR_CTS ); } -/* com_DCD( ) -> +/* com_DCD( ) --> */ HB_FUNC( COM_DCD ) { hb_ctComTestMSR( HB_COM_MSR_DCD ); } -/* com_DSR( ) -> +/* com_DSR( ) --> */ HB_FUNC( COM_DSR ) { hb_ctComTestMSR( HB_COM_MSR_DSR ); } -/* com_Ring( ) -> +/* com_Ring( ) --> */ HB_FUNC( COM_RING ) { hb_ctComTestMSR( HB_COM_MSR_RI ); } -/* com_RTS( , [] ) -> +/* com_RTS( , [] ) --> */ HB_FUNC( COM_RTS ) { @@ -150,7 +150,7 @@ HB_FUNC( COM_RTS ) hb_retl( ( iMCR & HB_COM_MCR_RTS ) != 0 ); } -/* com_DTR( , [] ) -> +/* com_DTR( , [] ) --> */ HB_FUNC( COM_DTR ) { @@ -167,7 +167,7 @@ HB_FUNC( COM_DTR ) hb_retl( ( iMCR & HB_COM_MCR_DTR ) != 0 ); } -/* com_MCR( , [] ) -> (MCR_*) +/* com_MCR( , [] ) --> (MCR_*) */ HB_FUNC( COM_MCR ) { @@ -187,7 +187,7 @@ HB_FUNC( COM_MCR ) hb_retni( iMCR ); } -/* com_MSR( ) -> (MSR_*) +/* com_MSR( ) --> (MSR_*) */ HB_FUNC( COM_MSR ) { @@ -199,7 +199,7 @@ HB_FUNC( COM_MSR ) hb_retni( iMSR ); } -/* com_LSR( ) -> (LSR_*) +/* com_LSR( ) --> (LSR_*) */ HB_FUNC( COM_LSR ) { @@ -211,14 +211,14 @@ HB_FUNC( COM_LSR ) hb_retni( iLSR ); } -/* com_Break( , =100 ) -> +/* com_Break( , =100 ) --> */ HB_FUNC( COM_BREAK ) { hb_retl( hb_comSendBreak( hb_parni( 1 ), hb_parnidef( 2, 100 ) ) != 0 ); } -/* com_Hard( , [], [] ) -> +/* com_Hard( , [], [] ) --> */ HB_FUNC( COM_HARD ) { @@ -244,7 +244,7 @@ HB_FUNC( COM_HARD ) } /* com_Soft( , [], - [], [] ) -> + [], [] ) --> */ HB_FUNC( COM_SOFT ) { @@ -270,7 +270,7 @@ HB_FUNC( COM_SOFT ) hb_retl( fResult ); } -/* com_Soft_R( , [] ) -> +/* com_Soft_R( , [] ) --> */ HB_FUNC( COM_SOFT_R ) { @@ -288,7 +288,7 @@ HB_FUNC( COM_SOFT_R ) hb_retl( fResult ); } -/* com_Soft_S( ) -> +/* com_Soft_S( ) --> */ HB_FUNC( COM_SOFT_S ) { @@ -301,21 +301,21 @@ HB_FUNC( COM_SOFT_S ) hb_retl( fResult ); } -/* com_ErrChr( , [] ) -> +/* com_ErrChr( , [] ) --> */ HB_FUNC( COM_ERRCHR ) { hb_retl( hb_comErrorChar( hb_parni( 1 ), hb_ctComCharParam( 2 ) ) != -1 ); } -/* com_Remote( , [] ) -> +/* com_Remote( , [] ) --> */ HB_FUNC( COM_REMOTE ) { hb_retl( hb_comDiscardChar( hb_parni( 1 ), hb_ctComCharParam( 2 ) ) > 0 ); } -/* com_SMode( ) -> +/* com_SMode( ) --> */ HB_FUNC( COM_SMODE ) { @@ -336,7 +336,7 @@ HB_FUNC( COM_SMODE ) hb_retni( iResult ); } -/* com_Event( , ) -> +/* com_Event( , ) --> */ HB_FUNC( COM_EVENT ) { @@ -344,7 +344,7 @@ HB_FUNC( COM_EVENT ) hb_retni( 0 ); } -/* com_Key( , [], [] ) -> +/* com_Key( , [], [] ) --> */ HB_FUNC( COM_KEY ) { @@ -353,7 +353,7 @@ HB_FUNC( COM_KEY ) } /* com_SKey( [], [], - * [] ) -> + * [] ) --> */ HB_FUNC( COM_SKEY ) { @@ -362,7 +362,7 @@ HB_FUNC( COM_SKEY ) } /* com_Init( , [=300], [=N], - * [=8], [=1] ) -> + * [=8], [=1] ) --> */ HB_FUNC( COM_INIT ) { @@ -376,7 +376,7 @@ HB_FUNC( COM_INIT ) } /* com_Open( , [=100] [, =0], - * [] ) -> + * [] ) --> */ HB_FUNC( COM_OPEN ) { @@ -389,7 +389,7 @@ HB_FUNC( COM_OPEN ) hb_retl( hb_comOpen( iPort ) != -1 ); } -/* com_Close( ) -> +/* com_Close( ) --> */ HB_FUNC( COM_CLOSE ) { @@ -399,7 +399,7 @@ HB_FUNC( COM_CLOSE ) hb_retl( hb_comClose( iPort ) != -1 ); } -/* com_Read( , [], [] ) -> +/* com_Read( , [], [] ) --> */ HB_FUNC( COM_READ ) { @@ -440,7 +440,7 @@ HB_FUNC( COM_READ ) hb_retclen_buffer( data, lRecv ); } -/* com_Send( , ) -> +/* com_Send( , ) --> */ HB_FUNC( COM_SEND ) { @@ -469,42 +469,42 @@ HB_FUNC( COM_SEND ) hb_retnl( lLen ); } -/* com_Num() -> +/* com_Num() --> */ HB_FUNC( COM_NUM ) { hb_retni( hb_comLastNum() ); } -/* com_GetIO( ) -> | -1 +/* com_GetIO( ) --> | -1 */ HB_FUNC( COM_GETIO ) { /* TODO! */ } -/* com_SetIO( , ) -> +/* com_SetIO( , ) --> */ HB_FUNC( COM_SETIO ) { /* TODO! */ } -/* com_GetIRQ( ) -> | -1 +/* com_GetIRQ( ) --> | -1 */ HB_FUNC( COM_GETIRQ ) { /* TODO! */ } -/* com_SetIRQ( , ) -> +/* com_SetIRQ( , ) --> */ HB_FUNC( COM_SETIRQ ) { /* TODO! */ } -/* com_DevName( [, ] ) -> +/* com_DevName( [, ] ) --> */ HB_FUNC( COM_DEVNAME ) { diff --git a/contrib/hbct/ctcom2.c b/contrib/hbct/ctcom2.c index 2d6c0134f6..03994fa069 100644 --- a/contrib/hbct/ctcom2.c +++ b/contrib/hbct/ctcom2.c @@ -50,7 +50,7 @@ #include "hbapigt.h" #include "hbchksum.h" -/* com_DosCon( , [], [] ) -> +/* com_DosCon( , [], [] ) --> */ HB_FUNC( COM_DOSCON ) { @@ -74,7 +74,7 @@ HB_FUNC( COM_DOSCON ) hb_retc_null(); } -/* com_CRC( , [], [] ) -> +/* com_CRC( , [], [] ) --> */ HB_FUNC( COM_CRC ) { @@ -90,10 +90,10 @@ HB_FUNC( COM_CRC ) /* NOTE: warning this function is not bug compatible with CT3. * It fixes few problems in original CT3 implementation - * i.e. it works correctly for 8 bit and smaller polynomials + * i.e. it works correctly for 8-bit and smaller polynomials * instead of returning 0 or supports much larger polynomials - * up to 64bits. - * For 16/17 bit polynomials it gives the same results as CT3 + * up to 64-bit. + * For 16/17-bit polynomials it gives the same results as CT3 * so for most common usage it should be binary compatible * with CT3. [druzus] */ @@ -111,7 +111,7 @@ static char s_xmoblock_sum( const char * szData, HB_SIZE nLen ) return ( char ) uc; } -/* XMoBlock( , , [], [] ) -> +/* XMoBlock( , , [], [] ) --> */ HB_FUNC( XMOBLOCK ) { @@ -152,17 +152,18 @@ HB_FUNC( XMOBLOCK ) hb_retclen_buffer( pszBlock, nSize ); } -/* XMoCheck( , [] ) -> |-1 +/* XMoCheck( , [] ) --> |-1 */ HB_FUNC( XMOCHECK ) { - HB_SIZE nLen = hb_parclen( 1 ), nSize; + HB_SIZE nLen = hb_parclen( 1 ); int iResult = -1; if( nLen >= 132 ) { const char * szBlock = hb_parc( 1 ); HB_BOOL fCRC = hb_parl( 2 ); + HB_SIZE nSize; if( *szBlock == 0x01 ) nSize = 128; @@ -183,7 +184,7 @@ HB_FUNC( XMOCHECK ) hb_retni( iResult ); } -/* ZeroInsert( ) -> +/* ZeroInsert( ) --> */ HB_FUNC( ZEROINSERT ) { @@ -194,7 +195,7 @@ HB_FUNC( ZEROINSERT ) const char * szText; HB_SIZE nLen, nBits, n; unsigned int uiVal; - int i, j; + int i; szText = hb_itemGetCPtr( pString ); nLen = hb_itemGetCLen( pString ); @@ -219,6 +220,7 @@ HB_FUNC( ZEROINSERT ) HB_SIZE nDest = nLen + ( ( nBits + 7 ) >> 3 ); char * pszDest = ( char * ) hb_xgrab( nDest + 1 ); unsigned char c = 0; + int j; nBits = n = 0; i = 1; @@ -265,7 +267,7 @@ HB_FUNC( ZEROINSERT ) hb_retc_null(); } -/* ZeroRemove( ) -> cString +/* ZeroRemove( ) --> cString */ HB_FUNC( ZEROREMOVE ) { diff --git a/contrib/hbct/ctcrypt.c b/contrib/hbct/ctcrypt.c index af56d1d593..4cc4a1176b 100644 --- a/contrib/hbct/ctcrypt.c +++ b/contrib/hbct/ctcrypt.c @@ -1,6 +1,9 @@ /* * Crypt() CA-T*ols compatible function * + * WARNING: Non-standard, insecure crypto. Use core hb_blowfish*() + * functions or other _standard_ alternatives instead. + * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) * * This program is free software; you can redistribute it and/or modify diff --git a/contrib/hbct/ctmath.c b/contrib/hbct/ctmath.c index 9cf5aecd45..1b121916f1 100644 --- a/contrib/hbct/ctmath.c +++ b/contrib/hbct/ctmath.c @@ -1,5 +1,5 @@ /* - * initialization and switch functions for CT3 math functions + * Initialization and switch functions for CT3 math functions * * Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany * Author: Martin Vogel diff --git a/contrib/hbct/ctmath.h b/contrib/hbct/ctmath.h index aea361c08c..0a10c2edad 100644 --- a/contrib/hbct/ctmath.h +++ b/contrib/hbct/ctmath.h @@ -1,7 +1,7 @@ /* * CA-T*ols for Harbour, Math header file * - * Copyright 2001 Alejandro de garate + * Copyright 2001 Alejandro de Garate * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,7 +59,7 @@ HB_EXTERN_BEGIN extern int ct_math_init( void ); extern int ct_math_exit( void ); -/* set & get precision */ +/* set and get precision */ extern void ct_setprecision( int iPrecision ); extern int ct_getprecision( void ); diff --git a/contrib/hbct/ctmath2.c b/contrib/hbct/ctmath2.c index aa75323983..0f2d2e2457 100644 --- a/contrib/hbct/ctmath2.c +++ b/contrib/hbct/ctmath2.c @@ -1,16 +1,14 @@ /* - * - * CT3 mathematical functions - * - Floor() - * - Ceiling() - * - Sign() - * - Log10() - * - Fact() + * CT3 mathematical functions + * - Floor() + * - Ceiling() + * - Sign() + * - Log10() + * - Fact() * * Copyright 2001 Alejandro de Garate - * - * Documentation and changes concerning error handling Copyright 2001 - * IntTec GmbH, Freiburg, Germany, Author: Martin Vogel + * Copyright 2001 IntTec GmbH, Freiburg, Germany + * Author: Martin Vogel (Documentation and changes concerning error handling) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -138,13 +136,11 @@ HB_FUNC( SIGN ) if( dInput == 0.00 ) iResult = 0; + else if( dInput > 0.00 ) + iResult = 1; else - { - if( dInput > 0.00 ) - iResult = 1; - else - iResult = -1; - } + iResult = -1; + hb_retni( iResult ); } else @@ -218,11 +214,12 @@ HB_FUNC( FACT ) if( HB_ISNUM( 1 ) ) { int iInput = hb_parni( 1 ); - int i; - double dResult = 1.0; - if( ( iInput >= 0 ) && ( iInput < 22 ) ) + if( iInput >= 0 && iInput < 22 ) { + double dResult = 1.0; + int i; + for( i = 1; i <= iInput; i++ ) dResult *= ( double ) i; hb_retnd( dResult ); diff --git a/contrib/hbct/ctnet.c b/contrib/hbct/ctnet.c index edaa876667..09b08b2084 100644 --- a/contrib/hbct/ctnet.c +++ b/contrib/hbct/ctnet.c @@ -47,33 +47,33 @@ /* * CT3 NET Functions Comments: * - * NetCancel( ) -> lReleased + * NetCancel( ) --> lReleased * Return true if was disconnected. * - * NetDisk( cDrive ) -> lSuccess + * NetDisk( cDrive ) --> lSuccess * Return true if is a network drive, otherwise return false if is a local drive. * - * NETLOCNAME( cSahredDevice ) -> cLocalDevice + * NetLocName( cSahredDevice ) --> cLocalDevice * Not implemented yet. * - * NetPrinter() -> lSuccess - * Return true if a current local printer seted by SET PRINTER TO was connected to a + * NetPrinter() --> lSuccess + * Return true if a current local printer set by SET PRINTER TO was connected to a * network printer. * - * NetRedir( cLocalDevice, cSharedDevice, [ cPassword ], [ lShowError] ) -> lSuccess + * NetRedir( cLocalDevice, cSharedDevice, [ cPassword ], [ lShowError] ) --> lSuccess * Return true if was connected to with , if any. * - * NetRmtname( cLocalDevice ) -> cSharedName + * NetRmtname( cLocalDevice ) --> cSharedName * Return the shared resource name connected to a . * The original parameter in CA-Cl*pper Tools was changed to in * xHarbour because in Windows Network I didn't find a number table like in MS-DOS. See * CA-T*ols help for more details. * - * Network() -> lSuccess - * Return true if a PC-LAN/MS-NET or Netware type is active. + * Network() --> lSuccess + * Return true if a PC-LAN/MS-NET or NetWare type is active. * - * NNetwork() -> lSuccess - * Return true if a Netware type is active. + * NNetwork() --> lSuccess + * Return true if a NetWare type is active. * */ @@ -114,7 +114,7 @@ HB_FUNC( NETCANCEL ) #if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE ) void * hDevice; - DWORD dwResult = WNetCancelConnection( HB_PARSTRDEF( 1, &hDevice, NULL ), TRUE ); /* FALSE = fail if exist open files or print jobs. */ + DWORD dwResult = WNetCancelConnection( HB_PARSTRDEF( 1, &hDevice, NULL ), TRUE ); /* FALSE = fail if exist open files or print jobs. */ hb_strfree( hDevice ); /* TRUE = force cancel connection even if exist @@ -129,7 +129,7 @@ HB_FUNC( NETCANCEL ) HB_FUNC( NETPRINTER ) { #if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE ) - const char * cPrn = hb_setGetCPtr( HB_SET_PRINTFILE ); /* query default local printer port. */ + const char * cPrn = hb_setGetCPtr( HB_SET_PRINTFILE ); /* query default local printer port. */ if( ! cPrn || ! *cPrn || hb_stricmp( cPrn, "PRN" ) == 0 ) cPrn = "LPT1"; diff --git a/contrib/hbct/ctrand.prg b/contrib/hbct/ctrand.prg index 549b96e10a..a3e6654bf9 100644 --- a/contrib/hbct/ctrand.prg +++ b/contrib/hbct/ctrand.prg @@ -45,7 +45,6 @@ */ FUNCTION Random( lMode ) - RETURN iif( HB_ISLOGICAL( lMode ) .AND. lMode, ; hb_RandomInt( -32768, 32767 ), hb_RandomInt( 0, 65535 ) ) diff --git a/contrib/hbct/ctstr.c b/contrib/hbct/ctstr.c index 38d75385aa..f3deee5843 100644 --- a/contrib/hbct/ctstr.c +++ b/contrib/hbct/ctstr.c @@ -1,5 +1,5 @@ /* - * internal and switch functions for CT3 string functions + * Internal and switch functions for CT3 string functions * * Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany * Author: Martin Vogel @@ -84,16 +84,14 @@ int ct_str_exit( void ) return 1; } -/* -------------------------- */ /* search for exact substring */ -/* -------------------------- */ const char * ct_at_exact_forward( const char * pcString, HB_SIZE sStrLen, const char * pcMatch, HB_SIZE sMatchLen, HB_SIZE * psMatchStrLen ) { HB_SIZE sPos; HB_TRACE( HB_TR_DEBUG, ( "ct_at_exact_forward (\"%s\", %" HB_PFS "u, \"%s\", %" HB_PFS "u, %p)", - pcString, sStrLen, pcMatch, sMatchLen, psMatchStrLen ) ); + pcString, sStrLen, pcMatch, sMatchLen, ( void * ) psMatchStrLen ) ); if( sMatchLen == 0 || sStrLen < sMatchLen ) return NULL; @@ -109,9 +107,7 @@ const char * ct_at_exact_forward( const char * pcString, HB_SIZE sStrLen, } } -/* ------------------------------------------------ */ /* search for exact substring in backward direction */ -/* ------------------------------------------------ */ const char * ct_at_exact_backward( const char * pcString, HB_SIZE sStrLen, const char * pcMatch, HB_SIZE sMatchLen, HB_SIZE * psMatchStrLen ) { @@ -119,7 +115,7 @@ const char * ct_at_exact_backward( const char * pcString, HB_SIZE sStrLen, const char * pcRet; HB_TRACE( HB_TR_DEBUG, ( "ct_at_exact_backward (\"%s\", %" HB_PFS "u, \"%s\", %" HB_PFS "u, %p)", - pcString, sStrLen, pcMatch, sMatchLen, psMatchStrLen ) ); + pcString, sStrLen, pcMatch, sMatchLen, ( void * ) psMatchStrLen ) ); if( sMatchLen == 0 || sStrLen < sMatchLen ) return NULL; @@ -143,9 +139,7 @@ const char * ct_at_exact_backward( const char * pcString, HB_SIZE sStrLen, return NULL; } -/* ----------------------------------- */ /* search for substring using wildcard */ -/* ----------------------------------- */ const char * ct_at_wildcard_forward( const char * pcString, HB_SIZE sStrLen, const char * pcMatch, HB_SIZE sMatchLen, char cWildCard, HB_SIZE * psMatchStrLen ) @@ -154,7 +148,7 @@ const char * ct_at_wildcard_forward( const char * pcString, HB_SIZE sStrLen, const char * pcRet, * pcStop; HB_TRACE( HB_TR_DEBUG, ( "ct_at_wildcard_forward (\"%s\", %" HB_PFS "u, \"%s\", %" HB_PFS "u, \'%c\', %p)", - pcString, sStrLen, pcMatch, sMatchLen, cWildCard, psMatchStrLen ) ); + pcString, sStrLen, pcMatch, sMatchLen, cWildCard, ( void * ) psMatchStrLen ) ); if( sMatchLen == 0 || sStrLen < sMatchLen ) return NULL; @@ -180,9 +174,7 @@ const char * ct_at_wildcard_forward( const char * pcString, HB_SIZE sStrLen, return NULL; } -/* --------------------------------------------------------- */ /* search for substring using wildcard in backward direction */ -/* --------------------------------------------------------- */ const char * ct_at_wildcard_backward( const char * pcString, HB_SIZE sStrLen, const char * pcMatch, HB_SIZE sMatchLen, char cWildCard, HB_SIZE * psMatchStrLen ) @@ -191,7 +183,7 @@ const char * ct_at_wildcard_backward( const char * pcString, HB_SIZE sStrLen, const char * pcRet; HB_TRACE( HB_TR_DEBUG, ( "ct_at_wildcard_backward (\"%s\", %" HB_PFS "u, \"%s\", %" HB_PFS "u, \'%c\', %p)", - pcString, sStrLen, pcMatch, sMatchLen, cWildCard, psMatchStrLen ) ); + pcString, sStrLen, pcMatch, sMatchLen, cWildCard, ( void * ) psMatchStrLen ) ); if( sMatchLen == 0 || sStrLen < sMatchLen ) return NULL; @@ -217,16 +209,14 @@ const char * ct_at_wildcard_backward( const char * pcString, HB_SIZE sStrLen, return NULL; } -/* ------------------------------- */ /* search for character from a set */ -/* ------------------------------- */ const char * ct_at_charset_forward( const char * pcString, HB_SIZE sStrLen, const char * pcCharSet, HB_SIZE sCharSetLen, HB_SIZE * psMatchedCharPos ) { const char * pcRet, * pcSet, * pcStop1, * pcStop2; HB_TRACE( HB_TR_DEBUG, ( "ct_at_charset_forward (\"%s\", %" HB_PFS "u, \"%s\", %" HB_PFS "u, %p)", - pcString, sStrLen, pcCharSet, sCharSetLen, psMatchedCharPos ) ); + pcString, sStrLen, pcCharSet, sCharSetLen, ( void * ) psMatchedCharPos ) ); *( psMatchedCharPos ) = sCharSetLen; @@ -242,7 +232,7 @@ const char * ct_at_charset_forward( const char * pcString, HB_SIZE sStrLen, if( *pcSet == *pcRet ) { if( psMatchedCharPos != NULL ) - *( psMatchedCharPos ) = pcSet - pcCharSet; + *psMatchedCharPos = pcSet - pcCharSet; return pcRet; } } @@ -251,16 +241,14 @@ const char * ct_at_charset_forward( const char * pcString, HB_SIZE sStrLen, return NULL; } -/* ----------------------------------------------------- */ /* search for character from a set in backward direction */ -/* ----------------------------------------------------- */ const char * ct_at_charset_backward( const char * pcString, HB_SIZE sStrLen, const char * pcCharSet, HB_SIZE sCharSetLen, HB_SIZE * psMatchedCharPos ) { const char * pcRet, * pcSet, * pcStop; HB_TRACE( HB_TR_DEBUG, ( "ct_at_charset_backward (\"%s\", %" HB_PFS "u, \"%s\", %" HB_PFS "u, %p)", - pcString, sStrLen, pcCharSet, sCharSetLen, psMatchedCharPos ) ); + pcString, sStrLen, pcCharSet, sCharSetLen, ( void * ) psMatchedCharPos ) ); *( psMatchedCharPos ) = sCharSetLen; @@ -275,7 +263,7 @@ const char * ct_at_charset_backward( const char * pcString, HB_SIZE sStrLen, if( *pcSet == *pcRet ) { if( psMatchedCharPos != NULL ) - *( psMatchedCharPos ) = pcSet - pcCharSet; + *psMatchedCharPos = pcSet - pcCharSet; return pcRet; } } @@ -284,9 +272,7 @@ const char * ct_at_charset_backward( const char * pcString, HB_SIZE sStrLen, return NULL; } -/* - * CSetRef() stuff - */ +/* CSetRef() stuff */ void ct_setref( int iNewSwitch ) { @@ -322,9 +308,7 @@ HB_FUNC( CSETREF ) } } -/* - * CSetAtMupa() stuff - */ +/* CSetAtMupa() stuff */ void ct_setatmupa( int iNewSwitch ) { @@ -360,9 +344,7 @@ HB_FUNC( CSETATMUPA ) } } -/* - * SetAtLike() stuff - */ +/* SetAtLike() stuff */ void ct_setatlike( int iNewMode ) { diff --git a/contrib/hbct/ctstr.h b/contrib/hbct/ctstr.h index eb0a373228..843a0f1ee8 100644 --- a/contrib/hbct/ctstr.h +++ b/contrib/hbct/ctstr.h @@ -1,5 +1,5 @@ /* - * internal function header for CT3 string functions + * Internal function header for CT3 string functions * * Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany * Author: Martin Vogel diff --git a/contrib/hbct/ctstrfil.c b/contrib/hbct/ctstrfil.c index 89f7b65e32..072f79fc00 100644 --- a/contrib/hbct/ctstrfil.c +++ b/contrib/hbct/ctstrfil.c @@ -1,7 +1,6 @@ /* - * Functions: - * SetFCreate(), CSetSafety(), StrFile(), FileStr(), ScreenFile() - * ScreenFile(), FileScreen() + * StrFile(), FileStr(), ScreenFile(), FileScreen() + * SetFCreate(), CSetSafety() * * Copyright 2004 Pavel Tsarenko * diff --git a/contrib/hbct/cttime.prg b/contrib/hbct/cttime.prg index 56b415f85d..23f93ef7a3 100644 --- a/contrib/hbct/cttime.prg +++ b/contrib/hbct/cttime.prg @@ -73,7 +73,7 @@ FUNCTION TimeToSec( cTime ) ENDIF ENDIF - RETURN Round( nSec, 2 ) /* round FL val to be sure that you can compare it */ + RETURN Round( nSec, 2 ) /* round FL val to be sure that you can compare it */ FUNCTION SecToTime( nSec, lHundredth ) diff --git a/contrib/hbct/ctwfunc.c b/contrib/hbct/ctwfunc.c index 5b95257c8e..a069ce1db0 100644 --- a/contrib/hbct/ctwfunc.c +++ b/contrib/hbct/ctwfunc.c @@ -161,17 +161,17 @@ HB_FUNC( WOPEN ) { int iColor; - /* 6-th (color) and 7-th (lVisible) parameters are Harbour extensions */ + /* 6th (color) and 7th (lVisible) parameters are Harbour extensions */ iColor = hb_ctColorParam( 6, -1 ); /* Harbour extension */ /* HB_EXTENSION */ hb_retni( hb_ctwCreateWindow( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parl( 5 ), iColor, - hb_parldef( 7, 1 ) ) ); /* HB_EXTENSION */ + hb_parldef( 7, HB_TRUE ) ) ); /* HB_EXTENSION */ } HB_FUNC( WCLOSE ) { - /* 1-st parameter (window handle) is Harbour extension */ + /* 1st parameter (window handle) is Harbour extension */ hb_retni( hb_ctwCloseWindow( HB_ISNUM( 1 ) ? hb_parni( 1 ) : /* HB_EXTENSION */ hb_ctwCurrentWindow() ) ); } @@ -181,11 +181,10 @@ HB_FUNC( WACLOSE ) hb_retni( hb_ctwCloseAllWindows() ); } -HB_FUNC( WSELECT ) +HB_FUNC( WSELECT ) /* 2nd parameter (fBringToTop) is Harbour extension */ { - /* 2-nd parameter (fBringToTop) is Harbour extension */ hb_retni( HB_ISNUM( 1 ) ? hb_ctwSelectWindow( hb_parni( 1 ), - hb_parldef( 2, 1 ) ) : /* HB_EXTENSION */ + hb_parldef( 2, HB_TRUE ) ) : /* HB_EXTENSION */ hb_ctwCurrentWindow() ); } @@ -388,7 +387,7 @@ HB_FUNC( HBCT_MAXCOL ) /* Return the maximum screen/window column number (zero o */ /* - WAlias( ) -> | -1 + WAlias( ) --> | -1 change current window handle to if is not used by other window or is current window. @@ -398,7 +397,7 @@ HB_FUNC( WALIAS ) int iWindow = hb_parnidef( 1, -1 ); /* 255 is original CT3 limit, - * harbour CTWIN does not have such intenral limits + * Harbour CTWIN does not have such internal limits */ if( iWindow >= 0 && iWindow <= 255 ) iWindow = hb_ctwChangeWindowHandle( iWindow ); @@ -409,8 +408,8 @@ HB_FUNC( WALIAS ) } /* - WList() -> - _WStack() -> + WList() --> + _WStack() --> return string with window handles in each character, the last character is the top window. diff --git a/contrib/hbct/ctwin.c b/contrib/hbct/ctwin.c index 15e58eb0ec..570b02013e 100644 --- a/contrib/hbct/ctwin.c +++ b/contrib/hbct/ctwin.c @@ -177,7 +177,7 @@ static void hb_ctw_SetMap( PHB_GTCTW pCTW, int * piMap, int iWindow, int iTop, i HB_SIZE nIndex; int i; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetMap(%p,%p,%d,%d,%d,%d,%d,%d)", pCTW, piMap, iWindow, iTop, iLeft, iBottom, iRight, iNested ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetMap(%p,%p,%d,%d,%d,%d,%d,%d)", ( void * ) pCTW, ( void * ) piMap, iWindow, iTop, iLeft, iBottom, iRight, iNested ) ); if( iTop < 0 ) iTop = 0; @@ -215,7 +215,7 @@ static void hb_ctw_ClearMap( PHB_GTCTW pCTW ) { HB_SIZE nSize; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_ClearMap(%p)", pCTW ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_ClearMap(%p)", ( void * ) pCTW ) ); nSize = ( HB_SIZE ) pCTW->iMapHeight * pCTW->iMapWidth * sizeof( int ); memset( pCTW->pWindowMap, 0, nSize ); @@ -224,7 +224,7 @@ static void hb_ctw_ClearMap( PHB_GTCTW pCTW ) static void hb_ctw_TouchLines( PHB_GTCTW pCTW, int iFrom, int iTo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_TouchLines(%p,%d,%d)", pCTW, iFrom, iTo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_TouchLines(%p,%d,%d)", ( void * ) pCTW, iFrom, iTo ) ); while( iFrom <= iTo ) { @@ -237,7 +237,7 @@ static void hb_ctw_WindowMap( PHB_GTCTW pCTW, int iWindow, HB_BOOL fExpose ) { PHB_CT_WND pWnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_WindowMap(%p,%d,%d)", pCTW, iWindow, ( int ) fExpose ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_WindowMap(%p,%d,%d)", ( void * ) pCTW, iWindow, ( int ) fExpose ) ); pWnd = pCTW->windows[ iWindow ]; @@ -274,7 +274,7 @@ static void hb_ctw_WindowMap( PHB_GTCTW pCTW, int iWindow, HB_BOOL fExpose ) static void hb_ctw_RemapAllWindows( PHB_GTCTW pCTW, int iFrom, HB_BOOL fExpose ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_RemapAllWindows(%p,%d,%d)", pCTW, iFrom, ( int ) fExpose ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_RemapAllWindows(%p,%d,%d)", ( void * ) pCTW, iFrom, ( int ) fExpose ) ); if( pCTW->iMaxWindow ) { @@ -293,7 +293,7 @@ static int hb_ctw_SetShadowAttr( PHB_GTCTW pCTW, int iAttr ) { int iOldAttr; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetShadowAttr(%p,%d)", pCTW, iAttr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetShadowAttr(%p,%d)", ( void * ) pCTW, iAttr ) ); iOldAttr = pCTW->iShadowAttr; if( iAttr >= 0 || @@ -309,7 +309,7 @@ static int hb_ctw_SetMoveMode( PHB_GTCTW pCTW, int iMode ) { int iOldMode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetMoveMode(%p,%d)", pCTW, iMode ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetMoveMode(%p,%d)", ( void * ) pCTW, iMode ) ); iOldMode = pCTW->iMoveMode; if( iMode >= 0 ) @@ -320,7 +320,7 @@ static int hb_ctw_SetMoveMode( PHB_GTCTW pCTW, int iMode ) static int hb_ctw_SetMoveStep( PHB_GTCTW pCTW, int iVertical, int iHorizontal ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetMoveStep(%p,%d,%d)", pCTW, iVertical, iHorizontal ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetMoveStep(%p,%d,%d)", ( void * ) pCTW, iVertical, iHorizontal ) ); if( iVertical < pCTW->iMapHeight && iHorizontal < pCTW->iMapWidth ) { @@ -335,7 +335,7 @@ static int hb_ctw_SetMoveStep( PHB_GTCTW pCTW, int iVertical, int iHorizontal ) static int hb_ctw_SetWindowBoard( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom, int iRight ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetWindowBoard(%p,%d,%d,%d,%d)", pCTW, iTop, iLeft, iBottom, iRight ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetWindowBoard(%p,%d,%d,%d,%d)", ( void * ) pCTW, iTop, iLeft, iBottom, iRight ) ); #ifdef HB_CLP_STRICT /* @@ -366,7 +366,7 @@ static int hb_ctw_SetWindowBoard( PHB_GTCTW pCTW, int iTop, int iLeft, int iBott static int hb_ctw_SetBorderMode( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom, int iRight ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetBorderMode(%p,%d,%d,%d,%d)", pCTW, iTop, iLeft, iBottom, iRight ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetBorderMode(%p,%d,%d,%d,%d)", ( void * ) pCTW, iTop, iLeft, iBottom, iRight ) ); if( iTop >= 0 ) pCTW->fBoardTop = iTop != 0; @@ -384,7 +384,7 @@ static int hb_ctw_CurrentWindow( PHB_GTCTW pCTW ) { PHB_CTWDATA pTSD; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CurrentWindow(%p)", pCTW ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CurrentWindow(%p)", ( void * ) pCTW ) ); pTSD = HB_CTW_TSD( pCTW ); @@ -405,7 +405,7 @@ static int hb_ctw_CurrentWindow( PHB_GTCTW pCTW ) static int hb_ctw_SelectWindow( PHB_GTCTW pCTW, int iWindow, HB_BOOL fToTop ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SelectWindow(%p,%d,%d)", pCTW, iWindow, fToTop ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SelectWindow(%p,%d,%d)", ( void * ) pCTW, iWindow, fToTop ) ); if( iWindow == 0 ) HB_CTW_SETCURRENT( pCTW, 0 ); @@ -415,7 +415,7 @@ static int hb_ctw_SelectWindow( PHB_GTCTW pCTW, int iWindow, HB_BOOL fToTop ) HB_CTW_SETCURRENT( pCTW, iWindow ); if( fToTop ) { - int i, iPos; + int i; /* update window level */ i = pCTW->iOpenWindows - 1; @@ -423,7 +423,7 @@ static int hb_ctw_SelectWindow( PHB_GTCTW pCTW, int iWindow, HB_BOOL fToTop ) { if( pCTW->windowStack[ i ] == iWindow ) { - iPos = i; + int iPos = i; while( i < pCTW->iOpenWindows - 1 && pCTW->windows[ pCTW->windowStack[ i + 1 ] ]->iLevel <= pCTW->windows[ iWindow ]->iLevel ) @@ -455,9 +455,9 @@ static int hb_ctw_SelectWindow( PHB_GTCTW pCTW, int iWindow, HB_BOOL fToTop ) static int hb_ctw_ChangeWindowHandle( PHB_GTCTW pCTW, int iNewWindow ) { - int iWindow, i; + int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_ChangeWindowHandle(%p,%d)", pCTW, iNewWindow ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_ChangeWindowHandle(%p,%d)", ( void * ) pCTW, iNewWindow ) ); iWindow = HB_CTW_GETCURRENT( pCTW ); if( iWindow != iNewWindow ) @@ -467,6 +467,7 @@ static int hb_ctw_ChangeWindowHandle( PHB_GTCTW pCTW, int iNewWindow ) pCTW->windows[ iNewWindow ] == NULL ) ) { PHB_CT_WND pWnd = pCTW->windows[ iWindow ]; + int i; if( iNewWindow > pCTW->iMaxWindow ) { @@ -508,7 +509,7 @@ static int hb_ctw_ChangeWindowHandle( PHB_GTCTW pCTW, int iNewWindow ) static int hb_ctw_GetWindowStack( PHB_GTCTW pCTW, const int ** piStack ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_GetWindowStack(%p,%p)", pCTW, piStack ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_GetWindowStack(%p,%p)", ( void * ) pCTW, ( const void * ) piStack ) ); *piStack = pCTW->windowStack; @@ -519,7 +520,7 @@ static int hb_ctw_Visible( PHB_GTCTW pCTW, int iWindow, int iVisible ) { int iResult = HB_CTW_UNDEF; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_Visible(%p,%d,%d)", pCTW, iWindow, iVisible ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_Visible(%p,%d,%d)", ( void * ) pCTW, iWindow, iVisible ) ); if( iWindow == 0 ) iResult = HB_CTW_VISIBLE; @@ -542,10 +543,9 @@ static int hb_ctw_Visible( PHB_GTCTW pCTW, int iWindow, int iVisible ) static int hb_ctw_SetWindowLevel( PHB_GTCTW pCTW, int iWindow, int iLevel ) { - int iResult = -1, iPos, i; - HB_BOOL fToTop; + int iResult = -1; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetWindowLevel(%p,%d,%d)", pCTW, iWindow, iLevel ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetWindowLevel(%p,%d,%d)", ( void * ) pCTW, iWindow, iLevel ) ); if( iWindow > 0 && iWindow <= pCTW->iMaxWindow && pCTW->windows[ iWindow ] != NULL ) @@ -556,6 +556,9 @@ static int hb_ctw_SetWindowLevel( PHB_GTCTW pCTW, int iWindow, int iLevel ) if( iLevel >= HB_CTW_BOTTOM && iLevel <= HB_CTW_TOP && pWnd->iLevel != iLevel ) { + HB_BOOL fToTop; + int i; + /* update window level */ fToTop = pWnd->iLevel < iLevel; pWnd->iLevel = iLevel; @@ -567,7 +570,7 @@ static int hb_ctw_SetWindowLevel( PHB_GTCTW pCTW, int iWindow, int iLevel ) --i; if( i >= 0 ) { - iPos = i; + int iPos = i; if( fToTop ) { while( i < pCTW->iOpenWindows - 1 && pWnd->iLevel >= @@ -602,7 +605,7 @@ static int hb_ctw_SetWindowShadow( PHB_GTCTW pCTW, int iWindow, int iAttr ) { int iResult = -1; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetWindowShadow(%p,%d,%d)", pCTW, iWindow, iAttr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetWindowShadow(%p,%d,%d)", ( void * ) pCTW, iWindow, iAttr ) ); if( iWindow > 0 && iWindow <= pCTW->iMaxWindow && pCTW->windows[ iWindow ] != NULL ) @@ -629,7 +632,7 @@ static int hb_ctw_MaxWindow( PHB_GTCTW pCTW ) { int i, iMaxHandle = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_MaxWindow(%p)", pCTW ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_MaxWindow(%p)", ( void * ) pCTW ) ); for( i = 0; i < pCTW->iOpenWindows; ++i ) { @@ -648,7 +651,7 @@ static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom int iRow, iCol, iHeight, iWidth, iTmp; long lIndex; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CreateWindow(%p,%d,%d,%d,%d,%d,%d,%d)", pCTW, iTop, iLeft, iBottom, iRight, ( int ) fClear, iColor, ( int ) fVisible ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CreateWindow(%p,%d,%d,%d,%d,%d,%d,%d)", ( void * ) pCTW, iTop, iLeft, iBottom, iRight, ( int ) fClear, iColor, ( int ) fVisible ) ); if( pCTW->iOpenWindows == pCTW->iMaxWindow ) { @@ -790,7 +793,7 @@ static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom static int hb_ctw_CloseWindow( PHB_GTCTW pCTW, int iWindow ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CloseWindow(%p,%d)", pCTW, iWindow ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CloseWindow(%p,%d)", ( void * ) pCTW, iWindow ) ); if( iWindow > 0 && iWindow <= pCTW->iMaxWindow && pCTW->windows[ iWindow ] ) { @@ -834,17 +837,16 @@ static int hb_ctw_CloseWindow( PHB_GTCTW pCTW, int iWindow ) static int hb_ctw_CloseAllWindows( PHB_GTCTW pCTW ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CloseAllWindows(%p)", pCTW ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CloseAllWindows(%p)", ( void * ) pCTW ) ); if( pCTW->iOpenWindows > 0 ) { - PHB_CT_WND pWnd; - int i, iWindow; + int i; for( i = 0; i < pCTW->iOpenWindows; ++i ) { - iWindow = pCTW->windowStack[ i ]; - pWnd = pCTW->windows[ iWindow ]; + int iWindow = pCTW->windowStack[ i ]; + PHB_CT_WND pWnd = pCTW->windows[ iWindow ]; pCTW->windowStack[ i ] = 0; pCTW->windows[ iWindow ] = NULL; hb_xfree( pWnd->screenBuffer ); @@ -863,7 +865,7 @@ static int hb_ctw_CloseAllWindows( PHB_GTCTW pCTW ) static int hb_ctw_CenterWindow( PHB_GTCTW pCTW, int iWindow, HB_BOOL fCenter ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CenterWindow(%p,%d,%d)", pCTW, iWindow, ( int ) fCenter ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_CenterWindow(%p,%d,%d)", ( void * ) pCTW, iWindow, ( int ) fCenter ) ); if( iWindow > 0 && iWindow <= pCTW->iOpenWindows ) { @@ -911,7 +913,7 @@ static int hb_ctw_CenterWindow( PHB_GTCTW pCTW, int iWindow, HB_BOOL fCenter ) static int hb_ctw_MoveWindow( PHB_GTCTW pCTW, int iWindow, int iRow, int iCol ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_MoveWindow(%p,%d,%d,%d)", pCTW, iWindow, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_MoveWindow(%p,%d,%d,%d)", ( void * ) pCTW, iWindow, iRow, iCol ) ); if( iWindow > 0 && iWindow <= pCTW->iOpenWindows ) { @@ -938,7 +940,7 @@ static int hb_ctw_MoveWindow( PHB_GTCTW pCTW, int iWindow, int iRow, int iCol ) static int hb_ctw_ChangeMargins( PHB_GTCTW pCTW, int iWindow, int iTop, int iLeft, int iBottom, int iRight ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_ChangeMargins(%p,%d,%d,%d,%d,%d)", pCTW, iWindow, iTop, iLeft, iBottom, iRight ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_ChangeMargins(%p,%d,%d,%d,%d,%d)", ( void * ) pCTW, iWindow, iTop, iLeft, iBottom, iRight ) ); if( iWindow > 0 && iWindow <= pCTW->iOpenWindows ) { @@ -972,7 +974,7 @@ static int hb_ctw_ChangeMargins( PHB_GTCTW pCTW, int iWindow, int iTop, int iLef static int hb_ctw_SetWindowClip( PHB_GTCTW pCTW, int iWindow, int iTop, int iLeft, int iBottom, int iRight ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetWindowClip(%p,%d,%d,%d,%d,%d)", pCTW, iWindow, iTop, iLeft, iBottom, iRight ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SetWindowClip(%p,%d,%d,%d,%d,%d)", ( void * ) pCTW, iWindow, iTop, iLeft, iBottom, iRight ) ); if( iWindow > 0 && iWindow <= pCTW->iOpenWindows ) { @@ -1012,7 +1014,7 @@ static int hb_ctw_SetWindowClip( PHB_GTCTW pCTW, int iWindow, int iTop, int iLef static int hb_ctw_GetWindowCords( PHB_GTCTW pCTW, int iWindow, HB_BOOL fCenter, int * piTop, int * piLeft, int * piBottom, int * piRight ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_GetWindowCords(%p,%d,%d,%p,%p,%p,%p)", pCTW, iWindow, ( int ) fCenter, piTop, piLeft, piBottom, piRight ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_GetWindowCords(%p,%d,%d,%p,%p,%p,%p)", ( void * ) pCTW, iWindow, ( int ) fCenter, ( void * ) piTop, ( void * ) piLeft, ( void * ) piBottom, ( void * ) piRight ) ); if( iWindow > 0 && iWindow <= pCTW->iOpenWindows ) { @@ -1054,7 +1056,7 @@ static int hb_ctw_GetWindowCords( PHB_GTCTW pCTW, int iWindow, HB_BOOL fCenter, static int hb_ctw_GetFormatCords( PHB_GTCTW pCTW, int iWindow, HB_BOOL fRelative, int * piTop, int * piLeft, int * piBottom, int * piRight ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_GetFormatCords(%p,%d,%d,%p,%p,%p,%p)", pCTW, iWindow, ( int ) fRelative, piTop, piLeft, piBottom, piRight ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_GetFormatCords(%p,%d,%d,%p,%p,%p,%p)", ( void * ) pCTW, iWindow, ( int ) fRelative, ( void * ) piTop, ( void * ) piLeft, ( void * ) piBottom, ( void * ) piRight ) ); if( iWindow > 0 && iWindow <= pCTW->iOpenWindows ) { @@ -1098,7 +1100,7 @@ static int hb_ctw_AddWindowBox( PHB_GTCTW pCTW, int iWindow, const HB_WCHAR * sz { int iMaxRow, iMaxCol; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_AddWindowBox(%p,%d,%p,%d)", pCTW, iWindow, szBoxW, iColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_AddWindowBox(%p,%d,%p,%d)", ( void * ) pCTW, iWindow, ( const void * ) szBoxW, iColor ) ); iMaxRow = HB_GTSELF_MAXROW( pCTW->pGT ); iMaxCol = HB_GTSELF_MAXCOL( pCTW->pGT ); @@ -1125,7 +1127,7 @@ static int hb_ctw_AddWindowBox( PHB_GTCTW pCTW, int iWindow, const HB_WCHAR * sz static int hb_ctw_SwapWindows( PHB_GTCTW pCTW, int iWindow1, int iWindow2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SwapWindows(%p,%d,%d)", pCTW, iWindow1, iWindow2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_SwapWindows(%p,%d,%d)", ( void * ) pCTW, iWindow1, iWindow2 ) ); if( iWindow1 > 0 && iWindow1 <= pCTW->iOpenWindows && pCTW->windows[ iWindow1 ] != NULL && @@ -1156,13 +1158,13 @@ static int hb_ctw_SwapWindows( PHB_GTCTW pCTW, int iWindow1, int iWindow2 ) return -1; } -/* ********************************************************************** */ +/* --- */ static void hb_ctw_Init( PHB_GTCTW pCTW ) { int iRow, iCol; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_Init(%p)", pCTW ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_Init(%p)", ( void * ) pCTW ) ); pCTW->iShadowWidth = 2; pCTW->iShadowAttr = -1; @@ -1180,7 +1182,7 @@ static void hb_ctw_Init( PHB_GTCTW pCTW ) HB_GTSELF_SETPOS( pCTW->pGT, iRow, iCol ); } -/* ********************************************************************** */ +/* --- */ static PHB_GTCTW hb_ctw_base( void ) { @@ -1220,7 +1222,7 @@ static void hb_ctw_gt_Exit( PHB_GT pGT ) { PHB_GTCTW pCTW; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_Exit(%p)", ( void * ) pGT ) ); HB_GTSELF_REFRESH( pGT ); @@ -1249,7 +1251,7 @@ static int hb_ctw_MouseRow( PHB_GT pGT ) PHB_GTCTW pCTW; int iRow, iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_MouseRow(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_MouseRow(%p)", ( void * ) pGT ) ); iRow = HB_GTSUPER_MOUSEROW( pGT ); @@ -1267,7 +1269,7 @@ static int hb_ctw_MouseCol( PHB_GT pGT ) PHB_GTCTW pCTW; int iCol, iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_MouseCol(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_MouseCol(%p)", ( void * ) pGT ) ); iCol = HB_GTSUPER_MOUSECOL( pGT ); @@ -1285,7 +1287,7 @@ static void hb_ctw_gt_GetPos( PHB_GT pGT, int * piRow, int * piCol ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetPos(%p,%p,%p)", pGT, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetPos(%p,%p,%p)", ( void * ) pGT, ( void * ) piRow, ( void * ) piCol ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1308,7 +1310,7 @@ static void hb_ctw_gt_SetPos( PHB_GT pGT, int iRow, int iCol ) PHB_GTCTW pCTW; int iHeight, iWidth, iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetPos(%p,%d,%d)", pGT, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetPos(%p,%d,%d)", ( void * ) pGT, iRow, iCol ) ); iHeight = HB_GTSELF_MAXROW( pGT ) + 1; iWidth = HB_GTSELF_MAXCOL( pGT ) + 1; @@ -1345,7 +1347,7 @@ static int hb_ctw_gt_MaxCol( PHB_GT pGT ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_MaxCol(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_MaxCol(%p)", ( void * ) pGT ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1362,7 +1364,7 @@ static int hb_ctw_gt_MaxRow( PHB_GT pGT ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_MaxRow(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_MaxRow(%p)", ( void * ) pGT ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1391,7 +1393,7 @@ static void hb_ctw_gt_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE nLength HB_SIZE nIndex = 0; HB_WCHAR wc; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_WriteCon(%p,%p,%" HB_PFS "u)", pGT, szText, nLength ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_WriteCon(%p,%p,%" HB_PFS "u)", ( void * ) pGT, ( const void * ) szText, nLength ) ); iMaxRow = HB_GTSELF_MAXROW( pGT ); iMaxCol = HB_GTSELF_MAXCOL( pGT ); @@ -1514,7 +1516,7 @@ static void hb_ctw_gt_WriteConW( PHB_GT pGT, const HB_WCHAR * szText, HB_SIZE nL HB_WCHAR szString[ WRITECON_BUFFER_SIZE ]; HB_SIZE nIndex = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_WriteConW(%p,%p,%" HB_PFS "u)", pGT, szText, nLength ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_WriteConW(%p,%p,%" HB_PFS "u)", ( void * ) pGT, ( const void * ) szText, nLength ) ); iMaxRow = HB_GTSELF_MAXROW( pGT ); iMaxCol = HB_GTSELF_MAXCOL( pGT ); @@ -1635,7 +1637,7 @@ static int hb_ctw_gt_GetCursorStyle( PHB_GT pGT ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetCursorStyle(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetCursorStyle(%p)", ( void * ) pGT ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1650,7 +1652,7 @@ static void hb_ctw_gt_SetCursorStyle( PHB_GT pGT, int iStyle ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_SetCursorStyle(%p,%d)", pGT, iStyle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_SetCursorStyle(%p,%d)", ( void * ) pGT, iStyle ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1679,7 +1681,7 @@ static void hb_ctw_gt_GetColorStr( PHB_GT pGT, char * pszColorString ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetColorStr(%p,%p)", pGT, pszColorString ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetColorStr(%p,%p)", ( void * ) pGT, ( void * ) pszColorString ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1697,7 +1699,7 @@ static void hb_ctw_gt_SetColorStr( PHB_GT pGT, const char * szColorString ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_SetColorStr(%p,%s)", pGT, szColorString ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_SetColorStr(%p,%s)", ( void * ) pGT, szColorString ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1716,7 +1718,7 @@ static void hb_ctw_gt_ColorSelect( PHB_GT pGT, int iColorIndex ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_ColorSelect(%p,%d)", pGT, iColorIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_ColorSelect(%p,%d)", ( void * ) pGT, iColorIndex ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1735,7 +1737,7 @@ static int hb_ctw_gt_GetColor( PHB_GT pGT ) PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetColor(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetColor(%p)", ( void * ) pGT ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1753,7 +1755,7 @@ static void hb_ctw_gt_GetColorData( PHB_GT pGT, int ** pColorsPtr, int * piColor PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetColor(%p,%p,%p,%p)", pGT, pColorsPtr, piColorCount, piColorIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetColor(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) pColorsPtr, ( void * ) piColorCount, ( void * ) piColorIndex ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1775,7 +1777,7 @@ static void hb_ctw_gt_GetScrCursor( PHB_GT pGT, int * piRow, int * piCol, int * PHB_GTCTW pCTW; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetScrCursor(%p,%p,%p,%p)", pGT, piRow, piCol, piStyle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetScrCursor(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) piRow, ( void * ) piCol, ( void * ) piStyle ) ); HB_GTSUPER_GETSCRCURSOR( pGT, piRow, piCol, piStyle ); pCTW = HB_GTCTW_GET( pGT ); @@ -1809,7 +1811,7 @@ static HB_BOOL hb_ctw_gt_GetScrChar( PHB_GT pGT, int iRow, int iCol, PHB_GTCTW pCTW; int iWindow, iShadow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetScrChar(%p,%d,%d,%p,%p,%p)", pGT, iRow, iCol, piColor, pbAttr, pusChar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetScrChar(%p,%d,%d,%p,%p,%p)", ( void * ) pGT, iRow, iCol, ( void * ) piColor, ( void * ) pbAttr, ( void * ) pusChar ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = iShadow = 0; @@ -1867,7 +1869,7 @@ static HB_BOOL hb_ctw_gt_GetScrUC( PHB_GT pGT, int iRow, int iCol, { HB_USHORT usChar; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetScrUC(%p,%d,%d,%p,%p,%p,%d)", pGT, iRow, iCol, piColor, pbAttr, puChar, fTerm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetScrUC(%p,%d,%d,%p,%p,%p,%d)", ( void * ) pGT, iRow, iCol, ( void * ) piColor, ( void * ) pbAttr, ( void * ) puChar, fTerm ) ); if( hb_ctw_gt_GetScrChar( pGT, iRow, iCol, piColor, pbAttr, &usChar ) ) { @@ -1903,7 +1905,7 @@ static HB_BOOL hb_ctw_gt_GetChar( PHB_GT pGT, int iRow, int iCol, PHB_CT_WND pWnd; int iWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetChar(%p,%d,%d,%p,%p,%p)", pGT, iRow, iCol, piColor, pbAttr, pusChar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_GetChar(%p,%d,%d,%p,%p,%p)", ( void * ) pGT, iRow, iCol, ( void * ) piColor, ( void * ) pbAttr, ( void * ) pusChar ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = HB_CTW_GETCURRENT( pCTW ); @@ -1932,7 +1934,7 @@ static HB_BOOL hb_ctw_gt_PutChar( PHB_GT pGT, int iRow, int iCol, PHB_GTCTW pCTW; int iWindow, iCurrWindow; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_PutChar(%p,%d,%d,%d,%d,%d)", pGT, iRow, iCol, iColor, ( int ) bAttr, ( int ) usChar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_PutChar(%p,%d,%d,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iColor, ( int ) bAttr, ( int ) usChar ) ); pCTW = HB_GTCTW_GET( pGT ); iWindow = iCurrWindow = HB_CTW_GETCURRENT( pCTW ); @@ -2026,7 +2028,7 @@ static HB_BOOL hb_ctw_gt_PutChar( PHB_GT pGT, int iRow, int iCol, static HB_BOOL hb_ctw_gt_Resize( PHB_GT pGT, int iRows, int iCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_Resize(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_Resize(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); if( HB_GTSUPER_RESIZE( pGT, iRows, iCols ) ) { @@ -2052,7 +2054,7 @@ static HB_BOOL hb_ctw_gt_Resize( PHB_GT pGT, int iRows, int iCols ) static HB_BOOL hb_ctw_gt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); switch( iType ) { @@ -2108,9 +2110,9 @@ static HB_BOOL hb_ctw_gt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static int hb_ctw_gt_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, int iClrNorm, int iClrHigh, double dDelay ) { - int iOptions, iRet = 0; + int iOptions; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_Alert(%p,%p,%p,%d,%d,%f)", pGT, pMessage, pOptions, iClrNorm, iClrHigh, dDelay ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_Alert(%p,%p,%p,%d,%d,%f)", ( void * ) pGT, ( void * ) pMessage, ( void * ) pOptions, iClrNorm, iClrHigh, dDelay ) ); if( pMessage && HB_IS_STRING( pMessage ) && pOptions && ( iOptions = ( int ) hb_arrayLen( pOptions ) ) > 0 ) @@ -2137,12 +2139,13 @@ static int hb_ctw_gt_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, } if( fScreen ) { + int iRet = 0; + PHB_GTCTW pCTW = HB_GTCTW_GET( pGT ); HB_UINT ulWidth = 0, ulCurrWidth = 0, ulMsg = 0, ul2, ulMaxWidth, ulLast; char szKey[ HB_MAX_CHAR_LEN ]; HB_SIZE nChar; - int iKey, iDspCount, iLines = 0, iTop, iLeft, iBottom, iRight, - iMnuCol, iPos, iClr, iWnd, iPrevWnd, i; + int iDspCount, iLines = 0, iTop, iLeft, iBottom, iRight, iPos, iClr, iWnd, iPrevWnd, i; HB_SIZE nLen, nOptLen; void * hMessage, * hOpt; const HB_WCHAR * szMessageW = hb_itemGetStrU16( pMessage, HB_CDP_ENDIAN_NATIVE, &hMessage, &nLen ), @@ -2227,6 +2230,8 @@ static int hb_ctw_gt_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, iPos = 1; while( iRet == 0 ) { + int iKey, iMnuCol; + HB_GTSELF_DISPBEGIN( pGT ); iMnuCol = ( ( ulWidth - ulCurrWidth ) >> 1 ) + 1; for( i = 1; i <= iOptions; ++i ) @@ -2321,7 +2326,7 @@ static int hb_ctw_gt_ReadKey( PHB_GT pGT, int iEventMask ) { int iKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ctw_gt_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); iKey = HB_GTSUPER_READKEY( pGT, iEventMask ); @@ -2389,7 +2394,7 @@ static void hb_ctw_gt_RedrawDiff( PHB_GT pGT ) } } -/* PUBLIC FUNCTIONS */ +/* Public functions */ HB_BOOL hb_ctwInit( void ) { @@ -2770,7 +2775,7 @@ int hb_ctwLastKey( int * piNewKey ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Exit = hb_ctw_gt_Exit; pFuncTable->MouseRow = hb_ctw_MouseRow; @@ -2802,9 +2807,9 @@ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) return HB_TRUE; } -/* *********************************************************************** */ +/* --- */ #define HB_GTSUPER NULL #include "hbgtreg.h" -/* *********************************************************************** */ +/* --- */ diff --git a/contrib/hbct/cursor.c b/contrib/hbct/cursor.c index 309781c3d5..3b66c6cdae 100644 --- a/contrib/hbct/cursor.c +++ b/contrib/hbct/cursor.c @@ -1,7 +1,5 @@ /* - * CT3 video functions: - * - * SaveCursor(), RestCursor() + * CT3 video functions: SaveCursor(), RestCursor() * * Copyright 2007 Przemyslaw Czerpak * diff --git a/contrib/hbct/datetime.c b/contrib/hbct/datetime.c index 1781ffa7c9..3382515c41 100644 --- a/contrib/hbct/datetime.c +++ b/contrib/hbct/datetime.c @@ -1,10 +1,8 @@ /* - * CT3 Date & Time functions: - BoM() / EoM() - * - BoQ() / EoQ() - * - BoY() / EoY() - * - WoM() + * CT3 Date & Time functions: BoM() / EoM(), BoQ() / EoQ(), BoY() / EoY(), WoM() * * Copyright 2005 Pavel Tsarenko + * Copyright 1999 Jose Lalin (WoM()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Jose Lalin - * WoM() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbdate.h" diff --git a/contrib/hbct/dattime2.c b/contrib/hbct/dattime2.c index 5fa2368eaa..fc98953d0e 100644 --- a/contrib/hbct/dattime2.c +++ b/contrib/hbct/dattime2.c @@ -1,18 +1,15 @@ /* - * CT3 Date & Time functions, part II: - AddMonth() - * - CToDoW() - * - CToMonth() - * - DaysInMonth() - * - DaysToMonth() - * - DMY() - * - DoY() - * - IsLeap() - * - LastDayOM() - * - MDY() - * - NToCDoW() - * - NToCMonth() - * - Quarter() - * - Week() + * CT3 Date & Time functions, part II: + * AddMonth() + * DMY() + * DoY() + * IsLeap() + * LastDayOM() + * MDY() + * NToCDoW() + * NToCMonth() + * Quarter() + * Week() * * Copyright 2006 Pavel Tsarenko * @@ -289,9 +286,7 @@ HB_FUNC( ADDMONTH ) iDays = ct_daysinmonth( iMonth, ct_isleap( iYear ) ); if( iDay > iDays ) - { iDay = iDays; - } lJulian = hb_dateEncode( iYear, iMonth, iDay ); if( fTimeStamp ) @@ -374,7 +369,7 @@ HB_FUNC( LASTDAYOM ) bLeap = ct_isleap( iYear ); } - hb_retni( ( iMonth && ( iMonth <= 12 ) ? ct_daysinmonth( iMonth, bLeap ) : 0 ) ); + hb_retni( ( iMonth && iMonth <= 12 ) ? ct_daysinmonth( iMonth, bLeap ) : 0 ); } HB_FUNC( NTOCDOW ) diff --git a/contrib/hbct/dattime3.c b/contrib/hbct/dattime3.c index 5861d3090b..38a39eb88d 100644 --- a/contrib/hbct/dattime3.c +++ b/contrib/hbct/dattime3.c @@ -47,7 +47,7 @@ /* stime() exists only in SVr4, SVID, X/OPEN and Linux */ #ifndef _SVID_SOURCE -# define _SVID_SOURCE +#define _SVID_SOURCE #endif #include "hbapi.h" diff --git a/contrib/hbct/dbftools.c b/contrib/hbct/dbftools.c index 3def2a6425..1d8b93b012 100644 --- a/contrib/hbct/dbftools.c +++ b/contrib/hbct/dbftools.c @@ -1,6 +1,5 @@ /* * dbf structure related functions: - * * FieldSize(), FieldDeci(), FieldNum(), DbfSize() * * Copyright 2000 Alexander Kresin @@ -62,18 +61,16 @@ HB_FUNC( DBFSIZE ) if( ( pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer() ) != NULL ) { PHB_ITEM pSize = hb_itemNew( NULL ); - HB_ULONG ulRecSize, ulRecCount; if( SELF_INFO( pArea, DBI_GETHEADERSIZE, pSize ) == HB_SUCCESS ) { llSize = hb_itemGetNL( pSize ) + 1; if( SELF_INFO( pArea, DBI_GETRECSIZE, pSize ) == HB_SUCCESS ) { + HB_ULONG ulRecSize, ulRecCount; ulRecSize = hb_itemGetNL( pSize ); if( SELF_RECCOUNT( pArea, &ulRecCount ) == HB_SUCCESS ) - { llSize += ( HB_MAXINT ) ulRecCount * ulRecSize; - } } } hb_itemRelease( pSize ); diff --git a/contrib/hbct/disk.c b/contrib/hbct/disk.c index 2896ffcbf9..1c146be4ab 100644 --- a/contrib/hbct/disk.c +++ b/contrib/hbct/disk.c @@ -2,24 +2,13 @@ * CT (Clipper Tools) Disk, File and Directory management. * * Copyright 2004-2005 Eduardo Fernandes - * - * DirMake() - Ready. Already exist a MakeDir() function in xHarbour RTL Lib, - * but DirMake returns a more compatible error codes. - * DirName() - Ready. - * DriveType() - Ready. corrected - * Volume() - Ready. - * VolSerial() - Ready. - * - * Copyright 2004 Phil Krylov - * NumDiskL() - * - * Copyright 2006 Pavel Tsarenko - * TrueName() - * + * DirMake(), DirName(), DriveType(), Volume(), VolSerial() + * Copyright 2004 Phil Krylov (NumDiskL()) + * Copyright 2006 Pavel Tsarenko (TrueName()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or ( at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -28,9 +17,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA ( or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -186,8 +175,8 @@ HB_FUNC( NUMDISKL ) * any drive letter and "test" will be the new volume name. * * Notes: - * 1) if the drive letter is not suplied, then the current drive will - * be used to change voloume name. + * 1) if the drive letter is not supplied, then the current drive will + * be used to change volume name. * 2) if Volume("X:") or Volume("X:\") then the volume name of the drive * "X:" will be erased. * 3) if Volume("") or Volume() then the volume name of the current drive @@ -234,7 +223,7 @@ HB_FUNC( VOLUME ) /* * VolSerial() function returns the volume serial number of an drive letter like - * floppy, Hard-disk, CD or mapped network drive. The return value is a dword + * floppy, Hard-disk, CD or mapped network drive. The return value is a numeric * type. If the drive is not available, VolSerial() returns -1. * * Syntax is: VolSerial( "X:\" ) diff --git a/contrib/hbct/dummy.c b/contrib/hbct/dummy.c index 5c2b73d9c4..bc45f31f4c 100644 --- a/contrib/hbct/dummy.c +++ b/contrib/hbct/dummy.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" /* Extended Drivers */ HB_FUNC( CGA40 ) { ; } diff --git a/contrib/hbct/envparam.c b/contrib/hbct/envparam.c index 43d29c78ef..203879bb23 100644 --- a/contrib/hbct/envparam.c +++ b/contrib/hbct/envparam.c @@ -1,6 +1,5 @@ /* - * CT3 Number and bit manipulation functions: - * EnvParam() + * EnvParam() * * Copyright 2012 Przemyslaw Czerpak * @@ -77,10 +76,11 @@ HB_FUNC( ENVPARAM ) defined( HB_OS_DOS ) || defined( HB_OS_OS2 ) char * const * pEnviron = environ, * const * pEnv; char * pResult = NULL, * pDst; - HB_SIZE nSize = 0; if( pEnviron ) { + HB_SIZE nSize = 0; + for( pEnv = pEnviron; *pEnv; pEnv++ ) nSize += strlen( *pEnv ) + 2; @@ -105,7 +105,7 @@ HB_FUNC( ENVPARAM ) hb_retc_null(); #elif defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE ) LPTCH lpEnviron = GetEnvironmentStrings(), lpEnv; - LPTSTR lpResult = NULL, lpDst; + LPTSTR lpResult = NULL; HB_SIZE nSize = 0; if( lpEnviron ) @@ -118,6 +118,8 @@ HB_FUNC( ENVPARAM ) } if( nSize > 0 ) { + LPTSTR lpDst; + lpResult = ( LPTSTR ) hb_xgrab( ( nSize + 1 ) * sizeof( TCHAR ) ); for( lpEnv = lpEnviron, lpDst = lpResult; *lpEnv; lpEnv++ ) { diff --git a/contrib/hbct/exponent.c b/contrib/hbct/exponent.c index c7318728dc..ee7c99c041 100644 --- a/contrib/hbct/exponent.c +++ b/contrib/hbct/exponent.c @@ -1,8 +1,8 @@ /* - * CT3 Number and bit manipulation functions: - Mantissa() - * - Exponent() + * CT3 Number and bit manipulation functions: + * Mantissa(), Exponent() * - * Copyright 2002 Walter Negro - FOEESITRA" + * Copyright 2002 Walter Negro - FOEESITRA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/contrib/hbct/fcopy.prg b/contrib/hbct/fcopy.prg index 643b8d7ffa..41b4c4625c 100644 --- a/contrib/hbct/fcopy.prg +++ b/contrib/hbct/fcopy.prg @@ -3,8 +3,8 @@ * FileCopy(), FileCOpen(), FileCCLose(), FileAppend() * * Author...: Frederic J. Bell - * Dated....: Jun,17 94 - * Revised..: Sep,20 94 + * Dated....: 1994-06-17 + * Revised..: 1994-09-20 * Purpose..: Replaces the following CA-T*ols functions which generate GPF's * FileCopy(), FileCOpen(), FileAppend()! * Relies on: Clipper (can you believe it!) @@ -66,12 +66,8 @@ THREAD STATIC t_hSrcFile := F_ERROR THREAD STATIC t_lSetDaTi := .T. THREAD STATIC t_fileTime -/* - * FileCopy() - * This is a replacement for the CA-T*ols III function of the - * same name that causes GPF's. - */ - +/* This is a replacement for the CA-T*ols III function of the + same name that causes GPF's. */ FUNCTION FileCopy( cSource, cDest, lMode ) LOCAL hDstFile diff --git a/contrib/hbct/files.c b/contrib/hbct/files.c index 6e2c32fe17..66df30fefb 100644 --- a/contrib/hbct/files.c +++ b/contrib/hbct/files.c @@ -1,16 +1,12 @@ /* - * CT3 files functions + * CT3 files functions: SetFAttr() * - * SetFattr() * Copyright 2001 Luiz Rafael Culik - * - * SetFDaTi(), FileSMax(), FileDelete() + * SetFDaTi(), FileSMax(), FileDelete() * Copyright 2004 Phil Krylov - * - * FileSeek(), FileSize(), FileAttr(), FileTime(), FileDate() - * FileMove(), FileSMax(), - * DeleteFile(), RenameFile() - * + * FileSeek(), FileSize(), FileAttr(), FileTime(), FileDate() + * FileMove(), FileSMax(), + * DeleteFile(), RenameFile() * Copyright 2007 Przemyslaw Czerpak * * This program is free software; you can redistribute it and/or modify @@ -202,13 +198,14 @@ HB_FUNC( SETFDATI ) if( szFile && *szFile ) { - PHB_ITEM pDate, pTime; long lJulian, lMillisec; if( HB_ISTIMESTAMP( 1 ) ) hb_partdt( &lJulian, &lMillisec, 1 ); else { + PHB_ITEM pDate, pTime; + pDate = hb_param( 2, HB_IT_DATE ); if( pDate ) pTime = hb_param( 3, HB_IT_STRING ); diff --git a/contrib/hbct/finan.c b/contrib/hbct/finan.c index 36a7d412cc..a283d9f10b 100644 --- a/contrib/hbct/finan.c +++ b/contrib/hbct/finan.c @@ -7,9 +7,8 @@ * - Rate() * * Copyright 2001 Alejandro de Garate - * - * Documentation and changes concerning error handling Copyright 2001 - * IntTec GmbH, Freiburg, Germany, Author: Martin Vogel + * Copyright 2001 IntTec GmbH, Freiburg, Germany + * Author: Martin Vogel (Documentation and changes concerning error handling) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -266,15 +265,16 @@ HB_FUNC( RATE ) double dCapital = hb_parnd( 1 ); double dPayment = hb_parnd( 2 ); double dTime = hb_parnd( 3 ); - double dAux; /* estimated payment to compare for */ - double dEpsilon = 0.00001; /* mimimal to consider 2 numbers as equal */ + double dEpsilon = 0.00001; /* minimal to consider 2 numbers as equal */ double dScale = 1.0; /* fractional step */ - double r; /* temptative rate */ double j = 1.0; /* index */ - double dExp; - while( j < 1020.0 ) /* maximum anual rate */ + while( j < 1020.0 ) /* maximum annual rate */ { + double dAux; /* estimated payment to compare for */ + double r; /* temptative rate */ + double dExp; + HB_MATH_EXCEPTION hb_exc; double dBase; diff --git a/contrib/hbct/ftoc.c b/contrib/hbct/ftoc.c index 97bdc53902..426b7785b1 100644 --- a/contrib/hbct/ftoc.c +++ b/contrib/hbct/ftoc.c @@ -1,6 +1,5 @@ /* - * CT3 Number and bit manipulation functions: - FToC() - * - CToF() + * CT3 Number and bit manipulation functions: FToC(), CToF() * * Copyright 2002 Walter Negro - FOEESITRA" * diff --git a/contrib/hbct/getinfo.prg b/contrib/hbct/getinfo.prg index d863ca0426..7d7e189844 100644 --- a/contrib/hbct/getinfo.prg +++ b/contrib/hbct/getinfo.prg @@ -1,11 +1,8 @@ /* * CT3 GET/READ Functions * - * SaveGets(), RestGets() - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * - * CountGets(), CurrentGet(), GetFldRow(), GetFldCol(), GetFldVar() - * Copyright 2004 Philip Chee + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (SaveGets(), RestGets()) + * Copyright 2004 Philip Chee (CountGets(), CurrentGet(), GetFldRow(), GetFldCol(), GetFldVar()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,11 +56,9 @@ FUNCTION SaveGets() RETURN aGetList FUNCTION RestGets( aGetList ) - RETURN ( GetList := aGetList ) != NIL FUNCTION CountGets() - RETURN Len( GetList ) FUNCTION CurrentGet() diff --git a/contrib/hbct/getinput.prg b/contrib/hbct/getinput.prg index f45caad805..fd962af08d 100644 --- a/contrib/hbct/getinput.prg +++ b/contrib/hbct/getinput.prg @@ -1,7 +1,5 @@ /* - * CT3 GET function: - * - * GetInput() + * CT3 GET function: GetInput() * * Copyright 2007 Przemyslaw Czerpak * diff --git a/contrib/hbct/getsecrt.prg b/contrib/hbct/getsecrt.prg index 9e5ba28d98..c24fab6243 100644 --- a/contrib/hbct/getsecrt.prg +++ b/contrib/hbct/getsecrt.prg @@ -1,7 +1,5 @@ /* - * CT3 GET function: - * - * GetSecret() + * CT3 GET function: GetSecret() * * Copyright 2007 Przemyslaw Czerpak * @@ -47,8 +45,8 @@ */ #include "getexit.ch" -#include "setcurs.ch" #include "inkey.ch" +#include "setcurs.ch" FUNCTION GetSecret( cVar, nRow, nCol, lSay, xPrompt ) @@ -93,7 +91,7 @@ STATIC FUNCTION _HIDE( cVar ) RETURN PadR( Replicate( "*", Len( RTrim( cVar ) ) ), Len( cVar ) ) -STATIC FUNCTION _VALUE( cVar, lHide, xNew ) +STATIC FUNCTION _VALUE( /* @ */ cVar, lHide, xNew ) IF lHide RETURN _HIDE( cVar ) @@ -103,7 +101,7 @@ STATIC FUNCTION _VALUE( cVar, lHide, xNew ) RETURN cVar -STATIC PROCEDURE _SECRET( _cGetSecret, lHide, oGet, oGetList ) +STATIC PROCEDURE _SECRET( /* @ */ _cGetSecret, /* @ */ lHide, oGet, oGetList ) LOCAL nKey, nLen, bKeyBlock LOCAL cKey diff --git a/contrib/hbct/justify.c b/contrib/hbct/justify.c index f051dcee36..f08c9276c2 100644 --- a/contrib/hbct/justify.c +++ b/contrib/hbct/justify.c @@ -51,7 +51,7 @@ #define DO_JUSTIFY_JUSTLEFT 0 #define DO_JUSTIFY_JUSTRIGHT 1 -/* helper function for the justxxx() functions */ +/* helper function for the Just*() functions */ static void do_justify( int iSwitch ) { int iNoRet = ct_getref() && HB_ISBYREF( 1 ); @@ -88,7 +88,7 @@ static void do_justify( int iSwitch ) case DO_JUSTIFY_JUSTLEFT: pc = pcString; sJustOffset = 0; - while( ( *pc == cJustChar ) && ( pc < pcString + sStrLen ) ) + while( *pc == cJustChar && pc < ( pcString + sStrLen ) ) { sJustOffset++; pc++; @@ -104,7 +104,7 @@ static void do_justify( int iSwitch ) case DO_JUSTIFY_JUSTRIGHT: pc = pcString + sStrLen - 1; sJustOffset = 0; - while( ( *pc == cJustChar ) && ( pc >= pcString ) ) + while( *pc == cJustChar && pc >= pcString ) { sJustOffset++; pc--; diff --git a/contrib/hbct/keysave.prg b/contrib/hbct/keysave.prg index e157ddea2e..38fe20fc04 100644 --- a/contrib/hbct/keysave.prg +++ b/contrib/hbct/keysave.prg @@ -1,7 +1,6 @@ /* - * CT3 SETKEY Functions + * CT3 SETKEY Functions: SaveSetKey(), RestSetKey() * - * SaveSetKey(), RestSetKey() * Copyright 2004 Philip Chee * * This program is free software; you can redistribute it and/or modify @@ -46,7 +45,6 @@ */ FUNCTION SaveSetKey() - RETURN hb_SetKeySave() FUNCTION RestSetKey( aSavedTraps ) diff --git a/contrib/hbct/keysec.prg b/contrib/hbct/keysec.prg index 4a7fc52c12..4292ce4a3d 100644 --- a/contrib/hbct/keysec.prg +++ b/contrib/hbct/keysec.prg @@ -1,7 +1,7 @@ /* - * CT3 Miscellaneous functions: - KeySec() + * CT3 Miscellaneous functions: KeySec() * - * Copyright 2005 Pavel Tsarenko - + * Copyright 2005 Pavel Tsarenko * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/contrib/hbct/keyset.c b/contrib/hbct/keyset.c index e1b1fede21..ddcc67adfb 100644 --- a/contrib/hbct/keyset.c +++ b/contrib/hbct/keyset.c @@ -1,10 +1,8 @@ /* - * CT3 Printer functions: - KSetIns() - * - KSetCaps() - * - KSetNum() - * - KSetScroll() + * CT3 Printer functions: + * KSetIns(), KSetCaps(), KSetNum(), KSetScroll() * - * Copyright 2001 Walter Negro - FOEESITRA" + * Copyright 2001 Walter Negro - FOEESITRA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,7 +50,7 @@ static void SetGet( int iFlag ) { - int iState = 0, iNewState; + int iState = 0; HB_GT_INFO gtInfo; memset( >Info, 0, sizeof( gtInfo ) ); @@ -67,8 +65,8 @@ static void SetGet( int iFlag ) if( HB_ISLOG( 1 ) ) { - iNewState = hb_parl( 1 ) ? ( iState | iFlag ) : ( iState & ~iFlag ); - gtInfo.pNewVal = hb_itemPutNI( gtInfo.pNewVal, iNewState ); + gtInfo.pNewVal = hb_itemPutNI( gtInfo.pNewVal, + hb_parl( 1 ) ? ( iState | iFlag ) : ( iState & ~iFlag ) ); hb_gtInfo( HB_GTI_KBDSHIFTS, >Info ); } diff --git a/contrib/hbct/keytime.prg b/contrib/hbct/keytime.prg index 58bdf4b063..60eb094a1e 100644 --- a/contrib/hbct/keytime.prg +++ b/contrib/hbct/keytime.prg @@ -1,7 +1,7 @@ /* - * CT3 Miscellaneous functions: - KeyTime() + * CT3 Miscellaneous functions: KeyTime() * - * Copyright 2005 Pavel Tsarenko - + * Copyright 2005 Pavel Tsarenko * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,8 +60,8 @@ FUNCTION KeyTime( nKey, cClockTime ) nMin := Val( SubStr( cClockTime, 4, 2 ) ) nSec := Val( SubStr( cClockTime, 7, 2 ) ) nLast := -1 - t_hIdle := hb_idleAdd( {|| doKeyTime( nKey, cClockTime, nHour, nMin, nSec, ; - @nLast ) } ) + t_hIdle := hb_idleAdd( ; + {|| doKeyTime( nKey, cClockTime, nHour, nMin, nSec, @nLast ) } ) RETURN .T. ENDIF @@ -69,12 +69,13 @@ FUNCTION KeyTime( nKey, cClockTime ) STATIC PROCEDURE doKeyTime( nKey, cClockTime, nHour, nMin, nSec, nLast ) - LOCAL ccTime := Time() - LOCAL nHr := Val( SubStr( ccTime, 1, 2 ) ) - LOCAL nMn := Val( SubStr( ccTime, 4, 2 ) ) - LOCAL nSc := Val( SubStr( ccTime, 7, 2 ) ) + LOCAL cTime := Time() + LOCAL nHr := Val( SubStr( cTime, 1, 2 ) ) + LOCAL nMn := Val( SubStr( cTime, 4, 2 ) ) + LOCAL nSc := Val( SubStr( cTime, 7, 2 ) ) - IF nHour == 99 + DO CASE + CASE nHour == 99 IF nHr > nLast hb_keyPut( nKey ) nLast := nHr @@ -83,7 +84,7 @@ STATIC PROCEDURE doKeyTime( nKey, cClockTime, nHour, nMin, nSec, nLast ) t_hIdle := NIL ENDIF ENDIF - ELSEIF nMin == 99 .AND. nHr == nHour + CASE nMin == 99 .AND. nHr == nHour IF nMn > nLast hb_keyPut( nKey ) nLast := nMn @@ -92,7 +93,7 @@ STATIC PROCEDURE doKeyTime( nKey, cClockTime, nHour, nMin, nSec, nLast ) t_hIdle := NIL ENDIF ENDIF - ELSEIF nSec == 99 .AND. nHr == nHour .AND. nMn == nMin + CASE nSec == 99 .AND. nHr == nHour .AND. nMn == nMin IF nSc > nLast hb_keyPut( nKey ) nLast := nSc @@ -101,10 +102,10 @@ STATIC PROCEDURE doKeyTime( nKey, cClockTime, nHour, nMin, nSec, nLast ) t_hIdle := NIL ENDIF ENDIF - ELSEIF ccTime > cClockTime + CASE cTime > cClockTime hb_keyPut( nKey ) hb_idleDel( t_hIdle ) t_hIdle := NIL - ENDIF + ENDCASE RETURN diff --git a/contrib/hbct/kxlat.prg b/contrib/hbct/kxlat.prg index cb5d49ea7a..88647aaba3 100644 --- a/contrib/hbct/kxlat.prg +++ b/contrib/hbct/kxlat.prg @@ -53,7 +53,7 @@ /* Trick to make it work in the STATIC initializer. It's safe because it's only used with ASCII chars. */ -#define hb_keyCode( x ) Asc( x ) +#define hb_keyCode( x ) Asc( x ) STATIC s_hTrs := { => } STATIC s_hMutex := hb_mutexCreate() diff --git a/contrib/hbct/like.c b/contrib/hbct/like.c index cd1c99da73..2c078def5f 100644 --- a/contrib/hbct/like.c +++ b/contrib/hbct/like.c @@ -1,6 +1,5 @@ /* - * CT3 string functions: - * Like() + * CT3 string functions: Like() * * Copyright 2007 Przemyslaw Czerpak * diff --git a/contrib/hbct/misc1.c b/contrib/hbct/misc1.c index 69e95e7184..51149d59f7 100644 --- a/contrib/hbct/misc1.c +++ b/contrib/hbct/misc1.c @@ -1,7 +1,7 @@ /* - * CT3 Miscellaneous functions: - XToC() + * CT3 Miscellaneous functions: XToC() * - * Copyright 2002 Walter Negro - FOEESITRA" + * Copyright 2002 Walter Negro - FOEESITRA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/contrib/hbct/misc3.c b/contrib/hbct/misc3.c index 36c8535c26..741f0a52b6 100644 --- a/contrib/hbct/misc3.c +++ b/contrib/hbct/misc3.c @@ -1,5 +1,5 @@ /* - * CT3 Miscellaneous functions: - KbdStat() + * CT3 Miscellaneous functions: KbdStat() * * Copyright 2005 Pavel Tsarenko * diff --git a/contrib/hbct/num1.c b/contrib/hbct/num1.c index 299bfe8143..26ce4d13a0 100644 --- a/contrib/hbct/num1.c +++ b/contrib/hbct/num1.c @@ -1,15 +1,12 @@ /* - * - * CT3 Numeric functions - PART 1 - * - Celsius() - * - Fahrenheit() - * - Infinity() + * CT3 Numeric functions - PART 1 + * - Celsius() + * - Fahrenheit() + * - Infinity() * * Copyright 2001 Alejandro de Garate - * - * Documentation and changes concerning error handling Copyright 2001 - * IntTec GmbH, Freiburg, Germany, Author: Martin Vogel - * + * Copyright 2001 IntTec GmbH, Freiburg, Germany + * Author: Martin Vogel (Documentation and changes concerning error handling) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/contrib/hbct/numat.c b/contrib/hbct/numat.c index de47842db3..3deffb8461 100644 --- a/contrib/hbct/numat.c +++ b/contrib/hbct/numat.c @@ -49,7 +49,7 @@ HB_FUNC( NUMAT ) { - if( ( HB_ISCHAR( 1 ) ) && ( HB_ISCHAR( 2 ) ) ) + if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) ) { const char * pcStringToMatch = hb_parc( 1 ); HB_SIZE sStrToMatchLen = hb_parclen( 1 ); diff --git a/contrib/hbct/numbase.c b/contrib/hbct/numbase.c index 7f4a0a5172..e01bc507a2 100644 --- a/contrib/hbct/numbase.c +++ b/contrib/hbct/numbase.c @@ -119,7 +119,7 @@ HB_FUNC( NTOC ) { char szBuffer[ 256 ], * pszResult = NULL; HB_MAXINT nValue = 0; - int iBase = hb_parnidef( 2, 10 ), iLen = hb_parni( 3 ), i; + int iBase = hb_parnidef( 2, 10 ), iLen = hb_parni( 3 ); if( iLen < 0 || iLen > ( int ) sizeof( szBuffer ) ) iLen = sizeof( szBuffer ); @@ -127,6 +127,7 @@ HB_FUNC( NTOC ) if( iBase >= 2 && iBase <= 36 && ct_numParam( 1, &nValue ) ) { HB_MAXUINT uValue = ( HB_MAXUINT ) nValue; + int i; i = iLen == 0 ? ( int ) sizeof( szBuffer ) : iLen; do diff --git a/contrib/hbct/pos1.c b/contrib/hbct/pos1.c index 838af8448b..c35db5b4db 100644 --- a/contrib/hbct/pos1.c +++ b/contrib/hbct/pos1.c @@ -1,9 +1,7 @@ /* * PosAlpha(), PosLower(), PosRange() and PosUpper() CT3 string functions * - * PosUpper() Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * - * PosAlpha(), PosLower(), PosRange() + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (PosUpper()) * Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany * Author: Martin Vogel * @@ -56,12 +54,12 @@ #define DO_POS1_POSRANGE 2 #define DO_POS1_POSUPPER 3 -/* helper function for the posxxx() functions */ +/* helper function for the Pos*() functions */ static void do_pos1( int iSwitch ) { if( HB_ISCHAR( 1 ) && /* all functions need string as 1st param */ - ( iSwitch != DO_POS1_POSRANGE || /* that's the only condition for all funcs _except_ POSRANGE */ - ( iSwitch == DO_POS1_POSRANGE && /* In addition, POSRANGE needs .. */ + ( iSwitch != DO_POS1_POSRANGE || /* that's the only condition for all functions _except_ PosRange() */ + ( iSwitch == DO_POS1_POSRANGE && /* In addition, PosRange() needs .. */ HB_ISCHAR( 2 ) && /* .. string as 2nd .. */ HB_ISCHAR( 3 ) ) ) ) /* .. and 3rd param */ { @@ -114,7 +112,7 @@ static void do_pos1( int iSwitch ) break; case DO_POS1_POSRANGE: - iDoRet = ( ( ucChar1 <= *puc ) && ( ucChar2 >= *puc ) ); + iDoRet = ( ucChar1 <= *puc && ucChar2 >= *puc ); break; case DO_POS1_POSUPPER: @@ -134,10 +132,11 @@ static void do_pos1( int iSwitch ) { PHB_ITEM pSubst = NULL; int iArgErrorMode = ct_getargerrormode(); - HB_ERRCODE iError = 0; if( iArgErrorMode != CT_ARGERR_IGNORE ) { + HB_ERRCODE iError = 0; + switch( iSwitch ) { case DO_POS1_POSALPHA: diff --git a/contrib/hbct/pos2.c b/contrib/hbct/pos2.c index 4b5817a0da..8662f2095a 100644 --- a/contrib/hbct/pos2.c +++ b/contrib/hbct/pos2.c @@ -53,7 +53,7 @@ HB_FUNC( POSCHAR ) if( hb_parclen( 1 ) > 0 ) { - if( ( hb_parclen( 2 ) > 0 ) || HB_ISNUM( 2 ) ) + if( hb_parclen( 2 ) > 0 || HB_ISNUM( 2 ) ) { const char * pcString = hb_parc( 1 ); HB_SIZE sStrLen = hb_parclen( 1 ); @@ -187,7 +187,6 @@ HB_FUNC( POSINS ) { const char * pcString = hb_parc( 1 ); HB_SIZE sStrLen = hb_parclen( 1 ); - const char * pcInsert; HB_SIZE sInsLen; if( ( sInsLen = hb_parclen( 2 ) ) > 0 ) @@ -195,7 +194,7 @@ HB_FUNC( POSINS ) HB_SIZE sStartPos; char * pcRet; - pcInsert = hb_parc( 2 ); + const char * pcInsert = hb_parc( 2 ); if( HB_ISNUM( 3 ) ) { @@ -264,7 +263,6 @@ HB_FUNC( POSREPL ) { const char * pcString = hb_parc( 1 ); HB_SIZE sStrLen = hb_parclen( 1 ); - const char * pcReplace; HB_SIZE sReplLen; if( ( sReplLen = hb_parclen( 2 ) ) > 0 ) @@ -273,7 +271,7 @@ HB_FUNC( POSREPL ) char * pcRet; HB_SIZE sRetLen; - pcReplace = hb_parc( 2 ); + const char * pcReplace = hb_parc( 2 ); if( HB_ISNUM( 3 ) ) { diff --git a/contrib/hbct/posdiff.c b/contrib/hbct/posdiff.c index 2da7f57e51..202f4f3808 100644 --- a/contrib/hbct/posdiff.c +++ b/contrib/hbct/posdiff.c @@ -73,7 +73,7 @@ HB_FUNC( POSDIFF ) pc1 = pcString1 + sIgnore; pc2 = pcString2 + sIgnore; - while( ( pc1 < pcString1 + sStrLen1 ) && ( pc2 < pcString2 + sStrLen2 ) ) + while( pc1 < ( pcString1 + sStrLen1 ) && pc2 < ( pcString2 + sStrLen2 ) ) { if( *pc1 != *pc2 ) { @@ -125,7 +125,7 @@ HB_FUNC( POSEQUAL ) else sCompare = ( sStrLen1 < sStrLen2 ? sStrLen1 : sStrLen2 ) - sIgnore; - if( ( sCompare == 0 ) || ( sIgnore > sStrLen1 ) || ( sIgnore > sStrLen2 ) ) + if( sCompare == 0 || sIgnore > sStrLen1 || sIgnore > sStrLen2 ) { int iArgErrorMode = ct_getargerrormode(); @@ -137,7 +137,7 @@ HB_FUNC( POSEQUAL ) return; } - if( ( sStrLen1 < ( sCompare + sIgnore ) ) || ( sStrLen2 < ( sCompare + sIgnore ) ) ) + if( sStrLen1 < ( sCompare + sIgnore ) || sStrLen2 < ( sCompare + sIgnore ) ) { int iArgErrorMode = ct_getargerrormode(); diff --git a/contrib/hbct/print.c b/contrib/hbct/print.c index c40724e00a..219811896c 100644 --- a/contrib/hbct/print.c +++ b/contrib/hbct/print.c @@ -1,5 +1,5 @@ /* - * CT3 Printer functions: + * CT3 Printer functions * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) (PrintReady()) * Copyright 2004 Phil Krylov (PrintSend()) diff --git a/contrib/hbct/range.c b/contrib/hbct/range.c index 295518d56a..f52fac3e09 100644 --- a/contrib/hbct/range.c +++ b/contrib/hbct/range.c @@ -58,7 +58,7 @@ HB_FUNC( RANGEREM ) const unsigned char * pc; unsigned char ucChar1, ucChar2; HB_SIZE sRetIndex; - int iMode, iBool; + int iMode; if( HB_ISCHAR( 1 ) ) ucChar1 = *( ( const unsigned char * ) hb_parc( 1 ) ); @@ -76,7 +76,8 @@ HB_FUNC( RANGEREM ) sRetIndex = 0; for( pc = ( const unsigned char * ) pcString; pc < ( const unsigned char * ) pcString + sStrLen; pc++ ) { - iBool = ( ( *pc ) >= ucChar1 ); + int iBool = ( ( *pc ) >= ucChar1 ); + if( iMode ) iBool |= ( ( *pc ) <= ucChar2 ); else @@ -125,7 +126,7 @@ HB_FUNC( RANGEREPL ) const unsigned char * pc; unsigned char ucChar1, ucChar2, ucReplace; HB_SIZE sRetIndex; - int iMode, iBool; + int iMode; if( HB_ISCHAR( 1 ) ) ucChar1 = *( ( const unsigned char * ) hb_parc( 1 ) ); @@ -148,7 +149,8 @@ HB_FUNC( RANGEREPL ) sRetIndex = 0; for( pc = ( const unsigned char * ) pcString; pc < ( const unsigned char * ) pcString + sStrLen; pc++ ) { - iBool = ( ( *pc ) >= ucChar1 ); + int iBool = ( ( *pc ) >= ucChar1 ); + if( iMode ) iBool |= ( ( *pc ) <= ucChar2 ); else @@ -169,7 +171,7 @@ HB_FUNC( RANGEREPL ) hb_storclen( pcRet, sStrLen, 3 ); if( iNoRef ) - /* Contrary to the official documentation, RANGREPL() returns NIL instead of .F. + /* Contrary to the official documentation, RangeRepl() returns NIL instead of .F. * in this situation. If the string is not passed by reference, it returns the * string regardless of iNoRef. */ hb_ret(); diff --git a/contrib/hbct/relation.c b/contrib/hbct/relation.c index b47336f2b8..2b483cb24e 100644 --- a/contrib/hbct/relation.c +++ b/contrib/hbct/relation.c @@ -65,7 +65,7 @@ HB_FUNC( CHARRELA ) HB_SIZE sMatchStrLen; /* check for empty strings */ - if( ( sStrToMatchLen1 == 0 ) || ( sStrToMatchLen2 == 0 ) ) + if( sStrToMatchLen1 == 0 || sStrToMatchLen2 == 0 ) { hb_retns( 0 ); return; @@ -164,7 +164,7 @@ HB_FUNC( CHARRELREP ) /* NOTE: this algorithm is not the best since the search that gave the larger relative position in the step before is repeated; try a search algorithm alternating between both strings */ - while( ( sOffset1 < sStrLen1 ) && ( sOffset2 < sStrLen2 ) ) + while( sOffset1 < sStrLen1 && sOffset2 < sStrLen2 ) { pc1 = ct_at_exact_forward( pcStringToMatch1, sStrToMatchLen1, pcString1 + sOffset1, sStrLen1 - sOffset1, diff --git a/contrib/hbct/remove.c b/contrib/hbct/remove.c index b59e7ba8d5..cef7348d68 100644 --- a/contrib/hbct/remove.c +++ b/contrib/hbct/remove.c @@ -59,7 +59,7 @@ static const HB_ERRCODE sulErrorSubcodes[] = CT_ERROR_REMRIGHT }; -/* helper function for the remxxx functions */ +/* helper function for the Rem*() functions */ static void do_remove( int iSwitch ) { /* param check */ @@ -68,7 +68,6 @@ static void do_remove( int iSwitch ) const char * pcString = hb_parc( 1 ); HB_SIZE sStrLen = hb_parclen( 1 ); const char * pcRet; - const char * pc; HB_SIZE sRetLen; char cSearch; @@ -84,7 +83,7 @@ static void do_remove( int iSwitch ) if( iSwitch != DO_REMOVE_REMRIGHT ) { - while( ( *pcRet == cSearch ) && ( pcRet < pcString + sStrLen ) ) + while( *pcRet == cSearch && pcRet < ( pcString + sStrLen ) ) { pcRet++; sRetLen--; @@ -93,8 +92,9 @@ static void do_remove( int iSwitch ) if( iSwitch != DO_REMOVE_REMLEFT ) { - pc = pcString + sStrLen - 1; - while( ( *pc == cSearch ) && ( pc >= pcRet ) ) + const char * pc = pcString + sStrLen - 1; + + while( *pc == cSearch && pc >= pcRet ) { pc--; sRetLen--; diff --git a/contrib/hbct/replace.c b/contrib/hbct/replace.c index 3044de054c..399ec90209 100644 --- a/contrib/hbct/replace.c +++ b/contrib/hbct/replace.c @@ -59,7 +59,7 @@ static const HB_ERRCODE sulErrorSubcodes[] = CT_ERROR_REPLRIGHT }; -/* helper function for the replxxx functions */ +/* helper function for the Repl*() functions */ static void do_replace( int iSwitch ) { /* suppressing return value ? */ diff --git a/contrib/hbct/screen1.c b/contrib/hbct/screen1.c index f4e0087e51..d98f458fc0 100644 --- a/contrib/hbct/screen1.c +++ b/contrib/hbct/screen1.c @@ -1,12 +1,8 @@ /* * CT3 video functions: - * * ScreenAttr(), ScreenMix(), SayScreen(), * ClearWin(), InvertWin(), UnTextWin(), CharWin(), ColorWin(), ColorRepl() - * - * and Harbour extension: - * - * ScreenText() + * and Harbour extension: ScreenText() * * Copyright 2007 Przemyslaw Czerpak * @@ -51,7 +47,6 @@ * */ -#include "hbdefs.h" #include "hbapi.h" #include "hbapigt.h" @@ -82,8 +77,8 @@ HB_FUNC( SCREENMIX ) { const char * szText = hb_parc( 1 ); const char * szAttr; - HB_SIZE nAttr = hb_parclen( 2 ), ul = 0; - int iRow, iCol, i; + HB_SIZE nAttr = hb_parclen( 2 ); + int iRow, iCol; if( nAttr == 0 ) { @@ -107,7 +102,8 @@ HB_FUNC( SCREENMIX ) HB_USHORT usChar; HB_WCHAR wc; PHB_CODEPAGE cdp = hb_gtHostCP(); - HB_SIZE nIndex = 0; + HB_SIZE nIndex = 0, ul = 0; + int i; hb_gtBeginWrite(); i = iCol; @@ -140,7 +136,7 @@ HB_FUNC( SAYSCREEN ) if( nLen ) { const char * szText = hb_parc( 1 ); - int iRow, iCol, i; + int iRow, iCol; hb_gtGetPos( &iRow, &iCol ); if( HB_ISNUM( 2 ) ) @@ -153,6 +149,7 @@ HB_FUNC( SAYSCREEN ) { PHB_CODEPAGE cdp = hb_gtHostCP(); HB_SIZE nIndex = 0; + int i; hb_gtBeginWrite(); i = iCol; @@ -186,7 +183,7 @@ static HB_BOOL hb_ctGetWinCord( int * piTop, int * piLeft, int iMaxRow = hb_gtMaxRow(); int iMaxCol = hb_gtMaxCol(); - hb_gtGetPosEx( piTop, piLeft ); + hb_gtGetPos( piTop, piLeft ); if( HB_ISNUM( 1 ) ) *piTop = hb_parni( 1 ); @@ -296,10 +293,11 @@ HB_FUNC( INVERTWIN ) HB_FUNC( UNTEXTWIN ) { int iTop, iLeft, iBottom, iRight; - HB_USHORT usRepl, usInit, usEnd; if( hb_ctGetWinCord( &iTop, &iLeft, &iBottom, &iRight ) ) { + HB_USHORT usRepl, usInit, usEnd; + usRepl = ( HB_USHORT ) hb_ctGetClearChar( 5 ); if( HB_ISNUM( 6 ) ) @@ -420,15 +418,15 @@ HB_FUNC( COLORWIN ) hb_retc_null(); } -HB_FUNC( SCREENTEXT ) /* HB_EXTENSION */ +HB_FUNC( SCREENTEXT ) /* HB_EXTENSION */ { int iTop, iLeft, iBottom, iRight; - char * pBuffer, * szText; - HB_SIZE nSize; if( hb_ctGetWinCord( &iTop, &iLeft, &iBottom, &iRight ) ) { - nSize = ( HB_SIZE ) ( iBottom - iTop + 1 ) * ( iRight - iLeft + 1 ); + char * pBuffer; + char * szText; + HB_SIZE nSize = ( HB_SIZE ) ( iBottom - iTop + 1 ) * ( iRight - iLeft + 1 ); szText = pBuffer = ( char * ) hb_xgrab( nSize + 1 ); while( iTop <= iBottom ) { @@ -454,7 +452,7 @@ HB_FUNC( COLORREPL ) { int iMaxRow = hb_gtMaxRow(); int iMaxCol = hb_gtMaxCol(); - int iRow = 0, iCol; + int iRow = 0; int iNewColor, iOldColor = 0; HB_BOOL fAll = HB_FALSE; @@ -468,7 +466,7 @@ HB_FUNC( COLORREPL ) hb_gtBeginWrite(); while( iRow <= iMaxRow ) { - iCol = 0; + int iCol = 0; while( iCol <= iMaxCol ) { int iColor; diff --git a/contrib/hbct/screen3.prg b/contrib/hbct/screen3.prg index 78e1535aef..12a74b6b59 100644 --- a/contrib/hbct/screen3.prg +++ b/contrib/hbct/screen3.prg @@ -1,7 +1,5 @@ /* - * CT3 video functions: - * - * ClearEol(), ClEol(), ClWin() + * CT3 video functions: ClearEol(), ClEol(), ClWin() * * Copyright 2007 Przemyslaw Czerpak * @@ -63,5 +61,4 @@ FUNCTION ClEol( nRow, nCol ) RETURN ClearWin( nRow, nCol, nRow, /* MaxCol() */, 7 /* "W/N" */, " " ) FUNCTION ClWin( nRow, nCol ) - RETURN ClearWin( nRow, nCol, /* MaxRow() */, /* MaxCol() */, 7 /* "W/N" */, " " ) diff --git a/contrib/hbct/scrmark.prg b/contrib/hbct/scrmark.prg index 5798a31024..e644b4e6f4 100644 --- a/contrib/hbct/scrmark.prg +++ b/contrib/hbct/scrmark.prg @@ -1,9 +1,7 @@ /* * CT3 video functions (screen-like functions): * - * ScreenMark() - * Copyright 2004 Pavel Tsarenko - * + * Copyright 2004 Pavel Tsarenko (ScreenMark()) * Copyright 2007 Przemyslaw Czerpak * modified for better CT3 compatibility and GT drivers which do not use * VGA compatible video buffer diff --git a/contrib/hbct/setlast.c b/contrib/hbct/setlast.c index 0dd1476e1c..8e8649f6cc 100644 --- a/contrib/hbct/setlast.c +++ b/contrib/hbct/setlast.c @@ -1,5 +1,5 @@ /* - * CT3 Set Status functions: - SetLastKey() + * CT3 Set Status functions: SetLastKey() * * Copyright 2003 Przemyslaw Czerpak * diff --git a/contrib/hbct/showtime.prg b/contrib/hbct/showtime.prg index 8fad0aff12..aa01bcefc1 100644 --- a/contrib/hbct/showtime.prg +++ b/contrib/hbct/showtime.prg @@ -46,7 +46,7 @@ FUNCTION ShowTime( nRow, nCol, lNoSec, cColor, l12, lAmPm ) - THREAD STATIC t_hTimer := NIL + THREAD STATIC t_hTimer IF HB_ISNUMERIC( nRow ) .AND. nRow >= 0 .AND. nRow <= MaxRow( .T. ) IF t_hTimer != NIL diff --git a/contrib/hbct/strswap.c b/contrib/hbct/strswap.c index 434a9bb1a1..c71966e4d6 100644 --- a/contrib/hbct/strswap.c +++ b/contrib/hbct/strswap.c @@ -77,11 +77,9 @@ HB_FUNC( STRSWAP ) sCmpLen = ( sStrLen1 < sStrLen2 ? sStrLen1 : sStrLen2 ); for( sIndex = 0; sIndex < sCmpLen; sIndex++ ) { - char cExchange; - if( iChange1 ) { - cExchange = *( pcString1 + sIndex ); + char cExchange = *( pcString1 + sIndex ); *( pcRet1 + sIndex ) = *( pcString2 + sIndex ); if( iChange2 ) *( pcRet2 + sIndex ) = cExchange; diff --git a/contrib/hbct/tab.c b/contrib/hbct/tab.c index ad393902d9..9900e9e85f 100644 --- a/contrib/hbct/tab.c +++ b/contrib/hbct/tab.c @@ -272,7 +272,7 @@ HB_FUNC( TABPACK ) { if( sTabIndex == sTabWidth - 1 ) { - /* we have just found the last character of a tabstopp */ + /* we have just found the last character of a tabstop */ *( pcRet + sRetLen ) = cTab; sRetLen++; sFillCount = 0; @@ -290,7 +290,7 @@ HB_FUNC( TABPACK ) { *( pcRet + sRetLen ) = cTab; sRetLen++; - /* discard any fill characters before the tabstopp */ + /* discard any fill characters before the tabstop */ sFillCount = 0; sTabIndex = 0; sIndex++; diff --git a/contrib/hbct/token1.c b/contrib/hbct/token1.c index d1997f49fa..152e01be80 100644 --- a/contrib/hbct/token1.c +++ b/contrib/hbct/token1.c @@ -120,7 +120,6 @@ static void do_token1( int iSwitch ) HB_SIZE sSubStrLen; HB_SIZE sRetStrLen = 0; HB_SIZE nToken = 0; - HB_SIZE nSkipCnt; const char * pc; /* separator string */ @@ -179,6 +178,7 @@ static void do_token1( int iSwitch ) while( nToken < nTokenCounter ) { HB_SIZE sMatchedPos = sSeparatorStrLen; + HB_SIZE nSkipCnt; /* Skip the left nSkip successive separators */ nSkipCnt = 0; diff --git a/contrib/hbct/token2.c b/contrib/hbct/token2.c index 77f5dd6089..b72c03c1a0 100644 --- a/contrib/hbct/token2.c +++ b/contrib/hbct/token2.c @@ -94,7 +94,7 @@ static int sTokEnvAddPos( TOKEN_ENVIRONMENT * pEnv, TOKEN_POSITION * pPos ) HB_SIZE nIndex; TOKEN_ENVIRONMENT env = *pEnv; - /* new memory needed ? */ + /* new memory needed? */ if( env[ 0 ].sStartPos == env[ 0 ].sEndPos ) { env = *pEnv = ( TOKEN_ENVIRONMENT ) @@ -200,7 +200,7 @@ static void sTokEnvDel( TOKEN_ENVIRONMENT env ) hb_xfree( env ); } -/* HARBOUR functions */ +/* Harbour functions */ /* static data */ static const char sc_spcSeparatorStr[] = @@ -442,7 +442,7 @@ HB_FUNC( TOKENNEXT ) sTokEnvIncPtr( sTokenEnvironment ); } - if( ( psTokenPosition == NULL ) || ( sStrLen <= psTokenPosition->sStartPos ) ) + if( psTokenPosition == NULL || sStrLen <= psTokenPosition->sStartPos ) { int iArgErrorMode = ct_getargerrormode(); @@ -524,7 +524,7 @@ HB_FUNC( TOKENEND ) if( pSubst != NULL ) hb_itemReturnRelease( pSubst ); else - /* it is CTIII behaviour to return .T. if there's no string TOKENINIT'ed */ + /* it is CT3 behaviour to return .T. if there's no string TokenInit()'ed */ hb_retl( HB_TRUE ); } } diff --git a/contrib/hbct/video.c b/contrib/hbct/video.c index bd474808de..c5709a3255 100644 --- a/contrib/hbct/video.c +++ b/contrib/hbct/video.c @@ -1,6 +1,5 @@ /* - * - * CT3 video functions + * CT3 video functions: * CharPix(), VGAPalette(), VideoType(), SetFont() * * Copyright 2004 Phil Krylov @@ -44,9 +43,6 @@ * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * - * - * See COPYING.txt for licensing terms. - * */ #include "hbapi.h" diff --git a/contrib/hbexpat/core.c b/contrib/hbexpat/core.c index 288c04bc63..c61b1dfbb7 100644 --- a/contrib/hbexpat/core.c +++ b/contrib/hbexpat/core.c @@ -44,16 +44,13 @@ * */ -/* - Author James Clark: +/* Author of expat, James Clark: http://www.jclark.com/xml/ Using Expat: - http://www.xml.com/pub/a/1999/09/expat/index.html - http://www.xml.com/lpt/a/47 + https://www.xml.com/pub/a/1999/09/expat/ */ -/* - TODO: +/* TODO: XML_SetExternalEntityRefHandler() XML_SetExternalEntityRefHandlerArg() XML_ExternalEntityParserCreate() @@ -63,7 +60,12 @@ #include "expat.h" -#define HB_EXPAT_VERS( ma, mi, mu ) ( XML_MAJOR_VERSION > ma || ( XML_MAJOR_VERSION == ma && ( XML_MINOR_VERSION > mi || ( XML_MINOR_VERSION == mi && XML_MICRO_VERSION >= mu ) ) ) ) +#define HB_EXPAT_VERS( ma, mi, mu ) \ + ( XML_MAJOR_VERSION > ma || \ + ( XML_MAJOR_VERSION == ma && \ + ( XML_MINOR_VERSION > mi || \ + ( XML_MINOR_VERSION == mi && \ + XML_MICRO_VERSION >= mu ) ) ) ) #include "hbapi.h" #include "hbapiitm.h" @@ -122,8 +124,7 @@ typedef struct _HB_EXPAT hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); \ } -/* Global initialization/deinitialization */ -/* -------------------------------------- */ +/* --- Global initialization/de-initialization --- */ static void * XMLCALL hb_expat_xgrab( size_t size ) { @@ -141,8 +142,7 @@ static void * XMLCALL hb_expat_xrealloc( void * p, size_t size ) return hb_xrealloc( p, size ); } -/* Callbacks */ -/* --------- */ +/* --- Callbacks --- */ /* Common */ @@ -643,8 +643,7 @@ static int XMLCALL hb_expat_NotStandaloneHandler( void * userdata ) return iResult; } -/* Constructor/Destructor */ -/* ---------------------- */ +/* --- Constructor/Destructor --- */ static void PHB_EXPAT_free( PHB_EXPAT hb_expat, HB_BOOL bFree ) { @@ -733,8 +732,7 @@ static void hb_expat_setvar( PHB_EXPAT hb_expat, int iHandler, PHB_ITEM pBlock ) } } -/* Harbour interface */ -/* ----------------- */ +/* --- Harbour interface --- */ HB_FUNC( XML_PARSERCREATE ) { @@ -917,8 +915,6 @@ HB_FUNC( XML_SETUNKNOWNENCODINGHANDLER ) hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* ; */ - HB_FUNC( XML_PARSE ) { if( PHB_EXPAT_is( 1 ) ) diff --git a/contrib/hbexpat/internal.c b/contrib/hbexpat/internal.c index 8f445dc823..ec253aff7c 100644 --- a/contrib/hbexpat/internal.c +++ b/contrib/hbexpat/internal.c @@ -57,6 +57,9 @@ HB_FUNC( __HB_XML_CDPU16MAP ) unsigned int tmp; + /* FIXME: uses hb_cdpGetU16() which cannot be used + with CPs using multibyte encoding. */ + for( tmp = 0; tmp <= UCHAR_MAX; ++tmp ) hb_arraySetNI( pMap, tmp + 1, hb_cdpGetU16( cdp, ( HB_UCHAR ) tmp ) ); diff --git a/contrib/hbfbird/firebird.c b/contrib/hbfbird/firebird.c index a7ccf2d698..72719b4a54 100644 --- a/contrib/hbfbird/firebird.c +++ b/contrib/hbfbird/firebird.c @@ -1,5 +1,5 @@ /* - * Firebird RDBMS low level (client api) interface code. + * Firebird RDBMS low-level (client API) interface code. * * Copyright 2003 Rodrigo Moreno rodrigo_moreno@yahoo.com * @@ -42,8 +42,6 @@ * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * - * See COPYING.txt for licensing terms. - * */ #include @@ -154,7 +152,7 @@ HB_FUNC( FBCONNECT ) short i = 0; int len; - /* TOFIX: Possible buffer overflow. Use hb_snprintf(). */ + /* FIXME: Possible buffer overflow. Use hb_snprintf(). */ dpb[ i++ ] = isc_dpb_version1; dpb[ i++ ] = isc_dpb_user_name; len = ( int ) strlen( user ); @@ -471,11 +469,11 @@ HB_FUNC( FBFETCH ) ISC_STATUS_ARRAY status; unsigned short dialect = ( unsigned short ) hb_itemGetNI( hb_itemArrayGet( aParam, 5 ) ); - /* TOFIX */ + /* FIXME */ hb_retnl( isc_dsql_fetch( status, &stmt, dialect, - sqlda ) == 100L ? -1 : isc_sqlcode( status ) ); + sqlda ) == 100 ? -1 : isc_sqlcode( status ) ); } else hb_retnl( 0 ); @@ -504,7 +502,7 @@ HB_FUNC( FBFREE ) return; } - /* TOFIX: Freeing pointer received as parameter? We should at least set the item NULL. */ + /* FIXME: Freeing pointer received as parameter? We should at least set the item NULL. */ if( sqlda ) hb_xfree( sqlda ); @@ -523,7 +521,6 @@ HB_FUNC( FBGETDATA ) XSQLVAR * var; XSQLDA * sqlda = ( XSQLDA * ) hb_itemGetPtr( hb_itemArrayGet( aParam, 2 ) ); ISC_STATUS_ARRAY status; - ISC_QUAD * blob_id; int pos = hb_parni( 2 ) - 1; @@ -590,10 +587,11 @@ HB_FUNC( FBGETDATA ) break; case SQL_BLOB: - blob_id = ( ISC_QUAD * ) var->sqldata; + { + ISC_QUAD * blob_id = ( ISC_QUAD * ) var->sqldata; hb_retptr( ( void * ) blob_id ); break; - + } case SQL_SHORT: case SQL_LONG: case SQL_INT64: diff --git a/contrib/hbfbird/readme.txt b/contrib/hbfbird/readme.txt index 978f4e363d..d77551bcb6 100644 --- a/contrib/hbfbird/readme.txt +++ b/contrib/hbfbird/readme.txt @@ -1,6 +1,6 @@ -README 2003-12-23 - Harbour Low Level api for Firebird and Interbase RDBMS +README 2003-12-23 - Harbour low-level API for Firebird and Interbase RDBMS -This work is not finished yet. It's to be seem like Harbour TMysql routines. +This work is not finished yet. It's planned to be similar to Harbour TMysql routines. For full firebird documentation look at: @@ -11,19 +11,9 @@ Language Reference: http://www.ibphoenix.com/downloads/60LangRef.zip Developers guide: http://www.ibphoenix.com/downloads/60DevGuide.zip The Class implementation has no all implementation like TMysql has, because Firebird it's diferent. -For example, you can't navigate in records like Mysql do, ex: Getrow( number of row ), in firebird you can +For example, you cannot navigate in records like Mysql do, ex: Getrow( number of row ), in firebird you can just go forward. -FILES: - -firebird.c - Low level api -TFirebrd.prg - Class implementation, it's to be seems like TMysql. - -tests\simple.prg - Simple test class -tests\stress.prg - Stress test class -tests\test.prg - Testing using only low level api -tests\testapi.c - Pure C code to test firebird access. - TODO: Full implementation of blob control. For now, we have only partial control, only for text blobs (subtype 1). @@ -43,6 +33,6 @@ BUGS: Fix a few segment faults. I Need some help to find what's going on here. -That's all folks and sorry my poor english +That's all folks and sorry my poor English Rodrigo Moreno - rodrigo_moreno@yahoo.com diff --git a/contrib/hbfbird/tfirebrd.prg b/contrib/hbfbird/tfirebrd.prg index 8d10b94af5..faff0c291c 100644 --- a/contrib/hbfbird/tfirebrd.prg +++ b/contrib/hbfbird/tfirebrd.prg @@ -1,5 +1,5 @@ /* - * Firebird RDBMS low level (client api) interface code. + * Firebird RDBMS low-level (client API) interface code. * * Copyright 2003 Rodrigo Moreno rodrigo_moreno@yahoo.com * @@ -42,59 +42,57 @@ * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * - * See COPYING.txt for licensing terms. - * */ #include "hbclass.ch" -#define SQL_TEXT 452 -#define SQL_VARYING 448 -#define SQL_SHORT 500 -#define SQL_LONG 496 -#define SQL_FLOAT 482 -#define SQL_DOUBLE 480 -#define SQL_D_FLOAT 530 -#define SQL_TIMESTAMP 510 -#define SQL_BLOB 520 -#define SQL_ARRAY 540 -#define SQL_QUAD 550 -#define SQL_TYPE_TIME 560 -#define SQL_TYPE_DATE 570 -#define SQL_INT64 580 +#define SQL_TEXT 452 +#define SQL_VARYING 448 +#define SQL_SHORT 500 +#define SQL_LONG 496 +#define SQL_FLOAT 482 +#define SQL_DOUBLE 480 +#define SQL_D_FLOAT 530 +#define SQL_TIMESTAMP 510 +#define SQL_BLOB 520 +#define SQL_ARRAY 540 +#define SQL_QUAD 550 +#define SQL_TYPE_TIME 560 +#define SQL_TYPE_DATE 570 +#define SQL_INT64 580 #define SQL_DATE SQL_TIMESTAMP CREATE CLASS TFbServer - VAR db - VAR trans - VAR StartedTrans - VAR nError - VAR lError - VAR dialect + VAR db + VAR trans + VAR StartedTrans + VAR nError + VAR lError + VAR dialect - METHOD New( cServer, cUser, cPassword, nDialect ) - METHOD Destroy() INLINE FBClose( ::db ) - METHOD Close() INLINE FBClose( ::db ) + METHOD New( cServer, cUser, cPassword, nDialect ) + METHOD Destroy() INLINE FBClose( ::db ) + METHOD Close() INLINE FBClose( ::db ) - METHOD TableExists( cTable ) - METHOD ListTables() - METHOD TableStruct( cTable ) + METHOD TableExists( cTable ) + METHOD ListTables() + METHOD TableStruct( cTable ) - METHOD StartTransaction() - METHOD Commit() - METHOD Rollback() + METHOD StartTransaction() + METHOD Commit() + METHOD Rollback() - METHOD Execute( cQuery ) - METHOD Query( cQuery ) + METHOD Execute( cQuery ) + METHOD Query( cQuery ) - METHOD Update( oRow, cWhere ) - METHOD Delete( oRow, cWhere ) - METHOD Append( oRow ) + METHOD Update( oRow, cWhere ) + METHOD Delete( oRow, cWhere ) + METHOD Append( oRow ) - METHOD NetErr() INLINE ::lError - METHOD Error() INLINE FBError( ::nError ) - METHOD ErrorNo() INLINE ::nError + METHOD NetErr() INLINE ::lError + METHOD Error() INLINE FBError( ::nError ) + METHOD ErrorNo() INLINE ::nError ENDCLASS diff --git a/contrib/hbformat/hbfmtcls.prg b/contrib/hbformat/hbfmtcls.prg index 0022724d60..c22434c804 100644 --- a/contrib/hbformat/hbfmtcls.prg +++ b/contrib/hbformat/hbfmtcls.prg @@ -149,7 +149,7 @@ METHOD New( aParams, cIniName ) CLASS HBFormatCode NEXT ENDIF - IF !( Right( ::cCommands, 1 ) == "," ) + IF ! Right( ::cCommands, 1 ) == "," ::cCommands += "," ENDIF @@ -161,7 +161,7 @@ METHOD New( aParams, cIniName ) CLASS HBFormatCode "LOOP,MENU,NEXT,PACK,PRINT,QUIT,READ,RECALL,REINDEX,RELEASE,RENAME,REQUEST,REPLACE,RESTORE," + ; "RUN,SAVE,SEEK,SELECT,SET,SKIP,SORT,STORE,SUM,TEXT,TOTAL,UNLOCK,USE,VAR,WAIT,ZAP," - IF !( Right( ::cClauses, 1 ) == "," ) + IF ! Right( ::cClauses, 1 ) == "," ::cClauses += "," ENDIF @@ -171,10 +171,10 @@ METHOD New( aParams, cIniName ) CLASS HBFormatCode "EXACT,EXCLUSIVE,FILTER,FIXED,FORMAT,INHERIT,INTENSITY,KEY,LIKE,MARGIN,MESSAGE,NEW,NIL,OFF,ON,ORDER,PATH,PICTURE,PRINTER,PROMPT," + ; "PROTECTED,RELATION,SCOREBOARD,SEQUENCE,SOFTSEEK,STEP,STRUCTURE,TYPEAHEAD,UNIQUE,WRAP,TAG,TO,TOP,VALID,WHEN," - IF !( Right( ::cFunctions, 1 ) == "," ) + IF ! Right( ::cFunctions, 1 ) == "," ::cFunctions += "," ENDIF - IF !( ",STR," $ Upper( ::cFunctions ) ) + IF ! ",STR," $ Upper( ::cFunctions ) ::cFunctions += "iif,ISNIL,ISARRAY,ISBLOCK,ISCHARACTER,ISDATE,ISLOGICAL,ISMEMO,ISNUMBER,ISOBJECT,Main" __hbformat_BuildListOfFunctions( @::cFunctions, ::cHBXList ) ENDIF diff --git a/contrib/hbformat/utils/hbformat.prg b/contrib/hbformat/utils/hbformat.prg index 66415354a9..772eebadf0 100644 --- a/contrib/hbformat/utils/hbformat.prg +++ b/contrib/hbformat/utils/hbformat.prg @@ -1,5 +1,5 @@ /* - * Harbour source code formatter (cmdline wrapper) + * Harbour source code formatter (command-line wrapper) * * Copyright 2009 Alexander S.Kresin * @@ -55,7 +55,10 @@ PROCEDURE Main( ... ) LOCAL oRef, aParams, cFileName, cInitDir, i, cParam, lRecursive := .F. - // AltD( 2 ); AltD() +#if 0 + AltD( 2 ) + AltD() +#endif aParams := hb_AParams() IF Empty( aParams ) .OR. ( Left( cFileName := ATail( aParams ), 1 ) $ "@/-" ) diff --git a/contrib/hbfoxpro/dbfunc.c b/contrib/hbfoxpro/dbfunc.c index ebca006f1f..b7cc4c4603 100644 --- a/contrib/hbfoxpro/dbfunc.c +++ b/contrib/hbfoxpro/dbfunc.c @@ -61,7 +61,7 @@ static AREAP s_foxAreaPointer( int iParam ) if( szAlias ) hb_rddGetAliasNumber( szAlias, &iArea ); - else + else iArea = hb_parni( iParam ); return ( AREAP ) hb_rddGetWorkAreaPointer( iArea ); diff --git a/contrib/hbfoxpro/hbfoxpro.ch b/contrib/hbfoxpro/hbfoxpro.ch index 85e482f28c..6370a2ad72 100644 --- a/contrib/hbfoxpro/hbfoxpro.ch +++ b/contrib/hbfoxpro/hbfoxpro.ch @@ -91,19 +91,19 @@ iif( <.last.>, .T., NIL ), ; <(wa)>, <(tag)> ) #command SET FILTER TO IN [NOOPTIMIZE] => ; - ->( DbSetFilter( <{exp}>, <"exp"> ) ) -#command SKIP [] IN => ->( DbSkip( ) ) -#command UNLOCK IN => ->( DbUnlock() ) -#command GO TOP IN => ->( DbGoTop() ) -#command GO BOTTOM IN => ->( DbGoBottom() ) -#command GOTO IN => ->( DbGoTo( ) ) + ->( dbSetFilter( <{exp}>, <"exp"> ) ) +#command SKIP [] IN => ->( dbSkip( ) ) +#command UNLOCK IN => ->( dbUnlock() ) +#command GO TOP IN => ->( dbGoTop() ) +#command GO BOTTOM IN => ->( dbGoBottom() ) +#command GOTO IN => ->( dbGoto( ) ) -#xtranslate SEEK( , ) => ()->( DbSeek( ) ) +#xtranslate SEEK( , ) => ()->( dbSeek( ) ) #xtranslate RECCOUNT( ) => ()->( RecCount() ) #xtranslate RECSIZE( ) => ()->( RecSize() ) #xtranslate FCOUNT( ) => ()->( FCount() ) #xtranslate RECNO( ) => ()->( RecNo() ) -#xtranslate RLOCK( ) => ()->( Rlock() ) +#xtranslate RLOCK( ) => ()->( RLock() ) #xtranslate USED( ) => __fox_Used( ) @@ -117,7 +117,7 @@ #command ENDSCAN => __dbContinue(); ENDDO #command EJECT PAGE => __Eject() -#command FLUSH => DbCommitAll() +#command FLUSH => dbCommitAll() #command REGIONAL [] => LOCAL #command CD <(path)> => hb_cwd( <(path)> ) diff --git a/contrib/hbfoxpro/miscfunc.c b/contrib/hbfoxpro/miscfunc.c index be97899b81..9eb82961a5 100644 --- a/contrib/hbfoxpro/miscfunc.c +++ b/contrib/hbfoxpro/miscfunc.c @@ -45,7 +45,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( PARAMETERS, PCOUNT ) HB_FUNC_TRANSLATE( SROWS, MAXROW ) diff --git a/contrib/hbfoxpro/occurs.prg b/contrib/hbfoxpro/occurs.prg index 43c638a386..b3fb0945e3 100644 --- a/contrib/hbfoxpro/occurs.prg +++ b/contrib/hbfoxpro/occurs.prg @@ -45,18 +45,20 @@ */ FUNCTION Occurs( cSub, cStr ) - LOCAL nCount := 0, nPos := 0 + + LOCAL nCount := 0, nPos IF HB_ISSTRING( cSub ) .AND. HB_ISSTRING( cStr ) - DO WHILE ( nPos := hb_At( cSub, cStr, nPos + 1 ) ) != 0 + nPos := 0 + DO WHILE ( nPos := hb_At( cSub, cStr, nPos + 1 ) ) > 0 ++nCount ENDDO ENDIF RETURN nCount - FUNCTION fox_At( cSub, cStr, nOccurrence ) + LOCAL nPos := 0 IF HB_ISSTRING( cSub ) .AND. HB_ISSTRING( cStr ) @@ -65,4 +67,4 @@ FUNCTION fox_At( cSub, cStr, nOccurrence ) ENDDO ENDIF -RETURN nPos + RETURN nPos diff --git a/contrib/hbfship/dbsetloc.c b/contrib/hbfship/dbsetloc.c index ce071ff864..a84099c19e 100644 --- a/contrib/hbfship/dbsetloc.c +++ b/contrib/hbfship/dbsetloc.c @@ -1,6 +1,6 @@ /* - * dbSetLocate[Block]( ) -> * FlagShip compatible functions + * dbSetLocate[Block]( ) --> * * Copyright 2011 Przemyslaw Czerpak * diff --git a/contrib/hbfship/exec.c b/contrib/hbfship/exec.c index 3990147055..68243f2f9e 100644 --- a/contrib/hbfship/exec.c +++ b/contrib/hbfship/exec.c @@ -1,7 +1,7 @@ /* - * ExecName( [ ] ) -> - * ExecPIDNum() -> * FlagShip compatible functions + * ExecName( [ ] ) --> + * ExecPIDNum() --> * * Copyright 2011 Przemyslaw Czerpak * diff --git a/contrib/hbfship/index.c b/contrib/hbfship/index.c index fa200c2d9e..fa49906d3a 100644 --- a/contrib/hbfship/index.c +++ b/contrib/hbfship/index.c @@ -1,7 +1,7 @@ /* - * IndexCount() -> - * IndexNames() -> * FlagShip compatible functions + * IndexCount() --> + * IndexNames() --> * * Copyright 2011 Przemyslaw Czerpak * diff --git a/contrib/hbfship/isbegseq.c b/contrib/hbfship/isbegseq.c index 9e18f67ed0..caa399ecec 100644 --- a/contrib/hbfship/isbegseq.c +++ b/contrib/hbfship/isbegseq.c @@ -1,6 +1,6 @@ /* - * IsBegSeq() -> * FlagShip compatible function + * IsBegSeq() --> * Test if currently executed code is encapsulated inside * begin sequence / end sequence statement activated by * current or any upper level function/procedure diff --git a/contrib/hbfship/isdb.prg b/contrib/hbfship/isdb.prg index 167bf6595a..ca94b95d67 100644 --- a/contrib/hbfship/isdb.prg +++ b/contrib/hbfship/isdb.prg @@ -1,8 +1,8 @@ /* - * IsDbExcl() -> - * IsDbFLock() -> - * IsDbRLock( [ ] ) -> * FlagShip compatible functions + * IsDbExcl() --> + * IsDbFLock() --> + * IsDbRLock( [ ] ) --> * * Copyright 2010 Przemyslaw Czerpak * diff --git a/contrib/hbfship/isfunc.c b/contrib/hbfship/isfunc.c index 7858dc2871..7fdb12e6b5 100644 --- a/contrib/hbfship/isfunc.c +++ b/contrib/hbfship/isfunc.c @@ -1,6 +1,6 @@ /* - * IsFunction( ) -> * FlagShip compatible function + * IsFunction( ) --> * Determines if a standard or user defined function/procedure * is available (linked to the application and registered in VM) * @@ -47,6 +47,6 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( ISFUNCTION, HB_ISFUNCTION ) diff --git a/contrib/hbfship/secondfs.c b/contrib/hbfship/secondfs.c index 3231437e18..6a51bcd7a9 100644 --- a/contrib/hbfship/secondfs.c +++ b/contrib/hbfship/secondfs.c @@ -44,6 +44,6 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( SECONDSCPU, HB_SECONDSCPU ) diff --git a/contrib/hbfship/stroccur.prg b/contrib/hbfship/stroccur.prg index cffd1d2a05..ffce7d1d11 100644 --- a/contrib/hbfship/stroccur.prg +++ b/contrib/hbfship/stroccur.prg @@ -1,6 +1,6 @@ /* - * StrOccurs( , , [] ) -> * Undocumented FlagShip compatible function + * StrOccurs( , , [] ) --> * * Copyright 2013 Przemyslaw Czerpak * @@ -46,6 +46,7 @@ */ FUNCTION StrOccurs( cSub, cStr, lAny ) + LOCAL nCount := 0, nPos := 0 IF HB_ISSTRING( cSub ) .AND. HB_ISSTRING( cStr ) diff --git a/contrib/hbfship/strpeek.c b/contrib/hbfship/strpeek.c index 7a4adcd6e2..f867361842 100644 --- a/contrib/hbfship/strpeek.c +++ b/contrib/hbfship/strpeek.c @@ -1,7 +1,7 @@ /* * FlagShip compatible functions: - * StrPeek( cStr, nPos ) -> nASC - * StrPoke( cStr, nPos, nASCval ) -> cStr + * StrPeek( cStr, nPos ) --> nASC + * StrPoke( cStr, nPos, nASCval ) --> cStr * * Copyright 2003 Przemyslaw Czerpak * diff --git a/contrib/hbfship/users.c b/contrib/hbfship/users.c index 77f08826f4..853d70f9e2 100644 --- a/contrib/hbfship/users.c +++ b/contrib/hbfship/users.c @@ -1,6 +1,6 @@ /* - * UsersMax() -> (1024) * FlagShip compatible functions + * UsersMax() --> (1024) * * Copyright 2011 Przemyslaw Czerpak * diff --git a/contrib/hbgd/gd.ch b/contrib/hbgd/gd.ch index 9801f31fe6..4574d3e70f 100644 --- a/contrib/hbgd/gd.ch +++ b/contrib/hbgd/gd.ch @@ -49,8 +49,7 @@ /* The maximum number of palette entries in palette-based images. In the wonderful new world of gd 2.0, you can of course have - many more colors when using truecolor mode. */ - + many more colors when using true-color mode. */ #define gdMaxColors 256 #define gdAlphaMax 127 @@ -65,7 +64,6 @@ #define gdDashSize 4 /* Special colors. */ - #define gdStyled -2 #define gdBrushed -3 #define gdStyledBrushed -4 @@ -101,16 +99,16 @@ #define GD2_FMT_COMPRESSED 2 #define GD_CMP_IMAGE 1 /* Actual image IS different */ -#define GD_CMP_NUM_COLORS 2 /* Number of Colours in pallette differ */ -#define GD_CMP_COLOR 4 /* Image colours differ */ +#define GD_CMP_NUM_COLORS 2 /* Number of colors in palette differ */ +#define GD_CMP_COLOR 4 /* Image colors differ */ #define GD_CMP_SIZE_X 8 /* Image width differs */ #define GD_CMP_SIZE_Y 16 /* Image heights differ */ -#define GD_CMP_TRANSPARENT 32 /* Transparent colour */ -#define GD_CMP_BACKGROUND 64 /* Background colour */ +#define GD_CMP_TRANSPARENT 32 /* Transparent color */ +#define GD_CMP_BACKGROUND 64 /* Background color */ #define GD_CMP_INTERLACE 128 /* Interlaced setting */ -#define GD_CMP_TRUECOLOR 256 /* Truecolor vs palette differs */ +#define GD_CMP_TRUECOLOR 256 /* True-color vs palette differs */ -/* resolution affects ttf font rendering, particularly hinting */ +/* resolution affects TrueType font rendering, particularly hinting */ #define GD_RESOLUTION 96 /* pixels per inch */ /* Legal values for Disposal. gdDisposalNone is always used by diff --git a/contrib/hbgd/gd.prg b/contrib/hbgd/gd.prg index 5194ee530f..85a00508db 100644 --- a/contrib/hbgd/gd.prg +++ b/contrib/hbgd/gd.prg @@ -1,5 +1,5 @@ /* - * GD graphic library prg level (client api) interface code. + * GD graphic library .prg level (client API) interface code. * * Copyright 2004 Francesco Saverio Giudice * diff --git a/contrib/hbgd/gdbar.prg b/contrib/hbgd/gdbar.prg index 0aa100b7a1..03431c8692 100644 --- a/contrib/hbgd/gdbar.prg +++ b/contrib/hbgd/gdbar.prg @@ -56,10 +56,10 @@ #define THICKNESS_I250 0 #define THICKNESS_I251 0 -CREATE CLASS GDBar FROM GDImage +CREATE CLASS GDBar INHERIT GDImage - // class attributes - VAR positionX AS NUMERIC INIT 4 + // Class attributes + VAR positionX AS NUMERIC INIT 4 VAR positionY AS NUMERIC VAR maxHeight AS NUMERIC INIT 25 VAR maxHDefa AS NUMERIC INIT 25 @@ -81,7 +81,7 @@ CREATE CLASS GDBar FROM GDImage VAR KeysModeB AS CHARACTER VAR KeysModeC AS ARRAY - // image attributes + // Image attributes VAR res AS NUMERIC VAR textfont AS NUMERIC VAR TEXT AS CHARACTER @@ -93,7 +93,6 @@ CREATE CLASS GDBar FROM GDImage VAR lDrawValue AS LOGICAL INIT .T. // Methods - METHOD CreateBar( sx, sy, filename, cColor ) METHOD Configure( nMaxHeight, aFillColor, aBackColor, nRes, nTextFont, lBook, lDrawValue ) METHOD Allocate() diff --git a/contrib/hbgd/gdbarcod.prg b/contrib/hbgd/gdbarcod.prg index f5203fded2..0ea75bcc7f 100644 --- a/contrib/hbgd/gdbarcod.prg +++ b/contrib/hbgd/gdbarcod.prg @@ -46,41 +46,36 @@ #include "hbclass.ch" -#define CODEC 100 -#define CODEB 101 -#define CODEA 102 -#define FNC1 103 -#define STARTA 104 -#define STARTB 105 -#define STARTC 106 +#define CODEC 100 +#define CODEB 101 +#define CODEA 102 +#define FNC1 103 +#define STARTA 104 +#define STARTB 105 +#define STARTC 106 -CREATE CLASS GDBarCode FROM GDBar +CREATE CLASS GDBarCode INHERIT GDBar VAR nType // EAN-13 ISBN - METHOD New( nTypeCode ) CONSTRUCTOR METHOD Draw( cText ) METHOD Draw13( cText ) METHOD DrawText13() // EAN-8 - METHOD Draw8( cText ) METHOD DrawText8() // EAN-128 - METHOD Draw128( cText, cModeCode ) // I25 - METHOD DrawI25( cText ) METHOD GenCodei25() // Utils - METHOD FindCharCode( cString, cChar ) METHOD MixCode( value ) METHOD Findcode( uval ) diff --git a/contrib/hbgd/gdchart.prg b/contrib/hbgd/gdchart.prg index 2238b4f711..1667419626 100644 --- a/contrib/hbgd/gdchart.prg +++ b/contrib/hbgd/gdchart.prg @@ -47,7 +47,7 @@ #include "hbclass.ch" #include "gd.ch" -CREATE CLASS GDChart FROM GDImage +CREATE CLASS GDChart INHERIT GDImage VAR cTitle VAR cAxisX @@ -61,7 +61,6 @@ CREATE CLASS GDChart FROM GDImage VAR aDataOfHashes // Hash contains graph datas VAR hDefs - METHOD New( sx, sy ) CONSTRUCTOR METHOD AddData( hData ) METHOD AddDef( cDefKey, xDefVal ) diff --git a/contrib/hbgd/gdimage.prg b/contrib/hbgd/gdimage.prg index 2cef24daf8..a310651043 100644 --- a/contrib/hbgd/gdimage.prg +++ b/contrib/hbgd/gdimage.prg @@ -70,7 +70,7 @@ CREATE CLASS GDImage METHOD New( sx, sy ) CONSTRUCTOR - /* IMAGE CREATION, DESTRUCTION, LOADING AND SAVING */ + /* IMAGE CREATION, DESTRUCTION, LOADING AND SAVING */ // Create in memory METHOD Create( sx, sy ) INLINE ::pImage := gdImageCreate( sx, sy ), Self @@ -132,7 +132,7 @@ CREATE CLASS GDImage DESTRUCTOR Destruct() #endif - /* DRAWING FUNCTIONS */ + /* Drawing functions */ METHOD SetPixel( x, y, color ) INLINE hb_default( @color, ::pColor ), gdImageSetPixel( ::pImage, x, y, color ) METHOD Line( x1, y1, x2, y2, color ) INLINE hb_default( @color, ::pColor ), gdImageLine( ::pImage, x1, y1, x2, y2, color ) diff --git a/contrib/hbgd/gdwrp.c b/contrib/hbgd/gdwrp.c index 99c6d997b2..a81ffb7568 100644 --- a/contrib/hbgd/gdwrp.c +++ b/contrib/hbgd/gdwrp.c @@ -1,5 +1,5 @@ /* - * GD graphic library low level (client api) interface code. + * GD graphic library low-level (client API) interface code. * * Copyright 2004-2005 Francesco Saverio Giudice * @@ -74,16 +74,13 @@ #define IMAGE_WBMP 4 #define IMAGE_GD 5 -/* Internal functions */ - -/* - * internal function for handling pointers +/* Internal function for handling pointers * * Code of Przemyslaw Czerpak for gdImagePtr * adapted also to gdFontPtr */ -/* gdImage ----------------------- */ +/* gdImage */ /* gdImage destructor, it's executed automatically */ static HB_GARBAGE_FUNC( hb_gdImage_Destructor ) @@ -97,7 +94,7 @@ static HB_GARBAGE_FUNC( hb_gdImage_Destructor ) /* Destroy the image */ gdImageDestroy( *ptr ); - /* set pointer to NULL to avoid multiple freeing */ + /* Set pointer to NULL to avoid multiple freeing */ *ptr = NULL; } } @@ -108,7 +105,7 @@ static const HB_GC_FUNCS s_gcGDimageFuncs = hb_gcDummyMark }; -/* function returns gdImage pointer or NULL when wrong variable is +/* Function returns gdImage pointer or NULL when wrong variable is passed or gdImage was freed before */ static gdImagePtr hb_parGdImage( int iParam ) { @@ -122,7 +119,7 @@ static void * hb_isGdImage( int iParam ) return hb_parptrGC( &s_gcGDimageFuncs, iParam ); } -/* function create in HVM stack return value item with gdImage pointer */ +/* Function create in HVM stack return value item with gdImage pointer */ static void hb_retGdImage( gdImagePtr im ) { gdImagePtr * ptr = ( gdImagePtr * ) hb_gcAllocate( sizeof( gdImagePtr ), @@ -134,7 +131,7 @@ static void hb_retGdImage( gdImagePtr im ) } #if 0 -/* function returns PHB_ITEM with gdImage pointer */ +/* Function returns PHB_ITEM with gdImage pointer */ static PHB_ITEM hb_gdImageItemNew( gdImagePtr im ) { gdImagePtr * ptr = ( gdImagePtr * ) hb_gcAllocate( sizeof( gdImagePtr ), @@ -146,7 +143,7 @@ static PHB_ITEM hb_gdImageItemNew( gdImagePtr im ) } #endif -/* gdFont ----------------------- */ +/* gdFont */ /* gdFont destructor, it's executed automatically */ static HB_GARBAGE_FUNC( hb_gdFont_Destructor ) @@ -159,11 +156,11 @@ static HB_GARBAGE_FUNC( hb_gdFont_Destructor ) { /* Destroy the Font */ #if 0 - /* do nothing, GD handles it directly and gdFontDestroy() not exists */ + /* Do nothing, GD handles it directly and gdFontDestroy() not exists */ gdFontDestroy( *ptr ); #endif - /* set pointer to NULL to avoid multiple freeing */ + /* Set pointer to NULL to avoid multiple freeing */ *ptr = NULL; } } @@ -174,7 +171,7 @@ static const HB_GC_FUNCS s_gcGDfontFuncs = hb_gcDummyMark }; -/* function returns gdFont pointer or NULL when wrong variable is +/* Function returns gdFont pointer or NULL when wrong variable is passed or gdFont was freed before */ static gdFontPtr hb_parGdFont( int iParam ) { @@ -188,7 +185,7 @@ static void * hb_isGdFont( int iParam ) return hb_parptrGC( &s_gcGDfontFuncs, iParam ); } -/* function create in HVM stack return value item with gdFont pointer */ +/* Function create in HVM stack return value item with gdFont pointer */ static void hb_retGdFont( gdFontPtr font ) { gdFontPtr * ptr = ( gdFontPtr * ) hb_gcAllocate( sizeof( gdFontPtr ), @@ -200,7 +197,7 @@ static void hb_retGdFont( gdFontPtr font ) } #if 0 -/* function returns PHB_ITEM with gdFont pointer */ +/* Function returns PHB_ITEM with gdFont pointer */ static PHB_ITEM hb_gdFontItemNew( gdFontPtr font ) { gdFontPtr * ptr = ( gdFontPtr * ) hb_gcAllocate( sizeof( gdFontPtr ), diff --git a/contrib/hbgs/core.c b/contrib/hbgs/core.c index 245ed857aa..ccc070cf19 100644 --- a/contrib/hbgs/core.c +++ b/contrib/hbgs/core.c @@ -57,7 +57,7 @@ /* Workaround to build with pre-9.18 versions */ #if defined( e_Quit ) - #define gs_error_Quit e_Quit +# define gs_error_Quit e_Quit #endif HB_FUNC( HB_GS ) diff --git a/contrib/hbgt/asciisgt.c b/contrib/hbgt/asciisgt.c index e6f7676b6f..c2c92849d3 100644 --- a/contrib/hbgt/asciisgt.c +++ b/contrib/hbgt/asciisgt.c @@ -1,10 +1,7 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ diff --git a/contrib/hbgt/ascposgt.c b/contrib/hbgt/ascposgt.c index d46da370e1..422800d85e 100644 --- a/contrib/hbgt/ascposgt.c +++ b/contrib/hbgt/ascposgt.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ @@ -24,7 +21,7 @@ HB_FUNC( GT_ASCPOS ) if( p > hb_parclen( 1 ) ) /* oh oh p > length of passed string */ hb_retni( -2 ); /* error -2 */ else - hb_retni( ( int ) s[ p ] ); /* return ascii code of appropriate */ + hb_retni( ( int ) s[ p ] ); /* return ASCII code of appropriate */ /* character in string */ } else diff --git a/contrib/hbgt/atdiff.c b/contrib/hbgt/atdiff.c index 49365e4b4b..0c9a4e10d4 100644 --- a/contrib/hbgt/atdiff.c +++ b/contrib/hbgt/atdiff.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ @@ -20,17 +17,14 @@ HB_FUNC( GT_ATDIFF ) HB_ISIZ len = hb_parclen( 2 ); HB_ISIZ pos; - /* - loop through comparing both strings - + /* loop through comparing both strings NOTE: pos starts at 1, so as to return a string index - for CLIPPER - */ + for Cl*pper */ for( pos = 1; ( pos <= len ) && ( *s1 == *s2 ); s2++, s1++ ) pos++; - if( pos > len ) /* strings match exactly!!! */ + if( pos > len ) /* strings match exactly */ hb_retns( 0 ); else hb_retns( pos ); diff --git a/contrib/hbgt/bitflags.c b/contrib/hbgt/bitflags.c index 4c3d8b34b7..04b9f71e12 100644 --- a/contrib/hbgt/bitflags.c +++ b/contrib/hbgt/bitflags.c @@ -1,5 +1,4 @@ /* - * Author....: Dave Pearson * BBS.......: The Dark Knight Returns * Date......: 1993-03-31 * @@ -10,7 +9,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Modification history: - * --------------------- * * 2001-08-19 Modifications for Harbour by Brian Hays, also placed in * the public domain. diff --git a/contrib/hbgt/chareven.c b/contrib/hbgt/chareven.c index 9de804319a..82bccae20f 100644 --- a/contrib/hbgt/chareven.c +++ b/contrib/hbgt/chareven.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-24 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ @@ -20,7 +17,7 @@ HB_FUNC( GT_CHAREVEN ) HB_ISIZ len = hb_parclen( 1 ); HB_ISIZ i; - s2 = ( char * ) hb_xgrab( len / 2 + 1 ); /* grab us some mem to work with */ + s2 = ( char * ) hb_xgrab( len / 2 + 1 ); /* grab us some memory to work with */ for( i = 1; i <= len; i += 2 ) s2[ ( i - 1 ) / 2 ] = s1[ i ] & 0x7f; diff --git a/contrib/hbgt/charmixg.c b/contrib/hbgt/charmixg.c index fc13e7444e..e6398365e0 100644 --- a/contrib/hbgt/charmixg.c +++ b/contrib/hbgt/charmixg.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-24 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ @@ -22,7 +19,7 @@ HB_FUNC( GT_CHARMIX ) char * s3; HB_ISIZ i, pos3 = 0; - s3 = ( char * ) hb_xgrab( l1 + l2 + 1 ); /* grab us some mem to work with */ + s3 = ( char * ) hb_xgrab( l1 + l2 + 1 ); /* grab us some memory to work with */ for( i = 0; i < l1; i++ ) { diff --git a/contrib/hbgt/charodd.c b/contrib/hbgt/charodd.c index 269352c66a..b640110a98 100644 --- a/contrib/hbgt/charodd.c +++ b/contrib/hbgt/charodd.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-24 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ @@ -20,7 +17,7 @@ HB_FUNC( GT_CHARODD ) HB_ISIZ len = hb_parclen( 1 ); HB_ISIZ i; - s2 = ( char * ) hb_xgrab( len / 2 + 1 ); /* grab us some mem to work with */ + s2 = ( char * ) hb_xgrab( len / 2 + 1 ); /* grab us some memory to work with */ for( i = 0; i <= len; i += 2 ) s2[ i / 2 ] = s1[ i ] & 0x7f; diff --git a/contrib/hbgt/chrcount.c b/contrib/hbgt/chrcount.c index 32a0557748..c5688c34ed 100644 --- a/contrib/hbgt/chrcount.c +++ b/contrib/hbgt/chrcount.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ diff --git a/contrib/hbgt/chrfirst.c b/contrib/hbgt/chrfirst.c index 2db8c6aef9..1469905517 100644 --- a/contrib/hbgt/chrfirst.c +++ b/contrib/hbgt/chrfirst.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ diff --git a/contrib/hbgt/chrtotal.c b/contrib/hbgt/chrtotal.c index 5de57bcf6e..30b20ffac8 100644 --- a/contrib/hbgt/chrtotal.c +++ b/contrib/hbgt/chrtotal.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ diff --git a/contrib/hbgt/strasint.c b/contrib/hbgt/strasint.c index 5164017ff3..2d5686cb5d 100644 --- a/contrib/hbgt/strasint.c +++ b/contrib/hbgt/strasint.c @@ -1,12 +1,11 @@ -/*** -* Function: _GT_Internal_StringAsInt() -* Syntax..: int _GT_Internal_StringAsInt(char *String, int Start, int End) -* Usage...: Convert a numeric value in a string to an int value. -* By......: David A Pearson -* -* This is an original work by David A Pearson and is placed in the -* public domain. -*/ +/* + * Function: _GT_Internal_StringAsInt() + * Syntax..: int _GT_Internal_StringAsInt( char * String, int Start, int End ) + * Usage...: Convert a numeric value in a string to an int value. + * + * This is an original work by David A Pearson and is placed in the + * public domain. + */ #include "hbapi.h" diff --git a/contrib/hbgt/strcount.c b/contrib/hbgt/strcount.c index 9f70c79d92..2f023568ea 100644 --- a/contrib/hbgt/strcount.c +++ b/contrib/hbgt/strcount.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ @@ -20,14 +17,13 @@ HB_FUNC( GT_STRCOUNT ) HB_ISIZ l1 = hb_parclen( 1 ); HB_ISIZ l2 = hb_parclen( 2 ); HB_ISIZ count, p1, p2; - int match; /* loop through s2 matching passed character (s1) with each character of s1 */ for( count = 0, p2 = 0; p2 <= ( l2 - l1 ); p2++ ) { - match = 1; + int match = 1; for( p1 = 0; p1 < l1; p1++ ) { diff --git a/contrib/hbgt/strcspn.c b/contrib/hbgt/strcspn.c index 8f58d7850d..194c289d30 100644 --- a/contrib/hbgt/strcspn.c +++ b/contrib/hbgt/strcspn.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ diff --git a/contrib/hbgt/strdiffg.c b/contrib/hbgt/strdiffg.c index 1a291b9e4c..6980606653 100644 --- a/contrib/hbgt/strdiffg.c +++ b/contrib/hbgt/strdiffg.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-24 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ @@ -20,17 +17,14 @@ HB_FUNC( GT_STRDIFF ) HB_ISIZ pos; HB_ISIZ len = hb_parclen( 2 ); - /* - loop through comparing both strings - + /* loop through comparing both strings NOTE: pos starts at 1, so as to return a string index - for CLIPPER - */ + for Cl*pper */ for( pos = 1; ( pos <= len ) && ( *s1 == *s2 ); s2++, s1++ ) pos++; - if( pos > len ) /* strings match exactly!!! */ + if( pos > len ) /* strings match exactly */ hb_retc_null(); else hb_retc( s2 ); diff --git a/contrib/hbgt/strexpan.c b/contrib/hbgt/strexpan.c index 681e147849..786b97c49d 100644 --- a/contrib/hbgt/strexpan.c +++ b/contrib/hbgt/strexpan.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-24 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ @@ -26,15 +23,18 @@ HB_FUNC( GT_STREXPAND ) if( HB_ISCHAR( 3 ) ) insert = hb_parc( 3 ); - out = ( char * ) hb_xgrab( len * ( nIns + 1 ) ); /* grab us some mem to work with */ + out = ( char * ) hb_xgrab( len * ( nIns + 1 ) ); /* grab us some memory to work with */ - for( i = 0, p = 0; i < len; i++ ) /* loop thru input */ + /* loop thru input */ + for( i = 0, p = 0; i < len; i++ ) { - out[ p++ ] = in[ i ]; /* insert a character from input */ + out[ p++ ] = in[ i ]; /* insert a character from input */ - if( i < ( len - 1 ) ) /* do not insert fill chars on last */ - { /* char of input */ - for( j = 1; j <= nIns; j++ ) /* insert the fill characters */ + /* do not insert fill chars on last char of input */ + if( i < ( len - 1 ) ) + { + /* insert the fill characters */ + for( j = 1; j <= nIns; j++ ) out[ p++ ] = insert[ 0 ]; } } diff --git a/contrib/hbgt/strleft.c b/contrib/hbgt/strleft.c index 5bc8e25de4..bd997d6b35 100644 --- a/contrib/hbgt/strleft.c +++ b/contrib/hbgt/strleft.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ diff --git a/contrib/hbgt/strpbrk.c b/contrib/hbgt/strpbrk.c index e9adf67e6b..d3c1f809bd 100644 --- a/contrib/hbgt/strpbrk.c +++ b/contrib/hbgt/strpbrk.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ diff --git a/contrib/hbgt/strright.c b/contrib/hbgt/strright.c index f1f554f000..f5d8e6e82a 100644 --- a/contrib/hbgt/strright.c +++ b/contrib/hbgt/strright.c @@ -1,11 +1,8 @@ /* - * GT CLIPPER STANDARD HEADER - * - * Author....: Andy M Leighton * BBS.......: The Dark Knight Returns * Date......: 1993-05-23 * - * This is an original work by Andy Leighton and is placed in the + * This is an original work by Andy M Leighton and is placed in the * public domain. */ diff --git a/contrib/hbhpdf/annot.c b/contrib/hbhpdf/annot.c index 59836013c7..bb9303ef45 100644 --- a/contrib/hbhpdf/annot.c +++ b/contrib/hbhpdf/annot.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,7 +44,7 @@ #include "hbhpdf.h" -/* HPDF_LinkAnnot_SetHighlightMode( hAnnot, nHilightMode ) -> hStatus +/* HPDF_LinkAnnot_SetHighlightMode( hAnnot, nHilightMode ) --> hStatus nHilightMode == HPDF_ANNOT_NO_HIGHTLIGHT 1 No highlighting. HPDF_ANNOT_INVERT_BOX 2 Invert the contents of the area of annotation. @@ -57,14 +56,13 @@ HB_FUNC( HPDF_LINKANNOT_SETHIGHLIGHTMODE ) hb_retnl( ( long ) HPDF_LinkAnnot_SetHighlightMode( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_AnnotHighlightMode ) hb_parni( 2 ) ) ); } -/* HPDF_LinkAnnot_SetBorderStyle( hAnnot, nWidth, nDashOn, nDashOff ) -> hStatus - */ +/* HPDF_LinkAnnot_SetBorderStyle( hAnnot, nWidth, nDashOn, nDashOff ) --> hStatus */ HB_FUNC( HPDF_LINKANNOT_SETBORDERSTYLE ) { hb_retnl( ( long ) HPDF_LinkAnnot_SetBorderStyle( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_UINT16 ) hb_parni( 3 ), ( HPDF_UINT16 ) hb_parni( 4 ) ) ); } -/* HPDF_TextAnnot_SetIcon( hAnnot, nIconID ) -> hStatus +/* HPDF_TextAnnot_SetIcon( hAnnot, nIconID ) --> hStatus nIconID HPDF_ANNOT_ICON_COMMENT HPDF_ANNOT_ICON_KEY @@ -79,14 +77,13 @@ HB_FUNC( HPDF_TEXTANNOT_SETICON ) hb_retnl( ( long ) HPDF_TextAnnot_SetIcon( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_AnnotIcon ) hb_parni( 2 ) ) ); } -/* HPDF_TextAnnot_SetOpened( hAnnot, lOpened ) -> hStatus - */ +/* HPDF_TextAnnot_SetOpened( hAnnot, lOpened ) --> hStatus */ HB_FUNC( HPDF_TEXTANNOT_SETOPENED ) { hb_retnl( ( long ) HPDF_TextAnnot_SetOpened( ( HPDF_Annotation ) hb_parptr( 1 ), hb_parl( 2 ) ? HPDF_TRUE : HPDF_FALSE ) ); } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateFreeTextAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, @@ -107,8 +104,8 @@ HB_FUNC( HPDF_PAGE_CREATEFREETEXTANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateLineAnnot (HPDF_Page page, const char *text, HPDF_Encoder encoder); @@ -144,8 +141,7 @@ HB_FUNC( HPDF_PAGE_CREATETEXTMARKUPANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateHighlightAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, @@ -166,8 +162,8 @@ HB_FUNC( HPDF_PAGE_CREATEHIGHLIGHTANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateUnderlineAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, @@ -188,8 +184,8 @@ HB_FUNC( HPDF_PAGE_CREATEUNDERLINEANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateSquigglyAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, @@ -210,8 +206,8 @@ HB_FUNC( HPDF_PAGE_CREATESQUIGGLYANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateStrikeOutAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, @@ -232,8 +228,8 @@ HB_FUNC( HPDF_PAGE_CREATESTRIKEOUTANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreatePopupAnnot ( HPDF_Page page, HPDF_Rect rect, HPDF_Annotation parent); @@ -253,8 +249,8 @@ HB_FUNC( HPDF_PAGE_CREATEPOPUPANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateStampAnnot ( HPDF_Page page, HPDF_Rect rect, HPDF_StampAnnotName name, @@ -276,8 +272,8 @@ HB_FUNC( HPDF_PAGE_CREATESTAMPANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateSquareAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, @@ -298,8 +294,8 @@ HB_FUNC( HPDF_PAGE_CREATESQUAREANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Annotation) + +/* HPDF_EXPORT(HPDF_Annotation) HPDF_Page_CreateCircleAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, @@ -320,8 +316,8 @@ HB_FUNC( HPDF_PAGE_CREATECIRCLEANNOT ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_Annot_SetRGBColor (HPDF_Annotation annot, HPDF_RGBColor color); */ HB_FUNC( HPDF_ANNOT_SETRGBCOLOR ) @@ -335,11 +331,11 @@ HB_FUNC( HPDF_ANNOT_SETRGBCOLOR ) hb_retnl( ( long ) HPDF_Annot_SetRGBColor( ( HPDF_Annotation ) hb_parptr( 1 ), rgb ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_Annot_SetCMYKColor (HPDF_Annotation annot, HPDF_CMYKColor color); */ HB_FUNC( HPDF_ANNOT_SETCMYKCOLOR ) @@ -354,11 +350,11 @@ HB_FUNC( HPDF_ANNOT_SETCMYKCOLOR ) hb_retnl( ( long ) HPDF_Annot_SetCMYKColor( ( HPDF_Annotation ) hb_parptr( 1 ), cmyk ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_Annot_SetGrayColor (HPDF_Annotation annot, HPDF_REAL color); */ HB_FUNC( HPDF_ANNOT_SETGRAYCOLOR ) @@ -366,11 +362,11 @@ HB_FUNC( HPDF_ANNOT_SETGRAYCOLOR ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_Annot_SetGrayColor( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_Annot_SetNoColor (HPDF_Annotation annot); */ HB_FUNC( HPDF_ANNOT_SETNOCOLOR ) @@ -378,11 +374,11 @@ HB_FUNC( HPDF_ANNOT_SETNOCOLOR ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_Annot_SetNoColor( ( HPDF_Annotation ) hb_parptr( 1 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetTitle (HPDF_Annotation annot, const char* name); */ HB_FUNC( HPDF_MARKUPANNOT_SETTITLE ) @@ -390,11 +386,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETTITLE ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetTitle( ( HPDF_Annotation ) hb_parptr( 1 ), hb_parc( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetSubject (HPDF_Annotation annot, const char* name); */ HB_FUNC( HPDF_MARKUPANNOT_SETSUBJECT ) @@ -402,11 +398,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETSUBJECT ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetSubject( ( HPDF_Annotation ) hb_parptr( 1 ), hb_parc( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetCreationDate (HPDF_Annotation annot, HPDF_Date value); */ HB_FUNC( HPDF_MARKUPANNOT_SETCREATIONDATE ) @@ -426,11 +422,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETCREATIONDATE ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetCreationDate( ( HPDF_Annotation ) hb_parptr( 1 ), date ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetTransparency (HPDF_Annotation annot, HPDF_REAL value); */ HB_FUNC( HPDF_MARKUPANNOT_SETTRANSPARENCY ) @@ -438,11 +434,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETTRANSPARENCY ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetTransparency( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetIntent (HPDF_Annotation annot, HPDF_AnnotIntent intent); */ HB_FUNC( HPDF_MARKUPANNOT_SETINTENT ) @@ -450,11 +446,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETINTENT ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetIntent( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_AnnotIntent ) hb_parni( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetPopup (HPDF_Annotation annot, HPDF_Annotation popup); */ HB_FUNC( HPDF_MARKUPANNOT_SETPOPUP ) @@ -462,11 +458,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETPOPUP ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetPopup( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_Annotation ) hb_parptr( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetRectDiff (HPDF_Annotation annot, HPDF_Rect rect); */ HB_FUNC( HPDF_MARKUPANNOT_SETRECTDIFF ) @@ -481,11 +477,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETRECTDIFF ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetRectDiff( ( HPDF_Annotation ) hb_parptr( 1 ), rc ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetCloudEffect (HPDF_Annotation annot, HPDF_INT cloudIntensity); */ HB_FUNC( HPDF_MARKUPANNOT_SETCLOUDEFFECT ) @@ -493,11 +489,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETCLOUDEFFECT ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetCloudEffect( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_INT ) hb_parni( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetInteriorRGBColor (HPDF_Annotation annot, HPDF_RGBColor color); */ HB_FUNC( HPDF_MARKUPANNOT_SETINTERIORRGBCOLOR ) @@ -511,11 +507,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETINTERIORRGBCOLOR ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetInteriorRGBColor( ( HPDF_Annotation ) hb_parptr( 1 ), rgb ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetInteriorCMYKColor (HPDF_Annotation annot, HPDF_CMYKColor color); */ HB_FUNC( HPDF_MARKUPANNOT_SETINTERIORCMYKCOLOR ) @@ -530,11 +526,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETINTERIORCMYKCOLOR ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetInteriorCMYKColor( ( HPDF_Annotation ) hb_parptr( 1 ), cmyk ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetInteriorGrayColor (HPDF_Annotation annot, HPDF_REAL color); */ HB_FUNC( HPDF_MARKUPANNOT_SETINTERIORGRAYCOLOR ) @@ -542,11 +538,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETINTERIORGRAYCOLOR ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetInteriorGrayColor( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_MarkupAnnot_SetInteriorTransparent (HPDF_Annotation annot); */ HB_FUNC( HPDF_MARKUPANNOT_SETINTERIORTRANSPARENT ) @@ -554,11 +550,11 @@ HB_FUNC( HPDF_MARKUPANNOT_SETINTERIORTRANSPARENT ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_MarkupAnnot_SetInteriorTransparent( ( HPDF_Annotation ) hb_parptr( 1 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_TextMarkupAnnot_SetQuadPoints ( HPDF_Annotation annot, HPDF_Point lb, HPDF_Point rb, HPDF_Point rt, HPDF_Point lt); */ HB_FUNC( HPDF_TEXTMARKUPANNOT_SETQUADPOINTS ) @@ -583,11 +579,11 @@ HB_FUNC( HPDF_TEXTMARKUPANNOT_SETQUADPOINTS ) hb_retnl( ( long ) HPDF_TextMarkupAnnot_SetQuadPoints( ( HPDF_Annotation ) hb_parptr( 1 ), p1, p2, p3, p4 ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_Annot_Set3DView ( HPDF_MMgr mmgr, HPDF_Annotation annot, HPDF_Annotation annot3d, @@ -598,11 +594,11 @@ HB_FUNC( HPDF_ANNOT_SET3DVIEW ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_Annot_Set3DView( ( HPDF_MMgr ) hb_parptr( 1 ), ( HPDF_Annotation ) hb_parptr( 2 ), ( HPDF_Annotation ) hb_parptr( 3 ), ( HPDF_Dict ) hb_parptr( 4 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_PopupAnnot_SetOpened (HPDF_Annotation annot, HPDF_BOOL opened); */ @@ -611,11 +607,11 @@ HB_FUNC( HPDF_POPUPANNOT_SETOPENED ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_PopupAnnot_SetOpened( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_BOOL ) hb_parl( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_FreeTextAnnot_SetLineEndingStyle (HPDF_Annotation annot, HPDF_LineAnnotEndingStyle startStyle, HPDF_LineAnnotEndingStyle endStyle); */ HB_FUNC( HPDF_FREETEXTANNOT_SETLINEENDINGSTYLE ) @@ -623,11 +619,11 @@ HB_FUNC( HPDF_FREETEXTANNOT_SETLINEENDINGSTYLE ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_FreeTextAnnot_SetLineEndingStyle( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_LineAnnotEndingStyle ) hb_parni( 2 ), ( HPDF_LineAnnotEndingStyle ) hb_parni( 3 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_FreeTextAnnot_Set3PointCalloutLine (HPDF_Annotation annot, HPDF_Point startPoint, HPDF_Point kneePoint, HPDF_Point endPoint); */ HB_FUNC( HPDF_FREETEXTANNOT_SET3POINTCALLOUTLINE ) @@ -648,11 +644,11 @@ HB_FUNC( HPDF_FREETEXTANNOT_SET3POINTCALLOUTLINE ) hb_retnl( ( long ) HPDF_FreeTextAnnot_Set3PointCalloutLine( ( HPDF_Annotation ) hb_parptr( 1 ), p1, p2, p3 ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_FreeTextAnnot_Set2PointCalloutLine (HPDF_Annotation annot, HPDF_Point startPoint, HPDF_Point endPoint); */ HB_FUNC( HPDF_FREETEXTANNOT_SET2POINTCALLOUTLINE ) @@ -669,11 +665,11 @@ HB_FUNC( HPDF_FREETEXTANNOT_SET2POINTCALLOUTLINE ) hb_retnl( ( long ) HPDF_FreeTextAnnot_Set2PointCalloutLine( ( HPDF_Annotation ) hb_parptr( 1 ), p1, p2 ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_FreeTextAnnot_SetDefaultStyle (HPDF_Annotation annot, const char* style); */ HB_FUNC( HPDF_FREETEXTANNOT_SETDEFAULTSTYLE ) @@ -681,11 +677,11 @@ HB_FUNC( HPDF_FREETEXTANNOT_SETDEFAULTSTYLE ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_FreeTextAnnot_SetDefaultStyle( ( HPDF_Annotation ) hb_parptr( 1 ), hb_parc( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_LineAnnot_SetPosition (HPDF_Annotation annot, HPDF_Point startPoint, HPDF_LineAnnotEndingStyle startStyle, HPDF_Point endPoint, HPDF_LineAnnotEndingStyle endStyle); @@ -704,11 +700,11 @@ HB_FUNC( HPDF_LINEANNOT_SETPOSITION ) hb_retnl( ( long ) HPDF_LineAnnot_SetPosition( ( HPDF_Annotation ) hb_parptr( 1 ), p1, ( HPDF_LineAnnotEndingStyle ) hb_parni( 3 ), p2, ( HPDF_LineAnnotEndingStyle ) hb_parni( 5 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_LineAnnot_SetLeader (HPDF_Annotation annot, HPDF_INT leaderLen, HPDF_INT leaderExtLen, HPDF_INT leaderOffsetLen); */ HB_FUNC( HPDF_LINEANNOT_SETLEADER ) @@ -716,11 +712,11 @@ HB_FUNC( HPDF_LINEANNOT_SETLEADER ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_LineAnnot_SetLeader( ( HPDF_Annotation ) hb_parptr( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_LineAnnot_SetCaption (HPDF_Annotation annot, HPDF_BOOL showCaption, HPDF_LineAnnotCapPosition position, HPDF_INT horzOffset, HPDF_INT vertOffset); */ HB_FUNC( HPDF_LINEANNOT_SETCAPTION ) @@ -728,11 +724,11 @@ HB_FUNC( HPDF_LINEANNOT_SETCAPTION ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_LineAnnot_SetCaption( ( HPDF_Annotation ) hb_parptr( 1 ), hb_parl( 2 ), ( HPDF_LineAnnotCapPosition ) hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_Annotation_SetBorderStyle (HPDF_Annotation annot, HPDF_BSSubtype subtype, HPDF_REAL width, @@ -745,6 +741,6 @@ HB_FUNC( HPDF_ANNOTATION_SETBORDERSTYLE ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_Annotation_SetBorderStyle( ( HPDF_Annotation ) hb_parptr( 1 ), ( HPDF_BSSubtype ) hb_parni( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_UINT16 ) hb_parni( 4 ), ( HPDF_UINT16 ) hb_parni( 5 ), ( HPDF_UINT16 ) hb_parni( 6 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } diff --git a/contrib/hbhpdf/core.c b/contrib/hbhpdf/core.c index 2c5ddee386..518f407b8a 100644 --- a/contrib/hbhpdf/core.c +++ b/contrib/hbhpdf/core.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -73,12 +72,9 @@ HPDF_Doc hb_HPDF_Doc_par( int iParam ) return ph ? ( HPDF_Doc ) * ph : NULL; } -/* - Most of the functions return hStatus == HPDF_OK or ERROR Code - */ +/* Most of the functions return hStatus == HPDF_OK or ERROR Code */ -/* HPDF_New() -> hDoc - */ +/* HPDF_New() --> hDoc */ HB_FUNC( HPDF_NEW ) { void ** ph = ( void ** ) hb_gcAllocate( sizeof( HPDF_Doc ), &s_gcHPDF_DocFuncs ); @@ -88,8 +84,7 @@ HB_FUNC( HPDF_NEW ) hb_retptrGC( ph ); } -/* HPDF_Free( hDoc ) -> NIL - */ +/* HPDF_Free( hDoc ) --> NIL */ HB_FUNC( HPDF_FREE ) { void ** ph = ( void ** ) hb_parptrGC( &s_gcHPDF_DocFuncs, 1 ); @@ -104,29 +99,25 @@ HB_FUNC( HPDF_FREE ) } } -/* HPDF_NewDoc( hDoc ) -> hStatus - */ +/* HPDF_NewDoc( hDoc ) --> hStatus */ HB_FUNC( HPDF_NEWDOC ) { hb_retnl( ( long ) HPDF_NewDoc( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_FreeDoc( hNewDoc ) -> NIL - */ +/* HPDF_FreeDoc( hNewDoc ) --> NIL */ HB_FUNC( HPDF_FREEDOC ) { HPDF_FreeDoc( hb_HPDF_Doc_par( 1 ) ); } -/* HPDF_FreeDocAll() -> NIL - */ +/* HPDF_FreeDocAll() --> NIL */ HB_FUNC( HPDF_FREEDOCALL ) { HPDF_FreeDocAll( hb_HPDF_Doc_par( 1 ) ); } -/* HPDF_SaveToFile( hDoc, cFileToSave ) -> hStatus - */ +/* HPDF_SaveToFile( hDoc, cFileToSave ) --> hStatus */ HB_FUNC( HPDF_SAVETOFILE ) { char * pszFree; @@ -138,15 +129,13 @@ HB_FUNC( HPDF_SAVETOFILE ) hb_xfree( pszFree ); } -/* HPDF_SaveToStream( hDoc ) -> hStatus - */ +/* HPDF_SaveToStream( hDoc ) --> hStatus */ HB_FUNC( HPDF_SAVETOSTREAM ) { hb_retnl( ( long ) HPDF_SaveToStream( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_GetStreamSize( hDoc ) -> nSize - */ +/* HPDF_GetStreamSize( hDoc ) --> nSize */ HB_FUNC( HPDF_GETSTREAMSIZE ) { hb_retnl( ( long ) HPDF_GetStreamSize( hb_HPDF_Doc_par( 1 ) ) ); @@ -170,59 +159,52 @@ HB_FUNC( HPDF_READFROMSTREAM ) hb_xfree( buffer ); } -/* HPDF_ResetStream( hDoc ) -> hStatus - */ +/* HPDF_ResetStream( hDoc ) --> hStatus */ HB_FUNC( HPDF_RESETSTREAM ) { hb_retnl( ( long ) HPDF_ResetStream( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_HasDoc( hDoc ) -> lHasDoc - */ +/* HPDF_HasDoc( hDoc ) --> lHasDoc */ HB_FUNC( HPDF_HASDOC ) { hb_retl( HPDF_HasDoc( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_SetErrorHandler( hDoc, procErrHandler ) -> hStatus - */ +/* HPDF_SetErrorHandler( hDoc, procErrHandler ) --> hStatus */ HB_FUNC( HPDF_SETERRORHANDLER ) { - /* TOFIX: This should be extended to pass a wrapper which calls a + /* FIXME: This should be extended to pass a wrapper which calls a user defined codeblock. */ hb_retnl( ( long ) HPDF_SetErrorHandler( hb_HPDF_Doc_par( 1 ), ( HPDF_Error_Handler ) hb_parptr( 2 ) ) ); } -/* HPDF_GetError( hDoc ) -> nErrorCode - */ +/* HPDF_GetError( hDoc ) --> nErrorCode */ HB_FUNC( HPDF_GETERROR ) { hb_retnl( ( long ) HPDF_GetError( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_GetErrorDetail( hDoc ) -> nErrorCode - */ +/* HPDF_GetErrorDetail( hDoc ) --> nErrorCode */ HB_FUNC( HPDF_GETERRORDETAIL ) { hb_retnl( ( long ) HPDF_GetErrorDetail( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_ResetError( hDoc ) -> NIL - */ +/* HPDF_ResetError( hDoc ) --> NIL */ HB_FUNC( HPDF_RESETERROR ) { HPDF_ResetError( hb_HPDF_Doc_par( 1 ) ); } -/* HPDF_SetPagesConfiguration( hDoc, nPagePerPages ) -> hStatus - */ +/* HPDF_SetPagesConfiguration( hDoc, nPagePerPages ) --> hStatus */ HB_FUNC( HPDF_SETPAGESCONFIGURATION ) { hb_retnl( ( long ) HPDF_SetPagesConfiguration( hb_HPDF_Doc_par( 1 ), hb_parni( 2 ) ) ); } -/* HPDF_SetPageLayout( hDoc, nLayout ) -> hStatus +/* HPDF_SetPageLayout( hDoc, nLayout ) --> hStatus nLayout == HPDF_PAGE_LAYOUT_SINGLE 0 HPDF_PAGE_LAYOUT_ONE_COLUMN 1 @@ -235,14 +217,13 @@ HB_FUNC( HPDF_SETPAGELAYOUT ) hb_retnl( ( long ) HPDF_SetPageLayout( hb_HPDF_Doc_par( 1 ), ( HPDF_PageLayout ) hb_parni( 2 ) ) ); } -/* HPDF_GetPageLayout( hDoc ) -> nLayout - */ +/* HPDF_GetPageLayout( hDoc ) --> nLayout */ HB_FUNC( HPDF_GETPAGELAYOUT ) { hb_retni( ( int ) HPDF_GetPageLayout( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_SetPageMode( hDoc, nPageMode ) -> hStatus +/* HPDF_SetPageMode( hDoc, nPageMode ) --> hStatus nPageMode == HPDF_PAGE_MODE_USE_NONE 0 Display the document with neither outline nor thumbnail. HPDF_PAGE_MODE_USE_OUTLINE 1 Display the document with outline pane. @@ -255,49 +236,43 @@ HB_FUNC( HPDF_SETPAGEMODE ) hb_retnl( ( long ) HPDF_SetPageMode( hb_HPDF_Doc_par( 1 ), ( HPDF_PageMode ) hb_parni( 2 ) ) ); } -/* HPDF_GetPageMode( hDoc ) -> nPageMode - */ +/* HPDF_GetPageMode( hDoc ) --> nPageMode */ HB_FUNC( HPDF_GETPAGEMODE ) { hb_retni( ( int ) HPDF_GetPageMode( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_SetOpenAction( hDoc, hDestn ) -> hStatus - */ +/* HPDF_SetOpenAction( hDoc, hDestn ) --> hStatus */ HB_FUNC( HPDF_SETOPENACTION ) { hb_retnl( ( long ) HPDF_SetOpenAction( hb_HPDF_Doc_par( 1 ), ( HPDF_Destination ) hb_parptr( 2 ) ) ); } -/* HPDF_GetCurrentPage( hDoc ) -> hPage - */ +/* HPDF_GetCurrentPage( hDoc ) --> hPage */ HB_FUNC( HPDF_GETCURRENTPAGE ) { hb_retptr( ( void * ) HPDF_GetCurrentPage( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_AddPage( hDoc ) -> hPage - */ +/* HPDF_AddPage( hDoc ) --> hPage */ HB_FUNC( HPDF_ADDPAGE ) { hb_retptr( ( void * ) HPDF_AddPage( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_InsertPage( hDoc, hPage ) -> hPageInserted : Just before hPage - */ +/* HPDF_InsertPage( hDoc, hPage ) --> hPageInserted : Just before hPage */ HB_FUNC( HPDF_INSERTPAGE ) { hb_retptr( ( void * ) HPDF_InsertPage( hb_HPDF_Doc_par( 1 ), ( HPDF_Page ) hb_parptr( 2 ) ) ); } -/* HPDF_GetFont( hDoc, cFontName, cEncoding ) -> hFont - */ +/* HPDF_GetFont( hDoc, cFontName, cEncoding ) --> hFont */ HB_FUNC( HPDF_GETFONT ) { hb_retptr( ( void * ) HPDF_GetFont( hb_HPDF_Doc_par( 1 ), hb_parc( 2 ), hb_parc( 3 ) ) ); } -/* HPDF_AddPageLabel( hDoc, nPageNum, nPgNoStyle, nFirstPageInRange, cPrefixToLabel ) -> hStatus +/* HPDF_AddPageLabel( hDoc, nPageNum, nPgNoStyle, nFirstPageInRange, cPrefixToLabel ) --> hStatus nPgNoStyle HPDF_PAGE_NUM_STYLE_DECIMAL 1 Page label is displayed by Arabic numerals. HPDF_PAGE_NUM_STYLE_UPPER_ROMAN 2 Page label is displayed by Uppercase roman numerals. @@ -310,42 +285,37 @@ HB_FUNC( HPDF_ADDPAGELABEL ) hb_retnl( ( long ) HPDF_AddPageLabel( hb_HPDF_Doc_par( 1 ), hb_parni( 2 ), ( HPDF_PageNumStyle ) hb_parni( 3 ), hb_parni( 4 ), hb_parc( 5 ) ) ); } -/* HPDF_CreateExtGState( hDoc ) -> hExtGState - */ +/* HPDF_CreateExtGState( hDoc ) --> hExtGState */ HB_FUNC( HPDF_CREATEEXTGSTATE ) { hb_retptr( ( void * ) HPDF_CreateExtGState( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_CreateOutline( hDoc, hParentOutline, cTitle, hEncoder ) -> hOutline - */ +/* HPDF_CreateOutline( hDoc, hParentOutline, cTitle, hEncoder ) --> hOutline */ HB_FUNC( HPDF_CREATEOUTLINE ) { hb_retptr( ( void * ) HPDF_CreateOutline( hb_HPDF_Doc_par( 1 ), ( HPDF_Outline ) hb_parptr( 2 ), hb_parc( 3 ), ( HPDF_Encoder ) hb_parptr( 4 ) ) ); } -/* HPDF_GetEncoder( hDoc, cEncoding ) -> hEncoder - */ +/* HPDF_GetEncoder( hDoc, cEncoding ) --> hEncoder */ HB_FUNC( HPDF_GETENCODER ) { hb_retptr( ( void * ) HPDF_GetEncoder( hb_HPDF_Doc_par( 1 ), hb_parc( 2 ) ) ); } -/* HPDF_GetCurrentEncoder( hDoc ) -> hEncoder - */ +/* HPDF_GetCurrentEncoder( hDoc ) --> hEncoder */ HB_FUNC( HPDF_GETCURRENTENCODER ) { hb_retptr( ( void * ) HPDF_GetCurrentEncoder( hb_HPDF_Doc_par( 1 ) ) ); } -/* HPDF_SetCurrentEncoder( hDoc, hEncoder ) -> hStatus - */ +/* HPDF_SetCurrentEncoder( hDoc, hEncoder ) --> hStatus */ HB_FUNC( HPDF_SETCURRENTENCODER ) { hb_retnl( ( long ) HPDF_SetCurrentEncoder( hb_HPDF_Doc_par( 1 ), hb_parc( 2 ) ) ); } -/* HPDF_SetInfoAttr( hDoc, nInfoType, cInfo ) -> hStatus +/* HPDF_SetInfoAttr( hDoc, nInfoType, cInfo ) --> hStatus nInfoType == HPDF_INFO_AUTHOR HPDF_INFO_CREATOR @@ -358,14 +328,13 @@ HB_FUNC( HPDF_SETINFOATTR ) hb_retnl( ( long ) HPDF_SetInfoAttr( hb_HPDF_Doc_par( 1 ), ( HPDF_InfoType ) hb_parni( 2 ), hb_parc( 3 ) ) ); } -/* HPDF_GetInfoAttr( hDoc, nInfoType ) -> cInfo - */ +/* HPDF_GetInfoAttr( hDoc, nInfoType ) --> cInfo */ HB_FUNC( HPDF_GETINFOATTR ) { hb_retc( HPDF_GetInfoAttr( hb_HPDF_Doc_par( 1 ), ( HPDF_InfoType ) hb_parni( 2 ) ) ); } -/* HPDF_SetInfoDateAttr( hDoc, nInfoType, aDateValues ) -> hStatus +/* HPDF_SetInfoDateAttr( hDoc, nInfoType, aDateValues ) --> hStatus nInfoType == HPDF_INFO_CREATION_DATE HPDF_INFO_MOD_DATE @@ -387,14 +356,13 @@ HB_FUNC( HPDF_SETINFODATEATTR ) hb_retnl( ( long ) HPDF_SetInfoDateAttr( hb_HPDF_Doc_par( 1 ), ( HPDF_InfoType ) hb_parni( 2 ), date ) ); } -/* HPDF_SetPassword( hDoc, cOwnerPassword = NO NIL, cUserPassword = CANBE NIL ) -> hStatus - */ +/* HPDF_SetPassword( hDoc, cOwnerPassword = NO NIL, cUserPassword = CANBE NIL ) --> hStatus */ HB_FUNC( HPDF_SETPASSWORD ) { hb_retnl( ( long ) HPDF_SetPassword( hb_HPDF_Doc_par( 1 ), hb_parc( 2 ), hb_parc( 3 ) ) ); } -/* HPDF_SetPermission( hDoc, nPermission ) -> hStatus +/* HPDF_SetPermission( hDoc, nPermission ) --> hStatus nPermission == HPDF_ENABLE_READ 1 user can read the document. HPDF_ENABLE_PRINT 2 user can print the document. @@ -407,7 +375,7 @@ HB_FUNC( HPDF_SETPERMISSION ) hb_retnl( ( long ) HPDF_SetPermission( hb_HPDF_Doc_par( 1 ), hb_parni( 2 ) ) ); } -/* HPDF_SetEncryptionMode( hDoc, nEncMode, nKeyLen ) -> hStatus +/* HPDF_SetEncryptionMode( hDoc, nEncMode, nKeyLen ) --> hStatus nEncMode == HPDF_ENCRYPT_R2 1 Use "Revision 2" algorithm. The length of key is automatically set to 5(40bit). @@ -419,12 +387,12 @@ HB_FUNC( HPDF_SETENCRYPTIONMODE ) hb_retnl( ( long ) HPDF_SetEncryptionMode( hb_HPDF_Doc_par( 1 ), ( HPDF_EncryptMode ) hb_parni( 2 ), hb_parni( 3 ) ) ); } -/* HPDF_SetCompressionMode( hDoc, nCompMode ) -> hStatus +/* HPDF_SetCompressionMode( hDoc, nCompMode ) --> hStatus nCompMode == HPDF_COMP_NONE 1 All contents are not compressed. HPDF_COMP_TEXT 2 Compress the contents stream of the page. HPDF_COMP_IMAGE 3 Compress the streams of the image objects. - HPDF_COMP_METADATA 4 Other stream datas (fonts, cmaps and so on) are compressed. + HPDF_COMP_METADATA 4 Other stream datas (fonts, cmaps and so on) are compressed. HPDF_COMP_ALL 5 All stream datas are compressed. (The same as "HPDF_COMP_TEXT | HPDF_COMP_IMAGE | HPDF_COMP_METADATA") */ HB_FUNC( HPDF_SETCOMPRESSIONMODE ) @@ -432,25 +400,21 @@ HB_FUNC( HPDF_SETCOMPRESSIONMODE ) hb_retnl( ( long ) HPDF_SetCompressionMode( hb_HPDF_Doc_par( 1 ), hb_parni( 2 ) ) ); } -/*----------------------------------------------------------------------*/ -/* Page Handling */ -/*----------------------------------------------------------------------*/ +/* --- Page Handling --- */ -/* HPDF_Page_SetWidth( hPage, nWidth ) -> hStatus - */ +/* HPDF_Page_SetWidth( hPage, nWidth ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETWIDTH ) { hb_retnl( ( long ) HPDF_Page_SetWidth( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetHeight( hPage, nHeight ) -> hStatus - */ +/* HPDF_Page_SetHeight( hPage, nHeight ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETHEIGHT ) { hb_retnl( ( long ) HPDF_Page_SetHeight( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetSize( hPage, nSize, nOrientation = 1 Portrait, 2 Landscape ) -> hStatus +/* HPDF_Page_SetSize( hPage, nSize, nOrientation = 1 Portrait, 2 Landscape ) --> hStatus nSize == HPDF_PAGE_SIZE_LETTER 1 8.5 x 11 (Inches) 612 x 792 HPDF_PAGE_SIZE_LEGAL 2 8.5 x 14 (Inches) 612 x 1008 @@ -470,36 +434,31 @@ HB_FUNC( HPDF_PAGE_SETSIZE ) hb_retnl( ( long ) HPDF_Page_SetSize( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_PageSizes ) hb_parni( 2 ), ( HPDF_PageDirection ) hb_parni( 3 ) ) ); } -/* HPDF_Page_SetRotate( hPage, nAngle = 0-360 ) -> hStatus - */ +/* HPDF_Page_SetRotate( hPage, nAngle = 0-360 ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETROTATE ) { hb_retnl( ( long ) HPDF_Page_SetRotate( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_UINT16 ) hb_parni( 2 ) ) ); } -/* HPDF_Page_GetWidth( hPage ) -> nWidth - */ +/* HPDF_Page_GetWidth( hPage ) --> nWidth */ HB_FUNC( HPDF_PAGE_GETWIDTH ) { hb_retnd( ( double ) HPDF_Page_GetWidth( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetHeight( hPage ) -> nHeight - */ +/* HPDF_Page_GetHeight( hPage ) --> nHeight */ HB_FUNC( HPDF_PAGE_GETHEIGHT ) { hb_retnd( ( double ) HPDF_Page_GetHeight( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_CreateDestination( hPage ) -> hDestn - */ +/* HPDF_Page_CreateDestination( hPage ) --> hDestn */ HB_FUNC( HPDF_PAGE_CREATEDESTINATION ) { hb_retptr( ( void * ) HPDF_Page_CreateDestination( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_CreateAnnot( hPage, aRect[nLeft,nTop,nRight,nBottom], cText, cEncoder ) -> nHandle - */ +/* HPDF_Page_CreateAnnot( hPage, aRect[nLeft,nTop,nRight,nBottom], cText, cEncoder ) --> nHandle */ HB_FUNC( HPDF_PAGE_CREATETEXTANNOT ) { HPDF_Rect rc; @@ -512,8 +471,7 @@ HB_FUNC( HPDF_PAGE_CREATETEXTANNOT ) hb_retptr( HPDF_Page_CreateTextAnnot( ( HPDF_Page ) hb_parptr( 1 ), rc, hb_parc( 3 ), ( HPDF_Encoder ) hb_parptr( 4 ) ) ); } -/* HPDF_Page_CreateLinkAnnot( hPage, aRect, hDestn ) -> nHandle - */ +/* HPDF_Page_CreateLinkAnnot( hPage, aRect, hDestn ) --> nHandle */ HB_FUNC( HPDF_PAGE_CREATELINKANNOT ) { HPDF_Rect rc; @@ -526,8 +484,7 @@ HB_FUNC( HPDF_PAGE_CREATELINKANNOT ) hb_retptr( HPDF_Page_CreateLinkAnnot( ( HPDF_Page ) hb_parptr( 1 ), rc, ( HPDF_Destination ) hb_parptr( 3 ) ) ); } -/* HPDF_Page_CreateURILinkAnnot( hPage, aRect, cURI ) -> nHandle - */ +/* HPDF_Page_CreateURILinkAnnot( hPage, aRect, cURI ) --> nHandle */ HB_FUNC( HPDF_PAGE_CREATEURILINKANNOT ) { HPDF_Rect rc; @@ -540,29 +497,25 @@ HB_FUNC( HPDF_PAGE_CREATEURILINKANNOT ) hb_retptr( HPDF_Page_CreateURILinkAnnot( ( HPDF_Page ) hb_parptr( 1 ), rc, hb_parc( 3 ) ) ); } -/* HPDF_Page_TextWidth( hPage, cText ) -> nTextWidth - */ +/* HPDF_Page_TextWidth( hPage, cText ) --> nTextWidth */ HB_FUNC( HPDF_PAGE_TEXTWIDTH ) { hb_retnd( ( double ) HPDF_Page_TextWidth( ( HPDF_Page ) hb_parptr( 1 ), hb_parc( 2 ) ) ); } -/* HPDF_Page_MeasureText( hPage, cText, nWidth, lWordWrap ) -> nByteLenOfTextToFitWidth - */ +/* HPDF_Page_MeasureText( hPage, cText, nWidth, lWordWrap ) --> nByteLenOfTextToFitWidth */ HB_FUNC( HPDF_PAGE_MEASURETEXT ) { hb_retnl( ( long ) HPDF_Page_MeasureText( ( HPDF_Page ) hb_parptr( 1 ), hb_parc( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), hb_parl( 4 ) ? HPDF_TRUE : HPDF_FALSE, NULL ) ); } -/* HPDF_Page_GetMode( hPage ) -> nGraphicMode - */ +/* HPDF_Page_GetMode( hPage ) --> nGraphicMode */ HB_FUNC( HPDF_PAGE_GETGMODE ) { hb_retnl( ( long ) HPDF_Page_GetGMode( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetCurrentPos( hPage ) -> aCurPos[ nX, nY ] - */ +/* HPDF_Page_GetCurrentPos( hPage ) --> aCurPos[] { nX, nY } */ HB_FUNC( HPDF_PAGE_GETCURRENTPOS ) { HPDF_Point pt; @@ -576,8 +529,7 @@ HB_FUNC( HPDF_PAGE_GETCURRENTPOS ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetCurrentTextPos( hPage ) -> aCurTextPos[ nX, nY ] - */ +/* HPDF_Page_GetCurrentTextPos( hPage ) --> aCurTextPos[] { nX, nY } */ HB_FUNC( HPDF_PAGE_GETCURRENTTEXTPOS ) { HPDF_Point pt; @@ -591,22 +543,19 @@ HB_FUNC( HPDF_PAGE_GETCURRENTTEXTPOS ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetCurrentFont( hPage ) -> hFont - */ +/* HPDF_Page_GetCurrentFont( hPage ) --> hFont */ HB_FUNC( HPDF_PAGE_GETCURRENTFONT ) { hb_retptr( ( void * ) HPDF_Page_GetCurrentFont( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetCurrentFontSize( hPage ) -> nFontSize - */ +/* HPDF_Page_GetCurrentFontSize( hPage ) --> nFontSize */ HB_FUNC( HPDF_PAGE_GETCURRENTFONTSIZE ) { hb_retnd( ( double ) HPDF_Page_GetCurrentFontSize( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetTransMatrix( hPage ) -> aMatrix[ ] - */ +/* HPDF_Page_GetTransMatrix( hPage ) --> aMatrix[] */ HB_FUNC( HPDF_PAGE_GETTRANSMATRIX ) { HPDF_TransMatrix matrix; @@ -624,36 +573,31 @@ HB_FUNC( HPDF_PAGE_GETTRANSMATRIX ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetLineWidth( hPage ) -> nLineWidth - */ +/* HPDF_Page_GetLineWidth( hPage ) --> nLineWidth */ HB_FUNC( HPDF_PAGE_GETLINEWIDTH ) { hb_retnd( ( double ) HPDF_Page_GetLineWidth( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetLineCap( hPage ) -> nLineCapStyle - */ +/* HPDF_Page_GetLineCap( hPage ) --> nLineCapStyle */ HB_FUNC( HPDF_PAGE_GETLINECAP ) { hb_retnl( ( long ) HPDF_Page_GetLineCap( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetLineJoin( hPage ) -> nLineJoinStyle - */ +/* HPDF_Page_GetLineJoin( hPage ) --> nLineJoinStyle */ HB_FUNC( HPDF_PAGE_GETLINEJOIN ) { hb_retnl( ( long ) HPDF_Page_GetLineJoin( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetMiterLimit( hPage ) -> nMiterLimit - */ +/* HPDF_Page_GetMiterLimit( hPage ) --> nMiterLimit */ HB_FUNC( HPDF_PAGE_GETMITERLIMIT ) { hb_retnd( ( double ) HPDF_Page_GetMiterLimit( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetDash( hPage ) -> aDash - */ +/* HPDF_Page_GetDash( hPage ) --> aDash */ HB_FUNC( HPDF_PAGE_GETDASH ) { HPDF_DashMode dash; @@ -675,57 +619,49 @@ HB_FUNC( HPDF_PAGE_GETDASH ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetFlat( hPage ) -> nCurFlatness - */ +/* HPDF_Page_GetFlat( hPage ) --> nCurFlatness */ HB_FUNC( HPDF_PAGE_GETFLAT ) { hb_retnd( ( double ) HPDF_Page_GetFlat( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetCharSpace( hPage ) -> nCurCharSpace - */ +/* HPDF_Page_GetCharSpace( hPage ) --> nCurCharSpace */ HB_FUNC( HPDF_PAGE_GETCHARSPACE ) { hb_retnd( ( double ) HPDF_Page_GetCharSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetWordSpace( hPage ) -> nCurWordSpace - */ +/* HPDF_Page_GetWordSpace( hPage ) --> nCurWordSpace */ HB_FUNC( HPDF_PAGE_GETWORDSPACE ) { hb_retnd( ( double ) HPDF_Page_GetWordSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetHorizontalScalling( hPage ) -> nHorzScaling - */ +/* HPDF_Page_GetHorizontalScalling( hPage ) --> nHorzScaling */ HB_FUNC( HPDF_PAGE_GETHORIZONTALSCALLING ) { hb_retnd( ( double ) HPDF_Page_GetHorizontalScalling( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetTextLeading( hPage ) -> nTextLeading - */ +/* HPDF_Page_GetTextLeading( hPage ) --> nTextLeading */ HB_FUNC( HPDF_PAGE_GETTEXTLEADING ) { hb_retnd( ( double ) HPDF_Page_GetTextLeading( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetTextRenderingMode( hPage ) -> nTextRenderingMode - */ +/* HPDF_Page_GetTextRenderingMode( hPage ) --> nTextRenderingMode */ HB_FUNC( HPDF_PAGE_GETTEXTRENDERINGMODE ) { hb_retnd( ( double ) HPDF_Page_GetTextRenderingMode( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetTextRise( hPage ) -> nTextRise - */ +/* HPDF_Page_GetTextRise( hPage ) --> nTextRise */ HB_FUNC( HPDF_PAGE_GETTEXTRISE ) { hb_retnd( ( double ) HPDF_Page_GetTextRise( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetRGBFill( hPage ) -> aRGBFill[ nRed, nGreen, nBlue ] - */ +/* HPDF_Page_GetRGBFill( hPage ) --> aRGBFill[] { nRed, nGreen, nBlue } */ HB_FUNC( HPDF_PAGE_GETRGBFILL ) { HPDF_RGBColor rgb; @@ -740,8 +676,7 @@ HB_FUNC( HPDF_PAGE_GETRGBFILL ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetRGBStroke( hPage ) -> aRGBStroke[ nRed, nGreen, nBlue ] - */ +/* HPDF_Page_GetRGBStroke( hPage ) --> aRGBStroke[] { nRed, nGreen, nBlue } */ HB_FUNC( HPDF_PAGE_GETRGBSTROKE ) { HPDF_RGBColor rgb; @@ -756,8 +691,7 @@ HB_FUNC( HPDF_PAGE_GETRGBSTROKE ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetCMYKFill( hPage ) -> aCMYKFill[ nC, nM, nY, nK ] - */ +/* HPDF_Page_GetCMYKFill( hPage ) --> aCMYKFill[] { nC, nM, nY, nK } */ HB_FUNC( HPDF_PAGE_GETCMYKFILL ) { HPDF_CMYKColor cmyk; @@ -773,8 +707,7 @@ HB_FUNC( HPDF_PAGE_GETCMYKFILL ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetCMYKStroke( hPage ) -> aCMYKStroke[ nC, nM, nY, nK ] - */ +/* HPDF_Page_GetCMYKStroke( hPage ) --> aCMYKStroke[] { nC, nM, nY, nK } */ HB_FUNC( HPDF_PAGE_GETCMYKSTROKE ) { HPDF_CMYKColor cmyk; @@ -790,36 +723,31 @@ HB_FUNC( HPDF_PAGE_GETCMYKSTROKE ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetGrayFill( hPage ) -> nGrayFillValue - */ +/* HPDF_Page_GetGrayFill( hPage ) --> nGrayFillValue */ HB_FUNC( HPDF_PAGE_GETGRAYFILL ) { hb_retnd( ( double ) HPDF_Page_GetGrayFill( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetGrayStroke( hPage ) -> nGrayStrokeValue - */ +/* HPDF_Page_GetGrayStroke( hPage ) --> nGrayStrokeValue */ HB_FUNC( HPDF_PAGE_GETGRAYSTROKE ) { hb_retnd( ( double ) HPDF_Page_GetGrayStroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetStrokingColorSpace( hPage ) -> nStrokingSpace - */ +/* HPDF_Page_GetStrokingColorSpace( hPage ) --> nStrokingSpace */ HB_FUNC( HPDF_PAGE_GETSTROKINGCOLORSPACE ) { hb_retni( ( int ) HPDF_Page_GetStrokingColorSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetFillingColorSpace( hPage ) -> nFillingColorSpace - */ +/* HPDF_Page_GetFillingColorSpace( hPage ) --> nFillingColorSpace */ HB_FUNC( HPDF_PAGE_GETFILLINGCOLORSPACE ) { hb_retni( ( int ) HPDF_Page_GetFillingColorSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GetTextMatrix( hPage ) -> aMatrix[ ] - */ +/* HPDF_Page_GetTextMatrix( hPage ) --> aMatrix[] */ HB_FUNC( HPDF_PAGE_GETTEXTMATRIX ) { HPDF_TransMatrix matrix; @@ -837,14 +765,13 @@ HB_FUNC( HPDF_PAGE_GETTEXTMATRIX ) hb_itemReturnRelease( info ); } -/* HPDF_Page_GetGStateDepth( hPage ) -> nGStateDepth - */ +/* HPDF_Page_GetGStateDepth( hPage ) --> nGStateDepth */ HB_FUNC( HPDF_PAGE_GETGSTATEDEPTH ) { hb_retni( ( int ) HPDF_Page_GetGStateDepth( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_SetSlideShow( hPage, nType, nDurationPerFrame, nTranstnTime = 1 Second ) -> hStatus +/* HPDF_Page_SetSlideShow( hPage, nType, nDurationPerFrame, nTranstnTime = 1 Second ) --> hStatus nType == HPDF_TS_WIPE_RIGHT HPDF_TS_WIPE_UP @@ -869,40 +796,33 @@ HB_FUNC( HPDF_PAGE_SETSLIDESHOW ) hb_retnl( ( long ) HPDF_Page_SetSlideShow( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_TransitionStyle ) hb_parni( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ) ) ); } -/*----------------------------------------------------------------------*/ -/* GRAPHICS */ -/*----------------------------------------------------------------------*/ +/* --- GRAPHICS --- */ -/* HPDF_Page_SetLineWidth( hPage, nLineWidth ) -> hStatus - */ +/* HPDF_Page_SetLineWidth( hPage, nLineWidth ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETLINEWIDTH ) { hb_retnl( ( long ) HPDF_Page_SetLineWidth( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetLineCap( hPage, nLineCap ) -> hStatus - */ +/* HPDF_Page_SetLineCap( hPage, nLineCap ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETLINECAP ) { hb_retnl( ( long ) HPDF_Page_SetLineCap( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_LineCap ) hb_parni( 2 ) ) ); } -/* HPDF_Page_SetLineJoin( hPage, nLineJoin ) -> hStatus - */ +/* HPDF_Page_SetLineJoin( hPage, nLineJoin ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETLINEJOIN ) { hb_retnl( ( long ) HPDF_Page_SetLineJoin( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_LineJoin ) hb_parni( 2 ) ) ); } -/* HPDF_Page_SetMiterLimit( hPage, nMiterLimit ) -> hStatus - */ +/* HPDF_Page_SetMiterLimit( hPage, nMiterLimit ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETMITERLIMIT ) { hb_retnl( ( long ) HPDF_Page_SetMiterLimit( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetDash( hPage, aDash, nNumPoints, nStartFrom ) -> hStatus - */ +/* HPDF_Page_SetDash( hPage, aDash, nNumPoints, nStartFrom ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETDASH ) { HPDF_DashMode dash; @@ -915,29 +835,25 @@ HB_FUNC( HPDF_PAGE_SETDASH ) hb_retnl( ( long ) HPDF_Page_SetDash( ( HPDF_Page ) hb_parptr( 1 ), dash.ptn, nPtns, hb_parni( 4 ) ) ); } -/* HPDF_Page_SetExtGState( hPage, hGState ) -> hStatus - */ +/* HPDF_Page_SetExtGState( hPage, hGState ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETEXTGSTATE ) { hb_retnl( ( long ) HPDF_Page_SetExtGState( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_ExtGState ) hb_parptr( 2 ) ) ); } -/* HPDF_Page_GSave( hPage ) -> hStatus - */ +/* HPDF_Page_GSave( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_GSAVE ) { hb_retnl( ( long ) HPDF_Page_GSave( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_GRestore( hPage ) -> hStatus - */ +/* HPDF_Page_GRestore( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_GRESTORE ) { hb_retnl( ( long ) HPDF_Page_GRestore( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_Concat( hPage, nA, nB, nC, nD, nX, nY ) -> hStatus - */ +/* HPDF_Page_Concat( hPage, nA, nB, nC, nD, nX, nY ) --> hStatus */ HB_FUNC( HPDF_PAGE_CONCAT ) { hb_retnl( ( long ) HPDF_Page_Concat( ( HPDF_Page ) hb_parptr( 1 ), @@ -949,22 +865,19 @@ HB_FUNC( HPDF_PAGE_CONCAT ) ( HPDF_REAL ) hb_parnd( 7 ) ) ); } -/* HPDF_Page_MoveTo( hPage, nX, nY ) -> hStatus - */ +/* HPDF_Page_MoveTo( hPage, nX, nY ) --> hStatus */ HB_FUNC( HPDF_PAGE_MOVETO ) { hb_retnl( ( long ) HPDF_Page_MoveTo( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ) ) ); } -/* HPDF_Page_LineTo( hPage, nX, nY ) -> hStatus - */ +/* HPDF_Page_LineTo( hPage, nX, nY ) --> hStatus */ HB_FUNC( HPDF_PAGE_LINETO ) { hb_retnl( ( long ) HPDF_Page_LineTo( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ) ) ); } -/* HPDF_Page_CurveTo( hPage, nX1, nY1, nX2, nY2, nX3, nY3 ) -> hStatus - */ +/* HPDF_Page_CurveTo( hPage, nX1, nY1, nX2, nY2, nX3, nY3 ) --> hStatus */ HB_FUNC( HPDF_PAGE_CURVETO ) { hb_retnl( ( long ) HPDF_Page_CurveTo( ( HPDF_Page ) hb_parptr( 1 ), @@ -976,8 +889,7 @@ HB_FUNC( HPDF_PAGE_CURVETO ) ( HPDF_REAL ) hb_parnd( 7 ) ) ); } -/* HPDF_Page_CurveTo2( hPage, nX2, nY2, nX3, nY3 ) -> hStatus - */ +/* HPDF_Page_CurveTo2( hPage, nX2, nY2, nX3, nY3 ) --> hStatus */ HB_FUNC( HPDF_PAGE_CURVETO2 ) { hb_retnl( ( long ) HPDF_Page_CurveTo2( ( HPDF_Page ) hb_parptr( 1 ), @@ -987,8 +899,7 @@ HB_FUNC( HPDF_PAGE_CURVETO2 ) ( HPDF_REAL ) hb_parnd( 5 ) ) ); } -/* HPDF_Page_CurveTo3( hPage, nX1, nY1, nX3, nY3 ) -> hStatus - */ +/* HPDF_Page_CurveTo3( hPage, nX1, nY1, nX3, nY3 ) --> hStatus */ HB_FUNC( HPDF_PAGE_CURVETO3 ) { hb_retnl( ( long ) HPDF_Page_CurveTo3( ( HPDF_Page ) hb_parptr( 1 ), @@ -998,327 +909,279 @@ HB_FUNC( HPDF_PAGE_CURVETO3 ) ( HPDF_REAL ) hb_parnd( 5 ) ) ); } -/* HPDF_Page_ClosePath( hPage ) -> hStatus - */ +/* HPDF_Page_ClosePath( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_CLOSEPATH ) { hb_retnl( ( long ) HPDF_Page_ClosePath( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_Rectangle( hPage, nX, nY, nWidth, nHeight ) -> hStatus - */ +/* HPDF_Page_Rectangle( hPage, nX, nY, nWidth, nHeight ) --> hStatus */ HB_FUNC( HPDF_PAGE_RECTANGLE ) { hb_retnl( ( long ) HPDF_Page_Rectangle( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ) ) ); } -/* HPDF_Page_Stroke( hPage ) -> hStatus - */ +/* HPDF_Page_Stroke( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_STROKE ) { hb_retnl( ( long ) HPDF_Page_Stroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_ClosePathStroke( hPage ) -> hStatus - */ +/* HPDF_Page_ClosePathStroke( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_CLOSEPATHSTROKE ) { hb_retnl( ( long ) HPDF_Page_ClosePathStroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_SetFontAndSize( hPage, hFont, nSize ) -> hStatus - */ +/* HPDF_Page_SetFontAndSize( hPage, hFont, nSize ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETFONTANDSIZE ) { hb_retnl( ( long ) HPDF_Page_SetFontAndSize( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_Font ) hb_parptr( 2 ), ( HPDF_REAL ) hb_parnd( 3 ) ) ); } -/* HPDF_Page_BeginText( hPage ) -> hStatus - */ +/* HPDF_Page_BeginText( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_BEGINTEXT ) { hb_retnl( ( long ) HPDF_Page_BeginText( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_EndText( hPage ) -> hStatus - */ +/* HPDF_Page_EndText( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_ENDTEXT ) { hb_retnl( ( long ) HPDF_Page_EndText( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_TextOut( hPage, nX, nY, cText ) -> hStatus - */ +/* HPDF_Page_TextOut( hPage, nX, nY, cText ) --> hStatus */ HB_FUNC( HPDF_PAGE_TEXTOUT ) { hb_retnl( ( long ) HPDF_Page_TextOut( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), hb_parc( 4 ) ) ); } -/* HPDF_Page_MoveTextPos( hPage, nX, nY ) -> hStatus - */ +/* HPDF_Page_MoveTextPos( hPage, nX, nY ) --> hStatus */ HB_FUNC( HPDF_PAGE_MOVETEXTPOS ) { hb_retnl( ( long ) HPDF_Page_MoveTextPos( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ) ) ); } -/* HPDF_Page_ShowText( hPage, cText ) -> hStatus - */ +/* HPDF_Page_ShowText( hPage, cText ) --> hStatus */ HB_FUNC( HPDF_PAGE_SHOWTEXT ) { hb_retnl( ( long ) HPDF_Page_ShowText( ( HPDF_Page ) hb_parptr( 1 ), hb_parc( 2 ) ) ); } -/* HPDF_Page_Fill( hPage ) -> hStatus - */ +/* HPDF_Page_Fill( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_FILL ) { hb_retnl( ( long ) HPDF_Page_Fill( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_Eofill( hPage ) -> hStatus - */ +/* HPDF_Page_Eofill( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_EOFILL ) { hb_retnl( ( long ) HPDF_Page_Eofill( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_FillStroke( hPage ) -> hStatus - */ +/* HPDF_Page_FillStroke( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_FILLSTROKE ) { hb_retnl( ( long ) HPDF_Page_FillStroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_EofillStroke( hPage ) -> hStatus - */ +/* HPDF_Page_EofillStroke( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_EOFILLSTROKE ) { hb_retnl( ( long ) HPDF_Page_EofillStroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_ClosePathFillStroke( hPage ) -> hStatus - */ +/* HPDF_Page_ClosePathFillStroke( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_CLOSEPATHFILLSTROKE ) { hb_retnl( ( long ) HPDF_Page_ClosePathFillStroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_ClosePathEofillStroke( hPage ) -> hStatus - */ +/* HPDF_Page_ClosePathEofillStroke( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_CLOSEPATHEOFILLSTROKE ) { hb_retnl( ( long ) HPDF_Page_ClosePathEofillStroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_EndPath( hPage ) -> hStatus - */ +/* HPDF_Page_EndPath( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_ENDPATH ) { hb_retnl( ( long ) HPDF_Page_EndPath( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_Clip( hPage ) -> hStatus - */ +/* HPDF_Page_Clip( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_CLIP ) { hb_retnl( ( long ) HPDF_Page_Clip( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_Eoclip( hPage ) -> hStatus - */ +/* HPDF_Page_Eoclip( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_EOCLIP ) { hb_retnl( ( long ) HPDF_Page_Eoclip( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_SetCharSpace( hPage, nSpaceWidth ) -> hStatus - */ +/* HPDF_Page_SetCharSpace( hPage, nSpaceWidth ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETCHARSPACE ) { hb_retnl( ( long ) HPDF_Page_SetCharSpace( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetWordSpace( hPage, nSpaceWidth ) -> hStatus - */ +/* HPDF_Page_SetWordSpace( hPage, nSpaceWidth ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETWORDSPACE ) { hb_retnl( ( long ) HPDF_Page_SetWordSpace( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetHorizontalScalling( hPage, nHorzScale ) -> hStatus - */ +/* HPDF_Page_SetHorizontalScalling( hPage, nHorzScale ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETHORIZONTALSCALLING ) { hb_retnl( ( long ) HPDF_Page_SetHorizontalScalling( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetTextLeading( hPage, nTextLeading ) -> hStatus - */ +/* HPDF_Page_SetTextLeading( hPage, nTextLeading ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETTEXTLEADING ) { hb_retnl( ( long ) HPDF_Page_SetTextLeading( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetTextRenderingMode( hPage, nTextRenderingMode ) -> hStatus - */ +/* HPDF_Page_SetTextRenderingMode( hPage, nTextRenderingMode ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETTEXTRENDERINGMODE ) { hb_retnl( ( long ) HPDF_Page_SetTextRenderingMode( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_TextRenderingMode ) hb_parni( 2 ) ) ); } -/* HPDF_Page_SetTextRise( hPage, nTextRise ) -> hStatus - */ +/* HPDF_Page_SetTextRise( hPage, nTextRise ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETTEXTRISE ) { hb_retnl( ( long ) HPDF_Page_SetTextRise( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_MoveTextPos2( hPage, nX, nY ) -> hStatus - */ +/* HPDF_Page_MoveTextPos2( hPage, nX, nY ) --> hStatus */ HB_FUNC( HPDF_PAGE_MOVETEXTPOS2 ) { hb_retnl( ( long ) HPDF_Page_MoveTextPos2( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ) ) ); } -/* HPDF_Page_SetTextMatrix( hPage ) -> hStatus --------tobedone--------- - */ +/* HPDF_Page_SetTextMatrix( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETTEXTMATRIX ) { hb_retnl( ( long ) HPDF_Page_SetTextMatrix( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ), ( HPDF_REAL ) hb_parnd( 6 ), ( HPDF_REAL ) hb_parnd( 7 ) ) ); } -/* HPDF_Page_MoveToNextLine( hPage ) -> hStatus - */ +/* HPDF_Page_MoveToNextLine( hPage ) --> hStatus */ HB_FUNC( HPDF_PAGE_MOVETONEXTLINE ) { hb_retnl( ( long ) HPDF_Page_MoveToNextLine( ( HPDF_Page ) hb_parptr( 1 ) ) ); } -/* HPDF_Page_ShowTextNextLine( hPage, cText ) -> hStatus - */ +/* HPDF_Page_ShowTextNextLine( hPage, cText ) --> hStatus */ HB_FUNC( HPDF_PAGE_SHOWTEXTNEXTLINE ) { hb_retnl( ( long ) HPDF_Page_ShowTextNextLine( ( HPDF_Page ) hb_parptr( 1 ), hb_parc( 2 ) ) ); } -/* HPDF_Page_ShowTextNextLineEx( hPage, nWordSpace, nCharSpace, cText ) -> hStatus - */ +/* HPDF_Page_ShowTextNextLineEx( hPage, nWordSpace, nCharSpace, cText ) --> hStatus */ HB_FUNC( HPDF_PAGE_SHOWTEXTNEXTLINEEX ) { hb_retnl( ( long ) HPDF_Page_ShowTextNextLineEx( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), hb_parc( 4 ) ) ); } -/* HPDF_Page_SetGrayFill( hPage, nGrayFill ) -> hStatus - */ +/* HPDF_Page_SetGrayFill( hPage, nGrayFill ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETGRAYFILL ) { hb_retnl( ( long ) HPDF_Page_SetGrayFill( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetGrayStroke( hPage, nGrayStroke ) -> hStatus - */ +/* HPDF_Page_SetGrayStroke( hPage, nGrayStroke ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETGRAYSTROKE ) { hb_retnl( ( long ) HPDF_Page_SetGrayStroke( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Page_SetRGBFill( hPage, nRGBRed, nRGBGreen, nRGBBlue ) -> hStatus - */ +/* HPDF_Page_SetRGBFill( hPage, nRGBRed, nRGBGreen, nRGBBlue ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETRGBFILL ) { hb_retnl( ( long ) HPDF_Page_SetRGBFill( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ) ) ); } -/* HPDF_Page_SetRGBStroke( hPage, nRGBRed, nRGBGreen, nRGBBlue ) -> hStatus - */ +/* HPDF_Page_SetRGBStroke( hPage, nRGBRed, nRGBGreen, nRGBBlue ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETRGBSTROKE ) { hb_retnl( ( long ) HPDF_Page_SetRGBStroke( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ) ) ); } -/* HPDF_Page_SetCMYKFill( hPage, nC, nM, nY, nK ) -> hStatus - */ +/* HPDF_Page_SetCMYKFill( hPage, nC, nM, nY, nK ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETCMYKFILL ) { hb_retnl( ( long ) HPDF_Page_SetCMYKFill( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ) ) ); } -/* HPDF_Page_SetCMYKStroke( hPage, nC, nM, nY, nK ) -> hStatus - */ +/* HPDF_Page_SetCMYKStroke( hPage, nC, nM, nY, nK ) --> hStatus */ HB_FUNC( HPDF_PAGE_SETCMYKSTROKE ) { hb_retnl( ( long ) HPDF_Page_SetCMYKStroke( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ) ) ); } -/* HPDF_Page_ExecuteXObject( hPage, hImage ) -> hStatus - */ +/* HPDF_Page_ExecuteXObject( hPage, hImage ) --> hStatus */ HB_FUNC( HPDF_PAGE_EXECUTEXOBJECT ) { hb_retnl( ( long ) HPDF_Page_ExecuteXObject( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_Image ) hb_parptr( 2 ) ) ); } -/* HPDF_Page_DrawImage( hPage, hImage, nX, nY, nWidth, nHeight ) -> hStatus - */ +/* HPDF_Page_DrawImage( hPage, hImage, nX, nY, nWidth, nHeight ) --> hStatus */ HB_FUNC( HPDF_PAGE_DRAWIMAGE ) { hb_retnl( ( long ) HPDF_Page_DrawImage( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_Image ) hb_parptr( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ), ( HPDF_REAL ) hb_parnd( 6 ) ) ); } -/* HPDF_Page_Circle( hPage, nX, nY, nRay ) -> hStatus - */ +/* HPDF_Page_Circle( hPage, nX, nY, nRay ) --> hStatus */ HB_FUNC( HPDF_PAGE_CIRCLE ) { hb_retnl( ( long ) HPDF_Page_Circle( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ) ) ); } -/* HPDF_Page_Arc( hPage, nX, nY, nRay, nAngle1, nAngle2 ) -> hStatus - */ +/* HPDF_Page_Arc( hPage, nX, nY, nRay, nAngle1, nAngle2 ) --> hStatus */ HB_FUNC( HPDF_PAGE_ARC ) { hb_retnl( ( long ) HPDF_Page_Arc( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ), ( HPDF_REAL ) hb_parnd( 6 ) ) ); } -/* HPDF_Page_Ellipse( hPage, nX, nY, nxRay, nyRay ) -> hStatus - */ +/* HPDF_Page_Ellipse( hPage, nX, nY, nxRay, nyRay ) --> hStatus */ HB_FUNC( HPDF_PAGE_ELLIPSE ) { hb_retnl( ( long ) HPDF_Page_Ellipse( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ) ) ); } -/* HPDF_Page_TextRect( hPage, nLeft, nTop, nRight, nBottom, cText, nAlign ) -> hStatus - */ +/* HPDF_Page_TextRect( hPage, nLeft, nTop, nRight, nBottom, cText, nAlign ) --> hStatus */ HB_FUNC( HPDF_PAGE_TEXTRECT ) { hb_retnl( ( long ) HPDF_Page_TextRect( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ), hb_parc( 6 ), ( HPDF_TextAlignment ) hb_parni( 7 ), NULL ) ); } -/*----------------------------------------------------------------------*/ -/* FONTS */ -/*----------------------------------------------------------------------*/ +/* --- FONTS --- */ -/* HPDF_Font_GetFontName( hFont ) -> cFontName - */ +/* HPDF_Font_GetFontName( hFont ) --> cFontName */ HB_FUNC( HPDF_FONT_GETFONTNAME ) { hb_retc( HPDF_Font_GetFontName( ( HPDF_Font ) hb_parptr( 1 ) ) ); } -/* HPDF_Font_GetEncodingName( hFont ) -> cEncoding - */ +/* HPDF_Font_GetEncodingName( hFont ) --> cEncoding */ HB_FUNC( HPDF_FONT_GETENCODINGNAME ) { hb_retc( HPDF_Font_GetEncodingName( ( HPDF_Font ) hb_parptr( 1 ) ) ); } -/* HPDF_Font_GetUnicodeWidth( hFont, hUnicode ) -> nCharWidth - */ +/* HPDF_Font_GetUnicodeWidth( hFont, hUnicode ) --> nCharWidth */ HB_FUNC( HPDF_FONT_GETUNICODEWIDTH ) { hb_retnl( ( long ) HPDF_Font_GetUnicodeWidth( ( HPDF_Font ) hb_parptr( 1 ), ( HPDF_UNICODE ) hb_parni( 2 ) ) ); } -/* HPDF_Font_GetBBox( hFont ) -> aRect - */ +/* HPDF_Font_GetBBox( hFont ) --> aRect */ HB_FUNC( HPDF_FONT_GETBBOX ) { HPDF_Box rc; @@ -1334,36 +1197,31 @@ HB_FUNC( HPDF_FONT_GETBBOX ) hb_itemReturnRelease( info ); } -/* HPDF_Font_GetAscent( hFont ) -> nAscent - */ +/* HPDF_Font_GetAscent( hFont ) --> nAscent */ HB_FUNC( HPDF_FONT_GETASCENT ) { hb_retni( ( int ) HPDF_Font_GetAscent( ( HPDF_Font ) hb_parptr( 1 ) ) ); } -/* HPDF_Font_GetDescent( hFont ) -> nDescent - */ +/* HPDF_Font_GetDescent( hFont ) --> nDescent */ HB_FUNC( HPDF_FONT_GETDESCENT ) { hb_retni( ( int ) HPDF_Font_GetDescent( ( HPDF_Font ) hb_parptr( 1 ) ) ); } -/* HPDF_Font_GetXHeight( hFont ) -> nXHeight - */ +/* HPDF_Font_GetXHeight( hFont ) --> nXHeight */ HB_FUNC( HPDF_FONT_GETXHEIGHT ) { hb_retnl( ( long ) HPDF_Font_GetXHeight( ( HPDF_Font ) hb_parptr( 1 ) ) ); } -/* HPDF_Font_GetCapHeight( hFont ) -> nCapsHeight - */ +/* HPDF_Font_GetCapHeight( hFont ) --> nCapsHeight */ HB_FUNC( HPDF_FONT_GETCAPHEIGHT ) { hb_retnl( ( long ) HPDF_Font_GetCapHeight( ( HPDF_Font ) hb_parptr( 1 ) ) ); } -/* HPDF_Font_TextWidth( hFont, cText, nWidth ) -> aTextWidth[ nNumChars, nNumWords, nWidth, nNumSpace ] - */ +/* HPDF_Font_TextWidth( hFont, cText, nWidth ) --> aTextWidth[] { nNumChars, nNumWords, nWidth, nNumSpace } */ HB_FUNC( HPDF_FONT_TEXTWIDTH ) { HPDF_TextWidth tw; @@ -1379,8 +1237,7 @@ HB_FUNC( HPDF_FONT_TEXTWIDTH ) hb_itemReturnRelease( info ); } -/* HPDF_Font_MeasureText( hFont, cText, nTextLen, nWidth, nFontSize, nCharSpace, nWordSpace, lWordWrap ) -> nByteLengthTobeIncludedInWidth - */ +/* HPDF_Font_MeasureText( hFont, cText, nTextLen, nWidth, nFontSize, nCharSpace, nWordSpace, lWordWrap ) --> nByteLengthTobeIncludedInWidth */ HB_FUNC( HPDF_FONT_MEASURETEXT ) { hb_retni( HPDF_Font_MeasureText( ( HPDF_Font ) hb_parptr( 1 ), @@ -1394,11 +1251,9 @@ HB_FUNC( HPDF_FONT_MEASURETEXT ) NULL ) ); } -/*----------------------------------------------------------------------*/ -/* ENCODING */ -/*----------------------------------------------------------------------*/ +/* --- ENCODING --- */ -/* HPDF_Encoder_GetType( hEncoder ) -> nEncoderType +/* HPDF_Encoder_GetType( hEncoder ) --> nEncoderType nEncoderType == HPDF_ENCODER_TYPE_SINGLE_BYTE 1 This encoder is an encoder for single byte characters. HPDF_ENCODER_TYPE_DOUBLE_BYTE 2 This encoder is an encoder for multi byte characters. @@ -1410,7 +1265,7 @@ HB_FUNC( HPDF_ENCODER_GETTYPE ) hb_retni( ( int ) HPDF_Encoder_GetType( ( HPDF_Encoder ) hb_parptr( 1 ) ) ); } -/* HPDF_Encoder_GetByteType( hEncoder, cText, nIndex ) -> nByteType +/* HPDF_Encoder_GetByteType( hEncoder, cText, nIndex ) --> nByteType nByteType HPDF_BYTE_TYPE_SINGLE 1 Single byte character. HPDF_BYTE_TYPE_LEAD 2 Lead byte of a double-byte character. @@ -1422,14 +1277,13 @@ HB_FUNC( HPDF_ENCODER_GETBYTETYPE ) hb_retni( ( int ) HPDF_Encoder_GetByteType( ( HPDF_Encoder ) hb_parptr( 1 ), hb_parc( 2 ), hb_parni( 3 ) ) ); } -/* HPDF_Encoder_GetUnicode( hEncoder, nCode ) -> nUnicode - */ +/* HPDF_Encoder_GetUnicode( hEncoder, nCode ) --> nUnicode */ HB_FUNC( HPDF_ENCODER_GETUNICODE ) { hb_retni( ( int ) HPDF_Encoder_GetUnicode( ( HPDF_Encoder ) hb_parptr( 1 ), ( HPDF_UINT16 ) hb_parni( 2 ) ) ); } -/* HPDF_Encoder_GetWritingMode( hEncoder ) -> nWriteMode +/* HPDF_Encoder_GetWritingMode( hEncoder ) --> nWriteMode nWriteMode == HPDF_WMODE_HORIZONTAL 1 horizontal writing mode. HPDF_WMODE_VERTICAL 2 vertical writing mode; @@ -1439,103 +1293,85 @@ HB_FUNC( HPDF_ENCODER_GETWRITINGMODE ) hb_retni( ( int ) HPDF_Encoder_GetWritingMode( ( HPDF_Encoder ) hb_parptr( 1 ) ) ); } -/*----------------------------------------------------------------------*/ -/* OUTLINE */ -/*----------------------------------------------------------------------*/ +/* --- OUTLINE --- */ -/* HPDF_Outline_SetOpened( hOutline, lShowOpened ) -> hStatus - */ +/* HPDF_Outline_SetOpened( hOutline, lShowOpened ) --> hStatus */ HB_FUNC( HPDF_OUTLINE_SETOPENED ) { hb_retnl( ( long ) HPDF_Outline_SetOpened( ( HPDF_Outline ) hb_parptr( 1 ), hb_parl( 2 ) ? HPDF_TRUE : HPDF_FALSE ) ); } -/* HPDF_Outline_SetDestination( hOutline, hDestn ) -> hStatus - */ +/* HPDF_Outline_SetDestination( hOutline, hDestn ) --> hStatus */ HB_FUNC( HPDF_OUTLINE_SETDESTINATION ) { hb_retnl( ( long ) HPDF_Outline_SetDestination( ( HPDF_Outline ) hb_parptr( 1 ), ( HPDF_Destination ) hb_parptr( 2 ) ) ); } -/*----------------------------------------------------------------------*/ -/* DESTINATION */ -/*----------------------------------------------------------------------*/ +/* --- DESTINATION --- */ -/* HPDF_Destination_SetXYZ( hDestn, nLeft, nTop, nZoom ) -> hStatus - */ +/* HPDF_Destination_SetXYZ( hDestn, nLeft, nTop, nZoom ) --> hStatus */ HB_FUNC( HPDF_DESTINATION_SETXYZ ) { hb_retnl( ( long ) HPDF_Destination_SetXYZ( ( HPDF_Destination ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ) ) ); } -/* HPDF_Destination_SetFit( hDestn ) -> hStatus - */ +/* HPDF_Destination_SetFit( hDestn ) --> hStatus */ HB_FUNC( HPDF_DESTINATION_SETFIT ) { hb_retnl( ( long ) HPDF_Destination_SetFit( ( HPDF_Destination ) hb_parptr( 1 ) ) ); } -/* HPDF_Destination_SetFitH( hDestn, nTop ) -> hStatus - */ +/* HPDF_Destination_SetFitH( hDestn, nTop ) --> hStatus */ HB_FUNC( HPDF_DESTINATION_SETFITH ) { hb_retnl( ( long ) HPDF_Destination_SetFitH( ( HPDF_Destination ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Destination_SetFitV( hDestn, nLeft ) -> hStatus - */ +/* HPDF_Destination_SetFitV( hDestn, nLeft ) --> hStatus */ HB_FUNC( HPDF_DESTINATION_SETFITV ) { hb_retnl( ( long ) HPDF_Destination_SetFitV( ( HPDF_Destination ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Destination_SetFitR( hDestn, nLeft, nBottom, nRight, nTop ) -> hStatus - */ +/* HPDF_Destination_SetFitR( hDestn, nLeft, nBottom, nRight, nTop ) --> hStatus */ HB_FUNC( HPDF_DESTINATION_SETFITR ) { hb_retnl( ( long ) HPDF_Destination_SetFitR( ( HPDF_Destination ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ), ( HPDF_REAL ) hb_parnd( 3 ), ( HPDF_REAL ) hb_parnd( 4 ), ( HPDF_REAL ) hb_parnd( 5 ) ) ); } -/* HPDF_Destination_SetFitB( hDestn ) -> hStatus - */ +/* HPDF_Destination_SetFitB( hDestn ) --> hStatus */ HB_FUNC( HPDF_DESTINATION_SETFITB ) { hb_retnl( ( long ) HPDF_Destination_SetFitB( ( HPDF_Destination ) hb_parptr( 1 ) ) ); } -/* HPDF_Destination_SetFitBH( hDestn, nTop ) -> hStatus - */ +/* HPDF_Destination_SetFitBH( hDestn, nTop ) --> hStatus */ HB_FUNC( HPDF_DESTINATION_SETFITBH ) { hb_retnl( ( long ) HPDF_Destination_SetFitBH( ( HPDF_Destination ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_Destination_SetFitBV( hDestn, nTop ) -> hStatus - */ +/* HPDF_Destination_SetFitBV( hDestn, nTop ) --> hStatus */ HB_FUNC( HPDF_DESTINATION_SETFITBV ) { hb_retnl( ( long ) HPDF_Destination_SetFitBV( ( HPDF_Destination ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/*----------------------------------------------------------------------*/ -/* ExtGState */ -/*----------------------------------------------------------------------*/ +/* --- ExtGState --- */ -/* HPDF_ExtGState_SetAlphaStroke( hGState, nValue ) -> hStatus - */ +/* HPDF_ExtGState_SetAlphaStroke( hGState, nValue ) --> hStatus */ HB_FUNC( HPDF_EXTGSTATE_SETALPHASTROKE ) { hb_retnl( ( long ) HPDF_ExtGState_SetAlphaStroke( ( HPDF_ExtGState ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_ExtGState_SetAlphaFill( hGState, nValue ) -> hStatus - */ +/* HPDF_ExtGState_SetAlphaFill( hGState, nValue ) --> hStatus */ HB_FUNC( HPDF_EXTGSTATE_SETALPHAFILL ) { hb_retnl( ( long ) HPDF_ExtGState_SetAlphaFill( ( HPDF_ExtGState ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); } -/* HPDF_ExtGState_SetBlendMode( hGState, nBlendMode ) -> hStatus +/* HPDF_ExtGState_SetBlendMode( hGState, nBlendMode ) --> hStatus nBlendMode == HPDF_BM_NORMAL HPDF_BM_MULTIPLY @@ -1560,16 +1396,9 @@ HB_FUNC( HPDF_VERSION_TEXT ) hb_retc_const( HPDF_VERSION_TEXT ); } -/*----------------------------------------------------------------------*/ -/* New Functions in LibHaru 2.2.0 */ -/*----------------------------------------------------------------------*/ +/* --- New Functions in LibHaru 2.2.0 --- */ -/* - HPDF_EXPORT(HPDF_STATUS) - HPDF_GetContents (HPDF_Doc pdf, - HPDF_BYTE *buf, - HPDF_UINT32 *size); - */ +/* HPDF_EXPORT(HPDF_STATUS) HPDF_GetContents (HPDF_Doc pdf, HPDF_BYTE *buf, HPDF_UINT32 *size); */ HB_FUNC( HPDF_GETCONTENTS ) { #if HB_HPDF_VERS( 2, 2, 0 ) @@ -1587,36 +1416,31 @@ HB_FUNC( HPDF_GETCONTENTS ) hb_xfree( buffer ); #else hb_storc( NULL, 2 ); - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) - HPDF_CheckError (HPDF_Error error); - */ + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_CheckError (HPDF_Error error); */ HB_FUNC( HPDF_CHECKERROR ) { #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_CheckError( ( HPDF_Error ) hb_parptr( 1 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_STATUS) - HPDF_Page_SetZoom (HPDF_Page page, - HPDF_REAL zoom); - */ + +/* HPDF_EXPORT(HPDF_STATUS) HPDF_Page_SetZoom (HPDF_Page page, HPDF_REAL zoom); */ HB_FUNC( HPDF_PAGE_SETZOOM ) { #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_Page_SetZoom( ( HPDF_Page ) hb_parptr( 1 ), ( HPDF_REAL ) hb_parnd( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } -/* - HPDF_EXPORT(HPDF_Dict) + +/* HPDF_EXPORT(HPDF_Dict) HPDF_Page_Create3DView (HPDF_Page page, HPDF_U3D u3d, HPDF_Annotation annot3d, @@ -1630,11 +1454,8 @@ HB_FUNC( HPDF_PAGE_CREATE3DVIEW ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_EmbeddedFile) - HPDF_AttachFile (HPDF_Doc pdf, - const char *file); - */ + +/* HPDF_EXPORT(HPDF_EmbeddedFile) HPDF_AttachFile (HPDF_Doc pdf, const char *file); */ HB_FUNC( HPDF_ATTACHFILE ) { #if HB_HPDF_VERS( 2, 2, 0 ) @@ -1643,8 +1464,8 @@ HB_FUNC( HPDF_ATTACHFILE ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_OutputIntent) + +/* HPDF_EXPORT(HPDF_OutputIntent) HPDF_ICC_LoadIccFromMem (HPDF_Doc pdf, HPDF_MMgr mmgr, HPDF_Stream iccdata, @@ -1659,12 +1480,8 @@ HB_FUNC( HPDF_ICC_LOADICCFROMMEM ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_OutputIntent) - HPDF_LoadIccProfileFromFile (HPDF_Doc pdf, - const char* icc_file_name, - int numcomponent); - */ + +/* HPDF_EXPORT(HPDF_OutputIntent) HPDF_LoadIccProfileFromFile (HPDF_Doc pdf, const char* icc_file_name, int numcomponent); */ HB_FUNC( HPDF_LOADICCPROFILEFROMFILE ) { #if HB_HPDF_VERS( 2, 2, 0 ) @@ -1674,16 +1491,13 @@ HB_FUNC( HPDF_LOADICCPROFILEFROMFILE ) #endif } -/* - HPDF_EXPORT(HPDF_STATUS) - HPDF_UseUTFEncodings (HPDF_Doc pdf); - */ +/* HPDF_EXPORT(HPDF_STATUS) HPDF_UseUTFEncodings (HPDF_Doc pdf); */ HB_FUNC( HPDF_USEUTFENCODINGS ) { #if HB_HPDF_VERS( 2, 3, 0 ) hb_retnl( HPDF_UseUTFEncodings( hb_HPDF_Doc_par( 1 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } diff --git a/contrib/hbhpdf/enccns.c b/contrib/hbhpdf/enccns.c index ad576a02ff..00a147a492 100644 --- a/contrib/hbhpdf/enccns.c +++ b/contrib/hbhpdf/enccns.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_UseCNSEncodings( hDoc ) -> hStatus - */ +/* HPDF_UseCNSEncodings( hDoc ) --> hStatus */ HB_FUNC( HPDF_USECNSENCODINGS ) { hb_retnl( ( long ) HPDF_UseCNSEncodings( hb_HPDF_Doc_par( 1 ) ) ); diff --git a/contrib/hbhpdf/enccnt.c b/contrib/hbhpdf/enccnt.c index 76dc2724cb..90a3e4f6cd 100644 --- a/contrib/hbhpdf/enccnt.c +++ b/contrib/hbhpdf/enccnt.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_UseCNTEncodings( hDoc ) -> hStatus - */ +/* HPDF_UseCNTEncodings( hDoc ) --> hStatus */ HB_FUNC( HPDF_USECNTENCODINGS ) { hb_retnl( ( long ) HPDF_UseCNTEncodings( hb_HPDF_Doc_par( 1 ) ) ); diff --git a/contrib/hbhpdf/encjp.c b/contrib/hbhpdf/encjp.c index 087c4f9501..033a556ec4 100644 --- a/contrib/hbhpdf/encjp.c +++ b/contrib/hbhpdf/encjp.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_UseJPEncodings( hDoc ) -> hStatus - */ +/* HPDF_UseJPEncodings( hDoc ) --> hStatus */ HB_FUNC( HPDF_USEJPENCODINGS ) { hb_retnl( ( long ) HPDF_UseJPEncodings( hb_HPDF_Doc_par( 1 ) ) ); diff --git a/contrib/hbhpdf/enckr.c b/contrib/hbhpdf/enckr.c index 385b354513..d40d598f6f 100644 --- a/contrib/hbhpdf/enckr.c +++ b/contrib/hbhpdf/enckr.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_UseKREncodings( hDoc ) -> hStatus - */ +/* HPDF_UseKREncodings( hDoc ) --> hStatus */ HB_FUNC( HPDF_USEKRENCODINGS ) { hb_retnl( ( long ) HPDF_UseKREncodings( hb_HPDF_Doc_par( 1 ) ) ); diff --git a/contrib/hbhpdf/errstr.prg b/contrib/hbhpdf/errstr.prg index f9b01b30b4..ee94dbe0e0 100644 --- a/contrib/hbhpdf/errstr.prg +++ b/contrib/hbhpdf/errstr.prg @@ -47,8 +47,7 @@ #include "harupdf.ch" /* NOTE: Error descriptions here: - https://github.com/libharu/libharu/wiki/Error-handling - http://libharu.sourceforge.net/error_handling.html + https://github.com/libharu/libharu/wiki/Error-handling */ FUNCTION hb_HPDF_GetErrorString( nStatus ) @@ -58,6 +57,7 @@ FUNCTION hb_HPDF_GetErrorString( nStatus ) ENDIF SWITCH nStatus + CASE HB_HPDF_BADPARAM ; RETURN "HB_HPDF_BADPARAM" CASE HPDF_OK ; RETURN "HPDF_OK" CASE HPDF_ARRAY_COUNT_ERR ; RETURN "HPDF_ARRAY_COUNT_ERR" CASE HPDF_ARRAY_ITEM_NOT_FOUND ; RETURN "HPDF_ARRAY_ITEM_NOT_FOUND" diff --git a/contrib/hbhpdf/font.c b/contrib/hbhpdf/font.c index eb92bb858a..573304c4b0 100644 --- a/contrib/hbhpdf/font.c +++ b/contrib/hbhpdf/font.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_LoadTypeIFontFromFile( hDoc, cAFMFileName, cPFA_PFBFileName ) -> cFontName - */ +/* HPDF_LoadTypeIFontFromFile( hDoc, cAFMFileName, cPFA_PFBFileName ) --> cFontName */ HB_FUNC( HPDF_LOADTYPE1FONTFROMFILE ) { char * pszFree1; @@ -63,8 +61,7 @@ HB_FUNC( HPDF_LOADTYPE1FONTFROMFILE ) hb_xfree( pszFree2 ); } -/* HPDF_LoadTTFontFromFile( hDoc, cTTFontFileName, lEmbed ) -> cFontName - */ +/* HPDF_LoadTTFontFromFile( hDoc, cTTFontFileName, lEmbed ) --> cFontName */ HB_FUNC( HPDF_LOADTTFONTFROMFILE ) { char * pszFree; @@ -76,8 +73,7 @@ HB_FUNC( HPDF_LOADTTFONTFROMFILE ) hb_xfree( pszFree ); } -/* HPDF_LoadTTFontFromFile2( hDoc, cTTFontFileName, nIndexInFile, lEmbed ) -> cFontName - */ +/* HPDF_LoadTTFontFromFile2( hDoc, cTTFontFileName, nIndexInFile, lEmbed ) --> cFontName */ HB_FUNC( HPDF_LOADTTFONTFROMFILE2 ) { char * pszFree; diff --git a/contrib/hbhpdf/fontcns.c b/contrib/hbhpdf/fontcns.c index ae78c5ef83..d32fbd60b7 100644 --- a/contrib/hbhpdf/fontcns.c +++ b/contrib/hbhpdf/fontcns.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_UseCNSFonts( hDoc ) -> hStatus - */ +/* HPDF_UseCNSFonts( hDoc ) --> hStatus */ HB_FUNC( HPDF_USECNSFONTS ) { hb_retnl( ( long ) HPDF_UseCNSFonts( hb_HPDF_Doc_par( 1 ) ) ); diff --git a/contrib/hbhpdf/fontcnt.c b/contrib/hbhpdf/fontcnt.c index 932bbe32a0..3f491847fd 100644 --- a/contrib/hbhpdf/fontcnt.c +++ b/contrib/hbhpdf/fontcnt.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_UseCNTFonts( hDoc ) -> hStatus - */ +/* HPDF_UseCNTFonts( hDoc ) --> hStatus */ HB_FUNC( HPDF_USECNTFONTS ) { hb_retnl( ( long ) HPDF_UseCNTFonts( hb_HPDF_Doc_par( 1 ) ) ); diff --git a/contrib/hbhpdf/fontjp.c b/contrib/hbhpdf/fontjp.c index 99f1f2f543..6dbbb8c17d 100644 --- a/contrib/hbhpdf/fontjp.c +++ b/contrib/hbhpdf/fontjp.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_UseJPFonts( hDoc ) -> hStatus - */ +/* HPDF_UseJPFonts( hDoc ) --> hStatus */ HB_FUNC( HPDF_USEJPFONTS ) { hb_retnl( ( long ) HPDF_UseJPFonts( hb_HPDF_Doc_par( 1 ) ) ); diff --git a/contrib/hbhpdf/fontkr.c b/contrib/hbhpdf/fontkr.c index e9cb35c0bb..fe470243cf 100644 --- a/contrib/hbhpdf/fontkr.c +++ b/contrib/hbhpdf/fontkr.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,8 +44,7 @@ #include "hbhpdf.h" -/* HPDF_UseKRFonts( hDoc ) -> hStatus - */ +/* HPDF_UseKRFonts( hDoc ) --> hStatus */ HB_FUNC( HPDF_USEKRFONTS ) { hb_retnl( ( long ) HPDF_UseKRFonts( hb_HPDF_Doc_par( 1 ) ) ); diff --git a/contrib/hbhpdf/harupdf.ch b/contrib/hbhpdf/harupdf.ch index 24117869b0..19a2e76ac8 100644 --- a/contrib/hbhpdf/harupdf.ch +++ b/contrib/hbhpdf/harupdf.ch @@ -5,18 +5,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -34,7 +34,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -44,9 +44,7 @@ * */ -//--------------------------------------------------// -// Collected by Pritpal Bedi -//--------------------------------------------------// +/* Collected by Pritpal Bedi */ #ifndef _HARUPDF_CH #define _HARUPDF_CH @@ -310,9 +308,9 @@ #define HPDF_BS_DEF_WIDTH 1 -/* defalt page-size */ -#define HPDF_DEF_PAGE_WIDTH 595.276F -#define HPDF_DEF_PAGE_HEIGHT 841.89F +/* default page size */ +#define HPDF_DEF_PAGE_WIDTH 595.276 +#define HPDF_DEF_PAGE_HEIGHT 841.89 /* compression mode */ #define HPDF_COMP_NONE 0x00 @@ -320,8 +318,10 @@ #define HPDF_COMP_IMAGE 0x02 #define HPDF_COMP_METADATA 0x04 #define HPDF_COMP_ALL 0x0F -/* #define HPDF_COMP_BEST_COMPRESS 0x10 */ -/* #define HPDF_COMP_BEST_SPEED 0x20 */ +#if 0 +#define HPDF_COMP_BEST_COMPRESS 0x10 +#define HPDF_COMP_BEST_SPEED 0x20 +#endif #define HPDF_COMP_MASK 0xFF /* permission flags (only Revision 2 is supported) */ @@ -623,143 +623,143 @@ #define HPDF_COUNTRY_ZW "ZW" /* ZIMBABWE */ /* lang code definition */ -#define HPDF_LANG_AA "aa" /* Afar */ -#define HPDF_LANG_AB "ab" /* Abkhazian */ -#define HPDF_LANG_AF "af" /* Afrikaans */ -#define HPDF_LANG_AM "am" /* Amharic */ -#define HPDF_LANG_AR "ar" /* Arabic */ -#define HPDF_LANG_AS "as" /* Assamese */ -#define HPDF_LANG_AY "ay" /* Aymara */ -#define HPDF_LANG_AZ "az" /* Azerbaijani */ -#define HPDF_LANG_BA "ba" /* Bashkir */ -#define HPDF_LANG_BE "be" /* Byelorussian */ -#define HPDF_LANG_BG "bg" /* Bulgarian */ -#define HPDF_LANG_BH "bh" /* Bihari */ -#define HPDF_LANG_BI "bi" /* Bislama */ -#define HPDF_LANG_BN "bn" /* Bengali Bangla */ -#define HPDF_LANG_BO "bo" /* Tibetan */ -#define HPDF_LANG_BR "br" /* Breton */ -#define HPDF_LANG_CA "ca" /* Catalan */ -#define HPDF_LANG_CO "co" /* Corsican */ -#define HPDF_LANG_CS "cs" /* Czech */ -#define HPDF_LANG_CY "cy" /* Welsh */ -#define HPDF_LANG_DA "da" /* Danish */ -#define HPDF_LANG_DE "de" /* German */ -#define HPDF_LANG_DZ "dz" /* Bhutani */ -#define HPDF_LANG_EL "el" /* Greek */ -#define HPDF_LANG_EN "en" /* English */ -#define HPDF_LANG_EO "eo" /* Esperanto */ -#define HPDF_LANG_ES "es" /* Spanish */ -#define HPDF_LANG_ET "et" /* Estonian */ -#define HPDF_LANG_EU "eu" /* Basque */ -#define HPDF_LANG_FA "fa" /* Persian */ -#define HPDF_LANG_FI "fi" /* Finnish */ -#define HPDF_LANG_FJ "fj" /* Fiji */ -#define HPDF_LANG_FO "fo" /* Faeroese */ -#define HPDF_LANG_FR "fr" /* French */ -#define HPDF_LANG_FY "fy" /* Frisian */ -#define HPDF_LANG_GA "ga" /* Irish */ -#define HPDF_LANG_GD "gd" /* Scots Gaelic */ -#define HPDF_LANG_GL "gl" /* Galician */ -#define HPDF_LANG_GN "gn" /* Guarani */ -#define HPDF_LANG_GU "gu" /* Gujarati */ -#define HPDF_LANG_HA "ha" /* Hausa */ -#define HPDF_LANG_HI "hi" /* Hindi */ -#define HPDF_LANG_HR "hr" /* Croatian */ -#define HPDF_LANG_HU "hu" /* Hungarian */ -#define HPDF_LANG_HY "hy" /* Armenian */ -#define HPDF_LANG_IA "ia" /* Interlingua */ -#define HPDF_LANG_IE "ie" /* Interlingue */ -#define HPDF_LANG_IK "ik" /* Inupiak */ -#define HPDF_LANG_IN "in" /* Indonesian */ -#define HPDF_LANG_IS "is" /* Icelandic */ -#define HPDF_LANG_IT "it" /* Italian */ -#define HPDF_LANG_IW "iw" /* Hebrew */ -#define HPDF_LANG_JA "ja" /* Japanese */ -#define HPDF_LANG_JI "ji" /* Yiddish */ -#define HPDF_LANG_JW "jw" /* Javanese */ -#define HPDF_LANG_KA "ka" /* Georgian */ -#define HPDF_LANG_KK "kk" /* Kazakh */ -#define HPDF_LANG_KL "kl" /* Greenlandic */ -#define HPDF_LANG_KM "km" /* Cambodian */ -#define HPDF_LANG_KN "kn" /* Kannada */ -#define HPDF_LANG_KO "ko" /* Korean */ -#define HPDF_LANG_KS "ks" /* Kashmiri */ -#define HPDF_LANG_KU "ku" /* Kurdish */ -#define HPDF_LANG_KY "ky" /* Kirghiz */ -#define HPDF_LANG_LA "la" /* Latin */ -#define HPDF_LANG_LN "ln" /* Lingala */ -#define HPDF_LANG_LO "lo" /* Laothian */ -#define HPDF_LANG_LT "lt" /* Lithuanian */ -#define HPDF_LANG_LV "lv" /* Latvian,Lettish */ -#define HPDF_LANG_MG "mg" /* Malagasy */ -#define HPDF_LANG_MI "mi" /* Maori */ -#define HPDF_LANG_MK "mk" /* Macedonian */ -#define HPDF_LANG_ML "ml" /* Malayalam */ -#define HPDF_LANG_MN "mn" /* Mongolian */ -#define HPDF_LANG_MO "mo" /* Moldavian */ -#define HPDF_LANG_MR "mr" /* Marathi */ -#define HPDF_LANG_MS "ms" /* Malay */ -#define HPDF_LANG_MT "mt" /* Maltese */ -#define HPDF_LANG_MY "my" /* Burmese */ -#define HPDF_LANG_NA "na" /* Nauru */ -#define HPDF_LANG_NE "ne" /* Nepali */ -#define HPDF_LANG_NL "nl" /* Dutch */ -#define HPDF_LANG_NO "no" /* Norwegian */ -#define HPDF_LANG_OC "oc" /* Occitan */ -#define HPDF_LANG_OM "om" /* (Afan)Oromo */ -#define HPDF_LANG_OR "or" /* Oriya */ -#define HPDF_LANG_PA "pa" /* Punjabi */ -#define HPDF_LANG_PL "pl" /* Polish */ -#define HPDF_LANG_PS "ps" /* Pashto,Pushto */ -#define HPDF_LANG_PT "pt" /* Portuguese */ -#define HPDF_LANG_QU "qu" /* Quechua */ -#define HPDF_LANG_RM "rm" /* Rhaeto-Romance */ -#define HPDF_LANG_RN "rn" /* Kirundi */ -#define HPDF_LANG_RO "ro" /* Romanian */ -#define HPDF_LANG_RU "ru" /* Russian */ -#define HPDF_LANG_RW "rw" /* Kinyarwanda */ -#define HPDF_LANG_SA "sa" /* Sanskrit */ -#define HPDF_LANG_SD "sd" /* Sindhi */ -#define HPDF_LANG_SG "sg" /* Sangro */ -#define HPDF_LANG_SH "sh" /* Serbo-Croatian */ -#define HPDF_LANG_SI "si" /* Singhalese */ -#define HPDF_LANG_SK "sk" /* Slovak */ -#define HPDF_LANG_SL "sl" /* Slovenian */ -#define HPDF_LANG_SM "sm" /* Samoan */ -#define HPDF_LANG_SN "sn" /* Shona */ -#define HPDF_LANG_SO "so" /* Somali */ -#define HPDF_LANG_SQ "sq" /* Albanian */ -#define HPDF_LANG_SR "sr" /* Serbian */ -#define HPDF_LANG_SS "ss" /* Siswati */ -#define HPDF_LANG_ST "st" /* Sesotho */ -#define HPDF_LANG_SU "su" /* Sundanese */ -#define HPDF_LANG_SV "sv" /* Swedish */ -#define HPDF_LANG_SW "sw" /* Swahili */ -#define HPDF_LANG_TA "ta" /* Tamil */ -#define HPDF_LANG_TE "te" /* Tegulu */ -#define HPDF_LANG_TG "tg" /* Tajik */ -#define HPDF_LANG_TH "th" /* Thai */ -#define HPDF_LANG_TI "ti" /* Tigrinya */ -#define HPDF_LANG_TK "tk" /* Turkmen */ -#define HPDF_LANG_TL "tl" /* Tagalog */ -#define HPDF_LANG_TN "tn" /* Setswanato Tonga */ -#define HPDF_LANG_TR "tr" /* Turkish */ -#define HPDF_LANG_TS "ts" /* Tsonga */ -#define HPDF_LANG_TT "tt" /* Tatar */ -#define HPDF_LANG_TW "tw" /* Twi */ -#define HPDF_LANG_UK "uk" /* Ukrainian */ -#define HPDF_LANG_UR "ur" /* Urdu */ -#define HPDF_LANG_UZ "uz" /* Uzbek */ -#define HPDF_LANG_VI "vi" /* Vietnamese */ -#define HPDF_LANG_VO "vo" /* Volapuk */ -#define HPDF_LANG_WO "wo" /* Wolof */ -#define HPDF_LANG_XH "xh" /* Xhosa */ -#define HPDF_LANG_YO "yo" /* Yoruba */ -#define HPDF_LANG_ZH "zh" /* Chinese */ -#define HPDF_LANG_ZU "zu" /* Zulu */ +#define HPDF_LANG_AA "aa" /* Afar */ +#define HPDF_LANG_AB "ab" /* Abkhazian */ +#define HPDF_LANG_AF "af" /* Afrikaans */ +#define HPDF_LANG_AM "am" /* Amharic */ +#define HPDF_LANG_AR "ar" /* Arabic */ +#define HPDF_LANG_AS "as" /* Assamese */ +#define HPDF_LANG_AY "ay" /* Aymara */ +#define HPDF_LANG_AZ "az" /* Azerbaijani */ +#define HPDF_LANG_BA "ba" /* Bashkir */ +#define HPDF_LANG_BE "be" /* Byelorussian */ +#define HPDF_LANG_BG "bg" /* Bulgarian */ +#define HPDF_LANG_BH "bh" /* Bihari */ +#define HPDF_LANG_BI "bi" /* Bislama */ +#define HPDF_LANG_BN "bn" /* Bengali Bangla */ +#define HPDF_LANG_BO "bo" /* Tibetan */ +#define HPDF_LANG_BR "br" /* Breton */ +#define HPDF_LANG_CA "ca" /* Catalan */ +#define HPDF_LANG_CO "co" /* Corsican */ +#define HPDF_LANG_CS "cs" /* Czech */ +#define HPDF_LANG_CY "cy" /* Welsh */ +#define HPDF_LANG_DA "da" /* Danish */ +#define HPDF_LANG_DE "de" /* German */ +#define HPDF_LANG_DZ "dz" /* Bhutani */ +#define HPDF_LANG_EL "el" /* Greek */ +#define HPDF_LANG_EN "en" /* English */ +#define HPDF_LANG_EO "eo" /* Esperanto */ +#define HPDF_LANG_ES "es" /* Spanish */ +#define HPDF_LANG_ET "et" /* Estonian */ +#define HPDF_LANG_EU "eu" /* Basque */ +#define HPDF_LANG_FA "fa" /* Persian */ +#define HPDF_LANG_FI "fi" /* Finnish */ +#define HPDF_LANG_FJ "fj" /* Fiji */ +#define HPDF_LANG_FO "fo" /* Faeroese */ +#define HPDF_LANG_FR "fr" /* French */ +#define HPDF_LANG_FY "fy" /* Frisian */ +#define HPDF_LANG_GA "ga" /* Irish */ +#define HPDF_LANG_GD "gd" /* Scots Gaelic */ +#define HPDF_LANG_GL "gl" /* Galician */ +#define HPDF_LANG_GN "gn" /* Guarani */ +#define HPDF_LANG_GU "gu" /* Gujarati */ +#define HPDF_LANG_HA "ha" /* Hausa */ +#define HPDF_LANG_HI "hi" /* Hindi */ +#define HPDF_LANG_HR "hr" /* Croatian */ +#define HPDF_LANG_HU "hu" /* Hungarian */ +#define HPDF_LANG_HY "hy" /* Armenian */ +#define HPDF_LANG_IA "ia" /* Interlingua */ +#define HPDF_LANG_IE "ie" /* Interlingue */ +#define HPDF_LANG_IK "ik" /* Inupiak */ +#define HPDF_LANG_IN "in" /* Indonesian */ +#define HPDF_LANG_IS "is" /* Icelandic */ +#define HPDF_LANG_IT "it" /* Italian */ +#define HPDF_LANG_IW "iw" /* Hebrew */ +#define HPDF_LANG_JA "ja" /* Japanese */ +#define HPDF_LANG_JI "ji" /* Yiddish */ +#define HPDF_LANG_JW "jw" /* Javanese */ +#define HPDF_LANG_KA "ka" /* Georgian */ +#define HPDF_LANG_KK "kk" /* Kazakh */ +#define HPDF_LANG_KL "kl" /* Greenlandic */ +#define HPDF_LANG_KM "km" /* Cambodian */ +#define HPDF_LANG_KN "kn" /* Kannada */ +#define HPDF_LANG_KO "ko" /* Korean */ +#define HPDF_LANG_KS "ks" /* Kashmiri */ +#define HPDF_LANG_KU "ku" /* Kurdish */ +#define HPDF_LANG_KY "ky" /* Kirghiz */ +#define HPDF_LANG_LA "la" /* Latin */ +#define HPDF_LANG_LN "ln" /* Lingala */ +#define HPDF_LANG_LO "lo" /* Laothian */ +#define HPDF_LANG_LT "lt" /* Lithuanian */ +#define HPDF_LANG_LV "lv" /* Latvian,Lettish */ +#define HPDF_LANG_MG "mg" /* Malagasy */ +#define HPDF_LANG_MI "mi" /* Maori */ +#define HPDF_LANG_MK "mk" /* Macedonian */ +#define HPDF_LANG_ML "ml" /* Malayalam */ +#define HPDF_LANG_MN "mn" /* Mongolian */ +#define HPDF_LANG_MO "mo" /* Moldavian */ +#define HPDF_LANG_MR "mr" /* Marathi */ +#define HPDF_LANG_MS "ms" /* Malay */ +#define HPDF_LANG_MT "mt" /* Maltese */ +#define HPDF_LANG_MY "my" /* Burmese */ +#define HPDF_LANG_NA "na" /* Nauru */ +#define HPDF_LANG_NE "ne" /* Nepali */ +#define HPDF_LANG_NL "nl" /* Dutch */ +#define HPDF_LANG_NO "no" /* Norwegian */ +#define HPDF_LANG_OC "oc" /* Occitan */ +#define HPDF_LANG_OM "om" /* (Afan)Oromo */ +#define HPDF_LANG_OR "or" /* Oriya */ +#define HPDF_LANG_PA "pa" /* Punjabi */ +#define HPDF_LANG_PL "pl" /* Polish */ +#define HPDF_LANG_PS "ps" /* Pashto,Pushto */ +#define HPDF_LANG_PT "pt" /* Portuguese */ +#define HPDF_LANG_QU "qu" /* Quechua */ +#define HPDF_LANG_RM "rm" /* Rhaeto-Romance */ +#define HPDF_LANG_RN "rn" /* Kirundi */ +#define HPDF_LANG_RO "ro" /* Romanian */ +#define HPDF_LANG_RU "ru" /* Russian */ +#define HPDF_LANG_RW "rw" /* Kinyarwanda */ +#define HPDF_LANG_SA "sa" /* Sanskrit */ +#define HPDF_LANG_SD "sd" /* Sindhi */ +#define HPDF_LANG_SG "sg" /* Sangro */ +#define HPDF_LANG_SH "sh" /* Serbo-Croatian */ +#define HPDF_LANG_SI "si" /* Singhalese */ +#define HPDF_LANG_SK "sk" /* Slovak */ +#define HPDF_LANG_SL "sl" /* Slovenian */ +#define HPDF_LANG_SM "sm" /* Samoan */ +#define HPDF_LANG_SN "sn" /* Shona */ +#define HPDF_LANG_SO "so" /* Somali */ +#define HPDF_LANG_SQ "sq" /* Albanian */ +#define HPDF_LANG_SR "sr" /* Serbian */ +#define HPDF_LANG_SS "ss" /* Siswati */ +#define HPDF_LANG_ST "st" /* Sesotho */ +#define HPDF_LANG_SU "su" /* Sundanese */ +#define HPDF_LANG_SV "sv" /* Swedish */ +#define HPDF_LANG_SW "sw" /* Swahili */ +#define HPDF_LANG_TA "ta" /* Tamil */ +#define HPDF_LANG_TE "te" /* Tegulu */ +#define HPDF_LANG_TG "tg" /* Tajik */ +#define HPDF_LANG_TH "th" /* Thai */ +#define HPDF_LANG_TI "ti" /* Tigrinya */ +#define HPDF_LANG_TK "tk" /* Turkmen */ +#define HPDF_LANG_TL "tl" /* Tagalog */ +#define HPDF_LANG_TN "tn" /* Setswanato Tonga */ +#define HPDF_LANG_TR "tr" /* Turkish */ +#define HPDF_LANG_TS "ts" /* Tsonga */ +#define HPDF_LANG_TT "tt" /* Tatar */ +#define HPDF_LANG_TW "tw" /* Twi */ +#define HPDF_LANG_UK "uk" /* Ukrainian */ +#define HPDF_LANG_UR "ur" /* Urdu */ +#define HPDF_LANG_UZ "uz" /* Uzbek */ +#define HPDF_LANG_VI "vi" /* Vietnamese */ +#define HPDF_LANG_VO "vo" /* Volapuk */ +#define HPDF_LANG_WO "wo" /* Wolof */ +#define HPDF_LANG_XH "xh" /* Xhosa */ +#define HPDF_LANG_YO "yo" /* Yoruba */ +#define HPDF_LANG_ZH "zh" /* Chinese */ +#define HPDF_LANG_ZU "zu" /* Zulu */ -/* Graphis mode */ +/* Graphics mode */ #define HPDF_GMODE_PAGE_DESCRIPTION 0x0001 #define HPDF_GMODE_PATH_OBJECT 0x0002 #define HPDF_GMODE_TEXT_OBJECT 0x0004 @@ -774,6 +774,9 @@ /* Error code */ +#define HB_HPDF_BADPARAM -2 +#define HB_HPDF_NOTSUPPORTED -1 + /* NOTE: After making any changes in the list below, always update hb_HPDF_GetErrorString() accordingly. */ diff --git a/contrib/hbhpdf/hbhpdf.h b/contrib/hbhpdf/hbhpdf.h index 7e835855b8..73ab5298cf 100644 --- a/contrib/hbhpdf/hbhpdf.h +++ b/contrib/hbhpdf/hbhpdf.h @@ -1,21 +1,22 @@ /* - * Copyright 2008 Pritpal Bedi * hbhpdf header * + * Copyright 2008 Pritpal Bedi + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +34,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -52,7 +53,15 @@ #include "hpdf.h" -#define HB_HPDF_VERS( ma, mi, mu ) ( HPDF_MAJOR_VERSION > ma || ( HPDF_MAJOR_VERSION == ma && ( HPDF_MINOR_VERSION > mi || ( HPDF_MINOR_VERSION == mi && HPDF_BUGFIX_VERSION >= mu ) ) ) ) +#define HB_HPDF_VERS( ma, mi, mu ) \ + ( HPDF_MAJOR_VERSION > ma || \ + ( HPDF_MAJOR_VERSION == ma && \ + ( HPDF_MINOR_VERSION > mi || \ + ( HPDF_MINOR_VERSION == mi && \ + HPDF_BUGFIX_VERSION >= mu ) ) ) ) + +#define HB_HPDF_BADPARAM -2 +#define HB_HPDF_NOTSUPPORTED -1 HB_EXTERN_BEGIN diff --git a/contrib/hbhpdf/image.c b/contrib/hbhpdf/image.c index cb32d72b2b..fe5d0cfc13 100644 --- a/contrib/hbhpdf/image.c +++ b/contrib/hbhpdf/image.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,21 +44,19 @@ #include "hbhpdf.h" -/* HPDF_LoadPngImageFromFile( hDoc, cPNGFileName ) -> hImage - */ +/* HPDF_LoadPngImageFromFile( hDoc, cPNGFileName ) --> hImage */ HB_FUNC( HPDF_LOADPNGIMAGEFROMFILE ) { hb_retptr( ( void * ) HPDF_LoadPngImageFromFile( hb_HPDF_Doc_par( 1 ), hb_parc( 2 ) ) ); } -/* HPDF_LoadPngImageFromFile2( hDoc, cPNGFileName ) -> hImage - */ +/* HPDF_LoadPngImageFromFile2( hDoc, cPNGFileName ) --> hImage */ HB_FUNC( HPDF_LOADPNGIMAGEFROMFILE2 ) { hb_retptr( ( void * ) HPDF_LoadPngImageFromFile2( hb_HPDF_Doc_par( 1 ), hb_parc( 2 ) ) ); } -/* HPDF_LoadRawImageFromFile( hDoc, cImageFileName, nWidth, nHeight, nColorSpace ) -> hImage +/* HPDF_LoadRawImageFromFile( hDoc, cImageFileName, nWidth, nHeight, nColorSpace ) --> hImage nColorSpace HPDF_CS_DEVICE_GRAY HPDF_CS_DEVICE_RGB @@ -70,22 +67,19 @@ HB_FUNC( HPDF_LOADRAWIMAGEFROMFILE ) hb_retptr( ( void * ) HPDF_LoadRawImageFromFile( hb_HPDF_Doc_par( 1 ), hb_parc( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HPDF_ColorSpace ) hb_parni( 5 ) ) ); } -/* HPDF_LoadRawImageFromMem( hDoc, cBuffer, nWidth, nHeight, nColorSpace, nBitsPerComponents ) -> hImage - */ +/* HPDF_LoadRawImageFromMem( hDoc, cBuffer, nWidth, nHeight, nColorSpace, nBitsPerComponents ) --> hImage */ HB_FUNC( HPDF_LOADRAWIMAGEFROMMEM ) { hb_retptr( ( void * ) HPDF_LoadRawImageFromMem( hb_HPDF_Doc_par( 1 ), ( const HPDF_BYTE * ) hb_parc( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HPDF_ColorSpace ) hb_parni( 5 ), hb_parni( 6 ) ) ); } -/* HPDF_LoadJpegImageFromFile( hDoc, cHPEGFileName ) -> hImage - */ +/* HPDF_LoadJpegImageFromFile( hDoc, cHPEGFileName ) --> hImage */ HB_FUNC( HPDF_LOADJPEGIMAGEFROMFILE ) { hb_retptr( ( void * ) HPDF_LoadJpegImageFromFile( hb_HPDF_Doc_par( 1 ), hb_parc( 2 ) ) ); } -/* - HPDF_EXPORT(HPDF_Image) +/* HPDF_EXPORT(HPDF_Image) HPDF_LoadPngImageFromMem (HPDF_Doc pdf, const HPDF_BYTE *buffer, HPDF_UINT size); @@ -101,8 +95,7 @@ HB_FUNC( HPDF_LOADPNGIMAGEFROMMEM ) hb_retptr( NULL ); #endif } -/* - HPDF_EXPORT(HPDF_Image) +/* HPDF_EXPORT(HPDF_Image) HPDF_LoadJpegImageFromMem (HPDF_Doc pdf, const HPDF_BYTE *buffer, HPDF_UINT size); @@ -119,8 +112,7 @@ HB_FUNC( HPDF_LOADJPEGIMAGEFROMMEM ) #endif } -/* HPDF_Image_GetSize( hImage ) -> aSize[ nW, nH ] - */ +/* HPDF_Image_GetSize( hImage ) --> aSize[] { nW, nH } */ HB_FUNC( HPDF_IMAGE_GETSIZE ) { HPDF_Point pt; @@ -134,29 +126,25 @@ HB_FUNC( HPDF_IMAGE_GETSIZE ) hb_itemReturnRelease( info ); } -/* HPDF_Image_GetWidth( hImage ) -> nWidth - */ +/* HPDF_Image_GetWidth( hImage ) --> nWidth */ HB_FUNC( HPDF_IMAGE_GETWIDTH ) { hb_retni( HPDF_Image_GetWidth( ( HPDF_Image ) hb_parptr( 1 ) ) ); } -/* HPDF_Image_GetHeight( hImage ) -> nHeight - */ +/* HPDF_Image_GetHeight( hImage ) --> nHeight */ HB_FUNC( HPDF_IMAGE_GETHEIGHT ) { hb_retni( HPDF_Image_GetHeight( ( HPDF_Image ) hb_parptr( 1 ) ) ); } -/* HPDF_Image_GetBitsPerComponent( hImage ) -> nBitsPerComponent - */ +/* HPDF_Image_GetBitsPerComponent( hImage ) --> nBitsPerComponent */ HB_FUNC( HPDF_IMAGE_GETBITSPERCOMPONENT ) { hb_retni( HPDF_Image_GetBitsPerComponent( ( HPDF_Image ) hb_parptr( 1 ) ) ); } -/* HPDF_Image_GetColorSpace( hImage ) -> nColorSpace - */ +/* HPDF_Image_GetColorSpace( hImage ) --> nColorSpace */ HB_FUNC( HPDF_IMAGE_GETCOLORSPACE ) { HPDF_Image image = ( HPDF_Image ) hb_parptr( 1 ); @@ -167,8 +155,7 @@ HB_FUNC( HPDF_IMAGE_GETCOLORSPACE ) hb_retc_null(); } -/* HPDF_Image_SetColorMask( hImage, nRGB_R_Min, nRGB_R_Max, nRGB_G_Min, nRGB_G_Max, nRGB_B_Min, nRGB_B_Max ) - */ +/* HPDF_Image_SetColorMask( hImage, nRGB_R_Min, nRGB_R_Max, nRGB_G_Min, nRGB_G_Max, nRGB_B_Min, nRGB_B_Max ) */ HB_FUNC( HPDF_IMAGE_SETCOLORMASK ) { hb_retnl( ( long ) HPDF_Image_SetColorMask( ( HPDF_Image ) hb_parptr( 1 ), @@ -180,15 +167,13 @@ HB_FUNC( HPDF_IMAGE_SETCOLORMASK ) hb_parni( 7 ) ) ); } -/* HPDF_Image_SetMaskImage( hImage, hImageMask ) -> hStatus - */ +/* HPDF_Image_SetMaskImage( hImage, hImageMask ) --> hStatus */ HB_FUNC( HPDF_IMAGE_SETMASKIMAGE ) { hb_retnl( ( long ) HPDF_Image_SetMaskImage( ( HPDF_Image ) hb_parptr( 1 ), ( HPDF_Image ) hb_parptr( 2 ) ) ); } -/* - HPDF_EXPORT(HPDF_STATUS) +/* HPDF_EXPORT(HPDF_STATUS) HPDF_Image_AddSMask (HPDF_Image image, HPDF_Image smask); */ @@ -197,6 +182,6 @@ HB_FUNC( HPDF_IMAGE_ADDSMASK ) #if HB_HPDF_VERS( 2, 2, 0 ) hb_retnl( ( long ) HPDF_Image_AddSMask( ( HPDF_Image ) hb_parptr( 1 ), ( HPDF_Image ) hb_parptr( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } diff --git a/contrib/hbhpdf/misc.prg b/contrib/hbhpdf/misc.prg index fb80dd0a46..ff6a6632db 100644 --- a/contrib/hbhpdf/misc.prg +++ b/contrib/hbhpdf/misc.prg @@ -50,7 +50,8 @@ FUNCTION hb_HPDF_IsVersion( ma, mi, mu ) hb_HPDF_Version( @HPDF_MAJOR_VERSION, @HPDF_MINOR_VERSION, @HPDF_BUGFIX_VERSION ) - RETURN HPDF_MAJOR_VERSION > ma .OR. ; - ( HPDF_MAJOR_VERSION == ma .AND. ; - ( HPDF_MINOR_VERSION > mi .OR. ; - ( HPDF_MINOR_VERSION == mi .AND. HPDF_BUGFIX_VERSION >= mu ) ) ) + RETURN ; + HPDF_MAJOR_VERSION > ma .OR. ; + ( HPDF_MAJOR_VERSION == ma .AND. ; + ( HPDF_MINOR_VERSION > mi .OR. ; + ( HPDF_MINOR_VERSION == mi .AND. HPDF_BUGFIX_VERSION >= mu ) ) ) diff --git a/contrib/hbhpdf/pdfa.c b/contrib/hbhpdf/pdfa.c index f222ba0be1..14207d84f5 100644 --- a/contrib/hbhpdf/pdfa.c +++ b/contrib/hbhpdf/pdfa.c @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -45,18 +44,15 @@ #include "hbhpdf.h" -/* - HPDF_STATUS - HPDF_PDFA_SetPDFAConformance (HPDF_Doc pdf,HPDF_PDFAType pdfatype) - */ +/* HPDF_PDFA_SetPDFAConformance( pdf, nPDFAType ) --> hStatus */ HB_FUNC( HPDF_PDFA_SETPDFACONFORMANCE ) { -/* TOFIX: These functions are not exported from libharu. Until we find +/* FIXME: These functions are not exported from libharu. Until we find out it is design decision or bug, I excluded them from dynamic builds. [vszakats] */ #if HB_HPDF_VERS( 2, 2, 0 ) && ! defined( HB_DYNLIB ) hb_retnl( HPDF_PDFA_SetPDFAConformance( hb_HPDF_Doc_par( 1 ), ( HPDF_PDFAType ) hb_parni( 2 ) ) ); #else - hb_retnl( -1 ); + hb_retnl( HB_HPDF_NOTSUPPORTED ); #endif } diff --git a/contrib/hbhpdf/tests/harupdf.prg b/contrib/hbhpdf/tests/harupdf.prg index a30d119a07..d9151aa3aa 100644 --- a/contrib/hbhpdf/tests/harupdf.prg +++ b/contrib/hbhpdf/tests/harupdf.prg @@ -1,21 +1,20 @@ /* * Copyright 2008 Pritpal Bedi * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -33,7 +32,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -70,21 +69,20 @@ FUNCTION DesignHaruPDF( cFileToSave ) LOCAL i, page, height, width, def_font, tw, samp_text, font LOCAL page_title := "hbhpdf demo" LOCAL font_list := { ; - "Courier", ; - "Courier-Bold", ; - "Courier-Oblique", ; - "Courier-BoldOblique", ; - "Helvetica", ; - "Helvetica-Bold", ; - "Helvetica-Oblique", ; - "Helvetica-BoldOblique", ; - "Times-Roman", ; - "Times-Bold", ; - "Times-Italic", ; - "Times-BoldItalic", ; - "Symbol", ; - "ZapfDingbats" ; - } + "Courier" , ; + "Courier-Bold" , ; + "Courier-Oblique" , ; + "Courier-BoldOblique" , ; + "Helvetica" , ; + "Helvetica-Bold" , ; + "Helvetica-Oblique" , ; + "Helvetica-BoldOblique" , ; + "Times-Roman" , ; + "Times-Bold" , ; + "Times-Italic" , ; + "Times-BoldItalic" , ; + "Symbol" , ; + "ZapfDingbats" } LOCAL pdf := HPDF_New() @@ -160,7 +158,7 @@ FUNCTION DesignHaruPDF( cFileToSave ) Page_Images( pdf ) - // Commentout the following line if you need ASCII chart by Codepages + // Comment out the following line if you need ASCII chart by Codepages Page_CodePages( pdf ) IF HPDF_SaveToFile( pdf, cFileToSave ) != 0 @@ -171,9 +169,7 @@ FUNCTION DesignHaruPDF( cFileToSave ) RETURN hb_FileExists( cFileToSave ) -// - -STATIC FUNCTION Page_Lines( pdf ) +STATIC PROCEDURE Page_Lines( pdf ) LOCAL page_title := "Line Example" LOCAL font, page @@ -207,15 +203,15 @@ STATIC FUNCTION Page_Lines( pdf ) HPDF_Page_SetFontAndSize( page, font, 10 ) - /* Draw verious widths of lines. */ + /* Draw various widths of lines. */ HPDF_Page_SetLineWidth( page, 0 ) - draw_line( page, 60, 770, "line width = 0" ) + draw_line( page, 60, 770, "line width: 0" ) HPDF_Page_SetLineWidth( page, 1.0 ) - draw_line( page, 60, 740, "line width = 1.0" ) + draw_line( page, 60, 740, "line width: 1.0" ) HPDF_Page_SetLineWidth( page, 2.0 ) - draw_line( page, 60, 710, "line width = 2.0" ) + draw_line( page, 60, 710, "line width: 2.0" ) /* Line dash pattern */ HPDF_Page_SetLineWidth( page, 1.0 ) @@ -229,7 +225,7 @@ STATIC FUNCTION Page_Lines( pdf ) HPDF_Page_SetDash( page, DASH_MODE3, 4, 0 ) draw_line( page, 60, 620, "dash_ptn=[8, 7, 2, 7], phase=0" ) - HPDF_Page_SetDash( page, NIL, 0, 0 ) + HPDF_Page_SetDash( page, , 0, 0 ) HPDF_Page_SetLineWidth( page, 30 ) HPDF_Page_SetRGBStroke( page, 0.0, 0.5, 0.0 ) @@ -344,7 +340,7 @@ STATIC FUNCTION Page_Lines( pdf ) HPDF_Page_LineTo( page, x2, y2 ) HPDF_Page_Stroke( page ) - HPDF_Page_SetDash( page, NIL, 0, 0 ) + HPDF_Page_SetDash( page, , 0, 0 ) HPDF_Page_SetLineWidth( page, 1.5 ) @@ -378,7 +374,7 @@ STATIC FUNCTION Page_Lines( pdf ) HPDF_Page_LineTo( page, x1, y1 ) HPDF_Page_Stroke( page ) - HPDF_Page_SetDash( page, NIL, 0, 0 ) + HPDF_Page_SetDash( page, , 0, 0 ) HPDF_Page_SetLineWidth( page, 1.5 ) HPDF_Page_MoveTo( page, x, y ) @@ -417,18 +413,16 @@ STATIC FUNCTION Page_Lines( pdf ) HPDF_Page_LineTo( page, x3, y3 ) HPDF_Page_Stroke( page ) - HPDF_Page_SetDash( page, NIL, 0, 0 ) + HPDF_Page_SetDash( page, , 0, 0 ) HPDF_Page_SetLineWidth( page, 1.5 ) HPDF_Page_MoveTo( page, x, y ) HPDF_Page_CurveTo( page, x1, y1, x2, y2, x3, y3 ) HPDF_Page_Stroke( page ) - RETURN NIL + RETURN -// - -STATIC FUNCTION draw_rect( page, x, y, label ) +STATIC PROCEDURE draw_rect( page, x, y, label ) HPDF_Page_BeginText( page ) HPDF_Page_MoveTextPos( page, x, y - 10 ) @@ -437,11 +431,9 @@ STATIC FUNCTION draw_rect( page, x, y, label ) HPDF_Page_Rectangle( page, x, y - 40, 220, 25 ) - RETURN NIL + RETURN -// - -STATIC FUNCTION draw_line( page, x, y, label ) +STATIC PROCEDURE draw_line( page, x, y, label ) HPDF_Page_BeginText( page ) HPDF_Page_MoveTextPos( page, x, y - 10 ) @@ -452,11 +444,9 @@ STATIC FUNCTION draw_line( page, x, y, label ) HPDF_Page_LineTo( page, x + 220, y - 15 ) HPDF_Page_Stroke( page ) - RETURN NIL + RETURN -// - -STATIC FUNCTION draw_line2( page, x, y, label ) +STATIC PROCEDURE draw_line2( page, x, y, label ) HPDF_Page_BeginText( page ) HPDF_Page_MoveTextPos( page, x, y ) @@ -467,33 +457,35 @@ STATIC FUNCTION draw_line2( page, x, y, label ) HPDF_Page_LineTo( page, x + 160, y - 25 ) HPDF_Page_Stroke( page ) - RETURN NIL + RETURN -// - -STATIC FUNCTION Page_Text( pdf ) +STATIC PROCEDURE Page_Text( pdf ) LOCAL page, font, rect := Array( 4 ) LOCAL SAMP_TXT := "The quick brown fox jumps over the lazy dog. " LOCAL angle1, angle2, rad1, rad2, i, x, y, buf - // LOCAL page_height +#if 0 + LOCAL page_height +#endif /* add a new page object. */ page := HPDF_AddPage( pdf ) HPDF_Page_SetSize( page, HPDF_PAGE_SIZE_A5, HPDF_PAGE_PORTRAIT ) - // print_grid( pdf, page ) +#if 0 + print_grid( pdf, page ) - // page_height := HPDF_Page_GetHeight( page ) + page_height := HPDF_Page_GetHeight( page ) +#endif font := HPDF_GetFont( pdf, "Helvetica", NIL ) HPDF_Page_SetTextLeading( page, 20 ) -#define rLEFT 1 -#define rTOP 2 -#define rRIGHT 3 -#define rBOTTOM 4 + #define rLEFT 1 + #define rTOP 2 + #define rRIGHT 3 + #define rBOTTOM 4 /* text_rect method */ @@ -608,7 +600,6 @@ STATIC FUNCTION Page_Text( pdf ) HPDF_Page_GRestore( page ) - /* Rotated coordinate system */ HPDF_Page_GSave( page ) @@ -638,7 +629,6 @@ STATIC FUNCTION Page_Text( pdf ) HPDF_Page_GRestore( page ) - /* text along a circle */ HPDF_Page_SetGrayStroke( page, 0 ) HPDF_Page_Circle( page, 210, 190, 145 ) @@ -668,11 +658,9 @@ STATIC FUNCTION Page_Text( pdf ) HPDF_Page_EndText( page ) - RETURN NIL + RETURN -// - -STATIC FUNCTION Page_TextScaling( pdf ) +STATIC PROCEDURE Page_TextScaling( pdf ) LOCAL font, page, tw, angle1, angle2, buf, len, fsize, i, r, b, g, yPos, rad1, rad2 LOCAL samp_text := "abcdefgABCDEFG123!#$%&+-@?" @@ -680,7 +668,9 @@ STATIC FUNCTION Page_TextScaling( pdf ) LOCAL page_title := "Text Demo" /* set compression mode */ - // HPDF_SetCompressionMode( pdf, HPDF_COMP_ALL ) +#if 0 + HPDF_SetCompressionMode( pdf, HPDF_COMP_ALL ) +#endif /* create default-font */ font := HPDF_GetFont( pdf, "Helvetica", NIL ) @@ -689,14 +679,17 @@ STATIC FUNCTION Page_TextScaling( pdf ) page := HPDF_AddPage( pdf ) /* draw grid to the page */ - // print_grid( pdf, page ) +#if 0 + print_grid( pdf, page ) +#endif - /* print the lines of the page. + /* print the lines of the page */ +#if 0 HPDF_Page_SetLineWidth( page, 1 ) - HPDF_Page_Rectangle( page, 50, 50, HPDF_Page_GetWidth( page ) - 100, - HPDF_Page_GetHeight( page ) - 110 ) + HPDF_Page_Rectangle( page, 50, 50, HPDF_Page_GetWidth( page ) - 100, ; + HPDF_Page_GetHeight( page ) - 110 ) HPDF_Page_Stroke( page ) - */ +#endif /* print the title of the page(with positioning center). */ HPDF_Page_SetFontAndSize( page, font, 24 ) @@ -709,16 +702,14 @@ STATIC FUNCTION Page_TextScaling( pdf ) HPDF_Page_BeginText( page ) HPDF_Page_MoveTextPos( page, 60, HPDF_Page_GetHeight( page ) - 60 ) - /* - * font size - */ + /* font size */ fsize := 8 DO WHILE fsize < 60 /* set style and size of font. */ HPDF_Page_SetFontAndSize( page, font, fsize ) /* set the position of the text. */ - HPDF_Page_MoveTextPos( page, 0, - 5 - fsize ) + HPDF_Page_MoveTextPos( page, 0, -5 - fsize ) /* measure the number of characters which included in the page. */ buf := samp_text @@ -728,7 +719,7 @@ STATIC FUNCTION Page_TextScaling( pdf ) HPDF_Page_ShowText( page, buf ) /* print the description. */ - HPDF_Page_MoveTextPos( page, 0, - 10 ) + HPDF_Page_MoveTextPos( page, 0, -10 ) HPDF_Page_SetFontAndSize( page, font, 8 ) buf := "Fontsize=" + hb_ntos( fsize ) @@ -737,15 +728,13 @@ STATIC FUNCTION Page_TextScaling( pdf ) fsize *= 1.5 ENDDO - /* - * font color - */ + /* font color */ HPDF_Page_SetFontAndSize( page, font, 8 ) - HPDF_Page_MoveTextPos( page, 0, - 30 ) + HPDF_Page_MoveTextPos( page, 0, -30 ) HPDF_Page_ShowText( page, "Font color" ) HPDF_Page_SetFontAndSize( page, font, 18 ) - HPDF_Page_MoveTextPos( page, 0, - 20 ) + HPDF_Page_MoveTextPos( page, 0, -20 ) len := Len( samp_text ) FOR i := 1 TO len r := i / len @@ -755,7 +744,7 @@ STATIC FUNCTION Page_TextScaling( pdf ) HPDF_Page_SetRGBFill( page, r, g, 0.0 ) HPDF_Page_ShowText( page, buf ) NEXT - HPDF_Page_MoveTextPos( page, 0, - 25 ) + HPDF_Page_MoveTextPos( page, 0, -25 ) FOR i := 1 TO len r := i / len @@ -765,7 +754,7 @@ STATIC FUNCTION Page_TextScaling( pdf ) HPDF_Page_SetRGBFill( page, r, 0.0, b ) HPDF_Page_ShowText( page, buf ) NEXT - HPDF_Page_MoveTextPos( page, 0, - 25 ) + HPDF_Page_MoveTextPos( page, 0, -25 ) FOR i := 1 TO len b := i / len @@ -780,9 +769,7 @@ STATIC FUNCTION Page_TextScaling( pdf ) ypos := 450 - /* - * Font rendering mode - */ + /* Font rendering mode */ HPDF_Page_SetFontAndSize( page, font, 32 ) HPDF_Page_SetRGBFill( page, 0.5, 0.5, 0.0 ) HPDF_Page_SetLineWidth( page, 1.5 ) @@ -843,23 +830,17 @@ STATIC FUNCTION Page_TextScaling( pdf ) HPDF_Page_SetRGBFill( page, 0, 0, 0 ) HPDF_Page_SetFontAndSize( page, font, 30 ) - - /* - * Rotating text - */ + /* Rotating text */ angle1 := 30 /* A rotation of 30 degrees. */ rad1 := angle1 / 180 * 3.141592 /* Calcurate the radian value. */ show_description( page, 320, ypos - 60, "Rotating text" ) HPDF_Page_BeginText( page ) - HPDF_Page_SetTextMatrix( page, Cos( rad1 ), Sin( rad1 ), - Sin( rad1 ), Cos( rad1 ), 330, ypos - 60 ) + HPDF_Page_SetTextMatrix( page, Cos( rad1 ), Sin( rad1 ), -Sin( rad1 ), Cos( rad1 ), 330, ypos - 60 ) HPDF_Page_ShowText( page, "ABCabc123" ) HPDF_Page_EndText( page ) - - /* - * Skewing text. - */ + /* Skewing text. */ show_description( page, 320, ypos - 120, "Skewing text" ) HPDF_Page_BeginText( page ) @@ -872,31 +853,21 @@ STATIC FUNCTION Page_TextScaling( pdf ) HPDF_Page_ShowText( page, "ABCabc123" ) HPDF_Page_EndText( page ) - - /* - * scaling text(X direction) - */ + /* scaling text(X direction) */ show_description( page, 320, ypos - 175, "Scaling text(X direction)" ) HPDF_Page_BeginText( page ) HPDF_Page_SetTextMatrix( page, 1.5, 0, 0, 1, 320, ypos - 175 ) HPDF_Page_ShowText( page, "ABCabc12" ) HPDF_Page_EndText( page ) - - /* - * scaling text(Y direction) - */ + /* scaling text(Y direction) */ show_description( page, 320, ypos - 250, "Scaling text(Y direction)" ) HPDF_Page_BeginText( page ) HPDF_Page_SetTextMatrix( page, 1, 0, 0, 2, 320, ypos - 250 ) HPDF_Page_ShowText( page, "ABCabc123" ) HPDF_Page_EndText( page ) - - /* - * char spacing, word spacing - */ - + /* char spacing, word spacing */ show_description( page, 60, 140, "char-spacing 0" ) show_description( page, 60, 100, "char-spacing 1.5" ) show_description( page, 60, 60, "char-spacing 1.5, word-spacing 2.5" ) @@ -923,32 +894,29 @@ STATIC FUNCTION Page_TextScaling( pdf ) HPDF_Page_TextOut( page, 60, 60, samp_text2 ) HPDF_Page_EndText( page ) - // HPDF_SetCompressionMode( pdf, nComp ) +#if 0 + HPDF_SetCompressionMode( pdf, nComp ) +#endif - RETURN NIL + RETURN -// +STATIC PROCEDURE show_stripe_pattern( page, x, y ) + LOCAL iy -STATIC FUNCTION show_stripe_pattern( page, x, y ) - LOCAL iy := 0 - - DO WHILE iy < 50 + FOR iy := 0 TO 50 STEP 3 HPDF_Page_SetRGBStroke( page, 0.0, 0.0, 0.5 ) HPDF_Page_SetLineWidth( page, 1 ) HPDF_Page_MoveTo( page, x, y + iy ) HPDF_Page_LineTo( page, x + HPDF_Page_TextWidth( page, "ABCabc123" ), y + iy ) HPDF_Page_Stroke( page ) - iy += 3 - ENDDO + NEXT HPDF_Page_SetLineWidth( page, 2.5 ) - RETURN NIL + RETURN -// - -STATIC FUNCTION show_description( page, x, y, text ) +STATIC PROCEDURE show_description( page, x, y, text ) LOCAL fsize := HPDF_Page_GetCurrentFontSize( page ) LOCAL font := HPDF_Page_GetCurrentFont( page ) @@ -964,9 +932,7 @@ STATIC FUNCTION show_description( page, x, y, text ) HPDF_Page_SetFontAndSize( page, font, fsize ) HPDF_Page_SetRGBFill( page, c[ 1 ], c[ 2 ], c[ 3 ] ) - RETURN NIL - -// + RETURN #define PAGE_WIDTH 420 #define PAGE_HEIGHT 400 @@ -1026,7 +992,9 @@ STATIC FUNCTION Page_CodePages( pdf ) dst := HPDF_Page_CreateDestination( page ) HPDF_Destination_SetXYZ( dst, 0, HPDF_Page_GetHeight( page ), 1 ) - /* HPDF_Destination_SetFitB(dst) */ +#if 0 + HPDF_Destination_SetFitB( dst ) +#endif HPDF_Outline_SetDestination( outline, dst ) HPDF_Page_SetFontAndSize( page, font, 15 ) @@ -1053,9 +1021,7 @@ STATIC FUNCTION Page_CodePages( pdf ) RETURN NIL -// - -STATIC FUNCTION draw_graph( page ) +STATIC PROCEDURE draw_graph( page ) LOCAL buf, i, x, y @@ -1065,9 +1031,9 @@ STATIC FUNCTION draw_graph( page ) HPDF_Page_SetLineWidth( page, 0.5 ) FOR i := 0 TO 17 - x := i * CELL_WIDTH + 40; + x := i * CELL_WIDTH + 40 - HPDF_Page_MoveTo( page, x, PAGE_HEIGHT - 60 ) + HPDF_Page_MoveTo( page, x, PAGE_HEIGHT - 60 ) HPDF_Page_LineTo( page, x, 40 ) HPDF_Page_Stroke( page ) @@ -1097,11 +1063,9 @@ STATIC FUNCTION draw_graph( page ) ENDIF NEXT - RETURN NIL + RETURN -// - -STATIC FUNCTION draw_fonts( page ) +STATIC PROCEDURE draw_fonts( page ) LOCAL i, j, buf, x, y, d @@ -1123,11 +1087,9 @@ STATIC FUNCTION draw_fonts( page ) HPDF_Page_EndText( page ) - RETURN NIL + RETURN -// - -STATIC FUNCTION Page_Graphics( pdf ) +STATIC PROCEDURE Page_Graphics( pdf ) LOCAL page, pos @@ -1138,7 +1100,9 @@ STATIC FUNCTION Page_Graphics( pdf ) HPDF_Page_SetWidth( page, 200 ) /* draw grid to the page */ - // print_grid( pdf, page ) +#if 0 + print_grid( pdf, page ) +#endif /* draw pie chart * @@ -1180,7 +1144,9 @@ STATIC FUNCTION Page_Graphics( pdf ) HPDF_Page_MoveTo( page, 100, 100 ) HPDF_Page_LineTo( page, pos[ 1 ], pos[ 2 ] ) HPDF_Page_Arc( page, 100, 100, 80, 360 * 0.85, 360 ) - // pos := HPDF_Page_GetCurrentPos( page ) +#if 0 + pos := HPDF_Page_GetCurrentPos( page ) +#endif HPDF_Page_LineTo( page, 100, 100 ) HPDF_Page_Fill( page ) @@ -1190,11 +1156,9 @@ STATIC FUNCTION Page_Graphics( pdf ) HPDF_Page_Circle( page, 100, 100, 30 ) HPDF_Page_Fill( page ) - RETURN NIL + RETURN -// - -STATIC FUNCTION Page_Annotation( pdf ) +STATIC PROCEDURE Page_Annotation( pdf ) LOCAL rect1 := { 50, 350, 150, 400 } LOCAL rect2 := { 210, 350, 350, 400 } @@ -1294,20 +1258,16 @@ STATIC FUNCTION Page_Annotation( pdf ) HPDF_Page_ShowText( page, "Text Icon(ISO8859-2 text)" ) HPDF_Page_EndText( page ) - RETURN NIL + RETURN -// -#define NULL NIL -// - -STATIC FUNCTION Page_Images( pdf ) +STATIC PROCEDURE Page_Images( pdf ) LOCAL font, page, dst, image, image1, image2, image3 LOCAL x, y, angle, angle1, angle2, rad, rad1, rad2, iw, ih - LOCAL cImagePath := "files" + hb_ps() + LOCAL cImagePath := hb_DirBase() + "files" + hb_ps() /* create default-font */ - font := HPDF_GetFont( pdf, "Helvetica", NULL ) + font := HPDF_GetFont( pdf, "Helvetica", NIL ) /* add a new page object. */ page := HPDF_AddPage( pdf ) @@ -1334,9 +1294,7 @@ STATIC FUNCTION Page_Images( pdf ) /* image2 is a mask image. */ image2 := HPDF_LoadPngImageFromFile( pdf, cImagePath + "basn0g01.png" ) - /* image3 is a RGB-color image. we use this image for color-mask - * demo. - */ + /* image3 is a RGB-color image. we use this image for color-mask demo. */ image3 := HPDF_LoadPngImageFromFile( pdf, cImagePath + "maskimag.png" ) iw := HPDF_Image_GetWidth( image ) @@ -1344,25 +1302,25 @@ STATIC FUNCTION Page_Images( pdf ) HPDF_Page_SetLineWidth( page, 0.5 ) x := 100 - y := HPDF_Page_GetHeight( page ) - 150; + y := HPDF_Page_GetHeight( page ) - 150 - /* Draw image to the canvas.(normal-mode with actual size.)*/ + /* Draw image to the canvas. (normal-mode with actual size.) */ HPDF_Page_DrawImage( page, image, x, y, iw, ih ) show_description_1( page, x, y, "Actual Size" ) x += 150 - /* Scalling image(X direction) */ + /* Scaling image(X direction) */ HPDF_Page_DrawImage( page, image, x, y, iw * 1.5, ih ) - show_description_1( page, x, y, "Scalling image(X direction)" ) + show_description_1( page, x, y, "Scaling image(X direction)" ) x += 150 - /* Scalling image(Y direction). */ + /* Scaling image(Y direction). */ HPDF_Page_DrawImage( page, image, x, y, iw, ih * 1.5 ) - show_description_1( page, x, y, "Scalling image(Y direction)" ) + show_description_1( page, x, y, "Scaling image(Y direction)" ) x := 100 y -= 120 @@ -1389,7 +1347,7 @@ STATIC FUNCTION Page_Images( pdf ) HPDF_Page_GSave( page ) HPDF_Page_Concat( page, iw * Cos( rad ), ; iw * Sin( rad ), ; - ih * - Sin( rad ), ; + ih * -Sin( rad ), ; ih * Cos( rad ), ; x, y ) HPDF_Page_ExecuteXObject( page, image ) @@ -1429,11 +1387,9 @@ STATIC FUNCTION Page_Images( pdf ) show_description_1( page, x, y, "Color Mask" ) - RETURN NIL + RETURN -// - -STATIC FUNCTION show_description_1( page, x, y, text ) +STATIC PROCEDURE show_description_1( page, x, y, text ) LOCAL buf @@ -1459,4 +1415,4 @@ STATIC FUNCTION show_description_1( page, x, y, text ) HPDF_Page_ShowText( page, text ) HPDF_Page_EndText( page ) - RETURN NIL + RETURN diff --git a/contrib/hbhttpd/readme.txt b/contrib/hbhttpd/readme.txt index 4e9e958063..f430ece0e3 100644 --- a/contrib/hbhttpd/readme.txt +++ b/contrib/hbhttpd/readme.txt @@ -1,6 +1,6 @@ Date: Fri, 12 Jun 2009 19:47:37 +0300 From: Mindaugas Kavaliauskas -To: "Harbour Project Main Developer List." +To: "Harbour Project Main Developer List." Subject: uhttpd v0.2 @@ -12,10 +12,10 @@ I want to share some more ideas (and code) about uhttpd development. All pro and cons, and any brainstorming is very welcome. Sources can be obtained from: -http://www.dbtopas.lt/hrb/uhttpd-0.2.zip +https://dbtopas.lt/hrb/uhttpd-0.2.zip You can test running demo application at (I'll try to keep it running -for some time): http://www.dbtopas.lt:8001/ +for some time): https://dbtopas.lt:8001/ I also want to add answer about one question. uhttpd support and @@ -143,26 +143,26 @@ Mounting table is hash, having this structure: oServer:hMount := { url => { handler, sessioned }, ... } URL can a single URL path, or path containing '*' wildchar in the end. Example: - /app/login - single URL match http://host/app/login - /files/* - the whole URL subtree from http://host/files/ - /* - the whole URL tree http://host/ + /app/login - single URL match https://host/app/login + /files/* - the whole URL subtree from https://host/files/ + /* - the whole URL tree https://host/ NOTE: '*' should be placed after '/' symbol to match URL subtree. Usage of '/files*' is invalid and do not match '/files1', '/filesa' or '/files/x'. The requested URL path is checked by deleting last slashed part until URL is found in mounting table. If no URL found in mounting table, 404 Not Found error is returned. -Example 1. If '/files/folder/aaa' is requested, '/files/folder/aaa', -'/files/folder/*', '/files/*', and '/*' will be checked before 404 +Example 1. If '/files/dir/aaa' is requested, '/files/dir/aaa', +'/files/dir/*', '/files/*', and '/*' will be checked before 404 error is returned. -Example 2. If '/files/folder/' is requested, '/files/folder/', -'/files/folder/*', '/files/*', and '/*' will be checked before 404 +Example 2. If '/files/dir/' is requested, '/files/dir/', +'/files/dir/*', '/files/*', and '/*' will be checked before 404 error is returned. NOTE 2: if you want to use a slash-less URL address as a synonym for -the folder you may need an extra redirection rule. Ex., +the directory you may need an extra redirection rule. Ex., "/files" => { {|| URedirect( "/files/" ) }, .F. } - "/files/*" => { {| x | UProcFiles(DocumentRoot + x ) }, .F. } + "/files/*" => { {| x | UProcFiles( DocumentRoot + x ) }, .F. } Widgets @@ -175,7 +175,7 @@ to use some objects (browse, etc.) instead of plain: UWrite('') DO WHILE ! Eof() UWrite( '' ) + hb_ntos( FIELD->AGE ) + '' ) dbSkip() ENDDO UWrite('
' + FIELD->NAME + '' + - Str( FIELD->AGE ) + '
') @@ -200,31 +200,33 @@ containing the mapping of URL subtree into handler functions. Ex., Page handler functions receives a parameter indicating received event/method. Handler has a structure: -STATIC FUNC proc_handler(cMethod) - IF cMethod == "INIT" +STATIC FUNCTION proc_handler( cMethod ) + DO CASE + CASE cMethod == "INIT" // This code is executed on entering URL (first call to this URL) // Here we open databases used to process queries - ELSEIF cMethod == "POST" + CASE cMethod == "POST" // Process HTTP POST request - ELSEIF cMethod == "GET" + CASE cMethod == "GET" // Process HTTP GET request - ELSEIF cMethod == "EXIT" + CASE cMethod == "EXIT" // This code is executed on leaving URL (before first call to // another URL) // Here we close databases opened in INIT method, etc. - ENDIF -RETURN .T. + ENDCASE + RETURN .T. As you can see this handler reminds the structure of traditional GUI based application message/event handler, for example in windows, we have: -STATIC FUNC WndProc( hWnd, uMsg, wParam, lParam ) - IF uMsg == WM_CREATE - ELSEIF uMsg == WM_PAINT - ELSEIF uMsg == WM_DESTROY - ENDIF -RETURN ... +STATIC FUNCTION WndProc( hWnd, uMsg, wParam, lParam ) + DO CASE + CASE uMsg == WM_CREATE + CASE uMsg == WM_PAINT + CASE uMsg == WM_DESTROY + ENDCASE + RETURN ... I hope this similarity will help to develop (or convert) event based GUI applications to web easier. @@ -279,7 +281,7 @@ items dialog, and items_edit_handler() function for item_edit dialog. PROCEDURE items_handler() ... - IF event = "edit button pressed" + IF event == "edit button pressed" dialog := create_new_modal_dialog() // create items_edit dialog dialog:handler := @items_edit_handler() process_event_loop() // until dialog is closed diff --git a/contrib/hbhttpd/widgets.prg b/contrib/hbhttpd/widgets.prg index 46deb3027d..934b50fb40 100644 --- a/contrib/hbhttpd/widgets.prg +++ b/contrib/hbhttpd/widgets.prg @@ -1,6 +1,4 @@ -/* - * Copyright 2009 Mindaugas Kavaliauskas - */ +/* Copyright 2009 Mindaugas Kavaliauskas */ #include "hbclass.ch" @@ -8,11 +6,11 @@ MEMVAR session, server, get, post -// ============================================================ +// --- CREATE CLASS UWMain - VAR aChilds INIT {} + VAR aChilds INIT {} METHOD Add( oWidget ) METHOD Paint() @@ -33,22 +31,22 @@ METHOD Paint() CLASS UWMain UWrite( '' ) UWrite( '' ) UWrite( '' ) - AEval( Self:aChilds, {| x | x:Paint() } ) + AEval( ::aChilds, {| x | x:Paint() } ) UWrite( '' ) RETURN Self METHOD Add( oWidget ) CLASS UWMain - AAdd( Self:aChilds, oWidget ) + AAdd( ::aChilds, oWidget ) RETURN Self -// ============================================================ +// --- CREATE CLASS UWLayoutGrid - VAR aChilds INIT { { {} } } // {{{}}, {{}}} ; {{{}, {}}} + VAR aChilds INIT { { {} } } // {{{}}, {{}}} ; {{{}, {}}} METHOD Add( oWidget, nRow, nCol ) METHOD Paint() @@ -56,17 +54,14 @@ CREATE CLASS UWLayoutGrid ENDCLASS FUNCTION UWLayoutGridNew() - - LOCAL oW := UWLayoutGrid() - - RETURN oW + RETURN UWLayoutGrid() METHOD Paint() CLASS UWLayoutGrid LOCAL aRow, aCell UWrite( '' ) - FOR EACH aRow IN Self:aChilds + FOR EACH aRow IN ::aChilds UWrite( '' ) FOR EACH aCell IN aRow UWrite( '' @@ -398,12 +384,12 @@ METHOD Output() CLASS UWBrowse NEXT cRet += '' dbSkip() - IF ++nPos >= Self:nPageSize + IF ++nPos >= ::nPageSize EXIT ENDIF ENDDO cRet += '
' ) @@ -83,29 +78,29 @@ METHOD Add( oWidget, nRow, nCol ) CLASS UWLayoutGrid LOCAL nI, nJ, aI - IF nRow > Len( Self:aChilds ) - FOR nI := Len( Self:aChilds ) + 1 TO nRow - aI := Array( Len( Self:aChilds[ 1 ] ) ) - FOR nJ := 1 TO Len( Self:aChilds[ 1 ] ) + IF nRow > Len( ::aChilds ) + FOR nI := Len( ::aChilds ) + 1 TO nRow + aI := Array( Len( ::aChilds[ 1 ] ) ) + FOR nJ := 1 TO Len( ::aChilds[ 1 ] ) aI[ nJ ] := {} NEXT - AAdd( Self:aChilds, aI ) + AAdd( ::aChilds, aI ) NEXT ENDIF - IF nCol > Len( Self:aChilds[ 1 ] ) - FOR nI := Len( Self:aChilds[ 1 ] ) + 1 TO nCol - AEval( Self:aChilds, {| x | AAdd( x, {} ) } ) + IF nCol > Len( ::aChilds[ 1 ] ) + FOR nI := Len( ::aChilds[ 1 ] ) + 1 TO nCol + AEval( ::aChilds, {| x | AAdd( x, {} ) } ) NEXT ENDIF - AAdd( Self:aChilds[ nRow, nCol ], oWidget ) + AAdd( ::aChilds[ nRow, nCol ], oWidget ) RETURN Self -// ============================================================ +// --- CREATE CLASS UWHtml - VAR cText + VAR cText METHOD Paint() @@ -121,17 +116,17 @@ FUNCTION UWHtmlNew( cText ) METHOD Paint() CLASS UWHtml - UWrite( Self:cText ) + UWrite( ::cText ) RETURN Self -// ============================================================ +// --- CREATE CLASS UWLabel - VAR cText - VAR cID - VAR cStyle + VAR cText + VAR cID + VAR cStyle METHOD Paint() @@ -149,19 +144,19 @@ FUNCTION UWLabelNew( cText, cID, cStyle ) METHOD Paint() CLASS UWLabel - UWrite( '' + ; - UHtmlEncode( Self:cText ) + '' ) + UWrite( '' + ; + UHtmlEncode( ::cText ) + '' ) RETURN Self -// ============================================================ +// --- CREATE CLASS UWForm - VAR cAction - VAR cMethod INIT "POST" - VAR aChilds INIT {} + VAR cAction + VAR cMethod INIT "POST" + VAR aChilds INIT {} METHOD Add( oWidget ) METHOD Paint() @@ -178,26 +173,26 @@ FUNCTION UWFormNew( cAction ) METHOD Add( oWidget ) CLASS UWForm - AAdd( Self:aChilds, oWidget ) + AAdd( ::aChilds, oWidget ) RETURN Self METHOD Paint() CLASS UWForm - UWrite( '
' ) - AEval( Self:aChilds, {| x | x:Paint() } ) + UWrite( '' ) + AEval( ::aChilds, {| x | x:Paint() } ) UWrite( '
' ) RETURN Self -// ============================================================ +// --- CREATE CLASS UWInput - VAR cName - VAR cValue - VAR cID - VAR cStyle + VAR cName + VAR cValue + VAR cID + VAR cStyle METHOD Paint() @@ -216,17 +211,17 @@ FUNCTION UWInputNew( cName, cValue, cID, cStyle ) METHOD Paint() CLASS UWInput - UWrite( '' ) + UWrite( '' ) RETURN Self -// ============================================================ +// --- CREATE CLASS UWPassword - VAR cName - VAR cValue + VAR cName + VAR cValue METHOD Paint() @@ -242,17 +237,17 @@ FUNCTION UWPasswordNew( cName ) METHOD Paint() CLASS UWPassword - UWrite( '' ) + UWrite( '' ) RETURN Self -// ============================================================ +// --- CREATE CLASS UWSubmit - VAR cName - VAR cValue + VAR cName + VAR cValue METHOD Paint() @@ -269,12 +264,12 @@ FUNCTION UWSubmitNew( cName, cValue ) METHOD Paint() CLASS UWSubmit - UWrite( '' ) + UWrite( '' ) RETURN Self -// ============================================================ +// --- CREATE CLASS UWSeparator @@ -283,10 +278,7 @@ CREATE CLASS UWSeparator ENDCLASS FUNCTION UWSeparatorNew() - - LOCAL oW := UWSeparator() - - RETURN oW + RETURN UWSeparator() METHOD Paint() CLASS UWSeparator @@ -294,11 +286,11 @@ METHOD Paint() CLASS UWSeparator RETURN Self -// ============================================================ +// --- CREATE CLASS UWMenu - VAR aItems INIT {} + VAR aItems INIT {} METHOD AddItem( cTitle, cLink ) METHOD Paint() @@ -306,14 +298,11 @@ CREATE CLASS UWMenu ENDCLASS FUNCTION UWMenuNew() - - LOCAL oB := UWMenu() - - RETURN oB + RETURN UWMenu() METHOD AddItem( cTitle, cLink ) CLASS UWMenu - AAdd( Self:aItems, { cTitle, cLink } ) + AAdd( ::aItems, { cTitle, cLink } ) RETURN Self @@ -332,7 +321,7 @@ METHOD Paint() CLASS UWMenu RETURN Self -// ============================================================ +// --- CREATE CLASS UWBrowse @@ -345,15 +334,12 @@ CREATE CLASS UWBrowse ENDCLASS -FUNC UWBrowseNew() - - LOCAL oW := UWBrowse() - - RETURN oW +FUNCTION UWBrowseNew() + RETURN UWBrowse() METHOD AddColumn( nID, cTitle, cField, lRaw ) CLASS UWBrowse - AAdd( Self:aColumns, { nID, cTitle, cField, ! Empty( lRaw ) } ) + AAdd( ::aColumns, { nID, cTitle, cField, ! Empty( lRaw ) } ) RETURN Self @@ -373,8 +359,8 @@ METHOD Output() CLASS UWBrowse // Body nPos := 0 dbGoTop() - IF Self:nPageSize > 0 .AND. Self:nPos > 0 - dbSkip( Self:nPos ) + IF ::nPageSize > 0 .AND. ::nPos > 0 + dbSkip( ::nPos ) ENDIF DO WHILE ! Eof() cRet += '
' - IF ! Eof() .OR. Self:nPos > 0 + IF ! Eof() .OR. ::nPos > 0 cUrl := server[ "REQUEST_URI" ] IF ( nI := At( "?_ucs=", cUrl ) ) == 0 nI := At( "&_ucs=", cUrl ) @@ -420,18 +406,18 @@ METHOD Output() CLASS UWBrowse cUrl += iif( "?" $ cUrl, "&", "?" ) + "_pos=" cRet := '
' + cRet IF ! Eof() - cI := cUrl + hb_ntos( Self:nPos + Self:nPageSize ) + cI := cUrl + hb_ntos( ::nPos + ::nPageSize ) cRet := '>>' + cRet ENDIF - IF Self:nPos > 0 - cI := cUrl + hb_ntos( Max( 0, Self:nPos - Self:nPageSize ) ) + IF ::nPos > 0 + cI := cUrl + hb_ntos( Max( 0, ::nPos - ::nPageSize ) ) cRet := '<<  ' + cRet ENDIF ENDIF RETURN cRet -// ============================================================ +// --- CREATE CLASS UWOption @@ -443,15 +429,12 @@ CREATE CLASS UWOption ENDCLASS -FUNC UWOptionNew() - - LOCAL oW := UWOption() - - RETURN oW +FUNCTION UWOptionNew() + RETURN UWOption() METHOD Add( cTitle, cCode, lRaw ) CLASS UWOption - AAdd( Self:aOption, { iif( ! Empty( lRaw ), cTitle, UHtmlEncode( cTitle ) ), cCode } ) + AAdd( ::aOption, { iif( Empty( lRaw ), UHtmlEncode( cTitle ), cTitle ), cCode } ) RETURN Self @@ -459,15 +442,11 @@ METHOD Output() CLASS UWOption LOCAL cRet := "" - AEval( Self:aOption, {| X | cRet += hb_StrFormat( '', UHtmlEncode( X[ 2 ] ), iif( X[ 2 ] == Self:cValue, " selected", "" ), X[ 1 ] ) } ) + AEval( ::aOption, {| X | cRet += hb_StrFormat( '', UHtmlEncode( X[ 2 ] ), iif( X[ 2 ] == ::cValue, " selected", "" ), X[ 1 ] ) } ) RETURN cRet -/******************************************************************** -* -* Default procedure handlers -* -********************************************************************/ +/* Default procedure handlers */ PROCEDURE UProcWidgets( cURL, aMap ) @@ -523,11 +502,12 @@ PROCEDURE UProcWidgets( cURL, aMap ) IF lRet session[ "_uthis" ] := ATail( aStack )[ 3 ] - IF server[ "REQUEST_METHOD" ] == "GET" + DO CASE + CASE server[ "REQUEST_METHOD" ] == "GET" Eval( ATail( aStack )[ 2 ], "GET" ) - ELSEIF server[ "REQUEST_METHOD" ] == "POST" + CASE server[ "REQUEST_METHOD" ] == "POST" Eval( ATail( aStack )[ 2 ], "POST" ) - ENDIF + ENDCASE ATail( aStack )[ 3 ] := session[ "_uthis" ] session[ "_uthis" ] := NIL ENDIF @@ -564,7 +544,6 @@ STATIC PROCEDURE SetWId( oW, cID ) RETURN FUNCTION UGetWidgetById( cID ) - RETURN hb_HGetDef( session[ "_uthis", "idhash" ], cID ) STATIC FUNCTION uhttpd_split( cSeparator, cString ) diff --git a/contrib/hblzf/core.c b/contrib/hblzf/core.c index 3fd6193d40..3223aba13b 100644 --- a/contrib/hblzf/core.c +++ b/contrib/hblzf/core.c @@ -81,7 +81,7 @@ HB_FUNC( HB_LZF_VERSION ) hb_retni( LZF_VERSION ); } -/* Return if lzf was optimized for speed (or for compression) */ +/* Return if LZF was optimized for speed (or for compression) */ HB_FUNC( HB_LZF_OPTIMIZED_FOR_SPEED ) { #if ULTRA_FAST @@ -224,7 +224,7 @@ HB_FUNC( HB_LZF_DECOMPRESS ) } } else - hb_storni( ( buffer_size ) ? HB_LZF_BUF_ERROR : HB_LZF_MEM_ERROR, 3 ); + hb_storni( buffer_size ? HB_LZF_BUF_ERROR : HB_LZF_MEM_ERROR, 3 ); } else { diff --git a/contrib/hbmagic/hbmagic.ch b/contrib/hbmagic/hbmagic.ch index 7fd094913c..02a0330c6e 100644 --- a/contrib/hbmagic/hbmagic.ch +++ b/contrib/hbmagic/hbmagic.ch @@ -56,7 +56,7 @@ #define MAGIC_NO_CHECK_ASCII MAGIC_NO_CHECK_TEXT /* Defined for backwards compatibility; do nothing */ -#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */ -#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */ +#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ASCII/fortran */ +#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ASCII/troff */ #endif /* HBMAGIC_CH_ */ diff --git a/contrib/hbmemio/memio.c b/contrib/hbmemio/memio.c index df1d77f23f..bd53ef9180 100644 --- a/contrib/hbmemio/memio.c +++ b/contrib/hbmemio/memio.c @@ -1,6 +1,6 @@ /* * Memory file system - * I/O driver for Memory file system + * I/O driver for Memory file system * * Copyright 2009 Mindaugas Kavaliauskas * @@ -58,11 +58,7 @@ #include "directry.ch" -/****************************************************** - * - * Memory file system - * - *******************************************************/ +/* -- Memory file system --- */ /* change this define for public hb_memfs*() API */ #ifdef HB_MEMFS_PUBLIC_API @@ -171,13 +167,15 @@ static void memfsInit( void ) /* Note: returns 1 based index! */ static HB_ULONG memfsInodeFind( const char * szName, HB_ULONG * pulPos ) { - HB_ULONG ulLeft, ulRight, ulMiddle; - int i; + HB_ULONG ulLeft, ulRight; ulLeft = 0; ulRight = s_fs.ulInodeCount; while( ulLeft < ulRight ) { + HB_ULONG ulMiddle; + int i; + ulMiddle = ( ulLeft + ulRight ) >> 1; i = strcmp( szName, s_fs.pInodes[ ulMiddle ]->szName ); if( i == 0 ) @@ -255,7 +253,9 @@ static PHB_MEMFS_FILE memfsHandleToFile( HB_FHANDLE hFile ) { if( hFile == FS_ERROR || ( HB_ULONG ) hFile == 0 || ( HB_ULONG ) hFile > s_fs.ulFileAlloc || s_fs.pFiles[ ( HB_ULONG ) hFile - 1 ] == NULL ) { - /* hb_errInternal( 9999, "memfsHandleToFile: Invalid file handle", NULL, NULL ); */ +#if 0 + hb_errInternal( 9999, "memfsHandleToFile: Invalid file handle", NULL, NULL ); +#endif return NULL; } else @@ -298,7 +298,7 @@ static HB_FHANDLE memfsHandleAlloc( PHB_MEMFS_FILE pFile ) } -/* ======== Public Memory FS functions ======== */ +/* --- Public Memory FS functions --- */ HB_MEMFS_EXPORT HB_ERRCODE hb_memfsError( void ) { @@ -651,7 +651,6 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsTruncAt( HB_FHANDLE hFile, HB_FOFFSET llOffset ) { PHB_MEMFS_FILE pFile; PHB_MEMFS_INODE pInode; - HB_FOFFSET llNewAlloc; if( ( pFile = memfsHandleToFile( hFile ) ) == NULL ) return HB_FALSE; /* invalid handle */ @@ -668,7 +667,7 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsTruncAt( HB_FHANDLE hFile, HB_FOFFSET llOffset ) /* Reallocate if neccesary */ if( pInode->llAlloc < llOffset ) { - llNewAlloc = pInode->llAlloc + ( pInode->llAlloc >> 1 ); + HB_FOFFSET llNewAlloc = pInode->llAlloc + ( pInode->llAlloc >> 1 ); if( llNewAlloc < llOffset ) llNewAlloc = llOffset; @@ -768,11 +767,7 @@ HB_MEMFS_EXPORT int hb_memfsLockTest( HB_FHANDLE hFile, HB_FOFFSET ulStart, HB_F return 0; } -/****************************************************** - * - * I/O Driver for Memory file system - * - *******************************************************/ +/* --- I/O Driver for Memory file system --- */ #define FILE_PREFIX "MEM:" #define FILE_PREFIX_LEN strlen( FILE_PREFIX ) @@ -950,7 +945,6 @@ static PHB_FILE s_fileOpen( PHB_FILE_FUNCS pFuncs, const char * szName, HB_FHANDLE hFile; char szNameNew[ HB_PATH_MAX ]; HB_USHORT uiFlags; - HB_SIZE nLen; HB_SYMBOL_UNUSED( pFuncs ); HB_SYMBOL_UNUSED( pPaths ); @@ -960,7 +954,7 @@ static PHB_FILE s_fileOpen( PHB_FILE_FUNCS pFuncs, const char * szName, if( szDefExt ) { - nLen = strlen( szNameNew ); + HB_SIZE nLen = strlen( szNameNew ); do { if( nLen == 0 || strchr( HB_OS_PATH_DELIM_CHR_LIST, szNameNew[ nLen - 1 ] ) ) diff --git a/contrib/hbmisc/bbabble.c b/contrib/hbmisc/bbabble.c index 2eefb8df5a..d74150f903 100644 --- a/contrib/hbmisc/bbabble.c +++ b/contrib/hbmisc/bbabble.c @@ -46,11 +46,10 @@ #include "hbapi.h" -/* - Algorithm: +/* Algorithm: http://wiki.yak.net/589/Bubble_Babble_Encoding.txt Implementation based on this code: - http://www.nitrxgen.net/source/bubblebabble.txt + [LOST LINK] www.nitrxgen.net/source/bubblebabble.txt */ HB_FUNC( BUBBLEBABBLEENCODE ) @@ -65,15 +64,15 @@ HB_FUNC( BUBBLEBABBLEENCODE ) HB_ISIZ nPos = 0; HB_ISIZ i; - HB_BYTE byte1; - HB_BYTE byte2; - int iSeed = 1; pszResult[ nPos++ ] = 'x'; for( i = 0;; i += 2 ) { + HB_BYTE byte1; + HB_BYTE byte2; + if( i >= nInputLen ) { pszResult[ nPos++ ] = s_szVowels[ iSeed % 6 ]; diff --git a/contrib/hbmisc/calldll.prg b/contrib/hbmisc/calldll.prg index ee607bbbf9..a3e0b35b33 100644 --- a/contrib/hbmisc/calldll.prg +++ b/contrib/hbmisc/calldll.prg @@ -64,9 +64,9 @@ FUNCTION CallDll32( cFunction, cLibrary, ... ) /* Use Windows system .dll calling convention on Windows systems, like in original lib. Original .lib was a Windows-only solution. [vszakats] */ -# define _DEF_CALLCONV_ HB_DYN_CALLCONV_STDCALL + #define _DEF_CALLCONV_ HB_DYN_CALLCONV_STDCALL #else -# define _DEF_CALLCONV_ HB_DYN_CALLCONV_CDECL + #define _DEF_CALLCONV_ HB_DYN_CALLCONV_CDECL #endif FUNCTION hb_DynaCall1( cFunction, cLibrary, nCount, ... ) @@ -79,7 +79,7 @@ FUNCTION hb_DynaCall1( cFunction, cLibrary, nCount, ... ) hb_mutexLock( s_mutex ) - IF !( cLibrary $ s_hDLL ) + IF ! cLibrary $ s_hDLL s_hDLL[ cLibrary ] := hb_libLoad( cLibrary ) ENDIF diff --git a/contrib/hbmisc/dates.c b/contrib/hbmisc/dates.c index 9711e09912..60ef26d9bc 100644 --- a/contrib/hbmisc/dates.c +++ b/contrib/hbmisc/dates.c @@ -2,6 +2,7 @@ * Additional date functions * * Copyright 1999 Jose Lalin + * Copyright 1999 Jon Berg (DateTime()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Jon Berg - * DateTime() - * - * See COPYING.txt for licensing terms. - * - */ - #include #include "hbapi.h" @@ -62,7 +53,7 @@ #include "hbdate.h" static const int s_daysinmonth[ 12 ] = -{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static HB_BOOL hb_isleapyear( int iYear ) { @@ -89,7 +80,7 @@ static int hb_doy( int iYear, int iMonth, int iDay ) HB_TRACE( HB_TR_DEBUG, ( "hb_doy(%d, %d, %d)", iYear, iMonth, iDay ) ); - for( i = 1; i < iMonth; i++ ) + for( i = 1; i < iMonth; ++i ) iDoy += hb_daysinmonth( iYear, i ); return iDoy + iDay; @@ -112,10 +103,10 @@ static int hb_woy( long lDate, HB_BOOL fISO ) HB_FUNC( AMONTHS ) { - PHB_ITEM pReturn = hb_itemArrayNew( 12 ); /* Create array */ + PHB_ITEM pReturn = hb_itemArrayNew( 12 ); /* Create array */ int i; - for( i = 0; i < 12; i++ ) + for( i = 0; i < 12; ++i ) hb_arraySetC( pReturn, i + 1, hb_langDGetItem( HB_LANG_ITEM_BASE_MONTH + i ) ); hb_itemReturnRelease( pReturn ); @@ -123,10 +114,10 @@ HB_FUNC( AMONTHS ) HB_FUNC( ADAYS ) { - PHB_ITEM pReturn = hb_itemArrayNew( 7 ); /* Create array */ + PHB_ITEM pReturn = hb_itemArrayNew( 7 ); /* Create array */ int i; - for( i = 0; i < 7; i++ ) + for( i = 0; i < 7; ++i ) hb_arraySetC( pReturn, i + 1, hb_langDGetItem( HB_LANG_ITEM_BASE_DAY + i ) ); hb_itemReturnRelease( pReturn ); diff --git a/contrib/hbmisc/fcomma.prg b/contrib/hbmisc/fcomma.prg index c705281de9..0d97aaaebd 100644 --- a/contrib/hbmisc/fcomma.prg +++ b/contrib/hbmisc/fcomma.prg @@ -64,8 +64,8 @@ ANNOUNCE FCOMMA /* * 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 FCM_INIT( nRDD ) @@ -81,8 +81,8 @@ STATIC FUNCTION FCM_INIT( nRDD ) * 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 FCM_NEW( pWA ) @@ -337,22 +337,22 @@ FUNCTION FCOMMA_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) LOCAL cSuperRDD := NIL /* NO SUPER RDD */ LOCAL aMyFunc[ UR_METHODCOUNT ] - aMyFunc[ UR_INIT ] := ( @FCM_INIT() ) - aMyFunc[ UR_NEW ] := ( @FCM_NEW() ) - aMyFunc[ UR_CREATE ] := ( @FCM_CREATE() ) - aMyFunc[ UR_OPEN ] := ( @FCM_OPEN() ) - aMyFunc[ UR_CLOSE ] := ( @FCM_CLOSE() ) - aMyFunc[ UR_BOF ] := ( @FCM_Bof() ) - aMyFunc[ UR_EOF ] := ( @FCM_EOF() ) - aMyFunc[ UR_DELETED ] := ( @FCM_DELETED() ) - aMyFunc[ UR_SKIPRAW ] := ( @FCM_SKIPRAW() ) - aMyFunc[ UR_GOTO ] := ( @FCM_GOTO() ) - aMyFunc[ UR_GOTOID ] := ( @FCM_GOTOID() ) - aMyFunc[ UR_GOTOP ] := ( @FCM_GOTOP() ) - aMyFunc[ UR_GOBOTTOM ] := ( @FCM_GOBOTTOM() ) - aMyFunc[ UR_RECID ] := ( @FCM_RECID() ) - aMyFunc[ UR_RECCOUNT ] := ( @FCM_RECCOUNT() ) - aMyFunc[ UR_GETVALUE ] := ( @FCM_GETVALUE() ) + aMyFunc[ UR_INIT ] := @FCM_INIT() + aMyFunc[ UR_NEW ] := @FCM_NEW() + aMyFunc[ UR_CREATE ] := @FCM_CREATE() + aMyFunc[ UR_OPEN ] := @FCM_OPEN() + aMyFunc[ UR_CLOSE ] := @FCM_CLOSE() + aMyFunc[ UR_BOF ] := @FCM_Bof() + aMyFunc[ UR_EOF ] := @FCM_EOF() + aMyFunc[ UR_DELETED ] := @FCM_DELETED() + aMyFunc[ UR_SKIPRAW ] := @FCM_SKIPRAW() + aMyFunc[ UR_GOTO ] := @FCM_GOTO() + aMyFunc[ UR_GOTOID ] := @FCM_GOTOID() + aMyFunc[ UR_GOTOP ] := @FCM_GOTOP() + aMyFunc[ UR_GOBOTTOM ] := @FCM_GOBOTTOM() + aMyFunc[ UR_RECID ] := @FCM_RECID() + aMyFunc[ UR_RECCOUNT ] := @FCM_RECCOUNT() + aMyFunc[ UR_GETVALUE ] := @FCM_GETVALUE() RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; cSuperRDD, aMyFunc ) diff --git a/contrib/hbmisc/hbedit.prg b/contrib/hbmisc/hbedit.prg index 2349b8975c..90b69d5e90 100644 --- a/contrib/hbmisc/hbedit.prg +++ b/contrib/hbmisc/hbedit.prg @@ -1,6 +1,4 @@ -/* - * Copyright 1999 Ryszard Glab - */ +/* Copyright 1999 Ryszard Glab */ #include "inkey.ch" #include "setcurs.ch" @@ -9,14 +7,14 @@ #define EDIT_LOWER 0 // convert to lowercase #define EDIT_UPPER 1 // convert to uppercase -#define EDIT_SAME 2 // no convertion +#define EDIT_SAME 2 // no conversion -#define EDIT_HARD 13 // hard cariage +#define EDIT_HARD 13 // hard carriage #define EDIT_EDIT .T. // full edit mode #define EDIT_VIEW .F. // view only mode -// The editor structure +// The editor structure // #define E_EDIT 1 // pointer returned be ED_NEW #define E_TOP 2 // position on the screen @@ -34,17 +32,16 @@ THREAD STATIC t_nESize := 4096 // default buffer size -// // 1993-03-06 19:52 // // nTop, nLeft, nBottom, nRight - position on the screen // nLength - the line length -// cFrame - the frame to be drawed around the editor +// cFrame - the frame to be drawn around the editor // cTitle - comment displayed in upper, left corner // cColor - colors used to draw the editor // nSize - the size of memory buffer that holds the edited text - the buffer // will not grow at current design -// nEscape - the character code used as a marker of color highlighing +// nEscape - the character code used as a marker of color highlighting // For example if its value is 126 '~' then the following text: // normal text ~2text in bold~1 back to normal text // will be displayed with 'text in bold' highlighted using the second diff --git a/contrib/hbmisc/hbeditc.c b/contrib/hbmisc/hbeditc.c index 7bc2db59f6..1f8cc6f961 100644 --- a/contrib/hbmisc/hbeditc.c +++ b/contrib/hbmisc/hbeditc.c @@ -1,25 +1,22 @@ -/* - * Copyright 1999 Ryszard Glab - */ +/* Copyright 1999 Ryszard Glab */ + +/* Known bugs: -/* - Known bugs: - ---------- 1) It requires files separated with CR/LF pairs 2) NextWord() doesn't work correctly 3) If text contains color escape codes then deleting or inserting - of characters doesn't work correctly in the line that contains it + of characters doesn't work correctly in the line that contains it 4) Doesn't handle OS-specific EOL (only CRLG) 5) Unicode support - To fix: - ------ + FIXME: + 1) All TAB characters are replaced with spaces at startup - if edited file is - very large and contains many TABs then it can take a vary long time - TAB - characters should be left unchanged and interpreted during editing + very large and contains many TABs then it can take a vary long time - TAB + characters should be left unchanged and interpreted during editing 2) It reformats whole text at startup - again for a very long text it can - take too much time - 3) Text buffer shold be reallocated dynamically + take too much time + 3) Text buffer should be reallocated dynamically */ #include "hbapi.h" @@ -32,7 +29,6 @@ #define _MAX_LINE_LEN 4096 - typedef struct { int top; /* topmost row of editor's window */ @@ -50,9 +46,9 @@ typedef struct HB_ISIZ last_display; /* the offset of last visible line */ HB_ISIZ first_col; /* first visible column */ HB_BOOL fStable; /* is the editor stabilized? */ - int current_stabil; /* currently displayed row (during stabilisation) */ + int current_stabil; /* currently displayed row (during stabilization) */ int stabil; /* number of rows to stabilize */ - char escape; /* ASCII code of color escaspe character (the next character after this will be used as color index */ + char escape; /* ASCII code of color escape character (the next character after this will be used as color index */ HB_ISIZ next_stabil; /* the offset in memory buffer of next line to display */ int dir; /* the direction of line stabilization */ int tab_size; /* the number of spaces the replaces TAB character */ @@ -65,9 +61,6 @@ typedef struct } HB_EDITOR, * PHB_EDITOR; - - - static void KillText( PHB_EDITOR pEd ); static HB_ISIZ Clear( PHB_EDITOR pEd, HB_ISIZ e, HB_ISIZ * nEsc ); static void BackSpace( PHB_EDITOR pEd, HB_BOOL fInsert ); @@ -78,8 +71,6 @@ static HB_BOOL format_line( PHB_EDITOR pEd, char Karetka, HB_ISIZ LineDl ); static void MoveText( PHB_EDITOR pEd, HB_ISIZ source, HB_ISIZ dest, HB_ISIZ ilb ); static HB_ISIZ GetLineLength( PHB_EDITOR pEd, HB_ISIZ off, HB_ISIZ * wsk ); - - static HB_GARBAGE_FUNC( PHB_EDITOR_release ) { void ** ph = ( void ** ) Cargo; @@ -125,16 +116,13 @@ static PHB_EDITOR PHB_EDITOR_par( int iParam ) return ph ? ( PHB_EDITOR ) *ph : NULL; } - - -/* Find the beginning of previous line starting from given offset - */ +/* Find the beginning of previous line starting from given offset */ static HB_ISIZ Prev( PHB_EDITOR pEd, HB_ISIZ adres ) { - HB_ISIZ i; - if( adres > 0 ) { + HB_ISIZ i; + for( i = adres; i >= 0; i-- ) { if( pEd->begin[ i ] == '\n' ) @@ -149,8 +137,7 @@ static HB_ISIZ Prev( PHB_EDITOR pEd, HB_ISIZ adres ) return -1; } -/* Find the beginning of next line starting from given offset - */ +/* Find the beginning of next line starting from given offset */ static HB_ISIZ Next( PHB_EDITOR pEd, HB_ISIZ adres ) { char * tmp; @@ -163,8 +150,7 @@ static HB_ISIZ Next( PHB_EDITOR pEd, HB_ISIZ adres ) return -1; } -/* Initializes HB_EDITOR structure - */ +/* Initializes HB_EDITOR structure */ static void New( PHB_EDITOR pEd, int tab, HB_ISIZ ll, HB_ISIZ bufferSize ) { @@ -193,8 +179,6 @@ static void New( PHB_EDITOR pEd, int tab, HB_ISIZ ll, HB_ISIZ bufferSize ) } - - /* Creates new editor and returns index into internal editors table */ HB_FUNC( ED_NEW ) { @@ -221,27 +205,23 @@ HB_FUNC( ED_NEW ) PHB_EDITOR_ret( pEd ); } -/* Replaces TAB with spaces and removes spaces from the end of line - */ +/* Replaces TAB with spaces and removes spaces from the end of line */ static void FormatText( PHB_EDITOR pEd ) { - HB_ISIZ j; HB_ISIZ dl; char * wsk; int i; - HB_ISIZ nLen; HB_ISIZ nEsc; dl = pEd->current_line; pEd->current_line = pEd->last_line; /* TODO: remove this TAB replacement because it is time consuming - * operation if a very large file is edited - */ + operation if a very large file is edited */ wsk = pEd->begin + pEd->last_line; while( ( wsk = strchr( wsk, '\t' ) ) != 0 ) { - j = wsk - pEd->begin; + HB_ISIZ j = wsk - pEd->begin; MoveText( pEd, j, j + pEd->tab_size - 1, pEd->buffer_size - j - pEd->tab_size + 1 ); @@ -250,11 +230,12 @@ static void FormatText( PHB_EDITOR pEd ) *wsk = ' '; } - /* TODO: optimize this line formating - format line only if - * it will be displayed - */ + /* TODO: optimize this line formatting - format line only if + it will be displayed */ while( pEd->current_line >= 0 ) { + HB_ISIZ nLen; + pEd->last_line = pEd->current_line; pEd->line_number++; @@ -268,15 +249,13 @@ static void FormatText( PHB_EDITOR pEd ) pEd->first_col = 0; } -/* Resets the editor state after pasting new content of text buffer - */ +/* Resets the editor state after pasting new content of text buffer */ static void NewText( PHB_EDITOR pEd ) { HB_ISIZ dl; int i; - /* text in buffer have to end with CR/LF - */ + /* text in buffer have to end with CR/LF */ dl = pEd->text_length; if( pEd->begin[ dl - 1 ] != '\n' ) { @@ -301,8 +280,7 @@ static void NewText( PHB_EDITOR pEd ) pEd->last_display = Next( pEd, pEd->last_display ); } -/* Appends passed text to the existing text buffer - */ +/* Appends passed text to the existing text buffer */ static void AddText( PHB_EDITOR pEd, const char * adres ) { HB_ISIZ dl, dlold; @@ -310,14 +288,12 @@ static void AddText( PHB_EDITOR pEd, const char * adres ) dl = strlen( adres ); dlold = pEd->text_length; if( dlold == 2 ) - dlold = 0; /* if current text buffer contains CRLF only then discard it */ + dlold = 0; /* if current text buffer contains CRLF only then discard it */ - /* TODO: add reallocation of text buffer - */ + /* TODO: add reallocation of text buffer */ if( ( dl + dlold ) <= ( pEd->buffer_size - 10 ) ) { - /* there is enough room in text buffer - */ + /* there is enough room in text buffer */ hb_strncpy( pEd->begin + dlold, adres, dl ); pEd->text_length += dl; } @@ -327,7 +303,7 @@ static void AddText( PHB_EDITOR pEd, const char * adres ) pEd->text_length = pEd->buffer_size - 10; } - NewText( pEd ); /* reformat text */ + NewText( pEd ); /* reformat text */ } /* Appends passed text at the end of existing one */ @@ -341,8 +317,7 @@ HB_FUNC( ED_ADDTEXT ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Moves text from one location into another - */ +/* Moves text from one location into another */ static void MoveText( PHB_EDITOR pEd, HB_ISIZ source, HB_ISIZ dest, HB_ISIZ ilb ) { HB_ISIZ diff; @@ -368,8 +343,7 @@ static void MoveText( PHB_EDITOR pEd, HB_ISIZ source, HB_ISIZ dest, HB_ISIZ ilb } } -/* Skips to the beginning of given line - */ +/* Skips to the beginning of given line */ static HB_ISIZ GoToLine( PHB_EDITOR pEd, HB_ISIZ linia ) { char * p; @@ -386,11 +360,10 @@ static HB_ISIZ GoToLine( PHB_EDITOR pEd, HB_ISIZ linia ) return pEd->text_length; /* no such line number - go to the end */ } -/* Counts the number of printable characters in given line - */ +/* Counts the number of printable characters in given line */ static HB_ISIZ GetLineLength( PHB_EDITOR pEd, HB_ISIZ off, HB_ISIZ * wsk ) { - HB_ISIZ i, j; + HB_ISIZ i; char * p; char * tmp; @@ -405,9 +378,10 @@ static HB_ISIZ GetLineLength( PHB_EDITOR pEd, HB_ISIZ off, HB_ISIZ * wsk ) else i = strlen( tmp ); - *wsk = 0; /* number of characters used in color escape codes */ + *wsk = 0; /* number of characters used in color escape codes */ if( pEd->escape ) { + HB_ISIZ j; for( j = 0; j < i; j++ ) { if( tmp[ j ] == pEd->escape ) @@ -421,24 +395,21 @@ static HB_ISIZ GetLineLength( PHB_EDITOR pEd, HB_ISIZ off, HB_ISIZ * wsk ) return i - *wsk; /* number of all chars minus number of escape chars */ } -/* Inserts text into existing text buffer starting from given line number - */ +/* Inserts text into existing text buffer starting from given line number */ static HB_ISIZ InsText( PHB_EDITOR pEd, char * adres, HB_ISIZ line ) { - HB_ISIZ dl, off, il, dl1; - HB_BOOL addCRLF; - HB_ISIZ cc; + HB_ISIZ dl = strlen( adres ); /* length of text to insert */ + HB_ISIZ dl1 = pEd->text_length; /* length of text that is currently in the buffer */ - addCRLF = HB_FALSE; - dl = strlen( adres ); /* length of text to insert */ - dl1 = pEd->text_length; /* length of text that is currently in the buffer */ - - /* TODO: add reallocation of text buffer - */ + /* TODO: add reallocation of text buffer */ if( dl1 < ( pEd->buffer_size - 10 ) ) { - /* there is some free space in text buffer - */ + HB_BOOL addCRLF = HB_FALSE; + HB_ISIZ off, il; + HB_ISIZ cc; + + /* there is some free space in text buffer */ + /* Find the offset of given line */ if( line > 0 ) off = GoToLine( pEd, line ); /* Find the offset of given line */ @@ -447,13 +418,11 @@ static HB_ISIZ InsText( PHB_EDITOR pEd, char * adres, HB_ISIZ line ) if( ( dl + dl1 ) < ( pEd->buffer_size - 10 ) ) { - /* there is enough free room in text buffer - */ + /* there is enough free room in text buffer */ if( adres[ dl - 1 ] != '\n' && adres[ dl - 2 ] != '\r' ) { /* There is no CRLF at the end of inserted text - - * we have to add CRLF to separate it from existing text - */ + we have to add CRLF to separate it from existing text */ addCRLF = HB_TRUE; dl += 2; } @@ -463,8 +432,7 @@ static HB_ISIZ InsText( PHB_EDITOR pEd, char * adres, HB_ISIZ line ) else { /* not enough free space - * text at the end of existing text buffer will be lost - */ + text at the end of existing text buffer will be lost */ dl = pEd->buffer_size - 10 - dl1; if( adres[ dl - 1 ] == '\r' ) adres[ dl - 1 ] = ' '; @@ -529,10 +497,8 @@ HB_FUNC( ED_INSTEXT ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * Selects the editor as active - all next ED_*() calls will be send - * to this editor. - */ +/* Selects the editor as active - all next ED_*() calls will be send + to this editor. */ HB_FUNC( ED_CONFIG ) { PHB_EDITOR pEd = PHB_EDITOR_par( 1 ); @@ -540,9 +506,7 @@ HB_FUNC( ED_CONFIG ) if( pEd ) { int szer, wys; - int nszer, nwys; - int diff; - HB_ISIZ tmp; + int nwys; HB_ISIZ j; int top, left, bottom, right; @@ -570,13 +534,11 @@ HB_FUNC( ED_CONFIG ) if( pEd->fIsConfigured ) { /* In event driven world the position and size of the editor window can - * change between activations - recalculate some required values - */ + change between activations - recalculate some required values */ pEd->first_display = pEd->current_line; /* find the first line to display - try to keep visible the current line - * and display this line in the same row in the window (if possible) - */ + and display this line in the same row in the window (if possible) */ for( i = 0; i < pEd->cursor_row; i++ ) { j = Prev( pEd, pEd->first_display ); @@ -619,6 +581,9 @@ HB_FUNC( ED_CONFIG ) if( pEd->fIsConfigured ) { + int nszer; + int diff; + nszer = pEd->right - pEd->left + 1; nwys = pEd->bottom - pEd->top + 1; @@ -626,8 +591,7 @@ HB_FUNC( ED_CONFIG ) if( szer < nszer ) { /* current width of the window is greater then during previous activation - * adjust the first visible column - */ + adjust the first visible column */ if( pEd->first_col > diff ) { pEd->first_col -= diff; @@ -639,8 +603,7 @@ HB_FUNC( ED_CONFIG ) pEd->first_col = 0; } } - if( szer > nszer ) /* current width of the window is smaller then during previous activation - */ + if( szer > nszer ) /* current width of the window is smaller then during previous activation */ { if( pEd->cursor_col > ( nszer - 1 ) ) { @@ -652,12 +615,11 @@ HB_FUNC( ED_CONFIG ) diff = abs( nwys - wys ); if( wys > nwys ) { - /* current height of the window is smaller then during previous activation - */ + HB_ISIZ tmp; + /* current height of the window is smaller then during previous activation */ if( pEd->cursor_row < nwys ) { - /* the old cursor row position is smaller then the window height - */ + /* the old cursor row position is smaller then the window height */ tmp = pEd->last_display; for( i = 0; i < diff; i++ ) { @@ -671,9 +633,8 @@ HB_FUNC( ED_CONFIG ) else { /* old cursor row position is greater then current window height - * display the line where the cursor is placed as the last visible - * line in the window - */ + display the line where the cursor is placed as the last visible + line in the window */ pEd->last_display = pEd->current_line; tmp = pEd->last_display; @@ -747,10 +708,8 @@ HB_FUNC( ED_GETLINE ) if( pEd ) { - HB_ISIZ l, j; + HB_ISIZ l; HB_ISIZ tmp; - HB_ISIZ dl; - HB_ISIZ rdl; HB_ISIZ i; HB_ISIZ linia = hb_parns( 2 ); @@ -759,7 +718,7 @@ HB_FUNC( ED_GETLINE ) tmp = pEd->first_line; for( i = 1; i < linia; i++ ) { - j = Next( pEd, tmp ); + HB_ISIZ j = Next( pEd, tmp ); if( j >= 0 ) { tmp = j; @@ -769,6 +728,9 @@ HB_FUNC( ED_GETLINE ) if( l == linia ) { + HB_ISIZ dl; + HB_ISIZ rdl; + dl = GetLineLength( pEd, tmp, &rdl ); hb_retclen( pEd->begin + tmp, dl ); @@ -789,11 +751,11 @@ HB_FUNC( ED_GETNEXT ) if( pEd ) { - HB_ISIZ rdl; - HB_ISIZ dl; - if( pEd->next_line > 0 ) { + HB_ISIZ rdl; + HB_ISIZ dl; + dl = GetLineLength( pEd, pEd->next_line, &rdl ); hb_retclen( pEd->begin + pEd->next_line, dl ); @@ -807,8 +769,7 @@ HB_FUNC( ED_GETNEXT ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Resets text buffer - */ +/* Resets text buffer */ static void KillText( PHB_EDITOR pEd ) { memset( pEd->begin, '\0', pEd->buffer_size ); @@ -875,30 +836,27 @@ HB_FUNC( ED_READTEXT ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * Stabilize the editor - * Redisplays all requested lines - * It is simmilar to TBrowse:forceStable() - * Incremental stabilisation was too slow - */ +/* Stabilize the editor + Redisplays all requested lines + It is similar to TBrowse:forceStable() + Incremental stabilization was too slow */ HB_FUNC( ED_STABILIZE ) { PHB_EDITOR pEd = PHB_EDITOR_par( 1 ); if( pEd ) { - int nLeft, nTop; int nRow = 0; - HB_ISIZ nEscLen, nLen, width, i, j, e; + int nLeft, nTop; + HB_ISIZ nEscLen, nLen, i, j, e; char * EscPtr; char * cPtr; char adres[ _MAX_LINE_LEN + 2 ]; while( --pEd->stabil >= 0 ) { - /* there are some lines of text to display - */ - width = pEd->right - pEd->left + 1; + /* there are some lines of text to display */ + HB_ISIZ width = pEd->right - pEd->left + 1; if( pEd->next_stabil >= 0 ) { @@ -906,13 +864,12 @@ HB_FUNC( ED_STABILIZE ) for( nEscLen = nLen = 0; *cPtr && *cPtr != '\n'; cPtr++ ) { /* copy the line into temporary buffer - count characters used - * as color escape codes - */ + as color escape codes */ adres[ nLen++ ] = *cPtr; if( pEd->escape && *cPtr == pEd->escape ) nEscLen += 2; } - j = nLen - nEscLen; /* length of printable text */ + j = nLen - nEscLen; /* length of printable text */ adres[ nLen ] = '\0'; if( pEd->first_col >= j ) @@ -921,10 +878,9 @@ HB_FUNC( ED_STABILIZE ) else if( pEd->first_col ) { /* text is scrolled right - we need to find the first - * color escape code that will be visible - * text ~2 in bold ~1 in normal - * ^-first visible column - */ + color escape code that will be visible + text ~2 in bold ~1 in normal + ^-first visible column */ e = 0; i = 0; if( pEd->escape ) @@ -944,7 +900,10 @@ HB_FUNC( ED_STABILIZE ) { nLen -= ( i - 2 ); if( adres[ i - 1 ] == pEd->escape ) - i++, nLen--; + { + i++; + nLen--; + } hb_strncpy( adres + 2, adres + i, nLen - 2 ); nEscLen -= ( e - 2 ); } @@ -958,7 +917,7 @@ HB_FUNC( ED_STABILIZE ) if( nLen ) { - if( adres[ nLen - 1 ] & '\xd' ) /* soft or hard carriage */ + if( adres[ nLen - 1 ] & '\xd' ) /* soft or hard carriage */ adres[ --nLen ] = '\0'; } @@ -976,7 +935,7 @@ HB_FUNC( ED_STABILIZE ) break; } - hb_gtColorSelect( 0 ); /* select default color */ + hb_gtColorSelect( 0 ); /* select default color */ nTop = pEd->top + nRow; if( nLen ) @@ -1007,8 +966,7 @@ HB_FUNC( ED_STABILIZE ) } else { - /* no more lines of text to display - fill the window with spaces - */ + /* no more lines of text to display - fill the window with spaces */ switch( pEd->dir ) { case _STABILIZE_DOWN: @@ -1034,8 +992,7 @@ HB_FUNC( ED_STABILIZE ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Removes trailing spaces from the end of line - */ +/* Removes trailing spaces from the end of line */ static HB_ISIZ Clear( PHB_EDITOR pEd, HB_ISIZ e, HB_ISIZ * nEsc ) { HB_ISIZ nLen, i; @@ -1061,8 +1018,7 @@ static HB_ISIZ Clear( PHB_EDITOR pEd, HB_ISIZ e, HB_ISIZ * nEsc ) return nLen; } -/* Moves the cursor to the next line of text - */ +/* Moves the cursor to the next line of text */ static void Down( PHB_EDITOR pEd ) { HB_ISIZ j; @@ -1087,8 +1043,7 @@ static void Down( PHB_EDITOR pEd ) if( ( ( ++pEd->cursor_row ) + pEd->top ) > pEd->bottom ) { - /* attempt to move to the line that was not visible yet - */ + /* attempt to move to the line that was not visible yet */ pEd->stabil = 1; /* only one line needs to be redisplayed */ pEd->cursor_row = pEd->bottom - pEd->top; @@ -1113,7 +1068,6 @@ static void Down( PHB_EDITOR pEd ) pEd->last_line = pEd->current_line; } - /* Moves cursor to the next line of text */ HB_FUNC( ED_DOWN ) { @@ -1129,13 +1083,10 @@ HB_FUNC( ED_DOWN ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Moves the cursor to the previous line of text - */ +/* Moves the cursor to the previous line of text */ static void Up( PHB_EDITOR pEd ) { - int j, i; - HB_ISIZ jj, tmp; - HB_ISIZ nEsc; + HB_ISIZ jj; /* find the previous line */ jj = Prev( pEd, pEd->current_line ); @@ -1145,21 +1096,25 @@ static void Up( PHB_EDITOR pEd ) } else { + HB_ISIZ nEsc; + pEd->active--; Clear( pEd, pEd->current_line, &nEsc ); pEd->current_line = jj; if( ( ( --pEd->cursor_row ) + pEd->top ) < pEd->top ) { + int j, i; + HB_ISIZ tmp; + /* the new line was not displayed yet */ - pEd->stabil = 1; /* only one line needs redisplay - rest of lines will be scrolled */ + pEd->stabil = 1; /* only one line needs redisplay - rest of lines will be scrolled */ j = 0; pEd->cursor_row = 0; /* count the number of lines that will be visible in the window. - * If the number of lines is smaller then the window height then - * the offset of last displayed line will be not changed - */ + If the number of lines is smaller then the window height then + the offset of last displayed line will be not changed */ pEd->first_display = Prev( pEd, pEd->first_display ); tmp = pEd->first_display; for( i = 0; i < pEd->bottom - pEd->top + 1; i++ ) @@ -1208,7 +1163,7 @@ HB_FUNC( ED_PGDOWN ) HB_ISIZ j; j = Next( pEd, pEd->last_display ); - if( pEd->begin[ j ] == '\0' ) /* no more lines */ + if( pEd->begin[ j ] == '\0' ) /* no more lines */ { pEd->fStable = HB_TRUE; /* advance the cursor as much as possible (to the last line) */ @@ -1231,7 +1186,7 @@ HB_FUNC( ED_PGDOWN ) } } else - break; /* no more lines */ + break; /* no more lines */ } if( pEd->begin[ pEd->last_display ] == '\0' ) @@ -1248,7 +1203,7 @@ HB_FUNC( ED_PGDOWN ) pEd->first_display = 0; } - /* find the offset of the line where the currsor will be displayed */ + /* find the offset of the line where the cursor will be displayed */ pEd->current_line = pEd->last_display; for( i = 0; i < pEd->bottom - pEd->top - pEd->cursor_row; i++ ) { @@ -1269,7 +1224,6 @@ HB_FUNC( ED_PGDOWN ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Moves the cursor to the previous page of text */ HB_FUNC( ED_PGUP ) { @@ -1283,10 +1237,10 @@ HB_FUNC( ED_PGUP ) bt = pEd->bottom - pEd->top; j = Prev( pEd, pEd->first_display ); - if( j < 0 ) /* no more lines to move */ + if( j < 0 ) /* no more lines to move */ { pEd->fStable = HB_TRUE; - /* advannce the cursor to the topmost line */ + /* advance the cursor to the topmost line */ for( i = 0; i < bt + 1; i++ ) Up( pEd ); return; @@ -1302,7 +1256,7 @@ HB_FUNC( ED_PGUP ) pEd->first_display = j; } else - break; /* no more line */ + break; /* no more line */ } /* now the last visible line */ pEd->last_display = pEd->first_display; @@ -1314,8 +1268,7 @@ HB_FUNC( ED_PGUP ) } /* update the offset of line where the cursor will be displayed - * keep the cursor in the same row if possible - */ + keep the cursor in the same row if possible */ pEd->current_line = pEd->last_display; for( i = 0; i < bt - pEd->cursor_row; i++ ) { @@ -1343,7 +1296,6 @@ HB_FUNC( ED_TOP ) if( pEd ) { - HB_ISIZ j; int i; HB_ISIZ nEsc; @@ -1355,7 +1307,7 @@ HB_FUNC( ED_TOP ) /* find the last visible line */ for( i = 0; i < pEd->bottom - pEd->top; i++ ) { - j = Next( pEd, pEd->last_display ); + HB_ISIZ j = Next( pEd, pEd->last_display ); if( j >= 0 ) pEd->last_display = j; } @@ -1380,7 +1332,6 @@ HB_FUNC( ED_BOTTOM ) if( pEd ) { int i, j; - HB_ISIZ jj; HB_ISIZ nEsc; j = 0; @@ -1390,13 +1341,13 @@ HB_FUNC( ED_BOTTOM ) pEd->first_display = pEd->last_line; /* find the first visible line */ + /* We have to count from the bottom to make it work in case the number - * of lines is smaller then the height of the window - */ + of lines is smaller then the height of the window */ pEd->last_display = pEd->first_display; for( i = 0; i < pEd->bottom - pEd->top; i++ ) { - jj = Prev( pEd, pEd->first_display ); + HB_ISIZ jj = Prev( pEd, pEd->first_display ); if( jj >= 0 ) { pEd->first_display = jj; @@ -1418,8 +1369,7 @@ HB_FUNC( ED_BOTTOM ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Go to the specified line number - */ +/* Go to the specified line number */ static void GoTo( PHB_EDITOR pEd, HB_ISIZ line ) { int i; @@ -1468,12 +1418,11 @@ HB_FUNC( ED_GOTO ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Move the cursor to the previous character - */ +/* Move the cursor to the previous character */ static void Left( PHB_EDITOR pEd ) { if( pEd->cursor_col > 0 ) - pEd->cursor_col--; /* inside the window - decrement current column number */ + pEd->cursor_col--; /* inside the window - decrement current column number */ else { if( pEd->first_col > 0 ) @@ -1501,12 +1450,10 @@ HB_FUNC( ED_LEFT ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - -/* Move the cursor to the next character - */ +/* Move the cursor to the next character */ static void Right( PHB_EDITOR pEd ) { - if( pEd->cursor_col < ( pEd->right - pEd->left ) ) /* inside the window */ + if( pEd->cursor_col < ( pEd->right - pEd->left ) ) /* inside the window */ { if( ( pEd->first_col + pEd->cursor_col ) < pEd->line_length ) pEd->cursor_col++; @@ -1537,8 +1484,7 @@ HB_FUNC( ED_RIGHT ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Move the cursor to the beginning of line - */ +/* Move the cursor to the beginning of line */ static void Home( PHB_EDITOR pEd ) { if( pEd->first_col > 0 ) @@ -1559,7 +1505,6 @@ static void Home( PHB_EDITOR pEd ) } } - /* Move the cursor to the beginning of the line */ HB_FUNC( ED_HOME ) { @@ -1571,8 +1516,7 @@ HB_FUNC( ED_HOME ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Move the cursor to the end of line - */ +/* Move the cursor to the end of line */ static void End( PHB_EDITOR pEd ) { HB_ISIZ ll; @@ -1582,8 +1526,7 @@ static void End( PHB_EDITOR pEd ) if( ll < pEd->first_col ) { /* the line length is smaller then the number of characters scrolled - - * adjust the first visible column to make the end of line visible - */ + adjust the first visible column to make the end of line visible */ pEd->first_col = ll; pEd->cursor_col = 0; pEd->fStable = HB_FALSE; @@ -1594,7 +1537,7 @@ static void End( PHB_EDITOR pEd ) } else if( ( ll - pEd->first_col ) > ( pEd->right - pEd->left ) ) { - /* scroll text to the right */ + /* scroll text to the right */ pEd->cursor_col = pEd->right - pEd->left; pEd->first_col = ll - ( pEd->right - pEd->left ); pEd->fStable = HB_FALSE; @@ -1607,7 +1550,6 @@ static void End( PHB_EDITOR pEd ) pEd->cursor_col = ll - pEd->first_col; } - /* Move the cursor the the end of line (after the last non-space character) */ HB_FUNC( ED_END ) { @@ -1619,28 +1561,30 @@ HB_FUNC( ED_END ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Format the current paragraph */ static void FormatParagraph( PHB_EDITOR pEd ) { HB_ISIZ rdl; int cr, cor; HB_ISIZ cc; - HB_ISIZ dl, source, CrLine; - char pom[ _MAX_LINE_LEN * 2 ]; - char * tmp; - HB_ISIZ nEsc; cc = pEd->cursor_col; cr = pEd->cursor_row; cor = 0; rdl = format_line( pEd, HB_CHAR_SOFT1, 0 ); - pEd->stabil = 1; /* at least one line will be redisplayed */ + pEd->stabil = 1; /* at least one line will be redisplayed */ -/* if( rdl ) - */ +#if 0 + if( rdl ) +#endif { + HB_ISIZ dl, CrLine; + HB_ISIZ nEsc; + + char pom[ _MAX_LINE_LEN * 2 ]; + char * tmp; + dl = GetLineLength( pEd, pEd->current_line, &rdl ); hb_strncpy( pom, pEd->begin + pEd->current_line, dl + rdl + 10 ); pom[ pEd->line_length + rdl + 1 ] = '\0'; @@ -1657,7 +1601,7 @@ static void FormatParagraph( PHB_EDITOR pEd ) while( tmp ) { - source = pEd->current_line + ( tmp - pom - 1 ); + HB_ISIZ source = pEd->current_line + ( tmp - pom - 1 ); MoveText( pEd, source + 2, source + 1, pEd->buffer_size - source + 2 ); pEd->begin[ source + 1 ] = ' '; @@ -1683,8 +1627,9 @@ static void FormatParagraph( PHB_EDITOR pEd ) pEd->next_stabil = pEd->first_display; pEd->current_stabil = 0; } -/* else - */ +#if 0 + else +#endif { pEd->stabil = 1; pEd->next_stabil = pEd->current_line; @@ -1698,10 +1643,7 @@ static void FormatParagraph( PHB_EDITOR pEd ) pEd->line_number -= cor; } - - -/* Delete the character under the cursor - */ +/* Delete the character under the cursor */ static void DelChar( PHB_EDITOR pEd ) { HB_ISIZ ccc; @@ -1755,16 +1697,14 @@ HB_FUNC( ED_DELCHAR ) if( ( pEd->cursor_col + pEd->first_col ) >= GetLineLength( pEd, pEd->current_line, &rdl ) ) { - /* The cursor is positioned after the last non-space character - */ + /* The cursor is positioned after the last non-space character */ j = Next( pEd, pEd->current_line ); if( j >= 0 ) { - /* there are more lines below the cursor - join the lines - */ - Down( pEd ); /* goto the next line */ - Home( pEd ); /* goto the beginning of line */ - BackSpace( pEd, HB_TRUE ); /* delete separating CR/LF */ + /* there are more lines below the cursor - join the lines */ + Down( pEd ); /* goto the next line */ + Home( pEd ); /* goto the beginning of line */ + BackSpace( pEd, HB_TRUE ); /* delete separating CR/LF */ pEd->fStable = HB_FALSE; pEd->next_stabil = pEd->first_display; @@ -1775,15 +1715,14 @@ HB_FUNC( ED_DELCHAR ) } else { - /* The cursor is inside the line or at the last character - */ + /* The cursor is inside the line or at the last character */ if( ( pEd->cursor_col + pEd->first_col ) < GetLineLength( pEd, pEd->current_line, &rdl ) ) DelChar( pEd ); /* inside a line */ - else /* at the last character */ + else /* at the last character */ { j = Next( pEd, pEd->current_line ); - if( j >= 0 ) /* if it is not the last line then delete character unde the cursor */ + if( j >= 0 ) /* if it is not the last line then delete character under the cursor */ DelChar( pEd ); } } @@ -1792,15 +1731,11 @@ HB_FUNC( ED_DELCHAR ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Delete a character on the left side of the cursor - */ +/* Delete a character on the left side of the cursor */ static void BackSpace( PHB_EDITOR pEd, HB_BOOL fInsert ) { - char tmp[ _MAX_LINE_LEN + 2 ]; - char tmp1[ _MAX_LINE_LEN + 2 ]; - char * w; - HB_ISIZ ww, j, ccc, kk; - HB_ISIZ rdl, nLen; + HB_ISIZ ccc; + HB_ISIZ rdl; pEd->fStable = HB_FALSE; pEd->next_stabil = pEd->current_line; @@ -1817,8 +1752,10 @@ static void BackSpace( PHB_EDITOR pEd, HB_BOOL fInsert ) if( fInsert ) { - /* in destructive mode - */ + char tmp[ _MAX_LINE_LEN + 2 ]; + char tmp1[ _MAX_LINE_LEN + 2 ]; + + /* in destructive mode */ *tmp = '\0'; *tmp1 = '\0'; if( ( ccc = pEd->cursor_col + pEd->first_col ) > 0 ) @@ -1828,71 +1765,71 @@ static void BackSpace( PHB_EDITOR pEd, HB_BOOL fInsert ) ( pEd->buffer_size - ( pEd->current_line + ccc + 1 ) ) ); Left( pEd ); } - else + else if( pEd->current_line != pEd->first_line ) /* at the beginning of the line */ { - /* at the beginning of the line */ - if( pEd->current_line != pEd->first_line ) + char * w; + HB_ISIZ ww, j, kk; + HB_ISIZ nLen; + + /* this is not the first line */ + nLen = GetLineLength( pEd, pEd->current_line, &rdl ); + + if( pEd->current_line == pEd->last_line ) + if( nLen == 0 ) + pEd->last_line = Prev( pEd, pEd->last_line ); + + /* copy the last line into temporary buffer */ + hb_strncpy( tmp, pEd->begin + pEd->current_line, nLen + rdl ); + + /* find the first space in current line (the new line will + be wrapped eventually at this position) */ + if( ( w = strchr( tmp, ' ' ) ) != 0 ) + ww = w - tmp; + else + ww = nLen + rdl; + + /* go to the previous line */ + j = Prev( pEd, pEd->current_line ); + kk = GetLineLength( pEd, j, &rdl ); + hb_strncpy( tmp1, pEd->begin + j, kk + rdl ); + Up( pEd ); + End( pEd ); + + /* the lines can be joined + the sum of whole length of these lines is smaller then maximal allowed + or there is a space where the line can be wrapped */ + if( ( ww + kk + rdl - 1 ) < pEd->line_length ) { - /* this is not the first line */ - nLen = GetLineLength( pEd, pEd->current_line, &rdl ); + kk = GetLineLength( pEd, pEd->current_line, &rdl ); + j = pEd->current_line + kk + rdl; + /* remove separating CRLF characters */ + MoveText( pEd, j + 2, j, pEd->buffer_size - j - 2 ); - if( pEd->current_line == pEd->last_line ) - if( nLen == 0 ) - pEd->last_line = Prev( pEd, pEd->last_line ); + pEd->line_number--; - /* copy the last line into temporary buffer */ - hb_strncpy( tmp, pEd->begin + pEd->current_line, nLen + rdl ); + j = Next( pEd, pEd->last_display ); + if( j >= 0 ) + pEd->last_display = j; + if( pEd->begin[ pEd->last_display + 1 ] == '\0' ) + pEd->last_display = Prev( pEd, pEd->last_display ); - /* find the first space in current line (the new line will - * be wrapped eventually at this position) */ - if( ( w = strchr( tmp, ' ' ) ) != 0 ) - ww = w - tmp; - else - ww = nLen + rdl; + /* split the new line if it is too long */ + format_line( pEd, HB_CHAR_HARD1, 0 ); - /* go to the previous line */ - j = Prev( pEd, pEd->current_line ); - kk = GetLineLength( pEd, j, &rdl ); - hb_strncpy( tmp1, pEd->begin + j, kk + rdl ); - Up( pEd ); - End( pEd ); - - /* the lines can be joined - * the sum of whole length of these lines is smaller then maximal allowed - * or there is a space where the line can be wrapped - */ - if( ( ww + kk + rdl - 1 ) < pEd->line_length ) + j = Next( pEd, pEd->current_line ); + if( j < 0 ) { - kk = GetLineLength( pEd, pEd->current_line, &rdl ); - j = pEd->current_line + kk + rdl; - /* remove separating CRLF characters */ - MoveText( pEd, j + 2, j, pEd->buffer_size - j - 2 ); - - pEd->line_number--; - - j = Next( pEd, pEd->last_display ); - if( j >= 0 ) - pEd->last_display = j; - if( pEd->begin[ pEd->last_display + 1 ] == '\0' ) - pEd->last_display = Prev( pEd, pEd->last_display ); - - /* split the new line if it is too long */ - format_line( pEd, HB_CHAR_HARD1, 0 ); - - j = Next( pEd, pEd->current_line ); - if( j < 0 ) - { - pEd->last_display = Prev( pEd, pEd->last_display ); - pEd->last_line = pEd->current_line; - } - pEd->fStable = HB_FALSE; - pEd->next_stabil = pEd->first_display; - pEd->stabil = pEd->bottom - pEd->top + 1; - pEd->dir = _STABILIZE_DOWN; - pEd->current_stabil = 0; + pEd->last_display = Prev( pEd, pEd->last_display ); + pEd->last_line = pEd->current_line; } + pEd->fStable = HB_FALSE; + pEd->next_stabil = pEd->first_display; + pEd->stabil = pEd->bottom - pEd->top + 1; + pEd->dir = _STABILIZE_DOWN; + pEd->current_stabil = 0; } } + FormatParagraph( pEd ); pEd->fStable = HB_FALSE; @@ -1920,7 +1857,6 @@ static void BackSpace( PHB_EDITOR pEd, HB_BOOL fInsert ) } } - /* Delete a character on the left side of the cursor */ HB_FUNC( ED_BSPACE ) { @@ -1932,9 +1868,7 @@ HB_FUNC( ED_BSPACE ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - -/* Move to the beginning of next non-empty line - */ +/* Move to the beginning of next non-empty line */ static void GotoNextNonEmptyLine( PHB_EDITOR pEd ) { HB_ISIZ rdl; @@ -1951,9 +1885,7 @@ static void GotoNextNonEmptyLine( PHB_EDITOR pEd ) } } - -/* Move the cursor to the next word - */ +/* Move the cursor to the next word */ static void NextWord( PHB_EDITOR pEd ) { char * adr; @@ -2005,7 +1937,6 @@ static void NextWord( PHB_EDITOR pEd ) NextWord( pEd ); } - /* Move the cursor to the next word */ HB_FUNC( ED_NWORD ) { @@ -2017,8 +1948,7 @@ HB_FUNC( ED_NWORD ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* Move the cursor to the previous word - */ +/* Move the cursor to the previous word */ static void PreviousWord( PHB_EDITOR pEd ) { HB_ISIZ pom; @@ -2090,7 +2020,6 @@ static void PreviousWord( PHB_EDITOR pEd ) PreviousWord( pEd ); } - /* Move the cursor to the previous word */ HB_FUNC( ED_PWORD ) { @@ -2101,36 +2030,35 @@ HB_FUNC( ED_PWORD ) else hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } +/* Format given line - returns it the line has changed */ - -/* Format given line - returns it the line has changed - */ static HB_BOOL format_line( PHB_EDITOR pEd, char Karetka, HB_ISIZ LineDl ) { - char pom[ _MAX_LINE_LEN * 2 ]; - char * p; - HB_ISIZ podz, jj, i; HB_BOOL status; - HB_ISIZ j; HB_ISIZ rdl = 0; if( ! LineDl ) LineDl = GetLineLength( pEd, pEd->current_line, &rdl ); - status = HB_FALSE; /* the line is not splitted yet */ + status = HB_FALSE; /* the line is not split yet */ if( LineDl > pEd->line_length ) { + char * p; + HB_ISIZ podz, jj; + HB_ISIZ j; + + char pom[ _MAX_LINE_LEN * 2 ]; + /* the line is longer then maximal allowed length - - * wrap the line - */ - status = HB_TRUE; /* the line will be splitted */ + wrap the line */ + status = HB_TRUE; /* the line will be split */ /* copy maximum allowed bytes form the line into temporary buffer */ hb_strncpy( pom, pEd->begin + pEd->current_line, pEd->line_length + 10 + rdl ); pom[ pEd->line_length + rdl ] = '\0'; - /* find the last space where the line can be splitted */ + /* find the last space where the line can be split */ p = strrchr( pom, ' ' ); if( p ) { @@ -2155,6 +2083,7 @@ static HB_BOOL format_line( PHB_EDITOR pEd, char Karetka, HB_ISIZ LineDl ) if( ( pEd->cursor_col + pEd->first_col ) >= podz ) { + HB_ISIZ i; Home( pEd ); Down( pEd ); for( i = 0; i < jj; i++ ) @@ -2167,8 +2096,7 @@ static HB_BOOL format_line( PHB_EDITOR pEd, char Karetka, HB_ISIZ LineDl ) return status; } -/* Appends the character at the end of line - */ +/* Appends the character at the end of line */ static HB_BOOL AppendChar( PHB_EDITOR pEd, char znak, char podz ) { HB_BOOL status; @@ -2184,8 +2112,7 @@ static HB_BOOL AppendChar( PHB_EDITOR pEd, char znak, char podz ) diff = pEd->cursor_col + pEd->first_col - nLen; /* the cursor is positioned 'diff' columns after the last character - * in the line - fill the gap with spaces before appending the character - */ + in the line - fill the gap with spaces before appending the character */ MoveText( pEd, iPos, iPos + diff + 1, pEd->buffer_size - 1 - iPos - diff ); memset( pEd->begin + ( pEd->current_line + nLen ), ' ', diff ); @@ -2214,9 +2141,7 @@ static HB_BOOL AppendChar( PHB_EDITOR pEd, char znak, char podz ) return status; } - -/* Checks if there is enough free room in the text buffer - */ +/* Checks if there is enough free room in the text buffer */ static HB_BOOL Check_length( PHB_EDITOR pEd, HB_ISIZ iRequested ) { if( ( pEd->text_length + iRequested ) <= ( pEd->buffer_size - 8 ) ) @@ -2225,40 +2150,36 @@ static HB_BOOL Check_length( PHB_EDITOR pEd, HB_ISIZ iRequested ) return HB_FALSE; } - -/* Adjusts the offset of last line - */ +/* Adjusts the offset of last line */ static void SetLastLine( PHB_EDITOR pEd ) { if( pEd->current_line > pEd->last_line ) pEd->last_line = pEd->current_line; } - -/* Insert or replace the new character into the text buffer - */ +/* Insert or replace the new character into the text buffer */ static void PutChar( PHB_EDITOR pEd, HB_BOOL fInsert, char znak ) { HB_BOOL jj; - HB_ISIZ i, cc; + HB_ISIZ cc; HB_ISIZ rdl; - HB_ISIZ cl; - HB_ISIZ ccol, fcol; jj = HB_FALSE; - cc = pEd->cursor_col + pEd->first_col; /* currnt position in the line */ + cc = pEd->cursor_col + pEd->first_col; /* current position in the line */ if( fInsert ) { /* INSERT is ON */ if( Check_length( pEd, 1 ) ) { - /* TODO: add reallocation of text buffer - */ + /* TODO: add reallocation of text buffer */ if( cc < GetLineLength( pEd, pEd->current_line, &rdl ) ) { + HB_ISIZ i; + HB_ISIZ cl; + HB_ISIZ ccol, fcol; + /* the character will be inserted within the line - the cursor - * is placed inside the line - */ + is placed inside the line */ i = pEd->current_line + cc; MoveText( pEd, i, i + 1, pEd->buffer_size - pEd->current_line - cc - 1 ); pEd->begin[ i ] = znak; @@ -2287,23 +2208,19 @@ static void PutChar( PHB_EDITOR pEd, HB_BOOL fInsert, char znak ) SetLastLine( pEd ); } } - else + else if( cc < GetLineLength( pEd, pEd->current_line, &rdl ) ) { - if( cc < GetLineLength( pEd, pEd->current_line, &rdl ) ) - { - pEd->begin[ pEd->current_line + cc ] = znak; - jj = HB_FALSE; + pEd->begin[ pEd->current_line + cc ] = znak; + jj = HB_FALSE; + Right( pEd ); + } + else if( Check_length( pEd, 1 ) ) + { + jj = AppendChar( pEd, znak, HB_CHAR_SOFT1 ); + if( ! jj ) Right( pEd ); - } else - if( Check_length( pEd, 1 ) ) - { - jj = AppendChar( pEd, znak, HB_CHAR_SOFT1 ); - if( ! jj ) - Right( pEd ); - else - SetLastLine( pEd ); - } + SetLastLine( pEd ); } if( ! jj ) @@ -2329,7 +2246,6 @@ static void PutChar( PHB_EDITOR pEd, HB_BOOL fInsert, char znak ) pEd->dir = _STABILIZE_DOWN; } - /* Insert or replace the character into the text buffer */ HB_FUNC( ED_PUTCHAR ) { @@ -2343,7 +2259,6 @@ HB_FUNC( ED_PUTCHAR ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - #if 0 static void Tab( PHB_EDITOR pEd, HB_BOOL fInsert ) { @@ -2360,9 +2275,7 @@ static void Tab( PHB_EDITOR pEd, HB_BOOL fInsert ) } #endif -/* -** -*/ +/* --- */ #if 0 HB_FUNC( ED_TAB ) @@ -2378,10 +2291,10 @@ HB_FUNC( ED_TAB ) static void DelLine( PHB_EDITOR pEd ) { - HB_ISIZ tmp, j; - if( pEd->active < pEd->line_number ) { + HB_ISIZ tmp, j; + j = Next( pEd, pEd->last_display ); if( j >= 0 ) pEd->last_display = j; @@ -2425,7 +2338,6 @@ static void DelLine( PHB_EDITOR pEd ) } } - /* Delete the current line */ HB_FUNC( ED_DELLINE ) { @@ -2444,19 +2356,21 @@ HB_FUNC( ED_DELWORD ) if( pEd ) { - HB_ISIZ pos1, pos2, j; - HB_ISIZ cc, fc; - int cr; - HB_ISIZ rdl; - HB_ISIZ fd, ld; - HB_ISIZ l; + HB_ISIZ j = pEd->current_line + pEd->cursor_col + pEd->first_col; - j = pEd->current_line + pEd->cursor_col + pEd->first_col; if( pEd->begin[ j ] != ' ' ) { + HB_ISIZ rdl; + if( ( pEd->cursor_col + pEd->first_col ) < GetLineLength( pEd, pEd->current_line, &rdl ) ) { + HB_ISIZ pos1, pos2; + HB_ISIZ cc, fc; + int cr; + HB_ISIZ fd, ld; + HB_ISIZ l; + cc = pEd->cursor_col; cr = pEd->cursor_row; fc = pEd->first_col; @@ -2501,22 +2415,18 @@ HB_FUNC( ED_DELWORD ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - -/* Insert the CRLF characters - */ +/* Insert the CRLF characters */ static void Return( PHB_EDITOR pEd, HB_BOOL fInsert ) { - HB_ISIZ ii, j; - HB_ISIZ nLen; + HB_ISIZ j; HB_ISIZ nEsc; if( Check_length( pEd, 2 ) ) { if( fInsert ) { - /* only if INSERT state is ON - */ - nLen = Clear( pEd, pEd->current_line, &nEsc ); + /* only if INSERT state is ON */ + HB_ISIZ nLen = Clear( pEd, pEd->current_line, &nEsc ); pEd->line_number++; @@ -2532,6 +2442,7 @@ static void Return( PHB_EDITOR pEd, HB_BOOL fInsert ) } else { + HB_ISIZ ii; if( ( pEd->first_col + pEd->cursor_col ) > nLen + 1 ) End( pEd ); ii = pEd->current_line + pEd->first_col + @@ -2596,7 +2507,6 @@ static void Return( PHB_EDITOR pEd, HB_BOOL fInsert ) } } - /* Insert the CRLF characters */ HB_FUNC( ED_RETURN ) { @@ -2608,7 +2518,6 @@ HB_FUNC( ED_RETURN ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Returns the current cursor row inside the editor's window */ HB_FUNC( ED_WINROW ) { @@ -2631,7 +2540,6 @@ HB_FUNC( ED_ROW ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Return the current cursor column inside the editor's window */ HB_FUNC( ED_WINCOL ) { @@ -2643,7 +2551,6 @@ HB_FUNC( ED_WINCOL ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Returns the current cursor position inside the line */ HB_FUNC( ED_COL ) { @@ -2655,7 +2562,6 @@ HB_FUNC( ED_COL ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Returns the total number of lines */ HB_FUNC( ED_MAXLINE ) { @@ -2667,7 +2573,6 @@ HB_FUNC( ED_MAXLINE ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Counts the total number of lines in passed editor */ HB_FUNC( ED_LCOUNT ) { @@ -2679,7 +2584,6 @@ HB_FUNC( ED_LCOUNT ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Returns if the editor is correctly displayed */ HB_FUNC( ED_STABLE ) { @@ -2691,7 +2595,6 @@ HB_FUNC( ED_STABLE ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - /* Returns the number of bytes stored in the text buffer */ HB_FUNC( ED_LENGTH ) { diff --git a/contrib/hbmisc/irm.c b/contrib/hbmisc/irm.c index 39b49cd9d7..ff3b6f5d14 100644 --- a/contrib/hbmisc/irm.c +++ b/contrib/hbmisc/irm.c @@ -169,34 +169,34 @@ static void hb_irmMapMarkCallback( HB_ULONG ulRecNo, unsigned char * pKey, unsig } /* - * Expresion operators: + * Expression operators: * "&", expr1, expr2, ... * "|", expr1, expr2, ... * Filter operators: - * "=", tag, bag, value ORKEYVAL() = value - * "<=", tag, bag, value ORKEYVAL() <= value - * ">=", tag, bag, value ORKEYVAL() >= value - * "<=<=", tag, bag, value1, value2 value1 <= ORKEYVAL() <= value2 + * "=", tag, bag, value ordKeyVal() = value + * "<=", tag, bag, value ordKeyVal() <= value + * ">=", tag, bag, value ordKeyVal() >= value + * "<=<=", tag, bag, value1, value2 value1 <= ordKeyVal() <= value2 */ PHB_IRMMAP hb_irmExecute( PHB_ITEM pItem ) { - PHB_IRMMAP pMap, * pMapArray; const char * szOper; - HB_ULONG ulLen, ulSize, ul, ul2; - AREAP pArea; - DBORDERINFO dboi; if( HB_IS_ARRAY( pItem ) && ( szOper = hb_arrayGetCPtr( pItem, 1 ) ) != NULL ) { + HB_ULONG ulLen, ulSize; + PHB_IRMMAP pMap; + /* Expression operators */ if( ( ! strcmp( szOper, "&" ) || ! strcmp( szOper, "|" ) ) && ( ulLen = ( HB_ULONG ) hb_arrayLen( pItem ) ) > 1 ) { + HB_ULONG ul, ul2; + PHB_IRMMAP * pMapArray; + --ulLen; pMapArray = ( PHB_IRMMAP * ) hb_xgrab( sizeof( PHB_IRMMAP ) * ulLen ); for( ul = 0; ul < ulLen; ++ul ) - { pMapArray[ ul ] = hb_irmExecute( hb_arrayGetItemPtr( pItem, ul + 2 ) ); - } ulSize = ( pMapArray[ 0 ]->ulSize + 7 ) >> 3; if( ! strcmp( szOper, "&" ) ) { @@ -224,9 +224,11 @@ PHB_IRMMAP hb_irmExecute( PHB_ITEM pItem ) ( ! strcmp( szOper, ">=" ) && ( hb_arrayLen( pItem ) == 4 ) ) || ( ! strcmp( szOper, "<=<=" ) && ( hb_arrayLen( pItem ) == 5 ) ) ) { - pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); + AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) { + DBORDERINFO dboi; + SELF_RECCOUNT( pArea, &ulSize ); pMap = hb_irmMapAlloc( ulSize ); diff --git a/contrib/hbmisc/nconvert.prg b/contrib/hbmisc/nconvert.prg index 0046170e9b..da7ffbfc59 100644 --- a/contrib/hbmisc/nconvert.prg +++ b/contrib/hbmisc/nconvert.prg @@ -50,7 +50,7 @@ FUNCTION IsBin( cString ) cString := AllTrim( cString ) FOR nX := 1 TO Len( cString ) - IF !( SubStr( cString, nX, 1 ) $ "01" ) + IF ! SubStr( cString, nX, 1 ) $ "01" RETURN .F. ENDIF NEXT @@ -63,7 +63,7 @@ FUNCTION IsOctal( cString ) cString := AllTrim( cString ) FOR nX := 1 TO Len( cString ) - IF !( SubStr( cString, nX, 1 ) $ "01234567" ) + IF ! SubStr( cString, nX, 1 ) $ "01234567" RETURN .F. ENDIF NEXT @@ -76,7 +76,7 @@ FUNCTION IsDec( cString ) cString := AllTrim( cString ) FOR nX := 1 TO Len( cString ) - IF !( SubStr( cString, nX, 1 ) $ "0123456789" ) + IF ! SubStr( cString, nX, 1 ) $ "0123456789" RETURN .F. ENDIF NEXT @@ -89,7 +89,7 @@ FUNCTION IsHexa( cString ) cString := AllTrim( cString ) FOR nX := 1 TO Len( cString ) - IF !( SubStr( cString, nX, 1 ) $ "0123456789ABCDEF" ) + IF ! SubStr( cString, nX, 1 ) $ "0123456789ABCDEF" RETURN .F. ENDIF NEXT diff --git a/contrib/hbmisc/numtxten.prg b/contrib/hbmisc/numtxten.prg index 2defe848a6..abbad60232 100644 --- a/contrib/hbmisc/numtxten.prg +++ b/contrib/hbmisc/numtxten.prg @@ -1,7 +1,7 @@ -// ; Author: "Michael Mozina" -// ; Donated to the Public Domain. +// Author: "Michael Mozina" +// Donated to the Public Domain. -// ; Decimals not supported +// Decimals not supported FUNCTION NumToTxtEN( nValue ) diff --git a/contrib/hbmisc/numtxthu.prg b/contrib/hbmisc/numtxthu.prg index cab2deaa2a..c928c7a02b 100644 --- a/contrib/hbmisc/numtxthu.prg +++ b/contrib/hbmisc/numtxthu.prg @@ -44,8 +44,6 @@ * */ -/* UTF-8 */ - FUNCTION NumToTxtHU( nValue ) LOCAL aTort := { "tized", "század", "ezred", "tízezred", "százezred", "milliomod", "milliárdod" } @@ -69,7 +67,7 @@ FUNCTION NumToTxtHU( nValue ) tmp1 := Len( tmp2 := SubStr( Str( tmp, 8, 6 ), 3 ) ) - WHILE SubStr( tmp2, tmp1, 1 ) == "0" .AND. tmp1 > 0 + DO WHILE SubStr( tmp2, tmp1, 1 ) == "0" .AND. tmp1 > 0 tmp1-- ENDDO diff --git a/contrib/hbmisc/numtxtru.prg b/contrib/hbmisc/numtxtru.prg index c8f3d6c35e..0be2724c3c 100644 --- a/contrib/hbmisc/numtxtru.prg +++ b/contrib/hbmisc/numtxtru.prg @@ -49,20 +49,20 @@ * */ -#define NTSR_MALE 1 -#define NTSR_FEMA 2 -#define NTSR_MIDD 3 -#define NTSR_1000_1 4 -#define NTSR_1000_2 5 -#define NTSR_1000_3 6 -#define NTSR_CNT 7 -#define NTSR_ROD 8 -#define NTSR_ORDG 9 -#define NTSR_CURR 10 -#define NTSR_CENT 11 -#define NTSR_MINUS 12 -#define NTSR_MONTH 13 -#define NTSR_YEAR 14 +#define NTSR_MALE 1 +#define NTSR_FEMA 2 +#define NTSR_MIDD 3 +#define NTSR_1000_1 4 +#define NTSR_1000_2 5 +#define NTSR_1000_3 6 +#define NTSR_CNT 7 +#define NTSR_ROD 8 +#define NTSR_ORDG 9 +#define NTSR_CURR 10 +#define NTSR_CENT 11 +#define NTSR_MINUS 12 +#define NTSR_MONTH 13 +#define NTSR_YEAR 14 /* Russian messages */ STATIC sc_aRus := { ; @@ -420,7 +420,7 @@ STATIC sc_aBel := { ; /* * nValue: integer value; - * cLang: language Id ("ru", "uk", "be"), russian ("ru") by default; + * cLang: language Id ("ru", "uk", "be"), Russian ("ru") by default; * nGender: masculine (default), feminine or neuter gender; * lOrd: ordinals, cardinal numbers if omitted */ @@ -443,7 +443,7 @@ FUNCTION NumToTxtRU( nValue, cLang, nGender, lOrd ) /* * nValue: integer value; - * cLang: language Id ("ru", "uk", "be"), russian ("ru") by default; + * cLang: language Id ("ru", "uk", "be"), Russian ("ru") by default; * nMode1: 1 - in words, * 2 - in words and short name, * 3 - in numbers, diff --git a/contrib/hbmisc/spd.c b/contrib/hbmisc/spd.c index 5bbe4497b4..20107e135f 100644 --- a/contrib/hbmisc/spd.c +++ b/contrib/hbmisc/spd.c @@ -69,11 +69,11 @@ static void STAItm( PHB_ITEM pItmPar ) cRes[ i++ ] = '\''; cRes[ i++ ] = *c++; } - cRes[ i++ ] = '\''; /* cRes[i] = '\0'; */ + cRes[ i++ ] = '\''; /* cRes[ i ] = '\0'; */ hb_itemPutCLPtr( pItmPar, cRes, i ); } -static HB_UINT SCItm( char * cBuffer, HB_UINT ulMaxBuf, char * cParFrm, int iCOut, int IsIndW, +static HB_UINT SCItm( char * cBuffer, HB_UINT ulMaxBuf, const char * cParFrm, int iCOut, int IsIndW, int iIndWidth, int IsIndP, int iIndPrec, PHB_ITEM pItmPar ) { @@ -215,22 +215,24 @@ HB_FUNC( SQL_SPRINTF ) { static const char s_szToken[] = "stTcdiouxXaAeEfgGpnSC"; - PHB_ITEM pItmPar, pItmCpy; - char * cIntMod, * cBuffer, * cParFrm; - const char * c; - int p, arg, iCOut, IsType, IsIndW, IsIndP, iIndWidth, iIndPrec, iErrorPar = 0; - HB_UINT s, f, i, ulWidth, ulParPos = 0, ulResPos = 0, ulMaxBuf = DK_INCBUF, ulMaxRes = - DK_INCRES; + HB_UINT ulResPos = 0, ulMaxBuf = DK_INCBUF, ulMaxRes = DK_INCRES; + + char * cIntMod, * cBuffer, * cParFrm; + int p, iErrorPar = 0; cIntMod = NULL; cRes = ( char * ) hb_xgrab( ulMaxRes ); cBuffer = ( char * ) hb_xgrab( ulMaxBuf ); cParFrm = ( char * ) hb_xgrab( ulItmFrm + sizeof( char ) ); - for( p = 0; p < argc; /* Not p++ by support index & indirect arguments */ ) + for( p = 0; p < argc; /* Not p++ by support index & indirect arguments */ ) { + PHB_ITEM pItmPar, pItmCpy; + int arg, iCOut, IsType, IsIndW, IsIndP, iIndWidth, iIndPrec; + HB_UINT s, f, i, ulWidth, ulParPos = 0; + + const char * c = cItmFrm + ulParPos; - c = cItmFrm + ulParPos; s = f = i = ulWidth = arg = iCOut = IsType = IsIndW = iIndWidth = IsIndP = iIndPrec = 0; do /* Get Par Format */ { @@ -351,7 +353,7 @@ HB_FUNC( SQL_SPRINTF ) if( IsIndW ) /* Get Par Indirectly Width Item */ { - pItmPar = hb_param( ( iIndWidth ? iIndWidth + 1 : p++ + 2 ), HB_IT_INTEGER ); + pItmPar = hb_param( iIndWidth ? iIndWidth + 1 : p++ + 2, HB_IT_INTEGER ); if( pItmPar ) { if( ( iIndWidth = hb_itemGetNI( pItmPar ) ) < 0 ) @@ -368,7 +370,7 @@ HB_FUNC( SQL_SPRINTF ) if( IsIndP ) /* Get Par Indirectly Precision Item */ { - pItmPar = hb_param( ( iIndPrec ? iIndPrec + 1 : p++ + 2 ), HB_IT_INTEGER ); + pItmPar = hb_param( iIndPrec ? iIndPrec + 1 : p++ + 2, HB_IT_INTEGER ); if( pItmPar ) { iIndPrec = hb_itemGetNI( pItmPar ); @@ -390,7 +392,7 @@ HB_FUNC( SQL_SPRINTF ) i--; } /* i == strlen( cParFrm ) */ - pItmPar = hb_param( ( arg ? arg + 1 : p++ + 2 ), HB_IT_ANY ); /* Get Par Item */ + pItmPar = hb_param( arg ? arg + 1 : p++ + 2, HB_IT_ANY ); /* Get Par Item */ if( ! pItmPar ) { iErrorPar = 1; @@ -438,13 +440,13 @@ HB_FUNC( SQL_SPRINTF ) } else /* Par Item sprintf() Out */ { -# ifdef HB_IT_NULL +#ifdef HB_IT_NULL if( ( HB_IS_NIL( pItmPar ) || HB_IS_NULL( pItmPar ) ) ) { -# else +#else if( HB_IS_NIL( pItmPar ) ) { -# endif +#endif ulWidth = f; IsIndW = IsIndP = 0; while( cParFrm[ --f ] != '%' ) @@ -459,13 +461,14 @@ HB_FUNC( SQL_SPRINTF ) cBuffer = ( char * ) hb_xrealloc( cBuffer, ulMaxBuf ); } pItmCpy = hb_itemNew( NULL ); -# ifdef HB_IT_NULL +#ifdef HB_IT_NULL if( IsType == 2 && ! HB_IS_NULL( pItmPar ) ) hb_itemPutCL( pItmCpy, "DEFAULT", 7 ); -# else /* Print DEFAULT if NIL for T converter if not NULL, print NULL for the rest of converters */ +#else + /* Print DEFAULT if NIL for T converter if not NULL, print NULL for the rest of converters */ if( IsType == 2 ) hb_itemPutCL( pItmCpy, "DEFAULT", 7 ); -# endif +#endif else hb_itemPutCL( pItmCpy, "NULL", 4 ); s = SCItm( cBuffer, ulMaxBuf, cParFrm, iCOut, IsIndW, iIndWidth, IsIndP, iIndPrec, @@ -499,7 +502,7 @@ HB_FUNC( SQL_SPRINTF ) else if( HB_IS_DATETIME( pItmPar ) && iCOut == 's' ) { long lDate, lTime; - char cDTBuf[ 9 ], cDTFrm[ 27 ]; + char cDTFrm[ 27 ]; if( s ) /* Internal Modifier */ { @@ -513,23 +516,26 @@ HB_FUNC( SQL_SPRINTF ) if( HB_IS_TIMESTAMP( pItmPar ) ) { hb_itemGetTDT( pItmPar, &lDate, &lTime ); - hb_timeStampFormat( cDTFrm, - ( s ? cIntMod : ( IsType ? "YYYY-MM-DD" : - hb_setGetDateFormat() ) ), - ( s ? cIntMod + - f : ( IsType ? "HH:MM:SS" : hb_setGetTimeFormat() ) ), - lDate, lTime ); + hb_timeStampFormat( cDTFrm, + s ? cIntMod : ( IsType ? "YYYY-MM-DD" : + hb_setGetDateFormat() ), + s ? cIntMod + f : ( IsType ? "HH:MM:SS" : + hb_setGetTimeFormat() ), + lDate, lTime ); if( s ) { if( ! cIntMod[ 0 ] ) - memcpy( cDTFrm, cDTFrm + 1, 26 ); /* LTrim 1 space if only Time */ + memmove( cDTFrm, cDTFrm + 1, 26 ); /* LTrim 1 space if only Time */ else if( cDTFrm[ s ] == ' ' ) - cDTFrm[ s ] = '\0'; /* RTrim 1 space if only Date */ + cDTFrm[ s ] = '\0'; /* RTrim 1 space if only Date */ } } else + { + char cDTBuf[ 9 ]; hb_dateFormat( hb_itemGetDS( pItmPar, cDTBuf ), cDTFrm, - ( s ? cIntMod : ( IsType ? "YYYY-MM-DD" : hb_setGetDateFormat() ) ) ); + s ? cIntMod : ( IsType ? "YYYY-MM-DD" : hb_setGetDateFormat() ) ); + } /* 27 + 2 if %t and change format time */ if( ( f = i + HB_MAX( ulWidth, 29 ) ) > ulMaxBuf ) @@ -543,9 +549,9 @@ HB_FUNC( SQL_SPRINTF ) { /* Empty DATE, DATETIME print DEFAULT for T converter or DK_EMPTYDATE, DK_EMPTYDATETIME for t converter */ if( *cDTFrm == ' ' ) - hb_itemPutC( pItmCpy, ( HB_IS_TIMESTAMP( pItmPar ) ? - ( IsType == 2 ? "DEFAULT" : DK_EMPTYDATETIME ) : - ( IsType == 2 ? "DEFAULT" : DK_EMPTYDATE ) ) ); + hb_itemPutC( pItmCpy, HB_IS_TIMESTAMP( pItmPar ) ? + ( IsType == 2 ? "DEFAULT" : DK_EMPTYDATETIME ) : + ( IsType == 2 ? "DEFAULT" : DK_EMPTYDATE ) ); else STAItm( pItmCpy ); } @@ -570,15 +576,13 @@ HB_FUNC( SQL_SPRINTF ) hb_itemCopy( pItmCpy = hb_itemNew( NULL ), pItmPar ); pItmPar = pItmCpy; hb_itemPutC( pItmPar, - ( hb_itemGetL( pItmPar ) ? ( s ? cIntMod : "TRUE" ) : ( s ? cIntMod - + f : - "FALSE" ) ) ); + hb_itemGetL( pItmPar ) ? ( s ? cIntMod : "TRUE" ) : + ( s ? cIntMod + f : "FALSE" ) ); } if( ( f = i + ( iCOut == - 's' ? HB_MAX( ulWidth, ( s ? s : 6 ) ) : HB_MAX( ulWidth, - DK_BLKBUF ) ) ) > - ulMaxBuf ) + 's' ? HB_MAX( ulWidth, s ? s : 6 ) : + HB_MAX( ulWidth, DK_BLKBUF ) ) ) > ulMaxBuf ) { ulMaxBuf += f + DK_INCBUF; /* size of "FALSE" == 6 */ cBuffer = ( char * ) hb_xrealloc( cBuffer, ulMaxBuf ); @@ -591,13 +595,13 @@ HB_FUNC( SQL_SPRINTF ) } else if( iCOut == 's' ) { - char * cStr = hb_itemStr( pItmPar, NULL, NULL ); - const char * cTrimStr; + char * cStr = hb_itemStr( pItmPar, NULL, NULL ); if( cStr ) { HB_SIZE nLen = strlen( cStr ); - cTrimStr = hb_strLTrim( cStr, &nLen ); + const char * cTrimStr = hb_strLTrim( cStr, &nLen ); + f = ( HB_UINT ) nLen; if( ( f = i + HB_MAX( ulWidth, f ) ) > ulMaxBuf ) { @@ -616,7 +620,6 @@ HB_FUNC( SQL_SPRINTF ) iErrorPar = p + 2; break; } - } else if( HB_IS_NUMERIC( pItmPar ) || HB_IS_POINTER( pItmPar ) ) { @@ -627,7 +630,6 @@ HB_FUNC( SQL_SPRINTF ) } s = SCItm( cBuffer, ulMaxBuf, cParFrm, iCOut, IsIndW, iIndWidth, IsIndP, iIndPrec, pItmPar ); - } else { @@ -660,8 +662,7 @@ HB_FUNC( SQL_SPRINTF ) hb_xfree( cRes ); if( iErrorPar > 1 ) - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 2, hb_paramError( - 1 ), hb_paramError( iErrorPar ) ); + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 2, hb_paramError( 1 ), hb_paramError( iErrorPar ) ); else hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); } diff --git a/contrib/hbmisc/strfmt.c b/contrib/hbmisc/strfmt.c index 76f96ffb48..5748f9c9f7 100644 --- a/contrib/hbmisc/strfmt.c +++ b/contrib/hbmisc/strfmt.c @@ -59,7 +59,7 @@ typedef struct } STRPAR; /* TODO: Add support for embedded PICTURE string in mask string. */ -/* TODO: Add a way to control trimming. (but 99.99% of the time, trimming is actually useful) */ +/* TODO: Add a way to disable trimming. (but 99.99% of the time, trimming is actually useful) */ HB_FUNC( STRFORMAT ) { diff --git a/contrib/hbmisc/stringp.prg b/contrib/hbmisc/stringp.prg index 8f4f169a72..fbfd9ba8b6 100644 --- a/contrib/hbmisc/stringp.prg +++ b/contrib/hbmisc/stringp.prg @@ -46,8 +46,7 @@ #include "hboo.ch" -/* - * Convert to character +/* Convert to character * * ToChar( , [], [] ) --> * : Item to write @@ -65,7 +64,6 @@ * NIL NIL * Logical .T. / .F. * Object ():{:, ...} - * */ FUNCTION ToChar( xTxt, cSeparator, lDebug ) @@ -126,9 +124,8 @@ FUNCTION ToChar( xTxt, cSeparator, lDebug ) RETURN cOut -// Non-volatile debugging function showing contents of xItem and returing +// Non-volatile debugging function showing contents of xItem and returning // passed argument. - FUNCTION Debug( xItem ) ? ToChar( xItem, ", ", .T. ) diff --git a/contrib/hbmisc/stringsx.c b/contrib/hbmisc/stringsx.c index a56d03a049..acdccd8911 100644 --- a/contrib/hbmisc/stringsx.c +++ b/contrib/hbmisc/stringsx.c @@ -1,6 +1,4 @@ -/* - * Copyright 1999 {list of individual authors and e-mail addresses} - */ +/* Copyright 1999 {list of individual authors and e-mail addresses} */ #include "hbapi.h" @@ -16,7 +14,7 @@ static const char * hb_strtoken( const char * szText, HB_TRACE( HB_TR_DEBUG, ( "hb_strtoken(%s, %" HB_PFS "d, %" HB_PFS "d, %d, %p)", szText, nText, nIndex, - ( int ) cDelimiter, pnLen ) ); + ( int ) cDelimiter, ( void * ) pnLen ) ); do { @@ -57,7 +55,7 @@ static const char * hb_strtoken( const char * szText, } } -/* returns the nth occurence of a substring within a token-delimited string */ +/* returns the nth occurrence of a substring within a token-delimited string */ HB_FUNC( STRTOKEN ) { const char * szText; diff --git a/contrib/hbmisc/twirler.prg b/contrib/hbmisc/twirler.prg index aed663b91f..9f81800fec 100644 --- a/contrib/hbmisc/twirler.prg +++ b/contrib/hbmisc/twirler.prg @@ -1,6 +1,6 @@ -/* New libmisc twirler class - Donated to the public domain on 2001-04-03 by David G. Holm - */ +/* Donated to the public domain on 2001-04-03 by David G. Holm */ + +/* New twirler class */ #include "hbclass.ch" @@ -19,7 +19,7 @@ CREATE CLASS Twirler METHOD show() METHOD hide() -END CLASS +ENDCLASS METHOD new( nRow, nCol, cTitle, cChars, nSmooth ) CLASS Twirler diff --git a/contrib/hbmisc/udpds.prg b/contrib/hbmisc/udpds.prg index b44ba841f4..efa8a373fb 100644 --- a/contrib/hbmisc/udpds.prg +++ b/contrib/hbmisc/udpds.prg @@ -1,15 +1,13 @@ -/* - * Copyright 2010 Mindaugas Kavaliauskas - */ +/* Copyright 2010 Mindaugas Kavaliauskas */ /* * This module demonstrates a simple UDP Discovery Server * - * If you run some service on the network (ex., netio) you need to + * If you run some service on the network (ex., hbnetio) you need to * know server IP address and configure client to connect to this * address. UDPDS helps client to find server address (or addresses * of multiple servers) on local network. UDPDS should be run in - * parallel to real server (ex., netio). Server part of UDPDS uses + * parallel to real server (ex., hbnetio). Server part of UDPDS uses * threads, so, it should be compiled in MT mode. * * Server functions: @@ -40,7 +38,7 @@ FUNCTION hb_udpds_Find( nPort, cName ) cBuffer := Space( 2000 ) nLen := hb_socketRecvFrom( hSocket, @cBuffer, , , @aAddr, nEnd - nTime ) IF hb_BLeft( cBuffer, hb_BLen( cName ) + 2 ) == hb_BChar( 6 ) + cName + hb_BChar( 0 ) .AND. ; - AScan( aRet, {|x| x[ 1 ] == aAddr[ 2 ] } ) == 0 + AScan( aRet, {| x | x[ 1 ] == aAddr[ 2 ] } ) == 0 AAdd( aRet, { aAddr[ 2 ], hb_BSubStr( cBuffer, hb_BLen( cName ) + 3, nLen - hb_BLen( cName ) - 2 ) } ) ENDIF nTime := hb_MilliSeconds() @@ -59,23 +57,25 @@ STATIC FUNCTION s_sendBroadcastMessages( hSocket, nPort, cMessage ) FOR EACH cAddr IN s_getBroadcastAddresses() IF hb_socketSendTo( hSocket, cMessage, , , ; { HB_SOCKET_AF_INET, cAddr, nPort } ) == hb_BLen( cMessage ) - lResult := .t. + lResult := .T. ENDIF NEXT -RETURN lResult + + RETURN lResult STATIC FUNCTION s_getBroadcastAddresses() - LOCAL aAddrs, aIF, cAddr, lLo - lLo := .F. - aAddrs := {} + LOCAL aIF, cAddr + + LOCAL lLo := .F. + LOCAL aAddrs := {} + FOR EACH aIF IN hb_socketGetIFaces() - cAddr := aIF[ HB_SOCKET_IFINFO_BROADCAST ] - IF Empty( cAddr ) - IF !lLo .AND. aIF[ HB_SOCKET_IFINFO_ADDR ] == "127.0.0.1" + IF Empty( cAddr := aIF[ HB_SOCKET_IFINFO_BROADCAST ] ) + IF ! lLo .AND. aIF[ HB_SOCKET_IFINFO_ADDR ] == "127.0.0.1" lLo := .T. ENDIF - ELSEIF HB_AScan( aAddrs, cAddr,,, .T. ) == 0 + ELSEIF hb_AScan( aAddrs, cAddr,,, .T. ) == 0 AAdd( aAddrs, cAddr ) ENDIF NEXT @@ -83,10 +83,10 @@ STATIC FUNCTION s_getBroadcastAddresses() AAdd( aAddrs, "255.255.255.255" ) ENDIF IF lLo - HB_AIns( aAddrs, 1, "127.0.0.1", .T. ) + hb_AIns( aAddrs, 1, "127.0.0.1", .T. ) ENDIF -RETURN aAddrs + RETURN aAddrs /* Server */ @@ -138,7 +138,7 @@ STATIC PROCEDURE UDPDS( hSocket, cName, cVersion ) * Server response: ACK, ServerName, NUL, Version */ IF hb_BLeft( cBuffer, nLen ) == hb_BChar( 5 ) + cName + hb_BChar( 0 ) - BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } + BEGIN SEQUENCE WITH __BreakBlock() hb_socketSendTo( hSocket, hb_BChar( 6 ) + cName + hb_BChar( 0 ) + cVersion, , , aAddr ) END SEQUENCE ENDIF diff --git a/contrib/hbmlzo/core.c b/contrib/hbmlzo/core.c index 599d0058df..d06852bac3 100644 --- a/contrib/hbmlzo/core.c +++ b/contrib/hbmlzo/core.c @@ -1,7 +1,6 @@ /* * hbmLZO (miniLZO functions wrapper). - * miniLZO -- mini subset of the LZO real-time data compression library - * http://www.oberhumer.com/opensource/lzo/ + * miniLZO -- mini subset of the LZO real-time data compression library * * Copyright 2011 Petr Chornyj * @@ -78,7 +77,7 @@ static void hb_mlzo_init( void * cargo ) HB_SYMBOL_UNUSED( cargo ); if( lzo_init() != LZO_E_OK ) - hb_errInternal( HB_EI_VMBADSTARTUP /* TOFIX: ? */, NULL, NULL, NULL ); + hb_errInternal( HB_EI_VMBADSTARTUP /* FIXME: ? */, NULL, NULL, NULL ); } HB_CALL_ON_STARTUP_BEGIN( _hb_mlzo_init_ ) @@ -95,13 +94,13 @@ HB_CALL_ON_STARTUP_END( _hb_mlzo_init_ ) /* Compression */ /* - * int lzo1x_1_compress ( const lzo_bytep src, - * lzo_uint src_len, - * lzo_bytep dst, - * lzo_uintp dst_len, - * lzo_voidp wrkmem ); + * int lzo1x_1_compress( const lzo_bytep src, + * lzo_uint src_len, + * lzo_bytep dst, + * lzo_uintp dst_len, + * lzo_voidp wrkmem ); * - * Memory requirements: LZO1X_1_MEM_COMPRESS (64 kB on 32-bit machines) + * Memory requirements: LZO1X_1_MEM_COMPRESS (64 KiB on 32-bit machines) * * Return value: * Always returns LZO_E_OK (this function can never fail). diff --git a/contrib/hbmxml/core.c b/contrib/hbmxml/core.c index 6c5aa832e6..39f56d5b11 100644 --- a/contrib/hbmxml/core.c +++ b/contrib/hbmxml/core.c @@ -41,6 +41,7 @@ * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. + * */ #include "hbapi.h" @@ -54,18 +55,15 @@ #include "mxml.h" #include "config.h" -#define BUFFER_SIZE 8192 - -#define MXML_ERR_ARGS ( hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, \ - HB_ERR_ARGS_BASEPARAMS ) ) +#define MXML_ERR_ARGS() ( hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, \ + HB_ERR_ARGS_BASEPARAMS ) ) typedef struct /* placeholder for mxml_node_t */ { mxml_node_t * node; } HBMXML_NODE; -/* cb's funcs support */ -/* ------------------ */ +/* callback function support */ typedef struct { @@ -135,15 +133,14 @@ static HB_TSD_NEW( s_error_cb_var, sizeof( HB_ERROR_CB_VAR ), hb_error_cb_var_in hb_error_cb_var_release ); /* mxml_node_t * support */ -/* --------------------- */ -static void hbmxml_relese( mxml_node_t * node ) +static void hbmxml_release( mxml_node_t * node ) { - void * user_data; - if( mxmlGetRefCount( node ) <= ( node->parent ? 2 : 1 ) ) { - /* remove userData when last HVM item with given node is cleared + void * user_data; + + /* remove userData when last HVM item with given node is cleared * It's not nice solution because node can still exists and can * be extracted yet but there is not destructor for userData * in MXML library so we have no choice :-( [druzus] @@ -164,7 +161,7 @@ static HB_GARBAGE_FUNC( hbmxml_nodeDestructor ) if( pHbnode->node ) { - hbmxml_relese( pHbnode->node ); + hbmxml_release( pHbnode->node ); pHbnode->node = NULL; } } @@ -207,7 +204,6 @@ static void mxml_node_ret( mxml_node_t * node, int iNew ) } /* mxml_index_t * support */ -/* ---------------------- */ static HB_GARBAGE_FUNC( hbmxml_indexDestructor ) { @@ -249,16 +245,14 @@ static void mxml_index_ret( mxml_index_t * index ) hb_itemPutPtrGC( hb_stackReturnItem(), mxml_index_new( index ) ); } -/* non-wrap HB_... funcs */ -/* --------------------- */ +/* non-wrap hb_mxml*() functions */ HB_FUNC( HB_MXMLVERSION ) { hb_retc( MXML_VERSION ); } -/* MXML_... wrapper funcs */ -/* ---------------------- */ +/* mxml_*() wrapper functions */ /* * - mxmlEntityAddCallback @@ -297,7 +291,7 @@ HB_FUNC( MXMLADD ) mxmlAddRef( parent, where, ( child != NULL ) ? child : MXML_ADD_TO_PARENT, node ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* void mxmlElementDeleteAttr( mxml_node_t * node, const char * name ) */ @@ -315,7 +309,7 @@ HB_FUNC( MXMLELEMENTDELETEATTR ) hb_strfree( hName ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* const char * mxmlElementGetAttr( mxml_node_t * node, const char * name ) */ @@ -333,7 +327,7 @@ HB_FUNC( MXMLELEMENTGETATTR ) hb_strfree( hName ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* void mxmlElementSetAttr( mxml_node_t * node, const char * name, const char * value ) */ @@ -353,7 +347,7 @@ HB_FUNC( MXMLELEMENTSETATTR ) hb_strfree( hValue ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* const char * mxmlEntityGetName( int val ) */ @@ -382,9 +376,9 @@ HB_FUNC( MXMLENTITYGETVALUE ) HB_FUNC( MXMLFINDELEMENT ) { - void * hName; - void * hAttr; - void * hValue; + void * hName; + void * hAttr; + void * hValue; mxml_node_t * node = mxml_node_param( 1 ); mxml_node_t * top = mxml_node_param( 2 ); @@ -403,14 +397,14 @@ HB_FUNC( MXMLFINDELEMENT ) mxml_node_ret( nodef, 0 ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlFindPath( mxml_node_t * node, const char * path ) */ HB_FUNC( MXMLFINDPATH ) { - void * hPath; + void * hPath; mxml_node_t * node = mxml_node_param( 1 ); if( node ) @@ -422,7 +416,7 @@ HB_FUNC( MXMLFINDPATH ) hb_strfree( hPath ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* char * mxmlGetCDATA( mxml_node_t * node ) */ @@ -434,7 +428,7 @@ HB_FUNC( MXMLGETCDATA ) if( node ) hb_retstr_utf8( mxmlGetCDATA( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* char * mxmlGetElement( mxml_node_t * node ) */ @@ -446,7 +440,7 @@ HB_FUNC( MXMLGETELEMENT ) if( node ) hb_retstr_utf8( mxmlGetElement( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlGetFirstChild( mxml_node_t * node ) */ @@ -458,7 +452,7 @@ HB_FUNC( MXMLGETFIRSTCHILD ) if( node ) mxml_node_ret( mxmlGetFirstChild( node ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlGetInteger( mxml_node_t * node ) */ @@ -470,7 +464,7 @@ HB_FUNC( MXMLGETINTEGER ) if( node ) hb_retni( mxmlGetInteger( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlGetLastChild( mxml_node_t * node ) */ @@ -482,7 +476,7 @@ HB_FUNC( MXMLGETLASTCHILD ) if( node ) mxml_node_ret( mxmlGetLastChild( node ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlGetNextSibling( mxml_node_t * node ) */ @@ -494,7 +488,7 @@ HB_FUNC( MXMLGETNEXTSIBLING ) if( node ) mxml_node_ret( mxmlGetNextSibling( node ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* char * mxmlGetOpaque( mxml_node_t * node ) */ @@ -506,7 +500,7 @@ HB_FUNC( MXMLGETOPAQUE ) if( node ) hb_retstr_utf8( mxmlGetOpaque( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlGetParent( mxml_node_t * node ) */ @@ -518,7 +512,7 @@ HB_FUNC( MXMLGETPARENT ) if( node ) mxml_node_ret( mxmlGetParent( node ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlGetPrevSibling( mxml_node_t *node ) */ @@ -530,7 +524,7 @@ HB_FUNC( MXMLGETPREVSIBLING ) if( node ) mxml_node_ret( mxmlGetPrevSibling( node ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* double mxmlGetReal( mxml_node_t * node ) */ @@ -542,7 +536,7 @@ HB_FUNC( MXMLGETREAL ) if( node ) hb_retnd( mxmlGetReal( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlGetRefCount( mxml_node_t * node ) */ @@ -554,7 +548,7 @@ HB_FUNC( MXMLGETREFCOUNT ) if( node ) hb_retni( mxmlGetRefCount( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* char * mxmlGetText( mxml_node_t * node, int * whitespace ) */ @@ -571,7 +565,7 @@ HB_FUNC( MXMLGETTEXT ) hb_storni( whitespace, 2 ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_type_t mxmlGetType( mxml_node_t * node) */ @@ -583,7 +577,7 @@ HB_FUNC( MXMLGETTYPE ) if( node ) hb_retni( ( int ) mxmlGetType( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* void * mxmlGetUserData( mxml_node_t * node ) */ @@ -600,7 +594,7 @@ HB_FUNC( MXMLGETUSERDATA ) hb_itemCopy( hb_stackReturnItem(), pItem ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlIndexEnum( mxml_index_t * ind ) */ @@ -612,7 +606,7 @@ HB_FUNC( MXMLINDEXENUM ) if( index ) mxml_node_ret( mxmlIndexEnum( index ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlIndexFind( mxml_index_t * ind, const char * element, const char * value ) */ @@ -623,8 +617,8 @@ HB_FUNC( MXMLINDEXFIND ) if( index ) { - void * hElement; - void * hValue; + void * hElement; + void * hValue; mxml_node_t * nodef = mxmlIndexFind( index, hb_parstr_utf8( 2, &hElement, NULL ), hb_parstr_utf8( 3, &hValue, NULL ) ); @@ -635,7 +629,7 @@ HB_FUNC( MXMLINDEXFIND ) mxml_node_ret( nodef, 0 ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* void mxmlIndexDelete( mxml_index_t * ind ) */ @@ -651,7 +645,7 @@ HB_FUNC( MXMLINDEXDELETE ) *ppIndex = NULL; } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlIndexGetCount( mxml_index_t * ind ) */ @@ -663,7 +657,7 @@ HB_FUNC( MXMLINDEXGETCOUNT ) if( index ) hb_retni( mxmlIndexGetCount( index ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_index_t * mxmlIndexNew( mxml_node_t * node, const char * element, const char * attr ) */ @@ -687,7 +681,7 @@ HB_FUNC( MXMLINDEXNEW ) mxml_index_ret( index ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlIndexReset( mxml_index_t * ind ) */ @@ -699,11 +693,10 @@ HB_FUNC( MXMLINDEXRESET ) if( index ) mxml_node_ret( mxmlIndexReset( index ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_type_t type_cb( mxml_node_t * node ) */ -/* ----------------------------------------- */ static mxml_type_t type_cb( mxml_node_t * node ) { @@ -748,7 +741,7 @@ HB_FUNC( MXMLLOADFILE ) if( ! node_top ) { - MXML_ERR_ARGS; + MXML_ERR_ARGS(); return; } } @@ -807,7 +800,7 @@ HB_FUNC( MXMLLOADSTRING ) if( ! node_top ) { - MXML_ERR_ARGS; + MXML_ERR_ARGS(); return; } } @@ -843,7 +836,7 @@ HB_FUNC( MXMLLOADSTRING ) HB_FUNC( MXMLNEWCDATA ) { - void * hString; + void * hString; mxml_node_t * node; if( HB_ISNIL( 1 ) || ( HB_ISNUM( 1 ) && hb_parni( 1 ) == MXML_NO_PARENT ) ) @@ -867,7 +860,7 @@ HB_FUNC( MXMLNEWCDATA ) hb_strfree( hString ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } } @@ -875,7 +868,7 @@ HB_FUNC( MXMLNEWCDATA ) HB_FUNC( MXMLNEWELEMENT ) { - void * hName; + void * hName; mxml_node_t * node; if( HB_ISNIL( 1 ) || ( HB_ISNUM( 1 ) && hb_parni( 1 ) == MXML_NO_PARENT ) ) @@ -899,7 +892,7 @@ HB_FUNC( MXMLNEWELEMENT ) hb_strfree( hName ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } } @@ -916,7 +909,7 @@ HB_FUNC( MXMLNEWINTEGER ) if( node_parent ) mxml_node_ret( mxmlNewInteger( node_parent, hb_parni( 2 ) ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } } @@ -924,7 +917,7 @@ HB_FUNC( MXMLNEWINTEGER ) HB_FUNC( MXMLNEWOPAQUE ) { - void * hOpaque; + void * hOpaque; mxml_node_t * node; if( HB_ISNIL( 1 ) || ( HB_ISNUM( 1 ) && hb_parni( 1 ) == MXML_NO_PARENT ) ) @@ -948,7 +941,7 @@ HB_FUNC( MXMLNEWOPAQUE ) hb_strfree( hOpaque ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } } @@ -965,7 +958,7 @@ HB_FUNC( MXMLNEWREAL ) if( node_parent ) mxml_node_ret( mxmlNewReal( node_parent, hb_parnd( 2 ) ), 0 ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } } @@ -973,7 +966,7 @@ HB_FUNC( MXMLNEWREAL ) HB_FUNC( MXMLNEWTEXT ) { - void * hString; + void * hString; mxml_node_t * node; if( HB_ISNIL( 1 ) || ( HB_ISNUM( 1 ) && hb_parni( 1 ) == MXML_NO_PARENT ) ) @@ -999,7 +992,7 @@ HB_FUNC( MXMLNEWTEXT ) hb_strfree( hString ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } } @@ -1045,7 +1038,7 @@ HB_FUNC( MXMLREMOVE ) if( node ) mxmlRemoveRef( node ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* void mxmlDelete( mxml_node_t * node ) */ @@ -1057,11 +1050,11 @@ HB_FUNC( MXMLDELETE ) if( pHbnode && pHbnode->node ) { mxmlRemoveRef( pHbnode->node ); - hbmxml_relese( pHbnode->node ); + hbmxml_release( pHbnode->node ); pHbnode->node = NULL; } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } #if 0 @@ -1074,7 +1067,7 @@ HB_FUNC( MXMLRELEASE ) if( node ) hb_retni( mxmlRelease( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlRetain( mxml_node_t * node ) */ @@ -1086,7 +1079,7 @@ HB_FUNC( MXMLRETAIN ) if( node ) hb_retni( mxmlRetain( node ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } #endif @@ -1121,14 +1114,12 @@ static void sax_cb( mxml_node_t * node, mxml_sax_event_t event, void * data ) } } -/* - mxml_node_t * mxmlSAXLoadFile( mxml_node_t * top, +/* mxml_node_t * mxmlSAXLoadFile( mxml_node_t * top, FILE * fp, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void * sax_data ) */ - HB_FUNC( MXMLSAXLOADFILE ) { mxml_node_t * node_top; @@ -1147,7 +1138,7 @@ HB_FUNC( MXMLSAXLOADFILE ) if( ! node_top ) { - MXML_ERR_ARGS; + MXML_ERR_ARGS(); return; } } @@ -1191,14 +1182,12 @@ HB_FUNC( MXMLSAXLOADFILE ) pCbs->sax_cb = NULL; } -/* - mxml_node_t * mxmlSAXLoadString( mxml_node_t * top, +/* mxml_node_t * mxmlSAXLoadString( mxml_node_t * top, const char * s, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void * sax_data ) */ - HB_FUNC( MXMLSAXLOADSTRING ) { void * hFree; @@ -1218,7 +1207,7 @@ HB_FUNC( MXMLSAXLOADSTRING ) if( ! node_top ) { - MXML_ERR_ARGS; + MXML_ERR_ARGS(); return; } } @@ -1308,7 +1297,7 @@ HB_FUNC( MXMLSAVEALLOCSTRING ) { mxml_save_cb_t cb = MXML_NO_CALLBACK; HB_CBS_VAR * pCbs = ( HB_CBS_VAR * ) hb_stackGetTSD( &s_cbs_var ); - char buffer[ BUFFER_SIZE ]; + char buffer[ 8192 ]; int bytes; if( HB_ISBLOCK( 2 ) || HB_ISSYMBOL( 2 ) ) @@ -1317,7 +1306,7 @@ HB_FUNC( MXMLSAVEALLOCSTRING ) cb = save_cb; } - bytes = mxmlSaveString( node, buffer, BUFFER_SIZE, cb ); + bytes = mxmlSaveString( node, buffer, sizeof( buffer ), cb ); pCbs->save_cb = NULL; if( pCbs->hText ) { @@ -1343,16 +1332,17 @@ HB_FUNC( MXMLSAVEALLOCSTRING ) } } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } HB_FUNC( MXMLSAVEFILE ) { mxml_node_t * node = mxml_node_param( 1 ); - FILE * file; if( node && HB_ISCHAR( 2 ) ) { + FILE * file; + mxml_save_cb_t cb = MXML_NO_CALLBACK; HB_CBS_VAR * pCbs = ( HB_CBS_VAR * ) hb_stackGetTSD( &s_cbs_var ); @@ -1377,7 +1367,7 @@ HB_FUNC( MXMLSAVEFILE ) } } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlSaveString( mxml_node_t * node, char * buffer, int bufsize, mxml_save_cb_t cb ) */ @@ -1424,7 +1414,7 @@ HB_FUNC( MXMLSAVESTRING ) } } - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlSetCDATA( mxml_node_t * node, const char * data ) */ @@ -1442,7 +1432,7 @@ HB_FUNC( MXMLSETCDATA ) hb_strfree( hData ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlSetElement( mxml_node_t * node, const char * name ) */ @@ -1460,7 +1450,7 @@ HB_FUNC( MXMLSETELEMENT ) hb_strfree( hFree ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* void ( * mxml_error_cb_t )( const char * ) */ @@ -1522,7 +1512,7 @@ HB_FUNC( MXMLSETINTEGER ) if( node ) hb_retni( mxmlSetInteger( node, hb_parnidef( 2, 0 ) ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlSetOpaque( mxml_node_t * node, const char * opaque ) */ @@ -1540,7 +1530,7 @@ HB_FUNC( MXMLSETOPAQUE ) hb_strfree( hOpaque ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlSetReal( mxml_node_t * node, double real ) */ @@ -1552,7 +1542,7 @@ HB_FUNC( MXMLSETREAL ) if( node ) hb_retni( mxmlSetReal( node, hb_parnd( 2 ) ) ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlSetText( mxml_node_t * node, int whitespace, const char * string ) */ @@ -1570,7 +1560,7 @@ HB_FUNC( MXMLSETTEXT ) hb_strfree( hString ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int mxmlSetUserData(mxml_node_t * node, void * data ) */ @@ -1587,7 +1577,7 @@ HB_FUNC( MXMLSETUSERDATA ) hb_retni( mxmlSetUserData( node, pItem ) ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* void mxmlSetWrapMargin( int column ) */ @@ -1611,7 +1601,7 @@ HB_FUNC( MXMLWALKNEXT ) mxml_node_ret( node_next, 0 ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* mxml_node_t * mxmlWalkPrev( mxml_node_t * node, mxml_node_t * top, int descend ) */ @@ -1628,7 +1618,7 @@ HB_FUNC( MXMLWALKPREV ) mxml_node_ret( node_prev, 0 ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* const void * mxmlGetCustom( mxml_node_t * node ) */ @@ -1645,7 +1635,7 @@ HB_FUNC( MXMLGETCUSTOM ) hb_itemReturn( pItem ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* void ( * mxml_custom_destroy_cb_t )( void * ) */ @@ -1658,11 +1648,9 @@ static void custom_destroy_cb( void * Cargo ) hb_itemRelease( pItem ); } -/* - mxml_node_t * mxmlNewCustom( mxml_node_t * parent, +/* mxml_node_t * mxmlNewCustom( mxml_node_t * parent, void * data, mxml_custom_destroy_cb_t destroy ) */ - HB_FUNC( MXMLNEWCUSTOM ) { if( hb_pcount() > 1 ) @@ -1689,14 +1677,13 @@ HB_FUNC( MXMLNEWCUSTOM ) hb_itemRelease( pItem ); } - MXML_ERR_ARGS; + + MXML_ERR_ARGS(); } -/* - int mxmlSetCustom ( mxml_node_t * node, +/* int mxmlSetCustom ( mxml_node_t * node, void * data, mxml_custom_destroy_cb_t destroy ) */ - HB_FUNC( MXMLSETCUSTOM ) { mxml_node_t * node = mxml_node_param( 1 ); @@ -1704,11 +1691,10 @@ HB_FUNC( MXMLSETCUSTOM ) if( node && hb_pcount() > 1 ) { PHB_ITEM pItem = hb_itemClone( hb_param( 2, HB_IT_ANY ) ); - int iResult; if( pItem ) { - iResult = mxmlSetCustom( node, pItem, custom_destroy_cb ); + int iResult = mxmlSetCustom( node, pItem, custom_destroy_cb ); if( iResult < 0 ) hb_itemRelease( pItem ); @@ -1717,7 +1703,7 @@ HB_FUNC( MXMLSETCUSTOM ) } } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } /* int ( * mxml_custom_load_cb_t )( mxml_node_t *, const char * ) */ @@ -1762,7 +1748,7 @@ static char * custom_save_cb( mxml_node_t * node ) if( pCallback && hb_vmRequestReenter() ) { - char * pszResult; + char * pszResult; const char * pszText; void * hText; @@ -1827,7 +1813,6 @@ HB_FUNC( MXMLSETCUSTOMHANDLERS ) } /* temporary solution before final 2.7 release */ -/* ------------------------------------------- */ HB_FUNC( HB_MXMLGETATTRSCOUNT ) { @@ -1836,7 +1821,7 @@ HB_FUNC( HB_MXMLGETATTRSCOUNT ) if( node && mxmlGetType( node ) == MXML_ELEMENT ) hb_retni( node->value.element.num_attrs ); else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } HB_FUNC( HB_MXMLGETATTRSARRAY ) @@ -1845,9 +1830,9 @@ HB_FUNC( HB_MXMLGETATTRSARRAY ) if( node && mxmlGetType( node ) == MXML_ELEMENT ) { - PHB_ITEM pAttrs = hb_itemArrayNew( 0 ), - pAttr = hb_itemNew( NULL ); - int i; + PHB_ITEM pAttrs = hb_itemArrayNew( 0 ); + PHB_ITEM pAttr = hb_itemNew( NULL ); + int i; mxml_attr_t * attr; for( i = node->value.element.num_attrs, attr = node->value.element.attrs; @@ -1866,7 +1851,7 @@ HB_FUNC( HB_MXMLGETATTRSARRAY ) hb_itemReturnRelease( pAttrs ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } HB_FUNC( HB_MXMLGETATTRS ) @@ -1875,10 +1860,10 @@ HB_FUNC( HB_MXMLGETATTRS ) if( node && mxmlGetType( node ) == MXML_ELEMENT ) { - PHB_ITEM pAttrs = hb_hashNew( hb_itemNew( NULL ) ), - pKey = NULL, - pValue = NULL; - int i; + PHB_ITEM pAttrs = hb_hashNew( hb_itemNew( NULL ) ); + PHB_ITEM pKey = NULL; + PHB_ITEM pValue = NULL; + int i; mxml_attr_t * attr; for( i = node->value.element.num_attrs, attr = node->value.element.attrs; @@ -1896,5 +1881,5 @@ HB_FUNC( HB_MXMLGETATTRS ) hb_itemReturnRelease( pAttrs ); } else - MXML_ERR_ARGS; + MXML_ERR_ARGS(); } diff --git a/contrib/hbmysql/mysql.c b/contrib/hbmysql/mysql.c index 4f52e7d1a5..0c7df1a313 100644 --- a/contrib/hbmysql/mysql.c +++ b/contrib/hbmysql/mysql.c @@ -1,8 +1,9 @@ /* - * MySQL DBMS low level (client api) interface code. + * MySQL DBMS low-level (client API) interface code. * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) (GC support) * Copyright 2000 Maurilio Longo + * Copyright 2001 Luiz Rafael Culik (DATATOSQL(), FILETOSQLBINARY()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,16 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2001 Luiz Rafael Culik - * DATATOSQL(), FILETOSQLBINARY() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapierr.h" #include "hbapiitm.h" @@ -67,8 +58,9 @@ #include "mysql.h" -/* NOTE: OS/2 EMX port of MySQL needs libmysqlclient.a from 3.21.33b build which has st and mt - versions of client library. I'm using ST version since harbour is single threaded. +/* NOTE: OS/2 EMX port of MySQL needs libmysqlclient.a from 3.21.33b build + which has ST and MT versions of client library. I'm using ST version + since Harbour is single threaded. You need also .h files from same distribution. */ /* GC object handlers */ diff --git a/contrib/hbmysql/mysql.ch b/contrib/hbmysql/mysql.ch index db699c5d74..606b6d2889 100644 --- a/contrib/hbmysql/mysql.ch +++ b/contrib/hbmysql/mysql.ch @@ -1,6 +1,6 @@ /* * MySQL DBMS defines - * These defines are clipper code level equivalent of mysql.h and mysql_com.h + * These defines are Cl*pper code level equivalent of mysql.h and mysql_com.h * * Copyright 2000 Maurilio Longo * @@ -50,7 +50,7 @@ /* MySQL field types */ #define MYSQL_TYPE_DECIMAL 0 -#define MYSQL_TYPE_TINY 1 /* NOTE: TINY is used to map clipper logical values to MySQL tables, so 0 == .F., 1 == .T. */ +#define MYSQL_TYPE_TINY 1 /* NOTE: TINY is used to map Cl*pper logical values to MySQL tables, so 0 == .F., 1 == .T. */ #define MYSQL_TYPE_SHORT 2 #define MYSQL_TYPE_LONG 3 #define MYSQL_TYPE_FLOAT 4 @@ -78,7 +78,7 @@ #define MYSQL_TYPE_GEOMETRY 255 /* MySQL field structure item number - (C level structure is translated to a clipper array) */ + (C level structure is translated to a Cl*pper array) */ #define MYSQL_FS_NAME 1 /* Name of column */ #define MYSQL_FS_TABLE 2 /* Table of column if column was a field */ #define MYSQL_FS_DEF 3 /* Default value (set by mysql_list_fields) */ @@ -89,20 +89,20 @@ #define MYSQL_FS_DECIMALS 8 /* Number of decimals in field */ /* MySQL field flags */ -#define NOT_NULL_FLAG 1 /* Field can't be NULL */ -#define PRI_KEY_FLAG 2 /* Field is part of a primary key */ -#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ -#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ -#define BLOB_FLAG 16 /* Field is a blob */ -#define UNSIGNED_FLAG 32 /* Field is unsigned */ -#define ZEROFILL_FLAG 64 /* Field is zerofill */ -#define BINARY_FLAG 128 +#define NOT_NULL_FLAG hb_bitShift( 1, 0 ) /* Field cannot be NULL */ +#define PRI_KEY_FLAG hb_bitShift( 1, 1 ) /* Field is part of a primary key */ +#define UNIQUE_KEY_FLAG hb_bitShift( 1, 2 ) /* Field is part of a unique key */ +#define MULTIPLE_KEY_FLAG hb_bitShift( 1, 3 ) /* Field is part of a key */ +#define BLOB_FLAG hb_bitShift( 1, 4 ) /* Field is a blob */ +#define UNSIGNED_FLAG hb_bitShift( 1, 5 ) /* Field is unsigned */ +#define ZEROFILL_FLAG hb_bitShift( 1, 6 ) /* Field is zerofill */ +#define BINARY_FLAG hb_bitShift( 1, 7 ) /* The following are only sent to new clients */ -#define ENUM_FLAG 256 /* field is an enum */ -#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ -#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ -#define PART_KEY_FLAG 16384 /* Intern; Part of some key */ -#define GROUP_FLAG 32768 /* Intern group field */ +#define ENUM_FLAG hb_bitShift( 1, 8 ) /* field is an enum */ +#define AUTO_INCREMENT_FLAG hb_bitShift( 1, 9 ) /* field is a auto-increment field */ +#define TIMESTAMP_FLAG hb_bitShift( 1, 10 ) /* Field is a timestamp */ +#define PART_KEY_FLAG hb_bitShift( 1, 14 ) /* Intern; Part of some key */ +#define GROUP_FLAG hb_bitShift( 1, 15 ) /* Intern group field */ /* Extension to DBS_xxx defines to encompass NOT NULL fields, needed by indexes */ #define DBS_NOTNULL 5 /* True if field has to be NOT NULL */ diff --git a/contrib/hbmysql/readme.txt b/contrib/hbmysql/readme.txt index 8c2c105c66..1aabcbb1fa 100644 --- a/contrib/hbmysql/readme.txt +++ b/contrib/hbmysql/readme.txt @@ -1,42 +1,25 @@ - +---------------------------------------------------------+ - | 2001-11-22 - Harbour MySQL access classes - readme file | - +---------------------------------------------------------+ +2001-11-22 - Harbour MariaDB/MySQL access classes - readme +========================================================== This is work in progress, so it has to be fully tested and needs a few more methods to cover MySQL possibilities. -This set of files gives you a mean to access a MySQL server, I've developed and tested them on a OS/2 platform, -In their present state MySQL classes are made up of these files: - -mysql.c : low level wrapper around MySQL client API. -mysql.ch : clipper level defines of MySQL types -tmysql.prg : MySQL access classes -test.prg : a little test program which wont work for you :-) since it uses a .dbf file not - provided. Use it as a small tutorial of tmysql.prg provided functions. +Add hbmysql.hbc to your hbmk2 command-line (you can also try to +recompile programs in utils and tests subdirs just to test everything) +and be sure to have MySQL dynamic libraries configured. -1) See README on how to obtain/install and configure Harbour build - system for mysql. +Available Classes +================= -2) Add hbmysql.hbc to your hbmk2 command line (you can also try to - recompile programs in utils and tests subdirs just to test everything) - and be sure to have MySQL dynamic libraries configured. - - - +---------------------+ - | Available Classes | - +---------------------+ - - -tmysql.prg defines four classes: TMySQLServer: manages access to a MySQL server and returns an oServer object to which you'll send all your queries; TMySQLQuery: a standard query to an oServer with joins. Every query has a GetRow() method which on every call returns a TMySQLRow object which, in turn, contains requested fields. - Query objects convert MySQL answers (which is an array of strings) to clipper level types. - At present time N (with decimals), L, D, and C clipper types are supported. + Query objects convert MySQL answers (which is an array of strings) to Cl*pper level types. + At present time N (with decimals), L, D, and C Cl*pper types are supported. TMySQLTable: It's a descendant of a TMySQLQuery and you'll receive it when your query has no joins. It adds Update(), Append() and Delete() methods which receive a TMySQLRow object and reflect changes to the MySQL table from which they come. @@ -53,6 +36,6 @@ I'm aware that this brief document doesn't explain a lot about MySQL access clas I'll try to update it as work on these classes goes by and I'll like to receive feedback and suggestions from users (if any :-)) -Excuse my poor english and happy selecting :-) +Excuse my poor English and happy selecting :-) Maurilio Longo - diff --git a/contrib/hbmysql/tmysql.prg b/contrib/hbmysql/tmysql.prg index 75158c5571..95857dacef 100644 --- a/contrib/hbmysql/tmysql.prg +++ b/contrib/hbmysql/tmysql.prg @@ -1,6 +1,6 @@ /* * MySQL DBMS classes. - * These classes try to emulate clipper dbXXXX functions on a SQL query + * These classes try to emulate Cl*pper db*() functions on a SQL query * * Copyright 2000 Maurilio Longo * @@ -57,7 +57,7 @@ CREATE CLASS TMySQLRow VAR aRow // a single row of answer VAR aDirty // array of booleans set to .T. if corresponding field of aRow has been changed - VAR aOldValue // If aDirty[n] is .T. aOldValue[n] keeps a copy of changed value if aRow[n] is part of a primary key + VAR aOldValue // If aDirty[ n ] is .T. aOldValue[ n ] keeps a copy of changed value if aRow[ n ] is part of a primary key VAR aOriValue // Original values ( same as TMySQLtable:aOldValue ) @@ -66,14 +66,14 @@ CREATE CLASS TMySQLRow METHOD New( aRow, aFStruct, cTableName ) // Create a new Row object - METHOD FieldGet( cnField ) // Same as clipper ones, but FieldGet() and FieldPut() accept a string as + METHOD FieldGet( cnField ) // Same as Cl*pper ones, but FieldGet() and FieldPut() accept a string as METHOD FieldPut( cnField, Value ) // field identifier, not only a number METHOD FieldName( nNum ) METHOD FieldPos( cFieldName ) METHOD FieldLen( nNum ) // Length of field N METHOD FieldDec( nNum, lFormat ) // How many decimals in field N - METHOD FieldType( nNum ) // Clipper type of field N + METHOD FieldType( nNum ) // Cl*pper type of field N METHOD MakePrimaryKeyWhere() // returns a WHERE x=y statement which uses primary key (if available) @@ -98,7 +98,6 @@ METHOD New( aRow, aFStruct, cTableName ) CLASS TMySQLRow RETURN Self - METHOD FieldGet( cnField ) CLASS TMySQLRow LOCAL nNum := iif( HB_ISSTRING( cnField ), ::FieldPos( cnField ), cnField ) @@ -115,7 +114,6 @@ METHOD FieldGet( cnField ) CLASS TMySQLRow RETURN NIL - METHOD FieldPut( cnField, Value ) CLASS TMySQLRow LOCAL nNum := iif( HB_ISSTRING( cnField ), ::FieldPos( cnField ), cnField ) @@ -143,7 +141,6 @@ METHOD FieldPut( cnField, Value ) CLASS TMySQLRow RETURN NIL - // Given a field name returns it's position METHOD FieldPos( cFieldName ) CLASS TMySQLRow @@ -151,21 +148,16 @@ METHOD FieldPos( cFieldName ) CLASS TMySQLRow RETURN AScan( ::aFieldStruct, {| aItem | Upper( aItem[ MYSQL_FS_NAME ] ) == cUpperName } ) - // Returns name of field N METHOD FieldName( nNum ) CLASS TMySQLRow - RETURN iif( nNum >= 1 .AND. nNum <= Len( ::aFieldStruct ), ::aFieldStruct[ nNum ][ MYSQL_FS_NAME ], "" ) - METHOD FieldLen( nNum ) CLASS TMySQLRow - RETURN iif( nNum >= 1 .AND. nNum <= Len( ::aFieldStruct ), ::aFieldStruct[ nNum ][ MYSQL_FS_LENGTH ], 0 ) -/* - lFormat: when .T. method returns number of formatted decimal places from mysql table otherwise _SET_DECIMALS. - lFormat is usefull for copying table structure from mysql to dbf -*/ +/* lFormat: when .T. method returns number of formatted decimal places from mysql table otherwise _SET_DECIMALS. + lFormat is useful for copying table structure from mysql to dbf + */ METHOD FieldDec( nNum, lFormat ) CLASS TMySQLRow hb_default( @lFormat, .F. ) @@ -182,7 +174,6 @@ METHOD FieldDec( nNum, lFormat ) CLASS TMySQLRow RETURN 0 - METHOD FieldType( nNum ) CLASS TMySQLRow IF nNum >= 1 .AND. nNum <= Len( ::aFieldStruct ) @@ -215,7 +206,6 @@ METHOD FieldType( nNum ) CLASS TMySQLRow RETURN "U" - // returns a WHERE x=y statement which uses primary key (if available) METHOD MakePrimaryKeyWhere() CLASS TMySQLRow @@ -240,7 +230,6 @@ METHOD MakePrimaryKeyWhere() CLASS TMySQLRow cWhere += ClipValue2SQL( ::aRow[ nI ] ) ENDIF ENDIF - NEXT IF ! Empty( cWhere ) @@ -249,7 +238,7 @@ METHOD MakePrimaryKeyWhere() CLASS TMySQLRow RETURN cWhere -/* -------------------------------------------------------- */ +/* --- */ // Every single query submitted to MySQL server CREATE CLASS TMySQLQuery @@ -282,7 +271,7 @@ CREATE CLASS TMySQLQuery METHOD GetRow( nRow ) // return Row n of answer - METHOD Skip( nRows ) // Same as clipper ones + METHOD Skip( nRows ) // Same as Cl*pper ones METHOD Bof() INLINE ::lBof METHOD Eof() INLINE ::lEof @@ -303,7 +292,7 @@ CREATE CLASS TMySQLQuery METHOD FieldLen( nNum ) // Length of field N METHOD FieldDec( nNum, lFormat ) // How many decimals in field N - METHOD FieldType( nNum ) // Clipper type of field N + METHOD FieldType( nNum ) // Cl*pper type of field N ENDCLASS @@ -337,13 +326,11 @@ METHOD New( nSocket, cQuery ) CLASS TMySQLQuery ::aRow := Array( ::nNumFields ) FOR nI := 1 TO ::nNumFields - aField := mysql_fetch_field( ::nResultHandle ) AAdd( ::aFieldStruct, aField ) IF ::lFieldAsData __objAddData( Self, ::aFieldStruct[ nI ][ MYSQL_FS_NAME ] ) ENDIF - NEXT ::getRow( ::nCurRow ) @@ -356,7 +343,6 @@ METHOD New( nSocket, cQuery ) CLASS TMySQLQuery RETURN Self - METHOD Refresh() CLASS TMySQLQuery // free present result handle @@ -396,7 +382,7 @@ METHOD Refresh() CLASS TMySQLQuery METHOD Skip( nRows ) CLASS TMySQLQuery - LOCAL lbof + LOCAL lBof // NOTE: MySQL row count starts from 0 hb_default( @nRows, 1 ) @@ -410,7 +396,7 @@ METHOD Skip( nRows ) CLASS TMySQLQuery // Negative movement IF ( ::RecNo() + nRows ) < 1 nRows := - ::RecNo() + 1 - // Clipper: only SKIP movement can set Bof() to .T. + // Cl*pper: only SKIP movement can set Bof() to .T. ::lBof := .T. // Try to skip before first record ENDIF ELSE @@ -423,13 +409,13 @@ METHOD Skip( nRows ) CLASS TMySQLQuery ::nCurRow := ::nCurRow + nRows // Maintain ::bof() true until next movement - // Clipper: only SKIP movement can set Bof() to .T. - lbof := ::Bof() + // Cl*pper: only SKIP movement can set Bof() to .T. + lBof := ::Bof() // mysql_data_seek( ::nResultHandle, ::nCurRow - 1 ) ::getRow( ::nCurrow ) - IF lbof + IF lBof ::lBof := .T. ENDIF @@ -531,18 +517,14 @@ METHOD GetRow( nRow ) CLASS TMySQLQuery IF ::lFieldAsData __objSetValueList( Self, { { ::aFieldStruct[ i ][ MYSQL_FS_NAME ], ::aRow[ i ] } } ) ENDIF - NEXT oRow := TMySQLRow():New( ::aRow, ::aFieldStruct ) - ENDIF - ENDIF RETURN iif( ::aRow == NIL, NIL, oRow ) - // Free result handle and associated resources METHOD Destroy() CLASS TMySQLQuery @@ -550,12 +532,9 @@ METHOD Destroy() CLASS TMySQLQuery RETURN Self - METHOD FCount() CLASS TMySQLQuery - RETURN ::nNumFields - METHOD Error() CLASS TMySQLQuery ::lError := .F. @@ -620,7 +599,6 @@ METHOD FieldGet( cnField ) CLASS TMySQLQuery RETURN NIL - METHOD FieldLen( nNum ) CLASS TMySQLQuery IF nNum >= 1 .AND. nNum <= Len( ::aFieldStruct ) @@ -628,12 +606,9 @@ METHOD FieldLen( nNum ) CLASS TMySQLQuery ENDIF RETURN 0 +/* lFormat: when .T. method returns number of formatted decimal places from mysql table otherwise _SET_DECIMALS. - -/* - lFormat: when .T. method returns number of formatted decimal places from mysql table otherwise _SET_DECIMALS. - lFormat is usefull for copying table structure from mysql to dbf -*/ + lFormat is useful for copying table structure from mysql to dbf */ METHOD FieldDec( nNum, lFormat ) CLASS TMySQLQuery hb_default( @lFormat, .F. ) @@ -649,11 +624,9 @@ METHOD FieldDec( nNum, lFormat ) CLASS TMySQLQuery RETURN 0 - METHOD FieldType( nNum ) CLASS TMySQLQuery IF nNum >= 1 .AND. nNum <= Len( ::aFieldStruct ) - SWITCH ::aFieldStruct[ nNum ][ MYSQL_FS_TYPE ] CASE MYSQL_TYPE_TINY CASE MYSQL_TYPE_SHORT @@ -682,12 +655,12 @@ METHOD FieldType( nNum ) CLASS TMySQLQuery RETURN "U" -/* -------------------------------------------------------- */ +/* --- */ // A Table is a query without joins; this way I can Insert() e Delete() rows. // NOTE: it's always a SELECT result, so it will contain a full table only if // SELECT * FROM ... was issued -CREATE CLASS TMySQLTable FROM TMySQLQuery +CREATE CLASS TMySQLTable INHERIT TMySQLQuery VAR cTable // name of table VAR aOldValue // keeps a copy of old value @@ -731,7 +704,6 @@ METHOD New( nSocket, cQuery, cTableName ) CLASS TMySQLTable RETURN Self - METHOD GetRow( nRow ) CLASS TMySQLTable LOCAL oRow := ::super:GetRow( nRow ), i @@ -748,7 +720,6 @@ METHOD GetRow( nRow ) CLASS TMySQLTable RETURN oRow - METHOD Skip( nRow ) CLASS TMySQLTable LOCAL i @@ -761,7 +732,6 @@ METHOD Skip( nRow ) CLASS TMySQLTable RETURN NIL - /* Creates an update query for changed fields and submits it to server */ METHOD Update( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable @@ -819,13 +789,10 @@ METHOD Update( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable ::aOldValue[ i ] := ::FieldGet( i ) NEXT ENDIF - ELSE ::lError := .T. ENDIF - ELSE - IF oRow:cTable == ::cTable FOR i := 1 TO Len( oRow:aRow ) @@ -855,19 +822,18 @@ METHOD Update( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable IF mysql_query( ::nSocket, cUpdateQuery ) == 0 - // All values are commited + // All values are committed AFill( oRow:aDirty, .F. ) AFill( oRow:aOldValue, NIL ) oRow:aOriValue := AClone( oRow:aRow ) - // Clipper maintain same record pointer + // Cl*pper maintain same record pointer // After refresh(), position of current record is often unpredictable IF lRefresh ::refresh() ENDIF - ELSE ::lError := .T. ENDIF @@ -876,7 +842,6 @@ METHOD Update( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable RETURN ! ::lError - METHOD Delete( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable LOCAL cDeleteQuery := "DELETE FROM " + ::cTable, i @@ -903,7 +868,6 @@ METHOD Delete( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable // remove last " AND " cWhere := Left( cWhere, Len( cWhere ) - 5 ) cDeleteQuery += cWhere - ELSE // MakePrimaryKeyWhere is based in fields part of a primary key cDeleteQuery += ::MakePrimaryKeyWhere() @@ -911,7 +875,7 @@ METHOD Delete( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable IF mysql_query( ::nSocket, cDeleteQuery ) == 0 ::lError := .F. - // Clipper maintain same record pointer + // Cl*pper maintain same record pointer // After refresh(), position of current record is often unpredictable IF lRefresh @@ -924,7 +888,6 @@ METHOD Delete( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable ELSE ::lError := .T. ENDIF - ELSE IF oRow:cTable == ::cTable @@ -955,7 +918,6 @@ METHOD Delete( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable IF lRefresh ::refresh() ENDIF - ELSE ::lError := .T. ENDIF @@ -964,7 +926,6 @@ METHOD Delete( oRow, lOldRecord, lRefresh ) CLASS TMySQLTable RETURN ! ::lError - // Adds a row with values passed into oRow METHOD Append( oRow, lRefresh ) CLASS TMySQLTable @@ -997,7 +958,7 @@ METHOD Append( oRow, lRefresh ) CLASS TMySQLTable IF mysql_query( ::nSocket, cInsertQuery ) == 0 ::lError := .F. - // Clipper add record at end + // Cl*pper add record at end ::nCurRow := ::LastRec() + 1 // After refresh(), position of current record is often unpredictable @@ -1016,7 +977,6 @@ METHOD Append( oRow, lRefresh ) CLASS TMySQLTable ELSE ::lError := .T. ENDIF - ELSE IF oRow:cTable == ::cTable @@ -1043,13 +1003,13 @@ METHOD Append( oRow, lRefresh ) CLASS TMySQLTable IF mysql_query( ::nSocket, cInsertQuery ) == 0 ::lError := .F. - // All values are commited + // All values are committed AFill( oRow:aDirty, .F. ) AFill( oRow:aOldValue, NIL ) oRow:aOriValue := AClone( oRow:aRow ) - // Clipper add record at end + // Cl*pper add record at end ::nCurRow := ::LastRec() + 1 // After refresh(), position of current record is often unpredictable @@ -1062,12 +1022,10 @@ METHOD Append( oRow, lRefresh ) CLASS TMySQLTable ::lError := .T. ENDIF ENDIF - ENDIF RETURN .F. - METHOD GetBlankRow( lSetValues ) CLASS TMySQLTable LOCAL i @@ -1120,7 +1078,6 @@ METHOD GetBlankRow( lSetValues ) CLASS TMySQLTable RETURN TMySQLRow():New( aRow, ::aFieldStruct, ::cTable, .F. ) - METHOD FieldPut( cnField, Value ) CLASS TMySQLTable LOCAL nNum @@ -1151,7 +1108,6 @@ METHOD FieldPut( cnField, Value ) CLASS TMySQLTable RETURN NIL - METHOD Refresh() CLASS TMySQLTABLE // free present result handle @@ -1189,7 +1145,6 @@ METHOD Refresh() CLASS TMySQLTABLE RETURN ! ::lError - // returns a WHERE x=y statement which uses primary key (if available) METHOD MakePrimaryKeyWhere() CLASS TMySQLTable @@ -1215,7 +1170,7 @@ METHOD MakePrimaryKeyWhere() CLASS TMySQLTable RETURN cWhere -/* -------------------------------------------------------- */ +/* --- */ // Every available MySQL server CREATE CLASS TMySQLServer @@ -1328,7 +1283,6 @@ METHOD CreateDatabase( cDataBase ) CLASS TMySQLServer RETURN .F. - // NOTE: OS/2 port of MySQL is picky about table names, that is if you create a table with // an upper case name you cannot alter it (for example) using a lower case name, this violates // OS/2 case insensibility about names @@ -1416,7 +1370,6 @@ METHOD CreateTable( cTable, aStruct, cPrimaryKey, cUniqueKey, cAuto ) CLASS TMyS RETURN .F. - METHOD CreateIndex( cName, cTable, aFNames, lUnique ) CLASS TMySQLServer LOCAL cCreateQuery := "CREATE " @@ -1515,25 +1468,20 @@ METHOD Query( cQuery ) CLASS TMySQLServer RETURN oQuery - METHOD Error() CLASS TMySQLServer ::lError := .F. RETURN iif( Empty( ::nSocket ), "No connection to server", mysql_error( ::nSocket ) ) - METHOD ListDBs() CLASS TMySQLServer - RETURN mysql_list_dbs( ::nSocket ) - METHOD ListTables() CLASS TMySQLServer - RETURN mysql_list_tables( ::nSocket ) -/* TOFIX: Conversion creates a .dbf with fields of wrong dimension (often) */ +/* FIXME: Conversion creates a .dbf with fields of wrong dimension (often) */ METHOD TableStruct( cTable ) CLASS TMySQLServer LOCAL aStruct := {} @@ -1602,7 +1550,6 @@ METHOD TableStruct( cTable ) CLASS TMySQLServer AAdd( aStruct, aSField ) ENDIF NEXT - ENDIF #endif diff --git a/contrib/hbmzip/mzip.c b/contrib/hbmzip/mzip.c index c1f665766f..a89a4d57fd 100644 --- a/contrib/hbmzip/mzip.c +++ b/contrib/hbmzip/mzip.c @@ -1,6 +1,6 @@ /* * Wrapper functions for minizip library - * Some higher level zip archive functions + * Some higher-level ZIP archive functions * * Copyright 2008 Mindaugas Kavaliauskas * Copyright 2011-2013 Viktor Szakats (vszakats.net/harbour) (codepage/unicode) @@ -95,8 +95,8 @@ #if defined( __USE_LARGEFILE64 ) /* * The macro: __USE_LARGEFILE64 is set when _LARGEFILE64_SOURCE is - * defined and effectively enables lseek64/flock64/ftruncate64 functions - * on 32bit machines. + * defined and effectively enables lseek64()/flock64()/ftruncate64() + * functions on 32-bit machines. */ #define HB_USE_LARGEFILE64 #elif defined( HB_OS_UNIX ) && defined( O_LARGEFILE ) @@ -104,10 +104,10 @@ #endif #endif -#define _ZIP_FLAG_UNICODE ( 1 << 11 ) /* Language encoding flag (EFS) */ +#define _ZIP_FLAG_UNICODE ( 1 << 11 ) /* Language encoding flag (EFS) */ #if defined( HB_OS_UNIX ) - #define _VER_PLATFORM 0x03 /* it's necessary for file attributes in unzip */ + #define _VER_PLATFORM 0x03 /* it's necessary for file attributes in unzip */ #else #define _VER_PLATFORM 0x00 #endif @@ -542,8 +542,6 @@ HB_FUNC( HB_UNZIPFILEINFO ) char szFileName[ HB_PATH_MAX * 3 ]; unz_file_info ufi; int iResult; - char buf[ 16 ]; - long lJulian, lMillisec; iResult = unzGetCurrentFileInfo( hUnzip, &ufi, szFileName, sizeof( szFileName ) - 1, NULL, 0, NULL, 0 ); @@ -553,6 +551,8 @@ HB_FUNC( HB_UNZIPFILEINFO ) { HB_BOOL fUnicode = ( ufi.flag & _ZIP_FLAG_UNICODE ) != 0; + long lJulian, lMillisec; + szFileName[ sizeof( szFileName ) - 1 ] = '\0'; if( fUnicode ) @@ -568,6 +568,7 @@ HB_FUNC( HB_UNZIPFILEINFO ) hb_stortdt( lJulian, lMillisec, 3 ); if( HB_ISBYREF( 4 ) ) { + char buf[ 16 ]; hb_snprintf( buf, sizeof( buf ), "%02d:%02d:%02d", ufi.tmu_date.tm_hour, ufi.tmu_date.tm_min, ufi.tmu_date.tm_sec ); @@ -670,7 +671,7 @@ HB_FUNC( HB_UNZIPFILECLOSE ) /* * - * Higher level functions - not a wrappers of minizip code + * Higher-level functions - not wrappers of minizip code * */ @@ -682,7 +683,7 @@ static HB_BOOL hb_zipGetFileInfoFromHandle( PHB_FILE pFile, HB_U32 * pulCRC, HB_ if( pFile != NULL ) { unsigned char * pString = ( unsigned char * ) hb_xgrab( HB_Z_IOBUF_SIZE ); - HB_SIZE nRead, u; + HB_SIZE nRead; do { @@ -692,6 +693,7 @@ static HB_BOOL hb_zipGetFileInfoFromHandle( PHB_FILE pFile, HB_U32 * pulCRC, HB_ ulCRC = crc32( ulCRC, pString, ( uInt ) nRead ); if( fText ) { + HB_SIZE u; for( u = 0; u < nRead; ++u ) { if( pString[ u ] < 0x20 ? @@ -981,7 +983,7 @@ static int hb_zipStoreFile( zipFile hZip, int iParamFileName, int iParamZipName, zfi.external_fa = ulExtAttr; /* TODO: zip.exe test: 0 for binary file, 1 for text. Does not depend on - extension. We should analyse content of file to determine this??? */ + extension. We should analyze content of file to determine this??? */ zfi.internal_fa = 0; if( ulExtAttr & 0x40000000 ) @@ -1129,7 +1131,7 @@ static int hb_zipStoreFileHandle( zipFile hZip, PHB_FILE pFile, int iParamZipNam zfi.internal_fa = fText ? 1 : 0; else /* TODO: zip.exe test: 0 for binary file, 1 for text. Does not depend on - extension. We should analyse content of file to determine this??? */ + extension. We should analyze content of file to determine this??? */ zfi.internal_fa = 0; iResult = zipOpenNewFileInZip4( hZip, szZipName, &zfi, NULL, 0, NULL, 0, szComment, @@ -1190,7 +1192,6 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, char szNameRaw[ HB_PATH_MAX * 3 ]; char * szName; HB_SIZE nPos, nLen; - char cSep, * pString; unz_file_info ufi; int iResult; PHB_FILE pFile; @@ -1225,13 +1226,13 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, nLen = strlen( szName ); - /* Test shows that files in subfolders can be stored to zip file without - explicitly adding folder. So, let's create a required path */ + /* Test shows that files in subdirectories can be stored to zip file without + explicitly adding directory. So, let's create a required path */ nPos = 1; while( nPos < nLen ) { - cSep = szName[ nPos ]; + char cSep = szName[ nPos ]; /* allow both path separators, ignore terminating path separator */ if( ( cSep == '\\' || cSep == '/' ) && nPos < nLen - 1 ) @@ -1255,7 +1256,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, FXO_TRUNCATE | FXO_SHARELOCK, NULL, NULL ); if( pFile != NULL ) { - pString = ( char * ) hb_xgrab( HB_Z_IOBUF_SIZE ); + char * pString = ( char * ) hb_xgrab( HB_Z_IOBUF_SIZE ); while( ( iResult = unzReadCurrentFile( hUnzip, pString, HB_Z_IOBUF_SIZE ) ) > 0 ) if( hb_fileWrite( pFile, pString, ( HB_SIZE ) iResult, -1 ) != ( HB_SIZE ) iResult ) diff --git a/contrib/hbmzip/readme.txt b/contrib/hbmzip/readme.txt index 205819d227..c67403e8b7 100644 --- a/contrib/hbmzip/readme.txt +++ b/contrib/hbmzip/readme.txt @@ -1,12 +1,10 @@ -This folder contains compression related files including: - * zip file support based on minizip library (http://www.winimage.com/zLibDll/minizip.html) - including: +This directory contains compression related files including: * wrapper functions for minizip - * some additionl functions to provide a higher level API for zip files + * some additionl functions to provide a higher-level API for ZIP files -Harbour functions to mange ZIP files: -===================================== +Harbour functions to manage ZIP files: +====================================== hb_zipOpen( cFileName, [ iMode = HB_ZIP_CREATE ], [ @cGlobalComment ] ) --> hZip diff --git a/contrib/hbnetio/netio.h b/contrib/hbnetio/netio.h index d35745e2e0..b552da62cc 100644 --- a/contrib/hbnetio/netio.h +++ b/contrib/hbnetio/netio.h @@ -1,9 +1,9 @@ /* - * demonstration code for alternative RDD IO API which uses own - * very simple TCP/IP file server with RPC support - * All files which names starts with 'net:' are redirected to this API. - * This is header file used by client and server code with some constant - * definitions. + * Demonstration code for alternative RDD IO API which uses own + * very simple TCP/IP file server with RPC support + * All files which names starts with 'net:' are redirected to this API. + * This is header file used by client and server code with some constant + * definitions. * * Copyright 2009 Przemyslaw Czerpak * diff --git a/contrib/hbnetio/netiocli.c b/contrib/hbnetio/netiocli.c index 08980ade0a..84e56dff4c 100644 --- a/contrib/hbnetio/netiocli.c +++ b/contrib/hbnetio/netiocli.c @@ -1,32 +1,32 @@ /* - * demonstration code for alternative RDD IO API which uses own - * very simple TCP/IP file server with RPC support - * All files which names starts 'net:' are redirected to this API. - * This is client code with - * netio_Connect( [], [], [], - * [], [], [] ) - * -> - * function which register alternative RDD IO API, sets server - * address and port and connection timeout parameter. - * Then it tries to connect to the server and returns .T. on success. - * This code also provides the following .prg functions: - * netio_Disconnect( [], [] ) -> - * netio_Decode( [@], [@], [@], [@], - * [@], [@], [@] ) - * -> - * netio_ProcExists( ) -> - * netio_ProcExec( [, ] ) -> - * netio_ProcExecW( [, ] ) -> - * netio_FuncExec( [, ] ) -> + * Demonstration code for alternative RDD IO API which uses own + * very simple TCP/IP file server with RPC support + * All files which names starts 'net:' are redirected to this API. + * This is client code with + * netio_Connect( [], [], [], + * [], [], [] ) + * --> + * function which register alternative RDD IO API, sets server + * address and port and connection timeout parameter. + * Then it tries to connect to the server and returns .T. on success. + * This code also provides the following .prg functions: + * netio_Disconnect( [], [] ) --> + * netio_Decode( [@], [@], [@], [@], + * [@], [@], [@] ) + * --> + * netio_ProcExists( ) --> + * netio_ProcExec( [, ] ) --> + * netio_ProcExecW( [, ] ) --> + * netio_FuncExec( [, ] ) --> * - * netio_OpenDataStream( [, ] ) - * -> - * netio_OpenItemStream( [, ] ) - * -> - * netio_CloseStream( , [], [] ) - * -> - * netio_GetData( , [], [] ) - * -> | | NIL + * netio_OpenDataStream( [, ] ) + * --> + * netio_OpenItemStream( [, ] ) + * --> + * netio_CloseStream( , [], [] ) + * --> + * netio_GetData( , [], [] ) + * --> | | NIL * * Copyright 2009 Przemyslaw Czerpak * @@ -401,10 +401,12 @@ static HB_BOOL s_fileSendMsg( PHB_CONCLI conn, HB_BYTE * msgbuf, } else if( fWait ) { - int iMsg = HB_GET_LE_INT32( msgbuf ), iResult; + int iMsg = HB_GET_LE_INT32( msgbuf ); for( ;; ) { + int iResult; + if( s_fileRecvAll( conn, msgbuf, NETIO_MSGLEN ) != NETIO_MSGLEN ) { conn->errcode = hb_socketGetError(); @@ -463,11 +465,11 @@ static HB_BOOL s_fileProcessData( PHB_CONCLI conn ) HB_BYTE msgbuf[ NETIO_MSGLEN ]; HB_BOOL fResult = HB_TRUE; int iMsg, iStreamID; - long len; for( ;; ) { - len = s_fileRecvTest( conn, msgbuf, NETIO_MSGLEN ); + long len = s_fileRecvTest( conn, msgbuf, NETIO_MSGLEN ); + if( len == NETIO_MSGLEN ) { iMsg = HB_GET_LE_INT32( msgbuf ); @@ -751,11 +753,11 @@ static const char * s_fileDecode( const char * pszFileName, { /* decode server address and port if given as part of file name * in format like: - * "192.168.0.1:2941:path/to/file" + * "example.org:2941:path/to/file" * or: - * "192.168.0.1:2941:passwd:path/to/file" + * "example.org:2941:passwd:path/to/file" * or: - * "//192.168.0.1:2941/path/to/file" + * "//example.org:2941/path/to/file" */ const char * psz, * pth = NULL; @@ -783,8 +785,6 @@ static const char * s_fileDecode( const char * pszFileName, if( pth || iLen == 0 || iLen > 1 ) { - char port_buf[ 10 ], c; - if( iLen >= NETIO_SERVERNAME_MAX ) iLen = NETIO_SERVERNAME_MAX - 1; if( iLen > 0 ) @@ -795,6 +795,8 @@ static const char * s_fileDecode( const char * pszFileName, pszFileName = psz + 1; if( ! pth || psz < pth ) { + char port_buf[ 10 ], c; + iLen = 0; while( HB_ISDIGIT( pszFileName[ iLen ] ) && iLen < ( int ) sizeof( port_buf ) - 1 ) @@ -1047,7 +1049,7 @@ static void s_netio_init( void * cargo ) } /* netio_Decode( [@], [@], [@], [@], ; - * [@], [@], [@] ) -> + * [@], [@], [@] ) --> */ HB_FUNC( NETIO_DECODE ) { @@ -1087,7 +1089,7 @@ HB_FUNC( NETIO_DECODE ) hb_storni( iLevel, 6 ); hb_storni( iStrategy, 7 ); if( pszFile != pszFullName ) - /* the order is important and 1-st parameter + /* the order is important and 1st parameter * should be assigned at the end */ hb_storc( pszFile, 1 ); @@ -1096,7 +1098,7 @@ HB_FUNC( NETIO_DECODE ) } /* netio_Connect( [], [], [], ; - * [], [], [] ) -> + * [], [], [] ) --> */ HB_FUNC( NETIO_CONNECT ) { @@ -1171,7 +1173,7 @@ static PHB_CONCLI s_connParam( int iParam ) /* netio_GetConnection( [], [], [], ; * [], [], [] ) - * -> | NIL + * --> | NIL */ HB_FUNC( NETIO_GETCONNECTION ) { @@ -1200,7 +1202,7 @@ HB_FUNC( NETIO_GETCONNECTION ) } } -/* netio_Disconnect( [], [] ) -> +/* netio_Disconnect( [], [] ) --> */ HB_FUNC( NETIO_DISCONNECT ) { @@ -1219,7 +1221,7 @@ HB_FUNC( NETIO_DISCONNECT ) hb_retl( fDisconnected ); } -/* netio_TimeOut( [, ] ) -> [] +/* netio_TimeOut( [, ] ) --> [] */ HB_FUNC( NETIO_TIMEOUT ) { @@ -1284,14 +1286,14 @@ HB_FUNC( NETIO_SETPATH ) static const char * s_netio_params( int iParam, int iMsg, const char * pszName, HB_U32 * pSize, char ** pFree ) { int iPCount = iMsg == NETIO_PROCIS ? 0 : hb_pcount(); - char * data = NULL, * itmData; + char * data = NULL; HB_SIZE size, itmSize; size = strlen( pszName ) + 1; while( ++iParam <= iPCount ) { - itmData = hb_itemSerialize( hb_param( iParam, HB_IT_ANY ), HB_SERIALIZE_NUMSIZE, &itmSize ); + char * itmData = hb_itemSerialize( hb_param( iParam, HB_IT_ANY ), HB_SERIALIZE_NUMSIZE, &itmSize ); if( data == NULL ) data = ( char * ) memcpy( hb_xgrab( size + itmSize ), pszName, size ); else @@ -1349,11 +1351,12 @@ static HB_BOOL s_netio_procexec( int iMsg, int iType ) iMsg != NETIO_PROC, HB_FALSE ); if( fResult && ( iMsg == NETIO_FUNC || iMsg == NETIO_FUNCCTRL ) ) { - HB_SIZE nResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] ), nRecv; + HB_SIZE nResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] ); if( nResult > 0 ) { PHB_ITEM pItem = NULL; + HB_SIZE nRecv; if( nResult > size && buffer ) { @@ -1409,7 +1412,7 @@ static HB_BOOL s_netio_procexec( int iMsg, int iType ) /* check if function/procedure exists on the server side: * - * netio_ProcExists( ) -> + * netio_ProcExists( ) --> */ HB_FUNC( NETIO_PROCEXISTS ) { @@ -1419,7 +1422,7 @@ HB_FUNC( NETIO_PROCEXISTS ) /* execute function/procedure on server the side, * do not wait for confirmation: * - * netio_ProcExec( [, ] ) -> + * netio_ProcExec( [, ] ) --> */ HB_FUNC( NETIO_PROCEXEC ) { @@ -1429,7 +1432,7 @@ HB_FUNC( NETIO_PROCEXEC ) /* execute function/procedure on the server side and wait for * confirmation: * - * netio_ProcExecW( [, ] ) -> + * netio_ProcExecW( [, ] ) --> */ HB_FUNC( NETIO_PROCEXECW ) { @@ -1438,7 +1441,7 @@ HB_FUNC( NETIO_PROCEXECW ) /* execute function on the server side and wait for its return value: * - * netio_FuncExec( [, ] ) -> + * netio_FuncExec( [, ] ) --> */ HB_FUNC( NETIO_FUNCEXEC ) { @@ -1448,7 +1451,7 @@ HB_FUNC( NETIO_FUNCEXEC ) /* open communication stream/channel which allow to send data * asynchronously from server to client: * - * netio_OpenDataStream( [, ] ) -> + * netio_OpenDataStream( [, ] ) --> * * it executes on the server side: * ( , [, ] ) @@ -1466,7 +1469,7 @@ HB_FUNC( NETIO_OPENDATASTREAM ) /* open communication stream/channel which allow to send data * asynchronously from server to client: * - * netio_OpenItemStream( [, ] ) -> + * netio_OpenItemStream( [, ] ) --> * * it executes on the server side: * ( , [, ] ) @@ -1506,7 +1509,7 @@ static PHB_CONCLI s_netio_getConn( void ) /* close communication stream/channel: * * netio_CloseStream( , [] | [[], []] ) - * -> + * --> */ HB_FUNC( NETIO_CLOSESTREAM ) { @@ -1542,7 +1545,7 @@ HB_FUNC( NETIO_CLOSESTREAM ) /* retrieve data sent from the server by cominication stream * * netio_GetData( , [] | [[], []] ) - * -> | | NIL + * --> | | NIL */ HB_FUNC( NETIO_GETDATA ) { diff --git a/contrib/hbnetio/netiomt.prg b/contrib/hbnetio/netiomt.prg index 00402ee751..41d57e1d09 100644 --- a/contrib/hbnetio/netiomt.prg +++ b/contrib/hbnetio/netiomt.prg @@ -1,14 +1,14 @@ /* - * demonstration code for alternative RDD IO API which uses own - * very simple TCP/IP file server with RPC support - * All files which names starts 'net:' are redirected to this API. - * This is code for simple MT server which is activated by: - * netio_MTServer( [], [], [], [], - * [], [], [], - * [] ) - * -> | NIL - * and can be stopped by: - * netio_ServerStop( , .T. ) + * Demonstration code for alternative RDD IO API which uses own + * very simple TCP/IP file server with RPC support + * All files which names starts 'net:' are redirected to this API. + * This is code for simple MT server which is activated by: + * netio_MTServer( [], [], [], [], + * [], [], [], + * [] ) + * --> | NIL + * and can be stopped by: + * netio_ServerStop( , .T. ) * * Copyright 2009 Przemyslaw Czerpak * @@ -109,7 +109,7 @@ STATIC FUNCTION NETIO_SRVLOOP( pListenSocket, xRPC, sSrvFunc, ... ) LOCAL pConnectionSocket - WHILE .T. + DO WHILE .T. pConnectionSocket := netio_Accept( pListenSocket,, ... ) IF Empty( pConnectionSocket ) EXIT diff --git a/contrib/hbnetio/netiosrv.c b/contrib/hbnetio/netiosrv.c index 4f45b567d0..fd463b9675 100644 --- a/contrib/hbnetio/netiosrv.c +++ b/contrib/hbnetio/netiosrv.c @@ -1,30 +1,30 @@ /* - * demonstration code for alternative RDD IO API which uses own - * very simple TCP/IP file server with RPC support - * All files which names starts 'net:' are redirected to this API. - * This is server code giving the following .prg functions: - * netio_Listen( [], [], [], [] ) - * -> | NIL - * netio_Accept( , [], - * [], [], [] ) - * -> | NIL - * netio_Compress( , - * [], [], [] ) - * -> NIL - * netio_Server( ) -> NIL - * netio_ServerStop( | [, ] ) - * -> NIL - * netio_ServerTimeOut( [, ] ) -> [] - * netio_RPC( | [, ] ) - * -> - * netio_RPCFilter( , - * | | NIL ) -> NIL + * Demonstration code for alternative RDD IO API which uses own + * very simple TCP/IP file server with RPC support + * All files which names starts 'net:' are redirected to this API. + * This is server code giving the following .prg functions: + * netio_Listen( [], [], [], [] ) + * --> | NIL + * netio_Accept( , [], + * [], [], [] ) + * --> | NIL + * netio_Compress( , + * [], [], [] ) + * --> NIL + * netio_Server( ) --> NIL + * netio_ServerStop( | [, ] ) + * --> NIL + * netio_ServerTimeOut( [, ] ) --> [] + * netio_RPC( | [, ] ) + * --> + * netio_RPCFilter( , + * | | NIL ) --> NIL * - * netio_SrvStatus( [, ] ) -> - * netio_SrvSendItem( , , ) - * -> - * netio_SrvSendData( , , ) - * -> + * netio_SrvStatus( [, ] ) --> + * netio_SrvSendItem( , , ) + * --> + * netio_SrvSendData( , , ) + * --> * * Copyright 2009 Przemyslaw Czerpak * @@ -129,7 +129,7 @@ HB_LISTENSD, * PHB_LISTENSD; static HB_BOOL s_isDirSep( char c ) { - /* intentionally used explicit values instead of harbour macros + /* intentionally used explicit values instead of Harbour macros * because client can use different OS */ return c == '/' || c == '\\'; @@ -372,7 +372,7 @@ static HB_BOOL s_srvRecvAll( PHB_CONSRV conn, void * buffer, long len ) static HB_BOOL s_srvSendAll( PHB_CONSRV conn, void * buffer, long len ) { HB_BYTE * ptr = ( HB_BYTE * ) buffer; - long lSent = 0, l; + long lSent = 0; if( ! conn->mutex || hb_threadMutexLock( conn->mutex ) ) { @@ -381,7 +381,7 @@ static HB_BOOL s_srvSendAll( PHB_CONSRV conn, void * buffer, long len ) while( lSent < len && ! conn->stop ) { - l = hb_sockexWrite( conn->sock, ptr + lSent, len - lSent, 1000 ); + long l = hb_sockexWrite( conn->sock, ptr + lSent, len - lSent, 1000 ); if( l > 0 ) { lSent += l; @@ -476,7 +476,7 @@ static void s_listenRet( HB_SOCKET sd, const char * szRootPath, HB_BOOL rpc ) } -/* netio_RPC( | [, ] ) -> +/* netio_RPC( | [, ] ) --> */ HB_FUNC( NETIO_RPC ) { @@ -503,7 +503,7 @@ HB_FUNC( NETIO_RPC ) } /* netio_RPCFilter( , - * | | NIL ) -> NIL + * | | NIL ) --> NIL */ HB_FUNC( NETIO_RPCFILTER ) { @@ -529,12 +529,12 @@ HB_FUNC( NETIO_RPCFILTER ) } } -/* netio_ServerStop( | [, ] ) -> NIL +/* netio_ServerStop( | [, ] ) --> NIL */ HB_FUNC( NETIO_SERVERSTOP ) { PHB_LISTENSD lsd = s_listenParam( 1, HB_FALSE ); - HB_BOOL fStop = hb_parldef( 2, 1 ); + HB_BOOL fStop = hb_parldef( 2, HB_TRUE ); if( lsd ) lsd->stop = fStop; @@ -546,7 +546,7 @@ HB_FUNC( NETIO_SERVERSTOP ) } } -/* netio_ServerTimeOut( [, ] ) -> [] +/* netio_ServerTimeOut( [, ] ) --> [] */ HB_FUNC( NETIO_SERVERTIMEOUT ) { @@ -561,7 +561,7 @@ HB_FUNC( NETIO_SERVERTIMEOUT ) } /* netio_Listen( [], [], [], [] ) - * -> | NIL + * --> | NIL */ HB_FUNC( NETIO_LISTEN ) { @@ -601,7 +601,7 @@ HB_FUNC( NETIO_LISTEN ) /* netio_Accept( , [], * [], [], [] ) - * -> | NIL + * --> | NIL */ HB_FUNC( NETIO_ACCEPT ) { @@ -651,7 +651,7 @@ HB_FUNC( NETIO_ACCEPT ) } /* netio_Compress( , - * [], [], [] ) -> NIL + * [], [], [] ) --> NIL */ HB_FUNC( NETIO_COMPRESS ) { @@ -713,7 +713,7 @@ static HB_BOOL s_netio_login_accept( PHB_CONSRV conn ) return conn && conn->login; } -/* netio_VerifyClient( ) -> +/* netio_VerifyClient( ) --> */ HB_FUNC( NETIO_VERIFYCLIENT ) { @@ -723,7 +723,7 @@ HB_FUNC( NETIO_VERIFYCLIENT ) hb_retl( s_netio_login_accept( conn ) ); } -/* netio_Server( ) -> NIL +/* netio_Server( ) --> NIL */ HB_FUNC( NETIO_SERVER ) { @@ -1466,7 +1466,6 @@ HB_FUNC( NETIO_SERVER ) HB_SIZE nSize = size - size2; HB_USHORT uiPCount = 0; HB_BOOL fSend = HB_FALSE; - int iStreamType; iStreamID = 0; data += size2; @@ -1490,6 +1489,8 @@ HB_FUNC( NETIO_SERVER ) } if( uiMsg == NETIO_FUNCCTRL ) { + int iStreamType; + iStreamID = HB_GET_LE_INT32( &msgbuf[ 8 ] ); iStreamType = HB_GET_LE_INT32( &msgbuf[ 12 ] ); hb_vmPush( hb_param( 1, HB_IT_ANY ) ); @@ -1600,7 +1601,7 @@ HB_FUNC( NETIO_SERVER ) case NETIO_SYNC: continue; - default: /* unkown message */ + default: /* unrecognized message */ errCode = NETIO_ERR_UNKNOWN_COMMAND; break; } @@ -1633,7 +1634,7 @@ HB_FUNC( NETIO_SERVER ) } } -/* netio_ServedConnection() -> +/* netio_ServedConnection() --> */ HB_FUNC( NETIO_SERVEDCONNECTION ) { @@ -1656,7 +1657,7 @@ HB_FUNC( NETIO_SERVEDCONNECTION ) } } -/* netio_SrvSendItem( , , ) -> +/* netio_SrvSendItem( , , ) --> */ HB_FUNC( NETIO_SRVSENDITEM ) { @@ -1701,7 +1702,7 @@ HB_FUNC( NETIO_SRVSENDITEM ) hb_retl( fResult ); } -/* netio_SrvSendData( , , ) -> +/* netio_SrvSendData( , , ) --> */ HB_FUNC( NETIO_SRVSENDDATA ) { @@ -1742,7 +1743,7 @@ HB_FUNC( NETIO_SRVSENDDATA ) } /* netio_SrvStatus( - * [, | , @] ) -> + * [, | , @] ) --> */ HB_FUNC( NETIO_SRVSTATUS ) { diff --git a/contrib/hbnetio/readme.txt b/contrib/hbnetio/readme.txt index b71cc7f933..903b4aed3b 100644 --- a/contrib/hbnetio/readme.txt +++ b/contrib/hbnetio/readme.txt @@ -1,6 +1,4 @@ -/* - * Copyright 2010 Przemyslaw Czerpak - */ +/* Copyright 2010 Przemyslaw Czerpak */ HBNETIO is implementation of alternative RDD IO API for Harbour with additional RPC support. It contains either client and server code. @@ -13,12 +11,12 @@ Client side functions: ====================== netio_Connect( [], [], [], ; [], [], [] ) - -> + --> Register HBNETIO as alternative RDD IO API redirecting all files with name starting with "net:" to HBNETIO server, set default server address, port and connection parameters and tries to set the connection to this server. - When executed 1-st time it sets default connection parameters + When executed 1st time it sets default connection parameters for all threads. Each thread can overwrite these default settings with its own local ones calling netio_Connect() function. Each successful call to netio_Connect() increase the reference @@ -34,11 +32,11 @@ Client side functions: It possible to open many different connections and keep them open. In RDD IO operations and RPC calls it's possible to specify server address as part of file or procedure/function name, i.e. - USE net:192.168.0.2:2942:path/to/file - netio_ProcExec( "192.168.0.2:2942:procname" ) + USE net:example.org:2942:path/to/file + netio_ProcExec( "example.org:2942:procname" ) or using UNC paths: - USE net://192.168.0.2:2942/path/to/file - netio_ProcExec( "//192.168.0.2:2942/procname" ) + USE net://example.org:2942/path/to/file + netio_ProcExec( "//example.org:2942/procname" ) It's also possible to specify the password. The connection string is in format: [:[:]]: @@ -58,29 +56,29 @@ Client side functions: netio_GetConnection( [], [], [], ; [], [], [] ) - -> | NIL + --> | NIL Get pointer item with HBNETIO connection. It can be used to speedup RPC calls and stream functions when is passed as parameter to these functions. - netio_Disconnect( [], [] ) -> + netio_Disconnect( [], [] ) --> Close the connection created by netio_Connect() netio_Decode( [@], [@], [@], [@], ; [@], [@], [@] ) - -> + --> Decode connection parameters from and default settings. Return .T. if contains any connection settings. does not need to be prefixed with "net:" - netio_TimeOut( [, ] ) -> [] + netio_TimeOut( [, ] ) --> [] Get/Set client side timeout for messages - netio_SetPath( [, ] ) -> [] + netio_SetPath( [, ] ) --> [] Set/Get path prefix for automatic file redirection to HBNETIO. If automatic redirection is activated then is removed from file name passed to HBNETIO server, i.e.: @@ -91,31 +89,31 @@ Client side functions: use "//myserver/myshare/data/table" - netio_ProcExists( [,] ) -> + netio_ProcExists( [,] ) --> Check if function or procedure exists on the server side. - netio_ProcExec( [,] [, ] ) -> + netio_ProcExec( [,] [, ] ) --> Execute function or procedure on server the side do not wait for confirmation from the server. netio_ProcExecW( [,] [, ] ) - -> + --> Execute function or procedure on the server side and wait for confirmation from the server. netio_FuncExec( [,] [, ] ) - -> + --> Execute function on the server side and wait for function return value sent by the server. netio_OpenDataStream( [,] [, ] ) - -> + --> netio_OpenItemStream( [,] [, ] ) - -> + --> open communication stream/channel which allow to send data asynchronously from server to client. It executes on the server side: @@ -129,12 +127,12 @@ Client side functions: just like in NETIO_PROC*() functions. netio_CloseStream( , - [] | [[], []] ) -> + [] | [[], []] ) --> close communication stream/channel netio_GetData( , [] | [[], []] ) - -> | | NIL + --> | | NIL retrieve data sent from the server by communication stream. If stream was open by netio_OpenDataStream() then data is returned as string. @@ -146,27 +144,27 @@ Client side functions: Server side functions: ====================== netio_Listen( [], [], [], [] ) - -> | NIL + --> | NIL netio_Accept( , [], [], [], [] ) - -> | NIL + --> | NIL netio_Compress( , - [], [], [] ) -> NIL - netio_VerifyClient( ) -> - netio_Server( ) -> NIL - netio_ServedConnection() -> - netio_RPC( | [, ] ) -> + [], [], [] ) --> NIL + netio_VerifyClient( ) --> + netio_Server( ) --> NIL + netio_ServedConnection() --> + netio_RPC( | [, ] ) --> netio_RPCFilter( , - | | NIL ) -> NIL - netio_ServerStop( | [, ] ) -> NIL - netio_ServerTimeOut( [, ] ) -> [] + | | NIL ) --> NIL + netio_ServerStop( | [, ] ) --> NIL + netio_ServerTimeOut( [, ] ) --> [] netio_MTServer( [], [], [], [ | | ], [], [], [], [] ) - -> + --> netio_SrvStatus( - [, | , @] ) -> - netio_SrvSendItem( , , ) -> - netio_SrvSendData( , , ) -> + [, | , @] ) --> + netio_SrvSendItem( , , ) --> + netio_SrvSendData( , , ) --> diff --git a/contrib/hbodbc/odbc.c b/contrib/hbodbc/odbc.c index 3994cba0f0..74d7fee0e7 100644 --- a/contrib/hbodbc/odbc.c +++ b/contrib/hbodbc/odbc.c @@ -2,7 +2,13 @@ * This file contains source for first ODBC routines. * * Copyright 2009 Viktor Szakats (vszakats.net/harbour) + * Copyright 2009 Mindaugas Kavaliauskas + * Copyright 2006 Marcelo Lombardo + * (SQLGetInfo(), SQLSetStmtAttr(), SQLGetStmtAttr(), SQLCommit(), + * SQLRollback(), SQLColAttribute(), SQLMoreResults()) * Copyright 1999 Antonio Linares + * Copyright 1999 Felipe G. Coury + * (SQLNumResultCols(), SQLDescribeCol()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,31 +51,12 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Felipe G. Coury - * SQLNumResultCols() - * SQLDescribeCol() - * - * Copyright 1996 Marcelo Lombardo - * SQLGetInfo() - * SQLSetStmtAttr() - * SQLGetStmtAttr() - * SQLCommit() - * SQLRollback() - * SQLColAttribute() - * SQLMoreResults() - * - * See COPYING.txt for licensing terms. - */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" #include "hbapistr.h" -#include "hbset.h" #include "hbdate.h" +#include "hbset.h" /* NOTE: This code using pointer items is a little bit more complicated then it has to be. @@ -85,51 +72,50 @@ blocks as used. It does not cause any speed or memory overhead so I left it as example for more complicated cases and as base for some - potential extensions. [druzus] - */ + potential extensions. [druzus] */ /* Required by headers on Windows */ #if defined( HB_OS_WIN ) -/* NOTE: Workaround for OpenWatcom's (tested with 1.9) odbc32.lib implib - missing the entry for wide version of one function, - so we turn off UNICODE, until its fixed in OpenWatcom: - Error! E2028: _SQLSetStmtAttrW@16 is an undefined reference - [vszakats] */ -# if defined( __WATCOMC__ ) && defined( UNICODE ) -# undef UNICODE -# endif + /* NOTE: Workaround for OpenWatcom's (tested with 1.9) odbc32.lib implib + missing the entry for wide version of one function, + so we turn off UNICODE, until it's fixed in OpenWatcom: + Error! E2028: _SQLSetStmtAttrW@16 is an undefined reference + [vszakats] */ + #if defined( __WATCOMC__ ) && defined( UNICODE ) + #undef UNICODE + #endif -# include + #include -# if ! defined( WIN32 ) -# define WIN32 /* Required for WIN32_LEAN_AND_MEAN mode */ -# endif + #if ! defined( WIN32 ) + #define WIN32 /* Required for WIN32_LEAN_AND_MEAN mode */ + #endif #endif #include #include #if ! defined( HB_OS_WIN ) -# if ! defined( SQLLEN ) && ! defined( SQLTCHAR ) && \ - ! defined( UODBCINT64 ) && ! defined( SIZEOF_LONG_INT ) -typedef unsigned char SQLTCHAR; -typedef long SQLLEN; -typedef unsigned long SQLULEN; -# ifndef SQL_WCHAR -# define SQL_WCHAR (-8) -# endif -# ifndef SQL_WVARCHAR -# define SQL_WVARCHAR (-9) -# endif -# ifndef SQL_WLONGVARCHAR -# define SQL_WLONGVARCHAR (-10) -# endif -# endif + #if ! defined( SQLLEN ) && ! defined( SQLTCHAR ) && \ + ! defined( UODBCINT64 ) && ! defined( SIZEOF_LONG_INT ) + typedef unsigned char SQLTCHAR; + typedef long SQLLEN; + typedef unsigned long SQLULEN; + #ifndef SQL_WCHAR + #define SQL_WCHAR ( -8 ) + #endif + #ifndef SQL_WVARCHAR + #define SQL_WVARCHAR ( -9 ) + #endif + #ifndef SQL_WLONGVARCHAR + #define SQL_WLONGVARCHAR ( -10 ) + #endif + #endif #endif #ifndef SQL_NO_DATA -# define SQL_NO_DATA SQL_NO_DATA_FOUND +#define SQL_NO_DATA SQL_NO_DATA_FOUND #endif #if defined( UNICODE ) @@ -263,9 +249,8 @@ static void hb_SQLHDBC_stor( PHB_ITEM pHEnvItm, SQLHDBC hDbc, int iParam ) pHDbc->hDbc = hDbc; pHDbc->conn_counter = 1; /* initialize pointer scanned by mark function before allocating new - * new GC block - such allocation may activate GC and uninitalized - * pointer will be accessed from our mark function - */ + new GC block - such allocation may activate GC and uninitialized + pointer will be accessed from our mark function */ pHDbc->pHEnvItm = NULL; if( pHEnvItm ) { @@ -362,9 +347,8 @@ static void hb_SQLHSTMT_stor( PHB_ITEM pHDbcItm, SQLHSTMT hStmt, int iParam ) pHStmt->hStmt = hStmt; pHStmt->conn_counter = 0; /* initialize pointer scanned by mark function before allocating new - * new GC block - such allocation may activate GC and uninitalized - * pointer will be accessed from our mark function - */ + new GC block - such allocation may activate GC and uninitalized + pointer will be accessed from our mark function */ pHStmt->pHDbcItm = NULL; if( pHDbcItm ) @@ -391,7 +375,7 @@ static SQLHSTMT hb_SQLHSTMT_par( int iParam ) pHStmt->hStmt : NULL; } -HB_FUNC( SQLALLOCENV ) /* @hEnv --> nRetCode */ +HB_FUNC( SQLALLOCENV ) /* @hEnv --> nRetCode */ { SQLHENV hEnv; SQLRETURN result; @@ -410,7 +394,7 @@ HB_FUNC( SQLALLOCENV ) /* @hEnv --> nRetCode */ hb_SQLHENV_stor( hEnv, 1 ); } -HB_FUNC( SQLALLOCCONNECT ) /* hEnv, @hDbc --> nRetCode */ +HB_FUNC( SQLALLOCCONNECT ) /* hEnv, @hDbc --> nRetCode */ { SQLHENV hEnv = hb_SQLHENV_par( 1 ); @@ -430,7 +414,7 @@ HB_FUNC( SQLALLOCCONNECT ) /* hEnv, @hDbc --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLDRIVERCONNECT ) /* hDbc, @cConnectString --> nRetCode */ +HB_FUNC( SQLDRIVERCONNECT ) /* hDbc, @cConnectString --> nRetCode */ { SQLHDBC hDbc = hb_SQLHDBC_par( 1 ); @@ -464,11 +448,11 @@ HB_FUNC( SQLDRIVERCONNECT ) /* hDbc, @cConnectString --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLCONNECT ) /* hDbc, cDSN, cUseName, cPassword --> nRetCode */ +HB_FUNC( SQLCONNECT ) /* hDbc, cDSN, cUseName, cPassword --> nRetCode */ { SQLHDBC hDbc = hb_SQLHDBC_par( 1 ); - /* TOFIX: add protection against connection with connected hDbc handle */ + /* FIXME: add protection against connection with connected hDbc handle */ if( hDbc ) { @@ -500,7 +484,7 @@ HB_FUNC( SQLCONNECT ) /* hDbc, cDSN, cUseName, cPassword --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLDISCONNECT ) /* hDbc --> nRetCode */ +HB_FUNC( SQLDISCONNECT ) /* hDbc --> nRetCode */ { PHB_SQLHDBC pHDbc = hb_SQLHDBC_get( hb_param( 1, HB_IT_POINTER ) ); @@ -519,21 +503,21 @@ HB_FUNC( SQLDISCONNECT ) /* hDbc --> nRetCode */ #if defined( HB_LEGACY_LEVEL4 ) -HB_FUNC( SQLFREECONNECT ) /* hDbc --> nRetCode */ +HB_FUNC( SQLFREECONNECT ) /* hDbc --> nRetCode */ { } -HB_FUNC( SQLFREEENV ) /* hEnv --> nRetCode */ +HB_FUNC( SQLFREEENV ) /* hEnv --> nRetCode */ { } -HB_FUNC( SQLFREESTMT ) /* hStmt, nType --> nRetCode */ +HB_FUNC( SQLFREESTMT ) /* hStmt, nType --> nRetCode */ { } #endif -HB_FUNC( SQLALLOCSTMT ) /* hDbc, @hStmt --> nRetCode */ +HB_FUNC( SQLALLOCSTMT ) /* hDbc, @hStmt --> nRetCode */ { SQLHDBC hDbc = hb_SQLHDBC_par( 1 ); @@ -553,7 +537,7 @@ HB_FUNC( SQLALLOCSTMT ) /* hDbc, @hStmt --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLEXECDIRECT ) /* hStmt, cStatement --> nRetCode */ +HB_FUNC( SQLEXECDIRECT ) /* hStmt, cStatement --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -572,7 +556,7 @@ HB_FUNC( SQLEXECDIRECT ) /* hStmt, cStatement --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLFETCH ) /* hStmt --> nRetCode */ +HB_FUNC( SQLFETCH ) /* hStmt --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -600,7 +584,7 @@ HB_FUNC( SQLFETCHSCROLL ) hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLGETDATA ) /* hStmt, nField, nType, [nMaxLen], @xValue --> nRetCode */ +HB_FUNC( SQLGETDATA ) /* hStmt, nField, nType, [nMaxLen], @xValue --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -768,7 +752,6 @@ HB_FUNC( SQLGETDATA ) /* hStmt, nField, nType, [nMaxLen], @xValue --> nRetCode * break; } - /* SQL_DATETIME = SQL_DATE = 9 */ case SQL_TIMESTAMP: #if ODBCVER >= 0x0300 case SQL_TYPE_TIMESTAMP: @@ -782,10 +765,8 @@ HB_FUNC( SQLGETDATA ) /* hStmt, nField, nType, [nMaxLen], @xValue --> nRetCode * hb_stortdt( 0, 0, 5 ); break; } - default: hb_stor( 5 ); - break; } hb_retni( res ); @@ -794,7 +775,7 @@ HB_FUNC( SQLGETDATA ) /* hStmt, nField, nType, [nMaxLen], @xValue --> nRetCode * hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLNUMRESULTCOLS ) /* hStmt, @nColCount --> nRetCode */ +HB_FUNC( SQLNUMRESULTCOLS ) /* hStmt, @nColCount --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -810,7 +791,7 @@ HB_FUNC( SQLNUMRESULTCOLS ) /* hStmt, @nColCount --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLDESCRIBECOL ) /* hStmt, nCol, @cName, nLen, @nBufferLen, @nDataType, @nColSize, @nDec, @nNull --> nRetCode */ +HB_FUNC( SQLDESCRIBECOL ) /* hStmt, nCol, @cName, nLen, @nBufferLen, @nDataType, @nColSize, @nDec, @nNull --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -853,7 +834,7 @@ HB_FUNC( SQLDESCRIBECOL ) /* hStmt, nCol, @cName, nLen, @nBufferLen, @nDataType, hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLCOLATTRIBUTE ) /* hStmt, nCol, nField, @cName, nLen, @nBufferLen, @nAttribute --> nRetCode */ +HB_FUNC( SQLCOLATTRIBUTE ) /* hStmt, nCol, nField, @cName, nLen, @nBufferLen, @nAttribute --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -903,7 +884,7 @@ HB_FUNC( SQLCOLATTRIBUTE ) /* hStmt, nCol, nField, @cName, nLen, @nBufferLen, @n hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLERROR ) /* hEnv, hDbc, hStmt, @cErrorClass, @nType, @cErrorMsg */ +HB_FUNC( SQLERROR ) /* hEnv, hDbc, hStmt, @cErrorClass, @nType, @cErrorMsg */ { SQLHENV hEnv = hb_SQLHENV_par( 1 ); SQLHDBC hDbc = hb_SQLHDBC_par( 2 ); @@ -937,7 +918,7 @@ HB_FUNC( SQLERROR ) /* hEnv, hDbc, hStmt, @cErrorClass, @nType, @cErrorMsg */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLGETDIAGREC ) /* nHandleType, hHandle, nRecNumber, @cSQLState, @nError, @cErrorMsg */ +HB_FUNC( SQLGETDIAGREC ) /* nHandleType, hHandle, nRecNumber, @cSQLState, @nError, @cErrorMsg */ { #if ODBCVER >= 0x0300 SQLSMALLINT iHandleType = ( SQLSMALLINT ) hb_parni( 1 ); @@ -1008,7 +989,7 @@ HB_FUNC( SQLROWCOUNT ) hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLGETINFO ) /* hDbc, nType, @cResult */ +HB_FUNC( SQLGETINFO ) /* hDbc, nType, @cResult */ { SQLHDBC hDbc = hb_SQLHDBC_par( 1 ); @@ -1031,7 +1012,7 @@ HB_FUNC( SQLGETINFO ) /* hDbc, nType, @cResult */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLSETCONNECTATTR ) /* hDbc, nOption, uOption */ +HB_FUNC( SQLSETCONNECTATTR ) /* hDbc, nOption, uOption */ { SQLHDBC hDbc = hb_SQLHDBC_par( 1 ); @@ -1055,7 +1036,7 @@ HB_FUNC( SQLSETCONNECTATTR ) /* hDbc, nOption, uOption */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLSETSTMTATTR ) /* hStmt, nOption, uOption --> nRetCode */ +HB_FUNC( SQLSETSTMTATTR ) /* hStmt, nOption, uOption --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -1079,7 +1060,7 @@ HB_FUNC( SQLSETSTMTATTR ) /* hStmt, nOption, uOption --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLGETCONNECTATTR ) /* hDbc, nOption, @cOption */ +HB_FUNC( SQLGETCONNECTATTR ) /* hDbc, nOption, @cOption */ { SQLHDBC hDbc = hb_SQLHDBC_par( 1 ); @@ -1108,7 +1089,7 @@ HB_FUNC( SQLGETCONNECTATTR ) /* hDbc, nOption, @cOption */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLGETSTMTATTR ) /* hStmt, nOption, @cOption */ +HB_FUNC( SQLGETSTMTATTR ) /* hStmt, nOption, @cOption */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -1137,7 +1118,7 @@ HB_FUNC( SQLGETSTMTATTR ) /* hStmt, nOption, @cOption */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLCOMMIT ) /* hEnv, hDbc */ +HB_FUNC( SQLCOMMIT ) /* hEnv, hDbc */ { SQLHENV hEnv = hb_SQLHENV_par( 1 ); SQLHDBC hDbc = hb_SQLHDBC_par( 2 ); @@ -1148,7 +1129,7 @@ HB_FUNC( SQLCOMMIT ) /* hEnv, hDbc */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLROLLBACK ) /* hEnv, hDbc */ +HB_FUNC( SQLROLLBACK ) /* hEnv, hDbc */ { SQLHENV hEnv = hb_SQLHENV_par( 1 ); SQLHDBC hDbc = hb_SQLHDBC_par( 2 ); @@ -1159,7 +1140,7 @@ HB_FUNC( SQLROLLBACK ) /* hEnv, hDbc */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLPREPARE ) /* hStmt, cStatement --> nRetCode */ +HB_FUNC( SQLPREPARE ) /* hStmt, cStatement --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -1177,7 +1158,7 @@ HB_FUNC( SQLPREPARE ) /* hStmt, cStatement --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLEXECUTE ) /* hStmt --> nRetCode */ +HB_FUNC( SQLEXECUTE ) /* hStmt --> nRetCode */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -1187,7 +1168,7 @@ HB_FUNC( SQLEXECUTE ) /* hStmt --> nRetCode */ hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( SQLMORERESULTS ) /* hEnv, hDbc */ +HB_FUNC( SQLMORERESULTS ) /* hEnv, hDbc */ { SQLHSTMT hStmt = hb_SQLHSTMT_par( 1 ); @@ -1219,7 +1200,7 @@ HB_FUNC( HB_ODBCSTOD ) hb_retds( NULL ); } -HB_FUNC( HB_ODBCNUMSETLEN ) /* nValue, nSize, nDecimals --> nValue (nSize, nDec) */ +HB_FUNC( HB_ODBCNUMSETLEN ) /* nValue, nSize, nDecimals --> nValue (nSize, nDec) */ { PHB_ITEM pValue = hb_param( 1, HB_IT_NUMERIC ); int iLen = hb_parni( 2 ); diff --git a/contrib/hbodbc/todbc.prg b/contrib/hbodbc/todbc.prg index 7b91b04e7a..1cb37d1859 100644 --- a/contrib/hbodbc/todbc.prg +++ b/contrib/hbodbc/todbc.prg @@ -1,6 +1,9 @@ /* * ODBC Access Class * + * Copyright 2006 Marcelo Lombardo + * (:SetCnnOptions(), :GetCnnOptions(), :Commit(), :RollBack(), + * :SetStmtOptions(), :GetStmtOptions(), :SetAutoCommit()) * Copyright 1999 Felipe G. Coury * * This program is free software; you can redistribute it and/or modify @@ -44,21 +47,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1996 Marcelo Lombardo - * - * METHOD SetCnnOptions( nType, uBuffer ) - * METHOD GetCnnOptions( nType ) - * METHOD Commit() - * METHOD RollBack() - * METHOD SetStmtOptions( nType, uBuffer ) - * METHOD GetStmtOptions( nType ) - * METHOD SetAutoCommit( lEnable ) - * - */ - #include "hbclass.ch" #include "sql.ch" diff --git a/contrib/hbpgsql/postgres.c b/contrib/hbpgsql/postgres.c index 693d68d23f..038e69fe30 100644 --- a/contrib/hbpgsql/postgres.c +++ b/contrib/hbpgsql/postgres.c @@ -1,7 +1,8 @@ /* - * PostgreSQL RDBMS low level (client api) interface code. + * PostgreSQL RDBMS low-level (client API) interface code. * - * Copyright 2010 Viktor Szakats (vszakats.net/harbour) (GC support) + * Copyright 2016 P.Chornyj + * Copyright 2010-2016 Viktor Szakats (vszakats.net/harbour) (GC support, etc) * Copyright 2003 Rodrigo Moreno rodrigo_moreno@yahoo.com * * This program is free software; you can redistribute it and/or modify diff --git a/contrib/hbpgsql/postgres.ch b/contrib/hbpgsql/postgres.ch index 120a833189..4bd52c84d9 100644 --- a/contrib/hbpgsql/postgres.ch +++ b/contrib/hbpgsql/postgres.ch @@ -1,6 +1,8 @@ /* - * PostgreSQL RDBMS low level (client api) interface code. + * PostgreSQL RDBMS low-level (client API) interface code. * + * Copyright 2016 P.Chornyj + * Copyright 2014 Viktor Szakats (vszakats.net/harbour) * Copyright 2003 Rodrigo Moreno rodrigo_moreno@yahoo.com * * This program is free software; you can redistribute it and/or modify @@ -47,6 +49,7 @@ #ifndef HBPOSTGRES_CH_ #define HBPOSTGRES_CH_ +/* PQstatus() */ #define CONNECTION_OK 0 #define CONNECTION_BAD 1 #define CONNECTION_STARTED 2 @@ -57,6 +60,7 @@ #define CONNECTION_SSL_STARTUP 7 #define CONNECTION_NEEDED 8 +/* PQresultStatus() */ #define PGRES_EMPTY_QUERY 0 #define PGRES_COMMAND_OK 1 #define PGRES_TUPLES_OK 2 @@ -66,6 +70,7 @@ #define PGRES_NONFATAL_ERROR 6 #define PGRES_FATAL_ERROR 7 +/* PQtransactionStatus() */ #define PQTRANS_IDLE 0 #define PQTRANS_ACTIVE 1 #define PQTRANS_INTRANS 2 diff --git a/contrib/hbpgsql/rddcopy.c b/contrib/hbpgsql/rddcopy.c index 8d7738b819..07917cc900 100644 --- a/contrib/hbpgsql/rddcopy.c +++ b/contrib/hbpgsql/rddcopy.c @@ -1,7 +1,6 @@ /* - * PostgreSQL RDBMS low level (client api) interface code. + * PostgreSQL RDBMS low-level (client API) interface code. * - * Copyright 2010 Viktor Szakats (vszakats.net/harbour) (GC support) * Copyright 2003 Rodrigo Moreno rodrigo_moreno@yahoo.com * * This program is free software; you can redistribute it and/or modify @@ -75,7 +74,7 @@ static HB_BOOL addToContext( pgCopyContext * context, const char c ) HB_VM_UNLOCK(); fOK = PQputCopyData( context->connection, context->buffer, context->position ) != -1; HB_VM_LOCK(); - if( !fOK ) + if( ! fOK ) return HB_FALSE; context->position = 0; @@ -96,7 +95,7 @@ static HB_BOOL addStrToContext( pgCopyContext * context, const char * str ) HB_VM_UNLOCK(); fOK = PQputCopyData( context->connection, context->buffer, context->position ) != -1; HB_VM_LOCK(); - if( !fOK ) + if( ! fOK ) return HB_FALSE; context->position = 0; @@ -119,7 +118,7 @@ static HB_BOOL addStrnToContext( pgCopyContext * context, const char * str, HB_S HB_VM_UNLOCK(); fOK = PQputCopyData( context->connection, context->buffer, context->position ) != -1; HB_VM_LOCK(); - if( !fOK ) + if( ! fOK ) return HB_FALSE; context->position = 0; @@ -367,7 +366,7 @@ HB_FUNC( HB_PQCOPYFROMWA ) hb_xfree( szInit ); HB_VM_LOCK(); - while( !bFail && ( nCount == 0 || uiRecCount < nCount ) && + while( ! bFail && ( nCount == 0 || uiRecCount < nCount ) && ( ! pWhile || hb_itemGetL( hb_vmEvalBlock( pWhile ) ) ) ) { diff --git a/contrib/hbpgsql/tpostgre.prg b/contrib/hbpgsql/tpostgre.prg index 987398c7a2..d7f4ec007f 100644 --- a/contrib/hbpgsql/tpostgre.prg +++ b/contrib/hbpgsql/tpostgre.prg @@ -1,5 +1,5 @@ /* - * PostgreSQL RDBMS low level (client api) interface code. + * PostgreSQL RDBMS low-level (client API) interface code. * * Copyright 2003 Rodrigo Moreno rodrigo_moreno@yahoo.com * @@ -47,12 +47,12 @@ #include "hbclass.ch" #include "postgres.ch" -#define _STRU_FIELDNAME 1 -#define _STRU_FIELDTYPE 2 -#define _STRU_FIELDLEN 3 -#define _STRU_FIELDDEC 4 -#define _STRU_TABLE 5 -#define _STRU_TABLECOL 6 +#define _STRU_FIELDNAME 1 +#define _STRU_FIELDTYPE 2 +#define _STRU_FIELDLEN 3 +#define _STRU_FIELDDEC 4 +#define _STRU_TABLE 5 +#define _STRU_TABLECOL 6 CREATE CLASS TPQServer diff --git a/contrib/hbpipeio/pipeio.c b/contrib/hbpipeio/pipeio.c index 52e9b61057..fac81bcc4e 100644 --- a/contrib/hbpipeio/pipeio.c +++ b/contrib/hbpipeio/pipeio.c @@ -339,7 +339,7 @@ static PHB_FILE hb_fileFromPipeHandle( HB_FHANDLE hProcess, HB_FHANDLE hPipeRD, } /* hb_vfFromPipes( [], [], [], [] ) - -> | NIL */ + --> | NIL */ HB_FUNC( HB_VFFROMPIPES ) { HB_FHANDLE hPipeRD = hb_numToHandle( hb_parnintdef( 1, FS_ERROR ) ); @@ -352,7 +352,7 @@ HB_FUNC( HB_VFFROMPIPES ) } /* hb_vfOpenProcess( , [=FO_READ], [], [] ) - -> | NIL */ + --> | NIL */ HB_FUNC( HB_VFOPENPROCESS ) { const char * pszCommand = hb_parc( 1 ); diff --git a/contrib/hbsms/sms.prg b/contrib/hbsms/sms.prg index 0f9cf49372..baf5561083 100644 --- a/contrib/hbsms/sms.prg +++ b/contrib/hbsms/sms.prg @@ -47,13 +47,11 @@ /* TODO: - Unicode support */ /* TODO: - Receive support */ -/* NOTE: Source of information: - http://www.smssolutions.net/tutorials/gsm/sendsmsat/ - http://www.smssolutions.net/tutorials/gsm/receivesmsat/ - http://www.developershome.com/sms/sendSmsByAtCommands.asp - http://www.developershome.com/sms/readSmsByAtCommands.asp - http://www.dreamfabric.com/sms/ - [vszakats] */ +/* Source of information: + https://web.archive.org/web/www.smssolutions.net/tutorials/gsm/sendsmsat/ + https://web.archive.org/web/www.smssolutions.net/tutorials/gsm/receivesmsat/ + https://web.archive.org/web/20121115163620/dreamfabric.com/sms/ + */ STATIC FUNCTION port_send( h, s ) RETURN hb_comSend( h, s ) @@ -101,7 +99,7 @@ FUNCTION sms_ReceiveAll( cPort, cPIN ) RETURN aRetVal -/* --------------------- */ +/* --- */ #define _SMSCTX_xHnd 1 #define _SMSCTX_cPIN 2 diff --git a/contrib/hbsqlit3/core.c b/contrib/hbsqlit3/core.c index bd68585b46..c806f88d03 100644 --- a/contrib/hbsqlit3/core.c +++ b/contrib/hbsqlit3/core.c @@ -1,5 +1,5 @@ /* - * SQLite3 library low level (client api) interface code + * SQLite3 library low-level (client API) interface code * * Copyright 2007-2010 P.Chornyj * @@ -42,21 +42,19 @@ * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * - * See COPYING.txt for licensing terms. - * */ #include "sqlite3.h" -#include "hbvm.h" #include "hbapi.h" +#include "hbvm.h" #include "hbapiitm.h" #include "hbapierr.h" #include "hbapifs.h" #include "hbapistr.h" #include "hbstack.h" -/* TOFIX: verify the exact SQLITE3 version */ +/* FIXME: verify the exact SQLITE3 version */ #if SQLITE_VERSION_NUMBER <= 3004001 #define sqlite3_int64 HB_LONGLONG #define sqlite3_uint64 HB_ULONGLONG @@ -248,7 +246,7 @@ static void * hb_sqlite3_param( int iParam, int iType, HB_BOOL fError ) } /** - Callbacs helpers: + Callback helpers: Compile-Time Authorization Callback A Callback To Handle SQLITE_BUSY Errors Query Progress Callbacks @@ -417,7 +415,6 @@ static void func( sqlite3_context * ctx, int argc, sqlite3_value ** argv ) if( pCallback && hb_vmRequestReenter() ) { PHB_ITEM pResult; - int i; hb_vmPushEvalSym(); hb_vmPush( pCallback ); @@ -425,6 +422,8 @@ static void func( sqlite3_context * ctx, int argc, sqlite3_value ** argv ) if( argc > 0 ) { + int i; + for( i = 0; i < argc; i++ ) { switch( sqlite3_value_type( argv[ i ] ) ) @@ -506,9 +505,9 @@ static void func( sqlite3_context * ctx, int argc, sqlite3_value ** argv ) } /** - sqlite3_libversion() -> cVersion - sqlite3_libversion_number() -> nVersionNumber - sqlite3_sourceid() -> cSourceID + sqlite3_libversion() --> cVersion + sqlite3_libversion_number() --> nVersionNumber + sqlite3_sourceid() --> cSourceID Returns values equivalent to the header constants SQLITE_VERSION, SQLITE_VERSION_NUMBER, SQLITE_SOURCE_ID. @@ -534,8 +533,8 @@ HB_FUNC( SQLITE3_SOURCEID ) } /** - sqlite3_initialize() -> nResult - sqlite3_shutdown() -> nResult + sqlite3_initialize() --> nResult + sqlite3_shutdown() --> nResult The sqlite3_initialize() routine initializes the SQLite library. The sqlite3_shutdown() routine deallocates any resources that were @@ -563,7 +562,7 @@ HB_FUNC( SQLITE3_SHUTDOWN ) /** Enable Or Disable Extended Result Codes - sqlite3_extended_result_codes( db, lOnOff ) -> nResultCode + sqlite3_extended_result_codes( db, lOnOff ) --> nResultCode */ HB_FUNC( SQLITE3_EXTENDED_RESULT_CODES ) @@ -579,10 +578,10 @@ HB_FUNC( SQLITE3_EXTENDED_RESULT_CODES ) /** Error Codes And Messages - sqlite3_errcode( db ) -> returns the numeric result code or extended result - code - sqlite3_errmsg( db ) -> return English-language text - that describes the error + sqlite3_errcode( db ) --> returns the numeric result code or extended result + code + sqlite3_errmsg( db ) --> return English-language text + that describes the error */ HB_FUNC( SQLITE3_ERRCODE ) @@ -642,7 +641,7 @@ HB_FUNC( SQLITE3_SLEEP ) /** Last Insert Rowid - sqlite3_last_insert_rowid( db ) -> nROWID + sqlite3_last_insert_rowid( db ) --> nROWID */ HB_FUNC( SQLITE3_LAST_INSERT_ROWID ) @@ -656,9 +655,9 @@ HB_FUNC( SQLITE3_LAST_INSERT_ROWID ) } /** - Name Of The Folder Holding Temporary Files + Name Of The Directory Holding Temporary Files - sqlite3_temp_directory( cDirName ) -> lResult + sqlite3_temp_directory( cDirName ) --> lResult */ HB_FUNC( SQLITE3_TEMP_DIRECTORY ) @@ -680,11 +679,11 @@ HB_FUNC( SQLITE3_TEMP_DIRECTORY ) bResult = HB_TRUE; else HB_TRACE( HB_TR_DEBUG, - ( "sqlite_temp_directory(): Can't create directory %s", pszDirName ) ); + ( "sqlite_temp_directory(): Could not create directory %s", pszDirName ) ); } else HB_TRACE( HB_TR_DEBUG, - ( "sqlite_temp_directory(): Directory doesn't exist %s", pszDirName ) ); + ( "sqlite_temp_directory(): Directory does not exist %s", pszDirName ) ); } if( bResult ) @@ -700,9 +699,9 @@ HB_FUNC( SQLITE3_TEMP_DIRECTORY ) /** Opening( creating ) A New Database Connection - sqlite3_open( cDatabace, lCreateIfNotExist ) -> return pointer to Db - or NIL if error occurs - sqlite3_open_v2( cDatabace, nOpenMode ) -> return pHbSqlite3 or NIL + sqlite3_open( cDatabace, lCreateIfNotExist ) --> return pointer to Db + or NIL if error occurs + sqlite3_open_v2( cDatabace, nOpenMode ) --> return pHbSqlite3 or NIL */ HB_FUNC( SQLITE3_OPEN ) @@ -730,7 +729,7 @@ HB_FUNC( SQLITE3_OPEN ) } else { - HB_TRACE( HB_TR_DEBUG, ( "sqlite3_open(): Database doesn't exist %s", pszdbName ) ); + HB_TRACE( HB_TR_DEBUG, ( "sqlite3_open(): Database does not exist %s", pszdbName ) ); hb_retptr( NULL ); } @@ -771,7 +770,7 @@ HB_FUNC( SQLITE3_OPEN_V2 ) /** One-Step Query Execution Interface - sqlite3_exec( db, cSQLTEXT, [pCallbackFunc | cCallbackFunc] ) -> nResultCode + sqlite3_exec( db, cSQLTEXT, [pCallbackFunc | cCallbackFunc] ) --> nResultCode */ HB_FUNC( SQLITE3_EXEC ) @@ -809,8 +808,8 @@ HB_FUNC( SQLITE3_EXEC ) /** Compiling An SQL Statement - sqlite3_prepare( db, cSQLTEXT ) - -> return pointer to compiled statement or NIL if error occurs + sqlite3_prepare( db, cSQLTEXT, [nPrepFlags] ) + --> return pointer to compiled statement or NIL if error occurs TODO: pszTail? */ @@ -845,7 +844,7 @@ HB_FUNC( SQLITE3_PREPARE ) /** Determine If An SQL Statement Is Complete - sqlite3_complete( sqlText ) -> lResult + sqlite3_complete( sqlText ) --> lResult */ HB_FUNC( SQLITE3_COMPLETE ) @@ -867,12 +866,12 @@ HB_FUNC( SQLITE3_COMPLETE ) used to create a prepared statement if that statement was compiled using either sqlite3_prepare() - sqlite3_sql( pStmt ) -> cSQLTEXT + sqlite3_sql( pStmt ) --> cSQLTEXT */ HB_FUNC( SQLITE3_SQL ) { -/* TOFIX: verify the exact SQLITE3 version */ +/* FIXME: verify the exact SQLITE3 version */ #if SQLITE_VERSION_NUMBER > 3004001 psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 ); @@ -888,7 +887,7 @@ HB_FUNC( SQLITE3_SQL ) /** Prepared Statement Status. - sqlite3_stmt_status( pStmt, nOp, lResetFlag ) -> nStatus + sqlite3_stmt_status( pStmt, nOp, lResetFlag ) --> nStatus */ HB_FUNC( SQLITE3_STMT_STATUS ) @@ -906,7 +905,7 @@ HB_FUNC( SQLITE3_STMT_STATUS ) } /** - sqlite3_stmt_readonly( pStmt ) -> lResult + sqlite3_stmt_readonly( pStmt ) --> lResult Determine If An SQL Statement Writes The Database */ @@ -927,7 +926,7 @@ HB_FUNC( SQLITE3_STMT_READONLY ) /** Find The Database Handle Associated With A Prepared Statement - sqlite3_db_handle( pStmt ) -> pHbSqlite3 + sqlite3_db_handle( pStmt ) --> pHbSqlite3 */ #if 0 @@ -947,7 +946,7 @@ HB_FUNC( SQLITE3_DB_HANDLE ) /** Evaluate An Prepared SQL Statement - sqlite3_step( pStmt ) -> nResultCode + sqlite3_step( pStmt ) --> nResultCode */ HB_FUNC( SQLITE3_STEP ) @@ -963,7 +962,7 @@ HB_FUNC( SQLITE3_STEP ) /** Reset All Bindings On A Prepared Statement - sqlite3_clear_bindings( pStmt ) -> nResultCode + sqlite3_clear_bindings( pStmt ) --> nResultCode Contrary to the intuition of many, sqlite3_reset() does not reset the bindings on a prepared statement. @@ -983,7 +982,7 @@ HB_FUNC( SQLITE3_CLEAR_BINDINGS ) /** Reset A Prepared Statement Object - sqlite3_reset( pStmt ) -> nResultCode + sqlite3_reset( pStmt ) --> nResultCode */ HB_FUNC( SQLITE3_RESET ) @@ -999,7 +998,7 @@ HB_FUNC( SQLITE3_RESET ) /** Finalize A Prepared Statement Object - sqlite3_finalize( pStmt ) -> nResultCode + sqlite3_finalize( pStmt ) --> nResultCode */ HB_FUNC( SQLITE3_FINALIZE ) @@ -1119,7 +1118,7 @@ HB_FUNC( SQLITE3_BIND_ZEROBLOB ) /** Number Of Host Parameters - sqlite3_bind_parameter_count( pStmt ) -> nResult + sqlite3_bind_parameter_count( pStmt ) --> nResult */ HB_FUNC( SQLITE3_BIND_PARAMETER_COUNT ) @@ -1135,7 +1134,7 @@ HB_FUNC( SQLITE3_BIND_PARAMETER_COUNT ) /** Index Of A Parameter With A Given Name - sqlite3_bind_parameter_index( pStmt, cParameterName ) -> nResult + sqlite3_bind_parameter_index( pStmt, cParameterName ) --> nResult */ HB_FUNC( SQLITE3_BIND_PARAMETER_INDEX ) @@ -1157,7 +1156,7 @@ HB_FUNC( SQLITE3_BIND_PARAMETER_INDEX ) /** Name Of A Host Parameter - sqlite3_bind_parameter_name( pStmt, nParameterIndex ) -> cParameterName + sqlite3_bind_parameter_name( pStmt, nParameterIndex ) --> cParameterName */ HB_FUNC( SQLITE3_BIND_PARAMETER_NAME ) @@ -1173,7 +1172,7 @@ HB_FUNC( SQLITE3_BIND_PARAMETER_NAME ) /** Count The Number Of Rows Modified - sqlite3_changes( db ) -> nRowCount + sqlite3_changes( db ) --> nRowCount */ HB_FUNC( SQLITE3_CHANGES ) @@ -1189,7 +1188,7 @@ HB_FUNC( SQLITE3_CHANGES ) /** Total Number Of Rows Modified - sqlite3_total_changes( db ) -> nRowCount + sqlite3_total_changes( db ) --> nRowCount */ HB_FUNC( SQLITE3_TOTAL_CHANGES ) @@ -1205,7 +1204,7 @@ HB_FUNC( SQLITE3_TOTAL_CHANGES ) /** Number Of Columns In A Result Set - sqlite3_column_count( pStmt ) -> nColumnCount + sqlite3_column_count( pStmt ) --> nColumnCount */ HB_FUNC( SQLITE3_COLUMN_COUNT ) @@ -1219,7 +1218,7 @@ HB_FUNC( SQLITE3_COLUMN_COUNT ) } /** - sqlite3_column_type( pStmt, nIndex ) -> nColumnType + sqlite3_column_type( pStmt, nIndex ) --> nColumnType nColumnType is Datatype code for the initial data type of the result column SQLITE_INTEGER 1 @@ -1230,7 +1229,7 @@ HB_FUNC( SQLITE3_COLUMN_COUNT ) SQLITE_NULL 5 Declared Datatype Of A Query Result (see doc) - sqlite3_column_decltype( pStmt, nIndex ) -> nColumnDeclType + sqlite3_column_decltype( pStmt, nIndex ) --> nColumnDeclType */ HB_FUNC( SQLITE3_COLUMN_TYPE ) @@ -1256,7 +1255,7 @@ HB_FUNC( SQLITE3_COLUMN_DECLTYPE ) /** Column Names In A Result Set - sqlite3_column_name( pStmt, columnIndex ) -> columnName + sqlite3_column_name( pStmt, columnIndex ) --> columnName */ HB_FUNC( SQLITE3_COLUMN_NAME ) @@ -1271,15 +1270,15 @@ HB_FUNC( SQLITE3_COLUMN_NAME ) /** sqlite3_column_bytes( pStmt, columnIndex ) - -> returns the number of bytes in that BLOB or string + --> returns the number of bytes in that BLOB or string Results Values From A Query - sqlite3_column_blob( pStmt, columnIndex ) -> value as BLOB - sqlite3_column_double( pStmt, columnIndex ) -> value as double - sqlite3_column_int( pStmt, columnIndex ) -> value as integer - sqlite3_column_int64( pStmt, columnIndex ) -> value as long long - sqlite3_column_text( pStmt, columnIndex ) -> value as text + sqlite3_column_blob( pStmt, columnIndex ) --> value as BLOB + sqlite3_column_double( pStmt, columnIndex ) --> value as double + sqlite3_column_int( pStmt, columnIndex ) --> value as integer + sqlite3_column_int64( pStmt, columnIndex ) --> value as long long + sqlite3_column_text( pStmt, columnIndex ) --> value as text */ HB_FUNC( SQLITE3_COLUMN_BYTES ) @@ -1376,7 +1375,7 @@ HB_FUNC( SQLITE3_LOAD_EXTENSION ) /** Enable Or Disable Extension Loading - sqlite3_enable_load_extension( db, lOnOff ) -> prev.state + sqlite3_enable_load_extension( db, lOnOff ) --> prev.state */ HB_FUNC( SQLITE3_ENABLE_LOAD_EXTENSION ) @@ -1423,7 +1422,7 @@ HB_FUNC( SQLITE3_BUSY_TIMEOUT ) /** Convenience Routines For Running Queries - sqlite3_get_table( db, sqlText ) -> aResult + sqlite3_get_table( db, sqlText ) --> aResult */ HB_FUNC( SQLITE3_GET_TABLE ) @@ -1443,11 +1442,12 @@ HB_FUNC( SQLITE3_GET_TABLE ) NULL ), &pResult, &iRow, &iCol, &pszErrMsg ) == SQLITE_OK ) { - int i, j, k = 0; + int i, k = 0; for( i = 0; i < iRow + 1; i++ ) { PHB_ITEM pArray = hb_itemArrayNew( iCol ); + int j; for( j = 1; j <= iCol; j++, k++ ) hb_arraySetStrUTF8( pArray, j, ( const char * ) pResult[ k ] ); @@ -1541,9 +1541,9 @@ HB_FUNC( SQLITE3_TABLE_COLUMN_METADATA ) /** Source Of Data In A Query Result - sqlite3_column_database_name( pStmt, ColumnIndex ) -> cDatabaseName - sqlite3_column_table_name( pStmt, ColumnIndex ) -> cTableName - sqlite3_column_origin_name( pStmt, ColumnIndex ) -> cColumnName + sqlite3_column_database_name( pStmt, ColumnIndex ) --> cDatabaseName + sqlite3_column_table_name( pStmt, ColumnIndex ) --> cTableName + sqlite3_column_origin_name( pStmt, ColumnIndex ) --> cColumnName */ HB_FUNC( SQLITE3_COLUMN_DATABASE_NAME ) @@ -1730,7 +1730,7 @@ HB_FUNC( SQLITE3_BLOB_WRITE ) /** Test To See If The Database Is In Auto-Commit Mode - sqlite3_get_autocommit( db ) -> lResult + sqlite3_get_autocommit( db ) --> lResult */ HB_FUNC( SQLITE3_GET_AUTOCOMMIT ) @@ -1746,7 +1746,7 @@ HB_FUNC( SQLITE3_GET_AUTOCOMMIT ) /** Enable Or Disable Shared Pager Cache - sqlite3_enable_shared_cache( lOnOff ) -> nResultCode + sqlite3_enable_shared_cache( lOnOff ) --> nResultCode */ HB_FUNC( SQLITE3_ENABLE_SHARED_CACHE ) @@ -1754,13 +1754,14 @@ HB_FUNC( SQLITE3_ENABLE_SHARED_CACHE ) hb_retni( sqlite3_enable_shared_cache( hb_parl( 1 ) ) ); } +/* TODO: implement sqlite3_trace_v2(), that replaces both of these deprecated functions */ + /** Tracing And Profiling Functions sqlite3_trace( db, lOnOff ) sqlite3_profile( db, lOnOff ) */ - static void SQL3ProfileLog( void * sFile, const char * sProfileMsg, sqlite3_uint64 uint64 ) { if( sProfileMsg ) @@ -1855,7 +1856,7 @@ HB_FUNC( SQLITE3_BUFF_TO_FILE ) Causes any pending database operation to abort and return at its earliest opportunity. - sqlite3_interrupt( db ) -> NIL + sqlite3_interrupt( db ) --> NIL */ HB_FUNC( SQLITE3_INTERRUPT ) @@ -2025,10 +2026,10 @@ HB_FUNC( SQLITE3_SET_AUTHORIZER ) sqlite3_backup_init( DbDest, cDestName, DbSource, cSourceName ) -> return pointer to Backup or NIL if error occurs - sqlite3_backup_step( pBackup, nPage ) -> nResult - sqlite3_backup_finish( pBackup ) -> nResult - sqlite3_backup_remaining( pBackup ) -> nResult - sqlite3_backup_pagecount( pBackup ) -> nResult + sqlite3_backup_step( pBackup, nPage ) --> nResult + sqlite3_backup_finish( pBackup ) --> nResult + sqlite3_backup_remaining( pBackup ) --> nResult + sqlite3_backup_pagecount( pBackup ) --> nResult */ HB_FUNC( SQLITE3_BACKUP_INIT ) @@ -2046,7 +2047,7 @@ HB_FUNC( SQLITE3_BACKUP_INIT ) 2 ), pHbSqlite3Source->db, hb_parcx( 4 ) ); if( pBackup ) - hb_retptr( pBackup ); /* TOFIX: Create GC collected pointer */ + hb_retptr( pBackup ); /* FIXME: Create GC collected pointer */ else hb_retptr( NULL ); } @@ -2060,7 +2061,7 @@ HB_FUNC( SQLITE3_BACKUP_INIT ) HB_FUNC( SQLITE3_BACKUP_STEP ) { #if SQLITE_VERSION_NUMBER >= 3006011 - /* TOFIX: Use GC collected pointer */ + /* FIXME: Use GC collected pointer */ sqlite3_backup * pBackup = ( sqlite3_backup * ) hb_parptr( 1 ); if( pBackup ) @@ -2075,7 +2076,7 @@ HB_FUNC( SQLITE3_BACKUP_STEP ) HB_FUNC( SQLITE3_BACKUP_FINISH ) { #if SQLITE_VERSION_NUMBER >= 3006011 - /* TOFIX: Use and free GC collected pointer */ + /* FIXME: Use and free GC collected pointer */ sqlite3_backup * pBackup = ( sqlite3_backup * ) hb_parptr( 1 ); if( pBackup ) @@ -2090,7 +2091,7 @@ HB_FUNC( SQLITE3_BACKUP_FINISH ) HB_FUNC( SQLITE3_BACKUP_REMAINING ) { #if SQLITE_VERSION_NUMBER >= 3006011 - /* TOFIX: Use GC collected pointer */ + /* FIXME: Use GC collected pointer */ sqlite3_backup * pBackup = ( sqlite3_backup * ) hb_parptr( 1 ); if( pBackup ) @@ -2105,7 +2106,7 @@ HB_FUNC( SQLITE3_BACKUP_REMAINING ) HB_FUNC( SQLITE3_BACKUP_PAGECOUNT ) { #if SQLITE_VERSION_NUMBER >= 3006011 - /* TOFIX: Use GC collected pointer */ + /* FIXME: Use GC collected pointer */ sqlite3_backup * pBackup = ( sqlite3_backup * ) hb_parptr( 1 ); if( pBackup ) @@ -2120,13 +2121,13 @@ HB_FUNC( SQLITE3_BACKUP_PAGECOUNT ) /** Memory Allocator Statistics - sqlite3_memory_used() -> nResult - sqlite3_memory_highwater( lResetFlag ) -> nResult + sqlite3_memory_used() --> nResult + sqlite3_memory_highwater( lResetFlag ) --> nResult */ HB_FUNC( SQLITE3_MEMORY_USED ) { -/* TOFIX: verify the exact SQLITE3 version */ +/* FIXME: verify the exact SQLITE3 version */ #if SQLITE_VERSION_NUMBER > 3004001 hb_retnint( sqlite3_memory_used() ); #else @@ -2136,7 +2137,7 @@ HB_FUNC( SQLITE3_MEMORY_USED ) HB_FUNC( SQLITE3_MEMORY_HIGHWATER ) { -/* TOFIX: verify the exact SQLITE3 version */ +/* FIXME: verify the exact SQLITE3 version */ #if SQLITE_VERSION_NUMBER > 3004001 hb_retnint( sqlite3_memory_highwater( ( int ) hb_parl( 1 ) ) ); #else @@ -2145,14 +2146,14 @@ HB_FUNC( SQLITE3_MEMORY_HIGHWATER ) } /** - Test To See If The Library Is Threadsafe + Test to see if the library is thread-safe - sqlite3_threadsafe() -> nResult + sqlite3_threadsafe() --> nResult */ HB_FUNC( SQLITE3_THREADSAFE ) { -/* TOFIX: verify the exact SQLITE3 version */ +/* FIXME: verify the exact SQLITE3 version */ #if SQLITE_VERSION_NUMBER > 3004001 hb_retni( sqlite3_threadsafe() ); #else @@ -2163,16 +2164,16 @@ HB_FUNC( SQLITE3_THREADSAFE ) /** SQLite Runtime Status - sqlite3_status( nOp, @nCurrent, @nHighwater, lResetFlag ) -> nResult + sqlite3_status( nOp, @nCurrent, @nHighwater, lResetFlag ) --> nResult */ HB_FUNC( SQLITE3_STATUS ) { #if SQLITE_VERSION_NUMBER >= 3006000 - int iCurrent, iHighwater; - if( hb_pcount() > 3 && ( HB_ISNUM( 2 ) && HB_ISBYREF( 2 ) ) && ( HB_ISNUM( 3 ) && HB_ISBYREF( 3 ) ) ) { + int iCurrent, iHighwater; + hb_retni( sqlite3_status( hb_parni( 1 ), &iCurrent, &iHighwater, ( int ) hb_parl( 4 ) ) ); hb_storni( iCurrent, 2 ); @@ -2188,18 +2189,19 @@ HB_FUNC( SQLITE3_STATUS ) /** Database Connection Status - sqlite3_db_status( pDb, nOp, @nCurrent, @nHighwater, lResetFlag ) -> nResult + sqlite3_db_status( pDb, nOp, @nCurrent, @nHighwater, lResetFlag ) --> nResult */ HB_FUNC( SQLITE3_DB_STATUS ) { #if SQLITE_VERSION_NUMBER >= 3006001 - int iCurrent, iHighwater; HB_SQLITE3 * pHbSqlite3 = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE ); if( pHbSqlite3 && pHbSqlite3->db && ( hb_pcount() > 4 ) && ( HB_ISNUM( 3 ) && HB_ISBYREF( 3 ) ) && ( HB_ISNUM( 4 ) && HB_ISBYREF( 4 ) ) ) { + int iCurrent, iHighwater; + hb_retni( sqlite3_db_status( pHbSqlite3->db, hb_parni( 2 ), &iCurrent, &iHighwater, ( int ) hb_parl( 5 ) ) ); @@ -2216,7 +2218,7 @@ HB_FUNC( SQLITE3_DB_STATUS ) /** Run-time Limits - sqlite3_limit( pDb, nId, nNewVal ) -> nOldVal + sqlite3_limit( pDb, nId, nNewVal ) --> nOldVal */ HB_FUNC( SQLITE3_LIMIT ) @@ -2236,8 +2238,8 @@ HB_FUNC( SQLITE3_LIMIT ) /** Run-Time Library Compilation Options Diagnostics - sqlite3_compileoption_used( cOptName ) -> nResult - sqlite3_compileoption_get( nOptNum ) -> cResult + sqlite3_compileoption_used( cOptName ) --> nResult + sqlite3_compileoption_get( nOptNum ) --> cResult */ HB_FUNC( SQLITE3_COMPILEOPTION_USED ) diff --git a/contrib/hbtest/hbtest.ch b/contrib/hbtest/hbtest.ch index deef8a1726..c690368c30 100644 --- a/contrib/hbtest/hbtest.ch +++ b/contrib/hbtest/hbtest.ch @@ -47,7 +47,7 @@ #ifndef HB_TEST_CH_ #define HB_TEST_CH_ -#translate HBTEST IS => hbtest_Call( #, {|| }, ) +#xtranslate HBTEST IS => hbtest_Call( #, {|| }, ) #pragma linenumber=on diff --git a/contrib/hbtip/client.prg b/contrib/hbtip/client.prg index 91adca1e7c..0fe95c5c10 100644 --- a/contrib/hbtip/client.prg +++ b/contrib/hbtip/client.prg @@ -70,7 +70,7 @@ CREATE CLASS TIPClient CLASS VAR bInitSocks INIT .F. CLASS VAR cCRLF INIT tip_CRLF() - VAR oUrl /* url to wich to connect */ + VAR oUrl /* URL to which to connect */ VAR oCredentials /* credential needed to access the service */ VAR nStatus INIT 0 /* basic status */ VAR SocketCon @@ -113,7 +113,7 @@ CREATE CLASS TIPClient VAR cProxyPassword VAR lProxyXferSSL INIT .F. /* SSL should only be enabled after proxy connection NOTE: I've only checked HTTP POST / GET, unsure if - there are other funtions with this issue. */ + there are other functions with this issue. */ METHOD New( oUrl, xTrace, oCredentials ) METHOD Open( cUrl ) @@ -411,7 +411,7 @@ METHOD Read( nLen ) CLASS TIPClient IMO the proper fix would have been done to hb_inetRecvAll(). [vszakats] */ ::nLastRead := ::inetRecvAll( ::SocketCon, @cStr0, nLen ) ELSE - // S.R. if len of file is less than RCV_BUF_SIZE hb_inetRecvAll return 0 + // S.R. if length of file is less than RCV_BUF_SIZE hb_inetRecvAll() returns 0 // ::nLastRead := ::InetRecvAll( ::SocketCon, @cStr0, nLen ) ::inetRecvAll( ::SocketCon, @cStr0, nLen ) ::nLastRead := ::inetCount( ::SocketCon ) diff --git a/contrib/hbtip/encoder.prg b/contrib/hbtip/encoder.prg index a173523ce6..1df67c2c20 100644 --- a/contrib/hbtip/encoder.prg +++ b/contrib/hbtip/encoder.prg @@ -45,7 +45,7 @@ * */ -/* Internet Messaging: https://www.ietf.org/rfc/rfc2045.txt */ +/* Internet Messaging: https://tools.ietf.org/html/rfc2045 */ #include "hbclass.ch" diff --git a/contrib/hbtip/httpcli.prg b/contrib/hbtip/httpcli.prg index 6d5f7cd0b3..a573af1e07 100644 --- a/contrib/hbtip/httpcli.prg +++ b/contrib/hbtip/httpcli.prg @@ -372,7 +372,7 @@ METHOD ReadAll() CLASS TIPClientHTTP METHOD PROCEDURE setCookie( cLine ) CLASS TIPClientHTTP - // docs from https://www.ietf.org/rfc/rfc2109.txt + // docs from https://tools.ietf.org/html/rfc2109 LOCAL cHost, cPath, cName, cValue, aElements LOCAL cDefaultHost := ::oUrl:cServer, cDefaultPath := ::oUrl:cPath LOCAL x @@ -471,11 +471,11 @@ METHOD getcookies( cHost, cPath ) CLASS TIPClientHTTP /* nType: 0=as found as the separator in the stdin stream 1=as found as the last one in the stdin stream - 2=as found in the CGI enviroment + 2=as found in the CGI environment Examples: 0: -----------------------------41184676334 // in the body or stdin stream 1: -----------------------------41184676334-- // last one of the stdin stream - 2: ---------------------------41184676334 // in the header or CGI envirnment + 2: ---------------------------41184676334 // in the header or CGI environment */ METHOD Boundary( nType ) CLASS TIPClientHTTP diff --git a/contrib/hbtip/mail.prg b/contrib/hbtip/mail.prg index f998e7d475..e1565ac647 100644 --- a/contrib/hbtip/mail.prg +++ b/contrib/hbtip/mail.prg @@ -2,7 +2,9 @@ * TIP Class oriented Internet protocol library * * Copyright 2003 Giancarlo Niccolai - * Copyright 2007 Hannes Ziegler (setHeader(), attachFile(), detachFile(), getFileName(), isMultiPart(), getMultiParts()) + * Copyright 2007 Hannes Ziegler + * (setHeader(), attachFile(), detachFile(), getFileName(), isMultiPart(), + * getMultiParts()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -305,7 +307,7 @@ METHOD ToString() CLASS TIPMail IF Empty( ::aAttachments ) cRet += ::cBody + iif( ::lBodyEncoded, "", e"\r\n" ) ELSE - // if there are attachements, the body of the message has to be treated as an attachment. [GD] + // if there are attachments, the body of the message has to be treated as an attachment. [GD] cRet += ; "--" + cBoundary + e"\r\n" + ; "Content-Disposition: inline" + e"\r\n" + ; diff --git a/contrib/hbtip/mailassy.prg b/contrib/hbtip/mailassy.prg index 31975460e6..ff4d4d9b6f 100644 --- a/contrib/hbtip/mailassy.prg +++ b/contrib/hbtip/mailassy.prg @@ -2,7 +2,7 @@ * tip_MailAssemble() (This version started from Luiz's original work on SendMail()) * * Copyright 2007 Luiz Rafael Culik Guimaraes and Patrick Mast - * Copyright 2009 Viktor Szakats (vszakats.net/harbour) (SSL support) + * Copyright 2009-2017 Viktor Szakats (vszakats.net/harbour) (SSL support) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/contrib/hbtip/mailsend.prg b/contrib/hbtip/mailsend.prg index c60aec26b9..f146996d8b 100644 --- a/contrib/hbtip/mailsend.prg +++ b/contrib/hbtip/mailsend.prg @@ -69,7 +69,7 @@ FUNCTION hb_SendMail( ... ) xTrace -> Optional. If set to .T., a log file is created (smtp-.log). Standard setting is .F. If a block is passed, it will be called for each log event with the message a string, no param on session close. lPopAuth -> Optional. Do POP3 authentication before sending mail. - lNoAuth -> Optional. Disable Autentication methods + lNoAuth -> Optional. Disable authentication methods nTimeOut -> Optional. Number os ms to wait default 10000 (10s) cReplyTo -> Optional. lSSL -> Optional. Need SSL at connect time (TLS need this param set to False) diff --git a/contrib/hbtip/mime.c b/contrib/hbtip/mime.c index 5f7deaaff8..73a3870bb5 100644 --- a/contrib/hbtip/mime.c +++ b/contrib/hbtip/mime.c @@ -619,7 +619,7 @@ static const char * s_findMimeStringInTree( const char * cData, HB_SIZE nLen, in if( elem->alternate != 0 ) return s_findMimeStringInTree( cData, nLen, iElem + elem->alternate ); - return NULL; /* total giveup */ + return NULL; /* give up */ } static const char * s_findStringMimeType( const char * cData, HB_SIZE nLen ) diff --git a/contrib/hbtip/misc.c b/contrib/hbtip/misc.c index 13f3b96fb0..3eda69b325 100644 --- a/contrib/hbtip/misc.c +++ b/contrib/hbtip/misc.c @@ -2,7 +2,8 @@ * TIP Class oriented Internet protocol library * * Copyright 2003 Giancarlo Niccolai - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (tip_TimeStamp() rework, cleanups) + * Copyright 1999-2017 Viktor Szakats (vszakats.net/harbour) + * (tip_TimeStamp() rework, cleanups) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +50,9 @@ #include "hbapierr.h" #include "hbdate.h" -/* Internet timestamp based on RFC 822 & RFC 2822 */ +/* Internet timestamp based on: + https://tools.ietf.org/html/rfc822 + https://tools.ietf.org/html/rfc2822 */ HB_FUNC( TIP_TIMESTAMP ) { static const char * s_days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; @@ -65,7 +68,7 @@ HB_FUNC( TIP_TIMESTAMP ) { hb_dateDecode( hb_pardl( 1 ), &iYear, &iMonth, &iDay ); - /* For compatibility, seconds() value */ + /* For compatibility, Seconds() value */ if( HB_ISNUM( 2 ) ) hb_timeDecode( ( long ) ( hb_parnd( 2 ) * 1000 ), &iHour, &iMinute, &iSecond, &iMSec ); diff --git a/contrib/hbtip/sessid.prg b/contrib/hbtip/sessid.prg index dbb0aa1ba9..9931b6cbea 100644 --- a/contrib/hbtip/sessid.prg +++ b/contrib/hbtip/sessid.prg @@ -90,7 +90,7 @@ FUNCTION tip_CheckSID( cSID, cCRCKey ) NEXT /* Recalculate the CRC */ - nSIDCRC := nKey * 51 // Max Value is 99603. a 5 chars number + nSIDCRC := nKey * 51 // Max Value is 99603. a 5 chars number cTemp := StrZero( nSIDCRC, 5 ) cSIDCRC := "" diff --git a/contrib/hbtip/thtml.ch b/contrib/hbtip/thtml.ch index ddf512ec91..fac65d8d68 100644 --- a/contrib/hbtip/thtml.ch +++ b/contrib/hbtip/thtml.ch @@ -48,7 +48,7 @@ #define _HB_THTML /* Content model shortcut encoding taken from Tidy library - http://www.html-tidy.org/ */ + https://github.com/htacg/tidy-html5 */ #define CM_UNKNOWN 0 #define CM_EMPTY 0x000001 /* Elements with no content. Map to HTML specification. */ @@ -74,7 +74,7 @@ #define CM_NO_INDENT 0x040000 /* Elements whose content needs to be indented only if containing one CM_BLOCK element. */ #define CM_OBSOLETE 0x080000 /* Elements that are obsolete (such as "dir", "menu"). */ -#define CM_NEW 0x100000 /* User defined elements. Used to determine how attributes wihout value +#define CM_NEW 0x100000 /* User defined elements. Used to determine how attributes without value should be printed. */ #define CM_OMITST 0x200000 /* Elements that cannot be omitted. */ diff --git a/contrib/hbtip/thtml.prg b/contrib/hbtip/thtml.prg index 4af8702427..56b9cceeeb 100644 --- a/contrib/hbtip/thtml.prg +++ b/contrib/hbtip/thtml.prg @@ -40,6 +40,7 @@ * * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -89,7 +90,7 @@ THREAD STATIC t_cHtmlUnicChars THREAD STATIC t_aHtmlAnsiEntities // HTML character entities (ANSI character set) THREAD STATIC t_cHtmlAnsiChars #endif -THREAD STATIC t_lInit := .F. // initilization flag for HTML data +THREAD STATIC t_lInit := .F. // initialization flag for HTML data #ifdef _DEBUG_ #xtranslate HIDDEN: => EXPORTED: // debugger cannot see HIDDEN iVars @@ -1621,7 +1622,7 @@ FUNCTION THtmlIsValid( cTagName, cAttrName ) RETURN lRet /* HTML Tag data are adopted for Harbour from Tidy - http://www.html-tidy.org/ */ + https://github.com/htacg/tidy-html5 */ STATIC PROCEDURE _Init_Html_TagTypes @@ -4268,7 +4269,7 @@ FUNCTION ANSIToHtml( cAnsiText ) FUNCTION OEMToHtml( cOemText ) RETURN ANSIToHtml( hb_OEMToANSI( cOemText ) ) -// This function returs the HTML character entities that are exchangeable between ANSI and OEM character sets +// This function returns the HTML character entities that are exchangeable between ANSI and OEM character sets STATIC PROCEDURE _Init_Html_AnsiCharacterEntities() t_cHtmlAnsiChars := ; diff --git a/contrib/hbtip/url.prg b/contrib/hbtip/url.prg index 8e35a01a33..552403e3cf 100644 --- a/contrib/hbtip/url.prg +++ b/contrib/hbtip/url.prg @@ -47,7 +47,7 @@ #include "hbclass.ch" /* An URL: - https://user:passwd@example.com:port/mypages/mysite/page.html?avar=0&avar1=1 + https://user:passwd@example.org:port/mypages/mysite/page.html?avar=0&avar1=1 ^---^ ^--^ ^----^ ^---------^ ^--^ ^----------------------^ ^------------^ cProto UID PWD cServer nPort cPath cQuery ^------------^ ^-------^ @@ -110,7 +110,7 @@ METHOD SetAddress( cUrl ) CLASS TUrl RETURN .T. ENDIF - // TOPLEVEL url parsing. May fail. + // Top-level URL parsing. May fail. IF Empty( aMatch := hb_regex( ::cREuri, cUrl ) ) RETURN .F. ENDIF diff --git a/contrib/hbtpathy/telepath.ch b/contrib/hbtpathy/telepath.ch index 3b460529a5..0980cc7451 100644 --- a/contrib/hbtpathy/telepath.ch +++ b/contrib/hbtpathy/telepath.ch @@ -1,7 +1,7 @@ /* * Telepathy emulation library (header) * - * Copyright 2000, 2001 Dan Levitt + * Copyright 2000-2001 Dan Levitt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/contrib/hbtpathy/telepath.prg b/contrib/hbtpathy/telepath.prg index 8b732a228c..c7c5c989aa 100644 --- a/contrib/hbtpathy/telepath.prg +++ b/contrib/hbtpathy/telepath.prg @@ -1,8 +1,8 @@ /* * Telepathy emulation library * - * Copyright 2000, 2001 Dan Levitt - * Copyright 2004, 2005 Maurilio Longo + * Copyright 2000-2001 Dan Levitt + * Copyright 2004-2005 Maurilio Longo * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * * This program is free software; you can redistribute it and/or modify @@ -46,31 +46,26 @@ * */ -/* - This is based upon a library originally made by Dan Levitt +/* This is based upon a library originally made by Dan Levitt The original files have been committed as v1.0. So you can always retrieve them - (see VCS docs on how to) -*/ + (see VCS docs on how to) */ #include "telepath.ch" #include "hbcom.ch" - -#define TPFP_NAME 1 /* Structure of ports array */ +#define TPFP_NAME 1 /* Structure of ports array */ #define TPFP_HANDLE 2 #define TPFP_BAUD 3 #define TPFP_DBITS 4 #define TPFP_PARITY 5 #define TPFP_SBITS 6 -#define TPFP_OC 7 /* Open/Close Flag */ +#define TPFP_OC 7 /* Open/Close Flag */ #define TPFP_INBUF 8 -#define TPFP_INBUF_SIZE 9 /* Size of input buffer */ - - -THREAD STATIC t_aPorts // Array with port info -THREAD STATIC t_nErrorCode := 0 // Error code from last operation, 0 if no error +#define TPFP_INBUF_SIZE 9 /* Size of input buffer */ +THREAD STATIC t_aPorts // Array with port info +THREAD STATIC t_nErrorCode := 0 // Error code from last operation, 0 if no error FUNCTION tp_baud( nPort, nNewBaud ) diff --git a/contrib/hbunix/chroot.c b/contrib/hbunix/chroot.c index c89e2a8368..4cc8b7211a 100644 --- a/contrib/hbunix/chroot.c +++ b/contrib/hbunix/chroot.c @@ -1,5 +1,5 @@ /* - * UNIX function wrappers (chroot) + * Unix function wrappers (chroot) * * Copyright 2011 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/hbunix/daemon.c b/contrib/hbunix/daemon.c index 3e54218890..ac8e6bfc38 100644 --- a/contrib/hbunix/daemon.c +++ b/contrib/hbunix/daemon.c @@ -57,7 +57,7 @@ HB_FUNC( UNIX_DAEMON ) if( ! HB_PARLUNIX( 1 ) && chdir( "/" ) == -1 ) { - /* FALLTHROUGH */ + /* fallthrough */ } if( ! HB_PARLUNIX( 2 ) && ( fd = open( "/dev/null", O_RDWR ) ) != -1 ) diff --git a/contrib/hbwin/axcore.c b/contrib/hbwin/axcore.c index b9f0a8379f..837afb4d6e 100644 --- a/contrib/hbwin/axcore.c +++ b/contrib/hbwin/axcore.c @@ -129,7 +129,6 @@ PHB_ITEM hb_oleAxControlNew( PHB_ITEM pItem, HWND hWnd ) { IUnknown * pUnk = NULL; IDispatch * pDisp = NULL; - HRESULT lOleError; if( pItem ) hb_itemClear( pItem ); @@ -141,7 +140,7 @@ PHB_ITEM hb_oleAxControlNew( PHB_ITEM pItem, HWND hWnd ) } else { - lOleError = ( *s_pAtlAxGetControl )( hWnd, &pUnk ); + HRESULT lOleError = ( *s_pAtlAxGetControl )( hWnd, &pUnk ); if( lOleError == S_OK ) { @@ -201,11 +200,11 @@ HB_FUNC( __AXDOVERB ) /* ( hWndAx, iVerb ) --> hResult */ if( lOleError == S_OK ) { MSG Msg; - RECT rct; + RECT rc; memset( &Msg, 0, sizeof( Msg ) ); - GetClientRect( hWnd, &rct ); - HB_VTBL( lpOleObject )->DoVerb( HB_THIS_( lpOleObject ) hb_parni( 2 ), &Msg, lpOleClientSite, 0, hWnd, &rct ); + GetClientRect( hWnd, &rc ); + HB_VTBL( lpOleObject )->DoVerb( HB_THIS_( lpOleObject ) hb_parni( 2 ), &Msg, lpOleClientSite, 0, hWnd, &rc ); } HB_VTBL( lpOleObject )->Release( HB_THIS( lpOleObject ) ); } @@ -217,7 +216,7 @@ HB_FUNC( __AXDOVERB ) /* ( hWndAx, iVerb ) --> hResult */ } -/* ======================== Event handler support ======================== */ +/* --- Event handler support --- */ #if ! defined( HB_OLE_C_API ) @@ -398,7 +397,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * TYPEATTR * pTypeAttr; HREFTYPE hRefType; HRESULT hr; - int iFlags, i, j; + int iFlags, i; if( ! szEvent ) { @@ -491,6 +490,8 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * { if( pTypeAttr->typekind == TKIND_COCLASS ) { + int j; + for( j = 0; j < pTypeAttr->cImplTypes; j++ ) { if( szEvent ) @@ -587,7 +588,7 @@ static void hb_sink_destruct( void * cargo ) DWORD dwCookie = pSink->dwCookie; /* Unadvise() may activate pSink destructor so clear these - * items as protection against recursive Unadvise call. + * items as protection against recursive Unadvise() call. */ pSink->pConnectionPoint = NULL; pSink->dwCookie = 0; diff --git a/contrib/hbwin/hbolesrv.c b/contrib/hbwin/hbolesrv.c index 81634d4334..9fe23aa858 100644 --- a/contrib/hbwin/hbolesrv.c +++ b/contrib/hbwin/hbolesrv.c @@ -191,13 +191,13 @@ static HB_BOOL s_getKeyValue( LPCTSTR lpKey, LPTSTR lpBuffer, int iLen ) #if ! defined( HB_OLE_C_API ) typedef struct { - HRESULT ( STDMETHODCALLTYPE * QueryInterface ) ( IDispatch*, REFIID, void** ); - ULONG ( STDMETHODCALLTYPE * AddRef ) ( IDispatch* ); - ULONG ( STDMETHODCALLTYPE * Release ) ( IDispatch* ); - HRESULT ( STDMETHODCALLTYPE * GetTypeInfoCount ) ( IDispatch*, UINT* ); - HRESULT ( STDMETHODCALLTYPE * GetTypeInfo ) ( IDispatch*, UINT, LCID, ITypeInfo** ); - HRESULT ( STDMETHODCALLTYPE * GetIDsOfNames ) ( IDispatch*, REFIID, LPOLESTR*, UINT, LCID, DISPID* ); - HRESULT ( STDMETHODCALLTYPE * Invoke ) ( IDispatch*, DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT* ); + HRESULT ( STDMETHODCALLTYPE * QueryInterface ) ( IDispatch *, REFIID, void ** ); + ULONG ( STDMETHODCALLTYPE * AddRef ) ( IDispatch * ); + ULONG ( STDMETHODCALLTYPE * Release ) ( IDispatch * ); + HRESULT ( STDMETHODCALLTYPE * GetTypeInfoCount ) ( IDispatch *, UINT * ); + HRESULT ( STDMETHODCALLTYPE * GetTypeInfo ) ( IDispatch *, UINT, LCID, ITypeInfo ** ); + HRESULT ( STDMETHODCALLTYPE * GetIDsOfNames ) ( IDispatch *, REFIID, LPOLESTR *, UINT, LCID, DISPID * ); + HRESULT ( STDMETHODCALLTYPE * Invoke ) ( IDispatch *, DISPID, REFIID, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT * ); } IDispatchVtbl; #endif @@ -507,11 +507,11 @@ static const IDispatchVtbl IHbOleServer_Vtbl = { #if ! defined( HB_OLE_C_API ) typedef struct { - HRESULT ( STDMETHODCALLTYPE * QueryInterface ) ( IClassFactory*, REFIID, void** ); - ULONG ( STDMETHODCALLTYPE * AddRef ) ( IClassFactory* ); - ULONG ( STDMETHODCALLTYPE * Release ) ( IClassFactory* ); - HRESULT ( STDMETHODCALLTYPE * CreateInstance ) ( IClassFactory*, IUnknown*, REFIID, void** ); - HRESULT ( STDMETHODCALLTYPE * LockServer) ( IClassFactory*, BOOL ); + HRESULT ( STDMETHODCALLTYPE * QueryInterface ) ( IClassFactory *, REFIID, void ** ); + ULONG ( STDMETHODCALLTYPE * AddRef ) ( IClassFactory * ); + ULONG ( STDMETHODCALLTYPE * Release ) ( IClassFactory * ); + HRESULT ( STDMETHODCALLTYPE * CreateInstance ) ( IClassFactory *, IUnknown *, REFIID, void ** ); + HRESULT ( STDMETHODCALLTYPE * LockServer) ( IClassFactory *, BOOL ); } IClassFactoryVtbl; #endif @@ -719,11 +719,12 @@ STDAPI DllRegisterServer( void ) LPCTSTR lpValName; HRESULT hr = S_OK; HKEY hKey; - long err; int i; for( i = 0; i < ( int ) HB_SIZEOFARRAY( s_regTable ); ++i ) { + long err; + s_getKeyValue( s_regTable[ i ][ 0 ], lpKeyName, MAX_REGSTR_SIZE ); if( s_regTable[ i ][ 1 ] ) { diff --git a/contrib/hbwin/hbsim.ch b/contrib/hbwin/hbsim.ch index 46f0476af1..04d7e4e348 100644 --- a/contrib/hbwin/hbsim.ch +++ b/contrib/hbwin/hbsim.ch @@ -50,10 +50,10 @@ /* Error codes for SIM API */ #define SIM_E_OK 0 // This is non standard... #define SIM_E_HB_MISC -1 // This is non standard... -#define SIM_E_HB_NOTINITIALIZED -10 // This is non standard (class tsim not initialized sim) +#define SIM_E_HB_NOTINITIALIZED -10 // This is non standard (class wce_Sim not initialized sim) #define SIM_E_SIMFAILURE -100 // SIM failure was detected #define SIM_E_SIMBUSY -200 // SIM is busy -#define SIM_E_SIMWRONG -300 // Inorrect SIM was inserted +#define SIM_E_SIMWRONG -300 // Incorrect SIM was inserted #define SIM_E_NOSIMMSGSTORAGE -400 // SIM isn't capable of storing messages #define SIM_E_SIMTOOLKITBUSY -500 // SIM Application Toolkit is busy #define SIM_E_SIMDOWNLOADERROR -600 // SIM data download error @@ -97,7 +97,7 @@ #define SIM_PBSTORAGE_EMERGENCY 0x00000001 // Emergency dial list #define SIM_PBSTORAGE_FIXEDDIALING 0x00000002 // SIM fixed dialing list #define SIM_PBSTORAGE_LASTDIALING 0x00000004 // SIM last dialing list -#define SIM_PBSTORAGE_OWNNUMBERS 0x00000008 // SIM ownnumbers lists +#define SIM_PBSTORAGE_OWNNUMBERS 0x00000008 // SIM own numbers lists #define SIM_PBSTORAGE_SIM 0x00000010 // General SIM Storage #define SIM_NUMPBSTORAGES 5 // Number of phonebook storages diff --git a/contrib/hbwin/hbwinole.h b/contrib/hbwin/hbwinole.h index d2df3ef8f4..88e0248e18 100644 --- a/contrib/hbwin/hbwinole.h +++ b/contrib/hbwin/hbwinole.h @@ -61,11 +61,11 @@ * compilers like OpenWatcom but not for all, f.e. it will not help * BCC when used with -P (C++ mode) switch. */ -/* +#if 0 #if defined( __cplusplus ) && ! defined( CINTERFACE ) #define CINTERFACE 1 #endif -*/ +#endif /* This code uses named union so this declaration is necessary for * compilers where nameless unions are default @@ -81,8 +81,7 @@ #include #include -/* MinGW is lacking a number of variant accessors - */ +/* MinGW is lacking a number of variant accessors */ #if defined( __MINGW32__ ) # if ! defined( V_I1REF ) # define V_I1REF( x ) V_UNION( x, pcVal ) @@ -114,8 +113,7 @@ # define HB_WIN_U3( x, y ) ( x )->y #endif -/* macros used to hide type of interface: C or C++ - */ +/* macros used to hide type of interface: C or C++ */ #if defined( __cplusplus ) && ! defined( CINTERFACE ) && \ ( defined( __BORLANDC__ ) || \ defined( __DMC__ ) || \ @@ -161,7 +159,7 @@ extern HB_EXPORT HB_BOOL hb_oleDispInvoke( PHB_SYMB pSym, PHB_ITEM pObject, HB_OLEOBJ_FUNC pObjFunc, HB_USHORT uiClass ); extern HB_EXPORT void hb_oleItemSetDestructor( PHB_ITEM pItem, HB_OLE_DESTRUCTOR_FUNC pFunc, void * cargo ); -/* activex control */ +/* ActiveX control */ extern HB_EXPORT HB_BOOL hb_oleAxInit( void ); extern HB_EXPORT PHB_ITEM hb_oleAxControlNew( PHB_ITEM pItem, HWND hWnd ); diff --git a/contrib/hbwin/oleauto.prg b/contrib/hbwin/oleauto.prg index 2c0dfd6122..91991de610 100644 --- a/contrib/hbwin/oleauto.prg +++ b/contrib/hbwin/oleauto.prg @@ -99,7 +99,7 @@ METHOD __enumSkip( enum, lDescend ) CLASS win_oleAuto METHOD PROCEDURE __enumStop() CLASS win_oleAuto - ::__hObjEnum := NIL /* activate autodestructor */ + ::__hObjEnum := NIL /* activate auto-destructor */ RETURN diff --git a/contrib/hbwin/olecore.c b/contrib/hbwin/olecore.c index ab9d017768..4d55ef4ebe 100644 --- a/contrib/hbwin/olecore.c +++ b/contrib/hbwin/olecore.c @@ -73,7 +73,7 @@ #define HB_OLE_NO_SAFEARRAYGETVARTYPE #endif -/* base date value in OLE (1899-12-30) as julian day */ +/* base date value in OLE (1899-12-30) as Julian day */ #define HB_OLE_DATE_BASE 0x0024D9AB static PHB_DYNS s_pDyns_hb_oleauto; @@ -1206,7 +1206,7 @@ void hb_oleDispatchToItem( PHB_ITEM pItem, IDispatch * pdispVal, HB_USHORT uiCla hb_vmRequestRestore(); /* We should store object to pItem after hb_vmRequestRestore(), - * because pItem actualy can be stack's return item! + * because pItem actually can be stack's return item! */ hb_itemMove( pItem, pObject ); hb_itemRelease( pObject ); @@ -1334,7 +1334,7 @@ void hb_oleVariantToItemEx( PHB_ITEM pItem, VARIANT * pVariant, HB_USHORT uiClas break; case VT_UI8: - /* TODO: sign is lost. Convertion to double will lose significant digits. */ + /* TODO: sign is lost. Conversion to double will lose significant digits. */ #if HB_VMLONG_MAX == INT32_MAX || defined( HB_LONG_LONG_OFF ) hb_itemPutNInt( pItem, ( HB_MAXINT ) V_UI4( pVariant ) ); #elif defined( HB_OLE_NO_LL ) @@ -1346,7 +1346,7 @@ void hb_oleVariantToItemEx( PHB_ITEM pItem, VARIANT * pVariant, HB_USHORT uiClas break; case VT_UI8 | VT_BYREF: - /* TODO: sign is lost. Convertion to double will lose significant digits. */ + /* TODO: sign is lost. Conversion to double will lose significant digits. */ #if HB_VMLONG_MAX == INT32_MAX || defined( HB_LONG_LONG_OFF ) hb_itemPutNInt( pItem, ( HB_MAXINT ) *V_UI4REF( pVariant ) ); #elif defined( HB_OLE_NO_LLREF ) @@ -2284,7 +2284,7 @@ HB_FUNC( WIN_OLEAUTO___ONERROR ) if( iPCount >= 1 && HB_ISHASH( 1 ) ) { - /* named parameters are passsed in hash array */ + /* named parameters are passed in hash array */ PHB_ITEM pArgs[ HB_OLE_MAX_NAMEDARGS ]; DISPID pDispIds[ HB_OLE_MAX_NAMEDARGS + 1 ]; UINT uiNamedArgs; @@ -2576,7 +2576,7 @@ HB_FUNC( __OLEINVOKEPUT ) } -/* __oleVariantGetValue( ) -> */ +/* __oleVariantGetValue( ) --> */ HB_FUNC( __OLEVARIANTGETVALUE ) { VARIANT * pVariant = hb_oleVariantParam( 1 ); @@ -2585,7 +2585,7 @@ HB_FUNC( __OLEVARIANTGETVALUE ) hb_oleVariantToItemEx( hb_stackReturnItem(), pVariant, 0 ); } -/* __oleVariantGetType( ) -> */ +/* __oleVariantGetType( ) --> */ HB_FUNC( __OLEVARIANTGETTYPE ) { VARIANT * pVariant = hb_oleVariantParam( 1 ); @@ -2594,7 +2594,7 @@ HB_FUNC( __OLEVARIANTGETTYPE ) hb_retni( V_VT( pVariant ) ); } -/* __oleVariantNew( , [], [] ) -> */ +/* __oleVariantNew( , [], [] ) --> */ HB_FUNC( __OLEVARIANTNEW ) { int iType = hb_parni( 1 ); @@ -2853,7 +2853,7 @@ HB_FUNC( __OLEVARIANTNEW ) hb_errRT_OLE( EG_ARG, 1018, 0, NULL, HB_ERR_FUNCNAME, NULL ); } -/* __oleVariantNullDate( [] ) -> */ +/* __oleVariantNullDate( [] ) --> */ HB_FUNC( __OLEVARIANTNULLDATE ) { hb_retl( hb_oleGetNullDateFlag() ); @@ -2861,7 +2861,7 @@ HB_FUNC( __OLEVARIANTNULLDATE ) hb_oleSetNullDateFlag( hb_parl( 1 ) ); } -/* __oleVariantNil2Null( [] ) -> */ +/* __oleVariantNil2Null( [] ) --> */ HB_FUNC( __OLEVARIANTNIL2NULL ) { hb_retl( hb_oleGetNil2NullFlag() ); diff --git a/contrib/hbwin/wapi_commctrl.c b/contrib/hbwin/wapi_commctrl.c index eb041cc1be..41f70ee135 100644 --- a/contrib/hbwin/wapi_commctrl.c +++ b/contrib/hbwin/wapi_commctrl.c @@ -1,7 +1,7 @@ /* * Windows API functions (commctrl) * - * Pritpal Bedi 14Feb2009 + * Copyright 2009 Pritpal Bedi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,11 +56,8 @@ #endif /*----------------------------------------------------------------------*/ -/* BEGIN - ImageList_* - API */ -/*----------------------------------------------------------------------*/ -/* - int ImageList_Add( HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask ); - */ +/* --- BEGIN - ImageList_* - API --- */ +/* int ImageList_Add( HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask ); */ HB_FUNC( WAPI_IMAGELIST_ADD ) { hbwapi_ret_NI( ImageList_Add( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -68,9 +65,7 @@ HB_FUNC( WAPI_IMAGELIST_ADD ) hbwapi_par_raw_HBITMAP( 3 ) ) ); } -/* - int ImageList_AddMasked( HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask ); - */ +/* int ImageList_AddMasked( HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask ); */ HB_FUNC( WAPI_IMAGELIST_ADDMASKED ) { hbwapi_ret_NI( ImageList_AddMasked( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -78,9 +73,7 @@ HB_FUNC( WAPI_IMAGELIST_ADDMASKED ) hbwapi_par_COLORREF( 3 ) ) ); } -/* - BOOL ImageList_BeginDrag( HIMAGELIST himlTrack, int iTrack, int dxHotspot, int dyHotspot ); - */ +/* BOOL ImageList_BeginDrag( HIMAGELIST himlTrack, int iTrack, int dxHotspot, int dyHotspot ); */ HB_FUNC( WAPI_IMAGELIST_BEGINDRAG ) { hbwapi_ret_L( ImageList_BeginDrag( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -89,18 +82,14 @@ HB_FUNC( WAPI_IMAGELIST_BEGINDRAG ) hbwapi_par_INT( 4 ) ) ); } -/* - HRESULT ImageList_CoCreateInstance( REFCLSID rclsid, const IUnknown *punkOuter, REFIID riid, void **ppv ); - */ +/* HRESULT ImageList_CoCreateInstance( REFCLSID rclsid, const IUnknown *punkOuter, REFIID riid, void **ppv ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_COCREATEINSTANCE ) { } #endif -/* - BOOL ImageList_Copy( HIMAGELIST himlDst, int iDst, HIMAGELIST himlSrc, int iSrc, UINT uFlags ); - */ +/* BOOL ImageList_Copy( HIMAGELIST himlDst, int iDst, HIMAGELIST himlSrc, int iSrc, UINT uFlags ); */ HB_FUNC( WAPI_IMAGELIST_COPY ) { #if ( _WIN32_IE >= 0x0300 ) @@ -114,9 +103,7 @@ HB_FUNC( WAPI_IMAGELIST_COPY ) #endif } -/* - HIMAGELIST ImageList_Create( int cx, int cy, UINT flags, int cInitial, int cGrow ); - */ +/* HIMAGELIST ImageList_Create( int cx, int cy, UINT flags, int cInitial, int cGrow ); */ HB_FUNC( WAPI_IMAGELIST_CREATE ) { hbwapi_ret_raw_HANDLE( ImageList_Create( hbwapi_par_INT( 1 ), @@ -126,17 +113,13 @@ HB_FUNC( WAPI_IMAGELIST_CREATE ) hbwapi_par_INT( 5 ) ) ); } -/* - BOOL ImageList_Destroy( HIMAGELIST himl ); - */ +/* BOOL ImageList_Destroy( HIMAGELIST himl ); */ HB_FUNC( WAPI_IMAGELIST_DESTROY ) { hbwapi_ret_L( ImageList_Destroy( hbwapi_par_raw_HIMAGELIST( 1 ) ) ); } -/* - BOOL ImageList_DragEnter( HWND hwndLock, int x, int y ); - */ +/* BOOL ImageList_DragEnter( HWND hwndLock, int x, int y ); */ HB_FUNC( WAPI_IMAGELIST_DRAGENTER ) { hbwapi_ret_L( ImageList_DragEnter( hbwapi_par_raw_HWND( 1 ), @@ -144,34 +127,26 @@ HB_FUNC( WAPI_IMAGELIST_DRAGENTER ) hbwapi_par_INT( 3 ) ) ); } -/* - BOOL ImageList_DragLeave( HWND hwndLock ); - */ +/* BOOL ImageList_DragLeave( HWND hwndLock ); */ HB_FUNC( WAPI_IMAGELIST_DRAGLEAVE ) { hbwapi_ret_L( ImageList_DragLeave( hbwapi_par_raw_HWND( 1 ) ) ); } -/* - BOOL ImageList_DragMove( int x, int y ); - */ +/* BOOL ImageList_DragMove( int x, int y ); */ HB_FUNC( WAPI_IMAGELIST_DRAGMOVE ) { hbwapi_ret_L( ImageList_DragMove( hbwapi_par_INT( 1 ), hbwapi_par_INT( 2 ) ) ); } -/* - BOOL ImageList_DragShowNolock( BOOL fShow ); - */ +/* BOOL ImageList_DragShowNolock( BOOL fShow ); */ HB_FUNC( WAPI_IMAGELIST_DRAGSHOWNOLOCK ) { hbwapi_ret_L( ImageList_DragShowNolock( hb_parl( 1 ) ) ); } -/* - BOOL ImageList_Draw( HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle ); - */ +/* BOOL ImageList_Draw( HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle ); */ HB_FUNC( WAPI_IMAGELIST_DRAW ) { hbwapi_ret_L( ImageList_Draw( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -182,10 +157,8 @@ HB_FUNC( WAPI_IMAGELIST_DRAW ) hbwapi_par_UINT( 6 ) ) ); } -/* - BOOL ImageList_DrawEx( HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, - COLORREF rgbBk, COLORREF rgbFg, UINT fStyle ); - */ +/* BOOL ImageList_DrawEx( HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, + COLORREF rgbBk, COLORREF rgbFg, UINT fStyle ); */ HB_FUNC( WAPI_IMAGELIST_DRAWEX ) { hbwapi_ret_L( ImageList_DrawEx( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -200,18 +173,14 @@ HB_FUNC( WAPI_IMAGELIST_DRAWEX ) hbwapi_par_UINT( 10 ) ) ); } -/* - BOOL ImageList_DrawIndirect( IMAGELISTDRAWPARAMS *pimldp ); - */ +/* BOOL ImageList_DrawIndirect( IMAGELISTDRAWPARAMS *pimldp ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_DRAWINDIRECT ) { } #endif -/* - HIMAGELIST ImageList_Duplicate( HIMAGELIST himl ); - */ +/* HIMAGELIST ImageList_Duplicate( HIMAGELIST himl ); */ HB_FUNC( WAPI_IMAGELIST_DUPLICATE ) { #if ( _WIN32_IE >= 0x0400 ) @@ -221,9 +190,7 @@ HB_FUNC( WAPI_IMAGELIST_DUPLICATE ) #endif } -/* - VOID ImageList_EndDrag( VOID ); - */ +/* VOID ImageList_EndDrag( VOID ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_ENDDRAG ) { @@ -231,26 +198,20 @@ HB_FUNC( WAPI_IMAGELIST_ENDDRAG ) } #endif -/* - COLORREF ImageList_GetBkColor( HIMAGELIST himl ); - */ +/* COLORREF ImageList_GetBkColor( HIMAGELIST himl ); */ HB_FUNC( WAPI_IMAGELIST_GETBKCOLOR ) { hbwapi_ret_COLORREF( ImageList_GetBkColor( hbwapi_par_raw_HIMAGELIST( 1 ) ) ); } -/* - HIMAGELIST ImageList_GetDragImage( POINT *ppt, POINT *pptHotspot ); - */ +/* HIMAGELIST ImageList_GetDragImage( POINT *ppt, POINT *pptHotspot ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_GETDRAGIMAGE ) { } #endif -/* - HICON ImageList_GetIcon( HIMAGELIST himl, int i, UINT flags ); - */ +/* HICON ImageList_GetIcon( HIMAGELIST himl, int i, UINT flags ); */ HB_FUNC( WAPI_IMAGELIST_GETICON ) { hbwapi_ret_raw_HANDLE( ImageList_GetIcon( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -258,9 +219,7 @@ HB_FUNC( WAPI_IMAGELIST_GETICON ) hbwapi_par_UINT( 3 ) ) ); } -/* - BOOL ImageList_GetIconSize( HIMAGELIST himl, int *cx, int *cy ); - */ +/* BOOL ImageList_GetIconSize( HIMAGELIST himl, int *cx, int *cy ); */ HB_FUNC( WAPI_IMAGELIST_GETICONSIZE ) { int cx; @@ -276,31 +235,25 @@ HB_FUNC( WAPI_IMAGELIST_GETICONSIZE ) hb_retl( HB_FALSE ); } -/* - int ImageList_GetImageCount( HIMAGELIST himl ); - */ +/* int ImageList_GetImageCount( HIMAGELIST himl ); */ HB_FUNC( WAPI_IMAGELIST_GETIMAGECOUNT ) { hbwapi_ret_NI( ImageList_GetImageCount( hbwapi_par_raw_HIMAGELIST( 1 ) ) ); } -/* T O R E V I E W - BOOL ImageList_GetImageInfo( HIMAGELIST himl, int i, IMAGEINFO *pImageInfo ); - */ +/* BOOL ImageList_GetImageInfo( HIMAGELIST himl, int i, IMAGEINFO *pImageInfo ); */ HB_FUNC( WAPI_IMAGELIST_GETIMAGEINFO ) { IMAGEINFO ii; if( ImageList_GetImageInfo( hbwapi_par_raw_HIMAGELIST( 1 ), hbwapi_par_INT( 2 ), &ii ) ) - hb_retclen( ( char * ) &ii, sizeof( IMAGEINFO ) ); + hb_retclen( ( char * ) &ii, sizeof( ii ) ); else hb_retc_null(); } -/* - HIMAGELIST ImageList_LoadImage( HINSTANCE hi, LPCTSTR lpbmp, int cx, int cGrow, - COLORREF crMask, UINT uType, UINT uFlags ); - */ +/* HIMAGELIST ImageList_LoadImage( HINSTANCE hi, LPCTSTR lpbmp, int cx, int cGrow, + COLORREF crMask, UINT uType, UINT uFlags ); */ HB_FUNC( WAPI_IMAGELIST_LOADIMAGE ) { #if ! defined( HB_OS_WIN_CE ) @@ -323,9 +276,7 @@ HB_FUNC( WAPI_IMAGELIST_LOADIMAGE ) #endif } -/* - HIMAGELIST ImageList_Merge( HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy ); - */ +/* HIMAGELIST ImageList_Merge( HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy ); */ HB_FUNC( WAPI_IMAGELIST_MERGE ) { hbwapi_ret_raw_HANDLE( ImageList_Merge( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -337,36 +288,28 @@ HB_FUNC( WAPI_IMAGELIST_MERGE ) } -/* - HIMAGELIST ImageList_Read( LPSTREAM pstm ); - */ +/* HIMAGELIST ImageList_Read( LPSTREAM pstm ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_READ ) { } #endif -/* - HRESULT ImageList_ReadEx( DWORD dwFlags, LPSTREAM pstm, REFIID riid, void **ppv ); - */ +/* HRESULT ImageList_ReadEx( DWORD dwFlags, LPSTREAM pstm, REFIID riid, void **ppv ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_READEX ) { } #endif -/* - BOOL ImageList_Remove( HIMAGELIST himl, int i ); - */ +/* BOOL ImageList_Remove( HIMAGELIST himl, int i ); */ HB_FUNC( WAPI_IMAGELIST_REMOVE ) { hbwapi_ret_L( ImageList_Remove( hbwapi_par_raw_HIMAGELIST( 1 ), hbwapi_par_INT( 2 ) ) ); } -/* - BOOL ImageList_Replace( HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask ); - */ +/* BOOL ImageList_Replace( HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask ); */ HB_FUNC( WAPI_IMAGELIST_REPLACE ) { hbwapi_ret_L( ImageList_Replace( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -375,9 +318,7 @@ HB_FUNC( WAPI_IMAGELIST_REPLACE ) hbwapi_par_raw_HBITMAP( 4 ) ) ); } -/* - int ImageList_ReplaceIcon( HIMAGELIST himl, int i, HICON hicon ); - */ +/* int ImageList_ReplaceIcon( HIMAGELIST himl, int i, HICON hicon ); */ HB_FUNC( WAPI_IMAGELIST_REPLACEICON ) { hbwapi_ret_NI( ImageList_ReplaceIcon( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -386,18 +327,14 @@ HB_FUNC( WAPI_IMAGELIST_REPLACEICON ) } -/* - COLORREF ImageList_SetBkColor( HIMAGELIST himl, COLORREF clrBk ); - */ +/* COLORREF ImageList_SetBkColor( HIMAGELIST himl, COLORREF clrBk ); */ HB_FUNC( WAPI_IMAGELIST_SETBKCOLOR ) { hbwapi_ret_COLORREF( ImageList_SetBkColor( hbwapi_par_raw_HIMAGELIST( 1 ), hbwapi_par_COLORREF( 2 ) ) ); } -/* - int ImageList_SetColorTable( HIMAGELIST himl, int start, int len, RGBQUAD *prgb ); - */ +/* int ImageList_SetColorTable( HIMAGELIST himl, int start, int len, RGBQUAD *prgb ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_SETCOLORTABLE ) { @@ -408,9 +345,7 @@ HB_FUNC( WAPI_IMAGELIST_SETCOLORTABLE ) } #endif -/* - BOOL ImageList_SetDragCursorImage( HIMAGELIST himlDrag, int iDrag, int dxHotspot, int dyHotspot ); - */ +/* BOOL ImageList_SetDragCursorImage( HIMAGELIST himlDrag, int iDrag, int dxHotspot, int dyHotspot ); */ HB_FUNC( WAPI_IMAGELIST_SETDRAGCURSORIMAGE ) { hbwapi_ret_L( ImageList_SetDragCursorImage( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -419,9 +354,7 @@ HB_FUNC( WAPI_IMAGELIST_SETDRAGCURSORIMAGE ) hbwapi_par_INT( 4 ) ) ); } -/* - BOOL ImageList_SetIconSize( HIMAGELIST himl, int cx, int cy ); - */ +/* BOOL ImageList_SetIconSize( HIMAGELIST himl, int cx, int cy ); */ HB_FUNC( WAPI_IMAGELIST_SETICONSIZE ) { hbwapi_ret_L( ImageList_SetIconSize( hbwapi_par_raw_HIMAGELIST( 1 ), @@ -429,9 +362,7 @@ HB_FUNC( WAPI_IMAGELIST_SETICONSIZE ) hbwapi_par_INT( 3 ) ) ); } -/* - BOOL ImageList_SetImageCount( HIMAGELIST himl, UINT uNewCount ); - */ +/* BOOL ImageList_SetImageCount( HIMAGELIST himl, UINT uNewCount ); */ HB_FUNC( WAPI_IMAGELIST_SETIMAGECOUNT ) { #if ( _WIN32_IE >= 0x0400 ) @@ -442,42 +373,32 @@ HB_FUNC( WAPI_IMAGELIST_SETIMAGECOUNT ) #endif } -/* - BOOL ImageList_SetOverlayImage( HIMAGELIST himl, int iImage, int iOverlay ); - */ +/* BOOL ImageList_SetOverlayImage( HIMAGELIST himl, int iImage, int iOverlay ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_SETOVERLAYIMAGE ) { } #endif -/* - BOOL ImageList_Write( HIMAGELIST himl, LPSTREAM pstm ); - */ +/* BOOL ImageList_Write( HIMAGELIST himl, LPSTREAM pstm ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_WRITE ) { } #endif -/* - HRESULT ImageList_WriteEx( HIMAGELIST himl, DWORD dwFlags, LPSTREAM pstm ); - */ +/* HRESULT ImageList_WriteEx( HIMAGELIST himl, DWORD dwFlags, LPSTREAM pstm ); */ #if 0 HB_FUNC( WAPI_IMAGELIST_WRITEEX ) { } #endif -/*----------------------------------------------------------------------*/ -/* END - ImageList_* - API */ -/*----------------------------------------------------------------------*/ +/* --- END - ImageList_* - API --- */ -/*----------------------------------------------------------------------*/ -/* Tab Control Macros */ -/*----------------------------------------------------------------------*/ +/* --- Tab Control Macros --- */ + /* wapi_TabCtrl_InsertItem( hWndTab, nInsertPos, cText, iImageListIndex ) */ - HB_FUNC( WAPI_TABCTRL_INSERTITEM ) { TC_ITEM item; @@ -538,8 +459,7 @@ HB_FUNC( WAPI_TABCTRL_GETROWCOUNT ) } /* TabCtrl_GetImageList(hwnd) */ -/* (HIMAGELIST)SNDMSG((hwnd), TCM_GETIMAGELIST, 0, 0L) */ - +/* (HIMAGELIST)SNDMSG((hwnd), TCM_GETIMAGELIST, 0, 0) */ HB_FUNC( WAPI_TABCTRL_GETIMAGELIST ) { hbwapi_ret_NINT( ( HB_PTRUINT ) TabCtrl_GetImageList( hbwapi_par_raw_HWND( 1 ) ) ); @@ -547,7 +467,6 @@ HB_FUNC( WAPI_TABCTRL_GETIMAGELIST ) /* #define TabCtrl_SetImageList(hwnd, himl) */ /* (HIMAGELIST)SNDMSG((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(HIMAGELIST)(himl)) */ - HB_FUNC( WAPI_TABCTRL_SETIMAGELIST ) { hbwapi_ret_NINT( ( HB_PTRUINT ) TabCtrl_SetImageList( hbwapi_par_raw_HWND( 1 ), @@ -556,7 +475,6 @@ HB_FUNC( WAPI_TABCTRL_SETIMAGELIST ) /* wapi_TabCtrl_SetItem( hWndTab, nInsertPos, cText, iImageListIndex ) */ /* (BOOL)SNDMSG((hwnd), TCM_SETITEM, (WPARAM)(int)(iItem), (LPARAM)(TC_ITEM FAR*)(pitem)) */ - HB_FUNC( WAPI_TABCTRL_SETITEM ) { TC_ITEM item; @@ -573,16 +491,14 @@ HB_FUNC( WAPI_TABCTRL_SETITEM ) } /* TabCtrl_DeleteAllItems(hwnd) */ -/* (BOOL)SNDMSG((hwnd), TCM_DELETEALLITEMS, 0, 0L) */ - +/* (BOOL)SNDMSG((hwnd), TCM_DELETEALLITEMS, 0, 0) */ HB_FUNC( WAPI_TABCTRL_DELETEALLITEMS ) { hbwapi_ret_L( TabCtrl_DeleteAllItems( hbwapi_par_raw_HWND( 1 ) ) ); } /* TabCtrl_DeleteItem(hwnd, i) */ -/* (BOOL)SNDMSG((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0L) */ - +/* (BOOL)SNDMSG((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0) */ HB_FUNC( WAPI_TABCTRL_DELETEITEM ) { hbwapi_ret_L( TabCtrl_DeleteItem( hbwapi_par_raw_HWND( 1 ), ( WPARAM ) hbwapi_par_INT( 2 ) ) ); @@ -601,8 +517,7 @@ HB_FUNC( WAPI_TABCTRL_HITTEST ) } /* TabCtrl_SetItemExtra(hwndTC, cb) */ -/* (BOOL)SNDMSG((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0L) */ - +/* (BOOL)SNDMSG((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0) */ HB_FUNC( WAPI_TABCTRL_SETITEMEXTRA ) { hbwapi_ret_L( TabCtrl_SetItemExtra( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ) ) ); @@ -610,7 +525,6 @@ HB_FUNC( WAPI_TABCTRL_SETITEMEXTRA ) /* TabCtrl_AdjustRect(hwnd, bLarger, prc) */ /* (int)SNDMSG(hwnd, TCM_ADJUSTRECT, (WPARAM)(BOOL)(bLarger), (LPARAM)(RECT FAR *)prc) */ - HB_FUNC( WAPI_TABCTRL_ADJUSTRECT ) { if( HB_ISARRAY( 3 ) ) @@ -633,15 +547,13 @@ HB_FUNC( WAPI_TABCTRL_ADJUSTRECT ) /* TabCtrl_SetItemSize(hwnd, x, y) */ /* (DWORD)SNDMSG((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y)) */ - HB_FUNC( WAPI_TABCTRL_SETITEMSIZE ) { hbwapi_ret_NINT( TabCtrl_SetItemSize( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ), hbwapi_par_INT( 3 ) ) ); } /* TabCtrl_RemoveImage(hwnd, i) */ -/* (void)SNDMSG((hwnd), TCM_REMOVEIMAGE, i, 0L) */ - +/* (void)SNDMSG((hwnd), TCM_REMOVEIMAGE, i, 0) */ HB_FUNC( WAPI_TABCTRL_REMOVEIMAGE ) { TabCtrl_RemoveImage( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ) ); @@ -649,15 +561,13 @@ HB_FUNC( WAPI_TABCTRL_REMOVEIMAGE ) /* TabCtrl_SetPadding(hwnd, cx, cy) */ /* (void)SNDMSG((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy)) */ - HB_FUNC( WAPI_TABCTRL_SETPADDING ) { TabCtrl_SetPadding( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ), hbwapi_par_INT( 3 ) ); } /* TabCtrl_GetToolTips(hwnd) */ -/* (HWND)SNDMSG((hwnd), TCM_GETTOOLTIPS, 0, 0L) */ - +/* (HWND)SNDMSG((hwnd), TCM_GETTOOLTIPS, 0, 0) */ HB_FUNC( WAPI_TABCTRL_GETTOOLTIPS ) { #if ! defined( HB_OS_WIN_CE ) @@ -668,8 +578,7 @@ HB_FUNC( WAPI_TABCTRL_GETTOOLTIPS ) } /* TabCtrl_SetToolTips(hwnd, hwndTT) */ -/* (void)SNDMSG((hwnd), TCM_SETTOOLTIPS, (WPARAM)(hwndTT), 0L) */ - +/* (void)SNDMSG((hwnd), TCM_SETTOOLTIPS, (WPARAM)(hwndTT), 0) */ HB_FUNC( WAPI_TABCTRL_SETTOOLTIPS ) { #if ! defined( HB_OS_WIN_CE ) @@ -679,7 +588,6 @@ HB_FUNC( WAPI_TABCTRL_SETTOOLTIPS ) /* TabCtrl_GetCurFocus(hwnd) */ /* (int)SNDMSG((hwnd), TCM_GETCURFOCUS, 0, 0) */ - HB_FUNC( WAPI_TABCTRL_GETCURFOCUS ) { hbwapi_ret_NI( TabCtrl_GetCurFocus( hbwapi_par_raw_HWND( 1 ) ) ); @@ -687,7 +595,6 @@ HB_FUNC( WAPI_TABCTRL_GETCURFOCUS ) /* TabCtrl_SetCurFocus(hwnd, i) */ /* SNDMSG((hwnd),TCM_SETCURFOCUS, i, 0) */ - HB_FUNC( WAPI_TABCTRL_SETCURFOCUS ) { TabCtrl_SetCurFocus( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ) ); @@ -695,7 +602,6 @@ HB_FUNC( WAPI_TABCTRL_SETCURFOCUS ) /* TabCtrl_SetMinTabWidth(hwnd, x) */ /* (int)SNDMSG((hwnd), TCM_SETMINTABWIDTH, 0, x) */ - HB_FUNC( WAPI_TABCTRL_SETMINTABWIDTH ) { /* hbwapi_ret_NI( TabCtrl_SetMinTabWidth( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ) ) ); */ @@ -704,7 +610,6 @@ HB_FUNC( WAPI_TABCTRL_SETMINTABWIDTH ) /* TabCtrl_DeselectAll(hwnd, fExcludeFocus) */ /* (void)SNDMSG((hwnd), TCM_DESELECTALL, fExcludeFocus, 0) */ - HB_FUNC( WAPI_TABCTRL_DESELECTALL ) { /* TabCtrl_DeselectAll( hbwapi_par_raw_HWND( 1 ), hbwapi_par_UINT( 2 ) ); */ @@ -713,7 +618,6 @@ HB_FUNC( WAPI_TABCTRL_DESELECTALL ) /* TabCtrl_HighlightItem(hwnd, i, fHighlight) */ /* (BOOL)SNDMSG((hwnd), TCM_HIGHLIGHTITEM, (WPARAM)(i), (LPARAM)MAKELONG (fHighlight, 0)) */ - HB_FUNC( WAPI_TABCTRL_HIGHLIGHTITEM ) { #if ( _WIN32_IE >= 0x0400 ) @@ -725,7 +629,6 @@ HB_FUNC( WAPI_TABCTRL_HIGHLIGHTITEM ) /* TabCtrl_SetExtendedStyle(hwnd, dw) */ /* (DWORD)SNDMSG((hwnd), TCM_SETEXTENDEDSTYLE, 0, dw) */ - HB_FUNC( WAPI_TABCTRL_SETEXTENDEDSTYLE ) { #if ( _WIN32_IE >= 0x0400 ) @@ -737,7 +640,6 @@ HB_FUNC( WAPI_TABCTRL_SETEXTENDEDSTYLE ) /* TabCtrl_GetExtendedStyle(hwnd) */ /* (DWORD)SNDMSG((hwnd), TCM_GETEXTENDEDSTYLE, 0, 0) */ - HB_FUNC( WAPI_TABCTRL_GETEXTENDEDSTYLE ) { #if ( _WIN32_IE >= 0x0400 ) @@ -749,7 +651,6 @@ HB_FUNC( WAPI_TABCTRL_GETEXTENDEDSTYLE ) /* TabCtrl_SetUnicodeFormat(hwnd, fUnicode) */ /* (BOOL)SNDMSG((hwnd), TCM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0) */ - HB_FUNC( WAPI_TABCTRL_SETUNICODEFORMAT ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -761,7 +662,6 @@ HB_FUNC( WAPI_TABCTRL_SETUNICODEFORMAT ) /* TabCtrl_GetUnicodeFormat(hwnd) */ /* (BOOL)SNDMSG((hwnd), TCM_GETUNICODEFORMAT, 0, 0) */ - HB_FUNC( WAPI_TABCTRL_GETUNICODEFORMAT ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -775,7 +675,7 @@ HB_FUNC( WAPI_TABCTRL_GETUNICODEFORMAT ) HB_FUNC( WAPI_TABCTRL_CREATE ) { HWND hwnd = hbwapi_par_raw_HWND( 1 ); - HWND hbutton = CreateWindowEx( 0, WC_TABCONTROL, NULL, ( LONG ) hb_parnl( 6 ) /* style */, hb_parni( 2 ), hb_parni( 3 ) , hb_parni( 4 ), hb_parni( 5 ), hwnd, NULL, GetModuleHandle( NULL ), NULL ); + HWND hbutton = CreateWindowEx( 0, WC_TABCONTROL, NULL, ( LONG ) hb_parnl( 6 ) /* style */, hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hwnd, NULL, GetModuleHandle( NULL ), NULL ); SendMessage( hbutton, ( UINT ) WM_SETFONT, ( WPARAM ) ( HFONT ) SendMessage( hwnd, WM_GETFONT, 0, 0 ), 1 ); hbwapi_ret_raw_HANDLE( hbutton ); @@ -798,61 +698,45 @@ HB_FUNC( WAPI_TABCTRL_ADDITEM ) hb_strfree( hText ); } -/*----------------------------------------------------------------------*/ -/* TreeView_* Functions */ -/*----------------------------------------------------------------------*/ +/* --- TreeView_* Functions --- */ -/* - HIMAGELIST TreeView_CreateDragImage( HWND hwndTV, HTREEITEM hitem ); - */ +/* HIMAGELIST TreeView_CreateDragImage( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_CREATEDRAGIMAGE ) { hbwapi_ret_raw_HANDLE( TreeView_CreateDragImage( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...BOOL TreeView_DeleteAllItems( HWND hwndTV ); - */ +/* BOOL TreeView_DeleteAllItems( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_DELETEALLITEMS ) { hbwapi_ret_L( TreeView_DeleteAllItems( hbwapi_par_raw_HWND( 1 ) ) ); } -/* - ...HWND TreeView_EditLabel( HWND hWndTV, HTREEITEM hitem ); - */ +/* HWND TreeView_EditLabel( HWND hWndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_EDITLABEL ) { hbwapi_ret_raw_HANDLE( TreeView_EditLabel( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...BOOL TreeView_EndEditLabelNow( HWND hwndTV, BOOL b ); - */ +/* BOOL TreeView_EndEditLabelNow( HWND hwndTV, BOOL b ); */ HB_FUNC( WAPI_TREEVIEW_ENDEDITLABELNOW ) { hbwapi_ret_L( TreeView_EndEditLabelNow( hbwapi_par_raw_HWND( 1 ), hbwapi_par_BOOL( 2 ) ) ); } -/* - ...BOOL TreeView_EnsureVisible( HWND hwndTV, HTREEITEM hitem ); - */ +/* BOOL TreeView_EnsureVisible( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_ENSUREVISIBLE ) { hbwapi_ret_L( TreeView_EnsureVisible( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...BOOL TreeView_Expand( HWND hwndTV, HTREEITEM hItem, UINT flag ); - */ +/* BOOL TreeView_Expand( HWND hwndTV, HTREEITEM hItem, UINT flag ); */ HB_FUNC( WAPI_TREEVIEW_EXPAND ) { hbwapi_ret_L( TreeView_Expand( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ), hbwapi_par_UINT( 2 ) ) ); } -/* - ... COLORREF TreeView_GetBkColor( HWND hwndTV ); - */ +/* COLORREF TreeView_GetBkColor( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETBKCOLOR ) { #if ! defined( HB_OS_WIN_CE ) && ! defined( __MINGW32__ ) && ! defined( __CYGWIN__ ) @@ -862,9 +746,7 @@ HB_FUNC( WAPI_TREEVIEW_GETBKCOLOR ) #endif } -/* IE 5.0 - ...UINT TreeView_GetCheckState( HWND hwndTV, HTREEITEM hItem ); - */ +/* IE 5.0 UINT TreeView_GetCheckState( HWND hwndTV, HTREEITEM hItem ); */ HB_FUNC( WAPI_TREEVIEW_GETCHECKSTATE ) { #if ( _WIN32_IE >= 0x0500 ) @@ -874,75 +756,57 @@ HB_FUNC( WAPI_TREEVIEW_GETCHECKSTATE ) #endif } -/* - ...HTREEITEM TreeView_GetChild( HWND hwndTV, HTREEITEM hitem ); - */ +/* HTREEITEM TreeView_GetChild( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_GETCHILD ) { hbwapi_ret_raw_HANDLE( TreeView_GetChild( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...UINT TreeView_GetCount( HWND hwndTV ); - */ +/* UINT TreeView_GetCount( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETCOUNT ) { hbwapi_ret_UINT( TreeView_GetCount( hbwapi_par_raw_HWND( 1 ) ) ); } -/* - ...HTREEITEM TreeView_GetDropHilight( HWND hwndTV ); - */ +/* HTREEITEM TreeView_GetDropHilight( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETDROPHILIGHT ) { hbwapi_ret_raw_HANDLE( TreeView_GetDropHilight( hbwapi_par_raw_HWND( 1 ) ) ); } -/* - ...HWND TreeView_GetEditControl( HWND hwndTV ); - */ +/* HWND TreeView_GetEditControl( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETEDITCONTROL ) { hbwapi_ret_raw_HANDLE( TreeView_GetEditControl( hbwapi_par_raw_HWND( 1 ) ) ); } #if 0 -/* Vista - ...DWORD TreeView_GetExtendedStyle( HWND hwnd ); - */ +/* Vista DWORD TreeView_GetExtendedStyle( HWND hwnd ); */ HB_FUNC( WAPI_TREEVIEW_GETEXTENDEDSTYLE ) { hbwapi_ret_DWORD( TreeView_GetExtendedStyle( hbwapi_par_raw_HWND( 1 ) ) ); } #endif -/* - ...HTREEITEM TreeView_GetFirstVisible( HWND hwndTV ); - */ +/* HTREEITEM TreeView_GetFirstVisible( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETFIRSTVISIBLE ) { hbwapi_ret_raw_HANDLE( TreeView_GetFirstVisible( hbwapi_par_raw_HWND( 1 ) ) ); } -/* - ...HIMAGELIST TreeView_GetImageList( HWND hwndTV, INT iImage ); - */ +/* HIMAGELIST TreeView_GetImageList( HWND hwndTV, INT iImage ); */ HB_FUNC( WAPI_TREEVIEW_GETIMAGELIST ) { hbwapi_ret_raw_HANDLE( TreeView_GetImageList( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ) ) ); } -/* - ...UINT TreeView_GetIndent( HWND hwndTV ); - */ +/* UINT TreeView_GetIndent( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETINDENT ) { hbwapi_ret_UINT( TreeView_GetIndent( hbwapi_par_raw_HWND( 1 ) ) ); } -/* IE 4.0 - ... COLORREF TreeView_GetInsertMarkColor( HWND hwndTV ); - */ +/* IE 4.0 COLORREF TreeView_GetInsertMarkColor( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETINSERTMARKCOLOR ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -952,27 +816,23 @@ HB_FUNC( WAPI_TREEVIEW_GETINSERTMARKCOLOR ) #endif } -/* - ...BOOL TreeView_GetISearchString( HWND hwndTV, LPTSTR lpsz ); - */ +/* BOOL TreeView_GetISearchString( HWND hwndTV, LPTSTR lpsz ); */ HB_FUNC( WAPI_TREEVIEW_GETISEARCHSTRING ) { /* hbwapi_ret_( TreeView_GetISearchString( hbwapi_par_raw_HWND( 1 ), LPTSTR ) ); */ } -/* - ...BOOL TreeView_GetItem( HWND hwndTV, LPTVITEM pitem ); +/* BOOL TreeView_GetItem( HWND hwndTV, LPTVITEM pitem ); -- Version 4.71 or later -- - ...BOOL TreeView_GetItem( HWND hwndTV, LPTVITEMEX pitem ); - */ + BOOL TreeView_GetItem( HWND hwndTV, LPTVITEMEX pitem ); */ HB_FUNC( WAPI_TREEVIEW_GETITEM ) { - /* hbwapi_ret_( TreeView_GetItem( hbwapi_par_raw_HWND( 1 ), LPTVITEM ) ); */ +#if 0 + hbwapi_ret_( TreeView_GetItem( hbwapi_par_raw_HWND( 1 ), LPTVITEM ) ); +#endif } -/* IE 4.0 - ...int TreeView_GetItemHeight( HWND hwndTV ); - */ +/* IE 4.0 int TreeView_GetItemHeight( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETITEMHEIGHT ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -983,9 +843,7 @@ HB_FUNC( WAPI_TREEVIEW_GETITEMHEIGHT ) } #if 0 -/* Vista - ... BOOL TreeView_GetItemPartRect( HWND hwnd, HTREEITEM hitem, RECT *prc, TVITEMPART *partid ); - */ +/* Vista BOOL TreeView_GetItemPartRect( HWND hwnd, HTREEITEM hitem, RECT *prc, TVITEMPART *partid ); */ HB_FUNC( WAPI_TREEVIEW_GETITEMPARTRECT ) { RECT rc; @@ -995,9 +853,7 @@ HB_FUNC( WAPI_TREEVIEW_GETITEMPARTRECT ) } #endif -/* - ...BOOL TreeView_GetItemRect( HWND hwndTV, HTREEITEM hitem, LPRECT prc, BOOL fItemRect ); - */ +/* BOOL TreeView_GetItemRect( HWND hwndTV, HTREEITEM hitem, LPRECT prc, BOOL fItemRect ); */ HB_FUNC( WAPI_TREEVIEW_GETITEMRECT ) { LPRECT prc = NULL; @@ -1005,9 +861,7 @@ HB_FUNC( WAPI_TREEVIEW_GETITEMRECT ) hbwapi_ret_L( TreeView_GetItemRect( hbwapi_par_raw_HWND( 1 ), ( HTREEITEM ) hbwapi_par_raw_HANDLE( 2 ), prc, hbwapi_par_BOOL( 4 ) ) ); } -/* IE 5.0 - ...UINT TreeView_GetItemState( HWND hwndTV, HTREEITEM hItem, UINT stateMask ); - */ +/* IE 5.0 UINT TreeView_GetItemState( HWND hwndTV, HTREEITEM hItem, UINT stateMask ); */ HB_FUNC( WAPI_TREEVIEW_GETITEMSTATE ) { #if ( _WIN32_IE >= 0x0500 ) @@ -1017,9 +871,7 @@ HB_FUNC( WAPI_TREEVIEW_GETITEMSTATE ) #endif } -/* IE 4.0 - ...HTREEITEM TreeView_GetLastVisible( HWND hwndTV ); - */ +/* IE 4.0 HTREEITEM TreeView_GetLastVisible( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETLASTVISIBLE ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -1029,9 +881,7 @@ HB_FUNC( WAPI_TREEVIEW_GETLASTVISIBLE ) #endif } -/* - ...COLOREF TreeView_GetLineColor( HWND hwndTV ); - */ +/* COLOREF TreeView_GetLineColor( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETLINECOLOR ) { #if ( _WIN32_IE >= 0x0500 ) @@ -1041,76 +891,57 @@ HB_FUNC( WAPI_TREEVIEW_GETLINECOLOR ) #endif } -/* - ...HTREEITEM TreeView_GetNextItem( HWND hwndTV, HTREEITEM hitem, UINT flag ); - */ +/* HTREEITEM TreeView_GetNextItem( HWND hwndTV, HTREEITEM hitem, UINT flag ); */ HB_FUNC( WAPI_TREEVIEW_GETNEXTITEM ) { hbwapi_ret_raw_HANDLE( TreeView_GetNextItem( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ), hbwapi_par_UINT( 3 ) ) ); } #if 0 -/* - ...HTREEITEM TreeView_GetNextSelected( HWND hwnd, TREEITEM *hitem ); - */ +/* HTREEITEM TreeView_GetNextSelected( HWND hwnd, TREEITEM *hitem ); */ HB_FUNC( WAPI_TREEVIEW_GETNEXTSELECTED ) { hbwapi_ret_raw_HANDLE( TreeView_GetNextSelected( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_TREEITEM( 2 ) ) ); } #endif -/* - ...HTREEITEM TreeView_GetNextSibling( HWND hwndTV, HTREEITEM hitem ); - */ +/* HTREEITEM TreeView_GetNextSibling( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_GETNEXTSIBLING ) { hbwapi_ret_raw_HANDLE( TreeView_GetNextSibling( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...HTREEITEM TreeView_GetNextVisible( HWND hwndTV, HTREEITEM hitem ); - ); - */ +/* HTREEITEM TreeView_GetNextVisible( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_GETNEXTVISIBLE ) { hbwapi_ret_raw_HANDLE( TreeView_GetNextVisible( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...HTREEITEM TreeView_GetParent( HWND hwndTV, HTREEITEM hitem ); - */ +/* HTREEITEM TreeView_GetParent( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_GETPARENT ) { hbwapi_ret_raw_HANDLE( TreeView_GetParent( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...HTREEITEM TreeView_GetPrevSibling( HWND hwndTV, HTREEITEM hitem ); - */ +/* HTREEITEM TreeView_GetPrevSibling( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_GETPREVSIBLING ) { hbwapi_ret_raw_HANDLE( TreeView_GetPrevSibling( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...HTREEITEM TreeView_GetPrevVisible( HWND hwndTV, HTREEITEM hitem ); - */ +/* HTREEITEM TreeView_GetPrevVisible( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_GETPREVVISIBLE ) { hbwapi_ret_raw_HANDLE( TreeView_GetPrevVisible( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...HTREEITEM TreeView_GetRoot( HWND hwndTV ); - */ +/* HTREEITEM TreeView_GetRoot( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETROOT ) { hbwapi_ret_raw_HANDLE( TreeView_GetRoot( hbwapi_par_raw_HWND( 1 ) ) ); } -/* - ...UINT TreeView_GetScrollTime( HWND hwndTV ); - */ +/* UINT TreeView_GetScrollTime( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETSCROLLTIME ) { #if ! defined( HB_OS_WIN_CE ) && ! defined( __MINGW32__ ) && ! defined( __CYGWIN__ ) @@ -1120,17 +951,13 @@ HB_FUNC( WAPI_TREEVIEW_GETSCROLLTIME ) #endif } -/* - ...HTREEITEM TreeView_GetSelection( HWND hwndTV ); - */ +/* HTREEITEM TreeView_GetSelection( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETSELECTION ) { hbwapi_ret_raw_HANDLE( TreeView_GetSelection( hbwapi_par_raw_HWND( 1 ) ) ); } -/* - ...COLORREF TreeView_GetTextColor( HWND hwndTV ); - */ +/* COLORREF TreeView_GetTextColor( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETTEXTCOLOR ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -1140,9 +967,7 @@ HB_FUNC( WAPI_TREEVIEW_GETTEXTCOLOR ) #endif } -/* - ...HWND TreeView_GetToolTips( HWND hwndTV ); - */ +/* HWND TreeView_GetToolTips( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETTOOLTIPS ) { #if ( _WIN32_IE >= 0x0300 ) && ! defined( HB_OS_WIN_CE ) @@ -1152,9 +977,7 @@ HB_FUNC( WAPI_TREEVIEW_GETTOOLTIPS ) #endif } -/* - ...BOOL TreeView_GetUnicodeFormat( HWND hwnd ); - */ +/* BOOL TreeView_GetUnicodeFormat( HWND hwnd ); */ HB_FUNC( WAPI_TREEVIEW_GETUNICODEFORMAT ) { #if ! defined( HB_OS_WIN_CE ) && ! defined( __MINGW32__ ) && ! defined( __CYGWIN__ ) @@ -1164,34 +987,26 @@ HB_FUNC( WAPI_TREEVIEW_GETUNICODEFORMAT ) #endif } -/* - ...UINT TreeView_GetVisibleCount( HWND hwndTV ); - */ +/* UINT TreeView_GetVisibleCount( HWND hwndTV ); */ HB_FUNC( WAPI_TREEVIEW_GETVISIBLECOUNT ) { hbwapi_ret_UINT( TreeView_GetVisibleCount( hbwapi_par_raw_HWND( 1 ) ) ); } -/* - ...HTREEITEM TreeView_HitTest( HWND hwndTV, LPTVHITTESTINFO lpht ); - */ +/* HTREEITEM TreeView_HitTest( HWND hwndTV, LPTVHITTESTINFO lpht ); */ HB_FUNC( WAPI_TREEVIEW_HITTEST ) { hbwapi_ret_raw_HANDLE( TreeView_HitTest( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_TVHITTESTINFO( 2 ) ) ); } -/* - ...HTREEITEM TreeView_InsertItem( HWND hwndTV, LPTVINSERTSTRUCT lpis ); - */ +/* HTREEITEM TreeView_InsertItem( HWND hwndTV, LPTVINSERTSTRUCT lpis ); */ HB_FUNC( WAPI_TREEVIEW_INSERTITEM ) { hbwapi_ret_raw_HANDLE( TreeView_InsertItem( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_TVINSERTSTRUCT( 2 ) ) ); } #if 0 -/* - ...HTREEITEM TreeView_MapAccIDToHTREEITEM( HWND hwnd, UINT id ); - */ +/* HTREEITEM TreeView_MapAccIDToHTREEITEM( HWND hwnd, UINT id ); */ HB_FUNC( WAPI_TREEVIEW_MAPACCIDTOHTREEITEM ) { hbwapi_ret_raw_HANDLE( TreeView_MapAccIDToHTREEITEM( hbwapi_par_raw_HWND( 1 ), hbwapi_par_UINT( 2 ) ) ); @@ -1199,60 +1014,46 @@ HB_FUNC( WAPI_TREEVIEW_MAPACCIDTOHTREEITEM ) #endif #if 0 -/* - ...UINT TreeView_MapHTREEITEMtoAccID( HWND hwnd, HTREEITEM htreeitem ); - */ +/* UINT TreeView_MapHTREEITEMtoAccID( HWND hwnd, HTREEITEM htreeitem ); */ HB_FUNC( WAPI_TREEVIEW_MAPHTREEITEMTOACCID ) { hbwapi_ret_UINT( TreeView_MapHTREEITEMtoAccID( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } #endif -/* - ...BOOL TreeView_Select( HWND hwndTV, HTREEITEM hitem, UINT flag ); - */ +/* BOOL TreeView_Select( HWND hwndTV, HTREEITEM hitem, UINT flag ); */ HB_FUNC( WAPI_TREEVIEW_SELECT ) { hbwapi_ret_L( TreeView_Select( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ), hbwapi_par_UINT( 3 ) ) ); } -/* - ...BOOL TreeView_SelectDropTarget( HWND hwndTV, HTREEITEM hitem ); - */ +/* BOOL TreeView_SelectDropTarget( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_SELECTDROPTARGET ) { hbwapi_ret_L( TreeView_SelectDropTarget( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...BOOL TreeView_SelectItem( HWND hwndTV, HTREEITEM hitem ); - */ +/* BOOL TreeView_SelectItem( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_SELECTITEM ) { hbwapi_ret_L( TreeView_SelectItem( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } -/* - ...BOOL TreeView_SelectSetFirstVisible( HWND hwndTV, HTREEITEM hitem ); - */ +/* BOOL TreeView_SelectSetFirstVisible( HWND hwndTV, HTREEITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_SELECTSETFIRSTVISIBLE ) { hbwapi_ret_L( TreeView_SelectSetFirstVisible( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ) ) ); } #if 0 -/* - ...LRESULT TreeView_SetAutoScrollInfo( HWND hwnd, UINT uPixPerSec, UINT uUpdateTime ); - */ +/* LRESULT TreeView_SetAutoScrollInfo( HWND hwnd, UINT uPixPerSec, UINT uUpdateTime ); */ HB_FUNC( WAPI_TREEVIEW_SETAUTOSCROLLINFO ) { hbwapi_ret_LRESULT( TreeView_SetAutoScrollInfo( hbwapi_par_raw_HWND( 1 ), hbwapi_par_UINT( 2 ), hbwapi_par_UINT( 2 ) ) ); } #endif -/* - ...COLORREF TreeView_SetBkColor( HWND hwndTV, COLORREF clrBk ); - */ +/* COLORREF TreeView_SetBkColor( HWND hwndTV, COLORREF clrBk ); */ HB_FUNC( WAPI_TREEVIEW_SETBKCOLOR ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -1262,48 +1063,39 @@ HB_FUNC( WAPI_TREEVIEW_SETBKCOLOR ) #endif } -/* - ...UINT TreeView_SetCheckState( HWND hwndTV, HTREEITEM hItem, BOOL fCheck ); - */ +/* UINT TreeView_SetCheckState( HWND hwndTV, HTREEITEM hItem, BOOL fCheck ); */ HB_FUNC( WAPI_TREEVIEW_SETCHECKSTATE ) { #if ( _WIN32_IE >= 0x0500 ) - /* hbwapi_ret_UINT( TreeView_SetCheckState( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ), hbwapi_par_BOOL( 3 ) ) ); */ +#if 0 + hbwapi_ret_UINT( TreeView_SetCheckState( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ), hbwapi_par_BOOL( 3 ) ) ); +#endif #else hbwapi_ret_UINT( 0 ); #endif } #if 0 -/* - ...HRESULT TreeView_SetExtendedStyle( HWND hwnd, DWORD dw, UINT mask ); - */ +/* HRESULT TreeView_SetExtendedStyle( HWND hwnd, DWORD dw, UINT mask ); */ HB_FUNC( WAPI_TREEVIEW_SETEXTENDEDSTYLE ) { hbwapi_ret_HRESULT( TreeView_SetExtendedStyle( hbwapi_par_raw_HWND( 1 ), hbwapi_par_DWORD( 2 ), hbwapi_par_UINT( 2 ) ) ); } #endif -/* - ...HIMAGELIST TreeView_SetImageList( HWND hwndTV, HIMAGELIST himl, INT iImage ); - */ +/* HIMAGELIST TreeView_SetImageList( HWND hwndTV, HIMAGELIST himl, INT iImage ); */ HB_FUNC( WAPI_TREEVIEW_SETIMAGELIST ) { hbwapi_ret_raw_HANDLE( TreeView_SetImageList( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HIMAGELIST( 2 ), hbwapi_par_INT( 3 ) ) ); } -/* - ...BOOL TreeView_SetIndent( HWND hwndTV, INT indent ); - */ +/* BOOL TreeView_SetIndent( HWND hwndTV, INT indent ); */ HB_FUNC( WAPI_TREEVIEW_SETINDENT ) { hbwapi_ret_L( TreeView_SetIndent( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ) ) ); } -/* - ...BOOL TreeView_SetInsertMark( HWND hwndTV, HTREEITEM htiInsert, BOOL fAfter ); - - */ +/* BOOL TreeView_SetInsertMark( HWND hwndTV, HTREEITEM htiInsert, BOOL fAfter ); */ HB_FUNC( WAPI_TREEVIEW_SETINSERTMARK ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -1313,9 +1105,7 @@ HB_FUNC( WAPI_TREEVIEW_SETINSERTMARK ) #endif } -/* - ...COLORREF TreeView_SetInsertMarkColor( HWND hwndTV, COLORREF clrInsertMark ); - */ +/* COLORREF TreeView_SetInsertMarkColor( HWND hwndTV, COLORREF clrInsertMark ); */ HB_FUNC( WAPI_TREEVIEW_SETINSERTMARKCOLOR ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -1325,19 +1115,15 @@ HB_FUNC( WAPI_TREEVIEW_SETINSERTMARKCOLOR ) #endif } -/* - ...BOOL TreeView_SetItem( HWND hwndTV, LPTVITEM pitem ); +/* BOOL TreeView_SetItem( HWND hwndTV, LPTVITEM pitem ); - Version 4.71 or later - - ...BOOL TreeView_SetItem( HWND hwndTV, LPTVITEMEX pitem ); - */ + BOOL TreeView_SetItem( HWND hwndTV, LPTVITEMEX pitem ); */ HB_FUNC( WAPI_TREEVIEW_SETITEM ) { hbwapi_ret_L( TreeView_SetItem( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_TVITEM( 2 ) ) ); } -/* - ...int TreeView_SetItemHeight( HWND hwndTV, SHORT cyItem ); - */ +/* int TreeView_SetItemHeight( HWND hwndTV, SHORT cyItem ); */ HB_FUNC( WAPI_TREEVIEW_SETITEMHEIGHT ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -1347,21 +1133,19 @@ HB_FUNC( WAPI_TREEVIEW_SETITEMHEIGHT ) #endif } -/* - ...UINT TreeView_SetItemState( HWND hwndTV, HTREEITEM hItem, UINT state, UINT stateMask ); - */ +/* UINT TreeView_SetItemState( HWND hwndTV, HTREEITEM hItem, UINT state, UINT stateMask ); */ HB_FUNC( WAPI_TREEVIEW_SETITEMSTATE ) { #if ( _WIN32_IE >= 0x0500 ) - /* hbwapi_ret_UINT( TreeView_SetItemState( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ), hbwapi_par_UINT( 3 ), hbwapi_par_UINT( 4 ) ) ); */ +#if 0 + hbwapi_ret_UINT( TreeView_SetItemState( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ), hbwapi_par_UINT( 3 ), hbwapi_par_UINT( 4 ) ) ); +#endif #else hbwapi_ret_UINT( 0 ); #endif } -/* - ...COLORREF TreeView_SetLineColor( HWND hwndTV, COLORREF clrLine ); - */ +/* COLORREF TreeView_SetLineColor( HWND hwndTV, COLORREF clrLine ); */ HB_FUNC( WAPI_TREEVIEW_SETLINECOLOR ) { #if ( _WIN32_IE >= 0x0500 ) @@ -1371,9 +1155,7 @@ HB_FUNC( WAPI_TREEVIEW_SETLINECOLOR ) #endif } -/* - ...UINT TreeView_SetScrollTime( HWND hwndTV, UINT uMaxScrollTime ); - */ +/* UINT TreeView_SetScrollTime( HWND hwndTV, UINT uMaxScrollTime ); */ HB_FUNC( WAPI_TREEVIEW_SETSCROLLTIME ) { #if ! defined( HB_OS_WIN_CE ) && ! defined( __MINGW32__ ) && ! defined( __CYGWIN__ ) @@ -1383,9 +1165,7 @@ HB_FUNC( WAPI_TREEVIEW_SETSCROLLTIME ) #endif } -/* - ...COLORREF TreeView_SetTextColor( HWND hwndTV, COLORREF clrText ); - */ +/* COLORREF TreeView_SetTextColor( HWND hwndTV, COLORREF clrText ); */ HB_FUNC( WAPI_TREEVIEW_SETTEXTCOLOR ) { #if ( _WIN32_IE >= 0x0400 ) && ! defined( HB_OS_WIN_CE ) @@ -1395,9 +1175,7 @@ HB_FUNC( WAPI_TREEVIEW_SETTEXTCOLOR ) #endif } -/* - ...HWND TreeView_SetToolTips( HWND hwndTV, HWND hwndTooltip ); - */ +/* HWND TreeView_SetToolTips( HWND hwndTV, HWND hwndTooltip ); */ HB_FUNC( WAPI_TREEVIEW_SETTOOLTIPS ) { #if ( _WIN32_IE >= 0x0300 ) && ! defined( HB_OS_WIN_CE ) @@ -1407,9 +1185,7 @@ HB_FUNC( WAPI_TREEVIEW_SETTOOLTIPS ) #endif } -/* IE 4.0 - ...BOOL TreeView_SetUnicodeFormat( HWND hwnd, BOOL fUnicode ); - */ +/* IE 4.0 BOOL TreeView_SetUnicodeFormat( HWND hwnd, BOOL fUnicode ); */ HB_FUNC( WAPI_TREEVIEW_SETUNICODEFORMAT ) { #if ! defined( HB_OS_WIN_CE ) && ! defined( __MINGW32__ ) && ! defined( __CYGWIN__ ) @@ -1420,27 +1196,21 @@ HB_FUNC( WAPI_TREEVIEW_SETUNICODEFORMAT ) } #if 0 -/* - ...DWORD TreeView_ShowInfoTip( HWND hwnd, HITEM hitem ); - */ +/* DWORD TreeView_ShowInfoTip( HWND hwnd, HITEM hitem ); */ HB_FUNC( WAPI_TREEVIEW_SHOWINFOTIP ) { hbwapi_ret_DWORD( TreeView_ShowInfoTip( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HITEM( 2 ) ) ); } #endif -/* - ...BOOL TreeView_SortChildren( HWND hwndTV, HTREEITEM hitem, BOOL fRecurse ); - */ +/* BOOL TreeView_SortChildren( HWND hwndTV, HTREEITEM hitem, BOOL fRecurse ); */ HB_FUNC( WAPI_TREEVIEW_SORTCHILDREN ) { hbwapi_ret_L( TreeView_SortChildren( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_HANDLE( 2 ), hbwapi_par_BOOL( 3 ) ) ); } #if 0 -/* - ...BOOL TreeView_SortChildrenCB( HWND hwndTV, LPTVSORTCB psort, BOOL fRecurse ); - */ +/* BOOL TreeView_SortChildrenCB( HWND hwndTV, LPTVSORTCB psort, BOOL fRecurse ); */ HB_FUNC( WAPI_TREEVIEW_SORTCHILDRENCB ) { hbwapi_ret_L( TreeView_SortChildrenCB( hbwapi_par_raw_HWND( 1 ), hbwapi_par_raw_TVSORTCB( 2 ), hbwapi_par_BOOL( 3 ) ) ); diff --git a/contrib/hbwin/wapi_misc.c b/contrib/hbwin/wapi_misc.c index 84fb13a6a7..19fca6ed18 100644 --- a/contrib/hbwin/wapi_misc.c +++ b/contrib/hbwin/wapi_misc.c @@ -46,13 +46,25 @@ #include "hbwapi.h" +HB_SIZE hbwapi_tstrlen( const TCHAR * pText ) +{ + HB_SIZE nLen = 0; + + HB_TRACE( HB_TR_DEBUG, ( "hbwapi_tstrlen(%p)", ( const void * ) pText ) ); + + while( pText[ nLen ] != TEXT( '\0' ) ) + ++nLen; + + return nLen; +} + /* NOTE: Based on hb_strdup() */ TCHAR * hbwapi_tstrdup( const TCHAR * pszText ) { TCHAR * pszDup; HB_SIZE nLen; - HB_TRACE( HB_TR_DEBUG, ( "hbwapi_tstrdup(%p)", pszText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hbwapi_tstrdup(%p)", ( const void * ) pszText ) ); nLen = ( hbwapi_tstrlen( pszText ) + 1 ) * sizeof( TCHAR ); @@ -67,7 +79,7 @@ TCHAR * hbwapi_tstrncat( TCHAR * pDest, const TCHAR * pSource, HB_SIZE nLen ) { TCHAR * pBuf = pDest; - HB_TRACE( HB_TR_DEBUG, ( "hbwapi_tstrncat(%p, %p, %" HB_PFS "u)", pDest, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hbwapi_tstrncat(%p, %p, %" HB_PFS "u)", ( void * ) pDest, ( const void * ) pSource, nLen ) ); pDest[ nLen ] = TEXT( '\0' ); @@ -83,18 +95,6 @@ TCHAR * hbwapi_tstrncat( TCHAR * pDest, const TCHAR * pSource, HB_SIZE nLen ) return pBuf; } -HB_SIZE hbwapi_tstrlen( const TCHAR * pText ) -{ - HB_SIZE nLen = 0; - - HB_TRACE( HB_TR_DEBUG, ( "hbwapi_tstrlen(%p)", pText ) ); - - while( pText[ nLen ] != TEXT( '\0' ) ) - ++nLen; - - return nLen; -} - static TCHAR * hbwapi_FileNameAtSystemDir( const TCHAR * pFileName ) { #if defined( HB_OS_WIN_CE ) diff --git a/contrib/hbwin/wapi_wingdi.c b/contrib/hbwin/wapi_wingdi.c index 0fc687becf..0daeecec38 100644 --- a/contrib/hbwin/wapi_wingdi.c +++ b/contrib/hbwin/wapi_wingdi.c @@ -45,7 +45,7 @@ */ /* WinCE MSDN documentation: - http://msdn.microsoft.com/en-us/library/aa923590.aspx + https://msdn.microsoft.com/library/aa923590 */ #include "hbwapi.h" diff --git a/contrib/hbwin/wapi_winuser_dlg.c b/contrib/hbwin/wapi_winuser_dlg.c index d1150d5db1..ef24f0e174 100644 --- a/contrib/hbwin/wapi_winuser_dlg.c +++ b/contrib/hbwin/wapi_winuser_dlg.c @@ -1,7 +1,7 @@ /* * Windows API functions * - * Copyright 2011 Vailton Renato + * Copyright 2011 Vailton Renato (and others) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,10 +51,8 @@ #include -/* - * Application-defined callback used with the CreateDialog and DialogBox... It - * processes messages sent to a modal or modeless dialog box. - */ +/* Application-defined callback used with the CreateDialog and DialogBox... It + processes messages sent to a modal or modeless dialog box. */ static BOOL CALLBACK wapi_DialogFuncProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { PHB_SYMB pSymbol; @@ -89,9 +87,7 @@ static BOOL CALLBACK wapi_DialogFuncProc( HWND hDlg, UINT message, WPARAM wParam return ( BOOL ) hb_parnl( -1 ); } -/* - * Creates a modal dialog box from a dialog box template resource. - */ +/* Creates a modal dialog box from a dialog box template resource. */ HB_FUNC( WAPI_DIALOGBOXPARAM ) { INT_PTR nResult = DialogBoxParam( @@ -106,10 +102,8 @@ HB_FUNC( WAPI_DIALOGBOXPARAM ) hbwapi_ret_NINT( nResult ); } -/* - * Destroys a modal dialog box, causing the system to end any processing for the - * dialog box. - */ +/* Destroys a modal dialog box, causing the system to end any processing for the + dialog box. */ HB_FUNC( WAPI_ENDDIALOG ) { hbwapi_ret_L( EndDialog( hbwapi_par_raw_HWND( 1 ), @@ -117,9 +111,7 @@ HB_FUNC( WAPI_ENDDIALOG ) hbwapi_SetLastError( GetLastError() ); } -/* - * Sets the title or text of a control in a dialog box. - */ +/* Sets the title or text of a control in a dialog box. */ HB_FUNC( WAPI_SETDLGITEMTEXT ) { void * hStr; @@ -132,9 +124,7 @@ HB_FUNC( WAPI_SETDLGITEMTEXT ) hb_strfree( hStr ); } -/* - * Retrieves the title or text associated with a control in a dialog box. - */ +/* Retrieves the title or text associated with a control in a dialog box. */ HB_FUNC( WAPI_GETDLGITEMTEXT ) { HWND nItem = GetDlgItem( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ) ); @@ -151,18 +141,14 @@ HB_FUNC( WAPI_GETDLGITEMTEXT ) hb_xfree( lpResult ); } -/* - * Retrieves a handle to a control in the specified dialog box. - */ +/* Retrieves a handle to a control in the specified dialog box. */ HB_FUNC( WAPI_GETDLGITEM ) { hbwapi_ret_raw_HWND( GetDlgItem( hbwapi_par_raw_HWND( 1 ), hbwapi_par_INT( 2 ) ) ); hbwapi_SetLastError( GetLastError() ); } -/* - * Adds a string to a list in a combo box. - */ +/* Adds a string to a list in a combo box. */ HB_FUNC( WAPI_COMBOBOX_ADDSTRING ) { void * hStr; diff --git a/contrib/hbwin/wce_simc.c b/contrib/hbwin/wce_simc.c index cf3ddb682d..581d5e1d5a 100644 --- a/contrib/hbwin/wce_simc.c +++ b/contrib/hbwin/wce_simc.c @@ -1,5 +1,5 @@ /* - * SIM interface code (low level) + * SIM interface code (low-level) * * Copyright 2009 Jose Luis Capel * diff --git a/contrib/hbwin/win_bmp.c b/contrib/hbwin/win_bmp.c index 443da34a47..c0930a6fcd 100644 --- a/contrib/hbwin/win_bmp.c +++ b/contrib/hbwin/win_bmp.c @@ -94,7 +94,7 @@ HB_FUNC( WIN_LOADBITMAPFILE ) if( pBuffer ) { - /* TOFIX: No check is done on read data from disk which is a large security hole + /* FIXME: No check is done on read data from disk which is a large security hole and may cause GPF even in simple error cases, like invalid file content. [vszakats] */ diff --git a/contrib/hbwin/win_dlg.c b/contrib/hbwin/win_dlg.c index 9d716b891e..dca99d6a19 100644 --- a/contrib/hbwin/win_dlg.c +++ b/contrib/hbwin/win_dlg.c @@ -1,11 +1,8 @@ /* * Windows dialogs * - * Copyright 2010 Viktor Szakats (vszakats.net/harbour) - * win_PrintDlgDC() - * - * Copyright 2010 Przemyslaw Czerpak - * win_GetOpenFileName(), win_GetSaveFileName() + * Copyright 2010 Viktor Szakats (vszakats.net/harbour) (win_PrintDlgDC()) + * Copyright 2010 Przemyslaw Czerpak (win_GetOpenFileName(), win_GetSaveFileName()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +54,7 @@ #include /* win_PrintDlgDC( [@], [], [], [] ) - * -> + * --> */ HB_FUNC( WIN_PRINTDLGDC ) { @@ -286,9 +283,9 @@ static void s_GetFileName( HB_BOOL fSave ) hb_strfree( hDefExt ); } -/* win_GetOpenFileName( [[@]], [], [], [],; +/* win_GetOpenFileName( [[@]], [], [], [], ; * [], [[@]], [], [] ) - * -> | + e"\0" + [ + e"\0" + ] | "" + * --> | + e"\0" + [ + e"\0" + ] | "" * */ HB_FUNC( WIN_GETOPENFILENAME ) @@ -296,9 +293,9 @@ HB_FUNC( WIN_GETOPENFILENAME ) s_GetFileName( HB_FALSE ); } -/* win_GetSaveFileName( [[@]], [], [], [],; +/* win_GetSaveFileName( [[@]], [], [], [], ; * [], [[@]], [], [] ) - * -> | + e"\0" + [ + e"\0" + ] | "" + * --> | + e"\0" + [ + e"\0" + ] | "" * */ HB_FUNC( WIN_GETSAVEFILENAME ) diff --git a/contrib/hbwin/win_os.prg b/contrib/hbwin/win_os.prg index a5b6e8bd9f..5fc8493e35 100644 --- a/contrib/hbwin/win_os.prg +++ b/contrib/hbwin/win_os.prg @@ -1,5 +1,5 @@ /* - * Windows OS version information + * Windows OS - safe LAN networking * * Copyright 2004 Peter Rees Rees Software and Systems Ltd * @@ -44,14 +44,11 @@ * */ -/* - * Operating system functions for Windows - * - * Program to check and set Windows Registry settings - * for safe networking - all versions of Windows to XP SP2 +/* Function to check and set Windows Registry settings + * for safe networking - for all versions of Windows. * * Also includes check for buggy VREDIR.VXD under Win95 - * and if the correct patch file is found - run it. + * and if the correct patch file is found. */ #include "directry.ch" diff --git a/contrib/hbwin/win_prn1.c b/contrib/hbwin/win_prn1.c index 23a1f60cb9..59f2cc608e 100644 --- a/contrib/hbwin/win_prn1.c +++ b/contrib/hbwin/win_prn1.c @@ -219,12 +219,12 @@ HB_FUNC( WIN_GETTEXTSIZE ) { SIZE sSize; - GetTextExtentPoint32( hDC, lpData, ( int ) nLen, &sSize ); /* Get the length of the text in device size */ + GetTextExtentPoint32( hDC, lpData, ( int ) nLen, &sSize ); /* Get the length of the text in device size */ - if( ! hb_parldef( 4, 1 ) ) - lResult = ( long ) sSize.cy; /* return the height */ + if( hb_parldef( 4, HB_TRUE ) ) + lResult = ( long ) sSize.cx; /* return the width */ else - lResult = ( long ) sSize.cx; /* return the width */ + lResult = ( long ) sSize.cy; /* return the height */ } hb_strfree( hData ); diff --git a/contrib/hbwin/win_prn2.c b/contrib/hbwin/win_prn2.c index 8e72f66698..bfb4346ff4 100644 --- a/contrib/hbwin/win_prn2.c +++ b/contrib/hbwin/win_prn2.c @@ -170,7 +170,7 @@ static void hb_GetDefaultPrinter( PHB_ITEM pPrinterName ) if( ! bResult && hb_iswin9x() ) { /* This option should never be required but is included because of this article - http://support.microsoft.com/kb/246772/en-us + https://support.microsoft.com/kb/246772 This option will not enumerate any network printers. diff --git a/contrib/hbwin/win_prn3.c b/contrib/hbwin/win_prn3.c index 9751593017..dac48d07b0 100644 --- a/contrib/hbwin/win_prn3.c +++ b/contrib/hbwin/win_prn3.c @@ -107,7 +107,7 @@ static HB_BOOL hb_SetDefaultPrinter( LPCTSTR lpPrinterName ) /* Tell all open programs that this change occurred. Allow each program 1 second to handle this message. */ - SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0L, ( LPARAM ) ( LPCTSTR ) TEXT( "windows" ), SMTO_NORMAL, 1000, NULL ); + SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0, ( LPARAM ) ( LPCTSTR ) TEXT( "windows" ), SMTO_NORMAL, 1000, NULL ); } /* If Windows NT, use the SetDefaultPrinter API for Windows 2000, or WriteProfileString for version 4.0 and earlier. */ @@ -204,7 +204,7 @@ static HB_BOOL hb_SetDefaultPrinter( LPCTSTR lpPrinterName ) /* Tell all open programs that this change occurred. Allow each app 1 second to handle this message. */ - SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0L, 0L, SMTO_NORMAL, 1000, NULL ); + SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0, SMTO_NORMAL, 1000, NULL ); } /* Clean up. */ diff --git a/contrib/hbwin/win_shell.c b/contrib/hbwin/win_shell.c index 96b4bea1b3..aa586650d1 100644 --- a/contrib/hbwin/win_shell.c +++ b/contrib/hbwin/win_shell.c @@ -46,7 +46,7 @@ */ #undef _WIN32_IE -#define _WIN32_IE 0x0500 /* request Windows 2000 features for NOTIFYICONDATA */ +#define _WIN32_IE 0x0500 /* request Windows 2000 features for NOTIFYICONDATA */ #include "hbwapi.h" #include "hbapiitm.h" @@ -82,7 +82,7 @@ /* win_ShellNotifyIcon( [], [], [], [], [], [], - [], [], [], [] ) -> */ + [], [], [], [] ) --> */ HB_FUNC( WIN_SHELLNOTIFYICON ) { #if ! defined( HB_OS_WIN_CE ) @@ -122,8 +122,8 @@ HB_FUNC( WIN_SHELLNOTIFYICON ) } /* Details: - http://msdn.microsoft.com/en-us/library/bb762164(VS.85).aspx - http://msdn.microsoft.com/en-us/library/bb759795(v=VS.85).aspx + https://msdn.microsoft.com/library/bb762164 + https://msdn.microsoft.com/library/bb759795 */ #if ! defined( HB_OS_WIN_CE ) diff --git a/contrib/hbwin/win_tprn.prg b/contrib/hbwin/win_tprn.prg index da9b063af7..2403031374 100644 --- a/contrib/hbwin/win_tprn.prg +++ b/contrib/hbwin/win_tprn.prg @@ -54,11 +54,11 @@ Simple example - TODO: Colour printing + TODO: Color printing etc.... Peter Rees 2004-01-21 -*/ + */ #include "hbclass.ch" @@ -79,7 +79,7 @@ CREATE CLASS win_Prn METHOD StartPage() METHOD EndPage( lStartNewPage ) // If lStartNewPage == .T. then StartPage() is called for the next page of output METHOD NewLine() - METHOD NewPage( lDelay ) // If lDelay == .T. then new page is not created immediately but just before 1-st output + METHOD NewPage( lDelay ) // If lDelay == .T. then new page is not created immediately but just before 1st output METHOD CheckPage() METHOD GetDocumentProperties() METHOD SetFont( cFontName, nPointSize, xWidth, nBold, lUnderline, lItalic, nCharSet, lManualSize ) @@ -95,17 +95,17 @@ CREATE CLASS win_Prn METHOD Bold( nWeight ) METHOD UnderLine( lUnderline ) METHOD Italic( lItalic ) - METHOD SetDuplexType( nDuplexType ) // Get/Set current Duplexmode - METHOD SetPrintQuality( nPrintQuality ) // Get/Set Printquality + METHOD SetDuplexType( nDuplexType ) // Get/Set current duplex mode + METHOD SetPrintQuality( nPrintQuality ) // Get/Set print quality METHOD CharSet( nCharSet ) - METHOD SetPos( nPosX, nPosY ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col ) + METHOD SetPos( nPosX, nPosY ) // WARNING: ( Col, Row ) _NOT_ ( Row, Col ) METHOD SetColor( nClrText, nClrPane, nAlign ) - METHOD SetBkMode( nMode ) // Set Background mode: WIN_TRANSPARENT or WIN_OPAQUE + METHOD SetBkMode( nMode ) // Set background mode: WIN_TRANSPARENT or WIN_OPAQUE - METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) // nAlign : WIN_TA_* - METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col ) + METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) // nAlign : WIN_TA_* + METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) // WARNING: ( Col, Row ) _NOT_ ( Row, Col ) METHOD SetPen( nStyle, nWidth, nColor ) @@ -124,18 +124,18 @@ CREATE CLASS win_Prn METHOD SetPRC( nRow, nCol ) // Based on ::LineHeight and current ::CharWidth METHOD PRow() METHOD PCol() - METHOD MaxRow() // Based on ::LineHeight and Form dimensions - METHOD MaxCol() // Based on ::CharWidth and Form dimensions + METHOD MaxRow() // Based on ::LineHeight and form dimensions + METHOD MaxCol() // Based on ::CharWidth and form dimensions METHOD MM_TO_POSX( nMm ) // Convert position on page from MM to pixel location Column METHOD MM_TO_POSY( nMm ) // " " " " " " " " " Row METHOD INCH_TO_POSX( nInch ) // Convert position on page from INCH to pixel location Column METHOD INCH_TO_POSY( nInch ) // " " " " " " " " " Row - METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize,; // Print text string at location - nWidth, nBold, lUnderLine, lItalic, nCharSet,; // in specified font and color. - lNewLine, lUpdatePosX, nColor, nAlign ) // Restore original font and colour - // after printing. + METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, ; // Print text string at location + nWidth, nBold, lUnderLine, lItalic, nCharSet, ; // in specified font and color. + lNewLine, lUpdatePosX, nColor, nAlign ) // Restore original font and color + // after printing. METHOD GetDeviceCaps( nCaps ) @@ -148,13 +148,13 @@ CREATE CLASS win_Prn VAR AskProperties INIT .F. - // These next 6 variables must be set before calling ::Create() if - // you wish to alter the defaults + /* These next 6 variables must be set before calling ::Create() if + you wish to alter the defaults */ VAR FormType INIT 0 VAR BinNumber INIT 0 VAR Landscape INIT .F. VAR Copies INIT 1 - VAR PaperLength INIT 0 // Value is * 1/10 of mm 1000 = 10cm + VAR PaperLength INIT 0 // Value is * 1/10 of mm 1000 == 10cm VAR PaperWidth INIT 0 // " " " " " " VAR SetFontOk INIT .F. @@ -163,7 +163,7 @@ CREATE CLASS win_Prn VAR FontPointSize INIT 12 // Point size for font VAR FontWidth INIT { 0, 0 } // { Mul, Div } Calc width: nWidth := wapi_MulDiv( nMul, win_GetDeviceCaps( HDC, WIN_LOGPIXELSX ), nDiv ) // If font width is specified it is in "characters per inch" to emulate DotMatrix - VAR fBold INIT 0 HIDDEN // font darkness weight (Bold). See wingdi.h or WIN SDK CreateFont() for valid values + VAR fBold INIT 0 HIDDEN // font darkness weight (Bold). See wingdi.h or Windows SDK CreateFont() for valid values. VAR fUnderLine INIT .F. HIDDEN // UnderLine is on or off VAR fItalic INIT .F. HIDDEN // Italic is on or off VAR fCharSet INIT WIN_DEFAULT_CHARSET HIDDEN diff --git a/contrib/hbxdiff/core.c b/contrib/hbxdiff/core.c index c509b073e9..ebac6c425f 100644 --- a/contrib/hbxdiff/core.c +++ b/contrib/hbxdiff/core.c @@ -178,9 +178,9 @@ HB_FUNC( XDL_INIT_MMFILE ) hb_xfree( mmf ); } -/* - HB_FUNC( XDL_FREE_MMFILE ) - { +#if 0 +HB_FUNC( XDL_FREE_MMFILE ) +{ HB_MMF * phb_mmf = ( HB_MMF * ) hb_mmf_param( 1, HB_MMF_SIGN, HB_TRUE ); if( phb_mmf && phb_mmf->mmf ) @@ -190,8 +190,8 @@ HB_FUNC( XDL_INIT_MMFILE ) } else hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - } - */ +} +#endif /* int xdl_mmfile_iscompact(mmfile_t *mmf) */ @@ -228,7 +228,6 @@ HB_FUNC( XDL_READ_MMFILE ) PHB_ITEM pData = HB_ISBYREF( 2 ) ? hb_param( 2, HB_IT_STRING ) : NULL; char * data; HB_SIZE size; - long lResult; if( pData ) { @@ -245,7 +244,8 @@ HB_FUNC( XDL_READ_MMFILE ) if( data && size ) { - lResult = xdl_read_mmfile( phb_mmf->mmf, data, ( long ) size ); + long lResult = xdl_read_mmfile( phb_mmf->mmf, data, ( long ) size ); + if( lResult == -1 ) { hb_retc_null(); diff --git a/contrib/hbxdiff/hbxdiff.ch b/contrib/hbxdiff/hbxdiff.ch index 879b84ccb3..8f77bd6145 100644 --- a/contrib/hbxdiff/hbxdiff.ch +++ b/contrib/hbxdiff/hbxdiff.ch @@ -50,16 +50,16 @@ #define XDLT_STD_BLKSIZE ( 1024 * 8 ) #define XDLT_MAX_LINE_SIZE 80 -#define XDF_NEED_MINIMAL ( hb_bitShift( 1, 1 ) ) +#define XDF_NEED_MINIMAL hb_bitShift( 1, 1 ) -#define XDL_PATCH_NORMAL ( Asc( "-" ) ) -#define XDL_PATCH_REVERSE ( Asc( "+" ) ) +#define XDL_PATCH_NORMAL Asc( "-" ) +#define XDL_PATCH_REVERSE Asc( "+" ) #define XDL_PATCH_MODEMASK ( hb_bitShift( 1, 8 ) - 1 ) -#define XDL_PATCH_IGNOREBSPACE ( hb_bitShift( 1, 8 ) ) +#define XDL_PATCH_IGNOREBSPACE hb_bitShift( 1, 8 ) -#define XDL_MMB_READONLY ( hb_bitShift( 1, 0 ) ) +#define XDL_MMB_READONLY hb_bitShift( 1, 0 ) -#define XDL_MMF_ATOMIC ( hb_bitShift( 1, 0 ) ) +#define XDL_MMF_ATOMIC hb_bitShift( 1, 0 ) #define XDL_BDOP_INS 1 #define XDL_BDOP_CPY 2 diff --git a/contrib/hbxpp/dbcmdx.c b/contrib/hbxpp/dbcmdx.c index 4b017b9aae..190d6ce1ce 100644 --- a/contrib/hbxpp/dbcmdx.c +++ b/contrib/hbxpp/dbcmdx.c @@ -1,5 +1,5 @@ /* - * Base RDD module (XPP functions) + * Base RDD module (Xbase++ functions) * * Copyright 1999 Bruno Cantero * Copyright 2004-2007 Przemyslaw Czerpak @@ -45,7 +45,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( DBPACK, HB_DBPACK ) HB_FUNC_TRANSLATE( DBZAP, HB_DBZAP ) diff --git a/contrib/hbxpp/dbdetacx.c b/contrib/hbxpp/dbdetacx.c index 42b3b5934b..8e6da1cbda 100644 --- a/contrib/hbxpp/dbdetacx.c +++ b/contrib/hbxpp/dbdetacx.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( DBRELEASE, HB_DBDETACH ) HB_FUNC_TRANSLATE( DBREQUEST, HB_DBREQUEST ) diff --git a/contrib/hbxpp/dbfuncsx.prg b/contrib/hbxpp/dbfuncsx.prg index 0a6102cf08..e075c336ac 100644 --- a/contrib/hbxpp/dbfuncsx.prg +++ b/contrib/hbxpp/dbfuncsx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible _dbExport() function + * Xbase++ compatible _dbExport() function * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * @@ -46,16 +46,20 @@ FUNCTION _dbExport( cFile, aFields, bFor, bWhile, nNext, nRecord, lRest, cXPP_Driver, cDelimiter ) - DO CASE - CASE cXPP_Driver == "SDFDBE" + SWITCH hb_defaultValue( cXPP_Driver, "" ) + CASE "SDFDBE" RETURN __dbCopy( cFile, aFields, bFor, bWhile, nNext, nRecord, lRest, "SDF" ) -/* Alternate CA-Cl*pper compatible call: - RETURN __dbSDF( .T., cFile, aFields, bFor, bWhile, nNext, nRecord, lRest ) */ - CASE cXPP_Driver == "DELDBE" +#if 0 + /* Alternate CA-Cl*pper compatible call: */ + RETURN __dbSDF( .T., cFile, aFields, bFor, bWhile, nNext, nRecord, lRest ) +#endif + CASE "DELDBE" RETURN __dbCopy( cFile, aFields, bFor, bWhile, nNext, nRecord, lRest, "DELIM", , , cDelimiter ) -/* Alternate CA-Cl*pper compatible call: - RETURN __dbDelim( .T., cFile, cDelimiter, aFields, bFor, bWhile, nNext, nRecord, lRest ) */ - ENDCASE +#if 0 + /* Alternate CA-Cl*pper compatible call: */ + RETURN __dbDelim( .T., cFile, cDelimiter, aFields, bFor, bWhile, nNext, nRecord, lRest ) +#endif + ENDSWITCH RETURN __dbCopy( cFile, aFields, bFor, bWhile, nNext, nRecord, lRest, cXPP_Driver ) diff --git a/contrib/hbxpp/dbjoinx.prg b/contrib/hbxpp/dbjoinx.prg index f8656d45af..50a6391330 100644 --- a/contrib/hbxpp/dbjoinx.prg +++ b/contrib/hbxpp/dbjoinx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible dbJoin() function + * Xbase++ compatible dbJoin() function * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/hbxpp/dblistx.prg b/contrib/hbxpp/dblistx.prg index 2eb0938010..60e1b622ad 100644 --- a/contrib/hbxpp/dblistx.prg +++ b/contrib/hbxpp/dblistx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible dbList() function + * Xbase++ compatible dbList() function * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * @@ -42,7 +42,7 @@ * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * -*/ + */ FUNCTION dbList( lOff, abEval, lAll, bFor, bWhile, nNext, nRecord, lRest, lToPrint, cToFileName ) RETURN __dbList( abEval, lOff, lAll, bFor, bWhile, nNext, nRecord, lRest, lToPrint, cToFileName ) diff --git a/contrib/hbxpp/dbsortx.prg b/contrib/hbxpp/dbsortx.prg index 47dc5b7566..4775cf6729 100644 --- a/contrib/hbxpp/dbsortx.prg +++ b/contrib/hbxpp/dbsortx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible dbSort() function + * Xbase++ compatible dbSort() function * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/hbxpp/dbstruxx.prg b/contrib/hbxpp/dbstruxx.prg index ff0e04ced0..e59452c1e8 100644 --- a/contrib/hbxpp/dbstruxx.prg +++ b/contrib/hbxpp/dbstruxx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible dbCopyStruct(), dbCopyExtStruct() functions + * Xbase++ compatible dbCopyStruct(), dbCopyExtStruct() functions * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/hbxpp/dbtotalx.prg b/contrib/hbxpp/dbtotalx.prg index c847be176a..006dfadd29 100644 --- a/contrib/hbxpp/dbtotalx.prg +++ b/contrib/hbxpp/dbtotalx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible dbTotal() function + * Xbase++ compatible dbTotal() function * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/hbxpp/dbupdatx.prg b/contrib/hbxpp/dbupdatx.prg index 2e9a1b84ba..3b3341c5fc 100644 --- a/contrib/hbxpp/dbupdatx.prg +++ b/contrib/hbxpp/dbupdatx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible dbUpdate() function + * Xbase++ compatible dbUpdate() function * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/hbxpp/dll.ch b/contrib/hbxpp/dll.ch index 9656a1797d..99e5e3eaf2 100644 --- a/contrib/hbxpp/dll.ch +++ b/contrib/hbxpp/dll.ch @@ -60,7 +60,7 @@ #define DLL_OSAPI DLL_CDECL #endif -/* Only for compatiblity. +/* Only for compatibility. Harbour always copies the string to a temporary buffer. */ #define DLL_CALLMODE_COPY 0 #define DLL_CALLMODE_NORMAL DLL_CALLMODE_COPY diff --git a/contrib/hbxpp/dmlb.ch b/contrib/hbxpp/dmlb.ch index 96cebb7cbc..6ce025766b 100644 --- a/contrib/hbxpp/dmlb.ch +++ b/contrib/hbxpp/dmlb.ch @@ -1,5 +1,5 @@ /* - * XBASE++ compatibility header + * Xbase++ compatibility header * * Copyright 2010 Przemyslaw Czerpak * diff --git a/contrib/hbxpp/hbxpp.ch b/contrib/hbxpp/hbxpp.ch index 6948230116..e6cc591911 100644 --- a/contrib/hbxpp/hbxpp.ch +++ b/contrib/hbxpp/hbxpp.ch @@ -84,7 +84,7 @@ #define HB_B_THIN_UNI hb_UTF8ToStrBox( "█▀███▄██" ) #define HB_B_FAT_UNI hb_UTF8ToStrBox( "████████" ) -/* TEXT INTO [WRAP []] [TRIMMED] */ +/* TEXT INTO [WRAP []] [TRIMMED] */ #xcommand TEXT INTO [] [] => ; #pragma __text | += iif( <.trm.>, LTrim( %s ), %s ) +; iif( <.wrp.>, hb_eol(), "" ); := "" diff --git a/contrib/hbxpp/oemansix.c b/contrib/hbxpp/oemansix.c index 5dff30ad71..cd848d54ff 100644 --- a/contrib/hbxpp/oemansix.c +++ b/contrib/hbxpp/oemansix.c @@ -1,5 +1,5 @@ /* - * XPP compatible OEM <-> ANSI string conversion functions + * Xbase++ compatible OEM <-> ANSI string conversion functions * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/hbxpp/runshell.prg b/contrib/hbxpp/runshell.prg index a4febecb5f..cb272ddf56 100644 --- a/contrib/hbxpp/runshell.prg +++ b/contrib/hbxpp/runshell.prg @@ -82,4 +82,4 @@ FUNCTION RunShell( cCommand, cProgram, lAsync, lBackground ) #endif ENDIF - RETURN hb_processRun( LTrim( cProgram ), NIL, NIL, NIL, lAsync ) + RETURN hb_processRun( LTrim( cProgram ),,,, lAsync ) diff --git a/contrib/hbxpp/tbrowsex.prg b/contrib/hbxpp/tbrowsex.prg index 92295325a6..c005eaec20 100644 --- a/contrib/hbxpp/tbrowsex.prg +++ b/contrib/hbxpp/tbrowsex.prg @@ -50,7 +50,7 @@ #include "hbclass.ch" -#define _TBR_COORD( n ) Int( n ) +#define _TBR_COORD( n ) Int( n ) CREATE CLASS xpp_TBrowse INHERIT TBrowse @@ -73,7 +73,7 @@ METHOD viewArea() CLASS xpp_TBrowse ::doConfigure() ENDIF - // TOFIX + // FIXME nWidth := nFrozenWidth := _TBR_COORD( ::n_Right ) - _TBR_COORD( ::n_Left ) + 1 /* _MAXFREEZE( ::nFrozen, ::aColData, @nWidth ) */ @@ -94,9 +94,10 @@ METHOD firstScrCol() CLASS xpp_TBrowse ::doConfigure() ENDIF - // TOFIX - -// RETURN iif( ::leftVisible == 0, 0, ::aColData[ ::leftVisible ][ _TBCI_COLPOS ] ) +#if 0 + // FIXME + RETURN iif( ::leftVisible == 0, 0, ::aColData[ ::leftVisible ][ _TBCI_COLPOS ] ) +#endif RETURN 0 METHOD _left() CLASS xpp_TBrowse diff --git a/contrib/hbxpp/tgetx.prg b/contrib/hbxpp/tgetx.prg index 8e042ba75e..61d87bfdff 100644 --- a/contrib/hbxpp/tgetx.prg +++ b/contrib/hbxpp/tgetx.prg @@ -59,7 +59,7 @@ CREATE CLASS xpp_Get INHERIT Get ENDCLASS /* NOTE: Not tested or compared to Xbase++. [vszakats] */ -/* TOFIX: To make it work when @S was used. [vszakats] */ +/* FIXME: To make it work when @S was used. [vszakats] */ METHOD posInBuffer( nRow, nCol ) CLASS xpp_Get diff --git a/contrib/hbxpp/thfuncx.prg b/contrib/hbxpp/thfuncx.prg index 4c8f4683e3..3d6aa36818 100644 --- a/contrib/hbxpp/thfuncx.prg +++ b/contrib/hbxpp/thfuncx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible thread functions + * Xbase++ compatible thread functions * * Copyright 2008 Przemyslaw Czerpak * @@ -47,14 +47,15 @@ FUNCTION ThreadID() RETURN hb_threadID() - FUNCTION ThreadObject( oThread ) + THREAD STATIC t_oThread + IF PCount() > 0 t_oThread := oThread ENDIF - RETURN t_oThread + RETURN t_oThread FUNCTION ThreadWait( aThreads, nTimeOut ) diff --git a/contrib/hbxpp/tthreadx.prg b/contrib/hbxpp/tthreadx.prg index 911fe7e115..4a355ff144 100644 --- a/contrib/hbxpp/tthreadx.prg +++ b/contrib/hbxpp/tthreadx.prg @@ -1,8 +1,8 @@ /* - * XPP compatible classes to manage threads + * Xbase++ compatible classes to manage threads * * Copyright 2008 Przemyslaw Czerpak - * special thanks for Pritpal Bedi for class skeleton with info about + * Special thanks for Pritpal Bedi for class skeleton with info about * Xbase++ and to other contributors which I hope will finish and fix * this code * @@ -53,9 +53,6 @@ #include "thread.ch" -/* - * SIGNAL class - */ CREATE CLASS Signal VAR cargo AS USUAL EXPORTED @@ -69,23 +66,23 @@ EXPORTED: ENDCLASS -METHOD new( ... ) CLASS SIGNAL +METHOD new( ... ) CLASS Signal + ::mutex := hb_mutexCreate() ::Init( ... ) + RETURN Self METHOD wait( nTimeOut ) CLASS SIGNAL RETURN __clsSyncWait( ::mutex, nTimeOut ) -METHOD signal() CLASS SIGNAL +METHOD signal() CLASS Signal + __clsSyncSignal( ::mutex ) + RETURN Self -/* - * THREAD class - */ - CREATE CLASS Thread EXPORTED: @@ -127,7 +124,8 @@ EXPORTED: ENDCLASS -METHOD new( ... ) CLASS THREAD +METHOD new( ... ) CLASS Thread + LOCAL nMaxStackSize IF PCount() == 1 @@ -143,14 +141,19 @@ METHOD new( ... ) CLASS THREAD /* TODO: do not ignore thread stack size set by user in ::maxStackSize */ ENDIF + ::Init( ... ) + RETURN Self -METHOD execute() CLASS THREAD - HB_SYMBOL_UNUSED( Self ) - RETURN NIL +METHOD PROCEDURE execute() CLASS Thread + + HB_SYMBOL_UNUSED( Self ) + + RETURN + +METHOD PROCEDURE quit( xResult, nRestart ) CLASS Thread -METHOD quit( xResult, nRestart ) CLASS THREAD IF hb_threadSelf() == ::pThreadID IF PCount() > 0 ::result := xResult @@ -160,9 +163,11 @@ METHOD quit( xResult, nRestart ) CLASS THREAD ENDIF QUIT ENDIF - RETURN NIL -METHOD setInterval( nHSeconds ) CLASS THREAD + RETURN + +METHOD setInterval( nHSeconds ) CLASS Thread + IF HB_ISNUMERIC( nHSeconds ) .AND. Int( nHSeconds ) >= 0 ::interval := Int( nHSeconds ) ELSEIF PCount() > 0 .OR. nHSeconds == NIL @@ -171,16 +176,20 @@ METHOD setInterval( nHSeconds ) CLASS THREAD /* TODO: RT Error */ RETURN .F. ENDIF + RETURN .T. -METHOD setPriority( nPriority ) CLASS THREAD +METHOD setPriority( nPriority ) CLASS Thread + /* TODO: add thread priority setting */ IF HB_ISNUMERIC( nPriority ) ::priority := nPriority ENDIF + RETURN .F. -METHOD setStartTime( nSeconds ) CLASS THREAD +METHOD setStartTime( nSeconds ) CLASS Thread + IF HB_ISNUMERIC( nSeconds ) IF nSeconds < 0 .OR. nSeconds > 86400 RETURN .F. @@ -192,13 +201,13 @@ METHOD setStartTime( nSeconds ) CLASS THREAD /* TODO: RT Error */ RETURN .F. ENDIF + RETURN .T. -METHOD start( xAction, ... ) CLASS THREAD +METHOD start( xAction, ... ) CLASS Thread IF ::active RETURN .F. - ELSE ::pThreadID := hb_threadStart( HB_THREAD_INHERIT_PUBLIC, ; {| ... | @@ -223,7 +232,7 @@ METHOD start( xAction, ... ) CLASS THREAD Eval( ::_atStart, ... ) ENDIF - WHILE .T. + DO WHILE .T. nTime := hb_MilliSeconds() @@ -235,7 +244,7 @@ METHOD start( xAction, ... ) CLASS THREAD ENDIF ALWAYS __QuitCancel() - ENDSEQUENCE + END SEQUENCE nTime := Int( ( hb_MilliSeconds() - nTime ) / 10 ) ::deltaTime := nTime @@ -266,27 +275,30 @@ METHOD start( xAction, ... ) CLASS THREAD RETURN NIL }, ... ) - ::threadID := IIF( ::pThreadID == NIL, 0, hb_threadID( ::pThreadID ) ) - + ::threadID := iif( ::pThreadID == NIL, 0, hb_threadID( ::pThreadID ) ) ENDIF -RETURN .T. + RETURN .T. + +METHOD synchronize( nTimeOut ) CLASS Thread -METHOD synchronize( nTimeOut ) CLASS THREAD LOCAL pThreadID := ::pThreadID IF hb_threadSelf() != pThreadID RETURN hb_threadWait( pThreadID, ; - iif( HB_ISNUMERIC( nTimeOut ) .AND. nTimeOut != 0, ; - nTimeOut / 100, ) ) + iif( HB_ISNUMERIC( nTimeOut ) .AND. nTimeOut != 0, ; + nTimeOut / 100, ) ) ENDIF + RETURN .F. -METHOD threadSelf() CLASS THREAD +METHOD threadSelf() CLASS Thread RETURN ::pThreadID -/* -METHOD threadID() CLASS THREAD +#if 0 +METHOD threadID() CLASS Thread + LOCAL pThreadID := ::pThreadID - RETURN IIF( pThreadID == NIL, 0, hb_threadID( pThreadID ) ) -*/ + + RETURN iif( pThreadID == NIL, 0, hb_threadID( pThreadID ) ) +#endif diff --git a/contrib/hbxpp/typefilx.prg b/contrib/hbxpp/typefilx.prg index a1470aaf1f..1d4b7734a1 100644 --- a/contrib/hbxpp/typefilx.prg +++ b/contrib/hbxpp/typefilx.prg @@ -1,5 +1,5 @@ /* - * XPP compatible _TypeFile() function + * Xbase++ compatible _TypeFile() function * * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/hbxpp/wafuncx.c b/contrib/hbxpp/wafuncx.c index 6cc9e42b8d..4a7170859b 100644 --- a/contrib/hbxpp/wafuncx.c +++ b/contrib/hbxpp/wafuncx.c @@ -1,5 +1,5 @@ /* - * XBASE++ compatible workarea functions + * Xbase++ compatible workarea functions * * Copyright 2010 Przemyslaw Czerpak * @@ -66,13 +66,12 @@ HB_FUNC( WORKSPACELIST ) PHB_ITEM pArray; if( hb_parni( 1 ) == DB_ZEROSPACE ) - { pArray = hb_rddDetachedList(); - } else { pArray = hb_itemArrayNew( 0 ); hb_rddIterateWorkAreas( s_waList, pArray ); } + hb_itemReturnRelease( pArray ); } diff --git a/contrib/hbzebra/codabar.c b/contrib/hbzebra/codabar.c index 8fd5e069aa..b16f0119e9 100644 --- a/contrib/hbzebra/codabar.c +++ b/contrib/hbzebra/codabar.c @@ -45,8 +45,6 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" static const char s_code[] = { @@ -73,12 +71,12 @@ static const char s_code[] = { static int _codabar_charno( char ch ) { - static const char * s_symbols = "-$:/.+ABCD"; - if( '0' <= ch && ch <= '9' ) return ch - '0'; else { + static const char * s_symbols = "-$:/.+ABCD"; + const char * ptr = strchr( s_symbols, ch ); if( ptr && *ptr ) return ( int ) ( ptr - s_symbols + 10 ); @@ -94,7 +92,7 @@ static void _codabar_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fL { for( i = 0; i < 7; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 5 : 2 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 5 : 2 ); code >>= 1; } if( ! fLast ) @@ -104,7 +102,7 @@ static void _codabar_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fL { for( i = 0; i < 7; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 3 : 1 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 3 : 1 ); code >>= 1; } if( ! fLast ) @@ -114,7 +112,7 @@ static void _codabar_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fL { for( i = 0; i < 7; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 2 : 1 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 2 : 1 ); code >>= 1; } if( ! fLast ) @@ -124,16 +122,16 @@ static void _codabar_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fL PHB_ZEBRA hb_zebra_create_codabar( const char * szCode, HB_SIZE nLen, int iFlags ) { - PHB_ZEBRA pZebra; - int i, iLen = ( int ) nLen; - int j; + PHB_ZEBRA pZebra; + unsigned int i, iLen = ( unsigned int ) nLen; pZebra = hb_zebra_create(); pZebra->iType = HB_ZEBRA_TYPE_CODABAR; for( i = 0; i < iLen; i++ ) { - j = _codabar_charno( szCode[ i ] ); + int j = _codabar_charno( szCode[ i ] ); + if( j < 0 || ( j >= 16 && i != 0 && i != iLen - 1 ) ) { pZebra->iError = HB_ZEBRA_ERROR_INVALIDCODE; diff --git a/contrib/hbzebra/code11.c b/contrib/hbzebra/code11.c index 2b7d78de88..a57816b5b9 100644 --- a/contrib/hbzebra/code11.c +++ b/contrib/hbzebra/code11.c @@ -45,8 +45,6 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" static const char s_code[] = { 0x10, /* 0 */ @@ -80,7 +78,7 @@ static void _code11_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fLa { for( i = 0; i < 5; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 5 : 2 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 5 : 2 ); code >>= 1; } if( ! fLast ) @@ -90,7 +88,7 @@ static void _code11_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fLa { for( i = 0; i < 5; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 3 : 1 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 3 : 1 ); code >>= 1; } if( ! fLast ) @@ -100,7 +98,7 @@ static void _code11_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fLa { for( i = 0; i < 5; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 2 : 1 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 2 : 1 ); code >>= 1; } if( ! fLast ) @@ -110,8 +108,8 @@ static void _code11_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fLa PHB_ZEBRA hb_zebra_create_code11( const char * szCode, HB_SIZE nLen, int iFlags ) { - PHB_ZEBRA pZebra; - int csum, ksum, i, iLen = ( int ) nLen; + PHB_ZEBRA pZebra; + unsigned int csum, ksum, i, iLen = ( unsigned int ) nLen; pZebra = hb_zebra_create(); pZebra->iType = HB_ZEBRA_TYPE_CODE11; @@ -139,8 +137,8 @@ PHB_ZEBRA hb_zebra_create_code11( const char * szCode, HB_SIZE nLen, int iFlags { int no = _code11_charno( szCode[ i ] ); _code11_add( pZebra->pBits, s_code[ no ], iFlags, HB_FALSE ); - ksum += ( ( iLen + 1 - i ) % 9 ? ( iLen + 1 - i ) % 9 : 9 ) * no; - csum += ( ( iLen - i ) % 10 ? ( iLen - i ) % 10 : 10 ) * no; + ksum += ( ( ( iLen + 1 - i ) % 9 ) ? ( iLen + 1 - i ) % 9 : 9 ) * no; + csum += ( ( ( iLen - i ) % 10 ) ? ( iLen - i ) % 10 : 10 ) * no; } /* checksum */ diff --git a/contrib/hbzebra/code128.c b/contrib/hbzebra/code128.c index 4c8abb3ab8..6d5eef4bdc 100644 --- a/contrib/hbzebra/code128.c +++ b/contrib/hbzebra/code128.c @@ -45,111 +45,109 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" static const unsigned short s_code[] = { - 00633, /* 00 */ - 00663, /* ! ! 01 */ - 01463, /* " " 02 */ - 00311, /* # # 03 */ - 00611, /* $ $ 04 */ - 00621, /* % % 05 */ - 00231, /* & & 06 */ - 00431, /* ' ' 07 */ - 00461, /* ( ( 08 */ - 00223, /* ) ) 09 */ - 00423, /* * * 10 */ - 00443, /* + + 11 */ - 00715, /* , , 12 */ - 00731, /* - - 13 */ - 01631, /* . . 14 */ - 00635, /* / / 15 */ - 00671, /* 0 0 16 */ - 01471, /* 1 1 17 */ - 01163, /* 2 2 18 */ - 00723, /* 3 3 19 */ - 01623, /* 4 4 20 */ - 00473, /* 5 5 21 */ - 00563, /* 6 6 22 */ - 01667, /* 7 7 23 */ - 00627, /* 8 8 24 */ - 00647, /* 9 9 25 */ - 01447, /* : : 26 */ - 00467, /* ; ; 27 */ - 00547, /* < < 28 */ - 01147, /* = = 29 */ - 00333, /* > > 30 */ - 01433, /* ? ? 31 */ - 01543, /* @ @ 32 */ - 00305, /* A A 33 */ - 00321, /* B B 34 */ - 01421, /* C C 35 */ - 00215, /* D D 36 */ - 00261, /* E E 37 */ - 01061, /* F F 38 */ - 00213, /* G G 39 */ - 00243, /* H H 40 */ - 01043, /* I I 41 */ - 00355, /* J J 42 */ - 01615, /* K K 43 */ - 01661, /* L L 44 */ - 00335, /* M M 45 */ - 01435, /* N N 46 */ - 01561, /* O O 47 */ - 01567, /* P P 48 */ - 01613, /* Q Q 49 */ - 01643, /* R R 50 */ - 00273, /* S S 51 */ - 01073, /* T T 52 */ - 01673, /* U U 53 */ - 00327, /* V V 54 */ - 01427, /* W W 55 */ - 01507, /* X X 56 */ - 00267, /* Y Y 57 */ - 01067, /* Z Z 58 */ - 01307, /* [ [ 59 */ - 01367, /* \ \ 60 */ - 01023, /* ] ] 61 */ - 01217, /* ^ ^ 62 */ - 00145, /* _ _ 63 */ - 00605, /* NUL ` 64 */ - 00151, /* SOH a 65 */ - 01411, /* STX b 66 */ - 00641, /* ETX c 67 */ - 01441, /* EOT d 68 */ - 00115, /* ENQ e 69 */ - 00415, /* ACK f 70 */ - 00131, /* BEL g 71 */ - 01031, /* BS h 72 */ - 00541, /* HT i 73 */ - 01141, /* LF j 74 */ - 01103, /* VT k 75 */ - 00123, /* FF l 76 */ - 01357, /* CR m 77 */ - 00503, /* SO n 78 */ - 01361, /* SI o 79 */ - 00745, /* DLE p 80 */ - 00751, /* DC1 q 81 */ - 01711, /* DC2 r 82 */ - 00475, /* DC3 s 83 */ - 00571, /* DC4 t 84 */ - 01171, /* NAK u 85 */ - 00457, /* SYN v 86 */ - 00517, /* ETB w 87 */ - 01117, /* CAN x 88 */ - 01733, /* EM y 89 */ - 01573, /* SUB z 90 */ - 01557, /* ESC { 91 */ - 00365, /* FS | 92 */ - 01705, /* GS } 93 */ - 01721, /* RS ~ 94 */ - 00275, /* US DEL 95 */ - 01075, /* FNC3 FNC3 96 */ - 00257, /* FNC2 FNC2 97 */ - 01057, /* ShiB ShiA 98 */ - 01735, /* CodC CodC 99 */ + 00633, /* 00 */ + 00663, /* ! ! 01 */ + 01463, /* " " 02 */ + 00311, /* # # 03 */ + 00611, /* $ $ 04 */ + 00621, /* % % 05 */ + 00231, /* & & 06 */ + 00431, /* ' ' 07 */ + 00461, /* ( ( 08 */ + 00223, /* ) ) 09 */ + 00423, /* * * 10 */ + 00443, /* + + 11 */ + 00715, /* , , 12 */ + 00731, /* - - 13 */ + 01631, /* . . 14 */ + 00635, /* / / 15 */ + 00671, /* 0 0 16 */ + 01471, /* 1 1 17 */ + 01163, /* 2 2 18 */ + 00723, /* 3 3 19 */ + 01623, /* 4 4 20 */ + 00473, /* 5 5 21 */ + 00563, /* 6 6 22 */ + 01667, /* 7 7 23 */ + 00627, /* 8 8 24 */ + 00647, /* 9 9 25 */ + 01447, /* : : 26 */ + 00467, /* ; ; 27 */ + 00547, /* < < 28 */ + 01147, /* = = 29 */ + 00333, /* > > 30 */ + 01433, /* ? ? 31 */ + 01543, /* @ @ 32 */ + 00305, /* A A 33 */ + 00321, /* B B 34 */ + 01421, /* C C 35 */ + 00215, /* D D 36 */ + 00261, /* E E 37 */ + 01061, /* F F 38 */ + 00213, /* G G 39 */ + 00243, /* H H 40 */ + 01043, /* I I 41 */ + 00355, /* J J 42 */ + 01615, /* K K 43 */ + 01661, /* L L 44 */ + 00335, /* M M 45 */ + 01435, /* N N 46 */ + 01561, /* O O 47 */ + 01567, /* P P 48 */ + 01613, /* Q Q 49 */ + 01643, /* R R 50 */ + 00273, /* S S 51 */ + 01073, /* T T 52 */ + 01673, /* U U 53 */ + 00327, /* V V 54 */ + 01427, /* W W 55 */ + 01507, /* X X 56 */ + 00267, /* Y Y 57 */ + 01067, /* Z Z 58 */ + 01307, /* [ [ 59 */ + 01367, /* \ \ 60 */ + 01023, /* ] ] 61 */ + 01217, /* ^ ^ 62 */ + 00145, /* _ _ 63 */ + 00605, /* NUL ` 64 */ + 00151, /* SOH a 65 */ + 01411, /* STX b 66 */ + 00641, /* ETX c 67 */ + 01441, /* EOT d 68 */ + 00115, /* ENQ e 69 */ + 00415, /* ACK f 70 */ + 00131, /* BEL g 71 */ + 01031, /* BS h 72 */ + 00541, /* HT i 73 */ + 01141, /* LF j 74 */ + 01103, /* VT k 75 */ + 00123, /* FF l 76 */ + 01357, /* CR m 77 */ + 00503, /* SO n 78 */ + 01361, /* SI o 79 */ + 00745, /* DLE p 80 */ + 00751, /* DC1 q 81 */ + 01711, /* DC2 r 82 */ + 00475, /* DC3 s 83 */ + 00571, /* DC4 t 84 */ + 01171, /* NAK u 85 */ + 00457, /* SYN v 86 */ + 00517, /* ETB w 87 */ + 01117, /* CAN x 88 */ + 01733, /* EM y 89 */ + 01573, /* SUB z 90 */ + 01557, /* ESC { 91 */ + 00365, /* FS | 92 */ + 01705, /* GS } 93 */ + 01721, /* RS ~ 94 */ + 00275, /* US DEL 95 */ + 01075, /* FNC3 FNC3 96 */ + 00257, /* FNC2 FNC2 97 */ + 01057, /* ShiB ShiA 98 */ + 01735, /* CodC CodC 99 */ 01675, /* CodB FNC4 CodB 100 */ 01727, /* FNC4 CodA CodA 101 */ 01657, /* FNC1 FNC1 FNC1 102 */ @@ -196,7 +194,7 @@ static int _code128_charno( char ch, int iCodeSet ) PHB_ZEBRA hb_zebra_create_code128( const char * szCode, HB_SIZE nLen, int iFlags ) { PHB_ZEBRA pZebra; - int i, j, k, csum, iCode, iCodeSet, iCodeLen, iLen = ( int ) nLen; + int i, j, k, csum, iCodeSet, iCodeLen, iLen = ( int ) nLen; int * pCode; HB_SYMBOL_UNUSED( iFlags ); @@ -254,10 +252,11 @@ PHB_ZEBRA hb_zebra_create_code128( const char * szCode, HB_SIZE nLen, int iFlags /* encode source data */ /* Warning: digit optimizer works in optimal way with this encoder code. Be careful - if you'll change encoder code, digit optimizer canm require adjustment also [Mindaugas] */ + if you'll change encoder code, digit optimizer can require adjustment also [Mindaugas] */ for( i = 0; i < iLen; i++ ) { - iCode = _code128_charno( szCode[ i ], iCodeSet ); + int iCode = _code128_charno( szCode[ i ], iCodeSet ); + if( iCode != -1 ) pCode[ iCodeLen++ ] = iCode; else diff --git a/contrib/hbzebra/code39.c b/contrib/hbzebra/code39.c index 109a46a710..cc5ca3ccf0 100644 --- a/contrib/hbzebra/code39.c +++ b/contrib/hbzebra/code39.c @@ -45,8 +45,6 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" /* Usually one character bitmap does not fit into 1 byte, but if we use enough @@ -123,7 +121,7 @@ static void _code39_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fLa { for( i = 0; i < 8; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 5 : 2 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 5 : 2 ); cnt += ( code & 1 ); code >>= 1; } @@ -135,7 +133,7 @@ static void _code39_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fLa { for( i = 0; i < 8; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 3 : 1 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 3 : 1 ); cnt += ( code & 1 ); code >>= 1; } @@ -147,7 +145,7 @@ static void _code39_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fLa { for( i = 0; i < 8; i++ ) { - hb_bitbuffer_cat_int( pBits, i & 1 ? 0 : 31, code & 1 ? 2 : 1 ); + hb_bitbuffer_cat_int( pBits, ( i & 1 ) ? 0 : 31, ( code & 1 ) ? 2 : 1 ); cnt += ( code & 1 ); code >>= 1; } diff --git a/contrib/hbzebra/code93.c b/contrib/hbzebra/code93.c index 23dbcfda0a..a2b7f354c5 100644 --- a/contrib/hbzebra/code93.c +++ b/contrib/hbzebra/code93.c @@ -45,8 +45,6 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" static const char s_code[] = { @@ -170,8 +168,8 @@ PHB_ZEBRA hb_zebra_create_code93( const char * szCode, HB_SIZE nLen, int iFlags hb_bitbuffer_cat_int( pZebra->pBits, 1, 1 ); hb_bitbuffer_cat_int( pZebra->pBits, s_code[ no ], 7 ); hb_bitbuffer_cat_int( pZebra->pBits, 0, 1 ); - ksum += ( k % 15 ? k % 15 : 15 ) * no; k--; - csum += ( k % 20 ? k % 20 : 20 ) * no; + ksum += ( ( k % 15 ) ? k % 15 : 15 ) * no; k--; + csum += ( ( k % 20 ) ? k % 20 : 20 ) * no; } else { @@ -227,10 +225,10 @@ PHB_ZEBRA hb_zebra_create_code93( const char * szCode, HB_SIZE nLen, int iFlags hb_bitbuffer_cat_int( pZebra->pBits, 1, 1 ); hb_bitbuffer_cat_int( pZebra->pBits, s_code[ no2 ], 7 ); hb_bitbuffer_cat_int( pZebra->pBits, 0, 1 ); - ksum += ( k % 15 ? k % 15 : 15 ) * no1; k--; - csum += ( k % 20 ? k % 20 : 20 ) * no1; - ksum += ( k % 15 ? k % 15 : 15 ) * no2; k--; - csum += ( k % 20 ? k % 20 : 20 ) * no2; + ksum += ( ( k % 15 ) ? k % 15 : 15 ) * no1; k--; + csum += ( ( k % 20 ) ? k % 20 : 20 ) * no1; + ksum += ( ( k % 15 ) ? k % 15 : 15 ) * no2; k--; + csum += ( ( k % 20 ) ? k % 20 : 20 ) * no2; } } diff --git a/contrib/hbzebra/core.c b/contrib/hbzebra/core.c index 91fb73c4cc..7839bbded7 100644 --- a/contrib/hbzebra/core.c +++ b/contrib/hbzebra/core.c @@ -45,12 +45,10 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" #include "hbstack.h" -/* ================ Bit buffer ================ */ +/* --- Bit buffer --- */ PHB_BITBUFFER hb_bitbuffer_create( void ) { @@ -164,7 +162,7 @@ void hb_bitbuffer_cat_int_rev( PHB_BITBUFFER pBitBuffer, int iValue, int iLen ) } -/* ================ GC pointer ================ */ +/* --- GC pointer --- */ static HB_GARBAGE_FUNC( hb_zebra_destructor ) { @@ -229,7 +227,7 @@ void hb_zebra_ret( PHB_ZEBRA pZebra ) } -/* ================ Zebra ================ */ +/* --- Zebra --- */ PHB_ZEBRA hb_zebra_create( void ) { diff --git a/contrib/hbzebra/coredraw.c b/contrib/hbzebra/coredraw.c index cc9c838dfa..99de084fe1 100644 --- a/contrib/hbzebra/coredraw.c +++ b/contrib/hbzebra/coredraw.c @@ -46,7 +46,6 @@ */ #include "hbzebra.h" -#include "hbapierr.h" #include "hbvm.h" typedef void ( *HB_ZEBRA_CALLBACK )( void * cargo, double dX, double dY, double dWidth, double dHeight ); @@ -55,7 +54,7 @@ int hb_zebra_draw( PHB_ZEBRA pZebra, HB_ZEBRA_CALLBACK pCallback, void * cargo, { double dLast; HB_SIZE n, nLen, nCount; - HB_BOOL fBit, fLastBit; + HB_BOOL fLastBit; int i, iCol = pZebra->iCol; HB_SYMBOL_UNUSED( iFlags ); @@ -70,7 +69,7 @@ int hb_zebra_draw( PHB_ZEBRA pZebra, HB_ZEBRA_CALLBACK pCallback, void * cargo, i = 0; for( n = 0; n < nLen; n++ ) { - fBit = hb_bitbuffer_get( pZebra->pBits, n ); + HB_BOOL fBit = hb_bitbuffer_get( pZebra->pBits, n ); if( fBit != fLastBit ) { if( fLastBit && pCallback ) diff --git a/contrib/hbzebra/datamtrx.c b/contrib/hbzebra/datamtrx.c index f525b47a41..c06a6cafce 100644 --- a/contrib/hbzebra/datamtrx.c +++ b/contrib/hbzebra/datamtrx.c @@ -48,26 +48,23 @@ DataMatrix is ISO/IEC 16022:2006 Some info links: - http://www.gs1.org/docs/barcodes/GS1_DataMatrix_Introduction_and_technical_overview.pdf - http://www.aipsys.com/dmintro.htm + https://web.archive.org/web/20150208040021/www.gs1.org/docs/barcodes/GS1_DataMatrix_Introduction_and_technical_overview.pdf + https://web.archive.org/web/20161114095405/www.aipsys.com/dmintro.htm - Open source projects, that implements DataMatrix: - http://www.datenfreihafen.org/projects/iec16022.html - http://www.libdmtx.org/ - http://www.codeproject.com/Articles/66495/DataMatrixNet-ported-to-Compact-Framework.aspx + Open source projects, that implement DataMatrix: + https://www.datenfreihafen.org/projects/iec16022.html + https://web.archive.org/web/20130325083148/www.libdmtx.org/ + https://www.codeproject.com/Articles/66495/DataMatrixNet-ported-to-Compact-Framework.aspx Online encoder: - http://www.bcgen.com/datamatrix-barcode-creator.html - http://www.bcmaker.com/demos/datamatrix.php + https://www.barcodetools.com/generator/index.html Online decoder: - http://www.datasymbol.com/barcode-recognition-sdk/barcode-reader/online-barcode-decoder.html + https://www.datasymbol.com/barcode-reader-sdk/barcode-reader-sdk-for-windows/online-barcode-decoder.html */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" /* Special CodeWords */ @@ -154,14 +151,14 @@ static int _datamatrix_encode( const char * szCode, int iLen, unsigned char * pC static void _reed_solomon_encode( unsigned char * pData, int iDataLen, unsigned char * pEC, int iECLen, int * pPoly, int * pExp, int * pLog, int iMod ) { int i, j; - unsigned char iM; for( i = 0; i < iECLen; i++ ) pEC[ i ] = 0; for( i = 0; i < iDataLen; i++ ) { - iM = pData[ i ] ^ pEC[ iECLen - 1 ]; + unsigned char iM = pData[ i ] ^ pEC[ iECLen - 1 ]; + for( j = iECLen - 1; j > 0; j-- ) { if( iM && pPoly[ j ] ) diff --git a/contrib/hbzebra/eanupc.c b/contrib/hbzebra/eanupc.c index 6b1fa9b4cb..397ede66ac 100644 --- a/contrib/hbzebra/eanupc.c +++ b/contrib/hbzebra/eanupc.c @@ -45,8 +45,6 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" /* we do not store L-code, but just to bit inversion R-code to obtain it */ @@ -60,7 +58,7 @@ static char _ean13_checksum( const char * szCode ) int i, sum = 0; for( i = 0; i < 12; i++ ) - sum += ( szCode[ i ] - '0' ) * ( i & 1 ? 3 : 1 ); + sum += ( szCode[ i ] - '0' ) * ( ( i & 1 ) ? 3 : 1 ); return '0' + ( 10000 - sum ) % 10; } @@ -69,7 +67,7 @@ static char _ean8_checksum( const char * szCode ) int i, sum = 0; for( i = 0; i < 7; i++ ) - sum += ( szCode[ i ] - '0' ) * ( i & 1 ? 1 : 3 ); + sum += ( szCode[ i ] - '0' ) * ( ( i & 1 ) ? 1 : 3 ); return '0' + ( 10000 - sum ) % 10; } @@ -78,7 +76,7 @@ static char _upca_checksum( const char * szCode ) int i, sum = 0; for( i = 0; i < 11; i++ ) - sum += ( szCode[ i ] - '0' ) * ( i & 1 ? 1 : 3 ); + sum += ( szCode[ i ] - '0' ) * ( ( i & 1 ) ? 1 : 3 ); return '0' + ( 10000 - sum ) % 10; } diff --git a/contrib/hbzebra/hbzebra.h b/contrib/hbzebra/hbzebra.h index f19098b93c..e4eb3aeef5 100644 --- a/contrib/hbzebra/hbzebra.h +++ b/contrib/hbzebra/hbzebra.h @@ -48,6 +48,9 @@ #define HB_ZEBRA_H_ #include "hbapi.h" +#include "hbapiitm.h" +#include "hbapierr.h" + #include "hbzebra.ch" typedef struct diff --git a/contrib/hbzebra/itf.c b/contrib/hbzebra/itf.c index 41373c082c..e74b2f2f9e 100644 --- a/contrib/hbzebra/itf.c +++ b/contrib/hbzebra/itf.c @@ -45,8 +45,6 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" static const char s_code[] = { 0x0C, 0x11, 0x12, 0x03, 0x14, 0x05, 0x06, 0x18, 0x09, 0x0A }; @@ -56,7 +54,7 @@ static char _itf_checksum( const char * szCode ) int i, sum = 0; for( i = 0; szCode[ i ]; i++ ) - sum += ( szCode[ i ] - '0' ) * ( i & 1 ? 1 : 3 ); + sum += ( szCode[ i ] - '0' ) * ( ( i & 1 ) ? 1 : 3 ); return '0' + ( 100000 - sum ) % 10; } @@ -77,7 +75,7 @@ PHB_ZEBRA hb_zebra_create_itf( const char * szCode, HB_SIZE nLen, int iFlags ) return pZebra; } } - if( ( iLen + ( iFlags & HB_ZEBRA_FLAG_CHECKSUM ? 1 : 0 ) ) & 1 ) + if( ( iLen + ( ( iFlags & HB_ZEBRA_FLAG_CHECKSUM ) ? 1 : 0 ) ) & 1 ) { pZebra->szCode = ( char * ) hb_xgrab( iLen + 2 ); pZebra->szCode[ 0 ] = '0'; @@ -124,11 +122,11 @@ PHB_ZEBRA hb_zebra_create_itf( const char * szCode, HB_SIZE nLen, int iFlags ) for( i = 0; szCode[ i ]; i += 2 ) { char c1 = s_code[ szCode[ i ] - '0' ], c2 = szCode[ i + 1 ] ? s_code[ szCode[ i + 1 ] - '0' ] : csum; - hb_bitbuffer_cat_int( pZebra->pBits, 31, c1 & 1 ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, c2 & 1 ? iW : iN ); c1 >>= 1; c2 >>= 1; - hb_bitbuffer_cat_int( pZebra->pBits, 31, c1 & 1 ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, c2 & 1 ? iW : iN ); c1 >>= 1; c2 >>= 1; - hb_bitbuffer_cat_int( pZebra->pBits, 31, c1 & 1 ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, c2 & 1 ? iW : iN ); c1 >>= 1; c2 >>= 1; - hb_bitbuffer_cat_int( pZebra->pBits, 31, c1 & 1 ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, c2 & 1 ? iW : iN ); c1 >>= 1; c2 >>= 1; - hb_bitbuffer_cat_int( pZebra->pBits, 31, c1 & 1 ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, c2 & 1 ? iW : iN ); + hb_bitbuffer_cat_int( pZebra->pBits, 31, ( c1 & 1 ) ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, ( c2 & 1 ) ? iW : iN ); c1 >>= 1; c2 >>= 1; + hb_bitbuffer_cat_int( pZebra->pBits, 31, ( c1 & 1 ) ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, ( c2 & 1 ) ? iW : iN ); c1 >>= 1; c2 >>= 1; + hb_bitbuffer_cat_int( pZebra->pBits, 31, ( c1 & 1 ) ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, ( c2 & 1 ) ? iW : iN ); c1 >>= 1; c2 >>= 1; + hb_bitbuffer_cat_int( pZebra->pBits, 31, ( c1 & 1 ) ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, ( c2 & 1 ) ? iW : iN ); c1 >>= 1; c2 >>= 1; + hb_bitbuffer_cat_int( pZebra->pBits, 31, ( c1 & 1 ) ? iW : iN ); hb_bitbuffer_cat_int( pZebra->pBits, 0, ( c2 & 1 ) ? iW : iN ); if( ! szCode[ i + 1 ] ) break; } diff --git a/contrib/hbzebra/msi.c b/contrib/hbzebra/msi.c index c0429db2bd..6a26cc295d 100644 --- a/contrib/hbzebra/msi.c +++ b/contrib/hbzebra/msi.c @@ -45,18 +45,16 @@ */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" static char _msi_checksum( const char * szCode ) { - int i, j = 1, k, sum = 0; + int i, j = 1, sum = 0; /* Luhn algorithm */ for( i = ( int ) strlen( szCode ) - 1; i >= 0; i-- ) { - k = ( szCode[ i ] - '0' ) * ( j ? 2 : 1 ); + int k = ( szCode[ i ] - '0' ) * ( j ? 2 : 1 ); if( k > 9 ) k -= 9; sum += k; diff --git a/contrib/hbzebra/pdf417.c b/contrib/hbzebra/pdf417.c index 51ad9b8121..3166ccfbd0 100644 --- a/contrib/hbzebra/pdf417.c +++ b/contrib/hbzebra/pdf417.c @@ -48,25 +48,23 @@ PDF417 is ISO/IEC 15438:2006 Good short PDF417 description: - http://grandzebu.net/index.php?page=/informatique/codbar-en/pdf417.htm + https://grandzebu.net/informatique/codbar-en/pdf417.htm Free PDF417 specification (in Russian): - http://protect.gost.ru/v.aspx?control=8&baseC=-1&page=0&month=-1&year=-1&search=&RegNum=1&DocOnPageCount=15&id=122345&pageK=D11DCCF9-B540-4CB2-A514-C3547043FC68 + [LOST LINK] protect.gost.ru/v.aspx?control=8&baseC=-1&page=0&month=-1&year=-1&search=&RegNum=1&DocOnPageCount=15&id=122345&pageK=D11DCCF9-B540-4CB2-A514-C3547043FC68 Online generator: - http://www.bcmaker.com/demos/pdf417.php - http://www.terryburton.co.uk/barcodewriter/generator/ + https://www.barcodetools.com/generator/index.html + https://www.terryburton.co.uk/barcodewriter/generator/ Online decoder: - http://www.datasymbol.com/barcode-recognition-sdk/barcode-reader/online-barcode-decoder.html + https://www.datasymbol.com/barcode-recognition-sdk/barcode-reader/online-barcode-decoder.html */ #include "hbzebra.h" -#include "hbapiitm.h" -#include "hbapierr.h" -#define CODE_START 0x2AFF /* 17 bit width */ -#define CODE_STOP 0x2517F /* 18 bit width */ +#define CODE_START 0x2AFF /* 17-bit width */ +#define CODE_STOP 0x2517F /* 18-bit width */ #define LATCH_TEXT 900 #define LATCH_BYTE 901 @@ -537,7 +535,7 @@ static int _pdf417_ec_size( int iLevel ) static int _pdf417_default_ec_level( int iDataSize ) { - /* http://www.idautomation.com/pdf417faq.html */ + /* https://www.idautomation.com/barcode-faq/2d/pdf417/ */ if( iDataSize <= 40 ) return 2; if( iDataSize <= 160 ) @@ -549,7 +547,7 @@ static int _pdf417_default_ec_level( int iDataSize ) static int _pdf417_width( int iColCount, int iFlags ) { - return 17 + ( iColCount + 2 ) * 17 + 18 - ( iFlags & HB_ZEBRA_FLAG_PDF417_TRUNCATED ? 34 : 0 ); + return 17 + ( iColCount + 2 ) * 17 + 18 - ( ( iFlags & HB_ZEBRA_FLAG_PDF417_TRUNCATED ) ? 34 : 0 ); } static int _pdf417_left_codeword( int iRow, int iRowCount, int iColCount, int iLevel ) @@ -1015,12 +1013,11 @@ static int _pdf417_encode_text( const char * szCode, int iLen, int * pCW, int iP static int _pdf417_encode_numeric( const char * szCode, int iLen, int * pCW, int iPos ) { - /* Some very long integer (147bit) arithmetics shoud be implemented to encode + /* Some very long integer (147-bit) arithmetics should be implemented to encode digits in an effective way. I use more simple way and encode digits in groups - not longer that 18 digits. 64bit integer arithmetics do this job */ + not longer that 18 digits. 64-bit integer arithmetics do this job */ - HB_LONGLONG ill; - int i, j, k; + int i, j; HB_TRACE( HB_TR_DEBUG, ( "encode numeric len=%d", iLen ) ); if( iLen == 0 ) @@ -1029,7 +1026,8 @@ static int _pdf417_encode_numeric( const char * szCode, int iLen, int * pCW, int i = 0; while( i < iLen ) { - k = iLen - i; + HB_LONGLONG ill; + int k = iLen - i; if( k > 18 ) k = 18; @@ -1073,8 +1071,8 @@ static int _pdf417_encode( const char * szCode, int iLen, int * pCW ) if( _pdf417_isdigit( szCode[ i ] ) ) { /* - Digit in textmode uses 0.5 CW, in numeric mode 0.3409 CW. - To save 2 CW + average remainig space in text mode we must + Digit in text mode uses 0.5 CW, in numeric mode 0.3409 CW. + To save 2 CW + average remaining space in text mode we must have 2.5 / (0.5-0.3409) = 15.71 digits */ for( j = i + 1; j < iLen && _pdf417_isdigit( szCode[ j ] ); j++ ) @@ -1196,7 +1194,7 @@ static void _pdf417_reed_solomon( int * pCW, int iLen, int iLevel ) { int * pEC; const unsigned short * coef; - int i, j, iM, iECLen; + int i, j, iECLen; iECLen = _pdf417_ec_size( iLevel ); @@ -1238,7 +1236,7 @@ static void _pdf417_reed_solomon( int * pCW, int iLen, int iLevel ) for( i = 0; i < iLen; i++ ) { - iM = ( pCW[ i ] + pEC[ iECLen - 1 ] ) % 929; + int iM = ( pCW[ i ] + pEC[ iECLen - 1 ] ) % 929; for( j = iECLen - 1; j >= 0; j-- ) { if( j ) @@ -1309,7 +1307,7 @@ PHB_ZEBRA hb_zebra_create_pdf417( const char * szCode, HB_SIZE nLen, int iFlags, for( ;; ) { iColCount = ( iDataCount + _pdf417_ec_size( iLevel ) + iRowCount - 1 ) / iRowCount; - /* w:h aspect ration is less than 2:1 for defaul 3x module height */ + /* w:h aspect ration is less than 2:1 for default 3x module height */ HB_TRACE( HB_TR_DEBUG, ( "iDataCount=%d iRowCount=%d iColCount=%d", iDataCount, iRowCount, iColCount ) ); if( ( _pdf417_width( iColCount, iFlags ) < iRowCount * 3 * 2 || iColCount == 1 ) && iColCount <= MAX_COL_COUNT && diff --git a/contrib/hbzebra/qrcode.c b/contrib/hbzebra/qrcode.c index 956f70f865..24d9243935 100644 --- a/contrib/hbzebra/qrcode.c +++ b/contrib/hbzebra/qrcode.c @@ -47,32 +47,29 @@ /* QR Code is ISO/IEC18004 - JIS-X-0510 QR Code standard in Japaneese language :) - http://sourceforge.jp/projects/qrcode/docs/qrcode_specification_ja/en/1/qrcode_specification_ja.pdf + JIS-X-0510 QR Code standard in Japanese language :) + https://osdn.jp/projects/qrcode/docs/qrcode_specification_ja/en/1/qrcode_specification_ja.pdf - http://en.wikipedia.org/wiki/QR_Code - http://www.denso-wave.com/qrcode/index-e.html - http://www.itsc.org.sg/pdf/synthesis08/Three_QR_Code.pdf - http://www.qrme.co.uk/qr-code-resources/understanding-a-qr-code.html - http://www.swetake.com/qr/index-e.html - http://www.codeproject.com/KB/cs/qrcode.aspx - http://sourceforge.jp/projects/reedsolomon - http://twit88.com/home/ - http://qrcode.sourceforge.jp/ - http://zxing.org/w/decode.jspx Online decoder + https://en.wikipedia.org/wiki/QR_Code + http://www.qrcode.com/ + https://foxdesignsstudio.com/uploads/pdf/Three_QR_Code.pdf + https://web.archive.org/web/www.qrme.co.uk/qr-code-resources/understanding-a-qr-code.html + http://www.swetake.com/qrcode/index-e.html + https://www.codeproject.com/Articles/20574/Open-Source-QRCode-Library + https://osdn.jp/projects/reedsolomon/ + https://web.archive.org/web/twit88.com/platform/projects/show/mt-qrcode + https://qrcode.osdn.jp/ + https://zxing.org/w/decode.jspx Online decoder http://blog.qr4.nl/Online-QR-Code_Decoder.aspx Online decoder (not all codes are decoded) http://www.thonky.com/qr-code-tutorial/ Tutorial - http://code.google.com/p/zxing/ Java library + https://github.com/zxing/zxing Java library http://goqr.me/ Online encode - http://www.pclviewer.com/rs2/calculator.html Reed-solomon ECC calculator - http://raidenii.net/files/datasheets/misc/qr_code.pdf + http://www.pclviewer.com/rs2/calculator.html Reed-Solomon ECC calculator + https://web.archive.org/web/raidenii.net/files/datasheets/misc/qr_code.pdf */ #include "hbzebra.h" -#include "hbapi.h" -#include "hbapiitm.h" -#include "hbapierr.h" /* #define DEBUG_CODE */ @@ -358,13 +355,13 @@ static unsigned char * s_align[ 40 ] = { #ifdef DEBUG_CODE static int _qr_check_version_table( void ) { - const QRVERSION * pQRVersion; int iV, iL; unsigned int uiSumD, uiSumE; for( iV = 1; iV <= 40; iV++ ) { - pQRVersion = &s_version[ iV - 1 ]; + const QRVERSION * pQRVersion = &s_version[ iV - 1 ]; + for( iL = 0; iL < 4; iL++ ) { uiSumE = ( unsigned int ) ( pQRVersion->level[ iL ].block[ 0 ].uiCount ) * ( pQRVersion->level[ iL ].block[ 0 ].uiECC ) + @@ -466,9 +463,9 @@ static int _qr_versionlength( int iVersion ) static int _qr_fixed( int iVersion, int iRow, int iCol ) { int iLength = _qr_versionlength( iVersion ); - unsigned char * pi, * pj; + const unsigned char * pi; - /* position detection markers and versino info */ + /* position detection markers and version info */ if( iRow < 9 && iCol < 9 ) return 1; if( iRow < 9 && iCol >= iLength - 8 ) @@ -484,7 +481,7 @@ static int _qr_fixed( int iVersion, int iRow, int iCol ) pi = s_align[ iVersion - 1 ]; for( ; *pi; pi++ ) { - pj = s_align[ iVersion - 1 ]; + const unsigned char * pj = s_align[ iVersion - 1 ]; for( ; *pj; pj++ ) { if( iRow - 2 <= ( int ) *pi && ( int ) *pi <= iRow + 2 && @@ -625,13 +622,12 @@ static int _qr_dataencode( const char * szCode, HB_SIZE nSize, PHB_BITBUFFER pDa int i, iVersion, iMode; HB_ISIZ iLen, iDataLen, m; HB_SIZE n; - char ch; /* Select encoding mode */ - iMode = 1; /* 1=Numeric, 2=Alphanumeric, 4=8-bit, 8=Kanji. Not modes: 0=termibator, 3=Structured append, 7=ECI, 5=FNC1(1), 9=FNC1(2)*/ + iMode = 1; /* 1=Numeric, 2=Alphanumeric, 4=8-bit, 8=Kanji. Not modes: 0=terminator, 3=Structured append, 7=ECI, 5=FNC1(1), 9=FNC1(2)*/ for( n = 0; n < nSize; n++ ) { - ch = szCode[ n ]; + char ch = szCode[ n ]; if( '0' <= ch && ch <= '9' ) { } @@ -733,14 +729,14 @@ static int _qr_dataencode( const char * szCode, HB_SIZE nSize, PHB_BITBUFFER pDa static void _reed_solomon_encode( unsigned char * pData, int iDataLen, unsigned char * pECC, int iECCLen, int * pPoly, int * pExp, int * pLog, int iMod ) { int i, j; - unsigned char iM; for( i = 0; i < iECCLen; i++ ) pECC[ i ] = 0; for( i = 0; i < iDataLen; i++ ) { - iM = s_rev[ pData[ i ] ] ^ pECC[ iECCLen - 1 ]; + unsigned char iM = s_rev[ pData[ i ] ] ^ pECC[ iECCLen - 1 ]; + for( j = iECCLen - 1; j > 0; j-- ) { if( iM && pPoly[ j ] ) @@ -786,7 +782,7 @@ static unsigned char * _qr_checksum( PHB_BITBUFFER pData, int iVersion, int iLev j ^= iPoly; } - /* Init Reed-Solomonn encode. Parameters: iECCLen, iIndex */ + /* Init Reed-Solomon encode. Parameters: iECCLen, iIndex */ iECCLen = pLevel->block[ 0 ].uiECC; iIndex = 0; /* why this parameter is different from DataMatrix ??? */ @@ -857,8 +853,8 @@ static unsigned char * _qr_checksum( PHB_BITBUFFER pData, int iVersion, int iLev static void _qr_draw( PHB_BITBUFFER pBits, PHB_BITBUFFER pCWBits, int iVersion ) { - int i, j, no, up, right, iLength; - unsigned char * pi, * pj; + int i, j, iLength; + const unsigned char * pi; HB_SYMBOL_UNUSED( pCWBits ); @@ -901,7 +897,7 @@ static void _qr_draw( PHB_BITBUFFER pBits, PHB_BITBUFFER pCWBits, int iVersion ) pi = s_align[ iVersion - 1 ]; for( ; *pi; pi++ ) { - pj = s_align[ iVersion - 1 ]; + const unsigned char * pj = s_align[ iVersion - 1 ]; for( ; *pj; pj++ ) { if( ( *pi > 10 && *pi < iLength - 10 ) || @@ -941,6 +937,8 @@ static void _qr_draw( PHB_BITBUFFER pBits, PHB_BITBUFFER pCWBits, int iVersion ) /* Draw data. Note: pCWBits == NULL is used only for debugging */ if( pCWBits ) { + int no, up, right; + i = j = iLength - 1; right = 1; up = 1; @@ -994,13 +992,13 @@ static void _qr_draw( PHB_BITBUFFER pBits, PHB_BITBUFFER pCWBits, int iVersion ) static int _qr_penalty( PHB_BITBUFFER pBits, int iVersion ) { int i, j, k, iPenalty = 0, iLen = _qr_versionlength( iVersion ); - HB_BOOL bBitLast, bBit; + HB_BOOL bBit; /* 1. Same color modules in row/column */ for( i = 0; i < iLen; i++ ) { /* Row */ - bBitLast = hb_bitbuffer_get( pBits, i * iLen ); + HB_BOOL bBitLast = hb_bitbuffer_get( pBits, i * iLen ); k = 1; for( j = 1; j < iLen; j++ ) { @@ -1041,8 +1039,8 @@ static int _qr_penalty( PHB_BITBUFFER pBits, int iVersion ) } /* 2. Block of same color modules */ - /* Instead of looking for non-overlapped MxN block, we can search for 2x2 overlapping blocks, */ - /* penalty value is the same for both of these methods */ + /* Instead of looking for non-overlapped MxN block, we can search for 2x2 overlapping blocks, + penalty value is the same for both of these methods */ for( i = 0; i < iLen - 1; i++ ) { for( j = 0; j < iLen - 1; j++ ) @@ -1142,10 +1140,12 @@ static void _qr_mask_pattern( PHB_BITBUFFER pBits, int iVersion, int iMask ) static int _qr_mask( PHB_BITBUFFER pBits, int iVersion ) { - int i, iPenaltyMin = 0, iMaskMin = 0, iPenalty; + int i, iPenaltyMin = 0, iMaskMin = 0; for( i = 0; i < 8; i++ ) { + int iPenalty; + _qr_mask_pattern( pBits, iVersion, i ); iPenalty = _qr_penalty( pBits, iVersion ); #ifdef DEBUG_CODE diff --git a/contrib/hbziparc/ziparc.prg b/contrib/hbziparc/ziparc.prg index 77d75bca5b..694e2a6209 100644 --- a/contrib/hbziparc/ziparc.prg +++ b/contrib/hbziparc/ziparc.prg @@ -3,12 +3,11 @@ * * Copyright 2008 Viktor Szakats (vszakats.net/harbour) * Copyright 2008 Toninho (toninhofwi yahoo.com.br) - * Copyright 2000-2001 Luiz Rafael Culik - * (original ZipArchive interface, docs) + * Copyright 2000-2001 Luiz Rafael Culik (original ZipArchive interface, docs) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or ( at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -17,15 +16,15 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA ( or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, the Harbour Project gives permission for + * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of * linking the Harbour library code into it. @@ -36,14 +35,14 @@ * This exception applies only to the code released by the Harbour * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete + * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * If you write modifications of your own for Harbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * If you do not wish that, delete this exception notice. * */ @@ -170,8 +169,8 @@ FUNCTION hb_GetFilesInZip( cFileName, lVerbose ) nRatio := 0 ENDIF - /* TOFIX: Original hbziparch has nMethod as string: Unknown, Stored, DeflatN, DeflatX, DeflatF. */ - /* TOFIX: Original hbziparch has attributes as string. */ + /* FIXME: Original hbziparch has nMethod as string: Unknown, Stored, DeflatN, DeflatX, DeflatF. */ + /* FIXME: Original hbziparch has attributes as string. */ AAdd( aFiles, { cFileName, nSize, nMethod, nCompSize, nRatio, dDate, cTime, hb_NumToHex( nCRC, 8 ), nInternalAttr /* cAttr */, lCrypted, cComment } ) ELSE AAdd( aFiles, cFileName ) diff --git a/contrib/rddads/ads.ch b/contrib/rddads/ads.ch index 9e1535aec0..06e3a24734 100644 --- a/contrib/rddads/ads.ch +++ b/contrib/rddads/ads.ch @@ -51,7 +51,7 @@ to the *latest* version you want to allow/require, as in -DADS_LIB_VERSION=500 - As of 6/7/2004, the default supports linking to v6 and v7, + As of 2004-06-07, the default supports linking to v6 and v7, as there are no v7-specific features yet. It does cover v6 data dictionary support, built-in Internet Server capabilities, etc. @@ -62,7 +62,7 @@ 2) Set this "define" when compiling rddads: -DADS_LIB_VERSION=500 -*/ + */ #ifndef ADS_CH_ #define ADS_CH_ @@ -89,10 +89,11 @@ /* For retrieving scope settings In the Harbour RDD, use TOPSCOPE and BOTTOMSCOPE as the values are - different (Top = 0, Bottom = 1) + different (Top = 0, Bottom = 1) */ +#if 0 #define ADS_TOP 1 #define ADS_BOTTOM 2 -*/ +#endif /* for calls that can optionally use filters */ #define ADS_RESPECTFILTERS 1 @@ -189,7 +190,7 @@ #define ADS_DD_TABLE_MEMO_BLOCK_SIZE 215 #define ADS_DD_TABLE_PERMISSION_LEVEL 216 -/* Field properties between 300 - 399 */ +/* Field properties between 300-399 */ #define ADS_DD_FIELD_DEFAULT_VALUE 300 #define ADS_DD_FIELD_CAN_NULL 301 #define ADS_DD_FIELD_MIN_VALUE 302 @@ -200,7 +201,7 @@ #define ADS_DD_FIELD_LENGTH 307 #define ADS_DD_FIELD_DECIMAL 308 -/* Index tag properties between 400 - 499 */ +/* Index tag properties between 400-499 */ #define ADS_DD_INDEX_FILE_NAME 400 #define ADS_DD_INDEX_EXPRESSION 401 #define ADS_DD_INDEX_CONDITION 402 @@ -238,7 +239,7 @@ #define ADS_DD_INDEX_FILE_PAGESIZE 901 /* - * Object rights properties 1001 - 1099 . They can be used + * Object rights properties 1001-1099. They can be used * with either user or user group objects. */ #define ADS_DD_TABLES_RIGHTS 1001 @@ -247,15 +248,15 @@ #define ADS_DD_OBJECTS_RIGHTS 1004 #define ADS_DD_FREE_TABLES_RIGHTS 1005 -/* User Properties 1101 - 1199 */ +/* User Properties 1101-1199 */ #define ADS_DD_USER_PASSWORD 1101 #define ADS_DD_USER_GROUP_MEMBERSHIP 1102 #define ADS_DD_USER_BAD_LOGINS 1103 -/* User group Properties 1201 - 1299 */ +/* User group Properties 1201-1299 */ /* None at this moment. */ -/* Link properties 1301 - 1399 */ +/* Link properties 1301-1399 */ #define ADS_DD_LINK_PATH 1300 #define ADS_DD_LINK_OPTIONS 1301 #define ADS_DD_LINK_USERNAME 1302 diff --git a/contrib/rddads/ads1.c b/contrib/rddads/ads1.c index f41c88e901..d6c48fc765 100644 --- a/contrib/rddads/ads1.c +++ b/contrib/rddads/ads1.c @@ -47,10 +47,10 @@ #define SUPERTABLE ( &adsSuper ) #define MAX_STR_LEN 255 +#include "rddads.h" + #include "hbvm.h" #include "hbinit.h" -#include "hbapi.h" -#include "hbapiitm.h" #include "hbapistr.h" #include "hbapierr.h" #include "hbdbferr.h" @@ -60,7 +60,6 @@ #include "hbstack.h" #include "rddsys.ch" -#include "rddads.h" static int s_iSetListenerHandle = 0; @@ -123,17 +122,15 @@ static void adsSetListener_callback( HB_set_enum setting, HB_set_listener_enum w AdsSetDecimals( ( UNSIGNED16 ) hb_setGetNI( HB_SET_DECIMALS ) ); break; -/* Possible TODO? - case HB_SET_MFILEEXT : +#if 0 /* Possible TODO? */ + case HB_SET_MFILEEXT: if( hb_setGetCPtr( HB_SET_MFILEEXT ) ) - { hb_retc( hb_setGetCPtr( HB_SET_MFILEEXT ) ); - } break; - case HB_SET_STRICTREAD : + case HB_SET_STRICTREAD: hb_retl( hb_setGetL( HB_SET_STRICTREAD ) ); break; - */ +#endif default: break; } @@ -158,11 +155,12 @@ static HB_ERRCODE commonError( ADSAREAP pArea, HB_ERRCODE errOsCode, const char * szFileName, HB_USHORT uiFlags, PHB_ITEM * pErrorPtr ) { - PHB_ITEM pError; HB_ERRCODE errCode = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { + PHB_ITEM pError; + if( pErrorPtr ) { if( ! *pErrorPtr ) @@ -225,7 +223,7 @@ static void DumpArea( ADSAREAP pArea ) /* For debugging: call this to dump ads u32RetVal = AdsGetTableAlias( pArea->hTable, pucTemp, &pusLen ); AdsGetEpoch( &pusLen ); HB_TRACE( HB_TR_ALWAYS, ( "DumpArea: \n pArea: %p hTable: %lu Alias: %s (RetVal %lu)\n Eof: %d DateFormat: %s Epoch: %d", - pArea, pArea->hTable, pucTemp, u32RetVal, pArea->area.fEof, pucFormat, pusLen ) ); + ( void * ) pArea, pArea->hTable, pucTemp, u32RetVal, pArea->area.fEof, pucFormat, pusLen ) ); pusLen = 1024; ulRetAOF = AdsGetAOF( pArea->hTable, pucTemp, &pusLen ); @@ -463,17 +461,17 @@ static void adsGetKeyItem( ADSAREAP pArea, PHB_ITEM pItem, int iKeyType, { /* TODO: ADS_RAW only partially supported. Presumed string. - ADT files can use ";" concatentation operator, which returns index key types as Raw + ADT files can use ";" concatenation operator, which returns index key types as Raw */ case ADS_RAW: - /* hack for timestamp values, we need sth better yo detect timestamp indexes */ + /* hack for timestamp values, we need something better to detect timestamp indexes */ if( pArea->iFileType == ADS_ADT && pKeyBuf[ 0 ] == 0 && ( iKeyLen == 8 || iKeyLen == 4 ) ) { - long lDate, lTime; + long lDate; lDate = HB_GET_BE_UINT32( pKeyBuf ); if( iKeyLen == 8 ) { - lTime = HB_GET_BE_UINT32( &pKeyBuf[ 4 ] ); + long lTime = HB_GET_BE_UINT32( &pKeyBuf[ 4 ] ); /* ADS stores milliseconds in raw ADT form increased by one */ if( lTime ) --lTime; @@ -556,7 +554,7 @@ static void adsScopeGet( ADSAREAP pArea, ADSHANDLE hOrder, HB_USHORT nScope, PHB UNSIGNED32 u32RetVal; UNSIGNED16 u16KeyType = 0; - HB_TRACE( HB_TR_DEBUG, ( "adsScopeGet(%p, %lu, %hu, %p)", pArea, hOrder, nScope, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsScopeGet(%p, %lu, %hu, %p)", ( void * ) pArea, hOrder, nScope, ( void * ) pItem ) ); if( hOrder ) { @@ -577,7 +575,7 @@ static void adsScopeGet( ADSAREAP pArea, ADSHANDLE hOrder, HB_USHORT nScope, PHB static HB_ERRCODE adsScopeSet( ADSAREAP pArea, ADSHANDLE hOrder, HB_USHORT nScope, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "adsScopeSet(%p, %lu, %hu, %p)", pArea, hOrder, nScope, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsScopeSet(%p, %lu, %hu, %p)", ( void * ) pArea, hOrder, nScope, ( void * ) pItem ) ); HB_SYMBOL_UNUSED( pArea ); @@ -592,7 +590,7 @@ static HB_ERRCODE adsScopeSet( ADSAREAP pArea, ADSHANDLE hOrder, HB_USHORT nScop /* make sure passed item has same type as index */ switch( u16KeyType ) { - case ADS_RAW: /* adt files need the ";" concatenation operator (instead of "+") to be optimized */ + case ADS_RAW: /* ADT files need the ";" concatenation operator (instead of "+") to be optimized */ /* ADS timestamp values */ if( HB_IS_DATETIME( pItem ) ) { @@ -766,7 +764,7 @@ HB_ERRCODE hb_adsCloseCursor( ADSAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_adsCloseCursor(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_adsCloseCursor(%p)", ( void * ) pArea ) ); pArea->hOrdCurrent = 0; if( pArea->hTable ) @@ -811,7 +809,7 @@ HB_ERRCODE hb_adsCloseCursor( ADSAREAP pArea ) static HB_ERRCODE adsBof( ADSAREAP pArea, HB_BOOL * pBof ) { - HB_TRACE( HB_TR_DEBUG, ( "adsBof(%p, %p)", pArea, pBof ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsBof(%p, %p)", ( void * ) pArea, ( void * ) pBof ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -824,7 +822,7 @@ static HB_ERRCODE adsBof( ADSAREAP pArea, HB_BOOL * pBof ) static HB_ERRCODE adsEof( ADSAREAP pArea, HB_BOOL * pEof ) { - HB_TRACE( HB_TR_DEBUG, ( "adsEof(%p, %p)", pArea, pEof ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsEof(%p, %p)", ( void * ) pArea, ( void * ) pEof ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -837,7 +835,7 @@ static HB_ERRCODE adsEof( ADSAREAP pArea, HB_BOOL * pEof ) static HB_ERRCODE adsFound( ADSAREAP pArea, HB_BOOL * pFound ) { - HB_TRACE( HB_TR_DEBUG, ( "adsFound(%p, %p)", pArea, pFound ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsFound(%p, %p)", ( void * ) pArea, ( void * ) pFound ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -852,7 +850,7 @@ static HB_ERRCODE adsGoBottom( ADSAREAP pArea ) { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsGoBottom(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGoBottom(%p)", ( void * ) pArea ) ); /* reset any pending relations */ SELF_RESETREL( pArea ); @@ -890,17 +888,16 @@ static HB_ERRCODE adsGoTo( ADSAREAP pArea, HB_ULONG ulRecNo ) UNSIGNED32 u32RetVal, u32RecNo; HB_ULONG ulRecCount; - HB_TRACE( HB_TR_DEBUG, ( "adsGoTo(%p, %lu)", pArea, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGoTo(%p, %lu)", ( void * ) pArea, ulRecNo ) ); - /* -----------------2001-07-19 15:04----------------- + /* 2001-07-19 15:04, BH The following call is a necessary workaround for ace32.dll prior to 6.1. There were bugs where AdsGotoRecord() can FAIL to move the record pointer after some sequences of setting/clearing relations. - A call to AdsGetRecordNum() before it clears the problem. -BH - --------------------------------------------------*/ - /* - * 2005-08-25 11:56:20 CEST, Druzus + A call to AdsGetRecordNum() before it clears the problem. */ + + /* 2005-08-25 11:56:20 CEST, Druzus * This trick force to resolving pending relations. It means * that this ADS clients does not reset pending relation in * AdsGotoRecord() and it is resolved later. Similar situation @@ -915,10 +912,8 @@ static HB_ERRCODE adsGoTo( ADSAREAP pArea, HB_ULONG ulRecNo ) /* force to reset ACE pending relations by resolving them */ AdsGetRecordNum( pArea->hTable, ADS_IGNOREFILTERS, &u32RecNo ); - /* - * always make GOTO - it's necessary to sync children inside ACE - * internals - */ + /* always make GOTO - it's necessary to sync children inside ACE + internals */ u32RetVal = AdsGotoRecord( pArea->hTable, ( UNSIGNED32 ) ulRecNo ); if( u32RetVal == AE_INVALID_RECORD_NUMBER ) @@ -952,7 +947,7 @@ static HB_ERRCODE adsGoTo( ADSAREAP pArea, HB_ULONG ulRecNo ) { /* set our record number value */ SELF_RECCOUNT( &pArea->area, &ulRecCount ); - /* eliminate posible race condition in this operation */ + /* eliminate possible race condition in this operation */ if( ulRecNo != 0 && ulRecNo <= ulRecCount ) pArea->ulRecNo = ulRecNo; else @@ -973,13 +968,11 @@ static HB_ERRCODE adsGoTo( ADSAREAP pArea, HB_ULONG ulRecNo ) static HB_ERRCODE adsGoToId( ADSAREAP pArea, PHB_ITEM pItem ) { - HB_ULONG ulRecNo; - - HB_TRACE( HB_TR_DEBUG, ( "adsGoToId(%p, %p)", pArea, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGoToId(%p, %p)", ( void * ) pArea, ( void * ) pItem ) ); if( HB_IS_NUMERIC( pItem ) ) { - ulRecNo = hb_itemGetNL( pItem ); + HB_ULONG ulRecNo = hb_itemGetNL( pItem ); return SELF_GOTO( &pArea->area, ulRecNo ); } else @@ -993,7 +986,7 @@ static HB_ERRCODE adsGoTop( ADSAREAP pArea ) { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsGoTop(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGoTop(%p)", ( void * ) pArea ) ); /* reset any pending relations */ SELF_RESETREL( pArea ); @@ -1029,7 +1022,7 @@ static HB_ERRCODE adsSeek( ADSAREAP pArea, HB_BOOL bSoftSeek, PHB_ITEM pKey, HB_ UNSIGNED8 * pszKeyFree = NULL; #endif - HB_TRACE( HB_TR_DEBUG, ( "adsSeek(%p, %d, %p, %d)", pArea, bSoftSeek, pKey, bFindLast ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsSeek(%p, %d, %p, %d)", ( void * ) pArea, bSoftSeek, ( void * ) pKey, bFindLast ) ); if( ! pArea->hOrdCurrent ) { @@ -1157,11 +1150,11 @@ static HB_ERRCODE adsSeek( ADSAREAP pArea, HB_BOOL bSoftSeek, PHB_ITEM pKey, HB_ if( pArea->area.lpdbRelations ) SELF_SYNCCHILDREN( &pArea->area ); - /* ----------------- BH ------------------ + /* BH: If a filter is set that is not valid for ADS, we need to skip - off of any invalid records (IOW, filter at the Harbour level if ADS can't + off of any invalid records (IOW, filter at the Harbour level if ADS cannot because the filter has UDFs or PUBLICVAR references). - To make sure the skipped-to record still matches the seeked key, we need to + To make sure the skipped-to record still matches the seek-ed key, we need to be able to construct a comparable key for the subsequent record. This is annoyingly complex with the various ads key types for various table types. AdsExtractKey would seem to be the api of choice, but here on the starting end the @@ -1169,8 +1162,7 @@ static HB_ERRCODE adsSeek( ADSAREAP pArea, HB_BOOL bSoftSeek, PHB_ITEM pKey, HB_ So I'm saving off the first found record's key, and passing that to our adsIndexKeyCmp() to compare to the new record's key. We're relying on testing to verify that partial key searches and binary - raw keys all end up working right. - --------------------------------------------------*/ + raw keys all end up working right. */ if( pArea->area.dbfi.itmCobExpr && ! pArea->area.dbfi.fOptimized && ! pArea->area.fEof ) { /* Remember FOUND flag for updating after SKIPFILTER() */ @@ -1270,30 +1262,27 @@ static HB_ERRCODE adsSkip( ADSAREAP pArea, HB_LONG lToSkip ) { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsSkip(%p, %ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsSkip(%p, %ld)", ( void * ) pArea, lToSkip ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) SELF_FORCEREL( &pArea->area ); -/* ----------------- Brian Hays ------------------ + /* Brian Hays: - In ADS, if you GO 0 (as opposed to skipping past lastrec), - it considers the record pointer "unpositioned". - If you then try to skip -1 you end up at Top with BOF True. - (If you skip past lastrec, then skip -1 it works right.) - To fix this we need to trap for a (negative lToSkip .AND. EOF) - and do a GoBottom--but only after letting ads try first and - testing for BOF. We need to avoid our GoBottom hack as much as - possible because with a filter set it could be quite slow. - - In addition, if lToSkip > 1 we need to iterate calls to AdsSkip(1) and - test the filter each time since, even if the server has a filter set, - AdsSkip(5) may only test the filter after 5 raw skips (according to the - Extended Systems developers.) - - --------------------------------------------------*/ + In ADS, if you GO 0 (as opposed to skipping past lastrec), + it considers the record pointer "unpositioned". + If you then try to skip -1 you end up at Top with BOF True. + (If you skip past lastrec, then skip -1 it works right.) + To fix this we need to trap for a (negative lToSkip .AND. EOF) + and do a GoBottom--but only after letting ads try first and + testing for BOF. We need to avoid our GoBottom hack as much as + possible because with a filter set it could be quite slow. + In addition, if lToSkip > 1 we need to iterate calls to AdsSkip(1) and + test the filter each time since, even if the server has a filter set, + AdsSkip(5) may only test the filter after 5 raw skips (according to the + Extended Systems developers.) */ if( lToSkip == 0 ) { @@ -1409,7 +1398,7 @@ static HB_ERRCODE adsSkipFilter( ADSAREAP pArea, HB_LONG lUpDown ) HB_BOOL fBottom; HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "adsSkipFilter(%p, %ld)", pArea, lUpDown ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsSkipFilter(%p, %ld)", ( void * ) pArea, lUpDown ) ); lUpDown = ( lUpDown < 0 ? -1 : 1 ); @@ -1483,7 +1472,7 @@ static HB_ERRCODE adsAppend( ADSAREAP pArea, HB_BOOL fUnLockAll ) { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsAppend(%p, %d)", pArea, ( int ) fUnLockAll ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsAppend(%p, %d)", ( void * ) pArea, ( int ) fUnLockAll ) ); /* reset any pending relations */ SELF_RESETREL( pArea ); @@ -1536,14 +1525,12 @@ static HB_ERRCODE adsAppend( ADSAREAP pArea, HB_BOOL fUnLockAll ) static HB_ERRCODE adsCreateFields( ADSAREAP pArea, PHB_ITEM pStruct ) { - HB_USHORT uiItems, uiCount, uiLen, uiDec; + HB_USHORT uiItems, uiCount; HB_ERRCODE errCode = HB_SUCCESS; DBFIELDINFO dbFieldInfo; - PHB_ITEM pFieldDesc; - const char * szFieldType, * szType; - int iData, iNameLen; + const char * szType; - HB_TRACE( HB_TR_DEBUG, ( "adsCreateFields(%p, %p)", pArea, pStruct ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsCreateFields(%p, %p)", ( void * ) pArea, ( void * ) pStruct ) ); uiItems = ( HB_USHORT ) hb_arrayLen( pStruct ); SELF_SETFIELDEXTENT( &pArea->area, uiItems ); @@ -1552,6 +1539,11 @@ static HB_ERRCODE adsCreateFields( ADSAREAP pArea, PHB_ITEM pStruct ) for( uiCount = 0; uiCount < uiItems; uiCount++ ) { + HB_USHORT uiLen, uiDec; + PHB_ITEM pFieldDesc; + const char * szFieldType; + int iData, iNameLen; + dbFieldInfo.uiTypeExtended = 0; pFieldDesc = hb_arrayGetItemPtr( pStruct, uiCount + 1 ); dbFieldInfo.atomName = hb_arrayGetCPtr( pFieldDesc, DBS_NAME ); @@ -2006,7 +1998,7 @@ static HB_ERRCODE adsDeleteRec( ADSAREAP pArea ) { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsDeleteRec(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsDeleteRec(%p)", ( void * ) pArea ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -2028,7 +2020,7 @@ static HB_ERRCODE adsDeleteRec( ADSAREAP pArea ) static HB_ERRCODE adsDeleted( ADSAREAP pArea, HB_BOOL * pDeleted ) { - HB_TRACE( HB_TR_DEBUG, ( "adsDeleted(%p, %p)", pArea, pDeleted ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsDeleted(%p, %p)", ( void * ) pArea, ( void * ) pDeleted ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -2036,7 +2028,7 @@ static HB_ERRCODE adsDeleted( ADSAREAP pArea, HB_BOOL * pDeleted ) if( ! pArea->fPositioned ) { - /* AdsIsRecordDeleted has error AE_NO_CURRENT_RECORD at eof; avoid server call */ + /* AdsIsRecordDeleted() has error AE_NO_CURRENT_RECORD at EOF; avoid server call */ *pDeleted = HB_FALSE; } else @@ -2056,7 +2048,7 @@ static HB_ERRCODE adsFieldCount( ADSAREAP pArea, HB_USHORT * uiFields ) { UNSIGNED16 u16Fields; - HB_TRACE( HB_TR_DEBUG, ( "adsFieldCount(%p, %p)", pArea, uiFields ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsFieldCount(%p, %p)", ( void * ) pArea, ( void * ) uiFields ) ); AdsGetNumFields( pArea->hTable, &u16Fields ); *uiFields = u16Fields; @@ -2068,7 +2060,7 @@ static HB_ERRCODE adsFieldCount( ADSAREAP pArea, HB_USHORT * uiFields ) static HB_ERRCODE adsFieldInfo( ADSAREAP pArea, HB_USHORT uiIndex, HB_USHORT uiType, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "adsFieldInfo(%p, %hu, %hu, %p)", pArea, uiIndex, uiType, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsFieldInfo(%p, %hu, %hu, %p)", ( void * ) pArea, uiIndex, uiType, ( void * ) pItem ) ); if( uiIndex > pArea->area.uiFieldCount ) return HB_FAILURE; @@ -2097,15 +2089,15 @@ static HB_ERRCODE adsFieldInfo( ADSAREAP pArea, HB_USHORT uiIndex, HB_USHORT uiT hb_itemPutL( pItem, u16Null != 0 ); break; } -#if ADS_LIB_VERSION >= 710 case DBS_TYPE: +#if ADS_LIB_VERSION >= 710 if( pArea->area.lpFields[ uiIndex - 1 ].uiTypeExtended == ADS_CISTRING ) { hb_itemPutC( pItem, "CICHARACTER" ); break; } - /* fallthrough */ #endif + /* fallthrough */ default: return SUPER_FIELDINFO( &pArea->area, uiIndex, uiType, pItem ); } @@ -2114,7 +2106,7 @@ static HB_ERRCODE adsFieldInfo( ADSAREAP pArea, HB_USHORT uiIndex, HB_USHORT uiT static HB_ERRCODE adsFieldName( ADSAREAP pArea, HB_USHORT uiIndex, void * szName ) { - HB_TRACE( HB_TR_DEBUG, ( "adsFieldName(%p, %hu, %p)", pArea, uiIndex, szName ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsFieldName(%p, %hu, %p)", ( void * ) pArea, uiIndex, szName ) ); if( uiIndex <= pArea->area.uiFieldCount ) { @@ -2130,7 +2122,7 @@ static HB_ERRCODE adsFieldName( ADSAREAP pArea, HB_USHORT uiIndex, void * szName static HB_ERRCODE adsFlush( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsFlush(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsFlush(%p)", ( void * ) pArea ) ); /* This function should flush current record buffer if hot and send to OS request to flush its file buffers to disk, so as well as @@ -2157,7 +2149,7 @@ static HB_ERRCODE adsGetRec( ADSAREAP pArea, HB_BYTE ** pBuffer ) { UNSIGNED32 u32Len = ( UNSIGNED32 ) pArea->ulRecordLen, u32Result; - HB_TRACE( HB_TR_DEBUG, ( "adsGetRec(%p, %p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGetRec(%p, %p)", ( void * ) pArea, ( void * ) pBuffer ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -2182,7 +2174,7 @@ static HB_ERRCODE adsGetValue( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem UNSIGNED32 u32Length; UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsGetValue(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGetValue(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( ! uiIndex || uiIndex > pArea->area.uiFieldCount ) return HB_FAILURE; @@ -2539,7 +2531,7 @@ static HB_ERRCODE adsGetValue( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem { if( pArea->fPositioned ) { - /* It should not happen - sth desynchronize WA with ADS, + /* It should not happen - something desynchronize WA with ADS, update area flags, Druzus */ hb_adsUpdateAreaFlags( pArea ); } @@ -2560,7 +2552,7 @@ static HB_ERRCODE adsGetVarLen( ADSAREAP pArea, HB_USHORT uiIndex, HB_ULONG * ul { LPFIELD pField; - HB_TRACE( HB_TR_DEBUG, ( "adsGetVarLen(%p, %hu, %p)", pArea, uiIndex, ulLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGetVarLen(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) ulLen ) ); if( uiIndex > pArea->area.uiFieldCount ) return HB_FAILURE; @@ -2578,7 +2570,7 @@ static HB_ERRCODE adsGetVarLen( ADSAREAP pArea, HB_USHORT uiIndex, HB_ULONG * ul *ulLen = 0; else if( AdsGetMemoLength( pArea->hTable, ADSFIELD( uiIndex ), &u32Len ) != AE_SUCCESS ) { - /* It should not happen - sth desynchronize WA with ADS, + /* It should not happen - something desynchronize WA with ADS, update area flags, Druzus */ hb_adsUpdateAreaFlags( pArea ); *ulLen = 0; @@ -2601,7 +2593,7 @@ static HB_ERRCODE adsGetVarLen( ADSAREAP pArea, HB_USHORT uiIndex, HB_ULONG * ul static HB_ERRCODE adsGoCold( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsGoCold(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGoCold(%p)", ( void * ) pArea ) ); if( ! pArea->fReadonly ) AdsWriteRecord( pArea->hTable ); @@ -2615,7 +2607,7 @@ static HB_ERRCODE adsPutRec( ADSAREAP pArea, const HB_BYTE * pBuffer ) { UNSIGNED32 u32Len = ( UNSIGNED32 ) pArea->ulRecordLen, u32Result; - HB_TRACE( HB_TR_DEBUG, ( "adsGetRec(%p, %p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGetRec(%p, %p)", ( void * ) pArea, ( const void * ) pBuffer ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -2644,12 +2636,12 @@ static HB_ERRCODE adsPutValue( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem HB_BOOL bTypeError = HB_TRUE; UNSIGNED32 u32RetVal = 0; - HB_TRACE( HB_TR_DEBUG, ( "adsPutValue(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsPutValue(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( ! uiIndex || uiIndex > pArea->area.uiFieldCount ) return HB_FAILURE; - /* -----------------2003-10-30 15:54----------------- + /* 2003-10-30 15:54 ADS has Implicit Record locking that can mask programming errors. Implicit locking can occur the first time a value is written to a @@ -2664,9 +2656,8 @@ static HB_ERRCODE adsPutValue( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem For performance reasons, Release code should leave this OFF. Although the call to AdsIsRecordLocked is documented as a client call, not a server request, and should be fast, it will be - called for EACH FIELD as it is assigned a value. + called for EACH FIELD as it is assigned a value. */ - --------------------------------------------------*/ /* resolve any pending relations */ if( pArea->lpdbPendingRel ) SELF_FORCEREL( &pArea->area ); @@ -2755,7 +2746,7 @@ static HB_ERRCODE adsPutValue( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem { bTypeError = HB_FALSE; u32RetVal = AdsSetLongLong( pArea->hTable, ADSFIELD( uiIndex ), hb_itemGetNInt( pItem ) ); - /* write to autoincrement field will gen error 5066 */ + /* write to auto-increment field will generate error 5066 */ } break; #endif @@ -2767,7 +2758,7 @@ static HB_ERRCODE adsPutValue( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem { bTypeError = HB_FALSE; u32RetVal = AdsSetDouble( pArea->hTable, ADSFIELD( uiIndex ), hb_itemGetND( pItem ) ); - /* write to autoincrement field will gen error 5066 + /* write to auto-increment field will generate error 5066 #if HB_TR_LEVEL >= HB_TR_DEBUG if( pField->uiTypeExtended == ADS_AUTOINC ) HB_TRACE( HB_TR_INFO, ( "adsPutValue() error" ) ); @@ -2795,7 +2786,7 @@ static HB_ERRCODE adsPutValue( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem { long lDate = hb_itemGetDL( pItem ); - /* ADS does not support dates before 0001-01-01. It generates corructed + /* ADS does not support dates before 0001-01-01. It generates corrupted DBF records and fires ADS error 5095 on FieldGet() later. [Mindaugas] */ if( pField->uiLen != 4 && lDate < 1721426 ) /* 1721426 ~= 0001-01-01 */ lDate = 0; @@ -2823,11 +2814,11 @@ static HB_ERRCODE adsPutValue( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem nLen = hb_itemGetCLen( pItem ); /* ToninhoFwi - 2006-12-09 - In the previous code nLen was limited to 0xFFFF - so, I comment it, because ADS support up to 4Gb in memo/binary/image fields. + so, I comment it, because ADS support up to 4 GiB in memo/binary/image fields. Advantage documentations says that we need use AdsSetBinary in binary/image fields. I tested these special fields with AdsSetString() and it works, but is a little bit slower to save big image file in the fields, so I keep - AdsSetString() only for commom memo fields and AdsSetBinary() for the others. + AdsSetString() only for common memo fields and AdsSetBinary() for the others. */ if( pField->uiTypeExtended == ADS_BINARY || pField->uiTypeExtended == ADS_IMAGE ) { @@ -2897,7 +2888,7 @@ static HB_ERRCODE adsRecall( ADSAREAP pArea ) { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsRecall(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsRecall(%p)", ( void * ) pArea ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -2921,7 +2912,7 @@ static HB_ERRCODE adsRecCount( ADSAREAP pArea, HB_ULONG * pRecCount ) { UNSIGNED32 u32RecCount = 0, u32Result; - HB_TRACE( HB_TR_DEBUG, ( "adsRecCount(%p, %p)", pArea, pRecCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsRecCount(%p, %p)", ( void * ) pArea, ( void * ) pRecCount ) ); u32Result = AdsGetRecordCount( pArea->hTable, ADS_IGNOREFILTERS | ADS_REFRESHCOUNT, &u32RecCount ); *pRecCount = ( HB_ULONG ) u32RecCount; @@ -2934,7 +2925,7 @@ static HB_ERRCODE adsRecInfo( ADSAREAP pArea, PHB_ITEM pRecID, HB_USHORT uiInfoT HB_ULONG ulRecNo = hb_itemGetNL( pRecID ); HB_ERRCODE uiRetVal = HB_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "adsRecInfo(%p, %p, %hu, %p)", pArea, pRecID, uiInfoType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsRecInfo(%p, %p, %hu, %p)", ( void * ) pArea, ( void * ) pRecID, uiInfoType, ( void * ) pInfo ) ); switch( uiInfoType ) { @@ -2997,7 +2988,7 @@ static HB_ERRCODE adsRecNo( ADSAREAP pArea, HB_ULONG * ulRecNo ) { UNSIGNED32 u32RecNo, u32Result; - HB_TRACE( HB_TR_DEBUG, ( "adsRecNo(%p, %p)", pArea, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsRecNo(%p, %p)", ( void * ) pArea, ( void * ) ulRecNo ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -3017,7 +3008,7 @@ static HB_ERRCODE adsRecId( ADSAREAP pArea, PHB_ITEM pRecNo ) HB_ERRCODE errCode; HB_ULONG ulRecNo; - HB_TRACE( HB_TR_DEBUG, ( "adsRecId(%p, %p)", pArea, pRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsRecId(%p, %p)", ( void * ) pArea, ( void * ) pRecNo ) ); errCode = SELF_RECNO( &pArea->area, &ulRecNo ); hb_itemPutNL( pRecNo, ulRecNo ); @@ -3029,7 +3020,7 @@ static HB_ERRCODE adsRecId( ADSAREAP pArea, PHB_ITEM pRecNo ) static HB_ERRCODE adsClose( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsClose(%p)", ( void * ) pArea ) ); if( pArea->szQuery ) { @@ -3047,10 +3038,9 @@ static HB_ERRCODE adsCreate( ADSAREAP pArea, LPDBOPENINFO pCreateInfo ) char szBuffer[ MAX_STR_LEN + 1 ]; HB_USHORT uiCount; LPFIELD pField; - const char * cType; HB_BOOL fUnicode; - HB_TRACE( HB_TR_DEBUG, ( "adsCreate(%p, %p)", pArea, pCreateInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsCreate(%p, %p)", ( void * ) pArea, ( void * ) pCreateInfo ) ); hConnection = HB_ADS_DEFCONNECTION( pCreateInfo->ulConnection, pCreateInfo->abName ); @@ -3084,6 +3074,8 @@ static HB_ERRCODE adsCreate( ADSAREAP pArea, LPDBOPENINFO pCreateInfo ) pField = pArea->area.lpFields; for( uiCount = 0; uiCount < pArea->area.uiFieldCount; uiCount++ ) { + const char * cType; + if( ( HB_ULONG ) pField->uiLen > pArea->maxFieldLen ) pArea->maxFieldLen = pField->uiLen; @@ -3307,7 +3299,7 @@ static HB_ERRCODE adsInfo( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { UNSIGNED32 uRetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsInfo(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsInfo(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); switch( uiIndex ) { @@ -3444,7 +3436,7 @@ static HB_ERRCODE adsInfo( ADSAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) case DBI_MEMOBLOCKSIZE: /* Blocksize in memo files */ break; - /* use workarea.c implmentation */ + /* use workarea.c implementation */ default: return SUPER_INFO( &pArea->area, uiIndex, pItem ); } @@ -3455,7 +3447,7 @@ static HB_ERRCODE adsNewArea( ADSAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "adsNewArea(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsNewArea(%p)", ( void * ) pArea ) ); errCode = SUPER_NEW( &pArea->area ); if( errCode == HB_SUCCESS ) @@ -3503,7 +3495,7 @@ static HB_ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo ) const char * szFile; HB_BOOL fDictionary = HB_FALSE, fUnicode = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "adsOpen(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOpen(%p)", ( void * ) pArea ) ); hConnection = HB_ADS_DEFCONNECTION( pOpenInfo->ulConnection, pOpenInfo->abName ); u32RetVal = AdsGetHandleType( hConnection, &usType); @@ -3523,7 +3515,7 @@ static HB_ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo ) if( pArea->hTable != 0 ) { /* - * table was open by ADSEXECUTESQL[DIRECT]() function + * table was open by AdsExecuteSQL[Direct]() function * I do not like the way it was implemented but I also * do not have time to change it so I simply restored this * functionality, Druzus. @@ -3531,10 +3523,10 @@ static HB_ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo ) hTable = pArea->hTable; hStatement = pArea->hStatement; } - else if( szFile && ( ( hb_strnicmp( szFile, "SELECT ", 7 ) == 0 ) || + else if( szFile && ( ( hb_strnicmp( szFile, "SELECT ", 7 ) == 0 ) || ( hb_strnicmp( szFile, "SQL:", 4 ) == 0 ) ) ) { - if( hb_strnicmp( szFile, "SQL:", 4 ) == 0 ) + if( hb_strnicmp( szFile, "SQL:", 4 ) == 0 ) szFile += 4; pArea->szQuery = hb_strdup( szFile ); @@ -3864,7 +3856,7 @@ static HB_ERRCODE adsSysName( ADSAREAP pArea, HB_BYTE * pBuffer ) UNSIGNED16 u16TableType; UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsSysName(%p, %p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsSysName(%p, %p)", ( void * ) pArea, ( void * ) pBuffer ) ); if( pArea->hTable ) { @@ -3903,7 +3895,7 @@ static HB_ERRCODE adsSysName( ADSAREAP pArea, HB_BYTE * pBuffer ) static HB_ERRCODE adsPack( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsPack(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsPack(%p)", ( void * ) pArea ) ); if( pArea->fReadonly ) { @@ -3928,7 +3920,7 @@ static HB_ERRCODE adsPack( ADSAREAP pArea ) static HB_ERRCODE adsZap( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsZap(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsZap(%p)", ( void * ) pArea ) ); if( pArea->fReadonly ) { @@ -3950,7 +3942,7 @@ static HB_ERRCODE adsChildEnd( ADSAREAP pArea, LPDBRELINFO pRelInfo ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "adsChildEnd(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsChildEnd(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( pArea->lpdbPendingRel == pRelInfo ) errCode = SELF_FORCEREL( &pArea->area ); @@ -3964,7 +3956,7 @@ static HB_ERRCODE adsChildEnd( ADSAREAP pArea, LPDBRELINFO pRelInfo ) static HB_ERRCODE adsChildStart( ADSAREAP pArea, LPDBRELINFO pRelInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "adsChildStart(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsChildStart(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); SELF_CHILDSYNC( &pArea->area, pRelInfo ); @@ -3973,7 +3965,7 @@ static HB_ERRCODE adsChildStart( ADSAREAP pArea, LPDBRELINFO pRelInfo ) static HB_ERRCODE adsChildSync( ADSAREAP pArea, LPDBRELINFO pRelInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "adsChildSync(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsChildSync(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); pArea->lpdbPendingRel = pRelInfo; @@ -3987,7 +3979,7 @@ static HB_ERRCODE adsChildSync( ADSAREAP pArea, LPDBRELINFO pRelInfo ) static HB_ERRCODE adsClearRel( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsClearRel(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsClearRel(%p)", ( void * ) pArea ) ); SUPER_CLEARREL( &pArea->area ); AdsClearRelation( pArea->hTable ); @@ -3997,7 +3989,7 @@ static HB_ERRCODE adsClearRel( ADSAREAP pArea ) static HB_ERRCODE adsForceRel( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsForceRel(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsForceRel(%p)", ( void * ) pArea ) ); if( pArea->lpdbPendingRel ) { @@ -4024,7 +4016,7 @@ static HB_ERRCODE adsSetRel( ADSAREAP pArea, LPDBRELINFO lpdbRelations ) UNSIGNED32 u32RetVal = ( UNSIGNED32 ) ~AE_SUCCESS; UNSIGNED8 * szExp; - HB_TRACE( HB_TR_DEBUG, ( "adsSetRel(%p, %p)", pArea, lpdbRelations ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsSetRel(%p, %p)", ( void * ) pArea, ( void * ) lpdbRelations ) ); szExp = ( UNSIGNED8 * ) HB_UNCONST( hb_itemGetCPtr( lpdbRelations->abKey ) ); if( *szExp && adsGetRddType( lpdbRelations->lpaChild->rddID ) >= 0 ) @@ -4050,7 +4042,7 @@ static HB_ERRCODE adsOrderListAdd( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) UNSIGNED16 u16ArrayLen = 256; UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsOrderListAdd(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOrderListAdd(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); u32RetVal = AdsOpenIndex( pArea->hTable, ( UNSIGNED8 * ) HB_UNCONST( hb_itemGetCPtr( pOrderInfo->atomBagName ) ), @@ -4075,7 +4067,7 @@ static HB_ERRCODE adsOrderListAdd( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) static HB_ERRCODE adsOrderListClear( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsOrderListClear(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOrderListClear(%p)", ( void * ) pArea ) ); #if ADS_LIB_VERSION >= 610 if( ! pArea->fReadonly ) @@ -4090,7 +4082,7 @@ static HB_ERRCODE adsOrderListClear( ADSAREAP pArea ) static HB_ERRCODE adsOrderListDelete( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "adsOrderListDelete(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOrderListDelete(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( hb_itemGetCLen( pOrderInfo->atomBagName ) > 0 ) { @@ -4121,7 +4113,7 @@ static HB_ERRCODE adsOrderListFocus( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) UNSIGNED16 u16Len = ADS_MAX_TAG_NAME + 1, u16Order; UNSIGNED32 u32RetVal = AE_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "adsOrderListFocus(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOrderListFocus(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( ! pArea->hOrdCurrent ) { @@ -4138,7 +4130,7 @@ static HB_ERRCODE adsOrderListFocus( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) { if( HB_IS_STRING( pOrderInfo->itmOrder ) ) { - /* ADS can't handle a space-padded string--we have to trim it */ + /* ADS cannot handle a space-padded string--we have to trim it */ hb_strncpyUpperTrim( ( char * ) pucTagName, hb_itemGetCPtr( pOrderInfo->itmOrder ), sizeof( pucTagName ) - 1 ); @@ -4164,7 +4156,7 @@ static HB_ERRCODE adsOrderListFocus( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) if( u32RetVal != AE_SUCCESS ) { - /* ntx compatibilty: keep current order if failed */ + /* NTX compatibility: keep current order if failed */ if( pArea->iFileType == ADS_NTX ) return HB_SUCCESS; @@ -4178,7 +4170,7 @@ static HB_ERRCODE adsOrderListFocus( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) static HB_ERRCODE adsOrderListRebuild( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsOrderListRebuild(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOrderListRebuild(%p)", ( void * ) pArea ) ); AdsReindex( pArea->hTable ); @@ -4199,7 +4191,7 @@ static HB_ERRCODE adsOrderCreate( ADSAREAP pArea, LPDBORDERCREATEINFO pOrderInfo UNSIGNED16 u16Len = ADS_MAX_KEY_LENGTH; HB_BOOL fClose = HB_TRUE; - HB_TRACE( HB_TR_DEBUG, ( "adsOrderCreate(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOrderCreate(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -4338,7 +4330,7 @@ static HB_ERRCODE adsOrderDestroy( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) ADSHANDLE hIndex; UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsOrderDestroy(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOrderDestroy(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( HB_IS_STRING( pOrderInfo->itmOrder ) ) { @@ -4375,7 +4367,7 @@ static HB_ERRCODE adsOrderInfo( ADSAREAP pArea, HB_USHORT uiIndex, LPDBORDERINFO UNSIGNED32 u32 = 0; UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsOrderInfo(%p, %hu, %p)", pArea, uiIndex, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsOrderInfo(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pOrderInfo ) ); aucBuffer[ 0 ] = 0; @@ -4502,11 +4494,9 @@ static HB_ERRCODE adsOrderInfo( ADSAREAP pArea, HB_USHORT uiIndex, LPDBORDERINFO case DBOI_KEYVAL: if( ! pArea->area.fEof && hIndex ) { - /* ---------------------------------- - From ads docs: It is important to note that the key generated + /* From ads docs: It is important to note that the key generated by this function is built on the client, and the key may not - exist in the index. - -----------------------------------*/ + exist in the index. */ AdsExtractKey( hIndex, aucBuffer, &u16len ); AdsGetKeyType( hIndex, &u16 ); @@ -4874,7 +4864,7 @@ static HB_ERRCODE adsOrderInfo( ADSAREAP pArea, HB_USHORT uiIndex, LPDBORDERINFO static HB_ERRCODE adsClearFilter( ADSAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "adsClearFilter(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsClearFilter(%p)", ( void * ) pArea ) ); /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -4899,13 +4889,12 @@ static HB_ERRCODE adsClearFilter( ADSAREAP pArea ) static HB_ERRCODE adsSetFilter( ADSAREAP pArea, LPDBFILTERINFO pFilterInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "adsSetFilter(%p, %p)", pArea, pFilterInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsSetFilter(%p, %p)", ( void * ) pArea, ( void * ) pFilterInfo ) ); - /* ----------------- NOTE: ------------------ + /* NOTE: See if the server can evaluate the filter. If not, don't pass it to the server; let the super level - filter the records locally. - --------------------------------------------------*/ + filter the records locally. */ /* resolve any pending relations */ if( pArea->lpdbPendingRel ) @@ -4960,7 +4949,7 @@ static HB_ERRCODE adsRawLock( ADSAREAP pArea, HB_USHORT uiAction, HB_ULONG ulRec { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsRawLock(%p, %hu, %lu)", pArea, uiAction, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsRawLock(%p, %hu, %lu)", ( void * ) pArea, uiAction, ulRecNo ) ); switch( uiAction ) { @@ -5028,7 +5017,7 @@ static HB_ERRCODE adsLock( ADSAREAP pArea, LPDBLOCKINFO pLockInfo ) HB_USHORT uiAction; HB_ULONG ulRecNo; - HB_TRACE( HB_TR_DEBUG, ( "adsLock(%p, %p)", pArea, pLockInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsLock(%p, %p)", ( void * ) pArea, ( void * ) pLockInfo ) ); ulRecNo = ( HB_ULONG ) hb_itemGetNL( pLockInfo->itmRecID ); @@ -5071,7 +5060,7 @@ static HB_ERRCODE adsUnLock( ADSAREAP pArea, PHB_ITEM pRecNo ) { HB_ULONG ulRecNo; - HB_TRACE( HB_TR_DEBUG, ( "adsUnLock(%p, %p)", pArea, pRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsUnLock(%p, %p)", ( void * ) pArea, ( void * ) pRecNo ) ); ulRecNo = hb_itemGetNL( pRecNo ); @@ -5086,7 +5075,7 @@ static HB_ERRCODE adsGetValueFile( ADSAREAP pArea, HB_USHORT uiIndex, const char { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsGetValueFile(%p, %hu, %s, %hu)", pArea, uiIndex, szFile, uiMode ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsGetValueFile(%p, %hu, %s, %hu)", ( void * ) pArea, uiIndex, szFile, uiMode ) ); HB_SYMBOL_UNUSED( uiMode ); @@ -5116,7 +5105,7 @@ static HB_ERRCODE adsPutValueFile( ADSAREAP pArea, HB_USHORT uiIndex, const char { UNSIGNED32 u32RetVal; - HB_TRACE( HB_TR_DEBUG, ( "adsPutValueFile(%p, %hu, %s, %hu)", pArea, uiIndex, szFile, uiMode ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsPutValueFile(%p, %hu, %s, %hu)", ( void * ) pArea, uiIndex, szFile, uiMode ) ); if( ! uiIndex || uiIndex > pArea->area.uiFieldCount ) return HB_FAILURE; @@ -5161,7 +5150,7 @@ static HB_ERRCODE adsDrop( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pItemIn PHB_FNAME pFileName; HB_BOOL fTable = HB_FALSE, fResult = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "adsDrop(%p, %p, %p, %lu)", pRDD, pItemTable, pItemIndex, ulConnect ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsDrop(%p, %p, %p, %lu)", ( void * ) pRDD, ( void * ) pItemTable, ( void * ) pItemIndex, ulConnect ) ); szFile = hb_itemGetCPtr( pItemIndex ); if( ! szFile[ 0 ] ) @@ -5185,7 +5174,7 @@ static HB_ERRCODE adsDrop( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pItemIn hb_fsFNameMerge( szFileName, pFileName ); hb_xfree( pFileName ); - /* Use hb_spFile first to locate table which can be in differ path */ + /* Use hb_spFile() first to locate table which can be in differ path */ if( hb_spFile( szFileName, szFileName ) ) { fResult = hb_fsDelete( szFileName ); @@ -5248,7 +5237,7 @@ static HB_ERRCODE adsExists( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pItem PHB_FNAME pFileName; HB_BOOL fTable = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "adsExists(%p, %p, %p, %lu)", pRDD, pItemTable, pItemIndex, ulConnect ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsExists(%p, %p, %p, %lu)", ( void * ) pRDD, ( void * ) pItemTable, ( void * ) pItemIndex, ulConnect ) ); szFile = hb_itemGetCPtr( pItemIndex ); if( ! szFile[ 0 ] ) @@ -5349,7 +5338,7 @@ static HB_ERRCODE adsExit( LPRDDNODE pRDD ) static HB_ERRCODE adsRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulConnect, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "adsRddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnect, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "adsRddInfo(%p, %hu, %lu, %p)", ( void * ) pRDD, uiIndex, ulConnect, ( void * ) pItem ) ); switch( uiIndex ) { @@ -5400,7 +5389,7 @@ static HB_ERRCODE adsRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulConn } else { - UNSIGNED16 usLen = ERROR_BUFFER_LEN; + UNSIGNED16 usLen = sizeof( pData->szError ) - 1; pData->ulError = u32RetVal; AdsGetLastError( &u32RetVal, pData->szError, &usLen ); @@ -5417,7 +5406,7 @@ static HB_ERRCODE adsRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulConn /* NOTE: Only allow disconnect of 0 if explicitly passed. The thread default connection handle might be 0 if caller accidentally disconnects twice. */ - + if( ( hConnect != 0 || HB_IS_NUMERIC( pItem ) ) && AdsDisconnect( hConnect ) == AE_SUCCESS ) { @@ -5497,7 +5486,6 @@ static HB_ERRCODE adsRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulConn case RDDI_EXECUTE: { - LPRDDADSDATA pData = RDDADSNODE_DATA( pRDD ); ADSHANDLE hConnect = ulConnect ? ( ADSHANDLE ) ulConnect : hb_ads_getConnection(); ADSHANDLE hStatement = 0; @@ -5514,7 +5502,7 @@ static HB_ERRCODE adsRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulConn AdsStmtSetTableType( hStatement, adsGetFileType( pRDD->rddID ) ); u32RetVal = AdsExecuteSQLDirect( hStatement, ( UNSIGNED8 * ) hb_itemGetCPtr( pItem ), &hCursor ); - if( u32RetVal == AE_SUCCESS ) + if( u32RetVal == AE_SUCCESS ) { if( AdsGetLastAutoinc( hStatement, &u32RetVal ) == AE_SUCCESS ) pData->ulInsertID = u32RetVal; @@ -5529,18 +5517,18 @@ static HB_ERRCODE adsRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulConn } else { - UNSIGNED16 usLen = ERROR_BUFFER_LEN; + UNSIGNED16 usLen = sizeof( pData->szError ) - 1; pData->ulError = u32RetVal; AdsGetLastError( &u32RetVal, pData->szError, &usLen ); pData->szError[ usLen ] = '\0'; - } + AdsCloseSQLStatement( hStatement ); } else { - UNSIGNED16 usLen = ERROR_BUFFER_LEN; + UNSIGNED16 usLen = sizeof( pData->szError ) - 1; pData->ulError = u32RetVal; AdsGetLastError( &u32RetVal, pData->szError, &usLen ); @@ -5831,7 +5819,6 @@ HB_FUNC( ADSCUSTOMIZEAOF ) UNSIGNED32 u32NumRecs = 0; UNSIGNED32 u32RetVal = ( UNSIGNED32 ) ~AE_SUCCESS; /* initialize to something other than success */ UNSIGNED16 u16Option = ADS_AOF_ADD_RECORD; - UNSIGNED32 * pu32Records; pArea = hb_adsGetWorkAreaPointer(); if( pArea ) @@ -5854,7 +5841,8 @@ HB_FUNC( ADSCUSTOMIZEAOF ) if( u32NumRecs ) { - pu32Records = ( UNSIGNED32 * ) hb_xgrab( u32NumRecs * sizeof( UNSIGNED32 ) ); + UNSIGNED32 * pu32Records = ( UNSIGNED32 * ) hb_xgrab( u32NumRecs * sizeof( UNSIGNED32 ) ); + if( HB_ISARRAY( 1 ) ) /* convert array of recnos to C array */ { for( ulRecord = 0; ulRecord < u32NumRecs; ulRecord++ ) diff --git a/contrib/rddads/adsfunc.c b/contrib/rddads/adsfunc.c index d9b75bf771..0fb81f8a37 100644 --- a/contrib/rddads/adsfunc.c +++ b/contrib/rddads/adsfunc.c @@ -1,7 +1,7 @@ /* * Advantage Database Server RDD (additional functions) * - * Copyright 2008 Viktor Szakats (vszakats.net/harbour) (cleanups) + * Copyright 2008 Viktor Szakats (vszakats.net/harbour) (cleanups, AdsGetRecordCount()) * Copyright 2000 Alexander Kresin * * This program is free software; you can redistribute it and/or modify @@ -45,16 +45,15 @@ * */ +#include "rddads.h" + #include "hbvm.h" -#include "hbapi.h" -#include "hbapiitm.h" #include "hbapierr.h" #include "hbapilng.h" #include "hbstack.h" #include "hbdate.h" #include "rddsys.ch" -#include "rddads.h" #define HARBOUR_MAX_RDD_FILTER_LENGTH 256 #define MAX_STR_LEN 255 @@ -410,7 +409,7 @@ HB_FUNC( ADSGETSERVERTIME ) #endif } -/* ---------------------------------------------------------------------------- */ +/* --- */ HB_FUNC( ADSISTABLELOCKED ) { @@ -2200,7 +2199,7 @@ HB_FUNC( ADSDDGETUSERPROPERTY ) If the optional last 3 parameters are supplied, then it queries the requested user property and returns it in the buffer. This is useful - fo example to get the groups of which the user is a member + for example to get the groups of which the user is a member */ HB_FUNC( ADSTESTLOGIN ) { @@ -2256,7 +2255,7 @@ HB_FUNC( ADSRESTRUCTURETABLE ) #endif } -/* AdsCopyTableContent( szAliasDest [, nAdsFilterOption ] ) -> lSuccess */ +/* AdsCopyTableContent( szAliasDest [, nAdsFilterOption ] ) --> lSuccess */ HB_FUNC( ADSCOPYTABLECONTENTS ) { #if ADS_LIB_VERSION >= 600 diff --git a/contrib/rddads/adsmgmnt.c b/contrib/rddads/adsmgmnt.c index 721b71fdc9..dd87a5676d 100644 --- a/contrib/rddads/adsmgmnt.c +++ b/contrib/rddads/adsmgmnt.c @@ -45,9 +45,6 @@ * */ -#include "hbapi.h" -#include "hbapiitm.h" - #include "rddads.h" static ADSHANDLE s_hMgmtHandle = 0; @@ -105,13 +102,13 @@ HB_FUNC( ADSMGGETINSTALLINFO ) { hb_reta( 8 ); hb_storvnl( stInstallInfo.ulUserOption , -1, 1 ); /* User option purchased */ - hb_storvc( ( char * ) stInstallInfo.aucRegisteredOwner, -1, 2 ); /* Registered owner */ - hb_storvc( ( char * ) stInstallInfo.aucVersionStr , -1, 3 ); /* Advantage version */ - hb_storvc( ( char * ) stInstallInfo.aucInstallDate , -1, 4 ); /* Install date string */ - hb_storvc( ( char * ) stInstallInfo.aucOemCharName , -1, 5 ); /* OEM char language */ - hb_storvc( ( char * ) stInstallInfo.aucAnsiCharName , -1, 6 ); /* ANSI char language */ - hb_storvc( ( char * ) stInstallInfo.aucEvalExpireDate , -1, 7 ); /* Eval expiration date */ - hb_storvc( ( char * ) stInstallInfo.aucSerialNumber , -1, 8 ); /* Serial number string */ + hb_storvc( ( char * ) stInstallInfo.aucRegisteredOwner, -1, 2 ); /* Registered owner */ + hb_storvc( ( char * ) stInstallInfo.aucVersionStr , -1, 3 ); /* Advantage version */ + hb_storvc( ( char * ) stInstallInfo.aucInstallDate , -1, 4 ); /* Install date string */ + hb_storvc( ( char * ) stInstallInfo.aucOemCharName , -1, 5 ); /* OEM char language */ + hb_storvc( ( char * ) stInstallInfo.aucAnsiCharName , -1, 6 ); /* ANSI char language */ + hb_storvc( ( char * ) stInstallInfo.aucEvalExpireDate , -1, 7 ); /* Eval expiration date */ + hb_storvc( ( char * ) stInstallInfo.aucSerialNumber , -1, 8 ); /* Serial number string */ } else hb_reta( 0 ); @@ -138,11 +135,11 @@ HB_FUNC( ADSMGGETACTIVITYINFO ) break; case 2: - hb_retnl( stActivityInfo.ulLoggedErrors ); /* Number logged errors */ + hb_retnl( stActivityInfo.ulLoggedErrors ); /* Number logged errors */ break; case 3: - hb_reta( 4 ); /* Length of time ADS has been up */ + hb_reta( 4 ); /* Length of time ADS has been up */ hb_storvnl( stActivityInfo.stUpTime.usDays, -1, 1 ); hb_storvnl( stActivityInfo.stUpTime.usHours, -1, 2 ); hb_storvnl( stActivityInfo.stUpTime.usMinutes, -1, 3 ); @@ -150,70 +147,70 @@ HB_FUNC( ADSMGGETACTIVITYINFO ) break; case 4: - hb_reta( 3 ); /* Users in use, max, rejected */ + hb_reta( 3 ); /* Users in use, max, rejected */ hb_storvnl( stActivityInfo.stUsers.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stUsers.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stUsers.ulRejected, -1, 3 ); break; case 5: - hb_reta( 3 ); /* Conns in use, max, rejected */ + hb_reta( 3 ); /* Conns in use, max, rejected */ hb_storvnl( stActivityInfo.stConnections.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stConnections.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stConnections.ulRejected, -1, 3 ); break; case 6: - hb_reta( 3 ); /* WAs in use, max, rejected */ + hb_reta( 3 ); /* WAs in use, max, rejected */ hb_storvnl( stActivityInfo.stWorkAreas.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stWorkAreas.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stWorkAreas.ulRejected, -1, 3 ); break; case 7: - hb_reta( 3 ); /* Tables in use, max, rejected */ + hb_reta( 3 ); /* Tables in use, max, rejected */ hb_storvnl( stActivityInfo.stTables.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stTables.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stTables.ulRejected, -1, 3 ); break; case 8: - hb_reta( 3 ); /* Indexes in use, max, rejected */ + hb_reta( 3 ); /* Indexes in use, max, rejected */ hb_storvnl( stActivityInfo.stIndexes.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stIndexes.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stIndexes.ulRejected, -1, 3 ); break; case 9: - hb_reta( 3 ); /* Locks in use, max, rejected */ + hb_reta( 3 ); /* Locks in use, max, rejected */ hb_storvnl( stActivityInfo.stLocks.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stLocks.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stLocks.ulRejected, -1, 3 ); break; case 10: - hb_reta( 3 ); /* TPS header elems in use, max */ + hb_reta( 3 ); /* TPS header elems in use, max */ hb_storvnl( stActivityInfo.stTpsHeaderElems.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stTpsHeaderElems.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stTpsHeaderElems.ulRejected, -1, 3 ); break; case 11: - hb_reta( 3 ); /* TPS vis elems in use, max */ + hb_reta( 3 ); /* TPS vis elems in use, max */ hb_storvnl( stActivityInfo.stTpsVisElems.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stTpsVisElems.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stTpsVisElems.ulRejected, -1, 3 ); break; case 12: - hb_reta( 3 ); /* TPS memo elems in use, max */ + hb_reta( 3 ); /* TPS memo elems in use, max */ hb_storvnl( stActivityInfo.stTpsMemoElems.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stTpsMemoElems.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stTpsMemoElems.ulRejected, -1, 3 ); break; case 13: - hb_reta( 3 ); /* Worker threads in use, max */ + hb_reta( 3 ); /* Worker threads in use, max */ hb_storvnl( stActivityInfo.stWorkerThreads.ulInUse, -1, 1 ); hb_storvnl( stActivityInfo.stWorkerThreads.ulMaxUsed, -1, 2 ); hb_storvnl( stActivityInfo.stWorkerThreads.ulRejected, -1, 3 ); @@ -243,16 +240,16 @@ HB_FUNC( ADSMGGETCOMMSTATS ) { hb_reta( 11 ); hb_storvnd( stCommStats.dPercentCheckSums , -1, 1 ); /* % of pkts with checksum failures */ - hb_storvnl( stCommStats.ulTotalPackets , -1, 2 ); /* Total packets received */ - hb_storvnl( stCommStats.ulRcvPktOutOfSeq , -1, 3 ); /* Receive packets out of sequence */ - hb_storvnl( stCommStats.ulNotLoggedIn , -1, 4 ); /* Packet owner not logged in */ + hb_storvnl( stCommStats.ulTotalPackets , -1, 2 ); /* Total packets received */ + hb_storvnl( stCommStats.ulRcvPktOutOfSeq , -1, 3 ); /* Receive packets out of sequence */ + hb_storvnl( stCommStats.ulNotLoggedIn , -1, 4 ); /* Packet owner not logged in */ hb_storvnl( stCommStats.ulRcvReqOutOfSeq , -1, 5 ); /* Receive requests out of sequence */ - hb_storvnl( stCommStats.ulCheckSumFailures , -1, 6 ); /* Checksum failures */ - hb_storvnl( stCommStats.ulDisconnectedUsers, -1, 7 ); /* Server initiated disconnects */ - hb_storvnl( stCommStats.ulPartialConnects , -1, 8 ); /* Removed partial connections */ - hb_storvnl( stCommStats.ulInvalidPackets , -1, 9 ); /* Rcvd invalid packets (NT only) */ - hb_storvnl( stCommStats.ulRecvFromErrors , -1, 10 ); /* RecvFrom failed (NT only) */ - hb_storvnl( stCommStats.ulSendToErrors , -1, 11 ); /* SendTo failed (NT only) */ + hb_storvnl( stCommStats.ulCheckSumFailures , -1, 6 ); /* Checksum failures */ + hb_storvnl( stCommStats.ulDisconnectedUsers, -1, 7 ); /* Server initiated disconnects */ + hb_storvnl( stCommStats.ulPartialConnects , -1, 8 ); /* Removed partial connections */ + hb_storvnl( stCommStats.ulInvalidPackets , -1, 9 ); /* Rcvd invalid packets (NT only) */ + hb_storvnl( stCommStats.ulRecvFromErrors , -1, 10 ); /* RecvFrom failed (NT only) */ + hb_storvnl( stCommStats.ulSendToErrors , -1, 11 ); /* SendTo failed (NT only) */ } else hb_reta( 0 ); @@ -285,59 +282,59 @@ HB_FUNC( ADSMGGETCONFIGINFO ) { case 0: hb_reta( 25 ); - hb_storvnl( stConfigValues.ulNumConnections , -1, 1 ); /* number connections */ - hb_storvnl( stConfigValues.ulNumWorkAreas , -1, 2 ); /* number work areas */ - hb_storvnl( stConfigValues.ulNumTables , -1, 3 ); /* number tables */ - hb_storvnl( stConfigValues.ulNumIndexes , -1, 4 ); /* number indexes */ - hb_storvnl( stConfigValues.ulNumLocks , -1, 5 ); /* number locks */ - hb_storvnl( stConfigValues.ulUserBufferSize , -1, 6 ); /* user buffer */ - hb_storvnl( stConfigValues.ulStatDumpInterval , -1, 7 ); /* statistics dump interval */ - hb_storvnl( stConfigValues.ulErrorLogMax , -1, 8 ); /* max size of error log */ - hb_storvnl( stConfigValues.ulNumTPSHeaderElems , -1, 9 ); /* number TPS header elems */ - hb_storvnl( stConfigValues.ulNumTPSVisibilityElems , -1, 10 ); /* number TPS vis elems */ - hb_storvnl( stConfigValues.ulNumTPSMemoTransElems , -1, 11 ); /* number TPS memo elems */ - hb_storvnl( stConfigValues.usNumReceiveECBs , -1, 12 ); /* number rcv ECBs (NLM only) */ - hb_storvnl( stConfigValues.usNumSendECBs , -1, 13 ); /* number send ECBs (NLM only) */ - hb_storvnd( stConfigValues.usNumBurstPackets , -1, 14 ); /* number packets per burst */ - hb_storvnl( stConfigValues.usNumWorkerThreads , -1, 15 ); /* number worker threads */ + hb_storvnl( stConfigValues.ulNumConnections , -1, 1 ); /* number connections */ + hb_storvnl( stConfigValues.ulNumWorkAreas , -1, 2 ); /* number work areas */ + hb_storvnl( stConfigValues.ulNumTables , -1, 3 ); /* number tables */ + hb_storvnl( stConfigValues.ulNumIndexes , -1, 4 ); /* number indexes */ + hb_storvnl( stConfigValues.ulNumLocks , -1, 5 ); /* number locks */ + hb_storvnl( stConfigValues.ulUserBufferSize , -1, 6 ); /* user buffer */ + hb_storvnl( stConfigValues.ulStatDumpInterval , -1, 7 ); /* statistics dump interval */ + hb_storvnl( stConfigValues.ulErrorLogMax , -1, 8 ); /* max size of error log */ + hb_storvnl( stConfigValues.ulNumTPSHeaderElems , -1, 9 ); /* number TPS header elems */ + hb_storvnl( stConfigValues.ulNumTPSVisibilityElems , -1, 10 ); /* number TPS vis elems */ + hb_storvnl( stConfigValues.ulNumTPSMemoTransElems , -1, 11 ); /* number TPS memo elems */ + hb_storvnl( stConfigValues.usNumReceiveECBs , -1, 12 ); /* number rcv ECBs (NLM only) */ + hb_storvnl( stConfigValues.usNumSendECBs , -1, 13 ); /* number send ECBs (NLM only) */ + hb_storvnd( stConfigValues.usNumBurstPackets , -1, 14 ); /* number packets per burst */ + hb_storvnl( stConfigValues.usNumWorkerThreads , -1, 15 ); /* number worker threads */ #if ADS_LIB_VERSION >= 810 - hb_storvnl( stConfigValues.ulSortBuffSize , -1, 16 ); /* index sort buffer size */ - hb_storvni( 0 , -1, 17 ); /* reserved */ - hb_storvni( 0 , -1, 18 ); /* reserved */ + hb_storvnl( stConfigValues.ulSortBuffSize , -1, 16 ); /* index sort buffer size */ + hb_storvni( 0 , -1, 17 ); /* reserved */ + hb_storvni( 0 , -1, 18 ); /* reserved */ #elif ADS_LIB_VERSION < 810 - hb_storvnl( stConfigValues.usSortBuffSize , -1, 16 ); /* index sort buffer size */ - hb_storvni( stConfigValues.ucReserved1 , -1, 17 ); /* reserved */ - hb_storvni( stConfigValues.ucReserved2 , -1, 18 ); /* reserved */ + hb_storvnl( stConfigValues.usSortBuffSize , -1, 16 ); /* index sort buffer size */ + hb_storvni( stConfigValues.ucReserved1 , -1, 17 ); /* reserved */ + hb_storvni( stConfigValues.ucReserved2 , -1, 18 ); /* reserved */ #else /* not currently used */ - hb_storvnl( 0 , -1, 16 ); /* index sort buffer size */ - hb_storvni( 0 , -1, 17 ); /* reserved */ - hb_storvni( 0 , -1, 18 ); /* reserved */ + hb_storvnl( 0 , -1, 16 ); /* index sort buffer size */ + hb_storvni( 0 , -1, 17 ); /* reserved */ + hb_storvni( 0 , -1, 18 ); /* reserved */ #endif - hb_storvc( ( char * ) stConfigValues.aucErrorLog , -1, 19 ); /* error log path */ - hb_storvc( ( char * ) stConfigValues.aucSemaphore , -1, 20 ); /* semaphore file path */ - hb_storvc( ( char * ) stConfigValues.aucTransaction, -1, 21 ); /* TPS log file path */ - hb_storvni( stConfigValues.ucReserved3 , -1, 22 ); /* reserved */ - hb_storvni( stConfigValues.ucReserved4 , -1, 23 ); /* reserved */ - hb_storvnl( stConfigValues.usSendIPPort , -1, 24 ); /* NT Service IP send port # */ - hb_storvnl( stConfigValues.usReceiveIPPort , -1, 25 ); /* NT Service IP rcv port # */ - /* hb_storvnl( stConfigValues.usReserved5 , -1, 26 ); reserved */ + hb_storvc( ( char * ) stConfigValues.aucErrorLog , -1, 19 ); /* error log path */ + hb_storvc( ( char * ) stConfigValues.aucSemaphore , -1, 20 ); /* semaphore file path */ + hb_storvc( ( char * ) stConfigValues.aucTransaction, -1, 21 ); /* TPS log file path */ + hb_storvni( stConfigValues.ucReserved3 , -1, 22 ); /* reserved */ + hb_storvni( stConfigValues.ucReserved4 , -1, 23 ); /* reserved */ + hb_storvnl( stConfigValues.usSendIPPort , -1, 24 ); /* NT Service IP send port # */ + hb_storvnl( stConfigValues.usReceiveIPPort , -1, 25 ); /* NT Service IP rcv port # */ + /* hb_storvnl( stConfigValues.usReserved5 , -1, 26 ); reserved */ break; case 1: hb_reta( 13 ); - hb_storvnd( stConfigMemory.ulTotalConfigMem , -1, 1 ); /* Total mem taken by cfg params */ - hb_storvnl( stConfigMemory.ulConnectionMem , -1, 2 ); /* memory taken by connections */ - hb_storvnl( stConfigMemory.ulWorkAreaMem , -1, 3 ); /* memory taken by work areas */ - hb_storvnl( stConfigMemory.ulTableMem , -1, 4 ); /* memory taken by tables */ - hb_storvnl( stConfigMemory.ulIndexMem , -1, 5 ); /* memory taken by indexes */ - hb_storvnl( stConfigMemory.ulLockMem , -1, 6 ); /* memory taken by locks */ - hb_storvnl( stConfigMemory.ulUserBufferMem , -1, 7 ); /* memory taken by user buffer */ + hb_storvnd( stConfigMemory.ulTotalConfigMem , -1, 1 ); /* Total memory taken by config parameters */ + hb_storvnl( stConfigMemory.ulConnectionMem , -1, 2 ); /* memory taken by connections */ + hb_storvnl( stConfigMemory.ulWorkAreaMem , -1, 3 ); /* memory taken by work areas */ + hb_storvnl( stConfigMemory.ulTableMem , -1, 4 ); /* memory taken by tables */ + hb_storvnl( stConfigMemory.ulIndexMem , -1, 5 ); /* memory taken by indexes */ + hb_storvnl( stConfigMemory.ulLockMem , -1, 6 ); /* memory taken by locks */ + hb_storvnl( stConfigMemory.ulUserBufferMem , -1, 7 ); /* memory taken by user buffer */ hb_storvnl( stConfigMemory.ulTPSHeaderElemMem , -1, 8 ); /* memory taken by TPS hdr elems */ hb_storvnl( stConfigMemory.ulTPSVisibilityElemMem , -1, 9 ); /* memory taken by TPS vis elems */ - hb_storvnl( stConfigMemory.ulTPSMemoTransElemMem , -1, 10 ); /* mem taken by TPS memo elems */ - hb_storvnl( stConfigMemory.ulReceiveEcbMem , -1, 11 ); /* mem taken by rcv ECBs (NLM) */ - hb_storvnl( stConfigMemory.ulSendEcbMem , -1, 12 ); /* mem taken by send ECBs (NLM) */ - hb_storvnl( stConfigMemory.ulWorkerThreadMem , -1, 13 ); /* mem taken by worker threads */ + hb_storvnl( stConfigMemory.ulTPSMemoTransElemMem , -1, 10 ); /* memory taken by TPS memo elems */ + hb_storvnl( stConfigMemory.ulReceiveEcbMem , -1, 11 ); /* memory taken by rcv ECBs (NLM) */ + hb_storvnl( stConfigMemory.ulSendEcbMem , -1, 12 ); /* memory taken by send ECBs (NLM) */ + hb_storvnl( stConfigMemory.ulWorkerThreadMem , -1, 13 ); /* memory taken by worker threads */ break; default: @@ -418,8 +415,8 @@ HB_FUNC( ADSMGGETUSERNAMES ) /* * NOTE: returns an array of 5 elements if successful * [1] Client machine name when server runs on NT/2000 - * Client Username when server runs on Netware - * [2] Netware connection number + * Client Username when server runs on NetWare + * [2] NetWare connection number * [3] Login user name for data dictionary connections (ADS 6.0 and above) * [4] Client machine IP address (ADS 6.0 and above) * [5] lock type ADS_MGMT_NO_LOCK ADS_MGMT_RECORD_LOCK ADS_MGMT_FILE_LOCK @@ -444,10 +441,10 @@ HB_FUNC( ADSMGGETLOCKOWNER ) hb_storvnl( ( UNSIGNED16 ) pstUserInfo->usConnNumber, -1, 2 ); /* NetWare conn # (NLM only) */ #if ADS_LIB_VERSION >= 600 hb_storvc( ( char * ) pstUserInfo->aucAuthUserName, -1, 3 ); /* logon name with Data Dictionary */ - hb_storvc( ( char * ) pstUserInfo->aucAddress, -1, 4 ); /* IP adddress */ + hb_storvc( ( char * ) pstUserInfo->aucAddress, -1, 4 ); /* IP address */ #else hb_storvc( NULL, -1, 3 ); /* logon name with Data Dictionary */ - hb_storvc( NULL, -1, 4 ); /* IP adddress */ + hb_storvc( NULL, -1, 4 ); /* IP address */ #endif hb_storvnl( pusLockType, -1, 5 ); /* type of lock */ } @@ -462,7 +459,7 @@ HB_FUNC( ADSMGGETLOCKOWNER ) #endif } -/* NOTE: For a newer edition of this function, which also returns locktype +/* NOTE: For a newer edition of this function, which also returns lock type info, see AdsMgGetOpenTables2(). */ HB_FUNC( ADSMGGETOPENTABLES ) /* nMaxNumberOfFilesToReturn, cUserName, nConnection */ { @@ -472,7 +469,7 @@ HB_FUNC( ADSMGGETOPENTABLES ) /* nMaxNumberOfFilesToReturn, cUserName, nConnecti if( AdsMgGetOpenTables( s_hMgmtHandle, ( UNSIGNED8 * ) ( hb_parclen( 2 ) > 0 ? HB_UNCONST( hb_parc( 2 ) ) : NULL ) /* pucUserName */, - ( UNSIGNED16 ) hb_parni( 3 ) /* usConnNumber */, /* = HB_ADS_PARCONNECTION( 3 ) only valid for netware so don't default to current, only take a passed value */ + ( UNSIGNED16 ) hb_parni( 3 ) /* usConnNumber */, /* = HB_ADS_PARCONNECTION( 3 ) only valid for NetWare so don't default to current, only take a passed value */ astOpenTableInfo, &usArrayLen, &usStructSize ) == AE_SUCCESS ) @@ -504,7 +501,7 @@ HB_FUNC( ADSMGGETOPENTABLES2 ) /* nMaxNumberOfFilesToReturn, cUserName, nConnect if( AdsMgGetOpenTables( s_hMgmtHandle, ( UNSIGNED8 * ) ( hb_parclen( 2 ) > 0 ? HB_UNCONST( hb_parc( 2 ) ) : NULL ) /* pucUserName */, - ( UNSIGNED16 ) hb_parni( 3 ) /* usConnNumber */, /* = HB_ADS_PARCONNECTION( 3 ) only valid for netware so don't default to current, only take a passed value */ + ( UNSIGNED16 ) hb_parni( 3 ) /* usConnNumber */, /* = HB_ADS_PARCONNECTION( 3 ) only valid for NetWare so don't default to current, only take a passed value */ astOpenTableInfo, &usArrayLen, &usStructSize ) == AE_SUCCESS ) @@ -543,7 +540,7 @@ HB_FUNC( ADSMGGETOPENINDEXES ) /* nMaxNumberOfFilesToReturn, cTableName, cUserNa if( AdsMgGetOpenIndexes( s_hMgmtHandle, ( UNSIGNED8 * ) ( hb_parclen( 2 ) > 0 ? HB_UNCONST( hb_parc( 2 ) ) : NULL ) /* pucTableName */, /* fully qualified path to that table */ ( UNSIGNED8 * ) ( hb_parclen( 3 ) > 0 ? HB_UNCONST( hb_parc( 3 ) ) : NULL ) /* pucUserName */, - ( UNSIGNED16 ) hb_parni( 4 ) /* usConnNumber */, /* = HB_ADS_PARCONNECTION( 4 ) only valid for netware so don't default to current, only take a passed value */ + ( UNSIGNED16 ) hb_parni( 4 ) /* usConnNumber */, /* = HB_ADS_PARCONNECTION( 4 ) only valid for NetWare so don't default to current, only take a passed value */ astOpenIndexInfo, &usArrayLen, &usStructSize ) == AE_SUCCESS ) @@ -576,7 +573,7 @@ HB_FUNC( ADSMGGETLOCKS ) if( AdsMgGetLocks( s_hMgmtHandle, ( UNSIGNED8 * ) ( hb_parclen( 2 ) > 0 ? HB_UNCONST( hb_parc( 2 ) ) : NULL ) /* pucTableName */, /* fully qualified path to that table */ ( UNSIGNED8 * ) ( hb_parclen( 3 ) > 0 ? HB_UNCONST( hb_parc( 3 ) ) : NULL ) /* pucUserName */, - ( UNSIGNED16 ) hb_parni( 4 ) /* usConnNumber */, /* = HB_ADS_PARCONNECTION( 4 ) only valid for netware so don't default to current, only take a passed value */ + ( UNSIGNED16 ) hb_parni( 4 ) /* usConnNumber */, /* = HB_ADS_PARCONNECTION( 4 ) only valid for NetWare so don't default to current, only take a passed value */ astRecordInfo, &usArrayLen, &usStructSize ) == AE_SUCCESS ) diff --git a/contrib/rddads/adsx.c b/contrib/rddads/adsx.c index fee58b45fa..9b96e98092 100644 --- a/contrib/rddads/adsx.c +++ b/contrib/rddads/adsx.c @@ -44,17 +44,16 @@ * */ -#include "hbdefs.h" -#include "hbapi.h" +#include "rddads.h" + #include "hbinit.h" -#include "hbapiitm.h" #include "hbapierr.h" #include "hbdbferr.h" #include "hbapilng.h" #include "hbdate.h" -#include "rddads.h" #include "hbset.h" #include "hbvm.h" + #include "rddsys.ch" #ifndef SUPER_ORDDESTROY @@ -94,7 +93,7 @@ typedef struct _MIXTAG HB_ULONG ulRecMax; HB_ULONG ulRecCount; - PHB_CODEPAGE pCodepage; /* National sorttable for character key tags, NULL otherwise */ + PHB_CODEPAGE pCodepage; /* National sort table for character key tags, NULL otherwise */ HB_ULONG ulKeyNo; } MIXTAG, * PMIXTAG; @@ -107,7 +106,7 @@ typedef struct _ADSXAREA_ { ADSAREA adsarea; - /* ================ Additional fields for ADSX RDD =================== */ + /* Additional fields for ADSX RDD */ PMIXTAG pTagList; PMIXTAG pTagCurrent; @@ -125,21 +124,18 @@ static HB_USHORT s_uiRddIdADSADTX = ( HB_USHORT ) -1; static RDDFUNCS adsxSuper; -/*********************************************************************** - * Misc functions - ************************************************************************/ +/* Misc functions */ static HB_ERRCODE hb_mixErrorRT( ADSXAREAP pArea, HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * filename, HB_ERRCODE errOsCode, HB_USHORT uiFlags ) { - PHB_ITEM pError; HB_ERRCODE iRet = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { - pError = hb_errNew(); + PHB_ITEM pError = hb_errNew(); hb_errPutGenCode( pError, errGenCode ); hb_errPutSubCode( pError, errSubCode ); hb_errPutOsCode( pError, errOsCode ); @@ -173,9 +169,7 @@ static HB_ERRCODE hb_adsUpdateAreaFlags( ADSXAREAP pArea ) } -/************************************************************************ - * Memory Index - *************************************************************************/ +/* Memory Index */ static PMIXKEY mixKeyNew( PHB_ITEM pItem, HB_ULONG ulRecNo, HB_BYTE bType, HB_USHORT uiLen ) { @@ -414,7 +408,7 @@ static PMIXTAG mixTagCreate( const char * szTagName, PHB_ITEM pKeyExpr, PHB_ITEM pTag->szKeyExpr = ( char * ) hb_xgrab( hb_itemGetCLen( pKeyExpr ) + 1 ); hb_strncpyTrim( pTag->szKeyExpr, hb_itemGetCPtr( pKeyExpr ), hb_itemGetCLen( pKeyExpr ) ); - /* TODO: for expresion */ + /* TODO: for expression */ pTag->szForExpr = NULL; pTag->pKeyItem = pKeyItem; @@ -558,7 +552,6 @@ static void mixTagDestroy( PMIXTAG pTag ) static PMIXTAG mixFindTag( ADSXAREAP pArea, PHB_ITEM pOrder ) { - char szTag[ MIX_MAXTAGNAMELEN + 1 ]; PMIXTAG pTag; if( HB_IS_NUMBER( pOrder ) ) @@ -575,6 +568,8 @@ static PMIXTAG mixFindTag( ADSXAREAP pArea, PHB_ITEM pOrder ) } else { + char szTag[ MIX_MAXTAGNAMELEN + 1 ]; + hb_strncpyUpperTrim( szTag, hb_itemGetCPtr( pOrder ), MIX_MAXTAGNAMELEN ); pTag = pArea->pTagList; while( pTag && hb_stricmp( szTag, pTag->szName ) ) @@ -706,9 +701,7 @@ static void mixUpdateDestroy( ADSXAREAP pArea, PMIXUPDATE pUpdate, int fUpdate ) } -/************************************************************************ - * ADSX RDD METHODS - *************************************************************************/ +/* ADSX RDD METHODS */ static HB_ERRCODE adsxGoBottom( ADSXAREAP pArea ) { @@ -934,12 +927,10 @@ static HB_ERRCODE adsxPutValue( ADSXAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt static HB_ERRCODE adsxClose( ADSXAREAP pArea ) { - PMIXTAG pTag; - pArea->pTagCurrent = NULL; while( pArea->pTagList ) { - pTag = pArea->pTagList; + PMIXTAG pTag = pArea->pTagList; pArea->pTagList = pArea->pTagList->pNext; mixTagDestroy( pTag ); } @@ -1123,9 +1114,7 @@ static HB_ERRCODE adsxOrderCreate( ADSXAREAP pArea, LPDBORDERCREATEINFO pOrderIn } if( bKeyADS && bForADS && bWhileADS ) - { return SUPER_ORDCREATE( &pArea->adsarea.area, pOrderInfo ); - } if( pArea->adsarea.area.lpdbOrdCondInfo && ( ( bForADS && pArea->adsarea.area.lpdbOrdCondInfo->abFor ) || diff --git a/contrib/rddads/rddads.h b/contrib/rddads/rddads.h index 8e89990782..b21803e98f 100644 --- a/contrib/rddads/rddads.h +++ b/contrib/rddads/rddads.h @@ -65,7 +65,7 @@ #include "ace.h" -/* Autodetect ACE version. */ +/* Auto-detect ACE version. */ #if defined( ADS_ROOT_DD_ALIAS ) #define _ADS_LIB_VERSION 1110 /* or upper */ #elif defined( ADS_GET_FORMAT_WEB ) @@ -112,23 +112,18 @@ HB_EXTERN_BEGIN UNSIGNED32 ENTRYPOINT AdsDeleteFile( ADSHANDLE hConnection, UNSIGNED8 * pucFileName ); #endif -/* - * ADS WORKAREA - * -------- - * The Workarea Structure of Advantage Database Server RDD - * - */ +/* ADS WORKAREA + The Workarea Structure of Advantage Database Server RDD */ typedef struct _ADSAREA_ { AREA area; - /* - * ADS's additions to the workarea structure + /* ADS's additions to the workarea structure * - * Warning: The above section MUST match WORKAREA exactly! Any - * additions to the structure MUST be added below, as in this - * example. + * Warning: The above section MUST match WORKAREA exactly! Any + * additions to the structure MUST be added below, as in this + * example. */ LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */ diff --git a/contrib/rddads/readme.txt b/contrib/rddads/readme.txt index 97a19c04bf..3ebad3d179 100644 --- a/contrib/rddads/readme.txt +++ b/contrib/rddads/readme.txt @@ -12,6 +12,10 @@ You need to include in your prg file the following lines: REQUEST ADS +You can also use: + + REQUEST ADT | ADSNTX | ADSCDX | ADSVFP + and then you can set default RDD using one of the following functions: rddSetDefault( "ADT" ) @@ -19,22 +23,16 @@ and then you can set default RDD using one of the following functions: rddSetDefault( "ADSCDX" ) rddSetDefault( "ADSVFP" ) -You can also use: - - REQUEST ADT | ADSNTX | ADSCDX | ADSVFP - -instead of REQUEST ADS. - -for backward compatibility with old code it's possible to use also: - rddSetDefault( "ADS" ) and then #include "ads.ch" SET FILETYPE TO NTX | CDX | ADT | VFP -command or AdsSetFileType() function to set table type (default is CDX) +command, or function + AdsSetFileType() +to set table type (default is CDX) By default RDD is tuned for remote server. To change this you may use commands, defined in ads.ch: - SET SERVER LOCAL - -or function AdsSetServerType(). + SET SERVER LOCAL +command, or function + AdsSetServerType() diff --git a/contrib/rddbm/bmdbfx.c b/contrib/rddbm/bmdbfx.c index e3f6cf33c4..94902274f1 100644 --- a/contrib/rddbm/bmdbfx.c +++ b/contrib/rddbm/bmdbfx.c @@ -1,10 +1,10 @@ /* * Alternative BMDBF* implementation which respects RDD inheritance - * scheme and gives similar functionality and PRG functions as modified - * by Miguel Angel Marchuet DBFCDX with - * directly hardcoded bitmap filters. - * This code is completely new implementation and does not contain - * any code created by Miguel. + * scheme and gives similar functionality and PRG functions as modified + * by Miguel Angel Marchuet DBFCDX with + * directly hardcoded bitmap filters. + * This code is completely new implementation and does not contain + * any code created by Miguel. * * Copyright 2010 Przemyslaw Czerpak * @@ -60,7 +60,7 @@ #include "rddsys.ch" -/* now this function is RDD independent and can work with any RDD suporting +/* now this function is RDD independent and can work with any RDD supporting * DBOI_SKIPWILD and DBOI_SKIPWILDBACK */ HB_FUNC( BM_DBSEEKWILD ) @@ -73,7 +73,7 @@ HB_FUNC( BM_DBSEEKWILD ) if( szPattern ) { - HB_BOOL fSoft, fBack, fCont, fAll, fFound, fUnlock; + HB_BOOL fSoft, fBack, fCont, fAll, fFound; DBORDERINFO OrderInfo; HB_ERRCODE errCode; PHB_ITEM pArray = NULL; @@ -100,6 +100,7 @@ HB_FUNC( BM_DBSEEKWILD ) if( iOrder != 0 ) { + HB_BOOL fUnlock; OrderInfo.itmNewVal = OrderInfo.itmResult; hb_itemPutL( OrderInfo.itmNewVal, HB_TRUE ); if( SELF_ORDINFO( pArea, DBOI_READLOCK, &OrderInfo ) == HB_SUCCESS ) @@ -110,8 +111,6 @@ HB_FUNC( BM_DBSEEKWILD ) if( ! fCont ) { - const char * szKey; - if( fBack ) errCode = SELF_GOBOTTOM( pArea ); else @@ -121,10 +120,7 @@ HB_FUNC( BM_DBSEEKWILD ) { errCode = SELF_ORDINFO( pArea, DBOI_KEYVAL, &OrderInfo ); if( errCode == HB_SUCCESS ) - { - szKey = hb_itemGetCPtr( OrderInfo.itmResult ); - fFound = hb_strMatchWild( szKey, szPattern ); - } + fFound = hb_strMatchWild( hb_itemGetCPtr( OrderInfo.itmResult ), szPattern ); } } @@ -321,12 +317,13 @@ HB_FUNC( BM_DBGETFILTERARRAY ) if( pBM && pArea->dbfi.fOptimized ) { - HB_ULONG ul, ulItems = BM_ITEMSIZE( pBM->maxrec ); + HB_ULONG ulItems = BM_ITEMSIZE( pBM->maxrec ); HB_ULONG ulRecNo; if( SELF_RECNO( pArea, &ulRecNo ) == HB_SUCCESS ) { PHB_ITEM pItem = hb_itemNew( NULL ); + HB_ULONG ul; for( ul = 0; ul < ulItems; ul++ ) { @@ -525,9 +522,7 @@ static HB_ERRCODE hb_bmSkipFilter( AREAP pArea, HB_LONG lUpDown ) static HB_ERRCODE hb_bmPutRec( AREAP pArea, const HB_BYTE * pBuffer ) { - HB_ERRCODE errCode; - - errCode = SUPER_PUTREC( pArea, pBuffer ); + HB_ERRCODE errCode = SUPER_PUTREC( pArea, pBuffer ); if( pBuffer == NULL && errCode == HB_SUCCESS && BM_GETFILTER( pArea ) ) hb_bmEvalFilter( pArea, HB_TRUE ); @@ -564,9 +559,8 @@ static HB_ERRCODE hb_bmClearFilter( AREAP pArea ) static HB_ERRCODE hb_bmSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo ) { - HB_ERRCODE errCode; + HB_ERRCODE errCode = SUPER_SETFILTER( pArea, pFilterInfo ); - errCode = SUPER_SETFILTER( pArea, pFilterInfo ); if( errCode == HB_SUCCESS ) { if( hb_setGetOptimize() ) @@ -581,10 +575,12 @@ static HB_ERRCODE hb_bmSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo ) if( hb_setGetForceOpt() ) { - HB_ULONG ulRecNo, ulRec; + HB_ULONG ulRecNo; if( SELF_RECNO( pArea, &ulRecNo ) == HB_SUCCESS ) { + HB_ULONG ulRec; + for( ulRec = 1; ulRec <= pBM->maxrec; ulRec++ ) { SELF_GOTO( pArea, ulRec ); @@ -599,7 +595,6 @@ static HB_ERRCODE hb_bmSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo ) return errCode; } - static const RDDFUNCS bmTable = { /* Movement and positioning methods */ @@ -739,7 +734,7 @@ static void hb_bmGetFuncTable( const char * szSuper ) uiRddId = ( HB_USHORT ) hb_parni( 4 ); puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); - HB_TRACE( HB_TR_DEBUG, ( "BM%s_GETFUNCTABLE(%p, %p, %p, %hu, %p)", szSuper, puiCount, pTable, pSuperTable, uiRddId, puiSuperRddId ) ); + HB_TRACE( HB_TR_DEBUG, ( "BM%s_GETFUNCTABLE(%p, %p, %p, %hu, %p)", szSuper, ( void * ) puiCount, pTable, pSuperTable, uiRddId, puiSuperRddId ) ); if( puiCount && pTable && pSuperTable && puiSuperRddId ) { diff --git a/contrib/rddsql/hbrddsql.h b/contrib/rddsql/hbrddsql.h index 54ac270206..d749631dfc 100644 --- a/contrib/rddsql/hbrddsql.h +++ b/contrib/rddsql/hbrddsql.h @@ -48,17 +48,13 @@ #ifndef HB_RDDSQL_H_ #define HB_RDDSQL_H_ +#include "hbapi.h" #include "hbapirdd.h" #include "hbdbferr.h" #include "hbapierr.h" #include "hbapilng.h" -#include "hbapi.h" -/* - ==================================================================== - SQLBASE - ==================================================================== - */ +/* SQLBASE */ #define MAX_FIELD_NAME 64 @@ -73,9 +69,7 @@ typedef struct _SQLBASEAREA { AREA area; - /* - * SQLBASE additions to the workarea structure - */ + /* SQLBASE additions to the workarea structure */ LPDBRELINFO lpdbPendingRel; @@ -113,11 +107,7 @@ typedef struct _SQLDDCONNECTION } SQLDDCONNECTION; -/* - ==================================================================== - SQLMIX - ==================================================================== - */ +/* SQLMIX */ #define MIX_MAXKEYLEN 1024 #define MIX_MAXTAGNAMELEN 16 @@ -178,7 +168,7 @@ typedef struct _MIXTAG PMIXKEY HotKey; HB_BOOL HotFor; - PHB_CODEPAGE pCodepage; /* National sorttable for character key tags, NULL otherwise */ + PHB_CODEPAGE pCodepage; /* National sort table for character key tags, NULL otherwise */ } MIXTAG, * PMIXTAG; @@ -196,11 +186,7 @@ typedef struct _SQLMIXAREA } SQLMIXAREA, * SQLMIXAREAP; -/* - ==================================================================== - SQLDD - ==================================================================== - */ +/* SQLDD */ typedef HB_ERRCODE ( *SDDFUNC_CONNECT )( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ); typedef HB_ERRCODE ( *SDDFUNC_DISCONNECT )( SQLDDCONNECTION * pConnection ); diff --git a/contrib/rddsql/readme.txt b/contrib/rddsql/readme.txt index ba48fa5b68..5e3369794b 100644 --- a/contrib/rddsql/readme.txt +++ b/contrib/rddsql/readme.txt @@ -18,7 +18,7 @@ emulated by creating additional table columns to store delete flag. Some record and file locks in DBF style. The idea of SQL query is also lost. If you do a simple loop - dbUseArea(, "select * from my_table" ) + dbUseArea( , "select * from my_table" ) DO WHILE ! Eof() somefunc( FIELD->some_sql_field ) dbSkip() @@ -26,8 +26,8 @@ you do a simple loop RDD usualy will read SQL rows in portions, let's say 100 records per query. So, hidden queries are generated. If you are using indexes these queries -are really complicated. Let's have index on FIELD1 + Str(FIELD2). A seek to -value cValue1 + Str(nValue2) will generate a query like: +are really complicated. Let's have index on FIELD1 + Str( FIELD2 ). A seek +to value cValue1 + Str( nValue2 ) will generate a query like: SELECT * FROM my_table WHERE (FIELD1 == cValue1 and FIELD2 >= nValue2) or FIELD1 > cValue1 @@ -55,7 +55,7 @@ queries should be made explicitly by programmer. SSI gives access to query result via RDD interface, it does not tries to emulate DBF and be "plug-and-play" solution for DBF to SQL migration. If you do - dbUseArea(, "select * from my_table") + dbUseArea( , "select * from my_table") all query (it could contain millions of records!) will be cached. diff --git a/contrib/rddsql/sqlbase.c b/contrib/rddsql/sqlbase.c index f2c80cbab5..c89d6d1786 100644 --- a/contrib/rddsql/sqlbase.c +++ b/contrib/rddsql/sqlbase.c @@ -104,11 +104,11 @@ void hb_rddsqlSetError( HB_ERRCODE errCode, const char * szError, const char * s static HB_ERRCODE hb_errRT_SQLBASE( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation ) { - PHB_ITEM pError; HB_ERRCODE iRet = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { + PHB_ITEM pError; pError = hb_errRT_New( ES_ERROR, "SQLBASE", errGenCode, errSubCode, szDescription, szOperation, 0, EF_NONE ); iRet = hb_errLaunch( pError ); hb_itemRelease( pError ); @@ -117,7 +117,7 @@ static HB_ERRCODE hb_errRT_SQLBASE( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode } -/*================ NULL SDD ==========================================================*/ +/* --- NULL SDD --- */ static HB_ERRCODE sddConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ); static HB_ERRCODE sddDisconnect( SQLDDCONNECTION * pConnection ); @@ -224,7 +224,7 @@ static HB_ERRCODE sddGetVarLen( SQLBASEAREAP pArea, HB_USHORT uiIndex, HB_ULONG } -/*==================== SDD registration =====================================*/ +/* --- SDD registration --- */ static PSDDNODE s_pSdd = NULL; @@ -263,7 +263,7 @@ int hb_sddRegister( PSDDNODE pSdd ) } -/*============= RDD METHODS =============================================================*/ +/* --- RDD METHODS --- */ static HB_ERRCODE sqlbaseGoBottom( SQLBASEAREAP pArea ) { @@ -310,13 +310,11 @@ static HB_ERRCODE sqlbaseGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ) static HB_ERRCODE sqlbaseGoToId( SQLBASEAREAP pArea, PHB_ITEM pItem ) { - PHB_ITEM pError; - if( HB_IS_NUMERIC( pItem ) ) return SELF_GOTO( &pArea->area, hb_itemGetNL( pItem ) ); else { - pError = hb_errNew(); + PHB_ITEM pError = hb_errNew(); hb_errPutGenCode( pError, EG_DATATYPE ); hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_DATATYPE ) ); hb_errPutSubCode( pError, EDBF_DATATYPE ); @@ -900,12 +898,12 @@ static HB_ERRCODE sqlbaseInit( LPRDDNODE pRDD ) static HB_ERRCODE sqlbaseExit( LPRDDNODE pRDD ) { - HB_ULONG ul; - HB_SYMBOL_UNUSED( pRDD ); if( s_pConnection ) { + HB_ULONG ul; + /* Disconnect all connections */ for( ul = 0; ul < s_ulConnectionCount; ul++ ) { @@ -1089,7 +1087,7 @@ static HB_ERRCODE sqlbaseRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ul } -/*====================================================================================*/ +/* --- */ static RDDFUNCS sqlbaseTable = { @@ -1196,7 +1194,7 @@ static RDDFUNCS sqlbaseTable = }; -/*================ Module initialization code ========================================*/ +/* --- Module initialization code --- */ HB_FUNC( SQLBASE ) { diff --git a/contrib/rddsql/sqlmix.c b/contrib/rddsql/sqlmix.c index 8827020f1d..3ea8fe8caf 100644 --- a/contrib/rddsql/sqlmix.c +++ b/contrib/rddsql/sqlmix.c @@ -90,21 +90,16 @@ static HB_USHORT s_uiRddIdSQLMIX = ( HB_USHORT ) -1; static RDDFUNCS sqlmixSuper; -/* - ======================================================================= - Misc functions - ======================================================================= - */ +/* --- Misc functions --- */ static HB_ERRCODE sqlmixErrorRT( SQLMIXAREAP pArea, HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, char * filename, HB_ERRCODE errOsCode, HB_USHORT uiFlags ) { - PHB_ITEM pError; HB_ERRCODE iRet = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { - pError = hb_errNew(); + PHB_ITEM pError = hb_errNew(); hb_errPutGenCode( pError, errGenCode ); hb_errPutSubCode( pError, errSubCode ); hb_errPutOsCode( pError, errOsCode ); @@ -120,13 +115,10 @@ static HB_ERRCODE sqlmixErrorRT( SQLMIXAREAP pArea, HB_ERRCODE errGenCode, HB_ER } -/* - ======================================================================= - Memory Index - ======================================================================= - */ +/* --- Memory Index --- */ + +/* --- Key management --- */ -/* -------------------------- Key management ---------------------------- */ /* hb_mixKey*() */ static PMIXKEY hb_mixKeyNew( PMIXTAG pTag ) @@ -293,7 +285,8 @@ static int hb_mixKeyCompare( PMIXTAG pTag, PMIXKEY pKey1, PMIXKEY pKey2, unsigne } -/* -------------------------- Tag management ---------------------------- */ +/* --- Tag management --- */ + /* hb_mixTag*() */ /* This function is used for debugging purposes. Uncomment it, if you need it. */ @@ -771,7 +764,7 @@ static PMIXTAG hb_mixTagCreate( const char * szTagName, PHB_ITEM pKeyExpr, PHB_I pTag->szKeyExpr = ( char * ) hb_xgrab( hb_itemGetCLen( pKeyExpr ) + 1 ); hb_strncpyTrim( pTag->szKeyExpr, hb_itemGetCPtr( pKeyExpr ), hb_itemGetCLen( pKeyExpr ) ); - /* TODO: FOR expresion */ + /* TODO: FOR expression */ pTag->szForExpr = NULL; pTag->pKeyItem = pKeyItem; @@ -1080,7 +1073,8 @@ static void hb_mixTagSkip( PMIXTAG pTag, HB_LONG lSkip ) } } -/* -------------------------- Misc functions ---------------------------- */ +/* --- Misc functions --- */ + /* hb_mix*() */ static PMIXTAG hb_mixFindTag( SQLMIXAREAP pArea, PHB_ITEM pOrder ) @@ -1110,20 +1104,20 @@ static PMIXTAG hb_mixFindTag( SQLMIXAREAP pArea, PHB_ITEM pOrder ) } -/*=======================================================================*/ +/* --- */ static HB_ULONG hb_mixTagNodeKeyCount( PMIXNODE pNode ) { - HB_ULONG ulKeyCount; - unsigned int ui; + HB_ULONG ulKeyCount = pNode->KeyCount; - ulKeyCount = pNode->KeyCount; if( ! pNode->Leaf ) { + unsigned int ui; for( ui = 0; ui <= pNode->KeyCount; ui++ ) ulKeyCount += hb_mixTagNodeKeyCount( pNode->Child[ ui ] ); } + return ulKeyCount; } @@ -1216,11 +1210,7 @@ static HB_ULONG hb_mixDBOIKeyNo( PMIXTAG pTag, HB_BOOL fFilter ) } -/* - ======================================================================= - SQLMIX RDD METHODS - ======================================================================= - */ +/* --- SQLMIX RDD METHODS --- */ static HB_ERRCODE sqlmixGoBottom( SQLMIXAREAP pArea ) { @@ -1809,7 +1799,7 @@ static HB_ERRCODE sqlmixOrderInfo( SQLMIXAREAP pArea, HB_USHORT uiIndex, LPDBORD break; case DBOI_NUMBER: - pOrderInfo->itmResult = hb_itemPutNI( pOrderInfo->itmResult, uiTag ); /* kitaip */ + pOrderInfo->itmResult = hb_itemPutNI( pOrderInfo->itmResult, uiTag ); /* otherwise */ break; case DBOI_ISCOND: diff --git a/contrib/sddfb/core.c b/contrib/sddfb/core.c index 7c7f3235a9..efd3430e23 100644 --- a/contrib/sddfb/core.c +++ b/contrib/sddfb/core.c @@ -51,12 +51,11 @@ #define __STDINT_H #endif -#include "hbapi.h" +#include "hbrddsql.h" + #include "hbapiitm.h" #include "hbvm.h" -#include "hbrddsql.h" - #include "ibase.h" typedef struct @@ -129,8 +128,8 @@ HB_CALL_ON_STARTUP_END( _hb_firebirddd_init_ ) #endif -/* ===================================================================================== */ -static HB_USHORT hb_errRT_FireBirdDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode ) +/* --- */ +static HB_USHORT hb_errRT_FirebirdDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode ) { HB_USHORT uiAction; PHB_ITEM pError; @@ -141,8 +140,7 @@ static HB_USHORT hb_errRT_FireBirdDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCo return uiAction; } -/* ============= SDD METHODS ============================================================= */ - +/* --- SDD METHODS --- */ static HB_ERRCODE fbConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) { ISC_STATUS_ARRAY status; @@ -172,7 +170,7 @@ static HB_ERRCODE fbConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) if( isc_attach_database( status, ( short ) hb_arrayGetCLen( pItem, 5 ), hb_arrayGetCPtr( pItem, 5 ), &hDb, ( short ) i, parambuf ) ) - /* TODO: error code in status[1]; */ + /* TODO: error code in status[ 1 ]; */ return HB_FAILURE; pConnection->pSDDConn = hb_xgrab( sizeof( SDDCONN ) ); ( ( SDDCONN * ) pConnection->pSDDConn )->hDb = hDb; @@ -213,7 +211,6 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea ) PHB_ITEM pItemEof, pItem; HB_BOOL bError; HB_USHORT uiFields, uiCount; - int iType; pArea->pSDDData = memset( hb_xgrab( sizeof( SDDDATA ) ), 0, sizeof( SDDDATA ) ); pSDDData = ( SDDDATA * ) pArea->pSDDData; @@ -228,13 +225,13 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea ) #if 0 HB_TRACE( HB_TR_ALWAYS, ( "hTrans=%d status=%ld %ld %ld %ld", ( int ) hTrans, ( long ) status[ 0 ], ( long ) status[ 1 ], ( long ) status[ 2 ], ( long ) status[ 3 ] ) ); #endif - hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_START, "Start transaction failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); + hb_errRT_FirebirdDD( EG_OPEN, ESQLDD_START, "Start transaction failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); return HB_FAILURE; } if( isc_dsql_allocate_statement( status, phDb, &hStmt ) ) { - hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_STMTALLOC, "Allocate statement failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); + hb_errRT_FirebirdDD( EG_OPEN, ESQLDD_STMTALLOC, "Allocate statement failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); isc_rollback_transaction( status, &hTrans ); return HB_FAILURE; } @@ -245,7 +242,7 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea ) if( isc_dsql_prepare( status, &hTrans, &hStmt, 0, pArea->szQuery, SQL_DIALECT_V5, pSqlda ) ) { - hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_INVALIDQUERY, "Prepare statement failed", pArea->szQuery, ( HB_ERRCODE ) isc_sqlcode( status ) ); + hb_errRT_FirebirdDD( EG_OPEN, ESQLDD_INVALIDQUERY, "Prepare statement failed", pArea->szQuery, ( HB_ERRCODE ) isc_sqlcode( status ) ); isc_dsql_free_statement( status, &hStmt, DSQL_drop ); isc_rollback_transaction( status, &hTrans ); hb_xfree( pSqlda ); @@ -254,7 +251,7 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea ) if( isc_dsql_execute( status, &hTrans, &hStmt, 1, NULL ) ) { - hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_EXECUTE, "Execute statement failed", pArea->szQuery, ( HB_ERRCODE ) isc_sqlcode( status ) ); + hb_errRT_FirebirdDD( EG_OPEN, ESQLDD_EXECUTE, "Execute statement failed", pArea->szQuery, ( HB_ERRCODE ) isc_sqlcode( status ) ); isc_dsql_free_statement( status, &hStmt, DSQL_drop ); isc_rollback_transaction( status, &hTrans ); hb_xfree( pSqlda ); @@ -271,7 +268,7 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea ) if( isc_dsql_describe( status, &hStmt, SQL_DIALECT_V5, pSqlda ) ) { - hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_STMTDESCR, "Describe statement failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); + hb_errRT_FirebirdDD( EG_OPEN, ESQLDD_STMTDESCR, "Describe statement failed", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); isc_dsql_free_statement( status, &hStmt, DSQL_drop ); isc_rollback_transaction( status, &hTrans ); hb_xfree( pSqlda ); @@ -292,8 +289,10 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea ) for( uiCount = 0, pVar = pSqlda->sqlvar; uiCount < uiFields; uiCount++, pVar++ ) { DBFIELDINFO dbFieldInfo; + int iType; + /* FIXME: if pVar->sqlname is ended with 0 byte then this hb_strndup() - * and hb_xfree() bewlow is redundant and + * and hb_xfree() below is redundant and * dbFieldInfo.atomName = pVar->sqlname; * is enough. */ @@ -319,7 +318,6 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea ) break; } - case SQL_VARYING: { char * pStr; @@ -425,7 +423,7 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea ) { hb_itemClear( pItemEof ); hb_itemRelease( pItemEof ); - hb_errRT_FireBirdDD( EG_CORRUPTION, ESQLDD_INVALIDFIELD, "Invalid field type", pArea->szQuery, 0 ); + hb_errRT_FirebirdDD( EG_CORRUPTION, ESQLDD_INVALIDFIELD, "Invalid field type", pArea->szQuery, 0 ); return HB_FAILURE; } @@ -557,14 +555,14 @@ static HB_ERRCODE fbGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ) pArea->fFetched = HB_TRUE; if( isc_dsql_free_statement( status, phStmt, DSQL_drop ) ) { - hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_STMTFREE, "Statement free error", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); + hb_errRT_FirebirdDD( EG_OPEN, ESQLDD_STMTFREE, "Statement free error", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); return HB_FAILURE; } pSDDData->hStmt = ( isc_stmt_handle ) 0; if( isc_commit_transaction( status, phTr ) ) { - hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_COMMIT, "Transaction commit error", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); + hb_errRT_FirebirdDD( EG_OPEN, ESQLDD_COMMIT, "Transaction commit error", NULL, ( HB_ERRCODE ) isc_sqlcode( status ) ); return HB_FAILURE; } pSDDData->hTrans = ( isc_tr_handle ) 0; @@ -575,7 +573,7 @@ static HB_ERRCODE fbGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ) } else { - hb_errRT_FireBirdDD( EG_OPEN, ESQLDD_FETCH, "Fetch error", NULL, ( HB_ERRCODE ) lErr ); + hb_errRT_FirebirdDD( EG_OPEN, ESQLDD_FETCH, "Fetch error", NULL, ( HB_ERRCODE ) lErr ); return HB_FAILURE; } } diff --git a/contrib/sddmy/core.c b/contrib/sddmy/core.c index 6b1deaed36..4e220c02a8 100644 --- a/contrib/sddmy/core.c +++ b/contrib/sddmy/core.c @@ -1,5 +1,5 @@ /* - * MySQL Database Driver + * MariaDB/MySQL Database Driver * * Copyright 2007 Mindaugas Kavaliauskas * @@ -44,12 +44,11 @@ * */ -#include "hbapi.h" +#include "hbrddsql.h" + #include "hbapiitm.h" #include "hbvm.h" -#include "hbrddsql.h" - #ifndef my_socket_defined #define my_socket_defined typedef int my_socket; @@ -138,7 +137,7 @@ HB_CALL_ON_STARTUP_END( _hb_mysqldd_init_ ) #endif -/*=====================================================================================*/ +/* --- */ static HB_USHORT hb_errRT_MySQLDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode ) { HB_USHORT uiAction; @@ -150,8 +149,7 @@ static HB_USHORT hb_errRT_MySQLDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, return uiAction; } -/*============= SDD METHODS =============================================================*/ - +/* --- SDD METHODS --- */ static HB_ERRCODE mysqlConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) { MYSQL * pMySql; @@ -329,17 +327,15 @@ static HB_ERRCODE mysqlOpen( SQLBASEAREAP pArea ) dbFieldInfo.uiLen = 4; break; -/* +#if 0 case MYSQL_TYPE_NULL: case MYSQL_TYPE_YEAR: case MYSQL_TYPE_NEWDATE: - case MYSQL_TYPE_ENUM: case MYSQL_TYPE_SET: case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_BIT: case MYSQL_TYPE_GEOMETRY: - */ - +#endif default: bError = HB_TRUE; errCode = ( HB_ERRCODE ) pMyField->type; @@ -397,9 +393,10 @@ static HB_ERRCODE mysqlOpen( SQLBASEAREAP pArea ) hb_arraySetForward( pItemEof, uiCount + 1, pItem ); hb_itemRelease( pItem ); -/* if( dbFieldInfo.uiType == HB_IT_DOUBLE || dbFieldInfo.uiType == HB_IT_INTEGER ) +#if 0 + if( dbFieldInfo.uiType == HB_IT_DOUBLE || dbFieldInfo.uiType == HB_IT_INTEGER ) dbFieldInfo.uiType = HB_IT_LONG; - */ +#endif if( ! bError ) bError = ( SELF_ADDFIELD( &pArea->area, &dbFieldInfo ) == HB_FAILURE ); @@ -490,7 +487,6 @@ static HB_ERRCODE mysqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM char * pValue; char szBuffer[ 64 ]; HB_BOOL bError; - PHB_ITEM pError; HB_SIZE nLen; bError = HB_FALSE; @@ -620,7 +616,7 @@ static HB_ERRCODE mysqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM if( bError ) { - pError = hb_errNew(); + PHB_ITEM pError = hb_errNew(); hb_errPutGenCode( pError, EG_DATATYPE ); hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_DATATYPE ) ); hb_errPutSubCode( pError, EDBF_DATATYPE ); diff --git a/contrib/sddoci/core.c b/contrib/sddoci/core.c index e7c815a2c2..89d1a3f29f 100644 --- a/contrib/sddoci/core.c +++ b/contrib/sddoci/core.c @@ -100,7 +100,6 @@ typedef struct OCI_Statement * pStmt; } SDDDATA; - static HB_ERRCODE ocilibConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ); static HB_ERRCODE ocilibDisconnect( SQLDDCONNECTION * pConnection ); static HB_ERRCODE ocilibExecute( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ); @@ -108,7 +107,6 @@ static HB_ERRCODE ocilibOpen( SQLBASEAREAP pArea ); static HB_ERRCODE ocilibClose( SQLBASEAREAP pArea ); static HB_ERRCODE ocilibGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ); - static SDDNODE s_ocidd = { NULL, @@ -169,9 +167,8 @@ HB_CALL_ON_STARTUP_END( _hb_ocidd_init_ ) HB_DATASEG_FUNC( _hb_ocidd_init_ ) #include "hbiniseg.h" #endif +/* --- */ - -/*=====================================================================================*/ static HB_USHORT hb_errRT_OCIDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode ) { PHB_ITEM pError; @@ -184,7 +181,6 @@ static HB_USHORT hb_errRT_OCIDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, c return uiAction; } - static char * ocilibGetError( HB_ERRCODE * pErrCode ) { OCI_Error * err = OCI_GetLastError(); @@ -202,7 +198,7 @@ static char * ocilibGetError( HB_ERRCODE * pErrCode ) } else { - szRet = hb_strdup( "Unable to get error message" ); + szRet = hb_strdup( "Could not get the error message" ); iNativeErr = 9999; } @@ -212,9 +208,7 @@ static char * ocilibGetError( HB_ERRCODE * pErrCode ) return szRet; } - -/*============= SDD METHODS =============================================================*/ - +/* --- SDD METHODS --- */ static HB_ERRCODE ocilibConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) { OCI_Connection * cn; @@ -240,7 +234,6 @@ static HB_ERRCODE ocilibConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) return HB_FAILURE; } - static HB_ERRCODE ocilibDisconnect( SQLDDCONNECTION * pConnection ) { HB_ERRCODE errCode; @@ -250,7 +243,6 @@ static HB_ERRCODE ocilibDisconnect( SQLDDCONNECTION * pConnection ) return errCode; } - static HB_ERRCODE ocilibExecute( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) { OCI_Statement * st = OCI_StatementCreate( ( ( SDDCONN * ) pConnection->pSDDConn )->pConn ); @@ -285,7 +277,6 @@ static HB_ERRCODE ocilibExecute( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) return HB_FAILURE; } - static HB_ERRCODE ocilibOpen( SQLBASEAREAP pArea ) { OCI_Statement * st = OCI_StatementCreate( ( ( SDDCONN * ) pArea->pConnection->pSDDConn )->pConn ); @@ -511,7 +502,6 @@ static HB_ERRCODE ocilibOpen( SQLBASEAREAP pArea ) return HB_SUCCESS; } - static HB_ERRCODE ocilibClose( SQLBASEAREAP pArea ) { SDDDATA * pSDDData = ( SDDDATA * ) pArea->pSDDData; @@ -527,7 +517,6 @@ static HB_ERRCODE ocilibClose( SQLBASEAREAP pArea ) return HB_SUCCESS; } - static HB_ERRCODE ocilibGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ) { OCI_Statement * st = ( ( SDDDATA * ) pArea->pSDDData )->pStmt; diff --git a/contrib/sddodbc/core.c b/contrib/sddodbc/core.c index 8a9c3373ec..066561ffac 100644 --- a/contrib/sddodbc/core.c +++ b/contrib/sddodbc/core.c @@ -44,43 +44,42 @@ * */ -#include "hbapi.h" +#include "hbrddsql.h" + #include "hbapiitm.h" #include "hbdate.h" #include "hbapistr.h" #include "hbset.h" #include "hbvm.h" -#include "hbrddsql.h" - /* Required by headers on Windows */ #if defined( HB_OS_WIN ) -# include + #include /* Required for WIN32_LEAN_AND_MEAN mode */ -# if ! defined( WIN32 ) -# define WIN32 -# endif + #if ! defined( WIN32 ) + #define WIN32 + #endif #endif #include #include #if ! defined( HB_OS_WIN ) -# if ! defined( SQLLEN ) && ! defined( SQLTCHAR ) && \ - ! defined( UODBCINT64 ) && ! defined( SIZEOF_LONG_INT ) -typedef unsigned char SQLTCHAR; -typedef long SQLLEN; -typedef unsigned long SQLULEN; -# ifndef SQL_WCHAR -# define SQL_WCHAR (-8) -# endif -# ifndef SQL_WVARCHAR -# define SQL_WVARCHAR (-9) -# endif -# ifndef SQL_WLONGVARCHAR -# define SQL_WLONGVARCHAR (-10) -# endif -# endif + #if ! defined( SQLLEN ) && ! defined( SQLTCHAR ) && \ + ! defined( UODBCINT64 ) && ! defined( SIZEOF_LONG_INT ) + typedef unsigned char SQLTCHAR; + typedef long SQLLEN; + typedef unsigned long SQLULEN; + #ifndef SQL_WCHAR + #define SQL_WCHAR ( -8 ) + #endif + #ifndef SQL_WVARCHAR + #define SQL_WVARCHAR ( -9 ) + #endif + #ifndef SQL_WLONGVARCHAR + #define SQL_WLONGVARCHAR ( -10 ) + #endif + #endif #endif #if defined( UNICODE ) @@ -177,7 +176,7 @@ HB_CALL_ON_STARTUP_END( _hb_odbcdd_init_ ) #endif -/*=====================================================================================*/ +/* --- */ static HB_USHORT hb_errRT_ODBCDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode ) { HB_USHORT uiAction; @@ -208,7 +207,7 @@ static char * odbcGetError( SQLHENV hEnv, SQLHDBC hConn, SQLHSTMT hStmt, HB_ERRC hb_itemRelease( pRet ); } else - szRet = hb_strdup( "HY000 Unable to get error message" ); + szRet = hb_strdup( "HY000 Could not get the error message" ); if( pErrCode ) *pErrCode = ( HB_ERRCODE ) iNativeErr; @@ -216,8 +215,7 @@ static char * odbcGetError( SQLHENV hEnv, SQLHDBC hConn, SQLHSTMT hStmt, HB_ERRC } -/*============= SDD METHODS =============================================================*/ - +/* --- SDD METHODS --- */ static HB_ERRCODE odbcConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) { SQLHENV hEnv = NULL; @@ -480,7 +478,7 @@ static HB_ERRCODE odbcOpen( SQLBASEAREAP pArea ) /* We do mapping of many SQL types to one Harbour field type here, so, we need store real SQL type in uiTypeExtended. SQL types are signed, so, HB_USHORT type casting - is a little hacky. We need to remember use this casting also in expressions like + is a little hackish. We need to remember use this casting also in expressions like this: if( pField->uiTypeExtended == ( HB_USHORT ) SQL_BIGINT ) or introduce our own unsigned SQL types. diff --git a/contrib/sddpg/core.c b/contrib/sddpg/core.c index 4af7e6858f..f120e29fad 100644 --- a/contrib/sddpg/core.c +++ b/contrib/sddpg/core.c @@ -45,12 +45,11 @@ */ -#include "hbapi.h" +#include "hbrddsql.h" + #include "hbapiitm.h" #include "hbvm.h" -#include "hbrddsql.h" - #include "libpq-fe.h" #define BOOLOID 16 @@ -149,7 +148,7 @@ HB_CALL_ON_STARTUP_END( _hb_sddpostgre_init_ ) #endif -/* ===================================================================================== */ +/* --- */ static HB_USHORT hb_errRT_PostgreSQLDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode ) { HB_USHORT uiAction; @@ -162,8 +161,7 @@ static HB_USHORT hb_errRT_PostgreSQLDD( HB_ERRCODE errGenCode, HB_ERRCODE errSub } -/* ============= SDD METHODS ============================================================= */ - +/* --- SDD METHODS --- */ static HB_ERRCODE pgsqlConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) { PGconn * pConn; @@ -387,7 +385,9 @@ static HB_ERRCODE pgsqlOpen( SQLBASEAREAP pArea ) bError = HB_TRUE; break; } - /* printf( "field:%s \ttype:%d \tsize:%d \tformat:%d \tmod:%d err=%d\n", dbFieldInfo.atomName, PQftype( pResult, ( int ) uiCount ), PQfsize( pResult, uiCount ), PQfformat( pResult, uiCount ) , PQfmod( pResult, uiCount ), bError ); */ +#if 0 + HB_TRACE( HB_TR_ALWAYS, ( "field:%s type=%d size=%d format=%d mod=%d err=%d", dbFieldInfo.atomName, PQftype( pResult, ( int ) uiCount ), PQfsize( pResult, uiCount ), PQfformat( pResult, uiCount ), PQfmod( pResult, uiCount ), bError ) ); +#endif if( ! bError ) { @@ -438,9 +438,10 @@ static HB_ERRCODE pgsqlOpen( SQLBASEAREAP pArea ) hb_arraySetForward( pItemEof, uiCount + 1, pItem ); -/* if( dbFieldInfo.uiType == HB_IT_DOUBLE || dbFieldInfo.uiType == HB_IT_INTEGER ) +#if 0 + if( dbFieldInfo.uiType == HB_IT_DOUBLE || dbFieldInfo.uiType == HB_IT_INTEGER ) dbFieldInfo.uiType = HB_IT_LONG; - */ +#endif if( ! bError ) bError = ( SELF_ADDFIELD( &pArea->area, &dbFieldInfo ) == HB_FAILURE ); @@ -496,7 +497,6 @@ static HB_ERRCODE pgsqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM LPFIELD pField; char * pValue; HB_BOOL bError; - PHB_ITEM pError; HB_SIZE nLen; bError = HB_FALSE; @@ -504,13 +504,18 @@ static HB_ERRCODE pgsqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pField = pArea->area.lpFields + uiIndex; if( PQgetisnull( pSDDData->pResult, pArea->ulRecNo - 1, uiIndex ) ) - /* TOFIX: it breaks defined field type */ + { + hb_itemClear( pItem ); + /* FIXME: it breaks defined field type */ return HB_SUCCESS; + } pValue = PQgetvalue( pSDDData->pResult, pArea->ulRecNo - 1, uiIndex ); nLen = ( HB_SIZE ) PQgetlength( pSDDData->pResult, pArea->ulRecNo - 1, uiIndex ); -/* printf( "fieldget recno:%d index:%d value:%s len:%d\n", pArea->ulRecNo, uiIndex, pValue, nLen ); */ +#if 0 + HB_TRACE( HB_TR_ALWAYS, ( "fieldget recno=%d index=%d value=%s len=%d", dbFieldInfo.atomName, PQftype( pResult, ( int ) uiCount ), pArea->ulRecNo, uiIndex, pValue, nLen ) ); +#endif switch( pField->uiType ) { @@ -542,7 +547,6 @@ static HB_ERRCODE pgsqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM hb_itemPutL( pItem, pValue[ 0 ] == 'T' || pValue[ 0 ] == 'Y' ); break; - case HB_FT_DATE: { char szDate[ 9 ]; @@ -567,7 +571,7 @@ static HB_ERRCODE pgsqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM if( bError ) { - pError = hb_errNew(); + PHB_ITEM pError = hb_errNew(); hb_errPutGenCode( pError, EG_DATATYPE ); hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_DATATYPE ) ); hb_errPutSubCode( pError, EDBF_DATATYPE ); diff --git a/contrib/sddsqlt3/core.c b/contrib/sddsqlt3/core.c index 8373640249..4459679b1a 100644 --- a/contrib/sddsqlt3/core.c +++ b/contrib/sddsqlt3/core.c @@ -44,15 +44,15 @@ * */ -#include "hbapi.h" +#include "hbrddsql.h" + #include "hbapiitm.h" #include "hbapistr.h" #include "hbdate.h" +#include "hbset.h" #include "hbvm.h" #include "hbset.h" -#include "hbrddsql.h" - #include #define S_HB_ARRAYGETSTR( arr, n, phstr, plen ) hb_arrayGetStrUTF8( arr, n, phstr, plen ) @@ -78,7 +78,6 @@ static HB_ERRCODE sqlite3Open( SQLBASEAREAP pArea ); static HB_ERRCODE sqlite3Close( SQLBASEAREAP pArea ); static HB_ERRCODE sqlite3GoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ); - static SDDNODE s_sqlt3dd = { NULL, @@ -93,7 +92,6 @@ static SDDNODE s_sqlt3dd = ( SDDFUNC_GETVARLEN ) NULL }; - static void hb_sqlt3dd_init( void * cargo ) { HB_SYMBOL_UNUSED( cargo ); @@ -144,8 +142,7 @@ HB_CALL_ON_STARTUP_END( _hb_sqlt3dd_init_ ) #include "hbiniseg.h" #endif - -/*=====================================================================================*/ +/* --- */ static HB_USHORT hb_errRT_SQLT3DD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode ) { PHB_ITEM pError; @@ -158,7 +155,6 @@ static HB_USHORT hb_errRT_SQLT3DD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, return uiAction; } - static char * sqlite3GetError( sqlite3 * pDb, HB_ERRCODE * pErrCode ) { char * szRet; @@ -174,7 +170,7 @@ static char * sqlite3GetError( sqlite3 * pDb, HB_ERRCODE * pErrCode ) } else { - szRet = hb_strdup( "Unable to get error message" ); + szRet = hb_strdup( "Could not get the error message" ); iNativeErr = 9999; } @@ -236,9 +232,7 @@ static HB_USHORT sqlite3DeclType(sqlite3_stmt * st, HB_USHORT uiIndex ) #endif } - -/*============= SDD METHODS =============================================================*/ - +/* --- SDD METHODS --- */ static HB_ERRCODE sqlite3Connect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem ) { sqlite3 * db; @@ -257,7 +251,6 @@ static HB_ERRCODE sqlite3Connect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem return db ? HB_SUCCESS : HB_FAILURE; } - static HB_ERRCODE sqlite3Disconnect( SQLDDCONNECTION * pConnection ) { HB_ERRCODE errCode; @@ -355,6 +348,12 @@ static HB_ERRCODE sqlite3Open( SQLBASEAREAP pArea ) dbFieldInfo.uiType = sqlite3DeclType( st, uiIndex ); pItem = hb_arrayGetItemPtr( pItemEof, uiIndex + 1 ); + /* There are no field length limits stored in the SQLite3 database, + so we're resorting to setting some arbitrary default values to + make apps relying on these (f.e. Browse()/GET) to behave somewhat + better. For better results, update apps to untie UI metrics from + any database field/value widths. [vszakats] */ + switch( dbFieldInfo.uiType ) { case HB_FT_STRING: @@ -421,7 +420,6 @@ static HB_ERRCODE sqlite3Open( SQLBASEAREAP pArea ) return HB_SUCCESS; } - static HB_ERRCODE sqlite3Close( SQLBASEAREAP pArea ) { SDDDATA * pSDDData = ( SDDDATA * ) pArea->pSDDData; @@ -437,7 +435,6 @@ static HB_ERRCODE sqlite3Close( SQLBASEAREAP pArea ) return HB_SUCCESS; } - static HB_ERRCODE sqlite3GoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ) { sqlite3_stmt * st = ( ( SDDDATA * ) pArea->pSDDData )->pStmt; diff --git a/contrib/xhb/arrayblk.prg b/contrib/xhb/arrayblk.prg index 59caed6dad..185061c653 100644 --- a/contrib/xhb/arrayblk.prg +++ b/contrib/xhb/arrayblk.prg @@ -1,5 +1,5 @@ /* - * HB_ArrayBlk function + * hb_ArrayBlock() function * * Copyright 2003 Walter Negro * @@ -44,7 +44,5 @@ * */ - FUNCTION hb_ArrayBlock( aArray, nIndex ) - RETURN {| x | iif( PCount() == 0, aArray[ nIndex ], aArray[ nIndex ] := x ) } diff --git a/contrib/xhb/bkgtsks.c b/contrib/xhb/bkgtsks.c index 31286f1301..df29f2b058 100644 --- a/contrib/xhb/bkgtsks.c +++ b/contrib/xhb/bkgtsks.c @@ -53,11 +53,11 @@ #include "error.ch" #if defined( HB_OS_UNIX ) -#if defined( HB_OS_DARWIN ) - #include /* We need usleep() in Darwin */ -#else - #include -#endif + #if defined( HB_OS_DARWIN ) + #include /* We need usleep() in Darwin */ + #else + #include + #endif #endif HB_EXTERN_BEGIN @@ -435,7 +435,7 @@ HB_FUNC( HB_BACKGROUNDACTIVE ) if( s_pBackgroundTasks && HB_ISNUM( 1 ) ) { /* TODO: access to pointers from harbour code */ - bOldActive = hb_backgroundActive( hb_parnl( 1 ), hb_parldef( 2, 1 ) ); + bOldActive = hb_backgroundActive( hb_parnl( 1 ), hb_parldef( 2, HB_TRUE ) ); } hb_retl( bOldActive ); /* return old active value */ diff --git a/contrib/xhb/cgi.ch b/contrib/xhb/cgi.ch index 2881a2b777..7cbb776d11 100644 --- a/contrib/xhb/cgi.ch +++ b/contrib/xhb/cgi.ch @@ -2,6 +2,7 @@ * common includes for cgi lib * * Copyright 2000 Manos Aspradakis + * Copyright 2000 Luiz Rafael Culik (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,18 +45,8 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #xtranslate Default(

, ) =>

:= iif(

== NIL, ,

) -#xtranslate HTMLSpace( ) => Replicate( " ", ) //" " +#xtranslate HTMLSpace( ) => Replicate( " ", ) // " " #xtranslate CRLF() => Chr( 13 ) + Chr( 10 ) #define STD_IN 0 diff --git a/contrib/xhb/classex.ch b/contrib/xhb/classex.ch index cf01a4011f..c39ade127a 100644 --- a/contrib/xhb/classex.ch +++ b/contrib/xhb/classex.ch @@ -68,7 +68,7 @@ - value = initial value of var - - pos = index is a powerfull access method. You can use same method to get/set + - pos = index is a powerful access method. You can use same method to get/set data, but trough index you can access to correct data. example: .... diff --git a/contrib/xhb/cstruct.ch b/contrib/xhb/cstruct.ch index b23e2d6945..db544d9a00 100644 --- a/contrib/xhb/cstruct.ch +++ b/contrib/xhb/cstruct.ch @@ -1,4 +1,5 @@ /* + * CStruct header * * Copyright 2000 Ron Pinkas * @@ -60,13 +61,11 @@ // instead of to allow ElemName[n] syntax. #xcommand MEMBER IS => hb_Member( #, ) - /* - Will match: + /* Will match: MEMBER IS due to expansion of: #xtranslate IS [...] => := hb_CStructure( # ):Init( {} ) - as established by C STRUCTURE #xcommand for the given structure. - */ + as established by C STRUCTURE #xcommand for the given structure. */ #xcommand MEMBER := hb_CStructure( ):Init( {} ) => ; hb_Member( #, hb_CStructureId( , .T. ) ) @@ -83,13 +82,11 @@ #xtranslate IS \[ \ { \ } ] => := hb_CStructure( # ):Init( {\} ); ; #xtranslate IS FROM \ => := hb_CStructure( # ):Buffer( \ ) - //----------------------------- C Syntax support ---------------------------------// + /* C Syntax support */ + /* NOTES: - - 1. #pragma pack() needs to be translated to pragma pack() without the <#>. - - 2. First line must end with <;> so the whole definition is a single PRG line! - */ + 1. #pragma pack() needs to be translated to pragma pack() without the <#>. + 2. First line must end with <;> so the whole definition is a single PRG line! */ #define __PACK 8 diff --git a/contrib/xhb/cstruct.prg b/contrib/xhb/cstruct.prg index 00033b7b95..b50d668969 100644 --- a/contrib/xhb/cstruct.prg +++ b/contrib/xhb/cstruct.prg @@ -52,7 +52,7 @@ THREAD STATIC t_aActiveStructure -/* TOFIX: Add mutex protection for variables below. */ +/* FIXME: Add mutex protection for variables below. */ STATIC s_aClasses := {} STATIC s_aArrayClasses := {} STATIC s_aSynonyms := {} @@ -68,8 +68,6 @@ PROCEDURE __init_LONGLONGs() RETURN -// - FUNCTION __ActiveStructure( cStructure, nAlign ) #if 0 @@ -153,8 +151,6 @@ FUNCTION __ActiveStructure( cStructure, nAlign ) RETURN t_aActiveStructure -// - PROCEDURE hb_Member( cMember, CType ) LOCAL nLen, nAt @@ -174,8 +170,6 @@ PROCEDURE hb_Member( cMember, CType ) RETURN -// - FUNCTION hb_CStructureId( cStructure, lInplace ) LOCAL nID @@ -183,11 +177,8 @@ FUNCTION hb_CStructureId( cStructure, lInplace ) cStructure := Upper( cStructure ) - nID := AScan( s_aClasses, {| aClassInfo | aClassInfo[ 1 ] == cStructure } ) - - IF nID == 0 - nID := AScan( s_aSynonyms, {| aSynonym | aSynonym[ 1 ] == cStructure } ) - IF nID == 0 + IF ( nID := AScan( s_aClasses, {| aClassInfo | aClassInfo[ 1 ] == cStructure } ) ) == 0 + IF ( nID := AScan( s_aSynonyms, {| aSynonym | aSynonym[ 1 ] == cStructure } ) ) == 0 oErr := ErrorNew() oErr:Args := { cStructure, lInplace } oErr:CanDefault := .F. @@ -213,8 +204,6 @@ FUNCTION hb_CStructureId( cStructure, lInplace ) RETURN nID -// - PROCEDURE hb_CStructureCSyntax( cStructure, aDefinitions, cTag, cSynonList, nAlign ) LOCAL cElem, nAt, nIndex := 1 @@ -223,7 +212,7 @@ PROCEDURE hb_CStructureCSyntax( cStructure, aDefinitions, cTag, cSynonList, nAli LOCAL nID, cSynon FOR EACH cElem IN aDefinitions - // *** PP bug - remove when possible! *** + IF cElem == NIL ASize( aDefinitions, nIndex - 1 ) EXIT @@ -306,8 +295,6 @@ PROCEDURE hb_CStructureCSyntax( cStructure, aDefinitions, cTag, cSynonList, nAli RETURN -// - FUNCTION hb_CStructure( cStructure, nAlign ) LOCAL hClass @@ -316,9 +303,8 @@ FUNCTION hb_CStructure( cStructure, nAlign ) LOCAL oErr cStructure := Upper( cStructure ) - nID := AScan( s_aClasses, {| aClassInfo | aClassInfo[ 1 ] == cStructure } ) - IF nID == 0 + IF ( nID := AScan( s_aClasses, {| aClassInfo | aClassInfo[ 1 ] == cStructure } ) ) == 0 oErr := ErrorNew() oErr:Args := { cStructure, nAlign } oErr:CanDefault := .F. @@ -340,8 +326,6 @@ FUNCTION hb_CStructure( cStructure, nAlign ) RETURN oStructure -// - STATIC PROCEDURE AllocateMembers( oStructure ) LOCAL aCTypes, CType @@ -361,8 +345,6 @@ STATIC PROCEDURE AllocateMembers( oStructure ) RETURN -// - FUNCTION hb_CStructureFromId( nID, nAlign ) LOCAL hClass, oStructure @@ -400,8 +382,6 @@ FUNCTION hb_CStructureFromId( nID, nAlign ) RETURN oStructure -// - FUNCTION hb_CTypeArrayId( CType, nLen ) LOCAL hClass @@ -410,9 +390,8 @@ FUNCTION hb_CTypeArrayId( CType, nLen ) LOCAL aCTypes, acMembers, cMember LOCAL cArrayClassName := "C Array of [" + hb_ntos( nLen ) + "] CType: " + Str( CType ) - nID := AScan( s_aArrayClasses, {| aArrayDefinitions | aArrayDefinitions[ 1 ] == CType .AND. aArrayDefinitions[ 2 ] == nLen } ) + IF ( nID := AScan( s_aArrayClasses, {| aArrayDefinitions | aArrayDefinitions[ 1 ] == CType .AND. aArrayDefinitions[ 2 ] == nLen } ) ) == 0 - IF nID == 0 hClass := __clsNew( "C Structure " + cArrayClassName, nLen + CLASS_PROPERTIES ) // __clsDelMsg( hClass, "C" ) @@ -440,13 +419,13 @@ FUNCTION hb_CTypeArrayId( CType, nLen ) __clsAddMsg( hClass, "CopyTo" , @__CStr_CopyTo() , HB_OO_MSG_METHOD ) // IF Abs( CType ) == 1 - __clsAddMsg( hClass, "AsString", @AsString() , HB_OO_MSG_METHOD ) + __clsAddMsg( hClass, "AsString", @AsString(), HB_OO_MSG_METHOD ) // ENDIF FOR Counter := 1 TO nLen cMember := hb_ntos( Counter ) acMembers[ Counter ] := cMember - __clsAddMsg( hClass, cMember, Counter, HB_OO_MSG_PROPERTY ) + __clsAddMsg( hClass, cMember, Counter, HB_OO_MSG_PROPERTY ) NEXT __clsAddMsg( hClass, "aCTypes" , Counter++, HB_OO_MSG_PROPERTY, aCTypes ) @@ -464,14 +443,9 @@ FUNCTION hb_CTypeArrayId( CType, nLen ) RETURN nID + CTYPE_STRUCTURE -// - FUNCTION hb_Is_CStructure( x ) - RETURN Left( x:ClassName(), 11 ) == "C Structure" -// - STATIC FUNCTION SayMembers( cPad, lShowMembers, lReturnString ) LOCAL xProperty, cOut := "" @@ -513,8 +487,6 @@ STATIC FUNCTION SayMembers( cPad, lShowMembers, lReturnString ) RETURN iif( lReturnString, cOut, QSelf() ) -// - STATIC FUNCTION Reset() LOCAL xProperty, nProperties := Len( QSelf() ) - CLASS_PROPERTIES @@ -533,8 +505,6 @@ STATIC FUNCTION Reset() RETURN QSelf() -// - STATIC FUNCTION Buffer( Buffer, lAdopt ) IF HB_ISSTRING( Buffer ) @@ -553,16 +523,12 @@ STATIC FUNCTION Buffer( Buffer, lAdopt ) RETURN QSelf() -// - STATIC FUNCTION GetPointer() QSelf():InternalBuffer := hb_ArrayToStructure( QSelf(), QSelf():aCTypes, QSelf():nAlign ) RETURN hb_String2Pointer( QSelf():InternalBuffer ) -// - STATIC FUNCTION Value() #if 0 @@ -575,8 +541,6 @@ STATIC FUNCTION Value() RETURN QSelf():InternalBuffer -// - STATIC FUNCTION DeValue( lAdopt ) #if 0 @@ -601,8 +565,6 @@ STATIC FUNCTION DeValue( lAdopt ) RETURN QSelf() -// - STATIC FUNCTION ArrayMethod() LOCAL aValues := {} @@ -611,8 +573,6 @@ STATIC FUNCTION ArrayMethod() RETURN aValues -// - STATIC FUNCTION Init( aValues ) LOCAL xProperty, nLen := Len( aValues ) @@ -631,8 +591,6 @@ STATIC FUNCTION Init( aValues ) RETURN QSelf() -// - STATIC FUNCTION Pointer( nNewPointer, lAdopt ) IF nNewPointer != NIL @@ -641,8 +599,6 @@ STATIC FUNCTION Pointer( nNewPointer, lAdopt ) RETURN QSelf() -// - STATIC FUNCTION AsString() LOCAL cChar, nLen := Len( QSelf() ) - CLASS_PROPERTIES, cString := Space( nLen ) diff --git a/contrib/xhb/cstructc.c b/contrib/xhb/cstructc.c index a456372bd6..284276e2fe 100644 --- a/contrib/xhb/cstructc.c +++ b/contrib/xhb/cstructc.c @@ -44,7 +44,7 @@ * */ -#include "hbvmint.h" /* TOFIX: clean the code to not access any internal HVM structures */ +#include "hbvmint.h" /* FIXME: clean the code to not access any internal HVM structures */ #include "hbapi.h" #include "hbvm.h" #include "hbstack.h" @@ -57,7 +57,7 @@ static PHB_ITEM hb_itemPutCRaw( PHB_ITEM pItem, const char * szText, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCRaw(%p, %s, %" HB_PFS "u)", pItem, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCRaw(%p, %s, %" HB_PFS "u)", ( void * ) pItem, szText, nLen ) ); if( pItem ) { @@ -84,7 +84,7 @@ static PHB_ITEM hb_itemPutCRaw( PHB_ITEM pItem, const char * szText, HB_SIZE nLe #undef hb_itemPutCRawStatic static PHB_ITEM hb_itemPutCRawStatic( PHB_ITEM pItem, const char * szText, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCRawStatic(%p, %s, %" HB_PFS "u)", pItem, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCRawStatic(%p, %s, %" HB_PFS "u)", ( void * ) pItem, szText, nLen ) ); if( pItem ) { @@ -234,21 +234,16 @@ static HB_UINT SizeOfCStructure( PHB_ITEM aDef, HB_UINT uiAlign ) uiPad = ( ( uiMemberSize < uiAlign ) ? uiMemberSize : uiAlign ); if( ( cShift = ( HB_BYTE ) ( uiSize % uiPad ) ) > 0 ) - { - uiSize += ( uiPad - cShift ); - } + uiSize += uiPad - cShift; } uiSize += uiMemberSize; /* printf( "#%" HB_PFS "u Size: %u Align: %u Pad: %u Shift %i Size: %u\n", nIndex, uiMemberSize, uiAlign, uiPad, cShift, uiSize ); */ - } if( ( cShift = ( HB_BYTE ) ( uiSize % uiAlign ) ) > 0 ) - { - uiSize += ( uiAlign - cShift ); - } + uiSize += uiAlign - cShift; /* printf( "#%" HB_PFS "u Size: %u Align: %u Pad: %u Shift %i Size: %u\n", nIndex, uiMemberSize, uiAlign, uiPad, cShift, uiSize ); */ @@ -257,27 +252,22 @@ static HB_UINT SizeOfCStructure( PHB_ITEM aDef, HB_UINT uiAlign ) HB_FUNC( HB_SIZEOFCSTRUCTURE ) { - PHB_ITEM aDef = hb_param( 1, HB_IT_ARRAY ); - PHB_ITEM pAlign = hb_param( 2, HB_IT_INTEGER ); - HB_UINT uiAlign; + PHB_ITEM aDef = hb_param( 1, HB_IT_ARRAY ); if( aDef ) { + PHB_ITEM pAlign = hb_param( 2, HB_IT_INTEGER ); + HB_UINT uiAlign; + if( pAlign ) - { uiAlign = ( HB_BYTE ) pAlign->item.asInteger.value; - } else - { uiAlign = 8; - } hb_retni( SizeOfCStructure( aDef, uiAlign ) ); } else - { hb_errRT_BASE( EG_ARG, 2023, NULL, "SizeOfCStructure", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); - } } static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign, HB_UINT * puiSize ) @@ -481,9 +471,7 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign HB_UINT uiPad = ( ( uiMemberSize < uiAlign ) ? uiMemberSize : uiAlign ); if( ( cShift = ( HB_BYTE ) ( uiOffset % uiPad ) ) > 0 ) - { - uiOffset += ( uiPad - cShift ); - } + uiOffset += uiPad - cShift; } /* printf( "* Size: %i Offset: %i\n", uiMemberSize, uiOffset ); */ @@ -492,24 +480,16 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign { case CTYPE_CHAR: /* char */ if( ( pBaseVar->pItems + nIndex )->type ) - { *( ( char * ) ( Buffer + uiOffset ) ) = ( char ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); - } else - { *( ( char * ) ( Buffer + uiOffset ) ) = 0; - } break; case CTYPE_UNSIGNED_CHAR: /* unsigned char */ if( ( pBaseVar->pItems + nIndex )->type ) - { *( ( HB_BYTE * ) ( Buffer + uiOffset ) ) = ( HB_BYTE ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); - } else - { *( ( HB_BYTE * ) ( Buffer + uiOffset ) ) = 0; - } break; case CTYPE_CHAR_PTR: /* char * */ @@ -565,21 +545,13 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign case CTYPE_SHORT: /* short */ if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) - { *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) - { *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) - { *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) - { *( ( short * ) ( Buffer + uiOffset ) ) = 0; - } else { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); @@ -589,21 +561,13 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign case CTYPE_UNSIGNED_SHORT: /* unsigned short */ if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) - { *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) - { *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) - { *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) - { *( ( unsigned short * ) ( Buffer + uiOffset ) ) = 0; - } else { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); @@ -657,21 +621,13 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign case CTYPE_INT: /* int */ if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) - { *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) - { *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) - { *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) - { *( ( int * ) ( Buffer + uiOffset ) ) = 0; - } else { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); @@ -681,21 +637,13 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign case CTYPE_UNSIGNED_INT: /* unsigned int */ if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) - { *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) - { *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) - { *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) - { *( ( unsigned int * ) ( Buffer + uiOffset ) ) = 0; - } else { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); @@ -750,21 +698,13 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign case CTYPE_LONG: /* long */ if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) - { *( ( long * ) ( Buffer + uiOffset ) ) = ( long ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) - { *( ( long * ) ( Buffer + uiOffset ) ) = ( long ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) - { *( ( long * ) ( Buffer + uiOffset ) ) = ( long ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) - { *( ( long * ) ( Buffer + uiOffset ) ) = 0; - } else { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); @@ -774,21 +714,13 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign case CTYPE_UNSIGNED_LONG: /* unsigned long */ if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) - { *( ( unsigned long * ) ( Buffer + uiOffset ) ) = ( unsigned long ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) - { *( ( unsigned long * ) ( Buffer + uiOffset ) ) = ( unsigned long ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) - { *( ( unsigned long * ) ( Buffer + uiOffset ) ) = ( unsigned long ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); - } else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) - { *( ( unsigned long * ) ( Buffer + uiOffset ) ) = 0; - } else { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); @@ -842,13 +774,9 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign case CTYPE_FLOAT: /* float */ if( ( pBaseVar->pItems + nIndex )->type ) - { *( ( float * ) ( Buffer + uiOffset ) ) = ( float ) ( pBaseVar->pItems + nIndex )->item.asDouble.value; - } else - { *( ( float * ) ( Buffer + uiOffset ) ) = 0; - } break; case CTYPE_FLOAT_PTR: /* float * */ @@ -880,13 +808,9 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign case CTYPE_DOUBLE: /* double */ if( ( pBaseVar->pItems + nIndex )->type ) - { *( ( double * ) ( Buffer + uiOffset ) ) = ( pBaseVar->pItems + nIndex )->item.asDouble.value; - } else - { *( ( double * ) ( Buffer + uiOffset ) ) = 0; - } break; case CTYPE_DOUBLE_PTR: /* double * */ @@ -946,38 +870,25 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign if( HB_IS_LONG( pStructure ) ) { if( ( pBaseDef->pItems + nIndex )->item.asInteger.value > CTYPE_STRUCTURE_PTR ) - { *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) ( HB_PTRUINT ) pStructure->item.asLong.value; - } else - { memcpy( ( void * ) ( Buffer + uiOffset ), ( void * ) ( HB_PTRUINT ) pStructure->item.asLong.value, uiMemberSize ); - } } #if UINT_MAX == ULONG_MAX else if( HB_IS_INTEGER( pStructure ) ) { if( ( pBaseDef->pItems + nIndex )->item.asInteger.value > CTYPE_STRUCTURE_PTR ) - { *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) ( HB_PTRUINT ) pStructure->item.asInteger.value; - } else - { memcpy( ( void * ) ( Buffer + uiOffset ), ( void * ) ( HB_PTRUINT ) pStructure->item.asInteger.value, uiMemberSize ); - } } #endif else if( HB_IS_NIL( pStructure ) ) { if( ( pBaseDef->pItems + nIndex )->item.asInteger.value > CTYPE_STRUCTURE_PTR ) - { *( ( void ** ) ( Buffer + uiOffset ) ) = NULL; - } else - { - /* TraceLog( NULL,"ArrayToStructure() - Empty Inplace\n" ); */ memset( ( void * ) ( Buffer + uiOffset ), 0, uiMemberSize ); - } } else if( strncmp( hb_objGetClsName( pStructure ), "C Structure", 11 ) == 0 ) { @@ -987,23 +898,15 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign hb_objSendMsg( pStructure, "VALUE", 0 ); if( ( pBaseDef->pItems + nIndex )->item.asInteger.value > CTYPE_STRUCTURE_PTR ) - { *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) pInternalBuffer->item.asString.value; - } else - { memcpy( ( void * ) ( Buffer + uiOffset ), ( void * ) pInternalBuffer->item.asString.value, uiMemberSize ); - } } else - { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); - } } else - { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); - } } /* printf( "Wrote %i bytes at Offset %i\n", uiMemberSize, uiOffset ); */ @@ -1027,21 +930,16 @@ HB_FUNC( HB_ARRAYTOSTRUCTURE ) HB_BYTE * Buffer; if( pAlign ) - { uiAlign = ( HB_BYTE ) pAlign->item.asInteger.value; - } else - { uiAlign = 8; - } Buffer = ArrayToStructure( aVar, aDef, uiAlign, &uiSize ); + hb_retclen_buffer( ( char * ) Buffer, uiSize ); } else - { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); - } } static PHB_ITEM StructureToArray( HB_BYTE * Buffer, HB_SIZE nBufferLen, PHB_ITEM aDef, HB_UINT uiAlign, HB_BOOL bAdoptNested, PHB_ITEM pRet ) @@ -1051,10 +949,12 @@ static PHB_ITEM StructureToArray( HB_BYTE * Buffer, HB_SIZE nBufferLen, PHB_ITEM HB_SIZE nIndex; HB_UINT uiOffset, uiMemberSize; HB_BYTE cShift; - /* PHB_ITEM pRet = hb_itemNew( NULL ); */ +#if 0 + PHB_ITEM pRet = hb_itemNew( NULL ); +#endif PHB_BASEARRAY pBaseVar; - /* TraceLog( NULL, "StructureToArray(%p, %p, %u, %i) ->%u\n", Buffer, aDef, uiAlign, bAdoptNested, nLen ); */ + /* TraceLog( NULL, "StructureToArray(%p, %p, %u, %i) ->%u\n", ( const void * ) Buffer, ( void * ) aDef, uiAlign, bAdoptNested, nLen ); */ /* hb_arrayNew( pRet, nLen ); */ pBaseVar = pRet->item.asArray.value; @@ -1161,9 +1061,7 @@ static PHB_ITEM StructureToArray( HB_BYTE * Buffer, HB_SIZE nBufferLen, PHB_ITEM HB_UINT uiPad = ( ( uiMemberSize < uiAlign ) ? uiMemberSize : uiAlign ); if( ( cShift = ( HB_BYTE ) ( uiOffset % uiPad ) ) > 0 ) - { - uiOffset += ( uiPad - cShift ); - } + uiOffset += uiPad - cShift; /* TraceLog( NULL, "* Size: %i Offset: %i Pad: %i\n", uiMemberSize, uiOffset, uiPad ); */ } @@ -1173,9 +1071,7 @@ static PHB_ITEM StructureToArray( HB_BYTE * Buffer, HB_SIZE nBufferLen, PHB_ITEM } if( ( uiOffset + uiMemberSize ) > nBufferLen ) - { break; - } switch( ( pBaseDef->pItems + nIndex )->item.asInteger.value ) { @@ -1308,19 +1204,17 @@ static PHB_ITEM StructureToArray( HB_BYTE * Buffer, HB_SIZE nBufferLen, PHB_ITEM PHB_ITEM pInternalBuffer = pBaseStructure->pItems + pBaseStructure->nLen - 1; if( ! bAdoptNested ) - { hb_itemPutCRawStatic( pInternalBuffer, *( char ** ) ( ( long ** ) ( Buffer + uiOffset ) ), uiNestedSize ); - } else - { hb_itemPutCRaw( pInternalBuffer, *( char ** ) ( ( long ** ) ( Buffer + uiOffset ) ), uiNestedSize ); - } hb_objSendMsg( pStructure, "DEVALUE", 0 ); } else { - /* hb_objSendMsg( pStructure, "RESET", 0 ); */ +#if 0 + hb_objSendMsg( pStructure, "RESET", 0 ); +#endif hb_itemClear( pStructure ); } } @@ -1363,12 +1257,12 @@ HB_FUNC( HB_STRUCTURETOARRAY ) PHB_ITEM pAlign = hb_param( 3, HB_IT_INTEGER ); PHB_ITEM pAdopt = hb_param( 4, HB_IT_LOGICAL ); PHB_ITEM pRet = hb_param( 5, HB_IT_ARRAY ); - HB_BOOL bAdopt; if( Structure && aDef ) { HB_BYTE * Buffer = ( HB_BYTE * ) Structure->item.asString.value; HB_UINT uiAlign; + HB_BOOL bAdopt; if( pAlign ) uiAlign = ( HB_BYTE ) pAlign->item.asInteger.value; @@ -1392,17 +1286,11 @@ HB_FUNC( HB_POINTER2STRING ) PHB_ITEM pLen = hb_param( 2, HB_IT_NUMERIC ); if( HB_IS_POINTER( pPointer ) && pLen ) - { hb_retclen( ( char * ) hb_itemGetPtr( pPointer ), hb_itemGetNS( pLen ) ); - } else if( HB_IS_INTEGER( pPointer ) && pLen ) - { hb_retclen( ( char * ) ( HB_PTRUINT ) hb_itemGetNI( pPointer ), hb_itemGetNS( pLen ) ); - } else if( HB_IS_LONG( pPointer ) && pLen ) - { hb_retclen( ( char * ) ( HB_PTRUINT ) hb_itemGetNL( pPointer ), hb_itemGetNS( pLen ) ); - } else hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, HB_ERR_FUNCNAME, 2, hb_paramError( 1 ), hb_paramError( 2 ) ); } @@ -1417,7 +1305,6 @@ HB_FUNC( HB_STRING2POINTER ) hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); } - HB_FUNC( __CSTR_COPYTO ) { static PHB_DYNS s_pVALUE = NULL; diff --git a/contrib/xhb/datesxhb.c b/contrib/xhb/datesxhb.c index 9118997a9f..c270d2243d 100644 --- a/contrib/xhb/datesxhb.c +++ b/contrib/xhb/datesxhb.c @@ -2,7 +2,8 @@ * The Date API (Harbour level) * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * Copyright 2004 Giancarlo Niccolai + * Copyright 2004 Giancarlo Niccolai + * Copyright 2006 Pavel Tsarenko (DaysInMonth(), DaysToMonth()) * Copyright 2007 Walter Negro * * This program is free software; you can redistribute it and/or modify @@ -83,9 +84,7 @@ HB_FUNC( TIMEOFDAY ) char szResult[ 9 ]; if( hb_pcount() == 0 ) - { hb_dateTimeStr( szResult ); - } else { int iSeconds = hb_parni( 1 ); @@ -93,6 +92,7 @@ HB_FUNC( TIMEOFDAY ) hb_snprintf( szResult, sizeof( szResult ), "%02d:%02d:%02d", iSeconds / 3600, ( iSeconds % 3600 ) / 60, iSeconds % 60 ); } + hb_retclen( szResult, 8 ); } @@ -110,5 +110,5 @@ HB_FUNC( TTOD ) if( HB_ISDATE( 1 ) ) hb_retdl( hb_pardl( 1 ) ); else - hb_errRT_BASE_SubstR( EG_ARG, 1120, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); + hb_errRT_BASE_SubstR( EG_ARG, 1120, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } diff --git a/contrib/xhb/dirrec.prg b/contrib/xhb/dirrec.prg index 9dda377626..8523d5bb60 100644 --- a/contrib/xhb/dirrec.prg +++ b/contrib/xhb/dirrec.prg @@ -48,14 +48,14 @@ * It does not change current drive or current directory so * unlike the xHarbour version it's MT safe. * It also returns relative paths which are more similar to - * Directory() function results so they can be easy used + * *Directory() function results so they can be easy used * directly in other code, f.e. to create archive without * absolute paths. Please note that user can easy convert - * relative paths to absolte ones by simple adding CurDir() + * relative paths to absolute ones by simple adding CurDir() * and/or cPath parameter passed to DirectoryRecurse() but * reverted conversion may not be possible in some cases. - * The 3-rd xHarbour parameter is ignored because - * harbour uses platform native rules to check filename mask + * The 3rd xHarbour parameter is ignored because + * Harbour uses platform native rules to check filename mask * respecting SET FILECASE and SET DIRCASE settings. * xHarbour does not add "D" to attribute list used for directory * tree scanning so user always have to add it manually and later diff --git a/contrib/xhb/dumpvar.prg b/contrib/xhb/dumpvar.prg index bd65e715b4..3729df6fe6 100644 --- a/contrib/xhb/dumpvar.prg +++ b/contrib/xhb/dumpvar.prg @@ -46,13 +46,7 @@ #include "hbclass.ch" -/* - * (C) 2003 - Francesco Saverio Giudice - * - * Send to hb_OutDebug() more parameters - * -*/ - +/* Send to hb_OutDebug() more parameters */ PROCEDURE __OutDebug( ... ) LOCAL xVal @@ -63,16 +57,12 @@ PROCEDURE __OutDebug( ... ) RETURN -/* - * (C) 2003 - Francesco Saverio Giudice - * - * return a string containing a dump of a variable +/* Return a string containing a dump of a variable * * 2006-09-24 * - Added recursion limit * - Added front function with limited parameters and removed support for TAssociative Array -*/ - + */ FUNCTION hb_DumpVar( xVar, lRecursive, nMaxRecursionLevel ) LOCAL nRecursionLevel := 1 @@ -272,33 +262,33 @@ STATIC FUNCTION DecodeScope( nScope AS NUMERIC ) LOCAL cString := "" - IF hb_bitAnd( nScope, HB_OO_CLSTP_EXPORTED ) # 0 // 1 + IF hb_bitAnd( nScope, HB_OO_CLSTP_EXPORTED ) != 0 cString += "Ex," ENDIF #ifdef __XHARBOUR__ - IF hb_bitAnd( nScope, HB_OO_CLSTP_PUBLISHED ) # 0 // 2 + IF hb_bitAnd( nScope, HB_OO_CLSTP_PUBLISHED ) != 0 cString += "Pu," ENDIF #endif - IF hb_bitAnd( nScope, HB_OO_CLSTP_PROTECTED ) # 0 // 4 + IF hb_bitAnd( nScope, HB_OO_CLSTP_PROTECTED ) != 0 cString += "Pr," ENDIF - IF hb_bitAnd( nScope, HB_OO_CLSTP_HIDDEN ) # 0 // 8 + IF hb_bitAnd( nScope, HB_OO_CLSTP_HIDDEN ) != 0 cString += "Hi," ENDIF - IF hb_bitAnd( nScope, HB_OO_CLSTP_CTOR ) # 0 // 16 + IF hb_bitAnd( nScope, HB_OO_CLSTP_CTOR ) != 0 cString += "Ct," ENDIF - IF hb_bitAnd( nScope, HB_OO_CLSTP_READONLY ) # 0 // 32 + IF hb_bitAnd( nScope, HB_OO_CLSTP_READONLY ) != 0 cString += "Ro," ENDIF - IF hb_bitAnd( nScope, HB_OO_CLSTP_SHARED ) # 0 // 64 + IF hb_bitAnd( nScope, HB_OO_CLSTP_SHARED ) != 0 cString += "Sh," ENDIF - IF hb_bitAnd( nScope, HB_OO_CLSTP_CLASS ) # 0 // 128 + IF hb_bitAnd( nScope, HB_OO_CLSTP_CLASS ) != 0 cString += "Cl," ENDIF - IF hb_bitAnd( nScope, HB_OO_CLSTP_SUPER ) # 0 // 256 + IF hb_bitAnd( nScope, HB_OO_CLSTP_SUPER ) != 0 cString += "Su," ENDIF diff --git a/contrib/xhb/filestat.c b/contrib/xhb/filestat.c index 824b08e0ac..f649c2a4a8 100644 --- a/contrib/xhb/filestat.c +++ b/contrib/xhb/filestat.c @@ -1,8 +1,7 @@ /* * FileStats() function * - * Copyright 2004 Giancarlo Niccolai - * + * Copyright 2004 Giancarlo Niccolai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,8 +71,8 @@ #if defined( __USE_LARGEFILE64 ) /* * The macro: __USE_LARGEFILE64 is set when _LARGEFILE64_SOURCE is - * defined and effectively enables lseek64/flock64/ftruncate64 functions - * on 32bit machines. + * defined and effectively enables lseek64()/flock64()/ftruncate64() + * functions on 32-bit machines. */ #define HB_USE_LARGEFILE64 #elif defined( HB_OS_UNIX ) && defined( O_LARGEFILE ) @@ -139,33 +138,33 @@ HB_FUNC( FILESTATS ) } /* Standard characters */ - if( ( usAttr & 4 ) == 0 ) /* Hidden (can't read)*/ + if( ( usAttr & 4 ) == 0 ) /* Hidden (cannot read) */ ushbAttr |= HB_FA_HIDDEN; - if( ( usAttr & 2 ) == 0 ) /* read only (can't write)*/ + if( ( usAttr & 2 ) == 0 ) /* read only (cannot write) */ ushbAttr |= HB_FA_READONLY; - if( ( usAttr & 1 ) == 1 ) /* executable? (xbit)*/ + if( ( usAttr & 1 ) == 1 ) /* executable? (xbit) */ ushbAttr |= HB_FA_SYSTEM; /* Extension characters */ if( ( statbuf.st_mode & S_IFLNK ) == S_IFLNK ) - *pszAttr++ = 'Z'; /* Xharbour extension */ + *pszAttr++ = 'Z'; /* xHarbour extension */ if( ( statbuf.st_mode & S_IFSOCK ) == S_IFSOCK ) - *pszAttr++ = 'K'; /* Xharbour extension */ + *pszAttr++ = 'K'; /* xHarbour extension */ /* device */ if( ( statbuf.st_mode & S_IFBLK ) == S_IFBLK || ( statbuf.st_mode & S_IFCHR ) == S_IFCHR ) - ushbAttr |= HB_FA_DEVICE; /* Xharbour extension */ + ushbAttr |= HB_FA_DEVICE; /* xHarbour extension */ if( ( statbuf.st_mode & S_IFIFO ) == S_IFIFO ) - *pszAttr++ = 'Y'; /* Xharbour extension */ + *pszAttr++ = 'Y'; /* xHarbour extension */ if( S_ISDIR( statbuf.st_mode ) ) - ushbAttr |= HB_FA_DIRECTORY; /* Xharbour extension */ + ushbAttr |= HB_FA_DIRECTORY; /* xHarbour extension */ /* Give the ARCHIVE if readwrite, not executable and not special */ else if( S_ISREG( statbuf.st_mode ) && ushbAttr == 0 ) ushbAttr |= HB_FA_ARCHIVE; @@ -206,7 +205,6 @@ HB_FUNC( FILESTATS ) LPCTSTR lpFileName = HB_PARSTR( 1, &hFileName, NULL ); DWORD dwAttribs; WIN32_FIND_DATA ffind; - HANDLE hFind; FILETIME filetime; SYSTEMTIME time; @@ -214,9 +212,11 @@ HB_FUNC( FILESTATS ) dwAttribs = GetFileAttributes( lpFileName ); if( dwAttribs != INVALID_FILE_ATTRIBUTES ) { + HANDLE hFind; + hb_fsAttrDecode( hb_fsAttrFromRaw( dwAttribs ), szAttr ); - /* If file existed, do a findfirst */ + /* If file existed, do a find-first */ hFind = FindFirstFile( lpFileName, &ffind ); if( hFind != INVALID_HANDLE_VALUE ) { @@ -256,7 +256,7 @@ HB_FUNC( FILESTATS ) #else - /* Generic algorithm based on findfirst */ + /* Generic algorithm based on find-first */ { PHB_FFIND findinfo = hb_fsFindFirst( hb_parc( 1 ), HB_FA_ALL ); diff --git a/contrib/xhb/fparse.c b/contrib/xhb/fparse.c index f3e6cd72ae..894478fe24 100644 --- a/contrib/xhb/fparse.c +++ b/contrib/xhb/fparse.c @@ -1,11 +1,5 @@ /* - * - * FParse() - * FParseEx() - * FParseLine() - * FLineCount() - * FCharCount() - * FWordCount() + * FParse*(), F*Count() * * Copyright 2004 Andi Jahja * @@ -50,8 +44,9 @@ * */ -/* - FParse( cFile, cDelimiter ) -> array +/* FIXME: use Harbour VF IO API */ + +/* FParse( cFile, cDelimiter ) --> array Purpose: Parse a delimited text file. @@ -113,13 +108,9 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, { /* an '"' after '"' ? */ if( szText[ i + 1 ] != '"' ) - { szResult[ ui ] = szText[ i + 1 ]; - } else - { szResult[ ui ] = '\0'; - } ++i; @@ -171,13 +162,9 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, while( ++i < nLen ) { if( szText[ i ] == iDelimiter ) - { break; - } else - { szResult[ ++ui ] = szText[ i ]; - } } } } @@ -216,16 +203,12 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, break; } else - { szResult[ ++ui ] = szText[ i ]; - } } } } else - { szResult[ ++ui ] = szText[ i ]; - } } word_count++; szResult[ ui + 1 ] = '\0'; @@ -270,9 +253,7 @@ static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharC if( ( HB_BYTE ) *string == delimiter ) { while( ( HB_BYTE ) *string == delimiter ) - { string++; - } if( bufptr > buffer ) { @@ -281,15 +262,11 @@ static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharC } } else - { last_char = *bufptr++ = *string++; - } } if( last_char > 0 ) - { word_count++; - } *bufptr = '\0'; @@ -314,15 +291,15 @@ static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharC static HB_BOOL file_read( FILE * stream, char * string, int * iCharCount ) { - int ch, cnbr = 0; + int cnbr = 0; memset( string, ' ', MAX_READ ); for( ;; ) { - ch = fgetc( stream ); + int ch = fgetc( stream ); - if( ( ch == '\n' ) || ( ch == EOF ) || ( ch == 26 ) ) + if( ch == '\n' || ch == EOF || ch == 26 ) { *iCharCount = cnbr; string[ cnbr ] = '\0'; @@ -331,9 +308,7 @@ static HB_BOOL file_read( FILE * stream, char * string, int * iCharCount ) else { if( cnbr < MAX_READ && ch != '\r' ) - { string[ cnbr++ ] = ( char ) ch; - } } if( cnbr >= MAX_READ ) @@ -353,7 +328,6 @@ HB_FUNC( FPARSE ) PHB_ITEM pArray; PHB_ITEM pItem; char * string; - char ** tokens; int iToken, iCharCount = 0; HB_BYTE nByte; @@ -396,7 +370,7 @@ HB_FUNC( FPARSE ) /* parse the read line */ int iWord = 0; - tokens = hb_tokensplit( string, nByte, iCharCount, &iWord ); + char ** tokens = hb_tokensplit( string, nByte, iCharCount, &iWord ); /* prepare empty array */ hb_arrayNew( pItem, iWord ); @@ -494,7 +468,6 @@ HB_FUNC( FWORDCOUNT ) FILE * inFile; PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); char * string; - char ** tokens; int iCharCount = 0; HB_BYTE nByte = ' '; HB_SIZE nWordCount = 0; @@ -530,7 +503,7 @@ HB_FUNC( FWORDCOUNT ) { int iWord = 0; - tokens = hb_tokensplit( string, nByte, iCharCount, &iWord ); + char ** tokens = hb_tokensplit( string, nByte, iCharCount, &iWord ); nWordCount += iWord; @@ -582,9 +555,7 @@ HB_FUNC( FLINECOUNT ) while( ( ch = fgetc( inFile ) ) != EOF ) { if( ch == '\n' ) - { nLineCount++; - } } /* return number of lines */ diff --git a/contrib/xhb/freadlin.c b/contrib/xhb/freadlin.c index 93ccde538a..123a096a05 100644 --- a/contrib/xhb/freadlin.c +++ b/contrib/xhb/freadlin.c @@ -2,7 +2,6 @@ * Text file reading functions * * Copyright 2003 Marcelo Lombardo - lombardo@uol.com.br - * http://www.xharbour.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -87,7 +86,6 @@ static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const nRead = hb_fsReadLarge( hFileHandle, pBuff + nOffset, nSize - nOffset ); /* scan the read buffer */ - if( nRead > 0 ) { for( nPos = 0; nPos < nRead; nPos++ ) @@ -155,8 +153,7 @@ static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const return pBuff; } -/* PRG level fReadLine( , <@buffer>, [], [] ) */ - +/* hb_FReadLine( , <@buffer>, [], [] ) --> nError */ HB_FUNC( HB_FREADLINE ) { PHB_ITEM pTerm1; diff --git a/contrib/xhb/hbcommon.ch b/contrib/xhb/hbcommon.ch index b11077f697..a49ec8e67c 100644 --- a/contrib/xhb/hbcommon.ch +++ b/contrib/xhb/hbcommon.ch @@ -1,5 +1,5 @@ /* - * Common header file for the source of Harbour itself. + * Common header file for the source of Harbour itself * * Copyright 2001-2002 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/xhb/hbcompat.ch b/contrib/xhb/hbcompat.ch index 0a27a5ea4f..bca08ba9c4 100644 --- a/contrib/xhb/hbcompat.ch +++ b/contrib/xhb/hbcompat.ch @@ -304,7 +304,7 @@ #xtranslate hb_enumIndex( ) => :__enumIndex() /* TRY / CATCH / FINALLY / END */ - #xcommand TRY => BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } + #xcommand TRY => BEGIN SEQUENCE WITH __BreakBlock() #xcommand CATCH [] => RECOVER [USING ] <-oErr-> #xcommand FINALLY => ALWAYS @@ -314,19 +314,19 @@ /* xHarbour operators: IN, HAS, LIKE, >>, <<, |, &, ^^ */ #translate ( IN ) => ( ( ) $ ( ) ) - #translate ( HAS ) => ( hb_regexHas( ( ), ( ) ) ) - #translate ( LIKE ) => ( hb_regexLike( ( ), ( ) ) ) - #translate ( \<\< ) => ( hb_bitShift( ( ), ( ) ) ) - #translate ( >> ) => ( hb_bitShift( ( ), -( ) ) ) + #translate ( HAS ) => hb_regexHas( , ) + #translate ( LIKE ) => hb_regexLike( , ) + #translate ( \<\< ) => hb_bitShift( , ) + #translate ( >> ) => hb_bitShift( , -( ) ) /* NOTE: These macros can break some valid Harbour/Clipper constructs, so they are disabled by default. Enable them with care, or even better to switch to use HB_BIT*() functions directly. They are optimized by Harbour compiler the same way (and even more) as these C-like operators, without any bad side-effects. */ #if defined( XHB_BITOP ) - #translate ( | ) => ( xhb_bitOr( ( ), ( ) ) ) - #translate ( & ) => ( xhb_bitAnd( ( ), ( ) ) ) - #translate ( ^^ ) => ( xhb_bitXor( ( ), ( ) ) ) + #translate ( | ) => xhb_bitOr( , ) + #translate ( & ) => xhb_bitAnd( , ) + #translate ( ^^ ) => xhb_bitXor( , ) #endif #command @ , PROMPT [ MESSAGE ] [ COLOR ] => ; @@ -512,7 +512,7 @@ hb_HKeepOrder( h ) ;; RETURN .T. ; }:eval( ) - /* Inet functions */ + /* inet*() functions */ #xtranslate inetInit( [] ) => hb_inetInit( ) #xtranslate inetCleanup( [] ) => hb_inetCleanup( ) #xtranslate inetCreate( [] ) => hb_inetCreate( ) diff --git a/contrib/xhb/hbcomprs.prg b/contrib/xhb/hbcomprs.prg index 244be609cc..4932a77d85 100644 --- a/contrib/xhb/hbcomprs.prg +++ b/contrib/xhb/hbcomprs.prg @@ -1,5 +1,6 @@ /* - * Reimplementation of xhb .zip functions. EXPERIMENTAL CODE. USE AT YOUR OWN RISK. NO GUARANTEES. + * Reimplementation of xHarbour .zip functions. + * EXPERIMENTAL CODE. USE AT YOUR OWN RISK. NO GUARANTEES. * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -50,11 +51,11 @@ THREAD STATIC t_nLastError := HB_ZLIB_RES_OK -/****** COMPRESSOR WRAPPER - * hb_Compress( cSource [,nSourceLen ] ) --> cDest - * hb_Compress( nComprFactor, cSource [,nSourceLen ] ) --> cDest - * hb_Compress( cSource, nSourceLen, @cDest, @nDestLen ) --> nError - * hb_Compress( nComprFactor, cSource, nSourceLen, @cDest, @nDestLen ) --> nError +/* COMPRESSOR WRAPPER + * hb_Compress( cSource [,nSourceLen ] ) --> cDest + * hb_Compress( nComprFactor, cSource [,nSourceLen ] ) --> cDest + * hb_Compress( cSource, nSourceLen, @cDest, @nDestLen ) --> nError + * hb_Compress( nComprFactor, cSource, nSourceLen, @cDest, @nDestLen ) --> nError */ FUNCTION hb_Compress( xPar1, xPar2, xPar3, xPar4, xPar5 ) @@ -117,9 +118,9 @@ FUNCTION hb_Compress( xPar1, xPar2, xPar3, xPar4, xPar5 ) RETURN hb_ZCompress( cSource, nDestLen, @t_nLastError, nComprFactor ) -/****** DECOMPRESSOR WRAPPER - * hb_Uncompress( nDestLen, cSource [, nSourceLen ] ) --> cDest - * hb_Uncompress( nDestLen, cSource, nSourceLen, @cDest ) --> nError +/* DECOMPRESSOR WRAPPER + * hb_Uncompress( nDestLen, cSource [, nSourceLen ] ) --> cDest + * hb_Uncompress( nDestLen, cSource, nSourceLen, @cDest ) --> nError */ FUNCTION hb_Uncompress( nDestLen, cSource, nSourceLen, /* @ */ cDest ) @@ -151,21 +152,15 @@ FUNCTION hb_Uncompress( nDestLen, cSource, nSourceLen, /* @ */ cDest ) RETURN hb_ZUncompress( cSource, nDestLen, @t_nLastError ) -/** - * hb_CompressError() --> nError - */ +/* hb_CompressError() --> nError */ FUNCTION hb_CompressError() RETURN t_nLastError -/** - * hb_CompressErrorDesc( nErrorCode ) --> cDesc - */ +/* hb_CompressErrorDesc( nErrorCode ) --> cDesc */ FUNCTION hb_CompressErrorDesc( nError ) RETURN hb_ZError( nError ) -/** - * hb_CompressBufLen( nSrcLen ) --> nDestLen - */ +/* hb_CompressBufLen( nSrcLen ) --> nDestLen */ FUNCTION hb_CompressBufLen( nSrcLen ) LOCAL nRet @@ -173,7 +168,6 @@ FUNCTION hb_CompressBufLen( nSrcLen ) hb_default( @nSrcLen, 0 ) nRet := nSrcLen - nRet += nRet / 100 * 15 + 12 IF ( nSrcLen % 100 ) != 0 diff --git a/contrib/xhb/hbcrypt.c b/contrib/xhb/hbcrypt.c index 32ee649de7..c49158d6cd 100644 --- a/contrib/xhb/hbcrypt.c +++ b/contrib/xhb/hbcrypt.c @@ -1,5 +1,8 @@ /* - * Cryptography for xharbour + * Cryptography for xHarbour + * + * WARNING: Non-standard, insecure crypto. Use core hb_blowfish*() + * functions or other _standard_ alternatives instead. * * Copyright 2003 Giancarlo Niccolai * SEE ALSO COPYRIGHT NOTICE FOR NXS BELOW. @@ -45,8 +48,7 @@ * */ -/***** - * NXS aglorithm is FREE SOFTWARE. It can be reused for any +/* NXS algorithm is FREE SOFTWARE. It can be reused for any * purpose, provided that this copyright notice is still present * in the software. * @@ -56,7 +58,6 @@ * NXS author is Giancarlo Niccolai */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" @@ -69,7 +70,7 @@ * Prerequisites: * 1) source must be at least 8 bytes long. * 2) key must be at least 6 characters long. - * Optimal lenght is about 12 to 16 bytes. Maximum keylen is 512 bytes + * Optimal length is about 12 to 16 bytes. Maximum keylen is 512 bytes * 3) cipher must be preallocated with srclen bytes */ @@ -78,7 +79,6 @@ void nxs_crypt( const unsigned char * key, HB_SIZE keylen, unsigned char * cipher ) { - if( keylen > NXS_MAX_KEYLEN ) keylen = NXS_MAX_KEYLEN; @@ -97,7 +97,7 @@ void nxs_crypt( nxs_xorcyclic( cipher, srclen, key, keylen ); } -/*decrypting the buffer */ +/* Decrypting the buffer */ void nxs_decrypt( const unsigned char * cipher, HB_SIZE cipherlen, @@ -261,7 +261,7 @@ void nxs_xordecode( { HB_SIZE pos = 0; HB_USHORT keypos = 0; - unsigned char c_bitrest, c_bitleft; + unsigned char c_bitleft; /* A very short block? */ if( keylen > cipherlen - pos ) @@ -271,6 +271,8 @@ void nxs_xordecode( while( pos < cipherlen ) { + unsigned char c_bitrest; + cipher[ pos ] ^= key[ keypos ]; c_bitrest = cipher[ pos ] << 5; @@ -286,9 +288,7 @@ void nxs_xordecode( keypos = 0; /* last block */ if( keylen > cipherlen - pos ) - { keylen = ( HB_USHORT ) ( cipherlen - pos ); - } c_bitleft = ( cipher[ pos + keylen - 1 ] ^ key[ keylen - 1 ] ) << 5; } @@ -348,10 +348,9 @@ HB_U32 nxs_cyclic_sequence( HB_U32 input ) { HB_U32 first = input & 0xffff; HB_U32 second = input >> 16; - HB_U32 ret = ( ( second * BASE * BASE ) & 0xffff ) | - ( ( first * BASE * BASE ) & 0xffff0000 ); - return ret; + return ( ( second * BASE * BASE ) & 0xffff ) | + ( ( first * BASE * BASE ) & 0xffff0000 ); } @@ -377,20 +376,14 @@ void nxs_make_scramble( HB_ISIZ * scramble, const unsigned char * key, HB_SIZE k } } -/* - * END OF NXS - */ +/* END OF NXS */ -/***** - * xHarbour implementation - */ +/* xHarbour implementation */ -/***** - * Encrypt a text using a key +/* Encrypt a text using a key * Usage: * hb_Crypt( cSource, cKey ) --> cCipher */ - HB_FUNC( HB_CRYPT ) { PHB_ITEM pSource = hb_param( 1, HB_IT_ANY ); @@ -406,12 +399,10 @@ HB_FUNC( HB_CRYPT ) hb_retclen_buffer( ( char * ) cRes, hb_itemGetCLen( pSource ) ); } -/***** - * Decrypt a text using a key +/* Decrypt a text using a key * Usage: * hb_Decrypt( cCrypt, cKey ) --> cSource */ - HB_FUNC( HB_DECRYPT ) { PHB_ITEM pSource = hb_param( 1, HB_IT_ANY ); diff --git a/contrib/xhb/hbctypes.ch b/contrib/xhb/hbctypes.ch index a6c73d4a95..d330964453 100644 --- a/contrib/xhb/hbctypes.ch +++ b/contrib/xhb/hbctypes.ch @@ -1,5 +1,7 @@ /* + * CTYPE_* constants * + * Copyright 2000 {list of individual authors and e-mail addresses} * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,38 +47,38 @@ #ifndef __HBCTYPES_CH_ #define __HBCTYPES_CH_ -#define CTYPE_VOID 0 +#define CTYPE_VOID 0 -#define CTYPE_CHAR 1 -#define CTYPE_UNSIGNED_CHAR -1 -#define CTYPE_CHAR_PTR 10 -#define CTYPE_UNSIGNED_CHAR_PTR -10 +#define CTYPE_CHAR 1 +#define CTYPE_UNSIGNED_CHAR -1 +#define CTYPE_CHAR_PTR 10 +#define CTYPE_UNSIGNED_CHAR_PTR -10 -#define CTYPE_SHORT 2 -#define CTYPE_UNSIGNED_SHORT -2 -#define CTYPE_SHORT_PTR 20 -#define CTYPE_UNSIGNED_SHORT_PTR -20 +#define CTYPE_SHORT 2 +#define CTYPE_UNSIGNED_SHORT -2 +#define CTYPE_SHORT_PTR 20 +#define CTYPE_UNSIGNED_SHORT_PTR -20 -#define CTYPE_INT 3 -#define CTYPE_UNSIGNED_INT -3 -#define CTYPE_INT_PTR 30 -#define CTYPE_UNSIGNED_INT_PTR -30 +#define CTYPE_INT 3 +#define CTYPE_UNSIGNED_INT -3 +#define CTYPE_INT_PTR 30 +#define CTYPE_UNSIGNED_INT_PTR -30 -#define CTYPE_LONG 4 -#define CTYPE_UNSIGNED_LONG -4 -#define CTYPE_LONG_PTR 40 -#define CTYPE_UNSIGNED_LONG_PTR -40 +#define CTYPE_LONG 4 +#define CTYPE_UNSIGNED_LONG -4 +#define CTYPE_LONG_PTR 40 +#define CTYPE_UNSIGNED_LONG_PTR -40 -#define CTYPE_FLOAT 5 -#define CTYPE_FLOAT_PTR 50 +#define CTYPE_FLOAT 5 +#define CTYPE_FLOAT_PTR 50 -#define CTYPE_DOUBLE 6 -#define CTYPE_DOUBLE_PTR 60 +#define CTYPE_DOUBLE 6 +#define CTYPE_DOUBLE_PTR 60 -#define CTYPE_VOID_PTR 7 +#define CTYPE_VOID_PTR 7 /* _Must_ be smaller than CTYPE_STRUCTURE_PTR */ #define CTYPE_STRUCTURE 1000 -#define CTYPE_STRUCTURE_PTR 10000 +#define CTYPE_STRUCTURE_PTR 10000 #endif /* __HBCTYPES_CH_ */ diff --git a/contrib/xhb/hbdll.ch b/contrib/xhb/hbdll.ch index a3261b3551..2e8145d835 100644 --- a/contrib/xhb/hbdll.ch +++ b/contrib/xhb/hbdll.ch @@ -1,5 +1,7 @@ /* + * DLL call header * + * Copyright 200? {list of individual authors and e-mail addresses} * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +50,7 @@ #define __DLL_CH #define DC_MICROSOFT 0x0000 // Default -#define DC_BORLAND 0x0001 // Borland compat +#define DC_BORLAND 0x0001 // Borland compatibility #define DC_CALL_CDECL DLL_CDECL #define DC_CALL_STD DLL_STDCALL #define DC_RETVAL_MATH4 0x0100 // Return value in ST diff --git a/contrib/xhb/hblog.prg b/contrib/xhb/hblog.prg index 62177fa4f4..359665748d 100644 --- a/contrib/xhb/hblog.prg +++ b/contrib/xhb/hblog.prg @@ -1,45 +1,46 @@ /* * Versatile logging system. * - * Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws] + * Copyright 2003 Giancarlo Niccolai * - * this program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General public License as published by + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * - * this program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the - * GNU General public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General public License - * along with this software; see the file COPYING.txt. if not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * You should have received a copy of the GNU General Public License + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General public License. + * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * - * this exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General public License. + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. * - * this exception applies only to the code released with this xHarbour - * explicit exception. if you add/copy code from other sources, - * as the General public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * if you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. - * if you do not wish that, delete this exception notice. + * If you do not wish that, delete this exception notice. * */ @@ -47,17 +48,9 @@ #include "hblog.ch" #include "fileio.ch" +/* Static standard logger access */ -/***** - * Static standard logger access - */ - -#define HB_THREAD_SUPPORT - -#ifdef HB_THREAD_SUPPORT STATIC s_StdLogMutex := hb_mutexCreate() -#endif - STATIC s_StdLogger PROCEDURE hb_InitStandardLog( ... ) diff --git a/contrib/xhb/hblogdef.ch b/contrib/xhb/hblogdef.ch index 527ee44df2..6756ca7dd0 100644 --- a/contrib/xhb/hblogdef.ch +++ b/contrib/xhb/hblogdef.ch @@ -1,6 +1,6 @@ /* * Header file with definition for logging levels - * ( Need a separate file for inclusion in PRG and C files ) + * (Need a separate file for inclusion in PRG and C files) * * Copyright 2003 Giancarlo Niccolai * diff --git a/contrib/xhb/hblognet.prg b/contrib/xhb/hblognet.prg index 9ca5fdfe0a..95336591fb 100644 --- a/contrib/xhb/hblognet.prg +++ b/contrib/xhb/hblognet.prg @@ -1,61 +1,60 @@ /* - * Versatile logging system - Logger sending log message to e-mail + * Versatile logging system - Logger sending log message to email * - * Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws] + * Copyright 2003 Giancarlo Niccolai * - * this program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General public License as published by + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * - * this program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the - * GNU General public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General public License - * along with this software; see the file COPYING.txt. if not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * You should have received a copy of the GNU General Public License + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General public License. + * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * - * this exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General public License. + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. * - * this exception applies only to the code released with this xHarbour - * explicit exception. if you add/copy code from other sources, - * as the General public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * if you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. - * if you do not wish that, delete this exception notice. + * If you do not wish that, delete this exception notice. * */ #include "hbclass.ch" -#define CRLF Chr( 13 ) + Chr( 10 ) +#define CRLF Chr( 13 ) + Chr( 10 ) -#define HB_THREAD_SUPPORT - -CREATE CLASS HB_LogEmail FROM HB_LogChannel +CREATE CLASS HB_LogEmail INHERIT HB_LogChannel VAR cServer - VAR cAddress INIT "log@xharbour.org" - VAR cSubject INIT "Log message from xharbour application" + VAR cAddress INIT "log@example.org" + VAR cSubject INIT "Log message from xHarbour application" VAR cSendTo - VAR cHelo INIT "XHarbour E-mail Logger" + VAR cHelo INIT "xHarbour Email Logger" VAR nPort INIT 25 VAR cPrefix @@ -103,10 +102,7 @@ METHOD New( nLevel, cHelo, cServer, cSendTo, cSubject, cFrom ) CLASS HB_LogEmail RETURN SELF -/** - * Inet init must be called here - */ - +/* hb_inetInit() must be called here */ METHOD Open( cName ) CLASS HB_LogEmail HB_SYMBOL_UNUSED( cName ) @@ -114,10 +110,7 @@ METHOD Open( cName ) CLASS HB_LogEmail RETURN .T. -/** - * InetCleanup to be called here - */ - +/* hb_inetCleanup() to be called here */ METHOD Close( cName ) CLASS HB_LogEmail HB_SYMBOL_UNUSED( cName ) @@ -125,11 +118,7 @@ METHOD Close( cName ) CLASS HB_LogEmail RETURN .T. - -/** - * Sends the real message in e-mail - */ - +/* Sends the real message in email */ METHOD Send( nStyle, cMessage, cName, nPriority ) CLASS HB_LogEmail LOCAL skCon := hb_inetCreate() @@ -172,10 +161,7 @@ METHOD Send( nStyle, cMessage, cName, nPriority ) CLASS HB_LogEmail hb_inetSendAll( skCon, "QUIT" + CRLF ) RETURN ::GetOk( skCon ) // if quit fails, the mail does not go! - -/** - * Get the reply and returns true if it is allright - */ +/* Get the reply and returns true if it is alright */ METHOD GetOk( skCon ) CLASS HB_LogEmail @@ -208,23 +194,16 @@ METHOD Prepare( nStyle, cMessage, cName, nPriority ) CLASS HB_LogEmail RETURN cPre - - -/***** - * Channel for monitors listening on a port - */ - +/* Channel for monitors listening on a port */ CREATE CLASS HB_LogInetPort FROM HB_LogChannel VAR nPort INIT 7761 VAR aListeners INIT {} VAR skIn -#ifdef HB_THREAD_SUPPORT VAR bTerminate INIT .F. VAR nThread VAR mtxBusy -#endif METHOD New( nLevel, nPort ) METHOD Open( cName ) @@ -233,10 +212,8 @@ CREATE CLASS HB_LogInetPort FROM HB_LogChannel PROTECTED: METHOD Send( nStyle, cMessage, cName, nPriority ) -#ifdef HB_THREAD_SUPPORT HIDDEN: METHOD AcceptCon() -#endif ENDCLASS @@ -262,14 +239,8 @@ METHOD Open( cName ) CLASS HB_LogInetPort RETURN .F. ENDIF -#ifdef HB_THREAD_SUPPORT ::mtxBusy := hb_mutexCreate() ::nThread := hb_threadStart( Self, "AcceptCon" ) -#else - // If we have not threads, we have to sync accept incoming connection - // when we log a message - hb_inetTimeout( ::skIn, 50 ) -#endif RETURN .T. @@ -283,11 +254,9 @@ METHOD Close( cName ) CLASS HB_LogInetPort RETURN .F. ENDIF -#ifdef HB_THREAD_SUPPORT // kind termination request ::bTerminate := .T. hb_threadJoin( ::nThread ) -#endif hb_inetClose( ::skIn ) @@ -307,18 +276,8 @@ METHOD Send( nStyle, cMessage, cName, nPriority ) CLASS HB_LogInetPort LOCAL sk, nCount -#ifdef HB_THREAD_SUPPORT - // be sure thread is not busy now hb_mutexLock( ::mtxBusy ) -#else - // IF we have not a thread, we must see if there is a new connection - sk := hb_inetAccept( ::skIn ) // timeout should be short - - IF sk != NIL - AAdd( ::aListeners, sk ) - ENDIF -#endif // now we transmit the message to all the available channels cMessage := ::Format( nStyle, cMessage, cName, nPriority ) @@ -335,14 +294,10 @@ METHOD Send( nStyle, cMessage, cName, nPriority ) CLASS HB_LogInetPort ENDIF ENDDO -#ifdef HB_THREAD_SUPPORT hb_mutexUnlock( ::mtxBusy ) -#endif RETURN .T. -#ifdef HB_THREAD_SUPPORT - METHOD AcceptCon() CLASS HB_LogInetPort LOCAL sk @@ -359,5 +314,3 @@ METHOD AcceptCon() CLASS HB_LogInetPort ENDDO RETURN .T. - -#endif diff --git a/contrib/xhb/hbnxs.h b/contrib/xhb/hbnxs.h index cbefdd5c32..11b537a980 100644 --- a/contrib/xhb/hbnxs.h +++ b/contrib/xhb/hbnxs.h @@ -1,5 +1,5 @@ /* - * Cryptography for xharbour + * Cryptography for xHarbour * * Copyright 2003 Giancarlo Niccolai * SEE ALSO COPYRIGHT NOTICE FOR NXS BELOW. @@ -45,9 +45,8 @@ * */ -/*************************************************************** - * NXS aglorithm is FREE SOFTWARE. It can be reused for any - * purpose, provided that this copiright notice is still present +/* NXS algorithm is FREE SOFTWARE. It can be reused for any + * purpose, provided that this copyright notice is still present * in the software. * * This program is distributed WITHOUT ANY WARRANTY that it can @@ -56,7 +55,7 @@ * NXS author is Giancarlo Niccolai * * Adler 32 CRC is copyrighted by Martin Adler - **************************************************************/ + */ #ifndef HBNXS_H #define HBNXS_H diff --git a/contrib/xhb/hboutdbg.c b/contrib/xhb/hboutdbg.c index 400d9a6c9f..3670555ccf 100644 --- a/contrib/xhb/hboutdbg.c +++ b/contrib/xhb/hboutdbg.c @@ -78,8 +78,7 @@ static int s_iXtermPid = 0; static void debugInit( void ) { - int iPid, iFifoResult; - char szDebugTitle[ 30 ]; + int iFifoResult; PHB_FNAME pFileName = NULL; char szDebugName[ 128 ]; @@ -101,6 +100,9 @@ static void debugInit( void ) if( iFifoResult == 0 || iFifoResult == EEXIST ) { + char szDebugTitle[ 30 ]; + int iPid; + hb_snprintf( szDebugTitle, sizeof( szDebugTitle ), "%s - Debug", pFileName->szName ); iPid = fork(); @@ -114,7 +116,7 @@ static void debugInit( void ) if( iFifoResult != EEXIST ) { s_iXtermPid = execlp( "xterm", "xterm", "-T", szDebugTitle, "-e", - "cat", szDebugName, ( char * ) NULL ); + "cat", szDebugName, NULL ); if( s_iXtermPid <= 0 ) { @@ -164,7 +166,7 @@ HB_BOOL hb_OutDebugName( PHB_ITEM pName ) void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen ) { #if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS ) - int iStatus, iPid; + int iStatus; /* Are we under X? */ if( getenv( "DISPLAY" ) != NULL ) @@ -176,10 +178,10 @@ void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen ) if( s_iDebugFd <= 0 || s_iXtermPid == 0 ) return; - /* Chech if display process has terminated in the meanwhile */ + /* Check if display process has terminated in the meanwhile */ if( ! s_iUseDebugName ) { - iPid = waitpid( s_iXtermPid, &iStatus, WNOHANG ); + int iPid = waitpid( s_iXtermPid, &iStatus, WNOHANG ); if( iPid == s_iXtermPid || iPid == -1 ) { s_iXtermPid = 0; diff --git a/contrib/xhb/hbrpc.ch b/contrib/xhb/hbrpc.ch index 76befbb778..bbe1a29575 100644 --- a/contrib/xhb/hbrpc.ch +++ b/contrib/xhb/hbrpc.ch @@ -1,6 +1,5 @@ /* - * Remote Procedure Call code - * Standard definitions + * Remote Procedure Call code - Standard definitions * * Copyright 2003 Giancarlo Niccolai * diff --git a/contrib/xhb/hbserv.c b/contrib/xhb/hbserv.c index 854f717c40..bd33684f41 100644 --- a/contrib/xhb/hbserv.c +++ b/contrib/xhb/hbserv.c @@ -1,46 +1,46 @@ /* - * The Service/Daemon support - * (Includes also signal/low level error management) + * The Service/Daemon support (includes also signal/low-level error management) * - * Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws] + * Copyright 2003 Giancarlo Niccolai * - * this program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General public License as published by + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * - * this program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the - * GNU General public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General public License - * along with this software; see the file COPYING.txt. if not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * You should have received a copy of the GNU General Public License + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General public License. + * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * - * this exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General public License. + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. * - * this exception applies only to the code released with this xHarbour - * explicit exception. if you add/copy code from other sources, - * as the General public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * If you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. - * if you do not wish that, delete this exception notice. + * If you do not wish that, delete this exception notice. * */ @@ -62,7 +62,7 @@ #endif #endif -/* These targets can't compile this module */ +/* These targets cannot compile this module */ #if ! defined( HB_OS_DOS ) && \ ! defined( HB_OS_DARWIN_5 ) && \ ! ( defined( HB_OS_WIN_CE ) && ( defined( __POCC__ ) || ( defined( _MSC_VER ) && ( _MSC_VER <= 1500 ) ) ) ) && \ @@ -77,20 +77,11 @@ #include #endif -/* TODO: - we'll use hb_fsPopen for popening once we put it multiplatform. For now: */ -#ifdef HB_OS_WIN - #define popen _popen - #define pclose _pclose -#endif - #ifdef __LCC__ #define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION #endif -/************************************************** - * Global definition, valid for all systems - ***************************************************/ +/* Global definition, valid for all systems */ static void s_serviceSetHBSig( void ); static void s_serviceSetDflSig( void ); @@ -116,17 +107,16 @@ typedef struct static int s_translateSignal( HB_UINT sig, HB_UINT subsig ); -/***************************************************************************** -* Unix specific signal handling implementation -* -* This section has unix specific code to manage the -* signals, both from kernel or from users. -*****************************************************************************/ +/* Unix specific signal handling implementation + * + * This section has unix specific code to manage the + * signals, both from kernel or from users. + */ #if defined( HB_OS_UNIX ) || defined( HB_OS_OS2_GCC ) /* TODO: Register the old signal action to allow graceful fallback - static struct sigaction sa_oldAction[ SIGUSR2 + 1 ]; */ + static struct sigaction s_aOldAction[ SIGUSR2 + 1 ]; */ /* Implementation of the signal translation table */ static S_TUPLE s_sigTable[] = @@ -150,11 +140,8 @@ static void s_signalHandler( int sig ) static void s_signalHandler( int sig, siginfo_t * info, void * v ) #endif { - HB_UINT uiMask; HB_UINT uiSig; - PHB_ITEM pFunction, pExecArray, pRet; HB_SIZE nPos; - int iRet; #if ! ( defined( HB_OS_OS2_GCC ) || defined( __WATCOMC__ ) ) HB_SYMBOL_UNUSED( v ); @@ -177,10 +164,16 @@ static void s_signalHandler( int sig, siginfo_t * info, void * v ) while( nPos > 0 ) { + PHB_ITEM pFunction; + HB_UINT uiMask; + pFunction = hb_arrayGetItemPtr( sp_hooks, nPos ); uiMask = ( HB_UINT ) hb_arrayGetNI( pFunction, 1 ); if( uiMask & uiSig ) { + PHB_ITEM pExecArray, pRet; + int iRet; + /* we don't unlock the mutex now, even if it is a little dangerous. But we are in a signal hander... for now just 2 parameters */ @@ -246,7 +239,9 @@ static void s_signalHandler( int sig, siginfo_t * info, void * v ) } bSignalEnabled = HB_TRUE; - /*s_serviceSetHBSig();*/ + #if 0 + s_serviceSetHBSig(); + #endif #if 0 if( uiSig != HB_SIGNAL_UNKNOWN ) @@ -266,8 +261,9 @@ static void s_signalHandler( int sig, siginfo_t * info, void * v ) static void * s_signalListener( void * my_stack ) { static HB_BOOL bFirst = HB_TRUE; - sigset_t passall; - HB_STACK * pStack = ( HB_STACK * ) my_stack; + + sigset_t passall; + HB_STACK * pStack = ( HB_STACK * ) my_stack; #if defined( HB_OS_BSD ) int sig; @@ -345,12 +341,11 @@ static void * s_signalListener( void * my_stack ) #endif #endif -/***************************************************************************** -* Windows specific exception filter system. -* -* Windows will only catch exceptions; It is necessary to rely on the -* HB_SERVICELOOP to receive user generated messages. -*****************************************************************************/ +/* Windows specific exception filter system. + * + * Windows will only catch exceptions; It is necessary to rely on the + * hb_ServiceLoop() to receive user generated messages. + */ #ifdef HB_OS_WIN static void s_serviceSetHBSig( void ); @@ -361,8 +356,7 @@ static HHOOK s_hMsgHook = NULL; /* old error mode */ static UINT s_uiErrorMode = 0; -/* ------------------------------- - implementation of the signal translation table +/* implementation of the signal translation table Under windows, 0 is a system exception, while 1 is a user message */ static S_TUPLE s_sigTable[] = { @@ -404,15 +398,11 @@ static S_TUPLE s_sigTable[] = { { 0, 0, 0 } }; -/* ------------------------------- - Manager of signals for windows - */ +/* Manager of signals for windows */ static LONG s_signalHandler( int type, int sig, PEXCEPTION_RECORD exc ) { - PHB_ITEM pFunction, pExecArray, pRet; HB_SIZE nPos; - HB_UINT uiSig, uiMask; - int iRet; + HB_UINT uiSig; /* let's find the right signal handler. */ hb_threadEnterCriticalSectionGC( &s_ServiceMutex ); @@ -431,10 +421,16 @@ static LONG s_signalHandler( int type, int sig, PEXCEPTION_RECORD exc ) while( nPos > 0 ) { + PHB_ITEM pFunction; + HB_UINT uiMask; + pFunction = hb_arrayGetItemPtr( sp_hooks, nPos ); uiMask = ( HB_UINT ) hb_arrayGetNI( pFunction, 1 ); if( ( uiMask & uiSig ) == uiSig ) { + PHB_ITEM pExecArray, pRet; + int iRet; + /* we don't unlock the mutex now, even if it is a little dangerous. But we are in a signal hander... for now just 2 parameters */ @@ -446,7 +442,7 @@ static LONG s_signalHandler( int type, int sig, PEXCEPTION_RECORD exc ) * 1: low-level signal * 2: low-level subsignal * 3: low-level system error - * 4: address that rised the signal + * 4: address that rose the signal * 5: process id of the signal riser * 6: UID of the riser */ @@ -460,13 +456,10 @@ static LONG s_signalHandler( int type, int sig, PEXCEPTION_RECORD exc ) hb_arraySetNI( pRet, HB_SERVICE_OSERROR, GetLastError() ); if( type == 0 ) /* exception */ - { hb_arraySetPtr( pRet, HB_SERVICE_ADDRESS, ( void * ) exc->ExceptionAddress ); - } else - { hb_arraySetPtr( pRet, HB_SERVICE_ADDRESS, NULL ); - } + /* TODO: */ hb_arraySetNI( pRet, HB_SERVICE_PROCESS, GetCurrentThreadId() ); /* TODO: */ @@ -565,20 +558,17 @@ BOOL WINAPI s_ConsoleHandlerRoutine( DWORD dwCtrlType ) #endif -/***************************************************************************** -* Filter/handlers setup/shutdown -* This utility functions are meant to abstract the process of declare and -* remove the signal handlers, and do it in a mutltiplatform fashon. Use this -* to implement new platform signal/exception handlers. -*****************************************************************************/ - -/*----------------------------------------------------- - Set the signal handlers to our program interceptors. +/** + * Filter/handlers setup/shutdown + * This utility functions are meant to abstract the process of declare and + * remove the signal handlers, and do it in a mutlti-platform fashion. Use this + * to implement new platform signal/exception handlers. */ +/* Set the signal handlers to our program interceptors. */ + static void s_serviceSetHBSig( void ) { - #if defined( HB_OS_UNIX ) || defined( HB_OS_OS2_GCC ) struct sigaction act; @@ -602,7 +592,7 @@ static void s_serviceSetHBSig( void ) /* to avoid problems with differ sigaction structures and uninitialized fields */ - memset( &act, 0, sizeof( struct sigaction ) ); + memset( &act, 0, sizeof( act ) ); #if defined( HB_OS_OS2_GCC ) || defined( __WATCOMC__ ) act.sa_handler = s_signalHandler; @@ -611,7 +601,9 @@ static void s_serviceSetHBSig( void ) act.sa_handler = NULL; /* if act.sa.. is a union, we just clean this */ act.sa_sigaction = s_signalHandler; /* this is what matters */ /* block al signals, we don't want to be interrupted. */ - /*sigfillset( &act.sa_mask );*/ + #if 0 + sigfillset( &act.sa_mask ); + #endif #endif @@ -644,13 +636,10 @@ static void s_serviceSetHBSig( void ) SetUnhandledExceptionFilter( s_exceptionFilter ); s_hMsgHook = SetWindowsHookEx( WH_GETMESSAGE, ( HOOKPROC ) s_MsgFilterFunc, NULL, GetCurrentThreadId() ); SetConsoleCtrlHandler( s_ConsoleHandlerRoutine, TRUE ); - #endif } -/* --------------------------------------------------- - Reset the signal handlers to the default OS value - */ +/* Reset the signal handlers to the default OS value */ static void s_serviceSetDflSig( void ) { @@ -680,10 +669,8 @@ static void s_serviceSetDflSig( void ) } -/* --------------------------------------------------- - This translates a signal into abstract HB_SIGNAL - from os specific representation - */ +/* This translates a signal into abstract HB_SIGNAL + from os specific representation */ static int s_translateSignal( HB_UINT sig, HB_UINT subsig ) { @@ -731,10 +718,10 @@ static void s_signalHandlersInit() hb_vmAtQuit( hb_service_exit, NULL ); } -/***************************************************************************** -* HB_*Service routines -* This is the core of the service system. -*****************************************************************************/ +/** + * hb_*Service routines + * This is the core of the service system. + */ /** * Starts the service system. @@ -742,7 +729,6 @@ static void s_signalHandlersInit() * On unix: if the parameter is .T., puts the server in daemonic mode, detaching * the main thread from the console and terminating it. */ - HB_FUNC( HB_STARTSERVICE ) { #ifdef HB_THREAD_SUPPORT @@ -757,12 +743,10 @@ HB_FUNC( HB_STARTSERVICE ) #if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS ) { - int pid; - /* Iconic? */ if( hb_parl( 1 ) ) { - pid = fork(); + int pid = fork(); if( pid != 0 ) { @@ -786,23 +770,18 @@ HB_FUNC( HB_STARTSERVICE ) /* in windows, we just detach from console */ #ifdef HB_OS_WIN if( hb_parl( 1 ) ) - { FreeConsole(); - } #endif /* Initialize only if the service has not yet been initialized */ if( sp_hooks == NULL ) - { s_signalHandlersInit(); - } } /** * Returns true if the current program is a service, that is if hb_StartService() has * Been called. C version useful for internal api */ - HB_BOOL hb_isService( void ) { return sb_isService; @@ -812,7 +791,6 @@ HB_BOOL hb_isService( void ) * Clean up when system exits * Called from hb_vmQuit() */ - void hb_serviceExit( void ) { if( sp_hooks != NULL ) @@ -842,7 +820,6 @@ HB_FUNC( HB_ISSERVICE ) * Under windows, it peeks the pending messages and send the relevant ones * (quit, user+1 and user+2) to our handling functions. */ - HB_FUNC( HB_SERVICELOOP ) { #ifdef HB_OS_WIN @@ -879,9 +856,7 @@ HB_FUNC( HB_PUSHSIGNALHANDLER ) /* if the hook is not initialized, initialize it */ if( sp_hooks == NULL ) - { s_signalHandlersInit(); - } hb_threadEnterCriticalSectionGC( &s_ServiceMutex ); @@ -915,20 +890,17 @@ HB_FUNC( HB_POPSIGNALHANDLER ) } } else - { hb_retl( HB_FALSE ); - } + hb_threadLeaveCriticalSection( &s_ServiceMutex ); } else - { hb_retl( HB_FALSE ); - } } /** - * Return a character description of the low level signal that has been - * issued to signal handling routines. This is system dependant. + * Return a character description of the low-level signal that has been + * issued to signal handling routines. This is system dependent. * TODO: Make it international through the xHarbour standard message system. */ HB_FUNC( HB_SIGNALDESC ) diff --git a/contrib/xhb/hbserv.ch b/contrib/xhb/hbserv.ch index 23942660c3..84c13605ac 100644 --- a/contrib/xhb/hbserv.ch +++ b/contrib/xhb/hbserv.ch @@ -1,46 +1,46 @@ /* - * The Service/Daemon support - * (Includes also signal/low level error management) + * The Service/Daemon support (Includes also signal/low-level error management) * - * Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws] + * Copyright 2003 Giancarlo Niccolai * - * this program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General public License as published by + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * - * this program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the - * GNU General public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General public License - * along with this software; see the file COPYING.txt. if not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * You should have received a copy of the GNU General Public License + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General public License. + * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * - * this exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General public License. + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. * - * this exception applies only to the code released with this xHarbour - * explicit exception. if you add/copy code from other sources, - * as the General public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * If you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. - * if you do not wish that, delete this exception notice. + * If you do not wish that, delete this exception notice. * */ @@ -64,15 +64,15 @@ #define HB_SERVICE_QUIT 3 -/* Index in the OS dependant signal array that is passed to the +/* Index in the OS dependent signal array that is passed to the signal handler as a parameter 1: low-level signal 2: low-level subsignal 3: low-level system error - 4: address that rised the signal + 4: address that rose the signal 5: process id of the signal riser 6: UID of the riser -*/ + */ #define HB_SERVICE_OSSIGNAL 1 #define HB_SERVICE_OSSUBSIG 2 diff --git a/contrib/xhb/hbserv.h b/contrib/xhb/hbserv.h index 8ab78b57e7..f5496efa38 100644 --- a/contrib/xhb/hbserv.h +++ b/contrib/xhb/hbserv.h @@ -1,45 +1,46 @@ /* * The Service/Daemon support * - * Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws] + * Copyright 2003 Giancarlo Niccolai * - * this program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General public License as published by + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * - * this program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the - * GNU General public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General public License - * along with this software; see the file COPYING.txt. if not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * You should have received a copy of the GNU General Public License + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General public License. + * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * - * this exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General public License. + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. * - * this exception applies only to the code released with this xHarbour - * explicit exception. if you add/copy code from other sources, - * as the General public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * If you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. - * if you do not wish that, delete this exception notice. + * If you do not wish that, delete this exception notice. * */ diff --git a/contrib/xhb/hbstruct.ch b/contrib/xhb/hbstruct.ch index 5809bb6a92..b215d54ae9 100644 --- a/contrib/xhb/hbstruct.ch +++ b/contrib/xhb/hbstruct.ch @@ -53,7 +53,7 @@ #undef _TSTRUCT_ ;; #endif ;; #define _TSTRUCT_ ;; - := hb_Hash() ;; + := { => } ;; hb_HCaseMatch( , .F. ) #xcommand MEMBER ; diff --git a/contrib/xhb/hbstruct.prg b/contrib/xhb/hbstruct.prg index 27dd2f7481..d02f2e7c7e 100644 --- a/contrib/xhb/hbstruct.prg +++ b/contrib/xhb/hbstruct.prg @@ -103,7 +103,6 @@ PROCEDURE hb_HashAddMember( aName, cType, uInit, oObj ) EXIT ENDSWITCH - ENDIF FOR EACH cName IN aName diff --git a/contrib/xhb/hbsyslog.c b/contrib/xhb/hbsyslog.c index bf7dd83ad9..9d6ca147fa 100644 --- a/contrib/xhb/hbsyslog.c +++ b/contrib/xhb/hbsyslog.c @@ -1,7 +1,7 @@ /* * Event logging system * - * Copyright 2004 Giancarlo Niccolai + * Copyright 2004 Giancarlo Niccolai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,9 +14,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -51,7 +51,7 @@ #if defined( HB_OS_WIN ) -# include "windows.h" +# include static HANDLE s_RegHandle; @@ -135,10 +135,10 @@ HB_FUNC( HB_SYSLOGMESSAGE ) switch( hb_parni( 2 ) ) { case HB_LOG_CRITICAL: logval = EVENTLOG_ERROR_TYPE; break; - case HB_LOG_ERROR: logval = EVENTLOG_ERROR_TYPE; break; - case HB_LOG_WARN: logval = EVENTLOG_WARNING_TYPE; break; - case HB_LOG_INFO: logval = EVENTLOG_INFORMATION_TYPE; break; - default: logval = EVENTLOG_AUDIT_SUCCESS; + case HB_LOG_ERROR: logval = EVENTLOG_ERROR_TYPE; break; + case HB_LOG_WARN: logval = EVENTLOG_WARNING_TYPE; break; + case HB_LOG_INFO: logval = EVENTLOG_INFORMATION_TYPE; break; + default: logval = EVENTLOG_AUDIT_SUCCESS; } hb_retl( ReportEvent( s_RegHandle, /* event log handle */ logval, /* event type */ diff --git a/contrib/xhb/hbxml.c b/contrib/xhb/hbxml.c index 16dfc55028..10a6295f7b 100644 --- a/contrib/xhb/hbxml.c +++ b/contrib/xhb/hbxml.c @@ -45,14 +45,13 @@ * */ -/* - * MXML (Mini XML) Library related copyright notice. +/* MXML (Mini XML) Library related copyright notice. * (referring to Harbour/xHarbour version). * * This source file contains a modified version of MXML (Mini XML) * library, developed by Giancarlo Niccolai. MXML is released under * LGPL license; this modified version (called HBXML) is released under - * GPL with HARBOUR exception. HBXML license does not extends into + * GPL with Harbour exception. HBXML license does not extends into * MXML; HBXML and any modification to HBXML is to be considered as * a part of Harbour or xHarbour projects, as it is modified to * be specifically working in the context of the compiler's RTL. @@ -71,9 +70,7 @@ #include "hbxml.h" -/******************************************* - Static declarations - ********************************************/ +/* --- Static declarations --- */ /* Node oriented operations */ static PHB_ITEM mxml_node_new( PHB_ITEM pDoc ); @@ -93,7 +90,7 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style static MXML_STATUS mxml_attribute_read( MXML_REFIL * data, PHB_ITEM doc, PHB_ITEM pNode, PHBXML_ATTRIBUTE dest, int style ); static MXML_STATUS mxml_attribute_write( MXML_OUTPUT * out, PHBXML_ATTRIBUTE attr, int style ); -/* Refil routines */ +/* Refill routines */ /* Currently not used */ #if 0 static MXML_REFIL * mxml_refil_new( MXML_REFIL_FUNC func, char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ); @@ -105,13 +102,6 @@ static MXML_STATUS mxml_refil_setup( MXML_REFIL * ref, MXML_REFIL_FUNC func, static int mxml_refil_getc( MXML_REFIL * ref ); #define mxml_refil_ungetc( ref, ch ) ref->sparechar = ch -/* Currently not used */ -#if 0 -static void mxml_refill_from_stream_func( MXML_REFIL * ref ); -#endif - -static void mxml_refill_from_handle_func( MXML_REFIL * ref ); - /* Output routines */ /* Currently not used */ #if 0 @@ -144,9 +134,7 @@ static MXML_STATUS mxml_sgs_append_string( MXML_SGS * sgs, char * s ); static const char * mxml_error_desc( MXML_ERROR_CODE code ); -/******************************************** - HB-MXML glue code - *********************************************/ +/* --- HB-MXML glue code --- */ /* This is just a shortcut */ static void hbxml_set_doc_status( MXML_REFIL * ref, PHB_ITEM doc, PHB_ITEM pNode, int status, int error ) @@ -186,14 +174,11 @@ static void hbxml_doc_new_node( PHB_ITEM pDoc, int amount ) /* TODO: launch a callback */ } -/*********************************************************** - HBXML lib - Attribute oriented routines - ************************************************************/ +/* HBXML lib - Attribute oriented routines */ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITEM pNode, PHBXML_ATTRIBUTE pDest, int style ) { - int chr, quotechr = '"'; + int quotechr = '"'; MXML_SGS * buf_name; MXML_SGS * buf_attrib; int iStatus = 0; @@ -206,7 +191,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE while( iStatus < 6 ) { - chr = mxml_refil_getc( ref ); + int chr = mxml_refil_getc( ref ); if( chr == MXML_EOF ) break; @@ -384,7 +369,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE else /* Decimal */ chr = atoi( bp ); } - /** Reducing an SGS length is legal */ + /* Reducing an SGS length is legal */ buf_attrib->length = iPosAmper; mxml_sgs_append_char( buf_attrib, ( char ) chr ); } @@ -450,12 +435,7 @@ static MXML_STATUS mxml_attribute_write( MXML_OUTPUT * out, PHBXML_ATTRIBUTE pAt } - -/*********************************************************** - HBXML lib - Item (node) routines -***********************************************************/ - +/* HBXML lib - Item (node) routines */ static PHB_ITEM mxml_node_new( PHB_ITEM pDoc ) { @@ -482,15 +462,12 @@ static PHB_ITEM mxml_node_new( PHB_ITEM pDoc ) return pNode; } -/** - * The unlink function is used to detach a node from the UPPER and PARENT hyerarcy. +/* The unlink function is used to detach a node from the UPPER and PARENT hierarchy. * The node is "removed" so that siblings node are "squished", and possible parents * are informed of the changes, so that they are able to get a new child to start - * the tree structure under them. The childs of the unlinked nodes are NOT unlinked, + * the tree structure under them. The children of the unlinked nodes are NOT unlinked, * thus remains attached to the node: is like removing a branch with all its leaves. - * */ - static void mxml_node_unlink( PHB_ITEM pNode ) { PHB_ITEM pPrev, pNext, pParent, pNil; @@ -539,7 +516,8 @@ HB_FUNC( HBXML_NODE_UNLINK ) { mxml_node_unlink( hb_param( 1, HB_IT_OBJECT ) ); } -/****************************************************************/ + +/* --- */ static void mxml_node_insert_before( PHB_ITEM pTg, PHB_ITEM pNode ) { @@ -600,11 +578,9 @@ HB_FUNC( HBXML_NODE_INSERT_AFTER ) mxml_node_insert_after( hb_param( 1, HB_IT_OBJECT ), hb_param( 2, HB_IT_OBJECT ) ); } -/** - * Creates a new tree level, so that the given node is added between +/* Creates a new tree level, so that the given node is added between * tg and its former children. Former children of pNode are discarded */ - static void mxml_node_insert_below( PHB_ITEM pTg, PHB_ITEM pNode ) { PHB_ITEM pChild; @@ -632,10 +608,8 @@ HB_FUNC( HBXML_NODE_INSERT_BELOW ) { mxml_node_insert_below( hb_param( 1, HB_IT_OBJECT ), hb_param( 2, HB_IT_OBJECT ) ); } -/** - * Adds a node to the bottom of the children list of tg. - */ +/* Adds a node to the bottom of the children list of tg. */ static void mxml_node_add_below( PHB_ITEM pTg, PHB_ITEM pNode ) { PHB_ITEM pChild; @@ -673,11 +647,10 @@ HB_FUNC( HBXML_NODE_ADD_BELOW ) { mxml_node_add_below( hb_param( 1, HB_IT_OBJECT ), hb_param( 2, HB_IT_OBJECT ) ); } -/** - * Clones a node, but it does not sets the parent, nor the siblings; - * this clone is "floating" out of the tree hierarcy. - */ +/* Clones a node, but it does not sets the parent, nor the siblings; + * this clone is "floating" out of the tree hierarchy. + */ static PHB_ITEM mxml_node_clone( PHB_ITEM pTg ) { /* Node is not from a real document, so is right to leave nBeginLine at 0 */ @@ -710,11 +683,9 @@ HB_FUNC( HBXML_NODE_CLONE ) hb_itemReturnRelease( mxml_node_clone( hb_param( 1, HB_IT_OBJECT ) ) ); } -/** - * Clones a node and all its subtree, but it does not sets the parent, nor the siblings; - * this clone is "floating" out of the tree hierarcy. +/* Clones a node and all its subtree, but it does not sets the parent, nor the siblings; + * this clone is "floating" out of the tree hierarchy. */ - static PHB_ITEM mxml_node_clone_tree( PHB_ITEM pTg ) { PHB_ITEM pClone = mxml_node_clone( pTg ); @@ -762,7 +733,6 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, chr = mxml_refil_getc( ref ); while( chr != MXML_EOF ) { - /* still in a data element */ if( chr != '<' ) { @@ -857,7 +827,7 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, return; } - /* trimming unneded spaces */ + /* trimming unneeded spaces */ while( iPos > 1 && HB_ISSPACE( ( HB_BYTE ) buf[ iPos - 1 ] ) ) iPos--; @@ -881,7 +851,6 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT char * buf; int iAllocated; int iPos = 0; - int chr; int iStatus = 0; buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); @@ -889,7 +858,7 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT while( iStatus < 2 ) { - chr = mxml_refil_getc( ref ); + int chr = mxml_refil_getc( ref ); if( chr == MXML_EOF ) break; @@ -898,7 +867,7 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT case 0: if( HB_ISALPHA( chr ) ) { - /* can't cause reallocations */ + /* cannot cause reallocations */ buf[ iPos++ ] = ( char ) chr; iStatus = 1; } @@ -913,7 +882,7 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT case 1: if( HB_ISALNUM( chr ) || chr == '_' || chr == '-' || chr == ':' ) { - /* can't cause reallocations */ + /* cannot cause reallocations */ buf[ iPos++ ] = ( char ) chr; } else if( chr == '>' || chr == ' ' || chr == '/' || chr == '\r' || @@ -989,9 +958,7 @@ static MXML_STATUS mxml_node_read_attributes( MXML_REFIL * ref, /* Error already set. */ #if 0 if( ref->status != MXML_STATUS_OK ) - { hbxml_set_doc_status( ref, doc, pNode, ref->status, ref->error ); - } #endif hb_itemRelease( attributes ); hb_itemRelease( hbValue ); @@ -1002,14 +969,15 @@ static MXML_STATUS mxml_node_read_attributes( MXML_REFIL * ref, static void mxml_node_read_directive( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) { - char * buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); - int iAllocated = MXML_ALLOC_BLOCK; - int iPos = 0; - int chr; + char * buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); if( mxml_node_read_name( ref, pNode, doc ) == MXML_STATUS_OK ) { - chr = mxml_refil_getc( ref ); + int iAllocated = MXML_ALLOC_BLOCK; + int iPos = 0; + + int chr = mxml_refil_getc( ref ); + while( chr != MXML_EOF && chr != '>' ) { if( iPos > 0 || ( chr != ' ' && chr != '\t' && chr != '\r' && chr != '\n' ) ) @@ -1050,7 +1018,6 @@ static void mxml_node_read_directive( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) { int iPos = 0, iAllocated; - int chr; char * buf; int iStatus = 0; @@ -1065,7 +1032,7 @@ static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) while( iStatus < 2 ) { - chr = mxml_refil_getc( ref ); + int chr = mxml_refil_getc( ref ); if( chr == MXML_EOF ) break; @@ -1160,7 +1127,6 @@ static void mxml_node_read_tag( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, static void mxml_node_read_comment( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) { int iPos = 0, iAllocated; - int chr; char * buf; int iStatus = 0; PHB_ITEM pItem; @@ -1175,7 +1141,7 @@ static void mxml_node_read_comment( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM d while( iStatus < 3 ) { - chr = mxml_refil_getc( ref ); + int chr = mxml_refil_getc( ref ); if( chr == MXML_EOF ) break; @@ -1243,9 +1209,7 @@ static void mxml_node_read_comment( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM d static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDoc ) { - int iPos = 0, iAllocated; int chr; - char * buf; int iStatus = 0; PHB_ITEM pItem; @@ -1323,10 +1287,11 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo } else { - iStatus = 0; + int iPos = 0, iAllocated = MXML_ALLOC_BLOCK; - buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); - iAllocated = MXML_ALLOC_BLOCK; + char * buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); + + iStatus = 0; /* now we can read the node */ while( iStatus < 3 ) @@ -1438,15 +1403,14 @@ static int mxml_node_read_closing( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM do static MXML_STATUS mxml_node_read( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, int style ) { - PHB_ITEM node; - - int chr; /* Stateful machine status */ int iStatus = 0; while( iStatus >= 0 ) { - chr = mxml_refil_getc( ref ); + PHB_ITEM node; + + int chr = mxml_refil_getc( ref ); if( chr == MXML_EOF ) break; @@ -1455,7 +1419,7 @@ static MXML_STATUS mxml_node_read( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM do hbxml_set_doc_status( ref, doc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_INVNODE ); return MXML_STATUS_MALFORMED; } - /* resetting new node foundings */ + /* resetting new node findings */ node = NULL; switch( iStatus ) @@ -1551,7 +1515,7 @@ static MXML_STATUS mxml_node_read( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM do } else { - /* Error is already set in ref->status; it can't be an hard error, we catch it before.*/ + /* Error is already set in ref->status; it cannot be an hard error, we catch it before.*/ hb_itemRelease( node ); /* node will be destroyed by GC when needed */ return ref->status; @@ -1560,7 +1524,7 @@ static MXML_STATUS mxml_node_read( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM do } - /* We can't have errors here; we would have been already returned */ + /* We cannot have errors here; we would have been already returned */ if( iStatus == -1 ) /* ARE WE DONE ? */ { @@ -1654,8 +1618,7 @@ static void mxml_node_file_indent( MXML_OUTPUT * out, int depth, int style ) static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style ) { PHB_ITEM pChild, pItem; - int depth = 0; - int mustIndent = 0; + int depth = 0; pChild = hb_itemNew( NULL ); pItem = hb_itemNew( NULL ); @@ -1681,7 +1644,7 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style mxml_node_write_attributes( out, hb_param( -1, HB_IT_ANY ), style ); hb_objSendMsg( pNode, "CDATA", 0 ); - /* itemcopy should not be applied to strings, as it rises the + /* hb_itemCopy() should not be applied to strings, as it rises the holders, and we don't want this */ hb_itemMove( pItem, hb_param( -1, HB_IT_ANY ) ); hb_objSendMsg( pNode, "OCHILD", 0 ); @@ -1694,6 +1657,8 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style } else { + int mustIndent = 0; + mxml_output_char( out, '>' ); if( ! HB_IS_NIL( pChild ) ) @@ -1815,18 +1780,14 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style } -/*********************************************************** - HBXML lib - Virtual stream input/output routines -***********************************************************/ +/* HBXML lib - Virtual stream input/output routines */ -/** - * Creates a new output object - * In this case, the func member is required. +/* Creates a new output object + * In this case, the function member is required. * Node count is optional, but highly wanted for progress indicators. */ -/* Currently not used */ #if 0 +/* Currently not used */ static MXML_OUTPUT * mxml_output_new( MXML_OUTPUT_FUNC func, int node_count ) { MXML_OUTPUT * ret = ( MXML_OUTPUT * ) MXML_ALLOCATOR( sizeof( MXML_OUTPUT ) ); @@ -1842,12 +1803,10 @@ static MXML_OUTPUT * mxml_output_new( MXML_OUTPUT_FUNC func, int node_count ) } #endif -/** - * Sets up output parameters. - * In this case, the func member is required. +/* Sets up output parameters. + * In this case, the function member is required. * Node count is optional, but highly wanted for progress indicators. */ - static MXML_STATUS mxml_output_setup( MXML_OUTPUT * out, MXML_OUTPUT_FUNC func, int node_count ) { if( func == NULL ) @@ -1862,16 +1821,15 @@ static MXML_STATUS mxml_output_setup( MXML_OUTPUT * out, MXML_OUTPUT_FUNC func, return MXML_STATUS_ERROR; } -/* Currently not used */ #if 0 +/* Currently not used */ static void mxml_output_destroy( MXML_OUTPUT * out ) { MXML_DELETOR( out ); } #endif -/**********************************************/ -/* output functions */ +/* --- output functions --- */ static MXML_STATUS mxml_output_char( MXML_OUTPUT * out, int c ) { @@ -1887,8 +1845,8 @@ static MXML_STATUS mxml_output_string_len( MXML_OUTPUT * out, const char * s, HB return out->status; } -/* Currently not used */ #if 0 +/* Currently not used */ static MXML_STATUS mxml_output_string( MXML_OUTPUT * out, const char * s ) { return mxml_output_string_len( out, s, strlen( s ) ); @@ -1901,7 +1859,6 @@ static MXML_STATUS mxml_output_string( MXML_OUTPUT * out, const char * s ) return out->status; } - static MXML_STATUS mxml_output_string_escape( MXML_OUTPUT * out, const char * s ) { while( *s ) @@ -1924,9 +1881,7 @@ static MXML_STATUS mxml_output_string_escape( MXML_OUTPUT * out, const char * s return out->status; } -/** - * Useful function to output to file handles - */ +/* Useful function to output to file handles */ static void mxml_output_func_to_handle( MXML_OUTPUT * out, const char * s, HB_ISIZ len ) { HB_FHANDLE fh = out->u.hFile; @@ -1941,9 +1896,7 @@ static void mxml_output_func_to_handle( MXML_OUTPUT * out, const char * s, HB_IS } } -/** - * Useful function to output to self growing strings - */ +/* Useful function to output to self growing strings */ static void mxml_output_func_to_sgs( MXML_OUTPUT * out, const char * s, HB_ISIZ len ) { MXML_SGS * sgs = ( MXML_SGS * ) out->u.vPtr; @@ -1963,16 +1916,11 @@ static void mxml_output_func_to_sgs( MXML_OUTPUT * out, const char * s, HB_ISIZ } -/*********************************************************** - HBXML lib - Refiller routines -***********************************************************/ +/* HBXML lib - Re-filler routines */ - -/** - * Creates a new refiller object. - * If buf is null, then buflen is ignored and set to 0; the first retrival - * of a character will then lead to refil func calling. +/* Creates a new re-filler object. + * If buf is null, then buflen is ignored and set to 0; the first retrieval + * of a character will then lead to refill func calling. * If the function is null, once the data has been read the reader returns * eof. If both func and buf are NULL, the creation fails, and the function * retunrs NULL. @@ -1994,10 +1942,9 @@ static MXML_REFIL * mxml_refil_new( MXML_REFIL_FUNC func, char * buf, HB_ISIZ bu } #endif -/** - * Sets up refiller parameters. +/* Sets up re-filler parameters. * If buf is null, then buflen is ignored and set to 0; the first retrival - * of a character will then lead to refil func calling. Bufsize is the size + * of a character will then lead to refill func calling. Bufsize is the size * of the allocated memory, while buflen is the count of currently valid * characters in that buffer. * If the function is null, once the data has been read the reader returns @@ -2006,7 +1953,6 @@ static MXML_REFIL * mxml_refil_new( MXML_REFIL_FUNC func, char * buf, HB_ISIZ bu * Notice: ref->data member is left to fill to the * calling program, if this is needed. */ - static MXML_STATUS mxml_refil_setup( MXML_REFIL * ref, MXML_REFIL_FUNC func, char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ) { @@ -2033,7 +1979,7 @@ static MXML_STATUS mxml_refil_setup( MXML_REFIL * ref, MXML_REFIL_FUNC func, ref->streamlen = 0; ref->streampos = 0; - /* theese are for ungetc operations */ + /* these are for ungetc operations */ ref->sparechar = MXML_EOF; /* data is left to fill for the program */ @@ -2080,10 +2026,7 @@ void mxml_refil_ungetc( MXML_REFIL * ref, int chr ) } #endif -/** - * Useful "fill" function that reads from a file handle - */ - +/* Useful "fill" function that reads from a file handle */ static void mxml_refill_from_handle_func( MXML_REFIL * ref ) { HB_FHANDLE fh = ( HB_FHANDLE ) ref->u.hFile; @@ -2104,16 +2047,9 @@ static void mxml_refill_from_handle_func( MXML_REFIL * ref ) } +/* HBXML lib - Self growing string routines */ -/******************************************************** - HBXML lib - Self growing string routines - *********************************************************/ - -/** - * Creates a new self growing string, with buffer set to - * minimal buffer length - */ +/* Creates a new self growing string, with buffer set to minimal buffer length */ static MXML_SGS * mxml_sgs_new() { MXML_SGS * ret = ( MXML_SGS * ) MXML_ALLOCATOR( sizeof( MXML_SGS ) ); @@ -2142,17 +2078,16 @@ static void mxml_sgs_destroy( MXML_SGS * sgs ) MXML_DELETOR( sgs ); } -/****************************************/ +/* --- */ static MXML_STATUS mxml_sgs_append_char( MXML_SGS * sgs, char c ) { - char * buf; - sgs->buffer[ sgs->length++ ] = c; if( sgs->length >= sgs->allocated ) { - buf = ( char * ) MXML_REALLOCATOR( sgs->buffer, sgs->allocated + MXML_ALLOC_BLOCK ); + char * buf = ( char * ) MXML_REALLOCATOR( sgs->buffer, sgs->allocated + MXML_ALLOC_BLOCK ); + if( buf == NULL ) return MXML_STATUS_ERROR; @@ -2165,14 +2100,12 @@ static MXML_STATUS mxml_sgs_append_char( MXML_SGS * sgs, char c ) static MXML_STATUS mxml_sgs_append_string_len( MXML_SGS * sgs, const char * s, HB_ISIZ slen ) { - char * buf; - if( slen > 0 ) { if( sgs->length + slen >= sgs->allocated ) { HB_ISIZ blklen = ( ( sgs->length + slen ) / MXML_ALLOC_BLOCK + 1 ) * MXML_ALLOC_BLOCK; - buf = ( char * ) MXML_REALLOCATOR( sgs->buffer, blklen ); + char * buf = ( char * ) MXML_REALLOCATOR( sgs->buffer, blklen ); if( buf == NULL ) return MXML_STATUS_ERROR; @@ -2188,9 +2121,8 @@ static MXML_STATUS mxml_sgs_append_string_len( MXML_SGS * sgs, const char * s, H return MXML_STATUS_OK; } - -/* Currently not used */ #if 0 +/* Currently not used */ static MXML_STATUS mxml_sgs_append_string( MXML_SGS * sgs, char * s ) { return mxml_sgs_append_string_len( sgs, s, strlen( s ) ); @@ -2207,10 +2139,7 @@ static char * mxml_sgs_extract( MXML_SGS * sgs ) return sgs->buffer; } -/*********************************************************** - HBXML lib - Error code routines -***********************************************************/ +/* HBXML lib - Error code routines */ static const char * edesc[] = { @@ -2240,19 +2169,13 @@ static const char * mxml_error_desc( MXML_ERROR_CODE code ) } -/*********************************************************** - HBXML lib - xHarbour RTL & VM interface -***********************************************************/ +/* HBXML lib - xHarbour RTL & VM interface */ - -/** - * HB_XmlCreate( [xData] ) --> xmlDocument +/* hbxml_dataread( [xData] ) --> xmlDocument * xData can be a file handle from which an XML can be read, * a string containing an XML tree or NIL, in which case the * document is created empty. */ - HB_FUNC( HBXML_DATAREAD ) { PHB_ITEM pParam = hb_param( 2, HB_IT_ANY ); @@ -2288,9 +2211,7 @@ HB_FUNC( HBXML_DATAREAD ) hb_itemRelease( pRoot ); } - -/** - * hb_XMLErrorDesc( nErrorNumber ) --> cErrorDesc +/* hb_XMLErrorDesc( nErrorNumber ) --> cErrorDesc * Returns a descriptive string telling what the error number is meaning. */ HB_FUNC( HB_XMLERRORDESC ) @@ -2303,14 +2224,9 @@ HB_FUNC( HB_XMLERRORDESC ) hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } - - -/** - * HB_XmlToString( xmlDocument [, nStyle] ) --> cXml | NIL - * +/* hbxml_node_to_string( xmlDocument [, nStyle] ) --> cXml | NIL * Writes an XML document to a string. */ - HB_FUNC( HBXML_NODE_TO_STRING ) { PHB_ITEM pNode = hb_param( 1, HB_IT_OBJECT ); @@ -2340,12 +2256,9 @@ HB_FUNC( HBXML_NODE_TO_STRING ) mxml_sgs_destroy( sgs ); } -/** - * HB_XmlWrite( xmlDocument, nFileHandle, nStyle ) --> nStatus - * +/* hbxml_node_write( xmlDocument, xFileHandle, nStyle ) --> nStatus * Writes an XML document to a file; returns the HB_XML status. */ - HB_FUNC( HBXML_NODE_WRITE ) { PHB_ITEM pNode = hb_param( 1, HB_IT_OBJECT ); diff --git a/contrib/xhb/hbxml.ch b/contrib/xhb/hbxml.ch index 4d62cecaed..1314dc4d00 100644 --- a/contrib/xhb/hbxml.ch +++ b/contrib/xhb/hbxml.ch @@ -1,6 +1,5 @@ /* * HBXML - XML DOM oriented routines - * Define wrappers for xHarbour PRG. * * Copyright 2003 Giancarlo Niccolai * @@ -51,7 +50,7 @@ /* Styles */ #define HBXML_STYLE_NOINDENT 0 /* no indent nodes and insert new line after each node */ -#define HBXML_STYLE_INDENT 1 /* indent nodes with 1 space and insert new line after each node (default) */ +#define HBXML_STYLE_INDENT 1 /* indent nodes with 1 space and insert new line after each node (default) */ #define HBXML_STYLE_TAB 2 /* indent nodes with tab spaces and insert new line after each node */ #define HBXML_STYLE_THREESPACES 4 /* indent nodes with 3 spaces and insert new line after each node */ #define HBXML_STYLE_NOESCAPE 8 diff --git a/contrib/xhb/hbxml.h b/contrib/xhb/hbxml.h index c4400c23d5..6093f1be83 100644 --- a/contrib/xhb/hbxml.h +++ b/contrib/xhb/hbxml.h @@ -52,7 +52,7 @@ * This source file contains a modified version of MXML (Mini XML) * library, developed by Giancarlo Niccolai. MXML is released under * LGPL license; this modified version (called HBXML) is released under - * GPL with HARBOUR exception. HBXML license does not extends into + * GPL with Harbour exception. HBXML license does not extends into * MXML; HBXML and any modification to HBXML is to be considered as * a part of Harbour or xHarbour projects, as it is modified to * be specifically working in the context of the compiler's RTL. @@ -69,7 +69,7 @@ #define MXML_LINE_TERMINATOR '\r' #define MXML_SOFT_LINE_TERMINATOR '\n' #else -/*Notice, this works for unix AND windows */ +/* Notice, this works for both Unix and Windows */ #define MXML_LINE_TERMINATOR '\n' #define MXML_SOFT_LINE_TERMINATOR '\r' #endif @@ -85,7 +85,7 @@ #define MXML_STYLE_THREESPACES 0x0004 #define MXML_STYLE_NOESCAPE 0x0008 -/* Status vaules */ +/* Status values */ typedef enum { @@ -137,12 +137,9 @@ struct tag_mxml_output; typedef void ( *MXML_REFIL_FUNC )( struct tag_mxml_refil * ref ); typedef void ( *MXML_OUTPUT_FUNC )( struct tag_mxml_output * out, const char * data, HB_ISIZ len ); -/************************************************* - Structures holding the XML data - **************************************************/ +/* --- Structures holding the XML data --- */ - -/* Refiller */ +/* Re-filler */ typedef struct tag_mxml_refil { @@ -156,7 +153,7 @@ typedef struct tag_mxml_refil HB_ISIZ buflen; /* valid characters in the current buffer */ HB_ISIZ bufpos; /* current position */ - /* lenght of the stream for implementing progress indicators */ + /* length of the stream for implementing progress indicators */ HB_ISIZ streampos; HB_ISIZ streamlen; diff --git a/contrib/xhb/hjwindow.prg b/contrib/xhb/hjwindow.prg index 0b4c6d9276..3fee8686a8 100644 --- a/contrib/xhb/hjwindow.prg +++ b/contrib/xhb/hjwindow.prg @@ -2,6 +2,7 @@ * JavaScript Window Class * * Copyright 2000 Manos Aspradakis + * Copyright 2000 Luiz Rafael Culik (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbclass.ch" #include "cgi.ch" @@ -86,46 +77,28 @@ CREATE CLASS TJSWindow VAR onUnLoad METHOD New( cVarName, cUrl, cName, x, y, w, h ) - METHOD setOnLoad( c ) INLINE ::onLoad := c - METHOD setOnUnLoad( c ) INLINE ::onUnLoad := c - METHOD Alert( c ) INLINE ::QOut( "Alert('" + c + "')" ) - METHOD confirm( c ) INLINE ::QOut( "confirm('" + c + "')" ) - METHOD SetSize( x, y, h, w ) - METHOD Write( c ) - METHOD lineBreak() INLINE ::QOut( "
" ) - METHOD Paragraph() INLINE ::QOut( "

" ) - METHOD Center( l ) INLINE ::QOut( iif( l, "
", "
" ) ) - METHOD bold( l ) INLINE ::QOut( iif( l, "", "" ) ) - METHOD Italic( l ) INLINE ::QOut( iif( l, "", "" ) ) - METHOD ULine( l ) INLINE ::QOut( iif( l, "", "" ) ) - METHOD Put() - METHOD Begin() - METHOD End() METHOD QOut( c ) - METHOD WriteLN( c ) INLINE ::QOut( c ) - METHOD SetFeatures( alwaysRaised, alwaysLowered, ; Resizable, Menubar, personalBar, ; dependent, location, directories, ; Scrollbars, Status, TitleBar, Toolbar, copyHistory ) - METHOD ImageURL( cImage, cUrl, nHeight, nBorder, ; cOnClick, cOnMsover, cOnMsout, ; cName, cAlt ) @@ -161,12 +134,7 @@ METHOD New( cVarName, cUrl, cName, x, y, w, h ) CLASS TJSWindow RETURN Self -/**** -* -* Set the properties of the window -* -*/ - +/* Set the properties of the window */ METHOD SetFeatures( alwaysRaised, alwaysLowered, ; Resizable, Menubar, personalBar, ; dependent, location, directories, ; @@ -258,12 +226,7 @@ METHOD SetFeatures( alwaysRaised, alwaysLowered, ; RETURN Self -/**** -* -* set the size for the window -* -*/ - +/* set the size for the window */ METHOD SetSize( x, y, h, w ) CLASS TJSWindow LOCAL cStr := "" @@ -288,12 +251,7 @@ METHOD SetSize( x, y, h, w ) CLASS TJSWindow RETURN Self -/**** -* -* Open the window from within the current document -* -*/ - +/* Open the window from within the current document */ METHOD Put() CLASS TJSWindow LOCAL cStr := "" @@ -321,39 +279,23 @@ METHOD Put() CLASS TJSWindow RETURN Self -/**** -* -* Output stand alone Javascript code in the current document -* -*/ - +/* Output stand alone Javascript code in the current document */ METHOD Write( c ) CLASS TJSWindow HtmlJSCmd( ::nH, ::varName + ".document.write('" + c + "')" + CRLF() ) RETURN Self -/**** -* -* Output Javascript (or HTML) code in the current document and -* in the current script -* -*/ - +/* Output Javascript (or HTML) code in the current document and + in the current script */ METHOD QOut( c ) CLASS TJSWindow FWrite( ::nH, ::varName + ".document.write('" + c + "')" + CRLF() ) RETURN Self -/**** -* -* Begin HTML output to the window from within the current document -* and the current script -* -* -*/ - +/* Begin HTML output to the window from within the current document + and the current script */ METHOD Begin() CLASS TJSWindow LOCAL i @@ -413,24 +355,14 @@ METHOD Begin() CLASS TJSWindow RETURN Self -/**** -* -* End HTML output to the window -* -*/ - +/* End HTML output to the window */ METHOD End() CLASS TJSWindow HtmlJSCmd( ::nH, ::varName + ".document.write('')" + CRLF() ) RETURN Self -/**** -* -* Place an image link to the window -* -*/ - +/* Place an image link to the window */ METHOD ImageURL( cImage, cUrl, nHeight, nBorder, ; cOnClick, cOnMsover, cOnMsout, ; cName, cAlt ) CLASS TJSWindow diff --git a/contrib/xhb/hterrsys.prg b/contrib/xhb/hterrsys.prg index f99485e1cc..d0c70f2cd4 100644 --- a/contrib/xhb/hterrsys.prg +++ b/contrib/xhb/hterrsys.prg @@ -2,6 +2,7 @@ * HTML output conversion * * Copyright 2000 Manos Aspradakis + * Copyright 2000 Luiz Rafael Culik (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #include "error.ch" #include "cgi.ch" @@ -69,11 +60,6 @@ REQUEST MemoWrit STATIC s_bFixCorrupt STATIC s_cErrFooter := " " - -/*** -* DefError() -*/ - #if 0 STATIC FUNCTION xhb_cgi_DefError( e ) @@ -102,16 +88,14 @@ STATIC FUNCTION xhb_cgi_DefError( e ) .AND. e:canDefault NetErr( .T. ) - RETURN .F. // NOTE - + RETURN .F. ENDIF - // for lock error during APPEND BLANK, set NetErr() and subsystem default + // for lock error during dbAppend(), set NetErr() and subsystem default IF e:genCode == EG_APPENDLOCK .AND. e:canDefault NetErr( .T. ) - RETURN .F. // NOTE - + RETURN .F. ENDIF // build error message diff --git a/contrib/xhb/htjlist.prg b/contrib/xhb/htjlist.prg index 22f4aa5049..e8ed313289 100644 --- a/contrib/xhb/htjlist.prg +++ b/contrib/xhb/htjlist.prg @@ -1,11 +1,12 @@ /* - * Generates Javascript and DHTML list menus - * (see the website/jList dir for an example) + * Generates Javascript and DHTML list menus + * (see the website/jList dir for an example) * - * Uses list.js and resize.js (heavily modified) found at - * developer.netscape.com + * Uses list.js and resize.js (heavily modified) found at + * developer.netscape.com * * Copyright 2000 Manos Aspradakis + * Copyright 2000 Luiz Rafael Culik (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,16 +49,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbclass.ch" #include "cgi.ch" @@ -79,29 +70,17 @@ CREATE CLASS TJSList METHOD New( name, lOpen, width, height, bgColor, ; FONT, fntColor, fntSize, cMinusImg, cPlusImg ) - METHOD NewNode( name, lOpen, width, height, bgColor ) - METHOD SetFont( name, font, fntColor, fntSize ) - METHOD AddItem( name, url, bgColor ) - METHOD AddLink( name, url, img, bgColor ) - METHOD EndNode( name, caption ) - METHOD Build( xPos, yPos ) - METHOD Put( cFile ) ENDCLASS -/**** -* -* Create main node -* -*/ - +/* Create main node */ METHOD New( name, lOpen, width, height, bgColor, ; FONT, fntColor, fntSize, cMinusImg, cPlusImg ) CLASS TJSList diff --git a/contrib/xhb/html.ch b/contrib/xhb/html.ch index 690e55309f..2fbca24c83 100644 --- a/contrib/xhb/html.ch +++ b/contrib/xhb/html.ch @@ -2,6 +2,7 @@ * Main HTML include File Definition of all html lib commands * * Copyright 2000 Manos Aspradakis + * Copyright 2000 Luiz Rafael Culik (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #ifndef _HTML_CH #include "simpleio.ch" @@ -64,7 +55,7 @@ #xtranslate CRLF( ) => ( + Chr( 13 ) + Chr( 10 ) ) #xtranslate CRLF() => ( Chr( 13 ) + Chr( 10 ) ) -/* +#if 0 #xcommand DEFINE HTML ; [FILE ] ; [TITLE ] ; @@ -88,22 +79,23 @@ [BASETARGET <basetarget>] ; [STYLESHEET <cStyleScr>] ; [REFRESH <nRefresh>] ; - [REFRESHURL <cRefreshURL>] ; - [<lcache:NOCACHE>] ; + [REFRESHURL <cRefreshURL>] ; + [<lcache:NOCACHE>] ; OF <oHtml> ; => ; - <oHtml> := THtml():new( <file>,<title>,<linktitle>,<charset>,; + <oHtml> := THtml():new( <file>, <title>, <linktitle>, <charset>, ; [{<(javasrc)>}], ; - [<bgimg>], [<bgcolor>], [<txtcolor>],; - [{<(javacode)>}],; + [<bgimg>], [<bgcolor>], [<txtcolor>], ; + [{<(javacode)>}], ; [<(onload)>], [<(onunload)>], ; - [<(lcolor)>],[<(vlcolor)>],[<(alcolor)>],; - [<(cStyle)>], [<aImages>],; - [<baseurl>], [<basetarget>] ,; - [<nRefresh>], [<cRefreshURL>],; - <cStyleScr>,<.lcache.>) -*/ -#xcommand DEFINE HTML ; + [<(lcolor)>],[<(vlcolor)>],[<(alcolor)>], ; + [<(cStyle)>], [<aImages>], ; + [<baseurl>], [<basetarget>], ; + [<nRefresh>], [<cRefreshURL>], ; + <cStyleScr>, <.lcache.> ) +#endif + +#xcommand DEFINE HTML ; [FILE <file>] ; [TITLE <title>] ; [LINKTITLE <linktitle>] ; @@ -127,7 +119,7 @@ [BASETARGET <basetarget>] ; [REFRESH <nrefr> [REFRESHURL <refrURL>] ] ; [STYLESHEET <cStyleScr>] ; - [<lcache:NOCACHE>] ; + [<lcache:NOCACHE>] ; [NOF <nof> ] ; [TOPMARGIN <nMarginTop>]; [LEFTMARGIN <nMarginLeft>] ; @@ -135,17 +127,17 @@ [MARGINWIDTH <nMarginWidth>] ; OF <oHtml> ; => ; - <oHtml> := THtml():new(<title>, <linktitle>, <charset>,; + <oHtml> := THtml():new( <title>, <linktitle>, <charset>, ; [{<(javasrc)>}], ; - [<bgimg>], [<bgcolor>], [<txtcolor>],; - [{<(javacode)>}],; + [<bgimg>], [<bgcolor>], [<txtcolor>], ; + [{<(javacode)>}], ; [<(onload)>], [<(onunload)>], ; - [<(lcolor)>], [<(vlcolor)>], [<(alcolor)>],; - [<(cStyle)>], [<aImages>], [{<(srvr)>}],; + [<(lcolor)>], [<(vlcolor)>], [<(alcolor)>], ; + [<(cStyle)>], [<aImages>], [{<(srvr)>}], ; [<baseurl>], [<basetarget>], ; - <nrefr>, <refrURL>, <cStyleScr>, <.lcache.>, <nof>,; - <nMarginTop>, <nMarginHeight>, <nMarginWidth>, <nMarginLeft> ,; - .F.,<file>) + <nrefr>, <refrURL>, <cStyleScr>, <.lcache.>, <nof>, ; + <nMarginTop>, <nMarginHeight>, <nMarginWidth>, <nMarginLeft>, ; + .F.,<file> ) #xcommand DEFINE CGI ; [FILE <file>] ; @@ -179,16 +171,16 @@ [MARGINWIDTH <nMarginWidth>] ; OF <oHtml> ; => ; - <oHtml> := THtml():new(<title>, <linktitle>, <charset>,; + <oHtml> := THtml():new( <title>, <linktitle>, <charset>, ; [{<(javasrc)>}], ; - [<bgimg>], [<bgcolor>], [<txtcolor>],; - [{<(javacode)>}],; + [<bgimg>], [<bgcolor>], [<txtcolor>], ; + [{<(javacode)>}], ; [<(onload)>], [<(onunload)>], ; - [<(lcolor)>], [<(vlcolor)>], [<(alcolor)>],; - [<(cStyle)>], [<aImages>], [{<(srvr)>}],; + [<(lcolor)>], [<(vlcolor)>], [<(alcolor)>], ; + [<(cStyle)>], [<aImages>], [{<(srvr)>}], ; [<baseurl>], [<basetarget>], ; - <nrefr>, <refrURL>, <cStyleScr>, <.lcache.>, <nof>,; - <nMarginTop>, <nMarginHeight>, <nMarginWidth>, <nMarginLeft> ,; + <nrefr>, <refrURL>, <cStyleScr>, <.lcache.>, <nof>, ; + <nMarginTop>, <nMarginHeight>, <nMarginWidth>, <nMarginLeft>, ; .T., <file> ) // [<auth:AUTHENTICATE>] ; @@ -219,13 +211,13 @@ [NOF <nof> ] ; OF <oHtm> ; => ; - <oHtm>:defineTable( <cols>, <border>, <width>,<height>, ; + <oHtm>:defineTable( <cols>, <border>, <width>, <height>, ; <clrfore>, <clrbg>, ; - <.d.>, <.c.>, <.r.>,; + <.d.>, <.c.>, <.r.>, ; <clrdrk>, <clrlt>, <cClrBorder>, ; <nCellPadding>, <nCellSpacing>, ; - __HTML_ALING__ [<aln>], <.x.>, <bgImage>, ; - <cStyle>, <id> , <nof>) + __HTML_ALIGN__ [<aln>], <.x.>, <bgImage>, ; + <cStyle>, <id>, <nof> ) #xcommand DEFINE TABLE HEADER ; @@ -238,13 +230,13 @@ [HEIGHT <nHeight>] ; OF <oHtm> ; => ; - <oHtm>:TableHead( <cHead>, <cColor>, __HTML_ALING__ [<aln>], <cFont>, ; + <oHtm>:TableHead( <cHead>, <cColor>, __HTML_ALIGN__ [<aln>], <cFont>, ; <nSize>, <cFntColor>, <nHeight> ) #xcommand DEFINE CELL ; [COLOR <cColor>] ; - [ALING <aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>]; + [ALIGN <aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>]; [FONT <cFont>] ; [SIZE <nSize>] ; [FONTCOLOR <cFntColor>] ; @@ -262,10 +254,10 @@ [CLASS <cClass>] ; OF <oHtm> ; => ; - <oHtm>:newTableCell( __HTML_ALING__ [<aln>], <cColor>, <cFont>, ; + <oHtm>:newTableCell( __HTML_ALIGN__ [<aln>], <cColor>, <cFont>, ; <nSize>, <cFntColor>, <nHeight>, ; <img>, <width>, ! <.nowrap.>, ; - <cspan>, <rspan> ,__HTML_ALING__ [<valn>], <clrdrk>, <clrlt>, <bclrlt>, <cClass>) + <cspan>, <rspan> ,__HTML_ALIGN__ [<valn>], <clrdrk>, <clrlt>, <bclrlt>, <cClass> ) #xcommand TABLE CELL ; @@ -282,7 +274,7 @@ [<aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>]; OF <oHtm> ; => ; - <oHtm>:newTableCell( __HTML_ALING__ [<aln>], <cColor>, <cFont>, ; + <oHtm>:newTableCell( __HTML_ALIGN__ [<aln>], <cColor>, <cFont>, ; <nSize>, <cFntColor>, <nHeight>, ; <img>, <width>, ! <.nowrap.>, ; <cspan>, <rspan> ) @@ -294,7 +286,7 @@ [ALIGN <aln1:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>]; OF <oHtm> ; => ; - <oHtm>:NewTableRow( <cColor>, __HTML_ALING__ [<aln>], __HTML_ALING__ [<aln1>] ); + <oHtm>:NewTableRow( <cColor>, __HTML_ALIGN__ [<aln>], __HTML_ALIGN__ [<aln1>] ); #xcommand DEFINE FONT [<cFont>] ; [<ftype:BOLD,ITALIC,ULINE,UNDERLINE>] ; @@ -353,7 +345,7 @@ [COLOR <clr>] ; <of:OF,IN> <oHtm> ; => ; - <oHtm>:Say( <str>, <fnt>, <size>, <type>, <clr>, <style>) + <oHtm>:Say( <str>, <fnt>, <size>, <type>, <clr>, <style> ) #xcommand PUSH BUTTON ; @@ -371,8 +363,8 @@ => ; <oHtm>:PushButton( <(name)>, <(caption)>, ; [<(cgiapp)>], [<(onclick)>], ; - [<(onfocus)>], [<(onblur)>],; - [<(onmsov)>], [<(onmsou)>],; + [<(onfocus)>], [<(onblur)>], ; + [<(onmsov)>], [<(onmsou)>], ; [<(style)>], [<(id)>] ) #xcommand BUTTON ; @@ -388,7 +380,7 @@ =>; <oHtm>:Button( <(name)>, <(caption)>, ; [<(onclick)>],[<(cgiapp)>], ; - [<(onmsov)>], [<(onmsou)>],; + [<(onmsov)>], [<(onmsou)>], ; [<(style)>], [<(id)>] ) @@ -411,9 +403,9 @@ [<break:BREAK>] ; OF <oHtm> ; => ; - <oHtm>:putImageURL( <image>, <border>, <height>, <url>,; + <oHtm>:putImageURL( <image>, <border>, <height>, <url>, ; <onclick>, <onmsover>, <onmsout>, ; - <name>, <alt>, <target>, <width>,<.break.>) + <name>, <alt>, <target>, <width>, <.break.> ) #xcommand IMAGE <image> ; @@ -433,10 +425,10 @@ [ALIGN <aln1:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>]; OF <oHtm> ; => ; - <oHtm>:putImage( <image>, <border>, <height>,; + <oHtm>:putImage( <image>, <border>, <height>, ; <onclick>, <onmsover>, <onmsout>, ; <name>, <alt>, ; - <target>, <width>, <.break.>, <iD>, <map>, __HTML_ALING__ [<aln1>] , <hspace>) + <target>, <width>, <.break.>, <iD>, <map>, __HTML_ALIGN__ [<aln1>], <hspace> ) #xcommand LINK <url> ; [TEXT <text>] ; @@ -455,7 +447,7 @@ => ; <oHtm>:putTextURL( <text>, <url>, ; <onclick>, <onmsover>, <onmsout>, ; - <target>, <font>, <clr>, <size>, <style>, <.bld.> ,<.break.>, <cClass>) + <target>, <font>, <clr>, <size>, <style>, <.bld.>, <.break.>, <cClass> ) #xcommand LINK <url> ; [IMAGE <image>] ; @@ -475,9 +467,9 @@ [ALIGN <aln1:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>]; OF <oHtm> ; => ; - <oHtm>:putImageURL( <image>,<border>,<height>,<url>,; + <oHtm>:putImageURL( <image>, <border>, <height>, <url>, ; <onclick>, <onmsover>, <onmsout>, <name>, <alt>, ; - <target>, <width>, <.break.>, <cClass>, <id>, < hspace >, __HTML_ALING__ [<aln1>] ) + <target>, <width>, <.break.>, <cClass>, <id>, < hspace >, __HTML_ALIGN__ [<aln1>] ) #xcommand NEW FRAMEPAGE ; @@ -546,7 +538,7 @@ <oHtm>:Marquee( <cText>, <cFont>, <cFntColor>, <nFntSize>, ; __HTML_POS__ [<pos>], <nWidth>, <nHeight>, <cbgColor>, ; __HTML_BEHAVE__ [<bhv>], __HTML_DIR__ [<dir>], ; - <nScrollAmt>, <nScrollDel>, <loop>,; + <nScrollAmt>, <nScrollDel>, <loop>, ; [<(onmsover)>], [<(onmsout)>], [<(onclick)>], ; [<(onstart)>], [<(onfinish)>] ) @@ -574,7 +566,7 @@ <oHtm>:StartMarquee( <cFont>, <cFntColor>, <nFntSize>, ; __HTML_POS__ [<pos>], <nWidth>, <nHeight>, <cbgColor>, ; __HTML_BEHAVE__ [<bhv>], __HTML_DIR__ [<dir>], ; - <nScrollAmt>, <nScrollDel>, <loop>,; + <nScrollAmt>, <nScrollDel>, <loop>, ; [<(onmsover)>], [<(onmsout)>], [<(onclick)>], ; [<(onstart)>], [<(onfinish)>] ) @@ -615,9 +607,7 @@ => ; PutCounter( <oHtm>, <num>, <folder>, <dig>, <w>, <clr>, <b> ) -/*******************************************/ -/* New Commands */ -/*******************************************/ +/* New Commands */ #xcommand LINKS <url> ; [TEXT <text>] ; @@ -635,24 +625,24 @@ [CLASS <cClass>] ; OF <oHtm> ; => ; - <oHtm>:putTextImageURL( <image>, <border>, <height>, <url>,; - <onclick>, <onmsover>, <onmsout>, <name>, <alt> , ; - <target>,<width>, <.break.>, <cClass>, <text>) + <oHtm>:putTextImageURL( <image>, <border>, <height>, <url>, ; + <onclick>, <onmsover>, <onmsout>, <name>, <alt>, ; + <target>, <width>, <.break.>, <cClass>, <text> ) #xcommand SPAN <text> ; [STYLE <cStyle>] ; OF <oHtm> ; => ; - <oHtm>:Span(<text>,<cStyle>) + <oHtm>:Span( <text>, <cStyle> ) #xcommand Comment <text> ; OF <oHtm> ; => ; - <oHtm>:Comment(<text>) + <oHtm>:Comment( <text> ) #xcommand LINKNAME <cName> ; OF <oHtm> ; => ; - <oHtm>:PutLinkName(<cName>) + <oHtm>:PutLinkName( <cName> ) #xcommand CREATE OBJECT ; @@ -667,14 +657,14 @@ [<aln:LEFT,RIGHT,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSBOTTOM,BASELINE>]; OF <oHtm> ; => ; - <oHtm>:ADDOBJECT(<cType>,<cClassid>,__HTML_ALING__ [<aln>],<cCode>,<.lDisable.>,<cCodeBase>,<cName>,<nWidth>,<nHeight>) + <oHtm>:ADDOBJECT( <cType>, <cClassid>, __HTML_ALIGN__ [<aln>], <cCode>, <.lDisable.>, <cCodeBase>, <cName>, <nWidth>, <nHeight> ) #xcommand OBJECT PARAM ; NAME <cName> ; VALUE <cValue> ; OF <oHtm> ; => ; - <oHtm>:ADDPARAM(<cName>,<cValue>) + <oHtm>:ADDPARAM( <cName>, <cValue> ) #xcommand END OBJECT ; OF <oHtm> ; @@ -715,47 +705,47 @@ =>; <ohtm>:MapArea( <(Shape)>, <Alt>, <coord>, <Url> ) -#xtranslate __HTML_SCROLL__ => "AUTO" -#xtranslate __HTML_SCROLL__ <scrl:NO> => "NO" -#xtranslate __HTML_SCROLL__ <scrl:OFF> => "NO" -#xtranslate __HTML_SCROLL__ <scrl:ON> => "YES" -#xtranslate __HTML_SCROLL__ <scrl:YES> => "YES" -#xtranslate __HTML_SCROLL__ <scrl:AUTO> => "AUTO" +#xtranslate __HTML_SCROLL__ => "auto" +#xtranslate __HTML_SCROLL__ <scrl:NO> => "no" +#xtranslate __HTML_SCROLL__ <scrl:OFF> => "no" +#xtranslate __HTML_SCROLL__ <scrl:ON> => "yes" +#xtranslate __HTML_SCROLL__ <scrl:YES> => "yes" +#xtranslate __HTML_SCROLL__ <scrl:AUTO> => "auto" -#xtranslate __HTML_ALING__ => NIL -#xtranslate __HTML_ALING__ <aln:LEFT> => "LEFT" -#xtranslate __HTML_ALING__ <aln:RIGHT> => "RIGHT" -#xtranslate __HTML_ALING__ <aln:CENTER> => "center" -#xtranslate __HTML_ALING__ <aln:MIDDLE> => "MIDDLE" -#xtranslate __HTML_ALING__ <aln:TOP> => "TOP" -#xtranslate __HTML_ALING__ <aln:TEXTTOP> => "TEXTTOP" -#xtranslate __HTML_ALING__ <aln:BOTTOM> => "BOTTOM" -#xtranslate __HTML_ALING__ <aln:ABSMIDDLE> => "ABSMIDDLE" -#xtranslate __HTML_ALING__ <aln:ABSCENTER> => "ABSMIDDLE" -#xtranslate __HTML_ALING__ <aln:ABSBOTTOM> => "ABSBOTTOM" -#xtranslate __HTML_ALING__ <aln:BASELINE> => "BASELINE" +#xtranslate __HTML_ALIGN__ => NIL +#xtranslate __HTML_ALIGN__ <aln:LEFT> => "left" +#xtranslate __HTML_ALIGN__ <aln:RIGHT> => "right" +#xtranslate __HTML_ALIGN__ <aln:CENTER> => "center" +#xtranslate __HTML_ALIGN__ <aln:MIDDLE> => "middle" +#xtranslate __HTML_ALIGN__ <aln:TOP> => "top" +#xtranslate __HTML_ALIGN__ <aln:TEXTTOP> => "texttop" +#xtranslate __HTML_ALIGN__ <aln:BOTTOM> => "bottom" +#xtranslate __HTML_ALIGN__ <aln:ABSMIDDLE> => "absmiddle" +#xtranslate __HTML_ALIGN__ <aln:ABSCENTER> => "absmiddle" +#xtranslate __HTML_ALIGN__ <aln:ABSBOTTOM> => "absbottom" +#xtranslate __HTML_ALIGN__ <aln:BASELINE> => "baseline" #xtranslate __HTML_POS__ => NIL -#xtranslate __HTML_POS__ <pos:TOP> => "TOP" -#xtranslate __HTML_POS__ <pos:MIDDLE> => "MIDDLE" -#xtranslate __HTML_POS__ <pos:BOTTOM> => "BOTTOM" +#xtranslate __HTML_POS__ <pos:TOP> => "top" +#xtranslate __HTML_POS__ <pos:MIDDLE> => "middle" +#xtranslate __HTML_POS__ <pos:BOTTOM> => "bottom" #xtranslate __HTML_DIR__ => NIL -#xtranslate __HTML_DIR__ <dir:LEFT> => "LEFT" -#xtranslate __HTML_DIR__ <dir:RIGHT> => "RIGHT" +#xtranslate __HTML_DIR__ <dir:LEFT> => "left" +#xtranslate __HTML_DIR__ <dir:RIGHT> => "right" #xtranslate __HTML_BEHAVE__ => NIL -#xtranslate __HTML_BEHAVE__ <bhv:SCROLL> => "SCROLL" -#xtranslate __HTML_BEHAVE__ <bhv:SLIDE> => "SLIDE" -#xtranslate __HTML_BEHAVE__ <bhv:ALTERNATE> => "ALTERNATE" -#xtranslate __HTML_BEHAVE__ <bhv:ALT> => "ALTERNATE" +#xtranslate __HTML_BEHAVE__ <bhv:SCROLL> => "scroll" +#xtranslate __HTML_BEHAVE__ <bhv:SLIDE> => "slide" +#xtranslate __HTML_BEHAVE__ <bhv:ALTERNATE> => "alternate" +#xtranslate __HTML_BEHAVE__ <bhv:ALT> => "alternate" #xtranslate __HTML_FTYPE__ => NIL -#xtranslate __HTML_FTYPE__ <ftype:ITALIC> => "<I>" -#xtranslate __HTML_FTYPE__ <ftype:BOLD> => "<B>" -#xtranslate __HTML_FTYPE__ <ftype:ULINE> => "<U>" -#xtranslate __HTML_FTYPE__ <ftype:UNDERLINE> => "<U>" +#xtranslate __HTML_FTYPE__ <ftype:ITALIC> => "<i>" +#xtranslate __HTML_FTYPE__ <ftype:BOLD> => "<b>" +#xtranslate __HTML_FTYPE__ <ftype:ULINE> => "<u>" +#xtranslate __HTML_FTYPE__ <ftype:UNDERLINE> => "<u>" #define _HTML_CH diff --git a/contrib/xhb/htmlclrs.ch b/contrib/xhb/htmlclrs.ch index c4d9efd24b..410cc63846 100644 --- a/contrib/xhb/htmlclrs.ch +++ b/contrib/xhb/htmlclrs.ch @@ -2,6 +2,7 @@ * Colors include file for HTMLLIB * * Copyright 2000 Manos Aspradakis <maspr@otenet.gr> + * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #ifndef _COLORS_CH #define ALICEBLUE "#A0CF00" diff --git a/contrib/xhb/htmlform.ch b/contrib/xhb/htmlform.ch index c52ad1f48b..7123fc9253 100644 --- a/contrib/xhb/htmlform.ch +++ b/contrib/xhb/htmlform.ch @@ -2,6 +2,7 @@ * Include file to create forms * * Copyright 2000 Manos Aspradakis <maspr@otenet.gr> + * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #ifndef _FORMS_CH #xcommand DEFINE FORM <oFrm> ; diff --git a/contrib/xhb/inet.h b/contrib/xhb/inet.h index 44fdb15c45..604c250791 100644 --- a/contrib/xhb/inet.h +++ b/contrib/xhb/inet.h @@ -1,5 +1,5 @@ /* - * The Internet Protocol / TCP support (xhb compatibility header) + * The Internet Protocol / TCP support (xHarbour compatibility header) * * Copyright 2009 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/xhb/regexrpl.prg b/contrib/xhb/regexrpl.prg index 65cdbd93b8..5a80efdeca 100644 --- a/contrib/xhb/regexrpl.prg +++ b/contrib/xhb/regexrpl.prg @@ -18,34 +18,35 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the GNU General Public License. * - * This exception applies only to the code released with this xHarbour - * explicit exception. If you add/copy code from other sources, - * as the General Public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * If you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * */ -#define MATCH_STRING 1 -#define MATCH_START 2 -#define MATCH_END 3 +#define MATCH_STRING 1 +#define MATCH_START 2 +#define MATCH_END 3 FUNCTION hb_regexReplace( cRegex, cString, cReplace, lCaseSensitive, lNewLine, nMaxMatches, nGetMatch ) diff --git a/contrib/xhb/stream.prg b/contrib/xhb/stream.prg index b0af3daf71..c312ffcb8f 100644 --- a/contrib/xhb/stream.prg +++ b/contrib/xhb/stream.prg @@ -1,5 +1,5 @@ /* - * xhb stream classes + * xHarbour stream classes * * Copyright 2009 {list of individual authors and e-mail addresses} * diff --git a/contrib/xhb/tcgi.prg b/contrib/xhb/tcgi.prg index 8c46f44ffc..3b5c1911be 100644 --- a/contrib/xhb/tcgi.prg +++ b/contrib/xhb/tcgi.prg @@ -2,6 +2,7 @@ * Cgi Class * * Copyright 2000 Manos Aspradakis <maspr@otenet.gr> + * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,20 +45,10 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbclass.ch" #include "cgi.ch" -CREATE CLASS TCgi FROM THtml +CREATE CLASS TCgi INHERIT THtml VAR nH VAR Server_Software @@ -87,9 +78,7 @@ CREATE CLASS TCgi FROM THtml VAR aQueryFields INIT {} METHOD New( cInBuffer ) - METHOD Field( cQueryName ) - METHOD ToObject() ENDCLASS @@ -151,16 +140,11 @@ METHOD New( cInBuffer ) CLASS TCgi RETURN ::ToObject() -/**** -* -* TCGI():ToObject() -* -* Creates instance variables out of CGI FORM return values -* or URL encoded content. -* -* It subclasses the TCgi class to a *new* class -*/ - +/* Creates instance variables out of CGI FORM return values + * or URL encoded content. + * + * It subclasses the TCgi class to a *new* class + */ METHOD ToObject() CLASS TCgi LOCAL i diff --git a/contrib/xhb/tedit.prg b/contrib/xhb/tedit.prg index 7b779ba7d3..01b880671f 100644 --- a/contrib/xhb/tedit.prg +++ b/contrib/xhb/tedit.prg @@ -2,6 +2,7 @@ * Editing and Forms Class for HTMLLIB * * Copyright 2000 Manos Aspradakis <maspr@otenet.gr> + * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,33 +45,17 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> - * Porting this library to Harbour - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbclass.ch" #include "cgi.ch" -#define _OPTION_TEXT 1 -#define _OPTION_VALUE 2 -#define _OPTION_LABEL 3 -#define _OPTION_SELECTED 4 -#define _OPTION_DISABLED 5 +#define _OPTION_TEXT 1 +#define _OPTION_VALUE 2 +#define _OPTION_LABEL 3 +#define _OPTION_SELECTED 4 +#define _OPTION_DISABLED 5 STATIC s_oForm -/**** -* -* Class THtmlControl() -* -*/ - CREATE CLASS THtmlControl VAR nH @@ -122,70 +107,38 @@ CREATE CLASS THtmlControl VAR onKeyDown VAR onKeyUp - METHOD SetName( c ) INLINE ::Name := c - - METHOD SetValue( c ) INLINE ::Value := c - - METHOD SetStyle( c ) INLINE ::Style := c - - METHOD SetId( c ) INLINE ::id := c - - METHOD SetRows( c ) INLINE ::Rows := c - - METHOD SetCols( c ) INLINE ::Cols := c - - METHOD SetCaption( c ) INLINE ::Caption := c - - METHOD SetPicture( c ) INLINE ::picture := c - - METHOD SetOnBlur( c ) INLINE ::onBlur := c - + METHOD SetName( c ) INLINE ::Name := c + METHOD SetValue( c ) INLINE ::Value := c + METHOD SetStyle( c ) INLINE ::Style := c + METHOD SetId( c ) INLINE ::id := c + METHOD SetRows( c ) INLINE ::Rows := c + METHOD SetCols( c ) INLINE ::Cols := c + METHOD SetCaption( c ) INLINE ::Caption := c + METHOD SetPicture( c ) INLINE ::picture := c + METHOD SetOnBlur( c ) INLINE ::onBlur := c METHOD SetOnChange( c ) INLINE ::onChange := c - - METHOD SetOnFocus( c ) INLINE ::onFocus := c - + METHOD SetOnFocus( c ) INLINE ::onFocus := c METHOD SetOnSelect( c ) INLINE ::onSelect := c - - METHOD SetOnClick( c ) INLINE ::onClick := c - + METHOD SetOnClick( c ) INLINE ::onClick := c METHOD SetOnMsOver( c ) INLINE ::onMouseOver := c - - METHOD SetOnMsOut( c ) INLINE ::onMouseOut := c - - METHOD SetSize( n ) INLINE ::Size := n - + METHOD SetOnMsOut( c ) INLINE ::onMouseOut := c + METHOD SetSize( n ) INLINE ::Size := n METHOD SetMaxChars( n ) INLINE ::MaxChars := n - - METHOD SetChecked( l ) INLINE ::Checked := l - - METHOD SetAlign( c ) INLINE ::Align := c - - METHOD SetWrap( c ) INLINE ::wrap := c - - METHOD SetSource( c ) INLINE ::Source := c - + METHOD SetChecked( l ) INLINE ::Checked := l + METHOD SetAlign( c ) INLINE ::Align := c + METHOD SetWrap( c ) INLINE ::wrap := c + METHOD SetSource( c ) INLINE ::Source := c METHOD SetReadOnly( l ) INLINE ::readOnly := l - METHOD SetDisabled( l ) INLINE ::disabled := l - METHOD SetMultiple( l ) INLINE ::multiple := l - METHOD SetOnMsDown( c ) INLINE ::onMouseDown := c - - METHOD SetOnMsUp( c ) INLINE ::onMouseup := c - + METHOD SetOnMsUp( c ) INLINE ::onMouseup := c METHOD SetOnKPress( c ) INLINE ::onKeyPress := c - - METHOD SetOnKDown( c ) INLINE ::onKeyDown := c - - METHOD SetOnKUp( c ) INLINE ::onKeyUp := c - - METHOD SetLabel( l ) INLINE ::lLabel := l - + METHOD SetOnKDown( c ) INLINE ::onKeyDown := c + METHOD SetOnKUp( c ) INLINE ::onKeyUp := c + METHOD SetLabel( l ) INLINE ::lLabel := l METHOD Put() - METHOD AddOption( cOption, cValue, cLabel, lSelected, lDisabled ) - METHOD SetControl( name, rows, cols, size, maxchars, value, onfocus, ; onblur, onchange, onselect, onclick, onmsover, onmsout, ; onmsdown, onmsup, onkdown, onkup, onkprs, ; @@ -194,12 +147,6 @@ CREATE CLASS THtmlControl ENDCLASS -/**** -* -* THtmlControl():Put() -* -*/ - METHOD Put() CLASS THtmlControl LOCAL i diff --git a/contrib/xhb/trpccli.prg b/contrib/xhb/trpccli.prg index a26aad03e7..965dcf056c 100644 --- a/contrib/xhb/trpccli.prg +++ b/contrib/xhb/trpccli.prg @@ -1,6 +1,5 @@ /* - * Remote Procedure Call code - * Client class + * Remote Procedure Call code - Client class * * Copyright 2003 Giancarlo Niccolai <giancarlo@niccolai.ws> * diff --git a/contrib/xhb/ttable.prg b/contrib/xhb/ttable.prg index 2ec3ecb284..bd96a2f18f 100644 --- a/contrib/xhb/ttable.prg +++ b/contrib/xhb/ttable.prg @@ -1,7 +1,8 @@ /* - * Table,Record and Field Class + * Table, Record and Field Class * * Copyright 2000-2003 Manos Aspradakis maspr@otenet.gr + * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> (Porting this library to Harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * - * Copyright 2000 -2002 Luiz Rafael Culik - * Methods CreateTable(),Gentable(),AddField() - * Plus optimization for Xharbour - * - */ - #include "hbclass.ch" #include "ttable.ch" diff --git a/contrib/xhb/txtline.c b/contrib/xhb/txtline.c index a19f12b976..4d21d634b2 100644 --- a/contrib/xhb/txtline.c +++ b/contrib/xhb/txtline.c @@ -2,7 +2,6 @@ * hb_TabExpand() and hb_ReadLine() functions * * Copyright 2004 Marcelo Lombardo - lombardo@uol.com.br - * http://www.xharbour.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +56,9 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen HB_SIZE nPos, nCurrCol, nLastBlk; HB_BOOL bBreak = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_readLine(%p, %" HB_PFS "u, %" HB_PFS "u, %" HB_PFS "u, %d, %p, %p, %" HB_PFS "u, %p, %p, %p, %p)", szText, nTextLen, nLineLen, nTabLen, bWrap, pTerm, pnTermSizes, nTerms, pbFound, pbEOF, pnEnd, pnEndOffset ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_readLine(%p, %" HB_PFS "u, %" HB_PFS "u, %" HB_PFS "u, %d, %p, %p, %" HB_PFS "u, %p, %p, %p, %p)", + ( const void * ) szText, nTextLen, nLineLen, nTabLen, bWrap, ( const void * ) pTerm, + ( void * ) pnTermSizes, nTerms, ( void * ) pbFound, ( void * ) pbEOF, ( void * ) pnEnd, ( void * ) pnEndOffset ) ); *pbFound = HB_FALSE; *pbEOF = HB_FALSE; @@ -117,7 +118,7 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen } else if( szText[ nPos ] == HB_CHAR_SOFT1 && szText[ nPos + 1 ] == HB_CHAR_SOFT2 ) { - /* Clipper does NOT considers SOFT CR as a word seperator - WHY? + /* Clipper does NOT consider SOFT CR as a word separator - WHY? Should we not fix that? */ #if 0 nLastBlk = nPos; @@ -170,7 +171,7 @@ static HB_ISIZ hb_tabexpand( const char * szString, char * szRet, HB_ISIZ nEnd, for( nPos = 0; nPos <= nEnd; nPos++ ) { if( szString[ nPos ] == HB_CHAR_HT ) - nSpAdded += ( ( nTabLen > 0 ) ? nTabLen - ( ( nPos + nSpAdded ) % nTabLen ) - 1 : 0 ); + nSpAdded += ( nTabLen > 0 ? nTabLen - ( ( nPos + nSpAdded ) % nTabLen ) - 1 : 0 ); else if( ( nPos < nEnd && szString[ nPos ] == HB_CHAR_SOFT1 && szString[ nPos + 1 ] == HB_CHAR_SOFT2 ) || szString[ nPos ] == HB_CHAR_LF ) nSpAdded--; else @@ -186,8 +187,7 @@ HB_FUNC( HB_TABEXPAND ) HB_ISIZ nStrLen = hb_parclen( 1 ); HB_SIZE nTabLen = hb_parns( 2 ); HB_SIZE nTabCount = 0; - HB_ISIZ nPos, nSize; - char * szRet; + HB_ISIZ nPos; for( nPos = 0; nPos < nStrLen; nPos++ ) { @@ -195,10 +195,12 @@ HB_FUNC( HB_TABEXPAND ) ++nTabCount; } - if( ( nStrLen == 0 ) || ( nTabCount == 0 ) || ( nTabLen == 0 ) ) + if( nStrLen == 0 || nTabCount == 0 || nTabLen == 0 ) hb_retc( szText ); else { + HB_ISIZ nSize; + char * szRet; nSize = nStrLen + nTabCount * ( nTabLen - 1 ); szRet = ( char * ) hb_xgrab( nSize + 1 ); memset( szRet, ' ', nSize ); @@ -216,7 +218,6 @@ HB_FUNC( HB_READLINE ) HB_SIZE * pnTermSizes; HB_SIZE nTabLen, nTerms; HB_SIZE nLineSize = hb_parni( 3 ); - HB_SIZE i; HB_BOOL bWrap = hb_parl( 5 ); HB_BOOL bFound, bEOF; HB_SIZE nStartOffset; @@ -256,6 +257,8 @@ HB_FUNC( HB_READLINE ) if( HB_IS_ARRAY( pTerm1 ) ) { + HB_SIZE i; + nTerms = hb_arrayLen( pTerm1 ); pTerm = ( const char ** ) hb_xgrab( sizeof( char * ) * nTerms ); pnTermSizes = ( HB_SIZE * ) hb_xgrab( sizeof( HB_SIZE ) * nTerms ); diff --git a/contrib/xhb/win32prn.ch b/contrib/xhb/win32prn.ch index e7ea0d8624..6d1324e7cb 100644 --- a/contrib/xhb/win32prn.ch +++ b/contrib/xhb/win32prn.ch @@ -51,8 +51,6 @@ /* ------------------------------- */ /* Deprecated constants and macros */ -/* ------------------------------- */ - #define HKEY_CLASSES_ROOT WIN_HKEY_CLASSES_ROOT #define HKEY_CURRENT_USER WIN_HKEY_CURRENT_USER #define HKEY_LOCAL_MACHINE WIN_HKEY_LOCAL_MACHINE diff --git a/contrib/xhb/wintypes.ch b/contrib/xhb/wintypes.ch index 19d7cbc702..86f274d2d0 100644 --- a/contrib/xhb/wintypes.ch +++ b/contrib/xhb/wintypes.ch @@ -1,5 +1,7 @@ /* + * Windows types * + * Copyright 200? {list of individual authors and e-mail addresses} * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,6 +103,6 @@ #define HDC CTYPE_UNSIGNED_LONG #define HIMAGELIST CTYPE_UNSIGNED_LONG -#ytranslate CTYPE_Int( <x> ) => Int( <x> ) /* Fixes conflict with Int() function */ +#ytranslate CTYPE_Int( <x> ) => Int( <x> ) /* Fixes conflict with Int() function */ #endif /* __WINTYPES_CH */ diff --git a/contrib/xhb/xcstr.prg b/contrib/xhb/xcstr.prg index 2fe8ec65b8..68f5851b8b 100644 --- a/contrib/xhb/xcstr.prg +++ b/contrib/xhb/xcstr.prg @@ -1,5 +1,5 @@ /* - * CStr( xAnyType ) -> String + * CStr( xAnyType ) --> String * * Copyright 2001 Ron Pinkas <ron@@ronpinkas.com> * @@ -18,26 +18,27 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the GNU General Public License. * - * This exception applies only to the code released with this xHarbour - * explicit exception. If you add/copy code from other sources, - * as the General Public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * If you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * diff --git a/contrib/xhb/xdbmodst.prg b/contrib/xhb/xdbmodst.prg index d5a1d51c0c..9965beca73 100644 --- a/contrib/xhb/xdbmodst.prg +++ b/contrib/xhb/xdbmodst.prg @@ -1,5 +1,5 @@ /* - * dbModifyStructure( <cFile> ) -> lSuccess + * dbModifyStructure( <cFile> ) --> lSuccess * * Copyright 2009 Ron Pinkas <Ron.Pinkas at xHarbour.com> * diff --git a/contrib/xhb/xhb.ch b/contrib/xhb/xhb.ch index f4e7eb2ba5..e48eb26e68 100644 --- a/contrib/xhb/xhb.ch +++ b/contrib/xhb/xhb.ch @@ -1,5 +1,5 @@ /* - * Header file for cross-compatibility with xhb + * Header file for cross-compatibility with xHarbour * * Copyright 1999-2007 {list of individual authors and e-mail addresses} * diff --git a/contrib/xhb/xhb.h b/contrib/xhb/xhb.h index 7c166d209b..58c9f9e780 100644 --- a/contrib/xhb/xhb.h +++ b/contrib/xhb/xhb.h @@ -1,5 +1,5 @@ /* - * Header file for C functions in xhb contrib folder + * Header file for C functions in xHarbour contrib directory * * Copyright 2008 {list of individual authors and e-mail addresses} * diff --git a/contrib/xhb/xhbarr.c b/contrib/xhb/xhbarr.c index ed7c81f979..ca9392454e 100644 --- a/contrib/xhb/xhbarr.c +++ b/contrib/xhb/xhbarr.c @@ -18,26 +18,27 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the GNU General Public License. * - * This exception applies only to the code released with this xHarbour - * explicit exception. If you add/copy code from other sources, - * as the General Public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * If you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * @@ -48,7 +49,7 @@ #include "hbapiitm.h" #include "hbapierr.h" -/* ASplice( <aArray> [, <nPos>] [, <nCount>] [,<xVal1>] [, ...] [, <xValN>] ) => <aDeleted> +/* ASplice( <aArray> [, <nPos>] [, <nCount>] [, <xVal1>] [, ...] [, <xValN>] ) --> <aDeleted> * Removes elements and return them as array, optionally add items */ HB_FUNC( ASPLICE ) @@ -152,7 +153,7 @@ HB_FUNC( ASPLICE ) /* Synonym of ASplice() Xbase++ compatibility (extended with optional replacemenet values) */ HB_FUNC_TRANSLATE( AREMOVE, ASPLICE ) -/* AMerge( <aTarget>, <aSource> [, <nPos>] ) => aTarget */ +/* AMerge( <aTarget>, <aSource> [, <nPos>] ) --> aTarget */ HB_FUNC( AMERGE ) { PHB_ITEM pArray1 = hb_param( 1, HB_IT_ARRAY ); diff --git a/contrib/xhb/xhbarrex.c b/contrib/xhb/xhbarrex.c index d82b6c6ffc..7c3cba7973 100644 --- a/contrib/xhb/xhbarrex.c +++ b/contrib/xhb/xhbarrex.c @@ -18,26 +18,27 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the GNU General Public License. * - * This exception applies only to the code released with this xHarbour - * explicit exception. If you add/copy code from other sources, - * as the General Public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * If you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * @@ -46,7 +47,7 @@ #include "hbapi.h" #include "hbapiitm.h" -/* ASizeAlloc( <array>, <num> ) -> <array> - Set the pre-alloc step. */ +/* ASizeAlloc( <array>, <num> ) --> <array> - Set the pre-alloc step. */ HB_FUNC( ASIZEALLOC ) { PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY ); @@ -59,7 +60,7 @@ HB_FUNC( ASIZEALLOC ) } } -/* ALenAlloc( <array> ) -> <num> - Get the pre-alloc step. */ +/* ALenAlloc( <array> ) --> <num> - Get the pre-alloc step. */ HB_FUNC( ALENALLOC ) { PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY ); diff --git a/contrib/xhb/xhbat.c b/contrib/xhb/xhbat.c index 51915ab826..74816c46f1 100644 --- a/contrib/xhb/xhbat.c +++ b/contrib/xhb/xhbat.c @@ -53,12 +53,12 @@ static HB_SIZE hb_AtSkipStrings( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen ) { - char cLastChar = ' '; - HB_TRACE( HB_TR_DEBUG, ( "hb_AtSkipStrings(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen ) ); if( nSubLen > 0 && nLen >= nSubLen ) { + char cLastChar = ' '; + HB_SIZE nPos = 0; HB_SIZE nSubPos = 0; @@ -182,7 +182,6 @@ HB_FUNC( ATI ) HB_ISIZ nLen = hb_itemGetCLen( pText ); HB_ISIZ nStart = pStart ? hb_itemGetNS( pStart ) : 1; HB_ISIZ nEnd = pEnd ? hb_itemGetNS( pEnd ) : nLen; - HB_SIZE nPos; if( nStart < 0 ) { @@ -203,8 +202,8 @@ HB_FUNC( ATI ) hb_retns( 0 ); else { - nPos = hb_strAtI( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ), - hb_itemGetCPtr( pText ) + nStart, nEnd - nStart ); + HB_SIZE nPos = hb_strAtI( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ), + hb_itemGetCPtr( pText ) + nStart, nEnd - nStart ); hb_retns( nPos ? nPos + nStart : 0 ); } } diff --git a/contrib/xhb/xhbcls.ch b/contrib/xhb/xhbcls.ch index 962b9bc32b..1a57861099 100644 --- a/contrib/xhb/xhbcls.ch +++ b/contrib/xhb/xhbcls.ch @@ -1,5 +1,5 @@ /* - * Header file for cross-compatibility with xhb class code extensions + * Header file for cross-compatibility with xHarbour class code extensions * * Warning: using this functionality may break logical inheritance * scheme or even some internal class definitions in both diff --git a/contrib/xhb/xhbcomp.prg b/contrib/xhb/xhbcomp.prg index 827f87a5d7..16e269b4bf 100644 --- a/contrib/xhb/xhbcomp.prg +++ b/contrib/xhb/xhbcomp.prg @@ -1,5 +1,5 @@ /* - * xhb compatibility functions + * xHarbour compatibility functions * * Copyright 2007 Viktor Szakats (vszakats.net/harbour) * @@ -60,7 +60,8 @@ ANNOUNCE XHB_LIB INIT PROCEDURE xhb_Init() - /* Add calls to do initial settings to Harbour to be more compatible with xhb. */ + /* Add calls to do initial settings to Harbour to be more compatible with + xHarbour. */ ASSOCIATE CLASS _Character WITH TYPE Character ASSOCIATE CLASS _Numeric WITH TYPE Numeric diff --git a/contrib/xhb/xhbcopyf.c b/contrib/xhb/xhbcopyf.c index fae719e7eb..68e7f31211 100644 --- a/contrib/xhb/xhbcopyf.c +++ b/contrib/xhb/xhbcopyf.c @@ -63,7 +63,7 @@ static HB_BOOL hb_copyfile( const char * pszSource, const char * pszDest, PHB_IT PHB_FILE pSource; PHB_ITEM pError = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_copyfile(%s, %s, %p)", pszSource, pszDest, pBlock ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_copyfile(%s, %s, %p)", pszSource, pszDest, ( void * ) pBlock ) ); do { diff --git a/contrib/xhb/xhbdate.c b/contrib/xhb/xhbdate.c index 34ffb53de4..20e46a1de0 100644 --- a/contrib/xhb/xhbdate.c +++ b/contrib/xhb/xhbdate.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers. + * xHarbour compatibility wrappers * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( DATETIME , HB_DATETIME ) HB_FUNC_TRANSLATE( HOUR , HB_HOUR ) diff --git a/contrib/xhb/xhberr.prg b/contrib/xhb/xhberr.prg index 7fd69f2fce..67885b256d 100644 --- a/contrib/xhb/xhberr.prg +++ b/contrib/xhb/xhberr.prg @@ -5,8 +5,9 @@ * * Copyright 2010 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * Copyright 2009 Viktor Szakats (vszakats.net/harbour) - * Copyright 2004 Ron Pinkas <ron @ xHarbour.com> * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 2001-2004 Ron Pinkas <ron@profit-master.com> (TraceLog()) + * Copyright 2002 Luiz Rafael Culik <culikr@uol.com.br> (strvalue(), LogError()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,16 +48,6 @@ * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2001 Ron Pinkas <ron@profit-master.com> - * TraceLog() - * CStr() - * Copyright 2002 Luiz Rafael Culik <culikr@uol.com.br> - * StrValue() - * FWriteLine() - * LogError() */ #include "error.ch" diff --git a/contrib/xhb/xhberrc.c b/contrib/xhb/xhberrc.c index 3ce329ab49..d8f985c326 100644 --- a/contrib/xhb/xhberrc.c +++ b/contrib/xhb/xhberrc.c @@ -47,7 +47,6 @@ #include "hbapi.h" #include "hbapiitm.h" #include "hbvm.h" -#include "hbvmpub.h" #include "hbstack.h" #include "hbthread.h" diff --git a/contrib/xhb/xhbfs.c b/contrib/xhb/xhbfs.c index 744fa5197d..28c001457b 100644 --- a/contrib/xhb/xhbfs.c +++ b/contrib/xhb/xhbfs.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers. + * xHarbour compatibility wrappers * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -51,7 +51,7 @@ HB_FUNC( ISDIRECTORY ) { HB_BOOL bRetVal; -#if defined( HB_OS_WIN ) && 0 /* Document, but don't replicate xhb bug. */ +#if defined( HB_OS_WIN ) && 0 /* Document, but don't replicate xHarbour bug. */ bRetVal = hb_fsDirExists( hb_parcx( 1 ) ); #else { diff --git a/contrib/xhb/xhbfunc.c b/contrib/xhb/xhbfunc.c index 3d7fc34ac5..89f79f021d 100644 --- a/contrib/xhb/xhbfunc.c +++ b/contrib/xhb/xhbfunc.c @@ -3,6 +3,7 @@ * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * Copyright 2010 Viktor Szakats (vszakats.net/harbour) + * Copyright 2000 David G. Holm <dholm@jsd-llc.com> (hb_F_Eof()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,16 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 David G. Holm <dholm@jsd-llc.com> - * hb_F_Eof() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapifs.h" #include "hbapigt.h" @@ -108,7 +99,7 @@ HB_FUNC( HB_VMMODE ) #if defined( HB_NO_PROFILER ) && defined( HB_NO_TRACE ) && ! defined( HB_GUI ) hb_retni( 2 ); /* optimized for console applications */ #elif defined( HB_NO_PROFILER ) && defined( HB_NO_TRACE ) && defined( HB_GUI ) - hb_retni( 1 ); /* optimized for gui applications */ + hb_retni( 1 ); /* optimized for GUI applications */ #else hb_retni( 0 ); /* no optimization */ #endif @@ -223,7 +214,8 @@ HB_FUNC( CURDIRX ) else iDrv = iCurDrv; - /* NOTE: hb_fsCurDirBuffEx() in xhb, but I couldn't decipher the difference. [vszakats] */ + /* NOTE: hb_fsCurDirBuffEx() in xHarbour, but I couldn't decipher the + difference. [vszakats] */ hb_fsCurDirBuff( iDrv, pbyBuffer, HB_PATH_MAX ); hb_retc_buffer( pbyBuffer ); diff --git a/contrib/xhb/xhbfunp.prg b/contrib/xhb/xhbfunp.prg index 39183f9fbe..14b46386bd 100644 --- a/contrib/xhb/xhbfunp.prg +++ b/contrib/xhb/xhbfunp.prg @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers. + * xHarbour compatibility wrappers. * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/xhb/xhbgt.c b/contrib/xhb/xhbgt.c index b9068d7620..fad558cb5b 100644 --- a/contrib/xhb/xhbgt.c +++ b/contrib/xhb/xhbgt.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers + * xHarbour compatibility wrappers * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( GTPROCESSMESSAGES , NEXTKEY ) HB_FUNC_TRANSLATE( GFXPRIMITIVE , HB_GFXPRIMITIVE ) diff --git a/contrib/xhb/xhbhash.c b/contrib/xhb/xhbhash.c index cea868122a..b740b34817 100644 --- a/contrib/xhb/xhbhash.c +++ b/contrib/xhb/xhbhash.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers + * xHarbour compatibility wrappers * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/contrib/xhb/xhbhasha.c b/contrib/xhb/xhbhasha.c index d6921e8237..5c5797ab48 100644 --- a/contrib/xhb/xhbhasha.c +++ b/contrib/xhb/xhbhasha.c @@ -44,8 +44,6 @@ * */ -#include "hbapi.h" - /* These functions are only for compatibility with existing * xHarbour code. Harbour does not emulate associative arrays by * special index but it uses real natural order for them. It means @@ -79,7 +77,7 @@ static HB_BOOL s_isHashAA( PHB_ITEM pHash ) return ( hb_hashGetFlags( pHash ) & HB_HASH_KEEPORDER ) != 0; } -/* haAGetKeyAt( <hValue>, <nPos> ) -> <value> */ +/* haAGetKeyAt( <hValue>, <nPos> ) --> <value> */ HB_FUNC( HAAGETKEYAT ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); @@ -99,7 +97,7 @@ HB_FUNC( HAAGETKEYAT ) } } -/* haAGetValueAt( <hValue>, <nPos> ) -> <value> */ +/* haAGetValueAt( <hValue>, <nPos> ) --> <value> */ HB_FUNC( HAAGETVALUEAT ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); @@ -119,7 +117,7 @@ HB_FUNC( HAAGETVALUEAT ) } } -/* haASetValueAt( <hValue>, <nPos>, <value> ) -> NIL */ +/* haASetValueAt( <hValue>, <nPos>, <value> ) --> NIL */ HB_FUNC( HAASETVALUEAT ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); @@ -140,7 +138,7 @@ HB_FUNC( HAASETVALUEAT ) } } -/* haADelAt( <hValue>, <nPos> ) -> NIL */ +/* haADelAt( <hValue>, <nPos> ) --> NIL */ HB_FUNC( HAADELAT ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); @@ -154,7 +152,7 @@ HB_FUNC( HAADELAT ) s_errRT_hashBound(); } -/* haAGetPos( <hValue>, <xKey> ) -> <nPos> */ +/* haAGetPos( <hValue>, <xKey> ) --> <nPos> */ HB_FUNC( HAAGETPOS ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); @@ -172,7 +170,7 @@ HB_FUNC( HAAGETPOS ) } } -/* haAGetRealPos( <hValue>, <nPos> ) -> <nRealPos> */ +/* haAGetRealPos( <hValue>, <nPos> ) --> <nRealPos> */ HB_FUNC( HAAGETREALPOS ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); @@ -188,7 +186,7 @@ HB_FUNC( HAAGETREALPOS ) s_errRT_hashArg(); } -/* HGetVAAPos( <hValue> ) -> <aOrder> */ +/* HGetVAAPos( <hValue> ) --> <aOrder> */ HB_FUNC( HGETVAAPOS ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); @@ -206,7 +204,7 @@ HB_FUNC( HGETVAAPOS ) s_errRT_hashArg(); } -/* HSetAACompatibility( <hValue>, <lAACompat> ) -> <lDone> */ +/* HSetAACompatibility( <hValue>, <lAACompat> ) --> <lDone> */ HB_FUNC( HSETAACOMPATIBILITY ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); @@ -224,7 +222,7 @@ HB_FUNC( HSETAACOMPATIBILITY ) s_errRT_hashArg(); } -/* HGetAACompatibility( <hValue> ) -> <lAACompat> */ +/* HGetAACompatibility( <hValue> ) --> <lAACompat> */ HB_FUNC( HGETAACOMPATIBILITY ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); diff --git a/contrib/xhb/xhbhashp.c b/contrib/xhb/xhbhashp.c index 24cd498379..36c508658a 100644 --- a/contrib/xhb/xhbhashp.c +++ b/contrib/xhb/xhbhashp.c @@ -1,8 +1,8 @@ /* - * xhb compatibility functions HSetPartition()/HGetPartition() + * xHarbour compatibility functions HSetPartition()/HGetPartition() * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) - * Copyright 2003 Giancarlo Niccolai + * Copyright 2003 Giancarlo Niccolai <gc@niccolai.ws> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ #include "hbapiitm.h" #include "hbapierr.h" -/* Dummy compatibility functions mimicing RTE behavior only. +/* Dummy compatibility functions mimicking RTE behavior only. The rest is not needed in Harbour */ HB_FUNC( HSETPARTITION ) @@ -60,9 +60,9 @@ HB_FUNC( HSETPARTITION ) if( ! pHash ) hb_errRT_BASE( EG_ARG, 2017, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); else if( hb_hashLen( pHash ) > 0 ) - hb_errRT_BASE( EG_ARG, 2017, "Can't change partitioning in a non-empty hash", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + hb_errRT_BASE( EG_ARG, 2017, "Cannot change partitioning in a non-empty hash", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); else if( ( hb_hashGetFlags( pHash ) & HB_HASH_KEEPORDER ) != 0 ) - hb_errRT_BASE( EG_ARG, 2017, "Can't set partitioning in a hash with associative array compatibility", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + hb_errRT_BASE( EG_ARG, 2017, "Cannot set partitioning in a hash with associative array compatibility", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); else if( uiLevel < 1 || uiLevel > 8 ) hb_errRT_BASE( EG_ARG, 2017, "Pagination level must be between 1 and 8", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } diff --git a/contrib/xhb/xhbi18n.c b/contrib/xhb/xhbi18n.c index a1f07e21a6..a74bc867ea 100644 --- a/contrib/xhb/xhbi18n.c +++ b/contrib/xhb/xhbi18n.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers + * xHarbour compatibility wrappers * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -44,6 +44,6 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( I18N, HB_I18N_GETTEXT ) diff --git a/contrib/xhb/xhbinet.c b/contrib/xhb/xhbinet.c index 29b6afaddf..1fd17cd164 100644 --- a/contrib/xhb/xhbinet.c +++ b/contrib/xhb/xhbinet.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers + * xHarbour compatibility wrappers * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( INETINIT , HB_INETINIT ) HB_FUNC_TRANSLATE( INETCLEANUP , HB_INETCLEANUP ) diff --git a/contrib/xhb/xhbini.c b/contrib/xhb/xhbini.c index 73809b4c08..86fddf29ea 100644 --- a/contrib/xhb/xhbini.c +++ b/contrib/xhb/xhbini.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers + * xHarbour compatibility wrappers * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( HB_SETINICOMMENT , HB_INISETCOMMENT ) HB_FUNC_TRANSLATE( HB_READINI , HB_INIREAD ) diff --git a/contrib/xhb/xhbinkey.ch b/contrib/xhb/xhbinkey.ch index b51deea80a..9911bde034 100644 --- a/contrib/xhb/xhbinkey.ch +++ b/contrib/xhb/xhbinkey.ch @@ -14,9 +14,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -49,46 +49,46 @@ /* New control keys that do not overlap with other codes */ -#define XHB_K_CTRL_A 513 /* Ctrl-A */ -#define XHB_K_CTRL_B 514 /* Ctrl-B */ -#define XHB_K_CTRL_C 515 /* Ctrl-C */ -#define XHB_K_CTRL_D 516 /* Ctrl-D */ -#define XHB_K_CTRL_E 517 /* Ctrl-E */ -#define XHB_K_CTRL_F 518 /* Ctrl-F */ -#define XHB_K_CTRL_G 519 /* Ctrl-G */ -#define XHB_K_CTRL_H 520 /* Ctrl-H */ -#define XHB_K_CTRL_I 521 /* Ctrl-I */ -#define XHB_K_CTRL_J 522 /* Ctrl-J */ -#define XHB_K_CTRL_K 523 /* Ctrl-K */ -#define XHB_K_CTRL_L 524 /* Ctrl-L */ -#define XHB_K_CTRL_M 525 /* Ctrl-M */ -#define XHB_K_CTRL_N 526 /* Ctrl-N */ -#define XHB_K_CTRL_O 527 /* Ctrl-O */ -#define XHB_K_CTRL_P 528 /* Ctrl-P */ -#define XHB_K_CTRL_Q 529 /* Ctrl-Q */ -#define XHB_K_CTRL_R 530 /* Ctrl-R */ -#define XHB_K_CTRL_S 531 /* Ctrl-S */ -#define XHB_K_CTRL_T 532 /* Ctrl-T */ -#define XHB_K_CTRL_U 533 /* Ctrl-U */ -#define XHB_K_CTRL_V 534 /* Ctrl-V */ -#define XHB_K_CTRL_W 535 /* Ctrl-W */ -#define XHB_K_CTRL_X 536 /* Ctrl-X */ -#define XHB_K_CTRL_Y 537 /* Ctrl-Y */ -#define XHB_K_CTRL_Z 538 /* Ctrl-Z */ +#define XHB_K_CTRL_A 513 /* Ctrl-A */ +#define XHB_K_CTRL_B 514 /* Ctrl-B */ +#define XHB_K_CTRL_C 515 /* Ctrl-C */ +#define XHB_K_CTRL_D 516 /* Ctrl-D */ +#define XHB_K_CTRL_E 517 /* Ctrl-E */ +#define XHB_K_CTRL_F 518 /* Ctrl-F */ +#define XHB_K_CTRL_G 519 /* Ctrl-G */ +#define XHB_K_CTRL_H 520 /* Ctrl-H */ +#define XHB_K_CTRL_I 521 /* Ctrl-I */ +#define XHB_K_CTRL_J 522 /* Ctrl-J */ +#define XHB_K_CTRL_K 523 /* Ctrl-K */ +#define XHB_K_CTRL_L 524 /* Ctrl-L */ +#define XHB_K_CTRL_M 525 /* Ctrl-M */ +#define XHB_K_CTRL_N 526 /* Ctrl-N */ +#define XHB_K_CTRL_O 527 /* Ctrl-O */ +#define XHB_K_CTRL_P 528 /* Ctrl-P */ +#define XHB_K_CTRL_Q 529 /* Ctrl-Q */ +#define XHB_K_CTRL_R 530 /* Ctrl-R */ +#define XHB_K_CTRL_S 531 /* Ctrl-S */ +#define XHB_K_CTRL_T 532 /* Ctrl-T */ +#define XHB_K_CTRL_U 533 /* Ctrl-U */ +#define XHB_K_CTRL_V 534 /* Ctrl-V */ +#define XHB_K_CTRL_W 535 /* Ctrl-W */ +#define XHB_K_CTRL_X 536 /* Ctrl-X */ +#define XHB_K_CTRL_Y 537 /* Ctrl-Y */ +#define XHB_K_CTRL_Z 538 /* Ctrl-Z */ /* extended shift key codes, none in Clipper */ -#define XHB_K_SH_LEFT 424 /* Shift-Left */ -#define XHB_K_SH_UP 425 /* Shift-Up */ +#define XHB_K_SH_LEFT 424 /* Shift-Left */ +#define XHB_K_SH_UP 425 /* Shift-Up */ #define XHB_K_SH_RIGHT 426 /* Shift-Right */ -#define XHB_K_SH_DOWN 427 /* Shift-Down */ +#define XHB_K_SH_DOWN 427 /* Shift-Down */ -#define XHB_K_SH_INS 428 /* Shift-Ins */ -#define XHB_K_SH_DEL 429 /* Shift-Del */ -#define XHB_K_SH_HOME 430 /* Shift-Home */ -#define XHB_K_SH_END 431 /* Shift-End */ -#define XHB_K_SH_PGUP 432 /* Shift-PgUp */ -#define XHB_K_SH_PGDN 433 /* Shift-PgDn */ +#define XHB_K_SH_INS 428 /* Shift-Ins */ +#define XHB_K_SH_DEL 429 /* Shift-Del */ +#define XHB_K_SH_HOME 430 /* Shift-Home */ +#define XHB_K_SH_END 431 /* Shift-End */ +#define XHB_K_SH_PGUP 432 /* Shift-PgUp */ +#define XHB_K_SH_PGDN 433 /* Shift-PgDn */ #define XHB_K_SH_RETURN 434 /* Shift-Enter */ #define XHB_K_SH_ENTER 434 /* Shift-Enter */ diff --git a/contrib/xhb/xhbkey.c b/contrib/xhb/xhbkey.c index 57414e0b84..ae7b7bb9bd 100644 --- a/contrib/xhb/xhbkey.c +++ b/contrib/xhb/xhbkey.c @@ -14,9 +14,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -93,7 +93,7 @@ static int hb_inkeyKeyXHB( int iKey ) HB_INKEY_ISCHAR( iKey ) || HB_INKEY_ISUNICODE( iKey ) ) { - if( ( iFlags & ( HB_KF_CTRL | HB_KF_ALT ) ) == HB_KF_CTRL ) + if( ( iFlags & ( HB_KF_CTRL | HB_KF_ALT ) ) == HB_KF_CTRL ) { if( iValue >= 'A' && iValue <= 'Z' ) return 512 + ( iValue - 'A' ) + 1; diff --git a/contrib/xhb/xhbmemo.prg b/contrib/xhb/xhbmemo.prg index 0cf077eb28..cc42f12a73 100644 --- a/contrib/xhb/xhbmemo.prg +++ b/contrib/xhb/xhbmemo.prg @@ -48,10 +48,9 @@ #include "memoedit.ch" #include "inkey.ch" -// // A specialized HBEditor which can simulate MemoEdit() behaviour -// -CREATE CLASS xhb_TMemoEditor FROM XHBEditor + +CREATE CLASS xhb_TMemoEditor INHERIT XHBEditor VAR xUserFunction // User Function called to change default MemoEdit() behaviour diff --git a/contrib/xhb/xhbmisc.prg b/contrib/xhb/xhbmisc.prg index 37aefac505..b056e01e7f 100644 --- a/contrib/xhb/xhbmisc.prg +++ b/contrib/xhb/xhbmisc.prg @@ -1,8 +1,8 @@ /* - * xhb compatibility functions + * xHarbour compatibility functions * * Copyright 2012 Przemyslaw Czerpak <druzus / at / priv.onet.pl> (optimization and fixes) - * Copyright 2012 Viktor Szakats (vszakats.net/harbour) (rework) + * Copyright 2012 Viktor Szakats (vszakats.net/harbour) (rework, xhb__Run()) * Copyright 2004 Eduardo Fernandes <modalsist@yahoo.com.br> (original) * * This program is free software; you can redistribute it and/or modify diff --git a/contrib/xhb/xhbmsgs.c b/contrib/xhb/xhbmsgs.c index 464a8ce092..3beeff6cdf 100644 --- a/contrib/xhb/xhbmsgs.c +++ b/contrib/xhb/xhbmsgs.c @@ -57,7 +57,7 @@ HB_FUNC( XHB_HASHERROR ) if( iPCount == 1 ) { - if( szMessage[ 0 ] == '_' ) /* ASSIGN */ + if( szMessage[ 0 ] == '_' ) /* ASSIGN */ { PHB_ITEM pIndex = hb_itemPutCConst( hb_stackAllocItem(), szMessage + 1 ); PHB_ITEM pDest = hb_hashGetItemPtr( hb_stackSelfItem(), pIndex, HB_HASH_AUTOADD_ASSIGN ); @@ -71,7 +71,7 @@ HB_FUNC( XHB_HASHERROR ) } } } - else if( iPCount == 0 ) /* ACCESS */ + else if( iPCount == 0 ) /* ACCESS */ { PHB_ITEM pIndex = hb_itemPutCConst( hb_stackAllocItem(), szMessage ); PHB_ITEM pValue = hb_hashGetItemPtr( hb_stackSelfItem(), pIndex, HB_HASH_AUTOADD_ACCESS ); diff --git a/contrib/xhb/xhbmt.prg b/contrib/xhb/xhbmt.prg index 714c624541..199f5eeda7 100644 --- a/contrib/xhb/xhbmt.prg +++ b/contrib/xhb/xhbmt.prg @@ -56,7 +56,7 @@ FUNCTION StartThread( p1, p2, ... ) RETURN hb_threadStart( p1, p2, ... ) -FUNCTION Subscribe( mtx, nTimeOut, lSubscribed ) +FUNCTION Subscribe( mtx, nTimeOut, /* @ */ lSubscribed ) LOCAL xSubscribed @@ -66,7 +66,7 @@ FUNCTION Subscribe( mtx, nTimeOut, lSubscribed ) RETURN xSubscribed -FUNCTION SubscribeNow( mtx, nTimeOut, lSubscribed ) +FUNCTION SubscribeNow( mtx, nTimeOut, /* @ */ lSubscribed ) LOCAL xSubscribed @@ -86,24 +86,24 @@ FUNCTION IsValidThread( pThID ) BEGIN SEQUENCE WITH {|| Break() } lValid := hb_threadID( pThID ) != 0 - recover + RECOVER lValid := .F. END SEQUENCE RETURN lValid -FUNCTION KillThread( pThID ) +PROCEDURE KillThread( pThID ) hb_threadQuitRequest( pThID ) - RETURN NIL + RETURN -FUNCTION StopThread( pThID ) +PROCEDURE StopThread( pThID ) hb_threadQuitRequest( pThID ) hb_threadJoin( pThID ) - RETURN NIL + RETURN FUNCTION ThreadSleep( nTimeOut ) RETURN hb_idleSleep( nTimeOut / 1000 ) diff --git a/contrib/xhb/xhbmtc.c b/contrib/xhb/xhbmtc.c index 8eea1a349a..29ff6ebef6 100644 --- a/contrib/xhb/xhbmtc.c +++ b/contrib/xhb/xhbmtc.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers + * xHarbour compatibility wrappers * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" /* MT functions */ HB_FUNC_TRANSLATE( HB_MULTITHREAD , HB_MTVM ) diff --git a/contrib/xhb/xhbprn.c b/contrib/xhb/xhbprn.c index e46cf54693..d08746c02b 100644 --- a/contrib/xhb/xhbprn.c +++ b/contrib/xhb/xhbprn.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #if defined( HB_OS_WIN ) diff --git a/contrib/xhb/xhbproc.c b/contrib/xhb/xhbproc.c index 7814a47a81..7703fc0af2 100644 --- a/contrib/xhb/xhbproc.c +++ b/contrib/xhb/xhbproc.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers + * xHarbour compatibility wrappers * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( HB_OPENPROCESS , HB_PROCESSOPEN ) HB_FUNC_TRANSLATE( HB_CLOSEPROCESS , HB_PROCESSCLOSE ) diff --git a/contrib/xhb/xhbregx.c b/contrib/xhb/xhbregx.c index db97de12ac..2802da93aa 100644 --- a/contrib/xhb/xhbregx.c +++ b/contrib/xhb/xhbregx.c @@ -1,5 +1,5 @@ /* - * xhb compatibility wrappers + * xHarbour compatibility wrappers * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * @@ -44,6 +44,6 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( HB_ISREGEXSTRING, HB_ISREGEX ) diff --git a/contrib/xhb/xhbtedit.prg b/contrib/xhb/xhbtedit.prg index 24eae28e0f..4a2c6ea003 100644 --- a/contrib/xhb/xhbtedit.prg +++ b/contrib/xhb/xhbtedit.prg @@ -45,45 +45,38 @@ */ /* - * Pritpal Bedi <pritpal@vouchcac.com> - * 2004-02-28 - * - * Suppor for Clipper's MemoEdit( ..., nTextBufferRow, nTextBufferCol, nWindowRow, nWindowCol ) - * Rearrangement of code in logical sections. - * Reformatting of code to be more readable. - * Navigation code broken into small methods for easy mainainability on lines with TBrowse() + * Teditor Fix: v3.0beta 2004-04-17 + * Copyright 2004 Giancarlo Niccolai <antispam /at/ niccolai.ws> * + * Minimal revision for proper working (especially with word wrapping). + * Fixed many functions + * Added GotoCol() and GotoPos() to goto a logical column or position; + * they translate this movement in a adequate ::SetPos call. */ /* + * Pritpal Bedi <pritpal@vouchcac.com> 2004-02-28 * - * Teditor Fix: v3.0beta 2004-04-17 - * Copyright 2004 Giancarlo Niccolai <antispam /at/ niccolai /dot/ ws> - * - * Minimal revision for proper working (expecially with word warping). - * Fixed many funtions - * Added GotoCol() and GotoPos() to goto a logical column or position; - * they translate this movement in a adequate ::SetPos call. - * - * Modifications are based upon the following source file: + * Support for Cl*pper's MemoEdit( ..., nTextBufferRow, nTextBufferCol, nWindowRow, nWindowCol ) + * Rearrangement of code in logical sections. + * Reformatting of code to be more readable. + * Navigation code broken into small methods for easy maintainability on lines with TBrowse() */ /* * Teditor Fix: v2.0 2003-11-17 * Copyright 2003 Lance Owens <servant@gnosis.org> * - * This Revised Version has a completely rewritten edit method key commands, with dynamic line and paragraph reformatting. + * This revised version has a completely rewritten edit method key commands, with dynamic line and paragraph reformatting. * Includes a fix for the bugs in TEditor key processing that previously caused array errors * - * Note: -- If using the paste function to enter text, increase size of keyboard buffer to 2048 or 4096! - * Otherwise buffer will overrun -- it takes some processor time to do all the dynamic reformatting - * -- SetCursor() is used to change cursor between insert and overwrite. Modify if desired.... - * This will need to be cleared to return to original cursor within MemoEdit()!! - * -- K_LEFT is set to exit MemoEdit() in read-only mode, in addition to the standard exit keys ESC. - * -- __SoftCR() "soft CR" inserted by Clipper MemoEdit() is automatically removed when encountered in text - * -- Color persistence problems in previous version corrected by taking SetColor() at Method New file call. - * - * Modifications are based upon the following source file: + * NOTE: - If using the paste function to enter text, increase size of keyboard buffer to 2048 or 4096! + * Otherwise buffer will overrun -- it takes some processor time to do all the dynamic reformatting + * - SetCursor() is used to change cursor between insert and overwrite. Modify if desired.... + * This will need to be cleared to return to original cursor within MemoEdit()!! + * - K_LEFT is set to exit MemoEdit() in read-only mode, in addition to the standard exit keys ESC. + * - __SoftCR() "soft CR" inserted by Cl*pper MemoEdit() is automatically removed when encountered in text + * - Color persistence problems in previous version corrected by taking SetColor() at Method New file call. */ #include "hbclass.ch" diff --git a/contrib/xhb/xhbtrim.c b/contrib/xhb/xhbtrim.c index 2abc57d88b..c48b338966 100644 --- a/contrib/xhb/xhbtrim.c +++ b/contrib/xhb/xhbtrim.c @@ -70,11 +70,11 @@ HB_FUNC( XHB_RTRIM ) hb_retclen( szText, nLen ); } else - /* NOTE: "TRIM" is right here [vszakats] */ + /* NOTE: "TRIM" is correct here [vszakats] */ hb_errRT_BASE_SubstR( EG_ARG, 1100, NULL, "TRIM", HB_ERR_ARGS_BASEPARAMS ); } -/* synonymn for XHB_RTRIM */ +/* synonym for xhb_RTrim() */ HB_FUNC_TRANSLATE( XHB_TRIM, XHB_RTRIM ) /* trims leading and trailing spaces from a string */ diff --git a/contrib/xhb/xhbver.ch b/contrib/xhb/xhbver.ch index 6e34b752d7..c575acf476 100644 --- a/contrib/xhb/xhbver.ch +++ b/contrib/xhb/xhbver.ch @@ -47,40 +47,40 @@ #ifndef HB_VERX_CH_ #define HB_VERX_CH_ -#define _HB_VER_MAJOR 1 /* int */ -#define _HB_VER_MINOR 2 /* int */ -#define _HB_VER_REVISION 3 /* int */ -#define _HB_VER_LEX 4 /* char */ -#define _HB_VER_AS_STRING 5 /* char */ -#define _HB_PCODE_VER 6 /* int */ -#define _HB_VER_COMPILER 7 /* char */ -#define _HB_VER_PLATFORM 8 /* char */ -#define _HB_VER_BUILD_DATE 9 /* char */ -#define _HB_VER_BUILD_TIME 10 /* char */ -#define _HB_VER_LENTRY 11 /* char */ -#define _HB_VER_CHLCVS 12 /* char */ -#define _HB_VER_C_USR 13 /* char */ -#define _HB_VER_L_USR 14 /* char */ -#define _HB_VER_PRG_USR 15 /* char */ -#define _HB_EXTENSION 16 /* bool */ -#define _HB_C52_UNDOC 17 /* bool */ -#define _HB_C52_STRICT 18 /* bool */ -#define _HB_COMPAT_C53 19 /* bool */ -#define _HB_COMPAT_XPP 20 /* bool */ -#define _HB_COMPAT_VO 21 /* bool */ -#define _HB_COMPAT_FLAGSHIP 22 /* bool */ -#define _HB_COMPAT_FOXPRO 23 /* bool */ -#define _HB_COMPAT_DBASE 24 /* bool */ -#define _HB_HARBOUR_OBJ_GENERATION 25 /* bool */ -#define _HB_HARBOUR_STRICT_ANSI_C 26 /* bool */ -#define _HB_CPLUSPLUS 27 /* bool */ -#define _HB_HARBOUR_YYDEBUG 28 /* bool */ -#define _HB_SYMBOL_NAME_LEN 29 /* int */ -#define _HB_MULTITHREAD 30 /* bool */ -#define _HB_VM_OPTIMIZATION 31 /* int */ -#define _HB_LANG_ID 32 /* char */ -#define _HB_ARRAY_MODE 33 /* int */ +#define _HB_VER_MAJOR 1 /* int */ +#define _HB_VER_MINOR 2 /* int */ +#define _HB_VER_REVISION 3 /* int */ +#define _HB_VER_LEX 4 /* char */ +#define _HB_VER_AS_STRING 5 /* char */ +#define _HB_PCODE_VER 6 /* int */ +#define _HB_VER_COMPILER 7 /* char */ +#define _HB_VER_PLATFORM 8 /* char */ +#define _HB_VER_BUILD_DATE 9 /* char */ +#define _HB_VER_BUILD_TIME 10 /* char */ +#define _HB_VER_LENTRY 11 /* char */ +#define _HB_VER_CHLCVS 12 /* char */ +#define _HB_VER_C_USR 13 /* char */ +#define _HB_VER_L_USR 14 /* char */ +#define _HB_VER_PRG_USR 15 /* char */ +#define _HB_EXTENSION 16 /* bool */ +#define _HB_C52_UNDOC 17 /* bool */ +#define _HB_C52_STRICT 18 /* bool */ +#define _HB_COMPAT_C53 19 /* bool */ +#define _HB_COMPAT_XPP 20 /* bool */ +#define _HB_COMPAT_VO 21 /* bool */ +#define _HB_COMPAT_FLAGSHIP 22 /* bool */ +#define _HB_COMPAT_FOXPRO 23 /* bool */ +#define _HB_COMPAT_DBASE 24 /* bool */ +#define _HB_HARBOUR_OBJ_GENERATION 25 /* bool */ +#define _HB_HARBOUR_STRICT_ANSI_C 26 /* bool */ +#define _HB_CPLUSPLUS 27 /* bool */ +#define _HB_HARBOUR_YYDEBUG 28 /* bool */ +#define _HB_SYMBOL_NAME_LEN 29 /* int */ +#define _HB_MULTITHREAD 30 /* bool */ +#define _HB_VM_OPTIMIZATION 31 /* int */ +#define _HB_LANG_ID 32 /* char */ +#define _HB_ARRAY_MODE 33 /* int */ #define _HB_CREDITS 34 /* array */ -#define _HB_VER_LAST 35 /* last */ +#define _HB_VER_LAST 35 /* last */ #endif /* HB_VERX_CH_ */ diff --git a/contrib/xhb/xhbver.prg b/contrib/xhb/xhbver.prg index 7fd51aa01b..248156d192 100644 --- a/contrib/xhb/xhbver.prg +++ b/contrib/xhb/xhbver.prg @@ -1,5 +1,5 @@ /* - * xhb hb_BuildInfo() emulation. + * xHarbour hb_BuildInfo() emulation. * * Copyright 2009 Viktor Szakats (vszakats.net/harbour) * diff --git a/contrib/xhb/xhwinprn.prg b/contrib/xhb/xhwinprn.prg index d5e8ca5ed3..266422d841 100644 --- a/contrib/xhb/xhwinprn.prg +++ b/contrib/xhb/xhwinprn.prg @@ -1,26 +1,26 @@ /* * xHarbour compatible WIN32PRN class which inherits from WIN_PRN class - * hiding some differences between Harbour and xHarbour + * hiding some differences between Harbour and xHarbour * - * original WIN32PRN/WIN_PRN class author: - * Copyright 2004 Peter Rees <peter@rees.co.nz> Rees Software and Systems Ltd * this wrapper: * Copyright 2010 Przemyslaw Czerpak <druzus / at / priv.onet.pl> + * original WIN32PRN/WIN_PRN class author: + * Copyright 2004 Peter Rees <peter@rees.co.nz> Rees Software and Systems Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -38,14 +38,15 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. -*/ + * + */ #ifndef __PLATFORM__WINDOWS diff --git a/contrib/xhb/xstrdel.c b/contrib/xhb/xstrdel.c index 672cda6757..394f86d151 100644 --- a/contrib/xhb/xstrdel.c +++ b/contrib/xhb/xstrdel.c @@ -18,10 +18,10 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, the xHarbour Project gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of @@ -30,10 +30,10 @@ * This exception does not however invalidate any other reasons why * the executable file might be covered by the GNU General Public License. * - * This exception applies only to the code released by the xHarbour - * Project under the name xHarbour. If you copy code from other + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of - * xHarbour, as the General Public License permits, the exception does + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. diff --git a/include/achoice.ch b/include/achoice.ch index af0b16056c..d6532d4762 100644 --- a/include/achoice.ch +++ b/include/achoice.ch @@ -48,17 +48,17 @@ #define _ACHOICE_CH /* User callback calling mode values */ -#define AC_IDLE 0 /* Idle */ -#define AC_HITTOP 1 /* Attempt to move above the first item */ -#define AC_HITBOTTOM 2 /* Attempt to move below the last item */ -#define AC_EXCEPT 3 /* Keystroke exception */ -#define AC_NOITEM 4 /* There's no selectable item */ +#define AC_IDLE 0 /* Idle */ +#define AC_HITTOP 1 /* Attempt to move above the first item */ +#define AC_HITBOTTOM 2 /* Attempt to move below the last item */ +#define AC_EXCEPT 3 /* Keystroke exception */ +#define AC_NOITEM 4 /* There's no selectable item */ /* User callback return values */ -#define AC_ABORT 0 /* Abort AChoice() and return zero */ -#define AC_SELECT 1 /* Select current item and return it's index */ -#define AC_CONT 2 /* Continue AChoice() */ +#define AC_ABORT 0 /* Abort AChoice() and return zero */ +#define AC_SELECT 1 /* Select current item and return it's index */ +#define AC_CONT 2 /* Continue AChoice() */ #define AC_GOTO 3 /* Search first chars for the last pressed key */ -#define AC_REDRAW 4 /* Redraw AChoice() */ +#define AC_REDRAW 4 /* Redraw AChoice() */ #endif /* _ACHOICE_CH */ diff --git a/include/assert.ch b/include/assert.ch index 4c931ce3e8..0d72ce1a64 100644 --- a/include/assert.ch +++ b/include/assert.ch @@ -46,24 +46,24 @@ #ifndef HB_ASSERT_CH_ #define HB_ASSERT_CH_ -#define _ASSERT_DEFINED /* NOTE: For complete CA-Cl*pper compatibility */ +#define _ASSERT_DEFINED /* NOTE: For complete CA-Cl*pper compatibility */ #ifdef NDEBUG /* When NDEBUG is defined, ignore all ASSERT() calls */ -#command ASSERT( <exp> [, <msg>] ) => +#command ASSERT( <exp> [, <msg>] ) => #else -#command ASSERT( <exp> [, <msg>] ) => ; - IF !( <exp> ) ; - ; OutStd( ; - hb_eol() + ProcName( 0 ) + ; - "(" + hb_ntos( ProcLine() ) + ")" + ; - " Assertion failed: " + ; - iif( <.msg.>, <msg>, <"exp"> ) ; - ) ; - ; QUIT ; +#command ASSERT( <exp> [, <msg>] ) => ; + IF !( <exp> ) ; + ; OutStd( ; + hb_eol() + ProcName( 0 ) + ; + "(" + hb_ntos( ProcLine() ) + ")" + ; + " Assertion failed: " + ; + iif( <.msg.>, <msg>, <"exp"> ) ; + ) ; + ; QUIT ; ; END #endif /* NDEBUG */ diff --git a/include/blob.ch b/include/blob.ch index 1e1d879e61..e8ddc8cd4c 100644 --- a/include/blob.ch +++ b/include/blob.ch @@ -48,7 +48,7 @@ #define HB_BLOB_CH_ #ifndef HB_DBINFO_CH_ - #include "dbinfo.ch" + #include "dbinfo.ch" #endif #xtranslate BLOBRootLock() => dbInfo( DBI_BLOB_ROOT_LOCK ) diff --git a/include/clipdefs.h b/include/clipdefs.h index ccc9844296..5bfe5a8874 100644 --- a/include/clipdefs.h +++ b/include/clipdefs.h @@ -116,7 +116,7 @@ typedef HB_VMHANDLE HANDLE; typedef ERRCODE IHELP; typedef ERRCODE ICODE; -/* default func ptr -- USHORT return, USHORT param */ +/* default function pointer -- USHORT return, USHORT param */ typedef USHORT ( * FUNCP )( USHORT param, ...); typedef FUNCP * FUNCPP; diff --git a/include/common.ch b/include/common.ch index 6a90d870bb..dd4b638e22 100644 --- a/include/common.ch +++ b/include/common.ch @@ -48,7 +48,7 @@ #define HB_COMMON_CH_ #if defined( HB_LEGACY_LEVEL4 ) -# include "hbhash.ch" + #include "hbhash.ch" #endif /* Friendly logical aliases */ diff --git a/include/dbedit.ch b/include/dbedit.ch index 994b2e5f40..b7c34fd82b 100644 --- a/include/dbedit.ch +++ b/include/dbedit.ch @@ -48,15 +48,15 @@ #define _DBEDIT_CH /* User function entry modes */ -#define DE_IDLE 0 /* Idle */ -#define DE_HITTOP 1 /* Attempt to cursor past top of file */ -#define DE_HITBOTTOM 2 /* Attempt to cursor past bottom of file */ -#define DE_EMPTY 3 /* No records in work area */ -#define DE_EXCEPT 4 /* Key exception */ +#define DE_IDLE 0 /* Idle */ +#define DE_HITTOP 1 /* Attempt to cursor past top of file */ +#define DE_HITBOTTOM 2 /* Attempt to cursor past bottom of file */ +#define DE_EMPTY 3 /* No records in work area */ +#define DE_EXCEPT 4 /* Key exception */ /* User function return codes */ -#define DE_ABORT 0 /* Abort dbEdit() */ -#define DE_CONT 1 /* Continue dbEdit() */ +#define DE_ABORT 0 /* Abort dbEdit() */ +#define DE_CONT 1 /* Continue dbEdit() */ #define DE_REFRESH 2 /* Force reread/redisplay of all data rows */ #ifdef HB_CLP_UNDOC #define DE_APPEND 3 /* Undocumented CA-Cl*pper append mode in DBEdit */ diff --git a/include/dbinfo.ch b/include/dbinfo.ch index 54174d46e1..4c407c57c5 100644 --- a/include/dbinfo.ch +++ b/include/dbinfo.ch @@ -49,10 +49,7 @@ #ifndef HB_DBINFO_CH_ #define HB_DBINFO_CH_ -/* - Constants for SELF_RDDINFO () -*/ - +/* Constants for SELF_RDDINFO() */ #define RDDI_ISDBF 1 /* Does this RDD support DBFs? */ #define RDDI_CANPUTREC 2 /* Can this RDD Put Records? */ #define RDDI_DELIMITER 3 /* The field delimiter (as a string) */ @@ -69,7 +66,7 @@ #define RDDI_CONNECTION 12 /* Get/Set default connection */ #define RDDI_TABLETYPE 13 /* Type of table file */ #define RDDI_MEMOTYPE 14 /* Type of MEMO file DB_MEMO_*: DBT, SMT, FPT(FP,SIX3,FLEXIII) */ -#define RDDI_LARGEFILE 15 /* Is large file size (>=4GB) supported */ +#define RDDI_LARGEFILE 15 /* Is large file size (>= 4 GiB) supported */ #define RDDI_LOCKSCHEME 16 /* Locking scheme used by RDD */ #define RDDI_RECORDMAP 17 /* Does RDD support record map functionality? */ #define RDDI_ENCRYPTION 18 /* Does RDD support encryption */ @@ -117,63 +114,60 @@ #define RDDI_AFFECTEDROWS 67 /* number of affected rows after UPDATE */ #define RDDI_QUERY 68 /* last executed query */ -/* - Constants for SELF_ORDINFO () -*/ - -#define DBOI_CONDITION 1 /* The order's conditional expression */ -#define DBOI_EXPRESSION 2 /* The order's key expression */ -#define DBOI_POSITION 3 /* The current key position in scope and filter */ +/* Constants for SELF_ORDINFO() */ +#define DBOI_CONDITION 1 /* The order's conditional expression */ +#define DBOI_EXPRESSION 2 /* The order's key expression */ +#define DBOI_POSITION 3 /* The current key position in scope and filter */ #define DBOI_RECNO 4 /* The current key position disregarding filters */ -#define DBOI_NAME 5 /* The name of the order */ +#define DBOI_NAME 5 /* The name of the order */ #define DBOI_NUMBER 6 /* The numeric position in the list of orders */ -#define DBOI_BAGNAME 7 /* The name of the file containing this order */ +#define DBOI_BAGNAME 7 /* The name of the file containing this order */ #define DBOI_BAGEXT 8 /* The extension of the file containing this order */ #define DBOI_INDEXEXT DBOI_BAGEXT #define DBOI_INDEXNAME DBOI_BAGNAME #define DBOI_ORDERCOUNT 9 /* The count of ORDERS contained in an index file or in total */ -#define DBOI_FILEHANDLE 10 /* The OS file handle of the index */ +#define DBOI_FILEHANDLE 10 /* The OS file handle of the index */ #define DBOI_ISCOND 11 /* Does the order have a FOR condition? */ #define DBOI_ISDESC 12 /* Is the order DESCENDing? */ #define DBOI_UNIQUE 13 /* Does the order have the UNIQUE attribute? */ /* 53-level constants */ #define DBOI_FULLPATH 20 /* The full path to the index file (Bag) */ -#define DBOI_KEYTYPE 24 /* The type of the order's key */ -#define DBOI_KEYSIZE 25 /* The length of the order's key */ +#define DBOI_KEYTYPE 24 /* The type of the order's key */ +#define DBOI_KEYSIZE 25 /* The length of the order's key */ #define DBOI_KEYCOUNT 26 /* The count of keys in scope and filter */ -#define DBOI_SETCODEBLOCK 27 /* The codeblock that produces the key */ -#define DBOI_KEYDEC 28 /* The # of decimals in a numeric key */ -#define DBOI_HPLOCKING 29 /* Using High Performance locking for this order? */ -#define DBOI_LOCKOFFSET 35 /* The offset used for logical locking */ +#define DBOI_SETCODEBLOCK 27 /* The codeblock that produces the key */ +#define DBOI_KEYDEC 28 /* The # of decimals in a numeric key */ +#define DBOI_HPLOCKING 29 /* Using High Performance locking for this order? */ +#define DBOI_LOCKOFFSET 35 /* The offset used for logical locking */ -#define DBOI_KEYADD 36 /* Custom Index: Was Key added successfully? */ -#define DBOI_KEYDELETE 37 /* Custom Index: Was Key Deletion successful? */ -#define DBOI_KEYVAL 38 /* The value of the current key */ -#define DBOI_SCOPETOP 39 /* Get or Set the scope top */ -#define DBOI_SCOPEBOTTOM 40 /* Get or Set the scope bottom */ -#define DBOI_SCOPETOPCLEAR 41 /* Clear the scope top */ -#define DBOI_SCOPEBOTTOMCLEAR 42 /* Clear the scope bottom */ -#define DBOI_CUSTOM 45 /* Is this a Custom Index? */ -#define DBOI_SKIPUNIQUE 46 /* Was a skip to adjacent unique Key successful? */ +#define DBOI_KEYADD 36 /* Custom Index: Was Key added successfully? */ +#define DBOI_KEYDELETE 37 /* Custom Index: Was Key Deletion successful? */ +#define DBOI_KEYVAL 38 /* The value of the current key */ +#define DBOI_SCOPETOP 39 /* Get or Set the scope top */ +#define DBOI_SCOPEBOTTOM 40 /* Get or Set the scope bottom */ +#define DBOI_SCOPETOPCLEAR 41 /* Clear the scope top */ +#define DBOI_SCOPEBOTTOMCLEAR 42 /* Clear the scope bottom */ +#define DBOI_CUSTOM 45 /* Is this a Custom Index? */ +#define DBOI_SKIPUNIQUE 46 /* Was a skip to adjacent unique Key successful? */ #define DBOI_KEYSINCLUDED 50 /* Number of keys in the index order */ /* key numbers and counts */ #define DBOI_KEYGOTO DBOI_POSITION #define DBOI_KEYGOTORAW DBOI_KEYNORAW #define DBOI_KEYNO DBOI_POSITION -#define DBOI_KEYNORAW 51 /* The key number disregarding filters */ -#define DBOI_KEYCOUNTRAW 52 /* The key count disregarding filter */ +#define DBOI_KEYNORAW 51 /* The key number disregarding filters */ +#define DBOI_KEYCOUNTRAW 52 /* The key count disregarding filter */ /* Query Optimization */ #define DBOI_OPTLEVEL 53 /* Optimization level for current query */ /* These shouldn't need an open table */ -#define DBOI_STRICTREAD 60 /* Flag for avoiding RDD hierarchy and using a bigger buffer when indexing */ -#define DBOI_OPTIMIZE 61 /* Flag for whether to use query optimization */ -#define DBOI_AUTOOPEN 62 /* Flag for automatically opening structural indexes */ +#define DBOI_STRICTREAD 60 /* Flag for avoiding RDD hierarchy and using a bigger buffer when indexing */ +#define DBOI_OPTIMIZE 61 /* Flag for whether to use query optimization */ +#define DBOI_AUTOOPEN 62 /* Flag for automatically opening structural indexes */ #define DBOI_AUTOORDER 63 /* When a structural index is opened, the order to be set */ -#define DBOI_AUTOSHARE 64 /* When a network is detected, open the index shared, otherwise open exclusively */ +#define DBOI_AUTOSHARE 64 /* When a network is detected, open the index shared, otherwise open exclusively */ /* Harbour extensions */ #define DBOI_SKIPEVAL 100 /* skip while code block doesn't return TRUE */ @@ -194,7 +188,7 @@ #define DBOI_ISMULTITAG 114 /* does RDD support multi tag in index file */ #define DBOI_ISSORTRECNO 115 /* is record number part of key in sorting */ -#define DBOI_LARGEFILE 116 /* is large file size (>=4GB) supported */ +#define DBOI_LARGEFILE 116 /* is large file size (>= 4 GiB) supported */ #define DBOI_TEMPLATE 117 /* order with free user keys */ #define DBOI_MULTIKEY 118 /* custom order with multikeys */ #define DBOI_CHGONLY 119 /* update only existing keys */ @@ -242,43 +236,43 @@ #define DBRI_RECSIZE 3 #define DBRI_RECNO 4 #define DBRI_UPDATED 5 -#define DBRI_ENCRYPTED 6 -#define DBRI_RAWRECORD 7 -#define DBRI_RAWMEMOS 8 -#define DBRI_RAWDATA 9 +#define DBRI_ENCRYPTED 6 /* Harbour extension */ +#define DBRI_RAWRECORD 7 /* Harbour extension */ +#define DBRI_RAWMEMOS 8 /* Harbour extension */ +#define DBRI_RAWDATA 9 /* Harbour extension */ -/* constants for dbInfo() */ +/* constants for dbInfo() */ #define DBI_ISDBF 1 /* Does this RDD support DBFs? */ -#define DBI_CANPUTREC 2 /* Can this RDD Put Records? */ -#define DBI_GETHEADERSIZE 3 /* Data file's header size */ -#define DBI_LASTUPDATE 4 /* The last date this file was written to */ -#define DBI_GETDELIMITER 5 /* The delimiter (as a string) */ -#define DBI_SETDELIMITER 6 /* The delimiter (as a string) */ -#define DBI_GETRECSIZE 7 /* The size of 1 record in the file */ +#define DBI_CANPUTREC 2 /* Can this RDD Put Records? */ +#define DBI_GETHEADERSIZE 3 /* Data file's header size */ +#define DBI_LASTUPDATE 4 /* The last date this file was written to */ +#define DBI_GETDELIMITER 5 /* The delimiter (as a string) */ +#define DBI_SETDELIMITER 6 /* The delimiter (as a string) */ +#define DBI_GETRECSIZE 7 /* The size of 1 record in the file */ #define DBI_GETLOCKARRAY 8 /* An array of locked records' numbers */ -#define DBI_TABLEEXT 9 /* The data file's file extension */ -#define DBI_FULLPATH 10 /* The Full path to the data file */ +#define DBI_TABLEEXT 9 /* The data file's file extension */ +#define DBI_FULLPATH 10 /* The Full path to the data file */ -#define DBI_ISFLOCK 20 /* Is there a file lock active? */ -#define DBI_CHILDCOUNT 22 /* Number of child relations set */ -#define DBI_FILEHANDLE 23 /* The data file's OS file handle */ -#define DBI_BOF 26 /* Same as Bof() */ -#define DBI_EOF 27 /* Same as Eof() */ -#define DBI_DBFILTER 28 /* Current Filter setting */ -#define DBI_FOUND 29 /* Same as Found() */ -#define DBI_FCOUNT 30 /* How many fields in a record? */ -#define DBI_LOCKCOUNT 31 /* Number of record locks */ -#define DBI_VALIDBUFFER 32 /* Is the record buffer valid? */ -#define DBI_ALIAS 33 /* Name (alias) for this workarea */ -#define DBI_GETSCOPE 34 /* The codeblock used in LOCATE */ +#define DBI_ISFLOCK 20 /* Is there a file lock active? */ +#define DBI_CHILDCOUNT 22 /* Number of child relations set */ +#define DBI_FILEHANDLE 23 /* The data file's OS file handle */ +#define DBI_BOF 26 /* Same as Bof() */ +#define DBI_EOF 27 /* Same as Eof() */ +#define DBI_DBFILTER 28 /* Current Filter setting */ +#define DBI_FOUND 29 /* Same as Found() */ +#define DBI_FCOUNT 30 /* How many fields in a record? */ +#define DBI_LOCKCOUNT 31 /* Number of record locks */ +#define DBI_VALIDBUFFER 32 /* Is the record buffer valid? */ +#define DBI_ALIAS 33 /* Name (alias) for this workarea */ +#define DBI_GETSCOPE 34 /* The codeblock used in LOCATE */ #define DBI_LOCKOFFSET 35 /* The offset used for logical locking */ -#define DBI_SHARED 36 /* Was the file opened shared? */ -#define DBI_MEMOEXT 37 /* The memo file's file extension */ -#define DBI_MEMOHANDLE 38 /* File handle of the memo file */ -#define DBI_MEMOBLOCKSIZE 39 /* Memo File's block size */ +#define DBI_SHARED 36 /* Was the file opened shared? */ +#define DBI_MEMOEXT 37 /* The memo file's file extension */ +#define DBI_MEMOHANDLE 38 /* File handle of the memo file */ +#define DBI_MEMOBLOCKSIZE 39 /* Memo File's block size */ -#define DBI_DB_VERSION 101 /* Version of the Host driver */ -#define DBI_RDD_VERSION 102 /* current RDD's version */ +#define DBI_DB_VERSION 101 /* Version of the Host driver */ +#define DBI_RDD_VERSION 102 /* current RDD's version */ /* Harbour extension */ #define DBI_LOCKSCHEME 128 /* Locking scheme used by RDD */ @@ -363,7 +357,7 @@ #define DB_DBF_STD 1 #define DB_DBF_VFP 2 -/* MEMO TYPES: RDDI_MEMOTYPE, DBI_MEMOTYPE, */ +/* MEMO TYPES: RDDI_MEMOTYPE, DBI_MEMOTYPE */ #define DB_MEMO_NONE 0 #define DB_MEMO_DBT 1 #define DB_MEMO_FPT 2 @@ -384,8 +378,8 @@ #define DB_DBFLOCK_CLIPPER 1 /* default Cl*pper locking scheme */ #define DB_DBFLOCK_COMIX 2 /* COMIX and CL53 DBFCDX hyper locking scheme */ #define DB_DBFLOCK_VFP 3 /* [V]FP, CL52 DBFCDX, SIx3 SIXCDX, CDXLOCK.OBJ */ -#define DB_DBFLOCK_HB32 4 /* Harbour hyper locking scheme for 32bit file API */ -#define DB_DBFLOCK_HB64 5 /* Harbour hyper locking scheme for 64bit file API */ +#define DB_DBFLOCK_HB32 4 /* Harbour hyper locking scheme for 32-bit file API */ +#define DB_DBFLOCK_HB64 5 /* Harbour hyper locking scheme for 64-bit file API */ #define DB_DBFLOCK_CLIPPER2 6 /* extended Cl*pper locking scheme NTXLOCK2.OBJ */ /* for backward compatibility */ diff --git a/include/error.ch b/include/error.ch index d89793fc28..93abf62c41 100644 --- a/include/error.ch +++ b/include/error.ch @@ -1,5 +1,5 @@ /* - * Header file for error hanlding + * Header file for error handling * * Copyright 1999 {list of individual authors and e-mail addresses} * @@ -95,12 +95,12 @@ #define EG_APPENDLOCK 40 #define EG_LOCK 41 -#define EG_DESTRUCTOR 45 /* Harbour special */ -#define EG_ARRACCESS 46 /* Harbour special */ -#define EG_ARRASSIGN 47 /* Harbour special */ -#define EG_ARRDIMENSION 48 /* Harbour special */ -#define EG_NOTARRAY 49 /* Harbour special */ -#define EG_CONDITION 50 /* Harbour special */ +#define EG_DESTRUCTOR 45 /* Harbour extension */ +#define EG_ARRACCESS 46 /* Harbour extension */ +#define EG_ARRASSIGN 47 /* Harbour extension */ +#define EG_ARRDIMENSION 48 /* Harbour extension */ +#define EG_NOTARRAY 49 /* Harbour extension */ +#define EG_CONDITION 50 /* Harbour extension */ /* Internal errors */ #define HB_EI_ERRUNRECOV 9000 /* "Unrecoverable error %lu: " */ diff --git a/include/fileio.ch b/include/fileio.ch index c8cd862ed7..d5cd6c8135 100644 --- a/include/fileio.ch +++ b/include/fileio.ch @@ -50,10 +50,10 @@ #define _FILEIO_CH /* File create flags */ -#define FC_NORMAL 0 /* No file attributes are set */ +#define FC_NORMAL 0 /* No file attributes are set */ #define FC_READONLY 1 /* Read-only file attribute is set */ -#define FC_HIDDEN 2 /* Hidden file attribute is set */ -#define FC_SYSTEM 4 /* System file attribute is set */ +#define FC_HIDDEN 2 /* Hidden file attribute is set */ +#define FC_SYSTEM 4 /* System file attribute is set */ /* File attributes flags */ #define HB_FA_ALL 0x00000000 @@ -93,31 +93,38 @@ #define HB_FA_XOTH 0x00010000 /* 0001 execute/search by others */ /* File access flags */ -#define FO_READ 0 /* File is opened for reading */ -#define FO_WRITE 1 /* File is opened for writing */ +#define FO_READ 0 /* File is opened for reading */ +#define FO_WRITE 1 /* File is opened for writing */ #define FO_READWRITE 2 /* File is opened for reading and writing */ /* File open flags */ -#define FO_CREAT 0x0100 /* create and open file */ -#define FO_TRUNC 0x0200 /* open with truncation */ -#define FO_EXCL 0x0400 /* create and open only if file doesn't exist */ -#define FO_DEFAULTS 0x1000 /* Use SET command defaults */ +#define HB_FO_CREAT 0x0100 /* create and open file */ +#define HB_FO_TRUNC 0x0200 /* open with truncation */ +#define HB_FO_EXCL 0x0400 /* create and open only if file doesn't exist */ +#define HB_FO_DEFAULTS 0x1000 /* Use SET command defaults */ + +/* Constants breaking Cl*pper namespace. + Leaving it here for compatibility */ +#define FO_CREAT HB_FO_CREAT /* Harbour extension */ +#define FO_TRUNC HB_FO_TRUNC /* Harbour extension */ +#define FO_EXCL HB_FO_EXCL /* Harbour extension */ +#define FO_DEFAULTS HB_FO_DEFAULTS /* Use SET command defaults */ /* File sharing flags */ -#define FO_COMPAT 0 /* No sharing specified */ -#define FO_EXCLUSIVE 16 /* Deny further attempts to open the file */ +#define FO_COMPAT 0 /* No sharing specified */ +#define FO_EXCLUSIVE 16 /* Deny further attempts to open the file */ #define FO_DENYWRITE 32 /* Deny further attempts to open the file for writing */ #define FO_DENYREAD 48 /* Deny further attempts to open the file for reading */ -#define FO_DENYNONE 64 /* Do not deny any further attempts to open the file */ +#define FO_DENYNONE 64 /* Do not deny any further attempts to open the file */ #define FO_SHARED FO_DENYNONE /* File seek mode flags */ -#define FS_SET 0 /* Seek from beginning of file */ +#define FS_SET 0 /* Seek from beginning of file */ #define FS_RELATIVE 1 /* Seek from current file pointer */ -#define FS_END 2 /* Seek from end of file */ +#define FS_END 2 /* Seek from end of file */ /* File mode flags */ -#define FD_BINARY 1 /* Binary mode (raw) */ +#define FD_BINARY 1 /* Binary mode (raw) */ #define FD_RAW FD_BINARY #define FD_TEXT 2 /* Text mode (cooked) */ #define FD_COOKED FD_TEXT diff --git a/include/hb.ch b/include/hb.ch index 4e98babb4f..1a23fae91f 100644 --- a/include/hb.ch +++ b/include/hb.ch @@ -1,7 +1,7 @@ /* * Main Harbour header * - * Copyright 2010 Viktor Szakats (vszakats.net/harbour) + * Copyright 2010-2017 Viktor Szakats (vszakats.net/harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,6 +54,7 @@ #include "hbgtinfo.ch" #include "hbhash.ch" #include "hbserial.ch" +#include "hbver.ch" #include "inkey.ch" #include "setcurs.ch" diff --git a/include/hb_io.h b/include/hb_io.h index e9e0f15b9a..351bcdd9c5 100644 --- a/include/hb_io.h +++ b/include/hb_io.h @@ -1,5 +1,5 @@ /* - * A platform indpendent include file to include unistd.h and/or io.h + * Platform independent include file to include unistd.h and/or io.h * * Copyright 2001 {list of individual authors and e-mail addresses} * diff --git a/include/hbapi.h b/include/hbapi.h index 70c5be2577..3715d7e0b6 100644 --- a/include/hbapi.h +++ b/include/hbapi.h @@ -44,7 +44,7 @@ * */ -/* TOFIX: There are several things in this file which are not part of the +/* FIXME: There are several things in this file which are not part of the standard Harbour API, in other words these things are not guaranteed to remain unchanged. To avoid confusion these should be moved to somewhere else (like hbrtl.h). [vszakats] */ @@ -114,7 +114,7 @@ HB_EXTERN_BEGIN * These macros are slower but can be usable in debugging some code. * They are a little bit more safe in buggy code but they can * also hide bugs which should be exploited as soon as possible to - * know that sth is wrong and has to be fixed. + * know that something is wrong and has to be fixed. * the version below which check only chosen bits allow compiler to * use some optimizations if used CPU supports it. F.e. on standard * x86 machines they can save few CPU cycles. [druzus] @@ -144,8 +144,8 @@ HB_EXTERN_BEGIN #define HB_IS_COMPLEX( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_COMPLEX ) != 0 ) #define HB_IS_GCITEM( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_GCITEM ) != 0 ) #define HB_IS_EVALITEM( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_EVALITEM ) != 0 ) -#define HB_IS_BADITEM( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_COMPLEX ) != 0 && ( HB_ITEM_TYPE( p ) & ~( HB_IT_COMPLEX | HB_IT_MEMOFLAG ) ) != 0 ) #define HB_IS_HASHKEY( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_HASHKEY ) != 0 ) +#define HB_IS_BADITEM( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_COMPLEX ) != 0 && ( HB_ITEM_TYPE( p ) & ~( HB_IT_COMPLEX | HB_IT_MEMOFLAG ) ) != 0 ) #define HB_IS_OBJECT( p ) ( HB_IS_ARRAY( p ) && HB_ARRAY_OBJ( p ) ) #define HB_IS_NUMBER( p ) HB_IS_NUMERIC( p ) @@ -346,7 +346,7 @@ struct hb_struRefer union { struct _HB_BASEARRAY * array; /* array (statics and array item references) */ struct _HB_CODEBLOCK * block; /* codeblock */ - struct _HB_ITEM * itemPtr; /* item pointer */ + struct _HB_ITEM * itemPtr; /* item pointer */ struct _HB_ITEM ** *itemsbasePtr; /* local variables */ } BasePtr; HB_ISIZ offset; /* 0 for static variables */ @@ -542,18 +542,19 @@ extern void * hb_xRefResize( void * pMem, HB_SIZE nSave, HB_SIZE nSize, HB_S #define hb_xgrabz( n ) memset( hb_xgrab( ( n ) ), 0, ( n ) ) #define hb_xmemdup( p, n ) memcpy( hb_xgrab( ( n ) ), ( p ), ( n ) ) +#define hb_xreallocz( p, n ) memset( hb_xrealloc( ( p ), ( n ) ), 0, ( n ) ) /* #if UINT_MAX == ULONG_MAX */ -/* it fails on 64bit platforms where int has 32 bit and long has 64 bit. +/* it fails on 64-bit platforms where int has 32 bits and long has 64 bits. we need these functions only when max(size_t) < max(long) - and only on 16bit platforms, so the below condition seems to be + and only on 16-bit platforms, so the below condition seems to be more reasonable. */ #if UINT_MAX > USHRT_MAX - /* NOTE: memcpy/memset can work with HB_SIZE data blocks */ + /* NOTE: memcpy()/memset() can work with HB_SIZE data blocks */ #define hb_xmemcpy memcpy #define hb_xmemset memset #else - /* NOTE: otherwise, the hb_xmemcpy and hb_xmemset functions + /* NOTE: otherwise, the hb_xmemcpy() and hb_xmemset() functions will be used to copy and/or set HB_SIZE data blocks */ extern HB_EXPORT void * hb_xmemcpy( void * pDestArg, const void * pSourceArg, HB_SIZE nLen ); /* copy more than memcpy() can */ extern HB_EXPORT void * hb_xmemset( void * pDestArg, int iFill, HB_SIZE nLen ); /* set more than memset() can */ @@ -681,18 +682,18 @@ extern HB_EXPORT void * hb_parvptrGC( const HB_GC_FUNCS * pFuncs, int iPar extern HB_EXPORT HB_LONGLONG hb_parvnll( int iParam, ... ); /* retrieve a numeric parameter as a long long */ #endif -extern HB_EXPORT int hb_pcount( void ); /* returns the number of suplied parameters */ +extern HB_EXPORT int hb_pcount( void ); /* returns the number of supplied parameters */ extern HB_EXPORT void hb_ret( void ); /* post a NIL return value */ extern HB_EXPORT void hb_retc( const char * szText ); /* returns a string */ extern HB_EXPORT void hb_retc_null( void ); /* returns an empty string */ -extern HB_EXPORT void hb_retc_buffer( char * szText ); /* sames as above, but accepts an allocated buffer */ +extern HB_EXPORT void hb_retc_buffer( char * szText ); /* same as above, but accepts an allocated buffer */ extern HB_EXPORT void hb_retc_const( const char * szText ); /* returns a string as a pcode based string */ extern HB_EXPORT void hb_retclen( const char * szText, HB_SIZE nLen ); /* returns a string with a specific length */ -extern HB_EXPORT void hb_retclen_buffer( char * szText, HB_SIZE nLen ); /* sames as above, but accepts an allocated buffer */ +extern HB_EXPORT void hb_retclen_buffer( char * szText, HB_SIZE nLen ); /* same as above, but accepts an allocated buffer */ extern HB_EXPORT void hb_retclen_const( const char * szText, HB_SIZE nLen ); /* returns a string with a specific length formed from a constant buffer */ extern HB_EXPORT void hb_retds( const char * szDate ); /* returns a date, must use YYYYMMDD format */ extern HB_EXPORT void hb_retd( int iYear, int iMonth, int iDay ); /* returns a date */ -extern HB_EXPORT void hb_retdl( long lJulian ); /* returns a long value as a julian date */ +extern HB_EXPORT void hb_retdl( long lJulian ); /* returns a long value as a Julian date */ extern HB_EXPORT void hb_rettd( double dTimeStamp ); /* returns a double value as a timestamp */ extern HB_EXPORT void hb_rettdt( long lJulian, long lMilliSec ); /* returns two long values as a timestamp */ extern HB_EXPORT void hb_retl( int iTrueFalse ); /* returns a logical integer */ @@ -794,7 +795,7 @@ extern HB_EXPORT int hb_storvnll( HB_LONGLONG llValue, int iParam, ... ); /* /* array management */ extern HB_EXPORT HB_BOOL hb_arrayNew( PHB_ITEM pItem, HB_SIZE nLen ); /* creates a new array */ -extern HB_EXPORT HB_SIZE hb_arrayLen( PHB_ITEM pArray ); /* retrieves the array len */ +extern HB_EXPORT HB_SIZE hb_arrayLen( PHB_ITEM pArray ); /* retrieves the array length */ extern HB_EXPORT HB_BOOL hb_arrayIsObject( PHB_ITEM pArray ); /* retrieves if the array is an object */ extern HB_EXPORT void * hb_arrayId( PHB_ITEM pArray ); /* retrieves the array unique ID */ extern HB_EXPORT PHB_ITEM hb_arrayFromId( PHB_ITEM pItem, void * pArrayId ); @@ -958,9 +959,9 @@ extern HB_EXPORT int hb_printf_params( const char * format ); extern HB_EXPORT HB_BOOL hb_strMatchFile( const char * pszString, const char * szPattern ); /* compare two strings using platform dependent rules for file matching */ extern HB_EXPORT HB_BOOL hb_strMatchRegExp( const char * szString, const char * szPattern ); /* compare two strings using a regular expression pattern */ -extern HB_EXPORT HB_BOOL hb_strMatchWild( const char * szString, const char * szPattern ); /* compare two strings using pattern with wildcard (?*) - patern have to be prefix of given string */ -extern HB_EXPORT HB_BOOL hb_strMatchWildExact( const char * szString, const char * szPattern ); /* compare two strings using pattern with wildcard (?*) - patern have to cover whole string */ -extern HB_EXPORT HB_BOOL hb_strMatchCaseWildExact( const char * szString, const char * szPattern ); /* compare two strings using pattern with wildcard (?*) ignoring the case of the characters - patern have to cover whole string */ +extern HB_EXPORT HB_BOOL hb_strMatchWild( const char * szString, const char * szPattern ); /* compare two strings using pattern with wildcard (?*) - pattern have to be prefix of given string */ +extern HB_EXPORT HB_BOOL hb_strMatchWildExact( const char * szString, const char * szPattern ); /* compare two strings using pattern with wildcard (?*) - pattern have to cover whole string */ +extern HB_EXPORT HB_BOOL hb_strMatchCaseWildExact( const char * szString, const char * szPattern ); /* compare two strings using pattern with wildcard (?*) ignoring the case of the characters - pattern have to cover whole string */ extern HB_EXPORT HB_BOOL hb_strEmpty( const char * szText, HB_SIZE nLen ); /* returns whether a string contains only white space */ extern HB_EXPORT void hb_strDescend( char * szStringTo, const char * szStringFrom, HB_SIZE nLen ); /* copy a string to a buffer, inverting each character */ extern HB_EXPORT HB_SIZE hb_strAt( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen ); /* returns an index to a sub-string within another string */ @@ -981,8 +982,8 @@ extern HB_EXPORT HB_BOOL hb_strIsDigit( const char * szChar ); extern HB_EXPORT HB_BOOL hb_strIsAlpha( const char * szChar ); extern HB_EXPORT HB_BOOL hb_strIsLower( const char * szChar ); extern HB_EXPORT HB_BOOL hb_strIsUpper( const char * szChar ); -extern HB_EXPORT char * hb_strncpy( char * pDest, const char * pSource, HB_SIZE nLen ); /* copy at most nLen bytes from string buffer to another buffer and _always_ set 0 in destin buffer */ -extern HB_EXPORT char * hb_strncat( char * pDest, const char * pSource, HB_SIZE nLen ); /* copy at most nLen-strlen(pDest) bytes from string buffer to another buffer and _always_ set 0 in destin buffer */ +extern HB_EXPORT char * hb_strncpy( char * pDest, const char * pSource, HB_SIZE nLen ); /* copy at most nLen bytes from string buffer to another buffer and _always_ set 0 in destination buffer */ +extern HB_EXPORT char * hb_strncat( char * pDest, const char * pSource, HB_SIZE nLen ); /* copy at most nLen-strlen(pDest) bytes from string buffer to another buffer and _always_ set 0 in destination buffer */ extern HB_EXPORT char * hb_strncpyTrim( char * pDest, const char * pSource, HB_SIZE nLen ); extern HB_EXPORT char * hb_strncpyLower( char * pDest, const char * pSource, HB_SIZE nLen ); /* copy an existing string buffer to another buffer, as lower case */ extern HB_EXPORT char * hb_strncpyUpper( char * pDest, const char * pSource, HB_SIZE nLen ); /* copy an existing string buffer to another buffer, as upper case */ @@ -1048,11 +1049,11 @@ extern HB_LONG hb_dynsymCount( void ); /* number of dynamic symbols /* Symbol management */ extern HB_EXPORT PHB_SYMB hb_symbolNew( const char * szName ); /* create a new symbol */ -/* Command line and environment argument management */ -extern HB_EXPORT void hb_cmdargInit( int argc, char * argv[] ); /* initialize command line argument API's */ -extern HB_EXPORT int hb_cmdargARGC( void ); /* retrieve command line argument count */ -extern HB_EXPORT char ** hb_cmdargARGV( void ); /* retrieve command line argument buffer pointer */ -extern HB_EXPORT const char * hb_cmdargARGVN( int argc ); /* retrieve given command line argument */ +/* Command-line and environment argument management */ +extern HB_EXPORT void hb_cmdargInit( int argc, char * argv[] ); /* initialize command-line argument API's */ +extern HB_EXPORT int hb_cmdargARGC( void ); /* retrieve command-line argument count */ +extern HB_EXPORT char ** hb_cmdargARGV( void ); /* retrieve command-line argument buffer pointer */ +extern HB_EXPORT const char * hb_cmdargARGVN( int argc ); /* retrieve given command-line argument */ extern HB_EXPORT HB_BOOL hb_cmdargIsInternal( const char * szArg, int * piLen ); /* determine if a string is an internal setting */ extern HB_EXPORT char * hb_cmdargProgName( void ); /* return application name with path or NULL if not set, caller must free returned value with hb_xfree() if not NULL */ extern HB_EXPORT char * hb_cmdargBaseProgName( void ); /* return application name without path or NULL if not set, caller must free returned value with hb_xfree() if not NULL */ @@ -1061,7 +1062,7 @@ extern void hb_cmdargUpdate( void ); /* update arguments afte extern HB_BOOL hb_cmdargCheck( const char * pszName ); /* Check if a given internal switch (like //INFO) was set */ extern char * hb_cmdargString( const char * pszName ); /* Returns the string value of an internal switch (like //GT:cgi) */ extern int hb_cmdargNum( const char * pszName ); /* Returns the numeric value of an internal switch (like //F:90) */ -extern void hb_cmdargProcess( void ); /* Check for command line internal arguments */ +extern void hb_cmdargProcess( void ); /* Check for command-line internal arguments */ #if defined( HB_OS_WIN ) extern HB_EXPORT void hb_winmainArgInit( void * hInstance, void * hPrevInstance, int iCmdShow ); /* Set WinMain() parameters */ extern HB_EXPORT HB_BOOL hb_winmainArgGet( void * phInstance, void * phPrevInstance, int * piCmdShow ); /* Retrieve WinMain() parameters */ @@ -1084,7 +1085,7 @@ extern void hb_memvarGetValue( PHB_ITEM pItem, PHB_SYMB pMemvarS extern void hb_memvarGetRefer( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ); /* copy a reference to a symbol value into an item, with error trapping */ extern HB_SIZE hb_memvarGetPrivatesBase( void ); /* retrieve current PRIVATE variables stack base */ extern void hb_memvarSetPrivatesBase( HB_SIZE nBase ); /* release PRIVATE variables created after specified base */ -extern void hb_memvarUpdatePrivatesBase( void ); /* Update PRIVATE base ofsset so they will not be removed when function return */ +extern void hb_memvarUpdatePrivatesBase( void ); /* Update PRIVATE base offset so they will not be removed when function return */ extern void hb_memvarNewParameter( PHB_SYMB pSymbol, PHB_ITEM pValue ); extern char * hb_memvarGetStrValuePtr( char * szVarName, HB_SIZE * pnLen ); extern void hb_memvarCreateFromItem( PHB_ITEM pMemvar, int iScope, PHB_ITEM pValue ); @@ -1136,7 +1137,7 @@ extern void hb_macroPushSymbol( PHB_ITEM pItem ); /* handle a extern void hb_macroRun( PHB_MACRO pMacro ); /* executes pcode compiled by macro compiler */ extern PHB_MACRO hb_macroCompile( const char * szString ); /* compile a string and return a pcode buffer */ extern void hb_macroDelete( PHB_MACRO pMacro ); /* release all memory allocated for macro evaluation */ -extern char * hb_macroTextSymbol( const char * szString, HB_SIZE nLength, HB_BOOL * pfNewString ); /* substitute macro variables occurences within a given string and check if result is a valid function or variable name */ +extern char * hb_macroTextSymbol( const char * szString, HB_SIZE nLength, HB_BOOL * pfNewString ); /* substitute macro variables occurrences within a given string and check if result is a valid function or variable name */ extern char * hb_macroExpandString( const char * szString, HB_SIZE nLength, HB_BOOL * pfNewString ); /* expands valid '&' operator */ extern void hb_macroPopAliasedValue( PHB_ITEM pAlias, PHB_ITEM pVar, int flags ); /* compiles and evaluates an aliased macro expression */ extern void hb_macroPushAliasedValue( PHB_ITEM pAlias, PHB_ITEM pVar, int flags ); /* compiles and evaluates an aliased macro expression */ @@ -1181,7 +1182,7 @@ extern HB_EXPORT const char * hb_verCPU( void ); /* retrieves a cons extern HB_EXPORT const char * hb_verPlatformMacro( void ); /* retrieves a constant string with OS platform (as it appears in __PLATFORM__* macro) */ extern HB_EXPORT char * hb_verPlatform( void ); /* retrieves a newly allocated buffer containing platform version */ extern HB_EXPORT char * hb_verCompiler( void ); /* retrieves a newly allocated buffer containing compiler version */ -extern HB_EXPORT char * hb_verHarbour( void ); /* retrieves a newly allocated buffer containing harbour version */ +extern HB_EXPORT char * hb_verHarbour( void ); /* retrieves a newly allocated buffer containing Harbour version */ extern HB_EXPORT char * hb_verPCode( void ); /* retrieves a newly allocated buffer containing PCode version */ extern HB_EXPORT char * hb_verBuildDate( void ); /* retrieves a newly allocated buffer containing build date and time */ extern HB_EXPORT void hb_verBuildInfo( void ); /* display harbour, compiler, and platform versions to standard console */ @@ -1213,7 +1214,7 @@ extern HB_EXPORT HB_BOOL hb_iswinver( int iMajorVersion, int iMinorVersion, int extern HB_EXPORT HB_BOOL hb_printerIsReady( const char * pszPrinterName ); /* OS/Harbour codepage conversion */ -extern HB_EXPORT HB_BOOL hb_osUseCP( void ); /* Is OS<->Harbour codepage conversion enabled? */ +extern HB_EXPORT HB_BOOL hb_osUseCP( void ); /* Is OS<->Harbour codepage conversion enabled? */ extern HB_EXPORT const char * hb_osEncodeCP( const char * szName, char ** pszFree, HB_SIZE * pnSize ); /* Convert a string sent to a system call, from Harbour codepage. */ extern HB_EXPORT const char * hb_osDecodeCP( const char * szName, char ** pszFree, HB_SIZE * pnSize ); /* Convert a string received from a system call, to Harbour codepage. */ diff --git a/include/hbapicom.h b/include/hbapicom.h index 1a04669f71..c95e66a8fd 100644 --- a/include/hbapicom.h +++ b/include/hbapicom.h @@ -1,5 +1,5 @@ /* - * serial communication functions and constant values + * Serial communication functions and constant values * * Copyright 2010 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbapidbg.h b/include/hbapidbg.h index fdbdd88bb4..56dd4b9c8b 100644 --- a/include/hbapidbg.h +++ b/include/hbapidbg.h @@ -1,5 +1,5 @@ /* - * debugger C API + * Debugger C API * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbapifs.h b/include/hbapifs.h index eec4b8e611..6aacc119da 100644 --- a/include/hbapifs.h +++ b/include/hbapifs.h @@ -60,28 +60,28 @@ HB_EXTERN_BEGIN #define FL_MASK 0x00FF /* Mask for lock type */ /* Extended file locking flags */ -#define FLX_EXCLUSIVE 0x0000 /* Exclusive lock */ -#define FLX_SHARED 0x0100 /* Shared lock */ -#define FLX_WAIT 0x0200 /* Wait for lock until success */ +#define FLX_EXCLUSIVE HB_FLX_EXCLUSIVE /* Exclusive lock */ +#define FLX_SHARED HB_FLX_SHARED /* Shared lock */ +#define FLX_WAIT HB_FLX_WAIT /* Wait for lock until success */ /* File inheritance flags */ -#define FO_INHERITED 0x0000 /* Spawned processes can inherit this file handle */ +#define FO_INHERITED 0x0000 /* Spawned processes can inherit this file handle */ #define FO_PRIVATE 0x0080 /* Spawned processes can not inherit this file handle */ /* Extended file open mode flags */ #define FXO_TRUNCATE 0x0100 /* Create (truncate if exists) */ -#define FXO_APPEND 0x0200 /* Create (append if exists) */ +#define FXO_APPEND 0x0200 /* Create (append if exists) */ #define FXO_UNIQUE 0x0400 /* Create unique file FO_EXCL ??? */ -#define FXO_FORCEEXT 0x0800 /* Force default extension */ -#define FXO_DEFAULTS 0x1000 /* Use SET command defaults */ -#define FXO_DEVICERAW 0x2000 /* Open devices in raw mode */ +#define FXO_FORCEEXT 0x0800 /* Force default extension */ +#define FXO_DEFAULTS 0x1000 /* Use SET command defaults */ +#define FXO_DEVICERAW 0x2000 /* Open devices in raw mode */ /* Harbour extension */ #define FXO_NOSEEKPOS FXO_DEVICERAW /* seek pos not needed in regular file */ -#define FXO_SHARELOCK 0x4000 /* emulate MS-DOS SH_DENY* mode in POSIX OS */ -#define FXO_COPYNAME 0x8000 /* copy final szPath into pszFileName */ +#define FXO_SHARELOCK 0x4000 /* emulate MS-DOS SH_DENY* mode in POSIX OS */ +#define FXO_COPYNAME 0x8000 /* copy final szPath into pszFileName */ /* these definitions should be cleared, - * now they only help to clean lower level code + * now they only help to clean lower-level code */ #define HB_FA_FIFO HB_FA_TEMPORARY /* S_ISFIFO() */ #define HB_FA_FILE HB_FA_ARCHIVE /* S_ISREG() */ @@ -135,31 +135,31 @@ extern HB_EXPORT int hb_fsCurDrv ( void ); /* retrieve current drive extern HB_EXPORT HB_BOOL hb_fsDelete ( const char * pszFileName ); /* delete a file */ extern HB_EXPORT HB_BOOL hb_fsEof ( HB_FHANDLE hFileHandle ); /* determine if an open file is position at end-of-file */ extern HB_EXPORT HB_ERRCODE hb_fsError ( void ); /* retrieve file system error */ -extern HB_EXPORT HB_ERRCODE hb_fsOsError ( void ); /* retrieve system dependant file system error */ +extern HB_EXPORT HB_ERRCODE hb_fsOsError ( void ); /* retrieve system dependent file system error */ extern HB_EXPORT HB_BOOL hb_fsFile ( const char * pszFileName ); /* determine if a file exists */ extern HB_EXPORT HB_BOOL hb_fsIsDirectory ( const char * pszFileName ); extern HB_EXPORT HB_FOFFSET hb_fsFSize ( const char * pszFileName, HB_BOOL bUseDirEntry ); /* determine the size of a file */ extern HB_EXPORT HB_FHANDLE hb_fsExtOpen ( const char * pszFileName, const char * pDefExt, HB_FATTR nFlags, const char * pPaths, PHB_ITEM pError ); /* open a file using default extension and a list of paths */ extern HB_EXPORT char * hb_fsExtName ( const char * pszFileName, const char * pDefExt, - HB_FATTR nExFlags, const char * pPaths ); /* convert file name for hb_fsExtOpen, caller must free the returned buffer */ + HB_FATTR nExFlags, const char * pPaths ); /* convert file name for hb_fsExtOpen(), caller must free the returned buffer */ extern HB_EXPORT HB_ERRCODE hb_fsIsDrv ( int iDrive ); /* determine if a drive number is a valid drive */ extern HB_EXPORT HB_BOOL hb_fsIsDevice ( HB_FHANDLE hFileHandle ); /* determine if a file is attached to a device (console?) */ extern HB_EXPORT HB_BOOL hb_fsLock ( HB_FHANDLE hFileHandle, HB_ULONG ulStart, HB_ULONG ulLength, HB_USHORT uiMode ); /* request a lock on a portion of a file */ extern HB_EXPORT HB_BOOL hb_fsLockLarge ( HB_FHANDLE hFileHandle, HB_FOFFSET nStart, - HB_FOFFSET nLength, HB_USHORT uiMode ); /* request a lock on a portion of a file using 64bit API */ + HB_FOFFSET nLength, HB_USHORT uiMode ); /* request a lock on a portion of a file using 64-bit API */ extern HB_EXPORT int hb_fsLockTest ( HB_FHANDLE hFileHandle, HB_FOFFSET nStart, HB_FOFFSET nLength, HB_USHORT uiMode ); extern HB_EXPORT HB_BOOL hb_fsMkDir ( const char * pszDirName ); /* create a directory */ extern HB_EXPORT HB_FHANDLE hb_fsOpen ( const char * pszFileName, HB_USHORT uiFlags ); /* open a file */ extern HB_EXPORT HB_FHANDLE hb_fsOpenEx ( const char * pszFileName, HB_USHORT uiFlags, HB_FATTR nAttr ); /* open or create a file with given attributes */ -extern HB_EXPORT HB_USHORT hb_fsRead ( HB_FHANDLE hFileHandle, void * pBuff, HB_USHORT uiCount ); /* read contents of a file into a buffer (<=64K) */ -extern HB_EXPORT HB_SIZE hb_fsReadLarge ( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount ); /* read contents of a file into a buffer (>64K) */ -extern HB_EXPORT HB_SIZE hb_fsReadAt ( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount, HB_FOFFSET nOffset ); /* read from given offset contents of a file into a buffer (>64K) */ +extern HB_EXPORT HB_USHORT hb_fsRead ( HB_FHANDLE hFileHandle, void * pBuff, HB_USHORT uiCount ); /* read contents of a file into a buffer (<=64 KiB) */ +extern HB_EXPORT HB_SIZE hb_fsReadLarge ( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount ); /* read contents of a file into a buffer (>64 KiB) */ +extern HB_EXPORT HB_SIZE hb_fsReadAt ( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount, HB_FOFFSET nOffset ); /* read from given offset contents of a file into a buffer (> 64 KiB) */ extern HB_EXPORT HB_BOOL hb_fsRmDir ( const char * pszDirName ); /* remove a directory */ extern HB_EXPORT HB_BOOL hb_fsRename ( const char * pszOldName, const char * pszNewName ); /* rename a file */ extern HB_EXPORT HB_ULONG hb_fsSeek ( HB_FHANDLE hFileHandle, HB_LONG lOffset, HB_USHORT uiMode ); /* reposition an open file */ -extern HB_EXPORT HB_FOFFSET hb_fsSeekLarge ( HB_FHANDLE hFileHandle, HB_FOFFSET nOffset, HB_USHORT uiFlags ); /* reposition an open file using 64bit API */ +extern HB_EXPORT HB_FOFFSET hb_fsSeekLarge ( HB_FHANDLE hFileHandle, HB_FOFFSET nOffset, HB_USHORT uiFlags ); /* reposition an open file using 64-bit API */ extern HB_EXPORT HB_FOFFSET hb_fsTell ( HB_FHANDLE hFileHandle ); /* retrieve the current position of a file */ extern HB_EXPORT HB_FOFFSET hb_fsGetSize ( HB_FHANDLE hFileHandle ); /* retrieve the size of a file, it may change current seek position */ extern HB_EXPORT int hb_fsSetDevMode ( HB_FHANDLE hFileHandle, int iDevMode ); /* change the device mode of a file (text/binary) */ @@ -196,7 +196,7 @@ extern HB_EXPORT HB_BOOL hb_fsLinkSym ( const char * pszTarget, const cha extern HB_EXPORT char * hb_fsLinkRead ( const char * pszFileName ); /* returns the link pointed to */ #if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) -/* for POSIX systems only, hides low level select()/poll() access, +/* for POSIX systems only, hides low-level select()/poll() access, intentionally covered by HB_OS_UNIX / __DJGPP__ macros to generate compile time error in code which tries to use it on other platforms */ @@ -233,7 +233,7 @@ extern HB_EXPORT int hb_fsCanWrite ( HB_FHANDLE hFileHandle, HB_MAXINT ! defined( __WATCOMC__ ) && ! defined( HB_USE_BSDLOCKS ) /* default usage of BSD locks in *BSD systems for emulating * MS-DOS/Windows DENY_* flags has been disabled because tests - * on FreeBSD 6.2 and OS X shows that this implementation + * on FreeBSD 6.2 and macOS shows that this implementation * can create self deadlock when used simultaneously with * POSIX locks - thanks to Phil and Lorenzo for locating the * problem and tests [druzus] @@ -298,7 +298,7 @@ typedef struct } HB_FFIND, * PHB_FFIND; /* File Find API functions */ -extern HB_EXPORT PHB_FFIND hb_fsFindFirst( const char * pszFileName, HB_FATTR ulAttrMask ); +extern HB_EXPORT PHB_FFIND hb_fsFindFirst( const char * pszFileMask, HB_FATTR attrmask ); extern HB_EXPORT HB_BOOL hb_fsFindNext( PHB_FFIND ffind ); extern HB_EXPORT void hb_fsFindClose( PHB_FFIND ffind ); diff --git a/include/hbapigt.h b/include/hbapigt.h index 8c3a0b75e0..240ce105e1 100644 --- a/include/hbapigt.h +++ b/include/hbapigt.h @@ -2,6 +2,9 @@ * Header file for the Terminal API * * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> (Keyboard related declarations, Cursor declarations) + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (Mouse related declarations, Undocumented GT API declarations) + * Copyright 2005 Przemyslaw Czerpak < druzus /at/ priv.onet.pl > (Internal GT code reimplemented in different way) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,25 +47,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * Keyboard related declarations - * Cursor declarations - * See above for licensing terms. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * Mouse related declarations - * Undocumented GT API declarations - * - * Copyright 2005 Przemyslaw Czerpak < druzus /at/ priv.onet.pl > - * Internal GT code reimplemented in different way - * - * See COPYING.txt for licensing terms. - * - */ - #ifndef HB_APIGT_H_ #define HB_APIGT_H_ @@ -177,7 +161,7 @@ extern HB_EXPORT int hb_gtMaxCol( void ); extern HB_EXPORT int hb_gtMaxRow( void ); extern HB_EXPORT HB_ERRCODE hb_gtPostExt( void ); extern HB_EXPORT HB_ERRCODE hb_gtPreExt( void ); -extern HB_EXPORT HB_ERRCODE hb_gtSuspend( void ); /* prepare the reminal for shell output */ +extern HB_EXPORT HB_ERRCODE hb_gtSuspend( void ); /* prepare the terminal for shell output */ extern HB_EXPORT HB_ERRCODE hb_gtResume( void ); /* resume the terminal after the shell output */ extern HB_EXPORT int hb_gtReadKey( int iEventMask ); extern HB_EXPORT HB_ERRCODE hb_gtRectSize( int iTop, int iLeft, int iBottom, int iRight, HB_SIZE * pnBuffSize ); @@ -277,7 +261,7 @@ extern HB_EXPORT void hb_gtWCurrent( HB_GT_WND * wnd ); extern HB_EXPORT void hb_gtWPos( HB_GT_WND * wnd, HB_GT_RECT * rect ); extern HB_EXPORT HB_BOOL hb_gtWVis( HB_GT_WND * wnd, HB_USHORT uiStatus ); -extern HB_EXPORT HB_ERRCODE hb_gtSLR( HB_GT_SLR * pSLR ); /* System Level Request */ +extern HB_EXPORT HB_ERRCODE hb_gtSLR( HB_GT_SLR * pSLR ); /* System-Level Request */ extern HB_EXPORT HB_ERRCODE hb_gtModalRead( void * ); extern HB_EXPORT HB_ERRCODE hb_gtFlushCursor( void ); extern HB_EXPORT HB_ERRCODE hb_gtSetColor( HB_GT_RGB * color ); @@ -310,7 +294,7 @@ extern HB_EXPORT int hb_inkeySetLast( int iKey ); /* Set new LastKey() extern HB_EXPORT void hb_inkeyExit( void ); /* reset inkey pool to default state and free any allocated resources */ extern HB_EXPORT HB_SIZE hb_inkeyKeyString( int iKey, char * buffer, HB_SIZE nSize ); /* convert key value to string */ -extern HB_EXPORT int hb_inkeyKeyStd( int iKey ); /* convert Harbour extended key code to cl*pper inkey code */ +extern HB_EXPORT int hb_inkeyKeyStd( int iKey ); /* convert Harbour extended key code to Cl*pper inkey code */ extern HB_EXPORT int hb_inkeyKeyExt( int iKey ); /* extract function/edit key code value HB_KX_* from Harbour extended key code */ extern HB_EXPORT int hb_inkeyKeyMod( int iKey ); /* extract keyboard modifiers HB_KF_* from Harbour extended key code */ extern HB_EXPORT int hb_inkeyKeyVal( int iKey ); /* extract key/character code from Harbour extended key code */ diff --git a/include/hbapiitm.h b/include/hbapiitm.h index 58be71e7d9..df5361a08f 100644 --- a/include/hbapiitm.h +++ b/include/hbapiitm.h @@ -155,7 +155,7 @@ extern HB_EXPORT HB_BOOL hb_itemEqual ( PHB_ITEM pItem1, PHB_ITEM pItem extern HB_EXPORT HB_BOOL hb_itemCompare ( PHB_ITEM pItem1, PHB_ITEM pItem2, HB_BOOL bForceExact, int * piResult ); /* For compatible types compare pItem1 with pItem2 setting piResult to -1, 0 or 1 if pItem1 is <, == or > then pItem2 and return true otherwise return false. */ extern HB_EXPORT int hb_itemStrCmp ( PHB_ITEM pFirst, PHB_ITEM pSecond, HB_BOOL bForceExact ); /* our string compare */ extern HB_EXPORT int hb_itemStrICmp ( PHB_ITEM pFirst, PHB_ITEM pSecond, HB_BOOL bForceExact ); /* our string compare */ -extern HB_EXPORT void hb_itemCopy ( PHB_ITEM pDest, PHB_ITEM pSource ); /* copies an item to one place to another respecting its containts */ +extern HB_EXPORT void hb_itemCopy ( PHB_ITEM pDest, PHB_ITEM pSource ); /* copies an item to one place to another respecting its content */ extern HB_EXPORT void hb_itemCopyToRef ( PHB_ITEM pDest, PHB_ITEM pSource ); extern HB_EXPORT void hb_itemCopyFromRef( PHB_ITEM pDest, PHB_ITEM pSource ); extern HB_EXPORT void hb_itemMove ( PHB_ITEM pDest, PHB_ITEM pSource ); /* moves the value of an item without incrementing of reference counters, source is cleared */ @@ -212,7 +212,7 @@ extern PHB_ITEM hb_itemPutPtrRawGC( PHB_ITEM pItem, void * pValue ); # define hb_itemRawMove( dst, src ) hb_itemMove( (dst), (src) ) #endif - /* intentional low level hack to eliminate race condition in + /* intentional low-level hack to eliminate race condition in * unprotected readonly access in few places in core code only. * hb_item[Raw]Move() moves HB_ITEM structure members first coping * 'type' and then 'item' parts of HB_ITEM. In this macro the order diff --git a/include/hbapirdd.h b/include/hbapirdd.h index 6a463fe900..acc34f85c8 100644 --- a/include/hbapirdd.h +++ b/include/hbapirdd.h @@ -112,7 +112,7 @@ HB_EXTERN_BEGIN #define HB_FF_HIDDEN 0x0001 /* System Column (not visible to user) */ #define HB_FF_NULLABLE 0x0002 /* Column can store null values */ #define HB_FF_BINARY 0x0004 /* Binary column */ -#define HB_FF_AUTOINC 0x0008 /* Column is autoincrementing */ +#define HB_FF_AUTOINC 0x0008 /* Column is auto-incrementing */ #define HB_FF_COMPRESSED 0x0010 /* Column is compressed */ #define HB_FF_ENCRYPTED 0x0020 /* Column is encrypted */ #define HB_FF_UNICODE 0x0040 /* Column stores Unicode strings */ @@ -282,7 +282,7 @@ typedef struct PHB_ITEM itmOrder; /* Name or Number of the Order */ PHB_ITEM itmCobExpr; /* Code block containing the KEY expression */ PHB_ITEM itmResult; /* Operation result */ - PHB_ITEM itmNewVal; /* New Setting */ + PHB_ITEM itmNewVal; /* New Setting */ HB_BOOL fAllTags; /* Open all tags */ } DBORDERINFO; @@ -738,7 +738,7 @@ typedef struct _RDDFUNCS DBENTRYP_VLO setLocate; /*-Set the locate scope for the specified WorkArea. */ DBENTRYP_VOS setScope; /* */ DBENTRYP_VPL skipScope; /* */ - DBENTRYP_B locate; /* reposition cursor to postions set by setLocate */ + DBENTRYP_B locate; /* reposition cursor to positions set by setLocate */ /* Miscellaneous */ @@ -750,7 +750,7 @@ typedef struct _RDDFUNCS /* Network operations */ - DBENTRYP_VSP rawlock; /* Perform a lowlevel network lock in the specified WorkArea. */ + DBENTRYP_VSP rawlock; /* Perform a low-level network lock in the specified WorkArea. */ DBENTRYP_VL lock; /* Perform a network lock in the specified WorkArea. */ DBENTRYP_I unlock; /* Release network locks in the specified WorkArea. */ @@ -790,7 +790,7 @@ typedef RDDFUNCS * PRDDFUNCS; #define RDDFUNCSCOUNT ( sizeof( RDDFUNCS ) / sizeof( DBENTRYP_V ) ) -/* RDD Node structure */ +/* RDD Node structure */ typedef struct _RDDNODE { char szName[ HB_RDD_MAX_DRIVERNAME_LEN + 1 ]; /* Name of RDD */ diff --git a/include/hbapistr.h b/include/hbapistr.h index 39d21d73f2..f0764d5d65 100644 --- a/include/hbapistr.h +++ b/include/hbapistr.h @@ -1,5 +1,5 @@ /* - * string API functions + * String API functions * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbatomic.h b/include/hbatomic.h index f5327709b2..6d0c8fae6a 100644 --- a/include/hbatomic.h +++ b/include/hbatomic.h @@ -1,5 +1,5 @@ /* - * header file with functions for atomic operations + * Header file with functions for atomic operations * * Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -513,8 +513,7 @@ HB_EXTERN_BEGIN # define HB_SPINLOCK_REPEAT 63 # endif -/* workaround for borland C/C++ compiler limitation */ -#if defined( __BORLANDC__ ) +#if defined( __BORLANDC__ ) /* workaround for compiler limitation */ # define hb_spinlock_acquire_r( sl ) \ do { \ HB_SPINLOCK_T * l = &(sl)->lock; \ diff --git a/include/hbbfish.h b/include/hbbfish.h index 74aed1f291..525a50305c 100644 --- a/include/hbbfish.h +++ b/include/hbbfish.h @@ -1,12 +1,12 @@ /* * This code implements BlowFish algorithm designed by Bruce Schneier. - * The description of BlowFish algorithm can be found at: - * http://www.schneier.com/paper-blowfish-fse.html - * This code uses for initial s-boxes and p-array values PI hex digits - * taken from tables public at: - * http://www.schneier.com/blowfish.html - * which can be downloaded from: - * http://www.schneier.com/code/constants.txt + * The description of BlowFish algorithm can be found at: + * https://www.schneier.com/paper-blowfish-fse.html + * This code uses for initial s-boxes and p-array values PI hex digits + * taken from tables public at: + * https://www.schneier.com/blowfish.html + * which can be downloaded from: + * https://www.schneier.com/code/constants.txt * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbcdpreg.h b/include/hbcdpreg.h index 570db31102..bb47499951 100644 --- a/include/hbcdpreg.h +++ b/include/hbcdpreg.h @@ -1,5 +1,5 @@ /* - * code used to register new CP definition + * Code used to register new CP definition * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbchksum.h b/include/hbchksum.h index 135805173e..996c8f8e61 100644 --- a/include/hbchksum.h +++ b/include/hbchksum.h @@ -1,5 +1,5 @@ /* - * header files for functions to calculate different checksums + * Header files for functions to calculate different checksums * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbclass.ch b/include/hbclass.ch index 61e31b5997..30d0c14e2c 100644 --- a/include/hbclass.ch +++ b/include/hbclass.ch @@ -2,6 +2,8 @@ * Header file for Class commands * * Copyright 1999 Antonio Linares <alinares@fivetechsoft.com> + * Copyright 2000-07 JF. Lefebvre <jfl@mafact.com> & RA. Cuylen <rac@mafact.com> (Class(y), TopClass and Visual Object compatibility, multiple inheritance) + * Copyright 2000-08-2001 JF. Lefebvre <jfl@mafact.com> (Scoping, Delegating, DATA Shared, Support of 10 Chars limits) * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * most of rules rewritten * @@ -46,22 +48,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 ( ->07/2000 ) JF. Lefebvre <jfl@mafact.com> & RA. Cuylen <rac@mafact.com> - * Support for Class(y), TopClass and Visual Object compatibility - * Support for MI (multiple inheritance), - - * Copyright 2000-2001 ( 08/2000-> ) JF. Lefebvre <jfl@mafact.com> - * Scoping (Protect, Hidden and Readonly), - * Delegating, DATA Shared - * Support of 10 Chars limits - * - * See COPYING.txt for licensing terms. - * - */ - #ifndef HB_CLASS_CH_ #define HB_CLASS_CH_ @@ -82,7 +68,7 @@ /* There is also two compatibility define you can use */ /* HB_CLS_NOTOBJECT which IF DEFINED, disable the auto inherit of HBObject */ -/* (which in fact also disable the classy compatibility :new(...) => :Init(...) */ +/* (which in fact also disable the classy compatibility :new(...) => :Init(...) */ /* HB_CLS_NOAUTOINIT which disable the (VO like) AutoInit for Logical, Numeric, */ /* Date and Timestamp when not specifically initiated */ /* These two are disabled by default */ @@ -279,7 +265,7 @@ DECLARE HBClass ; local Self AS CLASS <ClassName> := QSelf() AS CLASS <ClassName> #xcommand __HB_CLS_DECLARE_METHOD <MethodName> <!ClassName!> => ; - #xcommand METHOD \<type: FUNCTION, PROCEDURE> <MethodName> CLASS <ClassName> _CLASS_IMPLEMENTATION_ => ; + #xcommand METHOD \<type: FUNCTION, PROCEDURE> <MethodName> CLASS <ClassName> _CLASS_IMPLEMENTATION_ => ; DECLARED METHOD \<type> <MethodName> CLASS <ClassName> #xcommand __HB_CLS_DECLARE_METHOD <!MethodName!> <!ClassName!> => ; diff --git a/include/hbcomp.h b/include/hbcomp.h index 4292ff6aa2..aa7c6d66dc 100644 --- a/include/hbcomp.h +++ b/include/hbcomp.h @@ -47,8 +47,8 @@ #ifndef HB_COMP_H_ #define HB_COMP_H_ -#include "hbmacro.ch" #include "hbapi.h" +#include "hbmacro.ch" #include "hberrors.h" #include "hbpp.h" #include "hbmacro.h" @@ -83,7 +83,7 @@ extern void hb_compParserRun( HB_COMP_DECL ); #define HB_VSCOMP_MEMVAR ( HB_VSCOMP_PUBLIC | HB_VSCOMP_PRIVATE ) #define HB_VSCOMP_TH_STATIC ( HB_VSCOMP_STATIC | HB_VSCOMP_THREAD ) -/* return detailed information about a class of variable */ +/* return detailed information about a class of variable */ #define HB_VS_UNDECLARED 0 /* variables declared in a current codeblock/function/procedure */ #define HB_VS_CBLOCAL_VAR 1 /* func/proc local variables and parameters used in codeblock (detached) */ @@ -116,7 +116,7 @@ extern void hb_compParserRun( HB_COMP_DECL ); #define HB_FUNF_WITH_RETURN 0x0020 /* there was RETURN statement in previous line */ #define HB_FUNF_EXTBLOCK 0x0040 /* it's extended codeblock */ #define HB_FUNF_FILE_DECL 0x0080 /* pseudo function with file wide declarations */ -#define HB_FUNF_FILE_FIRST 0x0100 /* 1-st real or pseudo function in compiled .prg module */ +#define HB_FUNF_FILE_FIRST 0x0100 /* 1st real or pseudo function in compiled .prg module */ #define HB_FUNF_ATTACHED 0x0200 /* function attached to function list */ extern void hb_compFunctionAdd( HB_COMP_DECL, const char * szFunName, HB_SYMBOLSCOPE cScope, int iType ); /* starts a new Clipper language function definition */ @@ -342,27 +342,27 @@ extern const HB_BYTE hb_comp_pcode_len[]; #define HB_IDENT_FREE 1 #define HB_IDENT_COPY 2 -/* /GC command line setting types */ +/* /GC command-line setting types */ #define HB_COMPGENC_COMPACT 0 #define HB_COMPGENC_NORMAL 1 #define HB_COMPGENC_VERBOSE 2 #define HB_COMPGENC_REALCODE 3 -/* /ES command line setting types */ +/* /ES command-line setting types */ #define HB_EXITLEVEL_DEFAULT 0 #define HB_EXITLEVEL_SETEXIT 1 #define HB_EXITLEVEL_DELTARGET 2 -/* /kx command line setting types - compatibility modes +/* /kx command-line setting types - compatibility modes * (turn on a bit in HB_ULONG word) */ #define HB_COMPFLAG_HARBOUR HB_SM_HARBOUR /* 1 -kh */ #define HB_COMPFLAG_XBASE HB_SM_XBASE /* 2 -kx */ -#define HB_COMPFLAG_SHORTCUTS HB_SM_SHORTCUTS /* 8 -z enable sortcuts for logical operators */ +#define HB_COMPFLAG_SHORTCUTS HB_SM_SHORTCUTS /* 8 -z enable shortcuts for logical operators */ #define HB_COMPFLAG_ARRSTR HB_SM_ARRSTR /* 16 -ks strings as array of bytes */ -#define HB_COMPFLAG_EXTOPT HB_SM_EXTOPT /* 32 -ko clipper incompatible optimizations */ +#define HB_COMPFLAG_EXTOPT HB_SM_EXTOPT /* 32 -ko Cl*pper incompatible optimizations */ #define HB_COMPFLAG_RT_MACRO HB_SM_RT_MACRO /* 64 -kr */ -#define HB_COMPFLAG_OPTJUMP 0x0100 /* -kj turn off jump optimalization */ +#define HB_COMPFLAG_OPTJUMP 0x0100 /* -kj turn off jump optimization */ #define HB_COMPFLAG_HB_INLINE 0x0200 /* -ki hb_inLine(...) { ... } support */ #define HB_COMPFLAG_MACROTEXT 0x0400 /* -kM turn off macrotext substitution */ #define HB_COMPFLAG_USERCP 0x0800 /* -ku strings in user encoding */ diff --git a/include/hbcompdf.h b/include/hbcompdf.h index dd798dd6e4..2a76348eab 100644 --- a/include/hbcompdf.h +++ b/include/hbcompdf.h @@ -1,5 +1,5 @@ /* - * definitions shared by compiler and macro compiler + * Definitions shared by compiler and macro compiler * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -44,11 +44,9 @@ * */ - #ifndef HB_COMPDF_H_ #define HB_COMPDF_H_ -#include "hbapi.h" #include "hbpp.h" #include "hbhash.h" @@ -101,7 +99,7 @@ typedef struct _HB_HVAR const char * szAlias; /* variable alias namespace */ int iUsed; /* number of times used */ int iDeclLine; /* declaration line number */ - HB_USHORT uiFlags; /* optional falgs, f.e. THREAD STATIC */ + HB_USHORT uiFlags; /* optional flags, f.e. THREAD STATIC */ HB_BYTE cType; /* optional strong typing */ PHB_HCLASS pClass; struct _HB_HVAR * pNext; /* pointer to next defined variable */ @@ -145,9 +143,9 @@ typedef struct _HB_VARTYPE typedef enum { HB_EA_REDUCE = 0, /* reduce the expression into optimized one */ - HB_EA_ARRAY_AT, /* check if the expession can be used as array */ - HB_EA_ARRAY_INDEX, /* check if the expession can be used as index */ - HB_EA_LVALUE, /* check if the expression can be used as lvalue (left side of an assigment) */ + HB_EA_ARRAY_AT, /* check if the expression can be used as array */ + HB_EA_ARRAY_INDEX, /* check if the expression can be used as index */ + HB_EA_LVALUE, /* check if the expression can be used as lvalue (left side of an assignment) */ HB_EA_PUSH_PCODE, /* generate the pcodes to push the value of expression */ HB_EA_POP_PCODE, /* generate the pcodes to pop the value of expression */ HB_EA_PUSH_POP, /* generate the pcodes to push and pop the expression */ @@ -167,7 +165,7 @@ typedef enum #define HB_ET_MACRO_ALIASED 0x0004 /* &alias->&variable */ #define HB_ET_MACRO_EXPR 0x0008 /* &( expr ) */ #define HB_ET_MACRO_LIST 0x0010 /* &variable used as in literal arrays or function call argument. */ -#define HB_ET_MACRO_PARE 0x0020 /* &variable used as parentesised expressions. */ +#define HB_ET_MACRO_PARE 0x0020 /* &variable used as parenthesized expressions. */ #define HB_ET_MACRO_REFER 0x0040 /* ¯o used in @ (pass by reference) */ #define HB_ET_MACRO_ASSIGN 0x0080 /* o:&msgname := value */ #define HB_ET_MACRO_NOLIST ( HB_ET_MACRO_SYMBOL | HB_ET_MACRO_ALIASED | \ @@ -215,7 +213,7 @@ typedef enum HB_ET_VARIABLE, HB_EO_POSTINC, /* post-operators -> lowest precedence */ HB_EO_POSTDEC, - HB_EO_ASSIGN, /* assigments */ + HB_EO_ASSIGN, /* assignments */ HB_EO_PLUSEQ, HB_EO_MINUSEQ, HB_EO_MULTEQ, @@ -360,12 +358,12 @@ typedef struct HB_EXPR_ struct { char * string; /* literal strings */ - HB_BOOL dealloc; /* automatic deallocate on expresion deletion */ + HB_BOOL dealloc; /* automatically deallocate on expression deletion */ } asString; struct { struct HB_EXPR_ * pMacro; /* macro variable */ - const char * szName; /* variable name */ + const char * szName; /* variable name */ } asRTVar; /* PUBLIC or PRIVATE variable declaration */ struct { @@ -384,7 +382,7 @@ typedef struct HB_EXPR_ } asNum; struct { - long lDate; /* julian date */ + long lDate; /* Julian date */ long lTime; /* time in milliseconds */ } asDate; struct @@ -516,7 +514,7 @@ typedef struct _HB_HFUNC HB_SIZE nJumps; /* Jumps Counter */ int iStaticsBase; /* base for this function statics */ int iFuncSuffix; /* function suffix for multiple static functions with the same name */ - int iEarlyEvalPass; /* !=0 if early evaluaded block is compiled - accessing of declared (compile time) variables is limited */ + int iEarlyEvalPass; /* !=0 if early evaluated block is compiled - accessing of declared (compile time) variables is limited */ HB_BOOL fVParams; /* HB_TRUE if variable number of parameters is used */ HB_BOOL bError; /* error during function compilation */ HB_BOOL bBlock; /* HB_TRUE if simple codeblock body is compiled */ @@ -537,7 +535,7 @@ typedef struct _HB_HFUNC HB_USHORT wWithObjectCnt; } HB_HFUNC, * PHB_HFUNC; -/* structure to hold PP #define variables passed as command line parameters */ +/* structure to hold PP #define variables passed as command-line parameters */ typedef struct _HB_PPDEFINE { char * szName; /* name of PP #define variable */ @@ -567,7 +565,7 @@ typedef struct _HB_HFUNCALL /* structure to control all Clipper defined functions */ typedef struct { - PHB_HFUNC pFirst; /* pointer to the first defined funtion */ + PHB_HFUNC pFirst; /* pointer to the first defined function */ PHB_HFUNC pLast; /* pointer to the last defined function */ int iCount; /* number of defined functions */ } HB_HFUNCTION_LIST; @@ -785,8 +783,8 @@ typedef struct _HB_COMP PHB_I18NTABLE pI18n; HB_BOOL fI18n; - void ( * outStdFunc ) ( void *, const char* ); - void ( * outErrFunc ) ( void *, const char* ); + void ( * outStdFunc ) ( void *, const char * ); + void ( * outErrFunc ) ( void *, const char * ); PHB_PP_MSG_FUNC outMsgFunc; void * cargo; @@ -819,7 +817,7 @@ typedef struct _HB_COMP int iVarScope; /* holds the scope for next variables to be defined */ int iLanguage; /* default Harbour generated output language */ int iGenCOutput; /* C code generation should be verbose (use comments) or not */ - int ilastLineErr; /* line numer with last syntax error */ + int ilastLineErr; /* line number with last syntax error */ int iTraceInclude; /* trace included files and generate dependencies list */ int iSyntaxCheckOnly; /* syntax check only */ int iErrorFmt; /* error message formatting mode (default: Clipper) */ @@ -828,12 +826,12 @@ typedef struct _HB_COMP HB_BOOL fGauge; /* hide line counter gauge (-ql) */ HB_BOOL fFullQuiet; /* be quiet during compilation disable all messages */ HB_BOOL fExit; /* force breaking compilation process */ - HB_BOOL fPPO; /* flag indicating, is ppo output needed */ - HB_BOOL fPPT; /* flag indicating, is ppt output needed */ + HB_BOOL fPPO; /* flag indicating, is .ppo output needed */ + HB_BOOL fPPT; /* flag indicating, is .ppt output needed */ HB_BOOL fLineNumbers; /* holds if we need pcodes with line numbers */ HB_BOOL fAnyWarning; /* holds if there was any warning during the compilation process */ HB_BOOL fAutoMemvarAssume; /* holds if undeclared variables are automatically assumed MEMVAR (-a)*/ - HB_BOOL fForceMemvars; /* holds if memvars are assumed when accesing undeclared variable (-v)*/ + HB_BOOL fForceMemvars; /* holds if memvars are assumed when accessing undeclared variable (-v)*/ HB_BOOL fDebugInfo; /* holds if generate debugger required info */ HB_BOOL fHideSource; /* do not embed original source filename into generated source code */ HB_BOOL fNoStartUp; /* C code generation embed HB_FS_FIRST or not */ diff --git a/include/hbdate.h b/include/hbdate.h index 76b9546184..0f43909486 100644 --- a/include/hbdate.h +++ b/include/hbdate.h @@ -54,10 +54,10 @@ HB_EXTERN_BEGIN extern HB_EXPORT double hb_secondsCPU( int n ); extern HB_EXPORT double hb_dateSeconds( void ); -/* return UTC julian timestamp in milliseconds */ +/* return UTC Julian timestamp in milliseconds */ extern HB_EXPORT HB_MAXUINT hb_dateMilliSeconds( void ); -/* functions to operate on julian date values */ +/* functions to operate on Julian date values */ extern HB_EXPORT void hb_dateTimeStr( char * pszTime ); extern HB_EXPORT void hb_dateToday( int * piYear, int * piMonth, int * piDay ); @@ -162,7 +162,7 @@ HB_EXTERN_END ! defined( HB_OS_DARWIN_5 ) # define HB_HAS_LOCALTIME_R # elif defined( __WATCOMC__ ) -# if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ == 1 +# if defined( __STDC_WANT_LIB_EXT1__ ) && __STDC_WANT_LIB_EXT1__ == 1 # define HB_HAS_LOCALTIME_R # define localtime_r localtime_s # define gmtime_r gmtime_s diff --git a/include/hbdbf.h b/include/hbdbf.h index e75fdb2203..58ca9bf2dc 100644 --- a/include/hbdbf.h +++ b/include/hbdbf.h @@ -64,7 +64,7 @@ typedef struct _DBFHEADER HB_BYTE uiRecordLen[ 2 ]; HB_BYTE bReserved1[ 2 ]; HB_BYTE bTransaction; /* 1-transaction begin */ - HB_BYTE bEncrypted; /* 1-encryptpted table */ + HB_BYTE bEncrypted; /* 1-encrypted table */ HB_BYTE bReserved2[ 12 ]; HB_BYTE bHasTags; /* bit filed: 1-production index, 2-memo file in VFP */ HB_BYTE bCodePage; @@ -85,8 +85,8 @@ typedef struct _DBFFIELD HB_BYTE bLen; HB_BYTE bDec; HB_BYTE bFieldFlags; /* 1-system column, 2-nullable, 4-binary */ - HB_BYTE bCounter[ 4 ]; /* autoincrement counter */ - HB_BYTE bStep; /* autoincrement step */ + HB_BYTE bCounter[ 4 ]; /* auto-increment counter */ + HB_BYTE bStep; /* auto-increment step */ HB_BYTE bReserved2[ 7 ]; HB_BYTE bHasTag; } DBFFIELD; diff --git a/include/hbdebug.ch b/include/hbdebug.ch index 80a8a4358e..996898a96d 100644 --- a/include/hbdebug.ch +++ b/include/hbdebug.ch @@ -49,13 +49,13 @@ #ifndef HB_DEBUGGER_CH_ #define HB_DEBUGGER_CH_ -/* Mode of __dbgEntry calls (the first parameter) */ -#define HB_DBG_MODULENAME 1 /* 2nd argumment is a module name */ +/* Mode of __dbgEntry() calls (the first parameter) */ +#define HB_DBG_MODULENAME 1 /* 2nd argument is a module name */ #define HB_DBG_LOCALNAME 2 /* 2nd argument is a local var name */ #define HB_DBG_STATICNAME 3 /* 2nd arg is a static var name */ #define HB_DBG_ENDPROC 4 /* exit from a procedure */ #define HB_DBG_SHOWLINE 5 /* show current line */ -#define HB_DBG_GETENTRY 6 /* initialize C __dbgEntry function pointer */ +#define HB_DBG_GETENTRY 6 /* initialize C __dbgEntry() function pointer */ #define HB_DBG_ACTIVATE 7 /* activate debugger interface */ #define HB_DBG_VMQUIT 8 /* call internal debugger destructors */ @@ -93,7 +93,7 @@ #define HB_DBG_WP_RESULT 4 /* expression result */ #define HB_DBG_WP_LEN 4 -/* Information structure stored in __dbgGetBreakPoints array */ +/* Information structure stored in __dbgGetBreakPoints() array */ #define HB_DBG_BP_LINE 1 /* line number */ #define HB_DBG_BP_MODULE 2 /* module name */ #define HB_DBG_BP_FUNC 3 /* function name */ diff --git a/include/hbdefs.h b/include/hbdefs.h index 67904e4b0e..e751d38398 100644 --- a/include/hbdefs.h +++ b/include/hbdefs.h @@ -78,8 +78,7 @@ # if defined( HB_OS_VXWORKS ) && defined( _INTPTR ) && ! defined( _INTPTR_T ) # define _INTPTR_T # endif - /* workaround for BCC 5.8 bug */ - #if ( defined( __BORLANDC__ ) && __BORLANDC__ >= 0x0582 ) + #if ( defined( __BORLANDC__ ) && __BORLANDC__ >= 0x0582 ) /* workaround for compiler bug */ #undef INT32_MIN #define INT32_MIN ((int32_t) (-INT32_MAX-1)) #undef INT64_MIN @@ -89,10 +88,20 @@ #endif #endif -/* +#if ( defined( __GNUC__ ) || defined( __SUNPRO_C ) || defined( __SUNPRO_CC ) ) && \ + ( defined( _ISOC99_SOURCE ) || defined( _STDC_C99 ) || \ + ( defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L ) ) + #define HB_C99_STATIC static + #define HB_C99_RESTRICT restrict +#else + #define HB_C99_STATIC + #define HB_C99_RESTRICT +#endif + +#if 0 #define HB_CLIPPER_INT_ITEMS #define HB_LONG_LONG_OFF -*/ +#endif #if defined( HB_OS_WIN ) #if defined( HB_OS_WIN_64 ) @@ -640,7 +649,7 @@ typedef HB_U32 HB_FATTR; #if ! defined( HB_PDP_ENDIAN ) && ! defined( HB_BIG_ENDIAN ) && \ ! defined( HB_LITTLE_ENDIAN ) - /* I intentionaly move the first two #if/#elif to the begining + /* I intentionaly move the first two #if/#elif to the beginning to avoid compiler error when this macro will be defined as empty statement in next conditions, F.e. SunOS */ @@ -1480,7 +1489,7 @@ typedef HB_U32 HB_FATTR; #define HB_SYMBOL_UNUSED( symbol ) ( void ) symbol #endif -/* *********************************************************************** +/* * The name of starting procedure * Note: You have to define it in case when Harbour cannot find the proper * starting procedure (due to unknown order of static data initialization) diff --git a/include/hbdyn.ch b/include/hbdyn.ch index db8459302d..78d2415c57 100644 --- a/include/hbdyn.ch +++ b/include/hbdyn.ch @@ -50,9 +50,9 @@ #define HBDYN_CH_ /* C calling conventions */ -#define HB_DYN_CALLCONV_CDECL 0x0000000 /* C default */ -#define HB_DYN_CALLCONV_STDCALL 0x0100000 /* Windows API default */ -#define HB_DYN_CALLCONV_SYSCALL 0x0200000 /* OS/2 32-bit default */ +#define HB_DYN_CALLCONV_CDECL 0x0000000 /* C default */ +#define HB_DYN_CALLCONV_STDCALL 0x0100000 /* Windows API default */ +#define HB_DYN_CALLCONV_SYSCALL 0x0200000 /* OS/2 32-bit default */ /* String encodings */ #define HB_DYN_ENC_ASCII 0x0000000 diff --git a/include/hbexpra.c b/include/hbexpra.c index 46baafc4eb..bc159854bc 100644 --- a/include/hbexpra.c +++ b/include/hbexpra.c @@ -44,11 +44,8 @@ * */ - #include "hbcomp.h" -/* ************************************************************************ */ - #ifndef HB_MACRO_SUPPORT HB_SIZE hb_compExprListEval( HB_COMP_DECL, PHB_EXPR pExpr, PHB_COMP_CARGO_FUNC pEval ) { @@ -246,7 +243,6 @@ PHB_EXPR hb_compExprNewFunCall( PHB_EXPR pName, PHB_EXPR pParms, HB_COMP_DECL ) /* Reserved Clipper function used to handle GET variables */ PHB_EXPR pArg, pNext; - HB_USHORT uiCount; /* pArg has to be reduced to eliminate possible problems with * cloned expressions in SETGET block @@ -268,6 +264,8 @@ PHB_EXPR hb_compExprNewFunCall( PHB_EXPR pName, PHB_EXPR pParms, HB_COMP_DECL ) if( pArg->ExprType == HB_ET_ARRAYAT ) { + HB_USHORT uiCount; + /* replace: _GET_( a[1], "a[1]", , , ) into: @@ -297,7 +295,7 @@ PHB_EXPR hb_compExprNewFunCall( PHB_EXPR pName, PHB_EXPR pParms, HB_COMP_DECL ) /* create a set only codeblock */ if( pVar->ExprType == HB_ET_MACRO ) { - /* &var[1] */ + /* &var[ 1 ] */ HB_COMP_EXPR_FREE( pVar ); pVar = hb_compExprNewNil( HB_COMP_PARAM ); } @@ -330,12 +328,12 @@ PHB_EXPR hb_compExprNewFunCall( PHB_EXPR pName, PHB_EXPR pParms, HB_COMP_DECL ) pVar->pNext = hb_compExprNewNil( HB_COMP_PARAM ); pVar = pVar->pNext; } - if( pVar->pNext ) /* Delete 6-th argument if present */ + if( pVar->pNext ) /* Delete 6th argument if present */ { pIndex->pNext = pVar->pNext->pNext; HB_COMP_EXPR_FREE( pVar->pNext ); } - pVar->pNext = pIndex; /* Set a new 6-th argument */ + pVar->pNext = pIndex; /* Set a new 6th argument */ /* Remove the index expression from a string representation */ @@ -442,7 +440,7 @@ PHB_EXPR hb_compExprNewFunCall( PHB_EXPR pName, PHB_EXPR pParms, HB_COMP_DECL ) */ PHB_EXPR pFirst = pArg; /* save first argument */ - pArg = hb_compExprNewNil( HB_COMP_PARAM ); /* replace 1-st with NIL */ + pArg = hb_compExprNewNil( HB_COMP_PARAM ); /* replace 1st with NIL */ if( pFirst->pNext && pFirst->pNext->ExprType == HB_ET_STRING ) pArg->pNext = pFirst->pNext; else @@ -558,8 +556,7 @@ PHB_EXPR hb_compExprNewArrayAt( PHB_EXPR pArray, PHB_EXPR pIndex, HB_COMP_DECL ) return pExpr; } - -/* ************************************************************************* */ +/* === */ #ifndef HB_MACRO_SUPPORT @@ -691,7 +688,7 @@ PHB_EXPR hb_compExprAssignStatic( PHB_EXPR pLeftExpr, PHB_EXPR pRightExpr, HB_CO PHB_EXPR hb_compExprSetCodeblockBody( PHB_EXPR pExpr, HB_BYTE * pCode, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprSetCodeblockBody(%p,%p,%" HB_PFS "u)", pExpr, pCode, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprSetCodeblockBody(%p,%p,%" HB_PFS "u)", ( void * ) pExpr, ( void * ) pCode, nLen ) ); pExpr->value.asCodeblock.string = ( char * ) hb_xgrab( nLen + 1 ); memcpy( pExpr->value.asCodeblock.string, pCode, nLen ); @@ -756,7 +753,7 @@ PHB_EXPR hb_compExprGenPop( PHB_EXPR pExpr, HB_COMP_DECL ) */ PHB_EXPR hb_compExprGenStatement( PHB_EXPR pExpr, HB_COMP_DECL ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprGenStatement(%p)", pExpr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprGenStatement(%p)", ( void * ) pExpr ) ); if( pExpr ) { if( pExpr->ExprType == HB_EO_EQUAL ) @@ -776,5 +773,3 @@ PHB_EXPR hb_compExprReduce( PHB_EXPR pExpr, HB_COMP_DECL ) return HB_EXPR_USE( pExpr, HB_EA_REDUCE ); } #endif - -/* ************************************************************************* */ diff --git a/include/hbexprb.c b/include/hbexprb.c index ce6266e448..24bbde6656 100644 --- a/include/hbexprb.c +++ b/include/hbexprb.c @@ -45,7 +45,6 @@ */ #include "hbcomp.h" -#include "hbmacro.ch" #if ! defined( HB_HASH_USES_ARRAY_INDEXES ) # define HB_HASH_USES_ARRAY_INDEXES @@ -174,7 +173,7 @@ const PHB_EXPR_FUNC hb_comp_ExprTable[ HB_EXPR_COUNT ] = { hb_compExprUseVariable, hb_compExprUsePostInc, /* post-operators -> lowest precedence */ hb_compExprUsePostDec, - hb_compExprUseAssign, /* assigments */ + hb_compExprUseAssign, /* assignments */ hb_compExprUsePlusEq, hb_compExprUseMinusEq, hb_compExprUseMultEq, @@ -1202,7 +1201,7 @@ static HB_EXPR_FUNC( hb_compExprUseArgList ) } /* NOTE: In PUSH operation it leaves all expressions on the eval stack, - * the expresions are divided into macro compiled blocks + * the expressions are divided into macro compiled blocks */ static HB_EXPR_FUNC( hb_compExprUseMacroArgList ) { @@ -1342,10 +1341,10 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) */ PHB_EXPR pNew = HB_COMP_EXPR_NEW( HB_ET_NONE ); memcpy( pNew, pExpr, sizeof( HB_EXPR ) ); - /* This will suppres releasing of memory occupied by components of + /* This will suppress releasing of memory occupied by components of * the expression - we have just copied them into the new expression. * This method is simpler then traversing the list and releasing all - * but this choosen one. + * but this chosen one. */ pExpr->ExprType = HB_ET_NONE; /* Here comes the magic */ @@ -1602,7 +1601,7 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) { /* complex macro expression: prefix&var.suffix * all components should be placed as a string that will - * be compiled after text susbstitution + * be compiled after text substitution */ /* Check if macrotext variable does not refer to @@ -1694,7 +1693,7 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) { /* complex macro expression: prefix&var.suffix * all components should be placed as a string that will - * be compiled after text susbstitution + * be compiled after text substitution */ /* Check if macrotext variable does not refer to @@ -2358,7 +2357,7 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar ) return pSelf; } -/* handler for expression->( exression, ... ) syntax +/* handler for expression->( expression, ... ) syntax */ static HB_EXPR_FUNC( hb_compExprUseAliasExpr ) { @@ -2396,7 +2395,7 @@ static HB_EXPR_FUNC( hb_compExprUseAliasExpr ) HB_EXPR_USE( pSelf->value.asAlias.pExpList, HB_EA_PUSH_PCODE ); /* swap the two last items on the eval stack: one item is a * value returned by evaluated expression and the second item - * is previously selected workarea. After swaping select again + * is previously selected workarea. After swapping select again * the restored workarea. */ HB_GEN_FUNC1( PCode1, HB_P_SWAPALIAS ); @@ -2535,7 +2534,7 @@ static HB_EXPR_FUNC( hb_compExprUseVariable ) * operator only (if 'any_expr' is not a string) - an alias value * is placed on the eval stack before macro compilation. * The HB_MACRO_GEN_ALIASED flag is used to signal that we have to - * genearate alias aware pcode even if we known a variable part only. + * generate alias aware pcode even if we known a variable part only. */ if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_ALIASED ) HB_GEN_FUNC4( PushAliasedVar, pSelf->value.asSymbol.name, HB_FALSE, NULL, 0 ); @@ -2713,7 +2712,7 @@ static HB_EXPR_FUNC( hb_compExprUseSend ) } else { - /* acces to instance variable */ + /* access to instance variable */ hb_compExprPushSendPush( pSelf, HB_COMP_PARAM ); HB_GEN_FUNC2( PCode2, HB_P_SENDSHORT, 0 ); } @@ -2910,7 +2909,7 @@ static HB_EXPR_FUNC( hb_compExprUseAssign ) break; case HB_EA_PUSH_PCODE: - /* NOTE: assigment to an object instance variable needs special handling + /* NOTE: assignment to an object instance variable needs special handling */ if( pSelf->value.asOperator.pLeft->ExprType == HB_ET_SEND ) { @@ -4551,11 +4550,11 @@ static HB_BOOL hb_compExprCodeblockPush( PHB_EXPR pSelf, int iEarlyEvalPass, HB_ pExpr->pNext = pNext; /* restore the link to next expression */ } - /* Generate push/pop pcodes for all expresions except the last one + /* Generate push/pop pcodes for all expressions except the last one * The value of the last expression is used as a return value * of a codeblock evaluation */ - /* NOTE: This will genereate warnings if constant value is + /* NOTE: This will generate warnings if constant value is * used as an expression - some operators will generate it too * e.g. * Eval( {|| 3+5, func()} ) @@ -4624,7 +4623,7 @@ static void hb_compExprCodeblockEarly( PHB_EXPR pSelf, HB_COMP_DECL ) } else { - /* generate code to check if macroexpression refers to local, static + /* generate code to check if macro-expression refers to local, static * or field variables and generate error in such case or disable * iEarlyEvalPass when -kd (MACRODECL) switch is used. * In the 2nd case hb_compExprCodeblockPush() returns true and generated @@ -4741,7 +4740,7 @@ static void hb_compExprPushSendPopPush( PHB_EXPR pObj, PHB_EXPR pValue, /* Push message */ if( pObj->value.asMessage.szMessage ) { - /* HB_TRUE used intnetionally to not push object variable in WITH OBJECT */ + /* HB_TRUE used intentionally not to push object variable in WITH OBJECT */ HB_GEN_FUNC2( Message, pObj->value.asMessage.szMessage, HB_TRUE ); } else @@ -5476,7 +5475,7 @@ static PHB_EXPR hb_compExprReduceList( PHB_EXPR pList, HB_COMP_DECL ) { PHB_EXPR * pExpr; - /* NOTE: During optimalization an expression on the list can be + /* NOTE: During optimization an expression on the list can be * replaced by the new one */ diff --git a/include/hbextcdp.ch b/include/hbextcdp.ch index af94b73f03..d8c80a4e8b 100644 --- a/include/hbextcdp.ch +++ b/include/hbextcdp.ch @@ -1,6 +1,5 @@ /* - * All HB_CODEPAGE_* externals. - * (Compatibility header) + * All HB_CODEPAGE_* externals. (Compatibility header) * * Copyright 2009 Viktor Szakats (vszakats.net/harbour) * diff --git a/include/hbextern.ch b/include/hbextern.ch index 4a4b4ef1f5..536072beaa 100644 --- a/include/hbextern.ch +++ b/include/hbextern.ch @@ -1,6 +1,5 @@ /* - * The declarations for all harbour defined functions/procedures. - * (Compatibility header) + * The declarations for all Harbour defined functions/procedures. (Compatibility header) * * Copyright 2010 Viktor Szakats (vszakats.net/harbour) * Copyright 1999 Ryszard Glab <rglab@imid.med.pl> diff --git a/include/hbextlng.ch b/include/hbextlng.ch index 86c24f1937..9efbc8835b 100644 --- a/include/hbextlng.ch +++ b/include/hbextlng.ch @@ -1,8 +1,7 @@ /* - * All HB_LANG_* externals. - * (Compatibility header) + * All HB_LANG_* externals. (Compatibility header) * - * Copyright 2009 April White <april users.sourceforge.net> + * Copyright 2009 April White <bright.tigra gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/hbfloat.h b/include/hbfloat.h index 970259772e..6167b1113c 100644 --- a/include/hbfloat.h +++ b/include/hbfloat.h @@ -221,7 +221,7 @@ #endif -/* NOTE: Workaround for Pellec C 5.00 not having an 'inf' (HUGE_VAL) +/* NOTE: Workaround for Pelles C 5.00 not having an 'inf' (HUGE_VAL) in '-Tarm-coff' mode. [vszakats] */ #if defined( __POCC__ ) && defined( HB_OS_WIN_CE ) #undef HUGE_VAL diff --git a/include/hbgfx.ch b/include/hbgfx.ch index b777e93820..feb4b8ebfc 100644 --- a/include/hbgfx.ch +++ b/include/hbgfx.ch @@ -54,9 +54,9 @@ /* * NOTE: ACQUIRE / RELEASE screen pair must work same way DispBegin()/DispEnd() pair does * (that is, with an internal counter), as lots of function may want to 'acquire/release' it. - * However, a GT must properly manage its gfx output if the user didn't requested to acquire the + * However, a GT must properly manage its GFX output if the user didn't requested to acquire the * screen, so this is under user choice. - * (the user just needs to know that it is not the same to aquire the screen, draw 100 lines, then + * (the user just needs to know that it is not the same to acquire the screen, draw 100 lines, then * release screen, than simply drawing 100 lines -as the GT will be acquiring/releasing the screen * 100 times, which will slow down things a lot-) [Mauricio] */ diff --git a/include/hbgfxdef.ch b/include/hbgfxdef.ch index 6da7704f5d..9dd9a33b06 100644 --- a/include/hbgfxdef.ch +++ b/include/hbgfxdef.ch @@ -52,17 +52,17 @@ /* * NOTE: ACQUIRE / RELEASE screen pair must work same way DispBegin()/DispEnd() pair does * (that is, with an internal counter), as lots of function may want to 'acquire/release' it. - * However, a GT must properly manage its gfx output if the user didn't requested to acquire the + * However, a GT must properly manage its GFX output if the user didn't requested to acquire the * screen, so this is under user choice. - * (the user just needs to know that it is not the same to aquire the screen, draw 100 lines, then + * (the user just needs to know that it is not the same to acquire the screen, draw 100 lines, then * release screen, than simply drawing 100 lines -as the GT will be acquiring/releasing the screen * 100 times, which will slow down things a lot-) [Mauricio] */ /* Misc, internals */ -#define HB_GFX_ACQUIRESCREEN 1 /* Some GTs may require that you 'acquire' the screen before doing gfx things */ +#define HB_GFX_ACQUIRESCREEN 1 /* Some GTs may require that you 'acquire' the screen before doing GFX things */ #define HB_GFX_RELEASESCREEN 2 /* Release a previously 'acquired' screen */ -#define HB_GFX_MAKECOLOR 3 /* Calculate gfx color number based on RGBA values */ +#define HB_GFX_MAKECOLOR 3 /* Calculate GFX color number based on RGBA values */ /* Functions that affect drawing area */ #define HB_GFX_CLIPTOP 10 #define HB_GFX_CLIPLEFT 11 @@ -86,7 +86,7 @@ /* Drawing mode constants */ #define HB_GFX_MODE_SOLID 1 /* Solid mode, no translucency, no patterned primitives */ #define HB_GFX_MODE_XOR 2 /* XOR with current screen contents */ -#define HB_GFX_MODE_ALPHA 3 /* Use alpha for transluced effect (SLOW) */ +#define HB_GFX_MODE_ALPHA 3 /* Use alpha for translucent effect (SLOW) */ /* TODO: add patterned mode drawings */ #endif /* _HBGFXDEF_CH_ */ diff --git a/include/hbgtcore.h b/include/hbgtcore.h index ef288c4d0f..6b6927ef2c 100644 --- a/include/hbgtcore.h +++ b/include/hbgtcore.h @@ -492,7 +492,7 @@ extern HB_EXPORT void hb_gt_gcMark( void ); #define HB_GTSELF_WHOCARES(g,p) (g)->pFuncTable->WhoCares(g,p) #ifndef HB_GTSUPERTABLE -# define HB_GTSUPERTABLE(g) HB_GTSUPER +#define HB_GTSUPERTABLE(g) HB_GTSUPER #endif #define HB_GTSUPER_LOCK(g) (HB_GTSUPERTABLE(g))->Lock(g) @@ -624,7 +624,7 @@ extern HB_EXPORT void hb_gt_gcMark( void ); extern HB_EXPORT HB_BOOL hb_gtRegister( const HB_GT_INIT * gtInit ); extern HB_EXPORT PHB_GT hb_gtLoad( const char * szGtName, PHB_GT pGT, PHB_GT_FUNCS pSuperTable ); -/* low level GT functions common to different GTs supported by RTL */ +/* low-level GT functions common to different GTs supported by RTL */ extern int hb_gt_chrmapinit( int * piTransTbl, const char * pszTerm, HB_BOOL fSetACSC ); extern HB_BOOL hb_gt_setClipboard( const char * szClipData, HB_SIZE nLen ); extern HB_BOOL hb_gt_getClipboard( char ** pszClipData, HB_SIZE * pnLen ); diff --git a/include/hbgtinfo.ch b/include/hbgtinfo.ch index 065cf6956c..5bba5a3135 100644 --- a/include/hbgtinfo.ch +++ b/include/hbgtinfo.ch @@ -59,15 +59,15 @@ #define HB_GTI_DESKTOPHEIGHT 7 /* Get height of desktop in pixels */ #define HB_GTI_DESKTOPDEPTH 8 /* Amount of bits used for colors in system */ #define HB_GTI_COMPATBUFFER 9 /* Use DOS CGA/EGA/VGA character/attribute buffer in SAVE/REST SCREEN */ -#define HB_GTI_KBDSHIFTS 10 /* Keyboard shift/ctrl/alt, caps/num/scroll & winkeys state */ +#define HB_GTI_KBDSHIFTS 10 /* Keyboard shift/ctrl/alt, caps/num/scroll/windows keys' state */ #define HB_GTI_KBDSPECIAL 11 /* This will get/set the status of the top row shift state handling. Enable to correct a documented keyboard handling bug under Win9x. Enable if the caps-lock key affects the top - row keys. (Alternate language keys are not + row keys. (Alternate language keys are not handled properly by this temporary fix. Default is disabled. */ -#define HB_GTI_KBDALT 12 /* This will get/set the status of the alt-numpad +#define HB_GTI_KBDALT 12 /* This will get/set the status of the Alt-NumPad key handling. Default is Enabled. */ #define HB_GTI_ISSCREENPOS 13 /* Is full screen cursor positioning supported by GT driver? */ @@ -79,7 +79,7 @@ #define HB_GTI_DESKTOPROWS 20 /* Get Size of desktop in character rows */ #define HB_GTI_DESKTOPCOLS 21 /* Get Size of desktop in character cols */ #define HB_GTI_FONTWEIGHT 22 /* Get/set the weight of the font used in application */ -#define HB_GTI_FONTQUALITY 23 /* Get/set quality of font rendering in the appl. */ +#define HB_GTI_FONTQUALITY 23 /* Get/set quality of font rendering in the application */ #define HB_GTI_FONTNAME 24 /* Set-only font name */ #define HB_GTI_CODEPAGE 25 /* codepage */ #define HB_GTI_WINTITLE 26 /* title */ @@ -94,11 +94,11 @@ #define HB_GTI_ESCDELAY 33 /* Get/Set escape key delay */ /* these 2 are used for MaxCol(?) and MaxRow(?) */ -#define HB_GTI_VIEWMAXHEIGHT 34 /* Maximum viewable height:for current mode */ -#define HB_GTI_VIEWMAXWIDTH 35 /* Maximum viewable width:either win or full scrn */ +#define HB_GTI_VIEWMAXHEIGHT 34 /* Maximum viewable height: for current mode */ +#define HB_GTI_VIEWMAXWIDTH 35 /* Maximum viewable width: either window or full screen */ -#define HB_GTI_VIEWPORTHEIGHT 36 /* Current viewport height:for current mode */ -#define HB_GTI_VIEWPORTWIDTH 37 /* Current viewport width:either win or full scrn */ +#define HB_GTI_VIEWPORTHEIGHT 36 /* Current viewport height: for current mode */ +#define HB_GTI_VIEWPORTWIDTH 37 /* Current viewport width: either window or full screen */ #define HB_GTI_STDOUTCON 38 /* redirect STDOUT to console */ #define HB_GTI_STDERRCON 39 /* redirect STDERR to console */ @@ -143,7 +143,7 @@ #define HB_GTI_MAXIMIZED 66 /* Get/Set Window's Maximized status (supported by: GTWVT) */ #define HB_GTI_FONTATTRIBUTE 67 /* Get/Set font attribute */ #define HB_GTI_UNITRANS 68 /* Set translation table for UNICODE characters */ -#define HB_GTI_WINHANDLE 69 /* Get console window low level handle */ +#define HB_GTI_WINHANDLE 69 /* Get console window low-level handle */ #define HB_GTI_MOUSEPOS_XY 70 /* Get mouse position in pixels */ #define HB_GTI_DISPIMAGE 71 /* Display image with given name */ #define HB_GTI_REDRAWMAX 72 /* Maximum number of unchanged neighboring chars in redrawn line */ @@ -196,7 +196,7 @@ #define HB_GTE_RESIZED 5 #endif -/* Harbour GT Reszing mode constants */ +/* Harbour GT resizing mode constants */ #define HB_GTI_RESIZEMODE_FONT 0 /* Default */ #define HB_GTI_RESIZEMODE_ROWS 1 diff --git a/include/hbgtreg.h b/include/hbgtreg.h index 0730fcf77c..fec4969195 100644 --- a/include/hbgtreg.h +++ b/include/hbgtreg.h @@ -1,5 +1,5 @@ /* - * code used to register GT driver + * Code used to register GT driver * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbhash.ch b/include/hbhash.ch index d1ad27eeda..a0bbc40a3b 100644 --- a/include/hbhash.ch +++ b/include/hbhash.ch @@ -51,7 +51,7 @@ #define HB_HAUTOADD_NEVER 0x00 #define HB_HAUTOADD_ACCESS 0x01 #define HB_HAUTOADD_ASSIGN 0x02 -#define HB_HAUTOADD_ALWAYS ( HB_HAUTOADD_ACCESS + HB_HAUTOADD_ASSIGN ) +#define HB_HAUTOADD_ALWAYS hb_bitOr( HB_HAUTOADD_ACCESS, HB_HAUTOADD_ASSIGN ) #define HB_HAUTOADD_REFERENCE HB_HAUTOADD_ALWAYS /* hb_HMerge() modes */ diff --git a/include/hbhash.h b/include/hbhash.h index dc8dfd1175..44dcf89d80 100644 --- a/include/hbhash.h +++ b/include/hbhash.h @@ -82,7 +82,7 @@ extern HB_EXPORT_INT PHB_HASH_TABLE hb_hashTableCreate( HB_SIZE nSize, PHB_HASH_FUNC pComp ); extern HB_EXPORT_INT void hb_hashTableKill( PHB_HASH_TABLE pTable ); /* release all items and the hash table */ extern HB_EXPORT_INT HB_BOOL hb_hashTableAdd( PHB_HASH_TABLE pTable, const void * pKey, const void * pValue ); /* add a new item into the table */ -extern HB_EXPORT_INT HB_BOOL hb_hashTableDel( PHB_HASH_TABLE pTable, const void * pKey ); /* delete an item from the table */ +extern HB_EXPORT_INT HB_BOOL hb_hashTableDel( PHB_HASH_TABLE pTable, const void * pKey ); /* delete an item from the table */ extern HB_EXPORT_INT const void * hb_hashTableFind( PHB_HASH_TABLE pTable, const void * pKey ); /* return the pointer to item's value or NULL if not found */ extern HB_EXPORT_INT PHB_HASH_TABLE hb_hashTableResize( PHB_HASH_TABLE pTable, HB_SIZE nNewSize ); /* resize the hash table */ extern HB_EXPORT_INT HB_SIZE hb_hashTableSize( PHB_HASH_TABLE pTable ); /* return the hash table size */ diff --git a/include/hbhrb.ch b/include/hbhrb.ch index c130687b3f..109a2db99d 100644 --- a/include/hbhrb.ch +++ b/include/hbhrb.ch @@ -1,5 +1,5 @@ /* - * Header file for dynmaic PCODE modules (HRB) options + * Header file for dynamic PCODE modules (HRB) options * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbiniseg.h b/include/hbiniseg.h index 36d629415f..db660a07ce 100644 --- a/include/hbiniseg.h +++ b/include/hbiniseg.h @@ -1,8 +1,7 @@ /* - * startup code using special data segments + * Startup code using special data segments * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> - * * This code uses MSC startup macros created by * Paul Tucker <ptucker /at/ sympatico.ca> * diff --git a/include/hbinit.h b/include/hbinit.h index 87cd8cdb97..ca7696277b 100644 --- a/include/hbinit.h +++ b/include/hbinit.h @@ -53,7 +53,7 @@ HB_EXTERN_BEGIN extern HB_EXPORT PHB_SYMB hb_vmProcessSymbols( PHB_SYMB pSymbols, HB_USHORT uiSymbols, const char * szModuleName, HB_ULONG ulID, HB_USHORT uiPcodeVer ); /* module symbols initialization with extended information */ -#define HB_INIT_SYMBOLS_END( func ) HB_INIT_SYMBOLS_EX_END( func, __FILE__, 0L, 0x0000 ) +#define HB_INIT_SYMBOLS_END( func ) HB_INIT_SYMBOLS_EX_END( func, "", 0L, 0x0000 ) /* By default in all C++ builds use static variable initialization as startup code with the exception for GCC which new versions show warning about @@ -163,7 +163,7 @@ extern HB_EXPORT PHB_SYMB hb_vmProcessSymbols( PHB_SYMB pSymbols, HB_USHORT uiSy defined( __GNUC__ ) || \ defined( __SUNPRO_C ) || defined( __SUNPRO_CC ) || \ defined( __DCC__ ) || \ - defined( __TINYC__ ) /* TOFIX: __TINYC__ */ || \ + defined( __TINYC__ ) /* FIXME: __TINYC__ */ || \ defined( __clang__ ) #if defined( HB_PRAGMA_STARTUP ) || defined( HB_DATASEG_STARTUP ) @@ -265,7 +265,7 @@ extern HB_EXPORT PHB_SYMB hb_vmProcessSymbols( PHB_SYMB pSymbols, HB_USHORT uiSy static HB_$INITSYM _s_init_func_##func = func; /* After each '*_END' symbol, additional 'hooks' are required - * See the C output of a generated prg for example + * See the C output of a generated .prg for example */ #elif defined( __WATCOMC__ ) diff --git a/include/hbiousr.ch b/include/hbiousr.ch index 2828a2535e..9f98a0988b 100644 --- a/include/hbiousr.ch +++ b/include/hbiousr.ch @@ -1,5 +1,5 @@ /* - * IOUSRD - module to create new FILE IO redirectors at prg level + * IOUSRD - module to create new FILE IO redirectors at .prg level * * Copyright 2014 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbmacro.ch b/include/hbmacro.ch index 3169f5a9e9..a487660966 100644 --- a/include/hbmacro.ch +++ b/include/hbmacro.ch @@ -52,7 +52,7 @@ /* runtime settings for macro compiler */ #define HB_SM_HARBOUR 1 /* extended Harbour features */ #define HB_SM_XBASE 2 /* extended Xbase++ compatibility */ -#define HB_SM_SHORTCUTS 8 /* enable/disable sortcuts for logical operators */ +#define HB_SM_SHORTCUTS 8 /* enable/disable shortcuts for logical operators */ #define HB_SM_ARRSTR 16 /* enable/disable strings as array of bytes */ #define HB_SM_EXTOPT 32 /* enable/disable operator optimizations */ #define HB_SM_RT_MACRO 64 /* disable automatic setup of macro flag */ diff --git a/include/hbmacro.h b/include/hbmacro.h index c0583e60f9..4c210efb25 100644 --- a/include/hbmacro.h +++ b/include/hbmacro.h @@ -47,8 +47,8 @@ #ifndef HB_MACRO_H_ #define HB_MACRO_H_ -#include "hbcompdf.h" #include "hbapi.h" +#include "hbcompdf.h" #include "hbapiitm.h" #include "hbapierr.h" #include "hbvm.h" @@ -64,7 +64,7 @@ HB_EXTERN_BEGIN #define HB_MACRO_GEN_POP 2 /* generate POP pcodes */ #define HB_MACRO_GEN_ALIASED 4 /* force aliased variable */ #define HB_MACRO_GEN_TYPE 8 /* check the type of expression (from Type() function) */ -#define HB_MACRO_GEN_PARE 16 /* generate parentesized list */ +#define HB_MACRO_GEN_PARE 16 /* generate parenthesized list */ #define HB_MACRO_GEN_LIST 32 /* generate push operation for every comma separated expressions */ #define HB_MACRO_GEN_REFER 64 /* generate PUSH pcodes for reference to given expression */ diff --git a/include/hbmath.ch b/include/hbmath.ch index d680e19a52..657391639c 100644 --- a/include/hbmath.ch +++ b/include/hbmath.ch @@ -1,5 +1,5 @@ /* - * Header file for MATHDEFERRMODE function + * Header file for hb_matherMode() function * * Copyright 2002 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany * Author: Martin Vogel <vogel@inttec.de> @@ -48,7 +48,7 @@ #ifndef HB_MATH_CH_ #define HB_MATH_CH_ -/* map the C math lib error definitions to harbour constants */ +/* map the C math lib error definitions to Harbour constants */ #define HB_MATH_ERR_UNKNOWN -1 #define HB_MATH_ERR_NONE 0 #define HB_MATH_ERR_DOMAIN 1 @@ -64,13 +64,13 @@ #define HB_MATH_ERRMODE_CDEFAULT 1 /* handle error by using the C RTL correction values */ #define HB_MATH_ERRMODE_USER 2 /* throw Harbour error, user MUST correct math error within Harbour error handling */ -#define HB_MATH_ERRMODE_USERDEFAULT 3 /* dito, but if user does not correct math error, default +#define HB_MATH_ERRMODE_USERDEFAULT 3 /* ditto, but if user does not correct math error, default error handling, i.e. by individual function applies */ #define HB_MATH_ERRMODE_USERCDEFAULT 4 /* as ERRMODE_USER, but if user does not correct math error, C RTL correction values are used */ /* array element indices in aInfo parameter passed to math errorblock */ -#define HB_MATHERRORBLOCK_RETVAL 1 -#define HB_MATHERRORBLOCK_HANDLED 2 +#define HB_MATHERRORBLOCK_RETVAL 1 +#define HB_MATHERRORBLOCK_HANDLED 2 #endif /* HB_MATH_CH */ diff --git a/include/hbmath.h b/include/hbmath.h index c9a1cf5384..7f31709a1e 100644 --- a/include/hbmath.h +++ b/include/hbmath.h @@ -54,7 +54,7 @@ #include <math.h> #endif -/* NOTE: Workaround for Pellec C 5.00 not having an 'inf' (HUGE_VAL) +/* NOTE: Workaround for Pelles C 5.00 not having an 'inf' (HUGE_VAL) in '-Tarm-coff' mode. [vszakats] */ #if defined( __POCC__ ) && defined( HB_OS_WIN_CE ) #undef HUGE_VAL diff --git a/include/hbmather.h b/include/hbmather.h index 8525367d51..5be4fe5bdd 100644 --- a/include/hbmather.h +++ b/include/hbmather.h @@ -54,7 +54,7 @@ HB_EXTERN_BEGIN #if defined( __WATCOMC__ ) #define HB_MATH_HANDLER - #if ( __WATCOMC__ > 1000 ) /* && defined( __cplusplus ) */ + #if __WATCOMC__ > 1000 /* && defined( __cplusplus ) */ #define exception _exception #endif #elif defined( __BORLANDC__ ) @@ -93,21 +93,21 @@ HB_EXTERN_BEGIN typedef struct _HB_MATH_EXCEPTION { - int type; - const char * funcname; - const char * error; - double arg1; - double arg2; - double retval; - int retvalwidth; - int retvaldec; - int handled; + int type; + const char * funcname; + const char * error; + double arg1; + double arg2; + double retval; + int retvalwidth; + int retvaldec; + int handled; } HB_MATH_EXCEPTION; typedef int ( * HB_MATH_HANDLERPROC )( HB_MATH_EXCEPTION * err ); extern HB_EXPORT void hb_mathResetError( HB_MATH_EXCEPTION * phb_exc ); -extern HB_EXPORT HB_BOOL hb_mathGetError( HB_MATH_EXCEPTION * phb_exc, const char *szFunc, double arg1, double arg2, double dResult ); +extern HB_EXPORT HB_BOOL hb_mathGetError( HB_MATH_EXCEPTION * phb_exc, const char * szFunc, double arg1, double arg2, double dResult ); extern HB_EXPORT int hb_mathSetErrMode( int imode ); extern HB_EXPORT int hb_mathGetErrMode( void ); diff --git a/include/hbmsgreg.h b/include/hbmsgreg.h index bbb34902ae..e03ca47349 100644 --- a/include/hbmsgreg.h +++ b/include/hbmsgreg.h @@ -1,5 +1,5 @@ /* - * code used to register new lang definition + * Code used to register new lang definition * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hboo.ch b/include/hboo.ch index 4e631d7338..6e23dc3459 100644 --- a/include/hboo.ch +++ b/include/hboo.ch @@ -2,6 +2,7 @@ * Header file for low-level object engine * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * Copyright 2000 JF Lefebvre <jfl@mafact.com> and RA Cuylen <rac@mafact.com> (Many enhancements (scopes, class methods)) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,25 +45,15 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 JF Lefebvre <jfl@mafact.com> and RA Cuylen <rac@mafact.com> - * Many enhancements (scopes, class methods) - * - * See COPYING.txt for licensing terms. - * - */ - /* NOTE: This file is also used by C code. */ #ifndef HB_OO_CH_ #define HB_OO_CH_ -/* Used by objfunc.prg (__objGetMsgList) and classes.c (hb___msgClsSel()) */ -#define HB_MSGLISTALL 0 -#define HB_MSGLISTCLASS 1 -#define HB_MSGLISTPURE 2 +/* Used by objfunc.prg (__objGetMsgList()) and classes.c (hb___msgClsSel()) */ +#define HB_MSGLISTALL 0 +#define HB_MSGLISTCLASS 1 +#define HB_MSGLISTPURE 2 /* Method or Data attribute (nScope)*/ #define HB_OO_CLSTP_EXPORTED 1 /* No comment, default */ diff --git a/include/hbpcode.h b/include/hbpcode.h index 1c85132ba4..d6ddb9ccf2 100644 --- a/include/hbpcode.h +++ b/include/hbpcode.h @@ -77,7 +77,7 @@ typedef enum HB_P_FUNCTIONSHORT, /* 12 instructs the virtual machine to execute a function saving its result */ HB_P_FRAME, /* 13 instructs the virtual machine about how many parameters and locals a function uses */ HB_P_FUNCPTR, /* 14 returns a function address pointer */ - HB_P_GREATER, /* 15 checks if the second latest value on the stack is greater that the lastest one */ + HB_P_GREATER, /* 15 checks if the second latest value on the stack is greater that the latest one */ HB_P_GREATEREQUAL, /* 16 checks if the second latest value on the stack is greater equal that the latest one, leaves the result only */ HB_P_DEC, /* 17 decrements the latest value on the virtual machine stack */ HB_P_DIVIDE, /* 18 divides the latest two values on the stack, removing them and leaving the result */ @@ -97,7 +97,7 @@ typedef enum HB_P_JUMPTRUE, /* 32 checks a logic expression of the stack and jumps to a relative offset */ HB_P_JUMPTRUEFAR, /* 33 checks a logic expression of the stack and jumps to a relative offset */ HB_P_LESSEQUAL, /* 34 checks if the second latest value on the stack is less equal that the latest one, leaves the result only */ - HB_P_LESS, /* 35 checks if the second latest value on the stack is less that the lastest one */ + HB_P_LESS, /* 35 checks if the second latest value on the stack is less that the latest one */ HB_P_LINE, /* 36 currently compiled source code line number */ HB_P_LOCALNAME, /* 37 sets the name of local variable */ HB_P_MACROPOP, /* 38 compile and run - pop a value from the stack */ @@ -135,7 +135,7 @@ typedef enum HB_P_NOT, /* 68 logically negates the latest value on the stack */ HB_P_NOTEQUAL, /* 69 checks if the latest two stack values are equal, leaves just the result */ HB_P_OR, /* 70 performs the logical OR of two latest stack values, removes them and places result */ - HB_P_PARAMETER, /* 71 creates PRIVATE variables and assigns values to functions paramaters */ + HB_P_PARAMETER, /* 71 creates PRIVATE variables and assigns values to functions parameters */ HB_P_PLUS, /* 72 adds the latest two values on the stack, removing them and leaving the result */ HB_P_POP, /* 73 removes the latest value from the stack */ HB_P_POPALIAS, /* 74 pops the item from the eval stack and selects the current workarea */ @@ -194,12 +194,12 @@ typedef enum HB_P_MACROPUSHREF, /* 127 Reference to macro variable @&mvar */ HB_P_PUSHLONGLONG, /* 128 places an integer number on the virtual machine stack */ HB_P_ENUMSTART, /* 129 Start of FOR EACH loop */ - HB_P_ENUMNEXT, /* 130 Next item of FOR EACH loop */ - HB_P_ENUMPREV, /* 131 Previous item of FOR EACH loop */ + HB_P_ENUMNEXT, /* 130 Next item of FOR EACH loop */ + HB_P_ENUMPREV, /* 131 Previous item of FOR EACH loop */ HB_P_ENUMEND, /* 132 End of FOR EACH loop */ HB_P_SWITCH, /* 133 SWITCH using long values */ HB_P_PUSHDATE, /* 134 places a data constant value on the virtual machine stack */ -/* optimalization of inlined math operations */ +/* optimization of inlined math operations */ HB_P_PLUSEQPOP, /* 135 adds a value to the variable reference */ HB_P_MINUSEQPOP, /* 136 subs a value from the variable reference */ HB_P_MULTEQPOP, /* 137 multiplies a variable reference by a value */ @@ -211,7 +211,7 @@ typedef enum HB_P_WITHOBJECTSTART, /* 143 start WITH OBJECT code */ HB_P_WITHOBJECTMESSAGE, /* 144 push message for WITH OBJECT */ HB_P_WITHOBJECTEND, /* 145 end WITH OBJECT code */ - HB_P_MACROSEND, /* 146 send operator with macrlist params */ + HB_P_MACROSEND, /* 146 send operator with macro list params */ HB_P_PUSHOVARREF, /* 147 pushes reference to object variable */ HB_P_ARRAYPUSHREF, /* 148 pushes reference to array element */ HB_P_VFRAME, /* 149 frame with variable number of parameters */ @@ -224,7 +224,7 @@ typedef enum HB_P_MODEQ, /* 156 calculates the modulus of var reference and a value, leave result on the stack */ HB_P_EXPEQ, /* 157 calculates the power of var reference and a value, leave result on the stack */ HB_P_DUPLUNREF, /* 158 places a copy of the latest virtual machine stack value on to the stack and unreference the source one */ - HB_P_MPUSHBLOCKLARGE, /* 159 code block generated by the macro compiler larger then 64kb */ + HB_P_MPUSHBLOCKLARGE, /* 159 code block generated by the macro compiler larger then 64 KiB */ HB_P_MPUSHSTRLARGE, /* 160 Macro compiled pushed string */ HB_P_PUSHBLOCKLARGE, /* 161 start of a codeblock definition */ HB_P_PUSHSTRLARGE, /* 162 places a string on the virtual machine stack */ diff --git a/include/hbpers.ch b/include/hbpers.ch index 429ca3c5f8..4b40e477cd 100644 --- a/include/hbpers.ch +++ b/include/hbpers.ch @@ -54,6 +54,6 @@ #xcommand ARRAY <obj> LEN <nLen> => <obj> := Array( <nLen> ) -#xcommand ENDARRAY => /* Just used to ease the read of the ascii file */ +#xcommand ENDARRAY => /* Just used to ease the read of the ASCII file */ #endif diff --git a/include/hbpp.h b/include/hbpp.h index d5c60a0d9f..1f25188747 100644 --- a/include/hbpp.h +++ b/include/hbpp.h @@ -62,9 +62,9 @@ HB_EXTERN_BEGIN #define HB_PP_STREAM_OFF 0 /* standard preprocessing */ #define HB_PP_STREAM_COMMENT 1 /* multiline comment */ #define HB_PP_STREAM_DUMP_C 2 /* pragma BEGINDUMP */ -#define HB_PP_STREAM_CLIPPER 3 /* clipper compatible TEXT/ENDTEXT */ +#define HB_PP_STREAM_CLIPPER 3 /* Cl*pper compatible TEXT/ENDTEXT */ #define HB_PP_STREAM_PRG 4 /* TEXT/ENDTEXT lines joined with LF */ -#define HB_PP_STREAM_C 5 /* TEXT/ENDTEXT lines joined and ESC seq processed */ +#define HB_PP_STREAM_C 5 /* TEXT/ENDTEXT lines joined and ESC sequences processed */ #define HB_PP_STREAM_INLINE_C 6 /* hb_inLIne() {...} data, should not be preprocessed */ #define HB_PP_STREAM_BINARY 7 /* __binarystreaminclude */ @@ -355,7 +355,7 @@ typedef HB_PP_MSG_FUNC_( ( * PHB_PP_MSG_FUNC ) ); HB_PP_TOKEN_ISEXPVAL( (t)->pNext->type ) ) ) #ifdef HB_CLP_STRICT -/* Clipper supports quoting by [] for 1-st token in the line so we +/* Clipper supports quoting by [] for 1st token in the line so we are not checking for HB_PP_TOKEN_NUL in this macro */ #define HB_PP_TOKEN_CANQUOTE(t) ( HB_PP_TOKEN_TYPE(t) != HB_PP_TOKEN_KEYWORD && \ HB_PP_TOKEN_TYPE(t) != HB_PP_TOKEN_MACROVAR && \ @@ -413,10 +413,10 @@ HB_PP_TOKEN, * PHB_PP_TOKEN; #define HB_PP_TRANSLATE 2 #define HB_PP_COMMAND 4 -/* comparision modes */ +/* comparison modes */ #define HB_PP_CMP_ADDR 0 /* compare token addresses */ #define HB_PP_CMP_STD 1 /* standard comparison, ignore the case of the characters */ -#define HB_PP_CMP_DBASE 2 /* dbase keyword comparison (accepts at least four character shortcuts) ignore the case of the characters */ +#define HB_PP_CMP_DBASE 2 /* dBase keyword comparison (accepts at least four character shortcuts) ignore the case of the characters */ #define HB_PP_CMP_CASE 3 /* case sensitive comparison */ #define HB_PP_CMP_MODE(t) ( (t) & 0xff ) @@ -495,8 +495,8 @@ HB_PP_MARKER, * PHB_PP_MARKER; typedef struct _HB_PP_RULE { struct _HB_PP_RULE * pPrev; /* previous rule */ - PHB_PP_TOKEN pMatch; /* match patern or NULL */ - PHB_PP_TOKEN pResult; /* result patern or NULL */ + PHB_PP_TOKEN pMatch; /* match pattern or NULL */ + PHB_PP_TOKEN pResult; /* result pattern or NULL */ HB_USHORT mode; /* comparison mode HB_PP_CMP_* */ HB_USHORT markers; /* number of markers in marker table */ /* filled when pattern matches for substitution, cleared after */ @@ -606,7 +606,7 @@ typedef struct HB_USHORT usLastType; /* last token type */ HB_BOOL fCanNextLine; /* ';' token found and we do not know yet if it's command separator or line concatenator */ HB_BOOL fDirective; /* # directives is parsed */ - HB_BOOL fNewStatement; /* set to HB_TRUE at line begining or after each ';' token */ + HB_BOOL fNewStatement; /* set to HB_TRUE at line beginning or after each ';' token */ PHB_PP_TOKEN pFuncOut; /* function used for each line in HB_PP_STREAM_* dumping */ PHB_PP_TOKEN pFuncEnd; /* end function for HB_PP_STREAM_* dumping */ PHB_MEM_BUFFER pStreamBuffer; /* buffer for stream output */ diff --git a/include/hbrddcdx.h b/include/hbrddcdx.h index 7d1f888dd9..393789aae0 100644 --- a/include/hbrddcdx.h +++ b/include/hbrddcdx.h @@ -140,9 +140,9 @@ HB_EXTERN_BEGIN #define CDX_TYPE_COMPOUND 0x40 /* FoxPro */ #define CDX_TYPE_STRUCTURE 0x80 /* FoxPro */ -#define CDX_CMP_EXACT 0x00 /* exact comparision */ -#define CDX_CMP_PREFIX 0x01 /* prefix comparision */ -#define CDX_CMP_DATE 0x02 /* date comparision */ +#define CDX_CMP_EXACT 0x00 /* exact comparison */ +#define CDX_CMP_PREFIX 0x01 /* prefix comparison */ +#define CDX_CMP_DATE 0x02 /* date comparison */ /* SIx3 order temperature flags: @@ -183,7 +183,7 @@ HB_EXTERN_BEGIN 0x20 - in index header: ADI file, in ADI tag header: ASCII 0x00 - in ADI tag header: UNICODE */ -/* CDX index node strucutres */ +/* CDX index node structures */ /* Compact Index Header Record */ typedef struct _CDXTAGHEADER { @@ -234,7 +234,7 @@ typedef struct _CDXEXTNODE HB_BYTE recBits; /* number of bits for record number */ HB_BYTE dupBits; /* number of bits for duplicate count */ HB_BYTE trlBits; /* number of bits for trailing count */ - HB_BYTE keyBytes; /* total number of bytes for recnn/dup/trail info */ + HB_BYTE keyBytes; /* total number of bytes for recno/dup/trail info */ } CDXEXTNODE; @@ -275,12 +275,12 @@ typedef struct _CDXPAGE HB_BOOL fChanged; HB_BOOL fBufChanged; - HB_SHORT bufKeyNum; /* do not change these vars' order */ - HB_SHORT bufKeyPos; /* they have to be just after the node */ - HB_SHORT bufKeyLen; /* and maybe temporary overwriten when adding */ - HB_SHORT iFree; /* new key to interior node record. */ + HB_SHORT bufKeyNum; /* do not change these vars' order */ + HB_SHORT bufKeyPos; /* they have to be just after the node */ + HB_SHORT bufKeyLen; /* and maybe temporary overwritten when adding */ + HB_SHORT iFree; /* new key to interior node record. */ - HB_BYTE * pKeyBuf; /* pointer to uncompressed leaf page key pool */ + HB_BYTE * pKeyBuf; /* pointer to uncompressed leaf page key pool */ struct _CDXPAGE * Owner; struct _CDXPAGE * Child; @@ -317,13 +317,13 @@ typedef struct _CDXTAG PHB_ITEM pForItem; /* item with a macro pcode for a tag for expression */ HB_USHORT uiType; /* a type of key expression value */ HB_USHORT uiLen; /* length of the key expression value */ - HB_USHORT nField; /* Field number for simple (one field) key expersion */ + HB_USHORT nField; /* Field number for simple (one field) key expression */ HB_BYTE bTrail; /* trailing character for shorter key value */ HB_BYTE OptFlags; /* index options flag */ HB_BOOL AscendKey; /* ascending/descending order flag */ HB_BOOL UniqueKey; /* unique order flag */ HB_BOOL Custom; /* custom order flag */ - HB_BOOL Template; /* user keyadata in ordKeyAdd()/ordKeyDel() accepted */ + HB_BOOL Template; /* user key data in ordKeyAdd()/ordKeyDel() accepted */ HB_BOOL MultiKey; /* repeated key values in custom indexes accepted */ HB_BOOL Partial; /* order is updated only partially - missing keys possible */ HB_BOOL ChgOnly; /* only existing key modifications are updated, no new key added */ @@ -392,8 +392,8 @@ typedef struct _CDXINDEX HB_BOOL RdLck; HB_BOOL WrLck; #endif - HB_BOOL fChanged; /* changes written to index, need upadte ulVersion */ - HB_BOOL fFlush; /* changes written to index, need upadte ulVersion */ + HB_BOOL fChanged; /* changes written to index, need to update ulVersion */ + HB_BOOL fFlush; /* changes written to index, need to update ulVersion */ HB_ULONG ulVersion; /* network version/update flag */ } CDXINDEX, * LPCDXINDEX; @@ -418,13 +418,13 @@ typedef struct HB_BOOL fReindex; /* HB_TRUE if reindexing is in process */ HB_ULONG ulMaxRec; /* the highest record number */ HB_ULONG ulTotKeys; /* total number of keys indexed */ - HB_ULONG ulKeys; /* keys in curently created page */ + HB_ULONG ulKeys; /* keys in currently created page */ HB_ULONG ulPages; /* number of pages */ HB_ULONG ulCurPage; /* current page */ HB_ULONG ulPgKeys; /* maximum number of key in page memory buffer */ HB_ULONG ulMaxKey; /* maximum number of keys in single page */ HB_BYTE * pKeyPool; /* memory buffer for current page then for pages */ - HB_BYTE * pStartKey; /* begining of key pool after sorting */ + HB_BYTE * pStartKey; /* beginning of key pool after sorting */ LPCDXSWAPPAGE pSwapPage; /* list of pages */ LPCDXPAGE NodeList[ CDX_STACKSIZE ]; /* Stack of pages */ HB_ULONG ulFirst; @@ -451,15 +451,15 @@ typedef struct _CDXAREA DBFAREA dbfarea; /* - * CDX's additions to the workarea structure - * - * Warning: The above section MUST match DBFAREA exactly! Any - * additions to the structure MUST be added below, as in this - * example. - */ + * CDX's additions to the workarea structure + * + * Warning: The above section MUST match DBFAREA exactly! Any + * additions to the structure MUST be added below, as in this + * example. + */ LPCDXSORTINFO pSort; /* Index build structure */ - LPCDXINDEX lpIndexes; /* Pointer to indexes array */ + LPCDXINDEX lpIndexes; /* Pointer to indexes array */ const HB_UCHAR * sortTab; /* Table with sorted characters */ HB_BOOL fCdxAppend; /* Appended record changed */ HB_BOOL fSortCDP; /* Use CDP functions for sorting */ diff --git a/include/hbrdddbf.h b/include/hbrdddbf.h index 48c31adcab..aa6e78dfa5 100644 --- a/include/hbrdddbf.h +++ b/include/hbrdddbf.h @@ -204,7 +204,7 @@ typedef struct _DBFAREA HB_USHORT uiNullCount; /* Number of null flags */ HB_BYTE bTableType; /* DBF type */ HB_BYTE bMemoType; /* MEMO type used in DBF memo fields */ - HB_BYTE bLockType; /* Type of locking shemes */ + HB_BYTE bLockType; /* Type of locking schemes */ HB_BYTE bCryptType; /* Type of used encryption */ HB_UINT uiSetHeader; /* DBF header updating modes DBI_SETHEADER */ DBFHEADER dbfHeader; /* DBF header buffer */ @@ -217,8 +217,8 @@ typedef struct _DBFAREA HB_BOOL fHasMemo; /* WorkArea with Memo fields */ HB_BOOL fHasTags; /* WorkArea with MDX or CDX index */ HB_BOOL fModStamp; /* WorkArea with modification autoupdate fields */ - HB_BOOL fDataFlush; /* data was written to DBF and not commited */ - HB_BOOL fMemoFlush; /* data was written to MEMO and not commited */ + HB_BOOL fDataFlush; /* data was written to DBF and not committed */ + HB_BOOL fMemoFlush; /* data was written to MEMO and not committed */ HB_BOOL fShared; /* Shared file */ HB_BOOL fReadonly; /* Read only file */ HB_BOOL fTemporary; /* Temporary file */ @@ -233,10 +233,10 @@ typedef struct _DBFAREA HB_BOOL fFLocked; /* HB_TRUE if file is locked */ HB_BOOL fHeaderLocked; /* HB_TRUE if DBF header is locked */ HB_BOOL fPackMemo; /* Pack memo file in pack operation */ - HB_BOOL fTransRec; /* HB_TRUE if records are transfered to this area, allow to change autoupdate fields and disable their initialization */ + HB_BOOL fTransRec; /* HB_TRUE if records are transferred to this area, allow to change autoupdate fields and disable their initialization */ HB_BOOL fTrigger; /* Execute trigger function */ LPDBOPENINFO lpdbOpenInfo; /* Pointer to current dbOpenInfo structure in OPEN/CREATE methods */ - LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */ + LPDBRELINFO lpdbPendingRel; /* Pointer to parent relation struct */ HB_ULONG * pLocksPos; /* List of records locked */ HB_ULONG ulNumLocksPos; /* Number of records locked */ char * pCryptKey; /* Pointer to encryption key */ diff --git a/include/hbrdddel.h b/include/hbrdddel.h index caf5458fc9..54d21b19dc 100644 --- a/include/hbrdddel.h +++ b/include/hbrdddel.h @@ -102,7 +102,7 @@ typedef struct _DELIMAREA HB_ULONG ulRecNo; /* Current record */ HB_ULONG ulRecCount; /* Number of records (in export) */ HB_BOOL fTransRec; /* Can put whole records */ - HB_BOOL fFlush; /* Data was written to table and not commited */ + HB_BOOL fFlush; /* Data was written to table and not committed */ HB_BOOL fShared; /* Shared file */ HB_BOOL fReadonly; /* Read only file */ HB_BOOL fPositioned; /* Positioned record */ diff --git a/include/hbrddfpt.h b/include/hbrddfpt.h index 7af74c6838..b92d339b48 100644 --- a/include/hbrddfpt.h +++ b/include/hbrddfpt.h @@ -94,8 +94,8 @@ HB_EXTERN_BEGIN #define FPTIT_DUMMY 0xDEADBEAF #define FPTIT_BINARY 0x0000 #define FPTIT_PICT 0x0000 /* Picture */ -#define FPTIT_TEXT 0x0001 /* Text */ -#define FPTIT_OBJ 0x0002 /* Object */ +#define FPTIT_TEXT 0x0001 /* Text */ +#define FPTIT_OBJ 0x0002 /* Object */ #define FPTIT_SIX_NIL 0x0000 /* NIL VALUE (USED ONLY IN ARRAYS) */ #define FPTIT_SIX_LNUM 0x0002 /* LONG LE */ @@ -109,29 +109,29 @@ HB_EXTERN_BEGIN /* #define FPTIT_SIX_VREF 0x2000 */ /* #define FPTIT_SIX_MREF 0x4000 */ -#define FPTIT_FLEX_GC 0x03E8 /* 1000 */ -#define FPTIT_FLEX_UNUSED 0x03E9 /* 1001 */ -#define FPTIT_FLEX_ARRAY 0x03EA /* 1002 */ +#define FPTIT_FLEX_GC 0x03E8 /* 1000 */ +#define FPTIT_FLEX_UNUSED 0x03E9 /* 1001 */ +#define FPTIT_FLEX_ARRAY 0x03EA /* 1002 */ #define FPTIT_FLEX_OBJECT 0x03EB /* 1003 ! */ #define FPTIT_FLEX_VOARR 0x03EC /* 1004 ! */ #define FPTIT_FLEX_VOOBJ 0x03ED /* 1005 ! */ -#define FPTIT_FLEX_NIL 0x03EE /* 1006 */ -#define FPTIT_FLEX_TRUE 0x03EF /* 1007 */ -#define FPTIT_FLEX_FALSE 0x03F0 /* 1008 */ -#define FPTIT_FLEX_LDATE 0x03F1 /* 1009 */ -#define FPTIT_FLEX_CHAR 0x03F2 /* 1010 */ -#define FPTIT_FLEX_UCHAR 0x03F3 /* 1011 */ -#define FPTIT_FLEX_SHORT 0x03F4 /* 1012 */ -#define FPTIT_FLEX_USHORT 0x03F5 /* 1013 */ -#define FPTIT_FLEX_LONG 0x03F6 /* 1014 */ -#define FPTIT_FLEX_ULONG 0x03F7 /* 1015 */ -#define FPTIT_FLEX_DOUBLE 0x03F8 /* 1016 */ +#define FPTIT_FLEX_NIL 0x03EE /* 1006 */ +#define FPTIT_FLEX_TRUE 0x03EF /* 1007 */ +#define FPTIT_FLEX_FALSE 0x03F0 /* 1008 */ +#define FPTIT_FLEX_LDATE 0x03F1 /* 1009 */ +#define FPTIT_FLEX_CHAR 0x03F2 /* 1010 */ +#define FPTIT_FLEX_UCHAR 0x03F3 /* 1011 */ +#define FPTIT_FLEX_SHORT 0x03F4 /* 1012 */ +#define FPTIT_FLEX_USHORT 0x03F5 /* 1013 */ +#define FPTIT_FLEX_LONG 0x03F6 /* 1014 */ +#define FPTIT_FLEX_ULONG 0x03F7 /* 1015 */ +#define FPTIT_FLEX_DOUBLE 0x03F8 /* 1016 */ #define FPTIT_FLEX_LDOUBLE 0x03F9 /* 1017 ! */ #define FPTIT_FLEX_COMPRCH 0x03FA /* 1018 ! */ /* Flex II types */ #define FPTIT_FLEX_DBLITEM 0x2710 /* 10000 14-bytes Clipper double item */ -#define FPTIT_FLEX_LOGICAL 0x2711 /* 10001 4-bytes logical value */ +#define FPTIT_FLEX_LOGICAL 0x2711 /* 10001 4-bytes logical value */ #define FPTIT_FLEX_NULSTR 0x2722 /* 10002 empty string */ @@ -176,7 +176,7 @@ typedef struct _FPTHEADER { HB_BYTE nextBlock[ 4 ]; /* Next free block in the file */ HB_BYTE blockSize[ 4 ]; /* Size of block */ - HB_BYTE signature1[ 10 ]; /* Signature: "SixMemo", "Harbour", "Made by CLIP"-overwrites next bytes*/ + HB_BYTE signature1[ 10 ]; /* Signature: "SixMemo", "Harbour", "Made by CLIP"-overwrites next bytes */ HB_BYTE nGCitems[ 2 ]; /* number of GC items in reserved2 (max 82)*/ HB_BYTE reserved2[ 492 ]; /* */ HB_BYTE signature2[ 12 ]; /* Signature: "FlexFile3\003" */ diff --git a/include/hbrddnsx.h b/include/hbrddnsx.h index b02e751ea9..aca0f64cbc 100644 --- a/include/hbrddnsx.h +++ b/include/hbrddnsx.h @@ -83,17 +83,17 @@ NSX description: during update operation if previous key value with valid record number cannot be located. Harbour RDD does not have such limit and can support 2^32-2 records = 4294967294. -7. Branch nodes have also field to mark record len (RecNoLen) but +7. Branch nodes have also field to mark record length (RecNoLen) but it seems to be unused (filled with 0 or 4) and record number is always stored in 4 bytes. -8. Maximum key len is set to 250 but in fact with 4 bytes record len - such keys cannot be supported without adding some hack because +8. Maximum key length is set to 250 but in fact with 4 bytes record + length such keys cannot be supported without adding some hack because RecNoLen[4] + Size[1] + DupCount[1] + 250 gives 256 and it cannot be stored in 1 byte (Size). We can add support for such long indexes but we have to define that Size=0 means Size=256. It can be done because Size=0 cannot appear in other way. I implemented it and Harbour works well with such indexes. -9. In root header is address of 1-st available free page in index file, +9. In root header is address of 1st available free page in index file, addresses of next pages are stored in the free pages at the same position as in root header (offset = 6) 10.Leaf nodes use for duplicate compression keys' values from upper @@ -136,10 +136,10 @@ NSX description: or: rddInfo( RDDI_MEMOTYPE, DB_MEMO_DBT, "DBFNSX" ) 16.Harbour NSX implementation in default format supports NSX files - upto 4GB. This is maximum keeping binary compatibility with SIX3 - NSX RDD. But Harbour can support files up to 4TB - it's a little + up to 4 GiB. This is maximum keeping binary compatibility with SIX3 + NSX RDD. But Harbour can support files up to 4 TiB - it's a little bit modified format with 'I' instead of 'i' in index header signature. - Such indexes are created when locking mode is set to 64bit. On open + Such indexes are created when locking mode is set to 64-bit. On open Harbour RDDs automatically recognize type of index files so it can use new format also with different locking schemes. SIX3 NSX cannot use new index. @@ -151,7 +151,7 @@ LEAF KEY COMPRESSION: a. store record number (RecNo) b. count duplicated characters c. if full key is duplicated then key size = n + 1 and goto @g - d. count trailng characters to the duplicate limit + d. count trailing characters to the duplicate limit e. if rest of key value (without dup and trail chars) is not empty then store it using RLE compression: - replace each repeated 3 or more characters with with FF xx yy @@ -220,9 +220,9 @@ HB_EXTERN_BEGIN #define NSX_TYPE_ANYNUM ( NSX_TYPE_LNUM | NSX_TYPE_DNUM ) #define NSX_TYPE_ANYEXP ( NSX_TYPE_ANYNUM | NSX_TYPE_CHAR | NSX_TYPE_LDATE | NSX_TYPE_TIMESTAMP | NSX_TYPE_LOG ) -#define NSX_CMP_EXACT 0x00 /* exact comparision */ -#define NSX_CMP_PREFIX 0x01 /* prefix comparision */ -#define NSX_CMP_DATE 0x02 /* date comparision */ +#define NSX_CMP_EXACT 0x00 /* exact comparison */ +#define NSX_CMP_PREFIX 0x01 /* prefix comparison */ +#define NSX_CMP_DATE 0x02 /* date comparison */ #define NSX_TAG_FULLUPDT 0x00 #define NSX_TAG_PARTIAL 0x01 @@ -281,7 +281,7 @@ typedef struct _NSXTAGHEADER HB_UCHAR KeyType[ 2 ]; /* index key type: NSX_TYPE_* */ HB_UCHAR KeySize[ 2 ]; /* index key size */ HB_UCHAR Unique[ 2 ]; /* 0x0001 for UNIQUE indexes */ - HB_UCHAR Descend[ 2 ]; /* 0x0001 for descond indexes */ + HB_UCHAR Descend[ 2 ]; /* 0x0001 for descend indexes */ HB_UCHAR KeyExpr[ NSX_MAXEXPLEN ]; /* index KEY expression ASCIIZ */ HB_UCHAR ForExpr[ NSX_MAXEXPLEN ]; /* index FOR expression ASCIIZ */ HB_UCHAR Unused[ NSX_PAGELEN - 14 - NSX_MAXEXPLEN - NSX_MAXEXPLEN ]; @@ -310,7 +310,7 @@ typedef struct _NSXLEAFPAGE HB_UCHAR NodeID[ 1 ]; /* NSX_LEAFPAGE | ( lRoot ? NSX_ROOTPAGE : 0 ) */ HB_UCHAR RecNoLen[ 1 ]; /* number of bytes for recno in leaf keys */ HB_UCHAR KeyCount[ 2 ]; /* number of key in page */ - HB_UCHAR UsedArea[ 2 ]; /* arrea used in page -> offset to free area */ + HB_UCHAR UsedArea[ 2 ]; /* area used in page -> offset to free area */ HB_UCHAR KeyData[ NSX_PAGELEN - NSX_LEAFKEYOFFSET ]; /* with branch keys */ } NSXLEAFPAGE; typedef NSXLEAFPAGE * LPNSXLEAFPAGE; @@ -320,20 +320,20 @@ typedef NSXLEAFPAGE * LPNSXLEAFPAGE; variable member sizes */ typedef struct _NSXBRANCHKEY { - HB_UCHAR Page[4]; /* page offset wih higher keys values */ - HB_UCHAR RecNo[n]; /* where n is RecNoLen */ - HB_UCHAR KeyData[l]; /* key value where l is KeySize */ + HB_UCHAR Page[ 4 ]; /* page offset with higher keys values */ + HB_UCHAR RecNo[ n ]; /* where n is RecNoLen */ + HB_UCHAR KeyData[ l ]; /* key value where l is KeySize */ } NSXBRANCHKEY; typedef NSXBRANCHKEY * LPNSXBRANCHKEY; typedef struct _NSXLEAFKEY { - HB_UCHAR RecNo[n]; /* where n is RecNoLen */ - HB_UCHAR Size[1]; /* key data size with this byte and n RecNo HB_BYTEs + HB_UCHAR RecNo[ n ]; /* where n is RecNoLen */ + HB_UCHAR Size[ 1 ]; /* key data size with this byte and n RecNo HB_BYTEs * if Size == n + 1 then key is fully duplicated */ - HB_UCHAR DupCount[1]; /* number of bytes from previous key */ - HB_UCHAR KeyData[m]; /* rest of key value with RLE compression: + HB_UCHAR DupCount[ 1 ]; /* number of bytes from previous key */ + HB_UCHAR KeyData[ m ]; /* rest of key value with RLE compression: * FF xx yy => Replicate(yy, xx) * FF 01 => FF * m = Size - n - 2 @@ -528,13 +528,13 @@ typedef struct HB_BOOL fReindex; /* HB_TRUE if reindexing is in process */ HB_ULONG ulMaxRec; /* the highest record number */ HB_ULONG ulTotKeys; /* total number of keys indexed */ - HB_ULONG ulKeys; /* keys in curently created page */ + HB_ULONG ulKeys; /* keys in currently created page */ HB_ULONG ulPages; /* number of pages */ HB_ULONG ulCurPage; /* current page */ HB_ULONG ulPgKeys; /* maximum number of key in page memory buffer */ HB_ULONG ulMaxKey; /* maximum number of keys in single page */ HB_UCHAR * pKeyPool; /* memory buffer for current page then for pages */ - HB_UCHAR * pStartKey; /* begining of key pool after sorting */ + HB_UCHAR * pStartKey; /* beginning of key pool after sorting */ LPNSXSWAPPAGE pSwapPage; /* list of pages */ LPPAGEINFO NodeList[ NSX_STACKSIZE ]; /* Stack of pages */ HB_ULONG ulFirst; diff --git a/include/hbrddntx.h b/include/hbrddntx.h index 01dae23193..7a8f57e913 100644 --- a/include/hbrddntx.h +++ b/include/hbrddntx.h @@ -77,11 +77,11 @@ HB_EXTERN_BEGIN #define CTX_MAX_TAGS 63 -#define NTX_MAX_KEY 256 /* Max len of key */ -#define NTX_MAX_EXP 256 /* Max len of KEY/FOR expression */ +#define NTX_MAX_KEY 256 /* Max length of key */ +#define NTX_MAX_EXP 256 /* Max length of KEY/FOR expression */ #define NTXBLOCKBITS 10 /* Size of NTX block in bits */ #define NTXBLOCKSIZE (1<<NTXBLOCKBITS) /* Size of block in NTX file */ -#define NTX_MAX_TAGNAME 10 /* Max len of tag name */ +#define NTX_MAX_TAGNAME 10 /* Max length of tag name */ #define NTX_HDR_UNUSED 473 /* the unused part of header */ #define NTX_PAGES_PER_TAG 8 #define NTX_STACKSIZE 32 /* Maximum page stack size */ @@ -92,32 +92,32 @@ HB_EXTERN_BEGIN typedef struct _NTXHEADER /* Header of NTX file */ { - HB_BYTE type[2]; - HB_BYTE version[2]; - HB_BYTE root[4]; - HB_BYTE next_page[4]; - HB_BYTE item_size[2]; - HB_BYTE key_size[2]; - HB_BYTE key_dec[2]; - HB_BYTE max_item[2]; - HB_BYTE half_page[2]; + HB_BYTE type[ 2 ]; + HB_BYTE version[ 2 ]; + HB_BYTE root[ 4 ]; + HB_BYTE next_page[ 4 ]; + HB_BYTE item_size[ 2 ]; + HB_BYTE key_size[ 2 ]; + HB_BYTE key_dec[ 2 ]; + HB_BYTE max_item[ 2 ]; + HB_BYTE half_page[ 2 ]; HB_BYTE key_expr[ NTX_MAX_EXP ]; - HB_BYTE unique[1]; - HB_BYTE unknown1[1]; - HB_BYTE descend[1]; - HB_BYTE unknown2[1]; + HB_BYTE unique[ 1 ]; + HB_BYTE unknown1[ 1 ]; + HB_BYTE descend[ 1 ]; + HB_BYTE unknown2[ 1 ]; HB_BYTE for_expr[ NTX_MAX_EXP ]; HB_BYTE tag_name[ NTX_MAX_TAGNAME + 2 ]; - HB_BYTE custom[1]; + HB_BYTE custom[ 1 ]; HB_BYTE unused[ NTX_HDR_UNUSED ]; } NTXHEADER; typedef NTXHEADER * LPNTXHEADER; typedef struct { - HB_BYTE type[2]; - HB_BYTE version[2]; - HB_BYTE root[4]; + HB_BYTE type[ 2 ]; + HB_BYTE version[ 2 ]; + HB_BYTE root[ 4 ]; } NTXHEADERUPDT; typedef struct _CTXTAGITEM /* TAG item in compound NTX (CTX) header */ @@ -308,13 +308,13 @@ typedef struct HB_BOOL fReindex; /* HB_TRUE if reindexing is in process */ HB_ULONG ulMaxRec; /* the highest record number */ HB_ULONG ulTotKeys; /* total number of keys indexed */ - HB_ULONG ulKeys; /* keys in curently created page */ + HB_ULONG ulKeys; /* keys in currently created page */ HB_ULONG ulPages; /* number of pages */ HB_ULONG ulCurPage; /* current page */ HB_ULONG ulPgKeys; /* maximum number of key in page memory buffer */ HB_ULONG ulMaxKey; /* maximum number of keys in single page */ HB_BYTE * pKeyPool; /* memory buffer for current page then for pages */ - HB_BYTE * pStartKey; /* begining of key pool after sorting */ + HB_BYTE * pStartKey; /* beginning of key pool after sorting */ LPNTXSWAPPAGE pSwapPage; /* list of pages */ LPPAGEINFO NodeList[ NTX_STACKSIZE ]; /* Stack of pages */ HB_ULONG ulFirst; diff --git a/include/hbrddsdf.h b/include/hbrddsdf.h index 2d48db7342..3965c8f8b4 100644 --- a/include/hbrddsdf.h +++ b/include/hbrddsdf.h @@ -88,7 +88,7 @@ typedef struct _SDFAREA HB_ULONG ulRecNo; /* Current record */ HB_ULONG ulRecCount; /* Number of records (in export) */ HB_BOOL fTransRec; /* Can put whole records */ - HB_BOOL fFlush; /* Data was written to SDF and not commited */ + HB_BOOL fFlush; /* Data was written to SDF and not committed */ HB_BOOL fShared; /* Shared file */ HB_BOOL fReadonly; /* Read only file */ HB_BOOL fPositioned; /* Positioned record */ diff --git a/include/hbregex.h b/include/hbregex.h index 6a31046c70..2237b7dcda 100644 --- a/include/hbregex.h +++ b/include/hbregex.h @@ -1,5 +1,5 @@ /* - * + * Regex header * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -83,16 +83,19 @@ typedef HB_REGEX * PHB_REGEX; #define HB_REGMATCH_SIZE( n ) ( ( n ) * 3 ) #define HB_REGMATCH_SO( p, n ) ( p )[ ( n ) * 2 ] #define HB_REGMATCH_EO( p, n ) ( p )[ ( n ) * 2 + 1 ] + #define HB_REGMATCH_UNSET ( -1 ) #elif defined( HB_POSIX_REGEX ) #define HB_REGMATCH regmatch_t #define HB_REGMATCH_SIZE( n ) ( n ) #define HB_REGMATCH_SO( p, n ) ( p )[ n ].rm_so #define HB_REGMATCH_EO( p, n ) ( p )[ n ].rm_eo + #define HB_REGMATCH_UNSET ( -1 ) #else #define HB_REGMATCH int #define HB_REGMATCH_SIZE( n ) ( ( n ) * 2 ) #define HB_REGMATCH_SO( p, n ) ( p )[ ( n ) * 2 ] #define HB_REGMATCH_EO( p, n ) ( p )[ ( n ) * 2 + 1 ] + #define HB_REGMATCH_UNSET ( -1 ) #endif typedef void ( * HB_REG_FREE )( PHB_REGEX ); @@ -103,10 +106,10 @@ extern void hb_regexInit( HB_REG_FREE pFree, HB_REG_COMP pComp, HB_REG_EXEC pExe extern HB_BOOL hb_regexIs( PHB_ITEM pItem ); #ifndef REG_EXTENDED -# define REG_EXTENDED 0x00 +#define REG_EXTENDED 0x00 #endif #ifndef REG_NOSUB -# define REG_NOSUB 0x00 +#define REG_NOSUB 0x00 #endif #else @@ -124,7 +127,7 @@ typedef void * PHB_REGEX; #define HBREG_DOTALL 0x40 #ifndef REGEX_MAX_GROUPS -# define REGEX_MAX_GROUPS 16 +#define REGEX_MAX_GROUPS 16 #endif HB_EXTERN_BEGIN diff --git a/include/hbserial.ch b/include/hbserial.ch index ebac7e1f81..86dd78928c 100644 --- a/include/hbserial.ch +++ b/include/hbserial.ch @@ -1,5 +1,5 @@ /* - * header file for item serialization flags + * Header file for item serialization flags * * Copyright 2013 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbsetup.h b/include/hbsetup.h index a5626d0a0b..f8e4602a2c 100644 --- a/include/hbsetup.h +++ b/include/hbsetup.h @@ -48,12 +48,12 @@ #ifndef HB_SETUP_H_ #define HB_SETUP_H_ -/* *********************************************************************** +/* * Include settings common for .prg and .c files */ #include "hbsetup.ch" -/* *********************************************************************** +/* * Define PCODE version number * HB_PCODE_VER_MIN define minimum supported PCODE by HVM */ @@ -61,25 +61,25 @@ #define HB_PCODE_VER 0x0003 #define HB_PCODE_VER_MIN 0x0002 -/* *********************************************************************** - * NOTE: You can select the default language modul used by Harbour, by - * defining this to a valid language modul identifier. +/* + * NOTE: You can select the default language module used by Harbour, by + * defining this to a valid language module identifier. */ #ifndef HB_LANG_DEFAULT #define HB_LANG_DEFAULT EN #endif -/* *********************************************************************** +/* * NOTE: You can select the default codepage used by Harbour, by - * defining this to a valid codepage modul identifier. + * defining this to a valid codepage module identifier. */ #ifndef HB_CODEPAGE_DEFAULT #define HB_CODEPAGE_DEFAULT EN #endif -/* *********************************************************************** +/* * Enable profiler support in HVM * By default this is turned off. Define HB_USE_PROFILER to turn it on. */ @@ -88,7 +88,7 @@ #define HB_NO_PROFILER #endif -/* *********************************************************************** +/* * This symbol defines if Harbour is compiled using C compiler * that support strict ANSI C only * @@ -96,7 +96,7 @@ * to call functions before the 'main' module is called. * This trick is used to automatically join all symbol tables defined * in run-time support modules and in user defined modules. - * If strict ANSI C compability is required then all symbol tables + * If strict ANSI C compatibility is required then all symbol tables * have to be joined manually by calling special function named * hb_vm_SymbolInit_<module_name> * (for example for myfirst.prg it will be: 'hb_vm_SymbolInit_MYFIRST' @@ -107,17 +107,17 @@ */ /* #define HB_STRICT_ANSI_C */ -/* *********************************************************************** +/* * Define this option if you want the /y YACC trace option to be available * in the Harbour compiler. * - * Note that if you turn this on, the compiler will slighly grow in size. + * Note that if you turn this on, the compiler will slightly grow in size. * * By default this is turned off. */ /* #define HB_YYDEBUG */ -/* *********************************************************************** +/* * Use native Windows memory allocation functions (HB_OS_WIN) * This option can disable compiler memory allocation optimization * so you should really have a good reason to enable it @@ -125,13 +125,13 @@ /* #define HB_FM_WIN_ALLOC */ -/* *********************************************************************** +/* * CPU detection */ /* Partially based on: - http://predef.sourceforge.net/prearch.html - http://poshlib.hookatooka.com/poshlib/trac.cgi/browser/posh.h + https://sourceforge.net/p/predef/wiki/ + http://guest:guest123@poshlib.hookatooka.com/poshlib/trac.cgi/browser/posh.h [vszakats] */ @@ -254,7 +254,7 @@ #endif -/* *********************************************************************** +/* * You can select here, what type of main entry will be used in the * application (main() or WinMain()). * @@ -282,10 +282,17 @@ Visual Studio 2010, version 10.0 1600 Visual Studio 2012, version 11.0 1700 Visual Studio 2013, version 12.0 1800 + Visual Studio 2015, version 14.0 1900 + Visual Studio 2017, version 14.1 1910 + + For newer versions, refer to this page: + https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering */ -/* *********************************************************************** +/* * Platform detection + * + * Ref: http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system */ #if defined( __WATCOMC__ ) @@ -393,7 +400,7 @@ #ifndef HB_OS_QNX #if defined( __QNX__ ) || defined( __QNXNTO__ ) #define HB_OS_QNX - #if defined( __QNXNTO__ ) /* TOFIX */ + #if defined( __QNXNTO__ ) /* FIXME */ #define HB_OS_QNX_BB10 #endif #endif @@ -462,7 +469,7 @@ #define HB_NO_FNMATCH #endif -/* *********************************************************************** +/* * Operating system specific definitions */ #if defined( HB_OS_UNIX ) @@ -496,7 +503,7 @@ #define HB_PATH_MAX 264 /* with trailing 0 byte */ -/* *********************************************************************** +/* * Here you can force the EOL string to be CRLF * * By default, the EOL string depends upon the detected platform. @@ -507,13 +514,13 @@ #define HB_OS_EOL_LEN 2 #endif -/* *********************************************************************** +/* * See also the following files for task specific definitions/settings * * hbmather.h - math errors handling */ -/* *********************************************************************** +/* * Extern "C" detection */ @@ -527,6 +534,22 @@ #define HB_EXTERN_END #endif +#if defined( __GNUC__ ) + #define HB_GCC_VER ( ( ( __GNUC__ - 0 ) * 100 ) + ( __GNUC_MINOR__ - 0 ) ) +# if HB_GCC_VER >= 406 + #define HB_GCC_HAS_DIAG +# else + #undef HB_GCC_HAS_DIAG +# endif +# if HB_GCC_VER >= 404 + #define HB_GCC_HAS_OPTIMIZE +# else + #undef HB_GCC_HAS_OPTIMIZE +# endif +#else + #define HB_GCC_VER 0 +#endif + #if defined( __GNUC__ ) && ( __GNUC__ - 0 >= 3 ) #define HB_DEPRECATED __attribute__ (( __deprecated__ )) diff --git a/include/hbsix.ch b/include/hbsix.ch index fca8339289..fb4664c67e 100644 --- a/include/hbsix.ch +++ b/include/hbsix.ch @@ -49,9 +49,7 @@ #include "hbsxdef.ch" -/* - * obsolete SIx Driver functions - */ +/* obsolete SIx Driver functions */ #xtranslate Sx_IndexFilter( [<nOrder>] ) => ordFor( [<nOrder>] ) #xtranslate Sx_TagName([<nOrder>]) => iif( Used(), ordName( [<nOrder>] ), "" ) #xtranslate Sx_SetTagOrder( [<xOrder>] [,<cBag>] ) => sx_SetTag( [<xOrder>] [,<cBag>] ) @@ -67,9 +65,7 @@ #xtranslate Sx_DirtyArea( [<param>] ) => sx_TurboArea( [<param>] ) -/* - * USE command with support for TRIGGER and PASSWORD clauses - */ +/* USE command with support for TRIGGER and PASSWORD clauses */ #command USE <(db)> [VIA <rdd>] [ALIAS <a>] [<nw: NEW>] ; [<ex: EXCLUSIVE>] [<sh: SHARED>] [<ro: READONLY>] ; [CODEPAGE <cp>] [INDEX <(index1)> [, <(indexN)>]] ; @@ -82,9 +78,7 @@ [; dbSetIndex( <(indexN)> )] -/* - * SORT command with USECURRENT clause - */ +/* SORT command with USECURRENT clause */ #command SORT [TO <(f)>] [ON <fields,...>] ; [FOR <for>] [WHILE <while>] [NEXT <next>] ; [RECORD <rec>] [<rest:REST>] [ALL] [VIA <rdd>] ; @@ -94,15 +88,11 @@ <{for}>, <{while}>, <next>, <rec>, <.rest.>, <rdd>,, <cp> ) -/* - * Seek using wildcards - */ +/* Seek using wildcards */ #xcommand WILDSEEK <str> => sx_WildSeek( <str> ) #xcommand WILDSEEKNEXT <str> => sx_WildSeek( <str>, .T. ) -/* - * order management commands - */ +/* order management commands */ #command CLEAR ORDER <order> => sx_ClearOrder( <order> ) #command SET TAGORDER TO <order> => ordSetFocus( <order> ) #command SET TAGORDER TO => ordSetFocus( 0 ) @@ -119,9 +109,7 @@ #command DELETE TAG ALL [OF <(bag)>] => sx_KillTag( .T., <(bag)> ) -/* - * order scope commands - */ +/* order scope commands */ #command CLEAR SCOPE => sx_ClrScope() #xcommand SET SCOPETOP TO <value> => sx_SetScope( 0, <value> ) #xcommand SET SCOPETOP TO => sx_ClrScope( 0 ) @@ -131,23 +119,17 @@ #command SET SCOPE TO <value> => sx_SetScope( 0, <value> ) ; ; sx_SetScope( 1, <value> ) -/* - * TURBO(DIRTY) READ commands - */ +/* TURBO(DIRTY) READ commands */ #command SET TURBOREAD ON => sx_SetTurbo( .T. ) #command SET TURBOREAD OFF => sx_SetTurbo( .F. ) -/* - * MEMO commands - */ +/* MEMO commands */ #command MEMOPACK [BLOCK <size>] [OPTION <opt> [STEP <step>]] => ; sx_MemoPack( <size>, <{opt}>, <step> ) #command SET MEMOBLOCK TO <value> => sx_SetMemoBlock( <value> ) -/* - * indexing - */ +/* indexing */ #command SUBINDEX ON <key> TO <(file)> ; [OPTION <eval> [STEP <every>]] ; [<filter: FILTERON>] ; diff --git a/include/hbsocket.ch b/include/hbsocket.ch index a6fc66f5c4..c492319d9b 100644 --- a/include/hbsocket.ch +++ b/include/hbsocket.ch @@ -1,5 +1,5 @@ /* - * socket related constant values + * Socket related constant values * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -197,11 +197,11 @@ #define HB_SOCKET_IFF_MULTICAST 0x0010 /* Supports multicast */ /* Harbour interface information indexes */ -#define HB_SOCKET_IFINFO_FAMILY 1 /* adress family */ +#define HB_SOCKET_IFINFO_FAMILY 1 /* address family */ #define HB_SOCKET_IFINFO_NAME 2 /* interface name */ #define HB_SOCKET_IFINFO_FLAGS 3 /* flags HB_SOCKET_IFF_* */ #define HB_SOCKET_IFINFO_ADDR 4 /* interface address */ -#define HB_SOCKET_IFINFO_NETMASK 5 /* subnetmask */ +#define HB_SOCKET_IFINFO_NETMASK 5 /* subnet mask */ #define HB_SOCKET_IFINFO_BROADCAST 6 /* broadcast address */ #define HB_SOCKET_IFINFO_P2PADDR 7 /* point-to-point address */ #define HB_SOCKET_IFINFO_HWADDR 8 /* hardware address */ diff --git a/include/hbsocket.h b/include/hbsocket.h index b9c8ed32df..b3aca15bbc 100644 --- a/include/hbsocket.h +++ b/include/hbsocket.h @@ -1,5 +1,5 @@ /* - * socket C API + * Socket C API * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbstack.h b/include/hbstack.h index f522c89be8..eba76643c4 100644 --- a/include/hbstack.h +++ b/include/hbstack.h @@ -44,7 +44,7 @@ * */ -/* TOFIX: There are several things in this file which are not part of the +/* FIXME: There are several things in this file which are not part of the standard Harbour API, in other words these things are not guaranteed to remain unchanged. To avoid confusion these should be moved to somewhere else (like hbrtl.h). [vszakats] */ @@ -154,7 +154,7 @@ typedef struct HB_ISIZ nWithObject; /* stack offset to base current WITH OBJECT item */ HB_ISIZ nRecoverBase; /* current SEQUENCE envelope offset or 0 if no SEQUENCE is active */ HB_USHORT uiActionRequest;/* request for some action - stop processing of opcodes */ - HB_USHORT uiQuitState; /* HVM is quiting */ + HB_USHORT uiQuitState; /* HVM is quitting */ HB_STACK_STATE state; /* first (default) stack state frame */ HB_STACKRDD rdd; /* RDD related data */ char szDate[ 9 ]; /* last returned date from hb_pards() YYYYMMDD format */ diff --git a/include/hbstdgen.ch b/include/hbstdgen.ch index 7987fa6eda..c3ec1e3ac6 100644 --- a/include/hbstdgen.ch +++ b/include/hbstdgen.ch @@ -1,5 +1,5 @@ /* - * + * Built-in PP rules * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbsxdef.ch b/include/hbsxdef.ch index fef6c74e75..7319e4de80 100644 --- a/include/hbsxdef.ch +++ b/include/hbsxdef.ch @@ -47,9 +47,7 @@ #ifndef HB_SIX_DEF_CH_ #define HB_SIX_DEF_CH_ -/* - * Event Constants for Trigger System - */ +/* Event Constants for Trigger System */ #define EVENT_PREUSE 1 #define EVENT_POSTUSE 2 #define EVENT_UPDATE 3 @@ -65,21 +63,15 @@ #define EVENT_PREMEMOPACK 13 #define EVENT_POSTMEMOPACK 14 -/* - * Trigger Toggle Values - */ +/* Trigger Toggle Values */ #define TRIGGER_ENABLE 1 #define TRIGGER_DISABLE 2 #define TRIGGER_REMOVE 3 #define TRIGGER_INSTALL 4 #define TRIGGER_PENDING 5 /* Internal Use Only */ - -/* - * sx_File2Blob() actions - */ +/* sx_File2Blob() actions */ #define BLOB_FILECOMPRESS 1 #define BLOB_FILEENCRYPT 2 - #endif /* HB_SIX_DEF_CH_ */ diff --git a/include/hbsxfunc.h b/include/hbsxfunc.h index f918a5989d..13e945b3ea 100644 --- a/include/hbsxfunc.h +++ b/include/hbsxfunc.h @@ -1,5 +1,5 @@ /* - * header file for SIX compatible functions + * Header file for SIX compatible functions * * Copyright 2005 Przemyslaw Czerpak <druzus@acn.waw.pl> * diff --git a/include/hbtask.h b/include/hbtask.h index 4d84432a9d..7599fe9ef9 100644 --- a/include/hbtask.h +++ b/include/hbtask.h @@ -1,6 +1,6 @@ /* - * platform independent task system. It's used when when OS does not - * support threads + * Platform independent task system. It's used when when OS does not + * support threads * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbthread.ch b/include/hbthread.ch index e0e5ef9197..88ace910a7 100644 --- a/include/hbthread.ch +++ b/include/hbthread.ch @@ -1,5 +1,5 @@ /* - * header file with MT mode constant values + * Header file with MT mode constant values * * Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbthread.h b/include/hbthread.h index 011ea96020..3b1e24f2ee 100644 --- a/include/hbthread.h +++ b/include/hbthread.h @@ -1,5 +1,5 @@ /* - * header file with MT mode functions + * Header file with MT mode functions * * Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -365,7 +365,7 @@ typedef HB_THREAD_STARTFUNC( PHB_THREAD_STARTFUNC ); extern HB_EXPORT void hb_threadReleaseCPU( void ); -/* atomic oprtations */ +/* atomic operations */ extern HB_EXPORT void hb_atomic_set( volatile HB_COUNTER * pCounter, HB_COUNTER value ); extern HB_EXPORT HB_COUNTER hb_atomic_get( volatile HB_COUNTER * pCounter ); extern HB_EXPORT void hb_atomic_inc( volatile HB_COUNTER * pCounter ); diff --git a/include/hbtrace.ch b/include/hbtrace.ch index 9326ebbd93..60518c4c30 100644 --- a/include/hbtrace.ch +++ b/include/hbtrace.ch @@ -48,9 +48,7 @@ #ifndef HB_TRACE_CH_ #define HB_TRACE_CH_ -/* - * Tracing levels. - */ +/* Tracing levels. */ #define HB_TR_ALWAYS 0 #define HB_TR_FATAL 1 #define HB_TR_ERROR 2 @@ -64,16 +62,12 @@ #define HB_TR_ALWAYS HB_TR_LAST #endif -/* - * Default tracing level. - */ +/* Default tracing level. */ #define HB_TR_DEFAULT HB_TR_WARNING -/* - * If we compiled without specifying a -DHB_TR_LEVEL, use the value +/* If we compiled without specifying a -DHB_TR_LEVEL, use the value * for HB_TR_DEFAULT. */ - #ifdef HB_TR_LEVEL_ALWAYS #define HB_TR_LEVEL HB_TR_ALWAYS #endif @@ -99,7 +93,7 @@ #xtranslate HB_TRACE_STEALTH( <l>, <x,...> ) => HB_TRACE( <l>, <x> ) #xtranslate HB_TRACE( <l>, ( <x,...> ) ) => HB_TRACE( <l>, <x> ) -#xtranslate HB_TRACE( <l>, <x,...> ) => ; +#xtranslate HB_TRACE( <l>, <x,...> ) => ; iif( HB_TR_LEVEL >= <l>, hb_traceLogAt( <l>, <x> ), ) #endif /* HB_TRACE_CH_ */ diff --git a/include/hbtrace.h b/include/hbtrace.h index bd3c8a4c18..903c90c260 100644 --- a/include/hbtrace.h +++ b/include/hbtrace.h @@ -153,7 +153,7 @@ HB_EXTERN_BEGIN #define HB_TRACE(l, x) HB_ECHO_TRACE_##l(x) /* NOTE: This will print tracing info without changing current - * filename/linenum information - this is usefull if we want to + * filename/linenum information - this is useful if we want to * trace the source of unreleased memory blocks */ #define HB_ECHO_STEALTH( l, x ) do \ diff --git a/include/hbusrrdd.ch b/include/hbusrrdd.ch index 3bcc7f0b7c..69a9c796d0 100644 --- a/include/hbusrrdd.ch +++ b/include/hbusrrdd.ch @@ -44,7 +44,6 @@ * */ - /* Movement and positioning methods */ #define UR_BOF 1 #define UR_EOF 2 @@ -158,7 +157,7 @@ #define UR_READDBHEADER 92 #define UR_WRITEDBHEADER 93 -/* non WorkArea functions */ +/* non WorkArea functions */ #define UR_INIT 94 #define UR_EXIT 95 #define UR_DROP 96 diff --git a/include/hbvm.h b/include/hbvm.h index 3d69689aaa..64941c55e3 100644 --- a/include/hbvm.h +++ b/include/hbvm.h @@ -77,7 +77,7 @@ extern HB_EXPORT PHB_SYMB hb_vmProcessDynLibSymbols( PHB_SYMB pSymbols, HB_USHOR { PHB_SYMB pModuleSymbols; /* pointer to module symbol table */ HB_USHORT uiModuleSymbols; /* number of symbols on that table */ - HB_USHORT uiStaticsOffset; /* ofset of statics base symbol */ + HB_USHORT uiStaticsOffset; /* offset of statics base symbol */ struct _HB_SYMBOLS * pNext; /* pointer to the next SYMBOLS structure */ HB_SYMBOLSCOPE hScope; /* scope collected from all symbols in module used to speed initialization code */ void * hDynLib; /* handler to dynamic library */ @@ -135,7 +135,7 @@ extern HB_EXPORT HB_BOOL hb_vmIsReady( void ); #define HB_BREAK_REQUESTED 2 /* break to nearest RECOVER/END sequence */ #define HB_ENDPROC_REQUESTED 4 /* immediately return from procedure (error handler in macro evaluation) */ #ifdef _HB_API_INTERNAL_ -#define HB_VMSTACK_REQUESTED 0x100 /* inetrnel flag to signal thread local stack */ +#define HB_VMSTACK_REQUESTED 0x100 /* internal flag to signal thread local stack */ #endif /* Public PCode functions */ diff --git a/include/hbvmpub.h b/include/hbvmpub.h index a7f84ff200..2463df486a 100644 --- a/include/hbvmpub.h +++ b/include/hbvmpub.h @@ -177,7 +177,7 @@ struct _HB_SYMB; typedef void HB_STACK; /* - * The first version reduce the number of modification in existing 3-rd + * The first version reduce the number of modification in existing 3rd * party code but in longer terms I'd prefer to disable it and left * only the second one where PHB_DYNS is mapped to void*. * This will allow us to fully redesign dynamic symbol internals diff --git a/include/hbwince.h b/include/hbwince.h index ff8a38e57a..baa17690d2 100644 --- a/include/hbwince.h +++ b/include/hbwince.h @@ -1,5 +1,5 @@ /* - * + * WinCE compatibility header * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/hbwinuni.h b/include/hbwinuni.h index e9a155aa2b..9ae753e78e 100644 --- a/include/hbwinuni.h +++ b/include/hbwinuni.h @@ -78,7 +78,7 @@ #define HB_STRNCAT( dst, src, len ) hb_wstrncat( dst, src, len ) #define HB_STRCMP( s1, s2 ) hb_wstrcmp( s1, s2 ) #define HB_STRNCMP( s1, s2, len ) hb_wstrncmp( s1, s2, len ) - #define HB_FSNAMECONV( fname, pfree ) ( ( LPCTSTR ) ( *(pfree) = hb_fsNameConvU16( fname ) ) ) + #define HB_FSNAMECONV( fname, pfree ) ( ( LPCTSTR ) ( *( pfree ) = hb_fsNameConvU16( fname ) ) ) #define HB_CHARDUP( str ) hb_osStrU16Encode( str ) #define HB_CHARDUPN( str, len ) hb_osStrU16EncodeN( str, len ) #define HB_OSSTRDUP( str ) hb_osStrU16Decode( str ) diff --git a/include/hbwmain.c b/include/hbwmain.c index 3cafe0b812..b054a87494 100644 --- a/include/hbwmain.c +++ b/include/hbwmain.c @@ -54,7 +54,7 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */ HINSTANCE hPrevInstance, /* handle to previous instance */ - HB_LPSTR lpCmdLine, /* pointer to command line */ + HB_LPSTR lpCmdLine, /* pointer to command-line */ int iCmdShow ) /* show state of window */ { int iErrorCode; diff --git a/include/hbxvm.h b/include/hbxvm.h index 7d18f55cd2..8b9539f7f2 100644 --- a/include/hbxvm.h +++ b/include/hbxvm.h @@ -86,7 +86,7 @@ extern HB_EXPORT HB_BOOL hb_xvmSwitchGet( PHB_ITEM * ); extern HB_EXPORT void hb_xvmSetLine( HB_USHORT uiLine ); /* set .prg line number information */ -extern HB_EXPORT void hb_xvmFrame( int iLocals, int iParams ); /* increases the stack pointer for the amount of locals and params suplied */ +extern HB_EXPORT void hb_xvmFrame( int iLocals, int iParams ); /* increases the stack pointer for the amount of locals and params supplied */ extern HB_EXPORT void hb_xvmVFrame( int iLocals, int iParams ); /* increases the stack pointer for the amount of locals and variable params */ extern HB_EXPORT void hb_xvmSFrame( PHB_SYMB pSymbol ); extern HB_EXPORT void hb_xvmStatics( PHB_SYMB pSymbol, HB_USHORT uiStatics ); @@ -110,8 +110,8 @@ extern HB_EXPORT void hb_xvmPushBlockLarge( const HB_BYTE * pCode, PHB_SYMB p extern HB_EXPORT void hb_xvmPushSelf( void ); extern HB_EXPORT void hb_xvmPushVParams( void ); extern HB_EXPORT void hb_xvmPushAParams( void ); -extern HB_EXPORT void hb_xvmPushLocal( HB_SHORT iLocal ); /* pushes the containts of a local onto the stack */ -extern HB_EXPORT void hb_xvmPushLocalByRef( HB_SHORT iLocal ); /* pushes a local by refrence onto the stack */ +extern HB_EXPORT void hb_xvmPushLocal( HB_SHORT iLocal ); /* pushes the content of a local onto the stack */ +extern HB_EXPORT void hb_xvmPushLocalByRef( HB_SHORT iLocal ); /* pushes a local by reference onto the stack */ extern HB_EXPORT void hb_xvmPopLocal( HB_SHORT iLocal ); /* pops the stack latest value onto a local */ extern HB_EXPORT HB_BOOL hb_xvmPushField( PHB_SYMB pSymbol ); extern HB_EXPORT HB_BOOL hb_xvmPopField( PHB_SYMB pSymbol ); @@ -131,7 +131,7 @@ extern HB_EXPORT HB_BOOL hb_xvmSwapAlias( void ); /* swaps item extern HB_EXPORT HB_BOOL hb_xvmLocalAddInt( int iLocal, HB_LONG lAdd ); /* add integer to given local variable */ extern HB_EXPORT HB_BOOL hb_xvmLocalInc( int iLocal ); /* increment given local variable */ extern HB_EXPORT HB_BOOL hb_xvmLocalDec( int iLocal ); /* decrement given local variable */ -extern HB_EXPORT HB_BOOL hb_xvmLocalIncPush( int iLocal ); /* increment given local variable and pussh it on HVM stack */ +extern HB_EXPORT HB_BOOL hb_xvmLocalIncPush( int iLocal ); /* increment given local variable and push it on HVM stack */ extern HB_EXPORT HB_BOOL hb_xvmAnd( void ); extern HB_EXPORT HB_BOOL hb_xvmOr( void ); @@ -154,7 +154,7 @@ extern HB_EXPORT HB_BOOL hb_xvmInstring( void ); /* check whet extern HB_EXPORT HB_BOOL hb_xvmPlus( void ); /* sums the latest two values on the stack, removes them and leaves the result */ extern HB_EXPORT HB_BOOL hb_xvmPlusEq( void ); extern HB_EXPORT HB_BOOL hb_xvmPlusEqPop( void ); -extern HB_EXPORT HB_BOOL hb_xvmMinus( void ); /* substracts the latest two values on the stack, removes them and leaves the result */ +extern HB_EXPORT HB_BOOL hb_xvmMinus( void ); /* subtracts the latest two values on the stack, removes them and leaves the result */ extern HB_EXPORT HB_BOOL hb_xvmMinusEq( void ); extern HB_EXPORT HB_BOOL hb_xvmMinusEqPop( void ); extern HB_EXPORT HB_BOOL hb_xvmMult( void ); /* multiplies the latest two values on the stack, removes them and leaves the result */ diff --git a/include/hbzlib.h b/include/hbzlib.h index f10cce1567..d775dae600 100644 --- a/include/hbzlib.h +++ b/include/hbzlib.h @@ -1,5 +1,5 @@ /* - * dynamic reference to ZLIB functions + * Dynamic reference to ZLIB functions * * Copyright 2013 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/include/inkey.ch b/include/inkey.ch index 445b8ad3aa..91207d59e2 100644 --- a/include/inkey.ch +++ b/include/inkey.ch @@ -62,7 +62,7 @@ #define INKEY_MMIDDLE 32 /* Harbour extension middle button mask */ #define INKEY_MWHEEL 64 /* Harbour extension mouse wheel mask */ #define INKEY_KEYBOARD 128 -#define INKEY_ALL 255 +#define INKEY_ALL ( INKEY_KEYBOARD + INKEY_MOVE + INKEY_LDOWN + INKEY_LUP + INKEY_RDOWN + INKEY_RUP + INKEY_MMIDDLE + INKEY_MWHEEL ) #define HB_INKEY_RAW 256 /* Harbour extension */ #define HB_INKEY_GTEVENT 1024 /* Harbour extension */ @@ -103,160 +103,160 @@ /* Cursor movement keys */ -#define K_UP 5 /* Up arrow, Ctrl-E */ -#define K_DOWN 24 /* Down arrow, Ctrl-X */ -#define K_LEFT 19 /* Left arrow, Ctrl-S */ -#define K_RIGHT 4 /* Right arrow, Ctrl-D */ -#define K_HOME 1 /* Home, Ctrl-A */ -#define K_END 6 /* End, Ctrl-F */ -#define K_PGUP 18 /* PgUp, Ctrl-R */ -#define K_PGDN 3 /* PgDn, Ctrl-C */ +#define K_UP 5 /* Up arrow, Ctrl-E */ +#define K_DOWN 24 /* Down arrow, Ctrl-X */ +#define K_LEFT 19 /* Left arrow, Ctrl-S */ +#define K_RIGHT 4 /* Right arrow, Ctrl-D */ +#define K_HOME 1 /* Home, Ctrl-A */ +#define K_END 6 /* End, Ctrl-F */ +#define K_PGUP 18 /* PgUp, Ctrl-R */ +#define K_PGDN 3 /* PgDn, Ctrl-C */ -#define K_CTRL_UP 397 /* * Ctrl-Up arrow */ -#define K_CTRL_DOWN 401 /* * Ctrl-Down arrow */ -#define K_CTRL_LEFT 26 /* Ctrl-Left arrow, Ctrl-Z */ -#define K_CTRL_RIGHT 2 /* Ctrl-Right arrow, Ctrl-B */ -#define K_CTRL_HOME 29 /* Ctrl-Home, Ctrl-] */ -#define K_CTRL_END 23 /* Ctrl-End, Ctrl-W */ -#define K_CTRL_PGUP 31 /* Ctrl-PgUp, Ctrl-Hyphen */ -#define K_CTRL_PGDN 30 /* Ctrl-PgDn, Ctrl-^ */ +#define K_CTRL_UP 397 /* * Ctrl-Up arrow */ +#define K_CTRL_DOWN 401 /* * Ctrl-Down arrow */ +#define K_CTRL_LEFT 26 /* Ctrl-Left arrow, Ctrl-Z */ +#define K_CTRL_RIGHT 2 /* Ctrl-Right arrow, Ctrl-B */ +#define K_CTRL_HOME 29 /* Ctrl-Home, Ctrl-] */ +#define K_CTRL_END 23 /* Ctrl-End, Ctrl-W */ +#define K_CTRL_PGUP 31 /* Ctrl-PgUp, Ctrl-Hyphen */ +#define K_CTRL_PGDN 30 /* Ctrl-PgDn, Ctrl-^ */ -#define K_ALT_UP 408 /* * Alt-Up arrow */ -#define K_ALT_DOWN 416 /* * Alt-Down arrow */ -#define K_ALT_LEFT 411 /* * Alt-Left arrow */ -#define K_ALT_RIGHT 413 /* * Alt-Right arrow */ -#define K_ALT_HOME 407 /* * Alt-Home */ -#define K_ALT_END 415 /* * Alt-End */ -#define K_ALT_PGUP 409 /* * Alt-PgUp */ -#define K_ALT_PGDN 417 /* * Alt-PgDn */ +#define K_ALT_UP 408 /* * Alt-Up arrow */ +#define K_ALT_DOWN 416 /* * Alt-Down arrow */ +#define K_ALT_LEFT 411 /* * Alt-Left arrow */ +#define K_ALT_RIGHT 413 /* * Alt-Right arrow */ +#define K_ALT_HOME 407 /* * Alt-Home */ +#define K_ALT_END 415 /* * Alt-End */ +#define K_ALT_PGUP 409 /* * Alt-PgUp */ +#define K_ALT_PGDN 417 /* * Alt-PgDn */ /* Misc. keys */ -#define K_ENTER 13 /* Enter, Ctrl-M */ -#define K_INTRO 13 /* */ -#define K_RETURN 13 /* Return, Ctrl-M */ -#define K_SPACE 32 /* Space bar */ -#define K_ESC 27 /* Esc, Ctrl-[ */ +#define K_ENTER 13 /* Enter, Ctrl-M */ +#define K_INTRO 13 /* */ +#define K_RETURN 13 /* Return, Ctrl-M */ +#define K_SPACE 32 /* Space bar */ +#define K_ESC 27 /* Esc, Ctrl-[ */ -#define K_CTRL_ENTER 10 /* Ctrl-Enter */ -#define K_CTRL_RETURN 10 /* Ctrl-Return */ -#define K_CTRL_RET 10 /* Ctrl-Return (Compatibility) */ -#define K_CTRL_PRTSCR 379 /* * Ctrl-Print Screen */ -#define K_CTRL_QUESTION 309 /* Ctrl-? */ +#define K_CTRL_ENTER 10 /* Ctrl-Enter */ +#define K_CTRL_RETURN 10 /* Ctrl-Return */ +#define K_CTRL_RET 10 /* Ctrl-Return (Compatibility) */ +#define K_CTRL_PRTSCR 379 /* * Ctrl-Print Screen */ +#define K_CTRL_QUESTION 309 /* Ctrl-? */ -#define K_ALT_ENTER 284 /* * Alt-Enter */ -#define K_ALT_RETURN 284 /* * Alt-Return */ -#define K_ALT_ESC 257 /* * Alt-Esc */ +#define K_ALT_ENTER 284 /* * Alt-Enter */ +#define K_ALT_RETURN 284 /* * Alt-Return */ +#define K_ALT_ESC 257 /* * Alt-Esc */ /* Keypad keys */ -#define KP_CENTER 332 /* * Keypad 5 */ +#define KP_CENTER 332 /* * Keypad 5 */ -#define KP_ALT_ENTER 422 /* * Keypad Alt-Enter */ +#define KP_ALT_ENTER 422 /* * Keypad Alt-Enter */ -#define KP_CTRL_5 399 /* * Keypad Ctrl-5 */ -#define KP_CTRL_SLASH 405 /* * Keypad Ctrl-/ */ -#define KP_CTRL_ASTERISK 406 /* * Keypad Ctrl-* */ -#define KP_CTRL_MINUS 398 /* * Keypad Ctrl-- */ -#define KP_CTRL_PLUS 400 /* * Keypad Ctrl-+ */ +#define KP_CTRL_5 399 /* * Keypad Ctrl-5 */ +#define KP_CTRL_SLASH 405 /* * Keypad Ctrl-/ */ +#define KP_CTRL_ASTERISK 406 /* * Keypad Ctrl-* */ +#define KP_CTRL_MINUS 398 /* * Keypad Ctrl-- */ +#define KP_CTRL_PLUS 400 /* * Keypad Ctrl-+ */ -#define KP_ALT_5 5 /* * Keypad Alt-5 */ -#define KP_ALT_SLASH 420 /* * Keypad Alt-/ */ -#define KP_ALT_ASTERISK 311 /* * Keypad Alt-* */ -#define KP_ALT_MINUS 330 /* * Keypad Alt-- */ -#define KP_ALT_PLUS 334 /* * Keypad Alt-+ */ +#define KP_ALT_5 5 /* * Keypad Alt-5 */ +#define KP_ALT_SLASH 420 /* * Keypad Alt-/ */ +#define KP_ALT_ASTERISK 311 /* * Keypad Alt-* */ +#define KP_ALT_MINUS 330 /* * Keypad Alt-- */ +#define KP_ALT_PLUS 334 /* * Keypad Alt-+ */ /* Editing keys */ -#define K_INS 22 /* Ins, Ctrl-V */ -#define K_DEL 7 /* Del, Ctrl-G */ -#define K_BS 8 /* Backspace, Ctrl-H */ -#define K_TAB 9 /* Tab, Ctrl-I */ -#define K_SH_TAB 271 /* Shift-Tab */ +#define K_INS 22 /* Ins, Ctrl-V */ +#define K_DEL 7 /* Del, Ctrl-G */ +#define K_BS 8 /* Backspace, Ctrl-H */ +#define K_TAB 9 /* Tab, Ctrl-I */ +#define K_SH_TAB 271 /* Shift-Tab */ -#define K_CTRL_INS 402 /* * Ctrl-Ins */ -#define K_CTRL_DEL 403 /* * Ctrl-Del */ -#define K_CTRL_BS 127 /* Ctrl-Backspace */ -#define K_CTRL_TAB 404 /* * Ctrl-Tab */ +#define K_CTRL_INS 402 /* * Ctrl-Ins */ +#define K_CTRL_DEL 403 /* * Ctrl-Del */ +#define K_CTRL_BS 127 /* Ctrl-Backspace */ +#define K_CTRL_TAB 404 /* * Ctrl-Tab */ -#define K_ALT_INS 418 /* * Alt-Ins */ -#define K_ALT_DEL 419 /* * Alt-Del */ -#define K_ALT_BS 270 /* * Alt-Backspace */ -#define K_ALT_TAB 421 /* * Alt-Tab */ +#define K_ALT_INS 418 /* * Alt-Ins */ +#define K_ALT_DEL 419 /* * Alt-Del */ +#define K_ALT_BS 270 /* * Alt-Backspace */ +#define K_ALT_TAB 421 /* * Alt-Tab */ -#define K_CTRL_SH_TAB 423 /* * Ctrl-Shift-Tab */ -#define K_SH_BS 423 /* * Shift-Backspace */ +#define K_CTRL_SH_TAB 423 /* * Ctrl-Shift-Tab */ +#define K_SH_BS 423 /* * Shift-Backspace */ /* Control keys */ -#define K_CTRL_A 1 /* Ctrl-A, Home */ -#define K_CTRL_B 2 /* Ctrl-B, Ctrl-Right arrow */ +#define K_CTRL_A 1 /* Ctrl-A, Home */ +#define K_CTRL_B 2 /* Ctrl-B, Ctrl-Right arrow */ #define K_CTRL_C 3 /* Ctrl-C, PgDn, Ctrl-ScrollLock */ -#define K_CTRL_D 4 /* Ctrl-D, Right arrow */ -#define K_CTRL_E 5 /* Ctrl-E, Up arrow */ -#define K_CTRL_F 6 /* Ctrl-F, End */ -#define K_CTRL_G 7 /* Ctrl-G, Del */ -#define K_CTRL_H 8 /* Ctrl-H, Backspace */ -#define K_CTRL_I 9 /* Ctrl-I, Tab */ -#define K_CTRL_J 10 /* Ctrl-J */ -#define K_CTRL_K 11 /* Ctrl-K */ -#define K_CTRL_L 12 /* Ctrl-L */ -#define K_CTRL_M 13 /* Ctrl-M, Return */ -#define K_CTRL_N 14 /* Ctrl-N */ -#define K_CTRL_O 15 /* Ctrl-O */ -#define K_CTRL_P 16 /* Ctrl-P */ -#define K_CTRL_Q 17 /* Ctrl-Q */ -#define K_CTRL_R 18 /* Ctrl-R, PgUp */ -#define K_CTRL_S 19 /* Ctrl-S, Left arrow */ -#define K_CTRL_T 20 /* Ctrl-T */ -#define K_CTRL_U 21 /* Ctrl-U */ -#define K_CTRL_V 22 /* Ctrl-V, Ins */ -#define K_CTRL_W 23 /* Ctrl-W, Ctrl-End */ -#define K_CTRL_X 24 /* Ctrl-X, Down arrow */ -#define K_CTRL_Y 25 /* Ctrl-Y */ -#define K_CTRL_Z 26 /* Ctrl-Z, Ctrl-Left arrow */ +#define K_CTRL_D 4 /* Ctrl-D, Right arrow */ +#define K_CTRL_E 5 /* Ctrl-E, Up arrow */ +#define K_CTRL_F 6 /* Ctrl-F, End */ +#define K_CTRL_G 7 /* Ctrl-G, Del */ +#define K_CTRL_H 8 /* Ctrl-H, Backspace */ +#define K_CTRL_I 9 /* Ctrl-I, Tab */ +#define K_CTRL_J 10 /* Ctrl-J */ +#define K_CTRL_K 11 /* Ctrl-K */ +#define K_CTRL_L 12 /* Ctrl-L */ +#define K_CTRL_M 13 /* Ctrl-M, Return */ +#define K_CTRL_N 14 /* Ctrl-N */ +#define K_CTRL_O 15 /* Ctrl-O */ +#define K_CTRL_P 16 /* Ctrl-P */ +#define K_CTRL_Q 17 /* Ctrl-Q */ +#define K_CTRL_R 18 /* Ctrl-R, PgUp */ +#define K_CTRL_S 19 /* Ctrl-S, Left arrow */ +#define K_CTRL_T 20 /* Ctrl-T */ +#define K_CTRL_U 21 /* Ctrl-U */ +#define K_CTRL_V 22 /* Ctrl-V, Ins */ +#define K_CTRL_W 23 /* Ctrl-W, Ctrl-End */ +#define K_CTRL_X 24 /* Ctrl-X, Down arrow */ +#define K_CTRL_Y 25 /* Ctrl-Y */ +#define K_CTRL_Z 26 /* Ctrl-Z, Ctrl-Left arrow */ /* Alt keys */ -#define K_ALT_A 286 /* Alt-A */ -#define K_ALT_B 304 /* Alt-B */ -#define K_ALT_C 302 /* Alt-C */ -#define K_ALT_D 288 /* Alt-D */ -#define K_ALT_E 274 /* Alt-E */ -#define K_ALT_F 289 /* Alt-F */ -#define K_ALT_G 290 /* Alt-G */ -#define K_ALT_H 291 /* Alt-H */ -#define K_ALT_I 279 /* Alt-I */ -#define K_ALT_J 292 /* Alt-J */ -#define K_ALT_K 293 /* Alt-K */ -#define K_ALT_L 294 /* Alt-L */ -#define K_ALT_M 306 /* Alt-M */ -#define K_ALT_N 305 /* Alt-N */ -#define K_ALT_O 280 /* Alt-O */ -#define K_ALT_P 281 /* Alt-P */ -#define K_ALT_Q 272 /* Alt-Q */ -#define K_ALT_R 275 /* Alt-R */ -#define K_ALT_S 287 /* Alt-S */ -#define K_ALT_T 276 /* Alt-T */ -#define K_ALT_U 278 /* Alt-U */ -#define K_ALT_V 303 /* Alt-V */ -#define K_ALT_W 273 /* Alt-W */ -#define K_ALT_X 301 /* Alt-X */ -#define K_ALT_Y 277 /* Alt-Y */ -#define K_ALT_Z 300 /* Alt-Z */ -#define K_ALT_BACKQUOTE 297 /* Alt-` */ -#define K_ALT_1 376 /* Alt-1 */ -#define K_ALT_2 377 /* Alt-2 */ -#define K_ALT_3 378 /* Alt-3 */ -#define K_ALT_4 379 /* Alt-4 */ -#define K_ALT_5 380 /* Alt-5 */ -#define K_ALT_6 381 /* Alt-6 */ -#define K_ALT_7 382 /* Alt-7 */ -#define K_ALT_8 383 /* Alt-8 */ -#define K_ALT_9 384 /* Alt-9 */ -#define K_ALT_0 385 /* Alt-0 */ +#define K_ALT_A 286 /* Alt-A */ +#define K_ALT_B 304 /* Alt-B */ +#define K_ALT_C 302 /* Alt-C */ +#define K_ALT_D 288 /* Alt-D */ +#define K_ALT_E 274 /* Alt-E */ +#define K_ALT_F 289 /* Alt-F */ +#define K_ALT_G 290 /* Alt-G */ +#define K_ALT_H 291 /* Alt-H */ +#define K_ALT_I 279 /* Alt-I */ +#define K_ALT_J 292 /* Alt-J */ +#define K_ALT_K 293 /* Alt-K */ +#define K_ALT_L 294 /* Alt-L */ +#define K_ALT_M 306 /* Alt-M */ +#define K_ALT_N 305 /* Alt-N */ +#define K_ALT_O 280 /* Alt-O */ +#define K_ALT_P 281 /* Alt-P */ +#define K_ALT_Q 272 /* Alt-Q */ +#define K_ALT_R 275 /* Alt-R */ +#define K_ALT_S 287 /* Alt-S */ +#define K_ALT_T 276 /* Alt-T */ +#define K_ALT_U 278 /* Alt-U */ +#define K_ALT_V 303 /* Alt-V */ +#define K_ALT_W 273 /* Alt-W */ +#define K_ALT_X 301 /* Alt-X */ +#define K_ALT_Y 277 /* Alt-Y */ +#define K_ALT_Z 300 /* Alt-Z */ +#define K_ALT_BACKQUOTE 297 /* Alt-` */ +#define K_ALT_1 376 /* Alt-1 */ +#define K_ALT_2 377 /* Alt-2 */ +#define K_ALT_3 378 /* Alt-3 */ +#define K_ALT_4 379 /* Alt-4 */ +#define K_ALT_5 380 /* Alt-5 */ +#define K_ALT_6 381 /* Alt-6 */ +#define K_ALT_7 382 /* Alt-7 */ +#define K_ALT_8 383 /* Alt-8 */ +#define K_ALT_9 384 /* Alt-9 */ +#define K_ALT_0 385 /* Alt-0 */ #define K_ALT_MINUS 386 -#define K_ALT_EQUALS 387 /* * Alt-Equals */ +#define K_ALT_EQUALS 387 /* * Alt-Equals */ #define K_ALT_OSB 282 #define K_ALT_CSB 283 #define K_ALT_BACKSLASH 299 @@ -264,68 +264,67 @@ #define K_ALT_QUOTE 296 #define K_ALT_COMMA 307 #define K_ALT_PERIOD 308 -#define K_ALT_SLASH 309 /* Alt-Slash (fyi Ctrl-? doesn't - work - maybe just under xp?) */ +#define K_ALT_SLASH 309 /* Alt-Slash (FYI: Ctrl-? doesn't work - maybe just under Windows XP?) */ /* Function keys */ -#define K_F1 28 /* F1, Ctrl-Backslash */ -#define K_F2 -1 /* F2 */ -#define K_F3 -2 /* F3 */ -#define K_F4 -3 /* F4 */ -#define K_F5 -4 /* F5 */ -#define K_F6 -5 /* F6 */ -#define K_F7 -6 /* F7 */ -#define K_F8 -7 /* F8 */ -#define K_F9 -8 /* F9 */ -#define K_F10 -9 /* F10 */ -#define K_F11 -40 /* * F11 */ -#define K_F12 -41 /* * F12 */ +#define K_F1 28 /* F1, Ctrl-Backslash */ +#define K_F2 -1 /* F2 */ +#define K_F3 -2 /* F3 */ +#define K_F4 -3 /* F4 */ +#define K_F5 -4 /* F5 */ +#define K_F6 -5 /* F6 */ +#define K_F7 -6 /* F7 */ +#define K_F8 -7 /* F8 */ +#define K_F9 -8 /* F9 */ +#define K_F10 -9 /* F10 */ +#define K_F11 -40 /* * F11 */ +#define K_F12 -41 /* * F12 */ /* Control-function keys */ -#define K_CTRL_F1 -20 /* Ctrl-F1 */ -#define K_CTRL_F2 -21 /* Ctrl-F2 */ -#define K_CTRL_F3 -22 /* Ctrl-F4 */ -#define K_CTRL_F4 -23 /* Ctrl-F3 */ -#define K_CTRL_F5 -24 /* Ctrl-F5 */ -#define K_CTRL_F6 -25 /* Ctrl-F6 */ -#define K_CTRL_F7 -26 /* Ctrl-F7 */ -#define K_CTRL_F8 -27 /* Ctrl-F8 */ -#define K_CTRL_F9 -28 /* Ctrl-F9 */ -#define K_CTRL_F10 -29 /* Ctrl-F10 */ -#define K_CTRL_F11 -44 /* * Ctrl-F11 */ -#define K_CTRL_F12 -45 /* * Ctrl-F12 */ +#define K_CTRL_F1 -20 /* Ctrl-F1 */ +#define K_CTRL_F2 -21 /* Ctrl-F2 */ +#define K_CTRL_F3 -22 /* Ctrl-F4 */ +#define K_CTRL_F4 -23 /* Ctrl-F3 */ +#define K_CTRL_F5 -24 /* Ctrl-F5 */ +#define K_CTRL_F6 -25 /* Ctrl-F6 */ +#define K_CTRL_F7 -26 /* Ctrl-F7 */ +#define K_CTRL_F8 -27 /* Ctrl-F8 */ +#define K_CTRL_F9 -28 /* Ctrl-F9 */ +#define K_CTRL_F10 -29 /* Ctrl-F10 */ +#define K_CTRL_F11 -44 /* * Ctrl-F11 */ +#define K_CTRL_F12 -45 /* * Ctrl-F12 */ /* Alt-function keys */ -#define K_ALT_F1 -30 /* Alt-F1 */ -#define K_ALT_F2 -31 /* Alt-F2 */ -#define K_ALT_F3 -32 /* Alt-F3 */ -#define K_ALT_F4 -33 /* Alt-F4 */ -#define K_ALT_F5 -34 /* Alt-F5 */ -#define K_ALT_F6 -35 /* Alt-F6 */ -#define K_ALT_F7 -36 /* Alt-F7 */ -#define K_ALT_F8 -37 /* Alt-F8 */ -#define K_ALT_F9 -38 /* Alt-F9 */ -#define K_ALT_F10 -39 /* Alt-F10 */ -#define K_ALT_F11 -46 /* * Alt-F11 */ -#define K_ALT_F12 -47 /* * Alt-F12 */ +#define K_ALT_F1 -30 /* Alt-F1 */ +#define K_ALT_F2 -31 /* Alt-F2 */ +#define K_ALT_F3 -32 /* Alt-F3 */ +#define K_ALT_F4 -33 /* Alt-F4 */ +#define K_ALT_F5 -34 /* Alt-F5 */ +#define K_ALT_F6 -35 /* Alt-F6 */ +#define K_ALT_F7 -36 /* Alt-F7 */ +#define K_ALT_F8 -37 /* Alt-F8 */ +#define K_ALT_F9 -38 /* Alt-F9 */ +#define K_ALT_F10 -39 /* Alt-F10 */ +#define K_ALT_F11 -46 /* * Alt-F11 */ +#define K_ALT_F12 -47 /* * Alt-F12 */ /* Shift-function keys */ -#define K_SH_F1 -10 /* Shift-F1 */ -#define K_SH_F2 -11 /* Shift-F2 */ -#define K_SH_F3 -12 /* Shift-F3 */ -#define K_SH_F4 -13 /* Shift-F4 */ -#define K_SH_F5 -14 /* Shift-F5 */ -#define K_SH_F6 -15 /* Shift-F6 */ -#define K_SH_F7 -16 /* Shift-F7 */ -#define K_SH_F8 -17 /* Shift-F8 */ -#define K_SH_F9 -18 /* Shift-F9 */ -#define K_SH_F10 -19 /* Shift-F10 */ -#define K_SH_F11 -42 /* * Shift-F11 */ -#define K_SH_F12 -43 /* * Shift-F12 */ +#define K_SH_F1 -10 /* Shift-F1 */ +#define K_SH_F2 -11 /* Shift-F2 */ +#define K_SH_F3 -12 /* Shift-F3 */ +#define K_SH_F4 -13 /* Shift-F4 */ +#define K_SH_F5 -14 /* Shift-F5 */ +#define K_SH_F6 -15 /* Shift-F6 */ +#define K_SH_F7 -16 /* Shift-F7 */ +#define K_SH_F8 -17 /* Shift-F8 */ +#define K_SH_F9 -18 /* Shift-F9 */ +#define K_SH_F10 -19 /* Shift-F10 */ +#define K_SH_F11 -42 /* * Shift-F11 */ +#define K_SH_F12 -43 /* * Shift-F12 */ /* key flags used by extended key codes */ diff --git a/include/memoedit.ch b/include/memoedit.ch index 31ca51ec8e..bb496f88bf 100644 --- a/include/memoedit.ch +++ b/include/memoedit.ch @@ -48,26 +48,26 @@ #define _MEMOEDIT_CH /* User callback status modes */ -#define ME_IDLE 0 /* Idle, all keys processed */ -#define ME_UNKEY 1 /* Unknown key, memo unaltered */ -#define ME_UNKEYX 2 /* Unknown key, memo altered */ -#define ME_INIT 3 /* Initialization mode */ +#define ME_IDLE 0 /* Idle, all keys processed */ +#define ME_UNKEY 1 /* Unknown key, memo unaltered */ +#define ME_UNKEYX 2 /* Unknown key, memo altered */ +#define ME_INIT 3 /* Initialization mode */ #ifndef HB_CLP_STRICT -#define ME_REQUEST 4 /* Memoedit requests an input from */ - /* the user function, e.g. after */ - /* ME_PASTE */ /* Xbase++ extension */ +#define ME_REQUEST 4 /* MemoEdit() requests an input from */ + /* the user function, e.g. after */ + /* ME_PASTE */ /* Xbase++ extension */ #endif /* User callback return codes */ -#define ME_DEFAULT 0 /* Perform default action */ -#define ME_IGNORE 32 /* Ignore unknown key */ -#define ME_DATA 33 /* Treat unknown key as data */ -#define ME_TOGGLEWRAP 34 /* Toggle word-wrap mode */ -#define ME_TOGGLESCROLL 35 /* Toggle scrolling mode */ -#define ME_WORDRIGHT 100 /* Perform word-right operation */ -#define ME_BOTTOMRIGHT 101 /* Perform bottom-right operation */ +#define ME_DEFAULT 0 /* Perform default action */ +#define ME_IGNORE 32 /* Ignore unknown key */ +#define ME_DATA 33 /* Treat unknown key as data */ +#define ME_TOGGLEWRAP 34 /* Toggle word-wrap mode */ +#define ME_TOGGLESCROLL 35 /* Toggle scrolling mode */ +#define ME_WORDRIGHT 100 /* Perform word-right operation */ +#define ME_BOTTOMRIGHT 101 /* Perform bottom-right operation */ #ifndef HB_CLP_STRICT -#define ME_PASTE 110 /* Paste string into buffer */ /* Xbase++ extension */ +#define ME_PASTE 110 /* Paste string into buffer */ /* Xbase++ extension */ #endif /* NOTE: Return codes 1-31 cause MemoEdit() to perform the */ diff --git a/include/ord.ch b/include/ord.ch index a8e98e64fd..7021733eef 100644 --- a/include/ord.ch +++ b/include/ord.ch @@ -71,21 +71,21 @@ /* - * This pseudofunction is only document in CL5.3 NG but not implemented + * This pseudo-function is only document in CL5.3 NG but not implemented * in Cl*pper */ #ifdef HB_COMPAT_C53 -#xtranslate ORDCOND( [FOR <for>] ; - [<all:ALL>] [WHILE <while>] ; - [EVAL <eval>] [EVERY <every>] ; - [RECORD <rec>] [NEXT <next>] ; - [<rest:REST>] [<descend: DESCENDING>] ) ; - => ordCondSet( <"for">, <{for}>, ; - [<.all.>], <{while}>, ; - <{eval}>, <every>, ; - RecNo(), <next>, <rec>, ; +#xtranslate ORDCOND( [FOR <for>] ; + [<all:ALL>] [WHILE <while>] ; + [EVAL <eval>] [EVERY <every>] ; + [RECORD <rec>] [NEXT <next>] ; + [<rest:REST>] [<descend: DESCENDING>] ) ; + => ordCondSet( <"for">, <{for}>, ; + [<.all.>], <{while}>, ; + <{eval}>, <every>, ; + RecNo(), <next>, <rec>, ; [<.rest.>], [<.descend.>] ) #endif diff --git a/include/set.ch b/include/set.ch index e48978fddc..d61852ca5d 100644 --- a/include/set.ch +++ b/include/set.ch @@ -130,4 +130,8 @@ #define HB_SET_BASE 100 #define HB_SET_COUNT ( _SET_DBCODEPAGE - HB_SET_BASE + 1 ) +#define HB_SET_CASE_MIXED 0 +#define HB_SET_CASE_LOWER 1 +#define HB_SET_CASE_UPPER 2 + #endif /* _SET_CH */ diff --git a/include/setcurs.ch b/include/setcurs.ch index 5898810636..31b94b2ae2 100644 --- a/include/setcurs.ch +++ b/include/setcurs.ch @@ -49,7 +49,7 @@ #ifndef _SETCURS_CH #define _SETCURS_CH -#define SC_UNDEF -1 /* NOTE: This is a Harbour extension. */ +#define SC_UNDEF -1 /* NOTE: This is a Harbour extension. */ #define SC_NONE 0 #define SC_NORMAL 1 #define SC_INSERT 2 diff --git a/include/std.ch b/include/std.ch index 34d00c7d56..b7b509f398 100644 --- a/include/std.ch +++ b/include/std.ch @@ -1,5 +1,5 @@ /* - * + * Standard PP rules * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -621,7 +621,7 @@ [BMPOFF X <bX> Y <bY>] => ; SetPos( <row>, <col> ) ;; AAdd( GetList, _GET_( <v>, <(v)>, NIL, <{valid}>, <{when}> ) ) ;; - ATail( GetList ):Control := _PushButt_( <cap>, <msg>, <clr>, <{fb}>,; + ATail( GetList ):Control := _PushButt_( <cap>, <msg>, <clr>, <{fb}>, ; <{sb}>, <stl>, <sX>, <sY>, <cX>, <cY>, <bmap>, <bX>, <bY> ) ;; ATail( GetList ):reader := {| a, b, c, d | GUIReader( a, b, c, d ) } ;; [ ATail( GetList ):<snd> ;] [ ATail( GetList ):Control:<gsnd> ;] ; @@ -635,7 +635,7 @@ SetPos( <top>, <left> ) ;; AAdd( GetList, _GET_( <v>, <(v)>, NIL, <{valid}>, <{when}> ) ) ;; ATail( GetList ):Control := _RadioGrp_( ATail( Getlist ):row, ; - ATail( Getlist ):col, <bottom>, <right>, <v>, <buttons>, <cap>,; + ATail( Getlist ):col, <bottom>, <right>, <v>, <buttons>, <cap>, ; <msg>, <clr>, <{fb}>, <stl> ) ;; ATail( GetList ):reader := {| a, b, c, d | GUIReader( a, b, c, d ) } ;; [ ATail( GetList ):<snd> ;] [ ATail( GetList ):Control:<gsnd> ;] ; diff --git a/include/tbrowse.ch b/include/tbrowse.ch index b5d1785b26..2620ece01b 100644 --- a/include/tbrowse.ch +++ b/include/tbrowse.ch @@ -47,14 +47,12 @@ #ifndef _TBROWSE_CH #define _TBROWSE_CH -/* tBrowse ApplyKey() method return codes */ -#define TBR_EXIT -1 +/* TBrowse ApplyKey() method return codes */ +#define TBR_EXIT -1 #define TBR_CONTINUE 0 #define TBR_EXCEPTION 1 - -/* tBrowse Styles */ - +/* TBrowse styles */ #define TBR_APPEND 1 #define TBR_APPENDING 2 #define TBR_MODIFY 3 @@ -62,9 +60,7 @@ #define TBR_SIZE 5 #define TBR_CUSTOM 6 - -/* tBcolumn Styles */ - +/* TBColumn styles */ #define TBC_READWRITE 1 #define TBC_MOVE 2 #define TBC_SIZE 3 diff --git a/include/vm.api b/include/vm.api index d077d008e9..529d406eda 100644 --- a/include/vm.api +++ b/include/vm.api @@ -46,10 +46,8 @@ /* DON'T USE THIS FILE FOR NEW HARBOUR C CODE */ -/* -------------------------------------------------------- */ -/* Warning: VM functionality is not supported by Harbour. */ -/* All functions will emulate constant failure. */ -/* -------------------------------------------------------- */ +/* WARNING: VM functionality is not supported by Harbour. + All functions will emulate constant failure. */ #ifndef _VM_API #define _VM_API diff --git a/src/codepage/big5.c b/src/codepage/big5.c index 00eb7d6386..05c3cef876 100644 --- a/src/codepage/big5.c +++ b/src/codepage/big5.c @@ -1,6 +1,6 @@ /* * BIG5 <-> UCS16 conversion tables - * code generated automatically by tests/big5_gen.prg + * code generated automatically by tests/big5_gen.prg * * Copyright 2011 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/codepage/cp950.c b/src/codepage/cp950.c index a7dabbea7c..c8ee97aca2 100644 --- a/src/codepage/cp950.c +++ b/src/codepage/cp950.c @@ -1,6 +1,6 @@ /* * CP950 <-> UCS16 conversion tables - * code generated automatically by tests/cp950gen.prg + * code generated automatically by tests/cp950gen.prg * * Copyright 2012 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/codepage/cp_950.c b/src/codepage/cp_950.c index 55ea904299..9d7ea06b7b 100644 --- a/src/codepage/cp_950.c +++ b/src/codepage/cp_950.c @@ -1,5 +1,5 @@ /* - * example of Harbour codepage using CP950 encoding + * Example of Harbour codepage using CP950 encoding * * Copyright 2011 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/codepage/cp_big5.c b/src/codepage/cp_big5.c index 5443fd3a39..ea362d4746 100644 --- a/src/codepage/cp_big5.c +++ b/src/codepage/cp_big5.c @@ -1,5 +1,5 @@ /* - * example of Harbour codepage using BIG5 encoding + * Example of Harbour codepage using BIG5 encoding * * Copyright 2011 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/codepage/cp_u16le.c b/src/codepage/cp_u16le.c index ede0ea799e..27bfda8dba 100644 --- a/src/codepage/cp_u16le.c +++ b/src/codepage/cp_u16le.c @@ -1,5 +1,5 @@ /* - * example of Harbour codepage using UTF-16 little endian encoding + * Example of Harbour codepage using UTF-16 little endian encoding * * Copyright 2011 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/codepage/cp_utf8.c b/src/codepage/cp_utf8.c index 473799a674..b264dbd978 100644 --- a/src/codepage/cp_utf8.c +++ b/src/codepage/cp_utf8.c @@ -1,5 +1,5 @@ /* - * example of Harbour codepage using UTF8 encoding + * Example of Harbour codepage using UTF-8 encoding * * Copyright 2011 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/codepage/cpcs852.c b/src/codepage/cpcs852.c index 74b54b7c31..72161a0b4b 100644 --- a/src/codepage/cpcs852.c +++ b/src/codepage/cpcs852.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (CS852) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Czech collating sequence (CS852) done by Vojtech Obrdlik <vobrdlik@centrum.cz> + * Copyright 2002 Vojtech Obrdlik <vobrdlik@centrum.cz> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpcsiso.c b/src/codepage/cpcsiso.c index 8ab5cd27df..d495bb58e2 100644 --- a/src/codepage/cpcsiso.c +++ b/src/codepage/cpcsiso.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (CSISO) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Czech collating sequence (CSISO) done by Vojtech Obrdlik <vobrdlik@centrum.cz> + * Copyright 2002 Vojtech Obrdlik <vobrdlik@centrum.cz> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpcswin.c b/src/codepage/cpcswin.c index 22030871e7..96abc5ca4d 100644 --- a/src/codepage/cpcswin.c +++ b/src/codepage/cpcswin.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (CSWIN) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Czech collating sequence (CSWIN) done by Vojtech Obrdlik <vobrdlik@centrum.cz> + * Copyright 2002 Vojtech Obrdlik <vobrdlik@centrum.cz> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpdeiso.c b/src/codepage/cpdeiso.c index d66283f60c..951407b037 100644 --- a/src/codepage/cpdeiso.c +++ b/src/codepage/cpdeiso.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (DEISO) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * v1.0 2003 Guenther Steiner <byte-one@aon.at> + * Copyright 2003 Guenther Steiner <byte-one@aon.at> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpdewin.c b/src/codepage/cpdewin.c index 033097e2eb..445e010185 100644 --- a/src/codepage/cpdewin.c +++ b/src/codepage/cpdewin.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (DEWIN) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * v1.0 2003 Guenther Steiner <byte-one@aon.at> + * Copyright 2003 Guenther Steiner <byte-one@aon.at> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpeliso.c b/src/codepage/cpeliso.c index 792b1f3ffd..5e8f9f1dc7 100644 --- a/src/codepage/cpeliso.c +++ b/src/codepage/cpeliso.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (ELISO) * - * Copyright 2004 Pete Dionisopoulos <pete_westg@yahoo.gr> - * v1.0 2004 Panayotis (Pete) Dionysopoulos <pete_westg@yahoo.gr> + * Copyright 2004 Panayotis (Pete) Dionisopoulos <pete_westg@yahoo.gr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpelwin.c b/src/codepage/cpelwin.c index 74c3c3ecec..d04bb23088 100644 --- a/src/codepage/cpelwin.c +++ b/src/codepage/cpelwin.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (ELWIN) * - * Copyright 2004 Pete Dionisopoulos <pete_westg@yahoo.gr> - * v1.0 2004 Panayotis (Pete) Dionysopoulos <pete_westg@yahoo.gr> + * Copyright 2004 Panayotis (Pete) Dionisopoulos <pete_westg@yahoo.gr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpes850.c b/src/codepage/cpes850.c index 0b1b3d6dbd..f13e59ca17 100644 --- a/src/codepage/cpes850.c +++ b/src/codepage/cpes850.c @@ -2,7 +2,7 @@ * National Collation Support Module (ES850 - Modern Spanish) * * Copyright 2008 Viktor Szakats (vszakats.net/harbour) - * Spanish Windows support by Antonio Linares <alinares@fivetechsoft.com> + * Copyright Antonio Linares <alinares@fivetechsoft.com> (Spanish Windows support) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpesiso.c b/src/codepage/cpesiso.c index ce1de8cefe..c285a76758 100644 --- a/src/codepage/cpesiso.c +++ b/src/codepage/cpesiso.c @@ -2,7 +2,7 @@ * National Collation Support Module (ESISO - Modern Spanish) * * Copyright 2008 Viktor Szakats (vszakats.net/harbour) - * Spanish Windows support by Antonio Linares <alinares@fivetechsoft.com> + * Copyright Antonio Linares <alinares@fivetechsoft.com> (Spanish Windows support) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpesmwin.c b/src/codepage/cpesmwin.c index f06538b321..c3c5e91681 100644 --- a/src/codepage/cpesmwin.c +++ b/src/codepage/cpesmwin.c @@ -2,8 +2,7 @@ * National Collation Support Module (ESMWIN - Modern Spanish) * (COMPATIBILITY - Use ESWIN or ESISO instead.) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Spanish Windows support by Antonio Linares <alinares@fivetechsoft.com> + * Copyright 2002 Antonio Linares <alinares@fivetechsoft.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpeswin.c b/src/codepage/cpeswin.c index 5920702f96..3c15577149 100644 --- a/src/codepage/cpeswin.c +++ b/src/codepage/cpeswin.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (ESWIN - Modern Spanish) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Spanish Windows support by Antonio Linares <alinares@fivetechsoft.com> + * Copyright 2002 Antonio Linares <alinares@fivetechsoft.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cphr852.c b/src/codepage/cphr852.c index e769dfc2ce..9ce33cb0ba 100644 --- a/src/codepage/cphr852.c +++ b/src/codepage/cphr852.c @@ -1,9 +1,8 @@ /* * National Collation Support Module (HR852) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> - * 2003 Vlado Miholic <Vladimir.Miholic@sk.hinet.hr> + * Copyright 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> + * Copyright 2003 Vlado Miholic <Vladimir.Miholic@sk.hinet.hr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cphriso.c b/src/codepage/cphriso.c index 04663b7f73..5feb613753 100644 --- a/src/codepage/cphriso.c +++ b/src/codepage/cphriso.c @@ -1,9 +1,8 @@ /* * National Collation Support Module (HRISO) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> - * 2003 Vlado Miholic <Vladimir.Miholic@sk.hinet.hr> + * Copyright 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> + * Copyright 2003 Vlado Miholic <Vladimir.Miholic@sk.hinet.hr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cphrwin.c b/src/codepage/cphrwin.c index a5e97a59fa..d2c69e45b2 100644 --- a/src/codepage/cphrwin.c +++ b/src/codepage/cphrwin.c @@ -1,9 +1,8 @@ /* * National Collation Support Module (HRWIN) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> - * 2003 Vlado Miholic <Vladimir.Miholic@sk.hinet.hr> + * Copyright 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> + * Copyright 2003 Vlado Miholic <Vladimir.Miholic@sk.hinet.hr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpit437.c b/src/codepage/cpit437.c index 742c21de7f..89f9975765 100644 --- a/src/codepage/cpit437.c +++ b/src/codepage/cpit437.c @@ -1,7 +1,7 @@ /* * National Collation Support Module (IT437) * - * Copyright 2004 Maurilio Longo - <maurilio.longo@libero.it> + * Copyright 2004 Maurilio Longo <maurilio.longo@libero.it> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpitisb.c b/src/codepage/cpitisb.c index 2612ed5780..5c3efbdb66 100644 --- a/src/codepage/cpitisb.c +++ b/src/codepage/cpitisb.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (ITISB) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Spanish MS-DOS support by Antonio Linares <alinares@fivetechsoft.com> + * Copyright 2002 Antonio Linares <alinares@fivetechsoft.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cplt775.c b/src/codepage/cplt775.c index 1b4fbb4a67..4cd507d8d8 100644 --- a/src/codepage/cplt775.c +++ b/src/codepage/cplt775.c @@ -1,9 +1,7 @@ /* * National Collation Support Module (LT775) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Lithuanian collation sequence - * 2010, by Mindaugas Kavaliauskas <dbtopas@dbtopas.lt> + * Copyright 2010 Mindaugas Kavaliauskas <dbtopas@dbtopas.lt> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpltwin.c b/src/codepage/cpltwin.c index 0bc44a1782..1506276109 100644 --- a/src/codepage/cpltwin.c +++ b/src/codepage/cpltwin.c @@ -1,9 +1,7 @@ /* * National Collation Support Module (LTWIN) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Lithuanian collation sequence - * 2003, by Mindaugas Kavaliauskas <dbtopas@dbtopas.lt> + * Copyright 2003 Mindaugas Kavaliauskas <dbtopas@dbtopas.lt> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cppl852.c b/src/codepage/cppl852.c index e29cea627c..0d5ce1308a 100644 --- a/src/codepage/cppl852.c +++ b/src/codepage/cppl852.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (PL852) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Polish collating sequence (PL852) CP852 done by Jacek Kubica <kubica@wssk.wroc.pl> + * Copyright 2002 Jacek Kubica <kubica@wssk.wroc.pl> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cppliso.c b/src/codepage/cppliso.c index ebdb91b14e..1a0e111a9d 100644 --- a/src/codepage/cppliso.c +++ b/src/codepage/cppliso.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (PLISO) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Polish collating sequence (PLISO) done by Jacek Kubica <kubica@wssk.wroc.pl> + * Copyright 2002 Jacek Kubica <kubica@wssk.wroc.pl> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpplmaz.c b/src/codepage/cpplmaz.c index 2c32520028..c5d7d8ad40 100644 --- a/src/codepage/cpplmaz.c +++ b/src/codepage/cpplmaz.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (PLMAZ) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Polish collating sequence (PLMAZ) Mazovia done by Jacek Kubica <kubica@wssk.wroc.pl> + * Copyright 2002 Jacek Kubica <kubica@wssk.wroc.pl> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpplwin.c b/src/codepage/cpplwin.c index ec82c5d89e..2636704800 100644 --- a/src/codepage/cpplwin.c +++ b/src/codepage/cpplwin.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (PLWIN) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Polish collating sequence (PLWIN) done by Przemyslaw Czerpak <druzus@polbox.com> + * Copyright 2002 Przemyslaw Czerpak <druzus@polbox.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cppt850.c b/src/codepage/cppt850.c index bff5ba71b5..e259df9f85 100644 --- a/src/codepage/cppt850.c +++ b/src/codepage/cppt850.c @@ -1,9 +1,7 @@ /* * National Collation Support Module (PT850) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Portuguese collating sequence (PT850) done - * by Luiz Rafael Culik Guimaraes <culikr@uol.com.br> + * Copyright 2002 Luiz Rafael Culik Guimaraes <culikr@uol.com.br> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpptiso.c b/src/codepage/cpptiso.c index 0f79fcf9f7..0a91e86120 100644 --- a/src/codepage/cpptiso.c +++ b/src/codepage/cpptiso.c @@ -1,9 +1,7 @@ /* * National Collation Support Module (PTISO) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * Portuguese collating sequence (PTISO) done - * by Przemyslaw Czerpak <druzus@polbox.com> + * Copyright 2002 Przemyslaw Czerpak <druzus@polbox.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpsl646.c b/src/codepage/cpsl646.c index 5e956e734f..d2f7055726 100644 --- a/src/codepage/cpsl646.c +++ b/src/codepage/cpsl646.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (SL646) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> + * Copyright 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpsl852.c b/src/codepage/cpsl852.c index 8666749ee7..2272187c24 100644 --- a/src/codepage/cpsl852.c +++ b/src/codepage/cpsl852.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (SL852) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> + * Copyright 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpsliso.c b/src/codepage/cpsliso.c index 3193260134..5657440cdb 100644 --- a/src/codepage/cpsliso.c +++ b/src/codepage/cpsliso.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (SLISO) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> + * Copyright 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpslwin.c b/src/codepage/cpslwin.c index 46a80a04b2..99540975dd 100644 --- a/src/codepage/cpslwin.c +++ b/src/codepage/cpslwin.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (SLWIN) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> + * Copyright 2003 Mitja Podgornik <Mitja.Podgornik@zgs.gov.si> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpsrwin.c b/src/codepage/cpsrwin.c index a1190f1b2c..edb89c0727 100644 --- a/src/codepage/cpsrwin.c +++ b/src/codepage/cpsrwin.c @@ -1,8 +1,7 @@ /* * National Collation Support Module (SRWIN) * - * Copyright 2002 Alexander S.Kresin <alex@belacy.belgorod.su> - * SERBIAN collating sequence done by Srdjan Dragojlovic <digikv@yahoo.com> + * Copyright 2002 Srdjan Dragojlovic <digikv@yahoo.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/cpsv437c.c b/src/codepage/cpsv437c.c index a01b0c2497..6432b90166 100644 --- a/src/codepage/cpsv437c.c +++ b/src/codepage/cpsv437c.c @@ -54,9 +54,9 @@ 136, a rather pointless relocation IMHO. I found no way to replicate that behaviour in the character strings below, so if you allow Chr( 146 ) and Chr( 145 ) to be saved in indexed fields there WILL be index corruption - if data is shared between Clipper and Harbour. Upper()/Lower() converson + if data is shared between Clipper and Harbour. Upper()/Lower() conversion of those characters as well as all accented characters must be done - programatically just like in Clipper. + programmatically just like in Clipper. For sharing data with Clipper, assuming that the Chr( 146 ) and Chr( 145 ) problem is properly taken care of in your code, this codepage version @@ -73,7 +73,7 @@ between Clipper and Harbour applications. */ -/* +#if 0 #define HB_CP_ID SVCLIP #define HB_CP_INFO "Swedish CP-437" #define HB_CP_UNITB HB_UNITB_437 @@ -81,7 +81,7 @@ #define HB_CP_UPPER "ABCDEÉFGHIJKLMNOPQRSTUVWXYÜZÅÄÖ" #define HB_CP_LOWER "abcdeèfghijklmnopqrstuvwxyüzåäö" #define HB_CP_UTF8 -*/ +#endif #define HB_CP_ID SV437C #define HB_CP_INFO "Swedish CP-437 (ntxswe.obj compatible)" diff --git a/src/codepage/cpua866.c b/src/codepage/cpua866.c index 5cd53cc192..0f16117461 100644 --- a/src/codepage/cpua866.c +++ b/src/codepage/cpua866.c @@ -48,10 +48,10 @@ the Ukrainian alphabet and uses non-cyrillic versions for another two (Іі), because the originals cannot be encoded in CP-866: - Ґ - U+0490 - http://codepoints.net/U+0490 - ґ - U+0491 - http://codepoints.net/U+0491 - І - U+0406 - http://codepoints.net/U+0406 - і - U+0456 - http://codepoints.net/U+0456 + Ґ - U+0490 - https://codepoints.net/U+0490 + ґ - U+0491 - https://codepoints.net/U+0491 + І - U+0406 - https://codepoints.net/U+0406 + і - U+0456 - https://codepoints.net/U+0456 [druzus/vszakats] */ #define HB_CP_ID UA866 diff --git a/src/codepage/uckam.c b/src/codepage/uckam.c index 76d0bc85e1..8b19e47bf7 100644 --- a/src/codepage/uckam.c +++ b/src/codepage/uckam.c @@ -2,7 +2,7 @@ * Czech and Slovak Kamenicky (CP895) <-> Unicode conversion table * * Copyright 2006 Vojtech Obrdlik <vobrdlik@centrum.cz> - * adapted from David Kozub - http://linux.fjfi.cvut.cz/%7Ezub/cp895/ + * adapted from David Kozub - https://linux.fjfi.cvut.cz/%7Ezub/cp895/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/codepage/uckoi8.c b/src/codepage/uckoi8.c index a8dc38c951..b3e91a0f6a 100644 --- a/src/codepage/uckoi8.c +++ b/src/codepage/uckoi8.c @@ -1,7 +1,6 @@ /* * KOI8 <-> Unicode conversion table * - * * Copyright 2003 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * * This program is free software; you can redistribute it and/or modify diff --git a/src/codepage/uckoi8u.c b/src/codepage/uckoi8u.c index bdae32d3ec..77d9cdb660 100644 --- a/src/codepage/uckoi8u.c +++ b/src/codepage/uckoi8u.c @@ -1,7 +1,6 @@ /* * KOI8-U <-> Unicode conversion table * - * * Copyright 2004 Pavel Tsarenko <tpe2@mail.ru> * * This program is free software; you can redistribute it and/or modify diff --git a/src/codepage/utf8sort.c b/src/codepage/utf8sort.c index 8b6173d37c..977a0f3269 100644 --- a/src/codepage/utf8sort.c +++ b/src/codepage/utf8sort.c @@ -1,5 +1,5 @@ /* - * simple unicode sort table + * Simple unicode sort table * * Copyright 2012 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/common/expropt1.c b/src/common/expropt1.c index 419e4f121f..43cd09b2ed 100644 --- a/src/common/expropt1.c +++ b/src/common/expropt1.c @@ -84,7 +84,7 @@ static const char * s_OperTable[ HB_EXPR_COUNT ] = { "", /* variable */ "++", /* post-operators -> lowest precedence */ "--", - ":=", /* assigments */ + ":=", /* assignments */ "+=", "-=", "*=", @@ -150,7 +150,7 @@ static const HB_BYTE s_PrecedTable[ HB_EXPR_COUNT ] = { HB_ET_NIL, /* HB_ET_VARIABLE, */ HB_ET_NIL, /* HB_EO_POSTINC, post-operators */ HB_ET_NIL, /* HB_EO_POSTDEC, */ - HB_ET_NONE, /* HB_EO_ASSIGN, assigments */ + HB_ET_NONE, /* HB_EO_ASSIGN, assignments */ HB_ET_NONE, /* HB_EO_PLUSEQ, Invalid syntax */ HB_ET_NONE, /* HB_EO_MINUSEQ, */ HB_ET_NONE, /* HB_EO_MULTEQ, */ @@ -295,7 +295,7 @@ PHB_EXPR hb_compExprNewDouble( double dValue, HB_BYTE ucWidth, HB_BYTE ucDec, { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewDouble(%f, %i, %p)", dValue, ucDec, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewDouble(%f, %i, %p)", dValue, ucDec, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_NUMERIC ); @@ -312,7 +312,7 @@ PHB_EXPR hb_compExprNewLong( HB_MAXINT nValue, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewLong(%" PFHL "d, %p)", nValue, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewLong(%" PFHL "d, %p)", nValue, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_NUMERIC ); @@ -329,7 +329,7 @@ PHB_EXPR hb_compExprNewDate( long lDate, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewDate(%ld, %p)", lDate, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewDate(%ld, %p)", lDate, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_DATE ); @@ -344,7 +344,7 @@ PHB_EXPR hb_compExprNewTimeStamp( long lDate, long lTime, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewTimeStamp(%ld, %ld, %p)", lDate, lTime, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewTimeStamp(%ld, %ld, %p)", lDate, lTime, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_TIMESTAMP ); @@ -454,7 +454,7 @@ PHB_EXPR hb_compExprNewCodeBlock( char * string, HB_SIZE nLen, int iFlags, HB_CO { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewCodeBlock(%s,%" HB_PFS "u,%d,%p)", string, nLen, iFlags, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewCodeBlock(%s,%" HB_PFS "u,%d,%p)", string, nLen, iFlags, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_CODEBLOCK ); @@ -489,7 +489,7 @@ PHB_EXPR hb_compExprNewLogical( int iValue, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewLogical(%i,%p)", iValue, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewLogical(%i,%p)", iValue, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_LOGICAL ); @@ -504,7 +504,7 @@ PHB_EXPR hb_compExprNewNil( HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewNil(%p)", HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewNil(%p)", ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_NIL ); @@ -516,7 +516,7 @@ PHB_EXPR hb_compExprNewSelf( HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewSelf(%p)", HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewSelf(%p)", ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_SELF ); @@ -528,7 +528,7 @@ PHB_EXPR hb_compExprNewVarRef( const char * szVarName, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewVarRef(%s,%p)", szVarName, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewVarRef(%s,%p)", szVarName, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_VARREF ); @@ -541,7 +541,7 @@ PHB_EXPR hb_compExprNewFunRef( const char * szFunName, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewFunRef(%s,%p)", szFunName, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewFunRef(%s,%p)", szFunName, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_FUNREF ); @@ -556,7 +556,7 @@ PHB_EXPR hb_compExprNewRef( PHB_EXPR pRefer, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewRef(%p,%p)", pRefer, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewRef(%p,%p)", ( void * ) pRefer, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_REFERENCE ); @@ -669,7 +669,7 @@ PHB_EXPR hb_compExprNewSend( const char * szMessage, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewSend(%s,%p)", szMessage, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewSend(%s,%p)", szMessage, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_SEND ); pExpr->value.asMessage.pObject = NULL; @@ -690,7 +690,7 @@ PHB_EXPR hb_compExprNewMacroSend( PHB_EXPR pMessage, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewMacroSend(%p,%p)", pMessage, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewMacroSend(%p,%p)", ( void * ) pMessage, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_SEND ); pExpr->value.asMessage.pObject = NULL; @@ -715,12 +715,12 @@ PHB_EXPR hb_compExprNewMacroSend( PHB_EXPR pMessage, HB_COMP_DECL ) /* Set object in send expression * pObject : pExpr * - * pExpr = is an expression returned by hb_compExprNewSend + * pExpr = is an expression returned by hb_compExprNewSend() * pObject = is an object */ PHB_EXPR hb_compExprNewMethodObject( PHB_EXPR pExpr, PHB_EXPR pObject ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewMethodObject(%p,%p)", pExpr, pObject ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewMethodObject(%p,%p)", ( void * ) pExpr, ( void * ) pObject ) ); pExpr->value.asMessage.pObject = pObject; @@ -730,7 +730,7 @@ PHB_EXPR hb_compExprNewMethodObject( PHB_EXPR pExpr, PHB_EXPR pObject ) /* Creates new method call * pObject : identifier ( pArgList ) * - * pObject = is an expression returned by hb_compExprNewSend + * pObject = is an expression returned by hb_compExprNewSend() * pArgList = list of passed arguments - it will be HB_ET_NONE if no arguments * are passed */ @@ -741,7 +741,7 @@ PHB_EXPR hb_compExprNewMethodCall( PHB_EXPR pObject, PHB_EXPR pArgList ) return pObject; } -/* Create a new IIF() expression +/* Create a new iif() expression * pExpr is a list of three expressions */ PHB_EXPR hb_compExprNewIIF( PHB_EXPR pExpr ) @@ -818,7 +818,7 @@ PHB_EXPR hb_compExprNewVar( const char * szName, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewVar(%s,%p)", szName, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewVar(%s,%p)", szName, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_VARIABLE ); pExpr->value.asSymbol.name = szName; @@ -835,7 +835,7 @@ PHB_EXPR hb_compExprNewRTVar( const char * szName, PHB_EXPR pMacroVar, { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewRTVar(%s, %p, %p)", szName, pMacroVar, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewRTVar(%s, %p, %p)", szName, ( void * ) pMacroVar, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_RTVAR ); pExpr->value.asRTVar.szName = szName; @@ -851,7 +851,7 @@ PHB_EXPR hb_compExprNewFunName( const char * szName, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewFunName(%s,%p)", szName, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewFunName(%s,%p)", szName, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_FUNNAME ); pExpr->value.asSymbol.name = hb_compGetFuncID( szName, @@ -866,7 +866,7 @@ PHB_EXPR hb_compExprNewAlias( const char * szName, HB_COMP_DECL ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewAlias(%s,%p)", szName, HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNewAlias(%s,%p)", szName, ( void * ) HB_COMP_PARAM ) ); pExpr = HB_COMP_EXPR_NEW( HB_ET_ALIAS ); pExpr->value.asSymbol.name = szName; @@ -1251,7 +1251,7 @@ PHB_EXPR hb_compExprSetOperand( PHB_EXPR pExpr, PHB_EXPR pItem, HB_COMP_DECL ) } else { - /* Left operator has the same or higer precedence then the right one + /* Left operator has the same or higher precedence then the right one * e.g. a * b + c * pItem -> b + c -> L=b R=c O=+ * pExpr -> a * -> l=a r= o=* @@ -1355,10 +1355,11 @@ HB_BOOL hb_compExprIsArrayToParams( PHB_EXPR pExpr ) HB_SIZE hb_compExprParamListCheck( HB_COMP_DECL, PHB_EXPR pExpr ) { - HB_SIZE nLen = 0, nItems = 0; + HB_SIZE nLen = 0; if( pExpr ) { + HB_SIZE nItems = 0; PHB_EXPR pElem; pElem = pExpr->value.asList.pExprList; @@ -1466,11 +1467,9 @@ PHB_EXPR hb_compExprCBVarAdd( PHB_EXPR pCB, const char * szVarName, HB_BYTE bTyp */ void hb_compExprCBVarDel( PHB_CBVAR pVars ) { - PHB_CBVAR pDel; - while( pVars ) { - pDel = pVars; + PHB_CBVAR pDel = pVars; pVars = pVars->pNext; hb_xfree( pDel ); } @@ -1478,7 +1477,7 @@ void hb_compExprCBVarDel( PHB_CBVAR pVars ) /* Creates a set/get codeblock for passed expression used in __GET * - * {| ~1 | IIF( ~1 == NIL, <pExpr>, <pExpr> := ~1 ) } + * {| ~1 | iif( ~1 == NIL, <pExpr>, <pExpr> := ~1 ) } * * NOTE: "~1" is not a valid variable name so there will be no collisions */ diff --git a/src/common/expropt2.c b/src/common/expropt2.c index d20f4c59fb..240f0e9905 100644 --- a/src/common/expropt2.c +++ b/src/common/expropt2.c @@ -158,16 +158,14 @@ PHB_EXPR hb_compExprReduceMod( PHB_EXPR pSelf, HB_COMP_DECL ) default: if( HB_SUPPORT_HARBOUR ) { - double dValue, dDivisor; - - dDivisor = pRight->value.asNum.NumType == HB_ET_LONG ? - ( double ) pRight->value.asNum.val.l : - pRight->value.asNum.val.d; + double dDivisor = pRight->value.asNum.NumType == HB_ET_LONG ? + ( double ) pRight->value.asNum.val.l : + pRight->value.asNum.val.d; if( dDivisor ) { - dValue = pLeft->value.asNum.NumType == HB_ET_LONG ? - ( double ) pLeft->value.asNum.val.l : - pLeft->value.asNum.val.d; + double dValue = pLeft->value.asNum.NumType == HB_ET_LONG ? + ( double ) pLeft->value.asNum.val.l : + pLeft->value.asNum.val.d; pSelf->value.asNum.val.d = fmod( dValue, dDivisor ); pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH; pSelf->value.asNum.bDec = HB_DEFAULT_DECIMALS; @@ -986,7 +984,7 @@ PHB_EXPR hb_compExprReduceIN( PHB_EXPR pSelf, HB_COMP_DECL ) /* Both arguments are literal strings */ - /* NOTE: If macro substitiution is not didabled (-kM compiler + /* NOTE: If macro substitution is not disabled (-kM compiler * switch) then we cannot reduce also strings which * have macro operator '&' */ @@ -1004,7 +1002,7 @@ PHB_EXPR hb_compExprReduceIN( PHB_EXPR pSelf, HB_COMP_DECL ) * But this bug exist only in compiler and CA-Cl*pper macro * compiler does not have optimizer. This bug is replicated * by us only when Harbour extensions in compiler (-kh) are - * not enabled f.e. in strict Clipper cmpatible mode (-kc) + * not enabled f.e. in strict Clipper compatible mode (-kc) * [druzus] */ if( pLeft->nLength == 0 ) @@ -1055,7 +1053,7 @@ PHB_EXPR hb_compExprReduceNE( PHB_EXPR pSelf, HB_COMP_DECL ) case HB_ET_STRING: /* NOTE: the result depends on SET EXACT setting then it - * cannot be optimized except the case when NULL string are + * cannot be optimized except the case when null strings are * compared - "" != "" is always HB_FALSE regardless of EXACT * setting */ @@ -1575,10 +1573,10 @@ PHB_EXPR hb_compExprReduceEQ( PHB_EXPR pSelf, HB_COMP_DECL ) case HB_ET_STRING: /* NOTE: when not exact comparison (==) is used * the result depends on SET EXACT setting then it - * cannot be optimized except the case when NULL string are + * cannot be optimized except the case when null strings are * compared - "" = "" is always TRUE regardless of EXACT * setting. - * If macro substitiution is not didabled (-kM compiler + * If macro substitution is not disabled (-kM compiler * switch) then we cannot reduce also strings which * have macro operator '&' */ @@ -1899,8 +1897,8 @@ PHB_EXPR hb_compExprReduceIIF( PHB_EXPR pSelf, HB_COMP_DECL ) /* store the TRUE expression as a result of reduction */ pSelf = pExpr; - pExpr = pExpr->pNext; /* skip to HB_FALSE expression */ - HB_COMP_EXPR_FREE( pExpr ); /* delete HB_FALSE expr */ + pExpr = pExpr->pNext; /* skip to FALSE expression */ + HB_COMP_EXPR_FREE( pExpr ); /* delete FALSE expression */ pSelf->pNext = NULL; } else @@ -1917,10 +1915,10 @@ PHB_EXPR hb_compExprReduceIIF( PHB_EXPR pSelf, HB_COMP_DECL ) */ pSelf->value.asList.pExprList = NULL; HB_COMP_EXPR_FREE( pSelf ); - /* store the HB_FALSE expression as a result of reduction + /* store the FALSE expression as a result of reduction */ pSelf = pExpr->pNext; - HB_COMP_EXPR_FREE( pExpr ); /* delete TRUE expr */ + HB_COMP_EXPR_FREE( pExpr ); /* delete TRUE expression */ pSelf->pNext = NULL; } @@ -1981,17 +1979,18 @@ HB_BOOL hb_compExprReduceAT( PHB_EXPR pSelf, HB_COMP_DECL ) PHB_EXPR pParms = pSelf->value.asFunCall.pParms; PHB_EXPR pSub = pParms->value.asList.pExprList; PHB_EXPR pText = pSub->pNext; - PHB_EXPR pReduced; if( pSub->ExprType == HB_ET_STRING && pText->ExprType == HB_ET_STRING && ! HB_SUPPORT_USERCP ) { + PHB_EXPR pReduced; + /* NOTE: CA-Cl*pper has a bug in At( "", cText ) compile time - * optimization and always set 1 as result in such cses. + * optimization and always set 1 as result in such cases. * This bug exist only in compiler and CA-Cl*pper macro * compiler does not have optimizer. This bug is replicated * by us only when Harbour extensions in compiler (-kh) are - * not enabled f.e. in strict Clipper cmpatible mode (-kc) + * not enabled f.e. in strict Clipper compatible mode (-kc) * [druzus] */ if( pSub->nLength == 0 ) @@ -2042,12 +2041,12 @@ HB_BOOL hb_compExprReduceCHR( PHB_EXPR pSelf, HB_COMP_DECL ) /* NOTE: CA-Cl*pper's compiler optimizer will be wrong for those * Chr() cases where the passed parameter is a constant which * can be divided by 256 but it's not zero, in this case it - * will return an empty string instead of a Chr(0). [vszakats] + * will return an empty string instead of a Chr( 0 ). [vszakats] * * But this bug exist only in compiler and CA-Cl*pper macro * compiler does not have optimizer. This bug is replicated * by us only when Harbour extensions in compiler (-kh) are - * not enabled f.e. in strict Clipper cmpatible mode (-kc) + * not enabled f.e. in strict Clipper compatible mode (-kc) * [druzus] */ @@ -2121,7 +2120,7 @@ HB_BOOL hb_compExprReduceLEN( PHB_EXPR pSelf, HB_COMP_DECL ) PHB_EXPR pParms = pSelf->value.asFunCall.pParms; PHB_EXPR pArg = pParms->value.asList.pExprList; - /* TOFIX: do not optimize when array/hash args have user expressions */ + /* FIXME: do not optimize when array/hash args have user expressions */ if( ( pArg->ExprType == HB_ET_STRING && ! HB_SUPPORT_USERCP ) || pArg->ExprType == HB_ET_ARRAY || pArg->ExprType == HB_ET_HASH ) @@ -2152,7 +2151,7 @@ HB_BOOL hb_compExprReduceEMPTY( PHB_EXPR pSelf, HB_COMP_DECL ) case HB_ET_ARRAY: case HB_ET_HASH: - /* TOFIX: do not optimize when array/hash args have user expressions */ + /* FIXME: do not optimize when array/hash args have user expressions */ fResult = pArg->nLength == 0; break; diff --git a/src/common/funcid.c b/src/common/funcid.c index f783ecf135..b6109411e3 100644 --- a/src/common/funcid.c +++ b/src/common/funcid.c @@ -1,5 +1,5 @@ /* - * get function identifier + * Get function identifier * * Copyright 2010 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/common/hbarch.c b/src/common/hbarch.c index 54d7701f5d..6f1e950054 100644 --- a/src/common/hbarch.c +++ b/src/common/hbarch.c @@ -68,12 +68,11 @@ void hb_put_ieee754( HB_BYTE * ptr, double d ) { int iExp, iSig; - double df; #if defined( HB_LONG_LONG_OFF ) HB_U32 l1, l2; - HB_TRACE( HB_TR_DEBUG, ( "hb_put_ieee754(%p, %f)", ptr, d ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_put_ieee754(%p, %f)", ( void * ) ptr, d ) ); iSig = d < 0 ? 1 : 0; if( d == 0.0 ) @@ -82,7 +81,7 @@ void hb_put_ieee754( HB_BYTE * ptr, double d ) } else { - df = frexp( iSig ? -d : d, &iExp ); + double df = frexp( iSig ? -d : d, &iExp ); l1 = ( HB_U32 ) ldexp( df, HB_MANTISSA_BITS + 1 ); l2 = ( HB_U32 ) ldexp( df, HB_MANTISSA_BITS + 1 - 32 ) & ( ( ( HB_U32 ) 1 << ( HB_MANTISSA_BITS - 32 ) ) - 1 ); @@ -95,7 +94,7 @@ void hb_put_ieee754( HB_BYTE * ptr, double d ) #else HB_U64 ll; - HB_TRACE( HB_TR_DEBUG, ( "hb_put_ieee754(%p, %f)", ptr, d ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_put_ieee754(%p, %f)", ( void * ) ptr, d ) ); iSig = d < 0 ? 1 : 0; if( d == 0.0 ) @@ -104,7 +103,7 @@ void hb_put_ieee754( HB_BYTE * ptr, double d ) } else { - df = frexp( iSig ? -d : d, &iExp ); + double df = frexp( iSig ? -d : d, &iExp ); ll = ( HB_U64 ) ldexp( df, HB_MANTISSA_BITS + 1 ) & HB_MANTISSA_MASK; ll |= ( HB_U64 ) ( ( iExp + HB_EXPONENT_ADD - 1 ) & HB_EXPONENT_MASK ) << HB_MANTISSA_BITS; @@ -122,7 +121,7 @@ double hb_get_ieee754( const HB_BYTE * ptr ) HB_U32 l1, l2; double d; - HB_TRACE( HB_TR_DEBUG, ( "hb_get_ieee754(%p)", ptr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_get_ieee754(%p)", ( const void * ) ptr ) ); l1 = HB_GET_LE_UINT32( ptr ); l2 = HB_GET_LE_UINT32( ptr + 4 ); @@ -138,7 +137,7 @@ double hb_get_ieee754( const HB_BYTE * ptr ) #else HB_U64 ll; - HB_TRACE( HB_TR_DEBUG, ( "hb_get_ieee754(%p)", ptr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_get_ieee754(%p)", ( const void * ) ptr ) ); ll = HB_GET_LE_UINT64( ptr ); iSig = ( int ) ( ll >> ( HB_MANTISSA_BITS + HB_EXPONENT_BITS ) ) & 1; @@ -158,10 +157,9 @@ double hb_get_ieee754( const HB_BYTE * ptr ) void hb_put_ord_ieee754( HB_BYTE * ptr, double d ) { int iExp, iSig; - double df; HB_U32 l1, l2; - HB_TRACE( HB_TR_DEBUG, ( "hb_put_ord_ieee754(%p, %f)", ptr, d ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_put_ord_ieee754(%p, %f)", ( void * ) ptr, d ) ); iSig = d < 0 ? 1 : 0; if( d == 0.0 ) @@ -170,7 +168,7 @@ void hb_put_ord_ieee754( HB_BYTE * ptr, double d ) } else { - df = frexp( iSig ? -d : d, &iExp ); + double df = frexp( iSig ? -d : d, &iExp ); l1 = ( HB_U32 ) ldexp( df, HB_MANTISSA_BITS + 1 ); l2 = ( HB_U32 ) ldexp( df, HB_MANTISSA_BITS + 1 - 32 ) & ( ( ( HB_U32 ) 1 << ( HB_MANTISSA_BITS - 32 ) ) - 1 ); @@ -196,7 +194,7 @@ double hb_get_ord_ieee754( const HB_BYTE * ptr ) HB_U32 l1, l2; double d; - HB_TRACE( HB_TR_DEBUG, ( "hb_get_ord_ieee754(%p)", ptr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_get_ord_ieee754(%p)", ( const void * ) ptr ) ); l1 = HB_GET_BE_UINT32( ptr + 4 ); l2 = HB_GET_BE_UINT32( ptr ); @@ -218,12 +216,12 @@ double hb_get_ord_ieee754( const HB_BYTE * ptr ) /* * I added function hb_get_rev_double() and hb_get_std_double() because - * some compilers does not like constraction used by in HB_GET_LE_DOUBLE + * some compilers does not like construction used by in HB_GET_LE_DOUBLE() * macro => d = { ... } */ double hb_get_rev_double( const HB_BYTE * ptr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_get_rev_double(%p)", ptr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_get_rev_double(%p)", ( const void * ) ptr ) ); { #if defined( __GNUC__ ) @@ -251,7 +249,7 @@ double hb_get_rev_double( const HB_BYTE * ptr ) double hb_get_std_double( const HB_BYTE * ptr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_get_std_double(%p)", ptr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_get_std_double(%p)", ( const void * ) ptr ) ); { #if defined( __GNUC__ ) @@ -289,7 +287,7 @@ double hb_get_le_uint64( const HB_BYTE * ptr ) { HB_U32 l1, l2; - HB_TRACE( HB_TR_DEBUG, ( "hb_get_le_uint64(%p)", ptr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_get_le_uint64(%p)", ( const void * ) ptr ) ); l1 = HB_GET_LE_UINT32( ptr ); l2 = HB_GET_LE_UINT32( ptr + 4 ); @@ -301,7 +299,7 @@ double hb_get_le_int64( const HB_BYTE * ptr ) HB_U32 l1; HB_I32 l2; - HB_TRACE( HB_TR_DEBUG, ( "hb_get_le_int64(%p)", ptr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_get_le_int64(%p)", ( const void * ) ptr ) ); l1 = HB_GET_LE_UINT32( ptr ); l2 = HB_GET_LE_INT32( ptr + 4 ); @@ -312,7 +310,7 @@ void hb_put_le_uint64( const HB_BYTE * ptr, double d ) { HB_U32 l1, l2; - HB_TRACE( HB_TR_DEBUG, ( "hb_put_le_uint64(%p)", ptr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_put_le_uint64(%p)", ( const void * ) ptr ) ); l1 = ( HB_U32 ) ( d ); l2 = ( HB_U32 ) ( d / 4294967296.0 ); diff --git a/src/common/hbdate.c b/src/common/hbdate.c index 4e06ed3274..382bc50ad2 100644 --- a/src/common/hbdate.c +++ b/src/common/hbdate.c @@ -2,6 +2,11 @@ * The Date conversion module * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * (hb_dateEncStr(), hb_dateDecStr(), hb_dateStrPut(), hb_dateStrGet()) + * Copyright 1999 Jose Lalin <dezac@corevia.com> (hb_dateDOW()) + * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> + * (time/timestamp functions) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,25 +49,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_dateEncStr() - * hb_dateDecStr() - * hb_dateStrPut() - * hb_dateStrGet() - * - * Copyright 1999 Jose Lalin <dezac@corevia.com> - * hb_dateDOW() - * - * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> - * time/timestamp functions - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbdate.h" #if defined( HB_LONG_LONG_OFF ) @@ -104,7 +90,7 @@ void hb_timeStampGetLocal( int * piYear, int * piMonth, int * piDay, int * piHour, int * piMinutes, int * piSeconds, int * piMSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampGetLocal(%p,%p,%p,%p,%p,%p,%p)", piYear, piMonth, piDay, piHour, piMinutes, piSeconds, piMSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampGetLocal(%p,%p,%p,%p,%p,%p,%p)", ( void * ) piYear, ( void * ) piMonth, ( void * ) piDay, ( void * ) piHour, ( void * ) piMinutes, ( void * ) piSeconds, ( void * ) piMSec ) ); #if defined( HB_OS_WIN ) { @@ -154,7 +140,7 @@ void hb_timeStampGetLocal( int * piYear, int * piMonth, int * piDay, #endif } -/* return UTC julian timestamp in milliseconds */ +/* return UTC Julian timestamp in milliseconds */ HB_MAXUINT hb_dateMilliSeconds( void ) { HB_TRACE( HB_TR_DEBUG, ( "hb_dateMilliSeconds()" ) ); @@ -191,7 +177,7 @@ void hb_timeStampGet( long * plJulian, long * plMilliSec ) { int iYear, iMonth, iDay, iHour, iMinute, iSeconds, iMillisec; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampGet(%p,%p)", plJulian, plMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampGet(%p,%p)", ( void * ) plJulian, ( void * ) plMilliSec ) ); hb_timeStampGetLocal( &iYear, &iMonth, &iDay, &iHour, &iMinute, &iSeconds, &iMillisec ); @@ -241,7 +227,7 @@ long hb_dateEncode( int iYear, int iMonth, int iDay ) void hb_dateDecode( long lJulian, int * piYear, int * piMonth, int * piDay ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dateDecode(%ld, %p, %p, %p)", lJulian, piYear, piMonth, piDay ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateDecode(%ld, %p, %p, %p)", lJulian, ( void * ) piYear, ( void * ) piMonth, ( void * ) piDay ) ); if( lJulian >= HB_STR_DATE_BASE ) { @@ -270,7 +256,7 @@ void hb_dateDecode( long lJulian, int * piYear, int * piMonth, int * piDay ) void hb_dateStrPut( char * szDate, int iYear, int iMonth, int iDay ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dateStrPut(%p, %d, %d, %d)", szDate, iYear, iMonth, iDay ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateStrPut(%p, %d, %d, %d)", ( void * ) szDate, iYear, iMonth, iDay ) ); if( iYear >= 0 && iMonth > 0 && iDay > 0 ) { @@ -293,7 +279,7 @@ void hb_dateStrPut( char * szDate, int iYear, int iMonth, int iDay ) void hb_dateStrGet( const char * szDate, int * piYear, int * piMonth, int * piDay ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dateStrGet(%.8s, %p, %p, %p)", szDate, piYear, piMonth, piDay ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateStrGet(%.8s, %p, %p, %p)", szDate, ( void * ) piYear, ( void * ) piMonth, ( void * ) piDay ) ); #if defined( HB_CLP_STRICT ) || 1 if( szDate ) @@ -333,7 +319,7 @@ char * hb_dateDecStr( char * szDate, long lJulian ) { int iYear, iMonth, iDay; - HB_TRACE( HB_TR_DEBUG, ( "hb_dateDecStr(%p, %ld)", szDate, lJulian ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateDecStr(%p, %ld)", ( void * ) szDate, lJulian ) ); if( lJulian <= 0 ) { @@ -372,7 +358,7 @@ int hb_dateJulianDOW( long lJulian ) HB_BOOL hb_dateDecWeek( long lJulian, int * piYear, int * piWeek, int * piDay ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dateDecWeek(%ld,%p,%p,%p)", lJulian, piYear, piWeek, piDay ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateDecWeek(%ld,%p,%p,%p)", lJulian, ( void * ) piYear, ( void * ) piWeek, ( void * ) piDay ) ); if( lJulian >= HB_STR_DATE_BASE ) { @@ -426,7 +412,7 @@ void hb_dateToday( int * piYear, int * piMonth, int * piDay ) { int iHour, iMinute, iSeconds, iMillisec; - HB_TRACE( HB_TR_DEBUG, ( "hb_dateToday(%p,%p,%p)", piYear, piMonth, piDay ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateToday(%p,%p,%p)", ( void * ) piYear, ( void * ) piMonth, ( void * ) piDay ) ); hb_timeStampGetLocal( piYear, piMonth, piDay, &iHour, &iMinute, &iSeconds, &iMillisec ); @@ -438,7 +424,7 @@ void hb_dateTimeStr( char * pszTime ) { int iYear, iMonth, iDay, iHour, iMinute, iSeconds, iMillisec; - HB_TRACE( HB_TR_DEBUG, ( "hb_dateTimeStr(%p)", pszTime ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateTimeStr(%p)", ( void * ) pszTime ) ); hb_timeStampGetLocal( &iYear, &iMonth, &iDay, &iHour, &iMinute, &iSeconds, &iMillisec ); @@ -470,7 +456,7 @@ long hb_timeEncode( int iHour, int iMinutes, int iSeconds, int iMSec ) void hb_timeDecode( long lMilliSec, int * piHour, int * piMinutes, int * piSeconds, int * piMSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_timeDecode(%ld, %p, %p, %p, %p)", lMilliSec, piHour, piMinutes, piSeconds, piMSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeDecode(%ld, %p, %p, %p, %p)", lMilliSec, ( void * ) piHour, ( void * ) piMinutes, ( void * ) piSeconds, ( void * ) piMSec ) ); if( lMilliSec <= 0 ) { @@ -498,7 +484,7 @@ char * hb_timeStr( char * szTime, long lMilliSec ) { int iHour, iMinutes, iSeconds, iMSec; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStr(%p, %ld)", szTime, lMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStr(%p, %ld)", ( void * ) szTime, lMilliSec ) ); hb_timeDecode( lMilliSec, &iHour, &iMinutes, &iSeconds, &iMSec ); hb_snprintf( szTime, 13, "%02d:%02d:%02d.%03d", @@ -514,7 +500,7 @@ HB_BOOL hb_timeStrGet( const char * szTime, int iHour, iMinutes, iSeconds, iMSec, iBlocks; HB_BOOL fValid; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStrGet(%s, %p, %p, %p, %p)", szTime, piHour, piMinutes, piSeconds, piMSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStrGet(%s, %p, %p, %p, %p)", szTime, ( void * ) piHour, ( void * ) piMinutes, ( void * ) piSeconds, ( void * ) piMSec ) ); iHour = iMinutes = iSeconds = iMSec = iBlocks = 0; fValid = HB_FALSE; @@ -607,7 +593,7 @@ void hb_timeStrRawGet( const char * szTime, int * piHour, int * piMinutes, int * piSeconds, int * piMSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStrRawGet(%.10s, %p, %p, %p, %p)", szTime, piHour, piMinutes, piSeconds, piMSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStrRawGet(%.10s, %p, %p, %p, %p)", szTime, ( void * ) piHour, ( void * ) piMinutes, ( void * ) piSeconds, ( void * ) piMSec ) ); *piHour = *piMinutes = *piSeconds = *piMSec = 0; @@ -664,7 +650,7 @@ char * hb_timeStampStrRawPut( char * szDateTime, long lJulian, long lMilliSec ) { int iYear, iMonth, iDay, iHour, iMinutes, iSeconds, iMSec; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStrRawPut(%p, %ld, %ld)", szDateTime, lJulian, lMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStrRawPut(%p, %ld, %ld)", ( void * ) szDateTime, lJulian, lMilliSec ) ); hb_dateDecode( lJulian, &iYear, &iMonth, &iDay ); hb_dateStrPut( szDateTime, iYear, iMonth, iDay ); @@ -679,7 +665,7 @@ void hb_timeStampStrRawGet( const char * szDateTime, long * plJulian, long * plM { int iYear, iMonth, iDay, iHour, iMinutes, iSeconds, iMSec, iLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStrRawGet(%s, %p, %p)", szDateTime, plJulian, plMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStrRawGet(%s, %p, %p)", szDateTime, ( void * ) plJulian, ( void * ) plMilliSec ) ); *plJulian = *plMilliSec = 0; @@ -710,7 +696,7 @@ char * hb_timeStampStr( char * szDateTime, long lJulian, long lMilliSec ) { int iYear, iMonth, iDay, iHour, iMinutes, iSeconds, iMSec; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStr(%p, %ld, %ld)", szDateTime, lJulian, lMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStr(%p, %ld, %ld)", ( void * ) szDateTime, lJulian, lMilliSec ) ); hb_dateDecode( lJulian, &iYear, &iMonth, &iDay ); hb_timeDecode( lMilliSec, &iHour, &iMinutes, &iSeconds, &iMSec ); @@ -729,7 +715,7 @@ HB_BOOL hb_timeStampStrGet( const char * szDateTime, int iYear, iMonth, iDay; HB_BOOL fValid; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStrGet(%s, %p, %p, %p, %p, %p, %p, %p)", szDateTime, piYear, piMonth, piDay, piHour, piMinutes, piSeconds, piMSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStrGet(%s, %p, %p, %p, %p, %p, %p, %p)", szDateTime, ( void * ) piYear, ( void * ) piMonth, ( void * ) piDay, ( void * ) piHour, ( void * ) piMinutes, ( void * ) piSeconds, ( void * ) piMSec ) ); iYear = iMonth = iDay = 0; fValid = HB_FALSE; @@ -854,7 +840,7 @@ HB_BOOL hb_timeStampStrGetDT( const char * szDateTime, int iYear, iMonth, iDay, iHour, iMinutes, iSeconds, iMSec; HB_BOOL fValid; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStrGetDT(%s, %p, %p)", szDateTime, plJulian, plMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampStrGetDT(%s, %p, %p)", szDateTime, ( void * ) plJulian, ( void * ) plMilliSec ) ); fValid = hb_timeStampStrGet( szDateTime, &iYear, &iMonth, &iDay, &iHour, &iMinutes, &iSeconds, &iMSec ); @@ -877,7 +863,7 @@ double hb_timeStampPackDT( long lJulian, long lMilliSec ) void hb_timeStampUnpackDT( double dTimeStamp, long * plJulian, long * plMilliSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampUnpackDT(%f, %p, %p)", dTimeStamp, plJulian, plMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampUnpackDT(%f, %p, %p)", dTimeStamp, ( void * ) plJulian, ( void * ) plMilliSec ) ); { #if defined( HB_LONG_LONG_OFF ) @@ -930,7 +916,7 @@ void hb_timeStampUnpack( double dTimeStamp, { long lJulian, lMilliSec; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampUnpack(%f, %p, %p, %p, %p, %p, %p, %p)", dTimeStamp, piYear, piMonth, piDay, piHour, piMinutes, piSeconds, piMSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampUnpack(%f, %p, %p, %p, %p, %p, %p, %p)", dTimeStamp, ( void * ) piYear, ( void * ) piMonth, ( void * ) piDay, ( void * ) piHour, ( void * ) piMinutes, ( void * ) piSeconds, ( void * ) piMSec ) ); hb_timeStampUnpackDT( dTimeStamp, &lJulian, &lMilliSec ); hb_dateDecode( lJulian, piYear, piMonth, piDay ); @@ -967,7 +953,7 @@ void hb_timeStampUnpackD( double dTimeStamp, long lJulian, lMilliSec; int iSeconds, iMSec; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampUnpackD(%f, %p, %p, %p, %p, %p, %p)", dTimeStamp, piYear, piMonth, piDay, piHour, piMinutes, pdSeconds ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampUnpackD(%f, %p, %p, %p, %p, %p, %p)", dTimeStamp, ( void * ) piYear, ( void * ) piMonth, ( void * ) piDay, ( void * ) piHour, ( void * ) piMinutes, ( void * ) pdSeconds ) ); hb_timeStampUnpackDT( dTimeStamp, &lJulian, &lMilliSec ); hb_dateDecode( lJulian, piYear, piMonth, piDay ); @@ -1187,7 +1173,7 @@ HB_MAXUINT hb_timerInit( HB_MAXINT nTimeOut ) HB_MAXINT hb_timerTest( HB_MAXINT nTimeOut, HB_MAXUINT * pnTimer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_timerTest(%" PFHL "d, %p)", nTimeOut, pnTimer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timerTest(%" PFHL "d, %p)", nTimeOut, ( void * ) pnTimer ) ); if( nTimeOut > 0 ) { diff --git a/src/common/hbffind.c b/src/common/hbffind.c index d9225aa9ff..f5f31d205d 100644 --- a/src/common/hbffind.c +++ b/src/common/hbffind.c @@ -58,7 +58,7 @@ #include "hbdate.h" #include "hb_io.h" -/* ------------------------------------------------------------- */ +/* --- */ #if defined( HB_OS_DOS ) @@ -178,8 +178,8 @@ #if defined( __USE_LARGEFILE64 ) /* * The macro: __USE_LARGEFILE64 is set when _LARGEFILE64_SOURCE is - * defined and effectively enables lseek64/flock64/ftruncate64 functions - * on 32bit machines. + * defined and effectively enables lseek64()/flock64()/ftruncate64() + * functions on 32-bit machines. */ #define HB_USE_LARGEFILE64 #elif defined( HB_OS_UNIX ) && defined( O_LARGEFILE ) @@ -187,7 +187,7 @@ #endif #endif -/* ------------------------------------------------------------- */ +/* --- */ HB_FATTR hb_fsAttrFromRaw( HB_FATTR raw_attr ) { @@ -344,7 +344,7 @@ HB_FATTR hb_fsAttrToRaw( HB_FATTR nAttr ) } /* Converts a CA-Cl*pper compatible file attribute string - to the internal reprensentation. */ + to the internal representation. */ HB_FATTR hb_fsAttrEncode( const char * szAttr ) { @@ -352,7 +352,7 @@ HB_FATTR hb_fsAttrEncode( const char * szAttr ) char ch; HB_FATTR nAttr = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsAttrEncode(%p)", szAttr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsAttrEncode(%p)", ( const void * ) szAttr ) ); while( ( ch = ( char ) HB_TOUPPER( *pos ) ) != '\0' ) { @@ -382,7 +382,7 @@ char * hb_fsAttrDecode( HB_FATTR nAttr, char * szAttr ) { char * ptr = szAttr; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsAttrDecode(%u, %p)", nAttr, szAttr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsAttrDecode(%u, %p)", nAttr, ( void * ) szAttr ) ); /* Using the same order as CA-Cl*pper did: RHSVDA. */ if( nAttr & HB_FA_READONLY ) *ptr++ = 'R'; @@ -423,7 +423,7 @@ static HB_BOOL hb_fsFindNextLow( PHB_FFIND ffind ) ffind->szName[ 0 ] = '\0'; ffind->size = 0; - /* Do platform dependant first/next search */ + /* Do platform dependent first/next search */ hb_vmUnlock(); @@ -686,7 +686,7 @@ static HB_BOOL hb_fsFindNextLow( PHB_FFIND ffind ) else { #if defined( __XCC__ ) || ( defined( __POCC__ ) && __POCC__ >= 500 ) - /* NOTE: PellesC 5.00.1 will go into an infinite loop if we don't + /* NOTE: Pelles C 5.00.1 will go into an infinite loop if we don't split this into two operations. [vszakats] */ ffind->size = ( HB_FOFFSET ) info->pFindFileData.nFileSizeLow; ffind->size += ( HB_FOFFSET ) info->pFindFileData.nFileSizeHigh << 32; @@ -964,7 +964,7 @@ void hb_fsFindClose( PHB_FFIND ffind ) if( ffind->pszFree ) hb_xfree( ffind->pszFree ); - /* Do platform dependant cleanup */ + /* Do platform dependent cleanup */ if( ffind->info ) { diff --git a/src/common/hbfopen.c b/src/common/hbfopen.c index e4f5e73920..e39a0b3f47 100644 --- a/src/common/hbfopen.c +++ b/src/common/hbfopen.c @@ -1,5 +1,5 @@ /* - * + * hb_fopen() function * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/common/hbfsapi.c b/src/common/hbfsapi.c index 7582b17d92..22b26dfe6f 100644 --- a/src/common/hbfsapi.c +++ b/src/common/hbfsapi.c @@ -83,7 +83,7 @@ /* * The macro: __USE_LARGEFILE64 is set when _LARGEFILE64_SOURCE is * defined and effectively enables lseek64/flock64/ftruncate64 functions - * on 32bit machines. + * on 32-bit machines. */ #define HB_USE_LARGEFILE64 #elif defined( HB_OS_UNIX ) && defined( O_LARGEFILE ) @@ -235,7 +235,7 @@ PHB_FNAME hb_fsFNameSplit( const char * pszFileName ) } /* NOTE: szFileName buffer must be at least HB_PATH_MAX long. - * Because some freign code may not be updated yet then + * Because some foreign code may not be updated yet then * hb_fsFNameMerge() effectively uses only HB_PATH_MAX buffer * but it will be changed in the future. */ @@ -243,7 +243,7 @@ PHB_FNAME hb_fsFNameSplit( const char * pszFileName ) /* This function joins path, name and extension into a string with a filename */ char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_fsFNameMerge(%p, %p)", pszFileName, pFileName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsFNameMerge(%p, %p)", ( void * ) pszFileName, ( void * ) pFileName ) ); if( pszFileName && pFileName ) { @@ -569,7 +569,7 @@ HB_BOOL hb_fsNameExists( const char * pszFileName ) { HB_BOOL fExist = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsNameExists(%p)", pszFileName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsNameExists(%p)", ( const void * ) pszFileName ) ); if( pszFileName != NULL ) { @@ -621,7 +621,7 @@ HB_BOOL hb_fsFileExists( const char * pszFileName ) { HB_BOOL fExist = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsFileExists(%p)", pszFileName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsFileExists(%p)", ( const void * ) pszFileName ) ); if( pszFileName != NULL ) { @@ -683,7 +683,7 @@ HB_BOOL hb_fsDirExists( const char * pszDirName ) { HB_BOOL fExist = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsDirExists(%p)", pszDirName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsDirExists(%p)", ( const void * ) pszDirName ) ); if( pszDirName != NULL ) { diff --git a/src/common/hbhash.c b/src/common/hbhash.c index b2564dea7a..e90e3c40fa 100644 --- a/src/common/hbhash.c +++ b/src/common/hbhash.c @@ -66,7 +66,7 @@ static void hb_hashItemDelete( PHB_HASH_TABLE pTable, PHB_HASH_ITEM pItem ) } /* create a new hash table - * nSize = initial numer of items in the table + * nSize = initial number of items in the table * pHashTable = a function that calculates a hash key value * (first parameter is a value to add) * pDelete = a function that clears item's value before item's releasing @@ -103,11 +103,10 @@ void hb_hashTableKill( PHB_HASH_TABLE pTable ) { if( pTable->pItems[ nSize ] ) { - PHB_HASH_ITEM pItem, pFree; - pItem = pTable->pItems[ nSize ]; + PHB_HASH_ITEM pItem = pTable->pItems[ nSize ]; while( pItem ) { - pFree = pItem; + PHB_HASH_ITEM pFree = pItem; pItem = pItem->next; hb_hashItemDelete( pTable, pFree ); } @@ -171,7 +170,7 @@ PHB_HASH_TABLE hb_hashTableResize( PHB_HASH_TABLE pTable, HB_SIZE nNewSize ) return pNew; } -/* add a new value into th ehash table */ +/* add a new value into the hash table */ HB_BOOL hb_hashTableAdd( PHB_HASH_TABLE pTable, const void * pKey, const void * pValue ) { HB_SIZE nKey; diff --git a/src/common/hbmem.c b/src/common/hbmem.c index ebb17f6cf0..1ed62ba868 100644 --- a/src/common/hbmem.c +++ b/src/common/hbmem.c @@ -49,7 +49,7 @@ /* hb_xmemcpy() and hb_xmemset() are only needed when unsigned int and unsigned long differ in length */ -/* unfortunately it's not true - on 64bit platforms int is 32 bit +/* unfortunately it's not true - on 64-bit platforms int is 32 bits and long is 64. we need these functions only when max(size_t) < max(long) what could be detected and set in header files. Here check diff --git a/src/common/hbprintf.c b/src/common/hbprintf.c index d600dce33a..117b5259d1 100644 --- a/src/common/hbprintf.c +++ b/src/common/hbprintf.c @@ -45,13 +45,13 @@ */ /* - patterm format: + pattern format: '%' [<flags>*] [<field width>] [.<precision>] [<length modifier>] <conversion specifier> */ /* - The folowwing conversions are not explicitly supported: + The following conversions are not explicitly supported: A, a E, e G, g @@ -62,7 +62,7 @@ S (or Ls) These are wide character conversions and needs locale settings. - double conversion if not necessary can be disabled to not create unnencessary + double conversion if not necessary can be disabled to not create unnecessary overhead and/or references to math library by #define __NO_DOUBLE__ It can be also greatly optimized anyhow it will increase dependences list and @@ -109,7 +109,7 @@ /* few macros for some platform dependent floating point functions/macros */ -#if ( defined( __BORLANDC__ ) && __BORLANDC__ < 0x582 ) || \ +#if ( defined( __BORLANDC__ ) && __BORLANDC__ < 0x0582 ) || \ ( defined( __WATCOMC__ ) && __WATCOMC__ < 1270 ) || \ defined( HB_OS_QNX ) || defined( HB_OS_SYMBIAN ) || \ defined( __DCC__ ) || defined( __TINYC__ ) || \ @@ -411,8 +411,7 @@ static size_t put_octal( char *buffer, size_t bufsize, size_t size, uintmax_t value, int flags, int width, int precision ) { uintmax_t v = value; - int nums = 0, n; - char c; + int nums = 0; while( v ) { @@ -439,10 +438,10 @@ static size_t put_octal( char *buffer, size_t bufsize, size_t size, } if( nums ) { - n = nums; + int n = nums; do { - c = ( char ) ( value & 0x7 ) + '0'; + char c = ( char ) ( value & 0x7 ) + '0'; value >>= 3; --n; if( size + n < bufsize ) @@ -467,8 +466,7 @@ static size_t put_dec( char *buffer, size_t bufsize, size_t size, int sign ) { uintmax_t v = value; - int nums = 0, n; - char c; + int nums = 0; while( v ) { @@ -499,15 +497,15 @@ static size_t put_dec( char *buffer, size_t bufsize, size_t size, if( ( flags & ( _F_SPACE | _F_SIGN ) ) || sign ) { if( size < bufsize ) - buffer[ size ] = sign ? '-' : ( flags & _F_SIGN ? '+' : ' ' ); + buffer[ size ] = sign ? '-' : ( ( flags & _F_SIGN ) ? '+' : ' ' ); ++size; } if( nums ) { - n = nums; + int n = nums; do { - c = ( char ) ( value % 10 ) + '0'; + char c = ( char ) ( value % 10 ) + '0'; value /= 10; --n; if( size + n < bufsize ) @@ -571,7 +569,7 @@ static size_t put_dbl( char *buffer, size_t bufsize, size_t size, while( value >= 1 ); width -= nums; c = ( ( flags & ( _F_SPACE | _F_SIGN ) ) || sign ) ? - ( buffer[ size ] = sign ? '-' : ( flags & _F_SIGN ? '+' : ' ' ) ) : 0; + ( buffer[ size ] = sign ? '-' : ( ( flags & _F_SIGN ) ? '+' : ' ' ) ) : 0; if( ( flags & _F_LEFTADJUSTED ) == 0 && width > 0 ) { if( c && ( flags & _F_ZEROPADED ) ) @@ -592,7 +590,7 @@ static size_t put_dbl( char *buffer, size_t bufsize, size_t size, if( c ) { if( size < bufsize ) - buffer[ size ] = sign ? '-' : ( flags & _F_SIGN ? '+' : ' ' ); + buffer[ size ] = sign ? '-' : ( ( flags & _F_SIGN ) ? '+' : ' ' ); ++size; } @@ -640,8 +638,7 @@ static size_t put_hex( char *buffer, size_t bufsize, size_t size, int upper ) { uintmax_t v = value; - int nums = 0, n; - char c; + int nums = 0; while( v ) { @@ -687,10 +684,10 @@ static size_t put_hex( char *buffer, size_t bufsize, size_t size, } if( nums ) { - n = nums; + int n = nums; do { - c = ( char ) ( value & 0x0f ) + '0'; + char c = ( char ) ( value & 0x0f ) + '0'; if( c > '9' ) c += upper ? 'A' - '9' - 1 : 'a' - '9' - 1; value >>= 4; @@ -1233,14 +1230,14 @@ int hb_vsnprintf( char * buffer, size_t bufsize, const char * format, va_list ap if( value & _HB_NUM_NAN ) size = put_str( buffer, bufsize, size, c == 'f' ? - ( flags & _F_SIGN ? "+nan": "nan" ) : - ( flags & _F_SIGN ? "+NAN": "NAN" ) , + ( ( flags & _F_SIGN ) ? "+nan": "nan" ) : + ( ( flags & _F_SIGN ) ? "+NAN": "NAN" ) , flags, width, -1 ); else if( value & _HB_NUM_PINF ) size = put_str( buffer, bufsize, size, c == 'f' ? - ( flags & _F_SIGN ? "+inf": "inf" ) : - ( flags & _F_SIGN ? "+INF": "INF" ), + ( ( flags & _F_SIGN ) ? "+inf": "inf" ) : + ( ( flags & _F_SIGN ) ? "+INF": "INF" ), flags, width, -1 ); else if( value & _HB_NUM_NINF ) size = put_str( buffer, bufsize, size, diff --git a/src/common/hbstr.c b/src/common/hbstr.c index 970a17a373..40083d5ca5 100644 --- a/src/common/hbstr.c +++ b/src/common/hbstr.c @@ -2,6 +2,7 @@ * Harbour common string functions (accessed from standalone utilities and the RTL) * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> (hb_stricmp()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * hb_stricmp() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbmath.h" @@ -255,12 +246,14 @@ HB_SIZE hb_strlentrim( const char * pszText ) int hb_stricmp( const char * s1, const char * s2 ) { - int rc = 0, c1, c2; + int rc = 0, c1; HB_TRACE( HB_TR_DEBUG, ( "hb_stricmp(%s, %s)", s1, s2 ) ); do { + int c2; + c1 = HB_TOUPPER( ( unsigned char ) *s1 ); c2 = HB_TOUPPER( ( unsigned char ) *s2 ); @@ -278,7 +271,7 @@ int hb_stricmp( const char * s1, const char * s2 ) return rc; } -/* warning: It is not case sensitive */ +/* Warning: It is not case sensitive */ int hb_strnicmp( const char * s1, const char * s2, HB_SIZE count ) { HB_SIZE nCount; @@ -306,14 +299,14 @@ int hb_strnicmp( const char * s1, const char * s2, HB_SIZE count ) /* AJ: 2004-02-23 Concatenates multiple strings into a single result. - Eg. hb_xstrcat (buffer, "A", "B", NULL) stores "AB" in buffer. + Eg. hb_xstrcat( buffer, "A", "B", NULL ) stores "AB" in buffer. */ char * hb_xstrcat( char * szDest, const char * szSrc, ... ) { char * szResult = szDest; va_list va; - HB_TRACE( HB_TR_DEBUG, ( "hb_xstrcat(%p, %p, ...)", szDest, szSrc ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xstrcat(%p, %p, ...)", ( void * ) szDest, ( const void * ) szSrc ) ); while( *szDest ) szDest++; @@ -346,7 +339,7 @@ char * hb_xstrcpy( char * szDest, const char * szSrc, ... ) char * szResult; va_list va; - HB_TRACE( HB_TR_DEBUG, ( "hb_xstrcpy(%p, %p, ...)", szDest, szSrc ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xstrcpy(%p, %p, ...)", ( void * ) szDest, ( const void * ) szSrc ) ); if( szDest == NULL ) { @@ -438,7 +431,7 @@ double hb_numRound( double dNum, int iDec ) * numbers so we can decrease the precision to 15 digits and use * the cut part for proper rounding. It should resolve * most of problems. But if someone totally not understand FL - * and will try to convert big matrix or sth like that it's quite + * and will try to convert big matrix or something like that it's quite * possible that he chose one of the natural school algorithm which * works nice with real numbers but can give very bad results in FL. * In such case it could be good to decrease precision even more. @@ -569,7 +562,7 @@ static HB_BOOL hb_str2number( HB_BOOL fPCode, const char * szNum, HB_SIZE nLen, int iLen, iPos = 0; int c, iWidth, iDec = 0, iDecR = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_str2number(%d, %p, %" HB_PFS "u, %p, %p, %p, %p)", ( int ) fPCode, szNum, nLen, lVal, dVal, piDec, piWidth ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_str2number(%d, %p, %" HB_PFS "u, %p, %p, %p, %p)", ( int ) fPCode, ( const void * ) szNum, nLen, ( void * ) lVal, ( void * ) dVal, ( void * ) piDec, ( void * ) piWidth ) ); iLen = ( int ) nLen; @@ -733,25 +726,25 @@ static HB_BOOL hb_str2number( HB_BOOL fPCode, const char * szNum, HB_SIZE nLen, HB_BOOL hb_compStrToNum( const char * szNum, HB_SIZE nLen, HB_MAXINT * plVal, double * pdVal, int * piDec, int * piWidth ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_compStrToNum( %s, %" HB_PFS "u, %p, %p, %p, %p)", szNum, nLen, plVal, pdVal, piDec, piWidth ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compStrToNum( %s, %" HB_PFS "u, %p, %p, %p, %p)", szNum, nLen, ( void * ) plVal, ( void * ) pdVal, ( void * ) piDec, ( void * ) piWidth ) ); return hb_str2number( HB_TRUE, szNum, nLen, plVal, pdVal, piDec, piWidth ); } HB_BOOL hb_valStrnToNum( const char * szNum, HB_SIZE nLen, HB_MAXINT * plVal, double * pdVal, int * piDec, int * piWidth ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_valStrnToNum( %s, %" HB_PFS "u, %p, %p, %p, %p)", szNum, nLen, plVal, pdVal, piDec, piWidth ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_valStrnToNum( %s, %" HB_PFS "u, %p, %p, %p, %p)", szNum, nLen, ( void * ) plVal, ( void * ) pdVal, ( void * ) piDec, ( void * ) piWidth ) ); return hb_str2number( HB_FALSE, szNum, nLen, plVal, pdVal, piDec, piWidth ); } HB_BOOL hb_strToNum( const char * szNum, HB_MAXINT * plVal, double * pdVal ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_strToNum(%s, %p, %p)", szNum, plVal, pdVal ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strToNum(%s, %p, %p)", szNum, ( void * ) plVal, ( void * ) pdVal ) ); return hb_str2number( HB_FALSE, szNum, strlen( szNum ), plVal, pdVal, NULL, NULL ); } HB_BOOL hb_strnToNum( const char * szNum, HB_SIZE nLen, HB_MAXINT * plVal, double * pdVal ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_strnToNum(%.*s, %" HB_PFS "u, %p, %p)", ( int ) nLen, szNum, nLen, plVal, pdVal ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strnToNum(%.*s, %" HB_PFS "u, %p, %p)", ( int ) nLen, szNum, nLen, ( void * ) plVal, ( void * ) pdVal ) ); return hb_str2number( HB_FALSE, szNum, nLen, plVal, pdVal, NULL, NULL ); } @@ -789,7 +782,7 @@ char * hb_numToStr( char * szBuf, HB_SIZE nSize, HB_MAXINT lNumber ) int iPos = ( int ) nSize; HB_BOOL fNeg = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_numToStr(%p, %" HB_PFS "u, %" PFHL "i)", szBuf, nSize, lNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_numToStr(%p, %" HB_PFS "u, %" PFHL "i)", ( void * ) szBuf, nSize, lNumber ) ); szBuf[ --iPos ] = '\0'; if( lNumber < 0 ) @@ -830,7 +823,7 @@ char * hb_dblToStr( char * szBuf, HB_SIZE nSize, double dNumber, int iMaxDec ) char * szResult; HB_BOOL fFirst; - HB_TRACE( HB_TR_DEBUG, ( "hb_dblToStr(%p, %" HB_PFS "u, %f, %d)", szBuf, nSize, dNumber, iMaxDec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dblToStr(%p, %" HB_PFS "u, %f, %d)", ( void * ) szBuf, nSize, dNumber, iMaxDec ) ); iLen = ( int ) ( nSize - 1 ); if( iLen <= 0 ) @@ -955,8 +948,7 @@ char * hb_dblToStr( char * szBuf, HB_SIZE nSize, double dNumber, int iMaxDec ) return iPos == 1 && *szResult == '-' && *szBuf == '0' ? szBuf : szResult; } -/* - * This function copies szText to destination buffer. +/* This function copies szText to destination buffer. * NOTE: Unlike the documentation for strncpy, this routine will always append * a null and the nLen param is pDest size not pSource limit */ @@ -964,7 +956,7 @@ char * hb_strncpy( char * pDest, const char * pSource, HB_SIZE nLen ) { char * pBuf = pDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_strncpy(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strncpy(%p, %.*s, %" HB_PFS "u)", ( void * ) pDest, ( int ) nLen, pSource, nLen ) ); pDest[ nLen ] = '\0'; @@ -974,8 +966,7 @@ char * hb_strncpy( char * pDest, const char * pSource, HB_SIZE nLen ) return pBuf; } -/* - * This function copies szText to destination buffer. +/* This function copies szText to destination buffer. * NOTE: Unlike the documentation for strncat, this routine will always append * a null and the nLen param is pDest size not pSource limit */ @@ -983,7 +974,7 @@ char * hb_strncat( char * pDest, const char * pSource, HB_SIZE nLen ) { char * pBuf = pDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_strncat(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strncat(%p, %.*s, %" HB_PFS "u)", ( void * ) pDest, ( int ) nLen, pSource, nLen ) ); pDest[ nLen ] = '\0'; @@ -999,18 +990,16 @@ char * hb_strncat( char * pDest, const char * pSource, HB_SIZE nLen ) return pBuf; } -/* This function copies and converts szText to lower case. - */ -/* - * NOTE: Unlike the documentation for strncpy, this routine will always append - * a null - * pt +/* This function copies and converts szText to lower case. */ + +/* NOTE: Unlike the documentation for strncpy, this routine will always append + * a null [pt] */ char * hb_strncpyLower( char * pDest, const char * pSource, HB_SIZE nLen ) { char * pBuf = pDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_strncpyLower(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strncpyLower(%p, %.*s, %" HB_PFS "u)", ( void * ) pDest, ( int ) nLen, pSource, nLen ) ); pDest[ nLen ] = '\0'; @@ -1023,18 +1012,16 @@ char * hb_strncpyLower( char * pDest, const char * pSource, HB_SIZE nLen ) return pBuf; } -/* This function copies and converts szText to upper case. - */ -/* - * NOTE: Unlike the documentation for strncpy, this routine will always append - * a null - * pt +/* This function copies and converts szText to upper case. */ + +/* NOTE: Unlike the documentation for strncpy, this routine will always append + * a null [pt] */ char * hb_strncpyUpper( char * pDest, const char * pSource, HB_SIZE nLen ) { char * pBuf = pDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_strncpyUpper(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strncpyUpper(%p, %.*s, %" HB_PFS "u)", ( void * ) pDest, ( int ) nLen, pSource, nLen ) ); pDest[ nLen ] = '\0'; @@ -1047,19 +1034,17 @@ char * hb_strncpyUpper( char * pDest, const char * pSource, HB_SIZE nLen ) return pBuf; } -/* This function copies and converts szText to upper case AND Trims it - */ -/* - * NOTE: Unlike the documentation for strncpy, this routine will always append - * a null - * pt +/* This function copies and converts szText to upper case AND Trims it */ + +/* NOTE: Unlike the documentation for strncpy, this routine will always append + * a null [pt] */ char * hb_strncpyUpperTrim( char * pDest, const char * pSource, HB_SIZE nLen ) { char * pBuf = pDest; HB_SIZE nSLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_strncpyUpperTrim(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strncpyUpperTrim(%p, %.*s, %" HB_PFS "u)", ( void * ) pDest, ( int ) nLen, pSource, nLen ) ); nSLen = 0; while( nSLen < nLen && pSource[ nSLen ] ) @@ -1081,9 +1066,9 @@ char * hb_strncpyUpperTrim( char * pDest, const char * pSource, HB_SIZE nLen ) return pBuf; } -/* - * This function copies trimed szText to destination buffer. - * NOTE: Unlike the documentation for strncpy, this routine will always append +/* This function copies trimed szText to destination buffer. */ + +/* NOTE: Unlike the documentation for strncpy, this routine will always append * a null */ char * hb_strncpyTrim( char * pDest, const char * pSource, HB_SIZE nLen ) @@ -1091,7 +1076,7 @@ char * hb_strncpyTrim( char * pDest, const char * pSource, HB_SIZE nLen ) char * pBuf = pDest; HB_SIZE nSLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_strncpyTrim(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strncpyTrim(%p, %.*s, %" HB_PFS "u)", ( void * ) pDest, ( int ) nLen, pSource, nLen ) ); nSLen = 0; while( nSLen < nLen && pSource[ nSLen ] ) diff --git a/src/common/hbstrbm.c b/src/common/hbstrbm.c index 04878822af..7d2471e6fe 100644 --- a/src/common/hbstrbm.c +++ b/src/common/hbstrbm.c @@ -1,7 +1,7 @@ /* * Turbo Boyer-Moore (Crochemore) string search * Based on this code: - * http://www-igm.univ-mlv.fr/~lecroq/string/node15.html + * https://web.archive.org/web/www-igm.univ-mlv.fr/~lecroq/string/node15.html * Authors: * Christian Charras, Thierry Lecroq * @@ -112,7 +112,7 @@ static void preBmGs( const char * needle, HB_ISIZ m, HB_ISIZ bmGs[] ) HB_ISIZ hb_strAtTBM( const char * needle, HB_ISIZ m, const char * haystack, HB_ISIZ n ) { HB_ISIZ r = 0; - HB_ISIZ bcShift, i, j, shift, u, v, turboShift; + HB_ISIZ bcShift, j, shift, u, v, turboShift; HB_ISIZ bmBc[ ASIZE ]; HB_ISIZ * bmGs; @@ -127,7 +127,7 @@ HB_ISIZ hb_strAtTBM( const char * needle, HB_ISIZ m, const char * haystack, HB_I shift = m; while( j <= n - m ) { - i = m - 1; + HB_ISIZ i = m - 1; while( i >= 0 && needle[ i ] == haystack[ i + j ] ) { --i; diff --git a/src/common/hbtrace.c b/src/common/hbtrace.c index 6ef7996f8e..8ccad38c59 100644 --- a/src/common/hbtrace.c +++ b/src/common/hbtrace.c @@ -1,5 +1,5 @@ /* - * Tracing functions. + * Tracing functions * * Copyright 2009 Viktor Szakats (vszakats.net/harbour) * Copyright 1999 Gonzalo Diethelm <gonzalo.diethelm@iname.com> @@ -386,7 +386,7 @@ void hb_tr_trace( const char * fmt, ... ) pTrace->level = -1; /* NOTE: resetting file name/line number will cause that we will unable * to report the location of code that allocated unreleased memory blocks - * See hb_xalloc/hb_xgrab in src/vm/fm.c + * See hb_xalloc()/hb_xgrab() in src/vm/fm.c */ if( hb_tr_level() < HB_TR_DEBUG ) { diff --git a/src/common/hbver.c b/src/common/hbver.c index 3c8f3d5e87..938395af0e 100644 --- a/src/common/hbver.c +++ b/src/common/hbver.c @@ -265,7 +265,7 @@ const char * hb_verPlatformMacro( void ) } /* NOTE: Must be larger than 128, which is the maximum size of - osVer.szCSDVersion (Windows). [vszakats] */ + osvi.szCSDVersion (Windows). [vszakats] */ #define PLATFORM_BUF_SIZE 255 char * hb_verPlatform( void ) @@ -339,19 +339,15 @@ char * hb_verPlatform( void ) { unsigned long aulQSV[ QSV_MAX ] = { 0 }; - APIRET rc; - - rc = DosQuerySysInfo( 1L, QSV_MAX, ( void * ) aulQSV, sizeof( ULONG ) * QSV_MAX ); + APIRET rc = DosQuerySysInfo( 1L, QSV_MAX, ( void * ) aulQSV, sizeof( ULONG ) * QSV_MAX ); if( rc == 0 ) { /* is this OS/2 2.x ? */ if( aulQSV[ QSV_VERSION_MINOR - 1 ] < 30 ) - { hb_snprintf( pszPlatform, PLATFORM_BUF_SIZE + 1, "OS/2 %ld.%02ld", aulQSV[ QSV_VERSION_MAJOR - 1 ] / 10, aulQSV[ QSV_VERSION_MINOR - 1 ] ); - } else hb_snprintf( pszPlatform, PLATFORM_BUF_SIZE + 1, "OS/2 %2.2f", ( float ) aulQSV[ QSV_VERSION_MINOR - 1 ] / 10 ); diff --git a/src/common/strwild.c b/src/common/strwild.c index 520af927eb..cfb4937995 100644 --- a/src/common/strwild.c +++ b/src/common/strwild.c @@ -1,5 +1,5 @@ /* - * wildcards / file match functions + * Wildcards / file match functions * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/compiler/cmdcheck.c b/src/compiler/cmdcheck.c index ea858b410e..c7cd8560f8 100644 --- a/src/compiler/cmdcheck.c +++ b/src/compiler/cmdcheck.c @@ -1,5 +1,5 @@ /* - * Compiler command line and environment parameters checking + * Compiler command-line and environment parameters checking * * Copyright 2015 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -119,7 +119,7 @@ static void hb_compChkIgnoredInfo( HB_COMP_DECL, const char * szSwitch ) char buffer[ 64 ]; hb_snprintf( buffer, sizeof( buffer ), - "Ignored unsupported command line option: %s\n", szSwitch ); + "Ignored unsupported command-line option: %s\n", szSwitch ); hb_compOutStd( HB_COMP_PARAM, buffer ); } @@ -455,6 +455,7 @@ static const char * hb_compChkParseSwitch( HB_COMP_DECL, const char * szSwitch, break; default: szSwPtr = hb_compChkOptionAddPath( HB_COMP_PARAM, szSwPtr, fEnv ); + break; } break; @@ -592,6 +593,7 @@ static const char * hb_compChkParseSwitch( HB_COMP_DECL, const char * szSwitch, default: ch = -1; --szSwPtr; + break; } if( ch == -1 ) break; @@ -693,6 +695,7 @@ static const char * hb_compChkParseSwitch( HB_COMP_DECL, const char * szSwitch, /* fallthrough */ default: HB_COMP_PARAM->fQuiet = HB_TRUE; + break; } break; @@ -838,7 +841,7 @@ static const char * hb_compChkParseSwitch( HB_COMP_DECL, const char * szSwitch, return ""; } -/* check command line parameters */ +/* check command-line parameters */ void hb_compChkCommandLine( HB_COMP_DECL, int argc, const char * const argv[] ) { int i; diff --git a/src/compiler/compi18n.c b/src/compiler/compi18n.c index 24eabd59d6..646dd6d88c 100644 --- a/src/compiler/compi18n.c +++ b/src/compiler/compi18n.c @@ -44,11 +44,8 @@ * */ - #include "hbcomp.h" - -/* ============================ I18N ============================ */ static PHB_I18NTABLE hb_compI18nCreate( void ) { PHB_I18NTABLE pI18n; diff --git a/src/compiler/complex.c b/src/compiler/complex.c index b85b1933f2..4499245852 100644 --- a/src/compiler/complex.c +++ b/src/compiler/complex.c @@ -1,6 +1,6 @@ /* - * compiler lexer which converts PP tokens to the ones which - * grammar parser generated by bison can understand + * Compiler lexer which converts PP tokens to the ones which + * grammar parser generated by bison can understand * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -45,8 +45,8 @@ * */ -#include "hbpp.h" #include "hbcomp.h" +#include "hbpp.h" #include "hbdate.h" #include "harboury.h" @@ -378,7 +378,7 @@ static int hb_comp_dayTimeDecode( PHB_COMP_LEX pLex, PHB_PP_TOKEN pToken, * VFP accepts slash, dot or hyphen as date delimiter and * 12 or 24-hour formatted time, * If only hours are included in time part then comma have to - * be used to separate date and time parts or it's necesary + * be used to separate date and time parts or it's necessary * to follow the hours with a colon. * { ^ <YEAR> <sep:/.-> <MONTH> <sep:/.-> <DAY> [[<sep2:,>] * [ <HOUR> [ : <MIN> [ : <SEC> [ . <FRAQ> ] ] ] [AM|PP] ] } @@ -872,7 +872,7 @@ int hb_comp_yylex( YYSTYPE * yylval_ptr, HB_COMP_DECL ) if( ! HB_SUPPORT_HARBOUR && HB_COMP_PARAM->iSyntaxCheckOnly < 2 ) { /* Clipper does not like end[], end(), end->, end-- & end++ at - the begining of line */ + the beginning of line */ if( HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_LEFT_PB || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_LEFT_SB || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_INC || @@ -974,7 +974,7 @@ int hb_comp_yylex( YYSTYPE * yylval_ptr, HB_COMP_DECL ) if( ! HB_SUPPORT_HARBOUR && HB_COMP_PARAM->iSyntaxCheckOnly < 2 ) { /* Clipper does not like NEXT[], NEXT(), NEXT->, - NEXT++ & NEXT-- at the begining of line */ + NEXT++ & NEXT-- at the beginning of line */ if( HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_LEFT_PB || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_LEFT_SB || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_INC || diff --git a/src/compiler/expropta.c b/src/compiler/expropta.c index d2de8e5424..469b63d5f9 100644 --- a/src/compiler/expropta.c +++ b/src/compiler/expropta.c @@ -1,5 +1,5 @@ /* hbexpra.c is also included from ../macro/macro.c - * However it produces a slighty different code if used in + * However it produces a slightly different code if used in * macro compiler (there is an additional parameter passed to some functions) */ #include "hbexpra.c" diff --git a/src/compiler/exproptb.c b/src/compiler/exproptb.c index c73c243755..5e1bff8ba0 100644 --- a/src/compiler/exproptb.c +++ b/src/compiler/exproptb.c @@ -1,5 +1,5 @@ /* hbexprb.c is also included from ../macro/macro.c - * However it produces a slighty different code if used in + * However it produces a slightly different code if used in * macro compiler (there is an additional parameter passed to some functions) */ #include "hbexprb.c" diff --git a/src/compiler/genc.c b/src/compiler/genc.c index d2f19a311d..0b765861d8 100644 --- a/src/compiler/genc.c +++ b/src/compiler/genc.c @@ -14,9 +14,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at https://www.gnu.org/). + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ @@ -167,7 +167,6 @@ void hb_compGenCCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the PHB_HINLINE pInline; FILE * yyc; /* file handle for C output */ HB_BOOL fHasHbInline = HB_FALSE; - int iFuncSuffix; hb_fsFNameMerge( szFileName, pFileName ); if( ! pFileName->szExtension ) @@ -210,6 +209,8 @@ void hb_compGenCCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the if( pFunc ) { + int iFuncSuffix; + hb_compDumpFindCFunc( HB_COMP_PARAM ); pInline = HB_COMP_PARAM->inlines.pFirst; @@ -497,8 +498,8 @@ static void hb_compGenCByteStr( FILE * yyc, const HB_BYTE * pText, HB_SIZE nLen { HB_BYTE uchr = ( HB_BYTE ) pText[ nPos ]; /* - * NOTE: After optimization some Chr(n) can be converted - * into a string containing nonprintable characters. + * NOTE: After optimization some Chr( n ) can be converted + * into a string containing non-printable characters. * * TODO: add switch to use hexadecimal format "%#04x" */ @@ -515,7 +516,7 @@ static void hb_compGenCLocalName( PHB_HFUNC pFunc, int iLocal, HB_SIZE nPCodePos if( cargo->nEndBlockPos > nPCodePos ) { - /* we are accesing variables within a codeblock */ + /* we are accessing variables within a codeblock */ /* the names of codeblock variable are lost */ if( iLocal < 0 ) fprintf( cargo->yyc, "\t/* localvar%i */", -iLocal ); @@ -2666,7 +2667,7 @@ static const PHB_GENC_FUNC s_verbose_table[] = { hb_p_enumend, hb_p_switch, hb_p_pushdate, - /* optimalization of inlined math operations (+=, -= */ + /* optimization of inlined math operations (+=, -= */ hb_p_pluseqpop, hb_p_minuseqpop, hb_p_multeqpop, diff --git a/src/compiler/gencc.c b/src/compiler/gencc.c index b4ceff46c0..f27d72ba14 100644 --- a/src/compiler/gencc.c +++ b/src/compiler/gencc.c @@ -77,8 +77,8 @@ void hb_compGenCString( FILE * yyc, const HB_BYTE * pText, HB_SIZE nLen ) { HB_BYTE uchr = ( HB_BYTE ) pText[ nPos ]; /* - * NOTE: After optimization some Chr(n) can be converted - * into a string containing nonprintable characters. + * NOTE: After optimization some Chr( n ) can be converted + * into a string containing non-printable characters. * * ? is escaped to avoid conflicts with trigraph sequences which * are part of ANSI C standard @@ -1639,7 +1639,7 @@ static HB_GENC_FUNC( hb_p_seqend ) HB_GENC_LABEL(); - if( nOffset == 4 ) /* no RECOVER clasue */ + if( nOffset == 4 ) /* no RECOVER clause */ fprintf( cargo->yyc, "\tbreak;\n\t}\n\tif( hb_xvmSeqEnd() ) break;\n" ); else /* RECOVER exists */ fprintf( cargo->yyc, "\tif( hb_xvmSeqEndTest() ) break;\n\tgoto lab%05" HB_PFS "u;\n\t}\n", @@ -2344,7 +2344,7 @@ static const PHB_GENC_FUNC s_verbose_table[] = { hb_p_enumend, hb_p_switch, hb_p_pushdate, - /* optimalization of inlined math operations (+=, -= */ + /* optimization of inlined math operations (+=, -= */ hb_p_pluseqpop, hb_p_minuseqpop, hb_p_multeqpop, diff --git a/src/compiler/genhrb.c b/src/compiler/genhrb.c index 52549b8a4a..d8fd88d6eb 100644 --- a/src/compiler/genhrb.c +++ b/src/compiler/genhrb.c @@ -2,7 +2,6 @@ * Compiler Harbour Portable Object (.hrb) generation * * Copyright 1999 Eddie Runia <eddie@runia.com> - * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * rewritten to work on memory buffers and with new compiler code * @@ -17,9 +16,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at https://www.gnu.org/). + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ @@ -92,12 +91,12 @@ void hb_compGenBufPortObj( HB_COMP_DECL, HB_BYTE ** pBufPtr, HB_SIZE * pnSize ) nLen = strlen( pSym->szName ) + 1; memcpy( ptr, pSym->szName, nLen ); ptr += nLen; - /* TOFIX: this conversion strips upper byte from symbol scope + /* FIXME: this conversion strips upper byte from symbol scope * Now we added workaround for it by using some strict * bit order and restoring some others at runtime when * .hrb file is loaded but we should create new format * for .hrb files in which this field will have at least - * 16bit [druzus] + * 16-bit [druzus] */ *ptr++ = ( HB_BYTE ) pSym->cScope; /* symbol type */ diff --git a/src/compiler/harbour.y b/src/compiler/harbour.y index 72c7647a4a..9b663baa40 100644 --- a/src/compiler/harbour.y +++ b/src/compiler/harbour.y @@ -83,8 +83,8 @@ static void hb_compLoopExit( HB_COMP_DECL ); static void hb_compLoopHere( HB_COMP_DECL ); static long hb_compLoopCount( HB_COMP_DECL ); -static void * hb_compElseIfGen( HB_COMP_DECL, void * pFirstElseIf, HB_SIZE nOffset ); /* generates a support structure for elseifs pcode fixups */ -static void hb_compElseIfFix( HB_COMP_DECL, void * pIfElseIfs ); /* implements the ElseIfs pcode fixups */ +static void * hb_compElseIfGen( HB_COMP_DECL, void * pFirstElseIf, HB_SIZE nOffset ); /* generates a support structure for ELSEIFs pcode fixups */ +static void hb_compElseIfFix( HB_COMP_DECL, void * pIfElseIfs ); /* implements the ELSEIFs pcode fixups */ static void hb_compRTVariableAdd( HB_COMP_DECL, PHB_EXPR, HB_BOOL ); static void hb_compRTVariableGen( HB_COMP_DECL, const char * ); @@ -191,9 +191,9 @@ extern void yyerror( HB_COMP_DECL, const char * ); /* parsing error manageme %token THREAD /*the lowest precedence*/ -/*postincrement and postdecrement*/ +/*post-increment and post-decrement*/ %left POST -/*assigment - from right to left*/ +/*assignment - from right to left*/ %right INASSIGN %right PLUSEQ MINUSEQ %right MULTEQ DIVEQ MODEQ @@ -210,7 +210,7 @@ extern void yyerror( HB_COMP_DECL, const char * ); /* parsing error manageme %right '*' '/' '%' %right POWER %right UNARY -/*preincrement and predecrement*/ +/*pre-increment and pre-decrement*/ %right PRE /*special operators*/ %right ALIASOP '&' '@' @@ -1083,7 +1083,7 @@ PareExpListAlias : PareExpList ALIASOP ; /* NOTE: Clipper allows to pass variable by reference only as - * function arguments, IIF() 2-nd and 3-rd arguments and as + * function arguments, iif() 2nd and 3rd arguments and as * explicit array items {...@var...} * AFAIK these are also the only one places where empty expressions in * the parenthesis expressions list are accepted @@ -1839,7 +1839,7 @@ BeginSeq : BEGINSEQ /* 1 */ { if( $<lNumber>4 != lLoopCount ) { - /* ALWAYS statement after RECOVER with EXIT/LOOP statments */ + /* ALWAYS statement after RECOVER with EXIT/LOOP statements */ hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ALWAYS_AFTER_EXIT, "EXIT/LOOP", NULL ); } --HB_COMP_PARAM->functions.pLast->wAlwaysCounter; diff --git a/src/compiler/hbcmplib.c b/src/compiler/hbcmplib.c index 14be91bcad..42bbccac44 100644 --- a/src/compiler/hbcmplib.c +++ b/src/compiler/hbcmplib.c @@ -44,7 +44,6 @@ * */ -#include "hbapi.h" #include "hbcomp.h" static void s_pp_msg( void * cargo, int iErrorFmt, int iLine, diff --git a/src/compiler/hbcomp.c b/src/compiler/hbcomp.c index 53cb929636..562c8c6896 100644 --- a/src/compiler/hbcomp.c +++ b/src/compiler/hbcomp.c @@ -1,5 +1,5 @@ /* - * allocate/free new compiler context + * Allocate/free new compiler context * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -44,7 +44,6 @@ * */ - #include "hbcomp.h" static PHB_EXPR hb_compExprAlloc( HB_COMP_DECL ) @@ -90,7 +89,7 @@ static PHB_EXPR hb_compExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNew(%p,%i)", HB_COMP_PARAM, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compExprNew(%p,%i)", ( void * ) HB_COMP_PARAM, iType ) ); pExpr = hb_compExprAlloc( HB_COMP_PARAM ); pExpr->ExprType = iType; @@ -263,13 +262,13 @@ PHB_COMP hb_comp_new( void ) HB_COMPFLAG_SHORTCUTS; pComp->fSwitchCase = HB_FALSE; - pComp->fPPO = HB_FALSE; /* flag indicating, is ppo output needed */ + pComp->fPPO = HB_FALSE; /* flag indicating, is .ppo output needed */ pComp->fLineNumbers = HB_TRUE; /* holds if we need pcodes with line numbers */ pComp->fAnyWarning = HB_FALSE; /* holds if there was any warning during the compilation process */ pComp->fAutoMemvarAssume = HB_FALSE; /* holds if undeclared variables are automatically assumed MEMVAR (-a)*/ - pComp->fForceMemvars = HB_FALSE; /* holds if memvars are assumed when accesing undeclared variable (-v)*/ + pComp->fForceMemvars = HB_FALSE; /* holds if memvars are assumed when accessing undeclared variable (-v)*/ pComp->fDebugInfo = HB_FALSE; /* holds if generate debugger required info */ - pComp->fHideSource = HB_FALSE; /* do not stor .prg file names in PCODE */ + pComp->fHideSource = ! pComp->fDebugInfo; /* do not store .prg file names in PCODE */ pComp->fNoStartUp = HB_FALSE; /* C code generation embed HB_FS_FIRST or not */ pComp->fCredits = HB_FALSE; /* print credits */ pComp->fBuildInfo = HB_FALSE; /* print build info */ diff --git a/src/compiler/hbdbginf.c b/src/compiler/hbdbginf.c index d7765aee38..0670b6a303 100644 --- a/src/compiler/hbdbginf.c +++ b/src/compiler/hbdbginf.c @@ -1,5 +1,5 @@ /* - * generate line information for debugger + * Generate line information for debugger * * Copyright 2006 Przemyslaw Czerpak < druzus /at/ priv.onet.pl > * diff --git a/src/compiler/hbdead.c b/src/compiler/hbdead.c index de0798c03a..827ef9f118 100644 --- a/src/compiler/hbdead.c +++ b/src/compiler/hbdead.c @@ -1,5 +1,5 @@ /* - * dead (unaccessible) PCODE eliminator + * Dead (unaccessible) PCODE eliminator * * Copyright 2006 Przemyslaw Czerpak < druzus /at/ priv.onet.pl > * @@ -490,7 +490,7 @@ static const PHB_CODETRACE_FUNC s_codeTraceFuncTable[] = hb_p_default, /* HB_P_ENUMEND */ hb_p_switch, /* HB_P_SWITCH */ hb_p_default, /* HB_P_PUSHDATE */ - /* optimalization of inlined math operations */ + /* optimization of inlined math operations */ hb_p_default, /* HB_P_PLUSEQPOP */ hb_p_default, /* HB_P_MINUSEQPOP */ hb_p_default, /* HB_P_MULTEQPOP */ diff --git a/src/compiler/hbfunchk.c b/src/compiler/hbfunchk.c index b0e38e0545..9e470bd9bf 100644 --- a/src/compiler/hbfunchk.c +++ b/src/compiler/hbfunchk.c @@ -5,8 +5,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,9 +14,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; see the file LICENSE.txt. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ @@ -28,9 +28,9 @@ typedef struct { - const char * cFuncName; /* function name */ - int iMinParam; /* min no of parms it needs */ - int iMaxParam; /* max no of parms need */ + const char * cFuncName; /* function name */ + int iMinParam; /* min number of parameters needed */ + int iMaxParam; /* max number of parameters needed */ } HB_FUNCINFO, * PHB_FUNCINFO; @@ -107,11 +107,9 @@ static const HB_FUNCINFO s_stdFunc[] = { "YEAR" , 1, 1 } }; -#define HB_STD_FUNCOUNT ( sizeof( s_stdFunc ) / sizeof( HB_FUNCINFO ) ) - HB_BOOL hb_compFunCallCheck( HB_COMP_DECL, const char * szFuncCall, int iArgs ) { - unsigned int uiFirst = 0, uiLast = HB_STD_FUNCOUNT - 1, uiMiddle; + unsigned int uiFirst = 0, uiLast = HB_SIZEOFARRAY( s_stdFunc ) - 1, uiMiddle; int iLen = ( int ) strlen( szFuncCall ), iCmp; /* Respect 4 or more letters shortcuts diff --git a/src/compiler/hbgenerr.c b/src/compiler/hbgenerr.c index 4f59299520..dc9e473976 100644 --- a/src/compiler/hbgenerr.c +++ b/src/compiler/hbgenerr.c @@ -6,7 +6,7 @@ * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,9 +14,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at https://www.gnu.org/). + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ @@ -58,8 +58,8 @@ const char * const hb_comp_szErrors[] = "Jump offset too long", "Can't create output file '%s'", "Can't create preprocessed output file '%s'", - "Bad command line option '%s'", - "Bad command line parameter '%s'", + "Bad command-line option '%s'", + "Bad command-line parameter '%s'", "Invalid filename '%s'", "Mayhem in CASE handler", "Operation not supported for data type '%s'", @@ -109,7 +109,7 @@ const char * const hb_comp_szErrors[] = /* Table with parse warnings */ /* NOTE: The first character stores the warning's level that triggers this - * warning. The warning's level is set by -w<n> command line option. + * warning. The warning's level is set by -w<n> command-line option. */ const char * const hb_comp_szWarnings[] = { diff --git a/src/compiler/hbident.c b/src/compiler/hbident.c index 09d2572cc7..82487f4d75 100644 --- a/src/compiler/hbident.c +++ b/src/compiler/hbident.c @@ -5,8 +5,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,15 +14,14 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; see the file LICENSE.txt. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ #include <string.h> -#include "hbhash.h" #include "hbcomp.h" #define HB_IDENT_TABLE_SIZE 509UL diff --git a/src/compiler/hblbl.c b/src/compiler/hblbl.c index 240a5d8e49..0ddffc12da 100644 --- a/src/compiler/hblbl.c +++ b/src/compiler/hblbl.c @@ -1,5 +1,5 @@ /* - * generate table with jump labels + * Generate table with jump labels * * Copyright 2006 Przemyslaw Czerpak < druzus /at/ priv.onet.pl > * @@ -321,7 +321,7 @@ static const PHB_LABEL_FUNC s_GenLabelFuncTable[] = NULL, /* HB_P_ENUMEND */ NULL, /* HB_P_SWITCH */ NULL, /* HB_P_PUSHDATE */ - /* optimalization of inlined math operations */ + /* optimization of inlined math operations */ NULL, /* HB_P_PLUSEQPOP */ NULL, /* HB_P_MINUSEQPOP */ NULL, /* HB_P_MULTEQPOP */ diff --git a/src/compiler/hbmain.c b/src/compiler/hbmain.c index c0ac9cfa3d..dd183ef22a 100644 --- a/src/compiler/hbmain.c +++ b/src/compiler/hbmain.c @@ -2,6 +2,10 @@ * Compiler main file * * Copyright 1999 Antonio Linares <alinares@fivetechsoft.com> + * Copyright 2000 Ron Pinkas <Ron@Profit-Master.com> + * (hb_compPrepareJumps(), hb_compOptimizeJumps(), hb_compOptimizeFrames(), + * hb_compDeclaredParameterAdd(), hb_compClassAdd(), hb_compClassFind(), + * hb_compMethodAdd(), hb_compMethodFind(), hb_compDeclaredAdd()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,30 +18,13 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at https://www.gnu.org/). - * - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 RonPinkas <Ron@Profit-Master.com> - * hb_compPrepareJumps() - * hb_compOptimizeJumps() - * hb_compOptimizeFrames() - * hb_compDeclaredParameterAdd() - * hb_compClassAdd() - * hb_compClassFind() - * hb_compMethodAdd() - * hb_compMethodFind() - * hb_compDeclaredAdd() - * - * See COPYING.txt for licensing terms. + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ -/* - * Avoid tracing in preprocessor/compiler. - */ +/* Avoid tracing in preprocessor/compiler. */ #if ! defined( HB_TRACE_UTILS ) #if defined( HB_TRACE_LEVEL ) #undef HB_TRACE_LEVEL @@ -45,7 +32,6 @@ #endif #include "hbcomp.h" -#include "hbhash.h" #include "hbset.h" static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuffer, int iStartLine ); @@ -63,7 +49,6 @@ int hb_compMainExt( int argc, const char * const argv[], int iStatus = EXIT_SUCCESS, iFileCount = 0; int iFileCase, iDirCase, iDirSep; HB_BOOL fTrimFN; - int i; HB_TRACE( HB_TR_DEBUG, ( "hb_compMain()" ) ); @@ -88,7 +73,7 @@ int hb_compMainExt( int argc, const char * const argv[], /* First check the environment variables */ hb_compChkEnvironment( HB_COMP_PARAM ); - /* Then check command line arguments + /* Then check command-line arguments This will override duplicated environment settings */ hb_compChkCommandLine( HB_COMP_PARAM, argc, argv ); @@ -137,7 +122,8 @@ int hb_compMainExt( int argc, const char * const argv[], } else { - /* Process all files passed via the command line. */ + int i; + /* Process all files passed via the command-line. */ for( i = 1; i < argc && ! HB_COMP_PARAM->fExit; i++ ) { HB_TRACE( HB_TR_DEBUG, ( "main LOOP(%i,%s)", i, argv[ i ] ) ); @@ -269,9 +255,8 @@ static int hb_compReadClpFile( HB_COMP_DECL, const char * szClpFile ) return iStatus; } -/* ------------------------------------------------------------------------- */ -/* ACTIONS */ -/* ------------------------------------------------------------------------- */ + +/* --- ACTIONS --- */ static PHB_HSYMBOL hb_compSymbolAdd( HB_COMP_DECL, const char * szSymbolName, HB_USHORT * pwPos, HB_BOOL bFunction ) @@ -735,7 +720,7 @@ PHB_HVAR hb_compVariableFind( HB_COMP_DECL, const char * szVarName, int * piPos, * * NOTE: Clipper creates such a codeblock however at the * time of codeblock evaluation it generates a runtime error: - * 'bound error: array acccess' + * 'bound error: array access' * Called from: (b)STATICS$(0) */ hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ILLEGAL_INIT, "(b)", szVarName ); @@ -909,7 +894,7 @@ static int hb_compVariableScope( HB_COMP_DECL, const char * szVarName ) void hb_compPushMacroVar( HB_COMP_DECL, const char * szVarName ) { /* save and restore iEarlyEvalPass to not disable early - evaluation when only macrovar and/or macrotex is used */ + evaluation when only macrovar and/or macrotext is used */ int iEarlyEvalPass = HB_COMP_PARAM->functions.pLast->iEarlyEvalPass; hb_compGenPushVar( szVarName, HB_COMP_PARAM ); @@ -929,7 +914,7 @@ void hb_compPushMacroText( HB_COMP_DECL, const char * szText, HB_SIZE nLen, HB_B if( szText[ n++ ] == '&' ) { char szSymName[ HB_SYMBOL_NAME_LEN + 1 ]; - int iSize = 0, iScope; + int iSize = 0; /* Check if macro operator is used inside a string * Macro operator is ignored if it is the last char or @@ -955,6 +940,8 @@ void hb_compPushMacroText( HB_COMP_DECL, const char * szText, HB_SIZE nLen, HB_B if( iSize ) { + int iScope; + szSymName[ iSize ] = '\0'; /* NOTE: All variables are assumed memvars in macro compiler - @@ -1318,7 +1305,7 @@ PHB_VARTYPE hb_compVarTypeNew( HB_COMP_DECL, HB_BYTE cVarType, const char* szFro } /* Add to the end of list. I hope it will help the most usual type (' ', NULL) - to be in the begining of the list, and it will be found faster. [Mindaugas] */ + to be in the beginning of the list, and it will be found faster. [Mindaugas] */ pVT = ( PHB_VARTYPE ) hb_xgrab( sizeof( HB_VARTYPE ) ); pVT->pNext = NULL; pVT->cVarType = cVarType; @@ -1390,7 +1377,7 @@ static void hb_compOptimizeJumps( HB_COMP_DECL ) * [ no jump targets or stack modification here ] * HB_P_JUMP{FALSE|TRUE}*, * - * I'll think about sth like that later, [druzus] + * I'll think about something like that later, [druzus] */ switch( pCode[ nJumpAddr ] ) { @@ -1547,7 +1534,7 @@ static void hb_compOptimizeJumps( HB_COMP_DECL ) /* First Scan NOOPS - Adjust Jump addresses. */ for( nNOOP = 0; nNOOP < HB_COMP_PARAM->functions.pLast->nNOOPs; nNOOP++ ) { - /* Adjusting preceding jumps that pooint to code beyond the current NOOP + /* Adjusting preceding jumps that point to code beyond the current NOOP or trailing backward jumps pointing to lower address. */ for( nJump = 0; nJump < HB_COMP_PARAM->functions.pLast->nJumps; nJump++ ) { @@ -1589,7 +1576,7 @@ static void hb_compOptimizeJumps( HB_COMP_DECL ) pNOOPs[ nNOOP ] < ( HB_SIZE ) ( nJumpAddr + nOffset ) ) plSizes[ nJump ]--; } - else /* if( nOffset < 0 ) - backword (negative) jump */ + else /* if( nOffset < 0 ) - backward (negative) jump */ { /* Only if points to code prior the current fix. */ if( pNOOPs[ nNOOP ] < nJumpAddr && @@ -1638,7 +1625,7 @@ static void hb_compOptimizeJumps( HB_COMP_DECL ) } nOptimized = nNextByte = 0; - /* Second Scan, after all adjustements been made, we can copy the optimized code. */ + /* Second Scan, after all adjustments been made, we can copy the optimized code. */ for( nNOOP = 0; nNOOP < HB_COMP_PARAM->functions.pLast->nNOOPs; nNOOP++ ) { nBytes2Copy = ( pNOOPs[ nNOOP ] - nNextByte ); @@ -1897,7 +1884,7 @@ static void hb_compFinalizeFunction( HB_COMP_DECL ) /* fixes all last defined fu } /* - * This function creates and initialises the HB_HFUNC structure + * This function creates and initializes the HB_HFUNC structure */ static PHB_HFUNC hb_compFunctionNew( HB_COMP_DECL, const char * szName, HB_SYMBOLSCOPE cScope ) { @@ -2229,7 +2216,7 @@ static void hb_compAnnounce( HB_COMP_DECL, const char * szFunName ) PHB_HFUNC pFunc; /* Clipper call this function after compiling .prg module where ANNOUNCE - * symbol was deined not after compiling all .prg modules and search for + * symbol was defined not after compiling all .prg modules and search for * public ANNOUNCEd function/procedure in all compiled so far modules * and then for static one in currently compiler module. */ @@ -2564,10 +2551,10 @@ static void hb_compGenVariablePCode( HB_COMP_DECL, HB_BYTE bPCode, const char * /* * NOTE: * Clipper always assumes a memvar variable if undeclared variable - * is popped (a value is asssigned to a variable). + * is popped (a value is assigned to a variable). */ if( HB_SUPPORT_HARBOUR ) - bGenCode = HB_COMP_PARAM->fForceMemvars; /* harbour compatibility */ + bGenCode = HB_COMP_PARAM->fForceMemvars; /* Harbour compatibility */ else bGenCode = ( HB_COMP_PARAM->fForceMemvars || bPCode == HB_P_POPVARIABLE ); @@ -2707,7 +2694,7 @@ void hb_compGenPopVar( const char * szVarName, HB_COMP_DECL ) /* generates the p case HB_VS_LOCAL_VAR: case HB_VS_CBLOCAL_VAR: /* local variable */ - /* local variables used in a coddeblock will not be adjusted + /* local variables used in a codeblock will not be adjusted * if PARAMETERS statement will be used then it is safe to * use 2 bytes for LOCALNEAR */ @@ -2767,7 +2754,7 @@ void hb_compGenPopMemvar( const char * szVarName, HB_COMP_DECL ) hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName, HB_COMP_PARAM ); } -/* generates the pcode to push a nonaliased variable value to the virtual +/* generates the pcode to push a non-aliased variable value to the virtual * machine stack * bMacroVar is HB_TRUE if macro &szVarName context */ @@ -2787,7 +2774,7 @@ void hb_compGenPushVar( const char * szVarName, HB_COMP_DECL ) case HB_VS_LOCAL_VAR: case HB_VS_CBLOCAL_VAR: /* local variable */ - /* local variables used in a coddeblock will not be adjusted + /* local variables used in a codeblock will not be adjusted * if PARAMETERS statement will be used then it is safe to * use 2 bytes for LOCALNEAR */ @@ -3159,8 +3146,6 @@ void hb_compGenPushString( const char * szText, HB_SIZE nStrLen, HB_COMP_DECL ) void hb_compNOOPfill( PHB_HFUNC pFunc, HB_SIZE nFrom, HB_ISIZ nCount, HB_BOOL fPop, HB_BOOL fCheck ) { - HB_SIZE n; - while( nCount-- ) { if( fPop ) @@ -3170,6 +3155,8 @@ void hb_compNOOPfill( PHB_HFUNC pFunc, HB_SIZE nFrom, HB_ISIZ nCount, HB_BOOL fP } else if( fCheck && pFunc->pCode[ nFrom ] == HB_P_NOOP && pFunc->nNOOPs ) { + HB_SIZE n; + for( n = 0; n < pFunc->nNOOPs; ++n ) { if( pFunc->pNOOPs[ n ] == nFrom ) @@ -3193,7 +3180,6 @@ static void hb_compRemovePCODE( HB_COMP_DECL, HB_SIZE nPos, HB_SIZE nCount, HB_BOOL fCanMove ) { PHB_HFUNC pFunc = HB_COMP_PARAM->functions.pLast; - HB_SIZE n; if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_OPTJUMP ) || ! fCanMove ) { @@ -3206,6 +3192,8 @@ static void hb_compRemovePCODE( HB_COMP_DECL, HB_SIZE nPos, HB_SIZE nCount, } else { + HB_SIZE n; + memmove( pFunc->pCode + nPos, pFunc->pCode + nPos + nCount, pFunc->nPCodePos - nPos - nCount ); pFunc->nPCodePos -= nCount; @@ -3270,7 +3258,7 @@ HB_BOOL hb_compHasJump( PHB_HFUNC pFunc, HB_SIZE nPos ) } /* Generate the opcode to open BEGIN/END sequence - * This code is simmilar to JUMP opcode - the offset will be filled with + * This code is similar to JUMP opcode - the offset will be filled with * - either the address of HB_P_SEQEND opcode if there is no RECOVER clause * - or the address of RECOVER code */ @@ -3286,10 +3274,10 @@ HB_SIZE hb_compSequenceBegin( HB_COMP_DECL ) } /* Generate the opcode to close BEGIN/END sequence - * This code is simmilar to JUMP opcode - the offset will be filled with + * This code is similar to JUMP opcode - the offset will be filled with * the address of first line after END SEQUENCE * This opcode will be executed if recover code was not requested (as the - * last statement in code beetwen BEGIN ... RECOVER) or if BREAK was requested + * last statement in code between BEGIN ... RECOVER) or if BREAK was requested * and there was no matching RECOVER clause. */ HB_SIZE hb_compSequenceEnd( HB_COMP_DECL ) @@ -3311,7 +3299,7 @@ HB_SIZE hb_compSequenceAlways( HB_COMP_DECL ) } /* Remove unnecessary opcodes in case there were no executable statements - * beetwen BEGIN and RECOVER sequence + * between BEGIN and RECOVER sequence */ void hb_compSequenceFinish( HB_COMP_DECL, HB_SIZE nStartPos, HB_SIZE nEndPos, HB_SIZE nAlways, HB_BOOL fUsualStmts, HB_BOOL fRecover, @@ -3453,7 +3441,7 @@ static void hb_compStaticDefThreadSet( HB_COMP_DECL ) { if( HB_COMP_PARAM->pInitFunc ) { - HB_USHORT uiCount = 0, uiVar = 0; + HB_USHORT uiCount = 0; PHB_HFUNC pFunc; PHB_HVAR pVar; @@ -3469,10 +3457,12 @@ static void hb_compStaticDefThreadSet( HB_COMP_DECL ) } pFunc = pFunc->pNext; } + if( uiCount ) { HB_SIZE nSize = ( ( HB_SIZE ) uiCount << 1 ) + 3; HB_BYTE * pBuffer = ( HB_BYTE * ) hb_xgrab( nSize ), *ptr; + HB_USHORT uiVar = 0; pBuffer[ 0 ] = HB_P_THREADSTATICS; pBuffer[ 1 ] = HB_LOBYTE( uiCount ); pBuffer[ 2 ] = HB_HIBYTE( uiCount ); @@ -3566,8 +3556,6 @@ void hb_compCodeBlockEnd( HB_COMP_DECL ) HB_SIZE nSize; HB_USHORT wLocals = 0; /* number of referenced local variables */ HB_USHORT wLocalsCnt, wLocalsLen; - HB_USHORT wPos; - int iLocalPos; PHB_HVAR pVar; pCodeblock = HB_COMP_PARAM->functions.pLast; @@ -3666,7 +3654,7 @@ void hb_compCodeBlockEnd( HB_COMP_DECL ) pVar = pCodeblock->pDetached; while( wLocals-- ) { - wPos = hb_compVariableGetPos( pFunc->pLocals, pVar->szName ); + HB_USHORT wPos = hb_compVariableGetPos( pFunc->pLocals, pVar->szName ); hb_compGenPCode2( HB_LOBYTE( wPos ), HB_HIBYTE( wPos ), HB_COMP_PARAM ); pVar = pVar->pNext; } @@ -3674,6 +3662,8 @@ void hb_compCodeBlockEnd( HB_COMP_DECL ) if( HB_COMP_PARAM->fDebugInfo ) { + int iLocalPos; + hb_compGenModuleName( HB_COMP_PARAM, pFuncName ); /* generate the name of referenced local variables */ @@ -3721,7 +3711,7 @@ void hb_compCodeBlockEnd( HB_COMP_DECL ) pFunc->pStatics = pCodeblock->pStatics; pVar = pCodeblock->pStatics; pCodeblock->pStatics = NULL; - /* change stati variables names to avoid conflicts */ + /* change static variables names to avoid conflicts */ while( pVar ) { char szName[ HB_SYMBOL_NAME_LEN + 4 ]; @@ -4174,7 +4164,7 @@ static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuff PHB_MODULE pModule; HB_BOOL fGenCode = HB_TRUE; - HB_TRACE( HB_TR_DEBUG, ( "hb_compCompile(%s,%p,%d)", szPrg, szBuffer, iStartLine ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_compCompile(%s,%p,%d)", szPrg, ( const void * ) szBuffer, iStartLine ) ); hb_compSaveSwitches( HB_COMP_PARAM, &switches ); /* Initialize support variables */ @@ -4195,7 +4185,6 @@ static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuff ( pModule || szBuffer ) ) { char szFileName[ HB_PATH_MAX ]; /* filename to parse */ - char szPpoName[ HB_PATH_MAX ]; HB_BOOL fSkip = HB_FALSE; /* Clear and reinitialize preprocessor state */ @@ -4246,6 +4235,8 @@ static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuff if( ! fSkip ) { + char szPpoName[ HB_PATH_MAX ]; + if( HB_COMP_PARAM->fPPT ) { hb_compPpoFile( HB_COMP_PARAM, szFileName, ".ppt", szPpoName ); diff --git a/src/compiler/hbopt.c b/src/compiler/hbopt.c index 2546fe6cb4..ea379073c6 100644 --- a/src/compiler/hbopt.c +++ b/src/compiler/hbopt.c @@ -473,7 +473,6 @@ static HB_OPT_FUNC( hb_p_jumpfar ) HB_BYTE * pAddr = &pFunc->pCode[ nPCodePos + 1 ]; HB_ISIZ nOffset = HB_PCODE_MKINT24( pAddr ); HB_SIZE nNewPos = nPCodePos + nOffset; - HB_BOOL fLine = HB_FALSE; HB_SYMBOL_UNUSED( cargo ); @@ -483,12 +482,15 @@ static HB_OPT_FUNC( hb_p_jumpfar ) } else { + HB_BOOL fLine = HB_FALSE; + if( pFunc->pCode[ nNewPos ] == HB_P_LINE ) { fLine = HB_TRUE; nNewPos += 3; nOffset += 3; } + switch( pFunc->pCode[ nNewPos ] ) { case HB_P_JUMPFAR: @@ -1179,7 +1181,7 @@ static void hb_compPCodeEnumScanLocals( PHB_HFUNC pFunc, PHB_OPT_LOCAL pLocals ) case HB_P_PUSHBLOCKLARGE: { HB_BYTE * pCode = &pFunc->pCode[ nPos + 5 ]; - HB_USHORT usVarCount, usVar; + HB_USHORT usVarCount; if( pFunc->pCode[ nPos ] == HB_P_PUSHBLOCKLARGE ) pCode++; @@ -1187,6 +1189,7 @@ static void hb_compPCodeEnumScanLocals( PHB_HFUNC pFunc, PHB_OPT_LOCAL pLocals ) usVarCount = HB_PCODE_MKUSHORT( pCode ); while( usVarCount-- ) { + HB_USHORT usVar; pCode += 2; usVar = HB_PCODE_MKUSHORT( pCode ); if( usVar > 0 ) @@ -1339,7 +1342,7 @@ static int hb_compPCodeTraceAssignedUnused( PHB_HFUNC pFunc, HB_SIZE nPos, HB_BY if( hb_compPCodeTraceAssignedUnused( pFunc, nPos2, pMap, isLocal, fCanBreak ) ) return 1; } - else if( pFunc->pCode[ nPos ] == HB_P_SWITCH ) /* Switch is multiplace jump */ + else if( pFunc->pCode[ nPos ] == HB_P_SWITCH ) /* Switch is multi-place jump */ { HB_USHORT us, usCount = HB_PCODE_MKUSHORT( pFunc->pCode + nPos + 1 ); @@ -1368,13 +1371,13 @@ static void hb_compPCodeEnumAssignedUnused( HB_COMP_DECL, PHB_HFUNC pFunc, PHB_O { HB_BYTE * pMap; HB_SIZE nPos = 0, nLastPos = 0; - HB_SHORT isLocal; HB_USHORT usLine = 0; pMap = ( HB_BYTE * ) hb_xgrab( pFunc->nPCodePos ); while( nPos < pFunc->nPCodePos ) { + HB_SHORT isLocal; int iCheck = 0; if( pFunc->pCode[ nPos ] == HB_P_POPLOCAL || @@ -1472,8 +1475,8 @@ static void hb_compPCodeEnumAssignedUnused( HB_COMP_DECL, PHB_HFUNC pFunc, PHB_O { char szFun[ 256 ]; - /* TOFIX: We calculate line number by simple tracking last HB_P_LINE, - but it can work bad, if line number optimizator is clever enough. + /* FIXME: We calculate line number by simple tracking last HB_P_LINE, + but it can work bad, if line number optimizer is clever enough. To obtain real line number we need one more tree scan or other algorithm. [Mindaugas] */ @@ -1560,7 +1563,6 @@ static void hb_compPCodeEnumRenumberLocals( PHB_HFUNC pFunc, PHB_OPT_LOCAL pLoca { HB_BYTE * pVar = &pFunc->pCode[ nPos + 5 ]; HB_USHORT usVarCount; - HB_SHORT isVar; if( pFunc->pCode[ nPos ] == HB_P_PUSHBLOCKLARGE ) pVar++; @@ -1568,6 +1570,8 @@ static void hb_compPCodeEnumRenumberLocals( PHB_HFUNC pFunc, PHB_OPT_LOCAL pLoca usVarCount = HB_PCODE_MKUSHORT( pVar ); while( usVarCount-- ) { + HB_SHORT isVar; + pVar += 2; isVar = HB_PCODE_MKSHORT( pVar ); @@ -1593,11 +1597,10 @@ void hb_compPCodeTraceOptimizer( HB_COMP_DECL ) { PHB_HFUNC pFunc = HB_COMP_PARAM->functions.pLast; PHB_OPT_LOCAL pLocals; - PHB_HVAR pVar, * ppVar; + PHB_HVAR pVar; HB_USHORT usLocalCount, usIndex; - HB_BOOL fBool; - /* Many (perhaps ALL) functions of pcode trace optimization dependes on pcodes. + /* Many (perhaps ALL) functions of pcode trace optimization depends on pcodes. Please, check these functions if new pcode is added, or existing changed. Special attention should be paid, if new pcode introduces branching, codeblocks, or are related to parameters, local variables. [Mindaugas] */ @@ -1615,8 +1618,8 @@ void hb_compPCodeTraceOptimizer( HB_COMP_DECL ) if( ! usLocalCount ) return; - /* TOFIX: Support for PARAMETER sentence is not implemented. - The temporary solution is to disable optmisation at all if PARAMETER is used. */ + /* FIXME: Support for PARAMETER sentence is not implemented. + The temporary solution is to disable optimization at all if PARAMETER is used. */ { HB_SIZE nPos = 0; @@ -1646,7 +1649,7 @@ void hb_compPCodeTraceOptimizer( HB_COMP_DECL ) * if .F. * x := 1 * endif - * return + * return * [druzus] */ #if 0 @@ -1695,18 +1698,21 @@ void hb_compPCodeTraceOptimizer( HB_COMP_DECL ) /* Delete unused */ if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_OPTJUMP ) && ! HB_COMP_PARAM->fDebugInfo ) { - fBool = 0; + HB_BOOL fBool = HB_FALSE; + for( usIndex = pFunc->wParamCount; usIndex < usLocalCount; usIndex++ ) { if( pLocals[ usIndex ].bFlags == 0 ) { - fBool = 1; + fBool = HB_TRUE; break; } } if( fBool ) { + PHB_HVAR * ppVar; + usIndex = usLocalCount = 0; ppVar = & pFunc->pLocals; pVar = pFunc->pLocals; diff --git a/src/compiler/hbpcode.c b/src/compiler/hbpcode.c index e6d546f771..d604a3bcf3 100644 --- a/src/compiler/hbpcode.c +++ b/src/compiler/hbpcode.c @@ -6,7 +6,7 @@ * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,13 +14,12 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at https://www.gnu.org/). + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ - #include "hbcomp.h" #include "hbassert.h" @@ -251,7 +250,7 @@ const HB_BYTE hb_comp_pcode_len[] = { 1, /* HB_P_ENUMEND */ 3, /* HB_P_SWITCH */ 5, /* HB_P_PUSHDATE */ - /* optimalization of inlined math operations */ + /* optimization of inlined math operations */ 1, /* HB_P_PLUSEQPOP */ 1, /* HB_P_MINUSEQPOP */ 1, /* HB_P_MULTEQPOP */ @@ -443,7 +442,7 @@ static PHB_PCODE_FUNC s_psize_table[] = NULL, /* HB_P_ENUMEND */ NULL, /* HB_P_SWITCH */ NULL, /* HB_P_PUSHDATE */ - /* optimalization of inlined math operations */ + /* optimization of inlined math operations */ NULL, /* HB_P_PLUSEQPOP */ NULL, /* HB_P_MINUSEQPOP */ NULL, /* HB_P_MULTEQPOP */ @@ -516,7 +515,6 @@ void hb_compPCodeEval( PHB_HFUNC pFunc, const PHB_PCODE_FUNC * pFunctions, void { HB_SIZE nPos = 0; HB_SIZE nSkip; - HB_BYTE opcode; /* Make sure that table is correct */ assert( sizeof( hb_comp_pcode_len ) == HB_P_LAST_PCODE ); @@ -524,7 +522,7 @@ void hb_compPCodeEval( PHB_HFUNC pFunc, const PHB_PCODE_FUNC * pFunctions, void while( nPos < pFunc->nPCodePos ) { - opcode = pFunc->pCode[ nPos ]; + HB_BYTE opcode = pFunc->pCode[ nPos ]; if( opcode < HB_P_LAST_PCODE ) { PHB_PCODE_FUNC pCall = pFunctions[ opcode ]; diff --git a/src/compiler/hbstripl.c b/src/compiler/hbstripl.c index b59f5e59bb..336972743a 100644 --- a/src/compiler/hbstripl.c +++ b/src/compiler/hbstripl.c @@ -232,7 +232,7 @@ static const PHB_STRIP_FUNC s_stripLines_table[] = NULL, /* HB_P_ENUMEND */ NULL, /* HB_P_SWITCH */ NULL, /* HB_P_PUSHDATE */ - /* optimalization of inlined math operations */ + /* optimization of inlined math operations */ NULL, /* HB_P_PLUSEQPOP */ NULL, /* HB_P_MINUSEQPOP */ NULL, /* HB_P_MULTEQPOP */ diff --git a/src/compiler/hbusage.c b/src/compiler/hbusage.c index cc6dec3277..62e5c02e80 100644 --- a/src/compiler/hbusage.c +++ b/src/compiler/hbusage.c @@ -46,9 +46,6 @@ #include "hbcomp.h" -/* - * Prints available options - */ void hb_compPrintUsage( HB_COMP_DECL, const char * szSelf ) { static const char * s_szOptions[] = @@ -115,9 +112,7 @@ void hb_compPrintUsage( HB_COMP_DECL, const char * szSelf ) hb_compOutStd( HB_COMP_PARAM, s_szOptions[ iLine ] ); } -/* - * List of compatibility/features modes - */ +/* List of compatibility/features modes */ void hb_compPrintModes( HB_COMP_DECL ) { static const char * s_szOptions[] = @@ -165,15 +160,12 @@ void hb_compPrintModes( HB_COMP_DECL ) } } -/* - * Prints credits - */ void hb_compPrintCredits( HB_COMP_DECL ) { hb_compOutStd( HB_COMP_PARAM, "\n" - "Credits: The Harbour Team at harbour-project.org\n" - " (replace space with @ in e-mail addresses)\n" + "Credits: The Harbour Team\n" + " (replace space with @ in email addresses)\n" "\n" "Alejandro de Garate (alex_degarate hotmail com)\n" "Aleksander Czajczynski <hb fki.pl>\n" @@ -264,9 +256,6 @@ void hb_compPrintCredits( HB_COMP_DECL ) ); } -/* - * Prints logo - */ void hb_compPrintLogo( HB_COMP_DECL ) { char * szVer = hb_verHarbour(); diff --git a/src/compiler/ppcomp.c b/src/compiler/ppcomp.c index f1b99c6643..e10edcc2cd 100644 --- a/src/compiler/ppcomp.c +++ b/src/compiler/ppcomp.c @@ -44,7 +44,6 @@ * */ - #include "hbcomp.h" static void hb_pp_ErrorGen( void * cargo, @@ -303,9 +302,9 @@ static HB_BOOL hb_pp_CompilerSwitch( void * cargo, const char * szSwitch, else { if( iValue ) - iValue = HB_COMP_PARAM->supported & iFlag ? 0 : 1; + iValue = ( HB_COMP_PARAM->supported & iFlag ) ? 0 : 1; else - iValue = HB_COMP_PARAM->supported & iFlag ? 1 : 0; + iValue = ( HB_COMP_PARAM->supported & iFlag ) ? 1 : 0; } } } @@ -415,7 +414,7 @@ void hb_compInitPP( HB_COMP_DECL, PHB_PP_OPEN_FUNC pOpenFunc ) hb_pp_initDynDefines( HB_COMP_PARAM->pLex->pPP, ! HB_COMP_PARAM->fNoArchDefs ); - /* Add /D and /undef: command line or envvar defines */ + /* Add /D and /undef: command-line or envvar defines */ hb_compChkSetDefines( HB_COMP_PARAM ); /* add extended definitions files (-u+<file>) */ diff --git a/src/debug/dbgbrwsr.prg b/src/debug/dbgbrwsr.prg index 5e5366daae..9cd9e08c1f 100644 --- a/src/debug/dbgbrwsr.prg +++ b/src/debug/dbgbrwsr.prg @@ -47,7 +47,7 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" /* HBDbBrowser diff --git a/src/debug/dbgentry.c b/src/debug/dbgentry.c index b2aad5b3ce..9d4042019e 100644 --- a/src/debug/dbgentry.c +++ b/src/debug/dbgentry.c @@ -551,7 +551,7 @@ void hb_dbgEntry( int nMode, int nLine, const char * szName, int nIndex, PHB_ITE return; case HB_DBG_STATICNAME: - HB_TRACE( HB_TR_DEBUG, ( "STATICNAME %s index %d frame %p", szName, nIndex, pFrame ) ); + HB_TRACE( HB_TR_DEBUG, ( "STATICNAME %s index %d frame %p", szName, nIndex, ( void * ) pFrame ) ); hb_dbgAddStatic( info, szName, nIndex, pFrame ); return; @@ -611,7 +611,6 @@ void hb_dbgEntry( int nMode, int nLine, const char * szName, int nIndex, PHB_ITE hb_xfree( info->szToCursorModule ); } } - /* Check if we must skip every level above info->nTraceLevel */ else if( info->bTraceOver ) { @@ -633,7 +632,7 @@ void hb_dbgEntry( int nMode, int nLine, const char * szName, int nIndex, PHB_ITE return; } - /* Check if'we skipping to the end of current routine */ + /* Check if we're skipping to the end of current routine */ if( info->bNextRoutine ) return; diff --git a/src/debug/dbghelp.prg b/src/debug/dbghelp.prg index 9e8b2d80b2..d66e2739b8 100644 --- a/src/debug/dbghelp.prg +++ b/src/debug/dbghelp.prg @@ -6,11 +6,6 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * @@ -146,7 +141,7 @@ STATIC PROCEDURE ProcessKey( nKey, oDlg, oBrw, aTopics ) CASE K_PGUP CASE K_CTRL_B - ShowTopic( oDlg, aTopics, oBrw:Cargo, -1 ) // Skip to prev page + ShowTopic( oDlg, aTopics, oBrw:Cargo, -1 ) // Skip to previous page EXIT CASE K_PGDN @@ -216,7 +211,7 @@ STATIC PROCEDURE ShowTopic( oDlg, aTopics, nTopic, nPageOp ) ENDIF EXIT - CASE -1 // Show prev page + CASE -1 // Show previous page IF oDebug:nHelpPage > 1 oDebug:nHelpPage-- @@ -245,7 +240,7 @@ STATIC FUNCTION GetTopics() LOCAL aTopics := {} LOCAL cLine - FOR EACH cLine IN hb_ATokens( help_en(), Chr( 10 ) ) + FOR EACH cLine IN hb_ATokens( help_en(), .T. ) IF hb_LeftEq( cLine, "--" ) AAdd( aTopics, { PadR( SubStr( cLine, Len( "--" ) + 1 ), 12 ), {} } ) ELSEIF ! Empty( aTopics ) .AND. ; diff --git a/src/debug/dbgmenu.prg b/src/debug/dbgmenu.prg index 2fb3fcdb0f..0846d19ca2 100644 --- a/src/debug/dbgmenu.prg +++ b/src/debug/dbgmenu.prg @@ -50,8 +50,8 @@ #xcommand MENUITEM [ <oMenuItem> PROMPT ] <cPrompt> ; [ IDENT <nIdent> ] [ ACTION <uAction,...> ] ; [ CHECKED <bChecked> ] => ; - [ <oMenuItem> := ] HBDbMenu():AddItem( HBDbMenuItem():New( <cPrompt>,; - [{||<uAction>}], [<bChecked>], [<nIdent>] ) ) + [ <oMenuItem> := ] HBDbMenu():AddItem( HBDbMenuItem():New( <cPrompt>, ; + [{|| <uAction> }], [<bChecked>], [<nIdent>] ) ) #xcommand SEPARATOR => HBDbMenu():AddItem( HBDbMenuItem():New( "-" ) ) #xcommand ENDMENU => ATail( HBDbMenu():aMenus ):Build() diff --git a/src/debug/dbgtarr.prg b/src/debug/dbgtarr.prg index 44d4b66cb2..7f71d1f2ec 100644 --- a/src/debug/dbgtarr.prg +++ b/src/debug/dbgtarr.prg @@ -46,7 +46,7 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" #include "inkey.ch" @@ -105,7 +105,7 @@ METHOD addWindows( aArray, nRow ) CLASS HBDbArray oBrwSets := HBDbBrowser():New( oWndSets:nTop + 1, oWndSets:nLeft + 1, oWndSets:nBottom - 1, oWndSets:nRight - 1 ) oBrwSets:ColorSpec := __dbg():ClrModal() - oBrwSets:Cargo := { 1, {} } // Actual highligthed row + oBrwSets:Cargo := { 1, {} } // Actual highlighted row AAdd( oBrwSets:Cargo[ 2 ], aArray ) oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| ::arrayName + "[" + hb_ntos( oBrwSets:cargo[ 1 ] ) + "]" } ) ) @@ -146,7 +146,7 @@ METHOD PROCEDURE doGet( oBrowse, pItem, nSet ) CLASS HBDbArray IF __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1, ; oBrowse:getColumn( 2 ):Width, @cValue, ; __dbgExprValidBlock(), __dbgColors()[ 2 ], 256 ) - BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } + BEGIN SEQUENCE WITH __BreakBlock() pItem[ nSet ] := &cValue RECOVER USING oErr __dbgAlert( oErr:description ) diff --git a/src/debug/dbgthsh.prg b/src/debug/dbgthsh.prg index 0ced6ca45f..3b0bfc43f4 100644 --- a/src/debug/dbgthsh.prg +++ b/src/debug/dbgthsh.prg @@ -46,7 +46,7 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" #include "inkey.ch" @@ -105,7 +105,7 @@ METHOD addWindows( hHash, nRow ) CLASS HBDbHash oBrwSets := HBDbBrowser():New( oWndSets:nTop + 1, oWndSets:nLeft + 1, oWndSets:nBottom - 1, oWndSets:nRight - 1 ) oBrwSets:ColorSpec := __dbg():ClrModal() - oBrwSets:Cargo := { 1, {} } // Actual highligthed row + oBrwSets:Cargo := { 1, {} } // Actual highlighted row AAdd( oBrwSets:Cargo[ 2 ], hHash ) oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| ::hashName + "[" + HashKeyString( hHash, oBrwSets:cargo[ 1 ] ) + "]" } ) ) @@ -150,7 +150,7 @@ METHOD PROCEDURE doGet( oBrowse, pItem, nSet ) CLASS HBDbHash IF __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1, ; oBrowse:getColumn( 2 ):Width, @cValue, ; __dbgExprValidBlock(), __dbgColors()[ 2 ], 256 ) - BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } + BEGIN SEQUENCE WITH __BreakBlock() hb_HValueAt( pItem, nSet, &cValue ) RECOVER USING oErr __dbgAlert( oErr:description ) diff --git a/src/debug/dbgtinp.prg b/src/debug/dbgtinp.prg index 60d8936cd2..dfce49521d 100644 --- a/src/debug/dbgtinp.prg +++ b/src/debug/dbgtinp.prg @@ -46,7 +46,7 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" #include "inkey.ch" @@ -54,7 +54,7 @@ #include "setcurs.ch" -CREATE CLASS HbDbInput +CREATE CLASS HBDbInput HIDDEN: @@ -80,7 +80,7 @@ CREATE CLASS HbDbInput ENDCLASS -METHOD new( nRow, nCol, nWidth, cValue, cColor, nSize ) CLASS HbDbInput +METHOD new( nRow, nCol, nWidth, cValue, cColor, nSize ) CLASS HBDbInput ::nRow := nRow ::nCol := nCol @@ -92,7 +92,7 @@ METHOD new( nRow, nCol, nWidth, cValue, cColor, nSize ) CLASS HbDbInput RETURN Self -METHOD SetColor( cColor ) CLASS HbDbInput +METHOD SetColor( cColor ) CLASS HBDbInput ::acColor := { hb_ColorIndex( cColor, CLR_STANDARD ), ; hb_ColorIndex( cColor, CLR_ENHANCED ) } @@ -102,24 +102,24 @@ METHOD SetColor( cColor ) CLASS HbDbInput RETURN Self -METHOD newPos( nRow, nCol ) CLASS HbDbInput +METHOD newPos( nRow, nCol ) CLASS HBDbInput ::nRow := nRow ::nCol := nCol RETURN Self -METHOD getValue() CLASS HbDbInput +METHOD getValue() CLASS HBDbInput RETURN ::cValue -METHOD setValue( cValue ) CLASS HbDbInput +METHOD setValue( cValue ) CLASS HBDbInput ::cValue := PadR( cValue, ::nSize ) ::nPos := Min( ::nSize, Len( RTrim( ::cValue ) ) + 1 ) RETURN Self -METHOD display() CLASS HbDbInput +METHOD display() CLASS HBDbInput IF ::nPos < ::nFirst ::nFirst := ::nPos @@ -131,14 +131,14 @@ METHOD display() CLASS HbDbInput RETURN Self -METHOD showCursor() CLASS HbDbInput +METHOD showCursor() CLASS HBDbInput SetPos( ::nRow, ::nCol + ::nPos - ::nFirst ) SetCursor( iif( Set( _SET_INSERT ), SC_INSERT, SC_NORMAL ) ) RETURN Self -METHOD applyKey( nKey ) CLASS HbDbInput +METHOD applyKey( nKey ) CLASS HBDbInput LOCAL lUpdate := .T. diff --git a/src/debug/dbgtmenu.prg b/src/debug/dbgtmenu.prg index c61ff7667a..ae286c3c50 100644 --- a/src/debug/dbgtmenu.prg +++ b/src/debug/dbgtmenu.prg @@ -50,7 +50,7 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" #include "hbmemvar.ch" diff --git a/src/debug/dbgtmitm.prg b/src/debug/dbgtmitm.prg index a6ddd0e055..ad5fbaf159 100644 --- a/src/debug/dbgtmitm.prg +++ b/src/debug/dbgtmitm.prg @@ -50,7 +50,7 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" CREATE CLASS HBDbMenuItem diff --git a/src/debug/dbgtobj.prg b/src/debug/dbgtobj.prg index f23a884c65..6940e72a72 100644 --- a/src/debug/dbgtobj.prg +++ b/src/debug/dbgtobj.prg @@ -46,13 +46,13 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" #include "inkey.ch" #include "setcurs.ch" -/* object message descirption */ +/* object message description */ #define OMSG_NAME 1 #define OMSG_VALUE 2 #define OMSG_EDIT 3 @@ -186,7 +186,7 @@ METHOD PROCEDURE doGet( oBrowse ) CLASS HBDbObject IF __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1, ; oBrowse:getColumn( oBrowse:colPos ):Width, @cValue, ; __dbgExprValidBlock(), __dbgColors()[ 2 ], 256 ) - BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } + BEGIN SEQUENCE WITH __BreakBlock() __dbgObjSetValue( ::TheObj, aItemRef[ OMSG_NAME ], &cValue ) RECOVER USING oErr __dbgAlert( oErr:description ) @@ -273,7 +273,7 @@ STATIC FUNCTION __dbgObjGetValue( oObject, cVar, lCanAcc ) xResult := __dbgSendMsg( nProcLevel, oObject, cVar ) lCanAcc := .T. RECOVER - BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } + BEGIN SEQUENCE WITH __BreakBlock() /* Try to access variables using class code level */ xResult := __dbgSendMsg( 0, oObject, cVar ) lCanAcc := .T. @@ -293,7 +293,7 @@ STATIC FUNCTION __dbgObjSetValue( oObject, cVar, xValue ) BEGIN SEQUENCE WITH {|| Break() } __dbgSendMsg( nProcLevel, oObject, "_" + cVar, xValue ) RECOVER - BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } + BEGIN SEQUENCE WITH __BreakBlock() /* Try to access variables using class code level */ __dbgSendMsg( 0, oObject, "_" + cVar, xValue ) RECOVER USING oErr diff --git a/src/debug/dbgtwin.prg b/src/debug/dbgtwin.prg index e9ba2eeb7d..3c04136edc 100644 --- a/src/debug/dbgtwin.prg +++ b/src/debug/dbgtwin.prg @@ -51,7 +51,7 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" #include "hbmemvar.ch" diff --git a/src/debug/dbgwa.prg b/src/debug/dbgwa.prg index 10edc3cd0a..507f33e9cb 100644 --- a/src/debug/dbgwa.prg +++ b/src/debug/dbgwa.prg @@ -72,7 +72,7 @@ PROCEDURE __dbgShowWorkAreas() LOCAL nOldArea := Select() - hb_WAEval( {|| AAdd( aAlias, { select(), Alias() } ) } ) + hb_WAEval( {|| AAdd( aAlias, { Select(), Alias() } ) } ) IF Len( aAlias ) == 0 __dbgAlert( "No workareas in use" ) @@ -131,7 +131,7 @@ PROCEDURE __dbgShowWorkAreas() oCol:ColorBlock := {|| iif( aAlias[ n1 ][ 1 ] == Select() .AND. n2 == 1, { 3, 4 }, { 1, 2 } ) } - /* Struc browse */ + /* Structure browser */ aStruc := ( aAlias[ n1 ][ 1 ] )->( dbStruct() ) diff --git a/src/debug/debugger.prg b/src/debug/debugger.prg index 0d0b0d5842..caa79ceed0 100644 --- a/src/debug/debugger.prg +++ b/src/debug/debugger.prg @@ -7,11 +7,6 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * @@ -57,10 +52,10 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" -#include "hbdebug.ch" /* for "nMode" of __dbgEntry */ +#include "hbdebug.ch" /* for "nMode" of __dbgEntry() */ #include "hbgtinfo.ch" #include "hbmemvar.ch" @@ -499,7 +494,7 @@ METHOD PROCEDURE BuildBrowseStack() CLASS HBDebugger ::oBrwStack:Cargo := Min( Max( ::oBrwStack:Cargo, 1 ), ; Len( ::aProcStack ) ), ::oBrwStack:Cargo - nOld } - ::oBrwStack:Cargo := 1 // Actual highligthed row + ::oBrwStack:Cargo := 1 // Actual highlighted row ::oBrwStack:AddColumn( HBDbColumnNew( "", {|| iif( Len( ::aProcStack ) > 0, ; PadC( ::aProcStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_FUNCTION ], 14 ), Space( 14 ) ) } ) ) @@ -721,7 +716,7 @@ METHOD PROCEDURE Colors() CLASS HBDebugger RETURN ENDIF - oBrwColors:Cargo := { 1, {} } // Actual highligthed row + oBrwColors:Cargo := { 1, {} } // Actual highlighted row oBrwColors:ColorSpec := ::ClrModal() oBrwColors:goTopBlock := {|| oBrwColors:cargo[ 1 ] := 1 } oBrwColors:goBottomBlock := {|| oBrwColors:cargo[ 1 ] := Len( oBrwColors:cargo[ 2 ][ 1 ] ) } @@ -1318,7 +1313,7 @@ METHOD PROCEDURE EditVar( nVar ) CLASS HBDebugger cVarStr := ::InputBox( cVarName, __dbgValToExp( uVarValue ), __dbgExprValidBlock() ) IF LastKey() != K_ESC - BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } + BEGIN SEQUENCE WITH __BreakBlock() ::VarSetValue( ::aVars[ nVar ], &cVarStr ) RECOVER USING oErr __dbgAlert( oErr:description ) @@ -2147,7 +2142,7 @@ METHOD PROCEDURE OSShell() CLASS HBDebugger QOut( "Type 'exit' to RETURN to the Debugger" ) SetCursor( SC_NORMAL ) // standard cursor for OS shell - BEGIN SEQUENCE WITH {| objErr | Break( objErr ) } + BEGIN SEQUENCE WITH __BreakBlock() #if defined( __PLATFORM__WINDOWS ) .OR. ; defined( __PLATFORM__DOS ) .OR. ; @@ -2412,8 +2407,8 @@ METHOD PROCEDURE SaveAppScreen() CLASS HBDebugger METHOD PROCEDURE SaveAppState() CLASS HBDebugger - ::nAppDirCase := Set( _SET_DIRCASE, 0 ) - ::nAppFileCase := Set( _SET_FILECASE, 0 ) + ::nAppDirCase := Set( _SET_DIRCASE, HB_SET_CASE_MIXED ) + ::nAppFileCase := Set( _SET_FILECASE, HB_SET_CASE_MIXED ) ::nAppTypeAhead := Set( _SET_TYPEAHEAD, 16 ) ::nAppLastKey := LastKey() @@ -3065,10 +3060,13 @@ METHOD TracepointAdd( cExpr ) CLASS HBDebugger RETURN Self ENDIF ENDIF + cExpr := AllTrim( cExpr ) + IF Empty( cExpr ) RETURN Self ENDIF + aWatch := { "tp", cExpr, NIL } ::RestoreAppState() __dbgAddWatch( ::pInfo, cExpr, .T. ) @@ -3217,20 +3215,21 @@ METHOD WatchpointDel( xPos ) CLASS HBDebugger LOCAL nPos := -1, lAll := .F. IF ::oWndPnt != NIL .AND. ::oWndPnt:lVisible - IF Empty( xPos ) - nPos := ::InputBox( "Enter item number to delete", ::oBrwPnt:cargo[ 1 ] - 1 ) - IF LastKey() == K_ESC - nPos := -1 - ENDIF - ELSEIF HB_ISSTRING( xPos ) + DO CASE + CASE HB_ISSTRING( xPos ) IF Upper( xPos ) == "ALL" lAll := .T. ELSEIF IsDigit( xPos ) nPos := Val( xPos ) ENDIF - ELSEIF HB_ISNUMERIC( xPos ) + CASE HB_ISNUMERIC( xPos ) nPos := xPos - ENDIF + OTHERWISE + nPos := ::InputBox( "Enter item number to delete", ::oBrwPnt:cargo[ 1 ] - 1 ) + IF LastKey() == K_ESC + nPos := -1 + ENDIF + ENDCASE IF lAll .OR. ( nPos >= 0 .AND. nPos < Len( ::aWatch ) ) ::oBrwPnt:gotop() @@ -3577,6 +3576,7 @@ STATIC FUNCTION hb_LeftEqN( cLine, cStart, nMin ) FUNCTION __dbgExprValidBlock( cType ) + LOCAL cTypeName IF HB_ISSTRING( cType ) @@ -3731,7 +3731,7 @@ FUNCTION __dbgRestScreen( ... ) FUNCTION __dbgTextToArray( cString ) - RETURN hb_ATokens( StrTran( cString, Chr( 13 ) ), Chr( 10 ) ) + RETURN hb_ATokens( cString, .T. ) FUNCTION __dbgValToStr( uVal ) diff --git a/src/debug/en.txt b/src/debug/en.txt index 380bdcfc35..36066ca27d 100644 --- a/src/debug/en.txt +++ b/src/debug/en.txt @@ -85,7 +85,7 @@ End In Code window, scrolls hard right. of line. In other windows, does nothing. -Esc In Command window, clears command line. +Esc In Command window, clears command-line. In other windows, does nothing. -- Other TAB Next window @@ -138,7 +138,7 @@ windows: One debugger window is active at a time. The active window -is displayed with a hilighted border. TAB and SHIFT-TAB +is displayed with a highlighted border. TAB and SHIFT-TAB navigate among open windows. The Window menu contains options to Move, Size, Zoom and @@ -163,7 +163,7 @@ active. When the Command window is active, the UP and DOWN arrow keys can be used to recall previous commands. -- Code -The Code window displays Clipper source code for +The Code window displays Harbour source code for the program being debugged. @@ -171,7 +171,7 @@ What file the Code window displays may be controlled in the following ways: 1. By default, the Code window will contain the line - of Clipper code currently being executed. + of Harbour code currently being executed. 2. If the CallStack window is open, the code being viewed is that of the selected call in the CallStack @@ -186,8 +186,8 @@ in the following ways: command, or selecting the File:View menu option. -If the Code window contains the line of Clipper code -currently being executed, that line will be hilighted. +If the Code window contains the line of Harbour code +currently being executed, that line will be highlighted. Any lines which have Breakpoints set on them will also be marked. @@ -296,11 +296,11 @@ Options: of the file onward. Next - Search for the next occurence of the Find string, + Search for the next occurrence of the Find string, from the cursor line onward. Prev - Search for the previous occurence of the Find string, + Search for the previous occurrence of the Find string, from the cursor line backward. Goto Line... @@ -362,7 +362,7 @@ Options: current value of a Watchpoint is displayed in the Watch window during debugging. - A Watchpoint may be any valid Clipper expression, + A Watchpoint may be any valid Harbour expression, i.e.: s // variable @@ -581,7 +581,7 @@ LIST BP|WP|TP the Command Window. NEXT - Search for next occurence of FIND string. + Search for next occurrence of FIND string. NUM ON|off Toggle display of line numbers in Code window. @@ -591,7 +591,7 @@ OUTPUT PREV - Search for previous occurence of FIND string. + Search for previous occurrence of FIND string. QUIT Quit. diff --git a/src/debug/tbrwtext.prg b/src/debug/tbrwtext.prg index e80276af05..9b3411cffc 100644 --- a/src/debug/tbrwtext.prg +++ b/src/debug/tbrwtext.prg @@ -46,7 +46,7 @@ #pragma -b- -#define HB_CLS_NOTOBJECT /* do not inherit from HBObject calss */ +#define HB_CLS_NOTOBJECT /* do not inherit from HBObject class */ #include "hbclass.ch" CREATE CLASS HBBrwText diff --git a/src/hbextern/hbextern.prg b/src/hbextern/hbextern.prg index 6d7543fe99..5dc6fb88dd 100644 --- a/src/hbextern/hbextern.prg +++ b/src/hbextern/hbextern.prg @@ -1,5 +1,5 @@ /* - * library with all function binding available for .prg code + * Library with all function bindings available for .prg code * * Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/lang/l_de_at.c b/src/lang/l_de_at.c index dacc2b6ef7..0488f04530 100644 --- a/src/lang/l_de_at.c +++ b/src/lang/l_de_at.c @@ -8,8 +8,8 @@ static HB_LANG s_lang = /* Identification */ "de_AT", - "German-Austria", - "Deutsch-Österreich", + "German (Austria)", + "Deutsch (Österreich)", "", "UTF8", "", diff --git a/src/macro/macro.y b/src/macro/macro.y index 5cf980f358..8a9d5a4842 100644 --- a/src/macro/macro.y +++ b/src/macro/macro.y @@ -165,7 +165,7 @@ } valDouble; struct { - long date; /* to hold julian date */ + long date; /* to hold Julian date */ long time; /* to hold milliseconds */ } valTimeStamp; } @@ -188,9 +188,9 @@ extern void yyerror( PHB_MACRO, const char * ); /* parsing error management f %token EPSILON /*the lowest precedence*/ -/*postincrement and postdecrement*/ +/*post-increment and post-decrement*/ %left POST -/*assigment - from right to left*/ +/*assignment - from right to left*/ %right INASSIGN %right PLUSEQ MINUSEQ %right MULTEQ DIVEQ MODEQ @@ -207,7 +207,7 @@ extern void yyerror( PHB_MACRO, const char * ); /* parsing error management f %right '*' '/' '%' %right POWER %right UNARY -/*preincrement and predecrement*/ +/*pre-increment and pre-decrement*/ %right PRE /*special operators*/ %right ALIASOP '&' '@' @@ -780,7 +780,7 @@ static PHB_EXPR hb_macroExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_macroExprNew(%p,%i)", HB_COMP_PARAM, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroExprNew(%p,%i)", ( void * ) HB_COMP_PARAM, iType ) ); pExpr = hb_macroExprAlloc( HB_COMP_PARAM ); pExpr->ExprType = iType; diff --git a/src/macro/macro.yyc b/src/macro/macro.yyc index aa7555a33b..8bb9227597 100644 --- a/src/macro/macro.yyc +++ b/src/macro/macro.yyc @@ -3048,7 +3048,7 @@ static PHB_EXPR hb_macroExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) { PHB_EXPR pExpr; - HB_TRACE( HB_TR_DEBUG, ( "hb_macroExprNew(%p,%i)", HB_COMP_PARAM, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroExprNew(%p,%i)", ( void * ) HB_COMP_PARAM, iType ) ); pExpr = hb_macroExprAlloc( HB_COMP_PARAM ); pExpr->ExprType = iType; diff --git a/src/macro/macroa.c b/src/macro/macroa.c index fd19309f13..09fcb20e55 100644 --- a/src/macro/macroa.c +++ b/src/macro/macroa.c @@ -1,5 +1,5 @@ /* hbexpra.c is also included from ../compiler/expropta.c - * However it produces a slighty different code if used in + * However it produces a slightly different code if used in * macro compiler (there is an additional parameter passed to some functions) */ diff --git a/src/macro/macrob.c b/src/macro/macrob.c index 791cb029e1..da625c3b62 100644 --- a/src/macro/macrob.c +++ b/src/macro/macrob.c @@ -1,5 +1,5 @@ /* hbexprb.c is also included from ../compiler/exproptb.c - * However it produces a slighty different code if used in + * However it produces a slightly different code if used in * macro compiler (there is an additional parameter passed to some functions) */ diff --git a/src/macro/macrolex.c b/src/macro/macrolex.c index 134814a4bc..c6d9ff5fad 100644 --- a/src/macro/macrolex.c +++ b/src/macro/macrolex.c @@ -1,5 +1,5 @@ /* - * small and MT safe lexer for macro compiler + * Small and MT safe lexer for macro compiler * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/main/harbour.c b/src/main/harbour.c index a320625d35..4612135d0e 100644 --- a/src/main/harbour.c +++ b/src/main/harbour.c @@ -1,5 +1,5 @@ /* - * + * Harbour standalone compiler entry point * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/nortl/nortl.c b/src/nortl/nortl.c index d75ed74198..5209979d0d 100644 --- a/src/nortl/nortl.c +++ b/src/nortl/nortl.c @@ -1,5 +1,5 @@ /* - * + * Standalone RTL stubs * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -53,9 +53,7 @@ #include "hbcomp.h" #include "hbmemory.ch" -/* ------------------------------------------------------------------------- */ -/* FM statistic module */ -/* ------------------------------------------------------------------------- */ +/* --- FM statistic module --- */ /* remove this 'undef' when number of memory leaks will be reduced to reasonable size */ @@ -68,7 +66,7 @@ #define HB_MEMSTR_BLOCK_MAX 256 #ifndef HB_MEMFILER -# define HB_MEMFILER 0xff +#define HB_MEMFILER 0xff #endif typedef struct _HB_MEMINFO @@ -311,7 +309,7 @@ void hb_xexit( void ) for( i = 1, pMemBlock = s_pMemBlocks; pMemBlock; ++i, pMemBlock = pMemBlock->pNextBlock ) HB_TRACE( HB_TR_ERROR, ( "Block %i %p (size %" HB_PFS "u) \"%s\"", i, - ( char * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->nSize, + ( void * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->nSize, hb_memToStr( szBuffer, ( char * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->nSize ) ) ); } @@ -510,7 +508,6 @@ const char * hb_fsNameConv( const char * szFileName, char ** pszFree ) s_iFileCase != HB_SET_CASE_MIXED || s_iDirCase != HB_SET_CASE_MIXED ) { PHB_FNAME pFileName; - HB_SIZE nLen; if( pszFree ) { @@ -534,6 +531,8 @@ const char * hb_fsNameConv( const char * szFileName, char ** pszFree ) /* strip trailing and leading spaces */ if( s_fFnTrim ) { + HB_SIZE nLen; + if( pFileName->szName ) { nLen = strlen( pFileName->szName ); @@ -604,7 +603,6 @@ HB_WCHAR * hb_fsNameConvU16( const char * szFileName ) s_iFileCase != HB_SET_CASE_MIXED || s_iDirCase != HB_SET_CASE_MIXED ) { PHB_FNAME pFileName; - HB_SIZE nLen; szFileName = pszBuffer = hb_strncpy( ( char * ) hb_xgrab( HB_PATH_MAX ), szFileName, HB_PATH_MAX - 1 ); @@ -625,6 +623,8 @@ HB_WCHAR * hb_fsNameConvU16( const char * szFileName ) /* strip trailing and leading spaces */ if( s_fFnTrim ) { + HB_SIZE nLen; + if( pFileName->szName ) { nLen = strlen( pFileName->szName ); diff --git a/src/pp/hbpp.1 b/src/pp/hbpp.1 index fc736d3898..4e9ffdfe23 100644 --- a/src/pp/hbpp.1 +++ b/src/pp/hbpp.1 @@ -44,4 +44,4 @@ directories, much like shell's \fB\s-1PATH\s0\fR. It's used by \fBhbpp\fR as default search paths for included files. .SH AUTHOR -Przemyslaw Czerpak, The Harbour Project (http://harbour-project.org) +Przemyslaw Czerpak, The Harbour Project diff --git a/src/pp/hbpp.c b/src/pp/hbpp.c index 93c44c00af..13f160bb7c 100644 --- a/src/pp/hbpp.c +++ b/src/pp/hbpp.c @@ -1,7 +1,7 @@ /* - * preprocessor static rules generator. - * It creates .c file with tables for defines/[x]translates/[x]commands - * found in given .ch or .prg file + * Preprocessor static rules generator. + * It creates .c file with tables for defines/[x]translates/[x]commands + * found in given .ch or .prg file * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -193,8 +193,8 @@ static void hb_pp_generateRules( FILE * fout, PHB_PP_STATE pState, const char * { int iDefs = 0, iTrans = 0, iCmds = 0; - fprintf( fout, "/*\n * $" "Id" "$\n */\n\n/*\n" - " * Build in preprocessor rules.\n" + fprintf( fout, "/*\n" + " * Built-in preprocessor rules.\n" " *\n" " * Copyright 2006-2016 Przemyslaw Czerpak <druzus / at / priv.onet.pl>\n" " *\n" @@ -321,7 +321,6 @@ static char * hb_pp_escapeString( char * szString ) static int hb_pp_generateVerInfo( char * szVerFile, int iRevID, char * szChangeLogID, char * szLastEntry ) { int iResult = 0; - char * pszEnv; FILE * fout; fout = hb_fopen( szVerFile, "w" ); @@ -334,6 +333,7 @@ static int hb_pp_generateVerInfo( char * szVerFile, int iRevID, char * szChangeL } else { + char * pszEnv; char * pszEscaped; fprintf( fout, "/*\n" diff --git a/src/pp/ppcore.c b/src/pp/ppcore.c index e77369272c..cd08ced465 100644 --- a/src/pp/ppcore.c +++ b/src/pp/ppcore.c @@ -193,7 +193,7 @@ static const HB_PP_OPERATOR s_operators[] = { "%" , 1, "%" , HB_PP_TOKEN_MOD | HB_PP_TOKEN_STATIC }, { "^" , 1, "^" , HB_PP_TOKEN_POWER | HB_PP_TOKEN_STATIC } /* unused: ? ~ " ' ` */ -/* not accesible: " ' ` */ +/* not accessible: " ' ` */ /* illegal in Clipper: ~ */ }; @@ -270,7 +270,7 @@ static const HB_PP_OPERATOR * hb_pp_operatorFind( PHB_PP_STATE pState, } pOperator = s_operators; - i = sizeof( s_operators ) / sizeof( HB_PP_OPERATOR ); + i = HB_SIZEOFARRAY( s_operators ); do { @@ -394,13 +394,12 @@ static void hb_pp_tokenListFree( PHB_PP_TOKEN * pTokenPtr ) static int hb_pp_tokenListFreeCmd( PHB_PP_TOKEN * pTokenPtr ) { - PHB_PP_TOKEN pToken; HB_BOOL fStop = HB_FALSE; int iLines = 0; while( *pTokenPtr && ! fStop ) { - pToken = *pTokenPtr; + PHB_PP_TOKEN pToken = *pTokenPtr; *pTokenPtr = pToken->pNext; if( HB_PP_TOKEN_TYPE( pToken->type ) == HB_PP_TOKEN_EOL ) ++iLines; @@ -777,15 +776,15 @@ static HB_BOOL hb_pp_canQuote( HB_BOOL fQuote, char * pBuffer, HB_SIZE nLen, static HB_BOOL hb_pp_hasCommand( char * pBuffer, HB_SIZE nLen, HB_SIZE * pnAt, int iCmds, ... ) { - HB_SIZE n = 0, nl; - char * cmd; + HB_SIZE n = 0; va_list va; int i; va_start( va, iCmds ); for( i = 0; i < iCmds && n < nLen; ++i ) { - cmd = va_arg( va, char * ); + HB_SIZE nl; + char * cmd = va_arg( va, char * ); nl = strlen( cmd ); while( n < nLen && HB_PP_ISBLANK( pBuffer[ n ] ) ) ++n; @@ -884,8 +883,7 @@ static void hb_pp_dumpEnd( PHB_PP_STATE pState ) static void hb_pp_getLine( PHB_PP_STATE pState ) { PHB_PP_TOKEN * pInLinePtr, * pEolTokenPtr; - char * pBuffer, ch; - HB_SIZE nLen, n; + char * pBuffer; HB_BOOL fDump = HB_FALSE; int iLines = 0, iStartLine; @@ -904,6 +902,8 @@ static void hb_pp_getLine( PHB_PP_STATE pState ) do { + HB_SIZE nLen, n; + hb_membufFlush( pState->pBuffer ); hb_pp_readLine( pState ); pBuffer = hb_membufPtr( pState->pBuffer ); @@ -936,7 +936,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState ) n = 0; while( n < nLen || fDump ) { - ch = pBuffer[ 0 ]; + char ch = pBuffer[ 0 ]; if( pState->iStreamDump ) { fDump = HB_FALSE; @@ -1226,7 +1226,8 @@ static void hb_pp_getLine( PHB_PP_STATE pState ) nLen += hb_membufLen( pState->pBuffer ) - u; pBuffer = hb_membufPtr( pState->pBuffer ) + u - n; --n; - while( ++n < nLen && pBuffer[ n ] != ch ) {} + while( ++n < nLen && pBuffer[ n ] != ch ) + ; } else { @@ -1262,7 +1263,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState ) } else if( ch == '*' && pState->pFile->iTokens == 0 ) { - /* strip the rest of line with // or && comment */ + /* strip the rest of line with * comment */ n = nLen; } else if( ch == '/' && nLen > 1 && pBuffer[ 1 ] == '*' ) @@ -1306,7 +1307,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState ) ; /* - * In Clipper note can be used only as 1-st token and after + * In Clipper note can be used only as 1st token and after * statement separator ';' it does not work like a single line * comment. */ @@ -3182,7 +3183,7 @@ static HB_BOOL hb_pp_matchPatternNew( PHB_PP_STATE pState, PHB_PP_TOKEN * pToken return HB_FALSE; } /* replace the order for these optional tokens to keep - the ones with keywords 1-st */ + the ones with keywords 1st */ ( *pTokenPtr )->pMTokens = *pLastPtr; *pLastPtr = pOptTok; } @@ -3414,7 +3415,7 @@ static void hb_pp_directiveNew( PHB_PP_STATE pState, PHB_PP_TOKEN pToken, { if( pMatch ) { - /* Clipper PP makes sth like that for result pattern of + /* Clipper PP makes something like that for result pattern of #[x]translate and #[x]command */ if( pStart->spaces > 1 ) pStart->spaces = 1; @@ -3821,7 +3822,7 @@ static HB_BOOL hb_pp_tokenMatch( PHB_PP_TOKEN pMatch, PHB_PP_TOKEN * pTokenPtr, /* * Here we are strictly Clipper compatible. Clipper accepts dummy - * restrict marker which starts from comma, <id: ,[ sth,...]> + * restrict marker which starts from comma, <id: ,[ something,...]> * which always match empty expression. The same effect can be * reached by giving ,, in the world list on other positions. */ @@ -4208,15 +4209,14 @@ static PHB_PP_TOKEN * hb_pp_matchResultAdd( PHB_PP_STATE pState, { PHB_PP_RESULT pMarkerResult = hb_pp_matchResultGet( pRule, usMatch, pMatch->index ); PHB_PP_TOKEN pToken, pStop; - HB_BOOL fSpaces, fFirst; if( HB_PP_TOKEN_TYPE( pMatch->type ) == HB_PP_RMARKER_REGULAR ) { if( pMarkerResult ) { + HB_BOOL fFirst = HB_TRUE; pToken = pMarkerResult->pFirstToken; pStop = pMarkerResult->pNextExpr; - fFirst = HB_TRUE; if( pToken != pStop ) { do @@ -4243,7 +4243,7 @@ static PHB_PP_TOKEN * hb_pp_matchResultAdd( PHB_PP_STATE pState, pStop = pMarkerResult->pNextExpr; if( pToken != pStop ) { - fSpaces = HB_FALSE; + HB_BOOL fSpaces = HB_FALSE; do { hb_pp_tokenStr( pToken, pState->pBuffer, fSpaces, HB_FALSE, 0 ); @@ -4389,7 +4389,7 @@ static char * hb_pp_tokenListStr( PHB_PP_TOKEN pToken, PHB_PP_TOKEN pStop, static void hb_pp_patternReplace( PHB_PP_STATE pState, PHB_PP_RULE pRule, PHB_PP_TOKEN * pTokenPtr, const char * szType ) { - PHB_PP_TOKEN pFinalResult = NULL, * pResultPtr, pToken, pSource; + PHB_PP_TOKEN pFinalResult = NULL, * pResultPtr, pSource; pResultPtr = hb_pp_patternStuff( pState, pRule, 0, pRule->pResult, &pFinalResult ); @@ -4424,7 +4424,7 @@ static void hb_pp_patternReplace( PHB_PP_STATE pState, PHB_PP_RULE pRule, /* Free the matched tokens */ while( pSource != pRule->pNextExpr ) { - pToken = pSource; + PHB_PP_TOKEN pToken = pSource; pSource = pSource->pNext; hb_pp_tokenFree( pToken ); } @@ -4549,13 +4549,12 @@ static HB_BOOL hb_pp_processDefine( PHB_PP_STATE pState, PHB_PP_TOKEN * pFirstPt static HB_BOOL hb_pp_processTranslate( PHB_PP_STATE pState, PHB_PP_TOKEN * pFirstPtr ) { - PHB_PP_TOKEN * pTokenPtr; HB_BOOL fSubst = HB_FALSE, fRepeat; int iCycle = 0; do { - pTokenPtr = pFirstPtr; + PHB_PP_TOKEN * pTokenPtr = pFirstPtr; fRepeat = HB_FALSE; while( ! HB_PP_TOKEN_ISEOS( *pTokenPtr ) ) { @@ -5434,7 +5433,6 @@ static void hb_pp_preprocessToken( PHB_PP_STATE pState ) void hb_pp_initRules( PHB_PP_RULE * pRulesPtr, int * piRules, const HB_PP_DEFRULE pDefRules[], int iDefRules ) { - const HB_PP_DEFRULE * pDefRule; PHB_PP_MARKER pMarkers; PHB_PP_RULE pRule; @@ -5443,7 +5441,7 @@ void hb_pp_initRules( PHB_PP_RULE * pRulesPtr, int * piRules, while( --iDefRules >= 0 ) { - pDefRule = pDefRules + iDefRules; + const HB_PP_DEFRULE * pDefRule = pDefRules + iDefRules; if( pDefRule->markers > 0 ) { HB_USHORT marker; @@ -5641,7 +5639,6 @@ void hb_pp_setStdBase( PHB_PP_STATE pState ) */ void hb_pp_initDynDefines( PHB_PP_STATE pState, HB_BOOL fArchDefs ) { - char szDefine[ 65 ]; char szResult[ 65 ]; int iYear, iMonth, iDay, i; long lDate, lTime; @@ -5650,6 +5647,8 @@ void hb_pp_initDynDefines( PHB_PP_STATE pState, HB_BOOL fArchDefs ) { static const char * s_szPlatform = "__PLATFORM__%s"; + char szDefine[ 65 ]; + if( hb_verPlatformMacro() ) { hb_snprintf( szDefine, sizeof( szDefine ), s_szPlatform, hb_verPlatformMacro() ); @@ -5728,7 +5727,6 @@ void hb_pp_readRules( PHB_PP_STATE pState, const char * szRulesFile ) char szFileName[ HB_PATH_MAX ]; PHB_PP_FILE pFile = pState->pFile; PHB_FNAME pFileName; - HB_BOOL fError = HB_FALSE; pFileName = hb_fsFNameSplit( szRulesFile ); if( ! pFileName->szExtension ) @@ -5745,6 +5743,8 @@ void hb_pp_readRules( PHB_PP_STATE pState, const char * szRulesFile ) } else { + HB_BOOL fError = HB_FALSE; + pState->iFiles++; pState->usLastType = HB_PP_TOKEN_NUL; while( hb_pp_tokenGet( pState ) ) diff --git a/src/pp/pplib.c b/src/pp/pplib.c index 562b6978b9..f30e710401 100644 --- a/src/pp/pplib.c +++ b/src/pp/pplib.c @@ -44,9 +44,8 @@ * */ - -#include "hbpp.h" #include "hbapi.h" +#include "hbpp.h" #include "hbapiitm.h" #include "hbapifs.h" #include "hbapierr.h" @@ -58,7 +57,7 @@ static void hb_pp_ErrorMessage( void * cargo, const char * const szMsgTable[], char cPrefix, int iCode, const char * szParam1, const char * szParam2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_pp_ErrorGen(%p, %p, %c, %d, %s, %s)", cargo, szMsgTable, cPrefix, iCode, szParam1, szParam2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_pp_ErrorGen(%p, %p, %c, %d, %s, %s)", cargo, ( const void * ) szMsgTable, cPrefix, iCode, szParam1, szParam2 ) ); HB_SYMBOL_UNUSED( cargo ); @@ -148,18 +147,19 @@ PHB_PP_STATE hb_pp_Param( int iParam ) /* * initialize new PP context and return pointer to it. - * __pp_Init( [<cIncludePath>], [<cStdChFile> ] [, <lArchDefs>] ) -> <pPP> + * __pp_Init( [<cIncludePath>], [<cStdChFile> ] [, <lArchDefs>] ) --> <pPP> * when <cStdChFile> is empty string ("") then no default rules are used * only the dynamically created #defines like __HARBOUR__, __DATE__, __TIME__ */ HB_FUNC( __PP_INIT ) { - PHB_PP_STATE * pStatePtr, pState = hb_pp_new(); + PHB_PP_STATE pState = hb_pp_new(); if( pState ) { + PHB_PP_STATE * pStatePtr; const char * szPath = hb_parc( 1 ), * szStdCh = hb_parc( 2 ); - HB_BOOL fArchDefs = hb_parldef( 3, 1 ); + HB_BOOL fArchDefs = hb_parldef( 3, HB_TRUE ); PHB_ITEM ppItem; pStatePtr = ( PHB_PP_STATE * ) hb_gcAllocate( sizeof( PHB_PP_STATE ), @@ -190,7 +190,7 @@ HB_FUNC( __PP_INIT ) /* * add new (or replace previous) include paths. - * __pp_Path( <pPP>, <cPath> [, <lClearPrev>] ) -> NIL + * __pp_Path( <pPP>, <cPath> [, <lClearPrev>] ) --> NIL */ HB_FUNC( __PP_PATH ) { @@ -202,7 +202,7 @@ HB_FUNC( __PP_PATH ) /* * reset the PP context (remove all rules added by user or preprocessed code) - * __pp_Reset( <pPP> ) -> NIL + * __pp_Reset( <pPP> ) --> NIL */ HB_FUNC( __PP_RESET ) { @@ -214,7 +214,7 @@ HB_FUNC( __PP_RESET ) /* * preprocess and execute new preprocessor directive - * __pp_AddRule( <pPP>, <cDirective> ) -> <lOK> + * __pp_AddRule( <pPP>, <cDirective> ) --> <lOK> */ HB_FUNC( __PP_ADDRULE ) { @@ -239,7 +239,7 @@ HB_FUNC( __PP_ADDRULE ) hb_pp_parseLine( pState, szText, &nLen ); /* probably for parsing #included files the old code was making - sth like that */ + something like that */ do { if( hb_vmRequestQuery() != 0 ) @@ -256,7 +256,7 @@ HB_FUNC( __PP_ADDRULE ) /* * preprocess given code and return result - * __pp_Process( <pPP>, <cCode> ) -> <cPreprocessedCode> + * __pp_Process( <pPP>, <cCode> ) --> <cPreprocessedCode> */ HB_FUNC( __PP_PROCESS ) { diff --git a/src/pp/pplib2.c b/src/pp/pplib2.c index f082f3d85e..6ec6b0fb65 100644 --- a/src/pp/pplib2.c +++ b/src/pp/pplib2.c @@ -1,8 +1,8 @@ /* * .prg interface to preprocessor - * __pp_StdRules() function - * intentionally in separate file to not force linking - * standard PP rules table when user does not need them + * __pp_StdRules() function + * intentionally in separate file to not force linking + * standard PP rules table when user does not need them * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -47,8 +47,8 @@ * */ -#include "hbpp.h" #include "hbapi.h" +#include "hbpp.h" HB_FUNC( __PP_STDRULES ) { diff --git a/src/rdd/dbcmd.c b/src/rdd/dbcmd.c index 74bc6dfade..b9d6b55c5f 100644 --- a/src/rdd/dbcmd.c +++ b/src/rdd/dbcmd.c @@ -3,6 +3,7 @@ * * Copyright 1999 Bruno Cantero <bruno@issnet.net> * Copyright 2004-2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> + * Copyright 2002 Horacio Roldan <harbour_ar@yahoo.com.ar> (hb_rddIterateWorkAreas(), hb_rddGetTempAlias()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,16 +46,6 @@ * */ -/* - * The following functions are added by - * Horacio Roldan <harbour_ar@yahoo.com.ar> - * - * hb_rddIterateWorkAreas() - * hb_rddGetTempAlias() - * hb_rddGetTempAlias() - * - */ - #include "hbapi.h" #include "hbapirdd.h" #include "hbapierr.h" @@ -62,7 +53,7 @@ #include "hbvm.h" #include "hbset.h" -/* The 5-th parameter is Harbour extensions */ +/* The 5th parameter is Harbour extension */ HB_FUNC( AFIELDS ) { HB_USHORT uiFields, uiCount; @@ -167,11 +158,8 @@ HB_FUNC( AFIELDS ) HB_FUNC( ALIAS ) { - int iArea; - AREAP pArea; + AREAP pArea = ( AREAP ) hb_rddGetWorkAreaPointer( ( HB_AREANO ) hb_parni( 1 ) ); - iArea = hb_parni( 1 ); - pArea = ( AREAP ) hb_rddGetWorkAreaPointer( iArea ); if( pArea ) { char szAlias[ HB_RDD_MAX_ALIAS_LEN + 1 ]; @@ -269,14 +257,14 @@ HB_FUNC( BOF ) hb_retl( bBof ); } -/* dbAppend( [<lUnLockAll>=.T.] ) -> <lSuccess> */ +/* dbAppend( [<lUnLockAll>=.T.] ) --> <lSuccess> */ HB_FUNC( DBAPPEND ) { AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) { - HB_BOOL bUnLockAll = hb_parldef( 1, 1 ); + HB_BOOL bUnLockAll = hb_parldef( 1, HB_TRUE ); HB_ERRCODE errCode; /* Clipper clears NETERR flag before APPEND */ @@ -315,25 +303,25 @@ HB_FUNC( DBCOMMITALL ) /* * In Clipper the arguments are: - * dbCreate( cFile, aStruct, cRDD, lKeepOpen, cAlias, cDelimArg ) -> NIL + * dbCreate( cFile, aStruct, cRDD, lKeepOpen, cAlias, cDelimArg ) --> NIL * In Harbour (HB_EXTENSION): * dbCreate( cFile, aStruct, cRDD, lKeepOpen, cAlias, cDelimArg, ; - * cCodePage, nConnection ) -> <lSuccess> + * cCodePage, nConnection ) --> <lSuccess> */ HB_FUNC( DBCREATE ) { const char * szFileName, * szAlias, * szDriver, * szCpId; HB_USHORT uiSize, uiLen; - PHB_ITEM pStruct, pFieldDesc, pDelim; + PHB_ITEM pStruct, pDelim; HB_BOOL fKeepOpen, fCurrArea; HB_ULONG ulConnection; /* - * NOTE: 4-th, 5-th and 6-th parameters are undocumented Clipper ones - * 4-th is boolean flag indicating if file should stay open (any boolean - * value will enable this behavior) - * 5-th is alias - if not given then WA is open without alias - * 6-th is optional DELIMITED value used by some RDDs like DELIM + * NOTE: 4th, 5th and 6th parameters are undocumented Clipper ones + * 4th is boolean flag indicating if file should stay open (any boolean + * value will enable this behavior) + * 5th is alias - if not given then WA is open without alias + * 6th is optional DELIMITED value used by some RDDs like DELIM */ szFileName = hb_parc( 1 ); @@ -366,7 +354,7 @@ HB_FUNC( DBCREATE ) for( uiSize = 1; uiSize <= uiLen; ++uiSize ) { - pFieldDesc = hb_arrayGetItemPtr( pStruct, uiSize ); + PHB_ITEM pFieldDesc = hb_arrayGetItemPtr( pStruct, uiSize ); /* Validate items types of fields */ if( hb_arrayLen( pFieldDesc ) < 4 || @@ -388,13 +376,13 @@ HB_FUNC( DBCREATE ) } /* - * hb_dbCreateTemp( <cAlias>, <aStruct>, <cRDD>, <cCodePage>, <nConnection> ) -> <lSuccess> + * hb_dbCreateTemp( <cAlias>, <aStruct>, <cRDD>, <cCodePage>, <nConnection> ) --> <lSuccess> */ HB_FUNC( HB_DBCREATETEMP ) { const char * szAlias, * szDriver, * szCpId; HB_USHORT uiSize, uiLen; - PHB_ITEM pStruct, pFieldDesc; + PHB_ITEM pStruct; HB_ULONG ulConnection; szAlias = hb_parc( 1 ); @@ -423,7 +411,7 @@ HB_FUNC( HB_DBCREATETEMP ) for( uiSize = 1; uiSize <= uiLen; ++uiSize ) { - pFieldDesc = hb_arrayGetItemPtr( pStruct, uiSize ); + PHB_ITEM pFieldDesc = hb_arrayGetItemPtr( pStruct, uiSize ); /* Validate items types of fields */ if( hb_arrayLen( pFieldDesc ) < 4 || @@ -453,20 +441,20 @@ HB_FUNC( HB_DBCREATETEMP ) if .F. it will be opened in the current one. */ /* NOTE: Has an identical parameter list with dbCreate() */ -/* __dbOpenSDF( cFile, aStruct, cRDD, lKeepOpen, cAlias, cDelimArg, cCodePage, nConnection ) -> <lSuccess> */ +/* __dbOpenSDF( cFile, aStruct, cRDD, lKeepOpen, cAlias, cDelimArg, cCodePage, nConnection ) --> <lSuccess> */ HB_FUNC( __DBOPENSDF ) { const char * szFileName, * szAlias, * szDriver, * szCpId; HB_USHORT uiSize, uiLen; - PHB_ITEM pStruct, pFieldDesc, pDelim; + PHB_ITEM pStruct, pDelim; HB_BOOL fKeepOpen, fCurrArea; HB_ULONG ulConnection; HB_ERRCODE errCode; /* - * NOTE: 4-th and 5-th parameters are undocumented Clipper ones - * 4-th is boolean flag indicating if file should stay open and - * 5-th is alias - if not given then WA is open without alias + * NOTE: 4th and 5th parameters are undocumented Clipper ones + * 4th is boolean flag indicating if file should stay open and + * 5th is alias - if not given then WA is open without alias */ szFileName = hb_parc( 1 ); @@ -490,7 +478,7 @@ HB_FUNC( __DBOPENSDF ) for( uiSize = 1; uiSize <= uiLen; ++uiSize ) { - pFieldDesc = hb_arrayGetItemPtr( pStruct, uiSize ); + PHB_ITEM pFieldDesc = hb_arrayGetItemPtr( pStruct, uiSize ); /* Validate items types of fields */ if( hb_arrayLen( pFieldDesc ) < 4 || @@ -575,11 +563,12 @@ HB_FUNC( DBGOTOP ) HB_FUNC( __DBLOCATE ) { - DBSCOPEINFO dbScopeInfo; AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) { + DBSCOPEINFO dbScopeInfo; + dbScopeInfo.itmCobFor = hb_param( 1, HB_IT_BLOCK ); dbScopeInfo.lpstrFor = NULL; dbScopeInfo.itmCobWhile = hb_param( 2, HB_IT_BLOCK ); @@ -630,7 +619,6 @@ HB_FUNC( __DBCONTINUE ) HB_FUNC( __DBPACK ) { - PHB_ITEM pBlock, pEvery; AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) @@ -639,9 +627,10 @@ HB_FUNC( __DBPACK ) * Additional feature: __dbPack( [<bBlock>, [<nEvery>] ) * Code Block to execute for every record. */ - pBlock = hb_param( 1, HB_IT_BLOCK ); + PHB_ITEM pBlock = hb_param( 1, HB_IT_BLOCK ); if( pBlock ) { + PHB_ITEM pEvery; hb_itemRelease( pArea->valResult ); pArea->valResult = hb_itemArrayNew( 2 ); hb_arraySet( pArea->valResult, 1, pBlock ); @@ -721,7 +710,7 @@ HB_FUNC( DBSEEK ) { PHB_ITEM pKey = hb_param( 1, HB_IT_ANY ); HB_BOOL bSoftSeek = HB_ISLOG( 2 ) ? ( HB_BOOL ) hb_parl( 2 ) : hb_setGetSoftSeek(); - HB_BOOL bFindLast = hb_parl( 3 ), fFound = HB_FALSE; + HB_BOOL bFindLast = hb_parl( 3 ) /* HB_EXTENSION */, fFound = HB_FALSE; if( SELF_SEEK( pArea, bSoftSeek, pKey, bFindLast ) == HB_SUCCESS ) { if( SELF_FOUND( pArea, &fFound ) != HB_SUCCESS ) @@ -841,7 +830,7 @@ HB_FUNC( DBFILTER ) hb_retc_null(); } -/* Harbour extension to retrieve CB */ +/* Harbour extension to retrieve filter codeblock */ HB_FUNC( HB_DBGETFILTER ) { AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); @@ -918,7 +907,7 @@ HB_FUNC( DBUNLOCKALL ) /* dbUseArea( [<lNewArea>], [<cDriver>], <cName>, [<xcAlias>], ; [<lShared>], [<lReadonly>], [<cCodePage>], ; - [<nConnection>] ) -> <lSuccess> */ + [<nConnection>] ) --> <lSuccess> */ HB_FUNC( DBUSEAREA ) { hb_retl( hb_rddOpenTable( hb_parc( 3 ), hb_parc( 2 ), @@ -983,7 +972,6 @@ HB_FUNC( FIELDGET ) HB_FUNC( FIELDNAME ) { - char * szName; AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); HB_USHORT uiFields, uiIndex = ( HB_FIELDNO ) hb_parni( 1 ); @@ -992,7 +980,7 @@ HB_FUNC( FIELDNAME ) if( SELF_FIELDCOUNT( pArea, &uiFields ) == HB_SUCCESS && uiIndex <= uiFields ) { - szName = ( char * ) hb_xgrab( pArea->uiMaxFieldNameLength + 1 ); + char * szName = ( char * ) hb_xgrab( pArea->uiMaxFieldNameLength + 1 ); szName[ 0 ] = '\0'; SELF_FIELDNAME( pArea, uiIndex, szName ); hb_retc_buffer( szName ); @@ -1094,7 +1082,6 @@ HB_FUNC( INDEXORD ) hb_retni( 0 ); } -/* Same as RecCount() */ HB_FUNC( LASTREC ) { HB_ULONG ulRecCount = 0; @@ -1223,7 +1210,7 @@ HB_FUNC( ORDCONDSET ) pItem = hb_param( 2, HB_IT_BLOCK ); lpdbOrdCondInfo->itmCobFor = pItem ? hb_itemNew( pItem ) : NULL; - lpdbOrdCondInfo->fAll = hb_parldef( 3, 1 ); + lpdbOrdCondInfo->fAll = hb_parldef( 3, HB_TRUE ); lpdbOrdCondInfo->abWhile = hb_parclen( 17 ) > 0 ? hb_strdup( hb_parc( 17 ) ) : NULL; @@ -1257,7 +1244,7 @@ HB_FUNC( ORDCONDSET ) /* 19th parameter is CL5.2 USEFILTER parameter which means that RDD should respect SET FILTER and SET DELETED flag */ lpdbOrdCondInfo->fUseFilter = hb_parl( 19 ); - /* 20th parameter is Harbour extenstion and informs RDD that + /* 20th parameter is Harbour extension and informs RDD that index is not shared between other clients */ lpdbOrdCondInfo->fExclusive = hb_parl( 20 ); @@ -1581,12 +1568,12 @@ HB_FUNC( RDDNAME ) HB_FUNC( RDDREGISTER ) { - HB_USHORT uiLen; - char szDriver[ HB_RDD_MAX_DRIVERNAME_LEN + 1 ]; + HB_USHORT uiLen = ( HB_USHORT ) hb_parclen( 1 ); - uiLen = ( HB_USHORT ) hb_parclen( 1 ); if( uiLen > 0 ) { + char szDriver[ HB_RDD_MAX_DRIVERNAME_LEN + 1 ]; + if( uiLen > HB_RDD_MAX_DRIVERNAME_LEN ) uiLen = HB_RDD_MAX_DRIVERNAME_LEN; @@ -1791,7 +1778,6 @@ HB_FUNC( DBSETRELATION ) DBRELINFO dbRelations; AREAP pChildArea; HB_AREANO uiChildArea; - char * szAlias = NULL; if( hb_pcount() < 2 || hb_param( 1, HB_IT_NUMERIC | HB_IT_STRING ) == NULL || @@ -1820,7 +1806,7 @@ HB_FUNC( DBSETRELATION ) if( ! pChildArea ) { - hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, szAlias, 0 ); + hb_errRT_BASE( EG_NOALIAS, EDBCMD_NOALIAS, NULL, NULL, 0 ); return; } @@ -1850,7 +1836,6 @@ HB_FUNC( __DBARRANGE ) /* TODO: check what Clipper does when pDstArea == NULL or pSrcArea == pDstArea */ if( pSrcArea && pDstArea && pSrcArea != pDstArea ) { - HB_USHORT uiCount, uiDest; DBSORTINFO dbSortInfo; /* structure with fields copied copied from source WorkArea */ PHB_ITEM pStruct = hb_param( 2, HB_IT_ARRAY ); @@ -1885,7 +1870,8 @@ HB_FUNC( __DBARRANGE ) dbSortInfo.uiItemCount = pFields ? ( HB_USHORT ) hb_arrayLen( pFields ) : 0; if( dbSortInfo.uiItemCount > 0 ) { - char * szFieldLine, * szPos; + HB_USHORT uiCount, uiDest; + char * szFieldLine; HB_SIZE nSize = 0; dbSortInfo.lpdbsItem = ( LPDBSORTITEM ) hb_xgrab( dbSortInfo.uiItemCount * sizeof( DBSORTITEM ) ); @@ -1898,6 +1884,7 @@ HB_FUNC( __DBARRANGE ) szFieldLine = ( char * ) hb_xgrab( nSize + 1 ); for( uiDest = 0, uiCount = 1; uiCount <= dbSortInfo.uiItemCount; ++uiCount ) { + char * szPos; dbSortInfo.lpdbsItem[ uiDest ].uiFlags = 0; hb_strncpyUpper( szFieldLine, hb_arrayGetCPtr( pFields, uiCount ), hb_arrayGetCLen( pFields, uiCount ) ); @@ -1954,7 +1941,7 @@ HB_FUNC( __DBARRANGE ) hb_retl( errCode == HB_SUCCESS ); } -/* __dbTrans( nDstArea, aFieldsStru, bFor, bWhile, nNext, nRecord, lRest ) -> <lSuccess> */ +/* __dbTrans( nDstArea, aFieldsStru, bFor, bWhile, nNext, nRecord, lRest ) --> <lSuccess> */ HB_FUNC( __DBTRANS ) { if( HB_ISNUM( 1 ) ) @@ -2033,7 +2020,7 @@ HB_FUNC( __DBTRANS ) /* __dbApp( <cNameName>, [<aFields>], ; [<bFor>], [<bWhile>], [<nNext>], [<nRecord>], [<lRest>], ; [<cRDD>], [<nConnection>], [<cCodePage>], ; - [<xDelimiter>] ) -> <lSuccess> */ + [<xDelimiter>] ) --> <lSuccess> */ HB_FUNC( __DBAPP ) { AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); @@ -2061,7 +2048,7 @@ HB_FUNC( __DBAPP ) /* __dbCoppy( <cNameName>, [<aFields>], ; [<bFor>], [<bWhile>], [<nNext>], [<nRecord>], [<lRest>], ; [<cRDD>], [<nConnection>], [<cCodePage>], ; - [<xDelimiter>] ) -> <lSuccess> */ + [<xDelimiter>] ) --> <lSuccess> */ HB_FUNC( __DBCOPY ) { AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); @@ -2315,12 +2302,13 @@ HB_FUNC( __DBSKIPPER ) if( pArea ) { HB_LONG lSkipped = 0; - HB_LONG lRecs = 1; HB_BOOL fBEof; HB_ULONG ulRecords = 0; if( SELF_RECCOUNT( pArea, &ulRecords ) == HB_SUCCESS && ulRecords > 0 ) { + HB_LONG lRecs = 1; + if( HB_ISNUM( 1 ) ) lRecs = hb_parnl( 1 ); diff --git a/src/rdd/dbcmd53.c b/src/rdd/dbcmd53.c index cbd5d15830..87b6757b28 100644 --- a/src/rdd/dbcmd53.c +++ b/src/rdd/dbcmd53.c @@ -3,6 +3,7 @@ * * Copyright 1999 Bruno Cantero <bruno@issnet.net> * Copyright 2004-2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> + * Copyright 2002 Horacio Roldan <harbour_ar@yahoo.com.ar> (ordKeyVal(), ordKeyAdd(), ordKeyDel()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,16 +46,6 @@ * */ -/* - * The following functions are added by - * Horacio Roldan <harbour_ar@yahoo.com.ar> - * - * ordKeyVal() - * ordKeyAdd() - * ordKeyDel() - * - */ - #include "hbapi.h" #include "hbapirdd.h" #include "hbapierr.h" diff --git a/src/rdd/dbcmdhb.c b/src/rdd/dbcmdhb.c index 8f5253022c..53278dee92 100644 --- a/src/rdd/dbcmdhb.c +++ b/src/rdd/dbcmdhb.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( HB_DBPACK, __DBPACK ) HB_FUNC_TRANSLATE( HB_DBZAP, __DBZAP ) diff --git a/src/rdd/dbdelim.prg b/src/rdd/dbdelim.prg index 6880d5641f..a8de61e64e 100644 --- a/src/rdd/dbdelim.prg +++ b/src/rdd/dbdelim.prg @@ -4,7 +4,6 @@ * * Copyright 2001-2003 David G. Holm <dholm@jsd-llc.com> * APPEND FROM code submitted by Marco Braida <marcobra@elart.it> - * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * function __dbDelim() replaced by the new one which uses * DELIM RDD I've just created diff --git a/src/rdd/dbdetach.c b/src/rdd/dbdetach.c index 33102ccd5e..bf1fdf9873 100644 --- a/src/rdd/dbdetach.c +++ b/src/rdd/dbdetach.c @@ -51,7 +51,7 @@ #include "hbthread.h" /* - * hb_dbDetach( [<nWorkArea>|<cAlias>], [<xCargo>] ) -> <lSuccess> + * hb_dbDetach( [<nWorkArea>|<cAlias>], [<xCargo>] ) --> <lSuccess> */ HB_FUNC( HB_DBDETACH ) { @@ -91,7 +91,7 @@ HB_FUNC( HB_DBDETACH ) /* * hb_dbRequest( [<cAlias>], [<lFreeArea>], [<@xCargo>], [<nTimeOut>|<lWait>] ) - * -> <lSuccess> + * --> <lSuccess> */ HB_FUNC( HB_DBREQUEST ) { diff --git a/src/rdd/dbdrop.c b/src/rdd/dbdrop.c index d8175a498e..e2f4da05e0 100644 --- a/src/rdd/dbdrop.c +++ b/src/rdd/dbdrop.c @@ -1,5 +1,5 @@ /* - * dbDrop() Harbour extension. + * dbDrop() Harbour extension * * Copyright 1999 Bruno Cantero <bruno@issnet.net> * Copyright 2004-2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> @@ -45,7 +45,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #ifndef HB_CLP_STRICT diff --git a/src/rdd/dbexists.c b/src/rdd/dbexists.c index 7058d0a7ce..1e85851bbd 100644 --- a/src/rdd/dbexists.c +++ b/src/rdd/dbexists.c @@ -1,5 +1,5 @@ /* - * dbExists() Harbour extension. + * dbExists() Harbour extension * * Copyright 1999 Bruno Cantero <bruno@issnet.net> * Copyright 2004-2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> @@ -45,7 +45,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #ifndef HB_CLP_STRICT diff --git a/src/rdd/dbf1.c b/src/rdd/dbf1.c index 11b632951c..d45d4e78b6 100644 --- a/src/rdd/dbf1.c +++ b/src/rdd/dbf1.c @@ -1,7 +1,6 @@ /* * DBF RDD module * - * Copyright 1999 Bruno Cantero <bruno@issnet.net> * Copyright 2003-2015 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * * This program is free software; you can redistribute it and/or modify @@ -92,11 +91,12 @@ static HB_ERRCODE hb_dbfErrorRT( DBFAREAP pArea, const char * szFileName, HB_ERRCODE errOsCode, HB_USHORT uiFlags, PHB_ITEM * pErrorPtr ) { - PHB_ITEM pError; HB_ERRCODE errCode = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { + PHB_ITEM pError; + if( pErrorPtr ) { if( ! *pErrorPtr ) @@ -586,7 +586,7 @@ static HB_BOOL hb_dbfTriggerDo( DBFAREAP pArea, int iEvent, { HB_BOOL fResult = HB_TRUE; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTriggerDo(%p,%d,%d,%p)", pArea, iEvent, iField, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTriggerDo(%p,%d,%d,%p)", ( void * ) pArea, iEvent, iField, pItem ) ); if( hb_vmRequestQuery() == 0 ) { @@ -630,7 +630,7 @@ static void hb_dbfTriggerSet( DBFAREAP pArea, PHB_ITEM pTrigger ) { const char * szName; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTriggerSet(%p,%p)", pArea, pTrigger ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTriggerSet(%p,%p)", ( void * ) pArea, ( void * ) pTrigger ) ); szName = hb_itemGetCPtr( pTrigger ); pArea->pTriggerSym = *szName ? hb_dynsymFindName( szName ) : NULL; @@ -644,7 +644,7 @@ static void hb_dbfTriggerSet( DBFAREAP pArea, PHB_ITEM pTrigger ) */ static HB_ULONG hb_dbfCalcRecCount( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfCalcRecCount(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfCalcRecCount(%p)", ( void * ) pArea ) ); if( ! pArea->pDataFile ) return 0; @@ -658,7 +658,7 @@ static HB_ULONG hb_dbfCalcRecCount( DBFAREAP pArea ) */ static HB_BOOL hb_dbfReadRecord( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfReadRecord(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfReadRecord(%p)", ( void * ) pArea ) ); if( ! pArea->pRecord ) return HB_FALSE; @@ -708,7 +708,7 @@ static HB_BOOL hb_dbfReadRecord( DBFAREAP pArea ) */ static HB_BOOL hb_dbfWriteRecord( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfWriteRecord(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfWriteRecord(%p)", ( void * ) pArea ) ); if( SELF_PUTREC( &pArea->area, NULL ) == HB_FAILURE ) return HB_FALSE; @@ -727,7 +727,7 @@ static HB_BOOL hb_dbfPasswordSet( DBFAREAP pArea, PHB_ITEM pPasswd, HB_BOOL fRaw HB_SIZE nLen; HB_BOOL fKeySet = HB_FALSE, fSet; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPasswordSet(%p,%p,%d)", pArea, pPasswd, fRaw ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPasswordSet(%p,%p,%d)", ( void * ) pArea, ( void * ) pPasswd, fRaw ) ); nLen = hb_itemGetCLen( pPasswd ); @@ -791,7 +791,7 @@ static HB_BOOL hb_dbfPasswordSet( DBFAREAP pArea, PHB_ITEM pPasswd, HB_BOOL fRaw */ static void hb_dbfTableCrypt( DBFAREAP pArea, PHB_ITEM pPasswd, HB_BOOL fEncrypt ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTableCrypt(%p,%p,%d)", pArea, pPasswd, fEncrypt ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTableCrypt(%p,%p,%d)", ( void * ) pArea, ( void * ) pPasswd, fEncrypt ) ); if( ! pArea->fReadonly && ! pArea->fShared && fEncrypt ? ! pArea->fTableEncrypted && ! pArea->fHasMemo : @@ -867,7 +867,7 @@ static HB_ERRCODE hb_dbfUnlockAllRecords( DBFAREAP pArea ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfUnlockAllRecords(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfUnlockAllRecords(%p)", ( void * ) pArea ) ); if( pArea->pLocksPos ) { @@ -889,9 +889,9 @@ static HB_ERRCODE hb_dbfUnlockAllRecords( DBFAREAP pArea ) static HB_ERRCODE hb_dbfUnlockRecord( DBFAREAP pArea, HB_ULONG ulRecNo ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_ULONG ulCount, * pList; + HB_ULONG ulCount; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfUnlockRecord(%p, %lu)", pArea, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfUnlockRecord(%p, %lu)", ( void * ) pArea, ulRecNo ) ); /* Search the locked record */ for( ulCount = 0; ulCount < pArea->ulNumLocksPos && @@ -909,7 +909,7 @@ static HB_ERRCODE hb_dbfUnlockRecord( DBFAREAP pArea, HB_ULONG ulRecNo ) } else /* Resize the list */ { - pList = pArea->pLocksPos + ulCount; + HB_ULONG * pList = pArea->pLocksPos + ulCount; memmove( pList, pList + 1, ( pArea->ulNumLocksPos - ulCount - 1 ) * sizeof( HB_ULONG ) ); pArea->pLocksPos = ( HB_ULONG * ) hb_xrealloc( pArea->pLocksPos, @@ -927,8 +927,8 @@ static HB_ERRCODE hb_dbfUnlockRecord( DBFAREAP pArea, HB_ULONG ulRecNo ) static HB_ERRCODE hb_dbfLockRecord( DBFAREAP pArea, HB_ULONG ulRecNo, HB_USHORT * pResult, HB_BOOL bExclusive ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfLockRecord(%p, %lu, %p, %i)", pArea, ulRecNo, - pResult, ( int ) bExclusive ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfLockRecord(%p, %lu, %p, %i)", ( void * ) pArea, ulRecNo, + ( void * ) pResult, ( int ) bExclusive ) ); if( pArea->lpdbPendingRel ) { @@ -1001,7 +1001,7 @@ static HB_ERRCODE hb_dbfLockRecord( DBFAREAP pArea, HB_ULONG ulRecNo, HB_USHORT */ static HB_ERRCODE hb_dbfLockFile( DBFAREAP pArea, HB_USHORT * pResult ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfLockFile(%p, %p)", pArea, pResult ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfLockFile(%p, %p)", ( void * ) pArea, ( void * ) pResult ) ); if( ! pArea->fFLocked ) { @@ -1039,7 +1039,7 @@ static HB_ERRCODE hb_dbfUnlockFile( DBFAREAP pArea ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfUnlockFile(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfUnlockFile(%p)", ( void * ) pArea ) ); if( pArea->fFLocked ) { @@ -1056,7 +1056,7 @@ static HB_BOOL hb_dbfIsLocked( DBFAREAP pArea, HB_ULONG ulRecNo ) { HB_ULONG ulCount; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfIsLocked(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfIsLocked(%p)", ( void * ) pArea ) ); ulCount = pArea->ulNumLocksPos; while( ulCount > 0 ) @@ -1076,7 +1076,7 @@ static void hb_dbfGetLockArray( DBFAREAP pArea, PHB_ITEM pItem ) { HB_ULONG ulCount; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetLockArray(%p, %p)", pArea, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetLockArray(%p, %p)", ( void * ) pArea, ( void * ) pItem ) ); hb_arrayNew( pItem, pArea->ulNumLocksPos ); for( ulCount = 0; ulCount < pArea->ulNumLocksPos; ulCount++ ) @@ -1153,7 +1153,7 @@ HB_ULONG hb_dbfGetMemoBlock( DBFAREAP pArea, HB_USHORT uiIndex ) { HB_ULONG ulBlock = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetMemoBlock(%p, %hu)", pArea, uiIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetMemoBlock(%p, %hu)", ( void * ) pArea, uiIndex ) ); if( pArea->area.lpFields[ uiIndex ].uiLen == 4 ) { @@ -1162,11 +1162,10 @@ HB_ULONG hb_dbfGetMemoBlock( DBFAREAP pArea, HB_USHORT uiIndex ) else { HB_USHORT uiCount; - HB_BYTE bByte; for( uiCount = 0; uiCount < 10; uiCount++ ) { - bByte = pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] + uiCount ]; + HB_BYTE bByte = pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] + uiCount ]; if( bByte >= '0' && bByte <= '9' ) { ulBlock = ulBlock * 10 + ( bByte - '0' ); @@ -1184,7 +1183,7 @@ HB_ULONG hb_dbfGetMemoBlock( DBFAREAP pArea, HB_USHORT uiIndex ) */ void hb_dbfPutMemoBlock( DBFAREAP pArea, HB_USHORT uiIndex, HB_ULONG ulBlock ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPutMemoBlock(%p, %hu, %lu)", pArea, uiIndex, ulBlock ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPutMemoBlock(%p, %hu, %lu)", ( void * ) pArea, uiIndex, ulBlock ) ); if( pArea->area.lpFields[ uiIndex ].uiLen == 4 ) { @@ -1218,7 +1217,7 @@ HB_ERRCODE hb_dbfGetMemoData( DBFAREAP pArea, HB_USHORT uiIndex, HB_ULONG * pulBlock, HB_ULONG * pulSize, HB_ULONG * pulType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetMemoData(%p, %hu, %p, %p, %p)", pArea, uiIndex, pulBlock, pulSize, pulType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetMemoData(%p, %hu, %p, %p, %p)", ( void * ) pArea, uiIndex, ( void * ) pulBlock, ( void * ) pulSize, ( void * ) pulType ) ); *pulBlock = *pulSize = *pulType = 0; @@ -1257,12 +1256,11 @@ HB_ERRCODE hb_dbfGetMemoData( DBFAREAP pArea, HB_USHORT uiIndex, else if( pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] ] != 0 ) { HB_USHORT uiCount; - HB_BYTE bByte; ulValue = 0; for( uiCount = 0; uiCount < 10; uiCount++ ) { - bByte = pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] + uiCount ]; + HB_BYTE bByte = pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] + uiCount ]; if( bByte >= '0' && bByte <= '9' ) ulValue = ulValue * 10 + ( bByte - '0' ); else if( bByte != ' ' || ulValue ) @@ -1288,7 +1286,7 @@ HB_ERRCODE hb_dbfSetMemoData( DBFAREAP pArea, HB_USHORT uiIndex, HB_ULONG ulBlock, HB_ULONG ulSize, HB_ULONG ulType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSetMemoData(%p, %hu, %lu, %lu, %lu)", pArea, uiIndex, ulBlock, ulSize, ulType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSetMemoData(%p, %hu, %lu, %lu, %lu)", ( void * ) pArea, uiIndex, ulBlock, ulSize, ulType ) ); if( uiIndex >= pArea->area.uiFieldCount || ( pArea->area.lpFields[ uiIndex ].uiType != HB_FT_MEMO && @@ -1405,7 +1403,7 @@ HB_BOOL hb_dbfLockIdxFile( DBFAREAP pArea, PHB_FILE pFile, int iType, HB_BOOL fLateWrlck, PHB_DBFLOCKDATA pLockData ) { - HB_FOFFSET offset, size, tolock; + HB_FOFFSET tolock; HB_BOOL fOK; switch( iType & FL_MASK ) @@ -1429,8 +1427,7 @@ HB_BOOL hb_dbfLockIdxFile( DBFAREAP pArea, PHB_FILE pFile, tolock = 0; for( ;; ) { - size = 1; - offset = pLockData->offset; + HB_FOFFSET size = 1, offset = pLockData->offset; if( pLockData->count != 0 ) offset += ( HB_FOFFSET ) ( hb_random_num() * pLockData->size ) + 1; else if( pLockData->size != 0 ) @@ -1581,7 +1578,7 @@ static int hb_dbfLockTest( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ulRecNo { int iResult = -1; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfLockTest(%p, %hu, %lu)", pArea, uiAction, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfLockTest(%p, %hu, %lu)", ( void * ) pArea, uiAction, ulRecNo ) ); if( ! pArea->fShared || pArea->fFLocked || ( uiAction == REC_LOCK && hb_dbfIsLocked( pArea, ulRecNo ) ) ) @@ -1629,7 +1626,7 @@ static int hb_dbfLockTest( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ulRecNo */ static HB_ERRCODE hb_dbfBof( DBFAREAP pArea, HB_BOOL * pBof ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfBof(%p, %p)", pArea, pBof ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfBof(%p, %p)", ( void * ) pArea, ( void * ) pBof ) ); if( pArea->lpdbPendingRel ) { @@ -1646,7 +1643,7 @@ static HB_ERRCODE hb_dbfBof( DBFAREAP pArea, HB_BOOL * pBof ) */ static HB_ERRCODE hb_dbfEof( DBFAREAP pArea, HB_BOOL * pEof ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfEof(%p, %p)", pArea, pEof ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfEof(%p, %p)", ( void * ) pArea, ( void * ) pEof ) ); if( pArea->lpdbPendingRel ) { @@ -1663,7 +1660,7 @@ static HB_ERRCODE hb_dbfEof( DBFAREAP pArea, HB_BOOL * pEof ) */ static HB_ERRCODE hb_dbfFound( DBFAREAP pArea, HB_BOOL * pFound ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfFound(%p, %p)", pArea, pFound ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfFound(%p, %p)", ( void * ) pArea, ( void * ) pFound ) ); if( pArea->lpdbPendingRel ) { @@ -1680,7 +1677,7 @@ static HB_ERRCODE hb_dbfFound( DBFAREAP pArea, HB_BOOL * pFound ) */ static HB_ERRCODE hb_dbfGoBottom( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoBottom(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoBottom(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->area ) == HB_FAILURE ) return HB_FAILURE; @@ -1702,7 +1699,7 @@ static HB_ERRCODE hb_dbfGoBottom( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfGoTo( DBFAREAP pArea, HB_ULONG ulRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoTo(%p, %lu)", pArea, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoTo(%p, %lu)", ( void * ) pArea, ulRecNo ) ); if( SELF_GOCOLD( &pArea->area ) == HB_FAILURE ) return HB_FAILURE; @@ -1751,7 +1748,7 @@ static HB_ERRCODE hb_dbfGoTo( DBFAREAP pArea, HB_ULONG ulRecNo ) */ static HB_ERRCODE hb_dbfGoToId( DBFAREAP pArea, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoToId(%p, %p)", pArea, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoToId(%p, %p)", ( void * ) pArea, ( void * ) pItem ) ); if( HB_IS_NUMERIC( pItem ) ) return SELF_GOTO( &pArea->area, hb_itemGetNL( pItem ) ); @@ -1767,7 +1764,7 @@ static HB_ERRCODE hb_dbfGoToId( DBFAREAP pArea, PHB_ITEM pItem ) */ static HB_ERRCODE hb_dbfGoTop( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoTop(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoTop(%p)", ( void * ) pArea ) ); pArea->area.fTop = HB_TRUE; pArea->area.fBottom = HB_FALSE; @@ -1787,7 +1784,7 @@ static HB_ERRCODE hb_dbfSkip( DBFAREAP pArea, HB_LONG lToSkip ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSkip(%p, %ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSkip(%p, %ld)", ( void * ) pArea, lToSkip ) ); if( pArea->lpdbPendingRel ) { @@ -1831,7 +1828,7 @@ static HB_ERRCODE hb_dbfSkipRaw( DBFAREAP pArea, HB_LONG lToSkip ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSkipRaw(%p, %ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSkipRaw(%p, %ld)", ( void * ) pArea, lToSkip ) ); if( pArea->lpdbPendingRel ) { @@ -1871,7 +1868,7 @@ static HB_ERRCODE hb_dbfSkipRaw( DBFAREAP pArea, HB_LONG lToSkip ) */ static HB_ERRCODE hb_dbfAddField( DBFAREAP pArea, LPDBFIELDINFO pFieldInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfAddField(%p, %p)", pArea, pFieldInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfAddField(%p, %p)", ( void * ) pArea, ( void * ) pFieldInfo ) ); switch( pFieldInfo->uiType ) { @@ -1907,11 +1904,9 @@ static HB_ERRCODE hb_dbfAddField( DBFAREAP pArea, LPDBFIELDINFO pFieldInfo ) */ static HB_ERRCODE hb_dbfAppend( DBFAREAP pArea, HB_BOOL bUnLockAll ) { - HB_ULONG ulNewRecord; HB_USHORT fLocked; - HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfAppend(%p, %d)", pArea, ( int ) bUnLockAll ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfAppend(%p, %d)", ( void * ) pArea, ( int ) bUnLockAll ) ); if( SELF_GOCOLD( &pArea->area ) == HB_FAILURE ) return HB_FAILURE; @@ -1944,6 +1939,7 @@ static HB_ERRCODE hb_dbfAppend( DBFAREAP pArea, HB_BOOL bUnLockAll ) fLocked = HB_FALSE; if( SELF_RAWLOCK( &pArea->area, APPEND_LOCK, 0 ) == HB_SUCCESS ) { + HB_ULONG ulNewRecord; /* Update RecCount */ pArea->ulRecCount = hb_dbfCalcRecCount( pArea ); ulNewRecord = pArea->ulRecCount + 1; @@ -1979,7 +1975,7 @@ static HB_ERRCODE hb_dbfAppend( DBFAREAP pArea, HB_BOOL bUnLockAll ) if( pArea->fShared ) { - errCode = SELF_GOCOLD( &pArea->area ); + HB_ERRCODE errCode = SELF_GOCOLD( &pArea->area ); SELF_RAWLOCK( &pArea->area, APPEND_UNLOCK, 0 ); return errCode; } @@ -1993,7 +1989,7 @@ static HB_ERRCODE hb_dbfAppend( DBFAREAP pArea, HB_BOOL bUnLockAll ) */ static HB_ERRCODE hb_dbfDeleteRec( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfDeleteRec(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfDeleteRec(%p)", ( void * ) pArea ) ); if( pArea->fTrigger ) { @@ -2028,7 +2024,7 @@ static HB_ERRCODE hb_dbfDeleteRec( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfDeleted( DBFAREAP pArea, HB_BOOL * pDeleted ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfDeleted(%p, %p)", pArea, pDeleted ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfDeleted(%p, %p)", ( void * ) pArea, ( void * ) pDeleted ) ); if( pArea->lpdbPendingRel ) { @@ -2055,7 +2051,7 @@ static HB_ERRCODE hb_dbfFlush( DBFAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfFlush(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfFlush(%p)", ( void * ) pArea ) ); errCode = SELF_GOCOLD( &pArea->area ); if( errCode == HB_SUCCESS ) @@ -2086,7 +2082,7 @@ static HB_ERRCODE hb_dbfFlush( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfGetRec( DBFAREAP pArea, HB_BYTE ** pBuffer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetRec(%p, %p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetRec(%p, %p)", ( void * ) pArea, ( void * ) pBuffer ) ); if( pBuffer != NULL ) { @@ -2125,12 +2121,10 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI LPFIELD pField; HB_BOOL fError; char * pszVal; - HB_SIZE nLen; - HB_MAXINT lVal; double dVal; - HB_BOOL fDbl; + HB_SIZE nLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetValue(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetValue(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( pArea->lpdbPendingRel ) { @@ -2307,7 +2301,11 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI break; case HB_FT_LONG: - /* DBASE documentation defines maximum numeric field size as 20 + { + HB_MAXINT lVal; + HB_BOOL fDbl; + + /* dBase documentation defines maximum numeric field size as 20 * but Clipper allows to create longer fields so I remove this * limit, Druzus */ @@ -2330,7 +2328,7 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI else hb_itemPutNIntLen( pItem, lVal, ( int ) pField->uiLen ); break; - + } case HB_FT_FLOAT: pszVal = ( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ]; dVal = hb_strVal( pszVal, pField->uiLen ); @@ -2396,7 +2394,7 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI */ static HB_ERRCODE hb_dbfGetVarLen( DBFAREAP pArea, HB_USHORT uiIndex, HB_SIZE * pLength ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetVarLen(%p, %hu, %p)", pArea, uiIndex, pLength ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetVarLen(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pLength ) ); *pLength = pArea->area.lpFields[ uiIndex - 1 ].uiLen; @@ -2410,7 +2408,7 @@ static HB_ERRCODE hb_dbfGoCold( DBFAREAP pArea ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoCold(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoCold(%p)", ( void * ) pArea ) ); if( pArea->fRecordChanged ) { @@ -2451,7 +2449,7 @@ static HB_ERRCODE hb_dbfGoCold( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfGoHot( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoHot(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGoHot(%p)", ( void * ) pArea ) ); if( pArea->fReadonly ) { @@ -2474,7 +2472,7 @@ static HB_ERRCODE hb_dbfGoHot( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfPutRec( DBFAREAP pArea, const HB_BYTE * pBuffer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPutRec(%p, %p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPutRec(%p, %p)", ( void * ) pArea, ( const void * ) pBuffer ) ); if( pBuffer != NULL ) { @@ -2553,7 +2551,7 @@ static HB_ERRCODE hb_dbfPutValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI { LPFIELD pField; /* this buffer is for varlength, date and number conversions, - * DBASE documentation defines maximum numeric field size as 20 + * dBase documentation defines maximum numeric field size as 20 * but Clipper allows to create longer fields so I removed this * limit [druzus] */ @@ -2563,7 +2561,7 @@ static HB_ERRCODE hb_dbfPutValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI HB_BYTE * ptr; HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPutValue(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPutValue(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( pArea->fTrigger ) { @@ -2741,11 +2739,11 @@ static HB_ERRCODE hb_dbfPutValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI pField->uiType == HB_FT_ROWVER ) ) ) { HB_MAXINT lVal; - double dVal; int iSize; if( pField->uiDec || HB_IS_DOUBLE( pItem ) ) { + double dVal; #if 0 /* this version rounds double values to nearest integer */ dVal = hb_numDecConv( hb_itemGetND( pItem ), -( int ) pField->uiDec ); #else /* this one truncates double value to integer dropping fractional part */ @@ -2875,7 +2873,7 @@ static HB_ERRCODE hb_dbfPutValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI */ static HB_ERRCODE hb_dbfRecall( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecall(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecall(%p)", ( void * ) pArea ) ); if( pArea->fTrigger ) { @@ -2910,7 +2908,7 @@ static HB_ERRCODE hb_dbfRecall( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfRecCount( DBFAREAP pArea, HB_ULONG * pRecCount ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecCount(%p, %p)", pArea, pRecCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecCount(%p, %p)", ( void * ) pArea, ( void * ) pRecCount ) ); /* Update record count */ if( pArea->fShared ) @@ -2925,7 +2923,7 @@ static HB_ERRCODE hb_dbfRecCount( DBFAREAP pArea, HB_ULONG * pRecCount ) */ static HB_ERRCODE hb_dbfRecNo( DBFAREAP pArea, HB_ULONG * pulRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecNo(%p, %p)", pArea, pulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecNo(%p, %p)", ( void * ) pArea, ( void * ) pulRecNo ) ); if( pArea->lpdbPendingRel ) { @@ -2945,7 +2943,7 @@ static HB_ERRCODE hb_dbfRecId( DBFAREAP pArea, PHB_ITEM pRecNo ) HB_ERRCODE errCode; HB_ULONG ulRecNo = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecId(%p, %p)", pArea, pRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecId(%p, %p)", ( void * ) pArea, ( void * ) pRecNo ) ); errCode = SELF_RECNO( &pArea->area, &ulRecNo ); @@ -2971,7 +2969,7 @@ static HB_ERRCODE hb_dbfRecId( DBFAREAP pArea, PHB_ITEM pRecNo ) */ static HB_ERRCODE hb_dbfSetFieldExtent( DBFAREAP pArea, HB_USHORT uiFieldExtent ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSetFieldExtent(%p, %hu)", pArea, uiFieldExtent ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSetFieldExtent(%p, %hu)", ( void * ) pArea, uiFieldExtent ) ); if( SUPER_SETFIELDEXTENT( &pArea->area, uiFieldExtent ) == HB_FAILURE ) return HB_FAILURE; @@ -2990,7 +2988,7 @@ static HB_ERRCODE hb_dbfSetFieldExtent( DBFAREAP pArea, HB_USHORT uiFieldExtent */ static HB_ERRCODE hb_dbfClose( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfClose(%p)", ( void * ) pArea ) ); if( pArea->fTrigger ) { @@ -3108,7 +3106,7 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo ) PHB_ITEM pItem = NULL, pError; char szFileName[ HB_PATH_MAX ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfCreate(%p, %p)", pArea, pCreateInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfCreate(%p, %p)", ( void * ) pArea, ( void * ) pCreateInfo ) ); pArea->lpdbOpenInfo = pCreateInfo; @@ -3604,7 +3602,7 @@ static HB_ERRCODE hb_dbfInfo( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem { HB_ERRCODE errCode = HB_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfInfo(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfInfo(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); switch( uiIndex ) { @@ -3871,10 +3869,8 @@ static HB_ERRCODE hb_dbfFieldInfo( DBFAREAP pArea, HB_USHORT uiIndex, HB_USHORT { LPFIELD pField; HB_BOOL fLck; - HB_MAXINT nValue; - int iValue; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfFieldInfo(%p, %hu, %hu, %p)", pArea, uiIndex, uiType, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfFieldInfo(%p, %hu, %hu, %p)", ( void * ) pArea, uiIndex, uiType, ( void * ) pItem ) ); if( uiIndex > pArea->area.uiFieldCount ) return HB_FAILURE; @@ -3890,6 +3886,7 @@ static HB_ERRCODE hb_dbfFieldInfo( DBFAREAP pArea, HB_USHORT uiIndex, HB_USHORT case DBS_COUNTER: if( hb_dbfIsAutoIncField( pArea->area.lpFields + uiIndex - 1 ) != HB_AUTOINC_NONE ) { + HB_MAXINT nValue; fLck = HB_FALSE; if( pArea->fShared && ! pArea->fFLocked && ! pArea->fHeaderLocked ) { @@ -3913,6 +3910,7 @@ static HB_ERRCODE hb_dbfFieldInfo( DBFAREAP pArea, HB_USHORT uiIndex, HB_USHORT case DBS_STEP: if( hb_dbfIsAutoIncField( pArea->area.lpFields + uiIndex - 1 ) != HB_AUTOINC_NONE ) { + int iValue; if( HB_IS_NUMERIC( pItem ) ) { fLck = HB_FALSE; @@ -3948,7 +3946,7 @@ static HB_ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, HB_USHORT uiIn HB_ERRCODE errResult = HB_SUCCESS; HB_BOOL bDeleted; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecInfo(%p, %p, %hu, %p)", pArea, pRecID, uiInfoType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRecInfo(%p, %p, %hu, %p)", ( void * ) pArea, ( void * ) pRecID, uiInfoType, ( void * ) pInfo ) ); if( pArea->lpdbPendingRel ) { @@ -4020,9 +4018,8 @@ static HB_ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, HB_USHORT uiIn case DBRI_RAWMEMOS: case DBRI_RAWDATA: { - HB_USHORT uiFields; HB_BYTE * pResult; - HB_SIZE nLength, nLen; + HB_SIZE nLength; if( ! pArea->fValidBuffer && ! hb_dbfReadRecord( pArea ) ) { @@ -4038,6 +4035,7 @@ static HB_ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, HB_USHORT uiIn if( pArea->fHasMemo ) { + HB_USHORT uiFields; for( uiFields = 0; uiFields < pArea->area.uiFieldCount; uiFields++ ) { if( pArea->area.lpFields[ uiFields ].uiType == HB_FT_MEMO || @@ -4045,6 +4043,7 @@ static HB_ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, HB_USHORT uiIn pArea->area.lpFields[ uiFields ].uiType == HB_FT_BLOB || pArea->area.lpFields[ uiFields ].uiType == HB_FT_OLE ) { + HB_SIZE nLen; errResult = SELF_GETVALUE( &pArea->area, uiFields + 1, pInfo ); if( errResult != HB_SUCCESS ) break; @@ -4079,12 +4078,12 @@ static HB_ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, HB_USHORT uiIn */ static HB_ERRCODE hb_dbfNewArea( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfNewArea(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfNewArea(%p)", ( void * ) pArea ) ); if( SUPER_NEW( &pArea->area ) == HB_FAILURE ) return HB_FAILURE; - /* set maximum fieldname length to 10 characters */ + /* set maximum field name length to 10 characters */ pArea->area.uiMaxFieldNameLength = 10; pArea->pDataFile = pArea->pMemoFile = pArea->pMemoTmpFile = NULL; @@ -4114,9 +4113,8 @@ static HB_ERRCODE hb_dbfNewArea( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) { - HB_ERRCODE errCode, errOsCode; + HB_ERRCODE errCode; HB_USHORT uiFields, uiCount, uiSkip, uiDecimals, uiFlags, uiFlagsMask; - HB_SIZE nSize; HB_BOOL fRawBlob; PHB_ITEM pError, pItem; PHB_FNAME pFileName; @@ -4126,7 +4124,7 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) char szFileName[ HB_PATH_MAX ]; char szAlias[ HB_RDD_MAX_ALIAS_LEN + 1 ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfOpen(%p, %p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfOpen(%p, %p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); pArea->lpdbOpenInfo = pOpenInfo; @@ -4246,6 +4244,9 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) } else { + HB_ERRCODE errOsCode; + HB_SIZE nSize; + /* Try open */ do { @@ -4273,7 +4274,7 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) return HB_FAILURE; } - /* Allocate only after succesfully open file */ + /* Allocate only after successfully open file */ pArea->szDataFileName = hb_strdup( szFileName ); /* Read file header and exit if error */ @@ -4480,7 +4481,7 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) case 'N': dbFieldInfo.uiType = HB_FT_LONG; dbFieldInfo.uiDec = pField->bDec; - /* DBASE documentation defines maximum numeric field size as 20 + /* dBase documentation defines maximum numeric field size as 20 * but Clipper allows to create longer fields so I removed this * limit, Druzus */ @@ -4721,7 +4722,7 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) */ static HB_ERRCODE hb_dbfStructSize( DBFAREAP pArea, HB_USHORT * uiSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfStrucSize(%p, %p)", pArea, uiSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfStrucSize(%p, %p)", ( void * ) pArea, ( void * ) uiSize ) ); HB_SYMBOL_UNUSED( pArea ); *uiSize = sizeof( DBFAREA ); @@ -4736,7 +4737,7 @@ static HB_ERRCODE hb_dbfStructSize( DBFAREAP pArea, HB_USHORT * uiSize ) */ static HB_ERRCODE hb_dbfPackRec( DBFAREAP pArea, HB_ULONG ulRecNo, HB_BOOL * fWritten ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPackRec(%p, %lu, %p)", pArea, ulRecNo, fWritten ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPackRec(%p, %lu, %p)", ( void * ) pArea, ulRecNo, ( void * ) fWritten ) ); HB_SYMBOL_UNUSED( ulRecNo ); @@ -4754,7 +4755,7 @@ static HB_ERRCODE hb_dbfPack( DBFAREAP pArea ) PHB_ITEM pBlock; HB_BOOL fWritten; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPack(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPack(%p)", ( void * ) pArea ) ); if( pArea->fReadonly ) { @@ -4878,7 +4879,7 @@ static HB_ERRCODE hb_dbfPack( DBFAREAP pArea ) static HB_ERRCODE hb_dbfTransCond( DBFAREAP pArea, LPDBTRANSINFO pTransInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTransCond(%p, %p)", pArea, pTransInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTransCond(%p, %p)", ( void * ) pArea, ( void * ) pTransInfo ) ); if( pTransInfo->uiFlags & DBTF_MATCH ) { @@ -4962,9 +4963,9 @@ static HB_ERRCODE hb_dbfSortInit( LPDBSORTREC pSortRec, LPDBSORTINFO pSortInfo ) { HB_USHORT uiCount, uiDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSortInit(%p, %p)", pSortInfo, pSortRec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSortInit(%p, %p)", ( void * ) pSortInfo, ( void * ) pSortRec ) ); - memset( pSortRec, 0, sizeof( DBSORTREC ) ); + memset( pSortRec, 0, sizeof( *pSortRec ) ); pSortRec->pSortInfo = pSortInfo; for( uiCount = uiDest = 0; uiCount < pSortInfo->uiItemCount; ++uiCount ) @@ -5050,7 +5051,7 @@ static HB_ERRCODE hb_dbfSortInit( LPDBSORTREC pSortRec, LPDBSORTINFO pSortInfo ) static void hb_dbfSortFree( LPDBSORTREC pSortRec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSortFree(%p)", pSortRec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSortFree(%p)", ( void * ) pSortRec ) ); if( pSortRec->pTempFile != NULL ) hb_fileClose( pSortRec->pTempFile ); @@ -5353,7 +5354,7 @@ static HB_ERRCODE hb_dbfSortFinish( LPDBSORTREC pSortRec ) { AREAP pArea = pSortRec->pSortInfo->dbtri.lpaSource; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSortFinish(%p)", pSortRec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSortFinish(%p)", ( void * ) pSortRec ) ); if( pSortRec->nCount > 0 ) { @@ -5445,7 +5446,7 @@ static HB_ERRCODE hb_dbfSortAdd( LPDBSORTREC pSortRec ) AREAP pArea; HB_ULONG ulRecNo; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSortAdd(%p)", pSortRec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSortAdd(%p)", ( void * ) pSortRec ) ); pArea = pSortRec->pSortInfo->dbtri.lpaSource; @@ -5493,7 +5494,7 @@ static HB_ERRCODE hb_dbfSort( DBFAREAP pArea, LPDBSORTINFO pSortInfo ) HB_ERRCODE errCode; HB_LONG lNext = 1; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSort(%p, %p)", pArea, pSortInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSort(%p, %p)", ( void * ) pArea, ( void * ) pSortInfo ) ); if( SELF_GOCOLD( &pArea->area ) != HB_SUCCESS ) return HB_FAILURE; @@ -5564,7 +5565,7 @@ static HB_ERRCODE hb_dbfSort( DBFAREAP pArea, LPDBSORTINFO pSortInfo ) */ static HB_ERRCODE hb_dbfTrans( DBFAREAP pArea, LPDBTRANSINFO pTransInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTrans(%p, %p)", pArea, pTransInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfTrans(%p, %p)", ( void * ) pArea, ( void * ) pTransInfo ) ); if( hb_dbfTransCond( pArea, pTransInfo ) != HB_SUCCESS ) return HB_FAILURE; @@ -5581,7 +5582,7 @@ static HB_ERRCODE hb_dbfZap( DBFAREAP pArea ) { HB_USHORT uiField; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfZap(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfZap(%p)", ( void * ) pArea ) ); if( pArea->fReadonly ) { @@ -5610,7 +5611,7 @@ static HB_ERRCODE hb_dbfZap( DBFAREAP pArea ) if( SELF_GOTO( &pArea->area, 0 ) != HB_SUCCESS ) return HB_FAILURE; - /* reset autoincrement and row version fields */ + /* reset auto-increment and row version fields */ for( uiField = 0; uiField < pArea->area.uiFieldCount; uiField++ ) { if( pArea->area.lpFields[ uiField ].uiType == HB_FT_ROWVER ) @@ -5635,7 +5636,7 @@ static HB_ERRCODE hb_dbfChildEnd( DBFAREAP pArea, LPDBRELINFO pRelInfo ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfChildEnd(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfChildEnd(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( pArea->lpdbPendingRel == pRelInfo ) errCode = SELF_FORCEREL( &pArea->area ); @@ -5650,7 +5651,7 @@ static HB_ERRCODE hb_dbfChildEnd( DBFAREAP pArea, LPDBRELINFO pRelInfo ) */ static HB_ERRCODE hb_dbfChildStart( DBFAREAP pArea, LPDBRELINFO pRelInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfChildStart(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfChildStart(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( SELF_CHILDSYNC( &pArea->area, pRelInfo ) != HB_SUCCESS ) return HB_FAILURE; @@ -5662,7 +5663,7 @@ static HB_ERRCODE hb_dbfChildStart( DBFAREAP pArea, LPDBRELINFO pRelInfo ) */ static HB_ERRCODE hb_dbfChildSync( DBFAREAP pArea, LPDBRELINFO pRelInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfChildSync(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfChildSync(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); /* * !!! The side effect of calling GOCOLD() inside CHILDSYNC() is @@ -5706,7 +5707,7 @@ static HB_ERRCODE hb_dbfChildSync( DBFAREAP pArea, LPDBRELINFO pRelInfo ) */ static HB_ERRCODE hb_dbfForceRel( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfForceRel(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfForceRel(%p)", ( void * ) pArea ) ); if( pArea->lpdbPendingRel ) { @@ -5744,7 +5745,7 @@ static HB_ERRCODE hb_dbfForceRel( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfClearFilter( DBFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfClearFilter(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfClearFilter(%p)", ( void * ) pArea ) ); if( pArea->lpdbPendingRel ) SELF_FORCEREL( &pArea->area ); @@ -5763,7 +5764,7 @@ static HB_ERRCODE hb_dbfClearFilter( DBFAREAP pArea ) */ static HB_ERRCODE hb_dbfSetFilter( DBFAREAP pArea, LPDBFILTERINFO pFilterInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSetFilter(%p, %p)", pArea, pFilterInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfSetFilter(%p, %p)", ( void * ) pArea, ( void * ) pFilterInfo ) ); if( pArea->lpdbPendingRel ) SELF_FORCEREL( &pArea->area ); @@ -5781,19 +5782,20 @@ static HB_ERRCODE hb_dbfSetFilter( DBFAREAP pArea, LPDBFILTERINFO pFilterInfo ) #define hb_dbfEvalBlock NULL /* - * Perform a network lowlevel lock in the specified WorkArea. + * Perform a network low-level lock in the specified WorkArea. */ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ulRecNo ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_FOFFSET nPos, nFlSize, nRlSize; - int iDir; - HB_BOOL fLck; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRawLock(%p, %hu, %lu)", pArea, uiAction, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRawLock(%p, %hu, %lu)", ( void * ) pArea, uiAction, ulRecNo ) ); if( pArea->fShared ) { + HB_FOFFSET nPos, nFlSize, nRlSize; + int iDir; + HB_BOOL fLck; + if( hb_dbfLockData( pArea, &nPos, &nFlSize, &nRlSize, &iDir ) == HB_FAILURE ) return HB_FAILURE; @@ -5900,7 +5902,7 @@ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ul */ static HB_ERRCODE hb_dbfLock( DBFAREAP pArea, LPDBLOCKINFO pLockInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfLock(%p, %p)", pArea, pLockInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfLock(%p, %p)", ( void * ) pArea, ( void * ) pLockInfo ) ); if( pArea->fShared ) { @@ -5933,7 +5935,7 @@ static HB_ERRCODE hb_dbfUnLock( DBFAREAP pArea, PHB_ITEM pRecNo ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "dbfUnLock(%p, %p)", pArea, pRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "dbfUnLock(%p, %p)", ( void * ) pArea, ( void * ) pRecNo ) ); if( pArea->fShared ) { @@ -5961,7 +5963,7 @@ static HB_ERRCODE hb_dbfUnLock( DBFAREAP pArea, PHB_ITEM pRecNo ) */ static HB_ERRCODE hb_dbfCreateMemFile( DBFAREAP pArea, LPDBOPENINFO pCreateInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfCreateMemFile(%p, %p)", pArea, pCreateInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfCreateMemFile(%p, %p)", ( void * ) pArea, ( void * ) pCreateInfo ) ); if( pCreateInfo ) hb_dbfErrorRT( pArea, EG_CREATE, EDBF_DATATYPE, pCreateInfo->abName, 0, 0, NULL ); @@ -5979,7 +5981,7 @@ static HB_ERRCODE hb_dbfGetValueFile( DBFAREAP pArea, HB_USHORT uiIndex, const c HB_ERRCODE errCode = HB_SUCCESS; LPFIELD pField; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetValueFile(%p, %hu, %s, %hu)", pArea, uiIndex, szFile, uiMode ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfGetValueFile(%p, %hu, %s, %hu)", ( void * ) pArea, uiIndex, szFile, uiMode ) ); if( pArea->lpdbPendingRel ) { @@ -6040,7 +6042,7 @@ static HB_ERRCODE hb_dbfGetValueFile( DBFAREAP pArea, HB_USHORT uiIndex, const c */ static HB_ERRCODE hb_dbfOpenMemFile( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfOpenMemFile(%p, %p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfOpenMemFile(%p, %p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); hb_dbfErrorRT( pArea, EG_OPEN, EDBF_OPEN_DBF, pOpenInfo->abName, 0, 0, NULL ); @@ -6055,7 +6057,7 @@ static HB_ERRCODE hb_dbfPutValueFile( DBFAREAP pArea, HB_USHORT uiIndex, const c HB_ERRCODE errCode = HB_SUCCESS; LPFIELD pField; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPutValueFile(%p, %hu, %s, %hu)", pArea, uiIndex, szFile, uiMode ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfPutValueFile(%p, %hu, %s, %hu)", ( void * ) pArea, uiIndex, szFile, uiMode ) ); HB_SYMBOL_UNUSED( uiMode ); @@ -6128,7 +6130,7 @@ static HB_ERRCODE hb_dbfReadDBHeader( DBFAREAP pArea ) HB_ERRCODE errCode; PHB_ITEM pError; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfReadDBHeader(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfReadDBHeader(%p)", ( void * ) pArea ) ); pError = NULL; do @@ -6244,7 +6246,7 @@ static HB_ERRCODE hb_dbfWriteDBHeader( DBFAREAP pArea ) HB_BOOL fLck = HB_FALSE; HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfWriteDBHeader(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfWriteDBHeader(%p)", ( void * ) pArea ) ); if( pArea->fReadonly ) { @@ -6336,7 +6338,7 @@ static HB_ERRCODE hb_dbfDrop( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pIte PHB_FNAME pFileName; HB_BOOL fTable = HB_FALSE, fResult = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfDrop(%p,%p,%p,%lu)", pRDD, pItemTable, pItemIndex, ulConnect ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfDrop(%p,%p,%p,%lu)", ( void * ) pRDD, ( void * ) pItemTable, ( void * ) pItemIndex, ulConnect ) ); szFile = hb_itemGetCPtr( pItemIndex ); if( ! szFile[ 0 ] ) @@ -6360,7 +6362,7 @@ static HB_ERRCODE hb_dbfDrop( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pIte hb_fsFNameMerge( szFileName, pFileName ); hb_xfree( pFileName ); - /* Use hb_fileExists first to locate table which can be in differ path */ + /* Use hb_fileExists() first to locate table which can be in different path */ if( hb_fileExists( szFileName, szFileName ) ) { fResult = hb_fileDelete( szFileName ); @@ -6418,7 +6420,7 @@ static HB_ERRCODE hb_dbfExists( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pI PHB_FNAME pFileName; HB_BOOL fTable = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfExists(%p,%p,%p,%lu)", pRDD, pItemTable, pItemIndex, ulConnect ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfExists(%p,%p,%p,%lu)", ( void * ) pRDD, ( void * ) pItemTable, ( void * ) pItemIndex, ulConnect ) ); szFile = hb_itemGetCPtr( pItemIndex ); if( ! szFile[ 0 ] ) @@ -6449,13 +6451,12 @@ static HB_ERRCODE hb_dbfExists( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pI static HB_ERRCODE hb_dbfRename( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pItemIndex, PHB_ITEM pItemNew, HB_ULONG ulConnect ) { char szFileName[ HB_PATH_MAX ]; - char szFileNew[ HB_PATH_MAX ]; const char * szFile, * szExt; PHB_ITEM pFileExt = NULL; - PHB_FNAME pFileName, pFileNameNew; + PHB_FNAME pFileName; HB_BOOL fTable = HB_FALSE, fResult = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRename(%p,%p,%p,%p,%lu)", pRDD, pItemTable, pItemIndex, pItemNew, ulConnect ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRename(%p,%p,%p,%p,%lu)", ( void * ) pRDD, ( void * ) pItemTable, ( void * ) pItemIndex, ( void * ) pItemNew, ulConnect ) ); szFile = hb_itemGetCPtr( pItemIndex ); if( ! szFile[ 0 ] ) @@ -6480,9 +6481,12 @@ static HB_ERRCODE hb_dbfRename( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pI hb_xfree( pFileName ); szFile = hb_itemGetCPtr( pItemNew ); - /* Use hb_fileExists first to locate table which can be in differ path */ + /* Use hb_fileExists() first to locate table which can be in different path */ if( szFile[ 0 ] && hb_fileExists( szFileName, szFileName ) ) { + char szFileNew[ HB_PATH_MAX ]; + PHB_FNAME pFileNameNew; + /* hb_fsFNameSplit() repeated intentionally to respect * the path set by hb_FileExists() */ @@ -6581,7 +6585,7 @@ static HB_ERRCODE hb_dbfInit( LPRDDNODE pRDD ) { PHB_TSD pTSD; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfInit(%p)", pRDD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfInit(%p)", ( void * ) pRDD ) ); pTSD = ( PHB_TSD ) hb_xgrab( sizeof( HB_TSD ) ); HB_TSD_INIT( pTSD, sizeof( DBFDATA ), hb_dbfInitTSD, hb_dbfDestroyTSD ); @@ -6595,7 +6599,7 @@ static HB_ERRCODE hb_dbfInit( LPRDDNODE pRDD ) static HB_ERRCODE hb_dbfExit( LPRDDNODE pRDD ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfExit(%p)", pRDD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfExit(%p)", ( void * ) pRDD ) ); if( pRDD->lpvCargo ) { @@ -6615,7 +6619,7 @@ static HB_ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulC { LPDBFDATA pData; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnect, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbfRddInfo(%p, %hu, %lu, %p)", ( void * ) pRDD, uiIndex, ulConnect, pItem ) ); pData = DBFNODE_DATA( pRDD ); @@ -6811,107 +6815,109 @@ static HB_ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulC #define hb_dbfWhoCares NULL -static const RDDFUNCS dbfTable = { ( DBENTRYP_BP ) hb_dbfBof, - ( DBENTRYP_BP ) hb_dbfEof, - ( DBENTRYP_BP ) hb_dbfFound, - ( DBENTRYP_V ) hb_dbfGoBottom, - ( DBENTRYP_UL ) hb_dbfGoTo, - ( DBENTRYP_I ) hb_dbfGoToId, - ( DBENTRYP_V ) hb_dbfGoTop, - ( DBENTRYP_BIB ) hb_dbfSeek, - ( DBENTRYP_L ) hb_dbfSkip, - ( DBENTRYP_L ) hb_dbfSkipFilter, - ( DBENTRYP_L ) hb_dbfSkipRaw, - ( DBENTRYP_VF ) hb_dbfAddField, - ( DBENTRYP_B ) hb_dbfAppend, - ( DBENTRYP_I ) hb_dbfCreateFields, - ( DBENTRYP_V ) hb_dbfDeleteRec, - ( DBENTRYP_BP ) hb_dbfDeleted, - ( DBENTRYP_SP ) hb_dbfFieldCount, - ( DBENTRYP_VF ) hb_dbfFieldDisplay, - ( DBENTRYP_SSI ) hb_dbfFieldInfo, - ( DBENTRYP_SCP ) hb_dbfFieldName, - ( DBENTRYP_V ) hb_dbfFlush, - ( DBENTRYP_PP ) hb_dbfGetRec, - ( DBENTRYP_SI ) hb_dbfGetValue, - ( DBENTRYP_SVL ) hb_dbfGetVarLen, - ( DBENTRYP_V ) hb_dbfGoCold, - ( DBENTRYP_V ) hb_dbfGoHot, - ( DBENTRYP_P ) hb_dbfPutRec, - ( DBENTRYP_SI ) hb_dbfPutValue, - ( DBENTRYP_V ) hb_dbfRecall, - ( DBENTRYP_ULP ) hb_dbfRecCount, - ( DBENTRYP_ISI ) hb_dbfRecInfo, - ( DBENTRYP_ULP ) hb_dbfRecNo, - ( DBENTRYP_I ) hb_dbfRecId, - ( DBENTRYP_S ) hb_dbfSetFieldExtent, - ( DBENTRYP_CP ) hb_dbfAlias, - ( DBENTRYP_V ) hb_dbfClose, - ( DBENTRYP_VO ) hb_dbfCreate, - ( DBENTRYP_SI ) hb_dbfInfo, - ( DBENTRYP_V ) hb_dbfNewArea, - ( DBENTRYP_VO ) hb_dbfOpen, - ( DBENTRYP_V ) hb_dbfRelease, - ( DBENTRYP_SP ) hb_dbfStructSize, - ( DBENTRYP_CP ) hb_dbfSysName, - ( DBENTRYP_VEI ) hb_dbfEval, - ( DBENTRYP_V ) hb_dbfPack, - ( DBENTRYP_LSP ) hb_dbfPackRec, - ( DBENTRYP_VS ) hb_dbfSort, - ( DBENTRYP_VT ) hb_dbfTrans, - ( DBENTRYP_VT ) hb_dbfTransRec, - ( DBENTRYP_V ) hb_dbfZap, - ( DBENTRYP_VR ) hb_dbfChildEnd, - ( DBENTRYP_VR ) hb_dbfChildStart, - ( DBENTRYP_VR ) hb_dbfChildSync, - ( DBENTRYP_V ) hb_dbfSyncChildren, - ( DBENTRYP_V ) hb_dbfClearRel, - ( DBENTRYP_V ) hb_dbfForceRel, - ( DBENTRYP_SSP ) hb_dbfRelArea, - ( DBENTRYP_VR ) hb_dbfRelEval, - ( DBENTRYP_SI ) hb_dbfRelText, - ( DBENTRYP_VR ) hb_dbfSetRel, - ( DBENTRYP_VOI ) hb_dbfOrderListAdd, - ( DBENTRYP_V ) hb_dbfOrderListClear, - ( DBENTRYP_VOI ) hb_dbfOrderListDelete, - ( DBENTRYP_VOI ) hb_dbfOrderListFocus, - ( DBENTRYP_V ) hb_dbfOrderListRebuild, - ( DBENTRYP_VOO ) hb_dbfOrderCondition, - ( DBENTRYP_VOC ) hb_dbfOrderCreate, - ( DBENTRYP_VOI ) hb_dbfOrderDestroy, - ( DBENTRYP_SVOI ) hb_dbfOrderInfo, - ( DBENTRYP_V ) hb_dbfClearFilter, - ( DBENTRYP_V ) hb_dbfClearLocate, - ( DBENTRYP_V ) hb_dbfClearScope, - ( DBENTRYP_VPLP ) hb_dbfCountScope, - ( DBENTRYP_I ) hb_dbfFilterText, - ( DBENTRYP_SI ) hb_dbfScopeInfo, - ( DBENTRYP_VFI ) hb_dbfSetFilter, - ( DBENTRYP_VLO ) hb_dbfSetLocate, - ( DBENTRYP_VOS ) hb_dbfSetScope, - ( DBENTRYP_VPL ) hb_dbfSkipScope, - ( DBENTRYP_B ) hb_dbfLocate, - ( DBENTRYP_CC ) hb_dbfCompile, - ( DBENTRYP_I ) hb_dbfError, - ( DBENTRYP_I ) hb_dbfEvalBlock, - ( DBENTRYP_VSP ) hb_dbfRawLock, - ( DBENTRYP_VL ) hb_dbfLock, - ( DBENTRYP_I ) hb_dbfUnLock, - ( DBENTRYP_V ) hb_dbfCloseMemFile, - ( DBENTRYP_VO ) hb_dbfCreateMemFile, - ( DBENTRYP_SCCS ) hb_dbfGetValueFile, - ( DBENTRYP_VO ) hb_dbfOpenMemFile, - ( DBENTRYP_SCCS ) hb_dbfPutValueFile, - ( DBENTRYP_V ) hb_dbfReadDBHeader, - ( DBENTRYP_V ) hb_dbfWriteDBHeader, - ( DBENTRYP_R ) hb_dbfInit, - ( DBENTRYP_R ) hb_dbfExit, - ( DBENTRYP_RVVL ) hb_dbfDrop, - ( DBENTRYP_RVVL ) hb_dbfExists, - ( DBENTRYP_RVVVL ) hb_dbfRename, - ( DBENTRYP_RSLV ) hb_dbfRddInfo, - ( DBENTRYP_SVP ) hb_dbfWhoCares - }; +static const RDDFUNCS dbfTable = +{ + ( DBENTRYP_BP ) hb_dbfBof, + ( DBENTRYP_BP ) hb_dbfEof, + ( DBENTRYP_BP ) hb_dbfFound, + ( DBENTRYP_V ) hb_dbfGoBottom, + ( DBENTRYP_UL ) hb_dbfGoTo, + ( DBENTRYP_I ) hb_dbfGoToId, + ( DBENTRYP_V ) hb_dbfGoTop, + ( DBENTRYP_BIB ) hb_dbfSeek, + ( DBENTRYP_L ) hb_dbfSkip, + ( DBENTRYP_L ) hb_dbfSkipFilter, + ( DBENTRYP_L ) hb_dbfSkipRaw, + ( DBENTRYP_VF ) hb_dbfAddField, + ( DBENTRYP_B ) hb_dbfAppend, + ( DBENTRYP_I ) hb_dbfCreateFields, + ( DBENTRYP_V ) hb_dbfDeleteRec, + ( DBENTRYP_BP ) hb_dbfDeleted, + ( DBENTRYP_SP ) hb_dbfFieldCount, + ( DBENTRYP_VF ) hb_dbfFieldDisplay, + ( DBENTRYP_SSI ) hb_dbfFieldInfo, + ( DBENTRYP_SCP ) hb_dbfFieldName, + ( DBENTRYP_V ) hb_dbfFlush, + ( DBENTRYP_PP ) hb_dbfGetRec, + ( DBENTRYP_SI ) hb_dbfGetValue, + ( DBENTRYP_SVL ) hb_dbfGetVarLen, + ( DBENTRYP_V ) hb_dbfGoCold, + ( DBENTRYP_V ) hb_dbfGoHot, + ( DBENTRYP_P ) hb_dbfPutRec, + ( DBENTRYP_SI ) hb_dbfPutValue, + ( DBENTRYP_V ) hb_dbfRecall, + ( DBENTRYP_ULP ) hb_dbfRecCount, + ( DBENTRYP_ISI ) hb_dbfRecInfo, + ( DBENTRYP_ULP ) hb_dbfRecNo, + ( DBENTRYP_I ) hb_dbfRecId, + ( DBENTRYP_S ) hb_dbfSetFieldExtent, + ( DBENTRYP_CP ) hb_dbfAlias, + ( DBENTRYP_V ) hb_dbfClose, + ( DBENTRYP_VO ) hb_dbfCreate, + ( DBENTRYP_SI ) hb_dbfInfo, + ( DBENTRYP_V ) hb_dbfNewArea, + ( DBENTRYP_VO ) hb_dbfOpen, + ( DBENTRYP_V ) hb_dbfRelease, + ( DBENTRYP_SP ) hb_dbfStructSize, + ( DBENTRYP_CP ) hb_dbfSysName, + ( DBENTRYP_VEI ) hb_dbfEval, + ( DBENTRYP_V ) hb_dbfPack, + ( DBENTRYP_LSP ) hb_dbfPackRec, + ( DBENTRYP_VS ) hb_dbfSort, + ( DBENTRYP_VT ) hb_dbfTrans, + ( DBENTRYP_VT ) hb_dbfTransRec, + ( DBENTRYP_V ) hb_dbfZap, + ( DBENTRYP_VR ) hb_dbfChildEnd, + ( DBENTRYP_VR ) hb_dbfChildStart, + ( DBENTRYP_VR ) hb_dbfChildSync, + ( DBENTRYP_V ) hb_dbfSyncChildren, + ( DBENTRYP_V ) hb_dbfClearRel, + ( DBENTRYP_V ) hb_dbfForceRel, + ( DBENTRYP_SSP ) hb_dbfRelArea, + ( DBENTRYP_VR ) hb_dbfRelEval, + ( DBENTRYP_SI ) hb_dbfRelText, + ( DBENTRYP_VR ) hb_dbfSetRel, + ( DBENTRYP_VOI ) hb_dbfOrderListAdd, + ( DBENTRYP_V ) hb_dbfOrderListClear, + ( DBENTRYP_VOI ) hb_dbfOrderListDelete, + ( DBENTRYP_VOI ) hb_dbfOrderListFocus, + ( DBENTRYP_V ) hb_dbfOrderListRebuild, + ( DBENTRYP_VOO ) hb_dbfOrderCondition, + ( DBENTRYP_VOC ) hb_dbfOrderCreate, + ( DBENTRYP_VOI ) hb_dbfOrderDestroy, + ( DBENTRYP_SVOI ) hb_dbfOrderInfo, + ( DBENTRYP_V ) hb_dbfClearFilter, + ( DBENTRYP_V ) hb_dbfClearLocate, + ( DBENTRYP_V ) hb_dbfClearScope, + ( DBENTRYP_VPLP ) hb_dbfCountScope, + ( DBENTRYP_I ) hb_dbfFilterText, + ( DBENTRYP_SI ) hb_dbfScopeInfo, + ( DBENTRYP_VFI ) hb_dbfSetFilter, + ( DBENTRYP_VLO ) hb_dbfSetLocate, + ( DBENTRYP_VOS ) hb_dbfSetScope, + ( DBENTRYP_VPL ) hb_dbfSkipScope, + ( DBENTRYP_B ) hb_dbfLocate, + ( DBENTRYP_CC ) hb_dbfCompile, + ( DBENTRYP_I ) hb_dbfError, + ( DBENTRYP_I ) hb_dbfEvalBlock, + ( DBENTRYP_VSP ) hb_dbfRawLock, + ( DBENTRYP_VL ) hb_dbfLock, + ( DBENTRYP_I ) hb_dbfUnLock, + ( DBENTRYP_V ) hb_dbfCloseMemFile, + ( DBENTRYP_VO ) hb_dbfCreateMemFile, + ( DBENTRYP_SCCS ) hb_dbfGetValueFile, + ( DBENTRYP_VO ) hb_dbfOpenMemFile, + ( DBENTRYP_SCCS ) hb_dbfPutValueFile, + ( DBENTRYP_V ) hb_dbfReadDBHeader, + ( DBENTRYP_V ) hb_dbfWriteDBHeader, + ( DBENTRYP_R ) hb_dbfInit, + ( DBENTRYP_R ) hb_dbfExit, + ( DBENTRYP_RVVL ) hb_dbfDrop, + ( DBENTRYP_RVVL ) hb_dbfExists, + ( DBENTRYP_RVVVL ) hb_dbfRename, + ( DBENTRYP_RSLV ) hb_dbfRddInfo, + ( DBENTRYP_SVP ) hb_dbfWhoCares +}; HB_FUNC( _DBF ) { ; } @@ -6924,7 +6930,7 @@ HB_FUNC_STATIC( DBF_GETFUNCTABLE ) pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = ( HB_USHORT ) hb_parni( 4 ); - HB_TRACE( HB_TR_DEBUG, ( "DBF_GETFUNCTABLE(%p, %p)", puiCount, pTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "DBF_GETFUNCTABLE(%p, %p)", ( void * ) puiCount, ( void * ) pTable ) ); if( pTable ) { diff --git a/src/rdd/dbfcdx/dbfcdx1.c b/src/rdd/dbfcdx/dbfcdx1.c index 3bd1935a7a..62ee1375e5 100644 --- a/src/rdd/dbfcdx/dbfcdx1.c +++ b/src/rdd/dbfcdx/dbfcdx1.c @@ -117,7 +117,7 @@ static void hb_cdxIndexPoolFree( LPCDXINDEX pIndex, int nPagesLeft ); /* split Root Page */ static int hb_cdxPageRootSplit( LPCDXPAGE pPage ); -/* free create index structur */ +/* free create index structure */ static void hb_cdxSortFree( LPCDXSORTINFO pSort ); static HB_USHORT s_uiRddId = ( HB_USHORT ) -1; @@ -195,11 +195,11 @@ static HB_ERRCODE hb_cdxErrorRT( CDXAREAP pArea, const char * filename, HB_ERRCODE errOsCode, HB_USHORT uiFlags, PHB_ITEM * pErrorPtr ) { - PHB_ITEM pError; HB_ERRCODE iRet = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { + PHB_ITEM pError; if( pErrorPtr ) { if( ! *pErrorPtr ) @@ -273,7 +273,7 @@ static LPCDXKEY hb_cdxKeyCopy( LPCDXKEY pKeyDest, LPCDXKEY pKey ) } /* - * store bytes value in inkdex key + * store bytes value in index key */ static LPCDXKEY hb_cdxKeyPut( LPCDXKEY pKey, const HB_BYTE * pbVal, HB_USHORT uiLen, HB_ULONG ulRec ) { @@ -299,7 +299,7 @@ static LPCDXKEY hb_cdxKeyPut( LPCDXKEY pKey, const HB_BYTE * pbVal, HB_USHORT ui } /* - * store string value in inkdex key + * store string value in index key */ static LPCDXKEY hb_cdxKeyPutCL( LPCDXKEY pKey, const char * pText, HB_SIZE nLen, HB_ULONG ulRec, HB_USHORT uiKeyLen, int iMode ) { @@ -748,7 +748,7 @@ static void hb_cdxTagClearScope( LPCDXTAG pTag, HB_USHORT nScope ) LPCDXKEY * pScopeKey; PHB_ITEM * pScope; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxTagClearScope(%p, %hu)", pTag, nScope ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxTagClearScope(%p, %hu)", ( void * ) pTag, nScope ) ); /* resolve any pending scope relations first */ if( pArea->dbfarea.lpdbPendingRel && pArea->dbfarea.lpdbPendingRel->isScoped ) @@ -955,7 +955,6 @@ static void hb_cdxIndexLockFlush( LPCDXINDEX pIndex ) static HB_ULONG hb_cdxIndexGetAvailPage( LPCDXINDEX pIndex, HB_BOOL fHeader ) { PHB_FILE pFile = pIndex->pFile; - HB_BYTE byBuf[ 4 ]; HB_ULONG ulPage; if( pIndex->fReadonly ) @@ -976,6 +975,7 @@ static HB_ULONG hb_cdxIndexGetAvailPage( LPCDXINDEX pIndex, HB_BOOL fHeader ) } else { + HB_BYTE byBuf[ 4 ]; if( hb_fileReadAt( pFile, byBuf, 4, hb_cdxFilePageOffset( pIndex, ulPage ) ) != 4 ) hb_errInternal( EDBF_READ, "hb_cdxIndexGetAvailPage: Read index page failed.", NULL, NULL ); #ifdef HB_CDX_DBGUPDT @@ -1462,7 +1462,7 @@ static HB_BYTE * hb_cdxPageGetKeyVal( LPCDXPAGE pPage, int iKey ) return &pPage->pKeyBuf[ iKey * ( pPage->TagParent->uiLen + 8 ) ]; else if( pPage->PageType & CDX_NODE_LEAF ) { - int iPos, iLen, iTmp, iTrl, iDup; + int iLen; HB_BYTE bTrail, * pKeyVal; pKeyVal = hb_cdxPageKeyBufPtr( pPage ); @@ -1477,6 +1477,8 @@ static HB_BYTE * hb_cdxPageGetKeyVal( LPCDXPAGE pPage, int iKey ) } while( pPage->bufKeyNum <= iKey ) { + int iPos, iTmp, iTrl, iDup; + iPos = pPage->bufKeyNum * pPage->ReqByte; iTmp = HB_GET_LE_UINT32( &hb_cdxPageExtKeyPool( pPage )[ iPos + pPage->ReqByte - 4 ] ) >> ( 32 - pPage->TCBits - pPage->DCBits ); @@ -1536,7 +1538,7 @@ static HB_ULONG hb_cdxPageGetKeyRec( LPCDXPAGE pPage, int iKey ) } /* - * get child page number from interrior index page + * get child page number from interior index page */ static HB_ULONG hb_cdxPageGetKeyPage( LPCDXPAGE pPage, int iKey ) { @@ -1762,9 +1764,8 @@ static void hb_cdxSetLeafRecord( HB_BYTE * pDst, */ static void hb_cdxPageLeafEncode( LPCDXPAGE pPage, HB_BYTE * pKeyBuf, int iKeys ) { - int iKey, iTrl, iDup, iReq, iTmp, iNum, iLen; + int iKey, iReq, iNum, iLen; HB_BYTE * pKeyPos, * pRecPos, * pSrc; - HB_ULONG ulRec; #ifdef HB_CDX_DBGCODE if( ( pPage->PageType & CDX_NODE_LEAF ) == 0 ) @@ -1787,6 +1788,9 @@ static void hb_cdxPageLeafEncode( LPCDXPAGE pPage, HB_BYTE * pKeyBuf, int iKeys pSrc = &pKeyBuf[ 0 ]; for( iKey = 0; iKey < iKeys; iKey++, pSrc += iLen, pRecPos += iReq ) { + int iTrl, iDup, iTmp; + HB_ULONG ulRec; + ulRec = HB_GET_LE_UINT32( &pSrc[ iNum ] ); iDup = HB_GET_LE_UINT16( &pSrc[ iNum + 4 ] ); iTrl = HB_GET_LE_UINT16( &pSrc[ iNum + 6 ] ); @@ -1850,9 +1854,8 @@ static void hb_cdxPageLeafEncode( LPCDXPAGE pPage, HB_BYTE * pKeyBuf, int iKeys */ static void hb_cdxPageLeafDecode( LPCDXPAGE pPage, HB_BYTE * pKeyBuf ) { - int iKey, iTmp, iBits, iDup, iTrl, iNew, iReq, iLen = pPage->TagParent->uiLen; - HB_BYTE * pDst, * pSrc, * pRec, * pTmp, bTrail = pPage->TagParent->bTrail; - HB_ULONG ulRec; + int iKey, iBits, iReq, iLen = pPage->TagParent->uiLen; + HB_BYTE * pDst, * pSrc, * pRec, bTrail = pPage->TagParent->bTrail; #ifdef HB_CDX_DBGCODE if( ( pPage->PageType & CDX_NODE_LEAF ) == 0 ) @@ -1868,6 +1871,10 @@ static void hb_cdxPageLeafDecode( LPCDXPAGE pPage, HB_BYTE * pKeyBuf ) iReq = pPage->ReqByte; for( iKey = 0; iKey < pPage->iKeys; iKey++, pRec += iReq ) { + int iTmp, iDup, iTrl, iNew; + HB_ULONG ulRec; + HB_BYTE * pTmp; + pTmp = &pRec[ iReq - 4 ]; iTmp = HB_GET_LE_UINT32( pTmp ) >> iBits; iDup = ( iKey == 0 ) ? 0 : ( iTmp & pPage->DCMask ); @@ -1934,13 +1941,13 @@ static void hb_cdxPageLeafInitSpace( LPCDXPAGE pPage ) /* * calculate the size of keys stored in buffer, return - * the number of keys wich can be stored in the page + * the number of keys which can be stored in the page */ static void hb_cdxPageCalcLeafSpace( LPCDXPAGE pPage, HB_BYTE * pKeyBuf, int iKeys ) { int iNum = pPage->TagParent->uiLen, iKey, iSize; int iLen = iNum + 8; - HB_BYTE ReqByte, *bPtr; + HB_BYTE ReqByte; HB_ULONG ulRec, RNMask; hb_cdxPageLeafInitSpace( pPage ); @@ -1950,11 +1957,11 @@ static void hb_cdxPageCalcLeafSpace( LPCDXPAGE pPage, HB_BYTE * pKeyBuf, int iKe #ifdef HB_CDX_DBGCODE_EXT hb_cdxPageCheckDupTrl( pPage, pKeyBuf, iKeys, HB_FALSE ); #endif - /* clear duplicate counter in 1-st key */ + /* clear duplicate counter in 1st key */ HB_PUT_LE_UINT16( &pKeyBuf[ iNum + 4 ], 0 ); for( iKey = 0; iKey < iKeys; iKey++ ) { - bPtr = &pKeyBuf[ iKey * iLen + iNum ]; + HB_BYTE * bPtr = &pKeyBuf[ iKey * iLen + iNum ]; ulRec = HB_GET_LE_UINT32( bPtr ); iSize = ReqByte + iNum - HB_GET_LE_UINT16( &bPtr[ 4 ] ) - HB_GET_LE_UINT16( &bPtr[ 6 ] ); @@ -2556,7 +2563,6 @@ static int hb_cdxPageKeyLeafBalance( LPCDXPAGE pPage, int iChildRet ) iKeys = 0, iFree = 0, iSkip = 0, iBufSize = 0; HB_BYTE * pKeyPool = NULL, * pPtr; HB_BOOL fIns; - HB_ULONG ulPage; int iRet = 0, iDup, iMax, i; #ifndef HB_CDX_PACKTRAIL int iTmp; @@ -2593,7 +2599,7 @@ static int hb_cdxPageKeyLeafBalance( LPCDXPAGE pPage, int iChildRet ) for( i = 0; i < iBlncKeys; i++ ) { - ulPage = hb_cdxPageGetKeyPage( pPage, iFirstKey + i ); + HB_ULONG ulPage = hb_cdxPageGetKeyPage( pPage, iFirstKey + i ); if( pPage->Child && pPage->Child->Page == ulPage ) { childs[ i ] = pPage->Child; @@ -2990,9 +2996,8 @@ static int hb_cdxPageKeyIntBalance( LPCDXPAGE pPage, int iChildRet ) { LPCDXPAGE childs[ CDX_BALANCE_INTPAGES + 2 ], lpTmpPage; int iFirstKey, iBlncKeys = CDX_BALANCE_INTPAGES; - int iLen = pPage->TagParent->uiLen + 8, iKeys = 0, iNeedKeys, iNodeKeys, + int iLen = pPage->TagParent->uiLen + 8, iKeys = 0, iNeedKeys, iMin = pPage->TagParent->MaxKeys, iMax = 0, iDiv; - HB_ULONG ulPage; HB_BYTE * pKeyPool = NULL, * pPtr; HB_BOOL fForce = ( iChildRet & ( NODE_SPLIT | NODE_JOIN ) ) != 0; int iRet = 0, i; @@ -3029,7 +3034,7 @@ static int hb_cdxPageKeyIntBalance( LPCDXPAGE pPage, int iChildRet ) for( i = 0; i < iBlncKeys; i++ ) { - ulPage = hb_cdxPageGetKeyPage( pPage, iFirstKey + i ); + HB_ULONG ulPage = hb_cdxPageGetKeyPage( pPage, iFirstKey + i ); if( pPage->Child && pPage->Child->Page == ulPage ) { childs[ i ] = pPage->Child; @@ -3254,8 +3259,8 @@ static int hb_cdxPageKeyIntBalance( LPCDXPAGE pPage, int iChildRet ) pPtr = pKeyPool; for( i = 0; i < iBlncKeys; i++ ) { - iNodeKeys = ( fForce && i == 1 ) ? 1 : - ( ( iKeys + iBlncKeys - i - 1 ) / ( iBlncKeys - i ) ); + int iNodeKeys = ( fForce && i == 1 ) ? 1 : + ( ( iKeys + iBlncKeys - i - 1 ) / ( iBlncKeys - i ) ); #ifdef HB_CDX_DBGCODE if( iNodeKeys > pPage->TagParent->MaxKeys ) hb_cdxErrInternal( "hb_cdxPageKeyIntBalance: iNodeKeys calculated wrong!" ); @@ -3491,7 +3496,7 @@ static void hb_cdxTagHeaderStore( LPCDXTAG pTag ) #if defined( HB_SIXCDX ) static HB_BOOL hb_cdxIsTemplateFunc( const char * szKeyExpr ) { - /* For CDX format SIx3 really makes sth like that */ + /* For CDX format SIx3 really makes something like that */ return hb_strnicmp( szKeyExpr, "sxChar(", 7 ) == 0 || hb_strnicmp( szKeyExpr, "sxDate(", 7 ) == 0 || hb_strnicmp( szKeyExpr, "sxNum(", 6 ) == 0 || @@ -3725,7 +3730,7 @@ static void hb_cdxTagFree( LPCDXTAG pTag ) /* * Creates a new structure with a tag information * TagHdr = offset of index page where a tag header is stored - * if CDX_DUMMYNODE then allocate space ofor a new tag header + * if CDX_DUMMYNODE then allocate space for a new tag header */ static LPCDXTAG hb_cdxTagNew( LPCDXINDEX pIndex, const char * szTagName, HB_ULONG TagHdr ) { @@ -3847,7 +3852,7 @@ static void hb_cdxTagPoolFlush( LPCDXTAG pTag ) } /* - * retrive CurKey from current Tag possition + * retrieve CurKey from current Tag position */ static void hb_cdxSetCurKey( LPCDXPAGE pPage ) { @@ -3980,7 +3985,7 @@ static HB_BOOL hb_cdxCheckRecordScope( CDXAREAP pArea, HB_ULONG ulRec ) } /* - * check and avaluate record filter + * check and evaluate record filter */ static HB_BOOL hb_cdxCheckRecordFilter( CDXAREAP pArea, HB_ULONG ulRecNo ) { @@ -4600,11 +4605,12 @@ static void hb_cdxTagSkipPrev( LPCDXTAG pTag ) */ static void hb_cdxReorderTagList( LPCDXTAG * TagListPtr ) { - LPCDXTAG * pTagPtr, pTagTmp; HB_BOOL fRepeat = HB_TRUE; while( fRepeat ) { + LPCDXTAG * pTagPtr, pTagTmp; + fRepeat = HB_FALSE; pTagPtr = TagListPtr; while( *pTagPtr && ( *pTagPtr )->pNext ) @@ -4698,13 +4704,12 @@ static void hb_cdxIndexFreePages( LPCDXPAGE pPage ) { if( ( pPage->PageType & CDX_NODE_LEAF ) == 0 ) { - LPCDXPAGE pChildPage; int iKey; for( iKey = 0; iKey < pPage->iKeys; iKey++ ) { - pChildPage = hb_cdxPageNew( pPage->TagParent, NULL, - hb_cdxPageGetKeyPage( pPage, iKey ) ); + LPCDXPAGE pChildPage = hb_cdxPageNew( pPage->TagParent, NULL, + hb_cdxPageGetKeyPage( pPage, iKey ) ); if( pChildPage ) hb_cdxIndexFreePages( pChildPage ); } @@ -5039,7 +5044,7 @@ static void hb_cdxCreateFName( CDXAREAP pArea, const char * szBagName, */ static void hb_cdxOrdListClear( CDXAREAP pArea, HB_BOOL fAll, LPCDXINDEX pKeepInd ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrdListClear(%p, %d)", pArea, ( int ) fAll ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrdListClear(%p, %d)", ( void * ) pArea, ( int ) fAll ) ); if( pArea->lpIndexes ) { @@ -5322,7 +5327,7 @@ static HB_ERRCODE hb_cdxDBOISkipUnique( CDXAREAP pArea, LPCDXTAG pTag, HB_LONG l HB_ERRCODE retval; HB_BOOL fForward; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxDBOISkipUnique(%p, %p, %ld)", pArea, pTag, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxDBOISkipUnique(%p, %p, %ld)", ( void * ) pArea, ( void * ) pTag, lToSkip ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -5444,7 +5449,7 @@ static HB_BOOL hb_cdxDBOISkipEval( CDXAREAP pArea, LPCDXTAG pTag, HB_BOOL fForwa { HB_BOOL fFound = HB_FALSE, fFirst = HB_TRUE; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxDBOISkipEval(%p, %p, %i, %p)", pArea, pTag, fForward, pEval ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxDBOISkipEval(%p, %p, %i, %p)", ( void * ) pArea, ( void * ) pTag, fForward, ( void * ) pEval ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FALSE; @@ -5541,7 +5546,7 @@ static HB_BOOL hb_cdxDBOISkipWild( CDXAREAP pArea, LPCDXTAG pTag, HB_BOOL fForwa char * szFree = NULL; int iFixed = 0, iStop; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxDBOISkipWild(%p, %p, %i, %p)", pArea, pTag, fForward, pWildItm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxDBOISkipWild(%p, %p, %i, %p)", ( void * ) pArea, ( void * ) pTag, fForward, ( void * ) pWildItm ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FALSE; @@ -5709,7 +5714,7 @@ static HB_BOOL hb_cdxDBOISkipRegEx( CDXAREAP pArea, LPCDXTAG pTag, HB_BOOL fForw HB_BOOL fFound = HB_FALSE, fFirst = HB_TRUE; PHB_REGEX pRegEx; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxDBOISkipRegEx(%p, %p, %i, %p)", pArea, pTag, fForward, pRegExItm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxDBOISkipRegEx(%p, %p, %i, %p)", ( void * ) pArea, ( void * ) pTag, fForward, ( void * ) pRegExItm ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FALSE; @@ -6555,7 +6560,7 @@ static HB_ERRCODE hb_cdxGoBottom( CDXAREAP pArea ) LPCDXTAG pTag; HB_ERRCODE retval; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxGoBottom(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxGoBottom(%p)", ( void * ) pArea ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6601,7 +6606,7 @@ static HB_ERRCODE hb_cdxGoTop( CDXAREAP pArea ) LPCDXTAG pTag; HB_ERRCODE retval; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxGoTop(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxGoTop(%p)", ( void * ) pArea ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6641,7 +6646,7 @@ static HB_ERRCODE hb_cdxSeek( CDXAREAP pArea, HB_BOOL fSoftSeek, PHB_ITEM pKeyIt { LPCDXTAG pTag; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxSeek(%p, %d, %p, %d)", pArea, fSoftSeek, pKeyItm, fFindLast ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxSeek(%p, %d, %p, %d)", ( void * ) pArea, fSoftSeek, ( void * ) pKeyItm, fFindLast ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6728,7 +6733,7 @@ static HB_ERRCODE hb_cdxSkip( CDXAREAP pArea, HB_LONG lToSkip ) LPCDXTAG pTag; HB_ULONG ulPos, ulRec; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxSkip(%p, %ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxSkip(%p, %ld)", ( void * ) pArea, lToSkip ) ); if( pArea->dbfarea.lpdbPendingRel ) SELF_FORCEREL( &pArea->dbfarea.area ); @@ -6797,7 +6802,7 @@ static HB_ERRCODE hb_cdxSkipRaw( CDXAREAP pArea, HB_LONG lToSkip ) HB_ERRCODE retval; HB_BOOL fOut = HB_FALSE, fForward; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxSkipRaw(%p, %ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxSkipRaw(%p, %ld)", ( void * ) pArea, lToSkip ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6897,7 +6902,7 @@ static HB_ERRCODE hb_cdxFlush( CDXAREAP pArea ) LPCDXINDEX pIndex; HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxFlush(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxFlush(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6934,7 +6939,7 @@ static HB_ERRCODE hb_cdxGoCold( CDXAREAP pArea ) HB_BOOL fRecordChanged = pArea->dbfarea.fRecordChanged; HB_BOOL fAppend = pArea->dbfarea.fAppend; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxGoCold(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxGoCold(%p)", ( void * ) pArea ) ); if( SUPER_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7058,7 +7063,7 @@ static HB_ERRCODE hb_cdxGoCold( CDXAREAP pArea ) static HB_ERRCODE hb_cdxGoHot( CDXAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxGoHot(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxGoHot(%p)", ( void * ) pArea ) ); if( pArea->dbfarea.fRecordChanged ) hb_cdxErrInternal( "hb_cdxGoHot: multiple marking buffer as hot." ); @@ -7109,7 +7114,7 @@ static HB_ERRCODE hb_cdxClose( CDXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxClose(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7164,7 +7169,7 @@ static HB_ERRCODE hb_cdxOpen( CDXAREAP pArea, LPDBOPENINFO pOpenInfo ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOpen(%p, %p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOpen(%p, %p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); if( ! pArea->dbfarea.bLockType ) { @@ -7238,7 +7243,7 @@ static HB_ERRCODE hb_cdxOpen( CDXAREAP pArea, LPDBOPENINFO pOpenInfo ) */ static HB_ERRCODE hb_cdxStructSize( CDXAREAP pArea, HB_USHORT * uiSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxStrucSize(%p, %p)", pArea, uiSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxStrucSize(%p, %p)", ( void * ) pArea, ( void * ) uiSize ) ); HB_SYMBOL_UNUSED( pArea ); *uiSize = sizeof( CDXAREA ); @@ -7252,7 +7257,7 @@ static HB_ERRCODE hb_cdxStructSize( CDXAREAP pArea, HB_USHORT * uiSize ) /* ( DBENTRYP_V ) hb_cdxPack */ static HB_ERRCODE hb_cdxPack( CDXAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxPack(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxPack(%p)", ( void * ) pArea ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7273,7 +7278,7 @@ static HB_ERRCODE hb_cdxPack( CDXAREAP pArea ) /* ( DBENTRYP_V ) hb_cdxZap */ static HB_ERRCODE hb_cdxZap( CDXAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "nb_cdxZap(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "nb_cdxZap(%p)", ( void * ) pArea ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7308,7 +7313,7 @@ static HB_ERRCODE hb_cdxOrderListAdd( CDXAREAP pArea, LPDBORDERINFO pOrderInfo ) HB_BOOL fProd, bRetry; PHB_ITEM pError = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderListAdd(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderListAdd(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7319,10 +7324,10 @@ static HB_ERRCODE hb_cdxOrderListAdd( CDXAREAP pArea, LPDBORDERINFO pOrderInfo ) hb_cdxCreateFName( pArea, hb_itemGetCPtr( pOrderInfo->atomBagName ), &fProd, szFileName, szBaseName ); -/* +#if 0 if( ! szBaseName[ 0 ] ) return HB_FAILURE; - */ +#endif pIndex = hb_cdxFindBag( pArea, szFileName ); if( pIndex ) @@ -7411,7 +7416,7 @@ static HB_ERRCODE hb_cdxOrderListAdd( CDXAREAP pArea, LPDBORDERINFO pOrderInfo ) */ static HB_ERRCODE hb_cdxOrderListClear( CDXAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderListClear(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderListClear(%p)", ( void * ) pArea ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7431,7 +7436,7 @@ static HB_ERRCODE hb_cdxOrderListDelete( CDXAREAP pArea, LPDBORDERINFO pOrderInf LPCDXINDEX pIndex, * pIndexPtr; HB_BOOL fProd; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderListDelete(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderListDelete(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7470,7 +7475,7 @@ static HB_ERRCODE hb_cdxOrderListFocus( CDXAREAP pArea, LPDBORDERINFO pOrderInfo { LPCDXTAG pTag; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderListFocus(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderListFocus(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7494,7 +7499,7 @@ static HB_ERRCODE hb_cdxOrderListRebuild( CDXAREAP pArea ) LPCDXINDEX pIndex, * pIndexPtr; HB_USHORT uiPrevTag; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxPack(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxPack(%p)", ( void * ) pArea ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7548,14 +7553,14 @@ static HB_ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderI fCustom = HB_FALSE, fTemporary = HB_FALSE, fExclusive = HB_FALSE; PHB_ITEM pKeyExp, pForExp = NULL, pResult; char szCpndTagName[ CDX_MAXTAGNAMELEN + 1 ], szTagName[ CDX_MAXTAGNAMELEN + 1 ]; - char szFileName[ HB_PATH_MAX ], szTempFile[ HB_PATH_MAX ]; + char szFileName[ HB_PATH_MAX ]; const char * szFor = NULL; LPCDXINDEX pIndex; LPCDXTAG pTag; HB_USHORT uiLen; HB_BYTE bType; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderCreate(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderCreate(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7762,6 +7767,7 @@ static HB_ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderI if( ! fOpenedIndex ) { + char szTempFile[ HB_PATH_MAX ]; PHB_FILE pFile; HB_BOOL bRetry, fShared = pArea->dbfarea.fShared && ! fTemporary && ! fExclusive; PHB_ITEM pError = NULL; @@ -7815,13 +7821,13 @@ static HB_ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderI if( ! hb_cdxIndexLoad( pIndex, szCpndTagName ) ) { /* TODO: What should be default? */ - /* +#if 0 hb_cdxIndexFree( pIndex ); hb_fileClose( pFile ); pFile = NULL; hb_cdxErrorRT( pArea, EG_CORRUPTION, EDBF_CORRUPT, szFileName, hb_fsError(), EF_CANDEFAULT, NULL ); - */ +#endif hb_cdxIndexFreeTags( pIndex ); fNewFile = HB_TRUE; } @@ -7923,7 +7929,7 @@ static HB_ERRCODE hb_cdxOrderDestroy( CDXAREAP pArea, LPDBORDERINFO pOrderInfo ) LPCDXTAG pTag; HB_USHORT uiTag; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderDestroy(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderDestroy(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( FAST_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7994,7 +8000,7 @@ static HB_ERRCODE hb_cdxOrderInfo( CDXAREAP pArea, HB_USHORT uiIndex, LPDBORDERI LPCDXTAG pTag; HB_USHORT uiTag = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderInfo(%p, %hu, %p)", pArea, uiIndex, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxOrderInfo(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pInfo ) ); switch( uiIndex ) { @@ -8806,7 +8812,7 @@ static HB_ERRCODE hb_cdxClearFilter( CDXAREAP pArea ) /* ( DBENTRYP_VPLP ) hb_cdxCountScope */ static HB_ERRCODE hb_cdxCountScope( CDXAREAP pArea, void * pPtr, HB_LONG * plRec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxCountScope(%p, %p, %p)", pArea, pPtr, plRec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxCountScope(%p, %p, %p)", ( void * ) pArea, ( void * ) pPtr, ( void * ) plRec ) ); if( pPtr == NULL ) { @@ -8858,7 +8864,7 @@ static HB_ERRCODE hb_cdxRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulC { LPDBFDATA pData; - HB_TRACE( HB_TR_DEBUG, ( "hb_cdxRddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnect, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cdxRddInfo(%p, %hu, %lu, %p)", ( void * ) pRDD, uiIndex, ulConnect, ( void * ) pItem ) ); pData = DBFNODE_DATA( pRDD ); @@ -9112,7 +9118,7 @@ static void hb_cdxSortWritePage( LPCDXSORTINFO pSort ) char szName[ HB_PATH_MAX ]; pSort->pTempFile = hb_fileCreateTemp( NULL, NULL, FC_NORMAL, szName ); if( pSort->pTempFile == NULL ) - hb_errInternal( 9301, "hb_cdxSortWritePage: Can't create temporary file.", NULL, NULL ); + hb_errInternal( 9301, "hb_cdxSortWritePage: Could not create temporary file.", NULL, NULL ); pSort->szTempFileName = hb_strdup( szName ); } pSort->pSwapPage[ pSort->ulCurPage ].ulKeys = pSort->ulKeys; @@ -9148,24 +9154,31 @@ static void hb_cdxSortGetPageKey( LPCDXSORTINFO pSort, HB_ULONG ulPage, #ifdef HB_CDX_NEW_SORT static void hb_cdxSortOrderPages( LPCDXSORTINFO pSort ) { - int iLen = pSort->keyLen, i; - HB_LONG l, r, m; - HB_ULONG n, ulPage, ulRec; - HB_BYTE * pKey = NULL, * pTmp; - pSort->ulFirst = 0; pSort->pSortedPages = ( HB_ULONG * ) hb_xgrab( pSort->ulPages * sizeof( HB_ULONG ) ); pSort->pSortedPages[ 0 ] = 0; if( pSort->ulTotKeys > 0 ) { + int iLen = pSort->keyLen; + HB_ULONG n; + HB_BYTE * pKey = NULL; + for( n = 0; n < pSort->ulPages; n++ ) { + HB_ULONG ulRec; + HB_LONG l, r; + hb_cdxSortGetPageKey( pSort, n, &pKey, &ulRec ); l = 0; r = n - 1; while( l <= r ) { + int i; + HB_ULONG ulPage; + HB_LONG m; + HB_BYTE * pTmp; + m = ( l + r ) >> 1; ulPage = pSort->pSortedPages[ m ]; pTmp = &pSort->pSwapPage[ ulPage ].pKeyPool[ pSort->pSwapPage[ ulPage ].ulCurKey * ( iLen + 4 ) ]; @@ -9186,17 +9199,15 @@ static void hb_cdxSortOrderPages( LPCDXSORTINFO pSort ) static HB_BOOL hb_cdxSortKeyGet( LPCDXSORTINFO pSort, HB_BYTE ** pKeyVal, HB_ULONG * pulRec ) { - int iLen = pSort->keyLen, i; - HB_LONG l, r, m; - HB_ULONG ulPage; - - ulPage = pSort->pSortedPages[ pSort->ulFirst ]; + HB_ULONG ulPage = pSort->pSortedPages[ pSort->ulFirst ]; /* check if first page has some keys yet */ if( pSort->pSwapPage[ ulPage ].ulKeys > 0 ) { - HB_BYTE * pKey, * pTmp; + int iLen = pSort->keyLen; + HB_BYTE * pKey; HB_ULONG ulRec; + HB_LONG l, r; /* * last key was taken from this page - we have to resort it. @@ -9212,6 +9223,10 @@ static HB_BOOL hb_cdxSortKeyGet( LPCDXSORTINFO pSort, HB_BYTE ** pKeyVal, HB_ULO r = pSort->ulPages - 1; while( l <= r ) { + int i; + HB_LONG m; + HB_BYTE * pTmp; + m = ( l + r ) >> 1; ulPage = pSort->pSortedPages[ m ]; pTmp = &pSort->pSwapPage[ ulPage ].pKeyPool[ pSort->pSwapPage[ ulPage ].ulCurKey * ( iLen + 4 ) ]; @@ -9369,7 +9384,7 @@ static LPCDXSORTINFO hb_cdxSortNew( LPCDXTAG pTag, HB_ULONG ulRecCount ) * The memory necessary to index file is now ~ * ~ (keySize+4+sizeof(CDXSWAPPAGE)) * sqrt(ulRecCount) * 2 * so the maximum is for DBF with 2^32 records and keySize 240 ~ - * ~ 2^17 * 268 ~=~ 35 Mb + * ~ 2^17 * 268 ~=~ 35 MB * this is not a problem for current computers and I do not see * any way to use DBFs with four billions records and indexes with * such long (240 bytes) keys on the old ones - they will be simply @@ -9423,7 +9438,7 @@ static void hb_cdxSortFree( LPCDXSORTINFO pSort ) static void hb_cdxSortOut( LPCDXSORTINFO pSort ) { HB_BOOL fUnique = pSort->fUnique, fNext; - HB_ULONG ulPage, ulRec, ulKey; + HB_ULONG ulRec, ulKey; HB_BYTE * pKeyVal; int iLen = pSort->keyLen, iLevel; @@ -9437,6 +9452,7 @@ static void hb_cdxSortOut( LPCDXSORTINFO pSort ) if( pSort->ulPages > 1 ) { HB_BYTE * pBuf = pSort->pKeyPool; + HB_ULONG ulPage; hb_cdxSortWritePage( pSort ); for( ulPage = 0; ulPage < pSort->ulPages; ulPage++ ) { @@ -9530,7 +9546,7 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag, HB_BOOL fReindex ) { LPCDXAREA pArea = pTag->pIndex->pArea; LPCDXSORTINFO pSort; - PHB_ITEM pForItem, pWhileItem = NULL, pEvalItem = NULL, pItem = NULL; + PHB_ITEM pWhileItem = NULL, pEvalItem = NULL; HB_ULONG ulRecCount, ulRecNo = pArea->dbfarea.ulRecNo; HB_LONG lStep = 0; PHB_CODEPAGE cdpTmp = hb_cdpSelect( pArea->dbfarea.area.cdPage ); @@ -9578,6 +9594,7 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag, HB_BOOL fReindex ) HB_BOOL fDirectRead, fUseFilter = HB_FALSE; HB_BYTE * pSaveRecBuff = pArea->dbfarea.pRecord, cTemp[ 8 ]; int iRecBuff = 0, iRecBufSize, iRec; + PHB_ITEM pForItem, pItem = NULL; pForItem = pTag->pForItem; if( pTag->nField ) @@ -9993,7 +10010,7 @@ HB_FUNC_STATIC( _GETFUNCTABLE ) uiRddId = ( HB_USHORT ) hb_parni( 4 ); puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); - HB_TRACE( HB_TR_DEBUG, ( HB_CDXRDD "_GETFUNCTABLE(%p, %p)", puiCount, pTable ) ); + HB_TRACE( HB_TR_DEBUG, ( HB_CDXRDD "_GETFUNCTABLE(%p, %p)", ( void * ) puiCount, ( void * ) pTable ) ); if( pTable ) { diff --git a/src/rdd/dbffpt/dbffpt1.c b/src/rdd/dbffpt/dbffpt1.c index 33785b4927..c1b4c3259c 100644 --- a/src/rdd/dbffpt/dbffpt1.c +++ b/src/rdd/dbffpt/dbffpt1.c @@ -315,16 +315,16 @@ static HB_ERRCODE hb_fptPutRootBlock( FPTAREAP pArea, HB_ULONG ulBlock ) /* GARBAGE COLLECTOR: I don't have any documentation about it. All I know is reverse engineering - or analyzes of other sources. If any one can tell me sth more about it then - I will be really glad. I use method one for SixMemo and method 2 for FLEX - memos. + or analyzes of other sources. If any one can tell me something more about it + then I will be really glad. I use method one for SixMemo and method 2 for + FLEX memos. Method 1. FPTHEADER->reserved2[492] is a list of free pages, 6 bytes for each page size[2] (size in blocks) (little endian) block[4] (block number) (little endian) - signature1[12] has to be cutted down to + signature1[12] has to be cut down to 10 bytes. The last 2 bytes becomes the number of entries in free block list (max 82) @@ -369,7 +369,7 @@ static HB_ERRCODE hb_fptPutRootBlock( FPTAREAP pArea, HB_ULONG ulBlock ) the number of items 2 - means branch node, 3-leaf node. The value in GC node is calculated as: ( nItem << 2 ) | FPTGCNODE_TYPE - Each item in branch node has 12 bytes and inside them 3 32bit little + Each item in branch node has 12 bytes and inside them 3 32-bit little endian values in pages sorted by offset the are: offset,size,subpage and in pages sorted by size: @@ -387,22 +387,26 @@ static HB_ERRCODE hb_fptPutRootBlock( FPTAREAP pArea, HB_ULONG ulBlock ) */ static void hb_fptSortGCitems( LPMEMOGCTABLE pGCtable ) { - HB_ULONG ulOffset, ulSize; - HB_BOOL fChanged, fMoved = HB_TRUE; - int i, j, l; + HB_BOOL fMoved = HB_TRUE; + int l; - /* this table should be allready quite good sorted so this simple + /* this table should be already quite good sorted so this simple algorithms will be the most efficient one. It will need only one or two passes */ l = pGCtable->usItems - 1; while( fMoved ) { + int i, j; + fMoved = HB_FALSE; j = l; for( i = 0; i < j; i++ ) { if( pGCtable->pGCitems[ i ].ulSize > pGCtable->pGCitems[ i + 1 ].ulSize ) { + HB_ULONG ulOffset, ulSize; + HB_BOOL fChanged; + ulOffset = pGCtable->pGCitems[ i + 1 ].ulOffset; ulSize = pGCtable->pGCitems[ i + 1 ].ulSize; fChanged = pGCtable->pGCitems[ i + 1 ].fChanged; @@ -425,17 +429,16 @@ static void hb_fptSortGCitems( LPMEMOGCTABLE pGCtable ) */ static void hb_fptPackGCitems( LPMEMOGCTABLE pGCtable ) { - HB_ULONG ulEnd; int i, j; - /* TODO: better alogrithm this primitve one can be too slow for big + /* TODO: better algorithm this primitive one can be too slow for big free block list table */ for( i = 0; i < pGCtable->usItems; i++ ) { if( pGCtable->pGCitems[ i ].ulOffset != 0 && pGCtable->pGCitems[ i ].ulSize != 0 ) { - ulEnd = pGCtable->pGCitems[ i ].ulOffset + pGCtable->pGCitems[ i ].ulSize; + HB_ULONG ulEnd = pGCtable->pGCitems[ i ].ulOffset + pGCtable->pGCitems[ i ].ulSize; if( ulEnd == pGCtable->ulNextBlock ) { pGCtable->ulNextBlock -= pGCtable->pGCitems[ i ].ulSize; @@ -486,11 +489,14 @@ static HB_ERRCODE hb_fptWriteGCitems( FPTAREAP pArea, LPMEMOGCTABLE pGCtable, HB { FPTBLOCK fptBlock; HB_ERRCODE errCode = HB_SUCCESS; - int i /* ,iStart, iStop */; + int i; +#if 0 + int iStart, iStop; +#endif HB_SYMBOL_UNUSED( usItem ); -/* +#if 0 if( usItem == 0 ) { iStart = 0; @@ -501,7 +507,7 @@ static HB_ERRCODE hb_fptWriteGCitems( FPTAREAP pArea, LPMEMOGCTABLE pGCtable, HB iStart = usItem; iStop = usItem + 1; } - */ +#endif for( i = 0; i < pGCtable->usItems; i++ ) { @@ -712,7 +718,7 @@ static HB_ERRCODE hb_fptGCgetFreeBlock( FPTAREAP pArea, LPMEMOGCTABLE pGCtable, } /* - * Init GC table free memo blok list. + * Init GC table free memo block list. */ static void hb_fptInitGCdata( LPMEMOGCTABLE pGCtable ) { @@ -720,7 +726,7 @@ static void hb_fptInitGCdata( LPMEMOGCTABLE pGCtable ) } /* - * Clean GC table free memo blok list. + * Clean GC table free memo block list. */ static void hb_fptDestroyGCdata( LPMEMOGCTABLE pGCtable ) { @@ -739,7 +745,6 @@ static void hb_fptDestroyGCdata( LPMEMOGCTABLE pGCtable ) static HB_ERRCODE hb_fptReadGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable ) { HB_SIZE nRead; - int i; hb_fptDestroyGCdata( pGCtable ); memset( &pGCtable->fptHeader, 0, sizeof( FPTHEADER ) ); @@ -748,6 +753,8 @@ static HB_ERRCODE hb_fptReadGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable ) sizeof( FPTHEADER ), 0 ); if( nRead >= 512 && nRead != ( HB_SIZE ) FS_ERROR ) { + int i; + if( pArea->bMemoType == DB_MEMO_SMT || pArea->bMemoType == DB_MEMO_DBT ) pGCtable->ulNextBlock = HB_GET_LE_UINT32( pGCtable->fptHeader.nextBlock ); else @@ -824,9 +831,7 @@ static HB_ERRCODE hb_fptReadGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable ) } if( pGCtable->pGCitems ) - { hb_fptSortGCitems( pGCtable ); - } return HB_SUCCESS; } @@ -839,11 +844,12 @@ static HB_ERRCODE hb_fptReadGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable ) static HB_ERRCODE hb_fptWriteGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_ULONG ulHdrSize = 512; - int i, j; if( pGCtable->bChanged > 0 ) { + HB_ULONG ulHdrSize = 512; + int i, j; + if( pGCtable->bType == DB_MEMOVER_SIX ) { HB_USHORT usItems = HB_MIN( pGCtable->usItems, pGCtable->usMaxItem ); @@ -983,9 +989,8 @@ static HB_ERRCODE hb_fptWriteGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable ) static HB_ULONG hb_fptGetMemoLen( FPTAREAP pArea, HB_USHORT uiIndex ) { HB_ULONG ulBlock, ulSize, ulType; - FPTBLOCK fptBlock; - HB_TRACE( HB_TR_DEBUG, ( "hb_fptGetMemoLen(%p, %hu)", pArea, uiIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fptGetMemoLen(%p, %hu)", ( void * ) pArea, uiIndex ) ); if( hb_dbfGetMemoData( ( DBFAREAP ) pArea, uiIndex - 1, &ulBlock, &ulSize, &ulType ) == HB_SUCCESS ) @@ -996,6 +1001,7 @@ static HB_ULONG hb_fptGetMemoLen( FPTAREAP pArea, HB_USHORT uiIndex ) pArea->bMemoType == DB_MEMO_FPT ) ) { HB_FOFFSET fOffset = FPT_BLOCK_OFFSET( ulBlock ); + FPTBLOCK fptBlock; if( pArea->bMemoType == DB_MEMO_DBT ) { @@ -1032,9 +1038,8 @@ static HB_ULONG hb_fptGetMemoLen( FPTAREAP pArea, HB_USHORT uiIndex ) static const char * hb_fptGetMemoType( FPTAREAP pArea, HB_USHORT uiIndex ) { HB_ULONG ulBlock, ulSize, ulType; - FPTBLOCK fptBlock; - HB_TRACE( HB_TR_DEBUG, ( "hb_fptGetMemoType(%p, %hu)", pArea, uiIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fptGetMemoType(%p, %hu)", ( void * ) pArea, uiIndex ) ); if( hb_dbfGetMemoData( ( DBFAREAP ) pArea, uiIndex - 1, &ulBlock, &ulSize, &ulType ) == HB_SUCCESS ) @@ -1043,6 +1048,7 @@ static const char * hb_fptGetMemoType( FPTAREAP pArea, HB_USHORT uiIndex ) { if( ulType == 0 && pArea->bMemoType == DB_MEMO_FPT ) { + FPTBLOCK fptBlock; if( hb_fileReadAt( pArea->pMemoFile, &fptBlock, sizeof( FPTBLOCK ), FPT_BLOCK_OFFSET( ulBlock ) ) != sizeof( FPTBLOCK ) ) @@ -1069,11 +1075,11 @@ static const char * hb_fptGetMemoType( FPTAREAP pArea, HB_USHORT uiIndex ) return "M"; case FPTIT_SIX_ARRAY: return "A"; -/* +#if 0 case FPTIT_SIX_BLOCK: case FPTIT_SIX_VREF: case FPTIT_SIX_MREF: - */ +#endif case FPTIT_FLEX_ARRAY: case FPTIT_FLEX_VOARR: return "A"; @@ -1264,10 +1270,6 @@ static HB_ERRCODE hb_fptCountSMTDataLength( FPTAREAP pArea, HB_FOFFSET * pfOffse static void hb_fptStoreSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBufPtr, int iTrans ) { HB_ULONG ulLen, u; - HB_MAXINT iVal; - HB_LONG lVal; - double dVal; - int iWidth, iDec; switch( hb_itemType( pItem ) ) { @@ -1323,7 +1325,8 @@ static void hb_fptStoreSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBufP case HB_IT_INTEGER: case HB_IT_LONG: - iVal = hb_itemGetNInt( pItem ); + { + HB_MAXINT iVal = hb_itemGetNInt( pItem ); if( HB_LIM_INT32( iVal ) ) { *( *bBufPtr )++ = SMT_IT_INT; @@ -1331,9 +1334,12 @@ static void hb_fptStoreSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBufP *bBufPtr += 4; break; } - /* fallthrough */ + } + /* fallthrough */ case HB_IT_DOUBLE: - dVal = hb_itemGetND( pItem ); + { + double dVal = hb_itemGetND( pItem ); + int iWidth, iDec; hb_itemGetNLen( pItem, &iWidth, &iDec ); if( iDec ) iWidth += iDec + 1; @@ -1343,15 +1349,17 @@ static void hb_fptStoreSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBufP HB_PUT_LE_DOUBLE( *bBufPtr, dVal ); *bBufPtr += 8; break; - + } case HB_IT_DATE: case HB_IT_TIMESTAMP: + { + HB_LONG lVal; *( *bBufPtr )++ = SMT_IT_DATE; lVal = hb_itemGetDL( pItem ); HB_PUT_LE_UINT32( *bBufPtr, lVal ); *bBufPtr += 4; break; - + } case HB_IT_LOGICAL: *( *bBufPtr )++ = SMT_IT_LOGICAL; *( *bBufPtr )++ = hb_itemGetL( pItem ) ? 1 : 0; @@ -1372,7 +1380,6 @@ static HB_ERRCODE hb_fptReadRawSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_FOFFS HB_ULONG ulLen, u; HB_BYTE buffer[ 10 ]; char * pBuffer; - int iWidth, iDec; if( hb_fileReadAt( pArea->pMemoFile, buffer, 1, *pfOffset ) != 1 ) return EDBF_READ; @@ -1436,6 +1443,8 @@ static HB_ERRCODE hb_fptReadRawSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_FOFFS break; case SMT_IT_DOUBLE: + { + int iWidth, iDec; if( hb_fileReadAt( pArea->pMemoFile, buffer, 10, *pfOffset ) != 10 ) return EDBF_READ; *pfOffset += 10; @@ -1445,7 +1454,7 @@ static HB_ERRCODE hb_fptReadRawSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_FOFFS iWidth -= iDec + 1; hb_itemPutNDLen( pItem, HB_GET_LE_DOUBLE( &buffer[ 2 ] ), iWidth, iDec ); break; - + } case SMT_IT_DATE: if( hb_fileReadAt( pArea->pMemoFile, buffer, 4, *pfOffset ) != 4 ) return EDBF_READ; @@ -1477,12 +1486,12 @@ static HB_ERRCODE hb_fptReadRawSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_FOFFS */ static HB_ERRCODE hb_fptReadSMTItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BYTE * bBufEnd, PHB_ITEM pItem, int iTrans ) { - HB_ULONG ulLen, u; HB_ERRCODE errCode = HB_SUCCESS; - int iWidth, iDec; if( bBufEnd - ( *pbMemoBuf ) >= 1 ) { + HB_ULONG ulLen, u; + switch( *( *pbMemoBuf )++ ) { case SMT_IT_ARRAY: @@ -1552,6 +1561,8 @@ static HB_ERRCODE hb_fptReadSMTItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BY break; case SMT_IT_DOUBLE: + { + int iWidth, iDec; if( bBufEnd - ( *pbMemoBuf ) < 10 ) { errCode = EDBF_CORRUPT; @@ -1564,7 +1575,7 @@ static HB_ERRCODE hb_fptReadSMTItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BY hb_itemPutNDLen( pItem, HB_GET_LE_DOUBLE( *pbMemoBuf ), iWidth, iDec ); *pbMemoBuf += 8; break; - + } case SMT_IT_DATE: if( bBufEnd - ( *pbMemoBuf ) < 4 ) { @@ -1595,9 +1606,7 @@ static HB_ERRCODE hb_fptReadSMTItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BY } } else - { errCode = EDBF_CORRUPT; - } return errCode; } @@ -1669,9 +1678,6 @@ static HB_ULONG hb_fptCountSixItemLength( FPTAREAP pArea, PHB_ITEM pItem, static HB_ULONG hb_fptStoreSixItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBufPtr, int iTrans ) { HB_ULONG ulLen, u, ulSize; - HB_MAXINT iVal; - HB_LONG lVal; - double dVal; int iWidth, iDec; memset( *bBufPtr, '\0', SIX_ITEM_BUFSIZE ); @@ -1696,7 +1702,8 @@ static HB_ULONG hb_fptStoreSixItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** b case HB_IT_INTEGER: case HB_IT_LONG: - iVal = hb_itemGetNInt( pItem ); + { + HB_MAXINT iVal = hb_itemGetNInt( pItem ); hb_itemGetNLen( pItem, &iWidth, &iDec ); if( HB_LIM_INT32( iVal ) ) { @@ -1715,9 +1722,10 @@ static HB_ULONG hb_fptStoreSixItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** b *bBufPtr += SIX_ITEM_BUFSIZE; } break; - + } case HB_IT_DOUBLE: - dVal = hb_itemGetND( pItem ); + { + double dVal = hb_itemGetND( pItem ); hb_itemGetNLen( pItem, &iWidth, &iDec ); HB_PUT_LE_UINT16( &( *bBufPtr )[ 0 ], FPTIT_SIX_DNUM ); HB_PUT_LE_UINT16( &( *bBufPtr )[ 2 ], iWidth ); @@ -1725,15 +1733,16 @@ static HB_ULONG hb_fptStoreSixItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** b HB_PUT_LE_DOUBLE( &( *bBufPtr )[ 6 ], dVal ); *bBufPtr += SIX_ITEM_BUFSIZE; break; - + } case HB_IT_DATE: case HB_IT_TIMESTAMP: - lVal = hb_itemGetDL( pItem ); + { + HB_LONG lVal = hb_itemGetDL( pItem ); HB_PUT_LE_UINT16( &( *bBufPtr )[ 0 ], FPTIT_SIX_LDATE ); HB_PUT_LE_UINT32( &( *bBufPtr )[ 6 ], lVal ); *bBufPtr += SIX_ITEM_BUFSIZE; break; - + } case HB_IT_LOGICAL: HB_PUT_LE_UINT16( &( *bBufPtr )[ 0 ], FPTIT_SIX_LOG ); ( *bBufPtr )[ 6 ] = hb_itemGetL( pItem ) ? 1 : 0; @@ -1789,14 +1798,13 @@ static HB_ULONG hb_fptStoreSixItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** b */ static HB_ERRCODE hb_fptReadSixItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BYTE * bBufEnd, PHB_ITEM pItem, int iTrans ) { - HB_USHORT usType; HB_ULONG ulLen, u; HB_ERRCODE errCode = HB_SUCCESS; ulLen = SIX_ITEM_BUFSIZE; if( bBufEnd - ( *pbMemoBuf ) >= ( HB_LONG ) ulLen ) { - usType = HB_GET_LE_UINT16( &( *pbMemoBuf )[ 0 ] ); + HB_USHORT usType = HB_GET_LE_UINT16( &( *pbMemoBuf )[ 0 ] ); switch( usType ) { case FPTIT_SIX_LNUM: @@ -1846,15 +1854,14 @@ static HB_ERRCODE hb_fptReadSixItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BY } } else - { errCode = EDBF_CORRUPT; - } + break; -/* +#if 0 case FPTIT_SIX_BLOCK: case FPTIT_SIX_VREF: case FPTIT_SIX_MREF: - */ +#endif case FPTIT_SIX_ARRAY: ulLen = HB_GET_LE_UINT32( &( *pbMemoBuf )[ 2 ] ); if( pArea->uiMemoVersion == DB_MEMOVER_SIX ) @@ -1868,9 +1875,7 @@ static HB_ERRCODE hb_fptReadSixItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BY errCode = hb_fptReadSixItem( pArea, pbMemoBuf, bBufEnd, hb_arrayGetItemPtr( pItem, u ), iTrans ); if( errCode != HB_SUCCESS ) - { break; - } } ulLen = 0; break; @@ -1887,9 +1892,7 @@ static HB_ERRCODE hb_fptReadSixItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BY *pbMemoBuf += ulLen; } else - { errCode = EDBF_CORRUPT; - } return errCode; } @@ -1961,9 +1964,6 @@ static HB_ULONG hb_fptCountFlexItemLength( FPTAREAP pArea, PHB_ITEM pItem, static void hb_fptStoreFlexItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBufPtr, int iTrans ) { HB_ULONG ulLen, u; - HB_MAXINT iVal; - HB_LONG lVal; - double dVal; int iWidth, iDec; switch( hb_itemType( pItem ) ) @@ -2016,14 +2016,18 @@ static void hb_fptStoreFlexItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBuf break; case HB_IT_DATE: case HB_IT_TIMESTAMP: + { + HB_LONG lVal; *( *bBufPtr )++ = FPTIT_FLEXAR_DATEJ; lVal = hb_itemGetDL( pItem ); HB_PUT_LE_UINT32( *bBufPtr, lVal ); *bBufPtr += 4; break; + } case HB_IT_INTEGER: case HB_IT_LONG: - iVal = hb_itemGetNInt( pItem ); + { + HB_MAXINT iVal = hb_itemGetNInt( pItem ); hb_itemGetNLen( pItem, &iWidth, &iDec ); if( HB_LIM_INT8( iVal ) ) { @@ -2054,8 +2058,10 @@ static void hb_fptStoreFlexItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBuf *bBufPtr += 8; } break; + } case HB_IT_DOUBLE: - dVal = hb_itemGetND( pItem ); + { + double dVal = hb_itemGetND( pItem ); hb_itemGetNLen( pItem, &iWidth, &iDec ); if( iDec ) iWidth += iDec + 1; @@ -2065,6 +2071,7 @@ static void hb_fptStoreFlexItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBuf HB_PUT_LE_DOUBLE( *bBufPtr, dVal ); *bBufPtr += 8; break; + } case HB_IT_LOGICAL: *( *bBufPtr )++ = hb_itemGetL( pItem ) ? FPTIT_FLEXAR_TRUE : FPTIT_FLEXAR_FALSE; @@ -2085,17 +2092,12 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B HB_ERRCODE errCode = HB_SUCCESS; if( bRoot ) - { usType = FPTIT_FLEXAR_ARAY; - } else if( bBufEnd - ( *pbMemoBuf ) > 0 ) - { usType = *( *pbMemoBuf )++; - } else - { return EDBF_CORRUPT; - } + switch( usType ) { case FPTIT_FLEXAR_NIL: @@ -2109,13 +2111,9 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B break; case FPTIT_FLEXAR_LOGIC: if( bBufEnd - ( *pbMemoBuf ) >= 1 ) - { hb_itemPutL( pItem, *( *pbMemoBuf )++ != 0 ); - } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_DATEJ: case FPTIT_FLEXAR_DATEX: @@ -2125,19 +2123,13 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 4; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_CHAR: if( bBufEnd - ( *pbMemoBuf ) >= 1 ) - { hb_itemPutNI( pItem, ( signed char ) *( *pbMemoBuf )++ ); - } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_CHAR1: if( bBufEnd - ( *pbMemoBuf ) >= 2 ) @@ -2146,9 +2138,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 2; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_CHAR2: if( bBufEnd - ( *pbMemoBuf ) >= 3 ) @@ -2160,25 +2150,17 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B hb_itemPutNDLen( pItem, ( signed char ) **pbMemoBuf, iLen, iDec ); } else - { hb_itemPutNILen( pItem, ( signed char ) **pbMemoBuf, iLen ); - } *pbMemoBuf += 3; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_UCHAR: if( bBufEnd - ( *pbMemoBuf ) >= 1 ) - { hb_itemPutNI( pItem, ( unsigned char ) *( *pbMemoBuf )++ ); - } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_UCHAR1: if( bBufEnd - ( *pbMemoBuf ) >= 2 ) @@ -2187,9 +2169,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 2; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_UCHAR2: if( bBufEnd - ( *pbMemoBuf ) >= 3 ) @@ -2201,15 +2181,11 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B hb_itemPutNDLen( pItem, ( unsigned char ) **pbMemoBuf, iLen, iDec ); } else - { hb_itemPutNILen( pItem, ( unsigned char ) **pbMemoBuf, iLen ); - } *pbMemoBuf += 3; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_SHORT: if( bBufEnd - ( *pbMemoBuf ) >= 2 ) @@ -2218,9 +2194,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 2; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_SHORT1: if( bBufEnd - ( *pbMemoBuf ) >= 3 ) @@ -2230,9 +2204,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 3; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_SHORT2: if( bBufEnd - ( *pbMemoBuf ) >= 4 ) @@ -2244,15 +2216,11 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B hb_itemPutNDLen( pItem, ( HB_SHORT ) HB_GET_LE_UINT16( *pbMemoBuf ), iLen, iDec ); } else - { hb_itemPutNILen( pItem, ( HB_SHORT ) HB_GET_LE_UINT16( *pbMemoBuf ), iLen ); - } *pbMemoBuf += 4; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_USHORT: if( bBufEnd - ( *pbMemoBuf ) >= 2 ) @@ -2261,9 +2229,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 2; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_USHORT1: if( bBufEnd - ( *pbMemoBuf ) >= 3 ) @@ -2273,9 +2239,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 3; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_USHORT2: if( bBufEnd - ( *pbMemoBuf ) >= 4 ) @@ -2287,15 +2251,11 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B hb_itemPutNDLen( pItem, ( HB_USHORT ) HB_GET_LE_UINT16( *pbMemoBuf ), iLen, iDec ); } else - { hb_itemPutNIntLen( pItem, ( HB_USHORT ) HB_GET_LE_UINT16( *pbMemoBuf ), iLen ); - } *pbMemoBuf += 4; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_LONG: if( bBufEnd - ( *pbMemoBuf ) >= 4 ) @@ -2304,9 +2264,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 4; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_LONG1: if( bBufEnd - ( *pbMemoBuf ) >= 5 ) @@ -2316,9 +2274,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 5; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_LONG2: if( bBufEnd - ( *pbMemoBuf ) >= 6 ) @@ -2330,15 +2286,11 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B hb_itemPutNDLen( pItem, ( HB_LONG ) HB_GET_LE_UINT32( *pbMemoBuf ), iLen, iDec ); } else - { hb_itemPutNLLen( pItem, ( HB_LONG ) HB_GET_LE_UINT32( *pbMemoBuf ), iLen ); - } *pbMemoBuf += 6; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_ULONG2: if( bBufEnd - ( *pbMemoBuf ) >= 6 ) @@ -2350,15 +2302,11 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B hb_itemPutNDLen( pItem, ( HB_ULONG ) HB_GET_LE_UINT32( *pbMemoBuf ), iLen, iDec ); } else - { hb_itemPutNIntLen( pItem, ( HB_ULONG ) HB_GET_LE_UINT32( *pbMemoBuf ), iLen ); - } *pbMemoBuf += 6; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_DOUBLE: if( bBufEnd - ( *pbMemoBuf ) >= 8 ) @@ -2367,9 +2315,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 8; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_DOUBLE2: if( bBufEnd - ( *pbMemoBuf ) >= 10 ) @@ -2381,9 +2327,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 10; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_LDOUBLE: if( bBufEnd - ( *pbMemoBuf ) >= 10 ) @@ -2394,9 +2338,7 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B *pbMemoBuf += 10; } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_NUL: hb_itemPutCL( pItem, NULL, 0 ); @@ -2427,14 +2369,10 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B hb_itemPutCL( pItem, pszStr, ulLen ); } else - { errCode = EDBF_CORRUPT; - } } else - { errCode = EDBF_CORRUPT; - } break; case FPTIT_FLEXAR_ARAY: @@ -2456,17 +2394,13 @@ static HB_ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_B } } else - { errCode = EDBF_CORRUPT; - } } else - { errCode = EDBF_CORRUPT; - } break; default: - /* fprintf( stderr, "Uknown FLEX array item: 0x%x = %d\n", usType, usType ); fflush( stderr ); */ + /* fprintf( stderr, "Unknown FLEX array item: 0x%x = %d\n", usType, usType ); fflush( stderr ); */ errCode = EDBF_CORRUPT; hb_itemClear( pItem ); break; @@ -2661,7 +2595,7 @@ static HB_ERRCODE hb_fptGetMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt HB_BYTE * bMemoBuf; FPTBLOCK fptBlock; - HB_TRACE( HB_TR_DEBUG, ( "hb_fptGetMemo(%p, %hu, %p, %p, %lu, %lu, %d)", pArea, uiIndex, pItem, pFile, ulStart, ulCount, iTrans ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fptGetMemo(%p, %hu, %p, %p, %lu, %lu, %d)", ( void * ) pArea, uiIndex, ( void * ) pItem, ( void * ) pFile, ulStart, ulCount, iTrans ) ); if( uiIndex ) { @@ -2824,11 +2758,11 @@ static HB_ERRCODE hb_fptGetMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt case FPTIT_SIX_LOG: case FPTIT_SIX_CHAR: case FPTIT_SIX_ARRAY: -/* +#if 0 case FPTIT_SIX_BLOCK: case FPTIT_SIX_VREF: case FPTIT_SIX_MREF: - */ +#endif bMemoBuf = ( HB_BYTE * ) pBuffer; errCode = hb_fptReadSixItem( pArea, &bMemoBuf, bMemoBuf + ulSize, pItem, iTrans ); break; @@ -2929,7 +2863,7 @@ static HB_ERRCODE hb_fptWriteMemo( FPTAREAP pArea, HB_ULONG ulBlock, HB_ULONG ul HB_BOOL bWrite; HB_TRACE( HB_TR_DEBUG, ( "hb_fptWriteMemo(%p, %lu, %lu, %p, %p, %lu, %lu, %p)", - pArea, ulBlock, ulSize, bBufPtr, pFile, ulType, ulLen, pulStoredBlock ) ); + ( void * ) pArea, ulBlock, ulSize, ( const void * ) bBufPtr, ( void * ) pFile, ulType, ulLen, ( void * ) pulStoredBlock ) ); bWrite = ( ulLen != 0 || ( pArea->bMemoType == DB_MEMO_FPT && ulType != FPTIT_TEXT && ulType != FPTIT_BINARY && diff --git a/src/rdd/dbfnsx/dbfnsx1.c b/src/rdd/dbfnsx/dbfnsx1.c index 6b1c453267..bf7ad7da55 100644 --- a/src/rdd/dbfnsx/dbfnsx1.c +++ b/src/rdd/dbfnsx/dbfnsx1.c @@ -226,7 +226,7 @@ static HB_USHORT hb_nsxLeafGetKey( LPTAGINFO pTag, LPPAGEINFO pPage, HB_USHORT u HB_UCHAR * bPrevValue, HB_ULONG * pulRecNo ) { HB_UCHAR * ptr = ( HB_UCHAR * ) hb_nsxPageBuffer( pPage ); - HB_UCHAR ucRecLen = hb_nsxGetKeyRecSizePtr( ptr ), ucSize, ucDupCount; + HB_UCHAR ucRecLen = hb_nsxGetKeyRecSizePtr( ptr ), ucSize; #ifndef HB_NSX_NO_CORRUPT_PROTECT /* protection against corrupted NSX files */ @@ -259,6 +259,7 @@ static HB_USHORT hb_nsxLeafGetKey( LPTAGINFO pTag, LPPAGEINFO pPage, HB_USHORT u if( ucSize != ucRecLen + 1 ) /* key value is not fully duplicated */ { HB_UCHAR len = ( HB_UCHAR ) pTag->KeyLength; + HB_UCHAR ucDupCount; /* ucSize = 0 is a special case when RecLen is 4 and KeySize is 250 * in such case ucSize - ( ucRecLen + 2 ) gives 250 = NSX_MAXKEYLEN @@ -478,11 +479,11 @@ static HB_ERRCODE hb_nsxErrorRT( NSXAREAP pArea, const char * szFileName, HB_ERRCODE errOsCode, HB_USHORT uiFlags, PHB_ITEM * pErrorPtr ) { - PHB_ITEM pError; HB_ERRCODE iRet = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { + PHB_ITEM pError; if( pErrorPtr ) { if( ! *pErrorPtr ) @@ -1319,10 +1320,11 @@ static HB_ULONG hb_nsxTagRootBlock( LPTAGINFO pTag ) static void hb_nsxFreePageBuffer( LPNSXINDEX pIndex ) { HB_ULONG ul, ulMax = pIndex->ulPagesDepth; - LPPAGEINFO * pPagePtr = pIndex->pages; if( ulMax ) { + LPPAGEINFO * pPagePtr = pIndex->pages; + for( ul = 0; ul < ulMax; ul++, pPagePtr++ ) { if( *pPagePtr ) @@ -1745,7 +1747,7 @@ static void hb_nsxTagFree( LPTAGINFO pTag ) } /* - * delete tag from compund index + * delete tag from compound index */ static void hb_nsxTagDelete( LPTAGINFO pTag ) { @@ -1771,7 +1773,7 @@ static void hb_nsxTagDelete( LPTAGINFO pTag ) } /* - * add tag to compund index + * add tag to compound index */ static HB_ERRCODE hb_nsxTagAdd( LPNSXINDEX pIndex, LPTAGINFO pTag ) { @@ -2035,7 +2037,6 @@ static HB_ERRCODE hb_nsxIndexHeaderSave( LPNSXINDEX pIndex ) */ static HB_ERRCODE hb_nsxIndexLoad( LPNSXINDEX pIndex ) { - LPTAGINFO pTag; HB_BYTE signature; if( ! pIndex->fValidHeader ) @@ -2057,7 +2058,6 @@ static HB_ERRCODE hb_nsxIndexLoad( LPNSXINDEX pIndex ) NSXTAGHEADER tagbuffer; int iTags = HB_GET_LE_UINT16( pIndex->HeaderBuff.TagCount ); LPNSXTAGITEM pTagItem = pIndex->HeaderBuff.TagList; - HB_ULONG ulBlock; if( iTags > NSX_MAXTAGS ) return HB_FAILURE; @@ -2069,7 +2069,8 @@ static HB_ERRCODE hb_nsxIndexLoad( LPNSXINDEX pIndex ) for( pIndex->iTags = 0; pIndex->iTags < iTags; pTagItem++ ) { - ulBlock = HB_GET_LE_UINT32( pTagItem->TagOffset ); + HB_ULONG ulBlock = HB_GET_LE_UINT32( pTagItem->TagOffset ); + LPTAGINFO pTag; if( ulBlock == 0 || pTagItem->TagName[ 0 ] <= 0x20 ) return HB_FAILURE; if( ! hb_nsxBlockRead( pIndex, ulBlock, @@ -2602,12 +2603,13 @@ static HB_BOOL hb_nsxTagBottomKey( LPTAGINFO pTag ) static HB_BOOL hb_nsxTagNextKey( LPTAGINFO pTag ) { int iLevel = pTag->stackLevel - 1; - LPPAGEINFO pPage; - HB_ULONG ulPage; - HB_BOOL fFound; if( iLevel >= 0 ) { + LPPAGEINFO pPage; + HB_ULONG ulPage; + HB_BOOL fFound; + pPage = hb_nsxPageLoad( pTag, pTag->stack[ iLevel ].page ); if( ! pPage ) return HB_FALSE; @@ -2660,12 +2662,13 @@ static HB_BOOL hb_nsxTagNextKey( LPTAGINFO pTag ) static HB_BOOL hb_nsxTagPrevKey( LPTAGINFO pTag ) { int iLevel = pTag->stackLevel - 1; - LPPAGEINFO pPage; - HB_ULONG ulPage; - HB_BOOL fFound; if( iLevel >= 0 ) { + LPPAGEINFO pPage; + HB_ULONG ulPage; + HB_BOOL fFound; + pPage = hb_nsxPageLoad( pTag, pTag->stack[ iLevel ].page ); if( ! pPage ) return HB_FALSE; @@ -3133,10 +3136,12 @@ static HB_BOOL hb_nsxTagInsertKey( LPTAGINFO pTag, LPPAGEINFO pPage, if( pNewKey ) { - int iLevel = pTag->stackLevel - 1, iKey; + int iLevel = pTag->stackLevel - 1; while( --iLevel >= 0 && pNewKey ) { + int iKey; + hb_nsxPageRelease( pTag, pPage ); pPage = hb_nsxPageLoad( pTag, pTag->stack[ iLevel ].page ); if( ! pPage ) @@ -3193,12 +3198,11 @@ static HB_BOOL hb_nsxTagInsertKey( LPTAGINFO pTag, LPPAGEINFO pPage, } /* - * add key to the index at the curret page path + * add key to the index at the current page path */ static HB_BOOL hb_nsxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey ) { LPPAGEINFO pPage; - HB_ULONG ulPage; HB_BOOL fFound, fBottom = HB_FALSE; if( pTag->UniqueKey ) @@ -3233,6 +3237,8 @@ static HB_BOOL hb_nsxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey ) return HB_FALSE; if( fBottom && ! hb_nsxIsLeaf( pPage ) ) { + HB_ULONG ulPage; + ulPage = pTag->stack[ pTag->stackLevel - 1 ].ikey == 0 ? hb_nsxGetLowerPage( pPage ) : hb_nsxGetKeyPage( pPage, pTag->KeyLength, pTag->stack[ pTag->stackLevel - 1 ].ikey - 1 ); @@ -3252,7 +3258,7 @@ static HB_BOOL hb_nsxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey ) */ static void hb_nsxPageLeafKeyDel( LPTAGINFO pTag, LPPAGEINFO pPage, HB_USHORT uiKey ) { - HB_UCHAR pKeyVal[ NSX_MAXKEYLEN ], pKeyVal2[ NSX_MAXKEYLEN ], * pPrevVal = NULL; + HB_UCHAR pKeyVal[ NSX_MAXKEYLEN ], pKeyVal2[ NSX_MAXKEYLEN ]; HB_ULONG ulRecNo; HB_USHORT uiOffset = NSX_LEAFKEYOFFSET, u; HB_BOOL fPrev; @@ -3269,6 +3275,8 @@ static void hb_nsxPageLeafKeyDel( LPTAGINFO pTag, LPPAGEINFO pPage, HB_USHORT ui } if( --pPage->uiKeys > uiKey ) { + HB_UCHAR * pPrevVal = NULL; + /* save previous key value */ if( fPrev || uiKey ) { @@ -3299,12 +3307,12 @@ static void hb_nsxPageLeafKeyDel( LPTAGINFO pTag, LPPAGEINFO pPage, HB_USHORT ui } /* - * del key at the curret page path from the index + * del key at the current page path from the index */ static HB_BOOL hb_nsxTagKeyDel( LPTAGINFO pTag, LPKEYINFO pKey ) { - int iLevel, iKey, iBaseLevel, iBaseKey; - LPPAGEINFO pBasePage, pPage; + int iLevel, iKey; + LPPAGEINFO pPage; HB_ULONG ulPage, ulRecNo; HB_BOOL fResult = HB_TRUE; @@ -3324,6 +3332,9 @@ static HB_BOOL hb_nsxTagKeyDel( LPTAGINFO pTag, LPKEYINFO pKey ) if( ! hb_nsxIsLeaf( pPage ) ) { + int iBaseLevel, iBaseKey; + LPPAGEINFO pBasePage; + pBasePage = pPage; iBaseKey = iKey - 1; /* iBaseKey >= 0 */ iBaseLevel = iLevel; @@ -3472,7 +3483,7 @@ static void hb_nsxTagSkipFilter( LPTAGINFO pTag, HB_BOOL fForward ) } /* - * go to the first visiable record in Tag + * go to the first visible record in Tag */ static void hb_nsxTagGoTop( LPTAGINFO pTag ) { @@ -3495,7 +3506,7 @@ static void hb_nsxTagGoTop( LPTAGINFO pTag ) } /* - * go to the last visiable record in Tag + * go to the last visible record in Tag */ static void hb_nsxTagGoBottom( LPTAGINFO pTag ) { @@ -3593,12 +3604,13 @@ static HB_ULONG hb_nsxPageCountKeys( LPTAGINFO pTag, HB_ULONG ulPage ) */ static double hb_nsxTagCountRelKeyPos( LPTAGINFO pTag ) { - int iLevel = pTag->stackLevel, iKeys, iKey; + int iLevel = pTag->stackLevel; double dPos = 1.0; while( --iLevel >= 0 ) { LPPAGEINFO pPage = hb_nsxPageLoad( pTag, pTag->stack[ iLevel ].page ); + int iKeys, iKey; if( ! pPage ) break; iKey = pTag->stack[ iLevel ].ikey; @@ -3865,8 +3877,7 @@ static void hb_nsxCreateFName( NSXAREAP pArea, const char * szBagName, HB_BOOL * static LPNSXINDEX hb_nsxFindBag( NSXAREAP pArea, const char * szBagName ) { LPNSXINDEX pIndex; - PHB_FNAME pSeek, pName; - HB_BOOL fFound; + PHB_FNAME pSeek; pSeek = hb_fsFNameSplit( szBagName ); if( ! pSeek->szName ) @@ -3875,7 +3886,8 @@ static LPNSXINDEX hb_nsxFindBag( NSXAREAP pArea, const char * szBagName ) pIndex = pArea->lpIndexes; while( pIndex ) { - pName = hb_fsFNameSplit( pIndex->IndexName ); + HB_BOOL fFound; + PHB_FNAME pName = hb_fsFNameSplit( pIndex->IndexName ); if( ! pName->szName ) pName->szName = ""; fFound = ! hb_stricmp( pName->szName, pSeek->szName ) && @@ -4103,13 +4115,13 @@ static HB_ULONG hb_nsxOrdKeyNo( LPTAGINFO pTag ) } else { - int iLevel = pTag->stackLevel, iKey; + int iLevel = pTag->stackLevel; HB_BOOL fBack = pTag->fUsrDescend, fFirst = HB_TRUE; - LPPAGEINFO pPage; while( --iLevel >= 0 ) { - pPage = hb_nsxPageLoad( pTag, pTag->stack[ iLevel ].page ); + LPPAGEINFO pPage = hb_nsxPageLoad( pTag, pTag->stack[ iLevel ].page ); + int iKey; if( ! pPage ) break; iKey = pTag->stack[ iLevel ].ikey; @@ -4174,7 +4186,7 @@ static HB_BOOL hb_nsxOrdKeyGoto( LPTAGINFO pTag, HB_ULONG ulKeyNo ) } else { - int iLevel = pTag->stackLevel - 1, iKey; + int iLevel = pTag->stackLevel - 1; HB_BOOL fBack = pTag->fUsrDescend, fFirst = HB_TRUE; LPPAGEINFO pPage; HB_ULONG ulPage; @@ -4182,7 +4194,7 @@ static HB_BOOL hb_nsxOrdKeyGoto( LPTAGINFO pTag, HB_ULONG ulKeyNo ) --ulKeyNo; while( ulKeyNo != 0 && iLevel >= 0 ) { - iKey = pTag->stack[ iLevel ].ikey; + int iKey = pTag->stack[ iLevel ].ikey; pPage = hb_nsxPageLoad( pTag, pTag->stack[ iLevel ].page ); if( ! pPage ) break; @@ -4450,7 +4462,6 @@ static void hb_nsxOrdSetRelKeyPos( LPTAGINFO pTag, double dPos ) static HB_BOOL hb_nsxOrdSkipUnique( LPTAGINFO pTag, HB_LONG lToSkip ) { NSXAREAP pArea = pTag->pIndex->pArea; - HB_BOOL fOut = HB_FALSE, fEof = HB_FALSE, fForward = ( lToSkip >= 0 ); if( pArea->dbfarea.lpdbPendingRel ) SELF_FORCEREL( &pArea->dbfarea.area ); @@ -4459,6 +4470,8 @@ static HB_BOOL hb_nsxOrdSkipUnique( LPTAGINFO pTag, HB_LONG lToSkip ) if( hb_nsxTagLockRead( pTag ) ) { + HB_BOOL fOut = HB_FALSE, fEof = HB_FALSE, fForward = ( lToSkip >= 0 ); + LPTAGINFO pSavedTag = pArea->lpCurTag; pArea->lpCurTag = pTag; @@ -4530,7 +4543,7 @@ static HB_BOOL hb_nsxOrdSkipEval( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pEv NSXAREAP pArea = pTag->pIndex->pArea; HB_BOOL fFound = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrdSkipEval(%p, %d, %p)", pTag, fForward, pEval ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrdSkipEval(%p, %d, %p)", ( void * ) pTag, fForward, ( void * ) pEval ) ); if( ( hb_itemType( pEval ) & HB_IT_BLOCK ) == 0 ) { @@ -4611,7 +4624,7 @@ static HB_BOOL hb_nsxOrdSkipWild( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pWi HB_BOOL fFound = HB_FALSE; int iFixed = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrdSkipWild(%p, %d, %p)", pTag, fForward, pWildItm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrdSkipWild(%p, %d, %p)", ( void * ) pTag, fForward, ( void * ) pWildItm ) ); szPattern = hb_itemGetCPtr( pWildItm ); @@ -4751,7 +4764,7 @@ static HB_BOOL hb_nsxOrdSkipRegEx( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pR HB_BOOL fFound = HB_FALSE; PHB_REGEX pRegEx; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrdSkipRegEx(%p, %d, %p)", pTag, fForward, pRegExItm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrdSkipRegEx(%p, %d, %p)", ( void * ) pTag, fForward, ( void * ) pRegExItm ) ); if( pTag->KeyType != 'C' || ( pRegEx = hb_regexGet( pRegExItm, 0 ) ) == NULL ) { @@ -5284,24 +5297,32 @@ static void hb_nsxSortGetPageKey( LPNSXSORTINFO pSort, HB_ULONG ulPage, static void hb_nsxSortOrderPages( LPNSXSORTINFO pSort ) { - int iLen = pSort->keyLen, i; - HB_LONG l, r, m; - HB_ULONG n, ulPage, ulRec; - HB_UCHAR *pKey = NULL, *pTmp; - pSort->ulFirst = 0; pSort->pSortedPages = ( HB_ULONG * ) hb_xgrab( pSort->ulPages * sizeof( HB_ULONG ) ); pSort->pSortedPages[ 0 ] = 0; if( pSort->ulTotKeys > 0 ) { + int iLen = pSort->keyLen; + HB_UCHAR *pKey = NULL; + + HB_ULONG n; + for( n = 0; n < pSort->ulPages; n++ ) { + HB_ULONG ulRec; + HB_LONG l, r; + hb_nsxSortGetPageKey( pSort, n, &pKey, &ulRec ); l = 0; r = n - 1; while( l <= r ) { + int i; + HB_ULONG ulPage; + HB_LONG m; + HB_UCHAR * pTmp; + m = ( l + r ) >> 1; ulPage = pSort->pSortedPages[ m ]; pTmp = &pSort->pSwapPage[ ulPage ].pKeyPool[ pSort->pSwapPage[ ulPage ].ulCurKey * ( iLen + 4 ) ]; @@ -5322,17 +5343,15 @@ static void hb_nsxSortOrderPages( LPNSXSORTINFO pSort ) static HB_BOOL hb_nsxSortKeyGet( LPNSXSORTINFO pSort, HB_UCHAR ** pKeyVal, HB_ULONG * pulRec ) { - int iLen = pSort->keyLen, i; - HB_LONG l, r, m; - HB_ULONG ulPage; - - ulPage = pSort->pSortedPages[ pSort->ulFirst ]; + HB_ULONG ulPage = pSort->pSortedPages[ pSort->ulFirst ]; /* check if first page has some keys yet */ if( pSort->pSwapPage[ ulPage ].ulKeys > 0 ) { - HB_UCHAR * pKey, * pTmp; - HB_ULONG ulRec, ulPg; + int iLen = pSort->keyLen; + HB_UCHAR * pKey; + HB_ULONG ulRec; + HB_LONG l, r; /* * last key was taken from this page - we have to resort it. @@ -5348,6 +5367,11 @@ static HB_BOOL hb_nsxSortKeyGet( LPNSXSORTINFO pSort, HB_UCHAR ** pKeyVal, HB_UL r = pSort->ulPages - 1; while( l <= r ) { + int i; + HB_ULONG ulPg; + HB_LONG m; + HB_UCHAR * pTmp; + m = ( l + r ) >> 1; ulPg = pSort->pSortedPages[ m ]; pTmp = &pSort->pSwapPage[ ulPg ].pKeyPool[ pSort->pSwapPage[ ulPg ].ulCurKey * ( iLen + 4 ) ]; @@ -5467,7 +5491,7 @@ static LPNSXSORTINFO hb_nsxSortNew( LPTAGINFO pTag, HB_ULONG ulRecCount ) * The memory necessary to index file is now ~ * ~ (keySize+4+sizeof(NSXSWAPPAGE)) * sqrt(ulRecCount) * 2 * so the maximum is for DBF with 2^32 records and keySize 256 ~ - * ~ 2^17 * 284 ~=~ 37 Mb + * ~ 2^17 * 284 ~=~ 37 MB * this is not a problem for current computers and I do not see * any way to use DBFs with four billions records and indexes with * such long (256 bytes) keys on the old ones - they will be simply @@ -5490,7 +5514,7 @@ static LPNSXSORTINFO hb_nsxSortNew( LPTAGINFO pTag, HB_ULONG ulRecCount ) pSort->ulMaxRec = ulRecCount; pSort->pKeyPool = pBuf; pSort->ulPages = ( ulRecCount + pSort->ulPgKeys - 1 ) / pSort->ulPgKeys; - /* check for overflow on 32 bit machines when number of records is nearly 2^32 */ + /* check for overflow on 32-bit machines when number of records is nearly 2^32 */ if( ! pSort->ulPages ) pSort->ulPages = ulRecCount / pSort->ulPgKeys + 1; pSort->pSwapPage = ( LPNSXSWAPPAGE ) hb_xgrabz( sizeof( NSXSWAPPAGE ) * pSort->ulPages ); @@ -5771,7 +5795,7 @@ static void hb_nsxSortOut( LPNSXSORTINFO pSort ) static HB_ERRCODE hb_nsxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex ) { LPNSXAREA pArea = pTag->pIndex->pArea; - PHB_ITEM pForItem, pWhileItem = NULL, pEvalItem = NULL, pItem = NULL; + PHB_ITEM pWhileItem = NULL, pEvalItem = NULL; HB_ULONG ulRecCount, ulRecNo = pArea->dbfarea.ulRecNo; LPNSXSORTINFO pSort; HB_LONG lStep = 0; @@ -5833,6 +5857,8 @@ static HB_ERRCODE hb_nsxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex ) int iRecBuff = 0, iRecBufSize, iRec; double d; PHB_CODEPAGE cdpTmp = hb_cdpSelect( pArea->dbfarea.area.cdPage ); + PHB_ITEM pItem = NULL; + PHB_ITEM pForItem; pForItem = pTag->pForItem; if( pTag->nField ) @@ -6068,10 +6094,11 @@ static HB_ERRCODE hb_nsxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex ) static HB_ERRCODE hb_nsxReIndex( LPNSXINDEX pIndex ) { HB_ERRCODE errCode = HB_FAILURE; - int i; if( hb_nsxIndexLockWrite( pIndex, HB_FALSE ) ) { + int i; + errCode = HB_SUCCESS; hb_nsxIndexTrunc( pIndex ); @@ -6098,7 +6125,7 @@ static HB_ERRCODE hb_nsxGoBottom( NSXAREAP pArea ) { HB_ERRCODE retval; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxGoBottom(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxGoBottom(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6135,7 +6162,7 @@ static HB_ERRCODE hb_nsxTop( NSXAREAP pArea ) { HB_ERRCODE retval; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxTop(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxTop(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6170,7 +6197,7 @@ static HB_ERRCODE hb_nsxTop( NSXAREAP pArea ) static HB_ERRCODE hb_nsxSeek( NSXAREAP pArea, HB_BOOL fSoftSeek, PHB_ITEM pItem, HB_BOOL fFindLast ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxSeek(%p, %d, %p, %d)", pArea, fSoftSeek, pItem, fFindLast ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxSeek(%p, %d, %p, %d)", ( void * ) pArea, fSoftSeek, ( void * ) pItem, fFindLast ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6262,7 +6289,7 @@ static HB_ERRCODE hb_nsxSkipRaw( NSXAREAP pArea, HB_LONG lToSkip ) HB_ERRCODE retval; HB_BOOL fOut = HB_FALSE, fForward; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxSkipRaw(%p, %ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxSkipRaw(%p, %ld)", ( void * ) pArea, lToSkip ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6332,7 +6359,7 @@ static HB_ERRCODE hb_nsxFlush( NSXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxFlush(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxFlush(%p)", ( void * ) pArea ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode == HB_SUCCESS ) @@ -6365,7 +6392,7 @@ static HB_ERRCODE hb_nsxGoCold( NSXAREAP pArea ) HB_BOOL fRecordChanged = pArea->dbfarea.fRecordChanged; HB_BOOL fAppend = pArea->dbfarea.fAppend; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxGoCold(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxGoCold(%p)", ( void * ) pArea ) ); if( SUPER_GOCOLD( &pArea->dbfarea.area ) == HB_SUCCESS ) { @@ -6494,7 +6521,7 @@ static HB_ERRCODE hb_nsxGoHot( NSXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxGoHot(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxGoHot(%p)", ( void * ) pArea ) ); errCode = SUPER_GOHOT( &pArea->dbfarea.area ); if( errCode == HB_SUCCESS ) @@ -6535,7 +6562,7 @@ static HB_ERRCODE hb_nsxClose( NSXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxClose(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6569,7 +6596,7 @@ static HB_ERRCODE hb_nsxClose( NSXAREAP pArea ) */ static HB_ERRCODE hb_nsxStructSize( NSXAREAP pArea, HB_USHORT * uiSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxStructSize(%p, %p)", pArea, uiSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxStructSize(%p, %p)", ( void * ) pArea, ( void * ) uiSize ) ); HB_SYMBOL_UNUSED( pArea ); *uiSize = sizeof( NSXAREA ); @@ -6583,7 +6610,7 @@ static HB_ERRCODE hb_nsxOpen( NSXAREAP pArea, LPDBOPENINFO pOpenInfo ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOpen(%p, %p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOpen(%p, %p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); if( ! pArea->dbfarea.bLockType ) { @@ -6644,7 +6671,7 @@ static HB_ERRCODE hb_nsxPack( NSXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxPack(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxPack(%p)", ( void * ) pArea ) ); errCode = SUPER_PACK( &pArea->dbfarea.area ); if( errCode == HB_SUCCESS ) @@ -6657,7 +6684,7 @@ static HB_ERRCODE hb_nsxZap( NSXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxZap(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxZap(%p)", ( void * ) pArea ) ); errCode = SUPER_ZAP( &pArea->dbfarea.area ); if( errCode == HB_SUCCESS ) @@ -6670,8 +6697,7 @@ static HB_ERRCODE hb_nsxOrderCreate( NSXAREAP pArea, LPDBORDERCREATEINFO pOrderI { PHB_ITEM pResult, pKeyExp, pForExp = NULL; int iLen, iTag; - char szFileName[ HB_PATH_MAX ], szSpFile[ HB_PATH_MAX ], - szTagName[ NSX_TAGNAME + 1 ]; + char szFileName[ HB_PATH_MAX ], szTagName[ NSX_TAGNAME + 1 ]; const char * szKey, * szFor = NULL; LPNSXINDEX pIndex, * pIndexPtr; LPTAGINFO pTag = NULL; @@ -6681,7 +6707,7 @@ static HB_ERRCODE hb_nsxOrderCreate( NSXAREAP pArea, LPDBORDERCREATEINFO pOrderI fTemporary = HB_FALSE, fExclusive = HB_FALSE; HB_BYTE bType, bTrail; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderCreate(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderCreate(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode != HB_SUCCESS ) @@ -6854,6 +6880,7 @@ static HB_ERRCODE hb_nsxOrderCreate( NSXAREAP pArea, LPDBORDERCREATEINFO pOrderI PHB_FILE pFile; HB_BOOL bRetry, fShared = pArea->dbfarea.fShared && ! fTemporary && ! fExclusive; PHB_ITEM pError = NULL; + char szSpFile[ HB_PATH_MAX ]; do { @@ -7006,7 +7033,7 @@ static HB_ERRCODE hb_nsxOrderCreate( NSXAREAP pArea, LPDBORDERCREATEINFO pOrderI while( *pIndexPtr && *pIndexPtr != pIndex ) pIndexPtr = &( *pIndexPtr )->pNext; - /* It should not happen, reintrance? */ + /* It should not happen, reentrance? */ if( ! *pIndexPtr ) return HB_FAILURE; @@ -7045,7 +7072,7 @@ static HB_ERRCODE hb_nsxOrderDestroy( NSXAREAP pArea, LPDBORDERINFO pOrderInfo ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderDestroy(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderDestroy(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode != HB_SUCCESS ) @@ -7064,12 +7091,12 @@ static HB_ERRCODE hb_nsxOrderDestroy( NSXAREAP pArea, LPDBORDERINFO pOrderInfo ) if( pTag ) { - LPNSXINDEX pIndex = pTag->pIndex, * pIndexPtr; + LPNSXINDEX pIndex = pTag->pIndex; if( pIndex->iTags == 1 ) { HB_BOOL fProd = pIndex->Production; - pIndexPtr = &pArea->lpIndexes; + LPNSXINDEX * pIndexPtr = &pArea->lpIndexes; while( *pIndexPtr != pIndex ) pIndexPtr = &( *pIndexPtr )->pNext; *pIndexPtr = pIndex->pNext; @@ -7114,7 +7141,7 @@ static HB_ERRCODE hb_nsxOrderInfo( NSXAREAP pArea, HB_USHORT uiIndex, LPDBORDERI { LPTAGINFO pTag; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderInfo(%p, %hu, %p)", pArea, uiIndex, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderInfo(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pInfo ) ); switch( uiIndex ) { @@ -7781,7 +7808,7 @@ static HB_ERRCODE hb_nsxOrderInfo( NSXAREAP pArea, HB_USHORT uiIndex, LPDBORDERI static HB_ERRCODE hb_nsxCountScope( NSXAREAP pArea, void * pPtr, HB_LONG * plRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxCountScope(%p, %p, %p)", pArea, pPtr, plRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxCountScope(%p, %p, %p)", ( void * ) pArea, pPtr, ( void * ) plRecNo ) ); if( pPtr == NULL ) return HB_SUCCESS; @@ -7793,11 +7820,11 @@ static HB_ERRCODE hb_nsxOrderListAdd( NSXAREAP pArea, LPDBORDERINFO pOrderInfo ) { PHB_FILE pFile; char szFileName[ HB_PATH_MAX ]; - LPNSXINDEX pIndex, * pIndexPtr; + LPNSXINDEX pIndex; HB_ERRCODE errCode; - HB_BOOL fRetry, fReadonly, fShared, fProd; + HB_BOOL fProd; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListAdd(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListAdd(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode != HB_SUCCESS ) @@ -7814,6 +7841,9 @@ static HB_ERRCODE hb_nsxOrderListAdd( NSXAREAP pArea, LPDBORDERINFO pOrderInfo ) if( ! pIndex ) { PHB_ITEM pError = NULL; + LPNSXINDEX * pIndexPtr; + HB_BOOL fRetry, fReadonly, fShared; + fReadonly = pArea->dbfarea.fReadonly; fShared = pArea->dbfarea.fShared; do @@ -7880,7 +7910,7 @@ static HB_ERRCODE hb_nsxOrderListClear( NSXAREAP pArea ) { LPNSXINDEX * pIndexPtr, pIndex; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListClear(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListClear(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7908,10 +7938,10 @@ static HB_ERRCODE hb_nsxOrderListDelete( NSXAREAP pArea, LPDBORDERINFO pOrderInf { char szTagName[ NSX_TAGNAME + 1 ]; char szFileName[ HB_PATH_MAX ]; - LPNSXINDEX pIndex, * pIndexPtr; + LPNSXINDEX pIndex; HB_BOOL fProd; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListDelete(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListDelete(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7924,7 +7954,7 @@ static HB_ERRCODE hb_nsxOrderListDelete( NSXAREAP pArea, LPDBORDERINFO pOrderInf ( DBFAREA_DATA( &pArea->dbfarea )->fStrictStruct ? pArea->dbfarea.fHasTags : hb_setGetAutOpen() ) ) ) { - pIndexPtr = &pArea->lpIndexes; + LPNSXINDEX * pIndexPtr = &pArea->lpIndexes; while( *pIndexPtr ) { if( pIndex == *pIndexPtr ) @@ -7941,7 +7971,7 @@ static HB_ERRCODE hb_nsxOrderListDelete( NSXAREAP pArea, LPDBORDERINFO pOrderInf static HB_ERRCODE hb_nsxOrderListFocus( NSXAREAP pArea, LPDBORDERINFO pOrderInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListFocus(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListFocus(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); pOrderInfo->itmResult = hb_itemPutC( pOrderInfo->itmResult, pArea->lpCurTag ? pArea->lpCurTag->TagName : NULL ); @@ -7976,7 +8006,7 @@ static HB_ERRCODE hb_nsxOrderListRebuild( NSXAREAP pArea ) LPNSXINDEX pIndex; HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListRebuild(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxOrderListRebuild(%p)", ( void * ) pArea ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode != HB_SUCCESS ) @@ -8019,7 +8049,7 @@ static HB_ERRCODE hb_nsxRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulC { LPDBFDATA pData; - HB_TRACE( HB_TR_DEBUG, ( "hb_nsxRddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnect, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_nsxRddInfo(%p, %hu, %lu, %p)", ( void * ) pRDD, uiIndex, ulConnect, ( void * ) pItem ) ); pData = DBFNODE_DATA( pRDD ); diff --git a/src/rdd/dbfntx/dbfntx1.c b/src/rdd/dbfntx/dbfntx1.c index 8106a8af18..c3c9a6ae26 100644 --- a/src/rdd/dbfntx/dbfntx1.c +++ b/src/rdd/dbfntx/dbfntx1.c @@ -259,11 +259,11 @@ static HB_ERRCODE hb_ntxErrorRT( NTXAREAP pArea, const char * szFileName, HB_ERRCODE errOsCode, HB_USHORT uiFlags, PHB_ITEM * pErrorPtr ) { - PHB_ITEM pError; HB_ERRCODE iRet = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { + PHB_ITEM pError; if( pErrorPtr ) { if( ! *pErrorPtr ) @@ -324,7 +324,6 @@ static PHB_ITEM hb_ntxStrToNum( PHB_ITEM pItem, const char * szKeyVal, HB_USHORT { char szBuffer[ NTX_MAX_KEY + 1 ]; const char * ptr = szKeyVal; - char * ptr2, c; int iLen, iDec; HB_MAXINT lValue; double dValue; @@ -333,6 +332,7 @@ static PHB_ITEM hb_ntxStrToNum( PHB_ITEM pItem, const char * szKeyVal, HB_USHORT if( *ptr == '0' - 4 ) /* negative number */ { + char * ptr2, c; ptr2 = szBuffer; while( ( c = *ptr++ ) != 0 ) { @@ -1074,10 +1074,11 @@ static HB_BOOL hb_ntxTagHeaderCheck( LPTAGINFO pTag ) static void hb_ntxFreePageBuffer( LPNTXINDEX pIndex ) { HB_ULONG ul, ulMax = pIndex->ulPagesDepth; - LPPAGEINFO * pPagePtr = pIndex->pages; if( ulMax ) { + LPPAGEINFO * pPagePtr = pIndex->pages; + for( ul = 0; ul < ulMax; ul++, pPagePtr++ ) { if( *pPagePtr ) @@ -1349,7 +1350,7 @@ static LPPAGEINFO hb_ntxPageNew( LPTAGINFO pTag, HB_BOOL fNull ) /* Handling of a pool of empty pages. Some sources says that this address is in the first 4 bytes of - a page ( http://www.e-bachmann.dk/docs/xbase.htm ). + a page ( https://www.clicketyclick.dk/databases/xbase/format/ ). But as I understood, studying dumps of Clipper ntx'es, address of the next available page is in the address field of a first key item in the page - it is done here now in such a way. @@ -1501,7 +1502,7 @@ static void hb_ntxTagFree( LPTAGINFO pTag ) } /* - * delete tag from compund index + * delete tag from compound index */ static void hb_ntxTagDelete( LPTAGINFO pTag ) { @@ -1527,7 +1528,7 @@ static void hb_ntxTagDelete( LPTAGINFO pTag ) } /* - * add tag to compund index + * add tag to compound index */ static HB_ERRCODE hb_ntxTagAdd( LPNTXINDEX pIndex, LPTAGINFO pTag ) { @@ -1618,7 +1619,7 @@ static LPTAGINFO hb_ntxTagLoad( LPNTXINDEX pIndex, HB_ULONG ulBlock, } else if( ! pIndex->pArea->dbfarea.bLockType ) { - pIndex->pArea->dbfarea.bLockType = usType & NTX_FLAG_EXTLOCK ? + pIndex->pArea->dbfarea.bLockType = ( usType & NTX_FLAG_EXTLOCK ) ? DB_DBFLOCK_CLIPPER2 : DB_DBFLOCK_CLIPPER; } } @@ -1730,7 +1731,7 @@ static HB_ERRCODE hb_ntxTagHeaderSave( LPTAGINFO pTag ) ( pTag->Partial ? NTX_FLAG_PARTIAL | NTX_FLAG_FORITEM : 0 ) | ( pIndex->pArea->dbfarea.bLockType == DB_DBFLOCK_CLIPPER2 ? NTX_FLAG_EXTLOCK : 0 ) | ( pTag->Partial ? NTX_FLAG_PARTIAL | NTX_FLAG_FORITEM : 0 ) | - /* non CLipper flags */ + /* non Clipper flags */ ( pTag->Custom ? NTX_FLAG_CUSTOM : 0 ) | ( pTag->ChgOnly ? NTX_FLAG_CHGONLY : 0 ) | ( pTag->Template ? NTX_FLAG_TEMPLATE : 0 ) | @@ -1882,7 +1883,6 @@ static HB_ERRCODE hb_ntxIndexLoad( LPNTXINDEX pIndex, const char * szTagName ) HB_BYTE tagbuffer[ NTXBLOCKSIZE ]; LPCTXHEADER lpCTX = ( LPCTXHEADER ) pIndex->HeaderBuff; LPCTXTAGITEM pTagItem = lpCTX->tags; - HB_ULONG ulBlock; int iTags; iTags = HB_GET_LE_UINT16( lpCTX->ntags ); @@ -1895,7 +1895,7 @@ static HB_ERRCODE hb_ntxIndexLoad( LPNTXINDEX pIndex, const char * szTagName ) for( pIndex->iTags = 0; pIndex->iTags < iTags; pTagItem++ ) { - ulBlock = HB_GET_LE_UINT32( pTagItem->tag_header ); + HB_ULONG ulBlock = HB_GET_LE_UINT32( pTagItem->tag_header ); if( ulBlock == 0 || pTagItem->tag_name[ 0 ] <= 0x20 ) return HB_FAILURE; if( ! hb_ntxBlockRead( pIndex, ulBlock, tagbuffer, NTXBLOCKSIZE ) ) @@ -2385,11 +2385,12 @@ static HB_BOOL hb_ntxTagBottomKey( LPTAGINFO pTag ) static HB_BOOL hb_ntxTagNextKey( LPTAGINFO pTag ) { int iLevel = pTag->stackLevel - 1; - LPPAGEINFO pPage; - HB_ULONG ulPage = 0; if( iLevel >= 0 ) { + LPPAGEINFO pPage; + HB_ULONG ulPage = 0; + pPage = hb_ntxPageLoad( pTag, pTag->stack[ iLevel ].page ); if( ! pPage ) return HB_FALSE; @@ -2438,11 +2439,12 @@ static HB_BOOL hb_ntxTagNextKey( LPTAGINFO pTag ) static HB_BOOL hb_ntxTagPrevKey( LPTAGINFO pTag ) { int iLevel = pTag->stackLevel - 1; - LPPAGEINFO pPage; - HB_ULONG ulPage; if( iLevel >= 0 ) { + LPPAGEINFO pPage; + HB_ULONG ulPage; + pPage = hb_ntxPageLoad( pTag, pTag->stack[ iLevel ].page ); if( ! pPage ) return HB_FALSE; @@ -2494,11 +2496,13 @@ static int hb_ntxPageKeyFind( LPTAGINFO pTag, LPPAGEINFO pPage, const char * key, HB_SHORT keylen, HB_BOOL fNext, HB_ULONG ulRecNo, HB_BOOL * fStop ) { - int iLast = -1, iBegin = 0, iEnd = pPage->uiKeys - 1, k, i; + int iLast = -1, iBegin = 0, iEnd = pPage->uiKeys - 1; *fStop = HB_FALSE; while( iBegin <= iEnd ) { + int i, k; + i = ( iBegin + iEnd ) >> 1; k = hb_ntxValCompare( pTag, key, keylen, hb_ntxGetKeyVal( pPage, i ), pTag->KeyLength, HB_FALSE ); @@ -2829,7 +2833,7 @@ static void hb_ntxBalancePages( LPTAGINFO pTag, LPPAGEINFO pBasePage, HB_USHORT /* * such situation should not exist even max keys, though it does not cost - * much and I want to be able to call hb_ntxBalancePages in any case for + * much and I want to be able to call hb_ntxBalancePages() in any case for * some advanced balancing */ if( iMove == 0 ) @@ -2904,14 +2908,13 @@ static void hb_ntxBalancePages( LPTAGINFO pTag, LPPAGEINFO pBasePage, HB_USHORT } /* - * add key to the index at the curret page path + * add key to the index at the current page path */ static HB_BOOL hb_ntxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey ) { int iLevel, iKey; LPPAGEINFO pPage = NULL; LPKEYINFO pNewKey = NULL; - HB_ULONG ulPage; HB_BOOL fFound, fBottom = HB_FALSE; if( pTag->UniqueKey ) @@ -2942,6 +2945,7 @@ static HB_BOOL hb_ntxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey ) iLevel = pTag->stackLevel - 1; if( fBottom ) { + HB_ULONG ulPage; pPage = hb_ntxPageLoad( pTag, pTag->stack[ iLevel ].page ); if( ! pPage ) return HB_FALSE; @@ -3076,7 +3080,7 @@ static HB_BOOL hb_ntxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey ) } /* - * del key at the curret page path from the index + * del key at the current page path from the index */ static HB_BOOL hb_ntxTagKeyDel( LPTAGINFO pTag, LPKEYINFO pKey ) { @@ -3240,7 +3244,7 @@ static void hb_ntxTagSkipFilter( LPTAGINFO pTag, HB_BOOL fForward ) } /* - * go to the first visiable record in Tag + * go to the first visible record in Tag */ static void hb_ntxTagGoTop( LPTAGINFO pTag ) { @@ -3263,7 +3267,7 @@ static void hb_ntxTagGoTop( LPTAGINFO pTag ) } /* - * go to the last visiable record in Tag + * go to the last visible record in Tag */ static void hb_ntxTagGoBottom( LPTAGINFO pTag ) { @@ -3360,12 +3364,13 @@ static HB_ULONG hb_ntxPageCountKeys( LPTAGINFO pTag, HB_ULONG ulPage ) */ static double hb_ntxTagCountRelKeyPos( LPTAGINFO pTag ) { - int iLevel = pTag->stackLevel, iKeys; + int iLevel = pTag->stackLevel; double dPos = 1.0; while( --iLevel >= 0 ) { LPPAGEINFO pPage = hb_ntxPageLoad( pTag, pTag->stack[ iLevel ].page ); + int iKeys; if( ! pPage ) break; iKeys = pPage->uiKeys; @@ -3617,8 +3622,7 @@ static void hb_ntxCreateFName( NTXAREAP pArea, const char * szBagName, HB_BOOL * static LPNTXINDEX hb_ntxFindBag( NTXAREAP pArea, const char * szBagName ) { LPNTXINDEX pIndex; - PHB_FNAME pSeek, pName; - HB_BOOL fFound; + PHB_FNAME pSeek; pSeek = hb_fsFNameSplit( szBagName ); if( ! pSeek->szName ) @@ -3627,7 +3631,8 @@ static LPNTXINDEX hb_ntxFindBag( NTXAREAP pArea, const char * szBagName ) pIndex = pArea->lpIndexes; while( pIndex ) { - pName = hb_fsFNameSplit( pIndex->IndexName ); + HB_BOOL fFound; + PHB_FNAME pName = hb_fsFNameSplit( pIndex->IndexName ); if( ! pName->szName ) pName->szName = ""; fFound = ! hb_stricmp( pName->szName, pSeek->szName ) && @@ -3857,12 +3862,11 @@ static HB_ULONG hb_ntxOrdKeyNo( LPTAGINFO pTag ) { int iLevel = pTag->stackLevel, iKey, iFirst = 1; HB_BOOL fBack = pTag->fUsrDescend == pTag->AscendKey; - LPPAGEINFO pPage; HB_ULONG ulPage; while( --iLevel >= 0 ) { - pPage = hb_ntxPageLoad( pTag, pTag->stack[ iLevel ].page ); + LPPAGEINFO pPage = hb_ntxPageLoad( pTag, pTag->stack[ iLevel ].page ); if( ! pPage ) break; if( fBack ) @@ -4094,7 +4098,6 @@ static void hb_ntxOrdSetRelKeyPos( LPTAGINFO pTag, double dPos ) static HB_BOOL hb_ntxOrdSkipUnique( LPTAGINFO pTag, HB_LONG lToSkip ) { NTXAREAP pArea = pTag->pIndex->pArea; - HB_BOOL fOut = HB_FALSE, fEof = HB_FALSE, fForward = ( lToSkip >= 0 ); if( pArea->dbfarea.lpdbPendingRel ) SELF_FORCEREL( &pArea->dbfarea.area ); @@ -4103,6 +4106,8 @@ static HB_BOOL hb_ntxOrdSkipUnique( LPTAGINFO pTag, HB_LONG lToSkip ) if( hb_ntxTagLockRead( pTag ) ) { + HB_BOOL fOut = HB_FALSE, fEof = HB_FALSE, fForward = ( lToSkip >= 0 ); + LPTAGINFO pSavedTag = pArea->lpCurTag; pArea->lpCurTag = pTag; @@ -4173,7 +4178,7 @@ static HB_BOOL hb_ntxOrdSkipEval( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pEv NTXAREAP pArea = pTag->pIndex->pArea; HB_BOOL fFound = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrdSkipEval(%p, %d, %p)", pTag, fForward, pEval ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrdSkipEval(%p, %d, %p)", ( void * ) pTag, fForward, ( void * ) pEval ) ); if( ( hb_itemType( pEval ) & HB_IT_BLOCK ) == 0 ) { @@ -4254,7 +4259,7 @@ static HB_BOOL hb_ntxOrdSkipWild( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pWi HB_BOOL fFound = HB_FALSE; int iFixed = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrdSkipWild(%p, %d, %p)", pTag, fForward, pWildItm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrdSkipWild(%p, %d, %p)", ( void * ) pTag, fForward, ( void * ) pWildItm ) ); szPattern = hb_itemGetCPtr( pWildItm ); @@ -4394,7 +4399,7 @@ static HB_BOOL hb_ntxOrdSkipRegEx( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pR HB_BOOL fFound = HB_FALSE; PHB_REGEX pRegEx; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrdSkipRegEx(%p, %d, %p)", pTag, fForward, pRegExItm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrdSkipRegEx(%p, %d, %p)", ( void * ) pTag, fForward, ( void * ) pRegExItm ) ); if( pTag->KeyType != 'C' || ( pRegEx = hb_regexGet( pRegExItm, 0 ) ) == NULL ) { @@ -4732,12 +4737,10 @@ static void hb_ntxSortSortPage( LPNTXSORTINFO pSort ) static void hb_ntxSortBufferFlush( LPNTXSORTINFO pSort ) { - HB_SIZE nSize; - if( pSort->ulPagesIO ) { LPNTXINDEX pIndex = pSort->pTag->pIndex; - nSize = ( HB_SIZE ) pSort->ulPagesIO * NTXBLOCKSIZE; + HB_SIZE nSize = ( HB_SIZE ) pSort->ulPagesIO * NTXBLOCKSIZE; if( hb_fileWriteAt( pIndex->DiskFile, pSort->pBuffIO, nSize, hb_ntxFileOffset( pIndex, pSort->ulFirstIO ) ) != nSize ) { @@ -4872,24 +4875,31 @@ static void hb_ntxSortGetPageKey( LPNTXSORTINFO pSort, HB_ULONG ulPage, static void hb_ntxSortOrderPages( LPNTXSORTINFO pSort ) { - int iLen = pSort->keyLen, i; - HB_LONG l, r, m; - HB_ULONG n, ulPage, ulRec; - HB_BYTE * pKey = NULL, * pTmp; - pSort->ulFirst = 0; pSort->pSortedPages = ( HB_ULONG * ) hb_xgrab( pSort->ulPages * sizeof( HB_ULONG ) ); pSort->pSortedPages[ 0 ] = 0; if( pSort->ulTotKeys > 0 ) { + int iLen = pSort->keyLen; + HB_BYTE * pKey = NULL; + HB_ULONG n; + for( n = 0; n < pSort->ulPages; n++ ) { + HB_LONG l, r; + HB_ULONG ulRec; + hb_ntxSortGetPageKey( pSort, n, &pKey, &ulRec ); l = 0; r = n - 1; while( l <= r ) { + int i; + HB_ULONG ulPage; + HB_LONG m; + HB_BYTE * pTmp; + m = ( l + r ) >> 1; ulPage = pSort->pSortedPages[ m ]; pTmp = &pSort->pSwapPage[ ulPage ].pKeyPool[ pSort->pSwapPage[ ulPage ].ulCurKey * ( iLen + 4 ) ]; @@ -4915,17 +4925,15 @@ static void hb_ntxSortOrderPages( LPNTXSORTINFO pSort ) static HB_BOOL hb_ntxSortKeyGet( LPNTXSORTINFO pSort, HB_BYTE ** pKeyVal, HB_ULONG * pulRec ) { - int iLen = pSort->keyLen, i; - HB_LONG l, r, m; - HB_ULONG ulPage; - - ulPage = pSort->pSortedPages[ pSort->ulFirst ]; + HB_ULONG ulPage = pSort->pSortedPages[ pSort->ulFirst ]; /* check if first page has some keys yet */ if( pSort->pSwapPage[ ulPage ].ulKeys > 0 ) { - HB_BYTE * pKey, * pTmp; - HB_ULONG ulRec, ulPg; + int iLen = pSort->keyLen; + HB_BYTE * pKey; + HB_ULONG ulRec; + HB_LONG l, r; /* * last key was taken from this page - we have to resort it. @@ -4941,6 +4949,11 @@ static HB_BOOL hb_ntxSortKeyGet( LPNTXSORTINFO pSort, HB_BYTE ** pKeyVal, HB_ULO r = pSort->ulPages - 1; while( l <= r ) { + int i; + HB_ULONG ulPg; + HB_LONG m; + HB_BYTE * pTmp; + m = ( l + r ) >> 1; ulPg = pSort->pSortedPages[ m ]; pTmp = &pSort->pSwapPage[ ulPg ].pKeyPool[ pSort->pSwapPage[ ulPg ].ulCurKey * ( iLen + 4 ) ]; @@ -5067,7 +5080,7 @@ static LPNTXSORTINFO hb_ntxSortNew( LPTAGINFO pTag, HB_ULONG ulRecCount ) * The memory necessary to index file is now ~ * ~ (keySize+4+sizeof(NTXSWAPPAGE)) * sqrt(ulRecCount) * 2 * so the maximum is for DBF with 2^32 records and keySize 256 ~ - * ~ 2^17 * 284 ~=~ 37 Mb + * ~ 2^17 * 284 ~=~ 37 MB * this is not a problem for current computers and I do not see * any way to use DBFs with four billions records and indexes with * such long (256 bytes) keys on the old ones - they will be simply @@ -5088,7 +5101,7 @@ static LPNTXSORTINFO hb_ntxSortNew( LPTAGINFO pTag, HB_ULONG ulRecCount ) pSort->ulMaxRec = ulRecCount; pSort->pKeyPool = pBuf; pSort->ulPages = ( ulRecCount + pSort->ulPgKeys - 1 ) / pSort->ulPgKeys; - /* check for overflow on 32 bit machines when number of records is nearly 2^32 */ + /* check for overflow on 32-bit machines when number of records is nearly 2^32 */ if( ! pSort->ulPages ) pSort->ulPages = ulRecCount / pSort->ulPgKeys + 1; pSort->pSwapPage = ( LPNTXSWAPPAGE ) hb_xgrabz( sizeof( NTXSWAPPAGE ) * pSort->ulPages ); @@ -5263,12 +5276,12 @@ static void hb_ntxSortOut( LPNTXSORTINFO pSort ) if( fBalance ) { - LPPAGEINFO pPage, pFirst, pLast; + LPPAGEINFO pFirst, pLast; ulPage = pTag->RootBlock; while( ulPage ) { - pPage = hb_ntxPageLoad( pTag, ulPage ); + LPPAGEINFO pPage = hb_ntxPageLoad( pTag, ulPage ); if( ! pPage ) return; ulPage = hb_ntxGetKeyPage( pPage, pPage->uiKeys ); @@ -5306,7 +5319,7 @@ static void hb_ntxSortOut( LPNTXSORTINFO pSort ) static HB_ERRCODE hb_ntxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex ) { LPNTXAREA pArea = pTag->pIndex->pArea; - PHB_ITEM pForItem, pWhileItem = NULL, pEvalItem = NULL, pItem = NULL; + PHB_ITEM pWhileItem = NULL, pEvalItem = NULL; HB_ULONG ulRecCount, ulRecNo = pArea->dbfarea.ulRecNo; LPNTXSORTINFO pSort; HB_LONG lStep = 0; @@ -5355,6 +5368,7 @@ static HB_ERRCODE hb_ntxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex ) char szBuffer[ NTX_MAX_KEY ]; int iRecBuff = 0, iRecBufSize, iRec; PHB_CODEPAGE cdpTmp = hb_cdpSelect( pArea->dbfarea.area.cdPage ); + PHB_ITEM pForItem, pItem = NULL; pForItem = pTag->pForItem; if( pTag->nField ) @@ -5626,7 +5640,7 @@ static HB_ERRCODE hb_ntxGoBottom( NTXAREAP pArea ) { HB_ERRCODE retval; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxGoBottom(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxGoBottom(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -5666,7 +5680,7 @@ static HB_ERRCODE hb_ntxGoTop( NTXAREAP pArea ) { HB_ERRCODE retval; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxGoTop(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxGoTop(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -5701,7 +5715,7 @@ static HB_ERRCODE hb_ntxGoTop( NTXAREAP pArea ) static HB_ERRCODE hb_ntxSeek( NTXAREAP pArea, HB_BOOL fSoftSeek, PHB_ITEM pItem, HB_BOOL fFindLast ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxSeek(%p, %d, %p, %d)", pArea, fSoftSeek, pItem, fFindLast ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxSeek(%p, %d, %p, %d)", ( void * ) pArea, fSoftSeek, ( void * ) pItem, fFindLast ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -5795,7 +5809,7 @@ static HB_ERRCODE hb_ntxSkipRaw( NTXAREAP pArea, HB_LONG lToSkip ) HB_ERRCODE retval; HB_BOOL fOut = HB_FALSE, fForward; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxSkipRaw(%p, %ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxSkipRaw(%p, %ld)", ( void * ) pArea, lToSkip ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -5875,7 +5889,7 @@ static HB_ERRCODE hb_ntxFlush( NTXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxFlush(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxFlush(%p)", ( void * ) pArea ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode == HB_SUCCESS ) @@ -5912,7 +5926,7 @@ static HB_ERRCODE hb_ntxGoCold( NTXAREAP pArea ) HB_BOOL fRecordChanged = pArea->dbfarea.fRecordChanged; HB_BOOL fAppend = pArea->dbfarea.fAppend; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxGoCold(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxGoCold(%p)", ( void * ) pArea ) ); if( SUPER_GOCOLD( &pArea->dbfarea.area ) == HB_SUCCESS ) { @@ -6044,7 +6058,7 @@ static HB_ERRCODE hb_ntxGoHot( NTXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxGoHot(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxGoHot(%p)", ( void * ) pArea ) ); errCode = SUPER_GOHOT( &pArea->dbfarea.area ); if( errCode == HB_SUCCESS ) @@ -6095,7 +6109,7 @@ static HB_ERRCODE hb_ntxClose( NTXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxClose(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -6137,7 +6151,7 @@ static HB_ERRCODE hb_ntxClose( NTXAREAP pArea ) */ static HB_ERRCODE hb_ntxStructSize( NTXAREAP pArea, HB_USHORT * uiSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxStructSize(%p, %p)", pArea, uiSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxStructSize(%p, %p)", ( void * ) pArea, ( void * ) uiSize ) ); HB_SYMBOL_UNUSED( pArea ); *uiSize = sizeof( NTXAREA ); @@ -6151,7 +6165,7 @@ static HB_ERRCODE hb_ntxOpen( NTXAREAP pArea, LPDBOPENINFO pOpenInfo ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOpen(%p, %p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOpen(%p, %p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); errCode = SUPER_OPEN( &pArea->dbfarea.area, pOpenInfo ); @@ -6202,7 +6216,7 @@ static HB_ERRCODE hb_ntxPack( NTXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxPack(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxPack(%p)", ( void * ) pArea ) ); errCode = SUPER_PACK( &pArea->dbfarea.area ); if( errCode == HB_SUCCESS ) @@ -6220,7 +6234,7 @@ static HB_ERRCODE hb_ntxZap( NTXAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxZap(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxZap(%p)", ( void * ) pArea ) ); errCode = SUPER_ZAP( &pArea->dbfarea.area ); if( errCode == HB_SUCCESS ) @@ -6246,8 +6260,7 @@ static HB_ERRCODE hb_ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderI { PHB_ITEM pResult, pKeyExp, pForExp = NULL; int iLen, iDec, iTag, i; - char szFileName[ HB_PATH_MAX ], szSpFile[ HB_PATH_MAX ], - szTagName[ NTX_MAX_TAGNAME + 1 ]; + char szFileName[ HB_PATH_MAX ], szTagName[ NTX_MAX_TAGNAME + 1 ]; const char * szKey, * szFor = NULL; LPNTXINDEX pIndex, * pIndexPtr; LPTAGINFO pTag = NULL; @@ -6259,7 +6272,7 @@ static HB_ERRCODE hb_ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderI fExclusive = HB_FALSE; HB_BYTE bType; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderCreate(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderCreate(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode != HB_SUCCESS ) @@ -6462,6 +6475,7 @@ static HB_ERRCODE hb_ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderI PHB_FILE pFile; HB_BOOL bRetry, fOld, fShared = pArea->dbfarea.fShared && ! fTemporary && ! fExclusive; PHB_ITEM pError = NULL; + char szSpFile[ HB_PATH_MAX ]; fOld = fCompound; do @@ -6636,7 +6650,7 @@ static HB_ERRCODE hb_ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderI while( *pIndexPtr && *pIndexPtr != pIndex ) pIndexPtr = &( *pIndexPtr )->pNext; - /* It should not happen, reintrance? */ + /* It should not happen, reentrance? */ if( ! *pIndexPtr ) return HB_FAILURE; @@ -6673,7 +6687,7 @@ static HB_ERRCODE hb_ntxOrderDestroy( NTXAREAP pArea, LPDBORDERINFO pOrderInfo ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderDestroy(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderDestroy(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode != HB_SUCCESS ) @@ -6692,12 +6706,12 @@ static HB_ERRCODE hb_ntxOrderDestroy( NTXAREAP pArea, LPDBORDERINFO pOrderInfo ) if( pTag ) { - LPNTXINDEX pIndex = pTag->pIndex, * pIndexPtr; + LPNTXINDEX pIndex = pTag->pIndex; if( pIndex->iTags == 1 ) { HB_BOOL fProd = pIndex->Production; - pIndexPtr = &pArea->lpIndexes; + LPNTXINDEX * pIndexPtr = &pArea->lpIndexes; while( *pIndexPtr != pIndex ) pIndexPtr = &(*pIndexPtr)->pNext; *pIndexPtr = pIndex->pNext; @@ -6743,7 +6757,7 @@ static HB_ERRCODE hb_ntxOrderInfo( NTXAREAP pArea, HB_USHORT uiIndex, LPDBORDERI { LPTAGINFO pTag; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderInfo(%p, %hu, %p)", pArea, uiIndex, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderInfo(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pInfo ) ); switch( uiIndex ) { @@ -7420,11 +7434,11 @@ static HB_ERRCODE hb_ntxOrderListAdd( NTXAREAP pArea, LPDBORDERINFO pOrderInfo ) { PHB_FILE pFile; char szFileName[ HB_PATH_MAX ], szTagName[ NTX_MAX_TAGNAME + 1 ]; - LPNTXINDEX pIndex, *pIndexPtr; + LPNTXINDEX pIndex; HB_ERRCODE errCode; - HB_BOOL fRetry, fReadonly, fShared, fProd; + HB_BOOL fProd; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListAdd(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListAdd(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode != HB_SUCCESS ) @@ -7436,16 +7450,18 @@ static HB_ERRCODE hb_ntxOrderListAdd( NTXAREAP pArea, LPDBORDERINFO pOrderInfo ) hb_ntxCreateFName( pArea, hb_itemGetCPtr( pOrderInfo->atomBagName ), &fProd, szFileName, szTagName ); -/* +#if 0 if( ! szTagName[ 0 ] ) return HB_FAILURE; - */ +#endif pIndex = hb_ntxFindBag( pArea, szFileName ); if( ! pIndex ) { PHB_ITEM pError = NULL; + LPNTXINDEX * pIndexPtr; + HB_BOOL fRetry, fReadonly, fShared; fReadonly = pArea->dbfarea.fReadonly; fShared = pArea->dbfarea.fShared; @@ -7514,7 +7530,7 @@ static HB_ERRCODE hb_ntxOrderListClear( NTXAREAP pArea ) { LPNTXINDEX * pIndexPtr, pIndex; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListClear(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListClear(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7543,10 +7559,10 @@ static HB_ERRCODE hb_ntxOrderListDelete( NTXAREAP pArea, LPDBORDERINFO pOrderInf { char szTagName[ NTX_MAX_TAGNAME + 1 ]; char szFileName[ HB_PATH_MAX ]; - LPNTXINDEX pIndex, * pIndexPtr; + LPNTXINDEX pIndex; HB_BOOL fProd; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListDelete(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListDelete(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( SELF_GOCOLD( &pArea->dbfarea.area ) == HB_FAILURE ) return HB_FAILURE; @@ -7559,7 +7575,7 @@ static HB_ERRCODE hb_ntxOrderListDelete( NTXAREAP pArea, LPDBORDERINFO pOrderInf ( DBFAREA_DATA( &pArea->dbfarea )->fStrictStruct ? pArea->dbfarea.fHasTags : hb_setGetAutOpen() ) ) ) { - pIndexPtr = &pArea->lpIndexes; + LPNTXINDEX * pIndexPtr = &pArea->lpIndexes; while( *pIndexPtr ) { if( pIndex == *pIndexPtr ) @@ -7576,7 +7592,7 @@ static HB_ERRCODE hb_ntxOrderListDelete( NTXAREAP pArea, LPDBORDERINFO pOrderInf static HB_ERRCODE hb_ntxOrderListFocus( NTXAREAP pArea, LPDBORDERINFO pOrderInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListFocus(%p, %p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListFocus(%p, %p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); pOrderInfo->itmResult = hb_itemPutC( pOrderInfo->itmResult, pArea->lpCurTag ? pArea->lpCurTag->TagName : NULL ); @@ -7609,7 +7625,7 @@ static HB_ERRCODE hb_ntxOrderListRebuild( NTXAREAP pArea ) LPNTXINDEX pIndex; HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListRebuild(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxOrderListRebuild(%p)", ( void * ) pArea ) ); errCode = SELF_GOCOLD( &pArea->dbfarea.area ); if( errCode != HB_SUCCESS ) @@ -7654,7 +7670,7 @@ static HB_ERRCODE hb_ntxOrderListRebuild( NTXAREAP pArea ) static HB_ERRCODE hb_ntxCountScope( NTXAREAP pArea, void * pPtr, HB_LONG * plRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxCountScope(%p, %p, %p)", pArea, pPtr, plRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxCountScope(%p, %p, %p)", ( void * ) pArea, pPtr, ( void * ) plRecNo ) ); if( pPtr == NULL ) { @@ -7694,7 +7710,7 @@ static HB_ERRCODE hb_ntxRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulC { LPDBFDATA pData; - HB_TRACE( HB_TR_DEBUG, ( "hb_ntxRddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnect, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_ntxRddInfo(%p, %hu, %lu, %p)", ( void * ) pRDD, uiIndex, ulConnect, ( void * ) pItem ) ); pData = DBFNODE_DATA( pRDD ); diff --git a/src/rdd/dbjoin.prg b/src/rdd/dbjoin.prg index f276f6dd45..1a34064258 100644 --- a/src/rdd/dbjoin.prg +++ b/src/rdd/dbjoin.prg @@ -146,11 +146,12 @@ STATIC FUNCTION __JoinList( nMaster, nDetail, nResult, aStruct ) LOCAL i FOR i := 1 TO Len( aStruct ) - IF ( nPos := ( nMaster )->( FieldPos( aStruct[ i ][ DBS_NAME ] ) ) ) != 0 + DO CASE + CASE ( nPos := ( nMaster )->( FieldPos( aStruct[ i ][ DBS_NAME ] ) ) ) != 0 AAdd( aList, { nResult, nMaster, nPos, i } ) - ELSEIF ( nPos := ( nDetail )->( FieldPos( aStruct[ i ][ DBS_NAME ] ) ) ) != 0 + CASE ( nPos := ( nDetail )->( FieldPos( aStruct[ i ][ DBS_NAME ] ) ) ) != 0 AAdd( aList, { nResult, nDetail, nPos, i } ) - ENDIF + ENDCASE NEXT RETURN aList diff --git a/src/rdd/dblist.prg b/src/rdd/dblist.prg index f176409ab8..839204f3ee 100644 --- a/src/rdd/dblist.prg +++ b/src/rdd/dblist.prg @@ -42,7 +42,7 @@ * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * -*/ + */ /* NOTE: lAll is a dummy parameter, nothing seems to depend on it. [vszakats] */ @@ -59,16 +59,16 @@ PROCEDURE __dbList( lOff, abEval, lAll, bFor, bWhile, nNext, nRecord, lRest, lTo /* Choose the output style */ IF lOff - bOutBlock := {|| QOut( iif( Deleted(), "*", " " ) ),; + bOutBlock := {|| QOut( iif( Deleted(), "*", " " ) ), ; AEval( abEval, {| bEval | QQOut( Eval( bEval ), "" ) } ) } ELSE - bOutBlock := {|| QOut( Str( RecNo(), 7 ), iif( Deleted(), "*", " " ) ),; + bOutBlock := {|| QOut( Str( RecNo(), 7 ), iif( Deleted(), "*", " " ) ), ; AEval( abEval, {| bEval | QQOut( Eval( bEval ), "" ) } ) } ENDIF /* Save SETs */ - IF ! Empty( lToPrint ) + IF ! Empty( lToPrint ) /* => hb_defaultValue( lToPrint, .F. ) */ lOldPrinter := Set( _SET_PRINTER, .T. ) ENDIF IF ! Empty( cToFileName ) @@ -83,12 +83,12 @@ PROCEDURE __dbList( lOff, abEval, lAll, bFor, bWhile, nNext, nRecord, lRest, lTo BEGIN SEQUENCE - IF Empty( lAll ) .AND. ; + IF Empty( lAll ) .AND. ; /* => hb_defaultValue( lAll, .F. ) */ Empty( bFor ) .AND. ; Empty( bWhile ) .AND. ; - Empty( nNext ) .AND. ; - Empty( nRecord ) .AND. ; - Empty( lRest ) + Empty( nNext ) .AND. ; /* => nNext == NIL .OR. nNext == 0 */ + Empty( nRecord ) .AND. ; /* => nRecord == NIL .OR. nRecord == 0 */ + Empty( lRest ) /* => hb_defaultValue( lRest, .F. ) */ Eval( bOutBlock ) ELSE diff --git a/src/rdd/dbrename.c b/src/rdd/dbrename.c index 6c04b35a30..2e67be5ca8 100644 --- a/src/rdd/dbrename.c +++ b/src/rdd/dbrename.c @@ -1,5 +1,5 @@ /* - * dbRename() Harbour extension. + * dbRename() Harbour extension * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #ifndef HB_CLP_STRICT diff --git a/src/rdd/dbsdf.prg b/src/rdd/dbsdf.prg index c95dd99d59..0241117bb0 100644 --- a/src/rdd/dbsdf.prg +++ b/src/rdd/dbsdf.prg @@ -3,7 +3,6 @@ * Appends the contents of an SDF text file to a database. * * Copyright 2001-2002 David G. Holm <dholm@jsd-llc.com> - * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * function __dbSDF() replaced by the new one which uses * SDF RDD I've just created @@ -52,6 +51,6 @@ REQUEST SDF FUNCTION __dbSDF( lExport, cFile, aFields, bFor, bWhile, nNext, nRecord, lRest, cCodePage ) - RETURN iif( lExport,; - __dbCopy( cFile, aFields, bFor, bWhile, nNext, nRecord, lRest, "SDF", , cCodePage ) ,; + RETURN iif( lExport, ; + __dbCopy( cFile, aFields, bFor, bWhile, nNext, nRecord, lRest, "SDF", , cCodePage ), ; __dbApp( cFile, aFields, bFor, bWhile, nNext, nRecord, lRest, "SDF", , cCodePage ) ) diff --git a/src/rdd/dbsort.prg b/src/rdd/dbsort.prg index 6ac21a7ed7..610c9bfdac 100644 --- a/src/rdd/dbsort.prg +++ b/src/rdd/dbsort.prg @@ -47,7 +47,7 @@ /* NOTE: Compared to CA-Cl*pper, Harbour has three extra parameters (cRDD, nConnection, cCodePage). */ -FUNCTION __dbSort( cToFileName, aFields, bFor, bWhile, nNext, nRecord, lRest,; +FUNCTION __dbSort( cToFileName, aFields, bFor, bWhile, nNext, nRecord, lRest, ; cRDD, nConnection, cCodePage ) LOCAL nOldArea diff --git a/src/rdd/dbsql.c b/src/rdd/dbsql.c index fb92e1046d..9820d3fc82 100644 --- a/src/rdd/dbsql.c +++ b/src/rdd/dbsql.c @@ -1,5 +1,5 @@ /* - * + * __dbSQL() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * Copyright 2007 Lorenzo Fiorini <lorenzo.fiorini / at / gmail.com> @@ -150,7 +150,9 @@ static HB_BOOL hb_exportBufSqlVar( PHB_FILEBUF pFileBuf, PHB_ITEM pValue, hb_addToFBuffer( pFileBuf, *szVal ); else { - /* printf( "%d %c", *szVal, *szVal ); */ +#if 0 + printf( "%d %c", *szVal, *szVal ); +#endif } szVal++; } @@ -333,8 +335,10 @@ static HB_ULONG hb_db2Sql( AREAP pArea, PHB_ITEM pFields, HB_MAXINT llNext, hb_destroyFBuffer( pFileBuf ); hb_itemRelease( pTmp ); +#if 0 /* Writing EOF */ - /* hb_fileWrite( pFile, "\x1A", 1, -1 ); */ + hb_fileWrite( pFile, "\x1A", 1, -1 ); +#endif return ulRecords; } diff --git a/src/rdd/dbstrux.prg b/src/rdd/dbstrux.prg index b14cbb5d1a..97cc54a105 100644 --- a/src/rdd/dbstrux.prg +++ b/src/rdd/dbstrux.prg @@ -69,12 +69,12 @@ FUNCTION __dbCopyXStruct( cFileName ) __dbCreate( cFileName, , , .F. ) AEval( aStruct, {| aField | ; - iif( aField[ DBS_TYPE ] == "C" .AND. aField[ DBS_LEN ] > 255,; - ( aField[ DBS_DEC ] := Int( aField[ DBS_LEN ] / 256 ), aField[ DBS_LEN ] := aField[ DBS_LEN ] % 256 ), ),; - dbAppend(),; - FIELD->FIELD_NAME := aField[ DBS_NAME ],; - FIELD->FIELD_TYPE := aField[ DBS_TYPE ],; - FIELD->FIELD_LEN := aField[ DBS_LEN ],; + iif( aField[ DBS_TYPE ] == "C" .AND. aField[ DBS_LEN ] > 255, ; + ( aField[ DBS_DEC ] := Int( aField[ DBS_LEN ] / 256 ), aField[ DBS_LEN ] := aField[ DBS_LEN ] % 256 ), ), ; + dbAppend(), ; + FIELD->FIELD_NAME := aField[ DBS_NAME ], ; + FIELD->FIELD_TYPE := aField[ DBS_TYPE ], ; + FIELD->FIELD_LEN := aField[ DBS_LEN ], ; FIELD->FIELD_DEC := aField[ DBS_DEC ] } ) /* NOTE: CA-Cl*pper has a bug, where only a plain RECOVER statement is @@ -94,7 +94,7 @@ FUNCTION __dbCopyXStruct( cFileName ) RETURN .T. -/* NOTE: Compared to CA-Cl*pper, Harbour has two extra parameters +/* NOTE: Compared to CA-Cl*pper, Harbour: (cCodePage, nConnection). */ FUNCTION __dbCreate( cFileName, cFileFrom, cRDD, lNew, cAlias, cCodePage, nConnection ) @@ -141,9 +141,9 @@ FUNCTION __dbCreate( cFileName, cFileFrom, cRDD, lNew, cAlias, cCodePage, nConne /* Type detection is more in sync with dbCreate() logic in Harbour, as lowercase "C" and padded/continued strings ("C ", "C...") are also accepted. */ - AEval( aStruct, {| aField | iif( hb_LeftEqI( aField[ DBS_TYPE ], "C" ) .AND. aField[ DBS_DEC ] != 0,; - ( aField[ DBS_LEN ] += aField[ DBS_DEC ] * 256,; - aField[ DBS_DEC ] := 0 ), NIL ) } ) + AEval( aStruct, {| aField | iif( hb_LeftEqI( aField[ DBS_TYPE ], "C" ) .AND. aField[ DBS_DEC ] != 0, ; + ( aField[ DBS_LEN ] += aField[ DBS_DEC ] * 256, ; + aField[ DBS_DEC ] := 0 ), NIL ) } ) dbCreate( cFileName, aStruct, cRDD, lNew, cAlias, , cCodePage, nConnection ) @@ -174,8 +174,8 @@ FUNCTION __dbStructFilter( aStruct, aFieldList ) bFindName := {| aField | aField[ DBS_NAME ] == cName } AEval( aFieldList, {| cFieldName, nIndex | ; - cName := RTrim( Upper( cFieldName ) ),; - nIndex := AScan( aStruct, bFindName ),; - iif( nIndex == 0, NIL, AAdd( aStructFiltered, aStruct[ nIndex ] ) ) } ) + cName := RTrim( Upper( cFieldName ) ), ; + nIndex := AScan( aStruct, bFindName ), ; + iif( nIndex == 0, NIL, AAdd( aStructFiltered, aStruct[ nIndex ] ) ) } ) RETURN aStructFiltered diff --git a/src/rdd/dbtotal.prg b/src/rdd/dbtotal.prg index c82920a6d2..5477a5c77a 100644 --- a/src/rdd/dbtotal.prg +++ b/src/rdd/dbtotal.prg @@ -1,5 +1,5 @@ /* - * __DBTOTAL FUNCTION + * __dbTotal() function * * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> * @@ -54,8 +54,8 @@ - won't crash with "No exported method: EVAL" if xKey is not block and table is not indexed. */ -FUNCTION __dbTotal( cFile, xKey, aFields,; - xFor, xWhile, nNext, nRec, lRest,; +FUNCTION __dbTotal( cFile, xKey, aFields, ; + xFor, xWhile, nNext, nRec, lRest, ; cRDD, nConnection, cCodePage ) LOCAL nOldArea @@ -74,23 +74,25 @@ FUNCTION __dbTotal( cFile, xKey, aFields,; LOCAL oError LOCAL lError := .F. - IF HB_ISEVALITEM( xWhile ) + DO CASE + CASE HB_ISEVALITEM( xWhile ) bWhileBlock := xWhile lRest := .T. - ELSEIF HB_ISSTRING( xWhile ) .AND. ! Empty( xWhile ) + CASE HB_ISSTRING( xWhile ) .AND. ! Empty( xWhile ) bWhileBlock := hb_macroBlock( xWhile ) lRest := .T. - ELSE + OTHERWISE bWhileBlock := {|| .T. } - ENDIF + ENDCASE - IF HB_ISEVALITEM( xFor ) + DO CASE + CASE HB_ISEVALITEM( xFor ) bForBlock := xFor - ELSEIF HB_ISSTRING( xFor ) .AND. ! Empty( xFor ) + CASE HB_ISSTRING( xFor ) .AND. ! Empty( xFor ) bForBlock := hb_macroBlock( xFor ) - ELSE + OTHERWISE bForBlock := {|| .T. } - ENDIF + ENDCASE __defaultNIL( @lRest, .F. ) diff --git a/src/rdd/delim1.c b/src/rdd/delim1.c index ebd0623a63..5dfa6a437a 100644 --- a/src/rdd/delim1.c +++ b/src/rdd/delim1.c @@ -67,7 +67,7 @@ static void hb_delimInitArea( DELIMAREAP pArea, char * szFileName ) { const char * szEol; - /* Allocate only after succesfully open file */ + /* Allocate only after successfully open file */ pArea->szFileName = hb_strdup( szFileName ); /* set line separator: EOL */ @@ -172,7 +172,7 @@ static HB_SIZE hb_delimEncodeBuffer( DELIMAREAP pArea ) LPFIELD pField; HB_BYTE * pBuffer; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimEncodeBuffer(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimEncodeBuffer(%p)", ( void * ) pArea ) ); /* mark the read buffer as empty */ pArea->nBufferRead = pArea->nBufferIndex = 0; @@ -333,7 +333,7 @@ static HB_ERRCODE hb_delimReadRecord( DELIMAREAP pArea ) HB_USHORT uiField; int ch = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimReadRecord(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimReadRecord(%p)", ( void * ) pArea ) ); pArea->area.fEof = HB_TRUE; @@ -453,7 +453,7 @@ static HB_ERRCODE hb_delimReadRecord( DELIMAREAP pArea ) static HB_ERRCODE hb_delimNextRecord( DELIMAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimNextRecord(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimNextRecord(%p)", ( void * ) pArea ) ); if( pArea->fPositioned ) { @@ -472,7 +472,7 @@ static HB_ERRCODE hb_delimNextRecord( DELIMAREAP pArea ) */ static HB_ERRCODE hb_delimGoTo( DELIMAREAP pArea, HB_ULONG ulRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoTo(%p, %lu)", pArea, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoTo(%p, %lu)", ( void * ) pArea, ulRecNo ) ); #ifndef HB_CLP_STRICT if( pArea->fReadonly && ulRecNo >= pArea->ulRecNo ) @@ -494,7 +494,7 @@ static HB_ERRCODE hb_delimGoTo( DELIMAREAP pArea, HB_ULONG ulRecNo ) */ static HB_ERRCODE hb_delimGoToId( DELIMAREAP pArea, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoToId(%p, %p)", pArea, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoToId(%p, %p)", ( void * ) pArea, ( void * ) pItem ) ); #ifndef HB_CLP_STRICT if( HB_IS_NUMERIC( pItem ) ) @@ -509,7 +509,7 @@ static HB_ERRCODE hb_delimGoToId( DELIMAREAP pArea, PHB_ITEM pItem ) */ static HB_ERRCODE hb_delimGoTop( DELIMAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoTop(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoTop(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->area ) != HB_SUCCESS ) return HB_FAILURE; @@ -536,7 +536,7 @@ static HB_ERRCODE hb_delimGoTop( DELIMAREAP pArea ) */ static HB_ERRCODE hb_delimSkipRaw( DELIMAREAP pArea, HB_LONG lToSkip ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimSkipRaw(%p,%ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimSkipRaw(%p,%ld)", ( void * ) pArea, lToSkip ) ); if( SELF_GOCOLD( &pArea->area ) != HB_SUCCESS ) return HB_FAILURE; @@ -553,7 +553,7 @@ static HB_ERRCODE hb_delimSkipRaw( DELIMAREAP pArea, HB_LONG lToSkip ) */ static HB_ERRCODE hb_delimDeleted( DELIMAREAP pArea, HB_BOOL * pDeleted ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimDeleted(%p,%p)", pArea, pDeleted ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimDeleted(%p,%p)", ( void * ) pArea, ( void * ) pDeleted ) ); HB_SYMBOL_UNUSED( pArea ); @@ -567,7 +567,7 @@ static HB_ERRCODE hb_delimDeleted( DELIMAREAP pArea, HB_BOOL * pDeleted ) */ static HB_ERRCODE hb_delimRecCount( DELIMAREAP pArea, HB_ULONG * pRecCount ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecCount(%p,%p)", pArea, pRecCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecCount(%p,%p)", ( void * ) pArea, ( void * ) pRecCount ) ); *pRecCount = pArea->ulRecCount; @@ -579,7 +579,7 @@ static HB_ERRCODE hb_delimRecCount( DELIMAREAP pArea, HB_ULONG * pRecCount ) */ static HB_ERRCODE hb_delimRecNo( DELIMAREAP pArea, HB_ULONG * pulRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecNo(%p,%p)", pArea, pulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecNo(%p,%p)", ( void * ) pArea, ( void * ) pulRecNo ) ); *pulRecNo = pArea->ulRecNo; @@ -594,7 +594,7 @@ static HB_ERRCODE hb_delimRecId( DELIMAREAP pArea, PHB_ITEM pRecNo ) HB_ERRCODE errCode; HB_ULONG ulRecNo; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecId(%p,%p)", pArea, pRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecId(%p,%p)", ( void * ) pArea, ( void * ) pRecNo ) ); errCode = SELF_RECNO( &pArea->area, &ulRecNo ); @@ -620,7 +620,7 @@ static HB_ERRCODE hb_delimRecId( DELIMAREAP pArea, PHB_ITEM pRecNo ) */ static HB_ERRCODE hb_delimAppend( DELIMAREAP pArea, HB_BOOL fUnLockAll ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimAppend(%p,%d)", pArea, ( int ) fUnLockAll ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimAppend(%p,%d)", ( void * ) pArea, ( int ) fUnLockAll ) ); HB_SYMBOL_UNUSED( fUnLockAll ); @@ -643,7 +643,7 @@ static HB_ERRCODE hb_delimAppend( DELIMAREAP pArea, HB_BOOL fUnLockAll ) */ static HB_ERRCODE hb_delimDeleteRec( DELIMAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimDeleteRec(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimDeleteRec(%p)", ( void * ) pArea ) ); HB_SYMBOL_UNUSED( pArea ); @@ -666,7 +666,7 @@ static HB_ERRCODE hb_delimDeleteRec( DELIMAREAP pArea ) */ static HB_ERRCODE hb_delimRecall( DELIMAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecall(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecall(%p)", ( void * ) pArea ) ); HB_SYMBOL_UNUSED( pArea ); @@ -680,7 +680,7 @@ static HB_ERRCODE hb_delimGetValue( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITE { LPFIELD pField; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimGetValue(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimGetValue(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( --uiIndex >= pArea->area.uiFieldCount ) return HB_FAILURE; @@ -789,7 +789,7 @@ static HB_ERRCODE hb_delimPutValue( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITE LPFIELD pField; HB_SIZE nSize; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimPutValue(%p,%hu,%p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimPutValue(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( ! pArea->fPositioned ) return HB_SUCCESS; @@ -904,7 +904,7 @@ static HB_ERRCODE hb_delimPutValue( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITE */ static HB_ERRCODE hb_delimPutRec( DELIMAREAP pArea, HB_BYTE * pBuffer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimPutRec(%p,%p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimPutRec(%p,%p)", ( void * ) pArea, ( void * ) pBuffer ) ); if( ! pArea->fPositioned ) return HB_SUCCESS; @@ -923,7 +923,7 @@ static HB_ERRCODE hb_delimPutRec( DELIMAREAP pArea, HB_BYTE * pBuffer ) */ static HB_ERRCODE hb_delimGetRec( DELIMAREAP pArea, HB_BYTE ** pBufferPtr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimGetRec(%p,%p)", pArea, pBufferPtr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimGetRec(%p,%p)", ( void * ) pArea, ( void * ) pBufferPtr ) ); *pBufferPtr = pArea->pRecord - 1; @@ -935,7 +935,7 @@ static HB_ERRCODE hb_delimGetRec( DELIMAREAP pArea, HB_BYTE ** pBufferPtr ) */ static HB_ERRCODE hb_delimTrans( DELIMAREAP pArea, LPDBTRANSINFO pTransInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimTrans(%p, %p)", pArea, pTransInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimTrans(%p, %p)", ( void * ) pArea, ( void * ) pTransInfo ) ); if( pTransInfo->uiFlags & DBTF_MATCH ) { @@ -966,7 +966,7 @@ static HB_ERRCODE hb_delimTrans( DELIMAREAP pArea, LPDBTRANSINFO pTransInfo ) */ static HB_ERRCODE hb_delimGoCold( DELIMAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoCold(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoCold(%p)", ( void * ) pArea ) ); if( pArea->fRecordChanged ) { @@ -985,7 +985,7 @@ static HB_ERRCODE hb_delimGoCold( DELIMAREAP pArea ) */ static HB_ERRCODE hb_delimGoHot( DELIMAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoHot(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimGoHot(%p)", ( void * ) pArea ) ); if( pArea->fReadonly ) { @@ -1008,7 +1008,7 @@ static HB_ERRCODE hb_delimFlush( DELIMAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimFlush(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimFlush(%p)", ( void * ) pArea ) ); errCode = SELF_GOCOLD( &pArea->area ); @@ -1026,7 +1026,7 @@ static HB_ERRCODE hb_delimFlush( DELIMAREAP pArea ) */ static HB_ERRCODE hb_delimInfo( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimInfo(%p,%hu,%p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimInfo(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); switch( uiIndex ) { @@ -1157,7 +1157,7 @@ static HB_ERRCODE hb_delimAddField( DELIMAREAP pArea, LPDBFIELDINFO pFieldInfo ) { HB_USHORT uiDelim = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimAddField(%p, %p)", pArea, pFieldInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimAddField(%p, %p)", ( void * ) pArea, ( void * ) pFieldInfo ) ); switch( pFieldInfo->uiType ) { @@ -1277,7 +1277,7 @@ static HB_ERRCODE hb_delimAddField( DELIMAREAP pArea, LPDBFIELDINFO pFieldInfo ) */ static HB_ERRCODE hb_delimSetFieldExtent( DELIMAREAP pArea, HB_USHORT uiFieldExtent ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimSetFieldExtent(%p,%hu)", pArea, uiFieldExtent ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimSetFieldExtent(%p,%hu)", ( void * ) pArea, uiFieldExtent ) ); if( SUPER_SETFIELDEXTENT( &pArea->area, uiFieldExtent ) == HB_FAILURE ) return HB_FAILURE; @@ -1294,7 +1294,7 @@ static HB_ERRCODE hb_delimSetFieldExtent( DELIMAREAP pArea, HB_USHORT uiFieldExt */ static HB_ERRCODE hb_delimNewArea( DELIMAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimNewArea(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimNewArea(%p)", ( void * ) pArea ) ); if( SUPER_NEW( &pArea->area ) == HB_FAILURE ) return HB_FAILURE; @@ -1318,7 +1318,7 @@ static HB_ERRCODE hb_delimNewArea( DELIMAREAP pArea ) */ static HB_ERRCODE hb_delimStructSize( DELIMAREAP pArea, HB_USHORT * uiSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimStrucSize(%p,%p)", pArea, uiSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimStrucSize(%p,%p)", ( void * ) pArea, ( void * ) uiSize ) ); HB_SYMBOL_UNUSED( pArea ); *uiSize = sizeof( DELIMAREA ); @@ -1330,7 +1330,7 @@ static HB_ERRCODE hb_delimStructSize( DELIMAREAP pArea, HB_USHORT * uiSize ) */ static HB_ERRCODE hb_delimClose( DELIMAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimClose(%p)", ( void * ) pArea ) ); /* Update record and unlock records */ if( pArea->pFile ) @@ -1389,7 +1389,7 @@ static HB_ERRCODE hb_delimCreate( DELIMAREAP pArea, LPDBOPENINFO pCreateInfo ) PHB_FNAME pFileName; char szFileName[ HB_PATH_MAX ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimCreate(%p,%p)", pArea, pCreateInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimCreate(%p,%p)", ( void * ) pArea, ( void * ) pCreateInfo ) ); pArea->fShared = HB_FALSE; /* pCreateInfo->fShared; */ pArea->fReadonly = HB_FALSE; /* pCreateInfo->fReadonly */ @@ -1491,7 +1491,7 @@ static HB_ERRCODE hb_delimOpen( DELIMAREAP pArea, LPDBOPENINFO pOpenInfo ) char szFileName[ HB_PATH_MAX ]; char szAlias[ HB_RDD_MAX_ALIAS_LEN + 1 ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimOpen(%p,%p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimOpen(%p,%p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); pArea->fShared = HB_TRUE; /* pOpenInfo->fShared; */ pArea->fReadonly = HB_TRUE; /* pOpenInfo->fReadonly; */ @@ -1589,7 +1589,7 @@ static HB_ERRCODE hb_delimInit( LPRDDNODE pRDD ) { PHB_TSD pTSD; - HB_TRACE( HB_TR_DEBUG, ( "hb_delimInit(%p)", pRDD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimInit(%p)", ( void * ) pRDD ) ); pTSD = ( PHB_TSD ) hb_xgrab( sizeof( HB_TSD ) ); HB_TSD_INIT( pTSD, sizeof( DELIMDATA ), NULL, NULL ); @@ -1606,7 +1606,7 @@ static HB_ERRCODE hb_delimInit( LPRDDNODE pRDD ) */ static HB_ERRCODE hb_delimExit( LPRDDNODE pRDD ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimExit(%p)", pRDD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimExit(%p)", ( void * ) pRDD ) ); if( pRDD->lpvCargo ) { @@ -1626,7 +1626,7 @@ static HB_ERRCODE hb_delimExit( LPRDDNODE pRDD ) */ static HB_ERRCODE hb_delimRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulConnect, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_delimRddInfo(%p,%hu,%lu,%p)", pRDD, uiIndex, ulConnect, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_delimRddInfo(%p,%hu,%lu,%p)", ( void * ) pRDD, uiIndex, ulConnect, ( void * ) pItem ) ); switch( uiIndex ) { @@ -1786,7 +1786,7 @@ HB_FUNC_STATIC( DELIM_GETFUNCTABLE ) puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); - HB_TRACE( HB_TR_DEBUG, ( "DELIM_GETFUNCTABLE(%p, %p)", puiCount, pTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "DELIM_GETFUNCTABLE(%p, %p)", ( void * ) puiCount, ( void * ) pTable ) ); if( pTable ) { diff --git a/src/rdd/fieldhb.c b/src/rdd/fieldhb.c index 97e9a0ceb9..ec0c43edf3 100644 --- a/src/rdd/fieldhb.c +++ b/src/rdd/fieldhb.c @@ -45,7 +45,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #ifndef HB_CLP_STRICT diff --git a/src/rdd/hbsix/sxcompat.prg b/src/rdd/hbsix/sxcompat.prg index 05da156e0b..64d9ca1691 100644 --- a/src/rdd/hbsix/sxcompat.prg +++ b/src/rdd/hbsix/sxcompat.prg @@ -1,36 +1,36 @@ /* * SIX compatible functions: - * sxChar() - * sxNum() - * sxDate() - * sxLog() - * sx_Compress() - * sx_Decompress() - * sx_TagInfo() - * sx_TagCount() - * sx_Tags() - * sx_SetTag() - * sx_KillTag() - * sx_FileOrder() - * sx_SetFileOrd() - * rdd_Count() - * rdd_Name() - * rdd_Info() - * sx_IsDBT() - * sx_AutoOpen() - * sx_AutoShare() - * sx_Blob2File() - * sx_File2Blob() - * sx_dbCreate() - * sx_VSigLen() - * sx_MemoExt() - * sx_MemoBlk() - * sx_SetMemoBlock() - * sx_StrXCheck() - * sx_LockRetry() - * sx_IsLocked() - * sx_SetTrigger() - * sx_VFGet() + * sxChar() + * sxNum() + * sxDate() + * sxLog() + * sx_Compress() + * sx_Decompress() + * sx_TagInfo() + * sx_TagCount() + * sx_Tags() + * sx_SetTag() + * sx_KillTag() + * sx_FileOrder() + * sx_SetFileOrd() + * rdd_Count() + * rdd_Name() + * rdd_Info() + * sx_IsDBT() + * sx_AutoOpen() + * sx_AutoShare() + * sx_Blob2File() + * sx_File2Blob() + * sx_dbCreate() + * sx_VSigLen() + * sx_MemoExt() + * sx_MemoBlk() + * sx_SetMemoBlock() + * sx_StrXCheck() + * sx_LockRetry() + * sx_IsLocked() + * sx_SetTrigger() + * sx_VFGet() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -227,34 +227,33 @@ FUNCTION sx_TagInfo( cIndex ) nFirst := 1 ENDIF FOR i := nFirst TO nOrds - aInfo[ i, 1 ] := ordName( i ) - aInfo[ i, 2 ] := ordKey( i ) - aInfo[ i, 3 ] := ordFor( i ) - aInfo[ i, 4 ] := ordIsUnique( i ) - aInfo[ i, 5 ] := ordDescend( i ) - aInfo[ i, 6 ] := ordCustom( i ) + aInfo[ i ][ 1 ] := ordName( i ) + aInfo[ i ][ 2 ] := ordKey( i ) + aInfo[ i ][ 3 ] := ordFor( i ) + aInfo[ i ][ 4 ] := ordIsUnique( i ) + aInfo[ i ][ 5 ] := ordDescend( i ) + aInfo[ i ][ 6 ] := ordCustom( i ) NEXT - ELSE - aInfo := {} + RETURN aInfo ENDIF - RETURN aInfo + RETURN {} FUNCTION sx_TagCount( xIndex ) LOCAL nTags := 0, cIndex, nOrder IF Used() - IF HB_ISNUMERIC( xIndex ) - nOrder := sx_TagOrder( 1, xIndex ) - IF nOrder != 0 + DO CASE + CASE HB_ISNUMERIC( xIndex ) + IF ( nOrder := sx_TagOrder( 1, xIndex ) ) != 0 cIndex := dbOrderInfo( DBOI_FULLPATH,, nOrder ) ENDIF - ELSEIF HB_ISSTRING( xIndex ) .AND. ! Empty( xIndex ) + CASE HB_ISSTRING( xIndex ) .AND. ! Empty( xIndex ) cIndex := xIndex - ELSE + OTHERWISE cIndex := dbOrderInfo( DBOI_FULLPATH ) - ENDIF + ENDCASE IF ! Empty( cIndex ) nTags := ordCount( cIndex ) ENDIF @@ -267,13 +266,14 @@ FUNCTION sx_Tags( xIndex ) LOCAL aTagNames := {}, nOrder, nTags IF Used() - IF HB_ISNUMERIC( xIndex ) + DO CASE + CASE HB_ISNUMERIC( xIndex ) nOrder := sx_TagOrder( 1, xIndex ) - ELSEIF HB_ISSTRING( xIndex ) .AND. ! Empty( xIndex ) + CASE HB_ISSTRING( xIndex ) .AND. ! Empty( xIndex ) nOrder := dbOrderInfo( DBOI_BAGORDER, xIndex ) - ELSE + OTHERWISE nOrder := ordNumber() - ENDIF + ENDCASE IF nOrder != 0 nTags := ordCount( dbOrderInfo( DBOI_FULLPATH,, nOrder ) ) DO WHILE --nTags >= 0 @@ -337,16 +337,17 @@ FUNCTION sx_KillTag( xTag, xIndex ) IF HB_ISLOGICAL( xTag ) IF xTag - IF Empty( xIndex ) + DO CASE + CASE Empty( xIndex ) cIndex := sx_IndexName() - ELSEIF HB_ISNUMERIC( xIndex ) + CASE HB_ISNUMERIC( xIndex ) cIndex := sx_IndexName( 1, xIndex ) - ELSEIF HB_ISSTRING( xIndex ) + CASE HB_ISSTRING( xIndex ) nOrder := dbOrderInfo( DBOI_BAGORDER, xIndex ) IF nOrder != 0 cIndex := dbOrderInfo( DBOI_FULLPATH,, nOrder ) ENDIF - ENDIF + ENDCASE IF ! Empty( cIndex ) IF ordBagClear( cIndex ) lRet := FErase( cIndex ) != F_ERROR @@ -372,8 +373,7 @@ FUNCTION sx_KillTag( xTag, xIndex ) ELSEIF HB_ISSTRING( xIndex ) nOrder := sx_TagOrder( xTag, xIndex ) ELSE - nOrder := sx_TagOrder( 1, xIndex ) - IF nOrder != 0 + IF ( nOrder := sx_TagOrder( 1, xIndex ) ) != 0 cIndex := dbOrderInfo( DBOI_FULLPATH,, nOrder ) IF Empty( cIndex ) nOrder := 0 @@ -416,37 +416,36 @@ FUNCTION rdd_Name( nRDD ) FUNCTION rdd_Info( xID ) - LOCAL aInfo, cRDD + LOCAL cRDD - IF HB_ISNUMERIC( xID ) - IF ! Empty( Alias( xID ) ) + DO CASE + CASE HB_ISNUMERIC( xID ) + IF ! Alias( xID ) == "" ( xID )->( rddName() ) ENDIF - ELSEIF HB_ISSTRING( xID ) + CASE HB_ISSTRING( xID ) cRDD := Upper( AllTrim( xID ) ) IF AScan( rddList(), {| x | Upper( x ) == cRDD } ) == 0 cRDD := NIL ENDIF - ELSEIF xID == NIL + CASE xID == NIL cRDD := rddSetDefault() - ENDIF + ENDCASE IF Empty( cRDD ) - aInfo := {} - ELSE - aInfo := Array( 6 ) - aInfo[ 1 ] := cRDD - aInfo[ 2 ] := .T. - aInfo[ 3 ] := hb_rddInfo( RDDI_TABLEEXT, NIL, cRDD ) - aInfo[ 4 ] := hb_rddInfo( RDDI_ORDBAGEXT, NIL, cRDD ) - aInfo[ 5 ] := hb_rddInfo( RDDI_ORDEREXT, NIL, cRDD ) - aInfo[ 6 ] := hb_rddInfo( RDDI_MEMOEXT, NIL, cRDD ) + RETURN {} ENDIF - RETURN aInfo + RETURN { ; + cRDD, ; + .T., ; + hb_rddInfo( RDDI_TABLEEXT, , cRDD ), ; + hb_rddInfo( RDDI_ORDBAGEXT, , cRDD ), ; + hb_rddInfo( RDDI_ORDEREXT, , cRDD ), ; + hb_rddInfo( RDDI_MEMOEXT, , cRDD ) } FUNCTION sx_IsDBT( cRDD ) - RETURN hb_rddInfo( RDDI_MEMOTYPE, NIL, cRDD ) == DB_MEMO_DBT + RETURN hb_rddInfo( RDDI_MEMOTYPE, , cRDD ) == DB_MEMO_DBT FUNCTION sx_MemoExt( cNewExt, cRDD ) RETURN hb_rddInfo( RDDI_MEMOEXT, cNewExt, cRDD ) @@ -515,11 +514,12 @@ FUNCTION sx_VSigLen( xField ) LOCAL nResult := 0, nField := 0 IF Used() - IF HB_ISSTRING( xField ) + DO CASE + CASE HB_ISSTRING( xField ) nField := FieldPos( xField ) - ELSEIF HB_ISNUMERIC( xField ) + CASE HB_ISNUMERIC( xField ) nField := xField - ENDIF + ENDCASE IF nField >= 1 .AND. nField <= FCount() nResult := FieldLen( nField ) IF FieldType( nField ) == "V" .AND. nResult >= 6 @@ -533,7 +533,7 @@ FUNCTION sx_VSigLen( xField ) FUNCTION sx_VFGet( cExpr, nLen ) /* Our RDDs does not use any internal flags to cut V-Fields so - * we can simply evaluate given expression */ + we can simply evaluate given expression */ IF Used() .AND. PCount() == 2 RETURN PadR( &cExpr, nLen ) /* NOTE: Macro operator! */ @@ -543,23 +543,21 @@ FUNCTION sx_VFGet( cExpr, nLen ) FUNCTION sx_IsLocked( xRec ) - LOCAL lResult := .F., xRecord + LOCAL xRecord IF Used() xRecord := iif( xRec == NIL, RecNo(), xRec ) - /* - * Don't be confused by function name. - * Even if it looks strange and results are not very usable due - * to possible race condition then this is what SIX3 exactly does. - */ + /* Don't be confused by function name. + Even if it looks strange and results are not very usable due + to possible race condition then this is what SIX3 exactly does. */ IF sx_Rlock( xRecord ) sx_Unlock( xRecord ) ELSE - lResult := .T. + RETURN .T. ENDIF ENDIF - RETURN lResult + RETURN .F. FUNCTION sx_SetTrigger( nAction, cTriggerName, cRDD /* Harbour extensions */ ) diff --git a/src/rdd/hbsix/sxcompr.c b/src/rdd/hbsix/sxcompr.c index f8ffa106c3..dd5b396db4 100644 --- a/src/rdd/hbsix/sxcompr.c +++ b/src/rdd/hbsix/sxcompr.c @@ -1,14 +1,14 @@ /* * SIX compatible functions: - * hb_LZSSxCompressMem() - * hb_LZSSxDecompressMem() - * hb_LZSSxCompressFile() - * hb_LZSSxDecompressFile() + * hb_LZSSxCompressMem() + * hb_LZSSxDecompressMem() + * hb_LZSSxCompressFile() + * hb_LZSSxDecompressFile() * - * SX_FCOMPRESS - * SX_FDECOMPRESS - * _SX_STRDECOMPRESS - * _SX_STRCOMPRESS + * sx_FCompress() + * sx_FDecompress() + * _sx_StrDecompress() + * _sx_StrCompress() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -72,7 +72,7 @@ wanted to reduce memory overhead in used algorithm for finding the longest match? The SIX was written for 16-bit DOS and the memory consumption was important though it should not be too much. They - documented ~9KB increasing the ring buffer size should be linear to + documented ~9 KiB increasing the ring buffer size should be linear to other used (helper) structures. The next interesting thing is that it dynamically overwrites the ring buffer with stream data and does not use any separate look ahead buffers. @@ -81,7 +81,7 @@ Our algorithm has to make the same with the ring buffer to be compatible. UPDATE: Using smaller ring buffer without increasing the match pointer suggested me that it is possible that someone didn't understand it fully - and modified already existing algorithm. I spend a while with a google + and modified already existing algorithm. I spend a while on the internet looking for old LZSS implementations and I've found it. IMHO in 99% this code is used in SIX. This is lzss.c file written by Haruhiko Okumura with the following note in header: @@ -120,7 +120,7 @@ #define HB_SX_UNCOMPRESED 0xFFFFFFFFUL -/* number of bits for encoded item (position,length) */ +/* number of bits for encoded item (position, length) */ #define ITEMBITS 16 /* unused DUMMY bits - who does know why SIX has it? */ #define DUMMYBITS 1 @@ -139,7 +139,7 @@ #define RBUFMASK ( ( 1 << OFFSETBITS ) - 1 ) /* the bit mask for match length */ #define MATCHMASK ( ( 1 << LENGTHBITS ) - 1 ) -/* get ringbuffer index */ +/* get ring buffer index */ #define RBUFINDEX( i ) ( ( i ) & RBUFMASK ) /* get ring buffer offset position from low and high bytes */ @@ -461,7 +461,7 @@ static HB_SIZE hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr ) HB_UCHAR itemSet[ ITEMSETSIZE ]; HB_UCHAR itemMask; HB_SIZE nSize = 0; - HB_SHORT i, c, len, r, s, last_match_length, item; + HB_SHORT i, c, len, r, s, item; for( i = RBUFLENGTH + 1; i < RBUFLENGTH + 257; i++ ) pCompr->right[ i ] = DUMMYNODE; @@ -488,6 +488,8 @@ static HB_SIZE hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr ) do { + HB_SHORT last_match_length; + if( pCompr->match_length > len ) pCompr->match_length = len; if( pCompr->match_length < MINLENGTH ) @@ -610,28 +612,26 @@ HB_BOOL hb_LZSSxDecompressFile( PHB_FILE pInput, PHB_FILE pOutput ) HB_FUNC( SX_FCOMPRESS ) { HB_BOOL fRet = HB_FALSE; - PHB_FILE pInput, pOutput; const char * szSource = hb_parc( 1 ), * szDestin = hb_parc( 2 ); - HB_BYTE buf[ 4 ]; - HB_SIZE nSize; if( szSource && *szSource && szDestin && *szDestin ) { - pInput = hb_fileExtOpen( szSource, NULL, FO_READ | FO_DENYNONE | - FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ); + PHB_FILE pInput = hb_fileExtOpen( szSource, NULL, FO_READ | FO_DENYNONE | + FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ); if( pInput != NULL ) { - pOutput = hb_fileExtOpen( szDestin, NULL, FO_READWRITE | - FO_EXCLUSIVE | FXO_TRUNCATE | - FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ); + PHB_FILE pOutput = hb_fileExtOpen( szDestin, NULL, FO_READWRITE | + FO_EXCLUSIVE | FXO_TRUNCATE | + FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ); if( pOutput != NULL ) { /* store uncompressed file size in first 4 bytes of destination * file in little endian order - for SIX3 compatibility */ - nSize = ( HB_SIZE ) hb_fileSize( pInput ); + HB_SIZE nSize = ( HB_SIZE ) hb_fileSize( pInput ); if( hb_fileSeek( pInput, 0, FS_SET ) == 0 ) { + HB_BYTE buf[ 4 ]; HB_PUT_LE_UINT32( buf, nSize ); if( hb_fileWrite( pOutput, buf, 4, -1 ) == 4 ) fRet = hb_LZSSxCompressFile( pInput, pOutput, NULL ); @@ -647,18 +647,17 @@ HB_FUNC( SX_FCOMPRESS ) HB_FUNC( SX_FDECOMPRESS ) { HB_BOOL fRet = HB_FALSE; - PHB_FILE pInput, pOutput; const char * szSource = hb_parc( 1 ), * szDestin = hb_parc( 2 ); if( szSource && *szSource && szDestin && *szDestin ) { - pInput = hb_fileExtOpen( szSource, NULL, FO_READ | FO_DENYNONE | - FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ); + PHB_FILE pInput = hb_fileExtOpen( szSource, NULL, FO_READ | FO_DENYNONE | + FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ); if( pInput != NULL ) { - pOutput = hb_fileExtOpen( szDestin, NULL, FO_READWRITE | - FO_EXCLUSIVE | FXO_TRUNCATE | - FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ); + PHB_FILE pOutput = hb_fileExtOpen( szDestin, NULL, FO_READWRITE | + FO_EXCLUSIVE | FXO_TRUNCATE | + FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ); if( pOutput != NULL ) { /* skip the four bytes with original file length */ @@ -675,11 +674,11 @@ HB_FUNC( SX_FDECOMPRESS ) HB_FUNC( _SX_STRCOMPRESS ) { const char * pStr = hb_parc( 1 ); - char * pBuf; if( pStr ) { HB_SIZE nLen = hb_parclen( 1 ), nBuf, nDst; + char * pBuf; /* this is for strict SIX compatibility - in general very bad idea */ nBuf = nLen + 257; @@ -703,7 +702,6 @@ HB_FUNC( _SX_STRDECOMPRESS ) { HB_BOOL fOK = HB_FALSE; const char * pStr = hb_parc( 1 ); - char * pBuf; if( pStr ) { @@ -719,7 +717,7 @@ HB_FUNC( _SX_STRDECOMPRESS ) } else { - pBuf = ( char * ) hb_xalloc( nBuf + 1 ); + char * pBuf = ( char * ) hb_xalloc( nBuf + 1 ); if( pBuf ) { fOK = hb_LZSSxDecompressMem( pStr + 4, nLen - 4, pBuf, nBuf ); diff --git a/src/rdd/hbsix/sxdate.c b/src/rdd/hbsix/sxdate.c index 15f98d099d..43231f203e 100644 --- a/src/rdd/hbsix/sxdate.c +++ b/src/rdd/hbsix/sxdate.c @@ -1,10 +1,10 @@ /* * SIX compatible functions: - * hb_sxDtoP() - * hb_sxPtoD() + * hb_sxDtoP() + * hb_sxPtoD() * - * sx_DToP() - * sx_PToD() + * sx_DToP() + * sx_PToD() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -56,7 +56,7 @@ char * hb_sxDtoP( char * pDate, long lJulian ) int iYear, iMonth, iDay; long lPDate; - HB_TRACE( HB_TR_DEBUG, ( "hb_sxDtoP(%p, %ld)", pDate, lJulian ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sxDtoP(%p, %ld)", ( void * ) pDate, lJulian ) ); hb_dateDecode( lJulian, &iYear, &iMonth, &iDay ); lPDate = ( ( ( iYear << 1 ) | ( iMonth >> 3 ) ) << 8 ) | @@ -68,13 +68,13 @@ char * hb_sxDtoP( char * pDate, long lJulian ) long hb_sxPtoD( const char * pDate ) { - int iYear, iMonth, iDay; - long lPDate; - - HB_TRACE( HB_TR_DEBUG, ( "hb_sxPtoD(%p)", pDate ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sxPtoD(%p)", ( const void * ) pDate ) ); if( pDate ) { + int iYear, iMonth, iDay; + long lPDate; + lPDate = HB_GET_BE_UINT24( pDate ); iDay = lPDate & 0x1f; iMonth = ( lPDate >> 5 ) & 0x0f; diff --git a/src/rdd/hbsix/sxfname.c b/src/rdd/hbsix/sxfname.c index f2a25bf69b..a4e1f73890 100644 --- a/src/rdd/hbsix/sxfname.c +++ b/src/rdd/hbsix/sxfname.c @@ -1,6 +1,6 @@ /* * SIX compatible function: - * sx_FNameParser() + * sx_FNameParser() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rdd/hbsix/sxini.prg b/src/rdd/hbsix/sxini.prg index 2ba2764c07..e1bfd141c2 100644 --- a/src/rdd/hbsix/sxini.prg +++ b/src/rdd/hbsix/sxini.prg @@ -1,7 +1,7 @@ /* * SIX compatible functions: - * _sx_IniInit() - * sx_IniHeader() + * _sx_IniInit() + * sx_IniHeader() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rdd/hbsix/sxord.c b/src/rdd/hbsix/sxord.c index 98a8c97fe2..daea75d38f 100644 --- a/src/rdd/hbsix/sxord.c +++ b/src/rdd/hbsix/sxord.c @@ -1,37 +1,37 @@ /* * SIX compatible function: - * sx_TagOrder() * - * sx_TagNo() - * sx_Freeze() - * sx_Warm() - * sx_Chill() - * sx_Thermometer() - * sx_ClrScope() - * sx_SetScope() - * sx_IsReindex() - * sx_Step() - * sx_KeySincluded() - * sx_I_IndexName() - * sx_I_TagName() - * sx_IndexCount() - * sx_IndexName() - * sx_IndexType() - * sx_KeyAdd() - * sx_KeyDrop() - * sx_KeyData() - * sx_KeySkip() - * sx_KeyCount() - * sx_KeyNo() - * sx_KeyGoto() - * sx_SkipUnique() - * sx_SeekLast() - * sx_TagUnique() - * sx_WildSeek() - * sx_ROXLock() - * sx_ROXUnlock() - * sx_IsMyROX() - * sx_IsROXLock() - * sx_SortOption() + * sx_TagOrder() * + * sx_TagNo() + * sx_Freeze() + * sx_Warm() + * sx_Chill() + * sx_Thermometer() + * sx_ClrScope() + * sx_SetScope() + * sx_IsReindex() + * sx_Step() + * sx_KeySincluded() + * sx_I_IndexName() + * sx_I_TagName() + * sx_IndexCount() + * sx_IndexName() + * sx_IndexType() + * sx_KeyAdd() + * sx_KeyDrop() + * sx_KeyData() + * sx_KeySkip() + * sx_KeyCount() + * sx_KeyNo() + * sx_KeyGoto() + * sx_SkipUnique() + * sx_SeekLast() + * sx_TagUnique() + * sx_WildSeek() + * sx_ROXLock() + * sx_ROXUnlock() + * sx_IsMyROX() + * sx_IsROXLock() + * sx_SortOption() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -125,13 +125,13 @@ HB_FUNC( SX_TAGORDER ) } /* - * sx_TagNo(tag,bag) -> nTagPosInBag + * sx_TagNo( tag, bag ) --> nTagPosInBag * returns order position in order bag */ HB_FUNC( SX_TAGNO ) { AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); - int iBagOrder = 0, iOrder; + int iBagOrder = 0; if( pArea ) { @@ -142,7 +142,7 @@ HB_FUNC( SX_TAGNO ) Info.itmResult = hb_itemPutNI( NULL, 0 ); if( SELF_ORDINFO( pArea, DBOI_NUMBER, &Info ) == HB_SUCCESS ) { - iOrder = hb_itemGetNI( Info.itmResult ); + int iOrder = hb_itemGetNI( Info.itmResult ); if( iOrder ) { Info.itmOrder = hb_itemPutNI( NULL, iOrder ); @@ -248,7 +248,7 @@ HB_FUNC( SX_CHILL ) HB_FUNC( SX_THERMOMETER ) { AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); - int iTemperature = -1, i; + int iTemperature = -1; if( pArea ) { @@ -256,6 +256,7 @@ HB_FUNC( SX_THERMOMETER ) if( hb_sxOrdParam( &Info ) ) { + int i; Info.itmResult = hb_itemPutNI( NULL, 0 ); SELF_ORDINFO( pArea, DBOI_NUMBER, &Info ); i = hb_itemGetNI( Info.itmResult ); @@ -679,10 +680,11 @@ HB_FUNC( SX_WILDSEEK ) const char * szPattern = hb_parc( 1 ); HB_BOOL fCont = hb_parl( 2 ); HB_BOOL fFound = HB_FALSE; - int iOrder = 0; if( pArea ) { + int iOrder = 0; + DBORDERINFO Info; memset( &Info, 0, sizeof( Info ) ); Info.itmResult = hb_itemNew( NULL ); diff --git a/src/rdd/hbsix/sxredir.c b/src/rdd/hbsix/sxredir.c index 40b1779f1b..fec1175dd6 100644 --- a/src/rdd/hbsix/sxredir.c +++ b/src/rdd/hbsix/sxredir.c @@ -1,8 +1,8 @@ /* * SIX compatible function: - * sx_FindRec() - * sx_ClearOrder() - * sx_SetTrig() + * sx_FindRec() + * sx_ClearOrder() + * sx_SetTrig() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -47,7 +47,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( SX_FINDREC , ORDFINDREC ) HB_FUNC_TRANSLATE( SX_CLEARORDER, ORDBAGCLEAR ) diff --git a/src/rdd/hbsix/sxsem.c b/src/rdd/hbsix/sxsem.c index 5184a2e89d..1ad5cb6654 100644 --- a/src/rdd/hbsix/sxsem.c +++ b/src/rdd/hbsix/sxsem.c @@ -1,8 +1,8 @@ /* * SIX compatible functions: - * sx_MakeSem() - * sx_KillSem() - * sx_IsSem() + * sx_MakeSem() + * sx_KillSem() + * sx_IsSem() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -48,7 +48,6 @@ */ #include "hbapi.h" -#include "hbapicdp.h" #include "hbapiitm.h" #include "hbapifs.h" #include "hbapirdd.h" @@ -137,7 +136,6 @@ static PHB_FILE hb_sxSemOpen( char * szFileName, HB_BOOL * pfNewFile ) HB_FUNC( SX_MAKESEM ) { char szFileName[ HB_PATH_MAX ]; - HB_BYTE buffer[ 2 ]; int iUsers = -1; HB_BOOL fError = HB_FALSE, fNewFile = HB_FALSE; @@ -147,6 +145,8 @@ HB_FUNC( SX_MAKESEM ) if( pFile != NULL ) { + HB_BYTE buffer[ 2 ]; + if( fNewFile ) iUsers = 1; else @@ -174,7 +174,6 @@ HB_FUNC( SX_MAKESEM ) HB_FUNC( SX_KILLSEM ) { char szFileName[ HB_PATH_MAX ]; - HB_BYTE buffer[ 2 ]; int iUsers = -1; if( hb_sxSemName( szFileName ) ) @@ -183,6 +182,7 @@ HB_FUNC( SX_KILLSEM ) if( pFile != NULL ) { + HB_BYTE buffer[ 2 ]; if( hb_fileReadAt( pFile, buffer, 2, 0 ) == 2 ) { iUsers = HB_GET_LE_INT16( buffer ) - 1; diff --git a/src/rdd/hbsix/sxtrig.prg b/src/rdd/hbsix/sxtrig.prg index 02081c6df0..258ae007e2 100644 --- a/src/rdd/hbsix/sxtrig.prg +++ b/src/rdd/hbsix/sxtrig.prg @@ -1,6 +1,6 @@ /* * SIX compatible functions: - * sx_DefTrigger() + * sx_DefTrigger() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -45,6 +45,8 @@ * */ +/* In separate source file to make it easy to override by user code */ + #include "hbsxdef.ch" FUNCTION sx_DefTrigger( nEvent, nArea, nFieldPos, xTrigVal ) diff --git a/src/rdd/hbsix/sxutil.c b/src/rdd/hbsix/sxutil.c index 1f31640e8f..68d44b0311 100644 --- a/src/rdd/hbsix/sxutil.c +++ b/src/rdd/hbsix/sxutil.c @@ -1,9 +1,9 @@ /* * SIX compatible function: - * sx_SlimFast() - * sx_WildMatch() - * sx_Version() - * sx_Error() + * sx_SlimFast() + * sx_WildMatch() + * sx_Version() + * sx_Error() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rdd/hsx/cftsfunc.c b/src/rdd/hsx/cftsfunc.c index 6cefeee37f..2825956003 100644 --- a/src/rdd/hsx/cftsfunc.c +++ b/src/rdd/hsx/cftsfunc.c @@ -1,13 +1,13 @@ /* * HiPer-SEEK / CFTS compatible library - * Cfts*() functions + * Cfts*() functions * * Copyright 2005 Przemyslaw Czerpak <druzus@acn.waw.pl> * * Credits: * Many thanks for Mindaugas Kavaliauskas for his assistance, - * informations about HSX internals, code checking and general - * helping in many things when this library was written. + * information about HSX internals, code checking and general + * help in many things when this library was written. * Przemek. * * This program is free software; you can redistribute it and/or modify @@ -51,7 +51,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( CFTSADD , HS_ADD ) HB_FUNC_TRANSLATE( CFTSCLOSE , HS_CLOSE ) diff --git a/src/rdd/hsx/hsx.c b/src/rdd/hsx/hsx.c index 64955d8934..d92148c43c 100644 --- a/src/rdd/hsx/hsx.c +++ b/src/rdd/hsx/hsx.c @@ -5,8 +5,8 @@ * * Credits: * Many thanks for Mindaugas Kavaliauskas for his assistance, - * informations about HSX internals, code checking and general - * helping in many things when this library was written. + * information about HSX internals, code checking and general + * help in many things when this library was written. * Przemek. * * This program is free software; you can redistribute it and/or modify @@ -54,7 +54,7 @@ /* LOCKING/IO operations done by HiPpe-SEEK/CFTS library: A. in exclusive mode: - Unimportant. Thogugh tests shows that CFTS uses buffers + Unimportant. Though tests shows that CFTS uses buffers only in ADD and NEXT operations. Other causes immediate IO call B. in shared mode @@ -184,7 +184,7 @@ are called without key expression. When the key expression is set as string then it is also stored in HSX header and later is automatically retrieve by HS_OPEN. - 3. HS_CREATE has optional 6-th parameter with key expression. It works + 3. HS_CREATE has optional 6th parameter with key expression. It works in the same way as key parameter in HS_INDEX. 4. other functions which accept the index key can receive it as direct the key value (string item) or codeblock @@ -334,7 +334,7 @@ typedef struct _HSXINFO int iArea; /* work area number if bound with WA or 0 */ char * szKeyExpr; /* key expression when bound with WA for automatic update */ PHB_ITEM pKeyItem; /* item with compiled key expression */ - HB_BOOL fFlush; /* data was written to file and not commited */ + HB_BOOL fFlush; /* data was written to file and not committed */ } HSXINFO; typedef HSXINFO * LPHSXINFO; @@ -465,7 +465,7 @@ static int hb_hsxHashVal( int c1, int c2, int iKeyBits, static void hb_hsxHashStr( const char * pStr, HB_SIZE nLen, HB_BYTE * pKey, int iKeySize, HB_BOOL fNoCase, int iFilter, HB_BOOL fUseHash ) { - int c1, c2, iBitNum, iKeyBits = iKeySize << 3; + int c1, iKeyBits = iKeySize << 3; memset( pKey, '\0', iKeySize ); #if 0 @@ -473,6 +473,7 @@ static void hb_hsxHashStr( const char * pStr, HB_SIZE nLen, HB_BYTE * pKey, int manipulating at first Chr(0) character */ if( pStr && nLen-- && ( c1 = ( HB_UCHAR ) *pStr++ ) != 0 ) { + int c2; while( nLen-- && ( c2 = ( HB_UCHAR ) *pStr++ ) != 0 ) { #else @@ -482,9 +483,9 @@ static void hb_hsxHashStr( const char * pStr, HB_SIZE nLen, HB_BYTE * pKey, int c1 = ( HB_UCHAR ) *pStr++; while( nLen-- ) { - c2 = ( HB_UCHAR ) *pStr++; + int c2 = ( HB_UCHAR ) *pStr++; #endif - iBitNum = hb_hsxHashVal( c1, c2, iKeyBits, fNoCase, iFilter, fUseHash ); + int iBitNum = hb_hsxHashVal( c1, c2, iKeyBits, fNoCase, iFilter, fUseHash ); if( iBitNum-- ) { pKey[ iBitNum >> 3 ] |= 0x80 >> ( iBitNum & 7 ); @@ -499,13 +500,13 @@ static int hb_hsxStrCmp( const char * pSub, HB_SIZE nSub, const char * pStr, HB_ { HB_BOOL fResult = HB_FALSE; HB_UCHAR c1, c2; - HB_SIZE nPos; if( nSub == 0 ) return HSX_SUCCESSFALSE; while( ! fResult && nLen >= nSub ) { + HB_SIZE nPos; fResult = HB_TRUE; for( nPos = 0; fResult && nPos < nSub; nPos++ ) { @@ -758,11 +759,13 @@ static int hb_hsxHdrRead( int iHandle ) static int hb_hsxRead( int iHandle, HB_ULONG ulRecord, HB_BYTE ** pRecPtr ) { LPHSXINFO pHSX = hb_hsxGetPointer( iHandle ); - HB_BOOL fCount = pHSX->fShared; + HB_BOOL fCount; if( ! pHSX ) return HSX_BADHANDLE; + fCount = pHSX->fShared; + if( ulRecord > pHSX->ulRecCount && fCount ) { hb_hsxGetRecCount( pHSX ); @@ -883,7 +886,7 @@ static int hb_hsxUpdate( int iHandle, HB_ULONG ulRecord, HB_BYTE ** pRecPtr ) static int hb_hsxLock( int iHandle, int iAction, HB_ULONG ulRecord ) { LPHSXINFO pHSX = hb_hsxGetPointer( iHandle ); - int iRetVal = HSX_SUCCESS, iRet; + int iRetVal = HSX_SUCCESS; HB_BOOL fResult; HB_SYMBOL_UNUSED( ulRecord ); @@ -929,7 +932,7 @@ static int hb_hsxLock( int iHandle, int iAction, HB_ULONG ulRecord ) } if( iRetVal == HSX_SUCCESS ) { - /* discrad buffers in shared mode */ + /* discard buffers in shared mode */ pHSX->ulFirstRec = pHSX->ulBufRec = 0; if( iAction == HSX_APPENDLOCK ) hb_hsxGetRecCount( pHSX ); @@ -971,10 +974,12 @@ static int hb_hsxLock( int iHandle, int iAction, HB_ULONG ulRecord ) pHSX->fWrLocked = HB_FALSE; /* fallthrough */ case HSX_HDRWRITEUNLOCK: - iRet = hb_hsxHdrFlush( iHandle ); + { + int iRet = hb_hsxHdrFlush( iHandle ); if( iRetVal == HSX_SUCCESS ) iRetVal = iRet; - /* fallthrough */ + } + /* fallthrough */ case HSX_HDRREADUNLOCK: if( ! hb_fileLock( pHSX->pFile, HSX_HDRLOCKPOS, HSX_HDRLOCKSIZE, FL_UNLOCK ) ) @@ -1000,7 +1005,7 @@ static int hb_hsxIfDel( int iHandle, HB_ULONG ulRecord ) { iRetVal = hb_hsxRead( iHandle, ulRecord, &pRecPtr ); if( iRetVal == HSX_SUCCESS ) - iRetVal = *pRecPtr & 0x80 ? HSX_SUCCESS : HSX_SUCCESSFALSE; + iRetVal = ( *pRecPtr & 0x80 ) ? HSX_SUCCESS : HSX_SUCCESSFALSE; } iRet = hb_hsxLock( iHandle, HSX_READUNLOCK, ulRecord ); if( iRet != HSX_SUCCESS ) @@ -1011,7 +1016,7 @@ static int hb_hsxIfDel( int iHandle, HB_ULONG ulRecord ) static int hb_hsxDelete( int iHandle, HB_ULONG ulRecord ) { LPHSXINFO pHSX = hb_hsxGetPointer( iHandle ); - int iRetVal, iRet; + int iRetVal; if( ! pHSX ) return HSX_BADHANDLE; @@ -1020,6 +1025,7 @@ static int hb_hsxDelete( int iHandle, HB_ULONG ulRecord ) if( iRetVal == HSX_SUCCESS ) { HB_BYTE * pRecPtr; + int iRet; iRetVal = hb_hsxRead( iHandle, ulRecord, &pRecPtr ); if( iRetVal == HSX_SUCCESS ) @@ -1043,7 +1049,7 @@ static int hb_hsxDelete( int iHandle, HB_ULONG ulRecord ) static int hb_hsxUnDelete( int iHandle, HB_ULONG ulRecord ) { LPHSXINFO pHSX = hb_hsxGetPointer( iHandle ); - int iRetVal, iRet; + int iRetVal; if( ! pHSX ) return HSX_BADHANDLE; @@ -1052,6 +1058,7 @@ static int hb_hsxUnDelete( int iHandle, HB_ULONG ulRecord ) if( iRetVal == HSX_SUCCESS ) { HB_BYTE * pRecPtr; + int iRet; iRetVal = hb_hsxRead( iHandle, ulRecord, &pRecPtr ); if( iRetVal == HSX_SUCCESS ) @@ -1075,7 +1082,7 @@ static int hb_hsxUnDelete( int iHandle, HB_ULONG ulRecord ) static int hb_hsxReplace( int iHandle, HB_ULONG ulRecord, PHB_ITEM pExpr, HB_BOOL fDeleted ) { LPHSXINFO pHSX = hb_hsxGetPointer( iHandle ); - int iRetVal, iRet; + int iRetVal; if( ! pHSX ) return HSX_BADHANDLE; @@ -1084,6 +1091,7 @@ static int hb_hsxReplace( int iHandle, HB_ULONG ulRecord, PHB_ITEM pExpr, HB_BOO if( iRetVal == HSX_SUCCESS ) { HB_BYTE * pRecPtr; + int iRet; iRetVal = hb_hsxUpdate( iHandle, ulRecord, &pRecPtr ); if( iRetVal == HSX_SUCCESS ) @@ -1106,7 +1114,7 @@ static int hb_hsxReplace( int iHandle, HB_ULONG ulRecord, PHB_ITEM pExpr, HB_BOO static int hb_hsxAdd( int iHandle, HB_ULONG * pulRecNo, PHB_ITEM pExpr, HB_BOOL fDeleted ) { LPHSXINFO pHSX = hb_hsxGetPointer( iHandle ); - int iRetVal, iRet; + int iRetVal; if( pulRecNo ) *pulRecNo = 0; @@ -1122,6 +1130,7 @@ static int hb_hsxAdd( int iHandle, HB_ULONG * pulRecNo, PHB_ITEM pExpr, HB_BOOL { HB_BYTE * pRecPtr; HB_ULONG ulRecNo; + int iRet; iRetVal = hb_hsxAppend( iHandle, &ulRecNo, &pRecPtr ); if( iRetVal == HSX_SUCCESS ) @@ -1179,7 +1188,7 @@ static int hb_hsxSeekSet( int iHandle, const char * pStr, HB_SIZE nLen ) static int hb_hsxNext( int iHandle, HB_ULONG * pulRecNo ) { LPHSXINFO pHSX = hb_hsxGetPointer( iHandle ); - int iRetVal, iRet; + int iRetVal; *pulRecNo = 0; @@ -1191,6 +1200,7 @@ static int hb_hsxNext( int iHandle, HB_ULONG * pulRecNo ) { HB_BYTE * pRecPtr; int i; + int iRet; while( pHSX->ulCurrRec < pHSX->ulRecCount ) { @@ -1479,7 +1489,7 @@ static int hb_hsxOpen( const char * szFile, int iBufSize, int iMode ) PHB_FILE pFile; HB_ULONG ulBufSize; LPHSXINFO pHSX; - int iRetVal, iRet; + int iRetVal; if( ! szFile || ! *szFile ) return HSX_BADPARMS; @@ -1520,6 +1530,7 @@ static int hb_hsxOpen( const char * szFile, int iBufSize, int iMode ) iRetVal = hb_hsxLock( pHSX->iHandle, HSX_HDRREADLOCK, 0 ); if( iRetVal == HSX_SUCCESS ) { + int iRet; iRetVal = hb_hsxHdrRead( pHSX->iHandle ); iRet = hb_hsxLock( pHSX->iHandle, HSX_HDRREADUNLOCK, 0 ); if( iRetVal == HSX_SUCCESS ) @@ -1692,7 +1703,7 @@ static int hb_hsxFilter( int iHandle, const char * pSeek, HB_SIZE nSeek, /* ************************************************************************ */ /* hs_Create( <cFile>, <nBufSize>, <nKeySize>, <lCase>, <nFiltSet>, <xExpr> ) - -> nVal >=0 (OK: <hIndex>), nVal < 0 (ERROR CODE) + --> nVal >=0 (OK: <hIndex>), nVal < 0 (ERROR CODE) Creates a new, empty HiPer-SEEK index file */ HB_FUNC( HS_CREATE ) { @@ -1702,7 +1713,7 @@ HB_FUNC( HS_CREATE ) } /* hs_Open( <cFile>, <nBufSize>, <nOpenMode> ) - -> nVal >=0 (OK: <hIndex>), nVal < 0 (ERROR CODE) + --> nVal >=0 (OK: <hIndex>), nVal < 0 (ERROR CODE) Opens an existing HiPer-SEEK index file */ HB_FUNC( HS_OPEN ) { @@ -1710,7 +1721,7 @@ HB_FUNC( HS_OPEN ) hb_param( 3, HB_IT_NUMERIC ) ? hb_parni( 3 ) : HSXDEFOPENMODE ) ); } -/* hs_Close( <hIndex> ) -> nVal = 1 (OK), nVal < 0 (ERROR CODE) +/* hs_Close( <hIndex> ) --> nVal = 1 (OK), nVal < 0 (ERROR CODE) Closes a previously opened HiPer-SEEK index file */ HB_FUNC( HS_CLOSE ) { @@ -1721,7 +1732,7 @@ HB_FUNC( HS_CLOSE ) } /* hs_Index( <cFile>, <cExpr>, <nKeySize>, <nOpenMode>, <nBufSize>, <lCase>, - <nFiltSet> ) -> nVal >=0 (OK: <hIndex>), nVal < 0 (ERROR CODE) + <nFiltSet> ) --> nVal >=0 (OK: <hIndex>), nVal < 0 (ERROR CODE) Creates and populates a new HiPer-SEEK index */ HB_FUNC( HS_INDEX ) { @@ -1732,7 +1743,7 @@ HB_FUNC( HS_INDEX ) hb_parni( 7 ) ) ); } -/* hs_Add( <hIndex>, [<xExpr>], [lDel] ) -> nVal >= 1 (RECNO), nVal < 0 (ERROR CODE) +/* hs_Add( <hIndex>, [<xExpr>], [lDel] ) --> nVal >= 1 (RECNO), nVal < 0 (ERROR CODE) Adds a text string entry to a HiPer-SEEK index file */ HB_FUNC( HS_ADD ) { @@ -1754,7 +1765,7 @@ HB_FUNC( HS_ADD ) hb_retni( HSX_BADPARMS ); } -/* hs_Replace( <hIndex>, [<xExpr>], <nRecNo>, [lDel] ) -> nVal = 1 (OK), nVal < 0 (ERROR CODE) +/* hs_Replace( <hIndex>, [<xExpr>], <nRecNo>, [lDel] ) --> nVal = 1 (OK), nVal < 0 (ERROR CODE) Replaces current HiPer-SEEK index entry with a new value */ HB_FUNC( HS_REPLACE ) { @@ -1766,7 +1777,7 @@ HB_FUNC( HS_REPLACE ) hb_retni( HSX_BADPARMS ); } -/* hs_IfDel( <hIndex>, <nRecNo> ) -> nVal = {0|1} (DELETED), nVal < 0 (ERROR CODE) +/* hs_IfDel( <hIndex>, <nRecNo> ) --> nVal = {0|1} (DELETED), nVal < 0 (ERROR CODE) Determines if a HiPer-SEEK record is marked as deleted */ HB_FUNC( HS_IFDEL ) { @@ -1776,7 +1787,7 @@ HB_FUNC( HS_IFDEL ) hb_retni( HSX_BADPARMS ); } -/* hs_Delete( <hIndex>, <nRecNo> ) -> nVal = 1 (OK), nVal < 0 (ERROR CODE) +/* hs_Delete( <hIndex>, <nRecNo> ) --> nVal = 1 (OK), nVal < 0 (ERROR CODE) Deletes specifed index record from HiPer-SEEK index file */ HB_FUNC( HS_DELETE ) { @@ -1786,7 +1797,7 @@ HB_FUNC( HS_DELETE ) hb_retni( HSX_BADPARMS ); } -/* hs_Undelete( <hIndex>, <nRecNo> ) -> nVal = 1 (OK), nVal < 0 (ERROR CODE) +/* hs_Undelete( <hIndex>, <nRecNo> ) --> nVal = 1 (OK), nVal < 0 (ERROR CODE) Unmarks the specified HiPer-SEEK record as being deleted */ HB_FUNC( HS_UNDELETE ) { @@ -1796,7 +1807,7 @@ HB_FUNC( HS_UNDELETE ) hb_retni( HSX_BADPARMS ); } -/* hs_KeyCount( <hIndex> ) -> nVal >= 0 (RECCOUNT), nVal < 0 (ERROR CODE) +/* hs_KeyCount( <hIndex> ) --> nVal >= 0 (RECCOUNT), nVal < 0 (ERROR CODE) Returns the number of entries in a HiPer-SEEK index */ HB_FUNC( HS_KEYCOUNT ) { @@ -1818,7 +1829,7 @@ HB_FUNC( HS_KEYCOUNT ) hb_retni( HSX_BADPARMS ); } -/* hs_Set( <hIndex>, <cExpr> ) -> nVal = 1 (OK), nVal < 0 (ERROR CODE) +/* hs_Set( <hIndex>, <cExpr> ) --> nVal = 1 (OK), nVal < 0 (ERROR CODE) Sets up parameters for a subsequent hs_Next() call */ HB_FUNC( HS_SET ) { @@ -1830,7 +1841,7 @@ HB_FUNC( HS_SET ) hb_retni( iRetVal ); } -/* hs_Filter( <cIndex>, <cVal>, [xRealExp], [nBufSize], [nOpenMode] ) -> nRecMatch +/* hs_Filter( <cIndex>, <cVal>, [xRealExp], [nBufSize], [nOpenMode] ) --> nRecMatch Sets a WA RM filter using a HiPer-SEEK index */ HB_FUNC( HS_FILTER ) { @@ -1938,7 +1949,7 @@ HB_FUNC( HS_FILTER ) hb_retnint( ulRecords ); } -/* hs_Next( <hIndex> ) -> nVal >= 0 (RECNO), nVal < 0 (ERROR CODE) +/* hs_Next( <hIndex> ) --> nVal >= 0 (RECNO), nVal < 0 (ERROR CODE) Searches a HiPer-SEEK index file for first/next match */ HB_FUNC( HS_NEXT ) { @@ -1955,8 +1966,8 @@ HB_FUNC( HS_NEXT ) } /* hs_Verify( <hIndex>, <bSource>, <cValue>, <nType> ) - -> nVal = {0|1} (VERIFIED), nVal < 0 (ERROR CODE) - hs_Verify( <bSource>, <cValue> ) -> lOK + --> nVal = {0|1} (VERIFIED), nVal < 0 (ERROR CODE) + hs_Verify( <bSource>, <cValue> ) --> lOK Verifies hs_Next() hit against code block expression */ HB_FUNC( HS_VERIFY ) { @@ -2014,7 +2025,7 @@ HB_FUNC( HS_VERIFY ) } } -/* hs_Version() -> <cVersion> */ +/* hs_Version() --> <cVersion> */ HB_FUNC( HS_VERSION ) { static const char sc_szVer[] = "HiPer-SEEK / FTS library emulation"; diff --git a/src/rdd/ordwldsk.c b/src/rdd/ordwldsk.c index f424c2a771..bf09aed877 100644 --- a/src/rdd/ordwldsk.c +++ b/src/rdd/ordwldsk.c @@ -75,8 +75,6 @@ HB_FUNC( ORDWILDSEEK ) if( ! fCont ) { - const char * szKey; - if( fBack ) errCode = SELF_GOBOTTOM( pArea ); else @@ -86,10 +84,7 @@ HB_FUNC( ORDWILDSEEK ) { errCode = SELF_ORDINFO( pArea, DBOI_KEYVAL, &OrderInfo ); if( errCode == HB_SUCCESS ) - { - szKey = hb_itemGetCPtr( OrderInfo.itmResult ); - fFound = hb_strMatchWild( szKey, szPattern ); - } + fFound = hb_strMatchWild( hb_itemGetCPtr( OrderInfo.itmResult ), szPattern ); } } if( ! fFound && errCode == HB_SUCCESS ) diff --git a/src/rdd/rddinfo.c b/src/rdd/rddinfo.c index 99012493f7..777f5b00e0 100644 --- a/src/rdd/rddinfo.c +++ b/src/rdd/rddinfo.c @@ -45,7 +45,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #ifndef HB_CLP_STRICT diff --git a/src/rdd/rddshort.c b/src/rdd/rddshort.c index 079d7b5444..dca2ab0757 100644 --- a/src/rdd/rddshort.c +++ b/src/rdd/rddshort.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( __DBARRANG, __DBARRANGE ) HB_FUNC_TRANSLATE( __DBCLEARI, __DBCLEARINDEX ) diff --git a/src/rdd/sdf1.c b/src/rdd/sdf1.c index 71c3312a47..98c4f99cf9 100644 --- a/src/rdd/sdf1.c +++ b/src/rdd/sdf1.c @@ -66,7 +66,7 @@ static void hb_sdfInitArea( SDFAREAP pArea, char * szFileName ) { const char * szEol; - /* Allocate only after succesfully open file */ + /* Allocate only after successfully open file */ pArea->szFileName = hb_strdup( szFileName ); /* set line separator: EOL */ @@ -108,7 +108,7 @@ static HB_ERRCODE hb_sdfReadRecord( SDFAREAP pArea ) { HB_SIZE nRead; - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfReadRecord(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfReadRecord(%p)", ( void * ) pArea ) ); pArea->area.fEof = HB_TRUE; @@ -181,7 +181,7 @@ static HB_ERRCODE hb_sdfReadRecord( SDFAREAP pArea ) static HB_ERRCODE hb_sdfNextRecord( SDFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfNextRecord(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfNextRecord(%p)", ( void * ) pArea ) ); if( pArea->fPositioned ) { @@ -200,7 +200,7 @@ static HB_ERRCODE hb_sdfNextRecord( SDFAREAP pArea ) */ static HB_ERRCODE hb_sdfGoTo( SDFAREAP pArea, HB_ULONG ulRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoTo(%p, %lu)", pArea, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoTo(%p, %lu)", ( void * ) pArea, ulRecNo ) ); #ifndef HB_CLP_STRICT if( pArea->fReadonly && ulRecNo >= pArea->ulRecNo ) @@ -222,7 +222,7 @@ static HB_ERRCODE hb_sdfGoTo( SDFAREAP pArea, HB_ULONG ulRecNo ) */ static HB_ERRCODE hb_sdfGoToId( SDFAREAP pArea, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoToId(%p, %p)", pArea, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoToId(%p, %p)", ( void * ) pArea, ( void * ) pItem ) ); #ifndef HB_CLP_STRICT if( HB_IS_NUMERIC( pItem ) ) @@ -237,7 +237,7 @@ static HB_ERRCODE hb_sdfGoToId( SDFAREAP pArea, PHB_ITEM pItem ) */ static HB_ERRCODE hb_sdfGoTop( SDFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoTop(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoTop(%p)", ( void * ) pArea ) ); if( SELF_GOCOLD( &pArea->area ) != HB_SUCCESS ) return HB_FAILURE; @@ -264,7 +264,7 @@ static HB_ERRCODE hb_sdfGoTop( SDFAREAP pArea ) */ static HB_ERRCODE hb_sdfSkipRaw( SDFAREAP pArea, HB_LONG lToSkip ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfSkipRaw(%p,%ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfSkipRaw(%p,%ld)", ( void * ) pArea, lToSkip ) ); if( SELF_GOCOLD( &pArea->area ) != HB_SUCCESS ) return HB_FAILURE; @@ -281,7 +281,7 @@ static HB_ERRCODE hb_sdfSkipRaw( SDFAREAP pArea, HB_LONG lToSkip ) */ static HB_ERRCODE hb_sdfDeleted( SDFAREAP pArea, HB_BOOL * pDeleted ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfDeleted(%p,%p)", pArea, pDeleted ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfDeleted(%p,%p)", ( void * ) pArea, ( void * ) pDeleted ) ); HB_SYMBOL_UNUSED( pArea ); @@ -295,7 +295,7 @@ static HB_ERRCODE hb_sdfDeleted( SDFAREAP pArea, HB_BOOL * pDeleted ) */ static HB_ERRCODE hb_sdfRecCount( SDFAREAP pArea, HB_ULONG * pRecCount ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecCount(%p,%p)", pArea, pRecCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecCount(%p,%p)", ( void * ) pArea, ( void * ) pRecCount ) ); *pRecCount = pArea->ulRecCount; @@ -307,7 +307,7 @@ static HB_ERRCODE hb_sdfRecCount( SDFAREAP pArea, HB_ULONG * pRecCount ) */ static HB_ERRCODE hb_sdfRecNo( SDFAREAP pArea, HB_ULONG * pulRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecNo(%p,%p)", pArea, pulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecNo(%p,%p)", ( void * ) pArea, ( void * ) pulRecNo ) ); *pulRecNo = pArea->ulRecNo; @@ -322,7 +322,7 @@ static HB_ERRCODE hb_sdfRecId( SDFAREAP pArea, PHB_ITEM pRecNo ) HB_ERRCODE errCode; HB_ULONG ulRecNo; - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecId(%p,%p)", pArea, pRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecId(%p,%p)", ( void * ) pArea, ( void * ) pRecNo ) ); errCode = SELF_RECNO( &pArea->area, &ulRecNo ); @@ -348,7 +348,7 @@ static HB_ERRCODE hb_sdfRecId( SDFAREAP pArea, PHB_ITEM pRecNo ) */ static HB_ERRCODE hb_sdfAppend( SDFAREAP pArea, HB_BOOL fUnLockAll ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfAppend(%p,%d)", pArea, ( int ) fUnLockAll ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfAppend(%p,%d)", ( void * ) pArea, ( int ) fUnLockAll ) ); HB_SYMBOL_UNUSED( fUnLockAll ); @@ -371,7 +371,7 @@ static HB_ERRCODE hb_sdfAppend( SDFAREAP pArea, HB_BOOL fUnLockAll ) */ static HB_ERRCODE hb_sdfDeleteRec( SDFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfDeleteRec(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfDeleteRec(%p)", ( void * ) pArea ) ); HB_SYMBOL_UNUSED( pArea ); @@ -394,7 +394,7 @@ static HB_ERRCODE hb_sdfDeleteRec( SDFAREAP pArea ) */ static HB_ERRCODE hb_sdfRecall( SDFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecall(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecall(%p)", ( void * ) pArea ) ); HB_SYMBOL_UNUSED( pArea ); @@ -408,7 +408,7 @@ static HB_ERRCODE hb_sdfGetValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI { LPFIELD pField; - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGetValue(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGetValue(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( --uiIndex >= pArea->area.uiFieldCount ) return HB_FAILURE; @@ -512,12 +512,11 @@ static HB_ERRCODE hb_sdfGetValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI */ static HB_ERRCODE hb_sdfPutValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { - char szBuffer[ 256 ]; HB_ERRCODE errCode; LPFIELD pField; HB_SIZE nSize; - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfPutValue(%p,%hu,%p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfPutValue(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( ! pArea->fPositioned ) return HB_SUCCESS; @@ -532,6 +531,8 @@ static HB_ERRCODE hb_sdfPutValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI pField = pArea->area.lpFields + uiIndex; if( pField->uiType != HB_FT_MEMO && pField->uiType != HB_FT_NONE ) { + char szBuffer[ 256 ]; + if( HB_IS_MEMO( pItem ) || HB_IS_STRING( pItem ) ) { if( pField->uiType == HB_FT_STRING ) @@ -632,7 +633,7 @@ static HB_ERRCODE hb_sdfPutValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI */ static HB_ERRCODE hb_sdfPutRec( SDFAREAP pArea, HB_BYTE * pBuffer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfPutRec(%p,%p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfPutRec(%p,%p)", ( void * ) pArea, ( void * ) pBuffer ) ); if( ! pArea->fPositioned ) return HB_SUCCESS; @@ -651,7 +652,7 @@ static HB_ERRCODE hb_sdfPutRec( SDFAREAP pArea, HB_BYTE * pBuffer ) */ static HB_ERRCODE hb_sdfGetRec( SDFAREAP pArea, HB_BYTE ** pBufferPtr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGetRec(%p,%p)", pArea, pBufferPtr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGetRec(%p,%p)", ( void * ) pArea, ( void * ) pBufferPtr ) ); *pBufferPtr = pArea->pRecord - 1; @@ -663,7 +664,7 @@ static HB_ERRCODE hb_sdfGetRec( SDFAREAP pArea, HB_BYTE ** pBufferPtr ) */ static HB_ERRCODE hb_sdfTrans( SDFAREAP pArea, LPDBTRANSINFO pTransInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfTrans(%p, %p)", pArea, pTransInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfTrans(%p, %p)", ( void * ) pArea, ( void * ) pTransInfo ) ); if( pTransInfo->uiFlags & DBTF_MATCH ) { @@ -694,7 +695,7 @@ static HB_ERRCODE hb_sdfTrans( SDFAREAP pArea, LPDBTRANSINFO pTransInfo ) */ static HB_ERRCODE hb_sdfGoCold( SDFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoCold(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoCold(%p)", ( void * ) pArea ) ); if( pArea->fRecordChanged ) { @@ -724,7 +725,7 @@ static HB_ERRCODE hb_sdfGoCold( SDFAREAP pArea ) */ static HB_ERRCODE hb_sdfGoHot( SDFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoHot(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfGoHot(%p)", ( void * ) pArea ) ); if( pArea->fReadonly ) { @@ -747,7 +748,7 @@ static HB_ERRCODE hb_sdfFlush( SDFAREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfFlush(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfFlush(%p)", ( void * ) pArea ) ); errCode = SELF_GOCOLD( &pArea->area ); @@ -765,7 +766,7 @@ static HB_ERRCODE hb_sdfFlush( SDFAREAP pArea ) */ static HB_ERRCODE hb_sdfInfo( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfInfo(%p,%hu,%p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfInfo(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); switch( uiIndex ) { @@ -825,7 +826,7 @@ static HB_ERRCODE hb_sdfInfo( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem */ static HB_ERRCODE hb_sdfAddField( SDFAREAP pArea, LPDBFIELDINFO pFieldInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfAddField(%p, %p)", pArea, pFieldInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfAddField(%p, %p)", ( void * ) pArea, ( void * ) pFieldInfo ) ); switch( pFieldInfo->uiType ) { @@ -938,7 +939,7 @@ static HB_ERRCODE hb_sdfAddField( SDFAREAP pArea, LPDBFIELDINFO pFieldInfo ) */ static HB_ERRCODE hb_sdfSetFieldExtent( SDFAREAP pArea, HB_USHORT uiFieldExtent ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfSetFieldExtent(%p,%hu)", pArea, uiFieldExtent ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfSetFieldExtent(%p,%hu)", ( void * ) pArea, uiFieldExtent ) ); if( SUPER_SETFIELDEXTENT( &pArea->area, uiFieldExtent ) == HB_FAILURE ) return HB_FAILURE; @@ -955,7 +956,7 @@ static HB_ERRCODE hb_sdfSetFieldExtent( SDFAREAP pArea, HB_USHORT uiFieldExtent */ static HB_ERRCODE hb_sdfNewArea( SDFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfNewArea(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfNewArea(%p)", ( void * ) pArea ) ); if( SUPER_NEW( &pArea->area ) == HB_FAILURE ) return HB_FAILURE; @@ -973,7 +974,7 @@ static HB_ERRCODE hb_sdfNewArea( SDFAREAP pArea ) */ static HB_ERRCODE hb_sdfStructSize( SDFAREAP pArea, HB_USHORT * uiSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfStrucSize(%p,%p)", pArea, uiSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfStrucSize(%p,%p)", ( void * ) pArea, ( void * ) uiSize ) ); HB_SYMBOL_UNUSED( pArea ); *uiSize = sizeof( SDFAREA ); @@ -985,7 +986,7 @@ static HB_ERRCODE hb_sdfStructSize( SDFAREAP pArea, HB_USHORT * uiSize ) */ static HB_ERRCODE hb_sdfClose( SDFAREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfClose(%p)", ( void * ) pArea ) ); /* Update record and unlock records */ if( pArea->pFile ) @@ -1044,7 +1045,7 @@ static HB_ERRCODE hb_sdfCreate( SDFAREAP pArea, LPDBOPENINFO pCreateInfo ) PHB_FNAME pFileName; char szFileName[ HB_PATH_MAX ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfCreate(%p,%p)", pArea, pCreateInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfCreate(%p,%p)", ( void * ) pArea, ( void * ) pCreateInfo ) ); pArea->fShared = HB_FALSE; /* pCreateInfo->fShared; */ pArea->fReadonly = HB_FALSE; /* pCreateInfo->fReadonly */ @@ -1136,7 +1137,7 @@ static HB_ERRCODE hb_sdfOpen( SDFAREAP pArea, LPDBOPENINFO pOpenInfo ) char szFileName[ HB_PATH_MAX ]; char szAlias[ HB_RDD_MAX_ALIAS_LEN + 1 ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfOpen(%p,%p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfOpen(%p,%p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); pArea->fShared = HB_TRUE; /* pOpenInfo->fShared; */ pArea->fReadonly = HB_TRUE; /* pOpenInfo->fReadonly; */ @@ -1232,7 +1233,7 @@ static HB_ERRCODE hb_sdfOpen( SDFAREAP pArea, LPDBOPENINFO pOpenInfo ) */ static HB_ERRCODE hb_sdfRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulConnect, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRddInfo(%p,%hu,%lu,%p)", pRDD, uiIndex, ulConnect, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRddInfo(%p,%hu,%lu,%p)", ( void * ) pRDD, uiIndex, ulConnect, ( void * ) pItem ) ); switch( uiIndex ) { @@ -1368,7 +1369,7 @@ HB_FUNC_STATIC( SDF_GETFUNCTABLE ) puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); - HB_TRACE( HB_TR_DEBUG, ( "SDF_GETFUNCTABLE(%p, %p)", puiCount, pTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "SDF_GETFUNCTABLE(%p, %p)", ( void * ) puiCount, ( void * ) pTable ) ); if( pTable ) { diff --git a/src/rdd/usrrdd/usrrdd.c b/src/rdd/usrrdd/usrrdd.c index c4bdfe2be3..a1e39d8351 100644 --- a/src/rdd/usrrdd/usrrdd.c +++ b/src/rdd/usrrdd/usrrdd.c @@ -432,14 +432,14 @@ static PHB_ITEM hb_usrTransInfoToItem( LPDBTRANSINFO pTransInfo ) hb_itemPutNI( hb_arrayGetItemPtr( pItem, UR_TI_ITEMCOUNT ), pTransInfo->uiItemCount ); if( pTransInfo->uiItemCount ) { - PHB_ITEM pItems = hb_arrayGetItemPtr( pItem, UR_TI_ITEMS ), pItm; + PHB_ITEM pItems = hb_arrayGetItemPtr( pItem, UR_TI_ITEMS ); LPDBTRANSITEM pTransItem = pTransInfo->lpTransItems; HB_USHORT uiCount; hb_arrayNew( pItems, pTransInfo->uiItemCount ); for( uiCount = 1; uiCount <= pTransInfo->uiItemCount; ++uiCount, ++pTransItem ) { - pItm = hb_arrayGetItemPtr( pItems, uiCount ); + PHB_ITEM pItm = hb_arrayGetItemPtr( pItems, uiCount ); hb_arrayNew( pItm, UR_TITEM_SIZE ); hb_itemPutNI( hb_arrayGetItemPtr( pItm, UR_TITEM_SOURCE ), pTransItem->uiSource ); hb_itemPutNI( hb_arrayGetItemPtr( pItm, UR_TITEM_DESTIN ), pTransItem->uiDest ); @@ -455,7 +455,7 @@ static HB_BOOL hb_usrItemToTransInfo( PHB_ITEM pItem, LPDBTRANSINFO pTransInfo ) if( pItem && hb_arrayLen( pItem ) == UR_TI_SIZE ) { HB_USHORT uiItemCount = ( HB_USHORT ) hb_arrayGetNI( pItem, UR_TI_ITEMCOUNT ), uiCount; - PHB_ITEM pItems = hb_arrayGetItemPtr( pItem, UR_TI_ITEMS ), pItm; + PHB_ITEM pItems = hb_arrayGetItemPtr( pItem, UR_TI_ITEMS ); if( hb_arrayLen( pItems ) == ( HB_SIZE ) uiItemCount && hb_usrItemToScopeInfo( hb_arrayGetItemPtr( pItem, UR_TI_SCOPE ), @@ -474,7 +474,7 @@ static HB_BOOL hb_usrItemToTransInfo( PHB_ITEM pItem, LPDBTRANSINFO pTransInfo ) for( uiCount = 1; uiCount <= uiItemCount; ++uiCount, ++pTransItem ) { - pItm = hb_arrayGetItemPtr( pItems, uiCount ); + PHB_ITEM pItm = hb_arrayGetItemPtr( pItems, uiCount ); pTransItem->uiSource = ( HB_USHORT ) hb_arrayGetNI( pItm, UR_TITEM_SOURCE ); pTransItem->uiDest = ( HB_USHORT ) hb_arrayGetNI( pItm, UR_TITEM_DESTIN ); } @@ -505,14 +505,14 @@ static PHB_ITEM hb_usrSortInfoToItem( LPDBSORTINFO pSortInfo ) hb_itemPutNI( hb_arrayGetItemPtr( pItem, UR_SRI_ITEMCOUNT ), pSortInfo->uiItemCount ); if( pSortInfo->uiItemCount ) { - PHB_ITEM pItems = hb_arrayGetItemPtr( pItem, UR_SRI_ITEMS ), pItm; + PHB_ITEM pItems = hb_arrayGetItemPtr( pItem, UR_SRI_ITEMS ); LPDBSORTITEM pSortItem = pSortInfo->lpdbsItem; HB_USHORT uiCount; hb_arrayNew( pItems, pSortInfo->uiItemCount ); for( uiCount = 1; uiCount <= pSortInfo->uiItemCount; ++uiCount, ++pSortItem ) { - pItm = hb_arrayGetItemPtr( pItems, uiCount ); + PHB_ITEM pItm = hb_arrayGetItemPtr( pItems, uiCount ); hb_arrayNew( pItm, UR_SITEM_SIZE ); hb_itemPutNI( hb_arrayGetItemPtr( pItm, UR_SITEM_FIELD ), pSortItem->uiField ); hb_itemPutNI( hb_arrayGetItemPtr( pItm, UR_SITEM_FLAGS ), pSortItem->uiFlags ); @@ -528,7 +528,7 @@ static HB_BOOL hb_usrItemToSortInfo( PHB_ITEM pItem, LPDBSORTINFO pSortInfo ) if( pItem && hb_arrayLen( pItem ) == UR_SRI_SIZE ) { HB_USHORT uiItemCount = ( HB_USHORT ) hb_arrayGetNI( pItem, UR_SRI_ITEMCOUNT ), uiCount; - PHB_ITEM pItems = hb_arrayGetItemPtr( pItem, UR_SRI_ITEMS ), pItm; + PHB_ITEM pItems = hb_arrayGetItemPtr( pItem, UR_SRI_ITEMS ); if( hb_arrayLen( pItems ) == ( HB_SIZE ) uiItemCount && hb_usrItemToTransInfo( hb_arrayGetItemPtr( pItem, UR_SRI_TRANSINFO ), @@ -544,7 +544,7 @@ static HB_BOOL hb_usrItemToSortInfo( PHB_ITEM pItem, LPDBSORTINFO pSortInfo ) for( uiCount = 1; uiCount <= uiItemCount; ++uiCount, ++pSortItem ) { - pItm = hb_arrayGetItemPtr( pItems, uiCount ); + PHB_ITEM pItm = hb_arrayGetItemPtr( pItems, uiCount ); pSortItem->uiField = ( HB_USHORT ) hb_arrayGetNI( pItm, UR_SITEM_FIELD ); pSortItem->uiFlags = ( HB_USHORT ) hb_arrayGetNI( pItm, UR_SITEM_FLAGS ); } @@ -712,12 +712,11 @@ static void hb_usrOrderCondClone( LPDBORDERCONDINFO pOrderCondInfo ) static PHB_ITEM hb_usrOrderCreateInfoToItem( LPDBORDERCREATEINFO pOrderCreateInfo ) { - PHB_ITEM pItem, pCond; + PHB_ITEM pItem = hb_itemArrayNew( UR_ORCR_SIZE ); - pItem = hb_itemArrayNew( UR_ORCR_SIZE ); if( pOrderCreateInfo->lpdbOrdCondInfo ) { - pCond = hb_usrOrderCondInfoToItem( pOrderCreateInfo->lpdbOrdCondInfo ); + PHB_ITEM pCond = hb_usrOrderCondInfoToItem( pOrderCreateInfo->lpdbOrdCondInfo ); hb_arraySet( pItem, UR_ORCR_CONDINFO, pCond ); hb_itemRelease( pCond ); } @@ -787,7 +786,7 @@ static HB_ERRCODE hb_usrInit( LPRDDNODE pRDD ) HB_ERRCODE errCode; LPUSRRDDNODE pNode; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrInit(%p)", pRDD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrInit(%p)", ( void * ) pRDD ) ); if( pRDD->rddID >= s_uiUsrNodes ) { @@ -824,7 +823,7 @@ static HB_ERRCODE hb_usrExit( LPRDDNODE pRDD ) HB_ERRCODE errCode; LPUSRRDDNODE pNode; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrExit(%p)", pRDD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrExit(%p)", ( void * ) pRDD ) ); pNode = s_pUsrRddNodes[ pRDD->rddID ]; hb_usrEvalRddFunc( pNode->pMethods, UR_EXIT, pRDD->rddID ); @@ -867,7 +866,7 @@ static HB_ERRCODE hb_usrStructSize( AREAP pArea, HB_USHORT * puiSize ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrStrucSize(%p, %p)", pArea, puiSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrStrucSize(%p, %p)", ( void * ) pArea, ( void * ) puiSize ) ); errCode = SUPER_STRUCTSIZE( pArea, puiSize ); s_pUsrRddNodes[ pArea->rddID ]->uiDataOffset = *puiSize; @@ -880,14 +879,14 @@ static HB_ERRCODE hb_usrSysName( AREAP pArea, char * szSysName ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSysName(%p,%p)", pArea, szSysName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSysName(%p,%p)", ( void * ) pArea, ( void * ) szSysName ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushNil(); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SYSNAME ) ) { hb_stackPop(); - hb_strncpy( ( char * ) szSysName, SELF_RDDNODE( pArea )->szName, + hb_strncpy( szSysName, SELF_RDDNODE( pArea )->szName, HB_RDD_MAX_DRIVERNAME_LEN ); return HB_SUCCESS; } @@ -896,7 +895,7 @@ static HB_ERRCODE hb_usrSysName( AREAP pArea, char * szSysName ) hb_xvmPushLocalByRef( ( HB_SHORT ) nOffset ); hb_vmDo( 2 ); - hb_strncpy( ( char * ) szSysName, hb_itemGetCPtr( hb_stackItemFromBase( nOffset ) ), + hb_strncpy( szSysName, hb_itemGetCPtr( hb_stackItemFromBase( nOffset ) ), HB_RDD_MAX_DRIVERNAME_LEN ); hb_stackPop(); @@ -907,7 +906,7 @@ static HB_ERRCODE hb_usrNewArea( AREAP pArea ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrNewArea(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrNewArea(%p)", ( void * ) pArea ) ); errCode = SUPER_NEW( pArea ); @@ -924,7 +923,7 @@ static HB_ERRCODE hb_usrRelease( AREAP pArea ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRelease(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRelease(%p)", ( void * ) pArea ) ); hb_usrEvalAreaFunc( SELF_USRNODE( pArea )->pMethods, UR_RELEASE, pArea ); @@ -948,7 +947,7 @@ static HB_ERRCODE hb_usrBof( AREAP pArea, HB_BOOL * pBof ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrBof(%p, %p)", pArea, pBof ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrBof(%p, %p)", ( void * ) pArea, ( void * ) pBof ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushLogical( pArea->fBof ); @@ -975,7 +974,7 @@ static HB_ERRCODE hb_usrEof( AREAP pArea, HB_BOOL * pEof ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrEof(%p, %p)", pArea, pEof ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrEof(%p, %p)", ( void * ) pArea, ( void * ) pEof ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushLogical( pArea->fEof ); @@ -1002,7 +1001,7 @@ static HB_ERRCODE hb_usrFound( AREAP pArea, HB_BOOL * pFound ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrFound(%p, %p)", pArea, pFound ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrFound(%p, %p)", ( void * ) pArea, ( void * ) pFound ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushLogical( pArea->fFound ); @@ -1027,7 +1026,7 @@ static HB_ERRCODE hb_usrFound( AREAP pArea, HB_BOOL * pFound ) static HB_ERRCODE hb_usrGoBottom( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoBottom(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoBottom(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_GOBOTTOM ) ) return SUPER_GOBOTTOM( pArea ); @@ -1040,7 +1039,7 @@ static HB_ERRCODE hb_usrGoBottom( AREAP pArea ) static HB_ERRCODE hb_usrGoTop( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoTop(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoTop(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_GOTOP ) ) return SUPER_GOTOP( pArea ); @@ -1053,7 +1052,7 @@ static HB_ERRCODE hb_usrGoTop( AREAP pArea ) static HB_ERRCODE hb_usrGoTo( AREAP pArea, HB_ULONG ulRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoTo(%p,%lu)", pArea, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoTo(%p,%lu)", ( void * ) pArea, ulRecNo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_GOTO ) ) return SUPER_GOTO( pArea, ulRecNo ); @@ -1067,7 +1066,7 @@ static HB_ERRCODE hb_usrGoTo( AREAP pArea, HB_ULONG ulRecNo ) static HB_ERRCODE hb_usrGoToId( AREAP pArea, PHB_ITEM pRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoToId(%p,%p)", pArea, pRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoToId(%p,%p)", ( void * ) pArea, ( void * ) pRecNo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_GOTOID ) ) return SUPER_GOTOID( pArea, pRecNo ); @@ -1081,7 +1080,7 @@ static HB_ERRCODE hb_usrGoToId( AREAP pArea, PHB_ITEM pRecNo ) static HB_ERRCODE hb_usrSeek( AREAP pArea, HB_BOOL fSoftSeek, PHB_ITEM pItem, HB_BOOL fFindLast ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSeek(%p,%d,%p,%d)", pArea, fSoftSeek, pItem, fFindLast ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSeek(%p,%d,%p,%d)", ( void * ) pArea, fSoftSeek, ( void * ) pItem, fFindLast ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SEEK ) ) return SUPER_SEEK( pArea, fSoftSeek, pItem, fFindLast ); @@ -1097,7 +1096,7 @@ static HB_ERRCODE hb_usrSeek( AREAP pArea, HB_BOOL fSoftSeek, PHB_ITEM pItem, HB static HB_ERRCODE hb_usrSkip( AREAP pArea, HB_LONG lRecords ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSkip(%p,%ld)", pArea, lRecords ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSkip(%p,%ld)", ( void * ) pArea, lRecords ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SKIP ) ) return SUPER_SKIP( pArea, lRecords ); @@ -1111,7 +1110,7 @@ static HB_ERRCODE hb_usrSkip( AREAP pArea, HB_LONG lRecords ) static HB_ERRCODE hb_usrSkipFilter( AREAP pArea, HB_LONG lDirect ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSkipFilter(%p,%ld)", pArea, lDirect ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSkipFilter(%p,%ld)", ( void * ) pArea, lDirect ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SKIPFILTER ) ) return SUPER_SKIPFILTER( pArea, lDirect ); @@ -1125,7 +1124,7 @@ static HB_ERRCODE hb_usrSkipFilter( AREAP pArea, HB_LONG lDirect ) static HB_ERRCODE hb_usrSkipRaw( AREAP pArea, HB_LONG lRecords ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSkipRaw(%p,%ld)", pArea, lRecords ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSkipRaw(%p,%ld)", ( void * ) pArea, lRecords ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SKIPRAW ) ) return SUPER_SKIPRAW( pArea, lRecords ); @@ -1146,7 +1145,7 @@ static HB_ERRCODE hb_usrDeleted( AREAP pArea, HB_BOOL * pDeleted ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrDeleted(%p, %p)", pArea, pDeleted ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrDeleted(%p, %p)", ( void * ) pArea, ( void * ) pDeleted ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushLogical( HB_FALSE ); @@ -1172,7 +1171,7 @@ static HB_ERRCODE hb_usrAddField( AREAP pArea, LPDBFIELDINFO pFieldInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrAddField(%p, %p)", pArea, pFieldInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrAddField(%p, %p)", ( void * ) pArea, ( void * ) pFieldInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ADDFIELD ) ) return SUPER_ADDFIELD( pArea, pFieldInfo ); @@ -1191,7 +1190,7 @@ static HB_ERRCODE hb_usrFieldDisplay( AREAP pArea, LPDBFIELDINFO pFieldInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrFieldDisplay(%p, %p)", pArea, pFieldInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrFieldDisplay(%p, %p)", ( void * ) pArea, ( void * ) pFieldInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_FIELDDISPLAY ) ) return SUPER_FIELDDISPLAY( pArea, pFieldInfo ); @@ -1210,7 +1209,7 @@ static HB_ERRCODE hb_usrFieldName( AREAP pArea, HB_USHORT uiIndex, char * szName { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrFieldName(%p,%hu,%p)", pArea, uiIndex, szName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrFieldName(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) szName ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushNil(); @@ -1225,7 +1224,7 @@ static HB_ERRCODE hb_usrFieldName( AREAP pArea, HB_USHORT uiIndex, char * szName hb_xvmPushLocalByRef( ( HB_SHORT ) nOffset ); hb_vmDo( 3 ); - hb_strncpy( ( char * ) szName, hb_itemGetCPtr( hb_stackItemFromBase( nOffset ) ), + hb_strncpy( szName, hb_itemGetCPtr( hb_stackItemFromBase( nOffset ) ), pArea->uiMaxFieldNameLength ); hb_stackPop(); @@ -1234,7 +1233,7 @@ static HB_ERRCODE hb_usrFieldName( AREAP pArea, HB_USHORT uiIndex, char * szName static HB_ERRCODE hb_usrAppend( AREAP pArea, HB_BOOL fUnLockAll ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrAppend(%p, %d)", pArea, fUnLockAll ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrAppend(%p, %d)", ( void * ) pArea, fUnLockAll ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_APPEND ) ) return SUPER_APPEND( pArea, fUnLockAll ); @@ -1248,7 +1247,7 @@ static HB_ERRCODE hb_usrAppend( AREAP pArea, HB_BOOL fUnLockAll ) static HB_ERRCODE hb_usrDelete( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrDelete(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrDelete(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_DELETE ) ) return SUPER_DELETE( pArea ); @@ -1261,7 +1260,7 @@ static HB_ERRCODE hb_usrDelete( AREAP pArea ) static HB_ERRCODE hb_usrRecall( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecall(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecall(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_RECALL ) ) return SUPER_RECALL( pArea ); @@ -1276,7 +1275,7 @@ static HB_ERRCODE hb_usrFieldCount( AREAP pArea, HB_USHORT * puiFields ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrFieldCount(%p,%p)", pArea, puiFields ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrFieldCount(%p,%p)", ( void * ) pArea, ( void * ) puiFields ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushInteger( 0 ); @@ -1298,7 +1297,7 @@ static HB_ERRCODE hb_usrFieldCount( AREAP pArea, HB_USHORT * puiFields ) static HB_ERRCODE hb_usrFlush( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrFlush(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrFlush(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_FLUSH ) ) return SUPER_FLUSH( pArea ); @@ -1311,7 +1310,7 @@ static HB_ERRCODE hb_usrFlush( AREAP pArea ) static HB_ERRCODE hb_usrGoCold( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoCold(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoCold(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_GOCOLD ) ) return SUPER_GOCOLD( pArea ); @@ -1324,7 +1323,7 @@ static HB_ERRCODE hb_usrGoCold( AREAP pArea ) static HB_ERRCODE hb_usrGoHot( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoHot(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGoHot(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_GOHOT ) ) return SUPER_GOHOT( pArea ); @@ -1337,7 +1336,7 @@ static HB_ERRCODE hb_usrGoHot( AREAP pArea ) static HB_ERRCODE hb_usrPutRec( AREAP pArea, const HB_BYTE * pBuffer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrPutRec(%p,%p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrPutRec(%p,%p)", ( void * ) pArea, ( const void * ) pBuffer ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_PUTREC ) ) return SUPER_PUTREC( pArea, pBuffer ); @@ -1354,7 +1353,7 @@ static HB_ERRCODE hb_usrGetRec( AREAP pArea, HB_BYTE ** pBuffer ) PHB_ITEM pItem; int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGetRec(%p,%p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGetRec(%p,%p)", ( void * ) pArea, ( void * ) pBuffer ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushNil(); @@ -1380,7 +1379,7 @@ static HB_ERRCODE hb_usrGetRec( AREAP pArea, HB_BYTE ** pBuffer ) static HB_ERRCODE hb_usrGetValue( AREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGetValue(%p,%hu,%p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGetValue(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_GETVALUE ) ) return SUPER_GETVALUE( pArea, uiIndex, pItem ); @@ -1395,7 +1394,7 @@ static HB_ERRCODE hb_usrGetValue( AREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem static HB_ERRCODE hb_usrPutValue( AREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrPutValue(%p,%hu,%p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrPutValue(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_PUTVALUE ) ) return SUPER_PUTVALUE( pArea, uiIndex, pItem ); @@ -1412,7 +1411,7 @@ static HB_ERRCODE hb_usrGetVarLen( AREAP pArea, HB_USHORT uiIndex, HB_ULONG * pu { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGetVarLen(%p,%hu,%p)", pArea, uiIndex, pulLength ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGetVarLen(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) pulLength ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushInteger( 0 ); @@ -1437,7 +1436,7 @@ static HB_ERRCODE hb_usrRecCount( AREAP pArea, HB_ULONG * pulRecCount ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecCount(%p,%p)", pArea, pulRecCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecCount(%p,%p)", ( void * ) pArea, ( void * ) pulRecCount ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushInteger( 0 ); @@ -1459,7 +1458,7 @@ static HB_ERRCODE hb_usrRecCount( AREAP pArea, HB_ULONG * pulRecCount ) static HB_ERRCODE hb_usrRecInfo( AREAP pArea, PHB_ITEM pRecID, HB_USHORT uiInfoType, PHB_ITEM pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecInfo(%p,%p,%hu,%p)", pArea, pRecID, uiInfoType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecInfo(%p,%p,%hu,%p)", ( void * ) pArea, ( void * ) pRecID, uiInfoType, ( void * ) pInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_RECINFO ) ) return SUPER_RECINFO( pArea, pRecID, uiInfoType, pInfo ); @@ -1477,7 +1476,7 @@ static HB_ERRCODE hb_usrRecNo( AREAP pArea, HB_ULONG * pulRecNo ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecNo(%p,%p)", pArea, pulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecNo(%p,%p)", ( void * ) pArea, ( void * ) pulRecNo ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushInteger( 0 ); @@ -1499,7 +1498,7 @@ static HB_ERRCODE hb_usrRecNo( AREAP pArea, HB_ULONG * pulRecNo ) static HB_ERRCODE hb_usrRecId( AREAP pArea, PHB_ITEM pRecId ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecId(%p,%p)", pArea, pRecId ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRecId(%p,%p)", ( void * ) pArea, ( void * ) pRecId ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_RECID ) ) return SUPER_RECID( pArea, pRecId ); @@ -1513,7 +1512,7 @@ static HB_ERRCODE hb_usrRecId( AREAP pArea, PHB_ITEM pRecId ) static HB_ERRCODE hb_usrFieldInfo( AREAP pArea, HB_USHORT uiIndex, HB_USHORT uiInfoType, PHB_ITEM pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrFieldInfo(%p,%hu,%hu,%p)", pArea, uiIndex, uiInfoType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrFieldInfo(%p,%hu,%hu,%p)", ( void * ) pArea, uiIndex, uiInfoType, ( void * ) pInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_FIELDINFO ) ) return SUPER_FIELDINFO( pArea, uiIndex, uiInfoType, pInfo ); @@ -1529,7 +1528,7 @@ static HB_ERRCODE hb_usrFieldInfo( AREAP pArea, HB_USHORT uiIndex, HB_USHORT uiI static HB_ERRCODE hb_usrCreateFields( AREAP pArea, PHB_ITEM pStruct ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrCreateFields(%p,%p)", pArea, pStruct ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrCreateFields(%p,%p)", ( void * ) pArea, ( void * ) pStruct ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CREATEFIELDS ) ) return SUPER_CREATEFIELDS( pArea, pStruct ); @@ -1543,7 +1542,7 @@ static HB_ERRCODE hb_usrCreateFields( AREAP pArea, PHB_ITEM pStruct ) static HB_ERRCODE hb_usrSetFieldExtent( AREAP pArea, HB_USHORT uiFieldExtent ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSetFieldExtent(%p,%hu)", pArea, uiFieldExtent ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSetFieldExtent(%p,%hu)", ( void * ) pArea, uiFieldExtent ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SETFIELDEXTENT ) ) return SUPER_SETFIELDEXTENT( pArea, uiFieldExtent ); @@ -1564,7 +1563,7 @@ static HB_ERRCODE hb_usrAlias( AREAP pArea, char * szAlias ) { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrAlias(%p,%p)", pArea, szAlias ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrAlias(%p,%p)", ( void * ) pArea, ( void * ) szAlias ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushNil(); @@ -1578,7 +1577,7 @@ static HB_ERRCODE hb_usrAlias( AREAP pArea, char * szAlias ) hb_xvmPushLocalByRef( ( HB_SHORT ) nOffset ); hb_vmDo( 2 ); - hb_strncpy( ( char * ) szAlias, hb_itemGetCPtr( hb_stackItemFromBase( nOffset ) ), + hb_strncpy( szAlias, hb_itemGetCPtr( hb_stackItemFromBase( nOffset ) ), HB_RDD_MAX_ALIAS_LEN ); hb_stackPop(); @@ -1587,7 +1586,7 @@ static HB_ERRCODE hb_usrAlias( AREAP pArea, char * szAlias ) static HB_ERRCODE hb_usrClose( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrClose(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CLOSE ) ) return SUPER_CLOSE( pArea ); @@ -1602,7 +1601,7 @@ static HB_ERRCODE hb_usrCreate( AREAP pArea, LPDBOPENINFO pOpenInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrCreate(%p,%p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrCreate(%p,%p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CREATE ) ) return SUPER_CREATE( pArea, pOpenInfo ); @@ -1621,7 +1620,7 @@ static HB_ERRCODE hb_usrOpen( AREAP pArea, LPDBOPENINFO pOpenInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOpen(%p,%p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOpen(%p,%p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_OPEN ) ) return SUPER_OPEN( pArea, pOpenInfo ); @@ -1638,7 +1637,7 @@ static HB_ERRCODE hb_usrOpen( AREAP pArea, LPDBOPENINFO pOpenInfo ) static HB_ERRCODE hb_usrInfo( AREAP pArea, HB_USHORT uiInfoType, PHB_ITEM pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrInfo(%p,%hu,%p)", pArea, uiInfoType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrInfo(%p,%hu,%p)", ( void * ) pArea, uiInfoType, ( void * ) pInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_INFO ) ) return SUPER_INFO( pArea, uiInfoType, pInfo ); @@ -1655,7 +1654,7 @@ static HB_ERRCODE hb_usrEval( AREAP pArea, LPDBEVALINFO pEvalInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrEval(%p,%p)", pArea, pEvalInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrEval(%p,%p)", ( void * ) pArea, ( void * ) pEvalInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_DBEVAL ) ) return SUPER_DBEVAL( pArea, pEvalInfo ); @@ -1672,7 +1671,7 @@ static HB_ERRCODE hb_usrEval( AREAP pArea, LPDBEVALINFO pEvalInfo ) static HB_ERRCODE hb_usrPack( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrPack(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrPack(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_PACK ) ) return SUPER_PACK( pArea ); @@ -1687,7 +1686,7 @@ static HB_ERRCODE hb_usrPackRec( AREAP pArea, HB_ULONG ulRecNo, HB_BOOL * pWritt { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrPackRec(%p,%lu,%p)", pArea, ulRecNo, pWritten ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrPackRec(%p,%lu,%p)", ( void * ) pArea, ulRecNo, ( void * ) pWritten ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushLogical( HB_TRUE ); @@ -1715,7 +1714,7 @@ static HB_ERRCODE hb_usrSort( AREAP pArea, LPDBSORTINFO pSortInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSort(%p,%p)", pArea, pSortInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSort(%p,%p)", ( void * ) pArea, ( void * ) pSortInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SORT ) ) return SUPER_SORT( pArea, pSortInfo ); @@ -1734,7 +1733,7 @@ static HB_ERRCODE hb_usrTrans( AREAP pArea, LPDBTRANSINFO pTransInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrTrans(%p,%p)", pArea, pTransInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrTrans(%p,%p)", ( void * ) pArea, ( void * ) pTransInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_TRANS ) ) return SUPER_TRANS( pArea, pTransInfo ); @@ -1753,7 +1752,7 @@ static HB_ERRCODE hb_usrTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrTransRec(%p,%p)", pArea, pTransInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrTransRec(%p,%p)", ( void * ) pArea, ( void * ) pTransInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_TRANSREC ) ) return SUPER_TRANSREC( pArea, pTransInfo ); @@ -1770,7 +1769,7 @@ static HB_ERRCODE hb_usrTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo ) static HB_ERRCODE hb_usrZap( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrZap(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrZap(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ZAP ) ) return SUPER_ZAP( pArea ); @@ -1789,7 +1788,7 @@ static HB_ERRCODE hb_usrChildEnd( AREAP pArea, LPDBRELINFO pRelInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrChildEnd(%p,%p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrChildEnd(%p,%p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CHILDEND ) ) return SUPER_CHILDEND( pArea, pRelInfo ); @@ -1808,7 +1807,7 @@ static HB_ERRCODE hb_usrChildStart( AREAP pArea, LPDBRELINFO pRelInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrChildStart(%p,%p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrChildStart(%p,%p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CHILDSTART ) ) return SUPER_CHILDSTART( pArea, pRelInfo ); @@ -1827,7 +1826,7 @@ static HB_ERRCODE hb_usrChildSync( AREAP pArea, LPDBRELINFO pRelInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrChildSync(%p,%p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrChildSync(%p,%p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CHILDSYNC ) ) return SUPER_CHILDSYNC( pArea, pRelInfo ); @@ -1844,7 +1843,7 @@ static HB_ERRCODE hb_usrChildSync( AREAP pArea, LPDBRELINFO pRelInfo ) static HB_ERRCODE hb_usrSyncChildren( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSyncChildren(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSyncChildren(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SYNCCHILDREN ) ) return SUPER_SYNCCHILDREN( pArea ); @@ -1857,7 +1856,7 @@ static HB_ERRCODE hb_usrSyncChildren( AREAP pArea ) static HB_ERRCODE hb_usrClearRel( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrClearRel(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrClearRel(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CLEARREL ) ) return SUPER_CLEARREL( pArea ); @@ -1870,7 +1869,7 @@ static HB_ERRCODE hb_usrClearRel( AREAP pArea ) static HB_ERRCODE hb_usrForceRel( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrForceRel(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrForceRel(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_FORCEREL ) ) return SUPER_FORCEREL( pArea ); @@ -1885,7 +1884,7 @@ static HB_ERRCODE hb_usrRelArea( AREAP pArea, HB_USHORT uiRelNo, HB_USHORT * pui { int nOffset; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRelArea(%p,%hu,%p)", pArea, uiRelNo, puiRelArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRelArea(%p,%hu,%p)", ( void * ) pArea, uiRelNo, ( void * ) puiRelArea ) ); nOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() ); hb_vmPushInteger( 0 ); @@ -1910,7 +1909,7 @@ static HB_ERRCODE hb_usrRelEval( AREAP pArea, LPDBRELINFO pRelInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRelEval(%p,%p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRelEval(%p,%p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_RELEVAL ) ) return SUPER_RELEVAL( pArea, pRelInfo ); @@ -1927,7 +1926,7 @@ static HB_ERRCODE hb_usrRelEval( AREAP pArea, LPDBRELINFO pRelInfo ) static HB_ERRCODE hb_usrRelText( AREAP pArea, HB_USHORT uiRelNo, PHB_ITEM pExpr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRelText(%p,%hu,%p)", pArea, uiRelNo, pExpr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRelText(%p,%hu,%p)", ( void * ) pArea, uiRelNo, ( void * ) pExpr ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_RELTEXT ) ) return SUPER_RELTEXT( pArea, uiRelNo, pExpr ); @@ -1944,7 +1943,7 @@ static HB_ERRCODE hb_usrSetRel( AREAP pArea, LPDBRELINFO pRelInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSetRel(%p,%p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSetRel(%p,%p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SETREL ) ) return SUPER_SETREL( pArea, pRelInfo ); @@ -1968,7 +1967,7 @@ static HB_ERRCODE hb_usrOrderListAdd( AREAP pArea, LPDBORDERINFO pOrderInfo ) { PHB_ITEM pItem, pResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListAdd(%p,%p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListAdd(%p,%p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDLSTADD ) ) return SUPER_ORDLSTADD( pArea, pOrderInfo ); @@ -1994,7 +1993,7 @@ static HB_ERRCODE hb_usrOrderListAdd( AREAP pArea, LPDBORDERINFO pOrderInfo ) static HB_ERRCODE hb_usrOrderListClear( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListClear(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListClear(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDLSTCLEAR ) ) return SUPER_ORDLSTCLEAR( pArea ); @@ -2009,7 +2008,7 @@ static HB_ERRCODE hb_usrOrderListDelete( AREAP pArea, LPDBORDERINFO pOrderInfo ) { PHB_ITEM pItem, pResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListDelete(%p,%p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListDelete(%p,%p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDLSTDELETE ) ) return SUPER_ORDLSTDELETE( pArea, pOrderInfo ); @@ -2037,7 +2036,7 @@ static HB_ERRCODE hb_usrOrderListFocus( AREAP pArea, LPDBORDERINFO pOrderInfo ) { PHB_ITEM pItem, pResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListFocus(%p,%p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListFocus(%p,%p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDLSTFOCUS ) ) return SUPER_ORDLSTFOCUS( pArea, pOrderInfo ); @@ -2063,7 +2062,7 @@ static HB_ERRCODE hb_usrOrderListFocus( AREAP pArea, LPDBORDERINFO pOrderInfo ) static HB_ERRCODE hb_usrOrderListRebuild( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListRebuild(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderListRebuild(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDLSTREBUILD ) ) return SUPER_ORDLSTREBUILD( pArea ); @@ -2076,7 +2075,7 @@ static HB_ERRCODE hb_usrOrderListRebuild( AREAP pArea ) static HB_ERRCODE hb_usrOrderCondition( AREAP pArea, LPDBORDERCONDINFO pOrderCondInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderCondition(%p,%p)", pArea, pOrderCondInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderCondition(%p,%p)", ( void * ) pArea, ( void * ) pOrderCondInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDSETCOND ) ) return SUPER_ORDSETCOND( pArea, pOrderCondInfo ); @@ -2103,7 +2102,7 @@ static HB_ERRCODE hb_usrOrderCreate( AREAP pArea, LPDBORDERCREATEINFO pOrderCrea { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderCreate(%p,%p)", pArea, pOrderCreateInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderCreate(%p,%p)", ( void * ) pArea, ( void * ) pOrderCreateInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDCREATE ) ) return SUPER_ORDCREATE( pArea, pOrderCreateInfo ); @@ -2122,7 +2121,7 @@ static HB_ERRCODE hb_usrOrderDestroy( AREAP pArea, LPDBORDERINFO pOrderInfo ) { PHB_ITEM pItem, pResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderDestroy(%p,%p)", pArea, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderDestroy(%p,%p)", ( void * ) pArea, ( void * ) pOrderInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDDESTROY ) ) return SUPER_ORDDESTROY( pArea, pOrderInfo ); @@ -2150,7 +2149,7 @@ static HB_ERRCODE hb_usrOrderInfo( AREAP pArea, HB_USHORT uiIndex, LPDBORDERINFO { PHB_ITEM pItem, pResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderInfo(%p,%hu,%p)", pArea, uiIndex, pOrderInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOrderInfo(%p,%hu,%p)", ( void * ) pArea, uiIndex, ( void * ) pOrderInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_ORDINFO ) ) return SUPER_ORDINFO( pArea, uiIndex, pOrderInfo ); @@ -2182,7 +2181,7 @@ static HB_ERRCODE hb_usrOrderInfo( AREAP pArea, HB_USHORT uiIndex, LPDBORDERINFO static HB_ERRCODE hb_usrClearFilter( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrClearFilter(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrClearFilter(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CLEARFILTER ) ) return SUPER_CLEARFILTER( pArea ); @@ -2195,7 +2194,7 @@ static HB_ERRCODE hb_usrClearFilter( AREAP pArea ) static HB_ERRCODE hb_usrClearLocate( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrClearLocate(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrClearLocate(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CLEARLOCATE ) ) return SUPER_CLEARLOCATE( pArea ); @@ -2208,7 +2207,7 @@ static HB_ERRCODE hb_usrClearLocate( AREAP pArea ) static HB_ERRCODE hb_usrClearScope( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrClearScope(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrClearScope(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CLEARSCOPE ) ) return SUPER_CLEARSCOPE( pArea ); @@ -2221,7 +2220,7 @@ static HB_ERRCODE hb_usrClearScope( AREAP pArea ) static HB_ERRCODE hb_usrFilterText( AREAP pArea, PHB_ITEM pFilter ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrFilterText(%p,%p)", pArea, pFilter ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrFilterText(%p,%p)", ( void * ) pArea, ( void * ) pFilter ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_FILTERTEXT ) ) return SUPER_FILTERTEXT( pArea, pFilter ); @@ -2237,7 +2236,7 @@ static HB_ERRCODE hb_usrSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSetFilter(%p,%p)", pArea, pFilterInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSetFilter(%p,%p)", ( void * ) pArea, ( void * ) pFilterInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SETFILTER ) ) return SUPER_SETFILTER( pArea, pFilterInfo ); @@ -2256,7 +2255,7 @@ static HB_ERRCODE hb_usrSetLocate( AREAP pArea, LPDBSCOPEINFO pScopeInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrSetLocate(%p,%p)", pArea, pScopeInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrSetLocate(%p,%p)", ( void * ) pArea, ( void * ) pScopeInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_SETLOCATE ) ) return SUPER_SETLOCATE( pArea, pScopeInfo ); @@ -2273,7 +2272,7 @@ static HB_ERRCODE hb_usrSetLocate( AREAP pArea, LPDBSCOPEINFO pScopeInfo ) static HB_ERRCODE hb_usrLocate( AREAP pArea, HB_BOOL fContinue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrLocate(%p,%d)", pArea, fContinue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrLocate(%p,%d)", ( void * ) pArea, fContinue ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_LOCATE ) ) return SUPER_LOCATE( pArea, fContinue ); @@ -2292,7 +2291,7 @@ static HB_ERRCODE hb_usrLocate( AREAP pArea, HB_BOOL fContinue ) static HB_ERRCODE hb_usrCompile( AREAP pArea, const char * szExpr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrCompile(%p,%p)", pArea, szExpr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrCompile(%p,%p)", ( void * ) pArea, ( const void * ) szExpr ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_COMPILE ) ) return SUPER_COMPILE( pArea, szExpr ); @@ -2306,7 +2305,7 @@ static HB_ERRCODE hb_usrCompile( AREAP pArea, const char * szExpr ) static HB_ERRCODE hb_usrError( AREAP pArea, PHB_ITEM pError ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrError(%p,%p)", pArea, pError ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrError(%p,%p)", ( void * ) pArea, ( void * ) pError ) ); if( ! pArea ) { @@ -2327,7 +2326,7 @@ static HB_ERRCODE hb_usrError( AREAP pArea, PHB_ITEM pError ) static HB_ERRCODE hb_usrEvalBlock( AREAP pArea, PHB_ITEM pBlock ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrEvalBlock(%p,%p)", pArea, pBlock ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrEvalBlock(%p,%p)", ( void * ) pArea, ( void * ) pBlock ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_EVALBLOCK ) ) return SUPER_EVALBLOCK( pArea, pBlock ); @@ -2346,7 +2345,7 @@ static HB_ERRCODE hb_usrEvalBlock( AREAP pArea, PHB_ITEM pBlock ) static HB_ERRCODE hb_usrRawLock( AREAP pArea, HB_USHORT uiAction, HB_ULONG ulRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRawLock(%p,%hu,%lu)", pArea, uiAction, ulRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRawLock(%p,%hu,%lu)", ( void * ) pArea, uiAction, ulRecNo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_RAWLOCK ) ) return SUPER_RAWLOCK( pArea, uiAction, ulRecNo ); @@ -2363,7 +2362,7 @@ static HB_ERRCODE hb_usrLock( AREAP pArea, LPDBLOCKINFO pLockInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrLock(%p,%p)", pArea, pLockInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrLock(%p,%p)", ( void * ) pArea, ( void * ) pLockInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_LOCK ) ) return SUPER_LOCK( pArea, pLockInfo ); @@ -2382,7 +2381,7 @@ static HB_ERRCODE hb_usrLock( AREAP pArea, LPDBLOCKINFO pLockInfo ) static HB_ERRCODE hb_usrUnLock( AREAP pArea, PHB_ITEM pRecNo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrUnLock(%p,%p)", pArea, pRecNo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrUnLock(%p,%p)", ( void * ) pArea, ( void * ) pRecNo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_UNLOCK ) ) return SUPER_UNLOCK( pArea, pRecNo ); @@ -2404,7 +2403,7 @@ static HB_ERRCODE hb_usrUnLock( AREAP pArea, PHB_ITEM pRecNo ) static HB_ERRCODE hb_usrCloseMemFile( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrCloseMemFile(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrCloseMemFile(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CLOSEMEMFILE ) ) return SUPER_CLOSEMEMFILE( pArea ); @@ -2419,7 +2418,7 @@ static HB_ERRCODE hb_usrCreateMemFile( AREAP pArea, LPDBOPENINFO pOpenInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrCreateMemFile(%p,%p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrCreateMemFile(%p,%p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_CREATEMEMFILE ) ) return SUPER_CREATEMEMFILE( pArea, pOpenInfo ); @@ -2438,7 +2437,7 @@ static HB_ERRCODE hb_usrOpenMemFile( AREAP pArea, LPDBOPENINFO pOpenInfo ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_usrOpenMemFile(%p,%p)", pArea, pOpenInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrOpenMemFile(%p,%p)", ( void * ) pArea, ( void * ) pOpenInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_OPENMEMFILE ) ) return SUPER_OPENMEMFILE( pArea, pOpenInfo ); @@ -2455,7 +2454,7 @@ static HB_ERRCODE hb_usrOpenMemFile( AREAP pArea, LPDBOPENINFO pOpenInfo ) static HB_ERRCODE hb_usrGetValueFile( AREAP pArea, HB_USHORT uiIndex, const char * szFile, HB_USHORT uiMode ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrGetValueFile(%p,%hu,%p,%hu)", pArea, uiIndex, szFile, uiMode ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrGetValueFile(%p,%hu,%p,%hu)", ( void * ) pArea, uiIndex, ( const void * ) szFile, uiMode ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_GETVALUEFILE ) ) return SUPER_GETVALUEFILE( pArea, uiIndex, szFile, uiMode ); @@ -2471,7 +2470,7 @@ static HB_ERRCODE hb_usrGetValueFile( AREAP pArea, HB_USHORT uiIndex, const char static HB_ERRCODE hb_usrPutValueFile( AREAP pArea, HB_USHORT uiIndex, const char * szFile, HB_USHORT uiMode ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrPutValueFile(%p,%hu,%p,%hu)", pArea, uiIndex, szFile, uiMode ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrPutValueFile(%p,%hu,%p,%hu)", ( void * ) pArea, uiIndex, ( const void * ) szFile, uiMode ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_PUTVALUEFILE ) ) return SUPER_PUTVALUEFILE( pArea, uiIndex, szFile, uiMode ); @@ -2492,7 +2491,7 @@ static HB_ERRCODE hb_usrPutValueFile( AREAP pArea, HB_USHORT uiIndex, const char static HB_ERRCODE hb_usrReadDBHeader( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrReadDBHeader(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrReadDBHeader(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_READDBHEADER ) ) return SUPER_READDBHEADER( pArea ); @@ -2505,7 +2504,7 @@ static HB_ERRCODE hb_usrReadDBHeader( AREAP pArea ) static HB_ERRCODE hb_usrWriteDBHeader( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrWriteDBHeader(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrWriteDBHeader(%p)", ( void * ) pArea ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pArea )->pMethods, UR_WRITEDBHEADER ) ) return SUPER_WRITEDBHEADER( pArea ); @@ -2523,7 +2522,7 @@ static HB_ERRCODE hb_usrWriteDBHeader( AREAP pArea ) static HB_ERRCODE hb_usrDrop( LPRDDNODE pRDD, PHB_ITEM pTable, PHB_ITEM pIndex, HB_ULONG ulConnection ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrDrop(%p,%p,%p,%lu)", pRDD, pTable, pIndex, ulConnection ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrDrop(%p,%p,%p,%lu)", ( void * ) pRDD, ( void * ) pTable, ( void * ) pIndex, ulConnection ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pRDD )->pMethods, UR_DROP ) ) return SUPER_DROP( pRDD, pTable, pIndex, ulConnection ); @@ -2539,7 +2538,7 @@ static HB_ERRCODE hb_usrDrop( LPRDDNODE pRDD, PHB_ITEM pTable, PHB_ITEM pIndex, static HB_ERRCODE hb_usrExists( LPRDDNODE pRDD, PHB_ITEM pTable, PHB_ITEM pIndex, HB_ULONG ulConnection ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrExists(%p,%p,%p,%lu)", pRDD, pTable, pIndex, ulConnection ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrExists(%p,%p,%p,%lu)", ( void * ) pRDD, ( void * ) pTable, ( void * ) pIndex, ulConnection ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pRDD )->pMethods, UR_EXISTS ) ) return SUPER_EXISTS( pRDD, pTable, pIndex, ulConnection ); @@ -2555,7 +2554,7 @@ static HB_ERRCODE hb_usrExists( LPRDDNODE pRDD, PHB_ITEM pTable, PHB_ITEM pIndex static HB_ERRCODE hb_usrRename( LPRDDNODE pRDD, PHB_ITEM pTable, PHB_ITEM pIndex, PHB_ITEM pNewName, HB_ULONG ulConnection ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRename(%p,%p,%p,%p,%lu)", pRDD, pTable, pIndex, pNewName, ulConnection ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRename(%p,%p,%p,%p,%lu)", ( void * ) pRDD, ( void * ) pTable, ( void * ) pIndex, ( void * ) pNewName, ulConnection ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pRDD )->pMethods, UR_RENAME ) ) return SUPER_RENAME( pRDD, pTable, pIndex, pNewName, ulConnection ); @@ -2572,7 +2571,7 @@ static HB_ERRCODE hb_usrRename( LPRDDNODE pRDD, PHB_ITEM pTable, PHB_ITEM pIndex static HB_ERRCODE hb_usrRddInfo( LPRDDNODE pRDD, HB_USHORT uiInfoType, HB_ULONG ulConnection, PHB_ITEM pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_usrRddInfo(%p,%hu,%lu,%p)", pRDD, uiInfoType, ulConnection, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_usrRddInfo(%p,%hu,%lu,%p)", ( void * ) pRDD, uiInfoType, ulConnection, ( void * ) pInfo ) ); if( ! hb_usrPushMethod( SELF_USRNODE( pRDD )->pMethods, UR_RDDINFO ) ) return SUPER_RDDINFO( pRDD, uiInfoType, ulConnection, pInfo ); @@ -2851,7 +2850,6 @@ HB_FUNC( USRRDD_GETFUNCTABLE ) { RDDFUNCS * pSelfTable, * pSuperTable; HB_USHORT * puiCount, * puiSuperRddId, uiCount, uiSize; - HB_ERRCODE uiResult; const char * szSuperRDD; PHB_ITEM pMethods; @@ -2860,13 +2858,16 @@ HB_FUNC( USRRDD_GETFUNCTABLE ) puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pSelfTable = ( RDDFUNCS * ) hb_parptr( 2 ); pSuperTable = ( RDDFUNCS * ) hb_parptr( 3 ); - /* uiRddID = hb_parni( 4 ); */ +#if 0 + uiRddID = hb_parni( 4 ); +#endif szSuperRDD = hb_parc( 5 ); pMethods = hb_param( 6, HB_IT_ARRAY ); puiSuperRddId = ( HB_USHORT * ) hb_parptr( 7 ); if( puiCount && pSelfTable && pSuperTable && pMethods ) { + HB_ERRCODE uiResult; HB_RDD_FUNCTABLE funcTable; DBENTRYP_V * pFunction; const DBENTRYP_V * pUsrFunction, * pRddFunction; @@ -2892,9 +2893,8 @@ HB_FUNC( USRRDD_GETFUNCTABLE ) } uiResult = hb_rddInheritEx( pSelfTable, &funcTable.funcTable, pSuperTable, szSuperRDD, puiSuperRddId ); if( uiResult == HB_SUCCESS ) - { pSelfTable->whoCares = ( DBENTRYP_SVP ) hb_itemNew( pMethods ); - } + hb_retni( uiResult ); } else @@ -2911,16 +2911,12 @@ HB_FUNC( USRRDD_RDDDATA ) hb_itemReturn( pItem ); if( hb_pcount() >= 2 ) - { hb_itemCopy( pItem, hb_param( 2, HB_IT_ANY ) ); - } } } HB_FUNC( USRRDD_ID ) { - AREAP pArea; - if( HB_ISCHAR( 1 ) ) { HB_USHORT uiRddId; @@ -2931,6 +2927,8 @@ HB_FUNC( USRRDD_ID ) } else { + AREAP pArea; + if( HB_ISNUM( 1 ) ) pArea = hb_usrGetAreaPointer( hb_parni( 1 ) ); else @@ -2956,9 +2954,7 @@ HB_FUNC( USRRDD_AREADATA ) hb_itemReturn( pItem ); if( hb_pcount() >= 2 ) - { hb_itemCopy( pItem, hb_param( 2, HB_IT_ANY ) ); - } } } @@ -2978,18 +2974,16 @@ HB_FUNC( USRRDD_AREARESULT ) hb_itemReturn( pArea->valResult ); if( hb_pcount() >= 2 ) - { hb_itemCopy( pArea->valResult, hb_param( 2, HB_IT_ANY ) ); - } } } HB_FUNC( USRRDD_SETBOF ) { - AREAP pArea; - if( HB_ISLOG( 2 ) ) { + AREAP pArea; + if( HB_ISNUM( 1 ) ) pArea = hb_usrGetAreaPointer( hb_parni( 1 ) ); else @@ -3002,10 +2996,10 @@ HB_FUNC( USRRDD_SETBOF ) HB_FUNC( USRRDD_SETEOF ) { - AREAP pArea; - if( HB_ISLOG( 2 ) ) { + AREAP pArea; + if( HB_ISNUM( 1 ) ) pArea = hb_usrGetAreaPointer( hb_parni( 1 ) ); else @@ -3018,10 +3012,10 @@ HB_FUNC( USRRDD_SETEOF ) HB_FUNC( USRRDD_SETFOUND ) { - AREAP pArea; - if( HB_ISLOG( 2 ) ) { + AREAP pArea; + if( HB_ISNUM( 1 ) ) pArea = hb_usrGetAreaPointer( hb_parni( 1 ) ); else @@ -3034,10 +3028,10 @@ HB_FUNC( USRRDD_SETFOUND ) HB_FUNC( USRRDD_SETTOP ) { - AREAP pArea; - if( HB_ISLOG( 2 ) ) { + AREAP pArea; + if( HB_ISNUM( 1 ) ) pArea = hb_usrGetAreaPointer( hb_parni( 1 ) ); else @@ -3050,10 +3044,10 @@ HB_FUNC( USRRDD_SETTOP ) HB_FUNC( USRRDD_SETBOTTOM ) { - AREAP pArea; - if( HB_ISLOG( 2 ) ) { + AREAP pArea; + if( HB_ISNUM( 1 ) ) pArea = hb_usrGetAreaPointer( hb_parni( 1 ) ); else @@ -3066,12 +3060,11 @@ HB_FUNC( USRRDD_SETBOTTOM ) static HB_ERRCODE hb_usrErrorRT( AREAP pArea, HB_ERRCODE errGenCode, HB_ERRCODE errSubCode ) { - PHB_ITEM pError; HB_ERRCODE iRet = HB_FAILURE; if( hb_vmRequestQuery() == 0 ) { - pError = hb_errNew(); + PHB_ITEM pError = hb_errNew(); hb_errPutGenCode( pError, errGenCode ); hb_errPutSubCode( pError, errSubCode ); hb_errPutDescription( pError, hb_langDGetErrorDesc( errGenCode ) ); diff --git a/src/rdd/wacore.c b/src/rdd/wacore.c index 72aa586e69..0cf64289ed 100644 --- a/src/rdd/wacore.c +++ b/src/rdd/wacore.c @@ -336,7 +336,7 @@ HB_ERRCODE hb_rddIterateWorkAreas( WACALLBACK pCallBack, void * cargo ) HB_ERRCODE errCode = HB_SUCCESS; HB_USHORT uiIndex; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddIterateWorkAreas(%p, %p)", pCallBack, cargo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddIterateWorkAreas(%p, %p)", ( void * ) pCallBack, cargo ) ); pRddInfo = hb_stackRDD(); for( uiIndex = 1; uiIndex < pRddInfo->uiWaMax; uiIndex++ ) @@ -508,11 +508,7 @@ HB_ERRCODE hb_rddSelectWorkAreaNumber( int iArea ) } -/* =========================================================== */ - -/* - * Moving work ares between threads - */ +/* Moving workareas between threads */ static HB_CRITICAL_NEW( s_waMtx ); static HB_COND_NEW( s_waCond ); @@ -572,7 +568,7 @@ HB_ERRCODE hb_rddDetachArea( AREAP pArea, PHB_ITEM pCargo ) HB_SIZE nPos; int iArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddDetachArea(%p, %p)", pArea, pCargo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddDetachArea(%p, %p)", ( void * ) pArea, ( void * ) pCargo ) ); /* save current WA number */ iArea = hb_rddGetCurrentWorkAreaNumber(); @@ -637,7 +633,7 @@ AREAP hb_rddRequestArea( const char * szAlias, PHB_ITEM pCargo, if( pCargo ) hb_itemClear( pCargo ); - /* close current WA or chose 1-st free available */ + /* close current WA or chose 1st free available */ if( ! fNewArea ) { hb_rddReleaseCurrentArea(); @@ -716,7 +712,7 @@ AREAP hb_rddRequestArea( const char * szAlias, PHB_ITEM pCargo, /* leave critical section */ hb_threadLeaveCriticalSection( &s_waMtx ); - /* atach WA and set alias */ + /* attach WA and set alias */ if( pArea ) { hb_waNodeInsert( hb_stackRDD(), pArea ); diff --git a/src/rdd/wafunc.c b/src/rdd/wafunc.c index 450a820219..a80ce8a117 100644 --- a/src/rdd/wafunc.c +++ b/src/rdd/wafunc.c @@ -58,10 +58,10 @@ */ HB_ERRCODE hb_rddVerifyAliasName( const char * szAlias ) { - char c; - if( szAlias ) { + char c; + /* Clipper ignores only trailing spaces */ #if 0 while( *szAlias == ' ' ) @@ -101,7 +101,7 @@ void * hb_rddNewAreaNode( LPRDDNODE pRddNode, HB_USHORT uiRddID ) { AREAP pArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddNewAreaNode(%p,%hu)", pRddNode, uiRddID ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddNewAreaNode(%p,%hu)", ( void * ) pRddNode, uiRddID ) ); if( pRddNode->uiAreaSize == 0 ) /* Calculate the size of WorkArea */ { @@ -190,7 +190,7 @@ void * hb_rddAllocWorkAreaAlias( const char * szAlias, int iArea ) */ HB_USHORT hb_rddFieldIndex( AREAP pArea, const char * szName ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_rddFieldIndex(%p, %s)", pArea, szName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddFieldIndex(%p, %s)", ( void * ) pArea, szName ) ); while( HB_ISSPACE( *szName ) ) ++szName; @@ -236,15 +236,13 @@ HB_USHORT hb_rddFieldIndex( AREAP pArea, const char * szName ) */ HB_USHORT hb_rddFieldExpIndex( AREAP pArea, const char * szField ) { - int n; - while( HB_ISSPACE( *szField ) ) ++szField; if( strchr( szField, '>' ) != NULL ) { char szAlias[ HB_RDD_MAX_ALIAS_LEN + 1 ]; - int i, j, l; + int j, l, n; n = 0; if( SELF_ALIAS( pArea, szAlias ) == HB_SUCCESS ) @@ -258,6 +256,7 @@ HB_USHORT hb_rddFieldExpIndex( AREAP pArea, const char * szField ) */ do { + int i; j = n; i = 0; if( HB_ISFIRSTIDCHAR( szField[ n ] ) ) @@ -304,7 +303,7 @@ HB_ERRCODE hb_rddGetAliasNumber( const char * szAlias, int * iArea ) HB_BOOL fOneLetter; char c; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddGetAliasNumber(%s, %p)", szAlias, iArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddGetAliasNumber(%s, %p)", szAlias, ( void * ) iArea ) ); while( *szAlias == ' ' ) szAlias++; @@ -349,7 +348,7 @@ HB_ERRCODE hb_rddSelectWorkAreaSymbol( PHB_SYMB pSymAlias ) const char * szName; int iArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddSelectWorkAreaSymbol(%p)", pSymAlias ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddSelectWorkAreaSymbol(%p)", ( void * ) pSymAlias ) ); iArea = ( int ) hb_dynsymAreaHandle( pSymAlias->pDynSym ); if( iArea ) @@ -454,7 +453,7 @@ HB_ERRCODE hb_rddFieldGet( PHB_ITEM pItem, PHB_SYMB pFieldSymbol ) { AREAP pArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddFieldGet(%p, %p)", pItem, pFieldSymbol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddFieldGet(%p, %p)", ( void * ) pItem, ( void * ) pFieldSymbol ) ); pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) @@ -483,7 +482,7 @@ HB_ERRCODE hb_rddFieldPut( PHB_ITEM pItem, PHB_SYMB pFieldSymbol ) { AREAP pArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddFieldPut(%p, %p)", pItem, pFieldSymbol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddFieldPut(%p, %p)", ( void * ) pItem, ( void * ) pFieldSymbol ) ); pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) @@ -512,7 +511,7 @@ HB_ERRCODE hb_rddGetFieldValue( PHB_ITEM pItem, PHB_SYMB pFieldSymbol ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddGetFieldValue(%p, %p)", pItem, pFieldSymbol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddGetFieldValue(%p, %p)", ( void * ) pItem, ( void * ) pFieldSymbol ) ); errCode = hb_rddFieldGet( pItem, pFieldSymbol ); @@ -548,7 +547,7 @@ HB_ERRCODE hb_rddPutFieldValue( PHB_ITEM pItem, PHB_SYMB pFieldSymbol ) { HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddPutFieldValue(%p, %p)", pItem, pFieldSymbol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddPutFieldValue(%p, %p)", ( void * ) pItem, ( void * ) pFieldSymbol ) ); errCode = hb_rddFieldPut( pItem, pFieldSymbol ); @@ -607,7 +606,7 @@ HB_ERRCODE hb_rddOpenTable( const char * szFileName, const char * szDriver, hb_rddSetNetErr( HB_FALSE ); /* Now check parameters, first RDD name. - * Clipper seems to make sth like: + * Clipper seems to make something like: * if( szDriver && strlen( szDriver ) > 1 ) * but I do not think we should replicate it, [druzus] */ @@ -918,9 +917,7 @@ HB_ERRCODE hb_dbTransStruct( AREAP lpaSource, AREAP lpaDest, uiSize = HB_MIN( uiSizeDst, uiSizeSrc ); } else - { uiSize = uiSizeDst = uiSizeSrc; - } if( ! uiSize ) return HB_FAILURE; @@ -1111,7 +1108,7 @@ HB_ERRCODE hb_rddTransRecords( AREAP pArea, AREAP lpaClose = NULL; PHB_ITEM pStruct = NULL; DBTRANSINFO dbTransInfo; - HB_USHORT uiPrevArea, uiCount, uiSwap; + HB_USHORT uiPrevArea; HB_ERRCODE errCode; memset( &dbTransInfo, 0, sizeof( dbTransInfo ) ); @@ -1145,6 +1142,8 @@ HB_ERRCODE hb_rddTransRecords( AREAP pArea, if( pRddNode->uiType == RDT_TRANSFER ) { + HB_USHORT uiCount; + errCode = hb_dbTransStruct( pArea, NULL, &dbTransInfo, &pStruct, pFields ); @@ -1152,7 +1151,7 @@ HB_ERRCODE hb_rddTransRecords( AREAP pArea, dbTransInfo.lpaDest = dbTransInfo.lpaSource; for( uiCount = 0; uiCount < dbTransInfo.uiItemCount; ++uiCount ) { - uiSwap = dbTransInfo.lpTransItems[ uiCount ].uiSource; + HB_USHORT uiSwap = dbTransInfo.lpTransItems[ uiCount ].uiSource; dbTransInfo.lpTransItems[ uiCount ].uiSource = dbTransInfo.lpTransItems[ uiCount ].uiDest; dbTransInfo.lpTransItems[ uiCount ].uiDest = uiSwap; @@ -1272,7 +1271,7 @@ HB_ERRCODE hb_rddCloseAllParentRelations( AREAP pArea ) { HB_ERRCODE errCode = HB_SUCCESS; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddCloseAllParentRelations(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddCloseAllParentRelations(%p)", ( void * ) pArea ) ); if( pArea->uiParents > 0 ) { @@ -1303,7 +1302,7 @@ HB_ERRCODE hb_rddEvalWA( PHB_ITEM pBlock ) HB_ERRCODE errCode; HB_USHORT uiArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddEvalWA(%p)", pBlock ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddEvalWA(%p)", ( void * ) pBlock ) ); uiArea = ( HB_AREANO ) hb_rddGetCurrentWorkAreaNumber(); errCode = hb_rddIterateWorkAreas( hb_rddEvalWABlock, pBlock ); diff --git a/src/rdd/workarea.c b/src/rdd/workarea.c index b7e5deb1c7..cb6bc408a0 100644 --- a/src/rdd/workarea.c +++ b/src/rdd/workarea.c @@ -3,6 +3,7 @@ * * Copyright 1999 Bruno Cantero <bruno@issnet.net> * Copyright 2004-2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> + * Copyright 2002 Horacio Roldan <harbour_ar@yahoo.com.ar> (hb_waCloseAux()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,11 +44,6 @@ * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * - * - * The following functions are added by - * Horacio Roldan <harbour_ar@yahoo.com.ar> - * hb_waCloseAux() - * */ #include "hbapi.h" @@ -68,7 +64,7 @@ */ static HB_ERRCODE hb_waBof( AREAP pArea, HB_BOOL * pBof ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waBof(%p, %p)", pArea, pBof ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waBof(%p, %p)", ( void * ) pArea, ( void * ) pBof ) ); *pBof = pArea->fBof; return HB_SUCCESS; @@ -79,7 +75,7 @@ static HB_ERRCODE hb_waBof( AREAP pArea, HB_BOOL * pBof ) */ static HB_ERRCODE hb_waEof( AREAP pArea, HB_BOOL * pEof ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waEof(%p, %p)", pArea, pEof ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waEof(%p, %p)", ( void * ) pArea, ( void * ) pEof ) ); *pEof = pArea->fEof; return HB_SUCCESS; @@ -90,7 +86,7 @@ static HB_ERRCODE hb_waEof( AREAP pArea, HB_BOOL * pEof ) */ static HB_ERRCODE hb_waFound( AREAP pArea, HB_BOOL * pFound ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waFound(%p, %p)", pArea, pFound ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waFound(%p, %p)", ( void * ) pArea, ( void * ) pFound ) ); *pFound = pArea->fFound; return HB_SUCCESS; @@ -103,7 +99,7 @@ static HB_ERRCODE hb_waSkip( AREAP pArea, HB_LONG lToSkip ) { HB_LONG lSkip; - HB_TRACE( HB_TR_DEBUG, ( "hb_waSkip(%p, %ld)", pArea, lToSkip ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waSkip(%p, %ld)", ( void * ) pArea, lToSkip ) ); /* Flush record and exit */ if( lToSkip == 0 ) @@ -145,14 +141,14 @@ static HB_ERRCODE hb_waSkipFilter( AREAP pArea, HB_LONG lUpDown ) HB_BOOL fBottom, fDeleted; HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_waSkipFilter(%p, %ld)", pArea, lUpDown ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waSkipFilter(%p, %ld)", ( void * ) pArea, lUpDown ) ); if( pArea->dbfi.itmCobExpr == NULL && ! hb_setGetDeleted() ) return HB_SUCCESS; /* Since lToSkip is passed to SkipRaw, it should never request more than a single skip. - The implied purpose of hb_waSkipFilter is to get off of a "bad" record + The implied purpose of hb_waSkipFilter() is to get off of a "bad" record after a skip was performed, NOT to skip lToSkip filtered records. */ lUpDown = ( lUpDown < 0 ? -1 : 1 ); @@ -236,7 +232,7 @@ static HB_ERRCODE hb_waAddField( AREAP pArea, LPDBFIELDINFO pFieldInfo ) char szFieldName[ HB_SYMBOL_NAME_LEN + 1 ]; const char *szPtr; - HB_TRACE( HB_TR_DEBUG, ( "hb_waAddField(%p, %p)", pArea, pFieldInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waAddField(%p, %p)", ( void * ) pArea, ( void * ) pFieldInfo ) ); /* Validate the name of field */ szPtr = pFieldInfo->atomName; @@ -267,14 +263,11 @@ static HB_ERRCODE hb_waAddField( AREAP pArea, LPDBFIELDINFO pFieldInfo ) */ static HB_ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct ) { - HB_USHORT uiItems, uiCount, uiLen, uiDec; + HB_USHORT uiItems, uiCount; HB_ERRCODE errCode = HB_SUCCESS; DBFIELDINFO dbFieldInfo; - PHB_ITEM pFieldDesc; - const char * szType; - int iData; - HB_TRACE( HB_TR_DEBUG, ( "hb_waCreateFields(%p, %p)", pArea, pStruct ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waCreateFields(%p, %p)", ( void * ) pArea, ( void * ) pStruct ) ); uiItems = ( HB_USHORT ) hb_arrayLen( pStruct ); if( SELF_SETFIELDEXTENT( pArea, uiItems ) != HB_SUCCESS ) @@ -282,6 +275,11 @@ static HB_ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct ) for( uiCount = 0; uiCount < uiItems; uiCount++ ) { + HB_USHORT uiLen, uiDec; + PHB_ITEM pFieldDesc; + const char * szType; + int iData; + dbFieldInfo.uiTypeExtended = 0; pFieldDesc = hb_arrayGetItemPtr( pStruct, uiCount + 1 ); dbFieldInfo.atomName = hb_arrayGetCPtr( pFieldDesc, DBS_NAME ); @@ -401,8 +399,8 @@ static HB_ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct ) case 'N': dbFieldInfo.uiType = HB_FT_LONG; dbFieldInfo.uiDec = uiDec; - /* DBASE documentation defines maximum numeric field size as 20 - * but Clipper allows to create longer fileds so I remove this + /* dBase documentation defines maximum numeric field size as 20 + * but Clipper allows to create longer fields so I remove this * limit, Druzus */ /* @@ -524,7 +522,7 @@ static HB_ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct ) */ static HB_ERRCODE hb_waFieldCount( AREAP pArea, HB_USHORT * uiFields ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waFieldCount(%p, %p)", pArea, uiFields ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waFieldCount(%p, %p)", ( void * ) pArea, ( void * ) uiFields ) ); * uiFields = pArea->uiFieldCount; return HB_SUCCESS; @@ -537,7 +535,7 @@ static HB_ERRCODE hb_waFieldInfo( AREAP pArea, HB_USHORT uiIndex, HB_USHORT uiTy { LPFIELD pField; - HB_TRACE( HB_TR_DEBUG, ( "hb_waFieldInfo(%p, %hu, %hu, %p)", pArea, uiIndex, uiType, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waFieldInfo(%p, %hu, %hu, %p)", ( void * ) pArea, uiIndex, uiType, ( void * ) pItem ) ); if( uiIndex > pArea->uiFieldCount ) return HB_FAILURE; @@ -712,7 +710,7 @@ static HB_ERRCODE hb_waFieldName( AREAP pArea, HB_USHORT uiIndex, char * szName { LPFIELD pField; - HB_TRACE( HB_TR_DEBUG, ( "hb_waFieldName(%p, %hu, %p)", pArea, uiIndex, szName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waFieldName(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) szName ) ); if( uiIndex > pArea->uiFieldExtent ) return HB_FAILURE; @@ -728,7 +726,7 @@ static HB_ERRCODE hb_waFieldName( AREAP pArea, HB_USHORT uiIndex, char * szName */ static HB_ERRCODE hb_waSetFieldExtent( AREAP pArea, HB_USHORT uiFieldExtent ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waSetFieldExtent(%p, %hu)", pArea, uiFieldExtent ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waSetFieldExtent(%p, %hu)", ( void * ) pArea, uiFieldExtent ) ); pArea->uiFieldExtent = uiFieldExtent; @@ -744,7 +742,7 @@ static HB_ERRCODE hb_waSetFieldExtent( AREAP pArea, HB_USHORT uiFieldExtent ) */ static HB_ERRCODE hb_waAlias( AREAP pArea, char * szAlias ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waAlias(%p, %p)", pArea, szAlias ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waAlias(%p, %p)", ( void * ) pArea, ( void * ) szAlias ) ); hb_strncpy( szAlias, pArea->atomAlias && hb_dynsymAreaHandle( ( PHB_DYNS ) pArea->atomAlias ) @@ -759,7 +757,7 @@ static HB_ERRCODE hb_waAlias( AREAP pArea, char * szAlias ) */ static HB_ERRCODE hb_waClose( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waClose(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waClose(%p)", ( void * ) pArea ) ); /* Clear items */ SELF_CLEARFILTER( pArea ); @@ -780,7 +778,7 @@ static HB_ERRCODE hb_waClose( AREAP pArea ) */ static HB_ERRCODE hb_waInfo( AREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waInfo(%p, %hu, %p)", pArea, uiIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waInfo(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pItem ) ); switch( uiIndex ) { @@ -855,17 +853,17 @@ static HB_ERRCODE hb_waInfo( AREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { char szAlias[ HB_RDD_MAX_ALIAS_LEN + 1 ]; if( SELF_ALIAS( pArea, szAlias ) != HB_SUCCESS ) - { return HB_FAILURE; - } hb_itemPutC( pItem, szAlias ); break; } case DBI_TABLEEXT: + { + LPRDDNODE pNode = SELF_RDDNODE( pArea ); hb_itemClear( pItem ); - return SELF_RDDINFO( SELF_RDDNODE( pArea ), RDDI_TABLEEXT, 0, pItem ); - + return pNode ? SELF_RDDINFO( pNode, RDDI_TABLEEXT, 0, pItem ) : HB_FAILURE; + } case DBI_SCOPEDRELATION: { int iRelNo = hb_itemGetNI( pItem ); @@ -924,11 +922,11 @@ static HB_ERRCODE hb_waInfo( AREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) /* * Retrieve information about the current order that SELF could not. - * Called by SELF_ORDINFO if uiIndex is not supported. + * Called by SELF_ORDINFO() if uiIndex is not supported. */ static HB_ERRCODE hb_waOrderInfo( AREAP pArea, HB_USHORT uiIndex, LPDBORDERINFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waOrderInfo(%p, %hu, %p)", pArea, uiIndex, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waOrderInfo(%p, %hu, %p)", ( void * ) pArea, uiIndex, ( void * ) pInfo ) ); HB_SYMBOL_UNUSED( pArea ); HB_SYMBOL_UNUSED( uiIndex ); @@ -949,7 +947,7 @@ static HB_ERRCODE hb_waOrderInfo( AREAP pArea, HB_USHORT uiIndex, LPDBORDERINFO */ static HB_ERRCODE hb_waNewArea( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waNewArea(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waNewArea(%p)", ( void * ) pArea ) ); pArea->valResult = hb_itemNew( NULL ); pArea->lpdbRelations = NULL; @@ -1018,7 +1016,7 @@ static HB_ERRCODE hb_waOrderCondition( AREAP pArea, LPDBORDERCONDINFO param ) */ static HB_ERRCODE hb_waRelease( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waRelease(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waRelease(%p)", ( void * ) pArea ) ); /* Free all allocated pointers */ if( pArea->lpFields ) @@ -1037,7 +1035,7 @@ static HB_ERRCODE hb_waRelease( AREAP pArea ) */ static HB_ERRCODE hb_waStructSize( AREAP pArea, HB_USHORT * uiSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waStrucSize(%p, %p)", pArea, uiSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waStrucSize(%p, %p)", ( void * ) pArea, ( void * ) uiSize ) ); HB_SYMBOL_UNUSED( pArea ); *uiSize = sizeof( AREA ); @@ -1049,7 +1047,7 @@ static HB_ERRCODE hb_waStructSize( AREAP pArea, HB_USHORT * uiSize ) */ static HB_ERRCODE hb_waSysName( AREAP pArea, char * pBuffer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waSysName(%p, %p)", pArea, pBuffer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waSysName(%p, %p)", ( void * ) pArea, ( void * ) pBuffer ) ); hb_strncpy( pBuffer, SELF_RDDNODE( pArea )->szName, HB_RDD_MAX_DRIVERNAME_LEN ); @@ -1065,7 +1063,7 @@ static HB_ERRCODE hb_waEval( AREAP pArea, LPDBEVALINFO pEvalInfo ) HB_LONG lNext = 1; HB_BOOL fEof, fFor; - HB_TRACE( HB_TR_DEBUG, ( "hb_waEval(%p, %p)", pArea, pEvalInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waEval(%p, %p)", ( void * ) pArea, ( void * ) pEvalInfo ) ); if( pEvalInfo->dbsci.itmRecID ) { @@ -1136,7 +1134,7 @@ static HB_ERRCODE hb_waLocate( AREAP pArea, HB_BOOL fContinue ) HB_LONG lNext = 1; HB_BOOL fEof; - HB_TRACE( HB_TR_DEBUG, ( "hb_waLocate(%p, %d)", pArea, fContinue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waLocate(%p, %d)", ( void * ) pArea, fContinue ) ); if( fContinue ) { @@ -1220,7 +1218,7 @@ static HB_ERRCODE hb_waTrans( AREAP pArea, LPDBTRANSINFO pTransInfo ) HB_LONG lNext = 1; HB_BOOL fEof, fFor; - HB_TRACE( HB_TR_DEBUG, ( "hb_waTrans(%p, %p)", pArea, pTransInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waTrans(%p, %p)", ( void * ) pArea, ( void * ) pTransInfo ) ); if( pTransInfo->dbsci.itmRecID ) { @@ -1292,7 +1290,7 @@ static HB_ERRCODE hb_waTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo ) HB_BYTE * pRecord; HB_ERRCODE errCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_waTransRec(%p, %p)", pArea, pTransInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waTransRec(%p, %p)", ( void * ) pArea, ( void * ) pTransInfo ) ); if( pTransInfo->uiFlags & DBTF_MATCH && pTransInfo->uiFlags & DBTF_PUTREC ) { @@ -1370,7 +1368,7 @@ static HB_ERRCODE hb_waTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo ) */ static HB_ERRCODE hb_waChildEnd( AREAP pArea, LPDBRELINFO pRelInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waChildEnd(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waChildEnd(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); if( pRelInfo->isScoped ) { @@ -1393,7 +1391,7 @@ static HB_ERRCODE hb_waChildEnd( AREAP pArea, LPDBRELINFO pRelInfo ) */ static HB_ERRCODE hb_waChildStart( AREAP pArea, LPDBRELINFO pRelInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waChildStart(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waChildStart(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); HB_SYMBOL_UNUSED( pRelInfo ); pArea->uiParents++; @@ -1408,7 +1406,7 @@ static HB_ERRCODE hb_waSyncChildren( AREAP pArea ) LPDBRELINFO lpdbRelation; - HB_TRACE( HB_TR_DEBUG, ( "hb_waSyncChildren(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waSyncChildren(%p)", ( void * ) pArea ) ); lpdbRelation = pArea->lpdbRelations; while( lpdbRelation ) @@ -1426,7 +1424,7 @@ static HB_ERRCODE hb_waSyncChildren( AREAP pArea ) */ static HB_ERRCODE hb_waClearRel( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waClearRel(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waClearRel(%p)", ( void * ) pArea ) ); /* Free all relations */ if( pArea->lpdbRelations ) @@ -1467,7 +1465,7 @@ static HB_ERRCODE hb_waRelArea( AREAP pArea, HB_USHORT uiRelNo, HB_USHORT * pRel LPDBRELINFO lpdbRelations; HB_USHORT uiIndex = 1; - HB_TRACE( HB_TR_DEBUG, ( "hb_waRelArea(%p, %hu, %p)", pArea, uiRelNo, pRelArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waRelArea(%p, %hu, %p)", ( void * ) pArea, uiRelNo, ( void * ) pRelArea ) ); *pRelArea = 0; lpdbRelations = pArea->lpdbRelations; @@ -1491,7 +1489,7 @@ static HB_ERRCODE hb_waRelEval( AREAP pArea, LPDBRELINFO pRelInfo ) HB_ERRCODE errCode; HB_BOOL fEof; - HB_TRACE( HB_TR_DEBUG, ( "hb_waRelEval(%p, %p)", pArea, pRelInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waRelEval(%p, %p)", ( void * ) pArea, ( void * ) pRelInfo ) ); errCode = SELF_EOF( pRelInfo->lpaParent, &fEof ); if( errCode == HB_SUCCESS ) @@ -1568,7 +1566,7 @@ static HB_ERRCODE hb_waRelText( AREAP pArea, HB_USHORT uiRelNo, PHB_ITEM pExpr ) LPDBRELINFO lpdbRelations; HB_USHORT uiIndex = 1; - HB_TRACE( HB_TR_DEBUG, ( "hb_waRelText(%p, %hu, %p)", pArea, uiRelNo, pExpr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waRelText(%p, %hu, %p)", ( void * ) pArea, uiRelNo, ( void * ) pExpr ) ); lpdbRelations = pArea->lpdbRelations; @@ -1592,7 +1590,7 @@ static HB_ERRCODE hb_waSetRel( AREAP pArea, LPDBRELINFO lpdbRelInf ) { LPDBRELINFO lpdbRelations; - HB_TRACE( HB_TR_DEBUG, ( "hb_waSetRel(%p, %p)", pArea, lpdbRelInf ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waSetRel(%p, %p)", ( void * ) pArea, ( void * ) lpdbRelInf ) ); lpdbRelations = pArea->lpdbRelations; if( ! lpdbRelations ) @@ -1623,7 +1621,7 @@ static HB_ERRCODE hb_waSetRel( AREAP pArea, LPDBRELINFO lpdbRelInf ) */ static HB_ERRCODE hb_waClearFilter( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waClearFilter(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waClearFilter(%p)", ( void * ) pArea ) ); /* Free all items */ if( pArea->dbfi.itmCobExpr ) @@ -1647,7 +1645,7 @@ static HB_ERRCODE hb_waClearFilter( AREAP pArea ) */ static HB_ERRCODE hb_waClearLocate( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waClearLocate(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waClearLocate(%p)", ( void * ) pArea ) ); /* Free all items */ if( pArea->dbsi.itmCobFor ) @@ -1694,7 +1692,7 @@ static HB_ERRCODE hb_waClearLocate( AREAP pArea ) */ static HB_ERRCODE hb_waFilterText( AREAP pArea, PHB_ITEM pFilter ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waFilterText(%p, %p)", pArea, pFilter ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waFilterText(%p, %p)", ( void * ) pArea, ( void * ) pFilter ) ); if( pArea->dbfi.abFilterText ) hb_itemCopy( pFilter, pArea->dbfi.abFilterText ); @@ -1707,7 +1705,7 @@ static HB_ERRCODE hb_waFilterText( AREAP pArea, PHB_ITEM pFilter ) */ static HB_ERRCODE hb_waSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waSetFilter(%p, %p)", pArea, pFilterInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waSetFilter(%p, %p)", ( void * ) pArea, ( void * ) pFilterInfo ) ); /* Clear the active filter expression */ if( SELF_CLEARFILTER( pArea ) != HB_SUCCESS ) @@ -1732,7 +1730,7 @@ static HB_ERRCODE hb_waSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo ) */ static HB_ERRCODE hb_waSetLocate( AREAP pArea, LPDBSCOPEINFO pScopeInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waSetLocate(%p, %p)", pArea, pScopeInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waSetLocate(%p, %p)", ( void * ) pArea, ( void * ) pScopeInfo ) ); /* Clear the active locate expression */ if( SELF_CLEARLOCATE( pArea ) != HB_SUCCESS ) @@ -1776,7 +1774,7 @@ static HB_ERRCODE hb_waCompile( AREAP pArea, const char * pExpr ) { PHB_MACRO pMacro; - HB_TRACE( HB_TR_DEBUG, ( "hb_waCompile(%p, %p)", pArea, pExpr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waCompile(%p, %p)", ( void * ) pArea, ( const void * ) pExpr ) ); pMacro = hb_macroCompile( pExpr ); if( pMacro ) @@ -1795,7 +1793,7 @@ static HB_ERRCODE hb_waError( AREAP pArea, PHB_ITEM pError ) { char szRddName[ HB_RDD_MAX_DRIVERNAME_LEN + 1 ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_waError(%p, %p)", pArea, pError ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waError(%p, %p)", ( void * ) pArea, ( void * ) pError ) ); if( pArea && pArea->lprfsHost->sysName ) SELF_SYSNAME( pArea, szRddName ); @@ -1814,7 +1812,7 @@ static HB_ERRCODE hb_waEvalBlock( AREAP pArea, PHB_ITEM pBlock ) PHB_ITEM pItem; int iCurrArea, iUsedArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_waEvalBlock(%p, %p)", pArea, pBlock ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waEvalBlock(%p, %p)", ( void * ) pArea, ( void * ) pBlock ) ); iCurrArea = hb_rddGetCurrentWorkAreaNumber(); iUsedArea = pArea->uiArea; @@ -1843,7 +1841,7 @@ static HB_ERRCODE hb_waRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulCo HB_BOOL fResult; int iResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnection, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddInfo(%p, %hu, %lu, %p)", ( void * ) pRDD, uiIndex, ulConnection, ( void * ) pItem ) ); HB_SYMBOL_UNUSED( pRDD ); HB_SYMBOL_UNUSED( ulConnection ); @@ -1939,7 +1937,7 @@ static HB_ERRCODE hb_waRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulCo case RDDI_TRIGGER: case RDDI_PENDINGTRIGGER: hb_itemPutC( pItem, NULL ); - /* fallthrough */ /*return HB_FAILURE */ + /* fallthrough */ /* return HB_FAILURE */ default: return HB_FAILURE; @@ -1954,7 +1952,7 @@ static HB_ERRCODE hb_waUnsupported( AREAP pArea ) { PHB_ITEM pError; - HB_TRACE( HB_TR_DEBUG, ( "hb_waUnsupported(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waUnsupported(%p)", ( void * ) pArea ) ); pError = hb_errNew(); hb_errPutGenCode( pError, EG_UNSUPPORTED ); @@ -1972,7 +1970,7 @@ static HB_ERRCODE hb_waRddUnsupported( LPRDDNODE pRDD ) { PHB_ITEM pError; - HB_TRACE( HB_TR_DEBUG, ( "hb_waRDDUnsupported(%p)", pRDD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waRDDUnsupported(%p)", ( void * ) pRDD ) ); pError = hb_errNew(); hb_errPutGenCode( pError, EG_UNSUPPORTED ); @@ -1992,7 +1990,7 @@ static HB_ERRCODE hb_waRddUnsupported( LPRDDNODE pRDD ) */ static HB_ERRCODE hb_waNull( AREAP pArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_waNull(%p)", pArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_waNull(%p)", ( void * ) pArea ) ); HB_SYMBOL_UNUSED( pArea ); @@ -2143,7 +2141,7 @@ static HB_USHORT s_uiRddRedirMax = 0; static HB_USHORT s_uiRddRedirCount = 0; /* - * Get RDD node poionter + * Get RDD node pointer */ LPRDDNODE hb_rddGetNode( HB_USHORT uiNode ) { @@ -2156,7 +2154,6 @@ PHB_ITEM hb_rddList( HB_USHORT uiType ) { HB_USHORT uiCount, uiIndex, uiRdds; PHB_ITEM pRddArray; - LPRDDNODE pNode; HB_TRACE( HB_TR_DEBUG, ( "hb_rddList(%hu)", uiType ) ); @@ -2168,7 +2165,7 @@ PHB_ITEM hb_rddList( HB_USHORT uiType ) pRddArray = hb_itemArrayNew( uiRdds ); for( uiCount = uiIndex = 0; uiCount < s_uiRddCount && uiIndex < uiRdds; ++uiCount ) { - pNode = s_RddList[ uiCount ]; + LPRDDNODE pNode = s_RddList[ uiCount ]; if( uiType == 0 || pNode->uiType == uiType ) hb_arraySetC( pRddArray, ++uiIndex, pNode->szName ); } @@ -2182,7 +2179,7 @@ LPRDDNODE hb_rddFindNode( const char * szDriver, HB_USHORT * uiIndex ) { HB_USHORT uiCount; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddFindNode(%s, %p)", szDriver, uiIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddFindNode(%s, %p)", szDriver, ( void * ) uiIndex ) ); for( uiCount = 0; uiCount < s_uiRddCount; uiCount++ ) { @@ -2200,13 +2197,13 @@ LPRDDNODE hb_rddFindNode( const char * szDriver, HB_USHORT * uiIndex ) } /* - * Find a RDD node respecing file/table name + * Find a RDD node respecting file/table name */ LPRDDNODE hb_rddFindFileNode( LPRDDNODE pRddNode, const char * szFileName ) { HB_USHORT uiCount; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddFindFileNode(%p, %s)", pRddNode, szFileName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddFindFileNode(%p, %s)", ( void * ) pRddNode, szFileName ) ); if( szFileName && szFileName[ 0 ] && s_uiRddRedirCount ) { @@ -2238,7 +2235,7 @@ void hb_rddSetFileRedirector( HB_RDDACCEPT funcAccept, HB_BOOL fEnable ) { HB_USHORT uiCount, uiFree; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddSetFileRedirector(%p, %d)", funcAccept, fEnable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddSetFileRedirector(%p, %d)", ( void * ) funcAccept, fEnable ) ); hb_threadEnterCriticalSection( &s_rddMtx ); uiFree = s_uiRddRedirCount + 1; @@ -2390,7 +2387,7 @@ HB_ERRCODE hb_rddInheritEx( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, DBENTRYP_V * pFunction; const DBENTRYP_V * pSubFunction; - HB_TRACE( HB_TR_DEBUG, ( "hb_rddInheritEx(%p, %p, %p, %s, %p)", pTable, pSubTable, pSuperTable, szDrvName, puiSuperRddId ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddInheritEx(%p, %p, %p, %s, %p)", ( void * ) pTable, ( const void * ) pSubTable, ( void * ) pSuperTable, szDrvName, ( void * ) puiSuperRddId ) ); if( ! pTable ) { @@ -2437,7 +2434,7 @@ HB_ERRCODE hb_rddInheritEx( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, HB_ERRCODE hb_rddInherit( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, RDDFUNCS * pSuperTable, const char * szDrvName ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_rddInherit(%p, %p, %p, %s)", pTable, pSubTable, pSuperTable, szDrvName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_rddInherit(%p, %p, %p, %s)", ( void * ) pTable, ( const void * ) pSubTable, ( void * ) pSuperTable, szDrvName ) ); return hb_rddInheritEx( pTable, pSubTable, pSuperTable, szDrvName, NULL ); } diff --git a/src/rtl/accept.c b/src/rtl/accept.c index e6d656161f..ebea0caa37 100644 --- a/src/rtl/accept.c +++ b/src/rtl/accept.c @@ -1,6 +1,7 @@ /* * ACCEPT command related functions * + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (__AcceptStr()) * Copyright 1999 Eddie Runia <eddie@runia.com> * * This program is free software; you can redistribute it and/or modify @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * __AcceptStr() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbvm.h" #include "hbapigt.h" @@ -62,7 +53,7 @@ HB_FUNC_EXTERN( QOUT ); -#define ACCEPT_BUFFER_LEN 256 /* length of input buffer for ACCEPT command */ +#define ACCEPT_BUFFER_LEN 256 /* length of input buffer for ACCEPT command */ #ifdef HB_CLP_UNDOC diff --git a/src/rtl/achoice.prg b/src/rtl/achoice.prg index de782f4ff5..9aa8ebb426 100644 --- a/src/rtl/achoice.prg +++ b/src/rtl/achoice.prg @@ -98,10 +98,10 @@ FUNCTION AChoice( nTop, nLeft, nBottom, nRight, acItems, xSelect, xUserFunc, nPo nPos := 0 ENDIF - // Ensure hilighted item can be selected + // Ensure highlighted item can be selected nPos := BETWEEN( nFrstItem, nPos, nLastItem ) - // Force hilighted row to be valid + // Force highlighted row to be valid nHiLiteRow := BETWEEN( 0, nHiLiteRow, nNumRows - 1 ) // Force the topmost item to be a valid index of the array @@ -516,7 +516,7 @@ FUNCTION AChoice( nTop, nLeft, nBottom, nRight, acItems, xSelect, xUserFunc, nPo IF nPos > 0 .AND. nMode != AC_EXCEPT #if 0 - /* TOVERIFY: Disabled nRowsClr DispPage(). + /* TODO: Disabled nRowsClr in DispPage() call: Please verify it, I do not know why it was added but it breaks code which adds dynamically new acItems positions */ nRowsClr := Min( nNumRows, nItems ) @@ -646,11 +646,12 @@ STATIC FUNCTION Ach_Select( alSelect, nPos ) IF nPos >= 1 .AND. nPos <= Len( alSelect ) sel := alSelect[ nPos ] - IF HB_ISEVALITEM( sel ) + DO CASE + CASE HB_ISEVALITEM( sel ) sel := Eval( sel ) - ELSEIF HB_ISSTRING( sel ) .AND. ! Empty( sel ) + CASE HB_ISSTRING( sel ) .AND. ! Empty( sel ) sel := Eval( hb_macroBlock( sel ) ) - ENDIF + ENDCASE IF HB_ISLOGICAL( sel ) RETURN sel ENDIF diff --git a/src/rtl/alert.prg b/src/rtl/alert.prg index 16ebcc3e59..ffeb7f98bb 100644 --- a/src/rtl/alert.prg +++ b/src/rtl/alert.prg @@ -2,17 +2,8 @@ * Alert(), hb_Alert() functions * * Released to Public Domain by Vladimir Kazimirchik <v_kazimirchik@yahoo.com> - * - */ - -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * Changes for higher Clipper compatibility, console mode, extensions - * __NoNoAlert() - * - * See COPYING.txt for licensing terms. + * Further modifications 1999-2017 Viktor Szakats (vszakats.net/harbour) + * Changes for higher Clipper compatibility, console mode, extensions, __NoNoAlert() * */ @@ -22,7 +13,7 @@ #include "setcurs.ch" #include "hbgtinfo.ch" -/* TOFIX: Clipper defines a clipped window for Alert() [vszakats] */ +/* FIXME: Clipper defines a clipped window for Alert() [vszakats] */ /* NOTE: Clipper will return NIL if the first parameter is not a string, but this is not documented. [vszakats] */ @@ -77,13 +68,14 @@ FUNCTION Alert( cMessage, aOptions, cColorNorm ) ENDIF NEXT - IF Len( aOptionsOK ) == 0 + DO CASE + CASE Len( aOptionsOK ) == 0 aOptionsOK := { "Ok" } #ifdef HB_CLP_STRICT - ELSEIF Len( aOptionsOK ) > 4 /* NOTE: Clipper allows only four options [vszakats] */ + CASE Len( aOptionsOK ) > 4 /* NOTE: Clipper allows only four options [vszakats] */ ASize( aOptionsOK, 4 ) #endif - ENDIF + ENDCASE RETURN hb_gtAlert( cMessage, aOptionsOK, cColorNorm, cColorHigh ) @@ -114,16 +106,17 @@ FUNCTION hb_Alert( xMessage, aOptions, cColorNorm, nDelay ) RETURN NIL ENDIF - IF HB_ISARRAY( xMessage ) + DO CASE + CASE HB_ISARRAY( xMessage ) cMessage := "" FOR EACH cString IN xMessage cMessage += iif( cString:__enumIsFirst(), "", Chr( 10 ) ) + hb_CStr( cString ) NEXT - ELSEIF HB_ISSTRING( xMessage ) + CASE HB_ISSTRING( xMessage ) cMessage := StrTran( xMessage, ";", Chr( 10 ) ) - ELSE + OTHERWISE cMessage := hb_CStr( xMessage ) - ENDIF + ENDCASE IF ! HB_ISSTRING( cColorNorm ) .OR. Empty( cColorNorm ) cColorNorm := "W+/R" // first pair color (Box line and Text) @@ -143,13 +136,14 @@ FUNCTION hb_Alert( xMessage, aOptions, cColorNorm, nDelay ) ENDIF NEXT - IF Len( aOptionsOK ) == 0 + DO CASE + CASE Len( aOptionsOK ) == 0 aOptionsOK := { "Ok" } #ifdef HB_CLP_STRICT - ELSEIF Len( aOptionsOK ) > 4 /* NOTE: Clipper allows only four options [vszakats] */ + CASE Len( aOptionsOK ) > 4 /* NOTE: Clipper allows only four options [vszakats] */ ASize( aOptionsOK, 4 ) #endif - ENDIF + ENDCASE RETURN hb_gtAlert( cMessage, aOptionsOK, cColorNorm, cColorHigh, nDelay ) diff --git a/src/rtl/altd.prg b/src/rtl/altd.prg index 91bbbe0580..758f40dd74 100644 --- a/src/rtl/altd.prg +++ b/src/rtl/altd.prg @@ -5,11 +5,6 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * @@ -49,14 +44,14 @@ * */ -#define ALTD_DISABLE 0 -#define ALTD_ENABLE 1 +#define ALTD_DISABLE 0 +#define ALTD_ENABLE 1 PROCEDURE AltD( nAction ) IF PCount() == 0 - /* do not activate the debugger imediatelly because the module + /* do not activate the debugger immediately because the module where AltD() was called can have no debugger info - stop on first LINE with debugged info */ __dbgInvokeDebug( Set( _SET_DEBUG ) ) diff --git a/src/rtl/arc4.c b/src/rtl/arc4.c index 720845c4bd..0fa1dfffcd 100644 --- a/src/rtl/arc4.c +++ b/src/rtl/arc4.c @@ -61,11 +61,9 @@ #if defined( HB_OS_WIN ) # if ! defined( __TINYC__ ) # include <wincrypt.h> -# include <process.h> # endif #elif defined( HB_OS_DOS ) || defined( HB_OS_OS2 ) # include <sys/types.h> -# include <process.h> #else # if ! defined( __WATCOMC__ ) # include <sys/param.h> @@ -110,8 +108,8 @@ static struct arc4_stream rs; static HB_I32 arc4_count; static HB_CRITICAL_NEW( arc4_lock ); -#define _ARC4_LOCK() hb_threadEnterCriticalSection( &arc4_lock ) -#define _ARC4_UNLOCK() hb_threadLeaveCriticalSection( &arc4_lock ) +#define ARC4_LOCK() hb_threadEnterCriticalSection( &arc4_lock ) +#define ARC4_UNLOCK() hb_threadLeaveCriticalSection( &arc4_lock ) #if defined( __BORLANDC__ ) && defined( _HB_INLINE_ ) #undef _HB_INLINE_ @@ -132,12 +130,12 @@ static _HB_INLINE_ void arc4_init( void ) static _HB_INLINE_ void arc4_addrandom( const HB_U8 * dat, int datlen ) { - int n; - HB_U8 si; + int n; rs.i--; for( n = 0; n < 256; ++n ) { + HB_U8 si; rs.i = ( rs.i + 1 ); si = rs.s[ rs.i ]; rs.j = rs.j + si + dat[ n % datlen ]; @@ -151,11 +149,10 @@ static _HB_INLINE_ void arc4_addrandom( const HB_U8 * dat, int datlen ) static HB_ISIZ read_all( int fd, HB_U8 * buf, size_t count ) { HB_SIZE numread = 0; - HB_ISIZ result; while( numread < count ) { - result = read( fd, buf + numread, count - numread ); + HB_ISIZ result = read( fd, buf + numread, count - numread ); if( result < 0 ) return -1; @@ -175,18 +172,18 @@ static HB_ISIZ read_all( int fd, HB_U8 * buf, size_t count ) static int arc4_seed_win( void ) { /* This is adapted from Tor's crypto_seed_rng() */ - static int provider_set = 0; - static HCRYPTPROV provider; + static int s_provider_set = 0; + static HCRYPTPROV s_provider; unsigned char buf[ ADD_ENTROPY ]; - if( ! provider_set && - ! CryptAcquireContext( &provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) && + if( ! s_provider_set && + ! CryptAcquireContext( &s_provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT ) && GetLastError() != ( DWORD ) NTE_BAD_KEYSET ) return -1; - provider_set = 1; + s_provider_set = 1; - if( ! CryptGenRandom( provider, sizeof( buf ), buf ) ) + if( ! CryptGenRandom( s_provider, sizeof( buf ), buf ) ) return -1; arc4_addrandom( buf, sizeof( buf ) ); @@ -324,14 +321,15 @@ static int arc4_seed_proc_sys_kernel_random_uuid( void ) * but not /dev/urandom. Let's try /proc/sys/kernel/random/uuid. * Its format is stupid, so we need to decode it from hex. */ - int fd; char buf[ 128 ]; HB_U8 entropy[ 64 ]; - int bytes, n, i, nybbles; + int bytes, i, nybbles; for( bytes = 0; bytes < ADD_ENTROPY; ) { - fd = open( "/proc/sys/kernel/random/uuid", O_RDONLY, 0 ); + int fd = open( "/proc/sys/kernel/random/uuid", O_RDONLY, 0 ); + int n; + if( fd < 0 ) return -1; @@ -382,13 +380,16 @@ static int arc4_seed_urandom( void ) "/dev/random", NULL }; - HB_U8 buf[ ADD_ENTROPY ]; - int fd, i; - HB_SIZE n; + + int i; for( i = 0; filenames[ i ]; ++i ) { - fd = open( filenames[ i ], O_RDONLY, 0 ); + HB_U8 buf[ ADD_ENTROPY ]; + HB_SIZE n; + + int fd = open( filenames[ i ], O_RDONLY, 0 ); + if( fd < 0 ) continue; @@ -491,7 +492,7 @@ static void arc4_stir( void ) * Discard early keystream, as per recommendations in * "Weaknesses in the Key Scheduling Algorithm of RC4" by * Scott Fluhrer, Itsik Mantin, and Adi Shamir. - * http://www.wisdom.weizmann.ac.il/~itsik/RC4/Papers/Rc4_ksa.ps + * https://web.archive.org/web/www.wisdom.weizmann.ac.il/~itsik/RC4/Papers/Rc4_ksa.ps * * Ilya Mironov's "(Not So) Random Shuffles of RC4" suggests that * we drop at least 2*256 bytes, with 12*256 as a conservative @@ -560,16 +561,16 @@ static _HB_INLINE_ HB_U32 arc4_getword( void ) */ void arc4random_stir( void ) { - _ARC4_LOCK(); + ARC4_LOCK(); arc4_stir(); - _ARC4_UNLOCK(); + ARC4_UNLOCK(); } void arc4random_addrandom( const unsigned char * dat, int datlen ) { int j; - _ARC4_LOCK(); + ARC4_LOCK(); if( ! rs_initialized ) arc4_stir(); @@ -583,7 +584,7 @@ void arc4random_addrandom( const unsigned char * dat, int datlen ) */ arc4_addrandom( dat + j, datlen - j ); } - _ARC4_UNLOCK(); + ARC4_UNLOCK(); } #endif @@ -591,13 +592,13 @@ HB_U32 hb_arc4random( void ) { HB_U32 val; - _ARC4_LOCK(); + ARC4_LOCK(); arc4_count -= 4; arc4_stir_if_needed(); val = arc4_getword(); - _ARC4_UNLOCK(); + ARC4_UNLOCK(); return val; } @@ -606,7 +607,7 @@ void hb_arc4random_buf( void * _buf, HB_SIZE n ) { HB_U8 * buf = ( HB_U8 * ) _buf; - _ARC4_LOCK(); + ARC4_LOCK(); arc4_stir_if_needed(); @@ -618,7 +619,7 @@ void hb_arc4random_buf( void * _buf, HB_SIZE n ) buf[ n ] = arc4_getbyte(); } - _ARC4_UNLOCK(); + ARC4_UNLOCK(); } /* diff --git a/src/rtl/at.c b/src/rtl/at.c index 947131ea7a..782f57b7b1 100644 --- a/src/rtl/at.c +++ b/src/rtl/at.c @@ -63,7 +63,7 @@ HB_FUNC( HB_AT ) const char * pszText = hb_itemGetCPtr( pText ); HB_SIZE nTextLength = hb_itemGetCLen( pText ); HB_SIZE nStart = hb_parns( 3 ); - HB_SIZE nFrom, nTo, nPos = 0; + HB_SIZE nFrom, nPos = 0; if( nStart <= 1 ) nStart = nFrom = 0; @@ -74,6 +74,8 @@ HB_FUNC( HB_AT ) if( nFrom < nTextLength ) { + HB_SIZE nTo; + pszText += nFrom; nTextLength -= nFrom; if( HB_ISNUM( 4 ) ) diff --git a/src/rtl/ati.c b/src/rtl/ati.c index d000aee97c..7a0fb3b5ba 100644 --- a/src/rtl/ati.c +++ b/src/rtl/ati.c @@ -53,7 +53,7 @@ static HB_SIZE s_strAtI( PHB_CODEPAGE cdp, const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "s_strAtI(%p, %s, %" HB_PFS "u, %s, %" HB_PFS "u)", cdp, szSub, nSubLen, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "s_strAtI(%p, %s, %" HB_PFS "u, %s, %" HB_PFS "u)", ( void * ) cdp, szSub, nSubLen, szText, nLen ) ); if( nSubLen > 0 && nLen >= nSubLen ) { @@ -91,7 +91,7 @@ HB_FUNC( HB_ATI ) const char * pszText = hb_itemGetCPtr( pText ); HB_SIZE nTextLength = hb_itemGetCLen( pText ); HB_SIZE nStart = hb_parns( 3 ); - HB_SIZE nFrom, nTo, nPos = 0; + HB_SIZE nFrom, nPos = 0; if( nStart <= 1 ) nStart = nFrom = 0; @@ -102,6 +102,8 @@ HB_FUNC( HB_ATI ) if( nFrom < nTextLength ) { + HB_SIZE nTo; + pszText += nFrom; nTextLength -= nFrom; if( HB_ISNUM( 4 ) ) diff --git a/src/rtl/base64d.c b/src/rtl/base64d.c index 6fb4f7a0f4..c2e823470e 100644 --- a/src/rtl/base64d.c +++ b/src/rtl/base64d.c @@ -4,7 +4,7 @@ * Copyright 2011 Viktor Szakats (vszakats.net/harbour) * [ base64_decode_* functions are part of the libb64 project, and has * been placed in the public domain. Author: Chris Venter - * For details, see http://sourceforge.net/projects/libb64 ] + * For details, see https://libb64.sourceforge.io/ ] * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/rtl/browdb.prg b/src/rtl/browdb.prg index caa026c986..38ea2128ca 100644 --- a/src/rtl/browdb.prg +++ b/src/rtl/browdb.prg @@ -61,26 +61,27 @@ FUNCTION __dbSkipper( nRecs ) LOCAL nSkipped := 0 IF LastRec() != 0 - IF nRecs == 0 + DO CASE + CASE nRecs == 0 dbSkip( 0 ) - ELSEIF nRecs > 0 .AND. RecNo() != LastRec() + 1 + CASE nRecs > 0 .AND. RecNo() != LastRec() + 1 DO WHILE nSkipped < nRecs - dbSkip( 1 ) + dbSkip() IF Eof() dbSkip( -1 ) EXIT ENDIF - nSkipped++ + ++nSkipped ENDDO - ELSEIF nRecs < 0 + CASE nRecs < 0 DO WHILE nSkipped > nRecs dbSkip( -1 ) IF Bof() EXIT ENDIF - nSkipped-- + --nSkipped ENDDO - ENDIF + ENDCASE ENDIF RETURN nSkipped diff --git a/src/rtl/browse.prg b/src/rtl/browse.prg index 9366c3ddbf..a1a8a021b0 100644 --- a/src/rtl/browse.prg +++ b/src/rtl/browse.prg @@ -405,9 +405,10 @@ STATIC FUNCTION Skipped( nRecs, lAppend ) LOCAL nSkipped := 0 IF LastRec() != 0 - IF nRecs == 0 + DO CASE + CASE nRecs == 0 dbSkip( 0 ) - ELSEIF nRecs > 0 .AND. RecNo() != LastRec() + 1 + CASE nRecs > 0 .AND. RecNo() != LastRec() + 1 DO WHILE nSkipped < nRecs dbSkip() IF Eof() @@ -420,7 +421,7 @@ STATIC FUNCTION Skipped( nRecs, lAppend ) ENDIF ++nSkipped ENDDO - ELSEIF nRecs < 0 + CASE nRecs < 0 DO WHILE nSkipped > nRecs dbSkip( -1 ) IF Bof() @@ -428,7 +429,7 @@ STATIC FUNCTION Skipped( nRecs, lAppend ) ENDIF --nSkipped ENDDO - ENDIF + ENDCASE ENDIF RETURN nSkipped diff --git a/src/rtl/cdpapihb.c b/src/rtl/cdpapihb.c index e1093b5768..e3669c444d 100644 --- a/src/rtl/cdpapihb.c +++ b/src/rtl/cdpapihb.c @@ -236,7 +236,6 @@ HB_FUNC( HB_UTF8ASC ) HB_FUNC( HB_STRTOUTF8 ) { HB_SIZE nLen = hb_parclen( 1 ), nDest = 0; - const char * szString; char * szDest = NULL; if( nLen ) @@ -253,7 +252,7 @@ HB_FUNC( HB_STRTOUTF8 ) } else { - szString = hb_parc( 1 ); + const char * szString = hb_parc( 1 ); nDest = hb_cdpStrAsUTF8Len( cdp, szString, nLen, 0 ); szDest = ( char * ) hb_xgrab( nDest + 1 ); hb_cdpStrToUTF8( cdp, szString, nLen, szDest, nDest + 1 ); diff --git a/src/rtl/cdpdet.prg b/src/rtl/cdpdet.prg index fbc03dd892..d12cf97a0e 100644 --- a/src/rtl/cdpdet.prg +++ b/src/rtl/cdpdet.prg @@ -170,7 +170,7 @@ STATIC FUNCTION __UnixParseLangCP( cString, /* @ */ cLang ) cCP := Stuff( cCP, Len( "iso8859" ) + 1, 0, "-" ) ENDIF - /* Convert UNIX CP name to Harbour CP ID */ + /* Convert Unix CP name to Harbour CP ID */ SWITCH cCP CASE "utf8" CASE "cp437" diff --git a/src/rtl/cdpdetc.c b/src/rtl/cdpdetc.c index 4c9e8ee699..e7d9b77731 100644 --- a/src/rtl/cdpdetc.c +++ b/src/rtl/cdpdetc.c @@ -1,7 +1,7 @@ /* * CP detection (low-level) * - * Copyright 2009-2012 Viktor Szakats (vszakats.net/harbour) + * Copyright 2009-2014 Viktor Szakats (vszakats.net/harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/rtl/checkbox.prg b/src/rtl/checkbox.prg index 98fcaab8c0..f2d47afad5 100644 --- a/src/rtl/checkbox.prg +++ b/src/rtl/checkbox.prg @@ -343,7 +343,7 @@ METHOD New( nRow, nCol, cCaption ) CLASS CheckBox RETURN Self -FUNCTION _CHECKBOX_( lState, cCaption, cMessage, cColorSpec, bFBlock, bSBlock, cStyle, aBitmaps ) +FUNCTION _CheckBox_( lState, cCaption, cMessage, cColorSpec, bFBlock, bSBlock, cStyle, aBitmaps ) LOCAL o := HBCheckBox():New( Row(), Col(), cCaption ) diff --git a/src/rtl/chrasc.c b/src/rtl/chrasc.c index d6f6c976a2..e8fff5ae5f 100644 --- a/src/rtl/chrasc.c +++ b/src/rtl/chrasc.c @@ -59,7 +59,7 @@ HB_FUNC( CHR ) can be divided by 256 but it's not zero, in this case it will return an empty string instead of a Chr( 0 ). [vszakats] */ - /* Believe it or not, clipper does this! */ + /* Believe it or not, Cl*pper does this! */ #ifdef HB_CLP_STRICT char szChar[ 2 ]; szChar[ 0 ] = hb_parnl( 1 ) % 256; diff --git a/src/rtl/chruni.c b/src/rtl/chruni.c index 597445443f..0e774afc01 100644 --- a/src/rtl/chruni.c +++ b/src/rtl/chruni.c @@ -51,7 +51,7 @@ #include "hbapiitm.h" #include "hbapierr.h" -/* hb_UChar( <nCode> ) -> <cText> +/* hb_UChar( <nCode> ) --> <cText> * return string with U+nCode character in HVM CP encoding */ HB_FUNC( HB_UCHAR ) @@ -69,7 +69,7 @@ HB_FUNC( HB_UCHAR ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BChar( <nCode> ) -> <cText> +/* hb_BChar( <nCode> ) --> <cText> * return 1 byte string with <nCode> value */ HB_FUNC( HB_BCHAR ) @@ -84,8 +84,8 @@ HB_FUNC( HB_BCHAR ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_UCode( <cText> ) -> <nCode> - * return unicode value of 1-st character (not byte) in given string +/* hb_UCode( <cText> ) --> <nCode> + * return unicode value of 1st character (not byte) in given string */ HB_FUNC( HB_UCODE ) { @@ -98,8 +98,8 @@ HB_FUNC( HB_UCODE ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BCode( <cText> ) -> <nCode> - * return value of 1-st byte in given string +/* hb_BCode( <cText> ) --> <nCode> + * return value of 1st byte in given string */ HB_FUNC( HB_BCODE ) { @@ -111,7 +111,7 @@ HB_FUNC( HB_BCODE ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_ULen( <cText> ) -> <nChars> +/* hb_ULen( <cText> ) --> <nChars> * return string length in characters */ HB_FUNC( HB_ULEN ) @@ -125,7 +125,7 @@ HB_FUNC( HB_ULEN ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BLen( <cText> ) -> <nBytes> +/* hb_BLen( <cText> ) --> <nBytes> * return string length in bytes */ HB_FUNC( HB_BLEN ) @@ -138,8 +138,8 @@ HB_FUNC( HB_BLEN ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_UPeek( <cText>, <n> ) -> <nCode> - * return unicode value of <n>-th character in given string +/* hb_UPeek( <cText>, <n> ) --> <nCode> + * return unicode value of <n>th character in given string */ HB_FUNC( HB_UPEEK ) { @@ -167,8 +167,8 @@ HB_FUNC( HB_UPEEK ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BPeek( <cText>, <n> ) -> <nCode> - * return value of <n>-th byte in given string +/* hb_BPeek( <cText>, <n> ) --> <nCode> + * return value of <n>th byte in given string */ HB_FUNC( HB_BPEEK ) { @@ -185,8 +185,8 @@ HB_FUNC( HB_BPEEK ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_UPoke( [@]<cText>, <n>, <nVal> ) -> <cText> - * change <n>-th character in given string to unicode <nVal> one and return modified text +/* hb_UPoke( [@]<cText>, <n>, <nVal> ) --> <cText> + * change <n>th character in given string to unicode <nVal> one and return modified text */ HB_FUNC( HB_UPOKE ) { @@ -237,8 +237,8 @@ HB_FUNC( HB_UPOKE ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BPoke( [@]<cText>, <n>, <nVal> ) -> <cText> - * change <n>-th byte in given string to <nVal> and return modified text +/* hb_BPoke( [@]<cText>, <n>, <nVal> ) --> <cText> + * change <n>th byte in given string to <nVal> and return modified text */ HB_FUNC( HB_BPOKE ) { @@ -260,7 +260,7 @@ HB_FUNC( HB_BPOKE ) hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_USubStr( <cString>, <nStart>, <nCount> ) -> <cSubstring> +/* hb_USubStr( <cString>, <nStart>, <nCount> ) --> <cSubstring> */ HB_FUNC( HB_USUBSTR ) { @@ -308,7 +308,7 @@ HB_FUNC( HB_USUBSTR ) hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BSubStr( <cString>, <nStart>, <nCount> ) -> <cSubstring> +/* hb_BSubStr( <cString>, <nStart>, <nCount> ) --> <cSubstring> */ HB_FUNC( HB_BSUBSTR ) { @@ -354,7 +354,7 @@ HB_FUNC( HB_BSUBSTR ) hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_ULeft( <cString>, <nCount> ) -> <cSubstring> +/* hb_ULeft( <cString>, <nCount> ) --> <cSubstring> */ HB_FUNC( HB_ULEFT ) { @@ -380,7 +380,7 @@ HB_FUNC( HB_ULEFT ) hb_errRT_BASE_SubstR( EG_ARG, 1124, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BLeft( <cString>, <nCount> ) -> <cSubstring> +/* hb_BLeft( <cString>, <nCount> ) --> <cSubstring> */ HB_FUNC( HB_BLEFT ) { @@ -404,7 +404,7 @@ HB_FUNC( HB_BLEFT ) hb_errRT_BASE_SubstR( EG_ARG, 1124, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_URight( <cString>, <nCount> ) -> <cSubstring> +/* hb_URight( <cString>, <nCount> ) --> <cSubstring> */ HB_FUNC( HB_URIGHT ) { @@ -432,7 +432,7 @@ HB_FUNC( HB_URIGHT ) hb_retc_null(); } -/* hb_BRight( <cString>, <nCount> ) -> <cSubstring> +/* hb_BRight( <cString>, <nCount> ) --> <cSubstring> */ HB_FUNC( HB_BRIGHT ) { @@ -452,7 +452,7 @@ HB_FUNC( HB_BRIGHT ) } -/* hb_UAt( <cSubString>, <cString>, [<nFrom>], [<nTo>] ) -> <nAt> +/* hb_UAt( <cSubString>, <cString>, [<nFrom>], [<nTo>] ) --> <nAt> */ HB_FUNC( HB_UAT ) { @@ -465,7 +465,7 @@ HB_FUNC( HB_UAT ) const char * pszText = hb_itemGetCPtr( pText ); HB_SIZE nTextLength = hb_itemGetCLen( pText ); HB_SIZE nStart = hb_parns( 3 ); - HB_SIZE nFrom, nTo, nPos = 0; + HB_SIZE nFrom, nPos = 0; if( nStart <= 1 ) nStart = nFrom = 0; @@ -474,6 +474,8 @@ HB_FUNC( HB_UAT ) if( nFrom < nTextLength ) { + HB_SIZE nTo; + pszText += nFrom; nTextLength -= nFrom; if( HB_ISNUM( 4 ) ) @@ -506,7 +508,7 @@ HB_FUNC( HB_UAT ) hb_errRT_BASE_SubstR( EG_ARG, 1108, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BAt( <cSubString>, <cString>, [<nFrom>], [<nTo>] ) -> <nAt> +/* hb_BAt( <cSubString>, <cString>, [<nFrom>], [<nTo>] ) --> <nAt> */ HB_FUNC( HB_BAT ) { @@ -518,7 +520,7 @@ HB_FUNC( HB_BAT ) const char * pszText = hb_itemGetCPtr( pText ); HB_SIZE nTextLength = hb_itemGetCLen( pText ); HB_SIZE nStart = hb_parns( 3 ); - HB_SIZE nFrom, nTo, nPos = 0; + HB_SIZE nFrom, nPos = 0; if( nStart <= 1 ) nStart = nFrom = 0; @@ -527,6 +529,8 @@ HB_FUNC( HB_BAT ) if( nFrom < nTextLength ) { + HB_SIZE nTo; + pszText += nFrom; nTextLength -= nFrom; if( HB_ISNUM( 4 ) ) @@ -558,7 +562,7 @@ HB_FUNC( HB_BAT ) hb_errRT_BASE_SubstR( EG_ARG, 1108, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_BRAt( <cSubString>, <cString>, [<nFrom>], [<nTo>] ) -> <nAt> +/* hb_BRAt( <cSubString>, <cString>, [<nFrom>], [<nTo>] ) --> <nAt> */ HB_FUNC( HB_BRAT ) { @@ -612,7 +616,7 @@ HB_FUNC( HB_BRAT ) hb_retns( nPos ); } -/* hb_BStuff( <cString>, <nAt>, <nDel>, <cIns> ) -> <cResult> +/* hb_BStuff( <cString>, <nAt>, <nDel>, <cIns> ) --> <cResult> */ HB_FUNC( HB_BSTUFF ) { @@ -657,7 +661,7 @@ HB_FUNC( HB_BSTUFF ) hb_retc_null(); } -/* hb_UStuff( <cString>, <nAt>, <nDel>, <cIns> ) -> <cResult> +/* hb_UStuff( <cString>, <nAt>, <nDel>, <cIns> ) --> <cResult> */ HB_FUNC( HB_USTUFF ) { @@ -703,5 +707,3 @@ HB_FUNC( HB_USTUFF ) else hb_retc_null(); } - -/* TODO: PadR(), PadC(), PadL() */ diff --git a/src/rtl/colorind.c b/src/rtl/colorind.c index 1fb2613aa7..f626ad2b46 100644 --- a/src/rtl/colorind.c +++ b/src/rtl/colorind.c @@ -52,7 +52,6 @@ HB_FUNC( HB_COLORINDEX ) { const char * pszColor = hb_parc( 1 ); HB_SIZE nColorPos; - HB_SIZE nColorLen; int iColorIndex = hb_parni( 2 ); /* Skip the given number of commas */ @@ -65,6 +64,8 @@ HB_FUNC( HB_COLORINDEX ) /* if found, continue */ if( iColorIndex == 0 ) { + HB_SIZE nColorLen; + /* Skip the spaces after the comma */ while( pszColor[ nColorPos ] == ' ' ) nColorPos++; diff --git a/src/rtl/console.c b/src/rtl/console.c index cb4804b52f..b7d8c1e700 100644 --- a/src/rtl/console.c +++ b/src/rtl/console.c @@ -2,6 +2,13 @@ * The Console API * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2015 Viktor Szakats (vszakats.net/harbour) (hb_conNewLine(), DispOutAt(), hb_StrEOL()) + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> + * hb_conOutAlt(), hb_conOutDev(), DevOut(), hb_conDevPos(), + * DevPos(), __Eject(), + * hb_conOut(), hb_conOutErr(), OutErr(), + * hb_conOutStd(), OutStd(), PCol(), PRow(), + * SetPRC(), and hb_conInit() * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,24 +51,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * hb_conOutAlt(), hb_conOutDev(), DevOut(), hb_conDevPos(), - * DevPos(), __Eject(), - * hb_conOut(), hb_conOutErr(), OutErr(), - * hb_conOutStd(), OutStd(), PCol(), PRow(), - * SetPRC(), and hb_conInit() - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_conNewLine() - * DispOutAt() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapicdp.h" #include "hbapiitm.h" @@ -122,7 +111,7 @@ void hb_conInit( void ) #if ! defined( HB_OS_WIN ) /* On Windows file handles with numbers 0, 1, 2 are - transalted inside filesys to: + translated inside filesys to: GetStdHandle( STD_INPUT_HANDLE ), GetStdHandle( STD_OUTPUT_HANDLE ), GetStdHandle( STD_ERROR_HANDLE ) */ @@ -139,7 +128,7 @@ void hb_conInit( void ) if( iStderr == 0 || iStderr == 1 ) /* //STDERR with no parameter or 0 */ s_hFilenoStderr = s_hFilenoStdout; - /* disabled in default builds. It's not multiplatform and very + /* disabled in default builds. It's not multi-platform and very * dangerous because it can redirect error messages to data files * [druzus] */ @@ -175,7 +164,7 @@ void hb_conRelease( void ) /* * Clipper does not restore screen size on exit so I removed the code with: * hb_gtSetMode( s_originalMaxRow + 1, s_originalMaxCol + 1 ); - * If the low level GT drive change some video adapter parameters which + * If the low-level GT drive change some video adapter parameters which * have to be restored on exit then it should does it in its Exit() * method. Here we cannot force any actions because it may cause bad * results in some GTs, f.e. when the screen size is controlled by remote @@ -364,7 +353,6 @@ HB_FUNC( QOUT ) if( ( pFile = hb_setGetPrinterHandle( HB_SET_PRN_CON ) ) != NULL ) { - char buf[ 256 ]; PHB_PRNPOS pPrnPos = hb_prnPos(); pPrnPos->row++; @@ -372,6 +360,8 @@ HB_FUNC( QOUT ) if( pPrnPos->col ) { + char buf[ 256 ]; + if( pPrnPos->col > ( int ) sizeof( buf ) ) { char * pBuf = ( char * ) hb_xgrab( pPrnPos->col ); @@ -579,7 +569,7 @@ HB_FUNC( DISPOUT ) /* writes a single value to the screen, but is not affected b /* NOTE: Clipper does no checks about the screen positions. [vszakats] */ -HB_FUNC( DISPOUTAT ) /* writes a single value to the screen at speficic position, but is not affected by SET ALTERNATE */ +HB_FUNC( DISPOUTAT ) /* writes a single value to the screen at specific position, but is not affected by SET ALTERNATE */ { char * pszString; HB_SIZE nLen; @@ -612,7 +602,7 @@ HB_FUNC( DISPOUTAT ) /* writes a single value to the screen at speficic position } } -/* Harbour extension, works like DISPOUTAT but does not change cursor position */ +/* Harbour extension, works like DispOutAt() but does not change cursor position */ HB_FUNC( HB_DISPOUTAT ) { diff --git a/src/rtl/cputime.c b/src/rtl/cputime.c index 1e25d95803..9989056dbf 100644 --- a/src/rtl/cputime.c +++ b/src/rtl/cputime.c @@ -71,7 +71,7 @@ #endif /* - SecondsCPU(n) -> nTime + SecondsCPU( n ) --> nTime FlagShip/CLIP compatible function, which reports how many CPU and/or system seconds have elapsed since the beginning of the program execution. n == 1 utime -> user CPU time of the current process diff --git a/src/rtl/datec.c b/src/rtl/datec.c index 655b5171d0..34d2b123dd 100644 --- a/src/rtl/datec.c +++ b/src/rtl/datec.c @@ -1,6 +1,7 @@ /* - * CMonth(), CDoW() functions + * CMonth(), CDoW(), hb_CDay() functions * + * Copyright 2014 Viktor Szakats (vszakats.net/harbour) (hb_CDay()) * Copyright 1999 Jose Lalin <dezac@corevia.com> * * This program is free software; you can redistribute it and/or modify @@ -53,7 +54,7 @@ #if defined( __CODEGUARD__ ) static const char s_nullStr[ 4 ] = { 0 }; #else -# define s_nullStr "" + #define s_nullStr "" #endif const char * hb_dateCMonth( int iMonth ) diff --git a/src/rtl/dates.c b/src/rtl/dates.c index 52c5b5f919..cc341dedb8 100644 --- a/src/rtl/dates.c +++ b/src/rtl/dates.c @@ -2,6 +2,7 @@ * The Date API (C level) * * Copyright 1999 David G. Holm <dholm@jsd-llc.com> + * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> (hb_timeFormat(), hb_timeUnformat(), hb_timeStampFormat(), hb_timeStampUnformat()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,18 +44,6 @@ * If you do not wish that, delete this exception notice. * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> - * hb_timeFormat() - * hb_timeUnformat() - * hb_timeStampFormat() - * hb_timeStampUnformat() - * - * See COPYING.txt for licensing terms. - * - */ #include "hbapi.h" #include "hbdate.h" @@ -68,7 +57,7 @@ char * hb_dateFormat( const char * szDate, char * szFormattedDate, const char * */ int format_count, digit_count, size; - HB_TRACE( HB_TR_DEBUG, ( "hb_dateFormat(%s, %p, %s)", szDate, szFormattedDate, szDateFormat ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateFormat(%s, %p, %s)", szDate, ( void * ) szFormattedDate, szDateFormat ) ); /* * Determine the maximum size of the formatted date string @@ -80,7 +69,6 @@ char * hb_dateFormat( const char * szDate, char * szFormattedDate, const char * if( szDate && strlen( szDate ) == 8 ) /* A valid date is always 8 characters */ { const char * szPtr; - int digit; HB_BOOL used_d, used_m, used_y; format_count = 0; @@ -89,7 +77,7 @@ char * hb_dateFormat( const char * szDate, char * szFormattedDate, const char * while( format_count < size ) { - digit = HB_TOUPPER( ( HB_UCHAR ) *szPtr ); + int digit = HB_TOUPPER( ( HB_UCHAR ) *szPtr ); szPtr++; digit_count = 1; while( HB_TOUPPER( ( HB_UCHAR ) *szPtr ) == digit && format_count < size ) @@ -249,7 +237,7 @@ static int hb_dateUnformatRaw( const char * szDate, const char * szDateFormat, l int d_value = 0, m_value = 0, y_value = 0; int iSize = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_dateUnformatRaw(%s, %s, %p)", szDate, szDateFormat, plDate ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dateUnformatRaw(%s, %s, %p)", szDate, szDateFormat, ( void * ) plDate ) ); if( szDate ) { @@ -376,9 +364,9 @@ char * hb_timeFormat( char * szBuffer, const char * szTimeFormat, long lMilliSec { char * szTimeBuffer; int iHour, iMinutes, iSeconds, iMSec, iPM, i12; - int size, i, ch, count, value, digits, skip; + int size, i, value, digits, skip; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeFormat(%p, %s, %ld)", szBuffer, szTimeFormat, lMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeFormat(%p, %s, %ld)", ( void * ) szBuffer, szTimeFormat, lMilliSec ) ); hb_timeDecode( lMilliSec, &iHour, &iMinutes, &iSeconds, &iMSec ); szTimeBuffer = szBuffer; @@ -405,8 +393,8 @@ char * hb_timeFormat( char * szBuffer, const char * szTimeFormat, long lMilliSec i = 0; while( i < size ) { - count = -i; - ch = HB_TOUPPER( szTimeFormat[ i ] ); + int count = -i; + int ch = HB_TOUPPER( szTimeFormat[ i ] ); ++i; while( ch == HB_TOUPPER( szTimeFormat[ i ] ) && i < size ) ++i; @@ -503,7 +491,7 @@ char * hb_timeStampFormat( char * szBuffer, { char szDate[ 9 ], * szTimeBuffer; - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampFormat(%p, %s, %s, %ld, %ld)", szBuffer, szDateFormat, szTimeFormat, lJulian, lMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampFormat(%p, %s, %s, %ld, %ld)", ( void * ) szBuffer, szDateFormat, szTimeFormat, lJulian, lMilliSec ) ); hb_dateDecStr( szDate, lJulian ); hb_dateFormat( szDate, szBuffer, szDateFormat ); @@ -628,7 +616,7 @@ void hb_timeStampUnformat( const char * szDateTime, const char * szDateFormat, const char * szTimeFormat, long * plJulian, long * plMilliSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampUnformat(%s, %s, %s, %p, %p)", szDateTime, szDateFormat, szTimeFormat, plJulian, plMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampUnformat(%s, %s, %s, %p, %p)", szDateTime, szDateFormat, szTimeFormat, ( void * ) plJulian, ( void * ) plMilliSec ) ); if( szDateTime ) { diff --git a/src/rtl/dateshb.c b/src/rtl/dateshb.c index 06d3357038..77a38dcd2f 100644 --- a/src/rtl/dateshb.c +++ b/src/rtl/dateshb.c @@ -2,6 +2,9 @@ * The Date API (Harbour level) * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999 Jose Lalin <dezac@corevia.com> (Day(), Month(), Year(), DoW()) + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> (CToD(), Date()) + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (hb_SToD()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,26 +47,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Jose Lalin <dezac@corevia.com> - * Day() - * Month() - * Year() - * DoW() - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * CToD() - * Date() - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_SToD() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapierr.h" #include "hbapiitm.h" @@ -585,7 +568,7 @@ HB_FUNC( HB_STRTOTS ) } /* get week number and other parts ISO 8601 week date: - hb_Week( <dDate>, [@<nYear>], [@<nDayOfWeek>] ) -> <nWeek> */ + hb_Week( <dDate>, [@<nYear>], [@<nDayOfWeek>] ) --> <nWeek> */ HB_FUNC( HB_WEEK ) { PHB_ITEM pDate = hb_param( 1, HB_IT_DATETIME ); diff --git a/src/rtl/dbedit.prg b/src/rtl/dbedit.prg index 41cd7eb687..74440f5163 100644 --- a/src/rtl/dbedit.prg +++ b/src/rtl/dbedit.prg @@ -142,25 +142,28 @@ FUNCTION dbEdit( nTop, nLeft, nBottom, nRight, ; bBlock := iif( Type( cBlock ) == "M", {|| " <Memo> " }, hb_macroBlock( cBlock ) ) - IF HB_ISARRAY( xColumnHeaders ) .AND. Len( xColumnHeaders ) >= nPos .AND. HB_ISSTRING( xColumnHeaders[ nPos ] ) + DO CASE + CASE HB_ISARRAY( xColumnHeaders ) .AND. Len( xColumnHeaders ) >= nPos .AND. HB_ISSTRING( xColumnHeaders[ nPos ] ) cHeading := xColumnHeaders[ nPos ] - ELSEIF HB_ISSTRING( xColumnHeaders ) + CASE HB_ISSTRING( xColumnHeaders ) cHeading := xColumnHeaders - ENDIF + ENDCASE oColumn := TBColumnNew( cHeading, bBlock ) - IF HB_ISARRAY( xColumnSayPictures ) .AND. nPos <= Len( xColumnSayPictures ) .AND. HB_ISSTRING( xColumnSayPictures[ nPos ] ) .AND. ! Empty( xColumnSayPictures[ nPos ] ) + DO CASE + CASE HB_ISARRAY( xColumnSayPictures ) .AND. nPos <= Len( xColumnSayPictures ) .AND. HB_ISSTRING( xColumnSayPictures[ nPos ] ) .AND. ! Empty( xColumnSayPictures[ nPos ] ) oColumn:picture := xColumnSayPictures[ nPos ] - ELSEIF HB_ISSTRING( xColumnSayPictures ) .AND. ! Empty( xColumnSayPictures ) + CASE HB_ISSTRING( xColumnSayPictures ) .AND. ! Empty( xColumnSayPictures ) oColumn:picture := xColumnSayPictures - ENDIF + ENDCASE - IF HB_ISARRAY( xColumnFootings ) .AND. nPos <= Len( xColumnFootings ) .AND. HB_ISSTRING( xColumnFootings[ nPos ] ) + DO CASE + CASE HB_ISARRAY( xColumnFootings ) .AND. nPos <= Len( xColumnFootings ) .AND. HB_ISSTRING( xColumnFootings[ nPos ] ) oColumn:footing := xColumnFootings[ nPos ] - ELSEIF HB_ISSTRING( xColumnFootings ) + CASE HB_ISSTRING( xColumnFootings ) oColumn:footing := xColumnFootings - ENDIF + ENDCASE IF HB_ISARRAY( xHeadingSeparators ) .AND. nPos <= Len( xHeadingSeparators ) .AND. HB_ISSTRING( xHeadingSeparators[ nPos ] ) oColumn:headSep := xHeadingSeparators[ nPos ] @@ -179,9 +182,7 @@ FUNCTION dbEdit( nTop, nLeft, nBottom, nRight, ; nOldCUrsor := SetCursor( SC_NONE ) - /* --------------------------- */ /* Go into the processing loop */ - /* --------------------------- */ lAppend := .F. lFlag := .T. @@ -281,10 +282,9 @@ FUNCTION dbEdit( nTop, nLeft, nBottom, nRight, ; RETURN .T. -/* NOTE: CA-Cl*pper uses intermediate function CALLUSER() - * to execute user function. We're replicating this behavior - * for code which may check ProcName() results in user function - */ +/* NOTE: CA-Cl*pper uses intermediate function CallUser() + to execute user function. We're replicating this behavior + for code which may check ProcName() results in user function */ STATIC FUNCTION CallUser( oBrowse, xUserFunc, nKey, lAppend, lFlag ) LOCAL nPrevRecNo @@ -358,10 +358,8 @@ STATIC FUNCTION CallUser( oBrowse, xUserFunc, nKey, lAppend, lFlag ) /* helper function to detect empty tables. It's not perfect but - * it functionally uses the same conditions as CA-Cl*pper - */ + it functionally uses the same conditions as CA-Cl*pper */ STATIC FUNCTION IsDbEmpty() - RETURN LastRec() == 0 .OR. ; ( Bof() .AND. ( Eof() .OR. RecNo() == LastRec() + 1 ) ) @@ -371,14 +369,15 @@ STATIC FUNCTION Skipped( nRecs, lAppend ) LOCAL nSkipped := 0 IF LastRec() != 0 - IF nRecs == 0 + DO CASE + CASE nRecs == 0 IF Eof() .AND. ! lAppend dbSkip( -1 ) nSkipped := -1 ELSE dbSkip( 0 ) ENDIF - ELSEIF nRecs > 0 .AND. RecNo() != LastRec() + 1 + CASE nRecs > 0 .AND. RecNo() != LastRec() + 1 DO WHILE nSkipped < nRecs dbSkip() IF Eof() @@ -391,7 +390,7 @@ STATIC FUNCTION Skipped( nRecs, lAppend ) ENDIF nSkipped++ ENDDO - ELSEIF nRecs < 0 + CASE nRecs < 0 DO WHILE nSkipped > nRecs dbSkip( -1 ) IF Bof() @@ -399,7 +398,7 @@ STATIC FUNCTION Skipped( nRecs, lAppend ) ENDIF nSkipped-- ENDDO - ENDIF + ENDCASE ENDIF RETURN nSkipped diff --git a/src/rtl/defpath.c b/src/rtl/defpath.c index 72e5671e0d..2c7d7fabc4 100644 --- a/src/rtl/defpath.c +++ b/src/rtl/defpath.c @@ -50,10 +50,9 @@ HB_FUNC( __DEFPATH ) { char buffer[ HB_PATH_MAX - 1 + 2 ]; - const char * szDefault; + const char * szDefault = hb_setGetDefault(); int size = 0; - szDefault = hb_setGetDefault(); if( szDefault ) { /* Leave enough space to append a path delimiter */ diff --git a/src/rtl/defpathu.c b/src/rtl/defpathu.c index 1bbbfc201d..540de2bde4 100644 --- a/src/rtl/defpathu.c +++ b/src/rtl/defpathu.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #ifdef HB_CLP_UNDOC diff --git a/src/rtl/descend.c b/src/rtl/descend.c index ed8ec9b462..dbc7d7e903 100644 --- a/src/rtl/descend.c +++ b/src/rtl/descend.c @@ -49,7 +49,7 @@ void hb_strDescend( char * szStringTo, const char * szStringFrom, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_strDescend(%p, %s, %" HB_PFS "u)", szStringTo, szStringFrom, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strDescend(%p, %s, %" HB_PFS "u)", ( void * ) szStringTo, szStringFrom, nLen ) ); if( nLen == 1 && szStringFrom[ 0 ] == '\0' ) szStringTo[ 0 ] = '\0'; diff --git a/src/rtl/direct.c b/src/rtl/direct.c index f46ab70e6e..849639481f 100644 --- a/src/rtl/direct.c +++ b/src/rtl/direct.c @@ -50,7 +50,7 @@ * Clipper is a bit schizoid with the treatment of file attributes, but we've * emulated that weirdness here for your viewing amusement. * - * In Clippers' homeworld of DOS, there are 5 basic attributes: 'A'rchive, + * In Clippers' home world of MS-DOS, there are 5 basic attributes: 'A'rchive, * 'H'idden, 'S'ystem, 'R'eadonly and 'D'irectory. In addition, a file can * have no attributes, and only 1 file per physical partition can have the * 'V'olume label. @@ -61,7 +61,7 @@ * unless they also happen to be 'H'idden and that attribute was not requested. * * "V" is a special case - you will get back the entry that describes the - * volume label for the drive implied by the filemask. + * volume label for the drive implied by the file mask. * * Differences from the 'standard' (where supported): * - Filenames will be returned in the same case as they are stored in the diff --git a/src/rtl/diskspac.c b/src/rtl/diskspac.c index 3e3ecff98a..36df993228 100644 --- a/src/rtl/diskspac.c +++ b/src/rtl/diskspac.c @@ -44,7 +44,7 @@ * */ -/* NOTE: DiskSpace() supports larger disks than 2GB. CA-Cl*pper will always +/* NOTE: DiskSpace() supports larger disks than 2 GiB. CA-Cl*pper will always return a (long) value, Harbour may return a (double) for large values, the decimal places are always set to zero, though. */ @@ -116,9 +116,8 @@ HB_FUNC( DISKSPACE ) ( ( ( double ) 0xFFFFFFFF ) + 1 ) ) #else - /* NOTE: Borland doesn't seem to deal with the un-named - struct that is part of ULARGE_INTEGER - [pt] */ + /* NOTE: For compilers that don't seem to deal with the + unnamed struct that is part of ULARGE_INTEGER [pt] */ # define HB_GET_LARGE_UINT( v ) ( ( double ) (v).u.LowPart + \ ( double ) (v).u.HighPart * \ ( ( ( double ) 0xFFFFFFFF ) + 1 ) ) diff --git a/src/rtl/einstv52.prg b/src/rtl/einstv52.prg index 839b9762b5..cc8db372fd 100644 --- a/src/rtl/einstv52.prg +++ b/src/rtl/einstv52.prg @@ -1,6 +1,6 @@ /* * Undocumented CA-Cl*pper function used to validate - * instance variable type in assign messages. + * instance variable type in assign messages. * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -57,12 +57,12 @@ FUNCTION __eInstVar52( oVar, cMethod, xValue, cType, nSubCode, xMin, xMax ) IF ValType( xValue ) == cType lError := .F. IF xMin != NIL - lError := !( xValue >= xMin ) + lError := ! xValue >= xMin ENDIF /* NOTE: In CA-Cl*pper 5.2, xMin validation result is ignored when xMax != NIL. Harbour is doing the same. */ IF xMax != NIL - lError := !( xValue <= xMax ) + lError := ! xValue <= xMax ENDIF ELSE lError := .T. @@ -83,7 +83,7 @@ FUNCTION __eInstVar52( oVar, cMethod, xValue, cType, nSubCode, xMin, xMax ) oError:subcode := nSubCode oError:args := { xValue } xValue := Eval( ErrorBlock(), oError ) - IF !( ValType( xValue ) == cType ) + IF ! ValType( xValue ) == cType __errInHandler() ENDIF ENDIF diff --git a/src/rtl/einstvar.prg b/src/rtl/einstvar.prg index dc87bb697d..ffdf606df0 100644 --- a/src/rtl/einstvar.prg +++ b/src/rtl/einstvar.prg @@ -1,6 +1,6 @@ /* * Undocumented CA-Cl*pper function used to validate - * instance variable type in assign messages. + * instance variable type in assign messages. * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -53,7 +53,7 @@ FUNCTION __eInstVar53( oVar, cMethod, xValue, cType, nSubCode, bValid ) LOCAL oError - IF !( ValType( xValue ) == cType ) .OR. ; + IF ! ValType( xValue ) == cType .OR. ; ( bValid != NIL .AND. ! Eval( bValid, oVar, xValue ) ) oError := ErrorNew() oError:description := hb_langErrMsg( EG_ARG ) @@ -69,7 +69,7 @@ FUNCTION __eInstVar53( oVar, cMethod, xValue, cType, nSubCode, bValid ) oError:subcode := nSubCode oError:args := { xValue } xValue := Eval( ErrorBlock(), oError ) - IF !( ValType( xValue ) == cType ) + IF ! ValType( xValue ) == cType __errInHandler() ENDIF ENDIF diff --git a/src/rtl/einstvau.prg b/src/rtl/einstvau.prg index 1377d0f48d..3291861233 100644 --- a/src/rtl/einstvau.prg +++ b/src/rtl/einstvau.prg @@ -1,6 +1,6 @@ /* * Undocumented CA-Cl*pper function used to validate - * instance variable type in assign messages. + * instance variable type in assign messages. * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rtl/errapi.c b/src/rtl/errapi.c index 21a48eddd5..8da99f95be 100644 --- a/src/rtl/errapi.c +++ b/src/rtl/errapi.c @@ -2,6 +2,8 @@ * The Error API * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2016 Viktor Szakats (vszakats.net/harbour) (DosError(), __errInHandler(), __errRT*(), hb_errLaunch*(), hb_err*Flags(), hb_errRT*()) + * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> (rewritten in C ERROR class and all hb_errGet*() and hb_errPut*() functions) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,32 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * DosError() - * __errInHandler() - * __errRT_BASE() - * __errRT_SBASE() - * hb_errLaunch() - * hb_errLaunchSubst() - * hb_errGetFlags() - * hb_errPutFlags() - * hb_errRT_New() - * hb_errRT_New_Subst() - * hb_errRT_BASE() - * hb_errRT_BASE_Ext1() - * hb_errRT_BASE_Subst() - * - * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> - * rewritten in C ERROR class and all hb_errGet*() and hb_errPut*() - * functions - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" @@ -560,7 +536,7 @@ HB_USHORT hb_errLaunch( PHB_ITEM pError ) if( pErrData->errorHandler ) { /* there is a low-level error handler defined - use it instead - * of normal Harbour-level one + * of normal Harbour level one */ pErrData->errorHandler->Error = pError; pErrData->errorHandler->ErrorBlock = pErrData->errorBlock; @@ -654,7 +630,7 @@ PHB_ITEM hb_errLaunchSubst( PHB_ITEM pError ) if( pErrData->errorHandler ) { /* there is a low-level error handler defined - use it instead - * of normal Harbour-level one + * of normal Harbour level one */ pErrData->errorHandler->Error = pError; pErrData->errorHandler->ErrorBlock = pErrData->errorBlock; @@ -1048,7 +1024,7 @@ HB_USHORT hb_errRT_BASE( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const cha HB_ULONG ulArgPos; /* I replaced EF_CANRETRY with EF_NONE for Clipper compatibility - * If it's wrong and I missed sth please fix me, Druzus. + * If it's wrong and I missed something please fix me, Druzus. */ pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, errGenCode, errSubCode, szDescription, szOperation, 0, EF_NONE /* EF_CANRETRY */ ); diff --git a/src/rtl/errapiu.c b/src/rtl/errapiu.c index 63234feec4..df246b267e 100644 --- a/src/rtl/errapiu.c +++ b/src/rtl/errapiu.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #ifdef HB_CLP_UNDOC diff --git a/src/rtl/errint.c b/src/rtl/errint.c index 0ccf80d975..0780b051a9 100644 --- a/src/rtl/errint.c +++ b/src/rtl/errint.c @@ -60,14 +60,14 @@ void hb_errInternal( HB_ERRCODE errCode, const char * szText, const char * szPar if( hb_cmdargCheck( "ERRGPF" ) ) { #if defined( _MSC_VER ) && _MSC_VER >= 1800 -#pragma warning(push) -#pragma warning(disable:6011) +# pragma warning(push) +# pragma warning(disable:6011) #endif int * pGPF = NULL; *pGPF = 0; *( --pGPF ) = 0; #if defined( _MSC_VER ) && _MSC_VER >= 1800 -#pragma warning(pop) +# pragma warning(pop) #endif } diff --git a/src/rtl/errintlo.c b/src/rtl/errintlo.c index c58f8372b7..e024c19a3b 100644 --- a/src/rtl/errintlo.c +++ b/src/rtl/errintlo.c @@ -58,10 +58,9 @@ void hb_errInternalRaw( HB_ERRCODE errCode, const char * szText, const char * sz { char buffer[ 8192 ]; char file[ HB_PATH_MAX ]; - const char * szFile, * szInfo; + const char * szFile; HB_BOOL fStack, fLang; HB_USHORT uiLine; - int iLevel; FILE * hLog; HB_TRACE( HB_TR_DEBUG, ( "hb_errInternal(%d, %s, %s, %s)", errCode, szText, szPar1, szPar2 ) ); @@ -82,6 +81,8 @@ void hb_errInternalRaw( HB_ERRCODE errCode, const char * szText, const char * sz hLog = hb_fopen( szFile, "a+" ); if( hLog ) { + const char * szInfo; + char szTime[ 9 ]; int iYear, iMonth, iDay; @@ -120,7 +121,7 @@ void hb_errInternalRaw( HB_ERRCODE errCode, const char * szText, const char * sz if( fStack && hb_stackTotalItems() ) { - iLevel = 0; + int iLevel = 0; while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) { char msg[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ]; diff --git a/src/rtl/errsys.prg b/src/rtl/errsys.prg index b6136b0aa7..e1e82eb06d 100644 --- a/src/rtl/errsys.prg +++ b/src/rtl/errsys.prg @@ -115,7 +115,7 @@ STATIC FUNCTION DefError( oError ) iif( cOSError == NIL, "", ";" + cOSError ), aOptions ) ) == 0 ENDDO - IF ! Empty( nChoice ) + IF ! Empty( nChoice ) /* Alert() may return NIL */ SWITCH aOptions[ nChoice ] CASE "Break" Break( oError ) @@ -137,12 +137,10 @@ STATIC FUNCTION DefError( oError ) n := 1 DO WHILE ! Empty( ProcName( ++n ) ) - OutErr( hb_eol() ) OutErr( hb_StrFormat( "Called from %1$s(%2$d) ", ; - ProcName( n ), ; - ProcLine( n ) ) ) - + ProcName( n ), ; + ProcLine( n ) ) ) ENDDO ErrorLevel( 1 ) diff --git a/src/rtl/file.c b/src/rtl/file.c index d76d0f6600..e5f7858d91 100644 --- a/src/rtl/file.c +++ b/src/rtl/file.c @@ -65,7 +65,6 @@ HB_BOOL hb_fsFile( const char * pszFileName ) HB_BOOL hb_fsIsDirectory( const char * pszFileName ) { HB_BOOL bResult = HB_FALSE; - PHB_FFIND ffind; char * pszFree = NULL; int iLen; @@ -80,6 +79,7 @@ HB_BOOL hb_fsIsDirectory( const char * pszFileName ) if( iLen && iLen <= ( HB_PATH_MAX - 1 ) ) { + PHB_FFIND ffind; if( ( ffind = hb_fsFindFirst( pszFileName, HB_FA_DIRECTORY ) ) != NULL ) { do diff --git a/src/rtl/filebuf.c b/src/rtl/filebuf.c index f037c87ea2..bd081a78b7 100644 --- a/src/rtl/filebuf.c +++ b/src/rtl/filebuf.c @@ -1,6 +1,6 @@ /* - * functions to access files with shared handles and locks - * (buffers in the future) + * Functions to access files with shared handles and locks + * (buffers in the future) * * Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -70,8 +70,8 @@ #if defined( __USE_LARGEFILE64 ) /* * The macro: __USE_LARGEFILE64 is set when _LARGEFILE64_SOURCE is - * defined and effectively enables lseek64/flock64/ftruncate64 functions - * on 32bit machines. + * defined and effectively enables lseek64()/flock64()/ftruncate64() + * functions on 32-bit machines. */ #define HB_USE_LARGEFILE64 #elif defined( HB_OS_UNIX ) && defined( O_LARGEFILE ) @@ -479,7 +479,6 @@ static PHB_FILE s_fileExtOpen( PHB_FILE_FUNCS pFuncs, const char * pszFileName, #endif HB_BOOL fResult, fShared; int iMode; - HB_FHANDLE hFile; char * pszFile; HB_SYMBOL_UNUSED( pFuncs ); @@ -497,8 +496,8 @@ static PHB_FILE s_fileExtOpen( PHB_FILE_FUNCS pFuncs, const char * pszFileName, { if( iMode == FO_WRITE && fShared ) { - if( access( ( char * ) pszFile, R_OK ) == 0 || - access( ( char * ) pszFile, F_OK ) != 0 ) + if( access( pszFile, R_OK ) == 0 || + access( pszFile, F_OK ) != 0 ) { nExFlags = ( nExFlags ^ FO_WRITE ) | FO_READWRITE; iMode = FO_READWRITE; @@ -517,9 +516,9 @@ static PHB_FILE s_fileExtOpen( PHB_FILE_FUNCS pFuncs, const char * pszFileName, hb_threadEnterCriticalSection( &s_fileMtx ); # if defined( HB_USE_LARGEFILE64 ) - fResult = stat64( ( char * ) pszFile, &statbuf ) == 0; + fResult = stat64( pszFile, &statbuf ) == 0; # else - fResult = stat( ( char * ) pszFile, &statbuf ) == 0; + fResult = stat( pszFile, &statbuf ) == 0; # endif hb_fsSetIOError( fResult, 0 ); @@ -559,7 +558,7 @@ static PHB_FILE s_fileExtOpen( PHB_FILE_FUNCS pFuncs, const char * pszFileName, if( fResult && pFile == NULL ) #endif /* HB_OS_UNIX */ { - hFile = hb_fsExtOpen( pszFile, NULL, + HB_FHANDLE hFile = hb_fsExtOpen( pszFile, NULL, nExFlags & ~ ( HB_FATTR ) ( FXO_DEFAULTS | FXO_COPYNAME ), NULL, NULL ); if( hFile != FS_ERROR ) @@ -623,7 +622,7 @@ static PHB_FILE s_fileExtOpen( PHB_FILE_FUNCS pFuncs, const char * pszFileName, hb_fsClose( hFile ); hFile = FS_ERROR; #if defined( HB_USE_SHARELOCKS ) && ! defined( HB_USE_BSDLOCKS ) - /* TOFIX: possible race condition */ + /* FIXME: possible race condition */ hb_fsLockLarge( pFile->hFile, HB_SHARELOCK_POS, HB_SHARELOCK_SIZE, FL_LOCK | FLX_SHARED ); #endif @@ -638,7 +637,7 @@ static PHB_FILE s_fileExtOpen( PHB_FILE_FUNCS pFuncs, const char * pszFileName, } if( hFile != FS_ERROR ) { - /* TOFIX: possible race condition in MT mode, + /* FIXME: possible race condition in MT mode, * close() is not safe due to existing locks * which are removed. */ @@ -1463,8 +1462,10 @@ HB_FHANDLE hb_fileHandle( PHB_FILE pFile ) /* internal FILE structures only */ -PHB_FILE hb_fileCreateTemp( const char * pszDir, const char * pszPrefix, - HB_FATTR ulAttr, char * pszName ) +PHB_FILE hb_fileCreateTemp( const char * pszDir, + const char * pszPrefix, + HB_FATTR ulAttr, + char * pszName ) { PHB_FILE pFile = NULL; HB_FHANDLE hFile; diff --git a/src/rtl/filebufd.c b/src/rtl/filebufd.c index a61f23f581..e83db9f1d1 100644 --- a/src/rtl/filebufd.c +++ b/src/rtl/filebufd.c @@ -1,5 +1,5 @@ /* - * dummy I/O driver initialization + * Dummy I/O driver initialization * * Copyright 2014 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rtl/filehb.c b/src/rtl/filehb.c index 98b3a0a9e5..9337728d7f 100644 --- a/src/rtl/filehb.c +++ b/src/rtl/filehb.c @@ -51,7 +51,7 @@ the required attribute. */ /* NOTE: CA-Cl*pper RTrim()s the filename before doing the existence check. - This is not multiplatform friendly, so Harbour doesn't do any + This is not multi-platform friendly, so Harbour doesn't do any modification on the filename. [vszakats] For easier portability in Harbour user can optionally enable leading and trailing spaces stripping by diff --git a/src/rtl/filesys.c b/src/rtl/filesys.c index e494acb5cd..74e1cc6de4 100644 --- a/src/rtl/filesys.c +++ b/src/rtl/filesys.c @@ -2,6 +2,18 @@ * The FileSys API (C level) * * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999-2010 Viktor Szakats (vszakats.net/harbour) + * hb_fsSetError(), hb_fsSetDevMode(), hb_fsReadLarge(), hb_fsWriteLarge() + * hb_fsCurDirBuff(), hb_fsBaseDirBuff() + * fs_win_get_drive(), fs_win_set_drive() + * Copyright 1999 Jose Lalin <dezac@corevia.com> + * hb_fsChDrv(), hb_fsCurDrv(), hb_fsIsDrv(), hb_fsIsDevice() + * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>, David G. Holm <dholm@jsd-llc.com> + * hb_fsEof() + * Copyright 2001 Jose Gimenez (JFG) <jfgimenez@wanadoo.es>, <tecnico.sireinsa@ctv.es> + * Added platform check for any compiler to use the Windows + * API calls to allow opening an unlimited number of files + * simultaneously. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,39 +56,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2010 Viktor Szakats (vszakats.net/harbour) - * hb_fsSetError() - * hb_fsSetDevMode() - * hb_fsReadLarge() - * hb_fsWriteLarge() - * hb_fsCurDirBuff() - * hb_fsBaseDirBuff() - * fs_win_get_drive() - * fs_win_set_drive() - * - * Copyright 1999 Jose Lalin <dezac@corevia.com> - * hb_fsChDrv() - * hb_fsCurDrv() - * hb_fsIsDrv() - * hb_fsIsDevice() - * - * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net> - * and David G. Holm <dholm@jsd-llc.com> - * hb_fsEof() - * - * Copyright 2001 Jose Gimenez (JFG) <jfgimenez@wanadoo.es> - * <tecnico.sireinsa@ctv.es> - * Added platform check for any compiler to use the Windows - * API calls to allow openning an unlimited number of files - * simultaneously. - * - * See COPYING.txt for licensing terms. - * - */ - /* NOTE: In DOS/DJGPP under WinNT4 hb_fsSeek( fhnd, offset < 0, FS_SET ) will set the file pointer to the passed negative value and the subsequent hb_fsWrite() call will fail. In CA-Cl*pper, _fsSeek() will fail, @@ -222,8 +201,8 @@ #if defined( __USE_LARGEFILE64 ) /* * The macro: __USE_LARGEFILE64 is set when _LARGEFILE64_SOURCE is - * defined and effectively enables lseek64/flock64/ftruncate64 functions - * on 32bit machines. + * defined and effectively enables lseek64()/flock64()/ftruncate64() + * functions on 32-bit machines. */ #define HB_USE_LARGEFILE64 #elif defined( HB_OS_UNIX ) && defined( O_LARGEFILE ) && ! defined( __WATCOMC__ ) @@ -411,20 +390,18 @@ static void fs_win_set_drive( int iDrive ) static HANDLE DosToWinHandle( HB_FHANDLE fHandle ) { - if( fHandle == ( HB_FHANDLE ) FS_ERROR ) - return NULL; - - else if( fHandle == ( HB_FHANDLE ) HB_STDIN_HANDLE ) - return GetStdHandle( STD_INPUT_HANDLE ); - - else if( fHandle == ( HB_FHANDLE ) HB_STDOUT_HANDLE ) - return GetStdHandle( STD_OUTPUT_HANDLE ); - - else if( fHandle == ( HB_FHANDLE ) HB_STDERR_HANDLE ) - return GetStdHandle( STD_ERROR_HANDLE ); - - else - return ( HANDLE ) fHandle; + switch( fHandle ) + { + case ( HB_FHANDLE ) FS_ERROR: + return NULL; + case ( HB_FHANDLE ) HB_STDIN_HANDLE: + return GetStdHandle( STD_INPUT_HANDLE ); + case ( HB_FHANDLE ) HB_STDOUT_HANDLE: + return GetStdHandle( STD_OUTPUT_HANDLE ); + case ( HB_FHANDLE ) HB_STDERR_HANDLE: + return GetStdHandle( STD_ERROR_HANDLE ); + } + return ( HANDLE ) fHandle; } static void convert_open_flags( HB_BOOL fCreate, HB_FATTR nAttr, HB_USHORT uiFlags, @@ -586,7 +563,7 @@ static void convert_open_flags( HB_BOOL fCreate, HB_FATTR nAttr, HB_USHORT uiFla int * flags, unsigned * mode, int * share, int * attr ) { - HB_TRACE( HB_TR_DEBUG, ( "convert_open_flags(%d, %u, %hu, %p, %p, %p, %p)", fCreate, nAttr, uiFlags, flags, mode, share, attr ) ); + HB_TRACE( HB_TR_DEBUG, ( "convert_open_flags(%d, %u, %hu, %p, %p, %p, %p)", fCreate, nAttr, uiFlags, ( void * ) flags, ( void * ) mode, ( void * ) share, ( void * ) attr ) ); /* file access mode */ #if defined( HB_OS_UNIX ) @@ -720,7 +697,7 @@ HB_FHANDLE hb_fsGetOsHandle( HB_FHANDLE hFileHandle ) } #if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) -/* for POSIX systems only, hides low level select()/poll() access, +/* for POSIX systems only, hides low-level select()/poll() access, intentionally covered by HB_OS_UNIX macro to generate compile time error in code which tries to use it on other platforms */ @@ -855,7 +832,7 @@ int hb_fsPoll( PHB_POLLFD pPollSet, int iCount, HB_MAXINT nTimeOut ) { int iResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsPoll(%p, %d, %" PFHL "d)", pPollSet, iCount, nTimeOut ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsPoll(%p, %d, %" PFHL "d)", ( void * ) pPollSet, iCount, nTimeOut ) ); hb_vmUnlock(); @@ -1048,7 +1025,7 @@ HB_FHANDLE hb_fsPOpen( const char * pszFileName, const char * pszMode ) { HB_FHANDLE hFileHandle = FS_ERROR; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsPOpen(%p, %s)", pszFileName, pszMode ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsPOpen(%p, %s)", ( const void * ) pszFileName, pszMode ) ); #if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS ) && ! defined( HB_OS_SYMBIAN ) { @@ -1192,16 +1169,16 @@ HB_FHANDLE hb_fsPOpen( const char * pszFileName, const char * pszMode ) #if defined( HB_OS_OS2 ) # if ! defined( HB_OS2_NONAMEDPIPES ) && ! defined( HB_OS2_USENAMEDPIPES ) -/* In OS2 anonymous pipes are not simulated by named pipes and +/* In OS/2 anonymous pipes are not simulated by named pipes and unlike in MS-Windows functions for named pipes cannot be used with anonymous ones. Read/Write operations from/to anonymous - pipes are always blocking on OS2. For unblocking access we + pipes are always blocking on OS/2. For unblocking access we have to emulate anonymous pipe using named one [druzus] */ # define HB_OS2_USENAMEDPIPES # endif -/* the size of sustem IO buffers in OS2 pipes */ +/* the size of system IO buffers in OS/2 pipes */ # define HB_OS2_PIPEBUFSIZE 4096 #endif @@ -1210,7 +1187,7 @@ HB_BOOL hb_fsPipeCreate( HB_FHANDLE hPipe[ 2 ] ) { HB_BOOL fResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsPipeCreate(%p)", hPipe ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsPipeCreate(%p)", ( void * ) hPipe ) ); #if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE ) { @@ -1910,7 +1887,7 @@ HB_BOOL hb_fsGetFileTime( const char * pszFileName, long * plJulian, long * plMi { HB_BOOL fResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsGetFileTime(%s, %p, %p)", pszFileName, plJulian, plMillisec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsGetFileTime(%s, %p, %p)", pszFileName, ( void * ) plJulian, ( void * ) plMillisec ) ); fResult = HB_FALSE; *plJulian = *plMillisec = 0; @@ -2066,7 +2043,7 @@ HB_BOOL hb_fsGetAttr( const char * pszFileName, HB_FATTR * pnAttr ) { HB_BOOL fResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsGetAttr(%s, %p)", pszFileName, pnAttr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsGetAttr(%s, %p)", pszFileName, ( void * ) pnAttr ) ); hb_vmUnlock(); @@ -2875,7 +2852,7 @@ HB_SIZE hb_fsReadAt( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount, HB_FO } # endif /* HB_WIN_IOREAD_LIMIT */ -/* TOFIX: below are not atom operations. It has to be fixed for RDD +/* FIXME: below are not atom operations. It has to be fixed for RDD * file access with shared file handles in aliased work areas */ #elif defined( HB_OS_OS2 ) @@ -3014,7 +2991,7 @@ HB_SIZE hb_fsWriteAt( HB_FHANDLE hFileHandle, const void * pBuff, HB_SIZE nCount } # endif /* HB_WIN_IOWRITE_LIMIT */ -/* TOFIX: below are not atom operations. It has to be fixed for RDD +/* FIXME: below are not atom operations. It has to be fixed for RDD * file access with shared file handles in aliased work areas */ #elif defined( HB_OS_OS2 ) @@ -3152,7 +3129,7 @@ void hb_fsCommit( HB_FHANDLE hFileHandle ) #else - /* NOTE: close() functions releases all locks regardles if it is an + /* NOTE: close() functions releases all locks regardless if it is an * original or duplicated file handle */ /* This hack is very dangerous. POSIX standard define that if _ANY_ @@ -3160,7 +3137,7 @@ void hb_fsCommit( HB_FHANDLE hFileHandle ) * pointed by this descriptor are removed. It doesn't matter they * were done using different descriptor. It means that we now clean * all locks on hFileHandle with the code below if the OS is POSIX - * compilant. I vote to disable it. [druzus] + * compliant. I vote to disable it. [druzus] */ { int dup_handle; @@ -3582,7 +3559,7 @@ HB_ULONG hb_fsSeek( HB_FHANDLE hFileHandle, HB_LONG lOffset, HB_USHORT uiFlags ) hb_vmUnlock(); #if defined( HB_OS_WIN ) - /* This DOS hack creates 2GB file size limit, Druzus */ + /* This DOS hack creates 2 GiB file size limit, Druzus */ if( lOffset < 0 && nFlags == SEEK_SET ) { ulPos = ( ULONG ) INVALID_SET_FILE_POINTER; @@ -3604,7 +3581,7 @@ HB_ULONG hb_fsSeek( HB_FHANDLE hFileHandle, HB_LONG lOffset, HB_USHORT uiFlags ) { APIRET ret; - /* This DOS hack creates 2GB file size limit, Druzus */ + /* This DOS hack creates 2 GiB file size limit, Druzus */ if( lOffset < 0 && nFlags == SEEK_SET ) ret = 25; /* 'Seek Error' */ else @@ -3618,7 +3595,7 @@ HB_ULONG hb_fsSeek( HB_FHANDLE hFileHandle, HB_LONG lOffset, HB_USHORT uiFlags ) } } #else - /* This DOS hack creates 2GB file size limit, Druzus */ + /* This DOS hack creates 2 GiB file size limit, Druzus */ if( lOffset < 0 && nFlags == SEEK_SET ) { ulPos = ( HB_ULONG ) -1; @@ -3632,7 +3609,7 @@ HB_ULONG hb_fsSeek( HB_FHANDLE hFileHandle, HB_LONG lOffset, HB_USHORT uiFlags ) /* small trick to resolve problem with position reported for directories */ if( ulPos == LONG_MAX && lOffset == 0 && nFlags == SEEK_END ) { - /* we do not need to use fstat64() here on 32 bit platforms, [druzus] */ + /* we do not need to use fstat64() here on 32-bit platforms, [druzus] */ struct stat st; if( fstat( hFileHandle, &st ) == 0 ) @@ -4270,7 +4247,7 @@ HB_BOOL hb_fsGetCWD( char * pszBuffer, HB_SIZE nSize ) { HB_BOOL fResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsGetCWD(%p,%" HB_PFS "u)", pszBuffer, nSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsGetCWD(%p,%" HB_PFS "u)", ( void * ) pszBuffer, nSize ) ); pszBuffer[ 0 ] = '\0'; @@ -4621,7 +4598,7 @@ HB_BOOL hb_fsIsDevice( HB_FHANDLE hFileHandle ) return fResult; } -/* convert file name for hb_fsExtOpen +/* convert file name for hb_fsExtOpen() * caller must free the returned buffer */ char * hb_fsExtName( const char * pszFileName, const char * pDefExt, @@ -4707,7 +4684,7 @@ HB_FHANDLE hb_fsExtOpen( const char * pszFileName, const char * pDefExt, const char * szPath; char * szFree = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsExtOpen(%s, %s, %u, %p, %p)", pszFileName, pDefExt, nExFlags, pPaths, pError ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsExtOpen(%s, %s, %u, %p, %p)", pszFileName, pDefExt, nExFlags, ( const void * ) pPaths, ( void * ) pError ) ); #if 0 #define FXO_TRUNCATE 0x0100 /* Create (truncate if exists) */ @@ -4868,8 +4845,8 @@ const char * hb_fsNameConv( const char * pszFileName, char ** pszFree ) /* Convert file and dir case. The allowed SET options are: - LOWER - Convert all caracters of file to lower - UPPER - Convert all caracters of file to upper + LOWER - Convert all characters of file to lower + UPPER - Convert all characters of file to upper MIXED - Leave as is The allowed environment options are: @@ -5012,8 +4989,8 @@ HB_WCHAR * hb_fsNameConvU16( const char * pszFileName ) /* Convert file and dir case. The allowed SET options are: - LOWER - Convert all caracters of file to lower - UPPER - Convert all caracters of file to upper + LOWER - Convert all characters of file to lower + UPPER - Convert all characters of file to upper MIXED - Leave as is The allowed environment options are: diff --git a/src/rtl/fmhb.c b/src/rtl/fmhb.c index 6f2ac403eb..9a82cd137c 100644 --- a/src/rtl/fmhb.c +++ b/src/rtl/fmhb.c @@ -1,5 +1,5 @@ /* - * Memory() function. + * Memory() function * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) * diff --git a/src/rtl/fscopy.c b/src/rtl/fscopy.c index c3d54b4407..fb530e62a8 100644 --- a/src/rtl/fscopy.c +++ b/src/rtl/fscopy.c @@ -53,19 +53,19 @@ HB_BOOL hb_fsCopy( const char * pszSource, const char * pszDest ) { HB_BOOL fResult = HB_FALSE; PHB_FILE pSrcFile; - PHB_FILE pDstFile; if( ( pSrcFile = hb_fileExtOpen( pszSource, NULL, FO_READ | FO_SHARED | FXO_SHARELOCK, NULL, NULL ) ) != NULL ) { + PHB_FILE pDstFile; HB_ERRCODE errCode; if( ( pDstFile = hb_fileExtOpen( pszDest, NULL, FXO_TRUNCATE | FO_READWRITE | FO_EXCLUSIVE | FXO_SHARELOCK, NULL, NULL ) ) != NULL ) { - HB_SIZE nBytesRead; void * pbyBuffer = hb_xgrab( HB_FSCOPY_BUFFERSIZE ); for( ;; ) { + HB_SIZE nBytesRead; if( ( nBytesRead = hb_fileRead( pSrcFile, pbyBuffer, HB_FSCOPY_BUFFERSIZE, -1 ) ) > 0 && nBytesRead != ( HB_SIZE ) FS_ERROR ) { diff --git a/src/rtl/fserr.c b/src/rtl/fserr.c index bcbedef9ce..222ccb8264 100644 --- a/src/rtl/fserr.c +++ b/src/rtl/fserr.c @@ -1,5 +1,5 @@ /* - * + * Error code translations * * Copyright 2003 Przemyslaw Czerpak <druzus@acn.waw.pl> * diff --git a/src/rtl/fssize.c b/src/rtl/fssize.c index cd47474d72..7a234b413e 100644 --- a/src/rtl/fssize.c +++ b/src/rtl/fssize.c @@ -1,5 +1,5 @@ /* - * hb_FSize() function + * hb_fsFSize() function * * Copyright 2000-2001 Jose Lalin <dezac@corevia.com> * Copyright 2000-2001 Viktor Szakats (vszakats.net/harbour) @@ -68,8 +68,8 @@ #if defined( __USE_LARGEFILE64 ) /* * The macro: __USE_LARGEFILE64 is set when _LARGEFILE64_SOURCE is - * defined and effectively enables lseek64/flock64/ftruncate64 functions - * on 32bit machines. + * defined and effectively enables lseek64()/flock64()/ftruncate64() + * functions on 32-bit machines. */ #define HB_USE_LARGEFILE64 #elif defined( HB_OS_UNIX ) && defined( O_LARGEFILE ) @@ -170,6 +170,7 @@ HB_FOFFSET hb_fsFSize( const char * pszFileName, HB_BOOL bUseDirEntry ) return nPos; } } + return 0; } @@ -177,5 +178,5 @@ HB_FUNC( HB_FSIZE ) { const char * pszFile = hb_parc( 1 ); - hb_retnint( pszFile ? hb_fsFSize( pszFile, hb_parldef( 2, 1 ) ) : 0 ); + hb_retnint( pszFile ? hb_fsFSize( pszFile, hb_parldef( 2, HB_TRUE ) ) : 0 ); } diff --git a/src/rtl/fstemp.c b/src/rtl/fstemp.c index 1148e79ff2..27b7b75d1c 100644 --- a/src/rtl/fstemp.c +++ b/src/rtl/fstemp.c @@ -88,8 +88,8 @@ #if defined( __USE_LARGEFILE64 ) /* * The macro: __USE_LARGEFILE64 is set when _LARGEFILE64_SOURCE is - * defined and effectively enables lseek64/flock64/ftruncate64 functions - * on 32bit machines. + * defined and effectively enables lseek64()/flock64()/ftruncate64() + * functions on 32-bit machines. */ #define HB_USE_LARGEFILE64 #elif defined( HB_OS_UNIX ) && defined( O_LARGEFILE ) && ! defined( __WATCOMC__ ) @@ -101,10 +101,11 @@ static HB_BOOL fsGetTempDirByCase( char * pszName, const char * pszTempDir, HB_BOOL fTrans ) { HB_BOOL fOK = HB_FALSE; - char * pTmp; if( pszTempDir && *pszTempDir != '\0' ) { + char * pTmp; + if( fTrans ) hb_osStrDecode2( pszTempDir, pszName, HB_PATH_MAX - 1 ); else @@ -214,11 +215,12 @@ HB_FHANDLE hb_fsCreateTempEx( char * pszName, const char * pszDir, const char * else #endif /* HB_HAS_MKSTEMP */ { - int i, n; + int i; double d = hb_random_num(), x; for( i = 0; i < 6; i++ ) { + int n; d = d * 36; n = ( int ) d; d = modf( d, &x ); diff --git a/src/rtl/gete.c b/src/rtl/gete.c index b87d9f7bf6..34b3b8c14e 100644 --- a/src/rtl/gete.c +++ b/src/rtl/gete.c @@ -2,6 +2,7 @@ * GetEnv(), GetE() functions * * Copyright 1999 Matthew Hamilton <mhamilton@bunge.com.au> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (GetE()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * GetE() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapiitm.h" diff --git a/src/rtl/getlist.prg b/src/rtl/getlist.prg index fcf38281b4..d49a1d6422 100644 --- a/src/rtl/getlist.prg +++ b/src/rtl/getlist.prg @@ -1,5 +1,5 @@ /* - * GET system active getlist handler for default HBGETLIST/GETSYS/READVAR + * GET system active GetList handler for default HBGetList()/GetSys/ReadVar() * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) * diff --git a/src/rtl/getsys.prg b/src/rtl/getsys.prg index 3b3df9ddcf..525f161c11 100644 --- a/src/rtl/getsys.prg +++ b/src/rtl/getsys.prg @@ -2,6 +2,7 @@ * GET system module (default) * * Copyright 1999-2001 Antonio Linares <alinares@fivetech.com> + * Copyright 2001 Luiz Rafael Culik (Support for CA-Cl*pper 5.3 GET-system) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,18 +45,10 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2001 Luiz Rafael Culik - * Support for CA-Cl*pper 5.3 Getsystem - * - * See COPYING.txt for licensing terms. - * - */ - #ifdef HB_COMPAT_C53 +#include "inkey.ch" + #define SLUPDATED 1 #define SOACTIVEGET 8 #define SXREADVAR 9 @@ -128,8 +121,8 @@ FUNCTION GetActive( oGet ) IF oGetList == NIL /* NOTE: For complete compatibility we need to make sure this - function works even if there is no active getlist. - F.e. when 3rd party software manages getlists on its + function works even if there is no active GetList. + F.e. when 3rd party software manages GetLists on its own and still uses this function. [vszakats] */ IF PCount() > 0 oGetActiveOld := t_oGetActive diff --git a/src/rtl/gt_tpl/gt_tpl.c b/src/rtl/gt_tpl/gt_tpl.c index 7065a1e9ec..120846126d 100644 --- a/src/rtl/gt_tpl/gt_tpl.c +++ b/src/rtl/gt_tpl/gt_tpl.c @@ -57,7 +57,7 @@ static HB_GT_FUNCS SuperTable; static void hb_gt_tpl_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Init(%p,%p,%p,%p)", pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); /* TODO: */ @@ -66,7 +66,7 @@ static void hb_gt_tpl_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil static void hb_gt_tpl_Exit( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Exit(%p)", ( void * ) pGT ) ); HB_GTSUPER_EXIT( pGT ); @@ -76,7 +76,7 @@ static void hb_gt_tpl_Exit( PHB_GT pGT ) static int hb_gt_tpl_ReadKey( PHB_GT pGT, int iEventMask ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( pGT ); HB_SYMBOL_UNUSED( iEventMask ); @@ -89,19 +89,19 @@ static int hb_gt_tpl_ReadKey( PHB_GT pGT, int iEventMask ) static const char * hb_gt_tpl_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); if( iType == 0 ) return HB_GT_DRVNAME( HB_GT_NAME ); - return "Harbour Terminal: (template)"; + return "Terminal: (template)"; } static HB_BOOL hb_gt_tpl_SetMode( PHB_GT pGT, int iRows, int iCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_SetMode(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_SetMode(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); HB_SYMBOL_UNUSED( pGT ); HB_SYMBOL_UNUSED( iRows ); @@ -118,7 +118,7 @@ static void hb_gt_tpl_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) HB_BYTE bAttr; HB_USHORT usChar; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); while( iSize-- ) { @@ -133,7 +133,7 @@ static void hb_gt_tpl_Refresh( PHB_GT pGT ) { int iRow, iCol, iStyle; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_tpl_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); HB_GTSELF_GETSCRCURSOR( pGT, &iRow, &iCol, &iStyle ); @@ -146,7 +146,7 @@ static void hb_gt_tpl_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_tpl_Init; pFuncTable->Exit = hb_gt_tpl_Exit; diff --git a/src/rtl/gtapi.c b/src/rtl/gtapi.c index f1113985ae..630304ecc2 100644 --- a/src/rtl/gtapi.c +++ b/src/rtl/gtapi.c @@ -2,6 +2,17 @@ * The Terminal API * * Copyright 1999 Bil Simser <bsimser@home.com> + * Copyright 1999 Paul Tucker <ptucker@sympatico.ca> + * hb_gtInit(), hb_gtExit() + * hb_gtDispBegin(), hb_gtDispEnd() + * hb_gtPreExt(), hb_gtPostExt() + * hb_gtGetColorStr(), hb_gtSetColorStr(), hb_gtSetMode() + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * hb_gtDrawShadow() + * Copyright 2006 Przemyslaw Czerpak < druzus /at/ priv.onet.pl > + * The body of these functions which were usable in new GT API + * have been moved to hbgtcore.c to hb_gt_def_*() functions + * some of my modifications. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,32 +55,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Paul Tucker <ptucker@sympatico.ca> - * hb_gtInit() - * hb_gtExit() - * hb_gtDispBegin() - * hb_gtDispEnd() - * hb_gtPreExt() - * hb_gtPostExt() - * hb_gtGetColorStr() - * hb_gtSetColorStr() - * hb_gtSetMode() - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_gtDrawShadow() - * - * Copyright 2006 Przemyslaw Czerpak < druzus /at/ priv.onet.pl > - * The body of these functions which were usable in new GT API - * have been moved to hbgtcore.c to hb_gt_def_*() functions - * some of my modificaations. - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbgtcore.h" #include "hbset.h" @@ -162,7 +147,7 @@ HB_ERRCODE hb_gtBox( int iTop, int iLeft, int iBottom, int iRight, const char * { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtBox(%d, %d, %d, %d, %p)", iTop, iLeft, iBottom, iRight, szFrame ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtBox(%d, %d, %d, %d, %p)", iTop, iLeft, iBottom, iRight, ( const void * ) szFrame ) ); pGT = hb_gt_Base(); if( pGT ) @@ -176,6 +161,26 @@ HB_ERRCODE hb_gtBox( int iTop, int iLeft, int iBottom, int iRight, const char * return HB_FAILURE; } +HB_ERRCODE hb_gtBoxEx( int iTop, int iLeft, int iBottom, int iRight, const char * szFrame, int iColor ) +{ + PHB_GT pGT; + + HB_TRACE( HB_TR_DEBUG, ( "hb_gtBoxEx(%d, %d, %d, %d, %p, %d)", iTop, iLeft, iBottom, iRight, ( const void * ) szFrame, iColor ) ); + + pGT = hb_gt_Base(); + if( pGT ) + { + if( iColor == -1 ) + iColor = HB_GTSELF_GETCOLOR( pGT ); + HB_GTSELF_BOX( pGT, iTop, iLeft, iBottom, iRight, szFrame, iColor ); + HB_GTSELF_SETPOS( pGT, iTop + 1, iLeft + 1 ); + HB_GTSELF_FLUSH( pGT ); + hb_gt_BaseFree( pGT ); + return HB_SUCCESS; + } + return HB_FAILURE; +} + HB_ERRCODE hb_gtBoxD( int iTop, int iLeft, int iBottom, int iRight ) { PHB_GT pGT; @@ -216,7 +221,7 @@ HB_ERRCODE hb_gtDrawBox( int iTop, int iLeft, int iBottom, int iRight, const cha { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtDrawBox(%d, %d, %d, %d, %p, %d)", iTop, iLeft, iBottom, iRight, szFrame, iColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtDrawBox(%d, %d, %d, %d, %p, %d)", iTop, iLeft, iBottom, iRight, ( const void * ) szFrame, iColor ) ); pGT = hb_gt_Base(); if( pGT ) @@ -373,7 +378,7 @@ HB_ERRCODE hb_gtColorsToString( int * pColors, int iColorCount, char * pszColorS { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtColorsToString(%p, %d, %p, %d)", pColors, iColorCount, pszColorString, iBufSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtColorsToString(%p, %d, %p, %d)", ( void * ) pColors, iColorCount, ( void * ) pszColorString, iBufSize ) ); pGT = hb_gt_Base(); if( pGT ) @@ -406,7 +411,7 @@ HB_ERRCODE hb_gtGetCursor( int * piCursorStyle ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetCursor(%p)", piCursorStyle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetCursor(%p)", ( void * ) piCursorStyle ) ); pGT = hb_gt_Base(); if( pGT ) @@ -440,7 +445,24 @@ HB_ERRCODE hb_gtGetPos( int * piRow, int * piCol ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetPos(%p, %p)", piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetPos(%p, %p)", ( void * ) piRow, ( void * ) piCol ) ); + + pGT = hb_gt_Base(); + if( pGT ) + { + HB_GTSELF_GETPOS( pGT, piRow, piCol ); + hb_gt_BaseFree( pGT ); + return HB_SUCCESS; + } + *piRow = *piCol = 0; + return HB_FAILURE; +} + +HB_ERRCODE hb_gtGetPosEx( int * piRow, int * piCol ) +{ + PHB_GT pGT; + + HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetPosEx(%p, %p)", ( void * ) piRow, ( void * ) piCol ) ); pGT = hb_gt_Base(); if( pGT ) @@ -515,7 +537,7 @@ HB_ERRCODE hb_gtScrDim( int * piHeight, int * piWidth ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtScrDim(%p, %p)", piHeight, piWidth ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtScrDim(%p, %p)", ( void * ) piHeight, ( void * ) piWidth ) ); pGT = hb_gt_Base(); if( pGT ) @@ -548,7 +570,7 @@ HB_ERRCODE hb_gtRectSize( int iTop, int iLeft, int iBottom, int iRight, HB_SIZE { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtRectSize(%d, %d, %d, %d, %p)", iTop, iLeft, iBottom, iRight, pulBuffSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtRectSize(%d, %d, %d, %d, %p)", iTop, iLeft, iBottom, iRight, ( void * ) pulBuffSize ) ); pGT = hb_gt_Base(); if( pGT ) @@ -633,7 +655,7 @@ HB_ERRCODE hb_gtGetChar( int iRow, int iCol, int * piColor, HB_BYTE * pbAttr, HB HB_ERRCODE errCode = HB_FAILURE; PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetChar(%d, %d, %p, %p, %p)", iRow, iCol, piColor, pbAttr, pusChar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetChar(%d, %d, %p, %p, %p)", iRow, iCol, ( void * ) piColor, ( void * ) pbAttr, ( void * ) pusChar ) ); pGT = hb_gt_Base(); if( pGT ) @@ -701,7 +723,7 @@ HB_ERRCODE hb_gtGetBlink( HB_BOOL * bpBlink ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetBlink(%p)", bpBlink ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetBlink(%p)", ( void * ) bpBlink ) ); pGT = hb_gt_Base(); if( pGT ) @@ -752,7 +774,7 @@ HB_ERRCODE hb_gtPutText( int iRow, int iCol, { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtPutText(%d, %d, %p, %" HB_PFS "u, %d)", iRow, iCol, szStr, nLength, iColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtPutText(%d, %d, %p, %" HB_PFS "u, %d)", iRow, iCol, ( const void * ) szStr, nLength, iColor ) ); pGT = hb_gt_Base(); if( pGT ) @@ -773,7 +795,7 @@ HB_ERRCODE hb_gtWriteAt( int iRow, int iCol, const char * szStr, HB_SIZE nLength { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtWriteAt(%d, %d, %p, %" HB_PFS "u)", iRow, iCol, szStr, nLength ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtWriteAt(%d, %d, %p, %" HB_PFS "u)", iRow, iCol, ( const void * ) szStr, nLength ) ); pGT = hb_gt_Base(); if( pGT ) @@ -790,7 +812,7 @@ HB_ERRCODE hb_gtWrite( const char * szStr, HB_SIZE nLength ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtWrite(%p, %" HB_PFS "u)", szStr, nLength ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtWrite(%p, %" HB_PFS "u)", ( const void * ) szStr, nLength ) ); pGT = hb_gt_Base(); if( pGT ) @@ -807,7 +829,7 @@ HB_ERRCODE hb_gtWriteCon( const char * szStr, HB_SIZE nLength ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtWriteCon(%p, %" HB_PFS "u)", szStr, nLength ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtWriteCon(%p, %" HB_PFS "u)", ( const void * ) szStr, nLength ) ); pGT = hb_gt_Base(); if( pGT ) @@ -838,6 +860,29 @@ HB_ERRCODE hb_gtScroll( int iTop, int iLeft, int iBottom, int iRight, int iRows, return HB_FAILURE; } +HB_ERRCODE hb_gtScrollEx( int iTop, int iLeft, int iBottom, int iRight, int iColor, int iChar, int iRows, int iCols ) +{ + PHB_GT pGT; + + HB_TRACE( HB_TR_DEBUG, ( "hb_gtScrollEx(%d, %d, %d, %d, %d, %d, %d, %d)", iTop, iLeft, iBottom, iRight, iColor, iChar, iRows, iCols ) ); + + pGT = hb_gt_Base(); + if( pGT ) + { + if( iColor == -1 ) + iColor = HB_GTSELF_GETCOLOR( pGT ); + if( iChar < 0 ) + iChar = HB_GTSELF_GETCLEARCHAR( pGT ); + HB_GTSELF_SCROLL( pGT, iTop, iLeft, iBottom, iRight, + iColor, ( HB_USHORT ) iChar, iRows, iCols ); + HB_GTSELF_FLUSH( pGT ); + hb_gt_BaseFree( pGT ); + return HB_SUCCESS; + } + + return HB_FAILURE; +} + HB_ERRCODE hb_gtScrollUp( int iRows ) { HB_TRACE( HB_TR_DEBUG, ( "hb_gtScrollUp(%d)", iRows ) ); @@ -961,7 +1006,7 @@ HB_ERRCODE hb_gtOutStd( const char * szStr, HB_SIZE nLen ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtOutStd(%p, %" HB_PFS "u)", szStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtOutStd(%p, %" HB_PFS "u)", ( const void * ) szStr, nLen ) ); pGT = hb_gt_Base(); if( pGT ) @@ -979,7 +1024,7 @@ HB_ERRCODE hb_gtOutErr( const char * szStr, HB_SIZE nLen ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtOutErr(%p, %" HB_PFS "u)", szStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtOutErr(%p, %" HB_PFS "u)", ( const void * ) szStr, nLen ) ); pGT = hb_gt_Base(); if( pGT ) @@ -1064,7 +1109,7 @@ HB_ERRCODE hb_gtInfo( int iType, PHB_GT_INFO pInfo ) HB_ERRCODE errCode = HB_FAILURE; PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtInfo(%d, %p)", iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtInfo(%d, %p)", iType, ( void * ) pInfo ) ); pGT = hb_gt_Base(); if( pGT ) @@ -1082,7 +1127,7 @@ int hb_gtAlert( PHB_ITEM pMessage, PHB_ITEM pOptions, int iResult = 0; PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtAlert(%p, %p, %d, %d, %f)", pMessage, pOptions, iClrNorm, iClrHigh, dDelay ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtAlert(%p, %p, %d, %d, %f)", ( void * ) pMessage, ( void * ) pOptions, iClrNorm, iClrHigh, dDelay ) ); pGT = hb_gt_Base(); if( pGT ) @@ -1204,7 +1249,7 @@ HB_ERRCODE hb_gtGetScrChar( int iRow, int iCol, int * piColor, HB_BYTE * pbAttr, HB_ERRCODE errCode = HB_FAILURE; PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetScrChar(%d, %d, %p, %p, %p)", iRow, iCol, piColor, pbAttr, pusChar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetScrChar(%d, %d, %p, %p, %p)", iRow, iCol, ( void * ) piColor, ( void * ) pbAttr, ( void * ) pusChar ) ); pGT = hb_gt_Base(); if( pGT ) @@ -1249,66 +1294,6 @@ HB_ERRCODE hb_gtFlush( void ) return HB_FAILURE; } -HB_ERRCODE hb_gtGetPosEx( int * piRow, int * piCol ) -{ - PHB_GT pGT; - - HB_TRACE( HB_TR_DEBUG, ( "hb_gtGetPosEx(%p, %p)", piRow, piCol ) ); - - pGT = hb_gt_Base(); - if( pGT ) - { - HB_GTSELF_GETPOS( pGT, piRow, piCol ); - hb_gt_BaseFree( pGT ); - return HB_SUCCESS; - } - *piRow = *piCol = 0; - return HB_FAILURE; -} - -HB_ERRCODE hb_gtScrollEx( int iTop, int iLeft, int iBottom, int iRight, int iColor, int iChar, int iRows, int iCols ) -{ - PHB_GT pGT; - - HB_TRACE( HB_TR_DEBUG, ( "hb_gtScrollEx(%d, %d, %d, %d, %d, %d, %d, %d)", iTop, iLeft, iBottom, iRight, iColor, iChar, iRows, iCols ) ); - - pGT = hb_gt_Base(); - if( pGT ) - { - if( iColor == -1 ) - iColor = HB_GTSELF_GETCOLOR( pGT ); - if( iChar < 0 ) - iChar = HB_GTSELF_GETCLEARCHAR( pGT ); - HB_GTSELF_SCROLL( pGT, iTop, iLeft, iBottom, iRight, - iColor, ( HB_USHORT ) iChar, iRows, iCols ); - HB_GTSELF_FLUSH( pGT ); - hb_gt_BaseFree( pGT ); - return HB_SUCCESS; - } - - return HB_FAILURE; -} - -HB_ERRCODE hb_gtBoxEx( int iTop, int iLeft, int iBottom, int iRight, const char * szFrame, int iColor ) -{ - PHB_GT pGT; - - HB_TRACE( HB_TR_DEBUG, ( "hb_gtBoxEx(%d, %d, %d, %d, %p, %d)", iTop, iLeft, iBottom, iRight, szFrame, iColor ) ); - - pGT = hb_gt_Base(); - if( pGT ) - { - if( iColor == -1 ) - iColor = HB_GTSELF_GETCOLOR( pGT ); - HB_GTSELF_BOX( pGT, iTop, iLeft, iBottom, iRight, szFrame, iColor ); - HB_GTSELF_SETPOS( pGT, iTop + 1, iLeft + 1 ); - HB_GTSELF_FLUSH( pGT ); - hb_gt_BaseFree( pGT ); - return HB_SUCCESS; - } - return HB_FAILURE; -} - int hb_gtGfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) { PHB_GT pGT; diff --git a/src/rtl/gtapiu.c b/src/rtl/gtapiu.c index 91b662844a..ce5c52f9e6 100644 --- a/src/rtl/gtapiu.c +++ b/src/rtl/gtapiu.c @@ -100,7 +100,7 @@ HB_BOOL hb_gtWVis( HB_GT_WND * wnd, HB_USHORT iStatus ) /* USHORT in CA-Cl*pper return HB_FALSE; } -HB_ERRCODE hb_gtSLR( HB_GT_SLR * pSLR ) /* System Level Request */ +HB_ERRCODE hb_gtSLR( HB_GT_SLR * pSLR ) /* System-Level Request */ { /* Do nothing in Harbour, since the low-level GT API is implemented with a different method than in CA-Cl*pper. */ diff --git a/src/rtl/gtcgi/gtcgi.c b/src/rtl/gtcgi/gtcgi.c index 3931439a06..e299b012a7 100644 --- a/src/rtl/gtcgi/gtcgi.c +++ b/src/rtl/gtcgi/gtcgi.c @@ -105,7 +105,7 @@ static void hb_gt_cgi_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil { PHB_GTCGI pGTCGI; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); HB_GTLOCAL( pGT ) = pGTCGI = ( PHB_GTCGI ) hb_xgrabz( sizeof( HB_GTCGI ) ); @@ -124,7 +124,7 @@ static void hb_gt_cgi_Exit( PHB_GT pGT ) { PHB_GTCGI pGTCGI; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Exit(%p)", ( void * ) pGT ) ); HB_GTSELF_REFRESH( pGT ); @@ -150,7 +150,7 @@ static void hb_gt_cgi_Exit( PHB_GT pGT ) static int hb_gt_cgi_ReadKey( PHB_GT pGT, int iEventMask ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( pGT ); HB_SYMBOL_UNUSED( iEventMask ); @@ -160,7 +160,7 @@ static int hb_gt_cgi_ReadKey( PHB_GT pGT, int iEventMask ) static HB_BOOL hb_gt_cgi_IsColor( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_IsColor(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_IsColor(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -172,7 +172,7 @@ static void hb_gt_cgi_Bell( PHB_GT pGT ) static const char s_szBell[] = { HB_CHAR_BEL, 0 }; PHB_GTCGI pGTCGI; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Bell(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Bell(%p)", ( void * ) pGT ) ); pGTCGI = HB_GTCGI_GET( pGT ); @@ -181,7 +181,7 @@ static void hb_gt_cgi_Bell( PHB_GT pGT ) static const char * hb_gt_cgi_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -196,7 +196,7 @@ static void hb_gt_cgi_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int { int iHeight, iWidth; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Scroll(%p,%d,%d,%d,%d,%d,%d,%d,%d)", pGT, iTop, iLeft, iBottom, iRight, iColor, usChar, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Scroll(%p,%d,%d,%d,%d,%d,%d,%d,%d)", ( void * ) pGT, iTop, iLeft, iBottom, iRight, iColor, usChar, iRows, iCols ) ); /* Provide some basic scroll support for full screen */ HB_GTSELF_GETSIZE( pGT, &iHeight, &iWidth ); @@ -342,7 +342,7 @@ static void hb_gt_cgi_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) int iLineFeed, iHeight, iWidth, iLen; PHB_GTCGI pGTCGI; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); pGTCGI = HB_GTCGI_GET( pGT ); HB_GTSELF_GETSIZE( pGT, &iHeight, &iWidth ); @@ -407,7 +407,7 @@ static void hb_gt_cgi_Refresh( PHB_GT pGT ) int iHeight, iWidth; PHB_GTCGI pGTCGI; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Refresh(%p)", ( void * ) pGT ) ); pGTCGI = HB_GTCGI_GET( pGT ); HB_GTSELF_GETSIZE( pGT, &iHeight, &iWidth ); @@ -426,7 +426,7 @@ static void hb_gt_cgi_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_cgi_Init; pFuncTable->Exit = hb_gt_cgi_Exit; diff --git a/src/rtl/gtchrmap.c b/src/rtl/gtchrmap.c index 9b1a21bce2..ea2a9b0391 100644 --- a/src/rtl/gtchrmap.c +++ b/src/rtl/gtchrmap.c @@ -12,13 +12,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -36,7 +36,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -48,6 +48,8 @@ /* NOTE: User programs should never call this layer directly! */ +/* TODO: use Harbour FS API */ + #include "hbgtcore.h" #include "hbapifs.h" @@ -192,7 +194,7 @@ static int get_val( char ** buf ) static int parse_line( char * buf, int * from, int * to, char * op, int * val, int * mod ) { - char *s, *s2; + char *s; int ret = 0, ina = 0; s = buf; @@ -223,6 +225,7 @@ static int parse_line( char * buf, int * from, int * to, char * op, int * val, i if( *s == '@' ) { + char *s2; ++s; s2 = buf; while( *s != '\0' && *s != ' ' ) @@ -412,13 +415,13 @@ int hb_gt_chrmapinit( int * piTransTbl, const char * pszTerm, HB_BOOL fSetACSC ) if( pszTerm != NULL && *pszTerm != '\0' ) { - char szFile[ HB_PATH_MAX ]; char * pszFile = hb_getenv( "HB_CHARMAP" ); if( pszFile != NULL && *pszFile != '\0' ) nRet = hb_gt_chrmapread( pszFile, pszTerm, piTransTbl ); if( nRet == -1 ) { + char szFile[ HB_PATH_MAX ]; if( pszFile ) hb_xfree( pszFile ); pszFile = hb_getenv( "HB_ROOT" ); diff --git a/src/rtl/gtclip.c b/src/rtl/gtclip.c index 93f5c67887..00eb3de514 100644 --- a/src/rtl/gtclip.c +++ b/src/rtl/gtclip.c @@ -1,5 +1,5 @@ /* - * Low level ClipBoard code common to some GT drivers + * Low-level ClipBoard code common to some GT drivers * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rtl/gtcrs/gtcrs.c b/src/rtl/gtcrs/gtcrs.c index 6f86d24f56..fc548a0b86 100644 --- a/src/rtl/gtcrs/gtcrs.c +++ b/src/rtl/gtcrs/gtcrs.c @@ -10,13 +10,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -34,7 +34,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -89,7 +89,7 @@ typedef struct int rbdn_row, rbdn_col; int mbup_row, mbup_col; int mbdn_row, mbdn_col; - /* to analize DBLCLK on xterm */ + /* to analyze DBLCLK on xterm */ int click_delay; struct timeval BL_time; struct timeval BR_time; @@ -179,7 +179,7 @@ static void curs_wrkaround( void ); static int getClipKey( int nKey ) { - int nRet = 0, nFlag, n; + int nRet = 0; if( IS_CLIPKEY( nKey ) ) nRet = GET_CLIPKEY( nKey ); @@ -187,9 +187,9 @@ static int getClipKey( int nKey ) nRet = nKey; else { - n = GET_KEYMASK( nKey ); + int nFlag = 0; + int n = GET_KEYMASK( nKey ); nKey = CLR_KEYMASK( nKey ); - nFlag = 0; if( n & KEY_SHIFTMASK ) nFlag |= HB_KF_SHIFT; if( n & KEY_CTRLMASK ) @@ -447,10 +447,10 @@ static void del_efds( InOutBase * ioBase, int fd ) static void del_all_efds( InOutBase * ioBase ) { - int i; - if( ioBase->event_fds != NULL ) { + int i; + for( i = 0; i < ioBase->efds_no; i++ ) hb_xfree( ioBase->event_fds[ i ] ); @@ -728,7 +728,7 @@ static void mouse_init( InOutBase * ioBase ) GPM_MOVE | GPM_DRAG | GPM_UP | GPM_DOWN | GPM_SINGLE | GPM_DOUBLE; /* give me move events but handle them anyway */ ioBase->Conn.defaultMask = GPM_MOVE | GPM_HARD; - /* only pure mouse events, no Ctrl,Alt,Shft events */ + /* only pure mouse events, no Ctrl,Alt,Shift events */ ioBase->Conn.minMod = 0; ioBase->Conn.maxMod = ( ( 1 << KG_SHIFT ) | ( 1 << KG_CTRL ) | ( 1 << KG_ALT ) ); gpm_zerobased = 1; @@ -1172,7 +1172,7 @@ static void disp_cursor( InOutBase * ioBase ) if( ioBase->cursor != ioBase->lcursor ) { int lcurs = -1; - char escseq[ 64 ], * cv = NULL; + char * cv = NULL; switch( ioBase->cursor ) { @@ -1206,6 +1206,7 @@ static void disp_cursor( InOutBase * ioBase ) { if( ioBase->terminal_type == TERM_LINUX ) { + char escseq[ 64 ]; hb_snprintf( escseq, sizeof( escseq ), "\033[?25%c\033[?%dc", ioBase->cursor == SC_NONE ? 'l' : 'h', lcurs ); write_ttyseq( ioBase, escseq ); @@ -1269,16 +1270,17 @@ static void gt_ttyrestore( InOutBase * ioBase ) static HB_BOOL gt_outstr( InOutBase * ioBase, int fd, const char * str, int len ) { - unsigned char * buf, c; - int i; HB_BOOL success; if( ioBase->out_transtbl != NULL ) { + unsigned char * buf; + int i; + buf = ( unsigned char * ) hb_xgrab( len ); for( i = 0; i < len; ++i ) { - c = str[ i ]; + unsigned char c = str[ i ]; if( c != 9 && c != 10 && c != 13 && ioBase->out_transtbl[ c ] ) buf[ i ] = ioBase->out_transtbl[ c ]; else @@ -1569,10 +1571,9 @@ static void init_keys( InOutBase * ioBase ) static void gt_tone( InOutBase * ioBase, double dFrequency, double dDuration ) { - char escseq[ 64 ]; - if( ioBase->terminal_type == TERM_LINUX && ioBase->beep != NULL ) { + char escseq[ 64 ]; hb_snprintf( escseq, sizeof( escseq ), "\033[10;%d]\033[11;%d]%s", ( int ) dFrequency, ( int ) ( dDuration * 1000.0 / 18.2 ), ioBase->beep ); @@ -1591,7 +1592,6 @@ static void set_sig_keys( InOutBase * ioBase, int key_int, int key_brk, { if( isatty( ioBase->base_infd ) ) { - /* set SIGINT character, default ^C */ if( key_int >= 0 && key_int <= 255 ) ioBase->curr_TIO.c_cc[ VINTR ] = key_int; @@ -1604,7 +1604,7 @@ static void set_sig_keys( InOutBase * ioBase, int key_int, int key_brk, if( key_stp >= 0 && key_stp <= 255 ) ioBase->curr_TIO.c_cc[ VSUSP ] = key_stp; - /* enable siganls from terminal device */ + /* enable signals from terminal device */ if( ioBase->curr_TIO.c_cc[ VINTR ] != 0 || ioBase->curr_TIO.c_cc[ VQUIT ] != 0 || ioBase->curr_TIO.c_cc[ VSUSP ] != 0 ) @@ -1680,11 +1680,12 @@ static int gt_resize( InOutBase * ioBase ) static int gt_setsize( InOutBase * ioBase, int rows, int cols ) { - int ret = -1, r, c; - char escseq[ 64 ]; + int ret = -1; if( ioBase->terminal_type == TERM_XTERM ) { + int r, c; + char escseq[ 64 ]; hb_snprintf( escseq, sizeof( escseq ), "\033[8;%d;%dt", rows, cols ); write_ttyseq( ioBase, escseq ); /* dirty hack - wait for SIGWINCH */ @@ -1717,10 +1718,10 @@ static int gt_setsize( InOutBase * ioBase, int rows, int cols ) static void setKeyTrans( InOutBase * ioBase, PHB_CODEPAGE cdpTerm, PHB_CODEPAGE cdpHost ) { - int i; - if( cdpTerm && cdpHost && cdpTerm != cdpHost ) { + int i; + if( ioBase->in_transtbl == NULL ) ioBase->in_transtbl = ( unsigned char * ) hb_xgrab( 256 ); @@ -1737,13 +1738,12 @@ static void setKeyTrans( InOutBase * ioBase, PHB_CODEPAGE cdpTerm, PHB_CODEPAGE static void setDispTrans( InOutBase * ioBase, PHB_CODEPAGE cdpHost, PHB_CODEPAGE cdpTerm, int transBox ) { int i, aSet; - chtype ch; aSet = ( cdpHost && cdpTerm ); for( i = 0; i < 256; i++ ) { - ch = ioBase->charmap[ i ] & 0xffff; + chtype ch = ioBase->charmap[ i ] & 0xffff; switch( ( ioBase->charmap[ i ] >> 16 ) & 0xff ) { case 1: @@ -1808,7 +1808,7 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, { InOutBase * ioBase; int bg, fg; - unsigned int i, n; + unsigned int i; char buf[ 256 ], * ptr, * crsterm = NULL; ioBase = ( InOutBase * ) hb_xgrabz( sizeof( InOutBase ) ); @@ -1872,13 +1872,13 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, memset( ioBase->curr_TIO.c_cc, 0, NCCS ); /* workaround for bug in some Linux kernels (i.e. 3.13.0-64-generic - Ubuntu) in which select() unconditionally accepts stdin for + *buntu) in which select() unconditionally accepts stdin for reading if c_cc[ VMIN ] = 0 [druzus] */ ioBase->curr_TIO.c_cc[ VMIN ] = 1; } - /* curses SCREEN initialisation */ + /* curses SCREEN initialization */ if( ioBase->base_infd == fileno( stdin ) ) ioBase->basein = stdin; else @@ -1922,7 +1922,7 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, ioBase->attr_mask = ( chtype ) -1; if( has_colors() ) { - /* DOS->CURSES color maping + /* DOS->CURSES color mapping DOS -> curses -------------------------------- 0 black -> COLOR_BLACK @@ -1968,8 +1968,9 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, #endif for( i = 0; i < 256; i++ ) { + unsigned int n; bg = ( i >> 4 ) & 0x07; /* extract background color bits 4-6 */ - fg = ( i & 0x07 ); /* extract forground color bits 0-2 */ + fg = ( i & 0x07 ); /* extract foreground color bits 0-2 */ n = bg * 8 + fg; /* n = bg * COLORS + fg */ if( n == 0 ) @@ -1979,7 +1980,7 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, if( ( i & 0x88 ) == 0 ) init_pair( n, color_map[ fg ], color_map[ bg ] ); ioBase->attr_map[ i ] = COLOR_PAIR( n ); - if( i & 0x08 ) /* highlight forground bit 3 */ + if( i & 0x08 ) /* highlight foreground bit 3 */ ioBase->attr_map[ i ] |= A_BOLD; if( i & 0x80 ) /* blink/highlight background bit 7 */ ioBase->attr_map[ i ] |= A_BLINK; @@ -1991,13 +1992,13 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, for( i = 0; i < 256; i++ ) { bg = ( i >> 4 ) & 0x07; /* extract background color bits 4-6 */ - fg = ( i & 0x07 ); /* extract forground color bits 0-2 */ + fg = ( i & 0x07 ); /* extract foreground color bits 0-2 */ ioBase->attr_map[ i ] = 0; if( fg < bg ) ioBase->attr_map[ i ] |= A_REVERSE; if( fg == 1 ) /* underline? */ ioBase->attr_map[ i ] |= A_UNDERLINE; - if( i & 0x08 ) /* highlight forground bit 3 */ + if( i & 0x08 ) /* highlight foreground bit 3 */ ioBase->attr_map[ i ] |= A_BOLD; if( i & 0x80 ) /* blink/highlight background bit 7 */ ioBase->attr_map[ i ] |= A_BLINK; @@ -2089,7 +2090,7 @@ static void destroy_ioBase( InOutBase * ioBase ) /* restore terminal settings */ gt_ttyrestore( ioBase ); - /* kill terminal proces if any */ + /* kill terminal process if any */ if( ioBase->termpid > 0 ) { kill( ioBase->termpid, SIGTERM ); @@ -2177,7 +2178,7 @@ static int set_active_ioBase( int iNO_ioBase ) static int add_new_ioBase( InOutBase * ioBase ) { - int i, n, add = 0; + int i, add = 0; for( i = 0; i < s_iSize_ioBaseTab && ! add; ++i ) if( ! s_ioBaseTab[ i ] ) @@ -2188,6 +2189,8 @@ static int add_new_ioBase( InOutBase * ioBase ) if( ! add ) { + int n; + if( s_ioBaseTab == NULL ) s_ioBaseTab = ( InOutBase ** ) hb_xgrab( ( s_iSize_ioBaseTab += 10 ) * sizeof( InOutBase * ) ); @@ -2207,14 +2210,14 @@ static int add_new_ioBase( InOutBase * ioBase ) static int del_ioBase( int iNO_ioBase ) { - int i; - if( iNO_ioBase >= 0 && iNO_ioBase < s_iSize_ioBaseTab ) { destroy_ioBase( s_ioBaseTab[ iNO_ioBase ] ); s_ioBaseTab[ iNO_ioBase ] = NULL; if( s_iActive_ioBase == iNO_ioBase ) { + int i; + s_iActive_ioBase = -1; s_ioBase = NULL; for( i = 0; i < s_iSize_ioBaseTab && ! s_ioBase; ++i ) @@ -2228,10 +2231,10 @@ static int del_ioBase( int iNO_ioBase ) static void del_all_ioBase( void ) { - int i; - if( s_ioBaseTab ) { + int i; + for( i = 0; i < s_iSize_ioBaseTab; ++i ) if( s_ioBaseTab[ i ] ) destroy_ioBase( s_ioBaseTab[ i ] ); @@ -2341,12 +2344,12 @@ void HB_GT_FUNC( gt_CatchSignal( int iSig ) ) static void hb_gt_crs_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { - InOutBase * ioBase; - - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); if( ! s_ioBase ) { + InOutBase * ioBase; + s_iStdIn = hFilenoStdin; s_iStdOut = hFilenoStdout; s_iStdErr = hFilenoStderr; @@ -2378,7 +2381,7 @@ static void hb_gt_crs_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil static void hb_gt_crs_Exit( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Exit(%p)", ( void * ) pGT ) ); HB_GTSUPER_EXIT( pGT ); @@ -2389,7 +2392,7 @@ static void hb_gt_crs_Exit( PHB_GT pGT ) static HB_BOOL hb_gt_crs_IsColor( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_IsColor(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_IsColor(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2400,7 +2403,7 @@ static HB_BOOL hb_gt_crs_IsColor( PHB_GT pGT ) static HB_BOOL hb_gt_crs_SetMode( PHB_GT pGT, int iRows, int iCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_SetMode(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_SetMode(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); if( gt_setsize( s_ioBase, iRows, iCols ) == 0 ) { @@ -2415,7 +2418,7 @@ static HB_BOOL hb_gt_crs_SetMode( PHB_GT pGT, int iRows, int iCols ) static void hb_gt_crs_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_SetBlink(%p, %d)", pGT, ( int ) fBlink ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_SetBlink(%p, %d)", ( void * ) pGT, ( int ) fBlink ) ); if( fBlink ) s_ioBase->attr_mask |= A_BLINK; @@ -2429,7 +2432,7 @@ static void hb_gt_crs_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) static void hb_gt_crs_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2444,7 +2447,7 @@ static void hb_gt_crs_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static const char * hb_gt_crs_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2491,7 +2494,7 @@ static void hb_gt_crs_OutErr( PHB_GT pGT, const char * szStr, HB_SIZE nLen ) static HB_BOOL hb_gt_crs_Suspend( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Suspend(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Suspend(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2509,7 +2512,7 @@ static HB_BOOL hb_gt_crs_Suspend( PHB_GT pGT ) static HB_BOOL hb_gt_crs_Resume( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Resume(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Resume(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2529,7 +2532,7 @@ static HB_BOOL hb_gt_crs_Resume( PHB_GT pGT ) static HB_BOOL hb_gt_crs_PreExt( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_PreExt(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_PreExt(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2543,7 +2546,7 @@ static HB_BOOL hb_gt_crs_PreExt( PHB_GT pGT ) static HB_BOOL hb_gt_crs_PostExt( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_PostExt(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_PostExt(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2554,7 +2557,7 @@ static HB_BOOL hb_gt_crs_PostExt( PHB_GT pGT ) static HB_BOOL hb_gt_crs_mouse_IsPresent( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_IsPresent(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_IsPresent(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2565,7 +2568,7 @@ static HB_BOOL hb_gt_crs_mouse_IsPresent( PHB_GT pGT ) static void hb_gt_crs_mouse_Show( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_Show(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_Show(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2580,7 +2583,7 @@ static void hb_gt_crs_mouse_Show( PHB_GT pGT ) static void hb_gt_crs_mouse_Hide( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_Hide(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_Hide(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2594,7 +2597,7 @@ static void hb_gt_crs_mouse_Hide( PHB_GT pGT ) static void hb_gt_crs_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_Col(%p,%p,%p)", pGT, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_Col(%p,%p,%p)", ( void * ) pGT, ( void * ) piRow, ( void * ) piCol ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2606,7 +2609,7 @@ static void hb_gt_crs_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) static void hb_gt_crs_mouse_SetPos( PHB_GT pGT, int iRow, int iCol ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_SetPos(%p,%i,%i)", pGT, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_SetPos(%p,%i,%i)", ( void * ) pGT, iRow, iCol ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2622,7 +2625,7 @@ static HB_BOOL hb_gt_crs_mouse_ButtonState( PHB_GT pGT, int iButton ) { HB_BOOL ret = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_ButtonState(%p,%i)", pGT, iButton ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_ButtonState(%p,%i)", ( void * ) pGT, iButton ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2649,7 +2652,7 @@ static HB_BOOL hb_gt_crs_mouse_ButtonState( PHB_GT pGT, int iButton ) static int hb_gt_crs_mouse_CountButton( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_CountButton(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_CountButton(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2658,7 +2661,7 @@ static int hb_gt_crs_mouse_CountButton( PHB_GT pGT ) static void hb_gt_crs_mouse_SetDoubleClickSpeed( PHB_GT pGT, int iSpeed ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_SetDoubleClickSpeed(%p,%d)", pGT, iSpeed ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_SetDoubleClickSpeed(%p,%d)", ( void * ) pGT, iSpeed ) ); HB_GTSUPER_MOUSESETDOUBLECLICKSPEED( pGT, iSpeed ); s_ioBase->mLastEvt.click_delay = iSpeed; @@ -2670,7 +2673,7 @@ static int hb_gt_crs_ReadKey( PHB_GT pGT, int iEventMask ) { int iKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( iEventMask ); @@ -2690,7 +2693,7 @@ static int hb_gt_crs_ReadKey( PHB_GT pGT, int iEventMask ) static HB_BOOL hb_gt_crs_SetDispCP( PHB_GT pGT, const char * pszTermCDP, const char * pszHostCDP, HB_BOOL fBox ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_SetDispCP(%p,%s,%s,%d)", pGT, pszTermCDP, pszHostCDP, ( int ) fBox ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_SetDispCP(%p,%s,%s,%d)", ( void * ) pGT, pszTermCDP, pszHostCDP, ( int ) fBox ) ); if( HB_GTSUPER_SETDISPCP( pGT, pszTermCDP, pszHostCDP, fBox ) ) { @@ -2705,7 +2708,7 @@ static HB_BOOL hb_gt_crs_SetDispCP( PHB_GT pGT, const char * pszTermCDP, const c static HB_BOOL hb_gt_crs_SetKeyCP( PHB_GT pGT, const char * pszTermCDP, const char * pszHostCDP ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_SetKeyCP(%p,%s,%s)", pGT, pszTermCDP, pszHostCDP ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_SetKeyCP(%p,%s,%s)", ( void * ) pGT, pszTermCDP, pszHostCDP ) ); if( HB_GTSUPER_SETKEYCP( pGT, pszTermCDP, pszHostCDP ) ) { @@ -2719,7 +2722,7 @@ static HB_BOOL hb_gt_crs_SetKeyCP( PHB_GT pGT, const char * pszTermCDP, const ch static HB_BOOL hb_gt_crs_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); if( s_ioBase ) { @@ -2749,7 +2752,7 @@ static HB_BOOL hb_gt_crs_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static void hb_gt_crs_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); if( s_ioBase ) { @@ -2764,8 +2767,8 @@ static void hb_gt_crs_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) if( ! HB_GTSELF_GETSCRUC( pGT, iRow, iCol++, &iColor, &bAttr, &uc, HB_FALSE ) ) break; ch = ( s_ioBase->attr_map[ iColor ] & s_ioBase->attr_mask ) | - ( bAttr & HB_GT_ATTR_BOX ? s_ioBase->box_chmap[ uc ] : - s_ioBase->std_chmap[ uc ] ); + ( ( bAttr & HB_GT_ATTR_BOX ) ? s_ioBase->box_chmap[ uc ] : + s_ioBase->std_chmap[ uc ] ); waddch( s_ioBase->hb_stdscr, ch ); } } @@ -2775,7 +2778,7 @@ static void hb_gt_crs_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) static void hb_gt_crs_Refresh( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); if( s_ioBase ) @@ -2794,7 +2797,7 @@ static void hb_gt_crs_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_crs_Init; pFuncTable->Exit = hb_gt_crs_Exit; diff --git a/src/rtl/gtcrs/gtcrs.h b/src/rtl/gtcrs/gtcrs.h index 5568e36bac..636d9ef9ba 100644 --- a/src/rtl/gtcrs/gtcrs.h +++ b/src/rtl/gtcrs/gtcrs.h @@ -10,13 +10,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -34,7 +34,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * diff --git a/src/rtl/gtcrs/hb-charmap.def b/src/rtl/gtcrs/hb-charmap.def index 67d99e497e..87710bc960 100644 --- a/src/rtl/gtcrs/hb-charmap.def +++ b/src/rtl/gtcrs/hb-charmap.def @@ -1,6 +1,6 @@ #============================================================================= # Copyright 2003 Przemyslaw Czerpak <druzus@polbox.com>, -# See COPYING.txt for licensing terms. +# See LICENSE.txt for licensing terms. #============================================================================= # Table Syntax: # <:> terminal[|terminal|terminal...] <space> comment diff --git a/src/rtl/gtdos/gtdos.c b/src/rtl/gtdos/gtdos.c index b8f627863e..67ac98c29e 100644 --- a/src/rtl/gtdos/gtdos.c +++ b/src/rtl/gtdos/gtdos.c @@ -2,6 +2,26 @@ * Video subsystem for DOS compilers * * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * hb_gt_CtrlBrkHandler() + * hb_gt_CtrlBrkRestore() + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> + * hb_gt_ReadKey() + * Copyright 2000 Alejandro de Garate <alex_degarate@hotmail.com> + * vmode12x40() + * vmode25x40() + * vmode28x40() + * vmode50x40() + * vmode12x80() + * vmode25x80() + * vmode28x80() + * vmode43x80() + * vmode50x80() + * hb_gt_SetMode() + * hb_gt_GetDisplay() + * Copyright 1999 Jose Lalin <dezac@corevia.com> + * Copyright 1999 Luiz Rafael Culik <Culik@sl.conex.net> + * Harbour Mouse Subsystem for DOS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,40 +64,7 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_gt_CtrlBrkHandler() - * hb_gt_CtrlBrkRestore() - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * hb_gt_ReadKey() - * - * Copyright 2000 Alejandro de Garate <alex_degarate@hotmail.com> - * vmode12x40() - * vmode25x40() - * vmode28x40() - * vmode50x40() - * vmode12x80() - * vmode25x80() - * vmode28x80() - * vmode43x80() - * vmode50x80() - * hb_gt_SetMode() - * hb_gt_GetDisplay() - * - * Copyright 1999 Jose Lalin <dezac@corevia.com> - * Luiz Rafael Culik <Culik@sl.conex.net> - * Harbour Mouse Subsystem for DOS - * - * See COPYING.txt for licensing terms. - * - */ - -/* - * This module is based on VIDMGR by Andrew Clarke and modified for Harbour. - */ +/* This module is based on VIDMGR by Andrew Clarke and modified for Harbour. */ /* NOTE: User programs should never call this layer directly! */ @@ -96,8 +83,7 @@ #include <conio.h> -/* - * use mouse driver save/restore state functions, +/* Use mouse driver save/restore state functions, * add other compilers for which calling real mode * interrupts with memory pointer is implemented. */ @@ -264,7 +250,7 @@ static int hb_gt_dos_GetScreenMode( void ) static void hb_gt_dos_GetScreenSize( int * piRows, int * piCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetScreenSize(%p, %p)", piRows, piCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetScreenSize(%p, %p)", ( void * ) piRows, ( void * ) piCols ) ); *piRows = ( int ) HB_PEEK_BYTE( 0x0040, 0x0084 ) + 1; *piCols = ( int ) HB_PEEK_BYTE( 0x0040, 0x004A ); @@ -275,7 +261,7 @@ static HB_BYTE FAR * hb_gt_dos_ScreenAddress( PHB_GT pGT ) { HB_BYTE FAR * ptr; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_ScreenAddress(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_ScreenAddress(%p)", ( void * ) pGT ) ); #if defined( __WATCOMC__ ) && defined( __386__ ) if( HB_GTSELF_ISCOLOR( pGT ) ) @@ -311,7 +297,7 @@ static void hb_gt_dos_GetScreenContents( PHB_GT pGT ) HB_BYTE * pScreenPtr = s_pScreenAddress; #endif - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetScreenContents(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetScreenContents(%p)", ( void * ) pGT ) ); bxAttr = 0; cdp = HB_GTSELF_CPTERM( pGT ); @@ -333,6 +319,7 @@ static void hb_gt_dos_GetScreenContents( PHB_GT pGT ) gettext( iCol + 1, iRow + 1, iCol + 1, iRow + 1, &ch_attr ); bChar = ch_attr & 0xFF; bAttr = ch_attr >> 8; + HB_SYMBOL_UNUSED( pScreenPtr ); #elif defined( __DJGPP__ ) int iChar, iAttr; ScreenGetChar( &iChar, &iAttr, iCol, iRow ); @@ -354,7 +341,7 @@ static void hb_gt_dos_GetCursorPosition( int * piRow, int * piCol ) { union REGS regs; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetCursorPosition(%p, %p)", piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetCursorPosition(%p, %p)", ( void * ) piRow, ( void * ) piCol ) ); regs.h.ah = 0x03; regs.h.bh = 0; @@ -397,7 +384,7 @@ static void hb_gt_dos_GetCursorSize( unsigned char * start, unsigned char * end { union REGS regs; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetCursorSize(%p, %p)", start, end ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetCursorSize(%p, %p)", ( void * ) start, ( void * ) end ) ); regs.h.ah = 0x03; regs.h.bh = 0; @@ -817,7 +804,7 @@ static void hb_gt_dos_mouse_GetBounds( PHB_GT pGT, int * piTop, int * piLeft, in static void hb_gt_dos_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Init(%p,%d,%d,%d)", pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Init(%p,%d,%d,%d)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); s_bBreak = HB_FALSE; @@ -872,7 +859,7 @@ static void hb_gt_dos_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil static void hb_gt_dos_Exit( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Exit(%p)", ( void * ) pGT ) ); HB_GTSUPER_EXIT( pGT ); } @@ -881,7 +868,7 @@ static int hb_gt_dos_ReadKey( PHB_GT pGT, int iEventMask ) { int iKey = 0, iFlags = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); #if defined( __DJGPP__ ) /* Check to see if Ctrl+Break has been detected */ @@ -949,7 +936,7 @@ static int hb_gt_dos_ReadKey( PHB_GT pGT, int iEventMask ) static HB_BOOL hb_gt_dos_IsColor( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_IsColor(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_IsColor(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -958,7 +945,7 @@ static HB_BOOL hb_gt_dos_IsColor( PHB_GT pGT ) static HB_BOOL hb_gt_dos_GetBlink( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetBlink(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_GetBlink(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -969,7 +956,7 @@ static void hb_gt_dos_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) { union REGS regs; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_SetBlink(%p,%d)", pGT, ( int ) fBlink ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_SetBlink(%p,%d)", ( void * ) pGT, ( int ) fBlink ) ); HB_SYMBOL_UNUSED( pGT ); @@ -982,7 +969,7 @@ static void hb_gt_dos_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) static void hb_gt_dos_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); @@ -992,6 +979,8 @@ static void hb_gt_dos_Tone( PHB_GT pGT, double dFrequency, double dDuration ) sound( ( unsigned ) dFrequency ); #elif defined( __DJGPP__ ) sound( ( int ) dFrequency ); +#else + HB_SYMBOL_UNUSED( dFrequency ); #endif /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ @@ -1006,7 +995,7 @@ static void hb_gt_dos_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static const char * hb_gt_dos_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1059,7 +1048,7 @@ static void vmode28x40( void ) regs.HB_XREGS.ax = 0x0001; /* video mode 40 cols */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); regs.HB_XREGS.bx = 0; /* load block 0 (BL = 0) */ - regs.HB_XREGS.ax = 0x1111; /* load 8x8 monochrome char set into RAM */ + regs.HB_XREGS.ax = 0x1111; /* load 8x8 monochrome font into RAM */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); } @@ -1070,7 +1059,7 @@ static void vmode50x40( void ) regs.HB_XREGS.ax = 0x0001; HB_DOS_INT86( INT_VIDEO, ®s, ®s ); regs.HB_XREGS.bx = 0; /* load block 0 (BL = 0) */ - regs.HB_XREGS.ax = 0x1112; /* load 8x8 double dot char set into RAM */ + regs.HB_XREGS.ax = 0x1112; /* load 8x8 double dot font into RAM */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); outportw( 0x03D4, 0x060A ); } @@ -1099,7 +1088,7 @@ static void vmode25x80( void ) regs.HB_XREGS.ax = 0x0083; /* mode in AL, if higher bit is on, No CLS */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); regs.HB_XREGS.bx = 0; /* load block 0 (BL = 0) */ - regs.HB_XREGS.ax = 0x1114; /* load 8x14 VGA char set into RAM */ + regs.HB_XREGS.ax = 0x1114; /* load 8x14 VGA font into RAM */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); } @@ -1110,7 +1099,7 @@ static void vmode28x80( void ) regs.HB_XREGS.ax = 0x0003; /* mode in AL, if higher bit is on, No CLS */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); regs.HB_XREGS.bx = 0; /* load block 0 (BL = 0) */ - regs.HB_XREGS.ax = 0x1111; /* load 8x8 monochrome char set into RAM */ + regs.HB_XREGS.ax = 0x1111; /* load 8x8 monochrome font into RAM */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); } @@ -1118,18 +1107,18 @@ static void vmode43x80( void ) { union REGS regs; - regs.HB_XREGS.ax = 0x1201; /* select 350 scan line mode */ + regs.HB_XREGS.ax = 0x1201; /* select 350 scan line mode */ regs.h.bl = 0x30; HB_DOS_INT86( INT_VIDEO, ®s, ®s ); - regs.HB_XREGS.ax = 0x0003; /* mode in AL, if higher bit is on, No CLS */ + regs.HB_XREGS.ax = 0x0003; /* mode in AL, if higher bit is on, No CLS */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); - regs.h.bh = 0x1; /* bytes per character */ - regs.h.bl = 0x0; /* load block 0 */ - regs.HB_XREGS.ax = 0x1112; /* load 8x8 double dot char set into RAM */ + regs.h.bh = 0x1; /* bytes per character */ + regs.h.bl = 0x0; /* load block 0 */ + regs.HB_XREGS.ax = 0x1112; /* load 8x8 double dot font into RAM */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); - outportw( 0x03D4, 0x060A ); /* update cursor size / pointers */ + outportw( 0x03D4, 0x060A ); /* update cursor size / pointers */ #if ! defined( __DJGPP__ ) - HB_POKE_BYTE( 0x40, 0x84, 42 ); /* 42 rows number update */ + HB_POKE_BYTE( 0x40, 0x84, 42 ); /* 42 rows number update */ #endif } @@ -1143,7 +1132,7 @@ static void vmode50x80( void ) regs.HB_XREGS.ax = 0x0003; /* mode in AL, if bit 7 is on, No CLS */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); regs.HB_XREGS.bx = 0; /* load block 0 (BL = 0) */ - regs.HB_XREGS.ax = 0x1112; /* load 8x8 double dot char set into RAM */ + regs.HB_XREGS.ax = 0x1112; /* load 8x8 double dot font into RAM */ HB_DOS_INT86( INT_VIDEO, ®s, ®s ); } @@ -1188,7 +1177,7 @@ static HB_BOOL hb_gt_dos_SetMode( PHB_GT pGT, int iRows, int iCols ) /* HB_GTSELF_ISCOLOR( pGT ) test for color card, we need to know if it is a VGA board...*/ HB_BOOL bIsVGA, bIsVesa, bSuccess; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_SetMode(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_SetMode(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); bIsVGA = ( hb_gt_dos_GetDisplay() == 8 ); bIsVesa = HB_FALSE; @@ -1232,7 +1221,7 @@ static HB_BOOL hb_gt_dos_SetMode( PHB_GT pGT, int iRows, int iCols ) hb_gt_dos_GetScreenSize( &s_iRows, &s_iCols ); - /* Check for succesful */ + /* Check for success */ if( s_iRows == iRows && s_iCols == iCols ) { bSuccess = HB_TRUE; @@ -1260,7 +1249,7 @@ static HB_BOOL hb_gt_dos_SetMode( PHB_GT pGT, int iRows, int iCols ) static HB_BOOL hb_gt_dos_PostExt( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_PostExt(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_PostExt(%p)", ( void * ) pGT ) ); hb_gt_dos_GetCursorPosition( &s_iCurRow, &s_iCurCol ); hb_gt_dos_GetScreenContents( pGT ); @@ -1271,7 +1260,7 @@ static HB_BOOL hb_gt_dos_PostExt( PHB_GT pGT ) static HB_BOOL hb_gt_dos_Resume( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Resume(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Resume(%p)", ( void * ) pGT ) ); s_iScreenMode = hb_gt_dos_GetScreenMode(); #if ! defined( __DJGPP__ ) @@ -1301,7 +1290,7 @@ static void hb_gt_dos_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) HB_UCHAR uc; int iLen = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); while( iLen < iSize ) { @@ -1312,6 +1301,7 @@ static void hb_gt_dos_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { short ch_attr = ( ( short ) iColor << 8 ) | uc; puttext( iCol + iLen + 1, iRow + 1, iCol + iLen + 1, iRow + 1, &ch_attr ); + HB_SYMBOL_UNUSED( pScreenPtr ); } #elif defined( __DJGPP__ ) ScreenPutChar( uc, iColor, iCol + iLen, iRow ); @@ -1326,7 +1316,7 @@ static void hb_gt_dos_Refresh( PHB_GT pGT ) { int iRow, iCol, iStyle; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); @@ -1343,7 +1333,7 @@ static void hb_gt_dos_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_dos_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Info(%p,%d,%p)", ( void * ) pGT, iType, pInfo ) ); switch( iType ) { @@ -1369,7 +1359,7 @@ static HB_BOOL hb_gt_dos_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_dos_Init; pFuncTable->Exit = hb_gt_dos_Exit; diff --git a/src/rtl/gtgui/gtgui.c b/src/rtl/gtgui/gtgui.c index da9be2266d..e367b834d7 100644 --- a/src/rtl/gtgui/gtgui.c +++ b/src/rtl/gtgui/gtgui.c @@ -1,6 +1,6 @@ /* * Mini GT for GUI programs. - * Now it supports only low level TONE and CLIPBOARD code for Windows + * Now it supports only low-level Tone() and CLIPBOARD code for Windows * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -98,7 +98,6 @@ static int hb_gt_gui_optionId( const char * pszOption ) if( pszOption ) { HB_SIZE nSize; - int i; while( HB_ISSPACE( *pszOption ) ) pszOption++; @@ -108,6 +107,7 @@ static int hb_gt_gui_optionId( const char * pszOption ) if( nSize >= 2 && nSize <= 9 ) { + int i; for( i = 0; i < ( int ) _HB_BUTTON_COUNT; ++i ) { if( nSize == s_buttons[ i ].len && @@ -241,7 +241,7 @@ static int hb_gt_gui_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, static const char * hb_gt_gui_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_gui_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_gui_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -255,7 +255,7 @@ static const char * hb_gt_gui_Version( PHB_GT pGT, int iType ) /* dDuration is in 'Ticks' (18.2 per second) */ static void hb_gt_gui_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_gui_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_gui_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); #if defined( HB_OS_WIN ) HB_SYMBOL_UNUSED( pGT ); @@ -269,7 +269,7 @@ static void hb_gt_gui_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static HB_BOOL hb_gt_gui_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_gui_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_gui_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); switch( iType ) { @@ -310,7 +310,7 @@ static HB_BOOL hb_gt_gui_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Version = hb_gt_gui_Version; pFuncTable->Tone = hb_gt_gui_Tone; diff --git a/src/rtl/gtkbstat.c b/src/rtl/gtkbstat.c index c14cec96f8..6dadb6091e 100644 --- a/src/rtl/gtkbstat.c +++ b/src/rtl/gtkbstat.c @@ -1,5 +1,5 @@ /* - * Low level keyboard shift state functions common to some GT drivers + * Low-level keyboard shift state functions common to some GT drivers * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -44,10 +44,8 @@ * */ - /* NOTE: User programs should never call this layer directly! */ - #include "hbgtcore.h" #if defined( HB_OS_WIN ) diff --git a/src/rtl/gtkeycod.c b/src/rtl/gtkeycod.c index 15ca0b452f..783f39f59d 100644 --- a/src/rtl/gtkeycod.c +++ b/src/rtl/gtkeycod.c @@ -1,12 +1,12 @@ /* * hb_gt_dos_keyCodeTranslate() - * function used by DOS, WIN and OS2 ports of few GTs which use - * getkey()/getch()/_read_kbd()/KbdCharIn() or similar function - * for keyboard input - * based on hb_gt_ReadKey() from GTDOS code by: - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> + * function used by MS-DOS, Windows and OS/2 ports of few GTs which + * use getkey()/getch()/_read_kbd()/KbdCharIn() or similar function + * for keyboard input * * Copyright 2006, 2015 Przemyslaw Czerpak <druzus / at / priv.onet.pl> + * based on hb_gt_ReadKey() from GTDOS code by: + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +49,6 @@ * */ - /* NOTE: User programs should never call this layer directly! */ #include "hbgtcore.h" diff --git a/src/rtl/gtos2/gtos2.c b/src/rtl/gtos2/gtos2.c index bc9388c737..11478539a0 100644 --- a/src/rtl/gtos2/gtos2.c +++ b/src/rtl/gtos2/gtos2.c @@ -2,6 +2,30 @@ * Video subsystem for OS/2 compilers * * Copyright 1999-2001 {list of individual authors and e-mail addresses} + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> + * hb_gt_os2_ReadKey() + * + * Copyright 1999 Chen Kedem <niki@synel.co.il> + * hb_gt_os2_mouse_Init() + * hb_gt_os2_mouse_Exit() + * hb_gt_os2_mouse_IsPresent() + * hb_gt_os2_mouse_Show() + * hb_gt_os2_mouse_Hide() + * hb_gt_os2_mouse_SetPos() + * hb_gt_os2_mouse_CountButton() + * hb_gt_os2_Tone() + * hb_gt_os2_IsColor() + * hb_gt_os2_SetCursorSize() + * hb_gt_os2_GetCharHeight() + * hb_gt_os2_GetCursorStyle() + * hb_gt_os2_SetCursorStyle() + * hb_gt_os2_GetBlink() + * hb_gt_os2_SetBlink() + * + * Copyright 2000-2001 Maurilio Longo <maurilio.longo@libero.it> + * hb_gt_DispBegin() / hb_gt_DispEnd() + * hb_gt_ScreenPtr() and hb_gt_xYYYY() functions and virtual screen support inside hb_gt_XXXX()s + * 16-bit KBD subsystem use inside hb_gt_os2_ReadKey() * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,41 +68,7 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * hb_gt_os2_ReadKey() - * - * Copyright 1999 Chen Kedem <niki@synel.co.il> - * hb_gt_os2_mouse_Init() - * hb_gt_os2_mouse_Exit() - * hb_gt_os2_mouse_IsPresent() - * hb_gt_os2_mouse_Show() - * hb_gt_os2_mouse_Hide() - * hb_gt_os2_mouse_SetPos() - * hb_gt_os2_mouse_CountButton() - * hb_gt_os2_Tone() - * hb_gt_os2_IsColor() - * hb_gt_os2_SetCursorSize() - * hb_gt_os2_GetCharHeight() - * hb_gt_os2_GetCursorStyle() - * hb_gt_os2_SetCursorStyle() - * hb_gt_os2_GetBlink() - * hb_gt_os2_SetBlink() - * - * Copyright 2000-2001 Maurilio Longo <maurilio.longo@libero.it> - * hb_gt_DispBegin() / hb_gt_DispEnd() - * hb_gt_ScreenPtr() and hb_gt_xYYYY() functions and virtual screen support inside hb_gt_XXXX()s - * 16 bit KBD subsystem use inside hb_gt_os2_ReadKey() - * - * See COPYING.txt for licensing terms. - * - */ - -/* - * This module is partially based on VIDMGR by Andrew Clarke and modified for Harbour. - */ +/* This module is partially based on VIDMGR by Andrew Clarke and modified for Harbour. */ /* NOTE: User programs should never call this layer directly! */ @@ -131,7 +121,7 @@ static int s_iCursorStyle; static int s_iLineBufSize = 0; static char * s_sLineBuf; -/* Code page ID of active codepage at the time harbour program was start */ +/* Code page ID of active codepage at the time Harbour program was start */ static HB_USHORT s_usOldCodePage; /* Instead of calling VioGetMode() every time I need MaxRow() or MaxCol() I @@ -233,7 +223,7 @@ static void hb_gt_os2_mouse_Exit( PHB_GT pGT ) if( s_uMouHandle ) { - MouClose( s_uMouHandle ); /* relese mouse handle */ + MouClose( s_uMouHandle ); /* release mouse handle */ s_uMouHandle = 0; } } @@ -271,7 +261,7 @@ static void hb_gt_os2_mouse_Hide( PHB_GT pGT ) con: calling function from another module, GT must be linked in con: VioGetMode is been called twice */ - vi.cb = sizeof( VIOMODEINFO ); + vi.cb = sizeof( vi ); VioGetMode( &vi, 0 ); rect.row = 0; /* x-coordinate upper left */ rect.col = 0; /* y-coordinate upper left */ @@ -437,7 +427,7 @@ static void hb_gt_os2_GetCursorPosition( int * piRow, int * piCol ) { USHORT y, x; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_GetCursorPosition(%p, %p)", piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_GetCursorPosition(%p, %p)", ( void * ) piRow, ( void * ) piCol ) ); VioGetCurPos( &y, &x, 0 ); @@ -559,7 +549,7 @@ static void hb_gt_os2_GetScreenContents( PHB_GT pGT ) char * pBufPtr; HB_BYTE bxAttr; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_GetScreenContents(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_GetScreenContents(%p)", ( void * ) pGT ) ); bxAttr = 0; cdp = HB_GTSELF_CPTERM( pGT ); @@ -600,9 +590,9 @@ static PVOID hb_gt_os2_allocMem( int iSize ) static void hb_gt_os2_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Init(%p,%p,%p,%p)", pGT, ( HB_PTRUINT ) hFilenoStdin, ( HB_PTRUINT ) hFilenoStdout, ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); - s_vi.cb = sizeof( VIOMODEINFO ); + s_vi.cb = sizeof( s_vi ); VioGetMode( &s_vi, 0 ); /* fill structure with current video mode settings */ /* Alloc tileable memory for calling a 16 subsystem */ @@ -665,7 +655,7 @@ static void hb_gt_os2_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil static void hb_gt_os2_Exit( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Exit(%p)", ( void * ) pGT ) ); HB_GTSUPER_EXIT( pGT ); @@ -688,10 +678,10 @@ static int hb_gt_os2_ReadKey( PHB_GT pGT, int iEventMask ) { int iKey = 0, iFlags = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); /* zero out keyboard event record */ - memset( s_key, 0, sizeof( KBDKEYINFO ) ); + memset( s_key, 0, sizeof( *s_key ) ); #if defined( __WATCOMC__ ) if( s_fBreak ) @@ -751,22 +741,22 @@ static int hb_gt_os2_ReadKey( PHB_GT pGT, int iEventMask ) static HB_BOOL hb_gt_os2_IsColor( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_IsColor(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_IsColor(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); - return s_vi.fbType != 0; /* 0 = monochrom-compatible mode */ + return s_vi.fbType != 0; /* 0 = monochrome-compatible mode */ } static HB_BOOL hb_gt_os2_GetBlink( PHB_GT pGT ) { VIOINTENSITY vi; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_GetBlink(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_GetBlink(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); - vi.cb = sizeof( VIOINTENSITY ); /* 6 */ + vi.cb = sizeof( vi ); /* 6 */ vi.type = 2; /* get intensity/blink toggle */ VioGetState( &vi, 0 ); @@ -777,11 +767,11 @@ static void hb_gt_os2_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) { VIOINTENSITY vi; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_SetBlink(%p,%d)", pGT, ( int ) fBlink ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_SetBlink(%p,%d)", ( void * ) pGT, ( int ) fBlink ) ); HB_SYMBOL_UNUSED( pGT ); - vi.cb = sizeof( VIOINTENSITY ); /* 6 */ + vi.cb = sizeof( vi ); /* 6 */ vi.type = 2; /* set intensity/blink toggle */ vi.fs = ( fBlink ? 0 : 1 ); /* 0 = blink, 1 = intens */ VioSetState( &vi, 0 ); @@ -791,7 +781,7 @@ static void hb_gt_os2_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { ULONG ulDuration; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); @@ -814,7 +804,7 @@ static void hb_gt_os2_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static const char * hb_gt_os2_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -826,7 +816,7 @@ static const char * hb_gt_os2_Version( PHB_GT pGT, int iType ) static HB_BOOL hb_gt_os2_Resize( PHB_GT pGT, int iRows, int iCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Resize(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Resize(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); if( HB_GTSUPER_RESIZE( pGT, iRows, iCols ) ) { @@ -849,11 +839,11 @@ static HB_BOOL hb_gt_os2_SetMode( PHB_GT pGT, int iRows, int iCols ) { HB_BOOL fResult = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_SetMode(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_SetMode(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); if( iRows > 0 && iCols > 0 ) { - s_vi.cb = sizeof( VIOMODEINFO ); + s_vi.cb = sizeof( s_vi ); VioGetMode( &s_vi, 0 ); /* fill structure with current settings */ s_vi.row = iRows; s_vi.col = iCols; @@ -861,7 +851,7 @@ static HB_BOOL hb_gt_os2_SetMode( PHB_GT pGT, int iRows, int iCols ) if( ! fResult ) { - s_vi.cb = sizeof( VIOMODEINFO ); + s_vi.cb = sizeof( s_vi ); VioGetMode( &s_vi, 0 ); /* fill structure with current settings */ } @@ -879,7 +869,7 @@ static HB_BOOL hb_gt_os2_SetMode( PHB_GT pGT, int iRows, int iCols ) static HB_BOOL hb_gt_os2_PostExt( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_PostExt(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_PostExt(%p)", ( void * ) pGT ) ); hb_gt_os2_GetCursorPosition( &s_iCurRow, &s_iCurCol ); HB_GTSELF_SETPOS( pGT, s_iCurRow, s_iCurCol ); @@ -890,9 +880,9 @@ static HB_BOOL hb_gt_os2_PostExt( PHB_GT pGT ) static HB_BOOL hb_gt_os2_Resume( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Resume(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Resume(%p)", ( void * ) pGT ) ); - s_vi.cb = sizeof( VIOMODEINFO ); + s_vi.cb = sizeof( s_vi ); VioGetMode( &s_vi, 0 ); /* fill structure with current settings */ hb_gt_os2_GetCursorPosition( &s_iCurRow, &s_iCurCol ); s_iCursorStyle = hb_gt_os2_GetCursorStyle(); @@ -913,7 +903,7 @@ static void hb_gt_os2_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) HB_UCHAR uc; int iLen = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); while( iLen < iSize ) { @@ -932,7 +922,7 @@ static void hb_gt_os2_Refresh( PHB_GT pGT ) { int iRow, iCol, iStyle; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); @@ -949,7 +939,7 @@ static void hb_gt_os2_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_os2_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Info(%p,%d,%p)", ( void * ) pGT, iType, pInfo ) ); switch( iType ) { @@ -990,7 +980,7 @@ static HB_BOOL hb_gt_os2_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_os2_Init; pFuncTable->Exit = hb_gt_os2_Exit; diff --git a/src/rtl/gtpca/gtpca.c b/src/rtl/gtpca/gtpca.c index 7bac85f0a5..aded68e583 100644 --- a/src/rtl/gtpca/gtpca.c +++ b/src/rtl/gtpca/gtpca.c @@ -189,9 +189,9 @@ static void hb_gt_pca_termOut( const char * szStr, int iLen ) { if( s_iOutBufSize ) { - int i; while( iLen > 0 ) { + int i; if( s_iOutBufSize == s_iOutBufIndex ) hb_gt_pca_termFlush(); i = s_iOutBufSize - s_iOutBufIndex; @@ -229,7 +229,7 @@ static void hb_gt_pca_AnsiGetCurPos( int * iRow, int * iCol ) { static HB_BOOL s_fIsAnswer = HB_TRUE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_AnsiGetCurPos(%p, %p)", iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_AnsiGetCurPos(%p, %p)", ( void * ) iRow, ( void * ) iCol ) ); if( s_fIsAnswer && s_bStdinConsole && s_bStdoutConsole ) { @@ -248,7 +248,7 @@ static void hb_gt_pca_AnsiGetCurPos( int * iRow, int * iCol ) timer = hb_timerInit( timeout ); for( ;; ) { - /* loking for cursor position in "\033[%d;%dR" */ + /* looking for cursor position in "\033[%d;%dR" */ while( j < n && rdbuf[ j ] != '\033' ) ++j; if( n - j >= 6 ) @@ -357,8 +357,8 @@ static void hb_gt_pca_AnsiSetAttributes( int iAttr ) bg = s_AnsiColors[ ( iAttr >> 4 ) & 0x07 ]; fg = s_AnsiColors[ iAttr & 0x07 ]; - bold = iAttr & 0x08 ? 1 : 0; - blink = iAttr & 0x80 ? 1 : 0; + bold = ( iAttr & 0x08 ) ? 1 : 0; + blink = ( iAttr & 0x80 ) ? 1 : 0; if( s_iCurrentSGR == -1 ) { @@ -434,7 +434,7 @@ static void hb_gt_pca_AnsiInit( void ) static void hb_gt_pca_AnsiPutStr( int iRow, int iCol, int iColor, const char * szStr, int iLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_AnsiPutStr(%d,%d,%d,%p,%d)", iRow, iCol, iColor, szStr, iLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_AnsiPutStr(%d,%d,%d,%p,%d)", iRow, iCol, iColor, ( const void * ) szStr, iLen ) ); hb_gt_pca_AnsiSetAttributes( ( HB_BYTE ) iColor ); hb_gt_pca_AnsiSetCursorPos( iRow, iCol ); @@ -447,7 +447,7 @@ static void hb_gt_pca_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil { int iRows = 25, iCols = 80; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); s_hFilenoStdin = hFilenoStdin; s_hFilenoStdout = hFilenoStdout; @@ -502,7 +502,7 @@ static void hb_gt_pca_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil s_curr_TIO.c_cc[ VMIN ] = 0; #else /* workaround for bug in some Linux kernels (i.e. 3.13.0-64-generic - Ubuntu) in which select() unconditionally accepts stdin for + *buntu) in which select() unconditionally accepts stdin for reading if c_cc[ VMIN ] = 0 [druzus] */ s_curr_TIO.c_cc[ VMIN ] = 1; #endif @@ -546,7 +546,7 @@ static void hb_gt_pca_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil static void hb_gt_pca_Exit( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Exit(%p)", ( void * ) pGT ) ); HB_GTSELF_REFRESH( pGT ); /* set default color */ @@ -583,7 +583,7 @@ static int hb_gt_pca_ReadKey( PHB_GT pGT, int iEventMask ) { int ch = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( pGT ); HB_SYMBOL_UNUSED( iEventMask ); @@ -685,7 +685,7 @@ static void hb_gt_pca_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static double s_dLastSeconds = 0; double dCurrentSeconds; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Tone(%p, %lf, %lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Tone(%p, %lf, %lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); @@ -710,7 +710,7 @@ static void hb_gt_pca_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static void hb_gt_pca_Bell( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Bell(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Bell(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -720,7 +720,7 @@ static void hb_gt_pca_Bell( PHB_GT pGT ) static const char * hb_gt_pca_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -732,7 +732,7 @@ static const char * hb_gt_pca_Version( PHB_GT pGT, int iType ) static HB_BOOL hb_gt_pca_Suspend( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Suspend(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Suspend(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); #if defined( HB_HAS_TERMIOS ) @@ -748,7 +748,7 @@ static HB_BOOL hb_gt_pca_Suspend( PHB_GT pGT ) static HB_BOOL hb_gt_pca_Resume( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Resume(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Resume(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); #if defined( HB_HAS_TERMIOS ) @@ -764,7 +764,7 @@ static HB_BOOL hb_gt_pca_Resume( PHB_GT pGT ) static HB_BOOL hb_gt_pca_SetDispCP( PHB_GT pGT, const char * pszTermCDP, const char * pszHostCDP, HB_BOOL fBox ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_SetDispCP(%p,%s,%s,%d)", pGT, pszTermCDP, pszHostCDP, ( int ) fBox ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_SetDispCP(%p,%s,%s,%d)", ( void * ) pGT, pszTermCDP, pszHostCDP, ( int ) fBox ) ); if( HB_GTSUPER_SETDISPCP( pGT, pszTermCDP, pszHostCDP, fBox ) ) { @@ -783,7 +783,7 @@ static void hb_gt_pca_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) HB_USHORT usChar; int iLen = 0, iColor2 = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); while( iSize-- ) { @@ -834,7 +834,7 @@ static void hb_gt_pca_Refresh( PHB_GT pGT ) { int iWidth, iHeight, iRow, iCol, iStyle; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Refresh(%p)", ( void * ) pGT ) ); HB_GTSELF_GETSIZE( pGT, &iHeight, &iWidth ); @@ -865,7 +865,7 @@ static void hb_gt_pca_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_pca_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); switch( iType ) { @@ -884,7 +884,7 @@ static HB_BOOL hb_gt_pca_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_pca_Init; pFuncTable->Exit = hb_gt_pca_Exit; diff --git a/src/rtl/gtsln/gtsln.c b/src/rtl/gtsln/gtsln.c index a3a0bd0466..52d27cc6f2 100644 --- a/src/rtl/gtsln/gtsln.c +++ b/src/rtl/gtsln/gtsln.c @@ -10,13 +10,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -34,7 +34,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -105,7 +105,7 @@ static int s_iCursorStyle = SC_NORMAL; /* indicate if we are currently running a command from system */ static HB_BOOL s_bSuspended = HB_FALSE; -/* the name of an environmet variable containig a definition of nation chars.*/ +/* the name of an environment variable containing a definition of nation chars.*/ /* A definition is a list of pairs of chars. The first char in each pair is */ /* an ASCII key, which should be pressed *after* a "DeadKey" was pressed to */ /* get the nation char, a second in that pair is a corresponding nation char */ @@ -130,10 +130,12 @@ static void sigwinch_handler( int iSig ) static void hb_sln_colorTrans( void ) { - int i, clr, fg, bg; + int i; for( i = 0; i < 256; i++ ) { + int clr, fg, bg; + fg = ( i & 0x0F ); /* * bit 7 is a blinking attribute - not used when console is not in @@ -212,7 +214,7 @@ static void hb_sln_setSingleBox( void ) static void hb_sln_setACSCtrans( void ) { - unsigned char * p, ch; + unsigned char * p; SLsmg_Char_Type chBoard[ 3 ], chArrow[ 4 ]; memset( &chArrow, 0, sizeof( chArrow ) ); @@ -236,7 +238,7 @@ static void hb_sln_setACSCtrans( void ) memset( &SLch, 0, sizeof( SLsmg_Char_Type ) ); for( i = 0; i < len; i += 2 ) { - ch = *p++; + unsigned char ch = *p++; HB_SLN_BUILD_RAWCHAR( SLch, *p++, 0 ); HB_SLN_SET_ACSC( SLch ); switch( ch ) @@ -404,7 +406,7 @@ static void hb_sln_setKeyTrans( PHB_GT pGT ) p = getenv( hb_NationCharsEnvName ); if( p ) { - int len = strlen( p ) >> 1, ch; + int len = strlen( p ) >> 1; /* no more than 128 National chars are allowed */ if( len > 128 ) @@ -416,7 +418,7 @@ static void hb_sln_setKeyTrans( PHB_GT pGT ) len <<= 1; for( i = 0; i < len; i += 2 ) { - ch = ( unsigned char ) p[ i + 1 ]; + int ch = ( unsigned char ) p[ i + 1 ]; hb_sln_convKDeadKeys[ i + 1 ] = ( unsigned char ) p[ i ]; hb_sln_convKDeadKeys[ i + 2 ] = ch; hb_sln_inputTab[ ( unsigned char ) p[ i ] ] = ch; @@ -437,7 +439,7 @@ static void hb_sln_SetCursorStyle( int iStyle ) { SLtt_set_cursor_visibility( iStyle != SC_NONE ); - /* NOTE: cursor apearence works only under linux console */ + /* NOTE: cursor appearance works only under linux console */ if( hb_sln_UnderLinuxConsole && s_iCursorStyle != iStyle ) { /* keyseq to define cursor shape under linux console */ @@ -462,7 +464,7 @@ static void hb_sln_SetCursorStyle( int iStyle ) break; case SC_SPECIAL2: - /* TODO: find a proper sequqnce to set a cursor + /* TODO: find a proper sequence to set a cursor to SC_SPECIAL2 under Linux console */ cursDefseq[ 3 ] = '4'; break; @@ -495,7 +497,7 @@ static int hb_sln_isUTF8( int iStdOut, int iStdIn ) timer = hb_timerInit( timeout ); for( ;; ) { - /* loking for cursor position in "\033[%d;%dR" */ + /* looking for cursor position in "\033[%d;%dR" */ while( j < n && rdbuf[ j ] != '\033' ) ++j; if( n - j >= 6 ) @@ -552,7 +554,7 @@ static void hb_gt_sln_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil { HB_BOOL gt_Inited = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); /* stdin && stdout && stderr */ s_hStdIn = hFilenoStdin; @@ -567,7 +569,7 @@ static void hb_gt_sln_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil SLang_TT_Read_FD = -1; SLang_TT_Write_FD = -1; - /* read a terminal descripion from a terminfo database */ + /* read a terminal description from a terminfo database */ SLtt_get_terminfo(); /* initialize higher-level Slang routines */ @@ -597,7 +599,7 @@ static void hb_gt_sln_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil /* do not indicate USER_BREAK in SLang_Error - ??? */ SLang_Ignore_User_Abort = 1; - /* no default abort procesing */ + /* no default abort processing */ SLang_set_abort_signal( NULL ); /* NOTE: this is incompatible with CLIPPER @@ -610,7 +612,7 @@ static void hb_gt_sln_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil s_iCursorStyle = SC_UNAVAIL; /* NOTE: this driver is implemented in a way that it is - imposible to get intensity/blinking background mode. + impossible to get intensity/blinking background mode. The reason is the way Slang is written. This is incompatible with Clipper. But when the console is in UTF-8 mode we don't need @@ -693,7 +695,7 @@ static void hb_gt_sln_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil static void hb_gt_sln_Exit( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Exit(%p)", ( void * ) pGT ) ); /* restore a standard bell frequency and duration */ if( hb_sln_UnderLinuxConsole ) @@ -721,7 +723,7 @@ static void hb_gt_sln_Exit( PHB_GT pGT ) static HB_BOOL hb_gt_sln_SetMode( PHB_GT pGT, int iRows, int iCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_SetMode(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_SetMode(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); HB_SYMBOL_UNUSED( pGT ); HB_SYMBOL_UNUSED( iRows ); @@ -735,7 +737,7 @@ static HB_BOOL hb_gt_sln_SetMode( PHB_GT pGT, int iRows, int iCols ) static HB_BOOL hb_gt_sln_IsColor( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_IsColor(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_IsColor(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -746,7 +748,7 @@ static HB_BOOL hb_gt_sln_IsColor( PHB_GT pGT ) static void hb_gt_sln_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_SetBlink(%p,%d)", pGT, ( int ) fBlink ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_SetBlink(%p,%d)", ( void * ) pGT, ( int ) fBlink ) ); /* * We cannot switch remote terminal between blinking and highlight mode @@ -769,7 +771,7 @@ static void hb_gt_sln_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) static void hb_gt_sln_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); /* TODO: Implement this for other consoles than linux ? */ @@ -804,7 +806,7 @@ static void hb_gt_sln_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static const char * hb_gt_sln_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Version(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Version(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -882,7 +884,7 @@ static HB_BOOL hb_gt_sln_PostExt( PHB_GT pGT ) static HB_BOOL hb_gt_sln_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); switch( iType ) { @@ -939,7 +941,7 @@ static HB_BOOL hb_gt_sln_SetKeyCP( PHB_GT pGT, const char * pszTermCDP, const ch static void hb_gt_sln_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); if( s_fActive ) { @@ -988,7 +990,7 @@ static void hb_gt_sln_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) static void hb_gt_sln_Refresh( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); if( s_fActive ) @@ -1009,7 +1011,7 @@ static void hb_gt_sln_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_sln_Init; pFuncTable->Exit = hb_gt_sln_Exit; diff --git a/src/rtl/gtsln/gtsln.h b/src/rtl/gtsln/gtsln.h index e579af41a2..1100fdd7c4 100644 --- a/src/rtl/gtsln/gtsln.h +++ b/src/rtl/gtsln/gtsln.h @@ -95,7 +95,7 @@ } while( 0 ) #define HB_SLN_BUILD_CHAR( slch, ch, clr, attr ) \ do { \ - SLsmg_Char_Type * outTab = ( attr ) & HB_GT_ATTR_BOX ? \ + SLsmg_Char_Type * outTab = ( ( attr ) & HB_GT_ATTR_BOX ) ? \ s_outboxTab : s_outputTab; \ ( slch ).color = outTab[ ( HB_BYTE ) ( ch ) ].color | \ s_colorTab[ ( HB_BYTE ) ( clr ) ]; \ @@ -144,7 +144,7 @@ } while( 0 ) #define HB_SLN_BUILD_CHAR( slch, ch, clr, attr ) \ do { \ - ( slch ) = ( ( attr ) & HB_GT_ATTR_BOX ? \ + ( slch ) = ( ( ( attr ) & HB_GT_ATTR_BOX ) ? \ s_outboxTab : s_outputTab )[ ( HB_BYTE ) ( ch ) ] | \ s_colorTab[ ( HB_BYTE ) ( clr ) ]; \ } while( 0 ) diff --git a/src/rtl/gtsln/kbsln.c b/src/rtl/gtsln/kbsln.c index 5d69a96ff4..541136e7ea 100644 --- a/src/rtl/gtsln/kbsln.c +++ b/src/rtl/gtsln/kbsln.c @@ -160,10 +160,10 @@ static void hb_sln_Init_KeyTranslations( void ) }; /* on Unix systems ESC is a special key so let - assume ESC is a doble pressed ESC key */ + assume ESC is a double pressed ESC key */ SLkp_define_keysym( ( char * ) "^[^[", SL_KEY_ESC ); - /* try to define Shft-Fn and Ctrl-Fn keys. + /* try to define Shift-Fn and Ctrl-Fn keys. Because we assume terminal has only 10 Fkeys so F11-F30 is generated with Shift & Ctrl. This is not guaranteed to work in all cases */ @@ -171,7 +171,7 @@ static void hb_sln_Init_KeyTranslations( void ) keyname[ 0 ] = 'F'; keyname[ 2 ] = 0; - /* Shft & Ctrl FKeys definition takes place in two + /* Shift & Ctrl FKeys definition takes place in two phases : from '1' to '9' and from 'A' to 'K' */ for( i = 1; i <= 2; i++ ) { @@ -202,7 +202,7 @@ static void hb_sln_Init_KeyTranslations( void ) keyname[ 1 ] = ch; /* QUESTION: why Slang reports error for defining Alt+O ???. - Have I any hidden error in key definitiions ??? */ + Have I any hidden error in key definitions ??? */ if( ch != 'O' ) SLkp_define_keysym( keyname, SL_KEY_ALT( ch ) ); } @@ -300,7 +300,7 @@ int hb_gt_sln_ReadKey( PHB_GT pGT, int iEventMask ) HB_BOOL fInput; int iKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_ReadKey(%p,%d)", pGT, ( int ) iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_sln_ReadKey(%p,%d)", ( void * ) pGT, ( int ) iEventMask ) ); /* user AbortKey break */ if( SLKeyBoard_Quit == 1 ) @@ -340,13 +340,13 @@ int hb_gt_sln_ReadKey( PHB_GT pGT, int iEventMask ) { if( hb_sln_escDelay == 0 ) { - /* standard acction, wait a 1 second for next char and if not then exit */ + /* standard action, wait a 1 second for next char and if not then exit */ if( 0 == SLang_input_pending( 10 ) ) return 0; } else { - /* wait hb_sln_escDelay milisec for next char and in not return ESC keycode */ + /* wait hb_sln_escDelay millisec for next char and in not return ESC keycode */ if( 0 == SLang_input_pending( -HB_MAX( hb_sln_escDelay, 0 ) ) ) return 033; } @@ -400,7 +400,7 @@ int hb_gt_sln_ReadKey( PHB_GT pGT, int iEventMask ) if( tmp != 0 ) return tmp; - /* TOFIX: this code is broken - needs a diffrent aproach */ + /* FIXME: this code is broken - needs a different approach */ tmp = hb_sln_FindKeyTranslation( ch ); if( tmp != 0 || ch > 256 ) return tmp; @@ -469,7 +469,7 @@ static int hb_sln_try_get_Kbd_State( void ) IOcommand = KB_ISSCANCODE; if( ioctl( 0, TCSETSC, &IOcommand ) >= 0 ) { - /* if SCANCODE mode is set corectly try get KBD state */ + /* if SCANCODE mode is set correctly try get KBD state */ if( ioctl( 0, KDGKBSTATE, &modifiers ) < 0 ) modifiers = 0; diff --git a/src/rtl/gtsln/keytrans.c b/src/rtl/gtsln/keytrans.c index daf56ef34f..a4f3d9ffb5 100644 --- a/src/rtl/gtsln/keytrans.c +++ b/src/rtl/gtsln/keytrans.c @@ -381,16 +381,17 @@ static int KeyTranslationTable[][ 2 ] = /* *********************************************************************** */ -#define KeyTranslationTableSize \ - ( sizeof( KeyTranslationTable ) / ( 2 * sizeof ( int ) ) ) +#define KeyTranslationTableSize HB_SIZEOFARRAY( KeyTranslationTable ) /* a very simple sort algorithm */ static void hb_sln_SortKeyTranslationTable( void ) { - int i, j, min, KeyTmp[ 2 ]; + int i; for( i = 0; i < ( ( int ) KeyTranslationTableSize - 1 ); i++ ) { + int j, min, KeyTmp[ 2 ]; + min = i; for( j = i + 1; j < ( int ) KeyTranslationTableSize; j++ ) @@ -412,11 +413,10 @@ static void hb_sln_SortKeyTranslationTable( void ) } } -/* +#if 0 for( i = 0; i < KeyTranslationTableSize; i++ ) fprintf( stderr, "%02x %8x %8x\n", i, KeyTranslationTable[ i ][ 0 ], KeyTranslationTable[ i ][ 1 ] ); - */ - +#endif } /* ************************************************************************* */ @@ -424,16 +424,14 @@ static void hb_sln_SortKeyTranslationTable( void ) /* standard binary search */ static int hb_sln_FindKeyTranslation( int SlangKey ) { - int Start, Stop, CurPos; - if( ( SlangKey >= KeyTranslationTable[ 0 ][ 0 ] ) && ( SlangKey <= KeyTranslationTable[ KeyTranslationTableSize - 1 ][ 0 ] ) ) { - Start = 0; Stop = KeyTranslationTableSize - 1; + int Start = 0, Stop = KeyTranslationTableSize - 1; while( Start <= Stop ) { - CurPos = ( Start + Stop ) / 2; + int CurPos = ( Start + Stop ) / 2; /* fprintf( stderr, "%d %d %d\n", i, KeyTranslationTable[ i ][ 0 ], KeyTranslationTable[ i ][ 1 ] ); */ diff --git a/src/rtl/gtsln/mousesln.c b/src/rtl/gtsln/mousesln.c index 89fc0a77fc..3973ef295c 100644 --- a/src/rtl/gtsln/mousesln.c +++ b/src/rtl/gtsln/mousesln.c @@ -349,7 +349,7 @@ void hb_gt_sln_mouse_Init( void ) Conn.eventMask = GPM_MOVE | GPM_UP | GPM_DOWN | GPM_DRAG | GPM_DOUBLE; /* give me move events but handle them anyway */ Conn.defaultMask= GPM_MOVE | GPM_HARD; - /* only pure mouse events, no Ctrl,Alt,Shft events */ + /* only pure mouse events, no Ctrl,Alt,Shift events */ Conn.minMod = 0; Conn.maxMod = 0; @@ -396,7 +396,7 @@ void hb_gt_sln_mouse_Exit( void ) if( hb_sln_UnderXterm ) { const char * DisabTrack = "\033[?1000l"; /* disable mouse tracking */ - const char * RestoHilit = "\033[?1001r"; /* restore old hilittracking */ + const char * RestoHilit = "\033[?1001r"; /* restore old hilit tracking */ /* restore xterm settings */ SLtt_write_string( ( char * ) HB_UNCONST( DisabTrack ) ); diff --git a/src/rtl/gtstd/gtstd.c b/src/rtl/gtstd/gtstd.c index f54ad82c2c..f926fb7099 100644 --- a/src/rtl/gtstd/gtstd.c +++ b/src/rtl/gtstd/gtstd.c @@ -189,7 +189,7 @@ static void hb_gt_std_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil { PHB_GTSTD pGTSTD; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); HB_GTLOCAL( pGT ) = pGTSTD = ( PHB_GTSTD ) hb_xgrabz( sizeof( HB_GTSTD ) ); @@ -242,7 +242,7 @@ static void hb_gt_std_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil pGTSTD->curr_TIO.c_cc[ VMIN ] = 0; #else /* workaround for bug in some Linux kernels (i.e. 3.13.0-64-generic - Ubuntu) in which select() unconditionally accepts stdin for + *buntu) in which select() unconditionally accepts stdin for reading if c_cc[ VMIN ] = 0 [druzus] */ pGTSTD->curr_TIO.c_cc[ VMIN ] = 1; #endif @@ -283,7 +283,7 @@ static void hb_gt_std_Exit( PHB_GT pGT ) PHB_GTSTD pGTSTD; int iRow, iCol; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Exit(%p)", ( void * ) pGT ) ); HB_GTSELF_REFRESH( pGT ); HB_GTSELF_GETPOS( pGT, &iRow, &iCol ); @@ -323,7 +323,7 @@ static int hb_gt_std_ReadKey( PHB_GT pGT, int iEventMask ) PHB_GTSTD pGTSTD; int ch = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( iEventMask ); @@ -438,7 +438,7 @@ static int hb_gt_std_ReadKey( PHB_GT pGT, int iEventMask ) static HB_BOOL hb_gt_std_IsColor( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_IsColor(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_IsColor(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -450,7 +450,7 @@ static void hb_gt_std_Tone( PHB_GT pGT, double dFrequency, double dDuration ) double dCurrentSeconds; PHB_GTSTD pGTSTD; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); pGTSTD = HB_GTSTD_GET( pGT ); @@ -475,14 +475,14 @@ static void hb_gt_std_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static void hb_gt_std_Bell( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Bell(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Bell(%p)", ( void * ) pGT ) ); hb_gt_std_termOut( HB_GTSTD_GET( pGT ), s_szBell, 1 ); } static const char * hb_gt_std_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -494,7 +494,7 @@ static const char * hb_gt_std_Version( PHB_GT pGT, int iType ) static HB_BOOL hb_gt_std_Suspend( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Suspend(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Suspend(%p)", ( void * ) pGT ) ); #if defined( HB_HAS_TERMIOS ) { @@ -509,7 +509,7 @@ static HB_BOOL hb_gt_std_Suspend( PHB_GT pGT ) static HB_BOOL hb_gt_std_Resume( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Resume(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Resume(%p)", ( void * ) pGT ) ); #if defined( HB_HAS_TERMIOS ) @@ -527,7 +527,7 @@ static void hb_gt_std_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int { int iHeight, iWidth; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Scroll(%p,%d,%d,%d,%d,%d,%d,%d,%d)", pGT, iTop, iLeft, iBottom, iRight, iColor, usChar, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Scroll(%p,%d,%d,%d,%d,%d,%d,%d,%d)", ( void * ) pGT, iTop, iLeft, iBottom, iRight, iColor, usChar, iRows, iCols ) ); /* Provide some basic scroll support for full screen */ HB_GTSELF_GETSIZE( pGT, &iHeight, &iWidth ); @@ -598,7 +598,7 @@ static void hb_gt_std_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) int iLineFeed, iBackSpace, iMin; PHB_GTSTD pGTSTD; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); iLineFeed = iBackSpace = 0; pGTSTD = HB_GTSTD_GET( pGT ); @@ -684,7 +684,7 @@ static void hb_gt_std_Refresh( PHB_GT pGT ) int iHeight, iSize; PHB_GTSTD pGTSTD; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Refresh(%p)", ( void * ) pGT ) ); pGTSTD = HB_GTSTD_GET( pGT ); HB_GTSELF_GETSIZE( pGT, &iHeight, &pGTSTD->iWidth ); @@ -699,10 +699,10 @@ static void hb_gt_std_Refresh( PHB_GT pGT ) HB_GTSUPER_REFRESH( pGT ); if( pGTSTD->fFullRedraw ) { - int i; - if( pGTSTD->iRow < iHeight - 1 ) { + int i; + for( i = pGTSTD->iRow + 1; i < iHeight; ++i ) hb_gt_std_DispLine( pGT, i, 0, -1 ); } @@ -711,7 +711,7 @@ static void hb_gt_std_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_std_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); switch( iType ) { @@ -730,7 +730,7 @@ static HB_BOOL hb_gt_std_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_std_Init; pFuncTable->Exit = hb_gt_std_Exit; diff --git a/src/rtl/gtsys.c b/src/rtl/gtsys.c index 4e3c65d87b..c0a44dac88 100644 --- a/src/rtl/gtsys.c +++ b/src/rtl/gtsys.c @@ -10,13 +10,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -34,7 +34,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -46,8 +46,6 @@ /* NOTE: User programs should never call this layer directly! */ -/* *********************************************************************** */ - /* This definition has to be placed before #include "hbapigt.h" */ #define HB_GT_NAME NUL diff --git a/src/rtl/gttone.c b/src/rtl/gttone.c index 0d833f33e9..d91c1930a0 100644 --- a/src/rtl/gttone.c +++ b/src/rtl/gttone.c @@ -1,9 +1,9 @@ /* - * Low level tone code common to some GT drivers + * Low-level tone code common to some GT drivers * * Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * - * the body of TONE function from Windows taken from GTWIN created by + * the body of Tone() function from Windows taken from GTWIN created by * the following authors: * Copyright 1999 David G. Holm <dholm@jsd-llc.com> * Copyright 1999-2006 Paul Tucker <ptucker@sympatico.ca> @@ -51,10 +51,8 @@ * */ - /* NOTE: User programs should never call this layer directly! */ - #include "hbgtcore.h" #if defined( HB_OS_WIN ) @@ -90,7 +88,7 @@ static int hb_Inp9x( unsigned short int usPort ) __emit__(0x32,0xE4); /* ASM XOR AH, AH */ usVal = _AX; - #elif defined( __XCC__ ) || defined( __POCC__ ) || defined( __BORLANDC__ ) + #elif defined( __BORLANDC__ ) || defined( __POCC__ ) || defined( __XCC__ ) __asm { mov dx, usPort @@ -100,6 +98,7 @@ static int hb_Inp9x( unsigned short int usPort ) } #elif defined( __MINGW32__ ) + __asm__ __volatile__ ("inb %w1,%b0":"=a" (usVal):"Nd" (usPort)); #elif defined( __WATCOMC__ ) @@ -115,8 +114,6 @@ static int hb_Inp9x( unsigned short int usPort ) return usVal; } -/* *********************************************************************** */ - static int hb_Outp9x( unsigned short int usPort, unsigned short int usVal ) { HB_TRACE( HB_TR_DEBUG, ( "hb_Outp9x(%hu, %hu)", usPort, usVal ) ); @@ -127,7 +124,7 @@ static int hb_Outp9x( unsigned short int usPort, unsigned short int usVal ) _AL = usVal; __emit__(0xEE); /* ASM OUT DX, AL */ - #elif defined( __XCC__ ) || defined( __POCC__ ) || defined( __BORLANDC__ ) + #elif defined( __BORLANDC__ ) || defined( __POCC__ ) || defined( __XCC__ ) __asm { mov dx, usPort @@ -152,7 +149,6 @@ static int hb_Outp9x( unsigned short int usPort, unsigned short int usVal ) return usVal; } -/* *********************************************************************** */ /* dDurat is in seconds */ static void hb_gt_w9xTone( double dFreq, double dDurat ) { @@ -211,7 +207,6 @@ static void hb_gt_w9xTone( double dFreq, double dDurat ) #endif -/* *********************************************************************** */ /* dDurat is in seconds */ static void hb_gt_wNtTone( double dFreq, double dDurat ) { @@ -226,7 +221,6 @@ static void hb_gt_wNtTone( double dFreq, double dDurat ) hb_idleSleep( dDurat ); } -/* *********************************************************************** */ /* dDuration is in 'Ticks' (18.2 per second) */ void hb_gt_winapi_tone( double dFrequency, double dDuration ) { @@ -234,7 +228,7 @@ void hb_gt_winapi_tone( double dFrequency, double dDuration ) /* * According to the Clipper NG, the duration in 'ticks' is truncated to the - * interger portion ... Depending on the platform, Harbour allows a finer + * integer portion ... Depending on the platform, Harbour allows a finer * resolution, but the minimum is 1 tick (for compatibility) */ /* Convert from ticks to seconds */ diff --git a/src/rtl/gttrm/gttrm.c b/src/rtl/gttrm/gttrm.c index ebc1a714b9..1bdcf359ec 100644 --- a/src/rtl/gttrm/gttrm.c +++ b/src/rtl/gttrm/gttrm.c @@ -11,10 +11,10 @@ * Now it support the following terminals: * linux, pc-ansi, xterm * - * Copyright 2007 Przemyslaw Czerpak <druzus /at/ priv.onet.pl> - * * I used my code from other GT drivers (GTCRS, GTPCA) * + * Copyright 2007 Przemyslaw Czerpak <druzus /at/ priv.onet.pl> + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -565,9 +565,9 @@ static void hb_gt_trm_termOut( PHB_GTTRM pTerm, const char * pStr, int iLen ) { if( pTerm->iOutBufSize ) { - int i; while( iLen > 0 ) { + int i; if( pTerm->iOutBufSize == pTerm->iOutBufIndex ) hb_gt_trm_termFlush( pTerm ); i = pTerm->iOutBufSize - pTerm->iOutBufIndex; @@ -710,10 +710,10 @@ static void del_efds( PHB_GTTRM pTerm, int fd ) static void del_all_efds( PHB_GTTRM pTerm ) { - int i; - if( pTerm->event_fds != NULL ) { + int i; + for( i = 0; i < pTerm->efds_no; i++ ) hb_xfree( pTerm->event_fds[ i ] ); @@ -1006,7 +1006,7 @@ static void mouse_init( PHB_GTTRM pTerm ) GPM_MOVE | GPM_DRAG | GPM_UP | GPM_DOWN | GPM_SINGLE | GPM_DOUBLE; /* give me move events but handle them anyway */ pTerm->Conn.defaultMask = GPM_MOVE | GPM_HARD; - /* report Ctrl,Alt,Shft events */ + /* report Ctrl,Alt,Shift events */ pTerm->Conn.minMod = 0; pTerm->Conn.maxMod = ( ( 1 << KG_SHIFT ) | ( 1 << KG_CTRL ) | ( 1 << KG_ALT ) ); gpm_zerobased = 1; @@ -1055,11 +1055,12 @@ static void mouse_exit( PHB_GTTRM pTerm ) static int read_bufch( PHB_GTTRM pTerm, int fd ) { - int n = 0, i; + int n = 0; if( STDIN_BUFLEN > pTerm->stdin_inbuf ) { unsigned char buf[ STDIN_BUFLEN ]; + int i; #if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) n = read( fd, buf, STDIN_BUFLEN - pTerm->stdin_inbuf ); @@ -1082,14 +1083,15 @@ static int read_bufch( PHB_GTTRM pTerm, int fd ) static int get_inch( PHB_GTTRM pTerm, HB_MAXINT timeout ) { int nRet = 0, nNext = 0, npfd = -1, nchk = pTerm->efds_no, lRead = 0; - int mode, i, n, counter; + int mode, i, n; evtFD * pefd = NULL; - HB_MAXUINT timer; - timer = hb_timerInit( timeout ); + HB_MAXUINT timer = hb_timerInit( timeout ); do { + int counter; + for( i = n = 0; i < pTerm->efds_no; i++ ) { if( pTerm->event_fds[ i ]->status == EVTFDSTAT_RUN ) @@ -1429,7 +1431,7 @@ again: */ static void hb_gt_trm_LinuxSetTermMode( PHB_GTTRM pTerm, int iAM ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxSetTermMode(%p,%d)", pTerm, iAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxSetTermMode(%p,%d)", ( void * ) pTerm, iAM ) ); if( iAM != pTerm->iAM ) { @@ -1445,7 +1447,7 @@ static void hb_gt_trm_LinuxTone( PHB_GTTRM pTerm, double dFrequency, double dDur { char escseq[ 64 ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxTone(%p,%lf,%lf)", pTerm, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxTone(%p,%lf,%lf)", ( void * ) pTerm, dFrequency, dDuration ) ); if( pTerm->iACSC ) { @@ -1463,7 +1465,7 @@ static void hb_gt_trm_LinuxTone( PHB_GTTRM pTerm, double dFrequency, double dDur static void hb_gt_trm_LinuxSetCursorStyle( PHB_GTTRM pTerm, int iStyle ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxSetCursorStyle(%p,%d)", pTerm, iStyle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxSetCursorStyle(%p,%d)", ( void * ) pTerm, iStyle ) ); if( pTerm->iCursorStyle != iStyle ) { @@ -1504,7 +1506,7 @@ static void hb_gt_trm_LinuxSetCursorStyle( PHB_GTTRM pTerm, int iStyle ) static void hb_gt_trm_LinuxSetPalette( PHB_GTTRM pTerm, int iIndexFrom, int iIndexTo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxSetPalette(%p,%d,%d)", pTerm, iIndexFrom, iIndexTo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxSetPalette(%p,%d,%d)", ( void * ) pTerm, iIndexFrom, iIndexTo ) ); if( iIndexFrom < 0 ) iIndexFrom = 0; @@ -1541,7 +1543,7 @@ static void hb_gt_trm_LinuxSetPalette( PHB_GTTRM pTerm, int iIndexFrom, int iInd static void hb_gt_trm_LinuxResetPalette( PHB_GTTRM pTerm ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxResetPalette(%p)", pTerm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_LinuxResetPalette(%p)", ( void * ) pTerm ) ); hb_gt_trm_termOut( pTerm, "\033]R", 3 ); } @@ -1554,7 +1556,7 @@ static HB_BOOL hb_gt_trm_XtermSetMode( PHB_GTTRM pTerm, int * piRows, int * piCo int iHeight, iWidth; char escseq[ 64 ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_XtermSetMode(%p,%d,%d)", pTerm, *piRows, *piCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_XtermSetMode(%p,%d,%d)", ( void * ) pTerm, *piRows, *piCols ) ); HB_GTSELF_GETSIZE( pTerm->pGT, &iHeight, &iWidth ); hb_snprintf( escseq, sizeof( escseq ), "\033[8;%d;%dt", *piRows, *piCols ); @@ -1576,7 +1578,7 @@ static HB_BOOL hb_gt_trm_XtermSetMode( PHB_GTTRM pTerm, int * piRows, int * piCo static void hb_gt_trm_XtermSetAttributes( PHB_GTTRM pTerm, int iAttr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_XtermSetAttributes(%p,%d)", pTerm, iAttr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_XtermSetAttributes(%p,%d)", ( void * ) pTerm, iAttr ) ); if( pTerm->iCurrentSGR != iAttr ) { @@ -1592,8 +1594,8 @@ static void hb_gt_trm_XtermSetAttributes( PHB_GTTRM pTerm, int iAttr ) { bg = s_AnsiColors[ ( iAttr >> 4 ) & 0x07 ]; fg = s_AnsiColors[ iAttr & 0x07 ]; - bold = iAttr & 0x08 ? 1 : 0; - blink = iAttr & 0x80 ? 1 : 0; + bold = ( iAttr & 0x08 ) ? 1 : 0; + blink = ( iAttr & 0x80 ) ? 1 : 0; } else { @@ -1856,7 +1858,7 @@ static void hb_gt_trm_XtermSetAttributes( PHB_GTTRM pTerm, int iAttr ) static void hb_gt_trm_XtermSetTitle( PHB_GTTRM pTerm, const char * szTitle ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_XtermSetTitle(%p,%s)", pTerm, szTitle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_XtermSetTitle(%p,%s)", ( void * ) pTerm, szTitle ) ); hb_gt_trm_termOut( pTerm, "\033]0;", 4 ); if( szTitle ) @@ -1871,7 +1873,7 @@ static void hb_gt_trm_XtermSetTitle( PHB_GTTRM pTerm, const char * szTitle ) static HB_BOOL hb_gt_trm_BsdGetCursorPos( PHB_GTTRM pTerm, int * iRow, int * iCol, const char * szPost ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_BsdGetCursorPos(%p,%p,%p,%s)", pTerm, iRow, iCol, szPost ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_BsdGetCursorPos(%p,%p,%p,%s)", ( void * ) pTerm, ( void * ) iRow, ( void * ) iCol, szPost ) ); HB_SYMBOL_UNUSED( szPost ); @@ -1886,7 +1888,7 @@ static HB_BOOL hb_gt_trm_BsdGetCursorPos( PHB_GTTRM pTerm, int * iRow, int * iCo static void hb_gt_trm_BsdSetCursorStyle( PHB_GTTRM pTerm, int iStyle ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_BsdSetCursorStyle(%p,%d)", pTerm, iStyle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_BsdSetCursorStyle(%p,%d)", ( void * ) pTerm, iStyle ) ); if( pTerm->iCursorStyle != iStyle ) { @@ -1922,7 +1924,7 @@ static void hb_gt_trm_BsdTone( PHB_GTTRM pTerm, double dFrequency, double dDurat { char escseq[ 64 ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_BsdTone(%p,%lf,%lf)", pTerm, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_BsdTone(%p,%lf,%lf)", ( void * ) pTerm, dFrequency, dDuration ) ); hb_snprintf( escseq, sizeof( escseq ), "\033[=%d;%dB\007", ( int ) dFrequency, ( int ) ( dDuration * 10.0 / 18.2 ) ); @@ -1940,7 +1942,7 @@ static void hb_gt_trm_BsdTone( PHB_GTTRM pTerm, double dFrequency, double dDurat */ static void hb_gt_trm_AnsiSetTermMode( PHB_GTTRM pTerm, int iAM ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetTermMode(%p,%d)", pTerm, iAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetTermMode(%p,%d)", ( void * ) pTerm, iAM ) ); if( iAM != pTerm->iAM ) { @@ -1962,7 +1964,7 @@ static void hb_gt_trm_AnsiSetTermMode( PHB_GTTRM pTerm, int iAM ) static HB_BOOL hb_gt_trm_AnsiGetCursorPos( PHB_GTTRM pTerm, int * iRow, int * iCol, const char * szPost ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiGetCursorPos(%p,%p,%p,%s)", pTerm, iRow, iCol, szPost ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiGetCursorPos(%p,%p,%p,%s)", ( void * ) pTerm, ( void * ) iRow, ( void * ) iCol, szPost ) ); if( pTerm->fPosAnswer ) { @@ -1984,7 +1986,7 @@ static HB_BOOL hb_gt_trm_AnsiGetCursorPos( PHB_GTTRM pTerm, int * iRow, int * iC timer = hb_timerInit( timeout ); for( ;; ) { - /* loking for cursor position in "\033[%d;%dR" */ + /* looking for cursor position in "\033[%d;%dR" */ while( j < n && rdbuf[ j ] != '\033' ) ++j; if( n - j >= 6 ) @@ -2064,7 +2066,7 @@ static HB_BOOL hb_gt_trm_AnsiGetCursorPos( PHB_GTTRM pTerm, int * iRow, int * iC static void hb_gt_trm_AnsiSetCursorPos( PHB_GTTRM pTerm, int iRow, int iCol ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetCursorPos(%p,%d,%d)", pTerm, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetCursorPos(%p,%d,%d)", ( void * ) pTerm, iRow, iCol ) ); if( pTerm->iRow != iRow || pTerm->iCol != iCol ) { @@ -2078,7 +2080,7 @@ static void hb_gt_trm_AnsiSetCursorPos( PHB_GTTRM pTerm, int iRow, int iCol ) static void hb_gt_trm_AnsiSetCursorStyle( PHB_GTTRM pTerm, int iStyle ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetCursorStyle(%p,%d)", pTerm, iStyle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetCursorStyle(%p,%d)", ( void * ) pTerm, iStyle ) ); if( pTerm->iCursorStyle != iStyle ) { @@ -2090,7 +2092,7 @@ static void hb_gt_trm_AnsiSetCursorStyle( PHB_GTTRM pTerm, int iStyle ) static void hb_gt_trm_AnsiSetAttributes( PHB_GTTRM pTerm, int iAttr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetAttributes(%p,%d)", pTerm, iAttr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetAttributes(%p,%d)", ( void * ) pTerm, iAttr ) ); if( pTerm->iCurrentSGR != iAttr ) { @@ -2101,11 +2103,11 @@ static void hb_gt_trm_AnsiSetAttributes( PHB_GTTRM pTerm, int iAttr ) buff[ 0 ] = 0x1b; buff[ 1 ] = '['; - acsc = iAttr & HB_GTTRM_ATTR_ACSC ? 1 : 0; + acsc = ( iAttr & HB_GTTRM_ATTR_ACSC ) ? 1 : 0; bg = s_AnsiColors[ ( iAttr >> 4 ) & 0x07 ]; fg = s_AnsiColors[ iAttr & 0x07 ]; - bold = iAttr & 0x08 ? 1 : 0; - blink = iAttr & 0x80 ? 1 : 0; + bold = ( iAttr & 0x08 ) ? 1 : 0; + blink = ( iAttr & 0x80 ) ? 1 : 0; if( pTerm->iCurrentSGR == -1 ) { @@ -2193,7 +2195,7 @@ static int hb_gt_trm_AnsiGetAcsc( PHB_GTTRM pTerm, unsigned char c ) { const unsigned char * ptr; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiGetAcsc(%p,%d)", pTerm, c ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiGetAcsc(%p,%d)", ( void * ) pTerm, c ) ); for( ptr = ( const unsigned char * ) pTerm->szAcsc; *ptr && *( ptr + 1 ); ptr += 2 ) { @@ -2223,7 +2225,7 @@ static int hb_gt_trm_AnsiGetAcsc( PHB_GTTRM pTerm, unsigned char c ) static HB_BOOL hb_gt_trm_AnsiSetMode( PHB_GTTRM pTerm, int * piRows, int * piCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetMode(%p,%d,%d)", pTerm, *piRows, *piCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiSetMode(%p,%d,%d)", ( void * ) pTerm, *piRows, *piCols ) ); if( pTerm->terminal_ext & TERM_PUTTY ) return hb_gt_trm_XtermSetMode( pTerm, piRows, piCols ); @@ -2233,7 +2235,7 @@ static HB_BOOL hb_gt_trm_AnsiSetMode( PHB_GTTRM pTerm, int * piRows, int * piCol static void hb_gt_trm_AnsiBell( PHB_GTTRM pTerm ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiBell(%p)", pTerm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiBell(%p)", ( void * ) pTerm ) ); hb_gt_trm_termOut( pTerm, s_szBell, 1 ); hb_gt_trm_termFlush( pTerm ); @@ -2243,7 +2245,7 @@ static void hb_gt_trm_AnsiTone( PHB_GTTRM pTerm, double dFrequency, double dDura { double dCurrentSeconds; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiTone(%p,%lf,%lf)", pTerm, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiTone(%p,%lf,%lf)", ( void * ) pTerm, dFrequency, dDuration ) ); /* Output an ASCII BEL character to cause a sound */ /* but throttle to max once per second, in case of sound */ @@ -2266,7 +2268,7 @@ static void hb_gt_trm_AnsiTone( PHB_GTTRM pTerm, double dFrequency, double dDura static void hb_gt_trm_AnsiInit( PHB_GTTRM pTerm ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiInit(%p)", pTerm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiInit(%p)", ( void * ) pTerm ) ); pTerm->iCurrentSGR = pTerm->iRow = pTerm->iCol = pTerm->iCursorStyle = pTerm->iACSC = pTerm->iAM = -1; @@ -2274,7 +2276,7 @@ static void hb_gt_trm_AnsiInit( PHB_GTTRM pTerm ) static void hb_gt_trm_AnsiExit( PHB_GTTRM pTerm ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiExit(%p)", pTerm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_AnsiExit(%p)", ( void * ) pTerm ) ); /* set default color */ pTerm->SetAttributes( pTerm, 0x07 & pTerm->iAttrMask ); @@ -2354,7 +2356,7 @@ static HB_BOOL hb_trm_isUTF8( PHB_GTTRM pTerm ) static void hb_gt_trm_PutStr( PHB_GTTRM pTerm, int iRow, int iCol, int iAttr, const char * pStr, int iLen, int iChars ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_PutStr(%p,%d,%d,%d,%p,%d,%d)", pTerm, iRow, iCol, iAttr, pStr, iLen, iChars ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_PutStr(%p,%d,%d,%d,%p,%d,%d)", ( void * ) pTerm, iRow, iCol, iAttr, ( const void * ) pStr, iLen, iChars ) ); if( pTerm->iOutBufSize ) { @@ -2372,7 +2374,7 @@ static void hb_gt_trm_PutStr( PHB_GTTRM pTerm, int iRow, int iCol, int iAttr, co static void hb_gt_trm_SetPalette( PHB_GTTRM pTerm, int iIndexFrom, int iIndexTo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetPalette(%p,%d,%d)", pTerm, iIndexFrom, iIndexTo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetPalette(%p,%d,%d)", ( void * ) pTerm, iIndexFrom, iIndexTo ) ); if( pTerm->terminal_type == TERM_LINUX || ( pTerm->terminal_ext & TERM_PUTTY ) ) @@ -2383,7 +2385,7 @@ static void hb_gt_trm_SetPalette( PHB_GTTRM pTerm, int iIndexFrom, int iIndexTo static void hb_gt_trm_ResetPalette( PHB_GTTRM pTerm ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_ResetPalette(%p)", pTerm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_ResetPalette(%p)", ( void * ) pTerm ) ); if( pTerm->terminal_type == TERM_LINUX || ( pTerm->terminal_ext & TERM_PUTTY ) ) @@ -2394,7 +2396,7 @@ static void hb_gt_trm_ResetPalette( PHB_GTTRM pTerm ) static void hb_gt_trm_SetTitle( PHB_GTTRM pTerm, const char * szTitle ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetTitle(%p,%s)", pTerm, szTitle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetTitle(%p,%s)", ( void * ) pTerm, szTitle ) ); if( pTerm->terminal_type == TERM_XTERM || ( pTerm->terminal_ext & TERM_PUTTY ) ) @@ -2410,7 +2412,7 @@ static void hb_gt_trm_SetKeyTrans( PHB_GTTRM pTerm ) cdpHost = HB_GTSELF_HOSTCP( pTerm->pGT ); int i; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetKeyTrans(%p,%p,%p)", pTerm, cdpTerm, cdpHost ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetKeyTrans(%p,%p,%p)", ( void * ) pTerm, ( void * ) cdpTerm, ( void * ) cdpHost ) ); for( i = 0; i < 256; ++i ) pTerm->keyTransTbl[ i ] = ( unsigned char ) @@ -2422,15 +2424,15 @@ static void hb_gt_trm_SetDispTrans( PHB_GTTRM pTerm, int box ) { PHB_CODEPAGE cdpTerm = HB_GTSELF_TERMCP( pTerm->pGT ), cdpHost = HB_GTSELF_HOSTCP( pTerm->pGT ); - int i, ch, mode; + int i; memset( pTerm->chrattr, 0, sizeof( pTerm->chrattr ) ); memset( pTerm->boxattr, 0, sizeof( pTerm->boxattr ) ); for( i = 0; i < 256; i++ ) { - ch = pTerm->charmap[ i ] & 0xffff; - mode = ! pTerm->fUTF8 ? ( pTerm->charmap[ i ] >> 16 ) & 0xff : 1; + int ch = pTerm->charmap[ i ] & 0xffff; + int mode = ! pTerm->fUTF8 ? ( pTerm->charmap[ i ] >> 16 ) & 0xff : 1; switch( mode ) { @@ -3144,7 +3146,7 @@ static void hb_gt_trm_SetTerm( PHB_GTTRM pTerm ) const char * szTerm; int iValue; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetTerm(%p)", pTerm ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetTerm(%p)", ( void * ) pTerm ) ); if( pTerm->iOutBufSize == 0 ) { @@ -3324,7 +3326,7 @@ static void hb_gt_trm_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil int iRows = 24, iCols = 80; PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); HB_GTLOCAL( pGT ) = pTerm = ( PHB_GTTRM ) hb_xgrabz( sizeof( HB_GTTRM ) ); @@ -3372,7 +3374,7 @@ static void hb_gt_trm_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil memset( pTerm->curr_TIO.c_cc, 0, NCCS ); /* workaround for bug in some Linux kernels (i.e. 3.13.0-64-generic - Ubuntu) in which select() unconditionally accepts stdin for + *buntu) in which select() unconditionally accepts stdin for reading if c_cc[ VMIN ] = 0 [druzus] */ pTerm->curr_TIO.c_cc[ VMIN ] = 1; /* pTerm->curr_TIO.c_cc[ VMIN ] = 0; */ @@ -3424,7 +3426,7 @@ static void hb_gt_trm_Exit( PHB_GT pGT ) { PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Exit(%p)", ( void * ) pGT ) ); HB_GTSELF_REFRESH( pGT ); @@ -3461,7 +3463,7 @@ static void hb_gt_trm_Exit( PHB_GT pGT ) static HB_BOOL hb_gt_trm_mouse_IsPresent( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_IsPresent(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_IsPresent(%p)", ( void * ) pGT ) ); return HB_GTTRM_GET( pGT )->mouse_type != MOUSE_NONE; } @@ -3470,7 +3472,7 @@ static void hb_gt_trm_mouse_Show( PHB_GT pGT ) { PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_Show(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_Show(%p)", ( void * ) pGT ) ); pTerm = HB_GTTRM_GET( pGT ); #if defined( HB_HAS_GPM ) @@ -3482,7 +3484,7 @@ static void hb_gt_trm_mouse_Show( PHB_GT pGT ) static void hb_gt_trm_mouse_Hide( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_Hide(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_Hide(%p)", ( void * ) pGT ) ); #if defined( HB_HAS_GPM ) if( HB_GTTRM_GET( pGT )->mouse_type & MOUSE_GPM ) @@ -3498,7 +3500,7 @@ static void hb_gt_trm_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) { PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_Col(%p,%p,%p)", pGT, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_Col(%p,%p,%p)", ( void * ) pGT, ( void * ) piRow, ( void * ) piCol ) ); pTerm = HB_GTTRM_GET( pGT ); *piRow = pTerm->mLastEvt.row; @@ -3509,7 +3511,7 @@ static void hb_gt_trm_mouse_SetPos( PHB_GT pGT, int iRow, int iCol ) { PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_SetPos(%p,%i,%i)", pGT, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_SetPos(%p,%i,%i)", ( void * ) pGT, iRow, iCol ) ); pTerm = HB_GTTRM_GET( pGT ); /* it does really nothing */ @@ -3523,7 +3525,7 @@ static HB_BOOL hb_gt_trm_mouse_ButtonState( PHB_GT pGT, int iButton ) PHB_GTTRM pTerm; HB_BOOL ret = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_ButtonState(%p,%i)", pGT, iButton ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_ButtonState(%p,%i)", ( void * ) pGT, iButton ) ); pTerm = HB_GTTRM_GET( pGT ); if( pTerm->mouse_type != MOUSE_NONE ) @@ -3547,7 +3549,7 @@ static HB_BOOL hb_gt_trm_mouse_ButtonState( PHB_GT pGT, int iButton ) static int hb_gt_trm_mouse_CountButton( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_CountButton(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_mouse_CountButton(%p)", ( void * ) pGT ) ); return HB_GTTRM_GET( pGT )->mButtons; } @@ -3556,7 +3558,7 @@ static int hb_gt_trm_ReadKey( PHB_GT pGT, int iEventMask ) { int iKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( iEventMask ); @@ -3582,7 +3584,7 @@ static void hb_gt_trm_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); pTerm = HB_GTTRM_GET( pGT ); pTerm->Tone( pTerm, dFrequency, dDuration ); @@ -3592,7 +3594,7 @@ static void hb_gt_trm_Bell( PHB_GT pGT ) { PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Bell(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Bell(%p)", ( void * ) pGT ) ); pTerm = HB_GTTRM_GET( pGT ); pTerm->Bell( pTerm ); @@ -3600,7 +3602,7 @@ static void hb_gt_trm_Bell( PHB_GT pGT ) static const char * hb_gt_trm_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -3614,7 +3616,7 @@ static HB_BOOL hb_gt_trm_Suspend( PHB_GT pGT ) { PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Suspend(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Suspend(%p)", ( void * ) pGT ) ); pTerm = HB_GTTRM_GET( pGT ); if( pTerm->mouse_type & MOUSE_XTERM ) @@ -3633,7 +3635,7 @@ static HB_BOOL hb_gt_trm_Resume( PHB_GT pGT ) PHB_GTTRM pTerm; int iHeight, iWidth; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Resume(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Resume(%p)", ( void * ) pGT ) ); pTerm = HB_GTTRM_GET( pGT ); #if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) @@ -3656,7 +3658,7 @@ static HB_BOOL hb_gt_trm_Resume( PHB_GT pGT ) static void hb_gt_trm_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, int iColor, HB_USHORT usChar, int iRows, int iCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Scroll(%p,%d,%d,%d,%d,%d,%d,%d,%d)", pGT, iTop, iLeft, iBottom, iRight, iColor, usChar, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Scroll(%p,%d,%d,%d,%d,%d,%d,%d,%d)", ( void * ) pGT, iTop, iLeft, iBottom, iRight, iColor, usChar, iRows, iCols ) ); /* Provide some basic scroll support for full screen */ if( iCols == 0 && iRows > 0 && iTop == 0 && iLeft == 0 ) @@ -3689,7 +3691,7 @@ static void hb_gt_trm_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int static HB_BOOL hb_gt_trm_SetMode( PHB_GT pGT, int iRows, int iCols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetMode(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetMode(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); if( iRows > 0 && iCols > 0 ) { @@ -3707,7 +3709,7 @@ static void hb_gt_trm_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) { PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetBlink(%p,%d)", pGT, ( int ) fBlink ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetBlink(%p,%d)", ( void * ) pGT, ( int ) fBlink ) ); pTerm = HB_GTTRM_GET( pGT ); @@ -3738,7 +3740,7 @@ static void hb_gt_trm_SetBlink( PHB_GT pGT, HB_BOOL fBlink ) static HB_BOOL hb_gt_trm_SetDispCP( PHB_GT pGT, const char * pszTermCDP, const char * pszHostCDP, HB_BOOL fBox ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetDispCP(%p,%s,%s,%d)", pGT, pszTermCDP, pszHostCDP, ( int ) fBox ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetDispCP(%p,%s,%s,%d)", ( void * ) pGT, pszTermCDP, pszHostCDP, ( int ) fBox ) ); if( HB_GTSUPER_SETDISPCP( pGT, pszTermCDP, pszHostCDP, fBox ) ) { @@ -3752,7 +3754,7 @@ static HB_BOOL hb_gt_trm_SetDispCP( PHB_GT pGT, const char * pszTermCDP, const c #ifndef HB_GT_UNICODE_BUF static HB_BOOL hb_gt_trm_SetKeyCP( PHB_GT pGT, const char * pszTermCDP, const char * pszHostCDP ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetKeyCP(%p,%s,%s)", pGT, pszTermCDP, pszHostCDP ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetKeyCP(%p,%s,%s)", ( void * ) pGT, pszTermCDP, pszHostCDP ) ); if( HB_GTSUPER_SETKEYCP( pGT, pszTermCDP, pszHostCDP ) ) { @@ -3771,7 +3773,7 @@ static void hb_gt_trm_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) HB_USHORT usChar; int iLen, iChars, iAttribute, iColor; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); iLen = iChars = iAttribute = 0; pTerm = HB_GTTRM_GET( pGT ); @@ -3863,7 +3865,7 @@ static void hb_gt_trm_Refresh( PHB_GT pGT ) HB_SIZE nLineBufSize; PHB_GTTRM pTerm; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Refresh(%p)", ( void * ) pGT ) ); pTerm = HB_GTTRM_GET( pGT ); @@ -3903,7 +3905,7 @@ static HB_BOOL hb_gt_trm_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) void * hVal; int iVal; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); pTerm = HB_GTTRM_GET( pGT ); switch( iType ) @@ -4031,7 +4033,7 @@ static HB_BOOL hb_gt_trm_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_trm_Init; pFuncTable->Exit = hb_gt_trm_Exit; diff --git a/src/rtl/gtwin/gtwin.c b/src/rtl/gtwin/gtwin.c index 8647cc859a..c5edfa4f43 100644 --- a/src/rtl/gtwin/gtwin.c +++ b/src/rtl/gtwin/gtwin.c @@ -10,8 +10,6 @@ * Copyright 1999-2000 Paul Tucker <ptucker@sympatico.ca> * (with 2004 work on Readkey) * - * The following parts are Copyright of the individual authors. - * * Copyright 1999-2010 Viktor Szakats (vszakats.net/harbour) * hb_gt_win_CtrlHandler() * hb_gt_win_SetCloseButton() @@ -21,8 +19,6 @@ * hb_gt_Tone() * hb_gt_ReadKey() * - * See COPYING.txt for licensing terms. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -30,13 +26,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -54,7 +50,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -426,7 +422,7 @@ static void hb_gt_win_xGetScreenContents( PHB_GT pGT, SMALL_RECT * psrWin ) HB_BYTE bxAttr; #endif - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_xGetScreenContents(%p,%p)", pGT, psrWin ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_xGetScreenContents(%p,%p)", ( void * ) pGT, ( void * ) psrWin ) ); #if ! defined( UNICODE ) bxAttr = 0; @@ -466,7 +462,7 @@ static void hb_gt_win_xGetScreenContents( PHB_GT pGT, SMALL_RECT * psrWin ) static void hb_gt_win_xInitScreenParam( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_xInitScreenParam(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_xInitScreenParam(%p)", ( void * ) pGT ) ); if( GetConsoleScreenBufferInfo( s_HOutput, &s_csbi ) ) { @@ -492,7 +488,7 @@ static void hb_gt_win_xInitScreenParam( PHB_GT pGT ) s_iUpdtBottom = s_iUpdtRight = 0; /* - * Unfortunatelly Windows refuse to read to big area :-( + * Unfortunately Windows refuse to read to big area :-( * (I do not know why) so we cannot read the whole console * buffer { 0, 0, s_csbi.dwSize.Y - 1, s_csbi.dwSize.X - 1 } * because it reads nothing, [druzus] @@ -729,7 +725,7 @@ static HB_BOOL hb_gt_win_SetCloseButton( HB_BOOL bSet, HB_BOOL bClosable ) static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); s_fWin9x = hb_iswin9x(); @@ -753,8 +749,8 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil * This is a hack for MSYS console. It does not support full screen output * so nothing can be seen on the screen and we have to close the MSYS * console to be able to allocate the MS-Windows one. - * Unfortunatelly I do not know any method to detect the MSYS console - * so I used this hack with checking OSTYPE environemnt variable. [druzus] + * Unfortunately I do not know any method to detect the MSYS console + * so I used this hack with checking OSTYPE environment variable. [druzus] */ { TCHAR lpOsType[ 16 ]; @@ -785,7 +781,7 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil } #endif if( s_HInput == INVALID_HANDLE_VALUE ) - hb_errInternal( 10001, "Can't allocate console", NULL, NULL ); + hb_errInternal( 10001, "Could not allocate console", NULL, NULL ); } /* Add Ctrl+Break handler [vszakats] */ @@ -801,7 +797,7 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil 0, 0 ); if( s_HOutput == INVALID_HANDLE_VALUE ) - hb_errInternal( 10001, "Can't allocate console (output)", NULL, NULL ); + hb_errInternal( 10001, "Could not allocate console (output)", NULL, NULL ); s_HInput = CreateFile( TEXT( "CONIN$" ), /* filename */ GENERIC_READ | GENERIC_WRITE, /* Access flag */ @@ -811,7 +807,7 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil 0, 0 ); if( s_HInput == INVALID_HANDLE_VALUE ) - hb_errInternal( 10001, "Can't allocate console (input)", NULL, NULL ); + hb_errInternal( 10001, "Could not allocate console (input)", NULL, NULL ); GetConsoleScreenBufferInfo( s_HOutput, &s_csbi ); @@ -847,7 +843,7 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil static void hb_gt_win_Exit( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Exit(%p)", ( void * ) pGT ) ); HB_GTSELF_REFRESH( pGT ); @@ -886,7 +882,7 @@ static HB_BOOL hb_gt_win_SetMode( PHB_GT pGT, int iRows, int iCols ) { HB_BOOL fRet = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_SetMode(%p,%d,%d)", pGT, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_SetMode(%p,%d,%d)", ( void * ) pGT, iRows, iCols ) ); if( s_HOutput != INVALID_HANDLE_VALUE && iRows > 0 && iCols > 0 ) { @@ -981,7 +977,7 @@ static HB_BOOL hb_gt_win_SetMode( PHB_GT pGT, int iRows, int iCols ) static const char * hb_gt_win_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -995,7 +991,7 @@ static const char * hb_gt_win_Version( PHB_GT pGT, int iType ) static HB_BOOL hb_gt_win_PostExt( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_PostExt(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_PostExt(%p)", ( void * ) pGT ) ); HB_GTSUPER_POSTEXT( pGT ); if( s_pCharInfoScreen ) @@ -1007,7 +1003,7 @@ static HB_BOOL hb_gt_win_PostExt( PHB_GT pGT ) static HB_BOOL hb_gt_win_Suspend( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Suspend(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Suspend(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1022,7 +1018,7 @@ static HB_BOOL hb_gt_win_Suspend( PHB_GT pGT ) static HB_BOOL hb_gt_win_Resume( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Resume(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Resume(%p)", ( void * ) pGT ) ); if( s_pCharInfoScreen ) { @@ -1181,7 +1177,7 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) { int iKey = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( iEventMask ); @@ -1204,7 +1200,7 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) { #if defined( UNICODE ) /* Workaround for UNICOWS bug: - http://blogs.msdn.com/michkap/archive/2007/01/13/1460724.aspx + https://web.archive.org/web/blogs.msdn.com/michkap/archive/2007/01/13/1460724.aspx [vszakats] */ if( s_fWin9x ) @@ -1217,10 +1213,10 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) #endif /* Read keyboard input */ - ReadConsoleInput( s_HInput, /* input buffer handle */ - s_irBuffer, /* buffer to read into */ - INPUT_BUFFER_LEN, /* size of read buffer */ - &s_dwNumRead ); /* number of records read */ + ReadConsoleInput( s_HInput, /* input buffer handle */ + s_irBuffer, /* buffer to read into */ + INPUT_BUFFER_LEN, /* size of read buffer */ + &s_dwNumRead ); /* number of records read */ /* Set up to process the first input event */ s_dwNumIndex = 0; @@ -1347,10 +1343,10 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) #endif /* - * Under Win9x, Upper row keys are affected by caps-lock + * Under Win9x, upper row keys are affected by caps-lock * and should not be. There are 2 solutions - the first * is to enable the calling of SpecialHandling below - which - * will only be activated under Win9x (Preferrably under user + * will only be activated under Win9x (Preferably under user * control, since they know if their keyboard isn't working), or * just enable KeyB handling in config.sys, and do not enable the * following call. @@ -1359,7 +1355,7 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) * (With some clarification by Paul Tucker) * If making this fix the default under Win98, then it doesn't * work for non-US keyboards. (The default has now been changed) - * I tried to replicate the problem under Win98SE (spanish), + * I tried to replicate the problem under Win98SE (Spanish), * but it works fine. I hope someone could tell me how the * problem appears, for try to fix it. @@ -1733,7 +1729,7 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) { int iFlags = hb_gt_win_keyFlags( pInRec->Event.MouseEvent.dwControlKeyState ); - /* mouse wheel events use screen based mouse possition */ + /* mouse wheel events use screen based mouse position */ if( pInRec->Event.MouseEvent.dwEventFlags == MOUSE_HWHEELED ) { /* unsupported */ @@ -1809,7 +1805,7 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) /* dDuration is in 'Ticks' (18.2 per second) */ static void hb_gt_win_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1870,7 +1866,7 @@ static HB_BOOL hb_gt_win_FullScreen( HB_BOOL bFullScreen ) static HB_BOOL hb_gt_win_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Info(%p,%d,%p)", ( void * ) pGT, iType, pInfo ) ); switch( iType ) { @@ -2153,7 +2149,7 @@ static int hb_gt_win_mouse_CountButton( PHB_GT pGT ) static void hb_gt_win_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); if( iSize > 0 && s_pCharInfoScreen && iRow < ( int ) _GetScreenHeight() && iCol < ( int ) _GetScreenWidth() ) @@ -2188,7 +2184,7 @@ static void hb_gt_win_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) static void hb_gt_win_Refresh( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); if( s_pCharInfoScreen ) @@ -2215,7 +2211,7 @@ static void hb_gt_win_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_win_Init; pFuncTable->Exit = hb_gt_win_Exit; diff --git a/src/rtl/gtwvt/gtwvt.c b/src/rtl/gtwvt/gtwvt.c index 97a1f24ea7..65a5bb7681 100644 --- a/src/rtl/gtwvt/gtwvt.c +++ b/src/rtl/gtwvt/gtwvt.c @@ -1,5 +1,5 @@ /* - * Video subsystem for Windows using GUI windows instead of Console + * Video subsystem for Windows using GDI windows instead of Console * Copyright 2003 Peter Rees <peter@rees.co.nz> * Rees Software & Systems Ltd * based on @@ -13,28 +13,31 @@ * Copyright 2006 Przemyslaw Czerpak <druzus /at/ priv.onet.pl> * Adopted to new GT API * - * The following parts are Copyright of the individual authors. - * - * * Copyright 1999 David G. Holm <dholm@jsd-llc.com> * hb_gt_Tone() * - * See COPYING.txt for licensing terms. + * Copyright 2003-2004 Giancarlo Niccolai <gc@niccolai.ws> + * Standard xplatform GT Info system, + * Graphical object system and event system. + * hb_gtInfo() And GTO_* implementation. + * + * Copyright 2004 Mauricio Abre <maurifull@datafull.com> + * Cross-GT, multi-platform Graphics API * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option ) + * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/ ). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -52,7 +55,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -62,18 +65,6 @@ * */ -/* - * Individual authors: - * (C) 2003-2004 Giancarlo Niccolai <gc at niccolai dot ws> - * Standard xplatform GT Info system, - * Graphical object system and event system. - * hb_gtInfo() And GTO_* implementation. - * - * (C) 2004 Mauricio Abre <maurifull@datafull.com> - * Cross-GT, multiplatform Graphics API - * - */ - #include "gtwvt.h" #ifndef WS_EX_COMPOSITED @@ -324,7 +315,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) pWVT->COLORS[ 14 ] = YELLOW; pWVT->COLORS[ 15 ] = WHITE; - /* THESE are the default font parameters, if not changed by user */ + /* These are the default font parameters, if not changed by user */ pWVT->PTEXTSIZE.x = WVT_DEFAULT_FONT_WIDTH; pWVT->PTEXTSIZE.y = WVT_DEFAULT_FONT_HEIGHT; pWVT->fontWidth = WVT_DEFAULT_FONT_WIDTH; @@ -489,7 +480,7 @@ static HBITMAP hb_gt_wvt_DefineBoxChar( PHB_GTWVT pWVT, HB_USHORT usCh ) HBITMAP hBitMap = NULL; int cellx = pWVT->PTEXTSIZE.x; int celly = pWVT->PTEXTSIZE.y; - int i, y, x, yy, xx, skip, start, mod; + int i, y, x, yy, xx; POINT pts[ 3 ]; RECT rc; @@ -937,6 +928,9 @@ static HBITMAP hb_gt_wvt_DefineBoxChar( PHB_GTWVT pWVT, HB_USHORT usCh ) case HB_BOXCH_FILLER1: case HB_BOXCH_FILLER2: case HB_BOXCH_FILLER3: + { + int skip, start, mod; + hBitMap = hb_gt_wvt_bitmap_char( pWVT, cellx, celly ); if( usCh == HB_BOXCH_FILLER1 ) @@ -963,7 +957,7 @@ static HBITMAP hb_gt_wvt_DefineBoxChar( PHB_GTWVT pWVT, HB_USHORT usCh ) if( usCh == HB_BOXCH_FILLER3 ) hb_bm_invertrect( 0, 0, cellx, celly ); break; - + } case HB_BOXCH_ARROW_R: hBitMap = hb_gt_wvt_bitmap_char( pWVT, cellx, celly ); @@ -1708,10 +1702,6 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) int borderHeight; int left; int top; - int i = 0; - int j = 0; - int iCalcWidth = 0; - int iCalcHeight = 0; HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_FitSize()" ) ); @@ -1740,6 +1730,11 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) int fontWidth; int n; + int i = 0; + int j = 0; + int iCalcWidth = 0; + int iCalcHeight = 0; + fontHeight = maxHeight / pWVT->ROWS; fontWidth = maxWidth / pWVT->COLS; @@ -1830,7 +1825,7 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) else { /* I did it this way, so that "Courier New" would size and maximize as expected. - * "Courier New" appears to not scale linearily, sometimes by just decreasing the + * "Courier New" appears to not scale linearly, sometimes by just decreasing the * font width by one with some font heights makes it all work out? * This code never seems to get executed with "Lucida Console" * Width scaling with some Heights is an issue with Courier New and Terminal @@ -1889,7 +1884,7 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT, HFONT hFont ) TEXTMETRIC tm; int n; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ResetWindowSize(%p,%p)", pWVT, hFont ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ResetWindowSize(%p,%p)", ( void * ) pWVT, ( void * ) hFont ) ); if( ! pWVT->hFont || hFont ) { @@ -2053,8 +2048,8 @@ static HB_BOOL hb_gt_wvt_SetWindowSize( PHB_GTWVT pWVT, int iRows, int iCols ) pWVT->COLS = iCols; return HB_TRUE; } - - return HB_FALSE; + else + return HB_FALSE; } static HB_BOOL hb_gt_wvt_InitWindow( PHB_GTWVT pWVT, int iRow, int iCol, HFONT hFont ) @@ -2125,7 +2120,8 @@ static HB_BOOL hb_gt_wvt_SetMousePos( PHB_GTWVT pWVT, int iRow, int iCol ) pWVT->MousePos.x = iCol; return HB_TRUE; } - return HB_FALSE; + else + return HB_FALSE; } static int hb_gt_wvt_GetKeyFlags( void ) @@ -2280,7 +2276,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L #if defined( UNICODE ) usChar = hb_cdpGetU16Ctrl( usChar ); #else - usChar = hb_cdpGetUC( bAttr & HB_GT_ATTR_BOX ? cdpBox : cdpHost, usChar, '?' ); + usChar = hb_cdpGetUC( ( bAttr & HB_GT_ATTR_BOX ) ? cdpBox : cdpHost, usChar, '?' ); #endif sBuffer[ n++ ] = ( TCHAR ) usChar; } @@ -2615,7 +2611,7 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, { iKey = ( int ) wParam; - if( ( iFlags & HB_KF_CTRL ) != 0 && ( iKey >= 0 && iKey < 32 ) ) + if( ( iFlags & HB_KF_CTRL ) != 0 && iKey >= 0 && iKey < 32 ) { iKey += 'A' - 1; iKey = HB_INKEY_NEW_KEY( iKey, iFlags ); @@ -2777,7 +2773,7 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, } /* - * hb_gt_wvt_TextOut converts col and row to x and y ( pixels ) and calls + * Convert col and row to x and y ( pixels ) and calls * the Windows function TextOut with the expected coordinates */ static void hb_gt_wvt_TextOut( PHB_GTWVT pWVT, HDC hdc, int col, int row, int iColor, LPCTSTR lpString, UINT cbString ) @@ -2814,7 +2810,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT ) PAINTSTRUCT ps; HDC hdc; RECT rcRect; - int iRow, iCol, startCol, len; + int iRow; int iColor, iOldColor = 0; HB_BYTE bAttr; HB_BOOL fFixMetric = ( pWVT->fontAttribute & HB_GTI_FONTA_FIXMETRIC ) != 0; @@ -2893,6 +2889,8 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT ) for( iRow = rcRect.top; iRow <= rcRect.bottom; ++iRow ) { + int iCol, startCol, len; + iCol = startCol = rcRect.left; len = 0; @@ -3001,7 +2999,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara } } - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_WndProc(%p,%u)", hWnd, message ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_WndProc(%p,%u)", ( void * ) hWnd, message ) ); if( pWVT ) switch( message ) { @@ -3329,19 +3327,19 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT ) static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { - HANDLE hInstance; + HINSTANCE hInstance; int iCmdShow; PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); if( ! hb_winmainArgGet( &hInstance, NULL, &iCmdShow ) ) { - hInstance = GetModuleHandle( NULL ); + hInstance = ( HINSTANCE ) GetModuleHandle( NULL ); iCmdShow = 1; } - pWVT = hb_gt_wvt_New( pGT, ( HINSTANCE ) hInstance, iCmdShow ); + pWVT = hb_gt_wvt_New( pGT, hInstance, iCmdShow ); if( pWVT ) { HB_GTLOCAL( pGT ) = ( void * ) pWVT; @@ -3364,7 +3362,7 @@ static void hb_gt_wvt_Exit( PHB_GT pGT ) { PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Exit(%p)", ( void * ) pGT ) ); pWVT = HB_GTWVT_GET( pGT ); HB_GTSUPER_EXIT( pGT ); @@ -3380,7 +3378,7 @@ static HB_BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol ) PHB_GTWVT pWVT; HB_BOOL fResult = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_SetMode(%p,%d,%d)", pGT, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_SetMode(%p,%d,%d)", ( void * ) pGT, iRow, iCol ) ); pWVT = HB_GTWVT_GET( pGT ); @@ -3426,7 +3424,7 @@ static HB_BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol ) static const char * hb_gt_wvt_Version( PHB_GT pGT, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Version(%p,%d)", pGT, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Version(%p,%d)", ( void * ) pGT, iType ) ); HB_SYMBOL_UNUSED( pGT ); @@ -3444,7 +3442,7 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) int c = 0; HB_BOOL fKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( iEventMask ); /* we ignore the eventmask! */ @@ -3462,7 +3460,7 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) /* dDuration is in 'Ticks' (18.2 per second) */ static void hb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); @@ -3473,7 +3471,7 @@ static void hb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static HB_BOOL hb_gt_wvt_mouse_IsPresent( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_IsPresent(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_IsPresent(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -3484,7 +3482,7 @@ static void hb_gt_wvt_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) { PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_GetPos(%p,%p,%p)", pGT, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_GetPos(%p,%p,%p)", ( void * ) pGT, ( void * ) piRow, ( void * ) piCol ) ); pWVT = HB_GTWVT_GET( pGT ); *piRow = pWVT->MousePos.y; @@ -3493,14 +3491,14 @@ static void hb_gt_wvt_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) static void hb_gt_wvt_mouse_SetPos( PHB_GT pGT, int iRow, int iCol ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_SetPos(%p,%i,%i)", pGT, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_SetPos(%p,%i,%i)", ( void * ) pGT, iRow, iCol ) ); hb_gt_wvt_SetMousePos( HB_GTWVT_GET( pGT ), iRow, iCol ); } static HB_BOOL hb_gt_wvt_mouse_ButtonState( PHB_GT pGT, int iButton ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_ButtonState(%p,%i)", pGT, iButton ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_ButtonState(%p,%i)", ( void * ) pGT, iButton ) ); HB_SYMBOL_UNUSED( pGT ); @@ -3518,7 +3516,7 @@ static HB_BOOL hb_gt_wvt_mouse_ButtonState( PHB_GT pGT, int iButton ) static int hb_gt_wvt_mouse_CountButton( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_CountButton(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_mouse_CountButton(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -3532,7 +3530,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) PHB_GTWVT pWVT; int iVal; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); pWVT = HB_GTWVT_GET( pGT ); @@ -3977,7 +3975,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pWVT->hIconToFree = hIconToFree; pWVT->hIcon = hIcon; } - pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( HB_PTRUINT ) pWVT->hIcon ); + pInfo->pResult = hb_itemPutPtr( pInfo->pResult, ( void * ) ( HB_PTRUINT ) pWVT->hIcon ); break; } case HB_GTI_VIEWPORTWIDTH: @@ -4312,18 +4310,19 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) { PHB_GTWVT pWVT; - HDC hdc; - HPEN hPen, hOldPen; - HBRUSH hBrush, hOldBrush; RECT r; int iRet = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", ( void * ) pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) ); pWVT = HB_GTWVT_GET( pGT ); if( pWVT->hWnd ) { + HDC hdc; + HPEN hPen, hOldPen; + HBRUSH hBrush, hOldBrush; + if( pWVT->bComposited ) hb_gt_wvt_Composited( pWVT, HB_FALSE ); @@ -4446,7 +4445,7 @@ static void hb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); pWVT = HB_GTWVT_GET( pGT ); if( pWVT ) @@ -4474,7 +4473,7 @@ static void hb_gt_wvt_Refresh( PHB_GT pGT ) { PHB_GTWVT pWVT; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Refresh(%p)", ( void * ) pGT ) ); HB_GTSUPER_REFRESH( pGT ); @@ -4496,7 +4495,7 @@ static void hb_gt_wvt_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_wvt_Init; pFuncTable->Exit = hb_gt_wvt_Exit; diff --git a/src/rtl/gtwvt/gtwvt.h b/src/rtl/gtwvt/gtwvt.h index e1cc395659..5732ff51ca 100644 --- a/src/rtl/gtwvt/gtwvt.h +++ b/src/rtl/gtwvt/gtwvt.h @@ -67,9 +67,8 @@ #include "hbwince.h" #endif -#define WVT_CHAR_QUEUE_SIZE 128 -#define WVT_MAX_TITLE_SIZE 128 -#define WVT_MAX_WINDOWS 256 +#define WVT_MAX_WINDOWS 256 + #if defined( HB_OS_WIN_CE ) # define WVT_DEFAULT_ROWS 15 # define WVT_DEFAULT_COLS 50 @@ -81,29 +80,30 @@ # define WVT_DEFAULT_FONT_HEIGHT 20 # define WVT_DEFAULT_FONT_WIDTH 10 #endif -#define WVT_DEFAULT_FONT_ATTR 0 -#define WVT_DEFAULT_FONT_NAME TEXT( "Courier New" ) -#define WVT_EXTKEY_FLAG ( 1 << 24 ) +#define WVT_DEFAULT_FONT_ATTR 0 +#define WVT_DEFAULT_FONT_NAME TEXT( "Courier New" ) -#define BLACK RGB( 0x00, 0x00, 0x00 ) -#define BLUE RGB( 0x00, 0x00, 0xAA ) -#define GREEN RGB( 0x00, 0xAA, 0x00 ) -#define CYAN RGB( 0x00, 0xAA, 0xAA ) -#define RED RGB( 0xAA, 0x00, 0x00 ) -#define MAGENTA RGB( 0xAA, 0x00, 0xAA ) -#define BROWN RGB( 0xAA, 0x55, 0x00 ) -#define LIGHT_GRAY RGB( 0xAA, 0xAA, 0xAA ) -#define GRAY RGB( 0x55, 0x55, 0x55 ) -#define BRIGHT_BLUE RGB( 0x55, 0x55, 0xFF ) -#define BRIGHT_GREEN RGB( 0x55, 0xFF, 0x55 ) -#define BRIGHT_CYAN RGB( 0x55, 0xFF, 0xFF ) -#define BRIGHT_RED RGB( 0xFF, 0x55, 0x55 ) -#define BRIGHT_MAGENTA RGB( 0xFF, 0x55, 0xFF ) -#define YELLOW RGB( 0xFF, 0xFF, 0x55 ) -#define WHITE RGB( 0xFF, 0xFF, 0xFF ) +#define WVT_EXTKEY_FLAG ( 1 << 24 ) -#define WM_MY_UPDATE_CARET ( WM_USER + 0x0101 ) +#define BLACK RGB( 0x00, 0x00, 0x00 ) +#define BLUE RGB( 0x00, 0x00, 0xAA ) +#define GREEN RGB( 0x00, 0xAA, 0x00 ) +#define CYAN RGB( 0x00, 0xAA, 0xAA ) +#define RED RGB( 0xAA, 0x00, 0x00 ) +#define MAGENTA RGB( 0xAA, 0x00, 0xAA ) +#define BROWN RGB( 0xAA, 0x55, 0x00 ) +#define LIGHT_GRAY RGB( 0xAA, 0xAA, 0xAA ) +#define GRAY RGB( 0x55, 0x55, 0x55 ) +#define BRIGHT_BLUE RGB( 0x55, 0x55, 0xFF ) +#define BRIGHT_GREEN RGB( 0x55, 0xFF, 0x55 ) +#define BRIGHT_CYAN RGB( 0x55, 0xFF, 0xFF ) +#define BRIGHT_RED RGB( 0xFF, 0x55, 0x55 ) +#define BRIGHT_MAGENTA RGB( 0xFF, 0x55, 0xFF ) +#define YELLOW RGB( 0xFF, 0xFF, 0x55 ) +#define WHITE RGB( 0xFF, 0xFF, 0xFF ) + +#define WM_MY_UPDATE_CARET ( WM_USER + 0x0101 ) /* Box char unicode values */ #define HB_BOXCH_ARROW_R 0x0010 /* ARROW RIGHT */ @@ -274,7 +274,7 @@ typedef struct POINT MousePos; /* the last mouse position */ - int Keys[ WVT_CHAR_QUEUE_SIZE ]; /* Array to hold the characters & events */ + int Keys[ 128 ]; /* Array to hold the characters & events */ int keyPointerIn; /* Offset into key array for character to be placed */ int keyPointerOut; /* Offset into key array of next character to read */ int keyLastPos; /* last inkey code position in buffer */ @@ -355,23 +355,23 @@ typedef struct } HB_GTWVT, * PHB_GTWVT; #ifndef WM_MOUSEWHEEL -# define WM_MOUSEWHEEL 0x020A +#define WM_MOUSEWHEEL 0x020A #endif #ifndef WM_ENTERSIZEMOVE -# define WM_ENTERSIZEMOVE 561 +#define WM_ENTERSIZEMOVE 0x0231 #endif #ifndef WM_EXITSIZEMOVE -# define WM_EXITSIZEMOVE 562 +#define WM_EXITSIZEMOVE 0x0232 #endif #ifndef SWP_DEFERERASE -# define SWP_DEFERERASE 0x2000 +#define SWP_DEFERERASE 0x2000 #endif #ifndef SW_NORMAL -# define SW_NORMAL 1 +#define SW_NORMAL 1 #endif #ifndef SC_MAXIMIZE -# define SC_MAXIMIZE 0xF030 +#define SC_MAXIMIZE 0xF030 #endif #define SYS_EV_MARK 1000 diff --git a/src/rtl/gtxwc/gtxwc.c b/src/rtl/gtxwc/gtxwc.c index 6f101ea1ac..a7fae0e4b7 100644 --- a/src/rtl/gtxwc/gtxwc.c +++ b/src/rtl/gtxwc/gtxwc.c @@ -1,7 +1,8 @@ /* - * XWindow Console - * Copyright 2003 - Giancarlo Niccolai <antispam /at/ niccolai.ws> - * Copyright 2004/2006 - Przemyslaw Czerpak <druzus /at/ priv.onet.pl> + * X11 (X Window System) console + * + * Copyright 2003 Giancarlo Niccolai <antispam /at/ niccolai.ws> + * Copyright 2004-2006 Przemyslaw Czerpak <druzus /at/ priv.onet.pl> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -10,13 +11,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -34,7 +35,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -470,7 +471,7 @@ static HB_BOOL hb_gt_xwc_DefineBoxChar( PXWND_DEF wnd, HB_USHORT usCh, XWC_CharT int cellx = wnd->fontWidth; int celly = wnd->fontHeight; - int i, y, x, yy, xx, skip, start, mod; + int i, y, x, yy, xx; if( usCh >= HB_BOXCH_RC_MIN && usCh <= HB_BOXCH_RC_MAX ) switch( usCh ) @@ -1328,6 +1329,9 @@ static HB_BOOL hb_gt_xwc_DefineBoxChar( PXWND_DEF wnd, HB_USHORT usCh, XWC_CharT case HB_BOXCH_FILLER1: case HB_BOXCH_FILLER2: case HB_BOXCH_FILLER3: + { + int skip, start, mod; + if( usCh == HB_BOXCH_FILLER1 ) { skip = 4; @@ -1365,7 +1369,7 @@ static HB_BOOL hb_gt_xwc_DefineBoxChar( PXWND_DEF wnd, HB_USHORT usCh, XWC_CharT } type = size == 0 ? CH_NONE : CH_PTS; break; - + } case HB_BOXCH_ARROW_R: i = HB_MIN( ( celly >> 1 ), cellx ) - 3; pts[ 0 ].x = ( ( cellx - i ) >> 1 ); @@ -2715,7 +2719,7 @@ static void hb_gt_xwc_ProcessKey( PXWND_DEF wnd, XKeyEvent * evt ) { i = Xutf8LookupString( wnd->ic, evt, buf, ( int ) sizeof( buf ), &outISO, &status_return ); buf[ HB_MAX( i, 0 ) ] = '\0'; - printf( "UTF8: KeySym=%lx, keySymISO=%lx, keystr[%d]='%s'\n", out, outISO, i, buf ); fflush( stdout ); + printf( "UTF-8: KeySym=%lx, keySymISO=%lx, keystr[%d]='%s'\n", out, outISO, i, buf ); fflush( stdout ); } else # endif @@ -2846,7 +2850,7 @@ static void hb_gt_xwc_ProcessKey( PXWND_DEF wnd, XKeyEvent * evt ) ikey = HB_KX_F12; break; - /* Keys with special meanings to clipper */ + /* Keys with special meanings to Cl*pper */ case XK_Pause: ikey = HB_KX_PAUSE; break; @@ -2935,7 +2939,7 @@ static void hb_gt_xwc_ProcessKey( PXWND_DEF wnd, XKeyEvent * evt ) if( i <= 0 ) { /* - * This is a temporary hack for Latin-x input see gt_SetKeyCP + * This is a temporary hack for Latin-x input see gt_SetKeyCP() */ if( outISO >= 0x0100 && outISO <= 0x0fff && ( outISO & 0x80 ) == 0x80 ) { @@ -3267,7 +3271,6 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent * evt ) if( evt->xselection.property != None ) { XTextProperty text; - unsigned long nItem; if( XGetTextProperty( wnd->dpy, wnd->window, &text, evt->xselection.property ) != 0 ) @@ -3311,9 +3314,9 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent * evt ) else if( evt->xselection.target == s_atomTargets && text.format == 32 ) { Atom aValue; - + unsigned long nItem; #ifdef XWC_DEBUG - printf( "text.nitems=%ld, text.format=%d\n", text.nitems, text.format ); fflush( stdout ); + printf( "text.nitems=%lu, text.format=%d\n", text.nitems, text.format ); fflush( stdout ); #endif for( nItem = 0; nItem < text.nitems; ++nItem ) { @@ -3326,9 +3329,9 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent * evt ) aNextRequest = s_atomText; #ifdef XWC_DEBUG if( aValue ) - printf( "%ld, %8lx (%s)\n", nItem, aValue, XGetAtomName( wnd->dpy, aValue ) ); + printf( "%lu, %8lx (%s)\n", nItem, aValue, XGetAtomName( wnd->dpy, aValue ) ); else - printf( "%ld, %8lx (NULL)\n", nItem, aValue ); + printf( "%lu, %8lx (NULL)\n", nItem, aValue ); fflush( stdout ); #endif } @@ -3522,7 +3525,7 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent * evt ) */ /* *********************************************************************** */ -/* collor allocation */ +/* color allocation */ static int hb_gt_xwc_GetColormapSize( PXWND_DEF wnd ) { XVisualInfo visInfo, *visInfoPtr; @@ -3562,7 +3565,7 @@ static HB_BOOL hb_gt_xwc_AllocColor( PXWND_DEF wnd, XColor * pColor ) * with ideas from David Tong's "noflash" library ;-) */ int i, iClosestColor; - double dDiff, dDistance, dClosestColorDist = 0; + double dDiff, dDistance; XColor *colorTable; HB_BYTE *checkTable; @@ -3577,12 +3580,14 @@ static HB_BOOL hb_gt_xwc_AllocColor( PXWND_DEF wnd, XColor * pColor ) do { + double dClosestColorDist; + iClosestColor = -1; /* * Look for the color that best approximates the desired one * and has not been checked so far and try to allocate it. * If allocation fails, it must mean that the color was read-write - * (so we can't use it, since its owner might change it) or else + * (so we cannot use it, since its owner might change it) or else * it was already freed. Repeat until something succeeds or * we test all colors in given maximum of approximation. * @@ -3708,11 +3713,11 @@ static HB_U32 hb_gt_xwc_HashCurrChar( HB_BYTE attr, HB_BYTE color, HB_USHORT chr static void hb_gt_xwc_RepaintChar( PXWND_DEF wnd, int colStart, int rowStart, int colStop, int rowStop ) { - HB_USHORT irow, icol, startCol = 0, len, basex, basey, nsize; + HB_USHORT irow, startCol = 0, basex, basey, nsize; HB_BYTE oldColor = 0, color, attr; HB_USHORT usCh16, usChBuf[ XWC_MAX_COLS ]; HB_U32 u32Curr = 0xFFFFFFFF; - int i, iColor, scridx; + int i, iColor; XWC_CharTrans * chTrans; #ifdef XWC_DEBUG @@ -3730,6 +3735,9 @@ static void hb_gt_xwc_RepaintChar( PXWND_DEF wnd, int colStart, int rowStart, in for( irow = rowStart; irow <= rowStop; irow++ ) { + HB_USHORT icol, len; + int scridx; + icol = colStart; scridx = icol + irow * wnd->cols; len = 0; @@ -3956,11 +3964,11 @@ static void hb_gt_xwc_InvalidateFull( PXWND_DEF wnd ) static void hb_gt_xwc_InvalidatePart( PXWND_DEF wnd, int left, int top, int right, int bottom ) { - int row, col, scridx; + int row, col; for( row = top; row <= bottom; row++ ) { - scridx = row * wnd->cols + left; + int scridx = row * wnd->cols + left; for( col = left; col <= right; col++, scridx++ ) wnd->pCurrScr[ scridx ] = 0xFFFFFFFF; } @@ -4586,10 +4594,10 @@ static HB_BOOL hb_gt_xwc_ConnectX( PXWND_DEF wnd, HB_BOOL fExit ) { /* TODO: a standard Harbour error should be generated here when it can run without console! - hb_errRT_TERM( EG_CREATE, 10001, NULL, "Can't connect to X server", 0, 0 ); + hb_errRT_TERM( EG_CREATE, 10001, NULL, "Could not connect to X server", 0, 0 ); */ s_fNoXServer = HB_TRUE; - hb_errInternal( 10001, "Can't connect to X server.", NULL, NULL ); + hb_errInternal( 10001, "Could not connect to X server.", NULL, NULL ); } return HB_FALSE; } @@ -4677,7 +4685,7 @@ static void hb_gt_xwc_DissConnectX( PXWND_DEF wnd ) wnd->dpy = NULL; /* Hack to avoid race condition inside some XLIB library - it looks - * in heavy stres MT tests that it can receive some events bound with + * in heavy stress MT tests that it can receive some events bound with * destroyed objects and executes our error handler. */ s_fIgnoreErrors = HB_TRUE; @@ -4719,7 +4727,7 @@ static void hb_gt_xwc_SetResizing( PXWND_DEF wnd ) /* with StaticGravity XMoveWindow expects upper left corner of client area * and with NorthWestGravity it expect upper left corner of window with - * frame and title bar. ConfigureNotify always returns client area possition + * frame and title bar. ConfigureNotify always returns client area position * so working with NorthWestGravity it's necessary to update cords returned * to user in hb_gt_xwc_UpdateWindowCords() */ @@ -4764,11 +4772,11 @@ static void hb_gt_xwc_CreateWindow( PXWND_DEF wnd ) /* TODO: a standard Harbour error should be generated here when it can run without console! - hb_errRT_TERM( EG_CREATE, 10001, NULL, "Can't load 'fixed' font", 0, 0 ); + hb_errRT_TERM( EG_CREATE, 10001, NULL, "Cannot load 'fixed' font", 0, 0 ); return; */ s_fNoXServer = HB_TRUE; - hb_errInternal( 10001, "Can't load 'fixed' font", NULL, NULL ); + hb_errInternal( 10001, "Cannot load 'fixed' font", NULL, NULL ); } } } @@ -4915,7 +4923,7 @@ static void hb_gt_xwc_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Init(%p,%p,%p,%p)", ( void * ) pGT, ( void * ) ( HB_PTRUINT ) hFilenoStdin, ( void * ) ( HB_PTRUINT ) hFilenoStdout, ( void * ) ( HB_PTRUINT ) hFilenoStderr ) ); #ifdef HB_XWC_USE_LOCALE setlocale( LC_CTYPE, "" ); @@ -4958,7 +4966,7 @@ static void hb_gt_xwc_Exit( PHB_GT pGT ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Exit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Exit(%p)", ( void * ) pGT ) ); wnd = HB_GTXWC_GET( pGT ); @@ -4977,7 +4985,7 @@ static HB_BOOL hb_gt_xwc_SetMode( PHB_GT pGT, int iRow, int iCol ) { HB_BOOL fResult = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_SetMode(%p,%d,%d)", pGT, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_SetMode(%p,%d,%d)", ( void * ) pGT, iRow, iCol ) ); if( iCol >= XWC_MIN_COLS && iRow >= XWC_MIN_ROWS && iCol <= XWC_MAX_COLS && iRow <= XWC_MAX_ROWS ) @@ -5051,7 +5059,7 @@ static HB_BOOL hb_gt_xwc_SetMode( PHB_GT pGT, int iRow, int iCol ) static HB_BOOL hb_gt_xwc_GetBlink( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_GetBlink(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_GetBlink(%p)", ( void * ) pGT ) ); HB_SYMBOL_UNUSED( pGT ); @@ -5077,7 +5085,7 @@ static int hb_gt_xwc_ReadKey( PHB_GT pGT, int iEventMask ) PXWND_DEF wnd; int c = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_ReadKey(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_ReadKey(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_SYMBOL_UNUSED( iEventMask ); @@ -5098,7 +5106,7 @@ static void hb_gt_xwc_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); /* The conversion from Clipper (DOS) timer tick units to milliseconds is * 1000.0 / 18.2. */ @@ -5127,7 +5135,7 @@ static HB_BOOL hb_gt_xwc_mouse_IsPresent( PHB_GT pGT ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_IsPresent(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_IsPresent(%p)", ( void * ) pGT ) ); wnd = HB_GTXWC_GET( pGT ); hb_gt_xwc_ConnectX( wnd, HB_TRUE ); @@ -5140,7 +5148,7 @@ static void hb_gt_xwc_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_GetPos(%p,%p,%p)", pGT, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_GetPos(%p,%p,%p)", ( void * ) pGT, ( void * ) piRow, ( void * ) piCol ) ); wnd = HB_GTXWC_GET( pGT ); if( wnd ) @@ -5157,7 +5165,7 @@ static void hb_gt_xwc_mouse_SetPos( PHB_GT pGT, int iRow, int iCol ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_SetPos(%p,%d,%d)", pGT, iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_SetPos(%p,%d,%d)", ( void * ) pGT, iRow, iCol ) ); wnd = HB_GTXWC_GET( pGT ); wnd->mouseGotoRow = iRow; @@ -5171,7 +5179,7 @@ static HB_BOOL hb_gt_xwc_mouse_ButtonState( PHB_GT pGT, int iButton ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_ButtonState(%p,%i)", pGT, iButton ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_ButtonState(%p,%i)", ( void * ) pGT, iButton ) ); wnd = HB_GTXWC_GET( pGT ); hb_gt_xwc_ConnectX( wnd, HB_TRUE ); @@ -5187,7 +5195,7 @@ static int hb_gt_xwc_mouse_CountButton( PHB_GT pGT ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_CountButton(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_CountButton(%p)", ( void * ) pGT ) ); wnd = HB_GTXWC_GET( pGT ); hb_gt_xwc_ConnectX( wnd, HB_TRUE ); @@ -5213,7 +5221,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) PXWND_DEF wnd; int iVal; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Info(%p,%d,%p)", ( void * ) pGT, iType, ( void * ) pInfo ) ); wnd = HB_GTXWC_GET( pGT ); if( ! wnd->dpy ) @@ -5746,7 +5754,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( wnd->window && pInfo->pNewVal && ( ( HB_IS_ARRAY( pInfo->pNewVal ) && hb_arrayLen( pInfo->pNewVal ) == ( HB_SIZE ) - ( hb_arrayGetType( pInfo->pNewVal, 4 ) & HB_IT_NUMERIC ? 4 : 3 ) ) || + ( ( hb_arrayGetType( pInfo->pNewVal, 4 ) & HB_IT_NUMERIC ) ? 4 : 3 ) ) || HB_IS_STRING( pInfo->pNewVal ) ) ) { XImage * xImage = NULL; @@ -5890,7 +5898,7 @@ static int hb_gt_xwc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, XColor color; XImage * image; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", ( void * ) pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) ); wnd = HB_GTXWC_GET( pGT ); if( ! wnd->fInit ) @@ -6080,7 +6088,7 @@ static void hb_gt_xwc_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) ); wnd = HB_GTXWC_GET( pGT ); if( wnd && ! s_fNoXServer ) @@ -6130,7 +6138,7 @@ static void hb_gt_xwc_Refresh( PHB_GT pGT ) { PXWND_DEF wnd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Refresh(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_Refresh(%p)", ( void * ) pGT ) ); wnd = HB_GTXWC_GET( pGT ); HB_GTSUPER_REFRESH( pGT ); @@ -6148,7 +6156,7 @@ static void hb_gt_xwc_Refresh( PHB_GT pGT ) static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_FuncInit(%p)", ( void * ) pFuncTable ) ); pFuncTable->Init = hb_gt_xwc_Init; pFuncTable->Exit = hb_gt_xwc_Exit; diff --git a/src/rtl/gtxwc/gtxwc.h b/src/rtl/gtxwc/gtxwc.h index 3e27f7da74..f484bf8088 100644 --- a/src/rtl/gtxwc/gtxwc.h +++ b/src/rtl/gtxwc/gtxwc.h @@ -1,7 +1,8 @@ /* * XWindow Console - * Copyright 2003 - Giancarlo Niccolai <antispam /at/ niccolai.ws> - * Copyright 2004/2006 - Przemyslaw Czerpak <druzus /at/ priv.onet.pl> + * + * Copyright 2003 Giancarlo Niccolai <antispam /at/ niccolai.ws> + * Copyright 2004-2006 Przemyslaw Czerpak <druzus /at/ priv.onet.pl> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -10,13 +11,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING.txt. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. @@ -34,7 +35,7 @@ * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading + * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * @@ -51,11 +52,11 @@ #define HB_GT_NAME XWC +#include "hbapi.h" #include "hbgtcore.h" #include "hbinit.h" #include "hbset.h" #include "hbvm.h" -#include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" #include "inkey.ch" diff --git a/src/rtl/gx.c b/src/rtl/gx.c index f6b5d97310..baded33b45 100644 --- a/src/rtl/gx.c +++ b/src/rtl/gx.c @@ -2,6 +2,7 @@ * NoSnow(), SetMode(), IsColor() functions * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * Copyright 1999 Paul Tucker <ptucker@sympatico.ca> (SetMode()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Paul Tucker <ptucker@sympatico.ca> - * SetMode() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapigt.h" diff --git a/src/rtl/hbadler.c b/src/rtl/hbadler.c index b6b6daa993..e6df48d1c6 100644 --- a/src/rtl/hbadler.c +++ b/src/rtl/hbadler.c @@ -2,7 +2,6 @@ * adler32 checksum function * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> - * * Algorithm taken from adler32.c Copyright (C) 1995-2002 Mark Adler * * This program is free software; you can redistribute it and/or modify diff --git a/src/rtl/hbbffnc.c b/src/rtl/hbbffnc.c index d930594053..9dd4eca5ba 100644 --- a/src/rtl/hbbffnc.c +++ b/src/rtl/hbbffnc.c @@ -57,7 +57,7 @@ static const HB_BLOWFISH * hb_bf_keyparam( void ) return NULL; } -/* hb_blowfishKey( <cPasswd> ) -> <cBfKey> +/* hb_blowfishKey( <cPasswd> ) --> <cBfKey> */ HB_FUNC( HB_BLOWFISHKEY ) { @@ -72,7 +72,7 @@ HB_FUNC( HB_BLOWFISHKEY ) } } -/* hb_blowfishEncrypt( <cBfKey>, <cText> [, <lRaw>=.F. ] ) -> <cCipher> | NIL +/* hb_blowfishEncrypt( <cBfKey>, <cText> [, <lRaw>=.F. ] ) --> <cCipher> | NIL * return string encrypted using ECB (electronic codebook) mode or * NIL on error (wrong parameters), * in raw mode passed string is padded to 8 bytes with '\0' @@ -85,12 +85,13 @@ HB_FUNC( HB_BLOWFISHENCRYPT ) if( bf && pData ) { - HB_SIZE nLen = hb_itemGetCLen( pData ), nSize; + HB_SIZE nLen = hb_itemGetCLen( pData ); if( nLen ) { char * pszData; HB_BOOL fRaw = hb_parl( 3 ); + HB_SIZE nSize; /* In raw mode passed string is padded to 8 bytes with '\0' * otherwise ANSI X.923 padding is used @@ -118,7 +119,7 @@ HB_FUNC( HB_BLOWFISHENCRYPT ) } } -/* hb_blowfishDecrypt( <cBfKey>, <cCipher> [, <lRaw>=.F. ] ) -> <cText> | NIL +/* hb_blowfishDecrypt( <cBfKey>, <cCipher> [, <lRaw>=.F. ] ) --> <cText> | NIL * return string decrypted using ECB (electronic codebook) mode or * NIL on error (wrong parameters), * in raw mode whole passed string is decoded as is @@ -131,13 +132,14 @@ HB_FUNC( HB_BLOWFISHDECRYPT ) if( bf && pData ) { - HB_SIZE nSize = hb_itemGetCLen( pData ), nLen; + HB_SIZE nSize = hb_itemGetCLen( pData ); if( nSize >= 8 && ( nSize & 0x07 ) == 0 ) { const char * pszSource; char * pszData; HB_BOOL fRaw = hb_parl( 3 ); + HB_SIZE nLen; pszData = ( char * ) hb_xgrab( nSize + ( fRaw ? 1 : 0 ) ); pszSource = hb_itemGetCPtr( pData ); @@ -194,7 +196,7 @@ static void hb_bf_encode( const HB_BLOWFISH * bf, HB_BYTE * vect ) } /* hb_blowfishEncrypt_CFB( <cBfKey>, <cText> [, <cInitSeed> ] ) - * -> <cCipher> | NIL + * --> <cCipher> | NIL * return string encrypted using CFB (cipher feedback) mode or * NIL on error (wrong parameters) */ @@ -205,13 +207,14 @@ HB_FUNC( HB_BLOWFISHENCRYPT_CFB ) if( bf && pData ) { - HB_SIZE nLen = hb_itemGetCLen( pData ), n; + HB_SIZE nLen = hb_itemGetCLen( pData ); if( nLen ) { const char * pszSource = hb_itemGetCPtr( pData ); char * pszData = ( char * ) hb_xgrab( nLen + 1 ); HB_BYTE vect[ HB_BF_CIPHERBLOCK ]; + HB_SIZE n; hb_bf_initvect( vect ); @@ -230,7 +233,7 @@ HB_FUNC( HB_BLOWFISHENCRYPT_CFB ) } /* hb_blowfishDecrypt_CFB( <cBfKey>, <cCipher> [, <cInitSeed> ] ) - * -> <cText> | NIL + * --> <cText> | NIL * return string decrypted using CFB (cipher feedback) mode or * NIL on error (wrong parameters), */ @@ -241,13 +244,14 @@ HB_FUNC( HB_BLOWFISHDECRYPT_CFB ) if( bf && pData ) { - HB_SIZE nLen = hb_itemGetCLen( pData ), n; + HB_SIZE nLen = hb_itemGetCLen( pData ); if( nLen ) { const char * pszSource = hb_itemGetCPtr( pData ); char * pszData = ( char * ) hb_xgrab( nLen + 1 ); HB_BYTE vect[ HB_BF_CIPHERBLOCK ]; + HB_SIZE n; hb_bf_initvect( vect ); diff --git a/src/rtl/hbbfish.c b/src/rtl/hbbfish.c index 0c593755f8..8c126115ef 100644 --- a/src/rtl/hbbfish.c +++ b/src/rtl/hbbfish.c @@ -1,12 +1,12 @@ /* * This code implements BlowFish algorithm designed by Bruce Schneier. - * The description of BlowFish algorithm can be found at: - * http://www.schneier.com/paper-blowfish-fse.html - * This code uses for initial s-boxes and p-array values PI hex digits - * taken from tables public at: - * http://www.schneier.com/blowfish.html - * which can be downloaded from: - * http://www.schneier.com/code/constants.txt + * The description of BlowFish algorithm can be found at: + * https://www.schneier.com/paper-blowfish-fse.html + * This code uses for initial s-boxes and p-array values PI hex digits + * taken from tables public at: + * https://www.schneier.com/blowfish.html + * which can be downloaded from: + * https://www.schneier.com/code/constants.txt * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rtl/hbbfsock.c b/src/rtl/hbbfsock.c index 08432ef967..90af57fa70 100644 --- a/src/rtl/hbbfsock.c +++ b/src/rtl/hbbfsock.c @@ -340,7 +340,7 @@ static PHB_SOCKEX s_sockexNext( PHB_SOCKEX pSock, PHB_ITEM pParams ) return pSockNew; } -/* hb_socketNewBFSock( <pSocket>, [<hParams>] ) -> <pSocket> */ +/* hb_socketNewBFSock( <pSocket>, [<hParams>] ) --> <pSocket> */ HB_FUNC( HB_SOCKETNEWBFSOCK ) { PHB_SOCKEX pSock = hb_sockexParam( 1 ); diff --git a/src/rtl/hbcom.c b/src/rtl/hbcom.c index 460b94a06f..7ba3078e7f 100644 --- a/src/rtl/hbcom.c +++ b/src/rtl/hbcom.c @@ -711,7 +711,7 @@ int hb_comInputCount( int iPort ) hb_comSetOsError( pCom, iResult == -1 ); #elif defined( FIONREAD ) && ! defined( HB_OS_CYGWIN ) /* Cygwin sys/termios.h explicitly says that "TIOCINQ is - * utilized instead of FIONREAD which has been accupied for + * utilized instead of FIONREAD which has been occupied for * other purposes under CYGWIN", so don't give Cygwin * even a chance to hit this code path. */ int iResult = ioctl( pCom->fd, FIONREAD, &iCount ); @@ -807,7 +807,7 @@ int hb_comFlush( int iPort, int iType ) */ #ifdef HB_OS_LINUX - /* hack for missing defintions in standard header files */ + /* hack for missing definitions in standard header files */ # ifndef TIOCM_OUT1 # define TIOCM_OUT1 0x2000 # endif @@ -1329,7 +1329,7 @@ long hb_comRecv( int iPort, void * data, long len, HB_MAXINT timeout ) #else if( timeout != pCom->rdtimeout ) { - /* TODO: implent timeout settings + /* TODO: implement timeout settings * tio.c_cc[ VTIME ] = ( timeout + 50 ) / 100; * tio.c_cc[ VMIN ] = 0; * in DJGPP builds @@ -1383,7 +1383,7 @@ int hb_comInit( int iPort, int iBaud, int iParity, int iSize, int iStop ) tio.c_cc[ VMIN ] = 0; /* minimum number of characters for read */ #else /* workaround for bug in some Linux kernels (i.e. 3.13.0-64-generic - Ubuntu) in which select() unconditionally accepts stdin for + *buntu) in which select() unconditionally accepts stdin for reading if c_cc[ VMIN ] = 0 [druzus] */ tio.c_cc[ VMIN ] = 1; #endif @@ -3185,7 +3185,7 @@ static void hb_comSetOsError( PHB_COM pCom, int iError ) break; case SER_ERR_IRQ_NOT_FOUND: /* Could not find an IRQ for the specified COM port */ case SER_ERR_LOCK_MEM: /* Could not lock memory in DPMI mode */ - case SER_ERR_UNKNOWN: /* An unknown error occured */ + case SER_ERR_UNKNOWN: /* An unknown error occurred */ default: pCom->error = iError < 0 ? HB_COM_ERR_OTHER : 0; } diff --git a/src/rtl/hbcomhb.c b/src/rtl/hbcomhb.c index b0776ad11f..4a3bd84b53 100644 --- a/src/rtl/hbcomhb.c +++ b/src/rtl/hbcomhb.c @@ -210,7 +210,7 @@ HB_FUNC( HB_COMOUTPUTSTATE ) HB_FUNC( HB_COMSENDBREAK ) { - /* 50ms break is enough for baudrate 300 and higher */ + /* 50ms break is enough for baud-rate 300 and higher */ hb_retl( hb_comSendBreak( hb_parni( 1 ), hb_parnidef( 2, 50 ) ) == 0 ); } diff --git a/src/rtl/hbcrc.c b/src/rtl/hbcrc.c index 7d9e922de5..37750f98bd 100644 --- a/src/rtl/hbcrc.c +++ b/src/rtl/hbcrc.c @@ -196,7 +196,7 @@ HB_MAXUINT hb_crc( HB_MAXUINT crc, const void * buf, HB_SIZE len, HB_MAXUINT pol crc ^= *ucbuf++; do { - crc = crc & 1 ? revp ^ ( crc >> 1 ) : crc >> 1; + crc = ( crc & 1 ) ? revp ^ ( crc >> 1 ) : crc >> 1; } while( --i ); } @@ -229,7 +229,7 @@ HB_MAXUINT hb_crcct( HB_MAXUINT crc, const void * buf, HB_SIZE len, HB_MAXUINT p crc ^= ( HB_MAXUINT ) ( *ucbuf++ ); do { - crc = crc & mask ? poly ^ ( crc << 1 ) : crc << 1; + crc = ( crc & mask ) ? poly ^ ( crc << 1 ) : crc << 1; } while( --i ); } @@ -245,7 +245,7 @@ HB_MAXUINT hb_crcct( HB_MAXUINT crc, const void * buf, HB_SIZE len, HB_MAXUINT p crc ^= ( HB_MAXUINT ) ( *ucbuf++ ) << bits; do { - crc = crc & mask ? poly ^ ( crc << 1 ) : crc << 1; + crc = ( crc & mask ) ? poly ^ ( crc << 1 ) : crc << 1; } while( --i ); } diff --git a/src/rtl/hbdyn.c b/src/rtl/hbdyn.c index 5483a5143b..a567e68eec 100644 --- a/src/rtl/hbdyn.c +++ b/src/rtl/hbdyn.c @@ -178,7 +178,7 @@ static HB_U64 hb_u64par( PHB_ITEM pParam, PHB_DYNARG pArg ) break; case HB_DYN_CTYPE_LLONG_UNSIGNED: - /* TOFIX: Digits are lost. */ + /* FIXME: Digits are lost. */ #if HB_VMLONG_MAX == INT32_MAX || defined( HB_LONG_LONG_OFF ) pArg->value.t.n64 = ( HB_MAXUINT ) hb_itemGetNInt( pParam ); #else @@ -188,7 +188,7 @@ static HB_U64 hb_u64par( PHB_ITEM pParam, PHB_DYNARG pArg ) break; case HB_DYN_CTYPE_FLOAT: - /* TOFIX */ + /* FIXME */ case HB_DYN_CTYPE_DOUBLE: HB_PUT_LE_DOUBLE( ( HB_BYTE * ) &pArg->value.t.n64, hb_itemGetND( pParam ) ); @@ -384,7 +384,7 @@ static PHB_ITEM hb_u64ret( PHB_ITEM pItem, int iRetType, int iEncoding, HB_DYNVA break; case HB_DYN_CTYPE_FLOAT: - hb_itemPutND( pItem, value.t.nFL ); + hb_itemPutND( pItem, ( double ) value.t.nFL ); break; case HB_DYN_CTYPE_DOUBLE: @@ -539,7 +539,7 @@ static void hb_u32par( PHB_ITEM pParam, PHB_DYNARG pArg, HB_U32 * r1, HB_U32 * r case HB_DYN_CTYPE_LLONG_UNSIGNED: #if ! defined( HB_LONG_LONG_OFF ) - /* TOFIX: Digits are lost. */ + /* FIXME: Digits are lost. */ #if HB_VMLONG_MAX == INT32_MAX || defined( HB_LONG_LONG_OFF ) pArg->value.t.n64 = ( HB_MAXUINT ) hb_itemGetNInt( pParam ); #else @@ -767,7 +767,7 @@ static PHB_ITEM hb_u32ret( PHB_ITEM pItem, int iRetType, int iEncoding, HB_DYNVA break; case HB_DYN_CTYPE_FLOAT: - hb_itemPutND( pItem, value.t.nFL ); + hb_itemPutND( pItem, ( double ) value.t.nFL ); break; case HB_DYN_CTYPE_DOUBLE: diff --git a/src/rtl/hbfilehi.prg b/src/rtl/hbfilehi.prg index 146e2deb3b..49000b0c7c 100644 --- a/src/rtl/hbfilehi.prg +++ b/src/rtl/hbfilehi.prg @@ -226,7 +226,7 @@ FUNCTION hb_DirSepAdd( cDir ) IF ! Empty( cDir ) .AND. ; ! _ISDRIVESPEC( cDir ) .AND. ; - !( Right( cDir, 1 ) == hb_ps() ) + ! Right( cDir, 1 ) == hb_ps() cDir += hb_ps() ENDIF @@ -241,14 +241,14 @@ FUNCTION hb_DirSepDel( cDir ) IF Empty( hb_osDriveSeparator() ) DO WHILE Len( cDir ) > 1 .AND. Right( cDir, 1 ) == hb_ps() .AND. ; - !( cDir == hb_ps() + hb_ps() ) + ! cDir == hb_ps() + hb_ps() cDir := hb_StrShrink( cDir ) ENDDO ELSE DO WHILE Len( cDir ) > 1 .AND. Right( cDir, 1 ) == hb_ps() .AND. ; - !( cDir == hb_ps() + hb_ps() ) .AND. ; - !( Right( cDir, Len( hb_osDriveSeparator() ) + 1 ) == hb_osDriveSeparator() + hb_ps() ) + ! cDir == hb_ps() + hb_ps() .AND. ; + ! Right( cDir, Len( hb_osDriveSeparator() ) + 1 ) == hb_osDriveSeparator() + hb_ps() cDir := hb_StrShrink( cDir ) ENDDO diff --git a/src/rtl/hbgtcore.c b/src/rtl/hbgtcore.c index afeb7bd3a1..6e71631b51 100644 --- a/src/rtl/hbgtcore.c +++ b/src/rtl/hbgtcore.c @@ -1,5 +1,5 @@ /* - * Harbour Graphic Terminal low level code + * Harbour Graphic Terminal low-level code * * Copyright 2006 Przemyslaw Czerpak < druzus /at/ priv.onet.pl > * @@ -293,7 +293,7 @@ static HB_BOOL hb_gt_def_IsColor( PHB_GT pGT ) [vszakats] */ static void hb_gt_def_GetColorStr( PHB_GT pGT, char * pszColorString ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_GetColorStr(%p,%s)", pGT, pszColorString ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_GetColorStr(%p,%s)", ( void * ) pGT, pszColorString ) ); HB_GTSELF_COLORSTOSTRING( pGT, pGT->pColor, pGT->iColorCount, pszColorString, HB_CLRSTR_LEN ); @@ -301,7 +301,7 @@ static void hb_gt_def_GetColorStr( PHB_GT pGT, char * pszColorString ) static void hb_gt_def_SetColorStr( PHB_GT pGT, const char * szColorString ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_SetColorStr(%p,%s)", pGT, szColorString ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_SetColorStr(%p,%s)", ( void * ) pGT, szColorString ) ); HB_GTSELF_STRINGTOCOLORS( pGT, szColorString, &pGT->pColor, &pGT->iColorCount ); pGT->iColorIndex = HB_CLR_STANDARD; /* HB_GTSELF_COLORSELECT( pGT, HB_CLR_STANDARD ); */ @@ -373,7 +373,7 @@ static const char * hb_gt_def_ColorDecode( const char * szColorString, int * piC int nColor = 0, iCount = 0; HB_BOOL bFore = HB_TRUE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_ColorDecode(%s,%p)", szColorString, piColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_ColorDecode(%s,%p)", szColorString, ( void * ) piColor ) ); while( ( c = *szColorString++ ) != 0 ) { @@ -478,10 +478,9 @@ static int hb_gt_def_ColorNum( PHB_GT pGT, const char * szColorString ) static void hb_gt_def_StringToColors( PHB_GT pGT, const char * szColorString, int ** pColorsPtr, int * piColorCount ) { int * pColors; - int nPos = 0; int nColor; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_StringToColors(%p,%s,%p,%p)", pGT, szColorString, pColorsPtr, piColorCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_StringToColors(%p,%s,%p,%p)", ( void * ) pGT, szColorString, ( void * ) pColorsPtr, ( void * ) piColorCount ) ); HB_SYMBOL_UNUSED( pGT ); @@ -503,6 +502,8 @@ static void hb_gt_def_StringToColors( PHB_GT pGT, const char * szColorString, in } else { + int nPos = 0; + do { szColorString = hb_gt_def_ColorDecode( szColorString, &nColor ); @@ -529,7 +530,7 @@ static void hb_gt_def_ColorsToString( PHB_GT pGT, int * pColors, int iColorCount { int iColorIndex, iPos; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_ColorsToString(%p,%p,%d,%p,%d)", pGT, pColors, iColorCount, pszColorString, iBufSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_ColorsToString(%p,%p,%d,%p,%d)", ( void * ) pGT, ( void * ) pColors, iColorCount, ( void * ) pszColorString, iBufSize ) ); HB_SYMBOL_UNUSED( pGT ); @@ -643,7 +644,7 @@ static void hb_gt_def_SetSnowFlag( PHB_GT pGT, HB_BOOL fNoSnow ) { /* * NOTE: This is a compatibility function which have to be implemented - * in low level GT driver. + * in low-level GT driver. * If you're running on a CGA and snow is a problem speak up! */ @@ -1365,7 +1366,7 @@ static void hb_gt_def_DrawShadow( PHB_GT pGT, int iTop, int iLeft, int iBottom, static void hb_gt_def_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, int iColor, HB_USHORT usChar, int iRows, int iCols ) { - int iColOld, iColNew, iColSize, iColClear, iClrs, iLength, iFlag = 0; + int iColOld, iColNew, iColSize, iColClear, iClrs, iLength; iColSize = iRight - iLeft; iLength = iColSize + 1; @@ -1388,6 +1389,7 @@ static void hb_gt_def_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int if( iLength > 0 && iTop <= iBottom ) { void * pBuffer = NULL; + int iFlag = 0; if( ( iRows || iCols ) && iColSize >= 0 && ( iBottom - iTop >= iRows ) ) { @@ -1470,7 +1472,7 @@ static void hb_gt_def_ScrollArea( PHB_GT pGT, int iTop, int iLeft, int iBottom, while( iTop <= iBottom ) { - int iRowPos, i; + int iRowPos; if( iRows >= 0 ) iRowPos = iTop++; @@ -1480,6 +1482,8 @@ static void hb_gt_def_ScrollArea( PHB_GT pGT, int iTop, int iLeft, int iBottom, if( fMove && ( iRows == 0 || ( iRowPos + iRows >= iTop && iRowPos + iRows <= iBottom ) ) ) { + int i; + lIndex = ( long ) iRowPos * iWidth + iColNew; if( lOffset < 0 ) { @@ -1874,7 +1878,7 @@ static HB_BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( ! pInfo->pResult ) pInfo->pResult = hb_itemNew( NULL ); hb_arrayNew( pInfo->pResult, 7 ); - /* 7-th item is allocated for GTCTW window number */ + /* 7th item is allocated for GTCTW window number */ HB_GTSELF_GETPOS( pGT, &iRow, &iCol ); hb_arraySetNI( pInfo->pResult, 1, iRow ); hb_arraySetNI( pInfo->pResult, 2, iCol ); @@ -2001,16 +2005,13 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, pOptions && ( iOptions = ( int ) hb_arrayLen( pOptions ) ) > 0 ) { HB_SIZE nLen; - void * hMessage, * hOpt; - const HB_WCHAR * szMessageW = hb_itemGetStrU16( pMessage, HB_CDP_ENDIAN_NATIVE, &hMessage, &nLen ), - * szOptW; + void * hMessage; + const HB_WCHAR * szMessageW = hb_itemGetStrU16( pMessage, HB_CDP_ENDIAN_NATIVE, &hMessage, &nLen ); HB_BOOL fScreen = HB_FALSE, fKeyBoard = HB_FALSE; PHB_CODEPAGE cdp = HB_GTSELF_HOSTCP( pGT ); char szKey[ HB_MAX_CHAR_LEN ]; HB_SIZE nChar; - int iKey, i, iDspCount, iStyle, iRows, iCols, - iRow, iCol, iTop, iLeft, iBottom, iRight, iMnuCol, iPos, iClr; - void * pBuffer = NULL; + int iKey, i, iRows, iCols; HB_GT_INFO gtInfo; memset( >Info, 0, sizeof( gtInfo ) ); @@ -2032,6 +2033,8 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, if( fScreen ) { + void * pBuffer = NULL; + int iDspCount, iStyle, iRow, iCol, iTop, iLeft, iBottom, iRight, iPos, iClr; HB_UINT ulLines = 0, ulWidth = 0, ulCurrWidth = 0, ulMsg = 0, ulDst = 0, ulLast = 0, ulSpace1 = 0, ulSpace2 = 0, ulDefWidth, ulMaxWidth; HB_WCHAR * szMsgDsp; @@ -2190,10 +2193,13 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, iPos = 1; while( iRet == 0 ) { + int iMnuCol; HB_GTSELF_DISPBEGIN( pGT ); iMnuCol = iLeft + ( ( ulWidth - ulCurrWidth ) >> 1 ) + 3; for( i = 1; i <= iOptions; ++i ) { + void * hOpt; + const HB_WCHAR * szOptW; iClr = i == iPos ? iClrHigh : iClrNorm; szOptW = hb_arrayGetStrU16( pOptions, i, HB_CDP_ENDIAN_NATIVE, &hOpt, &nLen ); HB_GTSELF_PUTTEXTW( pGT, iBottom - 1, iMnuCol, iClr, s_szSpaceW, 1 ); @@ -2614,7 +2620,7 @@ static int hb_gt_def_InkeyFilter( PHB_GT pGT, int iKey, int iEventMask ) { int iMask; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyFilter(%p,%d,%d)", pGT, iKey, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyFilter(%p,%d,%d)", ( void * ) pGT, iKey, iEventMask ) ); HB_SYMBOL_UNUSED( pGT ); @@ -2747,7 +2753,7 @@ static void hb_gt_def_InkeyPut( PHB_GT pGT, int iKey ) { int iHead; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyPut(%p,%d)", pGT, iKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyPut(%p,%d)", ( void * ) pGT, iKey ) ); iHead = pGT->inkeyHead; @@ -2784,7 +2790,7 @@ static void hb_gt_def_InkeyPut( PHB_GT pGT, int iKey ) /* Inset the key into head of keyboard buffer */ static void hb_gt_def_InkeyIns( PHB_GT pGT, int iKey ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyIns(%p,%d)", pGT, iKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyIns(%p,%d)", ( void * ) pGT, iKey ) ); if( --pGT->inkeyTail < 0 ) pGT->inkeyTail = pGT->inkeyBufferSize - 1; @@ -2805,7 +2811,7 @@ static void hb_gt_def_InkeyIns( PHB_GT pGT, int iKey ) /* helper internal function */ static HB_BOOL hb_gt_def_InkeyNextCheck( PHB_GT pGT, int iEventMask, int * iKey ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyNextCheck(%p,%p)", pGT, iKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyNextCheck(%p,%p)", ( void * ) pGT, ( void * ) iKey ) ); if( pGT->StrBuffer ) { @@ -2840,7 +2846,7 @@ static void hb_gt_def_InkeyPollDo( PHB_GT pGT ) { int iKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyPollDo(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyPollDo(%p)", ( void * ) pGT ) ); iKey = HB_GTSELF_READKEY( pGT, HB_INKEY_ALL | HB_INKEY_EXT ); @@ -2897,14 +2903,14 @@ static void hb_gt_def_InkeyPollDo( PHB_GT pGT ) /* Poll the console keyboard to stuff the Harbour buffer */ static void hb_gt_def_InkeyPoll( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyPoll(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyPoll(%p)", ( void * ) pGT ) ); /* * Clipper 5.3 always poll events without respecting * _SET_TYPEAHEAD when CL5.2 only when it's non zero. - * IMHO keeping CL5.2 behavior will be more accurate for harbour + * IMHO keeping CL5.2 behavior will be more accurate for Harbour * because it allows to control it by user what some times could be - * necessary due to different low level GT behavior on some platforms + * necessary due to different low-level GT behavior on some platforms */ if( hb_setGetTypeAhead() ) hb_gt_def_InkeyPollDo( pGT ); @@ -2915,7 +2921,7 @@ static int hb_gt_def_InkeyNext( PHB_GT pGT, int iEventMask ) { int iKey = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyNext(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyNext(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_GTSELF_INKEYPOLL( pGT ); hb_gt_def_InkeyNextCheck( pGT, iEventMask, &iKey ); @@ -2930,14 +2936,14 @@ static int hb_gt_def_InkeyGet( PHB_GT pGT, HB_BOOL fWait, double dSeconds, int i HB_MAXINT timeout; PHB_ITEM pKey; HB_BOOL fPop; - int iKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyGet(%p,%d,%f,%d)", pGT, ( int ) fWait, dSeconds, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyGet(%p,%d,%f,%d)", ( void * ) pGT, ( int ) fWait, dSeconds, iEventMask ) ); pKey = NULL; if( pGT->pInkeyReadBlock ) { + int iKey; HB_GTSELF_UNLOCK( pGT ); iKey = hb_itemGetNI( hb_vmEvalBlock( pGT->pInkeyReadBlock ) ); HB_GTSELF_LOCK( pGT ); @@ -2988,7 +2994,7 @@ static int hb_gt_def_InkeyGet( PHB_GT pGT, HB_BOOL fWait, double dSeconds, int i /* Return the value of the last key that was extracted */ static int hb_gt_def_InkeyLast( PHB_GT pGT, int iEventMask ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyLast(%p,%d)", pGT, iEventMask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyLast(%p,%d)", ( void * ) pGT, iEventMask ) ); HB_GTSELF_INKEYPOLL( pGT ); @@ -3000,7 +3006,7 @@ static int hb_gt_def_InkeySetLast( PHB_GT pGT, int iKey ) { int iLast; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeySetLast(%p,%d)", pGT, iKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeySetLast(%p,%d)", ( void * ) pGT, iKey ) ); iLast = pGT->inkeyLast; pGT->inkeyLast = iKey; @@ -3011,7 +3017,7 @@ static int hb_gt_def_InkeySetLast( PHB_GT pGT, int iKey ) /* Set text into inkey buffer */ static void hb_gt_def_InkeySetText( PHB_GT pGT, const char * szText, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeySetText(%p,%s,%" HB_PFS "u)", pGT, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeySetText(%p,%s,%" HB_PFS "u)", ( void * ) pGT, szText, nLen ) ); if( pGT->StrBuffer ) { @@ -3043,7 +3049,7 @@ static void hb_gt_def_InkeyReset( PHB_GT pGT ) { int iTypeAhead; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyReset(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyReset(%p)", ( void * ) pGT ) ); if( pGT->StrBuffer ) { @@ -3078,7 +3084,7 @@ static void hb_gt_def_InkeyReset( PHB_GT pGT ) /* reset inkey pool to default state and free any allocated resources */ static void hb_gt_def_InkeyExit( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyExit(%p)", pGT ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeyExit(%p)", ( void * ) pGT ) ); if( pGT->StrBuffer ) { @@ -3378,7 +3384,7 @@ static void hb_gt_def_WhoCares( PHB_GT pGT, void * pCargo ) HB_SYMBOL_UNUSED( pCargo ); } -/* ************************************************************************* */ +/* - */ #if defined( __GNUC__ ) && 0 static const HB_GT_FUNCS s_gtCoreFunc = @@ -3640,7 +3646,7 @@ static const HB_GT_FUNCS s_gtCoreFunc = }; #endif -/* ************************************************************************* */ +/* - */ static char s_gtNameBuf[ HB_GT_NAME_MAX_ + 1 ]; @@ -3724,11 +3730,9 @@ HB_BOOL hb_gtRegister( const HB_GT_INIT * gtInit ) PHB_GT hb_gtLoad( const char * szGtName, PHB_GT pGT, PHB_GT_FUNCS pSuperTable ) { - int iPos; - if( szGtName ) { - iPos = hb_gt_FindEntry( szGtName ); + int iPos = hb_gt_FindEntry( szGtName ); if( iPos == -1 ) { diff --git a/src/rtl/hbhex.c b/src/rtl/hbhex.c index 61521bde8a..74e9623883 100644 --- a/src/rtl/hbhex.c +++ b/src/rtl/hbhex.c @@ -1,6 +1,5 @@ /* - * hb_NumToHex() - * hb_HexToNum() + * hb_NumToHex(), hb_HexToNum() * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -182,7 +181,6 @@ HB_FUNC( HB_HEXTOSTR ) { HB_SIZE nDest, ul; const char * szPtr; - char * szDest; szPtr = szStr; ul = nStr; @@ -202,7 +200,8 @@ HB_FUNC( HB_HEXTOSTR ) { int iVal = 0x10; - szDest = ( char * ) hb_xgrab( nDest + 1 ); + char * szDest = ( char * ) hb_xgrab( nDest + 1 ); + /* ul = 0; see above stop condition */ do { diff --git a/src/rtl/hbi18n1.c b/src/rtl/hbi18n1.c index 94a92884f1..d5bb6a9425 100644 --- a/src/rtl/hbi18n1.c +++ b/src/rtl/hbi18n1.c @@ -141,7 +141,7 @@ static const HB_PLURAL_FORMS s_plural_forms[] = { "VI", HB_I18N_PLURAL_VI } }; -#define HB_PLURAL_FOMRS_COUNT ( sizeof( s_plural_forms ) / sizeof( HB_PLURAL_FORMS ) ) +#define HB_PLURAL_FOMRS_COUNT HB_SIZEOFARRAY( s_plural_forms ) static const HB_UCHAR s_signature[ 4 ] = { 193, 'H', 'B', 'L' }; typedef struct _HB_I18N_TRANS @@ -379,7 +379,7 @@ static PHB_I18N_TRANS hb_i18n_initialize( PHB_ITEM pTable ) if( HB_IS_HASH( pTable ) ) { - PHB_ITEM pKey, pContext, pDefContext = NULL, pValue; + PHB_ITEM pKey, pContext, pDefContext = NULL; pKey = hb_itemPutCConst( NULL, "CONTEXT" ); pContext = hb_hashGetItemPtr( pTable, pKey, 0 ); @@ -391,6 +391,8 @@ static PHB_I18N_TRANS hb_i18n_initialize( PHB_ITEM pTable ) if( pContext && pDefContext ) { + PHB_ITEM pValue; + pI18N = ( PHB_I18N_TRANS ) hb_xgrabz( sizeof( HB_I18N_TRANS ) ); hb_atomic_set( &pI18N->iUsers, 1 ); pI18N->table = pTable; @@ -660,7 +662,7 @@ static const char * hb_i18n_setcodepage( PHB_I18N_TRANS pI18N, const char * szCdpID, HB_BOOL fBase, HB_BOOL fTranslate ) { - const char * szOldCdpID = NULL, * szKey; + const char * szOldCdpID = NULL; if( pI18N ) { @@ -671,6 +673,8 @@ static const char * hb_i18n_setcodepage( PHB_I18N_TRANS pI18N, szOldCdpID = cdpage->id; if( cdp && cdp != cdpage ) { + const char * szKey; + if( fTranslate && cdpage ) { HB_SIZE nHashLen = hb_hashLen( pI18N->context_table ), ul; @@ -1036,9 +1040,10 @@ HB_FUNC( HB_I18N_ADDTEXT ) { if( HB_IS_ARRAY( pTrans ) ) { - HB_SIZE nLen = hb_arrayLen( pTrans ), n; + HB_SIZE nLen = hb_arrayLen( pTrans ); if( nLen != 0 ) { + HB_SIZE n; for( n = 1; n <= nLen; ++n ) { if( ! HB_IS_STRING( hb_arrayGetItemPtr( pTrans, n ) ) ) diff --git a/src/rtl/hbinet.c b/src/rtl/hbinet.c index 9950646065..a5afe41f81 100644 --- a/src/rtl/hbinet.c +++ b/src/rtl/hbinet.c @@ -1,15 +1,13 @@ /* * The internet protocol / TCP support * - * Copyright 2002 Giancarlo Niccolai [gian@niccolai.ws] + * Copyright 2002 Giancarlo Niccolai <gian@niccolai.ws> * Ron Pinkas [Ron@RonPinkas.com] * Marcelo Lombardo [marcelo.lombardo@newage-software.com.br] - * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * updated and ported to Harbour - * * Copyright 2008 Miguel Angel marchuet <miguelangel@marchuet.net> - * added dinamic system buffer + * added dynamic system buffer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,8 +91,8 @@ typedef struct do \ { \ HB_INET_INITIALIZE(); \ - s = ( PHB_SOCKET_STRUCT ) hb_gcAllocate( sizeof( HB_SOCKET_STRUCT ), &s_gcInetFuncs ); \ - memset( s, 0, sizeof( HB_SOCKET_STRUCT ) ); \ + s = ( PHB_SOCKET_STRUCT ) hb_gcAllocate( sizeof( *s ), &s_gcInetFuncs ); \ + memset( s, 0, sizeof( *s ) ); \ s->sd = HB_NO_SOCKET; \ s->readahead = HB_INET_BUFFER_LEN; \ s->iTimeout = -1; \ @@ -230,9 +228,7 @@ static const HB_GC_FUNCS s_gcInetFuncs = hb_inetSocketMark }; -/***************************************************** - * Socket Initialization - ***/ +/* Socket Initialization */ static void hb_inetAutoInit( void ) { @@ -320,9 +316,7 @@ HB_FUNC( HB_INETCLEANUP ) hb_socketCleanup(); } -/***************************************************** - * Socket Creation and destruction - ***/ +/* Socket Creation and destruction */ HB_FUNC( HB_INETCREATE ) { @@ -372,9 +366,7 @@ HB_FUNC( HB_INETFD ) hb_inetErrRT(); } -/************************************************ - * Socket data access & management - ***/ +/* Socket data access & management */ HB_FUNC( HB_INETSTATUS ) { @@ -653,9 +645,7 @@ HB_FUNC( HB_INETSETRCVBUFSIZE ) -/******************************************************************** - * TCP receive and send functions - ***/ +/* TCP receive and send functions */ static long s_inetRecv( PHB_SOCKET_STRUCT socket, char * buffer, long size, HB_BOOL readahead, HB_MAXINT timeout ) @@ -1100,9 +1090,7 @@ HB_FUNC( HB_INETSENDALL ) } -/******************************************* - * Name resolution interface functions - ***/ +/* Name resolution interface functions */ HB_FUNC( HB_INETGETHOSTS ) { @@ -1143,9 +1131,8 @@ HB_FUNC( HB_INETGETALIAS ) } -/********************************************** - * Interface information function - ****/ +/* Interface information function */ + HB_FUNC( HB_INETIFINFO ) { PHB_ITEM pInfo; @@ -1159,9 +1146,7 @@ HB_FUNC( HB_INETIFINFO ) hb_reta( 0 ); } -/********************************************** - * Server Specific functions - ****/ +/* Server Specific functions */ static int s_inetBind( PHB_SOCKET_STRUCT socket, const void * pSockAddr, unsigned uiLen ) { @@ -1247,22 +1232,21 @@ HB_FUNC( HB_INETACCEPT ) } } -/********************************************** - * Client specific (connection functions) - ****/ +/* Client specific (connection functions) */ static void hb_inetConnectInternal( HB_BOOL fResolve ) { const char * szHost = hb_parc( 1 ); char * szAddr = NULL; PHB_SOCKET_STRUCT socket = HB_PARSOCKET( 3 ); - PHB_ITEM pSocket = NULL; int iPort = hb_parni( 2 ); if( szHost == NULL || iPort == 0 || ( socket == NULL && ! HB_ISNIL( 3 ) ) ) hb_inetErrRT(); else { + PHB_ITEM pSocket = NULL; + if( ! socket ) HB_SOCKET_INIT( socket, pSocket ); else if( socket->sd != HB_NO_SOCKET ) @@ -1320,9 +1304,7 @@ HB_FUNC( HB_INETCONNECTIP ) hb_inetConnectInternal( HB_FALSE ); } -/*********************************************************** - * Datagram functions - ************************************************************/ +/* Datagram functions */ HB_FUNC( HB_INETDGRAMBIND ) { @@ -1479,7 +1461,7 @@ HB_FUNC( HB_INETDGRAMRECV ) { fRepeat = HB_FALSE; if( socket->remote ) - hb_xfree( socket->remote ); + hb_xfree( socket->remote ); /* FIXME: double free */ iMax = hb_socketRecvFrom( socket->sd, buffer, iLen, 0, &socket->remote, &socket->remotelen, socket->iTimeout ); @@ -1503,10 +1485,7 @@ HB_FUNC( HB_INETDGRAMRECV ) } } - -/*********************************************************** - * Generic utility(?) functions - ************************************************************/ +/* Generic utility(?) functions */ HB_FUNC( HB_INETCRLF ) { diff --git a/src/rtl/hbini.prg b/src/rtl/hbini.prg index 2eeaf89ef3..0263424a31 100644 --- a/src/rtl/hbini.prg +++ b/src/rtl/hbini.prg @@ -3,43 +3,44 @@ * * Copyright 2002 Giancarlo Niccolai <gian@niccolai.ws> * - * this program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General public License as published by + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * - * this program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the - * GNU General public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General public License - * along with this software; see the file COPYING.txt. if not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/). + * You should have received a copy of the GNU General Public License + * along with this program; see the file LICENSE.txt. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/). * - * As a special exception, xHarbour license gives permission for - * additional uses of the text contained in its release of xHarbour. + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. * - * The exception is that, if you link the xHarbour libraries with other + * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General public License. + * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of - * linking the xHarbour library code into it. + * linking the Harbour library code into it. * - * this exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General public License. + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. * - * this exception applies only to the code released with this xHarbour - * explicit exception. if you add/copy code from other sources, - * as the General public License permits, the above exception does + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * - * if you write modifications of your own for xHarbour, it is your choice + * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. - * if you do not wish that, delete this exception notice. + * If you do not wish that, delete this exception notice. * */ @@ -49,7 +50,7 @@ * ; A line starting with a ';' is a comment * # Also, a '#' marks a comment up to the end of the line * [NewSection] - * Variable = Value + * Variable=Value * OtherVariable: Value * * You can pass a list of "potential" .ini files in a ';' separated path; @@ -64,7 +65,7 @@ * "SectionN" => { "Key1" => "Val1", ... , "KeyN" => "ValN" } * } * - * Main is the default section (variables that are declared without a section). + * 'MAIN' is the default section (variables that are declared without a section). * */ @@ -96,7 +97,6 @@ FUNCTION hb_iniNew( lAutoMain ) RETURN hIni FUNCTION hb_iniRead( cFileSpec, lKeyCaseSens, cSplitters, lAutoMain ) - RETURN hb_iniReadStr( iif( HB_ISSTRING( cFileSpec ), hb_iniFileLow( cFileSpec ), "" ), lKeyCaseSens, cSplitters, lAutoMain ) FUNCTION hb_iniReadStr( cData, lKeyCaseSens, cSplitters, lAutoMain ) @@ -160,7 +160,7 @@ STATIC FUNCTION hb_iniStringLow( hIni, cData, lKeyCaseSens, cSplitters, lAutoMai reSection := hb_regexComp( "[[](.*)[]]" ) reSplitters := hb_regexComp( cSplitters ) - /* Always begin with the MAIN section */ + /* Always begin with the 'MAIN' section */ hCurrentSection := iif( lAutoMain, hIni[ "MAIN" ], hIni ) cLine := "" @@ -283,27 +283,27 @@ FUNCTION hb_iniWriteStr( hIni, cCommentBegin, cCommentEnd, lAutoMain ) lAutoMain := .F. ENDIF - /* Write toplevel section */ + /* Write top-level section */ IF lAutoMain - /* When automain is on, write the main section */ + /* When lAutoMain is on, write the 'main' section */ hb_HEval( hIni[ "MAIN" ], {| cKey, xVal | ; cBuffer += hb_CStr( cKey ) + "=" + hb_CStr( xVal ) + cNewLine } ) ELSE - /* When automain is off, just write all the toplevel variables. */ + /* When lAutoMain is off, just write all the top-level variables. */ hb_HEval( hIni, {| cKey, xVal | iif( HB_ISHASH( xVal ), /* nothing */, ; cBuffer += hb_CStr( cKey ) + "=" + hb_CStr( xVal ) + cNewLine ) } ) ENDIF FOR EACH cSection IN hIni - /* Avoid re-processing main section */ + /* Avoid re-processing 'MAIN' section */ IF lAutoMain - /* When automain is on, skip section named MAIN */ + /* When lAutoMain is on, skip section named 'MAIN' */ IF cSection:__enumKey == "MAIN" LOOP ENDIF ELSE - /* When automain is off, skip all the toplevel variables. */ + /* When lAutoMain is off, skip all the top-level variables. */ IF ! HB_ISHASH( cSection ) LOOP ENDIF diff --git a/src/rtl/hbjson.c b/src/rtl/hbjson.c index e7877ac46c..2155fe5773 100644 --- a/src/rtl/hbjson.c +++ b/src/rtl/hbjson.c @@ -52,14 +52,14 @@ /* The application/json Media Type for JavaScript Object Notation (JSON) - http://www.ietf.org/rfc/rfc4627.txt + https://tools.ietf.org/html/rfc4627 C level functions: char * hb_jsonEncode( PHB_ITEM pValue, HB_SIZE * pnLen, HB_BOOL fHuman ); pValue - value to encode; pnLen - if pnLen is not NULL, length of returned buffer is stored to *pnLen; - fHuman - format to be human redable; + fHuman - format to be human readable; returns pointer to encoded JSON buffer. buffer must be fried by the caller. @@ -72,8 +72,9 @@ purposes. Returns 0 on error. Harbour level functions: - hb_jsonDecode( cJSON, @xValue ) --> nLengthDecoded hb_jsonEncode( xValue [, lHuman = .F. ] ) --> cJSON + hb_jsonDecode( cJSON ) --> xValue + hb_jsonDecode( cJSON, @xValue ) --> nLengthDecoded Note: - JSON encode functions are safe for recursive arrays and hashes. @@ -174,7 +175,7 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, if( HB_IS_STRING( pValue ) ) { - HB_SIZE nPos, nPos2, nLen; + HB_SIZE nPos, nLen; const char * szString; void * hString = NULL; char buf[ 8 ]; @@ -194,7 +195,7 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, while( nPos < nLen ) { unsigned char uch = szString[ nPos ]; - nPos2 = nPos; + HB_SIZE nPos2 = nPos; while( uch >= ' ' && uch != '\\' && uch != '\"' ) uch = szString[ ++nPos2 ]; if( nPos2 > nPos ) @@ -389,7 +390,7 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, } else { - /* All unsupported types are replacd by null */ + /* All unsupported types are replaced by null */ _hb_jsonCtxAdd( pCtx, "null", 4 ); } } @@ -733,9 +734,7 @@ HB_FUNC( HB_JSONENCODE ) if( pItem ) { HB_SIZE nLen; - char * szRet; - - szRet = hb_jsonEncodeCP( pItem, &nLen, hb_parl( 2 ), _hb_jsonCdpPar( 3 ) ); + char * szRet = hb_jsonEncodeCP( pItem, &nLen, hb_parl( 2 ), _hb_jsonCdpPar( 3 ) ); hb_retclen_buffer( szRet, nLen ); } } diff --git a/src/rtl/hblpp.c b/src/rtl/hblpp.c index 8c5126f787..68714da9ee 100644 --- a/src/rtl/hblpp.c +++ b/src/rtl/hblpp.c @@ -44,24 +44,21 @@ * */ - #include "hbapiitm.h" #include "hbapierr.h" #include "hbdate.h" #include "hblpp.h" - PHB_LPP hb_lppCreate( HB_SOCKET sd ) { PHB_LPP pSocket; - pSocket = ( PHB_LPP ) hb_xgrabz( sizeof( HB_LPP ) ); - pSocket->sd = sd; + pSocket = ( PHB_LPP ) hb_xgrabz( sizeof( HB_LPP ) ); + pSocket->sd = sd; pSocket->nLimit = 1024; return pSocket; } - void hb_lppDestroy( PHB_LPP pSocket ) { if( pSocket->pSendBuffer ) @@ -73,19 +70,16 @@ void hb_lppDestroy( PHB_LPP pSocket ) hb_xfree( pSocket ); } - void hb_lppSetLimit( PHB_LPP pSocket, HB_SIZE nLimit ) { pSocket->nLimit = nLimit; } - int hb_lppError( PHB_LPP pSocket ) { return pSocket->iError; } - HB_BOOL hb_lppSend( PHB_LPP pSocket, const void * data, HB_SIZE len, HB_MAXINT timeout ) { HB_MAXUINT timer; @@ -120,7 +114,7 @@ HB_BOOL hb_lppSend( PHB_LPP pSocket, const void * data, HB_SIZE len, HB_MAXINT t { hb_xfree( pSocket->pSendBuffer ); pSocket->pSendBuffer = NULL; - pSocket->iError = 0; + pSocket->iError = 0; return HB_TRUE; } if( ( timeout = hb_timerTest( timeout, &timer ) ) == 0 ) @@ -131,7 +125,6 @@ HB_BOOL hb_lppSend( PHB_LPP pSocket, const void * data, HB_SIZE len, HB_MAXINT t } } - HB_BOOL hb_lppRecv( PHB_LPP pSocket, void ** data, HB_SIZE * len, HB_MAXINT timeout ) { HB_MAXUINT timer; @@ -139,8 +132,8 @@ HB_BOOL hb_lppRecv( PHB_LPP pSocket, void ** data, HB_SIZE * len, HB_MAXINT time if( ! pSocket->pRecvBuffer ) { - pSocket->pRecvBuffer = ( char * ) hb_xgrab( 4 ); - pSocket->nRecvLen = 0; + pSocket->pRecvBuffer = ( char * ) hb_xgrab( 4 ); + pSocket->nRecvLen = 0; pSocket->fRecvHasSize = HB_FALSE; } @@ -182,7 +175,7 @@ HB_BOOL hb_lppRecv( PHB_LPP pSocket, void ** data, HB_SIZE * len, HB_MAXINT time return HB_FALSE; } - pSocket->nRecvLen = 0; + pSocket->nRecvLen = 0; pSocket->fRecvHasSize = HB_TRUE; if( pSocket->nRecvSize != 4 ) pSocket->pRecvBuffer = ( char * ) hb_xrealloc( pSocket->pRecvBuffer, pSocket->nRecvSize ); @@ -209,10 +202,10 @@ HB_BOOL hb_lppRecv( PHB_LPP pSocket, void ** data, HB_SIZE * len, HB_MAXINT time pSocket->nRecvLen += lRecv; if( pSocket->nRecvSize == pSocket->nRecvLen ) { - * data = pSocket->pRecvBuffer; - * len = pSocket->nRecvLen; + *data = pSocket->pRecvBuffer; + *len = pSocket->nRecvLen; pSocket->pRecvBuffer = NULL; - pSocket->iError = 0; + pSocket->iError = 0; return HB_TRUE; } if( ( timeout = hb_timerTest( timeout, &timer ) ) == 0 ) @@ -223,13 +216,11 @@ HB_BOOL hb_lppRecv( PHB_LPP pSocket, void ** data, HB_SIZE * len, HB_MAXINT time } } - HB_SIZE hb_lppSendLen( PHB_LPP pSocket ) { return pSocket->nSendLen - pSocket->nSendPos; } - HB_SIZE hb_lppRecvLen( PHB_LPP pSocket ) { return pSocket->nRecvLen; diff --git a/src/rtl/hblpphb.c b/src/rtl/hblpphb.c index 3a5a21e5d6..eb66cd9cdd 100644 --- a/src/rtl/hblpphb.c +++ b/src/rtl/hblpphb.c @@ -44,20 +44,17 @@ * */ - -/* - - Idea and protocol +/* Idea and protocol ================= Very often it is required to accept the whole data message from TCP connection. Because of stream nature of TCP, this requires additional steps from application like start/end marker, or sending length of structure before the structure. The latter simple approach was used in Length Prefix Protocol (LPP). Protocol can easily be - described by simple Clipper expression: - Bin2L(Len(cData)) + cData + described by simple Harbour expression: + Bin2L( hb_BLen( cData ) ) + cData - Future extensions: Protocol is limitted to 4GB size for a single LPP + Future extensions: Protocol is limited to 4 GiB size for a single LPP message. This can be extended in future to use highest bit of length (or some highest length values 2^32-1, etc) as a special marker for 64-bit or similar length encoding. @@ -74,13 +71,13 @@ the only new error code (until now) is HB_LPP_ERROR_TOOLARGE hb_lppSetLimit( hLPP, nLimit ) Sets size limit for receiving data. Sending 4 bytes containing - large 32-bit value makes receiving application to alllocate a + large 32-bit value makes receiving application to allocate a large memory block for storage of data to be received. It is very easy to crash application (or system) using such protocol and logic. hb_lppSetLimit() helps to protect against such attacks. On hb_lppCreate() limit is set to 1024 bytes. This is enough - for server/client authentification. After successful - authentification server can increase size limit and large LPP + for server/client authentication. After successful + authentication server can increase size limit and large LPP packets can be used. hb_lppSend( hLPP, cBuf [, nTimeout = FOREVER ] ) --> lSuccess hb_lppRecv( hLPP, @cBuf [, nTimeout = FOREVER ] ) --> lSuccess @@ -95,7 +92,7 @@ hLPP := hb_lppCreate( hSocket ) DO WHILE ! ( lI := hb_lppSend( hLPP, cData, nTimeout ) ) .AND. ; hb_lppError( hLPP ) == HB_SOCKET_ERR_TIMEOUT ) - // draw progressbar using hb_lppSendLen( hLPP ) + // draw progress bar using hb_lppSendLen( hLPP ) ENDDO IF lI // or hb_lppError( hLPP ) == 0 // Sent OK @@ -108,7 +105,7 @@ // recv sample DO WHILE ! ( lI := hb_lppRecv( hLPP, @cData, nTimeout ) ) .AND. ; hb_lppError( hLPP ) == HB_SOCKET_ERR_TIMEOUT ) - // draw progressbar using hb_lppRecvLen( hLPP ) + // draw progress bar using hb_lppRecvLen( hLPP ) ENDDO IF lI // Rcvd OK, data in cData @@ -117,7 +114,6 @@ ELSE // error ENDIF - */ #include "hbapiitm.h" diff --git a/src/rtl/hbmd5.c b/src/rtl/hbmd5.c index 07cdb1e01c..26f5f31d89 100644 --- a/src/rtl/hbmd5.c +++ b/src/rtl/hbmd5.c @@ -1,8 +1,9 @@ /* + * WARNING: Outdated, insecure algorithm. + * * Harbour MD5 Support * * Copyright 2004 Dmitry V. Korzhov <dk@april26.spb.ru> - * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * updated for current Harbour code, other then x86@32 machines, * files and buffers longer then 2^32 and some fixes @@ -53,7 +54,7 @@ PRG functions: - hb_MD5( <cString> ) -> <cMD5> + hb_MD5( <cString> ) --> <cMD5> Calculates RFC 1321 MD5 digest (128-bit checksum) Parameters: <cString> - string variable to calculate MD5 @@ -61,7 +62,7 @@ ASCII hex MD5 digest as 32-byte string empty string on error - hb_MD5File( <cFileName> ) -> <cMD5> + hb_MD5File( <cFileName> ) --> <cMD5> Calculates RFC 1321 MD5 digest (128-bit checksum) of a file contents (file size is limited by OS limits only) Parameters: @@ -84,7 +85,7 @@ typedef struct } MD5_BUF; /* - Pseudofunctions; + Pseudo-functions; A[x] - accumulators[4] T[x] - Value table[64] X[x] - buffer[16] @@ -248,7 +249,7 @@ void hb_md5( const void * data, HB_SIZE nLen, char * digest ) /* perform startup procedures */ hb_md5accinit( md5.accum ); - /* count full 512bit blocks in data*/ + /* count full 512-bit blocks in data*/ n = nLen >> 6; /* process full blocks */ for( i = 0; i < n; i++, ucdata += 64 ) @@ -358,7 +359,7 @@ HB_BOOL hb_md5file( const char * pszFileName, char * digest ) return HB_FALSE; } -HB_FUNC( HB_MD5 ) +HB_FUNC( HB_MD5 ) /* Considered insecure. Use SHA256 or higher instead. */ { const char * pszStr = hb_parc( 1 ); @@ -382,7 +383,7 @@ HB_FUNC( HB_MD5 ) hb_retc_null(); /* return empty string on wrong call */ } -HB_FUNC( HB_MD5FILE ) +HB_FUNC( HB_MD5FILE ) /* Considered insecure. Use SHA256 or higher instead. */ { const char * pszFileName = hb_parc( 1 ); char dststr[ 16 ]; diff --git a/src/rtl/hbmd5enc.c b/src/rtl/hbmd5enc.c index 654ba8bc90..a1119812f8 100644 --- a/src/rtl/hbmd5enc.c +++ b/src/rtl/hbmd5enc.c @@ -1,6 +1,6 @@ /* * PRG functions for MD5 encryption/decryption using - * CFB (cipher feedback) mode + * CFB (cipher feedback) mode * * Copyright 2012 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -63,7 +63,7 @@ static void hb_md5_next_seed( char * vect, const char * pszKey, int iLen ) hb_md5( vect, 16, vect ); } -/* hb_MD5Encrypt( <cText>, <cPasswd> ) -> <cCipher> +/* hb_MD5Encrypt( <cText>, <cPasswd> ) --> <cCipher> */ HB_FUNC( HB_MD5ENCRYPT ) { @@ -71,7 +71,7 @@ HB_FUNC( HB_MD5ENCRYPT ) if( pData && hb_parclen( 2 ) > 0 ) { - HB_SIZE nLen = hb_itemGetCLen( pData ), n; + HB_SIZE nLen = hb_itemGetCLen( pData ); if( nLen ) { @@ -80,6 +80,7 @@ HB_FUNC( HB_MD5ENCRYPT ) const char * pszKey = hb_parc( 2 ); int iLen = ( int ) hb_parclen( 2 ); char vect[ 16 ]; + HB_SIZE n; hb_md5_init_seed( vect, pszKey, iLen ); @@ -97,7 +98,7 @@ HB_FUNC( HB_MD5ENCRYPT ) } } -/* hb_MD5Decrypt( <cCipher>, <cPasswd> ] ) -> <cText> +/* hb_MD5Decrypt( <cCipher>, <cPasswd> ] ) --> <cText> */ HB_FUNC( HB_MD5DECRYPT ) { @@ -105,7 +106,7 @@ HB_FUNC( HB_MD5DECRYPT ) if( pData && hb_parclen( 2 ) > 0 ) { - HB_SIZE nLen = hb_itemGetCLen( pData ), n; + HB_SIZE nLen = hb_itemGetCLen( pData ); if( nLen ) { @@ -114,6 +115,7 @@ HB_FUNC( HB_MD5DECRYPT ) const char * pszKey = hb_parc( 2 ); int iLen = ( int ) hb_parclen( 2 ); char vect[ 16 ]; + HB_SIZE n; hb_md5_init_seed( vect, pszKey, iLen ); diff --git a/src/rtl/hbproces.c b/src/rtl/hbproces.c index 6631093c45..e421af4282 100644 --- a/src/rtl/hbproces.c +++ b/src/rtl/hbproces.c @@ -1,5 +1,5 @@ /* - * low level functions to create, wait and terminate processes + * Low-level functions to create, wait and terminate processes * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * based on xHarbour code by @@ -235,7 +235,7 @@ static void hb_getCommand( const char * pszFileName, #elif defined( HB_PROCESS_USEFILES ) || defined( HB_OS_UNIX ) -/* convert command to argument list using standard bourne shell encoding: +/* convert command to argument list using standard Bourne shell encoding: * "" and '' can be used to group parameters with blank characters, * the escape character is '\', quoting by '' disables escape character. */ @@ -508,7 +508,7 @@ HB_FHANDLE hb_fsProcessOpen( const char * pszFileName, HB_FHANDLE hResult = FS_ERROR; HB_BOOL fError = HB_FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsProcessOpen(%s, %p, %p, %p, %d, %p)", pszFileName, phStdin, phStdout, phStderr, fDetach, pulPID ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsProcessOpen(%s, %p, %p, %p, %d, %p)", pszFileName, ( void * ) phStdin, ( void * ) phStdout, ( void * ) phStderr, fDetach, ( void * ) pulPID ) ); if( phStdin != NULL ) fError = ! hb_fsPipeCreate( hPipeIn ); @@ -1133,7 +1133,7 @@ int hb_fsProcessRun( const char * pszFileName, HB_SIZE nOutSize, nErrSize, nOutBuf, nErrBuf; int iResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_fsProcessRun(%s, %p, %" HB_PFS "u, %p, %p, %p, %p, %d)", pStdInBuf, pStdInBuf, nStdInLen, pStdOutPtr, pulStdOut, pStdErrPtr, pulStdErr, fDetach ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsProcessRun(%s, %p, %" HB_PFS "u, %p, %p, %p, %p, %d)", pszFileName, ( const void * ) pStdInBuf, nStdInLen, ( void * ) pStdOutPtr, ( void * ) pulStdOut, ( void * ) pStdErrPtr, ( void * ) pulStdErr, fDetach ) ); nOutBuf = nErrBuf = nOutSize = nErrSize = 0; pOutBuf = pErrBuf = NULL; @@ -1693,6 +1693,8 @@ int hb_fsProcessRun( const char * pszFileName, int iTODO; HB_SYMBOL_UNUSED( nStdInLen ); + HB_SYMBOL_UNUSED( nOutSize ); + HB_SYMBOL_UNUSED( nErrSize ); #endif } diff --git a/src/rtl/hbprocfn.c b/src/rtl/hbprocfn.c index ac42f682b5..ee9f5461be 100644 --- a/src/rtl/hbprocfn.c +++ b/src/rtl/hbprocfn.c @@ -56,10 +56,6 @@ HB_FUNC( HB_PROCESSOPEN ) PHB_ITEM pStdIn = hb_param( 2, HB_IT_BYREF ); PHB_ITEM pStdOut = hb_param( 3, HB_IT_BYREF ); PHB_ITEM pStdErr = hb_param( 4, HB_IT_BYREF ); - HB_BOOL fDetach = hb_parl( 5 ); - HB_FHANDLE hStdIn, *phStdIn, hStdOut, *phStdOut, hStdErr, *phStdErr; - HB_FHANDLE hProcess; - HB_ULONG ulPID; if( szName && ( pStdIn || HB_ISNIL( 2 ) ) && @@ -69,6 +65,11 @@ HB_FUNC( HB_PROCESSOPEN ) ( HB_ISBYREF( 6 ) || HB_ISNIL( 6 ) ) && ( ! pStdIn || ( pStdIn != pStdOut && pStdIn != pStdErr ) ) ) { + HB_BOOL fDetach = hb_parl( 5 ); + HB_FHANDLE hStdIn, *phStdIn, hStdOut, *phStdOut, hStdErr, *phStdErr; + HB_FHANDLE hProcess; + HB_ULONG ulPID; + phStdIn = pStdIn ? &hStdIn : NULL; phStdOut = pStdOut ? &hStdOut : NULL; phStdErr = pStdErr ? ( pStdOut == pStdErr ? phStdOut : &hStdErr ) : NULL; @@ -121,7 +122,7 @@ HB_FUNC( HB_PROCESSCLOSE ) } /* hb_processRun( <cCommand>, [ <cStdIn> ], [ @<cStdOut> ], [ @<cStdErr> ], ; - [ <lDetach> ] ) -> <nResult> */ + [ <lDetach> ] ) --> <nResult> */ HB_FUNC( HB_PROCESSRUN ) { const char * szName = hb_parc( 1 ); diff --git a/src/rtl/hbrand.c b/src/rtl/hbrand.c index 8b04e544ec..734443307e 100644 --- a/src/rtl/hbrand.c +++ b/src/rtl/hbrand.c @@ -45,7 +45,6 @@ */ #include "hbapi.h" - #include "arc4.h" void hb_random_block( void * data, HB_SIZE len ) diff --git a/src/rtl/hbregex.c b/src/rtl/hbregex.c index 33a153177a..1ea0d306be 100644 --- a/src/rtl/hbregex.c +++ b/src/rtl/hbregex.c @@ -1,5 +1,5 @@ /* - * + * Regex functions * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -114,7 +114,7 @@ static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE nLen, { for( i = 0; i < iMatches; i++ ) { - if( HB_REGMATCH_EO( aMatches, i ) != -1 ) + if( HB_REGMATCH_EO( aMatches, i ) != HB_REGMATCH_UNSET ) iResult = i + 1; } } @@ -129,13 +129,13 @@ static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE nLen, szString = szBuffer; } for( i = 0; i < iMatches; i++ ) - HB_REGMATCH_EO( aMatches, i ) = -1; + HB_REGMATCH_EO( aMatches, i ) = HB_REGMATCH_UNSET; iResult = regexec( &pRegEx->reg, szString, iMatches, aMatches, pRegEx->iEFlags ); if( iResult == 0 ) { for( i = 0; i < iMatches; i++ ) { - if( HB_REGMATCH_EO( aMatches, i ) != -1 ) + if( HB_REGMATCH_EO( aMatches, i ) != HB_REGMATCH_UNSET ) iResult = i + 1; } } @@ -166,7 +166,7 @@ HB_FUNC( HB_REGEXCOMP ) int iFlags = HBREG_EXTENDED; PHB_REGEX pRegEx; - if( ! hb_parldef( 2, 1 ) ) + if( ! hb_parldef( 2, HB_TRUE ) ) iFlags |= HBREG_ICASE; if( hb_parl( 3 ) ) iFlags |= HBREG_NEWLINE; @@ -192,7 +192,7 @@ HB_FUNC( HB_ATX ) if( pString ) { PHB_REGEX pRegEx = hb_regexGet( hb_param( 1, HB_IT_ANY ), - ! hb_parldef( 3, 1 ) ? HBREG_ICASE : 0 ); + ! hb_parldef( 3, HB_TRUE ) ? HBREG_ICASE : 0 ); if( pRegEx ) { @@ -257,7 +257,7 @@ static HB_BOOL hb_regex( int iRequest ) return HB_FALSE; } pRegEx = hb_regexGet( hb_param( 1, HB_IT_ANY ), - ( ! hb_parldef( 3, 1 ) ? HBREG_ICASE : 0 ) | + ( ! hb_parldef( 3, HB_TRUE ) ? HBREG_ICASE : 0 ) | ( hb_parl( 4 ) ? HBREG_NEWLINE : 0 ) ); if( ! pRegEx ) return HB_FALSE; @@ -360,7 +360,7 @@ static HB_BOOL hb_regex( int iRequest ) PHB_ITEM pAtxArray; int iMax = hb_parni( 5 ); /* max nuber of matches I want, 0 = unlimited */ int iGetMatch = hb_parni( 6 ); /* Gets if want only one single match or a sub-match */ - HB_BOOL fOnlyMatch = hb_parldef( 7, 1 ); /* if HB_TRUE returns only matches and sub-matches, not positions */ + HB_BOOL fOnlyMatch = hb_parldef( 7, HB_TRUE ); /* if HB_TRUE returns only matches and sub-matches, not positions */ HB_SIZE nOffset = 0; int iCount = 0; int iSO, iEO; diff --git a/src/rtl/hbregexc.c b/src/rtl/hbregexc.c index d57702344c..9b3fcbfa52 100644 --- a/src/rtl/hbregexc.c +++ b/src/rtl/hbregexc.c @@ -1,5 +1,5 @@ /* - * + * Regex functions * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -106,8 +106,8 @@ PHB_REGEX hb_regexCompile( const char * szRegEx, HB_SIZE nLen, int iFlags ) HB_SYMBOL_UNUSED( nLen ); - pRegEx = ( PHB_REGEX ) hb_gcAllocate( sizeof( HB_REGEX ), &s_gcRegexFuncs ); - memset( pRegEx, 0, sizeof( HB_REGEX ) ); + pRegEx = ( PHB_REGEX ) hb_gcAllocate( sizeof( *pRegEx ), &s_gcRegexFuncs ); + memset( pRegEx, 0, sizeof( *pRegEx ) ); pRegEx->fFree = HB_TRUE; pRegEx->iFlags = iFlags; diff --git a/src/rtl/hbrunfun.c b/src/rtl/hbrunfun.c index 78e030056c..55263f3843 100644 --- a/src/rtl/hbrunfun.c +++ b/src/rtl/hbrunfun.c @@ -69,9 +69,7 @@ HB_FUNC( HB_RUN ) iResult = hb_fsProcessRun( pszCommand, NULL, 0, NULL, NULL, NULL, NULL, HB_FALSE ); #elif defined( HB_OS_WIN ) - LPTSTR lpCommand; - - lpCommand = HB_CHARDUP( pszCommand ); + LPTSTR lpCommand = HB_CHARDUP( pszCommand ); iResult = HB_WINAPI_SYSTEM( lpCommand ); hb_xfree( lpCommand ); #else diff --git a/src/rtl/hbsocket.c b/src/rtl/hbsocket.c index cfd6be5f36..549d5fad89 100644 --- a/src/rtl/hbsocket.c +++ b/src/rtl/hbsocket.c @@ -1,5 +1,5 @@ /* - * socket C API + * Socket C API * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -305,7 +305,7 @@ #endif #if defined( __POCC__ ) && ( __POCC__ >= 500 ) && defined( HB_OS_WIN_64 ) - /* TOFIX: Bad workaround for the '__WSAFDIsSet unresolved' problem + /* FIXME: Bad workaround for the '__WSAFDIsSet unresolved' problem in Pelles C 5.00.13 AMD64 mode, to make final executables link at all. Some hbsocket.c features (or the whole module) won't properly work though. [vszakats] */ @@ -328,7 +328,7 @@ #include "hbthread.h" #include "hbdate.h" -/* TODO change error description to sth more user friendly */ +/* TODO change error description to something more user friendly */ static const char * s_socketErrors[] = { "OK", "EPIPE", @@ -1865,7 +1865,7 @@ static int hb_socketSelectWRE( HB_SOCKET sd, HB_MAXINT timeout ) #else /* ! HB_HAS_POLL */ int iResult, iError; struct timeval tv; - fd_set wfds, * pefds; + fd_set wfds; # if defined( HB_OS_WIN ) fd_set efds; # endif @@ -1879,6 +1879,8 @@ static int hb_socketSelectWRE( HB_SOCKET sd, HB_MAXINT timeout ) for( ;; ) { + fd_set * pefds; + if( timeout < 0 ) { tv.tv_sec = 1; @@ -2118,6 +2120,7 @@ char * hb_socketAddrGetName( const void * pSockAddr, unsigned len ) { int iTODO; szAddr = NULL; + HB_SYMBOL_UNUSED( sa ); } # endif if( szAddr ) @@ -2502,7 +2505,7 @@ HB_SOCKET hb_socketAccept( HB_SOCKET sd, void ** pSockAddr, unsigned * puiLen, H HB_SOCKET newsd = HB_NO_SOCKET; HB_SOCKADDR_STORAGE st; socklen_t len = sizeof( st ); - int ret, err; + int ret; hb_vmUnlock(); if( pSockAddr && puiLen ) @@ -2513,6 +2516,8 @@ HB_SOCKET hb_socketAccept( HB_SOCKET sd, void ** pSockAddr, unsigned * puiLen, H ret = hb_socketSelectRD( sd, timeout ); if( ret > 0 ) { + int err; + /* it's necessary to set non blocking IO to be sure that application * will not be frozen inside accept(). It may happen if some asynchronous * network error appear after above Select() or when other thread @@ -2549,7 +2554,7 @@ HB_SOCKET hb_socketAccept( HB_SOCKET sd, void ** pSockAddr, unsigned * puiLen, H int hb_socketConnect( HB_SOCKET sd, const void * pSockAddr, unsigned uiLen, HB_MAXINT timeout ) { - int ret, blk, err, rawerr; + int ret, blk, err; hb_vmUnlock(); @@ -2580,6 +2585,7 @@ int hb_socketConnect( HB_SOCKET sd, const void * pSockAddr, unsigned uiLen, HB_M if( blk > 0 ) { + int rawerr; err = hb_socketGetOsError(); rawerr = err ? 0 : hb_socketGetError(); @@ -2818,8 +2824,8 @@ int hb_socketSetNoDelay( HB_SOCKET sd, HB_BOOL fNoDelay ) #if defined( TCP_NODELAY ) /* - * Turn off the nagle algorithm for the specified socket. - * The nagle algorithm says that we should delay sending + * Turn off the Nagle algorithm for the specified socket. + * The Nagle algorithm says that we should delay sending * partial packets in the hopes of getting more data. * There are bad interactions between persistent connections and * Nagle's algorithm that have severe performance penalties. @@ -2838,7 +2844,7 @@ int hb_socketSetNoDelay( HB_SOCKET sd, HB_BOOL fNoDelay ) } /* NOTE: For notes on Windows, see: - https://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx + https://msdn.microsoft.com/library/ms740621 [vszakats] */ int hb_socketSetExclusiveAddr( HB_SOCKET sd, HB_BOOL fExclusive ) { @@ -2872,7 +2878,7 @@ int hb_socketSetReuseAddr( HB_SOCKET sd, HB_BOOL fReuse ) * clean all pending connections addressed to previous port owner */ #if defined( HB_OS_WIN ) - /* SO_REUSEADDR in MS-Windows makes sth completly different + /* SO_REUSEADDR in MS-Windows makes something completely different * then in other OS-es */ HB_SYMBOL_UNUSED( sd ); @@ -2979,9 +2985,10 @@ int hb_socketSetMulticast( HB_SOCKET sd, int af, const char * szAddr ) { #if defined( HB_HAS_INET_PTON ) struct ipv6_mreq mreq; - int err = inet_pton( AF_INET6, szAddr, &mreq.ipv6mr_multiaddr ), ret; + int err = inet_pton( AF_INET6, szAddr, &mreq.ipv6mr_multiaddr ); if( err > 0 ) { + int ret; mreq.ipv6mr_interface = 0; #if ! defined( IPV6_JOIN_GROUP ) && defined( IPV6_ADD_MEMBERSHIP ) # define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP @@ -3499,7 +3506,7 @@ PHB_ITEM hb_socketGetHosts( const char * szAddr, int af ) if( iResult == 0 ) { - int iCount = 0, i; + int iCount = 0; ai = res; while( ai ) { @@ -3516,6 +3523,7 @@ PHB_ITEM hb_socketGetHosts( const char * szAddr, int af ) char * szResult = hb_socketAddrGetName( res->ai_addr, ( unsigned ) res->ai_addrlen ); if( szResult ) { + int i; for( i = 1; i <= iCount; ++i ) { if( strcmp( hb_arrayGetCPtr( pItem, i ), szResult ) == 0 ) @@ -3547,7 +3555,7 @@ PHB_ITEM hb_socketGetHosts( const char * szAddr, int af ) hb_vmUnlock(); - /* gethostbyname() in Windows and OS2 does not accept direct IP + /* gethostbyname() in Windows and OS/2 does not accept direct IP * addresses */ #if ( defined( HB_OS_WIN ) || defined( HB_OS_OS2 ) ) && \ diff --git a/src/rtl/hbsockhb.c b/src/rtl/hbsockhb.c index dabd464118..19bd881d02 100644 --- a/src/rtl/hbsockhb.c +++ b/src/rtl/hbsockhb.c @@ -115,7 +115,7 @@ static int s_sockexClose( PHB_SOCKEX pSock, HB_BOOL fClose ) return iResult; } -/* read data from extended socket, check internal readahead +/* read data from extended socket, check internal read-ahead buffer first */ static long s_sockexRead( PHB_SOCKEX pSock, void * data, long len, HB_MAXINT timeout ) { @@ -170,7 +170,7 @@ static long s_sockexFlush( PHB_SOCKEX pSock, HB_MAXINT timeout, HB_BOOL fSync ) If fBuffer parameter is set to true then only data already read from socket and stored in memory buffer should be checked without any timeout. Such call is executed just before inside - hb_sockexSelect() just before call to low level socket select() + hb_sockexSelect() just before call to low-level socket select() function. */ static int s_sockexCanRead( PHB_SOCKEX pSock, HB_BOOL fBuffer, HB_MAXINT timeout ) { diff --git a/src/rtl/hbstrfmt.c b/src/rtl/hbstrfmt.c index 4ad3cbbe30..21a1255ac3 100644 --- a/src/rtl/hbstrfmt.c +++ b/src/rtl/hbstrfmt.c @@ -1,5 +1,5 @@ /* - * hb_StrFormat() functions + * hb_StrFormat() function * * Copyright 2008 Mindaugas Kavaliauskas <dbtopas at dbtopas.lt> * @@ -491,14 +491,16 @@ PHB_ITEM hb_strFormat( PHB_ITEM pItemReturn, PHB_ITEM pItemFormat, int iCount, P HB_FUNC( HB_STRFORMAT ) { - PHB_ITEM pFormat = hb_param( 1, HB_IT_STRING ); - int i, iParams = hb_pcount(); - PHB_ITEM * pItemArray = NULL; + PHB_ITEM pFormat = hb_param( 1, HB_IT_STRING ); if( pFormat ) { + int iParams = hb_pcount(); + PHB_ITEM * pItemArray = NULL; + if( iParams > 1 ) { + int i; pItemArray = ( PHB_ITEM * ) hb_xgrab( ( iParams - 1 ) * sizeof( PHB_ITEM ) ); for( i = 1; i < iParams; i++ ) pItemArray[ i - 1 ] = hb_param( i + 1, HB_IT_ANY ); diff --git a/src/rtl/hbtoken.c b/src/rtl/hbtoken.c index 03d95512c2..7c2de7a418 100644 --- a/src/rtl/hbtoken.c +++ b/src/rtl/hbtoken.c @@ -1,5 +1,5 @@ /* - * + * hb_token*() functions * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -54,7 +54,7 @@ #define _HB_TOK_RESPECT_BQUOTE 0x04 #define _HB_TOK_ISDELIM 0x08 #define _HB_TOK_EOL_DELIM 0x10 -#define _HB_TOK_STRIP_QUUTE 0x20 +#define _HB_TOK_STRIP_QUOTE 0x20 static HB_SIZE hb_tokenCount( const char * szLine, HB_SIZE nLen, const char * szDelim, HB_SIZE nDelim, @@ -310,16 +310,19 @@ HB_FUNC( HB_TOKENGET ) /* like hb_tokenGet() but returns next token starting from passed position * (0 based) inside string, f.e.: - * hb_tokenPtr( cString, @nTokPos, Chr( 9 ) ) -> cToken + * hb_tokenPtr( cString, @nTokPos, Chr( 9 ) ) --> cToken */ HB_FUNC( HB_TOKENPTR ) { - const char * szLine, * szDelim, * szToken; - HB_SIZE nLen, nDelim, nSkip, nToken; + const char * szLine, * szDelim; + HB_SIZE nLen, nDelim; int iFlags; if( hb_tokenParam( 3, hb_parns( 2 ), &szLine, &nLen, &szDelim, &nDelim, &iFlags ) ) { + const char * szToken; + HB_SIZE nSkip, nToken; + szToken = hb_tokenGet( szLine, nLen, szDelim, &nDelim, iFlags, 1, &nToken ); if( szToken && nLen > nToken ) diff --git a/src/rtl/hbzlib.c b/src/rtl/hbzlib.c index d684a8de8b..26a6310d28 100644 --- a/src/rtl/hbzlib.c +++ b/src/rtl/hbzlib.c @@ -99,7 +99,7 @@ static int s_zlibCompress2( char ** pDstPtr, HB_SIZE * pnDst, z_stream stream; int iResult; - memset( &stream, 0, sizeof( z_stream ) ); + memset( &stream, 0, sizeof( stream ) ); stream.zalloc = s_zlib_alloc; stream.zfree = s_zlib_free; stream.opaque = NULL; @@ -155,7 +155,7 @@ static HB_SIZE s_zlibUncompressedSize( const char * szSrc, HB_SIZE nLen, z_stream stream; HB_SIZE nDest = 0; - memset( &stream, 0, sizeof( z_stream ) ); + memset( &stream, 0, sizeof( stream ) ); stream.zalloc = s_zlib_alloc; stream.zfree = s_zlib_free; stream.opaque = NULL; @@ -190,7 +190,7 @@ static int s_zlibUncompress( char * pDst, HB_SIZE * pnDst, z_stream stream; int iResult; - memset( &stream, 0, sizeof( z_stream ) ); + memset( &stream, 0, sizeof( stream ) ); stream.zalloc = s_zlib_alloc; stream.zfree = s_zlib_free; stream.opaque = NULL; @@ -221,7 +221,7 @@ static int s_zlibUncompress( char * pDst, HB_SIZE * pnDst, } /* - * hb_ZLibVersion( [<nType>] ) -> <cZlibVersion> + * hb_ZLibVersion( [<nType>] ) --> <cZlibVersion> */ HB_FUNC( HB_ZLIBVERSION ) { @@ -237,7 +237,7 @@ HB_FUNC( HB_ZLIBVERSION ) } /* - * hb_ZCompressBound( <cData> | <nDataLen> ) -> <nMaxCompressLen> + * hb_ZCompressBound( <cData> | <nDataLen> ) --> <nMaxCompressLen> */ HB_FUNC( HB_ZCOMPRESSBOUND ) { @@ -251,7 +251,7 @@ HB_FUNC( HB_ZCOMPRESSBOUND ) /* * hb_ZUncompressLen( <cCompressedData>, [<@nResult>] ) - * -> <nUnCompressedDataLen> or -1 on error + * --> <nUnCompressedDataLen> or -1 on error */ HB_FUNC( HB_ZUNCOMPRESSLEN ) { @@ -408,7 +408,7 @@ HB_FUNC( HB_ZUNCOMPRESS ) } /* - * hb_gzCompressBound( <cData> | <nDataLen> ) -> <nMaxCompressLen> + * hb_gzCompressBound( <cData> | <nDataLen> ) --> <nMaxCompressLen> */ HB_FUNC( HB_GZCOMPRESSBOUND ) { diff --git a/src/rtl/hbzlibc.c b/src/rtl/hbzlibc.c index 60f4e53e75..e8809ee0fc 100644 --- a/src/rtl/hbzlibc.c +++ b/src/rtl/hbzlibc.c @@ -1,5 +1,5 @@ /* - * dynamic reference to ZLIB functions + * Dynamic reference to ZLIB functions * * Copyright 2013 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rtl/hbzlibgz.c b/src/rtl/hbzlibgz.c index bf910c56e8..51b787e774 100644 --- a/src/rtl/hbzlibgz.c +++ b/src/rtl/hbzlibgz.c @@ -52,7 +52,7 @@ #include <zlib.h> -#if !defined( HB_NO_GZLIB ) && \ +#if ! defined( HB_NO_GZLIB ) && \ defined( HB_OS_WIN_CE ) && defined( _MSC_VER ) && ZLIB_VERNUM >= 0x1240 #define HB_NO_GZLIB #endif diff --git a/src/rtl/hbznet.c b/src/rtl/hbznet.c index e01adc2cb2..3dd60f65d9 100644 --- a/src/rtl/hbznet.c +++ b/src/rtl/hbznet.c @@ -671,7 +671,7 @@ PHB_SOCKEX hb_sockexNewZNet( HB_SOCKET sd, const void * keydata, int keylen, } /* hb_socketNewZNet( <pSocket>, [<cPass>], ; - [<nCompressionLevel>], [<nStrategy>] ) -> <pSocket> + [<nCompressionLevel>], [<nStrategy>] ) --> <pSocket> */ HB_FUNC( HB_SOCKETNEWZNET ) { diff --git a/src/rtl/hbzsock.c b/src/rtl/hbzsock.c index b7f022362b..8f1b801beb 100644 --- a/src/rtl/hbzsock.c +++ b/src/rtl/hbzsock.c @@ -544,7 +544,7 @@ static PHB_SOCKEX s_sockexNext( PHB_SOCKEX pSock, PHB_ITEM pParams ) return pSockNew; } -/* hb_socketNewZSock( <pSocket>, [<hParams>] ) -> <pSocket> */ +/* hb_socketNewZSock( <pSocket>, [<hParams>] ) --> <pSocket> */ HB_FUNC( HB_SOCKETNEWZSOCK ) { PHB_SOCKEX pSock = hb_sockexParam( 1 ); diff --git a/src/rtl/idle.c b/src/rtl/idle.c index fed4d0afac..5203575d3d 100644 --- a/src/rtl/idle.c +++ b/src/rtl/idle.c @@ -2,6 +2,7 @@ * The idle state collector * * Copyright 1999 Ryszard Glab <rglab@imid.med.pl> + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> (hb_ReleaseCPU()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * hb_ReleaseCPU() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbset.h" @@ -200,7 +191,7 @@ HB_FUNC( HB_IDLEADD ) /* return a pointer as a handle to this idle task */ - hb_retptr( ( void * ) hb_codeblockId( pBlock ) ); /* TODO: access to pointers from harbour code */ + hb_retptr( ( void * ) hb_codeblockId( pBlock ) ); /* TODO: access to pointers from Harbour code */ } } diff --git a/src/rtl/inkey.c b/src/rtl/inkey.c index 61456d6bfc..3b001bc7e8 100644 --- a/src/rtl/inkey.c +++ b/src/rtl/inkey.c @@ -2,6 +2,8 @@ * The Keyboard API * * Copyright 1999 David G. Holm <dholm@jsd-llc.com> + * Copyright 1999-2012 Viktor Szakats (vszakats.net/harbour) (hb_keyPut(), hb_keyNew()) + * Copyright 2003-2012 Przemyslaw Czerpak <druzus@acn.waw.pl> (hb_keySetLast(), hb_keyChar(), hb_keyStd()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,19 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2012 Viktor Szakats (vszakats.net/harbour) - * hb_keyPut() - * - * Copyright 2003-2012 Przemyslaw Czerpak <druzus@acn.waw.pl> - * hb_keySetLast(), hb_keyChar(), hb_keyStd() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapigt.h" #include "hbgtcore.h" #include "hbapiitm.h" diff --git a/src/rtl/inkeyapi.c b/src/rtl/inkeyapi.c index 014f4aab81..0e2f590aa0 100644 --- a/src/rtl/inkeyapi.c +++ b/src/rtl/inkeyapi.c @@ -2,6 +2,7 @@ * Inkey GT API * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> + * Copyright 2002 Walter Negro <anegro@overnet.com.ar> (hb_inkeySetLast()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2002 Walter Negro <anegro@overnet.com.ar> - * hb_inkeySetLast() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbgtcore.h" /* xHarbour compatible definitions */ @@ -362,13 +353,13 @@ static int s_inkeyTransChar( int iKey, int iFlags, const HB_KEY_VALUE * pKeyVal return KP_ALT_ENTER; break; case '+': - return iFlags & HB_KF_ALT ? KP_ALT_PLUS : KP_CTRL_PLUS; + return ( iFlags & HB_KF_ALT ) ? KP_ALT_PLUS : KP_CTRL_PLUS; case '-': - return iFlags & HB_KF_ALT ? KP_ALT_MINUS : KP_CTRL_MINUS; + return ( iFlags & HB_KF_ALT ) ? KP_ALT_MINUS : KP_CTRL_MINUS; case '*': - return iFlags & HB_KF_ALT ? KP_ALT_ASTERISK : KP_CTRL_ASTERISK; + return ( iFlags & HB_KF_ALT ) ? KP_ALT_ASTERISK : KP_CTRL_ASTERISK; case '/': - return iFlags & HB_KF_ALT ? KP_ALT_SLASH : KP_CTRL_SLASH; + return ( iFlags & HB_KF_ALT ) ? KP_ALT_SLASH : KP_CTRL_SLASH; case '.': case ',': if( iFlags & HB_KF_CTRL ) @@ -404,7 +395,7 @@ HB_SIZE hb_inkeyKeyString( int iKey, char * buffer, HB_SIZE nSize ) { HB_SIZE nLen = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyString(%d,%p, %" HB_PFS "u)", iKey, buffer, nSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyString(%d,%p, %" HB_PFS "u)", iKey, ( void * ) buffer, nSize ) ); if( HB_INKEY_ISUNICODE( iKey ) ) { diff --git a/src/rtl/iousr.c b/src/rtl/iousr.c index 4213cf78cc..91593cdfa6 100644 --- a/src/rtl/iousr.c +++ b/src/rtl/iousr.c @@ -1,5 +1,5 @@ /* - * IOUSRD - library to create new FILE IO redirectors at prg level + * IOUSRD - library to create new FILE IO redirectors at .prg level * * Copyright 2014 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -751,10 +751,10 @@ HB_FUNC( IOUSR_REGISTER ) s_errRT_IOUSR( EG_ARG, 1001, "Argument error" ); } -/* IOUSR_SetError( [<nError> [, <nBase> ]] ) -> <nPrevError> */ +/* IOUSR_SetError( [<nError> [, <nBase> ]] ) --> <nPrevError> */ HB_FUNC( IOUSR_SETERROR ) { - HB_ERRCODE errCode = hb_fsError(); + HB_ERRCODE errCodePrev = hb_fsError(); if( HB_ISNUM( 1 ) ) { @@ -764,5 +764,5 @@ HB_FUNC( IOUSR_SETERROR ) hb_fsSetError( errCodeNew ); } - hb_retni( errCode ); + hb_retni( errCodePrev ); } diff --git a/src/rtl/isprint.c b/src/rtl/isprint.c index 12829bf678..36a26b9bd6 100644 --- a/src/rtl/isprint.c +++ b/src/rtl/isprint.c @@ -1,7 +1,7 @@ /* * IsPrinter() function * - * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) + * Copyright 1999-2016 Viktor Szakats (vszakats.net/harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -125,6 +125,27 @@ HB_BOOL hb_printerIsReady( const char * pszPrinterName ) return bIsPrinter; } +/* Contrary to popular beliefs and such (mis)feature implemented + in the Harbour derivative xHarbour, [hb_]IsPrinter() functions + are only meant to work on direct _devices_ (f.e. LPT1:, \\server\queue, + tcp:localhost:9100, /dev/lp0, etc...). Those that are writable + just like a stream. Of these two functions, IsPrinter() will + always use the same, OS-specific predefined device name, just + like in Cl*pper, for compatibility. IOW, it doesn't accept + a parameter. See source code above what the predefined device + names are. hb_IsPrinter() _will_ accept such device name as its + 1st and only parameter. However, because devices are typically + virtualized by modern OSes, they may not be offering the exact + Cl*pper behavior experienced under MS-DOS. To get the latter, + an MS-DOS build of Harbour is required. Because direct device + names don't have anything to do with high-level graphical + printers (and their names may even collide with valid device + names), such printer names are _not_ handled by these functions. + For such feature, explore the appropriate OS/desktop specific + printing libraries/APIs (or create a portable, printable document, + like a .pdf). As for these ones, regard them as legacy functions + for compatibility. [vszakats] */ + HB_FUNC( HB_ISPRINTER ) { hb_retl( hb_printerIsReady( hb_parc( 1 ) ) ); diff --git a/src/rtl/itemseri.c b/src/rtl/itemseri.c index 29c1eef6c3..17663e153c 100644 --- a/src/rtl/itemseri.c +++ b/src/rtl/itemseri.c @@ -1,5 +1,5 @@ /* - * item serialization code + * Item serialization code * * Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -205,7 +205,7 @@ static HB_SIZE hb_deserializeItem( PHB_ITEM pItem, const HB_UCHAR * pBuffer, HB_SIZE nOffset, PHB_REF_LIST pRefList ); -/* +#if 0 static void hb_itemSerialRefListShow( PHB_REF_LIST pRefList ) { HB_SIZE nPos; @@ -223,7 +223,7 @@ static void hb_itemSerialRefListShow( PHB_REF_LIST pRefList ) } printf( "================================\n" ); fflush( stdout ); } -*/ +#endif static void hb_itemSerialRefListInit( PHB_REF_LIST pRefList ) { @@ -503,7 +503,6 @@ static HB_SIZE hb_itemSerialSize( PHB_ITEM pItem, int iFlags, HB_SIZE nSize, nLen, u; HB_MAXINT lVal; HB_USHORT uiClass; - PHB_ITEM pDefVal; const char * szVal; if( HB_IS_BYREF( pItem ) ) @@ -614,6 +613,8 @@ static HB_SIZE hb_itemSerialSize( PHB_ITEM pItem, int iFlags, } else { + PHB_ITEM pDefVal; + if( ( hb_hashGetFlags( pItem ) & ~HB_HASH_RESORT ) != HB_HASH_FLAG_DEFAULT ) nSize = 3; else @@ -660,7 +661,7 @@ static HB_SIZE hb_serializeItem( PHB_ITEM pItem, HB_BOOL iFlags, int iWidth, iDecimal; long l, l2; const char * szVal; - HB_SIZE nRef, nLen, nSize, n; + HB_SIZE nRef, nLen, n; if( HB_IS_BYREF( pItem ) ) pItem = hb_itemUnRef( pItem ); @@ -807,7 +808,7 @@ static HB_SIZE hb_serializeItem( PHB_ITEM pItem, HB_BOOL iFlags, } else { - nSize = n = nLen; + HB_SIZE nSize = n = nLen; while( n && szVal[ n - 1 ] == ' ' ) --n; n = nLen - n; @@ -1900,11 +1901,12 @@ HB_FUNC( HB_SERIALIZE ) HB_FUNC( HB_DESERIALIZE ) { - PHB_ITEM pItem, pParam = hb_param( 1, HB_IT_BYREF ); + PHB_ITEM pParam = hb_param( 1, HB_IT_BYREF ); HB_SIZE nSize = hb_parclen( 1 ); if( nSize ) { + PHB_ITEM pItem; PHB_CODEPAGE cdpIn, cdpOut; const char * pBuffer = hb_parc( 1 ); const char * pszCdpIn = hb_parc( 2 ), diff --git a/src/rtl/langapi.c b/src/rtl/langapi.c index 07d8cdc6f7..c63c9a6105 100644 --- a/src/rtl/langapi.c +++ b/src/rtl/langapi.c @@ -334,7 +334,7 @@ void hb_langReleaseAll( void ) HB_BOOL hb_langRegister( PHB_LANG lang ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_langRegister(%p)", lang ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_langRegister(%p)", ( const void * ) lang ) ); if( lang ) { @@ -365,7 +365,7 @@ PHB_LANG hb_langSelect( PHB_LANG lang ) { PHB_LANG langOld; - HB_TRACE( HB_TR_DEBUG, ( "hb_langSelect(%p)", lang ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_langSelect(%p)", ( const void * ) lang ) ); langOld = hb_vmLang(); if( lang ) @@ -483,7 +483,7 @@ HB_FUNC( HB_LANGMESSAGE ) } /* hb_langNew( <cNewLangId>, <cNewLangCpId>, - * <cLangId>, <cLangCpId> ) -> <lOK> + * <cLangId>, <cLangCpId> ) --> <lOK> */ HB_FUNC( HB_LANGNEW ) { diff --git a/src/rtl/libnamec.c b/src/rtl/libnamec.c index 1a69993546..851d8257e1 100644 --- a/src/rtl/libnamec.c +++ b/src/rtl/libnamec.c @@ -5,11 +5,6 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * @@ -76,34 +71,34 @@ HB_FUNC( HB_LIBPREFIX ) } #if defined( HB_OS_WIN ) -# define HB_DLL_VER "-" HB_MACRO2STRING( HB_VER_MAJOR ) HB_MACRO2STRING( HB_VER_MINOR ) + #define HB_DLL_VER "-" HB_MACRO2STRING( HB_VER_MAJOR ) HB_MACRO2STRING( HB_VER_MINOR ) #else -# define HB_DLL_VER "" + #define HB_DLL_VER "" #endif #if defined( HB_OS_WIN_CE ) && defined( HB_CPU_ARM ) -# define HB_DLL_POSTFIX HB_DLL_VER "-wce-arm" + #define HB_DLL_SUFFIX HB_DLL_VER "-wce-arm" #elif defined( HB_OS_WIN_CE ) && defined( HB_CPU_MIPS ) -# define HB_DLL_POSTFIX HB_DLL_VER "-wce-mips" + #define HB_DLL_SUFFIX HB_DLL_VER "-wce-mips" #elif defined( HB_OS_WIN_CE ) && defined( HB_CPU_SH ) -# define HB_DLL_POSTFIX HB_DLL_VER "-wce-sh" + #define HB_DLL_SUFFIX HB_DLL_VER "-wce-sh" #elif defined( HB_OS_WIN_CE ) && defined( HB_CPU_X86 ) -# define HB_DLL_POSTFIX HB_DLL_VER "-wce-x86" + #define HB_DLL_SUFFIX HB_DLL_VER "-wce-x86" #elif defined( HB_OS_WIN_CE ) -# define HB_DLL_POSTFIX HB_DLL_VER "-wce" + #define HB_DLL_SUFFIX HB_DLL_VER "-wce" #elif defined( __BORLANDC__ ) -# define HB_DLL_POSTFIX HB_DLL_VER "-bcc" + #define HB_DLL_SUFFIX HB_DLL_VER "-bcc" #elif defined( HB_OS_WIN_64 ) && defined( HB_CPU_X86_64 ) -# define HB_DLL_POSTFIX HB_DLL_VER "-x64" + #define HB_DLL_SUFFIX HB_DLL_VER "-x64" #elif defined( HB_OS_WIN_64 ) && defined( HB_CPU_IA_64 ) -# define HB_DLL_POSTFIX HB_DLL_VER "-ia64" + #define HB_DLL_SUFFIX HB_DLL_VER "-ia64" #else -# define HB_DLL_POSTFIX HB_DLL_VER + #define HB_DLL_SUFFIX HB_DLL_VER #endif HB_FUNC( HB_LIBSUFFIX ) { - hb_retc_const( HB_DLL_POSTFIX ); + hb_retc_const( HB_DLL_SUFFIX ); } HB_FUNC_TRANSLATE( HB_LIBPOSTFIX, HB_LIBSUFFIX ) /* Deprecated */ diff --git a/src/rtl/listbox.prg b/src/rtl/listbox.prg index 3edb9eecb3..d69a6c8f63 100644 --- a/src/rtl/listbox.prg +++ b/src/rtl/listbox.prg @@ -418,29 +418,33 @@ METHOD hitTest( nMRow, nMCol ) CLASS ListBox DO CASE CASE nMRow == nTop - IF nMCol == ::nLeft + DO CASE + CASE nMCol == ::nLeft RETURN HTTOPLEFT - ELSEIF nMCol == ::nRight + CASE nMCol == ::nRight RETURN HTTOPRIGHT - ELSEIF nMCol >= ::nLeft .AND. nMCol <= ::nRight + CASE nMCol >= ::nLeft .AND. nMCol <= ::nRight RETURN HTTOP - ENDIF + ENDCASE CASE nMRow == ::nBottom - IF nMCol == ::nLeft + DO CASE + CASE nMCol == ::nLeft RETURN HTBOTTOMLEFT - ELSEIF nMCol == ::nRight + CASE nMCol == ::nRight RETURN HTBOTTOMRIGHT - ELSEIF nMCol >= ::nLeft .AND. nMCol <= ::nRight + CASE nMCol >= ::nLeft .AND. nMCol <= ::nRight RETURN HTBOTTOM - ENDIF + ENDCASE CASE nMCol == ::nLeft - IF nMRow >= ::nTop .AND. nMRow <= ::nBottom + IF nMRow >= ::nTop .AND. ; + nMRow <= ::nBottom RETURN HTLEFT ELSE RETURN HTNOWHERE ENDIF CASE nMCol == ::nRight - IF nMRow >= ::nTop .AND. nMRow <= ::nBottom + IF nMRow >= ::nTop .AND. ; + nMRow <= ::nBottom RETURN HTRIGHT ELSE RETURN HTNOWHERE @@ -682,14 +686,14 @@ METHOD select( xPos ) CLASS ListBox DO CASE CASE cType == "C" nPos := ::findData( xPos ) - IF !( ValType( ::xBuffer ) $ "CU" ) + IF ! ValType( ::xBuffer ) $ "CU" ::xBuffer := nPos ELSEIF ::nValue == 0 ::xBuffer := xPos ELSE ::xBuffer := _LISTBOX_ITEMDATA( ::aItems[ nPos ] ) ENDIF - CASE !( cType == "N" ) + CASE ! cType == "N" RETURN ::nValue CASE xPos < 1 RETURN ::nValue @@ -760,7 +764,7 @@ METHOD setFocus() CLASS ListBox METHOD setItem( nPos, aItem ) CLASS ListBox IF nPos >= 1 .AND. nPos <= ::nItemCount .AND. ; - Len( aItem ) == 2 .AND. ; + Len( aItem ) == _ITEM_xData .AND. ; HB_ISSTRING( aItem[ _ITEM_cText ] ) ::aItems[ nPos ] := aItem @@ -776,7 +780,7 @@ METHOD setText( nPos, cText ) CLASS ListBox RETURN Self -/* -------------------------------------------- */ +/* --- */ METHOD changeItem( nOldPos, nNewPos ) CLASS ListBox @@ -827,7 +831,7 @@ METHOD scrollbarPos() CLASS ListBox RETURN ( ( nCount - nLength ) * ::nTopItem + nLength - nSize ) / ( nCount - nSize ) -/* -------------------------------------------- */ +/* --- */ METHOD bitmap( cBitmap ) CLASS ListBox @@ -1035,7 +1039,7 @@ METHOD vScroll( oVScroll ) CLASS ListBox RETURN ::oVScroll -/* -------------------------------------------- */ +/* --- */ METHOD New( nTop, nLeft, nBottom, nRight, lDropDown ) CLASS ListBox @@ -1079,7 +1083,7 @@ METHOD New( nTop, nLeft, nBottom, nRight, lDropDown ) CLASS ListBox FUNCTION ListBox( nTop, nLeft, nBottom, nRight, lDropDown ) RETURN HBListBox():New( nTop, nLeft, nBottom, nRight, lDropDown ) -FUNCTION _LISTBOX_( nTop, nLeft, nBottom, nRight, xPos, aItems, cCaption, ; +FUNCTION _ListBox_( nTop, nLeft, nBottom, nRight, xPos, aItems, cCaption, ; cMessage, cColorSpec, bFBlock, bSBlock, lDropDown, lScrollBar, cBitmap ) LOCAL o @@ -1098,13 +1102,18 @@ FUNCTION _LISTBOX_( nTop, nLeft, nBottom, nRight, xPos, aItems, cCaption, ; o:sBlock := bSBlock FOR EACH xItem IN aItems - IF ! HB_ISARRAY( xItem ) + DO CASE + CASE ! HB_ISARRAY( xItem ) o:addItem( xItem ) - ELSEIF Len( xItem ) == _ITEM_cText + CASE Len( xItem ) == _ITEM_cText o:addItem( xItem[ _ITEM_cText ] ) - ELSE +#ifdef HB_CLP_STRICT + OTHERWISE /* Cl*pper will RTE on empty subarray */ +#else + CASE Len( xItem ) >= _ITEM_xData +#endif o:addItem( xItem[ _ITEM_cText ], xItem[ _ITEM_xData ] ) - ENDIF + ENDCASE NEXT IF hb_defaultValue( lScrollBar, .F. ) diff --git a/src/rtl/math.c b/src/rtl/math.c index b680812d43..c6380bda3b 100644 --- a/src/rtl/math.c +++ b/src/rtl/math.c @@ -81,7 +81,7 @@ static int hb_matherr( HB_MATH_EXCEPTION * pexc ) int mode = hb_mathGetErrMode(); int iRet = 1; - HB_TRACE( HB_TR_DEBUG, ( "hb_matherr(%p)", pexc ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_matherr(%p)", ( void * ) pexc ) ); if( pexc == NULL || pexc->handled != 0 ) { @@ -96,17 +96,21 @@ static int hb_matherr( HB_MATH_EXCEPTION * pexc ) PHB_ITEM pMatherrResult; /* create an error object */ - /* NOTE: In case of HB_MATH_ERRMODE_USER[C]DEFAULT, I am setting both EF_CANSUBSTITUTE and EF_CANDEFAULT to .T. here. - This is forbidden according to the original Cl*pper docs, but I think this reflects the situation best here: - The error handler can either substitute the errorneous value (by returning a numeric value) or choose the - default error handling (by returning .F., as usual) [martin vogel] */ + /* NOTE: In case of HB_MATH_ERRMODE_USER[C]DEFAULT, I am setting both + EF_CANSUBSTITUTE and EF_CANDEFAULT to .T. here. + This is forbidden according to the original Cl*pper docs, but + I think this reflects the situation best here: + The error handler can either substitute the erroneous value + (by returning a numeric value) or choose the default error + handling (by returning .F., as usual) [martin vogel] */ pError = hb_errRT_New_Subst( ES_ERROR, "MATH", EG_NUMERR, pexc->type, pexc->error, pexc->funcname, 0, EF_CANSUBSTITUTE | ( mode == HB_MATH_ERRMODE_USER ? 0 : EF_CANDEFAULT ) ); /* Assign the new array to the object data item. */ - /* NOTE: Unfortunately, we cannot decide whether one or two parameters have been used when the - math function has been called, so we always take two */ + /* NOTE: Unfortunately, we cannot decide whether one or two parameters + have been used when the math function has been called, so we + always take two */ pArg1 = hb_itemPutND( NULL, pexc->arg1 ); pArg2 = hb_itemPutND( NULL, pexc->arg2 ); hb_errPutArgs( pError, 2, pArg1, pArg2 ); @@ -135,14 +139,16 @@ static int hb_matherr( HB_MATH_EXCEPTION * pexc ) switch( mode ) { case HB_MATH_ERRMODE_USER: - /* user failed to handle the math exception, so quit the app [yes, that's the meaning of this mode !!] */ + /* user failed to handle the math exception, so quit the app + [yes, that's the meaning of this mode !!] */ iRet = 0; hb_vmRequestQuit(); break; case HB_MATH_ERRMODE_DEFAULT: case HB_MATH_ERRMODE_USERDEFAULT: - /* return 1 to suppress C RTL error msgs, but leave error handling to the calling Harbour routine */ + /* return 1 to suppress C RTL error msgs, but leave error + handling to the calling Harbour routine */ break; case HB_MATH_ERRMODE_CDEFAULT: @@ -153,7 +159,7 @@ static int hb_matherr( HB_MATH_EXCEPTION * pexc ) } } - return iRet; /* error handling successful */ + return iRet; /* error handling successful */ } static void hb_mathErrDataInit( void * Cargo ) @@ -190,17 +196,14 @@ static HB_TSD_NEW( s_mathErrData, sizeof( HB_MATHERRDATA ), #define hb_mathErrData() ( ( PHB_MATHERRDATA ) hb_stackGetTSD( &s_mathErrData ) ) -/* - * ************************************************************ - * Harbour Math functions Part I: +/* Harbour Math functions Part I: * handling math errors, C math lib redirection - * ************************************************************ */ /* reset math error information */ void hb_mathResetError( HB_MATH_EXCEPTION * phb_exc ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_mathResetError(%p)", phb_exc ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_mathResetError(%p)", ( void * ) phb_exc ) ); HB_SYMBOL_UNUSED( phb_exc ); @@ -231,7 +234,7 @@ int matherr( struct exception * err ) HB_MATH_HANDLERPROC mathHandler; HB_MATH_EXCEPTION * pExc; - HB_TRACE( HB_TR_DEBUG, ( "matherr(%p)", err ) ); + HB_TRACE( HB_TR_DEBUG, ( "matherr(%p)", ( void * ) err ) ); pExc = &hb_mathErrData()->exception; @@ -289,7 +292,7 @@ int matherr( struct exception * err ) else { /* there is no custom math handler */ - retval = 1; /* don't print any message, don't set errno and use return value provided by C RTL */ + retval = 1; /* don't print any message, don't set errno and use return value provided by C RTL */ } return retval; } @@ -302,7 +305,7 @@ HB_BOOL hb_mathGetError( HB_MATH_EXCEPTION * phb_exc, const char * szFunc, int errCode, v; - HB_TRACE( HB_TR_DEBUG, ( "hb_mathGetError(%p,%s,%lf,%lf,%lf)", phb_exc, szFunc, arg1, arg2, dResult ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_mathGetError(%p,%s,%lf,%lf,%lf)", ( void * ) phb_exc, szFunc, arg1, arg2, dResult ) ); switch( errno ) { @@ -365,7 +368,7 @@ HB_BOOL hb_mathGetError( HB_MATH_EXCEPTION * phb_exc, const char * szFunc, } return HB_TRUE; #else - HB_TRACE( HB_TR_DEBUG, ( "hb_mathGetError(%p,%s,%lf,%lf,%lf)", phb_exc, szFunc, arg1, arg2, dResult ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_mathGetError(%p,%s,%lf,%lf,%lf)", ( void * ) phb_exc, szFunc, arg1, arg2, dResult ) ); HB_SYMBOL_UNUSED( dResult ); HB_SYMBOL_UNUSED( arg1 ); @@ -388,11 +391,8 @@ HB_BOOL hb_mathGetError( HB_MATH_EXCEPTION * phb_exc, const char * szFunc, } -/* - * ************************************************************ - * Harbour Math functions Part II: +/* Harbour Math functions Part II: * handling math errors, Harbour default handling routine - * ************************************************************ */ /* set error handling mode of hb_matherr() */ @@ -426,7 +426,7 @@ int hb_mathGetErrMode( void ) } /* Harbour equivalent to mathSet/GetErrMode */ -HB_FUNC( HB_MATHERMODE ) /* ([<nNewMode>]) -> <nOldMode> */ +HB_FUNC( HB_MATHERMODE ) /* ([<nNewMode>]) --> <nOldMode> */ { hb_retni( hb_mathGetErrMode() ); @@ -436,20 +436,18 @@ HB_FUNC( HB_MATHERMODE ) /* ([<nNewMode>]) -> <nOldMode> */ } -/* - * ************************************************************ - * Harbour Math functions Part III: +/* Harbour Math functions Part III: * (de)installing and (de)activating custom math error handlers - * ************************************************************ */ -/* install a harbour-like math error handler (that will be called by the matherr() function), return old handler */ +/* install a harbour-like math error handler (that will be called by the + matherr() function), return old handler */ HB_MATH_HANDLERPROC hb_mathSetHandler( HB_MATH_HANDLERPROC handlerproc ) { HB_MATH_HANDLERPROC oldHandlerProc; PHB_MATHERRDATA pMathErr; - HB_TRACE( HB_TR_DEBUG, ( "hb_mathSetHandler (%p)", handlerproc ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_mathSetHandler (%p)", ( void * ) handlerproc ) ); pMathErr = hb_mathErrData(); oldHandlerProc = pMathErr->handler; @@ -466,12 +464,9 @@ HB_MATH_HANDLERPROC hb_mathGetHandler( void ) return hb_mathErrData()->handler; } -/* - * ************************************************************ - * Harbour Math functions Part IV: +/* Harbour Math functions Part IV: * example of hb_mathSet/GetHandler: add a new math handler that * calls a given codeblock for every math error - * ************************************************************ */ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) @@ -499,10 +494,12 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) hb_itemArrayPut( pArray, 2, pHandled ); /* launch error codeblock that can - a) change the members of the array = {dRetval, lHandled} to set the return value of the math C RTL routine and - the <exception handled flag> and it + a) change the members of the array = {dRetval, lHandled} to set the + return value of the math C RTL routine and the <exception handled + flag> and it b) can return an integer value to set the return value of matherr(). - NOTE that these values are only used if lHandled was .F. and is set to .T. within the codeblock */ + NOTE that these values are only used if lHandled was .F. and is set + to .T. within the codeblock */ pRet = hb_itemDo( pMathErr->block, 6, pType, pFuncname, pError, pArg1, pArg2, pArray ); hb_itemRelease( pType ); @@ -515,7 +512,8 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) if( pexc->handled ) { - /* math exception has already been handled, so codeblock call above was only informative */ + /* math exception has already been handled, so codeblock call above + was only informative */ retval = 1; } else @@ -541,12 +539,12 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) } if( pRet && HB_IS_NUMERIC( pRet ) ) { - retval = hb_itemGetNI( pRet ); /* block may also return 0 to force C math lib warnings */ + retval = hb_itemGetNI( pRet ); /* block may also return 0 to force C math lib warnings */ hb_itemRelease( pRet ); } else { - retval = 1; /* default return value to suppress C math lib warnings */ + retval = 1; /* default return value to suppress C math lib warnings */ } } else @@ -559,7 +557,7 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) } else { - retval = 1; /* default return value to suppress C math lib warnings */ + retval = 1; /* default return value to suppress C math lib warnings */ } if( pMathErr->prevHandler ) @@ -579,12 +577,13 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) } /* set/get math error block */ -HB_FUNC( HB_MATHERBLOCK ) /* ([<nNewErrorBlock>]) -> <nOldErrorBlock> */ +HB_FUNC( HB_MATHERBLOCK ) /* ([<nNewErrorBlock>]) --> <nOldErrorBlock> */ { PHB_MATHERRDATA pMathErr = hb_mathErrData(); - /* immediately install hb_matherrblock and keep it permanently installed ! - This is not dangerous because hb_matherrorblock will always call the previous error handler */ + /* immediately install hb_matherrblock and keep it permanently installed! + This is not dangerous because hb_matherrorblock will always call the + previous error handler */ if( pMathErr->prevHandler == NULL ) { pMathErr->prevHandler = hb_mathSetHandler( hb_matherrblock ); @@ -615,7 +614,8 @@ HB_FUNC( HB_MATHERBLOCK ) /* ([<nNewErrorBlock>]) -> <nOldErrorBlock> */ } else { - /* a parameter other than a block has been passed -> delete error handler ! */ + /* a parameter other than a block has been passed + -> delete error handler! */ if( pMathErr->block ) { hb_itemRelease( pMathErr->block ); @@ -625,11 +625,8 @@ HB_FUNC( HB_MATHERBLOCK ) /* ([<nNewErrorBlock>]) -> <nOldErrorBlock> */ } } -/* - * ************************************************************ - * Harbour Math functions Part V: +/* Harbour Math functions Part V: * Exp(), Log(), Sqrt() - * ************************************************************ */ HB_FUNC( EXP ) @@ -647,7 +644,8 @@ HB_FUNC( EXP ) hb_retndlen( hb_exc.retval, hb_exc.retvalwidth, hb_exc.retvaldec ); else { - /* math exception is up to the Harbour function, so do this as Clipper compatible as possible */ + /* math exception is up to the Harbour function, so do this as + Clipper compatible as possible */ if( hb_exc.type == HB_MATH_ERR_OVERFLOW ) hb_retndlen( HUGE_VAL, -1, -1 ); else @@ -666,12 +664,13 @@ HB_FUNC( LOG ) if( HB_ISNUM( 1 ) ) { HB_MATH_EXCEPTION hb_exc; - double dResult, dArg = hb_parnd( 1 ); + double dArg = hb_parnd( 1 ); if( dArg <= 0 ) hb_retndlen( -HUGE_VAL, -1, -1 ); /* return -infinity */ else { + double dResult; hb_mathResetError( &hb_exc ); dResult = log( dArg ); if( hb_mathGetError( &hb_exc, "LOG", dArg, 0.0, dResult ) ) @@ -680,7 +679,8 @@ HB_FUNC( LOG ) hb_retndlen( hb_exc.retval, hb_exc.retvalwidth, hb_exc.retvaldec ); else { - /* math exception is up to the Harbour function, so do this as Clipper compatible as possible */ + /* math exception is up to the Harbour function, so do this as + Clipper compatible as possible */ switch( hb_exc.type ) { case HB_MATH_ERR_SING: /* argument to log was 0.0 */ @@ -707,12 +707,13 @@ HB_FUNC( SQRT ) if( HB_ISNUM( 1 ) ) { HB_MATH_EXCEPTION hb_exc; - double dResult, dArg = hb_parnd( 1 ); + double dArg = hb_parnd( 1 ); if( dArg <= 0 ) hb_retnd( 0.0 ); else { + double dResult; hb_mathResetError( &hb_exc ); dResult = sqrt( dArg ); if( hb_mathGetError( &hb_exc, "SQRT", dArg, 0.0, dResult ) ) @@ -720,7 +721,8 @@ HB_FUNC( SQRT ) if( hb_exc.handled ) hb_retndlen( hb_exc.retval, hb_exc.retvalwidth, hb_exc.retvaldec ); else - /* math exception is up to the Harbour function, so do this as Clipper compatible as possible */ + /* math exception is up to the Harbour function, so do this as + Clipper compatible as possible */ hb_retnd( 0.0 ); /* return 0.0 on all errors (all (?) of type DOMAIN) */ } else diff --git a/src/rtl/memoedit.prg b/src/rtl/memoedit.prg index 101a10c000..87236c5056 100644 --- a/src/rtl/memoedit.prg +++ b/src/rtl/memoedit.prg @@ -61,7 +61,7 @@ CREATE CLASS HBMemoEditor INHERIT HBEditor METHOD MemoInit( xUserFunction ) // This method is called after ::New() returns to perform ME_INIT actions METHOD Edit() // Calls ::super:Edit( nKey ) but is needed to handle configurable keys METHOD KeyboardHook( nKey ) // Gets called every time there is a key not handled directly by HBEditor - METHOD IdleHook() // Gets called every time there are no more keys to hanlde + METHOD IdleHook() // Gets called every time there are no more keys to handle METHOD HandleUserKey( nKey, nUdfReturn ) // Handles keys returned to MemoEdit() by user function METHOD xDo( nStatus ) // Calls xUserFunction saving and restoring cursor position and shape diff --git a/src/rtl/memofile.c b/src/rtl/memofile.c index ed854a601e..7278b77197 100644 --- a/src/rtl/memofile.c +++ b/src/rtl/memofile.c @@ -48,7 +48,7 @@ #include "hbapiitm.h" #include "hbapifs.h" -/* NOTE: CA-Cl*pper has 64K (65516 bytes exactly) limit on read, in Harbour +/* NOTE: CA-Cl*pper has ~64 KiB (65516 bytes exactly) limit on read, in Harbour this limit is extended, so we are not *strictly* compatible here. [vszakats] */ diff --git a/src/rtl/memvarhb.prg b/src/rtl/memvarhb.prg index d0af788516..9423466a42 100644 --- a/src/rtl/memvarhb.prg +++ b/src/rtl/memvarhb.prg @@ -71,7 +71,7 @@ hb_BChar( 0x01 ) + ; hb_BChar( 0x00 ) ) -FUNCTION hb_mvSave( cFileName, cMask, lIncludeMask ) +PROCEDURE hb_mvSave( cFileName, cMask, lIncludeMask ) LOCAL nCount LOCAL xValue @@ -156,7 +156,7 @@ FUNCTION hb_mvSave( cFileName, cMask, lIncludeMask ) Eval( ErrorBlock(), oError ) ENDIF - RETURN NIL + RETURN FUNCTION hb_mvRestore( cFileName, lAdditive, cMask, lIncludeMask ) diff --git a/src/rtl/menusys.prg b/src/rtl/menusys.prg index 81883c434e..717e7988f4 100644 --- a/src/rtl/menusys.prg +++ b/src/rtl/menusys.prg @@ -67,11 +67,7 @@ FUNCTION ShowMsg( aMsg, lMode ) RETURN .F. -/*** -* -* ShortCut processing for initial Get or Menu Item. -* -***/ +/* ShortCut processing for initial Get or Menu Item. */ FUNCTION IsShortcut( oMenu, nKey, /* @ */ nID ) LOCAL nItem @@ -82,7 +78,7 @@ FUNCTION IsShortcut( oMenu, nKey, /* @ */ nID ) DO CASE // Test for top menu item not a TopBar Menu: - CASE !( oMenu:ClassName() == "TOPBARMENU" ) + CASE ! oMenu:ClassName() == "TOPBARMENU" RETURN IsQuick( oMenu, nKey, @nID ) @@ -127,12 +123,8 @@ FUNCTION IsShortcut( oMenu, nKey, /* @ */ nID ) RETURN .F. -/*** -* -* Navigates to the next Get or Menu Item from the -* Current if more than one uses the same ShortCut. -* -***/ +/* Navigates to the next Get or Menu Item from the + Current if more than one uses the same ShortCut. */ FUNCTION IsQuick( oMenu, nKey, /* @ */ nID ) LOCAL nItem diff --git a/src/rtl/menuto.prg b/src/rtl/menuto.prg index 7101c4879a..5961df02d5 100644 --- a/src/rtl/menuto.prg +++ b/src/rtl/menuto.prg @@ -35,12 +35,12 @@ FUNCTION __AtPrompt( nRow, nCol, cPrompt, cMsg, cColor ) ENDDO // add to the static array - AAdd( t_aLevel[ t_nPointer ], ; - { nRow, ; // _ITM_ROW - nCol, ; // _ITM_COL - cPrompt, ; // _ITM_PROMPT - cMsg, ; // _ITM_MSG - cColor } ) // _ITM_COLOR + AAdd( t_aLevel[ t_nPointer ], { ; + nRow, ; // _ITM_ROW + nCol, ; // _ITM_COL + cPrompt, ; // _ITM_PROMPT + cMsg, ; // _ITM_MSG + cColor } ) // _ITM_COLOR // put this prompt on the screen right now DispOutAt( nRow, nCol, cPrompt, cColor ) diff --git a/src/rtl/minmax.c b/src/rtl/minmax.c index 170838cc6f..53746886bf 100644 --- a/src/rtl/minmax.c +++ b/src/rtl/minmax.c @@ -49,7 +49,7 @@ #include "hbapierr.h" /* returns the maximum of two date or numerics */ -/* NOTE: CA-Cl*pper returns 1-st item when they are equal [druzus] */ +/* NOTE: CA-Cl*pper returns 1st item when they are equal [druzus] */ HB_FUNC( MAX ) { PHB_ITEM p1 = hb_param( 1, HB_IT_ANY ); @@ -110,7 +110,7 @@ HB_FUNC( MAX ) } /* returns the minimum of two date or numerics */ -/* NOTE: CA-Cl*pper returns 1-st item when they are equal [druzus] */ +/* NOTE: CA-Cl*pper returns 1st item when they are equal [druzus] */ HB_FUNC( MIN ) { PHB_ITEM p1 = hb_param( 1, HB_IT_ANY ); diff --git a/src/rtl/mlcfunc.c b/src/rtl/mlcfunc.c index 06dc25eb44..5715b9bbc6 100644 --- a/src/rtl/mlcfunc.c +++ b/src/rtl/mlcfunc.c @@ -157,7 +157,7 @@ static HB_BOOL hb_mlInit( PHB_MLC_INFO pMLC, int iParAdd ) pMLC->nLen = hb_parclen( 1 ); pMLC->nTabSize = hb_parnsdef( 3 + iParAdd, 4 ); - pMLC->fWordWrap = hb_parldef( 4 + iParAdd, 1 ); + pMLC->fWordWrap = hb_parldef( 4 + iParAdd, HB_TRUE ); #ifdef HB_CLP_STRICT if( pMLC->nLineLength > 254 ) @@ -302,21 +302,21 @@ static HB_SIZE hb_mlGetLine( PHB_MLC_INFO pMLC ) * [ <nLineNumber>=1 ], * [ <nTabSize>=4 ], [ <lWrap>=.T. ], * [ <cEOL>|<acEOLs> ], - * [ <lPad>=.T. ] ) -> <cLine> + * [ <lPad>=.T. ] ) --> <cLine> * * NOTE: <lPad> is undocumented parameter and will be removed and * replaced by other solution in the future. */ HB_FUNC( MEMOLINE ) { - HB_MLC_INFO MLC; HB_ISIZ nLine = hb_parnsdef( 3, 1 ); - HB_BOOL fPad = hb_parldef( 7, 1 ); char * szLine = NULL; - HB_SIZE nIndex, nLen = 0, nSize, nCol; + HB_SIZE nLen = 0; if( nLine >= 1 ) { + HB_MLC_INFO MLC; + if( hb_mlInit( &MLC, 1 ) ) { while( --nLine ) @@ -324,8 +324,12 @@ HB_FUNC( MEMOLINE ) if( ! hb_mlGetLine( &MLC ) ) break; } + if( nLine == 0 ) { + HB_BOOL fPad = hb_parldef( 7, HB_TRUE ); + HB_SIZE nIndex, nSize, nCol; + nIndex = MLC.nOffset; /* CA-Cl*pper also does not check if line exists and always @@ -409,7 +413,7 @@ HB_FUNC( MEMOLINE ) /* MLCount( <cString>, [ <nLineLength>=79 ], * [ <nTabSize>=4 ], [ <lWrap>=.T. ], - * [ <cEOL>|<acEOLs> ] ) -> <nLines> + * [ <cEOL>|<acEOLs> ] ) --> <nLines> */ HB_FUNC( MLCOUNT ) { @@ -428,7 +432,7 @@ HB_FUNC( MLCOUNT ) /* MLPos( <cString>, [ <nLineLength>=79 ], * [ <nLineNumber>=1 ], * [ <nTabSize>=4 ], [ <lWrap>=.T. ], - * [ <cEOL>|<acEOLs> ] ) -> <nLinePos> + * [ <cEOL>|<acEOLs> ] ) --> <nLinePos> */ HB_FUNC( MLPOS ) { @@ -462,7 +466,7 @@ HB_FUNC( MLPOS ) /* MLCToPos( <cString>, [ <nLineLength>=79 ], * [ <nLine>=1 ], [ <nCol>=0 ], * [ <nTabSize>=4 ], [ <lWrap>=.T. ], - * [ <cEOL>|<acEOLs> ] ) -> <nPos> + * [ <cEOL>|<acEOLs> ] ) --> <nPos> */ HB_FUNC( MLCTOPOS ) { @@ -501,7 +505,7 @@ HB_FUNC( MLCTOPOS ) /* MPosToLC( <cString>, [ <nLineLength>=79 ], * [ <nPos>=1 ], * [ <nTabSize>=4 ], [ <lWrap>=.T. ], - * [ <cEOL>|<acEOLs> ] ) -> <aLineCol> + * [ <cEOL>|<acEOLs> ] ) --> <aLineCol> */ HB_FUNC( MPOSTOLC ) { @@ -543,7 +547,7 @@ HB_FUNC( MPOSTOLC ) /* hb_MLEval( <cString>, <bCode>, [ <nLineLength>=79 ], * [ <nTabSize>=4 ], [ <lWrap>=.T. ], - * [ <nPos> ], [ @<nRow> ], [ @<nCol> ] ) -> <nLines> + * [ <nPos> ], [ @<nRow> ], [ @<nCol> ] ) --> <nLines> */ HB_FUNC( HB_MLEVAL ) { @@ -559,7 +563,7 @@ HB_FUNC( HB_MLEVAL ) HB_SIZE nLen = hb_parclen( 1 ); HB_SIZE nTabSize = hb_parnsdef( 4, 4 ); HB_SIZE nPos = hb_parns( 6 ) - 1; - HB_BOOL fWordWrap = hb_parldef( 5, 1 ); + HB_BOOL fWordWrap = hb_parldef( 5, HB_TRUE ); PHB_CODEPAGE cdp = hb_vmCDP(); PHB_ITEM pLineItem = NULL, pSoftItem = NULL; HB_BOOL fSoftCR, fEOL; diff --git a/src/rtl/mod.c b/src/rtl/mod.c index 5dd29b24c9..33565e9c38 100644 --- a/src/rtl/mod.c +++ b/src/rtl/mod.c @@ -86,8 +86,8 @@ HB_FUNC( MOD ) * representation: integer or double, size and number of * decimal places, it can be seen in code like: * PROCEDURE Main() - * SET FIXED ON - * ? Transform( Mod( 12345, 0 ),"" ) + * Set( _SET_FIXED, .T. ) + * ? Transform( Mod( 12345, 0 ), "" ) * RETURN * * [druzus] @@ -105,6 +105,7 @@ HB_FUNC( MOD ) /* FUNCTION Mod( cl_num, cl_base ) + LOCAL cl_result := cl_num % cl_base RETURN iif( cl_base = 0, cl_num, iif( cl_result * cl_base < 0, cl_result + cl_base, cl_result ) ) diff --git a/src/rtl/mouseapi.c b/src/rtl/mouseapi.c index bb79963cc9..6144cb6427 100644 --- a/src/rtl/mouseapi.c +++ b/src/rtl/mouseapi.c @@ -2,6 +2,7 @@ * Mouse API * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * Copyright 1999 Jose Lalin <dezac@corevia.com> (API proposal) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,19 +45,9 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Jose Lalin <dezac@corevia.com> - * API proposal - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbgtcore.h" -/* NOTE: Mouse initialization is called directly from low level GT driver +/* NOTE: Mouse initialization is called directly from low-level GT driver * because it possible that mouse subsystem can depend on the terminal * (for example, mouse subsystem cannot be initialized before ncurses * driver is initialized). @@ -145,7 +136,7 @@ void hb_mouseGetPos( int * piRow, int * piCol ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_mouseGetPos(%p, %p)", piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_mouseGetPos(%p, %p)", ( void * ) piRow, ( void * ) piCol ) ); pGT = hb_gt_Base(); if( pGT ) @@ -187,7 +178,7 @@ void hb_mouseGetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_mouseGetBounds(%p, %p, %p, %p)", piTop, piLeft, piBottom, piRight ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_mouseGetBounds(%p, %p, %p, %p)", ( void * ) piTop, ( void * ) piLeft, ( void * ) piBottom, ( void * ) piRight ) ); pGT = hb_gt_Base(); if( pGT ) @@ -308,7 +299,7 @@ HB_BOOL hb_mouseButtonPressed( int iButton, int * piRow, int * piCol ) HB_BOOL fPressed = HB_FALSE; PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_mouseButtonPressed(%d,%p,%p)", iButton, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_mouseButtonPressed(%d,%p,%p)", iButton, ( void * ) piRow, ( void * ) piCol ) ); pGT = hb_gt_Base(); if( pGT ) @@ -324,7 +315,7 @@ HB_BOOL hb_mouseButtonReleased( int iButton, int * piRow, int * piCol ) HB_BOOL fReleased = HB_FALSE; PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_mouseButtonReleased(%d,%p,%p)", iButton, piRow, piCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_mouseButtonReleased(%d,%p,%p)", iButton, ( void * ) piRow, ( void * ) piCol ) ); pGT = hb_gt_Base(); if( pGT ) diff --git a/src/rtl/mtran.c b/src/rtl/mtran.c index d53425b702..aea9e2b86f 100644 --- a/src/rtl/mtran.c +++ b/src/rtl/mtran.c @@ -54,7 +54,7 @@ static HB_SIZE hb_strMemotran( char * pszResult, const char * pszString, HB_SIZE HB_SIZE nStringPos = 0; HB_SIZE nResultPos = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_strMemotran(%p, %s, %" HB_PFS "u, %x, %x)", pszResult, pszString, nStringLen, cHardCR, cSoftCR ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strMemotran(%p, %s, %" HB_PFS "u, %x, %x)", ( void * ) pszResult, pszString, nStringLen, cHardCR, cSoftCR ) ); while( nStringPos < nStringLen ) { @@ -95,8 +95,8 @@ HB_FUNC( MEMOTRAN ) if( pszRepl ) cHardCR = *pszRepl; - /* CA-Cl*pper checks 3-rd cSoftCR parameter only - * if 2-nd one cHardCR is specified [druzus] + /* CA-Cl*pper checks 3rd cSoftCR parameter only + * if 2nd one cHardCR is specified [druzus] */ #ifdef HB_CLP_STRICT if( pszRepl ) diff --git a/src/rtl/natmsg.c b/src/rtl/natmsg.c index fe4afc98b3..4fecee2ed8 100644 --- a/src/rtl/natmsg.c +++ b/src/rtl/natmsg.c @@ -2,6 +2,7 @@ * NATION undocumented functions * * Copyright 1999 Jose Lalin <dezac@corevia.com> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (__natSortVer(), __natMsgVer()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,17 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * __natSortVer() - * __natMsgVer() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbapilng.h" diff --git a/src/rtl/natmsgu.c b/src/rtl/natmsgu.c index 8334bc176e..68ee4de0fd 100644 --- a/src/rtl/natmsgu.c +++ b/src/rtl/natmsgu.c @@ -2,6 +2,7 @@ * NATION undocumented functions * * Copyright 1999 Jose Lalin <dezac@corevia.com> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (_NatSortVer(), _NatMsgVer()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,18 +45,7 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * _NatSortVer() - * _NatMsgVer() - * - * See COPYING.txt for licensing terms. - * - */ - -#include "hbapi.h" +#include "hbdefs.h" #ifdef HB_CLP_UNDOC diff --git a/src/rtl/net.c b/src/rtl/net.c index cf233ba50b..1bc943922e 100644 --- a/src/rtl/net.c +++ b/src/rtl/net.c @@ -2,6 +2,7 @@ * NetName() function * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * Copyright 2001 Luiz Rafael Culik <culik@sl.conex.net> (Support for DJGPP/GCC/OS2 for NetName()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2001 Luiz Rafael Culik <culik@sl.conex.net> - * Support for DJGPP/GCC/OS2 for netname - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #if defined( HB_OS_WIN ) diff --git a/src/rtl/netusr.c b/src/rtl/netusr.c index 4eb7a09485..c464a6604e 100644 --- a/src/rtl/netusr.c +++ b/src/rtl/netusr.c @@ -44,16 +44,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2001 Luiz Rafael Culik <culik@sl.conex.net> - * Support for DJGPP/GCC/OS2 for netname - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #if defined( HB_OS_WIN ) diff --git a/src/rtl/objfunc.prg b/src/rtl/objfunc.prg index 0ef452b842..90c56be0fe 100644 --- a/src/rtl/objfunc.prg +++ b/src/rtl/objfunc.prg @@ -2,6 +2,8 @@ * Dynamic Object management and misc. Object related functions * * Copyright 1999 Eddie Runia <eddie@runia.com> + * Copyright 1999 Antonio Linares <alinares@fivetech.com> (__objGetMsgList()) + * Copyright 2000 Jf. Lefebvre <jfl@mafact.com> and Ra. Cuylen <rac@mafact.com> (__objDerivedFrom()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,21 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Antonio Linares <alinares@fivetech.com> - * __objGetMsgList - * - * Copyright 2000 Jf. Lefebvre <jfl@mafact.com> and Ra. Cuylen <rac@mafact.com> - * __objDerivedFrom - * - * New Param for Method :ClassSel() to allow it to return only ClassData array - * - * See COPYING.txt for licensing terms. - * - */ - #include "error.ch" #include "hboo.ch" @@ -240,13 +227,14 @@ FUNCTION __objDerivedFrom( oObject, xSuper ) __errRT_BASE( EG_ARG, 3101, , ProcName( 0 ) ) ENDIF - IF HB_ISOBJECT( xSuper ) + DO CASE + CASE HB_ISOBJECT( xSuper ) cClassName := xSuper:ClassName() - ELSEIF HB_ISSTRING( xSuper ) + CASE HB_ISSTRING( xSuper ) cClassName := hb_asciiUpper( xSuper ) - ELSE + OTHERWISE __errRT_BASE( EG_ARG, 3101, , ProcName( 0 ) ) - ENDIF + ENDCASE RETURN __clsParent( oObject:ClassH, cClassName ) diff --git a/src/rtl/philes.c b/src/rtl/philes.c index af8137f87d..495a5ff1aa 100644 --- a/src/rtl/philes.c +++ b/src/rtl/philes.c @@ -520,7 +520,7 @@ HB_FUNC( HB_FISDEVICE ) } /* hb_PRead( <nPipeHandle>, <@cBuffer>, [<nBytes>], [<nTimeOut>] ) - -> <nBytesRead> */ + --> <nBytesRead> */ HB_FUNC( HB_PREAD ) { HB_FHANDLE hPipe = hb_numToHandle( hb_parnintdef( 1, FS_ERROR ) ); @@ -558,7 +558,7 @@ HB_FUNC( HB_PREAD ) } /* hb_PWrite( <nPipeHandle>, <cBuffer>, [<nBytes>], [<nTimeOut>] ) - -> <nBytesWritten> */ + --> <nBytesWritten> */ HB_FUNC( HB_PWRITE ) { HB_FHANDLE hPipe = hb_numToHandle( hb_parnintdef( 1, FS_ERROR ) ); diff --git a/src/rtl/profiler.prg b/src/rtl/profiler.prg index 3e51c20d4c..6a991802ab 100644 --- a/src/rtl/profiler.prg +++ b/src/rtl/profiler.prg @@ -1,8 +1,7 @@ /* * Profiler reporting classes * - * Copyright 2001,2002 Dave Pearson <davep@davep.org> - * http://www.davep.org/ + * Copyright 2001-2002 Dave Pearson <davep@davep.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,7 +52,7 @@ * 2) Taking a snapshot of an application's profile information. * 3) Reporting on the data gathered in the snapshot. * - * Point 1 is handled in harbour's virtual machine. This source aims to + * Point 1 is handled in Harbour's virtual machine. This source aims to * provide code for performing points 2 and 3. A class is provided to * gather, hold and manipulate the profile snapshot and a hierarchy of * classes exist for reporting on that snapshot. The reporting classes are @@ -73,16 +72,13 @@ * in the profiler. * * Many of the "PROTECTED:" scope specifiers in the source have been - * commented out where there's a problem with scope in harbour's class + * commented out where there's a problem with scope in Harbour's class * system. Note that those comments will be removed when the bug is fixed. - * */ /* TODO: - * * - Handle any TODO: items in the source. * - Document the classes and the class hierarchy. - * */ /* Thanks: @@ -94,8 +90,7 @@ #include "hbclass.ch" #include "fileio.ch" -// --------------------------------------------------------- -// Class: HBProfileEntity +// --- CREATE CLASS HBProfileEntity @@ -125,23 +120,18 @@ METHOD init( cName, aInfo ) CLASS HBProfileEntity RETURN Self ACCESS nSeconds CLASS HBProfileEntity - RETURN hb_Clocks2Secs( ::nTicks ) ACCESS nMeanTicks CLASS HBProfileEntity - RETURN iif( ::nCalls == 0, 0, ::nTicks / ::nCalls ) ACCESS nMeanSeconds CLASS HBProfileEntity - RETURN iif( ::nCalls == 0, 0, ::nSeconds / ::nCalls ) METHOD describe() CLASS HBProfileEntity - RETURN "Base Entity" -// --------------------------------------------------------- -// Class: HBProfileFunction +// --- CREATE CLASS HBProfileFunction INHERIT HBProfileEntity @@ -154,11 +144,9 @@ ENDCLASS // METHOD describe() CLASS HBProfileFunction - RETURN "Function" -// --------------------------------------------------------- -// Class: HBProfileMethod +// --- CREATE CLASS HBProfileMethod INHERIT HBProfileEntity @@ -171,11 +159,9 @@ ENDCLASS // METHOD describe() CLASS HBProfileMethod - RETURN "Method" -// --------------------------------------------------------- -// Class: HBProfileOPCode +// --- CREATE CLASS HBProfileOPCode INHERIT HBProfileEntity @@ -188,11 +174,9 @@ ENDCLASS // METHOD describe() CLASS HBProfileOPCode - RETURN "OPCode" -// --------------------------------------------------------- -// Class: HBProfile +// --- CREATE CLASS HBProfile @@ -239,7 +223,6 @@ METHOD reset() CLASS HBProfile RETURN Self METHOD ignoreSymbol( cSymbol ) CLASS HBProfile - RETURN hb_LeftEq( cSymbol, "HBPROFILE" ) .OR. cSymbol == "__SETPROFILER" METHOD gatherFunctions() CLASS HBProfile @@ -262,9 +245,7 @@ METHOD gatherFunctions() CLASS HBProfile // Yes, it is, add it to the profile. AAdd( ::aProfile, HBProfileFunction():new( cName, __dynsGetPrf( n ) ) ) ENDIF - ENDIF - NEXT __SetProfiler( lProfile ) @@ -273,8 +254,8 @@ METHOD gatherFunctions() CLASS HBProfile METHOD gatherMethods() CLASS HBProfile - LOCAL lProfile := __SetProfiler( .F. ) - LOCAL n := 1 + LOCAL lProfile := __SetProfiler( .F. ) + LOCAL n := 1 LOCAL cClass LOCAL nMembers LOCAL aMembers @@ -296,13 +277,10 @@ METHOD gatherMethods() CLASS HBProfile // Add it to the profile. AAdd( ::aProfile, HBProfileMethod():new( cClass + ":" + aMembers[ nMember ], __GetMsgPrf( n, aMembers[ nMember ] ) ) ) ENDIF - NEXT - ENDIF ++n - ENDDO __SetProfiler( lProfile ) @@ -313,14 +291,9 @@ METHOD gather() CLASS HBProfile LOCAL lProfile := __SetProfiler( .F. ) - // Reset the profile. - ::reset() - - // Gather function calls - ::gatherFunctions() - - // Gather method calls - ::gatherMethods() + ::reset() // Reset the profile. + ::gatherFunctions() // Gather function calls + ::gatherMethods() // Gather method calls __SetProfiler( lProfile ) @@ -409,8 +382,7 @@ METHOD totalSeconds() CLASS HBProfile RETURN nSeconds -// --------------------------------------------------------- -// Class: HBProfileLowLevel +// --- CREATE CLASS HBProfileLowLevel INHERIT HBProfile @@ -446,7 +418,7 @@ METHOD gatherOPCodes() CLASS HBProfileLowLevel LOCAL cName LOCAL nOP - // Loop over all the harbour OP codes. Note that they start at 0. + // Loop over all the Harbour OP codes. Note that they start at 0. FOR nOP := 0 TO nMax - 1 // If we're not ignoring this opcode. IF ! ::ignoreSymbol( cName := "OPCODE( " + Str( nOP, 3 ) + " )" ) @@ -457,8 +429,7 @@ METHOD gatherOPCodes() CLASS HBProfileLowLevel RETURN Self -// --------------------------------------------------------- -// Class: HBProfileReport +// --- CREATE CLASS HBProfileReport @@ -498,7 +469,6 @@ METHOD writeLines( aLines ) CLASS HBProfileReport RETURN Self METHOD header() CLASS HBProfileReport - RETURN { ; "Name Type Calls Ticks Seconds", ; "=================================== ========== ======== =========== ===========" } @@ -510,7 +480,6 @@ METHOD emitHeader() CLASS HBProfileReport RETURN Self METHOD line( oEntity ) CLASS HBProfileReport - RETURN { ; PadR( oEntity:cName, 35 ) + " " + ; PadR( oEntity:describe(), 8 ) + " " + ; @@ -536,8 +505,7 @@ METHOD generate( bFilter ) CLASS HBProfileReport RETURN Self -// --------------------------------------------------------- -// Class: HBProfileReportToFile +// --- CREATE CLASS HBProfileReportToFile INHERIT HBProfileReport @@ -578,8 +546,7 @@ METHOD generate( bFilter, cFile ) CLASS HBProfileReportToFile RETURN Self -// --------------------------------------------------------- -// Class: HBProfileReportToArray +// --- CREATE CLASS HBProfileReportToArray INHERIT HBProfileReport @@ -610,8 +577,7 @@ METHOD generate( bFilter ) CLASS HBProfileReportToArray RETURN ::aReport -// --------------------------------------------------------- -// Class: HBProfileReportToString +// --- CREATE CLASS HBProfileReportToString INHERIT HBProfileReportToArray @@ -631,8 +597,7 @@ METHOD generate( bFilter ) CLASS HBProfileReportToString RETURN cReport -// --------------------------------------------------------- -// Class: HBProfileReportToTBrowse +// --- CREATE CLASS HBProfileReportToTBrowse INHERIT HBProfileReportToArray @@ -653,10 +618,8 @@ ENDCLASS // +// No header required. METHOD emitHeader() CLASS HBProfileReportToTBrowse - - // No header required. - RETURN Self METHOD emitLine( oEntity ) CLASS HBProfileReportToTBrowse @@ -671,14 +634,11 @@ METHOD generate( bFilter, nTop, nLeft, nBottom, nRight ) CLASS HBProfileReportTo LOCAL lProfile := __SetProfiler( .F. ) LOCAL oBrowse - // Start with the first entity. - ::nEntity := 1 + ::nEntity := 1 // Start with the first entity. - // Generate the array. - ::super:generate( bFilter ) + ::super:generate( bFilter ) // Generate the array. - // Build the browse. - oBrowse := TBrowseNew( nTop, nLeft, nBottom, nRight ) + oBrowse := TBrowseNew( nTop, nLeft, nBottom, nRight ) // Build the browse. oBrowse:goTopBlock := {|| ::nEntity := 1 } oBrowse:goBottomBlock := {|| ::nEntity := Len( ::aReport ) } @@ -706,5 +666,4 @@ METHOD addColumns( oBrowse ) CLASS HBProfileReportToTBrowse RETURN Self METHOD currentEntity() CLASS HBProfileReportToTBrowse - RETURN ::aReport[ ::nEntity ] diff --git a/src/rtl/pushbtn.prg b/src/rtl/pushbtn.prg index a298fdaad1..b7ba4eb7e2 100644 --- a/src/rtl/pushbtn.prg +++ b/src/rtl/pushbtn.prg @@ -207,13 +207,14 @@ METHOD display() CLASS PushButton DispBegin() - IF ::lBuffer + DO CASE + CASE ::lBuffer cColor := hb_ColorIndex( ::cColorSpec, 2 ) - ELSEIF ::lHasFocus + CASE ::lHasFocus cColor := hb_ColorIndex( ::cColorSpec, 1 ) - ELSE + OTHERWISE cColor := hb_ColorIndex( ::cColorSpec, 0 ) - ENDIF + ENDCASE IF ( nPos := At( "&", cCaption ) ) == 0 ELSEIF nPos == Len( cCaption ) @@ -242,7 +243,6 @@ METHOD display() CLASS PushButton IF nPos != 0 hb_DispOutAt( nRow, nCol + nPos - 1, SubStr( cCaption, nPos, 1 ), hb_ColorIndex( ::cColorSpec, 3 ) ) ENDIF - ENDIF DispEnd() @@ -362,7 +362,7 @@ METHOD New( nRow, nCol, cCaption ) CLASS PushButton FUNCTION PushButton( nRow, nCol, cCaption ) RETURN HBPushButton():New( nRow, nCol, cCaption ) -FUNCTION _PUSHBUTT_( cCaption, cMessage, cColorSpec, bFBlock, bSBlock, cStyle, nSizeX, nSizeY, nCapXOff, nCapYOff, cBitmap, nBmpXOff, nBmpYOff ) +FUNCTION _PushButt_( cCaption, cMessage, cColorSpec, bFBlock, bSBlock, cStyle, nSizeX, nSizeY, nCapXOff, nCapYOff, cBitmap, nBmpXOff, nBmpYOff ) LOCAL o := HBPushButton():New( Row(), Col(), cCaption ) diff --git a/src/rtl/radiobhb.prg b/src/rtl/radiobhb.prg index ea39e53c88..83563026ef 100644 --- a/src/rtl/radiobhb.prg +++ b/src/rtl/radiobhb.prg @@ -50,7 +50,7 @@ #ifdef HB_COMPAT_C53 -FUNCTION RadioButton( nRow, nCol, cCaption, cData ) /* NOTE: cData argument is undocumented */ +FUNCTION RadioButton( nRow, nCol, cCaption, cData ) /* NOTE: cData argument is undocumented */ RETURN HBRadioButton():New( nRow, nCol, cCaption, cData ) #endif diff --git a/src/rtl/radiobtn.prg b/src/rtl/radiobtn.prg index 8d7ef201db..19c502ea00 100644 --- a/src/rtl/radiobtn.prg +++ b/src/rtl/radiobtn.prg @@ -62,7 +62,7 @@ CREATE CLASS RadioButtn FUNCTION HBRadioButton EXPORTED: - VAR cargo /* NOTE: CA-Cl*pper 5.3 has a bug, where this var is filled with NIL everytime its value is read ( cargo := o:cargo ). */ + VAR cargo /* NOTE: CA-Cl*pper 5.3 has a bug, where this var is filled with NIL every time its value is read ( cargo := o:cargo ). */ METHOD display() METHOD hitTest( nMRow, nMCol ) @@ -85,7 +85,7 @@ CREATE CLASS RadioButtn FUNCTION HBRadioButton METHOD sBlock( bSBlock ) SETGET METHOD style( cStyle ) SETGET - METHOD New( nRow, nCol, cCaption, cData ) /* NOTE: This method is a Harbour extension [vszakats] */ + METHOD New( nRow, nCol, cCaption, cData ) /* NOTE: This method is a Harbour extension [vszakats] */ PROTECTED: @@ -184,13 +184,14 @@ METHOD isAccel( xKey ) CLASS RadioButtn LOCAL cKey - IF HB_ISSTRING( xKey ) + DO CASE + CASE HB_ISSTRING( xKey ) cKey := xKey - ELSEIF HB_ISNUMERIC( xKey ) + CASE HB_ISNUMERIC( xKey ) cKey := hb_keyChar( xKey ) - ELSE + OTHERWISE RETURN .F. - ENDIF + ENDCASE RETURN Len( cKey ) > 0 .AND. hb_AtI( "&" + cKey, ::cCaption ) > 0 @@ -328,7 +329,7 @@ METHOD New( nRow, nCol, cCaption, cData ) CLASS RadioButtn ::cCaption := hb_defaultValue( cCaption, "" ) ::nCol := nCol ::nRow := nRow - ::cData := cData /* NOTE: Every type is allowed here to be fully compatible */ + ::cData := cData /* NOTE: Every type is allowed here to be fully compatible */ IF IsDefColor() ::cColorSpec := "W/N,W+/N,W+/N,N/W,W/N,W/N,W+/N" diff --git a/src/rtl/radiogrp.prg b/src/rtl/radiogrp.prg index ce8ccf7378..6ba74ea462 100644 --- a/src/rtl/radiogrp.prg +++ b/src/rtl/radiogrp.prg @@ -95,12 +95,12 @@ CREATE CLASS RadioGroup FUNCTION HBRadioGroup METHOD left( nLeft ) SETGET METHOD message( cMessage ) SETGET METHOD right( nRight ) SETGET - METHOD textValue() SETGET /* NOTE: Undocumented CA-Cl*pper var. */ + METHOD textValue() SETGET /* NOTE: Undocumented CA-Cl*pper var. */ METHOD top( nTop ) SETGET METHOD typeOut() SETGET - METHOD value() SETGET /* NOTE: Undocumented CA-Cl*pper var. */ + METHOD value() SETGET /* NOTE: Undocumented CA-Cl*pper var. */ - METHOD New( nTop, nLeft, nBottom, nRight ) /* NOTE: This method is a Harbour extension [vszakats] */ + METHOD New( nTop, nLeft, nBottom, nRight ) /* NOTE: This method is a Harbour extension [vszakats] */ PROTECTED: @@ -170,11 +170,12 @@ METHOD display() CLASS RadioGroup cUnSelBox := ::cHotBox ENDIF - IF ! Empty( cSelBox ) + DO CASE + CASE ! Empty( cSelBox ) hb_DispBox( ::nTop, ::nLeft, ::nBottom, ::nRight, cSelBox, hb_ColorIndex( ::cColorSpec, 0 ) ) - ELSEIF ! Empty( cUnSelBox ) + CASE ! Empty( cUnSelBox ) hb_DispBox( ::nTop, ::nLeft, ::nBottom, ::nRight, cUnSelBox, hb_ColorIndex( ::cColorSpec, 0 ) ) - ENDIF + ENDCASE IF ! Empty( cCaption := ::cCaption ) @@ -191,7 +192,6 @@ METHOD display() CLASS RadioGroup IF nPos > 0 hb_DispOutAt( ::nCapRow, ::nCapCol + nPos - 1, SubStr( cCaption, nPos, 1 ), hb_ColorIndex( ::cColorSpec, 2 ) ) ENDIF - ENDIF AEval( ::aItems, {| o | o:display() } ) @@ -204,13 +204,14 @@ METHOD getAccel( xKey ) CLASS RadioGroup LOCAL cKey - IF HB_ISSTRING( xKey ) + DO CASE + CASE HB_ISSTRING( xKey ) cKey := xKey - ELSEIF HB_ISNUMERIC( xKey ) + CASE HB_ISNUMERIC( xKey ) cKey := hb_keyChar( xKey ) - ELSE + OTHERWISE RETURN 0 - ENDIF + ENDCASE IF Len( cKey ) > 0 cKey := Lower( cKey ) @@ -231,29 +232,33 @@ METHOD hitTest( nMRow, nMCol ) CLASS RadioGroup DO CASE CASE Empty( ::cColdbox + ::cHotBox ) CASE nMRow == ::nTop - IF nMCol == ::nLeft + DO CASE + CASE nMCol == ::nLeft RETURN HTTOPLEFT - ELSEIF nMCol == ::nRight + CASE nMCol == ::nRight RETURN HTTOPRIGHT - ELSEIF nMCol >= ::nLeft .AND. nMCol <= ::nRight + CASE nMCol >= ::nLeft .AND. nMCol <= ::nRight RETURN HTTOP - ENDIF + ENDCASE CASE nMRow == ::nBottom - IF nMCol == ::nLeft + DO CASE + CASE nMCol == ::nLeft RETURN HTBOTTOMLEFT - ELSEIF nMCol == ::nRight + CASE nMCol == ::nRight RETURN HTBOTTOM - ELSEIF nMCol >= ::nLeft .AND. nMCol <= ::nRight + CASE nMCol >= ::nLeft .AND. nMCol <= ::nRight RETURN HTBOTTOMRIGHT - ENDIF + ENDCASE CASE nMCol == ::nLeft - IF nMRow >= ::nTop .AND. nMRow <= ::nBottom + IF nMRow >= ::nTop .AND. ; + nMRow <= ::nBottom RETURN HTLEFT ELSE RETURN HTNOWHERE ENDIF CASE nMCol == ::nRight - IF nMRow >= ::nTop .AND. nMRow <= ::nBottom + IF nMRow >= ::nTop .AND. ; + nMRow <= ::nBottom RETURN HTRIGHT ELSE RETURN HTNOWHERE @@ -328,7 +333,6 @@ METHOD killFocus() CLASS RadioGroup MSetCursor( nOldMCur ) SetCursor( ::nCursor ) - ENDIF RETURN Self @@ -391,7 +395,6 @@ METHOD prevItem() CLASS RadioGroup ENDCASE ::changeButton( nValue, nPos ) - ENDIF RETURN Self @@ -480,7 +483,6 @@ METHOD changeButton( nUnselect, nSelect ) CLASS RadioGroup ::nValue := nSelect ::cTextValue := ::aItems[ nSelect ]:data ::xBuffer := iif( HB_ISNUMERIC( ::xBuffer ), nSelect, ::cTextValue ) - ENDIF MSetCursor( nOldMCur ) @@ -625,8 +627,8 @@ METHOD New( nTop, nLeft, nBottom, nRight ) CLASS RadioGroup ELSE cColor := SetColor() ::cColorSpec := ; - hb_ColorIndex( cColor, CLR_BORDER ) + "," + ; - hb_ColorIndex( cColor, CLR_STANDARD ) + "," + ; + hb_ColorIndex( cColor, CLR_BORDER ) + "," + ; + hb_ColorIndex( cColor, CLR_STANDARD ) + "," + ; hb_ColorIndex( cColor, CLR_BACKGROUND ) ENDIF @@ -635,7 +637,7 @@ METHOD New( nTop, nLeft, nBottom, nRight ) CLASS RadioGroup FUNCTION RadioGroup( nTop, nLeft, nBottom, nRight ) RETURN HBRadioGroup():New( nTop, nLeft, nBottom, nRight ) -FUNCTION _RADIOGRP_( nTop, nLeft, nBottom, nRight, xValue, aItems, cCaption, cMessage, cColorSpec, bFBlock ) +FUNCTION _RadioGrp_( nTop, nLeft, nBottom, nRight, xValue, aItems, cCaption, cMessage, cColorSpec, bFBlock ) LOCAL o @@ -649,7 +651,6 @@ FUNCTION _RADIOGRP_( nTop, nLeft, nBottom, nRight, xValue, aItems, cCaption, cMe AEval( aItems, {| aItem | o:AddItem( aItem ) } ) o:select( xValue ) - ENDIF RETURN o diff --git a/src/rtl/readkey.prg b/src/rtl/readkey.prg index 0a58a279f5..cae5940c8f 100644 --- a/src/rtl/readkey.prg +++ b/src/rtl/readkey.prg @@ -48,15 +48,15 @@ FUNCTION ReadKey() - LOCAL nKey := LastKey() + LOCAL nKey - SWITCH nKey - CASE K_UP ; nKey := 4 ; EXIT /* NOTE: NG says 5 incorrectly */ - CASE K_DOWN ; nKey := 5 ; EXIT /* NOTE: NG says 2 incorrectly */ + SWITCH nKey := LastKey() + CASE K_UP ; nKey := 4 ; EXIT /* NOTE: NG says 5 incorrectly */ + CASE K_DOWN ; nKey := 5 ; EXIT /* NOTE: NG says 2 incorrectly */ CASE K_PGUP ; nKey := 6 ; EXIT CASE K_PGDN ; nKey := 7 ; EXIT - CASE K_CTRL_PGUP ; nKey := 34 ; EXIT /* NOTE: NG says 31 incorrectly */ - CASE K_CTRL_PGDN ; nKey := 35 ; EXIT /* NOTE: NG says 30 incorrectly */ + CASE K_CTRL_PGUP ; nKey := 34 ; EXIT /* NOTE: NG says 31 incorrectly */ + CASE K_CTRL_PGDN ; nKey := 35 ; EXIT /* NOTE: NG says 30 incorrectly */ CASE K_ESC ; nKey := 12 ; EXIT CASE K_CTRL_W ; nKey := 14 ; EXIT CASE K_ENTER ; nKey := 15 ; EXIT diff --git a/src/rtl/readvar.prg b/src/rtl/readvar.prg index 24bee8b720..692d9afed4 100644 --- a/src/rtl/readvar.prg +++ b/src/rtl/readvar.prg @@ -45,6 +45,7 @@ */ FUNCTION ReadVar( cVarName ) + THREAD STATIC t_cVarName := "" LOCAL cOldVarName diff --git a/src/rtl/round.c b/src/rtl/round.c index 549ad828a4..68d7cd5bce 100644 --- a/src/rtl/round.c +++ b/src/rtl/round.c @@ -2,6 +2,8 @@ * Round(), Int() functions * * Copyright 1999 David G. Holm <dholm@jsd-llc.com> + * Copyright 1999 Matthew Hamilton <mhamilton@bunge.com.au> (Int()) + * Copyright 2003 Vicente Aranzana <varanzana@gruposp.com> (hb_numRound()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,19 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Matthew Hamilton <mhamilton@bunge.com.au> - * Int() - * - * Copyright 2003 Vicente Aranzana <varanzana@gruposp.com> - * hb_numRound() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" diff --git a/src/rtl/rtlshort.c b/src/rtl/rtlshort.c index a31c3929d4..cefbf129be 100644 --- a/src/rtl/rtlshort.c +++ b/src/rtl/rtlshort.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( ACCELERATO, ACCELERATOR ) HB_FUNC_TRANSLATE( COLORSELEC, COLORSELECT ) diff --git a/src/rtl/run.c b/src/rtl/run.c index a2c3a34e9e..1384ef90c2 100644 --- a/src/rtl/run.c +++ b/src/rtl/run.c @@ -55,7 +55,7 @@ #include <windows.h> #endif -/* TOFIX: The screen buffer handling is not right for all platforms (Windows) +/* FIXME: The screen buffer handling is not right for all platforms (Windows) The output of the launched (MS-DOS?) app is not visible. */ HB_FUNC( __RUN ) @@ -67,9 +67,7 @@ HB_FUNC( __RUN ) #if defined( HB_OS_WIN_CE ) hb_fsProcessRun( pszCommand, NULL, 0, NULL, NULL, NULL, NULL, HB_FALSE ); #elif defined( HB_OS_WIN ) - LPTSTR lpCommand; - - lpCommand = HB_CHARDUP( pszCommand ); + LPTSTR lpCommand = HB_CHARDUP( pszCommand ); ( void ) HB_WINAPI_SYSTEM( lpCommand ); hb_xfree( lpCommand ); #else diff --git a/src/rtl/samples.c b/src/rtl/samples.c index 414ad1cce4..0c663ebae4 100644 --- a/src/rtl/samples.c +++ b/src/rtl/samples.c @@ -1,7 +1,7 @@ /* - * Compatibility functions from the SAMPLES directory of Clipper. + * Compatibility functions from the SOURCE/SAMPLE directory of CA-Cl*pper. * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * Copyright 1999-2016 Viktor Szakats (vszakats.net/harbour) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ static char * hb_SecToTimeStr( char * pszTime, long lTime ) { int iValue; - HB_TRACE( HB_TR_DEBUG, ( "hb_SecToTimeStr(%p, %ld)", pszTime, lTime ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_SecToTimeStr(%p, %ld)", ( void * ) pszTime, lTime ) ); iValue = ( int ) ( ( lTime / 3600 ) % 24 ); pszTime[ 0 ] = ( char ) ( iValue / 10 ) + '0'; diff --git a/src/rtl/savebuff.prg b/src/rtl/savebuff.prg index c65f97bd2a..eb765f4fb5 100644 --- a/src/rtl/savebuff.prg +++ b/src/rtl/savebuff.prg @@ -1,5 +1,5 @@ /* - * SaveScreen() buffer help functions + * SaveScreen() buffer helper functions * * Copyright 2012 Viktor Szakats (vszakats.net/harbour) * diff --git a/src/rtl/scrollbr.prg b/src/rtl/scrollbr.prg index 4925b02cf9..fdb706d251 100644 --- a/src/rtl/scrollbr.prg +++ b/src/rtl/scrollbr.prg @@ -81,7 +81,7 @@ CREATE CLASS ScrollBar FUNCTION HBScrollBar METHOD update() METHOD hitTest( nMRow, nMCol ) - METHOD New( nStart, nEnd, nOffset, bSBlock, nOrient ) /* NOTE: This method is a Harbour extension [vszakats] */ + METHOD New( nStart, nEnd, nOffset, bSBlock, nOrient ) /* NOTE: This method is a Harbour extension [vszakats] */ PROTECTED: @@ -115,10 +115,10 @@ METHOD display() CLASS ScrollBar IF ::CalcThumbPos() - cStyle := ::cStyle - nOffset := ::nOffset - nStart := ::nStart - nEnd := ::nEnd - 1 + cStyle := ::cStyle + nOffset := ::nOffset + nStart := ::nStart + nEnd := ::nEnd - 1 DispBegin() @@ -216,9 +216,7 @@ METHOD hitTest( nMRow, nMCol ) CLASS ScrollBar CASE nMRow == ::nThumbPos + ::nStart RETURN HTSCROLLTHUMBDRAG ENDCASE - ENDIF - ELSE DO CASE @@ -236,7 +234,6 @@ METHOD hitTest( nMRow, nMCol ) CLASS ScrollBar CASE nMCol == ::nThumbPos + ::nStart RETURN HTSCROLLTHUMBDRAG ENDCASE - ENDIF RETURN HTNOWHERE @@ -342,15 +339,16 @@ METHOD thumbPos( nThumbPos ) CLASS ScrollBar IF HB_ISNUMERIC( nThumbPos ) - IF nThumbPos < 1 + DO CASE + CASE nThumbPos < 1 ::nThumbPos := 1 - ELSEIF nThumbPos >= ::nBarLength + CASE nThumbPos >= ::nBarLength ::nThumbPos := ::nBarLength - ELSEIF nThumbPos >= ::nBarLength - 1 + CASE nThumbPos >= ::nBarLength - 1 ::nThumbPos := nThumbPos - ELSE + OTHERWISE ::nThumbPos := nThumbPos - ENDIF + ENDCASE ::lOverride := ( nThumbPos != 0 ) ENDIF @@ -385,10 +383,10 @@ METHOD CalcThumbPos() CLASS ScrollBar /* New definitions for better coding. These are screen codepage dependent, but can be changed with the setStyle method. */ -#define SB_UPARROW Chr( 24 ) /* LOW-ASCII "↑" */ -#define SB_DNARROW Chr( 25 ) /* LOW-ASCII "↓" */ -#define SB_RIGHTARROW Chr( 27 ) /* LOW-ASCII "→" */ -#define SB_LEFTARROW Chr( 26 ) /* LOW-ASCII "←" */ +#define SB_UPARROW Chr( 24 ) /* LOW-ASCII "↑" */ +#define SB_DNARROW Chr( 25 ) /* LOW-ASCII "↓" */ +#define SB_RIGHTARROW Chr( 27 ) /* LOW-ASCII "→" */ +#define SB_LEFTARROW Chr( 26 ) /* LOW-ASCII "←" */ #define SB_THUMB hb_UTF8ToStr( "░" ) #define SB_TRACK hb_UTF8ToStr( "▓" ) @@ -415,13 +413,16 @@ METHOD New( nStart, nEnd, nOffset, bSBlock, nOrient ) CLASS ScrollBar ::start := nStart ::nBarLength := nEnd - nStart - 1 - IF nOrient == SCROLL_VERTICAL + SWITCH nOrient + CASE SCROLL_VERTICAL ::cStyle := SB_UPARROW + SB_THUMB + SB_TRACK + SB_DNARROW ::aBitmaps := { "arrow_u.bmu", "arrow_d.bmu", "arrow_e.bmu" } - ELSEIF nOrient == SCROLL_HORIZONTAL + EXIT + CASE SCROLL_HORIZONTAL ::cStyle := SB_LEFTARROW + SB_THUMB + SB_TRACK + SB_RIGHTARROW ::aBitmaps := { "arrow_l.bmu", "arrow_r.bmu", "arrow_e.bmu" } - ENDIF + EXIT + ENDSWITCH cColor := SetColor() ::cColorSpec := ; diff --git a/src/rtl/setkey.c b/src/rtl/setkey.c index 60c19114d1..2c90cacb4a 100644 --- a/src/rtl/setkey.c +++ b/src/rtl/setkey.c @@ -1,7 +1,7 @@ /* * SetKey() and related functions * - * Copyright 1999 April White <april@users.sourceforge.net> + * Copyright 1999 April White <bright.tigra gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,8 +50,8 @@ and call them from console.c Init/Exit functions. */ -#include "hbvm.h" #include "hbapi.h" +#include "hbvm.h" #include "hbapiitm.h" #include "hbapigt.h" #include "hbstack.h" diff --git a/src/rtl/setpos.c b/src/rtl/setpos.c index 9fb6a8acc3..c8e0118107 100644 --- a/src/rtl/setpos.c +++ b/src/rtl/setpos.c @@ -2,6 +2,7 @@ * SetPos(), Row(), Col() functions * * Copyright 1999 Bil Simser <bsimser@home.com> + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> (SetPos()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,21 +45,11 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * SetPos() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapigt.h" #include "hbapiitm.h" -HB_FUNC( SETPOS ) /* Sets the screen position */ +HB_FUNC( SETPOS ) /* Sets the screen position */ { if( HB_ISNUM( 1 ) && HB_ISNUM( 2 ) ) hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ) ); @@ -71,7 +62,7 @@ HB_FUNC( SETPOS ) /* Sets the screen position */ #endif } -HB_FUNC( ROW ) /* Return the current screen row position (zero origin) */ +HB_FUNC( ROW ) /* Return the current screen row position (zero origin) */ { int iRow; int iCol; @@ -81,7 +72,7 @@ HB_FUNC( ROW ) /* Return the current screen row position (zero origin) */ hb_retni( iRow ); } -HB_FUNC( COL ) /* Return the current screen column position (zero origin) */ +HB_FUNC( COL ) /* Return the current screen column position (zero origin) */ { int iRow; int iCol; diff --git a/src/rtl/sha1.c b/src/rtl/sha1.c index 6217f0ecea..fe7a7e13bb 100644 --- a/src/rtl/sha1.c +++ b/src/rtl/sha1.c @@ -1,14 +1,14 @@ /* - * sha1.c + * WARNING: Outdated, insecure algorithm. * - * Originally witten by Steve Reid <steve@edmweb.com> + * Originally written by Steve Reid <steve@edmweb.com> * * Modified by Aaron D. Gifford <agifford@infowest.com> * * NO COPYRIGHT - THIS IS 100% IN THE PUBLIC DOMAIN * * The original unmodified version is available at: - * ftp://ftp.funet.fi/pub/crypt/hash/sha/sha1.c + * http://www.nic.funet.fi/pub/crypt/hash/sha/sha1.c * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -38,7 +38,7 @@ static sha1_quadbyte rol( sha1_quadbyte value, int bits ) #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* blk0() and blk() perform the initial expand. */ -/* I got the idea of expanding during the round function from SSLeay */ +/* I got the idea of expanding during the round function from OpenSSL */ #ifdef HB_LITTLE_ENDIAN #define blk0(i) (block->l[i] = (rol(block->l[i],24)&(sha1_quadbyte)0xFF00FF00) \ diff --git a/src/rtl/sha1.h b/src/rtl/sha1.h index 771779e937..837bf3347a 100644 --- a/src/rtl/sha1.h +++ b/src/rtl/sha1.h @@ -1,5 +1,5 @@ /* - * sha.h + * WARNING: Outdated, insecure algorithm. * * Originally taken from the public domain SHA1 implementation * written by by Steve Reid <steve@edmweb.com> @@ -9,7 +9,7 @@ * NO COPYRIGHT - THIS IS 100% IN THE PUBLIC DOMAIN * * The original unmodified version is available at: - * ftp://ftp.funet.fi/pub/crypt/hash/sha/sha1.c + * http://www.nic.funet.fi/pub/crypt/hash/sha/sha1.c * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/src/rtl/sha1hmac.c b/src/rtl/sha1hmac.c index d8f9099602..005cd3fb1c 100644 --- a/src/rtl/sha1hmac.c +++ b/src/rtl/sha1hmac.c @@ -1,5 +1,5 @@ /* - * hmac_sha1.c + * WARNING: Outdated, insecure algorithm. * * Version 1.0.0 * diff --git a/src/rtl/sha1hmac.h b/src/rtl/sha1hmac.h index ac1506e85f..3055769ccb 100644 --- a/src/rtl/sha1hmac.h +++ b/src/rtl/sha1hmac.h @@ -1,5 +1,5 @@ /* - * hmac_sha1.h + * WARNING: Outdated, insecure algorithm. * * Version 1.0.0 * diff --git a/src/rtl/sha2.c b/src/rtl/sha2.c index ee2062b72c..1a1bcacaa5 100644 --- a/src/rtl/sha2.c +++ b/src/rtl/sha2.c @@ -1,7 +1,7 @@ /* * FIPS 180-2 SHA-224/256/384/512 implementation - * Last update: 02/02/2007 - * Issue date: 04/30/2005 + * Last update: 2007-02-02 + * Issue date: 2005-04-30 * * Copyright (C) 2005, 2007 Olivier Gay <olivier.gay@a3.epfl.ch> * All rights reserved. diff --git a/src/rtl/sha2hmac.c b/src/rtl/sha2hmac.c index 821bac38c4..f838f64d4c 100644 --- a/src/rtl/sha2hmac.c +++ b/src/rtl/sha2hmac.c @@ -1,7 +1,7 @@ /*- * HMAC-SHA-224/256/384/512 implementation - * Last update: 06/15/2005 - * Issue date: 06/15/2005 + * Last update: 2005-06-15 + * Issue date: 2005-06-15 * * Copyright (C) 2005 Olivier Gay <olivier.gay@a3.epfl.ch> * All rights reserved. diff --git a/src/rtl/shadowu.c b/src/rtl/shadowu.c index 4d3d489284..a37adc3484 100644 --- a/src/rtl/shadowu.c +++ b/src/rtl/shadowu.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" #ifdef HB_CLP_UNDOC diff --git a/src/rtl/space.c b/src/rtl/space.c index 70a7c1aa4e..034ac8cfc1 100644 --- a/src/rtl/space.c +++ b/src/rtl/space.c @@ -62,7 +62,7 @@ HB_FUNC( SPACE ) { char * szResult = ( char * ) hb_xgrab( nLen + 1 ); - /* NOTE: String overflow could never occure since a string can + /* NOTE: String overflow could never occur since a string can be as large as ULONG_MAX, and the maximum length that can be specified is LONG_MAX here. [vszakats] */ /* hb_errRT_BASE( EG_STROVERFLOW, 1233, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); */ diff --git a/src/rtl/spfiles.c b/src/rtl/spfiles.c index 1184494921..e0bd29579c 100644 --- a/src/rtl/spfiles.c +++ b/src/rtl/spfiles.c @@ -53,7 +53,7 @@ HB_BOOL hb_spFile( const char * pszFileName, char * pszRetPath ) HB_BOOL bIsFile = HB_FALSE; PHB_FNAME pFilepath; - HB_TRACE( HB_TR_DEBUG, ( "hb_spFile(%s, %p)", pszFileName, pszRetPath ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_spFile(%s, %p)", pszFileName, ( void * ) pszRetPath ) ); if( pszRetPath ) pszPath = pszRetPath; @@ -117,7 +117,7 @@ HB_BOOL hb_spFileExists( const char * pszFileName, char * pszRetPath ) HB_BOOL bIsFile = HB_FALSE; PHB_FNAME pFilepath; - HB_TRACE( HB_TR_DEBUG, ( "hb_spFileExists(%s, %p)", pszFileName, pszRetPath ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_spFileExists(%s, %p)", pszFileName, ( void * ) pszRetPath ) ); if( pszRetPath ) pszPath = pszRetPath; @@ -179,7 +179,7 @@ HB_FHANDLE hb_spOpen( const char * pszFileName, HB_USHORT uiFlags ) { char szPath[ HB_PATH_MAX ]; - HB_TRACE( HB_TR_DEBUG, ( "hb_spOpen(%p, %hu)", pszFileName, uiFlags ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_spOpen(%p, %hu)", ( const void * ) pszFileName, uiFlags ) ); if( hb_spFile( pszFileName, szPath ) ) return hb_fsOpen( szPath, uiFlags ); @@ -192,7 +192,7 @@ HB_FHANDLE hb_spCreate( const char * pszFileName, HB_FATTR ulAttr ) char szPath[ HB_PATH_MAX ]; PHB_FNAME pFilepath; - HB_TRACE( HB_TR_DEBUG, ( "hb_spCreate(%p, %u)", pszFileName, ulAttr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_spCreate(%p, %u)", ( const void * ) pszFileName, ulAttr ) ); pFilepath = hb_fsFNameSplit( pszFileName ); if( ! pFilepath->szPath ) @@ -209,7 +209,7 @@ HB_FHANDLE hb_spCreateEx( const char * pszFileName, HB_FATTR ulAttr, HB_USHORT u char szPath[ HB_PATH_MAX ]; PHB_FNAME pFilepath; - HB_TRACE( HB_TR_DEBUG, ( "hb_spCreateEx(%p, %u, %hu)", pszFileName, ulAttr, uiFlags ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_spCreateEx(%p, %u, %hu)", ( const void * ) pszFileName, ulAttr, uiFlags ) ); pFilepath = hb_fsFNameSplit( pszFileName ); if( ! pFilepath->szPath ) diff --git a/src/rtl/strc.c b/src/rtl/strc.c index d843957208..da563ea3d4 100644 --- a/src/rtl/strc.c +++ b/src/rtl/strc.c @@ -49,7 +49,7 @@ #include "hbapiitm.h" #include "hbapierr.h" -/* hb_StrDecodEscape( <cEscSeqStr> ) -> <cStr> +/* hb_StrDecodEscape( <cEscSeqStr> ) --> <cStr> * decode string with \ escape sequences */ HB_FUNC( HB_STRDECODESCAPE ) @@ -73,7 +73,7 @@ HB_FUNC( HB_STRDECODESCAPE ) hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_StrCDecode( <cStr> [, @<lCont> ] ) -> <cResult> | NIL +/* hb_StrCDecode( <cStr> [, @<lCont> ] ) --> <cResult> | NIL * decode string using C compiler rules * if second parameter <lCont> is passed by reference then it allows * to decode multiline strings. In such case <lCont> is set to .T. diff --git a/src/rtl/strrepl.c b/src/rtl/strrepl.c index b97bc8be20..d02b6f339a 100644 --- a/src/rtl/strrepl.c +++ b/src/rtl/strrepl.c @@ -49,7 +49,7 @@ #include "hbapierr.h" /* hb_StrReplace( <cString>, [ <cSource> | <acSource> | <hReplace> ], [ <cDest> | <acDest> ] ) - * -> <cResult> + * --> <cResult> */ HB_FUNC( HB_STRREPLACE ) { diff --git a/src/rtl/strtoexp.c b/src/rtl/strtoexp.c index 71f16d2de1..a83246ee69 100644 --- a/src/rtl/strtoexp.c +++ b/src/rtl/strtoexp.c @@ -1,5 +1,5 @@ /* - * hb_StrToExp() function - convert string to valid macrocompiler expression + * hb_StrToExp() function - convert string to valid macro-compiler expression * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * diff --git a/src/rtl/strtran.c b/src/rtl/strtran.c index 183fd0e5d4..266986b33c 100644 --- a/src/rtl/strtran.c +++ b/src/rtl/strtran.c @@ -2,7 +2,6 @@ * StrTran() function * * Copyright 1999 Antonio Linares <alinares@fivetech.com> - * * Copyright 2011 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * rewritten to fix incompatibilities with Clipper and fatal performance * of original code @@ -52,7 +51,7 @@ #include "hbapiitm.h" #include "hbapierr.h" -/* TOFIX: Check for string overflow, Clipper can crash if the resulting +/* FIXME: Check for string overflow, Clipper can crash if the resulting string is too large. Example: StrTran( "...", ".", Replicate( "A", 32000 ) ) [vszakats] */ diff --git a/src/rtl/strxor.c b/src/rtl/strxor.c index 099a4d3fc9..8284549252 100644 --- a/src/rtl/strxor.c +++ b/src/rtl/strxor.c @@ -55,9 +55,8 @@ HB_FUNC( HB_STRXOR ) if( pItem ) { PHB_ITEM pItem2; - HB_SIZE nLen1, nLen2, n, n2; + HB_SIZE nLen1, n; const char * pStr1; - const char * pStr2; char * pRet; pStr1 = hb_itemGetCPtr( pItem ); @@ -65,10 +64,11 @@ HB_FUNC( HB_STRXOR ) if( ( pItem2 = hb_param( 2, HB_IT_STRING ) ) != NULL ) { - nLen2 = hb_itemGetCLen( pItem2 ); + HB_SIZE nLen2 = hb_itemGetCLen( pItem2 ); if( nLen2 ) { - pStr2 = hb_itemGetCPtr( pItem2 ); + const char * pStr2 = hb_itemGetCPtr( pItem2 ); + HB_SIZE n2; pRet = ( char * ) hb_xgrab( nLen1 + 1 ); memcpy( pRet, pStr1, nLen1 + 1 ); diff --git a/src/rtl/tbrowse.prg b/src/rtl/tbrowse.prg index 2571d2e21e..8c17364fb1 100644 --- a/src/rtl/tbrowse.prg +++ b/src/rtl/tbrowse.prg @@ -211,7 +211,7 @@ CREATE CLASS TBrowse METHOD rightVisible() // indicates position of rightmost unfrozen column in display METHOD hilite() // highlights the current cell - METHOD deHilite() // dehighlights the current cell + METHOD deHilite() // de-highlights the current cell METHOD refreshAll() // causes all data to be recalculated during the next stabilize METHOD refreshCurrent() // causes the current row to be refilled and repainted on next stabilize METHOD forceStable() // performs a full stabilization @@ -256,7 +256,7 @@ CREATE CLASS TBrowse VAR nBufferPos AS INTEGER INIT 1 // position in row buffer VAR nMoveOffset AS INTEGER INIT 0 // requested repositioning VAR nLastRow AS INTEGER INIT 0 // last row in the buffer - VAR nLastScroll AS INTEGER INIT 0 // last srcoll value + VAR nLastScroll AS INTEGER INIT 0 // last scroll value VAR nConfigure AS INTEGER INIT _TBR_CONF_ALL // configuration status VAR nLastPos AS INTEGER INIT 0 // last calculated column position VAR lHitTop AS LOGICAL INIT .F. // indicates the beginning of available data @@ -277,7 +277,7 @@ CREATE CLASS TBrowse VAR aCellColors AS ARRAY INIT {} // cell colors buffers for each record METHOD doConfigure() // reconfigures the internal settings of the TBrowse object - METHOD setUnstable() // set TBrows in unstable mode resetting flags + METHOD setUnstable() // set TBrowse in unstable mode resetting flags METHOD setPosition() // synchronize record position with the buffer METHOD readRecord( nRow ) // read current record into the buffer @@ -299,7 +299,6 @@ ENDCLASS FUNCTION TBrowseNew( nTop, nLeft, nBottom, nRight ) - RETURN TBrowse():new( nTop, nLeft, nBottom, nRight ) @@ -325,7 +324,6 @@ METHOD new( nTop, nLeft, nBottom, nRight ) CLASS TBrowse RETURN Self STATIC FUNCTION _SKIP_RESULT( xResult ) - RETURN iif( HB_ISNUMERIC( xResult ), Int( xResult ), 0 ) @@ -549,8 +547,8 @@ METHOD colorRect( aRect, aColors ) CLASS TBrowse FOR nRow := aRect[ 1 ] TO aRect[ 3 ] ::readRecord( nRow ) FOR nCol := aRect[ 2 ] TO aRect[ 4 ] - ::aCellColors[ nRow, nCol, 1 ] := aColors[ 1 ] - ::aCellColors[ nRow, nCol, 2 ] := aColors[ 2 ] + ::aCellColors[ nRow, nCol ][ 1 ] := aColors[ 1 ] + ::aCellColors[ nRow, nCol ][ 2 ] := aColors[ 2 ] NEXT ::dispRow( nRow ) NEXT @@ -618,7 +616,7 @@ METHOD readRecord( nRow ) CLASS TBrowse * CA-Cl*pper does not fully respect here the returned * value and current code below replicates what Clipper * seems to do but it means that in network environment - * with concurent modifications wrong records can be + * with concurrent modifications wrong records can be * shown. [druzus] */ IF nToMove > 0 @@ -808,7 +806,7 @@ METHOD stabilize() CLASS TBrowse * CA-Cl*pper does not fully respect here the returned * value and current code below replicates what Clipper * seems to do but it means that in network environment - * with concurent modifications wrong records can be + * with concurrent modifications wrong records can be * shown. [druzus] */ nToMove := ::nRowPos - ::nBufferPos @@ -909,7 +907,7 @@ STATIC FUNCTION _DECODECOLORS( cColorSpec ) FOR nPos := 1 TO nColors cColor := hb_tokenGet( cColorSpec, nPos, "," ) - /* For 1-st two colors CA-Cl*pper checks if given color + /* For 1st two colors CA-Cl*pper checks if given color * definition has at least one of the following characters: * "*+/bBgGrRwWnNiIxXuU0123456789" * If not then it takes default color value. @@ -970,7 +968,7 @@ STATIC FUNCTION _COLDEFCOLORS( aDefColorsIdx, nMaxColorIndex ) /* If oCol:colorBlock does not return array length enough then colors * are taken from preprocessed during configuration oCol:defColor array. - * oCol:colorBlock is used only for cells so only 1-st two color indexes + * oCol:colorBlock is used only for cells so only 1st two color indexes * are significant. [druzus] */ STATIC FUNCTION _CELLCOLORS( aCol, xValue, nMaxColorIndex ) @@ -1037,7 +1035,7 @@ METHOD setUnstable() CLASS TBrowse ::doConfigure() ENDIF - /* CA-Cl*pper dehighlights the current cell */ + /* CA-Cl*pper de-highlights the current cell */ IF ::lHiLited ::deHilite() ENDIF @@ -1123,7 +1121,7 @@ METHOD left() CLASS TBrowse DO WHILE .T. ::nColPos-- IF ::nColPos < 1 .OR. ::nColPos > ::colCount .OR. ; - ::aColData[ ::nColPos, _TBCI_CELLWIDTH ] != 0 + ::aColData[ ::nColPos ][ _TBCI_CELLWIDTH ] != 0 EXIT ENDIF ENDDO @@ -1137,7 +1135,7 @@ METHOD right() CLASS TBrowse DO WHILE .T. ::nColPos++ IF ::nColPos < 1 .OR. ::nColPos > ::colCount .OR. ; - ::aColData[ ::nColPos, _TBCI_CELLWIDTH ] != 0 + ::aColData[ ::nColPos ][ _TBCI_CELLWIDTH ] != 0 EXIT ENDIF ENDDO @@ -1556,7 +1554,7 @@ STATIC FUNCTION _MAXFREEZE( nColumns, aColData, nWidth ) /* CA-Cl*pper allows to freeze all columns only when they * are fully visible, otherwise it reserves at least one - * character for 1-st unfrozen column [druzus] + * character for 1st unfrozen column [druzus] */ IF nWidth > 0 .OR. ; nWidth == 0 .AND. _NEXTCOLUMN( aColData, nColumns + 1 ) == 0 @@ -1935,7 +1933,6 @@ METHOD colorSpec( cColorSpec ) CLASS TBrowse METHOD colCount() CLASS TBrowse - RETURN Len( ::columns ) @@ -1955,7 +1952,7 @@ METHOD rowCount() CLASS TBrowse /* NOTE: CA-Cl*pper has a bug where negative nRowPos value will be translated - to 16bit unsigned int, so the behaviour will be different in this case. + to 16-bit unsigned int, so the behaviour will be different in this case. [vszakats] */ METHOD setRowPos( nRowPos ) CLASS TBrowse @@ -1985,7 +1982,7 @@ METHOD getRowPos() CLASS TBrowse /* NOTE: CA-Cl*pper has a bug where negative nRowPos value will be translated - to 16bit unsigned int, so the behaviour will be different in this case. + to 16-bit unsigned int, so the behaviour will be different in this case. [vszakats] */ METHOD setColPos( nColPos ) CLASS TBrowse @@ -2208,7 +2205,6 @@ METHOD setColumn( nColumn, oCol ) CLASS TBrowse /* Gets a specific TBColumn object */ METHOD getColumn( nColumn ) CLASS TBrowse - #ifdef HB_CLP_STRICT RETURN ::columns[ nColumn ] #else @@ -2694,25 +2690,27 @@ FUNCTION TBMouse( oBrw, nMRow, nMCol ) IF oBrw:hitTest( nMRow, nMCol ) == HTCELL - IF ( n := oBrw:mRowPos - oBrw:rowPos ) < 0 + DO CASE + CASE ( n := oBrw:mRowPos - oBrw:rowPos ) < 0 DO WHILE ++n <= 0 oBrw:up() ENDDO - ELSEIF n > 0 + CASE n > 0 DO WHILE --n >= 0 oBrw:down() ENDDO - ENDIF + ENDCASE - IF ( n := oBrw:mColPos - oBrw:colPos ) < 0 + DO CASE + CASE ( n := oBrw:mColPos - oBrw:colPos ) < 0 DO WHILE ++n <= 0 oBrw:left() ENDDO - ELSEIF n > 0 + CASE n > 0 DO WHILE --n >= 0 oBrw:right() ENDDO - ENDIF + ENDCASE RETURN TBR_CONTINUE ENDIF diff --git a/src/rtl/tbrowsys.prg b/src/rtl/tbrowsys.prg index 89d37f97fb..acb48af8b7 100644 --- a/src/rtl/tbrowsys.prg +++ b/src/rtl/tbrowsys.prg @@ -52,46 +52,46 @@ FUNCTION TApplyKey( nKey, oBrowse ) RETURN oBrowse:applyKey( nKey ) -FUNCTION TBAddCol() /* TODO */ - RETURN NIL +PROCEDURE TBAddCol() /* TODO */ + RETURN -FUNCTION TBBBlock() /* TODO */ - RETURN NIL +PROCEDURE TBBBlock() /* TODO */ + RETURN -FUNCTION TBClose() /* TODO */ - RETURN NIL +PROCEDURE TBClose() /* TODO */ + RETURN -FUNCTION TBCreate() /* TODO */ - RETURN NIL +PROCEDURE TBCreate() /* TODO */ + RETURN -FUNCTION TBDelCol() /* TODO */ - RETURN NIL +PROCEDURE TBDelCol() /* TODO */ + RETURN -FUNCTION TBDisplay() /* TODO */ - RETURN NIL +PROCEDURE TBDisplay() /* TODO */ + RETURN -FUNCTION TBEditCell() /* TODO */ - RETURN NIL +PROCEDURE TBEditCell() /* TODO */ + RETURN -FUNCTION TBFBlock() /* TODO */ - RETURN NIL +PROCEDURE TBFBlock() /* TODO */ + RETURN -FUNCTION TBGoBot() /* TODO */ - RETURN NIL +PROCEDURE TBGoBot() /* TODO */ + RETURN -FUNCTION TBGoTop() /* TODO */ - RETURN NIL +PROCEDURE TBGoTop() /* TODO */ + RETURN -FUNCTION TBInsCol() /* TODO */ - RETURN NIL +PROCEDURE TBInsCol() /* TODO */ + RETURN -FUNCTION TBModal() /* TODO */ - RETURN NIL +PROCEDURE TBModal() /* TODO */ + RETURN -FUNCTION TBSBlock() /* TODO */ - RETURN NIL +PROCEDURE TBSBlock() /* TODO */ + RETURN -FUNCTION TBSkip() /* TODO */ - RETURN NIL +PROCEDURE TBSkip() /* TODO */ + RETURN #endif diff --git a/src/rtl/tclass.prg b/src/rtl/tclass.prg index adc0c2b4bd..0fb9679fe0 100644 --- a/src/rtl/tclass.prg +++ b/src/rtl/tclass.prg @@ -2,6 +2,16 @@ * Base Class for internal handling of class creation * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 2000 J. Lefebvre <jfl@mafact.com> and RA. Cuylen <rac@mafact.com> + * Multiple inheritance + * Support shared class DATA + * scoping (hidden, protected, readOnly) + * Use of __cls_param function to allow multiple superclass declaration + * Suppress of SetType and SetInit not needed anymore + * Delegation and forwarding + * Preparing the InitClass class method (not working!) + * Copyright 1999 Eddie Runia <eddie@runia.com> + * Support for inheritance, default DATA values * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,26 +54,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2000 J. Lefebvre <jfl@mafact.com> and RA. Cuylen <rac@mafact.com> - * Multiple inheritance - * Support shared class DATA - * scoping (hidden, protected, readOnly) - * Use of __cls_param function to allow multiple superclass declaration - * Suppress of SetType and SetInit not more nedded - * Delegation and forwarding - * Preparing the InitClass class method (not working !!) - * - * Copyright 1999 Eddie Runia <eddie@runia.com> - * Support for inheritance - * Support for default DATA values - * - * See COPYING.txt for licensing terms. - * - */ - /* NOTE: This .prg is also used by the debugger subsystem, therefore we need this switch to avoid an infinite loop when launching it. [vszakats] */ @@ -77,7 +67,7 @@ REQUEST HBObject FUNCTION HBClass() - STATIC s_hClass /* NOTE: Automatically defaults to NIL */ + STATIC s_hClass /* NOTE: Automatically defaults to NIL */ LOCAL hClass @@ -167,22 +157,24 @@ STATIC FUNCTION New( cClassName, xSuper, sClassFunc, lModuleFriendly ) LOCAL Self := QSelf() LOCAL i - IF HB_ISSYMBOL( xSuper ) + DO CASE + CASE HB_ISSYMBOL( xSuper ) ::asSuper := { xSuper } - ELSEIF Empty( xSuper ) + CASE Empty( xSuper ) ::asSuper := {} - ELSEIF HB_ISSTRING( xSuper ) + CASE HB_ISSTRING( xSuper ) ::asSuper := { __dynsN2Sym( xSuper ) } - ELSEIF HB_ISARRAY( xSuper ) + CASE HB_ISARRAY( xSuper ) ::asSuper := {} FOR EACH i IN xSuper - IF HB_ISSYMBOL( i ) + DO CASE + CASE HB_ISSYMBOL( i ) AAdd( ::asSuper, i ) - ELSEIF HB_ISSTRING( i ) .AND. ! Empty( i ) + CASE HB_ISSTRING( i ) .AND. ! Empty( i ) AAdd( ::asSuper, __dynsN2Sym( i ) ) - ENDIF + ENDCASE NEXT - ENDIF + ENDCASE ::cName := hb_asciiUpper( cClassName ) ::sClassFunc := sClassFunc @@ -234,7 +226,7 @@ STATIC PROCEDURE Create( /* MetaClass */ ) NEXT #endif - /* local messages... */ + /* Local messages */ FOR EACH n IN ::aDatas __clsAddMsg( hClass, n[ HB_OO_DATA_SYMBOL ] , n:__enumIndex(), ; @@ -292,7 +284,6 @@ STATIC PROCEDURE Create( /* MetaClass */ ) RETURN STATIC FUNCTION Instance() - RETURN __clsInst( QSelf():hClass ) STATIC PROCEDURE AddData( cData, xInit, cType, nScope, lNoinit ) @@ -415,13 +406,14 @@ STATIC PROCEDURE AddDelegate( xMethod, cDelegMsg, cObject, nScope ) LOCAL mth - IF HB_ISSTRING( xMethod ) + DO CASE + CASE HB_ISSTRING( xMethod ) AAdd( QSelf():aDelegates, { xMethod, cDelegMsg, cObject, nScope } ) - ELSEIF HB_ISARRAY( xMethod ) + CASE HB_ISARRAY( xMethod ) FOR EACH mth IN xMethod AAdd( QSelf():aDelegates, { mth, cDelegMsg, cObject, nScope } ) NEXT - ENDIF + ENDCASE RETURN diff --git a/src/rtl/teditor.prg b/src/rtl/teditor.prg index 764ee9ec75..8504c702ac 100644 --- a/src/rtl/teditor.prg +++ b/src/rtl/teditor.prg @@ -93,12 +93,12 @@ CREATE CLASS HBEditor METHOD ExitState() // Returns ::lExitEdit METHOD KeyboardHook( nKey ) // Gets called every time there is a key not handled directly by HBEditor - METHOD IdleHook() // Gets called every time there are no more keys to hanlde just before HBEditor blocks itself waiting for a char + METHOD IdleHook() // Gets called every time there are no more keys to handle just before HBEditor blocks itself waiting for a char METHOD Resize( nTop, nLeft, nBottom, nRight ) // Redefines editor window size and refreshes it METHOD SetColor( cColorString ) // Sets/retrieves color used for screen writes - METHOD Hilite() // Start Hilighting swapping first two color definitions inside cColorSpec - METHOD DeHilite() // Stop Hilighting + METHOD Hilite() // Start highlighting swapping first two color definitions inside cColorSpec + METHOD DeHilite() // Stop highlighting METHOD Row() // Returns current line position on the screen METHOD Col() // Returns current column position on the screen @@ -215,7 +215,7 @@ METHOD LoadText( cText ) CLASS HBEditor // Saves file being edited, if there is no file name does nothing, returns .T. if OK METHOD SaveFile() CLASS HBEditor - RETURN ! HB_ISNULL( ::cFile ) .AND. ; + RETURN ! ::cFile == "" .AND. ; ! ::lDirty := ! hb_MemoWrit( ::cFile, ::GetText() ) // Add a new Line of text at end of current text diff --git a/src/rtl/tmenuitm.prg b/src/rtl/tmenuitm.prg index 5a3eb4021c..cca3081e3c 100644 --- a/src/rtl/tmenuitm.prg +++ b/src/rtl/tmenuitm.prg @@ -48,7 +48,7 @@ #include "button.ch" -#define IS_IN( str, list ) ( "|" + str + "|" $ "|" + list + "|" ) +#define IS_IN( str, list ) ( "|" + ( str ) + "|" $ "|" + ( list ) + "|" ) /* NOTE: Harbour doesn't support CA-Cl*pper 5.3 GUI functionality, but it has all related variables and methods. */ diff --git a/src/rtl/tmenusys.prg b/src/rtl/tmenusys.prg index ea2879f18e..1494f42c70 100644 --- a/src/rtl/tmenusys.prg +++ b/src/rtl/tmenusys.prg @@ -50,14 +50,14 @@ #include "inkey.ch" #include "setcurs.ch" -#define IS_IN( str, list ) ( "|" + str + "|" $ "|" + list + "|" ) +#define IS_IN( str, list ) ( "|" + ( str ) + "|" $ "|" + ( list ) + "|" ) /* NOTE: Harbour doesn't support CA-Cl*pper 5.3 GUI functionality, but it has all related variables and methods. */ #ifdef HB_COMPAT_C53 -/* Some helper contants for the ReadStats() calls. */ +/* Some helper constants for the ReadStats() calls. */ #define SNLASTEXIT 6 #define SNNEXTGET 12 @@ -98,11 +98,7 @@ CREATE CLASS HBMenuSys ENDCLASS -/*** -* -* Standard Menu System Modal handling for Menu Items -* -***/ +/* Standard Menu System Modal handling for Menu Items */ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLASS HBMenuSys LOCAL oTopMenu := ::oMenu @@ -140,7 +136,6 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA hb_Scroll( ::nMsgRow, ::nMsgLeft, ::nMsgRow, ::nMsgRight ) ::cMsgSaveS := SaveScreen( ::nMsgRow, ::nMsgLeft, ::nMsgRow, ::nMsgRight ) - ENDIF oTopMenu:select( nSelection ) @@ -164,17 +159,13 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA ELSEIF IsShortcut( oTopMenu, nKey, @nReturn ) RETURN nReturn - ELSE nSelection := 1 - ENDIF - ENDDO oTopMenu:select( nSelection ) oTopMenu:display() - ENDIF IF ! oTopMenu:getItem( nSelection ):enabled @@ -226,9 +217,7 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA ::PushMenu() ::ShowMsg( .T. ) ENDIF - ENDIF - ENDIF CASE nKey == K_DOWN @@ -249,7 +238,7 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA CASE nKey == K_UP - IF !( ::oMenu:ClassName() == "TOPBARMENU" ) + IF ! ::oMenu:ClassName() == "TOPBARMENU" nTemp := ::oMenu:getPrev() IF nTemp == 0 nTemp := ::oMenu:getLast() @@ -257,7 +246,6 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA ::oMenu:select( nTemp ) ::oMenu:display() ::ShowMsg( .T. ) - ENDIF CASE nKey == K_LEFT @@ -265,6 +253,7 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA IF ( lSubMenu := ( ::nMenuLevel > 1 ) ) ::PopMenu() ENDIF + IF ::oMenu:ClassName() == "TOPBARMENU" nTemp := ::oMenu:getPrev() IF nTemp == 0 @@ -315,14 +304,12 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA ::oMenu:display() ::ShowMsg( .T. ) ELSE - IF IS_IN( ::oMenu:ClassName(), "POPUPMENU|HB_POPUPMENU" ) ::oMenu:close() ENDIF - nReturn := -1 // Bail out if at the top menu item + nReturn := -1 // Bail out if at the top menu item EXIT - ENDIF CASE nKey == K_LBUTTONDOWN @@ -399,7 +386,6 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA ENDIF ENDIF ::ShowMsg( .T. ) - ENDIF CASE IsShortcut( oTopMenu, nKey, @nReturn ) @@ -438,7 +424,6 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA ENDIF ENDCASE - ENDDO IF ::lMsgFlag @@ -452,12 +437,8 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA RETURN nReturn -/*** -* -* Increment ::nMenuLevel and optionally select first item. -* If selected MenuItem IsPopUp, assign ::oMenu. -* -***/ +/* Increment ::nMenuLevel and optionally select first item. + If selected MenuItem IsPopUp, assign ::oMenu. */ METHOD PushMenu() CLASS HBMenuSys LOCAL oNewMenu := ::oMenu:getItem( ::oMenu:current ) @@ -473,16 +454,11 @@ METHOD PushMenu() CLASS HBMenuSys ENDIF RETURN .T. - ENDIF RETURN .F. -/*** -* -* Close SubMenuItem and Return to the upper MenuItem level. -* -***/ +/* Close SubMenuItem and Return to the upper MenuItem level. */ METHOD PopMenu() CLASS HBMenuSys IF ::nMenuLevel > 1 @@ -494,11 +470,7 @@ METHOD PopMenu() CLASS HBMenuSys RETURN .F. -/*** -* -* Close PopUp Child MenuItem and Return to the upper MenuItem level. -* -***/ +/* Close PopUp Child MenuItem and Return to the upper MenuItem level. */ METHOD PopChild( nNewLevel ) CLASS HBMenuSys LOCAL oOldMenuItem @@ -511,16 +483,11 @@ METHOD PopChild( nNewLevel ) CLASS HBMenuSys ::nMenuLevel := nNewLevel RETURN .T. ENDIF - ENDIF RETURN .F. -/*** -* -* Close all Menus below Top Menu and Return to upper MenuItem level. -* -***/ +/* Close all Menus below Top Menu and Return to upper MenuItem level. */ METHOD PopAll() CLASS HBMenuSys IF ::aMenuList[ 2 ] != NIL @@ -532,11 +499,7 @@ METHOD PopAll() CLASS HBMenuSys RETURN .T. -/*** -* -* Eval() the Data block if selected MenuItem is ! IsPopUp. -* -***/ +/* Eval() the Data block if selected MenuItem is ! IsPopUp. */ METHOD Execute() CLASS HBMenuSys LOCAL oNewMenu := ::oMenu:getItem( ::oMenu:current ) @@ -573,17 +536,12 @@ METHOD Execute() CLASS HBMenuSys ENDIF RETURN oNewMenu:Id - ENDIF RETURN 0 -/*** -* -* Test to find the Mouse location. -* Note: Formal parameters received here were passed by reference. -* -***/ +/* Test to find the Mouse location. + NOTE: Formal parameters received here were passed by reference. */ METHOD MHitTest( oNewMenu, nNewLevel, nNewItem ) CLASS HBMenuSys FOR nNewLevel := ::nMenuLevel TO 1 STEP -1 @@ -591,25 +549,21 @@ METHOD MHitTest( oNewMenu, nNewLevel, nNewItem ) CLASS HBMenuSys oNewMenu := ::aMenuList[ nNewLevel ] nNewItem := oNewMenu:hitTest( MRow(), MCol() ) - IF nNewItem < 0 - RETURN .F. // Test for the mouse on Menu separator or border - ELSEIF nNewItem > 0 .AND. oNewMenu:getItem( nNewItem ):enabled - RETURN .T. // Test for the mouse on an enabled item in the menu - ENDIF - + DO CASE + CASE nNewItem < 0 + RETURN .F. // Test for the mouse on Menu separator or border + CASE nNewItem > 0 .AND. oNewMenu:getItem( nNewItem ):enabled + RETURN .T. // Test for the mouse on an enabled item in the menu + ENDCASE NEXT RETURN .F. -/*** -* -* Erase and Show Messages. -* Erase Message then ::ShowMsg() if lMode is .T. -* Only erases Menu Message if lMode is .F. -* SaveScreen()/RestScreen() is used for the -* Message area in both text or graphics mode. -* -***/ +/* Erase and Show Messages. + Erase Message then ::ShowMsg() if lMode is .T. + Only erases Menu Message if lMode is .F. + SaveScreen()/RestScreen() is used for the + Message area in both text or graphics mode. */ METHOD ShowMsg( lMode ) CLASS HBMenuSys LOCAL nCurrent @@ -633,7 +587,6 @@ METHOD ShowMsg( lMode ) CLASS HBMenuSys ::cOldMessage := cMsg ::lOldMsgFlag := ::lMsgFlag - ENDIF RETURN .T. @@ -644,7 +597,7 @@ METHOD ShowMsg( lMode ) CLASS HBMenuSys METHOD GetMsgArray() CLASS HBMenuSys RETURN {, ::nMsgRow, ::nMsgLeft, ::nMsgRight, ::cMsgColor, , , , , } -/* -------------------------------------------- */ +/* --- */ METHOD New( oMenu ) CLASS HBMenuSys diff --git a/src/rtl/tpersist.prg b/src/rtl/tpersist.prg index c2979782e2..4f1c2034fb 100644 --- a/src/rtl/tpersist.prg +++ b/src/rtl/tpersist.prg @@ -121,7 +121,7 @@ METHOD LoadFromText( cObjectText, lIgnoreErrors ) CLASS HBPersistent ENDSWITCH ENDIF - IF !Empty( cProp ) + IF ! Empty( cProp ) IF ( nPos := At( "[", cProp ) ) > 0 cInd := hb_StrReplace( SubStr( cProp, nPos + 1, Len( cProp ) - nPos - 1 ), ; { " " => "", "][" => "," } ) diff --git a/src/rtl/trace.c b/src/rtl/trace.c index c525667662..0ce4f9ab9d 100644 --- a/src/rtl/trace.c +++ b/src/rtl/trace.c @@ -114,11 +114,11 @@ HB_FUNC( HB_TRACELEVEL ) HB_FUNC( HB_TRACELOGLEVEL ) { - int iOldLevel = s_traceLogLevel, iLevel; + int iOldLevel = s_traceLogLevel; if( HB_ISNUM( 1 ) ) { - iLevel = hb_parni( 1 ); + int iLevel = hb_parni( 1 ); if( iLevel >= HB_TR_ALWAYS && iLevel < HB_TR_LAST ) s_traceLogLevel = iLevel; } diff --git a/src/rtl/transfrm.c b/src/rtl/transfrm.c index 9d1cd26bd5..bec52ddd03 100644 --- a/src/rtl/transfrm.c +++ b/src/rtl/transfrm.c @@ -2,6 +2,7 @@ * Transform() function * * Copyright 2012 Przemyslaw Czerpak <druzus / at / priv.onet.pl> + * Copyright 1999 Matthew Hamilton <mhamilton@bunge.com.au> (String handling) * Copyright 1999 Eddie Runia <eddie@runia.com> * * This program is free software; you can redistribute it and/or modify @@ -45,16 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Matthew Hamilton <mhamilton@bunge.com.au> - * String handling - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" @@ -104,9 +95,7 @@ HB_FUNC( TRANSFORM ) HB_SIZE nOffset = 0; - /* ======================================================= */ - /* Analyze picture functions */ - /* ======================================================= */ + /* --- Analyze picture functions --- */ uiPicFlags = 0; @@ -197,16 +186,13 @@ HB_FUNC( TRANSFORM ) } } - /* ======================================================= */ - /* Handle STRING values */ - /* ======================================================= */ + /* --- Handle STRING values --- */ if( HB_IS_STRING( pValue ) ) { const char * szExp = hb_itemGetCPtr( pValue ); HB_SIZE nExpLen = hb_itemGetCLen( pValue ); HB_SIZE nExpPos = 0; - HB_BOOL bFound = HB_FALSE; /* Grab enough */ @@ -337,6 +323,8 @@ HB_FUNC( TRANSFORM ) if( uiPicFlags & PF_EXCHANG ) { + HB_BOOL bFound = HB_FALSE; + while( nExpPos < nResultPos ) { if( szResult[ nExpPos ] == ',' ) @@ -398,9 +386,7 @@ HB_FUNC( TRANSFORM ) } } - /* ======================================================= */ - /* Handle NUMERIC values */ - /* ======================================================= */ + /* --- Handle NUMERIC values --- */ else if( HB_IS_NUMERIC( pValue ) ) { @@ -408,7 +394,6 @@ HB_FUNC( TRANSFORM ) int iDec; /* Number of decimals */ int iCount; HB_SIZE i; - char cPic; PHB_ITEM pNumber = NULL; double dValue = hb_itemGetND( pValue ); @@ -466,7 +451,7 @@ HB_FUNC( TRANSFORM ) if( ( uiPicFlags & ( PF_DEBIT | PF_PARNEG | PF_PARNEGWOS ) ) && dValue < 0 ) { /* Always convert absolute val */ - if( HB_IS_NUMINT( pValue ) ) /* workaround for 64bit integer conversion */ + if( HB_IS_NUMINT( pValue ) ) /* workaround for 64-bit integer conversion */ pNumber = hb_itemPutNInt( NULL, -hb_itemGetNInt( pValue ) ); else pNumber = hb_itemPutND( NULL, -dValue ); @@ -536,7 +521,7 @@ HB_FUNC( TRANSFORM ) for( i = iCount = 0; i < nPicLen; i++ ) { - cPic = szPic[ i ]; + char cPic = szPic[ i ]; if( cPic == '9' || cPic == '#' ) { szResult[ i ] = iCount < iWidth ? szStr[ iCount++ ] : ' '; @@ -651,9 +636,7 @@ HB_FUNC( TRANSFORM ) szResult[ i ] = '\0'; } - /* ======================================================= */ - /* Handle DATE values */ - /* ======================================================= */ + /* --- Handle DATE values --- */ else if( HB_IS_DATE( pValue ) ) { @@ -669,7 +652,7 @@ HB_FUNC( TRANSFORM ) if( uiPicFlags & PF_BRITISH ) { /* When @E is used CA-Cl*pper do not update date format - * pattern but wrongly moves 4-th and 5-th bytes of + * pattern but wrongly moves 4th and 5th bytes of * formatted date to the beginning (see below). It causes * that date formats formats different then MM?DD?YY[YY] * are wrongly translated. The code below is not CA-Cl*pper @@ -754,9 +737,7 @@ HB_FUNC( TRANSFORM ) } } - /* ======================================================= */ - /* Handle TIMESTAMP values */ - /* ======================================================= */ + /* --- Handle TIMESTAMP values --- */ else if( HB_IS_TIMESTAMP( pValue ) ) { @@ -775,7 +756,7 @@ HB_FUNC( TRANSFORM ) if( szDateFormat && ( uiPicFlags & PF_BRITISH ) ) { /* When @E is used CA-Cl*pper do not update date format - * pattern but wrongly moves 4-th and 5-th bytes of + * pattern but wrongly moves 4th and 5th bytes of * formatted date to the beginning (see below). It causes * that date formats formats different then MM?DD?YY[YY] * are wrongly translated. The code below is not CA-Cl*pper @@ -872,9 +853,7 @@ HB_FUNC( TRANSFORM ) } } - /* ======================================================= */ - /* Handle LOGICAL values */ - /* ======================================================= */ + /* --- Handle LOGICAL values --- */ else if( HB_IS_LOGICAL( pValue ) ) { @@ -904,13 +883,13 @@ HB_FUNC( TRANSFORM ) switch( cPic ) { - case 'y': /* Yes/No */ - case 'Y': /* Yes/No */ + case 'y': /* Yes/No */ + case 'Y': /* Yes/No */ if( ! bDone ) { szResult[ nResultPos ] = hb_itemGetL( pValue ) ? 'Y' : 'N'; - bDone = HB_TRUE; /* Logical written */ + bDone = HB_TRUE; /* Logical written */ } else szResult[ nResultPos ] = ' '; @@ -918,8 +897,8 @@ HB_FUNC( TRANSFORM ) break; case '#': - case 'l': /* True/False */ - case 'L': /* True/False */ + case 'l': /* True/False */ + case 'L': /* True/False */ if( ! bDone ) { @@ -940,7 +919,7 @@ HB_FUNC( TRANSFORM ) } } - /* ======================================================= */ + /* --- */ else { @@ -971,7 +950,7 @@ HB_FUNC( TRANSFORM ) hb_retclen_buffer( szResult, ( nParamS && nResultPos > nParamS ) ? nParamS : nResultPos ); } } - else if( pPic || HB_ISNIL( 2 ) ) /* Picture is an empty string or NIL */ + else if( pPic || HB_ISNIL( 2 ) ) /* Picture is an empty string or NIL */ { if( HB_IS_STRING( pValue ) ) { diff --git a/src/rtl/treport.prg b/src/rtl/treport.prg index dec9278573..2105d70665 100644 --- a/src/rtl/treport.prg +++ b/src/rtl/treport.prg @@ -180,7 +180,7 @@ CREATE CLASS HBReportForm ENDCLASS -METHOD New( cFrmName AS STRING, ; +METHOD PROCEDURE New( cFrmName AS STRING, ; lPrinter AS LOGICAL, ; cAltFile AS STRING, ; lNoConsole AS LOGICAL, ; @@ -421,7 +421,7 @@ METHOD New( cFrmName AS STRING, ; BREAK xBreakVal ENDIF - RETURN NIL + RETURN METHOD PrintIt( cString AS STRING ) CLASS HBReportForm @@ -486,7 +486,7 @@ METHOD ReportHeader() CLASS HBReportForm NEXT NEXT - AAdd( aPageHeader, "" ) // S87 compat. + AAdd( aPageHeader, "" ) // S87 compatibility nLinesInHeader := Len( aPageHeader ) nMaxColLength := 0 @@ -532,7 +532,7 @@ METHOD ReportHeader() CLASS HBReportForm RETURN Self -METHOD ExecuteReport() CLASS HBReportForm +METHOD PROCEDURE ExecuteReport() CLASS HBReportForm LOCAL aRecordHeader := {} // Header for the current record LOCAL aRecordToPrint := {} // Current record to print @@ -724,11 +724,12 @@ METHOD ExecuteReport() CLASS HBReportForm // Determine the max number of lines needed by each expression nMaxLines := 1 FOR EACH aCol IN ::aReportData[ RPT_COLUMNS ] - IF aCol[ RCT_TYPE ] $ "M" + DO CASE + CASE aCol[ RCT_TYPE ] $ "M" nMaxLines := Max( XMLCOUNT( Eval( aCol[ RCT_EXP ] ), aCol[ RCT_WIDTH ] ), nMaxLines ) - ELSEIF aCol[ RCT_TYPE ] $ "C" + CASE aCol[ RCT_TYPE ] $ "C" nMaxLines := Max( XMLCOUNT( StrTran( Eval( aCol[ RCT_EXP ] ), ";", hb_eol() ), aCol[ RCT_WIDTH ] ), nMaxLines ) - ENDIF + ENDCASE NEXT // Size aRecordToPrint to the maximum number of lines it will need, then @@ -821,7 +822,7 @@ METHOD ExecuteReport() CLASS HBReportForm ENDIF ENDIF // Was this a summary report? - RETURN NIL + RETURN METHOD LoadReportFile( cFrmFile AS STRING ) CLASS HBReportForm @@ -1015,20 +1016,13 @@ METHOD LoadReportFile( cFrmFile AS STRING ) CLASS HBReportForm RETURN aReport -/*** -* GetExpr( nPointer ) --> cString -* -* Reads an expression from EXPR_BUFF via the OFFSETS_BUFF and returns -* a pointer to offset contained in OFFSETS_BUFF that in turn points -* to an expression located in the EXPR_BUFF string. -* -* Notes: -* -* 1. The expression is empty if: -* a. Passed pointer is equal to 65535 -* b. Character following character pointed to by pointer is Chr( 0 ) -*/ - +/* Reads an expression from EXPR_BUFF via the OFFSETS_BUFF and returns + a pointer to offset contained in OFFSETS_BUFF that in turn points + to an expression located in the EXPR_BUFF string. + Notes: + 1. The expression is empty if: + a. Passed pointer is equal to 65535 + b. Character following character pointed to by pointer is hb_BChar( 0 ) */ METHOD GetExpr( nPointer AS NUMERIC ) CLASS HBReportForm LOCAL nExprOffset @@ -1036,11 +1030,11 @@ METHOD GetExpr( nPointer AS NUMERIC ) CLASS HBReportForm LOCAL nOffsetOffset := 0 LOCAL cString := "" - // Stuff for dBASE compatability. + // Stuff for dBase compatibility. IF nPointer != 65535 - // Convert FILE offset to CLIPPER string offset + // Convert FILE offset to Cl*pper string offset nPointer++ // Calculate offset into OFFSETS_BUFF @@ -1060,7 +1054,7 @@ METHOD GetExpr( nPointer AS NUMERIC ) CLASS HBReportForm // Extract string cString := hb_BSubStr( ::cExprBuff, nExprOffset, nExprLength ) - // dBASE does this so we must do it too + // dBase does this so we must do it too // Character following character pointed to by pointer is NULL IF hb_BLeft( cString, 1 ) == hb_BChar( 0 ) cString := "" @@ -1096,10 +1090,6 @@ STATIC FUNCTION XMLCOUNT( cString, nLineLength, nTabSize, lWrap ) RETURN MLCount( RTrim( cString ), nLineLength, nTabSize, lWrap ) -/*** -* XMEMOLINE( <cString>, [<nLineLength>], [<nLineNumber>], -* [<nTabSize>], [<lWrap>] ) --> cLine -*/ STATIC FUNCTION XMEMOLINE( cString, nLineLength, nLineNumber, nTabSize, lWrap ) hb_default( @nLineLength, 79 ) @@ -1140,18 +1130,12 @@ STATIC FUNCTION ParseHeader( cHeaderString, nFields ) RETURN aPageHeader -/*** -* GetColumn( <cFieldBuffer>, @<nOffset> ) --> aColumn -* -* Get a COLUMN element from FIELDS_BUFF string using nOffset to point to -* the current FIELDS_OFFSET block. -* -* Notes: -* 1. The Header or Contents expressions are empty if: -* a. Passed pointer is equal to 65535 -* b. Character following character pointed to by pointer is Chr( 0 ) -*/ - +/* Get a COLUMN element from FIELDS_BUFF string using nOffset to point to + the current FIELDS_OFFSET block. + Notes: + 1. The Header or Contents expressions are empty if: + a. Passed pointer is equal to 65535 + b. Character following character pointed to by pointer is hb_BChar( 0 ) */ METHOD GetColumn( cFieldsBuffer AS STRING, /* @ */ nOffset AS NUMERIC ) CLASS HBReportForm LOCAL aColumn[ RCT_COUNT ] @@ -1233,9 +1217,11 @@ STATIC FUNCTION MakeAStr( uVar, cType ) RETURN "INVALID EXPRESSION" -FUNCTION __ReportForm( cFRMName, lPrinter, cAltFile, lNoConsole, bFor, ; +PROCEDURE __ReportForm( cFRMName, lPrinter, cAltFile, lNoConsole, bFor, ; bWhile, nNext, nRecord, lRest, lPlain, cHeading, ; lBEject, lSummary ) - RETURN HBReportForm():New( cFrmName, lPrinter, cAltFile, lNoConsole, bFor, bWhile, nNext, nRecord, ; + HBReportForm():New( cFrmName, lPrinter, cAltFile, lNoConsole, bFor, bWhile, nNext, nRecord, ; lRest, lPlain, cHeading, lBEject, lSummary ) + + RETURN diff --git a/src/rtl/trim.c b/src/rtl/trim.c index 62d61e870d..623dad371e 100644 --- a/src/rtl/trim.c +++ b/src/rtl/trim.c @@ -52,7 +52,7 @@ /* also returns the new length in lLen */ const char * hb_strLTrim( const char * szText, HB_SIZE * nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_strLTrim(%s, %p)", szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strLTrim(%s, %p)", szText, ( void * ) nLen ) ); while( *nLen && HB_ISSPACE( *szText ) ) { @@ -127,7 +127,7 @@ HB_FUNC( RTRIM ) hb_retclen( szText, nLen ); } else - /* NOTE: "TRIM" is right here [vszakats] */ + /* NOTE: "TRIM" is correct here [vszakats] */ hb_errRT_BASE_SubstR( EG_ARG, 1100, NULL, "TRIM", HB_ERR_ARGS_BASEPARAMS ); } diff --git a/src/rtl/tscalar.prg b/src/rtl/tscalar.prg index 097fb6dcd5..e1d305898f 100644 --- a/src/rtl/tscalar.prg +++ b/src/rtl/tscalar.prg @@ -45,11 +45,11 @@ */ /* Class(y) documentation is located at: - http://www.clipx.net/ng/classy/ngdebc.php */ + https://harbour.github.io/ng/classy/menu.html */ #include "hbclass.ch" -/* -------------------------------------------- */ +/* --- */ CREATE CLASS ScalarObject FUNCTION HBScalar @@ -98,14 +98,16 @@ METHOD AsExpStr() CLASS ScalarObject RETURN ::AsString() -METHOD BecomeErr() CLASS ScalarObject +METHOD PROCEDURE BecomeErr() CLASS ScalarObject +#if 0 // Not implemented yet - // ::error( CSYERR_BECOME, "Message 'become' illegally sent to scalar", ::ClassName() ) + ::error( CSYERR_BECOME, "Message 'become' illegally sent to scalar", ::ClassName() ) +#endif - RETURN NIL + RETURN -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Array INHERIT HBScalar FUNCTION __HBArray @@ -125,7 +127,7 @@ CREATE CLASS Array INHERIT HBScalar FUNCTION __HBArray METHOD IsScalar() METHOD Remove( e ) METHOD Scan( b ) - METHOD _Size( newSize ) // assignment method + METHOD _Size( newSize ) // assignment method MESSAGE Append METHOD Add @@ -184,12 +186,13 @@ METHOD DeleteAt( n ) CLASS Array METHOD InsertAt( n, x ) CLASS Array - IF n > Len( Self ) + DO CASE + CASE n > Len( Self ) ASize( Self, n ) Self[ n ] := x - ELSEIF n >= 1 + CASE n >= 1 hb_AIns( Self, n, x, .T. ) - ENDIF + ENDCASE RETURN Self @@ -218,11 +221,11 @@ METHOD IndexOf( x ) CLASS Array RETURN 0 -METHOD Remove( e ) CLASS Array +METHOD PROCEDURE Remove( e ) CLASS Array ::DeleteAt( ::IndexOf( e ) ) - RETURN NIL + RETURN METHOD Scan( b ) CLASS Array RETURN AScan( Self, b ) @@ -233,7 +236,7 @@ METHOD _Size( newSize ) CLASS Array RETURN newSize // so that assignment works according to standard rules -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Block INHERIT HBScalar FUNCTION __HBBlock @@ -244,7 +247,7 @@ ENDCLASS METHOD AsString() CLASS Block RETURN "{ || ... }" -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Character INHERIT HBScalar FUNCTION __HBCharacter @@ -259,7 +262,7 @@ METHOD AsString() CLASS Character METHOD AsExpStr() CLASS Character RETURN '"' + Self + '"' -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Date INHERIT HBScalar FUNCTION __HBDate @@ -286,7 +289,7 @@ METHOD Month() CLASS Date METHOD Day() CLASS Date RETURN Day( Self ) -/* -------------------------------------------- */ +/* --- */ CREATE CLASS TimeStamp INHERIT HBScalar FUNCTION __HBTimeStamp @@ -311,10 +314,10 @@ METHOD AsExpStr() CLASS TimeStamp RETURN 'hb_SToT("' + ::AsString() + '")' METHOD Date() CLASS TimeStamp - RETURN hb_TToC( Self, NIL, "" ) + RETURN hb_TToC( Self,, "" ) METHOD Time() CLASS TimeStamp - RETURN hb_TToC( Self, "", "HH:MM:SS" ) + RETURN hb_TToC( Self, "", "hh:mm:ss" ) METHOD Year() CLASS TimeStamp RETURN Year( Self ) @@ -334,7 +337,7 @@ METHOD Minute() CLASS TimeStamp METHOD Sec() CLASS TimeStamp RETURN hb_Sec( Self ) -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Hash INHERIT HBScalar FUNCTION __HBHash @@ -345,7 +348,7 @@ ENDCLASS METHOD AsString() CLASS Hash RETURN "{ ... => ... }" -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Logical INHERIT HBScalar FUNCTION __HBLogical @@ -356,7 +359,7 @@ ENDCLASS METHOD AsString() CLASS Logical RETURN iif( Self, ".T.", ".F." ) -/* -------------------------------------------- */ +/* --- */ CREATE CLASS NIL INHERIT HBScalar FUNCTION __HBNil @@ -367,7 +370,7 @@ ENDCLASS METHOD AsString() CLASS NIL RETURN "NIL" -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Numeric INHERIT HBScalar FUNCTION __HBNumeric @@ -378,7 +381,7 @@ ENDCLASS METHOD AsString() CLASS Numeric RETURN hb_ntos( Self ) -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Symbol INHERIT HBScalar FUNCTION __HBSymbol @@ -389,7 +392,7 @@ ENDCLASS METHOD AsString() CLASS Symbol RETURN "@" + ::name + "()" -/* -------------------------------------------- */ +/* --- */ CREATE CLASS Pointer INHERIT HBScalar FUNCTION __HBPointer @@ -399,5 +402,3 @@ ENDCLASS METHOD AsString() CLASS Pointer RETURN "<0x...>" - -/* -------------------------------------------- */ diff --git a/src/rtl/version.c b/src/rtl/version.c index 2ffeebd369..8f2d41dc1e 100644 --- a/src/rtl/version.c +++ b/src/rtl/version.c @@ -2,6 +2,7 @@ * Version related functions * * Copyright 1999-2015 Viktor Szakats (vszakats.net/harbour) + * Copyright 2013 Przemyslaw Czerpak <druzus / at / priv.onet.pl> (timestamp conversion) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/rtl/vfile.c b/src/rtl/vfile.c index 8d628a5c27..a6b699f1b4 100644 --- a/src/rtl/vfile.c +++ b/src/rtl/vfile.c @@ -129,7 +129,7 @@ static void hb_fileReturn( PHB_FILE pFile ) hb_ret(); } -/* hb_vfExists( <cFileName>, [ @<cDestFileName> ] ) -> <lOK> */ +/* hb_vfExists( <cFileName>, [ @<cDestFileName> ] ) --> <lOK> */ HB_FUNC( HB_VFEXISTS ) { const char * pszFileName = hb_parc( 1 ); @@ -156,7 +156,7 @@ HB_FUNC( HB_VFEXISTS ) hb_retl( fResult ); } -/* hb_vfErase( <cFileName> ) -> <nResult> */ +/* hb_vfErase( <cFileName> ) --> <nResult> */ HB_FUNC( HB_VFERASE ) { const char * pszFile = hb_parc( 1 ); @@ -174,7 +174,7 @@ HB_FUNC( HB_VFERASE ) hb_retni( iResult ); } -/* hb_vfRename( <cFileSrc>, <cFileDst> ) -> <nResult> */ +/* hb_vfRename( <cFileSrc>, <cFileDst> ) --> <nResult> */ HB_FUNC( HB_VFRENAME ) { const char * szFileOld = hb_parc( 1 ), @@ -193,7 +193,7 @@ HB_FUNC( HB_VFRENAME ) hb_retni( iResult ); } -/* hb_vfCopyFile( <cFileSrc>, <cFileDst> ) -> <nResult> */ +/* hb_vfCopyFile( <cFileSrc>, <cFileDst> ) --> <nResult> */ HB_FUNC( HB_VFCOPYFILE ) { const char * pszSource = hb_parc( 1 ), @@ -212,7 +212,7 @@ HB_FUNC( HB_VFCOPYFILE ) hb_retni( iResult ); } -/* hb_vfMoveFile( <cFileSrc>, <cFileDst> ) -> <nResult> */ +/* hb_vfMoveFile( <cFileSrc>, <cFileDst> ) --> <nResult> */ HB_FUNC( HB_VFMOVEFILE ) { const char * pszSource = hb_parc( 1 ), @@ -231,7 +231,7 @@ HB_FUNC( HB_VFMOVEFILE ) hb_retni( iResult ); } -/* hb_vfDirExists( <cDirName> ) -> <lExists> */ +/* hb_vfDirExists( <cDirName> ) --> <lExists> */ HB_FUNC( HB_VFDIREXISTS ) { const char * pszDirName = hb_parc( 1 ); @@ -248,7 +248,7 @@ HB_FUNC( HB_VFDIREXISTS ) hb_retl( fResult ); } -/* hb_vfDirMake( <cDirName> ) -> <nSuccess> */ +/* hb_vfDirMake( <cDirName> ) --> <nSuccess> */ HB_FUNC( HB_VFDIRMAKE ) { const char * pszDirName = hb_parc( 1 ); @@ -266,7 +266,7 @@ HB_FUNC( HB_VFDIRMAKE ) hb_retni( iResult ); } -/* hb_vfDirRemove( <cDirName> ) -> <nSuccess> */ +/* hb_vfDirRemove( <cDirName> ) --> <nSuccess> */ HB_FUNC( HB_VFDIRREMOVE ) { const char * pszDirName = hb_parc( 1 ); @@ -284,14 +284,14 @@ HB_FUNC( HB_VFDIRREMOVE ) hb_retni( iResult ); } -/* hb_vfDirectory( [ <cDirSpec> ], [ <cAttr> ] ) -> <aDirectory> */ +/* hb_vfDirectory( [ <cDirSpec> ], [ <cAttr> ] ) --> <aDirectory> */ HB_FUNC( HB_VFDIRECTORY ) { hb_itemReturnRelease( hb_fileDirectory( hb_parc( 1 ), hb_parc( 2 ) ) ); hb_fsSetFError( hb_fsError() ); } -/* hb_vfDirSpace( <cDirName>, [ <nInfoType> ] ) -> <nFreeSpace> */ +/* hb_vfDirSpace( <cDirName>, [ <nInfoType> ] ) --> <nFreeSpace> */ HB_FUNC( HB_VFDIRSPACE ) { HB_USHORT uiType = ( HB_USHORT ) hb_parnidef( 2, HB_DISK_AVAIL ); @@ -300,7 +300,7 @@ HB_FUNC( HB_VFDIRSPACE ) hb_fsSetFError( hb_fsError() ); } -/* hb_vfAttrGet( <cFileName>, @<nAttr> ) -> <lOK> */ +/* hb_vfAttrGet( <cFileName>, @<nAttr> ) --> <lOK> */ HB_FUNC( HB_VFATTRGET ) { HB_FATTR nAttr = 0; @@ -311,14 +311,14 @@ HB_FUNC( HB_VFATTRGET ) hb_stornl( nAttr, 2 ); } -/* hb_vfAttrSet( <cFileName>, <nAttr> ) -> <lOK> */ +/* hb_vfAttrSet( <cFileName>, <nAttr> ) --> <lOK> */ HB_FUNC( HB_VFATTRSET ) { hb_retl( hb_fileAttrSet( hb_parcx( 1 ), ( HB_FATTR ) hb_parnl( 2 ) ) ); hb_fsSetFError( hb_fsError() ); } -/* hb_vfTimeGet( <cFileName>, @<tsDateTime> ) -> <lOK> */ +/* hb_vfTimeGet( <cFileName>, @<tsDateTime> ) --> <lOK> */ HB_FUNC( HB_VFTIMEGET ) { long lJulian, lMillisec; @@ -357,7 +357,7 @@ HB_FUNC( HB_VFTIMEGET ) } } -/* hb_vfTimeSet( <cFileName>, <tsDateTime> ) -> <lOK> */ +/* hb_vfTimeSet( <cFileName>, <tsDateTime> ) --> <lOK> */ HB_FUNC( HB_VFTIMESET ) { long lDate = -1, lTime = -1; @@ -380,7 +380,7 @@ HB_FUNC( HB_VFTIMESET ) hb_fsSetFError( hb_fsError() ); } -/* hb_vfLink( <cExistingFileName>, <cNewFileName> ) -> <nSuccess> */ +/* hb_vfLink( <cExistingFileName>, <cNewFileName> ) --> <nSuccess> */ HB_FUNC( HB_VFLINK ) { const char * pszExisting = hb_parc( 1 ), * pszNewFile = hb_parc( 2 ); @@ -398,7 +398,7 @@ HB_FUNC( HB_VFLINK ) hb_retni( iResult ); } -/* hb_vfLinkSym( <cTargetFileName>, <cNewFileName> ) -> <nSuccess> */ +/* hb_vfLinkSym( <cTargetFileName>, <cNewFileName> ) --> <nSuccess> */ HB_FUNC( HB_VFLINKSYM ) { const char * pszTarget = hb_parc( 1 ), * pszNewFile = hb_parc( 2 ); @@ -416,7 +416,7 @@ HB_FUNC( HB_VFLINKSYM ) hb_retni( iResult ); } -/* hb_vfLinkRead( <cFileName> ) -> <cDestFileName> | "" */ +/* hb_vfLinkRead( <cFileName> ) --> <cDestFileName> | "" */ HB_FUNC( HB_VFLINKREAD ) { const char * pszFile = hb_parc( 1 ); @@ -433,7 +433,7 @@ HB_FUNC( HB_VFLINKREAD ) hb_retc_buffer( pszResult ); } -/* hb_vfOpen( [@]<cFileName>, [ <nModeAttr> ] ) -> <pHandle> | NIL */ +/* hb_vfOpen( [@]<cFileName>, [ <nModeAttr> ] ) --> <pHandle> | NIL */ HB_FUNC( HB_VFOPEN ) { const char * pszFile = hb_parc( 1 ); @@ -491,7 +491,7 @@ HB_FUNC( HB_VFOPEN ) } } -/* hb_vfClose( <pHandle> ) -> <lOK> */ +/* hb_vfClose( <pHandle> ) --> <lOK> */ HB_FUNC( HB_VFCLOSE ) { PHB_FILE * pFilePtr = hb_fileParamPtr( 1 ); @@ -506,7 +506,7 @@ HB_FUNC( HB_VFCLOSE ) } } -/* hb_vfLock( <pHandle>, <nStart>, <nLen>, [ <nType> ] ) -> <lOK> */ +/* hb_vfLock( <pHandle>, <nStart>, <nLen>, [ <nType> ] ) --> <lOK> */ HB_FUNC( HB_VFLOCK ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -529,7 +529,7 @@ HB_FUNC( HB_VFLOCK ) } } -/* hb_vfUnlock( <pHandle>, <nStart>, <nLen> ) -> <lOK> */ +/* hb_vfUnlock( <pHandle>, <nStart>, <nLen> ) --> <lOK> */ HB_FUNC( HB_VFUNLOCK ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -552,7 +552,7 @@ HB_FUNC( HB_VFUNLOCK ) } } -/* hb_vfLockTest( <pHandle>, <nStart>, <nLen>, [ <nType> ] ) -> <nPID> | 0 (nolock) | -1 (err) */ +/* hb_vfLockTest( <pHandle>, <nStart>, <nLen>, [ <nType> ] ) --> <nPID> | 0 (nolock) | -1 (err) */ HB_FUNC( HB_VFLOCKTEST ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -575,7 +575,7 @@ HB_FUNC( HB_VFLOCKTEST ) } } -/* hb_vfRead( <pHandle>, @<cBuff>, [ <nToRead> ], [ <nTimeOut> ] ) -> <nRead> */ +/* hb_vfRead( <pHandle>, @<cBuff>, [ <nToRead> ], [ <nTimeOut> ] ) --> <nRead> */ HB_FUNC( HB_VFREAD ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -609,7 +609,7 @@ HB_FUNC( HB_VFREAD ) } } -/* hb_vfReadLen( <pHandle>, <nToRead>, [ <nTimeOut> ] ) -> <cBuffer> */ +/* hb_vfReadLen( <pHandle>, <nToRead>, [ <nTimeOut> ] ) --> <cBuffer> */ HB_FUNC( HB_VFREADLEN ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -638,7 +638,7 @@ HB_FUNC( HB_VFREADLEN ) } } -/* hb_vfWrite( <pHandle>, <cBuff>, [ <nToWrite> ], [ <nTimeOut> ] ) -> <nWritten> */ +/* hb_vfWrite( <pHandle>, <cBuff>, [ <nToWrite> ], [ <nTimeOut> ] ) --> <nWritten> */ HB_FUNC( HB_VFWRITE ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -673,7 +673,7 @@ HB_FUNC( HB_VFWRITE ) } } -/* hb_vfReadAt( <pHandle>, @<cBuff>, [ <nToRead> ], [ <nAtOffset> ] ) -> <nRead> */ +/* hb_vfReadAt( <pHandle>, @<cBuff>, [ <nToRead> ], [ <nAtOffset> ] ) --> <nRead> */ HB_FUNC( HB_VFREADAT ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -708,7 +708,7 @@ HB_FUNC( HB_VFREADAT ) } } -/* hb_vfWriteAt( <pHandle>, <cBuff>, [ <nToWrite> ], [ <nAtOffset> ] ) -> <nWritten> */ +/* hb_vfWriteAt( <pHandle>, <cBuff>, [ <nToWrite> ], [ <nAtOffset> ] ) --> <nWritten> */ HB_FUNC( HB_VFWRITEAT ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -744,7 +744,7 @@ HB_FUNC( HB_VFWRITEAT ) } } -/* hb_vfSeek( <pHandle>, <nOffset>, [ <nWhence> ] ) -> <nOffset> */ +/* hb_vfSeek( <pHandle>, <nOffset>, [ <nWhence> ] ) --> <nOffset> */ HB_FUNC( HB_VFSEEK ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -766,7 +766,7 @@ HB_FUNC( HB_VFSEEK ) } } -/* hb_vfTrunc( <pHandle>, [ <nAtOffset> ] ) -> <lOK> */ +/* hb_vfTrunc( <pHandle>, [ <nAtOffset> ] ) --> <lOK> */ HB_FUNC( HB_VFTRUNC ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -778,14 +778,14 @@ HB_FUNC( HB_VFTRUNC ) } } -/* hb_vfSize( <pHandle> | <cFileName> [, <lUseDirEntry> ] ) -> <nSize> */ +/* hb_vfSize( <pHandle> | <cFileName> [, <lUseDirEntry> ] ) --> <nSize> */ HB_FUNC( HB_VFSIZE ) { const char * pszFile = hb_parc( 1 ); if( pszFile ) { - hb_retnint( hb_fileSizeGet( pszFile, hb_parldef( 2, 1 ) ) ); + hb_retnint( hb_fileSizeGet( pszFile, hb_parldef( 2, HB_TRUE ) ) ); hb_fsSetFError( hb_fsError() ); } else @@ -799,7 +799,7 @@ HB_FUNC( HB_VFSIZE ) } } -/* hb_vfEof( <pHandle> ) -> <lEOF> */ +/* hb_vfEof( <pHandle> ) --> <lEOF> */ HB_FUNC( HB_VFEOF ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -811,7 +811,7 @@ HB_FUNC( HB_VFEOF ) } } -/* hb_vfFlush( <pHandle>, [ <lDirtyOnly> ] ) -> NIL */ +/* hb_vfFlush( <pHandle>, [ <lDirtyOnly> ] ) --> NIL */ HB_FUNC( HB_VFFLUSH ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -823,7 +823,7 @@ HB_FUNC( HB_VFFLUSH ) } } -/* hb_vfCommit( <pHandle> ) -> NIL */ +/* hb_vfCommit( <pHandle> ) --> NIL */ HB_FUNC( HB_VFCOMMIT ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -835,7 +835,7 @@ HB_FUNC( HB_VFCOMMIT ) } } -/* hb_vfConfig( <pHandle>, <nSet>, [ <nParam> ] ) -> <nResult> */ +/* hb_vfConfig( <pHandle>, <nSet>, [ <nParam> ] ) --> <nResult> */ HB_FUNC( HB_VFCONFIG ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -855,7 +855,7 @@ HB_FUNC( HB_VFCONFIG ) } } -/* hb_vfHandle( <pHandle> ) -> <nOsHandle> */ +/* hb_vfHandle( <pHandle> ) --> <nOsHandle> */ HB_FUNC( HB_VFHANDLE ) { PHB_FILE pFile = hb_fileParam( 1 ); @@ -863,7 +863,7 @@ HB_FUNC( HB_VFHANDLE ) hb_retnint( ( HB_NHANDLE ) ( pFile ? hb_fileHandle( pFile ) : FS_ERROR ) ); } -/* hb_vfTempFile( @<cFileName>, [ <cDir> ], [ <cPrefix> ], [ <cExt> ], [ <nAttr> ] ) -> <pHandle> | NIL */ +/* hb_vfTempFile( @<cFileName>, [ <cDir> ], [ <cPrefix> ], [ <cExt> ], [ <nAttr> ] ) --> <pHandle> | NIL */ HB_FUNC( HB_VFTEMPFILE ) { char szName[ HB_PATH_MAX ]; @@ -877,7 +877,7 @@ HB_FUNC( HB_VFTEMPFILE ) hb_storc( szName, 1 ); } -/* hb_vfLoad( <cFileName>, [ <nMaxSize> ] ) -> <cFileBody> | NIL */ +/* hb_vfLoad( <cFileName>, [ <nMaxSize> ] ) --> <cFileBody> | NIL */ HB_FUNC( HB_VFLOAD ) { const char * pszFileName = hb_parc( 1 ); diff --git a/src/rtl/xhelp.c b/src/rtl/xhelp.c index ab3e9ed460..eeef7af7d8 100644 --- a/src/rtl/xhelp.c +++ b/src/rtl/xhelp.c @@ -57,7 +57,7 @@ HB_FUNC( __XHELP ) if( hb_dynsymIsFunction( s_pDynSym ) ) { - /* NOTE: push the existing params after the dyn symbol. [awhite] */ + /* NOTE: push the existing params after the dynamic symbol. [awhite] */ int iPCount = hb_pcount(); int iParam; diff --git a/src/rtl/xsavescr.c b/src/rtl/xsavescr.c index 9d3b3869e6..6e69233e3e 100644 --- a/src/rtl/xsavescr.c +++ b/src/rtl/xsavescr.c @@ -1,6 +1,7 @@ /* * __XSaveScreen()/__XRestScreen() functions * + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (Rewritten in C) * Copyright 1999 Paul Tucker <ptucker@sympatico.ca> * * This program is free software; you can redistribute it and/or modify @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * Rewritten in C - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapigt.h" #include "hbstack.h" diff --git a/src/vm/arrays.c b/src/vm/arrays.c index f796d3f6c2..d4390a62ef 100644 --- a/src/vm/arrays.c +++ b/src/vm/arrays.c @@ -2,6 +2,10 @@ * The Array API (C level) * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * (hb_arrayIsObject(), hb_arrayCopyC(), hb_arrayGetC()) + * Copyright 2001 Ron Pinkas <ron@profit-master.com> + * (hb_arrayClone(), hb_arrayFromStack(), hb_arrayFromParams()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,23 +48,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_arrayIsObject() - * hb_arrayCopyC() - * hb_arrayGetC() - * - * Copyright 2001 Ron Pinkas <ron@profit-master.com> - * hb_arrayClone() - * hb_arrayFromStack() - * hb_arrayFromParams() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbvmopt.h" #include "hbapi.h" #include "hbapiitm.h" @@ -161,9 +148,8 @@ HB_BOOL hb_arrayNew( PHB_ITEM pItem, HB_SIZE nLen ) /* creates a new array */ { PHB_BASEARRAY pBaseArray; PHB_ITEM pItems; - HB_SIZE nPos; - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayNew(%p, %" HB_PFS "u)", pItem, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayNew(%p, %" HB_PFS "u)", ( void * ) pItem, nLen ) ); if( HB_IS_COMPLEX( pItem ) ) hb_itemClear( pItem ); @@ -175,6 +161,7 @@ HB_BOOL hb_arrayNew( PHB_ITEM pItem, HB_SIZE nLen ) /* creates a new array */ */ if( nLen > 0 ) { + HB_SIZE nPos; pItems = ( PHB_ITEM ) hb_xgrab( sizeof( HB_ITEM ) * nLen ); for( nPos = 0; nPos < nLen; ++nPos ) ( pItems + nPos )->type = HB_IT_NIL; @@ -196,7 +183,7 @@ HB_BOOL hb_arrayNew( PHB_ITEM pItem, HB_SIZE nLen ) /* creates a new array */ void hb_arraySwap( PHB_ITEM pArray1, PHB_ITEM pArray2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySwap(%p, %p)", pArray1, pArray2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySwap(%p, %p)", ( void * ) pArray1, ( void * ) pArray2 ) ); if( HB_IS_ARRAY( pArray1 ) && HB_IS_ARRAY( pArray2 ) ) { @@ -210,7 +197,7 @@ void hb_arraySwap( PHB_ITEM pArray1, PHB_ITEM pArray2 ) HB_BOOL hb_arraySize( PHB_ITEM pArray, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySize(%p, %" HB_PFS "u)", pArray, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySize(%p, %" HB_PFS "u)", ( void * ) pArray, nLen ) ); if( HB_IS_ARRAY( pArray ) ) { @@ -240,7 +227,7 @@ HB_BOOL hb_arraySize( PHB_ITEM pArray, HB_SIZE nLen ) I've used here a little different formula. ulAllocated is divided by factor 2 ( >> 1 ) and 1 is added to requested size. This algorithm has properties: - - reallocation count remains asymptoticaly logarithmic; + - reallocation count remains asymptotically logarithmic; - saves memory for large arrays, because reallocation buffer size is not doubled, but multiplied by 1.5; - adding of 1, allows reduce reallocation count for small arrays. @@ -286,7 +273,7 @@ HB_BOOL hb_arraySize( PHB_ITEM pArray, HB_SIZE nLen ) HB_SIZE hb_arrayLen( PHB_ITEM pArray ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayLen(%p)", pArray ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayLen(%p)", ( void * ) pArray ) ); if( HB_IS_ARRAY( pArray ) ) return pArray->item.asArray.value->nLen; @@ -296,7 +283,7 @@ HB_SIZE hb_arrayLen( PHB_ITEM pArray ) HB_BOOL hb_arrayIsObject( PHB_ITEM pArray ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayIsObject(%p)", pArray ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayIsObject(%p)", ( void * ) pArray ) ); if( HB_IS_ARRAY( pArray ) ) return pArray->item.asArray.value->uiClass != 0; @@ -304,7 +291,7 @@ HB_BOOL hb_arrayIsObject( PHB_ITEM pArray ) return HB_FALSE; } -/* retrives the array unique ID */ +/* retrieves the array unique ID */ void * hb_arrayId( PHB_ITEM pArray ) { if( pArray && HB_IS_ARRAY( pArray ) ) @@ -328,7 +315,7 @@ PHB_ITEM hb_arrayFromId( PHB_ITEM pItem, void * pArrayId ) HB_BOOL hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayAdd(%p, %p)", pArray, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayAdd(%p, %p)", ( void * ) pArray, ( void * ) pValue ) ); if( HB_IS_ARRAY( pArray ) ) { @@ -349,7 +336,7 @@ HB_BOOL hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pValue ) HB_BOOL hb_arrayAddForward( PHB_ITEM pArray, PHB_ITEM pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayAddForward(%p, %p)", pArray, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayAddForward(%p, %p)", ( void * ) pArray, ( void * ) pValue ) ); if( HB_IS_ARRAY( pArray ) ) { @@ -370,7 +357,7 @@ HB_BOOL hb_arrayAddForward( PHB_ITEM pArray, PHB_ITEM pValue ) HB_BOOL hb_arrayDel( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayDel(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayDel(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) ) { @@ -400,7 +387,7 @@ HB_BOOL hb_arrayDel( PHB_ITEM pArray, HB_SIZE nIndex ) HB_BOOL hb_arrayIns( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayIns(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayIns(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) ) { @@ -430,7 +417,7 @@ HB_BOOL hb_arrayIns( PHB_ITEM pArray, HB_SIZE nIndex ) HB_BOOL hb_arraySet( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySet(%p, %" HB_PFS "u, %p)", pArray, nIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySet(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( void * ) pItem ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -443,7 +430,7 @@ HB_BOOL hb_arraySet( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) HB_BOOL hb_arraySetForward( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetForward(%p, %" HB_PFS "u, %p)", pArray, nIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetForward(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( void * ) pItem ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -459,7 +446,7 @@ HB_BOOL hb_arraySetForward( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) HB_BOOL hb_arrayGet( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGet(%p, %" HB_PFS "u, %p)", pArray, nIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGet(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( void * ) pItem ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -475,7 +462,7 @@ HB_BOOL hb_arrayGet( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) HB_BOOL hb_arrayGetItemRef( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetItemRef(%p, %" HB_PFS "u, %p)", pArray, nIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetItemRef(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( void * ) pItem ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -504,7 +491,7 @@ HB_BOOL hb_arrayGetItemRef( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) */ PHB_ITEM hb_arrayGetItemPtr( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetItemPtr(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetItemPtr(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return pArray->item.asArray.value->pItems + nIndex - 1; @@ -514,7 +501,7 @@ PHB_ITEM hb_arrayGetItemPtr( PHB_ITEM pArray, HB_SIZE nIndex ) char * hb_arrayGetDS( PHB_ITEM pArray, HB_SIZE nIndex, char * szDate ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetDS(%p, %" HB_PFS "u, %s)", pArray, nIndex, szDate ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetDS(%p, %" HB_PFS "u, %s)", ( void * ) pArray, nIndex, szDate ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetDS( pArray->item.asArray.value->pItems + nIndex - 1, szDate ); @@ -526,7 +513,7 @@ char * hb_arrayGetDS( PHB_ITEM pArray, HB_SIZE nIndex, char * szDate ) long hb_arrayGetDL( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetDL(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetDL(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetDL( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -538,7 +525,7 @@ long hb_arrayGetDL( PHB_ITEM pArray, HB_SIZE nIndex ) double hb_arrayGetTD( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetTD(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetTD(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetTD( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -548,7 +535,7 @@ double hb_arrayGetTD( PHB_ITEM pArray, HB_SIZE nIndex ) HB_BOOL hb_arrayGetTDT( PHB_ITEM pArray, HB_SIZE nIndex, long * plJulian, long * plMilliSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetTDT(%p, %" HB_PFS "u, %p, %p)", pArray, nIndex, plJulian, plMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetTDT(%p, %" HB_PFS "u, %p, %p)", ( void * ) pArray, nIndex, ( void * ) plJulian, ( void * ) plMilliSec ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetTDT( pArray->item.asArray.value->pItems + nIndex - 1, plJulian, plMilliSec ); @@ -561,7 +548,7 @@ HB_BOOL hb_arrayGetTDT( PHB_ITEM pArray, HB_SIZE nIndex, long * plJulian, long * HB_BOOL hb_arrayGetL( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetL(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetL(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetL( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -571,7 +558,7 @@ HB_BOOL hb_arrayGetL( PHB_ITEM pArray, HB_SIZE nIndex ) int hb_arrayGetNI( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNI(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNI(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetNI( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -581,7 +568,7 @@ int hb_arrayGetNI( PHB_ITEM pArray, HB_SIZE nIndex ) long hb_arrayGetNL( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNL(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNL(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetNL( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -591,7 +578,7 @@ long hb_arrayGetNL( PHB_ITEM pArray, HB_SIZE nIndex ) HB_ISIZ hb_arrayGetNS( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNS(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNS(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetNS( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -602,7 +589,7 @@ HB_ISIZ hb_arrayGetNS( PHB_ITEM pArray, HB_SIZE nIndex ) #ifndef HB_LONG_LONG_OFF HB_LONGLONG hb_arrayGetNLL( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNLL(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNLL(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetNLL( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -613,7 +600,7 @@ HB_LONGLONG hb_arrayGetNLL( PHB_ITEM pArray, HB_SIZE nIndex ) HB_MAXINT hb_arrayGetNInt( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNInt(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetNInt(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetNInt( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -623,7 +610,7 @@ HB_MAXINT hb_arrayGetNInt( PHB_ITEM pArray, HB_SIZE nIndex ) double hb_arrayGetND( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetND(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetND(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetND( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -633,7 +620,7 @@ double hb_arrayGetND( PHB_ITEM pArray, HB_SIZE nIndex ) HB_SIZE hb_arrayCopyC( PHB_ITEM pArray, HB_SIZE nIndex, char * szBuffer, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayCopyC(%p, %" HB_PFS "u, %s, %" HB_PFS "u)", pArray, nIndex, szBuffer, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayCopyC(%p, %" HB_PFS "u, %s, %" HB_PFS "u)", ( void * ) pArray, nIndex, szBuffer, nLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemCopyC( pArray->item.asArray.value->pItems + nIndex - 1, szBuffer, nLen ); @@ -643,7 +630,7 @@ HB_SIZE hb_arrayCopyC( PHB_ITEM pArray, HB_SIZE nIndex, char * szBuffer, HB_SIZE char * hb_arrayGetC( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetC(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetC(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetC( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -653,7 +640,7 @@ char * hb_arrayGetC( PHB_ITEM pArray, HB_SIZE nIndex ) const char * hb_arrayGetCPtr( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetCPtr(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetCPtr(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetCPtr( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -663,7 +650,7 @@ const char * hb_arrayGetCPtr( PHB_ITEM pArray, HB_SIZE nIndex ) HB_SIZE hb_arrayGetCLen( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetCLen(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetCLen(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetCLen( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -673,7 +660,7 @@ HB_SIZE hb_arrayGetCLen( PHB_ITEM pArray, HB_SIZE nIndex ) void * hb_arrayGetPtr( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetPtr(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetPtr(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetPtr( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -683,7 +670,7 @@ void * hb_arrayGetPtr( PHB_ITEM pArray, HB_SIZE nIndex ) void * hb_arrayGetPtrGC( PHB_ITEM pArray, HB_SIZE nIndex, const HB_GC_FUNCS * pFuncs ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetPtrGC(%p, %" HB_PFS "u, %p)", pArray, nIndex, pFuncs ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetPtrGC(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( const void * ) pFuncs ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetPtrGC( pArray->item.asArray.value->pItems + nIndex - 1, pFuncs ); @@ -693,7 +680,7 @@ void * hb_arrayGetPtrGC( PHB_ITEM pArray, HB_SIZE nIndex, const HB_GC_FUNCS * pF PHB_SYMB hb_arrayGetSymbol( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetSymbol(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetSymbol(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetSymbol( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -704,7 +691,7 @@ PHB_SYMB hb_arrayGetSymbol( PHB_ITEM pArray, HB_SIZE nIndex ) HB_TYPE hb_arrayGetType( PHB_ITEM pArray, HB_SIZE nIndex ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetType(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetType(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemType( pArray->item.asArray.value->pItems + nIndex - 1 ); @@ -714,7 +701,7 @@ HB_TYPE hb_arrayGetType( PHB_ITEM pArray, HB_SIZE nIndex ) HB_BOOL hb_arraySetDS( PHB_ITEM pArray, HB_SIZE nIndex, const char * szDate ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetDS(%p, %" HB_PFS "u, %s)", pArray, nIndex, szDate ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetDS(%p, %" HB_PFS "u, %s)", ( void * ) pArray, nIndex, szDate ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -727,7 +714,7 @@ HB_BOOL hb_arraySetDS( PHB_ITEM pArray, HB_SIZE nIndex, const char * szDate ) HB_BOOL hb_arraySetDL( PHB_ITEM pArray, HB_SIZE nIndex, long lDate ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetDL(%p, %" HB_PFS "u, %ld)", pArray, nIndex, lDate ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetDL(%p, %" HB_PFS "u, %ld)", ( void * ) pArray, nIndex, lDate ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -740,7 +727,7 @@ HB_BOOL hb_arraySetDL( PHB_ITEM pArray, HB_SIZE nIndex, long lDate ) HB_BOOL hb_arraySetTD( PHB_ITEM pArray, HB_SIZE nIndex, double dTimeStamp ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetTD(%p, %" HB_PFS "u, %lf)", pArray, nIndex, dTimeStamp ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetTD(%p, %" HB_PFS "u, %lf)", ( void * ) pArray, nIndex, dTimeStamp ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -753,7 +740,7 @@ HB_BOOL hb_arraySetTD( PHB_ITEM pArray, HB_SIZE nIndex, double dTimeStamp ) HB_BOOL hb_arraySetTDT( PHB_ITEM pArray, HB_SIZE nIndex, long lJulian, long lMilliSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetTDT(%p, %" HB_PFS "u, %lu, %lu)", pArray, nIndex, lJulian, lMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetTDT(%p, %" HB_PFS "u, %lu, %lu)", ( void * ) pArray, nIndex, lJulian, lMilliSec ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -766,7 +753,7 @@ HB_BOOL hb_arraySetTDT( PHB_ITEM pArray, HB_SIZE nIndex, long lJulian, long lMil HB_BOOL hb_arraySetL( PHB_ITEM pArray, HB_SIZE nIndex, HB_BOOL fValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetL(%p, %" HB_PFS "u, %d)", pArray, nIndex, fValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetL(%p, %" HB_PFS "u, %d)", ( void * ) pArray, nIndex, fValue ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -779,7 +766,7 @@ HB_BOOL hb_arraySetL( PHB_ITEM pArray, HB_SIZE nIndex, HB_BOOL fValue ) HB_BOOL hb_arraySetNI( PHB_ITEM pArray, HB_SIZE nIndex, int iNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNI(%p, %" HB_PFS "u, %d)", pArray, nIndex, iNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNI(%p, %" HB_PFS "u, %d)", ( void * ) pArray, nIndex, iNumber ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -792,7 +779,7 @@ HB_BOOL hb_arraySetNI( PHB_ITEM pArray, HB_SIZE nIndex, int iNumber ) HB_BOOL hb_arraySetNL( PHB_ITEM pArray, HB_SIZE nIndex, long lNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNL(%p, %" HB_PFS "u, %lu)", pArray, nIndex, lNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNL(%p, %" HB_PFS "u, %lu)", ( void * ) pArray, nIndex, lNumber ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -805,7 +792,7 @@ HB_BOOL hb_arraySetNL( PHB_ITEM pArray, HB_SIZE nIndex, long lNumber ) HB_BOOL hb_arraySetNS( PHB_ITEM pArray, HB_SIZE nIndex, HB_ISIZ nNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNS(%p, %" HB_PFS "u, %" HB_PFS "d)", pArray, nIndex, nNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNS(%p, %" HB_PFS "u, %" HB_PFS "d)", ( void * ) pArray, nIndex, nNumber ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -819,7 +806,7 @@ HB_BOOL hb_arraySetNS( PHB_ITEM pArray, HB_SIZE nIndex, HB_ISIZ nNumber ) #ifndef HB_LONG_LONG_OFF HB_BOOL hb_arraySetNLL( PHB_ITEM pArray, HB_SIZE nIndex, HB_LONGLONG llNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNLL(%p, %" HB_PFS "u, %" PFLL "d)", pArray, nIndex, llNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNLL(%p, %" HB_PFS "u, %" PFLL "d)", ( void * ) pArray, nIndex, llNumber ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -833,7 +820,7 @@ HB_BOOL hb_arraySetNLL( PHB_ITEM pArray, HB_SIZE nIndex, HB_LONGLONG llNumber ) HB_BOOL hb_arraySetNInt( PHB_ITEM pArray, HB_SIZE nIndex, HB_MAXINT nNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNInt(%p, %" HB_PFS "u, %" PFHL "d)", pArray, nIndex, nNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetNInt(%p, %" HB_PFS "u, %" PFHL "d)", ( void * ) pArray, nIndex, nNumber ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -846,7 +833,7 @@ HB_BOOL hb_arraySetNInt( PHB_ITEM pArray, HB_SIZE nIndex, HB_MAXINT nNumber ) HB_BOOL hb_arraySetND( PHB_ITEM pArray, HB_SIZE nIndex, double dNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetND(%p, %" HB_PFS "u, %lf)", pArray, nIndex, dNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetND(%p, %" HB_PFS "u, %lf)", ( void * ) pArray, nIndex, dNumber ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -859,7 +846,7 @@ HB_BOOL hb_arraySetND( PHB_ITEM pArray, HB_SIZE nIndex, double dNumber ) HB_BOOL hb_arraySetC( PHB_ITEM pArray, HB_SIZE nIndex, const char * szText ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetC(%p, %" HB_PFS "u, %p)", pArray, nIndex, szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetC(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( const void * ) szText ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -872,7 +859,7 @@ HB_BOOL hb_arraySetC( PHB_ITEM pArray, HB_SIZE nIndex, const char * szText ) HB_BOOL hb_arraySetCL( PHB_ITEM pArray, HB_SIZE nIndex, const char * szText, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetC(%p, %" HB_PFS "u, %p, %" HB_PFS "u)", pArray, nIndex, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetC(%p, %" HB_PFS "u, %p, %" HB_PFS "u)", ( void * ) pArray, nIndex, ( const void * ) szText, nLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -885,7 +872,7 @@ HB_BOOL hb_arraySetCL( PHB_ITEM pArray, HB_SIZE nIndex, const char * szText, HB_ HB_BOOL hb_arraySetCPtr( PHB_ITEM pArray, HB_SIZE nIndex, char * szText ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetCPtr(%p, %" HB_PFS "u, %p)", pArray, nIndex, szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetCPtr(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( void * ) szText ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -898,7 +885,7 @@ HB_BOOL hb_arraySetCPtr( PHB_ITEM pArray, HB_SIZE nIndex, char * szText ) HB_BOOL hb_arraySetCLPtr( PHB_ITEM pArray, HB_SIZE nIndex, char * szText, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetCLPtr(%p, %" HB_PFS "u, %p, %" HB_PFS "u)", pArray, nIndex, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetCLPtr(%p, %" HB_PFS "u, %p, %" HB_PFS "u)", ( void * ) pArray, nIndex, ( void * ) szText, nLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -911,7 +898,7 @@ HB_BOOL hb_arraySetCLPtr( PHB_ITEM pArray, HB_SIZE nIndex, char * szText, HB_SIZ HB_BOOL hb_arraySetCConst( PHB_ITEM pArray, HB_SIZE nIndex, const char * szText ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetCConst(%p, %" HB_PFS "u, %p)", pArray, nIndex, szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetCConst(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( const void * ) szText ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -924,7 +911,7 @@ HB_BOOL hb_arraySetCConst( PHB_ITEM pArray, HB_SIZE nIndex, const char * szText HB_BOOL hb_arraySetPtr( PHB_ITEM pArray, HB_SIZE nIndex, void * pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetPtr(%p, %" HB_PFS "u, %p)", pArray, nIndex, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetPtr(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, pValue ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -937,7 +924,7 @@ HB_BOOL hb_arraySetPtr( PHB_ITEM pArray, HB_SIZE nIndex, void * pValue ) HB_BOOL hb_arraySetPtrGC( PHB_ITEM pArray, HB_SIZE nIndex, void * pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetPtrGC(%p, %" HB_PFS "u, %p)", pArray, nIndex, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetPtrGC(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, pValue ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -950,7 +937,7 @@ HB_BOOL hb_arraySetPtrGC( PHB_ITEM pArray, HB_SIZE nIndex, void * pValue ) HB_BOOL hb_arraySetSymbol( PHB_ITEM pArray, HB_SIZE nIndex, PHB_SYMB pSymbol ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetSymbol(%p, %" HB_PFS "u, %p)", pArray, nIndex, pSymbol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetSymbol(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( void * ) pSymbol ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -963,7 +950,7 @@ HB_BOOL hb_arraySetSymbol( PHB_ITEM pArray, HB_SIZE nIndex, PHB_SYMB pSymbol ) HB_BOOL hb_arrayLast( PHB_ITEM pArray, PHB_ITEM pResult ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayLast(%p, %p)", pArray, pResult ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayLast(%p, %p)", ( void * ) pArray, ( void * ) pResult ) ); if( HB_IS_ARRAY( pArray ) ) { @@ -983,14 +970,13 @@ HB_BOOL hb_arrayLast( PHB_ITEM pArray, PHB_ITEM pResult ) HB_BOOL hb_arrayFill( PHB_ITEM pArray, PHB_ITEM pValue, HB_SIZE * pnStart, HB_SIZE * pnCount ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayFill(%p, %p, %p, %p)", pArray, pValue, pnStart, pnCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayFill(%p, %p, %p, %p)", ( void * ) pArray, ( void * ) pValue, ( void * ) pnStart, ( void * ) pnCount ) ); if( HB_IS_ARRAY( pArray ) ) { PHB_BASEARRAY pBaseArray = pArray->item.asArray.value; HB_SIZE nLen = pBaseArray->nLen; HB_SIZE nStart; - HB_SIZE nCount; if( pnStart && *pnStart ) nStart = *pnStart - 1; @@ -999,7 +985,7 @@ HB_BOOL hb_arrayFill( PHB_ITEM pArray, PHB_ITEM pValue, HB_SIZE * pnStart, HB_SI if( nStart < nLen ) { - nCount = nLen - nStart; + HB_SIZE nCount = nLen - nStart; if( pnCount && *pnCount < nCount ) nCount = *pnCount; @@ -1028,7 +1014,6 @@ HB_SIZE hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, HB_SIZE * pnStart, HB_SI PHB_BASEARRAY pBaseArray = pArray->item.asArray.value; HB_SIZE nLen = pBaseArray->nLen; HB_SIZE nStart; - HB_SIZE nCount; if( pnStart && *pnStart ) nStart = *pnStart - 1; @@ -1037,7 +1022,7 @@ HB_SIZE hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, HB_SIZE * pnStart, HB_SI if( nStart < nLen ) { - nCount = nLen - nStart; + HB_SIZE nCount = nLen - nStart; if( pnCount && *pnCount < nCount ) nCount = *pnCount; @@ -1199,14 +1184,13 @@ HB_SIZE hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, HB_SIZE * pnStart, HB_SI HB_SIZE hb_arrayRevScan( PHB_ITEM pArray, PHB_ITEM pValue, HB_SIZE * pnStart, HB_SIZE * pnCount, HB_BOOL fExact ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayRevScan(%p, %p, %p, %p, %d)", pArray, pValue, pnStart, pnCount, ( int ) fExact ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayRevScan(%p, %p, %p, %p, %d)", ( void * ) pArray, ( void * ) pValue, ( void * ) pnStart, ( void * ) pnCount, ( int ) fExact ) ); if( HB_IS_ARRAY( pArray ) ) { PHB_BASEARRAY pBaseArray = pArray->item.asArray.value; HB_SIZE nLen = pBaseArray->nLen; HB_SIZE nStart; - HB_SIZE nCount; if( pnStart && *pnStart ) nStart = *pnStart - 1; @@ -1215,7 +1199,7 @@ HB_SIZE hb_arrayRevScan( PHB_ITEM pArray, PHB_ITEM pValue, HB_SIZE * pnStart, HB if( nStart < nLen ) { - nCount = nStart + 1; + HB_SIZE nCount = nStart + 1; if( pnCount && *pnCount < nCount ) nCount = *pnCount; @@ -1380,14 +1364,13 @@ HB_SIZE hb_arrayRevScan( PHB_ITEM pArray, PHB_ITEM pValue, HB_SIZE * pnStart, HB HB_BOOL hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, HB_SIZE * pnStart, HB_SIZE * pnCount ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayEval(%p, %p, %p, %p)", pArray, bBlock, pnStart, pnCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayEval(%p, %p, %p, %p)", ( void * ) pArray, ( void * ) bBlock, ( void * ) pnStart, ( void * ) pnCount ) ); if( HB_IS_ARRAY( pArray ) && HB_IS_BLOCK( bBlock ) ) { PHB_BASEARRAY pBaseArray = pArray->item.asArray.value; HB_SIZE nLen = pBaseArray->nLen; HB_SIZE nStart; - HB_SIZE nCount; if( pnStart && *pnStart ) nStart = *pnStart - 1; @@ -1396,7 +1379,7 @@ HB_BOOL hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, HB_SIZE * pnStart, HB_SI if( nStart < nLen ) { - nCount = nLen - nStart; + HB_SIZE nCount = nLen - nStart; if( pnCount && *pnCount < nCount ) nCount = *pnCount; @@ -1430,7 +1413,7 @@ HB_BOOL hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, HB_SIZE * pnStart, HB_SI HB_BOOL hb_arrayCopy( PHB_ITEM pSrcArray, PHB_ITEM pDstArray, HB_SIZE * pnStart, HB_SIZE * pnCount, HB_SIZE * pnTarget ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayCopy(%p, %p, %p, %p, %p)", pSrcArray, pDstArray, pnStart, pnCount, pnTarget ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayCopy(%p, %p, %p, %p, %p)", ( void * ) pSrcArray, ( void * ) pDstArray, ( void * ) pnStart, ( void * ) pnCount, ( void * ) pnTarget ) ); if( HB_IS_ARRAY( pSrcArray ) && HB_IS_ARRAY( pDstArray ) ) { @@ -1439,7 +1422,6 @@ HB_BOOL hb_arrayCopy( PHB_ITEM pSrcArray, PHB_ITEM pDstArray, HB_SIZE * pnStart, HB_SIZE nSrcLen = pSrcBaseArray->nLen; HB_SIZE nDstLen = pDstBaseArray->nLen; HB_SIZE nStart; - HB_SIZE nCount; HB_SIZE nTarget; if( pnStart && ( *pnStart >= 1 ) ) @@ -1458,6 +1440,7 @@ HB_BOOL hb_arrayCopy( PHB_ITEM pSrcArray, PHB_ITEM pDstArray, HB_SIZE * pnStart, if( nSrcLen > 0 ) #endif { + HB_SIZE nCount; #ifndef HB_COMPAT_C53 /* From CA-Cl*pper 5.3a */ if( nStart > nSrcLen ) nStart = nSrcLen; @@ -1499,7 +1482,7 @@ static void hb_arrayCloneBody( PHB_ITEM pDest, PHB_ITEM pArray, PHB_NESTED_CLONE PHB_ITEM pSrcItem, pDstItem; HB_SIZE nLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayCloneBody(%p, %p, %p)", pDest, pArray, pClonedList ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayCloneBody(%p, %p, %p)", ( void * ) pDest, ( void * ) pArray, ( void * ) pClonedList ) ); nLen = pArray->item.asArray.value->nLen; hb_arrayNew( pDest, nLen ); @@ -1594,7 +1577,7 @@ void hb_nestedCloneDo( PHB_ITEM pDstItem, PHB_ITEM pSrcItem, PHB_NESTED_CLONED p PHB_ITEM hb_arrayCloneTo( PHB_ITEM pDest, PHB_ITEM pArray ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayCloneTo(%p,%p)", pDest, pArray ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayCloneTo(%p,%p)", ( void * ) pDest, ( void * ) pArray ) ); if( HB_IS_ARRAY( pArray ) ) { @@ -1609,7 +1592,7 @@ PHB_ITEM hb_arrayCloneTo( PHB_ITEM pDest, PHB_ITEM pArray ) PHB_ITEM hb_arrayClone( PHB_ITEM pArray ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayClone(%p)", pArray ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayClone(%p)", ( void * ) pArray ) ); return hb_arrayCloneTo( hb_itemNew( NULL ), pArray ); } diff --git a/src/vm/arrayshb.c b/src/vm/arrayshb.c index 6d79050e98..89576b79c0 100644 --- a/src/vm/arrayshb.c +++ b/src/vm/arrayshb.c @@ -206,7 +206,7 @@ HB_FUNC( AFILL ) HB_SIZE nStart, nCount; HB_ISIZ lStart = hb_parns( 3 ), lCount = hb_parns( 4 ); - /* Explicy lCount of 0 - Nothing to do! */ + /* Explicit lCount of 0 - Nothing to do! */ if( HB_ISNUM( 4 ) && lCount == 0 ) return; /* Clipper aborts if negative start. */ diff --git a/src/vm/asort.c b/src/vm/asort.c index 0a49e9aabd..92d87ada70 100644 --- a/src/vm/asort.c +++ b/src/vm/asort.c @@ -2,7 +2,7 @@ * ASort() function * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * Jose Lalin <dezac@corevia.com> + * Copyright 1999-2001 Jose Lalin <dezac@corevia.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,12 +45,12 @@ * */ -/* TOFIX: The sorting engine requires signed indexes to work, this means +/* FIXME: The sorting engine requires signed indexes to work, this means that arrays larger than 2^31 elements cannot be sorted. [vszakats] */ /* NOTE: Based on PD code found in SORTING AND SEARCHING ALGORITHMS: A COOKBOOK, BY THOMAS NIEMANN - http://members.xoom.com/_XMCM/thomasn/s_man.htm */ + https://www.cs.auckland.ac.nz/~jmor159/PLDS210/niemann/s_man.htm */ #include "hbvmint.h" #include "hbapiitm.h" @@ -91,7 +91,7 @@ static HB_BOOL hb_itemIsLess( PHB_BASEARRAY pBaseArray, PHB_ITEM pBlock, return hb_itemStrCmp( pItem1, pItem2, HB_FALSE ) < 0; else if( HB_IS_NUMINT( pItem1 ) && HB_IS_NUMINT( pItem2 ) ) /* intentionally separate comparison for integer numbers - to avoid precision lose in 64bit integer to double conversion */ + to avoid precision lose in 64-bit integer to double conversion */ return hb_itemGetNInt( pItem1 ) < hb_itemGetNInt( pItem2 ); else if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) ) return hb_itemGetND( pItem1 ) < hb_itemGetND( pItem2 ); @@ -104,7 +104,7 @@ static HB_BOOL hb_itemIsLess( PHB_BASEARRAY pBaseArray, PHB_ITEM pBlock, return lDate1 == lDate2 ? lTime1 < lTime2 : lDate1 < lDate2; } else if( HB_IS_DATETIME( pItem1 ) && HB_IS_DATETIME( pItem2 ) ) - /* it's not exact comparison, compare only julian date */ + /* it's not exact comparison, compare only Julian date */ return hb_itemGetDL( pItem1 ) < hb_itemGetDL( pItem2 ); else if( HB_IS_LOGICAL( pItem1 ) && HB_IS_LOGICAL( pItem2 ) ) return hb_itemGetL( pItem1 ) < hb_itemGetL( pItem2 ); @@ -181,10 +181,10 @@ static HB_ISIZ hb_arraySortQuickPartition( PHB_BASEARRAY pBaseArray, HB_ISIZ lb, static void hb_arraySortQuick( PHB_BASEARRAY pBaseArray, HB_ISIZ lb, HB_ISIZ ub, PHB_ITEM pBlock ) { - HB_ISIZ m; - while( lb < ub ) { + HB_ISIZ m; + if( ( HB_SIZE ) ub >= pBaseArray->nLen ) { ub = pBaseArray->nLen - 1; @@ -322,14 +322,13 @@ static void hb_arraySortStart( PHB_BASEARRAY pBaseArray, PHB_ITEM pBlock, HB_BOOL hb_arraySort( PHB_ITEM pArray, HB_SIZE * pnStart, HB_SIZE * pnCount, PHB_ITEM pBlock ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySort(%p, %p, %p, %p)", pArray, pnStart, pnCount, pBlock ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySort(%p, %p, %p, %p)", ( void * ) pArray, ( void * ) pnStart, ( void * ) pnCount, ( void * ) pBlock ) ); if( HB_IS_ARRAY( pArray ) ) { PHB_BASEARRAY pBaseArray = pArray->item.asArray.value; HB_SIZE nLen = pBaseArray->nLen; HB_SIZE nStart; - HB_SIZE nCount; if( pnStart && *pnStart >= 1 ) nStart = *pnStart; @@ -338,6 +337,8 @@ HB_BOOL hb_arraySort( PHB_ITEM pArray, HB_SIZE * pnStart, HB_SIZE * pnCount, PHB if( nStart <= nLen ) { + HB_SIZE nCount; + if( pnCount && *pnCount >= 1 && ( *pnCount <= nLen - nStart ) ) nCount = *pnCount; else diff --git a/src/vm/classes.c b/src/vm/classes.c index 3595c527d1..4aa6b6d0b4 100644 --- a/src/vm/classes.c +++ b/src/vm/classes.c @@ -2,6 +2,55 @@ * Base-routines for OOPS system * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999 Eddie Runia <eddie@runia.com> + * :CLASSSEL() + * __clsDelMsg() + * __clsModMsg() + * __clsInstSuper() + * __cls_CntClsData() + * __cls_CntData() + * __cls_DecData() + * __cls_IncData() + * __objClone() + * __objHasMsg() + * __objSendMsg() + * + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * __classNew() + * __classInstance() + * __classAdd() + * __className() + * __classSel() (based on hb___msgClsSel()) + * + * Copyright 1999 Janica Lubos <janica@fornax.elf.stuba.sk> + * hb_clsDictRealloc() + * + * Copyright 2000-2007 JF. Lefebvre <jfl@mafact.com> & RA. Cuylen <cakiral@altern.org + * Multiple inheritance fully implemented + * Forwarding, delegating + * Data initialization & Autoinit for Bool and Numeric + * Scoping: PROTECTED / EXPORTED + * + * Copyright 2008- JF. Lefebvre <jfl@mafact.com> + * hb_clsDictRealloc() New version + * Now support of shared and not shared class data + * Multiple data declarations fully supported + * + * Copyright 2000 Ryszard Glab <rglab@imid.med.pl> + * Garbage collector fixes + * + * Copyright 2001 JF. Lefebvre <jfl@mafact.com> + * Super msg corrected + * Scoping: working for PROTECTED, HIDDEN and READONLY + * To Many enhancement and correction to give a full list :-) + * Improved Class(y) compatibility + * Improved TopClass compatibility + * __CLS_PAR00() (Allow the creation of class which not autoinherit of the default HBObject()) + * Adding HB_CLS_ENFORCERO FLAG to disable Write access to RO VAR + * outside of Constructors /!\ Could be related to some incompatibility + * Added hb_objGetRealClsName() to keep a full class tree (for 99% cases) + * Fixed hb_clsIsParent() + * hb_objGetMthd() & __clsAddMsg() modified to translate operators * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,93 +93,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999 Eddie Runia <eddie@runia.com> - * :CLASSSEL() - * __clsDelMsg() - * __clsModMsg() - * __clsInstSuper() - * __cls_CntClsData() - * __cls_CntData() - * __cls_DecData() - * __cls_IncData() - * __objClone() - * __objHasMsg() - * __objSendMsg() - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * __classNew() - * __classInstance() - * __classAdd() - * __className() - * __classSel() (based on hb___msgClsSel()) - * - * Copyright 1999 Janica Lubos <janica@fornax.elf.stuba.sk> - * hb_clsDictRealloc() - * - * Copyright 2000-2007 JF. Lefebvre <jfl@mafact.com> & RA. Cuylen <cakiral@altern.org - * Multiple inheritence fully implemented - * Forwarding, delegating - * Data initialisation & Autoinit for Bool and Numeric - * Scoping : Protected / exported - * - * Copyright 2008- JF. Lefebvre <jfl@mafact.com> - * hb_clsDictRealloc() New version - * Now support of shared and not shared class data - * Multiple datas declaration fully supported - * - * 2000 RGlab - * Garbage collector fixe - * - * Copyright 2001 JF. Lefebvre <jfl@mafact.com> - * Super msg corrected - * Scoping : working for protected, hidden and readonly - * To Many enhancement and correction to give a full list :-) - * Improved class(y) compatibility - * Improved TopClass compatibility - * __CLS_PAR00() (Allow the creation of class wich not autoinherit of the default HBObject()) - * Adding HB_CLS_ENFORCERO FLAG to disable Write access to RO VAR - * outside of Constructors /!\ Could be related to some incompatibility - * Added hb_objGetRealClsName to keep a full class tree (for 99% cases) - * Fixed hb_clsIsParent - * - * - * hb_objGetMthd() & __clsAddMsg() modified to translate the followings operators - * - "+" = __OpPlus - "-" = __OpMinus - "*" = __OpMult - "/" = __OpDivide - "%" = __OpMod - "^" = __OpPower - "**" = __OpPower - "++" = __OpInc - "--" = __OpDec - "==" = __OpEqual - "=" = __OpEqual (same as "==") - "!=" = __OpNotEqual - "<>" = __OpNotEqual (same as "!=") - "#" = __OpNotEqual (same as "!=") - "<" = __OpLess - "<=" = __OpLessEqual - ">" = __OpGreater - ">=" = __OpGreaterEqual - "$" = __OpInstring - "$$" = __OpInclude - "!" = __OpNot - ".NOT." = __OpNot (same as "!") - ".AND." = __OpAnd - ".OR." = __OpOr - ":=" = __OpAssign ... not tested ... - "[]" = __OpArrayIndex - * - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbvmopt.h" #include "hbapi.h" #include "hbapicls.h" @@ -163,7 +125,7 @@ typedef struct PHB_SYMB pFuncSym; /* Function symbol */ PHB_SYMB pRealSym; /* Real function symbol when wrapper is used */ HB_TYPE itemType; /* Type of item in restricted assignment */ - HB_USHORT uiSprClass; /* Originalclass'handel (super or current class'handel if not herited). */ /*Added by RAC&JF*/ + HB_USHORT uiSprClass; /* Original class handle (super or current class handle if not inherited). [RAC&JF] */ HB_USHORT uiScope; /* Scoping value */ HB_USHORT uiData; /* Item position for instance data, class data and shared data (Harbour like, begin from 1), supercast class or delegated message index object */ HB_USHORT uiOffset; /* position in pInitData for class datas (from 1) or offset to instance area in inherited instance data and supercast messages (from 0) */ @@ -197,8 +159,8 @@ typedef struct HB_USHORT fHasDestructor; /* has the class destructor message? */ HB_USHORT fHasOnError; /* has the class OnError message? */ HB_USHORT fLocked; /* Class is locked against modifications */ - HB_USHORT uiMethods; /* Total Method initialised Counter */ - HB_USHORT uiInitDatas; /* Total Method initialised Counter */ + HB_USHORT uiMethods; /* Total Method initialized Counter */ + HB_USHORT uiInitDatas; /* Total Method initialized Counter */ HB_USHORT uiDatas; /* Total Data Counter */ HB_USHORT uiDataFirst; /* First instance item from this class */ HB_USHORT uiSuperClasses; /* Number of super classes */ @@ -263,14 +225,13 @@ HB_FUNC_STATIC( msgClassSel ); /* HB_FUNC_STATIC( msgClass ); */ /* HB_FUNC_STATIC( msgClassParent ); */ -/* ================================================ */ +/* --- */ /* static variables and structures initialized at HVM startup which * do not need any synchronization mechanism in MT mode, [druzus] */ -/* - * The positions of items in symbol table below have to correspond +/* The positions of items in symbol table below have to correspond * to HB_OO_OP_* constants in hbapicls.h, [druzus] */ static HB_SYMB s_opSymbols[ HB_OO_MAX_OPERATOR + 1 ] = { @@ -350,15 +311,14 @@ static HB_SYMB s___msgEnumValue = { "__ENUMVALUE", {HB_FS_MESSAGE}, {HB_FU static HB_SYMB s___msgEnumIsFirst = { "__ENUMISFIRST", {HB_FS_MESSAGE}, {HB_FUNCNAME( msgNull )}, NULL }; static HB_SYMB s___msgEnumIsLast = { "__ENUMISLAST", {HB_FS_MESSAGE}, {HB_FUNCNAME( msgNull )}, NULL }; -/* WITH OBJECT base value access/asign methods (:__withobject) */ +/* WITH OBJECT base value access/assign methods (:__withobject) */ static HB_SYMB s___msgWithObjectPush = { "__WITHOBJECT", {HB_FS_MESSAGE}, {HB_FUNCNAME( msgNull )}, NULL }; static HB_SYMB s___msgWithObjectPop = { "___WITHOBJECT", {HB_FS_MESSAGE}, {HB_FUNCNAME( msgNull )}, NULL }; -/* ================================================ */ +/* --- */ + +/* Scalar classes' handles */ -/* - * Scalar classes' handles - */ /* If user wants to change scalar classes at runtime in MT mode then * he must resolve thread synchronization problem himself, [druzus] */ @@ -376,11 +336,10 @@ static HB_USHORT s_uiPointerClass = 0; static HB_USHORT s_uiObjectClass = 0; -/* ================================================ */ +/* --- */ + +/* Class definition holder */ -/* - * Class definition holder - */ /* In MT mode we are allocating array big enough to hold all * class definitions so we do not have to worry about runtime * s_pClasses reallocation, [druzus] @@ -410,13 +369,12 @@ static HB_USHORT s_uiClasses = 0; static PHB_ITEM s_pClassMtx = NULL; -/* ================================================ */ +/* --- */ #if 0 static HB_USHORT hb_clsBucketPos( PHB_DYNS pMsg, HB_USHORT uiMask ) { - /* - * we can use PHB_DYNS address as base for hash key. + /* we can use PHB_DYNS address as base for hash key. * This value is perfectly unique and we do not need anything more * but it's not continuous so we will have to add dynamic BUCKETSIZE * modification to be 100% sure that we can resolve all symbol name @@ -432,15 +390,14 @@ static HB_USHORT hb_clsBucketPos( PHB_DYNS pMsg, HB_USHORT uiMask ) */ /* Using continuous symbol numbers we are 100% sure that we will cover - * the whole 16bit area and we will never have any problems until number + * the whole 16-bit area and we will never have any problems until number * of symbols is limited to 2^16. [druzus] */ return ( pMsg->uiSymNum & uiMask ) << BUCKETBITS; } #endif -/* - * hb_clsDictRealloc( PCLASS ) +/* hb_clsDictRealloc( PCLASS ) * * Realloc (widen) class */ @@ -454,7 +411,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) PMETHOD pNewMethods; #endif - HB_TRACE( HB_TR_DEBUG, ( "hb_clsDictRealloc(%p)", pClass ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsDictRealloc(%p)", ( void * ) pClass ) ); nNewHashKey = ( HB_SIZE ) pClass->uiHashKey + 1; nLimit = nNewHashKey << BUCKETBITS; @@ -463,7 +420,7 @@ static HB_BOOL hb_clsDictRealloc( PCLASS pClass ) { nNewHashKey <<= 1; if( nNewHashKey > HASH_KEYMAX ) - hb_errInternal( 6002, "Unable to realloc class message in __clsDictRealloc()", NULL, NULL ); + hb_errInternal( 6002, "Could not realloc class message in __clsDictRealloc()", NULL, NULL ); #ifdef HB_MSG_POOL puiMsgIdx = ( HB_USHORT * ) hb_xgrabz( ( nNewHashKey << BUCKETBITS ) * sizeof( HB_USHORT ) ); @@ -549,7 +506,7 @@ static void hb_clsDictInit( PCLASS pClass, HB_USHORT uiHashKey ) { HB_SIZE nSize; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsDictInit(%p,%hu)", pClass, uiHashKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsDictInit(%p,%hu)", ( void * ) pClass, uiHashKey ) ); pClass->uiHashKey = uiHashKey; #ifdef HB_MSG_POOL @@ -570,7 +527,7 @@ static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) HB_USHORT uiBucket, * puiMsgIdx; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindMsg(%p,%p)", pClass, pMsg ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); puiMsgIdx = pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->uiHashKey ); uiBucket = BUCKETSIZE; @@ -590,7 +547,7 @@ static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) PMETHOD pMethod; HB_USHORT uiBucket; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindMsg(%p,%p)", pClass, pMsg ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->uiHashKey ); uiBucket = BUCKETSIZE; @@ -610,7 +567,7 @@ static PMETHOD hb_clsFindMsg( PCLASS pClass, PHB_DYNS pMsg ) static PMETHOD hb_clsAllocMsg( PCLASS pClass, PHB_DYNS pMsg ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_clsAllocMsg(%p,%p)", pClass, pMsg ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsAllocMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); do { @@ -654,7 +611,7 @@ static PMETHOD hb_clsAllocMsg( PCLASS pClass, PHB_DYNS pMsg ) } while( hb_clsDictRealloc( pClass ) ); - hb_errInternal( 6001, "Unable to allocate new message", NULL, NULL ); + hb_errInternal( 6001, "Could not allocate new message", NULL, NULL ); return NULL; } @@ -680,7 +637,7 @@ static void hb_clsFreeMsg( PCLASS pClass, PHB_DYNS pMsg ) HB_USHORT uiBucket, * puiMsgIdx; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsFreeMsg(%p,%p)", pClass, pMsg ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsFreeMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); puiMsgIdx = pClass->puiMsgIdx + hb_clsBucketPos( pMsg, pClass->uiHashKey ); @@ -707,7 +664,7 @@ static void hb_clsFreeMsg( PCLASS pClass, PHB_DYNS pMsg ) PMETHOD pMethod; HB_USHORT uiBucket; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsFreeMsg(%p,%p)", pClass, pMsg ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsFreeMsg(%p,%p)", ( void * ) pClass, ( void * ) pMsg ) ); pMethod = pClass->pMethods + hb_clsBucketPos( pMsg, pClass->uiHashKey ); uiBucket = BUCKETSIZE; @@ -789,14 +746,14 @@ static HB_USHORT hb_clsParentInstanceOffset( PCLASS pClass, HB_USHORT uiParentCl return 0; } -/* +#if 0 static HB_USHORT hb_clsParentInstanceOffset( PCLASS pClass, HB_USHORT uiParentCls ) { PMETHOD pMethod = hb_clsFindMsg( pClass, s_pClasses[ uiParentCls ]->pClassSym ); return ( pMethod && pMethod->pFuncSym == &s___msgSuper ) ? pMethod->uiOffset : 0; } -*/ +#endif static HB_USHORT hb_clsAddInitValue( PCLASS pClass, PHB_ITEM pItem, HB_USHORT uiType, HB_USHORT uiData, @@ -804,7 +761,7 @@ static HB_USHORT hb_clsAddInitValue( PCLASS pClass, PHB_ITEM pItem, { PINITDATA pInitData; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsAddInitValue(%p,%p,%hu,%hu,%hu,%hu)", pClass, pItem, uiType, uiData, uiOffset, uiSprClass ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsAddInitValue(%p,%p,%hu,%hu,%hu,%hu)", ( void * ) pClass, ( void * ) pItem, uiType, uiData, uiOffset, uiSprClass ) ); if( ! pItem || HB_IS_NIL( pItem ) ) return 0; @@ -851,7 +808,7 @@ static HB_USHORT hb_clsFindRealClassDataOffset( PMETHOD pMethod ) { PMETHOD pRealMth; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindRealClassDataOffset(%p)", pMethod ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindRealClassDataOffset(%p)", ( void * ) pMethod ) ); pRealMth = hb_clsFindMsg( s_pClasses[ pMethod->uiSprClass ], pMethod->pMessage ); @@ -868,7 +825,7 @@ static HB_USHORT hb_clsFindClassDataOffset( PCLASS pClass, PMETHOD pNewMethod ) { HB_USHORT uiData; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindClassDataOffset(%p,%p)", pClass, pNewMethod ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsFindClassDataOffset(%p,%p)", ( void * ) pClass, ( void * ) pNewMethod ) ); uiData = hb_clsFindRealClassDataOffset( pNewMethod ); if( uiData ) @@ -898,7 +855,7 @@ static HB_BOOL hb_clsUpdateHiddenMessages( PMETHOD pSrcMethod, PMETHOD pDstMetho { PMETHOD pNewMethod = pSrcMethod; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsUpdateHiddenMessages(%p,%p,%p)", pSrcMethod, pDstMethod, pDstClass ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsUpdateHiddenMessages(%p,%p,%p)", ( void * ) pSrcMethod, ( void * ) pDstMethod, ( void * ) pDstClass ) ); if( ! pDstMethod->pMessage || ( hb_clsCanClearMethod( pDstMethod, HB_FALSE ) && @@ -968,7 +925,7 @@ static HB_BOOL hb_clsUpdateHiddenMessages( PMETHOD pSrcMethod, PMETHOD pDstMetho static void hb_clsAddSuperClass( PCLASS pClass, HB_USHORT uiSuperCls, HB_USHORT uiOffset ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_clsAddSuperClass(%p,%hu,%hu)", pClass, uiSuperCls, uiOffset ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsAddSuperClass(%p,%hu,%hu)", ( void * ) pClass, uiSuperCls, uiOffset ) ); pClass->pSuperClasses = ( PHB_CLSCAST ) hb_xrealloc( pClass->pSuperClasses, ( pClass->uiSuperClasses + 1 ) * sizeof( HB_CLSCAST ) ); @@ -981,7 +938,7 @@ static void hb_clsDefineSuperClass( PCLASS pClass, HB_USHORT uiSuperCls, HB_BOOL PMETHOD pMethod; PCLASS pSprCls; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsDefineSuperClass(%p,%hu,%d)", pClass, uiSuperCls, fNew ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsDefineSuperClass(%p,%hu,%d)", ( void * ) pClass, uiSuperCls, fNew ) ); pSprCls = s_pClasses[ uiSuperCls ]; @@ -1023,7 +980,7 @@ static void hb_clsCopyClass( PCLASS pClsDst, PCLASS pClsSrc ) PMETHOD pMethod; HB_SIZE nLimit; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsCopyClass(%p,%p)", pClsDst, pClsSrc ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsCopyClass(%p,%p)", ( void * ) pClsDst, ( void * ) pClsSrc ) ); hb_clsDictInit( pClsDst, pClsSrc->uiHashKey ); pClsDst->fHasOnError = pClsSrc->fHasOnError; @@ -1103,7 +1060,7 @@ static HB_BOOL hb_clsIsFriendSymbol( PCLASS pClass, PHB_SYMB pSym ) { HB_USHORT uiCount; - HB_TRACE( HB_TR_DEBUG, ( "hb_clsIsFriendSymbol(%p,%p)", pClass, pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsIsFriendSymbol(%p,%p)", ( void * ) pClass, ( void * ) pSym ) ); if( pSym >= pClass->pFriendModule && pSym < pClass->pFriendModule + pClass->uiFriendModule ) @@ -1120,7 +1077,7 @@ static HB_BOOL hb_clsIsFriendSymbol( PCLASS pClass, PHB_SYMB pSym ) static void hb_clsAddFriendSymbol( PCLASS pClass, PHB_SYMB pSym ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_clsAddFriendSymbol(%p,%p)", pClass, pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsAddFriendSymbol(%p,%p)", ( void * ) pClass, ( void * ) pSym ) ); if( ! hb_clsIsFriendSymbol( pClass, pSym ) ) { @@ -1139,9 +1096,7 @@ static void hb_clsAddFriendSymbol( PCLASS pClass, PHB_SYMB pSym ) } } -/* - * initialize Classy/OO system at HVM startup - */ +/* initialize Classy/OO system at HVM startup */ void hb_clsInit( void ) { PHB_SYMB pOpSym; @@ -1192,9 +1147,7 @@ void hb_clsInit( void ) #endif } -/* - * initialize Classy/OO system .prg functions - */ +/* initialize Classy/OO system .prg functions */ void hb_clsDoInit( void ) { static const char * s_pszFuncNames[] = @@ -1215,7 +1168,7 @@ void hb_clsDoInit( void ) HB_TRACE( HB_TR_DEBUG, ( "hb_clsDoInit()" ) ); - for( i = 0; i < ( int ) ( sizeof( s_puiHandles ) / sizeof( HB_USHORT * ) ); ++i ) + for( i = 0; i < ( int ) HB_SIZEOFARRAY( s_puiHandles ); ++i ) { PHB_DYNS pFuncSym = hb_dynsymFindName( s_pszFuncNames[i] ); if( pFuncSym && hb_dynsymIsFunction( pFuncSym ) ) @@ -1231,14 +1184,13 @@ void hb_clsDoInit( void ) } } -/* - * hb_clsRelease( <pClass> ) +/* hb_clsRelease( <pClass> ) * * Release a class from memory */ static void hb_clsRelease( PCLASS pClass ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_clsRelease(%p)", pClass ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsRelease(%p)", ( void * ) pClass ) ); if( pClass->uiInitDatas ) { @@ -1277,8 +1229,7 @@ static void hb_clsRelease( PCLASS pClass ) } -/* - * hb_clsReleaseAll() +/* hb_clsReleaseAll() * * Release all classes */ @@ -1318,11 +1269,9 @@ void hb_clsReleaseAll( void ) /* Mark all internal data as used so it will not be released by the * garbage collector */ - void hb_clsIsClassRef( void ) { - /* - * All internal items are allocated with hb_itemNew() + /* All internal items are allocated with hb_itemNew() * GC knows them and scan itself so it's not necessary * to repeat scanning here [druzus]. */ @@ -1403,14 +1352,12 @@ HB_USHORT hb_objSetClass( PHB_ITEM pItem, const char * szClass, const char * szF return uiClass; } -/* ================================================ */ +/* --- */ -/* - * Get the class handle - */ +/* Get the class handle */ static HB_USHORT hb_objGetClassH( PHB_ITEM pObject ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_objGetClassH(%p)", pObject ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objGetClassH(%p)", ( void * ) pObject ) ); if( HB_IS_ARRAY( pObject ) ) { @@ -1453,12 +1400,10 @@ static HB_USHORT hb_objGetClassH( PHB_ITEM pObject ) return 0; } -/* - * Get the class name of an object - */ +/* Get the class name of an object */ const char * hb_objGetClsName( PHB_ITEM pObject ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_objGetClsName(%p)", pObject ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objGetClsName(%p)", ( void * ) pObject ) ); if( HB_IS_ARRAY( pObject ) ) { @@ -1599,9 +1544,7 @@ static HB_USHORT hb_clsFindClassByFunc( PHB_SYMB pClassFuncSym ) return 0; } -/* - * Get the real method symbol for given stack symbol - */ +/* Get the real method symbol for given stack symbol */ PHB_SYMB hb_clsMethodSym( PHB_ITEM pBaseSymbol ) { PHB_STACK_STATE pStack = pBaseSymbol->item.asSymbol.stackstate; @@ -1615,8 +1558,11 @@ PHB_SYMB hb_clsMethodSym( PHB_ITEM pBaseSymbol ) pFuncSym = pMethod->pRealSym; if( pFuncSym == &s___msgEvalInline ) - return hb_arrayGetItemPtr( s_pClasses[ pMethod->uiSprClass ]->pInlines, - pMethod->uiData )->item.asBlock.value->pDefSymb; + { + PHB_ITEM pItem = hb_arrayGetItemPtr( s_pClasses[ pMethod->uiSprClass ]->pInlines, + pMethod->uiData ); + return pItem ? pItem->item.asBlock.value->pDefSymb : NULL; + } /* else if( pFuncSym == &s___msgPerform ) */ @@ -1629,8 +1575,7 @@ PHB_SYMB hb_clsMethodSym( PHB_ITEM pBaseSymbol ) return pBaseSymbol->item.asSymbol.value; } -/* - * Get the real class name of an object message +/* Get the real class name of an object message * Will return the class name from wich the message is inherited in case * of inheritance. */ @@ -1638,7 +1583,7 @@ const char * hb_objGetRealClsName( PHB_ITEM pObject, const char * szName ) { HB_USHORT uiClass; - HB_TRACE( HB_TR_DEBUG, ( "hb_objGetrealClsName(%p,%s)", pObject, szName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objGetrealClsName(%p,%s)", ( void * ) pObject, szName ) ); uiClass = hb_objGetClassH( pObject ); if( uiClass && uiClass <= s_uiClasses ) @@ -1673,7 +1618,7 @@ static HB_ISIZ hb_clsSenderOffset( void ) { nOffset = hb_stackItem( nOffset )->item.asSymbol.stackstate->nBaseItem; - /* I do not like it but Class(y) makes sth like that. [druzus] */ + /* I do not like it but Class(y) makes something like that. [druzus] */ while( nOffset > 0 && hb_stackItem( nOffset )->item.asSymbol.stackstate->uiClass == 0 ) nOffset = hb_stackItem( nOffset )->item.asSymbol.stackstate->nBaseItem; @@ -1760,8 +1705,7 @@ static PHB_SYMB hb_clsValidScope( PMETHOD pMethod, PHB_STACK_STATE pStack ) return pMethod->pFuncSym; else if( uiSenderClass ) { - /* - * Warning!!! Friends cannot access overloaded non virtual methods. + /* Warning!!! Friends cannot access overloaded non virtual methods. * This feature is available _ONLY_ for real class members, [druzus] */ if( pMethod->uiScope & HB_OO_CLSTP_OVERLOADED && @@ -1836,21 +1780,20 @@ static PHB_SYMB hb_clsScalarMethod( PCLASS pClass, PHB_DYNS pMsg, static void hb_clsMakeSuperObject( PHB_ITEM pDest, PHB_ITEM pObject, HB_USHORT uiSuperClass ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_clsMakeSuperObject(%p, %p, %hu)", pDest, pObject, uiSuperClass ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_clsMakeSuperObject(%p, %p, %hu)", ( void * ) pDest, ( void * ) pObject, uiSuperClass ) ); /* create a fake object array */ hb_arrayNew( pDest, 1 ); /* Now save the Self object as the 1st elem. */ hb_arraySet( pDest, 1, pObject ); /* And transform it into a fake object */ - /* backup of actual handel */ + /* backup of actual handle */ pDest->item.asArray.value->uiPrevCls = hb_objGetClassH( pObject ); - /* superclass handel casting */ + /* superclass handle casting */ pDest->item.asArray.value->uiClass = uiSuperClass; } -/* - * <pFuncSym> = hb_objGetMethod( <pObject>, <pMessage>, <pStackState> ) +/* <pFuncSym> = hb_objGetMethod( <pObject>, <pMessage>, <pStackState> ) * * Internal function to the function pointer of a message of an object */ @@ -1861,7 +1804,7 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage, PCLASS pClass = NULL; PHB_DYNS pMsg; - HB_TRACE( HB_TR_DEBUG, ( "hb_objGetMethod(%p, %p, %p)", pObject, pMessage, pStack ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objGetMethod(%p, %p, %p)", ( void * ) pObject, ( void * ) pMessage, ( void * ) pStack ) ); pMsg = pMessage->pDynSym; @@ -1877,8 +1820,7 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage, { if( pObject->item.asArray.value->nLen ) { - /* - * Copy real object - do not move! the same super casted + /* Copy real object - do not move! the same super casted * object can be used more then once and we mustn't * destroy it. We can safely use hb_stackReturnItem() here. */ @@ -1959,8 +1901,7 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage, if( HB_IS_ENUM( pEnum ) ) { - /* - * Do actions here - we already have unreferenced pEnum so + /* Do actions here - we already have unreferenced pEnum so * it will be a little bit faster but in the future it's * possible that I'll move it to separate function when * I'll add enumerators overloading. [druzus] @@ -2344,9 +2285,7 @@ HB_BOOL hb_objGetVarRef( PHB_ITEM pObject, PHB_SYMB pMessage, return HB_FALSE; } -/* - * Check if class has object destructors - */ +/* Check if class has object destructors */ HB_BOOL hb_clsHasDestructor( HB_USHORT uiClass ) { if( uiClass && uiClass <= s_uiClasses ) @@ -2355,9 +2294,7 @@ HB_BOOL hb_clsHasDestructor( HB_USHORT uiClass ) return HB_FALSE; } -/* - * Call all known super destructors - */ +/* Call all known super destructors */ static void hb_objSuperDestructorCall( PHB_ITEM pObject, PCLASS pClass ) { #if 0 @@ -2440,9 +2377,7 @@ static void hb_objSuperDestructorCall( PHB_ITEM pObject, PCLASS pClass ) #endif } -/* - * Call object destructor - */ +/* Call object destructor */ void hb_objDestructorCall( PHB_ITEM pObject ) { if( HB_IS_OBJECT( pObject ) && @@ -2465,14 +2400,12 @@ void hb_objDestructorCall( PHB_ITEM pObject ) } } -/* - * Check if object has a given operator - */ +/* Check if object has a given operator */ HB_BOOL hb_objHasOperator( PHB_ITEM pObject, HB_USHORT uiOperator ) { HB_USHORT uiClass; - HB_TRACE( HB_TR_DEBUG, ( "hb_objHasOperator(%p,%hu)", pObject, uiOperator ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objHasOperator(%p,%hu)", ( void * ) pObject, uiOperator ) ); uiClass = hb_objGetClassH( pObject ); if( uiClass && uiClass <= s_uiClasses ) @@ -2483,15 +2416,14 @@ HB_BOOL hb_objHasOperator( PHB_ITEM pObject, HB_USHORT uiOperator ) return HB_FALSE; } -/* - * Call object operator. If pMsgArg is NULL then operator is unary. +/* Call object operator. If pMsgArg is NULL then operator is unary. * Function return HB_TRUE when object class overloads given operator * and HB_FALSE otherwise. [druzus] */ HB_BOOL hb_objOperatorCall( HB_USHORT uiOperator, PHB_ITEM pResult, PHB_ITEM pObject, PHB_ITEM pMsgArg1, PHB_ITEM pMsgArg2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_objOperatorCall(%hu,%p,%p,%p,%p)", uiOperator, pResult, pObject, pMsgArg1, pMsgArg2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objOperatorCall(%hu,%p,%p,%p,%p)", uiOperator, ( void * ) pResult, ( void * ) pObject, ( void * ) pMsgArg1, ( void * ) pMsgArg2 ) ); if( hb_objHasOperator( pObject, uiOperator ) ) { @@ -2520,16 +2452,13 @@ HB_BOOL hb_objOperatorCall( HB_USHORT uiOperator, PHB_ITEM pResult, PHB_ITEM pOb return HB_FALSE; } -/* - * return HB_TRUE if object has a given message - */ +/* return HB_TRUE if object has a given message */ HB_BOOL hb_objHasMessage( PHB_ITEM pObject, PHB_DYNS pMessage ) { return hb_objGetMethod( pObject, pMessage->pSymbol, NULL ) != NULL; } -/* - * <bool> = hb_objHasMsg( <pObject>, <szString> ) +/* <bool> = hb_objHasMsg( <pObject>, <szString> ) * * Check whether <szString> is an existing message for object. * @@ -2539,7 +2468,7 @@ HB_BOOL hb_objHasMsg( PHB_ITEM pObject, const char * szString ) { PHB_DYNS pDynSym; - HB_TRACE( HB_TR_DEBUG, ( "hb_objHasMsg(%p, %s)", pObject, szString ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objHasMsg(%p, %s)", ( void * ) pObject, szString ) ); pDynSym = hb_dynsymFindName( szString ); if( pDynSym ) @@ -2570,7 +2499,7 @@ PHB_ITEM hb_objSendMessage( PHB_ITEM pObject, PHB_DYNS pMsgSym, HB_ULONG ulArg, hb_vmSend( ( HB_USHORT ) ulArg ); } else - hb_errRT_BASE( EG_ARG, 3000, NULL, "__ObjSendMessage()", 0 ); + hb_errRT_BASE( EG_ARG, 3000, NULL, "__objSendMessage()", 0 ); { HB_STACK_TLS_PRELOAD @@ -2682,7 +2611,7 @@ static PHB_SYMB hb_objGetFuncSym( PHB_ITEM pItem ) /* clone object if user defined clone method or copy it */ void hb_objCloneBody( PHB_ITEM pDest, PHB_ITEM pObject, PHB_NESTED_CLONED pClonedList ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_objCloneBody(%p,%p,%p)", pDest, pObject, pClonedList ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objCloneBody(%p,%p,%p)", ( void * ) pDest, ( void * ) pObject, ( void * ) pClonedList ) ); HB_SYMBOL_UNUSED( pClonedList ); @@ -2694,7 +2623,7 @@ void hb_objCloneBody( PHB_ITEM pDest, PHB_ITEM pObject, PHB_NESTED_CLONED pClone /* clone object if user defined clone method or copy it */ PHB_ITEM hb_objCloneTo( PHB_ITEM pDest, PHB_ITEM pObject ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_objCloneTo(%p,%p)", pDest, pObject ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_objCloneTo(%p,%p)", ( void * ) pDest, ( void * ) pObject ) ); hb_objCloneBody( pDest, pObject, NULL ); @@ -2785,7 +2714,7 @@ static HB_USHORT hb_clsUpdateScope( HB_USHORT uiScope, HB_BOOL fAssign ) instance variables, [druzus] */ uiScope &= ~HB_OO_CLSTP_READONLY; - uiScope |= uiScope & HB_OO_CLSTP_PROTECTED ? + uiScope |= ( uiScope & HB_OO_CLSTP_PROTECTED ) ? HB_OO_CLSTP_HIDDEN : HB_OO_CLSTP_PROTECTED; } } @@ -2894,7 +2823,7 @@ static HB_TYPE hb_clsGetItemType( PHB_ITEM pItem, HB_TYPE nDefault ) return nDefault; } -/* ================================================ */ +/* --- */ /* * <uiType> HB_OO_MSG_METHOD : standard method @@ -2918,7 +2847,7 @@ static HB_TYPE hb_clsGetItemType( PHB_ITEM pItem, HB_TYPE nDefault ) * HB_OO_CLSTP_READONLY 16 : data read only * HB_OO_CLSTP_SHARED 32 : (method or) data shared * HB_OO_CLSTP_CLASS 64 : message is class message not object - * * HB_OO_CLSTP_SUPER 128 : message is herited + * * HB_OO_CLSTP_SUPER 128 : message is inherited * HB_OO_CLSTP_PERSIST 256 : message is persistent (PROPERTY) * HB_OO_CLSTP_NONVIRTUAL 512 : Non Virtual message - should not be covered by subclass(es) messages with the same name when executed from a given class message * HB_OO_CLSTP_OVERLOADED 1024 : message overload NONVIRTUAL one @@ -3226,7 +3155,7 @@ static HB_BOOL hb_clsAddMsg( HB_USHORT uiClass, const char * szMessage, { if( hb_arrayLen( pClass->pClassDatas ) < ( HB_SIZE ) pNewMeth->uiData ) hb_arraySize( pClass->pClassDatas, pNewMeth->uiData ); - /* uiOffset is used to copy ancestor class data initializaers when + /* uiOffset is used to copy ancestor class data initializers when * new class is created */ pNewMeth->uiOffset = hb_clsAddInitValue( pClass, pInit, @@ -3251,7 +3180,7 @@ static HB_BOOL hb_clsAddMsg( HB_USHORT uiClass, const char * szMessage, case HB_OO_MSG_SUPER: - pNewMeth->uiData = uiSprClass; /* store the super handel */ + pNewMeth->uiData = uiSprClass; /* store the super handle */ pNewMeth->uiOffset = uiIndex; /* offset to instance area */ pNewMeth->uiScope = uiScope; pNewMeth->pFuncSym = &s___msgSuper; @@ -3315,8 +3244,7 @@ static HB_BOOL hb_clsAddMsg( HB_USHORT uiClass, const char * szMessage, return HB_TRUE; } -/* - * __clsAddMsg( <hClass>, <cMessage>, <pFunction>, <nType>, [xInit], <uiScope>, [xType] ) +/* __clsAddMsg( <hClass>, <cMessage>, <pFunction>, <nType>, [xInit], <uiScope>, [xType] ) * * Add a message to the class. * @@ -3357,7 +3285,7 @@ static HB_BOOL hb_clsAddMsg( HB_USHORT uiClass, const char * szMessage, * HB_OO_CLSTP_READONLY 16 : data read only * HB_OO_CLSTP_SHARED 32 : (method or) data shared * * HB_OO_CLSTP_CLASS 64 : message is class message not object - * * HB_OO_CLSTP_SUPER 128 : message is herited + * * HB_OO_CLSTP_SUPER 128 : message is inherited * HB_OO_CLSTP_PERSIST 256 : message is persistent (PROPERTY) * HB_OO_CLSTP_NONVIRTUAL 512 : Class method constructor * HB_OO_CLSTP_OVERLOADED 1024 : Class method constructor @@ -3385,8 +3313,8 @@ HB_FUNC( __CLSADDMSG ) } else if( nType == HB_OO_MSG_CLASSDATA ) { - nType = szMessage[ 0 ] == '_' ? HB_OO_MSG_CLSASSIGN : - HB_OO_MSG_CLSACCESS; + nType = szMessage[ 0 ] == '_' ? HB_OO_MSG_CLSASSIGN : + HB_OO_MSG_CLSACCESS; } /* to make xHarbour users happy ;-) */ else if( nType == HB_OO_MSG_PROPERTY || @@ -3423,10 +3351,9 @@ HB_FUNC( __CLSADDMSG ) } } -/* - * __clsNew( <szClassName>, <uiDatas>, +/* __clsNew( <szClassName>, <uiDatas>, * [<pSuperArray>], [<pClassFunc>], - * [<fModuleFriendly>] ) -> <hClass> + * [<fModuleFriendly>] ) --> <hClass> * * Create a new class * @@ -3638,8 +3565,7 @@ static HB_USHORT hb_clsNew( const char * szClassName, HB_USHORT uiDatas, return pNewCls->uiClass; } -/* - * __clsNew( <cClassName>, <nDatas>, [<ahSuper>], [<pClassFunc>], [<lModuleFriendly>] ) -> <hClass> +/* __clsNew( <cClassName>, <nDatas>, [<ahSuper>], [<pClassFunc>], [<lModuleFriendly>] ) --> <hClass> * * Create a new class * @@ -3688,8 +3614,7 @@ HB_FUNC( __CLSNEW ) hb_errRT_BASE( EG_ARG, 3000, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * __clsAddFriend( <hClass>, <sFuncSym> ) +/* __clsAddFriend( <hClass>, <sFuncSym> ) * * Add friend function */ @@ -3711,8 +3636,7 @@ HB_FUNC( __CLSADDFRIEND ) } } -/* - * __clsDelMsg( <hClass>, <cMessage> ) +/* __clsDelMsg( <hClass>, <cMessage> ) * * Delete message (only for INLINE and METHOD) * @@ -3735,8 +3659,7 @@ HB_FUNC( __CLSDELMSG ) } -/* - * hb_clsInst( <hClass> ) -> <pObjectItm> +/* hb_clsInst( <hClass> ) --> <pObjectItm> * * Create a new object from class definition <hClass> */ @@ -3795,8 +3718,7 @@ static PHB_ITEM hb_clsInst( HB_USHORT uiClass ) return pSelf; } -/* - * __clsInst( <hClass> ) -> <oNewObject> +/* __clsInst( <hClass> ) --> <oNewObject> * * Create a new object from class definition <hClass> */ @@ -3808,8 +3730,8 @@ HB_FUNC( __CLSINST ) hb_itemReturnRelease( pSelf ); } -/* - * __clsLock( <hClass> ) +/* __clsLock( <hClass> ) + * * Block farther class modifications */ HB_FUNC( __CLSLOCK ) @@ -3820,8 +3742,7 @@ HB_FUNC( __CLSLOCK ) s_pClasses[ uiClass ]->fLocked = HB_TRUE; } -/* - * __clsModMsg( <hClass>, <cMessage>, <pFunc> ) +/* __clsModMsg( <hClass>, <cMessage>, <pFunc> ) * * Modify message (only for INLINE and METHOD) */ @@ -3923,8 +3844,7 @@ HB_FUNC( __CLSMODMSG ) } -/* - * __objGetClsName( <hClass> | <oObj> ) -> <cClassName> +/* __objGetClsName( <hClass> | <oObj> ) --> <cClassName> * * Returns class name of <oObj> or <hClass> */ @@ -3943,8 +3863,7 @@ HB_FUNC( __OBJGETCLSNAME ) } -/* - * __objHasMsg( <oObj>, <cMsgName> | <sMsgName> ) -> <lRet> +/* __objHasMsg( <oObj>, <cMsgName> | <sMsgName> ) --> <lRet> * * Is <cSymbol> a valid message for the <oObj> */ @@ -3961,8 +3880,7 @@ HB_FUNC( __OBJHASMSG ) hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * __objHasMsgAssigned( <oObj>, <cMsgName> | <sMsgName> ) -> <lExists> +/* __objHasMsgAssigned( <oObj>, <cMsgName> | <sMsgName> ) --> <lExists> * * checks if function exists and is not virtual */ @@ -3981,8 +3899,7 @@ HB_FUNC( __OBJHASMSGASSIGNED ) hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * __objSendMsg( <oObj>, <cMsgName> | <sMsgName>, <xArg,..> ) -> <xRet> +/* __objSendMsg( <oObj>, <cMsgName> | <sMsgName>, <xArg,..> ) --> <xRet> * * Send a message to an object */ @@ -4008,8 +3925,7 @@ HB_FUNC( __OBJSENDMSG ) hb_errRT_BASE( EG_ARG, 3000, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* - * __objClone( <oSource> ) -> <oNew> +/* __objClone( <oSource> ) --> <oNew> * * Clone an object. Note the similarity with aClone ;-) */ @@ -4024,8 +3940,7 @@ HB_FUNC( __OBJCLONE ) hb_errRT_BASE( EG_ARG, 3001, NULL, HB_ERR_FUNCNAME, 0 ); } -/* - * __clsInstSuper( <cClassName> | <sClassFunc> ) -> <hClass> +/* __clsInstSuper( <cClassName> | <sClassFunc> ) --> <hClass> * * Instance super class and return class handle */ @@ -4120,8 +4035,7 @@ HB_FUNC( __CLSINSTSUPER ) hb_retni( uiClassH ); } -/* - * __clsAssocType( <hClass>, <cType> ) -> <lOK> +/* __clsAssocType( <hClass>, <cType> ) --> <lOK> * * Associate class with given basic type */ @@ -4185,8 +4099,7 @@ HB_FUNC( __CLSASSOCTYPE ) hb_retl( fResult ); } -/* - * __clsCntClasses() -> <nCount> +/* __clsCntClasses() --> <nCount> * * Return number of classes */ @@ -4196,8 +4109,7 @@ HB_FUNC( __CLSCNTCLASSES ) hb_retni( ( int ) s_uiClasses ); } -/* - * __cls_CntClsData( <hClass> ) -> <nCount> +/* __cls_CntClsData( <hClass> ) --> <nCount> * * Return number of class datas */ @@ -4210,8 +4122,7 @@ HB_FUNC( __CLS_CNTCLSDATA ) ( HB_USHORT ) hb_arrayLen( s_pClasses[ uiClass ]->pClassDatas ) : 0 ); } -/* - * __cls_CntShrData( <hClass> ) -> <nCount> +/* __cls_CntShrData( <hClass> ) --> <nCount> * * Return number of class datas */ @@ -4224,8 +4135,7 @@ HB_FUNC( __CLS_CNTSHRDATA ) ( HB_USHORT ) hb_arrayLen( s_pClasses[ uiClass ]->pSharedDatas ) : 0 ); } -/* - * __cls_CntData( <hClass> ) -> <nCount> +/* __cls_CntData( <hClass> ) --> <nCount> * * Return number of datas */ @@ -4238,8 +4148,7 @@ HB_FUNC( __CLS_CNTDATA ) s_pClasses[ uiClass ]->uiDatas : 0 ); } -/* - * __cls_DecData( <hClass> ) -> <nCount> +/* __cls_DecData( <hClass> ) --> <nCount> * * Decrease number of datas and return new value */ @@ -4259,8 +4168,8 @@ HB_FUNC( __CLS_DECDATA ) hb_retni( 0 ); } -/* - * __cls_IncData( <hClass> ) -> <nCount> +/* __cls_IncData( <hClass> ) --> <nCount> + * * Increase number of datas and return offset to new value */ HB_FUNC( __CLS_INCDATA ) @@ -4336,7 +4245,7 @@ HB_FUNC( __GETMESSAGE ) hb_retc( hb_stackItem ( hb_stackBaseItem()->item.asSymbol.stackstate->nBaseItem )->item.asSymbol.value->szName ); } -/* __clsParent( <hClass>, <cParentClass> ) -> <lIsParent> +/* __clsParent( <hClass>, <cParentClass> ) --> <lIsParent> * Checks if <cParentClass> is parent of <hClass> */ HB_FUNC( __CLSPARENT ) @@ -4348,7 +4257,7 @@ HB_FUNC( __CLSPARENT ) hb_clsIsParent( ( HB_USHORT ) hb_parni( 1 ), szParentName ) ); } -/* __Sender() -> <obj> | NIL +/* __Sender() --> <obj> | NIL * returns sender object */ HB_FUNC( __SENDER ) @@ -4429,8 +4338,7 @@ HB_FUNC( __CLSSYNCWAIT ) #endif /* HB_MT_VM */ } -/* - * __classH( <obj> ) -> <hClass> +/* __classH( <obj> ) --> <hClass> * * Returns class handle of <obj> */ @@ -4442,10 +4350,9 @@ HB_FUNC( __CLASSH ) hb_retni( pObject ? hb_objGetClassH( pObject ) : 0 ); } -/* ================================================ */ +/* --- */ -/* - * <hClass> := <obj>:ClassH() +/* <hClass> := <obj>:ClassH() * * Returns class handle of <obj> */ @@ -4456,8 +4363,7 @@ HB_FUNC_STATIC( msgClassH ) } -/* - * <cClassName> := <obj>:ClassName() +/* <cClassName> := <obj>:ClassName() * * Return class name of <obj>. Can also be used for all types. */ @@ -4518,8 +4424,7 @@ static int hb_methodType( PMETHOD pMethod ) return HB_OO_MSG_METHOD; } -/* - * <aMessages> := <obj>:ClassSel() +/* <aMessages> := <obj>:ClassSel() * * Returns all the messages in <obj> */ @@ -4530,7 +4435,7 @@ HB_FUNC_STATIC( msgClassSel ) if( uiClass && uiClass <= s_uiClasses ) { - PHB_ITEM pReturn, pItem; + PHB_ITEM pReturn; PCLASS pClass = s_pClasses[ uiClass ]; PMETHOD pMethod = pClass->pMethods; HB_SIZE nLimit = hb_clsMthNum( pClass ), nPos = 0; @@ -4556,12 +4461,15 @@ HB_FUNC_STATIC( msgClassSel ) { if( lFull ) { - pItem = hb_arrayGetItemPtr( pReturn, ++nPos ); - hb_arrayNew( pItem, 4 ); - hb_arraySetC( pItem, HB_OO_DATA_SYMBOL, - pMethod->pMessage->pSymbol->szName ); - hb_arraySetNI( pItem, HB_OO_DATA_TYPE, hb_methodType( pMethod ) ); - hb_arraySetNI( pItem, HB_OO_DATA_SCOPE, pMethod->uiScope ); + PHB_ITEM pItem = hb_arrayGetItemPtr( pReturn, ++nPos ); + if( pItem ) + { + hb_arrayNew( pItem, 4 ); + hb_arraySetC( pItem, HB_OO_DATA_SYMBOL, + pMethod->pMessage->pSymbol->szName ); + hb_arraySetNI( pItem, HB_OO_DATA_TYPE, hb_methodType( pMethod ) ); + hb_arraySetNI( pItem, HB_OO_DATA_SCOPE, pMethod->uiScope ); + } } else hb_arraySetC( pReturn, ++nPos, @@ -4581,8 +4489,7 @@ HB_FUNC_STATIC( msgClassSel ) #if 0 -/* - * __msgClass() +/* __msgClass() * * Internal function to return Self at Self:Class call (classy compatibility) */ @@ -4621,8 +4528,7 @@ HB_FUNC_STATIC( msgClassParent ) #endif -/* - * __msgEvalInline() +/* __msgEvalInline() * * Internal function executed for inline methods */ @@ -4657,11 +4563,12 @@ HB_FUNC_STATIC( msgPerform ) { HB_STACK_TLS_PRELOAD PHB_ITEM pItem = hb_param( 1, HB_IT_ANY ); - HB_USHORT uiPCount = hb_pcount(), uiParam; - PHB_SYMB pSym = NULL; if( pItem ) { + HB_USHORT uiPCount = hb_pcount(), uiParam; + PHB_SYMB pSym = NULL; + if( HB_IS_SYMBOL( pItem ) ) pSym = pItem->item.asSymbol.value; @@ -4766,8 +4673,7 @@ HB_FUNC_STATIC( msgSyncClass ) } } -/* - * __msgNoMethod() +/* __msgNoMethod() * * Internal function for generating error when not existing message is sent */ @@ -4797,8 +4703,7 @@ HB_FUNC_STATIC( msgNoMethod ) #endif } -/* - * __msgScopeErr() +/* __msgScopeErr() * * Internal function for generating error when not existing message is sent */ @@ -4835,8 +4740,7 @@ HB_FUNC_STATIC( msgTypeErr ) hb_xfree( pszProcName ); } -/* - * __msgSuper() +/* __msgSuper() * * Internal function to return a superobject */ @@ -4849,8 +4753,7 @@ HB_FUNC_STATIC( msgSuper ) s_pClasses[ pStack->uiClass ]->pMethods[ pStack->uiMethod ].uiData ); } -/* - * __msgRealClass() +/* __msgRealClass() * * Internal function to return a superobject of class where the method was * defined @@ -4873,8 +4776,7 @@ HB_FUNC_STATIC( msgRealClass ) } } -/* - * __msgGetClsData() +/* __msgGetClsData() * * Internal function to return a CLASSDATA */ @@ -4890,8 +4792,7 @@ HB_FUNC_STATIC( msgGetClsData ) } -/* - * __msgSetClsData() +/* __msgSetClsData() * * Internal function to set a CLASSDATA */ @@ -4926,8 +4827,7 @@ HB_FUNC_STATIC( msgSetClsData ) } } -/* - * __msgGetShrData() +/* __msgGetShrData() * * Internal function to return a SHAREDDATA */ @@ -4943,8 +4843,7 @@ HB_FUNC_STATIC( msgGetShrData ) pMethod->uiData, hb_stackReturnItem() ); } -/* - * __msgSetShrData() +/* __msgSetShrData() * * Internal function to set a SHAREDDATA */ @@ -4980,8 +4879,7 @@ HB_FUNC_STATIC( msgSetShrData ) } } -/* - * __msgGetData() +/* __msgGetData() * * Internal function to return a DATA */ @@ -5013,8 +4911,7 @@ HB_FUNC_STATIC( msgGetData ) } } -/* - * __msgSetData() +/* __msgSetData() * * Internal function to set a DATA */ @@ -5109,8 +5006,7 @@ void hb_mthAddTime( HB_ULONG ulClockTicks ) } #endif -/* __GetMsgPrf( <hClass>, <cMsg> ) -> <aMethodInfo> { { <nTimes>, <nTime> }, ... } - */ +/* __GetMsgPrf( <hClass>, <cMsg> ) --> <aMethodInfo> { { <nTimes>, <nTime> }, ... } */ HB_FUNC( __GETMSGPRF ) /* profiler: returns a method called and consumed times */ { HB_STACK_TLS_PRELOAD @@ -5334,7 +5230,7 @@ static void hb_objSetIVars( PHB_ITEM pObject, PHB_ITEM pArray ) } /* __objGetIVars( <oObject>, [<nScope>], [<lChanged>] ) - * -> <aIVars> { { <cName>, <xVal> }, ... } + * --> <aIVars> { { <cName>, <xVal> }, ... } */ HB_FUNC( __OBJGETIVARS ) { @@ -5346,7 +5242,7 @@ HB_FUNC( __OBJGETIVARS ) } /* __objSetIVars( <oObject> | <hClass> | <cClassName> | <sClassFunc>, - * <aIVars> ) -> <oObject> + * <aIVars> ) --> <oObject> */ HB_FUNC( __OBJSETIVARS ) { @@ -5376,7 +5272,7 @@ HB_FUNC( __OBJSETIVARS ) } /* __objRestoreIVars( <aIVars>, <hClass> | <sClassFunc> | - <cClassName>[, <cClassFuncName>] ) -> <oObject> + <cClassName>[, <cClassFuncName>] ) --> <oObject> */ HB_FUNC( __OBJRESTOREIVARS ) { @@ -5406,7 +5302,7 @@ HB_FUNC( __OBJRESTOREIVARS ) hb_itemReturn( pArray ); } -/* __clsGetProperties( <nClassHandle>, [<lAllExported>] ) -> <acProperties> +/* __clsGetProperties( <nClassHandle>, [<lAllExported>] ) --> <acProperties> * Notice that this function works quite similar to __classSel() * except that just returns the name of the datas and methods * that have been declared as PROPERTY (PERSISTENT) or also EXPORTED @@ -5477,8 +5373,7 @@ HB_FUNC( __CLSGETPROPERTIES ) hb_itemReturnRelease( pReturn ); } -/* __clsGetAncestors( <nClass> ) -> { <nSuper1>, <nSuper2>, ... } - */ +/* __clsGetAncestors( <nClass> ) --> { <nSuper1>, <nSuper2>, ... } */ HB_FUNC( __CLSGETANCESTORS ) { HB_USHORT uiClass = ( HB_USHORT ) hb_parni( 1 ), uiCount; @@ -5502,8 +5397,7 @@ HB_FUNC( __CLSGETANCESTORS ) } } -/* - * __clsMsgType( <hClass>, <cMsgName> | <sMsgName> ) -> <nType> +/* __clsMsgType( <hClass>, <cMsgName> | <sMsgName> ) --> <nType> * * return type of method attached to given message, * <nType> is one of HB_OO_MSG_* values defined in hboo.ch or @@ -5533,7 +5427,7 @@ HB_FUNC( __CLSMSGTYPE ) * for MT programs which will allocate dynamically at runtime * more then 16386 classes. In practice rather impossible though * who knows ;-) - * __clsPreallocate( [<nMaxClasses>] ) -> <nMaxClasses> + * __clsPreallocate( [<nMaxClasses>] ) --> <nMaxClasses> */ HB_FUNC( __CLSPREALLOCATE ) { @@ -5557,8 +5451,7 @@ HB_FUNC( __CLSPREALLOCATE ) hb_retnl( s_uiClsSize ); } -/* __clsLockDef( <clsItem> ) -> <lLocked> - */ +/* __clsLockDef( <clsItem> ) --> <lLocked> */ HB_FUNC( __CLSLOCKDEF ) { HB_STACK_TLS_PRELOAD @@ -5578,8 +5471,7 @@ HB_FUNC( __CLSLOCKDEF ) hb_retl( fLocked ); } -/* __clsUnlockDef( @<clsItem>, <clsDef> ) - */ +/* __clsUnlockDef( @<clsItem>, <clsDef> ) */ HB_FUNC( __CLSUNLOCKDEF ) { PHB_ITEM pClsDst = hb_param( 1, HB_IT_BYREF ), @@ -5598,7 +5490,7 @@ HB_FUNC( __CLSUNLOCKDEF ) } /* Dirty functions which converts array to object of given class - * __objSetClass( <oObject>, <cClassName> [, <cClassFuncName> ] ) -> <oObject> + * __objSetClass( <oObject>, <cClassName> [, <cClassFuncName> ] ) --> <oObject> */ HB_FUNC( __OBJSETCLASS ) { @@ -5615,11 +5507,11 @@ HB_FUNC( __OBJSETCLASS ) hb_itemReturn( pObject ); } -/* Real dirty function, though very usefull under certain circunstances: +/* Real dirty function, though very useful under certain circumstances: * It allows to change the class handle of an object into another class handle, * so the object behaves like a different Class of object. * Based on objects.lib SetClsHandle() - * __objSetClassHandle( <oObject>, <nClassHandle> ) -> <nPrevClassHandle> + * __objSetClassHandle( <oObject>, <nClassHandle> ) --> <nPrevClassHandle> */ HB_FUNC( __OBJSETCLASSHANDLE ) { @@ -5655,8 +5547,7 @@ void hb_clsAdd( HB_USHORT usClassH, const char * szMethodName, PHB_FUNC pFuncPtr PHB_SYMB pExecSym; PHB_ITEM pFuncItem; - /* - * We can use empty name "" for this symbol in hb_symbolNew() + /* We can use empty name "" for this symbol in hb_symbolNew() * It's only envelop for function with additional execution * information for HVM not registered symbol. [druzus] */ @@ -5717,9 +5608,7 @@ HB_FUNC( __CLSVERIFY ) } #if 0 -/* - * return real function name ignoring aliasing - */ +/* return real function name ignoring aliasing */ const char * hb_clsRealMethodName( void ) { HB_ISIZ nOffset = hb_stackBaseProcOffset( 1 ); diff --git a/src/vm/cmdarg.c b/src/vm/cmdarg.c index 14a46ed1cf..23daad5333 100644 --- a/src/vm/cmdarg.c +++ b/src/vm/cmdarg.c @@ -1,5 +1,5 @@ /* - * Command line and environment argument management + * Command-line and environment argument management * * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) * @@ -63,7 +63,7 @@ #include <os2.h> #endif -/* Command line argument management */ +/* Command-line argument management */ static int s_argc = 0; static char ** s_argv = NULL; @@ -91,12 +91,11 @@ static HB_BOOL s_WinMainParam = HB_FALSE; void hb_winmainArgVBuild( void ) { - LPCTSTR lpCmdLine, lpSrc; + LPCTSTR lpCmdLine; LPTSTR * lpArgV; LPTSTR lpDst, lpArg, lpModuleName; HB_SIZE nSize, nModuleName; int iArgC; - HB_BOOL fQuoted; /* NOTE: MAX_PATH used intentionally instead of HB_MAX_PATH */ lpModuleName = ( LPTSTR ) HB_WINARG_ALLOC( ( MAX_PATH + 1 ) * sizeof( TCHAR ) ); @@ -112,6 +111,9 @@ void hb_winmainArgVBuild( void ) while( lpCmdLine && ! lpArgV && iArgC != 0 ) { + HB_BOOL fQuoted; + LPCTSTR lpSrc; + if( nSize != 0 ) { lpArgV = ( LPTSTR * ) HB_WINARG_ALLOC( iArgC * sizeof( LPTSTR ) + @@ -291,7 +293,7 @@ HB_BOOL hb_winmainArgGet( void * phInstance, void * phPrevInstance, int * piCmdS void hb_cmdargInit( int argc, char * argv[] ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cmdargInit(%d, %p)", argc, argv ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cmdargInit(%d, %p)", argc, ( void * ) argv ) ); #if defined( HB_OS_WIN ) if( s_lpArgV ) @@ -459,10 +461,10 @@ int hb_cmdargPushArgs( void ) HB_BOOL hb_cmdargIsInternal( const char * szArg, int * piLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_cmdargIsInternal(%s, %p)", szArg, piLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_cmdargIsInternal(%s, %p)", szArg, ( void * ) piLen ) ); /* NOTE: Not checking for '--' here, as it would filter out - valid command line options used by applications. [vszakats] */ + valid command-line options used by applications. [vszakats] */ if( hb_strnicmp( szArg, "--hb:", 5 ) == 0 || hb_strnicmp( szArg, "//hb:", 5 ) == 0 ) @@ -494,7 +496,7 @@ static char * hb_cmdargGet( const char * pszName, HB_BOOL bRetValue ) HB_TRACE( HB_TR_DEBUG, ( "hb_cmdargGet(%s, %d)", pszName, ( int ) bRetValue ) ); - /* Check the command line first */ + /* Check the command-line first */ for( i = 1; i < s_argc; i++ ) { @@ -683,7 +685,7 @@ HB_FUNC( HB_ARGSTRING ) hb_retc_null(); } -/* Returns the number of command line arguments passed to the application, this +/* Returns the number of command-line arguments passed to the application, this also includes the internal arguments. */ HB_FUNC( HB_ARGC ) @@ -691,9 +693,9 @@ HB_FUNC( HB_ARGC ) hb_retni( s_argc - 1 ); } -/* Returns a command line argument passed to the application. Calling it with +/* Returns a command-line argument passed to the application. Calling it with the parameter zero or no parameter, it will return the name of the executable, - as written in the command line. */ + as written in the command-line. */ HB_FUNC( HB_ARGV ) { @@ -815,7 +817,7 @@ HB_FUNC( HB_CMDLINE ) hb_retc_null(); } -/* Check for command line internal arguments */ +/* Check for command-line internal arguments */ void hb_cmdargProcess( void ) { int iHandles; diff --git a/src/vm/codebloc.c b/src/vm/codebloc.c index 2645b113cf..10270b068f 100644 --- a/src/vm/codebloc.c +++ b/src/vm/codebloc.c @@ -44,8 +44,6 @@ * */ -/* The Harbour implementation of codeblocks */ - #include "hbvmopt.h" #include "hbapi.h" #include "hbapiitm.h" @@ -56,20 +54,17 @@ /* Dummy returning NIL for buggy code which may store references to freed by GC codeblock in .prg destructors and then (after - catching RT EG_DESTRUCTOR error) try to execute them - */ + catching RT EG_DESTRUCTOR error) try to execute them */ static const HB_BYTE s_pCode[ 2 ] = { HB_P_PUSHNIL, HB_P_ENDBLOCK }; -/* Release all allocated memory when called from the garbage collector - */ +/* Release all allocated memory when called from the garbage collector */ static HB_GARBAGE_FUNC( hb_codeblockGarbageDelete ) { PHB_CODEBLOCK pCBlock = ( PHB_CODEBLOCK ) Cargo; HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockGarbageDelete(%p)", Cargo ) ); - /* free space allocated for pcodes - if it was a macro-compiled codeblock - */ + /* free space allocated for pcodes - if it was a macro-compiled codeblock */ if( pCBlock->pCode && pCBlock->dynBuffer ) { pCBlock->dynBuffer = HB_FALSE; @@ -77,8 +72,7 @@ static HB_GARBAGE_FUNC( hb_codeblockGarbageDelete ) } pCBlock->pCode = s_pCode; - /* free space allocated for local variables - */ + /* free space allocated for local variables */ if( pCBlock->pLocals ) { if( hb_xRefDec( pCBlock->pLocals ) ) @@ -125,7 +119,6 @@ static const HB_GC_FUNCS s_gcCodeblockFuncs = * pSymbols -> a pointer to the module symbol table * * Note: pLocalPosTable cannot be used if uiLocals is ZERO - * */ PHB_CODEBLOCK hb_codeblockNew( const HB_BYTE * pBuffer, HB_USHORT uiLocals, @@ -138,18 +131,16 @@ PHB_CODEBLOCK hb_codeblockNew( const HB_BYTE * pBuffer, PHB_ITEM pLocals, pBase; const HB_BYTE * pCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockNew(%p, %hu, %p, %p, %" HB_PFS "u)", pBuffer, uiLocals, pLocalPosTable, pSymbols, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockNew(%p, %hu, %p, %p, %" HB_PFS "u)", ( const void * ) pBuffer, uiLocals, ( const void * ) pLocalPosTable, ( void * ) pSymbols, nLen ) ); - /* - * allocate memory for code block body and detach items hb_gcAllocRaw() + /* Allocate memory for code block body and detach items hb_gcAllocRaw() * to be safe for automatic GC activation in hb_xgrab() without * calling hb_gcLock()/hb_gcUnlock(). [druzus] */ if( nLen ) { - /* - * The codeblock pcode is stored in dynamically allocated memory that + /* The codeblock pcode is stored in dynamically allocated memory that * can be deallocated after creation of a codeblock. We have to duplicate * the passed buffer */ @@ -157,8 +148,7 @@ PHB_CODEBLOCK hb_codeblockNew( const HB_BYTE * pBuffer, } else { - /* - * The codeblock pcode is stored in static segment. + /* The codeblock pcode is stored in static segment. * The only allowed operation on a codeblock is evaluating it then * there is no need to duplicate its pcode - just store the pointer to it */ @@ -235,7 +225,7 @@ PHB_CODEBLOCK hb_codeblockNew( const HB_BYTE * pBuffer, pCBlock->uiLocals = uiLocals; pCBlock->pLocals = pLocals; - HB_TRACE( HB_TR_INFO, ( "codeblock created %p", pCBlock ) ); + HB_TRACE( HB_TR_INFO, ( "codeblock created %p", ( void * ) pCBlock ) ); return pCBlock; } @@ -247,15 +237,13 @@ PHB_CODEBLOCK hb_codeblockMacroNew( const HB_BYTE * pBuffer, HB_SIZE nLen ) PHB_ITEM pBase; HB_BYTE * pCode; - HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockMacroNew(%p, %" HB_PFS "u)", pBuffer, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockMacroNew(%p, %" HB_PFS "u)", ( const void * ) pBuffer, nLen ) ); - /* - * The codeblock pcode is stored in dynamically allocated memory that + /* The codeblock pcode is stored in dynamically allocated memory that * can be deallocated after creation of a codeblock. We have to duplicate * the passed buffer */ - /* - * allocate memory for code block body and detach items hb_gcAllocRaw() + /* allocate memory for code block body and detach items hb_gcAllocRaw() * to be safe for automatic GC activation in hb_xgrab() without * calling hb_gcLock()/hb_gcUnlock(). [druzus] */ @@ -268,39 +256,36 @@ PHB_CODEBLOCK hb_codeblockMacroNew( const HB_BYTE * pBuffer, HB_SIZE nLen ) pCBlock->dynBuffer = HB_TRUE; pCBlock->pDefSymb = pBase->item.asSymbol.stackstate->uiClass ? hb_clsMethodSym( pBase ) : pBase->item.asSymbol.value; - pCBlock->pSymbols = NULL; /* macro-compiled codeblock cannot acces a local symbol table */ + pCBlock->pSymbols = NULL; /* macro-compiled codeblock cannot access a local symbol table */ pCBlock->pStatics = hb_stackGetStaticsBase(); pCBlock->uiLocals = 0; pCBlock->pLocals = NULL; - HB_TRACE( HB_TR_INFO, ( "codeblock created %p", pCBlock ) ); + HB_TRACE( HB_TR_INFO, ( "codeblock created %p", ( void * ) pCBlock ) ); return pCBlock; } -/* Get local variable referenced in a codeblock - */ +/* Get local variable referenced in a codeblock */ PHB_ITEM hb_codeblockGetVar( PHB_ITEM pItem, int iItemPos ) { PHB_CODEBLOCK pCBlock = pItem->item.asBlock.value; - HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockGetVar(%p, %d)", pItem, iItemPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockGetVar(%p, %d)", ( void * ) pItem, iItemPos ) ); /* local variables accessed in a codeblock are always stored as reference */ return hb_itemUnRef( pCBlock->pLocals - iItemPos ); } -/* Get local variable passed by reference - */ +/* Get local variable passed by reference */ PHB_ITEM hb_codeblockGetRef( PHB_CODEBLOCK pCBlock, int iItemPos ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockGetRef(%p, %d)", pCBlock, iItemPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_codeblockGetRef(%p, %d)", ( void * ) pCBlock, iItemPos ) ); return pCBlock->pLocals - iItemPos; } -/* retrieves the codeblock unique ID - */ +/* retrieves the codeblock unique ID */ void * hb_codeblockId( PHB_ITEM pItem ) { if( HB_IS_BLOCK( pItem ) ) diff --git a/src/vm/debug.c b/src/vm/debug.c index dd66d740ce..68acf59118 100644 --- a/src/vm/debug.c +++ b/src/vm/debug.c @@ -51,7 +51,6 @@ #include "hbapierr.h" #include "hbstack.h" - /* Existing debug functions * from debug.c: * __dbgVMStkGCount() @@ -99,13 +98,12 @@ * HB_DBG_VMQUIT */ -/* +/* AddToArray( <pItem>, <pReturn>, <uiPos> ) * Add <pItem> to array <pReturn> at pos <uiPos> - * AddToArray( <pItem>, <pReturn>, <uiPos> ) */ static void AddToArray( PHB_ITEM pItem, PHB_ITEM pReturn, HB_SIZE nPos ) { - HB_TRACE( HB_TR_DEBUG, ( "AddToArray(%p, %p, %" HB_PFS "u)", pItem, pReturn, nPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "AddToArray(%p, %p, %" HB_PFS "u)", ( void * ) pItem, ( void * ) pReturn, nPos ) ); if( HB_IS_SYMBOL( pItem ) ) /* Symbol is pushed as text */ { @@ -124,9 +122,8 @@ static void AddToArray( PHB_ITEM pItem, PHB_ITEM pReturn, HB_SIZE nPos ) hb_itemArrayPut( pReturn, nPos, pItem ); } -/* +/* __dbgVMStkGCount() --> <nVars> * Returns the length of the global stack - * __dbgVMStkGCount() --> <nVars> */ HB_FUNC( __DBGVMSTKGCOUNT ) { @@ -136,9 +133,8 @@ HB_FUNC( __DBGVMSTKGCOUNT ) hb_retns( 0 ); } -/* +/* __dbgVMStkGList() --> <aStack> * Returns the global stack - * __dbgVMStkGList() --> <aStack> */ HB_FUNC( __DBGVMSTKGLIST ) { @@ -159,9 +155,8 @@ HB_FUNC( __DBGVMSTKGLIST ) hb_reta( 0 ); } -/* +/* hb_stackLen( <nProcLevel> ) --> <nVars> * Returns params plus locals amount of the nProcLevel function - * hb_stackLen( <nProcLevel> ) --> <nVars> */ static HB_ISIZ hb_stackLen( int iLevel ) { @@ -184,9 +179,8 @@ static HB_ISIZ hb_stackLen( int iLevel ) return nLen; } -/* +/* __dbgVMStkLCount( <nProcLevel> ) --> <nVars> * Returns params plus locals amount of the nProcLevel function - * __dbgVMStkLCount( <nProcLevel> ) --> <nVars> */ HB_FUNC( __DBGVMSTKLCOUNT ) { @@ -196,8 +190,7 @@ HB_FUNC( __DBGVMSTKLCOUNT ) hb_retns( 0 ); } -/* - * __dbgVMStkLList() --> <aStack> +/* __dbgVMStkLList() --> <aStack> * Returns the stack of the calling function * "[<symbol>]" Means symbol. * @@ -332,7 +325,6 @@ HB_FUNC( __DBGVMVARLSET ) int iLevel = hb_parni( 1 ) + 1; int iLocal = hb_parni( 2 ); HB_ISIZ nBaseOffset; - PHB_ITEM pLocal; nBaseOffset = hb_stackBaseOffset(); while( iLevel-- > 0 && nBaseOffset > 1 ) @@ -340,6 +332,8 @@ HB_FUNC( __DBGVMVARLSET ) if( iLevel < 0 ) { + PHB_ITEM pLocal; + if( iLocal > SHRT_MAX ) { iLocal -= USHRT_MAX; diff --git a/src/vm/dlmalloc.c b/src/vm/dlmalloc.c index 176261f89d..48b557f02f 100644 --- a/src/vm/dlmalloc.c +++ b/src/vm/dlmalloc.c @@ -1,12 +1,12 @@ /* This is a version (aka dlmalloc) of malloc/free/realloc written by Doug Lea and released to the public domain, as explained at - http://creativecommons.org/publicdomain/zero/1.0/ Send questions, + https://creativecommons.org/publicdomain/zero/1.0/ Send questions, comments, complaints, performance data, etc to dl@cs.oswego.edu * Version 2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea Note: There may be an updated version of this malloc obtainable at - ftp://gee.cs.oswego.edu/pub/misc/malloc.c + http://gee.cs.oswego.edu/pub/misc/malloc.c Check before installing! * Quickstart @@ -18,7 +18,7 @@ compile-time and dynamic tuning options. For convenience, an include file for code using this malloc is at: - ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.6.h + http://gee.cs.oswego.edu/pub/misc/malloc-2.8.6.h You don't really need this .h file unless you call functions not defined in your system include files. The .h file contains only the excerpts from this file needed for using this malloc on ANSI C/C++ @@ -3082,7 +3082,7 @@ static size_t traverse_and_check(mstate m); that the mstate controlling malloc/free is intact. This is a streamlined version of the approach described by William Robertson et al in "Run-time Detection of Heap-based Overflows" LISA'03 - http://www.usenix.org/events/lisa03/tech/robertson.html The footer + https://www.usenix.org/events/lisa03/tech/robertson.html The footer of an inuse chunk holds the xor of its mstate and a random seed, that is checked upon calls to free() and realloc(). This is (probabalistically) unguessable from outside the program, but can be diff --git a/src/vm/dynlibhb.c b/src/vm/dynlibhb.c index 31fc1caf86..88ebbe52f4 100644 --- a/src/vm/dynlibhb.c +++ b/src/vm/dynlibhb.c @@ -5,11 +5,6 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * @@ -70,7 +65,7 @@ # include <os2.h> #elif defined( HB_OS_DOS ) && defined( __WATCOMC__ ) && !defined( HB_CAUSEWAY_DLL ) /* it's broken in recent OpenWatcom builds so enable it - for tests only in harbur.dll [druzus] */ + for tests only in harbour.dll [druzus] */ # if defined( HB_DYNLIB ) # define HB_CAUSEWAY_DLL # include <cwdllfnc.h> @@ -273,7 +268,7 @@ HB_FUNC( HB_LIBERROR ) } /* Get FUNCTION or PROCEDURE symbol from given library. - * hb_libGetFunSym( <pLibHandle>, <cFuncName> ) -> <sFuncSym> | NIL + * hb_libGetFunSym( <pLibHandle>, <cFuncName> ) --> <sFuncSym> | NIL */ HB_FUNC( HB_LIBGETFUNSYM ) { diff --git a/src/vm/dynsym.c b/src/vm/dynsym.c index 40016e47f8..708ad8ede9 100644 --- a/src/vm/dynsym.c +++ b/src/vm/dynsym.c @@ -99,7 +99,7 @@ static PHB_DYNS hb_dynsymInsert( PHB_SYMB pSymbol, HB_UINT uiPos ) { PHB_DYNS pDynSym; - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymInsert(%p,%u)", pSymbol, uiPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymInsert(%p, %u)", ( void * ) pSymbol, uiPos ) ); if( ++s_uiDynSymbols == 0 ) { @@ -134,7 +134,7 @@ static PHB_DYNS hb_dynsymPos( const char * szName, HB_UINT * puiPos ) { HB_UINT uiFirst, uiLast, uiMiddle; - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymPos(%s,%p)", szName, puiPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymPos(%s, %p)", szName, ( void * ) puiPos ) ); uiFirst = 0; uiLast = s_uiDynSymbols; @@ -240,7 +240,7 @@ PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol ) PHB_DYNS pDynSym; HB_UINT uiPos; - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymNew(%p)", pSymbol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymNew(%p)", ( void * ) pSymbol ) ); HB_DYNSYM_LOCK(); @@ -305,10 +305,10 @@ PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol ) * decide what to do with them. We can leave it as is or we can * try to overload one symbol so both will point to the same * function. For .prg code such overloading will work but not - * for C code which makes sth like: HB_FUNC_EXEC( funcname ); + * for C code which makes something like: HB_FUNC_EXEC( funcname ); * In such case we cannot do anything - we cannot even detect * such situation. In some cases even linker cannot detect it - * because C compiler can make autoinlining or some bindings + * because C compiler can make auto-inlining or some bindings * which are not visible for linker */ /* Let's try to overload one of the functions. Simple: @@ -450,56 +450,56 @@ PHB_SYMB hb_dynsymFindSymbol( const char * szName ) PHB_SYMB hb_dynsymSymbol( PHB_DYNS pDynSym ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymSymbol(%p)", pDynSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymSymbol(%p)", ( void * ) pDynSym ) ); return pDynSym->pSymbol; } const char * hb_dynsymName( PHB_DYNS pDynSym ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymName(%p)", pDynSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymName(%p)", ( void * ) pDynSym ) ); return pDynSym->pSymbol->szName; } HB_BOOL hb_dynsymIsFunction( PHB_DYNS pDynSym ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymIsFunction(%p)", pDynSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymIsFunction(%p)", ( void * ) pDynSym ) ); return pDynSym->pSymbol->value.pFunPtr != NULL; } HB_BOOL hb_dynsymIsMemvar( PHB_DYNS pDynSym ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymIsMemvar(%p)", pDynSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymIsMemvar(%p)", ( void * ) pDynSym ) ); return hb_dynsymHandles( pDynSym )->pMemvar != NULL; } PHB_ITEM hb_dynsymGetMemvar( PHB_DYNS pDynSym ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymGetMemvar(%p)", pDynSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymGetMemvar(%p)", ( void * ) pDynSym ) ); return ( PHB_ITEM ) hb_dynsymHandles( pDynSym )->pMemvar; } void hb_dynsymSetMemvar( PHB_DYNS pDynSym, PHB_ITEM pMemvar ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymSetMemvar(%p,%p)", pDynSym, pMemvar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymSetMemvar(%p, %p)", ( void * ) pDynSym, ( void * ) pMemvar ) ); hb_dynsymHandles( pDynSym )->pMemvar = ( void * ) pMemvar; } int hb_dynsymAreaHandle( PHB_DYNS pDynSym ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymAreaHandle(%p)", pDynSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymAreaHandle(%p)", ( void * ) pDynSym ) ); return hb_dynsymHandles( pDynSym )->uiArea; } void hb_dynsymSetAreaHandle( PHB_DYNS pDynSym, int iArea ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymSetAreaHandle(%p,%d)", pDynSym, iArea ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymSetAreaHandle(%p, %d)", ( void * ) pDynSym, iArea ) ); hb_dynsymHandles( pDynSym )->uiArea = ( HB_USHORT ) iArea; } @@ -529,7 +529,7 @@ int hb_dynsymToNum( PHB_DYNS pDynSym ) { int iSymNum; - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymToNum(%p)", pDynSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymToNum(%p)", ( void * ) pDynSym ) ); HB_DYNSYM_LOCK(); @@ -573,7 +573,7 @@ void hb_dynsymEval( PHB_DYNS_FUNC pFunction, void * Cargo ) PHB_DYNS pDynSym = NULL; HB_USHORT uiPos = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymEval(%p, %p)", pFunction, Cargo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymEval(%p, %p)", ( void * ) pFunction, Cargo ) ); for( ;; ) { @@ -607,7 +607,7 @@ void hb_dynsymProtectEval( PHB_DYNS_FUNC pFunction, void * Cargo ) { HB_USHORT uiPos = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymProtectEval(%p, %p)", pFunction, Cargo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dynsymProtectEval(%p, %p)", ( void * ) pFunction, Cargo ) ); HB_DYNSYM_LOCK(); @@ -671,13 +671,12 @@ HB_FUNC( __DYNSGETNAME ) /* Get name of symbol: cSymbol = __dynsymGetName( dsInd HB_FUNC( __DYNSGETINDEX ) /* Gimme index number of symbol: dsIndex = __dynsymGetIndex( cSymbol ) */ { HB_STACK_TLS_PRELOAD - PHB_DYNS pDynSym; HB_UINT uiPos = 0; const char * szName = hb_parc( 1 ); if( szName ) { - pDynSym = hb_dynsymFindName( szName ); + PHB_DYNS pDynSym = hb_dynsymFindName( szName ); if( pDynSym ) { HB_DYNSYM_LOCK(); diff --git a/src/vm/estack.c b/src/vm/estack.c index 8f03a85ff9..74286dd121 100644 --- a/src/vm/estack.c +++ b/src/vm/estack.c @@ -59,7 +59,7 @@ #include "hbapirdd.h" #include "hbdate.h" -/* ------------------------------- */ +/* --- */ #if ! defined( STACK_INITHB_ITEMS ) #define STACK_INITHB_ITEMS 200 @@ -69,7 +69,7 @@ #endif -/* ------------------------------- */ +/* --- */ #if defined( HB_MT_VM ) @@ -144,23 +144,23 @@ #endif /* HB_MT_VM */ -/* ------------------------------- */ +/* --- */ static char s_szDirBuffer[ HB_PATH_MAX ]; static HB_IOERRORS s_IOErrors; static HB_TRACEINFO s_traceInfo; -/* ------------------------------- */ +/* --- */ static HB_SYMB s_initSymbol = { "hb_stackInit", { HB_FS_STATIC }, { NULL }, NULL }; -/* ------------------------------- */ +/* --- */ static void hb_stack_init( PHB_STACK pStack ) { HB_ISIZ n; - HB_TRACE( HB_TR_DEBUG, ( "hb_stack_init(%p)", pStack ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_stack_init(%p)", ( void * ) pStack ) ); memset( pStack, 0, sizeof( HB_STACK ) ); @@ -186,7 +186,7 @@ static void hb_stack_init( PHB_STACK pStack ) static void hb_stack_destroy_TSD( PHB_STACK pStack ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_stack_destroy_TSD(%p)", pStack ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_stack_destroy_TSD(%p)", ( void * ) pStack ) ); while( pStack->iTSD ) { @@ -212,7 +212,7 @@ static void hb_stack_free( PHB_STACK pStack ) { HB_ISIZ n; - HB_TRACE( HB_TR_DEBUG, ( "hb_stack_free(%p)", pStack ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_stack_free(%p)", ( void * ) pStack ) ); hb_stack_destroy_TSD( pStack ); @@ -257,7 +257,7 @@ void * hb_stackGetTSD( PHB_TSD pTSD ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_stackGetTSD(%p)", pTSD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_stackGetTSD(%p)", ( void * ) pTSD ) ); #if defined( HB_MT_VM ) if( pTSD->iHandle == 0 || pTSD->iHandle > hb_stack.iTSD || @@ -308,7 +308,7 @@ void * hb_stackTestTSD( PHB_TSD pTSD ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_stackTestTSD(%p)", pTSD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_stackTestTSD(%p)", ( void * ) pTSD ) ); #if defined( HB_MT_VM ) return ( pTSD->iHandle && pTSD->iHandle <= hb_stack.iTSD ) ? @@ -322,7 +322,7 @@ void hb_stackReleaseTSD( PHB_TSD pTSD ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_stackReleaseTSD(%p)", pTSD ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_stackReleaseTSD(%p)", ( void * ) pTSD ) ); if( pTSD->iHandle && pTSD->iHandle <= hb_stack.iTSD && hb_stack.pTSD[ pTSD->iHandle ].value ) @@ -335,7 +335,7 @@ void hb_stackReleaseTSD( PHB_TSD pTSD ) pTSD->iHandle = 0; /* TODO: add recovery system to not lose TSD handles and * make this functionality more general and public - * for 3-rd party developers + * for 3rd party developers */ } } @@ -1384,7 +1384,7 @@ void hb_stackIsStackRef( void * pStackId, PHB_TSD_FUNC pCleanFunc ) void hb_stackUpdateAllocator( void * pStackId, PHB_ALLOCUPDT_FUNC pFunc, int iCount ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_stackUpdateAllocator(%p, %p, %d)", pStackId, pFunc, iCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_stackUpdateAllocator(%p, %p, %d)", pStackId, ( void * ) pFunc, iCount ) ); #if defined( HB_MT_VM ) { diff --git a/src/vm/eval.c b/src/vm/eval.c index 1137f4d260..2014e8873b 100644 --- a/src/vm/eval.c +++ b/src/vm/eval.c @@ -2,6 +2,7 @@ * The Eval API * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (hb_itemDo()/hb_itemDoC() (based on HB_DO() by Ryszard Glab)) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,17 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_itemDo() ( based on HB_DO() by Ryszard Glab ) - * hb_itemDoC() ( based on HB_DO() by Ryszard Glab ) - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbvmint.h" #include "hbapi.h" #include "hbstack.h" @@ -64,7 +54,7 @@ HB_BOOL hb_evalNew( PHB_EVALINFO pEvalInfo, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_evalNew(%p, %p)", pEvalInfo, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_evalNew(%p, %p)", ( void * ) pEvalInfo, ( void * ) pItem ) ); if( pEvalInfo ) { @@ -93,7 +83,7 @@ HB_BOOL hb_evalNew( PHB_EVALINFO pEvalInfo, PHB_ITEM pItem ) HB_BOOL hb_evalPutParam( PHB_EVALINFO pEvalInfo, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_evalPutParam(%p, %p)", pEvalInfo, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_evalPutParam(%p, %p)", ( void * ) pEvalInfo, ( void * ) pItem ) ); if( pEvalInfo && pItem && pEvalInfo->paramCount < HB_EVAL_PARAM_MAX_ ) { @@ -109,13 +99,12 @@ PHB_ITEM hb_evalLaunch( PHB_EVALINFO pEvalInfo ) { PHB_ITEM pResult = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_evalLaunch(%p)", pEvalInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_evalLaunch(%p)", ( void * ) pEvalInfo ) ); if( pEvalInfo ) { PHB_ITEM pItem = pEvalInfo->pItems[ 0 ]; PHB_SYMB pSymbol = NULL; - HB_USHORT uiParam = 0; if( HB_IS_STRING( pItem ) ) { @@ -139,6 +128,8 @@ PHB_ITEM hb_evalLaunch( PHB_EVALINFO pEvalInfo ) if( pSymbol ) { + HB_USHORT uiParam = 0; + hb_vmPushSymbol( pSymbol ); if( pItem ) hb_vmPush( pItem ); @@ -163,7 +154,7 @@ PHB_ITEM hb_evalLaunch( PHB_EVALINFO pEvalInfo ) HB_BOOL hb_evalRelease( PHB_EVALINFO pEvalInfo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_evalRelease(%p)", pEvalInfo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_evalRelease(%p)", ( void * ) pEvalInfo ) ); if( pEvalInfo ) { @@ -197,7 +188,7 @@ PHB_ITEM hb_itemDo( PHB_ITEM pItem, HB_ULONG ulPCount, ... ) { PHB_ITEM pResult = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemDo(%p, %lu, ...)", pItem, ulPCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemDo(%p, %lu, ...)", ( void * ) pItem, ulPCount ) ); if( pItem ) { @@ -343,13 +334,15 @@ void hb_evalBlock( PHB_ITEM pCodeBlock, ... ) HB_FUNC( HB_FORNEXT ) /* nStart, nEnd | bEnd, bCode, nStep */ { - HB_MAXINT nStart = hb_parnint( 1 ), nEnd; - PHB_ITEM pEndBlock = hb_param( 2, HB_IT_BLOCK ); PHB_ITEM pCodeBlock = hb_param( 3, HB_IT_BLOCK ); - HB_MAXINT nStep = ( hb_pcount() > 3 ) ? hb_parnint( 4 ) : 1; if( pCodeBlock ) { + HB_MAXINT nStart = hb_parnint( 1 ), nEnd; + HB_MAXINT nStep = ( hb_pcount() > 3 ) ? hb_parnint( 4 ) : 1; + + PHB_ITEM pEndBlock = hb_param( 2, HB_IT_BLOCK ); + if( pEndBlock ) { hb_evalBlock0( pEndBlock ); @@ -504,11 +497,9 @@ HB_FUNC( HB_EXECFROMARRAY ) HB_BOOL hb_execFromArray( PHB_ITEM pParam ) { - PHB_SYMB pExecSym = NULL; PHB_ITEM pArray = NULL; PHB_ITEM pSelf = NULL; HB_ULONG ulParamOffset = 0; - int iPCount = 0; if( pParam && HB_IS_ARRAY( pParam ) && ! HB_IS_OBJECT( pParam ) ) { @@ -526,6 +517,8 @@ HB_BOOL hb_execFromArray( PHB_ITEM pParam ) if( pParam ) { + PHB_SYMB pExecSym = NULL; + if( HB_IS_SYMBOL( pParam ) ) pExecSym = hb_itemGetSymbol( pParam ); else if( HB_IS_STRING( pParam ) ) @@ -538,6 +531,8 @@ HB_BOOL hb_execFromArray( PHB_ITEM pParam ) if( pExecSym ) { + int iPCount = 0; + hb_vmPushSymbol( pExecSym ); if( pSelf ) hb_vmPush( pSelf ); @@ -569,7 +564,7 @@ HB_BOOL hb_execFromArray( PHB_ITEM pParam ) return HB_FALSE; } -/* hb_ExecMsg( <sFuncSym>, <object>, [<params,...>] ) -> <xResult> +/* hb_ExecMsg( <sFuncSym>, <object>, [<params,...>] ) --> <xResult> * Execute <sFuncSym> with <object> set as QSELF() value */ HB_FUNC( HB_EXECMSG ) diff --git a/src/vm/extend.c b/src/vm/extend.c index 9fb8e4a1d9..74150363f0 100644 --- a/src/vm/extend.c +++ b/src/vm/extend.c @@ -2,6 +2,8 @@ * The Extend API * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2009 Viktor Szakats (vszakats.net/harbour) (hb_stor(), hb_retn*len(), hb_retdl(), hb_parn*def()) + * Copyright 2000 Jose Lalin <dezac@corevia.com> (hb_retd()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,26 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2009 Viktor Szakats (vszakats.net/harbour) - * hb_stor() - * hb_retnlen() - * hb_retnilen() - * hb_retnllen() - * hb_retndlen() - * hb_retdl() - * hb_parnidef() (based on idea by Mindaugas Kavaliauskas) - * hb_parnldef() - * - * Copyright 2000 Jose Lalin <dezac@corevia.com> - * hb_retd() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbvmopt.h" #include "hbapi.h" #include "hbapiitm.h" @@ -341,7 +323,7 @@ char * hb_pardsbuff( char * szDate, int iParam ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_pardsbuff(%p, %d)", szDate, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_pardsbuff(%p, %d)", ( void * ) szDate, iParam ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -404,7 +386,7 @@ HB_BOOL hb_partdt( long * plJulian, long * plMilliSec, int iParam ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_partdt(%p,%p,%d)", plJulian, plMilliSec, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_partdt(%p,%p,%d)", ( void * ) plJulian, ( void * ) plMilliSec, iParam ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -731,7 +713,7 @@ void * hb_parptrGC( const HB_GC_FUNCS * pFuncs, int iParam ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parptrGC(%p,%d)", pFuncs, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parptrGC(%p,%d)", ( const void * ) pFuncs, iParam ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -925,7 +907,7 @@ char * hb_parvdsbuff( char * szDate, int iParam, ... ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parvdsbuff(%p, %d, ...)", szDate, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parvdsbuff(%p, %d, ...)", ( void * ) szDate, iParam ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -1021,7 +1003,7 @@ HB_BOOL hb_parvtdt( long * plJulian, long * plMilliSec, int iParam, ... ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parvtdt(%p,%p,%d, ...)", plJulian, plMilliSec, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parvtdt(%p,%p,%d, ...)", ( void * ) plJulian, ( void * ) plMilliSec, iParam ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -1340,7 +1322,7 @@ void * hb_parvptrGC( const HB_GC_FUNCS * pFuncs, int iParam, ... ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parvptrGC(%p,%d, ...)", pFuncs, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parvptrGC(%p,%d, ...)", ( const void * ) pFuncs, iParam ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { diff --git a/src/vm/extrap.c b/src/vm/extrap.c index 9539838988..55d4c807a8 100644 --- a/src/vm/extrap.c +++ b/src/vm/extrap.c @@ -2,6 +2,8 @@ * Exception handlers * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 2008 Mindaugas Kavaliauskas (dbtopas at dbtopas.lt) (hb_winExceptionHandler() Windows exception info dump code.) + * Copyright 2008-2010 Viktor Szakats (vszakats.net/harbour) (hb_winExceptionHandler() Module listing code, x86_64/WinCE/ARM support, OS/2, MIPS32, MIPS64, SH, IA64 CPU dumps.) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,23 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2008 Mindaugas Kavaliauskas (dbtopas at dbtopas.lt) - * hb_winExceptionHandler() Windows exception info dump code. - * - * Copyright 2008-2010 Viktor Szakats (vszakats.net/harbour) - * hb_winExceptionHandler() Module listing code. - * hb_winExceptionHandler() x64 support. - * hb_winExceptionHandler() WinCE/ARM support. - * hb_winExceptionHandler() OS/2 CPU dump. - * hb_winExceptionHandler() MIPS32, MIPS64, SH, IA64 CPU dumps. - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbapi.h" #include "hbvm.h" #include "hbapifs.h" @@ -164,7 +149,7 @@ static LONG WINAPI hb_winExceptionHandler( struct _EXCEPTION_POINTERS * pExcepti /* TODO: 64-bit stack trace. See: - StackWalk64() - - http://www.codeproject.com/KB/threads/StackWalker.aspx?fid=202364 */ + - https://www.codeproject.com/KB/threads/StackWalker.aspx?fid=202364 */ } #elif defined( HB_OS_WIN_64 ) && defined( HB_CPU_IA_64 ) { @@ -363,7 +348,7 @@ static LONG WINAPI hb_winExceptionHandler( struct _EXCEPTION_POINTERS * pExcepti pc = ( unsigned char * ) pCtx->Eip; for( i = 0; i < 16; i++ ) { - /* TOFIX: Unsafe funcion. */ + /* FIXME: Unsafe function. */ if( IsBadReadPtr( pc, 1 ) ) break; hb_snprintf( buf, sizeof( buf ), " %02X", ( int ) pc[ i ] ); @@ -373,7 +358,7 @@ static LONG WINAPI hb_winExceptionHandler( struct _EXCEPTION_POINTERS * pExcepti sc = ( unsigned int * ) pCtx->Esp; for( i = 0; i < 16; i++ ) { - /* TOFIX: Unsafe funcion. */ + /* FIXME: Unsafe function. */ if( IsBadReadPtr( sc, 4 ) ) break; hb_snprintf( buf, sizeof( buf ), " %08X", sc[ i ] ); @@ -384,12 +369,12 @@ static LONG WINAPI hb_winExceptionHandler( struct _EXCEPTION_POINTERS * pExcepti hb_strncat( errmsg, " EIP: EBP: Frame: OldEBP, RetAddr, Params...\n", errmsglen ); eip = pCtx->Eip; ebp = ( unsigned int * ) pCtx->Ebp; - /* TOFIX: Unsafe funcion. */ + /* FIXME: Unsafe function. */ if( ! IsBadWritePtr( ebp, 8 ) ) { for( i = 0; i < 20; i++ ) { - /* TOFIX: Unsafe funcion. */ + /* FIXME: Unsafe function. */ if( ( unsigned int ) ebp % 4 != 0 || IsBadWritePtr( ebp, 40 ) || ( unsigned int ) ebp >= ebp[ 0 ] ) break; hb_snprintf( buf, sizeof( buf ), " %08X %08X ", ( int ) eip, ( int ) ebp ); @@ -460,7 +445,7 @@ static LONG WINAPI hb_winExceptionHandler( struct _EXCEPTION_POINTERS * pExcepti { char buf[ 256 ]; #if defined( HB_OS_WIN_64 ) - /* TOFIX: me32.szExePath seemed trashed in some (standalone) tests. */ + /* FIXME: me32.szExePath seemed trashed in some (standalone) tests. */ hb_snprintf( buf, sizeof( buf ), "%016" PFLL "X %016" PFLL "X %s\n", ( HB_PTRUINT ) me32.modBaseAddr, ( HB_PTRUINT ) me32.modBaseSize, me32.szExePath ); #else char szBuffer[ MAX_PATH ]; @@ -594,7 +579,7 @@ void hb_vmSetExceptionHandler( void ) s_regRec.ExceptionHandler = ( ERR ) hb_os2ExceptionHandler; rc = DosSetExceptionHandler( &s_regRec ); if( rc != NO_ERROR ) - hb_errInternal( HB_EI_ERRUNRECOV, "Unable to setup exception handler (DosSetExceptionHandler())", NULL, NULL ); + hb_errInternal( HB_EI_ERRUNRECOV, "Could not setup exception handler (DosSetExceptionHandler())", NULL, NULL ); } #elif defined( HB_SIGNAL_EXCEPTION_HANDLER ) { @@ -628,7 +613,7 @@ void hb_vmUnsetExceptionHandler( void ) { APIRET rc; /* Return code */ - /* I don't do any check on return code since harbour is exiting in any case */ + /* I don't do any check on return code since Harbour is exiting in any case */ rc = DosUnsetExceptionHandler( &s_regRec ); HB_SYMBOL_UNUSED( rc ); } diff --git a/src/vm/fm.c b/src/vm/fm.c index b255eb289b..daedb0e03c 100644 --- a/src/vm/fm.c +++ b/src/vm/fm.c @@ -2,6 +2,7 @@ * The Fixed Memory API * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (hb_xquery()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,16 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_xquery() - * - * See COPYING.txt for licensing terms. - * - */ - /* NOTE: This definitions must be ahead of any and all #include statements */ #if ! defined( HB_FM_STATISTICS ) && \ @@ -323,7 +314,7 @@ typedef struct _HB_MEMINFO #define HB_FM_BLOCKSIZE( p ) ( s_fStatistic ? HB_FM_PTR( pMem )->nSize : 0 ) /* NOTE: we cannot use here HB_TRACE because it will overwrite the - * function name/line number of code which called hb_xalloc/hb_xgrab + * function name/line number of code which called hb_xalloc()/hb_xgrab() */ #define HB_TRACE_FM HB_TRACE_STEALTH @@ -622,7 +613,7 @@ void * hb_xalloc( HB_SIZE nSize ) /* allocates fixed memory, returns NUL /* NOTE: PRG line number/procname is not very useful during hunting * for memory leaks - this is why we are using the previously stored * function/line info - this is a location of code that called - * hb_xalloc/hb_xgrab + * hb_xalloc()/hb_xgrab() */ pMem->uiProcLine = pTrace->line; /* C line number */ if( pTrace->file ) @@ -713,7 +704,7 @@ void * hb_xgrab( HB_SIZE nSize ) /* allocates fixed memory, exits on fai /* NOTE: PRG line number/procname is not very useful during hunting * for memory leaks - this is why we are using the previously stored * function/line info - this is a location of code that called - * hb_xalloc/hb_xgrab + * hb_xalloc()/hb_xgrab() */ pMem->uiProcLine = pTrace->line; /* C line number */ if( pTrace->file ) @@ -1152,17 +1143,21 @@ static char * hb_mem2str( char * membuffer, void * pMem, HB_SIZE nSize ) nPrintable = 0; for( nIndex = 0; nIndex < nSize; nIndex++ ) + { if( ( cMem[ nIndex ] & 0x60 ) != 0 ) nPrintable++; + } if( nPrintable * 100 / nSize > 70 ) /* more then 70% printable chars */ { /* format as string of original chars */ for( nIndex = 0; nIndex < nSize; nIndex++ ) + { if( cMem[ nIndex ] >= ' ' ) membuffer[ nIndex ] = cMem[ nIndex ]; else membuffer[ nIndex ] = '.'; + } membuffer[ nIndex ] = '\0'; } else @@ -1170,9 +1165,8 @@ static char * hb_mem2str( char * membuffer, void * pMem, HB_SIZE nSize ) /* format as hex */ for( nIndex = 0; nIndex < nSize; nIndex++ ) { - int lownibble, hinibble; - hinibble = cMem[ nIndex ] >> 4; - lownibble = cMem[ nIndex ] & 0x0F; + HB_BYTE hinibble = cMem[ nIndex ] >> 4; + HB_BYTE lownibble = cMem[ nIndex ] & 0x0F; membuffer[ nIndex * 2 ] = hinibble <= 9 ? ( '0' + hinibble ) : ( 'A' + hinibble - 10 ); membuffer[ nIndex * 2 + 1 ] = lownibble <= 9 ? @@ -1507,7 +1501,7 @@ HB_SIZE hb_xquery( int iMode ) nResult = hb_stackTopOffset(); break; } - case HB_MEM_STATISTICS: /* Harbour extension (Is FM statistic is enabled?) */ + case HB_MEM_STATISTICS: /* Harbour extension (Is FM statistic enabled?) */ #ifdef HB_FM_STATISTICS nResult = s_fStatistic; #else diff --git a/src/vm/garbage.c b/src/vm/garbage.c index c0458e0e88..0c3cf7b0b1 100644 --- a/src/vm/garbage.c +++ b/src/vm/garbage.c @@ -90,7 +90,7 @@ /* holder of memory block information */ /* NOTE: HB_USHORT is used intentionally to fill up the structure to - * full 16 bytes (on 16/32 bit environment) + * full 16 bytes (on 16/32-bit environment) */ typedef struct HB_GARBAGE_ { @@ -386,7 +386,7 @@ void hb_gcGripDrop( PHB_ITEM pItem ) } /* Lock a memory pointer so it will not be released if stored - outside of harbour variables + outside of Harbour variables */ void * hb_gcLock( void * pBlock ) { @@ -409,7 +409,7 @@ void * hb_gcLock( void * pBlock ) } /* Unlock a memory pointer so it can be released if there is no - references inside of harbour variables + references inside of Harbour variables */ void * hb_gcUnlock( void * pBlock ) { @@ -724,7 +724,7 @@ void hb_gcReleaseAll( void ) { if( s_pCurrBlock ) { - PHB_GARBAGE pAlloc, pDelete; + PHB_GARBAGE pAlloc; s_bCollecting = HB_TRUE; @@ -742,7 +742,8 @@ void hb_gcReleaseAll( void ) do { - HB_TRACE( HB_TR_INFO, ( "Release %p", s_pCurrBlock ) ); + PHB_GARBAGE pDelete; + HB_TRACE( HB_TR_INFO, ( "Release %p", ( void * ) s_pCurrBlock ) ); pDelete = s_pCurrBlock; hb_gcUnlink( &s_pCurrBlock, pDelete ); HB_GC_AUTO_DEC(); @@ -779,7 +780,7 @@ HB_FUNC( HB_GCALL ) */ hb_ret(); - hb_gcCollectAll( hb_parldef( 1, 1 ) ); + hb_gcCollectAll( hb_parldef( 1, HB_TRUE ) ); } #ifdef HB_GC_AUTO diff --git a/src/vm/harbinit.prg b/src/vm/harbinit.prg index 95eea4ca89..8d101e5d8a 100644 --- a/src/vm/harbinit.prg +++ b/src/vm/harbinit.prg @@ -78,6 +78,6 @@ PROCEDURE __HBVMInit() PROCEDURE __SetHelpK() - SET KEY K_F1 TO __XHELP + SetKey( K_F1, {| p, l, v | __XHelp( p, l, v ) } ) RETURN diff --git a/src/vm/hashes.c b/src/vm/hashes.c index 6ef05d3692..54ac88e9e1 100644 --- a/src/vm/hashes.c +++ b/src/vm/hashes.c @@ -45,7 +45,7 @@ */ #ifndef _HB_HASH_INTERNAL_ -# define _HB_HASH_INTERNAL_ +#define _HB_HASH_INTERNAL_ #endif #include "hbvmopt.h" @@ -82,7 +82,7 @@ static HB_GARBAGE_FUNC( hb_hashGarbageRelease ) { PHB_BASEHASH pBaseHash = ( PHB_BASEHASH ) Cargo; - HB_TRACE( HB_TR_INFO, ( "hb_hashGarbageRelease(%p)", pBaseHash ) ); + HB_TRACE( HB_TR_INFO, ( "hb_hashGarbageRelease(%p)", ( void * ) pBaseHash ) ); if( pBaseHash->nSize > 0 ) { @@ -139,7 +139,7 @@ static HB_GARBAGE_FUNC( hb_hashGarbageMark ) { PHB_BASEHASH pBaseHash = ( PHB_BASEHASH ) Cargo; - HB_TRACE( HB_TR_INFO, ( "hb_hashMarkGarbage(%p)", pBaseHash ) ); + HB_TRACE( HB_TR_INFO, ( "hb_hashMarkGarbage(%p)", ( void * ) pBaseHash ) ); if( pBaseHash->nLen > 0 ) { @@ -240,7 +240,7 @@ static void hb_hashResort( PHB_BASEHASH pBaseHash ) static void hb_hashSortDo( PHB_BASEHASH pBaseHash ) { - HB_SIZE nPos, nFrom; + HB_SIZE nFrom; int iFlags = pBaseHash->iFlags; if( pBaseHash->pnPos ) @@ -281,7 +281,7 @@ static void hb_hashSortDo( PHB_BASEHASH pBaseHash ) for( nFrom = 1; nFrom < pBaseHash->nLen; ++nFrom ) { - nPos = nFrom; + HB_SIZE nPos = nFrom; while( nPos > 0 && hb_hashItemCmp( &pBaseHash->pPairs[ nPos - 1 ].key, &pBaseHash->pPairs[ nPos ].key, iFlags ) > 0 ) @@ -300,9 +300,8 @@ static void hb_hashSortDo( PHB_BASEHASH pBaseHash ) static HB_BOOL hb_hashFind( PHB_BASEHASH pBaseHash, PHB_ITEM pKey, HB_SIZE * pnPos ) { - HB_SIZE nLeft, nRight, nMiddle; + HB_SIZE nLeft, nRight; int iFlags = pBaseHash->iFlags; - int i; if( iFlags & HB_HASH_RESORT ) hb_hashSortDo( pBaseHash ); @@ -312,10 +311,10 @@ static HB_BOOL hb_hashFind( PHB_BASEHASH pBaseHash, PHB_ITEM pKey, HB_SIZE * pnP while( nLeft < nRight ) { - nMiddle = ( nLeft + nRight ) >> 1; - i = hb_hashItemCmp( &pBaseHash->pPairs[ pBaseHash->pnPos ? - pBaseHash->pnPos[ nMiddle ] : nMiddle ].key, - pKey, iFlags ); + HB_SIZE nMiddle = ( nLeft + nRight ) >> 1; + int i = hb_hashItemCmp( &pBaseHash->pPairs[ pBaseHash->pnPos ? + pBaseHash->pnPos[ nMiddle ] : nMiddle ].key, + pKey, iFlags ); if( i == 0 ) { *pnPos = pBaseHash->pnPos ? pBaseHash->pnPos[ nMiddle ] : nMiddle; @@ -563,7 +562,7 @@ PHB_ITEM hb_hashNew( PHB_ITEM pItem ) { PHB_BASEHASH pBaseHash; - HB_TRACE( HB_TR_DEBUG, ( "hb_hashNew(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashNew(%p)", ( void * ) pItem ) ); if( pItem == NULL ) pItem = hb_itemNew( NULL ); @@ -586,7 +585,7 @@ PHB_ITEM hb_hashNew( PHB_ITEM pItem ) HB_SIZE hb_hashLen( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashLen(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashLen(%p)", ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) return pHash->item.asHash.value->nLen; @@ -596,7 +595,7 @@ HB_SIZE hb_hashLen( PHB_ITEM pHash ) void hb_hashPreallocate( PHB_ITEM pHash, HB_SIZE nNewSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashPreallocate(%p,%" HB_PFS "u)", pHash, nNewSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashPreallocate(%p,%" HB_PFS "u)", ( void * ) pHash, nNewSize ) ); if( HB_IS_HASH( pHash ) ) hb_hashResize( pHash->item.asHash.value, nNewSize ); @@ -604,7 +603,7 @@ void hb_hashPreallocate( PHB_ITEM pHash, HB_SIZE nNewSize ) HB_BOOL hb_hashAllocNewPair( PHB_ITEM pHash, PHB_ITEM * pKeyPtr, PHB_ITEM * pValPtr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashAllocNewPair(%p,%p,%p)", pHash, pKeyPtr, pValPtr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashAllocNewPair(%p,%p,%p)", ( void * ) pHash, ( void * ) pKeyPtr, ( void * ) pValPtr ) ); if( HB_IS_HASH( pHash ) ) { @@ -617,7 +616,7 @@ HB_BOOL hb_hashAllocNewPair( PHB_ITEM pHash, PHB_ITEM * pKeyPtr, PHB_ITEM * pVal void hb_hashSort( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashSort(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashSort(%p)", ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) { @@ -633,7 +632,7 @@ void hb_hashSort( PHB_ITEM pHash ) PHB_ITEM hb_hashGetItemPtr( PHB_ITEM pHash, PHB_ITEM pKey, int iFlags ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetItemPtr(%p,%p,%d)", pHash, pKey, iFlags ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetItemPtr(%p,%p,%d)", ( void * ) pHash, ( void * ) pKey, iFlags ) ); if( HB_IS_HASH( pHash ) && HB_IS_HASHKEY( pKey ) ) { @@ -648,7 +647,7 @@ PHB_ITEM hb_hashGetItemPtr( PHB_ITEM pHash, PHB_ITEM pKey, int iFlags ) PHB_ITEM hb_hashGetCItemPtr( PHB_ITEM pHash, const char * pszKey ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetCItemPtr(%p,%s)", pHash, pszKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetCItemPtr(%p,%s)", ( void * ) pHash, pszKey ) ); if( HB_IS_HASH( pHash ) ) { @@ -670,7 +669,7 @@ HB_SIZE hb_hashGetCItemPos( PHB_ITEM pHash, const char * pszKey ) { HB_SIZE nPos = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetCItemPos(%p,%s)", pHash, pszKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetCItemPos(%p,%s)", ( void * ) pHash, pszKey ) ); if( HB_IS_HASH( pHash ) ) { @@ -692,7 +691,7 @@ HB_SIZE hb_hashGetCItemPos( PHB_ITEM pHash, const char * pszKey ) PHB_ITEM hb_hashGetItemRefPtr( PHB_ITEM pHash, PHB_ITEM pKey ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetItemRefPtr(%p,%p)", pHash, pKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetItemRefPtr(%p,%p)", ( void * ) pHash, ( void * ) pKey ) ); if( HB_IS_HASH( pHash ) && HB_IS_HASHKEY( pKey ) ) { @@ -712,7 +711,7 @@ PHB_ITEM hb_hashGetItemRefPtr( PHB_ITEM pHash, PHB_ITEM pKey ) HB_BOOL hb_hashScan( PHB_ITEM pHash, PHB_ITEM pKey, HB_SIZE * pnPos ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashScan(%p,%p,%p)", pHash, pKey, pnPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashScan(%p,%p,%p)", ( void * ) pHash, ( void * ) pKey, ( void * ) pnPos ) ); if( HB_IS_HASH( pHash ) ) { @@ -749,7 +748,7 @@ HB_BOOL hb_hashScan( PHB_ITEM pHash, PHB_ITEM pKey, HB_SIZE * pnPos ) HB_BOOL hb_hashScanSoft( PHB_ITEM pHash, PHB_ITEM pKey, HB_SIZE * pnPos ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashScanSoft(%p,%p,%p)", pHash, pKey, pnPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashScanSoft(%p,%p,%p)", ( void * ) pHash, ( void * ) pKey, ( void * ) pnPos ) ); if( HB_IS_HASH( pHash ) && HB_IS_HASHKEY( pKey ) ) { @@ -778,7 +777,7 @@ HB_BOOL hb_hashScanSoft( PHB_ITEM pHash, PHB_ITEM pKey, HB_SIZE * pnPos ) HB_BOOL hb_hashClear( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashClear(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashClear(%p)", ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) { @@ -816,7 +815,7 @@ HB_BOOL hb_hashClear( PHB_ITEM pHash ) HB_BOOL hb_hashDel( PHB_ITEM pHash, PHB_ITEM pKey ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashDel(%p,%p)", pHash, pKey ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashDel(%p,%p)", ( void * ) pHash, ( void * ) pKey ) ); if( HB_IS_HASH( pHash ) && HB_IS_HASHKEY( pKey ) ) { @@ -835,7 +834,7 @@ HB_BOOL hb_hashDel( PHB_ITEM pHash, PHB_ITEM pKey ) HB_BOOL hb_hashRemove( PHB_ITEM pHash, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashRemove(%p,%p)", pHash, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashRemove(%p,%p)", ( void * ) pHash, ( void * ) pItem ) ); if( HB_IS_HASH( pHash ) ) { @@ -870,7 +869,7 @@ HB_BOOL hb_hashRemove( PHB_ITEM pHash, PHB_ITEM pItem ) HB_BOOL hb_hashAdd( PHB_ITEM pHash, PHB_ITEM pKey, PHB_ITEM pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashAdd(%p,%p,%p)", pHash, pKey, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashAdd(%p,%p,%p)", ( void * ) pHash, ( void * ) pKey, ( void * ) pValue ) ); if( HB_IS_HASH( pHash ) && HB_IS_HASHKEY( pKey ) ) { @@ -892,7 +891,7 @@ HB_BOOL hb_hashAdd( PHB_ITEM pHash, PHB_ITEM pKey, PHB_ITEM pValue ) HB_BOOL hb_hashAddNew( PHB_ITEM pHash, PHB_ITEM pKey, PHB_ITEM pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashAddNew(%p,%p,%p)", pHash, pKey, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashAddNew(%p,%p,%p)", ( void * ) pHash, ( void * ) pKey, ( void * ) pValue ) ); if( HB_IS_HASH( pHash ) && HB_IS_HASHKEY( pKey ) ) return hb_hashNewValue( pHash->item.asHash.value, pKey, pValue ); @@ -902,7 +901,7 @@ HB_BOOL hb_hashAddNew( PHB_ITEM pHash, PHB_ITEM pKey, PHB_ITEM pValue ) PHB_ITEM hb_hashGetKeyAt( PHB_ITEM pHash, HB_SIZE nPos ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetKeyAt(%p,%" HB_PFS "u)", pHash, nPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetKeyAt(%p,%" HB_PFS "u)", ( void * ) pHash, nPos ) ); if( HB_IS_HASH( pHash ) && nPos > 0 && nPos <= pHash->item.asHash.value->nLen ) return &pHash->item.asHash.value->pPairs[ nPos - 1 ].key; @@ -912,7 +911,7 @@ PHB_ITEM hb_hashGetKeyAt( PHB_ITEM pHash, HB_SIZE nPos ) PHB_ITEM hb_hashGetValueAt( PHB_ITEM pHash, HB_SIZE nPos ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetValueAt(%p,%" HB_PFS "u)", pHash, nPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetValueAt(%p,%" HB_PFS "u)", ( void * ) pHash, nPos ) ); if( HB_IS_HASH( pHash ) && nPos > 0 && nPos <= pHash->item.asHash.value->nLen ) { @@ -925,7 +924,7 @@ PHB_ITEM hb_hashGetValueAt( PHB_ITEM pHash, HB_SIZE nPos ) HB_BOOL hb_hashDelAt( PHB_ITEM pHash, HB_SIZE nPos ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashDelAt(%p,%" HB_PFS "u)", pHash, nPos ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashDelAt(%p,%" HB_PFS "u)", ( void * ) pHash, nPos ) ); if( HB_IS_HASH( pHash ) && nPos > 0 && nPos <= pHash->item.asHash.value->nLen ) { @@ -936,10 +935,10 @@ HB_BOOL hb_hashDelAt( PHB_ITEM pHash, HB_SIZE nPos ) return HB_FALSE; } -/* retrives the hash unique ID */ +/* retrieves the hash unique ID */ void * hb_hashId( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashId(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashId(%p)", ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) return ( void * ) pHash->item.asHash.value; @@ -951,7 +950,7 @@ void hb_hashCloneBody( PHB_ITEM pDest, PHB_ITEM pHash, PHB_NESTED_CLONED pCloned { HB_SIZE nPos; - HB_TRACE( HB_TR_DEBUG, ( "hb_hashCloneBody(%p,%p,%p)", pDest, pHash, pClonedList ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashCloneBody(%p,%p,%p)", ( void * ) pDest, ( void * ) pHash, ( void * ) pClonedList ) ); hb_hashNew( pDest ); pDest->item.asHash.value->iFlags = pHash->item.asHash.value->iFlags; @@ -980,7 +979,7 @@ void hb_hashCloneBody( PHB_ITEM pDest, PHB_ITEM pHash, PHB_NESTED_CLONED pCloned PHB_ITEM hb_hashCloneTo( PHB_ITEM pDest, PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashCloneTo(%p,%p)", pDest, pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashCloneTo(%p,%p)", ( void * ) pDest, ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) { @@ -996,14 +995,14 @@ PHB_ITEM hb_hashCloneTo( PHB_ITEM pDest, PHB_ITEM pHash ) PHB_ITEM hb_hashClone( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashClone(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashClone(%p)", ( void * ) pHash ) ); return hb_hashCloneTo( hb_itemNew( NULL ), pHash ); } void hb_hashJoin( PHB_ITEM pDest, PHB_ITEM pSource, int iType ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashJoin(%p,%p,%d)", pDest, pSource, iType ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashJoin(%p,%p,%d)", ( void * ) pDest, ( void * ) pSource, iType ) ); if( HB_IS_HASH( pDest ) && HB_IS_HASH( pSource ) ) { @@ -1084,7 +1083,7 @@ void hb_hashJoin( PHB_ITEM pDest, PHB_ITEM pSource, int iType ) PHB_ITEM hb_hashGetKeys( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetKeys(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetKeys(%p)", ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) { @@ -1106,7 +1105,7 @@ PHB_ITEM hb_hashGetKeys( PHB_ITEM pHash ) PHB_ITEM hb_hashGetValues( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetValues(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetValues(%p)", ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) { @@ -1128,7 +1127,7 @@ PHB_ITEM hb_hashGetValues( PHB_ITEM pHash ) void hb_hashSetDefault( PHB_ITEM pHash, PHB_ITEM pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashSetDefault(%p,%p)", pHash, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashSetDefault(%p,%p)", ( void * ) pHash, ( void * ) pValue ) ); if( HB_IS_HASH( pHash ) ) { @@ -1149,7 +1148,7 @@ void hb_hashSetDefault( PHB_ITEM pHash, PHB_ITEM pValue ) PHB_ITEM hb_hashGetDefault( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetDefault(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetDefault(%p)", ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) return pHash->item.asHash.value->pDefault; @@ -1159,7 +1158,7 @@ PHB_ITEM hb_hashGetDefault( PHB_ITEM pHash ) void hb_hashSetFlags( PHB_ITEM pHash, int iFlags ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashSetFlags(%p,%d)", pHash, iFlags ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashSetFlags(%p,%d)", ( void * ) pHash, iFlags ) ); if( HB_IS_HASH( pHash ) ) { @@ -1184,7 +1183,7 @@ void hb_hashSetFlags( PHB_ITEM pHash, int iFlags ) void hb_hashClearFlags( PHB_ITEM pHash, int iFlags ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashClearFlags(%p,%d)", pHash, iFlags ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashClearFlags(%p,%d)", ( void * ) pHash, iFlags ) ); if( HB_IS_HASH( pHash ) ) { @@ -1201,7 +1200,7 @@ void hb_hashClearFlags( PHB_ITEM pHash, int iFlags ) int hb_hashGetFlags( PHB_ITEM pHash ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetFlags(%p)", pHash ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hashGetFlags(%p)", ( void * ) pHash ) ); if( HB_IS_HASH( pHash ) ) return pHash->item.asHash.value->iFlags; diff --git a/src/vm/hashfunc.c b/src/vm/hashfunc.c index de7a36054f..5e6b5ad632 100644 --- a/src/vm/hashfunc.c +++ b/src/vm/hashfunc.c @@ -54,13 +54,14 @@ HB_FUNC( HB_HASH ) { - int iPCount = hb_pcount(), iParam; + int iPCount = hb_pcount(); if( iPCount & 1 ) hb_errRT_BASE( EG_BOUND, 1131, NULL, hb_langDGetErrorDesc( EG_ARRDIMENSION ), HB_ERR_ARGS_BASEPARAMS ); else { PHB_ITEM pHash = hb_hashNew( NULL ); + int iParam; for( iParam = 1; iParam <= iPCount; iParam += 2 ) { PHB_ITEM pKey = hb_param( iParam, HB_IT_HASHKEY ); @@ -377,10 +378,11 @@ HB_FUNC( HB_HMERGE ) { PHB_ITEM pDest = hb_param( 1, HB_IT_HASH ); PHB_ITEM pSource = hb_param( 2, HB_IT_HASH ); - PHB_ITEM pAction = hb_param( 3, HB_IT_EVALITEM | HB_IT_NUMERIC ); if( pDest && pSource ) { + PHB_ITEM pAction = hb_param( 3, HB_IT_EVALITEM | HB_IT_NUMERIC ); + if( pAction && HB_IS_EVALITEM( pAction ) ) { HB_SIZE nLen = hb_hashLen( pSource ), nPos = 0; @@ -690,12 +692,14 @@ HB_FUNC( HB_HSORT ) HB_FUNC( HB_HCASEMATCH ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL ); if( pHash ) { + PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL ); int iFlags = hb_hashGetFlags( pHash ); + hb_retl( ( iFlags & HB_HASH_IGNORECASE ) == 0 ); + if( pValue ) { if( hb_itemGetL( pValue ) ) @@ -720,12 +724,14 @@ HB_FUNC( HB_HCASEMATCH ) HB_FUNC( HB_HBINARY ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL ); if( pHash ) { + PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL ); int iFlags = hb_hashGetFlags( pHash ); + hb_retl( ( iFlags & HB_HASH_BINARY ) != 0 ); + if( pValue ) { if( hb_itemGetL( pValue ) ) @@ -750,10 +756,10 @@ HB_FUNC( HB_HBINARY ) HB_FUNC( HB_HAUTOADD ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL | HB_IT_NUMERIC ); if( pHash ) { + PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL | HB_IT_NUMERIC ); int iOldFlags = hb_hashGetFlags( pHash ) & HB_HASH_AUTOADD_MASK; hb_retni( iOldFlags ); @@ -788,12 +794,14 @@ HB_FUNC( HB_HAUTOADD ) HB_FUNC( HB_HKEEPORDER ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL ); if( pHash ) { + PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL ); int iFlags = hb_hashGetFlags( pHash ); + hb_retl( ( iFlags & HB_HASH_KEEPORDER ) != 0 ); + if( pValue ) { if( hb_itemGetL( pValue ) ) diff --git a/src/vm/hvm.c b/src/vm/hvm.c index b1a83acf6c..df1b0f7b1c 100644 --- a/src/vm/hvm.c +++ b/src/vm/hvm.c @@ -2,6 +2,8 @@ * The Virtual Machine * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (hb_vmPushLongConst(), hb_vmPushDoubleConst()) + * Copyright 1999 Eddie Runia <eddie@runia.com> (__dbgVMVarSGet(), __dbgVMVarSList()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,21 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * hb_vmPushLongConst() - * hb_vmPushDoubleConst() - * - * Copyright 1999 Eddie Runia <eddie@runia.com> - * __dbgVMVarSGet() - * __dbgVMVarSList() - * - * See COPYING.txt for licensing terms. - * - */ - #define HB_STACK_PRELOAD #include "hbvmopt.h" @@ -98,10 +85,10 @@ HB_FUNC_EXTERN( BREAK ); static void hb_vmNegate( void ); /* negates (-) the latest value on the stack */ static void hb_vmInc( PHB_ITEM pItem ); /* increment the latest numeric value on the stack */ static void hb_vmDec( PHB_ITEM pItem ); /* decrements the latest numeric value on the stack */ -static void hb_vmFuncPtr( void ); /* pushes a function address pointer. Removes the symbol from the satck */ +static void hb_vmFuncPtr( void ); /* pushes a function address pointer. Removes the symbol from the stack */ static void hb_vmAddInt( PHB_ITEM pResult, HB_LONG lAdd ); /* add integer to given item */ static void hb_vmPlus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ); /* sums given values */ -static void hb_vmMinus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ); /* substracts given values */ +static void hb_vmMinus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ); /* subtracts given values */ static void hb_vmMult( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ); /* multiplies given values */ static void hb_vmDivide( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ); /* divides the given values */ static void hb_vmModulus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ); /* calculates modulus given values */ @@ -151,8 +138,8 @@ static void hb_vmSwapAlias( void ); /* swaps items on the eval s /* Execution */ static HARBOUR hb_vmDoBlock( void ); /* executes a codeblock */ -static void hb_vmFrame( HB_USHORT usLocals, unsigned char ucParams ); /* increases the stack pointer for the amount of locals and params suplied */ -static void hb_vmVFrame( HB_USHORT usLocals, unsigned char ucParams ); /* increases the stack pointer for the amount of locals and variable number of params suplied */ +static void hb_vmFrame( HB_USHORT usLocals, unsigned char ucParams ); /* increases the stack pointer for the amount of locals and params supplied */ +static void hb_vmVFrame( HB_USHORT usLocals, unsigned char ucParams ); /* increases the stack pointer for the amount of locals and variable number of params supplied */ static void hb_vmSFrame( PHB_SYMB pSym ); /* sets the statics frame for a function */ static void hb_vmStatics( PHB_SYMB pSym, HB_USHORT uiStatics ); /* increases the global statics array to hold a PRG statics */ static void hb_vmInitThreadStatics( HB_USHORT uiCount, const HB_BYTE * pCode ); /* mark thread static variables */ @@ -166,8 +153,8 @@ static void hb_vmPushBlock( const HB_BYTE * pCode, PHB_SYMB pSymbols, HB_SIZE static void hb_vmPushBlockShort( const HB_BYTE * pCode, PHB_SYMB pSymbols, HB_SIZE nLen ); /* creates a codeblock */ static void hb_vmPushMacroBlock( const HB_BYTE * pCode, HB_SIZE nSize, HB_USHORT usParams ); /* creates a macro-compiled codeblock */ static void hb_vmPushDoubleConst( double dNumber, int iWidth, int iDec ); /* Pushes a double constant (pcode) */ -static void hb_vmPushLocal( int iLocal ); /* pushes the containts of a local onto the stack */ -static void hb_vmPushLocalByRef( int iLocal ); /* pushes a local by refrence onto the stack */ +static void hb_vmPushLocal( int iLocal ); /* pushes the content of a local onto the stack */ +static void hb_vmPushLocalByRef( int iLocal ); /* pushes a local by reference onto the stack */ static void hb_vmPushHBLong( HB_MAXINT nNumber ); /* pushes a HB_MAXINT number onto the stack */ #if ! defined( HB_LONG_LONG_OFF ) static void hb_vmPushLongLongConst( HB_LONGLONG lNumber ); /* Pushes a long long constant (pcode) */ @@ -177,8 +164,8 @@ static void hb_vmPushIntegerConst( int iNumber ); /* Pushes a int constant ( #else static void hb_vmPushLongConst( long lNumber ); /* Pushes a long constant (pcode) */ #endif -static void hb_vmPushStatic( HB_USHORT uiStatic ); /* pushes the containts of a static onto the stack */ -static void hb_vmPushStaticByRef( HB_USHORT uiStatic ); /* pushes a static by refrence onto the stack */ +static void hb_vmPushStatic( HB_USHORT uiStatic ); /* pushes the content of a static onto the stack */ +static void hb_vmPushStaticByRef( HB_USHORT uiStatic ); /* pushes a static by reference onto the stack */ static void hb_vmPushVariable( PHB_SYMB pVarSymb ); /* pushes undeclared variable */ static void hb_vmPushObjectVarRef( void ); /* pushes reference to object variable */ static void hb_vmPushVParams( void ); /* pushes variable parameters */ @@ -259,12 +246,12 @@ static PHB_ITEM s_breakBlock = NULL; static HB_BOOL s_fHVMActive = HB_FALSE; /* is HVM ready for PCODE executing */ static HB_BOOL s_fDoExitProc = HB_TRUE; /* execute EXIT procedures */ -static int s_nErrorLevel = 0; /* application exit errorlevel */ +static int s_nErrorLevel = 0; /* application exit status */ static PHB_SYMB s_pSymStart = NULL; /* start symbol of the application. MAIN() is not required */ static PHB_SYMBOLS s_pSymbols = NULL; /* to hold a linked list of all different modules symbol tables */ static HB_ULONG s_ulFreeSymbols = 0;/* number of free module symbols */ -static void * s_hDynLibID = NULL; /* unique identifer to mark symbol tables loaded from dynamic libraries */ +static void * s_hDynLibID = NULL; /* unique identifier to mark symbol tables loaded from dynamic libraries */ static HB_BOOL s_fCloneSym = HB_FALSE;/* clone registered symbol tables */ /* main VM thread stack ID */ @@ -422,7 +409,7 @@ static void hb_vmDoModuleQuitFunctions( void ) } -/* call __HBVMINIT function to initialize GETLIST public variable +/* call __HBVMINIT() function to initialize GetList public variable * and set ErrorBlock() by ErrorSys() function */ static void hb_vmDoInitHVM( void ) @@ -462,7 +449,7 @@ void hb_vmLock( void ) {} void hb_vmUnlock( void ) {} HB_BOOL hb_vmSuspendThreads( HB_BOOL fWait ) { HB_SYMBOL_UNUSED( fWait ); return HB_TRUE; } void hb_vmResumeThreads( void ) {} -/* +#if 0 HB_BOOL hb_vmThreadRegister( void * Cargo ) { HB_SYMBOL_UNUSED( Cargo ); return HB_FALSE; } void hb_vmThreadRelease( void * Cargo ) { @@ -472,7 +459,7 @@ void hb_vmThreadRelease( void * Cargo ) if( pThItm ) hb_itemRelease( pThItm ); } -*/ +#endif #else static HB_CRITICAL_NEW( s_vmMtx ); @@ -738,7 +725,7 @@ HB_BOOL hb_vmThreadIsMain( void * Cargo ) static void hb_vmStackAdd( PHB_THREADSTATE pState ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmStackAdd(%p)", pState ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmStackAdd(%p)", ( void * ) pState ) ); if( ! pState->pPrev ) { @@ -763,7 +750,7 @@ static PHB_ITEM hb_vmStackDel( PHB_THREADSTATE pState, HB_BOOL fCounter ) { PHB_ITEM pThItm; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmStackDel(%p,%d)", pState, ( int ) fCounter ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmStackDel(%p,%d)", ( void * ) pState, ( int ) fCounter ) ); pState->fActive = HB_FALSE; pState->pStackId = NULL; @@ -796,7 +783,7 @@ static PHB_ITEM hb_vmStackDel( PHB_THREADSTATE pState, HB_BOOL fCounter ) static void hb_vmStackInit( PHB_THREADSTATE pState ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmStackInit(%p)", pState ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmStackInit(%p)", ( void * ) pState ) ); hb_stackInit(); /* initialize HVM thread stack */ @@ -920,7 +907,7 @@ void hb_vmThreadInit( void * Cargo ) if( s_fHVMActive ) { - /* call __HBVMINIT function to initialize GETLIST public variable + /* call __HBVMINIT() function to initialize GetList public variable * and set ErrorBlock() by ErrorSys() function */ hb_vmDoInitHVM(); @@ -996,7 +983,7 @@ void hb_vmThreadQuitRequest( void * Cargo ) PHB_ITEM hb_vmThreadStart( HB_ULONG ulAttr, PHB_CARGO_FUNC pFunc, void * cargo ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmThreadStart(%lu,%p,%p)", ulAttr, pFunc, cargo ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmThreadStart(%lu,%p,%p)", ulAttr, ( void * ) pFunc, cargo ) ); #if defined( HB_MT_VM ) return hb_threadStart( ulAttr, pFunc, cargo ); @@ -1149,7 +1136,7 @@ void hb_vmInit( HB_BOOL bStartMainProc ) */ hb_vmDoInitStatics(); - /* call __HBVMINIT function to initialize GETLIST public variable + /* call __HBVMINIT() function to initialize GetList public variable * and set ErrorBlock() by ErrorSys() function. */ hb_vmDoInitHVM(); @@ -1161,12 +1148,12 @@ void hb_vmInit( HB_BOOL bStartMainProc ) hb_vmDoInitFunctions( HB_FALSE ); /* process registered other INIT procedures */ /* Call __SetHelpK() function to redirect K_F1 to HELP() function - * if it is linked. CA-Cl*pper calls it after INIT PROCEDURes and + * if it is linked. CA-Cl*pper calls it after INIT PROCEDUREs and * before executing the application entry function. */ hb_vmDoInitHelp(); - /* This is undocumented CA-Cl*pper, if there's a function called _APPMAIN + /* This is undocumented CA-Cl*pper, if there's a function called _APPMAIN() it will be executed first. [vszakats] */ { PHB_DYNS pDynSym = hb_dynsymFind( "_APPMAIN" ); @@ -1343,7 +1330,7 @@ void hb_vmExecute( const HB_BYTE * pCode, PHB_SYMB pSymbols ) int * piKeyPolls = hb_stackKeyPolls(); #endif - HB_TRACE( HB_TR_DEBUG, ( "hb_vmExecute(%p, %p)", pCode, pSymbols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmExecute(%p, %p)", ( const void * ) pCode, ( void * ) pSymbols ) ); #ifndef HB_NO_PROFILER if( hb_bProfiler ) @@ -1371,7 +1358,7 @@ void hb_vmExecute( const HB_BYTE * pCode, PHB_SYMB pSymbols ) *piKeyPolls = 65536; /* IMHO we should have a _SET_ controlled by user - * sth like: + * something like: if( hb_stackSetStruct()->HB_SET_KEYPOLL ) { @@ -1379,7 +1366,7 @@ void hb_vmExecute( const HB_BYTE * pCode, PHB_SYMB pSymbols ) *piKeyPolls = hb_stackSetStruct()->HB_SET_KEYPOLL; } - for some GTs which can work in assynchrous mode user may + for some GTs which can work in asynchronous mode user may set it to 0 (or if he doesn't need any inkey poll) and when ALT+C/ALT+D is pressed (or any other platform dependent key combination) they should set proper flags in @@ -1924,7 +1911,7 @@ void hb_vmExecute( const HB_BYTE * pCode, PHB_SYMB pSymbols ) HB_TRACE( HB_TR_INFO, ( "HB_P_ENDBLOCK" ) ); hb_stackPopReturn(); /* manually inlined hb_vmRequestEndProc() for some C compilers - * which does not make such optimisation + * which does not make such optimization */ hb_stackSetActionRequest( HB_ENDPROC_REQUESTED ); break; @@ -1932,7 +1919,7 @@ void hb_vmExecute( const HB_BYTE * pCode, PHB_SYMB pSymbols ) case HB_P_ENDPROC: HB_TRACE( HB_TR_INFO, ( "HB_P_ENDPROC" ) ); /* manually inlined hb_vmRequestEndProc() for some C compilers - * which does not make such optimisation + * which does not make such optimization */ hb_stackSetActionRequest( HB_ENDPROC_REQUESTED ); break; @@ -2586,14 +2573,14 @@ void hb_vmExecute( const HB_BYTE * pCode, PHB_SYMB pSymbols ) Test with Clipper shows that for assignment, MEMVAR context is always used even if MEMVAR does NOT exists, and a FIELD with this name exists!!! - Here is the Test Ueed - Clipper produced NO R/T Error - + Here is the Test Used - Clipper produced NO runtime error - indicating MEMVAR was created. PROCEDURE Main() - USE Test + USE test.dbf First := First - CLOSE + dbCloseArea() ? First - RETURN + RETURN */ #if 0 /* Pops a value from the eval stack and uses it to set @@ -3100,7 +3087,7 @@ void hb_vmExecute( const HB_BYTE * pCode, PHB_SYMB pSymbols ) static void hb_vmAddInt( PHB_ITEM pResult, HB_LONG lAdd ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmAddInt(%p,%ld)", pResult, lAdd ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmAddInt(%p,%ld)", ( void * ) pResult, lAdd ) ); if( HB_IS_BYREF( pResult ) ) { @@ -3234,7 +3221,7 @@ static void hb_vmNegate( void ) static void hb_vmTimeStampPut( PHB_ITEM pItem, long lJulian, long lMilliSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmTimeStampPut(%p,%ld,%ld)", pItem, lJulian, lMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmTimeStampPut(%p,%ld,%ld)", ( void * ) pItem, lJulian, lMilliSec ) ); /* timestamp normalization */ if( lJulian < 0 ) @@ -3281,7 +3268,7 @@ static void hb_vmTimeStampAdd( PHB_ITEM pResult, PHB_ITEM pItem, double dValue ) { long lJulian, lMilliSec; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmTimeStampAdd(%p,%p,%lf)", pResult, pItem, dValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmTimeStampAdd(%p,%p,%lf)", ( void * ) pResult, ( void * ) pItem, dValue ) ); hb_timeStampUnpackDT( dValue, &lJulian, &lMilliSec ); @@ -3293,7 +3280,7 @@ static void hb_vmTimeStampAdd( PHB_ITEM pResult, PHB_ITEM pItem, double dValue ) static void hb_vmPlus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPlus(%p,%p,%p)", pResult, pItem1, pItem2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPlus(%p,%p,%p)", ( void * ) pResult, ( void * ) pItem1, ( void * ) pItem2 ) ); if( HB_IS_NUMINT( pItem1 ) && HB_IS_NUMINT( pItem2 ) ) { @@ -3409,7 +3396,7 @@ static void hb_vmPlus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) static void hb_vmMinus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmMinus(%p,%p,%p)", pResult, pItem1, pItem2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmMinus(%p,%p,%p)", ( void * ) pResult, ( void * ) pItem1, ( void * ) pItem2 ) ); if( HB_IS_NUMINT( pItem1 ) && HB_IS_NUMINT( pItem2 ) ) { @@ -3518,7 +3505,7 @@ static void hb_vmMinus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) static void hb_vmMult( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmMult(%p,%p,%p)", pResult, pItem1, pItem2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmMult(%p,%p,%p)", ( void * ) pResult, ( void * ) pItem1, ( void * ) pItem2 ) ); #if -( HB_VMLONG_MAX / HB_VMINT_MIN ) >= HB_VMINT_MAX && 1 if( HB_IS_INTEGER( pItem1 ) && HB_IS_INTEGER( pItem2 ) ) @@ -3554,7 +3541,7 @@ static void hb_vmMult( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) static void hb_vmDivide( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmDivide(%p,%p,%p)", pResult, pItem1, pItem2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmDivide(%p,%p,%p)", ( void * ) pResult, ( void * ) pItem1, ( void * ) pItem2 ) ); if( HB_IS_NUMINT( pItem1 ) && HB_IS_NUMINT( pItem2 ) ) { @@ -3616,7 +3603,7 @@ static void hb_vmDivide( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) static void hb_vmModulus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmModulus(%p,%p,%p)", pResult, pItem1, pItem2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmModulus(%p,%p,%p)", ( void * ) pResult, ( void * ) pItem1, ( void * ) pItem2 ) ); if( HB_IS_NUMINT( pItem1 ) && HB_IS_NUMINT( pItem2 ) ) { @@ -3674,7 +3661,7 @@ static void hb_vmModulus( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) static void hb_vmPower( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPower(%p,%p,%p)", pResult, pItem1, pItem2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPower(%p,%p,%p)", ( void * ) pResult, ( void * ) pItem1, ( void * ) pItem2 ) ); if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) ) { @@ -3696,7 +3683,7 @@ static void hb_vmPower( PHB_ITEM pResult, PHB_ITEM pItem1, PHB_ITEM pItem2 ) static void hb_vmInc( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmInc(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmInc(%p)", ( void * ) pItem ) ); if( HB_IS_NUMINT( pItem ) ) { @@ -3761,7 +3748,7 @@ static void hb_vmInc( PHB_ITEM pItem ) static void hb_vmDec( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmDec(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmDec(%p)", ( void * ) pItem ) ); if( HB_IS_NUMINT( pItem ) ) { @@ -3824,7 +3811,7 @@ static void hb_vmDec( PHB_ITEM pItem ) } } -static void hb_vmFuncPtr( void ) /* pushes a function address pointer. Removes the symbol from the satck */ +static void hb_vmFuncPtr( void ) /* pushes a function address pointer. Removes the symbol from the stack */ { HB_STACK_TLS_PRELOAD PHB_ITEM pItem; @@ -4056,7 +4043,7 @@ static void hb_vmEqual( void ) pItem1->type = HB_IT_LOGICAL; pItem1->item.asLogical.value = fResult; } -/* +#if 0 else if( HB_IS_HASH( pItem1 ) && HB_IS_HASH( pItem2 ) ) { HB_BOOL fResult = pItem1->item.asHash.value == pItem2->item.asHash.value; @@ -4065,7 +4052,7 @@ static void hb_vmEqual( void ) pItem1->type = HB_IT_LOGICAL; pItem1->item.asLogical.value = fResult; } - */ +#endif else if( hb_objOperatorCall( HB_OO_OP_EQUAL, pItem1, pItem1, pItem2, NULL ) ) hb_stackPop(); else @@ -4157,7 +4144,7 @@ static void hb_vmNotEqual( void ) pItem1->type = HB_IT_LOGICAL; pItem1->item.asLogical.value = fResult; } -/* +#if 0 else if( HB_IS_HASH( pItem1 ) && HB_IS_HASH( pItem2 ) ) { HB_BOOL fResult = pItem1->item.asHash.value != pItem2->item.asHash.value; @@ -4166,7 +4153,7 @@ static void hb_vmNotEqual( void ) pItem1->type = HB_IT_LOGICAL; pItem1->item.asLogical.value = fResult; } - */ +#endif else if( hb_objOperatorCall( HB_OO_OP_NOTEQUAL, pItem1, pItem1, pItem2, NULL ) ) hb_stackPop(); else @@ -4636,13 +4623,13 @@ static void hb_vmWithObjectStart( void ) } /* - * Relase enumerator items - called from hb_itemClear() + * Release enumerator items - called from hb_itemClear() */ void hb_vmEnumRelease( PHB_ITEM pBase, PHB_ITEM pValue ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_vmEnumRelease(%p,%p)", pBase, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmEnumRelease(%p,%p)", ( void * ) pBase, ( void * ) pValue ) ); if( pValue ) hb_itemRelease( pValue ); @@ -4723,7 +4710,7 @@ static void hb_vmEnumReference( PHB_ITEM pBase ) PHB_ENUMREF pEnumExtRef; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmEnumReference(%p)", pBase ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmEnumReference(%p)", ( void * ) pBase ) ); pEnumExtRef = ( PHB_ENUMREF ) hb_xgrab( sizeof( HB_ENUMREF ) ); pEnumExtRef->oldvalue.type = HB_IT_NIL; @@ -4745,14 +4732,14 @@ static void hb_vmEnumStart( int nVars, int nDescend ) HB_BOOL fStart = HB_TRUE; int i; -/* +#if 0 pItem = hb_itemUnRef( hb_stackItemFromTop( -( ( int ) nVars << 1 ) ) ); if( ( pItem->type & ( HB_IT_ARRAY | HB_IT_HASH | HB_IT_STRING ) ) == 0 ) { hb_errRT_BASE( EG_ARG, 1068, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 1, pItem ); return; } - */ +#endif for( i = ( int ) nVars << 1; i > 0 && fStart; i -= 2 ) { @@ -4850,11 +4837,12 @@ static void hb_vmEnumStart( int nVars, int nDescend ) static void hb_vmEnumNext( void ) { HB_STACK_TLS_PRELOAD - PHB_ITEM pEnumRef, pEnum, pBase; int i; for( i = ( int ) hb_stackItemFromTop( -1 )->item.asInteger.value; i > 0; --i ) { + PHB_ITEM pEnumRef, pEnum, pBase; + pEnumRef = hb_stackItemFromTop( -( i << 1 ) ); pEnum = hb_itemUnRefOnce( pEnumRef ); pBase = pEnum->item.asEnum.basePtr; @@ -4930,11 +4918,12 @@ static void hb_vmEnumNext( void ) static void hb_vmEnumPrev( void ) { HB_STACK_TLS_PRELOAD - PHB_ITEM pEnumRef, pEnum, pBase; int i; for( i = hb_stackItemFromTop( -1 )->item.asInteger.value; i > 0; --i ) { + PHB_ITEM pEnumRef, pEnum, pBase; + pEnumRef = hb_stackItemFromTop( -( i << 1 ) ); pEnum = hb_itemUnRefOnce( pEnumRef ); pBase = pEnum->item.asEnum.basePtr; @@ -5493,7 +5482,6 @@ static void hb_vmArrayGen( HB_SIZE nElements ) /* generates an nElements Array a { HB_STACK_TLS_PRELOAD PHB_ITEM pArray; - HB_SIZE nPos; HB_TRACE( HB_TR_DEBUG, ( "hb_vmArrayGen(%" HB_PFS "u)", nElements ) ); @@ -5503,6 +5491,7 @@ static void hb_vmArrayGen( HB_SIZE nElements ) /* generates an nElements Array a if( nElements ) { + HB_SIZE nPos; /* move items from HVM stack to created array */ for( nPos = 0; nPos < nElements; nPos++ ) { @@ -5527,7 +5516,7 @@ static HB_BOOL hb_vmArrayNew( PHB_ITEM pArray, HB_USHORT uiDimension ) HB_ISIZ nElements; PHB_ITEM pDim; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmArrayNew(%p, %hu)", pArray, uiDimension ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmArrayNew(%p, %hu)", ( void * ) pArray, uiDimension ) ); pDim = hb_stackItemFromTop( ( int ) ( -1 - uiDimension ) ); @@ -5680,7 +5669,7 @@ static void hb_vmMacroPushIndex( void ) static HB_LONG hb_vmArgsJoin( HB_LONG lLevel, HB_USHORT uiArgSets ) { HB_STACK_TLS_PRELOAD - HB_LONG lArgs, lRestArgs, lOffset; + HB_LONG lArgs; PHB_ITEM pArgs = hb_stackItemFromTop( lLevel ) ; lArgs = hb_itemGetNL( pArgs ); @@ -5689,6 +5678,8 @@ static HB_LONG hb_vmArgsJoin( HB_LONG lLevel, HB_USHORT uiArgSets ) if( --uiArgSets ) { + HB_LONG lRestArgs, lOffset; + lRestArgs = lArgs; lArgs += hb_vmArgsJoin( lLevel - lArgs - 1, uiArgSets ); lOffset = lLevel - lRestArgs - uiArgSets; @@ -5777,7 +5768,7 @@ static void hb_vmPushVParams( void ) static void hb_vmPushAParams( void ) { HB_STACK_TLS_PRELOAD - PHB_ITEM pArray, pCount; + PHB_ITEM pArray; HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushAParams()" ) ); @@ -5788,6 +5779,7 @@ static void hb_vmPushAParams( void ) if( nLen ) { + PHB_ITEM pCount; HB_SIZE nPos; for( nPos = 1; nPos < nLen; ++nPos ) hb_vmPush( pArray->item.asArray.value->pItems + nPos ); @@ -5813,7 +5805,7 @@ static HB_ERRCODE hb_vmSelectWorkarea( PHB_ITEM pAlias, PHB_SYMB pField ) HB_ERRCODE errCode; HB_BOOL fRepeat; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmSelectWorkArea(%p,%p)", pAlias, pField ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmSelectWorkArea(%p,%p)", ( void * ) pAlias, ( void * ) pField ) ); /* NOTE: Clipper doesn't generate an error if an workarea specified * as numeric value cannot be selected @@ -5915,7 +5907,7 @@ static HB_ERRCODE hb_vmSelectWorkarea( PHB_ITEM pAlias, PHB_SYMB pField ) return errCode; } -/* Swaps two last items on the eval stack - the last item after swaping +/* Swaps two last items on the eval stack - the last item after swapping * is popped as current workarea number */ static void hb_vmSwapAlias( void ) @@ -6242,7 +6234,7 @@ PHB_ITEM hb_vmEvalBlock( PHB_ITEM pBlock ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_vmEvalBlock(%p)", pBlock ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmEvalBlock(%p)", ( void * ) pBlock ) ); hb_vmPushEvalSym(); hb_vmPush( pBlock ); @@ -6264,7 +6256,7 @@ PHB_ITEM hb_vmEvalBlockV( PHB_ITEM pBlock, HB_ULONG ulArgCount, ... ) va_list va; HB_ULONG i; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmEvalBlockV(%p, %lu, ...)", pBlock, ulArgCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmEvalBlockV(%p, %lu, ...)", ( void * ) pBlock, ulArgCount ) ); hb_vmPushEvalSym(); hb_vmPush( pBlock ); @@ -6287,7 +6279,7 @@ PHB_ITEM hb_vmEvalBlockOrMacro( PHB_ITEM pItem ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_vmEvalBlockOrMacro(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmEvalBlockOrMacro(%p)", ( void * ) pItem ) ); if( HB_IS_BLOCK( pItem ) ) { @@ -6553,15 +6545,15 @@ static void hb_vmSFrame( PHB_SYMB pSym ) /* sets the statics frame for a fu { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_vmSFrame(%p)", pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmSFrame(%p)", ( void * ) pSym ) ); /* _INITSTATICS is now the statics frame. Statics() changed it! */ hb_stackSetStaticsBase( pSym->value.pStaticsBase ); } -static void hb_vmStatics( PHB_SYMB pSym, HB_USHORT uiStatics ) /* initializes the global aStatics array or redimensionates it */ +static void hb_vmStatics( PHB_SYMB pSym, HB_USHORT uiStatics ) /* initializes the global aStatics array or redimensions it */ { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmStatics(%p, %hu)", pSym, uiStatics ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmStatics(%p, %hu)", ( void * ) pSym, uiStatics ) ); /* statics frame for this PRG */ pSym->value.pStaticsBase = ( void * ) hb_itemArrayNew( uiStatics ); @@ -6656,7 +6648,7 @@ static void hb_vmTSVReference( PHB_ITEM pStatic ) PHB_TSVREF pTSVRef; PHB_ITEM pRefer; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmTSVReference(%p)", pStatic ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmTSVReference(%p)", ( void * ) pStatic ) ); pTSVRef = ( PHB_TSVREF ) hb_xgrab( sizeof( HB_TSVREF ) ); @@ -6679,7 +6671,7 @@ static void hb_vmInitThreadStatics( HB_USHORT uiCount, const HB_BYTE * pCode ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_vmInitThreadStatics(%hu,%p)", uiCount, pCode ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmInitThreadStatics(%hu,%p)", uiCount, ( const void * ) pCode ) ); while( uiCount-- ) { @@ -6692,7 +6684,7 @@ static void hb_vmInitThreadStatics( HB_USHORT uiCount, const HB_BYTE * pCode ) #else static void hb_vmInitThreadStatics( HB_USHORT uiCount, const HB_BYTE * pCode ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmInitThreadStatics(%hu,%p)", uiCount, pCode ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmInitThreadStatics(%hu,%p)", uiCount, ( const void * ) pCode ) ); /* single thread VM - do nothing, use normal static variables */ @@ -6709,7 +6701,7 @@ void hb_vmPush( PHB_ITEM pItem ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPush(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPush(%p)", ( void * ) pItem ) ); hb_itemCopy( hb_stackAllocItem(), pItem ); } @@ -6936,7 +6928,7 @@ void hb_vmPushPointer( void * pPointer ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem = hb_stackAllocItem(); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushPointer(%p)", pPointer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushPointer(%p)", ( void * ) pPointer ) ); pItem->type = HB_IT_POINTER; pItem->item.asPointer.value = pPointer; @@ -6949,7 +6941,7 @@ void hb_vmPushPointerGC( void * pPointer ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem = hb_stackAllocItem(); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushPointerGC(%p)", pPointer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushPointerGC(%p)", ( void * ) pPointer ) ); pItem->type = HB_IT_POINTER; pItem->item.asPointer.value = pPointer; @@ -6987,7 +6979,7 @@ void hb_vmPushSymbol( PHB_SYMB pSym ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem = hb_stackAllocItem(); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushSymbol(%p)", pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushSymbol(%p)", ( void * ) pSym ) ); pItem->type = HB_IT_SYMBOL; pItem->item.asSymbol.value = pSym; @@ -6999,7 +6991,7 @@ void hb_vmPushDynSym( PHB_DYNS pDynSym ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem = hb_stackAllocItem(); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushDynSym(%p)", pDynSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushDynSym(%p)", ( void * ) pDynSym ) ); pItem->type = HB_IT_SYMBOL; pItem->item.asSymbol.value = pDynSym->pSymbol; @@ -7032,7 +7024,7 @@ static void hb_vmPushBlock( const HB_BYTE * pCode, PHB_SYMB pSymbols, HB_SIZE nL HB_USHORT uiLocals; PHB_ITEM pItem = hb_stackAllocItem(); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushBlock(%p,%p,%" HB_PFS "u)", pCode, pSymbols, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushBlock(%p,%p,%" HB_PFS "u)", ( const void * ) pCode, ( void * ) pSymbols, nLen ) ); uiLocals = HB_PCODE_MKUSHORT( &pCode[ 2 ] ); @@ -7068,7 +7060,7 @@ static void hb_vmPushBlockShort( const HB_BYTE * pCode, PHB_SYMB pSymbols, HB_SI HB_STACK_TLS_PRELOAD PHB_ITEM pItem = hb_stackAllocItem(); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushBlockShort(%p,%p,%" HB_PFS "u)", pCode, pSymbols, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushBlockShort(%p,%p,%" HB_PFS "u)", ( const void * ) pCode, ( void * ) pSymbols, nLen ) ); pItem->item.asBlock.value = hb_codeblockNew( pCode, /* pcode buffer */ @@ -7101,7 +7093,7 @@ static void hb_vmPushMacroBlock( const HB_BYTE * pCode, HB_SIZE nSize, HB_USHORT HB_STACK_TLS_PRELOAD PHB_ITEM pItem = hb_stackAllocItem(); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushMacroBlock(%p,%" HB_PFS "u,%hu)", pCode, nSize, usParams ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushMacroBlock(%p,%" HB_PFS "u,%hu)", ( const void * ) pCode, nSize, usParams ) ); pItem->item.asBlock.value = hb_codeblockMacroNew( pCode, nSize ); pItem->type = HB_IT_BLOCK; @@ -7140,13 +7132,13 @@ static void hb_vmPushAliasedField( PHB_SYMB pSym ) PHB_ITEM pAlias; int iCurrArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushAliasedField(%p)", pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushAliasedField(%p)", ( void * ) pSym ) ); iCurrArea = hb_rddGetCurrentWorkAreaNumber(); pAlias = hb_stackItemFromTop( -1 ); /* - * NOTE: hb_vmSelecWorkarea clears passed item + * NOTE: hb_vmSelectWorkarea() clears passed item */ if( hb_vmSelectWorkarea( pAlias, pSym ) == HB_SUCCESS ) hb_rddGetFieldValue( pAlias, pSym ); @@ -7165,7 +7157,7 @@ static void hb_vmPushAliasedVar( PHB_SYMB pSym ) HB_STACK_TLS_PRELOAD PHB_ITEM pAlias = hb_stackItemFromTop( -1 ); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushAliasedVar(%p)", pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushAliasedVar(%p)", ( void * ) pSym ) ); if( HB_IS_STRING( pAlias ) ) { @@ -7417,14 +7409,14 @@ static void hb_vmPopAliasedField( PHB_SYMB pSym ) HB_STACK_TLS_PRELOAD int iCurrArea; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPopAliasedField(%p)", pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPopAliasedField(%p)", ( void * ) pSym ) ); iCurrArea = hb_rddGetCurrentWorkAreaNumber(); if( hb_vmSelectWorkarea( hb_stackItemFromTop( -1 ), pSym ) == HB_SUCCESS ) hb_rddPutFieldValue( hb_stackItemFromTop( -2 ), pSym ); hb_rddSelectWorkAreaNumber( iCurrArea ); - hb_stackDec(); /* alias - it was cleared in hb_vmSelectWorkarea */ + hb_stackDec(); /* alias - it was cleared in hb_vmSelectWorkarea() */ hb_stackPop(); /* field value */ } @@ -7438,7 +7430,7 @@ static void hb_vmPopAliasedVar( PHB_SYMB pSym ) HB_STACK_TLS_PRELOAD PHB_ITEM pAlias = hb_stackItemFromTop( -1 ); - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPopAliasedVar(%p)", pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPopAliasedVar(%p)", ( void * ) pSym ) ); /* * "M", "MEMV" - "MEMVAR" and "FIEL" - "FIELD" are reserved aliases @@ -7522,7 +7514,7 @@ static void hb_vmPopStatic( HB_USHORT uiStatic ) hb_stackDec(); } -/* ----------------------------------------------- */ +/* ------------------------------- */ /* * Functions to manage module symbols */ @@ -7582,10 +7574,10 @@ HB_BOOL hb_vmFindModuleSymbols( PHB_SYMB pSym, PHB_SYMB * pSymbols, { PHB_SYMBOLS pLastSymbols = s_pSymbols; -/* +#if 0 if( pSym->scope.value & HB_FS_PCODEFUNC ) * pSymbols = pSym->value.pCodeFunc->pSymbols; -*/ +#endif while( pLastSymbols ) { @@ -7662,7 +7654,7 @@ static void hb_vmStaticsClear( void ) for( ul = 1; ul <= nLen; ++ul ) { PHB_ITEM pItem = hb_arrayGetItemPtr( pStatics, ul ); - if( HB_IS_COMPLEX( pItem ) ) + if( pItem && HB_IS_COMPLEX( pItem ) ) hb_itemClear( pItem ); } } @@ -7753,7 +7745,7 @@ static PHB_ITEM hb_vmStaticsArray( void ) static PHB_SYMBOLS hb_vmFindFreeModule( PHB_SYMB pSymbols, HB_USHORT uiSymbols, const char * szModuleName, HB_ULONG ulID ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmFindFreeModule(%p,%hu,%s,%lu)", pSymbols, uiSymbols, szModuleName, ulID ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmFindFreeModule(%p,%hu,%s,%lu)", ( void * ) pSymbols, uiSymbols, szModuleName, ulID ) ); if( s_ulFreeSymbols ) { @@ -7796,7 +7788,7 @@ static PHB_SYMBOLS hb_vmFindFreeModule( PHB_SYMB pSymbols, HB_USHORT uiSymbols, void hb_vmFreeSymbols( PHB_SYMBOLS pSymbols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmFreeSymbols(%p)", pSymbols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmFreeSymbols(%p)", ( void * ) pSymbols ) ); if( pSymbols->fActive && hb_vmLockModuleSymbols() ) { @@ -7837,7 +7829,7 @@ void hb_vmBeginSymbolGroup( void * hDynLib, HB_BOOL fClone ) void hb_vmInitSymbolGroup( void * hNewDynLib, int argc, const char * argv[] ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmInitSymbolGroup(%p,%d,%p)", hNewDynLib, argc, argv ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmInitSymbolGroup(%p,%d,%p)", hNewDynLib, argc, ( const void * ) argv ) ); s_fCloneSym = HB_FALSE; @@ -7990,7 +7982,7 @@ PHB_SYMBOLS hb_vmRegisterSymbols( PHB_SYMB pModuleSymbols, HB_USHORT uiSymbols, HB_BOOL fRecycled, fInitStatics = HB_FALSE; HB_USHORT ui; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmRegisterSymbols(%p,%hu,%s,%lu,%d,%d,%d)", pModuleSymbols, uiSymbols, szModuleName, ulID, ( int ) fDynLib, ( int ) fClone, ( int ) fOverLoad ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmRegisterSymbols(%p,%hu,%s,%lu,%d,%d,%d)", ( void * ) pModuleSymbols, uiSymbols, szModuleName, ulID, ( int ) fDynLib, ( int ) fClone, ( int ) fOverLoad ) ); pNewSymbols = s_ulFreeSymbols == 0 ? NULL : hb_vmFindFreeModule( pModuleSymbols, uiSymbols, szModuleName, ulID ); @@ -8074,7 +8066,9 @@ PHB_SYMBOLS hb_vmRegisterSymbols( PHB_SYMB pModuleSymbols, HB_USHORT uiSymbols, hSymScope = pSymbol->scope.value; pNewSymbols->hScope |= hSymScope; - /* fPublic = ( hSymScope & ( HB_FS_PUBLIC | HB_FS_MESSAGE | HB_FS_MEMVAR ) ) != 0; */ +#if 0 + fPublic = ( hSymScope & ( HB_FS_PUBLIC | HB_FS_MESSAGE | HB_FS_MEMVAR ) ) != 0; +#endif fPublic = ( hSymScope & ( HB_FS_INITEXIT | HB_FS_STATIC | HB_FS_FRAME ) ) == 0; if( fStatics ) { @@ -8159,7 +8153,7 @@ static void hb_vmVerifySymbols( PHB_ITEM pArray ) PHB_SYMBOLS pLastSymbols = s_pSymbols; PHB_ITEM pItem = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmVerifySymbols(%p)", pArray ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmVerifySymbols(%p)", ( void * ) pArray ) ); hb_arrayNew( pArray, 0 ); @@ -8212,7 +8206,7 @@ PHB_SYMB hb_vmProcessSymbols( PHB_SYMB pSymbols, HB_USHORT uiModuleSymbols, const char * szModuleName, HB_ULONG ulID, HB_USHORT uiPCodeVer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmProcessSymbols(%p,%hu,%s,%lu,%hu)", pSymbols, uiModuleSymbols, szModuleName, ulID, uiPCodeVer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmProcessSymbols(%p,%hu,%s,%lu,%hu)", ( void * ) pSymbols, uiModuleSymbols, szModuleName, ulID, uiPCodeVer ) ); hb_vmVerifyPCodeVersion( szModuleName, uiPCodeVer ); return hb_vmRegisterSymbols( pSymbols, uiModuleSymbols, szModuleName, ulID, @@ -8224,7 +8218,7 @@ PHB_SYMB hb_vmProcessDynLibSymbols( PHB_SYMB pSymbols, HB_USHORT uiModuleSymbols const char * szModuleName, HB_ULONG ulID, HB_USHORT uiPCodeVer ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmProcessDynLibSymbols(%p,%hu,%s,%lu,%hu)", pSymbols, uiModuleSymbols, szModuleName, ulID, uiPCodeVer ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmProcessDynLibSymbols(%p,%hu,%s,%lu,%hu)", ( void * ) pSymbols, uiModuleSymbols, szModuleName, ulID, uiPCodeVer ) ); hb_vmVerifyPCodeVersion( szModuleName, uiPCodeVer ); return hb_vmRegisterSymbols( pSymbols, uiModuleSymbols, szModuleName, ulID, @@ -8470,7 +8464,7 @@ void hb_vmPushItemRef( PHB_ITEM pItem ) PHB_ITMREF pItmRef; PHB_ITEM pRefer; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushItemRef(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmPushItemRef(%p)", ( void * ) pItem ) ); pItmRef = ( PHB_ITMREF ) hb_xgrab( sizeof( HB_ITMREF ) ); @@ -8630,7 +8624,7 @@ HB_BOOL hb_vmMsgReference( PHB_ITEM pObject, PHB_DYNS pMessage, PHB_DYNS pAccMsg PHB_MSGREF pMsgRef; PHB_ITEM pRefer; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmMsgReference(%p,%p,%p)", pObject, pMessage, pAccMsg ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmMsgReference(%p,%p,%p)", ( void * ) pObject, ( void * ) pMessage, ( void * ) pAccMsg ) ); pMsgRef = ( PHB_MSGREF ) hb_xgrab( sizeof( HB_MSGREF ) ); pMsgRef->access = pAccMsg; @@ -8788,7 +8782,7 @@ static void hb_vmMsgIndexReference( PHB_ITEM pRefer, PHB_ITEM pObject, PHB_ITEM PHB_MSGIDXREF pMsgIdxRef; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmMsgIndexReference(%p,%p,%p)", pRefer, pObject, pIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmMsgIndexReference(%p,%p,%p)", ( void * ) pRefer, ( void * ) pObject, ( void * ) pIndex ) ); pMsgIdxRef = ( PHB_MSGIDXREF ) hb_xgrab( sizeof( HB_MSGIDXREF ) ); pMsgIdxRef->value.type = HB_IT_NIL | HB_IT_DEFAULT; @@ -8836,7 +8830,7 @@ void hb_vmRequestBreak( PHB_ITEM pItem ) HB_STACK_TLS_PRELOAD HB_ISIZ nRecoverBase; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmRequestBreak(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmRequestBreak(%p)", ( void * ) pItem ) ); nRecoverBase = hb_stackGetRecoverBase(); while( nRecoverBase && ( hb_stackItem( nRecoverBase + @@ -8899,14 +8893,14 @@ void hb_vmRequestCancel( void ) char buffer[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 + 10 ]; /* additional 10 bytes for line info (%hu) overhead */ char file[ HB_PATH_MAX ]; HB_USHORT uiLine; - int iLevel = 0, l; + int iLevel = 0; hb_conOutErr( hb_conNewLine(), 0 ); hb_conOutErr( "Cancelled at: ", 0 ); while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) { - l = ( int ) strlen( buffer ); + int l = ( int ) strlen( buffer ); hb_snprintf( buffer + l, sizeof( buffer ) - l, " (%hu)%s%s", uiLine, *file ? HB_I_( " in " ) : "", file ); hb_conOutErr( buffer, 0 ); @@ -8914,7 +8908,7 @@ void hb_vmRequestCancel( void ) } /* - * Clipper does not execute EXIT procedures when quiting using break key + * Clipper does not execute EXIT procedures when quitting using break key */ s_fDoExitProc = HB_FALSE; hb_stackSetActionRequest( HB_QUIT_REQUESTED ); @@ -9089,7 +9083,7 @@ HB_BOOL hb_vmTryEval( PHB_ITEM * pResult, PHB_ITEM pItem, HB_ULONG ulPCount, ... { HB_BOOL fResult; - HB_TRACE( HB_TR_DEBUG, ( "hb_vmTryEval(%p, %p, %lu)", pResult, pItem, ulPCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmTryEval(%p, %p, %lu)", ( void * ) pResult, ( void * ) pItem, ulPCount ) ); fResult = HB_FALSE; *pResult = NULL; @@ -9550,7 +9544,7 @@ HB_BOOL hb_xvmSwitchGet( PHB_ITEM * pSwitchPtr ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmSwitchGet(%p)", pSwitchPtr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmSwitchGet(%p)", ( void * ) pSwitchPtr ) ); *pSwitchPtr = hb_vmSwitchGet(); @@ -9586,7 +9580,7 @@ void hb_xvmVFrame( int iLocals, int iParams ) void hb_xvmSFrame( PHB_SYMB pSymbol ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmSFrame(%p)", pSymbol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmSFrame(%p)", ( void * ) pSymbol ) ); hb_vmSFrame( pSymbol ); } @@ -9669,14 +9663,14 @@ void hb_xvmRetInt( HB_LONG lValue ) void hb_xvmStatics( PHB_SYMB pSymbol, HB_USHORT uiStatics ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmStatics(%p,%hu)", pSymbol, uiStatics ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmStatics(%p,%hu)", ( void * ) pSymbol, uiStatics ) ); hb_vmStatics( pSymbol, uiStatics ); } void hb_xvmThreadStatics( HB_USHORT uiStatics, const HB_BYTE * statics ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmThreadStatics(%hu,%p)", uiStatics, statics ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmThreadStatics(%hu,%p)", uiStatics, ( const void * ) statics ) ); hb_vmInitThreadStatics( uiStatics, statics ); } @@ -9685,7 +9679,7 @@ void hb_xvmParameter( PHB_SYMB pSymbol, int iParams ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmParameter(%p,%d)", pSymbol, iParams ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmParameter(%p,%d)", ( void * ) pSymbol, iParams ) ); hb_memvarNewParameter( pSymbol, hb_stackItemFromBase( iParams ) ); } @@ -9767,7 +9761,7 @@ HB_BOOL hb_xvmPushVariable( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPushVariable(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPushVariable(%p)", ( void * ) pSymbol ) ); hb_vmPushVariable( pSymbol ); @@ -9778,7 +9772,7 @@ HB_BOOL hb_xvmPopVariable( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPopVariable(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPopVariable(%p)", ( void * ) pSymbol ) ); /* See the note above in HB_P_POPVARIABLE */ #if 0 @@ -9794,14 +9788,14 @@ HB_BOOL hb_xvmPopVariable( PHB_SYMB pSymbol ) void hb_xvmPushBlockShort( const HB_BYTE * pCode, PHB_SYMB pSymbols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmPushBlockShort(%p, %p)", pCode, pSymbols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmPushBlockShort(%p, %p)", ( const void * ) pCode, ( void * ) pSymbols ) ); hb_vmPushBlockShort( pCode, pSymbols, HB_FALSE ); } void hb_xvmPushBlock( const HB_BYTE * pCode, PHB_SYMB pSymbols ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmPushBlock(%p, %p)", pCode, pSymbols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmPushBlock(%p, %p)", ( const void * ) pCode, ( void * ) pSymbols ) ); hb_vmPushBlock( pCode, pSymbols, HB_FALSE ); } @@ -9820,7 +9814,7 @@ void hb_xvmPushFuncSymbol( PHB_SYMB pSym ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmPushFuncSymbol(%p)", pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmPushFuncSymbol(%p)", ( void * ) pSym ) ); pItem = hb_stackAllocItem(); pItem->type = HB_IT_SYMBOL; @@ -9833,7 +9827,7 @@ HB_BOOL hb_xvmPopLogical( HB_BOOL * pfValue ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmPopLogical(%p)", pfValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmPopLogical(%p)", ( void * ) pfValue ) ); *pfValue = hb_vmPopLogical(); @@ -9867,7 +9861,7 @@ HB_BOOL hb_xvmPushField( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPushField(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPushField(%p)", ( void * ) pSymbol ) ); hb_rddGetFieldValue( hb_stackAllocItem(), pSymbol ); @@ -9889,7 +9883,7 @@ HB_BOOL hb_xvmPushAliasedField( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPushAliasedField(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPushAliasedField(%p)", ( void * ) pSymbol ) ); hb_vmPushAliasedField( pSymbol ); @@ -9901,7 +9895,7 @@ HB_BOOL hb_xvmPushAliasedFieldExt( PHB_SYMB pAlias, PHB_SYMB pField ) HB_STACK_TLS_PRELOAD int iCurrArea; - HB_TRACE( HB_TR_INFO, ( "hb_xvmPushAliasedFieldExt(%p,%p)", pAlias, pField ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPushAliasedFieldExt(%p,%p)", ( void * ) pAlias, ( void * ) pField ) ); iCurrArea = hb_rddGetCurrentWorkAreaNumber(); if( hb_rddSelectWorkAreaSymbol( pAlias ) == HB_SUCCESS ) @@ -9915,7 +9909,7 @@ HB_BOOL hb_xvmPushAliasedVar( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPushAliasedVar(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPushAliasedVar(%p)", ( void * ) pSymbol ) ); hb_vmPushAliasedVar( pSymbol ); @@ -9926,7 +9920,7 @@ HB_BOOL hb_xvmPopField( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPopField(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPopField(%p)", ( void * ) pSymbol ) ); hb_rddPutFieldValue( hb_stackItemFromTop( -1 ), pSymbol ); hb_stackPop(); @@ -9938,7 +9932,7 @@ HB_BOOL hb_xvmPushMemvar( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPushMemvar(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPushMemvar(%p)", ( void * ) pSymbol ) ); hb_memvarGetValue( hb_stackAllocItem(), pSymbol ); @@ -9949,7 +9943,7 @@ HB_BOOL hb_xvmPushMemvarByRef( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPushMemvarByRef(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPushMemvarByRef(%p)", ( void * ) pSymbol ) ); hb_memvarGetRefer( hb_stackAllocItem(), pSymbol ); @@ -9960,7 +9954,7 @@ HB_BOOL hb_xvmPopMemvar( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPopMemvar(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPopMemvar(%p)", ( void * ) pSymbol ) ); hb_memvarSetValue( pSymbol, hb_stackItemFromTop( -1 ) ); hb_stackPop(); @@ -9972,7 +9966,7 @@ HB_BOOL hb_xvmPopAliasedField( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPopAliasedField(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPopAliasedField(%p)", ( void * ) pSymbol ) ); hb_vmPopAliasedField( pSymbol ); @@ -9984,7 +9978,7 @@ HB_BOOL hb_xvmPopAliasedFieldExt( PHB_SYMB pAlias, PHB_SYMB pField ) HB_STACK_TLS_PRELOAD int iCurrArea; - HB_TRACE( HB_TR_INFO, ( "hb_xvmPopAliasedFieldExt(%p,%p)", pAlias, pField ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPopAliasedFieldExt(%p,%p)", ( void * ) pAlias, ( void * ) pField ) ); iCurrArea = hb_rddGetCurrentWorkAreaNumber(); if( hb_rddSelectWorkAreaSymbol( pAlias ) == HB_SUCCESS ) @@ -10001,7 +9995,7 @@ HB_BOOL hb_xvmPopAliasedVar( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_INFO, ( "hb_xvmPopAliasedVar(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmPopAliasedVar(%p)", ( void * ) pSymbol ) ); hb_vmPopAliasedVar( pSymbol ); @@ -10133,15 +10127,15 @@ HB_BOOL hb_xvmStaticAdd( HB_USHORT uiStatic ) HB_BOOL hb_xvmMemvarAdd( PHB_SYMB pSymbol ) { HB_STACK_TLS_PRELOAD - PHB_ITEM pMemVar, pVal1, pVal2; + PHB_ITEM pVal1, pVal2; - HB_TRACE( HB_TR_INFO, ( "hb_xvmMemvarAdd(%p)", pSymbol ) ); + HB_TRACE( HB_TR_INFO, ( "hb_xvmMemvarAdd(%p)", ( void * ) pSymbol ) ); pVal1 = hb_stackItemFromTop( -2 ); pVal2 = hb_stackItemFromTop( -1 ); if( HB_IS_STRING( pVal1 ) && HB_IS_STRING( pVal2 ) ) { - pMemVar = hb_memvarGetItem( pSymbol ); + PHB_ITEM pMemVar = hb_memvarGetItem( pSymbol ); if( pMemVar ) { hb_vmPlus( pMemVar, pVal1, pVal2 ); @@ -10334,7 +10328,7 @@ HB_BOOL hb_xvmEqualIntIs( HB_LONG lValue, HB_BOOL * pfValue ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmEqualIntIs(%ld,%p)", lValue, pfValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmEqualIntIs(%ld,%p)", lValue, ( void * ) pfValue ) ); pItem = hb_stackItemFromTop( -1 ); if( HB_IS_INTEGER( pItem ) ) @@ -10463,7 +10457,7 @@ HB_BOOL hb_xvmNotEqualIntIs( HB_LONG lValue, HB_BOOL * pfValue ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmNotEqualIntIs(%ld,%p)", lValue, pfValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmNotEqualIntIs(%ld,%p)", lValue, ( void * ) pfValue ) ); pItem = hb_stackItemFromTop( -1 ); if( HB_IS_INTEGER( pItem ) ) @@ -10587,7 +10581,7 @@ HB_BOOL hb_xvmLessThenIntIs( HB_LONG lValue, HB_BOOL * pfValue ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmLessThenIntIs(%ld,%p)", lValue, pfValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmLessThenIntIs(%ld,%p)", lValue, ( void * ) pfValue ) ); pItem = hb_stackItemFromTop( -1 ); if( HB_IS_INTEGER( pItem ) ) @@ -10706,7 +10700,7 @@ HB_BOOL hb_xvmLessEqualThenIntIs( HB_LONG lValue, HB_BOOL * pfValue ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmLessEqualThenIntIs(%ld,%p)", lValue, pfValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmLessEqualThenIntIs(%ld,%p)", lValue, ( void * ) pfValue ) ); pItem = hb_stackItemFromTop( -1 ); if( HB_IS_INTEGER( pItem ) ) @@ -10825,7 +10819,7 @@ HB_BOOL hb_xvmGreaterThenIntIs( HB_LONG lValue, HB_BOOL * pfValue ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmGreaterThenIntIs(%ld,%p)", lValue, pfValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmGreaterThenIntIs(%ld,%p)", lValue, ( void * ) pfValue ) ); pItem = hb_stackItemFromTop( -1 ); if( HB_IS_INTEGER( pItem ) ) @@ -10944,7 +10938,7 @@ HB_BOOL hb_xvmGreaterEqualThenIntIs( HB_LONG lValue, HB_BOOL * pfValue ) HB_STACK_TLS_PRELOAD PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmGreaterEqualThenIntIs(%ld,%p)", lValue, pfValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmGreaterEqualThenIntIs(%ld,%p)", lValue, ( void * ) pfValue ) ); pItem = hb_stackItemFromTop( -1 ); if( HB_IS_INTEGER( pItem ) ) @@ -12024,7 +12018,7 @@ void hb_xvmWithObjectMessage( PHB_SYMB pSymbol ) HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_xvmWithObjectMessage(%p)", pSymbol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_xvmWithObjectMessage(%p)", ( void * ) pSymbol ) ); if( pSymbol ) hb_vmPushSymbol( pSymbol ); @@ -12069,7 +12063,7 @@ HB_DBGENTRY_FUNC hb_dbg_SetEntry( HB_DBGENTRY_FUNC pFunDbgEntry ) { HB_DBGENTRY_FUNC pPrevFunc; - HB_TRACE( HB_TR_DEBUG, ( "hb_dbg_SetEntry(%p)", pFunDbgEntry ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_dbg_SetEntry(%p)", ( void * ) pFunDbgEntry ) ); #ifndef HB_NO_DEBUG pPrevFunc = s_pFunDbgEntry; @@ -12286,7 +12280,7 @@ void hb_vmIsStackRef( void ) void hb_vmUpdateAllocator( PHB_ALLOCUPDT_FUNC pFunc, int iCount ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_vmUpdateAllocator(%p, %d)", pFunc, iCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_vmUpdateAllocator(%p, %d)", ( void * ) pFunc, iCount ) ); #if defined( HB_MT_VM ) if( s_vmStackLst ) diff --git a/src/vm/hvmall.c b/src/vm/hvmall.c index 3adbd1566a..d76a24ba81 100644 --- a/src/vm/hvmall.c +++ b/src/vm/hvmall.c @@ -1,6 +1,6 @@ /* - * common file with all HVM functions for compilers which can improve - * speed automatically inlining functions + * Common file with all HVM functions for compilers which can improve + * speed automatically inlining functions * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -66,10 +66,10 @@ /* For Linux and mremap() function */ #ifndef _GNU_SOURCE -# define _GNU_SOURCE +#define _GNU_SOURCE #endif -/* warning the order of included files is important +/* Warning: the order of included files is important * due to macros used to overload some functions */ diff --git a/src/vm/initexit.c b/src/vm/initexit.c index 418496cfc3..44a59d233f 100644 --- a/src/vm/initexit.c +++ b/src/vm/initexit.c @@ -5,11 +5,6 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * diff --git a/src/vm/initsymb.c b/src/vm/initsymb.c index c5c8a10acf..4902b83c31 100644 --- a/src/vm/initsymb.c +++ b/src/vm/initsymb.c @@ -184,5 +184,5 @@ void hb_vmSymbolInit_RT( void ) { HB_TRACE( HB_TR_DEBUG, ( "hb_vmSymbolInit_RT()" ) ); - hb_vmProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ), "initsymb.c", 0, 0 ); + hb_vmProcessSymbols( symbols, HB_SIZEOFARRAY( symbols ), "", 0, 0 ); } diff --git a/src/vm/itemapi.c b/src/vm/itemapi.c index 2312c8185e..1cf763c61c 100644 --- a/src/vm/itemapi.c +++ b/src/vm/itemapi.c @@ -2,6 +2,15 @@ * The Item API * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) + * hb_itemPCount(), hb_itemParamPtr(), hb_itemReturnPtr() + * hb_itemPutDL(), hb_itemPutNI(), hb_itemGetDL(), hb_itemGetNI(), + * hb_itemGetCPtr(), hb_itemPutCLPtr(), hb_itemGetCLen(), hb_itemGetNLen() + * hb_itemPutCConst(), hb_itemPutCLConst() + * hb_itemPutNLen(), hb_itemPutNDLen(), hb_itemPutNILen(), hb_itemPutNLLen() + * hb_itemPutD(), hb_itemSetCMemo() + * Copyright 1999 Eddie Runia <eddie@runia.com> (hb_itemStrCmp()) + * Copyright 1999 David G. Holm <dholm@jsd-llc.com> (hb_itemStr(), hb_itemString(), hb_itemValToStr()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,40 +53,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour) - * hb_itemPCount() - * hb_itemParamPtr() - * hb_itemReturnPtr() - * hb_itemPutDL() - * hb_itemPutNI() - * hb_itemGetDL() - * hb_itemGetNI() - * hb_itemGetCPtr() - * hb_itemGetCLPtr() - * hb_itemGetCLen() - * hb_itemGetNLen() - * hb_itemPutCConst() - * hb_itemPutCLConst() - * hb_itemPutNLen() - * hb_itemPutNDLen() - * hb_itemPutNILen() - * hb_itemPutNLLen() - * hb_itemPutD() - * hb_itemSetCMemo() - * - * Copyright 1999 Eddie Runia <eddie@runia.com> - * hb_itemStrCmp() - * - * Copyright 1999 David G. Holm <dholm@jsd-llc.com> - * hb_itemStr(), hb_itemString(), and hb_itemValToStr(). - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbvmopt.h" /* hbfloat.h have to be included before other header files */ #include "hbfloat.h" @@ -94,7 +69,7 @@ PHB_ITEM hb_itemNew( PHB_ITEM pNull ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemNew(%p)", pNull ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemNew(%p)", ( void * ) pNull ) ); return hb_gcGripGet( pNull ); } @@ -117,7 +92,7 @@ PHB_ITEM hb_itemParamPtr( HB_USHORT uiParam, long lMask ) HB_BOOL hb_itemParamStore( HB_USHORT uiParam, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemParamStore(%hu, %p)", uiParam, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemParamStore(%hu, %p)", uiParam, ( void * ) pItem ) ); if( hb_param( uiParam, HB_IT_BYREF ) ) { @@ -136,7 +111,7 @@ HB_BOOL hb_itemParamStore( HB_USHORT uiParam, PHB_ITEM pItem ) HB_BOOL hb_itemParamStoreForward( HB_USHORT uiParam, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemParamStoreForward(%hu, %p)", uiParam, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemParamStoreForward(%hu, %p)", uiParam, ( void * ) pItem ) ); if( hb_param( uiParam, HB_IT_BYREF ) ) { @@ -155,7 +130,7 @@ HB_BOOL hb_itemParamStoreForward( HB_USHORT uiParam, PHB_ITEM pItem ) HB_BOOL hb_itemParamStoreRelease( HB_USHORT uiParam, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemParamStoreRelease(%hu, %p)", uiParam, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemParamStoreRelease(%hu, %p)", uiParam, ( void * ) pItem ) ); if( hb_param( uiParam, HB_IT_BYREF ) ) { @@ -186,7 +161,7 @@ HB_USHORT hb_itemPCount( void ) HB_BOOL hb_itemRelease( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemRelease(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemRelease(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -214,7 +189,7 @@ PHB_ITEM hb_itemArrayGet( PHB_ITEM pArray, HB_SIZE nIndex ) { PHB_ITEM pItem; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemArrayGet(%p, %" HB_PFS "u)", pArray, nIndex ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemArrayGet(%p, %" HB_PFS "u)", ( void * ) pArray, nIndex ) ); pItem = hb_itemNew( NULL ); @@ -226,7 +201,7 @@ PHB_ITEM hb_itemArrayGet( PHB_ITEM pArray, HB_SIZE nIndex ) PHB_ITEM hb_itemArrayPut( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemArrayPut(%p, %" HB_PFS "u, %p)", pArray, nIndex, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemArrayPut(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( void * ) pItem ) ); if( pArray ) hb_arraySet( pArray, nIndex, pItem ); @@ -236,7 +211,7 @@ PHB_ITEM hb_itemArrayPut( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem ) PHB_ITEM hb_itemPutNil( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNil(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNil(%p)", ( void * ) pItem ) ); if( pItem ) hb_itemSetNil( pItem ); @@ -250,7 +225,7 @@ PHB_ITEM hb_itemPutC( PHB_ITEM pItem, const char * szText ) { HB_SIZE nLen, nAlloc; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutC(%p, %s)", pItem, szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutC(%p, %s)", ( void * ) pItem, szText ) ); nLen = szText ? strlen( szText ) : 0; if( nLen <= 1 ) @@ -285,7 +260,7 @@ PHB_ITEM hb_itemPutCL( PHB_ITEM pItem, const char * szText, HB_SIZE nLen ) HB_SIZE nAlloc; char * szValue; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCL(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) nLen, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCL(%p, %.*s, %" HB_PFS "u)", ( void * ) pItem, ( int ) nLen, szText, nLen ) ); if( nLen <= 1 ) { @@ -323,7 +298,7 @@ PHB_ITEM hb_itemPutCConst( PHB_ITEM pItem, const char * szText ) { HB_SIZE nLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCConst(%p, %s)", pItem, szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCConst(%p, %s)", ( void * ) pItem, szText ) ); if( pItem ) { @@ -346,7 +321,7 @@ PHB_ITEM hb_itemPutCConst( PHB_ITEM pItem, const char * szText ) PHB_ITEM hb_itemPutCLConst( PHB_ITEM pItem, const char * szText, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCLConst(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) nLen, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCLConst(%p, %.*s, %" HB_PFS "u)", ( void * ) pItem, ( int ) nLen, szText, nLen ) ); if( pItem ) { @@ -374,7 +349,7 @@ PHB_ITEM hb_itemPutCPtr( PHB_ITEM pItem, char * szText ) { HB_SIZE nLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCPtr(%p, %s)", pItem, szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCPtr(%p, %s)", ( void * ) pItem, szText ) ); if( pItem ) { @@ -406,7 +381,7 @@ PHB_ITEM hb_itemPutCPtr( PHB_ITEM pItem, char * szText ) PHB_ITEM hb_itemPutCLPtr( PHB_ITEM pItem, char * szText, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCLPtr(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) nLen, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCLPtr(%p, %.*s, %" HB_PFS "u)", ( void * ) pItem, ( int ) nLen, szText, nLen ) ); if( pItem ) { @@ -444,7 +419,7 @@ void hb_itemSetCMemo( PHB_ITEM pItem ) char * hb_itemGetC( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetC(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetC(%p)", ( void * ) pItem ) ); if( pItem && HB_IS_STRING( pItem ) ) { @@ -463,7 +438,7 @@ char * hb_itemGetC( PHB_ITEM pItem ) const char * hb_itemGetCPtr( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetCPtr(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetCPtr(%p)", ( void * ) pItem ) ); if( pItem && HB_IS_STRING( pItem ) ) return pItem->item.asString.value; @@ -473,7 +448,7 @@ const char * hb_itemGetCPtr( PHB_ITEM pItem ) HB_SIZE hb_itemGetCLen( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetCLen(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetCLen(%p)", ( void * ) pItem ) ); if( pItem && HB_IS_STRING( pItem ) ) return pItem->item.asString.length; @@ -483,7 +458,7 @@ HB_SIZE hb_itemGetCLen( PHB_ITEM pItem ) HB_SIZE hb_itemCopyC( PHB_ITEM pItem, char * szBuffer, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyC(%p, %s, %" HB_PFS "u)", pItem, szBuffer, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyC(%p, %s, %" HB_PFS "u)", ( void * ) pItem, szBuffer, nLen ) ); if( pItem && HB_IS_STRING( pItem ) ) { @@ -520,7 +495,7 @@ HB_BOOL hb_itemFreeC( char * szText ) char * hb_itemGetDS( PHB_ITEM pItem, char * szDate ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetDS(%p, %p)", pItem, szDate ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetDS(%p, %p)", ( void * ) pItem, ( void * ) szDate ) ); if( pItem && HB_IS_DATETIME( pItem ) ) return hb_dateDecStr( szDate, pItem->item.asDateTime.julian ); @@ -530,7 +505,7 @@ char * hb_itemGetDS( PHB_ITEM pItem, char * szDate ) long hb_itemGetDL( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetDL(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetDL(%p)", ( void * ) pItem ) ); if( pItem && HB_IS_DATETIME( pItem ) ) return pItem->item.asDateTime.julian; @@ -544,7 +519,7 @@ long hb_itemGetDL( PHB_ITEM pItem ) */ char * hb_itemGetTS( PHB_ITEM pItem, char * szDateTime ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetTS(%p, %s)", pItem, szDateTime ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetTS(%p, %s)", ( void * ) pItem, szDateTime ) ); if( pItem && HB_IS_DATETIME( pItem ) ) return hb_timeStampStrRawPut( szDateTime, pItem->item.asDateTime.julian, @@ -555,7 +530,7 @@ char * hb_itemGetTS( PHB_ITEM pItem, char * szDateTime ) double hb_itemGetTD( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetTD(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetTD(%p)", ( void * ) pItem ) ); if( pItem && HB_IS_DATETIME( pItem ) ) return hb_timeStampPackDT( pItem->item.asDateTime.julian, @@ -566,7 +541,7 @@ double hb_itemGetTD( PHB_ITEM pItem ) HB_BOOL hb_itemGetTDT( PHB_ITEM pItem, long * plJulian, long * plMilliSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetTDT(%p,%p,%p)", pItem, plJulian, plMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetTDT(%p,%p,%p)", ( void * ) pItem, ( void * ) plJulian, ( void * ) plMilliSec ) ); if( pItem && HB_IS_DATETIME( pItem ) ) { @@ -583,7 +558,7 @@ HB_BOOL hb_itemGetTDT( PHB_ITEM pItem, long * plJulian, long * plMilliSec ) HB_BOOL hb_itemGetL( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetL(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetL(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -605,7 +580,7 @@ HB_BOOL hb_itemGetL( PHB_ITEM pItem ) HB_BOOL hb_itemGetLX( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetLX(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetLX(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -634,7 +609,7 @@ HB_BOOL hb_itemGetLX( PHB_ITEM pItem ) double hb_itemGetND( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetND(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetND(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -653,7 +628,7 @@ double hb_itemGetND( PHB_ITEM pItem ) int hb_itemGetNI( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNI(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNI(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -672,7 +647,7 @@ int hb_itemGetNI( PHB_ITEM pItem ) long hb_itemGetNL( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNL(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNL(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -691,7 +666,7 @@ long hb_itemGetNL( PHB_ITEM pItem ) HB_ISIZ hb_itemGetNS( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNS(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNS(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -710,7 +685,7 @@ HB_ISIZ hb_itemGetNS( PHB_ITEM pItem ) HB_MAXINT hb_itemGetNInt( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNL(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNL(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -730,7 +705,7 @@ HB_MAXINT hb_itemGetNInt( PHB_ITEM pItem ) #ifndef HB_LONG_LONG_OFF HB_LONGLONG hb_itemGetNLL( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNL(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNL(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -750,7 +725,7 @@ HB_LONGLONG hb_itemGetNLL( PHB_ITEM pItem ) void * hb_itemGetPtr( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetPtr(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetPtr(%p)", ( void * ) pItem ) ); if( pItem && HB_IS_POINTER( pItem ) ) return pItem->item.asPointer.value; @@ -760,7 +735,7 @@ void * hb_itemGetPtr( PHB_ITEM pItem ) void * hb_itemGetPtrGC( PHB_ITEM pItem, const HB_GC_FUNCS * pFuncs ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetPtrGC(%p,%p)", pItem, pFuncs ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetPtrGC(%p,%p)", ( void * ) pItem, ( const void * ) pFuncs ) ); if( pItem && HB_IS_POINTER( pItem ) && pItem->item.asPointer.collect && @@ -772,7 +747,7 @@ void * hb_itemGetPtrGC( PHB_ITEM pItem, const HB_GC_FUNCS * pFuncs ) PHB_SYMB hb_itemGetSymbol( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetSymbol(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetSymbol(%p)", ( void * ) pItem ) ); if( pItem && HB_IS_SYMBOL( pItem ) ) return pItem->item.asSymbol.value; @@ -782,7 +757,7 @@ PHB_SYMB hb_itemGetSymbol( PHB_ITEM pItem ) PHB_ITEM hb_itemReturn( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemReturn(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemReturn(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -795,7 +770,7 @@ PHB_ITEM hb_itemReturn( PHB_ITEM pItem ) PHB_ITEM hb_itemReturnForward( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemReturnForward(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemReturnForward(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -808,7 +783,7 @@ PHB_ITEM hb_itemReturnForward( PHB_ITEM pItem ) void hb_itemReturnRelease( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemReturnRelease(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemReturnRelease(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -821,7 +796,7 @@ void hb_itemReturnRelease( PHB_ITEM pItem ) PHB_ITEM hb_itemPutDS( PHB_ITEM pItem, const char * szDate ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutDS(%p, %.8s)", pItem, szDate ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutDS(%p, %.8s)", ( void * ) pItem, szDate ) ); if( pItem ) { @@ -840,7 +815,7 @@ PHB_ITEM hb_itemPutDS( PHB_ITEM pItem, const char * szDate ) PHB_ITEM hb_itemPutD( PHB_ITEM pItem, int iYear, int iMonth, int iDay ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutD(%p, %04i, %02i, %02i)", pItem, iYear, iMonth, iDay ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutD(%p, %04i, %02i, %02i)", ( void * ) pItem, iYear, iMonth, iDay ) ); if( pItem ) { @@ -859,7 +834,7 @@ PHB_ITEM hb_itemPutD( PHB_ITEM pItem, int iYear, int iMonth, int iDay ) PHB_ITEM hb_itemPutDL( PHB_ITEM pItem, long lJulian ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutDL(%p, %ld)", pItem, lJulian ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutDL(%p, %ld)", ( void * ) pItem, lJulian ) ); if( pItem ) { @@ -878,7 +853,7 @@ PHB_ITEM hb_itemPutDL( PHB_ITEM pItem, long lJulian ) PHB_ITEM hb_itemPutTS( PHB_ITEM pItem, const char * szDateTime ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutTS(%p, %s)", pItem, szDateTime ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutTS(%p, %s)", ( void * ) pItem, szDateTime ) ); if( pItem ) { @@ -899,7 +874,7 @@ PHB_ITEM hb_itemPutTD( PHB_ITEM pItem, double dTimeStamp ) { long lJulian, lMilliSec; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutTD(%p, %lf)", pItem, dTimeStamp ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutTD(%p, %lf)", ( void * ) pItem, dTimeStamp ) ); if( pItem ) { @@ -919,7 +894,7 @@ PHB_ITEM hb_itemPutTD( PHB_ITEM pItem, double dTimeStamp ) PHB_ITEM hb_itemPutTDT( PHB_ITEM pItem, long lJulian, long lMilliSec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutTDT(%p, %ld, %ld)", pItem, lJulian, lMilliSec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutTDT(%p, %ld, %ld)", ( void * ) pItem, lJulian, lMilliSec ) ); if( pItem ) { @@ -938,7 +913,7 @@ PHB_ITEM hb_itemPutTDT( PHB_ITEM pItem, long lJulian, long lMilliSec ) PHB_ITEM hb_itemPutL( PHB_ITEM pItem, HB_BOOL bValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutL(%p, %d)", pItem, ( int ) bValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutL(%p, %d)", ( void * ) pItem, ( int ) bValue ) ); if( pItem ) { @@ -958,7 +933,7 @@ PHB_ITEM hb_itemPutND( PHB_ITEM pItem, double dNumber ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutND(%p, %lf)", pItem, dNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutND(%p, %lf)", ( void * ) pItem, dNumber ) ); if( pItem ) { @@ -978,7 +953,7 @@ PHB_ITEM hb_itemPutND( PHB_ITEM pItem, double dNumber ) PHB_ITEM hb_itemPutNI( PHB_ITEM pItem, int iNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNI(%p, %d)", pItem, iNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNI(%p, %d)", ( void * ) pItem, iNumber ) ); if( pItem ) { @@ -997,7 +972,7 @@ PHB_ITEM hb_itemPutNI( PHB_ITEM pItem, int iNumber ) PHB_ITEM hb_itemPutNL( PHB_ITEM pItem, long lNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNL(%p, %ld)", pItem, lNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNL(%p, %ld)", ( void * ) pItem, lNumber ) ); if( pItem ) { @@ -1014,7 +989,7 @@ PHB_ITEM hb_itemPutNL( PHB_ITEM pItem, long lNumber ) PHB_ITEM hb_itemPutNS( PHB_ITEM pItem, HB_ISIZ nNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNS(%p, %" HB_PFS "d)", pItem, nNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNS(%p, %" HB_PFS "d)", ( void * ) pItem, nNumber ) ); if( pItem ) { @@ -1051,7 +1026,7 @@ PHB_ITEM hb_itemPutNS( PHB_ITEM pItem, HB_ISIZ nNumber ) #ifndef HB_LONG_LONG_OFF PHB_ITEM hb_itemPutNLL( PHB_ITEM pItem, HB_LONGLONG llNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNL(%p, %" PFLL "d)", pItem, llNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNL(%p, %" PFLL "d)", ( void * ) pItem, llNumber ) ); if( pItem ) { @@ -1077,7 +1052,7 @@ PHB_ITEM hb_itemPutNLL( PHB_ITEM pItem, HB_LONGLONG llNumber ) PHB_ITEM hb_itemPutNInt( PHB_ITEM pItem, HB_MAXINT nNumber ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNInt(%p, %" PFHL "d)", pItem, nNumber ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNInt(%p, %" PFHL "d)", ( void * ) pItem, nNumber ) ); if( pItem ) { @@ -1106,7 +1081,7 @@ PHB_ITEM hb_itemPutNInt( PHB_ITEM pItem, HB_MAXINT nNumber ) PHB_ITEM hb_itemPutNIntLen( PHB_ITEM pItem, HB_MAXINT nNumber, int iWidth ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNIntLen(%p, %" PFHL "d, %d)", pItem, nNumber, iWidth ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNIntLen(%p, %" PFHL "d, %d)", ( void * ) pItem, nNumber, iWidth ) ); if( HB_LIM_INT( nNumber ) ) { @@ -1124,7 +1099,7 @@ PHB_ITEM hb_itemPutNIntLen( PHB_ITEM pItem, HB_MAXINT nNumber, int iWidth ) PHB_ITEM hb_itemPutNLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNLen(%p, %lf, %d, %d)", pItem, dNumber, iWidth, iDec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNLen(%p, %lf, %d, %d)", ( void * ) pItem, dNumber, iWidth, iDec ) ); if( iDec < 0 ) { @@ -1150,7 +1125,7 @@ PHB_ITEM hb_itemPutNLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec ) PHB_ITEM hb_itemPutNDLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNDLen(%p, %lf, %d, %d)", pItem, dNumber, iWidth, iDec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNDLen(%p, %lf, %d, %d)", ( void * ) pItem, dNumber, iWidth, iDec ) ); if( pItem ) { @@ -1179,7 +1154,7 @@ PHB_ITEM hb_itemPutNDLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec ) PHB_ITEM hb_itemPutNDDec( PHB_ITEM pItem, double dNumber, int iDec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNDDec(%p, %lf, %i)", pItem, dNumber, iDec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNDDec(%p, %lf, %i)", ( void * ) pItem, dNumber, iDec ) ); if( pItem ) { @@ -1209,7 +1184,7 @@ PHB_ITEM hb_itemPutNDDec( PHB_ITEM pItem, double dNumber, int iDec ) double hb_itemGetNDDec( PHB_ITEM pItem, int * piDec ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNDDec(%p,%p)", pItem, piDec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNDDec(%p,%p)", ( void * ) pItem, ( void * ) piDec ) ); if( HB_IS_INTEGER( pItem ) ) { @@ -1234,7 +1209,7 @@ double hb_itemGetNDDec( PHB_ITEM pItem, int * piDec ) PHB_ITEM hb_itemPutNILen( PHB_ITEM pItem, int iNumber, int iWidth ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNILen(%p, %d, %d)", pItem, iNumber, iWidth ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNILen(%p, %d, %d)", ( void * ) pItem, iNumber, iWidth ) ); if( pItem ) { @@ -1256,7 +1231,7 @@ PHB_ITEM hb_itemPutNILen( PHB_ITEM pItem, int iNumber, int iWidth ) PHB_ITEM hb_itemPutNLLen( PHB_ITEM pItem, long lNumber, int iWidth ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNLLen(%p, %ld, %d)", pItem, lNumber, iWidth ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNLLen(%p, %ld, %d)", ( void * ) pItem, lNumber, iWidth ) ); if( pItem ) { @@ -1288,7 +1263,7 @@ PHB_ITEM hb_itemPutNLLen( PHB_ITEM pItem, long lNumber, int iWidth ) #ifndef HB_LONG_LONG_OFF PHB_ITEM hb_itemPutNLLLen( PHB_ITEM pItem, HB_LONGLONG llNumber, int iWidth ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNLLLen(%p, %" PFLL "d, %d)", pItem, llNumber, iWidth ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNLLLen(%p, %" PFLL "d, %d)", ( void * ) pItem, llNumber, iWidth ) ); if( pItem ) { @@ -1320,7 +1295,7 @@ PHB_ITEM hb_itemPutNLLLen( PHB_ITEM pItem, HB_LONGLONG llNumber, int iWidth ) PHB_ITEM hb_itemPutNumType( PHB_ITEM pItem, double dNumber, int iDec, int iType1, int iType2 ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNumType( %p, %lf, %d, %i, %i)", pItem, dNumber, iDec, iType1, iType2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutNumType( %p, %lf, %d, %i, %i)", ( void * ) pItem, dNumber, iDec, iType1, iType2 ) ); if( iDec || iType1 & HB_IT_DOUBLE || iType2 & HB_IT_DOUBLE ) { @@ -1346,7 +1321,7 @@ PHB_ITEM hb_itemPutNumType( PHB_ITEM pItem, double dNumber, int iDec, int iType1 PHB_ITEM hb_itemPutPtr( PHB_ITEM pItem, void * pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutPtr(%p, %p)", pItem, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutPtr(%p, %p)", ( void * ) pItem, pValue ) ); if( pItem ) { @@ -1366,7 +1341,7 @@ PHB_ITEM hb_itemPutPtr( PHB_ITEM pItem, void * pValue ) PHB_ITEM hb_itemPutPtrGC( PHB_ITEM pItem, void * pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutPtrGC(%p, %p)", pItem, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutPtrGC(%p, %p)", ( void * ) pItem, pValue ) ); if( pItem ) { @@ -1388,7 +1363,7 @@ PHB_ITEM hb_itemPutPtrGC( PHB_ITEM pItem, void * pValue ) PHB_ITEM hb_itemPutPtrRawGC( PHB_ITEM pItem, void * pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutPtrRawGC(%p, %p)", pItem, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutPtrRawGC(%p, %p)", ( void * ) pItem, pValue ) ); if( pItem ) { @@ -1408,7 +1383,7 @@ PHB_ITEM hb_itemPutPtrRawGC( PHB_ITEM pItem, void * pValue ) PHB_ITEM hb_itemPutSymbol( PHB_ITEM pItem, PHB_SYMB pSym ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutSymbol(%p,%p)", pItem, pSym ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutSymbol(%p,%p)", ( void * ) pItem, ( void * ) pSym ) ); if( pItem ) { @@ -1429,7 +1404,7 @@ PHB_ITEM hb_itemPutSymbol( PHB_ITEM pItem, PHB_SYMB pSym ) void hb_itemGetNLen( PHB_ITEM pItem, int * piWidth, int * piDecimal ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNLen(%p, %p, %p)", pItem, piWidth, piDecimal ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetNLen(%p, %p, %p)", ( void * ) pItem, ( void * ) piWidth, ( void * ) piDecimal ) ); if( pItem ) { @@ -1458,7 +1433,7 @@ void hb_itemGetNLen( PHB_ITEM pItem, int * piWidth, int * piDecimal ) HB_SIZE hb_itemSize( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemSize(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemSize(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -1475,7 +1450,7 @@ HB_SIZE hb_itemSize( PHB_ITEM pItem ) HB_TYPE hb_itemType( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemType(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemType(%p)", ( void * ) pItem ) ); if( pItem ) return ( HB_TYPE ) HB_ITEM_TYPE( pItem ); @@ -1485,7 +1460,7 @@ HB_TYPE hb_itemType( PHB_ITEM pItem ) const char * hb_itemTypeStr( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemTypeStr(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemTypeStr(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -1535,7 +1510,7 @@ const char * hb_itemTypeStr( PHB_ITEM pItem ) void hb_itemInit( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemInit(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemInit(%p)", ( void * ) pItem ) ); if( pItem ) pItem->type = HB_IT_NIL; @@ -1545,7 +1520,7 @@ void hb_itemClear( PHB_ITEM pItem ) { HB_TYPE type; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemClear(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemClear(%p)", ( void * ) pItem ) ); type = HB_ITEM_TYPERAW( pItem ); pItem->type = HB_IT_NIL; @@ -1592,7 +1567,7 @@ void hb_itemClear( PHB_ITEM pItem ) void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopy(%p, %p)", pDest, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopy(%p, %p)", ( void * ) pDest, ( void * ) pSource ) ); if( pDest == pSource ) hb_errInternal( HB_EI_ITEMBADCOPY, NULL, "hb_itemCopy()", NULL ); @@ -1625,7 +1600,7 @@ void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource ) if( HB_IS_MEMVAR( pSource ) ) hb_memvarValueIncRef( pSource->item.asMemvar.value ); - else if( HB_IS_ENUM( pSource ) ) /* enumerators cannnot be copied */ + else if( HB_IS_ENUM( pSource ) ) /* enumerators cannot be copied */ pDest->type = HB_IT_NIL; else if( HB_IS_EXTREF( pSource ) ) @@ -1652,7 +1627,7 @@ void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource ) void hb_itemCopyToRef( PHB_ITEM pDest, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyToRef(%p, %p)", pDest, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyToRef(%p, %p)", ( void * ) pDest, ( void * ) pSource ) ); if( HB_IS_BYREF( pDest ) ) { @@ -1685,7 +1660,7 @@ void hb_itemCopyToRef( PHB_ITEM pDest, PHB_ITEM pSource ) void hb_itemCopyFromRef( PHB_ITEM pDest, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyFromRef(%p, %p)", pDest, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyFromRef(%p, %p)", ( void * ) pDest, ( void * ) pSource ) ); if( HB_IS_BYREF( pSource ) ) { @@ -1704,7 +1679,7 @@ void hb_itemCopyFromRef( PHB_ITEM pDest, PHB_ITEM pSource ) */ void hb_itemMove( PHB_ITEM pDest, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemMove(%p, %p)", pDest, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemMove(%p, %p)", ( void * ) pDest, ( void * ) pSource ) ); if( pDest == pSource ) hb_errInternal( HB_EI_ITEMBADCOPY, NULL, "hb_itemMove()", NULL ); @@ -1723,7 +1698,7 @@ void hb_itemMove( PHB_ITEM pDest, PHB_ITEM pSource ) void hb_itemMoveRef( PHB_ITEM pDest, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemMoveRef(%p, %p)", pDest, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemMoveRef(%p, %p)", ( void * ) pDest, ( void * ) pSource ) ); if( HB_IS_BYREF( pSource ) ) { @@ -1754,7 +1729,7 @@ void hb_itemMoveRef( PHB_ITEM pDest, PHB_ITEM pSource ) void hb_itemMoveToRef( PHB_ITEM pDest, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemMoveToRef(%p, %p)", pDest, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemMoveToRef(%p, %p)", ( void * ) pDest, ( void * ) pSource ) ); if( HB_IS_BYREF( pDest ) ) { @@ -1801,7 +1776,7 @@ void hb_itemMoveToRef( PHB_ITEM pDest, PHB_ITEM pSource ) void hb_itemMoveFromRef( PHB_ITEM pDest, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemMoveFromRef(%p, %p)", pDest, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemMoveFromRef(%p, %p)", ( void * ) pDest, ( void * ) pSource ) ); if( HB_IS_BYREF( pSource ) ) { @@ -1821,7 +1796,7 @@ void hb_itemSwap( PHB_ITEM pItem1, PHB_ITEM pItem2 ) { HB_ITEM temp; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemSwap(%p, %p)", pItem1, pItem2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemSwap(%p, %p)", ( void * ) pItem1, ( void * ) pItem2 ) ); /* * It's safe to use this version because our GC cannot be @@ -1841,7 +1816,7 @@ void hb_itemSwap( PHB_ITEM pItem1, PHB_ITEM pItem2 ) PHB_ITEM hb_itemUnRefOnce( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnRefOnce(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnRefOnce(%p)", ( void * ) pItem ) ); if( HB_IS_BYREF( pItem ) ) { @@ -1966,7 +1941,7 @@ PHB_ITEM hb_itemUnRefOnce( PHB_ITEM pItem ) PHB_ITEM hb_itemUnRef( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnRef(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnRef(%p)", ( void * ) pItem ) ); do { @@ -1982,7 +1957,7 @@ PHB_ITEM hb_itemUnRef( PHB_ITEM pItem ) */ PHB_ITEM hb_itemUnRefWrite( PHB_ITEM pItem, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnRefWrite(%p,%p)", pItem, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnRefWrite(%p,%p)", ( void * ) pItem, ( void * ) pSource ) ); if( HB_IS_EXTREF( pItem ) ) { @@ -2023,7 +1998,7 @@ PHB_ITEM hb_itemUnRefRefer( PHB_ITEM pItem ) { PHB_ITEM pLast; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnRefRefer(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnRefRefer(%p)", ( void * ) pItem ) ); do { @@ -2040,7 +2015,7 @@ PHB_ITEM hb_itemUnRefRefer( PHB_ITEM pItem ) PHB_ITEM hb_itemReSizeString( PHB_ITEM pItem, HB_SIZE nSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemReSizeString(%p,%" HB_PFS "u)", pItem, nSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemReSizeString(%p,%" HB_PFS "u)", ( void * ) pItem, nSize ) ); if( pItem->item.asString.allocated == 0 ) { @@ -2073,7 +2048,7 @@ PHB_ITEM hb_itemReSizeString( PHB_ITEM pItem, HB_SIZE nSize ) PHB_ITEM hb_itemUnShareString( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnShareString(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnShareString(%p)", ( void * ) pItem ) ); if( pItem->item.asString.allocated == 0 || hb_xRefCount( pItem->item.asString.value ) > 1 ) @@ -2097,7 +2072,7 @@ PHB_ITEM hb_itemUnShareString( PHB_ITEM pItem ) PHB_ITEM hb_itemUnShare( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnShare(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemUnShare(%p)", ( void * ) pItem ) ); if( HB_IS_BYREF( pItem ) ) pItem = hb_itemUnRef( pItem ); @@ -2110,7 +2085,7 @@ PHB_ITEM hb_itemUnShare( PHB_ITEM pItem ) HB_BOOL hb_itemGetWriteCL( PHB_ITEM pItem, char ** pszValue, HB_SIZE * pnLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetWriteCL(%p,%p,%p)", pItem, pszValue, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetWriteCL(%p,%p,%p)", ( void * ) pItem, ( void * ) pszValue, ( void * ) pnLen ) ); if( pItem ) { @@ -2132,7 +2107,7 @@ HB_BOOL hb_itemGetWriteCL( PHB_ITEM pItem, char ** pszValue, HB_SIZE * pnLen ) /* clone the given item */ PHB_ITEM hb_itemClone( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemClone(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemClone(%p)", ( void * ) pItem ) ); if( HB_IS_ARRAY( pItem ) ) { @@ -2149,7 +2124,7 @@ PHB_ITEM hb_itemClone( PHB_ITEM pItem ) void hb_itemCloneTo( PHB_ITEM pDest, PHB_ITEM pSource ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemCloneTo(%p,%p)", pDest, pSource ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemCloneTo(%p,%p)", ( void * ) pDest, ( void * ) pSource ) ); if( HB_IS_ARRAY( pSource ) ) { @@ -2349,7 +2324,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, HB_BOOL bForceExact ) HB_SIZE nMinLen; int iRet = 0; /* Current status */ - HB_TRACE( HB_TR_DEBUG, ( "hb_itemStrCmp(%p, %p, %d)", pFirst, pSecond, ( int ) bForceExact ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemStrCmp(%p, %p, %d)", ( void * ) pFirst, ( void * ) pSecond, ( int ) bForceExact ) ); szFirst = pFirst->item.asString.value; szSecond = pSecond->item.asString.value; @@ -2432,7 +2407,7 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, HB_BOOL bForceExact ) HB_SIZE nMinLen; int iRet = 0; /* Current status */ - HB_TRACE( HB_TR_DEBUG, ( "hb_itemStrICmp(%p, %p, %d)", pFirst, pSecond, ( int ) bForceExact ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemStrICmp(%p, %p, %d)", ( void * ) pFirst, ( void * ) pSecond, ( int ) bForceExact ) ); szFirst = pFirst->item.asString.value; szSecond = pSecond->item.asString.value; @@ -2708,7 +2683,7 @@ HB_BOOL hb_itemStrBuf( char * szResult, PHB_ITEM pNumber, int iSize, int iDec ) This function should be used by any function that wants to format numeric data for displaying, printing, or putting in a database. - Note: The caller is responsible for calling hb_xfree to free the results + Note: The caller is responsible for calling hb_xfree() to free the results buffer, but ONLY if the return value is not a NULL pointer! (If a NULL pointer is returned, then there was a conversion error.) */ @@ -2716,7 +2691,7 @@ char * hb_itemStr( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec ) { char * szResult = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemStr(%p, %p, %p)", pNumber, pWidth, pDec ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemStr(%p, %p, %p)", ( void * ) pNumber, ( void * ) pWidth, ( void * ) pDec ) ); if( pNumber ) { @@ -2776,7 +2751,7 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * nLen, HB_BOOL * bFreeReq ) { char * buffer; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemString(%p, %p, %p)", pItem, nLen, bFreeReq ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemString(%p, %p, %p)", ( void * ) pItem, ( void * ) nLen, ( void * ) bFreeReq ) ); switch( HB_ITEM_TYPE( pItem ) ) { @@ -2903,7 +2878,7 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * nLen, HB_BOOL * bFreeReq ) char * hb_itemPadConv( PHB_ITEM pItem, HB_SIZE * pnSize, HB_BOOL * bFreeReq ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPadConv(%p, %p, %p)", pItem, pnSize, bFreeReq ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPadConv(%p, %p, %p)", ( void * ) pItem, ( void * ) pnSize, ( void * ) bFreeReq ) ); if( pItem ) { @@ -2954,7 +2929,7 @@ PHB_ITEM hb_itemValToStr( PHB_ITEM pItem ) HB_SIZE nLen; HB_BOOL bFreeReq; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemValToStr(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemValToStr(%p)", ( void * ) pItem ) ); buffer = hb_itemString( pItem, &nLen, &bFreeReq ); if( bFreeReq ) diff --git a/src/vm/macro.c b/src/vm/macro.c index aa10f5e55b..ca0962c20c 100644 --- a/src/vm/macro.c +++ b/src/vm/macro.c @@ -93,19 +93,19 @@ static int s_macroFlags = HB_SM_DEFAULT; #define HB_SM_ISUSERCP() ( HB_CDP_ISCHARUNI( hb_vmCDP() ) ? HB_COMPFLAG_USERCP : 0 ) -/* ************************************************************************* */ +/* - */ /* Compile passed string into a pcode buffer * * 'pMacro' - pointer to HB_MACRO structure that will hold all information - * nedded for macro compilation and evaluation + * needed for macro compilation and evaluation * 'szString' - a string to compile * 'iFlag' - specifies if compiled code should generate pcodes either for push * operation (for example: var :=¯o) or for pop operation (¯o :=var) */ static int hb_macroParse( PHB_MACRO pMacro ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_macroParse(%p)", pMacro ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroParse(%p)", ( void * ) pMacro ) ); /* initialize the output (pcode) buffer - it will be filled by yacc */ pMacro->pCodeInfo = &pMacro->pCodeInfoBuffer; @@ -134,7 +134,7 @@ static int hb_macroParse( PHB_MACRO pMacro ) */ static void hb_macroClear( PHB_MACRO pMacro ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_macroClear(%p)", pMacro ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroClear(%p)", ( void * ) pMacro ) ); hb_xfree( pMacro->pCodeInfo->pCode ); if( pMacro->pError ) @@ -143,7 +143,7 @@ static void hb_macroClear( PHB_MACRO pMacro ) void hb_macroDelete( PHB_MACRO pMacro ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_macroDelete(%p)", pMacro ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroDelete(%p)", ( void * ) pMacro ) ); hb_macroClear( pMacro ); hb_xfree( pMacro ); @@ -155,7 +155,7 @@ static HB_BOOL hb_macroCheckParam( PHB_ITEM pItem ) { HB_BOOL bValid = HB_TRUE; - HB_TRACE( HB_TR_DEBUG, ( "hb_macroCheckParam(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroCheckParam(%p)", ( void * ) pItem ) ); if( ! HB_IS_STRING( pItem ) ) { @@ -199,7 +199,7 @@ static HB_ERROR_HANDLE( hb_macroErrorType ) */ void hb_macroRun( PHB_MACRO pMacro ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_macroRun(%p)", pMacro ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroRun(%p)", ( void * ) pMacro ) ); hb_vmExecute( pMacro->pCodeInfo->pCode, NULL ); } @@ -208,7 +208,7 @@ static void hb_macroSyntaxError( PHB_MACRO pMacro ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_macroSyntaxError(%p)", pMacro ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroSyntaxError(%p)", ( void * ) pMacro ) ); if( pMacro && pMacro->pError ) { @@ -233,10 +233,10 @@ static void hb_macroSyntaxError( PHB_MACRO pMacro ) } } -/* This replaces all '&var' or '&var.' occurences within a given string +/* This replaces all '&var' or '&var.' occurrences within a given string * with the value of variable 'var' if this variable exists and contains * a string value. The value of variable is also searched for - * occurences of macro operator and if it is found then it is expanded + * occurrences of macro operator and if it is found then it is expanded * until there is no more macro operators. * NOTE: * this does not evaluate a macro expression - there is a simple text @@ -418,7 +418,7 @@ void hb_macroGetValue( PHB_ITEM pItem, int iContext, int flags ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_macroGetValue(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroGetValue(%p)", ( void * ) pItem ) ); if( hb_macroCheckParam( pItem ) ) { @@ -434,7 +434,7 @@ void hb_macroGetValue( PHB_ITEM pItem, int iContext, int flags ) struMacro.status = HB_MACRO_CONT; struMacro.length = pItem->item.asString.length; /* - * Clipper appears to expand nested macros staticly vs. by + * Clipper appears to expand nested macros statically vs. by * Macro Parser, f.e.: * PROCEDURE Main() * LOCAL cText @@ -505,7 +505,7 @@ void hb_macroSetValue( PHB_ITEM pItem, int flags ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_macroSetValue(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroSetValue(%p)", ( void * ) pItem ) ); if( hb_macroCheckParam( pItem ) ) { @@ -549,7 +549,7 @@ void hb_macroPushReference( PHB_ITEM pItem ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_macroPushReference(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroPushReference(%p)", ( void * ) pItem ) ); if( hb_macroCheckParam( pItem ) ) { @@ -676,7 +676,7 @@ static void hb_macroUseAliased( PHB_ITEM pAlias, PHB_ITEM pVar, int iFlag, int i */ void hb_macroPopAliasedValue( PHB_ITEM pAlias, PHB_ITEM pVar, int flags ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_macroPopAliasedValue(%p, %p)", pAlias, pVar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroPopAliasedValue(%p, %p)", ( void * ) pAlias, ( void * ) pVar ) ); hb_macroUseAliased( pAlias, pVar, HB_MACRO_GEN_POP, flags ); } @@ -688,7 +688,7 @@ void hb_macroPopAliasedValue( PHB_ITEM pAlias, PHB_ITEM pVar, int flags ) */ void hb_macroPushAliasedValue( PHB_ITEM pAlias, PHB_ITEM pVar, int flags ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_macroPushAliasedValue(%p, %p)", pAlias, pVar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroPushAliasedValue(%p, %p)", ( void * ) pAlias, ( void * ) pVar ) ); hb_macroUseAliased( pAlias, pVar, HB_MACRO_GEN_PUSH, flags ); } @@ -702,7 +702,7 @@ char * hb_macroExpandString( const char * szString, HB_SIZE nLength, HB_BOOL * p { char * szResultString; - HB_TRACE( HB_TR_DEBUG, ( "hb_macroExpandString(%s,%" HB_PFS "u,%p)", szString, nLength, pfNewString ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroExpandString(%s,%" HB_PFS "u,%p)", szString, nLength, ( void * ) pfNewString ) ); if( szString ) szResultString = hb_macroTextSubst( szString, &nLength ); @@ -716,7 +716,7 @@ char * hb_macroTextSymbol( const char * szString, HB_SIZE nLength, HB_BOOL * pfN { char * szResult = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_macroTextSymbol(%s,%" HB_PFS "u,%p)", szString, nLength, pfNewString ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroTextSymbol(%s,%" HB_PFS "u,%p)", szString, nLength, ( void * ) pfNewString ) ); if( szString ) { @@ -859,7 +859,7 @@ static void hb_macroSetGetBlock( PHB_DYNS pVarSym, PHB_ITEM pItem, bPushPcode = HB_P_MPUSHALIASEDFIELD; bPopPcode = HB_P_MPOPALIASEDFIELD; } - else if( !fMemVar ) + else if( ! fMemVar ) { bPushPcode = HB_P_MPUSHFIELD; bPopPcode = HB_P_MPOPFIELD; @@ -1017,7 +1017,7 @@ HB_FUNC( FIELDWBLOCK ) void hb_macroPushSymbol( PHB_ITEM pItem ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_macroPushSymbol(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroPushSymbol(%p)", ( void * ) pItem ) ); if( hb_macroCheckParam( pItem ) ) { @@ -1059,7 +1059,7 @@ void hb_macroPushSymbol( PHB_ITEM pItem ) */ void hb_macroTextValue( PHB_ITEM pItem ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_macroTextValue(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroTextValue(%p)", ( void * ) pItem ) ); if( hb_macroCheckParam( pItem ) ) { @@ -1087,7 +1087,7 @@ const char * hb_macroGetType( PHB_ITEM pItem ) HB_STACK_TLS_PRELOAD const char * szType; - HB_TRACE( HB_TR_DEBUG, ( "hb_macroGetType(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroGetType(%p)", ( void * ) pItem ) ); if( hb_macroCheckParam( pItem ) ) { @@ -1134,7 +1134,7 @@ const char * hb_macroGetType( PHB_ITEM pItem ) /* Set our temporary error handler. We do not need any error * messages here - we need to know only if evaluation was - * successfull. If evaluation was successfull then the data type + * successful. If evaluation was successful then the data type * of expression can be determined. */ struErr.Func = hb_macroErrorType; @@ -1145,7 +1145,7 @@ const char * hb_macroGetType( PHB_ITEM pItem ) if( struMacro.status & HB_MACRO_CONT ) { - /* Evaluation was successfull + /* Evaluation was successful * Now the value of expression is placed on the eval stack - * check its type and pop it from the stack */ @@ -1238,7 +1238,7 @@ HB_FUNC( HB_SETMACRO ) hb_ret(); /* return NIL */ } -/* ************************************************************************* */ +/* - */ /* returns the order + 1 of a variable if defined or zero */ int hb_macroLocalVarGetPos( const char * szVarName, HB_COMP_DECL ) @@ -1577,7 +1577,7 @@ void hb_macroGenPopAliasedVar( const char * szVarName, } } -/* generates the pcode to push a nonaliased variable value to the virtual +/* generates the pcode to push a non-aliased variable value to the virtual * machine stack */ void hb_macroGenPushVar( const char * szVarName, HB_COMP_DECL ) @@ -1788,7 +1788,7 @@ void hb_macroGenPCodeN( const HB_BYTE * pBuffer, HB_SIZE nSize, HB_COMP_DECL ) pFunc->nPCodePos += nSize; } -/* ************************************************************************* */ +/* - */ void hb_macroError( int iError, HB_COMP_DECL ) { @@ -1796,14 +1796,12 @@ void hb_macroError( int iError, HB_COMP_DECL ) HB_MACRO_DATA->status &= ~HB_MACRO_CONT; /* clear CONT bit */ } -/* - * Start a new pcode buffer for a codeblock - */ +/* Start a new pcode buffer for a codeblock */ void hb_macroCodeBlockStart( HB_COMP_DECL ) { PHB_PCODE_INFO pCB; - HB_TRACE( HB_TR_DEBUG, ( "hb_macroCodeBlockStart(%p)", HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroCodeBlockStart(%p)", ( void * ) HB_COMP_PARAM ) ); pCB = ( PHB_PCODE_INFO ) hb_xgrab( sizeof( HB_PCODE_INFO ) ); @@ -1826,7 +1824,7 @@ void hb_macroCodeBlockEnd( HB_COMP_DECL ) HB_USHORT usParms = 0; /* number of codeblock parameters */ PHB_CBVAR pVar; - HB_TRACE( HB_TR_DEBUG, ( "hb_macroCodeBlockEnd(%p)", HB_COMP_PARAM ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_macroCodeBlockEnd(%p)", ( void * ) HB_COMP_PARAM ) ); /* a currently processed codeblock */ pCodeblock = HB_PCODE_DATA; diff --git a/src/vm/main.c b/src/vm/main.c index 3ca12b4ef5..84c436565c 100644 --- a/src/vm/main.c +++ b/src/vm/main.c @@ -56,5 +56,5 @@ #elif defined( HB_MAIN_WIN ) #include "mainwin.c" #else - #include "mainstd.c" /* Use the standard ANSI C entry point if not speficied */ + #include "mainstd.c" /* Use the standard ANSI C entry point if not specified */ #endif diff --git a/src/vm/maindllh.c b/src/vm/maindllh.c index c3781cc431..eb8e38c130 100644 --- a/src/vm/maindllh.c +++ b/src/vm/maindllh.c @@ -5,11 +5,6 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * diff --git a/src/vm/maindllp/dllext.c b/src/vm/maindllp/dllext.c index 2db84db979..07a30da0cc 100644 --- a/src/vm/maindllp/dllext.c +++ b/src/vm/maindllp/dllext.c @@ -2,14 +2,7 @@ * Windows pcode DLL entry point and VM/RTL routing functions * * Copyright 2001 Antonio Linares <alinares@fivetech.com> - * - * Copyright 2010 Przemyslaw Czerpak <druzus / at / priv.onet.pl> - * rewritten - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, with one exception: + * Copyright 2010 Przemyslaw Czerpak <druzus / at / priv.onet.pl> (rewritten) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/vm/mainstd.c b/src/vm/mainstd.c index 2837401b27..abbfcb4618 100644 --- a/src/vm/mainstd.c +++ b/src/vm/mainstd.c @@ -1,5 +1,5 @@ /* - * Std applications entry point + * Standard application entry point * * Copyright 1999 Antonio Linares <alinares@fivetech.com> * @@ -60,7 +60,7 @@ int _crt0_startup_flags = _CRT0_FLAG_USE_DOS_SLASHES; char ** __crt0_glob_function( char * _arg ) { - /* This function disables command line wildcard expansion. */ + /* This function disables command-line wildcard expansion. */ HB_SYMBOL_UNUSED( _arg ); return 0; @@ -76,7 +76,7 @@ HB_EXTERN_END int main( int argc, char * argv[] ) { - HB_TRACE( HB_TR_DEBUG, ( "main(%d, %p)", argc, argv ) ); + HB_TRACE( HB_TR_DEBUG, ( "main(%d, %p)", argc, ( void * ) argv ) ); #if defined( __DJGPP__ ) __system_flags = diff --git a/src/vm/mainwin.c b/src/vm/mainwin.c index d3495104fa..995fcda68f 100644 --- a/src/vm/mainwin.c +++ b/src/vm/mainwin.c @@ -1,5 +1,5 @@ /* - * Windows applications entry point + * Windows application entry point * * Copyright 1999 Antonio Linares <alinares@fivetech.com> * diff --git a/src/vm/memvars.c b/src/vm/memvars.c index 4f0c1cc4d9..501fb97088 100644 --- a/src/vm/memvars.c +++ b/src/vm/memvars.c @@ -2,6 +2,9 @@ * Memvar (PRIVATE/PUBLIC) runtime support * * Copyright 1999 Ryszard Glab <rglab@imid.med.pl> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) + * __mvSave(), __mvRestore() (Thanks to Dave Pearson and Jo French for + * the original Clipper function FReadMem() to read .mem files) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,18 +47,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * __mvSave() - * __mvRestore() (Thanks to Dave Pearson and Jo French for the original - * Clipper function (FReadMem()) to read .mem files) - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbvmopt.h" #include "hbapi.h" #include "hbapiitm.h" @@ -69,10 +60,8 @@ #include "hbstack.h" #if ! defined( HB_MT_VM ) - # define hb_dynsymGetMemvar( p ) ( ( PHB_ITEM ) ( p )->pMemvar ) # define hb_dynsymSetMemvar( p, h ) do { ( p )->pMemvar = ( h ); } while( 0 ) - #endif #define TABLE_INITHB_VALUE 100 @@ -113,7 +102,7 @@ static PHB_ITEM hb_memvarValueNew( void ) #undef hb_memvarValueIncRef void hb_memvarValueIncRef( PHB_ITEM pMemvar ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarValueIncRef(%p)", pMemvar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarValueIncRef(%p)", ( void * ) pMemvar ) ); hb_xRefInc( pMemvar ); } @@ -124,7 +113,7 @@ void hb_memvarValueIncRef( PHB_ITEM pMemvar ) */ void hb_memvarValueDecRef( PHB_ITEM pMemvar ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarValueDecRef(%p)", pMemvar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarValueDecRef(%p)", ( void * ) pMemvar ) ); if( hb_xRefDec( pMemvar ) ) { @@ -141,7 +130,7 @@ static void hb_memvarDetachDynSym( PHB_DYNS pDynSym, PHB_ITEM pPrevMemvar ) { PHB_ITEM pMemvar; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarDetachDynSym(%p,%p)", pDynSym, pPrevMemvar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarDetachDynSym(%p,%p)", ( void * ) pDynSym, ( void * ) pPrevMemvar ) ); pMemvar = hb_dynsymGetMemvar( pDynSym ); hb_dynsymSetMemvar( pDynSym, pPrevMemvar ); @@ -154,7 +143,7 @@ static void hb_memvarDetachDynSym( PHB_DYNS pDynSym, PHB_ITEM pPrevMemvar ) */ PHB_ITEM hb_memvarDetachLocal( PHB_ITEM pLocal ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarDetachLocal(%p)", pLocal ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarDetachLocal(%p)", ( void * ) pLocal ) ); if( HB_IS_BYREF( pLocal ) ) { @@ -220,7 +209,7 @@ static void hb_memvarAddPrivate( PHB_DYNS pDynSym, PHB_ITEM pValue ) PHB_PRIVATE_STACK pPrivateStack; PHB_ITEM pMemvar; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarAddPrivate(%p,%p)", pDynSym, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarAddPrivate(%p,%p)", ( void * ) pDynSym, ( void * ) pValue ) ); pPrivateStack = hb_stackGetPrivateStack(); @@ -330,7 +319,7 @@ void hb_memvarSetPrivatesBase( HB_SIZE nBase ) } /* - * Update PRIVATE base ofsset so they will not be removed + * Update PRIVATE base offset so they will not be removed * when function return */ void hb_memvarUpdatePrivatesBase( void ) @@ -366,7 +355,7 @@ void hb_memvarSetValue( PHB_SYMB pMemvarSymb, PHB_ITEM pItem ) { PHB_DYNS pDyn; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarSetValue(%p, %p)", pMemvarSymb, pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarSetValue(%p, %p)", ( void * ) pMemvarSymb, ( void * ) pItem ) ); pDyn = pMemvarSymb->pDynSym; if( pDyn ) @@ -375,7 +364,7 @@ void hb_memvarSetValue( PHB_SYMB pMemvarSymb, PHB_ITEM pItem ) pMemvar = hb_dynsymGetMemvar( pDyn ); - HB_TRACE( HB_TR_INFO, ( "Memvar item (%p)(%s) assigned", pMemvar, pMemvarSymb->szName ) ); + HB_TRACE( HB_TR_INFO, ( "Memvar item (%p)(%s) assigned", ( void * ) pMemvar, pMemvarSymb->szName ) ); if( pMemvar ) { @@ -399,7 +388,7 @@ HB_ERRCODE hb_memvarGet( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ) PHB_DYNS pDyn; HB_ERRCODE errCode = HB_FAILURE; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGet(%p, %p)", pItem, pMemvarSymb ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGet(%p, %p)", ( void * ) pItem, ( void * ) pMemvarSymb ) ); pDyn = pMemvarSymb->pDynSym; if( pDyn ) @@ -408,7 +397,7 @@ HB_ERRCODE hb_memvarGet( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ) pMemvar = hb_dynsymGetMemvar( pDyn ); - HB_TRACE( HB_TR_INFO, ( "Memvar item (%p)(%s) queried", pMemvar, pMemvarSymb->szName ) ); + HB_TRACE( HB_TR_INFO, ( "Memvar item (%p)(%s) queried", ( void * ) pMemvar, pMemvarSymb->szName ) ); if( pMemvar ) { @@ -429,7 +418,7 @@ HB_ERRCODE hb_memvarGet( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ) void hb_memvarGetValue( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetValue(%p, %p)", pItem, pMemvarSymb ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetValue(%p, %p)", ( void * ) pItem, ( void * ) pMemvarSymb ) ); if( hb_memvarGet( pItem, pMemvarSymb ) == HB_FAILURE ) { @@ -456,7 +445,7 @@ void hb_memvarGetRefer( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ) { PHB_DYNS pDyn; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetRefer(%p, %p)", pItem, pMemvarSymb ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetRefer(%p, %p)", ( void * ) pItem, ( void * ) pMemvarSymb ) ); pDyn = ( PHB_DYNS ) pMemvarSymb->pDynSym; if( pDyn ) @@ -465,7 +454,7 @@ void hb_memvarGetRefer( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ) pMemvar = hb_dynsymGetMemvar( pDyn ); - HB_TRACE( HB_TR_INFO, ( "Memvar item (%p)(%s) referenced", pMemvar, pMemvarSymb->szName ) ); + HB_TRACE( HB_TR_INFO, ( "Memvar item (%p)(%s) referenced", ( void * ) pMemvar, pMemvarSymb->szName ) ); if( pMemvar ) { @@ -516,7 +505,7 @@ void hb_memvarGetRefer( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ) PHB_ITEM hb_memvarGetItem( PHB_SYMB pMemvarSymb ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetItem(%p)", pMemvarSymb ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetItem(%p)", ( void * ) pMemvarSymb ) ); if( pMemvarSymb->pDynSym ) { @@ -537,7 +526,7 @@ PHB_ITEM hb_memvarGetItem( PHB_SYMB pMemvarSymb ) */ void hb_memvarNewParameter( PHB_SYMB pSymbol, PHB_ITEM pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarNewParameter(%p, %p)", pSymbol, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarNewParameter(%p, %p)", ( void * ) pSymbol, ( void * ) pValue ) ); hb_memvarCreateFromDynSymbol( pSymbol->pDynSym, HB_VSCOMP_PRIVATE, pValue ); } @@ -546,7 +535,7 @@ static PHB_DYNS hb_memvarFindSymbol( const char * szArg, HB_SIZE nLen ) { PHB_DYNS pDynSym = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarFindSymbol(%p,%" HB_PFS "u)", szArg, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarFindSymbol(%p,%" HB_PFS "u)", ( const void * ) szArg, nLen ) ); if( nLen && szArg && *szArg ) { @@ -585,7 +574,7 @@ char * hb_memvarGetStrValuePtr( char * szVarName, HB_SIZE * pnLen ) PHB_DYNS pDynVar; char * szValue = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetStrValuePtr(%s, %p)", szVarName, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetStrValuePtr(%s, %p)", ( void * ) szVarName, ( void * ) pnLen ) ); pDynVar = hb_memvarFindSymbol( szVarName, *pnLen ); @@ -619,7 +608,7 @@ char * hb_memvarGetStrValuePtr( char * szVarName, HB_SIZE * pnLen ) * * pMemvar - an item that stores the name of variable - it can be either * the HB_IT_SYMBOL (if created by PUBLIC statement) or HB_IT_STRING - * (if created by direct call to __MVPUBLIC function) + * (if created by direct call to __mvPublic() function) * iScope - the scope of created variable - if a variable with the same name * exists already then it's value is hidden by new variable with * passed scope @@ -631,12 +620,15 @@ void hb_memvarCreateFromItem( PHB_ITEM pMemvar, int iScope, PHB_ITEM pValue ) { PHB_DYNS pDynVar = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarCreateFromItem(%p, %d, %p)", pMemvar, iScope, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarCreateFromItem(%p, %d, %p)", ( void * ) pMemvar, iScope, ( void * ) pValue ) ); - /* find dynamic symbol or creeate one */ + /* find dynamic symbol or create one */ if( HB_IS_SYMBOL( pMemvar ) ) - /* pDynVar = hb_dynsymGet( pMemvar->item.asSymbol.value->szName ); */ +#if 0 + pDynVar = hb_dynsymGet( pMemvar->item.asSymbol.value->szName ); +#else pDynVar = pMemvar->item.asSymbol.value->pDynSym; +#endif else if( HB_IS_STRING( pMemvar ) ) pDynVar = hb_dynsymGet( pMemvar->item.asString.value ); @@ -648,7 +640,7 @@ void hb_memvarCreateFromItem( PHB_ITEM pMemvar, int iScope, PHB_ITEM pValue ) static void hb_memvarCreateFromDynSymbol( PHB_DYNS pDynVar, int iScope, PHB_ITEM pValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarCreateFromDynSymbol(%p, %d, %p)", pDynVar, iScope, pValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarCreateFromDynSymbol(%p, %d, %p)", ( void * ) pDynVar, iScope, ( void * ) pValue ) ); if( iScope & HB_VSCOMP_PUBLIC ) { @@ -696,7 +688,7 @@ static void hb_memvarCreateFromDynSymbol( PHB_DYNS pDynVar, int iScope, PHB_ITEM */ static void hb_memvarRelease( PHB_ITEM pMemvar ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarRelease(%p)", pMemvar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarRelease(%p)", ( void * ) pMemvar ) ); if( HB_IS_STRING( pMemvar ) ) { @@ -715,7 +707,7 @@ static void hb_memvarRelease( PHB_ITEM pMemvar ) { if( pDynSymbol == hb_stackGetPrivateStack()->stack[ --nBase ].pDynSym ) { - /* reset current value to NIL - the overriden variables will be + /* reset current value to NIL - the overridden variables will be * visible after exit from current procedure */ pMemvar = hb_dynsymGetMemvar( pDynSymbol ); @@ -744,8 +736,6 @@ static void hb_memvarReleaseWithMask( const char * szMask, HB_BOOL bInclude ) { HB_STACK_TLS_PRELOAD HB_SIZE nBase, nCount; - PHB_DYNS pDynVar; - PHB_ITEM pMemvar; HB_TRACE( HB_TR_DEBUG, ( "hb_memvarReleaseWithMask(%s, %d)", szMask, ( int ) bInclude ) ); @@ -753,8 +743,11 @@ static void hb_memvarReleaseWithMask( const char * szMask, HB_BOOL bInclude ) nBase = hb_stackBaseItem()->item.asSymbol.stackstate->nPrivateBase; while( nCount-- > nBase ) { + PHB_DYNS pDynVar; + PHB_ITEM pMemvar; + pDynVar = hb_stackGetPrivateStack()->stack[ nCount ].pDynSym; - /* reset current value to NIL - the overriden variables will be + /* reset current value to NIL - the overridden variables will be * visible after exit from current procedure */ pMemvar = hb_dynsymGetMemvar( pDynVar ); @@ -771,7 +764,7 @@ static void hb_memvarReleaseWithMask( const char * szMask, HB_BOOL bInclude ) */ static int hb_memvarScopeGet( PHB_DYNS pDynVar ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarScopeGet(%p)", pDynVar ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarScopeGet(%p)", ( void * ) pDynVar ) ); if( hb_dynsymGetMemvar( pDynVar ) == 0 ) return HB_MV_UNKNOWN; @@ -935,7 +928,7 @@ static PHB_ITEM hb_memvarDebugVariable( int iScope, int iPos, const char ** pszN *pszName = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hb_memvarDebugVariable(%d, %d, %p)", iScope, iPos, pszName ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_memvarDebugVariable(%d, %d, %p)", iScope, iPos, ( const void * ) pszName ) ); if( iPos > 0 ) { @@ -992,8 +985,7 @@ PHB_ITEM hb_memvarSaveInArray( int iScope, HB_BOOL fCopy ) { HB_STACK_TLS_PRELOAD struct mv_memvarArray_info MVInfo; - PHB_ITEM pArray, pItem, pMemvar; - PHB_DYNS pDynSymbol; + PHB_ITEM pArray; pArray = NULL; @@ -1017,23 +1009,26 @@ PHB_ITEM hb_memvarSaveInArray( int iScope, HB_BOOL fCopy ) pArray = hb_itemArrayNew( MVInfo.nCount ); do { - pItem = hb_arrayGetItemPtr( pArray, MVInfo.nCount ); - pDynSymbol = MVInfo.pDyns[ --MVInfo.nCount ]; - pMemvar = hb_dynsymGetMemvar( pDynSymbol ), + PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, MVInfo.nCount ); + if( pItem ) + { + PHB_DYNS pDynSymbol = MVInfo.pDyns[ --MVInfo.nCount ]; + PHB_ITEM pMemvar = hb_dynsymGetMemvar( pDynSymbol ); - hb_arrayNew( pItem, 2 ); - hb_arraySetSymbol( pItem, 1, pDynSymbol->pSymbol ); - pItem = hb_arrayGetItemPtr( pItem, 2 ); - if( fCopy ) - { - hb_itemCopy( pItem, pMemvar ); - hb_memvarDetachLocal( pItem ); - } - else - { - pItem->type = HB_IT_BYREF | HB_IT_MEMVAR; - pItem->item.asMemvar.value = pMemvar; - hb_xRefInc( pMemvar ); + hb_arrayNew( pItem, 2 ); + hb_arraySetSymbol( pItem, 1, pDynSymbol->pSymbol ); + pItem = hb_arrayGetItemPtr( pItem, 2 ); + if( fCopy ) + { + hb_itemCopy( pItem, pMemvar ); + hb_memvarDetachLocal( pItem ); + } + else + { + pItem->type = HB_IT_BYREF | HB_IT_MEMVAR; + pItem->item.asMemvar.value = pMemvar; + hb_xRefInc( pMemvar ); + } } } while( MVInfo.nCount ); @@ -1061,7 +1056,7 @@ void hb_memvarRestoreFromArray( PHB_ITEM pArray ) } } -/* ************************************************************************** */ +/* - */ static const char * hb_memvarGetMask( int iParam ) { @@ -1311,7 +1306,7 @@ HB_FUNC( __MVPUT ) pName->item.asString.length ); if( pDynVar ) { - /* variable was declared somwhere - assign a new value + /* variable was declared somewhere - assign a new value */ hb_memvarSetValue( pDynVar->pSymbol, pValue ); } @@ -1385,7 +1380,7 @@ static HB_DYNS_FUNC( hb_memvarSave ) HB_SIZE nLen = hb_itemGetCLen( pMemvar ) + 1; int iOverFlow = 0; - /* Clipper supports only 64KB strings */ + /* Clipper supports only 64 KiB strings */ if( nLen > USHRT_MAX ) { nLen = USHRT_MAX; @@ -1561,7 +1556,6 @@ HB_FUNC( __MVRESTORE ) HB_BOOL bIncludeMask; HB_BYTE buffer[ HB_MEM_REC_LEN ]; const char * pszMask; - char *szName; PHB_ITEM pItem = NULL; #ifdef HB_CLP_STRICT @@ -1569,11 +1563,13 @@ HB_FUNC( __MVRESTORE ) bIncludeMask = HB_TRUE; #else pszMask = hb_memvarGetMask( 3 ); - bIncludeMask = hb_parldef( 4, 1 ); + bIncludeMask = hb_parldef( 4, HB_TRUE ); #endif while( hb_fileRead( fhnd, buffer, HB_MEM_REC_LEN, -1 ) == HB_MEM_REC_LEN ) { + char * pszName; + /* FoxPro does not add 128 to item type: 'N', 'C', 'D', 'L' * CA-Cl*pper respects it and read such files so we also should. */ @@ -1583,7 +1579,7 @@ HB_FUNC( __MVRESTORE ) /* protect against corrupted files */ buffer[ 10 ] = '\0'; - szName = ( char * ) buffer; + pszName = ( char * ) buffer; switch( uiType ) { @@ -1599,7 +1595,7 @@ HB_FUNC( __MVRESTORE ) else { hb_xfree( pbyString ); - szName = NULL; + pszName = NULL; } break; @@ -1612,7 +1608,7 @@ HB_FUNC( __MVRESTORE ) if( hb_fileRead( fhnd, pbyNumber, HB_MEM_NUM_LEN, -1 ) == HB_MEM_NUM_LEN ) pItem = hb_itemPutNLen( pItem, HB_GET_LE_DOUBLE( pbyNumber ), uiWidth - ( uiDec ? ( uiDec + 1 ) : 0 ), uiDec ); else - szName = NULL; + pszName = NULL; break; } @@ -1624,7 +1620,7 @@ HB_FUNC( __MVRESTORE ) if( hb_fileRead( fhnd, pbyNumber, HB_MEM_NUM_LEN, -1 ) == HB_MEM_NUM_LEN ) pItem = hb_itemPutDL( pItem, ( long ) HB_GET_LE_DOUBLE( pbyNumber ) ); else - szName = NULL; + pszName = NULL; break; } @@ -1636,7 +1632,7 @@ HB_FUNC( __MVRESTORE ) if( hb_fileRead( fhnd, pbyNumber, HB_MEM_NUM_LEN, -1 ) == HB_MEM_NUM_LEN ) pItem = hb_itemPutTD( pItem, HB_GET_LE_DOUBLE( pbyNumber ) ); else - szName = NULL; + pszName = NULL; break; } @@ -1648,31 +1644,31 @@ HB_FUNC( __MVRESTORE ) if( hb_fileRead( fhnd, pbyLogical, 1, -1 ) == 1 ) pItem = hb_itemPutL( pItem, pbyLogical[ 0 ] != 0 ); else - szName = NULL; + pszName = NULL; break; } default: - szName = NULL; + pszName = NULL; } - if( szName ) + if( pszName ) { - HB_BOOL bMatch = hb_strMatchCaseWildExact( szName, pszMask ); + HB_BOOL bMatch = hb_strMatchCaseWildExact( pszName, pszMask ); /* Process it if it matches the passed mask */ if( bIncludeMask ? bMatch : ! bMatch ) { /* the first parameter is a string with not empty variable name */ - PHB_DYNS pDynVar = hb_memvarFindSymbol( szName, strlen( szName ) ); + PHB_DYNS pDynVar = hb_memvarFindSymbol( pszName, strlen( pszName ) ); if( pDynVar ) - /* variable was declared somwhere - assign a new value */ + /* variable was declared somewhere - assign a new value */ hb_memvarSetValue( pDynVar->pSymbol, pItem ); else /* attempt to assign a value to undeclared variable create the PRIVATE one */ - hb_memvarCreateFromDynSymbol( hb_dynsymGet( szName ), HB_VSCOMP_PRIVATE, pItem ); + hb_memvarCreateFromDynSymbol( hb_dynsymGet( pszName ), HB_VSCOMP_PRIVATE, pItem ); } } } diff --git a/src/vm/proc.c b/src/vm/proc.c index e4b9b190a4..cf4870527a 100644 --- a/src/vm/proc.c +++ b/src/vm/proc.c @@ -2,6 +2,11 @@ * ProcName(), ProcLine() and ProcFile() functions * * Copyright 1999 Antonio Linares <alinares@fivetech.com> + * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) (ProcFile()) + * Copyright 2001 JFL (Mafact) <jfl@mafact.com> + * Adding the MethodName() just calling ProcName() + * Special treatment in case of Object and Eval (only for method mame) + * skipping block and adding (b) before the method name * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,21 +49,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 1999-2001 Viktor Szakats (vszakats.net/harbour) - * ProcFile() - * - * Copyright 2001 JFL (Mafact) <jfl@mafact.com> - * Adding the MethodName() just calling ProcName() - * Special treatment in case of Object and Eval (only for methodname) - * skipping block and adding (b) before the method name - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbvmint.h" #include "hbapi.h" #include "hbapicls.h" @@ -211,7 +201,7 @@ char * hb_procname( int iLevel, char * szName, HB_BOOL fMethodName ) /* NOTE: szName size must be an at least: * HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 - * szFile szie must be an at least: + * szFile size must be an at least: * HB_PATH_MAX */ HB_BOOL hb_procinfo( int iLevel, char * szName, HB_USHORT * puiLine, char * szFile ) diff --git a/src/vm/pvaluehb.c b/src/vm/pvaluehb.c index 9afc980f90..2d08d6054b 100644 --- a/src/vm/pvaluehb.c +++ b/src/vm/pvaluehb.c @@ -44,12 +44,12 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" /* NOTE: This function is a new Harbour function implemented in the original CA-Cl*pper namespace. It should have been marked as HB_EXTENSION, but it's not, because it's commonly used extension - in other xbase dialects, like Xbase++ and FlagShip. + in other xBase dialects, like Xbase++ and FlagShip. Nevertheless this function must be kept in a separate source file to avoid linking errors when a 3rd party library or user code would also define this function. diff --git a/src/vm/runner.c b/src/vm/runner.c index 9e3f1b5840..dff3b51a47 100644 --- a/src/vm/runner.c +++ b/src/vm/runner.c @@ -2,6 +2,8 @@ * Harbour Portable Object (.hrb) file runner * * Copyright 1999 Eddie Runia <eddie@runia.com> + * Copyright 2002 Alexander Kresin <alex@belacy.belgorod.su> + * (hb_hrbLoad(), hb_hrbDo(), hb_hrbUnload(), hb_hrbGetFunSym()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,19 +46,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2002 Alexander Kresin <alex@belacy.belgorod.su> - * hb_hrbLoad() - * hb_hrbDo() - * hb_hrbUnload() - * hb_hrbGetFunSym() - * - * See COPYING.txt for licensing terms. - * - */ - #include "hbvmint.h" #include "hbapi.h" #include "hbstack.h" @@ -71,20 +60,20 @@ typedef struct { - char * szName; /* Name of the function */ - HB_PCODEFUNC pcodeFunc; /* Dynamic function info */ - HB_BYTE * pCode; /* P-code */ + char * szName; /* Name of the function */ + HB_PCODEFUNC pcodeFunc; /* Dynamic function info */ + HB_BYTE * pCode; /* P-code */ } HB_DYNF, * PHB_DYNF; typedef struct { - HB_ULONG ulSymbols; /* Number of symbols */ - HB_ULONG ulFuncs; /* Number of functions */ + HB_ULONG ulSymbols; /* Number of symbols */ + HB_ULONG ulFuncs; /* Number of functions */ HB_BOOL fInit; /* should be INIT functions executed */ HB_BOOL fExit; /* should be EXIT functions executed */ - HB_LONG lSymStart; /* Startup Symbol */ - PHB_SYMB pSymRead; /* Symbols read */ - PHB_DYNF pDynFunc; /* Functions read */ + HB_LONG lSymStart; /* Startup Symbol */ + PHB_SYMB pSymRead; /* Symbols read */ + PHB_DYNF pDynFunc; /* Functions read */ PHB_SYMBOLS pModuleSymbols; } HRB_BODY, * PHRB_BODY; @@ -92,10 +81,10 @@ static const char s_szHead[ 4 ] = { '\xC0', 'H', 'R', 'B' }; #define SYM_NOLINK 0 /* symbol does not have to be linked */ -#define SYM_FUNC 1 /* function defined in this module */ -#define SYM_EXTERN 2 /* function defined in other module */ -#define SYM_DEFERRED 3 /* lately bound function */ -#define SYM_NOT_FOUND 0xFFFFFFFFUL /* Symbol not found. */ +#define SYM_FUNC 1 /* function defined in this module */ +#define SYM_EXTERN 2 /* function defined in other module */ +#define SYM_DEFERRED 3 /* lately bound function */ +#define SYM_NOT_FOUND 0xFFFFFFFFUL /* Symbol not found. */ static HB_SIZE hb_hrbCheckSig( const char * szBody, HB_SIZE nBodySize ) { @@ -109,7 +98,7 @@ static int hb_hrbReadHead( const char * szBody, HB_SIZE nBodySize, HB_SIZE * pnB const char * pVersion; HB_SIZE nSigSize; - HB_TRACE( HB_TR_DEBUG, ( "hb_hrbReadHead(%p,%" HB_PFS "u,%p)", szBody, nBodySize, pnBodyOffset ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hrbReadHead(%p,%" HB_PFS "u,%p)", ( const void * ) szBody, nBodySize, ( void * ) pnBodyOffset ) ); nSigSize = hb_hrbCheckSig( szBody, nBodySize ); @@ -124,7 +113,7 @@ static int hb_hrbReadHead( const char * szBody, HB_SIZE nBodySize, HB_SIZE * pnB static HB_BOOL hb_hrbReadValue( const char * szBody, HB_SIZE nBodySize, HB_SIZE * pnBodyOffset, HB_ULONG * pulValue ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hrbReadValue(%p,%" HB_PFS "u,%p,%p)", szBody, nBodySize, pnBodyOffset, pulValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hrbReadValue(%p,%" HB_PFS "u,%p,%p)", ( const void * ) szBody, nBodySize, ( void * ) pnBodyOffset, ( void * ) pulValue ) ); if( *pnBodyOffset + 4 < nBodySize ) { @@ -144,7 +133,7 @@ static char * hb_hrbReadId( const char * szBody, HB_SIZE nBodySize, HB_SIZE * pn { const char * szIdx; - HB_TRACE( HB_TR_DEBUG, ( "hb_hrbReadId(%p,%" HB_PFS "u,%p)", szBody, nBodySize, pnBodyOffset ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hrbReadId(%p,%" HB_PFS "u,%p)", ( const void * ) szBody, nBodySize, ( void * ) pnBodyOffset ) ); szIdx = &szBody[ *pnBodyOffset ]; @@ -162,7 +151,7 @@ static HB_ULONG hb_hrbFindSymbol( const char * szName, PHB_DYNF pDynFunc, HB_ULO { HB_ULONG ulRet; - HB_TRACE( HB_TR_DEBUG, ( "hb_hrbFindSymbol(%s, %p, %lu)", szName, pDynFunc, ulLoaded ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hrbFindSymbol(%s, %p, %lu)", szName, ( void * ) pDynFunc, ulLoaded ) ); for( ulRet = 0; ulRet < ulLoaded; ++ulRet ) { @@ -210,15 +199,14 @@ static void hb_hrbInit( PHRB_BODY pHrbBody, int iPCount, PHB_ITEM * pParams ) { if( hb_vmRequestReenter() ) { - HB_ULONG ul; HB_BOOL fRepeat, fClipInit = HB_TRUE; - int i; pHrbBody->fInit = HB_FALSE; pHrbBody->fExit = HB_TRUE; do { + HB_ULONG ul; fRepeat = HB_FALSE; ul = pHrbBody->ulSymbols; while( ul-- ) @@ -229,6 +217,7 @@ static void hb_hrbInit( PHRB_BODY pHrbBody, int iPCount, PHB_ITEM * pParams ) if( strcmp( pHrbBody->pSymRead[ ul ].szName, "CLIPINIT$" ) ? ! fClipInit : fClipInit ) { + int i; hb_vmPushSymbol( pHrbBody->pSymRead + ul ); hb_vmPushNil(); for( i = 0; i < iPCount; i++ ) @@ -280,25 +269,21 @@ static void hb_hrbExit( PHRB_BODY pHrbBody ) static void hb_hrbUnLoad( PHRB_BODY pHrbBody ) { - HB_ULONG ul; - hb_hrbExit( pHrbBody ); if( pHrbBody->pModuleSymbols ) - { hb_vmFreeSymbols( pHrbBody->pModuleSymbols ); - } if( pHrbBody->pDynFunc ) { + HB_ULONG ul; + for( ul = 0; ul < pHrbBody->ulFuncs; ul++ ) { - PHB_DYNS pDyn; - if( pHrbBody->pDynFunc[ ul ].szName && pHrbBody->pDynFunc[ ul ].pcodeFunc.pCode ) { - pDyn = hb_dynsymFind( pHrbBody->pDynFunc[ ul ].szName ); + PHB_DYNS pDyn = hb_dynsymFind( pHrbBody->pDynFunc[ ul ].szName ); if( pDyn && pDyn->pSymbol->value.pCodeFunc == &pHrbBody->pDynFunc[ ul ].pcodeFunc ) { @@ -317,8 +302,6 @@ static void hb_hrbUnLoad( PHRB_BODY pHrbBody ) hb_xfree( pHrbBody ); } - - static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE nBodySize, HB_USHORT usMode, const char * szFileName ) { PHRB_BODY pHrbBody = NULL; @@ -326,14 +309,14 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE nBodySize, HB_USHOR if( szHrbBody ) { HB_SIZE nBodyOffset = 0; - HB_SIZE nSize; /* Size of function */ + HB_SIZE nSize; /* Size of function */ HB_SIZE nPos; HB_ULONG ul; char * buffer, ch; HB_USHORT usBind = ( usMode & HB_HRB_BIND_MODEMASK ); - PHB_SYMB pSymRead; /* Symbols read */ - PHB_DYNF pDynFunc; /* Functions read */ + PHB_SYMB pSymRead; /* Symbols read */ + PHB_DYNF pDynFunc; /* Functions read */ PHB_DYNS pDynSym; int iVersion = hb_hrbReadHead( szHrbBody, nBodySize, &nBodyOffset ); @@ -544,7 +527,7 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE nBodySize, HB_USHOR { /* * Old unused symbol table has been recycled - free the one - * we allocated and disactivate static initialization [druzus] + * we allocated and deactivate static initialization [druzus] */ pHrbBody->pSymRead = pHrbBody->pModuleSymbols->pModuleSymbols; hb_xfree( pSymRead ); @@ -619,13 +602,14 @@ static PHRB_BODY hb_hrbLoadFromFile( const char * szHrb, HB_USHORT usMode ) static void hb_hrbDo( PHRB_BODY pHrbBody, int iPCount, PHB_ITEM * pParams ) { PHB_ITEM pRetVal = NULL; - int i; hb_hrbInit( pHrbBody, iPCount, pParams ); /* May not have a startup symbol, if first symbol was an INIT Symbol (was executed already). */ if( pHrbBody->lSymStart >= 0 && hb_vmRequestQuery() == 0 ) { + int i; + hb_vmPushSymbol( &pHrbBody->pSymRead[ pHrbBody->lSymStart ] ); hb_vmPushNil(); @@ -677,7 +661,7 @@ static void hb_hrbReturn( PHRB_BODY pHrbBody ) } /* - hb_hrbRun( [ <nOptions>, ] <cHrb> [, <xparams,...> ] ) -> <retVal> + hb_hrbRun( [ <nOptions>, ] <cHrb> [, <xparams,...> ] ) --> <retVal> This program will get the data from the .hrb file and run the p-code contained in it. @@ -711,11 +695,12 @@ HB_FUNC( HB_HRBRUN ) if( pHrbBody ) { - int iPCount = hb_pcount() - nParam, i; + int iPCount = hb_pcount() - nParam; PHB_ITEM * pParams = NULL; if( iPCount > 0 ) { + int i; pParams = ( PHB_ITEM * ) hb_xgrab( sizeof( PHB_ITEM ) * iPCount ); for( i = 0; i < iPCount; i++ ) pParams[ i ] = hb_stackItemFromBase( i + 1 + nParam ); @@ -763,12 +748,11 @@ HB_FUNC( HB_HRBLOAD ) { int iPCount = hb_pcount() - nParam; PHB_ITEM * pParams = NULL; - int i; if( iPCount > 0 ) { + int i; pParams = ( PHB_ITEM * ) hb_xgrab( sizeof( PHB_ITEM ) * iPCount ); - for( i = 0; i < iPCount; i++ ) pParams[ i ] = hb_stackItemFromBase( i + 1 + nParam ); } @@ -792,12 +776,11 @@ HB_FUNC( HB_HRBDO ) { int iPCount = hb_pcount() - 1; PHB_ITEM * pParams = NULL; - int i; if( iPCount > 0 ) { + int i; pParams = ( PHB_ITEM * ) hb_xgrab( sizeof( PHB_ITEM ) * iPCount ); - for( i = 0; i < iPCount; i++ ) pParams[ i ] = hb_stackItemFromBase( i + 2 ); } diff --git a/src/vm/set.c b/src/vm/set.c index 16ad6df630..6b7a53b739 100644 --- a/src/vm/set.c +++ b/src/vm/set.c @@ -2,6 +2,7 @@ * Set functions * * Copyright 1999-2003 David G. Holm <dholm@jsd-llc.com> + * Copyright 2008-2009 Viktor Szakats (vszakats.net/harbour) (hb_osEncode(), hb_osDecode()) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,17 +45,6 @@ * */ -/* - * The following parts are Copyright of the individual authors. - * - * Copyright 2008-2009 Viktor Szakats (vszakats.net/harbour) - * hb_osEncode() - * hb_osDecode() - * - * See COPYING.txt for licensing terms. - * - */ - #define _HB_SET_INTERNAL_ #include "hbvmopt.h" @@ -88,7 +78,7 @@ static char set_char( PHB_ITEM pItem, char oldChar ) { char newChar = oldChar; - HB_TRACE( HB_TR_DEBUG, ( "set_char(%p, %c)", pItem, oldChar ) ); + HB_TRACE( HB_TR_DEBUG, ( "set_char(%p, %c)", ( void * ) pItem, oldChar ) ); if( HB_IS_STRING( pItem ) ) { @@ -110,7 +100,7 @@ static HB_BOOL set_logical( PHB_ITEM pItem, HB_BOOL bDefault ) { HB_BOOL bLogical = bDefault; - HB_TRACE( HB_TR_DEBUG, ( "set_logical(%p)", pItem ) ); + HB_TRACE( HB_TR_DEBUG, ( "set_logical(%p)", ( void * ) pItem ) ); if( pItem ) { @@ -138,7 +128,7 @@ static HB_BOOL set_logical( PHB_ITEM pItem, HB_BOOL bDefault ) static int set_number( PHB_ITEM pItem, int iOldValue ) { - HB_TRACE( HB_TR_DEBUG, ( "set_number(%p, %d)", pItem, iOldValue ) ); + HB_TRACE( HB_TR_DEBUG, ( "set_number(%p, %d)", ( void * ) pItem, iOldValue ) ); return HB_IS_NUMERIC( pItem ) ? hb_itemGetNI( pItem ) : iOldValue; } @@ -147,13 +137,13 @@ static char * set_string( PHB_ITEM pItem, char * szOldString ) { char * szString; - HB_TRACE( HB_TR_DEBUG, ( "set_string(%p, %s)", pItem, szOldString ) ); + HB_TRACE( HB_TR_DEBUG, ( "set_string(%p, %s)", ( void * ) pItem, szOldString ) ); if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) { if( szOldString ) hb_xfree( szOldString ); - /* Limit size of SET strings to 64K, truncating if source is longer */ + /* Limit size of SET strings to 64 KiB, truncating if source is longer */ szString = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); } else @@ -166,7 +156,7 @@ static void close_handle( PHB_SET_STRUCT pSet, HB_set_enum set_specifier ) { PHB_FILE * handle_ptr; - HB_TRACE( HB_TR_DEBUG, ( "close_handle(%p,%d)", pSet, ( int ) set_specifier ) ); + HB_TRACE( HB_TR_DEBUG, ( "close_handle(%p, %d)", ( void * ) pSet, ( int ) set_specifier ) ); switch( set_specifier ) { @@ -202,7 +192,7 @@ static const char * is_devicename( const char * szFileName ) "LPT1", "LPT2", "LPT3", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9" }; - int iSkip = 0, iLen, iFrom, iTo; + int iSkip = 0, iLen; if( ( szFileName[ 0 ] == '\\' || szFileName[ 0 ] == '/' ) && ( szFileName[ 1 ] == '\\' || szFileName[ 1 ] == '/' ) ) @@ -217,6 +207,7 @@ static const char * is_devicename( const char * szFileName ) } if( szFileName[ 2 ] != '\\' && szFileName[ 2 ] != '/' ) { + int iFrom, iTo; for( iFrom = 2, iTo = 0; szFileName[ iFrom ]; ++iFrom ) { if( szFileName[ iFrom ] == '\\' || szFileName[ iFrom ] == '/' ) @@ -232,6 +223,8 @@ static const char * is_devicename( const char * szFileName ) iLen = ( int ) strlen( szFileName + iSkip ); if( iLen >= 3 && iLen <= 4 ) { + int iFrom, iTo; + if( iLen == 3 ) { iFrom = 0; @@ -277,7 +270,7 @@ static void open_handle( PHB_SET_STRUCT pSet, const char * file_name, char ** set_value; HB_BOOL fPipe = HB_FALSE, fStripEof; - HB_TRACE( HB_TR_DEBUG, ( "open_handle(%p, %s, %d, %d)", pSet, file_name, ( int ) fAppend, ( int ) set_specifier ) ); + HB_TRACE( HB_TR_DEBUG, ( "open_handle(%p, %s, %d, %d)", ( void * ) pSet, file_name, ( int ) fAppend, ( int ) set_specifier ) ); switch( set_specifier ) { @@ -434,7 +427,7 @@ HB_BOOL hb_setSetCentury( HB_BOOL new_century_setting ) */ if( old_century_setting != new_century_setting ) { - int count, digit, size, y_size, y_start, y_stop; + int count, size, y_size, y_start, y_stop; char * szDateFormat, * szNewFormat; /* Convert to upper case and determine where year is */ @@ -443,7 +436,7 @@ HB_BOOL hb_setSetCentury( HB_BOOL new_century_setting ) size = ( int ) strlen( szDateFormat ); for( count = 0; count < size; count++ ) { - digit = HB_TOUPPER( ( HB_UCHAR ) szDateFormat[ count ] ); + int digit = HB_TOUPPER( ( HB_UCHAR ) szDateFormat[ count ] ); if( digit == 'Y' ) { if( y_start == -1 ) @@ -526,7 +519,7 @@ static char * hb_set_PRINTFILE_default( void ) #elif defined( HB_OS_WIN ) || defined( HB_OS_OS2 ) return hb_strdup( "LPT1" ); #else - return hb_strdup( "PRN" ); /* TOFIX */ + return hb_strdup( "PRN" ); /* FIXME */ #endif } @@ -1005,7 +998,7 @@ PHB_ITEM hb_setGetItem( HB_set_enum set_specifier, PHB_ITEM pResult, if( HB_IS_NIL( pArg1 ) ) pSet->HB_SET_HBOUTLOG = NULL; else - /* Limit size of SET strings to 64K, truncating if source is longer */ + /* Limit size of SET strings to 64 KiB, truncating if source is longer */ pSet->HB_SET_HBOUTLOG = hb_strndup( hb_itemGetCPtr( pArg1 ), USHRT_MAX ); hb_xsetfilename( pSet->HB_SET_HBOUTLOG ); } @@ -1090,7 +1083,7 @@ HB_FUNC( SET ) void hb_setInitialize( PHB_SET_STRUCT pSet ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_setInitialize(%p)", pSet ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_setInitialize(%p)", ( void * ) pSet ) ); pSet->HB_SET_ALTERNATE = HB_FALSE; pSet->HB_SET_ALTFILE = NULL; @@ -1103,6 +1096,7 @@ void hb_setInitialize( PHB_SET_STRUCT pSet ) pSet->hb_set_century = HB_FALSE; pSet->hb_set_prndevice = HB_FALSE; pSet->HB_SET_COLOR = ( char * ) hb_xgrab( HB_CLRSTR_LEN + 1 ); + /* NOTE: color must be synced with the one in IsDefColor() function */ hb_strncpy( pSet->HB_SET_COLOR, "W/N,N/W,N/N,N/N,N/W", HB_CLRSTR_LEN ); pSet->HB_SET_CONFIRM = HB_FALSE; pSet->HB_SET_CONSOLE = HB_TRUE; @@ -1332,13 +1326,14 @@ int hb_setListenerRemove( int listener ) HB_BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) { HB_STACK_TLS_PRELOAD - PHB_SET_STRUCT pSet = hb_stackSetStruct(); HB_BOOL fResult = HB_FALSE; - char * szValue; - int iValue; if( pItem ) { + PHB_SET_STRUCT pSet = hb_stackSetStruct(); + char * szValue; + int iValue; + hb_setListenerNotify( set_specifier, HB_SET_LISTENER_BEFORE ); switch( set_specifier ) @@ -1346,7 +1341,7 @@ HB_BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) case HB_SET_ALTFILE: case HB_SET_EXTRAFILE: case HB_SET_PRINTFILE: - /* This sets needs 3-rd parameter to indicate additive mode + /* This sets needs 3rd parameter to indicate additive mode * so they cannot be fully supported by this function */ if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) diff --git a/src/vm/short.c b/src/vm/short.c index 5ad3576e18..83a7719435 100644 --- a/src/vm/short.c +++ b/src/vm/short.c @@ -44,7 +44,7 @@ * */ -#include "hbapi.h" +#include "hbdefs.h" HB_FUNC_TRANSLATE( __CLASSINS, __CLASSINSTANCE ) HB_FUNC_TRANSLATE( __CLASSNAM, __CLASSNAME ) diff --git a/src/vm/strapi.c b/src/vm/strapi.c index 849af8fea7..22e962dcb4 100644 --- a/src/vm/strapi.c +++ b/src/vm/strapi.c @@ -1,5 +1,5 @@ /* - * string API functions + * String API functions * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -56,7 +56,7 @@ HB_SIZE hb_wstrlen( const HB_WCHAR * szText ) { HB_SIZE nLen = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrlen(%p)", szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrlen(%p)", ( const void * ) szText ) ); if( szText ) { @@ -71,7 +71,7 @@ HB_SIZE hb_wstrnlen( const HB_WCHAR * szText, HB_SIZE nCount ) { HB_SIZE nLen = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrnlen(%p,%" HB_PFS "u)", szText, nCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrnlen(%p,%" HB_PFS "u)", ( const void * ) szText, nCount ) ); if( szText ) { @@ -86,7 +86,7 @@ int hb_wstrcmp( const HB_WCHAR * s1, const HB_WCHAR * s2 ) { int rc = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrcmp(%p, %p)", s1, s2 ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrcmp(%p, %p)", ( const void * ) s1, ( const void * ) s2 ) ); for( ;; ) { @@ -109,7 +109,7 @@ int hb_wstrncmp( const HB_WCHAR * s1, const HB_WCHAR * s2, HB_SIZE nCount ) { int rc = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrncmp(%p, %p, %" HB_PFS "u)", s1, s2, nCount ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrncmp(%p, %p, %" HB_PFS "u)", ( const void * ) s1, ( const void * ) s2, nCount ) ); while( nCount-- ) { @@ -132,7 +132,7 @@ HB_WCHAR * hb_wstrncpy( HB_WCHAR * pDest, const HB_WCHAR * pSource, HB_SIZE nLen { HB_WCHAR * pBuf = pDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrncpy(%p, %p, %" HB_PFS "u)", pDest, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrncpy(%p, %p, %" HB_PFS "u)", ( void * ) pDest, ( const void * ) pSource, nLen ) ); pDest[ nLen ] = '\0'; @@ -146,7 +146,7 @@ HB_WCHAR * hb_wstrncat( HB_WCHAR * pDest, const HB_WCHAR * pSource, HB_SIZE nLen { HB_WCHAR * pBuf = pDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_strncat(%p, %p, %" HB_PFS "u)", pDest, pSource, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strncat(%p, %p, %" HB_PFS "u)", ( void * ) pDest, ( const void * ) pSource, nLen ) ); pDest[ nLen ] = '\0'; @@ -167,7 +167,7 @@ HB_WCHAR * hb_wstrdup( const HB_WCHAR * szText ) HB_WCHAR * pszDest; HB_SIZE nSize; - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrdup(%p)", szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrdup(%p)", ( const void * ) szText ) ); nSize = ( hb_wstrlen( szText ) + 1 ) * sizeof( HB_WCHAR ); pszDest = ( HB_WCHAR * ) hb_xgrab( nSize ); @@ -182,7 +182,7 @@ HB_WCHAR * hb_wstrndup( const HB_WCHAR * szText, HB_SIZE nLen ) HB_WCHAR * pszDest; HB_SIZE nSize; - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrndup(%p,%" HB_PFS "u)", szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrndup(%p,%" HB_PFS "u)", ( const void * ) szText, nLen ) ); nSize = hb_wstrlen( szText ); if( nSize < nLen ) @@ -197,7 +197,7 @@ HB_WCHAR * hb_wstrndup( const HB_WCHAR * szText, HB_SIZE nLen ) HB_WCHAR * hb_wstrunshare( void ** phStr, const HB_WCHAR * pStr, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrunshare(%p,%p,%" HB_PFS "u)", phStr, pStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrunshare(%p,%p,%" HB_PFS "u)", ( void * ) phStr, ( const void * ) pStr, nLen ) ); if( pStr == NULL || phStr == NULL || *phStr == NULL ) return NULL; @@ -221,7 +221,7 @@ HB_WCHAR * hb_wstrunshare( void ** phStr, const HB_WCHAR * pStr, HB_SIZE nLen ) char * hb_strunshare( void ** phStr, const char * pStr, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_strunshare(%p,%p,%" HB_PFS "u)", phStr, pStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strunshare(%p,%p,%" HB_PFS "u)", ( void * ) phStr, ( const void * ) pStr, nLen ) ); if( pStr == NULL || phStr == NULL || *phStr == NULL ) return NULL; @@ -244,14 +244,14 @@ char * hb_strunshare( void ** phStr, const char * pStr, HB_SIZE nLen ) const char * hb_strnull( const char * str ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_strnull(%p)", str ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strnull(%p)", ( const void * ) str ) ); return str ? str : ""; } const HB_WCHAR * hb_wstrnull( const HB_WCHAR * str ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_wstrnull(%p)", str ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_wstrnull(%p)", ( const void * ) str ) ); return str ? str : s_szConstStr; } @@ -269,7 +269,7 @@ void hb_strfree( void * hString ) const char * hb_itemGetStr( PHB_ITEM pItem, void * cdp, void ** phString, HB_SIZE * pnLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetStr(%p,%p,%p,%p)", pItem, cdp, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetStr(%p,%p,%p,%p)", ( void * ) pItem, cdp, ( void * ) phString, ( void * ) pnLen ) ); if( pItem && HB_IS_STRING( pItem ) ) { @@ -302,7 +302,7 @@ const char * hb_itemGetStr( PHB_ITEM pItem, void * cdp, void ** phString, HB_SIZ const char * hb_itemGetStrUTF8( PHB_ITEM pItem, void ** phString, HB_SIZE * pnLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetStrUTF8(%p,%p,%p)", pItem, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetStrUTF8(%p,%p,%p)", ( void * ) pItem, ( void * ) phString, ( void * ) pnLen ) ); if( pItem && HB_IS_STRING( pItem ) ) { @@ -343,7 +343,7 @@ const char * hb_itemGetStrUTF8( PHB_ITEM pItem, void ** phString, HB_SIZE * pnLe const HB_WCHAR * hb_itemGetStrU16( PHB_ITEM pItem, int iEndian, void ** phString, HB_SIZE * pnLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetStrU16(%p,%d,%p,%p)", pItem, iEndian, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemGetStrU16(%p,%d,%p,%p)", ( void * ) pItem, iEndian, ( void * ) phString, ( void * ) pnLen ) ); if( pItem && HB_IS_STRING( pItem ) ) { @@ -379,7 +379,7 @@ const HB_WCHAR * hb_itemGetStrU16( PHB_ITEM pItem, int iEndian, HB_SIZE hb_itemCopyStr( PHB_ITEM pItem, void * cdp, char * pStrBuffer, HB_SIZE nSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyStr(%p,%p,%p,%" HB_PFS "u)", pItem, cdp, pStrBuffer, nSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyStr(%p,%p,%p,%" HB_PFS "u)", ( void * ) pItem, cdp, ( void * ) pStrBuffer, nSize ) ); if( pItem && HB_IS_STRING( pItem ) ) { @@ -401,7 +401,7 @@ HB_SIZE hb_itemCopyStr( PHB_ITEM pItem, void * cdp, char * pStrBuffer, HB_SIZE n HB_SIZE hb_itemCopyStrUTF8( PHB_ITEM pItem, char * pStrBuffer, HB_SIZE nSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyStrUTF8(%p,%p,%" HB_PFS "u)", pItem, pStrBuffer, nSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyStrUTF8(%p,%p,%" HB_PFS "u)", ( void * ) pItem, ( void * ) pStrBuffer, nSize ) ); if( pItem && HB_IS_STRING( pItem ) ) { @@ -425,7 +425,7 @@ HB_SIZE hb_itemCopyStrUTF8( PHB_ITEM pItem, char * pStrBuffer, HB_SIZE nSize ) HB_SIZE hb_itemCopyStrU16( PHB_ITEM pItem, int iEndian, HB_WCHAR * pStrBuffer, HB_SIZE nSize ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyStrU16(%p,%d,%p,%" HB_PFS "u)", pItem, iEndian, pStrBuffer, nSize ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemCopyStrU16(%p,%d,%p,%" HB_PFS "u)", ( void * ) pItem, iEndian, ( void * ) pStrBuffer, nSize ) ); if( pItem && HB_IS_STRING( pItem ) ) { @@ -451,7 +451,7 @@ PHB_ITEM hb_itemPutStrLen( PHB_ITEM pItem, void * cdp, const char * pStr, HB_SIZ { char * pszText; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrLen(%p,%p,%p,%" HB_PFS "u)", pItem, cdp, pStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrLen(%p,%p,%p,%" HB_PFS "u)", ( void * ) pItem, cdp, ( const void * ) pStr, nLen ) ); if( nLen == 0 ) return hb_itemPutC( pItem, NULL ); @@ -467,7 +467,7 @@ PHB_ITEM hb_itemPutStrLenUTF8( PHB_ITEM pItem, const char * pStr, HB_SIZE nLen ) char * pszDest; HB_SIZE nDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrLenUTF8(%p,%p,%" HB_PFS "u)", pItem, pStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrLenUTF8(%p,%p,%" HB_PFS "u)", ( void * ) pItem, ( const void * ) pStr, nLen ) ); if( nLen == 0 ) return hb_itemPutC( pItem, NULL ); @@ -486,7 +486,7 @@ PHB_ITEM hb_itemPutStrLenU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr char * pszDest; HB_SIZE nDest; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrLenU16(%p,%d,%p,%" HB_PFS "u)", pItem, iEndian, pStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrLenU16(%p,%d,%p,%" HB_PFS "u)", ( void * ) pItem, iEndian, ( const void * ) pStr, nLen ) ); if( nLen == 0 ) return hb_itemPutC( pItem, NULL ); @@ -505,7 +505,7 @@ PHB_ITEM hb_itemPutStr( PHB_ITEM pItem, void * cdp, const char * pStr ) char * pszText; HB_SIZE nLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStr(%p,%p,%p)", pItem, cdp, pStr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStr(%p,%p,%p)", ( void * ) pItem, cdp, ( const void * ) pStr ) ); if( pStr == NULL ) return hb_itemPutC( pItem, NULL ); @@ -522,7 +522,7 @@ PHB_ITEM hb_itemPutStrUTF8( PHB_ITEM pItem, const char * pStr ) char * pszDest; HB_SIZE nDest, nLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrUTF8(%p,%p)", pItem, pStr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrUTF8(%p,%p)", ( void * ) pItem, ( const void * ) pStr ) ); if( pStr == NULL ) return hb_itemPutC( pItem, NULL ); @@ -542,7 +542,7 @@ PHB_ITEM hb_itemPutStrU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr ) char * pszDest; HB_SIZE nDest, nLen; - HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrU16(%p,%d,%p)", pItem, iEndian, pStr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutStrU16(%p,%d,%p)", ( void * ) pItem, iEndian, ( const void * ) pStr ) ); if( pStr == NULL ) return hb_itemPutC( pItem, NULL ); @@ -562,7 +562,7 @@ PHB_ITEM hb_itemPutStrU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr ) const char * hb_arrayGetStr( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, void ** phString, HB_SIZE * pnLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetStr(%p, %" HB_PFS "u, %p, %p, %p)", pArray, nIndex, cdp, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetStr(%p, %" HB_PFS "u, %p, %p, %p)", ( void * ) pArray, nIndex, cdp, ( void * ) phString, ( void * ) pnLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetStr( pArray->item.asArray.value->pItems + nIndex - 1, @@ -577,7 +577,7 @@ const char * hb_arrayGetStr( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, const char * hb_arrayGetStrUTF8( PHB_ITEM pArray, HB_SIZE nIndex, void ** phString, HB_SIZE * pnLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetStrUTF8(%p, %" HB_PFS "u, %p, %p)", pArray, nIndex, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetStrUTF8(%p, %" HB_PFS "u, %p, %p)", ( void * ) pArray, nIndex, ( void * ) phString, ( void * ) pnLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetStrUTF8( pArray->item.asArray.value->pItems + nIndex - 1, @@ -592,7 +592,7 @@ const char * hb_arrayGetStrUTF8( PHB_ITEM pArray, HB_SIZE nIndex, const HB_WCHAR * hb_arrayGetStrU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian, void ** phString, HB_SIZE * pnLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetStrU16(%p, %" HB_PFS "u, %d, %p, %p)", pArray, nIndex, iEndian, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arrayGetStrU16(%p, %" HB_PFS "u, %d, %p, %p)", ( void * ) pArray, nIndex, iEndian, ( void * ) phString, ( void * ) pnLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) return hb_itemGetStrU16( pArray->item.asArray.value->pItems + nIndex - 1, @@ -608,7 +608,7 @@ const HB_WCHAR * hb_arrayGetStrU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian HB_BOOL hb_arraySetStrLen( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, const char * pStr, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrLen(%p, %" HB_PFS "u, %p, %p, %" HB_PFS "u)", pArray, nIndex, cdp, pStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrLen(%p, %" HB_PFS "u, %p, %p, %" HB_PFS "u)", ( void * ) pArray, nIndex, cdp, ( const void * ) pStr, nLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -623,7 +623,7 @@ HB_BOOL hb_arraySetStrLen( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, HB_BOOL hb_arraySetStrLenUTF8( PHB_ITEM pArray, HB_SIZE nIndex, const char * pStr, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrLenUTF8(%p, %" HB_PFS "u, %p, %" HB_PFS "u)", pArray, nIndex, pStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrLenUTF8(%p, %" HB_PFS "u, %p, %" HB_PFS "u)", ( void * ) pArray, nIndex, ( const void * ) pStr, nLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -638,7 +638,7 @@ HB_BOOL hb_arraySetStrLenUTF8( PHB_ITEM pArray, HB_SIZE nIndex, HB_BOOL hb_arraySetStrLenU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian, const HB_WCHAR * pStr, HB_SIZE nLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrLenU16(%p, %" HB_PFS "u, %d, %p, %" HB_PFS "u)", pArray, nIndex, iEndian, pStr, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrLenU16(%p, %" HB_PFS "u, %d, %p, %" HB_PFS "u)", ( void * ) pArray, nIndex, iEndian, ( const void * ) pStr, nLen ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -653,7 +653,7 @@ HB_BOOL hb_arraySetStrLenU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian, HB_BOOL hb_arraySetStr( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, const char * pStr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStr(%p, %" HB_PFS "u, %p, %p)", pArray, nIndex, cdp, pStr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStr(%p, %" HB_PFS "u, %p, %p)", ( void * ) pArray, nIndex, cdp, ( const void * ) pStr ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -666,7 +666,7 @@ HB_BOOL hb_arraySetStr( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, const char HB_BOOL hb_arraySetStrUTF8( PHB_ITEM pArray, HB_SIZE nIndex, const char * pStr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrUTF8(%p, %" HB_PFS "u, %p)", pArray, nIndex, pStr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrUTF8(%p, %" HB_PFS "u, %p)", ( void * ) pArray, nIndex, ( const void * ) pStr ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -679,7 +679,7 @@ HB_BOOL hb_arraySetStrUTF8( PHB_ITEM pArray, HB_SIZE nIndex, const char * pStr ) HB_BOOL hb_arraySetStrU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian, const HB_WCHAR * pStr ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrU16(%p, %" HB_PFS "u, %d, %p)", pArray, nIndex, iEndian, pStr ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_arraySetStrU16(%p, %" HB_PFS "u, %d, %p)", ( void * ) pArray, nIndex, iEndian, ( const void * ) pStr ) ); if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen ) { @@ -697,7 +697,7 @@ const char * hb_parstr( int iParam, void * cdp, void ** phString, HB_SIZE * pnLe { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parstr(%d,%p,%p,%p)", iParam, cdp, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parstr(%d,%p,%p,%p)", iParam, cdp, ( void * ) phString, ( void * ) pnLen ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -720,7 +720,7 @@ const char * hb_parstr_utf8( int iParam, void ** phString, HB_SIZE * pnLen ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parstr_utf8(%d,%p,%p)", iParam, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parstr_utf8(%d,%p,%p)", iParam, ( void * ) phString, ( void * ) pnLen ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -744,7 +744,7 @@ const HB_WCHAR * hb_parstr_u16( int iParam, int iEndian, { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parstr_u16(%d,%d,%p,%p)", iParam, iEndian, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parstr_u16(%d,%d,%p,%p)", iParam, iEndian, ( void * ) phString, ( void * ) pnLen ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -769,7 +769,7 @@ const char * hb_parastr( int iParam, HB_SIZE nIndex, { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parastr(%d,%" HB_PFS "u,%p,%p,%p)", iParam, nIndex, cdp, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parastr(%d,%" HB_PFS "u,%p,%p,%p)", iParam, nIndex, cdp, ( void * ) phString, ( void * ) pnLen ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -796,7 +796,7 @@ const char * hb_parastr_utf8( int iParam, HB_SIZE nIndex, { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parastr_utf8(%d,%" HB_PFS "u,%p,%p)", iParam, nIndex, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parastr_utf8(%d,%" HB_PFS "u,%p,%p)", iParam, nIndex, ( void * ) phString, ( void * ) pnLen ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -823,7 +823,7 @@ const HB_WCHAR * hb_parastr_u16( int iParam, HB_SIZE nIndex, int iEndian, { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_parastr_u16(%d,%" HB_PFS "u,%d,%p,%p)", iParam, nIndex, iEndian, phString, pnLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_parastr_u16(%d,%" HB_PFS "u,%d,%p,%p)", iParam, nIndex, iEndian, ( void * ) phString, ( void * ) pnLen ) ); if( iParam >= -1 && iParam <= hb_pcount() ) { @@ -870,7 +870,7 @@ void hb_retstr_u16( int iEndian, const HB_WCHAR * szText ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_retstr_u16(%d,%p)", iEndian, szText ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_retstr_u16(%d,%p)", iEndian, ( const void * ) szText ) ); hb_itemPutStrLenU16( hb_stackReturnItem(), iEndian, szText, hb_wstrlen( szText ) ); @@ -881,7 +881,7 @@ void hb_retstrlen( void * cdp, const char * szText, HB_SIZE nLen ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_retstrlen(%p,%s,%" HB_PFS "u)", cdp, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_retstrlen(%p,%s,%" HB_PFS "u)", cdp, ( const void * ) szText, nLen ) ); hb_itemPutStrLen( hb_stackReturnItem(), cdp, szText, nLen ); } @@ -899,7 +899,7 @@ void hb_retstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE nLen ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_retstrlen_u16(%d,%p,%" HB_PFS "u)", iEndian, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_retstrlen_u16(%d,%p,%" HB_PFS "u)", iEndian, ( const void * ) szText, nLen ) ); hb_itemPutStrLenU16( hb_stackReturnItem(), iEndian, szText, nLen ); } @@ -909,7 +909,7 @@ int hb_storstr( void * cdp, const char * szText, int iParam ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_storstr(%p,%s,%d)", cdp, szText, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_storstr(%p,%s,%d)", cdp, ( const void * ) szText, iParam ) ); if( iParam == -1 ) { @@ -963,7 +963,7 @@ int hb_storstr_u16( int iEndian, const HB_WCHAR * szText, int iParam ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_storstr_u16(%d,%p,%d)", iEndian, szText, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_storstr_u16(%d,%p,%d)", iEndian, ( const void * ) szText, iParam ) ); if( iParam == -1 ) { @@ -991,7 +991,7 @@ int hb_storstrlen( void * cdp, const char * szText, HB_SIZE nLen, int iParam ) { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_storstrlen(%p,%s,%" HB_PFS "u,%d)", cdp, szText, nLen, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_storstrlen(%p,%s,%" HB_PFS "u,%d)", cdp, ( const void * ) szText, nLen, iParam ) ); if( iParam == -1 ) { @@ -1041,7 +1041,7 @@ int hb_storstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE nLen, int i { HB_STACK_TLS_PRELOAD - HB_TRACE( HB_TR_DEBUG, ( "hb_storstrlen_u16(%d,%p,%" HB_PFS "u,%d)", iEndian, szText, nLen, iParam ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_storstrlen_u16(%d,%p,%" HB_PFS "u,%d)", iEndian, ( const void * ) szText, nLen, iParam ) ); if( iParam == -1 ) { diff --git a/src/vm/task.c b/src/vm/task.c index 3740f9ffe9..3376ccbb9f 100644 --- a/src/vm/task.c +++ b/src/vm/task.c @@ -1,6 +1,6 @@ /* - * platform independent task system. It's used when when OS does not - * support threads + * Platform independent task system. It's used when when OS does not + * support threads * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -400,7 +400,7 @@ static void hb_taskFinalize( PHB_TASKINFO pTask ) #endif } - /* it cannot happen for runing threads */ + /* it cannot happen for running threads */ /* remove from mutex lockers queue */ if( pTask->locking ) diff --git a/src/vm/thread.c b/src/vm/thread.c index 74c0c63722..e703447acb 100644 --- a/src/vm/thread.c +++ b/src/vm/thread.c @@ -47,29 +47,29 @@ /* Harbour level API: - hb_threadStart( [ <nThreadAttrs>, ] <@sStart()> | <bStart> | <cStart> [, <params,...> ] ) -> <pThID> - hb_threadSelf() -> <pThID> | NIL - hb_threadID( [ <pThID> ] ) -> <nThNo> - hb_threadJoin( <pThID> [, @<xRetCode> ] ) -> <lOK> - hb_threadDetach( <pThID> ) -> <lOK> -* hb_threadQuitRequest( <pThID> ) -> <lOK> - hb_threadTerminateAll() -> NIL - hb_threadIsMain( [ <pThID> ] ) -> <lMainHvmThread> - hb_threadWaitForAll() -> NIL + hb_threadStart( [ <nThreadAttrs>, ] <@sStart()> | <bStart> | <cStart> [, <params,...> ] ) --> <pThID> + hb_threadSelf() --> <pThID> | NIL + hb_threadID( [ <pThID> ] ) --> <nThNo> + hb_threadJoin( <pThID> [, @<xRetCode> ] ) --> <lOK> + hb_threadDetach( <pThID> ) --> <lOK> +* hb_threadQuitRequest( <pThID> ) --> <lOK> + hb_threadTerminateAll() --> NIL + hb_threadIsMain( [ <pThID> ] ) --> <lMainHvmThread> + hb_threadWaitForAll() --> NIL hb_threadWait( <pThID> | <apThID>, [ <nTimeOut> ] [, <lAll> ] ) => <nThInd> | <nThCount> | 0 - hb_threadOnce( @<onceControl> [, <bAction> | <@sAction()> ] ) -> <lFirstCall> - hb_threadOnceInit( @<item>, <value> ) -> <lInitialized> - hb_mutexCreate() -> <pMtx> - hb_mutexExists( <pMtx> ) -> <lExists> - hb_mutexLock( <pMtx> [, <nTimeOut> ] ) -> <lLocked> - hb_mutexUnlock( <pMtx> ) -> <lOK> - hb_mutexNotify( <pMtx> [, <xVal>] ) -> NIL - hb_mutexNotifyAll( <pMtx> [, <xVal>] ) -> NIL - hb_mutexSubscribe( <pMtx>, [ <nTimeOut> ] [, @<xSubscribed> ] ) -> <lSubscribed> - hb_mutexSubscribeNow( <pMtx>, [ <nTimeOut> ] [, @<xSubscribed> ] ) -> <lSubscribed> - hb_mutexEval( <pMtx>, <bCode> | <@sFunc()> [, <params,...> ] ) -> <xCodeResult> -** hb_mutexQueueInfo( <pMtx>, [ @<nWaitersCount> ], [ @<nQueueLength> ] ) -> .T. - hb_mtvm() -> <lMultiThreadVM> + hb_threadOnce( @<onceControl> [, <bAction> | <@sAction()> ] ) --> <lFirstCall> + hb_threadOnceInit( @<item>, <value> ) --> <lInitialized> + hb_mutexCreate() --> <pMtx> + hb_mutexExists( <pMtx> ) --> <lExists> + hb_mutexLock( <pMtx> [, <nTimeOut> ] ) --> <lLocked> + hb_mutexUnlock( <pMtx> ) --> <lOK> + hb_mutexNotify( <pMtx> [, <xVal>] ) --> NIL + hb_mutexNotifyAll( <pMtx> [, <xVal>] ) --> NIL + hb_mutexSubscribe( <pMtx>, [ <nTimeOut> ] [, @<xSubscribed> ] ) --> <lSubscribed> + hb_mutexSubscribeNow( <pMtx>, [ <nTimeOut> ] [, @<xSubscribed> ] ) --> <lSubscribed> + hb_mutexEval( <pMtx>, <bCode> | <@sFunc()> [, <params,...> ] ) --> <xCodeResult> +** hb_mutexQueueInfo( <pMtx>, [ @<nWaitersCount> ], [ @<nQueueLength> ] ) --> .T. + hb_mtvm() --> <lMultiThreadVM> * - this function call can be ignored by the destination thread in some cases. HVM does not guaranties that the QUIT signal will be always @@ -300,7 +300,7 @@ void hb_threadReleaseCPU( void ) } /* the code below is simpler but seems that some Linux kernels - * (f.e. from Centos 5.1) have problems with nanosleep() + * (f.e. from CentOS 5.1) have problems with nanosleep() * so it was replaced by above code */ @@ -528,7 +528,7 @@ static HB_CRITICAL_NEW( s_atomicMtx ); void hb_atomic_set( volatile HB_COUNTER * pCounter, HB_COUNTER value ) { /* NOTE: on some platforms it may be necessary to protect this - * by cirtical section, f.e. when HB_COUNTER cannot be accessed + * by critical section, f.e. when HB_COUNTER cannot be accessed * using single memory access by CPU. */ *pCounter = value; @@ -537,7 +537,7 @@ void hb_atomic_set( volatile HB_COUNTER * pCounter, HB_COUNTER value ) HB_COUNTER hb_atomic_get( volatile HB_COUNTER * pCounter ) { /* NOTE: on some platforms it may be necessary to protect this - * by cirtical section, f.e. when HB_COUNTER cannot be accessed + * by critical section, f.e. when HB_COUNTER cannot be accessed * using single memory access by CPU. */ return *pCounter; @@ -859,7 +859,7 @@ HB_BOOL hb_threadJoin( HB_THREAD_HANDLE th_h ) return HB_FALSE; #elif defined( HB_OS_OS2 ) APIRET rc = DosWaitThread( &th_h, DCWW_WAIT ); - /* TOFIX: ERROR_INVALID_THREADID is a hack for failing DosWaitThread() + /* FIXME: ERROR_INVALID_THREADID is a hack for failing DosWaitThread() * when thread terminates before DosWaitThread() call. * OS2 users please check and fix this code if possible. */ @@ -1501,7 +1501,6 @@ HB_FUNC( HB_THREADWAIT ) #if defined( HB_MT_VM ) # define HB_THREAD_WAIT_ALLOC 16 HB_STACK_TLS_PRELOAD - HB_BOOL fAll; HB_ULONG ulMilliSec = HB_THREAD_INFINITE_WAIT; PHB_THREADSTATE * pThreads, pAlloc[ HB_THREAD_WAIT_ALLOC ]; int iThreads = -1; @@ -1538,6 +1537,8 @@ HB_FUNC( HB_THREADWAIT ) if( iThreads > 0 ) { + HB_BOOL fAll; + if( HB_ISNUM( 2 ) ) { double dTimeOut = hb_parnd( 2 ); @@ -1571,7 +1572,7 @@ HB_FUNC( HB_THREADTERMINATEALL ) #endif } -/* hb_threadOnce( @<onceControl> [, <bAction> ] ) -> <lFirstCall> +/* hb_threadOnce( @<onceControl> [, <bAction> ] ) --> <lFirstCall> * Execute <bAction> only once. <onceControl> is variable which holds * the execution status and have to be initialized to NIL. In most of * cases it will be simple static variable in user code. @@ -1582,7 +1583,7 @@ HB_FUNC( HB_THREADTERMINATEALL ) * If thread calls hb_threadOnce() with the same <onceControl> variable * recursively from <bAction> then hb_threadOnce() returns immediately * returning HB_FALSE without executing <bAction>. - * This function returns logical value indicating if it was 1-st call to + * This function returns logical value indicating if it was 1st call to * hb_threadOnce() for given <onceControl> variable */ HB_FUNC( HB_THREADONCE ) @@ -1634,7 +1635,7 @@ HB_FUNC( HB_THREADONCE ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -/* hb_threadOnceInit( @<item>, <value> ) -> <lInitialized> +/* hb_threadOnceInit( @<item>, <value> ) --> <lInitialized> * assign <value> to @<item> only if <item> is NIL */ HB_FUNC( HB_THREADONCEINIT ) diff --git a/src/vm/vm.c b/src/vm/vm.c index 2885185c27..61b9b84a61 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -44,10 +44,8 @@ * */ -/* -------------------------------------------------------- */ -/* Warning: VM functionality is not supported by Harbour. */ -/* All functions will emulate constant failure. */ -/* -------------------------------------------------------- */ +/* WARNING: VM functionality is not supported by Harbour. + All functions will emulate constant failure. */ #include "hbapi.h" diff --git a/utils/hbi18n/hbi18n.prg b/utils/hbi18n/hbi18n.prg index aeab4675f4..64a22a8a30 100644 --- a/utils/hbi18n/hbi18n.prg +++ b/utils/hbi18n/hbi18n.prg @@ -1,5 +1,5 @@ /* - * Harbour i18n .pot/.hbl file manger + * Harbour i18n .pot/.hbl file manager * * Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl> * @@ -48,9 +48,9 @@ #include "hbver.ch" #include "directry.ch" -#define _HB_I18N_MERGE 1 -#define _HB_I18N_GENHBL 2 -#define _HB_I18N_TRANS 3 +#define _HB_I18N_MERGE 1 +#define _HB_I18N_GENHBL 2 +#define _HB_I18N_TRANS 3 #define LEFTEQUAL( l, r ) ( Left( l, Len( r ) ) == r ) @@ -141,13 +141,17 @@ PROCEDURE Main( ... ) Logo() ENDIF - IF nMode == _HB_I18N_MERGE + SWITCH nMode + CASE _HB_I18N_MERGE Merge( aFiles, cFileOut ) - ELSEIF nMode == _HB_I18N_GENHBL + EXIT + CASE _HB_I18N_GENHBL GenHBL( aFiles, cFileOut, lEmpty ) - ELSEIF nMode == _HB_I18N_TRANS + EXIT + CASE _HB_I18N_TRANS AutoTrans( cFileIn, aFiles, cFileOut ) - ENDIF + EXIT + ENDSWITCH RETURN @@ -204,17 +208,15 @@ STATIC PROCEDURE ErrorMsg( cErrorMsg ) STATIC FUNCTION ExpandWildCards( aFiles ) -/* do not expand wild cards in environments where SHELL already does it. - * In *nixes it's possible that file name will contains "*" or "?". - */ +/* Do not expand wild cards in environments where SHELL already does it. + In *nixes it's possible that file name will contains "*" or "?". */ #ifndef __PLATFORM__UNIX LOCAL cFile, cRealFile LOCAL aRealFiles - LOCAL lWild + LOCAL lWild := .F. - lWild := .F. FOR EACH cFile IN aFiles IF "*" $ cFile .OR. "?" $ cFile lWild := .T. @@ -245,13 +247,11 @@ STATIC FUNCTION LoadFiles( aFiles ) LOCAL cErrorMsg LOCAL n - aTrans := __i18n_potArrayLoad( aFiles[ 1 ], @cErrorMsg ) - IF aTrans == NIL + IF ( aTrans := __i18n_potArrayLoad( aFiles[ 1 ], @cErrorMsg ) ) == NIL ErrorMsg( cErrorMsg ) ENDIF FOR n := 2 TO Len( aFiles ) - aTrans2 := __i18n_potArrayLoad( aFiles[ n ], @cErrorMsg ) - IF aTrans2 == NIL + IF ( aTrans2 := __i18n_potArrayLoad( aFiles[ n ], @cErrorMsg ) ) == NIL ErrorMsg( cErrorMsg ) ENDIF __i18n_potArrayJoin( aTrans, aTrans2, @hIndex ) diff --git a/utils/hbmk2/examples/plug_bis.hb b/utils/hbmk2/examples/plug_bis.hb index 762a9fcf29..ffe3526275 100644 --- a/utils/hbmk2/examples/plug_bis.hb +++ b/utils/hbmk2/examples/plug_bis.hb @@ -14,9 +14,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at https://www.gnu.org/). + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ diff --git a/utils/hbmk2/examples/plug_tpl.hb b/utils/hbmk2/examples/plug_tpl.hb index 40e7d4067b..8cfdbb4620 100644 --- a/utils/hbmk2/examples/plug_tpl.hb +++ b/utils/hbmk2/examples/plug_tpl.hb @@ -14,9 +14,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at https://www.gnu.org/). + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * (or visit their website at https://www.gnu.org/licenses/). * */ diff --git a/utils/hbmk2/hbmk2.hbp b/utils/hbmk2/hbmk2.hbp index 04a0cd74ac..c5db911974 100644 --- a/utils/hbmk2/hbmk2.hbp +++ b/utils/hbmk2/hbmk2.hbp @@ -1,3 +1,5 @@ +# Copyright 2009 Viktor Szakats (vszakats.net/harbour) + -q0 -w3 -es2 -kmo -l -u {HB_HAS_GPM}-prgflag=-DHB_HAS_GPM diff --git a/utils/hbmk2/pkg_dynl.hbm b/utils/hbmk2/pkg_dynl.hbm index 20018e0e06..e2e9dc05e1 100644 --- a/utils/hbmk2/pkg_dynl.hbm +++ b/utils/hbmk2/pkg_dynl.hbm @@ -1,3 +1,5 @@ +# Copyright 2012 Viktor Szakats (vszakats.net/harbour) + # dynamic lib creation settings {hbdyn}-shared {hbdyn}-implib=lib/${hb_plat}/${hb_comp}${hb_build}/ diff --git a/utils/hbmk2/pkg_inst.hbm b/utils/hbmk2/pkg_inst.hbm index 015a68caa7..1f8a4fad5f 100644 --- a/utils/hbmk2/pkg_inst.hbm +++ b/utils/hbmk2/pkg_inst.hbm @@ -1,3 +1,5 @@ +# Copyright 2012 Viktor Szakats (vszakats.net/harbour) + # Include file to setup standard installation rules # for 3rd party packages. To use it just add the line # '$hb_pkg_install.hbm' to the beginning of your project diff --git a/utils/hbtest/hbtest.prg b/utils/hbtest/hbtest.prg index e90ed737d1..5021877eeb 100644 --- a/utils/hbtest/hbtest.prg +++ b/utils/hbtest/hbtest.prg @@ -52,7 +52,7 @@ /* NOTE: It's worth to make tests with and without the /z switch */ /* NOTE: Guard all Harbour extensions with __HARBOUR__ #ifdefs */ /* NOTE: Use ":className()" instead of ":className" to make your code work - with Xbase++. Xbase++ seem to take differenciate between the + with Xbase++. Xbase++ seem to take differentiate between the object method and object variable form. In CA-Cl*pper and Harbour both syntax is accepted. Same goes for ":Eval()" */ @@ -61,7 +61,7 @@ /* TODO: Incorporate tests from test/working/string*.prg */ /* TODO: String overflow on + and - tests */ /* TODO: Tests with MEMO type ? */ -/* TODO: Tests with Log(0) type of invalid values */ +/* TODO: Tests with Log( 0 ) type of invalid values */ #include "rt_main.ch" @@ -123,12 +123,12 @@ PROCEDURE Main( cPar1, cPar2, cPar3 ) "-help" $ Lower( cPar1 ) .OR. ; "--help" $ Lower( cPar1 ) - OutStd( hb_eol() +; - "Syntax: hbtest [options]" + hb_eol() +; - hb_eol() +; - "Options: -h, -? Display this help." + hb_eol() +; - " -all Display all tests, not only the failures." + hb_eol() +; - " -noalt Ignore alternative results." + hb_eol() +; + OutStd( hb_eol() + ; + "Syntax: hbtest [options]" + hb_eol() + ; + hb_eol() + ; + "Options: -h, -? Display this help." + hb_eol() + ; + " -all Display all tests, not only the failures." + hb_eol() + ; + " -noalt Ignore alternative results." + hb_eol() + ; " -skip:<list> Skip the listed test numbers." + hb_eol() ) RETURN @@ -198,7 +198,7 @@ STATIC PROCEDURE Main_LAST() STATIC PROCEDURE TEST_BEGIN( cParam ) - LOCAL bErrorOld + LOCAL bOldError s_nStartTime := Seconds() @@ -209,7 +209,7 @@ STATIC PROCEDURE TEST_BEGIN( cParam ) hb_langSelect( "en" ) #endif Set( _SET_DATEFORMAT, "yyyy-mm-dd" ) - SET EXACT OFF + Set( _SET_EXACT, .F. ) FErase( "NOT_HERE.$$$" ) @@ -244,7 +244,7 @@ STATIC PROCEDURE TEST_BEGIN( cParam ) /* Feedback */ OutMsg( s_nFhnd, ; - "---------------------------------------------------------------------------" + hb_eol() +; + Replicate( "-", 75 ) + hb_eol() + ; " Version: " + Version() + hb_eol() ) #ifdef __HARBOUR__ OutMsg( s_nFhnd, ; @@ -255,7 +255,7 @@ STATIC PROCEDURE TEST_BEGIN( cParam ) " Date, Time: " + DToC( Date() ) + " " + Time() + hb_eol() +; "Shortcut opt.: " + iif( s_lShortcut, "On", "Off" ) + hb_eol() +; " Switches: " + cParam + hb_eol() +; - "===========================================================================" + hb_eol() ) + Replicate( "=", 75 ) + hb_eol() ) OutMsg( s_nFhnd, ; PadR( "R", TEST_RESULT_COL1_WIDTH ) + " " +; @@ -263,7 +263,7 @@ STATIC PROCEDURE TEST_BEGIN( cParam ) PadR( "TestCall()", TEST_RESULT_COL3_WIDTH ) + " -> " +; PadR( "Result", TEST_RESULT_COL4_WIDTH ) + " | " +; "Expected" + hb_eol() +; - "---------------------------------------------------------------------------" + hb_eol() ) + Replicate( "-", 75 ) + hb_eol() ) /* NOTE: mxNotHere intentionally not declared */ PUBLIC mcLongerNameThen10Chars := "Long String Name!" @@ -294,20 +294,20 @@ STATIC PROCEDURE TEST_BEGIN( cParam ) // rddSetDefault( "DBFCDX" ) #endif - bErrorOld := ErrorBlock( {| oError | Break( oError ) } ) + bOldError := ErrorBlock( {| oError | Break( oError ) } ) BEGIN SEQUENCE dbCreate( "_hbtmp_.dbf", { ; - { "TYPE_C" , "C", 15, 0 } ,; - { "TYPE_C_E" , "C", 15, 0 } ,; - { "TYPE_D" , "D", 8, 0 } ,; - { "TYPE_D_E" , "D", 8, 0 } ,; - { "TYPE_M" , "M", 10, 0 } ,; - { "TYPE_M_E" , "M", 10, 0 } ,; - { "TYPE_N_I" , "N", 11, 0 } ,; - { "TYPE_N_IE", "N", 11, 0 } ,; - { "TYPE_N_D" , "N", 11, 3 } ,; - { "TYPE_N_DE", "N", 11, 3 } ,; - { "TYPE_L" , "L", 1, 0 } ,; + { "TYPE_C" , "C", 15, 0 }, ; + { "TYPE_C_E" , "C", 15, 0 }, ; + { "TYPE_D" , "D", 8, 0 }, ; + { "TYPE_D_E" , "D", 8, 0 }, ; + { "TYPE_M" , "M", 10, 0 }, ; + { "TYPE_M_E" , "M", 10, 0 }, ; + { "TYPE_N_I" , "N", 11, 0 }, ; + { "TYPE_N_IE", "N", 11, 0 }, ; + { "TYPE_N_D" , "N", 11, 3 }, ; + { "TYPE_N_DE", "N", 11, 3 }, ; + { "TYPE_L" , "L", 1, 0 }, ; { "TYPE_L_E" , "L", 1, 0 } } ) USE ( "_hbtmp_.dbf" ) NEW ALIAS w_TEST EXCLUSIVE @@ -329,10 +329,10 @@ STATIC PROCEDURE TEST_BEGIN( cParam ) s_lDBFAvail := .T. END SEQUENCE - ErrorBlock( bErrorOld ) + ErrorBlock( bOldError ) IF ! s_lDBFAvail - OutMsg( s_nFhnd, "WARNING ! Test .dbf could not be created. Related tests will be skipped." + hb_eol() ) + OutMsg( s_nFhnd, "WARNING: Test .dbf could not be created. Related tests will be skipped." + hb_eol() ) ENDIF RETURN @@ -384,28 +384,27 @@ PROCEDURE TEST_CALL( cBlock, bBlock, xResultExpected, xResultAlter ) IF lFailed .AND. ! s_lNoAltResult .AND. PCount() >= 4 lFailed := ResultCompare( lRTE, xResult, xResultAlter ) ENDIF - ENDIF IF s_lShowAll .OR. lFailed .OR. lSkipped .OR. lPPError IF lFailed OutMsg( s_nFhnd, ; - PadR( iif( lFailed, "!", iif( lSkipped, "S", " " ) ), TEST_RESULT_COL1_WIDTH ) + " " +; - PadR( Str( s_nCount, 4 ) + " " + ProcName( 1 ) + "(" + LTrim( Str( ProcLine( 1 ), 5 ) ) + ")", TEST_RESULT_COL2_WIDTH ) + " " +; - RTrim( cBlock ) +; - hb_eol() +; - Space( 5 ) + " Result: " + XToStr( xResult ) +; - hb_eol() +; - Space( 5 ) + "Expected: " + XToStr( xResultExpected ) +; + PadR( iif( lFailed, "!", iif( lSkipped, "S", " " ) ), TEST_RESULT_COL1_WIDTH ) + " " + ; + PadR( Str( s_nCount, 4 ) + " " + ProcName( 1 ) + "(" + LTrim( Str( ProcLine( 1 ), 5 ) ) + ")", TEST_RESULT_COL2_WIDTH ) + " " + ; + RTrim( cBlock ) + ; + hb_eol() + ; + Space( 5 ) + " Result: " + XToStr( xResult ) + ; + hb_eol() + ; + Space( 5 ) + "Expected: " + XToStr( xResultExpected ) + ; hb_eol() ) ELSE OutMsg( s_nFhnd, ; - PadR( iif( lFailed, "!", iif( lSkipped, "S", " " ) ), TEST_RESULT_COL1_WIDTH ) + " " +; - PadR( Str( s_nCount, 4 ) + " " + ProcName( 1 ) + "(" + LTrim( Str( ProcLine( 1 ), 5 ) ) + ")", TEST_RESULT_COL2_WIDTH ) + " " +; - PadR( cBlock, TEST_RESULT_COL3_WIDTH ) + " -> " +; - PadR( XToStr( xResult ), TEST_RESULT_COL4_WIDTH ) + " | " +; - RTrim( XToStr( xResultExpected ) ) +; + PadR( iif( lFailed, "!", iif( lSkipped, "S", " " ) ), TEST_RESULT_COL1_WIDTH ) + " " + ; + PadR( Str( s_nCount, 4 ) + " " + ProcName( 1 ) + "(" + LTrim( Str( ProcLine( 1 ), 5 ) ) + ")", TEST_RESULT_COL2_WIDTH ) + " " + ; + PadR( cBlock, TEST_RESULT_COL3_WIDTH ) + " -> " + ; + PadR( XToStr( xResult ), TEST_RESULT_COL4_WIDTH ) + " | " + ; + RTrim( XToStr( xResultExpected ) ) + ; hb_eol() ) ENDIF ENDIF @@ -433,22 +432,22 @@ STATIC PROCEDURE TEST_END() s_nEndTime := Seconds() OutMsg( s_nFhnd, ; - "===========================================================================" + hb_eol() +; - "Test calls passed: " + Str( s_nPass ) + " ( " + LTrim( Str( ( 1 - ( s_nFail / s_nPass ) ) * 100, 6, 2 ) ) + " % )" + hb_eol() +; - "Test calls failed: " + Str( s_nFail ) + " ( " + LTrim( Str( ( s_nFail / s_nPass ) * 100, 6, 2 ) ) + " % )" + hb_eol() +; - " ----------" + hb_eol() +; - " Total: " + Str( s_nPass + s_nFail ) +; - " ( Time elapsed: " + LTrim( Str( s_nEndTime - s_nStartTime ) ) + " seconds )" + hb_eol() +; + Replicate( "=", 75 ) + hb_eol() + ; + "Test calls passed: " + Str( s_nPass ) + " ( " + LTrim( Str( ( 1 - ( s_nFail / s_nPass ) ) * 100, 6, 2 ) ) + " % )" + hb_eol() + ; + "Test calls failed: " + Str( s_nFail ) + " ( " + LTrim( Str( ( s_nFail / s_nPass ) * 100, 6, 2 ) ) + " % )" + hb_eol() + ; + " ----------" + hb_eol() + ; + " Total: " + Str( s_nPass + s_nFail ) + ; + " ( Time elapsed: " + LTrim( Str( s_nEndTime - s_nStartTime ) ) + " seconds )" + hb_eol() + ; hb_eol() ) IF s_nFail != 0 IF "CLIPPER (R)" $ Upper( Version() ) OutMsg( s_nFhnd, ; - "WARNING ! Failures detected using CA-Cl*pper." + hb_eol() +; + "WARNING: Failures detected using CA-Cl*pper." + hb_eol() + ; "Please fix those expected results which are not bugs in CA-Cl*pper itself." + hb_eol() ) ELSE OutMsg( s_nFhnd, ; - "WARNING ! Failures detected" + hb_eol() ) + "WARNING: Failures detected" + hb_eol() ) ENDIF ENDIF @@ -462,23 +461,15 @@ STATIC PROCEDURE TEST_END() FUNCTION ResultCompare( lRTE, xResult, xResultExpected ) - LOCAL lFailed - IF lRTE - lFailed := !( XToStr( xResult ) == XToStr( xResultExpected ) ) - ELSE - IF !( ValType( xResult ) == ValType( xResultExpected ) ) - IF ValType( xResultExpected ) == "C" .AND. ValType( xResult ) $ "ABMO" - lFailed := !( XToStr( xResult ) == xResultExpected ) - ELSE - lFailed := .T. - ENDIF - ELSE - lFailed := !( xResult == xResultExpected ) - ENDIF + RETURN ! XToStr( xResult ) == XToStr( xResultExpected ) + ELSEIF ValType( xResult ) == ValType( xResultExpected ) + RETURN ! xResult == xResultExpected + ELSEIF ValType( xResultExpected ) == "C" .AND. ValType( xResult ) $ "ABMO" + RETURN ! XToStr( xResult ) == xResultExpected ENDIF - RETURN lFailed + RETURN .T. FUNCTION XToStr( xValue ) @@ -523,7 +514,7 @@ FUNCTION XToStrE( xValue ) RETURN xValue CASE cType == "N" ; RETURN LTrim( Str( xValue ) ) - CASE cType == "D" ; RETURN "0d" + iif( Empty( xValue ), "00000000", DToS( xValue ) ) + CASE cType == "D" ; RETURN "0d" + iif( Empty( xValue ), "0", DToS( xValue ) ) CASE cType == "L" ; RETURN iif( xValue, ".T.", ".F." ) CASE cType == "O" ; RETURN xValue:className() + " Object" CASE cType == "U" ; RETURN "NIL" @@ -685,9 +676,9 @@ FUNCTION hb_SToD( cDate ) FUNCTION hb_SToD( s ) - LOCAL cDf := Set( _SET_DATEFORMAT, "YYYY/MM/DD" ), dt + LOCAL cDf := Set( _SET_DATEFORMAT, "yyyy-mm-dd" ), dt - dt := CToD( Stuff( Stuff( s, 7, 0, "/" ), 5, 0, "/" ) ) + dt := CToD( Stuff( Stuff( s, 7, 0, "-" ), 5, 0, "-" ) ) Set( _SET_DATEFORMAT, cDf ) RETURN dt @@ -705,13 +696,14 @@ STATIC FUNCTION BADFNAME() STATIC PROCEDURE OutMsg( hFile, cMsg ) - IF hFile == 1 + DO CASE + CASE hFile == 1 OutStd( cMsg ) - ELSEIF hFile == 2 + CASE hFile == 2 OutErr( cMsg ) - ELSE + OTHERWISE FWrite( hFile, cMsg ) - ENDIF + ENDCASE RETURN diff --git a/utils/hbtest/rt_class.prg b/utils/hbtest/rt_class.prg index 2745bce41a..1b9b8107fe 100644 --- a/utils/hbtest/rt_class.prg +++ b/utils/hbtest/rt_class.prg @@ -1093,13 +1093,14 @@ STATIC FUNCTION INSTANCE_DATA( oValue ) cData := "[" + hb_ntos( Len( oValue ) ) + "]:" FOR i := 1 TO Len( oValue ) - IF HB_ISSTRING( oValue[ i ] ) + DO CASE + CASE HB_ISSTRING( oValue[ i ] ) cData += " " + oValue[ i ] - ELSEIF oValue[ i ] == NIL + CASE oValue[ i ] == NIL cData += " NIL" - ELSE + OTHERWISE cData += " ..." - ENDIF + ENDCASE NEXT RETURN cData @@ -1113,25 +1114,27 @@ EXPORTED: CLASS VAR var2 METHOD init DESTRUCTOR dtor -END CLASS +ENDCLASS METHOD INIT( type ) CLASS DTORCLASS ::type := type RETURN self METHOD PROCEDURE DTOR CLASS DTORCLASS - IF ::type == 1 + + DO CASE + CASE ::Type == 1 cDtorResult += "Reference to self in instance variable." ::var1 := self - ELSEIF ::Type == 2 + CASE ::Type == 2 cDtorResult += "Reference to self in class variable." ::var2 := self - ELSEIF ::Type == 3 + CASE ::Type == 3 cDtorResult += "Reference to self in private memvar." objHolder := self - ELSE + OTHERWISE cDtorResult += "No references to self." - ENDIF + ENDCASE RETURN @@ -1142,28 +1145,28 @@ EXPORTED: VAR x1 INIT "(x1)" VAR y1 INIT "(y1)" VAR z1 INIT "(z1)" -END CLASS +ENDCLASS -CREATE CLASS IVARSCLASS2 FROM IVARSCLASS1 +CREATE CLASS IVARSCLASS2 INHERIT IVARSCLASS1 EXPORTED: VAR x2 INIT "(x2)" VAR y2 INIT "(y2)" VAR z2 INIT "(z2)" -END CLASS +ENDCLASS -CREATE CLASS IVARSCLASS3 FROM IVARSCLASS1, IVARSCLASS2 +CREATE CLASS IVARSCLASS3 INHERIT IVARSCLASS1, IVARSCLASS2 EXPORTED: VAR x3 INIT "(x3)" VAR y3 INIT "(y3)" VAR z3 INIT "(z3)" -END CLASS +ENDCLASS -CREATE CLASS IVARSCLASS4 FROM IVARSCLASS3, IVARSCLASS2 +CREATE CLASS IVARSCLASS4 INHERIT IVARSCLASS3, IVARSCLASS2 EXPORTED: VAR x4 INIT "(x4)" VAR y4 INIT "(y4)" VAR z4 INIT "(z4)" -END CLASS +ENDCLASS @@ -1172,28 +1175,28 @@ EXPORTED: CLASS VAR x1 INIT "(x1)" CLASS VAR y1 INIT "(y1)" CLASS VAR z1 INIT "(z1)" -END CLASS +ENDCLASS -CREATE CLASS CVARSCLASS2 FROM CVARSCLASS1 +CREATE CLASS CVARSCLASS2 INHERIT CVARSCLASS1 EXPORTED: CLASS VAR x2 INIT "(x2)" CLASS VAR y2 INIT "(y2)" CLASS VAR z2 INIT "(z2)" -END CLASS +ENDCLASS -CREATE CLASS CVARSCLASS3 FROM CVARSCLASS1, CVARSCLASS2 +CREATE CLASS CVARSCLASS3 INHERIT CVARSCLASS1, CVARSCLASS2 EXPORTED: CLASS VAR x3 INIT "(x3)" CLASS VAR y3 INIT "(y3)" CLASS VAR z3 INIT "(z3)" -END CLASS +ENDCLASS -CREATE CLASS CVARSCLASS4 FROM CVARSCLASS3, CVARSCLASS2 +CREATE CLASS CVARSCLASS4 INHERIT CVARSCLASS3, CVARSCLASS2 EXPORTED: CLASS VAR x4 INIT "(x4)" CLASS VAR y4 INIT "(y4)" CLASS VAR z4 INIT "(z4)" -END CLASS +ENDCLASS @@ -1204,21 +1207,21 @@ EXPORTED: CLASS VAR z1 INIT "(z1)" SHARED ENDCLASS -CREATE CLASS SVARSCLASS2 FROM SVARSCLASS1 +CREATE CLASS SVARSCLASS2 INHERIT SVARSCLASS1 EXPORTED: CLASS VAR x2 INIT "(x2)" SHARED CLASS VAR y2 INIT "(y2)" SHARED CLASS VAR z2 INIT "(z2)" SHARED ENDCLASS -CREATE CLASS SVARSCLASS3 FROM SVARSCLASS1, SVARSCLASS2 +CREATE CLASS SVARSCLASS3 INHERIT SVARSCLASS1, SVARSCLASS2 EXPORTED: CLASS VAR x3 INIT "(x3)" SHARED CLASS VAR y3 INIT "(y3)" SHARED CLASS VAR z3 INIT "(z3)" SHARED ENDCLASS -CREATE CLASS SVARSCLASS4 FROM SVARSCLASS3, SVARSCLASS2 +CREATE CLASS SVARSCLASS4 INHERIT SVARSCLASS3, SVARSCLASS2 EXPORTED: CLASS VAR x4 INIT "(x4)" SHARED CLASS VAR y4 INIT "(y4)" SHARED @@ -1246,7 +1249,6 @@ EXPORTED: ENDCLASS METHOD m1 CLASS NVCLASS1 - RETURN "NVCLASS1:M1 " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1260,7 +1262,6 @@ METHOD m1 CLASS NVCLASS1 ::z() METHOD x CLASS NVCLASS1 - RETURN "NVCLASS1:X " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1271,7 +1272,6 @@ METHOD x CLASS NVCLASS1 hb_CStr( ::v ) METHOD y CLASS NVCLASS1 - RETURN "NVCLASS1:Y " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1282,7 +1282,6 @@ METHOD y CLASS NVCLASS1 hb_CStr( ::v ) METHOD z CLASS NVCLASS1 - RETURN "NVCLASS1:Z " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1313,7 +1312,6 @@ EXPORTED: ENDCLASS METHOD m2 CLASS NVCLASS2 - RETURN "NVCLASS2:M2 " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1327,7 +1325,6 @@ METHOD m2 CLASS NVCLASS2 ::z() METHOD x CLASS NVCLASS2 - RETURN "NVCLASS2:X " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1338,7 +1335,6 @@ METHOD x CLASS NVCLASS2 hb_CStr( ::v ) METHOD y CLASS NVCLASS2 - RETURN "NVCLASS2:Y " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1349,7 +1345,6 @@ METHOD y CLASS NVCLASS2 hb_CStr( ::v ) METHOD z CLASS NVCLASS2 - RETURN "NVCLASS2:Z " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1360,7 +1355,7 @@ METHOD z CLASS NVCLASS2 hb_CStr( ::v ) -CREATE CLASS NVCLASS3 FROM NVCLASS1, NVCLASS2 +CREATE CLASS NVCLASS3 INHERIT NVCLASS1, NVCLASS2 HIDDEN: VAR a init "(a3)" CLASS VAR b init "(b3)" @@ -1381,7 +1376,6 @@ EXPORTED: ENDCLASS METHOD m3 CLASS NVCLASS3 - RETURN "NVCLASS3:M3 " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1395,7 +1389,6 @@ METHOD m3 CLASS NVCLASS3 ::z() METHOD x CLASS NVCLASS3 - RETURN "NVCLASS3:X " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1406,7 +1399,6 @@ METHOD x CLASS NVCLASS3 hb_CStr( ::v ) METHOD y CLASS NVCLASS3 - RETURN "NVCLASS3:Y " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1417,7 +1409,6 @@ METHOD y CLASS NVCLASS3 hb_CStr( ::v ) METHOD z CLASS NVCLASS3 - RETURN "NVCLASS3:Z " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; @@ -1428,12 +1419,11 @@ METHOD z CLASS NVCLASS3 hb_CStr( ::v ) -CREATE CLASS NVCLASS4 FROM NVCLASS3 +CREATE CLASS NVCLASS4 INHERIT NVCLASS3 METHOD m4 ENDCLASS -METHOD m4 - +METHOD m4 CLASS NVCLASS4 RETURN "NVCLASS4:M4 " + ; hb_CStr( ::a ) + " " + ; hb_CStr( ::b ) + " " + ; diff --git a/utils/hbtest/rt_file.prg b/utils/hbtest/rt_file.prg index e2683c0c6a..2f379f7d1b 100644 --- a/utils/hbtest/rt_file.prg +++ b/utils/hbtest/rt_file.prg @@ -57,15 +57,13 @@ PROCEDURE Main_FILE() LOCAL cFileName := "$$FILEIO.TMP" - LOCAL nFlags LOCAL cBuff4 := Space( 4 ) LOCAL cBuff100 := Space( 100 ) LOCAL fhnd - nFlags := FC_NORMAL - fhnd := FCreate( cFileName, nFlags ) + fhnd := FCreate( cFileName ) HBTEST FError() IS 0 HBTEST TESTFIER( FWrite( fhnd, ">1234567890<" ) ) IS "E: 0 R: 12" @@ -134,8 +132,7 @@ PROCEDURE Main_FILE() HBTEST TESTFIER( FRename( "NOT_HERE.$$$", 'A' ) ) IS 'E: 2 R: -1' HBTEST TESTFIER( FOpen( "NOT_HERE.$$$" ) ) IS 'E: 2 R: -1' - nFlags := FO_READWRITE - fhnd := FOpen( cFileName, nFlags ) + fhnd := FOpen( cFileName, FO_READWRITE ) HBTEST FError() IS 0 HBTEST TESTFIER( FWrite( fhnd, ">1234567890<" ) ) IS "E: 0 R: 12" diff --git a/utils/hbtest/rt_hvm.prg b/utils/hbtest/rt_hvm.prg index 65ff225871..cbebc60848 100644 --- a/utils/hbtest/rt_hvm.prg +++ b/utils/hbtest/rt_hvm.prg @@ -383,7 +383,7 @@ PROCEDURE Main_HVM() /* =, == */ - SET EXACT ON + Set( _SET_EXACT, .T. ) HBTEST "123" = "123 " IS .T. HBTEST " 123" = "123" IS .F. HBTEST "123" = "12345" IS .F. @@ -394,7 +394,7 @@ PROCEDURE Main_HVM() HBTEST "Z" == "A" IS .F. HBTEST "A" == "A " IS .F. HBTEST "AA" == "A" IS .F. - SET EXACT OFF + Set( _SET_EXACT, .F. ) HBTEST "123" = "123 " IS .F. HBTEST " 123" = "123" IS .F. HBTEST "123" = "12345" IS .F. @@ -426,7 +426,7 @@ PROCEDURE Main_HVM() /* != */ - SET EXACT ON + Set( _SET_EXACT, .T. ) HBTEST "123" != "123 " IS .F. HBTEST " 123" != "123" IS .T. HBTEST "123" != "12345" IS .T. @@ -437,7 +437,7 @@ PROCEDURE Main_HVM() HBTEST "Z" != "A" IS .T. HBTEST "A" != "A " IS .F. HBTEST "AA" != "A" IS .T. - SET EXACT OFF + Set( _SET_EXACT, .F. ) HBTEST "123" != "123 " IS .T. HBTEST " 123" != "123" IS .T. HBTEST "123" != "12345" IS .T. diff --git a/utils/hbtest/rt_hvma.prg b/utils/hbtest/rt_hvma.prg index 5318ffd678..774d921eac 100644 --- a/utils/hbtest/rt_hvma.prg +++ b/utils/hbtest/rt_hvma.prg @@ -235,13 +235,13 @@ PROCEDURE Main_HVMA() #ifdef __HARBOUR__ #pragma -kh- #endif - HBTEST "" $ "" IS .T. /* Bug in CA-Cl*ppers compiler optimizer. It should return .F. */ - HBTEST "" $ "bcde" IS .T. /* Bug in CA-Cl*ppers compiler optimizer. It should return .F. */ + HBTEST "" $ "" IS .T. /* Bug in CA-Cl*pper compiler optimizer. It should return .F. */ + HBTEST "" $ "bcde" IS .T. /* Bug in CA-Cl*pper compiler optimizer. It should return .F. */ #ifdef __HARBOUR__ /* enable Harbour extensions and test correct results results */ #pragma -kh+ - HBTEST "" $ "" IS .F. /* Bug in CA-Cl*ppers compiler optimizer. It should return .F. */ - HBTEST "" $ "bcde" IS .F. /* Bug in CA-Cl*ppers compiler optimizer. It should return .F. */ + HBTEST "" $ "" IS .F. /* Bug in CA-Cl*pper compiler optimizer. It should return .F. */ + HBTEST "" $ "bcde" IS .F. /* Bug in CA-Cl*pper compiler optimizer. It should return .F. */ #endif HBTEST "d" $ "bcde" IS .T. HBTEST "D" $ "BCDE" IS .T. @@ -305,14 +305,14 @@ PROCEDURE Main_HVMA() HBTEST .T. .AND. 1 IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.T.;N:1 F:S" HBTEST .T. .AND. 1.567 IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.T.;N:1.567 F:S" HBTEST .T. .AND. scString IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.T.;C:HELLO F:S" - HBTEST .T. .AND. hb_SToD( "" ) IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.T.;D:0d00000000 F:S" + HBTEST .T. .AND. hb_SToD( "" ) IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.T.;D:0d0 F:S" HBTEST .T. .AND. NIL IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.T.;U:NIL F:S" HBTEST .T. .AND. {} IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.T.;A:{.[0].} F:S" HBTEST .T. .AND. {|| NIL } IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.T.;B:{||...} F:S" HBTEST .F. .AND. 1 IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.F.;N:1 F:S" HBTEST .F. .AND. 1.567 IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.F.;N:1.567 F:S" HBTEST .F. .AND. scString IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.F.;C:HELLO F:S" - HBTEST .F. .AND. hb_SToD( "" ) IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.F.;D:0d00000000 F:S" + HBTEST .F. .AND. hb_SToD( "" ) IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.F.;D:0d0 F:S" HBTEST .F. .AND. NIL IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.F.;U:NIL F:S" HBTEST .F. .AND. {} IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.F.;A:{.[0].} F:S" HBTEST .F. .AND. {|| NIL } IS "E 1 BASE 1078 Argument error (.AND.) OS:0 #:0 A:2:L:.F.;B:{||...} F:S" @@ -386,7 +386,7 @@ PROCEDURE Main_HVMA() HBTEST (NIL)->NOFIELD IS "E 1 BASE 1065 Argument error (&) OS:0 #:0 A:2:U:NIL;C:NOFIELD F:S" HBTEST (2)->NOFIELD IS "E 14 BASE 1003 Variable does not exist (NOFIELD) OS:0 #:1 F:R" HBTEST (2.5)->NOFIELD IS "E 14 BASE 1003 Variable does not exist (NOFIELD) OS:0 #:1 F:R" - HBTEST (hb_SToD( "" ))->NOFIELD IS "E 1 BASE 1065 Argument error (&) OS:0 #:0 A:2:D:0d00000000;C:NOFIELD F:S" + HBTEST (hb_SToD( "" ))->NOFIELD IS "E 1 BASE 1065 Argument error (&) OS:0 #:0 A:2:D:0d0;C:NOFIELD F:S" HBTEST (ErrorNew())->NOFIELD IS "E 1 BASE 1065 Argument error (&) OS:0 #:0 A:2:O:ERROR Object;C:NOFIELD F:S" #ifndef __XPP__ @@ -633,7 +633,7 @@ PROCEDURE Main_HVMA() RETURN -FUNCTION RTSTR( nValue ) +STATIC FUNCTION RTSTR( nValue ) RETURN Str( Len( Str( nValue ) ), 3 ) + " " + Str( nValue ) /* Don't change the position of this #include. */ diff --git a/utils/hbtest/rt_misc.prg b/utils/hbtest/rt_misc.prg index 09cc703048..f697c2b0ce 100644 --- a/utils/hbtest/rt_misc.prg +++ b/utils/hbtest/rt_misc.prg @@ -83,7 +83,7 @@ PROCEDURE Main_MISC() HBTEST Set( _SET_MARGIN , -1 ) IS "E 1 BASE 2020 Argument error (SET) OS:0 #:0 A:2:N:25;N:-1 " #ifdef HB_COMPAT_C53 - HBTEST Set( _SET_EVENTMASK ) IS 128 + HBTEST Set( _SET_EVENTMASK ) IS 128 /* INKEY_KEYBOARD */ HBTEST Set( _SET_VIDEOMODE ) IS NIL, 0 HBTEST Set( _SET_MBLOCKSIZE ) IS 64 HBTEST Set( _SET_MFILEEXT ) IS "" @@ -537,7 +537,7 @@ PROCEDURE Main_MISC() HBTEST suNIL:Eval() IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:U:NIL F:S" HBTEST scString:Eval() IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:C:HELLO F:S" HBTEST snIntP:Eval() IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:N:10 F:S" - HBTEST sdDateE:Eval() IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:D:0d00000000 F:S" + HBTEST sdDateE:Eval() IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:D:0d0 F:S" HBTEST slFalse:Eval() IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:L:.F. F:S" HBTEST sbBlock:Eval() IS NIL HBTEST saArray:Eval() IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:A:{.[1].} F:S" @@ -545,7 +545,7 @@ PROCEDURE Main_MISC() HBTEST suNIL:Eval IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:U:NIL F:S" HBTEST scString:Eval IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:C:HELLO F:S" HBTEST snIntP:Eval IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:N:10 F:S" - HBTEST sdDateE:Eval IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:D:0d00000000 F:S" + HBTEST sdDateE:Eval IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:D:0d0 F:S" HBTEST slFalse:Eval IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:L:.F. F:S" HBTEST sbBlock:Eval IS NIL HBTEST saArray:Eval IS "E 13 BASE 1004 No exported method (EVAL) OS:0 #:0 A:1:A:{.[1].} F:S" @@ -701,7 +701,7 @@ PROCEDURE Main_MISC() #endif /* __XPP__ */ - /* NOTE: BIN2*() functions are quite untable in CA-Cl*pper when the passed + /* NOTE: BIN2*() functions are quite unstable in CA-Cl*pper when the passed parameter is smaller than the required length. */ /* Bin2I() */ @@ -806,7 +806,7 @@ PROCEDURE Main_MISC() HBTEST __CopyFile( "$$COPYFR.TMP" ) IS "E 1 BASE 2010 Argument error (__COPYFILE) OS:0 #:0 A:1:C:$$COPYFR.TMP " HBTEST __CopyFile( "$$COPYFR.TMP", "$$COPYTO.TMP" ) IS NIL HBTEST __CopyFile( "NOT_HERE.$$$", "$$COPYTO.TMP" ) IS "E 21 BASE 2012 Open error <NOT_HERE.$$$> OS:2 #:1 F:DR" - HBTEST __CopyFile( "$$COPYFR.TMP", BADFNAME() ) IS "E 20 BASE 2012 Create error <" + BADFNAME() + "> OS:2 #:1 F:DR" + HBTEST __CopyFile( "$$COPYFR.TMP", BADFNAME1() ) IS "E 20 BASE 2012 Create error <" + BADFNAME1() + "> OS:2 #:1 F:DR" FErase( "$$COPYFR.TMP" ) FErase( "$$COPYTO.TMP" ) @@ -1208,14 +1208,14 @@ STATIC FUNCTION TESTFNAME( cFull ) RETURN ; hb_FNameMerge( cPath, cName, cExt ) + ";" + ; - cPath + ";" +; - cName + ";" +; - cExt + ";" +; + cPath + ";" + ; + cName + ";" + ; + cExt + ";" + ; "" #endif -STATIC FUNCTION BADFNAME() +STATIC FUNCTION BADFNAME1() /* NOTE: The dot in the "*INVALID*." filename is intentional and serves to hide different path handling, since Harbour is platform independent. */ diff --git a/utils/hbtest/rt_mt.prg b/utils/hbtest/rt_mt.prg index 41049ccebd..bb0d408e9e 100644 --- a/utils/hbtest/rt_mt.prg +++ b/utils/hbtest/rt_mt.prg @@ -63,7 +63,7 @@ PROCEDURE Main_MT() RETURN #ifdef __HARBOUR__ -FUNCTION DO_MTTES1() +STATIC FUNCTION DO_MTTES1() LOCAL aThreads, aResults, i, nDigit, nSum, nExpected LOCAL mtxJobs, mtxResults @@ -101,11 +101,11 @@ FUNCTION DO_MTTES1() RETURN "ERROR, final sum: " + hb_ntos( nSum ) + ; " expected: " + hb_ntos( nExpected ) -PROCEDURE thFunc( mtxJobs, mtxResults ) +STATIC PROCEDURE thFunc( mtxJobs, mtxResults ) LOCAL xJob, xResult - WHILE .T. + DO WHILE .T. hb_mutexSubscribe( mtxJobs,, @xJob ) IF xJob == NIL EXIT diff --git a/utils/hbtest/rt_str.prg b/utils/hbtest/rt_str.prg index a34ea0ea21..d2786294e0 100644 --- a/utils/hbtest/rt_str.prg +++ b/utils/hbtest/rt_str.prg @@ -71,7 +71,7 @@ PROCEDURE Main_STR() #ifndef RT_NO_C #ifdef __PLATFORM__WINDOWS - IF .F. /* [U]LONG is 32 bit integer in Win64 */ + IF .F. /* [U]LONG is 32-bit integer in Windows 64-bit */ #else IF l64 #endif @@ -442,7 +442,7 @@ PROCEDURE Main_STR() /* TODO: StrTran() */ /* NOTE: It seems like CA-Cl*pper 5.x is not aware of the BREAK return value of - the error handler, so the error is thrown, but we can't catch it. + the error handler, so the error is thrown, but we cannot catch it. This bug is fixed in CA-Cl*pper 5.3 [vszakats] */ #ifndef __CLIPPER__ #ifndef __XPP__ @@ -503,13 +503,13 @@ PROCEDURE Main_STR() #ifdef __HARBOUR__ #pragma -kh- #endif - HBTEST At( "", "" ) IS 1 /* Bug in CA-Cl*ppers compiler optimizer, it should return 0 */ - HBTEST At( "", "ABCDEF" ) IS 1 /* Bug in CA-Cl*ppers compiler optimizer, it should return 0 */ + HBTEST At( "", "" ) IS 1 /* Bug in CA-Cl*pper compiler optimizer, it should return 0 */ + HBTEST At( "", "ABCDEF" ) IS 1 /* Bug in CA-Cl*pper compiler optimizer, it should return 0 */ #ifdef __HARBOUR__ /* enable Harbour extensions and test correct results results */ #pragma -kh+ - HBTEST At( "", "" ) IS 0 /* Bug in CA-Cl*ppers compiler optimizer, it should return 0 */ - HBTEST At( "", "ABCDEF" ) IS 0 /* Bug in CA-Cl*ppers compiler optimizer, it should return 0 */ + HBTEST At( "", "" ) IS 0 /* Bug in CA-Cl*pper compiler optimizer, it should return 0 */ + HBTEST At( "", "ABCDEF" ) IS 0 /* Bug in CA-Cl*pper compiler optimizer, it should return 0 */ #endif HBTEST At( scStringE, scStringE ) IS 0 HBTEST At( scStringE, "ABCDEF" ) IS 0 diff --git a/utils/hbtest/rt_trans.prg b/utils/hbtest/rt_trans.prg index c311dd867d..4e894f186e 100644 --- a/utils/hbtest/rt_trans.prg +++ b/utils/hbtest/rt_trans.prg @@ -512,7 +512,7 @@ PROCEDURE Main_TRANS() HBTEST Transform( .T., "@RZ ABCDEFGHIJKLMNOPQRSTUVWXYZ9#!$ *.," ) IS " " HBTEST Transform( .F., "@RZ ABCDEFGHIJKLMNOPQRSTUVWXYZ9#!$ *.," ) IS " " - SET DATE FORMAT TO "MM/DD/YY" + Set( _SET_DATEFORMAT, "MM/DD/YY" ) HBTEST Transform( "abcd", "@9!*" ) IS "ABCD" HBTEST Transform( "abcd", "@_9!*" ) IS "ABCD" @@ -540,30 +540,30 @@ PROCEDURE Main_TRANS() HBTEST Transform( 0, "@C 9.99" ) IS "0.00" dt := hb_SToD( "19871231" ) - SET DATE FORMAT TO "MM:DD:YYYY" + Set( _SET_DATEFORMAT, "MM:DD:YYYY" ) HBTEST Transform( dt, "@E" ) IS "31:12:1987" - SET DATE FORMAT TO "MM:DD:YY" + Set( _SET_DATEFORMAT, "MM:DD:YY" ) HBTEST Transform( dt, "@E" ) IS "31:12:87" - SET DATE FORMAT TO "MM<DD>YY" + Set( _SET_DATEFORMAT, "MM<DD>YY" ) HBTEST Transform( dt, "@E" ) IS "31<12>87" #ifdef __HARBOUR__ /* this are wrongly converted by CA-Cl*pper */ - SET DATE FORMAT TO "DD:MM:YYYY" + Set( _SET_DATEFORMAT, "DD:MM:YYYY" ) HBTEST Transform( dt, "@E" ) IS "31:12:1987" - SET DATE FORMAT TO "YYYY:MM:DD" + Set( _SET_DATEFORMAT, "YYYY:MM:DD" ) HBTEST Transform( dt, "@E" ) IS "31:12:1987" - SET DATE FORMAT TO "YYYY:DD:MM" + Set( _SET_DATEFORMAT, "YYYY:DD:MM" ) HBTEST Transform( dt, "@E" ) IS "31:12:1987" - SET DATE FORMAT TO "YY:MM:DD" + Set( _SET_DATEFORMAT, "YY:MM:DD" ) HBTEST Transform( dt, "@E" ) IS "31:12:87" - SET DATE FORMAT TO "DD:MM:YY" + Set( _SET_DATEFORMAT, "DD:MM:YY" ) HBTEST Transform( dt, "@E" ) IS "31:12:87" - SET DATE FORMAT TO "<YY:DD.MM>" + Set( _SET_DATEFORMAT, "<YY:DD.MM>" ) HBTEST Transform( dt, "@E" ) IS "<31:12.87>" - SET DATE FORMAT TO "|YY|MM|DD|" + Set( _SET_DATEFORMAT, "|YY|MM|DD|" ) HBTEST Transform( dt, "@E" ) IS "|31|12|87|" #endif - SET DATE FORMAT TO "MM.DD.YYYY" + Set( _SET_DATEFORMAT, "MM.DD.YYYY" ) HBTEST Transform( dt, "@E" ) IS "31.12.1987" HBTEST Transform( -5, "@(Z $###,##9.99" ) IS "( 5.00)" @@ -697,7 +697,7 @@ PROCEDURE Main_TRANS() HBTEST Transform( "abcdefghij", "@S0! <XXXXXXXX>" ) IS "<BCDEFGHI>" HBTEST Transform( "abcdefghij", "@S5! <XXXXXXXX>" ) IS "<BCDE" - SET FIXED ON + Set( _SET_FIXED, .T. ) HBTEST Transform( 1234, ) IS " 1234" HBTEST Transform( 1234, "" ) IS " 1234" @@ -728,20 +728,20 @@ PROCEDURE Main_TRANS() HBTEST Transform( Val( "12" ), ) IS " 12" HBTEST Transform( Val( "123" ), ) IS " 123" HBTEST Transform( Val( "1234" ), ) IS " 1234" - SET DECIMAL TO 3 + Set( _SET_DECIMALS, 3 ) HBTEST Transform( 0.0, ) IS " 0.000" HBTEST Transform( Val( "1" ), ) IS " 1" HBTEST Transform( Val( "12" ), ) IS " 12" HBTEST Transform( Val( "123" ), ) IS " 123" HBTEST Transform( Val( "1234" ), ) IS " 1234" - SET DECIMAL TO 4 + Set( _SET_DECIMALS, 4 ) HBTEST Transform( 0.0, ) IS " 0.0000" HBTEST Transform( Val( "1" ), ) IS " 1" HBTEST Transform( Val( "12" ), ) IS " 12" HBTEST Transform( Val( "123" ), ) IS " 123" HBTEST Transform( Val( "1234" ), ) IS " 1234" - SET FIXED OFF + Set( _SET_FIXED, .F. ) HBTEST Transform( -1234, ) IS " -1234" HBTEST Transform( -1234, "@B" ) IS "-1234 "