Commit b4c1ef87 authored by Jukka-Pekka Iivonen's avatar Jukka-Pekka Iivonen Committed by jpekka

Moved the error functions to information functions file.

1999-09-13  Jukka-Pekka Iivonen  <iivonen@iki.fi>

	* src/functions/fn-misc.c, src/functions/fn-information.c: Moved the
	error functions to information functions file.

	* src/functions/fn-math.c, src/function/fn-lookup.c: Moved TRANSPOSE
	to lookup functions file.
parent 05217cc4
1999-09-13 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/functions/fn-misc.c, src/functions/fn-information.c: Moved the
error functions to information functions file.
* src/functions/fn-math.c, src/function/fn-lookup.c: Moved TRANSPOSE
to lookup functions file.
* src/functions/fn-stat.c: Added more examples.
* src/dialogs/dialog-analysis-tools.c: Bug fix. Pressing ESC key
......
1999-09-13 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/functions/fn-misc.c, src/functions/fn-information.c: Moved the
error functions to information functions file.
* src/functions/fn-math.c, src/function/fn-lookup.c: Moved TRANSPOSE
to lookup functions file.
* src/functions/fn-stat.c: Added more examples.
* src/dialogs/dialog-analysis-tools.c: Bug fix. Pressing ESC key
......
......@@ -138,6 +138,7 @@ static char *help_bin2dec = {
"@DESCRIPTION="
"BIN2DEC function converts a binary number "
"in string or number to its decimal equivalent."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"BIN2DEC(101) equals 5.\n"
......@@ -163,6 +164,7 @@ static char *help_bin2oct = {
"number of spaces."
"\n"
"If @places is too small or negative #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"BIN2OCT(110111) equals 67.\n"
......@@ -188,6 +190,7 @@ static char *help_bin2hex = {
"to zero pad to that number of spaces."
"\n"
"If @places is too small or negative #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"BIN2HEX(100111) equals 27.\n"
......@@ -213,6 +216,7 @@ static char *help_dec2bin = {
"number of spaces."
"\n"
"If @places is too small or negative #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"DEC2BIN(42) equals 101010.\n"
......@@ -238,6 +242,7 @@ static char *help_dec2oct = {
"number of spaces."
"\n"
"If @places is too small or negative #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"DEC2OCT(42) equals 52.\n"
......@@ -263,6 +268,7 @@ static char *help_dec2hex = {
"to that number of spaces."
"\n"
"If @places is too small or negative #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"DEC2HEX(42) equals 2A.\n"
......@@ -285,6 +291,7 @@ static char *help_oct2dec = {
"@DESCRIPTION="
"OCT2DEC function converts an octal number "
"in a string or number to its decimal equivalent."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"OCT2DEC(\"124\") equals 84.\n"
......@@ -308,6 +315,7 @@ static char *help_oct2bin = {
"The OCT2BIN function converts an octal number to a binary "
"number. @places is an optional field, specifying to zero pad "
"to that number of spaces."
"This function is Excel compatible. "
"\n"
"If @places is too small or negative #NUM! error is returned."
"\n"
......@@ -333,6 +341,7 @@ static char *help_oct2hex = {
"The OCT2HEX function converts an octal number to a hexadecimal "
"number. @places is an optional field, specifying to zero pad "
"to that number of spaces."
"This function is Excel compatible. "
"\n"
"If @places is too small or negative #NUM! error is returned."
"\n"
......@@ -360,6 +369,7 @@ static char *help_hex2bin = {
"to that number of spaces."
"\n"
"If @places is too small or negative #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"HEX2BIN(\"2A\") equals 101010.\n"
......@@ -385,6 +395,7 @@ static char *help_hex2oct = {
"to that number of spaces."
"\n"
"If @places is too small or negative #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"HEX2OCT(\"2A\") equals 52.\n"
......@@ -407,6 +418,7 @@ static char *help_hex2dec = {
"@DESCRIPTION="
"The HEX2DEC function converts a hexadecimal number "
"to its decimal equivalent."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"HEX2DEC(\"2A\") equals 42.\n"
......@@ -433,9 +445,9 @@ static char *help_besseli = {
"@y is the order of the bessel function, if non-integer it is "
"truncated."
"\n"
"If @x or @y are not numeric a #VALUE! error is returned. "
"If @y < 0 a #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"BESSELI(0.7,3) equals 0.007367374.\n"
......@@ -468,15 +480,15 @@ static char *help_besselk = {
"@SYNTAX=BESSELK(x,y)\n"
"@DESCRIPTION="
"The BESSELK function returns the Neumann, Weber or Bessel "
"BESSELK function returns the Neumann, Weber or Bessel "
"function. "
"@x is where the function is evaluated. "
"@y is the order of the bessel function, if non-integer it is "
"truncated."
"\n"
"if x or n are not numeric a #VALUE! error is returned."
"if y < 0 a #NUM! error is returned."
"If x or n are not numeric a #VALUE! error is returned."
"If y < 0 a #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"BESSELK(3,9) equals 397.95880.\n"
......@@ -508,14 +520,14 @@ static char *help_besselj = {
"@SYNTAX=BESSELJ(x,y)\n"
"@DESCRIPTION="
"The BESSELJ function returns the bessel function with "
"BESSELJ function returns the bessel function with "
"@x is where the function is evaluated. "
"@y is the order of the bessel function, if non-integer it is "
"truncated."
"\n"
"If @x or @y are not numeric a #VALUE! error is returned. "
"If @y < 0 a #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"BESSELJ(0.89,3) equals 0.013974004.\n"
......@@ -544,14 +556,15 @@ static char *help_bessely = {
"@SYNTAX=BESSELY(x,y)\n"
"@DESCRIPTION="
"The BESSELY function returns the Neumann, Weber or Bessel "
"BESSELY function returns the Neumann, Weber or Bessel "
"function. "
"@x is where the function is evaluated. "
"@y is the order of the bessel function, if non-integer it is "
"truncated."
"\n"
"if x or n are not numeric a #VALUE! error is returned."
"if n < 0 a #NUM! error is returned."
"If x or n are not numeric a #VALUE! error is returned."
"If n < 0 a #NUM! error is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"BESSELY(4,2) equals 0.215903595.\n"
......@@ -626,6 +639,7 @@ static char *help_complex = {
"\n"
"If @suffix is neither 'i' nor 'j', COMPLEX returns #VALUE! "
"error. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"COMPLEX(1,-1) equals 1-i.\n"
......@@ -663,6 +677,7 @@ static char *help_imaginary = {
"@DESCRIPTION="
"IMAGINARY returns the imaginary coefficient of a complex "
"number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMAGINARY(\"132-j\") equals -1.\n"
......@@ -692,6 +707,7 @@ static char *help_imreal = {
"@SYNTAX=IMREAL(inumber)\n"
"@DESCRIPTION="
"IMREAL returns the real coefficient of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"imreal(\"132-j\") equals 132.\n"
......@@ -722,6 +738,7 @@ static char *help_imabs = {
"@SYNTAX=IMABS(inumber)\n"
"@DESCRIPTION="
"IMABS returns the absolute value of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMABS(\"2-j\") equals 2.23606798.\n"
......@@ -752,6 +769,7 @@ static char *help_imconjugate = {
"@SYNTAX=IMCONJUGATE(inumber)\n"
"@DESCRIPTION="
"IMCONJUGATE returns the complex conjugate of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMCONJUGATE(\"1-j\") equals 1+j.\n"
......@@ -782,6 +800,7 @@ static char *help_imcos = {
"@SYNTAX=IMCOS(inumber)\n"
"@DESCRIPTION="
"IMCOS returns the cosine of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMCOS(\"1+j\") equals 0.833730-0.988898j.\n"
......@@ -809,6 +828,7 @@ static char *help_imtan = {
"@SYNTAX=IMTAN(inumber)\n"
"@DESCRIPTION="
"IMTAN returns the tangent of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -835,6 +855,7 @@ static char *help_imexp = {
"@SYNTAX=IMEXP(inumber)\n"
"@DESCRIPTION="
"IMEXP returns the exponential of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMEXP(\"2-j\") equals 3.992324-6.217676j.\n"
......@@ -862,6 +883,7 @@ static char *help_imargument = {
"@SYNTAX=IMARGUMENT(inumber)\n"
"@DESCRIPTION="
"IMARGUMENT returns the argument theta of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMARGUMENT(\"2-j\") equals -0.463647609.\n"
......@@ -892,6 +914,7 @@ static char *help_imln = {
"natural logarithm is not uniquely defined on complex numbers. "
"You may need to add or subtract an even multiple of pi to the "
"imaginary part.)"
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMLN(\"3-j\") equals 1.15129-0.32175j.\n"
......@@ -919,6 +942,7 @@ static char *help_imlog2 = {
"@SYNTAX=IMLOG2(inumber)\n"
"@DESCRIPTION="
"IMLOG2 returns the logarithm of a complex number in base 2."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMLOG2(\"3-j\") equals 1.66096-0.46419j.\n"
......@@ -948,6 +972,7 @@ static char *help_imlog10 = {
"@SYNTAX=IMLOG10(inumber)\n"
"@DESCRIPTION="
"IMLOG10 returns the logarithm of a complex number in base 10."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMLOG10(\"3-j\") equals 0.5-0.13973j.\n"
......@@ -979,6 +1004,7 @@ static char *help_impower = {
"IMPOWER returns a complex number raised to a power. @inumber is "
"the complex number to be raised to a power and @number is the "
"power to which you want to raise the complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMPOWER(\"4-j\",2) equals 15-8j.\n"
......@@ -1012,6 +1038,7 @@ static char *help_imdiv = {
"@SYNTAX=IMDIV(inumber,inumber)\n"
"@DESCRIPTION="
"IMDIV returns the quotient of two complex numbers."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMDIV(\"2-j\",\"2+j\") equals 0.6-0.8j.\n"
......@@ -1045,6 +1072,7 @@ static char *help_imsin = {
"@SYNTAX=IMSIN(inumber)\n"
"@DESCRIPTION="
"IMSIN returns the sine of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMSIN(\"1+j\") equals 1.29846+0.63496j.\n"
......@@ -1072,6 +1100,7 @@ static char *help_imsqrt = {
"@SYNTAX=IMSQRT(inumber)\n"
"@DESCRIPTION="
"IMSQRT returns the square root of a complex number."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMSQRT(\"1+j\") equals 1.09868+0.4550899j.\n"
......@@ -1099,6 +1128,7 @@ static char *help_imsub = {
"@SYNTAX=IMSUB(inumber,inumber)\n"
"@DESCRIPTION="
"IMSUB returns the difference of two complex numbers."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMSUB(\"3-j\",\"2+j\") equals 1-2j.\n"
......@@ -1129,6 +1159,7 @@ static char *help_improduct = {
"@SYNTAX=IMPRODUCT(inumber1[,inumber2,...])\n"
"@DESCRIPTION="
"IMPRODUCT returns the product of given complex numbers."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMPRODUCT(\"2-j\",\"4-2j\") equals 6-8j.\n"
......@@ -1198,6 +1229,7 @@ static char *help_imsum = {
"@SYNTAX=IMSUM(inumber,inumber)\n"
"@DESCRIPTION="
"IMSUM returns the sum of two complex numbers."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"IMSUM(\"2-4j\",\"9-j\") equals 11-5j.\n"
......@@ -1315,6 +1347,7 @@ static char *help_convert = {
"\n"
"If @from_unit and @to_unit are different types, CONVERT returns "
"#NUM! error. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"CONVERT(3,\"lbm\",\"g\") equals 1360.7769.\n"
......@@ -1633,6 +1666,7 @@ static char *help_erf = {
"#VALUE! error is returned. "
"If either @lower_limit or @upper_limit are < 0 a #NUM! error "
"is returned."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"ERF(0.4) equals 0.428392355.\n"
......@@ -1671,7 +1705,6 @@ static char *help_erfc = {
"The ERFC function returns the integral of the complimentary "
"error function between the limits 0 and @x."
"\n"
"If @x is not numeric a #VALUE! error is returned. "
"If @x < 0 a #NUM! error is returned."
"\n"
......@@ -1702,8 +1735,8 @@ static char *help_delta = {
"arguments returning 1 in equality "
"@y is optional, and defaults to 0."
"\n"
"If either argument is non-numeric returns a #VALUE! error."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"DELTA(42.99,43) equals 0.\n"
......@@ -1753,12 +1786,12 @@ gnumeric_delta (FunctionEvalInfo *ei, Value **argv)
static char *help_gestep = {
N_("@FUNCTION=GESTEP\n"
"@SYNTAX=GESTEP(x[,y])\n"
"@DESCRIPTION="
"The GESTEP function test for if @x is >= @y, returning 1 if it "
"GESTEP function test for if @x is >= @y, returning 1 if it "
"is so, and 0 otherwise @y is optional, and defaults to 0."
"\n"
"If either argument is non-numeric returns a #VALUE! error."
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"GESTEP(5,4) equals 1.\n"
......
......@@ -581,7 +581,8 @@ gnumeric_disc (FunctionEvalInfo *ei, Value **argv)
static char *help_effect = {
N_("@FUNCTION=EFFECT\n"
"@SYNTAX=EFFECT(r,nper)\n"
"@DESCRIPTION=Calculates the effective interest rate from "
"@DESCRIPTION="
"EFFECT calculates the effective interest rate from "
"a given nominal rate.\n"
"Effective interest rate is calculated using this formulae:\n"
"\n"
......@@ -631,7 +632,8 @@ gnumeric_effect (FunctionEvalInfo *ei, Value **argv)
static char *help_nominal = {
N_("@FUNCTION=NOMINAL\n"
"@SYNTAX=NOMINAL(r,nper)\n"
"@DESCRIPTION=Calculates the nominal interest rate from "
"@DESCRIPTION="
"NOMINAL calculates the nominal interest rate from "
"a given effective rate.\n"
"Nominal interest rate is given by a formula:\n"
"\n"
......@@ -704,7 +706,7 @@ static char *help_db = {
N_("@FUNCTION=DB\n"
"@SYNTAX=DB(cost,salvage,life,period[,month])\n"
"@DESCRIPTION="
"DB returns the depreciation of an asset for a given period "
"DB calculates the depreciation of an asset for a given period "
"using the fixed-declining balance method. @cost is the "
"initial value of the asset. @salvage after the depreciation. "
"@life is the number of periods overall. @period is the period "
......@@ -806,7 +808,8 @@ static char *help_sln = {
N_("@FUNCTION=SLN\n"
"@SYNTAX=SLN(cost,salvage_value,life)\n"
"@DESCRIPTION=Calculates the straight line depriciation for an "
"@DESCRIPTION="
"SLN calculates the straight line depriciation for an "
"asset based on its cost, salvage value and anticipated life."
"\n"
"Formula for straight line depriciation is:"
......@@ -847,7 +850,7 @@ static char *help_syd = {
"@SYNTAX=SYD(cost,salvage_value,life,period)\n"
"@DESCRIPTION="
"Calculates the sum-of-years digits depriciation for an "
"SYD calculates the sum-of-years digits depriciation for an "
"asset based on its cost, salvage value, anticipated life and a "
"particular period."
"\n"
......@@ -891,7 +894,8 @@ gnumeric_syd (FunctionEvalInfo *ei, Value **argv)
static char *help_dollarde = {
N_("@FUNCTION=DOLLARDE\n"
"@SYNTAX=DOLLARDE(fractional_dollar,fraction)\n"
"@DESCRIPTION=DOLLARDE converts a dollar price expressed as a "
"@DESCRIPTION="
"DOLLARDE converts a dollar price expressed as a "
"fraction into a dollar price expressed as a decimal number. "
"\n"
"If @fraction is non-integer it is truncated. "
......@@ -932,7 +936,8 @@ gnumeric_dollarde (FunctionEvalInfo *ei, Value **argv)
static char *help_dollarfr = {
N_("@FUNCTION=DOLLARFR\n"
"@SYNTAX=DOLLARFR(decimal_dollar,fraction)\n"
"@DESCRIPTION=DOLLARFR converts a decimal dollar price into "
"@DESCRIPTION="
"DOLLARFR converts a decimal dollar price into "
"a dollar price expressed as a fraction. "
"\n"
"If @fraction is non-integer it is truncated. "
......@@ -1148,7 +1153,8 @@ gnumeric_tbillyield (FunctionEvalInfo *ei, Value **argv)
static char *help_rate = {
N_("@FUNCTION=RATE\n"
"@SYNTAX=RATE(nper,pmt,pv[,fv,type,guess])\n"
"@DESCRIPTION=Calculates rate of an investment."
"@DESCRIPTION="
"RATE calculates rate of an investment."
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -1251,7 +1257,8 @@ gnumeric_rate (FunctionEvalInfo *ei, Value **argv)
static char *help_pv = {
N_("@FUNCTION=PV\n"
"@SYNTAX=PV(rate,nper,pmt,fv,type)\n"
"@DESCRIPTION=Calculates the present value of an investment."
"@DESCRIPTION="
"PV calculates the present value of an investment."
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -1290,10 +1297,11 @@ static char *help_npv = {
"@DESCRIPTION="
"NPV calculates the net present value of an investment generating "
"peridic payments. @rate is the periodic interest rate and "
"@v1, @v2, ... are the periodic payments. If the schedule of the "
"@v1, @v2, ... are the periodic payments. If the schedule of the "
"cash flows are not periodic use the XNPV function. "
"\n"
"@EXAMPLES=\n"
"NPV(0.17,-10000,3340,2941,2493,3233,1732,2932) equals 186.30673.\n"
"\n"
"@SEEALSO=PV,XNPV")
};
......@@ -1397,7 +1405,8 @@ gnumeric_xnpv (FunctionEvalInfo *ei, Value **argv)
static char *help_fv = {
N_("@FUNCTION=FV\n"
"@SYNTAX=FV(rate,nper,pmt,pv,type)\n"
"@DESCRIPTION=Calculates the future value of an investment."
"@DESCRIPTION="
"FV calculates the future value of an investment."
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -1429,7 +1438,8 @@ gnumeric_fv (FunctionEvalInfo *ei, Value **argv)
static char *help_pmt = {
N_("@FUNCTION=PMT\n"
"@SYNTAX=PMT(rate,nper,pv[,fv,type])\n"
"@DESCRIPTION=Calculates the present value of an investment."
"@DESCRIPTION="
"PMT calculates the present value of an investment."
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -1463,7 +1473,7 @@ static char *help_ipmt = {
N_("@FUNCTION=IPMT\n"
"@SYNTAX=IPMT(rate,per,nper,pv,fv,type)\n"
"@DESCRIPTION="
"Calculates the amount of a payment of an annuity going "
"IPMT calculates the amount of a payment of an annuity going "
"towards interest."
"\n"
"Formula for IPMT is:\n"
......@@ -1517,7 +1527,7 @@ static char *help_ppmt = {
N_("@FUNCTION=PPMT\n"
"@SYNTAX=PPMT(rate,per,nper,pv[,fv,type])\n"
"@DESCRIPTION="
"Calculates the amount of a payment of an annuity going "
"PPMT calculates the amount of a payment of an annuity going "
"towards principal."
"\n"
"Formula for it is:"
......@@ -1571,7 +1581,8 @@ gnumeric_ppmt (FunctionEvalInfo *ei, Value **argv)
static char *help_nper = {
N_("@FUNCTION=NPER\n"
"@SYNTAX=NPER(rate,pmt,pv,fv,type)\n"
"@DESCRIPTION=Calculates number of periods of an investment."
"@DESCRIPTION="
"NPER calculates number of periods of an investment."
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -1607,7 +1618,7 @@ static char *help_duration = {
N_("@FUNCTION=DURATION\n"
"@SYNTAX=DURATION(rate,pv,fv)\n"
"@DESCRIPTION="
"Calculates number of periods needed for an investment to "
"DURATION calculates number of periods needed for an investment to "
"attain a desired value. This function is similar to FV and PV "
"with a difference that we do not need give the direction of "
"cash flows e.g. -100 for a cash outflow and +100 for a cash "
......@@ -1648,6 +1659,9 @@ static char *help_fvschedule = {
"after applying a series of compound periodic interest rates. "
"\n"
"@EXAMPLES=\n"
"Let us assume that the cells A1, A2, ..., A5 contain interest "
"rates 0.11, 0.13, 0.09, 0.17, and 0.03. Then\n"
"FVSCHEDULE(3000,A1:A5) equals 4942.7911611."
"\n"
"@SEEALSO=PV,FV")
};
......
......@@ -69,7 +69,8 @@ static char *help_cell = {
"@SYNTAX=CELL()\n"
"@DESCRIPTION="
"CELL Returns information about the formatting, location, or contents of a cell. "
"CELL returns information about the formatting, location, or "
"contents of a cell. "
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -217,6 +218,7 @@ static char *help_countblank = {
"@DESCRIPTION="
"COUNTBLANK returns the number of blank cells in a @range. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -233,7 +235,7 @@ gnumeric_countblank (FunctionEvalInfo *ei, Value **args)
int count;
range = args[0];
sheet = eval_sheet (range->v.cell_range.cell_a.sheet, ei->pos.sheet);
sheet = eval_sheet (ei->pos.sheet, ei->pos.sheet);
col_a = range->v.cell_range.cell_a.col;
col_b = range->v.cell_range.cell_b.col;
row_a = range->v.cell_range.cell_a.row;
......@@ -256,6 +258,7 @@ static char *help_info = {
"@DESCRIPTION="
"INFO returns information about the current operating environment. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"\n"
......@@ -280,10 +283,10 @@ gnumeric_info (FunctionEvalInfo *ei, Value **argv)
/* Number of active worksheets. */
return value_new_int (1); /* Good enough... */
} else if (!strcasecmp (info_type, "origin")) {
/* Absolute A1-style reference, as text, prepended with "$A:" for
* Lotus 1-2-3 release 3.x compatibility. Returns the cell
* reference of the top and leftmost cell visible in the window,
* based on the current scrolling position.
/* Absolute A1-style reference, as text, prepended with "$A:"
* for Lotus 1-2-3 release 3.x compatibility. Returns the cell
* reference of the top and leftmost cell visible in the
* window, based on the current scrolling position.
*/
return value_new_error (&ei->pos, _("Unimplemented"));
} else if (!strcasecmp (info_type, "osversion")) {
......@@ -291,7 +294,8 @@ gnumeric_info (FunctionEvalInfo *ei, Value **argv)
struct utsname unamedata;
if (uname (&unamedata) == -1)
return value_new_error (&ei->pos, _("Unknown version"));
return value_new_error (&ei->pos,
_("Unknown version"));
else {
char *tmp = g_strdup_printf (_("%s version %s"),
unamedata.sysname,
......@@ -326,12 +330,234 @@ gnumeric_info (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_iserror = {
N_("@FUNCTION=ISERROR\n"
"@SYNTAX=ISERROR(exp)\n"
"@DESCRIPTION="
"ISERROR returns a TRUE value if the expression has an error\n"
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"\n"
"@SEEALSO=ERROR")
};
/* A utility routine to evaluate a single argument and return any errors
* directly
*/
static Value *
gnumeric_check_for_err (FunctionEvalInfo *eval_info, GList *expr_node_list,
Value ** err)
{
Value * tmp;
if (g_list_length (expr_node_list) != 1) {
*err = value_new_error(&eval_info->pos,
_("Argument mismatch"));
return NULL;
}
tmp = eval_expr (eval_info, (ExprTree *) expr_node_list->data);
if (tmp != NULL) {
if (tmp->type == VALUE_ERROR)
return tmp;
value_release (tmp);
}
return NULL;
}
static Value *
gnumeric_iserror (FunctionEvalInfo *eval_info, GList *expr_node_list)
{
Value * res, *err = NULL;
res = gnumeric_check_for_err (eval_info, expr_node_list, &err);
if (err != NULL)
return err;
if (res) {
value_release (res);
return value_new_bool (TRUE);
} else
return value_new_bool (FALSE);
}
/***************************************************************************/
static char *help_isna = {
N_("@FUNCTION=ISNA\n"
"@SYNTAX=ISNA()\n"
"@DESCRIPTION="
"ISNA returns TRUE if the value is the #N/A error value. "
"This function is Excel compatible. "
"\n"
"@EXAMPLES=\n"
"\n"
"@SEEALSO=")
};
/*
* We need to operator directly in the input expression in order to bypass
* the error handling mechanism
*/
static Value *
gnumeric_isna (FunctionEvalInfo *eval_info, GList *expr_node_list)
{
Value * res, *err = NULL;
gboolean b;
res = gnumeric_check_for_err (eval_info, expr_node_list, &err);
if (err != NULL)
return err;
b = (res && !strcmp (gnumeric_err_NA, res->v.error.mesg->str));