Loris  Check-in [6efeb03b55]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Document our difference from semver.org.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:6efeb03b5596bd3a5445967d2c51095beae51cf8
User & Date: jesper 2016-04-15 23:27:42
Context
2016-04-16
11:27
Add procedure make-chain-pred, which makes procedures taking any number of arguments and compares them two-and-two, in the order given, with a supplied predicate. For example: (define string-or-number= (make-chain-pred (lambda (a b) (= (if (string? a) (string->number a) a) (if (string? b) (string->number b) b))))) (string-or-number= "50" 50 "000050.00") will now evaluate to #t. check-in: e839f3b951 user: jesper tags: trunk
2016-04-15
23:27
Document our difference from semver.org. check-in: 6efeb03b55 user: jesper tags: trunk
23:17
Cleanup. Checking for equality isn't necessary, as it is handled gracefully by (not (semantic-version< a b)) check-in: 00a5cf24c7 user: jesper tags: trunk
Changes

Changes to version.scm.

1












2
3


4
5
6
7




8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(use r7rs)













;; TODO


;;
;; Move precedence checking from platform:assert-version to here.
;; Also, implenet pre-release precedence checking as per point 11 at
;; semver.org.





(define-library (loris version)
  (import (scheme base)
          (scheme case-lambda)
          (loris convenience)
          (srfi 1)
          (srfi 13)
          (srfi 14))
  (export semantic full-semantic assert tokenise-semantic-version)
  (begin
    (define version (list 2 1 0		; major, minor, patch:	numeric
                          "devel"	; pre-release: 		#f or alphanumeric string (no hyphen!)
                          #f))		; metadata:    		#f or alphanumeric string (no hyphen!)

    (define (tokenise-semantic-version v)
      (if (not v) '()
          (let* ((v (string-tokenize v char-set:letter+digit)))
            (map (lambda (o)
                   (let ((v (string->number o)))
                     (if v v o)))
|
>
>
>
>
>
>
>
>
>
>
>
>

<
>
>
|
<
<
<
>
>
>
>










|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;;; Copyright (c) 2015 Jesper Raftegard <jesper@huggpunkt.org>
;;;
;;; Permission to use, copy, modify, and distribute this software for any
;;; purpose with or without fee is hereby granted, provided that the above
;;; copyright notice and this permission notice appear in all copies.
;;;
;;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


;;; This library implements a subset of Semantic Versioning 2.0.0 from
;;; http://semver.org/
;;;



;;; Contrary to the specification, the pre-release and metadata tags
;;; are not allowed to contain hyphens.

(use r7rs)

(define-library (loris version)
  (import (scheme base)
          (scheme case-lambda)
          (loris convenience)
          (srfi 1)
          (srfi 13)
          (srfi 14))
  (export semantic full-semantic assert tokenise-semantic-version)
  (begin
    (define version (list 2 1 0	        ; version:      numeric (major, minor, patch)
                          "devel"       ; pre-release:  #f or alphanumeric string (no hyphens!)
                          #f))          ; metadata:     #f or alphanumeric string (no hyphens!)

    (define (tokenise-semantic-version v)
      (if (not v) '()
          (let* ((v (string-tokenize v char-set:letter+digit)))
            (map (lambda (o)
                   (let ((v (string->number o)))
                     (if v v o)))