Clozure CL (CCL) Documentation

repository·master·Indexed 21 days ago

https://github.com/clozure/ccl

Clozure CL (CCL) is a high-performance, self-hosting Common Lisp implementation. The documentation covers system compilation, the Cocoa-based IDE for macOS, code coverage analysis, and Foreign Function Interface (FFI) examples including OpenGL and GTK integrations via OpenMCL.

Tokens
3.5K
Snippets
15
Records
26
Agent score
75%

What's inside Clozure CL

  1. Overview of Clozure CL (CCL)

    master
    Clozure CL (CCL) is a Common Lisp implementation. Notably, CCL is self-hosting, meaning the source code is written in CCL itself. To compile the source, you must already have a working version of CCL installed on your system.
  2. Use defsystem.lisp for system building

    master

    The defsystem.lisp file (version 3.4i, also known as "MK-DEFSYSTEM") is a system definition facility similar to the Unix make program. It is used for building systems in Common Lisp.

    Note: For historical reasons, DEFSYSTEM will attempt to redefine the CL:REQUIRE function.

  3. Use asdf.lisp for system definition

    master
    The asdf.lisp file provides 'Another System Definition Facility' for Clozure CL. It integrates with the environment by hooking into CCL's existing CL:REQUIRE function to manage system definitions and dependencies.
  4. Get support for Clozure CL

    master

    If you encounter problems or have questions, you can seek help through the following channels:

    • Email: Send mail to ccl-devel@clozure.com. Instructions for subscribing to the mailing list can be found at https://lists.clozure.com.
    • IRC: Ask on the #ccl channel on libera.chat.
    • GitHub Issues: Create an issue on GitHub, particularly if you believe you have found a bug.
  5. Obtain a working version of CCL for compilation

    master

    Since CCL is self-hosting, you cannot compile it from scratch without an existing CCL binary. To get a pre-compiled copy of CCL for your specific operating system, visit the official releases page.

    https://github.com/Clozure/ccl/releases/latest
  6. Compile a Common Lisp system with code coverage

    master

    To perform code coverage analysis on a Common Lisp system, follow these steps:

    1. Load the code coverage test system using Quicklisp or direct loading:

      (ql:quickload :code-cover-test)
      (ql:quickload :code-cover-tests)
    2. Configure your system to be tested. You can refer to code-cover-test/cl-ppcre-tests.lisp for a concrete example of defining methods to run unit tests with coverage enabled.

    3. Compile and run tests using the do-tests function. You must pass an instance of your test suite to it:

      (in-package :code-cover-test)
      (do-tests (make-instance 'cl-ppcre-tests))

    To (re)compile and (re)initialize code coverage without executing the tests, use init-code-coverage:

    (init-code-coverage (make-instance 'cl-ppcre-tests))
    (in-package :code-cover-test)
    (do-tests (make-instance 'cl-ppcre-tests))
  7. View code coverage reports via Hunchentoot web server

    master

    While you can view the generated html/index.html file directly in a browser, some browsers may fail to render frames or execute the Javascript UI correctly when using local file URLs. It is recommended to serve the results via a web server like Hunchentoot.

    1. Load the server system:

      (ql:quickload :code-cover-test-server)
    2. Configure host and port: The defaults are localhost and 9090. Set them using *server-host* and *server-port*:

      (in-package :code-cover-test-server)
      (setq *server-port* 9090. *server-host* "localhost")
    3. Start the server:

      (start-server)
    4. Access the results: Open your browser to the appropriate URL, for example: http://localhost:9090/code-cover-test.

    5. Stop the server:

      (stop-server)
    (in-package :code-cover-test-server)
    (setq *server-port* 9090. *server-host* "localhost")
    (start-server)
  8. Generate code coverage reports

    master

    After running your tests, you can generate the coverage report files.

    1. Set the output directory: The default directory is ~/tmp/code-cover-test. You can override this by setting the *output-directory-path* variable:

      (setq *output-directory-path* #P"~/tmp/code-cover-test/")
    2. Generate the report: Execute report-code-coverage-test to produce the output files:

      (report-code-coverage-test)
    (setq *output-directory-path* #P"~/tmp/code-cover-test/")
    (report-code-coverage-test)
  9. Overview of Phemlock

    master

    Phemlock (The Portable Hemlock) is an attempt to port the Hemlock editor to any system that supports ANSI Common Lisp and CLIM. It aims to decouple the editor from CMUCL-specific implementations, such as its stream interfaces and file I/O, to achieve broader portability.

    Key portability improvements include:

    • Streams: Replaced CMUCL-specific streams with Gray streams.
    • File I/O: Replaced direct Unix system calls (unix-read, unix-write) with standard Common Lisp line-by-line I/O.
    • X11 Interface: Provided a portability layer that uses the standard CLX interface instead of the CMUCL-specific SERVE-EVENT facility.

    Currently, you can edit files using the X11 interface on any ANSI Common Lisp implementation that provides CLX.

  10. Prerequisites for OpenMCL LinuxPPC examples

    master

    To run the LinuxPPC-specific examples, ensure the following requirements are met:

    1. OpenMCL Version: Requires OpenMCL 0.9 or later.
    2. X11 Environment: Most examples require X11 runtime libraries to be installed and OpenMCL to be running under an X server.
    3. Shared Libraries: You must have the necessary .so libraries installed on your system. You can verify if a library is present using ldconfig:
    % /sbin/ldconfig -p | fgrep LIBNAME.so

    If the command returns a path (e.g., LIBNAME.so (...) => /path/to/lib), the library is available. If not, you must install the appropriate package (e.g., mesa, opengl, or glutg3) for your Linux distribution. 4. Interface Directories: OpenMCL uses "interface directories" (subdirectories of ccl:headers; containing .db files) to modularize its interface database.

  11. Run the Cocoa-based IDE from a CCL session

    master

    To launch the Cocoa-based IDE from within an existing Clozure CL command-line session (such as a shell, Emacs buffer, SLIME, or ILisp), use the require function with the "COCOA" argument.

    On the first run, the system will compile the sources, which may generate numerous compiler warnings and messages regarding new ObjC-callable methods. Once complete, a temporary application bundle is created at ccl:temp bundle.app and activated. You will see a new menubar, a listener window, and a Clozure CL icon in the Dock.

    Note that the original non-GUI listener process remains active. Any diagnostic or error messages from the IDE will be directed to the standard output/error streams of that listener (e.g., the *inferior-lisp* buffer in SLIME).

    (require "COCOA")