source: issm/branches/trunk-jpl-damage/src/c/io/Matlab/CheckNumMatlabArguments.cpp@ 12004

Last change on this file since 12004 was 12004, checked in by cborstad, 13 years ago

merged trunk-jpl into trunk-jpl-damage through revision 11990

File size: 866 bytes
Line 
1/*!\file CheckNumMatlabArguments.cpp:
2 * \brief: check number of arguments and report an usage error message.
3 */
4
5#ifdef HAVE_CONFIG_H
6 #include <config.h>
7#else
8#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
9#endif
10
11
12#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
13
14#include "../../shared/Exceptions/exceptions.h"
15#include "../../include/include.h"
16#include "mex.h"
17
18int CheckNumMatlabArguments(int nlhs,int NLHS, int nrhs,int NRHS, const char* __FUNCT__, void (*function)( void )){
19
20 /*checks on arguments on the matlab side: */
21 if (nrhs==0 && nlhs==0) {
22 /*unless NLHS=0 and NRHS=0, we are just asking for documentation: */
23 if (NRHS==0 && NLHS==0)return 1;
24 /* special case: */
25 function();
26 _error_("usage: see above");
27 }
28 else if (nlhs!=NLHS || nrhs!=NRHS ) {
29 function();
30 _error_("usage error.");
31 }
32 return 1;
33}
34
35#endif
Note: See TracBrowser for help on using the repository browser.