Hi Patrick,
The way you explained is a lot better!.
El dom, 29-01-2006 a las 12:11 +0100, Patrick Bernaud escribió:
[snip]
> What would be even better is:
>
> 1 - define a new smob for OBJECT on the model of the one for ATTRIB
> in libgeda;
Done.
> 2 - modify the hook to be passed a smob OBJECT instead of a list of
> ATTRIB smobs;
Done.
> 3 - write a function get-object-attributes in C that is given an
> OBJECT smob and actually returns the list of ATTRIB smobs
Done, but untested. I didn't need it.
> Example:
> (define (print-all-attributes attribute-list)
> (for-each display attribute-list))
> (add-hook! add-pin-hook (lambda (pin)
> (print-all-attributes (get-object-attributes pin))))
>
> 4 - modify your g_add_attrib function so that scm_vis is expected to
> be boolean and scm_show a symbol (or list of symbols). Also split
> newtext into name and value.
>
> Example:
> (add-attrib object "name1" "value1" #t '(name value))
Done. I like the above one.
> Exposing the toplevel (w_current) to the scheme side is indeed a bad
> idea. To solve the access to this TOPLEVEL structure:
> - include toplevel in the OBJECT smob like the ATTRIB smob.
Done. I chose to implement this one, as it is very similar to the ATTRIB
smob.
Attached is the patch, if you want to take a look.
Thanks,
Carlos
Index: docs/ChangeLog
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/docs/ChangeLog,v
retrieving revision 1.71
diff -u -r1.71 ChangeLog
--- docs/ChangeLog 22 Jan 2006 13:55:25 -0000 1.71
+++ docs/ChangeLog 29 Jan 2006 16:29:00 -0000
@@ -1,3 +1,8 @@
+2006-01-29 Carlos Nieves Onega <[EMAIL PROTECTED]>
+ * hooks/hooks_and_scheme.txt: Added documentation for the new
+ add-pin-hook hook and the new add-attribute-to-object
+ function.
+
2006-01-16 Ales Hvezda <[EMAIL PROTECTED]>
* configure.ac: Bumped package version to 20060123
Index: docs/hooks/hooks_and_scheme.txt
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/docs/hooks/hooks_and_scheme.txt,v
retrieving revision 1.2
diff -u -r1.2 hooks_and_scheme.txt
--- docs/hooks/hooks_and_scheme.txt 15 Sep 2002 04:09:57 -0000 1.2
+++ docs/hooks/hooks_and_scheme.txt 29 Jan 2006 16:29:01 -0000
@@ -4,6 +4,7 @@
====================================
Copyright (C) 2000 Stefan Petersen
+Copyright (C) 2006 Carlos Nieves Onega
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -36,7 +37,7 @@
Scheme functions
----------------
-There are two function available for handling attributes in the schematic.
+There are three functions available for handling attributes in the schematic.
* get-attribute-name-value
Inparameter : an attribute
@@ -49,12 +50,28 @@
* set-attribute-value!
Inparameter : an attribute and a string.
+
Outparameter : undefined.
Description : Sets a new value to an attribute. The attribute must
be defined, the function can't create a new attribute.
Defined both in gschem and libgeda, mainly because
where different variables and information are available.
+* add-attribute-to-object
+Inparameters :
+ - Object: passed as a hook argument from gschem.
+ - Attribute name.
+ - Value of the attribute.
+ - Visibility: #t (visible) or #f (hidden).
+ - Show_list: a list containing what to show, using
+ elements like 'name' or 'value', or an empty list.
+Outparameter : undefined.
+Description : Adds a new attribute to an object.
+
+Examples:
+ (add-attribute-to-object object "pinlabel" "unknown" #t '(value))
+ (add-attribute-to-object object "pinnumber" "0" #t '(value name))
+ (add-attribute-to-object object "pinseq" "0" #f '(name))
Hooks
-----
@@ -64,6 +81,7 @@
* add-component-hook
* copy-component-hook
* move-component-hook
+* add-pin-hoook
As their name indicate, they are called at different occasions. When
you add a component add-component-hook is called, etc.
@@ -110,5 +128,10 @@
simply add the following line:
(add-hook! copy-component-hook auto-uref)
+If you want to automatically add default attributes to each newly placed pin,
+just add the following line to your gschemrc file:
+(add-hook! add-pin-hook add-default-pin-attributes)
+Note: This is enabled by default in the system wide gschemrc file!.
+
Good luck!
Index: gschem/ChangeLog
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/ChangeLog,v
retrieving revision 1.432
diff -u -r1.432 ChangeLog
--- gschem/ChangeLog 24 Jan 2006 03:34:02 -0000 1.432
+++ gschem/ChangeLog 29 Jan 2006 16:29:18 -0000
@@ -1,3 +1,14 @@
+2006-01-29 Carlos Nieves Onega <[EMAIL PROTECTED]>
+ * include/globals.h, include/prototype.h, lib/system-gschemrc.in,
+ noweb/g_hook.nw, noweb/g_register.nw, noweb/globals.nw,
+ noweb/o_pin.nw:
+ Added a new hook: add-pin-hook, and a new subroutine "g_add_attrib"
+ to add an attribute to an object from scheme.
+ Modified the system-gschemrc file so gschem adds automatically
+ the default pin attributes when placing a new pin.
+
+ * noweb/i_vars.h: Fixed compile warning.
+
2006-01-23 Ales Hvezda <[EMAIL PROTECTED]>
* po/*: auto* tools update all po files for distribution.
Index: gschem/include/globals.h
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/include/globals.h,v
retrieving revision 1.12
diff -u -r1.12 globals.h
--- gschem/include/globals.h 11 Jan 2006 14:44:08 -0000 1.12
+++ gschem/include/globals.h 29 Jan 2006 16:29:19 -0000
@@ -72,6 +72,7 @@
extern SCM add_component_hook;
extern SCM copy_component_hook;
extern SCM move_component_hook;
+extern SCM add_pin_hook;
#include "gettext.h"
#ifdef ENABLE_NLS
Index: gschem/include/prototype.h
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/include/prototype.h,v
retrieving revision 1.124
diff -u -r1.124 prototype.h
--- gschem/include/prototype.h 17 Dec 2005 13:59:13 -0000 1.124
+++ gschem/include/prototype.h 29 Jan 2006 16:29:23 -0000
@@ -24,6 +24,8 @@
/* g_hook.c */
SCM g_make_attrib_smob_list(TOPLEVEL *curr_w, OBJECT *curr_object);
SCM g_set_attrib_value_x(SCM attrib_smob, SCM scm_value);
+SCM g_add_attrib(SCM object, SCM attrib_name,
+ SCM attrib_value, SCM scm_vis, SCM scm_show);
/* g_keys.c */
void set_window_current_key(TOPLEVEL *w_current);
void g_keys_execute(int state, int keyval);
Index: gschem/lib/system-gschemrc.in
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/lib/system-gschemrc.in,v
retrieving revision 1.87
diff -u -r1.87 system-gschemrc.in
--- gschem/lib/system-gschemrc.in 18 Nov 2005 20:31:48 -0000 1.87
+++ gschem/lib/system-gschemrc.in 29 Jan 2006 16:29:26 -0000
@@ -768,6 +768,26 @@
;(add-hook! add-component-hook auto-uref)
;(add-hook! copy-component-hook auto-uref)
+; Adds the default pin attributes to each newly placed pin.
+(define (add-default-pin-attributes object)
+ ; Add the default attributes to a newly added pin.
+ ; Parameters:
+ ; - Object: passed as a hook argument from gschem.
+ ; - Attribute name.
+ ; - Value of the attribute.
+ ; - Visibility: #t (visible) or #f (hidden).
+ ; - Show_list: a list containing what to show, using
+ ; elements like 'name' or 'value', or an empty list.
+ (add-attribute-to-object object "pintype" "unknown" #f '())
+ (add-attribute-to-object object "pinlabel" "unknown" #t '(value))
+ (add-attribute-to-object object "pinnumber" "0" #t '(value))
+ (add-attribute-to-object object "pinseq" "0" #f '())
+)
+
+; Comment in this hook to automatically add the default attributes to
+; each newly placed pin
+(add-hook! add-pin-hook add-default-pin-attributes)
+
;
; End of hooks
;
Index: gschem/noweb/g_hook.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/g_hook.nw,v
retrieving revision 1.6
diff -u -r1.6 g_hook.nw
--- gschem/noweb/g_hook.nw 4 Feb 2005 04:39:29 -0000 1.6
+++ gschem/noweb/g_hook.nw 29 Jan 2006 16:29:27 -0000
@@ -13,6 +13,7 @@
<<g_hook.c : include directives>>
<<g_hook.c : g_make_attrib_smob_list()>>
<<g_hook.c : g_set_attrib_value_x()>>
+<<g_hook.c : g_add_attrib()>>
@
@@ -145,3 +146,67 @@
@ %def g_set_attrib_value_x
[EMAIL PROTECTED] g_add_attrib
+/* Adds an attribute to an object */
[EMAIL PROTECTED] defun
+
+<<g_hook.c : g_add_attrib()>>=
+SCM
+g_add_attrib(SCM object, SCM scm_attrib_name,
+ SCM scm_attrib_value, SCM scm_vis, SCM scm_show)
+{
+ TOPLEVEL *w_current=NULL;
+ OBJECT *o_current=NULL;
+ gboolean vis;
+ int show=0;
+ gchar *attrib_name=NULL;
+ gchar *attrib_value=NULL;
+ gchar *value=NULL;
+ int i;
+ gchar *newtext=NULL;
+
+ SCM_ASSERT (SCM_STRINGP(scm_attrib_name), scm_attrib_name,
+ SCM_ARG2, "add-attribute-to-object");
+ SCM_ASSERT (SCM_STRINGP(scm_attrib_value), scm_attrib_value,
+ SCM_ARG3, "add-attribute-to-object");
+ SCM_ASSERT (scm_boolean_p(scm_vis), scm_vis,
+ SCM_ARG4, "add-attribute-to-object");
+ SCM_ASSERT (scm_list_p(scm_show), scm_show,
+ SCM_ARG5, "add-attribute-to-object");
+
+ /* Get w_current and o_current */
+ o_current = g_get_object_from_object_smob(object);
+ printf("Object: %s.\n", o_current->name);
+ w_current = g_get_toplevel_from_object_smob(object);
+
+ /* Get parameters */
+ attrib_name = SCM_STRING_CHARS(scm_attrib_name);
+ attrib_value = SCM_STRING_CHARS(scm_attrib_value);
+ vis = SCM_NFALSEP(scm_vis);
+
+ for (i=0; i<=SCM_INUM(scm_length(scm_show))-1; i++) {
+ value = SCM_STRING_CHARS(scm_list_ref(scm_show, SCM_MAKINUM(i)));
+ SCM_ASSERT(!((strcasecmp(value, "name") != 0) &&
+ (strcasecmp(value, "value") != 0) ), scm_show,
+ SCM_ARG5, "add-attribute-to-object");
+ /* value = 1 => show value; name = 2 => show name; show = 3 => show both */
+ if (strcasecmp(value, "value") == 0) {
+ show |= 1;
+ }
+ else if (strcasecmp(value, "name") == 0) {
+ show |= 2;
+ }
+ }
+ /* Show name and value (show = 3) => show=0 for gschem */
+ if (show == 3) {
+ show = 0;
+ }
+
+ newtext = g_strdup_printf("%s=%s", attrib_name, attrib_value);
+ o_attrib_add_attrib (w_current, newtext, vis, show, o_current);
+ g_free(newtext);
+
+ return SCM_BOOL_T;
+
+}
+@ %def g_add_attrib
Index: gschem/noweb/g_register.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/g_register.nw,v
retrieving revision 1.28
diff -u -r1.28 g_register.nw
--- gschem/noweb/g_register.nw 28 Oct 2005 22:26:32 -0000 1.28
+++ gschem/noweb/g_register.nw 29 Jan 2006 16:29:28 -0000
@@ -345,13 +345,17 @@
}
g_init_attrib_smob ();
+ g_init_object_smob ();
/* Hook stuff */
scm_c_define_gsubr ("set-attribute-value!", 2, 0, 0, g_set_attrib_value_x);
+ scm_c_define_gsubr ("add-attribute-to-object", 5, 0, 0, g_add_attrib);
add_component_hook = scm_create_hook ("add-component-hook", 1);
copy_component_hook = scm_create_hook ("copy-component-hook", 1);
move_component_hook = scm_create_hook ("move-component-hook", 1);
+ add_pin_hook = scm_create_hook ("add-pin-hook", 1);
+
}
Index: gschem/noweb/globals.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/globals.nw,v
retrieving revision 1.9
diff -u -r1.9 globals.nw
--- gschem/noweb/globals.nw 27 Nov 2005 00:15:01 -0000 1.9
+++ gschem/noweb/globals.nw 29 Jan 2006 16:29:28 -0000
@@ -110,6 +110,7 @@
SCM add_component_hook;
SCM copy_component_hook;
SCM move_component_hook;
+SCM add_pin_hook;
-@ %def global_window_current rc_filename script_filename output_filename colormap visual white black do_logging logging_dest arc_draw_func box_draw_func circle_draw_func complex_draw_func line_draw_func net_draw_func bus_draw_func text_draw_func pin_draw_func select_func x_log_update_func quiet_mode verbose_mode stroke_info_mode object_buffer add_component_hook copy_component_hook move_component_hook
+@ %def global_window_current rc_filename script_filename output_filename colormap visual white black do_logging logging_dest arc_draw_func box_draw_func circle_draw_func complex_draw_func line_draw_func net_draw_func bus_draw_func text_draw_func pin_draw_func select_func x_log_update_func quiet_mode verbose_mode stroke_info_mode object_buffer add_component_hook copy_component_hook move_component_hook add_pin_hook
Index: gschem/noweb/i_vars.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/i_vars.nw,v
retrieving revision 1.19
diff -u -r1.19 i_vars.nw
--- gschem/noweb/i_vars.nw 28 Oct 2005 22:26:32 -0000 1.19
+++ gschem/noweb/i_vars.nw 29 Jan 2006 16:29:29 -0000
@@ -271,7 +271,8 @@
w_current->auto_save_interval = default_auto_save_interval;
if (w_current->auto_save_interval != 0) {
w_current->auto_save_timeout = g_timeout_add(w_current->auto_save_interval*1000,
- s_page_autosave, w_current);
+ (GSourceFunc) s_page_autosave,
+ w_current);
}
}
Index: gschem/noweb/o_pin.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_pin.nw,v
retrieving revision 1.9
diff -u -r1.9 o_pin.nw
--- gschem/noweb/o_pin.nw 7 Nov 2005 02:43:10 -0000 1.9
+++ gschem/noweb/o_pin.nw 29 Jan 2006 16:29:30 -0000
@@ -53,6 +53,7 @@
#include <libgeda/libgeda.h>
+#include "../include/globals.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -266,6 +267,7 @@
int color;
int size;
GList *other_objects = NULL;
+ OBJECT *o_current;
if (w_current->inside_action == 0) {
o_redraw(w_current, w_current->page_current->object_head);
@@ -356,6 +358,16 @@
w_current->last_x = (-1);
w_current->last_y = (-1);
w_current->page_current->CHANGED=1;
+
+ o_current = w_current->page_current->object_tail;
+
+ if (scm_hook_empty_p(add_pin_hook) == SCM_BOOL_F &&
+ o_current != NULL) {
+ scm_run_hook(add_pin_hook,
+ scm_cons(g_make_object_smob(w_current, o_current),
+ SCM_EOL));
+ }
+
o_undo_savestate(w_current, UNDO_ALL);
}
Index: libgeda/ChangeLog
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/ChangeLog,v
retrieving revision 1.287
diff -u -r1.287 ChangeLog
--- libgeda/ChangeLog 22 Jan 2006 13:55:33 -0000 1.287
+++ libgeda/ChangeLog 29 Jan 2006 16:29:40 -0000
@@ -1,3 +1,7 @@
+2006-01-29 Carlos Nieves Onega <[EMAIL PROTECTED]>
+ * include/prototype.h, include/struct.h, noweb/g_smob.nw:
+ Added new smob functions for OBJECT type.
+
2006-01-22 Ales Hvezda <[EMAIL PROTECTED]>
* autogen.sh, m4/gettext.m4: Removed m4 files since they are
Index: libgeda/include/prototype.h
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/include/prototype.h,v
retrieving revision 1.99
diff -u -r1.99 prototype.h
--- libgeda/include/prototype.h 7 Nov 2005 02:43:28 -0000 1.99
+++ libgeda/include/prototype.h 29 Jan 2006 16:29:43 -0000
@@ -66,6 +66,12 @@
SCM g_set_attrib_value_internal(SCM attrib_smob, SCM scm_value, TOPLEVEL **world, OBJECT **o_attrib, char *new_string[]);
void g_init_attrib_smob(void);
+SCM g_make_object_smob(TOPLEVEL *curr_w, OBJECT *object);
+SCM g_get_object_attributes(SCM object_smob);
+void g_init_object_smob(void);
+OBJECT *g_get_object_from_object_smob(SCM object_smob);
+TOPLEVEL *g_get_toplevel_from_object_smob(SCM object_smob);
+
/* i_vars.c */
void i_vars_libgeda_set(TOPLEVEL *w_current);
void i_vars_setnames(TOPLEVEL *w_current);
Index: libgeda/include/struct.h
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/include/struct.h,v
retrieving revision 1.79
diff -u -r1.79 struct.h
--- libgeda/include/struct.h 27 Nov 2005 00:15:05 -0000 1.79
+++ libgeda/include/struct.h 29 Jan 2006 16:29:45 -0000
@@ -990,4 +990,9 @@
ATTRIB *attribute;
};
+struct st_object_smob {
+ TOPLEVEL *world; /* We need this when updating schematic */
+ OBJECT *object;
+};
+
#endif
Index: libgeda/noweb/g_smob.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/g_smob.nw,v
retrieving revision 1.9
diff -u -r1.9 g_smob.nw
--- libgeda/noweb/g_smob.nw 14 Feb 2005 02:17:36 -0000 1.9
+++ libgeda/noweb/g_smob.nw 29 Jan 2006 16:29:46 -0000
@@ -19,6 +19,13 @@
<<g_smob.c : g_set_attrib_value_internal()>>
<<g_smob.c : g_init_attrib_smob()>>
+<<g_smob.c : g_free_object_smob()>>
+<<g_smob.c : g_print_object_smob()>>
+<<g_smob.c : g_make_object_smob()>>
+<<g_smob.c : g_get_object_attributes()>>
+<<g_smob.c : g_init_object_smob()>>
+<<g_smob.c : g_get_object_from_object_smob()>>
+<<g_smob.c : g_get_toplevel_from_object_smob()>>
@
@@ -73,6 +80,7 @@
<<g_smob.c : global variables>>=
static long attrib_smob_tag;
+static long object_smob_tag;
@ %def attrib_smob_tag
@@ -169,7 +177,6 @@
char *value = NULL;
SCM returned = SCM_EOL;
-
SCM_ASSERT ( SCM_NIMP(attrib_smob) &&
(SCM_CAR(attrib_smob) == attrib_smob_tag),
attrib_smob, SCM_ARG1, "get-attribute-name-value");
@@ -263,3 +270,171 @@
}
@ %def g_init_attrib_smob
+
+
+
[EMAIL PROTECTED] Function @code{g_free_attrib_smob()}
+
[EMAIL PROTECTED] g_free_object_smob object_smob
[EMAIL PROTECTED] defun
+
+<<g_smob.c : g_free_object_smob()>>=
+static scm_sizet
+g_free_object_smob(SCM object_smob)
+{
+ struct st_object_smob *object =
+ (struct st_object_smob *)SCM_CDR(object_smob);
+ scm_sizet size = sizeof(struct st_object_smob);
+
+ free(object);
+ return size;
+}
+
+@ %def g_free_object_smob
+
[EMAIL PROTECTED] Function @code{g_print_object_smob()}
+
[EMAIL PROTECTED] g_print_object_smob object_smob port pstate
[EMAIL PROTECTED] defun
+
+<<g_smob.c : g_print_object_smob()>>=
+static int
+g_print_object_smob(SCM object_smob, SCM port, scm_print_state *pstate)
+{
+ struct st_object_smob *object =
+ (struct st_object_smob *)SCM_CDR(object_smob);
+
+ /* I don't think this is valid, because C does not support this sort
+ * of evaluation, it will eval ALL the statements unlike pascal which
+ * will stop after the first FALSE -Ales */
+ if (object &&
+ object->object &&
+ object->object->name) {
+ scm_puts("#<object ", port);
+ scm_display (scm_makfrom0str (object->object->name),
+ port);
+ scm_puts(">", port);
+ }
+
+ /* non-zero means success */
+ return 1;
+}
+
+@ %def g_print_object_smob
+
[EMAIL PROTECTED] Function @code{g_make_object_smob()}
+
[EMAIL PROTECTED] g_make_object_smob curr_w curr_attr
[EMAIL PROTECTED] defun
+
+<<g_smob.c : g_make_object_smob()>>=
+/* Creates a name-value smob */
+SCM
+g_make_object_smob(TOPLEVEL *curr_w, OBJECT *object)
+{
+ struct st_object_smob *smob_object;
+
+ smob_object = (struct st_object_smob *)scm_must_malloc(
+ sizeof(struct st_object_smob), "object");
+
+ smob_object->world = curr_w;
+ smob_object->object = object;
+
+ /* Assumes Guile version >= 1.3.2 */
+ SCM_RETURN_NEWSMOB(object_smob_tag, smob_object);
+}
+
+@ %def g_make_object_smob
+
+
[EMAIL PROTECTED] Function @code{g_get_object_attributes()}
+
[EMAIL PROTECTED] g_get_object_attributes object_smob
[EMAIL PROTECTED] defun
+
+<<g_smob.c : g_get_object_attributes()>>=
+SCM
+g_get_object_attributes(SCM object_smob)
+{
+ TOPLEVEL *w_current;
+ struct st_object_smob *object;
+ SCM returned = SCM_EOL;
+
+ SCM_ASSERT ( SCM_NIMP(object_smob) &&
+ (SCM_CAR(object_smob) == object_smob_tag),
+ object_smob, SCM_ARG1, "get-object-attributes");
+
+ object = (struct st_object_smob *)SCM_CDR(object_smob);
+
+ if (object &&
+ object->object) {
+ ATTRIB *pointer;
+
+ pointer = object->object->attribs;
+ w_current = object->world;
+ while (pointer != NULL) {
+ returned = scm_cons (g_make_attrib_smob (w_current, pointer), returned);
+ }
+ }
+
+ return returned;
+}
+
+@ %def g_get_object_attributes
+
+
[EMAIL PROTECTED] Function @code{g_init_object_smob()}
+
[EMAIL PROTECTED] g_init_object_smob
[EMAIL PROTECTED] defun
+
+<<g_smob.c : g_init_object_smob()>>=
+void
+g_init_object_smob(void)
+{
+
+ object_smob_tag = scm_make_smob_type("object", sizeof (struct st_object_smob));
+ scm_set_smob_mark(object_smob_tag, 0);
+ scm_set_smob_free(object_smob_tag, g_free_object_smob);
+ scm_set_smob_print(object_smob_tag, g_print_object_smob);
+
+ scm_c_define_gsubr("get-object-attributes", 1, 0, 0, g_get_object_attributes);
+
+ return;
+}
+
+@ %def g_init_object_smob
+
[EMAIL PROTECTED] Function @code{g_free_attrib_smob()}
+
[EMAIL PROTECTED] g_get_object_from_object_smob object_smob
[EMAIL PROTECTED] defun
+
+<<g_smob.c : g_get_object_from_object_smob()>>=
+OBJECT *
+g_get_object_from_object_smob(SCM object_smob)
+{
+
+ SCM_ASSERT ( SCM_NIMP(object_smob) &&
+ (SCM_CAR(object_smob) == object_smob_tag),
+ object_smob, SCM_ARG1, "get_object_from_object_smob");
+ return ((OBJECT *) (((struct st_object_smob *)SCM_CDR(object_smob))->object));
+}
+
+@ %def g_get_object_from_object_smob
+
[EMAIL PROTECTED] g_get_object_from_object_smob object_smob
[EMAIL PROTECTED] defun
+
+<<g_smob.c : g_get_toplevel_from_object_smob()>>=
+TOPLEVEL *
+g_get_toplevel_from_object_smob(SCM object_smob)
+{
+
+ SCM_ASSERT ( SCM_NIMP(object_smob) &&
+ (SCM_CAR(object_smob) == object_smob_tag),
+ object_smob, SCM_ARG1, "get_toplevel_from_object_smob");
+ return ((TOPLEVEL *) (((struct st_object_smob *)SCM_CDR(object_smob))->world));
+}
+
+@ %def g_get_toplevel_from_object_smob