From decwrl!uunet!allbery Sun Mar 25 18:41:47 PST 1990 Article 1429 of comp.sources.misc: Path: decwrl!uunet!allbery From: ccount@ATHENA.MIT.EDU Newsgroups: comp.sources.misc Subject: v11i054: starchart 3.2 Part 26/32 Message-ID: <82346@uunet.UU.NET> Date: 26 Mar 90 00:00:38 GMT Sender: allbery@uunet.UU.NET Lines: 1141 Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) Posting-number: Volume 11, Issue 54 Submitted-by: ccount@ATHENA.MIT.EDU Archive-name: starchart/part26 #! /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 'starchart/spo.c.aa' <<'END_OF_FILE' X/* X * PostScript file format driver for startchart.c mainline X */ X X/* X ! patched December, 1987 by Alan Paeth (awpaeth@watcgl), X ! based on revisions by Craig Counterman (email: ccount@athena.mit.edu) X ! X ! [1] "bigmaster" chart layout now added X ! [2] extensive rework and subclassing of non-stellar objects, e.g. X ! galaxies, now have both spiral and irregular variants. X ! [3] star sizes now extended to magnitude 10 X ! [4] white halo-ing of text overlays (by analogy to star haloing) X ! X * Modified for starchart 3.0. Craig Counterman Jan, 1989 X * X * size changed: X * 8 x 11 inch field, in units of 1/ResPT th of a point X * offset 1/4 inch = 18*ResPT X * X * Portions Copyright (c) 1987 by Alan Paeth (awpaeth@watcgl) X * X * Copyright (c) 1990 by Craig Counterman. All rights reserved. X * X * This software may be redistributed freely, not sold. X * This copyright notice and disclaimer of warranty must remain X * unchanged. X * X * No representation is made about the suitability of this X * software for any purpose. It is provided "as is" without express or X * implied warranty, to the extent permitted by applicable law. X * X */ X X Xstatic char rcsid[]="$Header: starpost.c,v 2.19 90/03/09 19:13:30 ccount Exp $"; X#include X#include X#ifndef SYSV X#include X#else X#include X#endif X#include X#include "star3.h" X X X/* Externs */ Xextern int g_argc; Xextern char **g_argv; X Xextern char *title; /* Title of page */ X Xextern mapwindow *mapwin[MAXWINDOWS]; Xextern int numwins; X Xextern int cur_function; Xextern int cur_map_type; Xextern int cur_map_tag; Xextern char *cur_tag_field; Xextern mapwindow *cur_win; X Xextern int chart_type; X X/* Set by initxform X One could use elements of the mapwindow structure, X but these should be faster for the current window */ Xextern double xf_west, xf_east, xf_north, xf_south, xf_bottom; Xextern int xf_xcen, xf_ycen, xf_ybot; Xextern int xf_w_left, xf_w_right, xf_w_top, xf_w_bot; Xextern double xf_c_scale; X X/* Scale multiplier, minimum, X mangitude change, maximum, for thumbnail,*/ X#define THSMUL 1.2 X#define THSMIN 12.0 X#define THMADJ 2.5 X#define THMMAX 8.0 X X X#define ResPT 4 X#define InchPT 72*ResPT X X#define MAG_1_RAD 9*ResPT X#define MAG0_RAD ((int)(8*ResPT)) X#define MAG1_RAD ((int)(7*ResPT)) X#define MAG2_RAD ((int)(6*ResPT)) X/* if MAG3 is not an integer times ResPT, X there is an error reported later using some (non-ansi) compilers */ X#define MAG3_RAD ((int)(5*ResPT)) X#define MAG4_RAD ((int)(4*ResPT)) X#define MAG5_RAD ((int)(3.25*ResPT)) X#define MAG6_RAD ((int)(2.5*ResPT)) X#define MAG7_RAD ((int)(2.0*ResPT)) X#define MAG8_RAD ((int)(1.5*ResPT)) X#define MAG9_RAD ((int)(1.0*ResPT)) X#define MAG10_RAD ((int)(0.5*ResPT)) X#define MAG11_RAD ((int)(0.5*ResPT)) X#define MAG12_RAD ((int)(0.5*ResPT)) X#define MAG13_RAD ((int)(0.5*ResPT)) X#define MAG14_RAD ((int)(0.5*ResPT)) X#define MAG15_RAD ((int)(0.5*ResPT)) X#define MAG16_RAD ((int)(0.5*ResPT)) X#define MAG17_RAD ((int)(0.5*ResPT)) X#define MAG18_RAD ((int)(0.5*ResPT)) X#define MAG19_RAD ((int)(0.5*ResPT)) X#define MAG20_RAD ((int)(0.5*ResPT)) X X#define MAG_NUMMAGS 40 X/* Large enough to hold to mag. 40 */ X X/* Many things break if MAG_BRIGHT != -1; sorry, Sirius */ X#define MAG_BRIGHT -1 X#define MAG_DIM 20 X Xstatic int magsizes[MAG_NUMMAGS]; /* Set in D_control_arg */ X X/* mag10: 10 refers to 1/10th magnitude binning */ X#define MAG_10_NUMMAGS MAG_NUMMAGS*10 + 1 Xstatic int mag10sizes[MAG_10_NUMMAGS]; X X/* For Young's formula */ Xstatic double young_k = 0.11; Xstatic double young_D0 = 0.5 * ResPT; Xstatic double young_v0 = 10.0; Xstatic int use_v0 = FALSE; Xstatic int use_young = FALSE; X X/* Notebook mode controls */ X/* number of eyepiece/finder views */ X#define NOTE_NUMVIEWS 20 Xstatic double viewrad[NOTE_NUMVIEWS]; Xstatic int numviews; Xstatic int notebook_mode = FALSE; X X/* brightest and faintest magnitudes used in first map */ Xstatic double brightest_used = 100.0, faintest_used = -1.0; X/* used in legend */ X X/* shift thumbscale map magnitude */ Xstatic double thumbshift = 0.0; X X#ifndef MAXPATHLEN X#define MAXPATHLEN 1025 X#endif X Xstatic char filname[MAXPATHLEN] = ""; Xstatic FILE *set_out_file = NULL; Xstatic FILE *outf; X X X#define S_UNDEF -1 X#define S_MOVE 1 X#define S_LINE 2 X#define S_AREA 3 X X/* Status variables */ Xstatic int cur_colr = -1; Xstatic int c_font = -1, c_size = -1; Xstatic char *c_fname = "/Times-Roman"; Xstatic int vecstate = S_UNDEF; Xstatic int cur_x = -1, cur_y = -1; Xstatic int cur_sty = SOLID; Xstatic char *c_sty_str = "st"; X X X/* Exports */ X X/* 7 x 10 inch, half inch on bottom + 1/4 in. offset, X leave 3/8 inch on right with 1/8 on left */ X/* The variables in the first few lines MUST be set by driver */ Xmapwindow fullpage = { X 7*72*ResPT, 720*ResPT, (9+18)*ResPT, (18+36)*ResPT, X /* width, height, x and y offsets */ X 8.0, 3.0, 2.05, /* default limiting mags for glyph, name, label */ X X/* The next several variables SHOULD be set by the driver, X but are only used by the driver */ X FULLPAGEMAP, /* Type of map: THUMBNAIL may have X some restrictions */ X 0, /* May be used by driver for whatever */ X "String", /* May be used by driver for whatever */ X X/* The next several variables may be set by the driver, but the main routines X may reset them (and the driver routines may then override that) */ X SANSONS, /* Projection mode */ X FALSE, FALSE, /* Draw grids */ X 7.5, 5.0, /* grid step size */ X 0.0, 0.0, /* grid origin */ X X FALSE, /* Invert (flip north south) */ X}; X X/* 7 x 7 inch, 2.5 inch on bottom + 18 point offset */ X/* The variables in the first few lines MUST be set by driver */ Xmapwindow mainmap = { X 7*72*ResPT, 7*72*ResPT, (9+18)*ResPT,(18+180+18)*ResPT, X /* width, height, x and y offsets */ X 8.0, 3.0, 2.05, /* default limiting mags for glyph, name, label */ X X/* The next several variables SHOULD be set by the driver, X but are only used by the driver */ X MAINMAP, /* Type of map: THUMBNAIL may have X some restrictions */ X 0, /* May be used by driver for whatever */ X "String", /* May be used by driver for whatever */ X X/* The next several variables may be set by the driver, but the main routines X may reset them (and the driver routines may then override that) */ X SANSONS, /* Projection mode */ X FALSE, FALSE, /* Draw grids */ X 7.5, 5.0, /* grid step size */ X 0.0, 0.0, /* grid origin */ X X FALSE, /* Invert (flip north south) */ X}; X X X/* 3.5 x 2 inch, in bottom right */ X/* The variables in the first few lines MUST be set by driver */ Xmapwindow thumbmap = { X 252*ResPT, 2*72*ResPT, (9+18+252)*ResPT, (18+18)*ResPT, X /* width, height, x and y offsets */ X 6.2+THMADJ, 1.0+THMADJ, 2.05+THMADJ, X /* default limiting mags for glyph, name, label */ X X/* The next several variables SHOULD be set by the driver, X but are only used by the driver */ X THUMBNAIL, /* Type of map: THUMBNAIL may have X some restrictions */ X 0, /* May be used by driver for whatever */ X "String", /* May be used by driver for whatever */ X X/* The next several variables may be set by the driver, but the main routines X may reset them (and the driver routines may then override that) */ X SANSONS, /* Projection mode */ X FALSE, FALSE, /* Draw grids */ X 7.5, 5.0, /* grid step size */ X 0.0, 0.0, /* grid origin */ X X FALSE, /* Invert (flip north south) */ X}; X X/* h & v tick text controls */ Xint htick_lim = 1*ResPT; Xint htext_lim = 36*ResPT; Xint htext_xoff = 4*ResPT; Xint htext_yoff = 10*ResPT; Xint vtick_lim = 1*ResPT; Xint vtext_lim = 10*ResPT; Xint vtext_xoff = 14*ResPT; Xint vtext_yoff = 0*ResPT; X X/* Scale multiplier, minimum, X mangitude change, maximum, for thumbnail,*/ Xdouble th_smul=THSMUL; Xdouble th_smin=THSMIN; Xdouble th_madj=THMADJ; Xdouble th_mmax=THMMAX; X X X#define MAX(a,b) ((a)>(b)?(a):(b)) X#define MIN(a,b) ((a)<(b)?(a):(b)) X X Xstatic int use_fine_mag = FALSE; /* Use 10ths of magnitude */ Xstatic int color_postscript = FALSE; Xstatic int landscape = FALSE; X/* Device control argument */ XD_control_arg(s) X char *s; X{ X int i, j, k; X int c; X char *cp; X static int mags_set = FALSE; X X /* set array of magnitudes */ X if (!mags_set) { X magsizes[0] = MAG_1_RAD; X magsizes[1] = MAG0_RAD; X magsizes[2] = MAG1_RAD; X magsizes[3] = MAG2_RAD; X magsizes[4] = MAG3_RAD; X magsizes[5] = MAG4_RAD; X magsizes[6] = MAG5_RAD; X magsizes[7] = MAG6_RAD; X magsizes[8] = MAG7_RAD; X magsizes[9] = MAG8_RAD; X magsizes[10] = MAG9_RAD; X magsizes[11] = MAG10_RAD; X magsizes[12] = MAG11_RAD; X magsizes[13] = MAG12_RAD; X magsizes[14] = MAG13_RAD; X magsizes[15] = MAG14_RAD; X magsizes[16] = MAG15_RAD; X magsizes[17] = MAG16_RAD; X magsizes[18] = MAG17_RAD; X magsizes[19] = MAG18_RAD; X magsizes[20] = MAG19_RAD; X magsizes[21] = MAG20_RAD; X for (i = 22; i < MAG_NUMMAGS; i++) X magsizes[i] = MAG10_RAD; X mags_set = TRUE; X }; X X i = 0; X while (c = s[i++]) switch (c) { X case 'm': X /* m [mag-1 : mag0 : mag1 : mag2 : ...] */ X use_fine_mag = TRUE; X if (s[i]) { X cp = &s[i]; X /* Skip leading white space */ X while ((*cp == ' ') || (*cp == '\t')) { X i++; X cp++; X } X j = 0; X while (*cp) { X if (j < MAG_NUMMAGS) magsizes[j++] = atof(cp) * ResPT; X while (isdigit(*cp) || (*cp == '.')) { X i++; X cp++; X } X if (*cp) cp++; X } X for (k = j;k < MAG_NUMMAGS; k++) X magsizes[k] = magsizes[j]; X } X break; X case 'f': X /* f [file] */ X if (s[i++] == ' ') X if (s[i]) X strcpy(filname, &s[i]); X while ((s[i]) && (s[i] != ' ')) i++; X break; X case 's': X /* s [D0 [v0 [exp]]] */ X use_young = TRUE; X use_fine_mag = TRUE; X if (s[i]) { X cp = &s[i]; X /* Skip leading white space */ X while ((*cp == ' ') || (*cp == '\t')) { X i++; X cp++; X } X j = 0; X if (*cp) { X if (isdigit(*cp)) { X young_D0 = atof(cp) * ResPT; X while (isdigit(*cp) || (*cp == '.')) { X i++; X cp++; X } X if (*cp) cp++; X } X if (*cp) { X if (isdigit(*cp)) { X young_v0 = atof(cp); X use_v0 = TRUE; X while (isdigit(*cp) || (*cp == '.')) { X i++; X cp++; X } X if (*cp) cp++; X } X if (*cp) X if (isdigit(*cp)) { X young_k = atof(cp); X while (isdigit(*cp) || (*cp == '.')) { X i++; X cp++; X } X if (*cp) cp++; X } X } X } X } X break; X case 'c': X /* c */ X color_postscript = TRUE; X break; X case 'l': X /* l */ X landscape = TRUE; X chart_type = FULLPAGE; X break; X case 'n': X /* n [rad1 : rad2 : rad3 : ... ] */ X notebook_mode = TRUE; X chart_type = THREEPART; X j = 0; X if (s[i]) { X cp = &s[i]; X /* Skip leading white space */ X while ((*cp == ' ') || (*cp == '\t')) { X i++; X cp++; X } X while ((*cp) && (isdigit(*cp) || (*cp == '.'))) { X if (j < NOTE_NUMVIEWS) viewrad[j++] = atof(cp)/2.0; X /* It's input as diameter */ X while (isdigit(*cp) || (*cp == '.')) { X i++; X cp++; X } X if (*cp) cp++; X } X } X numviews = j; X default: X break; X } X} X X X/* Open the device */ XD_open() X{ X int i, j; X double young_size; X X if (filname[0] != '\0') { X set_out_file = fopen(filname, "w"); X }; X X if (set_out_file != NULL) X outf = set_out_file; X else X outf = stdout; /* WARNING: This might not work on some systems */ X X /* Need to initialize all variables */ X cur_colr = -1; X c_font = -1; X c_size = -1; X c_fname = "/Times-Roman"; X vecstate = S_UNDEF; X cur_x = -1; X cur_y = -1; X cur_sty = SOLID; X c_sty_str = "st"; X X Xout("%!PSAdobe-1.0"); Xout("%%Creator: AWPaeth@watCGL && Craig Counterman"); Xout("%%Title: StarChart"); Xout("%%Pages: 1"); Xout("%%DocumentFonts Times-Roman Times-Bold Times-Italic Helvetica Symbol"); Xout("%%BoundingBox 0 0 612 828"); Xout("%%EndComments"); Xout("%%EndProlog"); Xout("%%Page: 0 1"); Xout("%"); Xout("% alias moveto/drawto"); Xout("%"); Xout("/mt {moveto} def"); /* move to */ Xout("/lt {lineto} def"); /* line to */ Xout("% st, dt and ht are x y st --"); Xout("/st {[] 0 setdash lineto stroke newpath} def"); /* solid to */ Xfprintf(outf, X "/dt {[%d] 0 setdash lineto stroke newpath [] 0 setdash} def\n", X 1*ResPT); X /* dotted to */ Xfprintf(outf, X "/ht {[%d] 0 setdash lineto stroke newpath [] 0 setdash} def\n", X 3*ResPT); X /* hyphen to */ Xout("%"); Xout("% text operations"); Xout("%"); X/* doesn't work, since currentfont is already scaled X fprintf(outf, "/cfsize {currentfont exch %d mul scalefont setfont} def\n", ResPT);*/ Xout("% key fontsz --"); Xfprintf(outf, "/fontsz {findfont exch %d mul scalefont setfont} def\n", ResPT); Xout("% Show with extra spaces between words: string lbshw --"); Xout("/lbshw {5 0 8#040 4 3 roll widthshow} def"); Xout("% stroke white around filled letters: string obshw --"); Xout("/obshw {gsave dup false charpath 1 setgray 5 setlinewidth stroke"); Xout(" grestore true charpath fill} def"); X X/* Not used Xout("/cshow {dup stringwidth pop 2 div neg 0 rmoveto show} def"); Xout("/rshow {dup stringwidth pop neg 0 rmoveto show} def"); X*/ Xout("% use symbol font for star label: string gshow --"); Xout("/gshow {currentfont exch"); Xfprintf(outf, " /Symbol findfont %d scalefont setfont obshw setfont} def\n", X 10*ResPT); X Xout("%"); Xout("% star/planet macros"); Xout("%"); Xout("% move relative to x1 x2 and draw to x2 y2 : x1 y1 x2 y2 movereldraw --"); Xout("/movereldraw {newpath 4 2 roll mt rlineto [] 0 setdash stroke} def"); Xout("% draw dash from -dx to +dx at x y: x y dx starminus --"); Xout("/starminus {3 copy 0 movereldraw neg 0 movereldraw} def"); Xout("% draw plus sign size dx at x y: x y dx starplus --"); Xout("/starplus {3 copy 0 movereldraw 3 copy neg 0 movereldraw"); Xout( " 3 copy 0 exch movereldraw 0 exch neg movereldraw} def"); Xout("% draw circle diameter r at x y: x y r starcirc --"); Xout("/starcirc {newpath 0 360 arc closepath stroke} def"); Xout("% draw filled circle diameter r at x y: x y r starbody --"); Xout("/starbody {newpath 0 360 arc closepath fill} def"); X/*fprintf(outf, "/starbodyvar {3 copy %d add starcirc starbody} def\n", X (int) (.25 * ResPT));*/ Xout("% draw circle diameter r at x y: x y r starbodyvar --"); Xout("/starbodyvar {starcirc} def\n"); Xout("% draw dash and filled circle diameter r at x y: x y r starbodydbl --"); Xout("/starbodydbl {3 copy dup 3 div add starminus starbody} def"); Xout("%"); Xout("% make r larger and set white: x y r back x y r x y (r+dr)"); Xfprintf(outf, "/back {3 copy %d add 1 setgray} def\n", (int) (.5 * ResPT)); X if (color_postscript) { X out("% set r g and b, and set rgbcolor"); X out("/srgb {/r exch def /g exch def /b exch def r g b setrgbcolor} def\n"); X }; X out("% set foreground drawing color"); X if (color_postscript) X out("/fore {r g b setrgbcolor} def"); X else X out("/fore {0 setgray} def"); X Xout("% normal star: x y r s --"); Xout("/s {back starbody fore starbody} def"); Xout("% double star: x y r s --"); Xout("/d {back starbodydbl fore starbodydbl} def"); Xout("% variable star: x y r s --"); Xout("/v {back starbodyvar fore starbodyvar} def"); X X/* define integral magnitudes */ Xfprintf(outf, "/s_1 {%d s} def\n", MAG_1_RAD); Xfprintf(outf, "/d_1 {%d d} def\n", MAG_1_RAD); Xfprintf(outf, "/v_1 {%d v} def\n", MAG_1_RAD); Xfprintf(outf, "/s0 {%d s} def\n", MAG0_RAD); Xfprintf(outf, "/d0 {%d d} def\n", MAG0_RAD); Xfprintf(outf, "/v0 {%d v} def\n", MAG0_RAD); Xfprintf(outf, "/s1 {%d s} def\n", MAG1_RAD); Xfprintf(outf, "/d1 {%d d} def\n", MAG1_RAD); Xfprintf(outf, "/v1 {%d v} def\n", MAG1_RAD); Xfprintf(outf, "/s2 {%d s} def\n", MAG2_RAD); Xfprintf(outf, "/d2 {%d d} def\n", MAG2_RAD); Xfprintf(outf, "/v2 {%d v} def\n", MAG2_RAD); Xfprintf(outf, "/s3 {%d s} def\n", MAG3_RAD); Xfprintf(outf, "/d3 {%d d} def\n", MAG3_RAD); Xfprintf(outf, "/v3 {%d v} def\n", MAG3_RAD); Xfprintf(outf, "/s4 {%d s} def\n", MAG4_RAD); Xfprintf(outf, "/d4 {%d d} def\n", MAG4_RAD); Xfprintf(outf, "/v4 {%d v} def\n", MAG4_RAD); Xfprintf(outf, "/s5 {%d s} def\n", MAG5_RAD); Xfprintf(outf, "/d5 {%d d} def\n", MAG5_RAD); Xfprintf(outf, "/v5 {%d v} def\n", MAG5_RAD); Xfprintf(outf, "/s6 {%d s} def\n", MAG6_RAD); Xfprintf(outf, "/d6 {%d d} def\n", MAG6_RAD); Xfprintf(outf, "/v6 {%d v} def\n", MAG6_RAD); Xfprintf(outf, "/s7 {%d s} def\n", MAG7_RAD); Xfprintf(outf, "/d7 {%d d} def\n", MAG7_RAD); Xfprintf(outf, "/v7 {%d v} def\n", MAG7_RAD); Xfprintf(outf, "/s8 {%d s} def\n", MAG8_RAD); Xfprintf(outf, "/d8 {%d d} def\n", MAG8_RAD); Xfprintf(outf, "/v8 {%d v} def\n", MAG8_RAD); Xfprintf(outf, "/s9 {%d s} def\n", MAG9_RAD); Xfprintf(outf, "/d9 {%d d} def\n", MAG9_RAD); Xfprintf(outf, "/v9 {%d v} def\n", MAG9_RAD); Xfprintf(outf, "/s10 {%d s} def\n", MAG10_RAD); Xfprintf(outf, "/d10 {%d d} def\n", MAG10_RAD); Xfprintf(outf, "/v10 {%d v} def\n", MAG10_RAD); Xfprintf(outf, "/s11 {%d s} def\n", MAG11_RAD); Xfprintf(outf, "/d11 {%d d} def\n", MAG11_RAD); Xfprintf(outf, "/v11 {%d v} def\n", MAG11_RAD); Xfprintf(outf, "/s12 {%d s} def\n", MAG12_RAD); Xfprintf(outf, "/d12 {%d d} def\n", MAG12_RAD); Xfprintf(outf, "/v12 {%d v} def\n", MAG12_RAD); Xfprintf(outf, "/s13 {%d s} def\n", MAG13_RAD); Xfprintf(outf, "/d13 {%d d} def\n", MAG13_RAD); Xfprintf(outf, "/v13 {%d v} def\n", MAG13_RAD); Xfprintf(outf, "/s14 {%d s} def\n", MAG14_RAD); Xfprintf(outf, "/d14 {%d d} def\n", MAG14_RAD); Xfprintf(outf, "/v14 {%d v} def\n", MAG14_RAD); Xfprintf(outf, "/s15 {%d s} def\n", MAG15_RAD); Xfprintf(outf, "/d15 {%d d} def\n", MAG15_RAD); Xfprintf(outf, "/v15 {%d v} def\n", MAG15_RAD); Xfprintf(outf, "/s16 {%d s} def\n", MAG16_RAD); Xfprintf(outf, "/d16 {%d d} def\n", MAG16_RAD); Xfprintf(outf, "/v16 {%d v} def\n", MAG16_RAD); Xfprintf(outf, "/s17 {%d s} def\n", MAG17_RAD); Xfprintf(outf, "/d17 {%d d} def\n", MAG17_RAD); Xfprintf(outf, "/v17 {%d v} def\n", MAG17_RAD); Xfprintf(outf, "/s18 {%d s} def\n", MAG18_RAD); Xfprintf(outf, "/d18 {%d d} def\n", MAG18_RAD); Xfprintf(outf, "/v18 {%d v} def\n", MAG18_RAD); Xfprintf(outf, "/s19 {%d s} def\n", MAG19_RAD); Xfprintf(outf, "/d19 {%d d} def\n", MAG19_RAD); Xfprintf(outf, "/v19 {%d v} def\n", MAG19_RAD); Xfprintf(outf, "/s20 {%d s} def\n", MAG20_RAD); Xfprintf(outf, "/d20 {%d d} def\n", MAG20_RAD); Xfprintf(outf, "/v20 {%d v} def\n", MAG20_RAD); X X /* Thumbshift */ X if ((numwins == 2) && (mapwin[1]->map_type == THUMBNAIL)) { X thumbshift = mapwin[0]->maglim - MIN(th_mmax, X mapwin[1]->maglim - th_madj); X } X X X if (use_fine_mag) { X /* use fine (continuous) magnitude scale */ X X if (use_young) { X /* set magsizes according to Young's formula, X Sky and Telescope, March 1990, p. 311 */ X if (!use_v0) young_v0 = mapwin[0]->maglim; X for (i = 0; i < MAG_10_NUMMAGS; i++) { X /* magsizes[i] is for magnitude (i - 1) */ X /* brightest mag10sizes is for mag -1.0 */ X young_size = young_D0 * exp(log(10.0)*young_k*(young_v0 - (i/10.0-1))); X if (young_size < 1) young_size = 1; X mag10sizes[i] = (int) (young_size + 0.5); X } X } else { X for (i = 0; i < (MAG_NUMMAGS-1); i++) X for (j = 0; j < 10; j++) X mag10sizes[i*10 + j] = X magsizes[i] - j*(magsizes[i] - magsizes[i+1])/10.0; X mag10sizes[(MAG_NUMMAGS-1)*10] = magsizes[MAG_NUMMAGS-1]; X } X X#ifdef USE_FINE_MACROS X /* set macros: Only if you have lots of printer memory */ X k = 0; X for (i = MAG_BRIGHT; i < MAG_DIM; i++) X for (j = 0; j < 10; j++) { X if ((i*10 + j) < 0) { X fprintf(outf, "/ss_%02d {%d s} def\n", - (i*10 + j), mag10sizes[k]); X fprintf(outf, "/sd_%02d {%d d} def\n", - (i*10 + j), mag10sizes[k]); X fprintf(outf, "/sv_%02d {%d v} def\n", - (i*10 + j), mag10sizes[k]); X } else { X fprintf(outf, "/ss%02d {%d s} def\n", i*10 + j, mag10sizes[k]); X fprintf(outf, "/sd%02d {%d v} def\n", i*10 + j, mag10sizes[k]); X fprintf(outf, "/sv%02d {%d d} def\n", i*10 + j, mag10sizes[k]); X } X k++; X } X i = MAG_DIM; X j = 0; X if ((i*10 + j) < 0) { X fprintf(outf, "/ss_%02d {%d s} def\n", - (i*10 + j), mag10sizes[k]); X fprintf(outf, "/sd_%02d {%d d} def\n", - (i*10 + j), mag10sizes[k]); X fprintf(outf, "/sv_%02d {%d v} def\n", - (i*10 + j), mag10sizes[k]); X } else { X fprintf(outf, "/ss%02d {%d s} def\n", i*10 + j, mag10sizes[k]); X fprintf(outf, "/sd%02d {%d v} def\n", i*10 + j, mag10sizes[k]); X fprintf(outf, "/sv%02d {%d d} def\n", i*10 + j, mag10sizes[k]); X } X#endif X X } X X Xout("%"); Xout("% non-stellar object macros (better designs most welcome)"); X/* thanks to phk@kpd.dk */ Xout("/stdsh0 { [] 0 setdash } def"); X /* set dash zero: solid line */ X X /* macros are all x y size macro - */ X /* The first three lines, and the last grestore of most of the macros X set things up so the middle lines need only worry about a X region of +/- 1 square (or +/- 2, for some) */ Xout("% all but comet and moon take x y diam,"); Xout("% comet takes x y diam position-angle,"); Xout("% and moon takes x y diam phase pa-of-bright-limb"); Xout("% all leave nothing on the stack"); Xout("/planet { 2.4 div dup /sze exch def neg /nsze exch def"); Xout(" 2 copy stdsh0 sze starcirc sze 1.2 mul starplus} def"); Xout("/mercury { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 2 0 360 arc stroke"); Xout(" newpath 0 1 .4 180 0 arc .5 .1 moveto"); Xout(" 0 .1 .5 0 360 arc 0 -.4 moveto"); Xout(" 0 -1 lineto -.3 -.7 moveto .3 -.7 lineto stroke"); Xout(" grestore} def"); Xout("/venus { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 2 0 360 arc stroke"); Xout(" newpath 0 .4 .5 0 360 arc 0 .1 moveto 0 -.9 lineto -.4 -.55 moveto"); Xout(" .4 -.55 lineto stroke grestore } def"); Xout("/mars { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 2 0 360 arc stroke"); Xout(" newpath -.2 -.2 .6 0 405 arc"); Xout(" .7 .7 lineto 0 -.5 rmoveto 0 .5 rlineto"); Xout(" -.5 0 rlineto stroke grestore} def"); Xout("/jupiter { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 2 0 360 arc stroke"); Xout(" newpath .5 -.9 moveto .5 .9 lineto .9 -.5 moveto -.7 -.5 lineto"); Xout(" .2 -.5 .2 .4 .8 arcto pop pop pop pop .2 .4 lineto"); Xout(" .1 .9 -.4 .6 .4 arcto pop pop pop pop -.4 .6 lineto"); Xout(" -.8 .4 -.5 .2 .3 arcto pop pop pop pop"); Xout(" stroke grestore} def"); Xout("/saturn { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 2 0 360 arc stroke"); Xout(" newpath -.5 -.7 moveto -.5 1 lineto -.8 1 moveto -.2 1 lineto"); Xout(" -.5 0 moveto -.3 .3 0 .3 .6 arcto pop pop pop pop 0 .3 lineto"); Xout(" .5 .3 .4 -.1 .4 arcto pop pop pop pop .4 -.1 lineto .3 -.6 lineto"); Xout(" .3 -1.5 .7 -.8 .2 arcto pop pop pop pop .7 -.8 lineto"); Xout(" stroke grestore} def"); Xout("/uranus { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 2 0 360 arc stroke"); Xout(" newpath -1 1 moveto -1 -1 lineto 1 1 moveto 1 -1 lineto stroke"); Xout(" -1 0 moveto 1 0 lineto stroke"); Xout(" 0 1 moveto 0 -1 lineto stroke"); Xout(" 0 -1.3 .3 0 360 arc stroke"); Xout(" grestore } def"); Xout("/neptune { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 2 0 360 arc stroke"); Xout(" newpath 0 -.9 moveto"); Xout(" 0 .8 lineto -.8 .8 moveto -.7 .5 lineto -.7 0 lineto .7 0 lineto"); Xout(" .7 .5 lineto .8 .8 lineto -.5 -.5 moveto"); Xout(" .5 -.5 lineto stroke grestore} def"); Xout("/pluto { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 2 0 360 arc stroke"); Xout(" newpath -1 1 moveto -1 -1 lineto .5 -1 lineto stroke"); Xout(" -1 1 moveto 0 1 lineto -1 0 moveto 0 0 lineto stroke"); Xout(" 0 .5 .5 270 90 arc stroke"); Xout(" grestore} def"); Xout("/sun { 2 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 1 0 360 arc stroke"); Xout(" 0 0 .2 0 360 arc fill grestore } def"); X/* Moon takes x y size phase: x y size phase moon - */ Xout("/moon { /chi exch def /phase exch def 2 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath [.1 .2] 0 setdash 0 0 1 0 360 arc stroke"); Xout(" stdsh0 gsave"); Xout(" chi rotate"); Xout(" newpath\n"); Xout(" 0 0 1 0 180 arcn"); Xout(" 1 phase cos scale"); Xout(" 0 0 1 180 360 arc fill"); Xout(" grestore grestore } def"); Xout("/asteroid { 4 div dup /sze exch def neg /nsze exch def"); Xout(" 2 copy stdsh0 newpath sze 3 div 0 360 arc closepath fill"); Xout(" moveto sze sze rmoveto nsze 2 mul nsze 2 mul rlineto"); Xout(" sze 2 mul 0 rmoveto nsze 2 mul sze 2 mul rlineto stroke } def"); X/* Comet takes x y size position-angle: x y size position-angle comet - */ Xout("/comet { 2 div dup /sze exch def neg /nsze exch def /phase exch def"); Xout(" moveto gsave currentpoint translate sze dup scale"); Xout(" .1 setlinewidth"); Xout(" 90 phase sub rotate stdsh0 newpath 0 0 .3 0 360 arc stroke"); Xout(" 0 .3 moveto 1 .5 lineto 0 -.3 moveto 1 -.5 lineto"); Xout(" .3 0 moveto 1.2 0 lineto"); Xout(" stroke grestore } def"); Xout("/nebulad { 2 div dup /sze exch def neg /nsze exch def stdsh0"); Xout(" newpath moveto sze 0 rmoveto nsze nsze rlineto nsze sze rlineto"); Xout(" sze sze rlineto sze nsze rlineto stroke } def"); Xout("/nebulap { 4 div /sze exch def moveto"); Xout(" gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 0 1 0 360 arc stroke"); Xout(" newpath 2 0 moveto 1 0 lineto -1 0 moveto -2 0 lineto"); Xout(" 0 2 moveto 0 1 lineto 0 -1 moveto 0 -2 lineto stroke"); Xout(" grestore} def"); Xout("/nebula {nebulad} def"); Xout("/galaxye { 2 div dup /sze exch def neg /nsze exch def"); Xout(" gsave stdsh0 newpath translate -30 rotate 1 .5 scale"); Xout(" 0 0 sze 0 360 arc closepath fill"); Xout(" grestore } def"); Xout("/galaxys { 2 div dup /sze exch def neg /nsze exch def"); Xout(" gsave stdsh0 newpath translate -30 rotate 1 .5 scale"); Xout(" 0 0 sze 0 360 arc closepath fill"); Xout(" nsze 1.25 mul nsze moveto nsze 0 lineto sze 1.25 mul sze moveto"); Xout(" sze 0 lineto stroke grestore } def"); Xout("/galaxyq { 2 div dup /sze exch def neg /nsze exch def"); Xout(" gsave stdsh0 newpath translate"); Xout(" nsze 0 moveto sze 0 lineto 0 nsze moveto 0 sze lineto stroke"); Xout(" -30 rotate 1 .5 scale 0 0 sze 0 360 arc closepath fill"); Xout(" grestore } def"); Xout("/galaxy {galaxye} def"); Xout("/clustero { 2 div dup /sze exch def neg /nsze exch def"); Xout(" 2 copy newpath 1 setgray sze 0 360 arc fill"); Xfprintf(outf, X " [%d %d] 0 setdash 0 setgray sze 0 360 arc stroke stdsh0 } def\n", X 1*ResPT, 2*ResPT); Xout("/clusterg { 2 div dup /sze exch def neg /nsze exch def"); Xout(" 2 copy 2 copy newpath 1 setgray sze 0 360 arc fill"); Xfprintf(outf, " [%d %d] 0 setdash 0 setgray sze 0 360 arc stroke\n", X 1*ResPT, 2*ResPT); Xout(" 3 0 360 arc closepath fill stdsh0 } def"); Xout("/cluster {clustero} def"); Xout("/unknown_u { 2 div /sze exch def moveto gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" newpath 0 .5 .5 180 270 arcn stroke"); Xout(" 0 0 moveto 0 -1 lineto stroke"); Xout(" grestore} def"); Xout("/other_o { 2 div /sze exch def moveto gsave currentpoint translate"); Xout(" sze dup scale .1 setlinewidth"); Xout(" 1 1 moveto -1 -1 lineto -1 1 moveto 1 -1 lineto stroke"); Xout(" 0 1 moveto 1 0 lineto 0 -1 lineto -1 0 lineto 0 1 lineto stroke"); Xout(" grestore} def"); Xout("%"); Xout("%"); X X if (notebook_mode) { X out("%notebook mode"); X out("24 0 translate"); X numwins = 1; X }; X X if (landscape) { X out("%landscape mode"); X out("612 0 translate"); X out("90 rotate"); X i = fullpage.width; X fullpage.width = fullpage.height; X fullpage.height = i; X/* i = fullpage.x_offset; X fullpage.x_offset = fullpage.y_offset; X fullpage.y_offset = i;*/ X } Xfprintf(outf, "1 %d div dup scale\n", ResPT); Xout("% alter line drawing defaults, guarentee solid black lines"); Xout("1 setlinewidth 2 setlinecap"); Xout("[] 0 setdash 0 setgray"); Xout("%"); Xout("% boiler-plate"); Xout("%"); Xout("% Set a font"); XD_fontsize(18, TIMESROMAN); X/*out("18 /Times-Roman fontsz");*/ Xout("%"); Xout("%"); Xout("% THE STUFF"); Xout("%"); Xreturn TRUE ; /* open successful */ X} X Xout(s) X char *s; X{ X fprintf(outf, "%s\n", s); X} X X/* Close the device */ XD_close() X{ X out("showpage"); X out("%"); X out("%%Trailer"); X out("%%Pages: 1"); X fflush(outf); X fclose(outf); X} X X X X/* Xint vecstate = S_UNDEF; Xint cur_x = -1, cur_y = -1; Xint cur_sty = SOLID; Xchar *c_sty_str = "st"; X*/ X/* In postscript, we want to move to the beginning of a line with moveto (mt), X then move from point to point with lineto (lt), X then end the line when either the style changes X or we're moving to a new start point [This is not really X necessary, but if too many lt's are done, it probably X will overload the printer] X ending the line consists of calling (st),(dt),or (ht) X depending on the current style */ X X/* Move to (x, y) */ XD_move(x, y) X int x, y; X{ X/* fprintf(outf, "%%move %d %d\n", x, y);*/ X X if (vecstate != S_LINE) { /* not drawing line now */ X if ((x != cur_x) || (y != cur_y)) { /* otherwise nothing needed */ X fprintf(outf, "%d %d mt\n", x, y); X } X } else { /* drawing line, finish it then move */ X fprintf(outf, "%d %d %s\n", cur_x, cur_y, c_sty_str); X fprintf(outf, "%d %d mt\n", x, y); X } X cur_x = x; X cur_y = y; X vecstate = S_MOVE; 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 */ XD_draw(x, y, line_style) X int x, y; X int line_style; /* SOLID, DOTTED, DASHED, etc. */ X{ X int sty; X X/* fprintf(outf, "%%draw %d %d %d\n", x, y, line_style);*/ X X if ((x != cur_x) || (y != cur_y) || (line_style != cur_sty)) { X switch(cur_function) { X case CHRTOUTLN: X case CHRTHTICK: X case CHRTVTICK: X sty = SOLID; X break; X case GRID_RA: X case GRID_DEC: X sty = DOTTED; X break; X case ECLIPT: X sty = DOTTED; X break; X case CONSTBOUND: X sty = DASHED; X break; X case CONSTPATTRN: X sty = SOLID; X break; X case CONSTNAME: X case CHARTFILE: X default: X sty = line_style; X break; X } X X if (vecstate == S_UNDEF) { /* currentpoint not defined. X move to start point */ X fprintf(outf, "%d %d mt\n", cur_x, cur_y); X vecstate = S_MOVE; X } X X X if (sty == cur_sty) { /* Continue current line, style */ X fprintf(outf, "%d %d lt\n", x, y); X vecstate = S_LINE; X } else { /* Change style */ X /* Finish current line */ X fprintf(outf, "%d %d %s\n", cur_x, cur_y, c_sty_str); X /* Move to last point */ X fprintf(outf, "%d %d mt\n", cur_x, cur_y); X X /* Switch styles */ X switch(sty) { X case SOLID: X c_sty_str = "st"; X break; X case DOTTED: X c_sty_str = "dt"; X break; X case DASHED: X c_sty_str = "ht"; X break; X case VECSOLID: X c_sty_str = "st"; X break; X case VECDOT: X c_sty_str = "dt"; X break; X case VECDASH: X c_sty_str = "ht"; X break; X default: X c_sty_str = "st"; X break; X } X cur_sty = sty; X fprintf(outf, "%d %d lt\n", x, y); X vecstate = S_LINE; X } X cur_x = x; X cur_y = y; X } X} X/* This routine is encouraged to look at the extern cur_funtion X and change the line style drawn as desired */ X X X/* Move to (x1, y1) then draw a line of style line_style to (x2, y2) */ XD_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 Xstatic struct {int x,y;} areapts[1000]; Xstatic int nareapts; X/* Move to (x, y) to begin an area */ XD_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 */ XD_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 */ XD_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 fprintf(outf, "%d %d lt\n", areapts[i].x, areapts[i].y); X fprintf(outf, "fill newpath\n"); X X vecstate = S_UNDEF; X} X X X X X#define BLACK 0 X#define WHITE 1 X#define RED 2 X#define ORANGE 3 X#define YELLOW 4 X#define GREEN 5 X#define CYAN 6 X#define BLUE 7 X#define VIOLET 8 X#define BLUE_WHITE 9 X X/* Set the color to be used for lines and text */ X/* color_str is a 2 char (+ '\0') string containing X a specification for a color, X 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 X the device driver */ X/* static int cur_colr = -1; X*/ XD_color(color_str) X char *color_str; X{ X int colr; X int class, subclass; X static char *table = "OBAFGKMRNSrgbycpow"; X static int super_spectra[][10] = { X /* 0 1 2 3 4 5 6 7 8 9 */ X /* O */ { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 }, X /* B */ { 0, 1, 2, 3, 3, 4, 4, 4, 5, 6 }, X /* A */ { 7, 7, 8, 9, 9, 10, 10, 10, 10, 10 }, X /* F */ { 11, 11, 12, 12, 12, 13, 13, 13, 14, 14 }, X /* G */ { 15, 15, 15, 15, 15, 16, 16, 16, 16, 16 }, X /* K */ { 17, 17, 18, 18, 18, 19, 19, 19, 19, 19 }, X /* M */ { 20, 20, 21, 22, 23, 24, 25, 26, 26, 26 }, X /* R */ { 27, 27, 27, 28, 28, 28, 28, 28, 29, 30 }, X /* N */ { 27, 27, 27, 28, 28, 28, 28, 28, 29, 30 }, X /* S */ { 30, 30, 30, 30, 31, 31, 31, 31, 31, 31 }, X /* r */ { 33, 33, 33, 34, 34, 34, 35, 35, 35, 36 }, X /* y */ { 37, 37, 37, 38, 38, 38, 39, 39, 39, 40 }, X /* g */ { 41, 41, 41, 42, 42, 42, 43, 43, 43, 44 }, X /* c */ { 45, 45, 45, 46, 46, 46, 47, 47, 47, 48 }, X /* b */ { 49, 49, 49, 50, 50, 50, 51, 51, 51, 52 }, X /* p */ { 53, 53, 53, 54, 54, 54, 55, 55, 55, 56 }, X /* o */ { 57, 57, 57, 58, 58, 58, 59, 59, 59, 60 }, X /* w */ { 61, 61, 61, 62, 62, 62, 63, 63, 63, 64 } X }; X X static struct {double r, g, b;} ctab[] = { END_OF_FILE if test 34495 -ne `wc -c <'starchart/spo.c.aa'`; then echo shar: \"'starchart/spo.c.aa'\" unpacked with wrong size! fi # end of 'starchart/spo.c.aa' fi echo shar: End of archive 26 \(of 32\). cp /dev/null ark26isdone MISSING="" for I in 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 32 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 32 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0