2013-03-06 12:17 UTC+0100 Viktor Szakats (harbour syenar.net)

* src/vm/hashfunc.c
    + HB_HAUTOADD() extended, now it accepts 3rd parameter to
      set the default value used when autoadding a hash item,
      making separate HB_HDEFAULT() call unnecessary:
         hb_HAutoAdd( <hash>, [<nAutoAdd>|<lAutoAdd>], [<xDefault>] ) -> <nOldAutoAdd>

  * contrib/xhb/hbcompat.ch
  * doc/en/hashes.txt
  * src/vm/hashfunc.c
    * deprecated following Harbour core functions with HB_LEGACY_LEVEL5:
         hb_HSetCaseMatch(), hb_HSetAutoAdd(), hb_HSetBinary(), hb_HSetOrder()
      use these alternatives:
         hb_HCaseMatch(), hb_HAutoAdd(), hb_HBinary(), hb_HKeepOrder()
      they return the previous setting instead of the hash itself.

  * contrib/hbct/token1.c
    ! marked hidden/dirty Harbour extensions with HB_EXTENSION tag

  * src/debug/dbgtobj.prg
  + tests/dbgcls.prg
    ! ACCESS var is implemented using a full METHOD syntax, which can
      contain debug information. HVM sees this information while displaying
      ACCESS var value, the debugger gets reinvoked and confused.
      Patch and test code (hbformatted)
      by Aleksander Czajczynski. Thanks for the nice patch.
         https://groups.google.com/d/topic/harbour-devel/43hoC7GV7C4/discussion

  * src/rtl/alert.prg
    ! Alert()/hb_Alert(): fixed display colors when color parameter
      contained multiple color items.
      Reported by Tony Quick
         https://groups.google.com/d/topic/harbour-devel/20vFUGGtx9c/discussion
    * formatted 2 long lines for better readability

  * tests/altd.prg
    + light testing of custom Alert() colors

  * src/rtl/menuto.prg
    % added logic to avoid flicker when moving around the mouse.
      Protected by HB_CLP_STRICT, because Clipper flickers the same
      way, but it's something that seems possible to fix w/o adverse
      side effects on user level or breaking documented C5.3 behavior.
      Report if you think otherwise.
      Original patch provided by Miso Pucko in #3500627
         https://sourceforge.net/tracker/?func=detail&aid=3500627&group_id=681&atid=100681
    ; Checkme

  * tests/browse.prg
  * tests/menuto.prg
    + enabled mouse
    * minor cleanups

  * contrib/hbgd/gdchart.prg
  * contrib/hbgd/tests/cgi.prg
  * contrib/hbtip/cgi.prg
  * extras/httpsrv/cgifunc.prg
  * extras/httpsrv/uhttpd.prg
  * src/rdd/usrrdd/rdds/arrayrdd.prg
    * use 'h[ k ] := v' instead of 'hb_HSet( h, k, v )'
    * use 'h[ k ]' instead of 'hb_HGet( h, k )'
    ; do not use above function in Harbour sources

  * contrib/hbtip/mail.prg
  * contrib/hbtip/tests/loadhtml.prg
  * contrib/hbtip/thtml.prg
  * contrib/hbwin/tests/olesrv2.prg
  * contrib/xhb/hbcompat.ch
  * contrib/xhb/xhbhash.c
  * extras/httpsrv/cgifunc.prg
  * extras/httpsrv/uhttpd.prg
    * avoid deprecated hash functions in Harbour sources
This commit is contained in:
Viktor Szakats
2013-03-06 11:19:44 +00:00
parent 530a410e87
commit 50cfaab12f
23 changed files with 317 additions and 282 deletions

View File

@@ -57,7 +57,6 @@
#define CRLF ( Chr( 13 ) + Chr( 10 ) )
#xtranslate Throw( <oErr> ) => ( Eval( ErrorBlock(), <oErr> ), Break( <oErr> ) )
#define HB_IHASH() hb_HSetCaseMatch( { => }, .F. )
MEMVAR _SERVER, _GET, _POST, _COOKIE, _REQUEST, _HTTP_REQUEST
@@ -138,7 +137,7 @@ FUNCTION uhttpd_SplitUrl( cUrl )
LOCAL cUri
// Prevents case matching
hb_HSetCaseMatch( hUrl, .F. )
hb_HCaseMatch( hUrl, .F. )
cTemp := cUrl
cUri := ""
@@ -248,18 +247,18 @@ FUNCTION uhttpd_SplitUrl( cUrl )
ENDIF
// Assemble hash
hb_HSet( hUrl, "SCHEME" , cProto )
hb_HSet( hUrl, "HOST" , cHost )
hb_HSet( hUrl, "PORT" , nPort )
hb_HSet( hUrl, "USER" , cUser )
hb_HSet( hUrl, "PASS" , cPass )
hb_HSet( hUrl, "PATH" , cPath )
hb_HSet( hUrl, "QUERY" , cQuery )
hb_HSet( hUrl, "FRAGMENT", cFragment )
hb_HSet( hUrl, "URI" , cURI )
hUrl[ "SCHEME" ] := cProto
hUrl[ "HOST" ] := cHost
hUrl[ "PORT" ] := nPort
hUrl[ "USER" ] := cUser
hUrl[ "PASS" ] := cPass
hUrl[ "PATH" ] := cPath
hUrl[ "QUERY" ] := cQuery
hUrl[ "FRAGMENT" ] := cFragment
hUrl[ "URI" ] := cURI
// Prevents externals to add something else to this Hash
hb_HSetAutoAdd( hUrl, .F. )
hb_HAutoAdd( hUrl, .F. )
RETURN hUrl

View File

@@ -139,7 +139,6 @@ REQUEST GDIMAGE, GDIMAGECHAR, GDCHART
#define HRB_ACTIVATE_CACHE .F. // if .T. caching of HRB modules will be enabled. (NOTE: changes of files will not be loaded until server is active)
#define CR_LF ( Chr( 13 ) + Chr( 10 ) )
#define HB_IHASH() hb_HSetCaseMatch( { => }, .F. )
#ifdef __PLATFORM__WINDOWS
REQUEST HB_GT_WVT_DEFAULT
@@ -246,7 +245,7 @@ PROCEDURE Main( ... )
ENDIF
// TOCHECK: now not force case insensitive
// hb_HSetCaseMatch( s_hScriptAliases, .F. )
// hb_HCaseMatch( s_hScriptAliases, .F. )
// ----------------- Line command parameters checking ----------------------
@@ -334,7 +333,7 @@ PROCEDURE Main( ... )
// i.e. we can have /info or /Info that will be different unless lScriptAliasMixedCase will be .F.
FOR EACH xVal IN hDefault[ "SCRIPTALIASES" ]
IF HB_ISSTRING( xVal )
hb_HSet( s_hScriptAliases, iif( lScriptAliasMixedCase, xVal:__enumKey(), Upper( xVal:__enumKey() ) ), xVal )
s_hScriptAliases[ iif( lScriptAliasMixedCase, xVal:__enumKey(), Upper( xVal:__enumKey() ) ) ] := xVal
ENDIF
NEXT
@@ -342,7 +341,7 @@ PROCEDURE Main( ... )
// i.e. we can have /info or /Info that will be different
FOR EACH xVal IN hDefault[ "ALIASES" ]
IF HB_ISSTRING( xVal )
hb_HSet( s_hAliases, xVal:__enumKey(), xVal )
s_hAliases[ xVal:__enumKey() ] := xVal
ENDIF
NEXT
@@ -916,8 +915,8 @@ STATIC FUNCTION ProcessConnection()
// hb_ToOutDebug( "cRequest -- BEGIN --\n\r%s\n\rcRequest -- END --\n\r", cRequest )
_SERVER := HB_IHASH(); _GET := HB_IHASH(); _POST := HB_IHASH(); _COOKIE := HB_IHASH()
_SESSION := HB_IHASH(); _REQUEST := HB_IHASH(); _HTTP_REQUEST := HB_IHASH(); _HTTP_RESPONSE := HB_IHASH()
_SERVER := HB_HASHI(); _GET := HB_HASHI(); _POST := HB_HASHI(); _COOKIE := HB_HASHI()
_SESSION := HB_HASHI(); _REQUEST := HB_HASHI(); _HTTP_REQUEST := HB_HASHI(); _HTTP_RESPONSE := HB_HASHI()
m_cPost := NIL
t_cResult := ""
// t_aHeader := {}
@@ -1065,8 +1064,8 @@ STATIC FUNCTION ServiceConnection()
// hb_ToOutDebug( "cRequest -- INIZIO --\n\r%s\n\rcRequest -- FINE --\n\r", cRequest )
_SERVER := HB_IHASH(); _GET := HB_IHASH(); _POST := HB_IHASH(); _COOKIE := HB_IHASH()
_SESSION := HB_IHASH(); _REQUEST := HB_IHASH(); _HTTP_REQUEST := HB_IHASH(); _HTTP_RESPONSE := HB_IHASH()
_SERVER := HB_HASHI(); _GET := HB_HASHI(); _POST := HB_HASHI(); _COOKIE := HB_HASHI()
_SESSION := HB_HASHI(); _REQUEST := HB_HASHI(); _HTTP_REQUEST := HB_HASHI(); _HTTP_RESPONSE := HB_HASHI()
m_cPost := NIL
t_cResult := ""
// t_aHeader := {}
@@ -1202,12 +1201,12 @@ STATIC FUNCTION ParseRequest( cRequest )
// Load _HTTP_REQUEST
FOR EACH cReq IN aRequest
IF cReq:__enumIndex() == 1 // GET request
hb_HSet( _HTTP_REQUEST, "HTTP Request", cReq )
_HTTP_REQUEST[ "HTTP Request" ] := cReq
ELSEIF Empty( cReq )
EXIT
ELSE
aVal := uhttpd_split( ":", cReq, 1 )
hb_HSet( _HTTP_REQUEST, aVal[ 1 ], iif( Len( aVal ) == 2, AllTrim( aVal[ 2 ] ), NIL ) )
_HTTP_REQUEST[ aVal[ 1 ] ] := iif( Len( aVal ) == 2, AllTrim( aVal[ 2 ] ), NIL )
ENDIF
NEXT
@@ -1666,15 +1665,15 @@ PROCEDURE uhttpd_SetHeader( cType, cValue )
// // Needed from SetCookie()
// __defaultNIL( @lReplace, .T. )
hb_HSet( _HTTP_RESPONSE, cType, cValue )
_HTTP_RESPONSE[ cType ] := cValue
/*
#if 0
IF lReplace .AND. ( nI := AScan( t_aHeader, {| x | Upper( x[ 1 ] ) == Upper( cType ) } ) ) > 0
t_aHeader[ nI, 2 ] := cValue
ELSE
AAdd( t_aHeader, { cType, cValue } )
ENDIF
*/
#endif
RETURN
@@ -2288,31 +2287,25 @@ STATIC FUNCTION ParseIni( cConfig )
// Define here what attributes we can have in ini config file and their defaults
// Please add all keys in uppercase. hDefaults is Case Insensitive
hDefault := hb_HSetCaseMatch( ;
{ ;
"MAIN" => { ;
"PORT" => LISTEN_PORT ,;
"APPLICATION_ROOT" => EXE_Path() ,;
"DOCUMENT_ROOT" => EXE_Path() + hb_ps() + "home" ,;
"SHOW_INDEXES" => .F. ,;
"SCRIPTALIASMIXEDCASE" => .T. ,;
"SESSIONPATH" => EXE_Path() + hb_ps() + "sessions" ,;
"DIRECTORYINDEX" => DIRECTORYINDEX_ARRAY ,;
"CONSOLE-ROWS" => MaxRow() + 1 ,;
"CONSOLE-COLS" => MaxCol() + 1 ;
},;
"LOGFILES" => { ;
"ACCESS" => FILE_ACCESS_LOG ,;
"ERROR" => FILE_ERROR_LOG ;
},;
"THREADS" => { ;
"MAX_WAIT" => THREAD_MAX_WAIT ,;
"START_NUM" => START_RUNNING_THREADS ,;
"MAX_NUM" => MAX_RUNNING_THREADS ;
},;
"SCRIPTALIASES" => { => } ,;
"ALIASES" => { => } ;
}, .F. )
hDefault := { ;
"MAIN" => { "PORT" => LISTEN_PORT , ;
"APPLICATION_ROOT" => EXE_Path() , ;
"DOCUMENT_ROOT" => EXE_Path() + hb_ps() + "home", ;
"SHOW_INDEXES" => .F. , ;
"SCRIPTALIASMIXEDCASE" => .T. , ;
"SESSIONPATH" => EXE_Path() + hb_ps() + "sessions" , ;
"DIRECTORYINDEX" => DIRECTORYINDEX_ARRAY , ;
"CONSOLE-ROWS" => MaxRow() + 1 , ;
"CONSOLE-COLS" => MaxCol() + 1 }, ;
"LOGFILES" => { "ACCESS" => FILE_ACCESS_LOG , ;
"ERROR" => FILE_ERROR_LOG }, ;
"THREADS" => { "MAX_WAIT" => THREAD_MAX_WAIT , ;
"START_NUM" => START_RUNNING_THREADS , ;
"MAX_NUM" => MAX_RUNNING_THREADS }, ;
"SCRIPTALIASES" => { => } , ;
"ALIASES" => { => } }
hb_HCaseMatch( hDefault, .F. )
// hb_ToOutDebug( "hDefault = %s\n\r", hb_ValToExp( hDefault ) )
@@ -2434,7 +2427,7 @@ STATIC FUNCTION FileUnAlias( cScript )
// Checking if the request contains a Script Alias
IF hb_HHasKey( s_hScriptAliases, cScript )
// in this case I have to substitute the alias with the real file name
cFileName := hb_HGet( s_hScriptAliases, cScript )
cFileName := s_hScriptAliases[ cScript ]
// substitute macros
cFileName := StrTran( cFileName, "$(DOCROOT_DIR)", _SERVER[ "DOCUMENT_ROOT" ] )
@@ -2724,7 +2717,7 @@ STATIC FUNCTION Handler_HrbScript( cFileName )
IF HRB_ACTIVATE_CACHE
// caching modules
IF ! hb_HHasKey( s_hHRBModules, cFileName )
hb_HSet( s_hHRBModules, cFileName, HRB_LoadFromFile( uhttpd_OSFileName( cFileName ) ) )
s_hHRBModules[ cFileName ] := HRB_LoadFromFile( uhttpd_OSFileName( cFileName ) )
ENDIF
cHRBBody := s_hHRBModules[ cFileName ]
ENDIF
@@ -2884,3 +2877,11 @@ STATIC FUNCTION UHTTPD_UTCOFFSET()
RETURN iif( nOffset < 0, "-", "+" ) + ;
StrZero( nOffset / 3600, 2, 0 ) + ;
StrZero( ( nOffset % 3600 ) / 60, 2, 0 )
STATIC FUNCTION HB_HASHI()
LOCAL h := { => }
hb_HCaseMatch( h, .F. )
RETURN h