Difference between revisions of "Common Lisp Creating A New Project"

From copec
Jump to: navigation, search
(Edit Stuff)
(Load the skeleton)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
Template procedure on how to create new Common Lisp project. Totally stolen from:
+
Template procedure on how to create new Common Lisp project.  
 +
Totally stolen from:
 
* [http://xach.livejournal.com/278047.html?thread=674335 Zach Beane - Making a small Lisp project with quickproject and Quicklisp.]
 
* [http://xach.livejournal.com/278047.html?thread=674335 Zach Beane - Making a small Lisp project with quickproject and Quicklisp.]
  
Line 28: Line 29:
  
 
=== Edit Stuff ===
 
=== Edit Stuff ===
 +
==== Load the skeleton ====
 +
<pre>
 +
CL-USER> (ql:quickload "swatchblade")
 +
</pre>
 +
 
==== Hack the planet starting in '''swatchblade.lisp''' ====
 
==== Hack the planet starting in '''swatchblade.lisp''' ====
==== Import symbols under '''package.lisp''' ====
+
==== Import ''vecto'' symbols under '''package.lisp''' ====
 
<pre>
 
<pre>
 
(defpackage #:swatchblade
 
(defpackage #:swatchblade
Line 39: Line 45:
 
                           #:save-png-stream))
 
                           #:save-png-stream))
 
</pre>
 
</pre>
==== Add libraries under '''swatchblade.asd''' ====
+
==== Add libraries ''cl-colors'' under '''swatchblade.asd''' ====
 
<pre>
 
<pre>
 
(asdf:defsystem #:swatchblade
 
(asdf:defsystem #:swatchblade
Line 49: Line 55:
 
               (:file "swatchblade")))
 
               (:file "swatchblade")))
 
</pre>
 
</pre>
==== Add source files ''utils'', ''graphics'', ''web''====
+
==== Add source files ''utils'', ''graphics'', ''web'' under '''swatchblade.asd'''====
 +
Simple ":serial t" loading example:
 
<pre>
 
<pre>
 
(asdf:defsystem #:swatchblade
 
(asdf:defsystem #:swatchblade
Line 60: Line 67:
 
               (:file "web")
 
               (:file "web")
 
               (:file "swatchblade")))
 
               (:file "swatchblade")))
 +
</pre>
 +
==== Export some sort of entry point symbols under '''package.lisp''' ====
 +
<pre>
 +
(defpackage #:swatchblade
 +
  (:use #:cl)
 +
  (:export #:start-web-server)
 +
  (:shadowing-import-from #:vecto
 +
                          #:with-canvas
 +
                          #:rounded-rectangle
 +
                          #:set-rgb-fill
 +
                          #:save-png-stream))
 
</pre>
 
</pre>
  
Line 65: Line 83:
 
<pre>
 
<pre>
 
CL-USER> (ql:quickload "swatchblade")
 
CL-USER> (ql:quickload "swatchblade")
 +
</pre>
 +
=== Use Project ===
 +
<pre>
 +
CL-USER> (ql:quickload "swatchblade")
 +
loading output
 +
CL-USER> (swatchblade:start-web-server :port 8080)
 +
Server started on port 8080.
 
</pre>
 
</pre>

Latest revision as of 13:47, 10 January 2017

Overview

Template procedure on how to create new Common Lisp project. Totally stolen from:

Project Creation (Steps)

Make Sure Environment is Setup

Install quickproject

CL-USER> (ql:quickload "quickproject")

Create Project

CL-USER> (quickproject:make-project "~/org.unaen.dev.src/lisp/swatchblade/"
                             :depends-on '(vecto hunchentoot))
"swatchblade"

Default Files Created

~/org.unaen.dev.src/lisp/swatchblade/

  • package.lisp
  • swatchblade.lisp
  • swatchblade.asd
  • README.txt

Edit Stuff

Load the skeleton

CL-USER> (ql:quickload "swatchblade")

Hack the planet starting in swatchblade.lisp

Import vecto symbols under package.lisp

(defpackage #:swatchblade
  (:use #:cl)
  (:shadowing-import-from #:vecto
                          #:with-canvas
                          #:rounded-rectangle
                          #:set-rgb-fill
                          #:save-png-stream))

Add libraries cl-colors under swatchblade.asd

(asdf:defsystem #:swatchblade
  :serial t
  :depends-on (#:vecto
               #:hunchentoot
               #:cl-colors)
  :components ((:file "package")
               (:file "swatchblade")))

Add source files utils, graphics, web under swatchblade.asd

Simple ":serial t" loading example:

(asdf:defsystem #:swatchblade
  :serial t
  :depends-on (#:vecto
               #:hunchentoot)
  :components ((:file "package")
               (:file "utils")
               (:file "graphics")
               (:file "web")
               (:file "swatchblade")))

Export some sort of entry point symbols under package.lisp

(defpackage #:swatchblade
  (:use #:cl)
  (:export #:start-web-server)
  (:shadowing-import-from #:vecto
                          #:with-canvas
                          #:rounded-rectangle
                          #:set-rgb-fill
                          #:save-png-stream))

Load Project

CL-USER> (ql:quickload "swatchblade")

Use Project

CL-USER> (ql:quickload "swatchblade")
loading output
CL-USER> (swatchblade:start-web-server :port 8080)
Server started on port 8080.