A CFFI wrapper for the pslib library, a library for generating PostScript files.
1moved to https://codeberg.org/cage/cl-pslib
2Important noteThe 'ps' nickname for this package has been removed.
This means that if you are using this library you should replace all occurences of the 'ps' package qualifier with 'cl-pslib'.
(ps:get-value doc "boxheight")
(cl-pslib:get-value doc "boxheight")
(defpackage :foo (:use :ps))
(defpackage :foo (:use :cl-pslib))
Alternatively., if you are using ECL, ABCL, CCL or SBCL compiler you can setup a package local nickname as showed here.
Cl-pslib is a (thin) wrapper around pslib a library for generating PostScript files.
4The wrapperCl-pslib use CFFI and SWIG to interface with foreign (non lisp)library and generate the low-level lisp wrapper respectively.
cl-pslib does not export the raw (CFFI) pslib API but use CLOS instead.
A psdoc C struct pointer is wrapped in the class psdoc, most of the functions to manipulate this pointer are wrapped in lisp methods specialized for that class.
Pslib use a lot of parameters to configure its behavior.
(get-value doc "boxheight")
I found this very unpractical so i tried to generate lisp constants to match the corresponding string parameter
(get-value doc +value-key-boxheight+)
4.2Function nameAs general rule the methods for the class psdoc are the same of theones of the pslib with the character "_" substituted by "-".
There are some exceptions listed below.
|native name||lisp name|
setcolorcan accept a
cl-colorobject as parameter;
- there is no '(ps_)boot' method; when an instance of
psdocis created the
initialize-instanceof that class will call
ps_bootif needed.The same is true for '(ps_)new' method;
open-docmethod will pass the output of pslib (i.e.the PostScriptfile) to a lisp callback function if the second argument of the function isnil; by default the callback just copy the output in
cl-pslib:*callback-string*.This maybe can be useful for generate a file in a web application.
There is another callback:
write-to-streamthat write the postscript code to a stream (by default the stream is bound to
(let* ((cl-pslib:*callback-stream* *standard-output*) (doc (make-instance 'cl-pslib:psdoc :writeproc (cffi:callback write-to-stream)))) ;; rest of the code here )
string-geometrymethod return an instance of
Note that the whole library is in an alpha stage, testing is still in progress, please see section below
- to use the template features
and-templatea version >= 0.47 must be used.
5.1Missing functionThe high-level API does not still remap this functions:
Please file bug report on the issue tracker
7LicenseThis library is released under Lisp Lesser General Public license (seeCOPYING.LESSER file)
Examples are released under GPL version 3 or later
This library 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 Lesser General Public License for more details.