LXR Cross Referencer

From Wikipedia, the free encyclopedia
Jump to: navigation, search
LXR Cross Referencer
LXR logo 80 pixels.png
Initial release c. 1994 (1994)[1]
Stable release v2.0.2 / May 25, 2014; 6 months ago (2014-05-25)
Development status active
Written in Perl
Size 288 kB
Type Indexer and cross-referencer
License GNU General Public License
Website lxr.sourceforge.net sourceforge.net/projects/lxr

LXR Cross Referencer, usually known as LXR, is a general-purpose source code indexer and cross-referencer that provides web-based browsing of source code, with links to the definition and usage of any identifier.

History[edit]

LXR was born from a need for a tool to keep a synthetic eye on the Linux kernel during its development. Such a tool is all the more necessary as documentation is scarce and contributor number is high.

Two Norwegian students, Arne Georg Gleditsch and Per Kristian Gjermshus, curious about Linux architecture, began writing a small program displaying its files through a web-browser and showing variables usages after a click on the name. Aware of general interest, they posted it rapidly on SourceForge (as early as 1994?[1]).

Time passing, fans joined the development team to give code more maturity; however their number never exceeded ten.[2] With these characteristics, LXR is a typical SourceForge-hosted project but exhibits an exceptional life duration among small projects.

One of the initial creators explored new technologies giving the LXRng spin-off. This experimental development does not contain all features present in the traditional version and departs notably from LXR founding principles.

Though no communication was really ever done around the tool, LXR made its way through some paper columns, e.g. Linux Journal.[3] However, when collecting references to LXR on the Internet, there is ambiguity between the tool itself and the software being displayed by LXR.

Technology[edit]

LXR is minimalist and adheres to the least-effort principle.

The deliberate bias towards minimalism avoids using too many different technologies. Thus, it limits the dependencies and the software can be supported by many configurations without special adaptation.

The design choices include interpreted languages (such as Java or JavaScript) barring or strict HTML 4.01 conformance.

Least-effort principle forbids tool programming if it already exists (at least as open source).

This results in web browser usage for display (HTML and CSS allow for fancy page lay-out), definitions and references stored in an available relational data base and file parsing with Exuberant ctags tool.

LXR is written in Perl, handy choice for CGI scripts, but not really fit for lexical or syntactic parsing.[4]

LXR tries to impose as few constraints as possible:

  1. several database choices: MySQL, PostgreSQL, SQLite or Oracle,
  2. choices for full text search between Glimpse and SWISH-E,
  3. free choice for HTTP server provided it can execute CGI scripts (instructions are given for Apache, Cherokee, lighttpd, Nginx and thttpd),
  4. source-file stored in real directory or in version management system repository (choice[5] between CVS, Git,[6] Mercurial and Subversion).

Usage[edit]

After software installation, which is not a trivial task but does not require expertise, source code must be pre-processed and LXR configured to display it.

The different source code versions are implemented as sub-directories.
An alternative stores source code in a version management system.

Code is indexed during a second phase: identifiers are gathered and their locations entered in a data base. Reindexing is only necessary when source code is modified or a new version added.

Afterwards, all is needed is to launch a web browser with an URL corresponding to the source code and navigate across files through the hyperlinks associated to identifiers.

Capabilities and limitations[edit]

Source code can be written in any language that Exuberant ctags can handle, but parsers are not equally fine-grained.

Two versions of the same file can be compared side by side with differences visually enhanced (through diff command launched by LXR).

Besides hyperlinks under variables, a form allows searching for an identifier typed by the user.

To work around the indexing phase limitations, any character sequence my be (full text) searched at the cost of an extensive source files traversal.

LXR limitations are those of the support tools, mainly Exuberant ctags. But the primary cause of difficulties comes essentially from incorrect access permissions to files.

An advanced user may change LXR layout and rendering through customizing page templates (written in HTML) and cascading style sheet (CSS).

See also[edit]

External links[edit]

This site seems to have closed without notice early in 2014.

LXR collections:

Notes[edit]

  1. ^ a b According to dates in SourceForge's CVS repository
  2. ^ See LXR project statistics at www.ohloh.net/p/lxr
  3. ^ Read Source Code the HTML Way, June 01, 2007 by Kamran Soomro
  4. ^ A finite state automaton usually scans text (or source code) from left to right without backtracking. Using regular expressions in Perl incurs chances of multiple scanning of text with spurious replacement on already processed fragments.
  5. ^ It was initially possible to use BitKeeper, but support stopped (around 2005) when license became proprietary.
  6. ^ Git support has been fixed in release 1.0.