views:

343

answers:

4

I am trying to use doxygen to generate documentation for some matlab classes I have written. I am using the doxygen-matlab package, which includes a perl script to kludge matlab .m files into c++ style commented files, so that doxygen can read them.

In my doxyfile, I have set (according to the instructions)

FILTER_PATTERNS        = *m=C:/doxygenMatlab/m2cpp.pl

However, when the code runs, rather than running the script on the input files, it appears to just open the script using whatever the default windows setting for .pl is.

IE, if I associate .pl with notepad, the script is opened by notepad once for each input file doxygen is trying to parse. If I associate .pl with perl.exe, the script runs and throws the no argument error

Argument must contain filename -1 at C:\doxygenMatlab\m2cpp.pl line 4.

The doxygen documentation says

Doxygen will invoke the filter program by executing (via popen()) the command <filter> <input-file>

So I am wondering if there is some problem with popen() and windows that I could fix.

A: 

I encounter exactly the same error on Windows XP using Doxygen 1.6.2. Also, someone else posted the problem on the doxygen-matlab package page on Matlab Central today.

Could you already fix the problem?

René
I was unable to fix the problem, but i didn't try very hard. I suppose one kludgey solution would be to modify the perl script to generate the cpp files into a temporary directory, then run doxygen on the temporary directory
Marc
+1  A: 

Could you try the workarounds I posted on the Matlab File Exchange regarding the doxygen package ?

  1. Set the following variables in the Doxyfile : INPUT_FILTER=perl m2cpp.pl FILE_PATTERNS=*.m

  2. If it doesn't work you should try to install ActivePerl : with this version of perl, everything is working fine.

Fabrice
+1  A: 

Hi, I tried to reproduce the error using the Windows command prompt ("cmd") and noticed the following:

  • If you call "perl m2cpp.pl" you get error -1 because you did not specify a m-file to be translated into a cpp-file.
  • If you call "perl m2cpp.pl mfile" and the path of mfile contains spaces, you get error 1.
  • After I moved the mfile into a location which does not contain spaces, I got the desired output.

Now back to Doxygen. I tried what you suggested, Fabrice, without any luck. I read the doxygen help and found out that the INPUT_FILTER variable is only read and used if FILTER_PATTERNS is empty.

Therefore, I now use INPUT_FILTER = "C:\Programme\MATLAB\R2009a\sys\perl\win32\bin\perl U:\doxygen_matlab\m2cpp.pl" and an empty FILTER_PATTERNS variable. With this configuration, you can even leave the PERL_PATH variable empty. Moreover, there seems to be no issues with file names that contain spaces.

Unfortunately, all files are parsed with the above configuration, not only m-files. However, setting FILTER_PATTERNS to something like *.m=C:\Programme\MATLAB\R2009a\sys\perl\win32\bin\perl U:\doxygen_matlab\m2cpp.pl does not work because doxygen automatically adds the name of the filtered mfile and interprets the command as perl "m2cpp.pl mfile". Of course, the file "m2cpp.pl mfile" does not exist, because these are two files.

Maybe you can find a solution to this problem. In the meantime, I suggest the workaround above and that you keep your C-files away from the folder that contains the m-files.

René
this fixed my problem; it works fine as a workaround because I'm unlikely to mix c and m filesAlso, there's clearly an advantage to being french besides better food. When I replaced "Programme" with "Program Files," doxygen choked. But using the dos-style "progra~1" works fine.I'll wait a day to accept this answer in case someone finds a way to make it work using FILTER_PATTERNS, but in almost all cases, this will be good enough.
Marc
A: 

I think I solved this problem : it came from a bad association between .pl and the program to execute (maybe due to a bad installation of the perl shipped whith Matlab ?).

To correct this, you should change the association for the .pl files : in a Windows command prompt ("cmd"), just type de 2 following lines :

assoc .pl=PerlScript

ftype PerlScript=C:\Program Files\MATLAB\R20xx\sys\perl\win32\bin\perl.exe %1 %*

(the old installation forgot the %* at the end, the arguments were not passed to the m2cpp.pl script).

And then everything should be fine with the FILTER_PATTERNS set the usual way, for example FILTER_PATTERN=*m=C:\DoxygenMatlbab\m2cpp.pl

Could you tell me if this fixed your problem ?

Fabrice
I still got the same error as before; tried both with C:\Program Files\.... and C:\Progra~1\....I'll play with it more on Monday and see if I can get it to work
Marc