From d7092106ece39216a77ec62c32a912c83e7be49b Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 21 Oct 2012 23:52:40 +0000 Subject: [PATCH] 2012-10-22 01:51 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbct/ctmath.c * contrib/hbct/ctstr.c * contrib/hbct/ctstrfil.c * contrib/hbct/ctstrfil.h * contrib/hbct/ctwin.c * contrib/hbct/dattime3.c * contrib/hbct/token1.c * contrib/hbct/token2.c * renamed statics to have s_/sc_ prefix * changed int to HB_FATTR for file attributes * contrib/hbct/tests/datetime.prg + implemented TODO now allowing to select language * contrib/hbsms/sms.prg + added links regarding sending in unicode * extras/httpsrv/uhttpd.prg ! fixed a TOFIX --- harbour/ChangeLog | 21 +++++++++++++++++++++ harbour/contrib/hbct/ctmath.c | 6 +++--- harbour/contrib/hbct/ctstr.c | 24 ++++++++++++------------ harbour/contrib/hbct/ctstrfil.c | 16 ++++++++-------- harbour/contrib/hbct/ctstrfil.h | 4 ++-- harbour/contrib/hbct/ctwin.c | 4 ++-- harbour/contrib/hbct/dattime3.c | 4 ++-- harbour/contrib/hbct/tests/datetime.prg | 16 +++++++++------- harbour/contrib/hbct/token1.c | 8 ++++---- harbour/contrib/hbct/token2.c | 8 ++++---- harbour/contrib/hbsms/sms.prg | 3 +++ harbour/extras/httpsrv/uhttpd.prg | 2 +- 12 files changed, 71 insertions(+), 45 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e5fc0df95e..f0c7003b8c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,27 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-22 01:51 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbct/ctmath.c + * contrib/hbct/ctstr.c + * contrib/hbct/ctstrfil.c + * contrib/hbct/ctstrfil.h + * contrib/hbct/ctwin.c + * contrib/hbct/dattime3.c + * contrib/hbct/token1.c + * contrib/hbct/token2.c + * renamed statics to have s_/sc_ prefix + * changed int to HB_FATTR for file attributes + + * contrib/hbct/tests/datetime.prg + + implemented TODO now allowing to select language + + * contrib/hbsms/sms.prg + + added links regarding sending in unicode + + * extras/httpsrv/uhttpd.prg + ! fixed a TOFIX + 2012-10-21 15:42 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbnf/aredit.prg ! deleted code that never worked right, and it's a diff --git a/harbour/contrib/hbct/ctmath.c b/harbour/contrib/hbct/ctmath.c index 71eb915b84..5065259fc7 100644 --- a/harbour/contrib/hbct/ctmath.c +++ b/harbour/contrib/hbct/ctmath.c @@ -73,18 +73,18 @@ int ct_math_exit( void ) /* ---------------- */ /* math precision */ /* ---------------- */ -static int s_ct_precision = 16; /* TODO: make this thread safe */ +static int s_iPrecision = 16; /* TODO: make this thread safe */ void ct_setprecision( int iPrecision ) { HB_TRACE( HB_TR_DEBUG, ( "ct_setprecision (%i)", iPrecision ) ); - s_ct_precision = iPrecision; + s_iPrecision = iPrecision; } int ct_getprecision( void ) { HB_TRACE( HB_TR_DEBUG, ( "ct_getprecision()" ) ); - return s_ct_precision; + return s_iPrecision; } HB_FUNC( SETPREC ) diff --git a/harbour/contrib/hbct/ctstr.c b/harbour/contrib/hbct/ctstr.c index 4f480c71f8..a8fee5a74f 100644 --- a/harbour/contrib/hbct/ctstr.c +++ b/harbour/contrib/hbct/ctstr.c @@ -276,18 +276,18 @@ const char * ct_at_charset_backward( const char * pcString, HB_SIZE sStrLen, * CSETREF() stuff */ -static int siRefSwitch = 0; /* TODO: make this tread safe */ +static int s_iRefSwitch = 0; /* TODO: make this tread safe */ void ct_setref( int iNewSwitch ) { HB_TRACE( HB_TR_DEBUG, ( "ct_setref(%i)", iNewSwitch ) ); - siRefSwitch = iNewSwitch; + s_iRefSwitch = iNewSwitch; } int ct_getref( void ) { HB_TRACE( HB_TR_DEBUG, ( "ct_getref()" ) ); - return siRefSwitch; + return s_iRefSwitch; } HB_FUNC( CSETREF ) @@ -314,18 +314,18 @@ HB_FUNC( CSETREF ) * CSETATMUPA() stuff */ -static int siAtMupaSwitch = 0; /* TODO: make this tread safe */ +static int s_iAtMupaSwitch = 0; /* TODO: make this tread safe */ void ct_setatmupa( int iNewSwitch ) { HB_TRACE( HB_TR_DEBUG, ( "ct_setatmupa(%i)", iNewSwitch ) ); - siAtMupaSwitch = iNewSwitch; + s_iAtMupaSwitch = iNewSwitch; } int ct_getatmupa( void ) { HB_TRACE( HB_TR_DEBUG, ( "ct_getatmupa()" ) ); - return siAtMupaSwitch; + return s_iAtMupaSwitch; } HB_FUNC( CSETATMUPA ) @@ -352,31 +352,31 @@ HB_FUNC( CSETATMUPA ) * SETATLIKE() stuff */ -static int siAtLikeMode = 0; /* TODO: make this tread safe */ -static char scAtLikeChar = '?'; /* TODO: make this tread safe */ +static int s_iAtLikeMode = 0; /* TODO: make this tread safe */ +static char s_cAtLikeChar = '?'; /* TODO: make this tread safe */ void ct_setatlike( int iNewMode ) { HB_TRACE( HB_TR_DEBUG, ( "ct_setatlike(%i)", iNewMode ) ); - siAtLikeMode = iNewMode; + s_iAtLikeMode = iNewMode; } int ct_getatlike( void ) { HB_TRACE( HB_TR_DEBUG, ( "ct_getatlike()" ) ); - return siAtLikeMode; + return s_iAtLikeMode; } void ct_setatlikechar( char cNewChar ) { HB_TRACE( HB_TR_DEBUG, ( "ct_setatlikechar(\'%c\')", cNewChar ) ); - scAtLikeChar = cNewChar; + s_cAtLikeChar = cNewChar; } char ct_getatlikechar( void ) { HB_TRACE( HB_TR_DEBUG, ( "ct_getatlikechar()" ) ); - return scAtLikeChar; + return s_cAtLikeChar; } HB_FUNC( SETATLIKE ) diff --git a/harbour/contrib/hbct/ctstrfil.c b/harbour/contrib/hbct/ctstrfil.c index 12c8f89a70..3613d8306c 100644 --- a/harbour/contrib/hbct/ctstrfil.c +++ b/harbour/contrib/hbct/ctstrfil.c @@ -58,27 +58,27 @@ #include "ctstrfil.h" -static int s_iFileAttr = HB_FA_NORMAL; +static HB_FATTR s_nFileAttr = HB_FA_NORMAL; static HB_BOOL s_bSafety = HB_FALSE; -void ct_setfcreate( int iFileAttr ) +void ct_setfcreate( HB_FATTR nFileAttr ) { - HB_TRACE( HB_TR_DEBUG, ( "ct_setfcreate(%i)", iFileAttr ) ); - s_iFileAttr = iFileAttr; + HB_TRACE( HB_TR_DEBUG, ( "ct_setfcreate(%u)", nFileAttr ) ); + s_nFileAttr = nFileAttr; } -int ct_getfcreate( void ) +HB_FATTR ct_getfcreate( void ) { HB_TRACE( HB_TR_DEBUG, ( "ct_getfcreate()" ) ); - return s_iFileAttr; + return s_nFileAttr; } HB_FUNC( SETFCREATE ) { - hb_retni( ct_getfcreate() ); + hb_retnl( ct_getfcreate() ); if( HB_ISNUM( 1 ) ) - ct_setfcreate( hb_parni( 1 ) ); + ct_setfcreate( hb_parnl( 1 ) ); } void ct_setsafety( HB_BOOL bSafety ) diff --git a/harbour/contrib/hbct/ctstrfil.h b/harbour/contrib/hbct/ctstrfil.h index c16f552fe2..f1fe186b19 100644 --- a/harbour/contrib/hbct/ctstrfil.h +++ b/harbour/contrib/hbct/ctstrfil.h @@ -55,8 +55,8 @@ HB_EXTERN_BEGIN -extern int ct_getfcreate( void ); -extern void ct_setfcreate( int iFileAttr ); +extern HB_FATTR ct_getfcreate( void ); +extern void ct_setfcreate( HB_FATTR nFileAttr ); extern HB_BOOL ct_getsafety( void ); extern void ct_setsafety( HB_BOOL bSafety ); diff --git a/harbour/contrib/hbct/ctwin.c b/harbour/contrib/hbct/ctwin.c index 8c62cb6fb0..07e3078495 100644 --- a/harbour/contrib/hbct/ctwin.c +++ b/harbour/contrib/hbct/ctwin.c @@ -168,7 +168,7 @@ typedef struct } HB_GTCTW, * PHB_GTCTW; -static const HB_WCHAR s_szFrameW[] = HB_B_SINGLE_W; +static const HB_WCHAR sc_szFrameW[] = HB_B_SINGLE_W; static int hb_ctw_CalcShadowWidth( int iRows, int iCols ) { @@ -2200,7 +2200,7 @@ static int hb_ctw_gt_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, iPrevWnd = hb_ctw_CurrentWindow( pCTW ); iWnd = hb_ctw_CreateWindow( pCTW, iTop, iLeft, iBottom, iRight, HB_TRUE, iClrNorm, HB_TRUE ); - hb_ctw_AddWindowBox( pCTW, iWnd, s_szFrameW, iClrNorm ); + hb_ctw_AddWindowBox( pCTW, iWnd, sc_szFrameW, iClrNorm ); HB_GTSELF_SETCURSORSTYLE( pGT, SC_NONE ); ulLast = 0; i = 0; diff --git a/harbour/contrib/hbct/dattime3.c b/harbour/contrib/hbct/dattime3.c index 2ed03481d1..1c1a28f41a 100644 --- a/harbour/contrib/hbct/dattime3.c +++ b/harbour/contrib/hbct/dattime3.c @@ -90,7 +90,7 @@ static HB_BOOL _hb_timeValid( const char * szTime, HB_SIZE nLen, int * piDecode if( nLen == 2 || nLen == 5 || nLen == 8 || nLen == 11 ) { - static const int s_iMax[] = { 23, 59, 59, 99 }; + static const int sc_iMax[] = { 23, 59, 59, 99 }; int i, iVal; HB_SIZE ul; @@ -103,7 +103,7 @@ static HB_BOOL _hb_timeValid( const char * szTime, HB_SIZE nLen, int * piDecode for( ul = 0, i = 0; fValid && ul < nLen; ul += 3, ++i ) { iVal = 10 * ( szTime[ ul ] - '0' ) + ( szTime[ ul + 1 ] - '0' ); - fValid = iVal <= s_iMax[ i ]; + fValid = iVal <= sc_iMax[ i ]; if( piDecode ) piDecode[ i ] = iVal; } diff --git a/harbour/contrib/hbct/tests/datetime.prg b/harbour/contrib/hbct/tests/datetime.prg index 483c5bda37..afe5512926 100644 --- a/harbour/contrib/hbct/tests/datetime.prg +++ b/harbour/contrib/hbct/tests/datetime.prg @@ -56,17 +56,15 @@ #include "inkey.ch" #include "setcurs.ch" -// TODO: add language module request(s) and an achoice to select different lang modules +#include "hbextlng.ch" -//: +PROCEDURE Main( cLang ) -PROCEDURE Main() - - //: LOCAL cScr LOCAL nchoice LOCAL c := .T. - LOCAL farr := { "addmonth( ddate ) Add a month to ddate ", ; + LOCAL farr := { ; + "addmonth( ddate ) Add a month to ddate ", ; "bom() Beginning of month ", ; "boq() Returns first date of qtr", ; "boy() Beginning of year ", ; @@ -91,7 +89,11 @@ PROCEDURE Main() SET DATE ANSI SET CENTURY ON - cls + IF HB_ISSTRING( cLang ) + hb_langSelect( cLang ) + ENDIF + + CLS DO WHILE c cScr := SaveScreen( 4, 5, 21, 66 ) diff --git a/harbour/contrib/hbct/token1.c b/harbour/contrib/hbct/token1.c index 474cf5767e..1daaa028d9 100644 --- a/harbour/contrib/hbct/token1.c +++ b/harbour/contrib/hbct/token1.c @@ -61,9 +61,9 @@ #include "ct.h" /* static const data */ -static const char * s_pcSeparatorStr = +static const char * sc_pcSeparatorStr = "\x00" "\x09" "\x0A" "\x0C" "\x1A" "\x20" "\x8A" "\x8C" ",.;:!\?/\\<>()#&%+-*"; -static const HB_SIZE s_sSeparatorStrLen = 26; +static const HB_SIZE sc_sSeparatorStrLen = 26; /* static data */ /* even if these are chars, variable must be int, since we need an extra -1 */ @@ -118,8 +118,8 @@ static void do_token1( int iSwitch ) pcSeparatorStr = hb_parc( 2 ); else { - pcSeparatorStr = ( const char * ) s_pcSeparatorStr; - sSeparatorStrLen = s_sSeparatorStrLen; + pcSeparatorStr = sc_pcSeparatorStr; + sSeparatorStrLen = sc_sSeparatorStrLen; } /* token counter */ diff --git a/harbour/contrib/hbct/token2.c b/harbour/contrib/hbct/token2.c index 2cd89971d6..38aa9a0f2c 100644 --- a/harbour/contrib/hbct/token2.c +++ b/harbour/contrib/hbct/token2.c @@ -209,9 +209,9 @@ static void sTokEnvDel( TOKEN_ENVIRONMENT env ) /* ================= */ /* static data */ -static const char * spcSeparatorStr = +static const char * sc_spcSeparatorStr = "\x00" "\x09" "\x0A" "\x0C" "\x1A" "\x20" "\x8A" "\x8C" ",.;:!\?/\\<>()#&%+-*"; -static const HB_SIZE ssSeparatorStrLen = 26; +static const HB_SIZE sc_sSeparatorStrLen = 26; /* TODO: make thread safe */ static TOKEN_ENVIRONMENT s_sTokenEnvironment = NULL; @@ -262,8 +262,8 @@ HB_FUNC( TOKENINIT ) pcSeparatorStr = hb_parc( 2 ); else { - pcSeparatorStr = ( const char * ) spcSeparatorStr; - sSeparatorStrLen = ssSeparatorStrLen; + pcSeparatorStr = sc_spcSeparatorStr; + sSeparatorStrLen = sc_sSeparatorStrLen; } /* skip width */ diff --git a/harbour/contrib/hbsms/sms.prg b/harbour/contrib/hbsms/sms.prg index 0bc5e1a387..77a50669ab 100644 --- a/harbour/contrib/hbsms/sms.prg +++ b/harbour/contrib/hbsms/sms.prg @@ -54,8 +54,11 @@ /* 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] */ STATIC FUNCTION port_send( h, s ) diff --git a/harbour/extras/httpsrv/uhttpd.prg b/harbour/extras/httpsrv/uhttpd.prg index 78244b4900..25d49d50a4 100644 --- a/harbour/extras/httpsrv/uhttpd.prg +++ b/harbour/extras/httpsrv/uhttpd.prg @@ -1799,7 +1799,7 @@ STATIC PROCEDURE defineServer( hSocket ) _SERVER[ "SERVER_SOFTWARE" ] := APP_NAME + " " + APP_VERSION + " (" + OS() + ")" _SERVER[ "SERVER_SIGNATURE" ] := "
" + _SERVER[ "SERVER_SOFTWARE" ] + " Server at " + _SERVER[ "SERVER_NAME" ] + " Port " + _SERVER[ "SERVER_PORT" ] + "
" _SERVER[ "DOCUMENT_ROOT" ] := s_cDocumentRoot - _SERVER[ "SERVER_ADMIN" ] := "root@localhost" // TOFIX: put real user + _SERVER[ "SERVER_ADMIN" ] := hb_UserName() + "@" + NetName() _SERVER[ "SCRIPT_FILENAME" ] := NIL _SERVER[ "GATEWAY_INTERFACE" ] := "CGI/1.1" _SERVER[ "SCRIPT_URL" ] := NIL