[comp.sys.amiga] Initial posting of MandelVroom

orandy@amdahl.UUCP (05/20/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# MandVroom.uue

echo x - MandVroom.uue
cat > "MandVroom.uue" << '//E*O*F MandVroom.uue//'
begin 755 MandelVroom
M   #\P         #          (  "((   (#     $   /I   B"$[Z=B)0
M:6-T=7)E $Y5  !.NDPJ3KH_FB\L@#Y.K( L6$](;(K>+RR /DZL@#A03W  
M$"R<Z& *3KH"NF ,829@"$J 9_)3@&?T+RR /DZL@"Q83TALBDXO+( ^3JR 
M.%!/3EU.=4Y5^<I(YP\ *WP    @_^Q"K?_\*WP   0%__A@/F :("W__"!L
MC18B+?_X4ZW_^$/M^<H3L @ &  @+?_\XX @;(SP,C ( $C!)"W_^+2!;09*
MK?_X9LA2K?_\#*T    @__QMN$JM__AM$B M__A3K?_X0>WYRD(P" !@Z$ZZ
M!:Y"IR!L@#XO*  R3JR (%!/(&R /C H  I(P%6 +P B;( ^,BD "$C!+$%(
M;O_T2'@ "TAX  0L;( ^+RX ,DZL@!I/[P 4*VR D/W03KH& BML@';_Y$*M
M__Q@  &4*VR <O_H0JW_^&   6)^ "P'*@<H!T*M__1@  "R+&R<ZD'M_=Q#
M[?[<0JW_\"#$(L4@!"(%3J[_LB( 3J[_OB(M_^1.KO^^*@ @!B('3J[_N"(M
M_^A.KO^^*  B $ZN_[(L " %(@5.KO^R+@ B!DZN_[XB/(   $-.KO_6;FQ2
MK?_P("W_\+"M_^QMH$'M_=Q#[?[<0JW_\+B89ABZF686,"R BDC *T#_]"M\
M     /_P8#98B5*M__ @+?_PL*W_[&W4("W_[-&M__0P+("*2, B+?_TLH!M
M /]"0JW_]# L@(I(P"M __ @+?_PT*W_]$'M^<IR !(P"  O 2\LG.Y.K( @
M4$\@;?_\2&@ "R M__A8@"\ +RR<[DZL@"9/[P ,2JW]T&<2("W_]-"M__ @
M;?W05*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<]B\LG/HO+)S^3KH85D_O !!"
M;(":8'(P+)U22, R+)T.2,%T ^.B)BR<\I:"L(-M6#8LG5!(PS0LG0Q(PG(#
MY:$@;)SVD<&VB&T^,"R=4$C (BR<]I* .4&=5# LG5)(P"(LG/*2@#E!G58Y
M?  5G0HO+)SR+RR<]B\LG/HO+)S^3KH7WD_O !!*;)T*9Q@@;( ^("@ 4@C 
M  0O "\L@#Y.NG>"4$].74YU3E7__'  ,"R="F   CY.NC8&8  "3"\LG/(O
M+)SV+RR<^B\LG/Y.NA;>3^\ $# M  I(P+"LG/YL!CMLG0  "C M  Y(P+"L
MG/IL!CMLG/P #C M  I(P#(LG51(P="!-"R C$C"6(*P@F\4,"R C$C 6( R
M+)U42,&0@3M   HP+0 .2, R+)U62,'0@30L@(Y(PM2\    "["";Q@P+(".
M2,#0O     LR+)U62,&0@3M   XP+0 .2, O #(M  I(P2\!+RR<^B\LG/Y.
MNA8V3^\ $# M  Y(P"E G/(P+0 *2, I0)SV8  !="\LG/(O+)SV+RR<^B\L
MG/Y.NA8&3^\ $" LG/:0K)S^,BR=5$C!D($[0/_^("R<\I"LG/HR+)U62,&0
M@3M __P,;0 !  YL!CM\  $ #C M  I(P#(LG51(P9"!L+P    $; PP+)U4
M2,!8@#M   HP+0 .2, R+)U62,&0@;"\    "VP0,"R=5DC T+P    +.T  
M#C M  I(P#(M__Y(P="!-"R C$C"6(*P@F\4,"R C$C 6( R+?_^2,&0@3M 
M  HP+0 .2, R+?_\2,'0@30L@(Y(PM2\    "["";Q@P+(".2,#0O     LR
M+?_\2,&0@3M   XP+0 *2, R+)U42,&0@2E G/XP+0 .2, R+)U62,&0@2E 
MG/HP+0 *2, R+?_^2,'0@2E G/8P+0 .2, R+?_\2,'0@2E G/(O+)SR+RR<
M]B\LG/HO+)S^3KH4Q$_O !!@%I"\    %6< _<13@&< _;93@&< _I!.74YU
M3E7_7'  ,"T "NJ(P+P    _8  !YDAX  %.NA) 6$](;(#L2&R G$AZ >8O
M+(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? $ @(I@
M+CE\ @" BF F.7P#_X"*8![_M/^\_\3_S/_4_]RPO     9D"N. ,#L Z$[[
M  !@(/\2_J+^X/[Z_X#^Z/ZJL+P    '9 KC@# [ .9.^P  3EU.=4Y5  !P
M # M  IR"^*HP+P    ?8   BC LBQK ?(  9PXY? % BQ(";'__BQI@(#E\
M H"+$@!L@ "+&@BL  >+&PQL  2+%F\&.7P !(L68%P(+  "BQMG#@BL  *+
M&SE\ ,B+%& ,".P  HL;.7P!D(L48#@(+  'BQMG#@BL  >+&SE\  6+%F 2
M".P !XL; FQ__XL:.7P !HL68 Y*@&< _W13@&>H4X!GR&$(3KH H$Y=3G5.
M5?_^0FW__F   ((P+?_^P?P (D'L@];1P B0   P+?_^2,!@5C LBQK ?(  
M9Q(P+?_^P?P (D'L@];1P C0  !@1 @L  *+&V<2,"W__L'\ ")![(/6T< (
MT   8"@(+  'BQMG$C M__[!_  B0>R#UM' "-   & ,2H!GIE. 9\!3@&?8
M4FW__@QM  +__F\ _WA.74YU3E7__D)M__Y@%C M__[!_  B0>R$M-' ")  
M %)M__X,;0 &__YOXC LBQ9(P%. <B).NFRH0>R$M-' "-   $Y=3G5.5?_^
M0FW__F 6,"W__L'\ ")![(-6T< (D   4FW__@QM  '__F_B<  0+)SH<B).
MNFQF0>R#5M' "-   $Y=3G5.5?_^0FW__F 6,"W__L'\ ")![(7XT< (D   
M4FW__@QM  '__F_B#&P (("*;@@([   A?A@3@QL $" BFX(".P  (8:8#X,
M; " @(IN" CL  "&/& N#&P! ("*;@@([   AEY@'@QL @" BFX(".P  (: 
M8 X,; 0 @(IN!@CL  "&HDY=3G5-04Y$ $E,0DT 3&]A9 !3879E $=E;F5R
M871E $YE=U-C<F5E;@!1=6ET $]P96X 0VQO<V4  $EN=&5G97( 1D90 $A)
M4D53 $E.5$523$%#10!(04Q&0E))5$4 ,2U":710;&%N90 R+4)I=%!L86YE
M<P S+4)I=%!L86YE<P T+4)I=%!L86YE<P U+4)I=%!L86YE<P V+4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DAX "PO+?_\3JR "%!/< !@T# M
M  I(P'( ,BR=#..@(&W__#%   0P+0 .2,!R #(LG0[CH"!M__PQ0  &,"T 
M$DC <@ R+)T,XZ @;?_\,4  "# M !9(P'( ,BR=#N.@(&W__#%   H@;?_\
M,7P !  ,(&W__#%\  ( #B!M__PA;?_X !(@;?_\,7P  0 0(&W__#%M !X 
M)C M !)(P'( ,BR=#..@(&W_^#%   0P+0 62,!R #(LG0[CH"!M__@Q0  &
M(&W_^!%M !L #R M__Q@ /\*3E7_]$AY  $  $AX "Q.K( "4$\K0/_\2JW_
M_&8&< !.74YU2'D  0 "2'@ %$ZL@ )03RM __1*K?_T9A)(>  L+RW__$ZL
M@ A03W  8-!(>0 !  !(>  63JR  E!/*T#_^$JM__AF($AX "PO+?_\3JR 
M"%!/2'@ %"\M__1.K( (4$]P &"6,"T "DC <@ R+)T,XZ @;?_\,4  !# M
M  Y(P'( ,BR=#N.@(&W__#%   8P+0 22,!R #(LG0SCH"!M__PQ0  (,"T 
M%DC <@ R+)T.XZ @;?_\,4  "B!M__PQ?  &  P@;?_\,7P  0 .(&W__#%\
M  , $"!M__PA;?_T !(@;?_\(6W_]  6(&W__"%M__@ (B!M__PQ;0 : "8@
M;?_T$7P  0 /<  P+)T,<@3AH2!M__0Q00 $<  P+)T.<@/AH2!M__0Q00 &
M(&W_^#"\  P@+?_\8 #^O$Y5__Q(>0 !  !(>  43JR  E!/*T#__$JM__QF
M!G  3EU.=2!M__P0K0 7(&W__!%M !L  2!M__P1;0 ?  (P+0 .2,!R #(L
MG0SCH"!M__PQ0  $,"T $DC <@ R+)T.XZ @;?_\,4  !B!M__PA;0 (  P@
M+?_\8*1.5?_\2JT "&=R(&T "$JH !)G$DAX !0@;0 (+R@ $DZL@ A03R!M
M  A*J  B9Q)(>  6(&T ""\H ").K( (4$\@;0 (2J@ &F<22'@ %"!M  @O
M*  :3JR "%!/(&T ""M0__Q(>  L+RT "$ZL@ A03RMM__P "&"(3EU.=4Y5
M__1(>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,&0@2M __0@+?_@4X K0/_X,"W__$C (CP  /__X*D[0?_^,"W_[$C T*T 
M"#(M__!(P9"!*T#_V$CG__XB33-L@([_ZB!I_]0@*?_<XX D:  (U< F:  ,
MU\ H:  0V< J:  4V\ L:  8W< @:?_8<@$^*?_\M4*W0[E$NT6]1A 8XB#5
M0N(@UT/B(-E$XB#;1>(@W4:>06[F,"G__L%2P5/!5,%5P58P/  0D&G__.%B
MX6/A9.%EX6:%6H=;B5R+78U>("G_^-" U<#7P-G V\#=P-'I__23:?_J2FG_
MZFZ03-]__TY=3G5.5?O<*VR D/_D,"R BDC *T#_^$*M__Q@/F :("W__"!L
MC18B+?_X4ZW_^$/M^]X3L @ &  @+?_\XX @;(SP,C ( $C!)"W_^+2!;09*
MK?_X;,A2K?_\#*T    @__QL!DJM__ALLDJM__AM$B M__A3K?_X0>W[WD(P
M" !@Z!M\ /_[W3 L@(Q(P%B *T#_[# L@(Y(P-"\    "RM _^@K?     O_
M\&!L*WP    $__1@5"!M_^14K?_D,!!#[?O>&W$  /O<$"W[W+ M^]UG&'  
M$"W[W"\ +RR<[DZL@"!03QMM^]S[W4HM^]QG%"\M__ O+?_T+RR<[DZL@"9/
M[P ,4JW_]" M__2PK?_L;:)2K?_P("W_\+"M_^AMBDY=3G5.5?_H0BW_[4*G
M2'@1 DAX "!(>  $2'@ &DAX .1.NN5$3^\ &"M __0K0/_\2JW_]&<  ^)"
M;?_N0FW_\&   +YP # M__ @0$AH$0!(>  !2'@ !DAX  9R #(M_^XB04AI
M  Y(> #J3KKCX$_O !@K0/_X2JW_^&<  YIP # M__!@4$*G2'@  TAX  -(
M>/__2'@ "DAZ XI.NN8L3^\ &"!M__@A0  :8#!"ITAX  -(>  #2'C__TAX
M  I(>@-J3KKF!$_O !@@;?_X(4  &F (2H!GK%. 9] @;?_T(*W_^"MM__C_
M] 9M  K_[C M__!2;?_P<@ R  QM  +_\&4 _SQ";?_N0FW_\&!V<  P+?_N
M($!(:!  ,BW_[D/LC/9T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0^Y03SM __YP # M__XO '( ,BW__NB)+P%T #0M__[@
MBB\"=@ V+?_Z+P,O+)UV3KI$(D_O !1@  $><  P+?_Z+P!R #(LG5PO 4ZZ
M 3103V   01P # LG5PO "!LG78O*  $3KI#AE!/.T#__G  ,"W_^B\ (&R=
M=B\H  1.ND-L4$\[0/_\<  P+?_\+P!R #(M__SHB2\!=  T+?_\X(HO G8 
M-BR=7"\#+RR==DZZ0Z!/[P 4<  P+?_^+P!R #(M__[HB2\!=  T+?_^X(HO
M G8 -BW_^B\#+RR==DZZ0W!/[P 48&QP # LG5KE@$'LGK(B< @ *VD $O_V
M(&W_]A%M__L #TAX  %"IR\LG0)P # LG5KE@$'LGK(O, @ 3KI$@$_O ! P
M+)U:(&R-%A&M__L  & :58!GJI"\    "6< _J13@&< _NQ3@&< _P Y;?_Z
MG5QP # M__HO $ZZ N183TAX  %P # M__HO $ZZ [Y03TY=3G5.5?_:,"T 
M"K!M  YO$CMM  K__CMM  X "CMM__X #C M  I(P#(M  Y(P5.!L(%M!$Y=
M3G4P+0 *2, O "!LG78O*  $3KI")%!/.T#_['  ,"W_[."(P+P    /.T#_
MZG  ,"W_[.B(P+P    /.T#_Z'  ,"W_[,"\    #SM _^8P+0 .2, O "!L
MG78O*  $3KI!UE!/.T#_['  ,"W_[."(P+P    /.T#_Y'  ,"W_[.B(P+P 
M   /.T#_XG  ,"W_[,"\    #SM _^ P+?_D2, R+?_J2,&0@700Y: K0/_Z
M,BT #DC!,"T "DC DH @+?_Z3KHX8"M __8P+?_B2, R+?_H2,&0@700Y: K
M0/_Z,BT #DC!,"T "DC DH @+?_Z3KHX,"M __(P+?_@2, R+?_F2,&0@700
MY: K0/_Z,BT #DC!,"T "DC DH @+?_Z3KHX "M _^XP+0 *2,!2@#M __Y@
M  #4,"W__DC ,BT "DC!D($B+?_V3KH^]M"\  "  '00Y*@[0/_D,"W_ZDC 
M,BW_Y$C!T($[0/_>,"W__DC ,BT "DC!D($B+?_R3KH^P-"\  "  '00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_YQ*K?^<
M9@Y(;?_$3KH'6EA/*T#_G" M_YQ.74YU3E7__" M  Q3@"!M  A2K0 ($(!2
MK)V.0JW__& <("W__$'LGS(B;0 (4JT "!*P" !2K)V.4JW__" M__RPK0 ,
M;=H@+0 (3EU.=4Y5   @+0 ,4X!$@"!M  A2K0 ($(!2K)V.(&T "%*M  @0
MK0 34JR=CB M  A.74YU3E7_\$(M__9";?_T0FW_\D)M__ @;0 (*U#__"!M
M  PK4/_X0JR=CB!M__Q2K?_\&U#_]QMM__?_]AEM__>?,CM\  '_\E.M !!@
M  $T(&W__%*M__P;4/_W,"W_\E)M__)#[)\R$ZW_]P  ,"W_]$C 8   ^ QM
M (#_\F\L,"W_\DC 4X O "\M__A.NO[T4$\K0/_X&6W_]Y\R.WP  ?_R0FW_
M\&   ,X0+?_WL"W_]F9(,"W_\DC ,BW_\$C!D(&PO     -M)$IM__!O%C M
M__!(P"\ +RW_^$ZZ_J103RM __@[?  !__1@#$IM__!F!CM\  '_]& ,,"W_
M\DC 4X [0/_P8&P0+?_WL"W_]F86,BW_\DC!-"W_\$C"DH*RO    (!O0! M
M__9(@$C +P R+?_R2,%3@30M__!(PI*"+P$O+?_X3KK^@D_O  PK0/_X&6W_
M]Y\R.WP  ?_R0FW_\$)M__1@"DJ 9P#_!E. 9Y0;;?_W__93K0 02JT $&8 
M_L@P+?_T2,!@1# M__)(P"\ +RW_^$ZZ_>103RM __A@-! M__9(@$C +P R
M+?_R2,$T+?_P2,*2@B\!+RW_^$ZZ_@9/[P ,*T#_^& (2H!GN%. 9\P@;0 (
M(*W__"!M  P@K?_X("R=CDY=3G5.50  2.<(("1M  @@;0 ,.! P!$C YX T
M@"!M  PU:  "  )":@ &0FH !"!M  P5:  %  @5;0 3  D5;0 7  I"*@ +
M-6T &@ ,%7P  0 /%7P  0 .-6T '@ 0-6T (@ 2.WP!0  >9S8P+0 B2,!@
M'!5\  H #A5\  L #V >%7P %  .%7P "P /8!"0O    ,AGW)"\    R&?B
M8#P[? *  !YG-# M ")(P& <%7P !0 .%7P "P /8!X5?  *  X5?  +  ]@
M$)"\    R&?<D+P   #(9^((!   9P1P^F "< !,WP003EU.=4Y5__@O! PM
M  8 $V,&&WP !@ 3<  0+0 3> 'AI'(#( 1.NA[&+P!(>4--05 O+0 (3KH$
MD$_O  PK0/_\2JW__&<*("W__"@?3EU.=6!D(&T ## 02,#H@,"\    \!M 
M__@@;0 ,,!!(P,"\    \!M __D@;0 ,,!!(P.F P+P   #P&T#_^DAX  -(
M;?_X+RT "$ZZ!/9/[P ,*T#__$JM__QG!B M__Q@FE2M  Q3A$J$9I@O+0 (
M3KH%3EA/*T#__" M__Q@ /]\3E7_SDCG#@ @;0 ,<  P$"M __@@;0 4<  0
M*  (*T#_]"!M !0;:  *__,@+?_XT+P   !_[H#0K?_X(BT '+* ;4P,+0 !
M__-B1"!M  PB;0 4-"@  K1I  )F,BQM !1V #86UKP    /Z(OC@[:M__AF
M&BQM  QV !8N  6VK?_T90H,K0    ;_]&\*</I,WP!P3EU.=4JM !!F!'  
M8 )P ="M__0K0/_N> !@&B $Y8 @0-'M  P@!.6 0^W_SB.H  @( %*$N*W_
M]&W@2JT $&<0("W_].6 0>W_SB&M ! ( $AY@    4AY0D]$62\M  A.N@+\
M3^\ #"M __Q*K?_\9P8@+?_\8((@;0 4<  P*  "*@!@  "4> !@  "$2BW_
M\V8R+RW_^" $Y8!![?_.+S ( "\M  A.N@-^3^\ #"M __P@!.6 0>W_SM' 
M(BW_^-.08#HK;0 8_^HO+?_X2&W_ZB $Y8!![?_.T(@O $ZZ^M)/[P ,+  O
M!B\M !@O+0 (3KH#,D_O  PK0/_\2JW__&<(("W__&  _NY2A+BM_^YM /]X
M4X5*A6X _VHO+0 (3KH#@%A/*T#__" M__Q@ /[&3E4  $CG"" D;0 ,> !"
MDD*J  0E;0 (  A"J@ ,)6T $  00JH %$*J "!"J@ 82'C__T*G+RT "$ZZ
M'.1/[P ,2H!L!'C]8!0,K8    $ $&<*""T    39P)X^B $3-\$$$Y=3G5.
M50  +P0O+0 0+RT #"\M  A.N@&L3^\ #"@ 2H1F%DAX  1(;0 4+RT "$ZZ
M EQ/[P ,* !*A&8.+RT &"\M  AA#%!/*  @!"@?3EU.=4Y5  !(YPPP)&T 
M""9M  QZ ":*)VH !  $)VH "  ()VH #  ,)VH $  00JL %$*K "!"JP 8
M#*J    ! !AG)" J !B0J@ @* #8JP ,#*N    ! !!G"" K !"PA&\$)T0 
M$$JJ !1G&@@K    #V82#*N    ! !!G"@@K    $V<">OH@!4S?##!.74YU
M3E7__"\*)&T "$*M__Q*J@ 49PHK?/____K__& H2I)F#& (*WS____]__Q@
M&"!2(E(@*@ ,D*D #-&H " @4B%J  P #" M__PD7TY=3G5.50  2.<(("!M
M  @D4"\M  AAG%A/* !*A&8*+PI.N@&V6$\H " $3-\$$$Y=3G5.50  +P1X
M  RM@    0 09@)X^DJ$9A0O+0 0+RT #"\M  AA.$_O  PH $J$9A8O+0 0
M+RT %"\M  A.N@#J3^\ #"@ 2H1F#"\M  A.N@%66$\H " $*!].74YU3E7_
M_"\*)&T ""M\    "/_\2JH %&8&2JT #&X(</HD7TY=3G5*DF8P("T #& &
M8!YP^F#JD+Q#050@9_*0O ,-_BUGZI"\!?H!!V?B8.)*J@ ,9P1P^F#&#*V 
M   ! !!G$DJM !!L!'#Z8+(@+0 0T:W__ RJ@    0 09Q(@*@ ,T*W__+"J
M !!O!'#Z8(XE;0 , !0E;0 0 !A"J@ @2'@ "$AJ !0O*@ (3KH::D_O  Q*
M@&P&</U@ /]B4*H #'  8 #_6$Y5   O"B1M  A*J@ 49S9*K0 0;3 ,JH  
M  $ $&<.("H #-"M !"PJ@ 0;A@,JH    $ &&<6(BH (-*M !"RJ@ 8;PAP
M^B1?3EU.=2\M ! O+0 ,+RH "$ZZ&?1/[P ,2H!L!'#]8-X@+0 0T:H (" M
M !#1J@ ,< !@RDY5__XO"B1M  A";?_^2JH %&8(</HD7TY=3G4,JH    $ 
M&&900J<@*@ @6(!$@"\ +RH "$ZZ&7A/[P ,2H!M+DAX  1(:@ @+RH "$ZZ
M&8)/[P ,2H!M%D*G+RH ("\J  A.NAE*3^\ #$J ; 1P_6"B8 X@*@ 8L*H 
M(&<$</I@D@@J    (V<B2'@  4AM__XO*@ (3KH9.$_O  Q*@&P&</U@ /]N
M4JH #$*J !1"J@ @0JH &'  8 #_6$Y5   O!"EM  B<X$AM ! O+0 ,2'H 
M&DZZ -A/[P ,*  @;)S@0A @!"@?3EU.=4Y5   @;)S@4JR<X! M  L0@$B 
M2,# O    /].74YU3E4  $AM  PO+0 (2'H16DZZ )!/[P ,3EU.=4Y5  !(
MYP@@)&T $ RM    !  49@@@;0 (*!!@%$JM  QO""!M  @H$& &(&T ""@0
M0JT %$JM  QL$D2M  Q*A&P*1(0K?     $ %"(M  P@!$ZZ$'Y![)E84XH4
ML @ (BT #" $3KH0=B@ 9MY*K0 49P93BA2\ "T@"DS?!!!.74YU3E7_%$CG
M"# D;0 ()FT #$*M__@K;0 0__P@2U*+$!!(@$C * !G  .BN+P    E9@ #
M?$(M_R(K?     '_]"M\    (/_P*WP  "<0_^P@2U*+$!!(@$C * "PO   
M "UF$$*M__0@2U*+$!!(@$C * "XO    #!F%"M\    ,/_P($M2BQ 02(!(
MP"@ N+P    J9AH@;?_\6*W__"M0_^@@2U*+$!!(@$C * !@-$*M_^A@(G(*
M("W_Z$ZZ%FS0A)"\    ,"M _^@@2U*+$!!(@$C * !![)G["#   D@ 9M*X
MO    "YF8B!+4HL0$$B 2, H +"\    *F8:(&W__%BM__PK4/_L($M2BQ 0
M2(!(P"@ 8#1"K?_L8")R"B M_^Q.NA8"T(20O    # K0/_L($M2BQ 02(!(
MP"@ 0>R9^P@P  )( &;2*WP    $_^2XO    &QF%B!+4HL0$$B 2, H "M\
M    !/_D8!2XO    &AF#"!+4HL0$$B 2, H " $8  ! "M\    "/_@8!PK
M?     K_X& 2*WP    0_^!@""M\____]O_@+RW_Y$AM_R(O+?_@+RW__$ZZ
M_;)/[P 0*T#_W" M_^31K?_\8   RB!M__Q8K?_\*U#_W"\M_]Q.N@[$6$\K
M0/_D8   N"!$2&C_FPRM   G$/_L9@1P!F $("W_["\ 2&W_%")M__Q0K?_\
M0J<O$4ZZ :I/[P 40>W_%"M(_]PO"$ZZ#GI83RM _^0K?    ,C_[&!F(&W_
M_%BM__PH$$'M_R$K2/_<$(1@1/^H_PK_6/]8_UC_LO^R_[+_LO^R_[+_LO[L
M_[+_LO^R_SK_LO[V_[+_LO\ D+P   !CL+P    69+KC@# [ ,).^P  0>W_
M(I'M_]PK2/_D("W_Y+"M_^QO!BMM_^S_Y$JM__1G<"!M_]P,$  M9PHB;?_<
M#!$ *V8T#*T    P__!F*E.M_^@@;?_<4JW_W! 02(!(P"\ 3I)83["\____
M_V8*</],WPP03EU.=6 8+RW_\$Z26$^PO/____]F!'#_8.)2K?_X("W_Z%.M
M_^BPK?_D;MI"K?_@8"0@;?_<4JW_W! 02(!(P"\ 3I)83["\_____V8$</]@
MJE*M_^ @;?_<2A!G"B M_^"PK?_L;<H@+?_@T:W_^$JM__1F*F :2'@ ($Z2
M6$^PO/____]F!G#_8 #_<%*M__@@+?_H4ZW_Z+"M_^1NV& 8+P1.DEA/L+S_
M____9@9P_V  _TA2K?_X8 #\4B M__A@ /\X3E7_\$CG"# D;0 00>R9:B9(
M("T %%* *T#_\$*M__PB+0 (3KH"8&P4("T "$ZZ DPK0  (($I2BA"\ "TB
M+0 (3KH"0F]"(BL !" M  A.N@(@;!0B$R M  A.N@):*T  "%.M__Q@WB(3
M("T "$ZZ @!M%"(3("T "$ZZ B8K0  (4JW__&#@#*T    " !AF("MM !3_
M\ RM_____/_\;0H@+?_\L*T %&\$0JT && 2#*T    ! !AF"" M__S1K?_P
M2JW_\&U"#*T    0__!O!' 08 0@+?_P4H#E@"(S"  @+0 (3KH!?"M   @B
M$TZZ 7QM%"MK  0 "%*M__Q*K0 89P12K?_P2JT &&=.2JW__&P\($I2BA"\
M # @2E**$+P +B M__Q$@"@ 4X1*K?_P;@0H+0 4( 13A$J 9PH@2E**$+P 
M,&#N0JW_]& *("W__%* *T#_]& (*WP    !__1*K?_P;VIX +B\    $&PZ
M("T "$ZZ 1 K0/_X("W_^-"\    ,"!*4HH0@" M__A.N@$2(@ @+0 (3KH 
M]"(33KH!#"M   A@""!*4HH0O  P4ZW_\&<82JW_]&<.4ZW_]&8(($I2BA"\
M "Y2A&"82JT &&9^($I2BA"\ &5*K?_\; Y$K?_\($I2BA"\ "U@""!*4HH0
MO  K#*T   !D__QM)')D("W__$ZZ"B30O    # @2E**$(!R9" M__Q.N@HV
M*T#__'(*("W__$ZZ"@#0O    # @2E**$(!R"B M__Q.N@H2T+P    P($I2
MBA" 0A),WPP03EU.=2\\____OD[Z %(O//___]9.^@!(+SS____$3OH /B\\
M____T$[Z #0O//___^).^@ J+SS___^X3OH ("\\____K$[Z !8O//___]Q.
M^@ ,+SS___^R3OH  DJLG.IF.$CGP,!"ITAZ $A.NA(&4$\I0)SJ9AXO/   
M !!(>@!"3KH1+"\ 3KH18BZ\     4ZZ#P1,WP,#+P@@;P $+TX !"QLG.I.
MMH@ 3-]! $YU;6%T:&9F<"YL:6)R87)Y &YO(&UA=&@@;&EB<F%R>0I.5?_\
M2.<,("1M  A"K?_\8#8J+0 ,8"@O+0 43KH C%A/* "PO/____]F#" M__Q,
MWP0P3EU.=2!*4HH0A%.%2H5FU%*M__P@+?_\L*T $&W ("W__&#83E4  $CG
M#" D;0 (> !@-GH 8"HO+0 4($I2BA 02(!(P"\ 3KH)FE!/L+S_____9@IP
M $S?!#!.74YU4H6ZK0 ,9=!2A+BM !!EQ" M !!@XDY5   O"B1M  @@4K'J
M  1E#"\*81I83R1?3EU.=2!24I(0$$B 2,# O    /]@Z$Y5  !(YP@P)&T 
M"! J  S /  89PIP_TS?#!!.74YU"*H  @ ,2JH "&8(+PI.N@LH6$\0*@ ,
M2(!(P @   =G-D'LFGPF2! K  Q(@$C P+P   "$L+P   "$9@Q(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O"F%64$\H ! J  U(
M@$C +P!.N@4(6$^(@ @J  $ #&<*+RH "$ZZ CQ83P@J  4 #&<4+RH $DZZ
M MA83R\J !).N@(@6$]"DD*J  1"J@ (0BH #" $8(Q.5?_^2.<(("1M  A!
M^O]"*4B=0 @J  0 #&<*</],WP003EU.=0@J  ( #&<R*!*8J@ (+P0O*@ (
M$"H #4B 2, O $ZZ I9/[P ,L(1G$ CJ  0 #$*20JH !'#_8+X,K?____\ 
M#&80"*H  @ ,0I)"J@ $< !@I$JJ  AF""\*3KH I%A/#&H  0 09C ;;0 /
M__](>  !2&W__Q J  U(@$C +P!.N@(R3^\ #+"\     6:8("T #&  _V D
MJ@ (,"H $$C T*H ""5   0(Z@ "  P@4E*2$"T #Q" 2(!(P,"\    _V  
M_S!.50  +PI![)I\)$A**@ ,9QC5_    !9![)PTM<AE"'  )%].74YU8.)"
MDD*J  1"J@ (( I@ZDY5__PO"B1M  A(> 0 3KH PEA/*T#__&88-7P  0 0
M( K0O     XE0  ()%].74YU-7P$   0".H  0 ,)6W__  ($"H #4B 2, O
M $ZZ -Y83TJ 9P8 *@"   Q@S$Y5  !(YP P)&R<Y& 4)E(@*@ $4( O "\*
M3KH$T%!/)$L@"F;H0JR<Y$S?# !.74YU3E4  "\*0?K_QBE(G41"IR M  A0
M@"\ 3KH$=E!/)$!*@&8(<  D7TY=3G4DK)SD)6T "  $*4J<Y" *4(!@YDY5
M   O+0 (8;983TY=3G5.50  2.< ,)?+)&R<Y& .(&T "%&(L<IG$B9*)%(@
M"F;N</],WPP 3EU.=2 +9P0FDF $*5*<Y" J  10@"\ +PI.N@0F4$]P &#8
M3E4  "\*<@8@+0 (3KH"M"1 U>R=($JM  AM$C LG#1(P"(M  BR@&P$2I)F
M$"E\     IT0</\D7TY=3G5R!B M  A.N@)\(&R=("\P" !.N@+\6$]*@&<$
M< %@ G  8-9.50  +RT "$ZZ J)83TJ 9@Y.N@+0*4"=$'#_3EU.=7  8/A.
M50  2.<,("@M  A.N@!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P $3.\  P (+&R=;D[N_N @
M;P $+&R=;D[N_L@      ^P    !     0  =I@        #\@   ^H   <-
M3OD  (4H3OD  (523OD  (5F3OD  (6>3OD  (8>3OD  (8P3OD  (9B3OD 
M (;>3OD  (<.3OD  (?*          $ 4 !0  $   %H   2!0          
M    !            %  4 %  ,@ #X   ,*   #"@   0H   $+*18@\N-A:
M/ /_ %$ 3@                                                  
M                                                            
M            9&8Q.@                                          
M                                                            
M 0    0  @       !@N       !    !  "        &#,        !A  8
M  X *  , )(        !.@                      &  : "@ # "2    
M     4X                  0    0  @       !@X       !    !  "
M        &#T       $    $  (        80@       0    (  @      
M !A+       !     @ "        &%4        "+       :@ . 98     
M   !I@    !L             DX    . &H #@"2         ;H         
M  %B      )P    ' !J  X E@        '.     &<            "D@  
M "H :@ . )8        !X@    !N                   X &H #@"6    
M     ?8     <0           0    0  @       !A:       !    !  "
M        &%\        "_@ 8  X ,  , )(        "M               
M        &  : #  # "2         L@                  0   !   @  
M     !AF       !    $  "        &&X        #:@ 8  X 9  , 9< 
M   "   #(     !I                &  : &0 # "7     0   S0     
M9@           0   !   @       !AR       !    $  "        &'@ 
M      $    0  (        8@@        /J !@ #@!8  P DP        .,
M     &$            $#  8 !H 6  , ),        #H     !A        
M        &  F %@ # "3         [0     80           0   !   @  
M     !B,       !    $  "        &)<       $    0  (        8
MHP       0   !   @       !BO       !    $  "        &+L     
M  $    0  (        8QP        3( !@ #@"(  P EP   #X   0N    
M #$            $Z@ 8 !H B  , )<    ]   $0@     R            
M!0P &  F (@ # "7    .P  !%8     ,P            4N !@ ,@"(  P 
MEP   #<   1J     #0            %4  8 #X B  , 9<    O   $?@  
M   U                & !* (@ # "7    'P  !)(     -@          
M 0   !   @       !C4       !    $  "        &-<       $    0
M  (        8V@       0   !   @       !C>       !    $  "    
M    &.(       $    0  (        8Y@        8, !@ #@ P  P DP  
M #X   5R     #$            &+@ 8 !H ,  , ),    ]   %A@     R
M            !E  &  F #  # "3    .P  !9H     ,P            9R
M !@ ,@ P  P DP   #<   6N     #0            &E  8 #X ,  , ), 
M   O   %P@     U                & !* #  # &3    'P  !=8     
M-@           0    0  @       !CL       !    !  "        &/$ 
M      $    $  (        8^        0    0  @       !D!       !
M    !  "        &0L       $    $  (        9&0       0    0 
M @       !DB        !V0      &@ #@"2        !K8           +<
M      >&    #@!H  X!E@        ;*     &,            'J    !P 
M:  . )8        &W@    !K            !\H    J &@ #@"2        
M!O(           -(      ?L    . !H  X D@        <&     #     %
MZ@     (#@   $8 :  . )(        '&@     P     \@           !4
M &@ #@"2        !RX     ,     2F     0    0  @       !DH    
M   !    !  "        &3$       $    $  (        9.@       0  
M  0  @       !E(       !    !  "        &4X       $    $  ( 
M       96        0    0  @       !E?       !    !  "        
M&6D       $    $  (        9=0       0    0  @       !F     
M    "1H      (( #@"2        "#      <             D\    #@""
M  X D@        A$     '             )7@   !P @@ . )(        (
M6     !P            "8     J (( #@"2        "&P     <       
M      FB    . ""  X D@        B      '             )Q    $8 
M@@ . )(        (E     !P            ">8   !4 (( #@"2        
M"*@     <             H(    8@""  X D@        B\     '      
M       **@   '  @@ . )(        (T     !P                  !^
M (( #@"2        ".0     <             IJ  0    X  @  0  &8P 
M  (*              J( $0    @  @  0  &90   ="                
M &P   !   @  0  &9D   CX             0    0  @       !FB    
M             #P # "6        "J8     <P                0    X
M  @  0  &:@   JZ                                         4  
MR  %  $    /        &;                "       !0 "  (@(6 %^"
M" (9$Q%2$?X0"# *! 0<!@ &% <$! 0$  P$+ 0 #!P"( 8P > %\ R /X  
M  B           "      0!1 "  (@(6 %^"_GH! Y/> 3(0C" *5(1, A"&
M! ,4A 0 $,P$(#QX! 0"( 8P > %\ R /X    B            /X   &# '
MP' 8#^# "#_PG@Q_\(0&?_B( G_\'@/__(#Q?_Z (7_^0$ __X#Q?_[  3_^
M8 ,?_# &#_@8# ?P!Q@ X !P#X 8$ ?@"" '0 _P    ( / !! #X ,0 .  
MX           #_\ "@M$    P W0#P     ! 0  !0 4                
M  $!   %  ,        F%@       0$   4  P       "8:       #  , 
M P   '@!0 #(  $  !-@  ( 3@                           %  4 % 
M ,@ #P/_ _\ @ !  "  &P : !D &  7 !8 %0 4 !, $@ 1 !  #P .  T 
M#  +  H "0 (  < !@ %  0  P "  $     #*X (  ! @,$!08'" D*"PP-
M#@\0$1(3%!46%Q@9&AL<'1X?   ,] !Z    6@!X  $  !-P  ( 3@      
M      !!'            %  4 !0 %  #P  #_\-WPN_"9\'? 5: S<!% ,W
M!5H'? F?"[\,SP[O   /_P__#N\.[PW?#=\,SPS/"9\(C09K!5H#. (F#_\#
M_P$; 0$ YP#- +0 F@"  &< 9 !? %H 50!0 $L 10 C !\ '  9 !4 $@ /
M  L !P &  4 !  #  (  0    $" P0%!@<("0H+# T.#Q$2$Q05%A<8&1H;
M'!T>'@    __#MX-O R;"VH*20DG" 8'%@<G!C<&6 5H!7D$B0  #_\-[@O-
M";P&J@29 G@ 9P6:"LP/_PO="+L$B0!G _\ ]P#< ,$ IP"@ )H DP"- (8 
M@ !Z ', ;@!J &8 8@!= %D 50!1 $T 2@!) $@ 1P!& $4 1 !# $( 00 !
M @,$!08'" D*"PP-#@\>'1P;&AD8%Q85%!,2$107   *  \@#T /8 ^ #Y /
ML _0#_ -T0NR"9,(A 9E!$8")P ( @<$!@8%" 0) PL"#0$/  \@#T /4 ]P
M#Y /L /_ (X A ![ '$ : !C %X 60!4 $\ 2@!' $0 0@ _ #P .@ W #0 
M,@ P "\ +0 L "H *0 G "8 )  C "(  0(#! 4&!P@)"@L,#0X/$!$2$Q05
M%A<8&1H;'!T>'P  #_\-W0N["9D&9@1$ B(    "  , !0 &  < "0 * "H 
M.@!9 &D (  P $  0 !0 &  4 !  #  (  0#_\#_P)[ AX!P0%D 0< JP"1
M (X C "* (< A "  'T >@!W ', < !M &H 9P!B %X 60!5 %  3 !' $, 
M/@ Z  <&!00# P$$!@H+# T.#Q 1$A,4"!87&!D:&QP='@    8 "  +  T 
M#P /0 ^ #[ /\ NP!F "( ,U BH #PQ0"T )0 @P!C %( ,0 A    # "JH+
MNPS,#=T.[@__ _\!/@$G 1  ^0#B ,L M "= (< ?P!X '$ :@!C %P 50!$
M $$ /@ [ #@ -0   "P *P J "D *  G      \%! ," 0(#! 4&!P@)"@L,
M  T.#PX-  X-#@\.#0 ?   /  X!#0$, @H""0,( PDC"D(+8@R"#)$-L0[0
M#_ -X S0"L )L >@!9 $@ )P G("@P&% 98!F &9 *L K /_ 84!8P%! 1\ 
M_0#; +D EP"& '\ > !Q &H 8P!< %4 1 !" $$ /P ^ #T .P Z #D -P V
M #4        / 0(#! 4&!P@)"@L,#0X/$!$2$Q05%A<8&1H;'!T>'P  #2(,
M(@LB"B(((@DR"S(,0@U2#7$.D0ZA#L$/T _P"] (L 20 '  8@!3 $4 1P X
M "H &P -  H !P $#P\#_P'1 :L!A0%? 3D!% $# /0 Y0#5 ,8 MP"G *, 
MG@": )< E "1 (X B@"& (( ?@!Z '8 <@!M &@ 8P!D'P$" P0%!@<("0H+
M# T.#Q 1$A,4%187&!D:&QP='@    _P#P .  P "P )  @ !@ /_P[N#,P+
MNPF9"(@'=P55#_ /  D  1$"(@(B!$0%50=W"9D*J@S,#=T/_P / _\"P@*C
M FT". (# <T!F %C 2T ^ ## *, H "> )P F@"8 )8 E "2 )  C@", (H 
MB "& (0 @@"  'X ?  ! @,$!08'" 8$ P 6%Q@9&AH;'!T>'1P<&QD9&!<6
M    1 )5!'<&B J\#N\,SPN_"J\(C@=^!FX$30,] 1P # ,0!" %(04Q!C('
M0@A""5,)4PID"V0)4P<R!"$"  /_ FH"'0'1 84!.0$T 3 !+ $H 20!( $<
M 1@!% $0 0L RP#( ,4 PP#  +X NP"Y +8 LP"Q *X K "I *<  0(#! 4&
M!P@)"@L,#0X/$!$2$Q05%A<8&1H;'!T>'P  "I /  T #  *  @ !@ $  __
M#NX,S N["9D(B =W!54/\ \ #2 *, 8@ B($1 55!W<)F0JJ#,P-W0__  \#
M_P+" ;D!<P$G 0D ]P#B ,T PP"Y *X B "% (( ?P!\ 'D =@!T '$ ;@!K
M &@ 90!C &  70!: %< 5 !2'P$(!P8%! ,"$Q05 !87&!D:&AL<'1X='!P;
M&1D8%Q8  %7P@   PIHNB,&T>N%"FBZ(00!M $X#_P  0   !0        U(
M "    V(   -R   5?F2][&^@G#TP9+30;Z":7/! &  00/_  !    %    
M    #>@ (   #B@   YH  !6 O%GB,"*H92_["8UP(5$5K\ @0 Z _\  $  
M  4        .B  @   .R   #P@  %80H'C9P:UX/KR@*A/!I[]BO !X $P#
M_P  0   !         _( "   ! (   02   5A:@:;[!J\@[O* V9<&I(<V\
M &D . /_  !    %        $&@ (   $*@  !#H  !6(*!?V<&J[ >\H%1A
MP:GXPKP 8@ X _\  $    4        1"  @   12   $8@  %8GO_(]P.@E
MGKV^"B# U[X2O0!% #@#_P  0   !0        \H "    ]H   /J   5C&^
MU7S Y^C-O;ZNXL#G0Z:] &D . /_  !    %        $N@ (   $R@  !-H
M  !6/;[6N\#G?E^]OM)XP.=DKKT 7P X _\! $    4        1J  @   1
MZ   $B@  %9"OM3EP.=T[[V^TGC YVX>O0!7 #@#_P$ 0   !0       !)(
M "   !*(   2R        %9.  @  0     " @    H "P              
M   ! 0     !   5@   5EH      @$!   P  $                " 0$ 
M #   0                (! 0  ,  !                 @$!   P  $ 
M               " 0$  #   0               /_^__X \O_^ /( "?_^
M  G__O_^      (#  4  !88      ("  #_V      5@   5F(         
M    ''P    A                                       \ %4 \  *
M     0 $   6+        !8\        %E!VRP       !9T  H 1@$.  H 
M   !  $             %@0          ';*        %J  "@ \ 0X "@  
M  $  0             5\           =LD        6S  * #(!#@ *    
M 0 !             !7<          !VR        !;X  H * $.  H    !
M  $             %<@          ';'        %R0 "@ > 0X "@    $ 
M 0             5M           =L8            R    ,@ )    "0  
M     O_^ ##__@ T  ( -  ' #  "P "  O__@ '__X  @ "__X      @, 
M"0  %Y            ,"  4  !=\   7M        0 !   5@   5F@     
M       !  $  !6   !6<      " @  _\0          %9X            
M !Q\    ,@                                  %U  4  3 +X "@  
M  $ !              7_        !@0=L4       4        0        
M            &#0!&0 4 !0 /     H  P  ',H                  !A@
M=L,        8=@#Z &0 ,@ *     0 !   7Q        !?H          !V
MP@       !BB !0 9  R  H    !  $  !?$        %]0          ';!
M           !0 !X 0(       $0 @  &,X                      4  
M> %  '@ #P ! 0  !0 4                  $!   %  ,       !>5   
M        ,#$R,S0U-C<X.6%B8V1E9@  H   1(   $&   ! S,S-/*/7"CF#
M$FXVT;<6,J?%JR^&-[PLUK^3**O,=B6)<%XBV^;]'J_K_AN,O,L8X2X2%+0D
MVQ&0'7P.<@        !R*P       G<       ,!=RL      P)A       )
M 6$K      D">       !0%X*P     % @           " @(" @(" @(# P
M,# P(" @(" @(" @(" @(" @(" @D$! 0$! 0$! 0$! 0$! 0 P,# P,# P,
M# Q 0$! 0$! "0D)"0D) 0$! 0$! 0$! 0$! 0$! 0$! 0% 0$! 0$ *"@H*
M"@H" @(" @(" @(" @(" @(" @(" D! 0$ @                  $     
M 0                     ! 0    $                      0(    !
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                         !0   /L    G@    $   %B   !=    98 
M  (*   "'    BP   (^   "2    DX   )@   "<    H(   *D   "W   
M NX   ,0   #2    UH   -\   #R    ]H   /J   #_   !!X   2F   $
MN   !,@   3:   $Z@  !/P   4,   %'@  !2X   5    %8@  !>H   7\
M   &#   !AX   8N   &0   !E    9B   &<@  !H0   :F   '0@  !U0 
M  =>   '9   !W8   >&   'F   !Z@   >Z   'Q   !\H   ?<   'Y@  
M!^P   ?^   ("   ""    @J   (^   "0H   D:   )+   "3P   E.   )
M7@  "7    F    )D@  ":(   FT   )Q   "=8   GF   )^   "@@   H:
M   */   "DP   I>   *:@  "GP   J:   *S   "NX   SN   -%   $ZP 
M !.R   3M@  $]X  !/D   3Z   %!   !06   4&@  %$(  !1(   43   
M%'0  !1Z   4?@  %*8  !2L   4L   %-@  !3>   4X@  %0H  !40   5
M%   %3P  !5"   51@  %6X  !5T   5>   %:@  !8T   61   %E0  !:&
M   6C@  %I8  !:@   6N@  %LP  !;F   6^   %Q(  !<D   7/@  %U  
M !=J   7O   %\P  !?0   7W   %_   !@4   8-   &$X  !A6   8=@  
M&(@  !B8   8H@  &+0  !B\   8S@  &.   !CH   9#    %          
M6@   48   %:   !L@   <8   ':   ![@   @(   +    "U    RP   - 
M   #F    ZP   /    $.@  !$X   1B   $=@  !(H   2>   %?@  !9( 
M  6F   %N@  !<X   7B   &P@  !M8   ;J   &_@  !Q(   <F   '.@  
M"#P   A0   (9   "'@   B,   (H   "+0   C(   (W   "/    I:   *
M>   "I8   JR   *Z@  "R    Q:   ,;@  #3(  !.(   3N@  $^P  !0>
M   44   %((  !2T   4Y@  %1@  !5*   5@   %:P  !9(   7X   %_0 
M !@(   92@    (    (    #@   !0    :    (    "8    L    ,@  
6 #@        #\@   ^L    !   #\A0 
 
end
//E*O*F MandVroom.uue//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
    962   6895  59458 MandVroom.uue
!!!
wc  MandVroom.uue | sed 's=[^ ]*/==' | diff -b $temp -
exit 0


-- 
UUCP:  orandy@amdahl.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

orandy@amdahl.UUCP (05/20/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# Makefile README contour.c disp.c

echo x - Makefile
cat > "Makefile" << '//E*O*F Makefile//'
SAVEILBM = df1:src/IFF/saveILBM.o df1:src/IFF/packer.o df1:src/IFF/ilbmw.o df1:src/IFF/iffw.o
REQ      = df1:src/GetFile/getfile.o df1:src/GetFile/safeclose.o
MAND     = mand.o main.o menu.o menu1.o disp.o nav.o contour.o palette.o savemand.o presets.o
OBJECTS  = $(MAND) $(REQ) $(SAVEILBM)

MandelVroom: mand.p $(OBJECTS)
             ln $(OBJECTS) -lm32 -lc32 -o MandelVroom

mand.p:  mand.h
         cc Mand.h +l -s +HMand.p

main.o:  mand.p main.c
         cc main.c  -E160 +l +ff +IMand.p

mand.o:  mand.p mand.c
         cc mand.c  -E160 +l +ff +IMand.p

disp.o:  mand.p disp.c
         cc disp.c  -E160 +l +ff +IMand.p

nav.o:   mand.p nav.c
         cc nav.c  -E200 +l +ff +IMand.p

contour.o:  mand.p contour.c
         cc contour.c  -E200 +l +ff +IMand.p

palette.o:  mand.p palette.c
         cc palette.c  -E160 +l +ff +IMand.p

savemand.o:     mand.p savemand.c
         cc savemand.c +l +ff +IMand.p

menu.o: mand.p menu.c
         cc menu.c +l +ff +IMand.p

menu1.o: mand.p menu1.c
         cc menu1.c +l +IMand.p

presets.o: mand.p presets.c
         cc presets.c +l +ff +IMand.p

//E*O*F Makefile//

echo x - README
cat > "README" << '//E*O*F README//'


    This directory contains the source to MandelVroom.  The source must be
compiled with Manx Aztec c Version 3.40a or greater.  The 'makefile'
in this directory shows you how to make MandleVroom.

    You must make sure to have prepared and compiled the things in the
GetFile and IFF directories before 'making' the things in this directory.
//E*O*F README//

echo x - contour.c
cat > "contour.c" << '//E*O*F contour.c//'
/***************************************************************************
 *
 *                 MandelVroom Contour Editing Window
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/

#include "mand.h"

extern struct Screen *screen;
extern struct RastPort *rp;
extern struct Window *MandWind;

extern SHORT MouseX,MouseY;

extern SHORT MaxCount;

extern struct Menu Menu[];

extern USHORT CmdMode;

extern SHORT Zoom;

USHORT CurContour;

struct Window *ContWind;

BYTE ContTitle[80];

struct NewWindow NewCont = {
   0,200-80,                 /* start position           */
   320,200,                  /* width, height            */
   (UBYTE) 0, (UBYTE) 1,     /* detail pen, block pen    */
                             /* IDCMP flags */
   MENUPICK | GADGETDOWN | GADGETUP | REQCLEAR | CLOSEWINDOW,
                             /* MandWind flags */
   WINDOWCLOSE | WINDOWDRAG | WINDOWDEPTH | SIMPLE_REFRESH | NOCAREREFRESH,
   (struct Gadget *) NULL,   /* first gadget             */
   (struct Image *) NULL,    /* user checkmark           */
   (UBYTE *) NULL,           /* window title             */
   (struct Screen *) NULL,   /* pointer to screen        */
   (struct BitMap *) NULL,   /* pointer to superbitmap   */
   80,80,320,200,            /* sizing                   */
   CUSTOMSCREEN              /* type of screen           */
   };

SHORT Ceiling = 1023;

extern SHORT *CountBase;
extern SHORT CountX, CountY;

SHORT  Contours[NUMCONTS] = {
      1023,128,64, 32, 27, 26, 25, 24,
      23, 22, 21, 20, 19, 18, 17, 16,
      15, 14, 13, 12, 11, 10, 9,  8,
       7, 6,  5,  4,  3,  2,  1,  0
      };
SHORT *ContourBase = Contours;
SHORT  NumContours = NUMCONTS;

UBYTE  Colors[NUMCONTS] = {
      0,  1,  2,  3,  4,  5,  6,  7,
      8,  9,  10, 11, 12, 13, 14, 15,
      16, 17, 18, 19, 20, 21, 22, 23,
      24, 25, 26, 27, 28, 29, 30, 31
      };
UBYTE *ColorBase = Colors;

struct Gadget *ContGadget[NUMCONTS];
struct Gadget *SelGadget[NUMCONTS];


/*
 * Figure out what to do for this contour gadget
 */
DoContourDown(gadget)
  struct Gadget *gadget;
{
  USHORT  ContNum;
  USHORT  Type;

  extern LONG NavTop, NavBot, NavLeft, NavRight;

  ContNum = gadget->GadgetID & NUMMASK;

  switch (Type = gadget->GadgetID >> TYPEBITS & TYPEMASK) {
    case CONTCNTLS:
         switch (gadget->GadgetID) {
           case CONTRECOL:
                ReColor();
                DisplayBeep(screen);

                if (Zoom) {
                  DrawBox(NavLeft, NavTop, NavRight, NavBot );
                  DrawExtras(NavLeft, NavTop, NavRight, NavBot );
                }
                SetNormPointer();
                break;

           case CONTSMTH:
                SetToPointer();
                CmdMode = SMOOTH;
                break;
         }
         break;

    case CONTSELS:
         if (CmdMode == SMOOTH) {
           SetNormPointer();
           SmoothContours(CurContour, ContNum);

         } else {
           SetNormPointer();
           CmdMode = IMPLIEDSET;
         }
         break;

    case CONTDOWNS:
         if (*(ContourBase + ContNum) > 0) {
           *(ContourBase + ContNum) -= 1;
         }
         ReString(ContNum);
         SetNormPointer();
         break;

    case CONTUPS:
         if (*(ContourBase + ContNum) < MaxCount) {
           *(ContourBase + ContNum) += 1;
         }
         ReString(ContNum);
         SetNormPointer();
         break;
  }

  if ( Type != CONTCNTLS ) {
    DrawContBox(CurContour, 0);
    DrawContBox(ContNum, 1);

    CurContour = ContNum;
    SetContTitle(ContNum);
  }
}

/*
 * Figure out what to do for this contour gadget
 */
DoContourUp(gadget)
  struct Gadget *gadget;
{
  USHORT  ContNum;
  struct  PropInfo *PropInfo;
  ULONG   VertPot;
  char    msg[80];

  ContNum = gadget->GadgetID & NUMMASK;
  SetNormPointer();

  PropInfo = (struct PropInfo *) gadget->SpecialInfo;

  VertPot = PropInfo->VertPot + 1;

  switch (gadget->GadgetID >> TYPEBITS & TYPEMASK) {
    case CONTCNTLS:
         Ceiling = ((LONG) MaxCount - ( VertPot * MaxCount  >> 16));
         ModAll();
         break;

    case CONTPOTS:
         if (ContourBase[ContNum] < Ceiling) {
           ContourBase[ContNum] =
               ( (LONG) Ceiling ) - (VertPot * Ceiling >> 16);
         } else {
           PropInfo->VertPot = 0;
           RefreshGList(gadget,ContWind,NULL,1);
         }

         DrawContBox(CurContour, 0);
         DrawContBox(ContNum, 1);

         CurContour = ContNum;
         SetContTitle(ContNum);

         break;
  }
}

/*
 * Set the contour window's new title
 */
SetContTitle(ContNum)
  int ContNum;
{
  SHORT Low, High;

  char *fmt1 = "Contour: %d Alt: %d-%d Pen: %d";
  char *fmt2 = "Contour: %d Alt: %d Pen: %d";

  High = ContourBase[ContNum];

  if (ContNum != 0) {
    Low  = ContourBase[ContNum-1];

    if (Low == High || Low - High == 1) {
      sprintf(ContTitle, fmt2, ContNum, High, ColorBase[ContNum]);
    } else {
      sprintf(ContTitle, fmt1, ContNum, Low - 1, High, ColorBase[ContNum]);
    }
  } else {

    sprintf(ContTitle, fmt2, ContNum, MaxCount, High, ColorBase[ContNum]);
  }
  SetWindowTitles(ContWind, ContTitle, NULL);
}

/*
 * Set Potentiometer knob's pen
 */
DrawContBox(Contour, pen)
  ULONG Contour;
  int pen;
{
  LONG Left, Right, Top, Bottom;
  LONG Scaled4;
  struct RastPort *rp = ContWind->RPort;

  extern USHORT XScale, YScale;

  Scaled4 = 4 << XScale;

  Left = (6 << XScale) * Contour + Scaled4 - 1;
  Right = Left + Scaled4 + 1;

  Top = (12 << YScale) - 1;
  Bottom = Top + (4 << YScale) + 1;

  SetDrMd(rp, (LONG) JAM1);
  SetAPen(rp, (LONG) pen);
  /*
   * Draw the new box
   */
  Move(rp, Left,  Top   );
  Draw(rp, Right, Top   );
  Draw(rp, Right, Bottom);
  Draw(rp, Left,  Bottom);
  Draw(rp, Left,  Top+1 );

} /* DrawContBox */

/*
 *  There was a window pick. Do what we need to do to service it
 */
DoWindowPick(MouseX,MouseY)
  SHORT MouseX,MouseY;
{
  USHORT Height;

  if (MouseX >= LEFTMARG && MouseX <= MandWind->Width-RIGHTMARG &&
      MouseY >= TOPMARG  && MouseY <= MandWind->Height-BOTMARG) {

    if (CmdMode == IMPLIEDSET) {
      Height = *(CountBase + (MouseY-TOPMARG)*CountX + MouseX - LEFTMARG);
      *(ContourBase + CurContour) = Height;
      ReString(CurContour);
    }
  }
}

/*
 *  Smooth the heights over a subrange of contours
 */
SmoothContours(First,Second)
  USHORT First, Second;
{
  USHORT Temp;
  float Diff,Start;

  if (Second-First != 0) {

    if (Second < First) {
      Temp = First;
      First = Second;
      Second = Temp;
    }

    Start = (float) ContourBase[First];
    Diff = (((float) ContourBase[Second]) - Start)/((float)(Second-First));

    if (Diff > -1.0) {
      Diff = -1.0;
    }

    for ( ; First < Second && Start > 0; First++)
      ContourBase[First + 1] = (SHORT) (Start += Diff);

    if (Start == 0) {
      for ( ; First < NumContours; First++) {
        ContourBase[First] = 0;
      }
    }

    ModAll();
  }
} /* SmoothContours */

/*
 * ReColor the Mandelbrot image
 */
ReColor() {
  SHORT *CountPtr = CountBase;
  SHORT  Mask,Width;
  LONG   Mod,CMod;
  SHORT  LF,LP,RF,RP,D[6];
  SHORT  i,j,k,l, Depth;
  LONG   Sx,TL;
  SHORT *Planes[6];

  UBYTE *ColorPtr;
  UBYTE *ColorSave,t;
  UBYTE  T[1030];

  Depth = screen->BitMap.Depth;

  if (CountPtr == NULL) {
    DispErrMsg("No counts to recolor",0);
    return(0);
  }
  if (screen->Width < CountX+LEFTMARG+RIGHTMARG ||
      screen->Height < CountY+TOPMARG+BOTMARG) {
    DispErrMsg("Picture too big for screen.",0);
    return(0);
  }

  if (MandWind->Width  != CountX+LEFTMARG+RIGHTMARG ||
      MandWind->Height != CountY+TOPMARG+BOTMARG)
      SizeWindow(MandWind,CountX+LEFTMARG+RIGHTMARG-MandWind->Width,
                          CountY+TOPMARG+BOTMARG-MandWind->Height);

  WindowToFront(MandWind);

  SetAPen( rp, 0L );
  RectFill( rp, LEFTMARG, TOPMARG, LEFTMARG + CountX, TOPMARG + CountY );

  if ( Depth < 4 || Depth == 6) {
    ReColorSlow();
    return(0);
  }

  /* try to get enough memory to recolor the picture fast. */
  ColorPtr = ColorSave = (UBYTE *) AllocMem((LONG) CountX * CountY, 0L);
  if (ColorPtr == (UBYTE *) NULL) {
    ReColorSlow();
    return(0);
  }

  /* So recolor it now that you have the memory */
  for (i = 0,j = 1029; i < NUMCONTS; i++)
    for (; j >= ContourBase[i] && j; )
      T[j--] = ColorBase[i];
  while (j >= 0) T[j--] = 0;

  ;
#ifdef SLOW1
  for (Sx = CountX*CountY; Sx-- >= 0; )  *(ColorPtr++) = T[*(CountPtr++)];
#else
#asm
CountPtr  equ -4
ColorBase equ -82
T         equ -1117
   move.w   _CountX,d1
   muls.w   _CountY,d1
   sub.l    #1,d1
   move.l   CountPtr(a5),a0
   lea      T(a5),a1
   move.l   ColorBase(a5),a6
ColorLoop
   move.w   (a0)+,d0
   move.b   (a1,d0.w),(a6)+
   sub.l    #1,d1
   bge      ColorLoop
#endasm
#endif

  ClearMenuStrip(MandWind);

  if (Depth == 4) {
    ReColor4(ColorSave);
  } else
  if (Depth == 5) {
    ReColor5(ColorSave);
  }
  SetMenuStrip(MandWind, Menu);

  FreeMem(ColorSave,CountX*CountY);
} /* ReColor */

/*
 * Assembly code to recolor 4 bit planes
 */
ReColor4(ColorSave)
  UBYTE *ColorSave;
{
  SHORT  Mask,Width;
  LONG   Mod,CMod;
  SHORT  LF,LP,RF,RP;
  SHORT  i,j,k,l;
  LONG   Sx,TL;
  UBYTE  *ColorPtr;

  struct BitMap *BitMap = MandWind->RPort->BitMap;

#asm
SaveReg  reg a0-a6/d0-d7
Plane0   equ 8
Plane1   equ Plane0+4
Plane2   equ Plane0+8
Plane3   equ Plane0+12
Plane4   equ Plane0+16
Plane5   equ Plane0+20

BitMap    equ -44
ColorPtr  equ -40
TL        equ -36
Sx        equ -32
l         equ -28
k         equ -26
j         equ -24
i         equ -22
RP        equ -20
RF        equ -18
LP        equ -16
LF        equ -14
CMod      equ -12
Mod       equ -8
Width     equ -4
Mask      equ -2
ColorSave equ 8
#endasm

  ColorPtr = ColorSave;
  Sx = screen->Width >> 4;
  LF = MandWind->LeftEdge + 17 & 0xfff0;
  LP = MandWind->LeftEdge + LEFTMARG;
  CMod = CountX - (LF-LP);
  Mod = Sx - 1;
  TL = Sx * (MandWind->TopEdge + TOPMARG) + (LP >> 4);
  Width = LF-LP;
  Mask = 0xffff << Width;

#asm
  movem.l SaveReg,-(sp)          ;Save all the gprs to the stack
  move.l  a5,a1                  ;We need a5, so put MANX stack in a1
  move.w  _CountY,i(a1)
  move.l  BitMap(a1),a0
  move.l  TL(a1),d0              ;Load Offset to Top,Left corner of screen
  asl.l   #1,d0                  ; and make it a 'word' offset
  move.l  Plane0(a0),a2          ;Get address of screens first bit plane
  adda.l  d0,a2                  ; add in window top-left offset.
  move.l  Plane1(a0),a3          ;Same for second bit plane.
  adda.l  d0,a3
  move.l  Plane2(a0),a4          ;Same for third bit plane.
  adda.l  d0,a4
  move.l  Plane3(a0),a5          ;Same for fourth bit plane.
  adda.l  d0,a5
  move.l  ColorPtr(a1),a0        ;Load up pointer to recolored data.
  move.l  #1,d1                  ;/* for each row */
;                                for (i = CountY; i; i--) {
Y0Loop4                            ; /* for each pixel in column */
  move.w  Width(a1),d7           ;  for (k = Width; k; k--) {
  eor.w   d2,d2                  ;  Clear all bits in the bit plane data regs.
  eor.w   d3,d3
  eor.w   d4,d4
  eor.w   d5,d5
B0Loop4
  move.b  (a0)+,d0               ;    d0 = *(ColorPtr++);
  asr.b   d1,d0                  ;    get low order bit from d0
  addx.w  d2,d2                  ;    put it in bit plane 0 data
  asr.b   d1,d0                  ;    same for bit plane 1
  addx.w  d3,d3
  asr.b   d1,d0                  ;    same for bit plane 2
  addx.w  d4,d4
  asr.b   d1,d0                  ;    same for bit plane 3
  addx.w  d5,d5
  sub.w   d1,d7                  ;    same for bit plane 5
  bgt     B0Loop4                ;  } /* did each bit in bit plane word */
  move.w  Mask(a1),d0            ;  Turn off all the new bits in planes
  and.w   d0,(a2)
  and.w   d0,(a3)
  and.w   d0,(a4)
  and.w   d0,(a5)
  or.w    d2,(a2)+               ;  Set the new bits in the bit planes
  or.w    d3,(a3)+
  or.w    d4,(a4)+
  or.w    d5,(a5)+
  move.l  Mod(a1),d0             ;  Adjust plane pointers to start of next line
  add.l   d0,d0
  add.l   d0,a2
  add.l   d0,a3
  add.l   d0,a4
  add.l   d0,a5
  adda.l  CMod(a1),a0            ;  Adjust color pointer to start of next line
  sub.w   d1,i(a1)               ;} /* did each row */
  tst.w   i(a1)
  bgt     Y0Loop4
  movem.l (sp)+,SaveReg          ;better restore the registers
#endasm

  RP = LP + CountX & 0xfff0;
  RF = RP - 16;
  CMod = CountX - (RP-LF);
  Mod = Sx - ((RP-LF) >> 4);
  TL++;
  Width = (RP-LF) >> 4;
  ColorPtr = ColorSave + LF - LP;

#asm
  movem.l SaveReg,-(sp)          ;Save all the gprs to the stack
  move.l  a5,a1                  ;We need a5, so put MANX stack in a1
  move.w  _CountY,i(a1)          ;i = CountY;
  move.l  BitMap(a1),a0
  move.l  TL(a1),d0              ;Load Offset to Top,Left corner of screen
  asl.l   #1,d0                  ; and make it a 'word' offset
  move.l  Plane0(a0),a2          ;Get address of screens first bit plane
  adda.l  d0,a2                  ; add in window top-left offset.
  move.l  Plane1(a0),a3          ;Same for second bit plane.
  adda.l  d0,a3
  move.l  Plane2(a0),a4          ;Same for third bit plane.
  adda.l  d0,a4
  move.l  Plane3(a0),a5          ;Same for fourth bit plane.
  adda.l  d0,a5
  move.l  ColorPtr(a1),a0        ;Load up pointer to recolored data.
  move.l  #1,d1                  ;/* for each row */
;                                for (i = CountY; i; i--) {
YLoop4                            ; /* for each column */
  move.w  Width(a1),j(a1)        ;  for (j = Width; j; j--) {
XLoop4                               ; /* pack a word for each bit plane */
  move.w  #16,d7                 ;    for (k = 16; k; k--) {
BLoop4
  move.b  (a0)+,d0               ;      d0 = *(ColorPtr++);
  asr.b   d1,d0                  ;      get low order bit from d0
  addx.w  d2,d2                  ;      put it in bit plane 0 data
  asr.b   d1,d0                  ;      same for bit plane 1
  addx.w  d3,d3
  asr.b   d1,d0                  ;      same for bit plane 2
  addx.w  d4,d4
  asr.b   d1,d0                  ;      same for bit plane 3
  addx.w  d5,d5
  sub.w   d1,d7                  ;      same for bit plane 5
  bgt     BLoop4                 ;    } /* did each bit in bit plane word */
  move.w  d2,(a2)+               ;    Save the packed data in bit planes
  move.w  d3,(a3)+
  move.w  d4,(a4)+
  move.w  d5,(a5)+
  sub.w   d1,j(a1)               ;  } /* did each word in a row */
  tst.w   j(a1)
  bgt     XLoop4
  move.l  Mod(a1),d0             ;  Adjust plane pointers to start of next line
  add.l   d0,d0
  add.l   d0,a2
  add.l   d0,a3
  add.l   d0,a4
  add.l   d0,a5
  adda.l  CMod(a1),a0            ;  Adjust color pointer to start of next line
  sub.w   d1,i(a1)               ;} /* did each row */
  tst.w   i(a1)
  bgt     YLoop4
  movem.l (sp)+,SaveReg          ;better restore the registers
#endasm

  TL += Width;
  Width = LP + CountX - RP;
  CMod = CountX - Width;
  Mod = Sx - 1;
  Mask = 0xffff >> Width;
  ColorPtr = ColorSave + RP - LP;

#asm
  movem.l SaveReg,-(sp)          ;Save all the gprs to the stack
  move.l  a5,a1                  ;We need a5, so put MANX stack in a1
  move.w  _CountY,i(a1)
  move.l  BitMap(a1),a0
  move.l  TL(a1),d0              ;Load Offset to Top,Left corner of screen
  asl.l   #1,d0                  ; and make it a 'word' offset
  move.l  Plane0(a0),a2          ;Get address of screens first bit plane
  adda.l  d0,a2                  ; add in window top-left offset.
  move.l  Plane1(a0),a3          ;Same for second bit plane.
  adda.l  d0,a3
  move.l  Plane2(a0),a4          ;Same for third bit plane.
  adda.l  d0,a4
  move.l  Plane3(a0),a5          ;Same for fourth bit plane.
  adda.l  d0,a5
  move.l  ColorPtr(a1),a0        ;Load up pointer to recolored data.
  move.l  #1,d1                  ;/* for each row */
;                                ;for (i = CountY; i; i--) {
Y2Loop4                            ; /* for each pixel in column */
  move.w  Width(a1),d7           ;  for (k = Width; k; k--) {
  eor.w   d2,d2                  ;  Clear all bits in the bit plane data regs.
  eor.w   d3,d3
  eor.w   d4,d4
  eor.w   d5,d5
B2Loop4
  move.b  (a0)+,d0                ;   d0 = *(ColorPtr++);
  asr.b   d1,d0                   ;   get low order bit from d0
  addx.w  d2,d2                   ;   put it in bit plane 0 data
  asr.b   d1,d0                   ;   same for bit plane 1
  addx.w  d3,d3
  asr.b   d1,d0                   ;   same for bit plane 2
  addx.w  d4,d4
  asr.b   d1,d0                   ;   same for bit plane 3
  addx.w  d5,d5
  sub.w   d1,d7                   ;   same for bit plane 5
  bgt     B2Loop4                 ; } /* did each bit in bit plane word */
  move.w  Mask(a1),d0             ; Turn off all the new bits in planes
  and.w   d0,(a2)
  and.w   d0,(a3)
  and.w   d0,(a4)
  and.w   d0,(a5)
  move.w  #16,d0
  sub.w   Width(a1),d0
  asl.w   d0,d2
  asl.w   d0,d3
  asl.w   d0,d4
  asl.w   d0,d5
  or.w    d2,(a2)+                ; Set the new bits in the bit planes
  or.w    d3,(a3)+
  or.w    d4,(a4)+
  or.w    d5,(a5)+
  move.l  Mod(a1),d0              ; Adjust plane pointers to start of next line
  add.l   d0,d0
  add.l   d0,a2
  add.l   d0,a3
  add.l   d0,a4
  add.l   d0,a5
  adda.l  CMod(a1),a0             ; Adjust color pointer to start of next line
  sub.w   d1,i(a1)               ;} /* did each row */
  tst.w   i(a1)
  bgt     Y2Loop4
  movem.l (sp)+,SaveReg          ;better restore the registers
#endasm
} /* ReColor 4 bit planes */


/*
 * Assembly code to recolor 5 bit planes
 */
ReColor5(ColorSave)
  UBYTE *ColorSave;
{
  SHORT  Mask,Width;
  LONG   Mod,CMod;
  SHORT  LF,LP,RF,RP;
  SHORT  i,j,k,l;
  LONG   Sx,TL;
  UBYTE  *ColorPtr;

  struct BitMap *BitMap = MandWind->RPort->BitMap;

  ColorPtr = ColorSave;
  Sx = screen->Width >> 4;
  LF = MandWind->LeftEdge + 17 & 0xfff0;
  LP = MandWind->LeftEdge + LEFTMARG;
  CMod = CountX - (LF-LP);
  Mod = Sx - 1;
  TL = Sx * (MandWind->TopEdge + TOPMARG) + (LP >> 4);
  Width = LF-LP;
  Mask = 0xffff << Width;

#asm
  movem.l SaveReg,-(sp)          ;Save all the gprs to the stack
  move.l  a5,a1                  ;We need a5, so put MANX stack in a1
  move.w  _CountY,i(a1)
  move.l  BitMap(a1),a0
  move.l  TL(a1),d0              ;Load Offset to Top,Left corner of screen
  asl.l   #1,d0                  ; and make it a 'word' offset
  move.l  Plane0(a0),a2          ;Get address of screens first bit plane
  adda.l  d0,a2                  ; add in window top-left offset.
  move.l  Plane1(a0),a3          ;Same for second bit plane.
  adda.l  d0,a3
  move.l  Plane2(a0),a4          ;Same for third bit plane.
  adda.l  d0,a4
  move.l  Plane3(a0),a5          ;Same for fourth bit plane.
  adda.l  d0,a5
  move.l  Plane4(a0),a6          ;Same for fifth bit plane.
  adda.l  d0,a6
  move.l  ColorPtr(a1),a0        ;Load up pointer to recolored data.
  move.l  #1,d1                  ;/* for each row */
;                                ;for (i = CountY; i; i--) {
Y0Loop5                            ; /* for each pixel in column */
  move.w  Width(a1),d7           ;  for (k = Width; k; k--) {
  eor.w   d2,d2                  ;  Clear all bits in the bit plane data regs.
  eor.w   d3,d3
  eor.w   d4,d4
  eor.w   d5,d5
  eor.w   d6,d6
B0Loop5
  move.b  (a0)+,d0               ;    d0 = *(ColorPtr++);
  asr.b   d1,d0                  ;    get low order bit from d0
  addx.w  d2,d2                  ;    put it in bit plane 0 data
  asr.b   d1,d0                  ;    same for bit plane 1
  addx.w  d3,d3
  asr.b   d1,d0                  ;    same for bit plane 2
  addx.w  d4,d4
  asr.b   d1,d0                  ;    same for bit plane 3
  addx.w  d5,d5
  asr.b   d1,d0                  ;    same for bit plane 4
  addx.w  d6,d6
  sub.w   d1,d7                  ;    same for bit plane 5
  bgt     B0Loop5                ;  } /* did each bit in bit plane word */
  move.w  Mask(a1),d0            ;  Turn off all the new bits in planes
  and.w   d0,(a2)
  and.w   d0,(a3)
  and.w   d0,(a4)
  and.w   d0,(a5)
  and.w   d0,(a6)
  or.w    d2,(a2)+               ;  Set the new bits in the bit planes
  or.w    d3,(a3)+
  or.w    d4,(a4)+
  or.w    d5,(a5)+
  or.w    d6,(a6)+
  move.l  Mod(a1),d0             ;  Adjust plane pointers to start of next line
  add.l   d0,d0
  add.l   d0,a2
  add.l   d0,a3
  add.l   d0,a4
  add.l   d0,a5
  add.l   d0,a6
  adda.l  CMod(a1),a0            ;  Adjust color pointer to start of next line
  sub.w   d1,i(a1)               ;} /* did each row */
  tst.w   i(a1)
  bgt     Y0Loop5
  movem.l (sp)+,SaveReg          ;better restore the registers
#endasm

  RP = LP + CountX & 0xfff0;
  RF = RP - 16;
  CMod = CountX - (RP-LF);
  Mod = Sx - ((RP-LF) >> 4);
  TL++;
  Width = (RP-LF) >> 4;
  ColorPtr = ColorSave + LF - LP;

#asm
  movem.l SaveReg,-(sp)          ;Save all the gprs to the stack
  move.l  a5,a1                  ;We need a5, so put MANX stack in a1
  move.w  _CountY,i(a1)          ;i = CountY;
  move.l  BitMap(a1),a0
  move.l  TL(a1),d0              ;Load Offset to Top,Left corner of screen
  asl.l   #1,d0                  ; and make it a 'word' offset
  move.l  Plane0(a0),a2          ;Get address of screens first bit plane
  adda.l  d0,a2                  ; add in window top-left offset.
  move.l  Plane1(a0),a3          ;Same for second bit plane.
  adda.l  d0,a3
  move.l  Plane2(a0),a4          ;Same for third bit plane.
  adda.l  d0,a4
  move.l  Plane3(a0),a5          ;Same for fourth bit plane.
  adda.l  d0,a5
  move.l  Plane4(a0),a6          ;Same for fifth bit plane.
  adda.l  d0,a6
  move.l  ColorPtr(a1),a0        ;Load up pointer to recolored data.
  move.l  #1,d1                  ;/* for each row */
;                                ;for (i = CountY; i; i--) {
YLoop5                            ; /* for each column */
  move.w  Width(a1),j(a1)        ;  for (j = Width; j; j--) {
XLoop5                               ; /* pack a word for each bit plane */
  move.w  #16,d7                 ;    for (k = 16; k; k--) {
BLoop5
  move.b  (a0)+,d0               ;      d0 = *(ColorPtr++);
  asr.b   d1,d0                  ;      get low order bit from d0
  addx.w  d2,d2                  ;      put it in bit plane 0 data
  asr.b   d1,d0                  ;      same for bit plane 1
  addx.w  d3,d3
  asr.b   d1,d0                  ;      same for bit plane 2
  addx.w  d4,d4
  asr.b   d1,d0                  ;      same for bit plane 3
  addx.w  d5,d5
  asr.b   d1,d0                  ;      same for bit plane 4
  addx.w  d6,d6
  sub.w   d1,d7                  ;      same for bit plane 5
  bgt     BLoop5                 ;    } /* did each bit in bit plane word */
  move.w  d2,(a2)+               ;    Save the packed data in bit planes
  move.w  d3,(a3)+
  move.w  d4,(a4)+
  move.w  d5,(a5)+
  move.w  d6,(a6)+
  sub.w   d1,j(a1)               ;  } /* did each word in a row */
  tst.w   j(a1)
  bgt     XLoop5
  move.l  Mod(a1),d0             ;  Adjust plane pointers to start of next line
  add.l   d0,d0
  add.l   d0,a2
  add.l   d0,a3
  add.l   d0,a4
  add.l   d0,a5
  add.l   d0,a6
  adda.l  CMod(a1),a0            ;  Adjust color pointer to start of next line
  sub.w   d1,i(a1)               ;} /* did each row */
  tst.w   i(a1)
  bgt     YLoop5
  movem.l (sp)+,SaveReg          ;better restore the registers
#endasm

  TL += Width;
  Width = LP + CountX - RP;
  CMod = CountX - Width;
  Mod = Sx - 1;
  Mask = 0xffff >> Width;
  ColorPtr = ColorSave + RP - LP;

#asm
  movem.l SaveReg,-(sp)          ;Save all the gprs to the stack
  move.l  a5,a1                  ;We need a5, so put MANX stack in a1
  move.w  _CountY,i(a1)
  move.l  BitMap(a1),a0
  move.l  TL(a1),d0              ;Load Offset to Top,Left corner of screen
  asl.l   #1,d0                  ; and make it a 'word' offset
  move.l  Plane0(a0),a2          ;Get address of screens first bit plane
  adda.l  d0,a2                  ; add in window top-left offset.
  move.l  Plane1(a0),a3          ;Same for second bit plane.
  adda.l  d0,a3
  move.l  Plane2(a0),a4          ;Same for third bit plane.
  adda.l  d0,a4
  move.l  Plane3(a0),a5          ;Same for fourth bit plane.
  adda.l  d0,a5
  move.l  Plane4(a0),a6          ;Same for fifth bit plane.
  adda.l  d0,a6
  move.l  ColorPtr(a1),a0        ;Load up pointer to recolored data.
  move.l  #1,d1                  ;/* for each row */
;                                ;for (i = CountY; i; i--) {
Y2Loop5                          ;  ; /* for each pixel in column */
  move.w  Width(a1),d7           ;  for (k = Width; k; k--) {
  eor.w   d2,d2                  ;  Clear all bits in the bit plane data regs.
  eor.w   d3,d3
  eor.w   d4,d4
  eor.w   d5,d5
  eor.w   d6,d6
B2Loop5
  move.b  (a0)+,d0               ;    d0 = *(ColorPtr++);
  asr.b   d1,d0                  ;    get low order bit from d0
  addx.w  d2,d2                  ;    put it in bit plane 0 data
  asr.b   d1,d0                  ;    same for bit plane 1
  addx.w  d3,d3
  asr.b   d1,d0                  ;    same for bit plane 2
  addx.w  d4,d4
  asr.b   d1,d0                  ;    same for bit plane 3
  addx.w  d5,d5
  asr.b   d1,d0                  ;    same for bit plane 4
  addx.w  d6,d6
  sub.w   d1,d7                  ;    same for bit plane 5
  bgt     B2Loop5                ;  } /* did each bit in bit plane word */
  move.w  Mask(a1),d0            ;  Turn off all the new bits in planes
  and.w   d0,(a2)
  and.w   d0,(a3)
  and.w   d0,(a4)
  and.w   d0,(a5)
  and.w   d0,(a6)
  move.w  #16,d0
  sub.w   Width(a1),d0
  asl.w   d0,d2
  asl.w   d0,d3
  asl.w   d0,d4
  asl.w   d0,d5
  asl.w   d0,d6
  or.w    d2,(a2)+               ;  Set the new bits in the bit planes
  or.w    d3,(a3)+
  or.w    d4,(a4)+
  or.w    d5,(a5)+
  or.w    d6,(a6)+
  move.l  Mod(a1),d0             ;  Adjust plane pointers to start of next line
  add.l   d0,d0
  add.l   d0,a2
  add.l   d0,a3
  add.l   d0,a4
  add.l   d0,a5
  add.l   d0,a6
  adda.l  CMod(a1),a0            ;  Adjust color pointer to start of next line
  sub.w   d1,i(a1)               ;} /* did each row */
  tst.w   i(a1)
  bgt     Y2Loop5
  movem.l (sp)+,SaveReg          ;better restore the registers
#endasm
} /* ReColor 5 bit planes */

ReColorSlow() {
  LONG i, j, x, y, xl, yl;
  SHORT *CountPtr = CountBase;
  UBYTE  T[1030];
  UBYTE  OldColor;
  UBYTE  NewColor;

  j = MaxCount;

  for (i = 0; i < NUMCONTS && j >= 0; i++)
    for (; j >= ContourBase[i] && j >=0 ; )
      T[j--] = ColorBase[i];
  while (j >= 0) T[j--] = 0;

  OldColor = 0xff;
  xl = CountX + LEFTMARG;
  yl = CountY + TOPMARG;

  for (y = TOPMARG; y < yl; y++) {
    for (x = LEFTMARG; x < xl; x++) {

      NewColor = T[ *CountPtr++ ];

      if ( NewColor != OldColor) {

        SetAPen( rp, NewColor );
        OldColor = NewColor;
      }
      if (NewColor)
        WritePixel(rp, x, y);
    }
  }
} /* ReColorSlow */

/*
 * Allocate all the gadgets and things for the contour window
 */
struct Gadget *MakeContours()
{
  struct Gadget *FirstGadget, *NextGadget, *OldGadget;

  extern struct Gadget *MakeBool(), *MakePot();
  extern struct IntuiText *MakeIntui();

  USHORT i,x,y;
  UBYTE c = 0;

  struct PropInfo *PropInfo;

  FirstGadget = OldGadget = MakePot(228, 26, 4, 32, CONTCEIL, 0);

  if (OldGadget == (struct Gadget *) NULL)
    goto error;

  for (x = y = 0; x < 2; y += 10, x++) {

    NextGadget = MakeBool(234,y+14,6,6,1,CONTCNTL+x);

    if (NextGadget == (struct Gadget *) NULL)
      goto error;

    switch (x) {
      case 0:
        NextGadget->GadgetText = MakeIntui("ReColor",10,-1,3,3,JAM1);
        break;
      case 1:
        NextGadget->GadgetText = MakeIntui("Smooth",10,-1,3,3,JAM1);
        break;
    }
    OldGadget->NextGadget = NextGadget;
    OldGadget = NextGadget;
  }

  for (x = y = 0; y < NumContours; x += 6, y++) {

    NextGadget = MakeBool(4+x, 12,4,4,Colors[y],CONTSEL+y);

    if (NextGadget == (struct Gadget *) NULL)
      goto error;

    OldGadget->NextGadget = NextGadget;
    OldGadget = SelGadget[y] = NextGadget;
  }
  NextGadget->GadgetText = MakeIntui("Set",6,-2,3,3,JAM1);

  for (x = y = 0; y < NumContours; x += 6, y++) {

    NextGadget = MakeBool(4+x, 18, 4, 4, 3, CONTUP + y);

    if (NextGadget == (struct Gadget *) NULL)
      goto error;

    OldGadget->NextGadget = NextGadget;
    OldGadget = NextGadget;
  }
  NextGadget->GadgetText = MakeIntui("+",6,-2,3,3,JAM1);

  /*
   * Allocate the potentiometer gadgets for contour window
   */
  for (x = y = 0; y < NumContours; x += 6, y++) {

    NextGadget = MakePot(4+x, 24, 4, 32, CONTPOT+y, y);

    if (NextGadget == (struct Gadget *) NULL)
      goto error;

    PropInfo = (struct PropInfo *) NextGadget->SpecialInfo;

    if (ContourBase[y] < Ceiling) {

      PropInfo->VertPot =

      (USHORT) ((((Ceiling - (ContourBase[y] + 1))<<16)/(Ceiling)) & 0xffff);

    } else
      PropInfo->VertPot = 0;

    OldGadget->NextGadget = NextGadget;
    ContGadget[y] = NextGadget;
    OldGadget = NextGadget;
  }
  NextGadget->GadgetText = MakeIntui("Alt.",6,12,3,3,JAM1);

  /*
   * Allocate the push button gadgets for decrementing contours
   */
  for (x = y = 0; y < NumContours; x += 6, y++) {

    NextGadget = MakeBool(4+x, 58, 4, 4, 3, CONTDOWN + y);

    if (NextGadget == (struct Gadget *) NULL)
      goto error;

    if (y == NUMCONTS - 1) {
      NextGadget->GadgetText = MakeIntui("-",6,-2,3,3,JAM1);
    }
    OldGadget->NextGadget = NextGadget;
    OldGadget = NextGadget;
  }
  return( FirstGadget );

error:
  FreeGadgets(FirstGadget);
  return((struct Gadget *) NULL);

} /* MakeContours */

/*
 * Open the Contour window
 */
OpenContWind()
{
  struct Window *OpenMyWind();
  struct Gadget *gadgets;

  extern USHORT YScale;

  if (ContWind == (struct Window *) NULL) {

    gadgets = MakeContours();

    if (gadgets == (struct Gadget *) NULL) {
      DispErrMsg("Can't allocate contour gadget chain",0);
      return(0);
    }

    NewCont.TopEdge = 119 << YScale;

    ContWind = OpenMyWind(&NewCont, screen, gadgets, 320, 80, 320, 80);

    if (ContWind == (struct Window *) NULL) {
      DispErrMsg("Can't open Contour window",0);
      FreeGadgets(gadgets);
      return(0);
    }
    SetContTitle(0);
    DrawContBox(CurContour);
    ForceNormPointer();
  } else {
    WindowToFront( ContWind );
  }
  return(1);
} /* OpenContWind */

/*
 * Close the Mand window
 */
CloseContWind()
{
  if (ContWind != (struct Window *) NULL) {
    CloseMyWind(ContWind,NewCont.FirstGadget);
    ContWind = (struct Window *) NULL;
  }
} /* ClosePalWind */

/*
 * ReDisplay a given contour potentiometer gadget
 */
ReString(PotNum)
  SHORT PotNum;
{
  SHORT i;
  USHORT VertPot;

  if (ContourBase[PotNum] < Ceiling)
    VertPot = (USHORT) ((((Ceiling - (ContourBase[PotNum]+1))<<16)/(Ceiling)) & 0xffff);
  else
    VertPot = (USHORT) 0;
  NewModifyProp(ContGadget[PotNum], ContWind, NULL, FREEVERT | PROPBORDERLESS,
                0L, VertPot, 0L, 0L, 1L);
} /* ReString */

/*
 * ReDisplay all the contour potentiometer gadgets
 */
ModAll()
{
  SHORT i;
  USHORT VertPot;
  struct Gadget *PropGad = (struct Gadget *) ContGadget[0];

  for (i = 0; i < NUMCONTS; i++) {
    if (ContourBase[i] < Ceiling) {
      VertPot = (USHORT) ((((Ceiling - (ContourBase[i] + 1))<<16)/(Ceiling)) & 0xffff);
    } else
      VertPot = (USHORT) 0;
    NewModifyProp(PropGad,ContWind,NULL,FREEVERT|PROPBORDERLESS,0L,VertPot,0L,0L,1L);
    PropGad = PropGad->NextGadget;
  }
} /* ModAll */
//E*O*F contour.c//

echo x - disp.c
cat > "disp.c" << '//E*O*F disp.c//'
 /**************************************************************************
 *
 *                 MandelVroom Display Setup/Cleanup
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/

#include "mand.h"

extern struct Window *MandWind, *ContWind, *PalWind;
extern struct NewWindow NewMand, NewCont, NewPal;
extern struct Menu Menu;

extern struct Windows {
  struct Windows *NextWindow;
  struct Window  *Window;
} *WindowList;

extern struct MenuItem ViewModeSubs[];

extern SHORT  *ContourBase,Ceiling;

extern SHORT CountX, CountY;

struct IntuitionBase *IntuitionBase;
struct GfxBase       *GfxBase;
struct MathBase      *MathBase;

struct Screen   *screen = (struct Screen *) NULL;
struct RastPort *rp;
struct ViewPort *vp;

USHORT YScale, XScale;

USHORT *BabyBrotPointer = (USHORT *) NULL;
USHORT *BabyToPointer   = (USHORT *) NULL;
USHORT *SleepyPointer   = (USHORT *) NULL;

/* pointer types  */
#define UNINITIALIZED 0
#define NORMPOINTER   1
#define TOPOINTER     2
#define SLEEPYPOINTER 3

UBYTE   PointerType = UNINITIALIZED;

SHORT  SavePalette[32];
SHORT  Inited;

extern USHORT CmdMode;

struct NewScreen NewScreen = {
   0,0,                      /* start position           */
   320, 200, 5,              /* width, height, depth     */
   (UBYTE) 0, (UBYTE) 1,     /* detail pen, block pen    */
   (USHORT) NULL,            /* HIRES, INTERLACE, SPRITES, DUAL, HAM */
   CUSTOMSCREEN,             /* screen type              */
   (struct TextAttr *) NULL, /* font to use              */
   (UBYTE *) "                MandelVroom v1.50       by Kevin L. Clague",
   (struct Gadget *) NULL    /* pointer to extra gadgets */
};

/***************************************************************************
 *
 * Open the Libraries and custom screen
 *
 **************************************************************************/

/*
 * Open the libraries
 */
OpenLibs() {
  IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",0);
  if (IntuitionBase == (struct IntuitionBase *) NULL) {
     printf("Couldn't get Intuition\n");
     return(100);
     }

  GfxBase = (struct GfxBase *) OpenLibrary("graphics.library",0);
  if (GfxBase == (struct GfxBase *) NULL) {
     printf("Couldn't get Graphics\n");
     return(100);
     }

  MathBase = (struct MathBase *) OpenLibrary("mathffp.library",0);
  if (MathBase == (struct MathBase *) NULL) {
     printf("Couldn't get MathFFP\n");
     return(100);
     }

  return(0);
} /* OpenLibs */

/*
 * Close the libraries used
 */
CloseLibs() {
  if (IntuitionBase != (struct IntuitionBase *) NULL) CloseLibrary(IntuitionBase);
  if (GfxBase       != (struct GfxBase *) NULL) CloseLibrary(GfxBase);
  if (MathBase      != (struct MathBase *) NULL) CloseLibrary(MathBase);
} /* CloseLibs */

/*
 * Open the display
 */
OpenDisp()
{
  SHORT i;

  struct Window *OpenMyWind();
  struct Screen *OpenScreen();

  if (NewScreen.ViewModes & HIRES) {
    NewScreen.Width = 640;
    if ( NewScreen.Depth > 4 ) NewScreen.Depth = 4;
    XScale = 1;

  } else {
    NewScreen.Width = 320;
    XScale = 0;
  }

  if (NewScreen.ViewModes & INTERLACE) {
    NewScreen.Height = 400;
    YScale = 1;
  } else {
    NewScreen.Height = 200;
    YScale = 0;
  }

  screen = OpenScreen( (struct NewScreen *) &NewScreen);

  if (screen == (struct Screen *) NULL) {
     AndDie("Can't open new screen!\n");
  }
  InitViewModesSubs();
  InitDepthSubs();
  InitGenSubs();
  InitMaxISubs();

  AllocateMice();

  OpenMandWind();

  if ( MandWind == (struct Window *) NULL ) {
    AndDie("Can't open Picture window\n");
  }

  rp = MandWind->RPort;
  vp = &screen->ViewPort;

  if ( Inited )
    LoadRGB4(vp, &SavePalette[0], 32);
  Inited = 1;

  return(0);
} /* opendisp */

/*
 *  Close the screen
 */
CloseDisp() {
  LONG i;

  ClosePalWind();
  CloseContWind();
  CloseMandWind();

  if (Inited)
    for (i = 0; i < 32; i++) SavePalette[i] = GetRGB4(vp->ColorMap, i);

  if ( screen )   CloseScreen(screen);

  FreeMice();

} /* CloseDisp */

AndDie( ErrMsg )
  char *ErrMsg;
{
  extern SHORT *CountBase;

  printf("%s\n", ErrMsg);

  CloseLibs();

  CloseDisp();

  if (CountBase)
    FreeMem( CountBase, CountX * CountY * sizeof( USHORT ) );

  printf("Something unrecoverable happened!!!\n");
  exit(0);
}

/***************************************************************************
 *
 * Open and Close Window tools
 *
 **************************************************************************/

/*
 *  Open a window and put it in the window list
 */
struct Window *OpenMyWind(NewWind, Screen, Gadgets, Width, Height,
                          MaxWidth, MaxHeight)
  struct NewWindow *NewWind;
  struct Screen *Screen;
  struct Gadget *Gadgets;
  SHORT  Width, Height, MaxWidth, MaxHeight;
{
  struct Window *Window, *OpenWindow();
  struct Windows *Windows;

  NewWind->Screen = Screen;
  NewWind->FirstGadget = Gadgets;

  NewWind->Width = Width << XScale;
  NewWind->Height = Height << YScale;

  NewWind->MaxWidth = MaxWidth << XScale;
  NewWind->MaxHeight = MaxHeight << YScale;

  Window = OpenWindow( (struct NewWindow *) NewWind);

  if (Window == (struct Window *) NULL) {
    DispErrMsg("Can't open new window",0);
    return( (struct Window *) NULL);
  }

  Windows = (struct Windows *) AllocMem(sizeof(struct Windows), MEMF_CLEAR);

  if (Windows == (struct Windows *) NULL) {
    DispErrMsg("Can't malloc Windows. Out of RAM!!",0);
    return( (struct Window *) NULL);
  }

  Windows->Window = Window;
  if (WindowList)
    Windows->NextWindow = WindowList;
  WindowList = Windows;

  SetMenuStrip(Window, &Menu);

  return(Window);
} /* OpenMyWind */

/*
 * Remove the window from the window list,
 *   deallocate all the gadgets associated with this window
 */
CloseMyWind(Window,Gadgets)
  struct Window *Window;
  struct Gadget *Gadgets;
{
  struct Windows *Windows = WindowList, *PrevWinds = WindowList;

  if (Window) {

     /* get rid of the menu */
     ClearMenuStrip(Window);

     /* get rid of the previous pointer */
     ClearPointer(Window);

     if (Window == Windows->Window) {
       WindowList = WindowList->NextWindow;
       FreeMem(Windows,sizeof(struct Windows));
     } else {
       while (Windows && Windows->Window != Window) {
         PrevWinds = Windows;
         Windows = Windows->NextWindow;
       }
       if (Windows) {
         PrevWinds->NextWindow = Windows->NextWindow;
         FreeMem(Windows,sizeof(struct Windows));
       }
     }
     CloseWindow(Window);
     if (Gadgets)
       FreeGadgets(Gadgets);
  }
} /* CloseMyWind */

/*************************************************************************
 *
 * Allocate and ititialize gadget tools
 *
 ************************************************************************/

/*
 * Make a generic boolean gadget
 */
struct Gadget *MakeBool(x,y,xd,yd,c,id)
  SHORT  x,y,xd,yd;
  UBYTE  c;
  USHORT id;
{
  struct Gadget *NewGadget;
  struct Image  *NewImage;

  NewGadget = (struct Gadget *)
    AllocMem( (LONG) sizeof(struct Gadget), (LONG) MEMF_CLEAR );
  if (NewGadget == (struct Gadget *) NULL)
    return((struct Gadget *) NULL);

  NewImage = (struct Image *)
    AllocMem( (LONG) sizeof(struct Image), (LONG) MEMF_CHIP | MEMF_CLEAR );
  if (NewImage == (struct Image *) NULL) {
    FreeMem( NewGadget, (LONG) sizeof(struct Gadget));
    return((struct Gadget *) NULL);
  }
  NewGadget->LeftEdge = x << XScale;
  NewGadget->TopEdge  = y << YScale;
  NewGadget->Width    = xd << XScale;
  NewGadget->Height   = yd << YScale;
  NewGadget->Flags    = GADGHCOMP | GADGIMAGE;
  NewGadget->Activation = GADGIMMEDIATE;
  NewGadget->GadgetRender = (APTR) NewImage;
  NewGadget->GadgetType = BOOLGADGET;
  NewGadget->GadgetID = id;

  NewImage->Width = xd << XScale;
  NewImage->Height = yd << YScale;
  NewImage->PlaneOnOff = c;

  return(NewGadget);
} /* MakeBool */

/*
 * Make a generic potentiometer gadget
 */
struct Gadget *MakePot(x, y, xd, yd, id, cnt)
  SHORT  x,y,xd,yd;
  USHORT id;
  USHORT cnt;
{
  struct Gadget   *NewGadget;
  struct PropInfo *NewInfo;
  struct Image    *NewImage;

  NewGadget = (struct Gadget *)
    AllocMem( (LONG) sizeof(struct Gadget), MEMF_CLEAR );
  if (NewGadget == (struct Gadget *) NULL)
    return((struct Gadget *) NULL);

  NewImage = (struct Image *)
    AllocMem( (LONG) sizeof(struct Image), (LONG) MEMF_CHIP | MEMF_CLEAR );
  if (NewImage == (struct Image *) NULL) {
    FreeMem( NewGadget, (LONG) sizeof(struct Gadget));
    return((struct Gadget *) NULL);
  }
  NewInfo = (struct PropInfo *)
    AllocMem( (LONG) sizeof(struct PropInfo), MEMF_CLEAR );
  if (NewInfo == (struct PropInfo *) NULL) {
    FreeMem( NewGadget, (LONG) sizeof(struct Gadget));
    FreeMem( NewImage,  (LONG) sizeof(struct Image));
    return((struct Gadget *) NULL);
  }
  NewGadget->LeftEdge = x << XScale;
  NewGadget->TopEdge  = y << YScale;
  NewGadget->Width    = xd << XScale;
  NewGadget->Height   = yd << YScale;
  NewGadget->Flags    = GADGHIMAGE | GADGIMAGE;
  NewGadget->Activation   = RELVERIFY;
  NewGadget->GadgetType   = PROPGADGET;
  NewGadget->GadgetRender = (APTR) NewImage;
  NewGadget->SelectRender = (APTR) NewImage;
  NewGadget->SpecialInfo  = (APTR) NewInfo;
  NewGadget->GadgetID     = id;

  NewImage->PlaneOnOff = 1;
  NewImage->Width  = 4 << XScale;
  NewImage->Height = 3 << YScale;

  NewInfo->Flags = PROPBORDERLESS | FREEVERT;

  return(NewGadget);
} /* MakePot */

/*
 * Make an IntuiText structure
 */
struct IntuiText *MakeIntui(str, x, y, frontpen, backpen, drawmode )
  UBYTE *str;
  SHORT  x, y;
  UBYTE  frontpen, backpen, drawmode;
{
  struct IntuiText *NewIntui;

  NewIntui = (struct IntuiText *)
    AllocMem( (LONG) sizeof(struct IntuiText), (LONG) MEMF_CLEAR );

  if (NewIntui == (struct IntuiText *) NULL)
    return((struct IntuiText *) NULL);

  NewIntui->FrontPen = frontpen;
  NewIntui->BackPen  = backpen;
  NewIntui->DrawMode = drawmode;
  NewIntui->LeftEdge = x << XScale;
  NewIntui->TopEdge  = y << YScale;

  NewIntui->IText    = str;

  return(NewIntui);
} /* MakeIntui */

/*
 * Free a string of gadgets
 */
FreeGadgets(FirstGadget)
  struct Gadget *FirstGadget;
{
  struct Gadget *NextGadget;

  while (FirstGadget) {
    if (FirstGadget->GadgetRender)
      FreeMem(FirstGadget->GadgetRender, (LONG) sizeof(struct Image));

    if (FirstGadget->SpecialInfo)
      FreeMem(FirstGadget->SpecialInfo, (LONG) sizeof(struct PropInfo));

    if (FirstGadget->GadgetText)
      FreeMem(FirstGadget->GadgetText, (LONG) sizeof(struct IntuiText));

    NextGadget = FirstGadget->NextGadget;
    FreeMem(FirstGadget, (LONG) sizeof(struct Gadget));
    FirstGadget = NextGadget;
  }
} /* FreeGadgets */



/***************************************************************************
 *
 * This section handles the Mouse pointer for the custom screen
 *
 **************************************************************************/

/***************************************************************/
/*  This is the image for baby Mandelbrot pointer              */
/***************************************************************/

USHORT BabyBrotSprite[]=  {
     /*plane1  plane0 */
      0x0000,  0x0000,
      0x8000,  0x0000,
      0x0000,  0x5000,
      0x2000,  0x2202,
      0x1600,  0x5f82,
      0x0802,  0x1913,
      0x1152,  0x11fe,
      0x1008,  0x300a,
      0x0404,  0x1c06,
      0x0006,  0x1407,
      0x0404,  0x0404,
      0x000c,  0x042c,
      0x0400,  0x0c1c,
      0x0220,  0x0630,
      0x01e0,  0x05f0,
      0x0c80,  0x3f80,
      0x0000,  0x0880,
      0x0000,  0x0000,
     };

/***************************************************************/
/*  This is a baby brot pointer with 'TO' in it.               */
/***************************************************************/
USHORT BabyToSprite[]=  {
     /*plane1  plane0 */
      0x0000,  0x0000,
      0x8000,  0x0000,
      0x0100,  0x5100,
      0x2000,  0x2202,
      0x1600,  0x5f82,
      0xfe7a,  0x0103,
      0x93de,  0x0132,
      0x108c,  0x200a,
      0x5484,  0x4c02,
      0x1086,  0x0403,
      0x1484,  0x0400,
      0x10cc,  0x0420,
      0x3c78,  0x0404,
      0x0220,  0x0630,
      0x01e0,  0x05f0,
      0x0c80,  0x3f80,
      0x0000,  0x0880,
      0x0000,  0x0000,
     };

/***************************************************************/
/*  This is a sleepy cloud pointer                             */
/***************************************************************/
USHORT SleepySprite[] = {
      0x0000,  0x0000,
      0x0fe0,  0x0000,
      0x1830,  0x07c0,
      0x7018,  0x0fe0,
      0xc008,  0x3ff0,
      0x9e0c,  0x7ff0,
      0x8406,  0x7ff8,
      0x8802,  0x7ffc,
      0x1e03,  0xfffc,
      0x80f1,  0x7ffe,
      0x8021,  0x7ffe,
      0x4040,  0x3fff,
      0x80f1,  0x7ffe,
      0xc001,  0x3ffe,
      0x6003,  0x1ffc,
      0x3006,  0x0ff8,
      0x180c,  0x07f0,
      0x0718,  0x00e0,
      0x0070,  0x0f80,
      0x1810,  0x07e0,
      0x0820,  0x0740,
      0x0ff0,  0x0000,
      0x0020,  0x03c0,
      0x0410,  0x03e0,
      0x0310,  0x00e0,
      0x00e0,  0x0000,
      0x0000,  0x0000,
     };

/* defines for the cute pointer sprite */
#define MYSPRITE_WIDTH 16
#define MYSPRITE_HEIGHT 16
#define SLEEPY_WIDTH 16
#define SLEEPY_HEIGHT 25
#define MYSPRITE_HOTX -1
#define MYSPRITE_HOTY 0

#define BABYSIZE   ( (MYSPRITE_HEIGHT + 2) * 8)
#define TOSIZE     ( (MYSPRITE_HEIGHT + 2) * 8)
#define SLEEPYSIZE ( (SLEEPY_HEIGHT + 2) * 8)

/*
 * Copy an Image into a chip ram image
 */
USHORT *MakeChipSprite( FastRamSprite, Size )
  USHORT *FastRamSprite;
  int    Size;
{
  USHORT *ChipSprite, *SaveSprite, *AllocaMem();
  int i;

  ChipSprite = AllocMem( (LONG) (Size * sizeof(SHORT)), MEMF_CHIP );

  if ( ChipSprite == (struct USHORT * ) NULL )
    return ( ChipSprite );

  SaveSprite = ChipSprite;

  for ( i = 0; i < Size; i++)
    *(ChipSprite++) = *(FastRamSprite++);

  return( SaveSprite );
}

/*
 * Allocate all the mouse pointer sprites used by this program
 */
AllocateMice()
{
  BabyBrotPointer = MakeChipSprite( BabyBrotSprite, BABYSIZE );
  BabyToPointer   = MakeChipSprite( BabyToSprite,   TOSIZE );
  SleepyPointer   = MakeChipSprite( SleepySprite,   SLEEPYSIZE );
}

/*
 * Free all the mouse pointer sprites used by this program
 */
FreeMice()
{

  if ( BabyBrotPointer )
    FreeMem( BabyBrotPointer, BABYSIZE * sizeof(SHORT) );
  BabyBrotPointer = NULL;

  if ( BabyToPointer )
    FreeMem( BabyToPointer, TOSIZE * sizeof(SHORT) );
  BabyToPointer = NULL;

  if ( SleepyPointer )
    FreeMem( SleepyPointer, SLEEPYSIZE * sizeof(SHORT) );
  SleepyPointer = NULL;
}

/*
 * Set all window pointers NewPointer
 */
SetPointers( NewPointer, Height, Width)
  USHORT *NewPointer;
  int     Height, Width;
{
  if (NewPointer == (struct USHORT *) NULL )
    return();

  if ( ContWind )
    SetPointer( ContWind, NewPointer, Height,   Width,
                                     MYSPRITE_HOTX, MYSPRITE_HOTY);
  if ( MandWind )
    SetPointer( MandWind, NewPointer, Height,  Width,
                                     MYSPRITE_HOTX, MYSPRITE_HOTY);
  if ( PalWind )
    SetPointer( PalWind,  NewPointer, Height,   Width,
                                     MYSPRITE_HOTX, MYSPRITE_HOTY);
}

/*
 * Clear the window pointers
 */
ClearPointers()
{
    if ( MandWind ) ClearPointer( MandWind );
    if ( ContWind ) ClearPointer( ContWind );
    if ( PalWind )  ClearPointer( PalWind );
}

/*
 * Force normal pointers
 */
ForceNormPointer()
{
  PointerType = UNINITIALIZED;

  SetNormPointer();
}

/*
 * Set Normal Mouse Pointer
 */
SetNormPointer()
{
  if (PointerType != NORMPOINTER ) {
    ClearPointers();

    SetPointers( BabyBrotPointer, MYSPRITE_HEIGHT, MYSPRITE_WIDTH );

    PointerType = NORMPOINTER;
  }
  CmdMode = NULL;
}

/*
 * Set 'To' Mouse Pointer
 */
SetToPointer()
{
  if (PointerType != TOPOINTER ) {
    ClearPointers();

    SetPointers( BabyToPointer, MYSPRITE_HEIGHT, MYSPRITE_WIDTH );

    PointerType = TOPOINTER;
  }
}

/*
 * Set Sleepy Mouse Pointer
 */
SetSleepyPointer()
{
  if (PointerType != SLEEPYPOINTER ) {
    ClearPointers();

    SetPointers( SleepyPointer, SLEEPY_HEIGHT, SLEEPY_WIDTH );

    PointerType = SLEEPYPOINTER;
  }
}

SetSystemColors(flag)
  int flag;
{

  UWORD red, green, blue;

  static SHORT MenuColors[4] = { 0x0000, 0x0fff, 0x000a, 0x0b44 };
  static SHORT PointerColors[4] = { 0x0000, 0x00c0, 0x0dd0, 0x0f00 };
  static SHORT ColorSave[32];
  static SHORT SaveFull = 0;

  int i;

  if (flag) {
    if (SaveFull == 0) {
      for (i = 0; i < 32; i++) {
        ColorSave[i] = GetRGB4(vp->ColorMap, i);
      }
      /* Set the colors for the Menu */
      for (i = 0; i < 4; i++) {
        red = (MenuColors[i] & 0xf00) >> 8;
        green = (MenuColors[i] & 0x0f0) >> 4;
        blue  = (MenuColors[i] & 0x00f) ;
        SetRGB4(vp, i , red , green, blue);
      }

      /* Set the colors for the Mouse pointer */
      for (i = 0; i < 4; i++) {
        red = (PointerColors[i] & 0xf00) >> 8;
        green = (PointerColors[i] & 0x0f0) >> 4;
        blue  = (PointerColors[i] & 0x00f) ;
        SetRGB4(vp, i + 16, red , green, blue);
      }
    }
    SaveFull++;
  } else {
    if (SaveFull == 1)
      LoadRGB4(vp, &ColorSave[0], 32);

    if (--SaveFull < 0) SaveFull = 0;
  }
}

/**************************************************************************
 *
 *  This code is used to display error messages on the cusom screen
 *
 **************************************************************************/
struct IntuiText msg_txt =
   {
     0,
     1,
     JAM2,
     5,
     20,
     NULL,
     NULL,
     NULL
   };

struct IntuiText OK_txt =
   {
     0,
     1,
     JAM2,
     5,
     3,
     NULL,
     (UBYTE *) "OK",
     NULL
   };

struct IntuiText NO_txt =
   {
     0,
     1,
     JAM2,
     5,
     3,
     NULL,
     (UBYTE *) "NO",
     NULL
   };


DispErrMsg(ErrMsg, Flag)
  UBYTE *ErrMsg;
  SHORT  Flag;
{
  msg_txt.IText = ErrMsg;

  SetNormPointer();

  if (MandWind) {
    SetSystemColors(1);
    if (Flag) {

      AutoRequest(MandWind, &msg_txt, &OK_txt, &NO_txt, 0L, 0L,
         (long) (IntuiTextLength(&msg_txt) + 50L), 70L);
    } else {

      AutoRequest(MandWind, &msg_txt, 0L, &OK_txt, 0L, 0L,
         (long) (IntuiTextLength(&msg_txt) + 50L), 70L);
    }
    SetSystemColors(0);
  } else {
    printf("%s\n", ErrMsg);
  }
}



//E*O*F disp.c//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
     41    128   1097 Makefile
      8     55    345 README
   1115   4155  31593 contour.c
    786   2110  18438 disp.c
   1950   6448  51473 total
!!!
wc  Makefile README contour.c disp.c | sed 's=[^ ]*/==' | diff -b $temp -
exit 0


-- 
UUCP:  orandy@amdahl.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

orandy@amdahl.UUCP (05/20/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# main.c mand.c mand.h menu.c menu1.c nav.c

echo x - main.c
cat > "main.c" << '//E*O*F main.c//'
/***************************************************************************
 *
 *                         MandelZoom Main
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1986
 *
 **************************************************************************/

#include "mand.h"
#include <libraries/dosextens.h>

extern struct Menu Menu[], GenMenu[];

extern USHORT CmdMode;

extern SHORT CountX,CountY;

extern float StartX, StartY, EndX, EndY;
extern LONG  NavTop,NavBot,NavRight,NavLeft;
extern SHORT DragSize, BoxSizeX, BoxSizeY;

extern struct NewScreen NewScreen;
extern struct Screen *screen;

extern struct Window *ContWind,*MandWind,*PalWind;
extern struct NewWindow NewMand,NewCont,NewPal;

extern SHORT MaxCount;

extern SHORT *ContourBase;
extern UBYTE *ColorBase;

struct IntuiMessage *message;

SHORT *CountBase = (SHORT *) NULL;

UBYTE  QuitScreen = FALSE;

UBYTE  MandType;

ULONG  BorderType = 0;

SHORT MouseX,MouseY;

SHORT Zoom = 0;

ULONG SaveIDCMP;

SHORT HotSpotX, HotSpotY;

struct Windows {
  struct Windows *NextWindow;
  struct Window  *Window;
} *WindowList;

/*
 * Do it all
 */
main () {
  if (OpenLibs() == 0 && OpenDisp() == 0) {
    InitPreset(0);
    GenerateIt();
    DoBrot();
  }

  CloseDisp();

  if (CountBase) {
    FreeMem(CountBase,CountX*CountY*sizeof(SHORT));
  }

  CloseLibs();
}

/*
 * Decide what to do to satisfy this message
 */
DoBrot()
{
  ULONG   class;
  USHORT  code = 0;
  SHORT   ContNum;
  struct  MenuItem *Item;
  struct  Gadget *gadget;
  struct  Windows *Windows;
  struct  Window  *Window;
  ULONG   WaitMask;

#define INTUINULL ((struct IntuiMessage *) NULL)

  extern struct MenuItem *ItemAddress();
  extern struct IntuiMessage *GetMsg();

  if (WindowList == (struct Windows *) NULL) {
    printf("Fatal programming error\nNo windows\n");
    return(0);
  }

  while (QuitScreen == FALSE) {

    /* grab the first window in the list */
    Windows = WindowList;
    Window  = Windows->Window;

    /* while we still have windows and there are no messages,
       gather up the wait bit mask */

    WaitMask = 0;

    while (Windows && (message = GetMsg( Window->UserPort)) == INTUINULL ) {
      /* Add to the wait mask */
      WaitMask |= 1L << Window->UserPort->mp_SigBit;

      Windows = Windows->NextWindow;
      Window  = Windows->Window;
    }

    /* Wait here for a message */
    if (message == (struct IntuiMessage *) NULL) {
      Wait(WaitMask);
      continue;
    }

    /* got a message */
    class  = message->Class;
    code   = message->Code;
    gadget = (struct Gadget *) message->IAddress;
    MouseX = message->MouseX;
    MouseY = message->MouseY;
    ReplyMsg(message);

    if (class == MOUSEMOVE) {
      DoMouseMove(MouseX, MouseY);   /* Try this first */
    } else

    if (class == MENUPICK) {

      SetNormPointer();

      while (code != MENUNULL) {
        switch (MENUNUM(code)) {
          case PROJECTMENU:
               ScreenProject(code);
               break;
          case EDITMENU:
               EditScreen(code);
               break;
          case PRESETMENU:
               SetPreset(ITEMNUM(code));
               break;
        }
        Item = ItemAddress( (struct Menu *) &Menu[0], code);
        code = Item->NextSelect;
      }
    } else

    if (class == GADGETDOWN) {
      DoGadgetDown(gadget);
    } else

    if (class == GADGETUP) {
      DoGadgetUp(gadget);
    } else

    if (class == MOUSEBUTTONS) {
      DoMouseButtons(code);
    } else

    if (class == CLOSEWINDOW) {
      SetNormPointer();

      if (Windows->Window == ContWind) {
        CloseContWind();

      } else
      if (Windows->Window == PalWind) {
        ClosePalWind();
      }
    }
  }
} /* DoBrot */

/*
 * Perform functions for Gadget down messages
 */
DoGadgetDown(gadget)
  struct Gadget *gadget;

{
  switch (gadget->GadgetID >> WINDTYPEBITS & WINDMASK) {
  case PALTYPE:
       DoPalette(gadget);
       break;

  case CONTYPE:
       DoContourDown(gadget);
       break;
  }
} /* DoGadgetDown */

/*
 * Perform functions for Gadget up messages
 */
DoGadgetUp(gadget)
  struct Gadget *gadget;
{
  switch (gadget->GadgetID >> WINDTYPEBITS & WINDMASK) {
  case PALTYPE:
       SetNormPointer();
       break;

  case CONTYPE:
       DoContourUp(gadget);
       break;
  }
} /* DoGadgetUp */

/*
 * Perform functions for Mouse buttons
 */
DoMouseButtons(code)
  USHORT code;
{
  extern SHORT XScale, YScale;

#define MINXBOX (8 << XScale)
#define MINYBOX (8 << YScale)

  switch (code) {
  case SELECTDOWN:

       switch(CmdMode) {

       case IMPLIEDSET:
            DoWindowPick(MouseX, MouseY);
            CmdMode = NULL;
            break;

       case STARTBOX:
            StartZoomBox();
            break;

       case NULL:            /* must be trying to move or resize with mouse */
            DoZoomBoxGadgets();
            break;
       }
       break;

  case SELECTUP:

       ModifyIDCMP(MandWind, MandWind->IDCMPFlags & ~MOUSEMOVE);

       switch(CmdMode) {

       case ZOOMDRAG:
            CmdMode = NULL;

            /* redraw the extras */
            DrawExtras(NavLeft, NavTop, NavRight, NavBot );
            break;

       case STRETCHBOX:
            DrawBox(NavLeft, NavTop, NavRight, NavBot );

            if ( NavRight - NavLeft < MINXBOX )
              NavRight = NavLeft + MINXBOX;

            if ( NavBot - NavTop < MINYBOX )
              NavBot = NavTop + MINYBOX;

            /* draw the extras */
            DrawExtras(NavLeft, NavTop, NavRight, NavBot );

            DrawBox(NavLeft, NavTop, NavRight, NavBot );
            CmdMode = NULL;
            break;

       }

       SetNormPointer();

       break;
  }
} /* DoMouseButtons */

/*
 * Start Zoom box
 */
StartZoomBox()
{
  if (Zoom == 0) {
    if (MouseX > LEFTMARG && MouseX < MandWind->Width - RIGHTMARG &&
        MouseY > TOPMARG  && MouseY < MandWind->Height - BOTMARG) {

      Zoom = 1;

      /* Draw first box */
      NavTop   = MouseY;
      NavLeft  = MouseX;
      NavBot   = NavTop;
      NavRight = NavLeft;
      HotSpotX = HotSpotY = 0;
      CmdMode = STRETCHBOX;

      DrawBox(NavLeft, NavTop, NavRight, NavBot );
      ModifyIDCMP(MandWind, MandWind->IDCMPFlags | MOUSEMOVE);
    }
  }
}

/*
 * Simulate Zoom box gadgets
 */
DoZoomBoxGadgets()
{
  extern SHORT XScale, YScale;

  SetNormPointer();

  if ( Zoom == 1 ) {

    /* is it in the window box? */
    if (MouseX >= NavLeft && MouseX <= NavRight &&
        MouseY >= NavTop  && MouseY <= NavBot) {

      /* is it in the top part? */
      if (MouseY <= NavTop + (3 << YScale)) {

        /* is it the drag bar? */
        if (MouseX > NavLeft + (3 << XScale)) {

          HotSpotX = MouseX - NavLeft;
          HotSpotY = MouseY - NavTop;

          /* undraw the extras */
          DrawExtras(NavLeft, NavTop, NavRight, NavBot );
          CmdMode = ZOOMDRAG;

        } else {                     /* We got the close gadget */
          CmdMode = NULL;
          DrawBox(NavLeft, NavTop, NavRight, NavBot );

          /* undraw the extras */
          DrawExtras(NavLeft, NavTop, NavRight, NavBot );
          Zoom = 0;
        }
      } else {

        /* is it the Resize Gadget? */
        if (MouseY >= NavBot - (3 << YScale) &&
            MouseX >= NavRight - (3 << XScale)) {

          HotSpotX = NavRight - MouseX;
          HotSpotY = NavBot   - MouseY;

          CmdMode = STRETCHBOX;
          /* undraw the extras */
          DrawExtras(NavLeft, NavTop, NavRight, NavBot );
        }
      }
    }
  }
  if (CmdMode) {
    ModifyIDCMP(MandWind, MandWind->IDCMPFlags | MOUSEMOVE);
  }
}

/*
 * Perform functions for Mouse movements
 */
DoMouseMove( MouseX, MouseY)
  SHORT MouseX, MouseY;
{
  SHORT Width, Height;

  switch(CmdMode) {

  case COLORSLIDE:
       ModifyColors();
       break;

  case STRETCHBOX:

       DrawBox(NavLeft, NavTop, NavRight, NavBot );

       if ( MouseX < NavLeft )
         MouseX = NavLeft;

       if ( MouseY < NavTop )
         MouseY = NavTop;

       if ( MouseX + HotSpotX > CountX + LEFTMARG )
         MouseX = CountX + LEFTMARG - HotSpotX;

       if ( MouseY + HotSpotY > CountY + TOPMARG )
         MouseY = CountY + TOPMARG - HotSpotY;

       DrawBox(NavLeft, NavTop, MouseX, MouseY);

       NavBot   = MouseY;
       NavRight = MouseX;
       break;

  case ZOOMDRAG:
       DrawBox(NavLeft, NavTop, NavRight, NavBot );

       Width  = NavRight - NavLeft - HotSpotX;
       Height = NavBot - NavTop - HotSpotY;

       if ( MouseY < 1 )
         MouseY = 1;

       if ( MouseX - HotSpotX < LEFTMARG )
         MouseX = LEFTMARG + HotSpotX;

       if ( MouseY - HotSpotY < TOPMARG )
         MouseY = TOPMARG + HotSpotY;

       if ( MouseX + Width > CountX + LEFTMARG )
         MouseX = CountX + LEFTMARG - Width;

       if ( MouseY + Height > CountY + TOPMARG )
         MouseY = CountY + TOPMARG - Height;

       NavLeft  = MouseX - HotSpotX;
       NavTop   = MouseY - HotSpotY;

       NavRight = MouseX + Width;
       NavBot   = MouseY + Height;

       DrawBox(NavLeft, NavTop, NavRight, NavBot );
       break;
  }
} /* DoMouseMove */
//E*O*F main.c//

echo x - mand.c
cat > "mand.c" << '//E*O*F mand.c//'
/***************************************************************************
 *
 *                       MandelVroom Generator
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/

#include "mand.h"

#define PICTWINDXSIZE 100
#define PICTWINDYSIZE 100

#define PICTXSIZE  (PICTWINDXSIZE - LEFTMARG - RIGHTMARG)
#define PICTYSIZE  (PICTWINDYSIZE - TOPMARG - BOTMARG)

#define DEFAULTLEFT  -2.0
#define DEFAULTRIGHT  2.0
#define DEFAULTTOP   -2.0
#define DEFAULTBOT    2.0

extern struct Screen   *screen;
extern struct RastPort *rp;

extern SHORT *CountBase;
extern LONG NavTop, NavBot, NavLeft, NavRight;

extern SHORT Zoom;

extern struct Menu Menu, GenMenu;

extern SHORT *ContourBase;
extern UBYTE *ColorBase, MandType;

struct Window *MandWind = (struct Window *) NULL;

struct NewWindow NewMand = {
   0,1,                      /* start position           */
   80,80,                    /* width, height            */
   (UBYTE) 0, (UBYTE) 1,     /* detail pen, block pen    */
                             /* IDCMP flags */
   MENUPICK | GADGETDOWN | GADGETUP | MOUSEBUTTONS,
   WINDOWDEPTH | WINDOWSIZING | ACTIVATE | REPORTMOUSE, /* MandWind flags */
   (struct Gadget *) NULL,   /* first gadget             */
   (struct Image *) NULL,    /* user checkmark           */
   (UBYTE *) "Picture",      /* MandWind title             */
   (struct Screen *) NULL,   /* pointer to screen        */
   (struct BitMap *) NULL,   /* pointer to superbitmap   */
   80,80,320,200,            /* sizing                   */
   CUSTOMSCREEN              /* type of screen           */
   };

float StartX = DEFAULTLEFT;
float StartY = DEFAULTTOP;
float EndX   = DEFAULTRIGHT;
float EndY   = DEFAULTBOT;

float GapY = ( DEFAULTBOT - DEFAULTTOP ) / PICTXSIZE;
float GapX = 0.88 * ( DEFAULTBOT - DEFAULTTOP ) / PICTYSIZE;

SHORT MaxCount = 1023;

SHORT CountX = PICTXSIZE;
SHORT CountY = PICTYSIZE;

ULONG CalcTime;

/*
 * Generate It
 */
GenerateIt()
{
 ClosePalWind();
 CloseContWind();

 ClearMenuStrip(MandWind);
 SetMenuStrip(MandWind, &GenMenu);

 switch ( MandType ) {
   case 0:
        IntMandelbrot();
        break;
   case 1:
        Mandelbrot();
        break;
 }

 ClearMenuStrip(MandWind);
 SetMenuStrip(MandWind, &Menu);
}

/*
 * Fast Floating Point Mandelbrot Generator
 */
Mandelbrot()
{
  int i, j, k, l;
  int TraceSize = 32;

  register float cura, curb, cura2, curb2;

  float curx, cury, napx, napy;
  float olda[64], oldb[64];
  float *RealTrace,*ImagTrace;

  SHORT *CountPtr;

  UBYTE  ColorXlate[1030];

#asm
olda      equ -548
oldb      equ -292
TraceSize equ -20
l         equ -16
k         equ -12
curx      equ -24
cury      equ -28
#endasm

  /* Map contours into color translate table */
  for (i = 0,j = 1029; i < NUMCONTS; i++)
    for (; j >= ContourBase[i] && j; )
      ColorXlate[j--] = ColorBase[i];

  while (j >= 0) ColorXlate[j--] = 0;

  /* free up old counts memory, get new picture size, get new counts memory
   */
  GetCountsMemory();

  /* clear the picture area */

  SetAPen(MandWind->RPort, 0);

  RectFill(MandWind->RPort, LEFTMARG, TOPMARG,
                            MandWind->Width - 12,  MandWind->Height - 2);
  CountPtr = CountBase;

  /* calculate new picture's coordinates from zoom box */
  ZoomIn();

  /* start in the upper left hand corner */
  cury = StartY;

  /*
   * for each pixel, calculate mandelbrot
   */
  for (i = 0; i < CountY; i++) {
    curx = StartX;
    for (j = 0; j < CountX; j++) {
      cura = curb = cura2 = curb2 = 0;
      for (k = 0; k < MaxCount; k += TraceSize) {

#ifdef SLOW
        RealTrace = olda;
        ImagTrace = oldb;
        for (l = 0; l < TraceSize; l++) {
          *(RealTrace++) = cura;
          *(ImagTrace++) = curb;

          curb *= cura;
          curb += curb + cury;

          cura = cura2 - curb2 + curx;

          cura2 = cura * cura;
          curb2 = curb * curb;
          if (cura2+curb2 > 4.0)
            goto out;
        }
        RealTrace = olda;
        ImagTrace = oldb;
        for (l = 0; l < TraceSize; l++)
          if (cura == *(RealTrace++) && curb == *(ImagTrace++)) {
            k += MaxCount;
            goto out;
          }
#else
#asm
       public  _LVOSPMul
       public  _LVOSPAdd
       public  _LVOSPSub
       public  _LVOSPCmp
       public  _MathBase
       move.l  _MathBase,a6
       lea.l    olda(a5),a0        ;   RTrace = olda
       lea.l    oldb(a5),a1        ;   ITrace = oldb
       clr.l    l(a5)              ;for (l = TraceSize; l--; ) {
lloop  move.l   d4,(a0)+           ;   *(RTrace++) = cura
       move.l   d5,(a1)+           ;   *(ITrace++) = curb
       move.l   d4,d0              ;   curb *= cura
       move.l   d5,d1
       jsr     _LVOSPMul(a6)
       move.l   d0,d1              ;   curb += curb
       jsr     _LVOSPAdd(a6)
       move.l   cury(a5),d1        ;   curb += cury
       jsr     _LVOSPAdd(a6)
       move.l   d0,d5
       move.l   d6,d0              ;   cura = cura2-curb2+curx
       move.l   d7,d1
       jsr     _LVOSPSub(a6)
       move.l   curx(a5),d1
       jsr     _LVOSPAdd(a6)
       move.l   d0,d4
;
       move.l   d0,d1              ;   cura2 = cura*cura
       jsr     _LVOSPMul(a6)
       move.l   d0,d6
       move.l   d5,d0              ;   curb2 = curb*curb
       move.l   d5,d1
       jsr     _LVOSPMul(a6)
       move.l   d0,d7
       move.l   d6,d1              ;   if (cura2+curb2 > 4.0) goto out:
       jsr     _LVOSPAdd(a6)
       move.l   #$80000043,d1
       jsr     _LVOSPCmp(a6)
       bgt      out
       add.l    #1,l(a5)
       move.l   l(a5),d0
       cmp.l    TraceSize(a5),d0
       blt      lloop
;
       lea      olda(a5),a0        ;   RTrace = olda
       lea      oldb(a5),a1        ;   ITrace = oldb
       clr.l    l(a5)              ;   for (l = TraceSize; l--; )
lloop1
       cmp.l    (a0)+,d4
       bne      skipit
       cmp.l    (a1)+,d5
       bne      nextl
       move.w  _MaxCount,d0
       ext.l    d0
       move.l   d0,k(a5)
       move.l   #0,l(a5)
       bra      out
skipit
       add.l    #4,a1
nextl
       add.l    #1,l(a5)
       move.l   l(a5),d0
       cmp.l    TraceSize(a5),d0
       blt      lloop1
#endasm
#endif
      }
      k = 0;
      l = MaxCount;
out:
#asm
out
#endasm
      SetAPen(rp, ColorXlate[ k + l ]);

      WritePixel(rp, j + LEFTMARG,i + TOPMARG);

      if (CountPtr)
        *(CountPtr++) = k + l;

      curx += GapX;
      if ( CheckForStop() ) {

        DisplayBeep(screen);
        return(0);
      }
    }
    cury += GapY;
  }

  DisplayBeep(screen);
} /* Mandelbrot */

/*
 * 32 bit fixed point generator
 */
IntMandelbrot()
{
  LONG i, j, k;

  LONG curx, cury, gapx, gapy;
  register LONG cura, curb, cura2, curb2;

  float gap;

  SHORT *CountPtr;
  LONG  OldA[32],OldB[32];

  UBYTE MandFlag;

  UBYTE  ColorXlate[1030];

  UBYTE OldPen, NewPen;

  LONG xl,yl;

  OldPen = 0xff;

#define BITS2SHIFT 27

  /* Map contours into color translate table */
  for (i = 0,j = 1029; i < NUMCONTS; i++)
    for (; j >= ContourBase[i] && j; )
      ColorXlate[j--] = ColorBase[i];

  while (j >= 0) ColorXlate[j--] = 0;

  /* free up old counts memory, get new picture size, get new counts memory
   */

  GetCountsMemory();

  /* clear the picture area */

  SetAPen(MandWind->RPort, 0);

  RectFill(MandWind->RPort, LEFTMARG, TOPMARG,
                            MandWind->Width - 12,  MandWind->Height - 2);
  CountPtr = CountBase;

  /* calculate new picture's coordinates from zoom box */

  ZoomIn();

  /* figure out horizontal and verticle distances between points in plane.
   * convert them to fixed point format                                    */

  gapy = (int) (GapY*((float)(1<<BITS2SHIFT)));
  gapx = (int) (GapX*((float)(1<<BITS2SHIFT)));

  /*
   * for each point in the image, calculate Mandelbrot
   */
  cury = (int)(StartY*((float)(1<<BITS2SHIFT)));

  xl = LEFTMARG + CountX;
  yl = TOPMARG + CountY;

  for (i = TOPMARG; i < yl; i++) {
    curx = (int)(StartX*((float)(1<<BITS2SHIFT)));
    MandFlag = 0;
    for (j = LEFTMARG; j < xl; j++) {
      /*
       * if the last pixel was mandelbrot, then use trace table
       */
      if (MandFlag) {
#asm
Bits2Shift equ 5
;
;  d1 - a2
;  d2 - b2
;  d4 - a
;  d5 - b
;  d6 - BITS2SHIFT
;  d7 - k
;
;  a0 - OldA
;  a1 - OldB
;
;  cura = curb = curc = curd = 0;
OldA equ -292
OldB equ -164
Trace equ 15
   moveq    #0,d1
   moveq    #0,d2
   moveq    #0,d4
   moveq    #0,d5
   move.w   d5,k(a5)
   move.l   #Bits2Shift,d6
AddrLoop
   move.w   #Trace,d7
   lea      OldA(a5),a0
;  lea      OldB(a5),a1
KLoop
   move.l   d0,(a0)+   ; save todays version of Magnitude
;  move.l   d5,(a1)+   ; save todays version of B
;
;  cura = cura2 - curb2 + curx;
   exg      d1,d4      ; exchange cura and cura2
   sub.l    d2,d4      ; subtract curb
   add.l   -16(a5),d4  ; add curx
;
;  curb = cura * curb >> 12;
   move.l   d1,d2      ; get copy of op1 sign bit
   bpl      pos1       ; get absolute value of op1
   neg.l    d1
pos1
   eor.l    d5,d2      ; calculate result sign
   tst.l    d5         ; get absolute value of op2
   bpl      pos2
   neg.l    d5
pos2
   move.l   d1,d0      ; get a copy of op1
   swap     d0         ; get high half of op1
   move.w   d0,d2      ; save a copy of high half
   mulu     d5,d0      ; multiply op2 low by op1 high
   clr.w    d0         ;  clear least significant part
   swap     d0         ;  put it in it's place
   swap     d5         ; get high half of op2
   mulu     d5,d1      ; multiply op2 high with op1 low
   clr.w    d1         ;  clear least significant part
   swap     d1         ;  put it in its place
   mulu     d2,d5      ; multiply op2 high by op1 high
   add.l    d0,d5      ; add partial results
   add.l    d1,d5      ; add partial results
   tst.l    d2         ; is the result negative?
   bpl      pos3
   neg.l    d5         ; yes, better negate it.
pos3
   asl.l    d6,d5      ; now, rescale it.
;
;  curb += curb + cury;
   add.l    d5,d5      ; double it and add cury
   add.l   -20(a5),d5
;
;  cura2 = cura * cura;
   move.l   d4,d0      ; get absolute value of a in d0
   bpl      posa
   neg.l    d0
posa
   move.l   d0,d1      ; copy absolute value into d1
   swap     d1         ; get high part in d1
   mulu     d1,d0      ; multiply high and low destroying low
   clr.w    d0         ; clear the least significant part
   swap     d0         ; put most sig. part in low half
   mulu     d1,d1      ; multiply high and high destroing high
   add.l    d0,d1      ; add in lower half twice
   add.l    d0,d1
   asl.l    d6,d1      ; get radix point back in correct place
   bvs      bailout
;
;  curb2 = curb * curb;
   move.l   d5,d0      ; get absolute value of a in d0
   bpl      posb
   neg.l    d0
posb
   move.l   d0,d2      ; copy absolute value into d2
   swap     d2         ; get high part in d2
   mulu     d2,d0      ; multiply high and low destroying low
   clr.w    d0         ; clear the least significant part
   swap     d0         ; put most sig. part in low half
   mulu     d2,d2      ; multiply high and high destroing high
   add.l    d0,d2      ; add in lower half twice
   add.l    d0,d2
   asl.l    d6,d2      ; get radix point back in correct place
   bvs      bailout
;
   move.l   d1,d0      ; if (cura2 + curb2 >= 4) goto bailout;
   add.l    d2,d0
   bvs      bailout
   cmp.l    #536870912,d0
   bge      bailout
   dbra     d7,KLoop   ; keep going
;
   move.w   #Trace,d7
   lea      OldA(a5),a0
;  lea      OldB(a5),a1
SLoop
   cmp.l    (a0)+,d4   ; check A
;  bne      NotIt
;  cmp.l    (a1),d5    ; check B
   beq      GotIt
NotIt
   add      #2,a1
   dbra     d7,SLoop   ; check next one
   add.w    #Trace,k(a5)  ; drop the iteration count
   cmp.w    #1023-Trace,k(a5)
   blt      AddrLoop
;
GotIt
   move.w   #1023,d0
   bra      Adjusted
bailout
   move.b   #0,-293(a5) ; clear MandFlag here
   move.w   #Trace,d0
   sub.w    d7,d0
   add.w    k(a5),d0
Adjusted
   ext.l    d0
   move.l   d0,-12(a5)
#endasm
   ;} else {
   /*  This code does mandelbrot without any trace lookup.
    *  It is the fastest generator in the house.
    */
#asm
;
;  d1 - a2
;  d2 - b2
;  d4 - a
;  d5 - b
;  d6 - BITS2SHIFT
;  d7 - k
;
;  cura = curb = curc = curd = 0;
   moveq    #0,d1
   moveq    #0,d2
   moveq    #0,d4
   moveq    #0,d5
   move.l   #Bits2Shift,d6
   move.w   #1023,d7
FKLoop
;
;  cura = cura2 - curb2 + curx;
   exg      d1,d4      ; exchange cura and cura2
   sub.l    d2,d4      ; subtract curb
   add.l   -16(a5),d4  ; add curx
;
;  curb = cura * curb >> 12;
   move.l   d1,d2      ; get copy of op1 sign bit
   bpl      Fpos1       ; get absolute value of op1
   neg.l    d1
Fpos1
   eor.l    d5,d2      ; calculate result sign
   tst.l    d5         ; get absolute value of op2
   bpl      Fpos2
   neg.l    d5
Fpos2
   move.l   d1,d0      ; get a copy of op1
   swap     d0         ; get high half of op1
   move.w   d0,d2      ; save a copy of high half
   mulu     d5,d0      ; multiply op2 low by op1 high
   clr.w    d0         ;  clear least significant part
   swap     d0         ;  put it in it's place
   swap     d5         ; get high half of op2
   mulu     d5,d1      ; multiply op2 high with op1 low
   clr.w    d1         ;  clear least significant part
   swap     d1         ;  put it in its place
   mulu     d2,d5      ; multiply op2 high by op1 high
   add.l    d0,d5      ; add partial results
   add.l    d1,d5      ; add partial results
   tst.l    d2         ; is the result negative?
   bpl      Fpos3
   neg.l    d5         ; yes, better negate it.
Fpos3
   asl.l    d6,d5      ; now, rescale it.
;
;  curb += curb + cury;
   add.l    d5,d5      ; double it and add cury
   add.l   -20(a5),d5
;
;  cura2 = cura * cura;
   move.l   d4,d0      ; get absolute value of a in d0
   bpl      Fposa
   neg.l    d0
Fposa
   move.l   d0,d1      ; copy absolute value into d1
   swap     d1         ; get high part in d1
   mulu     d1,d0      ; multiply high and low destroying low
   clr.w    d0         ; clear the least significant part
   swap     d0         ; put most sig. part in low half
   mulu     d1,d1      ; multiply high and high destroing high
   add.l    d0,d1      ; add in lower half twice
   add.l    d0,d1
   asl.l    d6,d1      ; get radix point back in correct place
   bvs      Fbailout
;
;  curb2 = curb * curb;
   move.l   d5,d0      ; get absolute value of a in d0
   bpl      Fposb
   neg.l    d0
Fposb
   move.l   d0,d2      ; copy absolute value into d2
   swap     d2         ; get high part in d2
   mulu     d2,d0      ; multiply high and low destroying low
   clr.w    d0         ; clear the least significant part
   swap     d0         ; put most sig. part in low half
   mulu     d2,d2      ; multiply high and high destroing high
   add.l    d0,d2      ; add in lower half twice
   add.l    d0,d2
   asl.l    d6,d2      ; get radix point back in correct place
   bvs      Fbailout
;
   move.l   d1,d0      ; if (cura2 + curb2 >= 4) goto bailout;
   add.l    d2,d0
   bvs      Fbailout
   cmp.l    #536870912,d0
   bge      Fbailout
   dbra     d7,FKLoop
   move.b   #1,-293(a5) ; set MandFlag here
Fbailout
   move.w   #1023,d0
   sub.w    d7,d0
   move.w   d0,d7
   ext.l    d7
   move.l   d7,-12(a5)
#endasm
      }
      NewPen = ColorXlate[k];


      if (NewPen != OldPen) {
        SetAPen(rp,NewPen);
        OldPen = NewPen;
      }

      if (NewPen)
        WritePixel(rp, j, i);

      if (CountPtr)
        *(CountPtr++) = k;

      curx += gapx;
      if ( CheckForStop() ) {
        /* Clean up here */
        DisplayBeep(screen);
        return(0);
      }
    }
    cury += gapy;
  }
  DisplayBeep(screen);
} /* Mandelbrot */

/*
 * Free up old memory and get memory for new picture
 */
GetCountsMemory()
{
  /* free up old pictures iteration count pile */

  if (CountBase) {
    FreeMem(CountBase,CountX*CountY*sizeof(SHORT));
    CountBase = (SHORT *) NULL;
  }

  /* figure out new picture size */

  CountX = MandWind->Width-(LEFTMARG+RIGHTMARG);
  CountY = MandWind->Height-(TOPMARG+BOTMARG);

  /* Allocate memory for new picture */

  CountBase = (SHORT *) AllocMem(CountX*CountY*sizeof(SHORT),MEMF_CLEAR);
  if (CountBase == (SHORT *) NULL) {
    DispErrMsg("Can't save counts. Out of RAM!!",0);
    return(1);
  }
  return(0);
}

/*
 * ZoomIn
 */
ZoomIn()
{
  if (Zoom) {
    EndY   = StartY + GapY * (float)(NavBot-TOPMARG);
    EndX   = StartX + GapX * (float)(NavRight-LEFTMARG);
    StartY = StartY + GapY * (float)(NavTop-TOPMARG);
    StartX = StartX + GapX * (float)(NavLeft-LEFTMARG);

    Zoom = 0;
  }

  CalculateGaps();
} /* ZoomIn */

/*
 * Calculate Gaps
 */
CalculateGaps()
{
  GapY = (EndY-StartY)/(float)CountY;

  if (screen->ViewPort.Modes & HIRES)
    if (screen->ViewPort.Modes & INTERLACE)
      GapX = GapY*0.88;
    else
      GapX = GapY*0.44;
  else
    if (screen->ViewPort.Modes & INTERLACE)
      GapX = GapY*1.76;
    else
      GapX = GapY*0.88;
}

/*
 * Check For Stop
 */
CheckForStop()
{
  struct IntuiMessage *message;
  struct Gadget *gadget;
  ULONG  class;
  USHORT code;

  message = (struct IntuiMessage *) GetMsg(MandWind->UserPort);

  if (message) {
    class  = message->Class;
    code   = message->Code;
    ReplyMsg(message);

    if (class == MENUPICK && code != MENUNULL) {
      ClearMenuStrip(MandWind);
      return(1);
    }
  }
  return(0);
} /* Check for stop */

/*
 * Open the Mandelbrot window
 */
OpenMandWind()
{
  extern struct Window *OpenMyWind();

  if (MandWind == (struct Window *) NULL) {
    MandWind = OpenMyWind(&NewMand, screen, NULL, 109, 78, 320, 200);
    SetMenuStrip(MandWind, &Menu);
    ForceNormPointer();
  }
} /* OpenMandWind */

/*
 * Close the Mandelbrot Window
 */
CloseMandWind()
{
  if (MandWind != (struct Window *) NULL) {
    CloseMyWind(MandWind, NewMand.FirstGadget);
    MandWind = (struct Window *) NULL;
  }
} /* CloseMandWind */
//E*O*F mand.c//

echo x - mand.h
cat > "mand.h" << '//E*O*F mand.h//'

#include <exec/types.h>
#include <exec/memory.h>
#include <graphics/display.h>
#include <graphics/gfxbase.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <stdio.h>

/**********************************/

/* Types */
#define PALTYPE  1
#define CONTYPE  2
#define NAVTYPE  3
#define ORBTYPE  4

#define WINDTYPEBITS 11
#define TYPEBITS  6

#define WINDMASK 0xffff
#define TYPEMASK 0xf
#define NUMMASK 0x3f

/* PALETTE GADGET TYPES */
#define PALPENS  0
#define PALPOTS  1
#define PALCNTLS 2

/* Palette Control Gadgets */
#define PALPEN   (PALTYPE << WINDTYPEBITS | PALPENS  << TYPEBITS)
#define PALPOT   (PALTYPE << WINDTYPEBITS | PALPOTS  << TYPEBITS)
#define PALCNTL  (PALTYPE << WINDTYPEBITS | PALCNTLS << TYPEBITS)
#define PALCOPY  (PALCNTL | 0)
#define PALRANGE (PALCNTL | 1)
#define PALEXCG  (PALCNTL | 2)

/* CONTOUR DEFINES */
#define CONTSELS  0
#define CONTUPS   1
#define CONTDOWNS 2
#define CONTPOTS  3
#define CONTCNTLS 4

#define CONTSEL  (CONTYPE << WINDTYPEBITS | CONTSELS  << TYPEBITS)
#define CONTUP   (CONTYPE << WINDTYPEBITS | CONTUPS   << TYPEBITS)
#define CONTDOWN (CONTYPE << WINDTYPEBITS | CONTDOWNS << TYPEBITS)
#define CONTPOT  (CONTYPE << WINDTYPEBITS | CONTPOTS  << TYPEBITS)
#define CONTCNTL (CONTYPE << WINDTYPEBITS | CONTCNTLS << TYPEBITS)
#define CONTRECOL (CONTCNTL | 0)
#define CONTSMTH  (CONTCNTL | 1)
#define CONTCEIL  (CONTCNTL | 2)

#define NUMCONTS   32

#define TOPMARG   11
#define BOTMARG   11
#define LEFTMARG  4
#define RIGHTMARG 15

/**********************************/

/*-------------------*/
/* Misc. definitions */
#define VERSION 100

/* Menu: Project, Item: Save's SubItems */
#define SAVEMAND     0
#define SAVEILBM     1

/* Menu Project's, Items */
#define LOADITEM     0
#define SAVEITEM     1
#define GENERATEITEM 2
#define USEITEM      3
#define QUITITEM     4

/* Menu: Edit, Item: ZoomIn's, SubItems */
#define ZOOMINON  0
#define ZOOMINOFF 1

/* Menu: Edit, Item: ViewMode's, SubItems */
#define HIRESSUB 0
#define INTERLACESUB 1
#define HALFBRITESUB 2

/* Menu: Edit, Item: Depth's, SubItems */
#define BITPLANE1SUB  0
#define BITPLANES2SUB 1
#define BITPLANES3SUB 2
#define BITPLANES4SUB 3
#define BITPLANES5SUB 4
#define BITPLANES6SUB 5

/* Menu Edit's, Items */
#define ZOOMITEM      0
#define COLORITEM     1
#define CONTOURITEM   2
#define GENERATORITEM 3
#define COUNTITEM     4
#define VIEWMODEITEM  5
#define DEPTHITEM     6

/* Menu Entries */
#define PROJECTMENU 0
#define EDITMENU    1
#define PRESETMENU  2

#define TOGGLED11 0x0200

/************************************/
/*                                  */
/*  CmdMode possibilities           */
/*                                  */
/*                                  */
/************************************/

#define SMOOTH 1
#define IMPLIEDSET 2

#define COPY   11
#define RANGE  12
#define EXCG   13

#define STARTBOX   20
#define STRETCHBOX 21
#define COLORSLIDE 22
#define ZOOMDRAG   23
#define ZOOMSIZE   24

//E*O*F mand.h//

echo x - menu.c
cat > "menu.c" << '//E*O*F menu.c//'
/***************************************************************************
 *
 *                 MandelVroom Menu Manipulation routines
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/

#include "mand.h"

extern struct Menu Menu, GenMenu;

extern struct NewScreen NewScreen;
extern struct Screen *screen;
extern struct Window *MandWind, *PalWind, *ContWind;
extern struct NewWindow *NewMand;

extern SHORT MaxCount, Zoom;
extern UBYTE MandType, QuitScreen;
extern USHORT CmdMode;

/*
 * Decide what to do for Project menu's Items
 */
ScreenProject(code)
  USHORT code;
{
  static char File[80] = "", Path[80] = "df1:";
  char Name[160];
  char *p;

  switch (ITEMNUM(code))
    {
    case LOADITEM:

         SetSystemColors(1);

         if (get_fname(MandWind,screen,"Load Pics",File,Path)) {

           SetSystemColors(0);

           strcpy(Name,Path);
           if (Name[strlen(Name)-1] != ':') {
             strcat(Name,"/");
           }
           strcat(Name,File);

           if (PalWind) {
             ClosePalWind();
           }
           if (ContWind) {
             CloseContWind();
           }
           ClearMenuStrip(MandWind);

           LoadCounts(Name);

           SetNormPointer();
           SetMenuStrip(MandWind, &Menu);
         } else {
           SetSystemColors(0);
         }

         break;

    case SAVEITEM:
         switch (SUBNUM(code)) {
           case 0:
                p = "Save Pics";
                break;
           case 1:
                p = "Save ILBM";
                break;
         }
         SetSystemColors(1);

         if (get_fname(MandWind, screen, p, File, Path )) {

           SetSystemColors(0);

           strcpy(Name, Path);
           if (Name[strlen(Name)-1] != ':') {
             strcat(Name,"/");
           }
           strcat(Name,File);

           ClearMenuStrip(MandWind);

           switch (SUBNUM(code)) {
             case 0:
                  SaveCounts(Name);
                  break;
             case 1:
                  SaveILBM(Name);
                  break;
           }
           DisplayBeep(screen);

           SetNormPointer();

           SetMenuStrip(MandWind, &Menu);
         } else {
           SetSystemColors(0);
         }
         break;

    case GENERATEITEM:

         GenerateIt();

         break;

    case USEITEM:
         CloseDisp();
         OpenDisp();
         break;

    case QUITITEM:
         QuitScreen = TRUE;
    }
} /* DoProjectScreen */

/*
 * Decide what to do for Edit menu's Items
 */
EditScreen(code)
  USHORT code;
{
  float gapy,gapx;
  extern LONG NavLeft,NavTop,NavBot,NavRight;

  switch (ITEMNUM(code))
    {
    case COLORITEM:
         OpenPalWind();
         break;

    case DEPTHITEM:
         NewScreen.Depth = SUBNUM(code) + 1;
         if (NewScreen.ViewModes & HIRES)
           if (NewScreen.Depth > 4) {
             NewScreen.Depth = 4;
             InitDepthSubs();
           }
         break;

    case CONTOURITEM:
         OpenContWind();
         break;

    case VIEWMODEITEM:
         EditScreenViewModes(code);
         break;

    case GENERATORITEM:   /* generator type */
         MandType = SUBNUM(code);
         break;

    case ZOOMITEM:
         switch (SUBNUM(code)) {
           case ZOOMINON:
             if (Zoom == 0) {
               CmdMode = STARTBOX;
               SetToPointer();
             }
             break;
           case ZOOMINOFF:
             if (Zoom == 1) {
               DrawExtras(NavLeft, NavTop, NavRight, NavBot );
               DrawBox(NavLeft, NavTop, NavRight, NavBot );
               Zoom = 0;
             }
         }
         break;

    case COUNTITEM:
         switch (SUBNUM(code)) {
           case 0:
             MaxCount = 32;
             break;
           case 1:
             MaxCount = 64;
             break;
           case 2:
             MaxCount = 128;
             break;
           case 3:
             MaxCount = 256;
             break;
           case 4:
             MaxCount = 512;
             break;
           case 5:
             MaxCount = 1023;
             break;
         }
    }
} /* EditScreen */

/*
 * Modify the NewScreens ViewModes to match the menu
 */
EditScreenViewModes(code)
  USHORT code;
{
  switch (SUBNUM(code))
    {
    case HIRESSUB:
         if (NewScreen.ViewModes & HIRES) {
            NewScreen.Width = 320;
            NewScreen.ViewModes &= ~HIRES;
         } else {
            NewScreen.Width = 640;
            NewScreen.ViewModes |= HIRES;
            NewScreen.ViewModes &= ~EXTRA_HALFBRITE;
            if (NewScreen.Depth > 4)
              NewScreen.Depth = 4;
         }
         break;

    case INTERLACESUB:
         if (NewScreen.ViewModes & INTERLACE) {
            NewScreen.ViewModes &= ~INTERLACE;
            NewScreen.Height = 200;
         } else {
            NewScreen.ViewModes |= INTERLACE;
            NewScreen.Height = 400;
         }
         break;

    case HALFBRITESUB:
         if (NewScreen.ViewModes & EXTRA_HALFBRITE) {
            NewScreen.ViewModes &= ~EXTRA_HALFBRITE;
            NewScreen.Depth = 5;
         } else {
            NewScreen.ViewModes |= EXTRA_HALFBRITE;
            NewScreen.ViewModes &= ~HIRES;
            NewScreen.Depth = 6;
         }
         break;
    }

  InitViewModesSubs();
  InitDepthSubs();
} /* EditScreenViewMode */

/*
 * Set up Menu's check marks to reflect viewmodes.
 */
InitViewModesSubs()
{
  SHORT i;
  extern struct MenuItem ViewModeSubs[];

  for (i = HIRESSUB; i <= HALFBRITESUB; i++) {
    ViewModeSubs[i].Flags &= ~CHECKED;
    switch (i) {
      case HIRESSUB:
           if (NewScreen.ViewModes & HIRES)
             ViewModeSubs[i].Flags |= CHECKED;
           break;
      case INTERLACESUB:
           if (NewScreen.ViewModes & INTERLACE)
             ViewModeSubs[i].Flags |= CHECKED;
           break;
      case HALFBRITESUB:
           if (NewScreen.ViewModes & EXTRA_HALFBRITE)
             ViewModeSubs[i].Flags |= CHECKED;
           break;
      }
  }
} /* InitViewModesSubs */

/*
 * Set up Menu's check marks to reflect Depth.
 */
InitDepthSubs()
{
  SHORT i;
  extern struct MenuItem DepthSubs[];

  for (i = 0; i <= 6; i++) {
    DepthSubs[i].Flags &= ~CHECKED;
  }
  DepthSubs[NewScreen.Depth-1].Flags |= CHECKED;

} /* InitScreenViewMode */

/*
 * Set up Menu's check marks to reflect Generator Type
 */
InitGenSubs()
{
  SHORT i;
  extern struct MenuItem GenerateSubs[];
  extern UBYTE MandType;

  for (i = 0; i <= 1; i++) {
    GenerateSubs[i].Flags &= ~CHECKED;
  }
  GenerateSubs[MandType].Flags |= CHECKED;

} /* InitGenSubs */

/*
 * Set up Menu's check marks to reflect Iteration count
 */
InitMaxISubs()
{
  SHORT i;
  extern struct MenuItem CountSubs[];
  extern SHORT MaxCount;

  for (i = 0; i <= 1; i++) {
    CountSubs[i].Flags &= ~CHECKED;
  }

  if (MaxCount <= 32)
    CountSubs[0].Flags |= CHECKED;
  else
  if (MaxCount <= 64)
    CountSubs[1].Flags |= CHECKED;
  else
  if (MaxCount <= 128)
    CountSubs[2].Flags |= CHECKED;
  else
  if (MaxCount <= 256)
    CountSubs[3].Flags |= CHECKED;
  else
  if (MaxCount <= 512)
    CountSubs[4].Flags |= CHECKED;
  else
  if (MaxCount <= 1024)
    CountSubs[5].Flags |= CHECKED;

} /* InitGenSubs */
//E*O*F menu.c//

echo x - menu1.c
cat > "menu1.c" << '//E*O*F menu1.c//'
/****************************************************************************
 *
 *             MandelVroom Pre-initialized Menu structures
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/
#include "mand.h"

struct IntuiText SaveSubsIntui[] =
  {
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "MAND",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "ILBM",
    NULL
    }
  };
struct MenuItem SaveSubs[] =
  {
    {
    (struct MenuItem *) &SaveSubs[1],
    24,
    14,
    40,
    12,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    NULL,
    (APTR) &SaveSubsIntui[0],
    NULL,
    '\0',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) NULL,
    24,
    26,
    40,
    12,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    NULL,
    (APTR) &SaveSubsIntui[1],
    NULL,
    '\0',
    NULL,
    NULL
    }
  };
struct IntuiText ProjectItemsIntui[] =
  {
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Load",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Save",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Generate",
    NULL
    },
    {
    0,
    1,
    0,
    2,
    2,
    NULL,
    (UBYTE *) "NewScreen",
    NULL
    },
    {
    0,
    1,
    0,
    2,
    2,
    NULL,
    (UBYTE *) "Quit",
    NULL
    }
  };
struct MenuItem ProjectItems[] =
  {
    {
    (struct MenuItem *) &ProjectItems[1],
    0,
    0,
    106,
    14,
    CHECKED|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ProjectItemsIntui[0],
    NULL,
    'l',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ProjectItems[2],
    0,
    14,
    106,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ProjectItemsIntui[1],
    NULL,
    '\0',
    (struct MenuItem *) &SaveSubs[0],
    NULL
    },
    {
    (struct MenuItem *) &ProjectItems[3],
    0,
    28,
    106,
    14,
    ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ProjectItemsIntui[2],
    NULL,
    'g',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ProjectItems[4],
    0,
    42,
    106,
    14,
    ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ProjectItemsIntui[3],
    NULL,
    'n',
    NULL,
    NULL
    },
    {
    NULL,
    0,
    56,
    106,
    14,
    ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ProjectItemsIntui[4],
    NULL,
    'q',
    NULL,
    NULL
    }
  };
struct IntuiText ZoomInSubsIntui[] =
  {
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Open",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Close",
    NULL
    }
  };
struct MenuItem ZoomInSubs[] =
  {
    {
    (struct MenuItem *) &ZoomInSubs[1],
    24,
    14,
    48,
    12,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ZoomInSubsIntui[0],
    NULL,
    '\0',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) NULL,
    24,
    26,
    48,
    12,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ZoomInSubsIntui[1],
    NULL,
    '\0',
    NULL,
    NULL
    }
  };
struct IntuiText GenerateSubsIntui[] =
  {
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "Integer",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "FFP",
    NULL
    }
  };
struct MenuItem GenerateSubs[] =
  {
    {
    (struct MenuItem *) &GenerateSubs[1],
    24,
    14,
    100,
    12,
    CHECKIT|CHECKED|COMMSEQ|ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0x0003-0x0001,
    (APTR) &GenerateSubsIntui[0],
    NULL,
    'i',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) NULL,
    24,
    26,
    100,
    12,
    CHECKIT|COMMSEQ|ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0x0003-0x0002,
    (APTR) &GenerateSubsIntui[1],
    NULL,
    'f',
    NULL,
    NULL
    }
  };
struct IntuiText ViewModeSubsIntui[] =
  {
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "HIRES",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "INTERLACE",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "HALFBRITE",
    NULL
    }
  };
struct MenuItem ViewModeSubs[] =
  {
    {
    (struct MenuItem *) &ViewModeSubs[1],
    24,
    14,
    88,
    12,
    CHECKIT|ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ViewModeSubsIntui[0],
    NULL,
    '\0x1a',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ViewModeSubs[2],
    24,
    26,
    88,
    12,
    CHECKIT|ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ViewModeSubsIntui[1],
    NULL,
    '\0x1a',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) NULL,
    24,
    38,
    88,
    12,
    CHECKIT|ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ViewModeSubsIntui[2],
    NULL,
    '\0x1a',
    NULL,
    NULL
    }
  };
struct IntuiText DepthSubsIntui[] =
  {
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "1-BitPlane",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "2-BitPlanes",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "3-BitPlanes",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "4-BitPlanes",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "5-BitPlanes",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "6-BitPlanes",
    NULL
    }
  };
struct MenuItem DepthSubs[] =
  {
    {
    (struct MenuItem *) &DepthSubs[1],
    24,
    14,
    136,
    12,
    CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0x003F-0x0001,
    (APTR) &DepthSubsIntui[0],
    NULL,
    '1',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &DepthSubs[2],
    24,
    26,
    136,
    12,
    CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0x003F-0x0002,
    (APTR) &DepthSubsIntui[1],
    NULL,
    '2',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &DepthSubs[3],
    24,
    38,
    136,
    12,
    CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0x003F-0x0004,
    (APTR) &DepthSubsIntui[2],
    NULL,
    '3',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &DepthSubs[4],
    24,
    50,
    136,
    12,
    CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0x003F-0x0008,
    (APTR) &DepthSubsIntui[3],
    NULL,
    '4',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &DepthSubs[5],
    24,
    62,
    136,
    12,
    CHECKIT|CHECKED|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0x003F-0x0010,
    (APTR) &DepthSubsIntui[4],
    NULL,
    '5',
    NULL,
    NULL
    },
    {
    NULL,
    24,
    74,
    136,
    12,
    CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0x003F-0x0020,
    (APTR) &DepthSubsIntui[5],
    NULL,
    '6',
    NULL,
    NULL
    }
  };
struct IntuiText CountSubsIntui[] =
  {
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "32",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "64",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "128",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "256",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "512",
    NULL
    },
    {
    0,
    1,
    0,
    16,
    2,
    NULL,
    (UBYTE *) "1023",
    NULL
    }
  };
struct MenuItem CountSubs[] =
  {
    {
    (struct MenuItem *) &CountSubs[1],
    24,
    14,
    48,
    12,
    CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX,
    0x003F-0x0001,
    (APTR) &CountSubsIntui[0],
    NULL,
    '1',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &CountSubs[2],
    24,
    26,
    48,
    12,
    CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX,
    0x003F-0x0002,
    (APTR) &CountSubsIntui[1],
    NULL,
    '2',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &CountSubs[3],
    24,
    38,
    48,
    12,
    CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX,
    0x003F-0x0004,
    (APTR) &CountSubsIntui[2],
    NULL,
    '3',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &CountSubs[4],
    24,
    50,
    48,
    12,
    CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX,
    0x003F-0x0008,
    (APTR) &CountSubsIntui[3],
    NULL,
    '4',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &CountSubs[5],
    24,
    62,
    48,
    12,
    CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX,
    0x003F-0x0010,
    (APTR) &CountSubsIntui[4],
    NULL,
    '5',
    NULL,
    NULL
    },
    {
    NULL,
    24,
    74,
    48,
    12,
    CHECKIT | CHECKED | ITEMTEXT | ITEMENABLED | HIGHBOX,
    0x003F-0x0020,
    (APTR) &CountSubsIntui[5],
    NULL,
    '6',
    NULL,
    NULL
    }
  };
struct IntuiText EditItemsIntui[] =
  {
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Zoom",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Colors",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Contours",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Generator",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Max Iteration",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "ViewMode",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Depth",
    NULL
    },
  };

struct MenuItem EditItems[] =
  {
    {  /* Zoom */
    (struct MenuItem *) &EditItems[1],
    0,
    0,
    104,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &EditItemsIntui[0],
    NULL,
    0,
    (struct MenuItem *) &ZoomInSubs,
    NULL
    },
    {  /* Colors */
    (struct MenuItem *) &EditItems[2],
    0,
    14,
    104,
    14,
    CHECKED|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &EditItemsIntui[1],
    NULL,
    'c',
    NULL,
    NULL
    },
    {  /* Contours */
    (struct MenuItem *) &EditItems[3],
    0,
    28,
    104,
    14,
    ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &EditItemsIntui[2],
    NULL,
    'k',
    NULL,
    NULL
    },
    {  /* Generator */
    (struct MenuItem *) &EditItems[4],
    0,
    42,
    104,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &EditItemsIntui[3],
    NULL,
    '\0',
    (struct MenuItem *) &GenerateSubs,
    NULL
    },
    { /* MaxI */
    (struct MenuItem *) &EditItems[5],
    0,
    56,
    104,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &EditItemsIntui[4],
    NULL,
    '\0x0',
    (struct MenuItem *) &CountSubs,
    NULL
    },
    {  /* ViewModes */
    (struct MenuItem *) &EditItems[6],
    0,
    70,
    104,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &EditItemsIntui[5],
    NULL,
    '\0x0',
    (struct MenuItem *) &ViewModeSubs,
    NULL
    },
    { /* Depth */
    NULL,
    0,
    84,
    104,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &EditItemsIntui[6],
    NULL,
    '\0x0',
    (struct MenuItem *) &DepthSubs,
    NULL
    },
  };

struct IntuiText ToolItemsIntui[] =
  {
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Big Brot",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Hey Baby",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Dragon Family",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Spine",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Vertibrae",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Beauty",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Sea Horse",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Horse Chain",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Chain Link",
    NULL
    },
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Pretty Baby",
    NULL
    },
  };
struct MenuItem ToolItems[] =
  {
    {
    (struct MenuItem *) &ToolItems[1],
    0,
    0,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[0],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ToolItems[2],
    0,
    14,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[1],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ToolItems[3],
    0,
    28,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[2],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ToolItems[4],
    0,
    42,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[3],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ToolItems[5],
    0,
    56,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[4],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ToolItems[6],
    0,
    70,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[5],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ToolItems[7],
    0,
    84,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[6],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ToolItems[8],
    0,
    98,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[7],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) &ToolItems[9],
    0,
    112,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[8],
    NULL,
    'p',
    NULL,
    NULL
    },
    {
    (struct MenuItem *) NULL,
    0,
    126,
    130,
    14,
    ITEMTEXT|ITEMENABLED|HIGHBOX|0,
    0,
    (APTR) &ToolItemsIntui[9],
    NULL,
    'p',
    NULL,
    NULL
    },
  };

struct Menu Menu[] =
  {
    {
    (struct Menu *) &Menu[1],
    4,
    0,
    56,
    8,
    1,
    (BYTE *) "Project",
    (struct MenuItem *) &ProjectItems,
    },
    {
    (struct Menu *) &Menu[2],
    68,
    0,
    32,
    8,
    1,
    (BYTE *) "Edit",
    (struct MenuItem *) &EditItems,
    },
    {
    NULL,
    108,
    0,
    64,
    8,
    1,
    (BYTE *) "Presets",
    (struct MenuItem *) &ToolItems,
    }
  };
struct IntuiText GenProjIntui[] =
  {
    {
    0,
    1,
    0,
    4,
    2,
    NULL,
    (UBYTE *) "Stop",
    NULL
    }
  };
struct MenuItem GenProjItems[] =
  {
    {
    (struct MenuItem *) NULL,
    0,
    0,
    60,
    12,
    ITEMTEXT | COMMSEQ | ITEMENABLED | HIGHBOX,
    0,
    (APTR) &GenProjIntui[0],
    NULL,
    's',
    NULL,
    NULL
    }
  };

struct Menu GenMenu[] =
  {
    {
    (struct Menu *) NULL,
    4,
    0,
    56,
    8,
    1,
    (BYTE *) "Project",
    (struct MenuItem *) &GenProjItems,
    },
  };
//E*O*F menu1.c//

echo x - nav.c
cat > "nav.c" << '//E*O*F nav.c//'
/***************************************************************************
 *
 *                   MandelVroom Navigation Control
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/

#include "mand.h"

extern struct RastPort *rp;

extern USHORT CmdMode;

LONG NavTop, NavBot, NavLeft, NavRight;

extern SHORT XScale, YScale;

SHORT BoxSizeX = 3, BoxSizeY = 3, DragSize = 3;

DrawBox( Left, Top, Right, Bottom)
  SHORT Top, Left, Bottom, Right;
{
  SetDrMd(rp, COMPLEMENT);
  /*
   * Draw the new box
   */
  Move(rp, Left,  Top   );
  Draw(rp, Right, Top   );
  Draw(rp, Right, Bottom);
  Draw(rp, Left,  Bottom);
  Draw(rp, Left,  Top+1 );

  SetDrMd(rp, JAM1);
} /* DrawBox */

DrawExtras( Left, Top, Right, Bottom)
  SHORT Top, Left, Bottom, Right;
{
  SetDrMd(rp, COMPLEMENT);
  /*
   * Draw Resize gadget
   */
  Move(rp, Right - 1,                    Bottom - (BoxSizeY << YScale));
  Draw(rp, Right - (BoxSizeX << XScale), Bottom - (BoxSizeY << YScale));

  Move(rp, Right - (BoxSizeX << XScale), Bottom + 1 - (BoxSizeY << YScale));
  Draw(rp, Right - (BoxSizeX << XScale), Bottom - 1);

  Move(rp, Left  + 1,                    Top + (DragSize << YScale));
  Draw(rp, Right - 1,                    Top + (DragSize << YScale));

  /*
   * Drag bar bar / close gadget separator
   */
  Move(rp, Left + (4 << XScale), Top + 1);
  Draw(rp, Left + (4 << XScale), Top + (DragSize << YScale) -1 );

  SetDrMd(rp, JAM1);
} /* DrawBox */


//E*O*F nav.c//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
    436   1124   9159 main.c
    726   2477  17997 mand.c
    130    380   2980 mand.h
    338    709   7367 menu.c
   1177   1621  15142 menu1.c
     64    207   1563 nav.c
   2871   6518  54208 total
!!!
wc  main.c mand.c mand.h menu.c menu1.c nav.c | sed 's=[^ ]*/==' | diff -b $temp -
exit 0


-- 
UUCP:  orandy@amdahl.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

orandy@amdahl.UUCP (05/20/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# palette.c presets.c savemand.c

echo x - palette.c
cat > "palette.c" << '//E*O*F palette.c//'
/***************************************************************************
 *
 *                      MandleVroom Color Palette
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/

#include "mand.h"

extern USHORT CurContour;

extern struct Gadget *ContGadget[], *SelGadget[];

extern struct Window *ContWind, *MandWind;

/*
 * Holder for Allocated color potentiometer gadgets.
 */
struct ColorGads {
  struct Gadget *RedPot;
  struct Gadget *GreenPot;
  struct Gadget *BluePot;
};

extern struct Screen        *screen;
extern struct ViewPort      *vp;
extern struct IntuitionBase *IntuitionBase;
extern char                 *ColorBase;
extern struct IntuiText     *MakeIntui();

struct Window          *PalWind;
extern SHORT XScale, YScale;

extern struct Window   *ContWind;

struct ColorGads        PalGads;

USHORT CmdMode;
USHORT CurPen;

struct NewWindow NewPal = {
   122,0,                    /* start position           */
   90,120,                   /* width, height            */
   (UBYTE) 0, (UBYTE) 1,     /* detail pen, block pen    */
                             /* IDCMP flags */
   MENUPICK | GADGETDOWN | GADGETUP | MOUSEMOVE | REQCLEAR| CLOSEWINDOW,
                             /* MandWind flags */
   WINDOWCLOSE | WINDOWDRAG | WINDOWDEPTH | SIMPLE_REFRESH | NOCAREREFRESH,
   (struct Gadget *) NULL,   /* first gadget             */
   (struct Image *) NULL,    /* user checkmark           */
   (UBYTE *) "Colors",       /* window title             */
   (struct Screen *) NULL,   /* pointer to screen        */
   (struct BitMap *) NULL,   /* pointer to superbitmap   */
   80,80,80,80,              /* sizing                   */
   CUSTOMSCREEN              /* type of screen           */
   };

extern struct Windows *WindowList;

/*
 * Interpret the gadgets and do the right thing
 */
DoPalette(gadget)
  struct Gadget *gadget;
{
  switch (gadget->GadgetID >> TYPEBITS & TYPEMASK) {

  case PALPENS:
       ColorPenGotten(gadget);
       SetNormPointer();
       break;

  case PALCNTLS:
       ColorCntlGotten(gadget);
       break;

  case PALPOTS:
       SetNormPointer();
       CmdMode = COLORSLIDE;
       break;
  }
} /* DoPalette */

/*
 * We got a color palette command gadget
 */
int ColorCntlGotten(gadget)
struct Gadget *gadget;
{
  switch (gadget->GadgetID) {

  case PALCOPY:
       SetToPointer();
       CmdMode = COPY;
       break;

  case PALRANGE:
       SetToPointer();
       CmdMode = RANGE;
       break;

  case PALEXCG:
       SetToPointer();
       CmdMode = EXCG;
       break;
  }
} /* ColorCntlGotten */

/*
 * We got a color pen. Now what was the command we were supposed to perform?
 */
int ColorPenGotten(gadget)
struct Gadget *gadget;
{
  USHORT rgb, rgb2, pen;

  struct Image *Image;

  BoxPen((USHORT) CurPen, 0);

  pen = gadget->GadgetID & 0x003f;

  switch (CmdMode) {
    case COPY:
         rgb = GetRGB4(vp->ColorMap, CurPen);
         SetRGB4(vp, pen, rgb >> 8, rgb >> 4, rgb);
         break;

    case RANGE:
         ColorRange(CurPen, pen);
         break;

    case EXCG:
         rgb  = GetRGB4(vp->ColorMap, CurPen);
         rgb2 = GetRGB4(vp->ColorMap, pen);
         SetRGB4(vp, CurPen, rgb2 >> 8, rgb2 >> 4, rgb2 );
         SetRGB4(vp, pen,       rgb  >> 8, rgb  >> 4, rgb  );
         break;

    case IMPLIEDSET:
         Image = (struct Image *) SelGadget[ CurContour ]->GadgetRender;
         Image->PlaneOnOff = pen;

         RefreshGList( SelGadget[ CurContour ], ContWind, NULL, 1);

         *(ColorBase + CurContour) = pen;
         break;
  }
  CurPen = pen;
  SetColorProps( pen );
  BoxPen( pen, 1);
} /* ColorPenGotten */

/*
 * Blend a range of colors between two pens
 */
int ColorRange(first, last)
SHORT first, last;
{
    SHORT i;
    LONG whole, redfraction, greenfraction, bluefraction;
    USHORT rgb;
    SHORT firstred, firstgreen, firstblue;
    SHORT lastred, lastgreen, lastblue;
    SHORT workred, workgreen, workblue;

    if (first > last) {
        i = first;
        first = last;
        last = i;
     }

    /* I need to see a spread of at least two, where there's at least one
     * spot between the endpoints, else there's no work to do so I
     * might as well just return now.
     */
    if (first >= last - 1) return;

    rgb = GetRGB4(vp->ColorMap, first);
    firstred = (rgb >> 8) & 0xF;
    firstgreen = (rgb >> 4) & 0xF;
    firstblue = (rgb >> 0) & 0xF;

    rgb = GetRGB4(vp->ColorMap, last);
    lastred = (rgb >> 8) & 0xF;
    lastgreen = (rgb >> 4) & 0xF;
    lastblue = (rgb >> 0) & 0xF;

    whole = (lastred - firstred) << 16;
    redfraction = whole / (last - first);
    whole = (lastgreen - firstgreen) << 16;
    greenfraction = whole / (last - first);
    whole = (lastblue - firstblue) << 16;
    bluefraction = whole / (last - first);

    for (i = first + 1; i < last; i++)
        {
        lastred = (redfraction * (i - first) + 0x8000) >> 16;
        workred = firstred + lastred;
        lastgreen = (greenfraction * (i - first) + 0x8000) >> 16;
        workgreen = firstgreen + lastgreen;
        lastblue = (bluefraction * (i - first) + 0x8000) >> 16;
        workblue = firstblue + lastblue;
        SetRGB4(vp, i, workred, workgreen, workblue);
        }
} /* ColorRange */

/*
 * Modify the colors in the current pen
 */
ModifyColors()
{
  USHORT newred, newgreen, newblue;

  newred = ((struct PropInfo *)
           PalGads.RedPot->SpecialInfo)->VertPot >> 12;
  newgreen = ((struct PropInfo *)
           PalGads.GreenPot->SpecialInfo)->VertPot >> 12;
  newblue = ((struct PropInfo *)
           PalGads.BluePot->SpecialInfo)->VertPot >> 12;

  SetRGB4(vp, CurPen, newred, newgreen, newblue);
} /* ModifyColors */

/*
 * Reflect a pen's new color in the proportional gadget
 */
SetColorProps(pen)
  USHORT pen;
{
  USHORT rgb, red, green, blue;

  rgb = GetRGB4(vp->ColorMap, pen);

  red = (rgb >> 8) & 0xF;
  green = (rgb >> 4) & 0xF;
  blue = (rgb >> 0) & 0xF;

  red = (red << 12);
  green = (green << 12);
  blue = (blue << 12);

  ModifyProp(PalGads.RedPot,  PalWind,NULL,FREEVERT|PROPBORDERLESS,
             0L,red,0L,0L);
  ModifyProp(PalGads.GreenPot,PalWind,NULL,FREEVERT|PROPBORDERLESS,
             0L,green,0L,0L);
  ModifyProp(PalGads.BluePot, PalWind,NULL,FREEVERT|PROPBORDERLESS,
             0L,blue,0L,0L);
} /* SetColorProps */

BoxPen(BoxPen, DrawPen)
  USHORT BoxPen, DrawPen;
{
  ULONG  row, column;
  SHORT  Top, Bot, Left, Right;

#define PALTOP    (12 << YScale)
#define PALLEFT   (4 << XScale)
#define PENWIDTH  (4 << XScale)
#define PENHEIGHT (4 << YScale)
#define PENXPITCH (6 << XScale)
#define PENYPITCH (6 << YScale)

  column = BoxPen/8;

  row = BoxPen - column*8;

  SetAPen(PalWind->RPort, DrawPen);

  Left  = PALLEFT + PENXPITCH * column - 1;
  Top   = PALTOP  + PENYPITCH * row    - 1;
  Right = Left    + PENWIDTH  + 1;
  Bot   = Top     + PENHEIGHT + 1;

  Move(PalWind->RPort, Left,  Top);
  Draw(PalWind->RPort, Right, Top);
  Draw(PalWind->RPort, Right, Bot);
  Draw(PalWind->RPort, Left,  Bot);
  Draw(PalWind->RPort, Left,  Top + 1);
}

/*
 * Allocate all the gadgets for the color palette window
 */
struct Gadget *MakePalette()
{
  struct Gadget *FirstGadget, *NextGadget;
  extern struct Gadget *MakeBool(), *MakePot();
  SHORT i,Left,x,y,c = 0;

  FirstGadget = NextGadget = MakeBool(4,12,5,5,0,PALPEN);

  i = 1 << (screen->BitMap.Depth);
  Left = 8;
  for (x = 0; x < 6*8 && i > 0; x += 6) {
    for (y = 0; y < 6*8 && i > 0; y += 6) {
      if (c != 0) {
        NextGadget->NextGadget = MakeBool(x+4, y+12, 4, 4, c, PALPEN+c);
        if ((NextGadget = NextGadget->NextGadget) == (struct Gadget *) NULL)
          return(FirstGadget);
      }
      c++;
      i--;
    }
    Left += 8;
  }
  for (c = 0, x = 0; x < 10*3; x += 10) {
    NextGadget->NextGadget = MakeBool(Left+36, x+12, 10, 6, 1, PALCNTL+c);
    if (NextGadget->NextGadget == (struct Gadget *) NULL)
      return(FirstGadget);
    switch (c) {
      case 0:  NextGadget->NextGadget->GadgetText =
                  MakeIntui("Copy",14,-1,3,3,JAM1);
               break;
      case 1:  NextGadget->NextGadget->GadgetText =
                  MakeIntui("Spread",14,-1,3,3,JAM1);
               break;
      case 2:  NextGadget->NextGadget->GadgetText =
                  MakeIntui("Exchg",14,-1,3,3,JAM1);
               break;
    }
    NextGadget = NextGadget->NextGadget;
    c++;
  }
  for (x = y = 0; y < 3; x += 10, y++) {
    NextGadget->NextGadget = MakePot(Left+x, 22, 5, 42, PALPOT + y, y);
    if (NextGadget->NextGadget == (struct Gadget *) NULL)
      return(FirstGadget);
    switch (y) {
      case 0:  PalGads.RedPot = NextGadget->NextGadget;
               NextGadget->NextGadget->GadgetText =
                 MakeIntui("R",-2,-10,3,3,JAM1);
               break;
      case 1:  PalGads.GreenPot = NextGadget->NextGadget;
               NextGadget->NextGadget->GadgetText =
                 MakeIntui("G",-2,-10,3,3,JAM1);
               break;
      case 2:  PalGads.BluePot = NextGadget->NextGadget;
               NextGadget->NextGadget->GadgetText =
                 MakeIntui("B",-2,-10,3,3,JAM1);
               break;
    }
    NextGadget = NextGadget->NextGadget;
    NextGadget->Activation = GADGIMMEDIATE | FOLLOWMOUSE | RELVERIFY;
  }
  return(FirstGadget);
} /* MakePalette */

/*
 * Open the Palette window
 */
OpenPalWind()
{
  struct Window *OpenMyWind();

  if (PalWind == (struct Window *) NULL) {
    PalWind = OpenMyWind(&NewPal,screen,MakePalette(),140,70,140,70);
    if (PalWind) {
      CurPen = 0;
      BoxPen(CurPen, 1);
      SetColorProps( CurPen );
      ForceNormPointer();
    }
  } else {
    WindowToFront( PalWind );
  }
} /* OpenPalWind */

/*
 * Close the Palette window
 */
ClosePalWind()
{
  if (PalWind != (struct Window *) NULL) {
    CloseMyWind(PalWind,NewPal.FirstGadget);
    PalWind = (struct Window *) NULL;
  }
} /* ClosePalWind */

//E*O*F palette.c//

echo x - presets.c
cat > "presets.c" << '//E*O*F presets.c//'
/***************************************************************************
 *
 *                 MandelVroom Preset Pictures code
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/

#include "mand.h"

#define NUMPRESETS 10

extern struct ViewPort *vp;

extern struct Screen *screen;
extern struct NewScreen NewScreen;

extern struct Window *MandWind;

extern float StartX,StartY,EndX,EndY;
extern SHORT CountX,CountY,MaxCount;

extern SHORT NumContours, *ContourBase;
extern UBYTE *ColorBase;

extern UBYTE MandType;
extern ULONG BorderType;

extern SHORT *CountBase;

struct Preset {
  char   *Name;
  float   StartX, StartY, EndX, EndY;
  SHORT   CountX, CountY;
  SHORT   MaxCount;
  UBYTE   MandType;
  USHORT  ViewModes;
  USHORT  Depth;
  ULONG   BorderType;
  SHORT  *ColorMap;
  SHORT   NumContours;
  USHORT *Contours;
  UBYTE  *Pens;
};

extern struct Preset Preset[];

/*
 * Generate a preset picture
 */
SetPreset(Number)
  int Number;
{
  if (InitPreset(Number) == 0) {

    CloseDisp();
    OpenDisp();

    if (MandWind->Width  != CountX + LEFTMARG + RIGHTMARG ||
        MandWind->Height != CountY + TOPMARG  + BOTMARG)
      SizeWindow(MandWind, CountX + LEFTMARG + RIGHTMARG - MandWind->Width,
                           CountY + TOPMARG  + BOTMARG   - MandWind->Height);
    Delay(1);
    GenerateIt();
  }
}

/*
 * Set up system from preset list
 */
InitPreset(Number)
  int Number;
{
  struct  Preset *CurPreset;
  SHORT  *CurColors;
  USHORT *CurContours;
  UBYTE  *CurPens;

  SHORT   i;

  if (Number < NUMPRESETS) {

    if (CountBase) {
      FreeMem(CountBase,CountX*CountY*sizeof(SHORT));
      CountBase = (SHORT *) NULL;
    }

    CurPreset = &Preset[Number];
    StartX = CurPreset->StartX;
    StartY = CurPreset->StartY;
    EndX   = CurPreset->EndX;
    EndY   = CurPreset->EndY;

    CountX = CurPreset->CountX;
    CountY = CurPreset->CountY;

    MaxCount = CurPreset->MaxCount;

    MandType = CurPreset->MandType;

    NewScreen.ViewModes = CurPreset->ViewModes;
    NewScreen.Depth = CurPreset->Depth;

    BorderType = CurPreset->BorderType;

    CurColors = CurPreset->ColorMap;

    LoadRGB4(vp, CurColors, 32);

    CurContours = CurPreset->Contours;

    for (i = 0; i < NumContours; i++)
      *(ContourBase + i) = *CurContours++;

    CurPens = CurPreset->Pens;

    for (i = 0; i < NumContours; i++)
      *(ColorBase + i) = *CurPens++;

    return(0);
  } else {
    DispErrMsg("Invalid Preset",0);
    return(1);
  }
}

/**************************************************************************
 *
 *  Preset arrays for generating pictures
 *
 *************************************************************************/

SHORT big_brotPalette[] =
{
  0x0000,  0x0fff,  0x0ddf,  0x0bbf,  0x099f,  0x077c,  0x055a,  0x0337,
  0x0114,  0x0337,  0x055a,  0x077c,  0x099f,  0x0bbf,  0x0ccf,  0x0eef,
  0x0000,  0x0fff,  0x0fff,  0x0eef,  0x0eef,  0x0ddf,  0x0ddf,  0x0ccf,
  0x0ccf,  0x099f,  0x088d,  0x066b,  0x055a,  0x0338,  0x0226,  0x0fff
};
USHORT big_brotHeights[] =
{
  1023,  283,  257,  231,  205,  180,  154,  128,
  103,  100,  95,  90,  85,  80,  75,  69,
  35,  31,  28,  25,  21,  18,  15,  11,
  7,  6,  5,  4,  3,  2,  1,  0
};
UBYTE big_brotPens[] =
{
  0,  1,  2,  3,  4,  5,  6,  7,
  8,  9,  10,  11,  12,  13,  14,  15,
  17,  18,  19,  20,  21,  22,  23,  24,
  25,  26,  27,  28,  29,  30,  30,  0
};

SHORT Hey_BabyPalette[] =
{
  0x0000,  0x0fff,  0x0ede,  0x0dbc,  0x0c9b,  0x0b6a,  0x0a49,  0x0927,
  0x0806,  0x0716,  0x0727,  0x0637,  0x0658,  0x0568,  0x0579,  0x0489,
  0x0000,  0x0fff,  0x0dee,  0x0bcd,  0x09bc,  0x06aa,  0x0499,  0x0278,
  0x0067,  0x059a,  0x0acc,  0x0fff,  0x0bdd,  0x08bb,  0x0489,  0x0067
};

USHORT Hey_BabyHeights[] =
{
  1023,  247,  220,  193,  167,  160,  154,  147,
  141,  134,  128,  122,  115,  110,  106,  102,
  98,  93,  89,  85,  81,  77,  74,  73,
  72,  71,  70,  69,  68,  67,  66,  65
};

UBYTE Hey_BabyPens[] =
{
  0,  1,  2,  3,  4,  5,  6,  7,
  8,  9,  10,  11,  12,  13,  14,  15,
  30,  29,  28,  27,  26,  25,  24,  23,
  22,  21,  20,  19,  18,  17,  20,  23
};

SHORT dragon_familyPalette[] =
{
  0x0000,  0x0a00,  0x0f20,  0x0f40,  0x0f60,  0x0f80,  0x0f90,  0x0fb0,
  0x0fd0,  0x0ff0,  0x0dd1,  0x0bb2,  0x0993,  0x0884,  0x0665,  0x0446,
  0x0227,  0x0008,  0x0207,  0x0406,  0x0605,  0x0804,  0x0903,  0x0b02,
  0x0d01,  0x0f00,  0x0f20,  0x0f40,  0x0f50,  0x0f70,  0x0f90,  0x0fb0
};

USHORT dragon_familyHeights[] =
{
  1023,  142,  132,  123,  113,  104,  99,  94,
  89,  84,  79,  74,  71,  68,  66,  63,
  60,  58,  55,  52,  50,  48,  47,  45,
  44,  42,  41,  39,  38,  36,  35,  34
};

UBYTE dragon_familyPens[] =
{
  0,  1,  2,  3,  4,  5,  6,  7,
  8,  9,  10,  11,  12,  13,  14,  15,
  16,  17,  18,  19,  20,  21,  22,  23,
  24,  25,  26,  27,  28,  29,  30,  31
};

SHORT sea_horsePalette[] =
{
  0x0000,  0x0fff,  0x0ddd,  0x0bbb,  0x0999,  0x0666,  0x0444,  0x0222,
  0x0000,  0x0002,  0x0003,  0x0005,  0x0006,  0x0007,  0x0009,  0x000a,
  0x002a,  0x003a,  0x0059,  0x0069,  0x0020,  0x0030,  0x0040,  0x0040,
  0x0050,  0x0060,  0x0050,  0x0040,  0x0030,  0x0020,  0x0010,  0x0fff
};

USHORT sea_horseHeights[] =
{
  1023,  635,  542,  449,  356,  263,  171,  145,
  142,  140,  138,  135,  132,  128,  125,  122,
  119,  115,  112,  109,  106,  103,  98,  94,
  89,  85,  80,  76,  71,  67,  62,  58
};

UBYTE sea_horsePens[] =
{
  0,  7,  6,  5,  4,  3,  3,  1,
  4,  6,  10,  11,  12,  13,  14,  15,
  16,  17,  18,  19,  20,  8,  22,  23,
  24,  25,  26,  27,  28,  29,  30,  0
};

SHORT spinePalette[] =
{
  0x0000,  0x0600,  0x0800,  0x0b00,  0x0d00,  0x0f00,  0x0f40,  0x0f80,
  0x0fb0,  0x0ff0,  0x0bb0,  0x0660,  0x0220,  0x0335,  0x022a,  0x000f,
  0x0c50,  0x0b40,  0x0940,  0x0830,  0x0630,  0x0520,  0x0310,  0x0210,
  0x0000,  0x00c0,  0x0aaa,  0x0bbb,  0x0ccc,  0x0ddd,  0x0eee,  0x0fff
};

USHORT spineHeights[] =
{
  1023,  318,  295,  272,  249,  226,  203,  180,
  157,  135,  127,  120,  113,  106,  99,  92,
  85,  68,  65,  62,  59,  56,  53,  0,
  44,  43,  42,  41,  40,  39,  0,  0
};

UBYTE spinePens[] =
{
  15,  5,  4,  3,  2,  1,  2,  3,
  4,  5,  6,  7,  8,  9,  10,  11,
  12,  0,  13,  14,  15,  14,  13,  0,
  14,  13,  14,  15,  14,  13,  0,  31
};

SHORT vertibraePalette[] =
{
  0x0000,  0x0f00,  0x0e01,  0x0d01,  0x0c02,  0x0a02,  0x0903,  0x0803,
  0x0923,  0x0a42,  0x0b62,  0x0c82,  0x0c91,  0x0db1,  0x0ed0,  0x0ff0,
  0x0de0,  0x0cd0,  0x0ac0,  0x09b0,  0x07a0,  0x0590,  0x0480,  0x0270,
  0x0272,  0x0283,  0x0185,  0x0196,  0x0198,  0x0199,  0x00ab,  0x00ac
};

USHORT vertibraeHeights[] =
{
  1023,  389,  355,  321,  287,  253,  219,  185,
  151,  134,  127,  120,  113,  106,  99,  92,
  85,  68,  66,  65,  63,  62,  61,  59,
  58,  57,  55,  54,  53,  0,  0,  0
};

UBYTE vertibraePens[] =
{
  15,  1,  2,  3,  4,  5,  6,  7,
  8,  9,  10,  11,  12,  13,  14,  15,
  16,  17,  18,  19,  20,  21,  22,  23,
  24,  25,  26,  27,  28,  29,  30,  31
};

SHORT beauty2Palette[] =
{
  0x0000,  0x0d22,  0x0c22,  0x0b22,  0x0a22,  0x0822,  0x0932,  0x0b32,
  0x0c42,  0x0d52,  0x0d71,  0x0e91,  0x0ea1,  0x0ec1,  0x0fd0,  0x0ff0,
  0x0bd0,  0x08b0,  0x0490,  0x0070,  0x0062,  0x0053,  0x0045,  0x0047,
  0x0038,  0x002a,  0x001b,  0x000d,  0x000a,  0x0007,  0x0004,  0x0f0f
};

USHORT beauty2Heights[] =
{
  1023,  465,  427,  389,  351,  313,  276,  259,
  244,  229,  213,  198,  183,  167,  163,  158,
  154,  151,  148,  145,  142,  138,  134,  130,
  126,  122,  118,  114,  109,  104,  99,  100
};

UBYTE beauty2Pens[] =
{
  31,  1,  2,  3,  4,  5,  6,  7,
  8,  9,  10,  11,  12,  13,  14,  15,
  16,  17,  18,  19,  20,  21,  22,  23,
  24,  25,  26,  27,  28,  29,  30,  0
};

SHORT linkPalette[] =
{
  0x0000,  0x0ff0,  0x0f00,  0x0e00,  0x0c00,  0x0b00,  0x0900,  0x0800,
  0x0600,  0x0fff,  0x0eee,  0x0ccc,  0x0bbb,  0x0999,  0x0888,  0x0777,
  0x0555,  0x0ff0,  0x0f00,  0x0900,  0x0111,  0x0222,  0x0222,  0x0444,
  0x0555,  0x0777,  0x0999,  0x0aaa,  0x0ccc,  0x0ddd,  0x0fff,  0x000f
};

USHORT linkHeights[] =
{
  1023,  706,  675,  621,  568,  515,  461,  408,
  355,  301,  248,  195,  163,  160,  158,  156,
  154,  152,  150,  148,  146,  144,  142,  140,
  138,  136,  134,  132,  130,  128,  126,  124
};

UBYTE linkPens[] =
{
  0,  1,  2,  3,  4,  5,  6,  7,
  8,  6,  4,  3,  0,  22,  23,  24,
  25,  26,  26,  27,  28,  29,  30,  29,
  28,  28,  27,  25,  25,  24,  23,  22
};

SHORT pretty_babyPalette[] =
{
  0x0000,  0x0044,  0x0255,  0x0477,  0x0688,  0x0abc,  0x0eef,  0x0ccf,
  0x0bbf,  0x0aaf,  0x088e,  0x077e,  0x066e,  0x044d,  0x033d,  0x011c,
  0x000c,  0x0310,  0x0420,  0x0521,  0x0531,  0x0632,  0x0742,  0x0842,
  0x0953,  0x0953,  0x0a64,  0x0b64,  0x0953,  0x0732,  0x0421,  0x0200
};

USHORT pretty_babyHeights[] =
{
  1023,  618,  541,  465,  389,  313,  308,  304,
  300,  296,  292,  288,  284,  280,  276,  272,
  267,  203,  200,  197,  195,  192,  190,  187,
  185,  182,  179,  177,  174,  172,  169,  167
};

UBYTE pretty_babyPens[] =
{
  0,  1,  2,  3,  4,  5,  6,  7,
  8,  9,  10,  11,  12,  13,  14,  15,
  16,  17,  18,  19,  20,  21,  22,  23,
  24,  25,  26,  27,  28,  29,  30,  31
};

SHORT horse_chainPalette[] =
{
  0x0000,  0x0a90,  0x0f00,  0x0d00,  0x0c00,  0x0a00,  0x0800,  0x0600,
  0x0400,  0x0fff,  0x0eee,  0x0ccc,  0x0bbb,  0x0999,  0x0888,  0x0777,
  0x0555,  0x0ff0,  0x0f00,  0x0d20,  0x0a30,  0x0620,  0x0222,  0x0444,
  0x0555,  0x0777,  0x0999,  0x0aaa,  0x0ccc,  0x0ddd,  0x0fff,  0x000f
};

USHORT horse_chainHeights[] =
{
  1023,  706,  441,  371,  295,  265,  247,  226,
  205,  195,  185,  174,  136,  133,  130,  127,
  124,  121,  118,  116,  113,  110,  107,  104,
  101,  99,  96,  93,  90,  87,  84,  82
};

UBYTE horse_chainPens[] =
{
  31,  1,  8,  7,  6,  5,  4,  3,
  2,  19,  20,  21,  0,  22,  23,  24,
  25,  26,  26,  27,  28,  29,  30,  29,
  28,  28,  27,  25,  25,  24,  23,  22
};

struct Preset Preset[] =
  {
    {
      "big_brot",  /* Preset Name */
      -2.000000, -1.204545, /* StartX, StartY */
      2.820000, 1.204545, /* EndX, EndY */
      109, 78, /* CountX,CountY */
      1023,     /* MaxCount */
      0,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      &big_brotPalette[0], /* Palette colors */
      32,         /* NumContours */
      &big_brotHeights[0], /* ContourHeights */
      &big_brotPens[0]     /* ContourPens */
    },
    {
      "Hey_Baby",  /* Preset Name */
      -0.143523, -1.019072, /* StartX, StartY */
      -0.143384, -1.018843, /* EndX, EndY */
      96, 65, /* CountX,CountY */
      1023,     /* MaxCount */
      0,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      Hey_BabyPalette, /* Palette colors */
      32,         /* NumContours */
      Hey_BabyHeights, /* ContourHeights */
      Hey_BabyPens     /* ContourPens */
    },
    {
      "dragon_family",  /* Preset Name */
      -0.942986, -0.270764, /* StartX, StartY */
      -0.922458, -0.260287, /* EndX, EndY */
      129, 58, /* CountX,CountY */
      1023,     /* MaxCount */
      0,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      dragon_familyPalette, /* Palette colors */
      32,         /* NumContours */
      dragon_familyHeights, /* ContourHeights */
      dragon_familyPens     /* ContourPens */
    },
    {
      "spine",  /* Preset Name */
      -1.253688, -0.042351, /* StartX, StartY */
      -1.251284, -0.040954, /* EndX, EndY */
      120, 76, /* CountX,CountY */
      1023,     /* MaxCount */
      0,     /* MandType */
      0x4000,   /* ViewModes */
      4,     /* Depth */
      0,     /* Border Type*/
      spinePalette, /* Palette colors */
      32,         /* NumContours */
      spineHeights, /* ContourHeights */
      spinePens     /* ContourPens */
    },
    {
      "vertibrae",  /* Preset Name */
      -1.253227, -0.041939, /* StartX, StartY */
      -1.251660, -0.041292, /* EndX, EndY */
      105, 56, /* CountX,CountY */
      1023,     /* MaxCount */
      0,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      vertibraePalette, /* Palette colors */
      32,         /* NumContours */
      vertibraeHeights, /* ContourHeights */
      vertibraePens     /* ContourPens */
    },
    {
      "beauty",   /* Preset Name */
      -1.252925, -0.041729, /* StartX, StartY */
      -1.252575, -0.041497, /* EndX, EndY */
      98, 56, /* CountX,CountY */
      1023,     /* MaxCount */
      0,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      beauty2Palette, /* Palette colors */
      32,         /* NumContours */
      beauty2Heights, /* ContourHeights */
      beauty2Pens     /* ContourPens */
    },
    {
      "sea_horse",  /* Preset Name */
      -0.749790, -0.113353, /* StartX, StartY */
      -0.742342, -0.105343, /* EndX, EndY */
      69, 56, /* CountX,CountY */
      1023,     /* MaxCount */
      0,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      sea_horsePalette, /* Palette colors */
      32,         /* NumContours */
      sea_horseHeights, /* ContourHeights */
      sea_horsePens     /* ContourPens */
    },
    {
      "horse_chain",  /* Preset Name */
      -0.745445, -0.113237, /* StartX, StartY */
      -0.744856, -0.112922, /* EndX, EndY */
      105, 56, /* CountX,CountY */
      1023,     /* MaxCount */
      0,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      horse_chainPalette, /* Palette colors */
      32,         /* NumContours */
      horse_chainHeights, /* ContourHeights */
      horse_chainPens     /* ContourPens */
    },
    {
      "link",  /* Preset Name */
      -0.745464, -0.113034, /* StartX, StartY */
      -0.745399, -0.112985, /* EndX, EndY */
      95, 56, /* CountX,CountY */
      1023,     /* MaxCount */
      1,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      linkPalette, /* Palette colors */
      32,         /* NumContours */
      linkHeights, /* ContourHeights */
      linkPens     /* ContourPens */
    },
    {
      "pretty_baby",  /* Preset Name */
      -0.745436, -0.113016, /* StartX, StartY */
      -0.745399, -0.113003, /* EndX, EndY */
      87, 56, /* CountX,CountY */
      1023,     /* MaxCount */
      1,     /* MandType */
      0x4000,   /* ViewModes */
      5,     /* Depth */
      0,     /* Border Type*/
      pretty_babyPalette, /* Palette colors */
      32,         /* NumContours */
      pretty_babyHeights, /* ContourHeights */
      pretty_babyPens     /* ContourPens */
    },
  };

#ifdef DEVELOPMENT
SavePreset(name)
  char *name;
{
  int i;

  FILE *SaveFile;

  SaveFile = fopen(name,"a");

  if (SaveFile != (struct FILE *) NULL) {

    fprintf(SaveFile, "SHORT %sPalette[] =\n{\n",name);
    for (i = 0; i < 32; i++) {
      fprintf(SaveFile, "  0x%04x", GetRGB4(vp->ColorMap, i));

      if (i != 31)
        fprintf(SaveFile,",");

      if (i % 8 == 7)
        fprintf(SaveFile, "\n");
    }
    fprintf(SaveFile, "};\n");

    fprintf(SaveFile, "USHORT %sHeights[] =\n{\n",name);
    for (i = 0; i < NumContours; i++) {
      fprintf(SaveFile, "  %d", *(ContourBase + i) );

      if (i != NumContours - 1) {
        fprintf(SaveFile,",");
        if (i % 8 == 7)
          fprintf(SaveFile, "\n");
      }
    }
    fprintf(SaveFile, "\n};\n");

    fprintf(SaveFile, "UBYTE %sPens[] =\n{\n",name);
    for (i = 0; i < NumContours; i++) {
      fprintf(SaveFile, "  %d", *(ColorBase + i) );

      if (i != NumContours - 1) {
        fprintf(SaveFile,",");
        if (i % 8 == 7)
          fprintf(SaveFile, "\n");
      }
    }
    fprintf(SaveFile, "\n};\n");

    fprintf(SaveFile, "    {\n");
    fprintf(SaveFile, "      \"%s\",  /* Preset Name */\n", name);
    fprintf(SaveFile, "      %f, %f, /* StartX, StartY */\n",
                                    StartX, StartY);

    fprintf(SaveFile, "      %f, %f, /* EndX, EndY */\n", EndX, EndY);
    fprintf(SaveFile, "      %d, %d, /* CountX,CountY */\n",
                             CountX, CountY);

    fprintf(SaveFile, "      %d,     /* MaxCount */\n", MaxCount);

    fprintf(SaveFile, "      %d,     /* MandType */\n", MandType);

    fprintf(SaveFile, "      0x%04x,   /* ViewModes */\n",
                                    screen->ViewPort.Modes);

    fprintf(SaveFile, "      %d,     /* Depth */\n",
                                    screen->BitMap.Depth);

    fprintf(SaveFile, "      %d,     /* Border Type*/\n", BorderType);

    fprintf(SaveFile, "      %sPalette, /* Palette colors */\n",
                                    name);

    fprintf(SaveFile, "      %d,         /* NumContours */\n",
                                    NumContours);

    fprintf(SaveFile, "      %sHeights, /* ContourHeights */\n", name);
    fprintf(SaveFile, "      %sPens     /* ContourPens */\n", name);
    fprintf(SaveFile, "    },\n\n\n");
  }
}
#endif
//E*O*F presets.c//

echo x - savemand.c
cat > "savemand.c" << '//E*O*F savemand.c//'
/***************************************************************************
 *
 *                MandelVroom Load/Save raw information
 *
 *                         Kevin L. Clague
 *
 *                        Copyright (C) 1987
 *
 **************************************************************************/

#include "mand.h"

extern struct NewScreen NewScreen;
extern struct Screen    *screen;
extern struct ViewPort  *vp;

extern float StartX,StartY,EndX,EndY;

extern SHORT Zoom;

extern SHORT CountX,CountY,MaxCount,*CountBase;
extern LONG  NavTop,NavBot,NavLeft,NavRight;

extern SHORT NumContours, *ContourBase;
extern UBYTE *ColorBase;

extern SHORT SavePalette[], Inited;

extern ULONG CalcTime;
extern UBYTE MandType;
extern ULONG BorderType;

/*
 * Save all the data needed to restore the system to current state.
 */
SaveCounts(SaveName)
  char *SaveName;
{
  FILE  *SaveFile;
  SHORT *CountPtr,Color;
  ULONG  i,Count,Word = 0;
  USHORT Cur,t;
  ULONG Version = VERSION;
  char   ErrMsg[80];

  /*
   * Change the mouse pointer to Sleepy pointer
   */
  SetSleepyPointer();

  /*
   * open the desired file for writing
   */
  SaveFile = fopen(SaveName,"w");

  if (SaveFile == (FILE *) NULL) {
    sprintf(ErrMsg, "Can't open file %s", SaveName);
    DispErrMsg(ErrMsg, 0);
    return(0);
  }

  /*
   * if there is data to save, save it
   */
  if (CountBase) {

    /*
     * Put out the file header
     */
    fwrite((char *) "MAND",    4,  1, SaveFile);

    /*
     * Put out the revision number
     */
    fwrite((char *) Version,   sizeof(Version), 1, SaveFile);

    /*
     * Put out the location on the complex plane
     */
    fwrite((char *) &StartX,   sizeof(float),   1, SaveFile);
    fwrite((char *) &StartY,   sizeof(float),   1, SaveFile);
    fwrite((char *) &EndX,     sizeof(float),   1, SaveFile);
    fwrite((char *) &EndY,     sizeof(float),   1, SaveFile);

    /*
     * Put out the Maximum iteration count for a given point
     */
    fwrite((char *) &MaxCount, sizeof(SHORT),    1, SaveFile);

    /*
     * Put out the generator type
     */
    fwrite((char *) &MandType, sizeof(MandType), 1, SaveFile);

    /*
     * Put out the time it took to generate
     */
    fwrite((char *) &CalcTime, sizeof(CalcTime), 1, SaveFile);

    /*
     * Put out the screen's viewmodes
     */
    fwrite((char *) &screen->ViewPort.Modes,
              sizeof(screen->ViewPort.Modes), 1, SaveFile);

    /*
     * Put out the number of bit planes
     */
    fwrite((char *) &screen->BitMap.Depth,
              sizeof(screen->BitMap.Depth), 1, SaveFile);

    /*
     * Put some window flags
     */
    fwrite((char *) &BorderType, sizeof(BorderType), 1, SaveFile);

    /*
     * Save the Color Palette
     */
    for (i = 0; i < 32; i++) {
      Color = GetRGB4(vp->ColorMap, i);
      fwrite((char *) &Color, sizeof(Color), 1, SaveFile);
    }

    /*
     * Save the number of contours
     */
    fwrite((char *) &NumContours, sizeof(NumContours), 1, SaveFile);

    /*
     * Save the contour's heights
     */
    fwrite((char *) ContourBase, sizeof(SHORT), (long) NumContours, SaveFile);

    /*
     * Save the contour's pen numbers (Color is a misnomer)
     */
    fwrite((char *) ColorBase, sizeof(UBYTE), (long) NumContours, SaveFile);

    /*
     * Put out the image dimensions
     */
    fwrite((char *) &CountX,   sizeof(SHORT),   1, SaveFile);
    fwrite((char *) &CountY,   sizeof(SHORT),   1, SaveFile);

    /* Save count information in pseudo RLL format */
    /* Bits 9-0 are iteration count.               */
    /* Bits 15-10 are how many iteration count of same height in a row */

    i = CountX*CountY;

    CountPtr = CountBase;
    Cur = *CountPtr;
    Count = 1;

    while (--i) {
      CountPtr++;

      /*
       * Count up how many in a row have same height
       */
      if (Cur == *CountPtr) {
        Count++;
      } else {

        /*
         * Break it up into chunks of 64
         */
        while (Count) {
          if (Count > 63) {
            t = 63 << 10 | Cur;
            Count -= 63;
          } else {
            t = Count << 10 | Cur;
            Count = 0;
          }
          fwrite(&t,sizeof(SHORT),1,SaveFile);
          Word++;
        }
        Count = 1;
        Cur = *CountPtr;
      }
    }

    /*
     * Break the last one up into chunks
     */
    while (Count) {
      if (Count > 63) {
        t = 63 << 10 | Cur;
        Count -= 63;
      } else {
        t = Count << 10 | Cur;
        Count = 0;
      }
      fwrite(&t,sizeof(SHORT),1,SaveFile);
      Word++;
    }

  } else {
    DispErrMsg("No Picture to save",0);
    fclose(SaveFile);
    return(0);
  }
  fclose(SaveFile);
} /* SaveCounts */

/*
 * Load the state of the program from file
 */
LoadCounts(LoadName)
  char *LoadName;
{
  FILE  *LoadFile;
  SHORT *CountPtr;
  LONG   i;
  ULONG  Count,Word = 0;
  USHORT t;
  USHORT ViewModes;
  UBYTE  Depth;
  UBYTE  Header[5];
  ULONG  Version;
  char   ErrMsg[80];

  /*
   * Change the mouse pointer to Sleepy pointer
   */

  SetSleepyPointer();

  LoadFile = fopen(LoadName,"r");

  if (CountBase) {
    FreeMem(CountBase,CountX*CountY*sizeof(SHORT));
    CountBase = (SHORT *) NULL;
  }

  if (LoadFile == (FILE *) NULL) {

    /*
     * can't read a non-existant file
     */
    sprintf(ErrMsg, "File %s not found", LoadName);
    DispErrMsg(ErrMsg, 0);
    return(-1);
  } else {
    /*
     * Read and check the file header
     */
    fread((char *) &Header[0], 4, 1, LoadFile);
    Header[4] = '\0';

    if (strcmp(&Header[0], "MAND") != 0) {

      /*
       * File of improper format
       */
      sprintf(ErrMsg, "File %s is not a MAND file",LoadName);
      DispErrMsg(ErrMsg, 0);
      fclose(LoadFile);
      return(-1);

    } else {

      /*
       * Read in the version
       */
      fread((char *) &Version, sizeof(Version), 1, LoadFile);

      /*
       * Read in the locationin the complex plane
       */
      fread((char *) &StartX, sizeof(float), 1, LoadFile);
      fread((char *) &StartY, sizeof(float), 1, LoadFile);
      fread((char *) &EndX,   sizeof(float), 1, LoadFile);
      fread((char *) &EndY,   sizeof(float), 1, LoadFile);

      /*
       * Read in the maximum iteration count for a given point
       */
      fread((char *) &MaxCount, sizeof(SHORT), 1, LoadFile);

      /*
       * Read in the generator type
       */
      fread((char *) &MandType, sizeof(MandType), 1, LoadFile);

      /*
       * Read in the calculation time
       */
      fread((char *) &CalcTime, sizeof(CalcTime), 1, LoadFile);

      /*
       * Read in the screen's viewmodes
       */
      fread((char *) &ViewModes, sizeof(ViewModes), 1, LoadFile);

      /*
       * Read in the number of bit planes
       */
      fread((char *) &Depth, sizeof(Depth), 1, LoadFile);

      /*
       * Read in the window flags
       */
      fread((char *) &BorderType, sizeof(BorderType), 1, LoadFile);

      /*
       * Read in the color palette information
       */
      fread((char *) &SavePalette[0], sizeof(SHORT), 32, LoadFile);

      /*
       * Read in the number of contours
       */
      fread((char *) &NumContours, sizeof(NumContours), 1, LoadFile);

      /*
       * Read in the heights
       */
      fread((char *) ContourBase, sizeof(SHORT), (long) NumContours, LoadFile);

      /*
       * Read in the pen numbers (Color is a misnomer)
       */
      fread((char *) ColorBase, sizeof(UBYTE), (long) NumContours, LoadFile);

      /*
       * Put out the image dimensions
       */
      fread((char *) &CountX,   sizeof(SHORT),  1, LoadFile);
      fread((char *) &CountY,   sizeof(SHORT),  1, LoadFile);

      /*
       * try to allocate the space for the picture's iteration counts
       */
      CountBase = (SHORT *) AllocMem(CountX*CountY*sizeof(SHORT),0);

      if (CountBase == (SHORT *) NULL) {
        DispErrMsg("Can't load counts. Out of RAM!!",0);
        fclose(LoadFile);
        return(0);
      }

      CountPtr = CountBase;

      /* Load count information in pseudo RLL format */
      /* Bits 9-0 are iteration count.               */
      /* Bits 15-10 are how many iteration count of same height in a row */

      i = CountX*CountY;

      while (i > 0) {
        Word++;
        if (fread((char *) &t, sizeof(t), 1, LoadFile) == 0) {
          DispErrMsg("Premature EOF on source file",0);
          fclose(LoadFile);
          return(0);
        }
        Count = t >> 10;
        t = t & 0x3ff;
        for (; Count > 0; Count--) {
          *(CountPtr++) = t;
          i--;
        }
      }

      CalculateGaps();
    }
  }

  /*
   * Open a new screen
   */
  NewScreen.ViewModes = ViewModes;
  NewScreen.Depth = Depth;

  Inited = 0;
  CloseDisp();
  Inited = 1;
  OpenDisp();

  /*
   * Let's show it to them
   */
  ReColor();

  /*
   * Set No ZOOM
   */
  Zoom = 0;
  fclose(LoadFile);
} /* NewLoadCounts */

//E*O*F savemand.c//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
    382   1223  10002 palette.c
    607   2254  17314 presets.c
    394   1106   8928 savemand.c
   1383   4583  36244 total
!!!
wc  palette.c presets.c savemand.c | sed 's=[^ ]*/==' | diff -b $temp -
exit 0


-- 
UUCP:  orandy@amdahl.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

orandy@amdahl.UUCP (05/20/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# Makefile README README.1ST getfile.c getfile.diffs getfile.h safeclose.c safeclose.h standard.h testing.c

echo x - Makefile
cat > "Makefile" << '//E*O*F Makefile//'
# The "testing" program is not needed by MandelVroom;  I've left it in
# the Makefile due to Charlie Heath's "no modifications" demand.  If
# you think that policy is as much of a pain in the ass as I do, write
# Charlie at Microsmiths, Inc.


testing:        testing.o safeclose.o getfile.o
        ln testing.o safeclose.o getfile.o -lc32

testing.o: testing.c
  cc testing.c +l -s

safeclose.o: safeclose.c
  cc safeclose.c +l -s

getfile.o: getfile.c
  cc getfile.c +l -s

//E*O*F Makefile//

echo x - README
cat > "README" << '//E*O*F README//'
ReadMe for GetFile.Arc			November 11, 1986

	This archive includes the files needed for the Heath/Aegis file name
requester.
	This material is copyright (c) 1986 by C. Heath of Microsmiths, Inc.
Permission is granted to use these files in any way with the following
exceptions:

1) The files shall not be posted on any telecommunications service, public
or private, except for BIX until January 15, 1987.

2) The files may only be distributed in archive format, with no modifications.
If you make any improvements on the file requester and would like to
generally distribute them, please contact "cheath" on BIX, or write to:
	Microsmiths Inc, PO Box 561, Cambridge, MA 02140

3) The requester may be used in any commercial product, but must be in
object code format.  Permission is granted to Lattice, Inc, and to
Manx, Inc, to include the source files in archive format.

4) These files are distributed "as is" and it is your sole responsibility
to determine their fitness for use.

	My apologies for the lousy program structure and the compile
time warnings - I didn't have time to clean things up.  Hope this doesn't
inconvenience too many folks.

	Thanks, and enjoy.
		...cheath

[Note:  Charlie gave me explicit permission to include these files on one
 of my disks.  Fred Fish, 26-Nov-86]
//E*O*F README//

echo x - README.1ST
cat > "README.1ST" << '//E*O*F README.1ST//'
This directory contains Charlie Heath's file name requester.  It also
contains a diffs file that has some changes I made.  You should apply
the diffs to Charlie's original getfile.c to create the getfile.c that
I use in MandelVroom.

The file name requester did have some problems working with a custom
intuition screen, hence my changes.

You must make the things in this directory before you make MandelVroom.

//E*O*F README.1ST//

echo x - getfile.c
cat > "getfile.c" << '//E*O*F getfile.c//'
/************************************************************************
req.c
	This file contains a general-purpose <requester> that
will prompt the user for a filename input.
	The program actually uses a window instead of a 'Requester'
for greater flexibility. It will take control of your window's
IDCMP Port when called.

***	This material is copyright (c) 1986 by C. Heath of Microsmiths, Inc.
Permission is granted to use these files in any way with the following
exceptions:

1) The files shall not be posted on any telecommunications service, public
or private, except for BIX until January 15, 1987.

2) The files may only be distributed in archive format, with no modifications.
If you make any improvements on the file requester and would like to
generally distribute them, please contact "cheath" on BIX, or write to:
	Microsmiths Inc, PO Box 561, Cambridge, MA 02140

3) The requester may be used in any commercial product, but must be in
object code format.  You are free to make modifications for use in your
product.  Permission is granted to Lattice, Inc, and to Manx, Inc, to
include the source files in archive format.

	Thank you, and enjoy.
		...cheath

************************************************************************/

#include "standard.h"
#include "safeclose.h"

#define FAST register
#define NL NULL

extern char *dmore(), *dinit();

static struct FileLock      *pdir = NL;
static struct FileInfoBlock *dir_info;

static struct Window   *eW;		/* Parent Window. Uck	*/

static struct TextAttr MyFont = {"topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPF_ROMFONT };

/* FGAD requires a few unique gadget-ids, origined at FGAD	*/
/* In the unlikely event this conflicts with any of your gadgets, */
/* change this equate to allow 16 contiguous unique ID's	*/

#define FGAD	0x76c0L

#define FCHARS	32L	/* Number of chars allowed in file name	*/

#define DIR_SIZ	50L	/* Number of chars in a dir name...	*/
#define MAX_STR	DIR_SIZ+2L

#define DENTS	5L		/* Number of entries on screen   */
/* It's not as simple as changing 'DENTS'...      */

#define DSIZE	FCHARS+1L	/* Size of a directory entry   */

#define	DBUFSIZ	3000L	/* Number of bytes to allocate for all ents */

#define BCOL	1L	/* Background color	*/
#define FCOL	2L	/* Foreground color	*/

#define RHGHT	120L
#define RWDTH	320L

#define ZWDTH	270L

static char	ubuf[MAX_STR];		/* Undo buffer	*/

static struct dirent { struct dirent *next; BOOL isfile; char dE[DSIZE+2]; };
static struct dirent *FirstEntry;
static struct dirent *NextEntry;

static struct dirhead { struct dirent *next; };
static struct dirhead ListHead;

static long   curent,maxent;
static BOOL   more;

static struct Window	*wRq = NL;		/* Requester window   */
static struct RastPort	*wRp;

/* Requester "Hailing" prompt */
static struct IntuiText oTxt = {2,2,JAM1,10,11,NL, NL ,NL};

static struct IntuiText saydir = {0,1,JAM2,0,1,&MyFont,(UBYTE *)"(dir) ",NL};

static struct IntuiText rname[DENTS] = { /* File name list */
   {2,1,JAM2,48,1,NL,NL, NL},
   {2,1,JAM2,48,1,NL,NL, NL},
   {2,1,JAM2,48,1,NL,NL, NL},
   {2,1,JAM2,48,1,NL,NL, NL},
   {2,1,JAM2,48,1,NL,NL, NL} };

/* Display for file name ... */

static SHORT oXY2[] = {-2,-2, RWDTH-78,-2, RWDTH-78,9, -2,9, -2,-2};
static struct Border thebd = {0,0, 2,3,JAM1, 5,oXY2, NL};

static struct IntuiText otxt = {2,2,JAM1,-40,0,&MyFont,(UBYTE *)"file",NL};
static struct StringInfo osx = { NL ,ubuf, NL,DSIZE,NL,NL,NL,NL,NL,NL,NL,NL,NL};
static struct Gadget ogx = { NL, 60,RHGHT-35,RWDTH-80 ,10,     /* File name gadget */
   GADGHCOMP, RELVERIFY , STRGADGET,
   (APTR)&thebd,NL,&otxt,NL,(APTR)&osx, FGAD+11,NL };

static struct Gadget oga = { &ogx, 10,70, ZWDTH,10,   /* Gadgets For   */
   GADGHCOMP, RELVERIFY, BOOLGADGET,     /* Directory entries   */
   NL,NL, &rname[4] ,NL,NL, FGAD+10,NL };
static struct Gadget og9 = {&oga, 10,60, ZWDTH,10,
   GADGHCOMP, RELVERIFY, BOOLGADGET,
   NL,NL, &rname[3] ,NL,NL, FGAD+9,NL };
struct Gadget og8 = {&og9, 10,50, ZWDTH,10,
   GADGHCOMP, RELVERIFY, BOOLGADGET,
   NL,NL, &rname[2] ,NL,NL, FGAD+8,NL };
static struct Gadget og7 = {&og8, 10,40, ZWDTH,10,
   GADGHCOMP, RELVERIFY, BOOLGADGET,
   NL,NL, &rname[1] ,NL,NL, FGAD+7,NL };
static struct Gadget og6 = {&og7, 10,30, ZWDTH,10,
   GADGHCOMP, RELVERIFY, BOOLGADGET,
   NL,NL, &rname[0] ,NL,NL, FGAD+6,NL };


/* Gadjets for requester  */

static SHORT oXY3[] = {0,0, 50,0, 50,9, 0,9, 0,0};
static SHORT oXY4[] = {2,-2, 48,-2, 52,2, 52,7, 48,11, 2,11, -2,7, -2,2, 2,-2};
static struct Border obd2 = {0,0, 2,3,JAM1, 9,oXY4, NL};
static struct Border obd1 = {0,0, 3,2,JAM1, 5,oXY3, &obd2};  /* OTAY / CANCEL box */

static struct IntuiText ot1 = {0,0,JAM1,1,1,&MyFont,(UBYTE *)"  OK  ",NL};
static struct IntuiText ot2 = {0,0,JAM1,1,1,&MyFont,(UBYTE *)"Cancel",NL};

static struct IntuiText dtxt = {2,2,JAM1,-60,0,NL,(UBYTE *)"drawer",NL};
static struct StringInfo os5 = { NL ,ubuf, NL,DIR_SIZ,NL,NL,NL,NL,NL,NL,NL,NL,NL};
static struct Gadget og5 = { &og6, RWDTH/2-80,19,190,10,     /* Directory */
   GADGHCOMP, RELVERIFY, STRGADGET,
   NL,NL,&dtxt,NL,(APTR)&os5, FGAD+5,NL };

static struct Image   cc_img;
static struct PropInfo   cc_prop = {AUTOKNOB | FREEVERT, 0,0, 0,0x1000,0,0,0,0,0,0 };
static struct Gadget og3 = { &og5,RWDTH-39,20,20,60,      /* Scroll Bar   */
    GADGHCOMP,GADGIMMEDIATE | FOLLOWMOUSE, PROPGADGET,
    (APTR)&cc_img,NL,NL,NL,(APTR)&cc_prop,FGAD+3,NL };

static struct Gadget og2 = { &og3, RWDTH-70,RHGHT-20, 50,10,  /* CANCEL */
   GADGHCOMP,  RELVERIFY, BOOLGADGET,
   (APTR)&obd1,NL, &ot2,NL,NL, FGAD+2,NL };

static struct Gadget og1 = { &og2, 20,RHGHT-20, 50,10,      /* OTAY   */
   GADGHCOMP,		/* Flags	*/
   RELVERIFY,		/* Activation	*/
   BOOLGADGET,
   (APTR)&obd1,NL,	/* GadgetRender, SelectRender	*/
   &ot1,NL,NL,		/* IntuiText, MutualExclude,SpecialInfo   */
   FGAD+1,NL };		/* Gadget Id, UserData	*/

/* Open a requester "Window" */

static struct NewWindow NewFiles = {
   160, 30, RWDTH,RHGHT, BCOL,FCOL, NL, /* Fill in AFTER opening ... */
   SMART_REFRESH | ACTIVATE | RMBTRAP | WINDOWDRAG,
   &og1,NL,NL, NL,
   NL, RWDTH,RHGHT,RWDTH,RHGHT, WBENCHSCREEN };

IMPORT struct Library	*IntuitionBase;

/***************************************************
*  get_fname(window,screen,hail,ddef,ddir);
*
*   Displays a window/requester that
* gets a file name for device,directory,default file, extension
*
*   Calling args:
* window:   Window making the request
* screen:   Screen, if NULL assummed workbench
* hail:   Text prompt at top of requester
* ddef:   Input default file-name. Has NO DIRECTORY OR EXTENSION.
* ddir:   Directory of file, may be null

/* Set a file-requester with prompt 'hail'   */

char *get_fname(cW,screen,hail,ddef,ddir)
   struct Window *cW;		/* Calling Window   */
   struct Screen *screen;	/* screen .... if null assumed workbench */
   UBYTE	*hail;		/* Hailing prompt   */
   char		*ddef;		/* Proable file-name   */
   char		*ddir;		/* Directory in which to search   */
   {
   FAST struct IntuiMessage *imes;   /* Wait for message in HERE   */
   FAST struct Gadget	*igad;   /* Get Gadjet Mumbo Jumbo   */
   FAST long	i,class;
   FAST TEXT	*pnam;

   FAST char	*retval;
   FAST BOOL	dir_flag;
   FAST BOOL	keepon;

   if ( ! (eW = cW) )   return(NL);

   osx.Buffer = ddef;	/* Set default file name   */
   os5.Buffer = ddir;	/* Set default device name   */

   for ( i=0; i<DENTS; i++)
      {
      rname[i].IText = "";
      rname[i].NextText = NL;
      };

   NewFiles.Title = eW->Title;
   if ((dir_info = AllocMem((long)sizeof(struct FileInfoBlock),0L)) == NULL)
      return(NL);

   if (screen)		/* User supplied a screen */
      {
      NewFiles.Type = CUSTOMSCREEN;
      NewFiles.Screen = screen;
      }

   if ( ! (FirstEntry = (struct dirent *)AllocMem((long)DBUFSIZ,0L)) ||
        ! (wRq = (struct Window *)OpenWindow( &NewFiles )) )
      {
      if ( FirstEntry )   FreeMem(FirstEntry,(long)DBUFSIZ);
      /* notify("Can't Open Requester..."); */
      FreeMem(dir_info,(long)sizeof(struct FileInfoBlock));
      return(NL);
      }

   /* Set up directory, notify any errors...   */
   if ( pnam = (char *)dinit(ddir) )   notify(pnam);


   /* This optional line will activate a string gadget	*/
   if ( IntuitionBase->lib_Version > 32 )
	{
	ActivateGadget(&ogx,wRq,0L);
	}

   wRp = wRq->RPort;

   wRq->UserPort = eW->UserPort;
   ModifyIDCMP(wRq,(long)(MOUSEBUTTONS | GADGETDOWN | GADGETUP | MOUSEMOVE));

   SetAPen(wRp,1L);
   RectFill(wRp,4L,10L,(long)(RWDTH-5),(long)(RHGHT-4));

   oTxt.IText = hail;   /* Set calling arg   */
   oTxt.LeftEdge = (RWDTH - IntuiTextLength(&oTxt)) >> 1L;
   PrintIText(wRp,&oTxt,0L,0L);

   RefreshGadgets(&og1,wRq,(long)NL);
   for ( retval= NL, keepon=TRUE; keepon ; )
      {
      while ( ! (imes=(struct IntuiMessage *)GetMsg(wRq->UserPort)) )
      {
         if ( dir_flag )
            {
            i = (maxent-DENTS) * cc_prop.VertPot / MAXBODY;
            if ( i > (maxent-DENTS) )
            i = maxent-DENTS;
            if ( i <0 )   i = 0;
            curent = i;
            cxxx();
            dir_flag = FALSE;
            }
         if ( more )
            {
            if (pnam = (char *)dmore())   /* Continue to read the directory */
               notify(pnam);      /* Yucko error   */
            if ( maxent <= DENTS ) dir_flag = TRUE;
            }
         else    WaitPort(wRq->UserPort);
         }
      igad = (struct Gadget *)imes->IAddress;
      class = imes->Class;
      ReplyMsg(imes);

      switch (class)
         {
         case MOUSEMOVE:      dir_flag = TRUE;   break;
      
         case GADGETUP:
         case GADGETDOWN:
            switch ( i = igad->GadgetID)
            {
            case FGAD+6:
            case FGAD+7:
            case FGAD+8:
            case FGAD+9:
            case FGAD+10:       /* Replace file or directory name   */
               pnam = rname[i - (FGAD+6)].IText;
               if ( rname[igad->GadgetID - (FGAD+6)].NextText == NL )
                  {
                  RemoveGadget(wRq,&ogx);
                  for (i=0; i<DSIZE; i++)      ddef[i] = *pnam++;
                  AddGadget(wRq,&ogx,-1L);
                  RefreshGadgets(&ogx,wRq,(long)NL);
                  break;
                  }
                  else
                  {
                  RemoveGadget(wRq,&og5);
                  rfnam(ddir,pnam);
                  AddGadget(wRq,&og5,-1L);
                  RefreshGadgets(&og5,wRq,(long)NL);
                  }
            case FGAD+5:
               if ( pnam = (char *)dinit(ddir) )
                  notify(pnam);
            case FGAD+3:
               dir_flag = TRUE;
               break;

            case FGAD+11:      /* Name gadget, OTAY gadget   */
            case FGAD+1:
               retval = ddef;
            case FGAD+2:      /* Cancel gadget   */
               keepon = FALSE;
            }
         }
      }

      FreeMem(FirstEntry,(long)DBUFSIZ );
      FreeMem(dir_info,(long)sizeof(struct FileInfoBlock));
      free_pdir();

      CloseWindowSafely(wRq);
      return(retval);
   }

static free_pdir()
   {
   if ( pdir )
      {
      UnLock(pdir);
      pdir = NL;
      }
   }

/*****************************************************************
* dinit()
*   Initialize the fib for directory muck.  Null return
* is good, else return is a pointer to an error string      */

static char *dinit(subdir)
   char *subdir;
   {
   more = FALSE;
   curent = maxent = 0;

   NextEntry = FirstEntry;      /* Allocate from here   */
   ListHead.next = NL;          /* Clear the boogie     */

   free_pdir();   /* Unlock any old lock... */

   if (! (pdir=(struct FileLock *)Lock(subdir,(ULONG)ACCESS_READ)) )
      return("Wrong Diskette?");
   if ( ! Examine(pdir, dir_info) )   return("Wierd Disk Error");
   if ( dir_info->fib_DirEntryType < 0L )   return("Bizzare Alert!!");

   more = TRUE;
   return(dmore());
   }


static char *dmore()
   {
   FAST struct dirent   *p_D = NextEntry;
   FAST struct dirent   *ptr = (struct dirent *)&ListHead;
   FAST struct dirent   *plink;

   FAST   TEXT   *p_mung;

   FAST long    i;

   if ( ! more )   return(NL);

   if ( ExNext( pdir, dir_info ) )
      {


      if ( (ULONG)p_D >=
         ((ULONG)FirstEntry + (ULONG)DBUFSIZ - (ULONG)sizeof(struct dirent)) )
         {
         more = FALSE;
         return("Directory Truncated!");
         }


      /* Here you can add a file/directory filter   */
      /* filename text string is at &p_D->dE[0   */
      p_D->isfile = ( dir_info->fib_DirEntryType < 0L );

      p_mung = &p_D->dE[0];
      for ( i=0; i<FCHARS; i++)
         if ( ! (*p_mung++ = dir_info->fib_FileName[i]) )   break;

      i = (long)p_mung;
      NextEntry = (struct dirent *)( (i+5L) & ~3L );

      for ( i=maxent++; i>=0; i--)
         {
         if ( ! (plink = ptr->next)  )   break;
         if ( alpha_lower(p_D,plink) )   break;
         ptr = plink;
         }
      p_D->next = plink;
      ptr->next = p_D;

      return(NL);
      }
   else return ( IoErr() == ERROR_NO_MORE_ENTRIES) ?
       (char *)(more = (long)NL) : "Error Reading Directory!!!";
   }


/* dedicated alphabetizing function for dmore()   */

static alpha_lower(snew,sold)
   struct dirent *snew,*sold;
   {
   FAST struct dirent *pnew = snew;
   FAST TEXT *ps1,*ps2, c,d;

   if ( pnew->isfile == sold->isfile)
      {
      ps1 = &pnew->dE[0];
      ps2 = &sold->dE[0];
      while ( (c=*ps1++) )
         {
         if ( c > (d=*ps2++) )   return(FALSE);
         else if ( c < d )      break;
         }
      return(TRUE);
      }
   return(pnew->isfile);
   }   



/* Display directory stuff   */

static cxxx()
   {
   FAST long   i,new;
   FAST long   x,y;
   FAST struct dirent *ohboy = (struct dirent *)&ListHead;

   new = curent;
   for ( i=0; i<new; i++)   ohboy = ohboy->next;

   y = 20L;
   for (i=0; i<DENTS; i++)
      {
      y += (x=10);
      rname[i].NextText = NL;
      rname[i].IText = "";
      rname[i].LeftEdge = 0;
      if ( (new+i) < maxent )
         {
         ohboy = ohboy->next;
         rname[i].IText = &ohboy->dE[0];
         if ( ohboy->isfile )   PrintIText(wRp,&rname[i],10L,y);
         else
            {
            rname[i].LeftEdge = 48;
            PrintIText(wRp,&saydir,10L,y);
            PrintIText(wRp,&rname[i],10L,y);
            rname[i].NextText = &saydir;
            }
         x = wRp->cp_x;
         }
      if ( x < ZWDTH+10 )   RectFill(wRp,x,y,(long)(ZWDTH+10),(long)(y+8L));
      }
   }


/**************************************************
* rfnam()
*   Combines dir, plus name into dir   */

static rfnam(dir,fil_nam)
   char *dir,*fil_nam;
   {
   FAST char   *pdst = dir;
   FAST char   *psrc = fil_nam;
   FAST char   c = ':';

   while ( *pdst )
      c = *pdst++;
   if ( c != ':')   *pdst++ = '/';

   while ( *pdst++ = *psrc++ )
      ;
   }

static struct IntuiText b_txt = {0,1,JAM2, 5,20,NL,NL,    NL};
static struct IntuiText p_txt = {0,1,JAM2, 5,3,NL,"OK", NL};

/****************************************************************/
/* notify(txt)                     */
/*   Prompts for Yes/No response            */

static notify(txt)
   char *txt;
   {
   b_txt.IText = txt;
   AutoRequest(wRq,&b_txt,0L,&p_txt,0L,0L,
      (long)(IntuiTextLength(&b_txt)+50L),70L);
   }
//E*O*F getfile.c//

echo x - getfile.diffs
cat > "getfile.diffs" << '//E*O*F getfile.diffs//'
diff -c -w OGetFile/getfile.c GetFile/getfile.c
*** OGetFile/getfile.c	Tue May 19 01:45:05 1987
--- GetFile/getfile.c	Mon May 18 23:58:30 1987
***************
*** 161,170 ****
  /* Open a requester "Window" */
  
  static struct NewWindow NewFiles = {
!    160, 30, RWDTH,RHGHT, BCOL,FCOL, NL, /* Fill in AFTER opening ... */
     SMART_REFRESH | ACTIVATE | RMBTRAP | WINDOWDRAG,
     &og1,NL,NL, NL,
!    NL, RWDTH,RHGHT,RWDTH,RHGHT, WBENCHSCREEN };
  
  IMPORT struct Library	*IntuitionBase;
  
--- 161,170 ----
  /* Open a requester "Window" */
  
  static struct NewWindow NewFiles = {
!    0, 0, RWDTH,RHGHT, BCOL,FCOL, NL, /* Fill in AFTER opening ... */
     SMART_REFRESH | ACTIVATE | RMBTRAP | WINDOWDRAG,
     &og1,NL,NL, NL,
!    NL, RWDTH,RHGHT,RWDTH,RHGHT, CUSTOMSCREEN };
  
  IMPORT struct Library   *IntuitionBase;
  
***************
*** 223,234 ****
     if ( ! (FirstEntry = (struct dirent *)AllocMem((long)DBUFSIZ,0L)) ||
          ! (wRq = (struct Window *)OpenWindow( &NewFiles )) )
        {
        if ( FirstEntry )   FreeMem(FirstEntry,(long)DBUFSIZ);
        /* notify("Can't Open Requester..."); */
        FreeMem(dir_info,(long)sizeof(struct FileInfoBlock));
        return(NL);
        }
- 
     /* Set up directory, notify any errors...   */
     if ( pnam = (char *)dinit(ddir) )   notify(pnam);
  
--- 223,237 ----
     if ( ! (FirstEntry = (struct dirent *)AllocMem((long)DBUFSIZ,0L)) ||
          ! (wRq = (struct Window *)OpenWindow( &NewFiles )) )
        {
+       if (!FirstEntry)
+         notify("Can't Open first entry");
+       if (!wRq)
+         notify("Can't Open new window");
        if ( FirstEntry )   FreeMem(FirstEntry,(long)DBUFSIZ);
        /* notify("Can't Open Requester..."); */
        FreeMem(dir_info,(long)sizeof(struct FileInfoBlock));
        return(NL);
        }
     /* Set up directory, notify any errors...   */
     if ( pnam = (char *)dinit(ddir) )   notify(pnam);
  
//E*O*F getfile.diffs//

echo x - getfile.h
cat > "getfile.h" << '//E*O*F getfile.h//'
/***************************************************
*  get_fname(window,screen,hail,ddef,ddir);
*
*   Displays a window/requester that
* gets a file name for device,directory,default file, extension
*
*   Calling args:
* window:   Window making the request
* screen:   Screen, if NULL assummed workbench
* hail:   Text prompt at top of requester
* ddef:   Input default file-name. Has NO DIRECTORY OR EXTENSION.
* ddir:   Directory of file, may be null
*
*  The basic call is:
*
*   getfile(Window,Screen,Hailing_string,file_name,directory_name);
*
* Where:
*   Window is a pointer to your window
*   Screen is a pointer to your screen ... or (long)NULL if workbench
*   Hailing_string is a prompt displayed in the requester
*   file_name is a text array which will be altered by getfile,
*   it returns the file name.
*   directory_name is a text array altered by getfile, it
*   is the directory.
*
*   The return value is either a pointer to your buffer, file_name,
*   or NULL if the user selected CANCEL.
*
*   You must reserve two text areas for file and directory like so:
*
* #define FNAME_SIZE 33
* TEXT   file_name[FNAME_SIZE + 1];
* TEXT   dir_name[FNAME_SIZE + 2]
**********************************************************************/

#ifndef GET_FNAME

#define GET_FNAME

#define FNAME_SIZE 33

extern char *get_fname();

#endif

//E*O*F getfile.h//

echo x - safeclose.c
cat > "safeclose.c" << '//E*O*F safeclose.c//'
/* CloseWindowSafely()
*       This module should be used whenever you are sharing an IDCMP
* message port with more than one window.  Rather than calling CloseWindow(),
* you should use CloseWindowSafely().  This will keep Intuition from
* Guru Meditation, and thus is considered a good thing.  You should still
* use CloseWindow for the very last window you close.
*       The reason this is needed, is because Intuition will re-claim
* any outstanding messages for a window when the window is closed. But...
* it can't take them out of your message port. Thus, you will receive
* invalid messages and bad things will happen.  Very bad things.
*       This code is a slightly condensed version of the same routine
* written by Neil Katin of Amiga for the April '86 Commodore Developers
* Newsletter, Amiga Mail (tm).
*/

/*
#include <exec/types.h>
#include <exec/nodes.h>
#include <exec/lists.h>
#include <exec/ports.h>
#include <intuition/intuition.h>
#include <functions.h>
*/
#include "standard.h"

void CloseWindowSafely( p_wind )
   struct Window   *p_wind;
   {
   register struct IntuiMessage    *msg;
   register struct IntuiMessage    *succ;
   register struct Window          *win = p_wind;
   register struct MsgPort         *mp = (struct MsgPort *)win->UserPort;

   Forbid();

   msg = (struct IntuiMessage *)mp->mp_MsgList.lh_Head;

   while ( succ=(struct IntuiMessage *)msg->ExecMessage.mn_Node.ln_Succ )
      {
      if ( msg->IDCMPWindow == win )
         {
         Remove ( msg );
         ReplyMsg( msg );
         }
      msg = succ;
      }
   win->UserPort = NULL;
   ModifyIDCMP( win, 0L );
   Permit();
   CloseWindow( win );
   }


//E*O*F safeclose.c//

echo x - safeclose.h
cat > "safeclose.h" << '//E*O*F safeclose.h//'
/* CloseWindowSafely()
*       This module should be used whenever you are sharing an IDCMP
* message port with more than one window.  Rather than calling CloseWindow(),
* you should use CloseWindowSafely().  This will keep Intuition from
* Guru Meditation, and thus is considered a good thing.  You should still
* use CloseWindow for the very last window you close.
*       The reason this is needed, is because Intuition will re-claim
* any outstanding messages for a window when the window is closed. But...
* it can't take them out of your message port. Thus, you will receive
* invalid messages and bad things will happen.  Very bad things.
*       This code is a slightly condensed version of the same routine
* written by Neil Katin of Amiga for the April '86 Commodore Developers
* Newsletter, Amiga Mail (tm).
*/

#ifndef SAFECLOSE

#define SAFECLOSE


/* CloseWindowSafely(window), window is pointer to struct Window */

extern void CloseWindowSafely();

#endif

//E*O*F safeclose.h//

echo x - standard.h
cat > "standard.h" << '//E*O*F standard.h//'
#include <exec/types.h>
#include <exec/devices.h>
#include <intuition/intuition.h>

#include <libraries/dos.h>
#include <libraries/dosextens.h>
#ifdef MANX
#include <functions.h>
#endif
//E*O*F standard.h//

echo x - testing.c
cat > "testing.c" << '//E*O*F testing.c//'
#include <exec/types.h>
#include <intuition/intuition.h>

#include <libraries/dosextens.h>

#ifdef MANX
#include <functions.h>
#endif

#define I_REV   31
#define G_REV   31

#define	EWDTH	640
#define	EHGHT	198

#define	NL	NULL


struct IntuitionBase *IntuitionBase;
struct GfxBase  { int b; } *GfxBase;

struct NewScreen TS = {
	0,0,640,200,2,
	1,2,
	HIRES,	WBENCHSCREEN,
	0L, 0L, 0L
	};

/* Used to open a Window   */
struct NewWindow EdWindow = {
    0,2,EWDTH,EHGHT-2,		/* LeftEdge,TopEdge,Width,Height */
    1,2,			/* DetailPen,BlockPen	*/
    MENUPICK | NEWSIZE | REFRESHWINDOW | ACTIVEWINDOW |
	MOUSEBUTTONS | RAWKEY | MOUSEMOVE,
    WINDOWDRAG | WINDOWSIZING | SIMPLE_REFRESH | ACTIVATE | WINDOWDEPTH,
    NL,NL,"Window",		/* FirstGadget, CheckMark, Title  */
    NL,				/* Screen ( Null)	*/
    NL,				/* BitMap		*/
    150,45,32767,32767,		/* MinW, MinH, MaxW, MaxH */
    CUSTOMSCREEN };		/* Type			*/


main()
{
struct Window	*eW;
struct Screen	*eS;

struct Process	*OurTask;
struct Window	*old_pr_WindowPtr;

static char	def_name[50] = "Meps";
static char	def_dir[50] = "df1:";

    if ( ! (IntuitionBase = (struct IntuitionBase *)
	OpenLibrary("intuition.library",(long)I_REV)) ||
	! (GfxBase =(struct GfxBase *)OpenLibrary("graphics.library",(long)G_REV)) )
	{
	printf("Can't open libraries\n");
	exit(20);
	}

    if ( ! (eS = (struct Screen *)OpenScreen(&TS)) )
	{
	printf("Can't Open Screen!!!!!\n");
	exit(22);
	}

    EdWindow.Screen = eS;

    if ( ! (eW =(struct Window *)OpenWindow(&EdWindow)) )
	{
	CloseScreen(eS);
	printf("Can't open window...\n");
	exit(21);
	}

    /* CAUTION!!! KNOW ABOUT pr_WindowPtr before you use it!!! */

    OurTask = (struct Process *)FindTask(0L);
    old_pr_WindowPtr = OurTask->pr_WindowPtr;
    OurTask->pr_WindowPtr = eW;

    get_fname(eW,eS,"Nicht",def_name,def_dir);

    printf("File name is :%s\n",def_name);
    printf("Directory is :%s\n",def_dir);

    /* ALWAYS RESTORE pr_WindowPtr BEFORE CLOSING THE WINDOW!!! */
    OurTask->pr_WindowPtr = old_pr_WindowPtr;

    CloseWindow(eW);
    CloseScreen(eS);
    
    CloseLibrary(GfxBase);
    CloseLibrary(IntuitionBase);
}

//E*O*F testing.c//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
     18     74    477 Makefile
     32    214   1296 README
     10     67    413 README.1ST
    513   1878  15293 getfile.c
     56    234   1939 getfile.diffs
     46    197   1346 getfile.h
     53    229   1662 safeclose.c
     26    156    973 safeclose.h
      9     15    186 standard.h
     97    244   2140 testing.c
    860   3308  25725 total
!!!
wc  Makefile README README.1ST getfile.c getfile.diffs getfile.h safeclose.c safeclose.h standard.h testing.c | sed 's=[^ ]*/==' | diff -b $temp -
exit 0


-- 
UUCP:  orandy@amdahl.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

orandy@amdahl.UUCP (05/20/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# Makefile README SaveILBM.h iffw.c ilbmw.c packer.c saveilbm.c

echo x - Makefile
cat > "Makefile" << '//E*O*F Makefile//'
OBJ =           SaveILBM.o iffw.o ilbmw.o packer.o

ScreenSave :    $(OBJ)

SaveILBM.p :    SaveILBM.p
                cc +l SaveILBM.h +HSaveILBM.p

SaveILBM.o :    SaveILBM.c
                cc +l SaveILBM.c

iffw.o :        iffw.c
                cc +l iffw.c

ilbmw.o :       ilbmw.c
                cc +l ilbmw.c

packer.o :      packer.c
                cc +l packer.c
//E*O*F Makefile//

echo x - README
cat > "README" << '//E*O*F README//'




    This direstory to contains files from the Amiga Delevopers IFF
  sources disk. MandelVroom uses these sources to save ILBM pictures.
  These sources are from Fish Disk 64.

  The IFF directory should contain:

      SaveILBM.c - code written by Carolyn Scheppner and hacked by me
                   to save MandelVroom's screen as an ILBM.
      SaveILBM.h - include for SaveILBM.c

      packer.c   - from the Amiga Developers IFF disk
      ilbmw.c    - from the Amiga Developers IFF disk
      iffw.c     - from the Amiga Developers IFF disk

      iff        - a directory that contains the IFF disk include files

//E*O*F README//

echo x - SaveILBM.h
cat > "SaveILBM.h" << '//E*O*F SaveILBM.h//'
/***************************************************************************
*  SaveILBM.h --  Save front screen as ILBM file
*                   by Carolyn Scheppner  CBM  10/86
*
*                   modified by Kevin L. Clague for use in Mandelbrot
*
*     Using IFF rtns by J.Morrison and S.Shaw of Electronic Arts
*
***************************************************************************/

#include <exec/types.h>
#include <exec/memory.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <graphics/gfxbase.h>
#include <graphics/rastport.h>
#include <graphics/gfx.h>
#include <graphics/view.h>

#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <workbench/workbench.h>
#include <workbench/startup.h>

#include "iff/ilbm.h"


//E*O*F SaveILBM.h//

echo x - iffw.c
cat > "iffw.c" << '//E*O*F iffw.c//'
/*----------------------------------------------------------------------*
 * IFFW.C  Support routines for writing IFF-85 files.          1/23/86
 * (IFF is Interchange Format File.)
 *
 * By Jerry Morrison and Steve Shaw, Electronic Arts.
 * This software is in the public domain.
 *
 * This version for the Commodore-Amiga computer.
 *----------------------------------------------------------------------*/
#include "iff/iff.h"
#include "iff/gio.h"

/* ---------- IFF Writer -----------------------------------------------*/

/* A macro to test if a chunk size is definite, i.e. not szNotYetKnown.*/
#define Known(size)   ( (size) != szNotYetKnown )

/* Yet another weird macro to make the source code simpler...*/
#define IfIffp(expr)  {if (iffp == IFF_OKAY)  iffp = (expr);}

/* ---------- OpenWIFF -------------------------------------------------*/

IFFP OpenWIFF(file, new0, limit)  BPTR file; GroupContext *new0; LONG limit; {
    register GroupContext *new = new0;
    register IFFP iffp = IFF_OKAY;

    new->parent       = NULL;
    new->clientFrame  = NULL;
    new->file         = file;
    new->position     = 0;
    new->bound        = limit;
    new->ckHdr.ckID   = NULL_CHUNK;  /* indicates no current chunk */
    new->ckHdr.ckSize = new->bytesSoFar = 0;

    if (0 > Seek(file, 0, OFFSET_BEGINNING))    /* Go to start of the file.*/
        iffp = DOS_ERROR;
    else if ( Known(limit) && IS_ODD(limit) )
        iffp = CLIENT_ERROR;
    return(iffp);
    }

/* ---------- StartWGroup ----------------------------------------------*/
IFFP StartWGroup(parent, groupType, groupSize, subtype, new)
      GroupContext *parent, *new; ID groupType, subtype; LONG groupSize;  {
    register IFFP iffp;

    iffp = PutCkHdr(parent, groupType, groupSize);
    IfIffp( IFFWriteBytes(parent, (BYTE *)&subtype, sizeof(ID)) );
    IfIffp( OpenWGroup(parent, new) );
    return(iffp);
    }

/* ---------- OpenWGroup -----------------------------------------------*/
IFFP OpenWGroup(parent0, new0)  GroupContext *parent0, *new0; {
    register GroupContext *parent = parent0;
    register GroupContext *new    = new0;
    register LONG ckEnd;
    register IFFP iffp = IFF_OKAY;

    new->parent       = parent;
    new->clientFrame  = parent->clientFrame;
    new->file         = parent->file;
    new->position     = parent->position;
    new->bound        = parent->bound;
    new->ckHdr.ckID   = NULL_CHUNK;
    new->ckHdr.ckSize = new->bytesSoFar = 0;

    if ( Known(parent->ckHdr.ckSize) ) {
        ckEnd = new->position + ChunkMoreBytes(parent);
        if ( new->bound == szNotYetKnown || new->bound > ckEnd )
            new->bound = ckEnd;
        };

    if ( parent->ckHdr.ckID == NULL_CHUNK || /* not currently writing a chunk*/
         IS_ODD(new->position) ||
         (Known(new->bound) && IS_ODD(new->bound)) )
        iffp = CLIENT_ERROR;
    return(iffp);
    }

/* ---------- CloseWGroup ----------------------------------------------*/
IFFP CloseWGroup(old0)  GroupContext *old0; {
    register GroupContext *old = old0;
    IFFP iffp = IFF_OKAY;

    if ( old->ckHdr.ckID != NULL_CHUNK )  /* didn't close the last chunk */
        iffp = CLIENT_ERROR;
    else if ( old->parent == NULL ) {     /* top level file context */
        if (GWriteFlush(old->file) < 0)  iffp = DOS_ERROR;
        }
    else {                                /* update parent context */
        old->parent->bytesSoFar += old->position - old->parent->position;
        old->parent->position = old->position;
        };
    return(iffp);
    }

/* ---------- EndWGroup ------------------------------------------------*/
IFFP EndWGroup(old)  GroupContext *old;  {
    register GroupContext *parent = old->parent;
    register IFFP iffp;

    iffp = CloseWGroup(old);
    IfIffp( PutCkEnd(parent) );
    return(iffp);
    }

/* ---------- PutCk ----------------------------------------------------*/
IFFP PutCk(context, ckID, ckSize, data)
      GroupContext *context; ID ckID; LONG ckSize; BYTE *data; {
    register IFFP iffp = IFF_OKAY;

    if ( ckSize == szNotYetKnown )
        iffp = CLIENT_ERROR;
    IfIffp( PutCkHdr(context, ckID, ckSize) );
    IfIffp( IFFWriteBytes(context, data, ckSize) );
    IfIffp( PutCkEnd(context) );
    return(iffp);
    }

/* ---------- PutCkHdr -------------------------------------------------*/
IFFP PutCkHdr(context0, ckID, ckSize)
      GroupContext *context0;  ID ckID;  LONG ckSize; {
    register GroupContext *context = context0;
    LONG minPSize = sizeof(ChunkHeader); /* physical chunk >= minPSize bytes*/

    /* CLIENT_ERROR if we're already inside a chunk or asked to write
     * other than one FORM, LIST, or CAT at the top level of a file */
    /* Also, non-positive ID values are illegal and used for error codes.*/
    /* (We could check for other illegal IDs...)*/
    if ( context->ckHdr.ckID != NULL_CHUNK  ||  ckID <= 0 )
        return(CLIENT_ERROR);
    else if (context->parent == NULL)  {
        switch (ckID)  {
            case FORM:  case LIST:  case CAT:  break;
            default: return(CLIENT_ERROR);
            }
        if (context->position != 0)
            return(CLIENT_ERROR);
        }

    if ( Known(ckSize) ) {
        if ( ckSize < 0 )
            return(CLIENT_ERROR);
        minPSize += ckSize;
        };
    if ( Known(context->bound)  &&
         context->position + minPSize > context->bound )
        return(CLIENT_ERROR);

    context->ckHdr.ckID   = ckID;
    context->ckHdr.ckSize = ckSize;
    context->bytesSoFar   = 0;
    if (0 >
        GWrite(context->file, (BYTE *)&context->ckHdr, sizeof(ChunkHeader))
        )
        return(DOS_ERROR);
    context->position += sizeof(ChunkHeader);
    return(IFF_OKAY);
    }

/* ---------- IFFWriteBytes ---------------------------------------------*/
IFFP IFFWriteBytes(context0, data, nBytes)
      GroupContext *context0;  BYTE *data;  LONG nBytes; {
    register GroupContext *context = context0;

    if ( context->ckHdr.ckID == NULL_CHUNK  ||  /* not in a chunk */
         nBytes < 0  ||                         /* negative nBytes */
         (Known(context->bound)  &&             /* overflow context */
            context->position + nBytes > context->bound)  ||
         (Known(context->ckHdr.ckSize)  &&      /* overflow chunk */
            context->bytesSoFar + nBytes > context->ckHdr.ckSize) )
        return(CLIENT_ERROR);

    if (0 > GWrite(context->file, data, nBytes))
        return(DOS_ERROR);

    context->bytesSoFar += nBytes;
    context->position   += nBytes;
    return(IFF_OKAY);
    }

/* ---------- PutCkEnd -------------------------------------------------*/
IFFP PutCkEnd(context0)  GroupContext *context0; {
    register GroupContext *context = context0;
    WORD zero = 0;      /* padding source */

    if ( context->ckHdr.ckID == NULL_CHUNK )  /* not in a chunk */
        return(CLIENT_ERROR);

    if ( context->ckHdr.ckSize == szNotYetKnown ) {
        /* go back and set the chunk size to bytesSoFar */
        if ( 0 >
GSeek(context->file, -(context->bytesSoFar + sizeof(LONG)), OFFSET_CURRENT) ||
             0 >
GWrite(context->file, (BYTE *)&context->bytesSoFar, sizeof(LONG))  ||
             0 >
GSeek(context->file, context->bytesSoFar, OFFSET_CURRENT)  )
            return(DOS_ERROR);
        }
    else {  /* make sure the client wrote as many bytes as planned */
        if ( context->ckHdr.ckSize != context->bytesSoFar )
            return(CLIENT_ERROR);
        };

    /* Write a pad byte if needed to bring us up to an even boundary.
     * Since the context end must be even, and since we haven't
     * overwritten the context, if we're on an odd position there must
     * be room for a pad byte. */
    if ( IS_ODD(context->bytesSoFar) ) {
        if ( 0 > GWrite(context->file, (BYTE *)&zero, 1) )
            return(DOS_ERROR);
        context->position += 1;
        };

    context->ckHdr.ckID   = NULL_CHUNK;
    context->ckHdr.ckSize = context->bytesSoFar = 0;
    return(IFF_OKAY);
    }

//E*O*F iffw.c//

echo x - ilbmw.c
cat > "ilbmw.c" << '//E*O*F ilbmw.c//'
/*----------------------------------------------------------------------*
 * ILBMW.C  Support routines for writing ILBM files.            1/23/86
 * (IFF is Interchange Format File.)
 *
 * By Jerry Morrison and Steve Shaw, Electronic Arts.
 * This software is in the public domain.
 *
 * This version for the Commodore-Amiga computer.
 *----------------------------------------------------------------------*/
#include "iff/packer.h"
#include "iff/ilbm.h"

/*---------- InitBMHdr -------------------------------------------------*/
IFFP InitBMHdr(bmHdr0, bitmap, masking, compression, transparentColor,
            pageWidth, pageHeight)
        BitMapHeader *bmHdr0;  struct BitMap *bitmap;
        WORD masking;           /* Masking */
        WORD compression;       /* Compression */
        WORD transparentColor;  /* UWORD */
        WORD pageWidth, pageHeight;
    {
    register BitMapHeader *bmHdr = bmHdr0;
    register WORD rowBytes = bitmap->BytesPerRow;

    bmHdr->w = rowBytes << 3;
    bmHdr->h = bitmap->Rows;
    bmHdr->x = bmHdr->y = 0;    /* Default position is (0,0).*/
    bmHdr->nPlanes = bitmap->Depth;
    bmHdr->masking = masking;
    bmHdr->compression = compression;
    bmHdr->pad1 = 0;
    bmHdr->transparentColor = transparentColor;
    bmHdr->xAspect = bmHdr->yAspect = 1;
    bmHdr->pageWidth = pageWidth;
    bmHdr->pageHeight = pageHeight;

    if (pageWidth = 320)
        switch (pageHeight) {
            case 200: {bmHdr->xAspect = x320x200Aspect;
                       bmHdr->yAspect = y320x200Aspect; break;}
            case 400: {bmHdr->xAspect = x320x400Aspect;
                       bmHdr->yAspect = y320x400Aspect; break;}
            }
    else if (pageWidth = 640)
        switch (pageHeight) {
            case 200: {bmHdr->xAspect = x640x200Aspect;
                       bmHdr->yAspect = y640x200Aspect; break;}
            case 400: {bmHdr->xAspect = x640x400Aspect;
                       bmHdr->yAspect = y640x400Aspect; break;}
            }

    return( IS_ODD(rowBytes) ? CLIENT_ERROR : IFF_OKAY );
    }

/*---------- PutCMAP ---------------------------------------------------*/
IFFP PutCMAP(context, colorMap, depth)
      GroupContext *context;  WORD *colorMap;  UBYTE depth;
   {
   register LONG nColorRegs;
   IFFP iffp;
   ColorRegister colorReg;

   if (depth > MaxAmDepth)   depth = MaxAmDepth;
   nColorRegs = 1 << depth;

   iffp = PutCkHdr(context, ID_CMAP, nColorRegs * sizeofColorRegister);
   CheckIFFP();

   for ( ;  nColorRegs;  --nColorRegs)  {
      colorReg.red   = ( *colorMap >> 4 ) & 0xf0;
      colorReg.green = ( *colorMap      ) & 0xf0;
      colorReg.blue  = ( *colorMap << 4 ) & 0xf0;
      iffp = IFFWriteBytes(context, (BYTE *)&colorReg, sizeofColorRegister);
      CheckIFFP();
      ++colorMap;
      }

   iffp = PutCkEnd(context);
   return(iffp);
   }

/*---------- PutBODY ---------------------------------------------------*/
/* NOTE: This implementation could be a LOT faster if it used more of the
 * supplied buffer. It would make far fewer calls to IFFWriteBytes (and
 * therefore to DOS Write). */
IFFP PutBODY(context, bitmap, mask, bmHdr, buffer, bufsize)
      GroupContext *context;  struct BitMap *bitmap;  BYTE *mask;
      BitMapHeader *bmHdr;  BYTE *buffer;  LONG bufsize;
   {
   IFFP iffp;
   LONG rowBytes = bitmap->BytesPerRow;
   int dstDepth = bmHdr->nPlanes;
   Compression compression = bmHdr->compression;
   int planeCnt;                /* number of bit planes including mask */
   register int iPlane, iRow;
   register LONG packedRowBytes;
   BYTE *buf;
   BYTE *planes[MaxAmDepth + 1]; /* array of ptrs to planes & mask */

   if ( bufsize < MaxPackedSize(rowBytes)  ||   /* Must buffer a comprsd row*/
        compression > cmpByteRun1  ||           /* bad arg */
        bitmap->Rows != bmHdr->h   ||           /* inconsistent */
        rowBytes != RowBytes(bmHdr->w)  ||      /* inconsistent*/
        bitmap->Depth < dstDepth   ||           /* inconsistent */
        dstDepth > MaxAmDepth )                 /* too many for this routine*/
      return(CLIENT_ERROR);

   planeCnt = dstDepth + (mask == NULL ? 0 : 1);

   /* Copy the ptrs to bit & mask planes into local array "planes" */
   for (iPlane = 0; iPlane < dstDepth; iPlane++)
      planes[iPlane] = (BYTE *)bitmap->Planes[iPlane];
   if (mask != NULL)
      planes[dstDepth] = mask;

   /* Write out a BODY chunk header */
   iffp = PutCkHdr(context, ID_BODY, szNotYetKnown);
   CheckIFFP();

   /* Write out the BODY contents */
   for (iRow = bmHdr->h; iRow > 0; iRow--)  {
      for (iPlane = 0; iPlane < planeCnt; iPlane++)  {

         /* Write next row.*/
         if (compression == cmpNone) {
            iffp = IFFWriteBytes(context, planes[iPlane], rowBytes);
            planes[iPlane] += rowBytes;
            }

         /* Compress and write next row.*/
         else {
            buf = buffer;
            packedRowBytes = PackRow(&planes[iPlane], &buf, rowBytes);
            iffp = IFFWriteBytes(context, buffer, packedRowBytes);
            }

         CheckIFFP();
         }
      }

   /* Finish the chunk */
   iffp = PutCkEnd(context);
   return(iffp);
   }
//E*O*F ilbmw.c//

echo x - packer.c
cat > "packer.c" << '//E*O*F packer.c//'
/*----------------------------------------------------------------------*
 * packer.c Convert data to "cmpByteRun1" run compression.     11/15/85
 *
 * By Jerry Morrison and Steve Shaw, Electronic Arts.
 * This software is in the public domain.
 *
 *      control bytes:
 *       [0..127]   : followed by n+1 bytes of data.
 *       [-1..-127] : followed by byte to be repeated (-n)+1 times.
 *       -128       : NOOP.
 *
 * This version for the Commodore-Amiga computer.
 *----------------------------------------------------------------------*/
#include "iff/packer.h"

#define DUMP    0
#define RUN     1

#define MinRun 3
#define MaxRun 128
#define MaxDat 128

LONG putSize;
#define GetByte()       (*source++)
#define PutByte(c)      { *dest++ = (c);   ++putSize; }

char buf[256];  /* [TBD] should be 128?  on stack?*/

BYTE *PutDump(dest, nn)  BYTE *dest;  int nn; {
        int i;

        PutByte(nn-1);
        for(i = 0;  i < nn;  i++)   PutByte(buf[i]);
        return(dest);
        }

BYTE *PutRun(dest, nn, cc)   BYTE *dest;  int nn, cc; {
        PutByte(-(nn-1));
        PutByte(cc);
        return(dest);
        }

#define OutDump(nn)   dest = PutDump(dest, nn)
#define OutRun(nn,cc) dest = PutRun(dest, nn, cc)

/*----------- PackRow --------------------------------------------------*/
/* Given POINTERS TO POINTERS, packs one row, updating the source and
   destination pointers.  RETURNs count of packed bytes.*/
LONG PackRow(pSource, pDest, rowSize)
    BYTE **pSource, **pDest;   LONG rowSize; {
    BYTE *source, *dest;
    char c,lastc = '\0';
    BOOL mode = DUMP;
    short nbuf = 0;             /* number of chars in buffer */
    short rstart = 0;           /* buffer index current run starts */

    source = *pSource;
    dest = *pDest;
    putSize = 0;
    buf[0] = lastc = c = GetByte();  /* so have valid lastc */
    nbuf = 1;   rowSize--;      /* since one byte eaten.*/


    for (;  rowSize;  --rowSize) {
        buf[nbuf++] = c = GetByte();
        switch (mode) {
                case DUMP:
                        /* If the buffer is full, write the length byte,
                           then the data */
                        if (nbuf>MaxDat) {
                                OutDump(nbuf-1);
                                buf[0] = c;
                                nbuf = 1;   rstart = 0;
                                break;
                                }

                        if (c == lastc) {
                            if (nbuf-rstart >= MinRun) {
                                if (rstart > 0) OutDump(rstart);
                                mode = RUN;
                                }
                            else if (rstart == 0)
                                mode = RUN;     /* no dump in progress,
                                so can't lose by making these 2 a run.*/
                            }
                        else  rstart = nbuf-1;          /* first of run */
                        break;

                case RUN: if ( (c != lastc)|| ( nbuf-rstart > MaxRun)) {
                        /* output run */
                        OutRun(nbuf-1-rstart,lastc);
                        buf[0] = c;
                        nbuf = 1; rstart = 0;
                        mode = DUMP;
                        }
                        break;
                }

        lastc = c;
        }

    switch (mode) {
        case DUMP: OutDump(nbuf); break;
        case RUN: OutRun(nbuf-rstart,lastc); break;
        }
    *pSource = source;
    *pDest = dest;
    return(putSize);
    }

//E*O*F packer.c//

echo x - saveilbm.c
cat > "saveilbm.c" << '//E*O*F saveilbm.c//'
/***************************************************************************
*  SaveILBM.c --  Save screen as ILBM file
*
*                 Modified version of Carolyn Scheppner's ScreenSave program
*
*     Using IFF rtns by J.Morrison and S.Shaw of Electronic Arts
*
***************************************************************************/

#include "SaveILBM.h"

/* CAMG Stuff */
typedef struct {
   ULONG ViewModes;
   } CamgChunk;

#define PutCAMG(context, camg)  \
    PutCk(context, ID_CAMG, sizeof(CamgChunk),(BYTE *)camg)

#define bufSize 512

extern struct IntuitionBase *IntuitionBase;
extern struct Screen *screen;
extern struct Window *MandWind;

struct Screen   *frontScreen;

struct ViewPort *picViewPort;
struct BitMap   *picBitMap;
WORD            *picColorTable;
ULONG            picViewModes;

/**************************************************************************
 *
 *  Save the current screen as an ILBM file
 *
 *************************************************************************/
SaveILBM(FileName)
  char *FileName;
{
  LONG            file;
  IFFP            iffp = NO_FILE;

  int l;

  WindowToFront(MandWind);

  if (!(file = Open(FileName, MODE_NEWFILE))) {
    printf("Can't open file %s\n",FileName);
    return(0);
  }

  Write(file,"x",1);  /* 1.1 so Seek to beginning works ? */

  frontScreen  = screen;

  picViewPort =  &( frontScreen->ViewPort );
  picBitMap =     (struct BitMap*)picViewPort->RasInfo->BitMap;
  picColorTable = (WORD *)picViewPort->ColorMap->ColorTable;
  picViewModes =  (ULONG)picViewPort->Modes;

  iffp = PutPicture(file, picBitMap, picColorTable, picViewModes);
  Close(file);

  if (iffp == IFF_OKAY) {
    printf("Screen saved\n");
  }
  printf("Done\n");
} /* SaveILBM */


/** PutPicture() ***********************************************************
 *
 * Put a picture into an IFF file.
 * This procedure calls PutAnILBM, passing in an <x, y> location of <0, 0>,
 * a NULL mask, and a locally-allocated buffer. It also assumes you want to
 * write out all the bitplanes in the BitMap.
 *
 ***************************************************************************/
Point2D nullPoint = {0, 0};

IFFP PutPicture(file, bitmap, colorMap, viewmodes)
      LONG file;  struct BitMap *bitmap;
      WORD *colorMap;  ULONG viewmodes;
   {
   BYTE buffer[bufSize];
   return( PutAnILBM(file, bitmap, NULL,
           colorMap, bitmap->Depth, viewmodes,
           &nullPoint, buffer, bufSize) );
   }


/** PutAnILBM() ************************************************************
 *
 * Write an entire BitMap as a FORM ILBM in an IFF file.
 * This version works for any display mode (C. Scheppner).
 *
 * Normal return result is IFF_OKAY.
 *
 * The utility program IFFCheck would print the following outline of the
 * resulting file:
 *
 *   FORM ILBM
 *     BMHD
 *     CAMG
 *     CMAP
 *     BODY       (compressed)
 *
 ***************************************************************************/
#define CkErr(expression)  {if (ifferr == IFF_OKAY) ifferr = (expression);}

IFFP PutAnILBM(file, bitmap, mask, colorMap, depth,
                                viewmodes, xy, buffer, bufsize)
      LONG file;
      struct BitMap *bitmap;
      BYTE *mask;  WORD *colorMap; UBYTE depth;
      ULONG viewmodes;
      Point2D *xy; BYTE *buffer;  LONG bufsize;
   {
   BitMapHeader bmHdr;
   CamgChunk    camgChunk;
   GroupContext fileContext, formContext;
   IFFP ifferr;
   WORD pageWidth, pageHeight;

   pageWidth  = (bitmap->BytesPerRow) << 3;
   pageHeight = bitmap->Rows;

   ifferr = InitBMHdr(&bmHdr, bitmap, mskNone,
                      cmpByteRun1, 0, pageWidth, pageHeight);
   /* You could write an uncompressed image by passing cmpNone instead
    * of cmpByteRun1 to InitBMHdr. */
   bmHdr.nPlanes = depth;   /* This must be  <= bitmap->Depth */
   if (mask != NULL) bmHdr.masking = mskHasMask;
   bmHdr.x = xy->x;   bmHdr.y = xy->y;

   camgChunk.ViewModes = viewmodes;

   CkErr( OpenWIFF(file, &fileContext, szNotYetKnown) );
   CkErr(StartWGroup(&fileContext, FORM, szNotYetKnown, ID_ILBM, &formContext));

   CkErr( PutBMHD(&formContext, &bmHdr) );
   CkErr( PutCAMG(&formContext, &camgChunk) );
   CkErr( PutCMAP(&formContext, colorMap, depth) );
   CkErr( PutBODY(&formContext, bitmap, mask, &bmHdr, buffer, bufsize) );

   CkErr( EndWGroup(&formContext) );
   CkErr( CloseWGroup(&fileContext) );
   return( ifferr );
   }


//E*O*F saveilbm.c//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
     18     40    375 Makefile
     20     90    627 README
     27     67    781 SaveILBM.h
    220    879   8008 iffw.c
    144    573   5172 ilbmw.c
    110    400   3578 packer.c
    152    470   4420 saveilbm.c
    691   2519  22961 total
!!!
wc  Makefile README SaveILBM.h iffw.c ilbmw.c packer.c saveilbm.c | sed 's=[^ ]*/==' | diff -b $temp -
exit 0


-- 
UUCP:  orandy@amdahl.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

orandy@amdahl.UUCP (05/20/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# README compiler.h gio.h iff.h ilbm.h intuall.h packer.h putpict.h readpict.h remalloc.h

echo x - README
cat > "README" << '//E*O*F README//'




   This directory contains the include files off of Fish Disk 64.
   Fish Disk 64 contains the Amiga Developers IFF sources.




//E*O*F README//

echo x - compiler.h
cat > "compiler.h" << '//E*O*F compiler.h//'
#ifndef COMPILER_H
#define COMPILER_H
/*** compiler.h *********************************************************/
/*  Steve Shaw							1/29/86 */
/*  Portability file to handle compiler idiosyncrasies.			*/
/*  Version: Lattice 3.03 cross-compiler for the Amiga from the IBM PC. */
/*                                                                      */ 
/* This software is in the public domain.                               */ 
/*                                                                      */ 
/************************************************************************/

#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif


/* NOTE  --  NOTE  --  NOTE  --  NOTE  --  NOTE
 * Some C compilers can handle Function Declarations with Argument Types
 * (FDwAT) like this:
 *     extern LONG Seek(BPTR, LONG, LONG)
 * while others choke unless you just say
 *     extern LONG Seek()
 *
 * Comment out the #define FDwAT if you have a compiler that chokes. */



/* #define FDwAT 	COMMENTED OUT BECAUSE GREENHILLS CANT TAKE IT */


#endif COMPILER_H

//E*O*F compiler.h//

echo x - gio.h
cat > "gio.h" << '//E*O*F gio.h//'
#ifndef GIO_H
#define GIO_H
/*----------------------------------------------------------------------*/
/* GIO.H  defs for Generic I/O Speed Up Package.   	        1/23/86 */
/* See GIOCall.C for an example of usage.				*/
/* Read not speeded-up yet.  Only one Write file buffered at a time.	*/
/*									*/
/* Note: The speed-up provided is ONLY significant for code such as IFF */
/* which does numerous small Writes and Seeks.				*/
/*									*/
/* WARNING: If gio reports an error to you and you care what specific	*/
/* Dos error was, you must call IoErr() BEFORE calling any other gio	*/
/* functions.								*/
/*                                                                      */ 
/* By Jerry Morrison and Steve Shaw, Electronic Arts.                   */ 
/* This software is in the public domain.                               */ 
/*                                                                      */ 
/* This version for the Commodore-Amiga computer.                       */
/*                                                                      */ 
/*----------------------------------------------------------------------*/

/* Use this file interface in place of ALL Open,Close,Read,Write,Seek DOS
 * calls for an optional i/o speed-up via buffering.  You must use ONLY
 * these G routines for a file that is being buffered; e.g., call GClose
 * to Close the file, etc.
 * It is harmless though not necessary to use G routines for a file that
 * is not being buffered; e.g., GClose and Close are equivalent in that
 * case.
 * This Version only buffers one file at a time, and only for writing.
 * If you call GWriteDeclare for a second file before the first file
 * is GClosed, the first file becomes unbuffered.  This is harmless, no
 * data is lost, the first file is simply no longer speeded-up.
 */

/* Before compiling any modules that make G calls, or compiling gio.c,
 * you must set the GIO_ACTIVE flag below.
 *
 * To omit the speed-up code,
 *    #define GIO_ACTIVE 0
 *
 * To make the speed-up happen:
 * 1. #define GIO_ACTIVE 1
 * 2. link gio.o into your progrm
 * 3. GWriteDeclare(file, buffer, size)
 *    after GOpening the file and before doing
 *    any writing.
 * 4. ONLY use GRead, GWrite, GSeek, GClose -- do not use the DOS i/o
 *    routines directly.
 * 5. When done, do GClose.  Or to stop buffering without closing the
 *    file, do GWriteUndeclare(file).
 */
#define GIO_ACTIVE 0

#ifndef COMPILER_H
#include "iff/compiler.h"
#endif

#ifndef LIBRARIES_DOS_H
#include "libraries/dos.h"
#endif

#ifndef OFFSET_BEGINNING
#define OFFSET_BEGINNING OFFSET_BEGINING
#endif

#if GIO_ACTIVE

#ifdef FDwAT  /* Compiler handles Function Declaration with Argument Types */

/* Present for completeness in the interface.
 * "openmode" is either MODE_OLDFILE to read/write an existing file, or
 * MODE_NEWFILE to write a new file.
 * RETURNs a "file" pointer to a system-supplied structure that describes
 * the open file.  This pointer is passed in to the other routines below.*/
extern BPTR GOpen(char * /*filename*/, LONG /*openmode*/);

/* NOTE: Flushes & Frees the write buffer.
 * Returns -1 on error from Write.*/
extern LONG GClose(BPTR /*file*/);

/* Read not speeded-up yet.
 * GOpen the file, then do GReads to get successive chunks of data in
 * the file.  Assumes the system can handle any number of bytes in each
 * call, regardless of any block-structure of the device being read from.
 * When done, GClose to free any system resources associated with an
 * open file.*/
extern LONG GRead(BPTR /*file*/, BYTE * /*buffer*/, LONG /*nBytes*/);

/* Writes out any data in write buffer for file.
 * NOTE WHEN have Seeked into middle of buffer:
 * GWriteFlush causes current position to be the end of the data written.
 * -1 on error from Write.*/
extern LONG GWriteFlush(BPTR /*file*/);

/* Sets up variables to describe a write buffer for the file.*/
/* If the buffer already has data in it from an outstanding GWriteDeclare,
 * then that buffer must first be flushed.
 * RETURN -1 on error from Write for that previous buffer flush.
 * See also "GWriteUndeclare".*/
extern LONG GWriteDeclare(BPTR /*file*/, BYTE * /*buffer*/, LONG /*nBytes*/);

/* ANY PROGRAM WHICH USES "GWrite" MUST USE "GSeek" rather than "Seek"
 * TO SEEK ON A FILE BEING WRITTEN WITH "GWrite".
 * "Write" with Generic speed-up.
 * -1 on error from Write.  else returns # bytes written to disk.
 * Call GOpen, then do successive GWrites with GSeeks if required,
 * then GClose when done.  (IFF does require GSeek.)*/
extern LONG GWrite(BPTR /*file*/, BYTE * /*buffer*/, LONG /*nBytes*/);

/* "Seek" with Generic speed-up, for a file being written with GWrite.*/
/* Returns what Seek returns, which appears to be the position BEFORE
 * seeking, though the documentation says it returns the NEW position.
 * In fact, the code now explicitly returns the OLD position when
 * seeking within the buffer.
 * Eventually, will support two independent files, one being read, the
 * other being written.  Or could support even more.  Designed so is safe
 * to call even for files which aren't being buffered.*/
extern LONG GSeek(BPTR /*file*/, LONG /*position*/, LONG /*mode*/);

#else /*not FDwAT*/

extern BPTR GOpen();
extern LONG GClose();
extern LONG GRead();
extern LONG GWriteFlush();
extern LONG GWriteDeclare();
extern LONG GWrite();
extern LONG GSeek();

#endif FDwAT

#else /* not GIO_ACTIVE */

#define GOpen(filename, openmode)    	    Open(filename, openmode)
#define GClose(file)  			    Close(file)
#define GRead(file, buffer, nBytes)	    Read(file, buffer, nBytes)
#define GWriteFlush(file)		    (0)
#define GWriteDeclare(file, buffer, nBytes) (0)
#define GWrite(file, buffer, nBytes)	    Write(file, buffer, nBytes)
#define GSeek(file, position, mode)	    Seek(file, position, mode)

#endif GIO_ACTIVE


/* Release the buffer for that file, flushing it to disk if it has any
 * contents.  GWriteUndeclare(NULL) to release ALL buffers.
 * Currently, only one file can be buffered at a time anyway.*/
#define GWriteUndeclare(file)  GWriteDeclare(file, NULL, 0)


#endif
//E*O*F gio.h//

echo x - iff.h
cat > "iff.h" << '//E*O*F iff.h//'
#ifndef IFF_H
#define IFF_H
/*----------------------------------------------------------------------*/
/* IFF.H  defs for IFF-85 Interchange Format Files.	        1/22/86 */
/*									*/
/* By Jerry Morrison and Steve Shaw, Electronic Arts.			*/
/* This software is in the public domain.				*/
/*----------------------------------------------------------------------*/

#ifndef COMPILER_H
#include "iff/compiler.h"
#endif

#ifndef LIBRARIES_DOS_H
#include "libraries/dos.h"
#endif

#ifndef OFFSET_BEGINNING
#define OFFSET_BEGINNING OFFSET_BEGINING
#endif

typedef LONG IFFP;	/* Status code result from an IFF procedure */
	/* LONG, because must be type compatable with ID for GetChunkHdr.*/
	/* Note that the error codes below are not legal IDs.*/
#define IFF_OKAY   0L	/* Keep going...*/
#define END_MARK  -1L	/* As if there was a chunk at end of group.*/
#define IFF_DONE  -2L	/* clientProc returns this when it has READ enough.
			 * It means return thru all levels. File is Okay.*/
#define DOS_ERROR -3L
#define NOT_IFF   -4L	/* not an IFF file.*/
#define NO_FILE   -5L	/* Tried to open file, DOS didn't find it.*/
#define CLIENT_ERROR -6L /* Client made invalid request, for instance, write
			 * a negative size chunk.*/
#define BAD_FORM  -7L	/* A client read proc complains about FORM semantics;
			 * e.g. valid IFF, but missing a required chunk.*/
#define SHORT_CHUNK -8L	/* Client asked to IFFReadBytes more bytes than left
			 * in the chunk. Could be client bug or bad form.*/
#define BAD_IFF   -9L	/* mal-formed IFF file. [TBD] Expand this into a
			 * range of error codes.*/
#define LAST_ERROR BAD_IFF

/* This MACRO is used to RETURN immediately when a termination condition is
 * found. This is a pretty weird macro. It requires the caller to declare a
 * local "IFFP iffp" and assign it. This wouldn't work as a subroutine since
 * it returns for it's caller. */
#define CheckIFFP()   { if (iffp != IFF_OKAY) return(iffp); }


/* ---------- ID -------------------------------------------------------*/

typedef LONG ID;	/* An ID is four printable ASCII chars but
			 * stored as a LONG for efficient copy & compare.*/

/* Four-character IDentifier builder.*/
#define MakeID(a,b,c,d)  ( (LONG)(a)<<24L | (LONG)(b)<<16L | (c)<<8 | (d) )

/* Standard group IDs.  A chunk with one of these IDs contains a
   SubTypeID followed by zero or more chunks.*/
#define FORM MakeID('F','O','R','M')
#define PROP MakeID('P','R','O','P')
#define LIST MakeID('L','I','S','T')
#define CAT  MakeID('C','A','T',' ')
#define FILLER MakeID(' ',' ',' ',' ')
/* The IDs "FOR1".."FOR9", "LIS1".."LIS9", & "CAT1".."CAT9" are reserved
 * for future standardization.*/

/* Pseudo-ID used internally by chunk reader and writer.*/
#define NULL_CHUNK 0L	       /* No current chunk.*/


/* ---------- Chunk ----------------------------------------------------*/

/* All chunks start with a type ID and a count of the data bytes that 
   follow--the chunk's "logicl size" or "data size". If that number is odd,
   a 0 pad byte is written, too. */
typedef struct {
    ID	  ckID;
    LONG  ckSize;
    } ChunkHeader;

typedef struct {
    ID	  ckID;
    LONG  ckSize;
    UBYTE ckData[ 1 /*REALLY: ckSize*/ ];
    } Chunk;

/* Pass ckSize = szNotYetKnown to the writer to mean "compute the size".*/
#define szNotYetKnown 0x80000001L

/* Need to know whether a value is odd so can word-align.*/
#define IS_ODD(a)   ((a) & 1)

/* This macro rounds up to an even number. */
#define WordAlign(size)   ((size+1)&~1)

/* ALL CHUNKS MUST BE PADDED TO EVEN NUMBER OF BYTES.
 * ChunkPSize computes the total "physical size" of a padded chunk from
 * its "data size" or "logical size". */
#define ChunkPSize(dataSize)  (WordAlign(dataSize) + sizeof(ChunkHeader))

/* The Grouping chunks (LIST, FORM, PROP, & CAT) contain concatenations of
 * chunks after a subtype ID that identifies the content chunks.
 * "FORM type XXXX", "LIST of FORM type XXXX", "PROPerties associated
 * with FORM type XXXX", or "conCATenation of XXXX".*/
typedef struct {
    ID	  ckID;
    LONG  ckSize;	/* this ckSize includes "grpSubID".*/
    ID    grpSubID;
    } GroupHeader;

typedef struct {
    ID	  ckID;
    LONG  ckSize;
    ID    grpSubID;
    UBYTE grpData[ 1 /*REALLY: ckSize-sizeof(grpSubID)*/ ];
    } GroupChunk;


/* ---------- IFF Reader -----------------------------------------------*/

/******** Routines to support a stream-oriented IFF file reader *******
 *
 * These routines handle lots of details like error checking and skipping
 * over padding. They're also careful not to read past any containing context.
 *
 * These routines ASSUME they're the only ones reading from the file.
 * Client should check IFFP error codes. Don't press on after an error!
 * These routines try to have no side effects in the error case, except
 * partial I/O is sometimes unavoidable.
 *
 * All of these routines may return DOS_ERROR. In that case, ask DOS for the
 * specific error code.
 *
 * The overall scheme for the low level chunk reader is to open a "group read
 * context" with OpenRIFF or OpenRGroup, read the chunks with GetChunkHdr
 * (and its kin) and IFFReadBytes, and close the context with CloseRGroup.
 *
 * The overall scheme for reading an IFF file is to use ReadIFF, ReadIList,
 * and ReadICat to scan the file. See those procedures, ClientProc (below),
 * and the skeleton IFF reader. */

/* Client passes ptrs to procedures of this type to ReadIFF which call them
 * back to handle LISTs, FORMs, CATs, and PROPs.
 *
 * Use the GroupContext ptr when calling reader routines like GetChunkHdr.
 * Look inside the GroupContext ptr for your ClientFrame ptr. You'll
 * want to type cast it into a ptr to your containing struct to get your
 * private contextual data (stacked property settings). See below. */
#ifdef FDwAT
typedef IFFP ClientProc(struct _GroupContext *);
#else
typedef IFFP ClientProc();
#endif

/* Client's context for reading an IFF file or a group.
 * Client should actually make this the first component of a larger struct
 * (it's personal stack "frame") that has a field to store each "interesting"
 * property encountered.
 * Either initialize each such field to a global default or keep a boolean
 * indicating if you've read a property chunk into that field.
 * Your getList and getForm procs should allocate a new "frame" and copy the
 * parent frame's contents. The getProp procedure should store into the frame
 * allocated by getList for the containing LIST. */
typedef struct _ClientFrame {
   ClientProc *getList, *getProp, *getForm, *getCat;
    /* client's own data follows; place to stack property settings */
    } ClientFrame;

/* Our context for reading a group chunk. */
typedef struct _GroupContext {
    struct _GroupContext *parent; /* Containing group; NULL => whole file. */
    ClientFrame *clientFrame;     /* Reader data & client's context state. */
    BPTR file;		/* Byte-stream file handle. */
    LONG position;	/* The context's logical file position. */
    LONG bound;		/* File-absolute context bound
			 * or szNotYetKnown (writer only). */
    ChunkHeader ckHdr;	/* Current chunk header. ckHdr.ckSize = szNotYetKnown
			 * means we need to go back and set the size (writer only).
			 * See also Pseudo-IDs, above. */
    ID subtype;		/* Group's subtype ID when reading. */
    LONG bytesSoFar;	/* # bytes read/written of current chunk's data. */
    } GroupContext;

/* Computes the number of bytes not yet read from the current chunk, given
 * a group read context gc. */
#define ChunkMoreBytes(gc)  ((gc)->ckHdr.ckSize - (gc)->bytesSoFar)


/***** Low Level IFF Chunk Reader *****/

#ifdef FDwAT

/* Given an open file, open a read context spanning the whole file.
 * This is normally only called by ReadIFF.
 * This sets new->clientFrame = clientFrame.
 * ASSUME context allocated by caller but not initialized.
 * ASSUME caller doesn't deallocate the context before calling CloseRGroup.
 * NOT_IFF ERROR if the file is too short for even a chunk header.*/
extern IFFP OpenRIFF(BPTR, GroupContext *, ClientFrame *);
	         /*  file, new,            clientFrame  */

/* Open the remainder of the current chunk as a group read context.
 * This will be called just after the group's subtype ID has been read
 * (automatically by GetChunkHdr for LIST, FORM, PROP, and CAT) so the
 * remainder is a sequence of chunks.
 * This sets new->clientFrame = parent->clientFrame. The caller should repoint
 * it at a new clientFrame if opening a LIST context so it'll have a "stack
 * frame" to store PROPs for the LIST. (It's usually convenient to also
 * allocate a new Frame when you encounter FORM of the right type.)
 *
 * ASSUME new context allocated by caller but not initialized.
 * ASSUME caller doesn't deallocate the context or access the parent context
 * before calling CloseRGroup.
 * BAD_IFF ERROR if context end is odd or extends past parent. */
extern IFFP OpenRGroup(GroupContext *, GroupContext *);
		   /*  parent,         new  */

/* Close a group read context, updating its parent context.
 * After calling this, the old context may be deallocated and the parent
 * context can be accessed again. It's okay to call this particular procedure
 * after an error has occurred reading the group.
 * This always returns IFF_OKAY. */
extern IFFP CloseRGroup(GroupContext *);
		    /*  old  */

/* Skip any remaining bytes of the previous chunk and any padding, then
 * read the next chunk header into context.ckHdr.
 * If the ckID is LIST, FORM, CAT, or PROP, this automatically reads the
 * subtype ID into context->subtype.
 * Caller should dispatch on ckID (and subtype) to an appropriate handler.
 *
 * RETURNS context.ckHdr.ckID (the ID of the new chunk header); END_MARK
 * if there are no more chunks in this context; or NOT_IFF if the top level
 * file chunk isn't a FORM, LIST, or CAT; or BAD_IFF if malformed chunk, e.g.
 * ckSize is negative or too big for containing context, ckID isn't positive,
 * or we hit end-of-file.
 *
 * See also GetFChunkHdr, GetF1ChunkHdr, and GetPChunkHdr, below.*/
extern ID       GetChunkHdr(GroupContext *);
  /*  context.ckHdr.ckID    context  */

/* Read nBytes number of data bytes of current chunk. (Use OpenGroup, etc.
 * instead to read the contents of a group chunk.) You can call this several
 * times to read the data piecemeal.
 * CLIENT_ERROR if nBytes < 0. SHORT_CHUNK if nBytes > ChunkMoreBytes(context)
 * which could be due to a client bug or a chunk that's shorter than it
 * ought to be (bad form). (on either CLIENT_ERROR or SHORT_CHUNK,
 * IFFReadBytes won't read any bytes.) */
extern IFFP IFFReadBytes(GroupContext *, BYTE *, LONG);
		     /*  context,        buffer, nBytes  */


/***** IFF File Reader *****/

/* This is a noop ClientProc that you can use for a getList, getForm, getProp,
 * or getCat procedure that just skips the group. A simple reader might just
 * implement getForm, store ReadICat in the getCat field of clientFrame, and
 * use SkipGroup for the getList and getProp procs.*/
extern IFFP SkipGroup(GroupContext *);

/* IFF file reader.
 * Given an open file, allocate a group context and use it to read the FORM,
 * LIST, or CAT and it's contents. The idea is to parse the file's contents,
 * and for each FORM, LIST, CAT, or PROP encountered, call the getForm,
 * getList, getCat, or getProp procedure in clientFrame, passing the
 * GroupContext ptr.
 * This is achieved with the aid of ReadIList (which your getList should
 * call) and ReadICat (which your getCat should call, if you don't just use
 * ReadICat for your getCat). If you want to handle FORMs, LISTs, and CATs
 * nested within FORMs, the getForm procedure must dispatch to getForm,
 * getList, and getCat (it can use GetF1ChunkHdr to make this easy).
 *
 * Normal return is IFF_OKAY (if whole file scanned) or IFF_DONE (if a client
 * proc said "done" first).
 * See the skeletal getList, getForm, getCat, and getProp procedures. */
extern IFFP ReadIFF(BPTR, ClientFrame *);
                /*  file, clientFrame  */

/* IFF LIST reader.
 * Your "getList" procedure should allocate a ClientFrame, copy the parent's
 * ClientFrame, and then call this procedure to do all the work.
 *
 * Normal return is IFF_OKAY (if whole LIST scanned) or IFF_DONE (if a client
 * proc said "done" first).
 * BAD_IFF ERROR if a PROP appears after a non-PROP. */
extern IFFP ReadIList(GroupContext *, ClientFrame *);
		  /*  parent,         clientFrame  */

/* IFF CAT reader.
 * Most clients can simply use this to read their CATs. If you must do extra
 * setup work, put a ptr to your getCat procedure in the clientFrame, and
 * have that procedure call ReadICat to do the detail work.
 *
 * Normal return is IFF_OKAY (if whole CAT scanned) or IFF_DONE (if a client
 * proc said "done" first).
 * BAD_IFF ERROR if a PROP appears in the CAT. */
extern IFFP ReadICat(GroupContext *);
		 /*  parent  */

/* Call GetFChunkHdr instead of GetChunkHdr to read each chunk inside a FORM.
 * It just calls GetChunkHdr and returns BAD_IFF if it gets a PROP chunk. */
extern ID	GetFChunkHdr(GroupContext *);
  /*  context.ckHdr.ckID    context  */

/* GetF1ChunkHdr is like GetFChunkHdr, but it automatically dispatches to the
 * getForm, getList, and getCat procedure (and returns the result) if it
 * encounters a FORM, LIST, or CAT. */
extern ID	GetF1ChunkHdr(GroupContext *);
  /*  context.ckHdr.ckID    context  */

/* Call GetPChunkHdr instead of GetChunkHdr to read each chunk inside a PROP.
 * It just calls GetChunkHdr and returns BAD_IFF if it gets a group chunk. */
extern ID	GetPChunkHdr(GroupContext *);
  /*  context.ckHdr.ckID    context  */

#else /* not FDwAT */

extern IFFP OpenRIFF();
extern IFFP OpenRGroup();
extern IFFP CloseRGroup();
extern ID   GetChunkHdr();
extern IFFP IFFReadBytes();
extern IFFP SkipGroup();
extern IFFP ReadIFF();
extern IFFP ReadIList();
extern IFFP ReadICat();
extern ID   GetFChunkHdr();
extern ID   GetF1ChunkHdr();
extern ID   GetPChunkHdr();

#endif /* not FDwAT */

/* ---------- IFF Writer -----------------------------------------------*/

/******* Routines to support a stream-oriented IFF file writer *******
 *
 * These routines will random access back to set a chunk size value when the
 * caller doesn't know it ahead of time. They'll also do things automatically
 * like padding and error checking.
 *
 * These routines ASSUME they're the only ones writing to the file.
 * Client should check IFFP error codes. Don't press on after an error!
 * These routines try to have no side effects in the error case, except that
 * partial I/O is sometimes unavoidable.
 *
 * All of these routines may return DOS_ERROR. In that case, ask DOS for the
 * specific error code.
 *
 * The overall scheme is to open an output GroupContext via OpenWIFF or
 * OpenWGroup, call either PutCk or {PutCkHdr {IFFWriteBytes}* PutCkEnd} for
 * each chunk, then use CloseWGroup to close the GroupContext.
 *
 * To write a group (LIST, FORM, PROP, or CAT), call StartWGroup, write out
 * its chunks, then call EndWGroup. StartWGroup automatically writes the
 * group header and opens a nested context for writing the contents.
 * EndWGroup closes the nested context and completes the group chunk. */


#ifdef FDwAT

/* Given a file open for output, open a write context.
 * The "limit" arg imposes a fence or upper limit on the logical file
 * position for writing data in this context. Pass in szNotYetKnown to be
 * bounded only by disk capacity.
 * ASSUME new context structure allocated by caller but not initialized.
 * ASSUME caller doesn't deallocate the context before calling CloseWGroup.
 * The caller is only allowed to write out one FORM, LIST, or CAT in this top
 * level context (see StartWGroup and PutCkHdr).
 * CLIENT_ERROR if limit is odd.*/
extern IFFP OpenWIFF(BPTR, GroupContext *, LONG);
		 /*  file, new,            limit {file position}  */

/* Start writing a group (presumably LIST, FORM, PROP, or CAT), opening a
 * nested context. The groupSize includes all nested chunks + the subtype ID.
 *
 * The subtype of a LIST or CAT is a hint at the contents' FORM type(s). Pass
 * in FILLER if it's a mixture of different kinds.
 *
 * This writes the chunk header via PutCkHdr, writes the subtype ID via
 * IFFWriteBytes, and calls OpenWGroup. The caller may then write the nested
 * chunks and finish by calling EndWGroup.
 * The OpenWGroup call sets new->clientFrame = parent->clientFrame.
 *
 * ASSUME new context structure allocated by caller but not initialized.
 * ASSUME caller doesn't deallocate the context or access the parent context
 * before calling CloseWGroup.
 * ERROR conditions: See PutCkHdr, IFFWriteBytes, OpenWGroup. */
extern IFFP StartWGroup(GroupContext *, ID, LONG, ID, GroupContext *);
		    /*  parent, groupType, groupSize, subtype, new  */

/* End a group started by StartWGroup.
 * This just calls CloseWGroup and PutCkEnd.
 * ERROR conditions: See CloseWGroup and PutCkEnd. */
extern IFFP EndWGroup(GroupContext *);
		    /*  old  */

/* Open the remainder of the current chunk as a group write context.
 * This is normally only called by StartWGroup.
 *
 * Any fixed limit to this group chunk or a containing context will impose
 * a limit on the new context.
 * This will be called just after the group's subtype ID has been written
 * so the remaining contents will be a sequence of chunks.
 * This sets new->clientFrame = parent->clientFrame.
 * ASSUME new context structure allocated by caller but not initialized.
 * ASSUME caller doesn't deallocate the context or access the parent context
 * before calling CloseWGroup.
 * CLIENT_ERROR if context end is odd or PutCkHdr wasn't called first. */
extern IFFP OpenWGroup(GroupContext *, GroupContext *);
		   /*  parent,         new  */

/* Close a write context and update its parent context.
 * This is normally only called by EndWGroup.
 *
 * If this is a top level context (created by OpenWIFF) we'll set the file's
 * EOF (end of file) but won't close the file.
 * After calling this, the old context may be deallocated and the parent
 * context can be accessed again.
 *
 * Amiga DOS Note: There's no call to set the EOF. We just position to the
 * desired end and return. Caller must Close file at that position.
 * CLIENT_ERROR if PutCkEnd wasn't called first. */
extern IFFP CloseWGroup(GroupContext *);
		    /*  old  */

/* Write a whole chunk to a GroupContext. This writes a chunk header, ckSize
 * data bytes, and (if needed) a pad byte. It also updates the GroupContext.
 * CLIENT_ERROR if ckSize == szNotYetKnown. See also PutCkHdr errors. */
extern IFFP PutCk(GroupContext *, ID,   LONG,   BYTE *);
	      /*  context,        ckID, ckSize, *data  */

/* Write just a chunk header. Follow this will any number of calls to
 * IFFWriteBytes and finish with PutCkEnd.
 * If you don't yet know how big the chunk is, pass in ckSize = szNotYetKnown,
 * then PutCkEnd will set the ckSize for you later.
 * Otherwise, IFFWriteBytes and PutCkEnd will ensure that the specified
 * number of bytes get written.
 * CLIENT_ERROR if the chunk would overflow the GroupContext's bound, if
 * PutCkHdr was previously called without a matching PutCkEnd, if ckSize < 0
 * (except szNotYetKnown), if you're trying to write something other
 * than one FORM, LIST, or CAT in a top level (file level) context, or
 * if ckID <= 0 (these illegal ID values are used for error codes). */
extern IFFP PutCkHdr(GroupContext *, ID,   LONG);
		 /*  context,        ckID, ckSize  */

/* Write nBytes number of data bytes for the current chunk and update
 * GroupContext.
 * CLIENT_ERROR if this would overflow the GroupContext's limit or the
 * current chunk's ckSize, or if PutCkHdr wasn't called first, or if
 * nBytes < 0. */
extern IFFP IFFWriteBytes(GroupContext *, BYTE *, LONG);
		      /*  context,        *data,  nBytes  */

/* Complete the current chunk, write a pad byte if needed, and update
 * GroupContext.
 * If current chunk's ckSize = szNotYetKnown, this goes back and sets the
 * ckSize in the file.
 * CLIENT_ERROR if PutCkHdr wasn't called first, or if client hasn't
 * written 'ckSize' number of bytes with IFFWriteBytes. */
extern IFFP PutCkEnd(GroupContext *);
		 /*  context  */

#else /* not FDwAT */

extern IFFP OpenWIFF();
extern IFFP StartWGroup();
extern IFFP EndWGroup();
extern IFFP OpenWGroup();
extern IFFP CloseWGroup();
extern IFFP PutCk();
extern IFFP PutCkHdr();
extern IFFP IFFWriteBytes();
extern IFFP PutCkEnd();

#endif /* not FDwAT */

#endif IFF_H

//E*O*F iff.h//

echo x - ilbm.h
cat > "ilbm.h" << '//E*O*F ilbm.h//'
#ifndef ILBM_H
#define ILBM_H
/*----------------------------------------------------------------------*
 * ILBM.H  Definitions for InterLeaved BitMap raster image.     1/23/86
 *
 * By Jerry Morrison and Steve Shaw, Electronic Arts.
 * This software is in the public domain.
 *
 * This version for the Commodore-Amiga computer.
 *----------------------------------------------------------------------*/
#ifndef COMPILER_H
/* #include "iff/compiler.h" */
#endif

#ifndef GRAPHICS_GFX_H
#include "graphics/gfx.h"
#endif

#include "iff/iff.h"

#define ID_ILBM MakeID('I','L','B','M')
#define ID_BMHD MakeID('B','M','H','D')
#define ID_CMAP MakeID('C','M','A','P')
#define ID_GRAB MakeID('G','R','A','B')
#define ID_DEST MakeID('D','E','S','T')
#define ID_SPRT MakeID('S','P','R','T')
#define ID_CAMG MakeID('C','A','M','G')
#define ID_BODY MakeID('B','O','D','Y')

/* ---------- BitMapHeader ---------------------------------------------*/

typedef UBYTE Masking;          /* Choice of masking technique.*/
#define mskNone                 0
#define mskHasMask              1
#define mskHasTransparentColor  2
#define mskLasso                3

typedef UBYTE Compression;      /* Choice of compression algorithm applied to
     * each row of the source and mask planes. "cmpByteRun1" is the byte run
     * encoding generated by Mac's PackBits. See Packer.h . */
#define cmpNone      0
#define cmpByteRun1  1

/* Aspect ratios: The proper fraction xAspect/yAspect represents the pixel
 * aspect ratio pixel_width/pixel_height.
 *
 * For the 4 Amiga display modes:
 *   320 x 200: 10/11  (these pixels are taller than they are wide)
 *   320 x 400: 20/11
 *   640 x 200:  5/11
 *   640 x 400: 10/11           */
#define x320x200Aspect 10
#define y320x200Aspect 11
#define x320x400Aspect 20
#define y320x400Aspect 11
#define x640x200Aspect  5
#define y640x200Aspect 11
#define x640x400Aspect 10
#define y640x400Aspect 11

/* A BitMapHeader is stored in a BMHD chunk. */
typedef struct {
    UWORD w, h;                 /* raster width & height in pixels */
    WORD  x, y;                 /* position for this image */
    UBYTE nPlanes;              /* # source bitplanes */
    Masking masking;            /* masking technique */
    Compression compression;    /* compression algoithm */
    UBYTE pad1;                 /* UNUSED.  For consistency, put 0 here.*/
    UWORD transparentColor;     /* transparent "color number" */
    UBYTE xAspect, yAspect;     /* aspect ratio, a rational number x/y */
    WORD  pageWidth, pageHeight;  /* source "page" size in pixels */
    } BitMapHeader;

/* RowBytes computes the number of bytes in a row, from the width in pixels.*/
#define RowBytes(w)   (((w) + 15) >> 4 << 1)


/* ---------- ColorRegister --------------------------------------------*/
/* A CMAP chunk is a packed array of ColorRegisters (3 bytes each). */
typedef struct {
    UBYTE red, green, blue;   /* MUST be UBYTEs so ">> 4" won't sign extend.*/
    } ColorRegister;

/* Use this constant instead of sizeof(ColorRegister). */
#define sizeofColorRegister  3

typedef WORD Color4;    /* Amiga RAM version of a color-register,
                         * with 4 bits each RGB in low 12 bits.*/

/* Maximum number of bitplanes in RAM. Current Amiga max w/dual playfield. */
#define MaxAmDepth 6

/* ---------- Point2D --------------------------------------------------*/
/* A Point2D is stored in a GRAB chunk. */
typedef struct {
    WORD x, y;          /* coordinates (pixels) */
    } Point2D;

/* ---------- DestMerge ------------------------------------------------*/
/* A DestMerge is stored in a DEST chunk. */
typedef struct {
    UBYTE depth;        /* # bitplanes in the original source */
    UBYTE pad1;         /* UNUSED; for consistency store 0 here */
    UWORD planePick;    /* how to scatter source bitplanes into destination */
    UWORD planeOnOff;   /* default bitplane data for planePick */
    UWORD planeMask;    /* selects which bitplanes to store into */
    } DestMerge;

/* ---------- SpritePrecedence -----------------------------------------*/
/* A SpritePrecedence is stored in a SPRT chunk. */
typedef UWORD SpritePrecedence;

/* ---------- Viewport Mode --------------------------------------------*/
/* A Commodore Amiga ViewPort->Modes is stored in a CAMG chunk. */
/* The chunk's content is declared as a LONG. */

/* ---------- CRange ---------------------------------------------------*/
/* A CRange is store in a CRNG chunk. */
typedef struct {
    WORD  pad1;         /* reserved for future use; store 0 here */
    WORD  rate;         /* color cycling rate, 16384 = 60 steps/second */
    WORD  active;       /* nonzero means color cycling is turned on */
    UBYTE low, high;    /* lower and upper color registers selected */
    } CRange;

/* ---------- ILBM Writer Support Routines -----------------------------*/

/* Note: Just call PutCk to write a BMHD, GRAB, DEST, SPRT, or CAMG
 * chunk. As below. */
#define PutBMHD(context, bmHdr)  \
    PutCk(context, ID_BMHD, sizeof(BitMapHeader), (BYTE *)bmHdr)
#define PutGRAB(context, point2D)  \
    PutCk(context, ID_GRAB, sizeof(Point2D), (BYTE *)point2D)
#define PutDEST(context, destMerge)  \
    PutCk(context, ID_DEST, sizeof(DestMerge), (BYTE *)destMerge)
#define PutSPRT(context, spritePrec)  \
    PutCk(context, ID_SPRT, sizeof(SpritePrecedence), (BYTE *)spritePrec)

#ifdef FDwAT

/* Initialize a BitMapHeader record for a full-BitMap ILBM picture.
 * This gets w, h, and nPlanes from the BitMap fields BytesPerRow, Rows, and
 * Depth. It assumes you want  w = bitmap->BytesPerRow * 8 .
 * CLIENT_ERROR if bitmap->BytesPerRow isn't even, as required by ILBM format.
 *
 * If (pageWidth, pageHeight) is (320, 200), (320, 400), (640, 200), or
 * (640, 400) this sets (xAspect, yAspect) based on those 4 Amiga display
 * modes. Otherwise, it sets them to (1, 1).
 *
 * After calling this, store directly into the BitMapHeader if you want to
 * override any settings, e.g. to make nPlanes smaller, to reduce w a little,
 * or to set a position (x, y) other than (0, 0).*/
extern IFFP InitBMHdr(BitMapHeader *, struct BitMap *,
                  /*  bmHdr,          bitmap  */
     int,     int,         int,              WORD,      WORD);
 /*  masking, compression, transparentColor, pageWidth, pageHeight */
 /*  Masking, Compression, UWORD -- are the desired types, but get
  *  compiler warnings if use them.                                */

/* Output a CMAP chunk to an open FORM ILBM write context. */
extern IFFP PutCMAP(GroupContext *, WORD *,   UBYTE);
                /*  context,        colorMap, depth  */

/* This procedure outputs a BitMap as an ILBM's BODY chunk with
 * bitplane and mask data. Compressed if bmHdr->compression == cmpByteRun1.
 * If the "mask" argument isn't NULL, it merges in the mask plane, too.
 * (A fancier routine could write a rectangular portion of an image.)
 * This gets Planes (bitplane ptrs) from "bitmap".
 *
 * CLIENT_ERROR if bitmap->Rows != bmHdr->h, or if
 * bitmap->BytesPerRow != RowBytes(bmHdr->w), or if
 * bitmap->Depth < bmHdr->nPlanes, or if bmHdr->nPlanes > MaxAmDepth, or if
 * bufsize < MaxPackedSize(bitmap->BytesPerRow), or if
 * bmHdr->compression > cmpByteRun1. */
extern IFFP PutBODY(
    GroupContext *, struct BitMap *, BYTE *, BitMapHeader *, BYTE *, LONG);
    /*  context,           bitmap,   mask,   bmHdr,         buffer, bufsize */

#else /*not FDwAT*/

extern IFFP InitBMHdr();
extern IFFP PutCMAP();
extern IFFP PutBODY();

#endif FDwAT

/* ---------- ILBM Reader Support Routines -----------------------------*/

/* Note: Just call IFFReadBytes to read a BMHD, GRAB, DEST, SPRT, or CAMG
 * chunk. As below. */
#define GetBMHD(context, bmHdr)  \
    IFFReadBytes(context, (BYTE *)bmHdr, sizeof(BitMapHeader))
#define GetGRAB(context, point2D)  \
    IFFReadBytes(context, (BYTE *)point2D, sizeof(Point2D))
#define GetDEST(context, destMerge)  \
    IFFReadBytes(context, (BYTE *)destMerge, sizeof(DestMerge))
#define GetSPRT(context, spritePrec)  \
    IFFReadBytes(context, (BYTE *)spritePrec, sizeof(SpritePrecedence))

/* GetBODY can handle a file with up to 16 planes plus a mask.*/
#define MaxSrcPlanes 16+1

#ifdef FDwAT

/* Input a CMAP chunk from an open FORM ILBM read context.
 * This converts to an Amiga color map: 4 bits each of red, green, blue packed
 * into a 16 bit color register.
 * pNColorRegs is passed in as a pointer to a UBYTE variable that holds
 * the number of ColorRegisters the caller has space to hold. GetCMAP sets
 * that variable to the number of color registers actually read.*/
extern IFFP GetCMAP(GroupContext *, WORD *,   UBYTE *);
                /*  context,        colorMap, pNColorRegs  */

/* GetBODY reads an ILBM's BODY into a client's bitmap, de-interleaving and
 * decompressing.
 *
 * Caller should first compare bmHdr dimensions (rowWords, h, nPlanes) with
 * bitmap dimensions, and consider reallocating the bitmap.
 * If file has more bitplanes than bitmap, this reads first few planes (low
 * order ones). If bitmap has more bitplanes, the last few are untouched.
 * This reads the MIN(bmHdr->h, bitmap->Rows) rows, discarding the bottom
 * part of the source or leaving the bottom part of the bitmap untouched.
 *
 * GetBODY returns CLIENT_ERROR if asked to perform a conversion it doesn't
 * handle. It only understands compression algorithms cmpNone and cmpByteRun1.
 * The filed row width (# words) must agree with bitmap->BytesPerRow.
 *
 * Caller should use bmHdr.w; GetBODY only uses it to compute the row width
 * in words. Pixels to the right of bmHdr.w are not defined.
 *
 * [TBD] In the future, GetBODY could clip the stored image horizontally or
 * fill (with transparentColor) untouched parts of the destination bitmap.
 *
 * GetBODY stores the mask plane, if any, in the buffer pointed to by mask.
 * If mask == NULL, GetBODY will skip any mask plane. If
 * (bmHdr.masking != mskHasMask) GetBODY just leaves the caller's mask alone.
 *
 * GetBODY needs a buffer large enough for two compressed rows.
 * It returns CLIENT_ERROR if bufsize < 2 * MaxPackedSize(bmHdr.rowWords * 2).
 *
 * GetBODY can handle a file with up to MaxSrcPlanes planes. It returns
 * CLIENT_ERROR if the file has more. (Could be due to a bum file, though.)
 * If GetBODY fails, itt might've modified the client's bitmap. Sorry.*/
extern IFFP GetBODY(
    GroupContext *, struct BitMap *, BYTE *, BitMapHeader *, BYTE *, LONG);
    /*  context,           bitmap,   mask,   bmHdr,         buffer, bufsize */

/* [TBD] Add routine(s) to create masks when reading ILBMs whose
 * masking != mskHasMask. For mskNone, create a rectangular mask. For
 * mskHasTransparentColor, create a mask from transparentColor. For mskLasso,
 * create an "auto mask" by filling transparent color from the edges. */

#else /*not FDwAT*/

extern IFFP GetCMAP();
extern IFFP GetBODY();

#endif FDwAT

#endif ILBM_H

//E*O*F ilbm.h//

echo x - intuall.h
cat > "intuall.h" << '//E*O*F intuall.h//'
/* intuall.h */ 
#include "iff/compiler.h"   
#include "exec/types.h"
#include "exec/io.h"
#include "exec/memory.h"
#include "graphics/gfxbase.h"
#include "libraries/dos.h"
#include "intuition/intuition.h"





//E*O*F intuall.h//

echo x - packer.h
cat > "packer.h" << '//E*O*F packer.h//'
#ifndef PACKER_H
#define PACKER_H
/*----------------------------------------------------------------------*
 * PACKER.H  typedefs for Data-Compresser.  		        1/22/86
 *
 * This module implements the run compression algorithm "cmpByteRun1"; the
 * same encoding generated by Mac's PackBits.
 *
 * By Jerry Morrison and Steve Shaw, Electronic Arts.
 * This software is in the public domain.
 *
 * This version for the Commodore-Amiga computer.
 *----------------------------------------------------------------------*/

#ifndef COMPILER_H
#include "iff/compiler.h"
#endif

/* This macro computes the worst case packed size of a "row" of bytes. */
#define MaxPackedSize(rowSize)  ( (rowSize) + ( ((rowSize)+127) >> 7 ) )


#ifdef FDwAT  /* Compiler handles Function Declaration with Argument Types */

/* Given POINTERS to POINTER variables, packs one row, updating the source
 * and destination pointers. Returns the size in bytes of the packed row.
 * ASSUMES destination buffer is large enough for the packed row.
 * See MaxPackedSize. */
extern LONG PackRow(BYTE **, BYTE **, LONG);
		/*  pSource, pDest,   rowSize */

/* Given POINTERS to POINTER variables, unpacks one row, updating the source
 * and destination pointers until it produces dstBytes bytes (i.e., the
 * rowSize that went into PackRow).
 * If it would exceed the source's limit srcBytes or if a run would overrun
 * the destination buffer size dstBytes, it stops and returns TRUE.
 * Otherwise, it returns FALSE (no error). */
extern BOOL UnPackRow(BYTE **, BYTE **, WORD,     WORD);
		  /*  pSource, pDest,   srcBytes, dstBytes  */

#else /* not FDwAT */

extern LONG PackRow();
extern BOOL UnPackRow();

#endif /* FDwAT */

#endif

//E*O*F packer.h//

echo x - putpict.h
cat > "putpict.h" << '//E*O*F putpict.h//'
#ifndef PUTPICT_H
#define PUTPICT_H
/** putpict.h ********************************************************* */
/* PutPict().  Given a BitMap and a color map in RAM on the Amiga,      */
/* outputs as an ILBM.  See /iff/ilbm.h & /iff/ilbmw.c.       23-Jan-86 */
/*                                                                      */ 
/* By Jerry Morrison and Steve Shaw, Electronic Arts.                   */ 
/* This software is in the public domain.                               */ 
/*                                                                      */ 
/* This version for the Commodore-Amiga computer.                       */
/*                                                                      */ 
/************************************************************************/
#ifndef COMPILER_H
#include "iff/compiler.h"
#endif

#ifndef ILBM_H
#include "iff/ilbm.h"
#endif

#ifdef FDwAT

/****** IffErr *************************************************************/
/* Returns the iff error code and resets it to zero                        */
/***************************************************************************/
extern IFFP IffErr(void);

/****** PutPict ************************************************************/
/* Put a picture into an IFF file                                          */
/* Pass in mask == NULL for no mask.                                       */
/*                                                                         */
/* Buffer should be big enough for one packed scan line                    */
/* Buffer used as temporary storage to speed-up writing.                   */
/* A large buffer, say 8KB, is useful for minimizing Write and Seek calls. */
/* (See /iff/gio.h & /iff/gio.c).                                          */
/***************************************************************************/
extern BOOL PutPict(LONG, struct BitMap *, WORD,WORD, WORD *, BYTE *, LONG);
		 /* file, bm,           pageW,pageH,colorMap, buffer,bufsize */

#else /*not FDwAT*/

extern IFFP IffErr();
extern BOOL PutPict();

#endif FDwAT

#endif PUTPICT_H


//E*O*F putpict.h//

echo x - readpict.h
cat > "readpict.h" << '//E*O*F readpict.h//'
#ifndef READPICT_H
#define READPICT_H
/** ReadPict.h **************************************************************/
/*									    */
/* Read an ILBM raster image file into RAM.   1/23/86.			    */
/*									    */
/* By Jerry Morrison, Steve Shaw, and Steve Hayes, Electronic Arts.	    */
/* This software is in the public domain.				    */
/*									    */
/* USE THIS AS AN EXAMPLE PROGRAM FOR AN IFF READER.			    */	
/*									    */
/* The IFF reader portion is essentially a recursive-descent parser.	    */	
/****************************************************************************/

/* ILBMFrame is our "client frame" for reading FORMs ILBM in an IFF file.
 * We allocate one of these on the stack for every LIST or FORM encountered
 * in the file and use it to hold BMHD & CMAP properties. We also allocate
 * an initial one for the whole file. */
typedef struct {
   ClientFrame clientFrame;
   UBYTE foundBMHD;
   UBYTE nColorRegs;
   BitMapHeader bmHdr;
   Color4 colorMap[32 /*1<<MaxAmDepth*/ ];
   /* If you want to read any other property chunks, e.g. GRAB or CAMG, add
    * fields to this record to store them. */
   } ILBMFrame;

/** ReadPicture() ***********************************************************
 *
 * Read a picture from an IFF file, given a file handle open for reading.
 * Allocates BitMap RAM by calling (*Allocator)(size).
 *
 ****************************************************************************/

typedef UBYTE *UBytePtr;

#ifdef FDwAT

typedef UBytePtr Allocator(LONG);
   /* Allocator: a memory allocation procedure which only requires a size
    * argument. (No Amiga memory flags argument.) */

extern IFFP ReadPicture(LONG, struct BitMap *, ILBMFrame *, Allocator *);
		    /*  file, bm,              iFrame,      allocator  */
   /* iFrame is the top level "client frame". */
   /* allocator is a ptr to your allocation procedure. It must always
    *   allocate in Chip memory (for bitmap data). */

   /* PS: Notice how we used two "typedef"s above to make allocator's type
    * meaningful to humans.
    * Consider the usual C style: UBYTE *(*)(), or is it (UBYTE *)(*()) ? */

#else /* not FDwAT */

typedef UBytePtr Allocator();
extern IFFP ReadPicture();

#endif

#endif READPICT_H

//E*O*F readpict.h//

echo x - remalloc.h
cat > "remalloc.h" << '//E*O*F remalloc.h//'
/** RemAlloc.h **********************************************************/
/*  ChipAlloc(), ExtAlloc(), RemAlloc(), RemFree().			*/
/*  ALLOCators which REMember the size allocated, for simpler freeing.	*/
/*                                                                      */
/* Date      Who Changes                                                */
/* --------- --- -------------------------------------------------------*/
/* 16-Jan-86 sss Created from DPaint/DAlloc.c                           */
/* 22-Jan-86 jhm Include Compiler.h				  	*/
/* 25-Jan-86 sss Added ChipNoClearAlloc,ExtNoClearAlloc                 */
/*                                                                      */ 
/* By Jerry Morrison and Steve Shaw, Electronic Arts.                   */ 
/* This software is in the public domain.                               */ 
/*                                                                      */ 
/* This version for the Commodore-Amiga computer.                       */
/*                                                                      */ 
/************************************************************************/
#ifndef REM_ALLOC_H
#define REM_ALLOC_H

#ifndef COMPILER_H
#include "iff/compiler.h"
#endif


/* How these allocators work:
 * The allocator procedures get the memory from the system allocator,
 * actually allocating 4 extra bytes. We store the length of the node in
 * the first 4 bytes then return a ptr to the rest of the storage. The
 * deallocator can then find the node size and free it. */


#ifdef FDwAT

/* RemAlloc allocates a node with "size" bytes of user data.
 * Example:
 *   struct BitMap *bm;
 *   bm = (struct BitMap *)RemAlloc( sizeof(struct BitMap), ...flags... );
 */
extern UBYTE *RemAlloc(LONG, LONG);
		    /* size, flags */

/* ALLOCator that remembers size, allocates in CHIP-accessable memory.
 * Use for all data to be displayed on screen, all sound data, all data to be
 * blitted, disk buffers, or access by any other DMA channel.
 * Does clear memory being allocated.*/    
extern UBYTE *ChipAlloc(LONG);
		     /* size */

/* ChipAlloc, without clearing memory.  Purpose: speed when allocate
 * large area that will be overwritten anyway.*/
extern UBYTE *ChipNoClearAlloc(LONG);
    
/* ALLOCator that remembers size, allocates in extended memory.
 * Does clear memory being allocated.
 * NOTICE: does NOT declare "MEMF_FAST".  This allows machines
 * lacking extended memory to allocate within chip memory,
 * assuming there is enough memory left.*/    
extern UBYTE *ExtAlloc(LONG);
		    /* size */

/* ExtAlloc, without clearing memory.  Purpose: speed when allocate
 * large area that will be overwritten anyway.*/
extern UBYTE *ExtNoClearAlloc(LONG);


/* FREEs either chip or extended memory, if allocated with an allocator
 * which REMembers size allocated.
 * Safe: won't attempt to de-allocate a NULL pointer.
 * Returns NULL so caller can do
 *   p = RemFree(p);
 */
extern UBYTE *RemFree(UBYTE *);
		  /*  p  */

#else /* not FDwAT */

extern UBYTE *RemAlloc();
extern UBYTE *ChipAlloc();
extern UBYTE *ExtAlloc();
extern UBYTE *RemFree();

#endif /* FDwAT */

#endif REM_ALLOC_H

//E*O*F remalloc.h//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
     10     20    133 README
     32    123   1058 compiler.h
    151    910   6100 gio.h
    478   3249  20481 iff.h
    261   1517  10909 ilbm.h
     13     17    211 intuall.h
     49    243   1706 packer.h
     49    198   2110 putpict.h
     62    313   2249 readpict.h
     85    392   3182 remalloc.h
   1190   6982  48139 total
!!!
wc  README compiler.h gio.h iff.h ilbm.h intuall.h packer.h putpict.h readpict.h remalloc.h | sed 's=[^ ]*/==' | diff -b $temp -
exit 0


-- 
UUCP:  orandy@amdahl.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy
DDD:   408-737-5481
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

higgin@cbmvax.UUCP (05/20/87)

We didn't get part 2 here (the one with the executable - uuencoded).

	Please repost.

	Paul.

papa@uscacsc.UUCP (Marco Papa) (05/21/87)

There is an apparent inconsistency in the way this software is distributed.
The files say that the software is copyrighted, but the documentation says:

"  MandleVroom also has these features:
   ....
   - source in public domain"

One cannot, AT THE SAME TIME, copyright a piece of work and also put it in
the public domain.  If you put it in the public domain (and you probably
have JUST done it!), it means that ANYBODY can do anything with it: copy it,
modify it, redistribute it, SELL IT, put their copyright notices on the 
modified versions, etc... By putting it in the public domain, you have
relinquished ALL rights to it.

You'd better think about it next time.

-- Marco

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Marco Papa            3175 S. Hoover St., Ste. 275            (213)669-1497
                         Los Angeles, CA 90007           USC: (213)743-3752
                             F E L S I N A
Now working for                 :::::::                           BIX: papa
But in no way                   ::   ::
Officially representing         :::::::             ...!oberon!uscacsc!papa
                            S O F T W A R E                papa@cse.usc.edu
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-