[CM] plotter on MCL 5.0 and OSX 10.3.2

Bret Battey bbattey@u.washington.edu
Sat, 3 Jan 2004 14:18:58 -0800


--Apple-Mail-5-371858278
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

Regarding the gnuplot output, you might be speaking of Orm Finnedahl 
who posted some gnuplot examples on this list a few months pack 
(finnendahl@folkwang-hochschule.de).

Also, in CLM's DLOCSIG there is some plotter code for exporting to 
gnuplot (in fact, I usually commented this out since it had name 
conflicts with Rick's plotter utils)

Problem in MCL 5.0 is that it doesn't have a (shell ...) directive!!!! 
(what were/are they thinking?) So the code examples mentioned above 
won't work, as they use shell directives to send commands to gnuplot. I 
did find a shell command that works in MCL 5.0 though: bsd.lisp by 
Brendan Burns. I've enclosed the file.


--Apple-Mail-5-371858278
Content-Type: multipart/appledouble;
	boundary=Apple-Mail-6-371858279
Content-Disposition: attachment


--Apple-Mail-6-371858279
Content-Transfer-Encoding: base64
Content-Type: application/applefile;
	name="bsd.lisp"
Content-Disposition: attachment;
	filename=bsd.lisp

AAUWBwACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAJAAAAPgAAAAoAAAADAAAASAAAAAgAAAACAAAA
UAAAAX5URVhUUipjaAAAYnNkLmxpc3AAAAEAAAABTAAAAEwAAAAyAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAJ
TW9uYWNvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAEAGEAGANPApIAYQAYA08Ckrut9wIA
AHQKAAB0CgAAAAABAAAAAQAAAAFMAAAATAAAADIAEoCEHeEAAAAcADIAAE1QU1IAAAAKA+3//wAA
AAAA5Tqo

--Apple-Mail-6-371858279
Content-Transfer-Encoding: quoted-printable
Content-Type: application/text;
	x-mac-type=54455854;
	x-unix-mode=0644;
	x-mac-creator=522A6368;
	name="bsd.lisp"
Content-Disposition: attachment;
	filename=bsd.lisp

;;=20bsd.lisp=0D;;=20access=20to=20the=20BSD=20internals=20of=20Darwin=20=
for=20MCL=0D;;=20(c)=202003=20Brendan=20Burns=20<bburns@cs.umass.edu>=0D=
;;=20portions=20(c)=202003=20Gary=20King=20<gwking@cs.umass.edu>=0D;;=20=
portions=20of=20this=20code=20were=20taken=20from=20code=20by=20Gary=20=
Byers=0D=0D;;=20This=20code=20is=20derived=20from=20Apple=20computer's=20=
MiniShell=20sample=0D;;=20application.=20This=20code=20is=20included=20=
below=20and=20can=20be=20found=20at=0D;;=20=
http://developer.apple.com/samplecode/Sample_Code/OS_Utilities/MiniShell.h=
tm=0D=0D;;=20This=20code=20is=20released=20under=20the=20LGPL,=20=0D;;=20=
please=20see=20http://www.gnu.org=20for=20more=20info.=0D;;=20The=20=
author=20is=20not=20responsible=20for=20all=20of=20the=20Really=20Bad=20=
Things(tm)=0D;;=20you=20could=20do=20with=20this=20code.=0D=0D;;=20TODO=0D=
;;=20=20=20other=20bsd=20system=20calls=0D;;=20=20=20=
load-framework-bundle=20is=20not=20BSD=20specific,=20it=20should=20be=20=
moved=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20Instructions=0D;;;=20=
--------------------------------------------------------------------------=
-=0D=0D#|=0DThe=20main=20interface=20for=20Darwin=20access=20is=20the=20=
macro=20system-command.=20=0DIt=20takes=20a=20Unix=20command=20as=20a=20=
string=20argument=20and=20returns=20the=20results=0Dof=20that=20command=20=
as=20a=20string.=20For=20example:=0D=0D?=20(system-command=20"date")=0D=
"Sat=20Jan=2011=2023:45:32=20EST=202003"=0D=0D?=20(system-command=20=
"cal")=0D"=20=20=20=20January=202003=0D=20S=20=20M=20Tu=20=20W=20Th=20=20=
F=20=20S=0D=20=20=20=20=20=20=20=20=20=201=20=202=20=203=20=204=0D=205=20=
=206=20=207=20=208=20=209=2010=2011=0D12=2013=2014=2015=2016=2017=2018=0D=
19=2020=2021=2022=2023=2024=2025=0D26=2027=2028=2029=2030=2031=0D"=0D=0D=
The=20macro=20takes=20an=20optional=20parameter,=20mac-line-feeds?,=20=
which=20defaults=0Dto=20true.=20If=20false,=20the=20string=20returned=20=
will=20use=20Unix=20line=20feeds.=0D|#=0D=0D#+Ignore=0D(eval-when=20=
(:compile-toplevel=20:eval-toplevel=20:execute)=0D=20=20(unless=20=
(find-package=20:bsd)=0D=20=20=20=20(defpackage=20"BSD")))=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20;=20eval-when=0D=0D#-EKSL-UTILITIES=0D=
(in-package=20:BSD)=0D=0D#+EKSL-UTILITIES=0D(in-package=20u)=0D=0D=
(export=20'(darwin-interface=20create-darwin-interface=20hostname=20=
run-shell=20spawn-shell=0D=20=20=20=20=20=20=20=20=20=20=
with-darwin-interface=20system-command=20cd=20ls=20chdir))=0D=0D;;;=20=
This=20class=20wraps=20the=20pointers=20necessary=20for=20accessing=20=
Darwin's=20BSD=20layer.=0D;;;=20(:reader=20fread-fn)=20The=20pointer=20=
to=20the=20fread(3)=20function=0D;;;=20(:reader=20popen-fn)=20The=20=
pointer=20to=20the=20popen(3)=20function=0D;;;=20(:reader=20pclose-fn)=20=
The=20pointer=20to=20the=20pclose(3)=20function=0D;;;=20(:reader=20=
hostname-fn)=20The=20pointer=20to=20the=20gethostname(3)=20function=0D=
(defclass=20darwin-interface=20()=0D=20=20((read=20:reader=20fread-fn=0D=20=
=20=20=20=20=20=20=20=20:initform=20nil=0D=20=20=20=20=20=20=20=20=20=
:initarg=20:read)=0D=20=20=20(open=20:reader=20popen-fn=0D=20=20=20=20=20=
=20=20=20=20:initform=20nil=0D=20=20=20=20=20=20=20=20=20:initarg=20=
:open)=0D=20=20=20(close=20:reader=20pclose-fn=0D=20=20=20=20=20=20=20=20=
=20=20:initform=20nil=0D=20=20=20=20=20=20=20=20=20=20:initarg=20:close)=0D=
=20=20=20(host=20:reader=20hostname-fn=0D=20=20=20=20=20=20=20=20=20=
:initform=20nil=0D=20=20=20=20=20=20=20=20=20:initarg=20:host)=0D=20=20=20=
(fclose=20:reader=20fclose-fn=0D=20=20=20=20=20=20=20=20=20=20=20=
:initform=20nil=0D=20=20=20=20=20=20=20=20=20=20=20:initarg=20:fclose)=0D=
=20=20=20(fopen=20:reader=20fopen-fn=0D=20=20=20=20=20=20=20=20=20=20=
:initform=20nil=0D=20=20=20=20=20=20=20=20=20=20:initarg=20:fopen)=0D=20=20=
=20(fwrite=20:reader=20fwrite-fn=0D=20=20=20=20=20=20=20=20=20=20=20=
:initform=20nil=0D=20=20=20=20=20=20=20=20=20=20=20:initarg=20:fwrite)=0D=
=20=20=20(cd=20:reader=20chdir-fn=0D=20=20=20=20=20=20=20:initform=20nil=0D=
=20=20=20=20=20=20=20:initarg=20:chdir)=0D=20=20=20(bundle=20:reader=20=
bundle=0D=20=20=20=20=20=20=20=20=20=20=20:initform=20nil=0D=20=20=20=20=20=
=20=20=20=20=20=20:initarg=20:bundle)))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20This=20code=20taken=20(nearly)=20directly=20from=20Gary=20=
Byers'=20example=0D;;;=20It=20assumes=20that=20you=20will=20pass=20it=20=
a=20CFString=20(not=20a=20lisp=20string)=20=0D;;;=20see=20(with-cfstrs=20=
...)=0D;;;=20(:parameter=20bundle)=20The=20pointer=20to=20the=20=
BundleRef=0D;;;=20(:parameter=20name)=20The=20name=20(a=20CFString)=20of=20=
the=20function=20to=20find=0D;;;=20(:returns)=20The=20pointer=20to=20the=20=
function=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defun=20get-addr=20(bundle=20name)=0D=20=20(let*=20((addr=20=
(#_CFBundleGetFunctionPointerForName=20bundle=20name)))=0D=20=20=20=20=
(rlet=20((buf=20:long))=0D=20=20=20=20=20=20(setf=20(%get-ptr=20buf)=20=
addr)=0D=20=20=20=20=20=20(ash=20(%get-signed-long=20buf)=20-2))))=0D=0D=
;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20Create=20a=20darwin=20interface=0D;;;=20(:returns)=20The=20=
darwin=20interface,=20properly=20initialized=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20create-darwin-interface=20()=0D=20=20(let=20((bundle=20=
(load-framework-bundle=20"System.framework")))=0D=20=20=20=20(when=20=
(not=20(%null-ptr-p=20bundle))=0D=20=20=20=20=20=20(with-cfstrs=20=
((fread=20"fread")=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20(popen=20"popen")=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20(pclose=20"pclose")=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(hostname=20"gethostname")=0D=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(fopen=20"fopen")=0D=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20(fclose=20"fclose")=0D=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(fwrite=20"fwrite")=0D=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(chdir=20=
"chdir"))=0D=20=20=20=20=20=20=20=20(make-instance=20'darwin-interface=0D=
=20=20=20=20=20=20=20=20=20=20:read=20(get-addr=20bundle=20fread)=0D=20=20=
=20=20=20=20=20=20=20=20:open=20(get-addr=20bundle=20popen)=0D=20=20=20=20=
=20=20=20=20=20=20:close=20(get-addr=20bundle=20pclose)=0D=20=20=20=20=20=
=20=20=20=20=20:host=20(get-addr=20bundle=20hostname)=0D=20=20=20=20=20=20=
=20=20=20=20:fclose=20(get-addr=20bundle=20fclose)=0D=20=20=20=20=20=20=20=
=20=20=20:fopen=20(get-addr=20bundle=20fopen)=0D=20=20=20=20=20=20=20=20=20=
=20:fwrite=20(get-addr=20bundle=20fwrite)=0D=20=20=20=20=20=20=20=20=20=20=
:chdir=20(get-addr=20bundle=20chdir)=0D=20=20=20=20=20=20=20=20=20=20=
:bundle=20bundle)))))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20Hmmm,=20do=20we=20need=20dispose=20the=20function=20ptrs=20=
too?=20=20I'm=20not=20sure=20--bb=0D;;;=20(:parameter=20=
darwin-interface)=20The=20interface=20to=20dispose=0D;;;=20(:returns)=20=
nil=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20dispose-darwin-interface=20((darwin-interface=20=
darwin-interface))=0D=20=20(if=20(bundle=20darwin-interface)=0D=20=20=20=20=
(#_CFRelease=20(bundle=20darwin-interface)))=0D=20=20(setf=20(slot-value=20=
darwin-interface=20'read)=20nil=0D=20=20=20=20=20=20=20=20(slot-value=20=
darwin-interface=20'open)=20nil=0D=20=20=20=20=20=20=20=20(slot-value=20=
darwin-interface=20'close)=20nil=0D=20=20=20=20=20=20=20=20(slot-value=20=
darwin-interface=20'host)=20nil=0D=20=20=20=20=20=20=20=20(slot-value=20=
darwin-interface=20'fclose)=20nil=0D=20=20=20=20=20=20=20=20(slot-value=20=
darwin-interface=20'fopen)=20nil=0D=20=20=20=20=20=20=20=20(slot-value=20=
darwin-interface=20'fwrite)=20nil=0D=20=20=20=20=20=20=20=20(slot-value=20=
darwin-interface=20'cd)=20nil=0D=20=20=20=20=20=20=20=20(slot-value=20=
darwin-interface=20'bundle)=20nil))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20Get=20the=20string=20hostname=20of=20the=20current=20machine,=20=
(adapted=20from=20Gary=20Byers)=0D;;;=20(:parameter=20darwin-interface)=20=
The=20darwin-interface=20to=20use=20for=20the=20call=0D;;;=20(:returns)=20=
The=20string=20of=20the=20hostname=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20hostname=20((darwin-interface=20darwin-interface))=0D=20=
=20(%stack-block=20((buf=20512))=0D=20=20=20=20(if=20(eql=200=20=
(ccl::ppc-ff-call=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(hostname-fn=20darwin-interface)=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20:address=20buf=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:unsigned-fullword=20512=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:signed-fullword))=0D=20=20=20=20=20=20(%get-cstring=20buf))))=0D=0D=0D=
;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20see=20man=20chdir(2)=20changes=20the=20current=20working=20=
directory=0D;;;=20(:parameter=20darwin-interface)=20the=20interface=20to=20=
use.=0D;;;=20(:parameter=20path)=20The=20path=20of=20the=20directory=20=
to=20cd=20to=0D;;;=20(:returns)=20zero=20if=20sucessful=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20chdir=20((darwin-interface=20darwin-interface)=20(path=20=
string))=0D=20=20(ccl::with-cstr=20(c-path=20path)=0D=20=20=20=20=
(ccl::ppc-ff-call=20(chdir-fn=20darwin-interface)=0D=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20:address=20c-path=0D=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:signed-fullword)))=0D=0D=0D(defmethod=20bsd-path-to-mac=20((path=20=
string))=0D=20=20(let=20((real-path=20(substitute=20#\:=20#\/=20path)))=0D=
=20=20=20=20(if=20(not=20(eq=20(elt=20real-path=20(1-=20(length=20=
path)))=20#\:))=0D=20=20=20=20=20=20(setf=20real-path=20(concatenate=20=
'string=20real-path=20":")))=0D=20=20=20=20(if=20(eq=20(elt=20real-path=20=
0)=20#\:)=0D=20=20=20=20=20=20(if=20(string-equal=20(subseq=20real-path=20=
0=208)=20":volumes")=0D=20=20=20=20=20=20=20=20(subseq=20real-path=209)=0D=
=20=20=20=20=20=20=20=20(concatenate=20'string=20(namestring=20=
(ccl::boot-directory))=20=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20(subseq=20real-path=201)))=0D=20=20=20=20=20=20=
(concatenate=20'string=20(namestring=20(ccl::mac-default-directory))=0D=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20real-path))))=0D=0D=
;;;=20Note,=20this=20really=20ought=20to=20set-mac-default-directory,=20=
but=20I=20don't=20want=0D;;;=20to=20write=20the=20code=20to=20translate=20=
*BSD=20paths=20to=20Mac...=0D(defmacro=20cd=20(dir)=0D=20=20`(let*=20=
((di=20(create-darwin-interface))=0D=20=20=20=20=20=20=20=20=20=20(res=20=
(chdir=20di=20,dir)))=0D=20=20=20=20=20(if=20(zerop=20res)=20=0D=20=20=20=
=20=20=20=20(progn=20=0D=20=20=20=20=20=20=20=20=20,dir=0D=20=20=20=20=20=
=20=20=20=20(set-mac-default-directory=20(bsd-path-to-mac=20,dir)))=0D=20=
=20=20=20=20=20=20nil)))=0D=0D(defmacro=20ls=20(&key=20(args=20"")=20=
(stream=20*standard-output*))=20=0D=20=20`(progn=0D=20=20=20=20=20=
(format=20,stream=20"~A"=20(system-command=20(concatenate=20'string=20=
"ls=20"=20,args)))=0D=20=20=20=20=20nil))=0D=0D=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20see=20man=20fopen(3)=0D;;;=20(:parameter=20darwin-interface)=20=
The=20interface=20to=20call=20on=0D;;;=20(:parameter=20path)=20The=20=
path=20to=20the=20file=20(Un*x=20style)=0D;;;=20(:parameter=20mode)=20=
The=20mode=20to=20open=20the=20file=20(see=20the=20man=20page)=0D;;;=20=
(:returns)=20The=20file=20pointer=20(or=20zero=20if=20there's=20an=20=
error)=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20fopen=20((darwin-interface=20darwin-interface)=20(path=20=
string)=20(mode=20string))=0D=20=20(with-cstrs=20((c-path=20path)=0D=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(c-mode=20mode))=0D=20=20=20=20=
(ccl::ppc-ff-call=20(fopen-fn=20darwin-interface)=0D=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20:address=20c-path=0D=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20:address=20=
c-mode=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:unsigned-fullword)))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20see=20man=20fclose(3)=0D;;;=20(:parameter=20darwin-interface)=20=
the=20interface=20to=20call=20on=0D;;;=20(:parameter=20fp)=20The=20file=20=
pointer=20to=20close=0D;;;=20(:returns)=20zero=20if=20everything's=20=
cool,=20errno=20otherwise.=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20fclose=20((darwin-interface=20darwin-interface)=20fp)=0D=
=20=20(ccl::ppc-ff-call=20(fclose-fn=20darwin-interface)=0D=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20:unsigned-fullword=20fp=0D=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:signed-fullword))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20see=20man=20popen(3)=20=20=0D;;;=20(:parameter=20=
darwin-interface)=20the=20interface=20to=20call=20on=0D;;;=20(:parameter=20=
command)=20is=20a=20Lisp=20string=0D;;;=20(:returns)=20an=20=
integer/FILE*,=20geez=20doesn't=20anyone=20know=20Un*x=20anymore?=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20popen=20((darwin-interface=20darwin-interface)=20=
(command=20string))=0D=20=20(ccl::with-cstrs=20=20((read=20"r")=0D=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cmd=20command))=0D=
=20=20=20=20(ccl::ppc-ff-call=0D=20=20=20=20=20(popen-fn=20=
darwin-interface)=0D=20=20=20=20=20:address=20cmd=0D=20=20=20=20=20=
:address=20read=0D=20=20=20=20=20:address)))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20see=20man=20fwrite(3)=0D;;;=20(:parameter=20darwin-interface)=20=
the=20interface=20to=20call=20on=0D;;;=20(:parameter=20fp)=20the=20FILE*=20=
to=20write=20to=0D;;;=20(:parameter=20seq)=20the=20sequence=20of=20bytes=20=
to=20write=0D;;;=20(:parameter=20length)=20the=20length=20of=20the=20=
bytes=20to=20write=0D;;;=20(:returns)=20the=20number=20of=20bytes=20=
written=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20fwrite=20((darwin-interface=20darwin-interface)=20(fp=20=
integer)=20(seq=20sequence)=20(length=20integer))=0D=20=20(fwrite=20=
darwin-interface=20(ccl::%int-to-ptr=20fp)=20seq=20length))=0D=0D=
(defmethod=20fwrite=20((darwin-interface=20darwin-interface)=20(fp=20=
macptr)=20(seq=20sequence)=20(length=20integer))=0D=20=20(%stack-block=20=
((buff=20length))=0D=20=20=20=20(loop=20for=20i=20from=200=20to=20(1-=20=
length)=0D=20=20=20=20=20=20=20=20=20=20do=20(ccl::%put-byte=20buff=20=
(elt=20seq=20i)=20i))=0D=20=20=20=20(ccl::ppc-ff-call=20(fwrite-fn=20=
darwin-interface)=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20:address=20buff=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20:unsigned-fullword=201=0D=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20:unsigned-fullword=20length=0D=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20:address=20=
fp=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:signed-fullword)))=0D=0D=20=20;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20see=20man=20fread(3)=0D;;;=20(:parameter=20darwin-interface)=20=
the=20interface=20to=20call=20on=0D;;;=20(:parameter=20fp)=20the=20=
pointer=20to=20the=20file=20from=20which=20to=20read.=0D;;;=20=
(:parameter=20seq)=20the=20sequence=20to=20read=20into=0D;;;=20=
(:parameter=20length)=20the=20number=20of=20bytes=20to=20read=0D;;;=20=
(:returns)=20the=20number=20of=20bytes=20read=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20fread=20((darwin-interface=20darwin-interface)=20(fp=20=
integer)=20(seq=20sequence)=20(length=20integer))=0D=20=20(fread=20=
darwin-interface=20(ccl::%int-to-ptr=20fp)=20seq=20length))=0D=0D=
(defmethod=20fread=20((darwin-interface=20darwin-interface)=20(fp=20=
macptr)=20(seq=20sequence)=20(length=20integer))=0D=20=20(%stack-block=20=
((buf=20length))=0D=20=20=20=20(let=20((size=20(ccl::ppc-ff-call=0D=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(fread-fn=20=
darwin-interface)=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:address=20buf=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:unsigned-fullword=201=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20:unsigned-fullword=20length=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20:address=20fp=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20:signed-fullword)))=0D=20=20=20=20=20=20(if=20(>=20size=200)=0D=20=20=20=
=20=20=20=20=20(loop=20for=20i=20from=200=20to=20(1-=20size)=0D=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20do=20(setf=20(elt=20seq=20i)=20(%get-byte=20=
buf=20i))))=0D=20=20=20=20=20=20size)))=0D=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20see=20man=20fread(3)=0D;;;=20(:parameter=20darwin-interface)=20=
the=20interface=20to=20call=20on=0D;;;=20(:parameter=20fp)=20the=20=
pointer=20to=20the=20file=20from=20which=20to=20read.=0D;;;=20=
(:parameter=20max-length)=20the=20maximum=20number=20of=20chars=20to=20=
read=0D;;;=20(:returns)=20the=20string=20(or=20nil=20if=20zero=20chars=20=
are=20read=20or=20EOF)=0D;;;=20=
--------------------------------------------------------------------------=
-=0D=0D(defmethod=20fread-string=20((darwin-interface=20=
darwin-interface)=20fp=20&key=20(max-length=20512))=0D=20=20(let*=20=
((result-seq=20(make-sequence=20'(vector=20(unsigned-byte=208))=20=
max-length))=0D=20=20=20=20=20=20=20=20=20(size=20(fread=20=
darwin-interface=20fp=20result-seq=20max-length))=0D=20=20=20=20=20=20=20=
=20=20(result-string=20(make-sequence=20'string=20size)))=0D=20=20=20=20=
(loop=20for=20i=20from=200=20to=20(1-=20size)=0D=20=20=20=20=20=20=20=20=20=
=20do=20(setf=20(elt=20result-string=20i)=20(code-char=20(elt=20=
result-seq=20i))))=0D=20=20=20=20(if=20(zerop=20size)=20nil=20=
result-string)))=0D=20=20=20=20=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20see=20man=20pclose(3)=0D;;;=20(:parameter=20darwin-interface)=20=
the=20darwin-interface=20to=20call=20on=0D;;;=20(:parameter=20fp)=20the=20=
file=20pointer=20to=20close=0D;;;=20(:returns)=20zero=20if=20everything=20=
is=20cool,=20-1=20otherwise=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20pclose=20((darwin-interface=20darwin-interface)=20fp)=0D=
=20=20(ccl::ppc-ff-call=0D=20=20=20(pclose-fn=20darwin-interface)=0D=20=20=
=20:address=20fp=0D=20=20=20:signed-fullword))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20run=20a=20shell=20command=0D;;;=20(:parameter=20=
darwin-interface)=20the=20interface=20to=20run=20on=0D;;;=20(:parameter=20=
command)=20the=20shell=20command=20to=20run=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20run-shell=20((darwin-interface=20darwin-interface)=20=
(command=20string)=20=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20&optional=20(mac-line-feeds?=20t))=0D=20=20(let=20((fp=20=
(popen=20darwin-interface=20command))=0D=20=20=20=20=20=20=20=20(result=20=
""))=0D=20=20=20=20(when=20(not=20(%null-ptr-p=20fp))=0D=20=20=20=20=20=20=
(let=20((str=20(fread-string=20darwin-interface=20fp)))=0D=20=20=20=20=20=
=20=20=20(loop=20while=20str=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
do=20(setf=20result=20(concatenate=20'string=20result=20str))=0D=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20do=20(setf=20str=20(fread-string=20=
darwin-interface=20fp)))=0D=20=20=20=20=20=20(pclose=20darwin-interface=20=
fp)))=0D=20=20=20=20(if=20mac-line-feeds?=0D=20=20=20=20=20=20=
(substitute=20#\newline=20#\linefeed=20result)=0D=20=20=20=20=20=20=
result)))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20while=20utilizing=20a=20darwin-interface=20do=20...=0D;;;=20=
(:parameter=20darwin-interface)=20the=20name=20of=20the=20local=20=
darwin-interface=0D;;;=20(:parameter=20body)=20the=20code=20to=20execute=0D=
;;;=20(:returns)=20whatever=20(body)=20returns.=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmacro=20with-darwin-interface=20(darwin-interface=20&body=20=
body)=0D=20=20`(unwind-protect=20=0D=20=20=20=20=20(progn=0D=20=20=20=20=20=
=20=20(setf=20,darwin-interface=20(create-darwin-interface))=0D=20=20=20=20=
=20=20=20,@body)=0D=20=20=20=20=20(dispose-darwin-interface=20=
,darwin-interface)))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20simple=20utility=20for=20running=20shell=20commands=0D;;;=20=
*note,=20this=20shouldn't=20be=20called=20repeatedly,=20use=20=
with-darwin-interface=20=0D;;;=20instead.=0D;;;=20(:parameter=20string)=20=
the=20command=20to=20run=0D;;;=20(:parameter=20mac-line-feeds=20=
:optional=20t)=20convert=20\n=20to=20\r=20in=20the=20result=0D;;;=20=
(:returns)=20the=20string=20read.=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmacro=20system-command=20(string=20&optional=20(mac-line-feeds?=20=
t))=0D=20=20(let=20((system=20(gensym)))=0D=20=20=20=20`(unwind-protect=20=
=0D=20=20=20=20=20=20=20(progn=0D=20=20=20=20=20=20=20=20=20(setf=20=
,system=20(create-darwin-interface))=0D=20=20=20=20=20=20=20=20=20=
(run-shell=20,system=20,string=20,mac-line-feeds?))=0D=20=20=20=20=20=20=20=
(dispose-darwin-interface=20,system))))=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20utilities=20=0D;;;=20=
--------------------------------------------------------------------------=
-=0D=0D;;;=20=
--------------------------------------------------------------------------=
-=0D;;;=20Load=20a=20bundle=20located=20somewhere=20normal.=0D;;;=20=
(e.g.=20/Frameworks,=20/Library/Frameworks,=20~/Library/Frameworks,=20=
etc.=0D;;;=20the=20name=20should=20include=20the=20".framework"=20=
suffix.=0D;;;=20(:parameter=20framework-name)=20The=20name=20of=20the=20=
framework=20to=20load.=0D;;;=20(:parameter=20load-executable=20:optional=20=
t)=20Load=20the=20bundle's=20executables,=20(e.g.=20link=20it=20into=20=
the=20current=20program,=20you=20better=20say=20yes,=20if=20you=20want=20=
to=20execute=20any=20of=20its=20functions.=0D;;;=20(:returns)=20A=20=
pointer=20to=20the=20bundle=20(A=20BundleRef*=20to=20be=20exact)=0D;;;=20=
--------------------------------------------------------------------------=
-=0D(defmethod=20load-framework-bundle=20((framework-name=20string)=20=
&key=20(load-executable=20t))=0D=20=20(with-cfstrs=20((framework=20=
framework-name))=0D=20=20=20=20(let=20((err=200)=0D=20=20=20=20=20=20=20=20=
=20=20(baseURL=20nil)=0D=20=20=20=20=20=20=20=20=20=20(bundleURL=20nil)=0D=
=20=20=20=20=20=20=20=20=20=20(result=20nil))=0D=20=20=20=20=20=20(rlet=20=
((folder=20:fsref))=0D=20=20=20=20=20=20=20=20;;=20Find=20the=20folder=20=
holding=20the=20bundle=0D=20=20=20=20=20=20=20=20(setf=20err=20=
(#_FSFindFolder=20#$kOnAppropriateDisk=20#$kFrameworksFolderType=20=0D=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20t=20folder))=0D=20=20=
=20=20=20=20=20=20=0D=20=20=20=20=20=20=20=20;;=20if=20everything's=20=
cool,=20make=20a=20URL=20for=20it=0D=20=20=20=20=20=20=20=20(when=20=
(zerop=20err)=0D=20=20=20=20=20=20=20=20=20=20(setf=20baseURL=20=
(#_CFURLCreateFromFSRef=20(%null-ptr)=20folder))=0D=20=20=20=20=20=20=20=20=
=20=20(if=20(%null-ptr-p=20baseURL)=20=0D=20=20=20=20=20=20=20=20=20=20=20=
=20(setf=20err=20#$coreFoundationUnknownErr)))=0D=20=20=20=20=20=20=20=20=
=0D=20=20=20=20=20=20=20=20;;=20if=20everything's=20cool,=20make=20a=20=
URL=20for=20the=20bundle=0D=20=20=20=20=20=20=20=20(when=20(zerop=20err)=0D=
=20=20=20=20=20=20=20=20=20=20(setf=20bundleURL=20=
(#_CFURLCreateCopyAppendingPathComponent=20(%null-ptr)=20=0D=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
baseURL=20framework=20nil))=0D=20=20=20=20=20=20=20=20=20=20(if=20=
(%null-ptr-p=20bundleURL)=20=0D=20=20=20=20=20=20=20=20=20=20=20=20(setf=20=
err=20#$coreFoundationUnknownErr)))=0D=20=20=20=20=20=20=20=20=0D=20=20=20=
=20=20=20=20=20;;=20if=20everything's=20cool,=20load=20it=0D=20=20=20=20=20=
=20=20=20(when=20(zerop=20err)=0D=20=20=20=20=20=20=20=20=20=20(setf=20=
result=20(#_CFBundleCreate=20(%null-ptr)=20bundleURL))=0D=20=20=20=20=20=20=
=20=20=20=20(if=20(%null-ptr-p=20result)=0D=20=20=20=20=20=20=20=20=20=20=
=20=20(setf=20err=20#$coreFoundationUnknownErr)))=0D=20=20=20=20=20=20=20=
=20=0D=20=20=20=20=20=20=20=20;;=20if=20everything's=20cool,=20and=20the=20=
user=20wants=20it=20loaded,=20load=20it=0D=20=20=20=20=20=20=20=20(when=20=
(and=20load-executable=20(zerop=20err))=0D=20=20=20=20=20=20=20=20=20=20=
(if=20(not=20(#_CFBundleLoadExecutable=20result))=0D=20=20=20=20=20=20=20=
=20=20=20=20=20(setf=20err=20#$coreFoundationUnknownErr)))=0D=20=20=20=20=
=20=20=20=20=0D=20=20=20=20=20=20=20=20;;=20if=20there's=20an=20error,=20=
but=20we've=20got=20a=20pointer,=20free=20it=20and=20clear=20result=0D=20=
=20=20=20=20=20=20=20(when=20(and=20(not=20(zerop=20err))=20(not=20=
(%null-ptr-p=20result)))=0D=20=20=20=20=20=20=20=20=20=20(#_CFRelease=20=
result)=0D=20=20=20=20=20=20=20=20=20=20(setf=20result=20nil))=0D=20=20=20=
=20=20=20=20=20=0D=20=20=20=20=20=20=20=20;;=20free=20the=20URLs=20if=20=
there=20non-null=0D=20=20=20=20=20=20=20=20(when=20(not=20(%null-ptr-p=20=
bundleURL))=0D=20=20=20=20=20=20=20=20=20=20(#_CFRelease=20bundleURL))=0D=
=20=20=20=20=20=20=20=20(when=20(not=20(%null-ptr-p=20baseURL))=0D=20=20=20=
=20=20=20=20=20=20=20(#_CFRelease=20baseURL))=0D=20=20=20=20=20=20=20=20=0D=
=20=20=20=20=20=20=20=20;;=20return=20pointer=20+=20error=20value=0D=20=20=
=20=20=20=20=20=20(values=20result=20err)))))=0D=0D=0D#|=20MiniShell.r=0D=
=0D/*=0D=09File:=09=09MiniShell.r=0D=09=0D=09Disclaimer:=09IMPORTANT:=20=20=
This=20Apple=20software=20is=20supplied=20to=20you=20by=20Apple=20=
Computer,=20Inc.=0D=09=09=09=09("Apple")=20in=20consideration=20of=20=
your=20agreement=20to=20the=20following=20terms,=20and=20your=0D=09=09=09=
=09use,=20installation,=20modification=20or=20redistribution=20of=20this=20=
Apple=20software=0D=09=09=09=09constitutes=20acceptance=20of=20these=20=
terms.=20=20If=20you=20do=20not=20agree=20with=20these=20terms,=0D=09=09=09=
=09please=20do=20not=20use,=20install,=20modify=20or=20redistribute=20=
this=20Apple=20software.=0D=0D=09=09=09=09In=20consideration=20of=20your=20=
agreement=20to=20abide=20by=20the=20following=20terms,=20and=20subject=0D=
=09=09=09=09to=20these=20terms,=20Apple=20grants=20you=20a=20personal,=20=
non-exclusive=20license,=20under=20Apple=CDs=0D=09=09=09=09copyrights=20=
in=20this=20original=20Apple=20software=20(the=20"Apple=20Software"),=20=
to=20use,=0D=09=09=09=09reproduce,=20modify=20and=20redistribute=20the=20=
Apple=20Software,=20with=20or=20without=0D=09=09=09=09modifications,=20=
in=20source=20and/or=20binary=20forms;=20provided=20that=20if=20you=20=
redistribute=0D=09=09=09=09the=20Apple=20Software=20in=20its=20entirety=20=
and=20without=20modifications,=20you=20must=20retain=0D=09=09=09=09this=20=
notice=20and=20the=20following=20text=20and=20disclaimers=20in=20all=20=
such=20redistributions=20of=0D=09=09=09=09the=20Apple=20Software.=20=20=
Neither=20the=20name,=20trademarks,=20service=20marks=20or=20logos=20of=0D=
=09=09=09=09Apple=20Computer,=20Inc.=20may=20be=20used=20to=20endorse=20=
or=20promote=20products=20derived=20from=20the=0D=09=09=09=09Apple=20=
Software=20without=20specific=20prior=20written=20permission=20from=20=
Apple.=20=20Except=20as=0D=09=09=09=09expressly=20stated=20in=20this=20=
notice,=20no=20other=20rights=20or=20licenses,=20express=20or=20implied,=0D=
=09=09=09=09are=20granted=20by=20Apple=20herein,=20including=20but=20not=20=
limited=20to=20any=20patent=20rights=20that=0D=09=09=09=09may=20be=20=
infringed=20by=20your=20derivative=20works=20or=20by=20other=20works=20=
in=20which=20the=20Apple=0D=09=09=09=09Software=20may=20be=20=
incorporated.=0D=0D=09=09=09=09The=20Apple=20Software=20is=20provided=20=
by=20Apple=20on=20an=20"AS=20IS"=20basis.=20=20APPLE=20MAKES=20NO=0D=09=09=
=09=09WARRANTIES,=20EXPRESS=20OR=20IMPLIED,=20INCLUDING=20WITHOUT=20=
LIMITATION=20THE=20IMPLIED=0D=09=09=09=09WARRANTIES=20OF=20=
NON-INFRINGEMENT,=20MERCHANTABILITY=20AND=20FITNESS=20FOR=20A=20=
PARTICULAR=0D=09=09=09=09PURPOSE,=20REGARDING=20THE=20APPLE=20SOFTWARE=20=
OR=20ITS=20USE=20AND=20OPERATION=20ALONE=20OR=20IN=0D=09=09=09=09=
COMBINATION=20WITH=20YOUR=20PRODUCTS.=0D=0D=09=09=09=09IN=20NO=20EVENT=20=
SHALL=20APPLE=20BE=20LIABLE=20FOR=20ANY=20SPECIAL,=20INDIRECT,=20=
INCIDENTAL=20OR=0D=09=09=09=09CONSEQUENTIAL=20DAMAGES=20(INCLUDING,=20=
BUT=20NOT=20LIMITED=20TO,=20PROCUREMENT=20OF=20SUBSTITUTE=0D=09=09=09=09=
GOODS=20OR=20SERVICES;=20LOSS=20OF=20USE,=20DATA,=20OR=20PROFITS;=20OR=20=
BUSINESS=20INTERRUPTION)=0D=09=09=09=09ARISING=20IN=20ANY=20WAY=20OUT=20=
OF=20THE=20USE,=20REPRODUCTION,=20MODIFICATION=20AND/OR=20DISTRIBUTION=0D=
=09=09=09=09OF=20THE=20APPLE=20SOFTWARE,=20HOWEVER=20CAUSED=20AND=20=
WHETHER=20UNDER=20THEORY=20OF=20CONTRACT,=20TORT=0D=09=09=09=09=
(INCLUDING=20NEGLIGENCE),=20STRICT=20LIABILITY=20OR=20OTHERWISE,=20EVEN=20=
IF=20APPLE=20HAS=20BEEN=0D=09=09=09=09ADVISED=20OF=20THE=20POSSIBILITY=20=
OF=20SUCH=20DAMAGE.=0D=0D=09Copyright=20=A9=201999-2001=20Apple=20=
Computer,=20Inc.,=20All=20Rights=20Reserved=0D*/=0D=0D#include=20=
"Types.r"=0D=0Ddata=20'carb'=20(0)=20{=0D};=0D=0D=0Dresource=20'ALRT'=20=
(128)=20{=0D=09{40,=2040,=20164,=20398},=0D=09128,=0D=09{=09/*=20array:=20=
4=20elements=20*/=0D=09=09/*=20[1]=20*/=0D=09=09OK,=20visible,=20sound1,=0D=
=09=09/*=20[2]=20*/=0D=09=09OK,=20visible,=20sound1,=0D=09=09/*=20[3]=20=
*/=0D=09=09OK,=20visible,=20sound1,=0D=09=09/*=20[4]=20*/=0D=09=09OK,=20=
visible,=20sound1=0D=09},=0D=09alertPositionMainScreen=0D};=0D=0D=
resource=20'DITL'=20(128)=20{=0D=09{=09/*=20array=20DITLarray:=202=20=
elements=20*/=0D=09=09/*=20[1]=20*/=0D=09=09{95,=20158,=20115,=20216},=0D=
=09=09Button=20{=0D=09=09=09enabled,=0D=09=09=09"OK"=0D=09=09},=0D=09=09=
/*=20[2]=20*/=0D=09=09{11,=2044,=2080,=20334},=0D=09=09StaticText=20{=0D=09=
=09=09disabled,=0D=09=09=09"There=20was=20a=20problem=20loading=20the=20=
bundle.=20"=0D=09=09=09"=20Please=20verify=20you=20are=20running=20on=20=
Mac=20OS"=0D=09=09=09"=20X."=0D=09=09}=0D=09}=0D};=0D=0D=0D|#=0D=0D=0D#|=20=
MiniShell.c=0D=0D/*=0D=09File:=09=09MiniShell.c=0D=09=0D=09Disclaimer:=09=
IMPORTANT:=20=20This=20Apple=20software=20is=20supplied=20to=20you=20by=20=
Apple=20Computer,=20Inc.=0D=09=09=09=09("Apple")=20in=20consideration=20=
of=20your=20agreement=20to=20the=20following=20terms,=20and=20your=0D=09=09=
=09=09use,=20installation,=20modification=20or=20redistribution=20of=20=
this=20Apple=20software=0D=09=09=09=09constitutes=20acceptance=20of=20=
these=20terms.=20=20If=20you=20do=20not=20agree=20with=20these=20terms,=0D=
=09=09=09=09please=20do=20not=20use,=20install,=20modify=20or=20=
redistribute=20this=20Apple=20software.=0D=0D=09=09=09=09In=20=
consideration=20of=20your=20agreement=20to=20abide=20by=20the=20=
following=20terms,=20and=20subject=0D=09=09=09=09to=20these=20terms,=20=
Apple=20grants=20you=20a=20personal,=20non-exclusive=20license,=20under=20=
Apple=CDs=0D=09=09=09=09copyrights=20in=20this=20original=20Apple=20=
software=20(the=20"Apple=20Software"),=20to=20use,=0D=09=09=09=09=
reproduce,=20modify=20and=20redistribute=20the=20Apple=20Software,=20=
with=20or=20without=0D=09=09=09=09modifications,=20in=20source=20and/or=20=
binary=20forms;=20provided=20that=20if=20you=20redistribute=0D=09=09=09=09=
the=20Apple=20Software=20in=20its=20entirety=20and=20without=20=
modifications,=20you=20must=20retain=0D=09=09=09=09this=20notice=20and=20=
the=20following=20text=20and=20disclaimers=20in=20all=20such=20=
redistributions=20of=0D=09=09=09=09the=20Apple=20Software.=20=20Neither=20=
the=20name,=20trademarks,=20service=20marks=20or=20logos=20of=0D=09=09=09=
=09Apple=20Computer,=20Inc.=20may=20be=20used=20to=20endorse=20or=20=
promote=20products=20derived=20from=20the=0D=09=09=09=09Apple=20Software=20=
without=20specific=20prior=20written=20permission=20from=20Apple.=20=20=
Except=20as=0D=09=09=09=09expressly=20stated=20in=20this=20notice,=20no=20=
other=20rights=20or=20licenses,=20express=20or=20implied,=0D=09=09=09=09=
are=20granted=20by=20Apple=20herein,=20including=20but=20not=20limited=20=
to=20any=20patent=20rights=20that=0D=09=09=09=09may=20be=20infringed=20=
by=20your=20derivative=20works=20or=20by=20other=20works=20in=20which=20=
the=20Apple=0D=09=09=09=09Software=20may=20be=20incorporated.=0D=0D=09=09=
=09=09The=20Apple=20Software=20is=20provided=20by=20Apple=20on=20an=20=
"AS=20IS"=20basis.=20=20APPLE=20MAKES=20NO=0D=09=09=09=09WARRANTIES,=20=
EXPRESS=20OR=20IMPLIED,=20INCLUDING=20WITHOUT=20LIMITATION=20THE=20=
IMPLIED=0D=09=09=09=09WARRANTIES=20OF=20NON-INFRINGEMENT,=20=
MERCHANTABILITY=20AND=20FITNESS=20FOR=20A=20PARTICULAR=0D=09=09=09=09=
PURPOSE,=20REGARDING=20THE=20APPLE=20SOFTWARE=20OR=20ITS=20USE=20AND=20=
OPERATION=20ALONE=20OR=20IN=0D=09=09=09=09COMBINATION=20WITH=20YOUR=20=
PRODUCTS.=0D=0D=09=09=09=09IN=20NO=20EVENT=20SHALL=20APPLE=20BE=20LIABLE=20=
FOR=20ANY=20SPECIAL,=20INDIRECT,=20INCIDENTAL=20OR=0D=09=09=09=09=
CONSEQUENTIAL=20DAMAGES=20(INCLUDING,=20BUT=20NOT=20LIMITED=20TO,=20=
PROCUREMENT=20OF=20SUBSTITUTE=0D=09=09=09=09GOODS=20OR=20SERVICES;=20=
LOSS=20OF=20USE,=20DATA,=20OR=20PROFITS;=20OR=20BUSINESS=20INTERRUPTION)=0D=
=09=09=09=09ARISING=20IN=20ANY=20WAY=20OUT=20OF=20THE=20USE,=20=
REPRODUCTION,=20MODIFICATION=20AND/OR=20DISTRIBUTION=0D=09=09=09=09OF=20=
THE=20APPLE=20SOFTWARE,=20HOWEVER=20CAUSED=20AND=20WHETHER=20UNDER=20=
THEORY=20OF=20CONTRACT,=20TORT=0D=09=09=09=09(INCLUDING=20NEGLIGENCE),=20=
STRICT=20LIABILITY=20OR=20OTHERWISE,=20EVEN=20IF=20APPLE=20HAS=20BEEN=0D=09=
=09=09=09ADVISED=20OF=20THE=20POSSIBILITY=20OF=20SUCH=20DAMAGE.=0D=0D=09=
Copyright=20=A9=201999-2001=20Apple=20Computer,=20Inc.,=20All=20Rights=20=
Reserved=0D*/=0D=0D#include=20<stdio.h>=0D#include=20<string.h>=0D=0D=0D=
//=20BSD=20function=20prototypes=0Dint=09execv(=20const=20char=20*path,=20=
char=20*const=20argv[]=20);=0Dtypedef=20int=20(*execvFuncPtr)(=20const=20=
char*,=20char=20**const=20);=0D=0DFILE=20*=09=20popen(const=20char=20=
*command,=20const=20char=20*type);=0Dtypedef=20FILE=20=
*(*BSDpopenFuncPtr)(=20const=20char*,=20const=20char*=20);=0D=0Dint=09=
pclose(=20FILE=20*stream=20);=0Dtypedef=20int=20(*BSDpcloseFuncPtr)(=20=
FILE*=20);=0D=0Dtypedef=20int=20(*BSDfreadFuncPtr)(=20void=20*,=20=
size_t,=20size_t,=20FILE=20*=20);=0D=0DBSDpopenFuncPtr=09=09=
BSDpopenFunc;=0DBSDfreadFuncPtr=09=09BSDfread;=0DBSDpcloseFuncPtr=09=
BSDpclose;=0D=0Dvoid=09InvokeTool(=20char=20*toolName=20);=0D=0D=0D=
static=20Boolean=20RunningOnCarbonX(void)=0D{=0D=20=20=20=20UInt32=20=
response;=0D=20=20=20=20=0D=20=20=20=20return=20=
(Gestalt(gestaltSystemVersion,=20=0D=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(SInt32=20*)=20&response)=20=3D=3D=20noErr)=0D=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20&&=20(response=20>=3D=20=
0x01000);=0D}=0D=0D=0Dstatic=20OSStatus=20=
LoadFrameworkBundle(CFStringRef=20framework,=20CFBundleRef=20*bundlePtr)=0D=
{=0D=09OSStatus=20=09err;=0D=09FSRef=20=09=09frameworksFolderRef;=0D=09=
CFURLRef=09baseURL;=0D=09CFURLRef=09bundleURL;=0D=09=0D=09if=20(=20=
bundlePtr=20=3D=3D=20nil=20)=09return(=20-1=20);=0D=09=0D=09*bundlePtr=20=
=3D=20nil;=0D=09=0D=09baseURL=20=3D=20nil;=0D=09bundleURL=20=3D=20nil;=0D=
=09=0D=09err=20=3D=20FSFindFolder(kOnAppropriateDisk,=20=
kFrameworksFolderType,=20true,=20&frameworksFolderRef);=0D=09if=20(err=20=
=3D=3D=20noErr)=20{=0D=09=09baseURL=20=3D=20=
CFURLCreateFromFSRef(kCFAllocatorSystemDefault,=20&frameworksFolderRef);=0D=
=09=09if=20(baseURL=20=3D=3D=20nil)=20{=0D=09=09=09err=20=3D=20=
coreFoundationUnknownErr;=0D=09=09}=0D=09}=0D=09if=20(err=20=3D=3D=20=
noErr)=20{=0D=09=09bundleURL=20=3D=20=
CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault,=20=
baseURL,=20framework,=20false);=0D=09=09if=20(bundleURL=20=3D=3D=20nil)=20=
{=0D=09=09=09err=20=3D=20coreFoundationUnknownErr;=0D=09=09}=0D=09}=0D=09=
if=20(err=20=3D=3D=20noErr)=20{=0D=09=09*bundlePtr=20=3D=20=
CFBundleCreate(kCFAllocatorSystemDefault,=20bundleURL);=0D=09=09if=20=
(*bundlePtr=20=3D=3D=20nil)=20{=0D=09=09=09err=20=3D=20=
coreFoundationUnknownErr;=0D=09=09}=0D=09}=0D=09if=20(err=20=3D=3D=20=
noErr)=20{=0D=09=20=20=20=20if=20(=20!=20CFBundleLoadExecutable(=20=
*bundlePtr=20)=20)=20{=0D=09=09=09err=20=3D=20coreFoundationUnknownErr;=0D=
=09=20=20=20=20}=0D=09}=0D=0D=09//=20Clean=20up.=0D=09if=20(err=20!=3D=20=
noErr=20&&=20*bundlePtr=20!=3D=20nil)=20{=0D=09=09CFRelease(*bundlePtr);=0D=
=09=09*bundlePtr=20=3D=20nil;=0D=09}=0D=09if=20(bundleURL=20!=3D=20nil)=20=
{=0D=09=09CFRelease(bundleURL);=0D=09}=09=0D=09if=20(baseURL=20!=3D=20=
nil)=20{=0D=09=09CFRelease(baseURL);=0D=09}=09=0D=09=0D=09return=20err;=0D=
}=0D=0Dstatic=20pascal=20OSErr=20OpenDocumentsEventHandler(=20const=20=
AppleEvent=20*appleEvt,=20AppleEvent*=20reply,=20SInt32=20refcon=20)=0D{=0D=
#pragma=20unused=20(reply,=20refcon)=0D=09OSErr=09=09err;=0D=09=
AEDescList=09documents;=0D=09AEKeyword=09keyWd;=0D=09FSRef=09=09fsRef;=0D=
=09char=09=09fullPath[4096];=0D=09long=09=09i,=20n;=0D=09DescType=09=
typeCd;=0D=09Size=09=09actSz;=0D=09=0D=09AECreateDesc(=20typeNull,=20=
NULL,=200,=20&documents=20);=09=09//=09Initial=20state=0D=09=0D=09err=20=
=3D=20AEGetParamDesc(=20appleEvt,=20keyDirectObject,=20typeAEList,=20=
&documents=20);=09//=09Get=20the=20open=20parameter=0D=09if=20(=20err=20=
!=3D=20noErr=20)=20goto=20Bail;=0D=09=0D=09err=20=3D=20AECountItems(=20=
&documents,=20&n=20);=0D=09if=20(=20err=20!=3D=20noErr=20)=20goto=20=
Bail;=0D=0D=09for=20(=20i=20=3D=201=20;=20i=20<=3D=20n;=20i++=20)=0D=09{=0D=
//=09=09err=20=3D=20AEGetNthPtr(=20&documents,=20i,=20typeFSS,=20&keyWd,=20=
&typeCd,=20(Ptr)=20&fileSpec,=20sizeof(fileSpec),=20(actSz=20=3D=20=
sizeof(fileSpec),=20&actSz)=20);=0D=09=09err=20=3D=20AEGetNthPtr(=20=
&documents,=20i,=20typeFSRef,=20&keyWd,=20&typeCd,=20(Ptr)=20&fsRef,=20=
sizeof(FSRef),=20(actSz=20=3D=20sizeof(fsRef),=20&actSz)=20);=0D=09=09if=20=
=20(=20err=20!=3D=20noErr=20)=20goto=20Bail;=0D=09=09=0D=09=09err=09=3D=20=
FSRefMakePath(=20&fsRef,=20(UInt8*)fullPath,=204096=20);=0D=09=09if=20(=20=
err=20!=3D=20noErr=20)=20goto=20Bail;=0D=09=09=0D=09=09InvokeTool(=20=
fullPath=20);=0D=09}=0D=0DBail:=0D=09AEDisposeDesc(=20&documents=20);=0D=09=
return(=20err=20);=0D}=0D=0D=0Dvoid=20main(void)=0D{=0D=09CFBundleRef=20=09=
=09sysBundle;=0D=09char=09=09=09=09command[256];=0D=09OSStatus=20=09=09=09=
err;=0D=09=0D=09InitCursor();=0D=09=0D=09if=20(=20!=20RunningOnCarbonX()=20=
)=0D=09{=0D=09=09(void)=20Alert(=20128,=20nil=20);=0D=09=09return;=0D=09=
}=0D=09=0D=09err=20=3D=20AEInstallEventHandler(=20kCoreEventClass,=20=
kAEOpenDocuments,=20NewAEEventHandlerUPP(OpenDocumentsEventHandler),=20=
0,=20false=20);=0D=0D=09//=09Load=20the=20"System.framework"=20bundle.=20=
=20Most=20UNIX/BSD=20routines=20are=20in=20the=20System.framework=0D=09=
err=20=3D=20LoadFrameworkBundle(=20CFSTR("System.framework"),=20=
&sysBundle=20);=0D=09if=20(err=20!=3D=20noErr)=20goto=20Bail;=0D=09=0D=09=
//=09Load=20the=20Mach-O=20function=20pointers=20for=20the=20routines=20=
we=20will=20be=20using.=0D=09BSDfread=09=09=3D=20(BSDfreadFuncPtr)=20=
CFBundleGetFunctionPointerForName(=20sysBundle,=20CFSTR("fread")=20);=0D=09=
BSDpopenFunc=09=3D=20(BSDpopenFuncPtr)=20=
CFBundleGetFunctionPointerForName(=20sysBundle,=20CFSTR("popen")=20);=0D=09=
BSDpclose=09=09=3D=20(BSDpcloseFuncPtr)=20=
CFBundleGetFunctionPointerForName(=20sysBundle,=20CFSTR("pclose")=20);=0D=
=09if=20(=20(BSDpopenFunc=20=3D=3D=20nil)=20||=20(BSDpclose=20=3D=3D=20=
nil)=20||=20(BSDfread=20=3D=3D=20nil)=20)=0D=09=09goto=20Bail;=0D=09=0D=09=
//=09Print=20the=20instructions=20to=20the=20SIOUX=20window=0D=09=
printf("LaunchTool\n\n");=0D=09printf("Demonstrates=20how=20to=20run=20=
unix=20tools=20and=20shell=20scripts=20from=20a=20CFM=20Carbon\n");=0D=09=
printf("application.=20=20This=20sample=20demonstrates=20how=20to=20=
create=20a=20simple\n");=0D=09printf("\"Terminal-like\"=20shell.=20=20=
Simply=20enter=20unix=20commands=20or=20shell=20scripts");=0D=09=
printf("into=20the=20SIOUX=20window=20and=20hit=20enter.=20=20Try=20some=20=
simplecommands=20like\n");=0D=09printf("\"ps=20-aux\",=20\"whoami\",=20=
\"ls=20-la\",=20or=20\"banner=20hello\".\n\n");=0D=09printf("Type=20=
command-Q=20to=20Quit.\n\n");=0D=09printf("Ewample:=20moof%=20=
whoami\n");=0D=09=0D=09InvokeTool(=20"whoami"=20);=09=09=09//=09Call=20=
the=20"whoami"=20tool=0D//=09InvokeTool(=20"man=20popen"=20);=09=09//=09=
Lets=20view=20the=20man=20page=20for=20"popen()"=0D=09=0D=09do{=0D=09=09=
printf("moof%=20");=0D=09=09(void)=20gets(=20command=20);=0D=09=09=
InvokeTool(=20command=20);=0D=09}=20while=20(=20true=20);=0D=09=09=0D=09=
Bail:=0D=09;=0D}=0D=0D=0D//=09This=20routine=20does=20the=20interesting=20=
stuff,=20specifically=20the=20routine=20popen()=20loaded=20into=20the=20=
BSDpopenFunc=20function=20pointer=0D//=09effectively=20does=20a=20fork()=20=
and=20execv()=20and=20also=20opens=20a=20stream=20for=20us=20to=20read=20=
output=20from.=0Dvoid=09InvokeTool(=20char=20*toolName=20)=0D{=0D=09FILE=09=
=09=09=09*fp;=0D=09char=09=09=09=09outputS[1024=20*=2024];=09=09=09=09=09=
=09//=0924k=20buffer=0D=09int=09=09=09=09=09bytesRead;=0D=09=0D=09fp=20=3D=
=20BSDpopenFunc(=20toolName,=20"r"=20);=09=09=09=09=09=09=09//=09Find=20=
out=20more=20about=20"popen()",=20type=20"man=20popen"=0D=09if=20(=20fp=20=
=3D=3D=20nil=20)=20return;=0D=0D=09bytesRead=09=3D=20BSDfread(=20=
outputS,=20sizeof(char),=20sizeof(outputS),=20fp=20);=09//=09stdout=20=
gets=20redirected=20to=20this=20FILE*,=20stderr=20still=20goes=20to=20=
the=20console=0D=09outputS[bytesRead]=09=3D=20'\0';=0D=09=0D=09printf(=20=
"\"%s\"=20output:=20\n%s\n",=20toolName,=20outputS=20);=09=09//=09<--=20=
This=20is=20the=20MSL=20printf=0D=0D=09(void)=20BSDpclose(=20fp=20);=09=09=
=09=09=09=09=09=09=09=09//=09Close=20the=20FILE=20stream=0D}=0D=0D|#=0D=0D=
;;;=20=
**************************************************************************=
*=0D;;;=20*=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20End=20of=20File=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20*=0D;;;=20=
**************************************************************************=
*=

--Apple-Mail-6-371858279--

--Apple-Mail-5-371858278
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=ISO-8859-1;
	format=flowed



-=3DBret

Bret Battey                                     http://BatHatMedia.com
----------------------------------------------------------------------
Research Associate
Center for Digital Arts and Experimental Media
University of Washington, Seattle    http://www.washington.edu/dxarts/



On Jan 3, 2004, at 7:14 AM, Rick Taube wrote:

> > Does plotter work on OSX 10.3.2 with MCL 5.0?
> =A0
> When I last tried it worked but I stopped=A0MCL=A0development (or even=20=

> using MCL) until=A0it acts like=A0an osx native app.=A0 I've moved the=20=

> plotter code from the system into its own tarball until I have time to=20=

> figure out how to make a more portable version that will work on linux=20=

> and openmcl.
> =A0
> ftp://ccrma-ftp.stanford.edu/pub/Lisp/cm/sources/plotter.tar.gz
> =A0
> dont forget that you will have to do 'flip -m *' on these sources=20
> before you load them.
> Someone on the list (sorry I cant remember who) has some code that=20
> outputs to gnuplot -- this might also be of use if you just want to=20
> see the data.
>

--Apple-Mail-5-371858278--