Fwd: Re: [fpc-devel] build unit dependency list
Mario R. Carro
mcarro at gmx.net
Tue Aug 8 19:48:16 CEST 2006
> On Fri, 4 Aug 2006 09:53:00 -0300
>
> "Mario R. Carro" <mcarro at gmx.net> wrote:
> > Hi, I have a few hand made makefiles for some (up to now) Delphi projects
> > that I use to build the releases. I would want to be able to
> > automagically generate the dependencies for the units in the projects.
> >
> > I found that Lazarus has a dependencies view window. So after some
> > browsing I wrote the following minimal test program:
> >
> > program getpdeps;
> > {$mode objfpc}{$H+}
> > uses
> > Classes,
> > CodeCache,
> > CodeToolManager;
> > var
> > IntfFiles, ImplFiles: TStrings;
> > Cache: TCodeCache;
> > Buffer: TCodeBuffer;
> > begin
> > Cache := TCodeCache.Create;
> > IntfFiles := TStringList.Create;
> > ImplFiles := TStringList.Create;
> > try
> > Buffer := Cache.LoadFile(ParamStr(1));
> > CodeToolBoss.ActivateWriteLock;
> > try
> > CodeToolBoss.FindUsedUnitFiles(Buffer, IntfFiles, ImplFiles);
> > WriteLn('intf=' + IntfFiles.CommaText);
> > WriteLn('impl=' + ImplFiles.CommaText);
> > finally
> > CodeToolBoss.DeactivateWriteLock;
> > Buffer.Free;
> > end;
> > finally
> > Cache.Free;
> > IntfFiles.Free;
> > ImplFiles.Free;
> > end;
> > end.
> >
> > It does what I need but it fails because it couldn't find some units. How
> > do I tell CodeToolBoss where to find them?
>
> See the codetools example finddeclaration.lpi.
>
> BTW:
> CodeToolBoss already creates a code cache and many functions expect, that
> you only use that one. To load a file, use Buffer:=CodeToolBoss.LoadFile.
> And the ActivateWriteLock is only needed, when doing multiple searches.
Ok, great hints! But... every time I run the app I something like
this:
Scanning FPC sources may take a while ...
An unhandled exception occurred at $0809BF16 :
EListError : List index (1) out of bounds
Adding the CodeToolBoss.Init(Options) line to my test app produces analog
outputs. Excuse I cannot be more specific but the debugger does not seem to
be working :( I verfied the gdb path and checked the linker options, but it
does not stop on breakpoints.
Thanks,
Mario
> Mattias
-------------------------------------------------------
More information about the fpc-devel
mailing list