HOME

TheInfoList



OR:

LXR Cross Referencer, usually known as LXR, is a general-purpose
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
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, physical countable object (or class thereof), or physical noncountable ...
.


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, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ope ...
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, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU oper ...
, 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 that offers software consumers a centralized online location to control and manage open-source software projects and research business software. It provides source code repository hosting, bug tracking, mirrorin ...
(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 that offers software consumers a centralized online location to control and manage open-source software projects and research business software. It provides source code repository hosting, bug tracking, mirrorin ...
-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''. 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 b ...
,
Mozilla Mozilla (stylized as moz://a) is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, spreads and supports Mozilla products, thereby promoting exclusively free software and open standards, wi ...
fork In cutlery or kitchenware, a fork (from la, furca '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 ei ...
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++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
and
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
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), by the ancient Greek ...
UI. The result i
DXR
(the Dehydra Cross Reference). After DXR reached maturity, the MXR instance at mxr.mozilla.org was decommissioned.


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 (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
or
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
) barring or strict
HTML The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
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 the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
). :''This results in
web browser A web browser is application software 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 screen. Browsers are used on ...
usage for display (
HTML The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
and
CSS Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone techno ...
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 family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
, 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 characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
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 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 relational database o ...
,
PostgreSQL PostgreSQL (, ), also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. It was originally named POSTGRES, referring to its origins as a successor to the In ...
,
SQLite SQLite (, ) is a 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 belongs to the family of embedded databases. It is the most ...
or
Oracle An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination. Description The word '' ...
, #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 r ...
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, dev ...
, #free choice for HTTP server provided it can execute CGI scripts (instructions are given for
Apache The Apache () are a group of culturally related Native American tribes in the Southwestern United States, which include the Chiricahua, Jicarilla, Lipan, Mescalero, Mimbreño, Ndendahe (Bedonkohe or Mogollon and Nednhi or Carrizaleño an ...
,
Cherokee The Cherokee (; chr, ᎠᏂᏴᏫᏯᎢ, translit=Aniyvwiyaʔi or Anigiduwagi, or chr, ᏣᎳᎩ, links=no, translit=Tsalagi) are one of the indigenous peoples of the Southeastern Woodlands of the United States. Prior to the 18th century, t ...
,
lighttpd lighttpd (pronounced "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 c10k problem ...
,
Nginx Nginx (pronounced "engine x" ) 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 Igor Sysoev and publicly released in 2004. Nginx is free and open-source software ...
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 compile ...
), #source-file stored in real
directory Directory may refer to: * Directory (computing), or folder, a file system structure in which to store computer files * Directory (OpenVMS command) * Directory service, a software application for organizing information about a computer network's u ...
or in version management system repository (choiceIt was initially possible to use
BitKeeper BitKeeper is a 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-source software ...
, but support stopped (around 2005) when license became proprietary.
between CVS,
Git Git () is a distributed version control system: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data inte ...
,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 and Unix-like systems, such as FreeBSD, macOS, and Linux. Mercurial's major design goals include high performance and scalability, d ...
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 transform the established social order and its structures of power, authority, hierarchy, and social norms. Sub ...
).


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 is application software 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 screen. Browsers are used on ...
with an
URL A Uniform Resource Locator (URL), colloquially termed as a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifie ...
corresponding to the source code and navigate across files through the
hyperlinks In computing, a hyperlink, or simply a link, is a digital reference to data that the user can follow or be guided by clicking or tapping. A hyperlink points to a whole document or to a specific element within a document. Hypertext is text wi ...
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 it ...
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 Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technol ...
(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 search and cross-reference engine. It helps programmers to search, cross-reference, and navigate source code trees to aid code comprehension. It can understand various program file formats and version control histories ...


References


External links

*
Source code
on
SourceForge SourceForge is a web service that offers software consumers a centralized online location to control and manage open-source software projects and research business software. It provides source code repository hosting, bug tracking, mirrorin ...
LXRng (fork) * {{URL, http://lxr.linux.no Code comprehension tools Code navigation tools Code search engines