Commit c87a2cd1 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

cleanup handling of 'int' and fix handling of between.

2002-03-08  Jody Goldberg <jody@gnome.org>

	* src/validation.c (validation_eval) : cleanup handling of 'int'
	and fix handling of between.

2002-03-08  Jody Goldberg <jody@gnome.org>

	* src/eval.h : Add DEPENDENT_ALWAYS_UNLINK.
	  and the as yet unused DEPENDENT_HAS_3D.

	* src/io-context.c (gnm_io_warning) : new stub.
	(gnm_io_warning_unknown_font) : ditto.
	(gnm_io_warning_unknown_function) : ditto.
	(gnm_io_warning_unsupported_feature) : ditto.

	* src/func.c (function_def_get_full_info_if_needed) :  add
	  link/unlink.

	* src/plugin-service.c
	(plugin_service_function_group_get_full_info_callback) : add
	  link/unlink.  This is a terrible interface.  Why not just make the
	  thing into the FunctionDescriptor.
	* src/plugin-loader-module.c
	(gnumeric_plugin_loader_module_func_get_full_function_info) : ditto.

2002-03-08  Jody Goldberg <jody@gnome.org>

	* src/xml-io.c (xml_write_print_info) : handle missing paper so that
	  we can save again.

	* templates/autoformat/autoformat.3D.button.xml : fix.

	* plugins/Makefile.am (SUBDIRS) : add sample_datasource.
parent 394d8993
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/validation.c (validation_eval) : cleanup handling of 'int'
and fix handling of between.
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/eval.h : Add DEPENDENT_ALWAYS_UNLINK.
and the as yet unused DEPENDENT_HAS_3D.
* src/io-context.c (gnm_io_warning) : new stub.
(gnm_io_warning_unknown_font) : ditto.
(gnm_io_warning_unknown_function) : ditto.
(gnm_io_warning_unsupported_feature) : ditto.
* src/func.c (function_def_get_full_info_if_needed) : add
link/unlink.
* src/plugin-service.c
(plugin_service_function_group_get_full_info_callback) : add
link/unlink. This is a terrible interface. Why not just make the
thing into the FunctionDescriptor.
* src/plugin-loader-module.c
(gnumeric_plugin_loader_module_func_get_full_function_info) : ditto.
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/xml-io.c (xml_write_print_info) : handle missing paper so that
we can save again.
* templates/autoformat/autoformat.3D.button.xml : fix.
* plugins/Makefile.am (SUBDIRS) : add sample_datasource.
2002-03-07 Jody Goldberg <jody@gnome.org>
* src/plugin-loader-module.h (ModulePluginFunctionInfo) : add
'link' and 'unlink'.
2002-03-07 Jody Goldberg <jody@gnome.org>
* src/position.c (eval_pos_init*) : handle the optional dependent.
......
......@@ -58,11 +58,17 @@ Jody:
* improve xl import of images.
* start moving to utf8 internals.
* fix pango context leak.
* improve xl export.
* Implement hooks to support per instanace depends
* improve xl95 export.
* Implement hooks to support per instance depends
(eg data sources or INDIRECT)
* Fix formula guru.
* Initial pass at dumping the translated function docs into a manual.
* Cleanup name import from xls, and handling of fwd sheet decls in xl95.
* Move the font mapping into the core rather than at XL import.
* Cleanup the sheet's use of dependents.
* Improve dependent management.
* Prep for importing external references from XL.
* Better support for 3d references.
Jon Kåre:
* More correct import of "automatic" colors from Excel.
......
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/validation.c (validation_eval) : cleanup handling of 'int'
and fix handling of between.
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/eval.h : Add DEPENDENT_ALWAYS_UNLINK.
and the as yet unused DEPENDENT_HAS_3D.
* src/io-context.c (gnm_io_warning) : new stub.
(gnm_io_warning_unknown_font) : ditto.
(gnm_io_warning_unknown_function) : ditto.
(gnm_io_warning_unsupported_feature) : ditto.
* src/func.c (function_def_get_full_info_if_needed) : add
link/unlink.
* src/plugin-service.c
(plugin_service_function_group_get_full_info_callback) : add
link/unlink. This is a terrible interface. Why not just make the
thing into the FunctionDescriptor.
* src/plugin-loader-module.c
(gnumeric_plugin_loader_module_func_get_full_function_info) : ditto.
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/xml-io.c (xml_write_print_info) : handle missing paper so that
we can save again.
* templates/autoformat/autoformat.3D.button.xml : fix.
* plugins/Makefile.am (SUBDIRS) : add sample_datasource.
2002-03-07 Jody Goldberg <jody@gnome.org>
* src/plugin-loader-module.h (ModulePluginFunctionInfo) : add
'link' and 'unlink'.
2002-03-07 Jody Goldberg <jody@gnome.org>
* src/position.c (eval_pos_init*) : handle the optional dependent.
......
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/validation.c (validation_eval) : cleanup handling of 'int'
and fix handling of between.
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/eval.h : Add DEPENDENT_ALWAYS_UNLINK.
and the as yet unused DEPENDENT_HAS_3D.
* src/io-context.c (gnm_io_warning) : new stub.
(gnm_io_warning_unknown_font) : ditto.
(gnm_io_warning_unknown_function) : ditto.
(gnm_io_warning_unsupported_feature) : ditto.
* src/func.c (function_def_get_full_info_if_needed) : add
link/unlink.
* src/plugin-service.c
(plugin_service_function_group_get_full_info_callback) : add
link/unlink. This is a terrible interface. Why not just make the
thing into the FunctionDescriptor.
* src/plugin-loader-module.c
(gnumeric_plugin_loader_module_func_get_full_function_info) : ditto.
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/xml-io.c (xml_write_print_info) : handle missing paper so that
we can save again.
* templates/autoformat/autoformat.3D.button.xml : fix.
* plugins/Makefile.am (SUBDIRS) : add sample_datasource.
2002-03-07 Jody Goldberg <jody@gnome.org>
* src/plugin-loader-module.h (ModulePluginFunctionInfo) : add
'link' and 'unlink'.
2002-03-07 Jody Goldberg <jody@gnome.org>
* src/position.c (eval_pos_init*) : handle the optional dependent.
......
......@@ -36,7 +36,9 @@ typedef enum {
DEPENDENT_GOES_INTERSHEET = 0x00010000,
DEPENDENT_GOES_INTERBOOK = 0x00020000,
DEPENDENT_LINK_FLAGS = 0x0003f000
DEPENDENT_HAS_3D = 0x00040000,
DEPENDENT_ALWAYS_UNLINK = 0x00080000,
DEPENDENT_LINK_FLAGS = 0x000ff000
} DependentFlags;
#define dependent_type(dep) ((dep)->flags & DEPENDENT_TYPE_MASK)
......
......@@ -36,7 +36,9 @@ typedef enum {
DEPENDENT_GOES_INTERSHEET = 0x00010000,
DEPENDENT_GOES_INTERBOOK = 0x00020000,
DEPENDENT_LINK_FLAGS = 0x0003f000
DEPENDENT_HAS_3D = 0x00040000,
DEPENDENT_ALWAYS_UNLINK = 0x00080000,
DEPENDENT_LINK_FLAGS = 0x000ff000
} DependentFlags;
#define dependent_type(dep) ((dep)->flags & DEPENDENT_TYPE_MASK)
......
......@@ -260,13 +260,16 @@ function_def_get_full_info_if_needed (FunctionDefinition *fn_def)
gchar const *args;
gchar const *arg_names;
gchar const **help;
FunctionArgs *fn_args;
FunctionNodes *fn_nodes;
FunctionArgs fn_args;
FunctionNodes fn_nodes;
FuncLinkHandle fn_link;
FuncUnlinkHandle fn_unlink;
gboolean success;
success = fn_def->get_full_info_callback (
fn_def, &args, &arg_names, &help,
&fn_args, &fn_nodes);
&fn_args, &fn_nodes, &fn_link, &fn_unlink);
if (success) {
fn_def->named_arguments = arg_names;
fn_def->help = help;
......@@ -281,10 +284,14 @@ function_def_get_full_info_if_needed (FunctionDefinition *fn_def)
} else {
g_assert_not_reached ();
}
fn_def->link = fn_link;
fn_def->unlink = fn_unlink;
} else {
fn_def->named_arguments = "";
fn_def->fn_type = FUNCTION_NODES;
fn_def->fn.fn_nodes = &error_function_no_full_info;
fn_def->link = NULL;
fn_def->unlink = NULL;
}
}
}
......@@ -384,7 +391,7 @@ function_add_args (FunctionCategory *category,
char const *args,
char const *arg_names,
char const **help,
FunctionArgs *fn)
FunctionArgs fn)
{
static char const valid_tokens[] = "fsbraAS?|";
FunctionDefinition *fn_def;
......@@ -414,7 +421,7 @@ function_add_nodes (FunctionCategory *category,
char const *args,
char const *arg_names,
char const **help,
FunctionNodes *fn)
FunctionNodes fn)
{
FunctionDefinition *fn_def;
......
......@@ -76,8 +76,8 @@ typedef enum {
typedef enum { FUNCTION_ARGS, FUNCTION_NODES, FUNCTION_NAMEONLY } FuncType;
typedef Value *(FunctionArgs) (FunctionEvalInfo *ei, Value **args);
typedef Value *(FunctionNodes) (FunctionEvalInfo *ei, ExprList *nodes);
typedef Value *(*FunctionArgs) (FunctionEvalInfo *ei, Value **args);
typedef Value *(*FunctionNodes) (FunctionEvalInfo *ei, ExprList *nodes);
struct _FunctionEvalInfo {
EvalPos const *pos;
......@@ -90,8 +90,10 @@ typedef gboolean (*FunctionGetFullInfoCallback) (FunctionDefinition *fn_def,
gchar const **args_ptr,
gchar const **arg_names_ptr,
gchar const ***help_ptr,
FunctionArgs **fn_args_ptr,
FunctionNodes **fn_nodes_ptr);
FunctionArgs *fn_args_ptr,
FunctionNodes *fn_nodes_ptr,
FuncLinkHandle *link,
FuncUnlinkHandle *unlink);
struct _FunctionDefinition {
FunctionGetFullInfoCallback get_full_info_callback;
......@@ -101,10 +103,10 @@ struct _FunctionDefinition {
gchar const **help;
FuncType fn_type;
union {
FunctionNodes *fn_nodes;
FunctionNodes fn_nodes;
struct {
char const *arg_spec;
FunctionArgs *func;
FunctionArgs func;
int min_args, max_args;
char *arg_types;
} args;
......@@ -127,13 +129,13 @@ FunctionDefinition *function_add_args (FunctionCategory *category,
gchar const *args,
gchar const *arg_names,
gchar const **help,
FunctionArgs *fn);
FunctionArgs fn);
FunctionDefinition *function_add_nodes (FunctionCategory *category,
gchar const *name,
gchar const *args,
gchar const *arg_names,
gchar const **help,
FunctionNodes *fn);
FunctionNodes fn);
FunctionDefinition *function_add_name_only (FunctionCategory *category,
gchar const *name,
FunctionGetFullInfoCallback callback);
......
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* io-context.c : Place holder for an io error context.
* It is intended to become a place to handle errors
......@@ -7,7 +9,7 @@
* Jody Goldberg <jody@gnome.org>
* Zbigniew Chyla <cyba@gnome.pl>
*
* (C) 2000, 2001 Jody Goldberg
* (C) 2000-2002 Jody Goldberg
*/
#include <gnumeric-config.h>
#include "gnumeric.h"
......@@ -452,3 +454,25 @@ io_progress_unset (IOContext *io_context)
io_context->helper.helper_type = GNUM_PROGRESS_HELPER_NONE;
}
#warning Good Project implement these
void
gnm_io_warning (IOContext *context, char const *msg)
{
}
void
gnm_io_warning_unknown_font (IOContext *context, char const *font_name)
{
}
void
gnm_io_warning_unknown_function (IOContext *context, char const *funct_name)
{
}
void
gnm_io_warning_unsupported_feature (IOContext *context, char const *feature)
{
}
......@@ -65,8 +65,9 @@ void workbook_io_progress_update (IOContext *io_context, gint inc);
void io_progress_unset (IOContext *io_context);
void gnumeric_warning_unknown_font (IOContext *context, char const *msg);
void gnumeric_warning_unknown_feature (IOContext *context, char const *msg);
void gnumeric_warning_unknown_function (IOContext *context, char const *msg);
void gnm_io_warning (IOContext *context, char const *msg);
void gnm_io_warning_unknown_font (IOContext *context, char const *font_name);
void gnm_io_warning_unknown_function (IOContext *context, char const *funct_name);
void gnm_io_warning_unsupported_feature (IOContext *context, char const *feature);
#endif /* GNUMERIC_IO_CONTEXT_H */
......@@ -530,8 +530,10 @@ gnumeric_plugin_loader_module_func_get_full_function_info (PluginService *servic
const gchar **args_ptr,
const gchar **arg_names_ptr,
const gchar ***help_ptr,
FunctionArgs **fn_args_ptr,
FunctionNodes **fn_nodes_ptr)
FunctionArgs *fn_args_ptr,
FunctionNodes *fn_nodes_ptr,
FuncLinkHandle *fn_link,
FuncUnlinkHandle *fn_unlink)
{
ServiceLoaderDataFunctionGroup *loader_data;
gpointer func_index_ptr;
......@@ -550,6 +552,8 @@ gnumeric_plugin_loader_module_func_get_full_function_info (PluginService *servic
*help_ptr = fn_info->help;
*fn_args_ptr = fn_info->fn_args;
*fn_nodes_ptr = fn_info->fn_nodes;
*fn_link = fn_info->link;
*fn_unlink = fn_info->unlink;
return TRUE;
} else {
return FALSE;
......
......@@ -34,8 +34,10 @@ typedef struct {
gchar const *args;
gchar const *arg_names;
gchar const **help;
FunctionArgs *fn_args;
FunctionNodes *fn_nodes;
FunctionArgs fn_args;
FunctionNodes fn_nodes;
FuncLinkHandle link;
FuncUnlinkHandle unlink;
} ModulePluginFunctionInfo;
#endif /* GNUMERIC_PLUGIN_LOADER_MODULE_H */
......@@ -907,8 +907,10 @@ plugin_service_function_group_get_full_info_callback (FunctionDefinition *fn_def
const gchar **args_ptr,
const gchar **arg_names_ptr,
const gchar ***help_ptr,
FunctionArgs **fn_args_ptr,
FunctionNodes **fn_nodes_ptr)
FunctionArgs *fn_args_ptr,
FunctionNodes *fn_nodes_ptr,
FuncLinkHandle *fn_link_ptr,
FuncUnlinkHandle *fn_unlink_ptr)
{
PluginService *service;
PluginServiceFunctionGroup *service_function_group;
......@@ -920,20 +922,24 @@ plugin_service_function_group_get_full_info_callback (FunctionDefinition *fn_def
service_function_group = &service->t.function_group;
plugin_service_load (service, &error);
if (error == NULL) {
const gchar *args;
const gchar *arg_names;
const gchar **help;
FunctionArgs *fn_args;
FunctionNodes *fn_nodes;
const gchar *args;
const gchar *arg_names;
const gchar **help;
FunctionArgs fn_args;
FunctionNodes fn_nodes;
FuncLinkHandle fn_link;
FuncUnlinkHandle fn_unlink;
if (service_function_group->plugin_func_get_full_function_info (
service, function_def_get_name (fn_def),
&args, &arg_names, &help, &fn_args, &fn_nodes)) {
&args, &arg_names, &help, &fn_args, &fn_nodes, &fn_link, &fn_unlink)) {
*args_ptr = args;
*arg_names_ptr = arg_names;
*help_ptr = help;
*fn_args_ptr = fn_args;
*fn_nodes_ptr = fn_nodes;
*fn_args_ptr = fn_args;
*fn_nodes_ptr = fn_nodes;
*fn_link_ptr = fn_link;
*fn_unlink_ptr = fn_unlink;
return TRUE;
} else {
return FALSE;
......
......@@ -76,8 +76,10 @@ struct _PluginServiceFunctionGroup {
const gchar **args_ptr,
const gchar **arg_names_ptr,
const gchar ***help_ptr,
FunctionArgs **fn_args_ptr,
FunctionNodes **fn_nodes_ptr);
FunctionArgs *fn_args_ptr,
FunctionNodes *fn_nodes_ptr,
FuncLinkHandle *link,
FuncUnlinkHandle *unlink);
};
struct _PluginServicePluginLoader {
......
......@@ -149,13 +149,15 @@ validation_eval (WorkbookControl *wbc, MStyle const *mstyle,
case VALIDATION_TYPE_AS_INT :
case VALIDATION_TYPE_AS_NUMBER :
case VALIDATION_TYPE_AS_DATE : /* What the hell does this do */
case VALIDATION_TYPE_AS_DATE : /* What the hell does this do */
case VALIDATION_TYPE_AS_TIME : { /* What the hell does this do */
Value *res = NULL;
if (val->type == VALUE_ERROR)
/* we know it is not empty */
if (val->type == VALUE_ERROR) {
msg = g_strdup_printf (_("'%s' is an error"),
val->v_err.mesg->str);
else if (val->type == VALUE_STRING) {
break;
} else if (val->type == VALUE_STRING) {
res = format_match_number (val->v_str.val->str, NULL);
if (res == NULL) {
char const *fmt;
......@@ -167,25 +169,25 @@ validation_eval (WorkbookControl *wbc, MStyle const *mstyle,
} else
fmt = N_("'%s' is not a number");
msg = g_strdup_printf (_(fmt), val->v_str.val->str);
} else
val_expr = expr_tree_new_constant (res);
break;
}
} else
val_expr = expr_tree_new_constant (
value_duplicate (val));
if (val->type == VALUE_FLOAT) {
res = value_duplicate (val);
if (v->type == VALIDATION_TYPE_AS_INT &&
res != NULL && res->type == VALUE_FLOAT) {
gnum_float f = value_get_as_float (val);
gboolean isint = gnumabs (f - gnumeric_fake_round (f)) < 1e-10;
if (!isint) {
const char *valstr = value_peek_string (val);
char const *valstr = value_peek_string (val);
msg = g_strdup_printf (_("'%s' is not an integer"), valstr);
break;
}
}
/* FIXME: break or comment. */
#warning "Jody, why do we fall through here?"
}
val_expr = expr_tree_new_constant (res);
break;
}
case VALIDATION_TYPE_IN_LIST :
#warning TODO
......@@ -252,7 +254,8 @@ validation_eval (WorkbookControl *wbc, MStyle const *mstyle,
return VALIDATION_STATUS_VALID;
}
if (v->op == VALIDATION_OP_BETWEEN || v->op == VALIDATION_OP_NOT_BETWEEN) {
if ((v->op == VALIDATION_OP_BETWEEN && valid) ||
v->op == VALIDATION_OP_NOT_BETWEEN) {
g_return_val_if_fail (v->expr[1] != NULL, VALIDATION_STATUS_VALID);
expr_tree_ref (v->expr[1]);
......
......@@ -983,7 +983,8 @@ xml_write_print_info (XmlParseContext *ctxt, PrintInformation *pi)
xml_node_set_print_hf (cur, "Header", pi->header);
xml_node_set_print_hf (cur, "Footer", pi->footer);
xmlNewChild (cur, ctxt->ns, (xmlChar const *)"paper", (xmlChar const *)pi->paper->name);
if (pi->paper != NULL)
xmlNewChild (cur, ctxt->ns, (xmlChar const *)"paper", (xmlChar const *)pi->paper->name);
return cur;
}
......
<?xml version="1.0"?>
<gmr:FormatTemplate xmlns:gmr="http://www.gnome.org/gnumeric/format-template/v1">
<gmr:Information author="Gnumeric Team" name="Button" description="A button like template" category="3D"/>
<gmr:Members>
<gmr:Member>
<gmr:Row>
<gmr:Placement offset="0" offset_gravity="1"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment