Path: utzoo!attcan!hjespers From: hjespers@attcan.UUCP (Hans Jespersen) Newsgroups: unix-pc.sources Subject: MandelZoom (1 of 3) Keywords: fractal display program Message-ID: <10557@attcan.UUCP> Date: 23 Nov 89 15:08:33 GMT Reply-To: hjespers@attcan.UUCP (Hans Jespersen) Organization: AT&T Canada Inc., Toronto Lines: 1155 The following three part shell archive is a quick hack I wrote to display some fractal images I have generated on a 3B2/600 at work. The program that I used to generate the six data files (mandel[1-6]) is NOT included as part of this package. This is because it takes >10 hours to run on the 3B1 and is not the most efficient method for calculating the Mandelbrot Set. Should anyone want my version they can mail me at my address below. For compiling and running instructions see the top of 'm.c'. To decode the image files run uudecode on 'mandel[1-6].uu'. -- Hans Jespersen UUCP: {uunet | att}!attcan!hjespers AT&T Canada Inc. hjespers@attcan.UUCP Toronto, Ontario ---------------------------- cut here ---------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'mandel1.uu' <<'END_OF_FILE' begin 644 mandel1 M(#$Y-SD@,2 W.3(V(#$@-#,Q-B T(#'mandel2.uu' <<'END_OF_FILE' begin 644 mandel2 M(#0W-B Q(#8@-S8@-2 Q(#,X(#(@-" Q(#$S(#,@,2 R,B T(#8@,B Q(#(@ M,3 @,2 S(#$@-B Q(#,T(#0W-2 Q(#@@-S8@-2 R(#,T(#8@-" R(#$S(#,@ M,2 Q.2 U(#8@,2 R(#(@-34@-#8W(#$@-R Q(#(@,B S(#-" V(#0@,B Q,R S(#$@,3D@-2 V(#$@,B R(#4U X end END_OF_FILE if test 11784 -ne `wc -c <'mandel2.uu'`; then echo shar: \"'mandel2.uu'\" unpacked with wrong size! fi # end of 'mandel2.uu' fi if test -f 'mandel3.uu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mandel3.uu'\" else echo shar: Extracting \"'mandel3.uu'\" \(18190 characters\) sed "s/^X//" >'mandel3.uu' <<'END_OF_FILE' begin 644 mandel3 M(#$P,#'mandel4.uu' <<'END_OF_FILE' begin 644 mandel4 M(#0V,R Q(#(T-" Q(#$@,2 Q(#(@-#'mz.c' <<'END_OF_FILE' X/**********************************************************\ X* MandelZoom * X* * X* By : Hans Jespersen * X* * X* To compile : cc -O -o mz mz.c -ltam -ltermlib * X* To run : mz filename * X* * X\**********************************************************/ X X#include X#include X#include X#include X#include X X#define SIZE 720*300/16 X void wininit(); void cleanup(); X int wn; X extern unsigned short patwhite[]; X main( argc, argv ) X int argc; X char *argv[]; X{ X unsigned short screen[SIZE]; X FILE *fpin; X int bit,nbits; X int index,pos; X char c; X X if( argc != 2 ){ X printf("\nusage: mz filename\n"); X exit(-1); X } X if( (fpin = fopen( argv[1], "r")) == NULL ){ X fprintf(stderr,"\nCan't open file %s\n",argv[1]); X exit(-1); X } X wininit(); X pos = 0; X bit = 0; X for( index = 0; index < SIZE;){ X fscanf(fpin,"%d",&nbits); X for(; nbits > 0; nbits--){ X screen[index] |= bit << pos; X pos += 1; X if( pos == 16 ){ X pos = 0; X index += 1; X } X } X bit = 1 - bit; X } X wrastop(0,screen,720/8,0,0,0,0,0,0,720,300,SRCSRC,DSTSRC,0); X wcmd( wn, "Hit to exit, 'r' to reverse image." ); X while( (c = getchar()) != ' ' ){ X if( c == 'r' ) X wrastop(0,0,0,0,0,0,0,0,0,720,300,SRCPAT,DSTXOR,patwhite); X } X cleanup(); X} X void wininit() X{ X int wid; X X close( 0 ); X close( 1 ); X close( 2 ); X wid = open( "/dev/window",O_RDWR ); X dup( 0 ); X dup( 0 ); X winit(); X if( !iswind() ) { X fprintf(stderr,"\nSorry, you must use bit-mapped display!\n"); X wexit(-1); X } X wn = wcreate( 0, 0, 25, 80, NBORDER ); X wuser( wn, "MandelZoom" ); X wprintf( wn, "\033[=1C" ); X noecho(); X clear(); X nodelay( 0,1 ); X wprompt( wn, "MandelZoom: by Hans Jespersen" ); X wcmd( wn, "Loading image ...." ); X} X void cleanup() X{ X clear(); X wprintf( wn, "\033[=0C" ); X wdelete( wn ); X exit( 0 ); X} END_OF_FILE if test 2193 -ne `wc -c <'mz.c'`; then echo shar: \"'mz.c'\" unpacked with wrong size! fi # end of 'mz.c' fi echo shar: End of archive 1 \(of 3\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 3 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0