Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
g000001 committed Feb 10, 2020
1 parent 4f6cc3f commit a22e8e2
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.*~
*.*fasl
2 changes: 1 addition & 1 deletion README.org → README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* SRFI 88: Keyword objects
# SRFI 88 for CL: Keyword objects

- Copyright (C) Marc Feeley (2006). All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Expand Down
21 changes: 14 additions & 7 deletions package.lisp
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
;;;; package.lisp

(cl:in-package :cl-user)
(cl:in-package cl-user)

(defpackage :srfi-88

(defpackage "https://github.com/g000001/srfi-88"
(:use)
(:export :keyword?
:keyword->string
:string->keyword))
(:export keyword?
keyword->string
string->keyword))


(defpackage "https://github.com/g000001/srfi-88#internals"
(:use "https://github.com/g000001/srfi-88"
cl
fiveam))


(defpackage :srfi-88.internal
(:use :srfi-88 :cl :fiveam))
;;; *EOF*
41 changes: 32 additions & 9 deletions srfi-88.asd
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,41 @@

(cl:in-package :asdf)


(defsystem :srfi-88
:version "20200211"
:description "SRFI 88 for CL: Keyword objects"
:long-description "SRFI 88 for CL: Keyword objects
https://srfi.schemers.org/srfi-88"
:author "CHIBA Masaomi"
:maintainer "CHIBA Masaomi"
:serial t
:depends-on (:fiveam
:named-readtables)
:depends-on (:fiveam)
:components ((:file "package")
(:file "srfi-88")))


(defmethod perform :after ((o load-op) (c (eql (find-system :srfi-88))))
(let ((name "https://github.com/g000001/srfi-88")
(nickname :srfi-88))
(if (and (find-package nickname)
(not (eq (find-package nickname)
(find-package name))))
(warn "~A: A package with name ~A already exists." name nickname)
(rename-package name name `(,nickname)))))


(defmethod perform ((o test-op) (c (eql (find-system :srfi-88))))
(load-system :srfi-88)
(or (flet ((_ (pkg sym)
(intern (symbol-name sym) (find-package pkg))))
(let ((result (funcall (_ :fiveam :run) (_ :srfi-88.internal :srfi-88))))
(funcall (_ :fiveam :explain!) result)
(funcall (_ :fiveam :results-status) result)))
(error "test-op failed") ))
(let ((*package*
(find-package
"https://github.com/g000001/srfi-88#internals")))
(eval
(read-from-string
"
(or (let ((result (run 'srfi-88)))
(explain! result)
(results-status result))
(error \"test-op failed\") )"))))


;;; *EOF*
13 changes: 8 additions & 5 deletions srfi-88.lisp
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
;;;; srfi-88.lisp

(cl:in-package :srfi-88.internal)
;; (in-readtable :srfi-88)
(cl:in-package "https://github.com/g000001/srfi-88#internals")

(def-suite srfi-88)

(in-suite srfi-88)
(def-suite* srfi-88)


(declaim (inline keyword?))
(defun keyword? (obj)
(cl:keywordp obj))


(defun keyword->string (k)
(cl:string k))


(defun string->keyword (x)
(assert (stringp x))
(values (cl:intern x :keyword)))


(macrolet ((tst (&body clauses)
(do ((*gensym-counter* 0)
(c clauses (cdddr c))
Expand All @@ -43,4 +45,5 @@
(string->keyword "foo") ==> :|foo|
(string->keyword "") ==> (values :||)))

;;; eof

;;; *EOF*

0 comments on commit a22e8e2

Please sign in to comment.