unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Fixing goops-1
@ 2002-10-01 18:26 Andreas Rottmann
  2002-10-02 23:15 ` Neil Jerram
  2002-10-03 21:33 ` Neil Jerram
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Rottmann @ 2002-10-01 18:26 UTC (permalink / raw)


Hi!

Remember the goops-1 bug? I'd really like this one fixed, since it is
stopping me to test Guile as an extension language for my C++ programs
- I'd be stick with Python ;-)). However, I don't have the necessary
insight into the GOOPS internals. If someone of GOOPS authorship or
deeper GOOPS knowledge could guide me, I would like help, though.

Regards, Andy
-- 
Andreas Rottmann         | Dru@ICQ        | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62


_______________________________________________
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 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-02 23:15 ` Neil Jerram
@ 2002-10-03 20:45   ` Andreas Rottmann
  2002-10-04 18:45     ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Rottmann @ 2002-10-03 20:45 UTC (permalink / raw)


Neil Jerram <neil@ossau.uklinux.net> writes:

> >>>>> "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 ... :-)
> 
Yes, seems we can close that bug. I have replaced all passes of
SCM_EOL scm_closure with
scm_top_level_env(SCM_TOP_LEVEL_LOOKUP_CLOSURE) and the code works
now. Thanks a lot!

One should perhaps consider doing the same in goops.c, too.

However, scm_closure and the other stuff should be documented somewher ;-)

Regards, Andy

PS: No need to CC me, I am one guile-devel, however, Neil, your reply
wasn't on devel, altough you have CC'd it. Perhaps my fetchmail has
messed it up...
-- 
Andreas Rottmann         | Dru@ICQ        | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62


_______________________________________________
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

* Re: Fixing goops-1
  2002-10-03 20:45   ` Andreas Rottmann
@ 2002-10-04 18:45     ` Neil Jerram
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2002-10-04 18:45 UTC (permalink / raw)
  Cc: guile-devel

>>>>> "Andreas" == Andreas Rottmann <a.rottmann@gmx.at> writes:

    Andreas> One should perhaps consider doing the same in goops.c, too.

Yes, will do.

    Andreas> However, scm_closure and the other stuff should be
    Andreas> documented somewher ;-)

Ideally, yes.  I'm very good at committing patches ... :-)

        Neil



_______________________________________________
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

end of thread, other threads:[~2002-10-04 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-04 18:45     ` Neil Jerram
2002-10-03 21:33 ` Neil Jerram

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).