Discussion:
Bug in PValue() function?
(too old to reply)
Enrico Maria Giordano
2024-03-23 10:05:46 UTC
Permalink
This is a sample (kindly provided by Rao). Ron can you look at it?


function Main()

local a := 20
local b := 0

Add500( a, @b )
? Version(), b // 520 Harbour
// 0 xHarbour

Inkey( 0 )

return nil

function add500(...)

PValue( 2, PValue( 1 ) + 500 )

return nil


// This is from pvalue.c


#pragma BEGINDUMP

#include "hbvmopt.h"
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbstack.h"

HB_FUNC( PVALUE )
{
USHORT uiParam = ( USHORT ) hb_parni( 1 ), uiParams;
PHB_ITEM * pBase = HB_VM_STACK.pItems + ( hb_stackBaseItem()
)->item.asSymbol.pCargo->stackbase; /* Skip function + self */

uiParams = ( *pBase )->item.asSymbol.pCargo->arguments;

if( uiParam && uiParam <= uiParams ) /* Valid number */
{
USHORT uiOffset;
PHB_ITEM pItem;

if( ( *pBase )->item.asSymbol.pCargo->params == HB_VAR_PARAM_FLAG )
uiOffset = ( *pBase )->item.asSymbol.pCargo->locals;
else
uiOffset = 0;

pItem = *( pBase + 1 + uiParam + uiOffset );

hb_itemReturn( pItem );

if( hb_pcount() > 1 && HB_IS_BYREF( pItem ) )
hb_itemCopy( pItem, hb_param( 2, HB_IT_ANY ) );
}
else
hb_ret(); /* return NIL */
}

#pragma ENDDUMP



// This is from Harbour pvalue.c


/*
#include "hbvmint.h"
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbstack.h"

HB_FUNC( HB_PVALUE )
{
HB_ISIZ nOffset =
hb_stackBaseItem()->item.asSymbol.stackstate->nBaseItem;
HB_USHORT uiParam = ( HB_USHORT ) hb_parni( 1 );

if( uiParam && uiParam <= hb_stackItem( nOffset
)->item.asSymbol.paramcnt )
{
PHB_ITEM pItem = hb_stackItem( nOffset + 1 + uiParam );
if( hb_pcount() > 1 )
hb_itemCopyToRef( pItem, hb_param( 2, HB_IT_ANY ) );
hb_itemReturn( HB_IS_BYREF( pItem ) ? hb_itemUnRef( pItem ) :
pItem );
}
}
*/
--
Enrico Maria Giordano

http://www.emagsoftware.it
http://www.emagsoftware.it/emgmusic
http://www.emagsoftware.it/spectrum
http://www.emagsoftware.it/tbosg
Reynaldo Henrique
2024-03-24 02:09:54 UTC
Permalink
This error appears:

Turbo Incremental Link 6.97 Copyright (c) 1997-2022 Embarcadero
Technologies, Inc.
Error: Unresolved external '_hb_stackST' referenced from
C:\XHARBOUR\TESTS\OBJ\PVALUE.OBJ
Error: Unable to perform link


Thanks,


Reynaldo Henrique
--
O software antivírus AVG realizou uma checagem de vírus neste e-mail.
www.avg.com
Enrico Maria Giordano
2024-03-24 08:40:14 UTC
Permalink
Post by Reynaldo Henrique
Turbo Incremental Link 6.97 Copyright (c) 1997-2022 Embarcadero
Technologies, Inc.
Error: Unresolved external '_hb_stackST' referenced from
C:\XHARBOUR\TESTS\OBJ\PVALUE.OBJ
Error: Unable to perform link
I don't get any errors. Please show the batch you are using to compile.
--
Enrico Maria Giordano

http://www.emagsoftware.it
http://www.emagsoftware.it/emgmusic
http://www.emagsoftware.it/spectrum
http://www.emagsoftware.it/tbosg
Reynaldo Henrique
2024-03-24 23:30:20 UTC
Permalink
Post by Enrico Maria Giordano
Post by Reynaldo Henrique
Turbo Incremental Link 6.97 Copyright (c) 1997-2022 Embarcadero
Technologies, Inc.
Error: Unresolved external '_hb_stackST' referenced from
C:\XHARBOUR\TESTS\OBJ\PVALUE.OBJ
Error: Unable to perform link
I don't get any errors. Please show the batch you are using to compile.
I used bld_b32.bat from xharbour.

Thnaks,

Reynaldo Henrique
--
O software antivírus AVG realizou uma checagem de vírus neste e-mail.
www.avg.com
Enrico Maria Giordano
2024-03-25 08:48:48 UTC
Permalink
Post by Reynaldo Henrique
Post by Enrico Maria Giordano
I don't get any errors. Please show the batch you are using to compile.
I used bld_b32.bat from xharbour.
What is bld_b32.bat? I can't find it in the xHarbour repository. In
order to help you, I need a little PRG and the compile batch to
replicate the problem here.
--
Enrico Maria Giordano

http://www.emagsoftware.it
http://www.emagsoftware.it/emgmusic
http://www.emagsoftware.it/spectrum
http://www.emagsoftware.it/tbosg
Enrico Maria Giordano
2024-03-25 09:01:55 UTC
Permalink
Post by Enrico Maria Giordano
Post by Reynaldo Henrique
I used bld_b32.bat from xharbour.
What is bld_b32.bat? I can't find it in the xHarbour repository. In
order to help you, I need a little PRG and the compile batch to
replicate the problem here.
Found! Do you mean this?

bld_bc.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

I don't think it is working. What do you want to do exactly?
--
Enrico Maria Giordano

http://www.emagsoftware.it
http://www.emagsoftware.it/emgmusic
http://www.emagsoftware.it/spectrum
http://www.emagsoftware.it/tbosg
Enrico Maria Giordano
2024-03-25 09:03:32 UTC
Permalink
Post by Enrico Maria Giordano
Found! Do you mean this?
bld_bc.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
I don't think it is working. What do you want to do exactly?
If you just want to compile and run a single PRG then I can show you a
simple batch to do that. Let me know.
--
Enrico Maria Giordano

http://www.emagsoftware.it
http://www.emagsoftware.it/emgmusic
http://www.emagsoftware.it/spectrum
http://www.emagsoftware.it/tbosg
Loading...