* Re: Fixing goops-1
2002-10-01 18:26 Fixing goops-1 Andreas Rottmann
@ 2002-10-02 23:15 ` Neil Jerram
2002-10-03 20:45 ` Andreas Rottmann
2002-10-03 21:33 ` Neil Jerram
1 sibling, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2002-10-02 23:15 UTC (permalink / raw)
Cc: guile-devel
>>>>> "Andreas" == Andreas Rottmann <a.rottmann@gmx.at> writes:
Andreas> Hi! Remember the goops-1 bug? I'd really like this one
Andreas> fixed, since it is stopping me to test Guile as an
Andreas> extension language for my C++ programs - I'd be stick
Andreas> with Python ;-)). However, I don't have the necessary
Andreas> insight into the GOOPS internals. If someone of GOOPS
Andreas> authorship or deeper GOOPS knowledge could guide me, I
Andreas> would like help, though.
Hi Andy,
I don't fully understand this stuff, but through a kind of
investigation and experimentation, I have a solution. If you change
the second arg of scm_closure from SCM_EOL to scm_top_level_env
(SCM_TOP_LEVEL_LOOKUP_CLOSURE), the define-method call works.
Full patch (to your source) is below. I played around with this by
inserting scm_shell, so that I could use the debugger interactively to
look at frames, which in turn needed SCM_RECORD_POSITIONS_P = 1 and
the commenting out of the `:no-backtrace' option in the GOOPS .scm
files. I tested the commented out define-method call by typing it
into the Guile shell.
I'm guessing that you took your model from scm_add_slot, which also
passes SCM_EOL to scm_closure. However, note that nothing in Guile
actually uses scm_add_slot ... :-)
Hope this helps,
Neil
cd ~/Guile/miscellany/goops-1/
diff -Naur /home/neil/Guile/miscellany/goops-1/bug.c\~ /home/neil/Guile/miscellany/goops-1/bug.c
--- /home/neil/Guile/miscellany/goops-1/bug.c~ Wed Oct 2 22:13:07 2002
+++ /home/neil/Guile/miscellany/goops-1/bug.c Wed Oct 2 23:53:32 2002
@@ -19,7 +19,7 @@
SCM constr = scm_c_make_gsubr("constructor", 1, 0, 1, proc);
SCM constrm = scm_closure(scm_list_2(scm_list_2(sym_obj, sym_args),
scm_list_3(constr, sym_obj, sym_args)),
- SCM_EOL);
+ scm_top_level_env (SCM_TOP_LEVEL_LOOKUP_CLOSURE));
SCM meth = scm_make(scm_list_5(scm_class_method,
scm_c_make_keyword("specializers"),
scm_list_2(klass, scm_class_top),
@@ -32,7 +32,7 @@
static void real_main(void *closure, int argc, char *argv[])
{
SCM klass, slots;
-
+ SCM_RECORD_POSITIONS_P = 1;
scm_load_goops();
slots = scm_list_1(scm_list_3(scm_str2symbol("a-slot"),
@@ -48,10 +48,11 @@
scm_c_eval_string("(use-modules (oop goops))");
scm_c_eval_string("(define-class <new-object> (<my-object>))");
scm_c_eval_string("(make <new-object>)");
+ scm_shell (argc, argv);
// this produces the error
- scm_c_eval_string("(define-method (initialize (obj <new-object>) initargs)"
- " (next-method))");
+/* scm_c_eval_string("(define-method (initialize (obj <new-object>) initargs)" */
+/* " (next-method))"); */
}
int main(int argc, char *argv[])
Diff finished at Wed Oct 2 23:59:15
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fixing goops-1
2002-10-01 18:26 Fixing goops-1 Andreas Rottmann
2002-10-02 23:15 ` Neil Jerram
@ 2002-10-03 21:33 ` Neil Jerram
1 sibling, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2002-10-03 21:33 UTC (permalink / raw)
Cc: guile-devel
>>>>> "Andreas" == Andreas Rottmann <a.rottmann@gmx.at> writes:
Andreas> Hi! Remember the goops-1 bug? I'd really like this one
Andreas> fixed, since it is stopping me to test Guile as an
Andreas> extension language for my C++ programs - I'd be stick
Andreas> with Python ;-)). However, I don't have the necessary
Andreas> insight into the GOOPS internals. If someone of GOOPS
Andreas> authorship or deeper GOOPS knowledge could guide me, I
Andreas> would like help, though.
Hi Andy,
I don't fully understand this stuff, but through a kind of
investigation and experimentation, I have a solution. If you change
the second arg of scm_closure from SCM_EOL to scm_top_level_env
(SCM_TOP_LEVEL_LOOKUP_CLOSURE), the define-method call works.
Full patch (to your source) is below. I played around with this by
inserting scm_shell, so that I could use the debugger interactively to
look at frames, which in turn needed SCM_RECORD_POSITIONS_P = 1 and
the commenting out of the `:no-backtrace' option in the GOOPS .scm
files. I tested the commented out define-method call by typing it
into the Guile shell.
I'm guessing that you took your model from scm_add_slot, which also
passes SCM_EOL to scm_closure. However, note that nothing in Guile
actually uses scm_add_slot ... :-)
Hope this helps,
Neil
cd ~/Guile/miscellany/goops-1/
diff -Naur /home/neil/Guile/miscellany/goops-1/bug.c\~ /home/neil/Guile/miscellany/goops-1/bug.c
--- /home/neil/Guile/miscellany/goops-1/bug.c~ Wed Oct 2 22:13:07 2002
+++ /home/neil/Guile/miscellany/goops-1/bug.c Wed Oct 2 23:53:32 2002
@@ -19,7 +19,7 @@
SCM constr = scm_c_make_gsubr("constructor", 1, 0, 1, proc);
SCM constrm = scm_closure(scm_list_2(scm_list_2(sym_obj, sym_args),
scm_list_3(constr, sym_obj, sym_args)),
- SCM_EOL);
+ scm_top_level_env (SCM_TOP_LEVEL_LOOKUP_CLOSURE));
SCM meth = scm_make(scm_list_5(scm_class_method,
scm_c_make_keyword("specializers"),
scm_list_2(klass, scm_class_top),
@@ -32,7 +32,7 @@
static void real_main(void *closure, int argc, char *argv[])
{
SCM klass, slots;
-
+ SCM_RECORD_POSITIONS_P = 1;
scm_load_goops();
slots = scm_list_1(scm_list_3(scm_str2symbol("a-slot"),
@@ -48,10 +48,11 @@
scm_c_eval_string("(use-modules (oop goops))");
scm_c_eval_string("(define-class <new-object> (<my-object>))");
scm_c_eval_string("(make <new-object>)");
+ scm_shell (argc, argv);
// this produces the error
- scm_c_eval_string("(define-method (initialize (obj <new-object>) initargs)"
- " (next-method))");
+/* scm_c_eval_string("(define-method (initialize (obj <new-object>) initargs)" */
+/* " (next-method))"); */
}
int main(int argc, char *argv[])
Diff finished at Wed Oct 2 23:59:15
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread