+ 2. Put a DECLARE_LRECORD() for the object below the struct definition,
+ along with the standard XFOO/XSETFOO junk.
+
+ 3. Add this header file to inline.c.
+
+ 4. Create the methods for your object. Note that technically you don't
+ need any, but you will almost always want at least a mark method.
+
+ 5. Define your object with DEFINE_LRECORD_IMPLEMENTATION() or some
+ variant.
+
+ 6. Include the header file in the .c file where you defined the object.
+
+ 7. Put a call to INIT_LRECORD_IMPLEMENTATION() for the object in the
+ .c file's syms_of_foo() function.
+
+ 8. Add a type enum for the object to enum lrecord_type, earlier in this
+ file.
+
+An example:
+
+------------------------------ in toolbar.h -----------------------------
+
+struct toolbar_button
+{
+ struct lcrecord_header header;
+
+ Lisp_Object next;
+ Lisp_Object frame;
+
+ Lisp_Object up_glyph;
+ Lisp_Object down_glyph;
+ Lisp_Object disabled_glyph;
+
+ Lisp_Object cap_up_glyph;
+ Lisp_Object cap_down_glyph;
+ Lisp_Object cap_disabled_glyph;
+
+ Lisp_Object callback;
+ Lisp_Object enabled_p;
+ Lisp_Object help_string;
+
+ char enabled;
+ char down;
+ char pushright;
+ char blank;
+
+ int x, y;
+ int width, height;
+ int dirty;
+ int vertical;
+ int border_width;
+};
+
+DECLARE_LRECORD (toolbar_button, struct toolbar_button);
+#define XTOOLBAR_BUTTON(x) XRECORD (x, toolbar_button, struct toolbar_button)
+#define XSETTOOLBAR_BUTTON(x, p) XSETRECORD (x, p, toolbar_button)
+#define TOOLBAR_BUTTONP(x) RECORDP (x, toolbar_button)
+#define CHECK_TOOLBAR_BUTTON(x) CHECK_RECORD (x, toolbar_button)
+#define CONCHECK_TOOLBAR_BUTTON(x) CONCHECK_RECORD (x, toolbar_button)
+
+------------------------------ in toolbar.c -----------------------------
+
+#include "toolbar.h"
+
+...
+
+static Lisp_Object
+mark_toolbar_button (Lisp_Object obj)
+{
+ struct toolbar_button *data = XTOOLBAR_BUTTON (obj);
+ mark_object (data->next);
+ mark_object (data->frame);
+ mark_object (data->up_glyph);
+ mark_object (data->down_glyph);
+ mark_object (data->disabled_glyph);
+ mark_object (data->cap_up_glyph);
+ mark_object (data->cap_down_glyph);
+ mark_object (data->cap_disabled_glyph);
+ mark_object (data->callback);
+ mark_object (data->enabled_p);
+ return data->help_string;
+}
+
+DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button,
+ mark_toolbar_button, 0, 0, 0, 0, 0,
+ struct toolbar_button);
+
+...
+
+void
+syms_of_toolbar (void)
+{
+ INIT_LRECORD_IMPLEMENTATION (toolbar_button);
+
+ ...;
+}
+
+------------------------------ in inline.c -----------------------------
+
+#ifdef HAVE_TOOLBARS
+#include "toolbar.h"
+#endif
+
+------------------------------ in lrecord.h -----------------------------
+
+enum lrecord_type
+{
+ ...
+ lrecord_type_toolbar_button,
+ ...
+};
+
+*/
+
+/*
+
+Note: Object types defined in external dynamically-loaded modules (not
+part of the XEmacs main source code) should use DECLARE_EXTERNAL_LRECORD
+and DEFINE_EXTERNAL_LRECORD_IMPLEMENTATION rather than DECLARE_LRECORD
+and DEFINE_LRECORD_IMPLEMENTATION.
+
+*/