happy !

Beta Testing discussion on mikroPascal PRO for AVR.
Post Reply
Author
Message
jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

happy !

#1 Post by jpc » 09 Dec 2008 09:50

allthough i am a PIC programmer , i have been looking at this Pascal Pro for AVR with a more than average interest as i see a steady evolution over all compilers coming from ME. mP for PIC should be next to come so the better is this AVR , the better will be the next PIC version. Usually i am quite patient , this time my expectations are high now that i see what improvements have been made.

This sort of code is becoming possible now

Code: Select all

const spi_buffsize    : word =100;
type proctype = procedure;
type spi_channel_type  = record
                           head,
                           tail,
                           termflag,
                           match     : byte;
                           empty,
                           full      : boolean;
                           delimiter : string[5];
                           rx_buff,
                           tx_buff   : array[0..spi_buffsize] of byte;
                           what_to_do : proctype;
                         end;


const
      max_slave       = 5;

var spi_channels : array[0..max_slave] of spi_channel_type;
    this_channel : ^spi_channel_type;
    spi_ik ,
    spi_channel ,i,j      : byte;


    spi_txbuff        : array[0..max_slave] of array[0..spi_buffsize] of byte;
    spi_rxbuff        : array[0..max_slave] of array[0..spi_buffsize] of byte;
    spi_txhead,
    spi_txtail,
    spi_rxhead,
    spi_rxtail        : array[0..max_slave]of byte;
    spi_termflag,
    spi_match         : array[0..spi_buffsize] of byte;
    spi_rxb_empty,
    spi_rxb_full      : array[0..max_slave] of boolean;
    spi_delimiter     : array[0..max_slave] of array[5] of byte;
   // whatever : array[3] of string[5];   // results in errors

  //outstr            : string[5];
procedure nothing;
begin
  nop;
end;
  
begin
  i := sizeof(max_slave);
  i := sizeof(spi_buffsize);
  i := sizeof(spi_channel_type);
  i := 2;
  j := 7;
  
  this_channel := @spi_channels[1];
  this_channel^.head := 8;
  this_channel^.tx_buff[5] := 'x';
  this_channel^.tx_buff[j] := 'x';
  this_channel^.tx_buff[this_channel^.head] := 'x';
  this_channel^.what_to_do :=@nothing;
  this_channel^.tx_buff[this_channel^.head].3 := 1;
  this_channel^.what_to_do^;
  spi_rxbuff[i][j] := 'x';
end.
this is not intended to run at this moment but demonstrates some great features allowing for some serious programming.

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

#2 Post by jpc » 10 Dec 2008 15:44

today i looked into scope and visibility , seems this is getting real step forward as well . Declarations of variables can now be private to units. I do not know why , but for constants and type-definitions this is not ( yet) the case , i think it should be possible to have private constants and type-definitions as well.

I also would like to see the keyword INTERFACE , even if it has no real effect as all declared before the keyword IMPLEMENTATION is by default in the INTERFACE section.

Allthough there are some minor issues to solve , the watch-window allows us now to monitor variables with the same name in different units.
I noticed that some attention has to be given when naming variables , within it's scope it is now possible to overrule existing variables making them ( temporarily) inaccessible. As example , one can now ( without any warning) declare a variable EEDR thereby making the original EEDR inaccessible ( allthough library-functions will allways have access to the original EEDR) , i think a warning would be usefull here.

In the watch-window , it would be helpfull to have not only the name but also the unit visualized as is already the case in the list of variables.

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

#3 Post by jpc » 10 Dec 2008 16:12

i made a mistake there , see now that types can be local , only constants generate redifinition error (355)

Post Reply

Return to “mikroPascal PRO for AVR Beta Testing”