# HG changeset patch # User Steve Losh # Date 1511912935 18000 # Node ID de4030a2d5b958821288162146488107dbe6923c Initial commit diff -r 000000000000 -r de4030a2d5b9 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,6 @@ +syntax: glob +lisp.prof +scratch.lisp +*.log +docs/build +data diff -r 000000000000 -r de4030a2d5b9 .lispwords --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.lispwords Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,1 @@ + diff -r 000000000000 -r de4030a2d5b9 LICENSE.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LICENSE.markdown Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,19 @@ +Copyright (c) 2017 Steve Losh and contributors + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff -r 000000000000 -r de4030a2d5b9 Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,26 @@ +.PHONY: vendor docs pubdocs + +sourcefiles = $(shell ffind --full-path --literal .lisp) +docfiles = $(shell ls docs/*.markdown) +apidocs = $(shell ls docs/*reference*.markdown) + +# Vendor ---------------------------------------------------------------------- +vendor/quickutils.lisp: vendor/make-quickutils.lisp + cd vendor && sbcl --noinform --load make-quickutils.lisp --eval '(quit)' + +vendor: vendor/quickutils.lisp + +# Documentation --------------------------------------------------------------- +$(apidocs): $(sourcefiles) + sbcl --noinform --load docs/api.lisp --eval '(quit)' + +docs/build/index.html: $(docfiles) $(apidocs) docs/title + cd docs && ~/.virtualenvs/d/bin/d + +docs: docs/build/index.html + +pubdocs: docs + hg -R ~/src/sjl.bitbucket.org pull -u + rsync --delete -a ./docs/build/ ~/src/sjl.bitbucket.org/trivial-ppm + hg -R ~/src/sjl.bitbucket.org commit -Am 'trivial-ppm: Update site.' + hg -R ~/src/sjl.bitbucket.org push diff -r 000000000000 -r de4030a2d5b9 README.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.markdown Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,7 @@ +trivial-ppm is a Common Lisp library for reading and writing the [PPM, PGM, and +PBM image formats](https://en.wikipedia.org/wiki/Netpbm_format). + +* **License:** MIT/X11 +* **Documentation:** +* **Mercurial:** +* **Git:** diff -r 000000000000 -r de4030a2d5b9 docs/01-installation.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/01-installation.markdown Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,8 @@ +Installation +============ + +trivial-ppm is compatible with Quicklisp, but not *in* Quicklisp (yet?). You +can clone the repository into your [Quicklisp local-projects][local] directory +for now. + +[local]: https://www.quicklisp.org/beta/faq.html#local-project diff -r 000000000000 -r de4030a2d5b9 docs/02-usage.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/02-usage.markdown Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,11 @@ +Usage +===== + +trivial-ppm + +[TOC] + +Docs +---- + +foo diff -r 000000000000 -r de4030a2d5b9 docs/03-reference.markdown diff -r 000000000000 -r de4030a2d5b9 docs/04-changelog.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/04-changelog.markdown Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,11 @@ +Changelog +========= + +Here's the list of changes in each released version. + +[TOC] + +v1.0.0 +------ + +Initial version. diff -r 000000000000 -r de4030a2d5b9 docs/api.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/api.lisp Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,20 @@ +(ql:quickload "cl-d-api") + +(defparameter *header* + "The following is a list of all user-facing parts of trivial-ppm. + +If there are backwards-incompatible changes to anything listed here, they will +be noted in the changelog and the author will feel bad. + +Anything not listed here is subject to change at any time with no warning, so +don't touch it. + +") + +(d-api:generate-documentation + :trivial-ppm + #p"docs/03-reference.markdown" + (list "TRIVIAL-PPM") + *header* + :title "API Reference") + diff -r 000000000000 -r de4030a2d5b9 docs/footer.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/footer.markdown Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,3 @@ +Created by [Steve Losh](http://stevelosh.com). + +
Rochester Made diff -r 000000000000 -r de4030a2d5b9 docs/index.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/index.markdown Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,7 @@ +trivial-ppm is a Common Lisp library for reading and writing the [PPM, PGM, and +PBM image formats](https://en.wikipedia.org/wiki/Netpbm_format). + +* **License:** MIT/X11 +* **Documentation:** +* **Mercurial:** +* **Git:** diff -r 000000000000 -r de4030a2d5b9 docs/title --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/title Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,1 @@ +trivial-ppm diff -r 000000000000 -r de4030a2d5b9 package.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package.lisp Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,5 @@ +(defpackage :trivial-ppm + (:use + :cl + :trivial-ppm.quickutils) + (:export)) diff -r 000000000000 -r de4030a2d5b9 src/main.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main.lisp Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,1 @@ +(in-package :trivial-ppm) diff -r 000000000000 -r de4030a2d5b9 trivial-ppm.asd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trivial-ppm.asd Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,19 @@ +(asdf:defsystem :trivial-ppm + :description + "Common Lisp support for reading/writing the PPM/PGM/PBM image formats." + + :author "Steve Losh " + + :license "MIT/X11" + + :depends-on () + + :serial t + :components ((:module "vendor" :serial t + :components ((:file "quickutils-package") + (:file "quickutils"))) + (:file "package") + (:module "src" :serial t + :components + ((:file "main"))))) + diff -r 000000000000 -r de4030a2d5b9 vendor/make-quickutils.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/make-quickutils.lisp Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,10 @@ +(ql:quickload 'quickutil) + +(qtlc:save-utils-as + "quickutils.lisp" + :utilities '( + + :curry + + ) + :package "TRIVIAL-PPM.QUICKUTILS") diff -r 000000000000 -r de4030a2d5b9 vendor/quickutils-package.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/quickutils-package.lisp Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,12 @@ +(eval-when (:compile-toplevel :load-toplevel :execute) + (unless (find-package "TRIVIAL-PPM.QUICKUTILS") + (defpackage "TRIVIAL-PPM.QUICKUTILS" + (:documentation "Package that contains Quickutil utility functions.") + (:use :cl)))) + +(in-package "TRIVIAL-PPM.QUICKUTILS") + +;; need to define this here so sbcl will shut the hell up about it being +;; undefined when compiling quickutils.lisp. computers are trash. +(defparameter *utilities* nil) + diff -r 000000000000 -r de4030a2d5b9 vendor/quickutils.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/quickutils.lisp Tue Nov 28 18:48:55 2017 -0500 @@ -0,0 +1,64 @@ +;;;; This file was automatically generated by Quickutil. +;;;; See http://quickutil.org for details. + +;;;; To regenerate: +;;;; (qtlc:save-utils-as "quickutils.lisp" :utilities '(:CURRY) :ensure-package T :package "TRIVIAL-PPM.QUICKUTILS") + +(eval-when (:compile-toplevel :load-toplevel :execute) + (unless (find-package "TRIVIAL-PPM.QUICKUTILS") + (defpackage "TRIVIAL-PPM.QUICKUTILS" + (:documentation "Package that contains Quickutil utility functions.") + (:use #:cl)))) + +(in-package "TRIVIAL-PPM.QUICKUTILS") + +(when (boundp '*utilities*) + (setf *utilities* (union *utilities* '(:MAKE-GENSYM-LIST :ENSURE-FUNCTION + :CURRY)))) +(eval-when (:compile-toplevel :load-toplevel :execute) + (defun make-gensym-list (length &optional (x "G")) + "Returns a list of `length` gensyms, each generated as if with a call to `make-gensym`, +using the second (optional, defaulting to `\"G\"`) argument." + (let ((g (if (typep x '(integer 0)) x (string x)))) + (loop repeat length + collect (gensym g)))) + ) ; eval-when +(eval-when (:compile-toplevel :load-toplevel :execute) + ;;; To propagate return type and allow the compiler to eliminate the IF when + ;;; it is known if the argument is function or not. + (declaim (inline ensure-function)) + + (declaim (ftype (function (t) (values function &optional)) + ensure-function)) + (defun ensure-function (function-designator) + "Returns the function designated by `function-designator`: +if `function-designator` is a function, it is returned, otherwise +it must be a function name and its `fdefinition` is returned." + (if (functionp function-designator) + function-designator + (fdefinition function-designator))) + ) ; eval-when + + (defun curry (function &rest arguments) + "Returns a function that applies `arguments` and the arguments +it is called with to `function`." + (declare (optimize (speed 3) (safety 1) (debug 1))) + (let ((fn (ensure-function function))) + (lambda (&rest more) + (declare (dynamic-extent more)) + ;; Using M-V-C we don't need to append the arguments. + (multiple-value-call fn (values-list arguments) (values-list more))))) + + (define-compiler-macro curry (function &rest arguments) + (let ((curries (make-gensym-list (length arguments) "CURRY")) + (fun (gensym "FUN"))) + `(let ((,fun (ensure-function ,function)) + ,@(mapcar #'list curries arguments)) + (declare (optimize (speed 3) (safety 1) (debug 1))) + (lambda (&rest more) + (apply ,fun ,@curries more))))) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (export '(curry))) + +;;;; END OF quickutils.lisp ;;;;