Forum > General

typed array - TVarRec usage

(1/1)

akooos:
Helo

I have the following code :


--- Code: ---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) );     
--- End code ---
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:
You have to include TVarRec.VType as well. :(

And for your next question: @AC_SPACETIME is not a valid integer type expression!

akooos:

--- Quote from: eny 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!

--- End quote ---
im sry but where to include the TVarRec.Vtype ?
please write an example.

Thank you
Akooos

eny:

--- Quote from: akooos on September 10, 2010, 05:12:07 pm ---im sry but where to include the TVarRec.Vtype ?
--- End quote ---
:o

How did you find TVarRec in the first place?
Just look at it again and you'll see the VType field in it.

akooos:
Well , this is the first time using TVarRec...
It worked(i can compile it), in this form:

--- Code: ---    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;) );   
--- End code ---

Thank you.
Vermelho

Navigation

[0] Message Index

Go to full version