ccount@ATHENA.MIT.EDU (04/14/90)
Posting-number: Volume 12, Issue 2 Submitted-by: ccount@ATHENA.MIT.EDU Archive-name: starchart2/part02 #! /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 <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 2 (of 4)." # Contents: stch_pch.ab # Wrapped by ccount@e40-008-10 on Wed Apr 4 19:12:05 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'stch_pch.ab' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stch_pch.ab'\" else echo shar: Extracting \"'stch_pch.ab'\" \(34904 characters\) sed "s/^X//" >'stch_pch.ab' <<'END_OF_FILE' X+ int vtick_lim = 2; X+ int vtext_lim = 20; X+ int vtext_xoff = 24; X+ int vtext_yoff = 0; X+ X+ /* externs for labels */ X+ int x_nameoffset = 10, y_nameoffset = 0; X+ int x_lbloffset = 0, y_lbloffset = 10; X+ int x_magoffset = 7, y_magoffset = -15; X+ X+ /* externs for legend: variables of positioning are here */ X+ int l_til = 220; X+ int l_stil = 185; X+ X+ int l_lmar1 = 40; X+ int l_lmar2 = 65; X+ int l_ltext = 95; X+ int l_rmar1 = 205; X+ int l_rmar2 = 230; X+ int l_rtext = 260; X+ X+ int l_line1 = 150; X+ int l_line2 = 125; X+ int l_line3 = 100; X+ int l_line4 = 75; X+ int l_line5 = 50; X+ int l_line6 = 25; X+ X+ /* Point sizes for font calls */ X+ int titlesize = 16; X+ int subtlsize = 12; X+ int namesize = 10; X+ int lblsize = 8; X+ int magsize = 8; X+ X+ /* Fonts for font calls */ X+ int namefnt = TIMESROMAN; X+ int lblfnt = HELV; X+ int magfnt = COURIER; X+ int titlefnt = TIMESBOLD; X+ int subtlfnt = TIMESROMAN; X+ X+ /* X+ * Scale multiplier, minimum, mangitude change, maximum, for thumbnail, X+ */ X+ double th_smul = THSMUL; X+ double th_smin = THSMIN; X+ double th_madj = THMADJ; X+ double th_mmax = THMMAX; X+ X+ #define MAX(a,b) ((a)>(b)?(a):(b)) X+ #define MIN(a,b) ((a)<(b)?(a):(b)) X+ X+ int star_size_adj = 0; X+ int alwayslabel = 0; X+ X+ /* X+ * Generic Star Drawing Stuff X+ */ X+ X+ X+ int n, oldmode, currentcolor; X+ union REGS rg; X+ X+ X+ /* Override graphics mode */ X+ D_control_arg(s) X+ char *s; X+ { X+ int c, i, j; X+ i = 0; X+ j = 1; X+ while (c = s[i++]) { X+ if (c == 'D') { X+ if (s[i] == '-') { X+ j = -1; X+ i++; X+ } else if (s[i] == '+') X+ i++; X+ star_size_adj = s[i] - '0'; X+ if (star_size_adj < 0 || star_size_adj > 9) X+ star_size_adj = 0; X+ star_size_adj *= j; X+ } X+ if (c == 'X') X+ alwayslabel = 1; X+ } X+ } X+ X+ extern int readstar(); X+ extern int (*readfile) (); X+ X+ struct IRGB { X+ int i; X+ int r; X+ int g; X+ int b; X+ }; X+ X+ struct IRGB irgb[16] = { X+ {0, 0, 0, 0}, X+ {1, 22, 22, 63}, X+ {2, 33, 33, 56}, X+ {3, 44, 44, 40}, X+ {4, 49, 49, 33}, X+ {5, 47, 47, 20}, X+ {20, 48, 29, 13}, X+ {7, 45, 45, 45}, X+ {56, 48, 15, 5}, X+ {57, 40, 0, 0}, X+ {58, 18, 18, 18}, X+ {59, 27, 27, 27}, X+ {60, 50, 0, 63}, X+ {61, 0, 60, 25}, X+ {62, 60, 29, 29}, X+ {63, 60, 60, 60} X+ }; X+ X+ #define COLOR_BLACK 0 X+ #define COLOR_O_STAR 1 X+ #define COLOR_B_STAR 2 X+ #define COLOR_A_STAR 3 X+ #define COLOR_F_STAR 4 X+ #define COLOR_G_STAR 5 X+ #define COLOR_K_STAR 6 X+ #define COLOR_DEFTEXT 7 X+ #define COLOR_M_STAR 8 X+ #define COLOR_RED 9 X+ #define COLOR_DARKGRAY 10 X+ #define COLOR_LIGHTGRAY 11 X+ #define COLOR_VIOLET 12 X+ #define COLOR_GREEN 13 X+ #define COLOR_PINK 14 X+ #define COLOR_WHITE 15 X+ X+ #ifndef PLAIN_VGA X+ #define NUM_HORPIXELS 800 X+ #define NUM_VERTPIXELS 600 X+ #define MODE_SET 98 X+ #else X+ #define NUM_HORPIXELS 640 X+ #define NUM_VERTPIXELS 480 X+ #define MODE_SET 18 X+ #endif X+ X+ X+ X+ X+ /* Planetary images */ X+ X+ char *Sun[] = { X+ " ", X+ " * ", X+ " ***** ", X+ "** ** ", X+ "** * ** ", X+ "** ** ", X+ " ***** ", X+ " * ", X+ " ", X+ NULL X+ }; X+ X+ unsigned char xSun[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Luna[] = { X+ " ** ", X+ " *** ", X+ " *** ", X+ " ** **", X+ " ** **", X+ " ** **", X+ " *** ", X+ " *** ", X+ " ** ", X+ NULL X+ }; X+ unsigned char xLuna[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ X+ char *Mercury[] = { X+ X+ "** **", X+ " **** ", X+ "** **", X+ "** **", X+ "** **", X+ " **** ", X+ " ** ", X+ " **** ", X+ " ** ", X+ NULL X+ }; X+ X+ unsigned char xMercury[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Venus[] = { X+ " ** ", X+ " **** ", X+ "** **", X+ "** **", X+ "** **", X+ " **** ", X+ " ** ", X+ " **** ", X+ " ** ", X+ NULL X+ }; X+ unsigned char xVenus[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Mars[] = { X+ " **** ", X+ " *** ", X+ " *** ", X+ " ** * ", X+ " ** ", X+ " ***** ", X+ "** ** ", X+ "** ** ", X+ " ***** ", X+ NULL X+ }; X+ unsigned char xMars[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Jupiter[] = { X+ " ** ", X+ "**** **", X+ " ** ** ", X+ " ** ** ", X+ " ** ** ", X+ " ** ** ", X+ " ***** ", X+ " ** ", X+ " ** ", X+ NULL X+ }; X+ unsigned char xJupiter[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Saturn[] = { X+ " **** ", X+ " ** ", X+ " ** ", X+ " ***** ", X+ " ** **", X+ " ** ** ", X+ " ** ** ", X+ " ** **", X+ " *", X+ NULL X+ }; X+ unsigned char xSaturn[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Uranus[] = { X+ " ** ", X+ " ****** ", X+ "** ** **", X+ " ** ", X+ " ****** ", X+ "** **", X+ "** ** **", X+ "** **", X+ " ****** ", X+ NULL X+ }; X+ unsigned char xUranus[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Neptune[] = { X+ " ", X+ "** ** **", X+ "** ** **", X+ "** ** **", X+ "** ** **", X+ " ****** ", X+ " ** ", X+ " **** ", X+ " ** ", X+ NULL X+ }; X+ unsigned char xNeptune[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Pluto[] = { X+ "****** ", X+ "** ** ", X+ "** **", X+ "** ** ", X+ "****** ", X+ "** ", X+ "** ", X+ "** ", X+ "********", X+ NULL X+ }; X+ unsigned char xPluto[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Comet[] = { X+ " ", X+ " ***", X+ " *** ", X+ " *** ", X+ "********", X+ "********", X+ " *** ", X+ " *** ", X+ " ***", X+ NULL X+ }; X+ unsigned char xComet[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Aster[] = { X+ " ", X+ "* * ", X+ "* * ", X+ " * * * ", X+ " *** ", X+ " *** ", X+ " * * * ", X+ "* * ", X+ "* * ", X+ NULL X+ }; X+ unsigned char xAster[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ /* Galaxy images */ X+ X+ char *Gal_E[] = { X+ " ", X+ "** ", X+ "**** ", X+ " **** ", X+ " ***** ", X+ " ***** ", X+ " **** ", X+ " ****", X+ " **", X+ NULL X+ }; X+ unsigned char xGal_E[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Gal_S[] = { X+ " ", X+ " *** ", X+ " * * ", X+ " ** ", X+ " **** ", X+ " ** ", X+ " * * ", X+ " *** ", X+ " ", X+ NULL X+ }; X+ unsigned char xGal_S[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ /* Cluster images */ X+ X+ char *Clu_G[] = { X+ " ", X+ " * ", X+ " * * ", X+ " * ", X+ "* *** * ", X+ " * ", X+ " * * ", X+ " * ", X+ " ", X+ NULL X+ }; X+ unsigned char xClu_G[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Clu_O[] = { X+ " ", X+ " * ", X+ " * * ", X+ " ", X+ "* * ", X+ " ", X+ " * * ", X+ " * ", X+ " ", X+ NULL X+ }; X+ unsigned char xClu_O[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ /* Nebula images */ X+ X+ char *Neb_D[] = { X+ " ", X+ "******* ", X+ "* * ", X+ "* * ", X+ "* * ", X+ "* * ", X+ "* * ", X+ "******* ", X+ " ", X+ NULL X+ }; X+ unsigned char xNeb_D[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Neb_P[] = { X+ " ", X+ " * ", X+ " * * * ", X+ " * ", X+ "******* ", X+ " * ", X+ " * * * ", X+ " * ", X+ " ", X+ NULL X+ }; X+ unsigned char xNeb_P[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ /* Other images */ X+ X+ char *Unk_U[] = { X+ " ", X+ " *** ", X+ " * * ", X+ " * * ", X+ " * ", X+ " * ", X+ " * ", X+ " ", X+ " * ", X+ NULL X+ }; X+ unsigned char xUnk_U[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *Other_O[] = { X+ " ", X+ " ", X+ "* * * ", X+ " * * * ", X+ "* * * ", X+ " * * * ", X+ "* * * ", X+ " * * * ", X+ " ", X+ NULL X+ }; X+ unsigned char xOther_O[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C300[] = { X+ "* ** ", X+ " ***** ", X+ " ** ", X+ " ** ", X+ " ** ", X+ " ** ", X+ " **** ", X+ " ** ", X+ " ** ", X+ NULL X+ }; X+ unsigned char xC300[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C305[] = { X+ "* **** ", X+ " * ", X+ " *** ", X+ "** ", X+ "** ", X+ " ** ", X+ " *** ", X+ " ** ", X+ " ** ", X+ NULL X+ }; X+ unsigned char xC305[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C301[] = { X+ " ", X+ "** ", X+ "****** ", X+ "** ** ", X+ "** ** ", X+ "** ** ", X+ " ** ", X+ " ** ", X+ " ** ", X+ NULL X+ }; X+ unsigned char xC301[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C302[] = { X+ " ", X+ " ", X+ " ", X+ " *** ", X+ " ** ", X+ " ** ", X+ " ** ", X+ " ** ", X+ " *** ", X+ NULL X+ }; X+ unsigned char xC302[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C303[] = { X+ " ", X+ " ", X+ "** ** ", X+ "** ** ", X+ "** ** ", X+ "**** ", X+ "** ** ", X+ "** ** ", X+ "** ** ", X+ NULL X+ }; X+ unsigned char xC303[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C304[] = { X+ "** ", X+ " ** ", X+ " ** ", X+ " ** ", X+ " ** ", X+ " ** ", X+ " **** ", X+ " ** ** ", X+ "** **", X+ NULL X+ }; X+ unsigned char xC304[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C306[] = { X+ " ", X+ " **** ", X+ " ** ** ", X+ "** ** ", X+ "** ** ", X+ "** ** ", X+ "***** ", X+ "** ", X+ "** ", X+ NULL X+ }; X+ unsigned char xC306[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C307[] = { X+ "* * * ", X+ "* * * ", X+ "* * * ", X+ "* * * ", X+ " * * * ", X+ " *** ", X+ " * ", X+ " * ", X+ " * ", X+ NULL X+ }; X+ unsigned char xC307[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ char *C308[] = { X+ " ", X+ " ", X+ " ", X+ " * * ", X+ "** ** ", X+ "** * ** ", X+ "** * ** ", X+ "** * ** ", X+ " ***** ", X+ NULL X+ }; X+ unsigned char xC308[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; X+ X+ X+ X+ void cimage(char **, unsigned char *); X+ X+ void X+ cimage(char **in, unsigned char *out) X+ { X+ int i, j, bits; X+ X+ for (i = 0; i < 9; i++) { X+ bits = 0; X+ if (in[i][0] == '*') X+ bits |= 128; X+ if (in[i][1] == '*') X+ bits |= 64; X+ if (in[i][2] == '*') X+ bits |= 32; X+ if (in[i][3] == '*') X+ bits |= 16; X+ if (in[i][4] == '*') X+ bits |= 8; X+ if (in[i][5] == '*') X+ bits |= 4; X+ if (in[i][6] == '*') X+ bits |= 2; X+ if (in[i][7] == '*') X+ bits |= 1; X+ out[i] = bits; X+ } X+ } X+ void dimage(int, int, unsigned char *); X+ X+ X+ X+ int firsttimethrough = 1; X+ X+ X+ X+ X+ /* Open the device */ X+ int X+ D_open() X+ { X+ int i; X+ float aspect; X+ int limit; X+ X+ readfile = readstar; /* No memory to spare on PC */ X+ X+ rg.h.ah = 0x0f; X+ int86(16, &rg, &rg); X+ oldmode = rg.h.al; X+ if (MODE_SET == 18) { X+ rg.x.ax = 18; X+ } else if (MODE_SET == 98) { /* This will need to be changed for X+ * other video cards */ X+ rg.x.ax = 0x6f05; X+ rg.h.bl = 98; X+ } else X+ exit(1); X+ int86(16, &rg, &rg); X+ X+ X+ setmod(MODE_SET); X+ X+ X+ /* X+ * This next bit resets the VGA pallette registers to nice values. Since X+ * the EGA doesn't have these registers, this program won't work there. X+ * You could get it to work by dropping this "for" loop and changing the X+ * #defines for the colors, and using graphics mode 16 (decimal). There X+ * are 64 colors in an EGA, which probably will be enough. Use the BIOS X+ * to set them. X+ */ X+ X+ for (i = 0; i < 16; i++) { X+ outp(0x3c8, irgb[i].i); X+ outp(0x3c9, irgb[i].r); X+ outp(0x3c9, irgb[i].g); X+ outp(0x3c9, irgb[i].b); X+ } X+ X+ setcolor(COLOR_DEFTEXT); X+ X+ yscale1 = NUM_VERTPIXELS - 1; X+ yscale2 = (long) (13 * NUM_VERTPIXELS); X+ xscale1 = (long) (0.5 + 0.9765625 * NUM_HORPIXELS); X+ xlast = 0; X+ ylast = yscale1; X+ aspect = 1.; X+ for (i = 0; i < 7; ++i) { X+ if (yrad[i] < 1) { X+ yrad[i] = 1; X+ } X+ } X+ return TRUE; X+ } X+ X+ int X+ setcolor(c) X+ int c; X+ { X+ currentcolor = c; X+ } X+ X+ /* Close the device */ X+ D_close() X+ { X+ /* wait for keystroke */ X+ getch(); X+ /* reset screen */ X+ rg.x.ax = oldmode; X+ int86(16, &rg, &rg); X+ } X+ X+ int cur__x, cur__y; X+ X+ /* Move to (x, y) */ X+ D_move(x, y) X+ int x, y; X+ { X+ cur__x = scx(x); X+ cur__y = scy(y); X+ } X+ X+ X+ /* Draw a line of style line_style from the current point to (x, y) */ X+ /* Note, this replaces vecdraw vecdrawdot and vecdrawhyph */ X+ D_draw(x, y, line_style) X+ int x, y; X+ int line_style; /* SOLID, DOTTED, DASHED, etc. */ X+ { X+ unsigned short ls; X+ int tx, ty; X+ X+ switch (line_style) { X+ case SOLID: X+ case VECSOLID: X+ ls = COLOR_DEFTEXT; X+ break; X+ case DOTTED: X+ case VECDOT: X+ ls = COLOR_LIGHTGRAY; X+ break; X+ case DASHED: X+ case VECDASH: X+ ls = COLOR_DARKGRAY; X+ } X+ zsetup(); X+ zline(cur__x, cur__y, (tx = scx(x)), (ty = scy(y)), ls); X+ curmod(); X+ cur__x = tx; X+ cur__y = ty; X+ } X+ /* X+ * This routine is encouraged to look at the extern cur_funtion and change X+ * the line style drawn as desired X+ */ X+ X+ X+ /* Move to (x1, y1) then draw a line of style line_style to (x2, y2) */ X+ D_movedraw(x1, y1, x2, y2, line_style) X+ int x1, y1, x2, y2; X+ int line_style; /* SOLID, DOTTED, DASHED, etc. */ X+ { X+ D_move(x1, y1); X+ D_draw(x2, y2, line_style); X+ } X+ X+ X+ /* Set the color to be used for lines and text */ X+ /* X+ * color_str is a 2 char (+ '\0') string containing a specification for a X+ * color, e.g. "G2" for the color of a star of spectral class G2, or "r7" for X+ * red, level seven. The interpretation of the color string is left to the X+ * device driver X+ */ X+ D_color(color_str) X+ char *color_str; X+ { X+ switch (color_str[0]) { X+ case 'O': X+ case 'b': X+ setcolor(COLOR_O_STAR); X+ break; X+ case 'B': X+ setcolor(COLOR_B_STAR); X+ break; X+ case 'A': X+ setcolor(COLOR_A_STAR); X+ break; X+ case 'F': X+ setcolor(COLOR_F_STAR); X+ break; X+ case 'y': X+ case 'G': X+ setcolor(COLOR_G_STAR); X+ break; X+ case 'K': X+ case 'o': X+ setcolor(COLOR_K_STAR); X+ break; X+ case 'M': X+ setcolor(COLOR_M_STAR); X+ break; X+ case 'r': X+ case 'C': X+ case 'R': X+ case 'N': X+ case 'S': X+ setcolor(COLOR_RED); X+ break; X+ case 'g': X+ case 'c': X+ setcolor(COLOR_GREEN); X+ break; X+ case 'p': X+ setcolor(COLOR_VIOLET); X+ break; X+ case 16: X+ setcolor(COLOR_PINK); X+ break; X+ default: X+ setcolor(COLOR_DEFTEXT); X+ break; X+ } X+ } X+ X+ X+ /* Set the font and font size to be used for text. */ X+ /* Note order of args */ X+ D_fontsize(fsize, font) X+ int fsize; /* Size of font */ X+ int font; /* e.g. TIMES, HELV, TIMES+ITALIC */ X+ { X+ } X+ /* X+ * This routine is encouraged to look at the extern cur_funtion and change X+ * the font used as desired X+ */ X+ X+ X+ /* X+ * Fill in one character using the 8x8 character table that BIOS uses to X+ * write chars in graphics mode. Advance the xlast value by 8 bits. X+ */ X+ one_char(c) X+ int c; X+ { X+ char far *xtab; X+ int i, j; X+ int x, y; X+ X+ X+ if ((c < 0)) { X+ xlast += 8; X+ return; X+ } X+ y = ylast - 4; X+ x = xlast + 7; X+ if (c < 300) { X+ slettr(x, y, c, 7); X+ } else { X+ switch (c) { X+ case 300: X+ symbol(x, y, 9, 7, xC300); X+ break; X+ case 301: X+ symbol(x, y, 9, 7, xC301); X+ break; X+ case 302: X+ symbol(x, y - 2, 9, 7, xC302); X+ break; X+ case 303: X+ symbol(x, y - 2, 9, 7, xC303); X+ break; X+ case 304: X+ symbol(x, y - 2, 9, 7, xC304); X+ xlast += 1; X+ break; X+ case 305: X+ symbol(x, y, 9, 7, xC305); X+ break; X+ case 306: X+ symbol(x, y - 2, 9, 7, xC306); X+ break; X+ case 307: X+ symbol(x, y - 1, 9, 7, xC307); X+ break; X+ case 308: X+ symbol(x, y - 2, 9, 7, xC308); X+ xlast += 1; X+ break; X+ default: X+ break; X+ } X+ } X+ xlast += 8; X+ } X+ X+ static int intable[25] = {'a', 'b', 'g', 'd', 'e', 'z', 'h', 'q', X+ 'i', 'k', 'l', 'm', 'n', 'x', 'o', 'p', 'r', 's', 't', X+ 'u', 'j', 'c', 'y', 'w', 'f'}; X+ static int outtable[25] = {224, 225, 226, 235, 238, 300, 301, 233, X+ 302, 303, 304, 230, 'v', 305, 'o', 227, 306, 229, 231, X+ 'u', 237, 'x', 307, 308, 237}; X+ X+ greekfirsttime = 1; X+ X+ /* X+ * Display text string str at x,y, in current font and font size, using greek X+ * characters (if possible) if gk_flag is TRUE X+ */ X+ D_text(x, y, str, gk_flag) X+ int x, y; X+ char *str; X+ int gk_flag; X+ { X+ int c, i; X+ zsetup(); X+ X+ if (greekfirsttime) { X+ cimage(C300, xC300); X+ cimage(C301, xC301); X+ cimage(C302, xC302); X+ cimage(C303, xC303); X+ cimage(C304, xC304); X+ cimage(C305, xC305); X+ cimage(C306, xC306); X+ cimage(C307, xC307); X+ cimage(C308, xC308); X+ greekfirsttime = 0; X+ } X+ if (gk_flag == 2) X+ gk_flag = 0; X+ xlast = scx(x); X+ ylast = scy(y); X+ if (!gk_flag) { X+ while ((c = *str++) != '\0') { X+ one_char(c); X+ } X+ } else { X+ if (isgreek(str[0]) && (isdigit(str[1]) || (str[1] == ' '))) { X+ /* X+ * Greek if first character is greek encoded, and the second is X+ * space or a digit X+ */ X+ c = 0; X+ for (i = 0; i < 25; i++) { X+ if (intable[i] == str[0]) { X+ c = outtable[i]; X+ break; X+ } X+ } X+ if (c) { X+ one_char(c); X+ one_char(str[1]); X+ } X+ } else { /* Star label, but not greek */ X+ /* remove leading spaces */ X+ while (*str == ' ') X+ str++; X+ while ((c = *str++) != '\0') X+ one_char(c); X+ } X+ X+ X+ X+ X+ } X+ X+ curmod(); X+ X+ } X+ X+ isgreek(c) X+ char c; X+ { X+ char *cp; X+ X+ cp = "abgdezhqiklmnxoprstujcywf"; /* f and j are both phi */ X+ while (*cp && (*cp != c)) X+ cp++; X+ return (*cp != '\0'); /* True if letter was in greek string */ X+ } X+ X+ X+ /* Return input coordinate in device coords where there are pointing devices */ X+ D_inxy(x, y) X+ int *x, *y; X+ { X+ } X+ X+ X+ /* X+ * Put non-displayed comment in output. Allowed in postscript, but few other X+ * drivers will be able to support this. X+ */ X+ D_comment(str) X+ char *str; X+ { X+ /* X+ * fprintf(stderr, "%s\n", str); X+ */ X+ } X+ X+ drawlen(x, y, dx, dy, len) X+ { X+ int x1, x2, y1; X+ X+ x1 = x + dx * 2; X+ y1 = y + dy * 2; X+ x2 = x1 + len * 2 - 1; X+ x1 = scx(x1); X+ y1 = scy(y1); X+ x2 = scx(x2); X+ zsetup(); X+ zline(x2, y1, x1, y1, currentcolor); X+ curmod(); X+ cur__x = x2; X+ cur__y = y1; X+ } X+ X+ X+ X+ /* Interface Function */ X+ /* Draw object at x, y. properties set by other parameters */ X+ drawobj(x, y, mag, type, color_str, label_field, con_str, obj_name, X+ comment_str, file_line, X+ draw_glyph, draw_text, use_lbl, use_name, use_mag) X+ int x, y; X+ double mag; /* Magnitude of object */ X+ char *type; /* 2 chars, object code and subcode */ X+ char *color_str; /* 2 chars, spectral type for stars, color X+ * code otherwise */ X+ char *label_field; /* 2 chars, Bayer or flamsteed for X+ * stars, size in seconds for nebulae X+ * and planets */ X+ char *con_str; /* 3 chars, the constellation the object is X+ * in */ X+ char *obj_name; /* Name of object */ X+ char *comment_str; /* Comment field */ X+ char *file_line; /* The full line from the file, containing X+ * the above if it is in standard format */ X+ int draw_glyph; /* Draw object symbol */ X+ int draw_text; /* Draw text */ X+ int use_lbl; /* Label object with the label_field string */ X+ int use_name; /* Label object with the obj_name string */ X+ int use_mag; /* Label object with a 2 or 3 character X+ * string containing the magnitude * 10 X+ * without decimal point */ X+ { X+ char magstr[10]; X+ X+ X+ if (firsttimethrough) { X+ cimage(Sun, xSun); X+ cimage(Luna, xLuna); X+ cimage(Mercury, xMercury); X+ cimage(Venus, xVenus); X+ cimage(Mars, xMars); X+ cimage(Jupiter, xJupiter); X+ cimage(Saturn, xSaturn); X+ cimage(Uranus, xUranus); X+ cimage(Neptune, xNeptune); X+ cimage(Pluto, xPluto); X+ cimage(Comet, xComet); X+ cimage(Aster, xAster); X+ cimage(Gal_E, xGal_E); X+ cimage(Gal_S, xGal_S); X+ cimage(Clu_G, xClu_G); X+ cimage(Clu_O, xClu_O); X+ cimage(Neb_D, xNeb_D); X+ cimage(Neb_P, xNeb_P); X+ cimage(Unk_U, xUnk_U); X+ cimage(Other_O, xOther_O); X+ X+ firsttimethrough = 0; X+ } X+ /* X+ * fprintf(stderr, "%d %d %f <%s> <%s> <%s> <%s> <%s> <%s> <%s>\n", x, y, X+ * mag, type, color_str, label_field, con_str, obj_name, comment_str, X+ * file_line); X+ */ X+ X+ if (draw_glyph) X+ switch (type[0]) { X+ case 'S': X+ drawStar(x, y, mag, type[1], color_str); X+ break; X+ case 'P': X+ drawPlan(x, y, mag, type[1], color_str, size_obj(label_field), X+ comment_str); X+ goto extraname; X+ /* X+ * I, J. D. McDonald, have sworn to include a "goto" in every X+ * program I write. This is a perfect use of one. X+ */ X+ case 'N': X+ drawNebu(x, y, mag, type[1], color_str, size_obj(label_field)); X+ goto extraname; X+ case 'G': X+ drawGalx(x, y, mag, type[1], color_str, size_obj(label_field)); X+ goto extraname; X+ case 'C': X+ drawClus(x, y, mag, type[1], color_str, size_obj(label_field)); X+ extraname: X+ if (alwayslabel) { X+ draw_text = 1; X+ use_name = 1; X+ } X+ break; X+ case 'U': X+ drawUnknown(x, y, mag, type[1], color_str, size_obj(label_field)); X+ break; X+ case 'O': X+ drawOther(x, y, mag, type[1], color_str, size_obj(label_field)); X+ break; X+ case 'V': X+ case 'A': X+ case 'I': X+ break; X+ case '#': X+ default: X+ break; X+ }; X+ X+ X+ /* X+ * use name or label X+ */ X+ if (draw_text) { X+ if (type[0] == 'I') X+ D_color(color_str); X+ else X+ D_color(" "); X+ X+ if (use_name && obj_name[0]) { X+ D_fontsize(namesize, namefnt); X+ D_text(x + x_nameoffset, y + y_nameoffset, obj_name, FALSE); X+ } else if (use_lbl && X+ ((label_field[0] != ' ') || (label_field[1] != ' '))) { X+ D_fontsize(lblsize, lblfnt); X+ D_text(x + x_lbloffset, y + y_lbloffset, label_field, TRUE); X+ } X+ /* If you want to mag label other objects, change this */ X+ if (use_mag && (type[0] == 'S')) { X+ sprintf(magstr, "%02d", (int) (mag * 10.0 + 0.5)); X+ D_fontsize(magsize, magfnt); X+ D_text(x + x_magoffset, y + y_magoffset, magstr, FALSE); X+ } X+ } X+ } X+ X+ drawStar(x, y, mag, type, color) X+ int x, y; X+ double mag; X+ char type, *color; X+ { X+ int *coord; X+ int i; X+ int i_mag; X+ int maxlen; X+ X+ mag -= star_size_adj; X+ X+ if (mag < MIN_MAG) { X+ mag = MIN_MAG; X+ } else if (mag > MAX_MAG) { X+ mag = MAX_MAG; X+ } X+ X+ i_mag = 9 - (int)(mag + 0.5); X+ X+ D_color(color); X+ X+ x = scx(x); X+ y = scy(y); X+ zsetup(); X+ if (i_mag > 1) X+ fillelip(x, y, i_mag, i_mag, currentcolor); X+ else if (i_mag == -2) X+ zpoint(x, y, currentcolor); X+ else if (i_mag == -1) X+ zline(x, y, x+1, y, currentcolor); X+ else if (i_mag == 0) X+ fillelip(x,y,1,1,currentcolor); X+ else X+ rectfill(x-1,y-1,x+1,y+1,currentcolor); X+ X+ if (type == 'D' && i_mag > 2) { X+ zline(x - i_mag - 2, y, x + i_mag + 2, y, currentcolor); X+ } X+ if (type == 'V' && i_mag > 3) { X+ ellipse(x, y, i_mag - 2, i_mag - 2, 0); X+ } X+ curmod(); X+ D_color(" "); X+ } X+ X+ X+ drawPlan(x, y, mag, pcode, color, plansize, comment_str) X+ int x, y; X+ double mag; X+ char pcode, *color; X+ long plansize; X+ char *comment_str; X+ { X+ X+ D_color(color); X+ zsetup(); X+ switch (pcode) { X+ case 'S': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xSun); X+ break; X+ case 'L': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xLuna); X+ break; X+ case 'M': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xMercury); X+ break; X+ case 'V': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xVenus); X+ break; X+ case 'm': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xMars); X+ break; X+ case 'J': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xJupiter); X+ break; X+ case 's': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xSaturn); X+ break; X+ case 'U': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xUranus); X+ break; X+ case 'N': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xNeptune); X+ break; X+ case 'P': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xPluto); X+ break; X+ case 'C': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xComet); X+ break; X+ case 'A': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xAster); X+ break; X+ default: X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xUnk_U); X+ break; X+ } X+ curmod(); X+ } X+ X+ X+ drawGalx(x, y, mag, type, color, nebsize) X+ int x, y; X+ double mag; X+ char type, *color; X+ long nebsize; /* -1 should give default size */ X+ { X+ D_color(color); X+ X+ zsetup(); X+ switch (type) { X+ case 'a': X+ case 'b': X+ case 'c': X+ case 'd': X+ case 'B': X+ case 'S': X+ case 'O': X+ case 'Q': X+ case 'I': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xGal_S); X+ break; X+ default: X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xGal_E); X+ X+ } X+ curmod(); X+ X+ } X+ X+ drawClus(x, y, mag, type, color, nebsize) X+ int x, y; X+ double mag; X+ char type, *color; X+ long nebsize; /* -1 should give default size */ X+ { X+ D_color(color); X+ zsetup(); X+ switch (type) { X+ case 'G': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xClu_G); X+ break; X+ default: X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xClu_O); X+ X+ } X+ curmod(); X+ } X+ X+ drawNebu(x, y, mag, type, color, nebsize) X+ int x, y; X+ double mag; X+ char type, *color; X+ long nebsize; /* -1 should give default size */ X+ { X+ X+ if (color[0] == ' ') { X+ if (type == 'P') X+ color[0] = 'g'; X+ else X+ color[0] = 16; X+ } X+ D_color(color); X+ X+ zsetup(); X+ switch (type) { X+ case 'P': X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xNeb_P); X+ break; X+ default: X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xNeb_D); X+ X+ } X+ curmod(); X+ } X+ X+ drawUnknown(x, y, mag, type, color, nebsize) X+ int x, y; X+ double mag; X+ char type, *color; X+ long nebsize; /* -1 should give default size */ X+ { X+ D_color(color); X+ X+ zsetup(); X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xUnk_U); X+ curmod(); X+ } X+ X+ drawOther(x, y, mag, type, color, nebsize) X+ int x, y; X+ double mag; X+ char type, *color; X+ long nebsize; /* -1 should give default size */ X+ { X+ D_color(color); X+ X+ zsetup(); X+ symbol((int) scx(x) - 3, (int) scy(y) - 4, 9, currentcolor, xOther_O); X+ curmod(); X+ } X+ X+ X+ X+ X+ /* Note externs which are used */ X+ X+ chartlegend(win) X+ mapwindow *win; X+ { X+ char ras[20], dls[20], outstr[40]; X+ if (!title[0]) X+ title = "LEGEND"; X+ rastr(ras, win->racen); X+ declstr(dls, win->dlcen); X+ X+ if (win->map_type != FULLPAGEMAP) { X+ sprintf(outstr, "(%s,%s lim: %2.1f)", ras, dls, win->maglim); X+ D_fontsize(titlesize, titlefnt); X+ D_text(l_lmar1, l_til, title, FALSE); X+ D_fontsize(subtlsize, subtlfnt); X+ D_text(l_lmar1, l_stil, outstr, FALSE); X+ X+ drawStar(l_lmar2, l_line1, 1.0, 'S', " "); X+ D_fontsize(namesize, namefnt); X+ D_text(l_ltext, l_line1, "<1.5", FALSE); X+ if (win->maglim >= 2.5) { X+ drawStar(l_rmar2, l_line1, 3.0, 'S', " "); X+ D_fontsize(namesize, namefnt); X+ D_text(l_rtext, l_line1, "<3.5", FALSE); X+ } X+ if (win->maglim >= 4.5) { X+ drawStar(l_lmar2, l_line2, 5.0, 'S', " "); X+ D_fontsize(namesize, namefnt); X+ D_text(l_ltext, l_line2, "<5.5", FALSE); X+ } X+ if (win->maglim >= 6.5) { X+ drawStar(l_rmar2, l_line2, 7.0, 'S', " "); X+ D_fontsize(namesize, namefnt); X+ D_text(l_rtext, l_line2, "<7.5", FALSE); X+ } X+ if (win->maglim >= 8.5) { X+ drawStar(l_lmar2, l_line3, 9.0, 'S', " "); X+ D_fontsize(namesize, namefnt); X+ D_text(l_ltext, l_line3, "<9.5", FALSE); X+ } X+ if (win->maglim > 9.5) { X+ drawStar(l_rmar2, l_line3, 10.0, 'S', " "); X+ D_fontsize(namesize, namefnt); X+ D_text(l_rtext, l_line3, ">9.5", FALSE); X+ } X+ D_fontsize(namesize, namefnt); X+ D_text(l_ltext, l_line4, "double", FALSE); X+ drawStar(l_lmar2, l_line4, 4.0, 'D', " "); X+ D_fontsize(namesize, namefnt); X+ D_text(l_rtext, l_line4, "variable", FALSE); X+ drawStar(l_rmar2, l_line4, 2.0, 'V', " "); X+ X+ D_fontsize(namesize, namefnt); X+ D_text(l_ltext, l_line5, "planet", FALSE); X+ drawPlan(l_lmar2, l_line5, 1.0, 'J', " ", (long) -1, ""); X+ X+ D_fontsize(namesize, namefnt); X+ D_text(l_rtext, l_line5, "galaxy", FALSE); X+ drawGalx(l_rmar2, l_line5, 1.0, 'E', " ", (long) -1); X+ drawGalx(l_rmar1, l_line5, 1.0, 'S', " ", (long) -1); X+ X+ D_fontsize(namesize, namefnt); X+ D_text(l_ltext, l_line6, "nebula", FALSE); X+ drawNebu(l_lmar2, l_line6, 1.0, 'D', " ", (long) -1); X+ drawNebu(l_lmar1, l_line6, 1.0, 'P', " ", (long) -1); X+ X+ D_fontsize(namesize, namefnt); X+ D_text(l_rtext, l_line6, "cluster", FALSE); X+ drawClus(l_rmar2, l_line6, 1.0, 'O', " ", (long) -1); X+ drawClus(l_rmar1, l_line6, 1.0, 'G', " ", (long) -1); X+ } else { X+ D_fontsize(namesize, namefnt); X+ X+ sprintf(outstr, "%s: %s,%s lim: %2.1f", title, ras, dls, win->maglim); X+ D_text(15, 15, outstr, FALSE); X+ } X+ } X+ X+ /* Functions for areas, drawn as lines for now */ X+ static struct { X+ int x, y; X+ } areapts[1000]; X+ static int nareapts; X+ /* Move to (x, y) to begin an area */ X+ D_areamove(x, y) X+ int x, y; X+ { X+ nareapts = 0; X+ areapts[nareapts].x = x; X+ areapts[nareapts].y = y; X+ nareapts++; X+ } X+ X+ /* Add a segment to the area border */ X+ D_areaadd(x, y) X+ int x, y; X+ { X+ areapts[nareapts].x = x; X+ areapts[nareapts].y = y; X+ nareapts++; X+ } X+ X+ /* Fill the area, after adding the last segment */ X+ D_areafill(x, y) X+ int x, y; X+ { X+ int i; X+ X+ areapts[nareapts].x = x; X+ areapts[nareapts].y = y; X+ nareapts++; X+ X+ X+ D_move(areapts[0].x, areapts[0].y); X+ X+ for (i = 1; i < nareapts; i++) X+ D_draw(areapts[i].x, areapts[i].y); X+ } X+ X+ X+ X+ /* Draw an ellipse with width irx and height iry */ X+ /* from a routine by Tim Hogan in Dr. Dobb's Journal May '85 p.40 */ X+ /* Improved by calculating increments incrementally, thus removing all */ X+ /* multiplies from the loops. These multiplies were very bad since they */ X+ /* were (long)*(long). This code, when compiled by Microsoft C Version 5,*/ X+ /* can't be significantly improved by hand optimization. */ X+ /* Written Sept. 7, 1987 by J.D. McDonald (public domain) */ X+ X+ static long alpha, beta, alpha2, alpha4, beta2, beta4, d; X+ static long ddx, ddy, alphadx, betady; X+ static int dy, dx; X+ X+ extern void e_start(); /* Starts off by writing right and left X+ * points */ X+ extern void e_xd(); /* Moves one step to lower x (in all 4 quadrants) */ X+ extern void e_xdyu(); /* Moves to lower x, higher y */ X+ extern void e_yu(); /* Moves to higher y */ X+ X+ ellipse(x, y, irx, iry, c) X+ int x, y, irx, iry; X+ unsigned c; X+ { X+ X+ beta = (long) irx *(long) irx; X+ alpha = (long) iry *(long) iry; X+ X+ if (alpha == 0L) X+ alpha = 1L; X+ if (beta == 0L) X+ beta = 1L; X+ X+ dy = 0; X+ dx = irx; X+ alpha2 = alpha << 1; X+ alpha4 = alpha2 << 1; X+ beta2 = beta << 1; X+ beta4 = beta2 << 1; X+ alphadx = alpha * dx; X+ betady = 0; X+ ddx = alpha4 * (1 - dx); X+ ddy = beta2 * 3; X+ X+ d = alpha2 * ((long) (dx - 1) * dx) + alpha + beta2 * (1 - alpha); X+ e_start(x - dx, x + dx, y, c); X+ X+ do { X+ if (d >= 0) { X+ d += ddx; X+ dx--; X+ alphadx -= alpha; END_OF_FILE if test 34904 -ne `wc -c <'stch_pch.ab'`; then echo shar: \"'stch_pch.ab'\" unpacked with wrong size! fi # end of 'stch_pch.ab' fi echo shar: End of archive 2 \(of 4\). cp /dev/null ark2isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 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