ERROR compiled with FW , NOT without FW

ERROR compiled with FW , NOT without FW

Postby demont frank » Tue Jul 01, 2008 5:51 pm

Antonio,

Trying to work out the code from thread 'checking changes in folder' (28 juni , using 'HB_DBG_VMSTKLLIST()' , i have no error when compiled without FW , probably a GPF with FW


Code: Select all  Expand view  RUN
# ifdef FIVEWIN
  #include "FiveWin.ch"
# endif
#include "common.ch"

function Main()

Test( "one", "two", "three" )

return nil
***************************************************************************************************************
function Test( x, y, z )
************************   

local local1 := "first", local2 := {"SecondFirst","secondSecond"}
local aBegin
local aEnd
// your code...
aBegin := aClone(ReadLocals(HB_DBG_VMSTKLLIST(),4,5))
local2[2] := "changed!" // we change a local value
aEnd := Readlocals(HB_DBG_VMSTKLLIST(),4,5)

CompLocals(aBegin , aEnd)
return nil

****************************************************************************************************************
FUNC ReadLocals(...)
********************
LOCAL aParam := HB_aParams()
LOCAL nFrom , nTo
LOCAL aLocals// := HB_DBG_VMSTKLLIST()
LOCAL Arr[0] , el
aLocals := aParam[1]
aDel(aParam,1,.T.)
aDel(aLocals,1,.T.)
aDel(aLocals,1,.T.)
IF LEN(aParam) == 0
  Arr := aLocals
ELSEIF LEN(aParam) <= 2
  nTo := nFrom := aParam[1]
  IF LEN(aParam) = 2
    nTO   := aParam[2]
  END
  Arr := {}
  AEVAL(aLocals , {|el| AADD(Arr,el) } , nFrom , Nto - nFrom + 1)
ELSE
  AEVAL(aParam , {|el| AADD(Arr , aLocals[el]) } )      
ENDIF
RETURN Arr
*************************************************************
FUNC CompLocals(aBegin , aEnd)
*********************************
LOCAL el , elem , lOk := .T. , i
FOR i := 1 TO LEN(aBegin)
  el   := aBegin[i]
  elem := aEnd[i]
  IF VALTYPE(el) <> VALTYPE(elem)
    lOk := .F.
    EXIT
  END
  IF IsArray(el) .AND. IsArray(elem)
    IF LEN(el) <> LEN(elem)
      lOk := .F.
      EXIT
     END
     IF ! CompLocals(el , elem )
       lOk := .F.
       EXIT
    END
ELSE
    IF el <> elem
      lOk := .F.
      EXIT
    END      
  END
NEXT
IF ! lOk
  ? i , aBegin[i] , aEnd[i] , lOk
  # ifndef FIVEWIN
  WAIT
  # endif
END
RETURN lOk
Last edited by demont frank on Wed Jul 02, 2008 6:08 am, edited 2 times in total.
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby Antonio Linares » Tue Jul 01, 2008 7:35 pm

Frank,

With Harbour we get this error with your code and FWH:
Code: Select all  Expand view  RUN
   Error description: Error BASE/1003  Variable does not exist: ALOCAL

Stack Calls
===========
   Called from: F:\tmp43\test.prg => (b)READLOCALS(48)
   Called from:  => AEVAL(0)
   Called from: F:\tmp43\test.prg => READLOCALS(48)
   Called from: F:\tmp43\test.prg => TEST(20)
   Called from: F:\tmp43\test.prg => MAIN(9)

Quite curiously, with xHarbour there is no error :-)

but it should be there because aLocal is not defined
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Jul 01, 2008 7:36 pm

Also you have many ambiguous references in your code that you should fix (undeclared variables).

But no GPFs here :-)
Last edited by Antonio Linares on Tue Jul 01, 2008 7:50 pm, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Tue Jul 01, 2008 7:46 pm

Antonio Linares wrote:Frank,

With Harbour we get this error with your code and FWH:
Code: Select all  Expand view  RUN
   Error description: Error BASE/1003  Variable does not exist: ALOCAL

Stack Calls
===========
   Called from: F:\tmp43\test.prg => (b)READLOCALS(48)
   Called from:  => AEVAL(0)
   Called from: F:\tmp43\test.prg => READLOCALS(48)
   Called from: F:\tmp43\test.prg => TEST(20)
   Called from: F:\tmp43\test.prg => MAIN(9)

Quite curiously, with xHarbour there is no error :-)

but it should be there because aLocal is not defined


Which compiler switches are you using? I get exactly the same warnings with both Harbour or xHarbour:

Harbour 1.0.0RC1 Intl. (Rev. 8863)
Copyright (c) 1999-2008, http://www.harbour-project.org/
FRANK.prg(47) Warning W0001 Ambiguous reference: 'ALOCAL'
FRANK.prg(54) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(55) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(56) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(66) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(67) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(67) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(71) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(71) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(78) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(78) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(80) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(80) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(80) Warning W0001 Ambiguous reference: 'I'

No code generated.


xHarbour Compiler build 1.1.0 (SimpLex) (Rev. 6159)
Copyright 1999-2008, http://www.xharbour.org http://www.harbour-project.org/
FRANK.prg(47) Warning W0002 Ambiguous reference, assuming memvar: 'ALOCAL'
FRANK.prg(54) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(54) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(55) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(56) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(66) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(66) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(67) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(67) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(71) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(71) Warning W0001 Ambiguous reference: 'J'
FRANK.prg(78) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(78) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(80) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(80) Warning W0001 Ambiguous reference: 'I'
FRANK.prg(80) Warning W0001 Ambiguous reference: 'I'

No code generated.


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Tue Jul 01, 2008 8:24 pm

Enrico,

The ambiguous references are the same in both compilers.

The difference is that Harbour generates an error in runtime, thats seems ok, and xHarbour ignores it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Tue Jul 01, 2008 8:41 pm

Harbour doesn't generate any error here. At least using the following compiler switches:

SET HARBOURCMD=/a /es2 /gc0 /m /n /q /w


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Tue Jul 01, 2008 8:55 pm

Enrico,

See this line:

AEVAL(aParam , {|el| AADD(Arr , aLocal[el]) } )

aLocal is not defined anywhere, and more over, is used as an array, so it should generate an error. Don't know if those compiler switches may make a difference, but I can't find a aLocal variable declaration anywhere in the code :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Tue Jul 01, 2008 9:16 pm

Code: Select all  Expand view  RUN
AEVAL(aParam , {|el| AADD(Arr , aLocal[el]) } )


Judging from the rest of the code, it appears that aLocal is a typo--it should be aLocals (with an s). aLocals is defined and used.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby demont frank » Wed Jul 02, 2008 6:13 am

Sorry guys , i was mixting old xhb with recent fw code

I have changed the example , now it works , also when arrays are used .

I am wondering why i have to use

aBegin := aClone(ReadLocals(..))

If not , aBegin is changed with the next line , and aBegin is the same as aEnd

Frank
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby Antonio Linares » Wed Jul 02, 2008 6:32 am

Frank,

>
I am wondering why i have to use

aBegin := aClone(ReadLocals(..))
>

Probably because it is pointing to the original array, so when you modify it, then you are modifying the original. AClone() creates a copy of it, but kept on a different variable.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Wed Jul 02, 2008 9:25 am

Antonio Linares wrote:Enrico,

See this line:

AEVAL(aParam , {|el| AADD(Arr , aLocal[el]) } )

aLocal is not defined anywhere, and more over, is used as an array, so it should generate an error. Don't know if those compiler switches may make a difference, but I can't find a aLocal variable declaration anywhere in the code :-)


Yes, and this has been considered a warning from Clipper on:

Code: Select all  Expand view  RUN
FUNCTION MAIN()

    ? n

    RETURN NIL


Harbour 1.0.0RC2 Intl. (Rev. 8874)
Copyright (c) 1999-2008, http://www.harbour-project.org/
NODECL.prg(3) Warning W0001 Ambiguous reference: 'N'

No code generated.


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests