From 911ba94d9a7b006940fc8a872045c38f6d672c29 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 22 Sep 2010 22:07:21 +0000 Subject: [PATCH] 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) --- harbour/ChangeLog | 4 ++ harbour/tests/inline_c.prg | 97 +++++--------------------------------- 2 files changed, 17 insertions(+), 84 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index dbed1f5eb9..04cb53d2e4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -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 diff --git a/harbour/tests/inline_c.prg b/harbour/tests/inline_c.prg index c0cfee4cfa..431412916d 100644 --- a/harbour/tests/inline_c.prg +++ b/harbour/tests/inline_c.prg @@ -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"