Ice Sheet System Model  4.18
Code documentation
Macros | Functions
CheckNumPythonArguments.cpp File Reference

: check number of arguments and report an usage error message. More...

#include "./pythonio.h"
#include "../../c/shared/Exceptions/exceptions.h"

Go to the source code of this file.

Macros

#define PY_ARRAY_UNIQUE_SYMBOL   PythonIOSymbol
 
#define NO_IMPORT
 

Functions

int CheckNumPythonArguments (PyObject *inputs, int NRHS, void(*function)(void))
 

Detailed Description

: check number of arguments and report an usage error message.

:

Definition in file CheckNumPythonArguments.cpp.

Macro Definition Documentation

◆ PY_ARRAY_UNIQUE_SYMBOL

#define PY_ARRAY_UNIQUE_SYMBOL   PythonIOSymbol

Definition at line 5 of file CheckNumPythonArguments.cpp.

◆ NO_IMPORT

#define NO_IMPORT

Definition at line 6 of file CheckNumPythonArguments.cpp.

Function Documentation

◆ CheckNumPythonArguments()

int CheckNumPythonArguments ( PyObject *  inputs,
int  NRHS,
void(*)(void)  function 
)

Definition at line 11 of file CheckNumPythonArguments.cpp.

11  {
12 
13  Py_ssize_t size=0;
14 
15  /*figure out size of tuple in input: */
16  size=PyTuple_Size(inputs);
17 
18  /*check on requested size: */
19  if (size==0){
20  function();
21  _error_("usage: see above");
22  }
23  else if (size!=NRHS ) {
24  function();
25  _error_("usage error.");
26  }
27  return 1;
28 }
NRHS
#define NRHS
Definition: BamgConvertMesh.h:52
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49