1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char sccsid[] = "@(#)motion.c	5.1 (Berkeley) 4/30/85";
   9: #endif not lint
  10: 
  11: /*
  12:  * Move the pen to x, y.  We assume we are already in ESCP mode.
  13:  */
  14: 
  15: #include "2648.h"
  16: 
  17: motion(x, y)
  18: {
  19:     char lox, loy, hix, hiy;
  20:     int delx, dely;
  21: 
  22:     delx = x-_penx; dely = y-_peny;
  23:     if (-16 <= delx && delx <= 15 && -16 <= dely && dely <= 15) {
  24:         /*
  25: 		 * Optimization: if within 15 in both directions, can use
  26: 		 * HP short incremental mode, only 3 bytes.
  27: 		 */
  28:         outchar('j');
  29:         outchar(32 + (delx & 31));
  30:         outchar(32 + (dely & 31));
  31:     } else {
  32:         /*
  33: 		 * Otherwise must use binary absolute mode, 5 bytes.
  34: 		 * We never use ascii mode or binary incremental, since
  35: 		 * those both take many more bytes.
  36: 		 */
  37:         outchar('i');
  38:         outchar(32+ ((x>>5) & 31));
  39:         outchar(32+ (x&31));
  40:         outchar(32+ ((y>>5) & 31));
  41:         outchar(32+ (y&31));
  42:     }
  43:     _penx = x;
  44:     _peny = y;
  45: }

Defined functions

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-04-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 796
Valid CSS Valid XHTML 1.0 Strict