From f39619b3ef15e36db7e5051f735e1b1a82ff4fdb Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Mon, 23 Apr 2018 14:34:52 +0100 Subject: [PATCH] doc fixes --- C/arith1.c | 863 +++++++++++++++++----------------- C/errors.c | 1 - docs/Doxyfile | 2 +- docs/Doxyfile.in | 13 +- docs/checkpl.yap | 1 - docs/custom/DoxygenLayout.xml | 194 ++++++++ docs/custom/customdoxygen.css | 134 +++++- docs/custom/doxy-boot.js | 186 +++++++- docs/custom/footer.html | 16 +- docs/custom/header.html | 154 +++--- docs/md/INSTALL.md | 2 +- docs/md/yap.md | 2 +- os/sig.c | 1 - pl/debug.yap | 99 ++-- pl/top.yap | 2 +- 15 files changed, 1054 insertions(+), 616 deletions(-) create mode 100644 docs/custom/DoxygenLayout.xml diff --git a/C/arith1.c b/C/arith1.c index 97f78f768..f40fc3b4b 100644 --- a/C/arith1.c +++ b/C/arith1.c @@ -8,14 +8,12 @@ * * ************************************************************************** * * - * File: arith1.c * - * Last rev: * - * mods: * - * comments: arithmetical expression evaluation * + * File: arith1.c * Last rev: + ** mods: * comments: arithmetical expression evaluation * * * *************************************************************************/ #ifdef SCCS -static char SccsId[] = "%W% %G%"; +static char SccsId[] = "%W% %G%"; #endif /** @@ -109,20 +107,24 @@ static char SccsId[] = "%W% %G%"; - integer( _X_)

@anchor integer_1_op - If _X_ evaluates to a float, the integer between the value of _X_ and 0 closest to the value of _X_, else if _X_ evaluates to an - integer, the value of _X_. + If _X_ evaluates to a float, the integer between the value of _X_ and 0 +closest to the value of _X_, else if _X_ evaluates to an integer, the value of +_X_. - float( _X_) [ISO]

@anchor float_1_op - If _X_ evaluates to an integer, the corresponding float, else the float itself. + If _X_ evaluates to an integer, the corresponding float, else the float +itself. - float_fractional_part( _X_) [ISO]

@anchor float_fractional_part_1 - The fractional part of the floating point number _X_, or `0.0` if _X_ is an integer. In the `iso` language mode, _X_ must be an integer. + The fractional part of the floating point number _X_, or `0.0` if _X_ is +an integer. In the `iso` language mode, _X_ must be an integer. - float_integer_part( _X_) [ISO]

@anchor float_integer_part_1 - The float giving the integer part of the floating point number _X_, or _X_ if _X_ is an integer. In the `iso` language mode, _X_ must be an integer. + The float giving the integer part of the floating point number _X_, or _X_ +if _X_ is an integer. In the `iso` language mode, _X_ must be an integer. - abs( _X_) [ISO]

@anchor abs_1 @@ -132,7 +134,8 @@ static char SccsId[] = "%W% %G%"; The integer that is the smallest integral value not smaller than _X_. - In `iso` language mode the argument must be a floating point-number and the result is an integer. + In `iso` language mode the argument must be a floating point-number and the +result is an integer. - floor( _X_) [ISO]

@anchor floor_1 @@ -143,14 +146,19 @@ static char SccsId[] = "%W% %G%"; - round( _X_) [ISO]

@anchor round_1 - The nearest integral value to _X_. If _X_ is equidistant to two integers, it will be rounded to the closest even integral value. + The nearest integral value to _X_. If _X_ is equidistant to two integers, +it will be rounded to the closest even integral value. - In `iso` language mode the argument must be a floating point-number, the result is an integer and it the float is equidistant it is rounded up, that is, to the least integer greater than _X_. + In `iso` language mode the argument must be a floating point-number, the +result is an integer and it the float is equidistant it is rounded up, that is, +to the least integer greater than _X_. - sign( _X_) [ISO]

@anchor sign_1 - Return 1 if the _X_ evaluates to a positive integer, 0 it if evaluates to 0, and -1 if it evaluates to a negative integer. If _X_ - evaluates to a floating-point number return 1.0 for a positive _X_, 0.0 for 0.0, and -1.0 otherwise. + Return 1 if the _X_ evaluates to a positive integer, 0 it if evaluates to +0, and -1 if it evaluates to a negative integer. If _X_ evaluates to a +floating-point number return 1.0 for a positive _X_, 0.0 for 0.0, and -1.0 +otherwise. - truncate( _X_) [ISO]

@anchor truncate_1 @@ -158,13 +166,13 @@ static char SccsId[] = "%W% %G%"; - rational( _X_)

@anchor rational_1_op - Convert the expression _X_ to a rational number or integer. The function returns the input on integers and rational numbers. For - floating point numbers, the returned rational number exactly represents - the float. As floats cannot exactly represent all decimal numbers the - results may be surprising. In the examples below, doubles can represent - `0.25` and the result is as expected, in contrast to the result of - `rational(0.1)`. The function `rationalize/1` gives a more - intuitive result. + Convert the expression _X_ to a rational number or integer. The function +returns the input on integers and rational numbers. For floating point numbers, +the returned rational number exactly represents the float. As floats cannot +exactly represent all decimal numbers the results may be surprising. In the +examples below, doubles can represent `0.25` and the result is as expected, in +contrast to the result of `rational(0.1)`. The function `rationalize/1` gives a +more intuitive result. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~prolog ?- A is rational(0.25). @@ -176,8 +184,8 @@ A = 3602879701896397 rdiv 36028797018963968 - rationalize( _X_)

@anchor rationalize_1 Convert the expression _X_ to a rational number or integer. The function is - similar to [rational/1](@ref rational_1), but the result is only accurate within the - rounding error of floating point numbers, generally producing a much + similar to [rational/1](@ref rational_1), but the result is only accurate +within the rounding error of floating point numbers, generally producing a much smaller denominator. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~prolog @@ -202,7 +210,8 @@ A = 1 rdiv 10 - popcount( _X_)

@anchor popcount_1 - The number of bits set to `1` in the binary representation of the non-negative integer _X_. + The number of bits set to `1` in the binary representation of the +non-negative integer _X_. - [ _X_]

@@ -226,17 +235,15 @@ X is Y*10+C-48. */ #include "Yap.h" -#include "Yatom.h" -#include "YapHeap.h" #include "YapEval.h" +#include "YapHeap.h" +#include "Yatom.h" -static Term -float_to_int(Float v USES_REGS) -{ -#if USE_GMP +static Term float_to_int(Float v USES_REGS) { +#if USE_GMP Int i = (Int)v; - if (i-v == 0.0) { + if (i - v == 0.0) { return MkIntegerTerm(i); } else { return Yap_gmp_float_to_big(v); @@ -246,11 +253,11 @@ float_to_int(Float v USES_REGS) #endif } -#define RBIG_FL(v) return(float_to_int(v PASS_REGS)) +#define RBIG_FL(v) return (float_to_int(v PASS_REGS)) typedef struct init_un_eval { - char *OpName; - arith1_op f; + char *OpName; + arith1_op f; } InitUnEntry; /* Some compilers just don't get it */ @@ -263,18 +270,16 @@ typedef struct init_un_eval { #endif #if !HAVE_ASINH -#define asinh(F) (log((F)+sqrt((F)*(F)+1))) +#define asinh(F) (log((F) + sqrt((F) * (F) + 1))) #endif #if !HAVE_ACOSH -#define acosh(F) (log((F)+sqrt((F)*(F)-1))) +#define acosh(F) (log((F) + sqrt((F) * (F)-1))) #endif #if !HAVE_ATANH -#define atanh(F) (log((1+(F))/(1-(F)))/2) +#define atanh(F) (log((1 + (F)) / (1 - (F))) / 2) #endif - -static inline Float -get_float(Term t) { +static inline Float get_float(Term t) { if (IsFloatTerm(t)) { return FloatOfTerm(t); } @@ -296,130 +301,156 @@ get_float(Term t) { #if HAVE_RINT #define my_rint(X) rint(X) #else -static -double my_rint(double x) -{ +static double my_rint(double x) { double y, z; Int n; if (x >= 0) { y = x + 0.5; z = floor(y); - n = (Int) z; + n = (Int)z; if (y == z && n % 2) - return(z-1); + return (z - 1); } else { y = x - 0.5; z = ceil(y); - n = (Int) z; + n = (Int)z; if (y == z && n % 2) - return(z+1); + return (z + 1); } - return(z); + return (z); } #endif static Int -msb(Int inp USES_REGS) /* calculate the most significant bit for an integer */ +msb(Int inp USES_REGS) /* calculate the most significant bit for an integer */ { /* the obvious solution: do it by using binary search */ Int out = 0; if (inp < 0) { Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp), - "msb/1 received %d", inp); + "msb/1 received %d", inp); } #if HAVE__BUILTIN_FFSLL - out = __builtin_ffsll(inp); + out = __builtin_ffsll(inp); #elif HAVE_FFSLL - out = ffsll(inp); + out = ffsll(inp); #else - if (inp==0) + if (inp == 0) return 0L; #if SIZEOF_INT_P == 8 - if (inp & ((CELL)0xffffffffLL << 32)) {inp >>= 32; out += 32;} + if (inp & ((CELL)0xffffffffLL << 32)) { + inp >>= 32; + out += 32; + } #endif - if (inp & ((CELL)0xffffL << 16)) {inp >>= 16; out += 16;} - if (inp & ((CELL)0xffL << 8)) {inp >>= 8; out += 8;} - if (inp & ((CELL)0xfL << 4)) {inp >>= 4; out += 4;} - if (inp & ((CELL)0x3L << 2)) {inp >>= 2; out += 2;} - if (inp & ((CELL)0x1 << 1)) out++; + if (inp & ((CELL)0xffffL << 16)) { + inp >>= 16; + out += 16; + } + if (inp & ((CELL)0xffL << 8)) { + inp >>= 8; + out += 8; + } + if (inp & ((CELL)0xfL << 4)) { + inp >>= 4; + out += 4; + } + if (inp & ((CELL)0x3L << 2)) { + inp >>= 2; + out += 2; + } + if (inp & ((CELL)0x1 << 1)) + out++; #endif return out; } -Int -Yap_msb(Int inp USES_REGS) /* calculate the most significant bit for an integer */ +Int Yap_msb( + Int inp USES_REGS) /* calculate the most significant bit for an integer */ { return msb(inp PASS_REGS); } - static Int -lsb(Int inp USES_REGS) /* calculate the least significant bit for an integer */ +lsb(Int inp USES_REGS) /* calculate the least significant bit for an integer */ { /* the obvious solution: do it by using binary search */ Int out = 0; if (inp < 0) { Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp), - "msb/1 received %d", inp); + "msb/1 received %d", inp); } - if (inp==0) + if (inp == 0) return 0L; #if SIZEOF_INT_P == 8 - if (!(inp & (CELL)0xffffffffLL)) {inp >>= 32; out += 32;} + if (!(inp & (CELL)0xffffffffLL)) { + inp >>= 32; + out += 32; + } #endif - if (!(inp & (CELL)0xffffL)) {inp >>= 16; out += 16;} - if (!(inp & (CELL)0xffL)) {inp >>= 8; out += 8;} - if (!(inp & (CELL)0xfL)) {inp >>= 4; out += 4;} - if (!(inp & (CELL)0x3L)) {inp >>= 2; out += 2;} - if (!(inp & ((CELL)0x1))) out++; + if (!(inp & (CELL)0xffffL)) { + inp >>= 16; + out += 16; + } + if (!(inp & (CELL)0xffL)) { + inp >>= 8; + out += 8; + } + if (!(inp & (CELL)0xfL)) { + inp >>= 4; + out += 4; + } + if (!(inp & (CELL)0x3L)) { + inp >>= 2; + out += 2; + } + if (!(inp & ((CELL)0x1))) + out++; return out; } -static Int -popcount(Int inp USES_REGS) /* calculate the least significant bit for an integer */ +static Int popcount( + Int inp USES_REGS) /* calculate the least significant bit for an integer */ { /* the obvious solution: do it by using binary search */ Int c = 0, j = 0, m = ((CELL)1); if (inp < 0) { - Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp), - "popcount/1 received %d", inp); + Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, MkIntegerTerm(inp), + "popcount/1 received %d", inp); } - if (inp==0) + if (inp == 0) return 0L; - for(j=0,c=0; j= 0) { - RFLOAT(log(dbl)); - } else { - Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "log(%f)", dbl); - } + case op_log: { + Float dbl = get_float(t); + if (dbl >= 0) { + RFLOAT(log(dbl)); + } else { + Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "log(%f)", dbl); } - case op_log10: - { - Float dbl = get_float(t); - if (dbl >= 0) { - RFLOAT(log10(dbl)); - } else { - Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "log10(%f)", dbl); - } + } + case op_log10: { + Float dbl = get_float(t); + if (dbl >= 0) { + RFLOAT(log10(dbl)); + } else { + Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "log10(%f)", dbl); } - case op_sqrt: - { - Float dbl = get_float(t), out; - out = sqrt(dbl); + } + case op_sqrt: { + Float dbl = get_float(t), out; + out = sqrt(dbl); #if HAVE_ISNAN - if (isnan(out)) { - Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "sqrt(%f)", dbl); - } + if (isnan(out)) { + Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "sqrt(%f)", dbl); + } #endif - RFLOAT(out); - } - case op_sin: - { - Float dbl = get_float(t), out; - out = sin(dbl); - RFLOAT(out); - } - case op_cos: - { - Float dbl = get_float(t), out; - out = cos(dbl); - RFLOAT(out); - } - case op_tan: - { - Float dbl = get_float(t), out; - out = tan(dbl); - RFLOAT(out); - } - case op_sinh: - { - Float dbl = get_float(t), out; - out = sinh(dbl); - RFLOAT(out); - } - case op_cosh: - { - Float dbl = get_float(t), out; - out = cosh(dbl); - RFLOAT(out); - } - case op_tanh: - { - Float dbl = get_float(t), out; - out = tanh(dbl); - RFLOAT(out); - } - case op_asin: - { - Float dbl, out; + RFLOAT(out); + } + case op_sin: { + Float dbl = get_float(t), out; + out = sin(dbl); + RFLOAT(out); + } + case op_cos: { + Float dbl = get_float(t), out; + out = cos(dbl); + RFLOAT(out); + } + case op_tan: { + Float dbl = get_float(t), out; + out = tan(dbl); + RFLOAT(out); + } + case op_sinh: { + Float dbl = get_float(t), out; + out = sinh(dbl); + RFLOAT(out); + } + case op_cosh: { + Float dbl = get_float(t), out; + out = cosh(dbl); + RFLOAT(out); + } + case op_tanh: { + Float dbl = get_float(t), out; + out = tanh(dbl); + RFLOAT(out); + } + case op_asin: { + Float dbl, out; - dbl = get_float(t); - out = asin(dbl); + dbl = get_float(t); + out = asin(dbl); #if HAVE_ISNAN - if (isnan(out)) { - Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "asin(%f)", dbl); - } -#endif - RFLOAT(out); + if (isnan(out)) { + Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "asin(%f)", dbl); } - case op_acos: - { - Float dbl, out; +#endif + RFLOAT(out); + } + case op_acos: { + Float dbl, out; - dbl = get_float(t); - out = acos(dbl); + dbl = get_float(t); + out = acos(dbl); #if HAVE_ISNAN - if (isnan(out)) { - Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "acos(%f)", dbl); - } -#endif - RFLOAT(out); + if (isnan(out)) { + Yap_ArithError(EVALUATION_ERROR_UNDEFINED, t, "acos(%f)", dbl); } - case op_atan: - { - Float dbl, out; +#endif + RFLOAT(out); + } + case op_atan: { + Float dbl, out; - dbl = get_float(t); - out = atan(dbl); + dbl = get_float(t); + out = atan(dbl); #if HAVE_ISNAN - if (isnan(out)) { - Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "atan(%f)", dbl); - } -#endif - RFLOAT(out); + if (isnan(out)) { + Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "atan(%f)", dbl); } - case op_asinh: - { - Float dbl, out; +#endif + RFLOAT(out); + } + case op_asinh: { + Float dbl, out; - dbl = get_float(t); - out = asinh(dbl); + dbl = get_float(t); + out = asinh(dbl); #if HAVE_ISNAN - if (isnan(out)) { - Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "asinh(%f)", dbl); - } -#endif - RFLOAT(out); + if (isnan(out)) { + Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "asinh(%f)", dbl); } - case op_acosh: - { - Float dbl, out; +#endif + RFLOAT(out); + } + case op_acosh: { + Float dbl, out; - dbl = get_float(t); - out = acosh(dbl); + dbl = get_float(t); + out = acosh(dbl); #if HAVE_ISNAN - if (isnan(out)) { - Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "acosh(%f)", dbl); - } -#endif - RFLOAT(out); + if (isnan(out)) { + Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "acosh(%f)", dbl); } - case op_atanh: - { - Float dbl, out; +#endif + RFLOAT(out); + } + case op_atanh: { + Float dbl, out; - dbl = get_float(t); - out = atanh(dbl); + dbl = get_float(t); + out = atanh(dbl); #if HAVE_ISNAN - if (isnan(out)) { - Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "atanh(%f)", dbl); - } -#endif - RFLOAT(out); + if (isnan(out)) { + Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "atanh(%f)", dbl); } - case op_lgamma: - { +#endif + RFLOAT(out); + } + case op_lgamma: { #if HAVE_LGAMMA - Float dbl; + Float dbl; - dbl = get_float(t); - RFLOAT(lgamma(dbl)); + dbl = get_float(t); + RFLOAT(lgamma(dbl)); #else - RERROR(); + RERROR(); #endif - } - case op_erf: - { + } + case op_erf: { #if HAVE_ERF - Float dbl = get_float(t), out; - out = erf(dbl); - RFLOAT(out); + Float dbl = get_float(t), out; + out = erf(dbl); + RFLOAT(out); #else - RERROR(); + RERROR(); #endif - } - case op_erfc: - { + } + case op_erfc: { #if HAVE_ERF - Float dbl = get_float(t), out; - out = erfc(dbl); - RFLOAT(out); + Float dbl = get_float(t), out; + out = erfc(dbl); + RFLOAT(out); #else - RERROR(); + RERROR(); #endif - } + } /* floor(x) maximum integer greatest or equal to X @@ -626,127 +639,127 @@ eval1(Int fi, Term t USES_REGS) { ISO only converts from float -> int/big */ - case op_floor: - { - Float dbl; + case op_floor: { + Float dbl; - switch (ETypeOfTerm(t)) { - case long_int_e: - return t; - case double_e: - dbl = FloatOfTerm(t); - break; - case big_int_e: + switch (ETypeOfTerm(t)) { + case long_int_e: + return t; + case double_e: + dbl = FloatOfTerm(t); + break; + case big_int_e: #ifdef USE_GMP - return Yap_gmp_floor(t); + return Yap_gmp_floor(t); #endif - default: - RERROR(); - } + default: + RERROR(); + } #if HAVE_ISNAN - if (isnan(dbl)) { - Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl); - } + if (isnan(dbl)) { + Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl); + } #endif #if HAVE_ISINF - if (isinf(dbl)) { - Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\ -(%f)",dbl); - } -#endif - RBIG_FL(floor(dbl)); + if (isinf(dbl)) { + Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\ +(%f)", + dbl); } - case op_ceiling: - { - Float dbl; - switch (ETypeOfTerm(t)) { - case long_int_e: - return t; - case double_e: - dbl = FloatOfTerm(t); - break; - case big_int_e: -#ifdef USE_GMP - return Yap_gmp_ceiling(t); #endif - default: - RERROR(); - } + RBIG_FL(floor(dbl)); + } + case op_ceiling: { + Float dbl; + switch (ETypeOfTerm(t)) { + case long_int_e: + return t; + case double_e: + dbl = FloatOfTerm(t); + break; + case big_int_e: +#ifdef USE_GMP + return Yap_gmp_ceiling(t); +#endif + default: + RERROR(); + } #if HAVE_ISNAN - if (isnan(dbl)) { - Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl); - } + if (isnan(dbl)) { + Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl); + } #endif #if HAVE_ISINF - if (isinf(dbl)) { - Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\ -(%f)",dbl); - } -#endif - RBIG_FL(ceil(dbl)); + if (isinf(dbl)) { + Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\ +(%f)", + dbl); } - case op_round: - { - Float dbl; +#endif + RBIG_FL(ceil(dbl)); + } + case op_round: { + Float dbl; - switch (ETypeOfTerm(t)) { - case long_int_e: - return t; - case double_e: - dbl = FloatOfTerm(t); - break; - case big_int_e: + switch (ETypeOfTerm(t)) { + case long_int_e: + return t; + case double_e: + dbl = FloatOfTerm(t); + break; + case big_int_e: #ifdef USE_GMP - return Yap_gmp_round(t); + return Yap_gmp_round(t); #endif - default: - RERROR(); - } + default: + RERROR(); + } #if HAVE_ISNAN - if (isnan(dbl)) { - Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl); - } + if (isnan(dbl)) { + Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl); + } #endif #if HAVE_ISINF - if (isinf(dbl)) { - Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\ -(%f)",dbl); - } -#endif - RBIG_FL(my_rint(dbl)); + if (isinf(dbl)) { + Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\ +(%f)", + dbl); } +#endif + RBIG_FL(my_rint(dbl)); + } case op_truncate: - case op_integer: - { - Float dbl; - switch (ETypeOfTerm(t)) { - case long_int_e: - return t; - case double_e: - dbl = FloatOfTerm(t); - break; - case big_int_e: + case op_integer: { + Float dbl; + switch (ETypeOfTerm(t)) { + case long_int_e: + return t; + case double_e: + dbl = FloatOfTerm(t); + break; + case big_int_e: #ifdef USE_GMP - return Yap_gmp_trunc(t); + return Yap_gmp_trunc(t); #endif - default: - RERROR(); - } + default: + RERROR(); + } #if HAVE_ISNAN - if (isnan(dbl)) { - Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl); - } + if (isnan(dbl)) { + Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl); + } #endif #if HAVE_ISINF - if (isinf(dbl)) { - Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer (%f)",dbl); - } -#endif - if (dbl < 0.0) - RBIG_FL(ceil(dbl)); - else - RBIG_FL(floor(dbl)); + if (isinf(dbl)) { + Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), + "integer (%f)", dbl); } +#endif + if (dbl < 0.0) + RBIG_FL(ceil(dbl)); + else + RBIG_FL(floor(dbl)); + } case op_float: switch (ETypeOfTerm(t)) { case long_int_e: @@ -842,17 +855,16 @@ eval1(Int fi, Term t USES_REGS) { switch (ETypeOfTerm(t)) { case long_int_e: if (isoLanguageFlag()) { /* iso */ - Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_fractional_part(%f)", IntegerOfTerm(t)); + Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_fractional_part(%f)", + IntegerOfTerm(t)); } else { - RFLOAT(0.0); + RFLOAT(0.0); } - case double_e: - { - Float dbl; - dbl = FloatOfTerm(t); - RFLOAT(dbl-ceil(dbl)); - } - break; + case double_e: { + Float dbl; + dbl = FloatOfTerm(t); + RFLOAT(dbl - ceil(dbl)); + } break; case big_int_e: #ifdef USE_GMP return Yap_gmp_float_fractional_part(t); @@ -863,7 +875,8 @@ eval1(Int fi, Term t USES_REGS) { case op_fintp: switch (ETypeOfTerm(t)) { case long_int_e: - Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_integer_part(%f)", IntegerOfTerm(t)); + Yap_ArithError(TYPE_ERROR_FLOAT, t, "X is float_integer_part(%f)", + IntegerOfTerm(t)); case double_e: RFLOAT(rint(FloatOfTerm(t))); break; @@ -876,19 +889,17 @@ eval1(Int fi, Term t USES_REGS) { } case op_sign: switch (ETypeOfTerm(t)) { - case long_int_e: - { - Int x = IntegerOfTerm(t); + case long_int_e: { + Int x = IntegerOfTerm(t); - RINT((x > 0 ? 1 : (x < 0 ? -1 : 0))); - } - case double_e: - { + RINT((x > 0 ? 1 : (x < 0 ? -1 : 0))); + } + case double_e: { - Float dbl = FloatOfTerm(t); + Float dbl = FloatOfTerm(t); - RINT((dbl > 0.0 ? 1 : (dbl < 0.0 ? -1 : 0))); - } + RINT((dbl > 0.0 ? 1 : (dbl < 0.0 ? -1 : 0))); + } case big_int_e: #ifdef USE_GMP return Yap_gmp_sign(t); @@ -899,7 +910,7 @@ eval1(Int fi, Term t USES_REGS) { case op_random1: switch (ETypeOfTerm(t)) { case long_int_e: - RINT(Yap_random()*IntegerOfTerm(t)); + RINT(Yap_random() * IntegerOfTerm(t)); case double_e: Yap_ArithError(TYPE_ERROR_INTEGER, t, "random(%f)", FloatOfTerm(t)); case big_int_e: @@ -914,62 +925,53 @@ eval1(Int fi, Term t USES_REGS) { RERROR(); } -Term Yap_eval_unary(Int f, Term t) -{ +Term Yap_eval_unary(Int f, Term t) { CACHE_REGS - return eval1(f,t PASS_REGS); + return eval1(f, t PASS_REGS); } -static InitUnEntry InitUnTab[] = { - {"+", op_uplus}, - {"-", op_uminus}, - {"\\", op_unot}, - {"exp", op_exp}, - {"log", op_log}, - {"log10", op_log10}, - {"sqrt", op_sqrt}, - {"sin", op_sin}, - {"cos", op_cos}, - {"tan", op_tan}, - {"sinh", op_sinh}, - {"cosh", op_cosh}, - {"tanh", op_tanh}, - {"asin", op_asin}, - {"acos", op_acos}, - {"atan", op_atan}, - {"asinh", op_asinh}, - {"acosh", op_acosh}, - {"atanh", op_atanh}, - {"floor", op_floor}, - {"ceiling", op_ceiling}, - {"round", op_round}, - {"truncate", op_truncate}, - {"integer", op_integer}, - {"float", op_float}, - {"abs", op_abs}, - {"msb", op_msb}, - {"lsb", op_lsb}, - {"popcount", op_popcount}, - {"float_fractional_part", op_ffracp}, - {"float_integer_part", op_fintp}, - {"sign", op_sign}, - {"lgamma", op_lgamma}, - {"erf",op_erf}, - {"erfc",op_erfc}, - {"rational",op_rational}, - {"rationalize",op_rationalize}, - {"random", op_random1} -}; +static InitUnEntry InitUnTab[] = {{"+", op_uplus}, + {"-", op_uminus}, + {"\\", op_unot}, + {"exp", op_exp}, + {"log", op_log}, + {"log10", op_log10}, + {"sqrt", op_sqrt}, + {"sin", op_sin}, + {"cos", op_cos}, + {"tan", op_tan}, + {"sinh", op_sinh}, + {"cosh", op_cosh}, + {"tanh", op_tanh}, + {"asin", op_asin}, + {"acos", op_acos}, + {"atan", op_atan}, + {"asinh", op_asinh}, + {"acosh", op_acosh}, + {"atanh", op_atanh}, + {"floor", op_floor}, + {"ceiling", op_ceiling}, + {"round", op_round}, + {"truncate", op_truncate}, + {"integer", op_integer}, + {"float", op_float}, + {"abs", op_abs}, + {"msb", op_msb}, + {"lsb", op_lsb}, + {"popcount", op_popcount}, + {"float_fractional_part", op_ffracp}, + {"float_integer_part", op_fintp}, + {"sign", op_sign}, + {"lgamma", op_lgamma}, + {"erf", op_erf}, + {"erfc", op_erfc}, + {"rational", op_rational}, + {"rationalize", op_rationalize}, + {"random", op_random1}}; -Atom -Yap_NameOfUnaryOp(int i) -{ - return Yap_LookupAtom(InitUnTab[i].OpName); -} +Atom Yap_NameOfUnaryOp(int i) { return Yap_LookupAtom(InitUnTab[i].OpName); } -static Int -p_unary_is( USES_REGS1 ) -{ /* X is Y */ +static Int p_unary_is(USES_REGS1) { /* X is Y */ Term t = Deref(ARG2); Term top; bool go; @@ -986,7 +988,7 @@ p_unary_is( USES_REGS1 ) i = IntegerOfTerm(t); tout = eval1(i, top PASS_REGS); - return Yap_unify_constant(ARG1,tout); + return Yap_unify_constant(ARG1, tout); } else if (IsAtomTerm(t)) { Atom name = AtomOfTerm(t); ExpEntry *p; @@ -994,53 +996,49 @@ p_unary_is( USES_REGS1 ) if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 1)))) { Yap_EvalError(TYPE_ERROR_EVALUABLE, takeIndicator(t), - "functor %s/1 for arithmetic expression", - RepAtom(name)->StrOfAE); + "functor %s/1 for arithmetic expression", + RepAtom(name)->StrOfAE); return FALSE; } do { - out= eval1(p->FOfEE, top PASS_REGS); - go = Yap_CheckArithError(); - } while(go); - return Yap_unify_constant(ARG1,out); + out = eval1(p->FOfEE, top PASS_REGS); + go = Yap_CheckArithError(); + } while (go); + return Yap_unify_constant(ARG1, out); } return false; } -static Int -p_unary_op_as_integer( USES_REGS1 ) -{ /* X is Y */ +static Int p_unary_op_as_integer(USES_REGS1) { /* X is Y */ Term t = Deref(ARG1); if (IsVarTerm(t)) { - Yap_EvalError(INSTANTIATION_ERROR,t, "X is _Y"); - return(FALSE); + Yap_EvalError(INSTANTIATION_ERROR, t, "X is _Y"); + return (FALSE); } if (IsIntTerm(t)) { - return Yap_unify_constant(ARG2,t); + return Yap_unify_constant(ARG2, t); } if (IsAtomTerm(t)) { Atom name = AtomOfTerm(t); ExpEntry *p; if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 1)))) { - return Yap_unify(ARG1,ARG2); + return Yap_unify(ARG1, ARG2); } - return Yap_unify_constant(ARG2,MkIntTerm(p->FOfEE)); + return Yap_unify_constant(ARG2, MkIntTerm(p->FOfEE)); } - return(FALSE); + return (FALSE); } -void -Yap_InitUnaryExps(void) -{ - unsigned int i; - ExpEntry *p; +void Yap_InitUnaryExps(void) { + unsigned int i; + ExpEntry *p; - for (i = 0; i < sizeof(InitUnTab)/sizeof(InitUnEntry); ++i) { + for (i = 0; i < sizeof(InitUnTab) / sizeof(InitUnEntry); ++i) { AtomEntry *ae = RepAtom(Yap_LookupAtom(InitUnTab[i].OpName)); if (ae == NULL) { - Yap_EvalError(RESOURCE_ERROR_HEAP,TermNil,"at InitUnaryExps"); + Yap_EvalError(RESOURCE_ERROR_HEAP, TermNil, "at InitUnaryExps"); return; } WRITE_LOCK(ae->ARWLock); @@ -1048,7 +1046,7 @@ Yap_InitUnaryExps(void) WRITE_UNLOCK(ae->ARWLock); break; } - p = (ExpEntry *) Yap_AllocAtomSpace(sizeof(ExpEntry)); + p = (ExpEntry *)Yap_AllocAtomSpace(sizeof(ExpEntry)); p->KindOfPE = ExpProperty; p->ArityOfEE = 1; p->ENoOfEE = 1; @@ -1057,11 +1055,10 @@ Yap_InitUnaryExps(void) WRITE_UNLOCK(ae->ARWLock); } Yap_InitCPred("is", 3, p_unary_is, TestPredFlag | SafePredFlag); - Yap_InitCPred("$unary_op_as_integer", 2, p_unary_op_as_integer, TestPredFlag|SafePredFlag);} - -/* This routine is called from Restore to make sure we have the same arithmetic operators */ -int -Yap_ReInitUnaryExps(void) -{ - return TRUE; + Yap_InitCPred("$unary_op_as_integer", 2, p_unary_op_as_integer, + TestPredFlag | SafePredFlag); } + +/* This routine is called from Restore to make sure we have the same arithmetic + * operators */ +int Yap_ReInitUnaryExps(void) { return TRUE; } diff --git a/C/errors.c b/C/errors.c index 74dc66329..0b9747635 100755 --- a/C/errors.c +++ b/C/errors.c @@ -1,4 +1,3 @@ - /************************************************************************* * * * Yap Prolog * diff --git a/docs/Doxyfile b/docs/Doxyfile index b06c8b843..d65caeda0 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -246,7 +246,7 @@ TCL_SUBST = # members will be omitted, etc. # The default value is: NO. -OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 4dc2606fc..f01c9f488 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -694,7 +694,7 @@ FILE_VERSION_FILTER = # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. -LAYOUT_FILE = +LAYOUT_FILE = @CMAKE_SOURCE_DIR@/docs/custom/DoxygenLayout.xml # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib @@ -833,7 +833,8 @@ EXCLUDE_SYMLINKS = NO # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = \ - @PROJECT_SOURCE_DIR@/packages/gecode/gecode3_yap.cc \ + @PROJECT_SOURCE_DIR@/*/bprolog/* \ + @PROJECT_SOURCE_DIR@/*/prism/* \ @PROJECT_SOURCE_DIR@/packages/gecode/gecode4_yap.cc \ @PROJECT_SOURCE_DIR@/packages/gecode/gecode3.yap \ @PROJECT_SOURCE_DIR@/packages/gecode/gecode4.yap \ @@ -1028,7 +1029,7 @@ VERBATIM_HEADERS = YES # classes, structs, unions or interfaces. # The default value is: YES. -ALPHABETICAL_INDEX = YES +ALPHABETICAL_INDEX = NO # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. @@ -1410,7 +1411,7 @@ DISABLE_INDEX = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_TREEVIEW = YES +GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. @@ -1598,7 +1599,7 @@ EXTRA_SEARCH_MAPPINGS = # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1878,7 +1879,7 @@ MAN_LINKS = NOoi9 0 # captures the structure of the code including all documentation. # The default value is: NO. -GENERATE_XML = YES +GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of diff --git a/docs/checkpl.yap b/docs/checkpl.yap index a07a1aa5d..cca01fde2 100644 --- a/docs/checkpl.yap +++ b/docs/checkpl.yap @@ -6,7 +6,6 @@ main :- %system('find . \( -name '*.pl' -o -name '*.yap' -o -name '*.c' -o -name '*.h' -o -name '*.cpp' -o -name '*.hh' \) -type f -print | xargs grep '@defgroup\|@ingroup\|@addtogroup\|@{|@}'). - file_filter_with_start_end( docs, tmp, add2graph, initgraph, checkgraph). initgraph(_,_). diff --git a/docs/custom/DoxygenLayout.xml b/docs/custom/DoxygenLayout.xml new file mode 100644 index 000000000..2d145ba5a --- /dev/null +++ b/docs/custom/DoxygenLayout.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/custom/customdoxygen.css b/docs/custom/customdoxygen.css index d578db4d9..c20bd11ba 100644 --- a/docs/custom/customdoxygen.css +++ b/docs/custom/customdoxygen.css @@ -1,5 +1,3 @@ -* { box-sizing:border-box } - h1, .h1, h2, .h2, h3, .h3{ font-weight: 200 !important; } @@ -10,12 +8,17 @@ h1, .h1, h2, .h2, h3, .h3{ .adjust-right { margin-left: 30px !important; -margin-right: 30px !important; -Font-size: 1.15em !important; +font-size: 1.15em !important; } .navbar{ border: 0px solid #222 !important; } +table{ + white-space:pre-wrap !important; +} +/* + =========================== + */ /* Sticky footer styles @@ -145,8 +148,8 @@ div.fragment { } div.line { - font-family: monospace, fixed; - font-size: 13px; + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 12px; min-height: 13px; line-height: 1.0; text-wrap: unrestricted; @@ -154,7 +157,7 @@ div.line { white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ - word-wrap: break-word; /* IE 5.5+ */ + word-wrap: normal; /* IE 5.5+ */ text-indent: -53px; padding-left: 53px; padding-bottom: 0px; @@ -170,6 +173,9 @@ div.line { transition-property: background-color, box-shadow; transition-duration: 0.5s; } +div.line:hover{ + background-color: #FBFF00; +} div.line.glow { background-color: cyan; @@ -180,16 +186,21 @@ div.line.glow { span.lineno { padding-right: 4px; text-align: right; - border-right: 2px solid #0F0; - background-color: #E8E8E8; + color:rgba(0,0,0,0.3); + border-right: 1px solid #EEE; + border-left: 1px solid #EEE; + background-color: #FFF; white-space: pre; + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace ; } span.lineno a { - background-color: #D8D8D8; + background-color: #FAFAFA; + cursor:pointer; } span.lineno a:hover { - background-color: #C8C8C8; + background-color: #EFE200; + color: #1e1e1e; } div.groupHeader { @@ -256,3 +267,104 @@ blockquote { padding: 0 12px 0 16px; } +/*---------------- Search Box */ + +#search-box { + margin: 10px 0px; +} +#search-box .close { + display: none; + position: absolute; + right: 0px; + padding: 6px 12px; + z-index: 5; +} + +/*---------------- Search results window */ + +#search-results-window { + display: none; +} + +iframe#MSearchResults { + width: 100%; + height: 15em; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} +.SRPage .SRChildren { + display: none; +} +a.SRScope { + display: block; +} +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} +span.SRScope { + padding-left: 4px; +} +.SRResult { + display: none; +} + +/* class and file list */ +.directory .icona, +.directory .arrow { + height: auto; +} +.directory .icona .icon { + height: 16px; +} +.directory .icondoc { + background-position: 0px 0px; + height: 20px; +} +.directory .iconfopen { + background-position: 0px 0px; +} +.directory td.entry { + padding: 7px 8px 6px 8px; +} + +.table > tbody > tr > td.memSeparator { + line-height: 0; + .table-hover; + +} + +.memItemLeft, .memTemplItemLeft { + white-space: normal; +} + +/* enumerations */ +.panel-body thead > tr { + background-color: #e0e0e0; +} + +/* todo lists */ +.todoname, +.todoname a { + font-weight: bold; +} + +/* Class title */ +.summary { + margin-top: 25px; +} +.page-header { + margin: 20px 0px !important; +} +.page-header .title { + display: inline-block; +} +.page-header .pull-right { + margin-top: 0.3em; + margin-left: 0.5em; +} +.page-header .label { + font-size: 50%; +} diff --git a/docs/custom/doxy-boot.js b/docs/custom/doxy-boot.js index 61014d0df..ac0b41f49 100644 --- a/docs/custom/doxy-boot.js +++ b/docs/custom/doxy-boot.js @@ -4,7 +4,6 @@ $( document ).ready(function() { $("div.title").addClass("h1"); $('li > a[href="index.html"] > span').before(" "); - $('li > a[href="index.html"] > span').text("BioGears"); $('li > a[href="modules.html"] > span').before(" "); $('li > a[href="namespaces.html"] > span').before(" "); $('li > a[href="annotated.html"] > span').before(" "); @@ -14,7 +13,7 @@ $( document ).ready(function() { $('li > a[href="functions_func.html"] > span').before(" "); $('li > a[href="functions_vars.html"] > span').before(" "); $('li > a[href="functions_enum.html"] > span').before(" "); - $('li > a[href="functions_YapEval.html"] > span').before(" "); + $('li > a[href="functions_eval.html"] > span').before(" "); $('img[src="ftv2ns.png"]').replaceWith('N '); $('img[src="ftv2cl.png"]').replaceWith('C '); @@ -27,7 +26,7 @@ $( document ).ready(function() { $("#nav-path > ul").addClass("breadcrumb"); $("table.params").addClass("table"); - $("div.ingroups").wrapInner(""); + $("div.ingroups").wrapInner(""); $("div.levels").css("margin", "0.5em"); $("div.levels > span").addClass("btn btn-default btn-xs"); $("div.levels > span").css("margin-right", "0.25em"); @@ -54,21 +53,19 @@ $( document ).ready(function() { $("div.ttname a").css("color", 'white'); $("div.ttdef,div.ttdoc,div.ttdeci").addClass("panel-body"); - $('#MSearchBox').parent().remove(); + $('div.fragment.well div.line:first').css('margin-top', '2px'); + $('div.fragment.well div.line:last').css('margin-bottom', '2px'); - $('div.fragment.well div.line:first').css('margin-top', '15px'); - $('div.fragment.well div.line:last').css('margin-bottom', '15px'); - $('table.doxtable').removeClass('doxtable').addClass('table table-striped table-bordered').each(function(){ $(this).prepend(''); $(this).find('tbody > tr:first').prependTo($(this).find('thead')); - + $(this).find('td > span.success').parent().addClass('success'); $(this).find('td > span.warning').parent().addClass('warning'); $(this).find('td > span.danger').parent().addClass('danger'); }); - - + + if($('div.fragment.well div.ttc').length > 0) { @@ -79,18 +76,164 @@ $( document ).ready(function() { $(this).contents().appendTo($(this).siblings('.memItemLeft')); $(this).siblings('.memItemLeft').attr('align', 'left'); }); - + + $('table.memberdecls').find('.memTemplItemRight').each(function(){ + $(this).contents().appendTo($(this).siblings('.memTemplItemLeft')); + $(this).siblings('.memTemplItemLeft').attr('align', 'left'); + }); + function getOriginalWidthOfImg(img_element) { var t = new Image(); t.src = (img_element.getAttribute ? img_element.getAttribute("src") : false) || img_element.src; return t.width; } - + $('div.dyncontent').find('img').each(function(){ if(getOriginalWidthOfImg($(this)[0]) > $('#content>div.container').width()) $(this).css('width', '100%'); }); - + + + /* responsive search box */ + $('#MSearchBox').parent().remove(); + + var nav_container = $('

'); + $('#navrow1').parent().prepend(nav_container); + + var left_nav = $('
'); + for (i = 0; i < 6; i++) { + var navrow = $('#navrow' + i + ' > ul.tablist').detach(); + left_nav.append(navrow); + $('#navrow' + i).remove(); + } + var right_nav = $('
').append('\ + '); + $(nav_container).append(left_nav); + $(nav_container).append(right_nav); + + $('#MSearchSelectWindow .SelectionMark').remove(); + var search_selectors = $('#MSearchSelectWindow .SelectItem'); + for (var i = 0; i < search_selectors.length; i += 1) { + var element_a = $('').text($(search_selectors[i]).text()); + + element_a.click(function(){ + $('#search-box .dropdown-menu li').removeClass('active'); + $(this).parent().addClass('active'); + searchBox.OnSelectItem($('#search-box li a').index(this)); + searchBox.Search(); + return false; + }); + + var element = $('
  • ').append(element_a); + $('#search-box .dropdown-menu').append(element); + } + $('#MSearchSelectWindow').remove(); + + $('#search-box .close').click(function (){ + searchBox.CloseResultsWindow(); + }); + + $('body').append('
    '); + $('body').append('
    '); + $('body').append('
    '); + + searchBox.searchLabel = ''; + searchBox.DOMSearchField = function() { + return document.getElementById("search-field"); + } + searchBox.DOMSearchClose = function(){ + return document.getElementById("search-close"); + } + + + /* search results */ + var results_iframe = $('#MSearchResults').detach(); + $('#MSearchResultsWindow') + .attr('id', 'search-results-window') + .addClass('panel panel-default') + .append( + '
    \ +

    Search Results

    \ +
    \ +
    ' + ); + $('#search-results-window .panel-body').append(results_iframe); + + searchBox.DOMPopupSearchResultsWindow = function() { + return document.getElementById("search-results-window"); + } + + function update_search_results_window() { + $('#search-results-window').removeClass('panel-default panel-success panel-warning panel-danger') + var status = $('#MSearchResults').contents().find('.SRStatus:visible'); + if (status.length > 0) { + switch(status.attr('id')) { + case 'Loading': + case 'Searching': + $('#search-results-window').addClass('panel-warning'); + break; + case 'NoMatches': + $('#search-results-window').addClass('panel-danger'); + break; + default: + $('#search-results-window').addClass('panel-default'); + } + } else { + $('#search-results-window').addClass('panel-success'); + } + } + $('#MSearchResults').load(function() { + $('#MSearchResults').contents().find('link[href="search.css"]').attr('href','../doxygen.css'); + $('#MSearchResults').contents().find('head').append( + ''); + + update_search_results_window(); + + // detect status changes (only for search with external search backend) + var observer = new MutationObserver(function(mutations) { + update_search_results_window(); + }); + var config = { attributes: true}; + + var targets = $('#MSearchResults').contents().find('.SRStatus'); + for (i = 0; i < targets.length; i++) { + observer.observe(targets[i], config); + } + }); + + + /* enumerations */ + $('table.fieldtable').removeClass('fieldtable').addClass('table table-striped table-bordered').each(function(){ + $(this).prepend(''); + $(this).find('tbody > tr:first').prependTo($(this).find('thead')); + + $(this).find('td > span.success').parent().addClass('success'); + $(this).find('td > span.warning').parent().addClass('warning'); + $(this).find('td > span.danger').parent().addClass('danger'); + }); + + /* todo list */ + var todoelements = $('.contents > .textblock > dl.reflist > dt, .contents > .textblock > dl.reflist > dd'); + for (var i = 0; i < todoelements.length; i += 2) { + $('.contents > .textblock').append( + '
    ' + + "
    " + $(todoelements[i]).html() + "
    " + + "
    " + $(todoelements[i+1]).html() + "
    " + + '
    '); + } + $('.contents > .textblock > dl').remove(); + + $(".memitem").removeClass('memitem'); $(".memproto").removeClass('memproto'); $(".memdoc").removeClass('memdoc'); @@ -105,17 +248,24 @@ $( document ).ready(function() { $("a.el").removeClass('el'); $("div.ah").removeClass('ah'); $("div.header").removeClass("header"); - + $('.mdescLeft').each(function(){ if($(this).html()==" ") { $(this).siblings('.mdescRight').attr('colspan', 2); $(this).remove(); } }); - $('td.memItemLeft').each(function(){ - if($(this).siblings('.memItemRight').html()=="") { + $('td.memItemLeft').each(function(){ + if($(this).siblings('.memItemRight').html()=="") { + $(this).attr('colspan', 2); + $(this).siblings('.memItemRight').remove(); + } + }); + $('td.memTemplItemLeft').each(function(){ + if($(this).siblings('.memTemplItemRight').html()=="") { $(this).attr('colspan', 2); - $(this).siblings('.memItemRight').remove(); + $(this).siblings('.memTemplItemRight').remove(); } }); -}); \ No newline at end of file + searchBox.CloseResultsWindow(); +}); diff --git a/docs/custom/footer.html b/docs/custom/footer.html index f2fa20497..694845591 100644 --- a/docs/custom/footer.html +++ b/docs/custom/footer.html @@ -1,14 +1,14 @@ - + + + + + + + + diff --git a/docs/custom/header.html b/docs/custom/header.html index 09406b031..777cc6c9c 100644 --- a/docs/custom/header.html +++ b/docs/custom/header.html @@ -3,81 +3,99 @@ - - + + + - - + + - - $treeview - $search - $mathjax + + + + + + $projectname: $title + $title + $extrastylesheet - - - + + + $mathjax + + + - - - - - - - - - - - - +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + diff --git a/docs/md/INSTALL.md b/docs/md/INSTALL.md index f0cf09101..2a8f6c2b9 100644 --- a/docs/md/INSTALL.md +++ b/docs/md/INSTALL.md @@ -1,6 +1,6 @@ -Installing YAP {#install} +Installing YAP {#INSTALL} ++++++++ ### Downloading YAP {#download} diff --git a/docs/md/yap.md b/docs/md/yap.md index b2aeb8d43..db56f10e0 100644 --- a/docs/md/yap.md +++ b/docs/md/yap.md @@ -5,7 +5,7 @@ ![The YAP Logo](docs/icons/yap_128x128x32.png) -NOTE: this version of YAP is still experimental, documentation may be missing or brout of date. +NOTE: this version of YAP is still experimental, documentation may be missing or out of date. ## Introduction diff --git a/os/sig.c b/os/sig.c index efd2ee8e1..c51273f71 100644 --- a/os/sig.c +++ b/os/sig.c @@ -1,4 +1,3 @@ - #include "sysbits.h" #if HAVE_SIGINFO_H diff --git a/pl/debug.yap b/pl/debug.yap index eeedbbfc5..96123e1e5 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -300,9 +300,10 @@ be lost. '$execute_nonstop'(G,Mod). '$trace'([Mod|G]) :- CP is '$last_choice_pt', + '$trace_query'(G, Mod, CP, G, EG), gated_call( - '$debugger_input', - '$trace_query'(G, Mod, CP, not_expanded), + '$debugger_input', + EG, E, '$continue_debugging'(E) ). @@ -388,81 +389,48 @@ be lost. '$trace_meta_call'( G, M, CP ) :- - '$trace_query'(G, M, CP, not_expanded ). + '$trace_query'(G, M, CP, G, EG ), + call(EG). %% @pred '$trace_query'( +G, +M, +CP, +Expanded) % % debug a complex query % -'$trace_query'(V, M, CP, _) :- - '$creep', - !, - '$call'(V,M,V,CP). -'$trace_query'(V, M, CP, _) :- - var(V), !, - '$trace_query'(call(V), M, CP, _). -'$trace_query'(!, _, CP, _) :- - !, - '$$cut_by'(CP). -'$trace_query'('$cut_by'(M), _, _, _) :- - !, - '$$cut_by'(M). -'$trace_query'('$$cut_by'(M), _, _, _) :- - !, - '$$cut_by'(M). -'$trace_query'(true, _, _, _) :- !. -%'$trace_query'(fail, _, _, _) :- !, fail. -'$trace_query'(M:G, _, CP, Expanded) :- +'$trace_query'(V, M, CP, _, '$trace'([M|V],CP)) :- + var(V), !. +'$trace_query'(!, _, CP, _, '$$cut_by'(CP)) :- + !. +'$trace_query'('$cut_by'(M), _, _, _, '$$cut_by'(M)) :- + !. +'$trace_query'('$$cut_by'(M), _, _, _, '$$cut_by'(M)) :- + !. +'$trace_query'(true, _, _, _, true) :- !. +'$trace_query'(fail, _, _, _, '$trace'(fail)) :- !. +'$trace_query'(M:G, _, CP,S, Expanded) :- !, '$yap_strip_module'(M:G, M0, G0), - '$trace_query'(G0, M0, CP, Expanded ). -'$trace_query'((A,B), M, CP, Expanded) :- !, - '$trace_query'(A, M, CP, Expanded), - '$trace_query'(B, M, CP, Expanded). -'$trace_query'((T->A;B), M, CP, Expanded) :- !, - ( '$trace_query'(T, M, CP, Expanded) -> '$trace_query'(A, M, CP, Expanded) - ; - - '$trace_query'(B, M, CP, Expanded) - ). -'$trace_query'((T->A|B), M, CP, Expanded) :- !, - ( - '$trace_query'(T, M, CP, Expanded) - -> - '$trace_query'(A, M, CP, Expanded) - ; - '$trace_query'(B, M, CP, Expanded) - ). -'$trace_query'((T->A), M, CP, Expanded) :- !, - ( '$trace_query'(T, M, CP, Expanded) -> '$trace_query'(A, M, CP, Expanded) ). -'$trace_query'((A;B), M, CP, Expanded) :- !, - ( - '$trace_query'(A, M, CP, Expanded) - ; - '$trace_query'(B, M, CP, Expanded) - ). -'$trace_query'((A|B), M, CP, Expanded) :- !, - ( - '$trace_query'(A, M, CP, Expanded ) - ; - '$trace_query'(B, M, CP, Expanded ) - ). -'$trace_query'((\+G), M, CP, Expanded) :- !, - \+ '$trace_query'(G, M, CP, Expanded). -'$trace_query'((not(G)), M, CP, Expanded) :- !, - \+ '$trace_query'(G, M, CP, Expanded). -'$trace_query'(once(G), M, CP, Expanded) :- !, - once( '$trace_query'(G, M, CP, Expanded) ). -'$trace_query'(ignore(G), M, CP, Expanded) :- !, - ignore( '$trace_query'(G, M, CP, Expanded) ). -'$trace_query'(G, M, _CP, _) :- + '$trace_query'(G0, M0, CP,S, Expanded ). +'$trace_query'((A,B), M, CP, S, (EA,EB)) :- !, + '$trace_query'(A, M, CP, S, EA), + '$trace_query'(B, M, CP, S, EB). +'$trace_query'((A->B), M, CP, S, (EA->EB)) :- !, + '$trace_query'(A, M, CP, S, EA), + '$trace_query'(B, M, CP, S, EB). +'$trace_query'((A;B), M, CP, S, (EA;EB)) :- !, + '$trace_query'(A, M, CP, S, EA), + '$trace_query'(B, M, CP, S, EB). +'$trace_query'((A|B), M, CP, S, (EA|EB)) :- !, + '$trace_query'(A, M, CP, S, EA), +'$trace_query'((\+ A), M, CP, S, (\+ EA)) :- !, + '$trace_query'(A, M, CP, S, EA). +'$trace_query'(G, M, _CP, _, ( % spy a literal '$id_goal'(L), catch( '$trace_goal'(G, M, L, H), E, '$re_trace_query'(E, G, M, L, H) - ). + ))). %% @pred $trace_goal( +Goal, +Module, +CallId, +CallInfo) %% @@ -605,7 +573,8 @@ be lost. CP is '$last_choice_pt', clause(M:G, Cl, _), '$retry_clause'(GoalNumber, G, M, Info, X), - '$trace_query'(Cl, M, CP, expanded). + '$trace_query'(Cl, M, CP, Cl, ECl), + '$execute0'(ECl,M). '$creep_step'(GoalNumber, G, M, Info) :- X=marker(_,M,G), diff --git a/pl/top.yap b/pl/top.yap index e79aea434..13aa0d9ba 100644 --- a/pl/top.yap +++ b/pl/top.yap @@ -832,7 +832,7 @@ gated_call(Setup, Goal, Catcher, Cleanup) :- Task0 = cleanup( All, Catcher, Cleanup, Tag, true, CP0), TaskF = cleanup( All, Catcher, Cleanup, Tag, false, CP0), '$tag_cleanup'(CP0, Task0), - '$execute_nonstop'( Goal ), + call( Goal ), '$cleanup_on_exit'(CP0, TaskF).