HPGCC3 Documentation 3.0 R003

Argument and type checking functions

Defines

#define sat3_isreal(obj)   sat3_checktype(obj,SAT_DOREAL)
 Check object type on a given object.
#define sat3_iscplx(obj)   sat3_checktype(obj,SAT_DOCMP)
 Check object type on a given object.
#define sat3_isbint(obj)   sat3_checktype(obj,SAT_DOBINT)
 Check object type on a given object.
#define sat3_iszint(obj)   sat3_checktype(obj,SAT_DOINT)
 Check object type on a given object.
#define sat3_ischar(obj)   sat3_checktype(obj,SAT_DOCHAR)
 Check object type on a given object.
#define sat3_iscstr(obj)   sat3_checktype(obj,SAT_DOCSTR)
 Check object type on a given object.
#define sat3_ishxs(obj)   sat3_checktype(obj,SAT_DOHXS)
 Check object type on a given object.
#define sat3_islist(obj)   sat3_checktype(obj,SAT_DOLIST)
 Check object type on a given object.
#define sat3_ismatrix(obj)   sat3_checktype(obj,SAT_DOMATRIX)
 Check object type on a given object.
#define sat3_isid(obj)   sat3_checktype(obj,SAT_DOIDNT)
 Check object type on a given object.
#define sat3_istag(obj)   sat3_checktype(obj,SAT_DOTAG)
 Check object type on a given object.
#define sat3_issymb(obj)   sat3_checktype(obj,SAT_DOSYMB)
 Check object type on a given object.
#define sat3_isdir(obj)   sat3_checktype(obj,SAT_DORRP)
 Check object type on a given object.

Functions

BOOL sat3_checktype (SAT_OBJECT obj, unsigned int prolog)
 Verify object type.
BOOL sat3_checkargs (int n,...)
 Check for multiple stack arguments.
void sat3_checkargserror (int n,...)
 Check for multiple stack arguments, and exit with an error if types don't match.
BOOL sat3_ckn (int n)
 Check for enough stack arguments, and protect the calculator stack.
void sat3_cknerror (int n)
 Check for enough stack arguments, protect the calculator stack, and exit with error.
BOOL sat3_israrray (SAT_OBJECT obj)
 Check object type on a given object.
BOOL sat3_iscarray (SAT_OBJECT obj)
 Check object type on a given object.
BOOL sat3_isptr (SAT_OBJECT obj)
 Check if SAT_OBJECT is a PTR to an object in ROM.

Detailed Description

This group includes all functions used to identify objects.


Define Documentation

#define sat3_isbint (   obj)    sat3_checktype(obj,SAT_DOBINT)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3913 of file sat3.h.

#define sat3_ischar (   obj)    sat3_checktype(obj,SAT_DOCHAR)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3931 of file sat3.h.

#define sat3_iscplx (   obj)    sat3_checktype(obj,SAT_DOCMP)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3904 of file sat3.h.

#define sat3_iscstr (   obj)    sat3_checktype(obj,SAT_DOCSTR)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3940 of file sat3.h.

#define sat3_isdir (   obj)    sat3_checktype(obj,SAT_DORRP)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 4003 of file sat3.h.

#define sat3_ishxs (   obj)    sat3_checktype(obj,SAT_DOHXS)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3949 of file sat3.h.

#define sat3_isid (   obj)    sat3_checktype(obj,SAT_DOIDNT)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3976 of file sat3.h.

#define sat3_islist (   obj)    sat3_checktype(obj,SAT_DOLIST)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3958 of file sat3.h.

#define sat3_ismatrix (   obj)    sat3_checktype(obj,SAT_DOMATRIX)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3967 of file sat3.h.

#define sat3_isreal (   obj)    sat3_checktype(obj,SAT_DOREAL)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3895 of file sat3.h.

#define sat3_issymb (   obj)    sat3_checktype(obj,SAT_DOSYMB)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3994 of file sat3.h.

#define sat3_istag (   obj)    sat3_checktype(obj,SAT_DOTAG)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3985 of file sat3.h.

#define sat3_iszint (   obj)    sat3_checktype(obj,SAT_DOINT)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.

Definition at line 3922 of file sat3.h.


Function Documentation

BOOL sat3_checkargs ( int  n,
  ... 
)

Check for multiple stack arguments.

Checks if there are at least 'n' arguments on the stack, then verifies the type of each argument using sat3_checktype. This function must be called with exactly 'n' arguments, each indicating the expected type on each level of the stack (level 1 first, then 2 and up).

Parameters:
nNumber of arguments to expect on the stack.
...'n' arguments with object type, given by one of the SAT_DOXXX constants, optionally adding one of the constants SAT_TAGGED or SAT_OPTIONAL_TAG. Can also be the constant SAT_ANY, which represents all objects, or the constant SAT_NUMERIC, which represents any numeric type, including bints, zints, hex strings, and reals. Some examples: SAT_TAGGED | SAT_DOREAL will check for a tagged real. SAT_OPTIONAL_TAG | SAT_DOREAL will accept either a real or a tagged real (the tag is optional). SAT_TAGGED | SAT_ANY accepts any tagged object, and is equivalent to SAT_DOTAG.
Returns:
Returns TRUE if *ALL* stack arguments match the given types, FALSE otherwise.
See also:
sat3_ckn sat3_checkargserror
void sat3_checkargserror ( int  n,
  ... 
)

Check for multiple stack arguments, and exit with an error if types don't match.

Checks if there are at least 'n' arguments on the stack, then verifies the type of each argument using sat3_checktype. This function must be called with exactly 'n' arguments, each indicating the expected type on each level of the stack (level 1 first, then 2 and up).

Parameters:
nNumber of arguments to expect on the stack.
...'n' arguments with object type, given by one of the SAT_DOXXX constants, optionally adding one of the constants SAT_TAGGED or SAT_OPTIONAL_TAG. Can also be the constant SAT_ANY, which represents all objects, or the constant SAT_NUMERIC, which represents any numeric type, including bints, zints, hex strings, and reals. Some examples: SAT_TAGGED | SAT_DOREAL will check for a tagged real. SAT_OPTIONAL_TAG | SAT_DOREAL will accept either a real or a tagged real (the tag is optional). SAT_TAGGED | SAT_ANY accepts any tagged object, and is equivalent to SAT_DOTAG.
Returns:
Returns only if *ALL* stack arguments match the given types, otherwise it does not return, but exits the program generating the proper error message.
See also:
BOOL sat3_checktype ( SAT_OBJECT  obj,
unsigned int  prolog 
)

Verify object type.

Check if the given object is of the specified type.

Parameters:
objObject to check type.
prologObject type, given by one of the SAT_DOXXX constants, optionally adding one of the constants SAT_TAGGED or SAT_OPTIONAL_TAG. Can also be the constant SAT_ANY, which will return TRUE for all objects, or the constant SAT_NUMERIC, which represents any numeric type, including bints, zints, hex strings, and reals. Some examples: SAT_TAGGED | SAT_DOREAL will check for a tagged real. SAT_OPTIONAL_TAG | SAT_DOREAL will return TRUE for either a real or a tagged real (the tag is optional). SAT_TAGGED | SAT_ANY accepts any tagged object, and is equivalent to SAT_DOTAG. SAT_OPTIONAL_TAG | SAT_NUMERIC accepts Zints, reals, bints and hex strings, even if they are tagged.
Returns:
Returns TRUE if type matches, FALSE otherwise.
See also:
sat3_checkargs
BOOL sat3_ckn ( int  n)

Check for enough stack arguments, and protect the calculator stack.

Checks if there are at least 'n' arguments on the stack, up to a maximum of 5 arguments. This function also sets the protection on the calculator stack, allowing proper stack recovery after an error generated by sat3_exiterror(). It also allows the C program effect to be undone later. This function *MUST* be called if sat3_exiterror() is used, for proper error handling. Even if no arguments are required, it is good practice to call this function (with n=0).

Parameters:
nNumber of arguments to expect on the stack.
Returns:
Returns TRUE if there are at least 'n' objects on the stack, FALSE otherwise.
See also:
sat3_cknerror sat3_sheckargs sat3_checkargserror sat3_exiterror
void sat3_cknerror ( int  n)

Check for enough stack arguments, protect the calculator stack, and exit with error.

Checks if there are at least 'n' arguments on the stack, up to a maximum of 5 arguments. This function also sets the protection on the calculator stack, allowing proper stack recovery after an error generated by sat3_exiterror(). It also allows the C program effect to be undone later in the calculator. This function *MUST* be called if sat3_exiterror() is used, for proper error handling. Even if no arguments are required, it is good practice to call this function (with n=0).

Parameters:
nNumber of arguments to expect on the stack.
Returns:
Returns only if there are at least 'n' objects on the stack, otherwise it does not return, but it exits the program with the proper error message (uses sat3_exiterror).
See also:
sat3_ckn sat3_sheckargs sat3_checkargserror sat3_exiterror
BOOL sat3_iscarray ( SAT_OBJECT  obj)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.
BOOL sat3_isptr ( SAT_OBJECT  obj)

Check if SAT_OBJECT is a PTR to an object in ROM.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if it's not an object but a PTR rom address.
BOOL sat3_israrray ( SAT_OBJECT  obj)

Check object type on a given object.

Parameters:
objAny saturn object.
Returns:
Returns TRUE if object is of the specified type, FALSE otherwise.