changeset 5354:22c4e67a2e69

Remove #'acons from cl.el, make the version in alloc.c visible to Lisp src/ChangeLog addition: 2011-02-09 Aidan Kehoe <kehoea@parhasard.net> * alloc.c (Facons): * alloc.c (Fobject_memory_usage): * alloc.c (syms_of_alloc): * faces.c (complex_vars_of_faces): * lisp.h: * mc-alloc.c (Fmc_alloc_memory_usage): Rename acons() to Facons(), make it visible to Lisp. Change uses of the function in C accordingly. lisp/ChangeLog addition: 2011-02-09 Aidan Kehoe <kehoea@parhasard.net> * cl.el (acons): Removed, make the implementation in alloc.c visible to Lisp instead.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 09 Feb 2011 20:15:50 +0000
parents 38e24b8be4ea
children 70b15ac66ee5
files lisp/ChangeLog lisp/cl.el src/ChangeLog src/alloc.c src/faces.c src/lisp.h src/mc-alloc.c
diffstat 7 files changed, 73 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Feb 07 12:01:24 2011 +0000
+++ b/lisp/ChangeLog	Wed Feb 09 20:15:50 2011 +0000
@@ -1,3 +1,8 @@
+2011-02-09  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* cl.el (acons): Removed, make the implementation in alloc.c
+	visible to Lisp instead.
+
 2011-02-07  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* bytecomp.el:
--- a/lisp/cl.el	Mon Feb 07 12:01:24 2011 +0000
+++ b/lisp/cl.el	Wed Feb 09 20:15:50 2011 +0000
@@ -544,9 +544,7 @@
 (defalias 'cl-round 'round*)
 (defalias 'cl-mod 'mod*)
 
-(defun acons (key value alist)
-  "Return a new alist created by adding (KEY . VALUE) to ALIST."
-  (cons (cons key value) alist))
+;;; XEmacs; #'acons is in C.
 
 (defun pairlis (keys values &optional alist)
   "Make an alist from KEYS and VALUES.
--- a/src/ChangeLog	Mon Feb 07 12:01:24 2011 +0000
+++ b/src/ChangeLog	Wed Feb 09 20:15:50 2011 +0000
@@ -1,3 +1,14 @@
+2011-02-09  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* alloc.c (Facons):
+	* alloc.c (Fobject_memory_usage):
+	* alloc.c (syms_of_alloc):
+	* faces.c (complex_vars_of_faces):
+	* lisp.h:
+	* mc-alloc.c (Fmc_alloc_memory_usage):
+	Rename acons() to Facons(), make it visible to Lisp. Change uses
+	of the function in C accordingly.
+
 2011-02-07  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* keymap.c (describe_map_sort_predicate): Correct the order of
--- a/src/alloc.c	Mon Feb 07 12:01:24 2011 +0000
+++ b/src/alloc.c	Wed Feb 09 20:15:50 2011 +0000
@@ -1428,8 +1428,10 @@
   return Fcons (obj0, Fcons (obj1, obj2));
 }
 
-Lisp_Object
-acons (Lisp_Object key, Lisp_Object value, Lisp_Object alist)
+DEFUN ("acons", Facons, 3, 3, 0, /*
+Return a new alist created by prepending (KEY . VALUE) to ALIST.
+*/
+       (key, value, alist))
 {
   return Fcons (Fcons (key, value), alist);
 }
@@ -4197,10 +4199,10 @@
   xzero (object_stats);
   lisp_object_storage_size (object, &object_stats);
 
-  val = acons (Qobject_actually_requested,
-	       make_int (object_stats.was_requested), val);
-  val = acons (Qobject_malloc_overhead,
-	       make_int (object_stats.malloc_overhead), val);
+  val = Facons (Qobject_actually_requested,
+		make_int (object_stats.was_requested), val);
+  val = Facons (Qobject_malloc_overhead,
+		make_int (object_stats.malloc_overhead), val);
   assert (!object_stats.dynarr_overhead);
   assert (!object_stats.gap_overhead);
 
@@ -4210,16 +4212,16 @@
       MAYBE_OBJECT_METH (object, memory_usage, (object, &gustats));
 
       val = Fcons (Qt, val);
-      val = acons (Qother_memory_actually_requested,
-		   make_int (gustats.u.was_requested), val);
-      val = acons (Qother_memory_malloc_overhead,
-		   make_int (gustats.u.malloc_overhead), val);
+      val = Facons (Qother_memory_actually_requested,
+		    make_int (gustats.u.was_requested), val);
+      val = Facons (Qother_memory_malloc_overhead,
+		    make_int (gustats.u.malloc_overhead), val);
       if (gustats.u.dynarr_overhead)
-	val = acons (Qother_memory_dynarr_overhead,
-		     make_int (gustats.u.dynarr_overhead), val);
+	val = Facons (Qother_memory_dynarr_overhead,
+		      make_int (gustats.u.dynarr_overhead), val);
       if (gustats.u.gap_overhead)
-	val = acons (Qother_memory_gap_overhead,
-		     make_int (gustats.u.gap_overhead), val);
+	val = Facons (Qother_memory_gap_overhead,
+		      make_int (gustats.u.gap_overhead), val);
       val = Fcons (Qnil, val);
 
       i = 0;
@@ -4230,7 +4232,7 @@
 	      val = Fcons (item, val);
 	    else
 	      {
-		val = acons (item, make_int (gustats.othervals[i]), val);
+		val = Facons (item, make_int (gustats.othervals[i]), val);
 		i++;
 	      }
 	  }
@@ -5701,6 +5703,7 @@
 
   DEFSUBR (Fcons);
   DEFSUBR (Flist);
+  DEFSUBR (Facons);
   DEFSUBR (Fvector);
   DEFSUBR (Fbit_vector);
   DEFSUBR (Fmake_byte_code);
--- a/src/faces.c	Mon Feb 07 12:01:24 2011 +0000
+++ b/src/faces.c	Wed Feb 09 20:15:50 2011 +0000
@@ -2266,22 +2266,22 @@
     Lisp_Object fg_fb = Qnil, bg_fb = Qnil;
 
 #ifdef HAVE_GTK
-    fg_fb = acons (list1 (Qgtk), build_ascstring ("black"), fg_fb);
-    bg_fb = acons (list1 (Qgtk), build_ascstring ("white"), bg_fb);
+    fg_fb = Facons (list1 (Qgtk), build_ascstring ("black"), fg_fb);
+    bg_fb = Facons (list1 (Qgtk), build_ascstring ("white"), bg_fb);
 #endif
 #ifdef HAVE_X_WINDOWS
-    fg_fb = acons (list1 (Qx), build_ascstring ("black"), fg_fb);
-    bg_fb = acons (list1 (Qx), build_ascstring ("gray80"), bg_fb);
+    fg_fb = Facons (list1 (Qx), build_ascstring ("black"), fg_fb);
+    bg_fb = Facons (list1 (Qx), build_ascstring ("gray80"), bg_fb);
 #endif
 #ifdef HAVE_TTY
-    fg_fb = acons (list1 (Qtty), Fvector (0, 0), fg_fb);
-    bg_fb = acons (list1 (Qtty), Fvector (0, 0), bg_fb);
+    fg_fb = Facons (list1 (Qtty), Fvector (0, 0), fg_fb);
+    bg_fb = Facons (list1 (Qtty), Fvector (0, 0), bg_fb);
 #endif
 #ifdef HAVE_MS_WINDOWS
-    fg_fb = acons (list1 (Qmsprinter), build_ascstring ("black"), fg_fb);
-    bg_fb = acons (list1 (Qmsprinter), build_ascstring ("white"), bg_fb);
-    fg_fb = acons (list1 (Qmswindows), build_ascstring ("black"), fg_fb);
-    bg_fb = acons (list1 (Qmswindows), build_ascstring ("white"), bg_fb);
+    fg_fb = Facons (list1 (Qmsprinter), build_ascstring ("black"), fg_fb);
+    bg_fb = Facons (list1 (Qmsprinter), build_ascstring ("white"), bg_fb);
+    fg_fb = Facons (list1 (Qmswindows), build_ascstring ("black"), fg_fb);
+    bg_fb = Facons (list1 (Qmswindows), build_ascstring ("white"), bg_fb);
 #endif
     set_specifier_fallback (Fget (Vdefault_face, Qforeground, Qnil), fg_fb);
     set_specifier_fallback (Fget (Vdefault_face, Qbackground, Qnil), bg_fb);
@@ -2519,22 +2519,22 @@
     /* We need to put something in there, or error checking gets
        #%!@#ed up before the styles are set, which override the
        fallbacks. */
-    fg_fb = acons (list1 (Qgtk), build_ascstring ("black"), fg_fb);
-    bg_fb = acons (list1 (Qgtk), build_ascstring ("Gray80"), bg_fb);
+    fg_fb = Facons (list1 (Qgtk), build_ascstring ("black"), fg_fb);
+    bg_fb = Facons (list1 (Qgtk), build_ascstring ("Gray80"), bg_fb);
 #endif
 #ifdef HAVE_X_WINDOWS
-    fg_fb = acons (list1 (Qx), build_ascstring ("black"), fg_fb);
-    bg_fb = acons (list1 (Qx), build_ascstring ("Gray80"), bg_fb);
+    fg_fb = Facons (list1 (Qx), build_ascstring ("black"), fg_fb);
+    bg_fb = Facons (list1 (Qx), build_ascstring ("Gray80"), bg_fb);
 #endif
 #ifdef HAVE_TTY
-    fg_fb = acons (list1 (Qtty), Fvector (0, 0), fg_fb);
-    bg_fb = acons (list1 (Qtty), Fvector (0, 0), bg_fb);
+    fg_fb = Facons (list1 (Qtty), Fvector (0, 0), fg_fb);
+    bg_fb = Facons (list1 (Qtty), Fvector (0, 0), bg_fb);
 #endif
 #ifdef HAVE_MS_WINDOWS
-    fg_fb = acons (list1 (Qmsprinter), build_ascstring ("black"), fg_fb);
-    bg_fb = acons (list1 (Qmsprinter), build_ascstring ("white"), bg_fb);
-    fg_fb = acons (list1 (Qmswindows), build_ascstring ("black"), fg_fb);
-    bg_fb = acons (list1 (Qmswindows), build_ascstring ("Gray75"), bg_fb);
+    fg_fb = Facons (list1 (Qmsprinter), build_ascstring ("black"), fg_fb);
+    bg_fb = Facons (list1 (Qmsprinter), build_ascstring ("white"), bg_fb);
+    fg_fb = Facons (list1 (Qmswindows), build_ascstring ("black"), fg_fb);
+    bg_fb = Facons (list1 (Qmswindows), build_ascstring ("Gray75"), bg_fb);
 #endif
     set_specifier_fallback (Fget (Vgui_element_face, Qforeground, Qnil), fg_fb);
     set_specifier_fallback (Fget (Vgui_element_face, Qbackground, Qnil), bg_fb);
--- a/src/lisp.h	Mon Feb 07 12:01:24 2011 +0000
+++ b/src/lisp.h	Wed Feb 09 20:15:50 2011 +0000
@@ -4275,6 +4275,7 @@
 /* Defined in alloc.c */
 MODULE_API EXFUN (Fcons, 2);
 MODULE_API EXFUN (Flist, MANY);
+MODULE_API EXFUN (Facons, 3);
 EXFUN (Fbit_vector, MANY);
 EXFUN (Fmake_byte_code, MANY);
 MODULE_API EXFUN (Fmake_list, 2);
@@ -4299,7 +4300,6 @@
 #ifndef NEW_GC
 void garbage_collect_1 (void);
 #endif /* not NEW_GC */
-MODULE_API Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
 MODULE_API Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object);
 MODULE_API Lisp_Object list1 (Lisp_Object);
 MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object);
--- a/src/mc-alloc.c	Mon Feb 07 12:01:24 2011 +0000
+++ b/src/mc-alloc.c	Wed Feb 09 20:15:50 2011 +0000
@@ -1987,29 +1987,29 @@
   for (i = 0; i < N_FREE_PAGE_LISTS; i++) 
     if (PLH_PAGE_COUNT (FREE_HEAP_PAGES(i)) > 0)
       free_plhs = 
-	acons (make_int (PLH_SIZE (FREE_HEAP_PAGES(i))),
-	       list1 (make_int (PLH_PAGE_COUNT (FREE_HEAP_PAGES(i)))),
-	       free_plhs);
+	Facons (make_int (PLH_SIZE (FREE_HEAP_PAGES(i))),
+		list1 (make_int (PLH_PAGE_COUNT (FREE_HEAP_PAGES(i)))),
+		free_plhs);
 
   for (i = 0; i < N_USED_PAGE_LISTS; i++) 
     if (PLH_PAGE_COUNT (USED_HEAP_PAGES(i)) > 0)
       used_plhs = 
-	acons (make_int (PLH_SIZE (USED_HEAP_PAGES(i))),
-	       list5 (make_int (PLH_PAGE_COUNT (USED_HEAP_PAGES(i))),
-		      make_int (PLH_USED_CELLS (USED_HEAP_PAGES(i))),
-		      make_int (PLH_USED_SPACE (USED_HEAP_PAGES(i))),
-		      make_int (PLH_TOTAL_CELLS (USED_HEAP_PAGES(i))),
-		      make_int (PLH_TOTAL_SPACE (USED_HEAP_PAGES(i)))),
-	       used_plhs);
+	Facons (make_int (PLH_SIZE (USED_HEAP_PAGES(i))),
+		list5 (make_int (PLH_PAGE_COUNT (USED_HEAP_PAGES(i))),
+		       make_int (PLH_USED_CELLS (USED_HEAP_PAGES(i))),
+		       make_int (PLH_USED_SPACE (USED_HEAP_PAGES(i))),
+		       make_int (PLH_TOTAL_CELLS (USED_HEAP_PAGES(i))),
+		       make_int (PLH_TOTAL_SPACE (USED_HEAP_PAGES(i)))),
+		used_plhs);
 
   used_plhs =
-    acons (make_int (0),
-	   list5 (make_int (PLH_PAGE_COUNT(ARRAY_HEAP_PAGES)),
-		  make_int (PLH_USED_CELLS (ARRAY_HEAP_PAGES)),
-		  make_int (PLH_USED_SPACE (ARRAY_HEAP_PAGES)),
-		  make_int (PLH_TOTAL_CELLS (ARRAY_HEAP_PAGES)),
-		  make_int (PLH_TOTAL_SPACE (ARRAY_HEAP_PAGES))),
-	   used_plhs);
+    Facons (make_int (0),
+	    list5 (make_int (PLH_PAGE_COUNT(ARRAY_HEAP_PAGES)),
+		   make_int (PLH_USED_CELLS (ARRAY_HEAP_PAGES)),
+		   make_int (PLH_USED_SPACE (ARRAY_HEAP_PAGES)),
+		   make_int (PLH_TOTAL_CELLS (ARRAY_HEAP_PAGES)),
+		   make_int (PLH_TOTAL_SPACE (ARRAY_HEAP_PAGES))),
+	    used_plhs);
   
   for (i = 0; i < N_HEAP_SECTIONS; i++) {
     used_size += HEAP_SECTION(i).n_pages * PAGE_SIZE;