Page 1 of 1

Accessing the value of Array[x] Of String[x] STILL BROKEN

Posted: 11 Dec 2008 01:07
by pykedgew
Hi

With reference to my old thread http://www.mikroe.com/forum/viewtopic.php?t=12315
This program is still not working & had not been responded since Nov 2007.
So I am putting it up here again, to see if there is any solution.
Or has this been an oversight in the redevelopment or a bug.

This short program will not compile

Code: Select all

program DAY;
{  MCU         : ATmega16
   Oscillator  : 10 MHz, External
   SW          : mikroPascal PRO for AVR  }

var
  DOW   : String[3];
  Temp  : Byte;

const
  Day_Of_Week : array[1..7] of String[3] = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');

{ M A I N    P R O G R A M }
begin
  Temp := 0;

  for Temp := 1 to 7 do
    begin
      DOW := Day_Of_Week[Temp];
    end;

end.
The error message I received is
0 1 mPAVR.exe -DBG -pATMEGA16 -MSF -O11111114 -fo10 -N"C:\Program Files\Mikroelektronika\mikroPascal PRO for AVR\Tryout\WD\DAY.mppav" -SP"C:\Program Files\Mikroelektronika\mikroPascal PRO for AVR\Defs\" -SP"C:\Program Files\Mikroelektronika\mikroPascal PRO for AVR\Uses\LTE64KW\" -SP"C:\Program Files\Mikroelektronika\mikroPascal PRO for AVR\Tryout\WD\" "__Lib_Math.mcl" "__Lib_MathDouble.mcl" "__Lib_System.mcl" "__Lib_Delays.mcl" "DAY.mpas"

0 132 Compilation Started C:\PROGRAM FILES\MIKROELEKTRONIKA\MIKROPASCAL PRO FOR AVR\TRYOUT\WD\DAY.mpas

11 304 Syntax error: Expected ";" but "=" found DAY.mpas

11 304 Syntax error: Expected "." but "(" found DAY.mpas

0 102 Finished (with errors): 11 Dec 2008, 09:38:23 DAY.mppav
Assigning the array of string as part of const is fine.
But when it hit the line 'DOW := Day_Of_Week[Temp]', it complained.
Basically I have given up in this area, as I feel this is pretty crucial to any user who want to assign array for repetition work instead of repeating strings table for controlling LCD display.

Maybe I should asked the question other way round.
Does this compiler handle this operation ?
if yes
then it must be a bug
else
if no
add this function (string array handling) for the next version.

Ken

Posted: 11 Dec 2008 13:17
by marko.ziv
Hi,

we were able to reproduce this problem
and it will be fixed for the final release.
Thank you for reporting this.

Regards

Posted: 11 Dec 2008 13:26
by pykedgew
Hi Marko

Thanks, I will be testing this when the next release appear.

Ken

Solution For the Moment

Posted: 22 Jan 2009 00:53
by pykedgew
Update

There is a work around solution to this problem.

yo2lio [Florin] has presented the code that can be used in the link below.

http://www.mikroe.com/forum/viewtopic.php?t=18097
Topics: const array of string buggy? [SOLVED]


So hopefully the mE Team will have the fix for the next release.

Thanks to yo2lio :)

Ken

Re: Solution For the Moment

Posted: 22 Jan 2009 10:51
by srdjan
Hi pykedgew.
This bug was solved a few days after you have reported it.
But then we decided to do aggregate (array, record) copying using system routine rather than generating inline code for a loop each time aggregate copying takes place.
And that is when little gremlins made their comeback :(
Sorry about this.
I have fixed this bug (once again). Until the next release, you should use Florin's workaround.
Thank you for understanding.

Posted: 22 Jan 2009 23:39
by pykedgew
Hi srdjan

Sad, as it did happen.
It was great that Florin gave the solution for the moment.

You are going to pay him (for fixing) or me(for identifying the gremlins) money? :wink:

Cheers
Ken

Posted: 23 Jan 2009 11:10
by srdjan
pykedgew wrote: You are going to pay him (for fixing) or me(for identifying the gremlins) money?
Just tell me where should I wire the money ;)