home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_07_08 / v7n8104a.txt < prev    next >
Text File  |  1989-10-02  |  1KB  |  59 lines

  1. *** Listing 1 ***
  2.  
  3. /*
  4.  * hn.h - interface definition for the HNL
  5.  *
  6.  * Copyright(c) 1988 by Hobart Corporation.
  7.  * Used with permission.
  8.  */
  9.  
  10. /*
  11.  * port-level declarations
  12.  */
  13. enum hn_bps {HN_1200_BPS, HN_2400_BPS, HN_4800_BPS, HN_9600_BPS};
  14. typedef unsigned hn_bps;
  15.  
  16. enum hn_parity {HN_P_NONE, HN_P_ODD, HN_P_EVEN};
  17. typedef unsigned hn_parity;
  18.  
  19. #include <hn_port.h>
  20. typedef struct hn_port hn_port;
  21.  
  22. #define hn_perror(p) (p->errno)
  23.  
  24. hn_port *hn_popen(char *dev, hn_bps bps, hn_parity par,
  25.         unsigned data_bits, unsigned stop_bits);
  26. int hn_pclose(hn_port *p);
  27. int hn_pgetc(hn_port *p);
  28. int hn_pputc(int c, hn_port *p);
  29. int hn_pflush(hn_port *p);
  30. int hn_penable(hn_port *p);
  31. int hn_pdisable(hn_port *p);
  32.  
  33. /*
  34.  * stream-level declarations
  35.  */
  36. enum hn_model {HN_1860, HN_1865, HN_1870, ..., HN_SP1500};
  37. typedef unsigned hn_model;
  38.  
  39. struct hn_stream
  40.     {
  41.     unsigned si;        /* scale id */
  42.     unsigned fc;        /* function code */
  43.     hn_port *port;        /* attached port */
  44.     char blk_buf[2048];        /* packet buffer */
  45.     int errno;                  /* error code */
  46.     .
  47.     .
  48.     };
  49. typedef struct hn_stream hn_stream;
  50.  
  51. #define hn_serror(s) (s->errno)
  52.  
  53. hn_stream *hn_sopen
  54.     (hn_port *p, unsigned si, hn_model m, unsigned fc);
  55. int hn_sclose(hn_stream *s);
  56. int hn_sgetc(hn_stream *s);
  57. int hn_sputc(int c, hn_stream *s);
  58.  
  59.