2010-09-23 00:07 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* tests/inline_c.prg
! Fixed. (deleted old code not working since 10 years)
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2010-09-23 00:07 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* tests/inline_c.prg
|
||||
! Fixed. (deleted old code not working since 10 years)
|
||||
|
||||
2010-09-22 18:35 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* package/winuni/RELNOTES
|
||||
* INSTALL
|
||||
|
||||
@@ -1,96 +1,25 @@
|
||||
//NOTEST
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
// This file use the old HB_INLINE syntax which is no longer supported.
|
||||
// It was replace with more intuitve syntax, see hbinline.prg
|
||||
// [ckedem]
|
||||
PROCEDURE Main()
|
||||
|
||||
PROCEDURE MAIN( cLine, cDelim )
|
||||
|
||||
LOCAL a, i
|
||||
|
||||
IF EMPTY( cLine )
|
||||
cLine := "This is a test"
|
||||
END IF
|
||||
|
||||
a := aTokens( cLine, cDelim )
|
||||
FOR i := 1 TO LEN( a )
|
||||
? '"' + a[ i ] + '"'
|
||||
NEXT i
|
||||
|
||||
QOut( HB_INLINE() )
|
||||
{ hb_retc( "\na C String, including { and \" { \n" ); }
|
||||
|
||||
QOut( C_Func() )
|
||||
QOut( C_FUNC() )
|
||||
|
||||
QOut( EndDumpTest() )
|
||||
|
||||
RETURN
|
||||
|
||||
FUNCTION aTokens( cLine, cDelimiter )
|
||||
|
||||
LOCAL aTokens := {}
|
||||
|
||||
#ifdef __HARBOUR__
|
||||
|
||||
IF cDelimiter == NIL
|
||||
cDelimiter := ' '
|
||||
ENDIF
|
||||
|
||||
HB_INLINE( aTokens, cLine, Asc( cDelimiter ) )
|
||||
{ // Note including {
|
||||
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
|
||||
char cDelimiter = (char) hb_parni(3), * szLine = hb_parc( 2 );
|
||||
size_t i, len = hb_parclen( 2 ), iOffset = 0, iIndex = 1;
|
||||
|
||||
/* Comment including { */
|
||||
for( i = 0; i < len; i++ )
|
||||
{
|
||||
if( szLine[i] == cDelimiter )
|
||||
{
|
||||
hb_arraySize( pArray, iIndex );
|
||||
hb_storclen( szLine + iOffset, i - iOffset, 1, iIndex );
|
||||
iOffset = i + 1;
|
||||
iIndex++;
|
||||
}
|
||||
}
|
||||
if( iOffset < len - 1 )
|
||||
{
|
||||
hb_arraySize( pArray, iIndex );
|
||||
hb_storclen( szLine + iOffset, len - iOffset, 1, iIndex );
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
LOCAL nLen := Len( cLine ), i, nOffset := 1
|
||||
|
||||
IF cDelimiter == NIL
|
||||
cDelimiter := ' '
|
||||
ENDIF
|
||||
|
||||
FOR i := 1 to nLen
|
||||
IF SubStr( cLine, i, 1 ) == cDelimiter
|
||||
aAdd( aTokens, SubStr( cLine, nOffset, i - nOffset ) )
|
||||
nOffset := i + 1
|
||||
ENDIF
|
||||
NEXT
|
||||
IF nOffset < nLen - 1
|
||||
aAdd( aTokens, SubStr( cLine, nOffset ) )
|
||||
ENDIF
|
||||
|
||||
#endif
|
||||
|
||||
RETURN aTokens
|
||||
RETURN
|
||||
|
||||
#pragma BEGINDUMP
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
HB_FUNC( C_FUNC )
|
||||
{
|
||||
hb_retc( "returned from C_FUN\n" );
|
||||
hb_retc( "returned from C_FUNC()\n" );
|
||||
}
|
||||
|
||||
#pragma ENDDUMP
|
||||
|
||||
Function EndDumpTest()
|
||||
RETURN "End Dump Test"
|
||||
FUNCTION EndDumpTest()
|
||||
RETURN "End Dump Test"
|
||||
|
||||
Reference in New Issue
Block a user