diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0f6a8f2842..b12e5ccf59 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,50 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2008-03-12 17:43 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbapi.h + * harbour/source/common/hbver.c + * harbour/source/rtl/gttone.c + * added hb_iswince() and fixed TONE() for WinCE + + * harbour/source/rtl/math.c + ! added workaround for SIGFPE platforms which generate it instead of + setting errno during execution of math functions + + * harbour/source/rtl/gtcrs/hb-charmap.def + ! remap 0x9b (155) to '.' in Linux terminals - it's control code + + * harbour/source/rdd/dbsql.c + * harbour/source/rdd/workarea.c + * harbour/source/rdd/dbf1.c + ! always restore current workarea in WA EVAL() method + ! always use EVAL() method for user codeblocks and macros + + * harbour/source/rdd/dbcmd.c + ! fixed DBRELATION() called without numeric parameters or with 0 to + return first relation expression (Clipper compatible) + + * harbour/contrib/hbtip/thtml.prg + ! fixed wrongly ported to Harbour xHarbour specific code + + * harbour/source/common/hbstr.c + + added missing const in one declaration + * formatting + + * harbour/source/rtl/transfrm.c + ! fixed casting for C++ compilers + + * harbour/source/rtl/errorapi.c + * harbour/source/rdd/dbfntx/dbfntx1.c + ! cleanup warnings + + * harbour/source/common/hbtrace.c + * harbour/source/rdd/dbcmdx.c + * harbour/source/rdd/wafunc.c + * harbour/source/rdd/dbffpt/dbffpt1.c + * harbour/source/rdd/hbsix/sxcrypt.c + * formatting + 2008-03-11 14:04 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/utils/hbtest/rt_trans.prg * cleaned TRANSFORM() tests @@ -71,7 +115,7 @@ ! fixed ',' conversions ? transform( 12.34,"@E ab,cd.ef9,9.99,.--" ) ! fixed bug with picture starting with ".", f.e.: - ? transform( 0.3456, ".999" ) + ? transform( 0.3456, ".999" ) ! fixed "@(" and "@)" conversions, f.e.: ? transform( -12345, "@) 1999*999" ) ! fixed late oveflow detection in "@(" and "@)", f.e.: diff --git a/harbour/contrib/hbtip/thtml.prg b/harbour/contrib/hbtip/thtml.prg index ca1f041b51..5dad1eb851 100644 --- a/harbour/contrib/hbtip/thtml.prg +++ b/harbour/contrib/hbtip/thtml.prg @@ -73,8 +73,8 @@ #xtrans P_SEEK( , ) => (:p_end:=:p_pos, :p_pos:=AtI(,:p_str,:p_end+1)) #xtrans P_PEEK( , ) => (:p_end:=:p_pos,PStrCompi( :p_str, :p_pos, )) -#xtrans P_NEXT( ) => (:p_end:=:p_pos, :p_str\[++:p_pos]) -#xtrans P_PREV( ) => (:p_end:=:p_pos, :p_str\[--:p_pos]) +#xtrans P_NEXT( ) => (:p_end:=:p_pos, substr(:p_str,++:p_pos,1)) +#xtrans P_PREV( ) => (:p_end:=:p_pos, substr(:p_str,--:p_pos,1)) // Directives for a light weight stack #define S_DATA 1 // array holding data elements @@ -106,7 +106,7 @@ STATIC slInit := .F. // initilization flag for HTML data /* * Class for handling an entire HTML document */ -CLASS THtmlDocument +CLASS THtmlDocument MODULE FRIENDLY HIDDEN: DATA oIterator DATA nodes @@ -315,7 +315,7 @@ RETURN ::oIterator:Find( cName, cAttrib, cValue, cData ) * * (Adopted from TXMLIterator -> source\rtl\TXml.prg) */ -CLASS THtmlIterator +CLASS THtmlIterator MODULE FRIENDLY METHOD New( oNodeTop ) CONSTRUCTOR METHOD Next() METHOD Rewind() @@ -427,7 +427,7 @@ RETURN .T. Iterator scan class *********************************************/ -CLASS THtmlIteratorScan FROM THtmlIterator +CLASS THtmlIteratorScan FROM THtmlIterator MODULE FRIENDLY METHOD New( oNodeTop ) CONSTRUCTOR HIDDEN: METHOD MatchCriteria( oFound ) @@ -468,7 +468,7 @@ RETURN .T. Iterator regex class *********************************************/ -CLASS THtmlIteratorRegex FROM THtmlIterator +CLASS THtmlIteratorRegex FROM THtmlIterator MODULE FRIENDLY METHOD New( oNodeTop ) CONSTRUCTOR HIDDEN: METHOD MatchCriteria( oFound ) @@ -509,7 +509,7 @@ RETURN .T. * Class representing a HTML node tree. * It parses a HTML formatted string */ -CLASS THtmlNode +CLASS THtmlNode MODULE FRIENDLY HIDDEN: DATA root DATA _document @@ -1240,7 +1240,7 @@ METHOD getAttributes() CLASS THtmlNode // Tag has no valid attributes RETURN NIL - ELSEIF ::htmlTagName[1] == "!" + ELSEIF ::htmlTagName = "!" // and have no HTML attributes RETURN ::htmlAttributes @@ -1653,46 +1653,46 @@ STATIC PROCEDURE _Init_Html_TagTypes hb_HSetCaseMatch( shTagTypes, .F. ) - shTagTypes[ "_root_" ] := { NIL , hb_bitOr(CM_INLINE) } - shTagTypes[ "_text_" ] := { NIL , hb_bitOr(CM_INLINE) } + shTagTypes[ "_root_" ] := { NIL , (CM_INLINE) } + shTagTypes[ "_text_" ] := { NIL , (CM_INLINE) } shTagTypes[ "!--" ] := { NIL , hb_bitOr(CM_INLINE, CM_EMPTY) } - shTagTypes[ "a" ] := { ( @THtmlAttr_A() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "abbr" ] := { ( @THtmlAttr_ABBR() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "acronym" ] := { ( @THtmlAttr_ACRONYM() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "address" ] := { ( @THtmlAttr_ADDRESS() ) , hb_bitOr(CM_BLOCK) } - shTagTypes[ "align" ] := { NIL , hb_bitOr(CM_BLOCK) } + shTagTypes[ "a" ] := { ( @THtmlAttr_A() ) , (CM_INLINE) } + shTagTypes[ "abbr" ] := { ( @THtmlAttr_ABBR() ) , (CM_INLINE) } + shTagTypes[ "acronym" ] := { ( @THtmlAttr_ACRONYM() ) , (CM_INLINE) } + shTagTypes[ "address" ] := { ( @THtmlAttr_ADDRESS() ) , (CM_BLOCK) } + shTagTypes[ "align" ] := { NIL , (CM_BLOCK) } shTagTypes[ "applet" ] := { ( @THtmlAttr_APPLET() ) , hb_bitOr(CM_OBJECT, CM_IMG, CM_INLINE, CM_PARAM) } shTagTypes[ "area" ] := { ( @THtmlAttr_AREA() ) , hb_bitOr(CM_BLOCK, CM_EMPTY) } - shTagTypes[ "b" ] := { ( @THtmlAttr_B() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "b" ] := { ( @THtmlAttr_B() ) , (CM_INLINE) } shTagTypes[ "base" ] := { ( @THtmlAttr_BASE() ) , hb_bitOr(CM_HEAD, CM_EMPTY) } shTagTypes[ "basefont" ] := { ( @THtmlAttr_BASEFONT() ) , hb_bitOr(CM_INLINE, CM_EMPTY) } - shTagTypes[ "bdo" ] := { ( @THtmlAttr_BDO() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "bdo" ] := { ( @THtmlAttr_BDO() ) , (CM_INLINE) } shTagTypes[ "bgsound" ] := { NIL , hb_bitOr(CM_HEAD, CM_EMPTY) } - shTagTypes[ "big" ] := { ( @THtmlAttr_BIG() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "blink" ] := { NIL , hb_bitOr(CM_INLINE) } - shTagTypes[ "blockquote" ] := { ( @THtmlAttr_BLOCKQUOTE() ) , hb_bitOr(CM_BLOCK) } + shTagTypes[ "big" ] := { ( @THtmlAttr_BIG() ) , (CM_INLINE) } + shTagTypes[ "blink" ] := { NIL , (CM_INLINE) } + shTagTypes[ "blockquote" ] := { ( @THtmlAttr_BLOCKQUOTE() ) , (CM_BLOCK) } shTagTypes[ "body" ] := { ( @THtmlAttr_BODY() ) , hb_bitOr(CM_HTML, CM_OPT, CM_OMITST) } shTagTypes[ "br" ] := { ( @THtmlAttr_BR() ) , hb_bitOr(CM_INLINE, CM_EMPTY) } - shTagTypes[ "button" ] := { ( @THtmlAttr_BUTTON() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "caption" ] := { ( @THtmlAttr_CAPTION() ) , hb_bitOr(CM_TABLE) } - shTagTypes[ "center" ] := { ( @THtmlAttr_CENTER() ) , hb_bitOr(CM_BLOCK) } - shTagTypes[ "cite" ] := { ( @THtmlAttr_CITE() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "code" ] := { ( @THtmlAttr_CODE() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "button" ] := { ( @THtmlAttr_BUTTON() ) , (CM_INLINE) } + shTagTypes[ "caption" ] := { ( @THtmlAttr_CAPTION() ) , (CM_TABLE) } + shTagTypes[ "center" ] := { ( @THtmlAttr_CENTER() ) , (CM_BLOCK) } + shTagTypes[ "cite" ] := { ( @THtmlAttr_CITE() ) , (CM_INLINE) } + shTagTypes[ "code" ] := { ( @THtmlAttr_CODE() ) , (CM_INLINE) } shTagTypes[ "col" ] := { ( @THtmlAttr_COL() ) , hb_bitOr(CM_TABLE, CM_EMPTY) } shTagTypes[ "colgroup" ] := { ( @THtmlAttr_COLGROUP() ) , hb_bitOr(CM_TABLE, CM_OPT) } - shTagTypes[ "comment" ] := { NIL , hb_bitOr(CM_INLINE) } + shTagTypes[ "comment" ] := { NIL , (CM_INLINE) } shTagTypes[ "dd" ] := { ( @THtmlAttr_DD() ) , hb_bitOr(CM_DEFLIST, CM_OPT, CM_NO_INDENT) } shTagTypes[ "del" ] := { ( @THtmlAttr_DEL() ) , hb_bitOr(CM_INLINE, CM_BLOCK, CM_MIXED) } - shTagTypes[ "dfn" ] := { ( @THtmlAttr_DFN() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "dfn" ] := { ( @THtmlAttr_DFN() ) , (CM_INLINE) } shTagTypes[ "dir" ] := { ( @THtmlAttr_DIR() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) } - shTagTypes[ "div" ] := { ( @THtmlAttr_DIV() ) , hb_bitOr(CM_BLOCK) } - shTagTypes[ "dl" ] := { ( @THtmlAttr_DL() ) , hb_bitOr(CM_BLOCK) } + shTagTypes[ "div" ] := { ( @THtmlAttr_DIV() ) , (CM_BLOCK) } + shTagTypes[ "dl" ] := { ( @THtmlAttr_DL() ) , (CM_BLOCK) } shTagTypes[ "dt" ] := { ( @THtmlAttr_DT() ) , hb_bitOr(CM_DEFLIST, CM_OPT, CM_NO_INDENT) } - shTagTypes[ "em" ] := { ( @THtmlAttr_EM() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "em" ] := { ( @THtmlAttr_EM() ) , (CM_INLINE) } shTagTypes[ "embed" ] := { NIL , hb_bitOr(CM_INLINE, CM_IMG, CM_EMPTY) } - shTagTypes[ "fieldset" ] := { ( @THtmlAttr_FIELDSET() ) , hb_bitOr(CM_BLOCK) } - shTagTypes[ "font" ] := { ( @THtmlAttr_FONT() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "form" ] := { ( @THtmlAttr_FORM() ) , hb_bitOr(CM_BLOCK) } + shTagTypes[ "fieldset" ] := { ( @THtmlAttr_FIELDSET() ) , (CM_BLOCK) } + shTagTypes[ "font" ] := { ( @THtmlAttr_FONT() ) , (CM_INLINE) } + shTagTypes[ "form" ] := { ( @THtmlAttr_FORM() ) , (CM_BLOCK) } shTagTypes[ "frame" ] := { ( @THtmlAttr_FRAME() ) , hb_bitOr(CM_FRAMES, CM_EMPTY) } shTagTypes[ "frameset" ] := { ( @THtmlAttr_FRAMESET() ) , hb_bitOr(CM_HTML, CM_FRAMES) } shTagTypes[ "h1" ] := { ( @THtmlAttr_H1() ) , hb_bitOr(CM_BLOCK, CM_HEADING) } @@ -1704,75 +1704,75 @@ STATIC PROCEDURE _Init_Html_TagTypes shTagTypes[ "head" ] := { ( @THtmlAttr_HEAD() ) , hb_bitOr(CM_HTML, CM_OPT, CM_OMITST) } shTagTypes[ "hr" ] := { ( @THtmlAttr_HR() ) , hb_bitOr(CM_BLOCK, CM_EMPTY) } shTagTypes[ "html" ] := { ( @THtmlAttr_HTML() ) , hb_bitOr(CM_HTML, CM_OPT, CM_OMITST) } - shTagTypes[ "i" ] := { ( @THtmlAttr_I() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "iframe" ] := { ( @THtmlAttr_IFRAME() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "ilayer" ] := { NIL , hb_bitOr(CM_INLINE) } + shTagTypes[ "i" ] := { ( @THtmlAttr_I() ) , (CM_INLINE) } + shTagTypes[ "iframe" ] := { ( @THtmlAttr_IFRAME() ) , (CM_INLINE) } + shTagTypes[ "ilayer" ] := { NIL , (CM_INLINE) } shTagTypes[ "img" ] := { ( @THtmlAttr_IMG() ) , hb_bitOr(CM_INLINE, CM_IMG, CM_EMPTY) } shTagTypes[ "input" ] := { ( @THtmlAttr_INPUT() ) , hb_bitOr(CM_INLINE, CM_IMG, CM_EMPTY) } shTagTypes[ "ins" ] := { ( @THtmlAttr_INS() ) , hb_bitOr(CM_INLINE, CM_BLOCK, CM_MIXED) } shTagTypes[ "isindex" ] := { ( @THtmlAttr_ISINDEX() ) , hb_bitOr(CM_BLOCK, CM_EMPTY) } - shTagTypes[ "kbd" ] := { ( @THtmlAttr_KBD() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "kbd" ] := { ( @THtmlAttr_KBD() ) , (CM_INLINE) } shTagTypes[ "keygen" ] := { NIL , hb_bitOr(CM_INLINE, CM_EMPTY) } - shTagTypes[ "label" ] := { ( @THtmlAttr_LABEL() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "layer" ] := { NIL , hb_bitOr(CM_BLOCK) } - shTagTypes[ "legend" ] := { ( @THtmlAttr_LEGEND() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "label" ] := { ( @THtmlAttr_LABEL() ) , (CM_INLINE) } + shTagTypes[ "layer" ] := { NIL , (CM_BLOCK) } + shTagTypes[ "legend" ] := { ( @THtmlAttr_LEGEND() ) , (CM_INLINE) } shTagTypes[ "li" ] := { ( @THtmlAttr_LI() ) , hb_bitOr(CM_LIST, CM_OPT, CM_NO_INDENT) } shTagTypes[ "link" ] := { ( @THtmlAttr_LINK() ) , hb_bitOr(CM_HEAD, CM_EMPTY) } shTagTypes[ "listing" ] := { ( @THtmlAttr_LISTING() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) } - shTagTypes[ "map" ] := { ( @THtmlAttr_MAP() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "map" ] := { ( @THtmlAttr_MAP() ) , (CM_INLINE) } shTagTypes[ "marquee" ] := { NIL , hb_bitOr(CM_INLINE, CM_OPT) } shTagTypes[ "menu" ] := { ( @THtmlAttr_MENU() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) } shTagTypes[ "meta" ] := { ( @THtmlAttr_META() ) , hb_bitOr(CM_HEAD, CM_EMPTY) } - shTagTypes[ "multicol" ] := { NIL , hb_bitOr(CM_BLOCK) } + shTagTypes[ "multicol" ] := { NIL , (CM_BLOCK) } shTagTypes[ "nextid" ] := { ( @THtmlAttr_NEXTID() ) , hb_bitOr(CM_HEAD, CM_EMPTY) } - shTagTypes[ "nobr" ] := { NIL , hb_bitOr(CM_INLINE) } - shTagTypes[ "noembed" ] := { NIL , hb_bitOr(CM_INLINE) } + shTagTypes[ "nobr" ] := { NIL , (CM_INLINE) } + shTagTypes[ "noembed" ] := { NIL , (CM_INLINE) } shTagTypes[ "noframes" ] := { ( @THtmlAttr_NOFRAMES() ) , hb_bitOr(CM_BLOCK, CM_FRAMES) } shTagTypes[ "nolayer" ] := { NIL , hb_bitOr(CM_BLOCK, CM_INLINE, CM_MIXED) } - shTagTypes[ "nosave" ] := { NIL , hb_bitOr(CM_BLOCK) } + shTagTypes[ "nosave" ] := { NIL , (CM_BLOCK) } shTagTypes[ "noscript" ] := { ( @THtmlAttr_NOSCRIPT() ) , hb_bitOr(CM_BLOCK, CM_INLINE, CM_MIXED) } shTagTypes[ "object" ] := { ( @THtmlAttr_OBJECT() ) , hb_bitOr(CM_OBJECT, CM_HEAD, CM_IMG, CM_INLINE, CM_PARAM) } - shTagTypes[ "ol" ] := { ( @THtmlAttr_OL() ) , hb_bitOr(CM_BLOCK) } + shTagTypes[ "ol" ] := { ( @THtmlAttr_OL() ) , (CM_BLOCK) } shTagTypes[ "optgroup" ] := { ( @THtmlAttr_OPTGROUP() ) , hb_bitOr(CM_FIELD, CM_OPT) } shTagTypes[ "option" ] := { ( @THtmlAttr_OPTION() ) , hb_bitOr(CM_FIELD, CM_OPT) } shTagTypes[ "p" ] := { ( @THtmlAttr_P() ) , hb_bitOr(CM_BLOCK, CM_OPT) } shTagTypes[ "param" ] := { ( @THtmlAttr_PARAM() ) , hb_bitOr(CM_INLINE, CM_EMPTY) } shTagTypes[ "plaintext" ] := { ( @THtmlAttr_PLAINTEXT() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) } - shTagTypes[ "pre" ] := { ( @THtmlAttr_PRE() ) , hb_bitOr(CM_BLOCK) } - shTagTypes[ "q" ] := { ( @THtmlAttr_Q() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "rb" ] := { ( @THtmlAttr_RB() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "rbc" ] := { ( @THtmlAttr_RBC() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "rp" ] := { ( @THtmlAttr_RP() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "rt" ] := { ( @THtmlAttr_RT() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "rtc" ] := { ( @THtmlAttr_RTC() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "ruby" ] := { ( @THtmlAttr_RUBY() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "s" ] := { ( @THtmlAttr_S() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "samp" ] := { ( @THtmlAttr_SAMP() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "pre" ] := { ( @THtmlAttr_PRE() ) , (CM_BLOCK) } + shTagTypes[ "q" ] := { ( @THtmlAttr_Q() ) , (CM_INLINE) } + shTagTypes[ "rb" ] := { ( @THtmlAttr_RB() ) , (CM_INLINE) } + shTagTypes[ "rbc" ] := { ( @THtmlAttr_RBC() ) , (CM_INLINE) } + shTagTypes[ "rp" ] := { ( @THtmlAttr_RP() ) , (CM_INLINE) } + shTagTypes[ "rt" ] := { ( @THtmlAttr_RT() ) , (CM_INLINE) } + shTagTypes[ "rtc" ] := { ( @THtmlAttr_RTC() ) , (CM_INLINE) } + shTagTypes[ "ruby" ] := { ( @THtmlAttr_RUBY() ) , (CM_INLINE) } + shTagTypes[ "s" ] := { ( @THtmlAttr_S() ) , (CM_INLINE) } + shTagTypes[ "samp" ] := { ( @THtmlAttr_SAMP() ) , (CM_INLINE) } shTagTypes[ "script" ] := { ( @THtmlAttr_SCRIPT() ) , hb_bitOr(CM_HEAD, CM_MIXED, CM_BLOCK, CM_INLINE) } shTagTypes[ "select" ] := { ( @THtmlAttr_SELECT() ) , hb_bitOr(CM_INLINE, CM_FIELD) } shTagTypes[ "server" ] := { NIL , hb_bitOr(CM_HEAD, CM_MIXED, CM_BLOCK, CM_INLINE) } shTagTypes[ "servlet" ] := { NIL , hb_bitOr(CM_OBJECT, CM_IMG, CM_INLINE, CM_PARAM) } - shTagTypes[ "small" ] := { ( @THtmlAttr_SMALL() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "small" ] := { ( @THtmlAttr_SMALL() ) , (CM_INLINE) } shTagTypes[ "spacer" ] := { NIL , hb_bitOr(CM_INLINE, CM_EMPTY) } - shTagTypes[ "span" ] := { ( @THtmlAttr_SPAN() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "strike" ] := { ( @THtmlAttr_STRIKE() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "strong" ] := { ( @THtmlAttr_STRONG() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "style" ] := { ( @THtmlAttr_STYLE() ) , hb_bitOr(CM_HEAD) } - shTagTypes[ "sub" ] := { ( @THtmlAttr_SUB() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "sup" ] := { ( @THtmlAttr_SUP() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "table" ] := { ( @THtmlAttr_TABLE() ) , hb_bitOr(CM_BLOCK) } + shTagTypes[ "span" ] := { ( @THtmlAttr_SPAN() ) , (CM_INLINE) } + shTagTypes[ "strike" ] := { ( @THtmlAttr_STRIKE() ) , (CM_INLINE) } + shTagTypes[ "strong" ] := { ( @THtmlAttr_STRONG() ) , (CM_INLINE) } + shTagTypes[ "style" ] := { ( @THtmlAttr_STYLE() ) , (CM_HEAD) } + shTagTypes[ "sub" ] := { ( @THtmlAttr_SUB() ) , (CM_INLINE) } + shTagTypes[ "sup" ] := { ( @THtmlAttr_SUP() ) , (CM_INLINE) } + shTagTypes[ "table" ] := { ( @THtmlAttr_TABLE() ) , (CM_BLOCK) } shTagTypes[ "tbody" ] := { ( @THtmlAttr_TBODY() ) , hb_bitOr(CM_TABLE, CM_ROWGRP, CM_OPT) } shTagTypes[ "td" ] := { ( @THtmlAttr_TD() ) , hb_bitOr(CM_ROW, CM_OPT, CM_NO_INDENT) } shTagTypes[ "textarea" ] := { ( @THtmlAttr_TEXTAREA() ) , hb_bitOr(CM_INLINE, CM_FIELD) } shTagTypes[ "tfoot" ] := { ( @THtmlAttr_TFOOT() ) , hb_bitOr(CM_TABLE, CM_ROWGRP, CM_OPT) } shTagTypes[ "th" ] := { ( @THtmlAttr_TH() ) , hb_bitOr(CM_ROW, CM_OPT, CM_NO_INDENT) } shTagTypes[ "thead" ] := { ( @THtmlAttr_THEAD() ) , hb_bitOr(CM_TABLE, CM_ROWGRP, CM_OPT) } - shTagTypes[ "title" ] := { ( @THtmlAttr_TITLE() ) , hb_bitOr(CM_HEAD) } + shTagTypes[ "title" ] := { ( @THtmlAttr_TITLE() ) , (CM_HEAD) } shTagTypes[ "tr" ] := { ( @THtmlAttr_TR() ) , hb_bitOr(CM_TABLE, CM_OPT) } - shTagTypes[ "tt" ] := { ( @THtmlAttr_TT() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "u" ] := { ( @THtmlAttr_U() ) , hb_bitOr(CM_INLINE) } - shTagTypes[ "ul" ] := { ( @THtmlAttr_UL() ) , hb_bitOr(CM_BLOCK) } - shTagTypes[ "var" ] := { ( @THtmlAttr_VAR() ) , hb_bitOr(CM_INLINE) } + shTagTypes[ "tt" ] := { ( @THtmlAttr_TT() ) , (CM_INLINE) } + shTagTypes[ "u" ] := { ( @THtmlAttr_U() ) , (CM_INLINE) } + shTagTypes[ "ul" ] := { ( @THtmlAttr_UL() ) , (CM_BLOCK) } + shTagTypes[ "var" ] := { ( @THtmlAttr_VAR() ) , (CM_INLINE) } shTagTypes[ "wbr" ] := { NIL , hb_bitOr(CM_INLINE, CM_EMPTY) } shTagTypes[ "xmp" ] := { ( @THtmlAttr_XMP() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) } RETURN diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 50e9d6b001..bd10de3c5c 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -993,6 +993,7 @@ extern char * hb_verBuildDate( void ); /* retrieves a newly allocated buffer con extern void hb_verBuildInfo( void ); /* display harbour, compiler, and platform versions to standard console */ extern HB_EXPORT BOOL hb_iswinnt( void ); /* return .T. if OS == WinNt, 2000, XP */ +extern HB_EXPORT BOOL hb_iswince( void ); /* return .T. if OS is Windows CE or Windows Mobile */ extern HB_EXPORT BOOL hb_printerIsReady( char * pszPrinterName ); /* environment variables access */ diff --git a/harbour/source/common/hbstr.c b/harbour/source/common/hbstr.c index 770d3e84e2..e7ae16a2c2 100644 --- a/harbour/source/common/hbstr.c +++ b/harbour/source/common/hbstr.c @@ -208,7 +208,7 @@ HB_EXPORT int hb_stricmp( const char * s1, const char * s2 ) s1++; s2++; } - while ( c1 ); + while( c1 ); return rc; } @@ -231,7 +231,7 @@ HB_EXPORT int hb_strnicmp( const char * s1, const char * s2, ULONG count ) rc = ( c1 < c2 ? -1 : 1 ); break; } - else if ( !c1 ) + else if( !c1 ) break; } @@ -256,7 +256,7 @@ HB_EXPORT char * hb_xstrcat( char * szDest, const char * szSrc, ... ) va_start( va, szSrc ); while( szSrc ) { - while ( *szSrc ) + while( *szSrc ) *szDest++ = *szSrc++; szSrc = va_arg( va, char * ); } @@ -301,7 +301,7 @@ HB_EXPORT char * hb_xstrcpy( char * szDest, const char * szSrc, ... ) va_start( va, szSrc ); while( szSrc ) { - while ( *szSrc ) + while( *szSrc ) *szDest++ = *szSrc++; szSrc = va_arg( va, char * ); } @@ -313,35 +313,35 @@ HB_EXPORT char * hb_xstrcpy( char * szDest, const char * szSrc, ... ) static double hb_numPow10( int nPrecision ) { - static double s_dPow10[16] = { 1.0, /* 0 */ - 10.0, /* 1 */ - 100.0, /* 2 */ - 1000.0, /* 3 */ - 10000.0, /* 4 */ - 100000.0, /* 5 */ - 1000000.0, /* 6 */ - 10000000.0, /* 7 */ - 100000000.0, /* 8 */ - 1000000000.0, /* 9 */ - 10000000000.0, /* 10 */ - 100000000000.0, /* 11 */ - 1000000000000.0, /* 12 */ - 10000000000000.0, /* 13 */ - 100000000000000.0, /* 14 */ - 1000000000000000.0 }; /* 15 */ - if ( nPrecision < 16 ) + static const double s_dPow10[16] = { 1.0, /* 0 */ + 10.0, /* 1 */ + 100.0, /* 2 */ + 1000.0, /* 3 */ + 10000.0, /* 4 */ + 100000.0, /* 5 */ + 1000000.0, /* 6 */ + 10000000.0, /* 7 */ + 100000000.0, /* 8 */ + 1000000000.0, /* 9 */ + 10000000000.0, /* 10 */ + 100000000000.0, /* 11 */ + 1000000000000.0, /* 12 */ + 10000000000000.0, /* 13 */ + 100000000000000.0, /* 14 */ + 1000000000000000.0 }; /* 15 */ + if( nPrecision < 16 ) { - if ( nPrecision >= 0 ) + if( nPrecision >= 0 ) { return s_dPow10[ nPrecision ]; } - else if ( nPrecision > -16 ) + else if( nPrecision > -16 ) { return 1.0 / s_dPow10[ -nPrecision ]; } } - return pow(10.0, (double) nPrecision); + return pow( 10.0, ( double ) nPrecision ); } HB_EXPORT double hb_numRound( double dNum, int iDec ) @@ -354,7 +354,7 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) if( dNum == 0.0 ) return 0.0; - if ( iDec < 0 ) + if( iDec < 0 ) { dPow = hb_numPow10( -iDec ); doComplete5 = dNum / dPow * doBase; @@ -397,7 +397,7 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) int iDecR, iPrec; BOOL fNeg; - if ( dNum < 0 ) + if( dNum < 0 ) { fNeg = TRUE; dNum = -dNum; @@ -409,13 +409,13 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) iDecR = (int) log10( dNum ); iPrec = iDecR + iDec; - if ( iPrec < -1 ) + if( iPrec < -1 ) { return 0.0; } else { - if ( iPrec > HB_NUM_PRECISION ) + if( iPrec > HB_NUM_PRECISION ) { iDec = HB_NUM_PRECISION - ( dNum < 1.0 ? 0 : 1 ) - iDecR; iPrec = -1; @@ -425,7 +425,7 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) iPrec -= HB_NUM_PRECISION; } } - if ( iDec < 0 ) + if( iDec < 0 ) { dPow = hb_numPow10( -iDec ); doComplete5 = dNum / dPow * doBase + 5.0 + hb_numPow10( iPrec ); @@ -436,7 +436,7 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) doComplete5 = dNum * dPow * doBase + 5.0 + hb_numPow10( iPrec ); } - if ( fNeg ) + if( fNeg ) { doComplete5 = -doComplete5; } @@ -459,15 +459,15 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) modf( doComplete5, &doComplete5i ); #if defined( __XCC__ ) || defined( __POCC__ ) - if ( iDec < 16 ) + if( iDec < 16 ) { - if ( iDec >= 0 ) + if( iDec >= 0 ) return doComplete5i / (LONGLONG) dPow; - else if ( iDec > -16 ) + else if( iDec > -16 ) return doComplete5i * (LONGLONG) dPow; } #endif - if ( iDec < 0 ) + if( iDec < 0 ) return doComplete5i * dPow; else return doComplete5i / dPow; @@ -506,14 +506,14 @@ static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG HB_TRACE(HB_TR_DEBUG, ("hb_str2number(%d, %p, %lu, %p, %p, %p, %p)", (int) fPCode, szNum, ulLen, lVal, dVal, piDec, piWidth )); - while ( ulPos < ulLen && isspace( (BYTE) szNum[ulPos] ) ) + while( ulPos < ulLen && isspace( (BYTE) szNum[ulPos] ) ) ulPos++; - if ( ulPos >= ulLen ) + if( ulPos >= ulLen ) { fNeg = FALSE; } - else if ( szNum[ulPos] == '-' ) + else if( szNum[ulPos] == '-' ) { fNeg = TRUE; ulPos++; @@ -521,7 +521,7 @@ static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG else { fNeg = FALSE; - if ( szNum[ulPos] == '+' ) + if( szNum[ulPos] == '+' ) ulPos++; } @@ -534,14 +534,14 @@ static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG ulPos += 2; iWidth = HB_DEFAULT_WIDTH; fHex = TRUE; - for ( ; ulPos < ulLen; ulPos++ ) + for( ; ulPos < ulLen; ulPos++ ) { c = szNum[ulPos]; - if ( c >= '0' && c <= '9' ) + if( c >= '0' && c <= '9' ) c -= '0'; - else if ( c >= 'A' && c <= 'F' ) + else if( c >= 'A' && c <= 'F' ) c -= 'A' - 10; - else if ( c >= 'a' && c <= 'f' ) + else if( c >= 'a' && c <= 'f' ) c -= 'a' - 10; else break; @@ -558,16 +558,16 @@ static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG iWidth = ulPos; - for ( ; ulPos < ulLen; ulPos++ ) + for( ; ulPos < ulLen; ulPos++ ) { c = szNum[ulPos]; - if ( c >= '0' && c <= '9' ) + if( c >= '0' && c <= '9' ) { - if ( fDbl ) + if( fDbl ) { *dVal = *dVal * 10.0 + ( c - '0' ); } - else if ( *lVal < lLimV || ( *lVal <= lLimV && ( c - '0' ) <= iLimC ) ) + else if( *lVal < lLimV || ( *lVal <= lLimV && ( c - '0' ) <= iLimC ) ) { *lVal = *lVal * 10 + ( c - '0' ); } @@ -576,39 +576,39 @@ static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG *dVal = (double) *lVal * 10.0 + ( c - '0' ); fDbl = TRUE; } - if ( fDec ) + if( fDec ) iDec++; else iWidth++; } - else if ( c == '.' && !fDec ) + else if( c == '.' && !fDec ) { fDec = TRUE; } else { - while ( !fDec && ulPos < ulLen ) + while( !fDec && ulPos < ulLen ) { - if ( szNum[ulPos++] == '.' ) + if( szNum[ulPos++] == '.' ) fDec = TRUE; else iWidth++; } - if ( fDec ) + if( fDec ) iDecR = ulLen - ulPos; break; } } } - if ( fNeg ) + if( fNeg ) { - if ( fDbl ) + if( fDbl ) *dVal = -*dVal; else *lVal = -*lVal; } - if ( !fDbl && ( + if( !fDbl && ( #if defined( PCODE_LONG_LIM ) ( fPCode && !fHex && !PCODE_LONG_LIM( *lVal ) ) || #endif @@ -617,42 +617,42 @@ static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG *dVal = (double) *lVal; fDbl = TRUE; } - if ( iDec ) + if( iDec ) { #if defined( __XCC__ ) || defined( __POCC__ ) - if ( iDec < 16 ) + if( iDec < 16 ) *dVal /= ( LONGLONG ) hb_numPow10( iDec ); else #endif *dVal /= hb_numPow10( iDec ); } - if ( piDec ) + if( piDec ) *piDec = iDec + iDecR; - if ( piWidth ) + if( piWidth ) { - if ( fHex ) + if( fHex ) *piWidth = iWidth; else { int iSize = fDbl ? HB_DBL_LENGTH( *dVal ) : HB_LONG_LENGTH( *lVal ); - if ( fPCode ) + if( fPCode ) { - if ( iWidth < 10 || fNeg ) + if( iWidth < 10 || fNeg ) *piWidth = iSize; else *piWidth = iWidth + ( iDec == 0 ? 1 : 0 ); } else { - if ( iSize > 10 || iWidth > 10 ) + if( iSize > 10 || iWidth > 10 ) *piWidth = iSize; - else if ( iDec + iDecR == 0 ) + else if( iDec + iDecR == 0 ) *piWidth = ( int ) ulLen; - else if ( iWidth == 0 ) + else if( iWidth == 0 ) *piWidth = 1; - else if ( fNeg && iWidth == 1 && *dVal != 0 ) + else if( fNeg && iWidth == 1 && *dVal != 0 ) *piWidth = 2; else *piWidth = iWidth; @@ -734,7 +734,7 @@ HB_EXPORT char * hb_strncpy( char * pDest, const char * pSource, ULONG ulLen ) ulLen--; } - while (ulLen--) + while(ulLen--) { *pDest++ = '\0'; } @@ -769,7 +769,7 @@ HB_EXPORT char * hb_strncat( char * pDest, const char * pSource, ULONG ulLen ) /* if someone will need this then please uncomment the cleaning the rest of buffer. */ /* - while (ulLen--) + while(ulLen--) { *pDest++ = '\0'; } @@ -800,7 +800,7 @@ HB_EXPORT char * hb_strncpyLower( char * pDest, const char * pSource, ULONG ulLe pSource++; } - while (ulLen--) + while(ulLen--) { *pDest++ = '\0'; } @@ -831,7 +831,7 @@ HB_EXPORT char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLe pSource++; } - while (ulLen--) + while(ulLen--) { *pDest++ = '\0'; } @@ -854,7 +854,7 @@ HB_EXPORT char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG HB_TRACE(HB_TR_DEBUG, ("hb_strncpyUpperTrim(%p, %s, %lu)", pDest, pSource, ulLen)); ulSLen = 0; - while ( ulSLen < ulLen && pSource[ ulSLen ] ) + while( ulSLen < ulLen && pSource[ ulSLen ] ) { ulSLen++; } @@ -874,7 +874,7 @@ HB_EXPORT char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG pSource++; } - while (ulLen--) + while( ulLen-- ) { *pDest++ = '\0'; } @@ -914,7 +914,7 @@ HB_EXPORT char * hb_strncpyTrim( char * pDest, const char * pSource, ULONG ulLen ulLen--; } - while (ulLen--) + while( ulLen-- ) { *pDest++ = '\0'; } diff --git a/harbour/source/common/hbtrace.c b/harbour/source/common/hbtrace.c index 288e04fed3..7f1cd61d26 100644 --- a/harbour/source/common/hbtrace.c +++ b/harbour/source/common/hbtrace.c @@ -225,7 +225,7 @@ void hb_tr_trace( char * fmt, ... ) if ( s_flush ) { - fflush( s_fp ) ; + fflush( s_fp ); } } } diff --git a/harbour/source/common/hbver.c b/harbour/source/common/hbver.c index 8fe47974a5..84c60aef6b 100644 --- a/harbour/source/common/hbver.c +++ b/harbour/source/common/hbver.c @@ -315,7 +315,16 @@ HB_EXPORT BOOL hb_iswinnt( void ) } return s_fWinNT; #else - return FALSE ; + return FALSE; +#endif +} + +HB_EXPORT BOOL hb_iswince( void ) +{ +#if defined(HB_WINCE) + return TRUE; +#else + return FALSE; #endif } diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index c4754065ef..2213d7f94e 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -1675,7 +1675,8 @@ HB_FUNC( DBRELATION ) /* () --> cLinkExp */ if( pArea ) { PHB_ITEM pRelExpr = hb_itemPutC( NULL, "" ); - SELF_RELTEXT( pArea, hb_parni( 1 ), pRelExpr ) ; + USHORT uiRelNo = ( USHORT ) hb_parni( 1 ); + SELF_RELTEXT( pArea, uiRelNo ? uiRelNo : 1, pRelExpr ); hb_itemReturnRelease( pRelExpr ); } else diff --git a/harbour/source/rdd/dbcmdx.c b/harbour/source/rdd/dbcmdx.c index 7f27f66ef9..75f2359417 100644 --- a/harbour/source/rdd/dbcmdx.c +++ b/harbour/source/rdd/dbcmdx.c @@ -125,7 +125,7 @@ HB_FUNC( DBSKIPPER ) if( SELF_RECCOUNT( pArea, &ulRecords ) == SUCCESS && ulRecords > 0 ) { if( ISNUM( 1 ) ) - lRecs = hb_parnl( 1 ) ; + lRecs = hb_parnl( 1 ); if( lRecs == 0 ) SELF_SKIP( pArea, 0 ); diff --git a/harbour/source/rdd/dbf1.c b/harbour/source/rdd/dbf1.c index ab927a5346..6f90b5276e 100644 --- a/harbour/source/rdd/dbf1.c +++ b/harbour/source/rdd/dbf1.c @@ -3800,17 +3800,6 @@ static ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) { uiSkip++; } - /* Peter added it for FVP DBFs but in wrong place, - anyhow I cannot see why it's necessary, FVP private data - in header should be after 0x0d - I disabled this code, [druzus] */ - /* - if( pArea->bTableType == DB_DBF_VFP && - pBuffer[ uiCount * sizeof( DBFFIELD ) ] == 0x00 ) - { - uiFields = uiCount; - break; - } - */ } uiFields -= uiSkip; } @@ -3847,7 +3836,16 @@ static ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) dbFieldInfo.uiLen = pField->bLen; dbFieldInfo.uiDec = 0; dbFieldInfo.uiTypeExtended = 0; - dbFieldInfo.uiFlags = 0; + /* We cannot accept bFieldFlags as is because Clipper + * creates tables where this field is random so we have to + * try to guess the flags ourself. But if we know that table + * was created by VFP which uses field flags then we can + * retrive information from bFieldFlags. + */ + if( pArea->bTableType == DB_DBF_VFP ) + dbFieldInfo.uiFlags = pField->bFieldFlags; + else + dbFieldInfo.uiFlags = 0; switch( pField->bType ) { case 'C': @@ -3996,7 +3994,7 @@ static ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) pArea->fHasMemo = TRUE; break; - default: + case '0': if( pArea->bTableType == DB_DBF_VFP && pField->bFieldFlags & 0x01 ) { if( memcmp( dbFieldInfo.atomName, "_NullFlags", 10 ) == 0 ) @@ -4006,6 +4004,8 @@ static ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) pArea->uiRecordLen += dbFieldInfo.uiLen; continue; } + + default: errCode = FAILURE; break; } @@ -4194,7 +4194,8 @@ static ERRCODE hb_dbfPack( DBFAREAP pArea ) if( ++ulEvery >= ulUserEvery ) { ulEvery = 0; - hb_vmEvalBlock( pBlock ); + if( SELF_EVALBLOCK( ( AREAP ) pArea, pBlock ) != SUCCESS ) + return FAILURE; } } @@ -4218,7 +4219,8 @@ static ERRCODE hb_dbfPack( DBFAREAP pArea ) /* Execute the Code Block for pending record */ if( pBlock && ulEvery > 0 ) { - hb_vmEvalBlock( pBlock ); + if( SELF_EVALBLOCK( ( AREAP ) pArea, pBlock ) != SUCCESS ) + return FAILURE; } if( pArea->ulRecCount != ulRecOut ) @@ -4275,7 +4277,7 @@ static ERRCODE hb_dbfSort( DBFAREAP pArea, LPDBSORTINFO pSortInfo ) ulRecNo = 1; if( pSortInfo->dbtri.dbsci.itmRecID ) { - uiError = SELF_GOTO( ( AREAP ) pArea, hb_itemGetNL( pSortInfo->dbtri.dbsci.itmRecID ) ); + uiError = SELF_GOTOID( ( AREAP ) pArea, pSortInfo->dbtri.dbsci.itmRecID ); bMoreRecords = bLimited = TRUE; } else if( pSortInfo->dbtri.dbsci.lNext ) @@ -4297,10 +4299,24 @@ static ERRCODE hb_dbfSort( DBFAREAP pArea, LPDBSORTINFO pSortInfo ) while( uiError == SUCCESS && !pArea->fEof && bMoreRecords ) { if( pSortInfo->dbtri.dbsci.itmCobWhile ) - bMoreRecords = hb_itemGetL( hb_vmEvalBlock( pSortInfo->dbtri.dbsci.itmCobWhile ) ); + { + if( SELF_EVALBLOCK( ( AREAP ) pArea, pSortInfo->dbtri.dbsci.itmCobWhile ) != SUCCESS ) + { + hb_dbQSortExit( &dbQuickSort ); + return FAILURE; + } + bMoreRecords = hb_itemGetL( pArea->valResult ); + } if( bMoreRecords && pSortInfo->dbtri.dbsci.itmCobFor ) - bValidRecord = hb_itemGetL( hb_vmEvalBlock( pSortInfo->dbtri.dbsci.itmCobFor ) ); + { + if( SELF_EVALBLOCK( ( AREAP ) pArea, pSortInfo->dbtri.dbsci.itmCobFor ) != SUCCESS ) + { + hb_dbQSortExit( &dbQuickSort ); + return FAILURE; + } + bValidRecord = hb_itemGetL( pArea->valResult ); + } else bValidRecord = bMoreRecords; diff --git a/harbour/source/rdd/dbffpt/dbffpt1.c b/harbour/source/rdd/dbffpt/dbffpt1.c index fa45efe79f..1518a13d6b 100644 --- a/harbour/source/rdd/dbffpt/dbffpt1.c +++ b/harbour/source/rdd/dbffpt/dbffpt1.c @@ -577,9 +577,9 @@ static ERRCODE hb_fptWriteGCitems( FPTAREAP pArea, LPMEMOGCTABLE pGCtable, USHOR { FPTBLOCK fptBlock; ERRCODE errCode = SUCCESS; - int i /* ,iStart, iStop */ ; + int i /* ,iStart, iStop */; - HB_SYMBOL_UNUSED( usItem ) ; + HB_SYMBOL_UNUSED( usItem ); /* if( usItem == 0 ) @@ -932,7 +932,7 @@ static ERRCODE hb_fptWriteGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable ) HB_PUT_LE_UINT16( pGCtable->fptHeader.nGCitems, usItems ); memset( pGCtable->fptHeader.reserved2, 0, sizeof( pGCtable->fptHeader.reserved2 ) ); j = pGCtable->usItems - usItems; - for( i = j ; i < pGCtable->usItems; i++ ) + for( i = j; i < pGCtable->usItems; i++ ) { HB_PUT_LE_UINT16( &pGCtable->fptHeader.reserved2[ ( i - j ) * 6 ], (( USHORT ) pGCtable->pGCitems[i].ulSize ) ); @@ -990,7 +990,7 @@ static ERRCODE hb_fptWriteGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable ) memset( bPageBuf, 0xAD, pGCtable->ulSize ); HB_PUT_LE_UINT16( bPageBuf, ( (USHORT) usItems << 2 ) + 3 ); j = pGCtable->usItems - usItems; - for( i = j ; i < pGCtable->usItems; i++ ) + for( i = j; i < pGCtable->usItems; i++ ) { HB_PUT_LE_UINT32( &bPageBuf[ ( i - j ) * 8 + 2 ], pGCtable->pGCitems[i].ulOffset * pArea->uiMemoBlockSize ); @@ -1228,7 +1228,7 @@ static ULONG hb_fptCountSMTItemLength( FPTAREAP pArea, PHB_ITEM pItem, ulLen = hb_arrayLen( pItem ); if( ulLen > 0xFFFF ) ulLen = 0xFFFF; - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { ulSize += hb_fptCountSMTItemLength( pArea, hb_arrayGetItemPtr( pItem, i ), pulArrayCount ); } @@ -1348,7 +1348,7 @@ static ULONG hb_fptStoreSMTItem( FPTAREAP pArea, PHB_ITEM pItem, BYTE ** bBufPtr ulLen = 0xFFFF; HB_PUT_LE_UINT16( *bBufPtr, ulLen ); *bBufPtr += 2; - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { ulSize += hb_fptStoreSMTItem( pArea, hb_arrayGetItemPtr( pItem, i ), bBufPtr ); @@ -1435,7 +1435,7 @@ static ERRCODE hb_fptReadRawSMTItem( FPTAREAP pArea, PHB_ITEM pItem ) ulLen = HB_GET_LE_UINT16( buffer ); hb_arrayNew( pItem, ulLen ); - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { ERRCODE errCode = hb_fptReadRawSMTItem( pArea, hb_arrayGetItemPtr( pItem, i ) ); if( errCode != SUCCESS ) @@ -1526,7 +1526,7 @@ static ERRCODE hb_fptReadSMTItem( FPTAREAP pArea, BYTE ** pbMemoBuf, BYTE * bBuf break; } hb_arrayNew( pItem, ulLen ); - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { errCode = hb_fptReadSMTItem( pArea, pbMemoBuf, bBufEnd, hb_arrayGetItemPtr( pItem, i ) ); @@ -1637,7 +1637,7 @@ static ULONG hb_fptCountSixItemLength( FPTAREAP pArea, PHB_ITEM pItem, /* only 2 bytes (SHORT) for SIX compatibility */ ulLen = HB_MIN( ulLen, 0xFFFF ); } - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { ulSize += hb_fptCountSixItemLength( pArea, hb_arrayGetItemPtr( pItem, i ), pulArrayCount ); } @@ -1690,7 +1690,7 @@ static ULONG hb_fptStoreSixItem( FPTAREAP pArea, PHB_ITEM pItem, BYTE ** bBufPtr } HB_PUT_LE_UINT32( &(*bBufPtr)[2], ulLen ); *bBufPtr += SIX_ITEM_BUFSIZE; - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { pTmpItem = hb_arrayGetItemPtr( pItem, i ); ulSize += hb_fptStoreSixItem( pArea, pTmpItem, bBufPtr ); @@ -1835,7 +1835,7 @@ static ERRCODE hb_fptReadSixItem( FPTAREAP pArea, BYTE ** pbMemoBuf, BYTE * bBuf } (*pbMemoBuf) += SIX_ITEM_BUFSIZE; hb_arrayNew( pItem, ulLen ); - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { errCode = hb_fptReadSixItem( pArea, pbMemoBuf, bBufEnd, hb_arrayGetItemPtr( pItem, i ) ); @@ -1881,7 +1881,7 @@ static ULONG hb_fptCountFlexItemLength( FPTAREAP pArea, PHB_ITEM pItem, (*pulArrayCount)++; ulSize += 2; ulLen = hb_arrayLen( pItem ) & 0xFFFF; - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { ulSize += hb_fptCountFlexItemLength( pArea, hb_arrayGetItemPtr( pItem, i ), pulArrayCount ); } @@ -1929,7 +1929,7 @@ static void hb_fptStoreFlexItem( FPTAREAP pArea, PHB_ITEM pItem, BYTE ** bBufPtr *(*bBufPtr)++ = FPTIT_FLEXAR_ARAY; HB_PUT_LE_UINT16( *bBufPtr, ( USHORT ) ulLen ); *bBufPtr += 2; - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { hb_fptStoreFlexItem( pArea, hb_arrayGetItemPtr( pItem, i ), bBufPtr ); } @@ -2374,7 +2374,7 @@ static ERRCODE hb_fptReadFlexItem( FPTAREAP pArea, BYTE ** pbMemoBuf, BYTE * bBu if( bBufEnd - (*pbMemoBuf) >= ( LONG ) ulLen ) { hb_arrayNew( pItem, ulLen ); - for( i = 1 ; i <= ulLen ; i++ ) + for( i = 1; i <= ulLen; i++ ) { errCode = hb_fptReadFlexItem( pArea, pbMemoBuf, bBufEnd, hb_arrayGetItemPtr( pItem, i ), FALSE ); diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index 222a437d99..a8521d5b8e 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -4891,6 +4891,10 @@ static BOOL hb_ntxSortKeyGet( LPNTXSORTINFO pSort, BYTE ** pKeyVal, ULONG *pulRe pSort->pSwapPage[ ulPage ].ulKeyBuf--; return TRUE; } + + *pKeyVal = NULL; + *pulRec = 0; + return FALSE; } diff --git a/harbour/source/rdd/dbsql.c b/harbour/source/rdd/dbsql.c index b70e00fd46..e8a7c77b22 100644 --- a/harbour/source/rdd/dbsql.c +++ b/harbour/source/rdd/dbsql.c @@ -229,29 +229,40 @@ static ULONG hb_db2Sql( AREAP pArea, PHB_ITEM pFields, HB_LONG llNext, PHB_FILEBUF pFileBuf; ULONG ulRecords = 0; USHORT uiFields = 0, ui; - PHB_ITEM pTmp = hb_itemNew( NULL ); + PHB_ITEM pTmp; BOOL fWriteSep = FALSE; char * szNewLine = hb_conNewLine(); char * szInsert = NULL; BOOL fEof = TRUE; BOOL fNoFieldPassed = ( pFields == NULL || hb_arrayLen( pFields ) == 0 ); + if( SELF_FIELDCOUNT( pArea, &uiFields ) != SUCCESS ) + return 0; + if( fInsert && szTable ) szInsert = hb_xstrcpy( NULL, "INSERT INTO ", szTable, " VALUES ( ", NULL ); pFileBuf = hb_createFBuffer( hFile, HB_FILE_BUF_SIZE ); + pTmp = hb_itemNew( NULL ); - if( SELF_FIELDCOUNT( pArea, &uiFields ) == FAILURE ) - return 0; - - while( llNext-- > 0 && - ( !pWhile || hb_itemGetL( hb_vmEvalBlock( pWhile ) ) ) ) + while( llNext-- > 0 ) { - if( SELF_EOF( pArea, &fEof ) == FAILURE || fEof ) + if( pWhile ) + { + if( SELF_EVALBLOCK( pArea, pWhile ) != SUCCESS || + ! hb_itemGetL( pArea->valResult ) ) + break; + } + + if( SELF_EOF( pArea, &fEof ) != SUCCESS || fEof ) break; - /* if For is NULL, hb__Eval returns TRUE */ - if( !pFor || hb_itemGetL( hb_vmEvalBlock( pFor ) ) ) + if( pFor ) + { + if( SELF_EVALBLOCK( pArea, pWhile ) != SUCCESS ) + break; + } + if( !pFor || hb_itemGetL( pArea->valResult ) ) { ++ulRecords; @@ -279,11 +290,14 @@ static ULONG hb_db2Sql( AREAP pArea, PHB_ITEM pFields, HB_LONG llNext, { for( ui = 1; ui <= uiFields; ui ++ ) { - SELF_GETVALUE( pArea, ui, pTmp ); + if( SELF_GETVALUE( pArea, ui, pTmp ) != SUCCESS ) + break; if( fWriteSep ) hb_addStrToFBuffer( pFileBuf, szSep ); fWriteSep = hb_exportBufSqlVar( pFileBuf, pTmp, szDelim, szEsc ); } + if( ui <= uiFields ) + break; } else { @@ -296,20 +310,21 @@ static ULONG hb_db2Sql( AREAP pArea, PHB_ITEM pFields, HB_LONG llNext, fWriteSep = FALSE; } - SELF_SKIP( pArea, 1 ); + if( SELF_SKIP( pArea, 1 ) != SUCCESS ) + break; if( ( llNext % 10000 ) == 0 ) hb_inkeyPoll(); } - /* Writing EOF */ - /* hb_fsWriteLarge( hFile, (BYTE*) "\x1A", 1 ); */ - if( szInsert ) hb_xfree( szInsert ); hb_destroyFBuffer( pFileBuf ); hb_itemRelease( pTmp ); + /* Writing EOF */ + /* hb_fsWrite( hFile, ( BYTE * ) "\x1A", 1 ); */ + return ulRecords; } @@ -335,6 +350,7 @@ HB_FUNC( __DBSQL ) char * szEsc = hb_parcx( 15 ); HB_LONG llNext = HB_LONG_MAX; FHANDLE hFile; + ERRCODE errCode; if( ! szFileName ) hb_errRT_DBCMD( EG_ARG, EDBCMD_DBCMDBADPARAMETER, NULL, &hb_errFuncName ); @@ -389,16 +405,26 @@ HB_FUNC( __DBSQL ) if( fAppend ) hb_fsSeekLarge( hFile, 0, FS_END ); + errCode = SUCCESS; if( pRecord ) - SELF_GOTOID( pArea, pRecord ); + { + errCode = SELF_GOTOID( pArea, pRecord ); + } else if( pNext ) + { llNext = hb_itemGetNInt( pNext ); + } else if( !fRest ) - SELF_GOTOP( pArea ); + { + errCode = SELF_GOTOP( pArea ); + } - hb_retnint( hb_db2Sql( pArea, pFields, llNext, pWhile, pFor, - szDelim, szSep, szEsc, - szTable, hFile, fInsert, fRecno ) ); + if( errCode == SUCCESS ) + { + hb_retnint( hb_db2Sql( pArea, pFields, llNext, pWhile, pFor, + szDelim, szSep, szEsc, + szTable, hFile, fInsert, fRecno ) ); + } hb_fsClose( hFile ); } } diff --git a/harbour/source/rdd/hbsix/sxcrypt.c b/harbour/source/rdd/hbsix/sxcrypt.c index 5fc4d035ae..e433a81fff 100644 --- a/harbour/source/rdd/hbsix/sxcrypt.c +++ b/harbour/source/rdd/hbsix/sxcrypt.c @@ -65,7 +65,7 @@ static UINT32 hb_sxInitSeed( BYTE * pKeyVal, UINT16 * puiKey ) UINT32 ulSeed = 0; int i; - for( i = 0; i < 7 ; i++ ) + for( i = 0; i < 7; i++ ) { ulSeed = ( ( ( ulSeed >> 16 ) + ( ulSeed << 16 ) ) * 17 ) + HB_GET_LE_UINT16( &pKeyVal[i] ); @@ -101,7 +101,7 @@ void hb_sxEnCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen ) int i; ulSeed = hb_sxInitSeed( pKeyVal, &uiKey ); - for( ul = 0, i = 0 ; ul < ulLen ; ul++ ) + for( ul = 0, i = 0; ul < ulLen; ul++ ) { uChar = pSrc[ul]; uShft = uiKey & 0x07; @@ -122,7 +122,7 @@ void hb_sxDeCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen ) int i; ulSeed = hb_sxInitSeed( pKeyVal, &uiKey ); - for( ul = 0, i = 0 ; ul < ulLen ; ul++ ) + for( ul = 0, i = 0; ul < ulLen; ul++ ) { uChar = pSrc[ul] - ( uiKey & 0xFF ); uShft = uiKey & 0x07; diff --git a/harbour/source/rdd/wafunc.c b/harbour/source/rdd/wafunc.c index 171fd06abc..55bacdbc38 100644 --- a/harbour/source/rdd/wafunc.c +++ b/harbour/source/rdd/wafunc.c @@ -151,7 +151,7 @@ HB_EXPORT ERRCODE hb_rddGetTempAlias( char * szAliasTmp ) { int i, iArea; - for( i = 1 ; i < 1000 ; i++ ) + for( i = 1; i < 1000; i++ ) { snprintf( szAliasTmp, 11, "__HBTMP%03i", i); if( hb_rddGetAliasNumber( szAliasTmp, &iArea ) != SUCCESS ) diff --git a/harbour/source/rdd/workarea.c b/harbour/source/rdd/workarea.c index 3ddfa80622..62ac5ed137 100644 --- a/harbour/source/rdd/workarea.c +++ b/harbour/source/rdd/workarea.c @@ -150,7 +150,6 @@ static ERRCODE hb_waSkip( AREAP pArea, LONG lToSkip ) static ERRCODE hb_waSkipFilter( AREAP pArea, LONG lUpDown ) { BOOL fBottom, fDeleted; - PHB_ITEM pResult; ERRCODE uiError; HB_TRACE(HB_TR_DEBUG, ("hb_waSkipFilter(%p, %ld)", pArea, lUpDown)); @@ -186,8 +185,11 @@ static ERRCODE hb_waSkipFilter( AREAP pArea, LONG lUpDown ) /* SET FILTER TO */ if( pArea->dbfi.itmCobExpr ) { - pResult = hb_vmEvalBlock( pArea->dbfi.itmCobExpr ); - if( HB_IS_LOGICAL( pResult ) && !hb_itemGetL( pResult ) ) + if( SELF_EVALBLOCK( pArea, pArea->dbfi.itmCobExpr ) != SUCCESS ) + return FAILURE; + + if( HB_IS_LOGICAL( pArea->valResult ) && + !hb_itemGetL( pArea->valResult ) ) { if( SELF_SKIPRAW( pArea, lUpDown ) != SUCCESS ) return FAILURE; @@ -1005,7 +1007,7 @@ static ERRCODE hb_waSysName( AREAP pArea, BYTE * pBuffer ) static ERRCODE hb_waEval( AREAP pArea, LPDBEVALINFO pEvalInfo ) { LONG lNext = 1; - BOOL fEof; + BOOL fEof, fFor; HB_TRACE(HB_TR_DEBUG, ("hb_waEval(%p, %p)", pArea, pEvalInfo)); @@ -1037,13 +1039,28 @@ static ERRCODE hb_waEval( AREAP pArea, LPDBEVALINFO pEvalInfo ) if( fEof ) break; - if( pEvalInfo->dbsci.itmCobWhile && - ! hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobWhile ) ) ) - break; + if( pEvalInfo->dbsci.itmCobWhile ) + { + if( SELF_EVALBLOCK( pArea, pEvalInfo->dbsci.itmCobWhile ) != SUCCESS ) + return FAILURE; + if( ! hb_itemGetL( pArea->valResult ) ) + break; + } - if( ! pEvalInfo->dbsci.itmCobFor || - hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobFor ) ) ) - hb_vmEvalBlock( pEvalInfo->itmBlock ); + if( pEvalInfo->dbsci.itmCobFor ) + { + if( SELF_EVALBLOCK( pArea, pEvalInfo->dbsci.itmCobFor ) != SUCCESS ) + return FAILURE; + fFor = hb_itemGetL( pArea->valResult ); + } + else + fFor = TRUE; + + if( fFor ) + { + if( SELF_EVALBLOCK( pArea, pEvalInfo->itmBlock ) != SUCCESS ) + return FAILURE; + } if( pEvalInfo->dbsci.itmRecID || ( pEvalInfo->dbsci.lNext && --lNext < 1 ) ) break; @@ -1104,16 +1121,30 @@ static ERRCODE hb_waLocate( AREAP pArea, BOOL fContinue ) if( fEof ) break; - if( !fContinue && pArea->dbsi.itmCobWhile && - ! hb_itemGetL( hb_vmEvalBlock( pArea->dbsi.itmCobWhile ) ) ) - break; + if( !fContinue && pArea->dbsi.itmCobWhile ) + { + if( SELF_EVALBLOCK( pArea, pArea->dbsi.itmCobWhile ) != SUCCESS ) + return FAILURE; + if( ! hb_itemGetL( pArea->valResult ) ) + break; + } - if( ! pArea->dbsi.itmCobFor || - hb_itemGetL( hb_vmEvalBlock( pArea->dbsi.itmCobFor ) ) ) + if( ! pArea->dbsi.itmCobFor ) { pArea->fFound = TRUE; break; } + else + { + if( SELF_EVALBLOCK( pArea, pArea->dbsi.itmCobFor ) != SUCCESS ) + return FAILURE; + + if( hb_itemGetL( pArea->valResult ) ) + { + pArea->fFound = TRUE; + break; + } + } if( !fContinue && ( pArea->dbsi.itmRecID || ( pArea->dbsi.lNext && --lNext < 1 ) ) ) @@ -1133,7 +1164,7 @@ static ERRCODE hb_waLocate( AREAP pArea, BOOL fContinue ) static ERRCODE hb_waTrans( AREAP pArea, LPDBTRANSINFO pTransInfo ) { LONG lNext = 1; - BOOL fEof; + BOOL fEof, fFor; HB_TRACE(HB_TR_DEBUG, ("hb_waTrans(%p, %p)", pArea, pTransInfo)); @@ -1165,12 +1196,24 @@ static ERRCODE hb_waTrans( AREAP pArea, LPDBTRANSINFO pTransInfo ) if( fEof ) break; - if( pTransInfo->dbsci.itmCobWhile && - ! hb_itemGetL( hb_vmEvalBlock( pTransInfo->dbsci.itmCobWhile ) ) ) - break; + if( pTransInfo->dbsci.itmCobWhile ) + { + if( SELF_EVALBLOCK( pArea, pTransInfo->dbsci.itmCobWhile ) != SUCCESS ) + return FAILURE; + if( ! hb_itemGetL( pArea->valResult ) ) + break; + } - if( ! pTransInfo->dbsci.itmCobFor || - hb_itemGetL( hb_vmEvalBlock( pTransInfo->dbsci.itmCobFor ) ) ) + if( pTransInfo->dbsci.itmCobFor ) + { + if( SELF_EVALBLOCK( pArea, pTransInfo->dbsci.itmCobFor ) != SUCCESS ) + return FAILURE; + fFor = hb_itemGetL( pArea->valResult ); + } + else + fFor = TRUE; + + if( fFor ) { if( SELF_TRANSREC( pArea, pTransInfo ) != SUCCESS ) return FAILURE; @@ -1359,7 +1402,7 @@ static ERRCODE hb_waRelArea( AREAP pArea, USHORT uiRelNo, void * pRelArea ) { LPDBRELINFO lpdbRelations; USHORT uiIndex = 1; - USHORT* pWA = (USHORT *) pRelArea ; + USHORT * pWA = (USHORT *) pRelArea; /*TODO: Why pRelArea declared as void*? This creates casting hassles.*/ HB_TRACE(HB_TR_DEBUG, ("hb_waRelArea(%p, %hu, %p)", pArea, uiRelNo, pRelArea)); @@ -1375,7 +1418,7 @@ static ERRCODE hb_waRelArea( AREAP pArea, USHORT uiRelNo, void * pRelArea ) } lpdbRelations = lpdbRelations->lpdbriNext; } - return *pWA ? SUCCESS : FAILURE ; + return *pWA ? SUCCESS : FAILURE; } /* @@ -1702,16 +1745,13 @@ static ERRCODE hb_waEvalBlock( AREAP pArea, PHB_ITEM pBlock ) iCurrArea = hb_rddGetCurrentWorkAreaNumber(); if( iCurrArea != pArea->uiArea ) hb_rddSelectWorkAreaNumber( pArea->uiArea ); - else - iCurrArea = 0; pItem = hb_vmEvalBlockOrMacro( pBlock ); if( ! pArea->valResult ) pArea->valResult = hb_itemNew( NULL ); hb_itemCopy( pArea->valResult, pItem ); - if( iCurrArea ) - hb_rddSelectWorkAreaNumber( iCurrArea ); + hb_rddSelectWorkAreaNumber( iCurrArea ); return hb_vmRequestQuery() ? FAILURE : SUCCESS; } diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index 0095225f6b..c494b6c0ae 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -131,7 +131,10 @@ static BOOL hb_errGetNumCode( int * piValue, const char * szOperation ) pItem = hb_errRT_BASE_Subst( EG_ARG, 0, NULL, szOperation, HB_ERR_ARGS_BASEPARAMS ); if( !pItem ) + { + *piValue = 0; return FALSE; + } if( !HB_IS_NUMERIC( pItem ) ) hb_errInternal( HB_EI_ERRRECFAILURE, NULL, NULL, NULL ); diff --git a/harbour/source/rtl/gtcrs/hb-charmap.def b/harbour/source/rtl/gtcrs/hb-charmap.def index 6a351b0f61..a7c0b4260d 100644 --- a/harbour/source/rtl/gtcrs/hb-charmap.def +++ b/harbour/source/rtl/gtcrs/hb-charmap.def @@ -61,13 +61,15 @@ 30: '-' 5 # ACS_UARROW 31: '.' 5 # ACS_DARROW - 128-255: * 2 +128-255: * 2 + 155: '.' 1 # @acsc # include acsc section # @maz2iso # include maz2iso section :tterm = Teraterm modified terminal 0-31: '.' 1 127: '.' 1 + 155: '.' 1 04: '#' 1 16: '>' 1 17: '<' 1 diff --git a/harbour/source/rtl/gttone.c b/harbour/source/rtl/gttone.c index a55a09e7f5..96b9a00856 100644 --- a/harbour/source/rtl/gttone.c +++ b/harbour/source/rtl/gttone.c @@ -233,18 +233,8 @@ static void hb_gt_wNtTone( double dFreq, double dDurat ) /* dDuration is in 'Ticks' (18.2 per second) */ void hb_gt_w32_tone( double dFrequency, double dDuration ) { - static OSVERSIONINFO s_osv; - static BOOL s_fInit = TRUE; - HB_TRACE(HB_TR_DEBUG, ("hb_gt_w32_tone(%lf, %lf)", dFrequency, dDuration)); - if( s_fInit ) - { - s_osv.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); - GetVersionEx( &s_osv ); - s_fInit = FALSE; - } - /* * According to the Clipper NG, the duration in 'ticks' is truncated to the * interger portion ... Depending on the platform, Harbour allows a finer @@ -256,8 +246,13 @@ void hb_gt_w32_tone( double dFrequency, double dDuration ) /* keep the frequency in an acceptable range */ dFrequency = HB_MIN( HB_MAX( 0.0, dFrequency ), 32767.0 ); - /* If Windows 95 or 98, use w9xTone for BCC32, MSVC */ - if( s_osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) + /* If Windows NT or NT2k, use wNtTone, which provides TONE() + reset sequence support (new) */ + if( hb_iswinnt() || hb_iswince() ) + { + hb_gt_wNtTone( dFrequency, dDuration ); + } + else /* If Windows 95 or 98, use w9xTone for chosen C compilers */ { #if defined( HB_ARCH_32BIT ) && !defined( _M_ARM ) && \ ( defined( __BORLANDC__ ) || defined( _MSC_VER ) || \ @@ -267,12 +262,6 @@ void hb_gt_w32_tone( double dFrequency, double dDuration ) hb_gt_wNtTone( dFrequency, dDuration ); #endif } - /* If Windows NT or NT2k, use wNtTone, which provides TONE() - reset sequence support (new) */ - else /* if( s_osv.dwPlatformId == VER_PLATFORM_WIN32_NT ) */ - { - hb_gt_wNtTone( dFrequency, dDuration ); - } } #endif /* HB_OS_WIN_32 */ diff --git a/harbour/source/rtl/math.c b/harbour/source/rtl/math.c index 766278f917..89cbdbedd7 100644 --- a/harbour/source/rtl/math.c +++ b/harbour/source/rtl/math.c @@ -640,30 +640,35 @@ HB_FUNC( LOG ) HB_MATH_EXCEPTION hb_exc; double dResult, dArg = hb_parnd( 1 ); - hb_mathResetError( &hb_exc ); - dResult = log( dArg ); - if( hb_mathGetError( &hb_exc, "LOG", dArg, 0.0, dResult ) ) + if( dArg <= 0 ) + hb_retndlen( -HUGE_VAL, -1, -1 ); /* return -infinity */ + else { - if( hb_exc.handled ) - hb_retndlen( hb_exc.retval, hb_exc.retvalwidth, hb_exc.retvaldec ); - else + hb_mathResetError( &hb_exc ); + dResult = log( dArg ); + if( hb_mathGetError( &hb_exc, "LOG", dArg, 0.0, dResult ) ) { - /* math exception is up to the Harbour function, so do this as Clipper compatible as possible */ - switch( hb_exc.type ) + if( hb_exc.handled ) + hb_retndlen( hb_exc.retval, hb_exc.retvalwidth, hb_exc.retvaldec ); + else { - case HB_MATH_ERR_SING: /* argument to log was 0.0 */ - case HB_MATH_ERR_DOMAIN: /* argument to log was < 0.0 */ - hb_retndlen( -HUGE_VAL, -1, -1 ); /* return -infinity */ - break; + /* 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 */ + case HB_MATH_ERR_DOMAIN: /* argument to log was < 0.0 */ + hb_retndlen( -HUGE_VAL, -1, -1 ); /* return -infinity */ + break; - default: - hb_retnd( 0.0 ); - break; + default: + hb_retnd( 0.0 ); + break; + } } } + else + hb_retnd( dResult ); } - else - hb_retnd( dResult ); } else hb_errRT_BASE_SubstR( EG_ARG, 1095, NULL, "LOG", HB_ERR_ARGS_BASEPARAMS ); @@ -676,18 +681,23 @@ HB_FUNC( SQRT ) HB_MATH_EXCEPTION hb_exc; double dResult, dArg = hb_parnd( 1 ); - hb_mathResetError( &hb_exc ); - dResult = sqrt( dArg ); - if( hb_mathGetError( &hb_exc, "SQRT", dArg, 0.0, dResult ) ) - { - 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 */ - hb_retnd( 0.0 ); /* return 0.0 on all errors (all (?) of type DOMAIN) */ - } + if( dArg <= 0 ) + hb_retnd( 0.0 ); else - hb_retnd( dResult ); + { + hb_mathResetError( &hb_exc ); + dResult = sqrt( dArg ); + if( hb_mathGetError( &hb_exc, "SQRT", dArg, 0.0, dResult ) ) + { + 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 */ + hb_retnd( 0.0 ); /* return 0.0 on all errors (all (?) of type DOMAIN) */ + } + else + hb_retnd( dResult ); + } } else hb_errRT_BASE_SubstR( EG_ARG, 1097, NULL, "SQRT", HB_ERR_ARGS_BASEPARAMS ); diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index d714e731d4..e0cecc2a3f 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -854,7 +854,7 @@ HB_FUNC( TRANSFORM ) int iWidth, iDec; hb_itemGetNLen( pValue, &iWidth, &iDec ); iWidth += 2 + ( hb_set.HB_SET_DECIMALS << 1 ); - szStr = hb_xgrab( iWidth + 1 ); + szStr = ( char * ) hb_xgrab( iWidth + 1 ); hb_itemStrBuf( szStr, pValue, iWidth, iDec ); hb_retclen_buffer( szStr, iWidth ); }