Bond 0.9
Bond Standard Library API Documentation
Loading...
Searching...
No Matches
Bond Namespace Reference

Namespaces

namespace  IO

Classes

struct  Collector
 An opaque set of collected allocations that are freed together. More...
struct  InputStream
 An abstract interface for performing both unformatted and formatted input operations. More...
struct  OutputStream
 An abstract interface for performing both unformatted and formatted output operations. More...

Functions

InputStream * StdIn ()
 Returns the virtual machine's standard input stream.
OutputStream * StdOut ()
 Returns the virtual machine's standard output stream.
OutputStream * StdErr ()
 Returns the virtual machine's standard error stream.
InputStream * CreateInputStream (const char *fileName)
 Opens a file for reading. The stream must be freed manually.
InputStream * CreateInputStreamCollected (const char *fileName)
 Opens a file for reading. The stream is closed and freed automatically when the calling function returns.
InputStream * CreateInputStreamWithCollector (Collector *collector, const char *fileName)
 Opens a file for reading. The stream is closed and freed automatically along with a given Collector.
void FreeInputStream (InputStream *stream)
 Closes and frees a stream returned by CreateInputStream.
OutputStream * CreateOutputStream (const char *fileName, bool append)
 Opens a file for writing. The stream must be freed manually.
OutputStream * CreateOutputStreamCollected (const char *fileName, bool append)
 Opens a file for writing. The stream is flushed, closed and freed automatically when the calling function returns.
OutputStream * CreateOutputStreamWithCollector (Collector *collector, const char *fileName, bool append)
 Opens a file for writing. The stream is flushed, closed and freed automatically along with a given Collector.
void FreeOutputStream (OutputStream *stream)
 Flushes, closes and frees a stream returned by CreateOutputStream.
double SinD (double x)
 Returns the sine of an angle in radians.
float SinF (float x)
 Returns the sine of an angle in radians.
double CosD (double x)
 Returns the cosine of an angle in radians.
float CosF (float x)
 Returns the cosine of an angle in radians.
double TanD (double x)
 Returns the tangent of an angle in radians.
float TanF (float x)
 Returns the tangent of an angle in radians.
double AsinD (double x)
 Returns the arcsine in radians of a value.
float AsinF (float x)
 Returns the arcsine in radians of a value.
double AcosD (double x)
 Returns the arccosine in radians of a value.
float AcosF (float x)
 Returns the arccosine in radians of a value.
double AtanD (double x)
 Returns the arctangent in radians of a value, in the range [-pi/2, +pi/2].
float AtanF (float x)
 Returns the arctangent in radians of a value, in the range [-pi/2, +pi/2].
double Atan2D (double y, double x)
 Returns the arctangent in radians of y/x, in the range [-pi, +pi], using the signs of both arguments to determine the quadrant.
float Atan2F (float y, float x)
 Returns the arctangent in radians of y/x, in the range [-pi, +pi], using the signs of both arguments to determine the quadrant.
double SinhD (double x)
 Returns the hyperbolic sine of a hyperbolic angle.
float SinhF (float x)
 Returns the hyperbolic sine of a hyperbolic angle.
double CoshD (double x)
 Returns the hyperbolic cosine of a hyperbolic angle.
float CoshF (float x)
 Returns the hyperbolic cosine of a hyperbolic angle.
double TanhD (double x)
 Returns the hyperbolic tangent of a hyperbolic angle.
float TanhF (float x)
 Returns the hyperbolic tangent of a hyperbolic angle.
double AsinhD (double x)
 Returns the inverse hyperbolic sine of a value.
float AsinhF (float x)
 Returns the inverse hyperbolic sine of a value.
double AcoshD (double x)
 Returns the inverse hyperbolic cosine of a value.
float AcoshF (float x)
 Returns the inverse hyperbolic cosine of a value.
double AtanhD (double x)
 Returns the inverse hyperbolic tangent of a value.
float AtanhF (float x)
 Returns the inverse hyperbolic tangent of a value.
double ExpD (double x)
 Returns e raised to an exponent.
float ExpF (float x)
 Returns e raised to an exponent.
double Exp2D (double x)
 Returns 2 raised to an exponent.
float Exp2F (float x)
 Returns 2 raised to an exponent.
double LogD (double x)
 Returns the natural logarithm of a value.
float LogF (float x)
 Returns the natural logarithm of a value.
double Log2D (double x)
 Returns the base-2 logarithm of a value.
float Log2F (float x)
 Returns the base-2 logarithm of a value.
double Log10D (double x)
 Returns the base-10 logarithm of a value.
float Log10F (float x)
 Returns the base-10 logarithm of a value.
double PowD (double base, double exponent)
 Returns a base value raised to an exponent.
float PowF (float base, float exponent)
 Returns a base value raised to an exponent.
double SqrtD (double x)
 Returns the square root of a value.
float SqrtF (float x)
 Returns the square root of a value.
double CbrtD (double x)
 Returns the cube root of a value.
float CbrtF (float x)
 Returns the cube root of a value.
double HypotD (double x, double y)
 Returns the hypotenuse of a right-angled triangle with sides of the given lengths.
float HypotF (float x, float y)
 Returns the hypotenuse of a right-angled triangle with sides of the given lengths.
double CeilD (double x)
 Returns a value rounded upward.
float CeilF (float x)
 Returns a value rounded upward.
double FloorD (double x)
 Returns a value rounded downward.
float FloorF (float x)
 Returns a value rounded downward.
double TruncD (double x)
 Returns a value rounded toward zero.
float TruncF (float x)
 Returns a value rounded toward zero.
char AbsC (char x)
 Returns the absolute value of a signed 8-bit value. The result is unspecified for the most negative value, whose absolute value cannot be represented.
short AbsS (short x)
 Returns the absolute value of a signed 16-bit value. The result is unspecified for the most negative value, whose absolute value cannot be represented.
int AbsI (int x)
 Returns the absolute value of a signed 32-bit value. The result is unspecified for the most negative value, whose absolute value cannot be represented.
long AbsL (long x)
 Returns the absolute value of a signed 64-bit value. The result is unspecified for the most negative value, whose absolute value cannot be represented.
double AbsD (double x)
 Returns the absolute value of a value.
float AbsF (float x)
 Returns the absolute value of a value.
double LdexpD (double x, int exp)
 Returns a value multiplied by 2 raised to an exponent.
float LdexpF (float x, int exp)
 Returns a value multiplied by 2 raised to an exponent.
double FrexpD (double x, int *exp)
 Decomposes a value into a fraction and an integral power of two.
float FrexpF (float x, int *exp)
 Decomposes a value into a fraction and an integral power of two.
double ModfD (double x, double *ip)
 Decomposes a value into its integral and fractional parts.
float ModfF (float x, float *ip)
 Decomposes a value into its integral and fractional parts.
double FmodD (double x, double y)
 Returns the remainder of x/y, where the quotient is rounded toward zero. The result has the same sign as x.
float FmodF (float x, float y)
 Returns the remainder of x/y, where the quotient is rounded toward zero. The result has the same sign as x.
double CopySignD (double x, double y)
 Returns a value with the magnitude of one and the sign of another.
float CopySignF (float x, float y)
 Returns a value with the magnitude of one and the sign of another.
double NaND ()
 Returns a value representing Not-a-Number.
float NaNF ()
 Returns a value representing Not-a-Number.
bool IsNaND (double x)
 Returns whether a value is Not-a-Number.
bool IsNaNF (float x)
 Returns whether a value is Not-a-Number.
bool IsInfD (double x)
 Returns whether a value is positive or negative infinity.
bool IsInfF (float x)
 Returns whether a value is positive or negative infinity.
bool IsFiniteD (double x)
 Returns whether a value is neither infinite nor Not-a-Number.
bool IsFiniteF (float x)
 Returns whether a value is neither infinite nor Not-a-Number.
bool SignBitD (double x)
 Returns whether the sign bit of a value is set.
bool SignBitF (float x)
 Returns whether the sign bit of a value is set.
double RoundD (double x)
 Returns a value rounded to the nearest integer, with halfway cases rounded away from zero.
float RoundF (float x)
 Returns a value rounded to the nearest integer, with halfway cases rounded away from zero.
double RintD (double x)
 Returns a value rounded to the nearest integer using the current rounding mode.
float RintF (float x)
 Returns a value rounded to the nearest integer using the current rounding mode.
double NearbyintD (double x)
 Returns a value rounded to the nearest integer using the current rounding mode without raising the inexact exception.
float NearbyintF (float x)
 Returns a value rounded to the nearest integer using the current rounding mode without raising the inexact exception.
double RemainderD (double x, double y)
 Returns the remainder of x/y, where the quotient is rounded to the nearest integer, with halfway cases rounded to even.
float RemainderF (float x, float y)
 Returns the remainder of x/y, where the quotient is rounded to the nearest integer, with halfway cases rounded to even.
long LroundD (double x)
 Returns a value rounded to the nearest long integer, with halfway cases rounded away from zero.
long LroundF (float x)
 Returns a value rounded to the nearest long integer, with halfway cases rounded away from zero.
double Log1pD (double x)
 Returns the natural logarithm of one plus a value.
float Log1pF (float x)
 Returns the natural logarithm of one plus a value.
double Expm1D (double x)
 Returns e raised to an exponent minus one.
float Expm1F (float x)
 Returns e raised to an exponent minus one.
double ErfD (double x)
 Returns the error function of a value.
float ErfF (float x)
 Returns the error function of a value.
double ErfcD (double x)
 Returns the complementary error function of a value.
float ErfcF (float x)
 Returns the complementary error function of a value.
double TgammaD (double x)
 Returns the gamma function of a value.
float TgammaF (float x)
 Returns the gamma function of a value.
double LgammaD (double x)
 Returns the natural logarithm of the absolute value of the gamma function of a value.
float LgammaF (float x)
 Returns the natural logarithm of the absolute value of the gamma function of a value.
double FmaD (double x, double y, double z)
 Returns x * y + z computed with a single rounding.
float FmaF (float x, float y, float z)
 Returns x * y + z computed with a single rounding.
double NextafterD (double x, double y)
 Returns the next representable value after x in the direction of y.
float NextafterF (float x, float y)
 Returns the next representable value after x in the direction of y.
double ScalbnD (double x, int n)
 Returns a value multiplied by 2 raised to an integral exponent.
float ScalbnF (float x, int n)
 Returns a value multiplied by 2 raised to an integral exponent.
int IlogbD (double x)
 Returns the unbiased exponent of a value as an integer.
int IlogbF (float x)
 Returns the unbiased exponent of a value as an integer.
double LogbD (double x)
 Returns the unbiased exponent of a value as a floating-point number.
float LogbF (float x)
 Returns the unbiased exponent of a value as a floating-point number.
double RemquoD (double x, double y, int *quo)
 Returns the remainder of x/y, where the quotient is rounded to the nearest integer, with halfway cases rounded to even, and stores the sign and low bits of the quotient.
float RemquoF (float x, float y, int *quo)
 Returns the remainder of x/y, where the quotient is rounded to the nearest integer, with halfway cases rounded to even, and stores the sign and low bits of the quotient.
double InfD ()
 Returns a representation of positive infinity.
float InfF ()
 Returns a representation of positive infinity.
char MinC (char x, char y)
 Returns the smaller of two values.
uchar MinUC (uchar x, uchar y)
 Returns the smaller of two values.
short MinS (short x, short y)
 Returns the smaller of two values.
ushort MinUS (ushort x, ushort y)
 Returns the smaller of two values.
int MinI (int x, int y)
 Returns the smaller of two values.
uint MinUI (uint x, uint y)
 Returns the smaller of two values.
long MinL (long x, long y)
 Returns the smaller of two values.
ulong MinUL (ulong x, ulong y)
 Returns the smaller of two values.
double MinD (double x, double y)
 Returns the smaller of two values. If either value is Not-a-Number, the other value is returned.
float MinF (float x, float y)
 Returns the smaller of two values. If either value is Not-a-Number, the other value is returned.
char MaxC (char x, char y)
 Returns the larger of two values.
uchar MaxUC (uchar x, uchar y)
 Returns the larger of two values.
short MaxS (short x, short y)
 Returns the larger of two values.
ushort MaxUS (ushort x, ushort y)
 Returns the larger of two values.
int MaxI (int x, int y)
 Returns the larger of two values.
uint MaxUI (uint x, uint y)
 Returns the larger of two values.
long MaxL (long x, long y)
 Returns the larger of two values.
ulong MaxUL (ulong x, ulong y)
 Returns the larger of two values.
double MaxD (double x, double y)
 Returns the larger of two values. If either value is Not-a-Number, the other value is returned.
float MaxF (float x, float y)
 Returns the larger of two values. If either value is Not-a-Number, the other value is returned.
char ClampC (char value, char low, char high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
uchar ClampUC (uchar value, uchar low, uchar high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
short ClampS (short value, short low, short high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
ushort ClampUS (ushort value, ushort low, ushort high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
int ClampI (int value, int low, int high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
uint ClampUI (uint value, uint low, uint high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
long ClampL (long value, long low, long high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
ulong ClampUL (ulong value, ulong low, ulong high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
double ClampD (double value, double low, double high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
float ClampF (float value, float low, float high)
 Returns a value limited to the range [low, high]. The result is undefined if low is greater than high.
Collector * GetCollector ()
 Returns the Collector of the calling function.
void * Allocate (ulong size)
 Allocates a block of memory that must be freed manually.
void * AllocateCollected (ulong size)
 Allocates a block of memory that is freed automatically when the calling function returns.
void * AllocateWithCollector (Collector *collector, ulong size)
 Allocates a block of memory that is freed automatically along with a given Collector.
void * AllocateAligned (ulong size, uint alignment)
 Allocates an aligned block of memory that must be freed manually.
void * AllocateAlignedCollected (ulong size, uint alignment)
 Allocates an aligned block of memory that is freed automatically when the calling function returns.
void * AllocateAlignedWithCollector (Collector *collector, ulong size, uint alignment)
 Allocates an aligned block of memory that is freed automatically along with a given Collector.
void Free (void *ptr)
 Frees a block of memory allocated with Allocate.
void FreeAligned (void *ptr)
 Frees a block of memory allocated with AllocateAligned.
void Memcpy (void *dest, void *src, ulong size)
 Copies bytes from one block of memory to another. The blocks must not overlap.
uint Strlen (const char *str)
 Returns the length of a string in bytes, not in characters.
int Strcmp (const char *str1, const char *str2)
 Compares two strings byte by byte. For UTF-8 strings, this orders them by code point. The order is stable, but it is not a locale's collation order.
uint Utf8Length (const char *str)
 Returns the number of code points in a UTF-8 string. Each invalid byte sequence counts as one, as if it were replaced with U+FFFD.
bool Utf8IsValid (const char *str)
 Returns whether a string is valid UTF-8. Overlong encodings, UTF-16 surrogates and values beyond U+10FFFF are invalid.
uint Utf8Decode (const char *str, uint *codePoint)
 Decodes the UTF-8 encoded code point at the start of a string.
uint Utf8Encode (uint codePoint, char *buffer)
 Encodes a code point in UTF-8.
bool TryParseInt (const char *str, int *result)
 Parses a base-10 integer from the start of a string as an int.
bool TryParseLong (const char *str, long *result)
 Parses a base-10 integer from the start of a string as a long.
bool TryParseFloat (const char *str, float *result)
 Parses a floating-point number from the start of a string as a float.
bool TryParseDouble (const char *str, double *result)
 Parses a floating-point number from the start of a string as a double.
bool IsAlnum (int c)
 Returns whether a character is an ASCII alphanumeric character (i.e. a decimal digit or an upper or lower case letter).
bool IsAlpha (int c)
 Returns whether a character is an ASCII alphabetic character (i.e. an upper or lower case letter).
bool IsBlank (int c)
 Returns whether a character is an ASCII blank character (i.e. a space or a horizontal tab).
bool IsCntrl (int c)
 Returns whether a character is an ASCII control character (i.e. 0 through 31 or 127).
bool IsDigit (int c)
 Returns whether a character is an ASCII decimal digit.
bool IsGraph (int c)
 Returns whether a character is an ASCII character with a graphical representation (i.e. it is printable and is not a space).
bool IsLower (int c)
 Returns whether a character is an ASCII lower case letter.
bool IsPrint (int c)
 Returns whether a character is a printable ASCII character (i.e. a graphical character or a space).
bool IsPunct (int c)
 Returns whether a character is an ASCII punctuation character (i.e. a graphical character that is not alphanumeric).
bool IsSpace (int c)
 Returns whether a character is an ASCII whitespace character (i.e. a space, horizontal tab, newline, vertical tab, form feed or carriage return).
bool IsUpper (int c)
 Returns whether a character is an ASCII upper case letter.
bool IsXDigit (int c)
 Returns whether a character is an ASCII hexadecimal digit (i.e. the digits 0 through 9 and upper and lower case letters A through F).
int ToLower (int c)
 Returns an ASCII upper case letter converted to lower case. If the given character is not an ASCII upper case letter, it is returned unchanged.
int ToUpper (int c)
 Returns an ASCII lower case letter converted to upper case. If the given character is not an ASCII lower case letter, it is returned unchanged.

Variables

const double PI_D = 3.14159265358979323846
 The value of pi as a double.
const float PI_F = cast<float>(PI_D)
 The value of pi as a float.
const double HALF_PI_D = PI_D / 2.0
 The value of pi/2 as a double.
const float HALF_PI_F = cast<float>(HALF_PI_D)
 The value of pi/2 as a float.
const double TWO_PI_D = PI_D * 2.0
 The value of 2pi as a double.
const float TWO_PI_F = cast<float>(TWO_PI_D)
 The value of 2pi as a float.
const double E_D = 2.71828182845904523536
 The value of e as a double.
const float E_F = cast<float>(E_D)
 The value of e as a float.
const double LN2_D = 0.69314718055994530942
 The natural logarithm of 2 as a double.
const float LN2_F = cast<float>(LN2_D)
 The natural logarithm of 2 as a float.
const double LN10_D = 2.30258509299404568402
 The natural logarithm of 10 as a double.
const float LN10_F = cast<float>(LN10_D)
 The natural logarithm of 10 as a float.
const double LOG2E_D = 1.44269504088896340736
 The base-2 logarithm of e as a double.
const float LOG2E_F = cast<float>(LOG2E_D)
 The base-2 logarithm of e as a float.
const double LOG10E_D = 0.43429448190325182765
 The base-10 logarithm of e as a double.
const float LOG10E_F = cast<float>(LOG10E_D)
 The base-10 logarithm of e as a float.
const double SQRT2_D = 1.41421356237309504880
 The square root of 2 as a double.
const float SQRT2_F = cast<float>(SQRT2_D)
 The square root of 2 as a float.
const double SQRT1_2_D = 0.70710678118654752440
 The square root of 1/2 as a double.
const float SQRT1_2_F = cast<float>(SQRT1_2_D)
 The square root of 1/2 as a float.