Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-01

Problem with Record Helpers and Identifier completion

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Ring

Hi!

in the past I have not used Lazarus that much, currently I am developing some code for embedded platforms based on fpc and I would like to make this code as usable as possible in Lazarus.

I am currently extending the record definitions for embedded controllers with Record Helpers. (The reason is that this approach uses less precious flash storage than objects or classes and it looks cleaner to me than to redefine the records again).

Problem with this approach seems to be that identifier completion does not have a clue about the extra procedures defined in the Record Helper.

Here's an example:

In stm32f10x_cl I have this code

type
    TGPIO_Registers = record
     CRL : longword;
     CRH : longword;
     ....
   end;
Then I have a helper Unit defining some extra procedures:
unit
   gpioHelper;
uses
   stm32f10x_cl; // necessary to make indentifier completion work at all
type
   TGPIO_RegistersHelper = record helper for TGPIO_Registers
     procedure setConfig(bit : TGPIO_Bit; config : TGPIO_Config);
     procedure setConfig(bit : TGPIO_BitSet; config : TGPIO_Config);
     ....
  end;
In main Code I now have:
program test;
uses
   gpioHelper;
begin
   GPIOD.
end.

and hit Ctrl-Space after GPIOD.

The record elements show up in completion, all the procedures defined in the helper class are not visible. Is it me doing something wrong? Or is there something that I can do with my code to create hints/whatever so that the helper classes are visible? Or am I doomed and should bite in the sour apple and redefine all records that I need?

TnX,

Michael

Reply by email