81 lines
No EOL
4.9 KiB
HTML
81 lines
No EOL
4.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>CLiki: psgraph</title>
|
|
<link rel="alternate" type="application/atom+xml" title="ATOM feed of edits to current article"
|
|
href="https://www.cliki.net/site/feed/article.atom?title=psgraph">
|
|
<link rel="stylesheet" href="static/css/style.css">
|
|
<link rel="stylesheet" href="static/css/colorize.css">
|
|
</head>
|
|
|
|
<body>
|
|
<span class="hidden">CLiki - psgraph</span>
|
|
<div id="content"><div id="content-area"><div id="article-title">psgraph</div><div id="article">psgraph is a small package for generating <a href="PostScript.html" class="internal">PostScript</a> pictures of directed acyclic graphs written by <a href="https://www.cliki.net/Joe%20Bates" class="new">Joe Bates</a> and mentioned here: <a href="http://www.cs.cmu.edu/Groups/AI/html/faqs/lang/lisp/part6/faq-doc-2.html">Repositories of Lisp Software</a>. It allows arbitrary information to be displayed by a node, and it supports programmable generation of trees, similar to <a href="CLIM.html" class="internal">CLIM</a>'s tree drawing.<p>It is portable Common Lisp, and has been tested sucessfully on <a href="SBCL.html" class="internal">SBCL</a>, <a href="Clisp.html" class="internal">Clisp</a>, <a href="Allegro.html" class="internal">Allegro</a>, <a href="CMUCL.html" class="internal">CMUCL</a>, and <a href="LispWorks.html" class="internal">LispWorks</a>.<p><h2>Example</h2>
|
|
This code (look at psgraph.doc file) will make a pretty, small graph:<p><pre>
|
|
;; Load psgraph
|
|
(asdf:oos 'asdf:load-op :psgraph)
|
|
|
|
;; Set some drawing settings
|
|
(setf psgraph:*boxkind* "fill")
|
|
(setf psgraph:*boxgray* ".8")
|
|
(setf psgraph:*fontsize* 8)
|
|
(setf psgraph:*second-fontsize* 6)
|
|
|
|
;; This function will be given the name of a node, like 'A, and
|
|
;; return a list of the node's children.
|
|
(defun children (x)
|
|
(cond ((eq x 'A) '(B C D))
|
|
((member x '(B C D)) '(E F G))
|
|
((member x '(E F G)) '(H))
|
|
(t nil)))
|
|
|
|
;; This returns the information to be displayed for a node.
|
|
(defun info (x)
|
|
(list (string x)))
|
|
|
|
;; This is the top-level function
|
|
(defun graph (&optional (shrink t))
|
|
(with-open-file (output-stream "g.ps"
|
|
:direction :output
|
|
:if-exists :supersede)
|
|
(psgraph:psgraph output-stream 'A #'children #'info shrink nil #'eq)))
|
|
</pre><p>Just call <tt>(graph)</tt> and view g.ps. You will see something like this:<p><img src="http://common-lisp.net/project/asdf-packaging/g.png" alt="An example graph"><p><h2>Download</h2><p>It can be downloaded from the <a href="http://common-lisp.net/project/asdf-packaging/">asdf-packaging home page</a>.<p><hr>
|
|
<a href="plotting.html" class="category">plotting</a> <a href="graphics library.html" class="category">graphics library</a></div></div>
|
|
<div id="footer" class="buttonbar"><ul><li><a href="psgraph.html">Current version</a></li>
|
|
<li><a href="https://www.cliki.net/site/history?article=psgraph">History</a></li>
|
|
<li><a href="https://www.cliki.net/site/backlinks?article=psgraph">Backlinks</a></li><li><a href="https://www.cliki.net/site/edit-article?title=psgraph&from-revision=3686397407">Edit</a></li><li><a href="https://www.cliki.net/site/edit-article?create=t">Create</a></li></ul></div>
|
|
</div>
|
|
<div id="header-buttons" class="buttonbar">
|
|
<ul>
|
|
<li><a href="https://www.cliki.net/">Home</a></li>
|
|
<li><a href="https://www.cliki.net/site/recent-changes">Recent Changes</a></li>
|
|
<li><a href="CLiki.html">About</a></li>
|
|
<li><a href="Text Formatting.html">Text Formatting</a></li>
|
|
<li><a href="https://www.cliki.net/site/tools">Tools</a></li>
|
|
</ul>
|
|
<div id="search">
|
|
<form action="https://www.cliki.net/site/search">
|
|
<label for="search_query" class="hidden">Search CLiki</label>
|
|
<input type="text" name="query" id="search_query" value="" />
|
|
<input type="submit" value="search" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div id="pageheader">
|
|
<div id="header">
|
|
<span id="logo">CLiki</span>
|
|
<span id="slogan">the common lisp wiki</span>
|
|
<div id="login"><form method="post" action="https://www.cliki.net/site/login">
|
|
<label for="login_name" class="hidden">Account name</label>
|
|
<input type="text" name="name" id="login_name" class="login_input" />
|
|
<label for= "login_password" class="hidden">Password</label>
|
|
<input type="password" name="password" id="login_password" class="login_input" />
|
|
<input type="submit" name="login" value="login" id="login_submit" /><br />
|
|
<div id="register"><a href="https://www.cliki.net/site/register">register</a></div>
|
|
<input type="submit" name="reset-pw" value="reset password" id="reset_pw" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body></html> |