From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/28205 Path: main.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: cl Date: 14 Dec 1999 06:37:23 -0500 (EST) Organization: Emacsen advocacy group Sender: owner-ding@hpc.uh.edu Message-ID: References: <9t9ln6xrdkt.fsf@mraz.iskon.hr> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 (generated by WEMIKO 1.13.9 - "Euglena tripteris") Content-Type: multipart/mixed; boundary="Multipart_Tue_Dec_14_06:37:22_1999-1" X-Trace: main.gmane.org 1035165095 28699 80.91.224.250 (21 Oct 2002 01:51:35 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 01:51:35 +0000 (UTC) Return-Path: Original-Received: from spinoza.math.uh.edu (spinoza.math.uh.edu [129.7.128.18]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id GAA13737 for ; Tue, 14 Dec 1999 06:38:07 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by spinoza.math.uh.edu (8.9.1/8.9.1) with ESMTP id FAB24551; Tue, 14 Dec 1999 05:38:05 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Tue, 14 Dec 1999 05:37:56 -0600 (CST) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id FAA01194 for ; Tue, 14 Dec 1999 05:37:44 -0600 (CST) Original-Received: from jpl.org (mars.web-hosting.com [209.40.104.5]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id GAA13724 for ; Tue, 14 Dec 1999 06:37:23 -0500 (EST) Original-Received: (from yamaoka@localhost) by jpl.org (8.9.3/8.9.3) id GAA20035; Tue, 14 Dec 1999 06:37:22 -0500 (EST) Original-To: ding@gnus.org X-Wanted: Free NNTP servers for news posting. User-Agent: T-gnus/6.14.0 (based on Gnus v5.8.3) (revision 11) WEMIKO/1.13.9 (Euglena tripteris) SLIM/1.13.5 (=?ISO-2022-JP?B?GyRCOzNAJSReJF8bKEI=?=) MULE XEmacs/21.2 (beta23) (Hebe) (sparc-sun-solaris2.6) X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:28205 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:28205 --Multipart_Tue_Dec_14_06:37:22_1999-1 Content-Type: text/plain; charset=US-ASCII >>>>> In <9t9ln6xrdkt.fsf@mraz.iskon.hr> >>>>> Hrvoje Niksic wrote: >> This is the patch for eliminating run-time cl. >> >> 1999-12-14 04:14:44 Katsumi Yamaoka >> >> * dgnushack.el (last, mapcon, member-if, union): New compiler >> macros for emulating cl functions. Hrvoje> Could you please code these things so that they are not called Hrvoje> under XEmacs, where cl.el is "official"? Okay, thanks for the advice. This is a replacement of the patch. --Multipart_Tue_Dec_14_06:37:22_1999-1 Content-Type: application/x-patch; type=patch Content-Disposition: attachment; filename="dgnushack.el.diff" Content-Transfer-Encoding: 7bit --- dgnushack.el~ Mon Dec 6 02:04:45 1999 +++ dgnushack.el Tue Dec 14 11:34:55 1999 @@ -30,6 +30,83 @@ (require 'cl) +(define-compiler-macro last (&whole form x &optional n) + (if (or (featurep 'xemacs) + (and (fboundp 'last) + (subrp (symbol-function 'last)))) + form + (if n + `(let* ((x ,x) + (n ,n) + (m 0) + (p x)) + (while (consp p) + (incf m) + (pop p)) + (if (<= n 0) + p + (if (< n m) + (nthcdr (- m n) x) + x))) + `(let ((x ,x)) + (while (consp (cdr x)) + (pop x)) + x)))) + +(define-compiler-macro mapcon (&whole form fn seq &rest rest) + (if (or (featurep 'xemacs) + (and (fboundp 'mapcon) + (subrp (symbol-function 'mapcon)))) + form + (if rest + `(let (res + (args (list ,seq ,@rest)) + p) + (while (not (memq nil args)) + (push (apply ,fn args) res) + (setq p args) + (while p + (setcar p (cdr (pop p))) + )) + (apply (function nconc) (nreverse res))) + `(let (res + (arg ,seq)) + (while arg + (push (funcall ,fn arg) res) + (setq arg (cdr arg))) + (apply (function nconc) (nreverse res)))))) + +(define-compiler-macro member-if (&whole form pred list) + (if (or (featurep 'xemacs) + (and (fboundp 'member-if) + (subrp (symbol-function 'member-if)))) + form + `(let ((fn ,pred) + (seq ,list)) + (while (and seq + (not (funcall fn (car seq)))) + (pop seq)) + seq))) + +(define-compiler-macro union (&whole form list1 list2) + (if (or (featurep 'xemacs) + (and (fboundp 'union) + (subrp (symbol-function 'union)))) + form + `(let ((a ,list1) + (b ,list2)) + (cond ((null a) b) + ((null b) a) + ((equal a b) a) + (t + (or (>= (length a) (length b)) + (setq a (prog1 b (setq b a)))) + (while b + (or (memq (car b) a) + (push (car b) a)) + (pop b)) + a))))) + ;; If we are building w3 in a different directory than the source ;; directory, we must read *.el from source directory and write *.elc ;; into the building directory. For that, we define this function --Multipart_Tue_Dec_14_06:37:22_1999-1--