home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / star.lzh / star.26 < prev    next >
Encoding:
Text File  |  1990-04-06  |  36.1 KB  |  1,141 lines

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