Sign in Join

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

Mailing lists / lazarus / 2001-02

Using RTTI to get properties and methods

9 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

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

Peter Vreman
to Shane Miller: I'm not familiar with this stuff ata all so I'm a bit over my head so bear with me. You…
Show quoted text 11 lines
I'm not familiar with this stuff ata all so I'm a bit over my head so bear with me. You guys are saying that I should create some browser database that I could reference for the classes in the LCL and the current unit that's loaded and then run through that for the code completion? I was planning on just compiling the unit with browser information then parsing the browser.log file for the information I need. However, that' going to be tough because I can find the ***FORM1*** (or whatever they typed and then pressed the period). Then I have to parse the source to find out what FORM1 is a declaration of! That isn't terribly easy because there could be comments or whatever between the text FORM1 and the text TFORM1. Is parsing the browser.log file the way to go? If not, please explain the other options a bit more. I'm not sure what you guys mean when you say I should build a browser database. During runtime? ????

Parsing browser.log is too slow. Having streamed collections is faster. As a base how the collections can be made in the compiler the browcol for tcollection objects for the text ide can be used. But i'm not that good in the classes and streaming world yet. In the compiler is at least a TCStream class that is vmt compatible with Classes.TStream

Reply by email

Peter Vreman
to Shane Miller: I'm setting up LAzarus for Code Completion using the RTTI. However, when I call PT :=…
Show quoted text 22 lines
>PT := GetTypeData(Form1.ClassInfo) > >Pt only reflects the published properties and methods. Is there a way to >get the other methods or am I doing this wrong? Not with RTTI. >Should I be using something else to implement code completion? Yes, the browser info. Maybe have a look at the implementation of browser info in the text mode IDE. The important files for browser implementation are: ide/text/fpsymbol.pas compiler/browcol.pas compiler/browlog.pas Afaik the disadvantage is that the current implementation needs parts of the compiler (symtable etc.). The browser.log generated by the switch -bl isn't very helpful. If you need more info, Pierre or Peter may help.

A way to be independent of the compiler is to create a browser database file that lazarus then can load. MSDev does it also that way. The IDE should also keep track of the line number changes made by insertion or deletion.

Peter

Reply by email

Michael Van Canneyt
to Shane Miller: I'm setting up LAzarus for Code Completion using the RTTI. However, when I call PT :=…
Shane Miller wrote 7 lines
I'm setting up LAzarus for Code Completion using the RTTI. However, when I call PT := GetTypeData(Form1.ClassInfo) Pt only reflects the published properties and methods. Is there a way to get the other methods or am I doing this wrong? Should I be using something else to implement code completion?

Yes, Browser support. This is a difficult issue; in principle you need the browser info of all units that are included in the current unit. The person who implemented browser support is Pierre Muller; you can reach him at

Michael.

Reply by email

Unknown author
to Peter Vreman: A way to be independent of the compiler is to create a browser database file that lazarus…

Hi

Show quoted text 8 lines
On Mon, 5 Feb 2001, Peter Vreman wrote: > A way to be independent of the compiler is to create a browser database > file that lazarus then can load. MSDev does it also that way. The IDE > should also keep track of the line number changes made by insertion or > deletion. I think this is actually the only way you can do it, without including the compiler in the IDE, and I don't think that doing that is a good idea.

Just my opinion. What about a "ctags" approach? Does anybosy know of similar tool for object pascal?

bye,

Stefan

--------------------------------------------------------- Stefan Hille email: 48155 Muenster voice: 0251/664695

Reply by email

Florian Klaempfl
to Shane Miller: I'm setting up LAzarus for Code Completion using the RTTI. However, when I call PT :=…
you wrote 7 lines
I'm setting up LAzarus for Code Completion using the RTTI. However, when I call PT := GetTypeData(Form1.ClassInfo) Pt only reflects the published properties and methods. Is there a way to get the other methods or am I doing this wrong?

Not with RTTI.

Should I be using something else to implement code completion?

Yes, the browser info. Maybe have a look at the implementation of browser info in the text mode IDE. The important files for browser implementation are:

ide/text/fpsymbol.pas
compiler/browcol.pas
compiler/browlog.pas

Afaik the disadvantage is that the current implementation needs parts of the compiler (symtable etc.).
The browser.log generated by the switch -bl isn't very helpful.

If you need more info, Pierre or Peter may help.

Reply by email

Unknown author
to Peter Vreman: A way to be independent of the compiler is to create a browser database file that lazarus…
Peter Vreman wrote 28 lines
>>PT := GetTypeData(Form1.ClassInfo) >> >>Pt only reflects the published properties and methods. Is there a way to >>get the other methods or am I doing this wrong? > >Not with RTTI. > >>Should I be using something else to implement code completion? > >Yes, the browser info. Maybe have a look at the implementation >of browser info in the text mode IDE. The important files for >browser implementation are: > >ide/text/fpsymbol.pas >compiler/browcol.pas >compiler/browlog.pas > >Afaik the disadvantage is that the current implementation needs parts of >the compiler (symtable etc.). >The browser.log generated by the switch -bl isn't very helpful. > >If you need more info, Pierre or Peter may help. A way to be independent of the compiler is to create a browser database file that lazarus then can load. MSDev does it also that way. The IDE should also keep track of the line number changes made by insertion or deletion.

I think this is actually the only way you can do it, without including the compiler in the IDE, and I don't think that doing that is a good idea.

Michael.

Reply by email

Shane Miller

I'm not familiar with this stuff ata all so I'm a bit over my head so bear with me.

You guys are saying that I should create some browser database that I could reference for the classes in the LCL and the current unit that's loaded and then run through that for the code completion?

I was planning on just compiling the unit with browser information then parsing the browser.log file for the information I need. However, that' going to be tough because I can find the ***FORM1***
(or whatever they typed and then pressed the period). Then I have to parse the source to find out what FORM1 is a declaration of!

That isn't terribly easy because there could be comments or whatever between the text FORM1 and the text TFORM1.

Is parsing the browser.log file the way to go? If not, please explain the other options a bit more. I'm not sure what you guys mean when you say I should build a browser database. During runtime? ????

Shane

>> 02/05/01 02:27PM >>>
Peter Vreman wrote 28 lines
>>PT := GetTypeData(Form1.ClassInfo) >> >>Pt only reflects the published properties and methods. Is there a way to >>get the other methods or am I doing this wrong? > >Not with RTTI. > >>Should I be using something else to implement code completion? > >Yes, the browser info. Maybe have a look at the implementation >of browser info in the text mode IDE. The important files for >browser implementation are: > >ide/text/fpsymbol.pas >compiler/browcol.pas >compiler/browlog.pas > >Afaik the disadvantage is that the current implementation needs parts of >the compiler (symtable etc.). >The browser.log generated by the switch -bl isn't very helpful. > >If you need more info, Pierre or Peter may help. A way to be independent of the compiler is to create a browser database file that lazarus then can load. MSDev does it also that way. The IDE should also keep track of the line number changes made by insertion or deletion.

I think this is actually the only way you can do it, without including the compiler in the IDE, and I don't think that doing that is a good idea.

Michael.

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

I'm setting up LAzarus for Code Completion using the RTTI. However, when I call

PT := GetTypeData(Form1.ClassInfo)

Pt only reflects the published properties and methods. Is there a way to get the other methods or am I doing this wrong? Should I be using something else to implement code completion?

Shane

Reply by email

Unknown author
to Shane Miller: I'm not familiar with this stuff ata all so I'm a bit over my head so bear with me. You…
Shane Miller wrote 15 lines
I'm not familiar with this stuff ata all so I'm a bit over my head so bear with me. You guys are saying that I should create some browser database that I could reference for the classes in the LCL and the current unit that's loaded and then run through that for the code completion? I was planning on just compiling the unit with browser information then parsing the browser.log file for the information I need. However, that' going to be tough because I can find the ***FORM1*** (or whatever they typed and then pressed the period). Then I have to parse the source to find out what FORM1 is a declaration of! That isn't terribly easy because there could be comments or whatever between the text FORM1 and the text TFORM1. Is parsing the browser.log file the way to go? If not, please explain the other options a bit more. I'm not sure what you guys mean when you say I should build a browser database. During runtime? ????

Yes. Delphi itself compiles (!!) the current unit you're working on behind the scenes; that is why if your code contains errors, the code completion doesn't work in Delphi; it also explains why at certain times it seems to be working very hard when you're not doing those times it recompiles the current unit (and other units it needs), to be able to extract browser info...

The only time when they actually parse the current unit in the IDE is when they do the class completion (CTRL-SHIFT-C) (obviously, since then they cannot compile it, as it's not complete)

The best way would be to keep browser log files of all units somewhere, and use those for the code completion. From time to time these could be updated.

Michael.

Show quoted text 54 lines
Shane >>> 02/05/01 02:27PM >>> On Mon, 5 Feb 2001, Peter Vreman wrote: > > >>PT := GetTypeData(Form1.ClassInfo) > >> > >>Pt only reflects the published properties and methods. Is there a way to > >>get the other methods or am I doing this wrong? > > > >Not with RTTI. > > > >>Should I be using something else to implement code completion? > > > >Yes, the browser info. Maybe have a look at the implementation > >of browser info in the text mode IDE. The important files for > >browser implementation are: > > > >ide/text/fpsymbol.pas > >compiler/browcol.pas > >compiler/browlog.pas > > > >Afaik the disadvantage is that the current implementation needs parts of > >the compiler (symtable etc.). > >The browser.log generated by the switch -bl isn't very helpful. > > > >If you need more info, Pierre or Peter may help. > > A way to be independent of the compiler is to create a browser database > file that lazarus then can load. MSDev does it also that way. The IDE > should also keep track of the line number changes made by insertion or > deletion. I think this is actually the only way you can do it, without including the compiler in the IDE, and I don't think that doing that is a good idea. Michael. _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email