The following samples work on the most recent release of Pocket Scheme. I will amend these as I find the time. (Every 1.2 sample should work on 1.3, too. I just haven't had time to test them all.)
I change the contents of this file from time to time. If one of the following samples fails, complaining of a reference to unbound variable, please refresh your copy of this file.
w32:host-topmost procedure, new in 1.3.
with-handlers facility.
letcc construct
used in many examples of The Seasoned Schemer.
The following samples work on Pocket Scheme 1.2, released in 2005.
I change the contents of this file from time to time. If one of the following samples fails, complaining of a reference to unbound variable, please refresh your copy of this file.
(load "cm17a.scm") (display "Turning on the cat's bed-warmer.") (newline) (firecracker-on "A1")
At the top of cm17a.scm I define two numeric values,
time-warmup and time-pulse,
which specify delays in milliseconds for warming up and holding
a pulse in the signal to the CM17A transmitter.
The greater the value of time-pulse,
the longer the CM17A will spend transmitting each bit of the signal,
making its RF transmission more robust.
Reducing this value to 1 will greatly speed operation,
but will reduce the radius of effective operation to point-blank range
(less than 7 meters).
Also, please remember that the synch cable for CE devices is a null-modem cable, wired as DCE instead of DTE. You will need a null-modem adapter, as opposed to a simple gender changer, if you plan to plug the CM17A into the DB9F at the distal end of the cable.
with-handlers facility.
letcc construct
used in many examples of The Seasoned Schemer.
The following samples work only on the previous five-year-old release of Pocket Scheme, version 1.1; I haven't yet finished porting them to 1.2. They will not work on the current release. I present them here only as partial examples.
Most of these samples were written for Windows CE.
Many of them will run on Windows NT or 2000 as well, either as-is
or after setting the variable *windows-ce* to #f.
To run them on 95, 98, or ME,
you may need to modify foreign procedure and structure imports
to reference narrow-character instead of wide-character entry points.
Usage: (SHOW-PLOT l),
where l is a list of the following plotting commands:
(ORIGIN x y) - offset the origin to the given Cartesian coordinates.
Default has the origin at the lower left hand corner, i.e. Quadrant I.
(ORIGIN CENTER) - offset the origin to the center of the plotting screen.
(SCALE k) - scale all coordinates by k.
(COLOR k) - draw in specified color.
k can be RED, BLUE, GREEN, or BLACK;
SOLID-RED, SOLID-BLUE, SOLID-GREEN, or SOLID-BLACK (synonyms of preceding);
HOLLOW-RED, HOLLOW-BLUE, HOLLOW-GREEN, or HOLLOW-BLACK.
The HOLLOW colors draw plotted circle and square-shaped points with a transparent interior;
all other colors draw solid circles and squares.
(COLOR (RGB r g b)) - draw in specified custom color,
where r, g, and b are intensity values
ranging from 0 to 255.
(SHAPE PIXEL) - plot points as single pixels.
(SHAPE CIRCLE r) - plot points as circles of radius r.
The circles may be hollow or solid.
(SHAPE SQUARE r) - plot points as squares of radius r.
The squares may be hollow or solid.
(x y) - plot a point
in the current shape and color
at the given Cartesian coordinates.
(LINE-WEIGHT k) - draw lines, boxes, and circles with a heavier stroke.
Default k is 1.
(LINE p0 p1 ...) - draw a line through each specified point.
Each point is pair of the form (x y),
specifying Cartesian coordinates.
The line drawn is not fitted, but rather connects each point.
Lines are drawn in the current weight and color.
(CIRCLE x y r) - draw a circle of radius r
at the given Cartesian coordinates.
The circle is hollow, but of the current color and line weight.
(SQUARE x y r) - draw a square of radius r
at the given Cartesian coordinates.
The circle is hollow, but of the current color and line weight.
Usage example:
(SHOW-PLOT '((ORIGIN CENTER) (SHAPE CIRCLE 3) (5 5) (5 -5) (-5 5) (-5 -5)))
As a code sample, this library demonstrates proper application behavior in the presence of the Palm-sized PC input panel. It could use some additional work for the Pocket PC.
clipboard->string
and string->clipboard,
rewritten to demonstrate use of the Pocket Scheme FFI.
Windows NT/2000/XP only.
Last modified: Sun Apr 02 15:35:37 Pacific Standard Time 2006
Copyright 2005, Ben Goetter. All rights reserved.