2009-06-15 20:37 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* examples/uhttpd2/uwidgets.prg
  * examples/uhttpd2/uhbext.prg
  * examples/uhttpd2/app.prg
  + examples/uhttpd2/umutex.c
    * Embedded C moved to separate file.
    % Using Harbour's hb_HGetDef() instead of local version.
This commit is contained in:
Viktor Szakats
2009-06-15 18:37:38 +00:00
parent 131fd93c5f
commit d3e965d9a2
5 changed files with 55 additions and 52 deletions

View File

@@ -17,6 +17,14 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-15 20:37 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* examples/uhttpd2/uwidgets.prg
* examples/uhttpd2/uhbext.prg
* examples/uhttpd2/app.prg
+ examples/uhttpd2/umutex.c
* Embedded C moved to separate file.
% Using Harbour's hb_HGetDef() instead of local version.
2009-06-15 20:33 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* examples/uhttpd2/socket.c
* Minor updates.

View File

@@ -117,9 +117,9 @@ LOCAL cUser, oM, oF, oG
ELSEIF cMethod == "POST"
DBUSEAREA(.T.,, "users", "users", .T., .T.)
OrdSetFocus("user")
cUser := PADR(HGetDef(post, "user", ""), 16)
cUser := PADR(hb_HGetDef(post, "user", ""), 16)
IF !EMPTY(cUser) .AND. DBSEEK(cUser, .F.) .AND. ! DELETED() .AND. ;
PADR(HGetDef(post, "password", ""), 16) == FIELD->PASSWORD
PADR(hb_HGetDef(post, "password", ""), 16) == FIELD->PASSWORD
session["loggedin"] := cUser
URedirect("main")
ELSE
@@ -157,10 +157,10 @@ LOCAL cUser, cName, cPassword, cPassword2, oM, oF, oG
ELSEIF cMethod == "POST"
DBUSEAREA(.T.,, "users", "users", .T., .F.)
OrdSetFocus("user")
cUser := HGetDef(post, "user", "")
cName := HGetDef(post, "name", "")
cPassword := HGetDef(post, "password", "")
cPassword2 := HGetDef(post, "password2", "")
cUser := hb_HGetDef(post, "user", "")
cName := hb_HGetDef(post, "name", "")
cPassword := hb_HGetDef(post, "password", "")
cPassword2 := hb_HGetDef(post, "password2", "")
GetWidgetById("user"):cValue := cUser
GetWidgetById("name"):cValue := cName
IF EMPTY(cUser) .OR. EMPTY(cName) .OR. EMPTY(cPassword) .OR. EMPTY(cPassword2)
@@ -244,9 +244,9 @@ LOCAL cName, cPassword, cPassword2, oM, oG, oF
oG:Add( UWSubmitNew("save", "Save"), 5, 2 )
ELSEIF cMethod == "POST"
DBSEEK(session["loggedin"], .F.)
cName := HGetDef(post, "name", "")
cPassword := HGetDef(post, "password", "")
cPassword2 := HGetDef(post, "password2", "")
cName := hb_HGetDef(post, "name", "")
cPassword := hb_HGetDef(post, "password", "")
cPassword2 := hb_HGetDef(post, "password2", "")
GetWidgetById("name"):cValue := TRIM(cName)
IF EMPTY(cName)
URedirect("?err=1")

View File

@@ -9,10 +9,6 @@
*************************************************************/
FUNC HGetDef(aHash, xKey, xDefault)
RETURN IIF(HB_HHasKey(aHash, xKey), aHash[ xKey ], xDefault)
FUNC split(cSeparator, cString)
LOCAL aRet := {}, nI
@@ -37,38 +33,3 @@ LOCAL cRet := "", nI
ENDIF
NEXT
RETURN cRet
#pragma begindump
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbthread.h"
typedef struct _HB_MUTEX
{
int lock_count;
int lockers;
int waiters;
PHB_ITEM events;
HB_THREAD_ID owner;
HB_RAWCRITICAL_T mutex;
HB_RAWCOND_T cond_l;
HB_RAWCOND_T cond_w;
BOOL fSync;
struct _HB_MUTEX * pNext;
struct _HB_MUTEX * pPrev;
}
HB_MUTEX, * PHB_MUTEX;
HB_FUNC( HB_MUTEXWAITERSCOUNT )
{
PHB_MUTEX pItem = ( PHB_MUTEX ) hb_param( 1, HB_IT_POINTER );
if( pItem )
hb_retni( ( ( PHB_MUTEX ) hb_itemGetPtr( pItem ) )->waiters );
else
hb_ret();
}
#pragma enddump

View File

@@ -0,0 +1,34 @@
/*
* $Id$
*/
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbthread.h"
typedef struct _HB_MUTEX
{
int lock_count;
int lockers;
int waiters;
PHB_ITEM events;
HB_THREAD_ID owner;
HB_RAWCRITICAL_T mutex;
HB_RAWCOND_T cond_l;
HB_RAWCOND_T cond_w;
BOOL fSync;
struct _HB_MUTEX * pNext;
struct _HB_MUTEX * pPrev;
}
HB_MUTEX, * PHB_MUTEX;
HB_FUNC( HB_MUTEXWAITERSCOUNT )
{
PHB_MUTEX pItem = ( PHB_MUTEX ) hb_param( 1, HB_IT_POINTER );
if( pItem )
hb_retni( ( ( PHB_MUTEX ) hb_itemGetPtr( pItem ) )->waiters );
else
hb_ret();
}

View File

@@ -431,7 +431,7 @@ LOCAL aStack, aURL, aFrame, cI, nI, nL, lRet
? "cURL:", cURL
IF HB_HHasKey(aMap, cURL)
// aStack[i] = {url_part, function, variables}
IF (aStack := HGetDef(session, "_ustack")) == NIL
IF (aStack := hb_HGetDef(session, "_ustack")) == NIL
session["_ustack"] := aStack := {}
ENDIF
@@ -496,12 +496,12 @@ RETURN
PROC UWDefaultHandler(cMethod)
LOCAL cID, oW
IF cMethod == "GET"
IF (cID := HGetDef(get, "ajax")) == NIL
IF (cID := hb_HGetDef(get, "ajax")) == NIL
session["_uthis", "main"]:Paint()
ELSE
IF (oW := GetWidgetById(cID)) != NIL
UAddHeader("Content-type", "text/html; charset=windows-1257")
oW:Ajax(HGetDef(get, "action"))
oW:Ajax(hb_HGetDef(get, "action"))
ENDIF
ENDIF
ENDIF
@@ -517,4 +517,4 @@ RETURN
FUNC GetWidgetById(cID)
RETURN HGetDef(session["_uthis", "idhash"], cID)
RETURN hb_HGetDef(session["_uthis", "idhash"], cID)