How can I use INPUT as INCLUDE_PATH in Doxygen configuration? - doxygen

I have a C project with the subdirectories lib1 and lib2. lib2 defines things depending on defines in lib1. Therefore I set INPUT = lib1 lib2. I don't want to repeat the folders for INCLUDE_PATH (because in reality these are a lot of folders). I would like to reuse INPUT somehow.
The documentation of Doxygen states, that environment variables can be used with the syntax $(xxx). Therefore I tried INCLUDE_PATH = $(INPUT), but this doesn't work, because INPUT is not an environment variable.
lib1/lib1.h
#ifndef LIB1_H
#define LIB1_H
#define LIB1_DEPENDENCY
#endif LIB1_H
lib2/lib2.h
#include "lib1.h"
#ifdef LIB1_DEPENDENCY
//! #brief LIB1_DEPENDENCY was defined
void lib2_function(void);
#else
//! #brief LIB1_DEPENDENCY was NOT defined
void lib2_function(void);
#endif
I would expect that in the documentation the brief description of lib2_function() is "LIB1_DEPENDENCY was defined".
I am using doxygen 1.8.15.

Related

Combine docs of libraries with overlapping postfix

I want to combine the docs of two libraries: Bar and MyBar. However, this is causing strange problems with overlapping paths.
Consider this project:
Doxyfile
Bar/config.h
MyBar/config.h
with Doxyfile
INPUT = Bar MyBar
and Bar/config.h:
/**
Lorem ipsum
\file Bar/config.h
*/
/**
Some bar lib.
*/
namespace Bar {
} // namespace Bar
and MyBar/config.h:
/**
Lorem ipsum
\file MyBar/config.h
*/
#include <Bar/config.h>
/**
Some other library
*/
namespace MyBar {
} // namespace MyBar
Building with doxygen 1.9.1 gives the following warning:
Bar/config.h:4: warning: the name 'Bar/config.h' supplied as the argument in the \file statement matches the following input files:
/myprojectdir/Bar/config.h
/myprojectdir/MyBar/config.h
Please use a more specific name by including a (larger) part of the path!
I really don't know how to solve this: there is no larger part of the path to be specified (in relative sense).
The usage of the directory name in the \file is a potential source of problems.
When the documentation block of the file is in the file itself there are 2 solutions:
use the \file command without the name of the file
use the \file command without the directory
Personally I would go for the first solution as in case of a renaming of the file this has not to be done with the \file command as well.

another doxygen generating nothing

i use doxygen 1.8.15 for the first time.
I generate Doxyfile by doxygen -g and try to create documentation just by doxygen.
Among other i have in the base directory test.cpp looking like this:
/**
* This is a test. doc for an enum
*/
enum Test {
/**
* doc for an item
*/
SomeItem
};
I expect the html output in html/index.html but this is essentially an empty site.
The following is an extract of the output:
Parsing files
Preprocessing /home/ernst/Ankrit/Software/Products/Recon/recon/Mbed/main.cpp...
Parsing file /home/ernst/Ankrit/Software/Products/Recon/recon/Mbed/main.cpp...
Reading /home/ernst/Ankrit/Software/Products/Recon/recon/Mbed/mbed_settings.py...
Parsing file /home/ernst/Ankrit/Software/Products/Recon/recon/Mbed/mbed_settings.py...
Preprocessing /home/ernst/Ankrit/Software/Products/Recon/recon/Mbed/test.cpp...
Parsing file /home/ernst/Ankrit/Software/Products/Recon/recon/Mbed/test.cpp...
Building group list...
As you can see test.cpp is inside. But in the results nothing on cpp shows up, only mbed_settings.
What did i do wrong?
When e.g. cpp code doxygen has the "habit" of not finding some information when no corresponding .h file is present.
With the aid of the \file command this problem can be overcome, so the code:
/// \file
/**
* This is a test. doc for an enum
*/
enum Test {
/**
* doc for an item
*/
SomeItem
};
gives the requested result.

doxygen not resolving macro correctly

i am using doxygen 1.8.11 together with the eclipse plugin eclox. i tried to generate the call graph for my source files. when i checked in one of the files i noticed that the call graph contained a function call which is actually disabled by a #define my expectation was not to see this function call in the call-graph.
on top of the source file :
#define MACRO_NAME FALSE
....
void Func_1(int *p)
{
....
#if (MACRO_NAME == TRUE)
Func_Call_2()
#else
Func_Call_3()
#endif
}
FALSE and TRUE are defined in one of the headers i included in the settings in "Include Paths" and i also get a hyperlink in the html report for FALSE and TRUE so doxygen is able to find the definition.
both Func_Call_2 and Func_Call_3() are drawn in the call graph, when actually i only want to see Func_Call_3().
my settings in the doxyfile are:
Enable Preprocessing YES
Macro Expansion NO
Expand Only Predefined NO
Search Includes YES
Extract All YES
Extract Static YES
i also tried with Macro Expansion YES but then i got no call-graph for this function Func_1 at all only after setting it back to NO the call graph is drawn again in the html file
the header file in which FALSE/TRUE are defined starts like this:
#ifndef HEADER_H
#define HEADER_H
.....
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
is there any other setting i can try ? so that doxygen will draw the call-graph without the disabled code ?
You can try one of the following suggestions:
Don't use TRUE and FALSE but 1 and 0 directly in the definition of MACRO_NAME and in the condition.
Don't set a value for MACRO_NAME but check whether it is defined or not.
Set Macro Expandion to YES and Expand Only Predefined to YES. Then set Predefined and/or Expand As Defined to include the relevant macro's.

JSDoc - mark some code to not be parsed but retain documentation?

I'm trying to document a Javascript file with JSDoc(3) like so:
/** 1 if gnome-bluetooth is available, 0 otherwise
* #type {boolean}
* #const
*/
const HAVE_BLUETOOTH = #HAVE_BLUETOOTH#;
Now the file (called config.js.in) is not on its own valid Javascript; the file gets run through a Makefile which substitutes an appropriate value for #HAVE_BLUETOOTH#.
When I try to run JSdoc on this, it (understandably) balks because of the syntax error in the file.
Is there some way to tell JSDoc to ignore all code in this file but simply take into account the annotations? (I might have to add #name tags to each doclet to completely separate the documentation from the code; that's fine).
Something like:
/** 1 if gnome-bluetooth is available, 0 otherwise
* #name HAVE_BLUETOOTH
* #type {boolean}
* #const
*/
/** #ignore */ // somehow ignore from here onwards
const HAVE_BLUETOOTH = #HAVE_BLUETOOTH#;
/** !#ignore */ // somehow don't ignore from here onwards (although I'd be happy
// to ignore the entire file)
I'd prefer not to modify the code part of the file, if possible (I'm adding documentation to an existing project). For example, I could probably get around it with
const HAVE_BLUETOOTH = parseInt('#HAVE_BLUETOOTH#', 10);
which would make the file have valid JS syntax again so that the parser doesn't complain, but this also means I'm modifying the code of the original file which I want to avoid (I prefer to just add documentation).
cheers
My case is similar because I use JSDoc to comment my .less and .css file. When I running JSDoc on set of file, I have the same issue.
So, I resolve my problem (with JSDoc 3.3.3) with the commentsOnly JSDoc plugin
https://github.com/jsdoc3/jsdoc/blob/master/plugins/commentsOnly.js
I have create this config.json:
{
"source": {
"includePattern": ".+\\.(css|less)?$"
},
"plugins": [
"plugin/commentsOnly"
]
}
with the commentsOnly.js file into a plugin/ directory (consider plugin/ and config.json are in same folder) and in this folder I execute the following CLI command:
jsdoc -c ./config.json ./assets/stylesheets/common.less
And it's work ! There are no reason this do not work with your files.
Hope I help you ;)

Npapi Plugin not detected in demobrowser of QtWebkit

I am a newbie to StackOverflow and QtWebkit as well.
I have written a very basic Npapi plugin which has functions like NP_GetMimeTypeDescription and Np_Initialise etc for Mimetype application/basic-plugin and Mimetype description application/basic-plugin:bsc:Plug-ins SDK sample.
But I am facing a problem while loading it on the demobrowser of QtWebKit and also on Mozilla Firefox. I have placed the generated .so file in the paths where ever browser finds plugins like /usr/lib/mozilla/plugins/ and Qt Lib path.
I have a test.html file which contains the Mimetype application/basic-plugin. I am trying to launch this plugin in both the Mozilla browser and QtWebKit Demo Browser But in both the cases its not launching the plugin.
I am not able to find out why.
Any suggestions are Welcome...
Thanks for help and suggestions.
I was able to find out the problem why my plugin was not getting invoked,
even if I placed the .so file in the correct folders
/usr/lib/mozilla/plugins/ and Qt Lib path.
There were 2 reasons...
Had to enable the Define XP_UNIX (-DXP_UNIX) during compilation as a compiler directive.
This will consider different prototypes of the functions and also implementation
extern "C"
NPError OSCALL NP_Initialize(NPNetscapeFuncs *browserFuncs
#ifdef XP_UNIX
, NPPluginFuncs *pluginFuncs
#endif
)
{
// keep a pointer to the browser functions
g_browser = browserFuncs;
// any memory that is to be shared by all instances of
the browser plugin should be initialized here.
;
#ifdef XP_UNIX
// under Linux, as the browser won't call NP_GetEntryPoints()
explicitly, do it now to fill in <pluginFuncs>
return NP_GetEntryPoints(pluginFuncs);
#else
return NPERR_NO_ERROR;
#endif
}
and
extern "C"
#ifdef XP_UNIX
NPError NP_GetValue(void* instance, NPPVariable variable, void *value)
#else
NPError NP_GetValue(NPP instance, NPPVariable variable, void *value)
#endif
2.. There were 2 functions NP_GetValue and NPP_GetValue.
extern "C"
NPError NP_GetValue(void* instance, NPPVariable variable, void *value);
and
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *ret_value);
NPP_GetValue is a plugin function whose registration should be made in
NP_GetEntryPoints
extern "C"
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* NPPluginFuncsptr)
{
......
NPPluginFuncsptr->newp = NPP_New;
NPPluginFuncsptr->getvalue = NPP_GetValue;
NPPluginFuncsptr->setvalue = NPP_SetValue;
return NPERR_NO_ERROR;
}
In my code only NP_GetValue was implemented and NPP_GetValue was not implemented.
So NPP_GetValue was undefined in .so and due to it the .so was not loading.
On implementing the function NPP_GetValue this function was defined and exported in the .so file and was able to load it successfully.
The sequence of calling of the functions from the browser to plugin is as follows...
NP_Initialize - > Browser calls the initialization function first.
(In case of Linux the set of plugin function should be exported by calling
NP_GetEntryPoints explicity As browser will not call GetEntryPoints)
NP_GetEntryPoints -> Called explicitly from NP_Initialize for Linux to
expose/export plugin functions.
NP_GetValue variable : 1 -> Called from Browser to get the Plugin Name
(NPPVpluginNameString)
NP_GetValue variable : 2 -> Called from Browser to get the
Plugin Description (NPPVpluginDescriptionString)
NP_GetMimeDescription -> Called from browser to get MimeType Description
(This function should return Mime Type description
e.g. :
return("application/basic-plugin:bsc:Plug-ins SDK sample");)
NPP_New -> Called from browser to create plugin instance.
NPP_GetValue PLUGIN:main.cpp,NPP_GetValue,446ENTRY - > Called from browser to get plugin specific data...
......
Please note that the next function in the above sequence will be called
IF and ONLY IF the previous function call returns a success.:-)