* Patches to make guile-gtk work with Guile 1.7
@ 2002-01-25 8:28 unknown_lamer
0 siblings, 0 replies; only message in thread
From: unknown_lamer @ 2002-01-25 8:28 UTC (permalink / raw)
To: guile-gtk
[-- Attachment #1: Type: text/plain, Size: 782 bytes --]
Attached are patches to build-guile-gtk, guile-gtk.c, and guiledlopenhelper.c
that make it work with guile 1.7 from guile's CVS HEAD. It still uses
SCM_NEWCELL so it emits a warning when you exit guile (I don't know how to use
scm_alloc_cell). I replaced SCM_LIST0 with SCM_UNSPECIFIED in build-guile-gtk,
but I think it should be SCM_EOL instead (SCM_LIST0 made a 0-element list,
correct? SCM_EOL becomes '() which is the same thing?). The only issue I've
noticed is that sometimes it segfaults on load (a quick run through with
gdb shows a lot of errors in rw_common), but other times it loads correctly.
This might be because I'm compiling with GCC 3.0.3?
--
+ hackedtobits.com -- the home of irresponsible journalism
http://lamer.hackedtobits.com -- the home of the lamer
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: build-guile-gtk.patch --]
[-- Type: text/x-diff; name="build-guile-gtk.patch", Size: 1522 bytes --]
Index: build-guile-gtk
===================================================================
RCS file: /cvs/gnome/gnome-guile/guile-gtk/build-guile-gtk,v
retrieving revision 1.40
diff -u -r1.40 build-guile-gtk
--- build-guile-gtk 2001/07/24 22:48:42 1.40
+++ build-guile-gtk 2002/01/25 16:11:27
@@ -980,7 +980,7 @@
(if (null? multiple-values)
(@ "~% return ~a;~%}~%~%" (type-c2scm rtype "cr_ret" rcopy))
(begin
- (@ "~% ret_list = SCM_LIST0;")
+ (@ "~% ret_list = SCM_UNSPECIFIED;")
(for-each (lambda (ret)
(@ "~% ret_list = scm_cons(~a, ret_list);"
(type-c2scm (lookup-type (car ret))
@@ -1136,9 +1136,9 @@
'string
(make-type "string" "char*"
(lambda (x)
- (@@ "(SCM_NIMP(~a) && SCM_RWSTRINGP(~a))" x x))
+ (@@ "(SCM_NIMP(~a) && SCM_STRINGP(~a))" x x))
(lambda (x)
- (@@ "((~a) == SCM_BOOL_F? NULL : SCM_CHARS(~a))" x x))
+ (@@ "((~a) == SCM_BOOL_F? NULL : SCM_STRING_CHARS(~a))" x x))
(lambda (x copy)
(@@ "(~a == NULL? SCM_BOOL_F : scm_take0str (~a))" x x))
'fit-for-list #t
@@ -1148,9 +1148,9 @@
'cstring
(make-type "cstring" "const char*"
(lambda (x)
- (@@ "(SCM_NIMP(~a) && SCM_RWSTRINGP(~a))" x x))
+ (@@ "(SCM_NIMP(~a) && SCM_STRINGP(~a))" x x))
(lambda (x)
- (@@ "((~a) == SCM_BOOL_F? NULL : SCM_CHARS(~a))" x x))
+ (@@ "((~a) == SCM_BOOL_F? NULL : SCM_STRING_CHARS(~a))" x x))
(lambda (x copy)
(@@ "(~a == NULL? SCM_BOOL_F : scm_take0str (~a))" x x))
'fit-for-list #t
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: guile-gtk.c.patch --]
[-- Type: text/x-diff; name="guile-gtk.c.patch", Size: 7807 bytes --]
Index: guile-gtk.c
===================================================================
RCS file: /cvs/gnome/gnome-guile/guile-gtk/guile-gtk.c,v
retrieving revision 1.68
diff -u -r1.68 guile-gtk.c
--- guile-gtk.c 2001/06/04 22:27:42 1.68
+++ guile-gtk.c 2002/01/25 16:14:30
@@ -69,6 +69,10 @@
#define scm_reverse_x scm_list_reverse_x
#endif
+#ifndef SCM_LIST0
+#define SCM_LIST0 SCM_EOL
+#endif
+
\f
/* Associating SCM values with Gtk pointers.
@@ -534,7 +538,7 @@
proxy->obj, gtk_type_name (GTK_OBJECT_TYPE (proxy->obj)));
#endif
- SCM_SETGC8MARK (obj);
+ SCM_SETGCMARK (obj);
if (GTK_IS_CONTAINER (proxy->obj))
gtk_container_foreach (GTK_CONTAINER(proxy->obj), mark_traced_ref, NULL);
sgtk_mark_protects (proxy->protects);
@@ -555,7 +559,7 @@
return 1;
}
-static scm_sizet
+static size_t
gtkobj_free (SCM obj)
{
sgtk_object_proxy *proxy = GTKOBJ_PROXY (obj);
@@ -618,7 +622,7 @@
{
sgtk_object_proxy *proxy;
- SCM_SETGC8MARK (obj);
+ SCM_SETGCMARK (obj);
/* We do two passes here. The first pass counts how many references
an object has from other objects that have a proxy. The second
@@ -1006,7 +1010,7 @@
return 0;
for (i = 0; i < info->n_literals; i++)
- if (! strcmp (info->literals[i].name, SCM_CHARS (obj)))
+ if (! strcmp (info->literals[i].name, SCM_STRING_CHARS (obj)))
return 1;
return 0;
}
@@ -1028,12 +1032,12 @@
if (SCM_STRINGP (obj))
{
- SCM_COERCE_SUBSTR (obj);
- return SCM_CHARS (obj);
+ SCM_STRING_COERCE_0TERMINATION_X (obj);
+ return SCM_STRING_CHARS (obj);
}
for (i = 0; i < info->n_literals; i++)
- if (! strcmp (info->literals[i].name, SCM_CHARS (obj)))
+ if (! strcmp (info->literals[i].name, SCM_STRING_CHARS (obj)))
return info->literals[i].value;
return NULL;
}
@@ -1049,7 +1053,7 @@
#define BOXED_PTR(x) ((gpointer)SCM_CDR(x))
#define BOXED_INFO(x) ((sgtk_boxed_info*)must_get_type_info(BOXED_SEQNO(x)))
-static scm_sizet
+static size_t
boxed_free (SCM obj)
{
sgtk_boxed_info *info = BOXED_INFO (obj);
@@ -1226,7 +1230,7 @@
GdkAtom
sgtk_scm2atom (SCM symbol)
{
- return gdk_atom_intern (SCM_CHARS(symbol), FALSE);
+ return gdk_atom_intern (SCM_STRING_CHARS(symbol), FALSE);
}
SCM
@@ -1348,7 +1352,7 @@
{
return SCM_EQ_P (obj, SCM_BOOL_F) || GTKTYPEP (obj)
|| (SCM_NIMP (obj) && SCM_SYMBOLP (obj)
- && sgtk_type_from_name (SCM_CHARS (obj)));
+ && sgtk_type_from_name (SCM_STRING_CHARS (obj)));
}
GtkType
@@ -1359,7 +1363,7 @@
else if (GTKTYPEP (obj))
return GTKTYPE (obj);
else
- return sgtk_type_from_name (SCM_CHARS (obj));
+ return sgtk_type_from_name (SCM_STRING_CHARS (obj));
}
SCM
@@ -1456,7 +1460,7 @@
int i;
SCM *elts;
- actual_len = SCM_LENGTH (obj);
+ actual_len = SCM_VECTOR_LENGTH (obj);
if (len >= 0 && len != actual_len)
return 0;
@@ -1507,7 +1511,7 @@
{
SCM vec = obj;
SCM newvec = vec;
- int len = SCM_LENGTH(newvec), i;
+ int len = SCM_VECTOR_LENGTH(newvec), i;
for (i = 0; i < len; i++)
{
SCM newelt = conversion (SCM_VELTS(newvec)[i]);
@@ -1547,7 +1551,7 @@
}
else if (SCM_NIMP(obj) && SCM_VECTORP(obj))
{
- int len = SCM_LENGTH(obj), i;
+ int len = SCM_VECTOR_LENGTH(obj), i;
for (i = 0; i < len; i++)
SCM_VELTS(obj)[i] = conversion (SCM_VELTS(obj)[i]);
return obj;
@@ -1592,7 +1596,7 @@
}
else if (SCM_NIMP(obj) && SCM_VECTORP(obj))
{
- int len = SCM_LENGTH (obj), i;
+ int len = SCM_VECTOR_LENGTH (obj), i;
SCM *elts = SCM_VELTS (obj);
for (i = 0; i < len; i++)
{
@@ -1627,7 +1631,7 @@
}
else if (SCM_NIMP(obj) && SCM_VECTORP(obj))
{
- int len = SCM_LENGTH (obj), i;
+ int len = SCM_VECTOR_LENGTH (obj), i;
SCM *elts = SCM_VELTS (obj);
for (i = 0; i < len && list; i++)
{
@@ -1682,7 +1686,7 @@
}
else if (SCM_NIMP(obj) && SCM_VECTORP(obj))
{
- int len = SCM_LENGTH (obj), i;
+ int len = SCM_VECTOR_LENGTH (obj), i;
SCM *elts = SCM_VELTS (obj);
for (i = 0; i < len; i++)
{
@@ -1723,7 +1727,7 @@
}
else if (SCM_NIMP(obj) && SCM_VECTORP(obj))
{
- int len = SCM_LENGTH (obj), i;
+ int len = SCM_VECTOR_LENGTH (obj), i;
SCM *elts = SCM_VELTS (obj);
for (i = 0; i < len && list; i++)
{
@@ -1765,7 +1769,7 @@
else if (SCM_NIMP(obj) && SCM_VECTORP(obj))
{
SCM *elts = SCM_VELTS (obj);
- res.count = SCM_LENGTH (obj);
+ res.count = SCM_VECTOR_LENGTH (obj);
res.vec = (void *)scm_must_malloc (res.count * sz, "scm2cvec");
if (fromscm)
{
@@ -1802,7 +1806,7 @@
else if (SCM_NIMP(obj) && SCM_VECTORP(obj))
{
SCM *elts = SCM_VELTS (obj);
- int len1 = SCM_LENGTH (obj), len2 = cvec->count, i;
+ int len1 = SCM_VECTOR_LENGTH (obj), len2 = cvec->count, i;
char *ptr;
for (i = 0, ptr = cvec->vec; i < len1 && i < len2; i++, ptr += sz)
@@ -1953,8 +1957,8 @@
GTK_VALUE_DOUBLE(*a) = sgtk_scm2double (obj);
break;
case GTK_TYPE_STRING:
- SCM_COERCE_SUBSTR (obj);
- GTK_VALUE_STRING(*a) = SCM_CHARS(obj);
+ SCM_STRING_COERCE_0TERMINATION_X (obj);
+ GTK_VALUE_STRING(*a) = SCM_STRING_CHARS(obj);
break;
case GTK_TYPE_ENUM:
GTK_VALUE_ENUM(*a) =
@@ -2020,8 +2024,8 @@
case GTK_TYPE_STRING:
SCM_ASSERT (SCM_NIMP(obj) && SCM_STRINGP(obj), obj, SCM_ARG1,
"scm->gtk");
- SCM_COERCE_SUBSTR (obj);
- GTK_VALUE_STRING(*a) = g_strdup (SCM_CHARS(obj));
+ SCM_STRING_COERCE_0TERMINATION_X (obj);
+ GTK_VALUE_STRING(*a) = g_strdup (SCM_STRING_CHARS(obj));
break;
case GTK_TYPE_ENUM:
*GTK_RETLOC_ENUM(*a) =
@@ -2132,7 +2136,7 @@
info.n_args = n_args;
info.args = args;
- scm_internal_cwdr ((scm_catch_body_t)inner_callback_marshal, &info,
+ scm_internal_cwdr ((scm_t_catch_body)inner_callback_marshal, &info,
scm_handle_by_message_noexit, "gtk",
&stack_item);
}
@@ -2159,9 +2163,9 @@
GdkColor colstruct;
GdkColormap *colmap;
- SCM_COERCE_SUBSTR (color);
+ SCM_STRING_COERCE_0TERMINATION_X (color);
SCM_DEFER_INTS;
- if (!gdk_color_parse (SCM_CHARS (color), &colstruct))
+ if (!gdk_color_parse (SCM_STRING_CHARS (color), &colstruct))
{
SCM_ALLOW_INTS;
scm_misc_error ("string->color",
@@ -2199,7 +2203,7 @@
if (SCM_NIMP (font) && SCM_STRINGP (font))
{
- SCM_COERCE_SUBSTR (font);
+ SCM_STRING_COERCE_0TERMINATION_X (font);
font = sgtk_gdk_font_load (font);
if (font == SCM_BOOL_F)
scm_misc_error ("string->font",
@@ -2217,7 +2221,7 @@
sgtk_string_conversion (SCM str)
{
if (SCM_NIMP (str) && SCM_STRINGP (str))
- SCM_COERCE_SUBSTR (str);
+ SCM_STRING_COERCE_0TERMINATION_X (str);
return str;
}
@@ -2410,9 +2414,9 @@
scm_args = SCM_CDDR (scm_args);
if (SCM_NIMP (kw) && SCM_SYMBOLP (kw))
- name = SCM_CHARS(kw);
+ name = SCM_STRING_CHARS(kw);
else if (SCM_NIMP (kw) && SCM_KEYWORDP (kw))
- name = SCM_CHARS(SCM_KEYWORDSYM(kw))+1;
+ name = SCM_STRING_CHARS(SCM_KEYWORDSYM(kw))+1;
else
{
fprintf (stderr, "bad keyword\n");
@@ -2535,9 +2539,9 @@
SCM_ASSERT (info != NULL, scm_obj, SCM_ARG1, "gtk-object-get");
if (SCM_SYMBOLP(argsym))
- name = SCM_CHARS(argsym);
+ name = SCM_STRING_CHARS(argsym);
else
- name = SCM_CHARS(SCM_KEYWORDSYM(argsym))+1;
+ name = SCM_STRING_CHARS(SCM_KEYWORDSYM(argsym))+1;
sgtk_find_arg_info (&arg, info, name);
SCM_DEFER_INTS;
@@ -2834,7 +2838,7 @@
scm_must_free ((char *)v);
return;
}
- v[i] = xstrdup (SCM_CHARS (SCM_CAR (list)));
+ v[i] = xstrdup (SCM_STRING_CHARS (SCM_CAR (list)));
}
v[c] = NULL;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: guiledlopenhelper.c.patch --]
[-- Type: text/x-diff; name="guiledlopenhelper.c.patch", Size: 2331 bytes --]
Index: guiledlopenhelper.c
===================================================================
RCS file: /cvs/gnome/gnome-guile/guile-gtk/guiledlopenhelper.c,v
retrieving revision 1.10
diff -u -r1.10 guiledlopenhelper.c
--- guiledlopenhelper.c 2001/05/21 02:25:52 1.10
+++ guiledlopenhelper.c 2002/01/25 16:15:23
@@ -31,11 +31,11 @@
SCM_ASSERT (SCM_NIMP(name) && SCM_STRINGP(name), name,
SCM_ARG1, "%sgtk-dlopen");
- SCM_COERCE_SUBSTR (name);
+ SCM_STRING_COERCE_0TERMINATION_X (name);
SCM_ASSERT (SCM_NIMP(fullname) && SCM_STRINGP(fullname), fullname,
SCM_ARG2, "%sgtk-dlopen");
- SCM_COERCE_SUBSTR (fullname);
+ SCM_STRING_COERCE_0TERMINATION_X (fullname);
SCM_DEFER_INTS;
#ifdef HAVE_DLOPEN
@@ -52,12 +52,12 @@
*/
#ifdef RTLD_GLOBAL
#if (defined __NetBSD__)
- handle = dlopen (SCM_CHARS (fullname), RTLD_LAZY|RTLD_GLOBAL);
+ handle = dlopen (SCM_STRING_CHARS (fullname), RTLD_LAZY|RTLD_GLOBAL);
#else
- handle = dlopen (SCM_CHARS (name), RTLD_LAZY|RTLD_GLOBAL);
+ handle = dlopen (SCM_STRING_CHARS (name), RTLD_LAZY|RTLD_GLOBAL);
#endif
#else
- handle = dlopen (SCM_CHARS (fullname), RTLD_LAZY);
+ handle = dlopen (SCM_STRING_CHARS (fullname), RTLD_LAZY);
#endif
if (handle == NULL)
fprintf (stderr, "dlopen: %s\n", dlerror ());
@@ -77,25 +77,25 @@
SCM_ASSERT (SCM_NIMP(sym) && SCM_STRINGP(sym), sym,
SCM_ARG1, "%sgtk-dlinit");
handle = (void *)scm_num2ulong (lib, (char *)SCM_ARG2, "%sgtk-dlinit");
- SCM_COERCE_SUBSTR (sym);
+ SCM_STRING_COERCE_0TERMINATION_X (sym);
SCM_DEFER_INTS;
#ifdef HAVE_DLOPEN
#if (defined __NetBSD__)
do {
- char *symbol = scm_must_malloc (strlen (SCM_CHARS (sym)) + 2, "dlsym");
+ char *symbol = scm_must_malloc (strlen (SCM_STRING_CHARS (sym)) + 2, "dlsym");
- sprintf (symbol, "_%s", SCM_CHARS (sym));
+ sprintf (symbol, "_%s", SCM_STRING_CHARS (sym));
func = (void (*)())dlsym (handle, symbol);
scm_must_free (symbol);
} while (0);
#else
- func = (void (*)())dlsym (handle, SCM_CHARS (sym));
+ func = (void (*)())dlsym (handle, SCM_STRING_CHARS (sym));
#endif
if (func)
func ();
else
- fprintf (stderr, "dlsym (%s): %s\n", SCM_CHARS (sym), dlerror ());
+ fprintf (stderr, "dlsym (%s): %s\n", SCM_STRING_CHARS (sym), dlerror ());
#endif
SCM_ALLOW_INTS;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-01-25 16:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-25 8:28 Patches to make guile-gtk work with Guile 1.7 unknown_lamer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).