home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume13 / lj2ps / part10 < prev    next >
Encoding:
Text File  |  1990-07-02  |  39.1 KB  |  1,317 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v13i095: lj2ps (10 of 12), a LaserJet to PostScript Translator
  3. From: lishka@uwslh.slh.wisc.edu (Chris Lishka (relaxing in the Mad-City) )
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 13, Issue 95
  7. Submitted-by: lishka@uwslh.slh.wisc.edu (Chris Lishka (relaxing in the Mad-City) )
  8. Archive-name: lj2ps/part10
  9.  
  10. ---- Cut Here and unpack ----
  11. #!/bin/sh
  12. # This is part 10 of a multipart archive
  13. if touch 2>&1 | fgrep '[-amc]' > /dev/null
  14.  then TOUCH=touch
  15.  else TOUCH=true
  16. fi
  17. # ============= lj2ps.h ==============
  18. if test X"$1" != X"-c" -a -f 'lj2ps.h'; then
  19.     echo "File already exists: skipping 'lj2ps.h'"
  20. else
  21. echo "x - extracting lj2ps.h (Text)"
  22. sed 's/^X//' << 'SHAR_EOF' > lj2ps.h &&
  23. X/*
  24. X** Project:        lj2ps
  25. X** File:       lj2ps.h
  26. X**
  27. X** Author:       Christopher Lishka
  28. X** Organization:   Wisconsin State Laboratory of Hygiene
  29. X**           Data Processing Dept.
  30. X**
  31. X** Copyright (C) 1990 by Christopher Lishka.
  32. X**
  33. X** This program is free software; you can redistribute it and/or modify
  34. X** it under the terms of the GNU General Public License as published by
  35. X** the Free Software Foundation; either version 1, or (at your option)
  36. X** any later version.
  37. X**
  38. X** This program is distributed in the hope that it will be useful,
  39. X** but WITHOUT ANY WARRANTY; without even the implied warranty of
  40. X** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  41. X** GNU General Public License for more details.
  42. X**
  43. X** You should have received a copy of the GNU General Public License
  44. X** along with this program; if not, write to the Free Software
  45. X** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  46. X*/
  47. X
  48. X#ifndef LJ2PS_H
  49. X#define LJ2PS_H
  50. X
  51. X#include "lj.h"
  52. X
  53. X  /* Global constants
  54. X  */
  55. X#define PROGRAM  "lj2ps"
  56. X#define VERSION  "1.1"
  57. X#define STATUS     "release"
  58. X
  59. X  /* Global structure and type definitions
  60. X  */
  61. X
  62. X  /* Global variables
  63. X  */
  64. Xextern int    debug;
  65. Xextern int    warnings;
  66. X
  67. X  /* Global macro definitions
  68. X  */
  69. X
  70. X  /* Global functions
  71. X  */
  72. X#endif
  73. SHAR_EOF
  74. $TOUCH -am 0630160790 lj2ps.h &&
  75. chmod 0644 lj2ps.h ||
  76. echo "restore of lj2ps.h failed"
  77. set `wc -c lj2ps.h`;Wc_c=$1
  78. if test "$Wc_c" != "1251"; then
  79.     echo original size 1251, current size $Wc_c
  80. fi
  81. fi
  82. # ============= ljcmds.c ==============
  83. if test X"$1" != X"-c" -a -f 'ljcmds.c'; then
  84.     echo "File already exists: skipping 'ljcmds.c'"
  85. else
  86. echo "x - extracting ljcmds.c (Text)"
  87. sed 's/^X//' << 'SHAR_EOF' > ljcmds.c &&
  88. X/* Project:        lj2ps
  89. X** File:        ljcmds.c
  90. X**
  91. X** Author:        Christopher Lishka
  92. X** Organization:    Wisconsin State Laboratory of Hygiene
  93. X**            Data Processing Dept.
  94. X**
  95. X** Copyright (C) 1990 by Christopher Lishka.
  96. X**
  97. X** This program is free software; you can redistribute it and/or modify
  98. X** it under the terms of the GNU General Public License as published by
  99. X** the Free Software Foundation; either version 1, or (at your option)
  100. X** any later version.
  101. X**
  102. X** This program is distributed in the hope that it will be useful,
  103. X** but WITHOUT ANY WARRANTY; without even the implied warranty of
  104. X** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  105. X** GNU General Public License for more details.
  106. X**
  107. X** You should have received a copy of the GNU General Public License
  108. X** along with this program; if not, write to the Free Software
  109. X** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  110. X*/
  111. X
  112. Xstatic char * ModuleID = "Module ljcmds: v1.0, production";
  113. X
  114. X  /* Include files
  115. X  */
  116. X#include <stdio.h>
  117. X#include <math.h>
  118. X#include "ljcmds.h"
  119. X#include "lj.h"
  120. X#include "ljfonts.h"
  121. X#include "scan.h"
  122. X#include "lj2ps.h"
  123. X
  124. X  /* External definitions
  125. X  */
  126. X
  127. X  /* Global variables
  128. X  */
  129. X
  130. X  /* Global function list
  131. X  */
  132. Xextern void  ljcmd_undefined();    /* Command: undefined */
  133. Xextern void  ljcmd_E();        /* Command: ^[E  reset */
  134. Xextern void  ljcmd_Y();        /* Command: ^[Y  display functions on */
  135. Xextern void  ljcmd_Z();        /* Command: ^[Z  display functions off */
  136. Xextern void  ljcmd_9();        /* Command: ^[9  clear margins */
  137. Xextern void  ljcmd_eq();    /* Command: ^[=  half-line feed */
  138. Xextern void  ljcmd_lp();    /* Command: ^[(  primary symbol set */
  139. Xextern void  ljcmd_rp();    /* Command: ^[)  secondary symbol set */
  140. Xextern void  ljcmd_lp_s();    /* Command: ^[(s primary font attributes */
  141. Xextern void  ljcmd_rp_s();    /* Command: ^[)s secondary font attributes */
  142. Xextern void  ljcmd_amp_a();    /* Command: ^[&a margins & movement */
  143. Xextern void  ljcmd_amp_d();    /* Command: ^[&d underline */
  144. Xextern void  ljcmd_amp_f();    /* Command: ^[&f macros, position stack */
  145. Xextern void  ljcmd_amp_k();    /* Command: ^[&k HMI, pitch, line termination*/
  146. Xextern void  ljcmd_amp_l();    /* Command: ^[&l page attributes */
  147. Xextern void  ljcmd_amp_p();    /* Command: ^[&p transparent print data */
  148. Xextern void  ljcmd_amp_s();    /* Command: ^[&s end-of-line wrap */
  149. Xextern void  ljcmd_star_b();    /* Command: ^[*b bitmap transfer */
  150. Xextern void  ljcmd_star_c();    /* Command: ^[*c graphics, soft fonts */
  151. Xextern void  ljcmd_star_p();    /* Command: ^[*p device-dependent movement */
  152. Xextern void  ljcmd_star_r();    /* Command: ^[*r start/end graphics */
  153. Xextern void  ljcmd_star_t();    /* Command: ^[*t graphics resolution */
  154. X
  155. X  /* Local constants
  156. X  */
  157. X
  158. X  /* Local structures and types
  159. X  */
  160. X
  161. X  /* Local variables
  162. X  */
  163. X
  164. X  /* Local macro definitions
  165. X  */
  166. X#define operation(X) (variable[strlen(variable) - 1] == X)
  167. X
  168. X  /* Local function list
  169. X  */
  170. X
  171. X  /* Function bodies
  172. X  */
  173. X
  174. Xvoid
  175. Xljcmd_undefined(ifile, ofile)    /* Command: undefined */
  176. X     FILE *ifile, *ofile;
  177. X{
  178. X      warning("unknown LaserJet PCL command");
  179. X} /* ljcmd_undefined() */
  180. X
  181. X
  182. X
  183. X  /* ljcmd_E(ofile) performs a LaserJet "reset" command.  This initializes
  184. X  ** all internal variables to default values.  In addition, if the current
  185. X  ** page is not empty, a new page is started.
  186. X  */
  187. Xvoid
  188. Xljcmd_E(ofile)            /* Command: ^[E reset */
  189. X     FILE *ofile;
  190. X{
  191. X
  192. X    /* If current page is not empty, then start a new one */
  193. X  lj_page_end(ofile);
  194. X  
  195. X    /* Reset the printer */
  196. X  lj_reset(ofile);
  197. X
  198. X    /* Begin the next page */
  199. X  lj_page_begin(ofile);
  200. X
  201. X} /* ljcmd_E() */
  202. X
  203. X
  204. X
  205. Xvoid
  206. Xljcmd_Y(ofile)            /* Command: ^[Y display functions on */
  207. X     FILE *ofile;
  208. X{
  209. X
  210. X  warning("command <esc>Y is not implemented -- ignoring", "");
  211. X
  212. X} /* ljcmd_Y() */
  213. X
  214. X
  215. X
  216. Xvoid
  217. Xljcmd_Z(ofile)            /* Command: ^[Z display functions off */
  218. X     FILE *ofile;
  219. X{
  220. X
  221. X  warning("command <esc>Z is not implemented -- ignoring", "");
  222. X
  223. X} /* ljcmd_Z() */
  224. X
  225. X
  226. X
  227. Xvoid
  228. Xljcmd_9(ofile)            /* Command: ^[9 clear margins */
  229. X     FILE *ofile;
  230. X{
  231. X
  232. X  margin_left  = 0.0;        /* Reset the left margin */
  233. X  text_width  = page_width - margin_left; /* Reset the virtual right margin */
  234. X
  235. X  lj_text_end(ofile);
  236. X  fprintf(ofile, "/ml 0.0 def %.4f RM ", /* Reset the clipping path */
  237. X      margin_left + text_width);
  238. X  lj_text_begin();
  239. X
  240. X} /* ljcmd_9() */
  241. X
  242. X
  243. X
  244. Xvoid
  245. Xljcmd_eq(ofile)            /* Command: ^[= half-line feed */
  246. X     FILE *ofile;
  247. X{
  248. X
  249. X  lj_text_end(ofile);
  250. X  lj_undl_flush(ofile);
  251. X
  252. X  lj_cursor_ver_rel(ofile, (char_height / 2));
  253. X
  254. X  lj_undl_mark(ofile);
  255. X  lj_text_begin();
  256. X
  257. X} /* ljcmd_eq() */
  258. X
  259. X
  260. X
  261. Xvoid
  262. Xljcmd_lp(ifile, ofile)        /* Command ^[( primary symbol set */
  263. X     FILE *ifile, *ofile;
  264. X{
  265. X
  266. X    /* Parse all of the parameters, until the scanner returnes PARAM_END */
  267. X  do{
  268. X      /* If EOF is reached, then flag an error and return */
  269. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  270. X      error("end-of-file reached while reading parameters", variable);
  271. X    }
  272. X#ifdef DEBUG
  273. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  274. X#endif
  275. X    switch( curr_token.code ){
  276. X    case PARAM_CONTINUE:
  277. X      warning("more than one symbol set in a command -- ignoring", command);
  278. X      break;
  279. X    case PARAM_END:
  280. X      switch( atoi(number) ){
  281. X      case 0:            /* 0B, 0N, 0U */
  282. X    if( operation('B') )       font_p.symbol_set = LJ_SS_0B;
  283. X    else if( operation('N') )  font_p.symbol_set = LJ_SS_0N;
  284. X    else if( operation('U') )  font_p.symbol_set = LJ_SS_0U;
  285. X#ifdef VERBOSE_WARNINGS
  286. X    else
  287. X      warning("unknown symbol set -- ignoring", command);
  288. X#endif
  289. X    break;
  290. X      case 1:            /* 1U */
  291. X    if( operation('U') )  font_p.symbol_set = LJ_SS_1U;
  292. X#ifdef VERBOSE_WARNINGS
  293. X    else
  294. X      warning("unknown symbol set -- ignoring", command);
  295. X#endif
  296. X    break;
  297. X      case 8:            /* 8U */
  298. X    if( operation('U') )  font_p.symbol_set = LJ_SS_8U;
  299. X#ifdef VERBOSE_WARNINGS
  300. X    else
  301. X      warning("unknown symbol set -- ignoring", command);
  302. X#endif
  303. X    break;
  304. X      case 10:            /* 10U */
  305. X    if( operation('U') )  font_p.symbol_set = LJ_SS_10U;
  306. X#ifdef VERBOSE_WARNINGS
  307. X    else
  308. X      warning("unknown symbol set -- ignoring", command);
  309. X#endif
  310. X    break;
  311. X      case 11:            /* 11U */
  312. X    if( operation('U') )  font_p.symbol_set = LJ_SS_11U;
  313. X#ifdef VERBOSE_WARNINGS
  314. X    else
  315. X      warning("unknown symbol set -- ignoring", command);
  316. X#endif
  317. X    break;
  318. X#ifdef VERBOSE_WARNINGS
  319. X      default:
  320. X    warning("unknown symbol set -- ignoring", command);
  321. X#endif
  322. X      } /* switch( number ) */
  323. X      break;
  324. X    default:
  325. X      internal_error("illegal token encountered in parameters", "");
  326. X    } /* switch(...) */
  327. X    lj_match_font(&font_p);
  328. X    if( current_font == LJ_FT_PRIMARY ){
  329. X      lj_text_end(ofile);
  330. X      lj_undl_flush(ofile);
  331. X      lj_set_font(ofile, font_p);
  332. X      lj_undl_mark(ofile);
  333. X      lj_text_begin();
  334. X    } /* if( ... ) */
  335. X  } while( curr_token.code != PARAM_END );
  336. X
  337. X} /* ljcmd_lp() */
  338. X
  339. X
  340. X
  341. Xvoid
  342. Xljcmd_rp(ifile, ofile)        /* Command: ^[) secondary symbol set */
  343. X     FILE *ifile, *ofile;
  344. X{
  345. X
  346. X  warning("command <esc>) is not implemented -- ignoring", "");
  347. X
  348. X  do{
  349. X      /* Read the next token */
  350. X      /* If EOF is reached, then flag an error and return */
  351. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  352. X      error("end-of-file reached while reading parameters", variable);
  353. X    }
  354. X#ifdef DEBUG
  355. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  356. X#endif
  357. X    switch( curr_token.code ){
  358. X    case PARAM_CONTINUE:
  359. X      break;
  360. X    case PARAM_END:
  361. X      break;
  362. X    default:
  363. X      internal_error("illegal token encountered in parameters", "");
  364. X    } /* switch(...) */
  365. X  } while( curr_token.code != PARAM_END );
  366. X
  367. X} /* ljcmd_rp() */
  368. X
  369. X
  370. X
  371. Xvoid
  372. Xljcmd_lp_s(ifile, ofile)    /* Command: ^[(s primary font attributes */
  373. X     FILE *ifile, *ofile;
  374. X{
  375. X
  376. X  do{
  377. X      /* Read the next token */
  378. X      /* If EOF is reached, then flag an error and return */
  379. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  380. X      error("end-of-file reached while reading parameters", variable);
  381. X    }
  382. X#ifdef DEBUG
  383. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  384. X#endif
  385. X    switch( curr_token.code ){
  386. X    case PARAM_CONTINUE:
  387. X    case PARAM_END:
  388. X      if( operation('P') ){    /* Spacing */
  389. X    switch( atoi(number) ){
  390. X    case 0: font_p.spacing = LJ_SP_FIXED; break;
  391. X    case 1: font_p.spacing = LJ_SP_PROPORTIONAL; break;
  392. X    default:
  393. X      error("unknown primary font spacing code", number);
  394. X    }
  395. X      } /* if( P ) */
  396. X      else if( operation('H') ){ /* Pitch */
  397. X    font_p.pitch = atof(number);
  398. X      } /* else if( H ) */
  399. X      else if( operation('V') ){ /* Point size */
  400. X    font_p.point_size = atof(number);
  401. X      } /* else if( V ) */
  402. X      else if( operation('S') ){ /* Style */
  403. X    switch( atoi(number) ){
  404. X    case 0: font_p.style = LJ_ST_UPRIGHT; break;
  405. X    case 1: font_p.style = LJ_ST_ITALIC;  break;
  406. X    default:
  407. X      error("unknonw primary font style code", number);
  408. X    }
  409. X      } /* else if( S ) */
  410. X      else if( operation('B') ){ /* Stroke weight */
  411. X    switch( pos_code ){
  412. X    case POS_ABSOLUTE:
  413. X    case POS_REL_POSITIVE:
  414. X      font_p.weight = atoi(number); break;
  415. X    case POS_REL_NEGATIVE:
  416. X      font_p.weight = -(atoi(number)); break;
  417. X    default:
  418. X      internal_error("unknown pos-code in primary font stroke weight", "");
  419. X    }
  420. X      } /* else if( B ) */
  421. X      else if( operation('T') ){ /* Typeface */
  422. X    switch( atoi(number) ){
  423. X    case  4: font_p.typeface = LJ_TF_HELV;  break;
  424. X    case  5: font_p.typeface = LJ_TF_TIMES; break;
  425. X    case  8: font_p.typeface = LJ_TF_PRES;  break;
  426. X    case  0: font_p.typeface = LJ_TF_LP;    break;
  427. X    case  3: font_p.typeface = LJ_TF_COUR;  break;
  428. X    default:
  429. X      error("unrecognized typeface code (possibly not supported",
  430. X        number);
  431. X    }
  432. X      } /* else if( T ) */
  433. X      else{            /* Unknown command */
  434. X    warning("unknown command with prefix <esc>(s -- ignoring", "");
  435. X      } /* else */
  436. X        /* If at the *end* of the font change command, change the font! */
  437. X      if( curr_token.code == PARAM_END ){
  438. X    lj_match_font(&font_p);
  439. X    if( current_font == LJ_FT_PRIMARY ){
  440. X      lj_text_end(ofile);
  441. X      lj_undl_flush(ofile);
  442. X      lj_set_font(ofile, font_p);
  443. X      lj_undl_mark(ofile);
  444. X      lj_text_begin();
  445. X    } /* if( ... ) */
  446. X      } /* if( ... ) */
  447. X      break;
  448. X    default:
  449. X      internal_error("illegal token encountered in parameters", "");
  450. X    } /* switch(...) */
  451. X  } while( curr_token.code != PARAM_END );
  452. X
  453. X} /* ljcmd_lp_s() */
  454. X
  455. X
  456. X
  457. Xvoid
  458. Xljcmd_rp_s(ifile, ofile)    /* Command: ^[)s secondary font attributes */
  459. X     FILE *ifile, *ofile;
  460. X{
  461. X
  462. X  warning("command family <esc>)s not implemented -- ignoring", "");
  463. X
  464. X  do{
  465. X      /* Read the next token */
  466. X      /* If EOF is reached, then flag an error and return */
  467. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  468. X      error("end-of-file reached while reading parameters", variable);
  469. X    }
  470. X#ifdef DEBUG
  471. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  472. X#endif
  473. X    switch( curr_token.code ){
  474. X    case PARAM_CONTINUE:
  475. X      break;
  476. X    case PARAM_END:
  477. X      break;
  478. X    default:
  479. X      internal_error("illegal token encountered in parameters", "");
  480. X    } /* switch(...) */
  481. X  } while( curr_token.code != PARAM_END );
  482. X
  483. X} /* ljcmd_rp_s() */
  484. X
  485. X
  486. X
  487. Xvoid
  488. Xljcmd_amp_a(ifile, ofile)    /* Command: ^[&a margins & movement */
  489. X     FILE *ifile, *ofile;
  490. X{
  491. X
  492. X  do{
  493. X      /* If EOF is reached, then flag an error and return */
  494. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  495. X      error("end-of-file reached while reading parameters", variable);
  496. X    }
  497. X#ifdef DEBUG
  498. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  499. X#endif
  500. X    switch( curr_token.code ){
  501. X    case PARAM_CONTINUE:
  502. X    case PARAM_END:
  503. X      if( operation('R') ){    /* Move vertically by rows */
  504. X    lj_text_end(ofile);
  505. X    lj_undl_flush(ofile);
  506. X    switch( pos_code ){
  507. X    case POS_ABSOLUTE:    /* Absolute postioning */
  508. X      lj_cursor_ver_abs(ofile,
  509. X                page_height -
  510. X                (margin_top + char_height + ro2in(atof(number))) );
  511. X      break;
  512. X    case POS_REL_POSITIVE:    /* Relative positive */
  513. X      lj_cursor_ver_rel(ofile, ro2in(atof(number))); break;
  514. X    case POS_REL_NEGATIVE:    /* Relative negative */
  515. X      lj_cursor_ver_rel(ofile, -(ro2in(atof(number)))); break;
  516. X    default:
  517. X      internal_error("illegal positioning code", "");
  518. X    }
  519. X    lj_undl_mark(ofile);
  520. X    lj_text_begin();
  521. X      }
  522. X      else if( operation('V') ){ /* Move vertically by decipoints */
  523. X    lj_text_end(ofile);
  524. X    lj_undl_flush(ofile);
  525. X    switch( pos_code ){
  526. X    case POS_ABSOLUTE:    /* Absolute positioning */
  527. X      lj_cursor_ver_abs(ofile,
  528. X                page_height -
  529. X                (margin_top + dp2in(atof(number)))); break;
  530. X    case POS_REL_POSITIVE:    /* Relative positive */
  531. X      lj_cursor_ver_rel(ofile, dp2in(atof(number))); break;
  532. X    case POS_REL_NEGATIVE:    /* Relative negative */
  533. X      lj_cursor_ver_rel(ofile, -(dp2in(atof(number)))); break;
  534. X    default:
  535. X      internal_error("illegal positioning code", "");
  536. X    }
  537. X    lj_undl_mark(ofile);
  538. X    lj_text_begin();
  539. X      }
  540. X      else if( operation('C') ){ /* Move horizontally by columns */
  541. X    lj_text_end(ofile);
  542. X    switch( pos_code ){
  543. X    case POS_ABSOLUTE:    /* Absolute postioning */
  544. X      lj_cursor_hor_abs(ofile, co2in(atof(number))); break;
  545. X    case POS_REL_POSITIVE:    /* Relative positive */
  546. X      lj_cursor_hor_rel(ofile, co2in(atof(number))); break;
  547. X    case POS_REL_NEGATIVE:    /* Relative negative */
  548. X      lj_cursor_hor_rel(ofile, -(co2in(atof(number)))); break;
  549. X    default:
  550. X      internal_error("illegal positioning code", "");
  551. X    }
  552. X    lj_text_begin();
  553. X      }
  554. X      else if( operation('H') ){ /* Move horizontally by decipoints */
  555. X    lj_text_end(ofile);
  556. X    switch( pos_code ){
  557. X    case POS_ABSOLUTE:    /* Absolute positioning */
  558. X      lj_cursor_hor_abs(ofile, dp2in(atof(number))); break;
  559. X    case POS_REL_POSITIVE:    /* Relative positive */
  560. X      lj_cursor_hor_rel(ofile, dp2in(atof(number))); break;
  561. X    case POS_REL_NEGATIVE:    /* Relative negative */
  562. X      lj_cursor_hor_rel(ofile, -(dp2in(atof(number)))); break;
  563. X    default:
  564. X      internal_error("illegal positioning code", "");
  565. X    }
  566. X    lj_text_begin();
  567. X      }
  568. X      else if( operation('L') ){ /* Set the left margin */
  569. X    switch( pos_code ){
  570. X    case POS_ABSOLUTE:    /* Absolute positioning */
  571. X      margin_left = co2in(atof(number)); break;
  572. X    case POS_REL_POSITIVE:    /* Relative positive */
  573. X      margin_left += co2in(atof(number)); break;
  574. X    case POS_REL_NEGATIVE:    /* Relative negative */
  575. X      margin_left -= co2in(atof(number)); break;
  576. X    default:
  577. X      internal_error("illegal positioning code", "");
  578. X    }
  579. X    lj_text_end(ofile);
  580. X    fprintf(ofile, "/ml %4f def ", margin_left);
  581. X    if( empty_line ) lj_cursor_hor_abs(ofile, margin_left);
  582. X    lj_text_begin();
  583. X      }
  584. X      else if( operation('M') ){ /* Set the right margin */
  585. X    switch( pos_code ){
  586. X    case POS_ABSOLUTE:    /* Absolute positioning */
  587. X      text_width = co2in((atof(number) + 1)) - margin_left; break;
  588. X    case POS_REL_POSITIVE:    /* Relative positive */
  589. X      text_width += co2in(atof(number)); break;
  590. X    case POS_REL_NEGATIVE:    /* Relative negative */
  591. X      text_width -= co2in(atof(number)); break;
  592. X    default:
  593. X      internal_error("illegal positioning code", "");
  594. X    } /* switch( pos_code ) */
  595. X    lj_text_end(ofile);
  596. X    fprintf(ofile, "%.4f RM ", /* Reset the clipping path */
  597. X        margin_left + text_width);
  598. X    lj_text_begin();
  599. X      } /* else if( M ) */
  600. X      else{            /* Unknown command */
  601. X    warning("unknown command with prefix <esc>&a -- ignoring", "");
  602. X      } /* else */
  603. X      break;
  604. X    default:
  605. X      internal_error("illegal token encountered in parameters", "");
  606. X    } /* switch(...) */
  607. X  } while( curr_token.code != PARAM_END );
  608. X
  609. X} /* ljcmd_amp_a() */
  610. X
  611. X
  612. X
  613. Xvoid
  614. Xljcmd_amp_d(ifile, ofile)    /* Command: ^[&d underline */
  615. X     FILE *ifile, *ofile;
  616. X{
  617. X
  618. X  do{
  619. X      /* Read the next token */
  620. X      /* If EOF is reached, then flag an error and return */
  621. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  622. X      error("end-of-file reached while reading parameters", variable);
  623. X    }
  624. X#ifdef DEBUG
  625. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  626. X#endif
  627. X    switch( curr_token.code ){
  628. X    case PARAM_CONTINUE:
  629. X    case PARAM_END:
  630. X      if( operation('D') ){
  631. X      /* Note: you *must* end the text before setting underline mode.
  632. X      ** Otherwise, the text printed *before* underlining is turned on
  633. X      ** is not flushed from the text buffer, and will also be
  634. X      ** underlined.
  635. X      */
  636. X    lj_text_end(ofile);
  637. X    lj_undl_begin(ofile);
  638. X    lj_text_begin();
  639. X      }
  640. X      else if( operation('@') ){
  641. X    lj_text_end(ofile);
  642. X        lj_undl_end(ofile);
  643. X        lj_text_begin();
  644. X      }
  645. X      else{            /* Unknown command */
  646. X    warning("unknown command with prefix <esc>&d -- ignoring", "");
  647. X      }
  648. X      break;
  649. X    default:
  650. X      internal_error("illegal token encountered in parameters", "");
  651. X    } /* switch(...) */
  652. X  } while( curr_token.code != PARAM_END );
  653. X
  654. X} /* ljcmd_amp_d() */
  655. X
  656. X
  657. X
  658. Xvoid
  659. Xljcmd_amp_f(ifile, ofile)    /* Command: ^[&f macros, position stack */
  660. X     FILE *ifile, *ofile;
  661. X{
  662. X
  663. X  warning("command family <esc>&f not implemented -- ignoring", "");
  664. X
  665. X  do{
  666. X      /* Read the next token */
  667. X      /* If EOF is reached, then flag an error and return */
  668. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  669. X      error("end-of-file reached while reading parameters", variable);
  670. X    }
  671. X#ifdef DEBUG
  672. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  673. X#endif
  674. X    switch( curr_token.code ){
  675. X    case PARAM_CONTINUE:
  676. X      break;
  677. X    case PARAM_END:
  678. X      break;
  679. X    default:
  680. X      internal_error("illegal token encountered in parameters", "");
  681. X    } /* switch(...) */
  682. X  } while( curr_token.code != PARAM_END );
  683. X
  684. X} /* ljcmd_amp_f() */
  685. X
  686. X
  687. X
  688. Xvoid
  689. Xljcmd_amp_k(ifile, ofile)    /* Command: ^[&k HMI, pitch, line termination*/
  690. X     FILE *ifile, *ofile;
  691. X{
  692. X
  693. X  do{
  694. X      /* Read the next token */
  695. X      /* If EOF is reached, then flag an error and return */
  696. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  697. X      error("end-of-file reached while reading parameters", variable);
  698. X    }
  699. X#ifdef DEBUG
  700. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  701. X#endif
  702. X    switch( curr_token.code ){
  703. X    case PARAM_CONTINUE:
  704. X    case PARAM_END:
  705. X      if( operation('H') ){    /* Set HMI */
  706. X    switch( pos_code ){
  707. X    case POS_ABSOLUTE:    /* Absolute postioning */
  708. X      char_width  = hi2in(atof(number)); break;
  709. X    case POS_REL_POSITIVE:    /* Relative positive */
  710. X      char_width += hi2in(atof(number)); break;
  711. X    case POS_REL_NEGATIVE:    /* Relative negative */
  712. X      char_width -= hi2in(atof(number)); break;
  713. X    default:
  714. X      internal_error("illegal positioning code", "");
  715. X    }
  716. X      } /* if( K ) */
  717. X      else{            /* Unknown command */
  718. X    warning("unknown command with prefix <esc>&k -- ignoring", "");
  719. X      }
  720. X      break;
  721. X    default:
  722. X      internal_error("illegal token encountered in parameters", "");
  723. X    } /* switch(...) */
  724. X  } while( curr_token.code != PARAM_END );
  725. X
  726. X} /* ljcmd_amp_k() */
  727. X
  728. X
  729. X
  730. Xvoid
  731. Xljcmd_amp_l(ifile, ofile)    /* Command: ^[&l page attributes */
  732. X     FILE *ifile, *ofile;
  733. X{
  734. X  double tmp;
  735. X  int old_orientation;
  736. X
  737. X  do{
  738. X      /* Read the next token */
  739. X      /* If EOF is reached, then flag an error and return */
  740. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  741. X      error("end-of-file reached while reading parameters", variable);
  742. X    }
  743. X#ifdef DEBUG
  744. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  745. X#endif
  746. X    switch( curr_token.code ){
  747. X    case PARAM_CONTINUE:
  748. X    case PARAM_END:
  749. X      if( operation('A') ){ /* Set the page size */
  750. X    switch( pos_code ){
  751. X    case POS_ABSOLUTE:    /* Absolute positioning */
  752. X      switch( atoi(number) ){
  753. X      case  1:        /* Executive */
  754. X        page_size.code = LJ_PS_EXECUTIVE;
  755. X        warning("EXECUTIVE paper size is not available", "");
  756. X        break;
  757. X      case  2:        /* Letter */
  758. X        page_size.code = LJ_PS_LETTER;
  759. X        lj_text_end(ofile);
  760. X        fputs("letter ", ofile);
  761. X        lj_text_begin();
  762. X        warning("paper changed to LETTER size", "");
  763. X        break;
  764. X      case  3:        /* Legal */
  765. X        page_size.code = LJ_PS_LEGAL;
  766. X        lj_text_end(ofile);
  767. X        fputs("legal ", ofile);
  768. X        lj_text_begin();
  769. X        warning("paper changed to LEGAL size", "");
  770. X        break;
  771. X      case 26:        /* A4 */
  772. X        page_size.code = LJ_PS_A4;
  773. X        lj_text_end(ofile);
  774. X        fputs("a4 ", ofile);
  775. X        lj_text_begin();
  776. X        warning("paper changed to A4 size", "");
  777. X        break;
  778. X      case 80:        /* Monarch */
  779. X        page_size.code = LJ_PS_MONARCH;
  780. X        warning("MONARCH envelope size is not available", "");
  781. X        break;
  782. X      case 81:        /* Commercial 10 */
  783. X        page_size.code = LJ_PS_COMMERCIAL10;
  784. X        warning("COMMERCIAL-10 envelope size is not available", "");
  785. X        break;
  786. X      case 90:        /* International DL */
  787. X        page_size.code = LJ_PS_INTERNATIONALDL;
  788. X        warning("INTERNATIONAL-DL envelope size is not available", "");
  789. X        break;
  790. X      case 91:        /* International C5 */
  791. X        page_size.code = LJ_PS_INTERNATIONALC5;
  792. X        warning("INTERNATIONAL-C5 envelope size is not available", "");
  793. X        break;
  794. X      default:
  795. X        error("illegal paper size code", number);
  796. X      } /* switch( number ) */
  797. X        /* Find the correct paper size parameters */
  798. X      if( lj_paper_size(&page_size) ){
  799. X        internal_error("illegal page size", "");
  800. X      }
  801. X        /* Set the new page width and height */
  802. X      if( orientation == LJ_OR_PORTRAIT ){
  803. X        page_width = page_size.width;
  804. X        page_height = page_size.height;
  805. X      }
  806. X      else{
  807. X        page_width = page_size.height;
  808. X        page_height = page_size.width;
  809. X      }
  810. X        /* Reset several page control parameters */
  811. X      margin_top  = 0.5;        /* Top and bottom margins are 1/2" */
  812. X      text_height = page_height - margin_top - 0.5;
  813. X      char_height = text_height / panel_form;
  814. X      char_width  = font_p.width;    /* inches per character */
  815. X      text_length = text_height / char_height;
  816. X        /* Flush the current page */
  817. X      lj_page_end(ofile);
  818. X      lj_page_begin();
  819. X      break;
  820. X    case POS_REL_POSITIVE:    /* Relative positive */
  821. X    case POS_REL_NEGATIVE:    /* Relative negative */
  822. X      error("cannot use relative page size codes!", number);
  823. X    default:
  824. X      internal_error("illegal positioning code", "");
  825. X    }
  826. X      } /* else if( A ) */
  827. X      else if( operation('C') ){    /* Set VMI */
  828. X    switch( pos_code ){
  829. X    case POS_ABSOLUTE:    /* Absolute postioning */
  830. X      char_height  = vi2in(atof(number)); break;
  831. X    case POS_REL_POSITIVE:    /* Relative positive */
  832. X      char_height += vi2in(atof(number)); break;
  833. X    case POS_REL_NEGATIVE:    /* Relative negative */
  834. X      char_height -= vi2in(atof(number)); break;
  835. X    default:
  836. X      internal_error("illegal positioning code", "");
  837. X    }
  838. X      } /* else if( C ) */
  839. X      else if( operation('D') ){    /* Set lines per inch */
  840. X    switch( pos_code ){
  841. X    case POS_ABSOLUTE:    /* Absolute postioning */
  842. X      char_height  = 1 / atof(number); break;
  843. X    case POS_REL_POSITIVE:    /* Relative positive */
  844. X      char_height += 1 / atof(number); break;
  845. X    case POS_REL_NEGATIVE:    /* Relative negative */
  846. X      char_height -= 1 / atof(number); break;
  847. X    default:
  848. X      internal_error("illegal positioning code", "");
  849. X    }
  850. X      } /* else if( D ) */
  851. X      else if( operation('E') ){ /* Set the top margin */
  852. X    switch( pos_code ){
  853. X    case POS_ABSOLUTE:    /* Absolute positioning */
  854. X      margin_top =  ro2in(atof(number)); break;
  855. X    case POS_REL_POSITIVE:    /* Relative positive */
  856. X      margin_top -= ro2in(atof(number)); break;
  857. X    case POS_REL_NEGATIVE:    /* Relative negative */
  858. X      margin_top += ro2in(atof(number)); break;
  859. X    default:
  860. X      internal_error("illegal positioning code", "");
  861. X    }
  862. X    if( empty_page ){
  863. X      current_x    = margin_left;
  864. X      current_y    = page_height - margin_top - char_height;
  865. X      current_line = 1;
  866. X      lj_cursor_abs(ofile, current_x, current_y);
  867. X    }
  868. X      }
  869. X      else if( operation('F') ){ /* Set the text length */
  870. X    switch( pos_code ){
  871. X    case POS_ABSOLUTE:    /* Absolute positioning */
  872. X      text_length =  atoi(number); break;
  873. X    case POS_REL_POSITIVE:    /* Relative positive */
  874. X      text_length += atoi(number); break;
  875. X    case POS_REL_NEGATIVE:    /* Relative negative */
  876. X      text_length -= atoi(number); break;
  877. X    default:
  878. X      internal_error("illegal positioning code", "");
  879. X    }
  880. X      /* Reset the text_height */
  881. X    text_height = text_length * char_height;
  882. X      } /* else if( F ) */
  883. X      else if( operation('H') ){ /* Set the paper source */
  884. X    switch( pos_code ){
  885. X    case POS_ABSOLUTE:    /* Absolute positioning */
  886. X      switch( atoi(number) ){
  887. X      case 0:        /* Eject current page */
  888. X        lj_page_end(ofile);
  889. X        lj_page_begin(ofile);
  890. X        break;
  891. X      case 1:        /* Feed from the internal tray */
  892. X        paper_source = LJ_PS_TRAY_1;
  893. X        lj_page_end(ofile);
  894. X        lj_page_begin(ofile);
  895. X        lj_text_end(ofile);
  896. X        fputs("statusdict begin /manualfeed false def end\n", ofile);
  897. X        lj_text_begin();
  898. X        break;
  899. X      case 2:        /* Manual feed */
  900. X        if(   (page_size.code == LJ_PS_EXECUTIVE)
  901. X           || (page_size.code == LJ_PS_LETTER)
  902. X           || (page_size.code == LJ_PS_LEGAL)
  903. X           || (page_size.code == LJ_PS_A4) ){
  904. X          paper_source = LJ_PS_MANUAL;
  905. X        }
  906. X        else{
  907. X          paper_source = LJ_PS_MANUAL_ENVELOPE;
  908. X        }
  909. X        lj_page_end(ofile);
  910. X        lj_page_begin(ofile);
  911. X        lj_text_end(ofile);
  912. X        fputs("statusdict begin /manualfeed true def end\n", ofile);
  913. X        lj_text_begin();
  914. X        break;
  915. X      default:
  916. X        error("illegal paper source code -- ignoring", number);
  917. X      }
  918. X      break;
  919. X    case POS_REL_POSITIVE:    /* Relative positive */
  920. X    case POS_REL_NEGATIVE:    /* Relative negative */
  921. X      error("illegal paper source code -- ignoring", number);
  922. X      break;
  923. X    default:
  924. X      internal_error("illegal positioning code", "");
  925. X    }
  926. X      } /* else if( H ) */
  927. X      else if( operation('O') ){ /* Set the page orientation */
  928. X    old_orientation = orientation;
  929. X    switch( pos_code ){
  930. X    case POS_ABSOLUTE:    /* Absolute positioning */
  931. X    case POS_REL_POSITIVE:    /* Relative positive */
  932. X    case POS_REL_NEGATIVE:    /* Relative negative */
  933. X      switch( atoi(number) ){
  934. X      case 0:        /* Portrait */
  935. X        orientation = LJ_OR_PORTRAIT;  break;
  936. X      case 1:        /* Landscape */
  937. X        orientation = LJ_OR_LANDSCAPE; break;
  938. X      default:
  939. X        warning("illegal page orientation -- ignoring", "");
  940. X      } /* switch( number ) */
  941. X      break;
  942. X    default:
  943. X      internal_error("illegal page orientation", "");
  944. X    }
  945. X    if( orientation != old_orientation ){
  946. X      lj_page_end(ofile);
  947. X      if( orientation == LJ_OR_PORTRAIT ){ /* Set new width & height */
  948. X        page_width = page_size.width;
  949. X        page_height = page_size.height;
  950. X      }
  951. X      else{
  952. X        page_width = page_size.height;
  953. X        page_height = page_size.width;
  954. X      }
  955. X      lj_page_begin(ofile);
  956. X    } /* if( change in orientation ) */
  957. X      } /* else if( O ) */
  958. X      else if( operation('X') ){ /* Set the number of copies */
  959. X    switch( pos_code ){
  960. X    case POS_ABSOLUTE:    /* Absolute positioning */
  961. X      copies  = atoi(number); break;
  962. X    case POS_REL_POSITIVE:    /* Relative positive */
  963. X      copies += atoi(number); break;
  964. X    case POS_REL_NEGATIVE:    /* Relative negative */
  965. X      copies -= atoi(number); break;
  966. X    default:
  967. X      internal_error("illegal number of copies", "");
  968. X    }
  969. X    lj_text_end(ofile);
  970. X    lj_copies(ofile, copies);
  971. X    lj_text_begin();
  972. X      } /* else if( X ) */
  973. X      else{            /* Unknown command */
  974. X    warning("unknown command with prefix <esc>&l -- ignoring", "");
  975. X      }
  976. X      break;
  977. X    default:
  978. X      internal_error("illegal token encountered in parameters", "");
  979. X    } /* switch(...) */
  980. X  } while( curr_token.code != PARAM_END );
  981. X
  982. X} /* ljcmd_amp_l() */
  983. X
  984. X
  985. X
  986. Xvoid
  987. Xljcmd_amp_p(ifile, ofile)    /* Command: ^[&p transparent print data */
  988. X     FILE *ifile, *ofile;
  989. X{
  990. X
  991. X  warning("command family <esc>&p not implemented -- ignoring", "");
  992. X
  993. X  do{
  994. X      /* Read the next token */
  995. X      /* If EOF is reached, then flag an error and return */
  996. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  997. X      error("end-of-file reached while reading parameters", variable);
  998. X    }
  999. X#ifdef DEBUG
  1000. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  1001. X#endif
  1002. X    switch( curr_token.code ){
  1003. X    case PARAM_CONTINUE:
  1004. X      break;
  1005. X    case PARAM_END:
  1006. X      break;
  1007. X    default:
  1008. X      internal_error("illegal token encountered in parameters", "");
  1009. X    } /* switch(...) */
  1010. X  } while( curr_token.code != PARAM_END );
  1011. X
  1012. X} /* ljcmd_amp_p() */
  1013. X
  1014. X
  1015. X
  1016. Xvoid
  1017. Xljcmd_amp_s(ifile, ofile)    /* Command: ^[&s end-of-line wrap */
  1018. X     FILE *ifile, *ofile;
  1019. X{
  1020. X
  1021. X  warning("command family <esc>&s not implemented -- ignoring", "");
  1022. X
  1023. X  do{
  1024. X      /* Read the next token */
  1025. X      /* If EOF is reached, then flag an error and return */
  1026. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  1027. X      error("end-of-file reached while reading parameters", variable);
  1028. X    }
  1029. X#ifdef DEBUG
  1030. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  1031. X#endif
  1032. X    switch( curr_token.code ){
  1033. X    case PARAM_CONTINUE:
  1034. X      break;
  1035. X    case PARAM_END:
  1036. X      break;
  1037. X    default:
  1038. X      internal_error("illegal token encountered in parameters", "");
  1039. X    } /* switch(...) */
  1040. X  } while( curr_token.code != PARAM_END );
  1041. X
  1042. X} /* ljcmd_amp_s() */
  1043. X
  1044. X
  1045. X
  1046. Xvoid
  1047. Xljcmd_star_b(ifile, ofile)    /* Command: ^[*b bitmap transfer */
  1048. X     FILE *ifile, *ofile;
  1049. X{
  1050. X
  1051. X  warning("command family <esc>*b not implemented -- ignoring", "");
  1052. X
  1053. X  do{
  1054. X      /* Read the next token */
  1055. X      /* If EOF is reached, then flag an error and return */
  1056. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  1057. X      error("end-of-file reached while reading parameters", variable);
  1058. X    }
  1059. X#ifdef DEBUG
  1060. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  1061. X#endif
  1062. X    switch( curr_token.code ){
  1063. X    case PARAM_CONTINUE:
  1064. X      break;
  1065. X    case PARAM_END:
  1066. X      break;
  1067. X    default:
  1068. X      internal_error("illegal token encountered in parameters", "");
  1069. X    } /* switch(...) */
  1070. X  } while( curr_token.code != PARAM_END );
  1071. X
  1072. X} /* ljcmd_star_b() */
  1073. X
  1074. X
  1075. X
  1076. Xvoid
  1077. Xljcmd_star_c(ifile, ofile)    /* Command: ^[*c graphics, soft fonts */
  1078. X     FILE *ifile, *ofile;
  1079. X{
  1080. X
  1081. X  warning("command family <esc>*c not implemented -- ignoring", "");
  1082. X
  1083. X  do{
  1084. X      /* Read the next token */
  1085. X      /* If EOF is reached, then flag an error and return */
  1086. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  1087. X      error("end-of-file reached while reading parameters", variable);
  1088. X    }
  1089. X#ifdef DEBUG
  1090. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  1091. X#endif
  1092. X    switch( curr_token.code ){
  1093. X    case PARAM_CONTINUE:
  1094. X      break;
  1095. X    case PARAM_END:
  1096. X      break;
  1097. X    default:
  1098. X      internal_error("illegal token encountered in parameters", "");
  1099. X    } /* switch(...) */
  1100. X  } while( curr_token.code != PARAM_END );
  1101. X
  1102. X} /* ljcmd_star_c() */
  1103. X
  1104. X
  1105. X
  1106. Xvoid
  1107. Xljcmd_star_p(ifile, ofile)    /* Command: ^[*p device-dependent movement */
  1108. X     FILE *ifile, *ofile;
  1109. X{
  1110. X
  1111. X  do{
  1112. X      /* If EOF is reached, then flag an error and return */
  1113. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  1114. X      error("end-of-file reached while reading parameters", variable);
  1115. X    }
  1116. X#ifdef DEBUG
  1117. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  1118. X#endif
  1119. X    switch( curr_token.code ){
  1120. X    case PARAM_CONTINUE:
  1121. X    case PARAM_END:
  1122. X      if( operation('X') ){    /* Move horizontally by dots*/
  1123. X    lj_text_end(ofile);
  1124. X    switch( pos_code ){
  1125. X    case POS_ABSOLUTE:    /* Absolute postioning */
  1126. X      lj_cursor_hor_abs(ofile, dt2in(atof(number))); break;
  1127. X    case POS_REL_POSITIVE:    /* Relative positive */
  1128. X      lj_cursor_hor_rel(ofile, dt2in(atof(number))); break;
  1129. X    case POS_REL_NEGATIVE:    /* Relative negative */
  1130. X      lj_cursor_hor_rel(ofile, -(dt2in(atof(number)))); break;
  1131. X    default:
  1132. X      internal_error("illegal positioning code", "");
  1133. X    }
  1134. X    lj_text_begin();
  1135. X      }
  1136. X      else if( operation('Y') ){ /* Move vertically by dots */
  1137. X    lj_text_end(ofile);
  1138. X    lj_undl_flush(ofile);
  1139. X    switch( pos_code ){
  1140. X    case POS_ABSOLUTE:    /* Absolute postioning */
  1141. X      lj_cursor_ver_abs(ofile,
  1142. X                page_height -
  1143. X                (margin_top + dt2in(atof(number))));
  1144. X      break;
  1145. X    case POS_REL_POSITIVE:    /* Relative positive */
  1146. X      lj_cursor_ver_rel(ofile, dt2in(atof(number))); break;
  1147. X    case POS_REL_NEGATIVE:    /* Relative negative */
  1148. X      lj_cursor_ver_rel(ofile, -(dt2in(atof(number)))); break;
  1149. X    default:
  1150. X      internal_error("illegal positioning code", "");
  1151. X    }
  1152. X    lj_undl_mark(ofile);
  1153. X    lj_text_begin();
  1154. X      } /* else if( Y ) */
  1155. X      else{            /* Unknown command */
  1156. X    warning("unknown command with prefix <esc>*p -- ignoring", "");
  1157. X      }
  1158. X      break;
  1159. X    default:
  1160. X      internal_error("illegal token encountered in parameters", "");
  1161. X    } /* switch(...) */
  1162. X  } while( curr_token.code != PARAM_END );
  1163. X
  1164. X} /* ljcmd_star_p() */
  1165. X
  1166. X
  1167. X
  1168. Xvoid
  1169. Xljcmd_star_r(ifile, ofile)    /* Command: ^[*r start/end graphics */
  1170. X     FILE *ifile, *ofile;
  1171. X{
  1172. X
  1173. X  warning("command family <esc>*r is not implemented -- ignoring", "");
  1174. X
  1175. X  do{
  1176. X      /* Read the next token */
  1177. X      /* If EOF is reached, then flag an error and return */
  1178. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  1179. X      error("end-of-file reached while reading parameters", variable);
  1180. X    }
  1181. X#ifdef DEBUG
  1182. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  1183. X#endif
  1184. X    switch( curr_token.code ){
  1185. X    case PARAM_CONTINUE:
  1186. X      break;
  1187. X    case PARAM_END:
  1188. X      break;
  1189. X    default:
  1190. X      internal_error("illegal token encountered in parameters", "");
  1191. X    } /* switch(...) */
  1192. X  } while( curr_token.code != PARAM_END );
  1193. X
  1194. X} /* ljcmd_star_r() */
  1195. X
  1196. X
  1197. Xvoid
  1198. Xljcmd_star_t(ifile, ofile)    /* Command: ^[*t graphics resolution */
  1199. X     FILE *ifile, *ofile;
  1200. X{
  1201. X
  1202. X  warning("command family <esc>*t is not implemented -- ignoring", "");
  1203. X
  1204. X  do{
  1205. X      /* Read the next token */
  1206. X      /* If EOF is reached, then flag an error and return */
  1207. X    if( (scan() == 0) && (curr_token.code == PARAM_CONTINUE) ){
  1208. X      error("end-of-file reached while reading parameters", variable);
  1209. X    }
  1210. X#ifdef DEBUG
  1211. X    if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
  1212. X#endif
  1213. X    switch( curr_token.code ){
  1214. X    case PARAM_CONTINUE:
  1215. X      break;
  1216. X    case PARAM_END:
  1217. X      break;
  1218. X    default:
  1219. X      internal_error("illegal token encountered in parameters", "");
  1220. X    } /* switch(...) */
  1221. X  } while( curr_token.code != PARAM_END );
  1222. X
  1223. X} /* ljcmd_star_t() */
  1224. SHAR_EOF
  1225. $TOUCH -am 0630160790 ljcmds.c &&
  1226. chmod 0644 ljcmds.c ||
  1227. echo "restore of ljcmds.c failed"
  1228. set `wc -c ljcmds.c`;Wc_c=$1
  1229. if test "$Wc_c" != "33110"; then
  1230.     echo original size 33110, current size $Wc_c
  1231. fi
  1232. fi
  1233. # ============= ljcmds.h ==============
  1234. if test X"$1" != X"-c" -a -f 'ljcmds.h'; then
  1235.     echo "File already exists: skipping 'ljcmds.h'"
  1236. else
  1237. echo "x - extracting ljcmds.h (Text)"
  1238. sed 's/^X//' << 'SHAR_EOF' > ljcmds.h &&
  1239. X/*
  1240. X** Project:        lj2ps
  1241. X** File:        ljcmds.h
  1242. X**
  1243. X** Author:        Christopher Lishka
  1244. X** Organization:    Wisconsin State Laboratory of Hygiene
  1245. X**            Data Processing Dept.
  1246. X**
  1247. X** Copyright (C) 1990 by Christopher Lishka.
  1248. X**
  1249. X** This program is free software; you can redistribute it and/or modify
  1250. X** it under the terms of the GNU General Public License as published by
  1251. X** the Free Software Foundation; either version 1, or (at your option)
  1252. X** any later version.
  1253. X**
  1254. X** This program is distributed in the hope that it will be useful,
  1255. X** but WITHOUT ANY WARRANTY; without even the implied warranty of
  1256. X** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1257. X** GNU General Public License for more details.
  1258. X**
  1259. X** You should have received a copy of the GNU General Public License
  1260. X** along with this program; if not, write to the Free Software
  1261. X** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1262. X*/
  1263. X
  1264. X#ifndef LJCMDS_H
  1265. X#define LJCMDS_H
  1266. X
  1267. X  /* Global constants
  1268. X  */
  1269. X
  1270. X  /* Global structure and type definitions
  1271. X  */
  1272. X
  1273. X  /* Global variables
  1274. X  */
  1275. X
  1276. X  /* Global macro definitions
  1277. X  */
  1278. X
  1279. X  /* Global functions
  1280. X  */
  1281. Xextern void  ljcmd_undefined();    /* Command: undefined */
  1282. Xextern void  ljcmd_E();        /* Command: ^[E  reset */
  1283. Xextern void  ljcmd_Y();        /* Command: ^[Y  display functions on */
  1284. Xextern void  ljcmd_Z();        /* Command: ^[Z  display functions off */
  1285. Xextern void  ljcmd_9();        /* Command: ^[9  clear margins */
  1286. Xextern void  ljcmd_eq();    /* Command: ^[=  half-line feed */
  1287. Xextern void  ljcmd_lp();    /* Command: ^[(  primary symbol set */
  1288. Xextern void  ljcmd_rp();    /* Command: ^[)  secondary symbol set */
  1289. Xextern void  ljcmd_lp_s();    /* Command: ^[(s primary font attributes */
  1290. Xextern void  ljcmd_rp_s();    /* Command: ^[)s secondary font attributes */
  1291. Xextern void  ljcmd_amp_a();    /* Command: ^[&a margins & movement */
  1292. Xextern void  ljcmd_amp_d();    /* Command: ^[&d underline */
  1293. Xextern void  ljcmd_amp_f();    /* Command: ^[&f macros, position stack */
  1294. Xextern void  ljcmd_amp_k();    /* Command: ^[&k HMI, pitch, line termination*/
  1295. Xextern void  ljcmd_amp_l();    /* Command: ^[&l page attributes */
  1296. Xextern void  ljcmd_amp_p();    /* Command: ^[&p transparent print data */
  1297. Xextern void  ljcmd_amp_s();    /* Command: ^[&s end-of-line wrap */
  1298. Xextern void  ljcmd_star_b();    /* Command: ^[*b bitmap transfer */
  1299. Xextern void  ljcmd_star_c();    /* Command: ^[*c graphics, soft fonts */
  1300. Xextern void  ljcmd_star_p();    /* Command: ^[*p device-dependent movement */
  1301. Xextern void  ljcmd_star_r();    /* Command: ^[*r start/end graphics */
  1302. Xextern void  ljcmd_star_t();    /* Command: ^[*t graphics resolution */
  1303. X
  1304. X#endif
  1305. SHAR_EOF
  1306. $TOUCH -am 0630160790 ljcmds.h &&
  1307. chmod 0644 ljcmds.h ||
  1308. echo "restore of ljcmds.h failed"
  1309. set `wc -c ljcmds.h`;Wc_c=$1
  1310. if test "$Wc_c" != "2558"; then
  1311.     echo original size 2558, current size $Wc_c
  1312. fi
  1313. fi
  1314. echo "End of part 10, continue with part 11"
  1315. exit 0
  1316.  
  1317.