Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site utah-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!utah-cs!peterson From: peterson@utah-cs.UUCP (John W Peterson) Newsgroups: net.sources Subject: view.c - A Mandlebrot set viewer for Apollos. Message-ID: <3483@utah-cs.UUCP> Date: Sun, 6-Oct-85 22:10:41 EDT Article-I.D.: utah-cs.3483 Posted: Sun Oct 6 22:10:41 1985 Date-Received: Tue, 8-Oct-85 03:44:38 EDT Organization: Univ of Utah CS Dept Lines: 316 /* * view.c - View mandlebrot sets on an Apollo display * * Author: J. W. Peterson, * based on "ibmcg4" by Bennett Todd @ Duke University. * * Computer Science Dept. * University of Utah * Date: Fri Sep 20 1985 * Copyright (c) 1985 J. W. Peterson * */ /* View the mandlebrot set on a Color apollo (assumes 8 bit display) */ /* * view [name] * Display file name.pic created by "compute" on an Apollo color display * Works best with 8 bit color, but can produce interesting results on * bitmapped displays. * * This version is extended to you to use the mouse to find new regions * for "exploration". The program will print out the coordinates * and the "scale" of the box defined by the last two mouse selections * (bottom left and top right). * * The "c" mouse key (whatever that is on your particular mouse) * exits the program. */ #include #include "/sys/ins/base.ins.c" #include "/sys/ins/gpr.ins.c" #include "/sys/ins/pad.ins.c" #include "/sys/ins/streams.ins.c" status_$t status; stream_$id_t out_stream; gpr_$pixel_value_t scanline[2000]; int hpix, vpix; #define MAXNAMELEN 64 /* max filename length for MS-DOS */ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif #ifndef EOF #define EOF (-1) #endif #define ISSUFFIX(s1, s2) !strcmp((s1), (s2)+strlen(s2)-strlen(s1)) main(argc, argv) int argc; char **argv; { char name[MAXNAMELEN]; char ch; FILE *fp, *fopen(); int i, j, n; double center_r, center_i, scale_r, scale_i, new_r, new_i, last_r, last_i; char colormax[4]; int npix, count[256], temp_l; if (argc == 2) if (ISSUFFIX(".pic", argv[1])) strncpy(name, argv[1], MAXNAMELEN); else { strncpy(name, argv[1], MAXNAMELEN-4); strcat(name, ".pic"); } else { printf("syntax: view [name]\n"); printf("Name: "); gets(name); } if (!ISSUFFIX(".pic", name)) strcat(name, ".pic"); while ((fp = fopen(name, "r")) == NULL) { fprintf(stderr, "view: cannot open %s\n", name); printf("Name: "); gets(name); if (!ISSUFFIX(".pic", name)) strcat(name, ".pic"); } if (fscanf(fp, "Centered at %lf+%lfi, scale %lf+%lfi, %dx%d\n\032", ¢er_r, ¢er_i, &scale_r, &scale_i, &hpix, &vpix) != 6) { fprintf(stderr, "view: cannot parse header of %s\n", name); exit(1); } npix = hpix*vpix; printf("Reading %s centered at %lf+%lfi, scale %lf+%lfi, %dx%d\n", name, center_r, center_i, scale_r, scale_i, hpix, vpix); setup_scr(hpix,vpix); for (i=0; i= 'A') && (eventdata <= 'D'))); /* ignore 'up's */ gpr_$release_display( status ); *px = pos.x_coord; *py = pos.y_coord; *c = eventdata; }