Recent

Author Topic: typed array - TVarRec usage  (Read 6015 times)

akooos

  • Newbie
  • Posts: 3
typed array - TVarRec usage
« on: September 10, 2010, 03:19:06 pm »
Helo

I have the following code :

Code: [Select]
type
  TAlapertektipusok = ( tbasespacetime , tspeed , tmora , tofn , tac_spacetime , tad_spacetime , trmghszorzo , thmghszorzo , tmshszorzo );
const

     BASESPACE_TIME = 40;
     SPEED : single = 1;
     MORA :integer = 200;
     O_FN : string = '/tmp/ki.pho';
     AC_SPACETIME : integer = 4;
     AD_SPACETIME : integer = 6;
     RMGH_SZORZO : extended = 0.98;
     HMGH_SZORZO : extended = 1.5;
     MSH_SZORZO : extended = 0.98; 

 AlapErtErtekek : array[TAlapertektipusok] of TVarRec = (
                                                          ( VInteger :40),
                                                         (VExtended:1),
                                                         (VInteger: 200),
                                                         (VString:@O_FN),
                                                         (VInteger:@AC_SPACETIME),
                                                         (VInteger:@AD_SPACETIME),
                                                         (VExtended:@RMGH_SZORZO),
                                                         (VExtended:@HMGH_SZORZO),
                                                         (VExtended:@MSH_SZORZO) );     
and i have this error:
huntxt2pho.pas(13,17) Error: Some fields coming before "VInteger" weren't initialized
It stops  at the "VInteger:40" line.. and i dont know what to do... >:(

I put the constans in array because it's easier to write out(to the user) with a loop, than one by one.

Thank you

Akoos
(sry for my english)

eny

  • Hero Member
  • *****
  • Posts: 1646
Re: typed array - TVarRec usage
« Reply #1 on: September 10, 2010, 04:49:35 pm »
You have to include TVarRec.VType as well. :(

And for your next question: @AC_SPACETIME is not a valid integer type expression!
« Last Edit: September 10, 2010, 04:53:59 pm by eny »
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

akooos

  • Newbie
  • Posts: 3
Re: typed array - TVarRec usage
« Reply #2 on: September 10, 2010, 05:12:07 pm »
You have to include TVarRec.VType as well. :(

And for your next question: @AC_SPACETIME is not a valid integer type expression!
im sry but where to include the TVarRec.Vtype ?
please write an example.

Thank you
Akooos

eny

  • Hero Member
  • *****
  • Posts: 1646
Re: typed array - TVarRec usage
« Reply #3 on: September 10, 2010, 05:50:29 pm »
im sry but where to include the TVarRec.Vtype ?
:o

How did you find TVarRec in the first place?
Just look at it again and you'll see the VType field in it.
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

akooos

  • Newbie
  • Posts: 3
Re: typed array - TVarRec usage
« Reply #4 on: September 10, 2010, 06:07:26 pm »
Well , this is the first time using TVarRec...
It worked(i can compile it), in this form:
Code: [Select]
    BASESPACE_TIME = 40;
     SPEED : single = 1;
     MORA  = 200;
     O_FN : string = '/tmp/ki.pho';
     AC_SPACETIME  = 4;
     AD_SPACETIME  = 6;
     RMGH_SZORZO : extended = 0.98;
     HMGH_SZORZO : extended = 1.5;
     MSH_SZORZO : extended = 0.98;

 AlapErtErtekek : array[TAlapertektipusok] of TVarRec = (
                                                         (VType:(vtINteger);  VInteger: BASESPACE_TIME;  ) ,
                                                         (VType:(vtExtended); VExtended: @SPEED; ),
                                                         (VType:(vtINteger);VInteger: MORA;),
                                                         (VType:(vtString);VString: @O_FN;),
                                                         (VType:(vtInteger);VInteger: AC_SPACETIME;),
                                                         (VType:(vtInteger);VInteger: AD_SPACETIME;),
                                                         (VType:(vtExtended);VExtended: @RMGH_SZORZO;),
                                                         (VType:(vtExtended);VExtended: @HMGH_SZORZO;),
                                                         (VType:(vtExtended);VExtended: @MSH_SZORZO;) );   

Thank you.
Vermelho

 

TinyPortal © 2005-2018