Wednesday, May 18, 2011

Generating Doxygen Output

To generate the output of C code using Doxygen, one has to generate a Doxygen Configuration file and customize some options there according to one's requirement. The steps that I generally follow are listed below:

  1. doxygen -g [config-file-name-optional]: if the file name is given then configuration file is named that else it is Doxyfile.
  2. Edit Doxyfile. I prefer it with vim, so
    vim Doxyfile
    Then set following options:
    1. OPTIMISE_OUTPUT_FOR_C = YES
    2. FILE_PATTERNS = *.c *.h
    3. RECURSIVE = YES
    4. EXTRACT_ALL = YES
    5. EXTRACT_STATIC = YES
    6. SHOW_INCLUDE_FILES = NO
    7. Save and exit the vim editor with the key combination [esc]:wq
  3. Now just run doxygen by issuing command
    doxygen [config-file-name-optional]. In my case I write just doxygen
  4. Two folders are created html/ and latex/.
Start browsing your documentation in any browser by clicking on the files.html present in the html/ folder.
To generate pdf we need the latex/ folder. How to generate pdf? Use pdflatex tool.

Tuesday, May 17, 2011

Blogger-posts' URL

One of my habits while blogging is to put the title of the posts before I start scribbling ahead.. But with one of my recent posts I realized that the title once given is used forever for that blog-post, whatever changes you make to the title the URL remains the same.

General format of the URL's of blogger are:
http://blog-title.blogspot.com/yyyy/mm/first-four-words-of-title.html

Suppose you are writing some post about a concept and you gave the title as "Basic understanding gathered about Cloning". Now you would be thinking the URL would at least have the word cloning in it, but that is not so! WHY?
Because, the URL picks only first-four-words-of-title :P
Now if you try to edit the post's title to "Understanding Cloning", only the tile gets changed not the URL!!!

What I did to change to the URL of my post was to create a new post and paste the HTML of the previous post and write the new title of my choice, then delete the older post!! :P
Thats pretty ugly, YUCK! Please somebody suggest a more humane procedure :)

Documentation using Doxygen

Doxygen is a great tool to document the code in a neat style in most of the desired formats like html, chm, pdf, latex and also rtf!  Most of the customization of the doxygen output is possible through the options in configuration file of doxygen, generally called Doxyfile, unless named something else while generation.
All the commands that Doxygen understands are documented here.
Below is a list of some options that I found useful for the documentation of my code, extracted from the above link only:

1. To undcoument sections of code from the doxygen output:

#ifndef DOXY_DOC_SKIP
code-segment-to-skip-from-documentation
#endif

 Define this in the configuration file of Doxygen, which is Doxyfile if no name has been provided while generation of the initial configuration.           
PREDEFINED = DOXY_DOC_SKIP

2. To undocument/document some section from the doxygen comments:
/**
doxygen-captured comments
\if WANTED_ENABLED
doxygen uncaptured comments
\endif
*/

This will disable the documentation of the block in the \if &\endif construct, if at any later stage you want in the documentation, Put the flag in configuration file at the
ENABLED_SECTION = WANTED_ENABLED
This would enable in the documentation.

3. To have numbered documentation:
/**
* -# Numbered list
*    -# sublist
**/

4. To enable the documentation of the static functions in C, edit the configuration file in
EXTRACT_STATIC = YES

5. To enable the hyperlinks in pdf generated by doxygen and have the Table of Contents in the pdf document
PDF_HYPERLINKS         = YES
SHOW_DIRECTORIES       = YES

6. To capture tables and ascii charts/images put in the comment block as it is in the doxygen generated documentation, enclose the section in the \verbatim construct. For instance,
/**
  * - This is just to show the use of verbatim
  *\verbatim
 ________________________
|  S.NO.      | Command  |
|========================|
|     1.      |  printf  |
|     2.      |  scanf   |
| _______________________|
   \endverbatim
**/

Sunday, May 1, 2011

Ubuntu 11.04 and wireless connectivity problem

Wireless connection worked absolutely fine with the Broadcom STA driver on my lenovo machine - i386 until I upgraded to 11.04 when the natty narwhal's wireless connection became actually notorious! ;)
What finally worked for me to get the wireless connection working, Thanks to Eric Moon, is this. The last answer here did the trick.

I was getting the network UNCLAIMED status with

$sudo lshw -C network
PCI (sysfs) 
  *-network UNCLAIMED    
       description: Network controller
       product: BCM4311 802.11b/g WLAN
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:04:00.0
       version: 01
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list
       configuration: latency=0
       resources: memory:f0000000-f0003fff
  *-network
       description: Ethernet interface
       product: NetLink BCM5906M Fast Ethernet PCI Express
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:06:00.0
       logical name: eth0
       version: 02
       serial: 00:1e:ec:96:04:3d
       size: 100Mbit/s
       capacity: 100Mbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.116 duplex=full firmware=sb v3.04 ip=192.168.1.8 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
       resources: irq:44 memory:b8000000-b800ffff

and with

$ sudo iwconfig 
lo        no wireless extensions.

eth0      no wireless extensions.

Thus I connected to a working wired connection and installed the missing piece of two softwares, namely, firmware-b43-installer and b43-fwcutter; after deactivating the current Broadcom STA driver under Shortcuts->Additional Drivers, section.

Then running the following command activates the newly installed driver:

$ sudo modprobe b43

Still I did not get the wireless lit up as indicated in the post there, and that was because the wireless was not active in my laptop. In my lenovo machine FN+F5 is the shortcut to turn on/off the wireless. So that combination got my wifi finally up!
Now on executing:

 $ sudo lshw -C network 

no UNCLAIMED network was reported...
Also,

$ sudo iwconfig

stated a wlan0 connection!!