TinyMUSH 3.3
TinyMUSH Server
Loading...
Searching...
No Matches
Functions
funmath.c File Reference

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>
Include dependency graph for funmath.c:

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...
 

Detailed Description

Math and logic functions.

Author
TinyMUSH development team (https://github.com/TinyMUSH)
Version
3.3
Date
2021-01-04

Function Documentation

◆ cvtfun()

bool cvtfun ( int  flag,
char *  str 
)

Convert differents values to Boolean.

Parameters
flagCalling function flags
strString to parse
Returns
true
false

◆ fp_check_weird()

unsigned int fp_check_weird ( char *  buff,
char **  bufc,
long double  result 
)

Fix weird math results.

Parameters
buffOutput buffer
bufcOutput buffer tracker
resultResult to check
Returns
unsigned int Result of the 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.

◆ fromBaseX()

int fromBaseX ( char  ch,
int  base 
)

Convert a character to it's decimal value.

Parameters
chCharacter
baseBase to convert from
Returns
int Value in decimal base.

◆ fun_abs()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_add()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_band()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_baseconv()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot 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.

◆ fun_bnand()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_bor()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_bound()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNumber of function's arguments
cargsNot used
ncargsNot used

just the number; no bounds enforced

if empty, don't check the minimum

if empty, don't check the maximum

◆ fun_ceil()

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>.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_dec()

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).

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_dist2d()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_dist3d()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_div()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

The C '/' operator is only fully specified for non-negative operands, so we try not to give it negative operands here

◆ fun_e()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_eq()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_exp()

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>.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_fdiv()

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>.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_floor()

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).

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_floordiv()

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).

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

The C '/' operator is only fully specified for non-negative operands, so we try not to give it negative operands here

◆ fun_gt()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_gte()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_inc()

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).

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_ladd()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_lmax()

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).

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_lmin()

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).

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_ln()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_log()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_lt()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_lte()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_max()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNumber of function's arguments
cargsNot used
ncargsNot used

◆ fun_min()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNumber of function's arguments
cargsNot used
ncargsNot used

◆ fun_modulo()

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>.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

The C '' operator is only fully specified for non-negative operands, so we try not to give it negative operands here

◆ fun_mul()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNumber of function's arguments
cargsNot used
ncargsNot used

◆ fun_ncomp()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_neq()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_not()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_notbool()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_pi()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_power()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_remainder()

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>.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

The C '' operator is only fully specified for non-negative operands, so we try not to give it negative operands here

◆ fun_round()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_shl()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_shr()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_sign()

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).

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_sqrt()

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>.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_sub()

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>.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_t()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_trunc()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fval()

void fval ( char *  buff,
char **  bufc,
long double  result,
int  precision 
)

Copy the floating point value into a buffer and make it presentable.

Parameters
buffOutput buffer
bufcOutput buffer tracker
resultResult to present
precisionPrecision

If integer, we're done.

Remove useless zeroes

take care of dangling '.'

Handle bogus result of "-0" from sprintf. Yay, cclib.

◆ handle_listbool()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber of command's arguments

◆ handle_logic()

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].

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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

◆ handle_trig()

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...)

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ handle_vector()

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)

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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

◆ handle_vectors()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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.

◆ toBaseX()

char toBaseX ( int  i,
int  base 
)

Convert decival value to it's base X character representation.

Parameters
iDecimal value
baseBase to convert to
Returns
char Character