On Fri, 4 Aug 2006 09:53:00 -0300 "Mario R. Carro" <[EMAIL PROTECTED]> 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: CodeToolBos 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. Mattias _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel