Corman Lisp

Last updated on 12 March 2003.

What's New

12/03/2003
I've ported Screamer to the recently released Corman Lisp 2.01. Download it here and you can read a little bit about what it is and how to use it on my weblog.
04/01/2003
An update to Gray Streams takes it to version 1.3. This update adds support for STREAM-READ-SEQUENCE and STREAM-WRITE-SEQUENCE as well as a bug fix.
03/01/2003
I've fixed a couple of bugs in Gray Streams and Sockets that occur as a result of changes in Corman Lisp 2.0. If you are using Corman Lisp 2.0 please replace any existing implementation with these versions.
21/10/2002
Corman Lisp 2.0 has been released. Read Roger Corman's announcement on the Corman Lisp mailing list. Most notable in this release is the ability to create DLL's written in Lisp.
01/06/2002
I've made available at my weblog some new packages. They are IDL, Mixwin and WDTest. IDL allows generation of COM wrapper functions given a type library. Mixwin is a GUI library that wraps the Win32 API similar to my previous Miniwin. Mixwin provides subclassed controls and ActiveX controls. WDTest demonstrates using the WildTangent game library to display a spinning cube in a window, interactively.
06/04/2002
I've been working on the XML-RPC package to get it more compliant with the XML-RPC spec. In particular I want it to work against the XML-RPC servers on the web. I'd also like to get the server side going. You can read about my current progress testing it against Radio Userland at my Radio weblog. I have a test website (using AllegroServe) displaying pages produced from an XML-RPC call to radio which retrieves race information from a real time odds server (developed in a combination of Lisp, Dylan and Smalltalk). Apart from that, I've been away from updating this Corman Lisp page for awhile, busy running a couple of Rhee Taekwondo branches in Wellington, New Zealand, hence the lack of updates in the past. !
05/04/2002
General cleanup. Since the release of Corman Lisp 1.5 includes much of the software I made available here, I've removed the versions here. Remember to install the patches for Corman Lisp 1.5 from the Corman Lisp site. One new addition here is a package for accessing the Windows clipboard.

What is Corman Lisp?

Corman Lisp is a Common Lisp compiler for 32-bit Windows operating systems (Windows 95, 98 and NT). It includes a native code compiler, 80x86 assembler and disassembler, incremental linker and a multi-window text editor. From Corman Lisp you can call any Windows API function alongside the Lisp standard library functions. Corman Lisp 1.5 includes full source and the Lisp engine is free for non commercial use. More details are available at the Corman Lisp web site.

I've found Corman Lisp to be an excellent product to learn Lisp, explore Windows API functions when prototyping new functionality and for building applications.

Available Files

I've set up this page to provide some of the functions and libraries I've written or ported to Corman Lisp in the hopes that others may find them useful, or provide feedback to improve them.

Please note that the patches I provide are unofficial and not supported by Roger Corman, creator of Corman Lisp. If you use these patches and have problems with Corman Lisp you might like to try and reproduce the problem without the patches applied.

Clipboard 1.0 (~ 3KB)

Some functions that can be used to read and write text to the Windows clipboard. Includes functions to evaluate Lisp forms in the clipboard. This allows you to copy Lisp code to the clipboard, manipulate it with other code, and paste the changed code back. Useful for using alongside an editor or Lisp console.

Gray Streams 1.3 (~ 5KB)

An implementation of Gray Streams for Corman Lisp 2.0. Gray Streams are CLOS based streams, allowing easy creation of new stream types.

To use, place in the Corman Lisp module search path and evaluate (require 'gray-streams). For a description of Gray Streams see the STREAM-DEFINITION-BY-USER document.

Java Native Interface 1.0 (~ 6KB)

I've made available a work in progress for access Java from Lisp via the Java Native Interface. It's very rough but does allow calling Java routines from Corman Lisp. An example shows running the Java Swing Notepad example from Lisp. You'll need to know something about JNI to use it though.

I had planned to actually get a full J-FFI working, and I did have something close to that effect but the code seems to have vanished, and I'm releasing this code in the hopes that someone might find it useful.

John Foderaro's IF* macro

This is the IF* macro used by AllegroServe as placed in the public domain by John Foderaro. Tested and works with Corman Lisp 1.5. Place in a directory in the Corman Lisp module path and use (require 'ifstar) to include.

AllegroServe for Corman Lisp 1.5 (~ 226KB)

A port of an open source web server written in Common Lisp called AllegroServe. This version of the port works with Corman Lisp 1.5. Simple using (require 'allegroserve) and loading the as-example1.lisp file should have an example web server up and running. Much work still needs to be done to make this production quality but it's a start.

This package also includes an Allegro Common Lisp socket emulation layer which could probe helpful in porting other ACL software.

SQL-ODBC 0.85 for Corman Lisp 1.5 (~88 KB)

This is a port of Paul Meurer's SQL-ODBC library to Corman Lisp 1.5. Details on the port are available in the corman subdirectory of the archive. The archive contains all the changes needed to work with Corman Lisp 1.5. Note that you must have applied all the patches for Corman Lisp 1.5 available at the Corman Lisp web site before you can use this library. The original library is available from Paul Meurer's FTP site.

Corman Lisp 1.5 ships with a version of SQL-ODBC that I ported for Corman Lisp 1.4. That version does not actually work with Corman Lisp 1.5, hence the reason for making this package available.

This library provides a nice high level interface to ODBC. An optional reader syntax is available that allows using SQL directly from LISP. An example of useage is:

(require 'ODBC)
(in-package :cl-user)
(use-package :sql)
(use-package :odbc)
(enable-sql-reader-syntax)
(connect "contact-database")
(select [count [*]] :from [people])
(select [*] :from [people] :where [= [name] "Chris"])
(disconnect)

Sockets V1.9a

Version 1.9a should replace the version currently shipping with Corman Lisp 2.0 until Roger replaces the version their with this one. It fixes an important bug which prevents sockets from working correctly in Corman Lisp 2.0.

This package is a small set of CLOS classes that wrap the WINSOCK package available at the Corman Lisp web site. It allows creation of server sockets and client sockets in a fairly easy to use manner. Support for using sockets through a proxy server is part of the package.

Example code to create a server and a client:

(defun start-server-test2 (&optional (port 8000))
  (with-server-socket (s :host "0.0.0.0" :port port)
    (start-socket-server (s rs)
      (when (equal (read-socket-line rs) "quit")
        (return))
      (write-socket-line rs (coerce (make-list 80 :initial-element #\Z) 'string))
      (write-socket-line rs (coerce (make-list 80 :initial-element #\A) 'string)))))

;;Create the server on a seperate thread
(th:create-thread #'start-server-test2)

;; A simple client to connect and read the server output.
(with-client-socket (s :host "localhost" :port 8000)
   (write-socket-line s "GO")
   (format t "~A~%" (read-socket-line s))
   (format t "~A~%" (read-socket-line s)))

;; A simple client using stream support.
(with-client-socket (s :host "localhost" :port 8000)
   (with-socket-stream (stream s)
    (write-line "GO" stream)
    (force-output stream)
    (format t "~A~%" (read-line stream))
    (format t "~A~%" (read-line stream))))

SSL Sockets V1.4

This package is included with Corman Lisp 1.5 and is no longer available for download here.

This package provides an extension to the SOCKETS library. It requires the SOCKETS library. A class, client-ssl-socket is provided that specialises all the socket methods. Useage is like a normal CLIENT-SOCKET but uses SSL. This package wraps the OpenSSL libraries to do the SSL work and compiled DLL's of the OpenSSL libraries for Win32 are in the package. I intend to do more work on this library and the SOCKETS library so any comments and suggestions are welcome. New in version 1.4 is the ability to use SSL sockets from behind a proxy server.

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), cryptographic software written by Eric Young (eay@cryptsoft.com) and software written by Tim Hudson (tjh@cryptsoft.com).

LOGICAL-PATHNAMES

This package is included with Corman Lisp 1.5 and is no longer available for download here.

This is a port of Mark Kantrowitz's portable LOGICAL-PATHNAMES system for Corman Lisp 1.5. An example of usage is:

(require 'cd-patches)
(require 'lp)
(use-package :lp)


(setf (physical-host-type "c") :win32)
(setf (logical-pathname-translations "ccl")
  '(("*.*.*" "c:\\program files\\ccl\\")	
    ("**;*.*.*" "c:\\program files\\ccl\\**\\")
    (";**;*.*.*" "c:\\program files\\ccl\\**\\")))

(translate-logical-pathname "ccl:documentation;credits.txt")
 => "c:\\program files\\ccl\\documentation\\credits.txt"

(probe-file "ccl:documentation;credits.txt")
 => "c:\\program files\\ccl\\documentation\\credits.txt"

(with-open-file (fs "ccl:documentation;credits.txt")
    (let ((x (make-string (file-length fs))))
       (read-sequence x fs)
       x))
 => "...contents of file..."

XML-RPC Library V1.0

This package is included with Corman Lisp 1.5 and is no longer available for download here.

A package to use XML-RPC in Corman Lisp. Currently only client side is supported and base64 and datetime types still need to be implemented. The functionality is there for simple XML-RPC use though and some examples of calling various servers are included. See the XML-RPC website for details on XML-RPC. Example of usage are:

(define-xmlrpc-client-method get-state-name 
	"betty.userland.com" 
	"/RPC2" 
	"examples.getStateName" 
	(state-number))
(get-state-name 41)
=> "South Dakota"

Multiprocessing Package V1.0

This package is included with Corman Lisp 1.5 and is no longer available for download here.

A package that emulates some of the Allegro Common Lisp multiprocessing functionality. The intention was to provide a base for libraries like CLOCC that have wrappers for multiprocessing support and to be compatible with Allegro to ease porting of AllegroServe to Corman Lisp.

Example of usage are:

(process-run-function "sleeper" #'(lambda () (sleep 30)))
 => #<Process sleeper>
(proc)
=> 
 Name                           Id           Run     Arrest  Status    
 ----                           --           ---     ------  ------    
 main                           4294621939   1       0       RESUME
 sleeper                        4294621940   1       0       RESUME

TELNET-LISTENER Package V1.0

This package is included with Corman Lisp 1.5 and is no longer available for download here.

A package that provides the ability to telnet to a running Corman Lisp session and operate a listener through that telnet session. Multiple telnets can be made to a single Corman Lisp session. Requires the SOCKETS and MP packages.

Example of usage is:

(require :telnet-listener)
(use-package :telnet-listener)


;; Start a daemon on port 8000
(start-telnet-listener-daemon 8000)


;; Operating system commands here to start a couple of listeners.
;; Enter :QUIT into the listener to exit it.
telnet localhost 8000
telnet localhost 8000



(mp:proc)

=> 
  Name                           Id           Run     Arrest  Status    
  ----                           --           ---     ------  ------    
  telnet-listener-1              4294537043   1       0       RESUME    
  telnet-listener-2              4294453251   1       0       RESUME    
  telnet-listener-daemon-8001    4294608487   1       0       RESUME    
  main                           4294621939   1       0       RESUME    


;; Back to Lisp
(stop-telnet-listener-daemon 8000)

Links

Some links of interest for Corman Lisp and Lisp in general.