From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 25 04:20:54 2014 Received: (at submit) by debbugs.gnu.org; 25 Sep 2014 08:20:54 +0000 Received: from localhost ([127.0.0.1]:51590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XX4IH-00067o-45 for submit@debbugs.gnu.org; Thu, 25 Sep 2014 04:20:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36749) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XX4ID-00067f-Jb for submit@debbugs.gnu.org; Thu, 25 Sep 2014 04:20:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XX4Hz-0006uY-W4 for submit@debbugs.gnu.org; Thu, 25 Sep 2014 04:20:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX4Hz-0006tX-Nt for submit@debbugs.gnu.org; Thu, 25 Sep 2014 04:20:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX4Hl-0003mm-Bt for bug-gnu-emacs@gnu.org; Thu, 25 Sep 2014 04:20:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XX4Hb-0006py-Hz for bug-gnu-emacs@gnu.org; Thu, 25 Sep 2014 04:20:21 -0400 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]:62773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX4Hb-0006kb-6t for bug-gnu-emacs@gnu.org; Thu, 25 Sep 2014 04:20:11 -0400 Received: by mail-pd0-f170.google.com with SMTP id y13so10230653pdi.1 for ; Thu, 25 Sep 2014 01:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=dW8ja6Ec4e9w5xx1UuQ9zMyWZsjIyXOWDmmjlDtMrLM=; b=Rgzaf8jQb+jcBzCbCkYY+x/W/Z6SyMy0Pc2KB6+2VYhbOpSGuJOd3pvdgUBXxymocP lML54WJTFhZWBvnxX+rL+XWV4tPgQ04rSY0wAzzBf5s9oDa8OsfbJ694h62NIgZKoiDr Qy8//EaMP/bV87DXwL8bwaWX2PDm5Ynve0EBOqhDE22cUsEY0qyfo7Z6TgiU3OhXBftO 29hTGMet2K3qXFO1TvWmXAvUxQ1Ka4ooCurhzfhX8jEsSsM8saplfFF7yDoy8sAlr4Y9 ne4qfUJBxWEvDODKhTwVhp1GOQ37Yd+WMds8uKI4Okq1TqNA+NQzOE7LpuNO4t8lEplR MIvQ== X-Received: by 10.70.52.74 with SMTP id r10mr23383810pdo.12.1411633205322; Thu, 25 Sep 2014 01:20:05 -0700 (PDT) Received: from fortuna ([221.222.149.169]) by mx.google.com with ESMTPSA id y11sm1401686pbv.54.2014.09.25.01.20.02 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Thu, 25 Sep 2014 01:20:04 -0700 (PDT) From: Leo Liu To: bug-gnu-emacs@gnu.org Subject: 24.4.50; move parse-integer and digit-char-p to cl-lib X-Debbugs-CC: Date: Thu, 25 Sep 2014 16:19:59 +0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain Any comments on the following patch: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=parse-integer.diff Content-Description: parse-integer.diff === modified file 'lisp/calendar/parse-time.el' --- lisp/calendar/parse-time.el 2014-08-03 15:38:52 +0000 +++ lisp/calendar/parse-time.el 2014-09-25 08:11:25 +0000 @@ -34,21 +34,12 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - -(defvar parse-time-digits (make-vector 256 nil)) +(require 'cl-lib) ;; Byte-compiler warnings (defvar parse-time-elt) (defvar parse-time-val) -(unless (aref parse-time-digits ?0) - (cl-loop for i from ?0 to ?9 - do (aset parse-time-digits i (- i ?0)))) - -(defsubst digit-char-p (char) - (aref parse-time-digits char)) - (defsubst parse-time-string-chars (char) (save-match-data (let (case-fold-search str) @@ -62,27 +53,6 @@ (put 'parse-error 'error-conditions '(parse-error error)) (put 'parse-error 'error-message "Parsing error") -(defsubst parse-integer (string &optional start end) - "[CL] Parse and return the integer in STRING, or nil if none." - (let ((integer 0) - (digit 0) - (index (or start 0)) - (end (or end (length string)))) - (when (< index end) - (let ((sign (aref string index))) - (if (or (eq sign ?+) (eq sign ?-)) - (setq sign (parse-time-string-chars sign) - index (1+ index)) - (setq sign 1)) - (while (and (< index end) - (setq digit (digit-char-p (aref string index)))) - (setq integer (+ (* integer 10) digit) - index (1+ index))) - (if (/= index end) - (signal 'parse-error `("not an integer" - ,(substring string (or start 0) end))) - (* sign integer)))))) - (defun parse-time-tokenize (string) "Tokenize STRING into substrings." (let ((start nil) @@ -100,7 +70,7 @@ (setq c (parse-time-string-chars (aref string index)))) (setq all-digits (and all-digits (eq c ?0)))) (if (<= index end) - (push (if all-digits (parse-integer string start index) + (push (if all-digits (cl-parse-integer string :start start :end index) (substring string start index)) list))) (nreverse list))) @@ -147,8 +117,8 @@ (= 5 (length parse-time-elt)) (or (= (aref parse-time-elt 0) ?+) (= (aref parse-time-elt 0) ?-)))) - ,#'(lambda () (* 60 (+ (parse-integer parse-time-elt 3 5) - (* 60 (parse-integer parse-time-elt 1 3))) + ,#'(lambda () (* 60 (+ (cl-parse-integer parse-time-elt :start 3 :end 5) + (* 60 (cl-parse-integer parse-time-elt :start 1 :end 3))) (if (= (aref parse-time-elt 0) ?-) -1 1)))) ((5 4 3) ,#'(lambda () (and (stringp parse-time-elt) @@ -210,9 +180,10 @@ (let ((new-val (if rule (let ((this (pop rule))) (if (vectorp this) - (parse-integer + (cl-parse-integer parse-time-elt - (aref this 0) (aref this 1)) + :start (aref this 0) + :end (aref this 1)) (funcall this))) parse-time-val))) (rplaca (nthcdr (pop slots) time) new-val)))))))) === modified file 'lisp/emacs-lisp/cl-extra.el' --- lisp/emacs-lisp/cl-extra.el 2014-03-20 18:16:47 +0000 +++ lisp/emacs-lisp/cl-extra.el 2014-09-25 08:14:57 +0000 @@ -383,6 +383,28 @@ "Return 1 if X is positive, -1 if negative, 0 if zero." (cond ((> x 0) 1) ((< x 0) -1) (t 0))) +;;;###autoload +(cl-defun cl-parse-integer (string &key start end radix junk-allowed) + "Parse integer from the substring of STRING from START to END." + (let* ((start (or start 0)) + (end (or end (length string))) + (radix (or radix 10))) + (or (< start end (1+ (length string))) + (error "Bad interval: [%d, %d)" start end)) + (let ((sign (cl-case (aref string start) + (?+ (cl-incf start) +1) + (?- (cl-incf start) -1) + (t +1))) + digit sum) + (while (and (< start end) + (setq digit (cl-digit-char-p (aref string start) radix))) + (setq sum (+ (* (or sum 0) radix) digit) + start (1+ start))) + (cond ((and junk-allowed (null sum)) sum) + (junk-allowed (* sign sum)) + ((/= start end) (error "Not an integer string: %s" string)) + (t (* sign sum)))))) + ;; Random numbers. === modified file 'lisp/emacs-lisp/cl-lib.el' --- lisp/emacs-lisp/cl-lib.el 2014-05-21 00:41:21 +0000 +++ lisp/emacs-lisp/cl-lib.el 2014-09-25 07:55:40 +0000 @@ -279,6 +279,25 @@ "Return t if INTEGER is even." (eq (logand integer 1) 0)) +(defconst cl-digit-char-table + (let* ((digits (make-vector 256 nil)) + (populate (lambda (start end base) + (mapc (lambda (i) + (aset digits i (+ base (- i start)))) + (number-sequence start end))))) + (funcall populate ?0 ?9 0) + (funcall populate ?A ?Z 10) + (funcall populate ?a ?z 10) + digits)) + +(defun cl-digit-char-p (char &optional radix) + "Test if CHAR is a digit in the specified RADIX (default 10). +If true return the decimal value of digit CHAR in RADIX." + (or (<= 2 (or radix 10) 36) + (signal 'args-out-of-range (list 'radix radix '(2 36)))) + (let ((n (aref cl-digit-char-table char))) + (and n (< n (or radix 10)) n))) + (defvar cl--random-state (vector 'cl--random-state-tag -1 30 (cl--random-time))) === modified file 'test/automated/cl-lib.el' --- test/automated/cl-lib.el 2014-04-22 21:32:51 +0000 +++ test/automated/cl-lib.el 2014-09-25 08:16:10 +0000 @@ -223,6 +223,23 @@ (should (= (cl-the integer (cl-incf side-effect)) 1)) (should (= side-effect 1)))) +(ert-deftest cl-digit-char-p () + (should (cl-digit-char-p ?3)) + (should (cl-digit-char-p ?a 11)) + (should-not (cl-digit-char-p ?a)) + (should (cl-digit-char-p ?w 36)) + (should-error (cl-digit-char-p ?a 37)) + (should-error (cl-digit-char-p ?a 1))) + +(ert-deftest cl-parse-integer () + (should-error (cl-parse-integer "abc")) + (should (null (cl-parse-integer "abc" :junk-allowed t))) + (should (= 342391 (cl-parse-integer "0123456789" :radix 8 :junk-allowed t))) + (should-error (cl-parse-integer "0123456789" :radix 8)) + (should (= -239 (cl-parse-integer "-efz" :radix 16 :junk-allowed t))) + (should-error (cl-parse-integer "efz" :radix 16)) + (should (= 239 (cl-parse-integer "zzef" :radix 16 :start 2)))) + (ert-deftest cl-loop-destructuring-with () (should (equal (cl-loop with (a b c) = '(1 2 3) return (+ a b c)) 6))) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 25 09:10:32 2014 Received: (at 18557) by debbugs.gnu.org; 25 Sep 2014 13:10:32 +0000 Received: from localhost ([127.0.0.1]:51751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XX8oZ-0006YP-3U for submit@debbugs.gnu.org; Thu, 25 Sep 2014 09:10:31 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:7485) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XX8oW-0006YG-7b for 18557@debbugs.gnu.org; Thu, 25 Sep 2014 09:10:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYGAIDvNVOnWBcZ/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIwULCw4mEhQYDSSIBAjSGReOegeEOASrA4NMIQ X-IPAS-Result: ArYGAIDvNVOnWBcZ/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIwULCw4mEhQYDSSIBAjSGReOegeEOASrA4NMIQ X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="90847711" Received: from 167-88-23-25.cpe.teksavvy.com (HELO pastel.home) ([167.88.23.25]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Sep 2014 09:10:27 -0400 Received: by pastel.home (Postfix, from userid 20848) id 9BB196011B; Thu, 25 Sep 2014 09:10:27 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#18557: 24.4.50; move parse-integer and digit-char-p to cl-lib Message-ID: References: Date: Thu, 25 Sep 2014 09:10:27 -0400 In-Reply-To: (Leo Liu's message of "Thu, 25 Sep 2014 16:19:59 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 18557 Cc: 18557@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Any comments on the following patch: I'm fine with the idea. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 25 20:24:19 2014 Received: (at 18557-done) by debbugs.gnu.org; 26 Sep 2014 00:24:19 +0000 Received: from localhost ([127.0.0.1]:52416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XXJKc-0008B9-PB for submit@debbugs.gnu.org; Thu, 25 Sep 2014 20:24:18 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:54833) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XXJKa-0008B1-Hm for 18557-done@debbugs.gnu.org; Thu, 25 Sep 2014 20:24:17 -0400 Received: by mail-pd0-f174.google.com with SMTP id g10so11129806pdj.19 for <18557-done@debbugs.gnu.org>; Thu, 25 Sep 2014 17:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=SvNQFWXkhnwahxkibaqmfKNh30YSDenAXuBl+A+44Jo=; b=T6H3oKuUzsrsu7nweyoPnXY3LWcsPH2cRsylOKxS/xf38lvhVSB6huIhLaroz8ZGHv qLKa8oMPNIotWz6Tgt7JR4/+Y68RuKdvJKPXPcfe9fJqmfj7NPxip2f4bwX6W2lSAhk2 DO9xsXZFYd1+IWhrjflgSUFwRfauMMfDJho/Cr8WBaENYXztwhcFVPkbBZeT8/8KG9Ur mzMVq7HbLql5/lZKaR6aZDTYVJIUk/deTBr671GCRs1QSFr1opZdKKIsVfQtLvioKo+Q JNhFrWIas9wvlvq5fRbf3Q59OCR9+XDnorxrh6uPGSSEe5Npr7LaNNHb1zzgMGoqTjEM aTXQ== X-Received: by 10.68.69.106 with SMTP id d10mr12715056pbu.111.1411691055368; Thu, 25 Sep 2014 17:24:15 -0700 (PDT) Received: from fortuna ([221.222.149.169]) by mx.google.com with ESMTPSA id gp11sm3187377pbd.89.2014.09.25.17.24.12 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Thu, 25 Sep 2014 17:24:14 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#18557: 24.4.50; move parse-integer and digit-char-p to cl-lib References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUzRVhbQj4eZqO6SjnT eWpxnMetm5b6/PmidmqrAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1F B9cBBwMLBfKABCMAAAFoSURBVCjPtZI9a8MwEIaFoc7aYDdelQMna0Em3tsSr0XUeE2Q6a22a+v+ fk8fSSBkbDUI6dHpfe9OEvRgiD+ApqKPJgJeB6iUUXWESjUe/ig38AJrhqqvaU2nTIXbNvOQ40fe qdry4kyGoVWsfCQalXpHnJGM01wjWdYbMlXNFdsZDO69m9aqNqxEJqTEgbM5OF7wlEfIoll1Ked4 LbM5X2EdILLokEdmI8z7g5cKED0cuTC930TYhy7ZDekkXVGw/L60TguJePPxcJF48lpsSUWEA/Ju jGFNgJOXc4Hz7TmAdBeu5Ve4AEjOi2/2jfd3cAJZ+IbNrvdjgBZY01b+HTuG3cLws6BJZqVOj/pp T0OqVwx3rFq+QmJwx3loK5JSLEhDIt62+mtC2C+SrAUxEbV6C6v2BRbd6pILBKFpepKZJHgGgrKF sptSUUoczpwg2pQ7ZH1tgs0ou/917mzz6Cs2//C978cv5l07L02orIEAAAAASUVORK5CYII= Date: Fri, 26 Sep 2014 08:24:09 +0800 In-Reply-To: (Stefan Monnier's message of "Thu, 25 Sep 2014 09:10:27 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (CentOS 6.5) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18557-done Cc: 18557-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Version: 24.5 On 2014-09-25 09:10 -0400, Stefan Monnier wrote: >> Any comments on the following patch: > > I'm fine with the idea. > > > Stefan Committed to trunk. Thanks. Leo From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 04 12:32:22 2014 Received: (at control) by debbugs.gnu.org; 4 Oct 2014 16:32:22 +0000 Received: from localhost ([127.0.0.1]:33179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XaSFp-0002hC-Jn for submit@debbugs.gnu.org; Sat, 04 Oct 2014 12:32:21 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:59991) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XaSFm-0002h3-Hj for control@debbugs.gnu.org; Sat, 04 Oct 2014 12:32:19 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1XaSFj-0005By-Pf; Sat, 04 Oct 2014 12:32:15 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21552.8463.712517.884718@gnu.org> Date: Sat, 4 Oct 2014 12:32:15 -0400 From: Glenn Morris To: GNU bug tracker automated control server Subject: update fixed Emacs bugs for version number change X-Debbugs-No-Ack: yes X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) fixed 18502 25.1 notfixed 18502 24.5 fixed 16204 25.1 notfixed 16204 24.5 fixed 18557 25.1 notfixed 18557 24.5 fixed 18562 25.1 notfixed 18562 24.5 fixed 18265 25.1 notfixed 18265 24.5 fixed 16567 25.1 notfixed 16567 24.5 From unknown Sun Aug 10 07:33:08 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 02 Nov 2014 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator