BuiltinFunctions.hpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define fix_args(x)   expandArgs(arguments, argcount, x##_MIN, x##_MAX, CHAR_##x)
 
#define check_args(x)   expandArgs(arguments, argcount, x##_MIN, x##_MAX, CHAR_##x)
 
#define get_arg(x, n)   arguments[x##_##n - 1]
 
#define set_arg(x, n1, n2)   arguments[x##_##n1 - 1] = arguments[x##_##n2 - 1]
 
#define required_string(x, n)   requiredStringArg(x##_##n, arguments, argcount, CHAR_##x)
 
#define optional_string(x, n)   optionalStringArg(x##_##n, arguments, argcount, CHAR_##x)
 
#define required_text(x, n)   requiredTextArg(x##_##n, arguments, argcount, CHAR_##x)
 
#define required_integer(x, n)   requiredIntegerArg(x##_##n, arguments, argcount, CHAR_##x)
 
#define optional_integer(x, n)   optionalIntegerArg(x##_##n, arguments, argcount, CHAR_##x)
 
#define required_big_integer(x, n)   requiredBigIntegerArg(x##_##n, arguments, argcount, CHAR_##x)
 
#define optional_big_integer(x, n)   optionalBigIntegerArg(x##_##n, arguments, argcount, CHAR_##x)
 
#define optional_argument(x, n)   ((argcount >= x##_##n) ? arguments[x##_##n -1] : OREF_NULL )
 
#define arg_exists(x, n)   ((argcount < x##_##n) ? false : arguments[x##_##n - 1] != OREF_NULL )
 
#define arg_omitted(x, n)   ((argcount < x##_##n) ? true : arguments[x##_##n - 1] == OREF_NULL )
 
#define BUILTIN(x)   RexxObject *builtin_function_##x ( RexxActivation * context, RexxObject **arguments, size_t argcount, size_t named_argcount, RexxExpressionStack *stack )
 
#define positive_integer(n, f, p)   if (n <= 0) reportException(Error_Incorrect_call_positive, CHAR_##f, OREF_positional, p, n)
 
#define nonnegative_integer(n, f, p)   if (n < 0) reportException(Error_Incorrect_call_nonnegative, CHAR_##f, OREF_positional, p, n)
 
#define ALPHANUM   "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
 

Functions

void expandArgs (RexxObject **arguments, size_t argcount, size_t min, size_t max, const char *function)
 
RexxStringrequiredStringArg (size_t position, RexxObject **arguments, size_t argcount, const char *function)
 
RexxStringoptionalStringArg (size_t position, RexxObject **arguments, size_t argcount, const char *function)
 
RexxIntegerrequiredIntegerArg (size_t position, RexxObject **arguments, size_t argcount, const char *function)
 
RexxIntegeroptionalIntegerArg (size_t position, RexxObject **arguments, size_t argcount, const char *function)
 
RexxObjectrequiredBigIntegerArg (size_t position, RexxObject **arguments, size_t argcount, const char *function)
 
RexxObjectoptionalBigIntegerArg (size_t position, RexxObject **arguments, size_t argcount, const char *function)
 

Macro Definition Documentation

◆ ALPHANUM

#define ALPHANUM   "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

Definition at line 117 of file BuiltinFunctions.hpp.

◆ arg_exists

#define arg_exists (   x,
 
)    ((argcount < x##_##n) ? false : arguments[x##_##n - 1] != OREF_NULL )

Definition at line 109 of file BuiltinFunctions.hpp.

◆ arg_omitted

#define arg_omitted (   x,
 
)    ((argcount < x##_##n) ? true : arguments[x##_##n - 1] == OREF_NULL )

Definition at line 110 of file BuiltinFunctions.hpp.

◆ BUILTIN

#define BUILTIN (   x)    RexxObject *builtin_function_##x ( RexxActivation * context, RexxObject **arguments, size_t argcount, size_t named_argcount, RexxExpressionStack *stack )

Definition at line 112 of file BuiltinFunctions.hpp.

◆ check_args

#define check_args (   x)    expandArgs(arguments, argcount, x##_MIN, x##_MAX, CHAR_##x)

Definition at line 92 of file BuiltinFunctions.hpp.

◆ fix_args

#define fix_args (   x)    expandArgs(arguments, argcount, x##_MIN, x##_MAX, CHAR_##x)

Definition at line 91 of file BuiltinFunctions.hpp.

◆ get_arg

#define get_arg (   x,
 
)    arguments[x##_##n - 1]

Definition at line 94 of file BuiltinFunctions.hpp.

◆ nonnegative_integer

#define nonnegative_integer (   n,
  f,
 
)    if (n < 0) reportException(Error_Incorrect_call_nonnegative, CHAR_##f, OREF_positional, p, n)

Definition at line 115 of file BuiltinFunctions.hpp.

◆ optional_argument

#define optional_argument (   x,
 
)    ((argcount >= x##_##n) ? arguments[x##_##n -1] : OREF_NULL )

Definition at line 108 of file BuiltinFunctions.hpp.

◆ optional_big_integer

#define optional_big_integer (   x,
 
)    optionalBigIntegerArg(x##_##n, arguments, argcount, CHAR_##x)

Definition at line 106 of file BuiltinFunctions.hpp.

◆ optional_integer

#define optional_integer (   x,
 
)    optionalIntegerArg(x##_##n, arguments, argcount, CHAR_##x)

Definition at line 103 of file BuiltinFunctions.hpp.

◆ optional_string

#define optional_string (   x,
 
)    optionalStringArg(x##_##n, arguments, argcount, CHAR_##x)

Definition at line 98 of file BuiltinFunctions.hpp.

◆ positive_integer

#define positive_integer (   n,
  f,
 
)    if (n <= 0) reportException(Error_Incorrect_call_positive, CHAR_##f, OREF_positional, p, n)

Definition at line 114 of file BuiltinFunctions.hpp.

◆ required_big_integer

#define required_big_integer (   x,
 
)    requiredBigIntegerArg(x##_##n, arguments, argcount, CHAR_##x)

Definition at line 105 of file BuiltinFunctions.hpp.

◆ required_integer

#define required_integer (   x,
 
)    requiredIntegerArg(x##_##n, arguments, argcount, CHAR_##x)

Definition at line 102 of file BuiltinFunctions.hpp.

◆ required_string

#define required_string (   x,
 
)    requiredStringArg(x##_##n, arguments, argcount, CHAR_##x)

Definition at line 97 of file BuiltinFunctions.hpp.

◆ required_text

#define required_text (   x,
 
)    requiredTextArg(x##_##n, arguments, argcount, CHAR_##x)

Definition at line 100 of file BuiltinFunctions.hpp.

◆ set_arg

#define set_arg (   x,
  n1,
  n2 
)    arguments[x##_##n1 - 1] = arguments[x##_##n2 - 1]

Definition at line 95 of file BuiltinFunctions.hpp.

Function Documentation

◆ expandArgs()

void expandArgs ( RexxObject **  arguments,
size_t  argcount,
size_t  min,
size_t  max,
const char *  function 
)

Verify that a function has received all of its required arguments, and did not receive extras.

Parameters
argcountThe number of arguments passed to the function.
minThe minimum required arguments
maxThe maximum required arguments
functionThe function name
Returns
Nothing.

Definition at line 76 of file BuiltinFunctions.cpp.

References Error_Incorrect_call_maxarg, Error_Incorrect_call_minarg, Error_Incorrect_call_noarg, min, OREF_NULL, and reportException().

◆ optionalBigIntegerArg()

RexxObject* optionalBigIntegerArg ( size_t  position,
RexxObject **  arguments,
size_t  argcount,
const char *  function 
)

Process an optional argument and ensure it is a valid integer that can be expressed as a 64-bit value.

Parameters
positionThe argument position for any error messages (1 to argcount).
argcountThe number of arguments passed to the function.
functionThe function name
Returns
An object that can be converted to a 64-bit value for pass-on to a native function.

Definition at line 309 of file BuiltinFunctions.cpp.

References Error_Incorrect_call_whole, Numerics::int64Object(), OREF_NULL, and reportException().

◆ optionalIntegerArg()

RexxInteger* optionalIntegerArg ( size_t  position,
RexxObject **  arguments,
size_t  argcount,
const char *  function 
)

Process an optional argument and ensure it is a valid integer

Parameters
positionThe argument position for any error messages (1 to argcount).
argcountThe number of arguments passed to the function.
functionThe function name
Returns
An object that can be converted to an integer argument.

Definition at line 242 of file BuiltinFunctions.cpp.

References Numerics::ARGUMENT_DIGITS, Error_Incorrect_call_whole, isOfClass, new_integer(), OREF_NULL, reportException(), and RexxObject::requestNumber().

◆ optionalStringArg()

RexxString* optionalStringArg ( size_t  position,
RexxObject **  arguments,
size_t  argcount,
const char *  function 
)

Process an optional argument and potentially convert it into a string argument

Parameters
positionThe argument position for any error messages (1 to argcount).
argcountThe number of arguments passed to the function.
functionThe function name
Returns
The string representation of the argument.

Definition at line 156 of file BuiltinFunctions.cpp.

References isOfClass, OREF_NULL, and RexxObject::requestString().

◆ requiredBigIntegerArg()

RexxObject* requiredBigIntegerArg ( size_t  position,
RexxObject **  arguments,
size_t  argcount,
const char *  function 
)

Process a required argument and ensure it is a valid integer that can be expressed as a 64-bit value.

Parameters
positionThe argument position for any error messages (1 to argcount).
argcountThe number of arguments passed to the function.
functionThe function name
Returns
An object that can be converted to a 64-bit value for pass-on to a native function.

Definition at line 278 of file BuiltinFunctions.cpp.

References Error_Incorrect_call_noarg, Error_Incorrect_call_whole, Numerics::int64Object(), OREF_NULL, and reportException().

◆ requiredIntegerArg()

RexxInteger* requiredIntegerArg ( size_t  position,
RexxObject **  arguments,
size_t  argcount,
const char *  function 
)

Process a required argument and ensure it is a valid integer

Parameters
positionThe argument position for any error messages (1 to argcount).
argcountThe number of arguments passed to the function.
functionThe function name
Returns
An object that can be converted to an integer argument.

Definition at line 210 of file BuiltinFunctions.cpp.

References Numerics::ARGUMENT_DIGITS, Error_Incorrect_call_noarg, Error_Incorrect_call_whole, isOfClass, new_integer(), OREF_NULL, reportException(), and RexxObject::requestNumber().

◆ requiredStringArg()

RexxString* requiredStringArg ( size_t  position,
RexxObject **  arguments,
size_t  argcount,
const char *  function 
)

Process a required argument and potentially convert it into a string argument

Parameters
positionThe argument position for any error messages (1 to argcount).
argcountThe number of arguments passed to the function.
functionThe function name
Returns
The string representation of the argument.

Definition at line 129 of file BuiltinFunctions.cpp.

References Error_Incorrect_call_noarg, isOfClass, OREF_NULL, reportException(), and RexxObject::requestString().