LXR Cross Referencer
   HOME

TheInfoList



OR:

LXR Cross Referencer, usually known as LXR, is a general-purpose
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
indexer and
cross-reference The term cross-reference (abbreviation: xref) can refer to either: * An instance within a document which refers to related information elsewhere in the same document. In both printed and online dictionaries cross-references are important because ...
r for code comprehension that provides
web Web most often refers to: * Spider web, a silken structure created by the animal * World Wide Web or the Web, an Internet-based hypertext system Web, WEB, or the Web may also refer to: Computing * WEB, a literate programming system created by ...
-based browsing of source code, with links to the definition and usage of any
identifier An identifier is a name that identifies (that is, labels the identity of) either a unique object or a unique ''class'' of objects, where the "object" or class may be an idea, person, physical countable object (or class thereof), or physical mass ...
.


History

LXR was born from a need for a tool to keep a synthetic eye on the
Linux kernel The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
during its development (whence its original name: LXR stood for "Linux Cross-Referencer"). 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 The Linux kernel is a free and open source Unix-like kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the kernel for the GNU operating system (OS) which was created ...
, 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 SourceForge is a web service founded by Geoffrey B. Jeffery, Tim Perdue, and Drew Streib in November 1999. SourceForge provides a centralized software discovery platform, including an online platform for managing and hosting open-source soft ...
(as early as 1994?). Time passing, fans joined the development team to give code more maturity; however their number never exceeded ten. With these characteristics, LXR is a typical
SourceForge SourceForge is a web service founded by Geoffrey B. Jeffery, Tim Perdue, and Drew Streib in November 1999. SourceForge provides a centralized software discovery platform, including an online platform for managing and hosting open-source soft ...
-hosted project but exhibits an exceptional life duration among small projects. One of the initial creators explored new technologies giving the LXRng
spin-off Spin-off, Spin Off, Spin-Off, or Spinoff may refer to: Entertainment and media *Spinoff (media), a media work derived from an existing work *''The Spinoff'', a New Zealand current affairs magazine * ''Spin Off'' (Canadian game show), a 2013 Canad ...
. 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''. However, when collecting references to LXR on the Internet, there is ambiguity between the tool itself and instances of LXR displaying indexed source code (since many sites use "LXR" in its original sense of "Linux Cross-Referencer"). After adopting LXR to index the source code for the
Mozilla Application Suite The Mozilla Application Suite (originally known as Mozilla, marketed as the Mozilla Suite) is a discontinued cross-platform integrated Internet suite. Its development was initiated by Netscape Communications Corporation, before their acquisition ...
,
Mozilla Mozilla is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, publishes and supports Mozilla products, thereby promoting free software and open standards. The community is supported institution ...
fork In cutlery or kitchenware, a fork (from 'pitchfork') is a utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tines with which one can spear foods either to h ...
ed LXR to into MXR (the Mozilla Cross Reference). MXR was forked in order to meet the needs of Mozilla development, namely code navigation of a mixed C++ and
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
codebase. After years of MXR use, Mozilla began work on a new tool with a focus on better
static analysis Static analysis, static projection, or static scoring is a simplified analysis wherein the effect of an immediate change to a system is calculated without regard to the longer-term response of the system to that change. If the short-term effect i ...
and a dynamic
Ajax Ajax may refer to: Greek mythology and tragedy * Ajax the Great, a Greek mythological hero, son of King Telamon and Periboea * Ajax the Lesser, a Greek mythological hero, son of Oileus, the king of Locris * Ajax (play), ''Ajax'' (play), by the an ...
UI. The result i
DXR
(the Dehydra Cross Reference). After DXR reached maturity, the MXR instance at mxr.mozilla.org was decommissioned. DXR was subsequently deprecated and abandoned in 2020.


Technology

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 Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
or
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
) barring or strict
HTML Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
4.01 conformance.'' ''Least-effort principle'' forbids tool programming if it already exists (at least as
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
). :''This results in
web browser A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
usage for display (
HTML Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
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 Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language". Perl was developed ...
, handy choice for CGI scripts, but not really fit for lexical or syntactic parsing.A
finite-state automaton A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
usually scans text (or source code) from left to right without backtracking. Using
regular expressions A regular expression (shortened as regex or regexp), sometimes referred to as rational expression, is a sequence of character (computing), characters that specifies a pattern matching, match pattern in string (computer science), text. Usually ...
in Perl incurs chances of multiple scanning of text with spurious replacement on already processed fragments.
LXR tries to impose as few constraints as possible: #several database choices:
MySQL MySQL () is an Open-source software, open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A rel ...
,
PostgreSQL PostgreSQL ( ) also known as Postgres, is a free and open-source software, free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. PostgreSQL features transaction processing, transactions ...
,
SQLite SQLite ( "S-Q-L-ite", "sequel-ite") is a free and open-source relational database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it ...
or
Oracle An oracle is a person or thing considered to provide insight, wise counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. If done through occultic means, it is a form of divination. Descript ...
, #choices for
full text search In text retrieval, full-text search refers to techniques for searching a single computer-stored document or a collection in a full-text database. Full-text search is distinguished from searches based on metadata or on parts of the original texts ...
between Glimpse and
SWISH-E SWISH-E stands for ''Simple Web Indexing System for Humans - Enhanced''. It is used to index collections of documents ranging up to one million documents in size and includes import filters for many document types. SWISH-E is based on SWISH, de ...
, #free choice for HTTP server provided it can execute CGI scripts (instructions are given for
Apache The Apache ( ) are several Southern Athabaskan language-speaking peoples of the Southwestern United States, Southwest, the Southern Plains and Northern Mexico. They are linguistically related to the Navajo. They migrated from the Athabascan ho ...
,
Cherokee The Cherokee (; , or ) people are one of the Indigenous peoples of the Southeastern Woodlands of the United States. Prior to the 18th century, they were concentrated in their homelands, in towns along river valleys of what is now southwestern ...
,
lighttpd lighttpd (prescribed pronunciation: "lighty") is an open-source web server optimized for speed-critical environments while remaining standards-compliant, secure and flexible. It was originally written by Jan Kneschke as a proof-of-concept of the ...
,
Nginx (pronounced "engine x" , stylized as NGINX or nginx) is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Russian developer Igor Sysoev and publicly released in 20 ...
and
thttpd thttpd (tiny/turbo/throttling HTTP server) is an open source software web server from ACME Laboratories, designed for simplicity, a small execution footprint and speed. Design and features thttpd is single-threaded and portable: it compiles ...
), #source-file stored in real directory or in version management system repository (choiceIt was initially possible to use
BitKeeper BitKeeper is a discontinued software tool for distributed revision control of computer source code. Originally developed as proprietary software by BitMover Inc., a privately held company based in Los Gatos, California, it was released as open-sou ...
, but support stopped (around 2005) when license became proprietary.
between CVS,
Git Git () is a distributed version control system that tracks versions of files. It is often used to control source code by programmers who are developing software collaboratively. Design goals of Git include speed, data integrity, and suppor ...
,Git support has been fixed in release 1.0.
Mercurial Mercurial is a distributed revision control tool for software developers. It is supported on Microsoft Windows, Linux, and other Unix-like systems, such as FreeBSD and macOS. Mercurial's major design goals include high performance and scalabi ...
and
Subversion Subversion () refers to a process by which the values and principles of a system in place are contradicted or reversed in an attempt to sabotage the established social order and its structures of Power (philosophy), power, authority, tradition, h ...
).


Usage

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 A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
with an
URL A uniform resource locator (URL), colloquially known as an address on the Web, is a reference to a resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identi ...
corresponding to the source code and navigate across files through the
hyperlinks In computing, a hyperlink, or simply a link, is a digital reference providing direct access to data by a user's clicking or tapping. A hyperlink points to a whole document or to a specific element within a document. Hypertext is text with ...
associated to identifiers.


Capabilities and limitations

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 In computing, the utility diff is a data comparison tool that computes and displays the differences between the contents of files. Unlike edit distance notions used for other purposes, diff is line-oriented rather than character-oriented, but i ...
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 may 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. Another limitation comes from the design choice to only do static code analysis, in contrast t
other solutions
which do semantic analysis as a compile step, An advanced user may change LXR layout and rendering through customizing page ''templates'' (written in HTML) and cascading style sheet (CSS).


LXR collections


LXR itself
* Linux kernel browsing *
LXR (formerly "the Linux Cross Referencer")
''(running the experimental LXRng fork provided by lxr.linux.no)'' *
Linux kernels browsing
''(ran a very old LXR version until 2017)''
Glibc 2.3.2
*
A few other LXRs from the same site
::''(archives only shows directory structure - March 2016)''
Mozilla Cross Reference, for several projects from Mozilla.org
*
LXR for Apache HTTPD
::''(archive only shows directory structure - March 2016)''
KDE Cross Reference

GNOME Cross Reference
::''(archive not available - March 2016)''


See also

*
OpenGrok OpenGrok is a source code cross-reference and search engine. It helps programmers search, cross-reference, and navigate source code trees to aid program comprehension. It can read program file formats and version control histories such as M ...


References


External links

*
Source code
on
SourceForge SourceForge is a web service founded by Geoffrey B. Jeffery, Tim Perdue, and Drew Streib in November 1999. SourceForge provides a centralized software discovery platform, including an online platform for managing and hosting open-source soft ...
LXRng (fork) * {{URL, http://lxr.linux.no Code comprehension tools Code navigation tools Code search engines