From 171436ec74ce85914d5522e500b87aad7b619bb5 Mon Sep 17 00:00:00 2001
From: Chris Hanson <org/chris-hanson/cph>
Date: Sun, 28 Jun 1998 20:24:15 +0000
Subject: [PATCH] Export new procedure C-COMPUTE-INDENTATION for use by Java
 mode.

---
 v7/src/edwin/cinden.scm | 64 +++++++++++++++++++++--------------------
 v7/src/edwin/edwin.pkg  |  3 +-
 2 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/v7/src/edwin/cinden.scm b/v7/src/edwin/cinden.scm
index f6970f412..09f28eabc 100644
--- a/v7/src/edwin/cinden.scm
+++ b/v7/src/edwin/cinden.scm
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;	$Id: cinden.scm,v 1.16 1997/02/08 07:08:43 cph Exp $
+;;;	$Id: cinden.scm,v 1.17 1998/06/28 20:23:53 cph Exp $
 ;;;
-;;;	Copyright (c) 1986, 1989-97 Massachusetts Institute of Technology
+;;;	Copyright (c) 1986, 1989-98 Massachusetts Institute of Technology
 ;;;
 ;;;	This material was developed by the Scheme project at the
 ;;;	Massachusetts Institute of Technology, Department of
@@ -83,38 +83,40 @@ This is in addition to c-continued-statement-offset."
   exact-integer?)
 
 (define (c-indent-line start)
-  (let* ((start (line-start start 0))
-	 (old-indentation (mark-indentation start))
-	 (new-indentation
-	  (let ((indentation (calculate-indentation start false)))
-	    (cond ((not indentation)
-		   old-indentation)
-		  ((eq? indentation true)
-		   ;; Inside a comment.
-		   (mark-column
-		    (let* ((star?
-			    (char-match-forward #\* (indentation-end start)))
-			   (pend (whitespace-start start (group-start start)))
-			   (pstart (indentation-end pend))
-			   (comment-start
-			    (and (mark< pstart pend)
-				 (re-search-forward "/\\*[ \t]*" pstart pend
-						    false))))
-		      (cond ((not comment-start)
-			     pstart)
-			    (star?
-			     (mark1+ (re-match-start 0)))
-			    (else
-			     comment-start)))))
-		  ((char-match-forward #\# start)
-		   0)
-		  (else
-		   (indent-line:adjust-indentation (horizontal-space-end start)
-						   indentation))))))
-    (if (not (= new-indentation old-indentation))
+  (let ((old-indentation (mark-indentation start))
+	(new-indentation (c-compute-indentation start)))
+    (if (not (fix:= new-indentation old-indentation))
 	(change-indentation new-indentation start))
     (- new-indentation old-indentation)))
 
+(define (c-compute-indentation start)
+  (let ((start (line-start start 0)))
+    (let ((old-indentation (mark-indentation start)))
+      (let ((indentation (calculate-indentation start #f)))
+	(cond ((not indentation)
+	       old-indentation)
+	      ((eq? indentation true)
+	       ;; Inside a comment.
+	       (mark-column
+		(let* ((star?
+			(char-match-forward #\* (indentation-end start)))
+		       (pend (whitespace-start start (group-start start)))
+		       (pstart (indentation-end pend))
+		       (comment-start
+			(and (mark< pstart pend)
+			     (re-search-forward "/\\*[ \t]*" pstart pend #f))))
+		  (cond ((not comment-start)
+			 pstart)
+			(star?
+			 (mark1+ (re-match-start 0)))
+			(else
+			 comment-start)))))
+	      ((char-match-forward #\# start)
+	       0)
+	      (else
+	       (indent-line:adjust-indentation (horizontal-space-end start)
+					       indentation)))))))
+
 (define (indent-line:adjust-indentation start indentation)
   (cond ((or (looking-at-keyword? "case" start)
 	     (and (re-match-forward "[A-Za-z]" start)
diff --git a/v7/src/edwin/edwin.pkg b/v7/src/edwin/edwin.pkg
index 7b800477c..aebfe2961 100644
--- a/v7/src/edwin/edwin.pkg
+++ b/v7/src/edwin/edwin.pkg
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: edwin.pkg,v 1.222 1998/03/08 07:26:25 cph Exp $
+$Id: edwin.pkg,v 1.223 1998/06/28 20:24:15 cph Exp $
 
 Copyright (c) 1989-98 Massachusetts Institute of Technology
 
@@ -626,6 +626,7 @@ MIT in each case. |#
   (files "cinden")
   (parent (edwin))
   (export (edwin)
+	  c-compute-indentation
 	  c-indent-expression
 	  c-indent-line
 	  edwin-variable$c-argdecl-indent
-- 
2.25.1