Imported Upstream version 10.7.0
347
Makefile
Normal file
|
@ -0,0 +1,347 @@
|
|||
#
|
||||
# USAGE:
|
||||
#
|
||||
# make <option>
|
||||
#
|
||||
# to see a list of all options, enter 'make help'
|
||||
#
|
||||
# Note! on some systems do 'gmake' instead of 'make' (most BSD)
|
||||
#
|
||||
# for 'make install' you have to login as 'root' else do 'make install_home'
|
||||
# note that 'make install_home' will not install guiserver files which
|
||||
# must be in /usr/local/share/newlisp in MacOX X and UNIX machines
|
||||
#
|
||||
# to make the distribution archive: 'make dist'
|
||||
#
|
||||
# to clean up (delete .o *~ core etc.): 'make clean'
|
||||
#
|
||||
# for customization options, like install location, 64-bit nerwlisp,
|
||||
# newLISP as a library etc., see the file doc/INSTALL.txt
|
||||
#
|
||||
# Regular expressions are on all platforms Perl Compatible Regular Expresssions PCRE
|
||||
# see http://www.pcre.org. PCRE can be localized to other languages than English
|
||||
# by generating different character tables, see documentation at www.pcre.org
|
||||
# and file LOCALIZATION for details
|
||||
#
|
||||
|
||||
VERSION = 10.7.0
|
||||
INT_VERSION = 10700
|
||||
|
||||
default: makefile_build
|
||||
make -f makefile_build
|
||||
|
||||
makefile_build:
|
||||
./configure
|
||||
|
||||
all: default
|
||||
|
||||
help:
|
||||
@echo "\nDo one of the following:"
|
||||
@echo " make # auto-select one of the predefined makefiles and build newLISP"
|
||||
@echo " make help # display this help"
|
||||
@echo " make install # install on LINUX/UNIX in /usr/local/bin and /usr/local/share (need to be root)"
|
||||
@echo " make uninstall # uninstall on LINUX/UNIX from /usr/local/bin and /usr/local/share (need to be root)"
|
||||
@echo " make install_home # install on LINUX/UNIX in users home directory "
|
||||
@echo " make uninstall_home # uninstall on LINUX/UNIX from users home directory "
|
||||
@echo
|
||||
@echo " make clean # remove all *.o and .tar files etc. USE BETWEEN FLAVORS!"
|
||||
@echo " make check # run qa-dot, qa-net, qa-xml etc. test scripts"
|
||||
@echo " make test # same as 'make check' but less output"
|
||||
@echo " make testall # run an extended test suite with less output"
|
||||
@echo " make version # replace version number in several files after changing in Makefile"
|
||||
@echo " make bench # benchmark relative to 32-bit Mac OS 10.5 on MacMini 1.83Ghz"
|
||||
@echo " make dist # make a source distribution .tgz package "
|
||||
@echo " make android_dist # make a source package for Android NDK compilation"
|
||||
@echo " make android_dist_utf8 # make a source package for Android NDK compilationi utf8"
|
||||
@echo
|
||||
@echo "Note! on some systems use gmake instead of make."
|
||||
@echo "Note! not all makefiles are listed in this help, specifically 64-bit versions."
|
||||
@echo " "
|
||||
@echo "Readline is for commandline editing support and requires libreadline and headerfiles."
|
||||
@echo "Not all makefiles contain libreadline support, but is easy to add (see other makefieles)."
|
||||
@echo "If there is no UTF-8 option for your OS, consult makefile_xxx."
|
||||
@echo " "
|
||||
@echo "For more customization options (exe dir, install dir, 64-biti, etc) see the file doc/INSTALL"
|
||||
|
||||
# make newlisp.exe and newlisp.dll on a MinGW, MSYS system
|
||||
# also needs the installer NSYS installed
|
||||
winall:
|
||||
make clean
|
||||
make -f makefile_mingw_ffi
|
||||
rm *.o
|
||||
make -f makefile_mingwdll_ffi
|
||||
rm *.o
|
||||
./newlisp qa-dot
|
||||
|
||||
# make newlisp.exe and newlisp.dll in UTF-8 flavor
|
||||
winall_utf8:
|
||||
make clean
|
||||
make -f makefile_mingw_utf8_ffi
|
||||
rm *.o
|
||||
make -f makefile_mingwdll_utf8_ffi
|
||||
rm *.o
|
||||
./newlisp qa-dot
|
||||
tar czvf newlisp-win-utf8.tgz newlisp.exe newlisp.dll
|
||||
|
||||
winall64:
|
||||
make clean
|
||||
make -f makefile_mingw64_ffi
|
||||
rm *.o
|
||||
make -f makefile_mingw64dll_ffi
|
||||
rm *.o
|
||||
./newlisp qa-dot
|
||||
tar czvf newlisp-win64.tgz newlisp.exe newlisp.dll
|
||||
|
||||
# make newlisp.exe and newlisp.dll in UTF-8 flavor
|
||||
winall64_utf8:
|
||||
make clean
|
||||
make -f makefile_mingw64_utf8_ffi
|
||||
rm *.o
|
||||
make -f makefile_mingw64dll_utf8_ffi
|
||||
rm *.o
|
||||
./newlisp qa-dot
|
||||
tar czvf newlisp-win64-utf8.tgz newlisp.exe newlisp.dll
|
||||
|
||||
# make a Windows installer package
|
||||
wings:
|
||||
make -f makefile_wings
|
||||
|
||||
wings64:
|
||||
make -f makefile_wings64
|
||||
|
||||
|
||||
# scripts for making UBUNTU linux packages
|
||||
|
||||
dpkg:
|
||||
make clean
|
||||
cp makefile_original_install makefile_install
|
||||
make -f makefile_linuxLP64_ffi
|
||||
cp util/description-pak .
|
||||
sudo checkinstall --nodoc --maintainer "lutz@nuevatec.com" --pkgrelease 1 --default
|
||||
rm description-pak
|
||||
mv *.deb ../Desktop
|
||||
|
||||
dpkg_utf8:
|
||||
make clean
|
||||
cp makefile_original_install makefile_install
|
||||
make -f makefile_linuxLP64_utf8_ffi
|
||||
cp util/description-pak .
|
||||
sudo checkinstall --nodoc --maintainer "lutz@nuevatec.com" --pkgrelease utf8 --default
|
||||
rm description-pak
|
||||
mv *.deb ../Desktop
|
||||
|
||||
# scripts for making Mac OS X disk image installers
|
||||
# makefile_darwin_package needs a previous /Applications/newLISP-GS.app
|
||||
dmg_ppc:
|
||||
make clean
|
||||
make -f makefile_darwin_utf8_leopardPPC_ffi
|
||||
make -f makefile_darwin_package
|
||||
hdiutil create -srcfolder newLISP-image newlisp-$(VERSION)-OSX-ppc.dmg
|
||||
mv newlisp-$(VERSION)-OSX-ppc.dmg ..
|
||||
sudo rm -rf Package_contents
|
||||
sudo rm -rf newLISP-image
|
||||
|
||||
# makefile_darwin_package needs a previous /Applications/newLISP-GS.app
|
||||
dmg_intel:
|
||||
make clean
|
||||
make -f makefile_darwinLP64_utf8_ffi
|
||||
make -f makefile_darwin_package
|
||||
hdiutil create -srcfolder newLISP-image newlisp-$(VERSION)-OSX-intel.dmg
|
||||
mv newlisp-$(VERSION)-OSX-intel.dmg ..
|
||||
sudo rm -rf Package_contents
|
||||
sudo rm -rf newLISP-image
|
||||
|
||||
# this cleans up the distribution directory for a clean build from scratch
|
||||
|
||||
# this cleans the tree for a rebuild using the same configuration as before
|
||||
clean:
|
||||
-rm -f *~ *.bak *.o *.obj *.map *.core core *.tgz *.txt TEST newlisp-universal
|
||||
-rm -f newlisp-js*.*
|
||||
-rm -rf newlisp-js-$(VERSION)
|
||||
-rm -f guiserver/*.class */*~ */._*
|
||||
-rm -f doc/*.bak util/*.bak examples/*.bak modules/*.bak
|
||||
-chmod 644 *.h *.c Makefile makefile*
|
||||
-chmod 755 configure configure-alt examples/*
|
||||
-chmod 644 doc/* modules/*.lsp examples/*.lsp examples/*.html
|
||||
-chmod 755 doc/index.cgi
|
||||
-chmod 644 guiserver/*
|
||||
-chmod 755 guiserver/index.cgi
|
||||
-chmod 755 guiserver/images
|
||||
-chmod 644 guiserver/images/*
|
||||
-chmod 755 guiserver/images/index.cgi
|
||||
-chmod 755 guiserver/java
|
||||
-chmod 644 guiserver/java/*
|
||||
-chmod 755 guiserver/java/index.cgi
|
||||
-rm -f makefile_build makefile_install config.h test-*
|
||||
|
||||
# run test scripts
|
||||
sharebug:
|
||||
./newlisp qa-dot
|
||||
|
||||
|
||||
check:
|
||||
./newlisp qa-dot
|
||||
./newlisp qa-specific-tests/qa-dictionary
|
||||
./newlisp qa-specific-tests/qa-xml
|
||||
./newlisp qa-specific-tests/qa-json
|
||||
./newlisp qa-specific-tests/qa-setsig
|
||||
./newlisp qa-specific-tests/qa-net
|
||||
./newlisp qa-specific-tests/qa-cilk
|
||||
./newlisp qa-specific-tests/qa-ref
|
||||
./newlisp qa-specific-tests/qa-message
|
||||
./newlisp qa-specific-tests/qa-win-dll
|
||||
./newlisp qa-specific-tests/qa-bigint 10000
|
||||
./newlisp qa-specific-tests/qa-bench
|
||||
|
||||
# old naming for check
|
||||
test:
|
||||
make check | grep '>>>'
|
||||
|
||||
checkall:
|
||||
./newlisp qa-dot ; echo qa-dot
|
||||
./newlisp qa-specific-tests/qa-dictionary
|
||||
./newlisp qa-specific-tests/qa-xml
|
||||
./newlisp qa-specific-tests/qa-json
|
||||
./newlisp qa-specific-tests/qa-setsig
|
||||
./newlisp qa-specific-tests/qa-net
|
||||
./newlisp qa-specific-tests/qa-net6
|
||||
./newlisp qa-specific-tests/qa-cilk
|
||||
./newlisp qa-specific-tests/qa-ref
|
||||
./newlisp qa-specific-tests/qa-message
|
||||
./newlisp qa-specific-tests/qa-win-dll
|
||||
./newlisp qa-specific-tests/qa-blockmemory
|
||||
./newlisp qa-specific-tests/qa-exception
|
||||
./newlisp qa-specific-tests/qa-float
|
||||
./newlisp qa-specific-tests/qa-foop
|
||||
./newlisp qa-specific-tests/qa-local-domain
|
||||
./newlisp qa-specific-tests/qa-inplace
|
||||
# ./newlisp qa-specific-tests/qa-utf16path
|
||||
./newlisp qa-specific-tests/qa-pipefork
|
||||
./newlisp qa-specific-tests/qa-libffi
|
||||
./newlisp qa-specific-tests/qa-bigint 10000
|
||||
./newlisp qa-specific-tests/qa-longnum
|
||||
./newlisp qa-specific-tests/qa-factorfibo 60
|
||||
./newlisp qa-specific-tests/qa-bench
|
||||
|
||||
testall:
|
||||
make checkall | grep '>>>'
|
||||
|
||||
# benchmark
|
||||
bench:
|
||||
./newlisp qa-specific-tests/qa-bench
|
||||
|
||||
# install
|
||||
|
||||
# makefile_install normally is created by the configure script
|
||||
# but when using 'make -f makefile_xxx' the file hasn't been
|
||||
# created and is created with this dependency
|
||||
|
||||
makefile_install:
|
||||
cp makefile_original_install makefile_install
|
||||
|
||||
install: makefile_install
|
||||
-make -f makefile_install install
|
||||
|
||||
uninstall:
|
||||
-make -f makefile_install uninstall
|
||||
|
||||
install_home:
|
||||
-make -f makefile_install install_home
|
||||
|
||||
uninstall_home:
|
||||
-make -f makefile_install uninstall_home
|
||||
|
||||
# This makes the main newlisp-x.x.x.tgz source distribuition package
|
||||
dist: clean
|
||||
-mkdir newlisp-$(VERSION)
|
||||
-mkdir newlisp-$(VERSION)/guiserver
|
||||
-mkdir newlisp-$(VERSION)/guiserver/images
|
||||
-mkdir newlisp-$(VERSION)/guiserver/java
|
||||
-mkdir newlisp-$(VERSION)/modules
|
||||
-mkdir newlisp-$(VERSION)/examples
|
||||
-mkdir newlisp-$(VERSION)/doc
|
||||
-mkdir newlisp-$(VERSION)/util
|
||||
-mkdir newlisp-$(VERSION)/qa-specific-tests
|
||||
-mkdir newlisp-$(VERSION)/newlisp-js
|
||||
cp README newlisp-$(VERSION)
|
||||
cp nl*.c newlisp.c *.h pcre*.c index.cgi newlisp-$(VERSION)
|
||||
cp win64-dll.def win-*.* unix*.c newlisp-$(VERSION)
|
||||
cp Makefile configure* makefile* qa-dot qa-comma newlisp-$(VERSION)
|
||||
cp modules/* newlisp-$(VERSION)/modules
|
||||
cp examples/* newlisp-$(VERSION)/examples
|
||||
cp doc/* newlisp-$(VERSION)/doc
|
||||
cp util/* newlisp-$(VERSION)/util
|
||||
cp qa-specific-tests/* newlisp-$(VERSION)/qa-specific-tests
|
||||
cp -R guiserver/* newlisp-$(VERSION)/guiserver
|
||||
cp -R newlisp-js/* newlisp-$(VERSION)/newlisp-js
|
||||
tar czvf newlisp-$(VERSION).tgz newlisp-$(VERSION)/*
|
||||
rm -rf newlisp-$(VERSION)
|
||||
mv newlisp-$(VERSION).tgz ..
|
||||
|
||||
|
||||
# this makes a Android source package for compilation using the Android NDK
|
||||
# may want to change APP_PLATFORM spec to something different
|
||||
android_dist_utf8:
|
||||
-mkdir newlisp-ndk-utf8-$(VERSION)
|
||||
-mkdir newlisp-ndk-utf8-$(VERSION)/jni
|
||||
-mkdir newlisp-ndk-utf8-$(VERSION)/libs
|
||||
-mkdir newlisp-ndk-utf8-$(VERSION)/libs/armeabi
|
||||
-mkdir newlisp-ndk-utf8-$(VERSION)/obj
|
||||
-mkdir newlisp-ndk-utf8-$(VERSION)/obj/local
|
||||
-mkdir newlisp-ndk-utf8-$(VERSION)/obj/local/armeabi
|
||||
cp nl*.c newlisp.c *.h pcre*.c newlisp-ndk-utf8-$(VERSION)/jni
|
||||
rm newlisp-ndk-utf8-$(VERSION)/jni/win-ffi.h
|
||||
cp doc/Android.html newlisp-ndk-utf8-$(VERSION)
|
||||
cp util/Android-utf8.mk newlisp-ndk-utf8-$(VERSION)/jni/Android.mk
|
||||
cp util/Application.mk newlisp-ndk-utf8-$(VERSION)/jni
|
||||
tar czvf newlisp-ndk-utf8-$(VERSION).tgz newlisp-ndk-utf8-$(VERSION)/*
|
||||
rm -rf newlisp-ndk-utf8-$(VERSION)
|
||||
mv newlisp-ndk-utf8-$(VERSION).tgz ..
|
||||
|
||||
android_dist:
|
||||
-mkdir newlisp-ndk-$(VERSION)
|
||||
-mkdir newlisp-ndk-$(VERSION)/jni
|
||||
-mkdir newlisp-ndk-$(VERSION)/libs
|
||||
-mkdir newlisp-ndk-$(VERSION)/libs/armeabi
|
||||
-mkdir newlisp-ndk-$(VERSION)/obj
|
||||
-mkdir newlisp-ndk-$(VERSION)/obj/local
|
||||
-mkdir newlisp-ndk-$(VERSION)/obj/local/armeabi
|
||||
cp nl*.c newlisp.c *.h pcre*.c newlisp-ndk-$(VERSION)/jni
|
||||
rm newlisp-ndk-$(VERSION)/jni/win-ffi.h
|
||||
rm newlisp-ndk-$(VERSION)/jni/nl-utf8.c
|
||||
cp doc/Android.html newlisp-ndk-$(VERSION)
|
||||
cp util/Android.mk newlisp-ndk-$(VERSION)/jni
|
||||
cp util/Application.mk newlisp-ndk-$(VERSION)/jni
|
||||
tar czvf newlisp-ndk-$(VERSION).tgz newlisp-ndk-$(VERSION)/*
|
||||
rm -rf newlisp-ndk-$(VERSION)
|
||||
mv newlisp-ndk-$(VERSION).tgz ..
|
||||
|
||||
# this changes to the current version number in several files
|
||||
#
|
||||
# before doing a 'make version' the VERSION variable at the beginning
|
||||
# of this file has to be changed to the new number
|
||||
#
|
||||
version:
|
||||
sed -i.bak -E 's/int version = .+;/int version = $(INT_VERSION);/' newlisp.c
|
||||
sed -i.bak -E 's/newLISP v.[[:digit:]]+.[[:digit:]]+.[[:digit:]]+(-dev)? /newLISP v.$(VERSION) /' newlisp.c
|
||||
sed -i.bak -E 's/newLISP\/[[:digit:]]+.[[:digit:]]+.[[:digit:]]+(-dev)?/newLISP\/$(VERSION)/' nl-web.c
|
||||
sed -i.bak -E 's/newLISP v.+ Manual/newLISP v.$(VERSION) Manual/' doc/newlisp_manual.html
|
||||
sed -i.bak -E 's/Reference v.+<\/h2>/Reference v.$(VERSION)<\/h2>/' doc/newlisp_manual.html
|
||||
sed -i.bak -E 's/newlisp-.....-win/newlisp-$(INT_VERSION)-win/' guiserver/newlisp-gs.nsi
|
||||
sed -i.bak -E 's/and newLISP .+ on /and newLISP $(VERSION) on /' guiserver/newlisp-gs.nsi
|
||||
sed -i.bak -E 's/newlisp-.....-win/newlisp-$(INT_VERSION)-win/' guiserver/newlisp64-gs.nsi
|
||||
sed -i.bak -E 's/and newLISP .+ on /and newLISP $(VERSION) on /' guiserver/newlisp64-gs.nsi
|
||||
sed -i.bak -E 's/VERSION=.+/VERSION=$(VERSION)/' configure-alt
|
||||
sed -i.bak -E 's/VERSION=.+/VERSION=$(VERSION)/' makefile_original_install
|
||||
sed -i.bak -E 's/VERSION=.+/VERSION=$(VERSION)/' makefile_darwin_package
|
||||
sed -i.bak -E 's/VERSION=.+/VERSION=$(VERSION)/' makefile_wings
|
||||
sed -i.bak -E 's/VERSION=.+/VERSION=$(VERSION)/' makefile_wings64
|
||||
|
||||
# Prepare the manual file for PDF conversion, by replaceing all <span class="function"></span>
|
||||
# with <font color="#DD0000"></font> in the syntax statements and replacing → (one line
|
||||
# arrow with ⇒ (double line arrow). This is necessary when using OpenOffcice PDF conversion
|
||||
#
|
||||
preparepdf:
|
||||
util/preparepdf doc/newlisp_manual.html doc/newlisp_manual_preparepdf.html
|
||||
|
||||
# end of file
|
129
README
Normal file
|
@ -0,0 +1,129 @@
|
|||
newLISP version 10.x.x for LINUX, FreeBSD, Mac OSX Solaris and Win32
|
||||
===================================================================
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
------------
|
||||
newLISP(tm) is LISP like scripting language for general programming
|
||||
artificial intelligence and statistics.
|
||||
|
||||
For more details about newLISP see the Users Manual and Reference in the
|
||||
distribution file: 'doc/newlisp_manual.html'
|
||||
|
||||
Code contributions, bug fixes, reports and comments are welcome. New
|
||||
versions are available at:
|
||||
|
||||
http://newlisp.org
|
||||
or
|
||||
http://newlisp.org/downloads
|
||||
or
|
||||
http://sourceforge.net/projects/newlisp
|
||||
|
||||
See the file doc/CHANGES in the source distribtion for changes over
|
||||
previous versions or
|
||||
|
||||
http://newlisp.org/downloads/newLISP_xx_Release_Notes.html
|
||||
|
||||
New versions in development are available at:
|
||||
|
||||
http://newlisp.org/downloads/development
|
||||
|
||||
Please contact me via email at: lutz@nuevatec.com.
|
||||
|
||||
Some of the information in this file is expanded in file newlisp-x.x.x/doc/INSTALL.
|
||||
|
||||
|
||||
BUILD, CHECK and INSTALL
|
||||
------------------------
|
||||
|
||||
Normally the correct makefile_xxxxx will be picked automatically just typing:
|
||||
|
||||
make
|
||||
|
||||
to discover the current platform and make for Linux, MacOSX, FreeBSD, OpenBSD,
|
||||
NetBSD, Solaris/SunOS and Win32 (MinGW on MSYS). Sometimes the makefile_xxxxx
|
||||
must be specified explicitely, e.g. when compiling for the RaspberryPi runnning
|
||||
a sub-flavor of Linux and cross-compiled on a desktop system:
|
||||
|
||||
make -f makefile_raspberrypi
|
||||
|
||||
Any other makefile_xxxxx can be picked the same way, but always read the
|
||||
makefile_xxxxx first, sometimes it contains special instructions!
|
||||
|
||||
To test the compiled newlisp executable do:
|
||||
|
||||
make check
|
||||
|
||||
or showing only success or failure:
|
||||
|
||||
make testall
|
||||
|
||||
From a user account if the sudo command and admin password is available:
|
||||
|
||||
sudo make install
|
||||
|
||||
If root permissions are not available:
|
||||
|
||||
make install_home
|
||||
|
||||
home_install does not install the newLISP-GS Java based IDE, but installs
|
||||
the supportig documentation.
|
||||
|
||||
see all flavors and platforms available for install:
|
||||
|
||||
make help
|
||||
|
||||
will list all available platforms and flavors, newLISP can also be made as
|
||||
a shared, dhynamic library: newlisp.so, newlisp.dylib or newlisp.dll
|
||||
|
||||
To discover the platform in an extra step do:
|
||||
|
||||
./configure
|
||||
|
||||
make
|
||||
|
||||
this discovers the platform and generates a makefile_build which
|
||||
is used subsequently by make. As an alternative use:
|
||||
|
||||
./configure-alt
|
||||
|
||||
make
|
||||
|
||||
this does a more elaborate analysys of options supported on a specific
|
||||
platform and custom makes a makefile_build.
|
||||
|
||||
See the files doc/INSTALL, doc/LOCALIZATION and doc/FILES for more
|
||||
detailed information.
|
||||
|
||||
MINIMUM INSTALL
|
||||
---------------
|
||||
Note that for a minumum install only the executable newlisp or newlisp.exe
|
||||
in Win32 is necessary.
|
||||
|
||||
On Mac OS X or other UNIX copy newlisp to /usr/local/bin or /usr/bin or ~/bin
|
||||
and give it executable permissions.
|
||||
|
||||
|
||||
LICENSE
|
||||
-------
|
||||
newLISP and Nuevatec are trademarks of Lutz Mueller. Files in the newLISP
|
||||
distribution are protected by the "GNU General Public License Version 3, June 2007".
|
||||
For the full text of this license see the accompanying file COPYING in the doc
|
||||
directory, or the appendix in the file newlisp_manual.html. Documentation files
|
||||
are protected by the "GNU Free Doumentation License Version 1.2, November 2002".
|
||||
A copy of this license is also included in the file COPYING.
|
||||
|
||||
This and information about lcensing from other contributors to newLISP is
|
||||
contained in the file COPYING in the source distribution.
|
||||
|
||||
|
||||
MORE INFO AND CONTACT
|
||||
---------------------
|
||||
See in the doc/ directory of the source distribution
|
||||
|
||||
lutz@nuevatec.com
|
||||
|
||||
last edit February 2013
|
||||
|
||||
+++
|
||||
|
144
configure
vendored
Executable file
|
@ -0,0 +1,144 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Only LP64, LLP64 and ILP32 memory models are supported
|
||||
echo
|
||||
echo "removing old objects and setting correct permissions ..."
|
||||
make clean > /dev/null
|
||||
cp makefile_original_install makefile_install
|
||||
echo "discovering platform and default memory model ..."
|
||||
echo
|
||||
|
||||
case `uname` in
|
||||
Darwin) true ${os_type:=MAC_OSX} ;;
|
||||
Linux) true ${os_type:=LINUX} ;;
|
||||
FreeBSD) true ${os_type:=_BSD} ;;
|
||||
NetBSD) true ${os_type:=_BSD} ;;
|
||||
OpenBSD) true ${os_type:=_BSD} ;;
|
||||
SunOS) true ${os_type:=SUNOS} ;;
|
||||
AIX) true ${os_type:=AIX} ;;
|
||||
OSF1) true ${os_type:=TRU64} ;;
|
||||
MINGW32_*) true ${os_type:=WINDOWS} ;;
|
||||
MINGW64_*) true ${os_type:=WINDOWS} ;;
|
||||
CYGWIN*) true ${os_type:=CYGWIN} ;;
|
||||
OS/2) true ${os_type:=OS2} ;;
|
||||
*)
|
||||
echo Could not discover your OS platform use one of the following commands:
|
||||
make help
|
||||
;;
|
||||
esac
|
||||
|
||||
cat > test-memorymodel.c <<EOF
|
||||
/* test-memorymodel.c Ted Walther <ted@reactor-core.org>
|
||||
*
|
||||
* return a string with the type of memory model the current compiler is using.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char** argv) {
|
||||
short sc = sizeof(char) * 8;
|
||||
short ss = sizeof(short) * 8;
|
||||
short si = sizeof(int) * 8;
|
||||
short sl = sizeof(long) * 8;
|
||||
short sp = sizeof(void*) * 8;
|
||||
|
||||
if (si == 32 && sl == 64 && sp == 64) { printf("LP64\n"); return 0; }
|
||||
if (si == 64 && sl == 64 && sp == 64) { printf("ILP64\n"); return 0; }
|
||||
if (si == 32 && sl == 32 && sp == 64) { printf("LLP64\n"); return 0; }
|
||||
if (si == 32 && sl == 32 && sp == 32) { printf("ILP32\n"); return 0; }
|
||||
if (si == 16 && sl == 32 && sp == 32) { printf("LP32\n"); return 0; }
|
||||
printf("UNKNOWN\n"); return 1;
|
||||
}
|
||||
EOF
|
||||
|
||||
if [ `which gcc` ] ; then
|
||||
gcc test-memorymodel.c -o test-memorymodel >/dev/null
|
||||
else
|
||||
cc test-memorymodel.c -o test-memorymodel >/dev/null
|
||||
fi
|
||||
|
||||
true ${memory_model:=`./test-memorymodel`}
|
||||
|
||||
# clean up
|
||||
rm -f test-memorymodel*
|
||||
|
||||
echo "detected memory model ${memory_model}"
|
||||
echo "detected Operating System ${os_type}"
|
||||
echo "creating makefile_build ..."
|
||||
echo
|
||||
|
||||
if [ ${os_type} = MAC_OSX ] ; then
|
||||
cp makefile_darwinLP64_utf8_ffi makefile_build
|
||||
elif [ ${os_type} = LINUX ] ; then
|
||||
if [ -f /etc/redhat-release ] ; then
|
||||
libffi_version=$(ls -d /usr/lib*/libffi*/include)
|
||||
if [ -z "${libffi_version}" ] ; then
|
||||
libffi_version="/usr/include"
|
||||
fi
|
||||
if [ ${memory_model} = LP64 ] ; then
|
||||
sed "s,LIBFFI_VERSION,${libffi_version},g" makefile_linuxLP64_redhat_utf8_ffi > makefile_build
|
||||
else
|
||||
sed "s,LIBFFI_VERSION,${libffi_version},g" makefile_linux_redhat_utf8_ffi > makefile_build
|
||||
fi
|
||||
else
|
||||
if [ ${memory_model} = LP64 ] ; then
|
||||
cp makefile_linuxLP64_utf8_ffi makefile_build
|
||||
else
|
||||
cp makefile_linux_utf8_ffi makefile_build
|
||||
fi
|
||||
fi
|
||||
elif [ ${os_type} = _BSD ] ; then
|
||||
if [ ${memory_model} = LP64 ] ; then
|
||||
if [ -f /usr/local/include/ffi.h ] ; then
|
||||
cp makefile_bsdLP64_utf8_ffi makefile_build
|
||||
else
|
||||
cp makefile_bsdLP64_utf8 makefile_build
|
||||
fi
|
||||
else
|
||||
cp makefile_bsd_utf8 makefile_build
|
||||
fi
|
||||
elif [ ${os_type} = SUNOS ] ; then
|
||||
if [ ${memory_model} = LP64 ] ; then
|
||||
cp makefile_sunosLP64_uf8 makefile_build
|
||||
else
|
||||
cp makefile_sunos_utf8 makefile_build
|
||||
fi
|
||||
elif [ ${os_type} = AIX ] ; then
|
||||
if [ ${memory_model} = LP64 ] ; then
|
||||
cp makefile_aixLP64_utf8_gcc makefile_build
|
||||
else
|
||||
cp makefile_aix_utf8_gcc makefile_build
|
||||
fi
|
||||
elif [ ${os_type} = TRU64 ] ; then
|
||||
cp makefile_tru64 makefile_build
|
||||
elif [ ${os_type} = WINDOWS ] ; then
|
||||
if [ ${memory_model} = LLP64 ] ; then
|
||||
cp makefile_mingw64_ffi makefile_build
|
||||
else
|
||||
cp makefile_mingw_ffi makefile_build
|
||||
fi
|
||||
elif [ ${os_type} = CYGWIN ] ; then
|
||||
cp makefile_cygwin makefile_build
|
||||
if [ ${memory_model} = LP64 ]; then
|
||||
cp makefile_cygwinLP64 makefile_build
|
||||
else
|
||||
cp makefile_cygwin makefile_build
|
||||
fi
|
||||
elif [ ${os_type} = OS2 ] ; then
|
||||
cp makefile_os2 makefile_build
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ ${os_type} = MAC_OSX ] ; then
|
||||
echo "to make for 64-bit on MAC_OSX type:"
|
||||
else
|
||||
echo "to make for ${memory_model} on ${os_type} type:"
|
||||
fi
|
||||
echo " make"
|
||||
echo "to make for any other system do:"
|
||||
echo " make -f makefile_xxx"
|
||||
echo "where makefile_xxx is one of the preconfigured makefiles"
|
||||
echo
|
||||
|
630
configure-alt
Executable file
|
@ -0,0 +1,630 @@
|
|||
#!/bin/sh
|
||||
|
||||
PACKAGE=newlisp
|
||||
VERSION=10.7.0
|
||||
|
||||
rm -f config.h makefile_build makefile_install
|
||||
|
||||
# this script tries to discover the OS platform and configuration
|
||||
# and then makes newLISP using the appropiate makefile
|
||||
# if this script fails and for other special flavors, like
|
||||
# making shared libraries etc., type:
|
||||
#
|
||||
# make help
|
||||
# to see all options specified in Makefile
|
||||
#
|
||||
# to change $(prefix) edit prefix in Makefile
|
||||
|
||||
# Generate a config.h file with all our different option settings that are set
|
||||
# by #define
|
||||
|
||||
# Now we set the default values for our new Makefile
|
||||
DEFAULT_CC="cc"
|
||||
DARWIN_CC="${DEFAULT_CC}"
|
||||
LINUX_CC="gcc"
|
||||
BSD_CC="${DEFAULT_CC}"
|
||||
SUNOS_CC="gcc"
|
||||
AIX_CC="xlc_r"
|
||||
TRU64_CC="cc"
|
||||
WIN32_CC="gcc"
|
||||
OS2_CC="${DEFAULT_CC}"
|
||||
|
||||
DEFAULT_CFLAGS=" -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c"
|
||||
DARWIN_CFLAGS=" -Wall -Wno-long-long -Wno-strict-aliasing -O2 -c"
|
||||
LINUX_CFLAGS=" -Wall -Wno-long-long -Wno-strict-aliasing -O2 -c"
|
||||
BSD_CFLAGS=" -Wall -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -O2 -c"
|
||||
SUNOS_CFLAGS=" -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -O2 -c"
|
||||
AIX_XLCFLAGS=" -O2 -c"
|
||||
AIX_GCCFLAGS=" -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -O2 -c"
|
||||
TRU64_CFLAGS=" -ieee -pedantic -O3 -c -D_POSIX_PII_SOCKET"
|
||||
WIN32_CFLAGS=" -Wall -Wno-uninitialized -Wno-long-long -O1 -c"
|
||||
OS2_CFLAGS=" -Wall -pedantic -Wno-uninitialized -Wno-long-long -Wno-strict-aliasing -O2 -c -s"
|
||||
|
||||
DEFAULT_LDFLAGS="-lm"
|
||||
DARWIN_LDFLAGS="${DEFAULT_LDFLAGS}"
|
||||
LINUX_LDFLAGS="-lm -ldl"
|
||||
BSD_LDFLAGS="${DEFAULT_LDFLAGS}"
|
||||
SUNOS_LDFLAGS="-lm -ldl -lrt -lsocket -lnsl"
|
||||
AIX_LDFLAGS="-lm -ldl -lrt -lnsl"
|
||||
TRU64_LDFLAGS="-lm -lrt -ldb -lbsd"
|
||||
WIN32_LDFLAGS="-lws2_32"
|
||||
OS2_LDFLAGS="-Zomf -Zmt -lm -ldl"
|
||||
|
||||
DEFAULT_OBJS="newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o \
|
||||
nl-sock.o nl-import.o nl-xml-json.o nl-web.o nl-matrix.o nl-debug.o pcre.o"
|
||||
|
||||
DEFAULT_STRIP="strip"
|
||||
WIN32_STRIP="strip"
|
||||
|
||||
DEFAULT_TARG="newlisp"
|
||||
WIN32_TARG="newlisp.exe"
|
||||
OS2_TARG="newlisp.exe"
|
||||
|
||||
echo
|
||||
case `uname` in
|
||||
Darwin) true ${os_type:=MAC_OSX} ;;
|
||||
Linux) true ${os_type:=LINUX} ;;
|
||||
FreeBSD) true ${os_type:=_BSD} ;;
|
||||
NetBSD) true ${os_type:=_BSD} ;;
|
||||
OpenBSD) true ${os_type:=_BSD} ;;
|
||||
SunOS) true ${os_type:=SUNOS} ;;
|
||||
AIX) true ${os_type:=AIX} ;;
|
||||
OSF1) true ${os_type:=TRU64} ;;
|
||||
MINGW*) true ${os_type:=WINDOWS} ;;
|
||||
OS/2) true ${os_type:=OS2} ;;
|
||||
*)
|
||||
echo Could not discover your OS platform use one of the following commands:
|
||||
make help
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Detected Operating System ${os_type}"
|
||||
|
||||
if [ ${os_type} = MAC_OSX ] ; then
|
||||
DEFAULT_CFLAGS="${DARWIN_CFLAGS}"
|
||||
elif [ ${os_type} = LINUX ] ; then
|
||||
DEFAULT_CFLAGS="${LINUX_CFLAGS}"
|
||||
DEFAULT_LDFLAGS="${LINUX_LDFLAGS}"
|
||||
elif [ ${os_type} = _BSD ] ; then
|
||||
DEFAULT_CFLAGS="${BSD_CFLAGS}"
|
||||
elif [ ${os_type} = SUNOS ] ; then
|
||||
DEFAULT_CFLAGS="${SUNOS_CFLAGS}"
|
||||
DEFAULT_LDFLAGS="${SUNOS_LDFLAGS}"
|
||||
elif [ ${os_type} = AIX ] ; then
|
||||
DEFAULT_CC="${AIX_CC}"
|
||||
DEFAULT_CFLAGS="${AIX_XLCFLAGS}"
|
||||
true ${enable_readline:=no};
|
||||
elif [ ${os_type} = TRU64 ] ; then
|
||||
DEFAULT_CC="${TRU64_CC}"
|
||||
DEFAULT_CFLAGS="${TRU64_CFLAGS}"
|
||||
DEFAULT_LDFLAGS="${TRU64_LDFLAGS}"
|
||||
elif [ ${os_type} = WINDOWS ] ; then
|
||||
DEFAULT_CC="${WIN32_CC}"
|
||||
DEFAULT_CFLAGS="${WIN32_CFLAGS}"
|
||||
DEFAULT_LDFLAGS="${WIN32_LDFLAGS}"
|
||||
DEFAULT_OBJS="${DEFAULT_OBJS} win-util.o win-path.o"
|
||||
DEFAULT_STRIP="${WIN32_STRIP}"
|
||||
DEFAULT_TARG="${WIN32_TARG}"
|
||||
true ${enable_readline:=no};
|
||||
true ${enable_utf8:=no};
|
||||
elif [ ${os_type} = OS2 ] ; then
|
||||
DEFAULT_CFLAGS="${OS2_CFLAGS}"
|
||||
DEFAULT_LDFLAGS="${OS2_LDFLAGS}"
|
||||
DEFAULT_TARG="${OS2_TARG}"
|
||||
true ${enable_readline:=yes};
|
||||
fi
|
||||
|
||||
# Only LP64 and ILP32 memory models are officially supported, but we'll try to
|
||||
# support the others too.
|
||||
cat > test-memorymodel.c <<EOF
|
||||
/* test-memorymodel.c Ted Walther <ted@reactor-core.org>
|
||||
*
|
||||
* return a string with the type of memory model the current compiler is using.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char** argv) {
|
||||
short sc = sizeof(char) * 8;
|
||||
short ss = sizeof(short) * 8;
|
||||
short si = sizeof(int) * 8;
|
||||
short sl = sizeof(long) * 8;
|
||||
short sp = sizeof(void*) * 8;
|
||||
|
||||
if (si == 32 && sl == 64 && sp == 64) { printf("LP64\n"); return 0; }
|
||||
if (si == 64 && sl == 64 && sp == 64) { printf("ILP64\n"); return 0; }
|
||||
if (si == 32 && sl == 32 && sp == 64) { printf("LLP64\n"); return 0; }
|
||||
if (si == 32 && sl == 32 && sp == 32) { printf("ILP32\n"); return 0; }
|
||||
if (si == 16 && sl == 32 && sp == 32) { printf("LP32\n"); return 0; }
|
||||
printf("UNKNOWN\n"); return 1;
|
||||
}
|
||||
EOF
|
||||
${CC:-${DEFAULT_CC}} test-memorymodel.c -o test-memorymodel 2>/dev/null
|
||||
true ${memory_model:=`./test-memorymodel`}
|
||||
echo "Detected memory model `./test-memorymodel`"
|
||||
rm -f test-memorymodel*
|
||||
|
||||
# time_t is 64 bits on modern platforms. Support this.
|
||||
cat > test-time-t.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int
|
||||
main(int argc, char** argv) {
|
||||
short bits = sizeof(time_t) * 8;
|
||||
|
||||
if (bits == 64) { printf("64BIT"); return 0; }
|
||||
if (bits == 32) { printf("32BIT"); return 0; }
|
||||
printf("UNSUPPORTED\n"); return 1;
|
||||
}
|
||||
EOF
|
||||
${CC:-${DEFAULT_CC}} test-time-t.c -o test-time-t 2>/dev/null
|
||||
true ${time_t_size:=`./test-time-t`}
|
||||
echo "Detected time_t size `./test-time-t`"
|
||||
rm -f test-time-t*
|
||||
|
||||
# If we can't compile with readline, and the environment variables don't
|
||||
# specify otherwise, we will disable it.
|
||||
cat > test-readline.c <<EOF
|
||||
/* test-readline.c Fri Jul 10 14:57:33 PDT 2009 Ted Walther <ted@reactor-core.org>
|
||||
*
|
||||
* code for testing the compiler options to use for libreadline
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
char **
|
||||
test_completion (char * text, int start, int end) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv) {
|
||||
|
||||
rl_readline_name = "test";
|
||||
rl_attempted_completion_function = (CPPFunction *)test_completion;
|
||||
readline(NULL);
|
||||
add_history("test");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
for cclibreadline in "-lreadline" "-lreadline -lncurses" "-lreadline -ltermcap" "-lreadline -lterminfo"; do
|
||||
if ${CC:-${DEFAULT_CC}} test-readline.c ${cclibreadline} -o test-readline 2>/dev/null ; then
|
||||
true ${enable_readline:=yes};
|
||||
DEFAULT_RLFLAGS="${cclibreadline}";
|
||||
echo "Detected readline flags: ${cclibreadline}";
|
||||
break;
|
||||
fi
|
||||
done
|
||||
true ${enable_readline:=no};
|
||||
rm -f test-readline*
|
||||
|
||||
# If we can't compile with ffi, and the environment variables don't
|
||||
# specify otherwise, we will disable it.
|
||||
cat > test-ffi.c <<EOF
|
||||
/* test-ffi.c Fri Jul 10 14:57:33 PDT 2009 Ted Walther <ted@reactor-core.org>
|
||||
*
|
||||
* code for testing the compiler options to use for libffi
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ffi.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
ffi_cif cif;
|
||||
ffi_type *args[1];
|
||||
void *values[1];
|
||||
char *s;
|
||||
int rc;
|
||||
|
||||
args[0] = &ffi_type_pointer;
|
||||
values[0] = &s;
|
||||
|
||||
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
||||
&ffi_type_uint, args) == FFI_OK)
|
||||
{
|
||||
s = "Hello World!";
|
||||
ffi_call(&cif, puts, &rc, values);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
for cclibffi in "-lffi"; do
|
||||
if ${CC:-${DEFAULT_CC}} test-ffi.c ${DEFAULT_LDFLAGS} ${cclibffi} -o test-ffi 2>/dev/null ; then
|
||||
true ${enable_ffi:=yes};
|
||||
DEFAULT_FFIFLAGS="${cclibffi}";
|
||||
echo "Detected ffi flags: ${cclibffi}";
|
||||
break;
|
||||
fi
|
||||
done
|
||||
true ${enable_ffi:=no};
|
||||
rm -f test-ffi*
|
||||
|
||||
# Safe defaults;
|
||||
true ${enable_utf8:=yes};
|
||||
|
||||
# Default values to control how the Makefile is generated
|
||||
true ${enable_static:=no};
|
||||
true ${enable_debug:=no};
|
||||
|
||||
for nlc_arg in "$@"; do
|
||||
if test -n "$nlc_prev"; then
|
||||
eval "$nlc_prev=\$nlc_arg"
|
||||
nlc_prev=
|
||||
continue
|
||||
fi
|
||||
case "${nlc_arg}" in
|
||||
--*=*) nlc_optarg=`echo "$nlc_arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) nlc_optarg= ;;
|
||||
esac
|
||||
case "${nlc_arg}" in
|
||||
--enable-utf8) enable_utf8=yes; ;;
|
||||
--disable-utf8) enable_utf8=no; ;;
|
||||
--enable-readline) enable_readline=yes; ;;
|
||||
--disable-readline) enable_readline=no; ;;
|
||||
--enable-ffi) enable_ffi=yes; ;;
|
||||
--disable-ffi) enable_ffi=no; ;;
|
||||
--enable-static) enable_static=yes; ;;
|
||||
--disable-static) enable_static=no; ;;
|
||||
--enable-debug) enable_debug=yes; ;;
|
||||
--disable-debug) enable_debug=no; ;;
|
||||
--LP64) memory_model=LP64; ;;
|
||||
--ILP64) memory_model=ILP64; ;;
|
||||
--LLP64) memory_model=LLP64; ;;
|
||||
--LP32) memory_model=LP32; ;;
|
||||
--ILP32) memory_model=ILP32; ;;
|
||||
--prefix) nlc_prev=prefix ;;
|
||||
--prefix=*) prefix="$nlc_optarg" ;;
|
||||
--exec-prefix) nlc_prev=exec_prefix ;;
|
||||
--exec-prefix=*) exec_prefix="$nlc_optarg" ;;
|
||||
--bindir) nlc_prev=bindir ;;
|
||||
--bindir=*) bindir="$nlc_optarg" ;;
|
||||
--mandir) nlc_prev=mandir ;;
|
||||
--mandir=*) mandir="$nlc_optarg" ;;
|
||||
--man1dir) nlc_prev=man1dir ;;
|
||||
--man1dir=*) man1dir="$nlc_optarg" ;;
|
||||
--docdir) nlc_prev=docdir ;;
|
||||
--docdir=*) docdir="$nlc_optarg" ;;
|
||||
--datadir) nlc_prev=datadir ;;
|
||||
--datadir=*) datadir="$nlc_optarg" ;;
|
||||
--help) cat <<EOF
|
||||
Usage: ./configure-alt [options]
|
||||
--help # Show this help message.
|
||||
|
||||
--prefix=dir # standard GNU option
|
||||
--exec-prefix=dir # standard GNU option
|
||||
--bindir=dir # standard GNU option
|
||||
--datadir=dir # standard GNU option
|
||||
--docdir=dir # standard GNU option
|
||||
--mandir=dir # standard GNU option
|
||||
--man1dir=dir # standard GNU option
|
||||
|
||||
--enable-utf8 # (default) Enable UTF8 support
|
||||
--disable-utf8 # Disable UTF8 support
|
||||
--enable-readline # (default) Enable readline support
|
||||
--disable-readline # Disable readline support
|
||||
--enable-ffi # (default) Enable foreign function interface
|
||||
--disable-ffi # Disable foreign function interface
|
||||
--enable-static # Link newlisp statically, suitable for use in chroot jails
|
||||
--disable-static # (default) Link newlisp dynamically
|
||||
--enable-debug # Include debugging information in the newlisp binary
|
||||
--disable-debug # (default) Compile without debugging information
|
||||
--LP64 # Use LP64 memory model, overriding auto-detection
|
||||
--ILP64 # Use ILP64 memory model, overriding auto-detection
|
||||
--LLP64 # Use LLP64 memory model, overriding auto-detection
|
||||
--LP32 # Use LP32 memory model, overriding auto-detection
|
||||
--ILP32 # Use ILP32 memory model, overriding auto-detection
|
||||
EOF
|
||||
exit; ;;
|
||||
*) echo "Unrecognized option, ignoring: ${arg}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$prefix" ] ; then prefix="/usr/local"; fi
|
||||
if [ -z "$exec_prefix" ] ; then exec_prefix="$prefix"; fi
|
||||
if [ -z "$bindir" ] ; then bindir="${exec_prefix}/bin"; fi
|
||||
if [ -z "$datarootdir" ] ; then datarootdir="${prefix}/share"; fi
|
||||
if [ -z "$datadir" ] ; then datadir="${datarootdir}"; fi
|
||||
if [ -z "$docdir" ] ; then docdir="${datarootdir}/doc/${PACKAGE}"; fi
|
||||
if [ -z "$mandir" ] ; then mandir="${prefix}/man"; fi
|
||||
if [ -z "$man1dir" ] ; then man1dir="${mandir}/man1"; fi
|
||||
if [ -z "$pkgdatadir" ] ; then pkgdatadir="${datadir}/${PACKAGE}-${VERSION}"; fi
|
||||
|
||||
cat >> config.h <<EOF
|
||||
/* This file was generated automatically by ./configure-alt */
|
||||
|
||||
#define NEWLISPDIR "${pkgdatadir}"
|
||||
|
||||
EOF
|
||||
|
||||
cat >> config.h <<EOF
|
||||
/* Operating System Type */
|
||||
#define ${os_type}
|
||||
|
||||
/* Memory model for the platform */
|
||||
#define MEMORY_MODEL_${memory_model}
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
if [ $memory_model = LP64 ] ; then
|
||||
cat >> config.h <<EOF
|
||||
/* This platform is using the LP64 memory model. Adding legacy #define */
|
||||
#define NEWLISP64
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ $time_t_size = 64BIT ] ; then
|
||||
cat >> config.h <<EOF
|
||||
/* Large values of time_t are supported. */
|
||||
#define TIME_T_64
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ $enable_utf8 = yes ] ; then
|
||||
DEFAULT_OBJS="${DEFAULT_OBJS} nl-utf8.o"
|
||||
cat >> config.h <<EOF
|
||||
/* UTF8 support was chosen */
|
||||
#define SUPPORT_UTF8
|
||||
|
||||
EOF
|
||||
echo "UTF-8 is enabled"
|
||||
fi
|
||||
|
||||
if [ $enable_readline = yes ] ; then
|
||||
cat >> config.h <<EOF
|
||||
/* READLINE support was chosen */
|
||||
#define READLINE
|
||||
|
||||
EOF
|
||||
echo "readline support is enabled"
|
||||
else
|
||||
DEFAULT_RLFLAGS=""
|
||||
cat <<EOF
|
||||
readline support is disabled
|
||||
|
||||
To enable readline support, use the --enable-readline option, and specify the
|
||||
proper libraries to link by setting the RLFLAGS variable when running
|
||||
configure. Also if necessary, use the INCLUDES variable to specify where the
|
||||
readline header files are.
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ $enable_ffi = yes ] ; then
|
||||
cat >> config.h <<EOF
|
||||
/* FFI support was chosen */
|
||||
#define FFI
|
||||
|
||||
EOF
|
||||
echo "ffi support is enabled"
|
||||
else
|
||||
cat <<EOF
|
||||
ffi support is disabled
|
||||
|
||||
To enable ffi support, use the --enable-ffi option, and specify the proper
|
||||
libraries to link by setting the FFIFLAGS variable when running configure.
|
||||
Also if necessary, use the INCLUDES variable to specify where the ffi header
|
||||
files are.
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "/* EOF */" >> config.h
|
||||
|
||||
if [ $enable_static = yes ] ; then
|
||||
DEFAULT_LDFLAGS="${DEFAULT_LDFLAGS} -static"
|
||||
echo "Static linking enabled"
|
||||
fi
|
||||
|
||||
if [ $enable_debug = yes ] ; then
|
||||
DEFAULT_CFLAGS="${DEFAULT_CFLAGS} -g"
|
||||
DEFAULT_LDFLAGS="${DEFAULT_LDFLAGS} -g"
|
||||
echo "Debugging enabled"
|
||||
fi
|
||||
|
||||
cat >test-archflag.c <<EOF
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char** argv) {
|
||||
printf("Hello World.\n");
|
||||
}
|
||||
EOF
|
||||
|
||||
DEFAULT_ARCHFLAGS=""
|
||||
if [ $memory_model = LP64 ] ; then
|
||||
if [ $os_type = AIX -a ${CC:-${DEFAULT_CC}} = xlc_r ] ; then
|
||||
DEFAULT_ARCHFLAGS="-q64"
|
||||
elif [ $os_type = AIX -a ${CC:-${DEFAULT_CC}} = gcc ] ; then
|
||||
DEFAULT_ARCHFLAGS="-maix64"
|
||||
else
|
||||
if ${CC:-${DEFAULT_CC}} -m64 -o test-archflag test-archflag.c 2>/dev/null; then
|
||||
DEFAULT_ARCHFLAGS="-m64"
|
||||
fi
|
||||
fi
|
||||
elif [ $memory_model = ILP32 ] ; then
|
||||
if ${CC:-${DEFAULT_CC}} -m32 -o test-archflag test-archflag.c 2>/dev/null; then
|
||||
DEFAULT_ARCHFLAGS="-m32"
|
||||
fi
|
||||
fi
|
||||
rm -f test-archflag*
|
||||
|
||||
STRIPBINARY=" \$(STRIP) \$(TARG)"
|
||||
LINKSTAGE=" \$(CC) \$(OBJS) \$(ARCHFLAGS) \$(LDFLAGS) \$(RLFLAGS) \$(FFIFLAGS) -o \$(TARG)"
|
||||
COMPILEOBJS=" \$(CC) \$(ARCHFLAGS) \$(CFLAGS) -DNEWCONFIG $<"
|
||||
|
||||
if [ $os_type = OS2 ] ; then
|
||||
STRIPBINARY=""
|
||||
elif [ $os_type = AIX -a $memory_model = LP64 ] ; then
|
||||
LINKSTAGE=" OBJECT_MODE=64 \$(CC) \$(OBJS) \$(ARCHFLAGS) \$(LDFLAGS) \$(RLFLAGS) \$(FFIFLAGS) -o \$(TARG)"
|
||||
fi
|
||||
|
||||
# Now let us make the Makefile (makefile_build)
|
||||
cat > makefile_build <<EOF
|
||||
# makefile for newLISP v. 10.1.x generated by the configure script (configure-alt)
|
||||
CC = ${CC:-${DEFAULT_CC}}
|
||||
CFLAGS = ${CFLAGS:-${DEFAULT_CFLAGS}} ${INCLUDES}
|
||||
LDFLAGS = ${LDFLAGS:-${DEFAULT_LDFLAGS}}
|
||||
OBJS = ${OBJS:-${DEFAULT_OBJS}}
|
||||
STRIP = ${STRIP:-${DEFAULT_STRIP}}
|
||||
TARG = ${TARG:-${DEFAULT_TARG}}
|
||||
RLFLAGS = ${RLFLAGS:-${DEFAULT_RLFLAGS}}
|
||||
FFIFLAGS = ${FFIFLAGS:-${DEFAULT_FFIFLAGS}}
|
||||
ARCHFLAGS = ${ARCHFLAGS:-${DEFAULT_ARCHFLAGS}}
|
||||
|
||||
default: \$(OBJS)
|
||||
${LINKSTAGE}
|
||||
${STRIPBINARY}
|
||||
|
||||
.c.o:
|
||||
${COMPILEOBJS}
|
||||
|
||||
\$(OBJS): primes.h protos.h config.h makefile_build
|
||||
EOF
|
||||
|
||||
cat > makefile_install <<EOF
|
||||
# This file was generated automatically by ./configure-alt
|
||||
|
||||
package=${PACKAGE}
|
||||
version=${VERSION}
|
||||
prefix=\$(DESTDIR)${prefix}
|
||||
exec_prefix=\$(DESTDIR)${exec_prefix}
|
||||
bindir=\$(DESTDIR)${bindir}
|
||||
datarootdir=\$(DESTDIR)${datarootdir}
|
||||
datadir=\$(DESTDIR)${datadir}
|
||||
pkgdatadir=\$(DESTDIR)${pkgdatadir}
|
||||
docdir=\$(DESTDIR)${docdir}
|
||||
mandir=\$(DESTDIR)${mandir}
|
||||
man1dir=\$(DESTDIR)${man1dir}
|
||||
|
||||
install:
|
||||
-install -d \$(pkgdatadir)
|
||||
-install -d \$(pkgdatadir)/modules
|
||||
-install -d \$(pkgdatadir)/util
|
||||
-install -d \$(docdir)
|
||||
-install -d \$(man1dir)
|
||||
-install -d \$(bindir)
|
||||
-rm -f \$(bindir)/newlisp
|
||||
-install -m 755 newlisp \$(bindir)/\$(package)-\$(version)
|
||||
-cd \$(bindir); ln -s \$(package)-\$(version) newlisp
|
||||
-install -m 755 util/newlispdoc \$(bindir)/newlispdoc
|
||||
-install -m 644 util/syntax.cgi \$(pkgdatadir)/util/syntax.cgi
|
||||
-install -m 644 util/newlisp.vim \$(pkgdatadir)/util/newlisp.vim
|
||||
-install -m 644 doc/COPYING \$(docdir)/COPYING
|
||||
-install -m 644 doc/CREDITS \$(docdir)/CREDITS
|
||||
-install -m 644 doc/newlisp_manual.html \$(docdir)/newlisp_manual.html
|
||||
-install -m 644 doc/newlisp_index.html \$(docdir)/newlisp_index.html
|
||||
-install -m 644 doc/manual_frame.html \$(docdir)/manual_frame.html
|
||||
-install -m 644 doc/CodePatterns.html \$(docdir)/CodePatterns.html
|
||||
-install -m 644 doc/newLISPdoc.html \$(docdir)/newLISPdoc.html
|
||||
-install -m 644 doc/newLISP-${version}-Release.html \$(docdir)/newLISP-${version}-Release.html
|
||||
-install -m 644 doc/newlisp.1 \$(man1dir)/newlisp.1
|
||||
-install -m 644 doc/newlispdoc.1 \$(man1dir)/newlispdoc.1
|
||||
-install -m 644 modules/canvas.lsp \$(pkgdatadir)/modules/canvas.lsp
|
||||
-install -m 644 modules/cgi.lsp \$(pkgdatadir)/modules/cgi.lsp
|
||||
-install -m 644 modules/crypto.lsp \$(pkgdatadir)/modules/crypto.lsp
|
||||
-install -m 644 modules/ftp.lsp \$(pkgdatadir)/modules/ftp.lsp
|
||||
-install -m 644 modules/getopts.lsp \$(pkgdatadir)/modules/getopts.lsp
|
||||
-install -m 644 modules/gsl.lsp \$(pkgdatadir)/modules/gsl.lsp
|
||||
-install -m 644 modules/infix.lsp \$(pkgdatadir)/modules/infix.lsp
|
||||
-install -m 644 modules/macro.lsp \$(pkgdatadir)/modules/macro.lsp
|
||||
-install -m 644 modules/mysql.lsp \$(pkgdatadir)/modules/mysql.lsp
|
||||
-install -m 644 modules/odbc.lsp \$(pkgdatadir)/modules/odbc.lsp
|
||||
-install -m 644 modules/plot.lsp \$(pkgdatadir)/modules/plot.lsp
|
||||
-install -m 644 modules/pop3.lsp \$(pkgdatadir)/modules/pop3.lsp
|
||||
-install -m 644 modules/postgres.lsp \$(pkgdatadir)/modules/postgres.lsp
|
||||
-install -m 644 modules/postscript.lsp \$(pkgdatadir)/modules/postscript.lsp
|
||||
-install -m 644 modules/smtp.lsp \$(pkgdatadir)/modules/smtp.lsp
|
||||
-install -m 644 modules/smtpx.lsp \$(pkgdatadir)/modules/smtpx.lsp
|
||||
-install -m 644 modules/sqlite3.lsp \$(pkgdatadir)/modules/sqlite3.lsp
|
||||
-install -m 644 modules/stat.lsp \$(pkgdatadir)/modules/stat.lsp
|
||||
-install -m 644 modules/unix.lsp \$(pkgdatadir)/modules/unix.lsp
|
||||
-install -m 644 modules/xmlrpc-client.lsp \$(pkgdatadir)/modules/xmlrpc-client.lsp
|
||||
-install -m 644 modules/zlib.lsp \$(pkgdatadir)/modules/zlib.lsp
|
||||
# GUI-Server install
|
||||
-install -d \$(pkgdatadir)/guiserver
|
||||
-install -d \$(docdir)/guiserver
|
||||
-install -m 755 guiserver/newlisp-edit.lsp \$(bindir)/newlisp-edit
|
||||
-install -m 644 guiserver/guiserver.jar \$(pkgdatadir)/guiserver.jar
|
||||
-install -m 644 guiserver/guiserver.lsp \$(pkgdatadir)/guiserver.lsp
|
||||
-install -m 644 guiserver/images/newLISP128.png \$(pkgdatadir)/newLISP128.png
|
||||
-install -m 644 guiserver/COPYING \$(docdir)/guiserver/COPYING
|
||||
-install -m 644 guiserver/index.html \$(docdir)/guiserver/index.html
|
||||
-install -m 644 guiserver/guiserver.lsp.html \$(docdir)/guiserver/guiserver.lsp.html
|
||||
-install -m 644 util/newlispdoc.css \$(docdir)/guiserver/newlispdoc.css
|
||||
-install -m 644 guiserver/allfonts-demo.lsp \$(pkgdatadir)/guiserver/allfonts-demo.lsp
|
||||
-install -m 644 guiserver/animation-demo.lsp \$(pkgdatadir)/guiserver/animation-demo.lsp
|
||||
-install -m 644 guiserver/border-layout-demo.lsp \$(pkgdatadir)/guiserver/border-layout-demo.lsp
|
||||
-install -m 644 guiserver/button-demo.lsp \$(pkgdatadir)/guiserver/button-demo.lsp
|
||||
-install -m 644 guiserver/clipboard-demo.lsp \$(pkgdatadir)/guiserver/clipboard-demo.lsp
|
||||
-install -m 644 guiserver/cursor-demo.lsp \$(pkgdatadir)/guiserver/cursor-demo.lsp
|
||||
-install -m 644 guiserver/drag-demo.lsp \$(pkgdatadir)/guiserver/drag-demo.lsp
|
||||
-install -m 644 guiserver/font-demo.lsp \$(pkgdatadir)/guiserver/font-demo.lsp
|
||||
-install -m 644 guiserver/frameless-demo.lsp \$(pkgdatadir)/guiserver/frameless-demo.lsp
|
||||
-install -m 644 guiserver/html-demo.lsp \$(pkgdatadir)/guiserver/html-demo.lsp
|
||||
-install -m 644 guiserver/image-demo.lsp \$(pkgdatadir)/guiserver/image-demo.lsp
|
||||
-install -m 644 guiserver/midi-demo.lsp \$(pkgdatadir)/guiserver/midi-demo.lsp
|
||||
-install -m 644 guiserver/midi2-demo.lsp \$(pkgdatadir)/guiserver/midi2-demo.lsp
|
||||
-install -m 644 guiserver/mouse-demo.lsp \$(pkgdatadir)/guiserver/mouse-demo.lsp
|
||||
-install -m 644 guiserver/move-resize-demo.lsp \$(pkgdatadir)/guiserver/move-resize-demo.lsp
|
||||
-install -m 644 guiserver/pinballs-demo.lsp \$(pkgdatadir)/guiserver/pinballs-demo.lsp
|
||||
-install -m 644 guiserver/properties-demo.lsp \$(pkgdatadir)/guiserver/properties-demo.lsp
|
||||
-install -m 644 guiserver/rotation-demo.lsp \$(pkgdatadir)/guiserver/rotation-demo.lsp
|
||||
-install -m 644 guiserver/shapes-demo.lsp \$(pkgdatadir)/guiserver/shapes-demo.lsp
|
||||
-install -m 644 guiserver/sound-demo.lsp \$(pkgdatadir)/guiserver/sound-demo.lsp
|
||||
-install -m 644 guiserver/stroke-demo.lsp \$(pkgdatadir)/guiserver/stroke-demo.lsp
|
||||
-install -m 644 guiserver/tabs-demo.lsp \$(pkgdatadir)/guiserver/tabs-demo.lsp
|
||||
-install -m 644 guiserver/table-demo.lsp \$(pkgdatadir)/guiserver/table-demo.lsp
|
||||
-install -m 644 guiserver/textfield-demo.lsp \$(pkgdatadir)/guiserver/textfield-demo.lsp
|
||||
-install -m 644 guiserver/textrot-demo.lsp \$(pkgdatadir)/guiserver/textrot-demo.lsp
|
||||
-install -m 644 guiserver/widgets-demo.lsp \$(pkgdatadir)/guiserver/widgets-demo.lsp
|
||||
-install -m 644 guiserver/word-count.lsp \$(pkgdatadir)/guiserver/word-count.lsp
|
||||
-install -m 644 guiserver/uppercase.lsp \$(pkgdatadir)/guiserver/uppercase.lsp
|
||||
|
||||
|
||||
uninstall:
|
||||
-rm \$(bindir)/\$(package)
|
||||
-rm \$(bindir)/\$(package)-\$(version)
|
||||
-rm \$(bindir)/newlispdoc
|
||||
-rm \$(bindir)/newlisp-edit
|
||||
-rm -rf \$(pkgdatadir)
|
||||
-rm -rf \$(docdir)
|
||||
-rm \$(man1dir)/newlisp.1
|
||||
-rm \$(man1dir)/newlispdoc.1
|
||||
|
||||
install_home uninstall_home:
|
||||
@echo "This option is disabled; please use the prefix variables at the configure stage."
|
||||
|
||||
# End of file
|
||||
EOF
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Variables:
|
||||
|
||||
package=${PACKAGE}
|
||||
version=${VERSION}
|
||||
prefix=${prefix}
|
||||
exec_prefix=${exec_prefix}
|
||||
bindir=${bindir}
|
||||
datarootdir=${datarootdir}
|
||||
datadir=${datadir}
|
||||
pkgdatadir=${pkgdatadir}
|
||||
docdir=${docdir}
|
||||
mandir=${mandir}
|
||||
man1dir=${man1dir}
|
||||
|
||||
Type "make" to build your newlisp binary.
|
||||
EOF
|
||||
|
93
doc/ANDROID.txt
Normal file
|
@ -0,0 +1,93 @@
|
|||
Fore the following download: http://www.newlisp.org/code/newlisp-ndk-10.4.5.tgz
|
||||
|
||||
|
||||
From: http://newlispfanclub.alh.net/forum/viewtopic.php?f=2&p=20877&sid=a41fb6a4fd35618d8266d88acb102297#p20877
|
||||
|
||||
by kanen » Fri Dec 21, 2012 7:23 am
|
||||
|
||||
We have it working. It's stable.
|
||||
|
||||
It is missing (semaphore), which requires libraries that do not exist on Android. I'm attaching the full source, hoping Lutz will add everything necessary to make this work as part of the main newlisp download.
|
||||
|
||||
Steps to compile:
|
||||
|
||||
1. Download the android-ndk - http://developer.android.com/tools/sdk/ndk/index.html
|
||||
2. Make sure your environment works (see above documentation) on your platform
|
||||
3. Unpack and put newlisp-ndk in the android-ndk directory
|
||||
4. Compile newlisp
|
||||
|
||||
Code:
|
||||
kanen (~/Code/android-ndk)$ ./ndk-build -C newlisp-ndk/
|
||||
make: Entering directory `/Users/kanen/Code/android-ndk/newlisp-ndk'
|
||||
Compile thumb : newlisp <= newlisp.c
|
||||
Compile thumb : newlisp <= nl-symbol.c
|
||||
Compile thumb : newlisp <= nl-math.c
|
||||
Compile thumb : newlisp <= nl-list.c
|
||||
Compile thumb : newlisp <= nl-liststr.c
|
||||
Compile thumb : newlisp <= nl-string.c
|
||||
Compile thumb : newlisp <= nl-sock.c
|
||||
Compile thumb : newlisp <= nl-import.c
|
||||
Compile thumb : newlisp <= nl-xml.c
|
||||
Compile thumb : newlisp <= nl-web.c
|
||||
Compile thumb : newlisp <= nl-matrix.c
|
||||
Compile thumb : newlisp <= nl-debug.c
|
||||
Compile thumb : newlisp <= pcre.c
|
||||
Compile thumb : newlisp <= nl-filesys.c
|
||||
Executable : newlisp
|
||||
Install : newlisp => libs/armeabi/newlisp
|
||||
make: Leaving directory `/Users/kanen/Code/android-ndk/newlisp-ndk'
|
||||
|
||||
The binary gets put into libs/armeabi/newlisp. From there, you just have to build an Android emulator and you can copy newLisp over to it.
|
||||
|
||||
For that, you need the android-sdk - http://developer.android.com/sdk/index.html
|
||||
|
||||
First, list the targets and find the armeabi version you want to use. I use Target 4, which isn't the most recent, but is the most widely deployed, at API level 15.
|
||||
Code:
|
||||
kanen (~/Code/android-sdk/tools)$ ./android list targets
|
||||
Available Android targets:
|
||||
id: 4 or "Google Inc.:Google APIs:15"
|
||||
Name: Google APIs
|
||||
Type: Add-On
|
||||
Vendor: Google Inc.
|
||||
Revision: 2
|
||||
Description: Android + Google APIs
|
||||
Based on Android 4.0.3 (API level 15)
|
||||
ABIs : armeabi-v7a
|
||||
|
||||
Now, generate an emulator from that target platform:
|
||||
Code:
|
||||
kanen (~/Code/android-sdk/tools)$ ./android create avd -n MyEmulator -t 4
|
||||
|
||||
|
||||
Then, run the emulator:
|
||||
Code:
|
||||
kanen (~/Code/android-sdk/tools)$ ./emulator -avd TrustMe
|
||||
|
||||
Attach a shell to the emulator:
|
||||
Code:
|
||||
kanen (~/Code/android-sdk/platform-tools)$ ./adb shell
|
||||
|
||||
Make sure everything's ok and create a directory for newLisp:
|
||||
Code:
|
||||
# mkdir /data/nl
|
||||
# chmod 777 /data/nl
|
||||
# exit
|
||||
|
||||
|
||||
Copy newLisp to the emulator:
|
||||
Code:
|
||||
./adb push ~/Code/android-ndk/newlisp-ndk/libs/armeabi/newlisp /data/nl
|
||||
|
||||
|
||||
Go back into the shell and run newLisp:
|
||||
Code:
|
||||
kanen (~/Code/android-sdk/platform-tools)$ ./adb shell
|
||||
# cd /data
|
||||
# cd trustpipe
|
||||
# ls
|
||||
newlisp
|
||||
# ./newlisp
|
||||
newLISP v.10.4.5 on Linux IPv4/6, execute 'newlisp -h' for more info.
|
||||
|
||||
>
|
||||
|
97
doc/Android.html
Normal file
|
@ -0,0 +1,97 @@
|
|||
<body style="font-family: Helvetica, Verdanan, Arial, sans-serif;">
|
||||
<h2>Make newLISP for Android Linux</h2>
|
||||
<p>Download the latest version of the newLISP Android source distribution from the
|
||||
<a href="http://www.newlisp.org/index.cgi?page=Downloads"> downloads page</a></p>
|
||||
<p>This package can also be made using the following command from the main distribution directory:</p>
|
||||
<pre>
|
||||
make android_dist
|
||||
# or
|
||||
make android_dist_utf8
|
||||
</pre>
|
||||
<p>This will make a newlisp-ndk-x.x.x.tgz in the parent directory of the distribution directory where x.x.x is the version number.</p>
|
||||
<p>It is missing the <tt>semaphore</tt>, which requires libraries that do not exist on Android. It also does not contain the READLINE compile flavor. UTF8 support can be added by making a source package using <tt>make android_dist_utf8</tt>.</p>
|
||||
|
||||
<p>In order for <tt>share</tt> to work for more than 4072 bytes a <tt>/data/tmp</tt> directory must be created on the Android device. This directory is also required if more than 4072 data are transferred when using the <tt>spawn</tt> function.</p>
|
||||
|
||||
<p>Thanks to <i>Kanen Flowers</i> from <a href="http://www.scruffy.tv/">www.scruffy.tv</a> for doing the adaptation to the Android flavor of Linux and putting together the following instructions:</p>
|
||||
|
||||
<h2>Steps to compile:</h2>
|
||||
<ol>
|
||||
<li>Download the <a href="http://developer.android.com/tools/sdk/ndk/index.html">android-ndk</a></li>
|
||||
<li>Make sure your environment works (see above documentation) on your platform</li>
|
||||
<li>Unpack and put newlisp-ndk in the android-ndk directory</li>
|
||||
<li>Compile newlisp</li>
|
||||
</ol>
|
||||
<pre>
|
||||
kanen (~/Code/android-ndk)$ ./ndk-build -C newlisp-ndk/
|
||||
make: Entering directory `/Users/kanen/Code/android-ndk/newlisp-ndk'
|
||||
Compile thumb : newlisp <= newlisp.c
|
||||
Compile thumb : newlisp <= nl-symbol.c
|
||||
Compile thumb : newlisp <= nl-math.c
|
||||
Compile thumb : newlisp <= nl-list.c
|
||||
Compile thumb : newlisp <= nl-liststr.c
|
||||
Compile thumb : newlisp <= nl-string.c
|
||||
Compile thumb : newlisp <= nl-sock.c
|
||||
Compile thumb : newlisp <= nl-import.c
|
||||
Compile thumb : newlisp <= nl-xml.c
|
||||
Compile thumb : newlisp <= nl-web.c
|
||||
Compile thumb : newlisp <= nl-matrix.c
|
||||
Compile thumb : newlisp <= nl-debug.c
|
||||
Compile thumb : newlisp <= pcre.c
|
||||
Compile thumb : newlisp <= nl-filesys.c
|
||||
Executable : newlisp
|
||||
Install : newlisp => libs/armeabi/newlisp
|
||||
make: Leaving directory `/Users/kanen/Code/android-ndk/newlisp-ndk'
|
||||
</pre>
|
||||
<p>The binary gets put into <tt>libs/armeabi/newlisp</tt>. From there, you just have to build an Android emulator and you can copy newLISP over to it.</p>
|
||||
<p>For that, you need the <a href="http://developer.android.com/sdk/index.html">android-sdk</a>.</p>
|
||||
<p>First, list the targets and find the armeabi version you want to use. I use Target 4, which isn't the most recent, but is the most widely deployed, at API level 15.</p>
|
||||
<pre>
|
||||
kanen (~/Code/android-sdk/tools)$ ./android list targets
|
||||
Available Android targets:
|
||||
id: 4 or "Google Inc.:Google APIs:15"
|
||||
Name: Google APIs
|
||||
Type: Add-On
|
||||
Vendor: Google Inc.
|
||||
Revision: 2
|
||||
Description: Android + Google APIs
|
||||
Based on Android 4.0.3 (API level 15)
|
||||
ABIs : armeabi-v7a
|
||||
</pre>
|
||||
<p>Now, generate an emulator from that target platform:</p>
|
||||
<pre>
|
||||
kanen (~/Code/android-sdk/tools)$ ./android create avd -n MyEmulator -t 4
|
||||
</pre>
|
||||
<p>Then, run the emulator:</p>
|
||||
<pre>
|
||||
kanen (~/Code/android-sdk/tools)$ ./emulator -avd MyEmulator &
|
||||
</pre>
|
||||
<p>Attach a shell to the emulator:</p>
|
||||
<pre>
|
||||
kanen (~/Code/android-sdk/platform-tools)$ ./adb shell
|
||||
</pre>
|
||||
<p>Make sure everything's ok and create a directory for newLisp:</p>
|
||||
<pre>
|
||||
# mkdir /data/nl
|
||||
# chmod 777 /data/nl
|
||||
# exit
|
||||
</pre>
|
||||
<p>Copy newLisp to the emulator:</p>
|
||||
<pre>
|
||||
./adb push ~/Code/android-ndk/newlisp-ndk/libs/armeabi/newlisp /data/nl
|
||||
</pre>
|
||||
<p>Go back into the shell and run newLisp:</p>
|
||||
<pre>
|
||||
kanen (~/Code/android-sdk/platform-tools)$ ./adb shell
|
||||
# cd /data
|
||||
# cd nl
|
||||
# ls
|
||||
newlisp
|
||||
# ./newlisp
|
||||
newLISP v.10.4.5 on Linux IPv4/6, execute 'newlisp -h' for more info.
|
||||
|
||||
>
|
||||
</pre>
|
||||
|
||||
<center>+++</center>
|
||||
</body>
|
7149
doc/CHANGES
Normal file
1147
doc/COPYING
Normal file
173
doc/CREDITS
Normal file
|
@ -0,0 +1,173 @@
|
|||
CREDITS
|
||||
-------
|
||||
|
||||
Over the years many users have contributed to newLISP with suggestions,
|
||||
critiques and code. They were crucial in making newLISP what it is today.
|
||||
I want to thank everybody and encourage them to continue
|
||||
to contribute with code and comments. My special thanks go to
|
||||
(in historical order):
|
||||
|
||||
Steve Adams
|
||||
Did the first CYGWIN port and the new native Win32 ports, suggested many
|
||||
other features and functions found today in newLISP.
|
||||
|
||||
Stellan Borg
|
||||
Some of the string functions where suggested by him, discovered and
|
||||
prompted the fixing of many shortcomings in newLISP, built first
|
||||
commercial product (the knowledge manager SUCCEED tm) based on newLISP.
|
||||
|
||||
Lars Hard
|
||||
Many insights and ideas (where are you?, I want to contact you).
|
||||
|
||||
Ryon Root
|
||||
Set up and maintains the web board for discussing newLISP at
|
||||
http://www.alh.net/newlisp/phpbb/index.php .
|
||||
|
||||
Eddie Rucker
|
||||
His comments, insights and ideas have prompted many changes and additions
|
||||
since the Unix versions of newLISP have appeared in 2001.
|
||||
|
||||
Hans Peter Wickern
|
||||
Many usability suggestions and newlisp-tk.tcl improvements. Hans-Peter
|
||||
also introduced newLISP to many NeoBook and PowerBasic users and has
|
||||
written various DLLs which can be imported by newLISP on the Win32
|
||||
platform: http://hpwsoft.de/anmeldung/html1/newLISP/newLISP.html .
|
||||
|
||||
Nigel Brown
|
||||
Helped making floating point behaviour consistent across platforms,
|
||||
researched the use of setlocale(), triggered bugfixes and changes in
|
||||
math functions and contributed many other suggestions, which
|
||||
helped to improve newLISP.
|
||||
|
||||
Keith Trenton
|
||||
Helped initiating the documentation thread on the discussion board. Since
|
||||
that time many useres have pointed out errors in the documentation and
|
||||
suggested improvements.
|
||||
|
||||
Samuel CoX
|
||||
Pointed out many flaws in the documentation, prompted addition of atan2
|
||||
and contributed code examples.
|
||||
|
||||
Brian Clausing
|
||||
did the first complete pass through the manual taking care not only of
|
||||
spelling and punctuation but also improving style.
|
||||
|
||||
Norman Deppenbroek and Peter van Eerten, http://gtk-server.org
|
||||
both from the GTK-server project helped improving networking functions.
|
||||
Peter's GTK-server is an alternative to Tcl/Tk when doing platform
|
||||
independent GUIs or graphics with newLISP.
|
||||
Norman has contributed many useful newISP command line utilities
|
||||
for the Internet and other usages http://www.nodep.nl/newlisp/.
|
||||
|
||||
David S. de Lis from http://www.geocities.com/excaliborus/
|
||||
contributed the newlisp.vim file for VIM editor syntax highlighting
|
||||
now part of the newLISP source distribution
|
||||
|
||||
Luis Carvalho (Kozure) ported newLISP to the PocketPC running Win CE
|
||||
using Alexander Mamaich's pocket gcc, a port of gcc for ARM cpu based
|
||||
PocketPC, http://mamaich.kasone.com/fr_pocket.htm.
|
||||
|
||||
John Small
|
||||
initiated the advancement of logical programming in newLISP and contributed
|
||||
many scripts showing how to use newLISP macros. He also wrote the popular
|
||||
introduction "newLISP in 21 minutes"
|
||||
|
||||
Greg Ben
|
||||
contributed an account and space on a Sun Sparc workstation for better
|
||||
development and testing on the Sun Solaris platform.
|
||||
|
||||
Lucas Wix
|
||||
developed the first newlisp.jsf syntax file for the Joe editor
|
||||
now part of the newLISP source distribution
|
||||
|
||||
Tim Johnson
|
||||
developed the first syntax file for Emacs.
|
||||
|
||||
John DeSanto, Gordon Fischer, John Flowers, Martin Quiroga (alphabetical order)
|
||||
from Kozoru.com for their ideas and suggestions for improvements and enhancements
|
||||
of the newLISP language and improvements and work-out of the database libraries
|
||||
sqlite.lsp (Flowers) and mysql.lsp (Fischer). In June 2006 Kozoru released
|
||||
http://byoms.com, a distributed application almost entirely built with newLISP.
|
||||
|
||||
Cormullion cormullion@mac.com, http://unbalanced-parentheses.nfshost.com
|
||||
for evangelizing newLISP on the MacOS X platform and publishing many ideas
|
||||
how to use newLISP on that platform and writing the "Introduction to newLISP"
|
||||
|
||||
Michael and Melissa Michaels, http://www.neglook.com
|
||||
for a complete review of the Users Manual and evangelizing efforts for newLISP
|
||||
and other good ideas, i.e. defaults in argument lists: (define (foo x (y 1)) ...)
|
||||
Michael also designed the icons for newLISP-GS in v9.2 and much of the FOOP system
|
||||
released in 9.3 and has released a series of training videos.
|
||||
|
||||
Bob Bae (aka frontera000, http://sparebandwidth.blogspot.com/)
|
||||
bringing many ideas to the advancement of newLISP and actively advocating for
|
||||
newLISP on his and other peoples blogs.
|
||||
|
||||
Jeremy Dunn
|
||||
introduced the idea of default args for several operators i.e. (> x) => (> x 0)
|
||||
and for (>> x) => (>> x 1), (div x) => (div 1 x) ... and suggestions.
|
||||
|
||||
Michael Sabin
|
||||
contributed UTF-16 capable file and directory routines for the Win32 versions.
|
||||
|
||||
Dmitri Cherniak from http://en.feautec.pp.ru/
|
||||
many ideas for the newLISP API and big contributor of newLISP expansion
|
||||
modules.
|
||||
|
||||
Cyril Slobin from http://wagner.pp.ru/~slobin/
|
||||
contributed a new newlisp.vim syntax-highlighing file for the vim editor.
|
||||
|
||||
Kazimir Majorinc from http://kazimirmajorinc.blogspot.com/
|
||||
has contributed many ideas and has helped to make newLISP known through his
|
||||
thoughtful blog posts.
|
||||
|
||||
Jeff Ober from http://www.artfulcode.net/
|
||||
many of his ideas and comments have improved newLISP. On his blog a variety
|
||||
of interesting and useful code examples and modules can be found.
|
||||
|
||||
Ted Walther from http://reactor-core.org/~djw/
|
||||
helped to improve the build process.
|
||||
|
||||
Joh from http://johu02.spaces.live.com/default.aspx and http://johu02.wordpress.com/
|
||||
did a thorough pass through the manual correcting many erros. His website
|
||||
and his Japanese translations of the reference manual and other documentation
|
||||
help to make newLISP popular in Japan.
|
||||
|
||||
Stefan Sonnenberg implemented the extended libffi based API for the import
|
||||
and callback functions starting version 10.3.8. This has opened the door
|
||||
to connect to many C-libraries, which were not accessible before.
|
||||
|
||||
Shigeru Kobayashi contributed newLISP modules for Emacs, Curl and fixed various
|
||||
bugs in the newLISP C-source code. He also made many contributions to Windows
|
||||
specific code. He prepared the first 64-bit compilation for Windows.
|
||||
|
||||
------------------------- other contributors, sources ----------------------------
|
||||
Phillip Hazel
|
||||
wrote the PCRE (Perl Regular Expressions) library, it is an essential
|
||||
part of newLISP and many other scripting languages and Open Source applications
|
||||
(i.e. Apache)
|
||||
|
||||
Jorge Acereda and Peter O'Gorman
|
||||
wrote dyna link library functions for OSX which are used in this project,
|
||||
their files osx-dlfcn.c/.h were necessary on pre 10.3 versions of MacOSX
|
||||
(functionality/code? now part of OS X since 10.3)
|
||||
|
||||
Daniel Stenberg
|
||||
from the cURL project, newLISP adapted the base64 encoding and decoding routines
|
||||
|
||||
Thomas Niemannn
|
||||
wrote a red-black binary tree algorithm used in newLISP with modifications.
|
||||
|
||||
Sourceforge.net
|
||||
Has helped newLISP and many other Open Source projects to get more visibility,
|
||||
the newLISP project enjoys their compile farm to port newLISP to other platforms
|
||||
|
||||
Richard M. Stallman
|
||||
GCC and many other GNU - tools make it possible to write platform independent
|
||||
software for many OSs and hardware platforms. The GNU Public License is the
|
||||
strongest force in the open source movement from which newLISP has benefited.
|
||||
|
||||
My apologies to anybody, who has been forgotten on this list (let me know).
|
||||
|
||||
+++
|
||||
|
4349
doc/CodePatterns.html
Normal file
484
doc/ExpressionEvaluation.html
Normal file
|
@ -0,0 +1,484 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Expression Evaluation in newLISP</title>
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
<!--
|
||||
body, h4, p {
|
||||
font-family: Lucida Sans, Helvetica, sans-serif;
|
||||
line-height: 120%;
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
margin-top: 3%;
|
||||
font-family: Lucida Sans, Helvetica, sans-serif;
|
||||
line-height: 120%;
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 0px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
border-style: solid;
|
||||
border-width: 0px;
|
||||
border-color: #888888;
|
||||
padding: 3px;
|
||||
background: #f8ffff;
|
||||
font-size: 95%;
|
||||
}
|
||||
|
||||
th {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #888888;
|
||||
padding: 3px;
|
||||
background: #eeeeee;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
td {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #888888;
|
||||
padding: 3px;
|
||||
background: #f8ffff;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
border-style: dashed;
|
||||
border-width: 1px;
|
||||
border-color: #888888;
|
||||
padding: 4px;
|
||||
font-family: Andale Mono, "Bitstream Vera Sans Mono", Monaco, "Courier New";
|
||||
font-size: 90%;
|
||||
background: #f8ffff;
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: Andale Mono, "Bitstream Vera Sans Mono", Monaco, "Courier New";
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body text="#000000" bgcolor="#FFFFFF" link="#376590" vlink="#551A8B" alink="#ffAA28">
|
||||
|
||||
<br />
|
||||
<blockquote>
|
||||
<center><h2>Expression evaluation, Implicit Indexing, Contexts and Default Functors in the newLISP Scripting Language</h2></center>
|
||||
<center>
|
||||
<font size="-1">Lutz Mueller, 2007-2015. Last edit December 6th 2013, rev r9<br/></font>
|
||||
</center>
|
||||
|
||||
<center><blockquote><blockquote><i>
|
||||
Implicit indexing and Default Functors in newLISP are an extension of normal LISP expression evaluation rules. Contexts provide lexically closed state-full namespaces in a dynamically scoped programming language.
|
||||
</i></blockquote></blockquote></center>
|
||||
<br />
|
||||
|
||||
<h3>S-expression evaluation and implicit indexing</h3>
|
||||
|
||||
<p>In an earlier paper it was explained how s-expression evaluation in newLISP relates to ORO (One Reference Only) automatic memory management [1]. The following pseudo code of the expression evaluation function in newLISP shows how implicit indexing is an extension of Lisp s-expression evaluation rules:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
function evaluateExpression(expr)
|
||||
{
|
||||
if typeOf(expr) is constant (BOOLEAN, NUMBER, STRING, CONTEXT)
|
||||
return(expr)
|
||||
|
||||
if typeOf(expr) is SYMBOL
|
||||
return(symbolContents(expr))
|
||||
|
||||
if typeOf(expr) is QUOTED
|
||||
return(unQuotedContents(expr))
|
||||
|
||||
if typeOf(expr) is LIST
|
||||
{
|
||||
func = evaluateExpression(firstOf(expr))
|
||||
args = rest(expr)
|
||||
if typeOf(func) is BUILTIN_FUNCTION
|
||||
result = evaluateFunc(func, args)
|
||||
else if typeOf(func) = LAMBDA_FUNCTION
|
||||
result = evaluateLambda(func, args)
|
||||
/* extensions for default functor */
|
||||
if typeOf(func) is CONTEXT
|
||||
func = defaultFunctor(func)
|
||||
if typeOf(func) = LAMBDA_FUNCTION
|
||||
result = evaluateLambda(defaultFunctor(func), args)
|
||||
/* extensions for implicit indexing */
|
||||
else if typeOf(func) = LIST
|
||||
result = implicitIndexList(func, args)
|
||||
else if typeOf(func) = STRING
|
||||
result = implicitIndexString(func, args)
|
||||
else if typeOf(func) = ARRAY
|
||||
result = implicitIndexArray(func, args)
|
||||
else if typeOf(func) = NUMBER
|
||||
result = implicitNrestSlice(func, args)
|
||||
}
|
||||
}
|
||||
|
||||
return(result)
|
||||
}
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The general working of the function reflects the general structure of the <i>eval</i> function as described by <i>John McCarthy</i> in 1960, [2].</p>
|
||||
|
||||
<p>The function first processes atomic expression types. Constants evaluate to themselves and are returned. Symbols evaluate to their contents.</p>
|
||||
|
||||
<p>If the expression is a list the first element gets applied to the rest elements. As in Scheme, newLISP evaluates the first element before applying it the result to its arguments.</p>
|
||||
|
||||
<p>Traditional Lisp or Scheme only permit a built-in function, operator or user defined lambda expression in the first, functor position of the s-expression list for evaluation. In newLISP the context symbol type, list, array and number type also act as functions when in the functor position.</p>
|
||||
|
||||
<p>Built-in functions are evaluated calling <i>evaluateFunc(func, args)</i>, functors which are lambda expressions call the <i>evaluateLambda(func, args)</i> function. Both functions in turn will call <i>evaluateExpression(expr)</i> again for evaluation of function arguments.</p>
|
||||
|
||||
<p>The working of a context symbol in the functor position of an s-expression will be explained further down in the chapter about <i>namespaces and default functors</i>.</p>
|
||||
|
||||
<p>The list type causes newLISP to evaluate the whole s-expression to the element indexed by the number(s) following the list and interpreted as index or indices (in newLISP elements in nested lists can be addressed using multiple indices):</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(set 'lst '(a b (c d e) f g))
|
||||
(lst 2) → (c d e)
|
||||
(lst 2 1) → d
|
||||
|
||||
(set 'str "abcdefg")
|
||||
(str 2) → "c"
|
||||
</pre></blockquote>
|
||||
|
||||
<p>A number in the functor position will assume slicing functionality and slice the following list at the offset expressed by the number. When the number is followed by a second number, the second number specifies the size or length of the sliced part of the list:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(1 lst) → (b (c d e) f g)
|
||||
(1 2 lst) → (b (c d e))
|
||||
|
||||
(1 2 str) → "bc"
|
||||
</pre></blockquote>
|
||||
|
||||
<p>On first sight it seems logical to extend the same principle to the boolean data type. A ternary conditional expressions could be constructed without the necessity of the <tt>if</tt> operator, but in practical programming this leads to difficulties when reading code and causes too much ambiguity in error messages. Most of the time implicit indexing leads to better readable code, because the data object is grouped together with it's indices. Implicit indexing performs faster, but is also optional. The keywords <tt>nth</tt>, <tt>first</tt>, <tt>last</tt> and <tt>rest</tt> and <tt>slice</tt> can be used in the few cases where readability is better when using the explicit form of indexing.</p>
|
||||
|
||||
<h3>The environment stack and dynamic scoping</h3>
|
||||
|
||||
<p>In the original Lisp <i>eval</i> function a <i>variable environment</i> is implemented as an association list of symbols and their values. In newLISP a symbol is implemented as a data structure with one value slot and the environment is not an association list but a binary tree structure of symbols and an <i>environment stack</i> storing previous values of symbols in higher evaluation levels.</p>
|
||||
|
||||
<p>When entering a lambda function, the parameter symbols and their current values are pushed
|
||||
on to the environment stack. When leaving the function, the symbols are restored to their
|
||||
previous values when popping the environment stack. Any other function called will see symbol
|
||||
values as currently defined in the scope of the calling function. The variable environment
|
||||
changes dynamically while calling and returning from functions. The scope of a variable extends
|
||||
dynamically into lower call levels.</p>
|
||||
|
||||
<p>The following example sets two variables and defines two lambda functions. After the function definitions the functions are used in a nested fashion. The changing parts of the variable environment are shown in bold type face:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
; x → nil, y → nil;
|
||||
; foo → nil
|
||||
; double → nil
|
||||
; environment stack: [ ]
|
||||
|
||||
(define (foo x y)
|
||||
(+ (double (+ x 1)) y))
|
||||
|
||||
; x → nil, y → nil,
|
||||
<b>; foo → (lambda (x y) (+ (double (+ x 1)) y))</b>
|
||||
; double → nil
|
||||
; environment stack: [ ]
|
||||
|
||||
(define (double x)
|
||||
(* 2 x))
|
||||
|
||||
; x → nil, y → nil
|
||||
; foo → (lambda (x y) (+ (double (+ x 1)) y))
|
||||
<b>; double → (lambda (x) (* 2 x)))</b>
|
||||
; environment stack: [ ]
|
||||
|
||||
(set 'x 10) (set 'y 20)
|
||||
|
||||
<b>; x → 10, y → 20</b>
|
||||
; foo → (lambda (x y) (+ (double (+ x 1)) y))
|
||||
; double → (lambda (x) (* 2 x)))
|
||||
; environment stack: [ ]
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Similar to Scheme newLISP uses the same namespace for variable symbols and symbols holding user-defined lambda functions. The <tt>define</tt> function is just a short-cut for writing:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(set 'foo (lambda (x y) (+ (double (+ x 1)) y)))
|
||||
</pre></blockquote>
|
||||
|
||||
<p>During all these operations the environment stack stays empty <tt>[ ]</tt>. Symbol variables holding lambda expressions are part of the same namespace and treated the same way as variables holding data. Now the the first function <tt>foo</tt> gets called:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(foo 2 4)
|
||||
|
||||
; after entering the function foo
|
||||
<b>; x → 2, y → 4</b>
|
||||
; foo → (lambda (x y) (+ (double (+ x 1)) y))
|
||||
; double → (lambda (x) (* 2 x)))
|
||||
<b>; environment stack: [x -> 10, y -> 20]</b>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>After entering the functions, the old values of <tt>x</tt> and <tt>y</tt> are pushed on the environment stack. This push-operation is initiated by the function <i>evaluateLambda(func, args)</i>, discussed later in this paper. Inside <tt>foo</tt> the second function <tt>double</tt> is called:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(double 3)
|
||||
; after entering the function double
|
||||
<b>; x -> 3, y -> 4</b>
|
||||
; foo → (lambda (x y) (+ (double (+ x 1)) y))
|
||||
; double → (lambda (x) (* 2 x)))
|
||||
<b>; environment stack: [x -> 10, y -> 20, x -> 2]</b>
|
||||
|
||||
; after return from double
|
||||
<b>; x → 2, y → 4</b>
|
||||
; foo → (lambda (x y) (+ (double (+ x 1)) y))
|
||||
; double → (lambda (x) (* 2 x)))
|
||||
<b>; environment stack: [x -> 10, y -> 20]</b>
|
||||
|
||||
; after return from foo
|
||||
<b>; x → 10, y → 20</b>
|
||||
; foo → (lambda (x y) (+ (double (+ x 1)) y))
|
||||
; double → (lambda (x) (* 2 x)))
|
||||
<b>; environment stack: [ ]</b>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Note that in newLISP dynamic scoping of parameter symbols in lambda expressions does not create lexical state-full closures around those symbols as in the Scheme dialect of Lisp. On return from the lambda function the symbol contents gets destroyed and memory is reclaimed. The parameter symbols regain their old values on exit from the lambda function by popping them from the environment stack. </p>
|
||||
|
||||
<p>In newLISP lexical state-full closures are not realized using lambda closures but using lexical namespaces. Lambda functions in newLISP do not create closures but can create a new scope and new temporary content for existing symbols during lambda function execution.</p>
|
||||
|
||||
<h3>Lambda function evaluation</h3>
|
||||
|
||||
<p>All of the processing just described happens in <tt>evaluateLambda(func, args)</tt>. The following pseudo code shows more detail:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
function evaluateLambda(lambda-func, args)
|
||||
{
|
||||
for each parameter symbol in lambda-func
|
||||
pushEnvironmentStack(symbol, value)
|
||||
|
||||
for each arg in args and the symbol belonging to arg
|
||||
; evaluation of arg happens in old symbol environment
|
||||
assignSymbolValue(symbol, evaluateExpression(arg))
|
||||
|
||||
for each body expression expr in lambda-func
|
||||
result = evaluateExpression(expr)
|
||||
|
||||
for each parameter symbol in lambda-func
|
||||
popEnvironmentStack()
|
||||
|
||||
return(result)
|
||||
}
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The <tt>evaluateExpression(args)</tt> function and <tt>evaluateLambda(func, args)</tt> call each other in a recursive cycle.</p>
|
||||
|
||||
<p>Note that arguments to lambda functions are evaluated in the variable environment as defined previous to the lambda function call. Assignments to parameters symbols do happen after all argument evaluations. Only the arguments are evaluated which have a corresponding parameter symbol. If there are more parameter symbols than arguments passed, then parameter symbols are assigned <tt>nil</tt> or a default value.</p>
|
||||
|
||||
<h3>Namespaces and the translation and evaluation cycle</h3>
|
||||
|
||||
<p>All memory data objects in newLISP are bound directly or indirectly to a symbol. Either memory objects are directly referenced by a symbol or they are part of an enclosing s-expression memory object referenced by a symbol. Unbound objects only exist as transient objects as returned values from evaluations and are referenced on the result stack for later deletion [1].</p>
|
||||
|
||||
<p>Except for symbols, all data and program objects are referenced only once. Symbols are created and organized in a binary tree structure. Namespaces, called <i>contexts</i> in newLISP, are sub-branches in this binary tree. A context is bound to a symbol in the root context <tt>MAIN</tt>, which itself is a symbol in the root context.</p>
|
||||
|
||||
<p>With few exceptions all symbols are created during the code loading and translation phase of the newLISP interpreter. Only the functions <tt>load</tt>, <tt>sym</tt>, <tt>eval-string</tt> and a special syntax of <tt>context</tt> create symbols during runtime execution.</p>
|
||||
|
||||
<p>The two symbols <tt>MAIN:x</tt> and <tt>CTX:x</tt> are two different symbols at all times. A symbol under no circumstances can change it's context after it was created. A context, e.g <tt>CTX</tt>, itself is a symbol in <tt>MAIN</tt> containing the root pointer to a sub-branch in the symbol tree.</p>
|
||||
|
||||
<p>The working of context switching is explained using the following two code pieces:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(set 'var 123)
|
||||
(define (foo x y)
|
||||
(context 'CTX)
|
||||
(println var " " x " " y))
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The <tt>(context 'CTX)</tt> statement only has been included here to show, it has no effect in this position. A switch to a different namespace context will only have influence on subsequent symbol creation using <tt>sym</tt> or <tt>eval-string</tt>. By the time <tt>(context 'CTX)</tt> is executed <tt>foo</tt> has already been defined and all symbols used in it have been looked up and translated. Only when using <tt>(context ...)</tt> on the top level it will influence the symbol creation of code following it:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(context 'CTX)
|
||||
(set 'var 123)
|
||||
(define (foo x y)
|
||||
(println var " " x " " y))
|
||||
(context MAIN)
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Now the context is created and switched to on the top-level. When newLISP translates the subsequent set-statement and function definition, all symbols will be part of <tt>CTX</tt> as <tt>CTX:var</tt>, <tt>CTX:foo</tt>, <tt>CTX:x</tt> and <tt>CTX:y</tt>.</p>
|
||||
|
||||
|
||||
<p>When loading code newLISP reads a top-level expression translating then evaluating it. This cycle is repeated until all top-level expression are read and evaluated.</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(set 'var 123)
|
||||
(define (foo x y)
|
||||
(println var " " x " " y))
|
||||
</pre></blockquote>
|
||||
|
||||
<p>In the previous code snippet two top-level expressions are translated and evaluated resulting in the creation of the three symbols: <tt>MAIN:var</tt>, <tt>MAIN:foo</tt>, <tt>MAIN:x</tt>, <tt>MAIN:y</tt> and <tt>MAIN:CTX</tt>.</p>
|
||||
|
||||
<p>The symbol <tt>MAIN:var</tt> will contain the number <tt>123</tt> and the <tt>MAIN:foo</tt> symbols will contain the lambda expression <tt>(lambda (x y) (println var " " x " " y))</tt>. The symbols <tt>MAIN:x</tt> and <tt>MAIN:y</tt> both will contain <tt>nil</tt>. The <tt>var</tt> inside the definition of <tt>foo</tt> is the same as the <tt>var</tt> previously set to <tt>123</tt> and will be printed as <tt>123</tt> during execution of <tt>foo</tt>.</p>
|
||||
|
||||
<p>In detail the following steps are happening:</p>
|
||||
|
||||
<ol>
|
||||
<li> current context is <tt>MAIN</tt></li>
|
||||
<li> read the opening top-level parenthesis <tt>I</tt> and create a Lisp cell of type <tt>EXPRESSION</tt>.</li>
|
||||
<li> read and lookup <tt>set</tt> in <tt>MAIN</tt> and find it to be a built-in primitive in <tt>MAIN</tt>, translate it to the address of this primitive function in memory. Create a Lisp cell of type <tt>PRIMITIVE</tt> containing the functions address in its contents slot.</li>
|
||||
<li> read the quote <tt>'</tt> and create a Lisp cell of type <tt>QUOTE</tt>.</li>
|
||||
<li> read and lookup lookup <tt>var</tt> in <tt>MAIN</tt>, it is not found in <tt>MAIN</tt>, create it in <tt>MAIN</tt> and translate it to the address in the binary symbol tree. Create a Lisp cell of type <tt>SYMBOL</tt> containing the symbols address in its contents slot. The previously created quote cell serves as an envelop for the symbols cell.</li>
|
||||
<li> read <tt>123</tt> and create a Lisp cell of type <tt>INTEGER</tt> with <tt>123</tt> in its contents slot.</li>
|
||||
<li> read the closing top-level parenthesis finish the following list structure in memory:<br />
|
||||
|
||||
|
||||
<blockquote><pre>
|
||||
[ ] ; cell of type: EXPRESSION
|
||||
\
|
||||
[MAIN:set] → ['] → [123] ; three cells of type: PRIMITIVE, QUOTE, INTEGER
|
||||
\
|
||||
[MAIN:var] ; cell of type: SYMBOL
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The above list diagram shows the five Lisp cells, which are created. List and quote cells are envelope cells containing a list or a quoted expression.</p>
|
||||
|
||||
<p>The statement <tt>(set 'var 123)</tt> is not executed yet, but symbol translation and creation have finished and the statement exists as a list structure in memory. The whole list structure can be referenced with one memory address, the address of the first created cell of type <tt>EXPRESSION</tt>.</p>
|
||||
</li>
|
||||
|
||||
<li>Evaluate the statement</li>
|
||||
</ol>
|
||||
|
||||
<p>In similar fashion newLISP will read and translate the next top-level expression, which is the function definition of <tt>foo</tt>. Evaluating this top-level expression will result in an assignment of a lambda expression to the <tt>foo</tt> symbol.</p>
|
||||
|
||||
<p>In the above code snippet both instances of <tt>var</tt> refer to <tt>MAIN:var</tt>. The <tt>(context 'CTX)</tt> statement only changes the context, namespaces for newly created symbols. The symbol <tt>var</tt> was created during loading translating the <tt>foo</tt> function. By the time <tt>foo</tt> is called and executed <tt>var</tt> already exists inside the <tt>foo</tt> function as <tt>MAIN:var</tt>. The <tt>(context 'CTX)</tt> statement doesn't have any effect of the subsequent execution of <tt>(println var)</tt>.</p>
|
||||
|
||||
<p>Context statements like <tt>(context 'CTX)</tt> above, change the current context for symbol creation during the loading and translation phase. The current context defines under which branch in the symbol tree new symbols are created. This affects only the the functions <tt>sym</tt>, <tt>eval-string</tt> and a special syntax of <tt>context</tt> to create symbols. Once a symbol belongs to a context it stays there.</p>
|
||||
|
||||
<h3>Namespace context switching</h3>
|
||||
|
||||
<p>Previous chapters showed how to use context switching on the top-level of a newLISP source file to influence symbol creation and translation during the source loading process. Once different namespaces exist, calling a function which belongs to different context, will cause a context switch to the namespace the called lambda function resides in. If the called function doesn't execute any <tt>sym</tt> or <tt>eval-string</tt> statements, then these context switches don't have any effect. Even the <tt>load</tt> command will always start file loading relative to context <tt>MAIN</tt> unless a different context is specified as a special parameter in <tt>load</tt>. Inside the file loaded context switches will have an effect of symbol creation during the load process as explained previously.</p>
|
||||
|
||||
<p>What causes the context switch is the symbol holding the lambda function. In the following code examples bold face is used for output generated by <tt>println</tt> statements:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(context 'Foo)
|
||||
(set 'var 123)
|
||||
(define (func)
|
||||
(println "current context: " (context))
|
||||
(println "var: " var))
|
||||
(context 'MAIN)
|
||||
|
||||
(Foo:func)
|
||||
<b>current context: Foo</b>
|
||||
<b>var: 123</b>
|
||||
|
||||
(set 'aFunc Foo:func)
|
||||
(set 'var 999)
|
||||
|
||||
(aFunc)
|
||||
<b>current context: MAIN</b>
|
||||
<b>var: 123</b>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Note that the call to <tt>aFunc</tt> causes the current context to be shown as <tt>MAIN</tt>, because the symbol <tt>aFunc</tt> belongs to context <tt>MAIN</tt>. In both cases <tt>var</tt> is printed as <tt>123</tt>. The symbol <tt>var</tt> was put into the <tt>Foo</tt> namespace during translation of <tt>func</tt> and will always stay there, even if a copy of the lambda function is made and assigned to a symbol in a different context.</p>
|
||||
|
||||
<p>This context switching behaviour follows the same rules when applying or mapping functions:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(apply 'Foo:func)
|
||||
<b>current context: Foo
|
||||
var: 123</b>
|
||||
|
||||
(apply Foo:func)
|
||||
<b>current context: MAIN
|
||||
var: 123</b>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The first time <tt>Foo:func</tt> is applied as a symbol – quoted, the second time the lambda function contained in <tt>Foo:func</tt> is applied directly, because <tt>apply</tt> evaluates it's first argument first.</p>
|
||||
|
||||
<h3>Namespaces and the default functor</h3>
|
||||
|
||||
<p>In newLISP a symbol is a <i>default functor</i> if it has the same name as the context it belongs too, e.g. <tt>Foo:Foo</tt> is the default functor symbol in the context <tt>Foo</tt>. In newLISP when using a context symbol in the functor position, it is taken as the default functor:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(define (double:double x) (* 2 x))
|
||||
(double 3) → 6
|
||||
|
||||
(set 'my-list:my-list '(a b c d e f))
|
||||
(my-list 3) → d
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The second example combines implicit indexing with usage of a default functor.</p>
|
||||
|
||||
<p>Default functors can be applied and mapped using <tt>apply</tt> and <tt>map</tt> like any other function or functor symbol:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(map my-list '(3 2 1 2)) → (d c b c)
|
||||
|
||||
(apply double '(10)) → 20
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Default functors are a convenient way in newLISP to pass lists or other big data objects by reference:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(set 'my-list:my-list '(a b c d e f))
|
||||
|
||||
(define (set-last ctx val)
|
||||
(setf (ctx -1) val))
|
||||
|
||||
(set-last my-list 99) → f
|
||||
|
||||
my-list:my-list → (a b c d e 99)
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Default functors are also a convenient way to define functions with a closed state-full
|
||||
name space:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(context 'accumulator)
|
||||
(define (accumulator:accumulator x)
|
||||
(if (not value)
|
||||
(set 'value x)
|
||||
(inc 'value x)))
|
||||
(context MAIN)
|
||||
|
||||
(accumulator 10) → 10
|
||||
(accumulator 2) → 12
|
||||
(accumulator 3) → 15
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Note that the symbols <tt>x</tt> and <tt>value</tt> both belong to the namespace <tt>accumulator</tt>. Because <tt>(context 'accumulator)</tt> is at the top level, the translation of following function definition for <tt>accumulator:accumulator</tt> happens inside the current namespace <tt>accumulator</tt>.</p>
|
||||
|
||||
<p>Namespaces in newLISP can be passed by reference and can be used to create state-full lexical closures.</p>
|
||||
|
||||
<h3>The default functor used as a pseudo hash function</h3>
|
||||
<p>A default functor containing <tt>nil</tt> and in operator position
|
||||
will work similar to a hash function for building dictionaries with
|
||||
associative key → value access:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(define aHash:aHash) ; create namespace and default functor containing nil
|
||||
|
||||
(aHash "var" 123) ; create and set a key "var" to 123
|
||||
|
||||
(aHash "var") → 123 ; retrieve value from key
|
||||
</pre></blockquote>
|
||||
|
||||
<h3>References</h3>
|
||||
[1] <i>Lutz Mueller</i>, 2004-2015<br />
|
||||
<a href="http://newlisp.org/MemoryManagement.html">Automatic Memory Management in newLISP</a>.
|
||||
<br /><br />
|
||||
|
||||
[2] <i>John McCarthy</i>, 1960<br />
|
||||
<a href="http://www-formal.stanford.edu/jmc/recursive.html">Recursive Functions of Symbolic Expressions and their Computation by Machine</a>.
|
||||
<br /><br />
|
||||
<center><font size="-1">Copyright © 2007-2016, Lutz Mueller
|
||||
<a href="http://newlisp.org">http://newlisp.org</a>. All rights reserved. </font></center>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
396
doc/INSTALL
Normal file
|
@ -0,0 +1,396 @@
|
|||
BINARY INSTALL, BUILD, TOOLS, LOCALIZING (last updated 2011-11-14
|
||||
-------------------------------------------------------------------
|
||||
|
||||
CONTENTS
|
||||
|
||||
(1) WIN32 BINARY DISTRIBUTION INSTALLATION
|
||||
(2) Mac OS X BINARY DISTRIBUTION INSTALLATION
|
||||
(3) UBUNTU Linux DEBIAN DISTRIBUTION INSTALLATION
|
||||
(4) MINIMUM INSTALL
|
||||
(5) BUILD, TEST AND INSTALL newLISP FROM SOURCE
|
||||
(6) COMMENTS FOR COMPILING AND LINKING
|
||||
(7) LOCALIZATION
|
||||
(8) UNINSTALL
|
||||
(9) RUNNING newLISP IN A SHELL OR CONSOLE WINDOW
|
||||
(10) RUNNING THE newLISP-GS GRAPHICAL FRONTEND
|
||||
(11) INSTRUCTIONS FOR CUSTOMIZED INSTALL AND PACKAGE CREATORS
|
||||
(12) COMMENTS ABOUT LIBFFI
|
||||
|
||||
|
||||
(1) WIN32 BINARY DISTRIBUTION INSTALLATION
|
||||
------------------------------------------
|
||||
|
||||
The Win32 binary distribution comes packed as a Win32 installer
|
||||
application. After downloading a file:
|
||||
|
||||
newlisp-xxxx-win-gs-xxx.exe
|
||||
|
||||
double click on the downloaded file and follow instructions. xxxx and xxx
|
||||
are the version numbers for newLISP and the newLISP-GS the GUI frontend.
|
||||
On Win32 a ASCII version of newlisp.exe capable of ISO/IEC 8859 code pages
|
||||
is installed. A UTF-8 capable version is available from the newlisp download
|
||||
directory at: http://www.newlisp.org/downloads/UTF-8_win32/
|
||||
|
||||
|
||||
(2) Mac OS X BINARY DISTRIBUTION INSTALLATION
|
||||
---------------------------------------------
|
||||
|
||||
After downloading double-click on the Mac OS X disk image file:
|
||||
|
||||
newlisp-xxxx-ppc.dmg # for older PPC type Macs
|
||||
or
|
||||
newlisp-xxxx-intel.dmg # since at least end of 2007
|
||||
|
||||
This installs an applications icon in the Mac OS X Applications folder.
|
||||
On Mac OS X a UTF-8 capable version is installed by default. On both,
|
||||
Intel and PPC architectures Mac OS X v10.5 Leopard is minimum.
|
||||
|
||||
|
||||
(3) UBUNTU Linux DEBIAN DISTRIBUTION INSTALLATION
|
||||
-------------------------------------------------
|
||||
|
||||
Double click the file:
|
||||
|
||||
newlisp-xxxx-x_i386.deb
|
||||
or
|
||||
newlisp-xxxx-utf8_i386.deb
|
||||
|
||||
This will bring up the debian installer application.
|
||||
|
||||
On some UBUNTU libraries libreadline and libffi may have to be installed
|
||||
when making from source:
|
||||
|
||||
sudo apt-get install libreadline6 libreadline6-dev
|
||||
and
|
||||
apt-get install libffi-dev
|
||||
|
||||
|
||||
(4) MINIMUM INSTALL
|
||||
-------------------
|
||||
|
||||
For a minumum install, only the executable file: newlisp (or newlisp.exe
|
||||
on Win32) needs to be moved to a directory in the executable path, i.e.
|
||||
/usr/bin/newlisp on Unix. No other files are required. This installation
|
||||
is recommended for ISPs and other server installations. If modules are
|
||||
installed the environment NEWLISPDIR should be defined to point to
|
||||
the modules parent directory. If NEWLISPDIR is not defined, newLISP sets
|
||||
it to /usr/share/newlisp during startup.
|
||||
|
||||
To reduce an exisiting UNIX install to a minimum installation, remove all
|
||||
files in /usr/share/newlisp and /usr/share/doc/newlisp and the executable
|
||||
files /usr/bin/newlisp-edit and /usr/bin/newlispdoc.
|
||||
|
||||
On Mac OX X remove also the files under the Applications icon in the
|
||||
Applications folder. On Windows remove all file except newlisp.exe in
|
||||
C:/Program Files/newlisp.
|
||||
|
||||
|
||||
(5) BUILD AND INSTALL newLISP FROM SOURCE
|
||||
-----------------------------------------
|
||||
|
||||
Un-tar/gunzip the distribution file newlisp_9.x.x.tgz :
|
||||
|
||||
tar xzvf newlisp_9.x.x.tgz
|
||||
|
||||
Change the current directory in to newlisp_x.x.x/
|
||||
|
||||
and check what OS flavor make would detect, type:
|
||||
|
||||
./configure
|
||||
|
||||
This will automatically detect the platforms Linus, MacOS X, FreeBSD,
|
||||
OpenBSD, NetBSD, SunOS/Solaris and Win32. To build on Win32 a MinGW
|
||||
installation hosted by MSYS is required. See http://mingw.org.
|
||||
|
||||
If you agree with the platform detected by configure type:
|
||||
|
||||
make
|
||||
|
||||
After building has finished type:
|
||||
|
||||
make testall
|
||||
|
||||
or for a shorter version
|
||||
|
||||
make test
|
||||
|
||||
when all tests are passed OK do a
|
||||
|
||||
sudo make install
|
||||
|
||||
or if already in superuser mode:
|
||||
|
||||
make install
|
||||
|
||||
to find out all make options, use:
|
||||
|
||||
make help
|
||||
|
||||
For shorter ouput, 'make test' can be used instead of 'make check'.
|
||||
Using 'make testall' or 'make checkall' more tests and a speed
|
||||
benchmark are performed.
|
||||
|
||||
|
||||
(6) COMMENTS FOR COMPILING AND LINKING
|
||||
--------------------------------------
|
||||
|
||||
If skipping the ./configure step and just doing make, the
|
||||
configure script will be called automatically if no makefile_build
|
||||
can be found, or else the existing makefile_build will be used.
|
||||
|
||||
The standard configure script assumes READLINE support, discovers
|
||||
the default memory model (32 bit vs 64 bit) and copies one of the
|
||||
pre-fabricated makefiles to makefile_build. The standard
|
||||
configure forces 32-bit on MacOS X even if 64-bit is
|
||||
detected. To force compile for 64-bit either choose an appropiate
|
||||
make file manually or use configure-alt.
|
||||
|
||||
If compiling with READLINE fails on Linux , it may be due to missing
|
||||
readline.h and history.h include files. In this case the package
|
||||
'libreadline5-dev' has to be installed.
|
||||
|
||||
On some platforms the warning message "ANSI does not support long long"
|
||||
will be issued for every file compiled. This message can be discarded
|
||||
and does not occur on newer versions of GCC. The 'long long' data type
|
||||
is not used anywhere in the newLISP source but part of some header files
|
||||
of the GCC installation.
|
||||
|
||||
Most of the makefile_xxxxx can also be used this way:
|
||||
|
||||
make -f makefile_xxxxx
|
||||
|
||||
but always read the contents of makefile_xxxxx first, as it sometimes
|
||||
contains specific instructions.
|
||||
|
||||
|
||||
configure-alt script
|
||||
--------------------
|
||||
This script can be used as an alternative to the standard configure
|
||||
script. Instead of creating a makefile_build from existing pre-
|
||||
configured makefile configure-alt does an analysis of the capabilities
|
||||
found on the target platform and then custom generates a makefile_build.
|
||||
|
||||
Numerous options can be configured. To find all options use:
|
||||
|
||||
./configure-alt --help
|
||||
|
||||
For questions and support for configure-alt, please contact:
|
||||
|
||||
Ted Walther <ted@reactor-core.org>.
|
||||
|
||||
Note thet configure-alt uses a version-numbered directory for the
|
||||
installation. By default it also uses /usr/local instead of /usr
|
||||
as a prefix for the bin, man, share/newlisp and share/doc/newlisp
|
||||
directories.
|
||||
|
||||
Avoid having installs from the standard 'configure' and alternate
|
||||
'configure-alt' script on the same machine!
|
||||
|
||||
NOTE, that newLISP can only be compiled for the IPL32 and LP64 memory
|
||||
models.
|
||||
|
||||
configure-alt will configure a 64-bit (LP64) application by default
|
||||
if the platform and tools are capable. The standard configure script
|
||||
will configure a makefile for 32-bit (ILP32) by default. This may
|
||||
change in the future.
|
||||
|
||||
Compiling and running newlisp-x.x.x/util/types.c will produce:
|
||||
|
||||
IPL32 memory model
|
||||
------------------
|
||||
type bytes
|
||||
---------------
|
||||
char 1
|
||||
char * 4
|
||||
void * 4
|
||||
short int 2
|
||||
int 4
|
||||
long 4
|
||||
long int 4
|
||||
long long int 8
|
||||
size_t 4
|
||||
float 4
|
||||
double 8
|
||||
long double 16
|
||||
wchar_t 4
|
||||
size_t 4
|
||||
off_t 8
|
||||
time_t 4
|
||||
|
||||
|
||||
LP64 memory model
|
||||
-----------------
|
||||
type bytes
|
||||
---------------
|
||||
char 1
|
||||
char * 8
|
||||
void * 8
|
||||
short int 2
|
||||
int 4
|
||||
long 8
|
||||
long int 8
|
||||
long long int 8
|
||||
size_t 8
|
||||
float 4
|
||||
double 8
|
||||
long double 16
|
||||
wchar_t 4
|
||||
size_t 8
|
||||
off_t 8
|
||||
time_t 8
|
||||
|
||||
|
||||
(7) LOCALIZATION
|
||||
----------------
|
||||
|
||||
The PCRE Regular Expressions code can be localized to your country/language
|
||||
It comes with default character tables for English, but should work well
|
||||
for other languages when using the UTF-8 version of newLISP. For correct working of
|
||||
other string functions in your country/language a localizable 'C' library/OS
|
||||
may have to be used. The names of newLISP functions can be localized during
|
||||
runtime without performance loss, (see newlisp_manual.html).
|
||||
|
||||
There are UTF-8 versions/makefiles available in the source distribution.
|
||||
See the chapter about 'Customization, localization and UTF-8' in the manual.
|
||||
|
||||
|
||||
(8) UNINSTALL
|
||||
-------------
|
||||
|
||||
On Win32 use the uninstall application from the newlisp applications
|
||||
menu.
|
||||
|
||||
On Mac OS X double click on the uninstall script in the diskimage of
|
||||
the installer package.
|
||||
|
||||
On UBUNTU Linux execute:
|
||||
|
||||
sudo dpkg -r newlisp
|
||||
|
||||
On all other UNIX, to uninstall if installed with make install do:
|
||||
|
||||
sudo make uninstall
|
||||
|
||||
or if installed with: make install_home
|
||||
|
||||
make uninstall_home
|
||||
|
||||
To manually uninstall on Win32 remove all files in c:\Program files\newlisp
|
||||
|
||||
On Mac OS X and other UNIX remove all files in /usr/share/newlisp and
|
||||
/usr/share/doc/newlisp and the executable files /usr/bin/newlisp,
|
||||
/usr/bin/newliso-edit and /usr/bin/newlispdoc. On Mac OX X also remove
|
||||
the newLISP icon in the Applications folder.
|
||||
|
||||
|
||||
(8) RUNNING newLISP IN A SHELL OR CONSOLE WINDOW
|
||||
------------------------------------------------
|
||||
|
||||
On all platforms simply execute:
|
||||
|
||||
newlisp
|
||||
|
||||
On Win32 the execution path of newlisp.exe was added to the environment
|
||||
during installation. On all other platforms the newlisp binary is in
|
||||
/usr/bin/newlisp or when using the home install in $HOME/bin
|
||||
where $HOME is the the home directory of the user taken from the environment
|
||||
variable HOME.
|
||||
|
||||
|
||||
(10) RUNNING THE newLISP-GS GRAPHICAL FRONTEND
|
||||
----------------------------------------------
|
||||
|
||||
On Win32 and Mac OS X a Java based syntaxhighlighting editor is installed in
|
||||
in the Applications menus. In other UNIX execute:
|
||||
|
||||
newlisp-edit
|
||||
|
||||
from the command line in a terminal window.
|
||||
The editor needs a Java runtime environment JRE version 1.5 as a minimum.
|
||||
In case it is not installed it can be obtained from:
|
||||
http://www.oracle.com/technetwork/java/javase/downloads/index.html
|
||||
|
||||
Since Mac OS X 10.7 Lion, Java is not installed by default. Install
|
||||
Java for OS X 10.7 Lion from here: http://support.apple.com/kb/DL1421
|
||||
|
||||
(11) INSTRUCTIONS FOR CUSTOMIZED INSTALL AND PACKAGE CREATORS
|
||||
-------------------------------------------------------------
|
||||
|
||||
By default the configure script uses the following install directories:
|
||||
|
||||
/usr/bin/
|
||||
/usr/share/newlisp
|
||||
/usr/share/doc/newlisp
|
||||
|
||||
As an alternative the configure-alt script can be used. Do a:
|
||||
|
||||
./configure-alt --help
|
||||
|
||||
To see all the options available. Options for install directories,
|
||||
readline support, UTF-8 support and memory model used are available.
|
||||
|
||||
Like configure, configure-alt creates a makefile_build and makefile_install.
|
||||
Both makefiles are used by Makefile when doing:
|
||||
|
||||
make
|
||||
make install
|
||||
make test
|
||||
|
||||
or for a bigger testsuite
|
||||
|
||||
make testall
|
||||
|
||||
These are the standard configuration options recommended by newlisp.org:
|
||||
|
||||
- use ILP32 memory model as a default, use LP64 only when ILP32 is not
|
||||
available on the platform (configure-alt will take the default offered
|
||||
on the platform)
|
||||
|
||||
- use the default IPV4 support IPV6 has not been thoroughly tested yet
|
||||
although it passes the standard qa-net test script (configure-alt
|
||||
defaults to IPV4.
|
||||
|
||||
- use readline support if possible (configure-alt uses it if available)
|
||||
|
||||
- offer both packages, one with and one without UTF-8 support on UNIX
|
||||
installations. newlisp.org ships UTF-8 support on MAC OSX by default and
|
||||
ships without UTF-8 support on Win32 (offering UTF-8 binaries on the
|
||||
newlisp.org website).
|
||||
|
||||
- for a brief, one line description of the package, use:
|
||||
|
||||
newLISP is a LISP like, general purpose scripting language
|
||||
|
||||
- for a longer description of the package, use:
|
||||
|
||||
newLISP is a scripting language for developing web applications and
|
||||
programs in general and in the domains of artificial intelligence (AI)
|
||||
and statistics.
|
||||
|
||||
|
||||
(12) COMMENTS ABOUT LIBFFI
|
||||
--------------------------
|
||||
|
||||
Here some general comments for usage of libffi in newLISP:
|
||||
|
||||
The extended ffi requiring libffi and ffi.h for compiling, was only
|
||||
introduced a short time ago in February of 2012. Except for module/gsl.lsp
|
||||
all other modules shipped in the distributions work with the older simple
|
||||
form of import not requiring libffi.
|
||||
|
||||
The configure utility will pick libffi enabled makefiles only for Windows,
|
||||
OSX and Linux. For all other OS it will pick makefiles not requiring libffi.
|
||||
|
||||
Ted Walther's configure-alt utility, which automatically configures the
|
||||
memory model (32-bit or 64-bit) never configures for the new extended ffi
|
||||
using libffi.
|
||||
|
||||
The path for ffi.h chosen in newlisp.h, is only valid for OSX and UBUNTU
|
||||
Linux, for all other OSs the path might be different and has to be adjusted.
|
||||
|
||||
In any case, libffi from http://sourceware.org/libffi/ is pretty easy to make
|
||||
for most platforms. On Windows, Mac OSX and UBUNTU Linux it is already
|
||||
installed by default.
|
||||
|
||||
|
||||
+++
|
41
doc/LOCALIZATION
Normal file
|
@ -0,0 +1,41 @@
|
|||
LOCALIZATION
|
||||
============
|
||||
|
||||
See chapter 'Customization Localization and UTF-8' in the
|
||||
Users Manual and the usage of 'set-locale' function in the
|
||||
Function Reference.
|
||||
|
||||
The 'set-locale' function will not influence the behaviour of
|
||||
PCRE (Perl Compatible Regular Expressions) in newLISP, but a
|
||||
special option flag number can be set to support UTF-8 in all
|
||||
functions supporting regular expressions like: regex, find,
|
||||
replace, parse and search.
|
||||
|
||||
To further localize the behaviour of regular expressions in newLISP
|
||||
the file 'pcre-chartables.c' must be replaced with a localized
|
||||
version. To obtain this file for your locale, follow these steps:
|
||||
|
||||
(1) get the pcre source distribution from http://www.pcre.org
|
||||
|
||||
(2) follow the instruction in it's README file to 'configure'
|
||||
and 'make' it. An installation is not necessary. Just using
|
||||
the 'configure' and 'make' steps will create a file called
|
||||
'chartables.c' suitable for the locale on your computer
|
||||
system. Rename this file to 'pcre-chartables.c', which it
|
||||
replaces in the newLISP source distribution.
|
||||
|
||||
(3) recompile newLISP
|
||||
|
||||
newLISP will now show regular expression behaviour in functions
|
||||
like 'regex', 'find', 'replace' and 'parse' appropiate to your
|
||||
locale. The function 'set-locale' should still be used to change
|
||||
all other aspects of newLISP to your locale.
|
||||
|
||||
newLISP can be used with multi-byte character languages when
|
||||
compiled with UTF-8 options. For some OS flavors UTF-8 enabled
|
||||
makefile are shipped in the source distribution.
|
||||
|
||||
When compiled with UTF-8 character handling some newLISP functions
|
||||
will work on multibyte characters instead of single bytes. See
|
||||
the manual for details.
|
||||
+++
|
742
doc/License.html
Normal file
|
@ -0,0 +1,742 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<title>GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007</title>
|
||||
<body>
|
||||
<blockquote>
|
||||
<center>
|
||||
<h2><span class="function">GNU GENERAL PUBLIC LICENSE</span></h2>
|
||||
<p>Version 3, 29 June 2007</p>
|
||||
</center>
|
||||
|
||||
<p>
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
</p>
|
||||
|
||||
<center><b>Preamble</b></center>
|
||||
|
||||
<p>
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
</p>
|
||||
<p>
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
</p>
|
||||
<p>
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
</p>
|
||||
<p>
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
</p>
|
||||
<p>
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
</p>
|
||||
<p>
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
</p>
|
||||
<p>
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
</p>
|
||||
<p>
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
</p>
|
||||
<p>
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
</p>
|
||||
<p>
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
</p>
|
||||
<p>
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
</p>
|
||||
<center><b>TERMS AND CONDITIONS</b></center>
|
||||
|
||||
<p><b>0. Definitions.</b></p>
|
||||
<p>
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
</p>
|
||||
<p>
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
</p>
|
||||
<p>
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
</p>
|
||||
<p>
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
</p>
|
||||
<p>
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
</p>
|
||||
<p>
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
</p>
|
||||
<p>
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
</p>
|
||||
<p>
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.</p>
|
||||
|
||||
<p><b>1. Source Code.</b></p>
|
||||
|
||||
<p>
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
</p>
|
||||
<p>
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
</p>
|
||||
<p>
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
</p>
|
||||
<p>
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
</p>
|
||||
<p>
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
</p>
|
||||
<p>
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
</p>
|
||||
<p>
|
||||
<b>2. Basic Permissions.</b>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
</p>
|
||||
<p>
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
</p>
|
||||
<p>
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
</p>
|
||||
<p>
|
||||
<b>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</b>
|
||||
</p>
|
||||
<p>
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
</p>
|
||||
<p>
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
</p>
|
||||
<p>
|
||||
<b>4. Conveying Verbatim Copies.</b>
|
||||
</p>
|
||||
<p>
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
</p>
|
||||
<p>
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
</p>
|
||||
<p>
|
||||
<b>5. Conveying Modified Source Versions.</b>
|
||||
</p>
|
||||
<p>
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
</p>
|
||||
<blockquote>
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
</blockquote>
|
||||
<p>
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
</p>
|
||||
<p>
|
||||
<b>6. Conveying Non-Source Forms.</b>
|
||||
</p>
|
||||
<p>
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
</p>
|
||||
<blockquote>
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
</blockquote>
|
||||
<p>
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
</p>
|
||||
<p>
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
</p>
|
||||
<p>
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
</p>
|
||||
<p>
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
</p>
|
||||
<p>
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
</p>
|
||||
<p>
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
</p>
|
||||
<p>
|
||||
<b>7. Additional Terms.</b>
|
||||
</p>
|
||||
<p>
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
</p>
|
||||
<p>
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
</p>
|
||||
<p>
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
</p>
|
||||
<blockquote>
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
</blockquote>
|
||||
<p>
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
</p>
|
||||
<p>
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
</p>
|
||||
<p>
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
</p>
|
||||
<p>
|
||||
<b>8. Termination.</b>
|
||||
</p>
|
||||
<p>
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
</p>
|
||||
<p>
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
</p>
|
||||
<p>
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
</p>
|
||||
<p>
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
</p>
|
||||
<p>
|
||||
<b>9. Acceptance Not Required for Having Copies.</b>
|
||||
</p>
|
||||
<p>
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
</p>
|
||||
<p>
|
||||
<b>10. Automatic Licensing of Downstream Recipients.</b>
|
||||
</p>
|
||||
<p>
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
</p>
|
||||
<p>
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
</p>
|
||||
<p>
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
</p>
|
||||
<p>
|
||||
<b>11. Patents.</b>
|
||||
</p>
|
||||
<p>
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
</p>
|
||||
<p>
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
</p>
|
||||
<p>
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
</p>
|
||||
<p>
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
</p>
|
||||
<p>
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
</p>
|
||||
<p>
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
</p>
|
||||
<p>
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
</p>
|
||||
<p>
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
</p>
|
||||
<p>
|
||||
<b>12. No Surrender of Others' Freedom.</b>
|
||||
</p>
|
||||
<p>
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
</p>
|
||||
<p>
|
||||
<b>13. Use with the GNU Affero General Public License.</b>
|
||||
</p>
|
||||
<p>
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
</p>
|
||||
<p>
|
||||
<b>14. Revised Versions of this License.</b>
|
||||
</p>
|
||||
<p>
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
</p>
|
||||
<p>
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
</p>
|
||||
<p>
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
</p>
|
||||
<p>
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
</p>
|
||||
<p>
|
||||
<b>15. Disclaimer of Warranty.</b>
|
||||
</p>
|
||||
<p>
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
</p>
|
||||
<p>
|
||||
<b>16. Limitation of Liability.</b>
|
||||
</p>
|
||||
<p>
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
</p>
|
||||
<p>
|
||||
<b>17. Interpretation of Sections 15 and 16.</b>
|
||||
</p>
|
||||
<p>
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
</p>
|
||||
<br/>
|
||||
<center><b>END OF TERMS AND CONDITIONS</b></center>
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
444
doc/MemoryManagement.html
Normal file
|
@ -0,0 +1,444 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Automatic Memory Management in newLISP</title>
|
||||
<style type="text/css" media="screen">
|
||||
<!--
|
||||
body, h4, p {
|
||||
font-family: Lucida Sans, Helvetica, sans-serif;
|
||||
line-height: 120%;
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
margin-top: 3%;
|
||||
font-family: Lucida Sans, Helvetica, sans-serif;
|
||||
line-height: 120%;
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 0px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
border-style: solid;
|
||||
border-width: 0px;
|
||||
border-color: #888888;
|
||||
padding: 3px;
|
||||
background: #f8ffff;
|
||||
font-size: 95%;
|
||||
}
|
||||
|
||||
th {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #888888;
|
||||
padding: 3px;
|
||||
background: #eeeeee;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
td {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #888888;
|
||||
padding: 3px;
|
||||
background: #f8ffff;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
border-style: dashed;
|
||||
border-width: 1px;
|
||||
border-color: #888888;
|
||||
padding: 4px;
|
||||
font-family: Andale Mono, "Bitstream Vera Sans Mono", Monaco, "Courier New";
|
||||
font-size: 90%;
|
||||
background: #f8ffff;
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: Andale Mono, "Bitstream Vera Sans Mono", Monaco, "Courier New";
|
||||
font-size: 100%;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body text="#000000" bgcolor="#FFFFFF" link="#376590" vlink="#551A8B" alink="#ffAA28">
|
||||
|
||||
<br/>
|
||||
<blockquote>
|
||||
<center><h2>Automatic Memory Management in newLISP</h2></center>
|
||||
<center><font size="-1">Lutz Mueller, 2004-2015. Last edit 2013-11-07<br/>
|
||||
</font></center>
|
||||
|
||||
<center><blockquote><blockquote><i>
|
||||
ORO (One Reference Only) automatic memory management developed for newLISP is a fast
|
||||
and resources saving alternative to classic garbage collection algorithms in dynamic,
|
||||
interactive programming languages. This article explains how ORO memory management works</i>
|
||||
</blockquote></blockquote></center>
|
||||
|
||||
<p>newLISP and any other interactive language system will constantly generate new memory
|
||||
objects during expression evaluation. The new memory objects are intermediate evaluation results,
|
||||
reassigned memory objects, or memory objects whose content was changed. If newLISP did not
|
||||
delete some of the objects created, it would eventually run out of available memory.</p>
|
||||
|
||||
<p>In order to understand newLISP's automatic memory management, it is necessary to first
|
||||
review the traditional methods employed by other languages.</p>
|
||||
|
||||
<h3>Traditional automatic memory management (Garbage Collection)</h3>
|
||||
|
||||
<p>In most programming languages, a process registers allocated memory, and another
|
||||
process finds and recycles the unused parts of the allocated memory pool. The recycling
|
||||
process can be triggered by some memory allocation limit or can be scheduled to happen
|
||||
between evaluation steps. This form of automatic memory management is called
|
||||
<i>Garbage Collection</i>.</p>
|
||||
|
||||
<p>Traditional garbage collection schemes developed for LISP employed one of two
|
||||
algorithms: ¹</p>
|
||||
|
||||
<p>(1) The <i>mark-and-sweep</i> algorithm registers each allocated memory object. A mark
|
||||
phase periodically flags each object in the allocated memory pool. A named object
|
||||
(a variable symbol) directly or indirectly references each memory object in the system.
|
||||
The sweep phase frees the memory of the marked objects when they are no longer in use.</p>
|
||||
|
||||
<p>(2) A <i>reference-counting</i> scheme registers each allocated memory object together
|
||||
with a count of references to the object. This reference count gets incremented or decremented
|
||||
during expression evaluation. Whenever an object's reference count reaches zero, the object's
|
||||
allocated memory is freed.</p>
|
||||
|
||||
<p>Over time, many elaborate garbage collection schemes have been attempted based on these
|
||||
principles. The first garbage collection algorithms appeared in LISP. The inventors of
|
||||
the Smalltalk language used more elaborate garbage collection schemes. The history of
|
||||
Smalltalk-80 is an exciting account of the challenges of implementing memory management
|
||||
in an interactive programming language;
|
||||
see [Glenn Krasner, 1983: <i>Smalltalk-80, Bits of History, Words of Advice</i>].
|
||||
A more recent overview of garbage collection methods can be found in
|
||||
[Richard Jones, Rafael Lins, 1996: <i>Garbage Collection, Algorithms for
|
||||
Automatic Dynamic Memory Management</i>].</p>
|
||||
|
||||
|
||||
<h3>One reference only, (ORO) memory management</h3>
|
||||
|
||||
<p>Memory management in newLISP does not rely on a garbage collection algorithm. Memory is
|
||||
not marked or reference-counted. Instead, a decision whether to delete a newly created memory
|
||||
object is made right after the memory object is created.</p>
|
||||
|
||||
<p>Empirical studies of LISP have shown that most LISP cells are not shared and so can be
|
||||
reclaimed during the evaluation process. Aside from some optimizations for part of the
|
||||
built-in functions, newLISP deletes memory new objects containing intermediate evaluation results
|
||||
once it reaches a higher evaluation level. newLISP does this by pushing a reference to each
|
||||
created memory object onto a result stack. When newLISP reaches a higher evaluation level, it
|
||||
removes the last evaluation result's reference from the result stack and deletes the evaluation
|
||||
result's memory object. This should not be confused with one-bit reference counting. ORO memory
|
||||
management does not set bits to mark objects as <i>sticky</i>.</p>
|
||||
|
||||
<p>newLISP follows a one reference only (ORO) rule. Every memory object not referenced by a
|
||||
symbol is obsolete once newLISP reaches a higher evaluation level during
|
||||
expression evaluation. Objects in newLISP (excluding symbols and contexts) are passed by value
|
||||
copy to other user-defined functions. As a result, each newLISP object only requires one
|
||||
reference.</p>
|
||||
|
||||
<p>newLISP's ORO rule has advantages. It simplifies not only memory management but also
|
||||
other aspects of the newLISP language. For example, while users of traditional LISP
|
||||
have to distinguish between equality of copied memory objects and equality of references
|
||||
to memory objects, newLISP users do not.</p>
|
||||
|
||||
<p>newLISP's ORO rule forces newLISP to constantly allocate and then free LISP cells.
|
||||
newLISP optimizes this process by allocating large chunks of cell memory from the host
|
||||
operating system. newLISP will request LISP cells from a free cell list and then recycle
|
||||
those cells back into that list. As a result, only a few CPU instructions (pointer assignments)
|
||||
are needed to unlink a free cell or to re-insert a deleted cell.</p>
|
||||
|
||||
<p>The overall effect of ORO memory management is a faster evaluation time and a smaller memory
|
||||
and disk footprint than traditional interpreted LISP's can offer. Time spent linking and
|
||||
unlinking memory objects is more than compensated for by the lack of processing time used in
|
||||
traditional garbage collection. ORO memory management also avoids occasional processing
|
||||
pauses seen in languages using traditional garbage collection and the tuning of garbage
|
||||
collection parameters required when running memory intensive programs.</p>
|
||||
|
||||
<p>ORO memory management happens synchronous to other processing in the interpreter, which
|
||||
results in deterministic processing times.</p>
|
||||
|
||||
<p>In versions before 10.1.3, newLISP employed a classic mark and sweep algorithm to
|
||||
free un-referenced cells under error conditions. Starting version 10.1.3, this has been
|
||||
eliminated and replaced by a proper cleanup of the result stack under error conditions.</p>
|
||||
|
||||
<h3>Performance considerations with copying parameters</h3>
|
||||
|
||||
<p>In theory, passing parameters to user-defined functions by value (memory copying) instead
|
||||
by reference poses a potential disadvantage when dealing with large lists, arrays or strings.
|
||||
But in practice newLISP performs faster or as fast than other scripting languages and offers
|
||||
language facilities to pass very large memory object by reference.</p>
|
||||
|
||||
<p>Since newLISP version 9.4.5 functions can pass list, array and string type parameters
|
||||
as references using <i>default functor</i> namespace ids. Namespaces (called contexts
|
||||
in newLISP) have very little overhead and can be used to wrap functions and data.
|
||||
This allows reference passing of large memory object into user-defined functions.</p>
|
||||
|
||||
<p>Since version 10.2 FOOP (Functional Object Oriented Programming) in newLISP also passes
|
||||
the target object of a method call by reference.</p>
|
||||
|
||||
<p>But even in instances where reference passing and other optimizations are nor present,
|
||||
the speed of ORO memory management more than compensates for the overhead required to
|
||||
copy and delete objects.</p>
|
||||
|
||||
<h3>Optimizations to ORO memory management ²</h3>
|
||||
|
||||
<p>Since newLISP version 10.1, all lists, arrays and strings are passed in and out of
|
||||
built-in functions by reference. All built-in functions work directly on memory
|
||||
objects returned by reference from other built-in functions. This has substantially
|
||||
reduced the need for copying and deleting memory objects and increased the speed of
|
||||
some built-in functions. Now only parameters into user-defined functions and return
|
||||
values passed out of user-defined functions are ORO managed.</p>
|
||||
|
||||
<p>Since version 10.3.2, newLISP checks the result stack before copying LISP cells.
|
||||
This has reduced the amount of cells copied by about 83% and has significantly
|
||||
increased the speed of many operations on bigger lists.</p>
|
||||
|
||||
<h3>Memory and datatypes in newLISP</h3>
|
||||
|
||||
<p>The memory objects of newLISP strings are allocated from and freed to the host's OS,
|
||||
whenever newLISP recycles the cells from its allocated chunks of cell memory. This means
|
||||
that newLISP handles cell memory more efficiently than string memory. As a result, it is
|
||||
often better to use symbols rather than strings for efficient processing. For example,
|
||||
when handling natural language it is more efficient to handle natural language words as
|
||||
individual symbols in a separated name-space, then as single strings.
|
||||
The <tt>bayes-train</tt> function in newLISP uses this method. newLISP can handle
|
||||
millions of symbols without degrading performance.</p>
|
||||
|
||||
<p>Programmers coming from other programming languages frequently overlook that symbols in
|
||||
LISP can act as more than just variables or object references. The symbol is a useful data
|
||||
type in itself, which in many cases can replace the string data type.</p>
|
||||
|
||||
<p>Integer numbers and double floating-point numbers are stored directly in newLISP's LISP
|
||||
cells and do not need a separate memory allocation cycle.</p>
|
||||
|
||||
<p>For efficiency during matrix operations like matrix multiplication or inversion, newLISP
|
||||
allocates non-cell memory objects for matrices, converts the results to LISP cells, and then
|
||||
frees the matrix memory objects.</p>
|
||||
|
||||
<p>newLISP allocates an array as a group of LISP cells. The LISP cells are allocated linearly.
|
||||
As a result, array indices have faster random access to the LISP cells. Only a subset of
|
||||
newLISP list functions can be used on arrays. Automatic memory management in newLISP handles
|
||||
arrays in a manner similar to how it handles lists.</p>
|
||||
|
||||
<h3>Implementing ORO memory management</h3>
|
||||
|
||||
<p>The following pseudo code illustrates the algorithm implemented in newLISP in the context
|
||||
of LISP expression evaluation. Only two functions and one data structure are necessary to
|
||||
implement ORO memory management:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
function pushResultStack(evalationResult)
|
||||
|
||||
function popResultStack() ; implies deleting
|
||||
|
||||
array resultStack[] ; preallocated stack area
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The first two functions <tt>pushResultStack</tt> and <tt>popResultStack</tt> push or
|
||||
pop a LISP object handle on or off a stack. <tt>pushResultStack</tt> increases the value
|
||||
<tt>resultStackIndex</tt> while <tt>popResultStack</tt> decreases it. In newLISP every
|
||||
object is contained in a LISP cell structure. The object handle of that structure is simply
|
||||
the memory pointer to the cell structure. The cell itself may contain pointer addresses to
|
||||
other memory objects like string buffers or other LISP cells linked to the original object.
|
||||
Small objects like numbers are stored directly. In this paper function
|
||||
<tt>popResultStack()</tt> also implies that the popped object gets deleted.</p>
|
||||
|
||||
<p>The two <tt>resultStack</tt> management functions described are called by newLISP's
|
||||
<tt>evaluateExpression</tt> function: ³</p>
|
||||
|
||||
<blockquote><pre>
|
||||
function evaluateExpression(expr)
|
||||
{
|
||||
resultStackIndexSave = resultStackIndex
|
||||
|
||||
if typeOf(expr) is BOOLEAN or NUMBER or STRING
|
||||
return(expr)
|
||||
|
||||
if typeOf(expr) is SYMBOL
|
||||
return(symbolContents(expr))
|
||||
|
||||
if typeOf(expr) is QUOTE
|
||||
return(quoteContents(expr))
|
||||
|
||||
if typeOf(expr) is LIST
|
||||
{
|
||||
func = evaluateExpression(firstOf(expr))
|
||||
args = rest(expr)
|
||||
if typeOf(func) is BUILTIN_FUNCTION
|
||||
result = evaluateFunc(func, args)
|
||||
else if typeOf(func) = LAMBDA_FUNCTION
|
||||
result = evaluateLambda(func, args)
|
||||
}
|
||||
}
|
||||
|
||||
while (resultStackIndex > resultStackIndexSave)
|
||||
deleteList(popResultStack())
|
||||
|
||||
pushResultStack(result)
|
||||
|
||||
return(result)
|
||||
}
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The function <tt>evaluateExpression</tt> introduces the two variables
|
||||
<tt>resultStackIndexSave</tt> and <tt>resultStackIndex</tt> and a few other functions:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<tt>resultStackIndex</tt> is an index pointing to the top element in the
|
||||
<tt>resultStack</tt>. The deeper the level of evaluation the higher the value of
|
||||
<tt>resultStackIndex</tt>.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
<tt>resultStackIndexSave</tt> serves as a temporary storage for the value of
|
||||
<tt>resultStackIndex</tt> upon entry of the <tt>evaluateExpression(func, args)</tt> function.
|
||||
Before exit the <tt>resultStack</tt> is popped to the saved level of <tt>resultStackIndex</tt>.
|
||||
Popping the <tt>resultStack</tt> implies deleting the memory objects pointed to by entries in
|
||||
the <tt>resultStack</tt>.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
<tt>resultStack[]</tt> is a preallocated stack area for saving pointers to LISP cells
|
||||
and indexed by <tt>resultStackIndex</tt>.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
<tt>symbolContents(expr)</tt> and <tt>quoteContents(expr)</tt> extract contents from symbols
|
||||
or quote-envelope cells.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
<tt>typeOf(expr)</tt> extracts the type of an expression, which is either a <tt>BOOLEAN</tt>
|
||||
constant like <tt>nil</tt> or <tt>true</tt> or a <tt>NUMBER</tt> or <tt>STRING</tt>, or is
|
||||
a variable <tt>SYMBOL</tt> holding some contents, or a <tt>QUOTE</tt> serving as an envelope
|
||||
to some other <tt>LIST</tt> expression <tt>expr</tt>.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
<tt>evaluateFunc(func, args)</tt> is the application of a built-in function to its arguments.
|
||||
The built-in function is the evaluated first member of a list in <tt>expr</tt> and the
|
||||
arguments are the <tt>rest</tt> of the list in <tt>expr</tt>. The function <tt>func</tt> is
|
||||
extracted calling <tt>evaluateExpression(first(expr))</tt> recursively. For example if the
|
||||
expression (<tt>expr</tt> is <tt>(foo x y)</tt> than <tt>foo</tt> is a built-in function and
|
||||
<tt>x</tt> and <tt>y</tt> are the function arguments or parameters.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
<tt>evaluateLambda(func, args)</tt> works similar to <tt>evaluateFunc(func, args)</tt>, applying
|
||||
a user-defined function <tt>first(expr)</tt> to its arguments in <tt>rest(expr)</tt>. In case
|
||||
of a user-defined function we have two types of arguments in <tt>rest(expr)</tt>, a list of local
|
||||
parameters followed by one or more body expressions evaluated in sequence.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Both, <tt>evaluateFunc(func, args)</tt> and <tt>evaluateLambda(func, args)</tt> will return
|
||||
a newly created or copied LISP cell object, which may be any type of the above mentioned
|
||||
expressions. Since version 10.0, many built-in functions processed with
|
||||
<tt>evaluateFunc(func, args)</tt> are optimized and return references instead of a newly
|
||||
created or copied objects. Except for these optimizations, <tt>result</tt> values will always
|
||||
be newly created LISP cell objects destined to be destroyed on the next higher evaluation level,
|
||||
after the current <tt>evaluateExpression(expr)</tt> function execution returned.</p>
|
||||
|
||||
<p>Both functions will recursively call <tt>evaluateExpression(expr)</tt> to evaluate their
|
||||
arguments. As recursion deepens, the recursion level of the function increases.</p>
|
||||
|
||||
<p>Before <tt>evaluateExpression(func, args)</tt> returns, it will pop the <tt>resultStack</tt>
|
||||
deleting the <tt>result</tt> values from deeper level of evaluation and returned by one of
|
||||
the two functions, either <tt>evaluateFunc</tt> or <tt>evaluateLambda</tt>.</p>
|
||||
|
||||
<p>Any newly created <tt>result</tt> expression is destined to be destroyed later but its
|
||||
deletion is delayed until a higher, less deep, level of evaluation is reached. This permits
|
||||
results to be used and/or copied by calling functions.</p>
|
||||
|
||||
<p>The following example shows the evaluation of a small user-defined LISP function
|
||||
<tt>sum-of-squares</tt> and the creation and deletion of associated memory objects:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
(define (sum-of-squares x y)
|
||||
(+ (* x x) (* y y)))
|
||||
|
||||
(sum-of-squares 3 4) => 25
|
||||
</pre></blockquote>
|
||||
|
||||
<p><tt>sum-of-squares</tt> is a user-defined <em>lambda-function</em> calling to <em>built-in</em>
|
||||
functions <tt>+</tt> and <tt>*</tt>.</p>
|
||||
|
||||
<p>The following trace shows the relevant steps when defining the <tt>sum-of-squares</tt> function
|
||||
and when executing it with the arguments <tt>3</tt> and <tt>4</tt>.</p>
|
||||
|
||||
<blockquote><pre>
|
||||
> (define (sum-of-squares x y) (+ (* x x) (* y y)))
|
||||
|
||||
level 0: evaluateExpression( (define (sum-of-squares x y)
|
||||
(+ (* x x) (* y y))) )
|
||||
level 1: evaluateFunc( define <6598> )
|
||||
level 1: return( (lambda (x y) (+ (* x x) (* y y))) )
|
||||
|
||||
<b>→ (lambda (x y) (+ (* x x) (* y y)))</b>
|
||||
|
||||
> (sum-of-squares 3 4)
|
||||
|
||||
level 0: evaluateExpression( (sum-of-squares 3 4) )
|
||||
level 1: evaluateLambda( (lambda (x y) (+ (* x x) (* y y))), (3 4) )
|
||||
level 1: evaluateExpression( (+ (* x x) (* y y)) )
|
||||
level 2: evaluateFunc( +, ((* x x) (* y y)) )
|
||||
level 2: evaluateExpression( (* x x) )
|
||||
level 3: evaluateFunc( *, (x x) )
|
||||
level 3: pushResultStack( 9 )
|
||||
level 3: return( 9 )
|
||||
level 2: evaluateExpression( (* y y) )
|
||||
level 3: evaluateFunc( *, (y y) )
|
||||
level 3: pushResultStack( 16 )
|
||||
level 3: return( 16 )
|
||||
level 2: popResultStack() → 16
|
||||
level 2: popResultStack() → 9
|
||||
level 2: pushResultStack( 25 )
|
||||
level 2: return( 25 )
|
||||
level 1: return( 25 )
|
||||
|
||||
<b>→ 25</b>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The actual C-language implementation is optimized in some places to avoid pushing the
|
||||
<tt>resultStack</tt> and avoid calling <tt>evaluateExpression(expr)</tt>. Only the most
|
||||
relevant steps are shown. The function <tt>evaluateLambda(func, args)</tt> does not need
|
||||
to evaluate its arguments <tt>3</tt> and <tt>4</tt> because they are constants, but
|
||||
<tt>evaluateLambda(func, args)</tt> will call <tt>evaluateExpression(expr)</tt> twice to
|
||||
evaluate the two body expressions <tt>(+ (* x x)</tt> and <tt>(+ (* x x)</tt>. Lines
|
||||
preceded by the prompt <tt>></tt> show the command-line entry.</p>
|
||||
|
||||
<p><tt>evaluateLambda(func, args)</tt> also saves the environment for the variable symbols
|
||||
<tt>x</tt> and <tt>y</tt>, copies parameters into local variables and restores the old
|
||||
environment upon exit. These actions too involve creation and deletion of memory objects.
|
||||
Details are omitted, because they are similar to methods in other dynamic languages.</p>
|
||||
<br/>
|
||||
|
||||
<h3>References</h3>
|
||||
– Glenn Krasner, 1983: <i>Smalltalk-80, Bits of History, Words of
|
||||
Advice</i><br/>
|
||||
Addison Wesley Publishing Company<br/>
|
||||
<br/>
|
||||
– Richard Jones, Rafael Lins, 1996: <i>Garbage Collection, Algorithms
|
||||
for Automatic Dynamic Memory Management</i><br/>
|
||||
John Wiley & Sons <br/>
|
||||
<br/>
|
||||
¹ <font size="-1">Reference counting and mark-and-sweep algorithms where specifically
|
||||
developed for LISP. Other schemes like copying or generational algorithms where developed
|
||||
for other languages like Smalltalk and later also used in LISP.</font>
|
||||
<br/><br/>
|
||||
² <font size="-1">This chapter was added in October 2008 and extended August 2011.</font>
|
||||
<br/><br/>
|
||||
³ <font size="-1">This is a shortened rendition of expression evaluation
|
||||
not including handling of default functors and implicit indexing.
|
||||
For more information on expression evaluation see: <a href="http://www.newlisp.org/ExpressionEvaluation.html">Expression evaluation, Implicit Indexing, Contexts and Default Functors in the newLISP Scripting Language</a>.
|
||||
</font>
|
||||
<br/><br/>
|
||||
<center><font size="-1">Copyright © 2004-2016, Lutz Mueller
|
||||
<a href="http://newlisp.org">http://newlisp.org</a>. All rights reserved. </font></center>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
32
doc/README-OS2
Normal file
|
@ -0,0 +1,32 @@
|
|||
Build newLISP on OS2
|
||||
|
||||
The quickest way to compile the OS2 version is by use of the gcc environment
|
||||
package by Paul Smedley (smedley.info). Install the GCC 335 build and folow
|
||||
the instructions.
|
||||
|
||||
If you want a different GCC released by i.e. Paul Smedley then install that
|
||||
beside the gcc 335 release. It is described how to do that. You can of course
|
||||
get gcc itself from ftp.netlabs.org too.
|
||||
|
||||
After the "make os2" from within your newlisp-x.x.x release directory you can
|
||||
copy manualy the newlisp.exe to a location, "make install" can be used to but
|
||||
the "guiserver" for OS/2 does not exist as java 1.5 is not ported yet to OS/2.
|
||||
"make uninstall" doesn't therefore work correctly either (this will be changed).
|
||||
|
||||
The readline library should be able to compile but is not included currently
|
||||
in the makefile_os2 yet (working on it). The latest readline unix port for
|
||||
OS/2 must be obtained v5.2. But give it a try using the configure-alt script,
|
||||
and contact Ted if it doesn't work.
|
||||
|
||||
There are some differences when using newlisp.exe in an OS/2 enviroment,
|
||||
as you are working in a cmd.exe environment or bash. I'll try to define those.
|
||||
|
||||
Known issues in newlisp/2:
|
||||
|
||||
The newlisp functions 'spawn & 'share don't work, as the OS/2 gcc port doesn't
|
||||
have yet a good alternative for mmap. 'import is under investigation as it
|
||||
behaves strange with gcc 335.
|
||||
|
||||
newlisp/2 is tested and built on Ecomstation Rc2.
|
||||
The port is done by norman at http://newlisp2.nodep.nl
|
||||
|
10
doc/TRU64BUILD
Normal file
|
@ -0,0 +1,10 @@
|
|||
Building newLISP for HP's Tru64 OS
|
||||
==================================
|
||||
|
||||
The following now will make newLISP for the tru64 OS and using the Compaq
|
||||
C compiler for the Alpha CPU:
|
||||
|
||||
make
|
||||
|
||||
Please contact Peter van Eerten (peter AT gtk-server DOT org) for any
|
||||
remaining questions.
|
14
doc/index.cgi
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
(print "Content-type: text/html\r\n\r\n")
|
||||
(println "<h2>" (real-path) "</h2>")
|
||||
|
||||
(println {<table>})
|
||||
(dolist (file (sort (directory)))
|
||||
(set 'slash (if (directory? file) "/" ""))
|
||||
(println {<tr><td><tt><a href="http:} file slash {">} file slash {</a> </tt></td><td><tt>}
|
||||
(date (last (file-info file)) 0 "%Y-%m-%d %H:%M:%S") {</tt></td>}
|
||||
{<td><pre>} (format "%12.3f KB" (div (file-info file 0) 1000)) {</pre></td></tr>}))
|
||||
(println {</table>})
|
||||
(exit)
|
||||
|
16
doc/manual_frame.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta name="author" content="Lutz Mueller" />
|
||||
<meta name="keywords" content="newLISP LISP SCHEME manual reference help artificial intelligence AI NUEVATEC" />
|
||||
<meta name="description" content="newLISP Users Manual and Reference" />
|
||||
<title>newLISP Manual and Reference</title>
|
||||
</head>
|
||||
<frameset cols="175px,*">
|
||||
<frame name="index" src="newlisp_index.html" noresize="noresize" frameborder="0" />
|
||||
<frame name="body" src="newlisp_manual.html" noresize="noresize" frameborder="0"/>
|
||||
</frameset>
|
||||
</html>
|
197
doc/newLISP-10.7.0-Release.html
Normal file
|
@ -0,0 +1,197 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>newLISP v.1.7.0 Release Notes </title>
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
h1 {
|
||||
font-family:Optima, Georgia, Times New Roman, Times, serif;
|
||||
font-size: 200%;
|
||||
font-weight: 500;
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
h2, h3 {
|
||||
font-family: Lucida Sans, Helvetica, sans-serif;
|
||||
color: #404040;
|
||||
line-height: 120%;
|
||||
}
|
||||
|
||||
body, p {
|
||||
font-family: Lucida Sans, Helvetica, sans-serif;
|
||||
color: #404040;
|
||||
line-height: 120%;
|
||||
font-size: 110%;
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: Courier;
|
||||
color: #606060;
|
||||
line-height: 120%;
|
||||
}
|
||||
|
||||
em {
|
||||
font-family: Courier;
|
||||
color: #606060;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>newLISP<font size=-1>®</font> v.10.7.0 Stable Release
|
||||
<font color="red" size="-1">2016-01-21</font></h1>
|
||||
|
||||
<p>This stable release adds new functionality to existing functions,
|
||||
adds one new function and fixes bugs.</p>
|
||||
|
||||
|
||||
<h3>Additions and changes</h3>
|
||||
|
||||
<ul>
|
||||
<li>The installation location prefix for OS X, Linux and other Unix like
|
||||
platforms has been changed from <tt>/usr</tt> to <tt>/usr/local</tt> for
|
||||
installation in the <tt>/usr/local/</tt> directory. See also the file
|
||||
<tt>makefile-original-install</tt> in the main source directory.</li>
|
||||
|
||||
<li>On Mac OS X, when starting <tt>guiserver.jar</tt> first, when it is not
|
||||
loaded by another newLISP program, <tt>guiserver.jar</tt> expects the newlisp
|
||||
executable in <tt>/usr/local/bin/newlisp</tt>. On other UNIX the newlisp
|
||||
executable must be in the executable path of the operating system.</li>
|
||||
|
||||
<li>On MS Windows, newLISP can now be compiled as a 64-bit executable.
|
||||
Thanks to <i>Shigeru Kobayashi</i> for doing most of this work.</li>
|
||||
|
||||
<li><tt>dolist</tt> now also accepts arrays.</li>
|
||||
|
||||
<li>The <tt>net-eval</tt> function now returns the evaluation
|
||||
of the last expression passed, not the first. The possibility of
|
||||
passing more than one expression in <tt>net-eval</tt> is not
|
||||
documented.</li>
|
||||
|
||||
<li>The system variable <tt>ostype</tt> on MS Windows now reports
|
||||
the string <tt>"Windows"</tt>. In previous version 1.62 <tt>"Win32"</tt>
|
||||
was reported.</li>
|
||||
|
||||
<li>The <tt>net-eval</tt> connection timeout has changed to 15 seconds
|
||||
from 60 secconds. The processing timeout while connected can still be set
|
||||
by the user in a <tt>net-eval</tt> parameter.</li>
|
||||
|
||||
<li>The environment variable <tt>HTTP_AUTHORIZATION</tt> has been
|
||||
added to the variables handled in HTTP server mode.</li>
|
||||
|
||||
<li>In <tt>date-value</tt> the date and time numbers can now be
|
||||
given in one list instead of separate number parameters using and
|
||||
additional syntax.</li>
|
||||
|
||||
<li>The <tt>date-list</tt> function, when given without a parameter,
|
||||
now returns the date list for the current UTC date and time value.</li>
|
||||
|
||||
<li>The <tt>trim</tt> function without trim character parameters will
|
||||
now trim all white-space characters, not only spaces.</li>
|
||||
|
||||
<li><tt>dump</tt> now returns the number of cells dumped. Previously
|
||||
<tt>true</tt> was returned.</li>
|
||||
|
||||
<li>A new <tt>trace</tt> syntax <tt>(trace <em>int-device</em>)</tt> writes
|
||||
all expression entries and exit results to the device given.
|
||||
<em>int-device</em> can be the handle of an <tt>open</tt>'ed file or
|
||||
<tt>1</tt> for <em>stdout</em>.</li>
|
||||
|
||||
<li>The stack trace in error messages now prints the entire expression
|
||||
passed for evaluation, not only the function name.</li>
|
||||
|
||||
<li>The <tt>tmp</tt> directory is now defined during newLISP startup.
|
||||
For UNIX this is <tt>/tmp</tt>, for Windows it is taken from the
|
||||
<tt>TMP</tt> environment variable or assumed as <tt>/tmp</tt> when <tt>TMP</tt>
|
||||
is not defined. The directory is used by the built-in function <tt>share</tt>
|
||||
and the built-in HTTPD server.</li>
|
||||
|
||||
<li>A new newLISP library call <tt>(newlispLibConsole 1)</tt> forces console
|
||||
output to <em>stdout</em> instead of writing to the return string of
|
||||
<tt>newlispEvalStr</tt>. The same call also enables console input via
|
||||
<em>stdin</em>.</li>
|
||||
|
||||
<li>In <tt>get/put/post-url</tt> the new string option <tt>"raw"</tt> inhibits
|
||||
'Location' redirection. <tt>"raw"</tt> parameter can also be combined with the
|
||||
<tt>"list"</tt> and <tt>"debug"</tt> options, e.g. <tt>"raw debug"</tt>.</li>
|
||||
|
||||
<li>In <tt>get/put/post-url</tt> list mode the second string in the returned list
|
||||
contains only the returned content. The third list member is the server HTTP
|
||||
response line. The fourth list member contains the status-code, which is 0 for an
|
||||
invalid HTTP response.</li>
|
||||
|
||||
<li>The <tt>save</tt> function now saves symbols with strings longer than 2027
|
||||
characters appending multiple partial lines delimited by quotes <tt>"..."</tt>.
|
||||
This way lines can contain escape characters which are not allowed when using
|
||||
<tt>[text]...[/text]</tt> tags as delimiters.</li>
|
||||
|
||||
<li>When using a new second <tt>seed</tt> syntax, all randomizing functions are
|
||||
based on a random generator independent of platforms and compilers used to built
|
||||
newLISP. When seeding using the second syntax all random functions called subsequenly
|
||||
like <tt>amb</tt>, <tt>normal</tt>, <tt>rand</tt>, <tt>random</tt> and <tt>randomize</tt>
|
||||
are based on this platform independent random generator. After initializing with
|
||||
the new <tt>seed</tt> syntax a subsequent call to <tt>seed</tt> without parameters
|
||||
returns the current seed state of the random generator, which can be used at a later
|
||||
time to seed the generator for the same state in a sequence.</li>
|
||||
|
||||
<li>A new <tt>ssq</tt> function returns the Sum of SQquares (SSQ) for a list or array
|
||||
vector.</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
<h3>Bug fixes</h3>
|
||||
|
||||
<ul>
|
||||
<li><tt>date-list</tt> crashed for negative values on some MS Windows versions.</li>
|
||||
|
||||
<li>The <tt>det</tt> and <tt>mat</tt> functions now give an
|
||||
error message when passed the wrong dimensions.</li>
|
||||
|
||||
<li>HTTP server mode now works correctly with Apache server, when the environment
|
||||
variables NEWLISPDIR and PROGRAMFILES are not defined. Default file paths
|
||||
are then assumed for these variables.</li>
|
||||
|
||||
<li>HTTP only server mode with command-line switch <tt>-http</tt> did not
|
||||
reject <tt>net-eval</tt> requests.</li>
|
||||
|
||||
<li><tt>expand</tt> could crash when evaluating binding lists.</li>
|
||||
|
||||
<li>The <tt>json-parse</tt> function now handles 64-bit numbers also in 32-bit
|
||||
versions of newLISP.</li>
|
||||
|
||||
<li>Response string from <tt>get- put- post-url</tt> was not zero-terminated for
|
||||
HTTP error returns.</li>
|
||||
|
||||
<li><tt>date-value</tt> did not evaluate month, day parameters.</li>
|
||||
|
||||
<li>PCRE options PCRE_NOTBOL, PCRE_NOTEOL and PCRE_NOTEMPTY did not work.</li>
|
||||
|
||||
<li>Loading an empty file now returns <tt>nil</tt> instead of throwing an
|
||||
error.</li>
|
||||
|
||||
<li>guiserver.jar version 1.65 now correctly forces updates of a <tt>gs:canvas</tt>
|
||||
in a <tt>gs:scroll-pane</tt>.
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Compatibility with previous versions</h3>
|
||||
<p>This version is fully compatible with the previous development version 1.64 .</p>
|
||||
|
||||
<center>∂</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
334
doc/newLISPdoc.html
Normal file
|
@ -0,0 +1,334 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>newLISPdoc</title>
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
<!--
|
||||
span.arw {
|
||||
color:#666666;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
body, h4, p {
|
||||
font-family: Lucida Sans, Helvetica, sans-serif;
|
||||
line-height: 120%;
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
margin-top: 3%;
|
||||
font-family: Lucida Sans, Helvetica, sans-serif;
|
||||
line-height: 120%;
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: Andale Mono, "Bitstream Vera Sans Mono", Monaco, "Courier New";
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: Andale Mono, "Bitstream Vera Sans Mono", Monaco, "C5urier New";
|
||||
font-size: 100%;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin: 20px;" text="#222222" bgcolor="#FFFFFF"
|
||||
link="#376592" vlink="#551A8B" alink="#ffAA28">
|
||||
|
||||
<center>
|
||||
<h1>newLISPdoc - the newLISP documentation program</h1>
|
||||
<font size="-1">last edited 2015-04-16</font>
|
||||
</center>
|
||||
|
||||
<p>Comments in newLISP source files can be converted
|
||||
to HTML documentation using only a few tags in comments. The newLISPdoc system
|
||||
is designed to use a minimum of tags and leave the tagged comments still readable.</p>
|
||||
|
||||
<p>newLISPdoc also generates an index page for all newLISP source files
|
||||
generated.</p>
|
||||
|
||||
<p>See here for the <a href="http://newlisp.org/syntax.cgi?code/newlispdoc.txt">source of newLISPdoc</a> .
|
||||
The program and this documentation are also part of the
|
||||
source distribution of newLISP since version 9.0. Since newLISP version 9.1 syntax
|
||||
highlighting is built into <tt>newlispdoc</tt> which is installed
|
||||
in the same directory as the main newLISP executable program. The script
|
||||
<tt>syntax.cgi</tt> is still available for web site installations, but is not
|
||||
required anymore for <tt>newlispdoc</tt>.</p>
|
||||
|
||||
<h3>Usage</h3>
|
||||
<p>From within the directory where the modules are, execute with all module filenames
|
||||
to process on the commandline. For example to process the files <tt>mysql.lsp</tt>,
|
||||
<tt>odbc.lsp</tt> and <tt>sqlite3.lsp</tt> do:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
newlispdoc mysql.lsp odbc.lsp sqlite.lsp
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Or on Windows:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
newlisp newlispdoc mysql.lsp odbc.lsp sqlite.lsp
|
||||
</pre></blockquote>
|
||||
|
||||
<p>This will generate <tt>index.html</tt>, <tt>mysql.lsp.html</tt>, <tt>odbc.lsp.html</tt>
|
||||
and <tt>sqlite.lsp.html</tt> all in the same directory, where the command was executed.
|
||||
The page <tt>index.html</tt> contains links to all other pages.</p>
|
||||
|
||||
<p>If the current directory contains the file <tt>newlispdoc.css</tt>, HTML output
|
||||
will be formatted accordingly. For a sample file see
|
||||
<tt>util/newlispdoc.css</tt> in the source distribution.</p>
|
||||
|
||||
<p>The command line flag <tt>-s</tt> can be supplied to additionally
|
||||
generate syntax highlighted HTML versions of the source files and put a link
|
||||
to the highlighted version of the source file on the documentation page:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
newlispdoc -s mysql.lsp odbc.lsp sqlite.lsp
|
||||
newlispdoc -s *.lsp
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The <tt>-d</tt> flag supplies a download link to the raw source:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
newlispdoc -d *.lsp
|
||||
newlispdoc -s -d *.lsp
|
||||
</pre></blockquote>
|
||||
|
||||
<p>One or both options can be supplied.</p>
|
||||
|
||||
|
||||
<p>Or on Windows:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
newlisp newlispdoc -s mysql.lsp odbc.lsp sqlite.lsp
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Since version 1.3 of newLISPdoc a file containing URLs of source file locations
|
||||
can be specified. This allows indexing and documenting of newLISP source code distributed
|
||||
on different sites:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
newlispdoc -url file-with-urls.txt
|
||||
newlispdoc -s -url file-with-urls.txt
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Or on Windows:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
newlisp newlispdoc -url file-with-urls.txt
|
||||
newlisp newlispdoc -s -url file-with-urls.txt
|
||||
</pre></blockquote>
|
||||
|
||||
<p><tt>http://</tt> and <tt>file://</tt> URLs can be used. Like with individual files,
|
||||
the <tt>-s</tt> switch can be specified to generate also syntax highlighted source files.
|
||||
A URL file contains one URL per line. No other information is allowed in the file. The
|
||||
following is a sample URL file:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
http://asite.com/code/afile.lsp
|
||||
http://othersite.org/somefile.lsp
|
||||
file:///usr/home/joe/program.lsp
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The last line shows a file URL from the local filesystem.</p>
|
||||
|
||||
<p>All generated files will be written to the current directory.</p>
|
||||
|
||||
<h3>Tags</h3>
|
||||
|
||||
<p>The following tags start at the beginning of a line with
|
||||
2 semicolons and one space before the tag:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
;; @module one word for module name
|
||||
;; @index Title and URL for index page
|
||||
;; @description one line description of the module
|
||||
;; @location the original URL location of the source file
|
||||
;; @version one line version info
|
||||
;; @author one line for author info
|
||||
;; @syntax one line syntax pattern
|
||||
;; @param name description on one line
|
||||
;; @return description on one line
|
||||
;; @example multiline code example starting on next line
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The only required tag is either the <tt>@module</tt> tag or alternatively
|
||||
the <tt>@index</tt> tag. If neither one tag is present in the file, it will
|
||||
not be processed. All other tags are optional. Only lines starting with ;;
|
||||
(2 semicolons) are processed. Program comment text which should not appear
|
||||
in the documentation should start with only one semicolon.</p>
|
||||
|
||||
<p>The one line description of the <tt>@description</tt> tag will be put under the module
|
||||
name on the index and module doc page. This and the <tt>@location</tt> where added in
|
||||
June 2007, and are not part of the newlispdoc program in the newLISP v. 9.1 release.</p>
|
||||
|
||||
<p>A function may have multiple <tt>@syntax</tt> tags each on consecutive lines.</p>
|
||||
|
||||
<p>The following is the only tag, which can be embedded anywhere in
|
||||
the text. Between the tag link specification and description is exactly one
|
||||
space:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
@link link description
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Custom tags can be made up by just prepending the custom name with a <tt>@</tt>.
|
||||
The text after the custom tag will be translated as usual, e.g. it may contain
|
||||
a <tt>@link</tt> tag. Like in most other tags, text is limited to the same line.</p>
|
||||
|
||||
<p>All words between <tt><...></tt> angle braces are displayed in italic.
|
||||
Internally newLISPdoc uses <tt><em>,</em></tt> tags for formatting. They
|
||||
should be used for parameter specs after the @param tag and in text referring
|
||||
to those parameters..</p>
|
||||
|
||||
<p>All words between single quotes <tt>' ... '</tt> are printed in monospace.
|
||||
Internally newLISPdoc uses <tt><tt>,</tt></tt> tags for formatting.</p>
|
||||
|
||||
<p>All other lines starting with 2 semicolons contain descriptive
|
||||
text. An empty line with only 2 semicolons at the beginning
|
||||
is a break between paragraphs of text.</p>
|
||||
|
||||
<p>Lines not starting with 2 semicolons are ignored by newLISPdoc. This
|
||||
allows doing code comments with just one semicolon.</p>
|
||||
|
||||
<p>If more formatting is required than what is offered by newLISPdoc, the
|
||||
following simple HTML tags and their closing forms may also be used:
|
||||
<tt><h1></tt>,<tt><h2></tt>,<tt><h3></tt>,<tt><h4></tt>,
|
||||
<tt><i></tt>,<tt><em></tt>,<tt><b></tt>,<tt><tt></tt>,<tt><p></tt>,
|
||||
<tt><br></tt>,<tt><pre></tt>,<tt><center></tt>,<tt><blockquote></tt>
|
||||
and <tt><hr></tt>.</p>
|
||||
<h3>Linking to other module collections</h3>
|
||||
<p>newLISPdoc generates and index page for all modules documented. A special tag <tt>@index</tt>
|
||||
can be used to show a link on the index page to an index of other module collections. This way
|
||||
multilevel indices of modules can be created. To display a link to another module collection
|
||||
on the index page, create a file containing a <tt>@index</tt> and a <tt>@description</tt> link:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
; - other-collection.txt -
|
||||
;; @index OtherCollection http://example.com/modules
|
||||
;; @description Modules from OtherCollection
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Use one or more of these files on the newLISPdoc command line as any other
|
||||
source file:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
newlispdoc -s other-collection.txt *.lsp
|
||||
</pre></blockquote>
|
||||
|
||||
<p>This will show the index entry for OtherCollection on the module index before listing
|
||||
all modules in <tt>*.lsp</tt>.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="source"></a>
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>The following is the commented source of and example program
|
||||
followed by the pages generated in HTML:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
;; @module example.lsp
|
||||
;; @author John Doe, johndoe@example.com
|
||||
;; @version 1.0
|
||||
;;
|
||||
;; This module is an example module for the newlispdoc
|
||||
;; program, which generates automatic newLISP module
|
||||
;; documentation.
|
||||
|
||||
|
||||
;; @syntax (example:foo <num-repeat> <str-message>)
|
||||
;; @param <num-repeat> The number of times to repeat.
|
||||
;; @param <str-message> The message string to be printed.
|
||||
;; @return Returns the message in <str-message>
|
||||
;;
|
||||
;; The function 'foo' repeatedly prints a string to
|
||||
;; standard out terminated by a line feed.
|
||||
;;
|
||||
;; @example
|
||||
;; (example:foo 5 "hello world")
|
||||
;; =>
|
||||
;; "hello world"
|
||||
;; "hello world"
|
||||
;; "hello world"
|
||||
;; "hello world"
|
||||
;; "hello world"
|
||||
|
||||
(context 'example)
|
||||
|
||||
(define (foo n msg)
|
||||
(dotimes (i n)
|
||||
(println msg))
|
||||
)
|
||||
|
||||
;; See the @link http://example.com/example.lsp source .
|
||||
</pre></blockquote>
|
||||
|
||||
<p>Below the <tt>example.lsp.html</tt> and <tt>index.html</tt> page generated:</p>
|
||||
|
||||
<hr/>
|
||||
<a name="example"></a>
|
||||
<p><a href="#index">Module index</a></p><h2>Module: example.lsp</h2><b>Author: </b>John Doe, johndoe@example.com<br/>
|
||||
<b>Version: </b>1.0<br/>
|
||||
|
||||
<p>
|
||||
This module is an example module for the newlispdoc
|
||||
program, which generates automatic newLISP module
|
||||
documentation.
|
||||
</p>
|
||||
|
||||
|
||||
<p> </p><center>- § -</center><p> </p>
|
||||
<a name="example_foo"></a><h3>Syntax: (<font color=#CC0000>example:foo</font> <em>num-repeat</em> <em>str-message</em>)</h3>
|
||||
<b>parameter: </b><em>num-repeat</em> - The number of times to repeat.<br/>
|
||||
<b>parameter: </b><em>str-message</em> - The message string to be printed.<br/>
|
||||
<p><b>return: </b>Returns the message in <em>str-message</em></p>
|
||||
<p> </p>
|
||||
The function <tt>foo</tt> repeatedly prints a string to
|
||||
standard out terminated by a line feed.
|
||||
<p> </p>
|
||||
<p> </p><b>example:</b><blockquote><pre>
|
||||
(example:foo 5 "hello world")
|
||||
=>
|
||||
"hello world"
|
||||
"hello world"
|
||||
"hello world"
|
||||
"hello world"
|
||||
"hello world"</pre></blockquote>
|
||||
See the <a href="#source">source</a>.
|
||||
<p>#nbsp;</p><center>- ∂ -</center><br/>
|
||||
<center><font face='Arial' size='-2' color='#444444'>
|
||||
generated with <a href="http://newlisp.org">newLISP</a>
|
||||
and <a href="http://newlisp.org/newLISPdoc.html">newlispdoc</a>
|
||||
</font></center>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>Below the index page <tt>index.html</tt> which was generated. When more than one module is
|
||||
specified on the command line, the index page will show one link line for
|
||||
each module.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="index"></a>
|
||||
<center><h2>Index</h2></center>
|
||||
<blockquote>
|
||||
<h2><a href="#example">Module: example.lsp</a></h2>
|
||||
<a href="#example_foo">foo</a>
|
||||
<p> </p><center>- ∂ -</center><br/>
|
||||
<center><font face='Arial' size='-2' color='#444444'>
|
||||
generated with <a href="http://newlisp.org">newLISP</a>
|
||||
and <a href="http://newlisp.org/newLISPdoc.html">newlispdoc</a>
|
||||
</font></center>
|
||||
</blockquote>
|
||||
|
||||
<hr />
|
||||
|
||||
</body>
|
||||
</html>
|
172
doc/newlisp-man.txt
Normal file
|
@ -0,0 +1,172 @@
|
|||
newlisp(1) Commandline Parameters newlisp(1)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
newlisp - lisp like programming language
|
||||
|
||||
SYNOPSIS
|
||||
newlisp [-n] [-x source target] [-h | -v] [-c | -C | -http] [-t
|
||||
microseconds] [-s stack] [-m max-mem-megabyte] [[-l path-file | -L
|
||||
path-file] [-p port-number | -d port-number]] [-w directory]
|
||||
[lisp-files ...] [-e programtext]
|
||||
|
||||
DESCRIPTION
|
||||
Invokes newLISP which first loads init.lsp if present. Then one or more
|
||||
options and one or more newLISP source files can be specified. The
|
||||
options and source files are executed in the sequence they appear. For
|
||||
some options is makes sense to have source files loaded first like for
|
||||
the -p and -d options. For other options like -s and -m it is logical
|
||||
to specify these before the source files to be loaded. If a -e switch
|
||||
is used the programtext is evaluated and then newlisp exits otherwise
|
||||
evaluation continues interactively (unless an exit occurs during
|
||||
lisp-file interpretation).
|
||||
|
||||
OPTIONS
|
||||
-n Suppress loading of any init.lsp or .init.lsp initialization
|
||||
file.
|
||||
|
||||
-x source target
|
||||
Link the newLISP executable with a source file to built a new
|
||||
target executable.
|
||||
|
||||
-h Display a short help text.
|
||||
|
||||
-v Display a version string.
|
||||
|
||||
-c Suppress the commandline prompt.
|
||||
|
||||
-C Force prompt when running newLISP in pipe I/O mode for Emacs.
|
||||
|
||||
-http only accept HTTP commands
|
||||
|
||||
-s stacksize
|
||||
Stack size to use when starting newLISP. When no stack size is
|
||||
specified the stack defaults to 1024.
|
||||
|
||||
-m max-mem-megabyte
|
||||
Limits memory to max-cell-mem-megabyte megabytes for Lisp cell
|
||||
memory.
|
||||
|
||||
lisp-files
|
||||
Load and evaluate the specified lisp source files in sequence.
|
||||
Source files can be specified using URLs. If an (exit) is exe-
|
||||
cuted by one of the source files then newlisp exits and all pro-
|
||||
cessing ceases.
|
||||
|
||||
-e programtext
|
||||
Programtext is an expression enclosed in quotation marks which
|
||||
is evaluated and the result printed to standard out device (STD-
|
||||
OUT). In most UNIX system shells apostrophes can also be used to
|
||||
delimit the expression. newLISP exits after evaluation of pro-
|
||||
gramtext is complete.
|
||||
|
||||
-w directory
|
||||
Directory is the start up directory for newLISP. Any file refer-
|
||||
ence in a program will refer to this directory by default as the
|
||||
current directory. This can be used to define a web root direc-
|
||||
tory when in server mode.
|
||||
|
||||
-l -L path-file
|
||||
Log network connections and newLISP I/O to the file in
|
||||
path-file. -l will only log network connections or commandline
|
||||
input or net-eval requests. -L will additionally log HTTP
|
||||
requests and newLISP output from commandline and net-eval input.
|
||||
|
||||
-p port-number
|
||||
Listen for commands on a TCP/IP socket connection. In this case
|
||||
standard I/O is redirected to the port specified in the -p
|
||||
option. Any specified lisp-files will be loaded the first time a
|
||||
connection is made, that is, before text is accepted from the
|
||||
port connection.
|
||||
|
||||
-d port-number
|
||||
Run in demon mode. As for the -p option, but newLISP does not
|
||||
exit after a closed connection and stays in memory listening for
|
||||
a new connection.
|
||||
|
||||
-t microseconds-connection-timeout
|
||||
Specifies a connection timeout when running in -p or -d demon
|
||||
mode. Server will disconnect when no further input is read after
|
||||
accepting a client connection.
|
||||
|
||||
-6 Starts newLISP in IPv6 'Internet Protocol version 6' mode. With-
|
||||
out this switch newLISP willl start in IPv4 mode. The protocol
|
||||
mode can also be switched with the built-in 'net-ipv' function
|
||||
during runtime.
|
||||
|
||||
EXAMPLES
|
||||
Start interactive session
|
||||
newlisp
|
||||
|
||||
|
||||
Excute a program
|
||||
newlisp myprog.lsp
|
||||
|
||||
|
||||
Excute a remote program
|
||||
newlisp http://newlisp.org/example.lsp
|
||||
|
||||
|
||||
Add 3 and 4, 7 prints on standard output
|
||||
newlisp -e "(+ 3 4)"
|
||||
|
||||
|
||||
newLISP is started as a server (the & indicates to LINUX to run the
|
||||
process in the background) and can be connected to with telnet by issu-
|
||||
ing telnet localhost 1234
|
||||
newlisp -p 1234 &
|
||||
|
||||
|
||||
newLISP is started as a server for another newlisp process connecting
|
||||
with the net-eval function or HTTP requests. Connection timeout is 3
|
||||
seconds.
|
||||
newlisp -c -t 3000000 -d 4711 &
|
||||
|
||||
|
||||
newLISP is started as a server handling HTTP requests only. Connections
|
||||
are logged to the file /usr/home/www/log.txt
|
||||
newlisp -l /usr/home/www/log.txt -http -d 8080 &
|
||||
|
||||
|
||||
newLISP is started as a server handling HTTP requests and defining the
|
||||
startup/web root directory
|
||||
newlisp -http -d 8080 -w /usr/home/www/httpdocs &
|
||||
|
||||
When accepting HTTP commands a file httpd.conf can be loaded, which
|
||||
will preprocess the path-name in the HTTP request
|
||||
newlisp httpd.conf -http -d 8080 -w /usr/home/www/httpdocs &
|
||||
|
||||
If the file httpd.conf contains:
|
||||
|
||||
(command-event (fn (s)
|
||||
(local (request)
|
||||
(if (find "?" s) ; is this a query
|
||||
(begin
|
||||
(set 'request (first (parse s "?")))
|
||||
; discover illegal extension in queries
|
||||
(if (ends-with request ".exe")
|
||||
(set 'request "GET /errorpage.html")
|
||||
(set 'request s)))
|
||||
(set 'request s))
|
||||
request) ))
|
||||
|
||||
then all files ending in .exe will translate the request in to a
|
||||
request for an error page, else the original request string is
|
||||
returned.
|
||||
|
||||
|
||||
EXIT STATUS
|
||||
newLISP returns a zero exit status for normal termination unless an
|
||||
exit command specifies a code to be returned. Non zero is returned in
|
||||
case of abnormal exit.
|
||||
|
||||
AUTHOR
|
||||
Lutz Mueller <lutz@nuevatec.com>
|
||||
|
||||
http://www.newlisp.org/ - the newLISP home page
|
||||
|
||||
|
||||
|
||||
version 10.6.0 April 2014 newlisp(1)
|
||||
|
125
doc/newlisp.1
Normal file
|
@ -0,0 +1,125 @@
|
|||
.TH newlisp 1 "April 2014" "version 10.6.0" "Commandline Parameters"
|
||||
.SH NAME
|
||||
newlisp \- lisp like programming language
|
||||
.SH SYNOPSIS
|
||||
.B newlisp
|
||||
[\-n] [\-x source target] [\-h | -v] [\-c | \-C | \-http] [\-t microseconds] [\-s stack] [\-m max\-mem\-megabyte] [[\-l path\-file | \-L path\-file] [\-p port\-number | \-d port\-number]] [\-w directory] [lisp\-files ...] [\-e programtext]
|
||||
.SH DESCRIPTION
|
||||
Invokes newLISP which first loads init.lsp if present. Then one or more options and one or more newLISP source files can be specified. The options and source files are executed in the sequence they appear. For some options is makes sense to have source files loaded first like for the \-p and \-d options. For other options like \-s and \-m it is logical to specify these before the source files to be loaded. If a \-e switch is used the programtext is evaluated and then newlisp exits otherwise evaluation continues interactively (unless an exit occurs during lisp\-file interpretation).
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\-n
|
||||
Suppress loading of any init.lsp or .init.lsp initialization file.
|
||||
.TP
|
||||
\-x source target
|
||||
Link the newLISP executable with a source file to built a new target executable.
|
||||
.TP
|
||||
\-h
|
||||
Display a short help text.
|
||||
.TP
|
||||
\-v
|
||||
Display a version string.
|
||||
.TP
|
||||
\-c
|
||||
Suppress the commandline prompt.
|
||||
.TP
|
||||
\-C
|
||||
Force prompt when running newLISP in pipe I/O mode for Emacs.
|
||||
.TP
|
||||
\-http
|
||||
only accept HTTP commands
|
||||
.TP
|
||||
\-s stacksize
|
||||
Stack size to use when starting newLISP. When no stack size is specified the stack defaults to 1024.
|
||||
.TP
|
||||
\-m max\-mem\-megabyte
|
||||
Limits memory to max\-cell\-mem\-megabyte megabytes for Lisp cell memory.
|
||||
.TP
|
||||
lisp\-files
|
||||
Load and evaluate the specified lisp source files in sequence. Source files can be specified using URLs. If an (exit) is executed by one of the source files then newlisp exits and all processing ceases.
|
||||
.TP
|
||||
\-e programtext
|
||||
Programtext is an expression enclosed in quotation marks which is evaluated and the result printed to standard out device (STDOUT). In most UNIX system shells apostrophes can also be used to delimit the expression. newLISP exits after evaluation of programtext is complete.
|
||||
.TP
|
||||
\-w directory
|
||||
Directory is the start up directory for newLISP. Any file reference in a program will refer to this directory by default as the current directory. This can be used to define a web root directory when in server mode.
|
||||
.TP
|
||||
\-l \-L path\-file
|
||||
Log network connections and newLISP I/O to the file in path\-file. \-l will only log network connections or commandline input or net\-eval requests. \-L will additionally log HTTP requests and newLISP output from commandline and net\-eval input.
|
||||
.TP
|
||||
\-p port\-number
|
||||
Listen for commands on a TCP/IP socket connection. In this case standard I/O is redirected to the port specified in the \-p option. Any specified lisp\-files will be loaded the first time a connection is made, that is, before text is accepted from the port connection.
|
||||
.TP
|
||||
\-d port\-number
|
||||
Run in demon mode. As for the \-p option, but newLISP does not exit after a closed connection and stays in memory listening for a new connection.
|
||||
.TP
|
||||
\-t microseconds-connection-timeout
|
||||
Specifies a connection timeout when running in \-p or \-d demon mode. Server will disconnect when no further input is read after accepting a client connection.
|
||||
.TP
|
||||
\-6
|
||||
Starts newLISP in IPv6 'Internet Protocol version 6' mode. Without this switch newLISP willl start in IPv4 mode. The protocol mode can also be switched with the built-in 'net-ipv' function during runtime.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
Start interactive session
|
||||
.B newlisp
|
||||
.PP
|
||||
.TP
|
||||
Excute a program
|
||||
.B newlisp myprog.lsp
|
||||
.PP
|
||||
.TP
|
||||
Excute a remote program
|
||||
.B newlisp http://newlisp.org/example.lsp
|
||||
.PP
|
||||
.TP
|
||||
Add 3 and 4, 7 prints on standard output
|
||||
.B newlisp
|
||||
\-e "(+ 3 4)"
|
||||
.PP
|
||||
.TP
|
||||
newLISP is started as a server (the & indicates to LINUX to run the process in the background) and can be connected to with telnet by issuing telnet localhost 1234
|
||||
.B newlisp
|
||||
\-p 1234 &
|
||||
.PP
|
||||
.TP
|
||||
newLISP is started as a server for another newlisp process connecting with the net\-eval function or HTTP requests. Connection timeout is 3 seconds.
|
||||
.B newlisp
|
||||
\-c \-t 3000000 \-d 4711 &
|
||||
.PP
|
||||
.TP
|
||||
newLISP is started as a server handling HTTP requests only. Connections are logged to the file /usr/home/www/log.txt
|
||||
.B newlisp
|
||||
\-l /usr/home/www/log.txt \-http \-d 8080 &
|
||||
.PP
|
||||
.TP
|
||||
newLISP is started as a server handling HTTP requests and defining the startup/web root directory
|
||||
.B newlisp
|
||||
\-http \-d 8080 \-w /usr/home/www/httpdocs &
|
||||
.TP
|
||||
When accepting HTTP commands a file httpd.conf can be loaded, which will preprocess the path\-name in the HTTP request
|
||||
.B newlisp
|
||||
httpd.conf \-http \-d 8080 \-w /usr/home/www/httpdocs &
|
||||
.PP
|
||||
If the file httpd.conf contains:
|
||||
|
||||
(command-event (fn (s)
|
||||
(local (request)
|
||||
(if (find "?" s) ; is this a query
|
||||
(begin
|
||||
(set 'request (first (parse s "?")))
|
||||
; discover illegal extension in queries
|
||||
(if (ends-with request ".exe")
|
||||
(set 'request "GET /errorpage.html")
|
||||
(set 'request s)))
|
||||
(set 'request s))
|
||||
request)
|
||||
))
|
||||
|
||||
then all files ending in .exe will translate the request in to a request for an error page, else the original request string is returned.
|
||||
.PP
|
||||
.SH EXIT STATUS
|
||||
newLISP returns a zero exit status for normal termination unless an exit command specifies a code to be returned. Non zero is returned in case of abnormal exit.
|
||||
.SH AUTHOR
|
||||
Lutz Mueller <lutz@nuevatec.com>
|
||||
|
||||
http://www.newlisp.org/ \- the newLISP home page
|
583
doc/newlisp_index.html
Normal file
|
@ -0,0 +1,583 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
|
||||
<meta name="author" content="Lutz Mueller"/>
|
||||
<meta name="keywords" content="newLISP LISP SCHEME manual reference help artificial intelligence AI NUEVATEC"/>
|
||||
<meta name="description" content="newLISP Users Manual and Reference Index"/>
|
||||
<title>newLISP Manual and Reference Index</title>
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
<!--
|
||||
|
||||
body, h1, h4, h4, h4, p {
|
||||
font-family: Lucida Sans, Verdana, Helvetica, sanserif;
|
||||
color: #444444;
|
||||
}
|
||||
|
||||
pre, tt {
|
||||
font-family: Lucida Console, Courier;
|
||||
}
|
||||
|
||||
-->
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body text="#000000" bgcolor="#FFFFFF" link="#376590" vlink="#551A8B" alink="#ffAA28">
|
||||
<h4>Functions in alphabetical order</h4>
|
||||
|
||||
<b>
|
||||
<a href="newlisp_manual.html#shell" target="body">!</a>
|
||||
<a href="newlisp_manual.html#arithmetic" target="body">+-*/%</a>
|
||||
<a href="newlisp_manual.html#abort" target="body">Ab</a>
|
||||
<a href="newlisp_manual.html#append" target="body">Ap</a>
|
||||
<a href="newlisp_manual.html#asin" target="body">As</a>
|
||||
<a href="newlisp_manual.html#base64-dec" target="body">Ba</a>
|
||||
<a href="newlisp_manual.html#callback" target="body">Ca</a>
|
||||
<a href="newlisp_manual.html#clean" target="body">Cl</a>
|
||||
<a href="newlisp_manual.html#command-event" target="body">Co</a>
|
||||
<a href="newlisp_manual.html#current-line" target="body">Cu</a>
|
||||
<a href="newlisp_manual.html#dec" target="body">De</a>
|
||||
<a href="newlisp_manual.html#difference" target="body">Di</a>
|
||||
<a href="newlisp_manual.html#do-until" target="body">Do</a>
|
||||
<a href="newlisp_manual.html#encrypt" target="body">En</a>
|
||||
<a href="newlisp_manual.html#exec" target="body">Ex</a>
|
||||
<a href="newlisp_manual.html#file-info" target="body">Fi</a>
|
||||
<a href="newlisp_manual.html#flat" target="body">Fl</a>
|
||||
<a href="newlisp_manual.html#gammaln" target="body">Ga</a>
|
||||
<a href="newlisp_manual.html#global" target="body">Gl</a>
|
||||
<a href="newlisp_manual.html#inc" target="body">In</a>
|
||||
<a href="newlisp_manual.html#lambdap" target="body">La</a>
|
||||
<a href="newlisp_manual.html#listp" target="body">Li</a>
|
||||
<a href="newlisp_manual.html#macro" target="body">Ma</a>
|
||||
<a href="newlisp_manual.html#mul" target="body">Mu</a>
|
||||
<a href="newlisp_manual.html#net-accept" target="body">Net</a>
|
||||
<a href="newlisp_manual.html#new" target="body">New</a>
|
||||
<a href="newlisp_manual.html#nth" target="body">Nt</a>
|
||||
<a href="newlisp_manual.html#pack" target="body">Pa</a>
|
||||
<a href="newlisp_manual.html#prefix" target="body">Pr</a>
|
||||
<a href="newlisp_manual.html#rand" target="body">Ra</a>
|
||||
<a href="newlisp_manual.html#read" target="body">Rea</a>
|
||||
<a href="newlisp_manual.html#regex" target="body">Reg</a>
|
||||
<a href="newlisp_manual.html#search" target="body">Sea</a>
|
||||
<a href="newlisp_manual.html#sequence" target="body">Seq</a>
|
||||
<a href="newlisp_manual.html#sleep" target="body">Sl</a>
|
||||
<a href="newlisp_manual.html#starts-with" target="body">St</a>
|
||||
<a href="newlisp_manual.html#sym" target="body">Sy</a>
|
||||
<a href="newlisp_manual.html#time" target="body">Ti</a>
|
||||
<a href="newlisp_manual.html#trace" target="body">Tr</a>
|
||||
<a href="newlisp_manual.html#utf8" target="body">Ut</a>
|
||||
<a href="newlisp_manual.html#write" target="body">Wr</a>
|
||||
</b>
|
||||
|
||||
|
||||
<h4>List processing, flow control and integer arithmetic</h4>
|
||||
|
||||
<a href="newlisp_manual.html#arithmetic" target="body">+, -, *, /,%</a><br />
|
||||
<a href="newlisp_manual.html#inci" target="body">++</a><br />
|
||||
<a href="newlisp_manual.html#deci" target="body">--</a><br />
|
||||
<a href="newlisp_manual.html#logical" target="body"><, >, =,</a><br />
|
||||
<a href="newlisp_manual.html#logical" target="body"><=, >=, !=</a><br />
|
||||
<a href="newlisp_manual.html#colon" target="body">:</a><br />
|
||||
<a href="newlisp_manual.html#and" target="body">and</a><br />
|
||||
<a href="newlisp_manual.html#append" target="body">append</a><br />
|
||||
<a href="newlisp_manual.html#apply" target="body">apply</a><br />
|
||||
<a href="newlisp_manual.html#args" target="body">args</a><br />
|
||||
<a href="newlisp_manual.html#assoc" target="body">assoc</a><br />
|
||||
<a href="newlisp_manual.html#begin" target="body">begin</a><br />
|
||||
<a href="newlisp_manual.html#bind" target="body">bind</a><br />
|
||||
<a href="newlisp_manual.html#bigint" target="body">bigint</a><br />
|
||||
<a href="newlisp_manual.html#case" target="body">case</a><br />
|
||||
<a href="newlisp_manual.html#catch" target="body">catch</a><br />
|
||||
<a href="newlisp_manual.html#chop" target="body">chop</a><br />
|
||||
<a href="newlisp_manual.html#clean" target="body">clean</a><br />
|
||||
<a href="newlisp_manual.html#collect" target="body">collect</a><br />
|
||||
<a href="newlisp_manual.html#cond" target="body">cond</a><br />
|
||||
<a href="newlisp_manual.html#cons" target="body">cons</a><br />
|
||||
<a href="newlisp_manual.html#constant" target="body">constant</a><br />
|
||||
<a href="newlisp_manual.html#count" target="body">count</a><br />
|
||||
<a href="newlisp_manual.html#curry" target="body">curry</a><br />
|
||||
<a href="newlisp_manual.html#def-new" target="body">def-new</a><br />
|
||||
<a href="newlisp_manual.html#define" target="body">define</a><br />
|
||||
<a href="newlisp_manual.html#define-macro" target="body">define-macro</a><br />
|
||||
<a href="newlisp_manual.html#difference" target="body">difference</a><br />
|
||||
<a href="newlisp_manual.html#do-until" target="body">do-until</a><br />
|
||||
<a href="newlisp_manual.html#do-while" target="body">do-while</a><br />
|
||||
<a href="newlisp_manual.html#doargs" target="body">doargs</a><br />
|
||||
<a href="newlisp_manual.html#dolist" target="body">dolist</a><br />
|
||||
<a href="newlisp_manual.html#dostring" target="body">dostring</a><br />
|
||||
<a href="newlisp_manual.html#dotimes" target="body">dotimes</a><br />
|
||||
<a href="newlisp_manual.html#dotree" target="body">dotree</a><br />
|
||||
<a href="newlisp_manual.html#dup" target="body">dup</a><br />
|
||||
<a href="newlisp_manual.html#ends-with" target="body">ends-with</a><br />
|
||||
<a href="newlisp_manual.html#exists" target="body">exists</a><br />
|
||||
<a href="newlisp_manual.html#eval" target="body">eval</a><br />
|
||||
<a href="newlisp_manual.html#expand" target="body">expand</a><br />
|
||||
<a href="newlisp_manual.html#extend" target="body">extend</a><br />
|
||||
<a href="newlisp_manual.html#first" target="body">first</a><br />
|
||||
<a href="newlisp_manual.html#filter" target="body">filter</a><br />
|
||||
<a href="newlisp_manual.html#find" target="body">find</a><br />
|
||||
<a href="newlisp_manual.html#find-all" target="body">find-all</a><br />
|
||||
<a href="newlisp_manual.html#flat" target="body">flat</a><br />
|
||||
<a href="newlisp_manual.html#fn" target="body">fn</a><br />
|
||||
<a href="newlisp_manual.html#for" target="body">for</a><br />
|
||||
<a href="newlisp_manual.html#for-all" target="body">for-all</a><br />
|
||||
<a href="newlisp_manual.html#if" target="body">if</a><br />
|
||||
<!-- <a href="newlisp_manual.html#if-not" target="body">if-not</a><br /> -->
|
||||
<a href="newlisp_manual.html#index" target="body">index</a><br />
|
||||
<a href="newlisp_manual.html#intersect" target="body">intersect</a><br />
|
||||
<a href="newlisp_manual.html#lambda" target="body">lambda</a><br />
|
||||
<a href="newlisp_manual.html#lambda-macro" target="body">lambda-macro</a><br />
|
||||
<a href="newlisp_manual.html#last" target="body">last</a><br />
|
||||
<a href="newlisp_manual.html#length" target="body">length</a><br />
|
||||
<a href="newlisp_manual.html#let" target="body">let</a><br />
|
||||
<a href="newlisp_manual.html#letex" target="body">letex</a><br />
|
||||
<a href="newlisp_manual.html#letn" target="body">letn</a><br />
|
||||
<a href="newlisp_manual.html#list" target="body">list</a><br />
|
||||
<a href="newlisp_manual.html#local" target="body">local</a><br />
|
||||
<a href="newlisp_manual.html#lookup" target="body">lookup</a><br />
|
||||
<a href="newlisp_manual.html#map" target="body">map</a><br />
|
||||
<a href="newlisp_manual.html#match" target="body">match</a><br />
|
||||
<a href="newlisp_manual.html#member" target="body">member</a><br />
|
||||
<a href="newlisp_manual.html#not" target="body">not</a><br />
|
||||
<a href="newlisp_manual.html#nth" target="body">nth</a><br />
|
||||
<a href="newlisp_manual.html#or" target="body">or</a><br />
|
||||
<a href="newlisp_manual.html#pop" target="body">pop</a><br />
|
||||
<a href="newlisp_manual.html#pop-assoc" target="body">pop-assoc</a><br />
|
||||
<a href="newlisp_manual.html#push" target="body">push</a><br />
|
||||
<a href="newlisp_manual.html#quote" target="body">quote</a><br />
|
||||
<a href="newlisp_manual.html#ref" target="body">ref</a><br />
|
||||
<a href="newlisp_manual.html#ref-all" target="body">ref-all</a><br />
|
||||
<a href="newlisp_manual.html#rest" target="body">rest</a><br />
|
||||
<a href="newlisp_manual.html#replace" target="body">replace</a><br />
|
||||
<a href="newlisp_manual.html#reverse" target="body">reverse</a><br />
|
||||
<a href="newlisp_manual.html#rotate" target="body">rotate</a><br />
|
||||
<a href="newlisp_manual.html#select" target="body">select</a><br />
|
||||
<a href="newlisp_manual.html#self" target="body">self</a><br />
|
||||
<a href="newlisp_manual.html#set" target="body">set</a><br />
|
||||
<a href="newlisp_manual.html#set-ref" target="body">set-ref</a><br />
|
||||
<a href="newlisp_manual.html#set-ref-all" target="body">set-ref-all</a><br />
|
||||
<a href="newlisp_manual.html#setf" target="body">setf setq</a><br />
|
||||
<a href="newlisp_manual.html#silent" target="body">silent</a><br />
|
||||
<a href="newlisp_manual.html#slice" target="body">slice</a><br />
|
||||
<a href="newlisp_manual.html#sort" target="body">sort</a><br />
|
||||
<a href="newlisp_manual.html#starts-with" target="body">starts-with</a><br />
|
||||
<a href="newlisp_manual.html#swap" target="body">swap</a><br />
|
||||
<a href="newlisp_manual.html#unify" target="body">unify</a><br />
|
||||
<a href="newlisp_manual.html#unique" target="body">unique</a><br />
|
||||
<a href="newlisp_manual.html#union" target="body">union</a><br />
|
||||
<a href="newlisp_manual.html#unless" target="body">unless</a><br />
|
||||
<a href="newlisp_manual.html#until" target="body">until</a><br />
|
||||
<a href="newlisp_manual.html#when" target="body">when</a><br />
|
||||
<a href="newlisp_manual.html#while" target="body">while</a><br />
|
||||
|
||||
<h4>String and conversion functions</h4>
|
||||
|
||||
<a href="newlisp_manual.html#address" target="body">address</a><br />
|
||||
<a href="newlisp_manual.html#append" target="body">append</a><br />
|
||||
<a href="newlisp_manual.html#bigint" target="body">bigint</a><br />
|
||||
<a href="newlisp_manual.html#bits" target="body">bits</a><br />
|
||||
<a href="newlisp_manual.html#char" target="body">char</a><br />
|
||||
<a href="newlisp_manual.html#chop" target="body">chop</a><br />
|
||||
<a href="newlisp_manual.html#dup" target="body">dup</a><br />
|
||||
<a href="newlisp_manual.html#ends-with" target="body">ends-with</a><br />
|
||||
<a href="newlisp_manual.html#encrypt" target="body">encrypt</a><br />
|
||||
<a href="newlisp_manual.html#eval-string" target="body">eval-string</a><br />
|
||||
<a href="newlisp_manual.html#eval-string-js" target="body">eval-string-js</a><br />
|
||||
<a href="newlisp_manual.html#explode" target="body">explode</a><br />
|
||||
<a href="newlisp_manual.html#extend" target="body">extend</a><br />
|
||||
<a href="newlisp_manual.html#find" target="body">find</a><br />
|
||||
<a href="newlisp_manual.html#first" target="body">first</a><br />
|
||||
<a href="newlisp_manual.html#float" target="body">float</a><br />
|
||||
<a href="newlisp_manual.html#format" target="body">format</a><br />
|
||||
<a href="newlisp_manual.html#get-char" target="body">get-char</a><br />
|
||||
<a href="newlisp_manual.html#get-float" target="body">get-float</a><br />
|
||||
<a href="newlisp_manual.html#get-int" target="body">get-int</a><br />
|
||||
<a href="newlisp_manual.html#get-long" target="body">get-long</a><br />
|
||||
<a href="newlisp_manual.html#get-string" target="body">get-string</a><br />
|
||||
<a href="newlisp_manual.html#int" target="body">int</a><br />
|
||||
<a href="newlisp_manual.html#join" target="body">join</a><br />
|
||||
<a href="newlisp_manual.html#last" target="body">last</a><br />
|
||||
<a href="newlisp_manual.html#lower-case" target="body">lower-case</a><br />
|
||||
<a href="newlisp_manual.html#member" target="body">member</a><br />
|
||||
<a href="newlisp_manual.html#name" target="body">name</a><br />
|
||||
<a href="newlisp_manual.html#nth" target="body">nth</a><br />
|
||||
<a href="newlisp_manual.html#pack" target="body">pack</a><br />
|
||||
<a href="newlisp_manual.html#parse" target="body">parse</a><br />
|
||||
<a href="newlisp_manual.html#pop" target="body">pop</a><br />
|
||||
<a href="newlisp_manual.html#push" target="body">push</a><br />
|
||||
<a href="newlisp_manual.html#regex" target="body">regex</a><br />
|
||||
<a href="newlisp_manual.html#regex-comp" target="body">regex-comp</a><br />
|
||||
<a href="newlisp_manual.html#replace" target="body">replace</a><br />
|
||||
<a href="newlisp_manual.html#rest" target="body">rest</a><br />
|
||||
<a href="newlisp_manual.html#reverse" target="body">reverse</a><br />
|
||||
<a href="newlisp_manual.html#rotate" target="body">rotate</a><br />
|
||||
<a href="newlisp_manual.html#select" target="body">select</a><br />
|
||||
<a href="newlisp_manual.html#setf" target="body">setf</a><br />
|
||||
<a href="newlisp_manual.html#slice" target="body">slice</a><br />
|
||||
<a href="newlisp_manual.html#source" target="body">source</a><br/>
|
||||
<a href="newlisp_manual.html#starts-with" target="body">starts-with</a><br />
|
||||
<a href="newlisp_manual.html#string" target="body">string</a><br />
|
||||
<a href="newlisp_manual.html#sym" target="body">sym</a><br />
|
||||
<a href="newlisp_manual.html#title-case" target="body">title-case</a><br />
|
||||
<a href="newlisp_manual.html#trim" target="body">trim</a><br />
|
||||
<a href="newlisp_manual.html#unicode" target="body">unicode</a><br />
|
||||
<a href="newlisp_manual.html#unpack" target="body">unpack</a><br />
|
||||
<a href="newlisp_manual.html#upper-case" target="body">upper-case</a><br />
|
||||
<a href="newlisp_manual.html#utf8" target="body">utf8</a><br />
|
||||
<a href="newlisp_manual.html#utf8len" target="body">utf8len</a><br />
|
||||
|
||||
<h4>Floating point math and special functions</h4>
|
||||
|
||||
<a href="newlisp_manual.html#abs" target="body">abs</a><br />
|
||||
<a href="newlisp_manual.html#acos" target="body">acos</a><br />
|
||||
<a href="newlisp_manual.html#acosh" target="body">acosh</a><br />
|
||||
<a href="newlisp_manual.html#add" target="body">add</a><br />
|
||||
<a href="newlisp_manual.html#array" target="body">array</a><br />
|
||||
<a href="newlisp_manual.html#array-list" target="body">array-list</a><br />
|
||||
<a href="newlisp_manual.html#asin" target="body">asin</a><br />
|
||||
<a href="newlisp_manual.html#asinh" target="body">asinh</a><br />
|
||||
<a href="newlisp_manual.html#atan" target="body">atan</a><br />
|
||||
<a href="newlisp_manual.html#atanh" target="body">atanh</a><br />
|
||||
<a href="newlisp_manual.html#atan2" target="body">atan2</a><br />
|
||||
<a href="newlisp_manual.html#beta" target="body">beta</a><br />
|
||||
<a href="newlisp_manual.html#betai" target="body">betai</a><br />
|
||||
<a href="newlisp_manual.html#binomial" target="body">binomial</a><br />
|
||||
<a href="newlisp_manual.html#ceil" target="body">ceil</a><br />
|
||||
<a href="newlisp_manual.html#cos" target="body">cos</a><br />
|
||||
<a href="newlisp_manual.html#cosh" target="body">cosh</a><br />
|
||||
<a href="newlisp_manual.html#crc32" target="body">crc32</a><br />
|
||||
<a href="newlisp_manual.html#dec" target="body">dec</a><br />
|
||||
<a href="newlisp_manual.html#div" target="body">div</a><br />
|
||||
<a href="newlisp_manual.html#erf" target="body">erf</a><br />
|
||||
<a href="newlisp_manual.html#exp" target="body">exp</a><br />
|
||||
<a href="newlisp_manual.html#factor" target="body">factor</a><br />
|
||||
<a href="newlisp_manual.html#fft" target="body">fft</a><br />
|
||||
<a href="newlisp_manual.html#floor" target="body">floor</a><br />
|
||||
<a href="newlisp_manual.html#flt" target="body">flt</a><br />
|
||||
<a href="newlisp_manual.html#gammai" target="body">gammai</a><br />
|
||||
<a href="newlisp_manual.html#gammaln" target="body">gammaln</a><br />
|
||||
<a href="newlisp_manual.html#gcd" target="body">gcd</a><br />
|
||||
<a href="newlisp_manual.html#ifft" target="body">ifft</a><br />
|
||||
<a href="newlisp_manual.html#inc" target="body">inc</a><br />
|
||||
<a href="newlisp_manual.html#infp" target="body">inf?</a><br />
|
||||
<a href="newlisp_manual.html#log" target="body">log</a><br />
|
||||
<a href="newlisp_manual.html#min" target="body">min</a><br />
|
||||
<a href="newlisp_manual.html#max" target="body">max</a><br />
|
||||
<a href="newlisp_manual.html#mod" target="body">mod</a><br />
|
||||
<a href="newlisp_manual.html#mul" target="body">mul</a><br />
|
||||
<a href="newlisp_manual.html#NaNp" target="body">NaN?</a><br />
|
||||
<a href="newlisp_manual.html#pow" target="body">pow</a><br />
|
||||
<a href="newlisp_manual.html#round" target="body">round</a><br />
|
||||
<a href="newlisp_manual.html#sequence" target="body">sequence</a><br />
|
||||
<a href="newlisp_manual.html#series" target="body">series</a><br />
|
||||
<a href="newlisp_manual.html#sgn" target="body">sgn</a><br />
|
||||
<a href="newlisp_manual.html#sin" target="body">sin</a><br />
|
||||
<a href="newlisp_manual.html#sinh" target="body">sinh</a><br />
|
||||
<a href="newlisp_manual.html#sqrt" target="body">sqrt</a><br />
|
||||
<a href="newlisp_manual.html#sub" target="body">sub</a><br />
|
||||
<a href="newlisp_manual.html#tan" target="body">tan</a><br />
|
||||
<a href="newlisp_manual.html#tanh" target="body">tanh</a><br />
|
||||
|
||||
<h4>Matrix functions</h4>
|
||||
|
||||
<a href="newlisp_manual.html#det" target="body">det</a><br />
|
||||
<a href="newlisp_manual.html#invert" target="body">invert</a><br />
|
||||
<a href="newlisp_manual.html#mat" target="body">mat</a><br />
|
||||
<a href="newlisp_manual.html#multiply" target="body">multiply</a><br />
|
||||
<a href="newlisp_manual.html#transpose" target="body">transpose</a><br />
|
||||
|
||||
<h4>Array functions</h4>
|
||||
|
||||
<a href="newlisp_manual.html#append" target="body">append</a><br/>
|
||||
<a href="newlisp_manual.html#array" target="body">array</a><br/>
|
||||
<a href="newlisp_manual.html#array-list" target="body">array-list</a><br/>
|
||||
<a href="newlisp_manual.html#arrayp" target="body">array?</a><br/>
|
||||
<a href="newlisp_manual.html#det" target="body">det</a><br/>
|
||||
<a href="newlisp_manual.html#first" target="body">first</a><br/>
|
||||
<a href="newlisp_manual.html#invert" target="body">invert</a><br/>
|
||||
<a href="newlisp_manual.html#last" target="body">last</a><br/>
|
||||
<a href="newlisp_manual.html#mat" target="body">mat</a><br />
|
||||
<a href="newlisp_manual.html#multiply" target="body">multiply</a><br/>
|
||||
<a href="newlisp_manual.html#nth" target="body">nth</a><br/>
|
||||
<a href="newlisp_manual.html#rest" target="body">rest</a><br/>
|
||||
<a href="newlisp_manual.html#setf" target="body">setf</a><br />
|
||||
<a href="newlisp_manual.html#slice" target="body">slice</a><br />
|
||||
<a href="newlisp_manual.html#transpose" target="body">transpose</a><br/>
|
||||
|
||||
<h4>Bit operators</h4>
|
||||
|
||||
<a href="newlisp_manual.html#bit_shift" target="body"><<, >></a><br />
|
||||
<a href="newlisp_manual.html#bit_and" target="body">&</a><br />
|
||||
<a href="newlisp_manual.html#bit_inclusive" target="body">|</a><br />
|
||||
<a href="newlisp_manual.html#bit_exclusive" target="body">^</a><br />
|
||||
<a href="newlisp_manual.html#bit_not" target="body">~</a><br />
|
||||
|
||||
<h4>Predicates</h4>
|
||||
<a href="newlisp_manual.html#arrayp" target="body">array?</a><br />
|
||||
<a href="newlisp_manual.html#atomp" target="body">atom?</a><br />
|
||||
<a href="newlisp_manual.html#bigintp" target="body">bigint?</a><br />
|
||||
<a href="newlisp_manual.html#contextp" target="body">context?</a><br />
|
||||
<a href="newlisp_manual.html#directoryp" target="body">directory?</a><br />
|
||||
<a href="newlisp_manual.html#emptyp" target="body">empty?</a><br />
|
||||
<a href="newlisp_manual.html#evenp" target="body">even?</a><br />
|
||||
<a href="newlisp_manual.html#filep" target="body">file?</a><br />
|
||||
<a href="newlisp_manual.html#floatp" target="body">float?</a><br />
|
||||
<a href="newlisp_manual.html#globalp" target="body">global?</a><br />
|
||||
<a href="newlisp_manual.html#infp" target="body">inf?</a><br />
|
||||
<a href="newlisp_manual.html#integerp" target="body">integer?</a><br />
|
||||
<a href="newlisp_manual.html#lambdap" target="body">lambda?</a><br />
|
||||
<a href="newlisp_manual.html#legalp" target="body">legal?</a><br />
|
||||
<a href="newlisp_manual.html#listp" target="body">list?</a><br />
|
||||
<a href="newlisp_manual.html#macrop" target="body">macro?</a><br />
|
||||
<a href="newlisp_manual.html#NaNp" target="body">NaN?</a><br />
|
||||
<a href="newlisp_manual.html#nilp" target="body">nil?</a><br />
|
||||
<a href="newlisp_manual.html#nullp" target="body">null?</a><br />
|
||||
<a href="newlisp_manual.html#oddp" target="body">odd?</a><br />
|
||||
<a href="newlisp_manual.html#numberp" target="body">number?</a><br />
|
||||
<a href="newlisp_manual.html#primitivep" target="body">primitive?</a><br />
|
||||
<a href="newlisp_manual.html#protectedp" target="body">protected?</a><br />
|
||||
<a href="newlisp_manual.html#quotep" target="body">quote?</a><br />
|
||||
<a href="newlisp_manual.html#stringp" target="body">string?</a><br />
|
||||
<a href="newlisp_manual.html#symbolp" target="body">symbol?</a><br />
|
||||
<a href="newlisp_manual.html#truep" target="body">true?</a><br />
|
||||
<a href="newlisp_manual.html#zerop" target="body">zero?</a><br />
|
||||
|
||||
<h4>Date and time functions</h4>
|
||||
|
||||
<a href="newlisp_manual.html#date" target="body">date</a><br />
|
||||
<a href="newlisp_manual.html#date-list" target="body">date-list</a><br />
|
||||
<a href="newlisp_manual.html#date-parse" target="body">date-parse</a><br />
|
||||
<a href="newlisp_manual.html#date-value" target="body">date-value</a><br />
|
||||
<a href="newlisp_manual.html#now" target="body">now</a><br />
|
||||
<a href="newlisp_manual.html#time" target="body">time</a><br />
|
||||
<a href="newlisp_manual.html#time-of-day" target="body">time-of-day</a><br />
|
||||
|
||||
<h4>Statistics, simulation and modelling</h4>
|
||||
|
||||
<a href="newlisp_manual.html#amb" target="body">amb</a><br />
|
||||
<a href="newlisp_manual.html#bayes-query" target="body">bayes-query</a><br />
|
||||
<a href="newlisp_manual.html#bayes-train" target="body">bayes-train</a><br />
|
||||
<a href="newlisp_manual.html#corr" target="body">corr</a><br />
|
||||
<a href="newlisp_manual.html#crit-chi2" target="body">crit-chi2</a><br />
|
||||
<a href="newlisp_manual.html#crit-f" target="body">crit-f</a><br />
|
||||
<a href="newlisp_manual.html#crit-t" target="body">crit-t</a><br />
|
||||
<a href="newlisp_manual.html#crit-z" target="body">crit-z</a><br />
|
||||
<a href="newlisp_manual.html#kmeans-query" target="body">kmeans-query</a><br />
|
||||
<a href="newlisp_manual.html#kmeans-train" target="body">kmeans-train</a><br />
|
||||
<a href="newlisp_manual.html#normal" target="body">normal</a><br />
|
||||
<a href="newlisp_manual.html#prob-chi2" target="body">prob-chi2</a><br />
|
||||
<a href="newlisp_manual.html#prob-f" target="body">prob-f</a><br />
|
||||
<a href="newlisp_manual.html#prob-t" target="body">prob-t</a><br />
|
||||
<a href="newlisp_manual.html#prob-z" target="body">prob-z</a><br />
|
||||
<a href="newlisp_manual.html#rand" target="body">rand</a><br />
|
||||
<a href="newlisp_manual.html#random" target="body">random</a><br />
|
||||
<a href="newlisp_manual.html#randomize" target="body">randomize</a><br />
|
||||
<a href="newlisp_manual.html#seed" target="body">seed</a><br />
|
||||
<a href="newlisp_manual.html#stats" target="body">stats</a><br />
|
||||
<a href="newlisp_manual.html#t-test" target="body">t-test</a><br />
|
||||
|
||||
<h4>Pattern recognition</h4>
|
||||
|
||||
<a href="newlisp_manual.html#ends-with" target="body">ends-with</a><br />
|
||||
<a href="newlisp_manual.html#find" target="body">find</a><br />
|
||||
<a href="newlisp_manual.html#find-all" target="body">find-all</a><br />
|
||||
<a href="newlisp_manual.html#match" target="body">match</a><br />
|
||||
<a href="newlisp_manual.html#parse" target="body">parse</a><br />
|
||||
<a href="newlisp_manual.html#ref" target="body">ref</a><br />
|
||||
<a href="newlisp_manual.html#ref-all" target="body">ref-all</a><br />
|
||||
<a href="newlisp_manual.html#regex" target="body">regex</a><br />
|
||||
<a href="newlisp_manual.html#replace" target="body">replace</a><br />
|
||||
<a href="newlisp_manual.html#search" target="body">search</a><br />
|
||||
<a href="newlisp_manual.html#set-ref" target="body">set-ref</a><br />
|
||||
<a href="newlisp_manual.html#set-ref-all" target="body">set-ref-all</a><br />
|
||||
<a href="newlisp_manual.html#starts-with" target="body">starts-with</a><br />
|
||||
<a href="newlisp_manual.html#unify" target="body">unify</a><br />
|
||||
|
||||
<h4>Financial math functions</h4>
|
||||
|
||||
<a href="newlisp_manual.html#fv" target="body">fv</a><br />
|
||||
<a href="newlisp_manual.html#irr" target="body">irr</a><br />
|
||||
<a href="newlisp_manual.html#nper" target="body">nper</a><br />
|
||||
<a href="newlisp_manual.html#npv" target="body">npv</a><br />
|
||||
<a href="newlisp_manual.html#pv" target="body">pv</a><br />
|
||||
<a href="newlisp_manual.html#pmt" target="body">pmt</a><br />
|
||||
|
||||
<h4>Input/output and file operations</h4>
|
||||
|
||||
<a href="newlisp_manual.html#append-file" target="body">append-file</a><br />
|
||||
<a href="newlisp_manual.html#close" target="body">close</a><br />
|
||||
<a href="newlisp_manual.html#current-line" target="body">current-line</a><br />
|
||||
<a href="newlisp_manual.html#device" target="body">device</a><br />
|
||||
<a href="newlisp_manual.html#exec" target="body">exec</a><br />
|
||||
<a href="newlisp_manual.html#load" target="body">load</a><br />
|
||||
<a href="newlisp_manual.html#open" target="body">open</a><br />
|
||||
<a href="newlisp_manual.html#peek" target="body">peek</a><br />
|
||||
<a href="newlisp_manual.html#print" target="body">print</a><br />
|
||||
<a href="newlisp_manual.html#println" target="body">println</a><br />
|
||||
<a href="newlisp_manual.html#read-buffer" target="body">read</a><br />
|
||||
<a href="newlisp_manual.html#read-char" target="body">read-char</a><br />
|
||||
<a href="newlisp_manual.html#read-file" target="body">read-file</a><br />
|
||||
<a href="newlisp_manual.html#read-key" target="body">read-key</a><br />
|
||||
<a href="newlisp_manual.html#read-line" target="body">read-line</a><br />
|
||||
<a href="newlisp_manual.html#read-utf8" target="body">read-utf8</a><br />
|
||||
<a href="newlisp_manual.html#save" target="body">save</a><br />
|
||||
<a href="newlisp_manual.html#search" target="body">search</a><br />
|
||||
<a href="newlisp_manual.html#seek" target="body">seek</a><br />
|
||||
<a href="newlisp_manual.html#write" target="body">write</a><br />
|
||||
<a href="newlisp_manual.html#write-char" target="body">write-char</a><br />
|
||||
<a href="newlisp_manual.html#write-file" target="body">write-file</a><br />
|
||||
<a href="newlisp_manual.html#write-line" target="body">write-line</a><br />
|
||||
|
||||
<h4>File and directory management</h4>
|
||||
|
||||
<a href="newlisp_manual.html#change-dir" target="body">change-dir</a><br />
|
||||
<a href="newlisp_manual.html#copy-file" target="body">copy-file</a><br />
|
||||
<a href="newlisp_manual.html#delete-file" target="body">delete-file</a><br />
|
||||
<a href="newlisp_manual.html#directory" target="body">directory</a><br />
|
||||
<a href="newlisp_manual.html#file-info" target="body">file-info</a><br />
|
||||
<a href="newlisp_manual.html#make-dir" target="body">make-dir</a><br />
|
||||
<a href="newlisp_manual.html#real-path" target="body">real-path</a><br />
|
||||
<a href="newlisp_manual.html#remove-dir" target="body">remove-dir</a><br />
|
||||
<a href="newlisp_manual.html#rename-file" target="body">rename-file</a><br />
|
||||
|
||||
<h4>Processes and the Cilk API</h4>
|
||||
|
||||
<a href="newlisp_manual.html#shell" target="body">!</a><br />
|
||||
<a href="newlisp_manual.html#abort" target="body">abort</a><br />
|
||||
<a href="newlisp_manual.html#destroy" target="body">destroy</a><br />
|
||||
<a href="newlisp_manual.html#exec" target="body">exec</a><br />
|
||||
<a href="newlisp_manual.html#fork" target="body">fork</a><br />
|
||||
<a href="newlisp_manual.html#pipe" target="body">pipe</a><br />
|
||||
<a href="newlisp_manual.html#process" target="body">process</a><br />
|
||||
<a href="newlisp_manual.html#receive" target="body">receive</a><br />
|
||||
<a href="newlisp_manual.html#semaphore" target="body">semaphore</a><br />
|
||||
<a href="newlisp_manual.html#send" target="body">send</a><br />
|
||||
<a href="newlisp_manual.html#share" target="body">share</a><br />
|
||||
<a href="newlisp_manual.html#spawn" target="body">spawn</a><br />
|
||||
<a href="newlisp_manual.html#sync" target="body">sync</a><br />
|
||||
<a href="newlisp_manual.html#wait-pid" target="body">wait-pid</a><br />
|
||||
|
||||
<h4>HTTP network API</h4>
|
||||
|
||||
<a href="newlisp_manual.html#base64-enc" target="body">base64-enc</a><br />
|
||||
<a href="newlisp_manual.html#base64-dec" target="body">base64-dec</a><br />
|
||||
<a href="newlisp_manual.html#delete-url" target="body">delete-url</a><br />
|
||||
<a href="newlisp_manual.html#get-url" target="body">get-url</a><br />
|
||||
<a href="newlisp_manual.html#json-error" target="body">json-error</a><br />
|
||||
<a href="newlisp_manual.html#json-parse" target="body">json-parse</a><br />
|
||||
<a href="newlisp_manual.html#put-url" target="body">put-url</a><br />
|
||||
<a href="newlisp_manual.html#post-url" target="body">post-url</a><br />
|
||||
<a href="newlisp_manual.html#xfer-event" target="body">xfer-event</a><br />
|
||||
<a href="newlisp_manual.html#xml-error" target="body">xml-error</a><br />
|
||||
<a href="newlisp_manual.html#xml-parse" target="body">xml-parse</a><br />
|
||||
<a href="newlisp_manual.html#xml-type-tags" target="body">xml-type-tags</a><br />
|
||||
|
||||
<h4>Socket TCP/IP and UDP network API</h4>
|
||||
|
||||
<a href="newlisp_manual.html#net-accept" target="body">net-accept</a><br />
|
||||
<a href="newlisp_manual.html#net-close" target="body">net-close</a><br />
|
||||
<a href="newlisp_manual.html#net-connect" target="body">net-connect</a><br />
|
||||
<a href="newlisp_manual.html#net-error" target="body">net-error</a><br />
|
||||
<a href="newlisp_manual.html#net-eval" target="body">net-eval</a><br />
|
||||
<a href="newlisp_manual.html#net-interface" target="body">net-interface</a><br />
|
||||
<a href="newlisp_manual.html#net-ipv" target="body">net-ipv</a><br />
|
||||
<a href="newlisp_manual.html#net-listen" target="body">net-listen</a><br />
|
||||
<a href="newlisp_manual.html#net-local" target="body">net-local</a><br />
|
||||
<a href="newlisp_manual.html#net-lookup" target="body">net-lookup</a><br />
|
||||
<a href="newlisp_manual.html#net-packet" target="body">net-packet</a><br />
|
||||
<a href="newlisp_manual.html#net-peek" target="body">net-peek</a><br />
|
||||
<a href="newlisp_manual.html#net-peek" target="body">net-peek</a><br />
|
||||
<a href="newlisp_manual.html#net-ping" target="body">net-ping</a><br />
|
||||
<a href="newlisp_manual.html#net-receive" target="body">net-receive</a><br />
|
||||
<a href="newlisp_manual.html#net-receive-from" target="body">net-receive-from</a><br />
|
||||
<a href="newlisp_manual.html#net-receive-udp" target="body">net-receive-udp</a><br />
|
||||
<a href="newlisp_manual.html#net-select" target="body">net-select</a><br />
|
||||
<a href="newlisp_manual.html#net-send" target="body">net-send</a><br />
|
||||
<a href="newlisp_manual.html#net-send-to" target="body">net-send-to</a><br />
|
||||
<a href="newlisp_manual.html#net-send-udp" target="body">net-send-udp</a><br />
|
||||
<a href="newlisp_manual.html#net-service" target="body">net-service</a><br />
|
||||
<a href="newlisp_manual.html#net-sessions" target="body">net-sessions</a><br />
|
||||
|
||||
<h4>API for newLISP in a web browser</h4>
|
||||
|
||||
<a href="newlisp_manual.html#display-html" target="body">display-html</a><br />
|
||||
<a href="newlisp_manual.html#eval-string-js" target="body">eval-string-js</a><br />
|
||||
|
||||
<h4>Reflection and customization</h4>
|
||||
|
||||
<a href="newlisp_manual.html#command-event" target="body">command-event</a><br />
|
||||
<a href="newlisp_manual.html#error-event" target="body">error-event</a><br />
|
||||
<a href="newlisp_manual.html#last-error" target="body">last-error</a><br />
|
||||
<a href="newlisp_manual.html#macro" target="body">macro</a><br />
|
||||
<a href="newlisp_manual.html#ostype" target="body">ostype</a><br />
|
||||
<a href="newlisp_manual.html#prefix" target="body">prefix</a><br />
|
||||
<a href="newlisp_manual.html#prompt-event" target="body">prompt-event</a><br />
|
||||
<a href="newlisp_manual.html#read-expr" target="body">read-expr</a><br />
|
||||
<a href="newlisp_manual.html#reader-event" target="body">reader-event</a><br />
|
||||
<a href="newlisp_manual.html#set-locale" target="body">set-locale</a><br />
|
||||
<a href="newlisp_manual.html#source" target="body">source</a><br/>
|
||||
<a href="newlisp_manual.html#sys-error" target="body">sys-error</a><br />
|
||||
<a href="newlisp_manual.html#sys-info" target="body">sys-info</a><br />
|
||||
<a href="newlisp_manual.html#term" target="body">term</a><br />
|
||||
|
||||
<h4>System functions</h4>
|
||||
|
||||
<a href="newlisp_manual.html#systemsymbol" target="body">$</a><br />
|
||||
<a href="newlisp_manual.html#callback" target="body">callback</a><br />
|
||||
<a href="newlisp_manual.html#catch" target="body">catch</a><br />
|
||||
<a href="newlisp_manual.html#context" target="body">context</a><br />
|
||||
<a href="newlisp_manual.html#copy" target="body">copy</a><br />
|
||||
<a href="newlisp_manual.html#debug" target="body">debug</a><br />
|
||||
<a href="newlisp_manual.html#default" target="body">default</a><br />
|
||||
<a href="newlisp_manual.html#delete" target="body">delete</a><br />
|
||||
<a href="newlisp_manual.html#env" target="body">env</a><br />
|
||||
<a href="newlisp_manual.html#exit" target="body">exit</a><br />
|
||||
<a href="newlisp_manual.html#global" target="body">global</a><br />
|
||||
<a href="newlisp_manual.html#import" target="body">import</a><br />
|
||||
<a href="newlisp_manual.html#main-args" target="body">main-args</a><br />
|
||||
<a href="newlisp_manual.html#new" target="body">new</a><br />
|
||||
<a href="newlisp_manual.html#pretty-print" target="body">pretty-print</a><br />
|
||||
<a href="newlisp_manual.html#read-expr" target="body">read-expr</a><br />
|
||||
<a href="newlisp_manual.html#reset" target="body">reset</a><br />
|
||||
<a href="newlisp_manual.html#signal" target="body">signal</a><br />
|
||||
<a href="newlisp_manual.html#sleep" target="body">sleep</a><br />
|
||||
<a href="newlisp_manual.html#struct" target="body">struct</a><br />
|
||||
<a href="newlisp_manual.html#sym" target="body">sym</a><br />
|
||||
<a href="newlisp_manual.html#symbols" target="body">symbols</a><br />
|
||||
<a href="newlisp_manual.html#timer" target="body">timer</a><br />
|
||||
<a href="newlisp_manual.html#throw" target="body">throw</a><br />
|
||||
<a href="newlisp_manual.html#throw-error" target="body">throw-error</a><br />
|
||||
<a href="newlisp_manual.html#trace" target="body">trace</a><br />
|
||||
<a href="newlisp_manual.html#trace-highlight" target="body">trace-highlight</a><br />
|
||||
|
||||
<h4>Importing libraries</h4>
|
||||
|
||||
<a href="newlisp_manual.html#address" target="body">address</a><br />
|
||||
<a href="newlisp_manual.html#callback" target="body">callback</a><br />
|
||||
<a href="newlisp_manual.html#flt" target="body">flt</a><br />
|
||||
<a href="newlisp_manual.html#float" target="body">float</a><br />
|
||||
<a href="newlisp_manual.html#get-char" target="body">get-char</a><br />
|
||||
<a href="newlisp_manual.html#get-float" target="body">get-float</a><br />
|
||||
<a href="newlisp_manual.html#get-int" target="body">get-int</a><br />
|
||||
<a href="newlisp_manual.html#get-long" target="body">get-long</a><br />
|
||||
<a href="newlisp_manual.html#get-string" target="body">get-string</a><br />
|
||||
<a href="newlisp_manual.html#import" target="body">import</a><br />
|
||||
<a href="newlisp_manual.html#int" target="body">int</a><br />
|
||||
<a href="newlisp_manual.html#pack" target="body">pack</a><br />
|
||||
<a href="newlisp_manual.html#struct" target="body">struct</a><br />
|
||||
<a href="newlisp_manual.html#unpack" target="body">unpack</a><br />
|
||||
|
||||
<h4>newLISP internals API</h4>
|
||||
|
||||
<a href="newlisp_manual.html#command-event" target="body">command-event</a><br />
|
||||
<a href="newlisp_manual.html#cpymem" target="body">cpymem</a><br />
|
||||
<a href="newlisp_manual.html#dump" target="body">dump</a><br />
|
||||
<a href="newlisp_manual.html#prompt-event" target="body">prompt-event</a><br />
|
||||
<a href="newlisp_manual.html#read-expr" target="body">read-expr</a><br />
|
||||
<a href="newlisp_manual.html#reader-event" target="body">reader-event</a><br />
|
||||
|
||||
</body>
|
||||
</html>
|
30353
doc/newlisp_manual.html
Normal file
74
doc/newlispdoc-man.txt
Normal file
|
@ -0,0 +1,74 @@
|
|||
newlispdoc(1) Commandline Parameters newlispdoc(1)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
newlispdoc - generate documentation from newLISP source comments
|
||||
|
||||
SYNOPSIS
|
||||
newlispdoc [-s] [-d] lisp-file1 [lisp-file2 ...]
|
||||
|
||||
newlispdoc [-s] [-d] [-url] urls-file
|
||||
|
||||
DESCRIPTION
|
||||
newlispdoc is a commandline utility written in newLISP to generate HTML
|
||||
documentation from comments written in newLISP source files. Consult
|
||||
/usr/share/doc/newlisp/newLISPdoc.html for a detailed description on
|
||||
how to write comments usable for newlispdoc. The newlispdoc command
|
||||
should be executed from inside the directory where the newLISP source
|
||||
files can be found. The generated documetation files will have .html
|
||||
added to the name of the source file. An index.html page is generated,
|
||||
which is listing for each file links to all the documented functions.
|
||||
If the current directory contains the file newlispdoc.css, it will be
|
||||
used for formatting HTML output. For a sample see util/newlispdoc.css
|
||||
in the source distribution.
|
||||
|
||||
OPTIONS
|
||||
-s this option causes newlispdoc to also generate a syntax high-
|
||||
lighted HTML file of the source. A link to this file will be
|
||||
present in the HTML documentation of this file. The generated
|
||||
file will have the added extension .src.html.
|
||||
|
||||
-d also generate a link to the raw unformatted sourcefile.
|
||||
|
||||
lisp-file
|
||||
is a commented newLISP source file from which a documentation
|
||||
file will be generated.
|
||||
|
||||
-url this option is used to retrieve newLISP source files for docu-
|
||||
mentation from remote locations.
|
||||
|
||||
urls-file
|
||||
is a file containing urls of newLISP source files, one url per
|
||||
line.
|
||||
|
||||
EXAMPLES
|
||||
Generate all documentation form files in the current directory.
|
||||
newlispdoc afile.lsp bfile.lsp
|
||||
|
||||
|
||||
Generate documentation and syntax highlighted HTML versions from all
|
||||
lisp files in the current directory and also supply a download link.
|
||||
newlispdoc -s -d *.lsp
|
||||
|
||||
Retrieve source files for documentation from remote locations. Each
|
||||
file is specified on one line in urls.txt with its http:// address.
|
||||
newlispdoc -s -url urls.txt
|
||||
|
||||
EXIT STATUS
|
||||
newlispdoc returns a zero exit status for normal exit or writes a usage
|
||||
message if not enough paramneters are supplied.
|
||||
|
||||
AUTHOR
|
||||
Lutz Mueller <lutz@nuevatec.com>
|
||||
|
||||
SEE ALSO
|
||||
newlisp(1) - newlisp man page
|
||||
|
||||
http://www.newlisp.org/ - the newLISP home page
|
||||
|
||||
|
||||
|
||||
|
||||
version 3.1 July 2011 newlispdoc(1)
|
||||
|
51
doc/newlispdoc.1
Normal file
|
@ -0,0 +1,51 @@
|
|||
.TH newlispdoc 1 "July 2011" "version 3.4" "Commandline Parameters"
|
||||
.SH NAME
|
||||
.B newlispdoc
|
||||
\- generate documentation from newLISP source comments
|
||||
.SH SYNOPSIS
|
||||
.B newlispdoc
|
||||
[\-s] [\-d] lisp\-file1 [lisp\-file2 ...]
|
||||
|
||||
.B newlispdoc
|
||||
[\-s] [\-d] [\-url] urls-file
|
||||
.SH DESCRIPTION
|
||||
newlispdoc is a commandline utility written in newLISP to generate HTML documentation from comments written in newLISP source files. Consult /usr/share/doc/newlisp/newLISPdoc.html for a detailed description on how to write comments usable for newlispdoc. The newlispdoc command should be executed from inside the directory where the newLISP source files can be found. The generated documetation files will have .html added to the name of the source file. An index.html page is generated, which is listing for each file links to all the documented functions. If the current directory contains the file newlispdoc.css, it will be used for formatting HTML output. For a sample see util/newlispdoc.css in the source distribution.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\-s
|
||||
this option causes newlispdoc to also generate a syntax highlighted HTML file of the source. A link to this file will be present in the HTML documentation of this file. The generated file will have the added extension .src.html.
|
||||
.TP
|
||||
\-d
|
||||
also generate a link to the raw unformatted sourcefile.
|
||||
.TP
|
||||
lisp\-file
|
||||
is a commented newLISP source file from which a documentation file will be generated.
|
||||
.TP
|
||||
\-url
|
||||
this option is used to retrieve newLISP source files for documentation from remote locations.
|
||||
.TP
|
||||
urls-file
|
||||
is a file containing urls of newLISP source files, one url per line.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
Generate all documentation form files in the current directory.
|
||||
.B newlispdoc
|
||||
afile.lsp bfile.lsp
|
||||
.PP
|
||||
.TP
|
||||
Generate documentation and syntax highlighted HTML versions from all lisp files in the current directory and also supply a download link.
|
||||
.B newlispdoc
|
||||
\-s -d *.lsp
|
||||
.TP
|
||||
Retrieve source files for documentation from remote locations. Each file is specified on one line in urls.txt with its http:// address.
|
||||
.B newlispdoc
|
||||
\-s \-url urls.txt
|
||||
.SH EXIT STATUS
|
||||
newlispdoc returns a zero exit status for normal exit or writes a usage message if not enough paramneters are supplied.
|
||||
.SH AUTHOR
|
||||
Lutz Mueller <lutz@nuevatec.com>
|
||||
.SH SEE ALSO
|
||||
newlisp(1) \- newlisp man page
|
||||
|
||||
http://www.newlisp.org/ \- the newLISP home page
|
||||
|
25
examples/README.txt
Executable file
|
@ -0,0 +1,25 @@
|
|||
README.txt .................... this file
|
||||
async ......................... demo aysnchronous HTTP get-url requests
|
||||
client ........................ demo for TCP networking client
|
||||
env.cgi ....................... httpd server CGI file to show environment
|
||||
finger ........................ demo for using TCP finger port
|
||||
form.cgi ...................... demo for HTML form CGI
|
||||
form.html ..................... used by form.cgi
|
||||
httpd-conf.lsp ................ configuration file for newLISP httpd mode
|
||||
newLISP-Excel-Import.xls ...... demo how to import newLISP in MS Excel
|
||||
observer ...................... demo for forking processes
|
||||
opengl-demo-ffi.lsp ........... OpenGL demo for extended FFI
|
||||
opengl-demo.lsp ............... OpenGL demo for simple FFI
|
||||
prodcons.lsp .................. demo for producer/consumer messageing
|
||||
query ......................... demo for spawning parallel processes
|
||||
scan .......................... TCP port scanner
|
||||
server ........................ demo TCP server, run before TCP client
|
||||
sniff ......................... TCP port sniffer
|
||||
tcltk.lsp ..................... Tcl/Tk graphics demo
|
||||
udp-client.lsp ................ demo for UDP client
|
||||
udp-server.lsp ................ demo for UDP server
|
||||
upload.cgi .................... CGI for uploading a file (works on Apache and newLISP httpd)
|
||||
upload.html ................... used for upload.cgi
|
||||
win32demo.lsp ................. demo for importing Win32 SDK GUI functions
|
||||
xmlrpc.cgi .................... demo for xmlrpc CGI
|
||||
|
23
examples/async
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
; demo use spawn and sync for
|
||||
; aysnchronous HTTP get-url requests
|
||||
|
||||
(set 'start (time-of-day))
|
||||
|
||||
; callback routine when page is finished
|
||||
(define (page-ready pid)
|
||||
(println "pid:" pid)
|
||||
(println "received: " (length page) " bytes"))
|
||||
|
||||
; start fetching page, will return immediately
|
||||
(spawn 'page (get-url "http://www.yahoo.com"))
|
||||
|
||||
; specify call back, wait and do something else
|
||||
(until (true? (sync 100 page-ready) )
|
||||
(println (- (time-of-day) start) " ms"))
|
||||
|
||||
; all done
|
||||
(exit)
|
||||
|
||||
|
31
examples/callback
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/newlisp
|
||||
|
||||
; path-name of the library depending on platform
|
||||
; on Mac OSX use newlisp.dylib
|
||||
(set 'LIBRARY (if (= ostype "Windows") "newlisp.dll" "./newlisp.so"))
|
||||
|
||||
; import functions from the newLISP shared library
|
||||
(import LIBRARY "newlispEvalStr")
|
||||
(import LIBRARY "newlispCallback")
|
||||
|
||||
; set calltype platform specific
|
||||
(set 'CALLTYPE (if (= ostype "Windows") "stdcall" "cdecl"))
|
||||
|
||||
; the callback function
|
||||
(define (callme p1 p2 p3 result)
|
||||
(println "p1 => " p1 " p2 => " p2 " p3 => " p3)
|
||||
result)
|
||||
|
||||
; register the callback with newLISP library
|
||||
(newlispCallback "callme" (callback 0 'callme) CALLTYPE)
|
||||
|
||||
; the callback returns a string
|
||||
(println (get-string (newlispEvalStr
|
||||
{(get-string (callme 123 456 789 "hello world"))})))
|
||||
|
||||
; the callback returns a number
|
||||
(println (get-string (newlispEvalStr
|
||||
{(callme 123 456 789 99999)})))
|
||||
|
||||
|
||||
(exit)
|
38
examples/client
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
;; client for client/server demo
|
||||
;;
|
||||
;; USAGE: client hostName
|
||||
;;
|
||||
;; 'hostName' contains a string with the name or IP number
|
||||
;; of the computer running the server application
|
||||
;;
|
||||
;; The client prompts for input and sends it to the
|
||||
;; server which sends it back converted to uppercase
|
||||
;;
|
||||
;; The server has to be started first in a different
|
||||
;; terminal window or on a different computer.
|
||||
;;
|
||||
;; v 1.3
|
||||
;; v 1.4 change net-receive for v 10.0
|
||||
;;
|
||||
|
||||
(define (net-client-receive socket , buf)
|
||||
(net-receive socket buf 256)
|
||||
(print "\n" buf "\ninput or 'quit' to exit:")
|
||||
(if (= buf "bye bye!") (exit))
|
||||
(net-send socket (read-line)))
|
||||
|
||||
(define (client host-computer)
|
||||
(set 'socket (net-connect host-computer 1111))
|
||||
(if (not socket)
|
||||
(print "could not connect, is the server started?\n")
|
||||
(while true (net-client-receive socket))))
|
||||
|
||||
(if (not (main-args 2))
|
||||
(begin
|
||||
(print "USAGE: client hostName\n")
|
||||
(exit)))
|
||||
|
||||
(client (main-args 2))
|
||||
(exit)
|
25
examples/env.cgi
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env newlisp
|
||||
#
|
||||
|
||||
;;
|
||||
;; prints the environment
|
||||
;;
|
||||
(print "Content-Type: text/html\r\n\r\n")
|
||||
(print "<html>")
|
||||
|
||||
(print [text]
|
||||
<A HREF="http://newlisp.org">Home</A> |
|
||||
<A HREF="http:syntax.cgi?environment.txt">Source</A>
|
||||
[/text])
|
||||
|
||||
(println "<h2>" (date) "</h2>")
|
||||
(println "<table border=1>")
|
||||
(dolist (e (sort (env)))
|
||||
(if (and (!= (e 0) "HTTP_COOKIE") (!= (e 0) "UNIQUE_ID"))
|
||||
(println "<tr><td>" (e 0) "</td><td>" (e 1) "</td></tr>\n")
|
||||
)
|
||||
)
|
||||
(print "<h4>CGI by newLISP v" (sys-info -2)" on " ostype "<h4>")
|
||||
(println "</html>")
|
||||
(exit)
|
||||
|
36
examples/finger
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env newlisp
|
||||
#
|
||||
# v 1.1 changes for changed 'main-args'
|
||||
# v 1.2 eliminated 'net-cleanup'
|
||||
# v 1.3 replaced concat with append
|
||||
# v 1.4 direct string form of net-send, eplace name with user
|
||||
# v 1.5 change net-receive for 10.0
|
||||
#
|
||||
|
||||
(define (finger nameSite , socket buffer user site)
|
||||
(map set '(user site) (parse nameSite "@"))
|
||||
(set 'socket (net-connect site 79))
|
||||
(if (not socket)
|
||||
(begin
|
||||
(print "Could not connect\n")
|
||||
(exit)))
|
||||
(if (not (net-send socket (append user "\r\n")))
|
||||
(print "no connection\n")
|
||||
(net-finger-receive socket)))
|
||||
|
||||
(define (net-finger-receive socket , str)
|
||||
(if (not (net-receive socket str 512))
|
||||
(print "Receive failed\n")
|
||||
(print "\n" str "\n"))
|
||||
(if socket (net-close socket)))
|
||||
|
||||
(set 'params (main-args))
|
||||
(if (< (length params) 3)
|
||||
(begin
|
||||
(print "USAGE: finger name@host\n")
|
||||
(exit)))
|
||||
(finger (nth 2 params))
|
||||
(exit)
|
||||
|
||||
;eof;
|
||||
|
40
examples/form.cgi
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env newlisp
|
||||
#
|
||||
# Demo of CGI 1.1 interface
|
||||
#
|
||||
# version 1.2 changed for newlisp v.10.0
|
||||
# version 1.2a comments added
|
||||
#
|
||||
# get form data from CGI STDIN parse and
|
||||
# write back to the client browser
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
(print "Content-Type: text/html\r\n\r\n")
|
||||
(println "<h3>Post or Get Variables</h3>\n")
|
||||
|
||||
;; Try to read POST data. For an alternative
|
||||
;; method using CONTENT_LENGTH and CONTEN_TYPE
|
||||
;; see the module cgi.lsp from the distribution
|
||||
(set 'input (read-line))
|
||||
(if (not input) (set 'input (env "QUERY_STRING")))
|
||||
(if input (begin
|
||||
(set 'vars (parse input "&"))
|
||||
(dolist (elmnt vars)
|
||||
(replace "+" elmnt " ")
|
||||
(println elmnt"<br>"))
|
||||
(println "<p>")))
|
||||
|
||||
#
|
||||
# command line arguments
|
||||
(print "<h3>Command line</h3>\n" (main-args) "<p>\n")
|
||||
|
||||
#
|
||||
# print environment variables
|
||||
(println "<h3>Environment Variables</h3>")
|
||||
(dolist (e (env)) (print (e 0) "=" (e 1) "<br>"))
|
||||
(println)
|
||||
|
||||
(exit)
|
36
examples/form.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
<html>
|
||||
<head><title>A form to check newLISP CGI</title></head>
|
||||
<body>
|
||||
<h3>A test form for checking out the POST method in HTTP.</h3>
|
||||
<p>Change "localhost" in the action statement to the correct hostname, if trying this remotely.</p>
|
||||
<form action="/form.cgi" method="POST">
|
||||
Name (text entry field) <input type="text" name="name"> <p>
|
||||
Check Me (checkbox)
|
||||
<p><input type="checkbox" name="checkMe"></p>
|
||||
<p>
|
||||
Select me (radio buttons)<br>
|
||||
<input type="radio" name=color value="Red">red<BR>
|
||||
<input type="radio" name=color value="Green">green<BR>
|
||||
<input type="radio" name=color value="Blue">blue<BR>
|
||||
</p>
|
||||
<p>
|
||||
Choose one (select)
|
||||
<select name="chooseOne">
|
||||
<option> First
|
||||
<option> Second
|
||||
<option> Third
|
||||
<option> Fourth
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<p>Enter text (textarea)</p>
|
||||
<textarea name=textField rows=4 cols=40>
|
||||
</textarea>
|
||||
</p>
|
||||
<p>
|
||||
Submit It (submit) <input type="submit" value="Go">
|
||||
</p>
|
||||
</form>
|
||||
Source of CGI script: <a href="form-cgi.txt">form.cgi</a>
|
||||
</body>
|
||||
</html>
|
17
examples/httpd-conf.lsp
Normal file
|
@ -0,0 +1,17 @@
|
|||
; httpd-conf.lsp
|
||||
;;
|
||||
; filter and translate HTTP request for newLISP
|
||||
;; -c or -http server modes
|
||||
;; reject query commands using CGI with .exe files
|
||||
|
||||
(command-event (fn (s)
|
||||
(let (request s)
|
||||
(when (find "?" s) ; is this a query
|
||||
(set 'request (first (parse s "?")))
|
||||
; discover illegal extension in queries
|
||||
(when (ends-with request ".exe")
|
||||
(set 'request "GET /errorpage.html")) )
|
||||
request)
|
||||
))
|
||||
|
||||
; eof
|
14
examples/index.cgi
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
(print "Content-type: text/html\r\n\r\n")
|
||||
(println "<h2>" (real-path) "</h2>")
|
||||
|
||||
(println {<table>})
|
||||
(dolist (file (sort (directory)))
|
||||
(set 'slash (if (directory? file) "/" ""))
|
||||
(println {<tr><td><tt><a href="http:} file slash {">} file slash {</a> </tt></td><td><tt>}
|
||||
(date (last (file-info file)) 0 "%Y-%m-%d %H:%M:%S") {</tt></td>}
|
||||
{<td><pre>} (format "%12.3f KB" (div (file-info file 0) 1000)) {</pre></td></tr>}))
|
||||
(println {</table>})
|
||||
(exit)
|
||||
|
BIN
examples/newLISP-Excel-Import.xls
Executable file
22
examples/observer
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
(define (count-down-proc x channel)
|
||||
(while (!= x 0)
|
||||
(write-line channel (string x))
|
||||
(dec x)))
|
||||
|
||||
(define (observer-proc channel)
|
||||
(do-until (= i "1")
|
||||
(println "process " (setq i (read-line channel)))))
|
||||
|
||||
(map set '(in out) (pipe))
|
||||
(set 'observer (fork (observer-proc in)))
|
||||
(set 'counter (fork (count-down-proc 5 out)))
|
||||
|
||||
; avoid zombies
|
||||
(wait-pid observer)
|
||||
(wait-pid counter)
|
||||
|
||||
(exit)
|
||||
|
||||
|
187
examples/opengl-demo-ffi.lsp
Normal file
|
@ -0,0 +1,187 @@
|
|||
#!/usr/bin/env newlisp
|
||||
# OpenGL and GLUT demo - opengl-demo-ffi.lsp
|
||||
# Using extended import and callback API based on libffi
|
||||
# tested on Windows and OS X 32/64-bit (Intel) minimum version newLISP 10.3.10
|
||||
|
||||
# verson 2.1 December 2011 - remade with extended FFI for 32 and 64-bit
|
||||
# verson 2.2 February 2012 - check if newLISP compiled for extended FFI
|
||||
# verson 2.3 April 2015 - changed ostype to Windows from Win32
|
||||
# this version works on both, 32-bit and 64-bit newLISP
|
||||
# on a Mac OSX standard install everything neede for 32-bit or 64-bit
|
||||
# is included. On Windows XP and Windows 7, glut32.dll must be added.
|
||||
# on Linux opengl.so, libglut.so and libffi.so must be added, most
|
||||
# Linux seem to include libffi.so already. See also the C version:
|
||||
# http://graphics.stanford.edu/courses/cs248-01/OpenGLHelpSession/code_example.html
|
||||
|
||||
#
|
||||
# for a complete function reference for OpenGL look here:
|
||||
# http://www.opengl.org/documentation/
|
||||
#
|
||||
# for descriptions and refence to GLU see here:
|
||||
# http://www.opengl.org/resources/libraries/glut/
|
||||
#
|
||||
# Calling patterns for OpenGL functions:
|
||||
# Functions are described in the manual with the following types:
|
||||
#
|
||||
# All the following integer types are passed as is or with (int ...):
|
||||
# GLenum GLboolean GLbitfield GLbyte GLshort GLint GLsizei GLubyte GLushort GLuint
|
||||
# and types ending in: 3b, si, 3s
|
||||
#
|
||||
# The following double float types are passed as is or with (float ...):
|
||||
# GLdouble GLclampd
|
||||
# and types ending in: 3d
|
||||
#
|
||||
# The following are small float types
|
||||
# GLfloat GLclampf
|
||||
# and all types ending 3f:
|
||||
#
|
||||
# Note! on Windows 7 glut32.dll should be installed c:/Windows/SysWOW64/ not system32
|
||||
|
||||
(set 'is-64-bit (= 0x100 (& 0x100 (sys-info -1))))
|
||||
(set 'has-ffi (= 1024 (& 1024 (sys-info -1))))
|
||||
|
||||
(unless has-ffi
|
||||
(println "need newLISP compiled for extended FFI")
|
||||
(exit))
|
||||
|
||||
(if
|
||||
(= ostype "OSX") ;; drawings will be visible only on x86 based OS X
|
||||
(begin
|
||||
(set 'GL_LIB "/System/Library/Frameworks/OpenGL.Framework/Libraries/libGL.dylib")
|
||||
(set 'GLUT_LIB "/System/Library/Frameworks/GLUT.Framework/GLUT")
|
||||
)
|
||||
(find ostype '("Windows", "Cygwin"))
|
||||
(begin
|
||||
(set 'GL_LIB "opengl32.dll") ; works dfor both 32 and 64 bit
|
||||
(set 'GLUT_LIB (if is-64-bit "glut64.dll" "glut32.dll")))
|
||||
(= ostype "Linux") ;; not tested
|
||||
(begin
|
||||
(set 'GL_LIB "libGL.so")
|
||||
(set 'GLUT_LIB "libglut.so"))
|
||||
)
|
||||
|
||||
(import GL_LIB "glClear" "void" "int")
|
||||
(import GL_LIB "glClearColor" "void" "float" "float" "float" "float")
|
||||
(import GL_LIB "glEnable" "void" "int")
|
||||
(import GL_LIB "glHint" "void" "int" "int")
|
||||
(import GL_LIB "glColor3d" "void" "double" "double" "double")
|
||||
(import GL_LIB "glBegin" "void" "int")
|
||||
(import GL_LIB "glEnd" "void" "void")
|
||||
(import GL_LIB "glVertex3d" "void" "double" "double" "double")
|
||||
(import GL_LIB "glFlush" "void")
|
||||
(import GL_LIB "glFinish" "void")
|
||||
(import GL_LIB "glRotated" "void" "double" "double" "double" "double")
|
||||
(import GL_LIB "glLineWidth" "void" "float")
|
||||
|
||||
(import GLUT_LIB "glutInit" "void" "void*" "void*")
|
||||
(import GLUT_LIB "glutDisplayFunc" "void" "void*")
|
||||
(import GLUT_LIB "glutInitWindowSize" "void" "int" "int")
|
||||
(import GLUT_LIB "glutInitDisplayMode" "void" "int")
|
||||
(import GLUT_LIB "glutInitWindowPosition" "void" "int" "int")
|
||||
(import GLUT_LIB "glutDisplayFunc" "void" "void*")
|
||||
(import GLUT_LIB "glutKeyboardFunc" "void" "void*")
|
||||
(import GLUT_LIB "glutMouseFunc" "void" "void*")
|
||||
(import GLUT_LIB "glutJoystickFunc" "void" "void*" "int")
|
||||
(import GLUT_LIB "glutMotionFunc" "void" "void*")
|
||||
(import GLUT_LIB "glutIdleFunc" "void" "void*")
|
||||
(import GLUT_LIB "glutCreateWindow" "int" "char*")
|
||||
(import GLUT_LIB "glutCreateSubWindow" "int" "int" "int" "int" "int" "int")
|
||||
(import GLUT_LIB "glutMainLoop" "void")
|
||||
(import GLUT_LIB "glutSwapBuffers" "void")
|
||||
(import GLUT_LIB "glutPostRedisplay" "void")
|
||||
|
||||
(import GLUT_LIB "glutSolidCube" "void" "double")
|
||||
(import GLUT_LIB "glutSolidTeapot" "void" "double")
|
||||
(import GLUT_LIB "glutWireCube" "void" "double")
|
||||
(import GLUT_LIB "glutWireTeapot" "void" "double")
|
||||
|
||||
(constant 'GL_COLOR_BUFFER_BIT 0x00004000)
|
||||
(constant 'GL_TRIANGLES 0x0004)
|
||||
(constant 'GL_BLEND 0x0BE2)
|
||||
(constant 'GL_LINE_SMOOTH 0x0B20)
|
||||
(constant 'GL_DONT_CARE 0x1100)
|
||||
(constant 'GL_LINE_SMOOTH_HINT 0x0C52)
|
||||
|
||||
(constant 'GLUT_DOUBLE 0x0002)
|
||||
(constant 'GLUT_SINGLE 0x0000)
|
||||
(constant 'GLUT_RGB 0x0000)
|
||||
(constant 'GLUT_RGBA 0x0000)
|
||||
|
||||
(set 'argc 0)
|
||||
(set 'argv1 "")
|
||||
(set 'argv (pack "lu" argv1))
|
||||
(set 'rotx 0.0)
|
||||
(set 'roty 0.0)
|
||||
(set 'PI (atan2 0 -1))
|
||||
|
||||
(define (draw)
|
||||
(glClear GL_COLOR_BUFFER_BIT)
|
||||
(glRotated rotx 0.0 1.0 0.0)
|
||||
(glRotated roty 1.0 0.0 0.0)
|
||||
(glutWireTeapot 0.5)
|
||||
(glutSwapBuffers)
|
||||
)
|
||||
|
||||
(define (drawObject)
|
||||
(glClear GL_COLOR_BUFFER_BIT )
|
||||
(glColor3d 1.0 0.85 0.35)
|
||||
(glRotated rotx 0.0 1.0 0.0)
|
||||
(glRotated roty 1.0 0.0 0.0)
|
||||
(glBegin GL_TRIANGLES)
|
||||
(glVertex3d 0.0 0.6 0.0)
|
||||
(glVertex3d -0.2 -0.3 0.0)
|
||||
(glVertex3d 0.2 -0.3 0.0)
|
||||
(glEnd)
|
||||
(glutSwapBuffers)
|
||||
)
|
||||
|
||||
(define (rotation)
|
||||
(set 'rotx (mod (sub rotx .01) PI))
|
||||
(set 'roty (mod (sub roty .012) PI))
|
||||
(sleep 10)
|
||||
(glutPostRedisplay)
|
||||
)
|
||||
|
||||
(define (keyboard key x y)
|
||||
(if (= key 27) (exit))
|
||||
(println "key:" (& key 0xFF) " x:" x " y:" y))
|
||||
|
||||
(define (mouse button state x y)
|
||||
(if (= state 0)
|
||||
(glutIdleFunc 0) ; auto-motion off on button press
|
||||
(glutIdleFunc (callback 'rotation))) ; auto-motion on
|
||||
(println "mouse button: " button " state:" state " x:" x " y:" y))
|
||||
|
||||
(define (joystick button x y z)
|
||||
(println "joystick button: " button " x: " x " y: " y " z: " z))
|
||||
|
||||
(define (motion x y)
|
||||
(set 'rotx (mul (div 200 x) PI))
|
||||
(set 'roty (mul (div 150 y) PI))
|
||||
(glutPostRedisplay)
|
||||
(println "x:" x " y:" y))
|
||||
|
||||
(glutInit (address argc) (address argv))
|
||||
(glutInitDisplayMode (| GLUT_RGB GLUT_DOUBLE ))
|
||||
(glutInitWindowSize 800 600)
|
||||
(glutInitWindowPosition 80 80)
|
||||
(set 'id (glutCreateWindow "OpenGL and newLISP - drag mouse - ESC to exit"))
|
||||
|
||||
(glClearColor 0.5 0.3 0.3 0.0)
|
||||
(glColor3d 1.0 0.85 0.35)
|
||||
|
||||
(glutDisplayFunc (callback 'draw "void"))
|
||||
;(glutDisplayFunc (callback 0 'drawObject))
|
||||
(glutKeyboardFunc (callback 'keyboard "void" "byte" "int" "int"))
|
||||
(glutMouseFunc (callback 'mouse "void" "int" "int" "int" "int"))
|
||||
(glutMotionFunc (callback 'motion "void" "int" "int"))
|
||||
(glutIdleFunc (callback 'rotation "void"))
|
||||
(glutJoystickFunc (callback 'joystick "void" "int" "int" "int" "int") 50)
|
||||
(glutMainLoop)
|
||||
|
||||
;; eof
|
||||
|
||||
;(glEnable GL_BLEND)
|
||||
;(glEnable GL_LINE_SMOOTH) ; turn on antialiasing
|
||||
;(glHint GL_LINE_SMOOTH_HINT GL_DONT_CARE)
|
||||
;(glLineWidth 3)
|
197
examples/opengl-demo.lsp
Normal file
|
@ -0,0 +1,197 @@
|
|||
#!/usr/bin/env newlisp
|
||||
# OpenGL and GLUT demo - opengl-demo.lsp
|
||||
# using simple import and callback API
|
||||
# tested on Windows and OS X (Intel) 32-bit only!
|
||||
|
||||
# version 1.2, July 2009 - make drawObject working with motion
|
||||
|
||||
# this version runs only on 32-bit newLISP and libraries
|
||||
# for 64-bit newlisp use http://www.newlisp.org/downloads/OpenGL/opengl-demo-ffi-lsp.txt,
|
||||
# which runs both 32/64 versions of newLISP. For this extended ffi version newLISP 10.4.0
|
||||
# or later is required. The extended ffi interface is present in all binary distributions
|
||||
# (Windows, OSX, Ubuntu)
|
||||
|
||||
# WIn32
|
||||
# opengl32.dll - should be already on you WindowsXP installation or at www.opengl.org
|
||||
# glut32.dll - available here: http://www.opengl.org/resources/libraries/glut/
|
||||
# Note! on Windows 7 glut32.dll should be installed c:/Windows/SysWOW64/ not system32
|
||||
#
|
||||
# Linux/UNIX - not tested
|
||||
# libGLU.so - should be on your Linux/UNIX installation or at www.opengl.org
|
||||
# glut-3.7.so - already on your system or at:
|
||||
# http://www.opengl.org/resources/libraries/glut/
|
||||
#
|
||||
# Mac OS X - works well on Intel based Mac OS X, will not work on PPC
|
||||
# nothing needs to be installed on Mac OX X 10.4 and later
|
||||
# libGL.dylib - in /System/Library/Frameworks/OpenGL.Framework
|
||||
# GLUT - in /System/Library/Frameworks/GLUT.Framework
|
||||
#
|
||||
# for a complete function reference for OpenGL look here:
|
||||
# http://www.opengl.org/documentation/
|
||||
#
|
||||
# for descriptions and refence to GLU see here:
|
||||
# http://www.opengl.org/resources/libraries/glut/
|
||||
#
|
||||
# Calling patterns for OpenGL functions:
|
||||
# Functions are described in the manual with the following types:
|
||||
#
|
||||
# All the following integer types are passed as is or with (int ...):
|
||||
# GLenum GLboolean GLbitfield GLbyte GLshort GLint GLsizei GLubyte GLushort GLuint
|
||||
# and types ending in: 3b, si, 3s
|
||||
#
|
||||
# The following double float types are passed as is or with (float ...):
|
||||
# GLdouble GLclampd
|
||||
# and types ending in: 3d
|
||||
#
|
||||
# The following small float types are must with (flt ...) conversion:
|
||||
# GLfloat GLclampf
|
||||
# and all types ending 3f:
|
||||
#
|
||||
|
||||
(when (= 256 (& 256 (last (sys-info)))) ; if it is 64 bit version
|
||||
(println "This file can run only on the 32-bit version of newLISP")
|
||||
(println "Use opengl-demo-ffi.lsp, which runs on both, 32-bit and 64-bit")
|
||||
(exit))
|
||||
|
||||
(if
|
||||
(= ostype "OSX") ;; drawings will be visible only on x86 based OS X
|
||||
(begin
|
||||
(set 'GL_LIB "/System/Library/Frameworks/OpenGL.Framework/Libraries/libGL.dylib")
|
||||
(set 'GLUT_LIB "/System/Library/Frameworks/GLUT.Framework/GLUT")
|
||||
)
|
||||
(find ostype '("Windows", "Cygwin"))
|
||||
(begin
|
||||
(set 'GL_LIB "opengl32.dll")
|
||||
(set 'GLUT_LIB "glut32.dll"))
|
||||
(= ostype "Linux") ;; not tested
|
||||
(begin
|
||||
(set 'GL_LIB "libGL.so")
|
||||
(set 'GLUT_LIB "libglut.so"))
|
||||
)
|
||||
|
||||
(import GL_LIB "glClear")
|
||||
(import GL_LIB "glClearColor")
|
||||
(import GL_LIB "glEnable")
|
||||
(import GL_LIB "glHint")
|
||||
(import GL_LIB "glColor3d")
|
||||
(import GL_LIB "glBegin")
|
||||
(import GL_LIB "glEnd")
|
||||
(import GL_LIB "glVertex3d")
|
||||
(import GL_LIB "glFlush")
|
||||
(import GL_LIB "glFinish")
|
||||
(import GL_LIB "glRotated")
|
||||
(import GL_LIB "glLineWidth")
|
||||
|
||||
(import GLUT_LIB "glutInit")
|
||||
(import GLUT_LIB "glutDisplayFunc")
|
||||
(import GLUT_LIB "glutInitWindowSize")
|
||||
(import GLUT_LIB "glutInitDisplayMode")
|
||||
(import GLUT_LIB "glutInitWindowPosition")
|
||||
(import GLUT_LIB "glutDisplayFunc")
|
||||
(import GLUT_LIB "glutKeyboardFunc")
|
||||
(import GLUT_LIB "glutMouseFunc")
|
||||
(import GLUT_LIB "glutJoystickFunc")
|
||||
(import GLUT_LIB "glutMotionFunc")
|
||||
(import GLUT_LIB "glutIdleFunc")
|
||||
(import GLUT_LIB "glutCreateWindow")
|
||||
(import GLUT_LIB "glutCreateSubWindow")
|
||||
(import GLUT_LIB "glutMainLoop")
|
||||
(import GLUT_LIB "glutSwapBuffers")
|
||||
(import GLUT_LIB "glutPostRedisplay")
|
||||
|
||||
(import GLUT_LIB "glutSolidCube")
|
||||
(import GLUT_LIB "glutSolidTeapot")
|
||||
(import GLUT_LIB "glutWireCube")
|
||||
(import GLUT_LIB "glutWireTeapot")
|
||||
|
||||
(constant 'GL_COLOR_BUFFER_BIT 0x00004000)
|
||||
(constant 'GL_TRIANGLES 0x0004)
|
||||
(constant 'GL_BLEND 0x0BE2)
|
||||
(constant 'GL_LINE_SMOOTH 0x0B20)
|
||||
(constant 'GL_DONT_CARE 0x1100)
|
||||
(constant 'GL_LINE_SMOOTH_HINT 0x0C52)
|
||||
|
||||
(constant 'GLUT_DOUBLE 0x0002)
|
||||
(constant 'GLUT_SINGLE 0x0000)
|
||||
(constant 'GLUT_RGB 0x0000)
|
||||
(constant 'GLUT_RGBA 0x0000)
|
||||
|
||||
(set 'argc 0)
|
||||
(set 'argv1 "")
|
||||
(set 'argv (pack "lu" argv1))
|
||||
(set 'rotx 0.0)
|
||||
(set 'roty 0.0)
|
||||
(set 'PI (mul (acos 0) 2))
|
||||
|
||||
(define (draw)
|
||||
(glClear GL_COLOR_BUFFER_BIT )
|
||||
(glRotated rotx 0.0 1.0 0.0)
|
||||
(glRotated roty 1.0 0.0 0.0)
|
||||
(glutWireTeapot 0.5)
|
||||
(glutSwapBuffers)
|
||||
)
|
||||
|
||||
(define (drawObject)
|
||||
(glClear GL_COLOR_BUFFER_BIT )
|
||||
(glColor3d 1.0 0.85 0.35)
|
||||
(glRotated rotx 0.0 1.0 0.0)
|
||||
(glRotated roty 1.0 0.0 0.0)
|
||||
(glBegin GL_TRIANGLES)
|
||||
(glVertex3d 0.0 0.6 0.0)
|
||||
(glVertex3d -0.2 -0.3 0.0)
|
||||
(glVertex3d 0.2 -0.3 0.0)
|
||||
(glEnd)
|
||||
(glutSwapBuffers)
|
||||
)
|
||||
|
||||
(define (rotation)
|
||||
(set 'rotx (mod (sub rotx .01) PI))
|
||||
(set 'roty (mod (sub roty .012) PI))
|
||||
(sleep 10)
|
||||
(glutPostRedisplay)
|
||||
)
|
||||
|
||||
(define (keyboard key x y)
|
||||
(if (= (& key 0xFF) 27) (exit)) ; 0xFF mask necessary in Windows
|
||||
(println "key:" (& key 0xFF) " x:" x " y:" y))
|
||||
|
||||
(define (mouse button state x y)
|
||||
(if (= state 0)
|
||||
(glutIdleFunc 0) ; auto-motion off on button press
|
||||
(glutIdleFunc (callback 4 'rotation))) ; auto-motion on
|
||||
(println "mouse button: " button " state:" state " x:" x " y:" y))
|
||||
|
||||
(define (joystick button x y z)
|
||||
(println "joystick button: " button " x: " x " y: " y " z: " z))
|
||||
|
||||
(define (motion x y)
|
||||
(set 'rotx (mul (div 200 x) PI))
|
||||
(set 'roty (mul (div 150 y) PI))
|
||||
(glutPostRedisplay)
|
||||
(println "x:" x " y:" y)
|
||||
(reset))
|
||||
|
||||
(glutInit (address argc) (address argv))
|
||||
(glutInitDisplayMode (| GLUT_RGB GLUT_DOUBLE ))
|
||||
(glutInitWindowSize 800 600)
|
||||
(glutInitWindowPosition 80 80)
|
||||
(set 'id (glutCreateWindow "OpenGL and newLISP - drag mouse - ESC to exit"))
|
||||
|
||||
(glClearColor (flt 0.5) (flt 0.3) (flt 0.3) (flt 0.0))
|
||||
(glColor3d 1.0 0.85 0.35)
|
||||
|
||||
(glutDisplayFunc (callback 0 'draw))
|
||||
;(glutDisplayFunc (callback 0 'drawObject))
|
||||
(glutKeyboardFunc (callback 1 'keyboard))
|
||||
(glutMouseFunc (callback 2 'mouse))
|
||||
(glutMotionFunc (callback 3 'motion))
|
||||
(glutIdleFunc (callback 4 'rotation))
|
||||
(glutJoystickFunc (callback 5 'joystick) 50)
|
||||
(glutMainLoop)
|
||||
|
||||
;; eof
|
||||
|
||||
;(glEnable GL_BLEND)
|
||||
;(glEnable GL_LINE_SMOOTH) ; turn on antialiasing
|
||||
;(glHint GL_LINE_SMOOTH_HINT GL_DONT_CARE)
|
||||
;(glLineWidth 3)
|
53
examples/prodcons.lsp
Normal file
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
# prodcons.lsp - Producer/consumer
|
||||
#
|
||||
# this program only runs on Linux/UNIX
|
||||
#
|
||||
# usage of 'fork', 'wait-pid', 'semaphore' and 'share'
|
||||
|
||||
(when (= ostype "Windows")
|
||||
(println "this will not run on Windows")
|
||||
(exit))
|
||||
|
||||
(constant 'wait -1 'sig 1 'release 0)
|
||||
|
||||
(define (consumer n)
|
||||
(set 'i 0)
|
||||
(while (< i n)
|
||||
(semaphore cons-sem wait)
|
||||
(print (set 'i (share data)) "\r")
|
||||
(semaphore prod-sem sig))
|
||||
(exit))
|
||||
|
||||
(define (producer n)
|
||||
(for (i 1 n)
|
||||
(semaphore prod-sem wait)
|
||||
(print "-> " (share data i) " -> ")
|
||||
(semaphore cons-sem sig))
|
||||
(exit))
|
||||
|
||||
|
||||
(define (run n)
|
||||
(set 'data (share))
|
||||
(share data 0)
|
||||
|
||||
(set 'prod-sem (semaphore)) ; get semaphores
|
||||
(set 'cons-sem (semaphore))
|
||||
|
||||
(set 'prod-pid (fork (producer n))) ; start threads
|
||||
(set 'cons-pid (fork (consumer n)))
|
||||
(semaphore prod-sem sig) ; get producer started
|
||||
|
||||
(wait-pid prod-pid) ; wait for threads to finish
|
||||
(wait-pid cons-pid) ;
|
||||
(semaphore cons-sem release) ; release semaphores
|
||||
(semaphore prod-sem release))
|
||||
|
||||
(set 'N (or (int (main-args -1)) 100000))
|
||||
(set 'duration (time (run N)))
|
||||
|
||||
(println (div duration N) " ms per exchange")
|
||||
|
||||
(exit)
|
||||
|
143
examples/query
Executable file
|
@ -0,0 +1,143 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
; Retrieves a page with 20 links via Google containing
|
||||
; the search word, then spawns 20 child processes, each
|
||||
; retrieving one page from a link. All pages are then
|
||||
; HTML-cleaned, tokenized and words are counted using
|
||||
; bayes-train.
|
||||
|
||||
; USAGE: query <search-word>
|
||||
|
||||
; or rename to query.cgi and run on a web server
|
||||
; using the following query.html:
|
||||
|
||||
; NOTE!!! Google changes the formatting of links (see LINK_REGEX) once
|
||||
; in a while and then the whole thing breaks!
|
||||
|
||||
|
||||
;<html>
|
||||
;<head><title>Query</title></head>
|
||||
;<body><font face="Verdana">
|
||||
;<p>Parallel processing support on newLISP using 'spawn'</p>
|
||||
;<form name="query" action="query.cgi" method="POST">
|
||||
;Input a search word: <input type="text" name="query" size="48">
|
||||
; <input type="submit" value="Submit" name="submit">
|
||||
;</form>
|
||||
;</font></body></html>
|
||||
|
||||
(set 'cgi-mode nil)
|
||||
;(set 'cgi-mode true) ; run as CGI get question from query.html
|
||||
|
||||
(when cgi-mode
|
||||
(module "cgi.lsp")
|
||||
(print "Content-Type: text/html\n\n"))
|
||||
|
||||
;; globals and constants in this namespace
|
||||
(set 'LINK_REGEX {q=(http://[^>& ]+)&})
|
||||
(set 'START_TIME 0)
|
||||
(set 'SITES '())
|
||||
(set 'CONTENT "")
|
||||
(constant 'BRK (if cgi-mode "<br>" ""))
|
||||
|
||||
(define (url-decode str)
|
||||
(replace "%([0-9A-F][0-9A-F])" str (char (int $1 0 16)) 1))
|
||||
|
||||
(define (url-encode str)
|
||||
(replace {([^a-zA-Z0-9])} str (format "%%%2X" (char $1)) 0))
|
||||
|
||||
(define (clean-html text)
|
||||
(replace "<script.*?</script>" text "" 4)
|
||||
(replace "<style.*?</style>" text "" 4)
|
||||
(replace "<head.*?</head>" text "" 4)
|
||||
(replace "<[^>]*>" text " " 0)
|
||||
(replace "." text " . ")
|
||||
(replace "," text " , ")
|
||||
(replace "!" text " ! ")
|
||||
(replace "?" text " ? ")
|
||||
(replace "\n" text " ")
|
||||
(replace "\r" text "")
|
||||
(replace "\t" text " ")
|
||||
(replace " +" text " " 4)
|
||||
; this should be a list of all ISO 8859-1 Symbols
|
||||
; see http://www.w3schools.com/tags/ref_entities.asp
|
||||
; HTML entities should be replaced with UTF-8
|
||||
(replace " " text " ")
|
||||
(replace "—" text " - ")
|
||||
(replace "–" text " - ")
|
||||
(replace """ text "'")
|
||||
(replace "&" text "&")
|
||||
;(replace "‎" text (char 8206))
|
||||
;(replace {\&#(\d+);} text (char (int $1)) 0)
|
||||
)
|
||||
|
||||
(if cgi-mode
|
||||
(set 'question (CGI:get "query"))
|
||||
(set 'question (last (parse (main-args -1) "/"))) ; default is 'query'
|
||||
)
|
||||
|
||||
|
||||
(set 'page (get-url
|
||||
(string "http://www.google.com/search?q=" (url-encode question)
|
||||
"&num=22&ie=UTF-8&oe=UTF-8")))
|
||||
|
||||
(set 'links (find-all LINK_REGEX page $1))
|
||||
|
||||
(when cgi-mode
|
||||
(println {<html><font face="Verdana"><head>})
|
||||
(println {<META http-equiv="Content-Type" CONTENT="text/html; charset=utf-8" />})
|
||||
(println {</head><body>}))
|
||||
|
||||
(println "query term: " (url-decode question) BRK)
|
||||
(set 'START_TIME (time-of-day))
|
||||
|
||||
######################### this is, where all the pages are retrieved #################
|
||||
; spawn a childprocess for each link
|
||||
(dolist (lnk (0 20 links))
|
||||
(set 'pid (spawn 'page (get-url lnk 4000)))
|
||||
(push (list pid lnk) SITES -1))
|
||||
|
||||
; this gets executed whenever a page has been retrieved
|
||||
(define (page-ready-event pid)
|
||||
(let (link (0 80 (lookup pid SITES)))
|
||||
(set 'link (url-decode link))
|
||||
(println (inc cnt) " pid:" pid " " (- (time-of-day) START_TIME) " ms " link BRK)
|
||||
(push (lower-case (clean-html page)) CONTENT -1)
|
||||
(inc xferred (length page)))
|
||||
)
|
||||
|
||||
; start waiting for pages
|
||||
(println "waiting: ..." BRK BRK)
|
||||
(unless (sync 10000 page-ready-event)
|
||||
(println BRK "timeout" BRK))
|
||||
#####################################################################################
|
||||
|
||||
(println BRK "bytes transferred: " xferred BRK)
|
||||
(println "total time: " (- (time-of-day) START_TIME) " ms" BRK)
|
||||
|
||||
######################### all the counting is done here using bayes-train ###########
|
||||
(catch (load "Lex") 'result)
|
||||
(println "training: " (time (bayes-train (find-all {[a-zA-Z]+} CONTENT) 'Lex)) " ms" BRK)
|
||||
(println "total words processed: " (Lex:total 0) BRK)
|
||||
(println BRK)
|
||||
#####################################################################################
|
||||
|
||||
; sort by frequency and print in four columns
|
||||
(set 'items (sort (Lex) (fn (x y) (> (x 1 0) (y 1 0)))))
|
||||
(set 'items (transpose (explode items (ceil (div (length items) 4)))))
|
||||
|
||||
(when cgi-mode (println "<pre>"))
|
||||
(dolist (line items)
|
||||
(dolist (item line)
|
||||
(if (and item (< (length (item 0)) 19))
|
||||
(print (format "%-18s %5d, " (item 0) (item 1 0)))
|
||||
(print (format "%-18s , " " ")))) ; nil
|
||||
(println))
|
||||
|
||||
(when cgi-mode
|
||||
(println "</pre>")
|
||||
(println "</body></font></html>"))
|
||||
|
||||
; if accumulating results over various queries
|
||||
;(save "Lex" 'Lex)
|
||||
(exit)
|
||||
|
48
examples/scan
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
; - scan - v.1.0 port scanner in newLISP
|
||||
; much faster on Mac OSX, LINUX and other UNIX than on Windows
|
||||
; as on UNIX net-connect can return on failure before the timeout
|
||||
; has exspired. On Windows net-connect will wait out the timeout
|
||||
; if it cannot connect.
|
||||
;
|
||||
; Example:
|
||||
;
|
||||
|
||||
(when (< (sys-info -2) 10204)
|
||||
(println "newLISP v.10.2.4 or later required")
|
||||
(exit))
|
||||
|
||||
(set 'host (main-args 2))
|
||||
(unless host (println [text]
|
||||
- newLISP scan v1.1, a simple portscanner
|
||||
|
||||
USAGE: scan <host-ip-or-name> [<timeout-msec> [<from-port> [<to-port>]]]
|
||||
|
||||
EXAMPLES:
|
||||
scan localhost 200 1 1024
|
||||
scan example.com
|
||||
scan 192.168.1.92 300 20
|
||||
|
||||
Default for <timeout-msec> is 1000 milli seconds
|
||||
Defaults for <from-port> and <to-port> are 1 to 1024
|
||||
[/text])
|
||||
(exit))
|
||||
|
||||
(set 'timeout (or (int (main-args 3)) 1000))
|
||||
(set 'from-port (or (int (main-args 4)) 1))
|
||||
(set 'to-port (or (int (main-args 5)) 1024))
|
||||
|
||||
(println "scanning: " host)
|
||||
(for (port from-port to-port)
|
||||
(if (set 'socket (net-connect host port timeout))
|
||||
(begin
|
||||
(println "open port: " port " " (or (net-service port "tcp") ""))
|
||||
(net-close socket))
|
||||
(print port "\r"))
|
||||
)
|
||||
(println)
|
||||
(exit)
|
||||
|
||||
;; eof
|
||||
|
42
examples/server
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
;; server for client/server demo
|
||||
;;
|
||||
;; USAGE: server
|
||||
;;
|
||||
;; Start the client programm in a different
|
||||
;; terminal window or on a different computer
|
||||
;; See the 'client' file for more info.
|
||||
;;
|
||||
;; v 1.1
|
||||
;; v 1.2 change net-receive for 10.0
|
||||
;;
|
||||
|
||||
(define (net-server-accept listenSocket)
|
||||
(while online
|
||||
(set 'connect (net-accept listenSocket))
|
||||
(net-send connect "Connected!\n")
|
||||
(while (net-server-receive connect))))
|
||||
|
||||
(define (net-server-receive socket , str)
|
||||
(net-receive socket str 256)
|
||||
(print "received:" str "\n")
|
||||
(if (= str "quit")
|
||||
(begin
|
||||
(net-send socket "bye bye!")
|
||||
(net-close socket) nil)
|
||||
(net-send socket (upper-case str))))
|
||||
|
||||
(define (server)
|
||||
(if (not (set 'socket (net-listen 1111)))
|
||||
(print "Listen failed:\n" (net-error))
|
||||
(begin
|
||||
(set 'online true)
|
||||
(print "\nServer started\n")
|
||||
(net-server-accept socket)
|
||||
)))
|
||||
|
||||
(server)
|
||||
|
||||
; eof ;
|
||||
|
283
examples/sniff
Executable file
|
@ -0,0 +1,283 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
; sniff v.1.23 - net work packet snifffer
|
||||
; 2010-March-26 added out-commented callback method
|
||||
; 2010-April-10 documentation
|
||||
; 2010-April-27 added 'packet' output format for whole packet
|
||||
; added output of unknown packets
|
||||
; 2010-April-29 help text improvements
|
||||
; 2010-May-29 added library path for OpenBSD 4.6
|
||||
; 2013-Sep-22 change stats to pstats (stats is function since 10.4.2)
|
||||
;
|
||||
; See also http://www.tcpdump.org/pcap.htm
|
||||
; tested on Mac OS X 10.6 and UBUNTU 9.4 and Win32
|
||||
; for a Win32 library goto http://www.winpcap.org/
|
||||
; first version L.M.in March 2010
|
||||
;
|
||||
; This script must be run with super user prigileges.
|
||||
|
||||
(unless (main-args 2)
|
||||
(println [text]
|
||||
- sniff - network packet sniffer, version 1.21, April 2010
|
||||
|
||||
USAGE UNIX:
|
||||
sudo sniff <device> [<filter> [<count> [hex | ascii | packet]]]
|
||||
|
||||
USAGE Win32:
|
||||
newlisp sniff <device> [<filter> [<count> [hex | ascii | packet]]]
|
||||
|
||||
The program must run in super user or administrator mode. On Unix the
|
||||
sudo utility can be used, and the OS will ask for the root password.
|
||||
|
||||
EXAMPLES:
|
||||
sniff eth01 'tcp port 80' 100 hex
|
||||
sniff en1 ip 100 packet <-- best all purpose format
|
||||
sniff eth0 'ip host 10.1.2.3'
|
||||
sniff en0
|
||||
sniff ""
|
||||
|
||||
Use an empty string "" or '' for <device> to let sniff find out a device.
|
||||
This works well on Windows but frequently does not work on UNIX, where
|
||||
it is better to use the ifconfig utility to find a connected device.
|
||||
|
||||
The 'hex' option dumps data in HEX and ASCII, the 'ascii' option only in
|
||||
ASCII format. Both options only dump the data part of the packet after the
|
||||
TCP, UDP or frst 8 bytees of the ICMP header. The 'packet' option dumps
|
||||
the whole packet starting with the IP header and in HEX and ASCII format.
|
||||
|
||||
Default <filter> expression is 'ip' for all protocols. The protocol ids:
|
||||
tcp, udp and icmp are supported. Default packet <count> is 10 and
|
||||
default output mode is no output.
|
||||
[/text])
|
||||
(exit)
|
||||
)
|
||||
|
||||
; import pcap library
|
||||
|
||||
(set 'bit-64 (= 256 (& (sys-info -1) 256)))
|
||||
|
||||
(set 'files '(
|
||||
"/usr/lib/libpcap.dylib" ; Mac OS X 10.6
|
||||
"/usr/lib/libpcap.so.0.8" ; UBUNTU 9.04
|
||||
"/usr/lib/libpcap.so.1.0.0"; UBUNTU 9.04
|
||||
"/usr/lib/libpcap.so.6.0" ; OpenBSD 4.8
|
||||
"c:/windows/system32/wpcap.dll" ; Win32 XP
|
||||
))
|
||||
|
||||
(set 'libpcap (files (or
|
||||
(find true (map file? files))
|
||||
(throw-error "cannot find pcap packet capture library"))))
|
||||
|
||||
; import library functions
|
||||
(import libpcap "pcap_lookupdev")
|
||||
(import libpcap "pcap_lookupnet")
|
||||
(import libpcap "pcap_open_live")
|
||||
(import libpcap "pcap_compile")
|
||||
(import libpcap "pcap_setfilter")
|
||||
(import libpcap "pcap_next")
|
||||
(import libpcap "pcap_loop")
|
||||
(import libpcap "pcap_stats")
|
||||
|
||||
; allocate ptr varables used in library API
|
||||
(set 'errbuf (dup "\000" 256)) ; for error message
|
||||
(set 'fp (dup "\000" 8)) ; sizeof pointer (32 and 64 bit)
|
||||
(set 'net "\000\000\000\000") ; IP number of sniffing device
|
||||
(set 'mask "\000\000\000\000") ; net mask of sniffing device
|
||||
(set 'header (dup "\000" 24)) ; space for packet header (32 and 64 bit)
|
||||
(set 'protocols '((6 TCP) (17 UDP) (1 ICMP) (0 IP)))
|
||||
|
||||
; constants
|
||||
(constant 'PCAP_BUFFSIZE 1518)
|
||||
(constant 'PROMISCUOUS 1)
|
||||
(constant 'SIZE_ETHER 14)
|
||||
|
||||
; get device
|
||||
(set 'dev (main-args 2))
|
||||
(when (= dev "")
|
||||
(set 'dev (pcap_lookupdev errbuf)))
|
||||
|
||||
(when (zero? dev)
|
||||
(println errbuf)
|
||||
(println "must exit")
|
||||
(exit 1))
|
||||
|
||||
(when (= (pcap_lookupnet dev net mask errbuf) -1)
|
||||
(println (get-string errbuf))
|
||||
(println "must exit")
|
||||
(exit 1))
|
||||
|
||||
; get filter expression
|
||||
(if (main-args 3)
|
||||
(set 'filter-exp (lower-case (main-args 3)))
|
||||
(set 'filter-exp "ip")) ; default is all packets
|
||||
|
||||
; get packet count
|
||||
(set 'packet-count (int (main-args 4) 10)) ; default 10
|
||||
|
||||
; get output options
|
||||
(set 'out-opt (or (main-args 5) "none"))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(set 'handle (pcap_open_live dev PCAP_BUFFSIZE PROMISCUOUS 1000 errbuf))
|
||||
(when (= handle 0)
|
||||
(println (get-string errbuf))
|
||||
(println "must exit")
|
||||
(exit 2))
|
||||
|
||||
(when (= (pcap_compile handle fp filter-exp 0 net) -1)
|
||||
(println "could not compile filter:" filter-exp)
|
||||
(println "must exit")
|
||||
(exit 3))
|
||||
|
||||
(when (= (pcap_setfilter handle fp) -1)
|
||||
(println "could not install filter:" filter-exp)
|
||||
(println "must exit")
|
||||
(exit 4))
|
||||
|
||||
; transform ip number to n.n.n.n
|
||||
(define (ip-to-ascii ip)
|
||||
(join (map string (unpack "bbbb" (pack ">lu" ip))) "."))
|
||||
|
||||
; tansform mac address to n:n::n:n:n:n
|
||||
(define (eth-to-ascii host)
|
||||
(join (map (fn (x) (format "%02x" x)) (unpack "bbbbbb" host) ) ":"))
|
||||
|
||||
; packet handler, called when packet arrives
|
||||
(define (report-packet header packet)
|
||||
|
||||
(if bit-64
|
||||
(map set '(tm usec dummy caplen len) (unpack "Lu lu lu lu lu" header))
|
||||
(map set '(tm usec caplen len) (unpack "lu lu lu lu" header)))
|
||||
(println "time: " (date tm 0 "%H:%M:%S.") usec " captured:" caplen " wire:" len)
|
||||
|
||||
; get pcap header
|
||||
(map set '(dhost shost type) (unpack "s6 s6 d" packet))
|
||||
(println "from ether addr: " (eth-to-ascii shost)
|
||||
" to: " (eth-to-ascii dhost))
|
||||
|
||||
; IP header at p + SIZE_ETHER: sniff_ip
|
||||
(map set '(vhl tos ip-len id off ttl proto sum src dest)
|
||||
(unpack "> b b u u u b b u lu lu" (+ packet SIZE_ETHER)))
|
||||
(set 'IP_HL (& vhl 0x0f))
|
||||
(set 'IP_V (>> vhl 4))
|
||||
|
||||
(when (or (< IP_HL 5) (< ip-len (* IP_HL 4)))
|
||||
(println "ERROR malformed IP datagram")
|
||||
(throw true))
|
||||
|
||||
(set 'protocol (lookup proto protocols))
|
||||
|
||||
(if ; with multiple <condition> <body> terms
|
||||
; TCP header: sniff_tcp
|
||||
(= protocol 'TCP) ; TCP 6
|
||||
(begin
|
||||
(map set '(sport dport seq ack offx2)
|
||||
(unpack "> u u lu lu b" (+ packet SIZE_ETHER (* IP_HL 4))))
|
||||
(set 'TH_OFF (>> (& offx2 0xf0) 4)) ; * 4 -> offset
|
||||
(when (< TH_OFF 5)
|
||||
(println "ERROR malformed TCP segment")
|
||||
(throw true))
|
||||
|
||||
(println protocol " from ip addr: " (ip-to-ascii src) " port:" sport
|
||||
" to: " (ip-to-ascii dest) " port:" dport)
|
||||
)
|
||||
|
||||
(= protocol 'UDP) ; UDP 17
|
||||
(begin
|
||||
(map set '(sport dport ulen sum)
|
||||
(unpack "> u u u u" (+ packet SIZE_ETHER (* IP_HL 4))))
|
||||
(set 'TH_OFF 2) ; 2*4=8 bytes of UDP header length
|
||||
|
||||
(println protocol " from " (ip-to-ascii src) " port:" sport
|
||||
" to " (ip-to-ascii dest) " port:" dport)
|
||||
)
|
||||
|
||||
(= protocol 'ICMP) ; ICMP 1
|
||||
(begin
|
||||
(map set '(type code cksum other)
|
||||
(unpack "> b b u lu" (+ packet SIZE_ETHER (* IP_HL 4))))
|
||||
(set 'TH_OFF 2) ; 2*4=8 bytes of ICMP header length
|
||||
(println protocol
|
||||
" from: " (ip-to-ascii src) " to: " (ip-to-ascii dest))
|
||||
(println "type: " type " code: " code " checksum: " cksum)
|
||||
)
|
||||
|
||||
true ; catch all other
|
||||
(begin
|
||||
(set 'TH_OFF 0)
|
||||
(print "Protocol: " proto
|
||||
" from: " (ip-to-ascii src) " to: " (ip-to-ascii dest)) )
|
||||
) ; end if
|
||||
|
||||
; dump payload
|
||||
;(set 'ip-len (min len (- caplen SIZE_ETHER)))
|
||||
(set 'payload-len (- ip-len (* IP_HL 4) (* TH_OFF 4)))
|
||||
(print "packet total len w/o ether-header:" ip-len)
|
||||
(println ", payload length:" payload-len)
|
||||
|
||||
(when (and (zero? payload-len) (!= out-opt "packet"))
|
||||
(throw true))
|
||||
|
||||
(if (= out-opt "packet")
|
||||
(set 'data (unpack (dup "b" ip-len)
|
||||
(+ packet SIZE_ETHER )))
|
||||
(set 'data (unpack (dup "b" payload-len)
|
||||
(+ packet SIZE_ETHER (* IP_HL 4) (* TH_OFF 4))))
|
||||
)
|
||||
|
||||
; dump data as hex and ascii
|
||||
(when (or (= out-opt "hex") (= out-opt "packet"))
|
||||
(set 'addr 0)
|
||||
(dolist (line (explode data 16) )
|
||||
(print (format "%05d " addr))
|
||||
(println (format "%-48s" (join (map (fn (b) (format "%02x " b)) line))) " "
|
||||
(join (map (fn (c) (if (or (< c 32) (> c 126)) "." (char c))) line)))
|
||||
(inc addr 16))
|
||||
)
|
||||
|
||||
; dump ascii only
|
||||
(when (= out-opt "ascii")
|
||||
(dolist (line (explode data 64) )
|
||||
(println (join (map (fn (c) (if (or (< c 32) (> c 126)) "." (char c))) line)))
|
||||
)
|
||||
)
|
||||
|
||||
true
|
||||
)
|
||||
|
||||
(set 'counter 0)
|
||||
(println "device: " (get-string dev))
|
||||
|
||||
; Method using pcap_next and newLISP controlling
|
||||
; this method leves more time in newLISP to do
|
||||
; stuff in the while loop.
|
||||
(while (< counter packet-count)
|
||||
(set 'capture '())
|
||||
(set 'packet (pcap_next handle header))
|
||||
(unless (= packet 0)
|
||||
(print "\n--- " (inc counter) "--- ")
|
||||
(catch (report-packet header packet ))
|
||||
))
|
||||
|
||||
; Alternative method using callback with pcap_loop
|
||||
; and pcap library controlling. This leaves less
|
||||
; time for newLISP as the waiting for new packets
|
||||
; happens inside libpcap
|
||||
;(define (callback-handler params header packet)
|
||||
; (unless (= packet 0)
|
||||
; (print "\n--- " (inc counter) "--- ")
|
||||
; (catch (report-packet header packet ))
|
||||
;))
|
||||
;(pcap_loop handle 20 (callback 0 'callback-handler) 0)
|
||||
|
||||
|
||||
; report pcap status
|
||||
(set 'pstats (dup "\000" 8))
|
||||
(pcap_stats handle pstats)
|
||||
(map set '(received dropped) (unpack "lu lu" pstats))
|
||||
(println "\npackages dropped: " dropped)
|
||||
|
||||
(exit)
|
||||
|
||||
; eof
|
46
examples/tcltk.lsp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env newlisp
|
||||
;
|
||||
; demo how to write Tcl/Tk GUIs controlled from newLISP
|
||||
;
|
||||
; a Tcl/Tk installation is required
|
||||
; the example has been tested on Mac OS X and Unix
|
||||
;
|
||||
|
||||
; setup communications
|
||||
(map set '(myin tcout) (pipe))
|
||||
(map set '(tcin myout) (pipe))
|
||||
(println "wait ...")
|
||||
(process "/usr/bin/wish" tcin tcout)
|
||||
|
||||
; make GUI
|
||||
(write-buffer myout
|
||||
[text]
|
||||
wm geometry . 250x90
|
||||
wm title . "Tcl/Tk and newLISP"
|
||||
|
||||
button .one -text {red}
|
||||
button .two -text {green}
|
||||
button .three -text {blue}
|
||||
label .colorlabel -width 25
|
||||
|
||||
grid .one .two .three -padx 8 -row 0
|
||||
grid .colorlabel -column 0 -columnspan 3 -pady 6
|
||||
|
||||
.one config -command {puts {(call-back "red")}}
|
||||
.two config -command {puts {(call-back "green")}}
|
||||
.three config -command {puts {(call-back "blue")}}
|
||||
|
||||
bind . <Destroy> {puts {(exit)}}
|
||||
[/text])
|
||||
|
||||
(define (call-back color)
|
||||
(write-line myout (append ".colorlabel config -background " color))
|
||||
)
|
||||
|
||||
|
||||
; run event loop
|
||||
(while (read-line myin)
|
||||
(eval-string (current-line))
|
||||
)
|
||||
|
||||
;; eof
|
23
examples/udp-client.lsp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
; Demo client for non-blocking UDP communications
|
||||
;
|
||||
; Start the server program udp-server.lsp first.
|
||||
;
|
||||
; Note, that net-listen in UDP mode only binds the socket
|
||||
; to the local address, it does not 'listen' as in TCP/IP.
|
||||
; v.1.0
|
||||
; v.1.1 change net-receive for 10.0
|
||||
|
||||
(set 'socket (net-listen 10002 "" "udp"))
|
||||
(if (not socket) (println (net-error)))
|
||||
(while (not (net-error))
|
||||
(print "enter something -> ")
|
||||
(net-send-to "127.0.0.1" 10001 (read-line) socket)
|
||||
(net-receive socket buff 255)
|
||||
(println "=> " buff))
|
||||
|
||||
(exit)
|
||||
|
||||
; eof
|
||||
|
27
examples/udp-server.lsp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
; demo server for non-blocking UDP communications
|
||||
;
|
||||
; Start this program then start the client udp-client.lsp
|
||||
;
|
||||
; Note, that net-listen in UDP mode only binds the socket
|
||||
; to the local address, it does not 'listen' as in TCP/IP.
|
||||
;
|
||||
; On Windows the received string for the remote host also contains
|
||||
; the port separated by a colon and must parsed out. On UNIX this
|
||||
; is not necessary.
|
||||
; v.1.0
|
||||
; v.1.1 made it work for Windows parseing out the host label
|
||||
|
||||
|
||||
(set 'socket (net-listen 10001 "localhost" "udp"))
|
||||
(if socket (println "server listening on port " 10001)
|
||||
(println (net-error)))
|
||||
(while (not (net-error))
|
||||
(set 'msg (net-receive-from socket 255))
|
||||
(println "->" msg)
|
||||
(net-send-to
|
||||
(first (parse (nth 1 msg) ":")) (nth 2 msg) (upper-case (first msg)) socket))
|
||||
(exit)
|
||||
;; eof
|
||||
|
66
examples/upload.cgi
Executable file
|
@ -0,0 +1,66 @@
|
|||
#!/usr/bin/env newlisp
|
||||
#
|
||||
# upload.cgi - process uploads from POST multipart/form-data
|
||||
#
|
||||
# version 1.7
|
||||
#
|
||||
# works on Apache server 1.2 and after and newLISP server 10.3.0 and after
|
||||
# works on newLISP CGI with 10.1 and after
|
||||
|
||||
; make compatible with older versions of newLISP
|
||||
(when (< (sys-info -2) 10110)
|
||||
(constant (global 'write) write-buffer))
|
||||
|
||||
(define (process-upload,
|
||||
; locals
|
||||
len type infile outfile boundary
|
||||
disposition filename start end size
|
||||
bytesread buffer)
|
||||
|
||||
(print "Content-Type: text/html\n\n")
|
||||
|
||||
; check for valid request header
|
||||
(set 'len (int (env "CONTENT_LENGTH") 0))
|
||||
(set 'type (env "CONTENT_TYPE"))
|
||||
(if (not (find ".*multipart/form-data;.*boundary=.*" type 1))
|
||||
(throw-error "wrong upload format, multipart/form-data content-type not found"))
|
||||
|
||||
; read data into intermediate file
|
||||
(set 'infile (open "upload-file" "write"))
|
||||
(while (read-buffer (device) buffer 1024)
|
||||
(write infile buffer))
|
||||
(close infile)
|
||||
; get filename and boundaries
|
||||
(set 'infile (open "upload-file" "read"))
|
||||
(set 'boundary (read-line infile)) ; get boundary string
|
||||
(set 'disposition (read-line infile))
|
||||
|
||||
(if (not (find ".*filename=\"(.*)\".*" disposition 1))
|
||||
(throw-error "wrong upload format, did not find filename"))
|
||||
(if (= "" (set 'filename $1))
|
||||
(throw-error "need file name")
|
||||
(set 'filename (last (parse filename "/|\\\\" 0))))
|
||||
|
||||
; read from intermedeate file into permanent file
|
||||
(while (!= "" (read-line infile)))
|
||||
(set 'start (seek infile))
|
||||
(set 'end (search infile boundary))
|
||||
(if (not end)
|
||||
(throw-error "wrong upload format, did not find boundary string")
|
||||
(set 'size (- end start 2)))
|
||||
|
||||
(set 'outfile (open filename "write"))
|
||||
(seek infile start)
|
||||
(while (> size 0)
|
||||
(set 'bytesread (read-buffer infile buffer (min 1024 size)))
|
||||
(write outfile buffer bytesread)
|
||||
(dec size bytesread))
|
||||
(close infile)
|
||||
(close outfile)
|
||||
(delete-file "upload-file"))
|
||||
|
||||
(if (not (catch (process-upload) 'result))
|
||||
(print "<h2>" (first (parse result "\\r\\n|\\n" 0)) "</h2>")
|
||||
(print {<h2>file uploaded, click <a href="upload.html">continue</a></h2>}))
|
||||
|
||||
(exit)
|
14
examples/upload.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<html>
|
||||
<head><TITLE>File Upload</TITLE></head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Upload File</font></h2>
|
||||
<form name="FileUpload" action="upload.cgi"
|
||||
method="POST" enctype="multipart/form-data">
|
||||
<input type="file" name="uploaded_data" size="40">
|
||||
<input type="submit" value="Upload" name="submit">
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
83
examples/win32demo.lsp
Normal file
|
@ -0,0 +1,83 @@
|
|||
;; @module win32demo.lsp
|
||||
;; @description Event loop demo
|
||||
;; @author Cyril Slobin
|
||||
;; @location http://slobin.pp.ru/newlisp/win32demo.lsp
|
||||
;; @version $Id: win32demo.lsp,v 1.4 2010/06/10 02:14:08 slobin Exp $
|
||||
|
||||
; see also: http://slobin.livejournal.com/339071.html ; added by LM
|
||||
|
||||
(println "win32demo")
|
||||
|
||||
(define (import-list library flist)
|
||||
(dolist (fname flist) (import library (string fname))))
|
||||
|
||||
(define-macro (@setq %var %value)
|
||||
(set %var (eval %value))
|
||||
(println %var " " (eval %var)))
|
||||
|
||||
(import-list "kernel32" '(GetModuleHandleA GetConsoleWindow))
|
||||
(import-list "user32" '(PostQuitMessage DefWindowProcA))
|
||||
(import-list "user32" '(LoadCursorA RegisterClassA CreateWindowExA))
|
||||
(import-list "user32" '(ShowWindow UpdateWindow))
|
||||
(import-list "user32" '(GetMessageA TranslateMessage DispatchMessageA))
|
||||
|
||||
(setq WM_CREATE 1 WM_DESTROY 2 WM_CHAR 0x102 WM_LBUTTONDOWN 0x201)
|
||||
(setq IDC_ARROW 0x7F00 CS_VREDRAW 1 CS_HREDRAW 2 COLOR_WINDOW 5)
|
||||
(setq WS_OVERLAPPEDWINDOW 0xCF0000 HWND_MESSAGE -3 SW_SHOWDEFAULT 10)
|
||||
|
||||
(@setq hinstance (GetModuleHandleA 0))
|
||||
(@setq hconsole (GetConsoleWindow))
|
||||
(@setq cursor (LoadCursorA 0 IDC_ARROW))
|
||||
|
||||
(define (window-callback-function hwnd message wparam lparam)
|
||||
(cond
|
||||
((= message WM_CREATE) (println "created") 0)
|
||||
((= message WM_LBUTTONDOWN) (println "click!") 0)
|
||||
((= message WM_CHAR) (println (format "char %c" wparam)) 0)
|
||||
((= message WM_DESTROY) (println "destroyed") (PostQuitMessage 0) 0)
|
||||
(true (DefWindowProcA hwnd message wparam lparam))))
|
||||
|
||||
(setq wndproc (callback 0 'window-callback-function))
|
||||
(setq classname "newlisp class")
|
||||
|
||||
(setq wc (pack (dup "ld" 10)
|
||||
(| CS_HREDRAW CS_VREDRAW) ; style
|
||||
wndproc ; lpfnWndProc
|
||||
0 ; cbClsExtra
|
||||
0 ; cbWndExtra
|
||||
hinstance ; hInstance
|
||||
0 ; hIcon
|
||||
cursor ; hCursor
|
||||
(+ COLOR_WINDOW 1) ; hbrBackground
|
||||
0 ; lpszMenuName
|
||||
classname ; lpszClassName
|
||||
))
|
||||
|
||||
(@setq hwc (RegisterClassA wc))
|
||||
(@setq hwnd (CreateWindowExA
|
||||
0 ; dwExStyle
|
||||
"newlisp class" ; lpClassName
|
||||
"newlisp window" ; lpWindowName
|
||||
WS_OVERLAPPEDWINDOW ; dwStyle
|
||||
80 60 640 480 ; x y w h
|
||||
0 ; hwndParent
|
||||
0 ; hMenu
|
||||
hinstance ; hInstance
|
||||
0 ; hParam
|
||||
))
|
||||
|
||||
; hconsole and HWND_MESSAGE are other useful values for hwndParent
|
||||
|
||||
(ShowWindow hwnd SW_SHOWDEFAULT)
|
||||
(UpdateWindow hwnd)
|
||||
|
||||
(setq msg (pack "n28"))
|
||||
|
||||
(until (member (GetMessageA msg hwnd 0 0) '(0 -1))
|
||||
(TranslateMessage msg)
|
||||
(DispatchMessageA msg))
|
||||
|
||||
(println "the end")
|
||||
|
||||
(exit)
|
||||
|
227
examples/xmlrpc.cgi
Executable file
|
@ -0,0 +1,227 @@
|
|||
#!/usr/bin/env newlisp
|
||||
#
|
||||
# xmlrpc.cgi - CGI script to handle XML-RPC requests
|
||||
#
|
||||
# This is similar to xmlrpc-server, but stateless as a new
|
||||
# newLISP process is invoked everytime this script is executed.
|
||||
# For a XML-RPC server maintaining state run xmlrpc-server.
|
||||
#
|
||||
# v.1.0 - 2005-01-14 Lutz Mueller
|
||||
#
|
||||
# v.1.1 - 2005-03-20
|
||||
# method name for newLISP.evalString was listed wrong
|
||||
# v.1.2 - 2010-02-09
|
||||
# method name for newLISP.evalString was listed wrong
|
||||
# v.1.3 - 2010-10-07
|
||||
# replaced obsolete 'error-text' with 'last-error'
|
||||
# v.1.4 - 2012-03-16 bugfixes, thanks Kosh
|
||||
#
|
||||
# supports the following methods:
|
||||
#
|
||||
# Method Return Parameter
|
||||
# ------ ------ ---------
|
||||
# system.listMethods string n/a
|
||||
# system.methodHelp string string
|
||||
# system.methodSignature array string
|
||||
# newLISP.evalString base64 base64
|
||||
#
|
||||
#
|
||||
|
||||
(set 'version "1.4")
|
||||
|
||||
# formatting templates for responses
|
||||
|
||||
(set 'normal-response
|
||||
[text]<?xml version="1.0"?>
|
||||
<methodResponse>
|
||||
<params>
|
||||
<param>
|
||||
<value>%s</value>
|
||||
</param>
|
||||
</params>
|
||||
</methodResponse>
|
||||
[/text])
|
||||
|
||||
(set 'fault-response
|
||||
[text]<?xml version="1.0"?>
|
||||
<methodResponse>
|
||||
<fault>
|
||||
<value>
|
||||
<struct>
|
||||
<member>
|
||||
<name>faultCode</name>
|
||||
<value><int>%d</int></value>
|
||||
</member>
|
||||
<member>
|
||||
<name>faultString</name>
|
||||
<value><string>%s</string></value>
|
||||
</member>
|
||||
</struct>
|
||||
</value>
|
||||
</fault>
|
||||
</methodResponse>
|
||||
[/text])
|
||||
|
||||
|
||||
# event handler called when newLISP receives a request
|
||||
|
||||
(define (process-post request)
|
||||
(if (not (catch (handle request) 'page))
|
||||
(set 'page (format fault-response 0 page)))
|
||||
(print
|
||||
"Content-Type: text/xml\r\n"
|
||||
"Content-Length: " (length page) "\r\n\r\n"
|
||||
page))
|
||||
|
||||
|
||||
(define (handle input, XML contentlength methodName params)
|
||||
(set 'XML "")
|
||||
(xml-type-tags nil nil nil nil)
|
||||
(if (not (set 'XML (xml-parse input (+ 1 2 4 8 16))))
|
||||
(begin
|
||||
(if (not (xml-error))
|
||||
(error 3 "No XML or XML is empty")
|
||||
(error 4 (append "XML error: "
|
||||
(first (xml-error))))))
|
||||
|
||||
(set 'XML (first XML)))
|
||||
|
||||
; get methodName and parameter section
|
||||
(set 'm (match '(methodCall (methodName *) *) XML))
|
||||
(if (not m)
|
||||
(error 5 "Invalid XML-RPC format"))
|
||||
|
||||
(set 'methodName (first (first m)))
|
||||
(set 'params (last m))
|
||||
|
||||
(case methodName
|
||||
("newLISP.evalString" (newLISP.evalString params))
|
||||
("system.listMethods" (system.listMethods))
|
||||
("system.methodHelp" (system.methodHelp params))
|
||||
("system.methodSignature" (system.methodSignature params))
|
||||
(true (error 6 "Method name not known")))
|
||||
)
|
||||
|
||||
(define (error no msg)
|
||||
(throw (format fault-response no
|
||||
(append "newLISP XML-RPC v." version " - " msg))))
|
||||
|
||||
|
||||
######################### remote callable methods ##############################
|
||||
|
||||
(define (system.listMethods)
|
||||
[text]<?xml version="1.0"?>
|
||||
<methodResponse>
|
||||
<params>
|
||||
<param><value><array><data>
|
||||
<value><string>system.listMethods</string></value>
|
||||
<value><string>system.methodHelp</string></value>
|
||||
<value><string>system.methodSignature</string></value>
|
||||
<value><string>newLISP.evalString</string></value>
|
||||
</data></array></value></param>
|
||||
</params>
|
||||
</methodResponse>
|
||||
[/text])
|
||||
|
||||
|
||||
(define (system.methodHelp params, methodName)
|
||||
(set 'methodName (params 0 1 1 1 1))
|
||||
(case methodName
|
||||
("system.listMethods" (format normal-response "Lists all methods implemented."))
|
||||
("system.methodHelp" (format normal-response "Documents a method."))
|
||||
("system.methodSignature" (format normal-response "Shows the signatures of a method."))
|
||||
("newLISP.evalString" (format normal-response "Evaluate a base64 encoded string."))
|
||||
(true (error 7 "Method name in system.methodHelp not known")))
|
||||
)
|
||||
|
||||
(define (system.methodSignature params)
|
||||
(set 'methodName (params 0 1 1 1 1))
|
||||
(case methodName
|
||||
("system.listMethods" (format normal-response
|
||||
"<array>
|
||||
<data>
|
||||
<value>
|
||||
<array>
|
||||
<data>
|
||||
<value>array</value>
|
||||
</data>
|
||||
</array>
|
||||
</value>
|
||||
</data>
|
||||
</array>"))
|
||||
|
||||
("system.methodHelp" (format normal-response
|
||||
"<array>
|
||||
<data>
|
||||
<value>
|
||||
<array>
|
||||
<data>
|
||||
<value>string</value>
|
||||
<value>string</value>
|
||||
</data>
|
||||
</array>
|
||||
</value>
|
||||
</data>
|
||||
</array>"))
|
||||
|
||||
("system.methodSignature" (format normal-response
|
||||
"<array>
|
||||
<data>
|
||||
<value>
|
||||
<array>
|
||||
<data>
|
||||
<value>array</value>
|
||||
<value>string</value>
|
||||
</data>
|
||||
</array>
|
||||
</value>
|
||||
</data>
|
||||
</array>"))
|
||||
|
||||
("newLISP.evalString" (format normal-response
|
||||
"<array>
|
||||
<data>
|
||||
<value>
|
||||
<array>
|
||||
<data>
|
||||
<value>base64</value>
|
||||
<value>base64</value>
|
||||
</data>
|
||||
</array>
|
||||
</value>
|
||||
</data>
|
||||
</array>"))
|
||||
|
||||
(true (error 7 "Method name in system.methodSignature not known")))
|
||||
)
|
||||
|
||||
(define (newLISP.evalString params, m, result)
|
||||
(set 'm (match '((params (param (value (base64 *))))) params))
|
||||
(if (not m)
|
||||
(error 8 "Invalid format for method newLISP.evalString")
|
||||
(set 'result
|
||||
(string (eval-string (base64-dec (first (first m))) MAIN (last (last-error)))))
|
||||
(format normal-response
|
||||
(append "<base64>" (base64-enc result) "</base64>")) )
|
||||
)
|
||||
|
||||
|
||||
########################### MAIN ENTRY POINT #######################
|
||||
|
||||
(set 'input (read-line))
|
||||
|
||||
(if (not input)
|
||||
(print
|
||||
"Content-type: text/html\r\n\r\n"
|
||||
"<h2>newLISP XML-RPC v." version
|
||||
": not a valid XML-RPC request</h2>")
|
||||
(begin
|
||||
(while (read-line) (write input (current-line)))
|
||||
(process-post input))
|
||||
)
|
||||
|
||||
|
||||
(exit)
|
||||
|
||||
|
||||
# eof
|
985
guiserver/CHANGES
Normal file
|
@ -0,0 +1,985 @@
|
|||
0.2
|
||||
documentation corrections regarding default layout of frame and dialog
|
||||
|
||||
switchable look-and-feel with (gs:set-look-and-feel <str-spec>)
|
||||
now on Windows the Windows look and feel is chosen correctly by default
|
||||
|
||||
speedup of interpreter
|
||||
|
||||
0.3
|
||||
suppressed nullpointer error when using gs:set-look-and-feel
|
||||
|
||||
supppress Java error messages on Windows when shuttng down program
|
||||
|
||||
gs:label now can take optional width height has last parameters
|
||||
before ann extra gs:set-size statement was necessary
|
||||
|
||||
width and height specified in gs:button did not work, does now
|
||||
(note that for all other buttons/check-box an extra gs:set-size
|
||||
must still be used to change the size, it will not be added as
|
||||
optional parameters, as it is almost never used)
|
||||
|
||||
now image-button can take pressed icon path after the normal path
|
||||
(gs:image-button 'TheButton "/local/run32.png" "/local/run32p.png")
|
||||
|
||||
now gs:set-color working on frames and dialogs too
|
||||
|
||||
font-demo.lsp showing the fonts built-in on all platforms
|
||||
|
||||
new gs:text-pane for HTML and RTF (future version) formatted text
|
||||
see html-demo.lsp for a demo.
|
||||
|
||||
0.4
|
||||
allow multiple re-starts from same newlisp process, this works together
|
||||
with (gs:listen true)
|
||||
|
||||
parenthesis matching in text-pane and tab-size working on text-pane,
|
||||
will only work on "text/plain" flavore of text-pane
|
||||
|
||||
console.lsp now remembers last directory in file dialogs save/load
|
||||
|
||||
console.lsp now has list boxes for browsing contexts and variables
|
||||
|
||||
changed split-pane syntax adding divider size, leaving out width/height
|
||||
which can be set with extra set-size if required
|
||||
|
||||
combo-box and list-box life update now works and updates the screen
|
||||
correctly
|
||||
|
||||
new gs:clear-list empties out a combo-box or list-box
|
||||
eliminated redundant 'action' parameter on message-dialog
|
||||
|
||||
new confirm-dialog similar to message-dialog but 'yes', 'no' and optional
|
||||
'cancel' button and fires an event.
|
||||
|
||||
0.5
|
||||
gs:set-size now works on frames
|
||||
|
||||
new gs:remove-from removes one or more components from a container
|
||||
|
||||
new gs:select-text, gs:cut-text, gs:copy-text and gs:paste-text
|
||||
with suport for system clipboard, new gs:insert-text
|
||||
|
||||
gs:set-background/set-color now can take a list for the r g b
|
||||
color components
|
||||
|
||||
list-box now also fires event on key-entering a selection, previously only
|
||||
on mouse-double-click
|
||||
|
||||
avoid Java "index out of bound messages" in parenthesis matching
|
||||
|
||||
restructured text-area and text-pane event:
|
||||
(define (action-handler id code dot mark) ...)
|
||||
|
||||
id = name of text widget
|
||||
code = code of character
|
||||
dot = caret position
|
||||
mark = selection position
|
||||
|
||||
if there is no selection then dot and mark are equal
|
||||
if only the caret was moved then code is 65535 (16bit -1)
|
||||
|
||||
working logic for highlighting of cut/copy save/saveAs buttons and
|
||||
related menu items in console.lsp
|
||||
|
||||
working logic of maintaining directories and filenames in commonly
|
||||
established fashion between file operations
|
||||
|
||||
NOTE, console.lsp has been little tested, do not use in production,
|
||||
no confirmation dialogs yet for overwiting files, save before new, etc.
|
||||
|
||||
NOTE that console.lsp is broken on Windwos because iof filepath issues
|
||||
and CR-LF issues in parenhesis matching
|
||||
|
||||
many documentain fixes
|
||||
|
||||
0.6
|
||||
gs:set-font working on combo-box and list-box
|
||||
|
||||
parenthesis matching in text-pane working now on Windows too
|
||||
|
||||
file operations working in console.lsp on Windows
|
||||
|
||||
confirm dialog for new button in console when edit buffer is touched
|
||||
|
||||
eliminated crashes with bigger results in output area of console
|
||||
|
||||
context stays selected in console
|
||||
|
||||
console new button action will not reset current directory for file operations
|
||||
|
||||
request-focus now works on text-area and text-pane
|
||||
|
||||
eliminate Java error messages on listboxes
|
||||
|
||||
new gs:select-list-item selects a list box or combo box item
|
||||
|
||||
documentation changes for border-layout and others
|
||||
fixed many documantatin formatting problems
|
||||
|
||||
0.7
|
||||
because of a change in gs:listen in v. 0.6 all error messages from
|
||||
guiserver where suppresses, which made debugging difficult. Some applications
|
||||
running in guiserver v.0.6 may fail now because error messages are enabled
|
||||
again. E.g. misspelled or missing action handlers would cause no harm
|
||||
in v.0.6, but will let exit an application with an error message in v.0.7.
|
||||
|
||||
gs:window creates a wimndow without any border and system bar. On MacOX X
|
||||
when setting the background in such a window to
|
||||
(gs:set-background 'thewindow 0 0 0 0)
|
||||
totally transparent, the window will be invisible and widgets ppaced on it
|
||||
seem to float on the desktop (e.g. text from labels)
|
||||
|
||||
the second to- parameter in gs:select-text is now optional and the function
|
||||
will select all text from the from- position to the end of the text.
|
||||
|
||||
0.8
|
||||
text-panes and text-areas did not scroll after ading to tab, fixed
|
||||
added action event to gs:tabbed-pane
|
||||
(gs:tabbed-pane <sym-id> <sym-action> <str-orientation>
|
||||
[<sym-widget> <sym-tab-title> ...])
|
||||
the event reports: tabbed-pane-id tab-id tab-title.
|
||||
|
||||
console.lsp project renamed to newlisp-console.lsp instead, which is a
|
||||
multi tab lisp editor with run button and console window
|
||||
|
||||
in scrollable text-pane and text-area after gs:set-text will scroll
|
||||
to the beginning, after gs:append-text will scroll to end
|
||||
|
||||
can use gs:set-text in the tabs of a gs:tabbed-pane
|
||||
|
||||
can use gs:set-icon in the tabs of a gs:tabbed-pane
|
||||
|
||||
more demos: frameless-demo.lsp and clipboard-demo.lsp
|
||||
|
||||
0.9
|
||||
Several functions to retrieve system properties:
|
||||
gs:get-version - gets the GUI server version number
|
||||
gs:get-screen - gets width, height and resolution of the screen
|
||||
gs:get-fonts - gets all fonts on the current system
|
||||
|
||||
The following system variables can be used after a property function has
|
||||
been call once:
|
||||
gs:version - the version number
|
||||
gs:screen - list of screen parameters
|
||||
gs:fonts - list of all fonts
|
||||
Once a function has been callled onlyt the variables should be used
|
||||
for efficiency
|
||||
|
||||
two new demos: properties-demo.lsp, allfonts-demo.lsp
|
||||
|
||||
increased possible text size for events from 100K to 1000M
|
||||
(mainly for editor)
|
||||
|
||||
for do-nothing buttons or or other widgets specify 'gs:no-action as
|
||||
action-handler
|
||||
|
||||
0.93 First 2D canvas and mouse stuff
|
||||
gs:set-select now working for toggle-button, radio-butoon, check-box
|
||||
|
||||
gs:mouse-clicked, gs:mouse-dragged, gs:mouse-moved, gs:mouse-pressed
|
||||
and gs:mouse-released
|
||||
|
||||
new demos mouse-demo.lsp shapes-demo.lsp animation-demo.lsp
|
||||
|
||||
gs:draw-line, gs:draw-rect, gs:draw-circle
|
||||
gs:fill-rect, gs:fill-circle (raound-rect and ellipse in next version)
|
||||
|
||||
gs:paint (gs:stroke for line width in next version)
|
||||
|
||||
gs:delete-tag to delete a tagged group of shapes
|
||||
gs:moce-tag to move a tagged group of shapes
|
||||
|
||||
0.94
|
||||
fixed message box in newlisp-edit.lsp when no c:\temp on Windows
|
||||
|
||||
gs:paint renamed to gs:set-paint
|
||||
|
||||
last gs:set-paint now gets correctly taken when now color is specified in
|
||||
shapes or text
|
||||
|
||||
now different fonts on same canvas don't overwrite previous
|
||||
|
||||
documentation for draw-text had syntax in reverse
|
||||
all graphics functions now sorted into all other Functions
|
||||
spellchecked documentation
|
||||
|
||||
lines are now movable too
|
||||
|
||||
gs:set-canvas - onlye used for switching between muliple canvases
|
||||
gs:set-translation - move coordinate origin
|
||||
gs:set-scale - scales up or down
|
||||
gs:set-stroke - sets drawing line width and optional cap, join and miter limit
|
||||
gs:draw-arc - draw an arc outline
|
||||
gs:fill-arc - paints a filled arc
|
||||
|
||||
new stroke-demo.lsp - shows lines and outlimes with different strokes and round
|
||||
line ends
|
||||
|
||||
GUI-server signon message now contains version number. Note that in the future
|
||||
newLISP binary installers for Mac OS X and Win32 icons will be placed in the
|
||||
Mac OX X application folder and Win32 desktop for the newlisp-edit.lsp application.
|
||||
Then the signon and connection messages will be unvisible. They are more thought
|
||||
as a debugging aid duwing development.
|
||||
|
||||
On Mac OS X and UNIX applications can be started this way to close the terminal/shell
|
||||
window:
|
||||
newlisp newlisp-edit.lsp & exit
|
||||
this places the GUI-server process into the background and closes the termonal/shell
|
||||
|
||||
0.95
|
||||
fixed newlisp-edit.lsp temporal directory detection (again, thanks Sleeper)
|
||||
|
||||
gs:move-tag did not distinguish between tags, fixed
|
||||
|
||||
gs:set-select can take multiple id, flag pairs, fixed
|
||||
|
||||
gs:split-pane divider width in split-pane did not work, fixed
|
||||
|
||||
new gs:draw-ellipse - draws an elllipse outline
|
||||
new gs:fill-ellipse - fills an elllipse
|
||||
|
||||
new gs:set-translation of the canvas origin coordinates
|
||||
new gs:set-rotation set the rotation of the canvas
|
||||
|
||||
all tag transforms below add to the affine transform matrix
|
||||
already in the canvas
|
||||
|
||||
new gs:hide-tag - hides objects of a tag group
|
||||
new gs:scale-tag - scales an object up or down
|
||||
new gs:translate-tag - translates the coordinate origin of a tag group
|
||||
new gs:show-tag - shows objects of a tag group
|
||||
new gs:rotate-tag - function for rotating objects
|
||||
new gs:shear-tag - function for shearing objects
|
||||
|
||||
like gs:move-tag all other functions work on any shape, text
|
||||
or image.
|
||||
|
||||
shaped-demo.lsp modified to show funtioning of gs:hide-tag and gs:show-tag
|
||||
via selecting or de-selecting shapes with check boxes
|
||||
|
||||
gs:mouse-wheel - register mouse wheel events
|
||||
|
||||
mouse-demo.lsp - modified to show mouse wheel events
|
||||
|
||||
animaton-demo.lsp - modified to show the mouse wheel move text up/down
|
||||
|
||||
new rotation-demo.lsp to show rotating objects
|
||||
new image-demo - shows image zzomin, turning and squashing
|
||||
new textrot-demo - shows text rotation
|
||||
|
||||
gs:draw-text has optional angle parameter (but can also be titled
|
||||
using gs:rotate-tag, see sample program text-rotation.lsp)
|
||||
|
||||
all tag operations have optional flag to turn of screen update
|
||||
this is recommended when using several tag commands in a batch
|
||||
to do only one screen update at the end using gs:update
|
||||
the default for this flag is 'true' for doing the update.
|
||||
|
||||
On all other systems except Mac OS X, double buffering is tried for
|
||||
flicker free performance when animating graphics on systems other than
|
||||
the Mac. The performance of this depends on the graphics cards used.
|
||||
Performance was execellent on 2 Windows system I tried, one of them
|
||||
4 years old.
|
||||
|
||||
0.96
|
||||
gs:scale-tag, gs:translate-tag and gs:rotate-tag add to the affine transform matrix
|
||||
already in the canvas (it was wrongly stated before that gs:translate-tag
|
||||
if not accumulative, but it is like all others)
|
||||
|
||||
Corrections in the doc about the behaviour of gs:set-translation, gs:set-scale
|
||||
and gs:set-rotation. Again: they are all absolute, while tag operations are
|
||||
accumulative.
|
||||
|
||||
rotation-demo.lsp and image-demo.lsp have been changed using gs:translate-tag
|
||||
instead the global canvas gs:set-translation. This makes it possible to
|
||||
rotate or scale several tags at the same time, using gs:translate-tag
|
||||
to supply each tag group its own center (set to 0,0). This leads also
|
||||
to better readable code. All object cooridnates to rotate or zoom are
|
||||
best defined in reference to a 0,0 center point and then moved to their
|
||||
pace with gs:translate-tag. See also description of gs:scale-tag in documentation.
|
||||
|
||||
net gs:get-font-metrics - returns width and height of a string to display
|
||||
new gs:draw-round-rect - draw a rectangle with round corners
|
||||
new gs:full-round-rect - fill a rectangle with round corners
|
||||
new gs:draw-polygon - draws a polygon with 3 to N points
|
||||
new gs:fill-polygon - fill a polygon with 3 to N points
|
||||
new gs:set-cursor - set one of 14 cursor shapes
|
||||
|
||||
new cursor-demo.lsp tot show different cursor shapes
|
||||
|
||||
0.97
|
||||
gs:mouse-dragged fired invalid events when not defined but gs:mouse-clicked
|
||||
was defined.
|
||||
|
||||
gs:mouse-pressed, gs:mouse-released and gs:mouse-clicked now take an optional
|
||||
'true' parameter. This makes events carry a list of tags, which have been
|
||||
affected by one of the above mouse actions. This can be used to implement
|
||||
object dragging (see the new drag-demo.lsp) it also opens the possibility
|
||||
of creating self-drawn custom controls on a canvas because clicks can be
|
||||
detected on tags. The code mouse-demo.lsp has been simplified to detect
|
||||
tags to delete by using the tag list in the mouse-clicked event.
|
||||
|
||||
events generated by gs:mouse-pressed, gs:mouse-released, gs:mouse-clicked
|
||||
and gs:mouse-dragged besides the new tags spec also carry a number for
|
||||
modifier keys, e.g. pressing ctrl or shift while clicking the mouse.
|
||||
See the modified moused-demo.lsp.
|
||||
|
||||
gs:text-pane and gs:text-area now can register gs:mous-clicked events
|
||||
in the newlisp-edit.lsp app a popup has been implemented as a right click
|
||||
(or ctrl-click for one-button mouse) to popup an edit menu.
|
||||
|
||||
new drag-demo.lsp
|
||||
|
||||
Point detection is implemented for closed shapes, images and text. Precise
|
||||
deletection is done for images, text, polygons and rectangles, but for
|
||||
circles and ellipses the whole rectangle enclosing the shape is used
|
||||
for calculations. A precise point detection limited only to the inside
|
||||
of the circle or ellipse will be implemented at a later time.
|
||||
|
||||
Images must carry width and height parameters in the gs:draw-image statement.
|
||||
Drawn text is detected by calculating the enclosing rectangle.
|
||||
|
||||
new gs:draw-path - similar to polygon but the path may stay unclosed.
|
||||
new gs:export - exports to an image file in png in RGB + alpha channel
|
||||
format.
|
||||
|
||||
Note that detection will fail if scaling or translation has been used to
|
||||
for the canvas or drawn objects involved, because mouse coordinates do
|
||||
not sync to object coordinates in a scaled or translated coordinate
|
||||
system.
|
||||
|
||||
new gs:menu-pop and gs:show-popup implements popup menus for gs:text-area,
|
||||
gs:text-pane and gs:canvas. For a demo see newlisp-edit.lsp and
|
||||
drag-demo.lsp
|
||||
|
||||
bug fixes in newlisp-edit.lsp when closing other but the last tab.
|
||||
|
||||
0.98
|
||||
popup menus on canvas now also working on Win32
|
||||
|
||||
gs:open-file had problems with file masks (changed parameter format)
|
||||
|
||||
new gs:frame-closed - registers an event for a closing frame or dialog
|
||||
|
||||
new gs:find-text - finds and selects text in a text rea or text panel widget
|
||||
|
||||
new gs:mouse-event - registers a general mouse-event for any component
|
||||
see allfonts-demo.lsp, button-demo.lsp and the Fontbook button in
|
||||
newlisp-edit.lsp for demo
|
||||
|
||||
changed some shortcut keys in newlisp-edit.lsp to be more standard conform
|
||||
|
||||
newlisp-edit.lsp has now text search and replace implemented
|
||||
|
||||
newlisp-edit.lsp now has fontselection implemented
|
||||
|
||||
splash screen working, see doc for new gs:dispose-splash
|
||||
|
||||
0.99
|
||||
gs:find-text selection now positions and highlights correctly on Win32
|
||||
|
||||
now showing directories on Win32 even when file view is constrained to text files:
|
||||
.lsp .c .h .txt .java .htm .html .css .php .pl .py .rb .lisp .el .cl .cpp
|
||||
what are other essential text formats on Win32?
|
||||
|
||||
graceful error recovery on most errors in GUI-server: after the error
|
||||
message box is closed, the app will try continue and not exit as before.
|
||||
|
||||
better parenthesis matching performance on larger files
|
||||
(but minor flicker on Win32)
|
||||
|
||||
gs:get-font-metrics got stuck on last queried value
|
||||
|
||||
gs:set-tab-size when used on gs:text-pane, sets the tabsize in points
|
||||
|
||||
added ctrl-M to clear monitor area in newlisp-edit.lsp
|
||||
|
||||
find previous, undo and redo in newlisp-edit.lsp
|
||||
|
||||
new gs:undo-text and gs:redo-text, if no menus or code is used
|
||||
ctrl-z and ctrl-shift-z and meta-z meta-shift-z (MacOS X) are
|
||||
still hardwired into gs:text-pane
|
||||
|
||||
text widgets now also respond to the general gs:mouse-event
|
||||
|
||||
0.991
|
||||
Text selection was still broken on Win32 when starting out with a file containing
|
||||
carriage returns or when entering new text. It only worked on files loded without
|
||||
CRs even when etering new text. Now it seems to work in all situations, setting
|
||||
a Java system property to LF only and converting text when it goes in/out.
|
||||
|
||||
Changed run button to auxiliary stateful newLISP process as used
|
||||
previously in console.lsp. Now evaluation via the newLISP run button
|
||||
is stateful unless the restart button is hit to restart the
|
||||
other newLISP process. If the process exits, e.g. when closing a GUI-server
|
||||
applications the small LED turns red. When hitting the run-newLISP button
|
||||
and the newLISP process is down, it will get restarted automatically.
|
||||
|
||||
Only one GUI applocation should be started at the time from newlisp-edit.lsp
|
||||
starting more than one is unreliable and blocked on MacOX X.
|
||||
|
||||
There are som unreliabilities running GUI-Server apps from newlisp-edit.lsp
|
||||
on Win32, which have not been worked out. Text in the edit area should be saved
|
||||
before running a GUI-server app, to be safe.
|
||||
|
||||
|
||||
0.992
|
||||
File dialog file mask selection was broken again
|
||||
|
||||
0.993
|
||||
|
||||
Eliminated flicker when matching parenthesis in bigger files.
|
||||
|
||||
A canvas now can be treated like any other container adding other
|
||||
widgets to it (see demo textrot-demo.lsp).
|
||||
|
||||
Custom control for font coolors and size in newlisp-edit.lsp
|
||||
|
||||
Now newlisp-editor.lsp stays functional while a lengthy evaluation
|
||||
process is running and outputing to the monitor area. In another tab
|
||||
files can be edite/saved etc.
|
||||
|
||||
Auxiary newLISP process in newlisp-edit.lsp now starts with home directory as
|
||||
current directory
|
||||
|
||||
Trying to start a second evaluation or trying to restart the newLISP process
|
||||
will make the led blink in yellow for a second and output "busy" in the monitor
|
||||
area.
|
||||
|
||||
Trying to quit newlisp-edit.lsp while an evaluating process is running will
|
||||
leave the newlisp-edit.lsp application unfunctional on the screen until the
|
||||
evaluating process finishes. On MacOS X the Quit option of the top screen menu
|
||||
can be used to exit newlisp-edit.lsp in this case but on Win32 the task manager
|
||||
must be used to shut down newlisp-edit.lsp or the other evaluating process.
|
||||
|
||||
0.994
|
||||
Many fixes for running programs from the editor. There should be no possibility
|
||||
now to hang the editor, even if a pending newLISP evaluation cannot be finished,
|
||||
the editor should be still functional to edit and save files.
|
||||
|
||||
The yellow led will now stay on when a newLISP evaluation is pending to exit and
|
||||
an attempt has been make to start a second process. When the process has finished
|
||||
the led goes red. Attempting to start another app will do a restart automatically.
|
||||
|
||||
Running GUI-Server apps from newlisp-edit.lsp seems to be reliable now on MacOX X
|
||||
and Windows XP.
|
||||
|
||||
new menu 'File/Save Settings' saves all font, color and current directory when
|
||||
loading file. The settimgs file contains many more settings, which can be changed
|
||||
to give the editor a complete diferent appearance:
|
||||
|
||||
- The toolbar can be hidden completely or made floatable.
|
||||
- The tabs can be relocated to the bottom, left or right side of the editor.
|
||||
- The window size can be set to a desired X,Y width and height.
|
||||
|
||||
When newlisp-edit.lsp starts the first time and does not encounter a config file
|
||||
it gets created in the current home directory.
|
||||
|
||||
File and settings saving is announced in the monitor area.
|
||||
|
||||
Note, the directory remembered when open the file dialog is the directory of
|
||||
the currently open tab.
|
||||
|
||||
An optional icon can be added to gs:message-dialog when defining the type as "plain".
|
||||
In this case a user supplied icon will be shown.
|
||||
|
||||
0.995
|
||||
newlisp-edit.lsp:
|
||||
|
||||
- Font size did not get saved by 'File/Save Settings'.
|
||||
|
||||
- settings file ion Win32 gets now written to APPDATA/newLISP/newlisp-edit.conf
|
||||
where APPDATA is the Win32 environment variable for the applications data
|
||||
directory. If APPDATA is not defined USERPOFILE or DOCUMENT_ROOT is assumed
|
||||
On all other OS .newlisp-edit.conf is written to the users home directory
|
||||
in UNIX like fashion. This may change in the future for the Mac OX X to:
|
||||
~/Libarary/Application Support/newLISP/newlisp-edit.conf
|
||||
|
||||
- The toolbar can now be detached/reattached from the View menu
|
||||
|
||||
- The Tool menu as a 'Save Settings' option.
|
||||
|
||||
- The Help menu has options to access newLISP and GUI-Server docs.
|
||||
|
||||
- When editing the settings file and leaving an error, the next startup
|
||||
of newlisp-edit will give an error message box with the error.
|
||||
|
||||
- Ctrl-F (Win32) or meta-F (OS X) reenter the find dialog if not already
|
||||
open (this was already in 0.994, but not mentioned).
|
||||
|
||||
- Pressing ESC while in find dialog text field will close the find dialog
|
||||
this is consisten with behaviour of other Java-Swing built-in dialogs.
|
||||
When in the edit area ctrl-D / meta-D, will still work to dispose of the
|
||||
find-dialog
|
||||
|
||||
- on Mac OS X ctrl-up will select the tab, then keys left or right will
|
||||
let select other tabs. This is Java-Swing built-in behaviour and assumed
|
||||
to work like this on all platforms.
|
||||
|
||||
New gs:menu-item-check for checked menu items (behaves like a check box)
|
||||
|
||||
A new chapter about writing and debugging event handlers was added in the
|
||||
guiserver.lsp.html documentation.
|
||||
|
||||
0.996
|
||||
newlisp-edit.lsp:
|
||||
|
||||
- settings will now remember loaction and size of newlisp-edit.lsp on the screen
|
||||
|
||||
- Edit/Find marked edit buffer as dirty, which was not correct (icon and red dot)
|
||||
|
||||
- new menu option Edit/Goto Line
|
||||
|
||||
- mew menu option Files/Recent Files remembers a list of recently saved files
|
||||
the list is automatically updated each time a file is saved and maintained in
|
||||
the file $APPDATA/newlisp-edit-recent on Win32 or in $HOME/.newlisp-edit-recent
|
||||
on Mac OS X and Unix
|
||||
|
||||
popup menus now displayed in correct position on scrollable content
|
||||
|
||||
gs:get-bounds was broken, now displayes on-scrren coordinates for top level windows
|
||||
|
||||
new gs:goto-text - positions cursor in text at row columns position
|
||||
|
||||
new gs:load-text, gs:save-text to directlty load/save docs in to/from gs:text-pane
|
||||
these should not be used from Win32 because they don't work correctly with
|
||||
CR/LF line terminated files when using Edit/Find
|
||||
|
||||
documentation links in the Help menu have been taken out, because browser
|
||||
blocks guiserver.jar from exiting on Win32
|
||||
|
||||
0.997
|
||||
When using gs:load-text it now correctly filters carriage returns when
|
||||
loading files on Win32 or any other platforms. gs:save-text will always
|
||||
write LF line terminations. If this is not desirable, gs:get-text should
|
||||
be used instead.
|
||||
|
||||
ESC in find dialog also works when cursor in replace text field. ESC will close
|
||||
the dialog without initiaiting search action, as it did wrongly before.
|
||||
|
||||
demo directory accessible from the Help menu
|
||||
|
||||
Many additions and corrections to the documentaion.
|
||||
|
||||
0.998
|
||||
new gs:set-syntax-selected for enabling newLISP syntax highlighting in gs:text-pane
|
||||
|
||||
new gs:set-caret-color for setting a caret color in in all text widgets
|
||||
|
||||
new gs:set-selection-color for setting a text selection color
|
||||
|
||||
new gs:set-syntax-colors for setting syntax colors for keywords, comments etc.
|
||||
|
||||
new gs:key-event to register key events for any component (except text widgets,
|
||||
which already register keyevents by default)
|
||||
|
||||
syntax highlighting in newlisp-edit.lsp:
|
||||
- 3 preconfigured themes to choose from for medium, low and high contrast
|
||||
- alt-Y (Win32) or meta-Y (Mac OS X) toggle syntax highlighting on/off
|
||||
- by default all files ending in .lsp are highlighted
|
||||
|
||||
0.999
|
||||
newlisp-edit.lsp:
|
||||
|
||||
- any number of syntax profiles can now be configured in the settings file and
|
||||
loaded automatically into the View menu on startup.
|
||||
|
||||
- for the Tool menu scripts can be registered using the settings file. The
|
||||
scripts are run over the content of the current edit tab. The contents of the
|
||||
current edit tab is saved to a tmporary file, and the name of this file is passed
|
||||
as an argument to the script. The output of the script is shown in the monitor
|
||||
area.
|
||||
|
||||
- added tabulator size (in points) to settings file
|
||||
|
||||
- syntax on/off is remembered when switching tabs
|
||||
|
||||
- Edit/Get Position tells line and column positin of text cursor
|
||||
|
||||
- undo/redo was broken when in syntax highlighting mode. Undo/redo is now reset
|
||||
whenever switching syntax highligthing on/off. Loading a file is not part of an
|
||||
undoable operation anymore.
|
||||
|
||||
- eliminated foreground/background color options which are set as part of
|
||||
the color theme. When syntax highlighting is tirned off, foreground and background
|
||||
are still defined by the colors of the current theme.
|
||||
|
||||
- non-existing files in the recent files list are eliminated automatically
|
||||
|
||||
- now remembers correctly screen positions in settings file on all platforms
|
||||
|
||||
- eliminated black flash before splash screen display
|
||||
|
||||
- startup on Win32 w/o run.exe now shows hour glass cursor
|
||||
|
||||
- Clear Monitor disable/enable was faulty
|
||||
|
||||
- now highlights search text when returning to find/replace dialog
|
||||
|
||||
- message box when saving failed, e.g. becuase of wromg permissions
|
||||
|
||||
gs:set-cursor now works correctly in text widgets.
|
||||
|
||||
gs:get-bonds now works correctly for on-screen widgets
|
||||
|
||||
1.0 feature complete for release August 15th
|
||||
|
||||
fixed unreliable gs:layout
|
||||
|
||||
fixed occasional text blur in monitor area of newlisp-edit.lsp
|
||||
|
||||
new gs:get-selected-text, works like gs:get-text but retrieves selected text only
|
||||
|
||||
added C, C++, Java and PHP syntax highlighting, automatically selected for .c, .cpp, .h,
|
||||
.java and .php files. When a file does not have a known extension when loading, then no
|
||||
syntax highlighing is selected. But when switching highlighting on via View/Syntax
|
||||
or meta-Y (OS X) or alt-Y (Win32), a menu pops up for selecting a highlighting mode.
|
||||
|
||||
some small fixes for newLISP syntax highlighting
|
||||
|
||||
now 2 types of scripts in Tool menu and registered in currentScripts in settings file:
|
||||
|
||||
- Type "content" takes the contens of the edutor and passes it as a file to the script.
|
||||
Anything printed in the script goes to the monitor area in the editor. See the
|
||||
program word-count.lsp for an example
|
||||
|
||||
- Type "selection" takes the selection of the editor and passes it as a file to the
|
||||
script. Anyting printed from thr script replaces the selectin. If nothing
|
||||
was selected the output og the script gets inserted at the text caret.
|
||||
|
||||
The selection replace/insert type of script operation can be undone using Edit/Undo.
|
||||
In the settings file: the menu string, the script path name, the type and an
|
||||
optional shortcut key are specified. See the settings file for an example.
|
||||
|
||||
The settings file gets automatically created when not present on startup
|
||||
and registers the two scripts word-count.lsp and uppercase.lsp. The settings file
|
||||
can be edited using the option in the Tools menu.
|
||||
|
||||
before installing this version remove old settingfile on Win32:
|
||||
$HOME/Application Data/newLISP/newlisp-edit.conf or on Mac OS X and Unix:
|
||||
~/.newlisp-edit.conf
|
||||
|
||||
1.01 August 15th release
|
||||
|
||||
In newlis-edit.lsp: changed key assignments for fonts smaller/bigger:
|
||||
meta-minus and shift-meta-equals on Mac OS X and ctrl-minus ctrl-equals on Win32.
|
||||
For Mac OS X this is standard, for Win32 it mimics FireFox behaviour.
|
||||
|
||||
The items in gs:list-box and gs:combo-box can be either given individually
|
||||
or in a list: (gs:list-box 'TheListBox 'list-action '("a" "b" "c))
|
||||
|
||||
New gs:play-sound plays/streams .wav and .aif sound files.
|
||||
|
||||
|
||||
1.03
|
||||
The monitor area now works also as a newLISP shell, where expressions can
|
||||
be typed in directly and evaluated. The red/green led is not necessary
|
||||
anymore. The shell can be restarted at any time, even if a process is running.
|
||||
The run button will only work if the shell is present. If the shell is exited
|
||||
by a program, hit the restart button to restart. When restarting the shell
|
||||
while a program in it is running, the program will quit and the shell restart.
|
||||
|
||||
When the monitor/shell area has focus:
|
||||
Ctrl-l clears monitor and gives shell prompt (like Meta-m/Alt-m)
|
||||
Ctrl-p copies previous command
|
||||
Other common readline/editing commands usual in UNIX shells may be implemented
|
||||
in the future.
|
||||
|
||||
On Win32 Ctrl-l used to be "goto line" now: Alt-l
|
||||
On Win32 Ctrl-Shift-l used to "show current line/column" now: shift-Alt-l
|
||||
|
||||
newLISP-edit can be exited at any time, if a process is still running in the
|
||||
shell window it keeps on running after newLISP-edit closed.
|
||||
|
||||
New gs:run-shell installs a shell process in the monitor area
|
||||
New gs:eval-shell send a string for evaluation in the shell
|
||||
New gs:destroy-shell destroys the shell
|
||||
|
||||
Note that newlis-edit.lsp uses newISP as a shell process, but other shells
|
||||
can be started using gs:run-shell.
|
||||
|
||||
New gs:reorder-tags reorders the stacking order of tagged images.
|
||||
See the file drag-demo.lsp for usage (comment in gs:reorder-tags statement
|
||||
in line 47)
|
||||
|
||||
1.04
|
||||
Monitor background and foreground colors are now configuable in settings file
|
||||
do a File/Save Settings first to have the new config variables registered, then
|
||||
Tools/Edit Settings for editing: currentMonitorBackground and currentMonitorForeground.
|
||||
|
||||
Fix when evaluating in shell area after Ctrl-L, Meta-M (Alt-M).
|
||||
|
||||
Eliminated some quirks when copying/pasting between editor and monitor/shell area, and
|
||||
when hitting enter in the middle of an edited command.
|
||||
|
||||
Now full commandline history in shell-commandline when using arrow-up/down.
|
||||
|
||||
meta-1, meta-2 (alt-1, alt-2 on Win32) for switching between editor and shell/monitor.
|
||||
|
||||
More bash-shell like key bindings on UNIX: Ctrl-A beginnining of line after the
|
||||
shell prompt , Ctrl-E end of line (in gs:text-area with shell attached).
|
||||
|
||||
new gs:color-tag colors all shapes with the same tag
|
||||
|
||||
1.05
|
||||
gs:get-text now can be called without an action handler to return the text
|
||||
immedeately. This new synchronous mnode of gs:get-text is not recommended when
|
||||
receiving larger text areas, as the call is blocking until all text is returned,
|
||||
but makes coding simple data forms a lot shorter.
|
||||
|
||||
gs:mouse-move now can take an additional boolean parameter to indicate that
|
||||
a list of tags are to be returned in the mouse-move event handler. The flag
|
||||
should not be used when large amount of tags are present as it can slow down
|
||||
performance significantly calculating and transmitting tag lists on every
|
||||
mouse movement.
|
||||
|
||||
gs:key-event now also can be registered as a second key listener on text widgets.
|
||||
This is espacially interesting on gs:text-field, where individual key action
|
||||
could not be captured before, as the normal handler registered with gs:text-area
|
||||
only handles the ENTER and ESC key.
|
||||
|
||||
fix in gs:run-shell for shells without prompts
|
||||
|
||||
now uses patform independent:
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
in all demo files to load guiserver.lsp
|
||||
|
||||
1.06
|
||||
edit buffer did not get marked as dirty when cutting/pasting into clean buffer
|
||||
|
||||
when file-recent-loading->saving->file-recent-reloading the same file editor crashed
|
||||
|
||||
make sure shell proccesses in monitor window are destroyed when closing newlisp-edit
|
||||
|
||||
because of new 'process' in newlisp core full java path is needed in process statement
|
||||
in gs:init function. Assumes /usr/bin/java
|
||||
|
||||
1.07
|
||||
Tcp/Ip connection between Guiserver and newLISP now goes via 127.0.0.1, not localhost
|
||||
to avoid loss of connection when computer sleeps, while an GS application was
|
||||
running.
|
||||
|
||||
when runniung editor contents and shell is dow, the shell will be restarted
|
||||
automatically
|
||||
|
||||
the editor now loads, saves and displays UTF-8 correctly
|
||||
|
||||
1.08
|
||||
Guiserver now adjusts automatically to set UTF-8 on/off depending on newLISP version
|
||||
|
||||
The Win32 is again shipped as not UTF-8 by default.
|
||||
|
||||
new gs:window-moved and gs:window-resized. See new demo file move-resize-demo.lsp
|
||||
|
||||
1.09
|
||||
reverse "meta N" and "shift meta N" on OS X to be standard with "meta N" new window/tab
|
||||
on OS X
|
||||
|
||||
gs:mouse-event now can also be used on list boxes made with gs:list-box, this makes
|
||||
it possible to process single clicks.
|
||||
|
||||
1.10
|
||||
the gs:list-box event now responds on any click-count, previously only on 2 for
|
||||
double click. Addtionally the click-count is transmitted in the event as the last
|
||||
parameter
|
||||
|
||||
1.11
|
||||
replace all can now be redone, double undo not required any more for replace
|
||||
|
||||
new gs:undo-enable undo is currently disabled in newlisp-edit for find/replace
|
||||
because of instabilities
|
||||
|
||||
1.12
|
||||
newlisp-edit "Undo Previous" button in find dialog, this is used to undo replacements.
|
||||
Replacements cannot be undone with normal undo when the find dialog is closed again,
|
||||
but can only be undone from inside the find dialog
|
||||
|
||||
1.12-13-14
|
||||
in guiserver.lsp now checking JAVA_HOME when not Win32 or OS X
|
||||
|
||||
1.15
|
||||
fixed highlighing for 'pop-assoc'
|
||||
|
||||
1.16
|
||||
highlighting for regex-comp, spawn, sync and abort
|
||||
|
||||
a bug fix for newlisp-edit.lsp 1.12 for an editor crash caused by index overrun
|
||||
in switch-to-tab function
|
||||
|
||||
newlisp-edit.lsp will quit right away when buffers are clean without showing
|
||||
"You really ..." dialog
|
||||
|
||||
fixed gs:text-area area hangup when deleting backwards beyond beginning o line
|
||||
and hitting enter
|
||||
|
||||
1.17
|
||||
UTF-8 gs:set-text for gs:text-pane, gs:text-area and gs:text-field.
|
||||
|
||||
1.18
|
||||
UTF-8 text now working on all widgets and setter/getter functions. UTF-8 is
|
||||
enabled by default on the Mac OS X installer but not on Win32 which uses
|
||||
ISO 8859 code pages to display some eastern European and Middle Eastern fonts.
|
||||
Running an UTF-8 enabled version with newLISP-GS on Win32 will automatically
|
||||
switch newLISP-GS to UTF-8.
|
||||
|
||||
new gs:midi-init, gs:midi-close, gs:midi-patch, gs:play-note, gs:play-sequence
|
||||
gs:add-track and gs:mute-track for controlling an internal MIDI device.
|
||||
On Win32 a soundbank must be installed, see the description for gs:play-note
|
||||
for more details, where to get and how to install a soundbank file.
|
||||
|
||||
1.19
|
||||
Non-default directory install on Win32 now works. Windows must be rebooted
|
||||
when not accepting the default directory, so the different path set in
|
||||
the environment variable NEWLISPDIR can come into effect.
|
||||
|
||||
New gs:save-sequence saves sequences created using gs:add-track to a MIDI
|
||||
file.
|
||||
|
||||
gs:midi-init now can take a file path to an external soundbank file.
|
||||
|
||||
gs:channel-bend can be used to tune a channel up or down by a halftone
|
||||
|
||||
1.20
|
||||
fixed check option in gs:menu-item-check
|
||||
|
||||
1.21
|
||||
gs:channel-bend did not remember channel specific setting when using on more
|
||||
than one channel
|
||||
|
||||
reworked handling of bpm and resolution (gs:midi-bpm). Now recording with
|
||||
gs:save-sequence will work for any BPM settings correctly
|
||||
|
||||
notes in gs:play-note and gs:add-track now can have an optional last parameter
|
||||
for a note specific pitch-pend
|
||||
|
||||
1.22
|
||||
when history line in cursor-up keystroke in minitor area contains more than
|
||||
one line only the last line will enter history
|
||||
|
||||
gs:set-canvas did not change current canvas for guiserver.lsp
|
||||
|
||||
1.23
|
||||
fixed a long standing bug when copying pasting inside the monitor area
|
||||
|
||||
1.24
|
||||
some code cleanup in TextAreaWidget.java
|
||||
|
||||
Ctrl-A and HOME in monitor area now go to beginning of line _after_ the prompt
|
||||
Ctrl-P goes up in history, Ctrl-N goes down in history (like cursor UP, DOWN)
|
||||
Most Emacs (or Bash shell) commandline editing key strokes now work in the
|
||||
monitor area
|
||||
|
||||
1.25 changes for 9.9.2
|
||||
|
||||
1.26 guiserver
|
||||
don't repeat last color change on keystroke but display normal color
|
||||
|
||||
1.27
|
||||
added $it, bits, estack and read-utf8 to syntax highlighting
|
||||
|
||||
1.28
|
||||
[cmd][/cmd] tags can now be used in the monitor area
|
||||
1.29
|
||||
added transfer-event to syntax highlighter
|
||||
|
||||
1.30 a fix in the syntax highlighter for newLISP mode
|
||||
in newlisp-edit.sp font can now shanged in both, the editor and the monitor
|
||||
|
||||
1.31 syntax highlighting for new functions
|
||||
|
||||
1.32 the function gs:color-tag was documented but not implemented
|
||||
in newlisp-edit.lsp dirty-buffer indication did not work with Ctrl-x/v/z/Z
|
||||
and Cmd-x/v/z/Z
|
||||
|
||||
1.33/34 added new functions to the syntax highlighter
|
||||
|
||||
1.35 added new 'extend' and changed all copyright notes to 2010
|
||||
|
||||
1.36 added 'term', '++', '--' and eliminated 'name' from
|
||||
SyntaxHighligher.java
|
||||
|
||||
1.37 new OSXAdapter.java from Apple and related changes in guiserver.java
|
||||
add 'serialVersionUID' to various files to avoid warnings in new Java versions
|
||||
|
||||
1.38 an additional parameter in gs:text-field specifies a cover character to use
|
||||
the text-field for password entry
|
||||
|
||||
new textfield-demo.lsp
|
||||
|
||||
a UTF-8 fix for gs:get-fonts when font names
|
||||
|
||||
a UTF-8 fix for gs:append-text for labels
|
||||
|
||||
a UTF-8 dix gs:select-list-items for combo boxes, added to widget-demo-(ru, jp).lsp
|
||||
|
||||
a UTF-8 fix for gs:get-text for Dialog widgets
|
||||
|
||||
a UTF-8 fix for gs:menu-item-check
|
||||
|
||||
a UTF-8 fix for the tabbed pane when tabes are selected
|
||||
|
||||
a UTF-8 fix for gs:set-tool-tab
|
||||
|
||||
a UTF-8 fix for gs:set-font when font names are in UTF-8
|
||||
|
||||
1.39
|
||||
New Base64Coder.java with UTF8 aware encodeStringUTF8() and decodeStringUTF8()
|
||||
|
||||
1.40
|
||||
Syntax highlighting for date-parse (new writing of parse-date), date-list,
|
||||
net-packet and net-ipv
|
||||
|
||||
1.41
|
||||
Instability when nesting gs:check-event calls inside handler functions called
|
||||
from gs:listen, was entirely caused by an interaction of the global variable
|
||||
'event' used in both functions. This variable is now localized in both functions.
|
||||
Seperation of synchronous versus asynchronous communications, as suggested by
|
||||
a user is therefore not necessary.
|
||||
|
||||
1.42
|
||||
New table widget and support functions with code contributed by Unya from:
|
||||
http://newlispfanclub.alh.net/forum/
|
||||
|
||||
1.43
|
||||
Bug fix in table API
|
||||
|
||||
1.44
|
||||
fixed error message in gs:save-sequence
|
||||
|
||||
1.45
|
||||
Some error messages in the Midi part now exit the program to avoid error dialog
|
||||
loops.
|
||||
|
||||
Added struct to SyntaxHighlighter.java
|
||||
|
||||
1.46 added various new primitives to SyntaxHighlighter.java
|
||||
|
||||
1.47 gs:get-text now handles empty gs:text-field correctly
|
||||
|
||||
1.48 added various new primitives to SyntaxHighlighter.java
|
||||
syntxa highlighting for binary numbers like 0b10101
|
||||
|
||||
1.50 fixed gs:run-shell in newlisp-edit.lsp and TextAreaWidget.java for different
|
||||
handling of Runtime.getRuntime().exec(cmdArray) in Java 7 update 21.
|
||||
|
||||
1.51
|
||||
When adding columns with empty string headers, this will not any more put the
|
||||
column number as header. This allows to add columns to headerless tables, as
|
||||
possible when supplying empty string headers in the initial gs:table statement.
|
||||
|
||||
1.60
|
||||
New table functions igs:table-remove-row, gs:table-set-column-name and
|
||||
gs:table-set-row-count. Thanks to Ferry de Bruin.
|
||||
The nameing of gs:table-set-row-number is deprecated and should be called
|
||||
as gs:table-show-row-number. The old naming will continue to work.
|
||||
|
||||
1.60
|
||||
Addtions to the table interface.
|
||||
|
||||
1.62
|
||||
Make +123 and +1.23 work in syntax highlighter.
|
||||
Make sicentific notation e.g. 1.23e-4 work in syntax highlighter.
|
||||
|
||||
1.66 fixed screeen update when scrolling, fixed guierver quit menu.
|
||||
|
1046
guiserver/COPYING
Normal file
18
guiserver/Makefile
Normal file
|
@ -0,0 +1,18 @@
|
|||
# this make file is only used during development
|
||||
# the main makefile in the newlisp-x.x.x/ will
|
||||
# normally peform the installation below
|
||||
|
||||
all:
|
||||
javac -Xlint java/*.java
|
||||
mv java/*.class .
|
||||
jar cmf Manifest guiserver.jar *.class images/*.png
|
||||
rm *.class
|
||||
|
||||
install:
|
||||
-install -d /usr/local/share/newlisp/guiserver
|
||||
-install -d /usr/local/share/doc/newlisp/guiserver
|
||||
-install -m 644 guiserver.jar /usr/local/share/newlisp/
|
||||
-install -m 644 guiserver.lsp /usr/local/share/newlisp/
|
||||
-install -m 644 index.html /usr/local/share/doc/newlisp/guiserver/
|
||||
-install -m 644 guiserver.lsp.html /usr/local/share/doc/newlisp/guiserver/
|
||||
-install -m 755 newlisp-edit.lsp /usr/local/bin/newlisp-edit
|
1
guiserver/Manifest
Normal file
|
@ -0,0 +1 @@
|
|||
Main-Class: guiserver
|
43
guiserver/allfonts-demo.lsp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; allfonts-demo.lsp - show all fonts on the system
|
||||
;; this program also demonstrates that strings can be used instead
|
||||
;; of symbols for widget names (label in this case)
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
;(gs:set-trace true)
|
||||
;;;; describe the GUI
|
||||
(gs:frame 'AllFontsDemo 100 100 500 400)
|
||||
(gs:set-background 'AllFontsDemo 1 1 1)
|
||||
(gs:get-fonts)
|
||||
(gs:panel 'FontPanel)
|
||||
(gs:set-grid-layout 'FontPanel (length gs:fonts) 1 0 0)
|
||||
(gs:set-text 'AllFontsDemo (string "All " (length gs:fonts) " fonts on this system"))
|
||||
(dolist (font gs:fonts)
|
||||
(set 'font-label (string "label-" $idx))
|
||||
(gs:label font-label font)
|
||||
(gs:set-size font-label 100 30)
|
||||
(gs:set-font font-label font 24 "plain")
|
||||
(gs:mouse-event font-label 'mouse-action)
|
||||
(gs:add-to 'FontPanel font-label))
|
||||
|
||||
(gs:scroll-pane 'Scroll 'FontPanel)
|
||||
(gs:add-to 'AllFontsDemo 'Scroll)
|
||||
(gs:set-visible 'AllFontsDemo true)
|
||||
|
||||
|
||||
(define (mouse-action id type x y button cnt mods)
|
||||
(gs:set-text 'AllFontsDemo
|
||||
(format "%s %s %d:%d button:%d count:%d mod-key:%d" id type x y button cnt mods))
|
||||
)
|
||||
;;;; listen for incoming action requests and dispatch
|
||||
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
60
guiserver/animation-demo.lsp
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; animation-demo.lsp - demonstrate gs:move-tag for making animations
|
||||
;; and the mouse-wheel moving a text object
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
|
||||
;;;; describe the GUI
|
||||
(gs:frame 'AnimationDemo 100 100 400 400 "Animation ~ 50 frames/sec, 5 pixel/step")
|
||||
(gs:set-resizable 'AnimationDemo nil)
|
||||
(gs:canvas 'MyCanvas)
|
||||
(gs:set-background 'MyCanvas gs:white)
|
||||
(gs:mouse-wheel 'MyCanvas 'mouse-wheel-action)
|
||||
(gs:add-to 'AnimationDemo 'MyCanvas)
|
||||
|
||||
(set 'Ty 200)
|
||||
(gs:set-font 'MyCanvas "Lucida Sans Oblique" 16 "plain")
|
||||
(gs:draw-text 'T "mouse wheel moves this text, changes speed" 20 Ty)
|
||||
(gs:fill-circle 'C 50 40 25 gs:red)
|
||||
(gs:fill-circle 'C 30 20 15 gs:black)
|
||||
(gs:fill-circle 'C 70 20 15 gs:black)
|
||||
(gs:fill-circle 'C 50 48 6 gs:yellow)
|
||||
|
||||
(gs:set-visible 'AnimationDemo true)
|
||||
|
||||
|
||||
(define (mouse-wheel-action x y wheel)
|
||||
(inc delay (* wheel 1000))
|
||||
(if (> delay 80000) (set 'delay 80000))
|
||||
(if (< delay 500) (set 'delay 500))
|
||||
(if (= ostype "OSX")
|
||||
(gs:move-tag 'T 0 (* wheel wheel (sgn wheel)))
|
||||
(gs:move-tag 'T 0 (* 5 wheel)))
|
||||
)
|
||||
|
||||
(set 'delay 20000) ;;
|
||||
|
||||
(while (gs:check-event delay)
|
||||
(dotimes (x 60)
|
||||
(gs:check-event delay)
|
||||
(gs:move-tag 'C 5 0))
|
||||
(dotimes (x 60)
|
||||
(gs:check-event delay)
|
||||
(gs:move-tag 'C 0 5))
|
||||
(dotimes (x 60)
|
||||
(gs:check-event delay)
|
||||
(gs:move-tag 'C -5 0))
|
||||
(dotimes (x 60)
|
||||
(gs:check-event delay)
|
||||
(gs:move-tag 'C 0 -5))
|
||||
)
|
||||
|
||||
(exit)
|
||||
|
||||
;; eof
|
||||
|
32
guiserver/border-layout-demo.lsp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; border-layout-demo.lsp - demonstrate the border layout
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
|
||||
|
||||
;;;; describe the GUI
|
||||
(gs:frame 'BorderDemo 100 100 400 300 "Border layout demo")
|
||||
(gs:set-border-layout 'BorderDemo 0 0)
|
||||
(gs:panel 'NorthPanel 50 50)
|
||||
(gs:set-color 'NorthPanel 0.5 0 0)
|
||||
(gs:panel 'WestPanel 50 50)
|
||||
(gs:set-color 'WestPanel 0.5 0.5 0)
|
||||
(gs:panel 'CenterPanel 50 50)
|
||||
(gs:set-color 'CenterPanel 0.0 0.5 0)
|
||||
(gs:panel 'EastPanel 50 50)
|
||||
(gs:set-color 'EastPanel 0.0 0.5 0.5)
|
||||
(gs:panel 'SouthPanel 50 50)
|
||||
(gs:set-color 'SouthPanel 0.0 0 0.5)
|
||||
(gs:add-to 'BorderDemo 'NorthPanel "north" 'WestPanel "west" 'CenterPanel "center"
|
||||
'EastPanel "east" 'SouthPanel "south")
|
||||
(gs:set-visible 'BorderDemo true)
|
||||
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
36
guiserver/button-demo.lsp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
; button-demo.lsp - demonstrate the button control
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
(gs:set-trace true)
|
||||
|
||||
;;;; describe the GUI
|
||||
(gs:frame 'ButtonDemo 100 100 400 300 "Click on button or color panel")
|
||||
(gs:set-resizable 'ButtonDemo nil)
|
||||
(gs:panel 'ColorPanel 360 200)
|
||||
(gs:set-background 'ColorPanel '(0 1 0) 0.2)
|
||||
(gs:button 'aButton 'button-action "color")
|
||||
(gs:set-flow-layout 'ButtonDemo "center" 2 15)
|
||||
(gs:add-to 'ButtonDemo 'ColorPanel 'aButton)
|
||||
(gs:set-visible 'ButtonDemo true)
|
||||
|
||||
(gs:mouse-event 'ColorPanel 'mouse-action)
|
||||
|
||||
;;;; define actions
|
||||
(define (button-action id)
|
||||
(gs:set-color 'ColorPanel (random) (random) (random)))
|
||||
|
||||
(define (mouse-action id type x y button cnt mods)
|
||||
(gs:set-text 'ButtonDemo (format "%8s %3d:%3d %d %d %2d" type x y button cnt mods))
|
||||
)
|
||||
|
||||
;;;; listen for incoming action requests and dispatch
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
27
guiserver/clipboard-demo.lsp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; clipboard-demo.lsp - demonstrate the gs:paste-text function
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
|
||||
(gs:frame 'Frame 200 200 400 300)
|
||||
(gs:set-border-layout 'Frame)
|
||||
(gs:text-area 'TheText 'text-handler)
|
||||
(gs:button 'TheButton 'button-handler "get clipboard")
|
||||
(gs:add-to 'Frame 'TheText "center" 'TheButton "south")
|
||||
(gs:set-visible 'Frame true)
|
||||
|
||||
(define (button-handler)
|
||||
(gs:paste-text 'TheText))
|
||||
|
||||
(define (text-handler))
|
||||
|
||||
;;;; listen for incoming action requests and dispatch
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
47
guiserver/cursor-demo.lsp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; cursor-demo - demonstrate cursor shapes with gs:set-cursor
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
;(gs:set-trace true)
|
||||
|
||||
(set 'cursor-shapes '(
|
||||
"default"
|
||||
"crosshair"
|
||||
"text"
|
||||
"wait"
|
||||
"sw-resize"
|
||||
"se-resize"
|
||||
"nw-resize"
|
||||
"ne-resize"
|
||||
"n-resize"
|
||||
"s-resize"
|
||||
"w-resize"
|
||||
"e-resize"
|
||||
"hand"
|
||||
"move"
|
||||
))
|
||||
|
||||
;; describe the GUI
|
||||
(gs:frame 'CursorDemo 100 100 500 200 "Cursor shapes - move the cursor over the panels")
|
||||
(gs:set-grid-layout 'CursorDemo 2 7)
|
||||
|
||||
(dolist (c cursor-shapes)
|
||||
(set 'id (sym c))
|
||||
(gs:panel id)
|
||||
(gs:set-background id (list (random) (random) (random)))
|
||||
(gs:set-cursor id c)
|
||||
(gs:add-to 'CursorDemo id))
|
||||
|
||||
;(gs:set-resizable 'CursorDemo nil)
|
||||
|
||||
(gs:set-visible 'CursorDemo true)
|
||||
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
83
guiserver/drag-demo.lsp
Normal file
|
@ -0,0 +1,83 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; drag-demo.lsp - demonstrate dragging of objects with the mouse
|
||||
;;
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
;(gs:set-trace true)
|
||||
|
||||
;;;; describe the GUI
|
||||
(gs:frame 'DragDemo 100 100 600 500 "Drag demo")
|
||||
;(gs:set-resizable 'DragDemo nil)
|
||||
(gs:canvas 'MyCanvas)
|
||||
(gs:set-background 'MyCanvas gs:white)
|
||||
(gs:add-to 'DragDemo 'MyCanvas)
|
||||
(gs:mouse-clicked 'MyCanvas 'mouse-clicked-action true)
|
||||
(gs:mouse-pressed 'MyCanvas 'mouse-pressed-action true)
|
||||
(gs:mouse-released 'MyCanvas 'mouse-released-action true)
|
||||
(gs:mouse-dragged 'MyCanvas 'mouse-dragged-action)
|
||||
|
||||
;(gs:set-scale 0.5 0.5) ; only for testing, dragging would fail
|
||||
|
||||
(gs:set-font 'MyCanvas "Lucida Sans Oblique" 18 "plain")
|
||||
(gs:draw-text 'T "Drag objects with the mouse, click right for popup menu" 20 250 gs:darkGray)
|
||||
(gs:fill-circle 'C 100 100 50 gs:red)
|
||||
(gs:fill-circle 'C 60 60 30 gs:black)
|
||||
(gs:fill-circle 'C 140 60 30 gs:black)
|
||||
(gs:fill-circle 'C 100 110 8 gs:yellow)
|
||||
|
||||
|
||||
(gs:draw-polygon 'P '(300 200 400 50 500 200) gs:blue)
|
||||
|
||||
(gs:draw-image 'I "/local/newLISP128.png" 300 300 128 128)
|
||||
|
||||
(gs:menu-popup 'EditMenuPopup "Edit")
|
||||
(gs:menu-item 'EditCut 'gs:no-action "Cut")
|
||||
(gs:menu-item 'EditCopy 'gs:no-action "Copy")
|
||||
(gs:menu-item 'EditPaste 'gs:no-action "Paste")
|
||||
(gs:disable 'EditCut 'EditCopy 'EditPaste)
|
||||
(gs:add-to 'EditMenuPopup 'EditCut 'EditCopy 'EditPaste)
|
||||
|
||||
; comment out to test reorder
|
||||
;(gs:reorder-tags '(I P C T))
|
||||
|
||||
(gs:set-visible 'DragDemo true)
|
||||
|
||||
;(gs:update)
|
||||
|
||||
;; actions
|
||||
(set 'mouse-down-tags '())
|
||||
|
||||
(define (mouse-clicked-action x y button cnt modifiers tags)
|
||||
(gs:set-text 'DragDemo (string x ":" y " " button " " cnt " " tags))
|
||||
(if (or (= 3 button) (= modifiers 18)) ; check for ctrl-button1-click on Mac
|
||||
(gs:show-popup 'EditMenuPopup 'MyCanvas x y))
|
||||
)
|
||||
|
||||
(define (mouse-pressed-action x y button modifiers tags)
|
||||
(gs:set-text 'DragDemo (string x ":" y " " button " " modifiers " " tags))
|
||||
(set 'mouse-down-tags tags)
|
||||
(set 'mouse-old-x x)
|
||||
(set 'mouse-old-y y)
|
||||
)
|
||||
|
||||
(define (mouse-released-action x y button modifiers tags)
|
||||
(gs:set-text 'DragDemo (string x ":" y " " button " " modifiers " " tags))
|
||||
(set 'mouse-down-tags '())
|
||||
)
|
||||
|
||||
(define (mouse-dragged-action x y)
|
||||
(dolist (t mouse-down-tags)
|
||||
(gs:move-tag t (- x mouse-old-x) (- y mouse-old-y)))
|
||||
(set 'mouse-old-x x)
|
||||
(set 'mouse-old-y y)
|
||||
)
|
||||
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
61
guiserver/font-demo.lsp
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; font-demo.lsp - show all built-in Java fonts (available on all platforms)
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
|
||||
;;;; describe the GUI
|
||||
(gs:frame 'TestFrame 100 100 480 320 "newLISP-GS built-in Font Families")
|
||||
(gs:set-background 'TestFrame 1 1 1)
|
||||
(gs:set-grid-layout 'TestFrame 12 1)
|
||||
(gs:label 'L1 "Lucida Sans Regular")
|
||||
(gs:set-font 'L1 "Lucida Sans" 20 "plain")
|
||||
(gs:label 'L2 "Lucida Sans Bold")
|
||||
(gs:set-font 'L2 "Lucida Sans" 20 "bold")
|
||||
(gs:label 'L3 "Lucida Sans Oblique")
|
||||
(gs:set-font 'L3 "Lucida Sans" 20 "italic")
|
||||
|
||||
(gs:label 'L4 "Lucida Bright Regular")
|
||||
(gs:set-font 'L4 "Lucida Bright" 20 "plain")
|
||||
(gs:label 'L5 "Lucida Bright Bold")
|
||||
(gs:set-font 'L5 "Lucida Bright" 20 "bold")
|
||||
(gs:label 'L6 "Lucida Bright Oblique")
|
||||
(gs:set-font 'L6 "Lucida Bright" 20 "italic")
|
||||
|
||||
(gs:label 'L7 "Lucida Sans Typewriter Regular")
|
||||
(gs:set-font 'L7 "Lucida Sans Typewriter" 20 "plain")
|
||||
(gs:label 'L8 "Lucida Sans Typewriter Bold")
|
||||
(gs:set-font 'L8 "Lucida Sans Typewriter" 20 "bold")
|
||||
(gs:label 'L9 "Lucida Sans Typewriter Oblique")
|
||||
(gs:set-font 'L9 "Lucida Sans Typewriter" 20 "italic")
|
||||
|
||||
(gs:label 'L10 "Monospaced Regular")
|
||||
(gs:set-font 'L10 "Monospaced" 20 "plain")
|
||||
(gs:label 'L11 "Monospaced Bold")
|
||||
(gs:set-font 'L11 "Monospaced" 20 "bold")
|
||||
(gs:label 'L12 "Monospaced Oblique")
|
||||
(gs:set-font 'L12 "Monospaced" 20 "italic")
|
||||
|
||||
(dolist (i '(L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11 L12))
|
||||
(gs:set-foreground i 0 0 0.4))
|
||||
|
||||
(gs:add-to 'TestFrame 'L1 'L2 'L3 'L4 'L5 'L6 'L7 'L8 'L9 'L10 'L11 'L12)
|
||||
(gs:set-visible 'TestFrame true)
|
||||
|
||||
;; actions
|
||||
|
||||
(define (toggle-action id flag)
|
||||
(if flag
|
||||
(gs:set-icon 'aImage "/local/newLISP32.png")
|
||||
(gs:set-icon 'aImage "/local/newLISP128.png"))
|
||||
)
|
||||
|
||||
;;;; listen for incoming action requests and dispatch
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
28
guiserver/frameless-demo.lsp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
|
||||
;; frameless-demo.lsp - frameless and transparent (on MacOS X)
|
||||
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
|
||||
(gs:window 'Window 100 100 400 100)
|
||||
(gs:set-background 'Window 0 0 0.5 0.2)
|
||||
(gs:set-border-layout 'Window)
|
||||
(gs:label 'Time " ")
|
||||
(gs:set-font 'Time "Mono Spaced" 40 "bold")
|
||||
(gs:set-foreground 'Time 1 1 0 )
|
||||
(gs:add-to 'Window 'Time "center")
|
||||
(gs:button 'Button 'button-handler "close")
|
||||
(gs:add-to 'Window 'Button "south")
|
||||
(gs:set-visible 'Window true)
|
||||
|
||||
(define (button-handler) (exit))
|
||||
|
||||
(while (gs:check-event 10000)
|
||||
(sleep 200)
|
||||
(gs:set-text 'Time (date (date-value) 0 "%b %d %H:%M:%S"))
|
||||
)
|
||||
|
||||
;; eof
|
BIN
guiserver/guiserver.jar
Normal file
3829
guiserver/guiserver.lsp
Normal file
3068
guiserver/guiserver.lsp.html
Normal file
3832
guiserver/guiserver.lsp.src.html
Normal file
56
guiserver/html-demo.lsp
Normal file
|
@ -0,0 +1,56 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; html-demo.lsp - demonstrate the text pane with HTML
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
|
||||
;;;; describe the GUI
|
||||
(gs:frame 'HtmlDemo 100 100 400 270 "HTML text-pane demo")
|
||||
(gs:text-pane 'HtmlPane 'htmlpane-action "text/html" 200 500)
|
||||
(gs:set-editable 'HtmlPane nil)
|
||||
(gs:set-tab-size 'HtmlPane 4)
|
||||
(gs:set-font 'HtmlPane "Monospaced" 14 "plain")
|
||||
(gs:set-background 'HtmlPane 1 1 0.96)
|
||||
|
||||
(if (= ostype "Windows")
|
||||
(set 'url (string "file:///" (env "NEWLISPDIR") "/guiserver/html-demo.lsp"))
|
||||
(set 'url "file:///usr/local/share/newlisp/guiserver/html-demo.lsp")
|
||||
)
|
||||
|
||||
(set 'page (format [text]
|
||||
<html>
|
||||
<center><br><h2>Text panes for HTML</h2></center>
|
||||
<blockquote>
|
||||
<p>This is a page of <i>html</i> text with a clickable hyperlink
|
||||
<a href="%s">html-demo.lsp</a>.</p>
|
||||
|
||||
<p>The previous link expects the file <tt>html-demo.lsp</tt> in
|
||||
the current directory from where the program was started.</p>
|
||||
|
||||
<p>Only simple pages are processed correctly.</p>
|
||||
|
||||
</blockquote>
|
||||
</html>
|
||||
[/text] url))
|
||||
|
||||
(gs:set-text 'HtmlPane page)
|
||||
(gs:append-text 'HtmlPane "This is appended text")
|
||||
(gs:add-to 'HtmlDemo 'HtmlPane)
|
||||
(gs:set-visible 'HtmlDemo true)
|
||||
|
||||
;;;; define actions
|
||||
(define (urlfield-action id txt)
|
||||
)
|
||||
|
||||
(define (htmlpane-action id text)
|
||||
)
|
||||
|
||||
;;;; listen for incoming action requests and dispatch
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
66
guiserver/image-demo.lsp
Normal file
|
@ -0,0 +1,66 @@
|
|||
#!/usr/local/bin/newlisp
|
||||
;;
|
||||
;; image-demo.lsp - demonstrate images rotating and zooming
|
||||
;; and the mouse-wheel rotating an object
|
||||
|
||||
;;;; initialization
|
||||
(set-locale "C")
|
||||
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
|
||||
|
||||
(gs:init)
|
||||
|
||||
;;;; describe the GUI
|
||||
(gs:frame 'ImageDemo 100 100 600 600 "Image demo")
|
||||
(gs:set-border-layout 'ImageDemo)
|
||||
;(gs:set-resizable 'ImageDemo nil)
|
||||
(gs:canvas 'MyCanvas)
|
||||
(gs:set-background 'MyCanvas gs:white)
|
||||
(gs:panel 'Select)
|
||||
(gs:radio-button 'ZoomButton 'zoom-action "zoom")
|
||||
(gs:radio-button 'TurnButton 'turn-action "turn")
|
||||
(gs:set-selected 'TurnButton true)
|
||||
(set 'turn-flag true)
|
||||
(gs:add-to 'Select 'ZoomButton 'TurnButton)
|
||||
(gs:add-to 'ImageDemo 'MyCanvas "center" 'Select "south")
|
||||
(gs:mouse-wheel 'MyCanvas 'mouse-wheel-action)
|
||||
|
||||
;(gs:set-scale 0.5 0.5) ; only for testing
|
||||
|
||||
(gs:set-font 'MyCanvas "Lucida Sans Oblique" 14 "plain")
|
||||
(gs:draw-text 'T "turn mouse wheel to turn or zoom image" 20 50 gs:darkGray)
|
||||
(gs:draw-image 'S "/local/newLISP128.png" 320 20 32 50)
|
||||
(gs:draw-image 'S "/local/newLISP128.png" 380 30 50 32)
|
||||
|
||||
(gs:draw-image 'I "/local/newLISP128.png" -64 -64)
|
||||
(gs:translate-tag 'I 300 300)
|
||||
|
||||
(gs:set-visible 'ImageDemo true)
|
||||
|
||||
;; actions
|
||||
|
||||
(define (zoom-action id flag)
|
||||
(gs:set-selected 'TurnButton (not flag))
|
||||
(set 'turn-flag (not flag))
|
||||
)
|
||||
|
||||
(define (turn-action id flag)
|
||||
(gs:set-selected 'ZoomButton (not flag))
|
||||
(set 'turn-flag flag)
|
||||
)
|
||||
|
||||
|
||||
(define (mouse-wheel-action x y wheel)
|
||||
(if turn-flag
|
||||
(gs:rotate-tag 'I wheel 0 0)
|
||||
(if (< wheel 0)
|
||||
(gs:scale-tag 'I 0.9 0.9)
|
||||
(gs:scale-tag 'I 1.1 1.1)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(gs:listen)
|
||||
|
||||
;; eof
|
||||
|
2
guiserver/images/change-name
Normal file
|
@ -0,0 +1,2 @@
|
|||
replace-filename "(.*?)-icon-(.*)" ".*png" "(string \$1 \$2)"
|
||||
|
BIN
guiserver/images/clear-down32.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
guiserver/images/clear32.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
guiserver/images/copy-down32.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
guiserver/images/copy32.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
guiserver/images/cut-down32.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
guiserver/images/cut32.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
guiserver/images/dotgray16.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
guiserver/images/dotgray32.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
guiserver/images/dotgreen16.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
guiserver/images/dotgreen32.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
guiserver/images/dotred16.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
guiserver/images/dotred32.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
guiserver/images/dotyellow16.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
guiserver/images/dotyellow32.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
guiserver/images/edit-down32.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
guiserver/images/edit32.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
guiserver/images/folder-closed-down32.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
guiserver/images/folder-closed32.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
guiserver/images/folder-opened-down32.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
guiserver/images/folder-opened32.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
guiserver/images/font-book-down32.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
guiserver/images/font-book32.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
guiserver/images/green10.png
Normal file
After Width: | Height: | Size: 726 B |
14
guiserver/images/index.cgi
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env newlisp
|
||||
|
||||
(print "Content-type: text/html\r\n\r\n")
|
||||
(println "<h2>" (real-path) "</h2>")
|
||||
|
||||
(println {<table>})
|
||||
(dolist (file (sort (directory)))
|
||||
(set 'slash (if (directory? file) "/" ""))
|
||||
(println {<tr><td><tt><a href="http:} file slash {">} file slash {</a> </tt></td><td><tt>}
|
||||
(date (last (file-info file)) 0 "%Y-%m-%d %H:%M:%S") {</tt></td>}
|
||||
{<td><pre>} (format "%12.3f KB" (div (file-info file 0) 1000)) {</pre></td></tr>}))
|
||||
(println {</table>})
|
||||
(exit)
|
||||
|
BIN
guiserver/images/info-down32.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
guiserver/images/info32.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
guiserver/images/new-down32.png
Normal file
After Width: | Height: | Size: 1.3 KiB |