CVS update by aidan packages/xemacs-packages/pgg ...

[email protected]
Newsgroups gmane.emacs.xemacs.cvs
Message-ID <[email protected]>
  User: aidan   
  Date: 09/01/25 23:06:44

  Modified:    packages/xemacs-packages/pgg ChangeLog pgg-parse.el
Log:
Check CCL available at run time, not compile time, in PGG.

Revision  Changes    Path
1.27      +9 -0      XEmacs/packages/xemacs-packages/pgg/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/pgg/ChangeLog,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -p -r1.26 -r1.27
--- ChangeLog	2005/09/26 06:13:54	1.26
+++ ChangeLog	2009/01/25 22:06:41	1.27
@@ -1,3 +1,12 @@
+2007-12-23  Aidan Kehoe  <[email protected]>
+
+	* pgg-parse.el (pgg-parse-crc24): 
+	Provide the CCL program, independent of whether
+	#'define-ccl-program was available at compile time. 
+	* pgg-parse.el (pgg-parse-crc24-string):
+	Only call the CCL program if #'ccl-execute-on-string is available,
+	which it will be, if the current emacs has CCL support.
+
 2005-09-26  Norbert Koch  <[email protected]>
 
 	* Makefile (VERSION): XEmacs package 1.06 released.



1.6       +35 -18    XEmacs/packages/xemacs-packages/pgg/pgg-parse.el

Index: pgg-parse.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/pgg/pgg-parse.el,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- pgg-parse.el	2005/09/23 12:53:14	1.5
+++ pgg-parse.el	2009/01/25 22:06:42	1.6
@@ -35,7 +35,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl) (when (featurep 'mule) (require 'ccl)))
 
 (defgroup pgg-parse ()
   "OpenPGP packet parsing."
@@ -159,25 +159,42 @@
 (defmacro pgg-set-alist (alist key value)
   `(setq ,alist (nconc ,alist (list (cons ,key ,value)))))
 
-(when (fboundp 'define-ccl-program)
+(defconst pgg-parse-crc24 
+  (eval-when-compile
+    (let ((pre-existing
+	   [1 30 14 114744 114775 0 161 131127 1 148217 15 82167 1 1848
+	   131159 1 1595 5 256 114743 390 114775 19707 1467 16 7 183 1 -5628
+	   -7164 22]))
+      (when (fboundp #'ccl-compile)
+	(assert
+	 (equal
+	  pre-existing
+	  (ccl-compile 
+	   '(1
+	     ((loop
+		(read r0) (r1 ^= r0) (r2 ^= 0)
+		(r5 = 0)
+		(loop
+		  (r1 <<= 1)
+		  (r1 += ((r2 >> 15) & 1))
+		  (r2 <<= 1)
+		  (if (r1 & 256)
+		      ((r1 ^= 390) (r2 ^= 19707)))
+		  (if (r5 < 7)
+		      ((r5 += 1)
+		       (repeat))))
+		(repeat))))))
+	 nil
+	 "The pre-compiled CCL program appears broken, or the implementation
+of `ccl-compile' has changed versus to when this code was written.  "))
+      pre-existing))
+  "A CCL program to parse CRC 24 checksums.  See `define-ccl-program'.")
 
-  (define-ccl-program pgg-parse-crc24
-    '(1
-      ((loop
-	(read r0) (r1 ^= r0) (r2 ^= 0)
-	(r5 = 0)
-	(loop
-	 (r1 <<= 1)
-	 (r1 += ((r2 >> 15) & 1))
-	 (r2 <<= 1)
-	 (if (r1 & 256)
-	     ((r1 ^= 390) (r2 ^= 19707)))
-	 (if (r5 < 7)
-	     ((r5 += 1)
-	      (repeat))))
-	(repeat)))))
+(put 'pgg-parse-crc24 'ccl-program-idx
+     (register-ccl-program 'pgg-parse-crc24 pgg-parse-crc24))
 
-  (defun pgg-parse-crc24-string (string)
+(defun pgg-parse-crc24-string (string)
+  (when (fboundp #'ccl-execute-on-string)
     (let ((h (vector nil 183 1230 nil nil nil nil nil nil)))
       (ccl-execute-on-string pgg-parse-crc24 h string)
       (format "%c%c%c"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.