I'm sure this has already been asked somewhere but I can't seem to find it, so here it goes.
I am creating a program in C and using Doxygen to generate documentation. I am quite satisfied with the results, however the main page has no content. I would like to fill the main page with a list of all functions and structures used in the program in alphabetical order.
I do not know much about Doxygen, beyond the simple tutorial that I have used to get this far. It seems like a task that Doxygen would be able to do, but so far all I have found is instructions on how to create a custom main page.
Is it possible to use Doxygen to automatically generate a list of functions and structures on the main page?
Doxygen doesn't really offer a lot from the configuration point of view. You can use, together with Doxygen and doxyrest, a tool called Sphinx.
Basically, you'll be able to generate XML using Doxygen. Doxyrest is going to convert the XML output into .rst files, while Sphinx will work with the final result (it only handles .rst, that's why you'll need to use an intermediate tool like doxyrest).
Sphinx is going to generate beautiful HTML pages that are easy to read and, more important, to configure.
Information on how to combine these three tools and use them together can be found on this page: https://vovkos.github.io/doxyrest/manual/basic.html
A solution to your problem would be to group your functions using the \addtogroup Doxygen command (add all functions to the same group), and then, using Sphinx, select the newly created group page to be your index/landing page. This can be done by editing some lines in Sphinx's conf.py.
I was also looking for a more elegant way to see and search all functions.
Maybe the following trick will help you that i currently use:
If you use the #todo in your function headers,
then you will get in "Related Pages" a "Todo List" with all function names.
There you will get an alphabetical list with all functions with #todo.
You are also able to klick on the function name for better navigation.
Example/tip: If you view html output with web browser, you are able to search the todo list for function.
I recommend you to use #mainpage. This function changed the header of the main page and then after it you can use functions like #brief for a short information.
Use html tags to create sections, for me it works. Then in the new section with function #see you can go from the main page to functions or files. This is a working excample:
/**
* #mainpage WATCHDOG
* <hr/>
* #setion <b> File tree<b/>
* #brief Here you can see the main files which are used.
* #see io.c
* #see watchdog.c
* #see watchdog.h
* <p/><br/>
* <hr/>
* In this part we have few main functions used by the programm
* <p/><br/>
* #see watchdog_init_s();
* #see fpga_resetregs_init_s();
* #see watchdog_read(int add, unsigned int ws );
* #see watchdog_reset_io_write(WD * watchdog, unsigned int* data,unsigned int *ws );
* <hr/>
*/
Related
I am trying to find a way of creating a custom function macro in Enterprise Architect to "override" the built-in CSTYLE_COMMENT macro with a custom version of it that creates comments differently to use for operation headers when generating code.
EA's built-in CSTYLE_COMMENT generates comments like this:
/**
* Name: OperationA
* Inputs: int int
* Outputs: -
* Description: It doesn't do stuff
*/
I want to create some custom template that generates comments like this:
/***********************************
* Name: OperationA
* Inputs: int int
* Outputs: -
* Description: It doesn't do stuff
***********************************/
Is this possible? If so, how would I go about doing so? My efforts on finding any detailed guide on syntax online have been futile. Even though SparX systems has the exact search term that I looked for here:
https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_domains/codetemplatesyntax.html
there is no useful information on how to do what I want.
I found a way of doing this but I am not sure it is the best and it does not work well with reverse engineering and synchronization of the model. I could not find how to write my own macro as there is literally no documentation anywhere I looked.
This is how I did it:
Instead of
%CSTYLE_COMMENT($wrapLen)%
I wrote
/***************************************\n
%WRAP_COMMENT(opNotes,$wrapLen, "", "*")%
\n***************************************/
It worked exactly as I intended it to.
EDIT: I found what was missing to be able to correctly reverse engineer this commenting format. In EA 14, I navigated to START->Preferences->Source Code Engineering and I unchecked the option "Remove hard breaks from comments on import". This made the reverse engineering work correctly and update comments in the Element Notes field without losing their layout.
New to Doxygen and wondering can it be used to draw a graph showing what functions use a given global variable. I have been able to get call/caller graphs working for functions and want to do something similar for a hand full of variables.
REFERENCED_BY_RELATION = YES: In a Variable description it documents all functions which have used the variable and generates a hyperlink to these functions in the code. In the function documentation, this documents all functions being used in that particular function and also generates a hyperlink to the actual code.
REFERENCES_RELATION = YES: In a function documentation, this documents all functions that have called the function being described and also generates a hyperlink tot he code.
Although this is not a graphical solution (which would be way better), this is something one can definitely work with.
I am studying and debugging one software. There are thousands of functions in this software. I plan to add printf() at the entry and exit point of each function. It will take a lot of time.
Is there one tool/script to do this?
I may use '__cyg_profile_func_enter'. But it can only get address. But I have to run another script to get function name. I also hope to get value of input parameters of this function too.
You should give a try to AOP : Aspect Oriented Programming. Personnaly I've only tried with Java and Spring AOP but there's an API for C too : AspectC (https://sites.google.com/a/gapp.msrg.utoronto.ca/aspectc/home). From what I've seen, it's not the only one.
From what I've red about this library, you can add an pointcut before compiling with AspectC :
// before means it's a before function aspect
// call means it's processed when a function is called
// args(...) means it applies to any function with any arguments
// this->funcName is the name of the function handled by AspectC
before(): call(args(...)) {
printf("Entering %s\n", this->funcName);
}
(not tried by myself but extracted from the reference page https://sites.google.com/a/gapp.msrg.utoronto.ca/aspectc/tutorial)
This is only a basic overview of what can be done and you still have to deal with the compilation (documented in the page linked before) but it looks like it could possibly help you. Give a try with a simple POC maybe.
There is a Doxygen option to specify when API appeared using \since tag, for example
///
/// Does foo
///
/// \since 1.5
///
void foo();
And it would appear in foo()'s documentation.
What I'm looking is a way to create automatically page that contains all API
appeared in 1.5 - i.e. list all API marked by \since 1.5 or probably
some other tag if available.
Edit: I tried to use \ingroup and create a group page containing all new API there and it works. But it moves description to this page, for example moves a new method from class definition to a page "New in 1.2.3" which isn't what I wanted.
You want to create an external reference to the current item, an \xrefitem:
\xrefitem version_change_1_0_0 "Since 1.0.0" "Changes in 1.0.0" ...
<key> <heading> <list title> <text>
All items that share the same <key> will be shown on a special generated page. The <heading> will be used to start a section at the place you're using \xrefitem, whereas <list title> will be used as a title for the resulting page (see remarks below). The text can be arbitrary.
The result you get is similar to the lists and appearances of\todo and \bug, and you can even think of \bug and \todo implemented as
\bug <text> = \xrefitem bug "Bug" "List of bugs" <text>
\todo <text> = \xrefitem todo "Todo" "List of todos" <text>
Unfortunately, the key cannot contain dots:
ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*
LABELID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-]*
Therefore, you have to use an alias that takes (at least) two arguments, one for the label, and one for the actual text:
ALIASES += sinceversion{3}="\xrefitem version_changes\1 \"Since \2\" \"Changes in \2\" \3\n\n"
ALIASES += sinceversion{2}="\sinceversion{\1,\2,Introduced in this version.}"
If you never use dots, you can of course simplify the alias even more. This will give you two new commands:
\sinceversion{label, version}
\sinceversion{label, version, custom text}
In both cases, the label must only contain alphanumeric symbols, the version can be arbitrary. If you don't provide the custom text, "Introduced in this version" will be shown.
If there's a page with the identifier version_changes<label>, the list of changes will be added. Note that the \page's title will overwrite the title given by the \xrefitem, which can be handy for major releases.
Example
Here's an example of \sinceversion's usage. Note that you probably want to use another alias like ALIASES += since_vXYZ{1}="\sinceversion{X_Y_Z,X.Y.Z,\1}" if you document a lot of changes for version x.y.z:
Example code
/** Foos around.
* \sinceversion{001,0.0.1}
*/
void foo(){}
/** Bars around.
* \sinceversion{001,0.0.1}
* \sinceversion{002,0.0.2,Removed a memory leak}
*/
void bar(){}
/** \page version_changes002 Changes in 0.0.2
*
* We found several memory leaks and removed them
*/
List of version change pages
List of changes per version
List of changes per version with additional description
Appearance of changes in function documentation
I'm quite aware this question has been asked before multiple times, but I have no idea how to deal with this in my specfic situation. All I did was modify the default/settings.php file in order for the toolbar drawer in drupal to support more shortcuts.
I inserted the following code in the bottom of the document:
/**
* Changing Max Shortcut Slots
*
* The shortcut module supports a total of seven shortcuts slots. To change
* the quantity of supported enabled shortcuts the 'shortcut_max_slots' must be
* modified accordingly.
*
* #see https://www.drupal.org/documentation/modules/shortcut
*/
$conf['shortcut_max_slots'] = 11;
Well I got it to work, which is good, but I'm assaulted by a barrage of warnings, each one stating the following:
Warning: Cannot modify header information - headers already sent by (output started at /home/adamdcco/public_html/hadarc.com/cms/sites/default/settings.php:1) in drupal_send_headers() (line 1221 of /home/adamdcco/public_html/hadarc.com/cms/includes/bootstrap.inc).
I'm lost, I looked into the bootstrap file and navigated to the specficed line and, unfortunately no lightbulb. Sorry I'm new :), but I did search around, before being utterly overwhelmed
Any and all help is appreciated :P
Well than looks like we're good :)
I searched around some more and came across this question/answer
How to fix "Headers already sent" error in PHP , in a nutshell it's the same question, amazing answer, so yeah just in case anyone cared the code I inputted:
$conf['shortcut_max_slots'] = 11;
should of had quotes around the eleven, and any extra spaces in the beginning and in the end of the file had to be removed. Live and Learn :)