Read Source Code the HTML Way
The first thing you'll see when you open the file is a definition for a variable called v. As with programming languages, you can define your own variables and use them later in the configuration file. Wherever they occur, they will be replaced by whatever value they have. Variable values are referenced by the configuration file by $/variable-name. Variable definitions follow one of two possible formats:
variable: /variable-identifier, variable-name, /(/list-of-values/), /default-value/
variable: /variable-identifier, variable-name, /[/file-containing-list-of-values/], /default-value/
Here's what the terms stand for:
variable-identifier: the name the variable will be known as throughout the configuration file.
variable-name: the actual name of the variable that will be displayed to the user.
list-of-values: comma-separated list of values to be displayed.
file-containing: a file that contains a list of possible values.
list-of-values: the list has each entry on a separate line. The user can select any one of them. The absolute path of the file should be provided.
default-value: the value that the variable will take on by default. The first value is automatically set if this is not specified.
The baseurl is the URL relative to which all of the scripts required by LXR are placed. It should be accessible via a browser. In my configuration, it's http://my-ip/lxr/http/ <http://localhost/lxr/http/>. Make sure to place the / at the end, or the last directory will be ignored.
When the HTML for the source is generated, LXR can add headers and footers to the pages. Sample headers and footers are provided in the $INSTALLPREFIX/http/ directory. They're called template-head and template-tail. In addition, you also can change the way files and directories are displayed by LXR by modifying the template-dir file. The locations of these files can be specified by the htmlhead, htmltail and htmldir options in the lxr.conf file.
This option tells LXR where to look for the actual source code. In my case, it's /var/www/htdocs/lxr/source/glibc-2.3.5. If you want to cross-reference multiple projects, all you have to do is create a variable specifying the location of each of the directories that contain the source code. Then, you can specify the value of the variable as the sourceroot. For example, I set up the sources for glibc-2.3.5 and OpenMOSIX-2.4.26, placing the sources for both of them in /var/www/htdocs/lxr/source in their individual directories with the same names as above. In lxr.conf, I had a line like:
variable: s, Source, (glibc-2.3.5, OpenMOSIX-2.4.26)
Thus, the appropriate source code is automatically selected based on the value of the source variable.
srcrootname specifies the name of the project whose source code is displayed—for example:
This is the location of the fileidx and xref files generated by genxref. If you have multiple projects, specify a separate location for each, as follows:
These are the only options you need to set when configuring LXR. Additionally, you can specify the location of the glimpse binary using glimpsebin.
glimpse allows users to search for specific files within the source code and to search for any text within source files. You can obtain the latest version of glimpse from webglimpse.net/trial/glimpse-latest.tar.gz. Extract and install it. Once you are done installing glimpse, go to the directory where the source code is installed, such as /var/www/htdocs/lxr/source/glibc-2.3.5, and do the following:
bash# glimpseindex -H . .
The output should look something like this:
This is glimpseindex version 4.18.2, 2006. Indexing "/var/www/htdocs/lxr/source/glibc-2.3.5" ... Size of files being indexed = 81711416 B, Total #of files = 10075 Index-directory: "/var/www/htdocs/lxr/source/glibc-2.3.5" Glimpse-files created here: -rw-r--r-- 1 root root 676398 2006-09-08 05:51 .glimpse_filenames -rw-r--r-- 1 root root 40300 2006-09-08 05:51 .glimpse_filenames_index -rw-r--r-- 1 root root 0 2006-09-08 05:50 .glimpse_filetimes -rw------- 1 root root 1783314 2006-09-08 05:51 .glimpse_index -rw-r--r-- 1 root root 686 2006-09-08 05:51 .glimpse_messages -rw------- 1 root root 836 2006-09-08 05:51 .glimpse_partitions -rw-r--r-- 1 root root 23888 2006-09-08 05:51 .glimpse_statistics
This creates the required glimpse index files in the current directory. Once they're created, make sure read permission is set for others:
bash# chmod o+r .glimpse-*
Now, set the glimpsebin option in lxr.conf to wherever you installed glimpse. I installed it in /usr/local/bin/glimpse.
That's it; save and close the lxr.conf file. The only thing remaining to do now is configure the Web server to work with LXR.
|ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs||Aug 24, 2016|
|Updates from LinuxCon and ContainerCon, Toronto, August 2016||Aug 23, 2016|
|NVMe over Fabrics Support Coming to the Linux 4.8 Kernel||Aug 22, 2016|
|What I Wish I’d Known When I Was an Embedded Linux Newbie||Aug 18, 2016|
|Pandas||Aug 17, 2016|
|Juniper Systems' Geode||Aug 16, 2016|
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Updates from LinuxCon and ContainerCon, Toronto, August 2016
- What I Wish I’d Known When I Was an Embedded Linux Newbie
- ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs
- NVMe over Fabrics Support Coming to the Linux 4.8 Kernel
- New Version of GParted
- All about printf
- Tor 0.2.8.6 Is Released
- Blender for Visual Effects
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide