Put math module docstrings behind KRK_DOC macro
This commit is contained in:
parent
b5c22f77c5
commit
6638d10def
@ -5,8 +5,7 @@
|
||||
#include <kuroko/vm.h>
|
||||
#include <kuroko/value.h>
|
||||
#include <kuroko/object.h>
|
||||
|
||||
#define S(c) (krk_copyString(c,sizeof(c)-1))
|
||||
#include <kuroko/util.h>
|
||||
|
||||
#define ONE_ARGUMENT(name) if (argc != 1) { \
|
||||
krk_runtimeError(vm.exceptions->argumentError, "%s() expects one argument", #name); \
|
||||
@ -155,92 +154,124 @@ KrkValue krk_module_onload_math(void) {
|
||||
KrkInstance * module = krk_newInstance(vm.baseClasses->moduleClass);
|
||||
krk_push(OBJECT_VAL(module));
|
||||
|
||||
krk_attachNamedObject(&module->fields, "__doc__",(KrkObj*)
|
||||
S("Provides access to floating-point mathematical functions from the system `libm`."));
|
||||
|
||||
bind(ceil)->doc = "Returns the smallest integer value not less than the input.\n"
|
||||
"@arguments x";
|
||||
bind(floor)->doc = "Returns the largest integer value not greater than the input.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(module, "@brief Provides access to floating-point mathematical functions from the system `libm`.");
|
||||
KRK_DOC(bind(ceil),
|
||||
"@brief Returns the smallest integer value not less than the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(floor),
|
||||
"@brief Returns the largest integer value not greater than the input.\n"
|
||||
"@arguments x");
|
||||
#ifdef _math_trunc
|
||||
bind(trunc)->doc = "Rounds the input towards zero to an integer.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(bind(trunc),
|
||||
"@brief Rounds the input towards zero to an integer.\n"
|
||||
"@arguments x");
|
||||
#endif
|
||||
bind(exp)->doc = "Returns the base-e exponentiation of the input.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(bind(exp),
|
||||
"@brief Returns the base-e exponentiation of the input.\n"
|
||||
"@arguments x");
|
||||
#ifdef _math_expm1
|
||||
bind(expm1)->doc = "Equivalent to `exp(x) - 1`.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(bind(expm1),
|
||||
"@brief Equivalent to `exp(x) - 1`.\n"
|
||||
"@arguments x");
|
||||
#endif
|
||||
bind(log2)->doc = "Calculates the base-2 logarithm of the input.\n"
|
||||
"@arguments x";
|
||||
bind(log10)->doc = "Calculates the base-10 logarithm of the input.\n"
|
||||
"@arguments x";
|
||||
bind(sqrt)->doc = "Calculates the square root of the input.\n"
|
||||
"@arguments x";
|
||||
bind(acos)->doc = "Calculates the arc-cosine of the radian input.\n"
|
||||
"@arguments x";
|
||||
bind(asin)->doc = "Calculates the arc-sine of the radian input.\n"
|
||||
"@arguments x";
|
||||
bind(atan)->doc = "Calculates the arc-tangent of the radian input.\n"
|
||||
"@arguments x";
|
||||
bind(cos)->doc = "Calculates the cosine of the radian input.\n"
|
||||
"@arguments x";
|
||||
bind(sin)->doc = "Calculates the sine of the radian input.\n"
|
||||
"@arguments x";
|
||||
bind(tan)->doc = "Calculates the tangent of the radian input.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(bind(log2),
|
||||
"@brief Calculates the base-2 logarithm of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(log10),
|
||||
"@brief Calculates the base-10 logarithm of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(sqrt),
|
||||
"@brief Calculates the square root of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(acos),
|
||||
"@brief Calculates the arc-cosine of the radian input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(asin),
|
||||
"@brief Calculates the arc-sine of the radian input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(atan),
|
||||
"@brief Calculates the arc-tangent of the radian input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(cos),
|
||||
"@brief Calculates the cosine of the radian input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(sin),
|
||||
"@brief Calculates the sine of the radian input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(tan),
|
||||
"@brief Calculates the tangent of the radian input.\n"
|
||||
"@arguments x");
|
||||
#ifdef _math_acosh
|
||||
bind(acosh)->doc = "Calculates the inverse hyperbolic cosine of the input.\n"
|
||||
"@arguments x";
|
||||
bind(asinh)->doc = "Calculates the inverse hyperbolic sine of the input.\n"
|
||||
"@arguments x";
|
||||
bind(atanh)->doc = "Calculates the inverse hyperbolic tangent of the input.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(bind(acosh),
|
||||
"@brief Calculates the inverse hyperbolic cosine of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(asinh),
|
||||
"@brief Calculates the inverse hyperbolic sine of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(atanh),
|
||||
"@brief Calculates the inverse hyperbolic tangent of the input.\n"
|
||||
"@arguments x");
|
||||
#endif
|
||||
bind(cosh)->doc = "Calculates the hyperbolic cosine of the input.\n"
|
||||
"@arguments x";
|
||||
bind(sinh)->doc = "Calculates the hyperbolic sine of the input.\n"
|
||||
"@arguments x";
|
||||
bind(tanh)->doc = "Calculates the hyperbolic tangent of the input.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(bind(cosh),
|
||||
"@brief Calculates the hyperbolic cosine of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(sinh),
|
||||
"@brief Calculates the hyperbolic sine of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(tanh),
|
||||
"@brief Calculates the hyperbolic tangent of the input.\n"
|
||||
"@arguments x");
|
||||
#ifdef _math_erf
|
||||
bind(erf)->doc = "Calculates the error function of the input.\n"
|
||||
"@arguments x";
|
||||
bind(erfc)->doc = "Calculates the complementary error function of the input.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(bind(erf),
|
||||
"@brief Calculates the error function of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(erfc),
|
||||
"@brief Calculates the complementary error function of the input.\n"
|
||||
"@arguments x");
|
||||
#endif
|
||||
#ifdef _math_gamma
|
||||
bind(gamma)->doc = "Calculates the gamma of the input.\n"
|
||||
"@arguments x";
|
||||
bind(lgamma)->doc = "Calculates the log gamma of the input.\n"
|
||||
"@arguments x";
|
||||
KRK_DOC(bind(gamma),
|
||||
"@brief Calculates the gamma of the input.\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(lgamma),
|
||||
"@brief Calculates the log gamma of the input.\n"
|
||||
"@arguments x");
|
||||
#endif
|
||||
#ifdef _math_copysign
|
||||
bind(copysign)->doc = "Copies the sign from @p x to @p y\n"
|
||||
"@arguments x,y";
|
||||
KRK_DOC(bind(copysign),
|
||||
"@brief Copies the sign from @p x to @p y\n"
|
||||
"@arguments x,y");
|
||||
#endif
|
||||
bind(fmod)->doc = "Returns the floating point remainder of @p x over @p y\n"
|
||||
"@arguments x,y";
|
||||
KRK_DOC(bind(fmod),
|
||||
"@brief Returns the floating point remainder of @p x over @p y\n"
|
||||
"@arguments x,y");
|
||||
#ifdef _math_remainder
|
||||
bind(remainder)->doc = "Somehow different from `fmod`.";
|
||||
KRK_DOC(bind(remainder),
|
||||
"@brief Somehow different from `fmod`.");
|
||||
#endif
|
||||
bind(log1p)->doc = "Equivalent to `log(x) + 1`\n"
|
||||
"@arguments x";
|
||||
bind(pow)->doc = "Calculates `x^p`\n"
|
||||
"@arguments x,p";
|
||||
bind(atan2)->doc = "Calculates the arctangent of `x` and `y`\n"
|
||||
"@arguments x,y";
|
||||
bind(frexp)->doc = "Converts a floating point input to a fractional and integer component pair, returned as a tuple.\n"
|
||||
KRK_DOC(bind(log1p),
|
||||
"@brief Equivalent to `log(x) + 1`\n"
|
||||
"@arguments x");
|
||||
KRK_DOC(bind(pow),
|
||||
"@brief Calculates `x^p`\n"
|
||||
"@arguments x,p");
|
||||
KRK_DOC(bind(atan2),
|
||||
"@brief Calculates the arctangent of `x` and `y`\n"
|
||||
"@arguments x,y");
|
||||
KRK_DOC(bind(frexp),
|
||||
"@brief Converts a floating point input to a fractional and integer component pair, returned as a tuple.\n"
|
||||
"@arguments x\n"
|
||||
"@returns @ref tuple of two @ref int";
|
||||
"@returns @ref tuple of two @ref int");
|
||||
#ifdef isfinite
|
||||
bind(isfinite)->doc = "Determines if the input is finite.\n"
|
||||
"@arguments x\n";
|
||||
bind(isinf)->doc = "Determines if the input is infinite.\n"
|
||||
"@arguments x\n";
|
||||
bind(isnan)->doc = "Determines if the input is the floating point `NaN`.\n"
|
||||
"@arguments x\n";
|
||||
KRK_DOC(bind(isfinite),
|
||||
"@brief Determines if the input is finite.\n"
|
||||
"@arguments x\n");
|
||||
KRK_DOC(bind(isinf),
|
||||
"@brief Determines if the input is infinite.\n"
|
||||
"@arguments x\n");
|
||||
KRK_DOC(bind(isnan),
|
||||
"@brief Determines if the input is the floating point `NaN`.\n"
|
||||
"@arguments x\n");
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user