TinyMUSH 3.3
TinyMUSH Server
|
Math and logic functions. More...
#include "config.h"
#include "constants.h"
#include "typedefs.h"
#include "macros.h"
#include "externs.h"
#include "prototypes.h"
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
Functions | |
unsigned int | fp_check_weird (char *buff, char **bufc, long double result) |
Fix weird math results. More... | |
void | fval (char *buff, char **bufc, long double result, int precision) |
Copy the floating point value into a buffer and make it presentable. More... | |
void | fun_pi (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Return the PI constant. More... | |
void | fun_e (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Return the E constant. More... | |
void | fun_sign (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns -1, 0, or 1 depending on whether its argument is negative, zero, or positive (respectively). More... | |
void | fun_abs (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the absolute value of its argument. More... | |
void | fun_floor (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the integer quotient from dividing <number1> by <number2>, rounded down (towards zero if positive, away from zero if negative). More... | |
void | fun_ceil (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the smallest integer greater than or equal to <number>. More... | |
void | fun_round (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Rounds <number> to <places> decimal places. More... | |
void | fun_trunc (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the value of <number> after truncating off any fractional value. More... | |
void | fun_inc (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns <number>, incremented by 1 (the <number>, plus 1). More... | |
void | fun_dec (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns <number>, decremented by 1 (the <number>, minus 1). More... | |
void | fun_sqrt (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the square root of <number>. More... | |
void | fun_exp (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the result of raising the numeric constant e to <power>. More... | |
void | fun_ln (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
If only given one argument, this function returns a list of numbers from 0 to <number>-1. <number> must be at least 1. More... | |
void | handle_trig (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Handle trigonometrical functions (sin, cos, tan, etc...) More... | |
int | fromBaseX (char ch, int base) |
Convert a character to it's decimal value. More... | |
char | toBaseX (int i, int base) |
Convert decival value to it's base X character representation. More... | |
void | fun_baseconv (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Convert to various bases. More... | |
void | fun_gt (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Takes two numbers, and returns 1 if and only if <number1> is greater than <number2>, and 0 otherwise. More... | |
void | fun_gte (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Takes two numbers, and returns 1 if and only if <number1> is greater than or equal to <number2>, and 0 otherwise. More... | |
void | fun_lt (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Takes two numbers, and returns 1 if and only if <number1> is less than <number2>, and 0 otherwise. More... | |
void | fun_lte (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Takes two numbers, and returns 1 if and only if <number1> is less than or equal to <number2>, and 0 otherwise. More... | |
void | fun_eq (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Takes two numbers, and returns 1 if they are equal and 0 if they are not. More... | |
void | fun_neq (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Takes two numbers, and returns 1 if they are not equal and 0 if they are equal. More... | |
void | fun_ncomp (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
This function returns 0 if the two numbers are equal, 1 if the first number is greater than the second number, and -1 if the first number is less than the second number. More... | |
void | fun_sub (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the result of subtracting <number2> from <number1>. More... | |
void | fun_div (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the integer quotient from dividing <number1> by <number2>, rounded towards zero. More... | |
void | fun_floordiv (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the integer quotient from dividing <number1> by <number2>, rounded down (towards zero if positive, away from zero if negative). More... | |
void | fun_fdiv (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the floating point quotient from dividing <number1> by <number2>. More... | |
void | fun_modulo (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the smallest integer with the same sign as <integer2> such that the difference between <integer1> and the result is divisible by <integer2>. More... | |
void | fun_remainder (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the smallest integer with the same sign as <integer1> such that the difference between <integer1> and the result is divisible by <integer2>. More... | |
void | fun_power (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the result of raising <number> to the <power>'th power. More... | |
void | fun_log (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs, char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the result of raising <number> to the <power>'th power. More... | |
void | fun_shl (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
This function returns the result of leftwards bit-shifting <number> by <count> times. More... | |
void | fun_shr (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
This function returns the result of rightwards bit-shifting <number> by <count> times. More... | |
void | fun_band (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Intended for use on a bitfield, this function performs a binary AND between two numbers. More... | |
void | fun_bor (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Intended for use on a bitfield, this function performs a binary OR between two numbers. It is most useful for "turning on" bits in a bitfield. More... | |
void | fun_bnand (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Intended for use on a bitfield, this function performs a binary AND between a number and the complement of another number. More... | |
void | fun_add (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs, char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the result of adding its arguments together. More... | |
void | fun_mul (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs, char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the result of multiplying its arguments together. More... | |
void | fun_max (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs, char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the largest number from among its arguments. More... | |
void | fun_min (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs, char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the smallest number from among its arguments. More... | |
void | fun_bound (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs, char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Force a number to conform to specified bounds. More... | |
void | fun_dist2d (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the distance between the Cartesian points in two dimensions. More... | |
void | fun_dist3d (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Returns the distance between the Cartesian points in three dimensions. More... | |
void | fun_ladd (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
Adds a list of numbers together. More... | |
void | fun_lmax (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
Obtains the largest number out of a list of numbers (i.e., the maximum). More... | |
void | fun_lmin (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
Obtains the smallest number out of a list of numbers (i.e., the minimum). More... | |
void | handle_vector (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
Handle Operations on a single vector: VMAG, VUNIT (VDIM is implemented by fun_words) More... | |
void | handle_vectors (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
Handle operations on a pair of vectors: VADD, VSUB, VMUL, VDOT, VOR, VAND and VXOR. More... | |
void | fun_not (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
If the input is a non-zero number, returns 0. If it is 0 or the equivalent (such as a non-numeric string), returns 1. More... | |
void | fun_notbool (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Takes a boolean value, and returns its inverse. More... | |
void | fun_t (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) |
Takes a boolean value, and returns 0 if it is false, and 1 if true. More... | |
bool | cvtfun (int flag, char *str) |
Convert differents values to Boolean. More... | |
void | handle_logic (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
Handle multi-argument boolean funcs, various combinations of [L,C][AND,OR,XOR][BOOL]. More... | |
void | handle_listbool (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
Handle boolean values for an entire list. More... | |
Math and logic functions.
bool cvtfun | ( | int | flag, |
char * | str | ||
) |
Convert differents values to Boolean.
flag | Calling function flags |
str | String to parse |
unsigned int fp_check_weird | ( | char * | buff, |
char ** | bufc, | ||
long double | result | ||
) |
Fix weird math results.
buff | Output buffer |
bufc | Output buffer tracker |
result | Result to check |
these bits are all set. can't be zero exponent, but could still be max (weird) exponent.
none of these bits are set. can't be max exponent, but could still be zero exponent.
some bits were set but not others. can't be either zero exponent or max exponent.
int fromBaseX | ( | char | ch, |
int | base | ||
) |
Convert a character to it's decimal value.
ch | Character |
base | Base to convert from |
void fun_abs | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the absolute value of its argument.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_add | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int | nfargs, | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the result of adding its arguments together.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_band | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Intended for use on a bitfield, this function performs a binary AND between two numbers.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_baseconv | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Convert to various bases.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
Parse the number to convert
If we have a leading hyphen, and we're in base 63/64, always treat it as a minus sign. PennMUSH consistency.
Handle the case of 0 and less than base case.
Build up the number backwards, then reverse it.
void fun_bnand | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Intended for use on a bitfield, this function performs a binary AND between a number and the complement of another number.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_bor | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Intended for use on a bitfield, this function performs a binary OR between two numbers. It is most useful for "turning on" bits in a bitfield.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_bound | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int | nfargs, | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Force a number to conform to specified bounds.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Not used |
ncargs | Not used |
just the number; no bounds enforced
if empty, don't check the minimum
if empty, don't check the maximum
void fun_ceil | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the smallest integer greater than or equal to <number>.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_dec | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns <number>, decremented by 1 (the <number>, minus 1).
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_dist2d | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the distance between the Cartesian points in two dimensions.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_dist3d | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the distance between the Cartesian points in three dimensions.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_div | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the integer quotient from dividing <number1> by <number2>, rounded towards zero.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
The C '/' operator is only fully specified for non-negative operands, so we try not to give it negative operands here
void fun_e | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Return the E constant.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_eq | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Takes two numbers, and returns 1 if they are equal and 0 if they are not.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_exp | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the result of raising the numeric constant e to <power>.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_fdiv | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the floating point quotient from dividing <number1> by <number2>.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_floor | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the integer quotient from dividing <number1> by <number2>, rounded down (towards zero if positive, away from zero if negative).
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_floordiv | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the integer quotient from dividing <number1> by <number2>, rounded down (towards zero if positive, away from zero if negative).
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
The C '/' operator is only fully specified for non-negative operands, so we try not to give it negative operands here
void fun_gt | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Takes two numbers, and returns 1 if and only if <number1> is greater than <number2>, and 0 otherwise.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_gte | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Takes two numbers, and returns 1 if and only if <number1> is greater than or equal to <number2>, and 0 otherwise.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_inc | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns <number>, incremented by 1 (the <number>, plus 1).
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_ladd | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Adds a list of numbers together.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_lmax | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Obtains the largest number out of a list of numbers (i.e., the maximum).
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_lmin | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Obtains the smallest number out of a list of numbers (i.e., the minimum).
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_ln | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
If only given one argument, this function returns a list of numbers from 0 to <number>-1. <number> must be at least 1.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_log | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int | nfargs, | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the result of raising <number> to the <power>'th power.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_lt | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Takes two numbers, and returns 1 if and only if <number1> is less than <number2>, and 0 otherwise.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_lte | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Takes two numbers, and returns 1 if and only if <number1> is less than or equal to <number2>, and 0 otherwise.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_max | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int | nfargs, | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the largest number from among its arguments.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Not used |
ncargs | Not used |
void fun_min | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int | nfargs, | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the smallest number from among its arguments.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Not used |
ncargs | Not used |
void fun_modulo | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the smallest integer with the same sign as <integer2> such that the difference between <integer1> and the result is divisible by <integer2>.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
The C '' operator is only fully specified for non-negative operands, so we try not to give it negative operands here
void fun_mul | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int | nfargs, | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the result of multiplying its arguments together.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Not used |
ncargs | Not used |
void fun_ncomp | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
This function returns 0 if the two numbers are equal, 1 if the first number is greater than the second number, and -1 if the first number is less than the second number.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_neq | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Takes two numbers, and returns 1 if they are not equal and 0 if they are equal.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_not | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
If the input is a non-zero number, returns 0. If it is 0 or the equivalent (such as a non-numeric string), returns 1.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_notbool | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Takes a boolean value, and returns its inverse.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_pi | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Return the PI constant.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_power | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the result of raising <number> to the <power>'th power.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_remainder | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the smallest integer with the same sign as <integer1> such that the difference between <integer1> and the result is divisible by <integer2>.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
The C '' operator is only fully specified for non-negative operands, so we try not to give it negative operands here
void fun_round | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Rounds <number> to <places> decimal places.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_shl | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
This function returns the result of leftwards bit-shifting <number> by <count> times.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_shr | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
This function returns the result of rightwards bit-shifting <number> by <count> times.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_sign | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns -1, 0, or 1 depending on whether its argument is negative, zero, or positive (respectively).
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_sqrt | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the square root of <number>.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_sub | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the result of subtracting <number2> from <number1>.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_t | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Takes a boolean value, and returns 0 if it is false, and 1 if true.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_trunc | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns the value of <number> after truncating off any fractional value.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fval | ( | char * | buff, |
char ** | bufc, | ||
long double | result, | ||
int | precision | ||
) |
Copy the floating point value into a buffer and make it presentable.
buff | Output buffer |
bufc | Output buffer tracker |
result | Result to present |
precision | Precision |
If integer, we're done.
Remove useless zeroes
take care of dangling '.'
Handle bogus result of "-0" from sprintf. Yay, cclib.
void handle_listbool | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Handle boolean values for an entire list.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void handle_logic | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Handle multi-argument boolean funcs, various combinations of [L,C][AND,OR,XOR][BOOL].
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
most logic operations on an empty string should be false
the arguments come in a pre-evaluated list
separate arguments, but not enough of them
separate, unevaluated arguments
separate, pre-evaluated arguments
void handle_trig | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Handle trigonometrical functions (sin, cos, tan, etc...)
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void handle_vector | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Handle Operations on a single vector: VMAG, VUNIT (VDIM is implemented by fun_words)
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
split the list up, or return if the list is empty
calculate the magnitude
if we're just calculating the magnitude, return it
void handle_vectors | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Handle operations on a pair of vectors: VADD, VSUB, VMUL, VDOT, VOR, VAND and VXOR.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
dot product returns a scalar, so no output delim
split the list up, or return if the list is empty
if n or m is 1, this is scalar multiplication. otherwise, multiply elementwise.
vector elementwise product.
Note this is a departure from TinyMUX, but an imitation of the PennMUSH behavior: the documentation in Penn claims it's a dot product, but the actual behavior isn't. We implement dot product separately!
dot product: (a,b,c) . (d,e,f) = ad + be + cf
no cross product implementation yet: it would be (a,b,c) x (d,e,f) = (bf - ce, cd - af, ae - bd)
If we reached this, we're in trouble.
char toBaseX | ( | int | i, |
int | base | ||
) |
Convert decival value to it's base X character representation.
i | Decimal value |
base | Base to convert to |