MixMasterDoc.tioga
Michael Plass, September 25, 1989 2:46:00 pm PDT
MixMaster
PCedar 2.0 — FOR INTERNAL XEROX USE ONLY
MixMaster
An aid for generating stubs for access to Cedar functionality from Cedar Scheme
Michael Plass
© Copyright 1989 Xerox Corporation. All rights reserved.
Abstract: Writing Cedar code to register new Scheme primitives is a drag. This program provides some automation for this process, by mechanically generating a lot of the boring Cedar code that registers new Scheme primitives.
Created by: Michael Plass
Maintained by: Michael Plass <Plass.pa>
Keywords: Scheme, Programming Tools, Compiler, Translator, Tioga
XEROX Xerox Corporation
Palo Alto Research Center
3333 Coyote Hill Road
Palo Alto, California 94304
For Internal Xerox Use Only
1. MixMaster.mx
Refer to MixMaster.mx for documentation concerning the format of .mx files. Note that .mx files must be Tioga documents, and the Tioga formats on the nodes are significant. To make the .mx files readable, use the tioga style "MixMaster". To get a quick start, say
% Form MixMaster
2. Running it
The command
% MixMaster Foo.mx
will read Foo.mx and write Foo.scheme and FooMXCode.mesa, and attempt to compile them to produce Foo.$cheme and FooMXCode.bcd.
You may want to punt the Tidbit-compiled FooSchemeCode* if it is trivial.
3. Example
MixMaster.mx is also an example of the input format. (Ain't bootstrapping fun?) A simpler example would be nice. Here is another one that builds stubs for a few ViewerOps calls, and defines a Scheme procdure that changes a viewer's column a lot.
--------------------- begin example - remember to apply MixMaster.style if you put this in a file ---------------------
ViewerFun.mx
Copyright Ó 1989 by Xerox Corporation. All rights reserved.
Created by Michael Plass, January 27, 1989 2:00:01 pm PST
Documentation
A simple test
Cedar Primitives
(cedar-imports "ViewerOps")
(cedar-directory "Rope" "Ascii" "ViewerClasses")
(define-ref-type "ViewerClasses" "Viewer")
(define-rep-type "ViewerClasses" "ViewerRec")
(define-enum-type "ViewerClasses" "Column" (static left right color))
(
define-proc (
viewer-find name-string)
"Finds a viewer with the given name"
result ← ViewerOps.FindViewer[RopeFromString[TheString[nameString]]];
IF result = NIL THEN result ← false;
)
(
define-proc (
viewer-change-column viewer col)
"Move viewer to another column"
ViewerOps.ChangeColumn[TheViewer[viewer], TheColumn[col]];
)
(
define-proc (
viewer-column viewer)
"returns the column name of the viewer"
result ← SymbolForColumn[TheViewer[viewer].column];
)
Scheme Code
(define (what-fun foo n)
(define v (viewer-find foo))
(let loop ((n n))
(when (positive? n)
(viewer-change-column v 'left)
(viewer-change-column v 'right)
(loop (- n 1))
)
)
)
--------------------- end example ---------------------