Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
gnumeric
Commits
37db24da
Commit
37db24da
authored
Mar 11, 1999
by
Michael Meeks
Browse files
Cleaned OLE debug, and 2 statistics functions.
parent
dd952f1e
Changes
9
Hide whitespace changes
Inline
Side-by-side
ChangeLog-1999-07-09
View file @
37db24da
1999-03-11 Michael Meeks <michael@imaginator.com>
* src/fn-stat.c (gnumeric_expondist, gnumeric_geomean):
Implemented.
1999-03-10 Vladimir Vuksan (vuksan@veus.hr)
* src/fn-financial.c: New file.
...
...
ChangeLog-2000-02-23
View file @
37db24da
1999-03-11 Michael Meeks <michael@imaginator.com>
* src/fn-stat.c (gnumeric_expondist, gnumeric_geomean):
Implemented.
1999-03-10 Vladimir Vuksan (vuksan@veus.hr)
* src/fn-financial.c: New file.
...
...
OChangeLog-1999-07-09
View file @
37db24da
1999-03-11 Michael Meeks <michael@imaginator.com>
* src/fn-stat.c (gnumeric_expondist, gnumeric_geomean):
Implemented.
1999-03-10 Vladimir Vuksan (vuksan@veus.hr)
* src/fn-financial.c: New file.
...
...
OChangeLog-2000-02-23
View file @
37db24da
1999-03-11 Michael Meeks <michael@imaginator.com>
* src/fn-stat.c (gnumeric_expondist, gnumeric_geomean):
Implemented.
1999-03-10 Vladimir Vuksan (vuksan@veus.hr)
* src/fn-financial.c: New file.
...
...
plugins/excel/ChangeLog
View file @
37db24da
1999-03-11 Michael Meeks <michael@imaginator.com>
* ms-ole.c (ms_ole_destroy, ms_ole_new): Killed debug
output before we are sure its an OLE file.
1999-03-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* ms-excel.c (find_workbook): Use g_strncasecmp here.
...
...
plugins/excel/ms-ole.c
View file @
37db24da
...
...
@@ -491,7 +491,8 @@ ms_ole_new (const char *name)
int
file
;
MS_OLE
*
f
;
printf
(
"New OLE file '%s'
\n
"
,
name
);
if
(
OLE_DEBUG
>
0
)
printf
(
"New OLE file '%s'
\n
"
,
name
);
f
=
g_new0
(
MS_OLE
,
1
);
f
->
file_descriptor
=
file
=
open
(
name
,
O_RDWR
);
...
...
@@ -509,19 +510,19 @@ ms_ole_new (const char *name)
g_free
(
f
)
;
return
0
;
}
if
(
f
->
length
%
BB_BLOCK_SIZE
)
printf
(
"Warning file '%s':%d non-integer number of blocks
\n
"
,
name
,
f
->
length
);
f
->
mem
=
mmap
(
0
,
f
->
length
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
file
,
0
);
if
(
GET_GUINT32
(
f
->
mem
)
!=
0xe011cfd0
||
GET_GUINT32
(
f
->
mem
+
4
)
!=
0xe11ab1a1
)
{
printf
(
"Failed magic number %x %x
\n
"
,
printf
(
"Failed
OLE2
magic number %x %x
\n
"
,
GET_GUINT32
(
f
->
mem
),
GET_GUINT32
(
f
->
mem
+
4
));
ms_ole_destroy
(
f
);
return
0
;
}
if
(
f
->
length
%
BB_BLOCK_SIZE
)
printf
(
"Warning file '%s':%d non-integer number of blocks
\n
"
,
name
,
f
->
length
);
if
(
!
ms_ole_analyse
(
f
))
{
printf
(
"Directory error
\n
"
);
...
...
@@ -538,7 +539,8 @@ ms_ole_new (const char *name)
void
ms_ole_destroy
(
MS_OLE
*
f
)
{
printf
(
"FIXME: should truncate to remove unused blocks
\n
"
);
if
(
OLE_DEBUG
>
0
)
printf
(
"FIXME: should truncate to remove unused blocks
\n
"
);
if
(
f
)
{
munmap
(
f
->
mem
,
f
->
length
);
...
...
@@ -552,10 +554,9 @@ ms_ole_destroy (MS_OLE *f)
g_free
(
f
->
header
.
sbf_list
);
g_free
(
f
);
printf
(
"Closing file
\n
"
);
if
(
OLE_DEBUG
>
0
)
printf
(
"Closing OLE file
\n
"
);
}
else
printf
(
"Closing NULL file
\n
"
);
}
static
void
...
...
plugins/fn-stat/functions.c
View file @
37db24da
...
...
@@ -187,7 +187,111 @@ gnumeric_stdevp (void *tsheet, GList *expr_node_list, int eval_col, int eval_row
return
ans
;
}
static
char
*
help_geomean
=
{
N_
(
"@FUNCTION=GEOMEAN
\n
"
"@SYNTAX=GEOMEAN(b1, b2, ...)
\n
"
"@DESCRIPTION="
"GEOMEAN returns the geometric mean of the N data"
"This is equal to the Nth root of the product of the terms"
"
\n
"
"Performing this function on a string or empty cell simply does nothing."
"
\n
"
"@SEEALSO=MEDIAN,MEAN,MODE"
)
};
typedef
struct
{
int
first
;
guint32
num
;
float_t
product
;
}
stat_prod_t
;
static
int
callback_function_stat_prod
(
Sheet
*
sheet
,
Value
*
value
,
char
**
error_string
,
void
*
closure
)
{
stat_prod_t
*
mm
=
closure
;
switch
(
value
->
type
){
case
VALUE_INTEGER
:
mm
->
num
++
;
mm
->
product
=
mm
->
first
?
value
->
v
.
v_int
:
mm
->
product
*
value
->
v
.
v_int
;
break
;
case
VALUE_FLOAT
:
mm
->
num
++
;
mm
->
product
=
mm
->
first
?
value
->
v
.
v_float
:
mm
->
product
*
value
->
v
.
v_float
;
break
;
default:
/* ignore strings */
break
;
}
mm
->
first
=
FALSE
;
return
TRUE
;
}
static
Value
*
gnumeric_geomean
(
void
*
tsheet
,
GList
*
expr_node_list
,
int
eval_col
,
int
eval_row
,
char
**
error_string
)
{
stat_prod_t
pr
;
Sheet
*
sheet
=
(
Sheet
*
)
tsheet
;
float_t
ans
,
num
;
pr
.
first
=
TRUE
;
pr
.
num
=
0
;
pr
.
product
=
0
.
0
;
function_iterate_argument_values
(
sheet
,
callback_function_stat_prod
,
&
pr
,
expr_node_list
,
eval_col
,
eval_row
,
error_string
);
num
=
(
float_t
)
pr
.
num
;
return
value_float
(
pow
(
pr
.
product
,
1
.
0
/
num
))
;
}
static
char
*
help_expondist
=
{
N_
(
"@FUNCTION=EXPONDIST
\n
"
"@SYNTAX=EXPONDIST(x,y,cumulative)
\n
"
"@DESCRIPTION="
"The EXPONDIST function returns the exponential distribution "
"If the cumulative boolean is false it will return: "
"y * exp (-y*x), otherwise it will return 1 - exp (-y*x). "
"If x<0 or y<=0 this will return an error"
"
\n
"
"Performing this function on a string or empty cell simply does nothing. "
"
\n
"
"@SEEALSO=POISSON"
)
};
static
Value
*
gnumeric_expondist
(
struct
FunctionDefinition
*
i
,
Value
*
argv
[],
char
**
error_string
)
{
float_t
x
,
y
;
int
cuml
,
err
=
0
;
x
=
value_get_as_double
(
argv
[
0
]);
y
=
value_get_as_double
(
argv
[
1
]);
if
(
x
<
0
.
0
||
y
<=
0
.
0
)
{
*
error_string
=
_
(
"expondist - range error"
);
return
NULL
;
}
cuml
=
value_get_bool
(
argv
[
2
],
&
err
)
;
if
(
err
)
{
*
error_string
=
_
(
"expondist - cumulative?"
);
return
NULL
;
}
if
(
cuml
)
{
return
value_float
(
1
.
0
-
exp
(
-
y
*
x
))
;
}
else
{
return
value_float
(
y
*
exp
(
-
y
*
x
))
;
}
}
FunctionDefinition
stat_functions
[]
=
{
{
"expondist"
,
"ffb"
,
""
,
&
help_expondist
,
NULL
,
gnumeric_expondist
},
{
"geomean"
,
0
,
""
,
&
help_geomean
,
gnumeric_geomean
,
NULL
},
{
"stdev"
,
0
,
""
,
&
help_stdev
,
gnumeric_stdev
,
NULL
},
{
"stdevp"
,
0
,
""
,
&
help_stdevp
,
gnumeric_stdevp
,
NULL
},
{
"var"
,
0
,
""
,
&
help_var
,
gnumeric_var
,
NULL
},
...
...
src/fn-stat.c
View file @
37db24da
...
...
@@ -187,7 +187,111 @@ gnumeric_stdevp (void *tsheet, GList *expr_node_list, int eval_col, int eval_row
return
ans
;
}
static
char
*
help_geomean
=
{
N_
(
"@FUNCTION=GEOMEAN
\n
"
"@SYNTAX=GEOMEAN(b1, b2, ...)
\n
"
"@DESCRIPTION="
"GEOMEAN returns the geometric mean of the N data"
"This is equal to the Nth root of the product of the terms"
"
\n
"
"Performing this function on a string or empty cell simply does nothing."
"
\n
"
"@SEEALSO=MEDIAN,MEAN,MODE"
)
};
typedef
struct
{
int
first
;
guint32
num
;
float_t
product
;
}
stat_prod_t
;
static
int
callback_function_stat_prod
(
Sheet
*
sheet
,
Value
*
value
,
char
**
error_string
,
void
*
closure
)
{
stat_prod_t
*
mm
=
closure
;
switch
(
value
->
type
){
case
VALUE_INTEGER
:
mm
->
num
++
;
mm
->
product
=
mm
->
first
?
value
->
v
.
v_int
:
mm
->
product
*
value
->
v
.
v_int
;
break
;
case
VALUE_FLOAT
:
mm
->
num
++
;
mm
->
product
=
mm
->
first
?
value
->
v
.
v_float
:
mm
->
product
*
value
->
v
.
v_float
;
break
;
default:
/* ignore strings */
break
;
}
mm
->
first
=
FALSE
;
return
TRUE
;
}
static
Value
*
gnumeric_geomean
(
void
*
tsheet
,
GList
*
expr_node_list
,
int
eval_col
,
int
eval_row
,
char
**
error_string
)
{
stat_prod_t
pr
;
Sheet
*
sheet
=
(
Sheet
*
)
tsheet
;
float_t
ans
,
num
;
pr
.
first
=
TRUE
;
pr
.
num
=
0
;
pr
.
product
=
0
.
0
;
function_iterate_argument_values
(
sheet
,
callback_function_stat_prod
,
&
pr
,
expr_node_list
,
eval_col
,
eval_row
,
error_string
);
num
=
(
float_t
)
pr
.
num
;
return
value_float
(
pow
(
pr
.
product
,
1
.
0
/
num
))
;
}
static
char
*
help_expondist
=
{
N_
(
"@FUNCTION=EXPONDIST
\n
"
"@SYNTAX=EXPONDIST(x,y,cumulative)
\n
"
"@DESCRIPTION="
"The EXPONDIST function returns the exponential distribution "
"If the cumulative boolean is false it will return: "
"y * exp (-y*x), otherwise it will return 1 - exp (-y*x). "
"If x<0 or y<=0 this will return an error"
"
\n
"
"Performing this function on a string or empty cell simply does nothing. "
"
\n
"
"@SEEALSO=POISSON"
)
};
static
Value
*
gnumeric_expondist
(
struct
FunctionDefinition
*
i
,
Value
*
argv
[],
char
**
error_string
)
{
float_t
x
,
y
;
int
cuml
,
err
=
0
;
x
=
value_get_as_double
(
argv
[
0
]);
y
=
value_get_as_double
(
argv
[
1
]);
if
(
x
<
0
.
0
||
y
<=
0
.
0
)
{
*
error_string
=
_
(
"expondist - range error"
);
return
NULL
;
}
cuml
=
value_get_bool
(
argv
[
2
],
&
err
)
;
if
(
err
)
{
*
error_string
=
_
(
"expondist - cumulative?"
);
return
NULL
;
}
if
(
cuml
)
{
return
value_float
(
1
.
0
-
exp
(
-
y
*
x
))
;
}
else
{
return
value_float
(
y
*
exp
(
-
y
*
x
))
;
}
}
FunctionDefinition
stat_functions
[]
=
{
{
"expondist"
,
"ffb"
,
""
,
&
help_expondist
,
NULL
,
gnumeric_expondist
},
{
"geomean"
,
0
,
""
,
&
help_geomean
,
gnumeric_geomean
,
NULL
},
{
"stdev"
,
0
,
""
,
&
help_stdev
,
gnumeric_stdev
,
NULL
},
{
"stdevp"
,
0
,
""
,
&
help_stdevp
,
gnumeric_stdevp
,
NULL
},
{
"var"
,
0
,
""
,
&
help_var
,
gnumeric_var
,
NULL
},
...
...
src/functions/fn-stat.c
View file @
37db24da
...
...
@@ -187,7 +187,111 @@ gnumeric_stdevp (void *tsheet, GList *expr_node_list, int eval_col, int eval_row
return
ans
;
}
static
char
*
help_geomean
=
{
N_
(
"@FUNCTION=GEOMEAN
\n
"
"@SYNTAX=GEOMEAN(b1, b2, ...)
\n
"
"@DESCRIPTION="
"GEOMEAN returns the geometric mean of the N data"
"This is equal to the Nth root of the product of the terms"
"
\n
"
"Performing this function on a string or empty cell simply does nothing."
"
\n
"
"@SEEALSO=MEDIAN,MEAN,MODE"
)
};
typedef
struct
{
int
first
;
guint32
num
;
float_t
product
;
}
stat_prod_t
;
static
int
callback_function_stat_prod
(
Sheet
*
sheet
,
Value
*
value
,
char
**
error_string
,
void
*
closure
)
{
stat_prod_t
*
mm
=
closure
;
switch
(
value
->
type
){
case
VALUE_INTEGER
:
mm
->
num
++
;
mm
->
product
=
mm
->
first
?
value
->
v
.
v_int
:
mm
->
product
*
value
->
v
.
v_int
;
break
;
case
VALUE_FLOAT
:
mm
->
num
++
;
mm
->
product
=
mm
->
first
?
value
->
v
.
v_float
:
mm
->
product
*
value
->
v
.
v_float
;
break
;
default:
/* ignore strings */
break
;
}
mm
->
first
=
FALSE
;
return
TRUE
;
}
static
Value
*
gnumeric_geomean
(
void
*
tsheet
,
GList
*
expr_node_list
,
int
eval_col
,
int
eval_row
,
char
**
error_string
)
{
stat_prod_t
pr
;
Sheet
*
sheet
=
(
Sheet
*
)
tsheet
;
float_t
ans
,
num
;
pr
.
first
=
TRUE
;
pr
.
num
=
0
;
pr
.
product
=
0
.
0
;
function_iterate_argument_values
(
sheet
,
callback_function_stat_prod
,
&
pr
,
expr_node_list
,
eval_col
,
eval_row
,
error_string
);
num
=
(
float_t
)
pr
.
num
;
return
value_float
(
pow
(
pr
.
product
,
1
.
0
/
num
))
;
}
static
char
*
help_expondist
=
{
N_
(
"@FUNCTION=EXPONDIST
\n
"
"@SYNTAX=EXPONDIST(x,y,cumulative)
\n
"
"@DESCRIPTION="
"The EXPONDIST function returns the exponential distribution "
"If the cumulative boolean is false it will return: "
"y * exp (-y*x), otherwise it will return 1 - exp (-y*x). "
"If x<0 or y<=0 this will return an error"
"
\n
"
"Performing this function on a string or empty cell simply does nothing. "
"
\n
"
"@SEEALSO=POISSON"
)
};
static
Value
*
gnumeric_expondist
(
struct
FunctionDefinition
*
i
,
Value
*
argv
[],
char
**
error_string
)
{
float_t
x
,
y
;
int
cuml
,
err
=
0
;
x
=
value_get_as_double
(
argv
[
0
]);
y
=
value_get_as_double
(
argv
[
1
]);
if
(
x
<
0
.
0
||
y
<=
0
.
0
)
{
*
error_string
=
_
(
"expondist - range error"
);
return
NULL
;
}
cuml
=
value_get_bool
(
argv
[
2
],
&
err
)
;
if
(
err
)
{
*
error_string
=
_
(
"expondist - cumulative?"
);
return
NULL
;
}
if
(
cuml
)
{
return
value_float
(
1
.
0
-
exp
(
-
y
*
x
))
;
}
else
{
return
value_float
(
y
*
exp
(
-
y
*
x
))
;
}
}
FunctionDefinition
stat_functions
[]
=
{
{
"expondist"
,
"ffb"
,
""
,
&
help_expondist
,
NULL
,
gnumeric_expondist
},
{
"geomean"
,
0
,
""
,
&
help_geomean
,
gnumeric_geomean
,
NULL
},
{
"stdev"
,
0
,
""
,
&
help_stdev
,
gnumeric_stdev
,
NULL
},
{
"stdevp"
,
0
,
""
,
&
help_stdevp
,
gnumeric_stdevp
,
NULL
},
{
"var"
,
0
,
""
,
&
help_var
,
gnumeric_var
,
NULL
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment