/usr/share/gnu-smalltalk/examples/README is in gnu-smalltalk-common 3.2.5-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | This directory contains some example GNU Smalltalk programs.
The programs are:
bench.st An extraordinarily precise low-level benchmark for Smalltalk,
by His Majesty contributed by Dwight Hughes and originarily prepared for
Dan Ingalls! Squeak. It executes two pieces of code and deduces the
system's speed in terms of bytecodes/second on bytecode-heavy
code (arithmetics - sieve in this case) and sends/second on
send-heavy code (a recursive Fibonacci computation in this
case) -- they usually coincide to two digits with the speeds
given by the GST runtime!
CairoBlit.st A simple example of the Cairo and SDL bindings.
by tonyg
Case.st A nice object for C-switch like behavior. Although it is slower
by Ulf than compiler-optimized ifs, try it: it really works nice.
Dambacher
CStream.st A stream providing functionality for writing C code.
by sbb
Dinner.st The classic dining philosophers problem. You need working
by me Delays to try this (alarm is not very good but maybe it works).
Try `(Philosophers new: 5) dine'.
EditStream.st A stream handling fast insertions, using a double buffer
by Ulf with a gap between the buffers.
Dambacher
LazyCollection.st Implementation of #collect:, #select:, #reject: that do not
by me create a new collection unless really necessary.
Sync.st Many kinds of synchronization devices.
by me
GenClasses.st Provides help in creating many similarly named classes.
by sbb
Lisp.st A nice Lisp interpreter class; try "LispInterpreter
by Aoki Atsushi exampleXX" with XX going from 01 to 18. I modified it
Nishihara Satoshi to remove the Smalltalk-subset compiler that was needed
on proprietary systems that don't allow a compiler
to be enclosed in a run-time image -- it was 25%
of the total code; this way there is more focus
on the Lisp stuff.
MemUsage.st This is really more of a test suite kind of program. It
by sbb iterates through all the objects in the system, counting
up how much storage has been used by each, and printing a
total at the end. It has found more bugs in the memory
management system than I (sbb) care to admit.
Methods.st Examples of subclassing CompiledMethod... 'nuff said!
by Ian Piumarta
and me
MiniDebugger.st A simplified debugger which shows how to use the single step
by me primitives to implement an interface that vaguely resembles
gdb.
PackageBuilder.st A simple script to make package.xml file from a Smalltalk
by Stefan Schmiedl description. You may find it useful!
Prolog.st This is absolutely stunning! A Prolog interpreter written in
by Aoki Atsushi Smalltalk, from the same author as the Lisp interpreter; try
Nishihara Satoshi PrologInterpreter exampleXX with XX going from 01 to
06
PrtHier.st prints out the class hierarchy, indented according to
by sbb the number of super classes a class has.
Publish.st An object-oriented, multiple format class file-out system.
by me/sbb Currently includes Postscript for file-outs, and HTML/Texinfo
for documentation -- by the way, this example is used by the
makefile for GNU Smalltalk's info files. And also an example
of namespaces.
PushBack.st A Stream with unlimited push-back capabilities. Together with
by sbb Tokenizer.st, it is used in many places (C interface, compiler)
Queens.st An elegant solution of the queens and amazons problem (amazons
by me can move like either the queen or the knight). There are:
2 solutions (1 discarding rotations/reflections) on a 4x4 board
92 solutions (12) on a 8x8 board
no solutions (!) to the amazons problem on a 8x8 board
4 solutions (1) to the amazons problem on a 10x10 board
A few examples usages are at the end of the file.
Richards.st The Richards benchmark (a simulation of an operating systems)
by unknown under Smalltalk, a classic in Smalltalk benchmarking because of
its use of polymorphism and OO.
shell An example of how to make a Smalltalk script work both if you
by Alexander file it in from GNU Smalltalk and if you launch it from the
Lazarevic shell; for it to work, the gst executable must be in the path.
If it is not, just do PATH=$PATH:<gst path> before running it.
SortCriter.st A very nice object that allows you to easily create
by Peter SortedCollections sorted using complex objects (specifying
William Lount which fields are more important and which must be sorted in
descending order).
Tokenizer.st An abstract base class for lexical analyzers.
by me/sbb
TokenStream.st Formerly a part of the class hierarchy. Now replaced with
by sbb CharacterArray>>#subStrings.
Generator.st Python/Ruby-like generators, using continuations.
Gen2.st Same, using contexts (slower).
Gen3.st Same, using processes (in the middle).
by me
The directory also contains some bindings for external libraries; currently
these are GDBM, ZLib and MD5 bindings.
The directory also contains two examples of using Blox:
Man.st Man page viewer widget (example of using BExtended). To test
by me it evaluate "ManViewer openOn: 'path' ".
Tetris.st A Tetris game written using BLOX. To start it, use
by me "Tetris play". Cursor keys move the piece, Up rotates it,
Return drops it.
More examples can be found in the blox/BloxExtend.st and blox/test.st file
In addition, this directory contains two scripts that can help converting
from other Smalltalk source code formats to the traditional file in (chunk)
format. These are:
- `pepe.sed', that converts from the Pepe format, a portable format consisting
exclusively of executable code (an example is in tests/ansi/ansi.pepe; this
script can be slow.
- `xml.sed', that converts from an XML DTD designed for Smalltalk source. This
script does not convert `statics' (that's how the DTD calls class variables)
yet. Requires GNU sed.
The `unsupported/misc' directory contains some other small example GNU
Smalltalk programs which test more advanced aspects of Smalltalk, either
various packages or the VM. Among others, `torture.st' is Andreas Klimas'
nice memory torture test program - like MemUsage.st it has found more bugs
in the memory management system than I care to admit...
Paolo Bonzini
|