2005-07-21 03:45:34 -04:00
|
|
|
The Factor programming language
|
|
|
|
-------------------------------
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
This file covers installation and basic usage of the Factor
|
|
|
|
implementation. It is not an introduction to the language itself.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
* Contents
|
|
|
|
|
|
|
|
- Platform support
|
|
|
|
- Compiling Factor
|
|
|
|
- Building Factor
|
|
|
|
- Running Factor on Unix with X11
|
2006-10-14 00:48:59 -04:00
|
|
|
- Running Factor on Mac OS X - Cocoa UI
|
|
|
|
- Running Factor on Mac OS X - X11 UI
|
2006-07-09 15:57:34 -04:00
|
|
|
- Running Factor on Windows
|
2006-05-05 01:59:39 -04:00
|
|
|
- Source organization
|
|
|
|
- Community
|
|
|
|
- Credits
|
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
* Platform support
|
2004-09-01 21:04:16 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Factor is fully supported on the following platforms:
|
2004-09-01 21:04:16 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Linux/x86
|
2005-12-22 18:38:10 -05:00
|
|
|
Linux/AMD64
|
2006-07-07 00:07:18 -04:00
|
|
|
Mac OS X/x86
|
2005-07-21 03:45:34 -04:00
|
|
|
Mac OS X/PowerPC
|
2006-07-09 15:57:34 -04:00
|
|
|
MS Windows XP
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-12-22 18:38:10 -05:00
|
|
|
The following platforms should work, but are not tested on a
|
|
|
|
regular basis:
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-12-22 18:38:10 -05:00
|
|
|
FreeBSD/x86
|
|
|
|
FreeBSD/AMD64
|
2006-06-04 15:35:00 -04:00
|
|
|
Solaris/x86
|
2006-01-31 15:41:26 -05:00
|
|
|
Solaris/AMD64
|
2006-06-04 15:35:00 -04:00
|
|
|
Linux/PowerPC
|
2005-07-21 21:05:17 -04:00
|
|
|
|
2006-06-04 15:35:00 -04:00
|
|
|
Please donate time or hardware if you wish to see Factor running on
|
|
|
|
other platforms.
|
2006-01-18 14:16:43 -05:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
* Compiling Factor
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
The Factor runtime is written in C, and is built with GNU make and gcc.
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
Factor requires gcc 3.4 or later. On x86, it /will not/ build using gcc
|
|
|
|
3.3 or earlier.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Run 'make' (or 'gmake' on non-Linux platforms) with one of the following
|
|
|
|
parameters to build the Factor runtime:
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-07-07 00:07:18 -04:00
|
|
|
freebsd
|
|
|
|
linux-x86
|
|
|
|
linux-amd64
|
2005-07-21 03:45:34 -04:00
|
|
|
linux-ppc
|
2006-07-07 00:07:18 -04:00
|
|
|
macosx-x86
|
|
|
|
macosx-ppc
|
2006-01-31 15:41:26 -05:00
|
|
|
solaris
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
The following options can be given to make:
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
SITE_CFLAGS="..."
|
|
|
|
DEBUG=1
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
The former allows optimization flags to be specified, for example
|
2006-05-05 01:59:39 -04:00
|
|
|
"-march=pentium4 -ffast-math -O3". Nowadays most of the hard work is
|
|
|
|
done by Factor compiled code, so optimizing the runtime is not that
|
|
|
|
important. Usually the defaults are fine.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-01-18 14:16:43 -05:00
|
|
|
The DEBUG flag disables optimization and builds an executable with
|
2005-07-21 03:45:34 -04:00
|
|
|
debug symbols. This is probably only of interest to people intending to
|
|
|
|
hack on the runtime sources.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Compilation may print a handful of warnings about singled/unsigned
|
|
|
|
comparisons, and violated aliasing contracts. They may safely be
|
|
|
|
ignored.
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Compilation will yield an executable named 'f'.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
* Building Factor
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-10-19 21:03:58 -04:00
|
|
|
The boot images are no longer included with the Factor distribution
|
|
|
|
due to size concerns. Instead, download a boot image from:
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-10-19 21:03:58 -04:00
|
|
|
http://factorcode.org/images/0.85/
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Once you have compiled the Factor runtime, you must bootstrap the Factor
|
|
|
|
system using the image that corresponds to your CPU architecture.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-10-19 21:03:58 -04:00
|
|
|
Once you download the right image, bootstrap the system with the
|
|
|
|
following command line:
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
./f boot.image.<foo>
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Bootstrap can take a while, depending on your system. When the process
|
|
|
|
completes, a 'factor.image' file will be generated. Note that this image
|
|
|
|
is both CPU and OS-specific, so in general cannot be shared between
|
|
|
|
machines.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
* Running Factor on Unix with X11
|
|
|
|
|
|
|
|
On Unix, Factor can either run a graphical user interface using X11, or
|
|
|
|
a terminal listener.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
If your DISPLAY environment variable is set, the UI will start
|
|
|
|
automatically:
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
./f factor.image
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
To run an interactive terminal listener:
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
./f factor.image -shell=tty
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
If you're inside a terminal session, you can start the UI with one of
|
|
|
|
the following two commands:
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
ui
|
|
|
|
[ ui ] in-thread
|
|
|
|
|
|
|
|
The latter keeps the terminal listener running.
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2006-10-14 00:48:59 -04:00
|
|
|
* Running Factor on Mac OS X - Cocoa UI
|
2006-05-04 23:20:21 -04:00
|
|
|
|
2006-10-14 00:48:59 -04:00
|
|
|
On Mac OS X 10.4 and later, a Cocoa UI is available in addition to the
|
|
|
|
terminal listener. If you are using Mac OS X 10.3, you can only run the
|
|
|
|
X11 UI, as documented in the next section.
|
2006-05-04 23:20:21 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
The 'f' executable runs the terminal listener:
|
2006-05-04 23:20:21 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
./f factor.image
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
The Cocoa UI requires that after bootstrapping you build the Factor.app
|
|
|
|
application bundle:
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
make macosx.app
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-05-05 01:59:39 -04:00
|
|
|
This copies the runtime executable, factor.image (which must exist at
|
|
|
|
this point), and the library source into a self-contained Factor.app.
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-10-14 00:48:59 -04:00
|
|
|
* Running Factor on Mac OS X - X11 UI
|
|
|
|
|
|
|
|
The X11 UI is available on Mac OS X, however its use is not recommended
|
|
|
|
since it does not integrate with the host OS. However, if you are
|
|
|
|
running Mac OS X 10.3, it is your only choice.
|
|
|
|
|
|
|
|
When compiling Factor, pass the X11=1 parameter:
|
|
|
|
|
|
|
|
make macosx-ppc X11=1
|
|
|
|
|
|
|
|
Then bootstrap with the following pair of switches:
|
|
|
|
|
|
|
|
./f boot.image.ppc -no-cocoa -x11
|
|
|
|
|
|
|
|
Now if $DISPLAY is set, running ./f will start the UI.
|
|
|
|
|
2006-07-09 15:57:34 -04:00
|
|
|
* Running Factor on Windows
|
|
|
|
|
|
|
|
If you did not download the binary package, you can bootstrap Factor in
|
|
|
|
the command prompt:
|
|
|
|
|
|
|
|
f.exe boot.image.pentium4 (or boot.image.x86)
|
|
|
|
|
2006-11-24 16:42:36 -05:00
|
|
|
Once bootstrapped, double-clicking f.exe starts the Factor UI.
|
|
|
|
|
|
|
|
To run the listener in the command prompt:
|
|
|
|
|
|
|
|
f.exe -shell=tty
|
2006-07-09 15:57:34 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
* Source organization
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2006-11-29 15:17:49 -05:00
|
|
|
The following four directories are managed by the module system; consult
|
|
|
|
the documentation for details:
|
|
|
|
|
|
|
|
apps/ - user-contributed applications
|
|
|
|
libs/ - user-contributed libraries
|
|
|
|
demos/ - small examples illustrating various language features
|
|
|
|
core/ - sources for the library, written in Factor
|
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
fonts/ - TrueType fonts used by UI
|
2006-06-06 19:56:43 -04:00
|
|
|
vm/ - sources for the Factor runtime, written in C
|
2004-08-27 02:09:24 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
* Community
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-12-22 18:38:10 -05:00
|
|
|
The Factor homepage is located at http://factorcode.org/.
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Factor developers meet in the #concatenative channel on the
|
|
|
|
irc.freenode.net server. Drop by if you want to discuss anything related
|
|
|
|
to Factor or language design in general.
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-12-22 18:38:10 -05:00
|
|
|
* Credits
|
|
|
|
|
|
|
|
The following people have contributed code to the Factor core:
|
|
|
|
|
|
|
|
Slava Pestov: Lead developer
|
|
|
|
Alex Chapman: OpenGL binding
|
2006-06-04 15:35:00 -04:00
|
|
|
Doug Coleman: Mersenne Twister RNG, Windows port
|
|
|
|
Eduardo Cavazos: X11 binding
|
2006-07-07 03:46:05 -04:00
|
|
|
Joshua Grams: PowerPC instruction cache flush code
|
2005-12-22 18:38:10 -05:00
|
|
|
Mackenzie Straight: Windows port
|
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
Have fun!
|
2004-09-14 23:23:05 -04:00
|
|
|
|
2005-07-21 03:45:34 -04:00
|
|
|
:tabSize=2:indentSize=2:noTabs=true:
|