FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Error at STRUCTURE/ENDSTRUCTURE!
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Error at STRUCTURE/ENDSTRUCTURE!
Posted: Fri Jan 16, 2009 11:02 PM
Dear Antonio and friends,

I have tried to create a structure with STRUCTURE/ENDSTRUCTURE but i get an error

   STRUCT oQueryAlias

          //type:STRING,NUMERIC,LOGICAL,DATE,DATETIME,CODEBLOCK,ARRAY,OBJECT,HASH>

          MEMBER cQueryAlias   AS STRING INIT ""
          MEMBER cColunaFiltro AS STRING INIT ""
          MEMBER aFieldSql     AS ARRAY  INIT {}
          MEMBER aWhereSql     AS ARRAY  INIT {}
          MEMBER aGroupSql     AS ARRAY  INIT {}
          MEMBER aOrderSql     AS ARRAY  INIT {}
          MEMBER nLimitSql     AS LONG   INIT 0
          MEMBER nOffSetSql    AS LONG   INIT 0

   ENDSTRUCT


The error:
Application
===========
   Path and name: C:\test\app.EXE (32 bits)
   Size: 1,961,984 bytes
   Time from start: 0 hours 0 mins 6 secs 
   Error occurred at: 16/01/2009, 19:31:26
   Error description: Error BASE/1106  Argument error: REPLICATE
   Args:
     [   1] = C    
     [   2] = U   

Stack Calls
===========
   Called from:  => REPLICATE(0)
   Called from: .\source\classes\TStruct.PRG => TSTRUCT:ADDMEMBER(0)
   Called from: C:\extras\xbrowse.prg => TXBROWSE:SETOBJQUERY(6233)
   Called from: C:\extras\xbrowse.prg => TXBROWSE:NEW(610)
   Called from: C:\modulos\Cadastros\Cadastro_Empresa.prg => SELECIONAEMPRESA(1411)
   Called from: C:\modulos\Cadastros\Cadastro_UsuariosSistema.prg => LOGINSISTEMA(632)
   Called from: C:\RepositorioLocal\main.prg => (b)MAIN(214)
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(0)
   Called from: C:\RepositorioLocal\main.prg => MAIN(214)
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 182
Joined: Tue Oct 18, 2005 10:01 AM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Fri Jan 16, 2009 11:18 PM

HI,

If you are talking about STRUCTURE/ENDSTRUCTURE created by me in [x]Harbour, you can do this:

---cut---

include "hbstruct.ch"

procedure main()

local oStru

STRUCTURE oStru

  MEMBER c1, c2, c3, c4 AS STRING

  MEMBER c5             AS STRING INIT "my structure"

  MEMBER n1, n2, n3, n4 AS NUMERIC

  MEMBER b1             AS CODEBLOCK INIT { || QOut( "Hello!!!" ) }

  MEMBER a1, a2, a3     AS ARRAY

  MEMBER d1             AS DATE INIT Date()

ENDSTRUCTURE

? ValToPrg( oStru:c1 )
? ValToPrg( oStru:c2 )
? ValToPrg( oStru:c3 )
? ValToPrg( oStru:c4 )
? ValToPrg( oStru:c5 )
? ValToPrg( oStru:b1 )
? ValToPrg( oStru:d1 )

Eval( oStru:b1 )
?

return
---cut---

regards,

Toninho.

Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Fri Jan 16, 2009 11:24 PM

Ok, but... and the error?

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 182
Joined: Tue Oct 18, 2005 10:01 AM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Sat Jan 17, 2009 11:56 AM
JC wrote:Ok, but... and the error?


Hi JC,

IMO you are mixing things, If you need FWH C language structures support commmands, you need "Struct.CH". Please see how use it in fwh\source\TTRAY.PRG

Regards,

Toninho.
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Sat Jan 17, 2009 10:41 PM

This file "Struct.ch" already included!
But, the error still again!

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 159
Joined: Wed Mar 28, 2007 01:19 PM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Sun Jan 18, 2009 01:25 PM

Julio,
if you do search in the compilation warnings, you will find:
Warning W0001 Ambiguous reference: 'ARRAY'
if you remove the ARRAY definitions from the STRUCT it will compile and run OK.
How to use ARRAY elements inside STRUC definition is an other problem :-)
Regards, Euclides

Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Mon Jan 19, 2009 01:18 PM

Please, see the error.log!
The error is other!
Not works!

With data type array, work fine! But, when I try to use a STRING MEMBER type... this get me a REPLICATE error! Into error.log, this is detailed!

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Mon Jan 19, 2009 02:31 PM

Please post a reduced and self-contained sample of the problem.

EMG

Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Mon Jan 19, 2009 02:59 PM
Enrico,

This is the link with the self-example!
http://rapidshare.com/files/186026366/Struct.zip.html
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Mon Jan 19, 2009 10:37 PM

From where did you get that ARRAY can be used as STRUCT type?

EMG

Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Mon Jan 19, 2009 11:43 PM
Enrico,

From the HBStruct.ch into xharbour\include\

#ifndef _H_STRUCTURE
#define _H_STRUCTURE

#xcommand STRUCTURE <hStruct> => <hStruct> := HSetCaseMatch( Hash(), .F. ) ; #undef _TSTRUCT_ ; #define _TSTRUCT_ <hStruct>
#xcommand STRUC <hStruct> => <hStruct> := HSetCaseMatch( Hash(), .F.) ; #undef _TSTRUCT_ ; #define _TSTRUCT_ <hStruct>

#xcommand MEMBER <cName, ...> ;
             [ AS <type:STRING,NUMERIC,LOGICAL,DATE,DATETIME,CODEBLOCK,ARRAY,OBJECT,HASH> ] ;
             [ INIT <uValue> ]          ;
          => ;
          HashAddMember( {<(cName)>}, <(type)>, <uValue>, _TSTRUCT_ )

#xcommand ENDSTRUCTURE => HSetAutoAdd( _TSTRUCT_, .f. )
#xcommand ENDSTRUC => HSetAutoAdd( _TSTRUCT_, .f. )

#translate DESTROY STRUCTURE <hStruct> => <hStruct> := nil

#endif
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Tue Jan 20, 2009 10:15 AM

Right. Sorry, I don't know why it doesn't work. :-(

EMG

Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: Error at STRUCTURE/ENDSTRUCTURE!
Posted: Tue Jan 20, 2009 11:50 AM
Enrico Maria Giordano wrote:Right. Sorry, I don't know why it doesn't work. :-)

EMG


Enrico,

Ok! Thanks for you attention! Maybe Antonio can help me with this :-)
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9

Continue the discussion