[elpa] master a71be12 1/4: [vcard] Don't try to provide our own compat version of iso8601

2020-03-14 Thread Eric Abrahamsen
branch: master
commit a71be12e999f0f394a9b9ece30b640104fdec4fb
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[vcard] Don't try to provide our own compat version of iso8601

* packages/vcard/vcard-iso8601.el: Too complicated.
* packages/vcard/vcard-parse.el: Require Emacs 27, and load built-in
iso8601 library.
---
 packages/vcard/vcard-iso8601.el | 383 
 packages/vcard/vcard-parse.el   |   9 +-
 2 files changed, 3 insertions(+), 389 deletions(-)

diff --git a/packages/vcard/vcard-iso8601.el b/packages/vcard/vcard-iso8601.el
deleted file mode 100644
index 812ee45..000
--- a/packages/vcard/vcard-iso8601.el
+++ /dev/null
@@ -1,383 +0,0 @@
-;;; vcard-iso8601.el --- compatibility library for older Emacs  -*- 
lexical-binding:t -*-
-
-;; Copyright (C) 2019-2020 Free Software Foundation, Inc.
-
-;; Keywords: dates
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see .
-
-;;; Commentary:
-
-;; This is a copy of the iso8601.el library that exists in Emacs 27
-;; and later.  It is loaded conditionally in earlier Emacs that lack
-;; that library.
-
-;; ISO8601 times basically look like 1985-04-01T15:23:49...  Or so
-;; you'd think.  This is what everybody means when they say "ISO8601",
-;; but it's in reality a quite large collection of syntaxes, including
-;; week numbers, ordinal dates, durations and intervals.  This package
-;; has functions for parsing them all.
-;;
-;; The interface functions are `iso8601-parse', `iso8601-parse-date',
-;; `iso8601-parse-time', `iso8601-parse-zone',
-;; `iso8601-parse-duration' and `iso8601-parse-interval'.  They all
-;; return decoded time objects, except the last one, which returns a
-;; list of three of them.
-;;
-;; (iso8601-parse-interval "P1Y2M10DT2H30M/2008W32T153000-01")
-;; '((0 0 13 24 5 2007 nil nil -3600)
-;;   (0 30 15 3 8 2008 nil nil -3600)
-;;   (0 30 2 10 2 1 nil nil nil))
-;;
-;;
-;; The standard can be found at:
-;;
-;; 
http://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf
-;;
-;; The Wikipedia page on the standard is also informative:
-;;
-;; https://en.wikipedia.org/wiki/ISO_8601
-;;
-;; RFC3339 defines the subset that everybody thinks of as "ISO8601".
-
-;;; Code:
-
-(require 'time-date)
-(require 'cl-lib)
-
-(defun iso8601--concat-regexps (regexps)
-  (mapconcat (lambda (regexp)
-   (concat "\\(?:"
-   (replace-regexp-in-string "(" "(?:" regexp)
-   "\\)"))
- regexps "\\|"))
-
-(defconst iso8601--year-match
-  "\\([+-]?[0-9][0-9][0-9][0-9]\\)")
-(defconst iso8601--full-date-match
-  "\\([+-]?[0-9][0-9][0-9][0-9]\\)-?\\([0-9][0-9]\\)-?\\([0-9][0-9]\\)")
-(defconst iso8601--without-day-match
-  "\\([+-]?[0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)")
-(defconst iso8601--outdated-date-match
-  "--\\([0-9][0-9]\\)-?\\([0-9][0-9]\\)")
-(defconst iso8601--outdated-reduced-precision-date-match
-  "---?\\([0-9][0-9]\\)")
-(defconst iso8601--week-date-match
-  "\\([+-]?[0-9][0-9][0-9][0-9]\\)-?W\\([0-9][0-9]\\)-?\\([0-9]\\)?")
-(defconst iso8601--ordinal-date-match
-  "\\([+-]?[0-9][0-9][0-9][0-9]\\)-?\\([0-9][0-9][0-9]\\)")
-(defconst iso8601--date-match
-  (iso8601--concat-regexps
-   (list iso8601--year-match
- iso8601--full-date-match
- iso8601--without-day-match
- iso8601--outdated-date-match
- iso8601--outdated-reduced-precision-date-match
- iso8601--week-date-match
- iso8601--ordinal-date-match)))
-
-(defconst iso8601--time-match
-  "\\([0-9][0-9]\\):?\\([0-9][0-9]\\)?:?\\([0-9][0-9]\\)?[.,]?\\([0-9]*\\)")
-
-(defconst iso8601--zone-match
-  "\\(Z\\|\\([+-]\\)\\([0-9][0-9]\\):?\\([0-9][0-9]\\)?\\)")
-
-(defconst iso8601--full-time-match
-  (concat "\\(" (replace-regexp-in-string "(" "(?:" iso8601--time-match) "\\)"
-  "\\(" iso8601--zone-match "\\)?"))
-
-(defconst iso8601--combined-match
-  (concat "\\(" iso8601--date-match "\\)"
-  "\\(?:T\\("
-  (replace-regexp-in-string "(" "(?:" iso8601--time-match)
-  "\\)"
-  "\\(" iso8601--zone-match "\\)?\\)?"))
-
-(defconst iso8601--duration-full-match
-  
"P\\([0-9]+Y\\)?\\([0-9]+M\\)?\\([0-9]+D\\)?\\(T\\([0-9]+H\\)?\\([0-9]+M\\)?\\([0-9]+S\\)?\\)?")
-(defconst iso8601--duration-week-match
-  "P\\([0-9]+\\)W")
-(defconst iso8601--duration-combined-matc

[elpa] master updated (975791a -> d7700fb)

2020-03-14 Thread Eric Abrahamsen
girzel pushed a change to branch master.

  from  975791a   * externals-list: New (unreleased) package sql-smie
   new  a71be12   [vcard] Don't try to provide our own compat version of 
iso8601
   new  334cd89   [vcard] Use vars, not options, for altering parsing 
process
   new  60dafa7   [vcard] Don't swallow vCard parsing errors
   new  d7700fb   [vcard] Move vcard-mode into main vcard file, release 
version 0.1


Summary of changes:
 packages/vcard/vcard-iso8601.el | 383 
 packages/vcard/vcard-mode.el|  61 ---
 packages/vcard/vcard-parse.el   |  53 +++---
 packages/vcard/vcard.el |  51 --
 4 files changed, 60 insertions(+), 488 deletions(-)
 delete mode 100644 packages/vcard/vcard-iso8601.el
 delete mode 100644 packages/vcard/vcard-mode.el



[elpa] master d7700fb 4/4: [vcard] Move vcard-mode into main vcard file, release version 0.1

2020-03-14 Thread Eric Abrahamsen
branch: master
commit d7700fb6a657426297a5c6223ebff42db93dde43
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[vcard] Move vcard-mode into main vcard file, release version 0.1

* packages/vcard/vcard.el: Put the major mode here instead.
---
 packages/vcard/vcard-mode.el | 61 
 packages/vcard/vcard.el  | 51 ++--
 2 files changed, 37 insertions(+), 75 deletions(-)

diff --git a/packages/vcard/vcard-mode.el b/packages/vcard/vcard-mode.el
deleted file mode 100644
index ad6e124..000
--- a/packages/vcard/vcard-mode.el
+++ /dev/null
@@ -1,61 +0,0 @@
-;;; vcard-mode.el --- Major mode for viewing vCard files  -*- lexical-binding: 
t; -*-
-
-;; Copyright (C) 2019  Free Software Foundation, Inc.
-
-;; Author: Eric Abrahamsen 
-;; Maintainer: Eric Abrahamsen 
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see .
-
-;;; Commentary:
-
-;; This file contains `vcard-mode', for viewing vcard files.
-
-;;; Code:
-
-(require 'vcard)
-
-(defface vcard-property-face
-  '((t :inherit font-lock-function-name-face))
-  "Face for highlighting property names."
-  :group 'vcard)
-
-(defface vcard-parameter-key-face
-  '((t :inherit font-lock-comment-face))
-  "Face for highlighting parameter keys."
-  :group 'vcard)
-
-(defface vcard-parameter-value-face
-  '((t :inherit font-lock-type-face))
-  "Face for highlighting parameter values."
-  :group 'vcard)
-
-(defvar vcard-font-lock-keywords
-  '("BEGIN:VCARD" "END:VCARD"
-("^[^ \t;:]+" . 'vcard-property-face)
-(";\\([^=\n]+\\)=" (1 'vcard-parameter-key-face))
-("=\\([^;:\n]+\\)[;:]" (1 'vcard-parameter-value-face
-
-;;;###autoload
-(define-derived-mode vcard-mode text-mode "vCard"
-  "Major mode for viewing vCard files."
-  (turn-off-auto-fill)
-  (set (make-local-variable 'paragraph-start) "BEGIN:VCARD")
-  (setq font-lock-defaults '(vcard-font-lock-keywords)))
-
-;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.[Vv][Cc][Ff]\\'" . vcard-mode))
-
-(provide 'vcard-mode)
-;;; vcard-mode.el ends here
diff --git a/packages/vcard/vcard.el b/packages/vcard/vcard.el
index 2574cd9..69032b6 100644
--- a/packages/vcard/vcard.el
+++ b/packages/vcard/vcard.el
@@ -1,13 +1,12 @@
-;;; vcard.el --- Utilities for working with vCard files  -*- lexical-binding: 
t; -*-
+;;; vcard.el --- Package for handling vCard files  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2020  Free Software Foundation, Inc.
 
-;; Version: 0
-;; Package-Requires: ((emacs "25.1"))
-
 ;; Author: Eric Abrahamsen 
 ;; Maintainer: Eric Abrahamsen 
-;; Keywords: mail, comm
+
+;; Version: 0.1
+;; Package-Requires: ((emacs "27.1"))
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -24,18 +23,42 @@
 
 ;;; Commentary:
 
-;; This package provides libraries for working with vCard data: files
-;; representing contact information.  At present there are two parts
-;; to it: a major mode for looking at *.vcf files, and a library for
-;; parsing those files into elisp data structures.  The third part,
-;; eventually, will be a library for writing elisp data structures to
-;; *.vcf files.
+;; This file contains `vcard-mode', for viewing vCard files.  Other
+;; files in this package contain functions for parsing and writing
+;; vCard data.
 
 ;;; Code:
 
-(defgroup vcard nil
-  "Customization options for the vcard library."
-  :group 'mail)
+(defface vcard-property-face
+  '((t :inherit font-lock-function-name-face))
+  "Face for highlighting property names."
+  :group 'vcard)
+
+(defface vcard-parameter-key-face
+  '((t :inherit font-lock-comment-face))
+  "Face for highlighting parameter keys."
+  :group 'vcard)
+
+(defface vcard-parameter-value-face
+  '((t :inherit font-lock-type-face))
+  "Face for highlighting parameter values."
+  :group 'vcard)
+
+(defvar vcard-font-lock-keywords
+  '("BEGIN:VCARD" "END:VCARD"
+("^[^ \t;:]+" . 'vcard-property-face)
+(";\\([^=\n]+\\)=" (1 'vcard-parameter-key-face))
+("=\\([^;:\n]+\\)[;:]" (1 'vcard-parameter-value-face
+
+;;;###autoload
+(define-derived-mode vcard-mode text-mode "vCard"
+  "Major mode for viewing vCard files."
+  (turn-off-auto-fill)
+  (set (make-local-variable 'paragraph-start) "BEGIN:VCARD")
+  (setq font-lock-defaults '(vcard-font-lock-keywords)))
+
+;;;###a

[elpa] master 334cd89 2/4: [vcard] Use vars, not options, for altering parsing process

2020-03-14 Thread Eric Abrahamsen
branch: master
commit 334cd89138235acae1901a0d7c9581f997a500df
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[vcard] Use vars, not options, for altering parsing process

* packages/vcard/vcard-parse.el (vcard-parse-select-fields,
vcard-parse-omit-fields, vcard-parse-datetime-values,
vcard-parse-card-consumer-function,
vcard-parse-property-consumer-function): None of these make sense as
defcustoms, use defvar instead. This lets us get rid of the
parsing customization group altogether.
---
 packages/vcard/vcard-parse.el | 30 ++
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/packages/vcard/vcard-parse.el b/packages/vcard/vcard-parse.el
index 3c239de..dfddda4 100644
--- a/packages/vcard/vcard-parse.el
+++ b/packages/vcard/vcard-parse.el
@@ -92,53 +92,43 @@
 
 ;;; Code:
 
-(require 'vcard)
 (require 'cl-lib)
 (require 'iso8601)
 
-(defgroup vcard-parse nil
-  "Customization options for vcard parsing."
-  :group 'vcard)
-
-(defcustom vcard-parse-select-fields nil
+(defvar vcard-parse-select-fields nil
   "A list of field types to select.
 If this variable is non-nil, only the fields listed will be
 parsed, all others will be discarded.  Note that the 'version and
 'fn properties are always returned.
 
-Most useful when let-bound around one of the parsing functions."
-  :type '(repeat symbol))
+Most useful when let-bound around one of the parsing functions.")
 
-(defcustom vcard-parse-omit-fields nil
+(defvar vcard-parse-omit-fields nil
   "A list of field types to omit.
 If this variable is non-nil, the fields listed will be discarded.
 
-Most useful when let-bound around one of the parsing functions."
-  :type '(repeat symbol))
+Most useful when let-bound around one of the parsing functions.")
 
-(defcustom vcard-parse-datetime-values t
+(defvar vcard-parse-datetime-values t
   "When non-nil, attempt to parse date/time property values.
 If successful, the property value will be (usually) converted to
 a list of integers, though if the \"type\" parameter of the
 property is \"text\", the value will be returned as a string.  It
 is also possible that parsing may fail, in which case the
-original string value will also be returned."
-  :type 'boolean)
+original string value will also be returned.")
 
-(defcustom vcard-parse-card-consumer-function nil
+(defvar vcard-parse-card-consumer-function nil
   "Custom function for consuming a single contact card.
 It is called with a list of properties, as produced by the
 built-in code, or by the return value of
-`vcard-parse-property-consumer-function'."
-  :type 'function)
+`vcard-parse-property-consumer-function'.")
 
-(defcustom vcard-parse-property-consumer-function nil
+(defvar vcard-parse-property-consumer-function nil
   "Custom function for consuming a single property.
 The function is called with four arguments: the property type as
 a symbol, the property value (all un-escaping, decoding,
 splitting, etc already complete), the property parameters as an
-alist with symbol keys, and the vcard version as a float."
-  :type 'function)
+alist with symbol keys, and the vcard version as a float.")
 
 (defvar vcard-parse-overriding-version nil
   "vCard version, as a float, used when no VERSION property is present.



[elpa] master 60dafa7 3/4: [vcard] Don't swallow vCard parsing errors

2020-03-14 Thread Eric Abrahamsen
branch: master
commit 60dafa7ccd3c8cd14d636a1a6f9224f7450a0913
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[vcard] Don't swallow vCard parsing errors

* packages/vcard/vcard-parse.el (vcard-parse-buffer): Use lwarn and
try to provide some useful information.
---
 packages/vcard/vcard-parse.el | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/packages/vcard/vcard-parse.el b/packages/vcard/vcard-parse.el
index dfddda4..56afd30 100644
--- a/packages/vcard/vcard-parse.el
+++ b/packages/vcard/vcard-parse.el
@@ -212,10 +212,16 @@ Returns a list of contact objects."
 ;; with a `skip-syntax-forward' check.
 
 (while (re-search-forward "^BEGIN:VCARD\n" (line-end-position 2) t)
-  (when (setq card (ignore-errors
-;; `vcard-parse-card' moves point past the
-;; card.
-(vcard-parse-card prop-consumer card-consumer)))
+  (when (setq card (condition-case nil
+  ;; `vcard-parse-card' moves point past the
+  ;; card.
+  (vcard-parse-card prop-consumer card-consumer)
+(error (lwarn
+  '(vcard) :error
+  "Parsing failed with:\n %s"
+  (buffer-substring-no-properties
+   (point-at-bol)
+   (point-at-eol))
(push card out)))
 
 (nreverse out)))



[elpa] externals/elisp-benchmarks 6457015 1/3: * benchmarks/nbody.el: New benchmark

2020-03-14 Thread Andrea Corallo
branch: externals/elisp-benchmarks
commit 64570159fd1bcdc7ebcfbae3cbe6610c5f255ffe
Author: Luca Nassi 
Commit: Andrea Corallo 

* benchmarks/nbody.el: New benchmark
---
 benchmarks/nbody.el | 142 
 1 file changed, 142 insertions(+)

diff --git a/benchmarks/nbody.el b/benchmarks/nbody.el
new file mode 100644
index 000..e53e50d
--- /dev/null
+++ b/benchmarks/nbody.el
@@ -0,0 +1,142 @@
+;; -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
+
+;;; Commentary:
+
+;; Adapted to elisp from CL version from:
+;; 
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-sbcl-2.html
+
+(require 'cl-lib)
+
+(defconst elb-days-per-year 365.24)
+(defconst elb-solar-mass (* 4 pi pi))
+
+(cl-defstruct (elb-body (:type vector)
+   (:conc-name nil)
+   (:constructor make-elb-body (x y z vx vy vz mass)))
+  x y z
+  vx vy vz
+  mass)
+
+(defvar elb-jupiter
+  (make-elb-body 4.84143144246472090
+-1.16032004402742839
+-1.03622044471123109e-1
+(* 1.66007664274403694e-3 elb-days-per-year)
+(* 7.69901118419740425e-3 elb-days-per-year)
+(* -6.90460016972063023e-5  elb-days-per-year)
+(* 9.54791938424326609e-4 elb-solar-mass)))
+
+(defvar elb-saturn
+  (make-elb-body 8.34336671824457987
+4.12479856412430479
+-4.03523417114321381e-1
+(* -2.76742510726862411e-3 elb-days-per-year)
+(* 4.99852801234917238e-3 elb-days-per-year)
+(* 2.30417297573763929e-5 elb-days-per-year)
+(* 2.85885980666130812e-4 elb-solar-mass)))
+
+(defvar elb-uranus
+  (make-elb-body 1.28943695621391310e1
+-1.5514016986312e1
+-2.23307578892655734e-1
+(* 2.96460137564761618e-03 elb-days-per-year)
+(* 2.37847173959480950e-03 elb-days-per-year)
+(* -2.96589568540237556e-05 elb-days-per-year)
+(* 4.36624404335156298e-05 elb-solar-mass)))
+
+(defvar elb-neptune
+  (make-elb-body 1.53796971148509165e+01
+-2.59193146099879641e+01
+1.79258772950371181e-01
+(* 2.68067772490389322e-03 elb-days-per-year)
+(* 1.62824170038242295e-03 elb-days-per-year)
+(* -9.51592254519715870e-05 elb-days-per-year)
+(* 5.15138902046611451e-05 elb-solar-mass)))
+
+(defvar elb-sun
+  (make-elb-body 0.0 0.0 0.0 0.0 0.0 0.0 elb-solar-mass))
+
+(defun elb-applyforces (a b dt)
+  (let* ((dx (- (x a) (x b)))
+(dy (- (y a) (y b)))
+(dz (- (z a) (z b)))
+(distance (sqrt (+ (* dx dx) (* dy dy) (* dz dz
+(mag (/ dt (* distance distance distance)))
+(dxmag (* dx mag))
+(dymag (* dy mag))
+(dzmag (* dz mag)))
+(cl-decf (vx a) (* dxmag (mass b)))
+(cl-decf (vy a) (* dymag (mass b)))
+(cl-decf (vz a) (* dzmag (mass b)))
+(cl-incf (vx b) (* dxmag (mass a)))
+(cl-incf (vy b) (* dymag (mass a)))
+(cl-incf (vz b) (* dzmag (mass a
+  nil)
+
+(defun elb-advance (system dt)
+  (cl-loop for (a . rest) on system
+  do (dolist (b rest)
+   (elb-applyforces a b dt)))
+  (dolist (b system)
+(cl-incf (x b) (* dt (vx b)))
+(cl-incf (y b) (* dt (vy b)))
+(cl-incf (z b) (* dt (vz b
+  nil)
+
+(defun elb-energy (system)
+  (let ((e 0.0))
+(cl-loop for (a . rest) on system do
+(cl-incf e (* 0.5
+  (mass a)
+  (+ (* (vx a) (vx a))
+ (* (vy a) (vy a))
+ (* (vz a) (vz a)
+(dolist (b rest)
+  (let* ((dx (- (x a) (x b)))
+ (dy (- (y a) (y b)))
+ (dz (- (z a) (z b)))
+ (dist (sqrt (+ (* dx dx) (* dy dy) (* dz dz)
+(cl-decf e (/ (* (mass a) (mass b)) dist)
+e))
+
+(defun elb-offset-momentum (system)
+  (let ((px 0.0)
+   (py 0.0)
+   (pz 0.0))
+(dolist (p system)
+  (cl-incf px (* (vx p) (mass p)))
+  (cl-incf py (* (vy p) (mass p)))
+  (cl-incf pz (* (vz

[elpa] externals/elisp-benchmarks 8a6e442 3/3: * elisp-benchmarks.el: Increase minor package version

2020-03-14 Thread Andrea Corallo
branch: externals/elisp-benchmarks
commit 8a6e4420432357c4d67b29b0eed977237597cffd
Author: Andrea Corallo 
Commit: Andrea Corallo 

* elisp-benchmarks.el: Increase minor package version
---
 elisp-benchmarks.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elisp-benchmarks.el b/elisp-benchmarks.el
index 85a7fa4..2515bc4 100644
--- a/elisp-benchmarks.el
+++ b/elisp-benchmarks.el
@@ -4,7 +4,7 @@
 
 ;; Author: Andrea Corallo 
 ;; Maintainer: Andrea Corallo 
-;; Version: 1.2
+;; Version: 1.3
 ;; Keywords: languages, lisp
 ;; Package-Type: multi
 ;; Created: 2019-01-12



[elpa] externals/elisp-benchmarks updated (cd9b784 -> 8a6e442)

2020-03-14 Thread Andrea Corallo
akrl pushed a change to branch externals/elisp-benchmarks.

  from  cd9b784   Increment version number
   new  6457015   * benchmarks/nbody.el: New benchmark
   new  59e242b   * benchmarks/dhrystone.el: New benchmark
   new  8a6e442   * elisp-benchmarks.el: Increase minor package version


Summary of changes:
 benchmarks/dhrystone.el | 305 
 benchmarks/nbody.el | 142 ++
 elisp-benchmarks.el |   2 +-
 3 files changed, 448 insertions(+), 1 deletion(-)
 create mode 100644 benchmarks/dhrystone.el
 create mode 100644 benchmarks/nbody.el



[elpa] externals/elisp-benchmarks 59e242b 2/3: * benchmarks/dhrystone.el: New benchmark

2020-03-14 Thread Andrea Corallo
branch: externals/elisp-benchmarks
commit 59e242b8f51acdbdfc712bef11b4430eefa2223d
Author: Luca Nassi 
Commit: Andrea Corallo 

* benchmarks/dhrystone.el: New benchmark
---
 benchmarks/dhrystone.el | 305 
 1 file changed, 305 insertions(+)

diff --git a/benchmarks/dhrystone.el b/benchmarks/dhrystone.el
new file mode 100644
index 000..a3bce4b
--- /dev/null
+++ b/benchmarks/dhrystone.el
@@ -0,0 +1,305 @@
+;; -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
+
+;;; Commentary:
+
+;; Porting to elisp of the famous Dhrystone benchmark
+;;
+;; Adapted from C version:
+;; https://github.com/Keith-S-Thompson/dhrystone/blob/master/v2.2/dry.c
+
+(require 'cl-lib)
+
+(cl-defstruct dhry-record
+  discr
+  variant)
+
+(cl-defstruct dhry-var-1
+  enum-comp
+  int-comp
+  str-comp)
+
+(cl-defstruct dhry-var-2
+  e-comp-2
+  str-2-comp)
+
+(cl-defstruct dhry-var-3
+  ch-1-comp
+  ch-2-comp)
+
+(defvar dhry-ptr-glob)
+(defvar dhry-next-ptr-glob)
+(defvar dhry-int-glob)
+(defvar dhry-bool-glob)
+(defvar dhry-ch-1-glob)
+(defvar dhry-ch-2-glob)
+(defvar dhry-arr-1-glob)
+(defvar dhry-arr-2-glob)
+
+(defun dhry-structassign (dst src)
+  (setf (cdr dst) (cdr src))
+  (let ((src-record (car src))
+   (dst-record (car dst)))
+(setf (dhry-record-discr dst-record)
+ (dhry-record-discr src-record))
+(let ((type (dhry-record-discr src-record))
+ (src-variant (dhry-record-variant src-record))
+ (dst-variant (dhry-record-variant dst-record)))
+  (cl-case type
+   (0
+(setf (dhry-var-1-int-comp dst-variant)
+  (dhry-var-1-int-comp src-variant))
+(setf (dhry-var-1-enum-comp dst-variant)
+  (dhry-var-1-enum-comp src-variant))
+(store-substring (dhry-var-1-str-comp dst-variant)
+ 0
+ (dhry-var-1-str-comp src-variant)))
+   (1
+(setf (dhry-var-2-e-comp-2 dst-variant)
+  (dhry-var-2-e-comp-2 src-variant))
+(store-substring (dhry-var-2-str-2-comp dst-variant)
+ 0
+ (dhry-var-2-str-2-comp src-variant)))
+   (2
+(setf (dhry-var-3-ch-1-comp dst-variant)
+  (dhry-var-3-ch-1-comp src-variant))
+(setf (dhry-var-3-ch-2-comp dst-variant)
+  (dhry-var-3-ch-2-comp src-variant)))
+
+(defun dhry-proc-1 (ptr-val-par)
+  (let ((next-record (cdr ptr-val-par)))
+(dhry-structassign (cdr ptr-val-par) dhry-ptr-glob)
+(setf (dhry-var-1-int-comp (dhry-record-variant (car ptr-val-par))) 5)
+(setf (dhry-var-1-int-comp (dhry-record-variant (car next-record)))
+ (dhry-var-1-int-comp (dhry-record-variant (car ptr-val-par
+(setf (cdr next-record) (dhry-proc-3 (cdr next-record)))
+(if (= (dhry-record-discr (car next-record)) 0)
+   (progn
+ (setf (dhry-var-1-int-comp (dhry-record-variant (car next-record))) 6)
+ (setf (dhry-var-1-enum-comp (dhry-record-variant (car next-record)))
+   (dhry-proc-6 (dhry-var-1-enum-comp (dhry-record-variant (car 
ptr-val-par)
+ (setf (cdr next-record) (cdr dhry-ptr-glob))
+ (setf (dhry-var-1-int-comp (dhry-record-variant (car next-record)))
+   (dhry-proc-7 (dhry-var-1-int-comp (dhry-record-variant (car 
next-record))) 10)))
+  (dhry-structassign ptr-val-par (cdr ptr-val-par)
+
+(defun dhry-proc-2 (int-par-ref)
+  (let (int-loc enum-loc)
+(setq int-loc (+ int-par-ref 10))
+(cl-loop when (= dhry-ch-1-glob ?A)
+do (cl-decf int-loc)
+   (setq int-par-ref (- int-loc dhry-int-glob))
+   (setq enum-loc 0)
+while (/= enum-loc 0))
+int-par-ref))
+
+(defun dhry-proc-3 (ptr-ref-par)
+  (let ((ret ptr-ref-par))
+(when dhry-ptr-glob
+  (setq ret (cdr dhry-ptr-glob)))
+(setf (dhry-var-1-int-comp (dhry-record-variant (car dhry-ptr-glob))) 
(dhry-proc-7 10 dhry-int-glob))
+ret))
+
+(defun dhry-proc-4 ()
+  (let (bool-loc)
+(setq bool-loc (= dhry-ch-1-glob ?A))
+(setq dhry-bool-glob (or bool-loc dhry-bool-glob))
+(setq dhry-ch-2-glob ?B)))
+
+(defun dhry-proc-5 ()
+  (setq dhry-ch-1-glob ?A)
+  (setq dhry-bool-glob nil))
+
+(defun dhry-proc-