Hi all,

As I was working on the "current-process-milliseconds" patch I noticed
there was still an OBSOLETE mark in the import file for chicken.time.
I started to clean up all the OBSOLETEs.  These two patches are the
result.

Regarding patch 0001, I checked the henrietta cache on the call-cc
server and only the iup egg is using C_pair.  I'll send a mail to
Thomas so he can replace C_pair with C_a_pair.

We can take some time before actually removing it, but I think it's
a good idea to make the deprecation official after 10 years ;)

Regarding patch 0002, it looks like we forgot to change
define-record-printer (perhaps because it, itself is deprecated)
to use set-record-printer! instead of ##sys#register-record-printer,
which means we can't remove that definition just yet.

Cheers,
Peter
From 518b25f881c6c15626487fc768895d66cbb13a75 Mon Sep 17 00:00:00 2001
From: Peter Bex <[email protected]>
Date: Wed, 20 May 2020 19:56:58 +0200
Subject: [PATCH 1/2] Officially deprecate C_pair in favor of C_a_pair

It has been marked as deprecated for 10 years in the runtime.c file,
but this was never "official" in any way, and the manual even had
C_pair() but not C_a_pair() in the "C interface" chapter.
---
 DEPRECATED         |  2 ++
 NEWS               |  2 ++
 chicken.h          | 12 ++++++------
 manual/C interface |  4 ++--
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/DEPRECATED b/DEPRECATED
index 8f25faa8..7d9cffe7 100644
--- a/DEPRECATED
+++ b/DEPRECATED
@@ -6,6 +6,8 @@ Deprecated functions and variables
   C_a_i_current_milliseconds have been deprecated in favor of
   current-process_milliseconds, C_current_process_milliseconds and
   C_a_i_current_process_milliseconds
+- C_pair() is now officially deprecated in favor of C_a_pair(), which
+  should also be faster.
 
 5.1.1
 
diff --git a/NEWS b/NEWS
index 67b81974..95fbb159 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@
   - Deprecated C_(a_i_current_)milliseconds in favor of
     C_(a_i_)current_process_milliseconds to match the Scheme-level
     deprecation of current-milliseconds.
+  - Officially deprecated C_pair() in favor of C_a_pair(); it has
+    been deprecated for years.
 
 - Build system
   - Auto-configure at build time on most platforms. Cross-compilation
diff --git a/chicken.h b/chicken.h
index b3ba54f0..d75fe04f 100644
--- a/chicken.h
+++ b/chicken.h
@@ -3370,7 +3370,7 @@ inline static C_word C_a_i_list2(C_word **a, int n, C_word x1, C_word x2)
 
 inline static C_word C_a_i_list3(C_word **a, int n, C_word x1, C_word x2, C_word x3)
 {
-  C_word x = C_pair(a, x3, C_SCHEME_END_OF_LIST);
+  C_word x = C_a_pair(a, x3, C_SCHEME_END_OF_LIST);
 
   x = C_a_pair(a, x2, x);
   return C_a_pair(a, x1, x);
@@ -3379,7 +3379,7 @@ inline static C_word C_a_i_list3(C_word **a, int n, C_word x1, C_word x2, C_word
 
 inline static C_word C_a_i_list4(C_word **a, int n, C_word x1, C_word x2, C_word x3, C_word x4)
 {
-  C_word x = C_pair(a, x4, C_SCHEME_END_OF_LIST);
+  C_word x = C_a_pair(a, x4, C_SCHEME_END_OF_LIST);
 
   x = C_a_pair(a, x3, x);
   x = C_a_pair(a, x2, x);
@@ -3390,7 +3390,7 @@ inline static C_word C_a_i_list4(C_word **a, int n, C_word x1, C_word x2, C_word
 inline static C_word C_a_i_list5(C_word **a, int n, C_word x1, C_word x2, C_word x3, C_word x4,
 			    C_word x5)
 {
-  C_word x = C_pair(a, x5, C_SCHEME_END_OF_LIST);
+  C_word x = C_a_pair(a, x5, C_SCHEME_END_OF_LIST);
 
   x = C_a_pair(a, x4, x);
   x = C_a_pair(a, x3, x);
@@ -3402,7 +3402,7 @@ inline static C_word C_a_i_list5(C_word **a, int n, C_word x1, C_word x2, C_word
 inline static C_word C_a_i_list6(C_word **a, int n, C_word x1, C_word x2, C_word x3, C_word x4,
 			    C_word x5, C_word x6)
 {
-  C_word x = C_pair(a, x6, C_SCHEME_END_OF_LIST);
+  C_word x = C_a_pair(a, x6, C_SCHEME_END_OF_LIST);
 
   x = C_a_pair(a, x5, x);
   x = C_a_pair(a, x4, x);
@@ -3415,7 +3415,7 @@ inline static C_word C_a_i_list6(C_word **a, int n, C_word x1, C_word x2, C_word
 inline static C_word C_a_i_list7(C_word **a, int n, C_word x1, C_word x2, C_word x3, C_word x4,
 			    C_word x5, C_word x6, C_word x7)
 {
-  C_word x = C_pair(a, x7, C_SCHEME_END_OF_LIST);
+  C_word x = C_a_pair(a, x7, C_SCHEME_END_OF_LIST);
 
   x = C_a_pair(a, x6, x);
   x = C_a_pair(a, x5, x);
@@ -3429,7 +3429,7 @@ inline static C_word C_a_i_list7(C_word **a, int n, C_word x1, C_word x2, C_word
 inline static C_word C_a_i_list8(C_word **a, int n, C_word x1, C_word x2, C_word x3, C_word x4,
 			    C_word x5, C_word x6, C_word x7, C_word x8)
 {
-  C_word x = C_pair(a, x8, C_SCHEME_END_OF_LIST);
+  C_word x = C_a_pair(a, x8, C_SCHEME_END_OF_LIST);
 
   x = C_a_pair(a, x7, x);
   x = C_a_pair(a, x6, x);
diff --git a/manual/C interface b/manual/C interface
index 0114e631..f8c07d4b 100644
--- a/manual/C interface	
+++ b/manual/C interface	
@@ -373,9 +373,9 @@ accessor macros instead).
 
  [C function] C_word C_intern3 (C_word **ptr, char *zero_terminated_string, C_word initial_value)
 
-===== C_pair
+===== C_a_pair
 
- [C function] C_word C_pair (C_word **ptr, C_word car, C_word cdr)
+ [C function] C_word C_a_pair (C_word **ptr, C_word car, C_word cdr)
 
 ===== C_flonum
 
-- 
2.20.1

From 498be2fe033e6699c5f53901cd7ca0aadf9015d8 Mon Sep 17 00:00:00 2001
From: Peter Bex <[email protected]>
Date: Wed, 20 May 2020 20:14:38 +0200
Subject: [PATCH 2/2] Remove several obsolete leftovers from earlier refactors

Some of these were due to various macro and module overhauls which
have now been completed.  After removal, core can still be
bootstrapped with CHICKEN 5.2.0, so it's completely safe to finally
remove this cruft.

Could not yet remove ##sys#register-record-printer! because it was
still being used by some macros.  These have now been updated to use
chicken.base#set-record-printer! so this can be finally removed after
we make a new development snapshot.
---
 chicken-syntax.scm      | 22 +++++-----------------
 chicken.time.import.scm |  5 +----
 expand.scm              |  1 -
 profiler.scm            |  3 +--
 4 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/chicken-syntax.scm b/chicken-syntax.scm
index e3c2feb4..c1ade0ab 100644
--- a/chicken-syntax.scm
+++ b/chicken-syntax.scm
@@ -1044,8 +1044,9 @@
  (##sys#er-transformer
   (lambda (form r c)
     (##sys#check-syntax 'define-record-printer form '(_ _ . _))
-    (let ([head (cadr form)]
-	  [body (cddr form)])
+    (let ((head (cadr form))
+	  (body (cddr form))
+	  (%set-record-printer! (r 'chicken.base#set-record-printer!)))
       (cond [(pair? head)
 	     (##sys#check-syntax 
 	      'define-record-printer (cons head body)
@@ -1056,7 +1057,7 @@
 			      (##sys#module-name (##sys#current-module))
 			      '|#| plain-name)
 			     plain-name)))
-	       `(##sys#register-record-printer
+	       `(,%set-record-printer!
 		 (##core#quote ,tag)
 		 (##core#lambda ,(##sys#slot head 1) ,@body)))]
 	    (else
@@ -1067,7 +1068,7 @@
 			      (##sys#module-name (##sys#current-module))
 			      '|#| plain-name)
 			     plain-name)))
-	       `(##sys#register-record-printer
+	       `(,%set-record-printer!
 		 (##core#quote ,tag) ,@body))))))))
 
 ;;; SRFI-9:
@@ -1308,19 +1309,6 @@
 
 (macro-subset me0 ##sys#default-macro-environment)))
 
-
-(set! ##sys#chicken-macro-environment ;; OBSOLETE, remove after bootstrapping
-  (let ((me0 (##sys#macro-environment)))
-
-;; capture current macro env and add all the preceding ones as well
-
-;; TODO: omit `chicken.{base,condition,time,type}-m-e' when plain "chicken" module goes away
-(append ##sys#chicken.condition-macro-environment
-	##sys#chicken.time-macro-environment
-	##sys#chicken.type-macro-environment
-	##sys#chicken.base-macro-environment
-	(macro-subset me0 ##sys#default-macro-environment))))
-
 ;; register features
 
 (chicken.platform#register-feature! 'srfi-8 'srfi-11 'srfi-15 'srfi-16 'srfi-26 'srfi-31)
diff --git a/chicken.time.import.scm b/chicken.time.import.scm
index eb4a4b29..464bce39 100644
--- a/chicken.time.import.scm
+++ b/chicken.time.import.scm
@@ -30,7 +30,4 @@
     (current-milliseconds . chicken.time#current-milliseconds) ; DEPRECATED
     (current-process-milliseconds . chicken.time#current-process-milliseconds)
     (current-seconds . chicken.time#current-seconds))
- ;; OBSOLETE: This can be removed after bootstrapping
- (if (##sys#symbol-has-toplevel-binding? '##sys#chicken.time-macro-environment)
-     ##sys#chicken.time-macro-environment
-     ##sys#chicken.base-macro-environment))
+ ##sys#chicken.time-macro-environment)
diff --git a/expand.scm b/expand.scm
index 3e60f7e7..b228be8c 100644
--- a/expand.scm
+++ b/expand.scm
@@ -163,7 +163,6 @@
 
 (define ##sys#scheme-macro-environment '()) ; reassigned below
 ;; These are all re-assigned by chicken-syntax.scm:
-(define ##sys#chicken-macro-environment '()) ; used later in chicken.import.scm [OBSOLETE]
 (define ##sys#chicken-ffi-macro-environment '()) ; used later in foreign.import.scm
 (define ##sys#chicken.condition-macro-environment '()) ; used later in chicken.condition.import.scm
 (define ##sys#chicken.time-macro-environment '()) ; used later in chicken.time.import.scm
diff --git a/profiler.scm b/profiler.scm
index cbd3f78d..eafb0646 100644
--- a/profiler.scm
+++ b/profiler.scm
@@ -81,8 +81,7 @@
 
 ;;; Entry and exit into/out of profiled lambda:
 
-;; XXX TODO: Should be changed to unsigned-integer64 after bootstrapping
-(define cpu-ms (foreign-lambda unsigned-integer "C_cpu_milliseconds"))
+(define cpu-ms (foreign-lambda unsigned-integer64 "C_cpu_milliseconds"))
 
 (define ##sys#profile-entry 
   (let ((maxfix most-positive-fixnum))
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to