2006-11-13 03:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/bin/hb-func.sh
    + pass GTK paths to GCC in hb* scripts when -xbgtk switch is used

  * harbour/contrib/rdd_ads/rddads.h
  * harbour/contrib/rdd_ads/adsfunc.c
    * indenting and casting

  * harbour/source/rdd/dbfcdx/dbfcdx1.c
    * cleaned typos in comments

  + harbour/tests/speedtst.prg
    + added speed test

  * harbour/include/hbpp.h
  * harbour/source/pp/ppcore.c
    + added HB_PP_TOKEN_ISNEUTRAL() macro to make code a little bit more
      readable

  * harbour/include/std.ch
    + added some missing old PP commands

  * harbour/source/Makefile
    * minor modification in order of compiled libraries

  * harbour/source/pp/pplib.c
    * changed the PP interface for .prg code.
      Now following functions are supported:

         __PP_INIT( [<cIncludePath>] [, <cStdChFile> ] ) -> <pPP>
            initialize new PP context and return pointer to it.
            when <cStdChFile> is empty string ("") then no default rules are
            used  only the dynamically created #defines like __HARBOUR__,
            __DATE__, __TIME__, __PLATFORM__*

         __PP_FREE( <pPP> )
            free PP context.

         __PP_PATH( <pPP>, <cPath> [, <lClearPrev>] )
            add new (or replace previous) include paths.

         __PP_RESET( <pPP> )
            reset the PP context (remove all rules added by user or
            preprocessed code)

         __PP_ADDRULE( <pPP>, <cDirective> )
            preprocess and execute new preprocessor directive

         __PREPROCESS( <pPP>, <cCode> ) -> <cPreprocessedCode>
            preprocess given code and return result

      User can create more then one PP context and then use each of them
      separately. Any modification in one context have no effect in other.
This commit is contained in:
Przemyslaw Czerpak
2006-11-13 02:40:33 +00:00
parent 16f0722343
commit d99b93ad14
11 changed files with 685 additions and 50 deletions

View File

@@ -8,6 +8,60 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
- Remove one TOFIX item with was fixed (PP of a long line).
+ Add 3 TOFIX items (these are all that I know of).
+ doc/pp.txt
* PP description by Przemyslaw Czerpak (druzus/at/priv.onet.pl)
2006-11-13 03:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/hb-func.sh
+ pass GTK paths to GCC in hb* scripts when -xbgtk switch is used
* harbour/contrib/rdd_ads/rddads.h
* harbour/contrib/rdd_ads/adsfunc.c
* indenting and casting
* harbour/source/rdd/dbfcdx/dbfcdx1.c
* cleaned typos in comments
+ harbour/tests/speedtst.prg
+ added speed test
* harbour/include/hbpp.h
* harbour/source/pp/ppcore.c
+ added HB_PP_TOKEN_ISNEUTRAL() macro to make code a little bit more
readable
* harbour/include/std.ch
+ added some missing old PP commands
* harbour/source/Makefile
* minor modification in order of compiled libraries
* harbour/source/pp/pplib.c
* changed the PP interface for .prg code.
Now following functions are supported:
__PP_INIT( [<cIncludePath>] [, <cStdChFile> ] ) -> <pPP>
initialize new PP context and return pointer to it.
when <cStdChFile> is empty string ("") then no default rules are
used only the dynamically created #defines like __HARBOUR__,
__DATE__, __TIME__, __PLATFORM__*
__PP_FREE( <pPP> )
free PP context.
__PP_PATH( <pPP>, <cPath> [, <lClearPrev>] )
add new (or replace previous) include paths.
__PP_RESET( <pPP> )
reset the PP context (remove all rules added by user or
preprocessed code)
__PP_ADDRULE( <pPP>, <cDirective> )
preprocess and execute new preprocessor directive
__PREPROCESS( <pPP>, <cCode> ) -> <cPreprocessedCode>
preprocess given code and return result

View File

@@ -377,6 +377,7 @@ do
done
if [ "\${HB_XBGTK}" = "yes" ]; then
HARBOUR_LIBS="\${HARBOUR_LIBS} -lxbgtk"
HB_PATHS="\${HB_PATHS} -I\`PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --variable=xbgtkincludedir xbgtk\`"
fi
if [ "\${HB_HWGUI}" = "yes" ]; then
HARBOUR_LIBS="\${HARBOUR_LIBS} -lhwgui -lprocmisc -lhbxml"

View File

@@ -2073,7 +2073,6 @@ HB_FUNC( ADSCONNECT60 )
if( ulRetVal == AE_SUCCESS )
{
// determine if is a DataDict
UNSIGNED16 usType;
PHB_ITEM piByRefHandle = hb_param( 6, HB_IT_BYREF );
adsConnectHandle = hConnect; // set new default
@@ -2095,7 +2094,7 @@ HB_FUNC( ADSDDCREATE )
{
UNSIGNED32 ulRetVal;
UNSIGNED8 *pucDictionaryPath = (UNSIGNED8 *) hb_parcx( 1 );
UNSIGNED16 usEncrypt = (UNSIGNED16) ISNUM( 2 ) ? hb_parnl( 2 ) : (ISLOG( 2 ) ? hb_parl( 2 ) : 0 ) ;
UNSIGNED16 usEncrypt = (UNSIGNED16) ( ISNUM( 2 ) ? hb_parnl( 2 ) : ( ISLOG( 2 ) ? hb_parl( 2 ) : 0 ) );
UNSIGNED8 *pucDescription = ISCHAR( 3 ) ? (UNSIGNED8 *) hb_parcx( 3 ) : NULL;
ADSHANDLE hConnect = 0;
@@ -2268,12 +2267,13 @@ HB_FUNC( ADSDDGETUSERPROPERTY )
if (ulRetVal == AE_SUCCESS )
{
hb_storc(pvProperty, 3 );
hb_storc( (char *) pvProperty, 3 );
}
else
{
hb_storc( "", 3 );
}
hb_retl( ulRetVal == AE_SUCCESS );
}

View File

@@ -167,6 +167,17 @@ extern ADSAREAP hb_rddGetADSWorkAreaPointer( void );
extern char * hb_adsOemToAnsi( char * pcString, ULONG ulLen );
extern char * hb_adsAnsiToOem( char * pcString, ULONG ulLen );
void hb_adsOemAnsiFree( char * pcString );
UNSIGNED32 ENTRYPOINT AdsSetFieldRaw( ADSHANDLE hObj,
UNSIGNED8 *pucFldName,
UNSIGNED8 *pucBuf,
UNSIGNED32 ulLen );
UNSIGNED32 ENTRYPOINT AdsGetFieldRaw( ADSHANDLE hTbl,
UNSIGNED8 *pucFldName,
UNSIGNED8 *pucBuf,
UNSIGNED32 *pulLen );
#else
# define hb_adsOemToAnsi( s, l ) ( s )
# define hb_adsAnsiToOem( s, l ) ( s )
@@ -175,13 +186,3 @@ extern ADSAREAP hb_rddGetADSWorkAreaPointer( void );
HB_EXTERN_END
UNSIGNED32 ENTRYPOINT AdsSetFieldRaw( ADSHANDLE hObj,
UNSIGNED8 *pucFldName,
UNSIGNED8 *pucBuf,
UNSIGNED32 ulLen );
UNSIGNED32 ENTRYPOINT AdsGetFieldRaw( ADSHANDLE hTbl,
UNSIGNED8 *pucFldName,
UNSIGNED8 *pucBuf,
UNSIGNED32 *pulLen );

View File

@@ -309,6 +309,9 @@ typedef HB_PP_SWITCH_FUNC * PHB_PP_SWITCH_FUNC;
HB_PP_TOKEN_TYPE(t) == HB_PP_TOKEN_EQ || \
HB_PP_TOKEN_TYPE(t) == HB_PP_TOKEN_LEFT_SB )
#define HB_PP_TOKEN_ISNEUTRAL(t) ( HB_PP_TOKEN_TYPE(t) == HB_PP_TOKEN_DEC || \
HB_PP_TOKEN_TYPE(t) == HB_PP_TOKEN_INC )
/* I do not want to replicate exactly Clipper PP behavior and check if
expression is valid.
it's wrong and causes that potentially valid expressions are not

View File

@@ -656,4 +656,17 @@
#endif /* HB_COMPAT_C53 */
#ifdef HB_EXTENSION
#command SET FILECASE <(x)> => Set( _SET_FILECASE, <(x)> )
#command SET FILECASE (<x>) => Set( _SET_FILECASE, <x> )
#command SET DIRCASE <(x)> => Set( _SET_DIRCASE, <(x)> )
#command SET DIRCASE (<x>) => Set( _SET_DIRCASE, <x> )
#command SET DIRSEPARATOR <x> => Set( _SET_DIRSEPARATOR, <x> )
#command SET DBFLOCKSCHEME TO <x> => Set( _SET_DBFLOCKSCHEME, <x> )
#command SET DBFLOCKSCHEME TO => Set( _SET_DBFLOCKSCHEME, 0 )
#command SET HARDCOMMIT <x:ON,OFF,&> => Set( _SET_HARDCOMMIT, <(x)> )
#command SET HARDCOMMIT (<x>) => Set( _SET_HARDCOMMIT, <x> )
#endif
#endif /* HB_STD_CH_ */

View File

@@ -11,12 +11,12 @@ ifeq ($(HB_COMPILER),bcc16)
# is necessary to use the DJGPP Harbour compiler.
DIRS=\
codepage \
common \
pp \
rtl \
vm \
macro \
codepage \
lang \
rdd \
debug \
@@ -24,13 +24,13 @@ DIRS=\
else
DIRS=\
codepage \
common \
pp \
compiler \
rtl \
vm \
macro \
codepage \
lang \
rdd \
debug \

View File

@@ -2915,7 +2915,7 @@ static BOOL hb_pp_tokenSkipExp( PHB_PP_TOKEN * pTokenPtr, PHB_PP_TOKEN pStop,
HB_PP_TOKEN_RIGHT_CB ) );
++iBraces;
}
if( curtype != HB_PP_TOKEN_INC && curtype != HB_PP_TOKEN_DEC )
if( !HB_PP_TOKEN_ISNEUTRAL( curtype ) )
prevtype = curtype;
pToken = pToken->pNext;
}

View File

@@ -84,64 +84,90 @@ static void hb_pp_Disp( const char * szMessage )
HB_SYMBOL_UNUSED( szMessage );
}
static PHB_PP_STATE hb_pp_stateNew( char * szStdCh )
{
PHB_PP_STATE pState = hb_pp_new();
if( pState )
{
hb_pp_init( pState, szStdCh, TRUE, NULL, NULL,
hb_pp_ErrorMessage, hb_pp_Disp, NULL, NULL, NULL );
if( ! s_pp_state )
s_pp_state = pState;
}
return pState;
}
static void hb_pp_stateFree( PHB_PP_STATE pState )
{
if( pState )
{
if( pState == s_pp_state )
s_pp_state = NULL;
hb_pp_free( pState );
}
}
static PHB_PP_STATE hb_pp_stateParam( int * piParam )
{
PHB_ITEM pItem = hb_parptr( 1 );
PHB_PP_STATE pState = ( PHB_PP_STATE ) hb_parptr( 1 );
if( pItem )
if( pState )
{
* piParam = 2;
return ( PHB_PP_STATE ) hb_itemGetPtr( pItem );
return pState;
}
else
{
* piParam = 1;
if( !s_pp_state )
{
s_pp_state = hb_pp_new();
hb_pp_init( s_pp_state, NULL, TRUE, NULL, NULL,
hb_pp_ErrorMessage, hb_pp_Disp, NULL, NULL, NULL );
}
return s_pp_state;
return hb_pp_stateNew( NULL );
else
return s_pp_state;
}
}
/*
* initialize new PP context and return pointer to it.
* __PP_INIT( [<cIncludePath>] [, <cStdChFile> ] )
* 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 pState;
int iParam;
pState = hb_pp_stateParam( &iParam );
hb_pp_stateFree( s_pp_state );
pState = hb_pp_stateNew( hb_parc( 2 ) );
if( pState )
{
hb_pp_reset( pState );
if( ISCHAR( iParam ) )
hb_pp_addSearchPath( pState, hb_parc( iParam ), TRUE );
if( ISCHAR( 1 ) )
hb_pp_addSearchPath( pState, hb_parc( 1 ), TRUE );
hb_retptr( pState );
}
else
hb_ret();
}
/*
* free PP context.
* __PP_FREE( <pPP> )
*/
HB_FUNC( __PP_FREE )
{
PHB_ITEM pItem = hb_parptr( 1 );
if( pItem )
{
PHB_PP_STATE pState = ( PHB_PP_STATE ) hb_itemGetPtr( pItem );
if( pState )
hb_pp_free( pState );
}
else if( s_pp_state )
{
hb_pp_free( s_pp_state );
s_pp_state = NULL;
}
if( hb_pcount() == 0 )
hb_pp_stateFree( s_pp_state );
else
hb_pp_stateFree( ( PHB_PP_STATE ) hb_parptr( 1 ) );
}
/*
* add new (or replace previous) include paths.
* __PP_PATH( <pPP>, <cPath> [, <lClearPrev>] )
*/
HB_FUNC( __PP_PATH )
{
PHB_PP_STATE pState;
@@ -154,7 +180,27 @@ HB_FUNC( __PP_PATH )
}
}
HB_FUNC( __PPADDRULE )
/*
* reset the PP context (remove all rules added by user or preprocessed code)
* __PP_RESET( <pPP> )
*/
HB_FUNC( __PP_RESET )
{
PHB_PP_STATE pState;
int iParam;
pState = hb_pp_stateParam( &iParam );
if( pState )
{
hb_pp_reset( pState );
}
}
/*
* preprocess and execute new preprocessor directive
* __PPADDRULE( <pPP>, <cDirective> )
*/
HB_FUNC( __PP_ADDRULE )
{
PHB_PP_STATE pState;
int iParam;
@@ -176,10 +222,9 @@ HB_FUNC( __PPADDRULE )
if( szText && ulLen && szText[ 0 ] == '#' )
{
hb_pp_reset( pState );
hb_pp_parseLine( pState, szText, &ulLen );
/* probably for #included files parsing the old code was making
/* probably for parsing #included files the old code was making
sth like that */
do
{
@@ -195,6 +240,10 @@ HB_FUNC( __PPADDRULE )
hb_retl( FALSE );
}
/*
* preprocess given code and return result
* __PREPROCESS( <pPP>, <cCode> ) -> <cPreprocessedCode>
*/
HB_FUNC( __PREPROCESS )
{
PHB_PP_STATE pState;

View File

@@ -4273,7 +4273,7 @@ static BOOL hb_cdxTagKeyDel( LPCDXTAG pTag, LPCDXKEY pKey )
}
/*
* Go to the first visiable record in Tag
* Go to the first visible record in Tag
*/
static void hb_cdxTagGoTop( LPCDXTAG pTag )
{
@@ -4307,7 +4307,7 @@ static void hb_cdxTagGoTop( LPCDXTAG pTag )
}
/*
* Go to the last visiable record in Tag
* Go to the last visible record in Tag
*/
static void hb_cdxTagGoBottom( LPCDXTAG pTag )
{

514
harbour/tests/speedtst.prg Normal file
View File

@@ -0,0 +1,514 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* a small speed test program
*
* Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://www.harbour-project.org
*
*/
#define ARR_LEN 16
#define N_LOOPS 1000000
//#define NO_DBF_TEST
#define NO_KEYBOARD_TEST
#define NO_ASSOC_TEST
#define REAL_TIME
#ifdef __CLIP__
#define ASSOC_ARRAY map()
#undef REAL_TIME
#endif
#ifdef FlagShip
#undef REAL_TIME
#xtranslate seconds() => fs_seconds()
#endif
#ifdef __XHARBOUR__
#define ASSOC_ARRAY Hash()
#undef REAL_TIME
#endif
#ifdef __HARBOUR__
#undef REAL_TIME
#endif
#ifdef REAL_TIME
#xtranslate secondscpu([<x>]) => seconds()
#endif
#ifndef EOL
#define EOL chr(10)
#endif
#command ? => outstd(EOL)
#command ? <xx,...> => outstd(<xx>, EOL)
#ifdef NO_ASSOC_TEST
#undef ASSOC_ARRAY
#endif
function main()
#ifndef NO_DBF_TEST
field F_C, F_N, F_D
#endif
memvar M_C, M_N, M_D
local L_C, L_N, L_D
local i, j, t, c, c2, n, d, o, bc, tn, total, totalr, aa,;
a[ARR_LEN], a2[ARR_LEN], a3[ARR_LEN], aDb, cFi
#ifdef ASSOC_ARRAY
local aAssoc := ASSOC_ARRAY
#endif
private M_C := dtos(date()),;
M_N := 112345.67,;
M_D := date()
#ifndef __CLIP__
//#ifdef __XHARBOUR__
// setcancel(.f.)
// altd(0)
//#endif
#endif
#ifdef __CLIP__
SET MACRO_IN_STRING OFF
//CLEAR SCREEN
#endif
#ifdef FlagShip
FS_SET( "zerobyte", .t. )
FS_SET( "devel", .f. )
// FS_SET( "break", 0 )
// FS_SET( "debug", 0 )
#endif
for i:=1 to len(a)
a[i]:=i
a2[i]:=dtos(date())+chr(i%64+32)+chr(i%64+64)+str(i,10)
a3[i]:=stuff(dtos(date()),7,0,".")
next
? ""
? VERSION()+", "+OS()
? "ARR_LEN =", ARR_LEN
? "N_LOOPS =", N_LOOPS
t:=secondscpu()
for i:=1 to N_LOOPS
next
tn:=secondscpu()-t
? "empty loops overhead =", tn
#ifdef REAL_TIME
? "real time -> seconds()"
#else
? "CPU usage -> secondsCPU()"
#endif
? ""
aDb:={ {"F_C", "C", 10, 0},;
{"F_N", "N", 10, 2},;
{"F_D", "D", 8, 0} }
cFi:="tst_tmp.dbf"
if file(cFi)
ferase(cFi)
endif
#ifndef NO_DBF_TEST
dbcreate(cFi, aDb)
select(1)
use &cFi shared
dbappend()
replace F_C with dtos(date())
replace F_N with 112345.67
replace F_D with date()
dbcommit()
dbunlock()
cFi:="tst_tmp2.dbf"
if file(cFi)
ferase(cFi)
endif
dbcreate(cFi, aDb)
select(2)
use &cFi exclusive
dbappend()
replace F_C with dtos(date())
replace F_N with 112345.67
replace F_D with date()
dbcommit()
dbunlock()
#endif
L_C := dtos(date())
L_N := 112345.67
L_D := date()
total:=secondscpu()
totalr:=seconds()
t:=secondscpu()
for i:=1 to N_LOOPS
c:=L_C
next
dsp_time( "c:=L_C -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
n:=L_N
next
dsp_time( "n:=L_N -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
d:=L_D
next
dsp_time( "d:=L_D -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
c:=M_C
next
dsp_time( "c:=M_C -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
n:=M_N
next
dsp_time( "n:=M_N -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
d:=M_D
next
dsp_time( "d:=M_D -> ", t, tn)
#ifndef NO_DBF_TEST
select(1)
t:=secondscpu()
for i:=1 to N_LOOPS
c:=F_C
next
dsp_time( "(sh) c:=F_C -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
n:=F_N
next
dsp_time( "(sh) n:=F_N -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
d:=F_D
next
dsp_time( "(sh) d:=F_D -> ", t, tn)
select(2)
t:=secondscpu()
for i:=1 to N_LOOPS
c:=F_C
next
dsp_time( "(ex) c:=F_C -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
n:=F_N
next
dsp_time( "(ex) n:=F_N -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
d:=F_D
next
dsp_time( "(ex) d:=F_D -> ", t, tn)
#endif
o:=errorNew()
t:=secondscpu()
for i:=1 to N_LOOPS
n:=o:GenCode
next
dsp_time( "n:=o:GenCode -> ", t, tn)
#ifdef ASSOC_ARRAY
t:=secondscpu()
for i:=1 to N_LOOPS
aAssoc[a2[i%ARR_LEN+1]+ltrim(str(i%100))]:=i
next
dsp_time( "aAssoc[a2[i%ARR_LEN+1]+ltrim(str(i%100)]:=i -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
c:=aAssoc[a2[i%ARR_LEN+1]+ltrim(str(i%100))]
next
dsp_time( "c:=aAssoc[a2[i%ARR_LEN+1]+ltrim(str(i%100)] -> ", t, tn)
#endif
#ifndef NO_KEYBOARD_TEST
t:=secondscpu()
for i:=1 to N_LOOPS
inkey()
next
dsp_time( "inkey() -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
nextkey()
next
dsp_time( "nextkey() -> ", t, tn)
#endif
t:=secondscpu()
for i:=1 to N_LOOPS
round(i/1000,2)
next
dsp_time( "round(i/1000,2) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
str(i/1000)
next
dsp_time( "str(i/1000) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
val(a3[i%ARR_LEN+1])
next
dsp_time( "val(a3[i%ARR_LEN+1]) -> ", t, tn)
t:=secondscpu()
j:=date()
for i:=1 to N_LOOPS
dtos(j+i%10000-5000)
next
dsp_time( "dtos(j+i%10000-5000) -> ", t, tn)
bc:={||i%ARR_LEN}
t:=secondscpu()
for i:=1 to N_LOOPS
eval(bc)
next
dsp_time( "eval({||i%ARR_LEN}) -> ", t, tn)
bc:={|x|x%ARR_LEN}
t:=secondscpu()
for i:=1 to N_LOOPS
eval(bc,i)
next
dsp_time( "eval({|x|x%ARR_LEN}) -> ", t, tn)
bc:={|x|f1(x)}
t:=secondscpu()
for i:=1 to N_LOOPS
eval(bc,i)
next
dsp_time( "eval({|x|f1(x)}) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
n:=&("f1("+str(i)+")")
next
dsp_time( "&('f1('+str(i)+')') -> ", t, tn)
bc:=&("{|x|f1(x)}")
t:=secondscpu()
for i:=1 to N_LOOPS
eval(bc,i)
next
dsp_time( "eval([&('{|x|f1(x)}')]) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
j:=valtype(a)+valtype(i)
next
dsp_time( "j := valtype(a)+valtype(i) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
j := str(i%100,2) $ a2[i%ARR_LEN+1]
next
dsp_time( "j := str(i%100,2) $ a2[i%ARR_LEN+1] -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
j := val(a2[i%ARR_LEN+1])
next
dsp_time( "j := val(a2[i%ARR_LEN+1]) -> ", t, tn)
c:=dtos(date())
t:=secondscpu()
for i:=1 to N_LOOPS
j := a2[i%ARR_LEN+1] == c
next
dsp_time( "j := a2[i%ARR_LEN+1] == s -> ", t, tn)
c:=dtos(date())
t:=secondscpu()
for i:=1 to N_LOOPS
j := a2[i%ARR_LEN+1] = c
next
dsp_time( "j := a2[i%ARR_LEN+1] = s -> ", t, tn)
c:=dtos(date())
t:=secondscpu()
for i:=1 to N_LOOPS
j := a2[i%ARR_LEN+1] >= c
next
dsp_time( "j := a2[i%ARR_LEN+1] >= s -> ", t, tn)
c:=dtos(date())
t:=secondscpu()
for i:=1 to N_LOOPS
j := a2[i%ARR_LEN+1] < c
next
dsp_time( "j := a2[i%ARR_LEN+1] < s -> ", t, tn)
aa:={}
t:=secondscpu()
for i:=1 to N_LOOPS
if i%1000 == 0
aa:={}
endif
aadd(aa,{i,j,c,a,a2,t,bc})
next
dsp_time( "aadd(aa,{i,j,s,a,a2,t,bc}) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
f0()
next
dsp_time( "f0() -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
f1(i)
next
dsp_time( "f1(i) -> ", t, tn)
c:=dtos(date())
t:=secondscpu()
for i:=1 to N_LOOPS
f2(c)
next
dsp_time( "f2(c["+ltrim(str(len(c)))+"]) -> ", t, tn)
c:=replicate(c,5000)
t:=secondscpu()
for i:=1 to N_LOOPS
f2(c)
next
dsp_time( "f2(c["+ltrim(str(len(c)))+"]) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
f2(@c)
next
dsp_time( "f2(@c["+ltrim(str(len(c)))+"]) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
f2(c)
c2:=c
next
dsp_time( "f2(c["+ltrim(str(len(c)))+"]); c2:=c -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
f2(@c)
c2:=c
next
dsp_time( "f2(@c["+ltrim(str(len(c)))+"]); c2:=c -> ", t, tn)
c:=dtos(date())
t:=secondscpu()
for i:=1 to N_LOOPS
f3(a,a2,c,i,j,t,bc)
next
dsp_time( "f3(a,a2,c,i,j,t,bc) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
f2(a2)
next
dsp_time( "f2(a2) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
c:=f4()
next
dsp_time( "s:=f4() -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
ascan(a,i%ARR_LEN)
next
dsp_time( "ascan(a,i%ARR_LEN) -> ", t, tn)
c:=dtos(date())
t:=secondscpu()
for i:=1 to N_LOOPS
ascan(a2,c+chr(i%64+64))
next
dsp_time( "ascan(a2,c+chr(i%64+64)) -> ", t, tn)
t:=secondscpu()
for i:=1 to N_LOOPS
ascan(a,{|x|x==i%ARR_LEN})
next
dsp_time( "ascan(a,{|x|x==i%ARR_LEN}) -> ", t, tn)
? replicate("=",60)
dsp_time( "total application time:", total, 0)
? padr( "total real time:",50)+str(seconds()-totalr,8,2)
?
return nil
function dsp_time(s,t,tn)
? padr(s,50)+str(max(secondscpu()-t-tn,0),8,2)
return nil
function f0(x)
return nil
function f1(x)
return x+1
function f2(s)
return nil
function f3(a,b,c,d,e,f,g,h,i)
return nil
function f4()
return space(50000)
#ifdef FlagShip
function fs_seconds()
LOCAL_DOUBLE nret := 0
#Cinline
{
#include <sys/time.h>
struct timeval tv;
struct timezone tz;
if( !gettimeofday(&tv, NULL) )
nret = (double) tv.tv_sec + (double) (tv.tv_usec) / 1000000;
/*
nret = (double) (tv.tv_sec - tz.tz_minuteswest * 60 ) % 86400 +
(double) tv.tv_usec / 1000000;
*/
}
#endCinline
return ( nret )
#ifndef FlagShip5
FUNCTION cursesinit()
CALL fgsIoctl2
#Cinline
{
#include <fcntl.h>
int arg;
if ((arg = fcntl(0, F_GETFL, 0)) != -1)
fcntl(0, F_SETFL, arg | O_NONBLOCK);
}
#endCinline
return nil
#endif
#endif