HQP  1.9.6
Hxi Namespace Reference

Hqp eXternal Interfaces. More...

Functions

Functions for parsing S-function argument strings
static const char * mx_forward_whitespaces (const char *start)
 Return a pointer to the first non-whitespace character at or behind start. More...
 
static const char * mx_forward_argument (const char *start)
 Return a pointer to the first non-whitespace character behind the current argument.
 
static const char * mx_count_columns (const char *row, int &n)
 Count numbers of columns n of argument row. More...
 
static const char * mx_count_dimensions (const char *arg, int &m, int &n)
 Count numbers of rows m and columns n of argument arg. More...
 
static mxArray * mx_parse_argument (SimStruct *S, const char *arg)
 Parse one argument and return a dynamically allocated mxArray. More...
 
static void mx_foutput (FILE *fp, mxArray *mx_arg)
 Print mxArray to FILE. More...
 

Detailed Description

Hqp eXternal Interfaces.

Function Documentation

static const char* Hxi::mx_count_columns ( const char *  row,
int &  n 
)
static

Count numbers of columns n of argument row.

Return a pointer to the first non-whitespace character behind the row. Note: Comma ',' or whitespaces are valid column delimiters.

References mx_forward_argument(), and mx_forward_whitespaces().

Referenced by mx_count_dimensions().

static const char* Hxi::mx_count_dimensions ( const char *  arg,
int &  m,
int &  n 
)
static

Count numbers of rows m and columns n of argument arg.

Return a pointer to the first non-whitespace character behind the argument. Note: Brackets '[' and ']' are array delimiters. Semicolon ';' is required as row delimiter.

References mx_count_columns(), and mx_forward_whitespaces().

Referenced by mx_parse_argument().

static const char* Hxi::mx_forward_whitespaces ( const char *  start)
static

Return a pointer to the first non-whitespace character at or behind start.

Note: newline '
' is considered as an ordinary whitespace character, i.e. a semicolon ';' is required to delimit rows of a matrix.

Referenced by mx_count_columns(), mx_count_dimensions(), mx_forward_argument(), and mx_parse_argument().

static void Hxi::mx_foutput ( FILE *  fp,
mxArray *  mx_arg 
)
static

Print mxArray to FILE.

References mxFree().

static mxArray* Hxi::mx_parse_argument ( SimStruct *  S,
const char *  arg 
)
static

Parse one argument and return a dynamically allocated mxArray.

The function recognizes

  • strings delimited by '\'' or '"'
  • scalar doubles
  • matrices of doubles
  • cell arrays enclosed by '{' '}' are parsed as strings

References mx_count_dimensions(), mx_forward_argument(), mx_forward_whitespaces(), and Mesch::sscan_real().