Updated readme, fixed documentation typo, better no-method error reporting
parent
f808f659b5
commit
ade9b3333c
107
README.txt
107
README.txt
|
|
@ -4,6 +4,19 @@ The Factor programming language
|
||||||
This file covers installation and basic usage of the Factor
|
This file covers installation and basic usage of the Factor
|
||||||
implementation. It is not an introduction to the language itself.
|
implementation. It is not an introduction to the language itself.
|
||||||
|
|
||||||
|
* Contents
|
||||||
|
|
||||||
|
- Platform support
|
||||||
|
- Compiling Factor
|
||||||
|
- Building Factor
|
||||||
|
- Running Factor on Unix with X11
|
||||||
|
- Running Factor on Mac OS X
|
||||||
|
- Running Factor on Windows
|
||||||
|
- Source organization
|
||||||
|
- Learning Factor
|
||||||
|
- Community
|
||||||
|
- Credits
|
||||||
|
|
||||||
* Platform support
|
* Platform support
|
||||||
|
|
||||||
Factor is fully supported on the following platforms:
|
Factor is fully supported on the following platforms:
|
||||||
|
|
@ -28,9 +41,8 @@ Other platforms are not supported.
|
||||||
|
|
||||||
The Factor runtime is written in C, and is built with GNU make and gcc.
|
The Factor runtime is written in C, and is built with GNU make and gcc.
|
||||||
|
|
||||||
Note that on x86 systems, Factor _cannot_ be compiled with gcc 3.3. This
|
Factor requires gcc 3.4 or later. On x86, it /will not/ build using gcc
|
||||||
is due to a bug in gcc and there is nothing we can do about it. Please
|
3.3 or earlier.
|
||||||
use gcc 2.95, 3.4, or 4.0.
|
|
||||||
|
|
||||||
Run 'make' (or 'gmake' on non-Linux platforms) with one of the following
|
Run 'make' (or 'gmake' on non-Linux platforms) with one of the following
|
||||||
parameters to build the Factor runtime:
|
parameters to build the Factor runtime:
|
||||||
|
|
@ -48,9 +60,9 @@ The following options can be given to make:
|
||||||
DEBUG=1
|
DEBUG=1
|
||||||
|
|
||||||
The former allows optimization flags to be specified, for example
|
The former allows optimization flags to be specified, for example
|
||||||
"-march=pentium4 -ffast-math -O3". Optimization flags can make a *huge*
|
"-march=pentium4 -ffast-math -O3". Nowadays most of the hard work is
|
||||||
difference in Factor's performance, so willing hackers should
|
done by Factor compiled code, so optimizing the runtime is not that
|
||||||
experiment.
|
important. Usually the defaults are fine.
|
||||||
|
|
||||||
The DEBUG flag disables optimization and builds an executable with
|
The DEBUG flag disables optimization and builds an executable with
|
||||||
debug symbols. This is probably only of interest to people intending to
|
debug symbols. This is probably only of interest to people intending to
|
||||||
|
|
@ -85,80 +97,69 @@ 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
|
is both CPU and OS-specific, so in general cannot be shared between
|
||||||
machines.
|
machines.
|
||||||
|
|
||||||
* Running Factor
|
* Running Factor on Unix with X11
|
||||||
|
|
||||||
To run the Factor system, issue the following command:
|
On Unix, Factor can either run a graphical user interface using X11, or
|
||||||
|
a terminal listener.
|
||||||
|
|
||||||
|
If your DISPLAY environment variable is set, the UI will start
|
||||||
|
automatically:
|
||||||
|
|
||||||
./f factor.image
|
./f factor.image
|
||||||
|
|
||||||
This will start the interactive listener where Factor expressions may
|
To run an interactive terminal listener:
|
||||||
be entered.
|
|
||||||
|
|
||||||
To run the graphical user interface on non-Mac OS X systems, issue the
|
./f factor.image -shell=tty
|
||||||
following command:
|
|
||||||
|
|
||||||
./f factor.image -shell=ui
|
If you're inside a terminal session, you can start the UI with one of
|
||||||
|
the following two commands:
|
||||||
|
|
||||||
Note that on Windows, this is the default.
|
ui
|
||||||
|
[ ui ] in-thread
|
||||||
|
|
||||||
To prepare to run the GUI on Mac OS X, issue the following command:
|
The latter keeps the terminal listener running.
|
||||||
|
|
||||||
|
* Running Factor on Mac OS X
|
||||||
|
|
||||||
|
On Mac OS X, a Cocoa UI is available in addition to the terminal
|
||||||
|
listener.
|
||||||
|
|
||||||
|
The 'f' executable runs the terminal listener:
|
||||||
|
|
||||||
|
./f factor.image
|
||||||
|
|
||||||
|
The Cocoa UI requires that after bootstrapping you build the Factor.app
|
||||||
|
application bundle:
|
||||||
|
|
||||||
make macosx.app
|
make macosx.app
|
||||||
|
|
||||||
once after bootstrapping, then double-click the Factor application to
|
This copies the runtime executable, factor.image (which must exist at
|
||||||
run it.
|
this point), and the library source into a self-contained Factor.app.
|
||||||
|
|
||||||
On Unix, this might fail if the SDL libraries are not installed, or are
|
Factor.app runs the UI when double-clicked and can be transported
|
||||||
installed under unconventional names. This can be solved by explicitly
|
between PowerPC Macs.
|
||||||
naming the libraries during bootstrap, as in the next section.
|
|
||||||
|
|
||||||
* Setting up SDL libraries for use with Factor
|
* Running Factor on Windows
|
||||||
|
|
||||||
The Windows binary package for Factor includes all prerequisite DLLs.
|
On Windows, double-clicking f.exe will start running the Win32-based UI
|
||||||
On Unix, you need recent versions of SDL and FreeType.
|
with the factor.image in the same directory as the executable.
|
||||||
|
|
||||||
If you have installed these libraries but the UI still fails with an
|
Bootstrap runs in a Windows command prompt, however after bootstrapping
|
||||||
error, you will need to find out the exact names that they are installed
|
only the UI can be used.
|
||||||
as, and issue a command similar to the following to bootstrap Factor:
|
|
||||||
|
|
||||||
./f boot.image.<foo> -libraries:sdl:name=libSDL-1.2.so
|
|
||||||
-libraries:freetype:name=libfreetype.so
|
|
||||||
|
|
||||||
* Source organization
|
* Source organization
|
||||||
|
|
||||||
doc/ - the developer's handbook, and various other bits and pieces
|
doc/ - the developer's handbook, and various other bits and pieces
|
||||||
native/ - sources for the Factor runtime, written in C
|
native/ - sources for the Factor runtime, written in C
|
||||||
library/ - sources for the library, written in Factor
|
library/ - sources for the library, written in Factor
|
||||||
alien/ - C library interface
|
|
||||||
bootstrap/ - code for generating boot images
|
|
||||||
cocoa/ - Mac OS X Cocoa API and Objective-C runtime binding
|
|
||||||
collections/ - data types including but not limited to lists,
|
|
||||||
vectors, hashtables, and operations on them
|
|
||||||
compiler/ - optimizing native compiler
|
|
||||||
freetype/ - FreeType binding, rendering glyphs to OpenGL textures
|
|
||||||
generic/ - generic words, for object oriented programming style
|
|
||||||
help/ - online help system
|
|
||||||
inference/ - stack effect inference, used by compiler, as well as a
|
|
||||||
useful development tool of its own
|
|
||||||
io/ - input and output streams
|
|
||||||
math/ - integers, ratios, floats, complex numbers, vectors, matrices
|
|
||||||
opengl/ - OpenGL graphics library binding
|
|
||||||
syntax/ - parser and object prettyprinter
|
|
||||||
test/ - unit test framework and test suite
|
|
||||||
tools/ - interactive development tools
|
|
||||||
ui/ - UI framework
|
|
||||||
unix/ - Unix-specific I/O code
|
|
||||||
win32/ - Windows-specific I/O code
|
|
||||||
contrib/ - various handy libraries not part of the core
|
contrib/ - various handy libraries not part of the core
|
||||||
examples/ - small examples illustrating various language features
|
examples/ - small examples illustrating various language features
|
||||||
fonts/ - TrueType fonts used by UI
|
fonts/ - TrueType fonts used by UI
|
||||||
|
|
||||||
* Learning Factor
|
* Learning Factor
|
||||||
|
|
||||||
The UI has a simple tutorial that will show you the most basic concepts.
|
The UI has a tutorial and defailed reference documentation. You can
|
||||||
|
browse it in the UI or by running the HTTP server (contrib/httpd).
|
||||||
There is a detailed language and library reference available at
|
|
||||||
http://factorcode.org/handbook.pdf.
|
|
||||||
|
|
||||||
You can browse the source code; it is organized into small,
|
You can browse the source code; it is organized into small,
|
||||||
well-commented files and should be easy to follow once you have a good
|
well-commented files and should be easy to follow once you have a good
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ HELP: memq? "( obj seq -- ? )"
|
||||||
}
|
}
|
||||||
{ $see-also index index* member? } ;
|
{ $see-also index index* member? } ;
|
||||||
|
|
||||||
HELP: remove "( elt seq -- ? )"
|
HELP: remove "( elt seq -- newseq )"
|
||||||
{ $values { "elt" "an object" } { "seq" "a sequence" } }
|
{ $values { "elt" "an object" } { "seq" "a sequence" } { "newseq" "a new sequence" } }
|
||||||
{ $description "Outputs a new sequence containing all elements of the input sequence except those equal to the given element." } ;
|
{ $description "Outputs a new sequence containing all elements of the input sequence except those equal to the given element." } ;
|
||||||
|
|
||||||
HELP: subst "( newseq oldseq seq -- )"
|
HELP: subst "( newseq oldseq seq -- )"
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,17 @@ M: kernel-error error. ( error -- )
|
||||||
[ objc-error. ]
|
[ objc-error. ]
|
||||||
} dispatch ;
|
} dispatch ;
|
||||||
|
|
||||||
M: no-method summary drop "No suitable method" ;
|
M: no-method summary
|
||||||
|
"No suitable method" ;
|
||||||
|
|
||||||
|
M: no-method error. ( error -- )
|
||||||
|
"Generic word " write
|
||||||
|
dup no-method-generic pprint
|
||||||
|
" does not define a method for the " write
|
||||||
|
dup no-method-object class pprint
|
||||||
|
" class." print
|
||||||
|
"Allowed classes: " write dup no-method-generic order .
|
||||||
|
"Dispatching on object: " write no-method-object short. ;
|
||||||
|
|
||||||
M: no-math-method summary drop "No suitable arithmetic method" ;
|
M: no-math-method summary drop "No suitable arithmetic method" ;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue