Commit 4ca1bb93 authored by Michael Meeks's avatar Michael Meeks

Clean guile bits, The beggining of the end.

Clean guile bits,
The beggining of the end.
parent c5a42952
2000-01-28 Michael Meeks <mmeeks@gnu.org>
* configure.in (have_gb): update.
* plugins/Makefile.am: add gb.
* configure.in: ditto.
2000-01-28 Jon K Hellan <hellan@acm.org> 2000-01-28 Jon K Hellan <hellan@acm.org>
* src/gnumeric-util.c (gnumeric_dialog_run): Handle wb = NULL * src/gnumeric-util.c (gnumeric_dialog_run): Handle wb = NULL
......
2000-01-28 Michael Meeks <mmeeks@gnu.org>
* configure.in (have_gb): update.
* plugins/Makefile.am: add gb.
* configure.in: ditto.
2000-01-28 Jon K Hellan <hellan@acm.org> 2000-01-28 Jon K Hellan <hellan@acm.org>
* src/gnumeric-util.c (gnumeric_dialog_run): Handle wb = NULL * src/gnumeric-util.c (gnumeric_dialog_run): Handle wb = NULL
......
...@@ -206,14 +206,14 @@ AC_ARG_WITH(gb, ...@@ -206,14 +206,14 @@ AC_ARG_WITH(gb,
) )
if $try_gb; then if $try_gb; then
AC_MSG_CHECKING(for Gb > 0.0) AC_MSG_CHECKING(for Gb >= 0.0.6)
if gnome-config --libs gb > /dev/null 2>&1; then if gnome-config --libs gb > /dev/null 2>&1; then
vers=`gnome-config --modversion gb` vers=`gnome-config --modversion gb | awk 'BEGIN { FS = "."; } { print $1 * 10000 + $2 * 100 + $3; }'`
case $vers if test "$vers" -ge 000006; then
in gb_ok=true
gb-0.[[0]]) gb_ok=false ;; else
*) gb_ok=true ;; gb_ok=false
esac fi
else else
gb_ok=false gb_ok=false
fi fi
...@@ -228,7 +228,7 @@ if $try_gb; then ...@@ -228,7 +228,7 @@ if $try_gb; then
AC_MSG_RESULT(not found) AC_MSG_RESULT(not found)
fi fi
fi fi
AM_CONDITIONAL(GB, $have_gb) AM_CONDITIONAL(WITH_GB, $have_gb)
dnl ****************************** dnl ******************************
dnl GnomePrint checking dnl GnomePrint checking
...@@ -306,6 +306,7 @@ plugins/sc/Makefile ...@@ -306,6 +306,7 @@ plugins/sc/Makefile
plugins/sylk/Makefile plugins/sylk/Makefile
plugins/excel/Makefile plugins/excel/Makefile
plugins/excel/libole2/Makefile plugins/excel/libole2/Makefile
plugins/gb/Makefile
plugins/lotus-123/Makefile plugins/lotus-123/Makefile
plugins/oleo/Makefile plugins/oleo/Makefile
plugins/python/Makefile plugins/python/Makefile
......
...@@ -18,4 +18,10 @@ else ...@@ -18,4 +18,10 @@ else
GUILE_DIR = GUILE_DIR =
endif endif
SUBDIRS = sample excel lotus-123 oleo sc sylk ff-csv text xbase html dif ff-stf $(PYTHON) $(GUILE_DIR) if WITH_GB
GB_DIR = gb
else
GB_DIR =
endif
SUBDIRS = sample excel lotus-123 oleo sc sylk ff-csv text xbase html dif ff-stf $(PYTHON) $(GUILE_DIR) $(GB_DIR)
2000-01-28 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
* plugin.c (value_to_gb): implemented.
(gb_to_value): implement.
* plugin.c: created.
\ No newline at end of file
#
# Makefile for the Gnome Basic Gnumeric plugin.
#
# Where can we find the Gnumeric include files.
#
GNUMERIC_SRC_DIR = $(srcdir)/../../src
#
# Where to install the plugin
#
plugindir = $(libdir)/gnumeric/plugins/$(VERSION)
plugin_LTLIBRARIES = libgnum_gb.la
libgnum_gb_la_SOURCES = plugin.c
INCLUDES = \
-I$(GNUMERIC_SRC_DIR) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DGNUMERIC_VERSION=\""$(VERSION)"\" \
-I$(includedir) \
$(GNOME_INCLUDEDIR)
libgnum_gb_la_LIBADD = -lgb -lgbrun
/* -*- mode: c; c-basic-offset: 8 -*- */
/**
* boot.c: Gnome Basic support for Gnumeric
*
* Author:
* Michael Meeks (michael@imaginator.com)
*
* (C) 2000 HelixCode, Inc
**/
#include <config.h>
#include <glib.h>
#include <assert.h>
#include <stdio.h>
#include <libguile.h>
#include <gnome.h>
#include "gnumeric.h"
#include "symbol.h"
#include "plugin.h"
#include "expr.h"
#include "func.h"
static GBValue *
value_to_gb (Value *val, CellRef cell_ref)
{
if (val == NULL)
return NULL;
switch (val->type) {
case VALUE_EMPTY:
/* FIXME ?? what belongs here */
return gb_value_new_empty ();
case VALUE_BOOLEAN:
return gb_value_new_boolean (val->v.v_bool);
case VALUE_ERROR:
/* FIXME ?? what belongs here */
return gb_value_new_string_chars (val->v.error.mesg->str);
case VALUE_STRING:
return gb_value_new_string_chars (val->v.str->str);
case VALUE_INTEGER:
return gb_value_new_int (val->v.v_int);
case VALUE_FLOAT:
return gb_value_new_double (val->v.v_float);
default:
g_warning ("Unimplemented %d -> GB translation", val->type);
return gb_value_new_int (0);
}
}
static Value *
gb_to_value (GBValue *v)
{
switch (v->type) {
case GB_VALUE_EMPTY:
case GB_VALUE_NULL:
return value_new_empty ();
case GB_VALUE_INT:
case GB_VALUE_LONG:
return value_new_int (gb_value_get_as_long (v));
case GB_VALUE_SINGLE:
case GB_VALUE_DOUBLE:
return value_new_float (gb_value_get_as_double (v));
case GB_VALUE_STRING:
return value_new_string (v->v.str->str);
default:
g_warning ("Unimplemented GB %d -> gnumeric type mapping",
v->type);
return value_new_error ("Unknown mapping");
}
}
static int
dont_unload (PluginData *pd)
{
return 0;
}
PluginInitResult
init_plugin (CommandContext *context, PluginData *pd)
{
FunctionCategory *cat;
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
cat = function_get_category ("Gnome Basic");
/* I do nothing yet */
function_add_nodes (cat, "gb", 0, "symbol", NULL, NULL);
pd->can_unload = dont_unload;
pd->title = g_strdup(_("Gnome Basic Plugin"));
return PLUGIN_OK;
}
2000-01-28 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
* plugin.c: Kill nasty absolute references on includes.
(func_scm_apply): use ei->pos not ei for eval_expr.
(func_marshal_func): kill warning.
2000-01-18 Jody Goldberg <jgoldberg@home.com> 2000-01-18 Jody Goldberg <jgoldberg@home.com>
* plugin.c (expr_to_scm) : Add OPER_UNARY_PLUS. * plugin.c (expr_to_scm) : Add OPER_UNARY_PLUS.
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
#include <gnome.h> #include <gnome.h>
#include <guile/gh.h> #include <guile/gh.h>
#include "../../src/gnumeric.h" #include "gnumeric.h"
#include "../../src/symbol.h" #include "symbol.h"
#include "../../src/plugin.h" #include "plugin.h"
#include "../../src/expr.h" #include "expr.h"
#include "../../src/func.h" #include "func.h"
/* This is damn ugly. /* This is damn ugly.
* However, it will get things working again (I hope) * However, it will get things working again (I hope)
...@@ -296,7 +296,7 @@ func_scm_apply (FunctionEvalInfo *ei, GList *expr_node_list) ...@@ -296,7 +296,7 @@ func_scm_apply (FunctionEvalInfo *ei, GList *expr_node_list)
eval_cell.row_relative = 0; eval_cell.row_relative = 0;
eval_cell.sheet = NULL; eval_cell.sheet = NULL;
value = eval_expr(ei, (ExprTree*)g_list_nth(expr_node_list, i)->data); value = eval_expr (ei->pos, (ExprTree*)g_list_nth(expr_node_list, i)->data);
if (value == NULL) if (value == NULL)
return value_new_error (ei->pos, _("Could not evaluate argument")); return value_new_error (ei->pos, _("Could not evaluate argument"));
...@@ -322,7 +322,7 @@ scm_cell_value (SCM scm) ...@@ -322,7 +322,7 @@ scm_cell_value (SCM scm)
if (cell == NULL) if (cell == NULL)
return SCM_EOL; return SCM_EOL;
assert(cell->value != NULL); assert (cell->value != NULL);
return value_to_scm(cell->value, cell_ref); return value_to_scm(cell->value, cell_ref);
} }
...@@ -340,7 +340,7 @@ scm_cell_expr (SCM scm) ...@@ -340,7 +340,7 @@ scm_cell_expr (SCM scm)
if (cell == NULL || cell->parsed_node == NULL) if (cell == NULL || cell->parsed_node == NULL)
return SCM_EOL; return SCM_EOL;
return expr_to_scm(cell->parsed_node, cell_ref); return expr_to_scm (cell->parsed_node, cell_ref);
} }
static SCM static SCM
...@@ -358,7 +358,7 @@ scm_set_cell_string (SCM scm_cell_ref, SCM scm_string) ...@@ -358,7 +358,7 @@ scm_set_cell_string (SCM scm_cell_ref, SCM scm_string)
if (cell == NULL) if (cell == NULL)
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
cell_set_text(cell, SCM_CHARS(scm_string)); cell_set_text (cell, SCM_CHARS(scm_string));
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
} }
...@@ -413,21 +413,22 @@ func_marshal_func (FunctionEvalInfo *ei, Value *argv[]) ...@@ -413,21 +413,22 @@ func_marshal_func (FunctionEvalInfo *ei, Value *argv[])
function_def_count_args(fndef, &min, &max); function_def_count_args(fndef, &min, &max);
l = g_list_find_custom(funclist, fndef, (GCompareFunc)fndef_compare); l = g_list_find_custom (funclist, (gpointer)fndef,
(GCompareFunc)fndef_compare);
if (l == NULL) if (l == NULL)
return value_new_error (ei->pos, _("Unable to lookup Guile function.")); return value_new_error (ei->pos, _("Unable to lookup Guile function."));
function = ((FuncData*)l->data)->function; function = ((FuncData*)l->data)->function;
for (i = min - 1; i >= 0; --i) for (i = min - 1; i >= 0; --i)
args = scm_cons(value_to_scm(argv[i], dummy), args); args = scm_cons (value_to_scm (argv [i], dummy), args);
old_eval_pos = eval_pos; old_eval_pos = eval_pos;
eval_pos = ei->pos; eval_pos = ei->pos;
result = scm_apply(function, args, SCM_EOL); result = scm_apply (function, args, SCM_EOL);
eval_pos = old_eval_pos; eval_pos = old_eval_pos;
return scm_to_value(result); return scm_to_value (result);
} }
static SCM static SCM
......
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