Re: [Lxr-dev] Database relationships and finding "dead" code
Brought to you by:
ajlittoz
From: Darragh S. <Dar...@Su...> - 2002-10-10 10:11:14
|
Hi Malcolm, all, I have attempted to diagram the relationships, and here is my stab at it. If you want to edit, I have included the dia file, dia is available for most platforms from http://www.lysator.liu.se/~alla/dia and comes with GNOME Can you please tell me if the relationships are wrong Thanks Malcolm Box wrote: > Hi Darragh, > > Darragh Sherwin wrote: > >> I am looking to write an add-in to LXR that will find "dead" or >> un-used code, > > > Sounds like a cool addition - certainly something I'd love to see. > >> however I can't see the relationships betweem the tables in the database. >> Could you please send me (or put up on the web) a diagram of the >> relationships between the tables > > > I wish I had one! If anyone else on the list is a dab hand with a > drawing package, here's the info you need to make a diagram: > > There are three basic tables that hold info on filerevs, releases and > symbols, and then two tables which tie these together. > > The basic tables: > > Files table: information about every distinct (filename, revision) in > the system. > filename - obvious really :-) > revision - the revision number of this version of the file > fileid - unique ID for this file at this revision. > > Releases table: > fileid : Foreign key from files table > Release: release that this file is in. Note one fileid may appear in > multiple releases > > Symbols table: > symid: Unique id for each symbol. > symname: The unique string of characters for this symbol > > And the relation ones: > > Indexes table: > symid : A symbol id (Foreign key) > fileid : File that this symbol appears in (foreign key) > line : Line at which this symbol appears > langid : What language this file is in (C++, perl etc) > type : What sort of appearance of the symbol is this (type, langid > is looked up in the declarations table to turn this into a human > readable form). > relsym : Any symbol to which this appearance of the symbol is related. > > Since a symbol is simply a character string, it is possible that the > same string is used for different things in different parts of the > source base. So the indexes table will hold one entry for each place > where the symbol is defined/declared, along with what sort of > definition/declaration it is at that point (class, variable, macro etc). > > Useage table: > fileid : File identifier (Foreign key) > symid : Symbol id (Foreign key) > line : Line number in the file where the symbol appears > > The useage table tracks where the symbol is referenced. There is one > entry for each place in each file where something that matches a symbol > name exists. > > The final table is that status table, which just records what processing > has been done on each file. > > Regards, > > Malcolm > -- _______________________ Darragh Sherwin Email: Dar...@Su... Phone: x19788/+353-1-8199788 "To alcohol, the cause of, and solution to, all of life's problems" Homer Simpson |