diff src/event-stream.c @ 5117:3742ea8250b5 ben-lisp-object ben-lisp-object-final-ws-year-2005

Checking in final CVS version of workspace 'ben-lisp-object'
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 00:20:27 -0600
parents facf3239ba30
children e0db3c197671
line wrap: on
line diff
--- a/src/event-stream.c	Sat Dec 26 00:20:16 2009 -0600
+++ b/src/event-stream.c	Sat Dec 26 00:20:27 2009 -0600
@@ -2,7 +2,7 @@
    Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
    Copyright (C) 1995 Board of Trustees, University of Illinois.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1995, 1996, 2001, 2002, 2003 Ben Wing.
+   Copyright (C) 1995, 1996, 2001, 2002, 2003, 2005 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -329,10 +329,6 @@
 #define CHECK_COMMAND_BUILDER(x) CHECK_RECORD (x, command_builder)
 #define CONCHECK_COMMAND_BUILDER(x) CONCHECK_RECORD (x, command_builder)
 
-#ifndef MC_ALLOC
-static Lisp_Object Vcommand_builder_free_list;
-#endif /* not MC_ALLOC */
-
 static const struct memory_description command_builder_description [] = {
   { XD_LISP_OBJECT, offsetof (struct command_builder, current_events) },
   { XD_LISP_OBJECT, offsetof (struct command_builder, most_current_event) },
@@ -368,12 +364,12 @@
     }
 }
 
-DEFINE_LRECORD_IMPLEMENTATION ("command-builder", command_builder,
-			       0, /*dumpable-flag*/
-                               mark_command_builder, internal_object_printer,
-			       finalize_command_builder, 0, 0, 
-			       command_builder_description,
-			       struct command_builder);
+DEFINE_NONDUMPABLE_LISP_OBJECT ("command-builder", command_builder,
+					   mark_command_builder,
+					   0,
+					   finalize_command_builder, 0, 0, 
+					   command_builder_description,
+					   struct command_builder);
 
 static void
 reset_command_builder_event_chain (struct command_builder *builder)
@@ -388,13 +384,7 @@
 Lisp_Object
 allocate_command_builder (Lisp_Object console, int with_echo_buf)
 {
-  Lisp_Object builder_obj =
-#ifdef MC_ALLOC
-    wrap_pointer_1 (alloc_lrecord_type (struct command_builder,
-					 &lrecord_command_builder));
-#else /* not MC_ALLOC */
-    alloc_managed_lcrecord (Vcommand_builder_free_list);
-#endif /* not MC_ALLOC */
+  Lisp_Object builder_obj = ALLOC_LISP_OBJECT (command_builder);
   struct command_builder *builder = XCOMMAND_BUILDER (builder_obj);
 
   builder->console = console;
@@ -463,12 +453,7 @@
       xfree (builder->echo_buf, Ibyte *);
       builder->echo_buf = NULL;
     }
-#ifdef MC_ALLOC
-  free_lrecord (wrap_command_builder (builder));
-#else /* not MC_ALLOC */
-  free_managed_lcrecord (Vcommand_builder_free_list,
-			 wrap_command_builder (builder));
-#endif /* not MC_ALLOC */
+  FREE_LCRECORD (wrap_command_builder (builder));
 }
 
 static void
@@ -1031,10 +1016,6 @@
 
 static Lisp_Object pending_timeout_list, pending_async_timeout_list;
 
-#ifndef MC_ALLOC
-static Lisp_Object Vtimeout_free_list;
-#endif /* not MC_ALLOC */
-
 static Lisp_Object
 mark_timeout (Lisp_Object obj)
 {
@@ -1049,10 +1030,8 @@
   { XD_END }
 };
 
-DEFINE_LRECORD_IMPLEMENTATION ("timeout", timeout,
-			       1, /*dumpable-flag*/
-			       mark_timeout, internal_object_printer,
-			       0, 0, 0, timeout_description, Lisp_Timeout);
+DEFINE_INTERNAL_LISP_OBJECT ("timeout", timeout, Lisp_Timeout,
+			     timeout_description, mark_timeout);
 
 /* Generate a timeout and return its ID. */
 
@@ -1062,12 +1041,7 @@
 			      Lisp_Object function, Lisp_Object object,
 			      int async_p)
 {
-#ifdef MC_ALLOC
-  Lisp_Object op = 
-    wrap_pointer_1 (alloc_lrecord_type (Lisp_Timeout, &lrecord_timeout));
-#else /* not MC_ALLOC */
-  Lisp_Object op = alloc_managed_lcrecord (Vtimeout_free_list);
-#endif /* not MC_ALLOC */
+  Lisp_Object op = ALLOC_LISP_OBJECT (timeout);
   Lisp_Timeout *timeout = XTIMEOUT (op);
   EMACS_TIME current_time;
   EMACS_TIME interval;
@@ -1185,11 +1159,7 @@
       *timeout_list = noseeum_cons (op, *timeout_list);
     }
   else
-#ifdef MC_ALLOC
-    free_lrecord (op);
-#else /* not MC_ALLOC */
-    free_managed_lcrecord (Vtimeout_free_list, op);
-#endif /* not MC_ALLOC */
+    FREE_LCRECORD (op);
 
   UNGCPRO;
   return id;
@@ -1226,11 +1196,7 @@
 	signal_remove_async_interval_timeout (timeout->interval_id);
       else
 	event_stream_remove_timeout (timeout->interval_id);
-#ifdef MC_ALLOC
-      free_lrecord (op);
-#else /* not MC_ALLOC */
-      free_managed_lcrecord (Vtimeout_free_list, op);
-#endif /* not MC_ALLOC */
+      FREE_LCRECORD (op);
     }
 }
 
@@ -4870,8 +4836,8 @@
 void
 syms_of_event_stream (void)
 {
-  INIT_LRECORD_IMPLEMENTATION (command_builder);
-  INIT_LRECORD_IMPLEMENTATION (timeout);
+  INIT_LISP_OBJECT (command_builder);
+  INIT_LISP_OBJECT (timeout);
 
   DEFSYMBOL (Qdisabled);
   DEFSYMBOL (Qcommand_event_p);
@@ -4925,15 +4891,6 @@
   recent_keys_ring_index = 0;
   recent_keys_ring_size = 100;
   num_input_chars = 0;
-#ifndef MC_ALLOC
-  Vtimeout_free_list = make_lcrecord_list (sizeof (Lisp_Timeout),
-					   &lrecord_timeout);
-  staticpro_nodump (&Vtimeout_free_list);
-  Vcommand_builder_free_list =
-    make_lcrecord_list (sizeof (struct command_builder),
-			&lrecord_command_builder);
-  staticpro_nodump (&Vcommand_builder_free_list);
-#endif /* not MC_ALLOC */
   the_low_level_timeout_blocktype =
     Blocktype_new (struct low_level_timeout_blocktype);
   something_happened = 0;