home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / fortran / library / library / libry2a.doc < prev    next >
Text File  |  1989-11-10  |  8KB  |  274 lines

  1. .de
  2. .pa
  3.           SAMPLE USER-DEFINED HELP FILE FOR USE WITH HELPME ROUTINE
  4.  
  5.  
  6. HELPME  will check for any 3-character match with a line not having a "  "  in
  7.   column 1.
  8.  
  9. HELPME  will  dump  the  subsequent  information  to  the  CRT  until a "$" is
  10.   encountered in column 1.
  11.  
  12.  
  13. $USER-DEFINED HELP FILE
  14.    GENERAL HELP INFORMATION
  15.  PLOTS: TPLOT-based plot manager/command file builder
  16.  ----------------------------  selected keywords  ----------------------------
  17.  ABOVE         DASH          HP2EPS        MOVE          QUIT          SUPPRES
  18.  ABSOLUTE      DESTINATION   HP2IBM        NEWFILE       STOP          TEXT
  19.  ALTER         DISPLACE      HP2LJET       NEWLU         REGULAR       TICK
  20.  ARROW         D0TS          HP2STAR       NOAXES        RELATIVE      TICKL
  21.  ASPECT        DOTS          ITALICS       NOCOLOR       SCALE         TICKS
  22.  BELOW         DRAW          LABEL         NOLEGEND      SHADE         TILT
  23.  BOUNDS        END           LETTERS       NOTITLE       SLANT         UNDERLI
  24.  BUFFER        EXTRAX        LINE          NOXNUMS       SOLID         UPRIGHT
  25.  CHARACTERS    EXTRAY        LOGX          NOYNUMS       SPLIT         VECTOR
  26.  CIRCLE        FILES         LOGY          OVERRUN       SPOTS         WINDOW
  27.  COLOR         GRIDCOLOR     LU            PATTERN       SUBSCRIPT     XLOGX
  28.  CONTOUR       GRIDTYPE      MINOR         PLOT          SUPERSCRIPT   XLOGY
  29.  -----------------------------------------------------------------------------
  30.  Enter ?,keyword for help.  Note that only  the  first  three  characters  are
  31.  significant  (ie.   "?,STO"  and  "?,STOP"  are equivalent).  If you have any
  32.  other questions give me a call.
  33.  
  34.  To leave help and return to menu just hit Enter.
  35. $
  36. QUIT
  37. STOP
  38. HELP
  39.  If you want to get back to the menu, just hit Enter.
  40.  If you want to stop, just hit Enter twice.
  41. $
  42. FILES
  43.  TPLOT requires at least one file:  a command file.  All command files  should
  44.  have  the  extension ".PLT" in order for PLOTS to be able to distinguish them
  45.  from data files.  Optionally, TPLOT can handle one or more data files  for  a
  46.  given command file.  I recommend giving these the extension ".DAT".
  47. $
  48. NEWLU
  49. NEWFILE
  50.  TPLOT comes with a program called NEWLU.COM which will reassign the LU on the
  51.  second line of every file with the extension ".PLT" to the specified  number.
  52.  The new LU must be one of the following:  186,286,386,486,7470,7475,7550.  To
  53.  run it from DOS, enter something like:
  54.  
  55.       NEWLU 286
  56.  
  57.  which, for instance, will set all examples to EGA.
  58.  
  59.  NEWFILE tells TPLOT to look in a different file for data (NOTE:   NEWFILE  is
  60.  one  of  two  PLOT commands that CAN'T come before the title - it comes after
  61.  the last legend corresponding to the data read from the original file,  after
  62.  the  NEWFILE  command  you must start over part of the command sequence - see
  63.  the example "data from more than one file".
  64. $
  65. HP2EPS
  66. HP2IBM
  67. HP2LJET
  68. HP2STAR
  69.  HP2EPS translates HP GLC commands to Epson dot matrix commands for a printer.
  70.  
  71.  HP2IBM translates HP GLC commands to IBM dot matrix commands for a printer.
  72.  
  73.  HP2LJET translates HP GLC commands to HP LaserJet II graphics commands.
  74.  
  75.  HP2STAR translates HP GLC commands to STAR dot matrix commands for a printer.
  76. $
  77. 12
  78.  Error 12 occurs when more numbers were expected on a line than were read.
  79. $
  80. .pa
  81.                    EXAMPLE ILLUSTRATING THE USE OF RS232IO
  82.  
  83.  
  84. $STORAGE:2
  85.       PROGRAM EXAMPLE1
  86. C
  87. C  this program illustrates how to use RS232IO to "talk" to an HP pen plotter
  88. C
  89.       IMPLICIT INTEGER*2(I-N)
  90. C
  91. C  port parameters
  92. C
  93.       DATA IPORT,NBAUD,NSTOP,NBITS,IPAR/1,9600,0,8,0/
  94. C
  95. C  set up RS232 port
  96. C
  97.       CALL SEPORT(IPORT,NBAUD,NSTOP,NBITS,IPAR)
  98. C
  99. C  initialize plotter
  100. C
  101.       CALL OUTPUT('IN;VS18;',IPORT,IERR)
  102.       IF(IERR.NE.0) THEN
  103.         CALL WRTTY('unable to initialize plotter<')
  104.         GO TO 999
  105.       ENDIF
  106. C
  107. C  draw a 1"x1" box with pen 1
  108. C
  109.       CALL OUTPUT('SP1;PU5000,3500;PD6000,3500;PD6000,4500;PD5000,4500;P
  110.      &D5000,3500;PU;',IPORT,IERR)
  111.       IF(IERR.NE.0) GO TO 999
  112. C
  113. C  draw a 2"x2" box with pen 2
  114. C
  115.       CALL OUTPUT('SP2;PU4000,2500;PD7000,2500;PD7000,5500;PD4000,5500;P
  116.      &D4000,2500;PU;',IPORT,IERR)
  117.       IF(IERR.NE.0) GO TO 999
  118. C
  119. C  draw a 3"x3" box with pen 3
  120. C
  121.       CALL OUTPUT('SP3;PU3000,1500;PD8000,1500;PD8000,6500;PD3000,6500;P
  122.      &D3000,1500;PU;',IPORT,IERR)
  123.       IF(IERR.NE.0) GO TO 999
  124. C
  125. C  draw a 4"x4" box with pen 4
  126. C
  127.       CALL OUTPUT('SP4;PU2000, 500;PD9000, 500;PD9000,7500;PD2000,7500;P
  128.      &D2000, 500;PU;',IPORT,IERR)
  129.       IF(IERR.NE.0) GO TO 999
  130. C
  131. C  terminate plot and put the pen away
  132. C
  133.       CALL OUTPUT('PU0,0;SP0;',IPORT,IERR)
  134. C
  135.   999 STOP
  136.       END
  137.       SUBROUTINE SEPORT(IPORT,NBAUD,NSTOP,NBITS,IPAR)
  138. C
  139. C  set up RS232 port
  140. C
  141.       IMPLICIT INTEGER*2(I-N)
  142. C
  143. C  determine set up parameter
  144. C
  145.       ISETUP=0
  146.       IF(NBAUD.EQ.150) ISETUP = 32
  147.       IF(NBAUD.EQ.300) ISETUP = 64
  148.       IF(NBAUD.EQ.600) ISETUP = 96
  149.       IF(NBAUD.EQ.1200) ISETUP = 128
  150.       IF(NBAUD.EQ.2400) ISETUP = 160
  151.       IF(NBAUD.EQ.4800) ISETUP = 192
  152.       IF(NBAUD.EQ.9600) ISETUP = 224
  153. C
  154.       IF(IPAR.EQ.1) ISETUP=ISETUP+8
  155.       IF(IPAR.EQ.2) ISETUP=ISETUP+24
  156. C
  157.       IF(NBITS.EQ.7) THEN
  158.         IF(NSTOP.NE.0) ISETUP=ISETUP+4
  159.         ISETUP=ISETUP+2
  160.       ELSE
  161.         ISETUP=ISETUP+3
  162.       ENDIF
  163. C
  164. C  send setup parameter to the port
  165. C
  166.       CALL RS232IO(IPORT,0,ISETUP)
  167. C
  168.       RETURN
  169.       END
  170.       SUBROUTINE OUTPUT(CBUF,IPORT,IERR)
  171. C
  172. C  send a buffer to the plotter
  173. C
  174.       IMPLICIT INTEGER*2(I-N)
  175.       CHARACTER CBUF*(*)
  176.       DIMENSION IREADY(3),IHAND(7)
  177.       INTEGER*4 JSEC1,JSEC2
  178.       LOGICAL*2 IFBRK
  179.       DATA IREADY/27,46,79/
  180.       DATA IHAND/27,46,78,49,48,48,58/
  181. C
  182. C  determine buffer length
  183. C
  184.       NBUF=LEN(CBUF)
  185. C
  186. C  request extended hand-shake
  187. C
  188.       CALL ATIME(IHOUR,MIN,ISEC,IHUN)
  189.       JSEC1=INT4(3600)*INT4(IHOUR)+INT4(60)*INT4(MIN)+INT4(ISEC)
  190. C
  191.       DO 101 I=1,7
  192.   100 CALL RS232IO(IPORT,3,II)
  193.       IF(IAND(II,16).EQ.0) THEN
  194.         IF(IFBRK(0)) GO TO 102
  195.         CALL ATIME(IHOUR,MIN,ISEC,IHUN)
  196.         JSEC2=INT4(3600)*INT4(IHOUR)+INT4(60)*INT4(MIN)+INT4(ISEC)
  197.         IF(JSEC2-JSEC1.GT.INT4(60)) GO TO 103
  198.         GO TO 100
  199.       ENDIF
  200.   101 CALL RS232IO(IPORT,1,IHAND(I))
  201.       GO TO 110
  202. C
  203.   102 CALL WRTTY('BREAK detected at keyboard... TEST aborted!<')
  204.   103 CALL WRTTY('plotter "hand-shake" request failed<')
  205.       IERR=1
  206.       GO TO 999
  207. C
  208. C  check for buffer empty
  209. C
  210.   110 DO 112 I=1,3
  211.   111 CALL RS232IO(IPORT,3,II)
  212.       IF(IAND(II,16).EQ.0) THEN
  213.         IF(IFBRK(0)) GO TO 113
  214.         CALL ATIME(IHOUR,MIN,ISEC,IHUN)
  215.         JSEC2=INT4(3600)*INT4(IHOUR)+INT4(60)*INT4(MIN)+INT4(ISEC)
  216.         IF(JSEC2-JSEC1.GT.INT4(60)) GO TO 114
  217.         GO TO 111
  218.       ENDIF
  219.   112 CALL RS232IO(IPORT,1,IREADY(I))
  220.       GO TO 120
  221. C
  222.   113 CALL WRTTY('BREAK detected at keyboard... TEST aborted!<')
  223.   114 CALL WRTTY('plotter not ready<')
  224.       IERR=2
  225.       GO TO 999
  226. C
  227. C  wait for response from plotter
  228. C
  229.   120 IOK=0
  230.       DO 121 ITRY=1,10000
  231.       CALL RS232IO(IPORT,3,II)
  232.       IF(IAND(II,256).EQ.0) GO TO 121
  233. C
  234.       CALL RS232IO(IPORT,2,II)
  235.       IF(II.EQ.13) GO TO 130
  236.       IOK=IOK*10+IAND(II,255)-ICHAR('0')
  237.   121 CONTINUE
  238. C
  239.       IF(IFBRK(0)) GO TO 122
  240.       CALL ATIME(IHOUR,MIN,ISEC,IHUN)
  241.       JSEC2=INT4(3600)*INT4(IHOUR)+INT4(60)*INT4(MIN)+INT4(ISEC)
  242.       IF(JSEC2-JSEC1.GT.INT4(60)) GO TO 123
  243.       GO TO 110
  244. C
  245.   122 CALL WRTTY('BREAK detected at keyboard... TEST aborted!<')
  246.   123 CALL WRTTY('plotter did not respond to status inquiry<')
  247.       IERR=3
  248.       GO TO 999
  249. C
  250.   130 IF(IAND(IOK,8).EQ.0) GO TO 110
  251.       NTEST=16
  252. C
  253. C  dump buffer to RS232 port
  254. C
  255.   140 DO 142 I=1,NBUF
  256.   141 IF(IFBRK(0)) GO TO 143
  257.       CALL RS232IO(IPORT,3,II)
  258.       IF(IAND(II,NTEST).EQ.0) THEN
  259.         CALL ATIME(IHOUR,MIN,ISEC,IHUN)
  260.         JSEC2=INT4(3600)*INT4(IHOUR)+INT4(60)*INT4(MIN)+INT4(ISEC)
  261.         IF(JSEC2-JSEC1.GT.INT4(60)) GO TO 144
  262.         GO TO 141
  263.       ENDIF
  264.   142 CALL RS232IO(IPORT,1,ICHAR(CBUF(I:I)))
  265.       GO TO 999
  266. C
  267.   143 CALL WRTTY('BREAK detected at keyboard... TEST aborted!<')
  268.   144 CALL WRTTY('plotter would not accept buffer<')
  269.       IERR=4
  270. C
  271.   999 RETURN
  272.       END
  273. .ee
  274.