home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume11 / starchart / part26 < prev    next >
Encoding:
Text File  |  1990-03-25  |  36.4 KB  |  1,148 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v11i054: starchart 3.2 Part 26/32
  3. from: ccount@ATHENA.MIT.EDU
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 11, Issue 54
  7. Submitted-by: ccount@ATHENA.MIT.EDU
  8. Archive-name: starchart/part26
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 26 (of 32)."
  17. # Contents:  starchart/spo.c.aa
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'starchart/spo.c.aa' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'starchart/spo.c.aa'\"
  21. else
  22. echo shar: Extracting \"'starchart/spo.c.aa'\" \(34495 characters\)
  23. sed "s/^X//" >'starchart/spo.c.aa' <<'END_OF_FILE'
  24. X/*
  25. X * PostScript file format driver for startchart.c mainline
  26. X */
  27. X
  28. X/*
  29. X ! patched December, 1987 by Alan Paeth (awpaeth@watcgl),
  30. X ! based on revisions by Craig Counterman (email: ccount@athena.mit.edu)
  31. X !
  32. X ! [1] "bigmaster" chart layout now added
  33. X ! [2] extensive rework and subclassing of non-stellar objects, e.g.
  34. X !     galaxies, now have both spiral and irregular variants.
  35. X ! [3] star sizes now extended to magnitude 10
  36. X ! [4] white halo-ing of text overlays (by analogy to star haloing)
  37. X !
  38. X * Modified for starchart 3.0.  Craig Counterman Jan, 1989
  39. X *
  40. X * size changed:
  41. X *   8 x 11 inch field, in units of 1/ResPT th of a point
  42. X *   offset 1/4 inch = 18*ResPT
  43. X *
  44. X * Portions Copyright (c) 1987 by Alan Paeth (awpaeth@watcgl)
  45. X *
  46. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  47. X *
  48. X * This software may be redistributed freely, not sold.
  49. X * This copyright notice and disclaimer of warranty must remain
  50. X *    unchanged. 
  51. X *
  52. X * No representation is made about the suitability of this
  53. X * software for any purpose.  It is provided "as is" without express or
  54. X * implied warranty, to the extent permitted by applicable law.
  55. X *
  56. X */
  57. X
  58. X
  59. Xstatic char rcsid[]="$Header: starpost.c,v 2.19 90/03/09 19:13:30 ccount Exp $";
  60. X#include <stdio.h>
  61. X#include <math.h>
  62. X#ifndef SYSV
  63. X#include <strings.h>
  64. X#else
  65. X#include <string.h>
  66. X#endif
  67. X#include <ctype.h>
  68. X#include "star3.h"
  69. X
  70. X
  71. X/* Externs */
  72. Xextern int g_argc;
  73. Xextern char **g_argv;
  74. X
  75. Xextern char *title;    /* Title of page */
  76. X
  77. Xextern mapwindow *mapwin[MAXWINDOWS];
  78. Xextern int numwins;
  79. X
  80. Xextern int cur_function;
  81. Xextern int cur_map_type;
  82. Xextern int cur_map_tag;
  83. Xextern char *cur_tag_field;
  84. Xextern mapwindow *cur_win;
  85. X
  86. Xextern int chart_type;
  87. X
  88. X/* Set by initxform
  89. X   One could use elements of the mapwindow structure,
  90. X   but these should be faster for the current window */
  91. Xextern double xf_west, xf_east, xf_north, xf_south, xf_bottom;
  92. Xextern int xf_xcen, xf_ycen, xf_ybot;
  93. Xextern int xf_w_left, xf_w_right, xf_w_top, xf_w_bot;
  94. Xextern double xf_c_scale;
  95. X
  96. X/* Scale multiplier, minimum,
  97. X   mangitude change, maximum, for thumbnail,*/
  98. X#define THSMUL 1.2
  99. X#define THSMIN 12.0
  100. X#define THMADJ 2.5
  101. X#define THMMAX 8.0
  102. X
  103. X
  104. X#define ResPT 4
  105. X#define InchPT 72*ResPT
  106. X
  107. X#define MAG_1_RAD 9*ResPT
  108. X#define MAG0_RAD ((int)(8*ResPT))
  109. X#define MAG1_RAD ((int)(7*ResPT))
  110. X#define MAG2_RAD ((int)(6*ResPT))
  111. X/*  if MAG3 is not an integer times ResPT,
  112. X    there is an error reported later using some (non-ansi) compilers */
  113. X#define MAG3_RAD ((int)(5*ResPT))
  114. X#define MAG4_RAD ((int)(4*ResPT))
  115. X#define MAG5_RAD ((int)(3.25*ResPT))
  116. X#define MAG6_RAD ((int)(2.5*ResPT))
  117. X#define MAG7_RAD ((int)(2.0*ResPT))
  118. X#define MAG8_RAD ((int)(1.5*ResPT))
  119. X#define MAG9_RAD ((int)(1.0*ResPT))
  120. X#define MAG10_RAD ((int)(0.5*ResPT))
  121. X#define MAG11_RAD ((int)(0.5*ResPT))
  122. X#define MAG12_RAD ((int)(0.5*ResPT))
  123. X#define MAG13_RAD ((int)(0.5*ResPT))
  124. X#define MAG14_RAD ((int)(0.5*ResPT))
  125. X#define MAG15_RAD ((int)(0.5*ResPT))
  126. X#define MAG16_RAD ((int)(0.5*ResPT))
  127. X#define MAG17_RAD ((int)(0.5*ResPT))
  128. X#define MAG18_RAD ((int)(0.5*ResPT))
  129. X#define MAG19_RAD ((int)(0.5*ResPT))
  130. X#define MAG20_RAD ((int)(0.5*ResPT))
  131. X
  132. X#define MAG_NUMMAGS 40
  133. X/* Large enough to hold to mag. 40 */
  134. X
  135. X/* Many things break if MAG_BRIGHT != -1; sorry, Sirius */
  136. X#define MAG_BRIGHT -1
  137. X#define MAG_DIM 20
  138. X
  139. Xstatic int magsizes[MAG_NUMMAGS]; /* Set in D_control_arg */
  140. X
  141. X/* mag10: 10 refers to 1/10th magnitude binning */
  142. X#define MAG_10_NUMMAGS MAG_NUMMAGS*10 + 1
  143. Xstatic int mag10sizes[MAG_10_NUMMAGS];
  144. X
  145. X/* For Young's formula */
  146. Xstatic double young_k = 0.11;
  147. Xstatic double young_D0 = 0.5 * ResPT;
  148. Xstatic double young_v0 = 10.0;
  149. Xstatic int use_v0 = FALSE;
  150. Xstatic int use_young = FALSE;
  151. X
  152. X/* Notebook mode controls */
  153. X/* number of eyepiece/finder views */
  154. X#define NOTE_NUMVIEWS 20
  155. Xstatic double viewrad[NOTE_NUMVIEWS];
  156. Xstatic int numviews;
  157. Xstatic int notebook_mode = FALSE;
  158. X
  159. X/* brightest and faintest magnitudes used in first map */
  160. Xstatic double brightest_used = 100.0, faintest_used = -1.0;
  161. X/* used in legend */
  162. X
  163. X/* shift thumbscale map magnitude */
  164. Xstatic double thumbshift = 0.0;
  165. X
  166. X#ifndef MAXPATHLEN
  167. X#define MAXPATHLEN 1025
  168. X#endif
  169. X
  170. Xstatic char filname[MAXPATHLEN] = "";
  171. Xstatic FILE *set_out_file = NULL;
  172. Xstatic FILE *outf;
  173. X
  174. X
  175. X#define S_UNDEF -1
  176. X#define S_MOVE 1
  177. X#define S_LINE 2
  178. X#define S_AREA 3
  179. X
  180. X/* Status variables */
  181. Xstatic int cur_colr = -1;
  182. Xstatic int c_font = -1, c_size = -1;
  183. Xstatic char *c_fname = "/Times-Roman";
  184. Xstatic int vecstate = S_UNDEF;
  185. Xstatic int cur_x = -1, cur_y = -1;
  186. Xstatic int cur_sty = SOLID;
  187. Xstatic char *c_sty_str = "st";
  188. X
  189. X
  190. X/* Exports */
  191. X
  192. X/* 7 x 10 inch, half inch on bottom + 1/4 in.  offset,
  193. X                leave 3/8 inch on right with 1/8 on left */
  194. X/* The variables in the first few lines MUST be set by driver */
  195. Xmapwindow fullpage = {
  196. X  7*72*ResPT, 720*ResPT, (9+18)*ResPT, (18+36)*ResPT,
  197. X                /* width, height, x and y offsets */
  198. X  8.0, 3.0, 2.05,    /* default limiting mags for glyph, name, label */
  199. X
  200. X/* The next several variables SHOULD be set by the driver,
  201. X   but are only used by the driver */
  202. X  FULLPAGEMAP,        /* Type of map: THUMBNAIL may have
  203. X               some restrictions */
  204. X  0,            /* May be used by driver for whatever */
  205. X  "String",        /* May be used by driver for whatever */
  206. X
  207. X/* The next several variables may be set by the driver, but the main routines
  208. X   may reset them (and the driver routines may then override that) */
  209. X  SANSONS,        /* Projection mode */
  210. X  FALSE, FALSE,        /* Draw grids */
  211. X  7.5, 5.0,        /* grid step size */
  212. X  0.0, 0.0,        /* grid origin */
  213. X
  214. X  FALSE,        /* Invert (flip north south) */
  215. X};
  216. X
  217. X/* 7 x 7 inch, 2.5 inch on bottom  + 18 point offset */
  218. X/* The variables in the first few lines MUST be set by driver */
  219. Xmapwindow mainmap = {
  220. X  7*72*ResPT, 7*72*ResPT, (9+18)*ResPT,(18+180+18)*ResPT,
  221. X                        /* width, height, x and y offsets */
  222. X  8.0, 3.0, 2.05,    /* default limiting mags for glyph, name, label */
  223. X
  224. X/* The next several variables SHOULD be set by the driver,
  225. X   but are only used by the driver */
  226. X  MAINMAP,        /* Type of map: THUMBNAIL may have
  227. X               some restrictions */
  228. X  0,            /* May be used by driver for whatever */
  229. X  "String",        /* May be used by driver for whatever */
  230. X
  231. X/* The next several variables may be set by the driver, but the main routines
  232. X   may reset them (and the driver routines may then override that) */
  233. X  SANSONS,        /* Projection mode */
  234. X  FALSE, FALSE,        /* Draw grids */
  235. X  7.5, 5.0,        /* grid step size */
  236. X  0.0, 0.0,        /* grid origin */
  237. X
  238. X  FALSE,        /* Invert (flip north south) */
  239. X};
  240. X
  241. X
  242. X/* 3.5 x 2 inch, in bottom right */
  243. X/* The variables in the first few lines MUST be set by driver */
  244. Xmapwindow thumbmap = {
  245. X  252*ResPT, 2*72*ResPT, (9+18+252)*ResPT, (18+18)*ResPT,
  246. X                        /* width, height, x and y offsets */
  247. X  6.2+THMADJ, 1.0+THMADJ, 2.05+THMADJ,
  248. X            /* default limiting mags for glyph, name, label */
  249. X
  250. X/* The next several variables SHOULD be set by the driver,
  251. X   but are only used by the driver */
  252. X  THUMBNAIL,        /* Type of map: THUMBNAIL may have
  253. X               some restrictions */
  254. X  0,            /* May be used by driver for whatever */
  255. X  "String",        /* May be used by driver for whatever */
  256. X
  257. X/* The next several variables may be set by the driver, but the main routines
  258. X   may reset them (and the driver routines may then override that) */
  259. X  SANSONS,        /* Projection mode */
  260. X  FALSE, FALSE,        /* Draw grids */
  261. X  7.5, 5.0,        /* grid step size */
  262. X  0.0, 0.0,        /* grid origin */
  263. X
  264. X  FALSE,        /* Invert (flip north south) */
  265. X};
  266. X
  267. X/* h & v tick text controls */
  268. Xint htick_lim = 1*ResPT;
  269. Xint htext_lim = 36*ResPT;
  270. Xint htext_xoff = 4*ResPT;
  271. Xint htext_yoff = 10*ResPT;
  272. Xint vtick_lim = 1*ResPT;
  273. Xint vtext_lim = 10*ResPT;
  274. Xint vtext_xoff = 14*ResPT;
  275. Xint vtext_yoff = 0*ResPT;
  276. X
  277. X/* Scale multiplier, minimum,
  278. X   mangitude change, maximum, for thumbnail,*/
  279. Xdouble th_smul=THSMUL;
  280. Xdouble th_smin=THSMIN;
  281. Xdouble th_madj=THMADJ;
  282. Xdouble th_mmax=THMMAX;
  283. X
  284. X
  285. X#define MAX(a,b) ((a)>(b)?(a):(b))
  286. X#define MIN(a,b) ((a)<(b)?(a):(b))
  287. X
  288. X
  289. Xstatic int use_fine_mag = FALSE;    /* Use 10ths of magnitude */
  290. Xstatic int color_postscript = FALSE;
  291. Xstatic int landscape = FALSE;
  292. X/* Device control argument */
  293. XD_control_arg(s)
  294. X     char *s;
  295. X{
  296. X  int i, j, k;
  297. X  int c;
  298. X  char *cp;
  299. X  static int mags_set = FALSE;
  300. X
  301. X  /* set array of magnitudes */
  302. X  if (!mags_set) {
  303. X    magsizes[0] = MAG_1_RAD;
  304. X    magsizes[1] = MAG0_RAD;
  305. X    magsizes[2] = MAG1_RAD;
  306. X    magsizes[3] = MAG2_RAD;
  307. X    magsizes[4] = MAG3_RAD;
  308. X    magsizes[5] = MAG4_RAD;
  309. X    magsizes[6] = MAG5_RAD;
  310. X    magsizes[7] = MAG6_RAD;
  311. X    magsizes[8] = MAG7_RAD;
  312. X    magsizes[9] = MAG8_RAD;
  313. X    magsizes[10] = MAG9_RAD;
  314. X    magsizes[11] = MAG10_RAD;
  315. X    magsizes[12] = MAG11_RAD;
  316. X    magsizes[13] = MAG12_RAD;
  317. X    magsizes[14] = MAG13_RAD;
  318. X    magsizes[15] = MAG14_RAD;
  319. X    magsizes[16] = MAG15_RAD;
  320. X    magsizes[17] = MAG16_RAD;
  321. X    magsizes[18] = MAG17_RAD;
  322. X    magsizes[19] = MAG18_RAD;
  323. X    magsizes[20] = MAG19_RAD;
  324. X    magsizes[21] = MAG20_RAD;
  325. X    for (i = 22; i < MAG_NUMMAGS; i++)
  326. X      magsizes[i] = MAG10_RAD;
  327. X    mags_set = TRUE;
  328. X  };
  329. X
  330. X  i = 0;
  331. X  while (c = s[i++]) switch (c) {
  332. X  case 'm':
  333. X    /* m [mag-1 : mag0 : mag1 : mag2 : ...] */
  334. X    use_fine_mag = TRUE;
  335. X    if (s[i]) {
  336. X      cp = &s[i];
  337. X      /* Skip leading white space */
  338. X      while ((*cp == ' ') || (*cp == '\t')) {
  339. X    i++;
  340. X    cp++;
  341. X      }
  342. X      j = 0;
  343. X      while (*cp) {
  344. X    if (j < MAG_NUMMAGS) magsizes[j++] = atof(cp) * ResPT;
  345. X    while (isdigit(*cp) || (*cp == '.')) {
  346. X      i++;
  347. X      cp++;
  348. X    }
  349. X    if (*cp) cp++;
  350. X      }
  351. X      for (k = j;k < MAG_NUMMAGS; k++)
  352. X    magsizes[k] = magsizes[j];
  353. X    }
  354. X    break;
  355. X  case 'f':
  356. X    /* f [file] */
  357. X    if (s[i++] == ' ')
  358. X      if (s[i])
  359. X    strcpy(filname, &s[i]);
  360. X    while ((s[i]) && (s[i] != ' ')) i++;
  361. X    break;
  362. X  case 's':
  363. X    /* s [D0 [v0 [exp]]] */
  364. X    use_young = TRUE;
  365. X    use_fine_mag = TRUE;
  366. X    if (s[i]) {
  367. X      cp = &s[i];
  368. X      /* Skip leading white space */
  369. X      while ((*cp == ' ') || (*cp == '\t')) {
  370. X    i++;
  371. X    cp++;
  372. X      }
  373. X      j = 0;
  374. X      if (*cp) {
  375. X    if (isdigit(*cp)) {
  376. X      young_D0 = atof(cp) * ResPT;
  377. X      while (isdigit(*cp) || (*cp == '.')) {
  378. X        i++;
  379. X        cp++;
  380. X      }
  381. X      if (*cp) cp++;
  382. X    }
  383. X    if (*cp) {
  384. X      if (isdigit(*cp)) {
  385. X        young_v0 = atof(cp);
  386. X        use_v0 = TRUE;
  387. X        while (isdigit(*cp) || (*cp == '.')) {
  388. X          i++;
  389. X          cp++;
  390. X        }
  391. X        if (*cp) cp++;
  392. X      }
  393. X      if (*cp)
  394. X        if (isdigit(*cp)) {
  395. X          young_k = atof(cp);
  396. X          while (isdigit(*cp) || (*cp == '.')) {
  397. X        i++;
  398. X        cp++;
  399. X          }
  400. X          if (*cp) cp++;
  401. X        }
  402. X    }
  403. X      }
  404. X    }
  405. X    break;
  406. X  case 'c':
  407. X    /* c */
  408. X    color_postscript = TRUE;
  409. X    break;
  410. X  case 'l':
  411. X    /* l */
  412. X    landscape = TRUE;
  413. X    chart_type = FULLPAGE;
  414. X    break;
  415. X  case 'n':
  416. X    /* n [rad1 : rad2 : rad3 : ... ] */
  417. X    notebook_mode = TRUE;
  418. X    chart_type = THREEPART;
  419. X    j = 0;
  420. X    if (s[i]) {
  421. X      cp = &s[i];
  422. X      /* Skip leading white space */
  423. X      while ((*cp == ' ') || (*cp == '\t')) {
  424. X    i++;
  425. X    cp++;
  426. X      }
  427. X      while ((*cp) && (isdigit(*cp) || (*cp == '.'))) {
  428. X    if (j < NOTE_NUMVIEWS) viewrad[j++] = atof(cp)/2.0;
  429. X                /* It's input as diameter */
  430. X    while (isdigit(*cp) || (*cp == '.')) {
  431. X      i++;
  432. X      cp++;
  433. X    }
  434. X    if (*cp) cp++;
  435. X      }
  436. X    }
  437. X    numviews = j;
  438. X  default:
  439. X    break;
  440. X  }
  441. X}
  442. X
  443. X
  444. X/* Open the device */
  445. XD_open()
  446. X{
  447. X  int i, j;
  448. X  double young_size;
  449. X
  450. X  if (filname[0] != '\0') {
  451. X    set_out_file = fopen(filname, "w");
  452. X  };
  453. X
  454. X  if (set_out_file != NULL)
  455. X    outf = set_out_file;
  456. X  else
  457. X    outf = stdout;    /* WARNING: This might not work on some systems */
  458. X
  459. X  /* Need to initialize all variables */
  460. X  cur_colr = -1;
  461. X  c_font = -1;
  462. X  c_size = -1;
  463. X  c_fname = "/Times-Roman";
  464. X  vecstate = S_UNDEF;
  465. X  cur_x = -1;
  466. X  cur_y = -1;
  467. X  cur_sty = SOLID;
  468. X  c_sty_str = "st";
  469. X
  470. X
  471. Xout("%!PSAdobe-1.0");
  472. Xout("%%Creator: AWPaeth@watCGL && Craig Counterman");
  473. Xout("%%Title: StarChart");
  474. Xout("%%Pages: 1");
  475. Xout("%%DocumentFonts Times-Roman Times-Bold Times-Italic Helvetica Symbol");
  476. Xout("%%BoundingBox 0 0 612 828");
  477. Xout("%%EndComments");
  478. Xout("%%EndProlog");
  479. Xout("%%Page: 0 1");
  480. Xout("%");
  481. Xout("% alias moveto/drawto");
  482. Xout("%");
  483. Xout("/mt {moveto} def");                /* move to */
  484. Xout("/lt {lineto} def");                /* line to */
  485. Xout("% st, dt and ht are   x y st --");
  486. Xout("/st {[] 0 setdash lineto stroke newpath} def");    /* solid to */
  487. Xfprintf(outf,
  488. X    "/dt {[%d] 0 setdash lineto stroke newpath [] 0 setdash} def\n",
  489. X    1*ResPT);
  490. X                                        /* dotted to */
  491. Xfprintf(outf,
  492. X    "/ht {[%d] 0 setdash lineto stroke newpath [] 0 setdash} def\n",
  493. X    3*ResPT);
  494. X                            /* hyphen to */
  495. Xout("%");
  496. Xout("% text operations");
  497. Xout("%");
  498. X/* doesn't work, since currentfont is already scaled
  499. X  fprintf(outf, "/cfsize {currentfont exch %d mul scalefont setfont} def\n", ResPT);*/
  500. Xout("% key fontsz --");
  501. Xfprintf(outf, "/fontsz {findfont exch %d mul scalefont setfont} def\n", ResPT);
  502. Xout("% Show with extra spaces between words: string lbshw --");
  503. Xout("/lbshw {5 0 8#040 4 3 roll widthshow} def");
  504. Xout("% stroke white around filled letters: string obshw --");
  505. Xout("/obshw {gsave dup false charpath 1 setgray 5 setlinewidth stroke");
  506. Xout("            grestore true charpath fill} def");
  507. X
  508. X/* Not used
  509. Xout("/cshow {dup stringwidth pop 2 div neg 0 rmoveto show} def");
  510. Xout("/rshow {dup stringwidth pop neg 0 rmoveto show} def");
  511. X*/
  512. Xout("% use symbol font for star label: string gshow --");
  513. Xout("/gshow {currentfont exch");
  514. Xfprintf(outf, "        /Symbol findfont %d scalefont setfont obshw setfont} def\n",
  515. X       10*ResPT);
  516. X
  517. Xout("%");
  518. Xout("% star/planet macros");
  519. Xout("%");
  520. Xout("% move relative to x1 x2 and draw to x2 y2 : x1 y1 x2 y2 movereldraw --");
  521. Xout("/movereldraw {newpath 4 2 roll mt rlineto [] 0 setdash stroke} def");
  522. Xout("% draw dash from -dx to +dx at x y:  x y dx starminus --");
  523. Xout("/starminus {3 copy 0 movereldraw neg 0 movereldraw} def");
  524. Xout("% draw plus sign size dx at x y:  x y dx starplus --");
  525. Xout("/starplus {3 copy 0 movereldraw 3 copy neg 0 movereldraw");
  526. Xout( "          3 copy 0 exch movereldraw 0 exch neg movereldraw} def");
  527. Xout("% draw circle diameter r at x y: x y r starcirc --");
  528. Xout("/starcirc {newpath 0 360 arc closepath stroke} def");
  529. Xout("% draw filled circle diameter r at x y: x y r starbody --");
  530. Xout("/starbody {newpath 0 360 arc closepath fill} def");
  531. X/*fprintf(outf, "/starbodyvar {3 copy %d add starcirc starbody} def\n",
  532. X                                                          (int) (.25 * ResPT));*/
  533. Xout("% draw circle diameter r at x y: x y r starbodyvar --");
  534. Xout("/starbodyvar {starcirc} def\n");
  535. Xout("% draw dash and filled circle diameter r at x y: x y r starbodydbl --");
  536. Xout("/starbodydbl {3 copy dup 3 div add starminus starbody} def");
  537. Xout("%");
  538. Xout("% make r larger and set white: x y r back x y r x y (r+dr)");
  539. Xfprintf(outf, "/back {3 copy %d add 1 setgray} def\n", (int) (.5 * ResPT));
  540. X  if (color_postscript) {
  541. X    out("% set r g and b, and set rgbcolor");
  542. X    out("/srgb {/r exch def /g exch def /b exch def r g b setrgbcolor} def\n");
  543. X  };
  544. X  out("% set foreground drawing color");
  545. X  if (color_postscript)
  546. X    out("/fore {r g b setrgbcolor} def");
  547. X  else
  548. X    out("/fore {0 setgray} def");
  549. X
  550. Xout("% normal star: x y r s --");
  551. Xout("/s {back starbody fore starbody} def");
  552. Xout("% double star: x y r s --");
  553. Xout("/d {back starbodydbl fore starbodydbl} def");
  554. Xout("% variable star: x y r s --");
  555. Xout("/v {back starbodyvar fore starbodyvar} def");
  556. X
  557. X/* define integral magnitudes */
  558. Xfprintf(outf, "/s_1 {%d s} def\n", MAG_1_RAD);
  559. Xfprintf(outf, "/d_1 {%d d} def\n", MAG_1_RAD);
  560. Xfprintf(outf, "/v_1 {%d v} def\n", MAG_1_RAD);
  561. Xfprintf(outf, "/s0 {%d s} def\n", MAG0_RAD);
  562. Xfprintf(outf, "/d0 {%d d} def\n", MAG0_RAD);
  563. Xfprintf(outf, "/v0 {%d v} def\n", MAG0_RAD);
  564. Xfprintf(outf, "/s1 {%d s} def\n", MAG1_RAD);
  565. Xfprintf(outf, "/d1 {%d d} def\n", MAG1_RAD);
  566. Xfprintf(outf, "/v1 {%d v} def\n", MAG1_RAD);
  567. Xfprintf(outf, "/s2 {%d s} def\n", MAG2_RAD);
  568. Xfprintf(outf, "/d2 {%d d} def\n", MAG2_RAD);
  569. Xfprintf(outf, "/v2 {%d v} def\n", MAG2_RAD);
  570. Xfprintf(outf, "/s3 {%d s} def\n", MAG3_RAD);
  571. Xfprintf(outf, "/d3 {%d d} def\n", MAG3_RAD);
  572. Xfprintf(outf, "/v3 {%d v} def\n", MAG3_RAD);
  573. Xfprintf(outf, "/s4 {%d s} def\n", MAG4_RAD);
  574. Xfprintf(outf, "/d4 {%d d} def\n", MAG4_RAD);
  575. Xfprintf(outf, "/v4 {%d v} def\n", MAG4_RAD);
  576. Xfprintf(outf, "/s5 {%d s} def\n", MAG5_RAD);
  577. Xfprintf(outf, "/d5 {%d d} def\n", MAG5_RAD);
  578. Xfprintf(outf, "/v5 {%d v} def\n", MAG5_RAD);
  579. Xfprintf(outf, "/s6 {%d s} def\n", MAG6_RAD);
  580. Xfprintf(outf, "/d6 {%d d} def\n", MAG6_RAD);
  581. Xfprintf(outf, "/v6 {%d v} def\n", MAG6_RAD);
  582. Xfprintf(outf, "/s7 {%d s} def\n", MAG7_RAD);
  583. Xfprintf(outf, "/d7 {%d d} def\n", MAG7_RAD);
  584. Xfprintf(outf, "/v7 {%d v} def\n", MAG7_RAD);
  585. Xfprintf(outf, "/s8 {%d s} def\n", MAG8_RAD);
  586. Xfprintf(outf, "/d8 {%d d} def\n", MAG8_RAD);
  587. Xfprintf(outf, "/v8 {%d v} def\n", MAG8_RAD);
  588. Xfprintf(outf, "/s9 {%d s} def\n", MAG9_RAD);
  589. Xfprintf(outf, "/d9 {%d d} def\n", MAG9_RAD);
  590. Xfprintf(outf, "/v9 {%d v} def\n", MAG9_RAD);
  591. Xfprintf(outf, "/s10 {%d s} def\n", MAG10_RAD);
  592. Xfprintf(outf, "/d10 {%d d} def\n", MAG10_RAD);
  593. Xfprintf(outf, "/v10 {%d v} def\n", MAG10_RAD);
  594. Xfprintf(outf, "/s11 {%d s} def\n", MAG11_RAD);
  595. Xfprintf(outf, "/d11 {%d d} def\n", MAG11_RAD);
  596. Xfprintf(outf, "/v11 {%d v} def\n", MAG11_RAD);
  597. Xfprintf(outf, "/s12 {%d s} def\n", MAG12_RAD);
  598. Xfprintf(outf, "/d12 {%d d} def\n", MAG12_RAD);
  599. Xfprintf(outf, "/v12 {%d v} def\n", MAG12_RAD);
  600. Xfprintf(outf, "/s13 {%d s} def\n", MAG13_RAD);
  601. Xfprintf(outf, "/d13 {%d d} def\n", MAG13_RAD);
  602. Xfprintf(outf, "/v13 {%d v} def\n", MAG13_RAD);
  603. Xfprintf(outf, "/s14 {%d s} def\n", MAG14_RAD);
  604. Xfprintf(outf, "/d14 {%d d} def\n", MAG14_RAD);
  605. Xfprintf(outf, "/v14 {%d v} def\n", MAG14_RAD);
  606. Xfprintf(outf, "/s15 {%d s} def\n", MAG15_RAD);
  607. Xfprintf(outf, "/d15 {%d d} def\n", MAG15_RAD);
  608. Xfprintf(outf, "/v15 {%d v} def\n", MAG15_RAD);
  609. Xfprintf(outf, "/s16 {%d s} def\n", MAG16_RAD);
  610. Xfprintf(outf, "/d16 {%d d} def\n", MAG16_RAD);
  611. Xfprintf(outf, "/v16 {%d v} def\n", MAG16_RAD);
  612. Xfprintf(outf, "/s17 {%d s} def\n", MAG17_RAD);
  613. Xfprintf(outf, "/d17 {%d d} def\n", MAG17_RAD);
  614. Xfprintf(outf, "/v17 {%d v} def\n", MAG17_RAD);
  615. Xfprintf(outf, "/s18 {%d s} def\n", MAG18_RAD);
  616. Xfprintf(outf, "/d18 {%d d} def\n", MAG18_RAD);
  617. Xfprintf(outf, "/v18 {%d v} def\n", MAG18_RAD);
  618. Xfprintf(outf, "/s19 {%d s} def\n", MAG19_RAD);
  619. Xfprintf(outf, "/d19 {%d d} def\n", MAG19_RAD);
  620. Xfprintf(outf, "/v19 {%d v} def\n", MAG19_RAD);
  621. Xfprintf(outf, "/s20 {%d s} def\n", MAG20_RAD);
  622. Xfprintf(outf, "/d20 {%d d} def\n", MAG20_RAD);
  623. Xfprintf(outf, "/v20 {%d v} def\n", MAG20_RAD);
  624. X
  625. X  /* Thumbshift */
  626. X  if ((numwins == 2) && (mapwin[1]->map_type == THUMBNAIL)) {
  627. X    thumbshift = mapwin[0]->maglim - MIN(th_mmax,
  628. X                     mapwin[1]->maglim - th_madj);
  629. X  }
  630. X
  631. X
  632. X  if (use_fine_mag) {
  633. X    /* use fine (continuous) magnitude scale */
  634. X
  635. X    if (use_young) {
  636. X      /* set magsizes according to Young's formula,
  637. X     Sky and Telescope, March 1990, p. 311 */
  638. X      if (!use_v0) young_v0 = mapwin[0]->maglim;
  639. X      for (i = 0; i < MAG_10_NUMMAGS; i++) {
  640. X    /* magsizes[i] is for magnitude (i - 1) */
  641. X    /* brightest mag10sizes is for mag -1.0 */
  642. X    young_size = young_D0 * exp(log(10.0)*young_k*(young_v0 - (i/10.0-1)));
  643. X    if (young_size <  1) young_size = 1;
  644. X    mag10sizes[i] = (int) (young_size + 0.5);
  645. X      }
  646. X    } else {
  647. X      for (i = 0; i < (MAG_NUMMAGS-1); i++)
  648. X    for (j = 0; j < 10; j++)
  649. X      mag10sizes[i*10 + j] =
  650. X        magsizes[i] - j*(magsizes[i] - magsizes[i+1])/10.0;
  651. X      mag10sizes[(MAG_NUMMAGS-1)*10] = magsizes[MAG_NUMMAGS-1];
  652. X    }
  653. X
  654. X#ifdef USE_FINE_MACROS
  655. X    /* set macros: Only if you have lots of printer memory */
  656. X    k = 0;
  657. X    for (i = MAG_BRIGHT; i < MAG_DIM; i++)
  658. X      for (j = 0; j < 10; j++) {
  659. X    if ((i*10 + j) < 0) {
  660. X      fprintf(outf, "/ss_%02d {%d s} def\n", - (i*10 + j), mag10sizes[k]);
  661. X      fprintf(outf, "/sd_%02d {%d d} def\n", - (i*10 + j), mag10sizes[k]);
  662. X      fprintf(outf, "/sv_%02d {%d v} def\n", - (i*10 + j), mag10sizes[k]);
  663. X    } else {
  664. X      fprintf(outf, "/ss%02d {%d s} def\n", i*10 + j, mag10sizes[k]);
  665. X      fprintf(outf, "/sd%02d {%d v} def\n", i*10 + j, mag10sizes[k]);
  666. X      fprintf(outf, "/sv%02d {%d d} def\n", i*10 + j, mag10sizes[k]);
  667. X    }
  668. X    k++;
  669. X      }
  670. X    i = MAG_DIM;
  671. X    j = 0;
  672. X    if ((i*10 + j) < 0) {
  673. X      fprintf(outf, "/ss_%02d {%d s} def\n", - (i*10 + j), mag10sizes[k]);
  674. X      fprintf(outf, "/sd_%02d {%d d} def\n", - (i*10 + j), mag10sizes[k]);
  675. X      fprintf(outf, "/sv_%02d {%d v} def\n", - (i*10 + j), mag10sizes[k]);
  676. X    } else {
  677. X      fprintf(outf, "/ss%02d {%d s} def\n", i*10 + j, mag10sizes[k]);
  678. X      fprintf(outf, "/sd%02d {%d v} def\n", i*10 + j, mag10sizes[k]);
  679. X      fprintf(outf, "/sv%02d {%d d} def\n", i*10 + j, mag10sizes[k]);
  680. X    }
  681. X#endif
  682. X
  683. X  }
  684. X
  685. X
  686. Xout("%");
  687. Xout("% non-stellar object macros (better designs most welcome)");
  688. X/* thanks to phk@kpd.dk */
  689. Xout("/stdsh0 { [] 0 setdash } def");
  690. X  /* set dash zero: solid line */
  691. X
  692. X  /* macros are all x y size macro - */
  693. X  /* The first three lines, and the last grestore of most of the macros
  694. X     set things up so the middle lines need only worry about a
  695. X     region of +/- 1 square (or +/- 2, for some) */
  696. Xout("% all but comet and moon take x y diam,");
  697. Xout("%    comet takes x y diam position-angle,");
  698. Xout("%    and moon takes x y diam phase pa-of-bright-limb");
  699. Xout("%    all leave nothing on the stack");
  700. Xout("/planet  { 2.4 div dup /sze exch def neg /nsze exch def");
  701. Xout("    2 copy stdsh0 sze starcirc sze 1.2 mul starplus} def");
  702. Xout("/mercury { 4 div /sze exch def moveto");
  703. Xout("   gsave currentpoint translate");
  704. Xout("   sze dup scale .1 setlinewidth");
  705. Xout("   newpath 0 0 2 0 360 arc stroke");
  706. Xout("   newpath 0 1 .4 180 0 arc .5 .1 moveto");
  707. Xout("   0 .1 .5 0 360 arc 0 -.4 moveto");
  708. Xout("   0 -1 lineto -.3 -.7 moveto .3 -.7 lineto stroke");
  709. Xout("   grestore} def");
  710. Xout("/venus { 4 div /sze exch def moveto");
  711. Xout("   gsave currentpoint translate");
  712. Xout("   sze dup scale .1 setlinewidth");
  713. Xout("   newpath 0 0 2 0 360 arc stroke");
  714. Xout("   newpath 0 .4 .5 0 360 arc 0 .1 moveto 0 -.9 lineto -.4 -.55 moveto");
  715. Xout("   .4 -.55 lineto stroke grestore } def");
  716. Xout("/mars { 4 div /sze exch def moveto");
  717. Xout("   gsave currentpoint translate");
  718. Xout("   sze dup scale .1 setlinewidth");
  719. Xout("   newpath 0 0 2 0 360 arc stroke");
  720. Xout("   newpath -.2 -.2 .6 0 405 arc");
  721. Xout("   .7 .7 lineto 0 -.5 rmoveto 0 .5 rlineto");
  722. Xout("   -.5 0 rlineto stroke grestore} def");
  723. Xout("/jupiter { 4 div /sze exch def moveto");
  724. Xout("   gsave currentpoint translate");
  725. Xout("   sze dup scale .1 setlinewidth");
  726. Xout("   newpath 0 0 2 0 360 arc stroke");
  727. Xout("   newpath .5 -.9 moveto .5 .9 lineto .9 -.5 moveto -.7 -.5 lineto");
  728. Xout("   .2 -.5 .2 .4 .8 arcto pop pop pop pop .2 .4 lineto");
  729. Xout("   .1 .9 -.4 .6 .4 arcto pop pop pop pop -.4 .6 lineto");
  730. Xout("   -.8 .4 -.5 .2 .3 arcto pop pop pop pop");
  731. Xout("   stroke grestore} def");
  732. Xout("/saturn { 4 div /sze exch def moveto");
  733. Xout("   gsave currentpoint translate");
  734. Xout("   sze dup scale .1 setlinewidth");
  735. Xout("   newpath 0 0 2 0 360 arc stroke");
  736. Xout("   newpath -.5 -.7 moveto -.5 1 lineto -.8 1 moveto -.2 1 lineto");
  737. Xout("   -.5 0 moveto -.3 .3 0 .3 .6 arcto pop pop pop pop 0 .3 lineto");
  738. Xout("   .5 .3 .4 -.1 .4 arcto pop pop pop pop .4 -.1 lineto .3 -.6 lineto");
  739. Xout("   .3 -1.5 .7 -.8 .2 arcto pop pop pop pop .7 -.8 lineto");
  740. Xout("   stroke grestore} def");
  741. Xout("/uranus { 4 div /sze exch def moveto");
  742. Xout("   gsave currentpoint translate");
  743. Xout("   sze dup scale .1 setlinewidth");
  744. Xout("   newpath 0 0 2 0 360 arc stroke");
  745. Xout("   newpath -1 1 moveto -1 -1 lineto  1 1 moveto 1 -1 lineto stroke");
  746. Xout("   -1 0 moveto 1 0 lineto stroke");
  747. Xout("   0 1 moveto 0 -1 lineto stroke");
  748. Xout("   0 -1.3 .3 0 360 arc stroke");
  749. Xout("   grestore } def");
  750. Xout("/neptune { 4 div /sze exch def moveto");
  751. Xout("   gsave currentpoint translate");
  752. Xout("   sze dup scale .1 setlinewidth");
  753. Xout("   newpath 0 0 2 0 360 arc stroke");
  754. Xout("   newpath 0 -.9 moveto");
  755. Xout("   0 .8 lineto -.8 .8 moveto -.7 .5 lineto -.7 0 lineto .7 0 lineto");
  756. Xout("   .7 .5 lineto .8 .8 lineto -.5 -.5 moveto");
  757. Xout("   .5 -.5 lineto stroke grestore} def");
  758. Xout("/pluto { 4 div /sze exch def moveto");
  759. Xout("   gsave currentpoint translate");
  760. Xout("   sze dup scale .1 setlinewidth");
  761. Xout("   newpath 0 0 2 0 360 arc stroke");
  762. Xout("   newpath -1 1 moveto -1 -1 lineto .5 -1 lineto stroke");
  763. Xout("   -1 1 moveto 0 1 lineto -1 0 moveto 0 0 lineto stroke");
  764. Xout("   0 .5 .5 270 90 arc stroke");
  765. Xout("   grestore} def");
  766. Xout("/sun { 2 div /sze exch def moveto");
  767. Xout("   gsave currentpoint translate");
  768. Xout("   sze dup scale .1 setlinewidth");
  769. Xout("    newpath 0 0 1 0 360 arc stroke");
  770. Xout("    0 0 .2 0 360 arc fill grestore } def");
  771. X/* Moon takes x y size phase: x y size phase moon - */
  772. Xout("/moon { /chi exch def /phase exch def 2 div /sze exch def moveto");
  773. Xout("   gsave currentpoint translate");
  774. Xout("   sze dup scale .1 setlinewidth");
  775. Xout("   newpath [.1 .2] 0 setdash 0 0 1 0 360 arc stroke");
  776. Xout("   stdsh0 gsave");
  777. Xout("      chi rotate");
  778. Xout("      newpath\n");
  779. Xout("      0 0 1 0 180 arcn");
  780. Xout("      1 phase cos scale");
  781. Xout("      0 0 1 180 360 arc fill");
  782. Xout("   grestore grestore } def");
  783. Xout("/asteroid { 4 div dup /sze exch def neg /nsze exch def");
  784. Xout("    2 copy stdsh0 newpath sze 3 div 0 360 arc closepath fill");
  785. Xout("    moveto sze sze rmoveto nsze 2 mul nsze 2 mul rlineto");
  786. Xout("    sze 2 mul 0 rmoveto nsze 2 mul sze 2 mul rlineto stroke } def");
  787. X/* Comet takes x y size position-angle: x y size position-angle comet - */
  788. Xout("/comet { 2 div dup /sze exch def neg /nsze exch def /phase exch def");
  789. Xout("    moveto gsave currentpoint translate sze dup scale");
  790. Xout("    .1 setlinewidth");
  791. Xout("    90 phase sub rotate stdsh0 newpath 0 0 .3 0 360 arc stroke");
  792. Xout("    0 .3 moveto 1 .5 lineto 0 -.3 moveto 1 -.5 lineto");
  793. Xout("    .3 0 moveto 1.2 0 lineto");
  794. Xout("    stroke grestore } def");
  795. Xout("/nebulad { 2 div dup /sze exch def neg /nsze exch def stdsh0");
  796. Xout("    newpath moveto sze 0 rmoveto nsze nsze rlineto nsze sze rlineto");
  797. Xout("    sze sze rlineto sze nsze rlineto stroke } def");
  798. Xout("/nebulap { 4 div /sze exch def moveto");
  799. Xout("    gsave currentpoint translate");
  800. Xout("    sze dup scale .1 setlinewidth");
  801. Xout("    newpath 0 0 1 0 360 arc stroke");
  802. Xout("    newpath 2 0 moveto 1 0 lineto -1 0 moveto -2 0 lineto");
  803. Xout("    0 2 moveto 0 1 lineto 0 -1 moveto 0 -2 lineto stroke");
  804. Xout("    grestore} def");
  805. Xout("/nebula {nebulad} def");
  806. Xout("/galaxye { 2 div dup /sze exch def neg /nsze exch def");
  807. Xout("    gsave stdsh0 newpath translate -30 rotate 1 .5 scale");
  808. Xout("    0 0 sze 0 360 arc closepath fill");
  809. Xout("    grestore } def");
  810. Xout("/galaxys { 2 div dup /sze exch def neg /nsze exch def");
  811. Xout("    gsave stdsh0 newpath translate -30 rotate 1 .5 scale");
  812. Xout("    0 0 sze 0 360 arc closepath fill");
  813. Xout("    nsze 1.25 mul nsze moveto nsze 0 lineto sze 1.25 mul sze moveto");
  814. Xout("    sze 0 lineto stroke  grestore } def");
  815. Xout("/galaxyq { 2 div dup /sze exch def neg /nsze exch def");
  816. Xout("    gsave stdsh0 newpath translate");
  817. Xout("    nsze 0 moveto sze 0 lineto 0 nsze moveto 0 sze lineto stroke");
  818. Xout("     -30 rotate 1 .5 scale 0 0 sze 0 360 arc closepath fill");
  819. Xout("    grestore } def");
  820. Xout("/galaxy {galaxye} def");
  821. Xout("/clustero { 2 div dup /sze exch def neg /nsze exch def");
  822. Xout("    2 copy newpath 1 setgray sze 0 360 arc fill");
  823. Xfprintf(outf,
  824. X    "    [%d %d] 0 setdash 0 setgray sze 0 360 arc stroke stdsh0 } def\n",
  825. X       1*ResPT, 2*ResPT);
  826. Xout("/clusterg { 2 div dup /sze exch def neg /nsze exch def");
  827. Xout("    2 copy 2 copy newpath 1 setgray sze 0 360 arc fill");
  828. Xfprintf(outf, "    [%d %d] 0 setdash 0 setgray sze 0 360 arc stroke\n",
  829. X       1*ResPT, 2*ResPT);
  830. Xout("    3 0 360 arc closepath fill stdsh0 } def");
  831. Xout("/cluster {clustero} def");
  832. Xout("/unknown_u { 2 div /sze exch def moveto gsave currentpoint translate");
  833. Xout("   sze dup scale .1 setlinewidth");
  834. Xout("   newpath 0 .5 .5 180 270 arcn stroke");
  835. Xout("   0 0 moveto 0 -1 lineto stroke");
  836. Xout("   grestore} def");
  837. Xout("/other_o { 2 div /sze exch def moveto gsave currentpoint translate");
  838. Xout("   sze dup scale .1 setlinewidth");
  839. Xout("   1 1 moveto -1 -1 lineto  -1 1 moveto 1 -1 lineto stroke");
  840. Xout("   0 1 moveto 1 0 lineto  0 -1 lineto -1 0 lineto 0 1 lineto stroke");
  841. Xout("   grestore} def");
  842. Xout("%");
  843. Xout("%");
  844. X
  845. X  if (notebook_mode) {
  846. X    out("%notebook mode");
  847. X    out("24 0 translate");
  848. X    numwins = 1;
  849. X  };
  850. X
  851. X  if (landscape) {
  852. X    out("%landscape mode");
  853. X    out("612 0 translate");
  854. X    out("90 rotate");
  855. X    i = fullpage.width;
  856. X    fullpage.width = fullpage.height;
  857. X    fullpage.height = i;
  858. X/*    i = fullpage.x_offset;
  859. X    fullpage.x_offset = fullpage.y_offset;
  860. X    fullpage.y_offset = i;*/
  861. X  }
  862. Xfprintf(outf, "1 %d div dup scale\n", ResPT);
  863. Xout("% alter line drawing defaults, guarentee solid black lines");
  864. Xout("1 setlinewidth 2 setlinecap");
  865. Xout("[] 0 setdash 0 setgray");
  866. Xout("%");
  867. Xout("% boiler-plate");
  868. Xout("%");
  869. Xout("% Set a font");
  870. XD_fontsize(18, TIMESROMAN);
  871. X/*out("18 /Times-Roman fontsz");*/
  872. Xout("%");
  873. Xout("%");
  874. Xout("% THE STUFF");
  875. Xout("%");
  876. Xreturn TRUE ;                /* open successful */
  877. X}
  878. X
  879. Xout(s)
  880. X     char *s;
  881. X{
  882. X  fprintf(outf, "%s\n", s);
  883. X}
  884. X
  885. X/* Close the device */
  886. XD_close()
  887. X{
  888. X  out("showpage");
  889. X  out("%");
  890. X  out("%%Trailer");
  891. X  out("%%Pages: 1");
  892. X  fflush(outf);
  893. X  fclose(outf);
  894. X}
  895. X
  896. X
  897. X
  898. X/*
  899. Xint vecstate = S_UNDEF;
  900. Xint cur_x = -1, cur_y = -1;
  901. Xint cur_sty = SOLID;
  902. Xchar *c_sty_str = "st";
  903. X*/
  904. X/* In postscript, we want to move to the beginning of a line with moveto (mt),
  905. X        then move from point to point with lineto (lt),
  906. X    then end the line when either the style changes
  907. X        or we're moving to a new start point [This is not really
  908. X            necessary, but if too many lt's are done, it probably
  909. X            will overload the printer]
  910. X    ending the line consists of calling (st),(dt),or (ht)
  911. X        depending on the current style */
  912. X
  913. X/* Move to (x, y) */
  914. XD_move(x, y)
  915. X     int x, y;
  916. X{
  917. X/*  fprintf(outf, "%%move %d %d\n", x, y);*/
  918. X
  919. X  if (vecstate != S_LINE) {    /* not drawing line now */
  920. X    if ((x != cur_x) || (y != cur_y)) { /* otherwise nothing needed */
  921. X      fprintf(outf, "%d %d mt\n", x, y);
  922. X    }
  923. X  } else {            /* drawing line, finish it then move */
  924. X    fprintf(outf, "%d %d %s\n", cur_x, cur_y, c_sty_str);
  925. X    fprintf(outf, "%d %d mt\n", x, y);
  926. X  }
  927. X  cur_x = x;
  928. X  cur_y = y;
  929. X  vecstate = S_MOVE;
  930. X}
  931. X
  932. X
  933. X/* Draw a line of style line_style from the current point to (x, y) */
  934. X/* Note, this replaces vecdraw vecdrawdot and vecdrawhyph */
  935. XD_draw(x, y, line_style)
  936. X     int x, y;
  937. X     int line_style;    /* SOLID, DOTTED, DASHED, etc. */
  938. X{
  939. X  int sty;
  940. X
  941. X/*  fprintf(outf, "%%draw %d %d %d\n", x, y, line_style);*/
  942. X
  943. X  if ((x != cur_x) || (y != cur_y) || (line_style != cur_sty)) {
  944. X    switch(cur_function) {
  945. X    case CHRTOUTLN:
  946. X    case CHRTHTICK:
  947. X    case CHRTVTICK:
  948. X      sty = SOLID;
  949. X      break;
  950. X    case GRID_RA:
  951. X    case GRID_DEC:
  952. X      sty = DOTTED;
  953. X      break;
  954. X    case ECLIPT:
  955. X      sty = DOTTED;
  956. X      break;
  957. X    case CONSTBOUND:
  958. X      sty = DASHED;
  959. X      break;
  960. X    case CONSTPATTRN:
  961. X      sty = SOLID;
  962. X      break;
  963. X    case CONSTNAME:
  964. X    case CHARTFILE:
  965. X    default:
  966. X      sty = line_style;
  967. X      break;
  968. X    }
  969. X
  970. X    if (vecstate == S_UNDEF) {    /* currentpoint not defined.
  971. X                   move to start point */
  972. X      fprintf(outf, "%d %d mt\n", cur_x, cur_y);
  973. X      vecstate = S_MOVE;
  974. X    }
  975. X
  976. X
  977. X    if (sty == cur_sty) {    /* Continue current line, style */
  978. X      fprintf(outf, "%d %d lt\n", x, y);
  979. X      vecstate = S_LINE;
  980. X    } else {            /* Change style */
  981. X                /* Finish current line */
  982. X      fprintf(outf, "%d %d %s\n", cur_x, cur_y, c_sty_str);
  983. X                /* Move to last point */
  984. X      fprintf(outf, "%d %d mt\n", cur_x, cur_y);
  985. X
  986. X                /* Switch styles */
  987. X      switch(sty) {
  988. X      case SOLID:
  989. X    c_sty_str = "st";
  990. X    break;
  991. X      case DOTTED:
  992. X    c_sty_str = "dt";
  993. X    break;
  994. X      case DASHED:
  995. X    c_sty_str = "ht";
  996. X    break;
  997. X      case VECSOLID:
  998. X    c_sty_str = "st";
  999. X    break;
  1000. X      case VECDOT:
  1001. X    c_sty_str = "dt";
  1002. X    break;
  1003. X      case VECDASH:
  1004. X    c_sty_str = "ht";
  1005. X    break;
  1006. X      default:
  1007. X    c_sty_str = "st";
  1008. X    break;
  1009. X      }
  1010. X      cur_sty = sty;
  1011. X      fprintf(outf, "%d %d lt\n", x, y);
  1012. X      vecstate = S_LINE;
  1013. X    }
  1014. X    cur_x = x;
  1015. X    cur_y = y;
  1016. X  }
  1017. X}
  1018. X/* This routine is encouraged to look at the extern cur_funtion
  1019. X   and change the line style drawn as desired */
  1020. X
  1021. X
  1022. X/* Move to (x1, y1) then draw a line of style line_style to (x2, y2) */
  1023. XD_movedraw(x1, y1, x2, y2, line_style)
  1024. X     int x1, y1, x2, y2;
  1025. X     int line_style;    /* SOLID, DOTTED, DASHED, etc. */
  1026. X{
  1027. X  D_move(x1, y1);
  1028. X  D_draw(x2, y2, line_style);
  1029. X}
  1030. X
  1031. X
  1032. Xstatic struct {int x,y;} areapts[1000];
  1033. Xstatic int nareapts;
  1034. X/* Move to (x, y) to begin an area */
  1035. XD_areamove(x, y)
  1036. X     int x, y;
  1037. X{
  1038. X  nareapts = 0;
  1039. X  areapts[nareapts].x = x;
  1040. X  areapts[nareapts].y = y;
  1041. X  nareapts++;
  1042. X}
  1043. X
  1044. X/* Add a segment to the area border */
  1045. XD_areaadd(x, y)
  1046. X     int x, y;
  1047. X{
  1048. X  areapts[nareapts].x = x;
  1049. X  areapts[nareapts].y = y;
  1050. X  nareapts++;
  1051. X}
  1052. X
  1053. X/* Fill the area, after adding the last segment */
  1054. XD_areafill(x, y)
  1055. X     int x, y;
  1056. X{
  1057. X  int i;
  1058. X
  1059. X  areapts[nareapts].x = x;
  1060. X  areapts[nareapts].y = y;
  1061. X  nareapts++;
  1062. X
  1063. X
  1064. X  D_move(areapts[0].x, areapts[0].y);
  1065. X
  1066. X  for (i = 1; i < nareapts; i++)
  1067. X    fprintf(outf, "%d %d lt\n", areapts[i].x, areapts[i].y);
  1068. X  fprintf(outf, "fill newpath\n");
  1069. X
  1070. X  vecstate = S_UNDEF;
  1071. X}
  1072. X
  1073. X
  1074. X
  1075. X
  1076. X#define BLACK 0
  1077. X#define WHITE 1
  1078. X#define RED 2
  1079. X#define ORANGE 3
  1080. X#define YELLOW 4
  1081. X#define GREEN 5
  1082. X#define CYAN 6
  1083. X#define BLUE 7
  1084. X#define VIOLET 8
  1085. X#define BLUE_WHITE 9
  1086. X
  1087. X/* Set the color to be used for lines and text */
  1088. X/* color_str is a 2 char (+ '\0') string containing
  1089. X   a specification for a color,
  1090. X   e.g. "G2" for the color of a star of spectral class G2, or "r7" for
  1091. X   red, level seven.  The interpretation of the color string is left to
  1092. X   the device driver */
  1093. X/* static int cur_colr = -1;
  1094. X*/
  1095. XD_color(color_str)
  1096. X     char *color_str;
  1097. X{
  1098. X  int colr;
  1099. X  int class, subclass;
  1100. X  static char *table = "OBAFGKMRNSrgbycpow";
  1101. X  static int super_spectra[][10] = {
  1102. X    /*         0   1   2   3   4   5   6   7   8   9   */
  1103. X    /* O */ { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 },
  1104. X    /* B */ {  0,  1,  2,  3,  3,  4,  4,  4,  5,  6 },
  1105. X    /* A */ {  7,  7,  8,  9,  9, 10, 10, 10, 10, 10 },
  1106. X    /* F */ { 11, 11, 12, 12, 12, 13, 13, 13, 14, 14 },
  1107. X    /* G */ { 15, 15, 15, 15, 15, 16, 16, 16, 16, 16 },
  1108. X    /* K */ { 17, 17, 18, 18, 18, 19, 19, 19, 19, 19 },
  1109. X    /* M */ { 20, 20, 21, 22, 23, 24, 25, 26, 26, 26 },
  1110. X    /* R */ { 27, 27, 27, 28, 28, 28, 28, 28, 29, 30 },
  1111. X    /* N */ { 27, 27, 27, 28, 28, 28, 28, 28, 29, 30 },
  1112. X    /* S */ { 30, 30, 30, 30, 31, 31, 31, 31, 31, 31 },
  1113. X    /* r */ { 33, 33, 33, 34, 34, 34, 35, 35, 35, 36 },
  1114. X    /* y */ { 37, 37, 37, 38, 38, 38, 39, 39, 39, 40 },
  1115. X    /* g */ { 41, 41, 41, 42, 42, 42, 43, 43, 43, 44 },
  1116. X    /* c */ { 45, 45, 45, 46, 46, 46, 47, 47, 47, 48 },
  1117. X    /* b */ { 49, 49, 49, 50, 50, 50, 51, 51, 51, 52 },
  1118. X    /* p */ { 53, 53, 53, 54, 54, 54, 55, 55, 55, 56 },
  1119. X    /* o */ { 57, 57, 57, 58, 58, 58, 59, 59, 59, 60 },
  1120. X    /* w */ { 61, 61, 61, 62, 62, 62, 63, 63, 63, 64 }
  1121. X      };
  1122. X
  1123. X  static struct {double r, g, b;} ctab[] = {
  1124. END_OF_FILE
  1125. if test 34495 -ne `wc -c <'starchart/spo.c.aa'`; then
  1126.     echo shar: \"'starchart/spo.c.aa'\" unpacked with wrong size!
  1127. fi
  1128. # end of 'starchart/spo.c.aa'
  1129. fi
  1130. echo shar: End of archive 26 \(of 32\).
  1131. cp /dev/null ark26isdone
  1132. MISSING=""
  1133. 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
  1134.     if test ! -f ark${I}isdone ; then
  1135.     MISSING="${MISSING} ${I}"
  1136.     fi
  1137. done
  1138. if test "${MISSING}" = "" ; then
  1139.     echo You have unpacked all 32 archives.
  1140.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1141. else
  1142.     echo You still need to unpack the following archives:
  1143.     echo "        " ${MISSING}
  1144. fi
  1145. ##  End of shell archive.
  1146. exit 0
  1147.  
  1148.