(Magic Utilities of September 26, 1981 12:00 PM)/print

(
magic)(magicdict /begin).cvx .def
(cif)(magic).load .def

(magicdict).where
(.pop).cvx
((magicdict)256 .dict .def).cvx
.ifelse

magicdict .begin

(begin)
(jamrun magicrun .eq .not
((CIF.bcd).loadbcd
loadstipples
(draw)(drawscreen).cvx .def
(outlinemode).false .def
(magicrun)jamrun .def
(Init.cif)readcif reset
).cvx
.if
(Magic)/print
).cvx .def

(magicrun)0 .def

(
.reddown)(2 .copy 4 trackbox).cvx .def
(
.redup)
(4 .copy .pop .exch .pop .lt
(expand).cvx
(contract).cvx
.ifelse
draw .displayon
).cvx .def

(
.yellowdown)().cvx .def
(
.yellowup)(scroll draw .displayon).cvx .def

(
.bluedown)(2 .copy 1 trackbox).cvx .def
(
.blueup)
(setclipregion draw .displayon
).cvx .def

(
fit)(boundbox expand).cvx .def

(
clipfit)(fit boundbox setclipregion).cvx .def

(
atorigin)(boundbox .pop .pop getclipregion .pop .pop scroll).cvx .def

(
scrollto)
(getclipregion
3 -1 .roll .add 2 .div
3 1 .roll .add 2 .div
.exch scroll draw .displayon
).cvx .def

(
readcif)
(parsecif
(fit).cvx
.if
).cvx .def

(
readic)
(parseic
(fit).cvx
.if
).cvx .def

(
clear)
(endcif erase
).cvx .def

(
reset)
(clear unoutline screen
).cvx .def

(
show)
(Show log file. Expects name of log file)
(1 .bytestream (logstream) .exch .def
more).cvx /def

(
more)
(Resume showing log file. No parameters)
( logstream .type (.streamtype) .eq
( (logstream showone .not
((No more errors)/print
(logstream)(none).def .exit
).cvx
.if
( More? ).print
.mystream .readline .pop .dup .length 0 .eq
(.pop).cvx
(0 1 .substring (n) .eq
(.exit).cvx
.if
).cvx
.ifelse
).cvx .loop
).cvx
((No more errors)/print).cvx
.ifelse
).cvx /def

(logstream)(none).def

(showone)
(.token
(.exch .token .pop .exch .readline .pop
.print scrollto
.true
).cvx
(.false).cvx
.ifelse
).cvx .def


(
screen)
(screen - no parameters. output = draw
)
((screen)select loadstipples
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
.displayon
).cvx /def

(
press)
(selection: <pages down><pages across> press
output: <1st page row><1st page column>
<last page row><last page column><filename> output
)
(jamrun pressrun .eq .not
((CIFPress.bcd).loadbcd
(pressrun)jamrun .def
).cvx
.if
(press)select loadcolors
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
draw .displayon
).cvx /def
(pressrun)0 .def

(
versatec)
(selection: <strips> versatec
output: <1st strip><last strip><filename> output
)
(jamrun versatecrun .eq .not
((CIFVersatec.bcd).loadbcd
(versatecrun)jamrun .def
).cvx
.if
.dup (versatec)select loadstipples
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
1 .eq .not (draw).cvx .if
.displayon
).cvx /def
(versatecrun)0 .def

(
ramtek)
(selection: <strips> ramtek
output: <1st strip><last strip><filename> output
)
(jamrun ramtekrun .eq .not
((CIFRamtek.bcd).loadbcd
(ramtekrun)jamrun .def
).cvx
.if
.dup (ramtek)select loadstipples
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
1 .eq .not (draw).cvx .if
.displayon
).cvx /def
(ramtekrun)0 .def

(
extractor)
(selection: extractor
output: <filename> output
)
(jamrun extractorrun .eq .not
((CIFExtractor.bcd).loadbcd
(extractorrun)jamrun .def
).cvx
.if
(extractor)select
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
.displayon
).cvx /def
(extractorrun)0 .def

(
drc)
(selection: drc
output: <filename> output
)
(jamrun drcrun .eq .not
((CIFDRC.bcd).loadbcd
(drcrun)jamrun .def
).cvx
.if
(drc)select
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
.displayon
).cvx /def
(drcrun)0 .def

(
reticle)
(selection: reticle
output: <filename> output
)
(jamrun reticlerun .eq .not
((CIFReticle.bcd).loadbcd
(reticlerun)jamrun .def
).cvx
.if
(reticle)select
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
.displayon
).cvx /def
(reticlerun)0 .def

(
mann)
(selection: <units> mann <units> := english|metric
output: <filename> output
)
(jamrun mannrun .eq .not
((CIFMann.bcd).loadbcd
(mannrun)jamrun .def
).cvx
.if
(mann)select
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
.displayon
).cvx /def
(mannrun)0 .def
(metric)0 .def
(english)1 .def

(
manntocif)
(<filename> manntocif
)
(jamrun manntocifrun .eq .not
((ManntoCIF.bcd).loadbcd
(manntocifrun)jamrun .def
).cvx
.if
mtoc
).cvx /def
(manntocifrun)0 .def

(
cif)
(selection: cif
output: <symbols><filename> output <symbols> := all|called
)
(jamrun cifrun .eq .not
((CIFCIF.bcd).loadbcd
(cifrun)jamrun .def
).cvx
.if
(cif)select
outlinemode (savedraw) (draw) .ifelse (drawscreen).cvx .def
.displayon
).cvx /def
(cifrun)0 .def
(all).true .def
(called).false .def

(
erc)
(<filename><lowlimit><highlimit> erc
)
(jamrun ercrun .eq .not
((MagicERC.bcd).loadbcd
(ercrun)jamrun .def
).cvx
.if
static
).cvx /def
(ercrun)0 .def


(stippledict)100 .dict .def

(
setstipple)
(<layername><array or string of g0 g1 g2 g3> setstipple
)
(2 .copy stippledict 3 1 .roll .put
.cvx .exec loadstipple
).cvx /def

(loadstipples)(stippledict (.cvx .exec loadstipple).cvx .dictforall).cvx .def


(colordict)100 .dict .def

(
setcolor)
(<layername><array or string of hue sat bri> setcolor
)
(2 .copy colordict 3 1 .roll .put
.cvx .exec loadcolor
).cvx /def

(loadcolors)(colordict (.cvx .exec loadcolor).cvx .dictforall).cvx .def

(
draw)(drawscreen).cvx .def
(outlinemode).false .def

(
outline)
(outlinemode .not
((savedraw)(draw).load .def
(draw)(erase boundbox drawboxarea drawframe).cvx .def
(outlinemode).true .def
).cvx
.if
).cvx .def

(
unoutline)
(outlinemode
((draw)(savedraw).load .def
(outlinemode).false .def
).cvx
.if
).cvx .def

(initnames)(6 .bytestream (namestream).exch .def).cvx .def
(name)(namedict .begin).cvx .def
(finishnames)(namestream .killstream).cvx .def
(namedict) 10 .dict .def
namedict .begin
(.reddown)
(3 .copy .moveto .drawstring
3 -1 .roll outname
.exch .cvi .cvs outname
.cvi .cvs outname
(
)outname
).cvx .def

(.redup)(.pop .pop .end).cvx .def

(outname)
(namestream ( ).writebytes
namestream .exch .writebytes
).cvx .def
.end

(.prompt)(.displayon (#).print).cvx .def

.end

()/print

magic