Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
cmake_minimum_required(VERSION 3.14)
project(XLisp
VERSION 3.3
VERSION 10.0.0
DESCRIPTION "XLISP - an object-oriented LISP"
LANGUAGES C)

# Threading support option
option(XLISP_THREADS "Build with threading support" OFF)

# Find threads package
find_package(Threads)

add_library(xlisp "")

if(XLISP_THREADS)
target_compile_definitions(xlisp PUBLIC XLISP_USE_CONTEXT)
if(Threads_FOUND)
target_link_libraries(xlisp PUBLIC Threads::Threads)
endif()
endif()

add_subdirectory(src)

add_library(ext SHARED "")
Expand Down
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ endif
ECHO=echo
MKDIR=mkdir

CFLAGS=-Wall -DUNIX -I$(HDRDIR)
CFLAGS=-Wall -DUNIX -I$(HDRDIR) -fPIC

# Threading support: make THREADS=1
ifdef THREADS
CFLAGS += -DXLISP_USE_CONTEXT
THREADLIBS = -lpthread
else
THREADLIBS =
endif

INC=$(HDRDIR)/xlisp.h

Expand All @@ -67,6 +75,7 @@ clean:
rm -f -r $(OBJDIR)
rm -f -r $(LIBDIR)
rm -f -r $(BINDIR)
rm -f -r build

#########
# XLISP #
Expand All @@ -83,7 +92,7 @@ $(XLISPOBJDIR)/%.o: %.c $(INC)
@$(ECHO) $@

$(BINDIR)/xlisp$(EXT): $(XLISPOBJDIR) $(XLISPOBJS) library
@$(CC) $(CFLAGS) $(XLISPOBJS) -L$(LIBDIR) -lxlisp -lm -o $@
@$(CC) $(CFLAGS) $(XLISPOBJS) -L$(LIBDIR) -lxlisp -lm $(THREADLIBS) -o $@
@$(ECHO) $@

###########
Expand All @@ -99,6 +108,7 @@ $(LIBOBJDIR)/xlansi.o \
$(LIBOBJDIR)/xlapi.o \
$(LIBOBJDIR)/xlcobj.o \
$(LIBOBJDIR)/xlcom.o \
$(LIBOBJDIR)/xlcontext.o \
$(LIBOBJDIR)/xldbg.o \
$(LIBOBJDIR)/xldmem.o \
$(LIBOBJDIR)/xlfasl.o \
Expand All @@ -113,6 +123,9 @@ $(LIBOBJDIR)/xlio.o \
$(LIBOBJDIR)/xlmain.o \
$(LIBOBJDIR)/xlitersq.o \
$(LIBOBJDIR)/xlmath.o \
$(LIBOBJDIR)/xlnthread.o \
$(LIBOBJDIR)/xlshared.o \
$(LIBOBJDIR)/xlsync.o \
$(LIBOBJDIR)/xlobj.o \
$(LIBOBJDIR)/xlosint.o \
$(LIBOBJDIR)/xlprint.o \
Expand Down
69 changes: 29 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,42 @@
# xlisp
## An object-oriented LISP
# XLISP 3

Version 3.0
XLISP3 is a fork of David Betz's XLISP3.

February 18, 2006
The home for this fork is at <https://github.com/blakemcbride/XLISP3>

## Building with CMake
We've added the ability to build with CMake to simplify building XLisp on your
system. The way that we expect this to work on Linux systems using `make` would
be to first make a build directory. For this walkthrough we'll say that we
start _in_ the xlisp directory:
XLISP3 is better described as Scheme than Lisp since it more closely follows Scheme.

```bash
cd ..
mkdir build
cd build
ccmake ../xlisp
```
So, now we have made a build directory outside of xlisp, so that the build
products don't get strewn all over our pristine source. The `ccmake` command is
a curses front end to CMake that I like. From there you can pick the type of
build, then type "g" for generate. This drops you out in a shell prompt, where
it has made makefiles for you (on other platforms, you may have other types of
build files generated). After that you can:
It has some really nice features as follows:

```bash
make
# and then, either:
make install
# or
make package
```
1. It has a byte-code compiler (to FASL files) so code runs reasonably fast.
2. It can load Lisp source files or compiled FASL files.
3. It has an object system with classes, methods, inheritance, and `super` calls.
4. The macro system is traditional Lisp-style (not Scheme's hygienic macros).
5. It can be used as an extension language embedded in C programs.
6. It can save/load workspace images.
7. It correctly handles tail recursion (proper tail call optimization).
8. It has a Common Lisp-style package system.
9. It supports multiple return values.
10. It has first-class continuations (call/cc).

With the CMake file we have in there, it also has a "package" target, which
will most likely result in a gzipped tar file of the build products. It is also
possible to alter the `CMakeLists.txt` file to generate other package types,
such as `*.rpm`, `*.deb`, etc.
## To all of this, I have added:

#### David Michael Betz
- A. When used as an extension language, it is now reentrant and can handle multiple simultaneous threads.
- B. Native thread creation and joining from Lisp (`thread-create`, `thread-join`, `thread?`).
- C. Synchronization primitives: mutexes, condition variables, and message channels with cross-thread sharing via named registries.
- D. High-level threading utilities: `with-mutex`, `future`/`await`, `pcall`, thread pools, and `pmap` (`threads.lsp`).
- E. Shared bytecode pool: publish compiled functions once and have them automatically available in all threads, avoiding redundant compilation and reducing per-thread memory usage (`share-function`, `shared-code?`).
- F. Updated version to 10.0.0.

18 Garrison Drive
Bedford, US, NH 03110
## Building

(603) 472-2389 (home)
make # standard build
make THREADS=1 # thread-safe build
make clean # remove build artifacts

#### Copyright (c) 1984-2006, by David Michael Betz
## The original README file is located at README2.md

All Rights Reserved
Blake McBride
blake@mcbridemail.com

See the included file LICENSE for the full license.

Updated 11/8/24 to test 2FA.
53 changes: 53 additions & 0 deletions README2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# xlisp
## An object-oriented LISP

Version 3.0

February 18, 2006

## Building with CMake
We've added the ability to build with CMake to simplify building XLisp on your
system. The way that we expect this to work on Linux systems using `make` would
be to first make a build directory. For this walkthrough we'll say that we
start _in_ the xlisp directory:

```bash
cd ..
mkdir build
cd build
ccmake ../xlisp
```
So, now we have made a build directory outside of xlisp, so that the build
products don't get strewn all over our pristine source. The `ccmake` command is
a curses front end to CMake that I like. From there you can pick the type of
build, then type "g" for generate. This drops you out in a shell prompt, where
it has made makefiles for you (on other platforms, you may have other types of
build files generated). After that you can:

```bash
make
# and then, either:
make install
# or
make package
```

With the CMake file we have in there, it also has a "package" target, which
will most likely result in a gzipped tar file of the build products. It is also
possible to alter the `CMakeLists.txt` file to generate other package types,
such as `*.rpm`, `*.deb`, etc.

#### David Michael Betz

18 Garrison Drive
Bedford, US, NH 03110

(603) 472-2389 (home)

#### Copyright (c) 1984-2006, by David Michael Betz

All Rights Reserved

See the included file LICENSE for the full license.

Updated 11/8/24 to test 2FA.
Loading