DADiSP Worksheet Functions > SPL Functions > SERIES.H

 

SERIES.H

Purpose:

Contains definitions of global data types, variables, and miscellaneous macros, for including in SPL function files.

Syntax:

#include <SERIES.H>

Example:

The following are examples of definitions within SERIES.H:

 

/* type of variables */

#define UNSPECIFIED_VARIABLE 0 /* temporary unspecified type */

#define GLOBAL_VARIABLE 1 /* global */

 

/* argument and variable value types */

#define INTEGER_VALUE 1

#define REAL_VALUE 2

#define COMPLEX_VALUE 3

 

/* variable type tests */

#define IS_INTEGER(v) (argtype(v)==INTEGER_VALUE)

#define IS_REAL(v) (argtype(v)==REAL_VALUE)

#define IS_COMPLEX(v) (argtype(v)==COMPLEX_VALUE)

 

/* series item types */

#define ITEM_TYPE_SERIES (0)

#define ITEM_TYPE_XY (1)

#define ITEM_TYPE_LIST (2)

Remarks:

There are many more definitions within SERIES.H. These macros can simplify SPL functions. For example:

 

#include <series.h>

 

// return imaginary part only if complex

im(x)

{

    local y;

 

    // use IS_COMPLEX macro in series.h

    y = (IS_COMPLEX(x)) ? imag(x) : x;

    return(y);

}

 

im(1)

 

returns 1

 

im(1+2i)

 

returns 2

See Also:

#DEFINE

#INCLUDE

ARGTYPE

VALUETYPE