Recent

Author Topic: Array Syntax issues  (Read 907 times)

J011Y_R063R

  • Newbie
  • Posts: 1
Array Syntax issues
« on: February 03, 2021, 06:30:16 pm »
It doesn't seem to matter what I do, I cannot get the syntax of this array to be accepted. I am pretty sure its missing the 'type' but this just kinda got dumped on me, and I am new to pascal. Any help would be greatly appreciated.


procedure REA7PinInkJetText;
var
    NumChars,NumGaps: integer;
    TextHgt,CharDist,GapDist,TextNoteAng,TextAng,TextAngDif,AccDist,AccDistBkwd: double;
    StartX,StartY,EndX,EndY: double;
    TextHeight,CharacterDistance,GapDistance,TextAngleDiff,AccelerationDistance,AccelerationDistanceBackwards: array[1..5] of double;
begin
    if (PostObj.DoingTime) then exit;

From here it goes on to define the variables described above.

The error is based off sytax and my plugin that points out these errors, keeps  referring me to the section between
'array' and '[1..5]'

This would usually mean there is an error in this specific location, but... to me this part looks fine, so I am wondering if the issue is not elsewhere in the section.

As this is an issue at work, I cannot share MUCH MORE than this, but will provide additional information as able.

MarkMLl

  • Hero Member
  • *****
  • Posts: 2693
Re: Array Syntax issues
« Reply #1 on: February 03, 2021, 06:46:23 pm »
It doesn't seem to matter what I do, I cannot get the syntax of this array to be accepted. I am pretty sure its missing the 'type' but this just kinda got dumped on me, and I am new to pascal. Any help would be greatly appreciated.
...
As this is an issue at work, I cannot share MUCH MORE than this, but will provide additional information as able.

Before anything else, we appreciate that this is a work issue but could you /please/ tag code properly using [ code] and [ /code] markers (without the space after the bracket). This isn't just cosmetic, it prevents the forum system from trying to- as an example- interpret [ i] as the start of italicised text.

Looking at your code, try something like

Code: Pascal  [Select][+][-]
  1. procedure REA7PinInkJetText;
  2.  
  3. type
  4.   TdistanceArray= array[1..5] of double;
  5.  
  6. var
  7.     NumChars,NumGaps: integer;
  8.     TextHgt,CharDist,GapDist,TextNoteAng,TextAng,TextAngDif,AccDist,AccDistBkwd: double;
  9.     StartX,StartY,EndX,EndY: double;
  10.     TextHeight,CharacterDistance,GapDistance,TextAngleDiff,AccelerationDistance,AccelerationDistanceBackwards: TdistanceArray
  11. begin
  12.     if (PostObj.DoingTime) then exit;
  13.  
[/quote]

Having said that it would help if you'd quoted the /exact/ error message.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

speter

  • Full Member
  • ***
  • Posts: 209
Re: Array Syntax issues
« Reply #2 on: February 04, 2021, 04:37:29 am »
For what its worth, I pasted your code into a procedure and got no errors (just lots of warnings about variables not being used). :)

Maybe you should rename your variables (in the unlikely event a var name is clashing with some global variable); for example prefix the variable names with "ij_" or similar.

cheers
S.
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

Laz 2.0.10 / FPC 3.2.0 / Windows 10 (64bit)

PascalDragon

  • Hero Member
  • *****
  • Posts: 3056
  • Compiler Developer
Re: Array Syntax issues
« Reply #3 on: February 04, 2021, 08:50:41 am »
As this is an issue at work, I cannot share MUCH MORE than this, but will provide additional information as able.

You can at least quote the exact error message as MarkMLI said.

speter

  • Full Member
  • ***
  • Posts: 209
Re: Array Syntax issues
« Reply #4 on: February 04, 2021, 11:19:13 am »
One thought I had; there is a TextHeight method in TCanvas...
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

Laz 2.0.10 / FPC 3.2.0 / Windows 10 (64bit)

 

TinyPortal © 2005-2018