racket/collects/mzscheme/examples
2011-07-02 10:37:53 -04:00
..
bitmatrix.c Fixes more spelling errors. 2011-02-04 19:44:13 -07:00
catch.c A lot of "MzScheme" -> "Racket"s. 2010-05-16 18:26:26 -04:00
cfile.rkt A lot of "MzScheme" -> "Racket"s. 2010-05-16 18:26:26 -04:00
curses-demo.rkt ".ss" -> ".rkt" scan done. 2011-07-02 10:37:53 -04:00
curses.c A lot of "MzScheme" -> "Racket"s. 2010-05-16 18:26:26 -04:00
fmod-ez.rkt rename all files .ss -> .rkt 2010-04-27 16:50:15 -06:00
fmod.c A lot of "MzScheme" -> "Racket"s. 2010-05-16 18:26:26 -04:00
hello.c A lot of "MzScheme" -> "Racket"s. 2010-05-16 18:26:26 -04:00
helloprint.c updated for mzc --xform 2005-10-04 19:47:02 +00:00
idmodule.c Adding collects, with all the right properties (except eoln-style). 2005-05-27 18:56:37 +00:00
makeadder.c Adding collects, with all the right properties (except eoln-style). 2005-05-27 18:56:37 +00:00
makeadder3m.c 369.4 2007-01-12 07:09:56 +00:00
msgbox.rkt ".ss" -> ".rkt" scan done. 2011-07-02 10:37:53 -04:00
README Fixed various spelling errors. 2011-02-03 17:42:33 -05:00
tree-finish.rkt rename all files .ss -> .rkt 2010-04-27 16:50:15 -06:00
tree.cxx A lot of "MrEd" -> "GRacket"s. 2010-05-16 23:46:05 -04:00

This directory contains a few example Racket extensions. Most
examples are implemented directly in C. A few examples listed at the
end use the mzc `c-lambda', etc. forms.

 * hello.c - returns the string "Hello, World!". Demonstrates creating
   a Scheme value.

 * fmod.c - defines the `fmod' procedure, which calculates modulo on
   floating-point numbers. Demonstrates creating Scheme procedures
   from C and adding top-level definitions. (Manually instrumented for
   3m, so do not use `mzc --xform'.)

 * curses.c - links Racket to the curses library. Demonstrates more
   procedures and definitions, a little more type dispatching, and
   returning multiple values. (Manually instrumented for 3m, so do not
   use `mzc --xform'.)

 * makeadder.c - defines `make-adder', which takes a number and
   returns a procedure that takes another number to add to
   it. Demonstrates closure creation in C, getting Scheme global
   values, and calling Scheme procedures from C.

   makeadder3m.c - the same, but manually instrumented 3m (so do not
   use `mzc --xform'). Making the code work with 3m requires several
   changes, but `mzc --xform' works on "makeadder.c" without changes.

 * catch.c - defined `eval-string/catch-error', which catches
   exceptions while evaluating a string. Demonstrates how to catch
   exceptions from C code.

 * bitmatrix.c - implements two-dimensional bit matrixes with some
   operations. Demonstrates defining a new Scheme data type, data
   allocation, fancy integer type checking, general exception raising,
   and registering static variables. Also demonstrates supplying
   traversal functions for 3m (but still needs `mzc --xform'
   preprocessing to build for 3m).

 * idmodule.c - Declares the module named `idmodule' that provides an
   `identity' function. Demonstrates implementing a primitive module
   in C.

 * helloprint.c - prints "Hello, World!" directly to the current
   output port rather than relying on the read-eval-print-loop.
   Demonstrates using built-in Scheme parameter values from C.

 * tree.cxx, tree-finish.ss - shows how to inject a C++ class into
   MzLib's class.ss world. (Does not work with 3m.)


 * fmod-ez.ss - same as fmod.c, but with 10% of the code. Demonstrates
   `c-lambda'.

 * cfile.ss - simple (and unsafe) glue to the fopen(), fread(),
   fwrite(), and fclose() C library functions. Demonstrates the use of
   `(pointer ...)' types. Technically, this example is broken for 3m,
   because fclose() frees the FILE* pointer, and it's possible that
   the GC will later try to use the same memory.

 * msgbox.ss - a Windows-only example, provides a `message-box'
   procedure. Demonstrates some of the limitations of `c-lambda' and
   how to work around them.