Error at STRUCTURE/ENDSTRUCTURE!

Post Reply
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Error at STRUCTURE/ENDSTRUCTURE!

Post by JC »

Dear Antonio and friends,

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

Code: Select all

   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:

Code: Select all

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
toninhofwi
Posts: 161
Joined: Tue Oct 18, 2005 10:01 am

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by toninhofwi »

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.
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by JC »

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
toninhofwi
Posts: 161
Joined: Tue Oct 18, 2005 10:01 am

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by toninhofwi »

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.
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by JC »

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
User avatar
Euclides
Posts: 144
Joined: Wed Mar 28, 2007 1:19 pm

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by Euclides »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by JC »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by JC »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by JC »

Enrico,

From the HBStruct.ch into xharbour\include\

Code: Select all

#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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Re: Error at STRUCTURE/ENDSTRUCTURE!

Post by JC »

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
Post Reply