home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / gnuplot / part25 < prev    next >
Encoding:
Text File  |  1993-10-24  |  80.6 KB  |  2,970 lines

  1. Newsgroups: comp.sources.misc
  2. From: woo@playfair.stanford.edu ("Alexander Woo")
  3. Subject: v40i037:  gnuplot - interactive function plotting utility, Part25/33
  4. Message-ID: <1993Oct25.025905.1963@sparky.sterling.com>
  5. X-Md4-Signature: bf8682448ab38cca5327eb2a8d561955
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Mon, 25 Oct 1993 02:59:05 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: woo@playfair.stanford.edu ("Alexander Woo")
  12. Posting-number: Volume 40, Issue 37
  13. Archive-name: gnuplot/part25
  14. Environment: UNIX, MS-DOS, VMS
  15. Supersedes: gnuplot3: Volume 24, Issue 23-48
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  gnuplot/demo/poldat.dem gnuplot/hrcgraph.asm
  22. #   gnuplot/term/eepic.trm gnuplot/term/fig.trm
  23. #   gnuplot/term/hpljii.trm gnuplot/term/object.h
  24. #   gnuplot/term/pstricks.trm gnuplot/term/vws.trm
  25. #   gnuplot/win/wgnuplib.h gnuplot/win/wpause.c
  26. # Wrapped by kent@sparky on Wed Oct 20 17:14:58 1993
  27. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  28. echo If this archive is complete, you will see the following message:
  29. echo '          "shar: End of archive 25 (of 33)."'
  30. if test -f 'gnuplot/demo/poldat.dem' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'gnuplot/demo/poldat.dem'\"
  32. else
  33.   echo shar: Extracting \"'gnuplot/demo/poldat.dem'\" \(1257 characters\)
  34.   sed "s/^X//" >'gnuplot/demo/poldat.dem' <<'END_OF_FILE'
  35. X#
  36. X# $Id: poldat.dem%v 3.38.2.88 1993/03/04 01:47:16 woo Exp woo $
  37. X#
  38. X#
  39. Xset size .8,1.0
  40. Xset time
  41. Xset clip
  42. Xset grid
  43. Xset noborder
  44. Xset noparam
  45. Xset title "Antenna Pattern"
  46. Xset xlabel "Azimuth"
  47. Xset ylabel "dBSM"
  48. Xset data style line
  49. Xset angles degrees
  50. Xset polar
  51. Xset yrange [-220:220]
  52. Xset rrange [-200:60]
  53. Xplot "polar.dat" using 1:5,"antenna.dat"
  54. Xpause -1 "Hit return to continue"
  55. Xset nogrid
  56. Xset nopolar
  57. Xset title "Primitive Smith Chart"
  58. Xset nokey
  59. Xset xlabel "Impedance or Admittance Coordinates"
  60. Xset para
  61. Xset nogrid
  62. Xset rrange [-0 : 10]
  63. Xset trange [-pi : pi]
  64. Xset xrange [-1:1]
  65. Xset yrange [-1:1]
  66. Xtv(t,r) = sin(t)/(1+r)
  67. Xtu(t,r) = (cos(t) +r)/(1+r)
  68. Xcu(t,x) = 1 + cos(t)/x
  69. Xcv(t,x) = (1+ sin(t))/x
  70. Xplot cu(t,.1),cv(t,.1),cu(t,.1),-cv(t,.1),\
  71. Xcu(t,1),cv(t,1),cu(t,1),-cv(t,1),\
  72. Xcu(t,10),cv(t,10),cu(t,10),-cv(t,10),\
  73. Xtu(t,.1),tv(t,.1),\
  74. Xtu(t,.5),tv(t,.5),\
  75. Xtu(t,1),tv(t,1),\
  76. Xtu(t,5),tv(t,5),\
  77. Xtu(t,10),tv(t,10),\
  78. Xcu(t,.5),cv(t,.5),cu(t,.5),-cv(t,.5),\
  79. Xtu(t,0),tv(t,0)
  80. X#cu(t,5),cv(t,5),cu(t,5),-cv(t,5)
  81. Xpause -1 "Hit return to continue"
  82. Xset noparam
  83. Xset key
  84. Xset size 1.0,1.0
  85. Xset notime
  86. Xset title "" 0,0
  87. Xset xlabel "" 0,0
  88. Xset ylabel "" 0,0
  89. Xset data style points
  90. Xset angles radians
  91. Xset nopolar
  92. Xset yrange [-10:10]
  93. Xset rrange [0:10]
  94. Xset auto
  95. Xset noparam
  96. Xset border
  97. Xset nogrid
  98. END_OF_FILE
  99.   if test 1257 -ne `wc -c <'gnuplot/demo/poldat.dem'`; then
  100.     echo shar: \"'gnuplot/demo/poldat.dem'\" unpacked with wrong size!
  101.   fi
  102.   # end of 'gnuplot/demo/poldat.dem'
  103. fi
  104. if test -f 'gnuplot/hrcgraph.asm' -a "${1}" != "-c" ; then 
  105.   echo shar: Will not clobber existing file \"'gnuplot/hrcgraph.asm'\"
  106. else
  107.   echo shar: Extracting \"'gnuplot/hrcgraph.asm'\" \(8192 characters\)
  108.   sed "s/^X//" >'gnuplot/hrcgraph.asm' <<'END_OF_FILE'
  109. XTITLE    Hercules graphics module
  110. X
  111. X;    Michael Gordon - 8-Dec-86
  112. X;
  113. X; Certain routines were taken from the Hercules BIOS of    Dave Tutelman - 8/86
  114. X; Others came from pcgraph.asm included in GNUPLOT by Colin Kelley
  115. X;
  116. X; modified slightly by Colin Kelley - 22-Dec-86
  117. X;    added header.mac, parameterized declarations
  118. X; added dgroup: in HVmodem to reach HCh_Parms and HGr_Parms - 30-Jan-87
  119. X; modified by Russell Lang 3 Jun 1988
  120. X;    added H_init
  121. X
  122. Xinclude header.mac
  123. X
  124. Xif1
  125. Xinclude lineproc.mac
  126. Xendif
  127. X
  128. X
  129. XGPg1_Base equ 0B800h    ; Graphics page 1 base address
  130. X
  131. X_text    segment
  132. X
  133. X    public _H_line, _H_color, _H_mask, _HVmode, _H_puts
  134. X    public _H_init
  135. X
  136. XHCfg_Switch equ    03BFH    ; Configuration Switch - software switch 
  137. X            ; to select graphics card memory map
  138. X
  139. Xbeginproc _H_init
  140. X    mov al, 03H    ; allow graphics in b8000:bffff
  141. X    mov dx, HCfg_Switch
  142. X    out dx, al
  143. X    ret
  144. X_H_init endp
  145. X
  146. Xhpixel    proc near
  147. X    ror word ptr bmask,1
  148. X    jc cont
  149. X    ret
  150. Xcont:
  151. X    push ax
  152. X    push bx
  153. X    push cx
  154. X    push dx
  155. X    push si
  156. X    mov cx,ax        ; x
  157. X    mov dx,bx        ; y
  158. X;
  159. X; [couldn't this be done faster with a lookup table? -cdk]
  160. X;
  161. X    ; first compute the address of byte to be modified
  162. X    ; = 90*[row/4] + [col/8] + 2^D*[row/4] + 2^F*page
  163. X    mov    bh,cl        ; col (low order) in BH
  164. X    mov    bl,dl        ; row (low order) in BL
  165. X    and    bx,0703H    ; mask the col & row remainders
  166. XIFDEF iAPX286
  167. X    shr    cx,3        ; col / 8
  168. X    shr    dx,2        ; row / 4
  169. X    mov    al,90
  170. X    mul    dx        ; AX = 90*[ row/4 ]
  171. X    add    ax,cx        ;  ... + col/8
  172. X    shl    bl,5        ; align row remainder
  173. XELSE            ; same as above, obscure but fast for 8086
  174. X    shr    cx,1        ; divide col by 8
  175. X    shr    cx,1
  176. X    shr    cx,1
  177. X    shr    dx,1        ; divide row by 4
  178. X    shr    dx,1
  179. X    shl    dx,1        ; begin fast multiply by 90 (1011010 B)
  180. X    mov    ax,dx
  181. X    shl    dx,1
  182. X    shl    dx,1
  183. X    add    ax,dx
  184. X    shl    dx,1
  185. X    add    ax,dx
  186. X    shl    dx,1
  187. X    shl    dx,1
  188. X    add    ax,dx        ; end fast multiply by 90
  189. X    add    ax,cx        ; add on the col/8
  190. X    shl    bl,1        ; align row remainder
  191. X    shl    bl,1
  192. X    shl    bl,1
  193. X    shl    bl,1
  194. X    shl    bl,1
  195. XENDIF
  196. X    add    ah,bl        ; use aligned row remainder
  197. Xend_adr_calc:            ; address of byte is now in AX
  198. X    mov    dx,GPg1_Base    ; base of pixel display to DX
  199. X    mov    es,dx        ; ...and thence to segment reg
  200. X    mov    si,ax        ; address of byte w/ pixel to index reg
  201. X    mov    cl,bh        ; bit addr in byte
  202. X    mov    al,80H        ; '1000 0000' in AL 
  203. X    shr    al,cl        ; shift mask to line up with bit to read/write
  204. Xset_pix:            ; set the pixel
  205. X    or    es:[si],al    ; or the mask with the right byte
  206. X    pop si
  207. X    pop dx
  208. X    pop cx
  209. X    pop bx
  210. X    pop ax
  211. X    ret
  212. Xhpixel endp
  213. X
  214. Xlineproc _H_line, hpixel
  215. X
  216. X;
  217. X; clear - clear page 1 of the screen buffer to zero (effectively, blank
  218. X;    the screen)
  219. X;
  220. Xclear   proc near
  221. X    push es
  222. X    push ax
  223. X    push cx
  224. X    push di
  225. X    mov ax, GPg1_Base
  226. X    mov es, ax
  227. X    xor di, di
  228. X    mov cx, 4000h
  229. X    xor ax, ax
  230. X    cld
  231. X    rep stosw            ; zero out screen page
  232. X    pop di
  233. X    pop cx
  234. X    pop ax
  235. X    pop es
  236. X    ret
  237. Xclear    endp
  238. X
  239. Xbeginproc _H_color
  240. X    push bp
  241. X    mov bp,sp
  242. X    mov al,[bp+X]            ; color
  243. X    mov byte ptr color,al
  244. X    pop bp
  245. X    ret
  246. X_H_color endp
  247. X
  248. Xbeginproc _H_mask
  249. X    push bp
  250. X    mov bp,sp
  251. X    mov ax,[bp+X]            ; mask
  252. X    mov word ptr bmask,ax
  253. X    pop bp
  254. X    ret
  255. X_H_mask endp
  256. X
  257. XHCtrl_Port    equ    03B8H    ; Hercules 6845 control port IO addr
  258. XHIndx_Port    equ    03B4H    ; Hercules 6845 index port IO addr
  259. XHScrn_Enable    equ    008h    ; Control port bit to enable video
  260. XHCh_Mode    equ    020h    ; Character output mode
  261. XHGr_Mode    equ    082h    ; Graphics output mode page 1
  262. X
  263. Xparm_count equ 12
  264. X
  265. Xbeginproc _HVmode
  266. X    push bp
  267. X    mov bp, sp
  268. X    push si
  269. X    mov ax, [bp+X]
  270. X    or ah, al
  271. X    mov al, HCh_Mode        ; Assume character mode is wanted
  272. X    mov si, offset dgroup:HCh_Parms
  273. X    cmp ah, 0            ; nonzero means switch to graphics
  274. X    jz vmode_ok
  275. X    call near ptr clear        ; clear the graphics page
  276. X    mov al, HGr_Mode
  277. X    mov si, offset dgroup:HGr_Parms
  278. Xvmode_ok:
  279. X    mov dx, HCtrl_Port
  280. X    out dx, al            ; Set Hercules board to proper mode
  281. X    call near ptr setParms        ; Set the 6845 parameters
  282. X    or al, HScrn_Enable        ; Enable the video output
  283. X    out dx, al
  284. X    pop si
  285. X    pop bp
  286. X    ret
  287. X_HVmode    endp
  288. X
  289. XsetParms proc near        ; Send 6845 parms to Hercules board
  290. X    push ax
  291. X    push dx
  292. X    push si            
  293. X    mov dx, HIndx_Port    ; Index port addr -> DX
  294. X    mov ah, 0        ; 0 -> parameter counter
  295. Xsp_loop:
  296. X    mov al, ah
  297. X    out dx, al        ; output to 6845 addr register
  298. X    inc dx            ; next output to data register
  299. X    mov al, [si]        ; next control byte -> al
  300. X    inc si
  301. X    out dx, al        ; output control byte
  302. X    dec dx            ; 6845 index addr -> dx
  303. X    inc ah            ; bump addr
  304. X    cmp ah, parm_count
  305. X    jnz sp_loop
  306. X    pop si
  307. X    pop dx
  308. X    pop ax
  309. X    ret
  310. XsetParms endp
  311. X
  312. X; H_puts - print text in graphics mode
  313. X;
  314. X;    cx = row
  315. X;    bx = column
  316. X;    si = address of string (null terminated) to print
  317. X
  318. Xbeginproc _H_puts
  319. X    push bp
  320. X    mov bp, sp
  321. X    push si
  322. X    push ds
  323. X    mov si, [bp+X]            ; string offset
  324. X
  325. Xifdef LARGE_DATA
  326. X    mov ds, [bp+X+2]        ; string segment
  327. X    mov cx, [bp+X+4]        ; row
  328. X    mov bx, [bp+X+6]        ; col
  329. Xelse
  330. X    mov cx, [bp+X+2]        ; row
  331. X    mov bx, [bp+X+4]        ; col
  332. Xendif
  333. X
  334. Xploop:    lodsb                ; get next char
  335. X    or    al, al            ; end of display?
  336. X    je    pdone
  337. X    call near ptr display
  338. X    inc    bx            ; bump to next column
  339. X    jmp    ploop
  340. Xpdone:    pop ds
  341. X    pop si
  342. X    pop bp
  343. X    ret
  344. X_H_puts    endp
  345. X
  346. X;
  347. X; display - output an 8x8 character from the IBM ROM to the Herc board
  348. X;
  349. X; AX = char, BX = column (0-89), CX = row(0-42)  ** all preserved **
  350. X;
  351. XCON8    db    8
  352. XCON180    db    180
  353. XIBMROM    equ    0F000h
  354. XCHARTAB    equ    0FA6Eh
  355. X
  356. Xdisplay    proc near
  357. X    push    ds            ; save the lot
  358. X    push    es
  359. X    push    ax
  360. X    push    bx
  361. X    push    cx
  362. X    push    dx
  363. X    push    si
  364. X    push    di
  365. X
  366. X; setup ds -> IBM ROM, and si -> index into IBM ROM character table located
  367. X;    at 0fa6eh in the ROM
  368. X
  369. X    and    ax, 07fh
  370. X    mul    cs:CON8            ; mult by 8 bytes of table per char
  371. X    mov    si, ax
  372. X    mov    ax, IBMROM
  373. X    mov    ds, ax
  374. X    assume    ds:nothing
  375. X    add    si, CHARTAB        ; add offset of character table
  376. X
  377. X; compute index into Hercules screen memory for scan line 0.  The remaining
  378. X;    seven scan lines are all at fixed offsets from the first.
  379. X;
  380. X;    Since graphics mode treats the screen as sets of 16x4 "characters",
  381. X;    we need to map an 8x8 real character onto the front or back of
  382. X;    a pair of graphics "characters".  The first four scan lines of our
  383. X;    8x8 character will map to the top graphics "character", and the second
  384. X;    four scan lines map to the graphics character on the "line" (4 scan
  385. X;    lines high) below it.
  386. X;
  387. X;    For some exotic hardware reason (probably speed), all scan line 0
  388. X;    bits (i.e. every fourth scan line) are stored in memory locations
  389. X;    0-2000h in the screen buffer.  All scan line 1 bits are stored
  390. X;    2000h-4000h.  Within these banks, they are stored by rows.  The first
  391. X;    scan line on the screen (scan line 0 of graphics character row 0)
  392. X;    is the first 45 words of memory in the screen buffer.  The next 45
  393. X;    words are the first scan line graphics row 1, and since graphics
  394. X;    "characters" are 4 bits high, this second scan line is physically
  395. X;    the fifth scan line displayed on the screen.
  396. X;
  397. X;    SO, to display an 8x8 character, the 1st and 5th rows of dots are
  398. X;    both scan line 0 of the graphics "character", the 2nd and 6th are
  399. X;    scan line 1, and so on.
  400. X;
  401. X;    The column (0-89) tells which byte in a scan line we need to load.
  402. X;    Since it takes two rows of graphics characters to hold one row of
  403. X;    our characters, column+90 is a index to scan line 4 rows of pixels
  404. X;    higher (n+4).  Thus 180 bytes of screen memory in any bank (0h, 2000h,
  405. X;    4000h, 6000h) represent a row of 8x8 characters.
  406. X;    
  407. X;    The starting location in screen memory for the first scan line of
  408. X;    a character to be displayed will be:      (row*180)+column
  409. X;    The 5th scan line will be at:        (row*180)+column+90
  410. X;
  411. X;    The second and 6th scan lines will be at the above offsets plus
  412. X;    the bank offset of 2000h.  The third and 7th, add 4000h and finally
  413. X;    the 4th and 8th, add 6000h.
  414. X;
  415. X    mov    ax, GPg1_Base
  416. X    mov    es, ax            ; es = hercules page 0
  417. X    mov    ax, cx            ; get row
  418. X    mul    cs:CON180        ; mult by 180(10)
  419. X    mov    di, ax            ; di = index reg
  420. X    cld                ; insure right direction
  421. X
  422. X;output 8 segments of character to video ram
  423. X
  424. X    lodsb                ; line 0
  425. X    mov    es:[di+bx], al
  426. X    lodsb
  427. X    mov    es:[di+bx+2000h], al    ; line 1
  428. X    lodsb
  429. X    mov    es:[di+bx+4000h], al    ; line 2
  430. X    lodsb
  431. X    mov    es:[di+bx+6000h], al    ; line 3
  432. X    lodsb
  433. X    mov    es:[di+bx+90], al    ; line 4
  434. X    lodsb
  435. X    mov    es:[di+bx+2000h+90], al    ; line 5
  436. X    lodsb
  437. X    mov    es:[di+bx+4000h+90], al    ; line 6
  438. X    lodsb
  439. X    mov    es:[di+bx+6000h+90], al    ; line 7
  440. X
  441. X    pop    di
  442. X    pop    si
  443. X    pop    dx
  444. X    pop    cx
  445. X    pop    bx
  446. X    pop    ax
  447. X    pop    es
  448. X    pop    ds
  449. X    ret
  450. Xdisplay    endp
  451. X
  452. X_text    ends
  453. X
  454. X_data    segment
  455. Xbmask    dw -1
  456. Xcolor    db 1
  457. X_data    ends
  458. X
  459. Xconst    segment
  460. XHCh_Parms db     61H, 50H, 52H, 0FH, 19H, 06H, 19H, 19H, 02H, 0DH, 0BH, 0CH
  461. XHGr_Parms db    35H, 2DH, 2EH, 07H, 5BH, 02H, 57H, 57H, 02H, 03H, 00H, 00H
  462. Xconst    ends
  463. X
  464. X    end
  465. X
  466. X
  467. END_OF_FILE
  468.   if test 8192 -ne `wc -c <'gnuplot/hrcgraph.asm'`; then
  469.     echo shar: \"'gnuplot/hrcgraph.asm'\" unpacked with wrong size!
  470.   fi
  471.   # end of 'gnuplot/hrcgraph.asm'
  472. fi
  473. if test -f 'gnuplot/term/eepic.trm' -a "${1}" != "-c" ; then 
  474.   echo shar: Will not clobber existing file \"'gnuplot/term/eepic.trm'\"
  475. else
  476.   echo shar: Extracting \"'gnuplot/term/eepic.trm'\" \(7741 characters\)
  477.   sed "s/^X//" >'gnuplot/term/eepic.trm' <<'END_OF_FILE'
  478. X/*
  479. X * $Id: eepic.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  480. X *
  481. X */
  482. X
  483. X/* GNUPLOT - eepic.trm */
  484. X/*
  485. X * Copyright (C) 1990 - 1993   
  486. X *
  487. X * Permission to use, copy, and distribute this software and its
  488. X * documentation for any purpose with or without fee is hereby granted, 
  489. X * provided that the above copyright notice appear in all copies and 
  490. X * that both that copyright notice and this permission notice appear 
  491. X * in supporting documentation.
  492. X *
  493. X * Permission to modify the software is granted, but not the right to
  494. X * distribute the modified code.  Modifications are to be distributed 
  495. X * as patches to released version.
  496. X *  
  497. X * This software  is provided "as is" without express or implied warranty.
  498. X * 
  499. X * This file is included by ../term.c.
  500. X *
  501. X * This terminal driver supports:
  502. X *   The EEPIC macros for LaTeX. 
  503. X *
  504. X * AUTHORS
  505. X *   David Kotz
  506. X *
  507. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  508. X * 
  509. X */
  510. X/*
  511. X *  This file contains the eepic terminal driver, intended for use with the 
  512. X *  eepic.sty macro package for LaTeX. This is an alternative to the 
  513. X *  latex driver. You need eepic.sty, epic.sty, and a printer driver that
  514. X *  supports the tpic \specials.
  515. X *
  516. X * Although dotted and dashed lines are possible with EEPIC, and are
  517. X * tempting, they do not work well for high-sample-rate curves, mushing
  518. X * the dashes all together into a solid line. For now anyway, the EEPIC
  519. X * driver will have only solid lines. Anyone got a solution?
  520. X *
  521. X * LATEX must also be defined.
  522. X */
  523. X
  524. X#define EEPIC_PTS_PER_INCH (72.27)
  525. X#define DOTS_PER_INCH (300)    /* resolution of printer we expect to use */
  526. X#define EEPIC_UNIT (EEPIC_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
  527. X
  528. X/* 5 inches wide by 3 inches high (default) */
  529. X#define EEPIC_XMAX (5*DOTS_PER_INCH)  /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0) */
  530. X#define EEPIC_YMAX (3*DOTS_PER_INCH)  /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0) */
  531. X
  532. X#define EEPIC_HTIC (5*DOTS_PER_INCH/72)        /* (5./EEPIC_UNIT) */
  533. X#define EEPIC_VTIC (5*DOTS_PER_INCH/72)        /* (5./EEPIC_UNIT) */
  534. X#define EEPIC_HCHAR (DOTS_PER_INCH*53/10/72)    /* (5.3/EEPIC_UNIT) */
  535. X#define EEPIC_VCHAR (DOTS_PER_INCH*11/72)    /* (11./EEPIC_UNIT) */
  536. X
  537. Xstatic unsigned int EEPIC_posx;
  538. Xstatic unsigned int EEPIC_posy;
  539. Xenum JUSTIFY eepic_justify=LEFT;
  540. Xstatic int eepic_angle=0;
  541. X
  542. X/* for DOTS point style */
  543. X#define EEPIC_TINY_DOT "\\rule{.1pt}{.1pt}"
  544. X
  545. X/* POINTS */
  546. X#define EEPIC_POINT_TYPES 12    /* we supply more point types */
  547. Xstatic char GPFAR * GPFAR EEPIC_points[] = {
  548. X    "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Diamond$}}",
  549. X    "\\makebox(0,0){$+$}",
  550. X    "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Box$}}",
  551. X    "\\makebox(0,0){$\\times$}",
  552. X    "\\makebox(0,0){$\\triangle$}",
  553. X    "\\makebox(0,0){$\\star$}",
  554. X    "\\circle{12}", "\\circle{18}", "\\circle{24}",
  555. X    "\\circle*{12}", "\\circle*{18}", "\\circle*{24}"
  556. X};
  557. X
  558. X/* LINES */
  559. X#define EEPIC_NUMLINES 5        /* number of linetypes below */
  560. Xstatic char GPFAR * GPFAR EEPIC_lines[] = {
  561. X    "\\thicklines \\path",            /* -2 border */
  562. X    "\\thinlines \\drawline[-50]",        /* -1 axes */
  563. X    "\\thinlines \\path",            /*  0 solid thin  */
  564. X    "\\thicklines \\path",            /*  1 solid thick */
  565. X    "\\Thicklines \\path",            /*  2 solid Thick */
  566. X};
  567. X/* These are other possibilities
  568. X    "\\thinlines \\dottedline{30}",
  569. X    "\\thinlines \\drawline[-30]",    
  570. X    "\\thinlines \\dottedline{60}",
  571. X    "\\thinlines \\drawline[-60]",    
  572. X    "\\thinlines \\dashline[-10]{20}[6]"
  573. X*/
  574. Xstatic int EEPIC_type;        /* current line type */
  575. Xstatic TBOOLEAN EEPIC_inline = FALSE; /* are we in the middle of a line */
  576. Xstatic void EEPIC_endline();    /* terminate any line in progress */
  577. Xstatic int EEPIC_linecount = 0; /* number of points in line so far */
  578. X#define EEPIC_LINEMAX 50        /* max value for linecount */
  579. X
  580. X/* ARROWS */
  581. X/* we use the same code as for LATEX */
  582. Xstatic void best_latex_arrow(); /* figure out the best arrow */
  583. X
  584. XEEPIC_init()
  585. X{
  586. X    EEPIC_posx = EEPIC_posy = 0;
  587. X    EEPIC_linetype(-1);
  588. X    fprintf(outfile, "%% GNUPLOT: LaTeX picture using EEPIC macros\n");
  589. X    fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", EEPIC_UNIT);
  590. X}
  591. X
  592. X
  593. XEEPIC_scale(xs, ys)
  594. X    double xs, ys;            /* scaling factors */
  595. X{
  596. X    register struct termentry *t = &term_tbl[term];
  597. X
  598. X    /* we change the table for use in graphics.c and EEPIC_graphics */
  599. X    t->xmax = (unsigned int)(EEPIC_XMAX * xs);
  600. X    t->ymax = (unsigned int)(EEPIC_YMAX * ys);
  601. X
  602. X    return(TRUE);
  603. X}
  604. X
  605. XEEPIC_graphics()
  606. X{
  607. X    register struct termentry *t = &term_tbl[term];
  608. X
  609. X    fprintf(outfile, "\\begin{picture}(%d,%d)(0,0)\n", t->xmax, t->ymax);
  610. X    fprintf(outfile, "\\tenrm\n");
  611. X}
  612. X
  613. X
  614. XEEPIC_text()
  615. X{
  616. X    EEPIC_endline();
  617. X    fprintf(outfile, "\\end{picture}\n");
  618. X}
  619. X
  620. X
  621. XEEPIC_linetype(linetype)
  622. X    int linetype;
  623. X{
  624. X    EEPIC_endline();
  625. X
  626. X    if (linetype >= EEPIC_NUMLINES-2)
  627. X     linetype %= (EEPIC_NUMLINES-2);
  628. X
  629. X    EEPIC_type = linetype;
  630. X}
  631. X
  632. X
  633. X
  634. XEEPIC_move(x,y)
  635. X    unsigned int x,y;
  636. X{
  637. X    EEPIC_endline();
  638. X
  639. X    EEPIC_posx = x;
  640. X    EEPIC_posy = y;
  641. X}
  642. X
  643. X
  644. XEEPIC_point(x,y, number)        /* version of line_and_point */
  645. X    unsigned int x,y;
  646. X    int number;                /* type of point */
  647. X{
  648. X    EEPIC_move(x,y);
  649. X    
  650. X    /* Print the character defined by 'number'; number < 0 means 
  651. X      to use a dot, otherwise one of the defined points. */
  652. X    fprintf(outfile, "\\put(%d,%d){%s}\n", x, y, 
  653. X          (number < 0 ? EEPIC_TINY_DOT
  654. X           : EEPIC_points[number % EEPIC_POINT_TYPES]));
  655. X}
  656. X
  657. X
  658. XEEPIC_vector(ux,uy)
  659. X    unsigned int ux,uy;
  660. X{
  661. X    if (!EEPIC_inline) {
  662. X       EEPIC_inline = TRUE;
  663. X
  664. X       /* Start a new line. This depends on line type */
  665. X       fprintf(outfile, "%s(%u,%u)", 
  666. X             EEPIC_lines[EEPIC_type+2], 
  667. X             EEPIC_posx, EEPIC_posy);
  668. X       EEPIC_linecount = 1;
  669. X    } else {
  670. X       /* Even though we are in middle of a path, 
  671. X        * we may want to start a new path command. 
  672. X        * If they are too long then latex will choke.
  673. X        */
  674. X       if (EEPIC_linecount++ >= EEPIC_LINEMAX) {
  675. X          fprintf(outfile, "\n");
  676. X          fprintf(outfile, "%s(%u,%u)", 
  677. X                EEPIC_lines[EEPIC_type+2], 
  678. X                EEPIC_posx, EEPIC_posy);
  679. X          EEPIC_linecount = 1;
  680. X       }
  681. X    }
  682. X    fprintf(outfile, "(%u,%u)", ux,uy);
  683. X    EEPIC_posx = ux;
  684. X    EEPIC_posy = uy;
  685. X}
  686. X
  687. Xstatic void
  688. XEEPIC_endline()
  689. X{
  690. X    if (EEPIC_inline) {
  691. X       fprintf(outfile, "\n");
  692. X       EEPIC_inline = FALSE;
  693. X    }
  694. X}
  695. X
  696. X
  697. XEEPIC_arrow(sx,sy, ex,ey, head)
  698. X    int sx,sy, ex,ey;
  699. X    TBOOLEAN head;
  700. X{
  701. X    best_latex_arrow(sx,sy, ex,ey, 2, head); /* call latex routine */
  702. X
  703. X    EEPIC_posx = ex;
  704. X    EEPIC_posy = ey;
  705. X}
  706. X
  707. X
  708. XEEPIC_put_text(x, y, str)
  709. X    int x,y;                /* reference point of string */
  710. X    char str[];            /* the text */
  711. X{
  712. X    EEPIC_endline();
  713. X
  714. X    fprintf(outfile, "\\put(%d,%d)",x,y);
  715. X    switch(eepic_angle) {  
  716. X        case 0: {
  717. X          switch(eepic_justify) {
  718. X             case LEFT: {
  719. X                fprintf(outfile,
  720. X                       "{\\makebox(0,0)[l]{%s}}\n", str);
  721. X                break;
  722. X             }
  723. X             case CENTRE: {
  724. X                fprintf(outfile,
  725. X                       "{\\makebox(0,0){%s}}\n", str);
  726. X                break;
  727. X             }
  728. X             case RIGHT: {
  729. X                fprintf(outfile,
  730. X                       "{\\makebox(0,0)[r]{%s}}\n", str);
  731. X                break;
  732. X             }
  733. X          }
  734. X          break;
  735. X       }
  736. X       case 1: {            /* put text in a short stack */
  737. X          switch(eepic_justify) {
  738. X             case LEFT: {
  739. X                fprintf(outfile,
  740. X                       "{\\makebox(0,0)[lb]{\\shortstack{%s}}}\n", str);
  741. X                break;
  742. X             }
  743. X             case CENTRE: {
  744. X                fprintf(outfile,
  745. X                       "{\\makebox(0,0)[l]{\\shortstack{%s}}}\n", str);
  746. X                break;
  747. X             }
  748. X             case RIGHT: {
  749. X                fprintf(outfile,
  750. X                       "{\\makebox(0,0)[lt]{\\shortstack{%s}}}\n", str);
  751. X                break;
  752. X             }
  753. X          }
  754. X          break;
  755. X       }    
  756. X    }
  757. X}
  758. X
  759. X
  760. X
  761. Xint EEPIC_justify_text(mode)
  762. X    enum JUSTIFY mode;
  763. X{
  764. X    eepic_justify = mode;
  765. X    return (TRUE);
  766. X}
  767. X
  768. Xint EEPIC_text_angle(angle)
  769. X    int angle;
  770. X{
  771. X    /* we can't really write text vertically, but this will 
  772. X      put the ylabel centred at the left of the plot, and
  773. X      then we'll make a \shortstack */
  774. X    eepic_angle = angle;
  775. X    return (TRUE);
  776. X}
  777. X
  778. XEEPIC_reset()
  779. X{
  780. X    EEPIC_endline();
  781. X    EEPIC_posx = EEPIC_posy = 0;
  782. X}
  783. X
  784. END_OF_FILE
  785.   if test 7741 -ne `wc -c <'gnuplot/term/eepic.trm'`; then
  786.     echo shar: \"'gnuplot/term/eepic.trm'\" unpacked with wrong size!
  787.   fi
  788.   # end of 'gnuplot/term/eepic.trm'
  789. fi
  790. if test -f 'gnuplot/term/fig.trm' -a "${1}" != "-c" ; then 
  791.   echo shar: Will not clobber existing file \"'gnuplot/term/fig.trm'\"
  792. else
  793.   echo shar: Extracting \"'gnuplot/term/fig.trm'\" \(8468 characters\)
  794.   sed "s/^X//" >'gnuplot/term/fig.trm' <<'END_OF_FILE'
  795. X/*
  796. X * $Id: fig.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  797. X */
  798. X
  799. X/* GNUPLOT - fig.trm */
  800. X/*
  801. X * Copyright (C) 1990, 1991, 1992
  802. X *
  803. X * Permission to use, copy, and distribute this software and its
  804. X * documentation for any purpose with or without fee is hereby granted,
  805. X * provided that the above copyright notice appear in all copies and
  806. X * that both that copyright notice and this permission notice appear
  807. X * in supporting documentation.
  808. X *
  809. X * Permission to modify the software is granted, but not the right to
  810. X * distribute the modified code.  Modifications are to be distributed
  811. X * as patches to released version.
  812. X *
  813. X * This software  is provided "as is" without express or implied warranty.
  814. X *
  815. X * This file is included by ../term.c.
  816. X *
  817. X * This terminal driver supports:
  818. X *  Fig graphics language
  819. X *
  820. X * AUTHORS
  821. X *  Micah Beck, David Kotz
  822. X *
  823. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  824. X *
  825. X */
  826. X
  827. X#ifdef MSDOS
  828. X#define long int
  829. X#endif /* MSDOS */
  830. X
  831. X/*
  832. X * Original for Fig code output by Micah Beck, 1989
  833. X * Department of Computer Science, Cornell University
  834. X * Updated by David Kotz for gnuplot 2.0
  835. X * More efficient output by Ian Dall
  836. X * Updated to FIG 2.1 (with color) format by Vivek Khera
  837. X */
  838. X#include "object.h"                     /* from the XFig distribution */
  839. X#define FIG_DEFAULT DEFAULT
  840. X#define FIG_ROMAN_FONT (0)    /* actually, the default font */
  841. X#ifndef FIG_RES
  842. X/* Must be 80 for the Fig editor, but may be increased if used
  843. X * only by TransFig filters.
  844. X * Represents pixels per inch.
  845. X */
  846. X#define FIG_RES         (80)
  847. X#endif
  848. X#define FIG_COORD_SYS   2
  849. X#define FIG_MAGIC       "#FIG 2.1"
  850. X#define FIG_HTIC        (5*FIG_RES/80)
  851. X#define FIG_VTIC        (5*FIG_RES/80)
  852. X#define FIG_FONT_S      (10)    /* size in points */
  853. X#define FIG_VCHAR       (FIG_FONT_S*72/FIG_RES) /* height of font in pixels */
  854. X#define FIG_HCHAR       (FIG_VCHAR*6/10) /* this is a guess at the width */
  855. X#define FIG_ARROW_WIDTH (FIG_HTIC/2 + 1)
  856. X#define FIG_ARROW_HEIGHT FIG_HTIC
  857. Xstatic long FIG_xbase = FIG_RES/2;
  858. Xstatic long FIG_ybase = FIG_RES/2;
  859. Xstatic long FIG_posx;
  860. Xstatic long FIG_posy;
  861. Xstatic int FIG_poly_vec_cnt;
  862. Xenum FIG_poly_stat {FIG_poly_new, FIG_poly_part};
  863. Xstatic enum FIG_poly_stat FIG_polyvec_stat;
  864. X/* 5 inches wide by 3 inches high */
  865. X#define FIG_XMAX (5 * FIG_RES)
  866. X#define FIG_YMAX (3 * FIG_RES)
  867. X#define FIG_XOFF (FIG_RES/4)
  868. X#define FIG_YOFF (FIG_RES/4)
  869. Xstatic int FIG_type;            /* negative types use real lines */
  870. Xstatic float FIG_spacing;       /* length of dash or dot spacing */
  871. Xstatic int FIG_justify;         /* Fig justification T_*_JUSTIFIED */
  872. Xstatic float FIG_angle;         /* Fig text angle 0=horiz, Pi/2=vert */
  873. Xstatic int FIG_use_color = FALSE;    /* do we use color or not? */
  874. Xstatic int FIG_color = DEFAULT;    /* which color to use */
  875. X#define FIG_POINT_TYPES POINT_TYPES /* we use the same points */
  876. Xstatic
  877. X  FIG_poly_clean(stat)
  878. Xenum FIG_poly_stat stat;
  879. X{
  880. X  if(stat == FIG_poly_part)
  881. X        fprintf(outfile, " 9999 9999\n");
  882. X  FIG_polyvec_stat = FIG_poly_new;
  883. X}
  884. XFIG_options()
  885. X{
  886. X    FIG_use_color = FALSE;    /* assumption */
  887. X
  888. X    if (!END_OF_COMMAND) {
  889. X        if (almost_equals(c_token,"m$onochrome")) {
  890. X            FIG_use_color=FALSE;
  891. X            c_token++;
  892. X        }
  893. X        else if (almost_equals(c_token,"c$olor")) {
  894. X            FIG_use_color=TRUE;
  895. X            c_token++;
  896. X        }
  897. X    }
  898. X
  899. X    sprintf(term_options,"%s", FIG_use_color ? "color" : "monochrome");
  900. X}
  901. X
  902. XFIG_init()
  903. X{
  904. X    FIG_posx = FIG_posy = 0;
  905. X    FIG_polyvec_stat = FIG_poly_new;
  906. X    FIG_linetype(-1);
  907. X    FIG_justify_text(LEFT);
  908. X    FIG_text_angle(0);
  909. X    fprintf(outfile, "%s\n", FIG_MAGIC);
  910. X    fprintf(outfile, "%d %d\n", FIG_RES, FIG_COORD_SYS);
  911. X}
  912. XFIG_graphics()
  913. X{
  914. X    FIG_posx = FIG_posy = 0;
  915. X    FIG_polyvec_stat = FIG_poly_new;
  916. X    /* there is no way to have separate pictures in a FIG file */
  917. X}
  918. XFIG_text()
  919. X{
  920. X    /* there is no way to have separate pictures in a FIG file */
  921. X    FIG_poly_clean(FIG_polyvec_stat);
  922. X    FIG_posx = FIG_posy = 0;
  923. X    fflush(outfile);
  924. X}
  925. X/* Line types for FIG work like this:
  926. X *  for monochrome:
  927. X *  -2 : solid (border)
  928. X *  -1 : dotted 4 (axes)
  929. X *   0 : solid (first curve)
  930. X *   1 : dotted 3
  931. X *   2 : dashed 3
  932. X *   3 : dotted 6
  933. X *   4 : dashed 6
  934. X *   ... ...
  935. X *  for color, cycle through colors. once colors are used up, repeat colors
  936. X *   but start using dashed lines of different dash length. don't use white
  937. X *   as a color.
  938. X */
  939. XFIG_linetype(linetype)
  940. X        int linetype;                   /* expect linetype >= -2 */
  941. X{
  942. X    int last_FIG_type = FIG_type;
  943. X    int last_FIG_spacing = FIG_spacing;
  944. X    switch (linetype) {
  945. X           case 0:
  946. X           case -2: {
  947. X                  FIG_type = SOLID_LINE;
  948. X                  FIG_spacing = 0.0;
  949. X          if (FIG_use_color) FIG_color = BLACK;
  950. X                  break;
  951. X           }
  952. X           case -1: {
  953. X                  FIG_type = DOTTED_LINE;
  954. X                  FIG_spacing = 4.0; /* gap */
  955. X          if (FIG_use_color) FIG_color = BLACK;
  956. X                  break;
  957. X           }
  958. X           default: {
  959. X                linetype = abs(linetype); /* shouldn't be negative anyway */
  960. X                /* now linetype >= 1 */
  961. X        if (FIG_use_color) {
  962. X          FIG_type = (linetype >= WHITE);    /* dashed line */
  963. X          FIG_color = linetype % WHITE;
  964. X          FIG_spacing = (linetype / WHITE) * 3;
  965. X        } else { /* monochrome */
  966. X                  FIG_type = linetype % 2 + 1; /* dotted, dashed, ... */
  967. X                  FIG_spacing = (linetype+1) / 2 * 3;
  968. X        }
  969. X                  break;
  970. X           }
  971. X    }
  972. X    if (FIG_type != last_FIG_type || FIG_spacing != last_FIG_spacing)
  973. X      FIG_poly_clean(FIG_polyvec_stat);
  974. X}
  975. XFIG_move(x,y)
  976. X        unsigned int x,y;
  977. X{
  978. X    int last_FIG_posx = FIG_posx;
  979. X    int last_FIG_posy = FIG_posy;
  980. X    FIG_posx = x;
  981. X    FIG_posy = y;
  982. X    if (FIG_posx != last_FIG_posx || FIG_posy != last_FIG_posy)
  983. X          FIG_poly_clean(FIG_polyvec_stat);
  984. X}
  985. XFIG_vector(ux,uy)
  986. X     unsigned int ux,uy;
  987. X{
  988. X  int x=ux, y=uy;
  989. X  if (FIG_polyvec_stat != FIG_poly_part)
  990. X    {
  991. X      fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d %d %d\n",
  992. X              O_POLYLINE, T_POLYLINE,
  993. X              FIG_type, 1, FIG_color, 0, FIG_DEFAULT, 0, FIG_spacing, 0,0,0);
  994. X      fprintf(outfile, "%d %d",
  995. X              FIG_XOFF + FIG_posx, FIG_YMAX + FIG_YOFF - FIG_posy);
  996. X      FIG_poly_vec_cnt = 1;
  997. X      FIG_polyvec_stat = FIG_poly_part;
  998. X    }
  999. X  fprintf(outfile, " %d %d",
  1000. X          FIG_XOFF +  x, FIG_YMAX + FIG_YOFF-y);
  1001. X  FIG_poly_vec_cnt++;
  1002. X  if (FIG_poly_vec_cnt > 50)
  1003. X    FIG_poly_clean(FIG_polyvec_stat);
  1004. X  FIG_posx = x;
  1005. X  FIG_posy = y;
  1006. X}
  1007. XFIG_arrow(sx, sy, ex, ey, head)
  1008. X        int sx, sy;     /* start coord */
  1009. X        int ex, ey;     /* end coord */
  1010. X    TBOOLEAN head;
  1011. X{
  1012. X    FIG_poly_clean(FIG_polyvec_stat);
  1013. X        fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d  %d %d\n",
  1014. X                O_POLYLINE, T_POLYLINE,
  1015. X                FIG_type, 1, FIG_color, 0, FIG_DEFAULT, 0, FIG_spacing,
  1016. X        0, head ? 1 : 0, 0);
  1017. X        /* arrow line */
  1018. X    if ( head )
  1019. X            fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
  1020. X                    0, 0, 1.0,
  1021. X            (double)FIG_ARROW_WIDTH, (double)FIG_ARROW_HEIGHT);
  1022. X        fprintf(outfile, "%d %d %d %d 9999 9999\n",
  1023. X                FIG_XOFF + sx, FIG_YOFF + FIG_YMAX - sy,
  1024. X        FIG_XOFF + ex, FIG_YOFF + FIG_YMAX - ey);
  1025. X        FIG_posx = ex;
  1026. X        FIG_posy = ey;
  1027. X}
  1028. XFIG_put_text(x, y, str)
  1029. X        int x, y;
  1030. X        char *str;
  1031. X{
  1032. X  if (strlen(str) == 0) return;
  1033. X  FIG_poly_clean(FIG_polyvec_stat);
  1034. X  y -= FIG_VCHAR/2;    /* assuming vertical center justified */
  1035. X    fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
  1036. X                  O_TEXT, FIG_justify,
  1037. X                  FIG_ROMAN_FONT, FIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, 0,
  1038. X          FIG_angle, SPECIAL_TEXT, FIG_VCHAR, FIG_HCHAR*strlen(str),
  1039. X          FIG_XOFF + x, FIG_YMAX + FIG_YOFF-y, str);
  1040. X}
  1041. Xint FIG_justify_text(mode)
  1042. X        enum JUSTIFY mode;
  1043. X{
  1044. X    switch(mode) {
  1045. X           case LEFT: FIG_justify = T_LEFT_JUSTIFIED; break;
  1046. X           case CENTRE: FIG_justify = T_CENTER_JUSTIFIED; break;
  1047. X           case RIGHT: FIG_justify = T_RIGHT_JUSTIFIED; break;
  1048. X           /* shouldn't happen */
  1049. X           default: FIG_justify = T_LEFT_JUSTIFIED; return (FALSE); break;
  1050. X    }
  1051. X    return (TRUE);
  1052. X}
  1053. Xint FIG_text_angle(angle)
  1054. X        int angle;
  1055. X{
  1056. X    if (angle)
  1057. X         FIG_angle = Pi / 2.0;  /* vertical is pi/2 radians */
  1058. X    else
  1059. X         FIG_angle = 0.0;               /* horizontal */
  1060. X    return (TRUE);
  1061. X}
  1062. XFIG_reset()
  1063. X{
  1064. X    FIG_poly_clean(FIG_polyvec_stat);
  1065. X    FIG_posx = FIG_posy = 0;
  1066. X    fflush(outfile);
  1067. X}
  1068. X
  1069. X#ifdef MSDOS
  1070. X#undef long
  1071. X#endif /* MSDOS */
  1072. END_OF_FILE
  1073.   if test 8468 -ne `wc -c <'gnuplot/term/fig.trm'`; then
  1074.     echo shar: \"'gnuplot/term/fig.trm'\" unpacked with wrong size!
  1075.   fi
  1076.   # end of 'gnuplot/term/fig.trm'
  1077. fi
  1078. if test -f 'gnuplot/term/hpljii.trm' -a "${1}" != "-c" ; then 
  1079.   echo shar: Will not clobber existing file \"'gnuplot/term/hpljii.trm'\"
  1080. else
  1081.   echo shar: Extracting \"'gnuplot/term/hpljii.trm'\" \(8299 characters\)
  1082.   sed "s/^X//" >'gnuplot/term/hpljii.trm' <<'END_OF_FILE'
  1083. X/*
  1084. X * $Id: hpljii.trm%v 3.50.1.11 1993/08/10 03:55:03 woo Exp $
  1085. X *
  1086. X */
  1087. X
  1088. X/* GNUPLOT - hpljii.trm */
  1089. X/*
  1090. X * Copyright (C) 1990 - 1993   
  1091. X *
  1092. X * Permission to use, copy, and distribute this software and its
  1093. X * documentation for any purpose with or without fee is hereby granted, 
  1094. X * provided that the above copyright notice appear in all copies and 
  1095. X * that both that copyright notice and this permission notice appear 
  1096. X * in supporting documentation.
  1097. X *
  1098. X * Permission to modify the software is granted, but not the right to
  1099. X * distribute the modified code.  Modifications are to be distributed 
  1100. X * as patches to released version.
  1101. X *  
  1102. X * This software  is provided "as is" without express or implied warranty.
  1103. X * 
  1104. X * This file is included by ../term.c.
  1105. X *
  1106. X * This terminal driver supports:
  1107. X *  hpljii, hpdj
  1108. X *
  1109. X * AUTHORS
  1110. X *  John Engels
  1111. X *  Russell Lang
  1112. X *  Maurice Castro
  1113. X *
  1114. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1115. X * 
  1116. X */
  1117. X
  1118. X/* The following HP laserjet series II driver uses generic bit mapped graphics
  1119. X   routines from bitmap.c to build up a bit map in memory.  The driver
  1120. X   interchanges colomns and lines in order to access entire lines
  1121. X   easily and returns the lines to get bits in the right order :
  1122. X   (x,y) -> (y,XMAX-1-x). */
  1123. X/* This interchange is done by calling b_makebitmap() with reversed 
  1124. X   xmax and ymax, and then setting b_rastermode to TRUE.  b_setpixel()
  1125. X   will then perform the interchange before each pixel is plotted */
  1126. X/* by John Engels JENGELS@BNANDP51.BITNET, inspired by the hpljet driver
  1127. X   of Jyrki Yli-Nokari */
  1128. X
  1129. X#ifdef HPLJII
  1130. X
  1131. X/* We define 4 different print qualities : 300ppi, 150ppi, 100ppi and
  1132. X   75ppi.  (Pixel size = 1, 2, 3, 4 dots) */
  1133. X
  1134. X#define HPLJII_DPP (hplj_dpp)   /* dots per pixel */
  1135. X#define HPLJII_PPI (300/HPLJII_DPP) /* pixel per inch */
  1136. X/* make XMAX and YMAX a multiple of 8 */
  1137. X#define HPLJII_XMAX (8*(unsigned int)(xsize*1920/HPLJII_DPP/8.0+0.9))
  1138. X#define HPLJII_YMAX (8*(unsigned int)(ysize*1920/HPLJII_DPP/8.0+0.9))
  1139. X
  1140. X#define HPLJII_VCHAR (HPLJII_PPI/6) /* Courier font with 6 lines per inch */
  1141. X#define HPLJII_HCHAR (HPLJII_PPI/10) /* Courier font with 10 caracters
  1142. X                                        per inch */
  1143. X
  1144. X/* default values for term_tbl */
  1145. X#define HPLJII_75PPI_XMAX (1920/4)
  1146. X#define HPLJII_75PPI_YMAX (1920/4)
  1147. X#define HPLJII_75PPI_HCHAR (1920/4/6)
  1148. X#define HPLJII_75PPI_VCHAR (1920/4/10)
  1149. X#define HPLJII_75PPI_VTIC 5
  1150. X#define HPLJII_75PPI_HTIC 5
  1151. X
  1152. X
  1153. X#define HPLJII_PUSH_CURSOR fprintf(outfile,"\033&f0S") /* Save current
  1154. X                  cursor position */
  1155. X#define HPLJII_POP_CURSOR fprintf(outfile,"\033&f1S") /* Restore
  1156. X                  cursor position */
  1157. X#define HPLJII_COURIER fprintf(outfile,"\033(0N\033(s0p10.0h12.0v0s0b3T\033&l6D")
  1158. X         /* be sure to use courier font with 6lpi and 10cpi */
  1159. X
  1160. Xstatic int hplj_dpp=4;
  1161. X/* bm_pattern not appropriate for 300ppi graphics */
  1162. Xstatic unsigned int b_300ppi_pattern[] = {0xffff, 0x1111,
  1163. X        0xffff, 0x3333, 0x0f0f, 0x3f3f, 0x0fff, 0x00ff, 0x33ff};
  1164. X
  1165. XHPLJIIoptions()
  1166. X{
  1167. Xchar opt[4];
  1168. Xint parse_error=0;
  1169. X
  1170. X    if (END_OF_COMMAND) {
  1171. X        term_options[0]='\0';
  1172. X    } else {
  1173. X        if (token[c_token].length>3) {
  1174. X            parse_error=1; /* see below */
  1175. X        } else {
  1176. X        /* almost_equals() won't accept numbers - use strcmp() instead */
  1177. X        capture(opt,c_token,c_token);
  1178. X        if (!strcmp(opt,"75")) {
  1179. X               hplj_dpp = 4;
  1180. X        }
  1181. X        else if (!strcmp(opt,"100")) {
  1182. X               hplj_dpp = 3;
  1183. X        }
  1184. X        else if (!strcmp(opt,"150")) {
  1185. X               hplj_dpp = 2;
  1186. X        }
  1187. X        else if (!strcmp(opt,"300")) {
  1188. X               hplj_dpp = 1;
  1189. X        } else {
  1190. X        /* error, but set dpi anyway, since term it already set */
  1191. X                parse_error=1;
  1192. X        }
  1193. X        c_token++;
  1194. X    }
  1195. X    }
  1196. X
  1197. X    term_tbl[term].xmax = HPLJII_XMAX;
  1198. X    term_tbl[term].ymax = HPLJII_YMAX;
  1199. X    switch(hplj_dpp) {
  1200. X        case 1:
  1201. X            strcpy(term_options,"300");
  1202. X            term_tbl[term].v_tic = 15;
  1203. X            term_tbl[term].h_tic = 15;
  1204. X            break;
  1205. X        case 2:
  1206. X            strcpy(term_options,"150");
  1207. X            term_tbl[term].v_tic = 8;
  1208. X            term_tbl[term].h_tic = 8;
  1209. X            break;
  1210. X        case 3:
  1211. X            strcpy(term_options,"100");
  1212. X            term_tbl[term].v_tic = 6;
  1213. X            term_tbl[term].h_tic = 6;
  1214. X            break;
  1215. X        case 4:
  1216. X            strcpy(term_options,"75");
  1217. X            term_tbl[term].v_tic = 5;
  1218. X            term_tbl[term].h_tic = 5;
  1219. X            break;
  1220. X    }
  1221. X
  1222. X    if( parse_error ) 
  1223. X        int_error("expecting dots per inch size 75, 100, 150 or 300",
  1224. X                c_token);
  1225. X}
  1226. X
  1227. X
  1228. XHPLJIIinit()
  1229. X{
  1230. X#ifdef REOPEN_BINARY
  1231. X   reopen_binary();
  1232. X#endif /* REOPEN_BINARY */
  1233. X}
  1234. X
  1235. X
  1236. XHPLJIIgraphics()
  1237. X{
  1238. X   term_tbl[term].v_char = HPLJII_VCHAR;
  1239. X   term_tbl[term].h_char = HPLJII_HCHAR;
  1240. X   HPLJII_COURIER;
  1241. X   HPLJII_PUSH_CURSOR;
  1242. X   /* rotate plot -90 degrees by reversing XMAX and YMAX and by 
  1243. X      setting b_rastermode to TRUE */
  1244. X   b_makebitmap(HPLJII_YMAX,HPLJII_XMAX,1);
  1245. X   b_rastermode = TRUE;
  1246. X}
  1247. X
  1248. X
  1249. X/* HPLJIItext by rjl - no compression */
  1250. XHPLJIItext()
  1251. X{
  1252. X  register int x,j,row;
  1253. X
  1254. X   fprintf(outfile,"\033*t%dR", HPLJII_PPI);
  1255. X   HPLJII_POP_CURSOR;
  1256. X   fprintf(outfile, "\033*r1A");
  1257. X
  1258. X   /* dump bitmap in raster mode */
  1259. X   for (x = b_xsize-1; x >= 0; x--) {
  1260. X      row = (b_ysize/8)-1;
  1261. X      fprintf(outfile, "\033*b0m%dW", b_ysize/8);
  1262. X      for (j = row; j >= 0; j--) {
  1263. X         (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
  1264. X      }
  1265. X   }
  1266. X   fprintf(outfile, "\033*rB");
  1267. X
  1268. X   b_freebitmap();
  1269. X
  1270. X#ifndef vms  /* most vms spoolers add a formfeed character */
  1271. X   fprintf(outfile,"\f");
  1272. X#endif /* not vms */
  1273. X}
  1274. X
  1275. X
  1276. X
  1277. XHPLJIIlinetype(linetype)
  1278. Xint linetype;
  1279. X{
  1280. X
  1281. X   if (hplj_dpp == 1) {
  1282. X      if (linetype>=7)
  1283. X          linetype %= 7;
  1284. X      /* b_pattern not appropriate for 300ppi graphics */
  1285. X      b_linemask = b_300ppi_pattern[linetype+2];
  1286. X      b_maskcount=0;
  1287. X   }
  1288. X   else {
  1289. X      b_setlinetype(linetype);
  1290. X   }
  1291. X}
  1292. X
  1293. X#define HPLJIImove b_move
  1294. X#define HPLJIIvector b_vector
  1295. X#define HPLJIItext_angle b_text_angle
  1296. X
  1297. XHPLJIIput_text(x,y,str)
  1298. Xunsigned int x, y;
  1299. Xchar *str;
  1300. X{
  1301. X   switch (b_angle) {
  1302. X      case 0:
  1303. X         y -= HPLJII_VCHAR/5;
  1304. X         HPLJII_POP_CURSOR;
  1305. X         HPLJII_PUSH_CURSOR;
  1306. X         /* (0,0) is the upper left point of the paper */
  1307. X         fprintf(outfile, "\033*p%+dx%+dY", x*HPLJII_DPP
  1308. X                                         ,  (HPLJII_YMAX-y-1)*HPLJII_DPP );
  1309. X         fputs(str, outfile);
  1310. X/*       for (; *str; ++str, x += HPLJII_HCHAR)
  1311. X            HPLJIIputc (x, y, *str, b_angle);*/
  1312. X         break;
  1313. X      case 1:
  1314. X         y += (HPLJII_HCHAR-2*HPLJII_VCHAR)/2;
  1315. X         y += (HPLJII_VCHAR+HPLJII_HCHAR)*strlen(str)/2;
  1316. X         for (; *str; ++str, y -= HPLJII_VCHAR)
  1317. X            HPLJIIputc (x, y, *str, b_angle);
  1318. X         break;
  1319. X   }
  1320. X}
  1321. X
  1322. XHPLJIIputc(x,y,c,angle)
  1323. Xunsigned int x,y;
  1324. Xint angle;
  1325. Xchar c;
  1326. X{
  1327. X   HPLJII_POP_CURSOR;
  1328. X   HPLJII_PUSH_CURSOR;
  1329. X   /* (0,0) is the upper left point of the paper */
  1330. X   fprintf(outfile, "\033*p%+dx%+dY", x*HPLJII_DPP
  1331. X                                   ,  (HPLJII_YMAX-y-1)*HPLJII_DPP );
  1332. X   fputc(c, outfile);
  1333. X}
  1334. X
  1335. X
  1336. XHPLJIIreset()
  1337. X{
  1338. X#ifdef vms
  1339. X   fflush_binary();
  1340. X#endif /* vms */
  1341. X}
  1342. X
  1343. X
  1344. X/* HP DeskJet routines */
  1345. XHPDJgraphics()
  1346. X{
  1347. X    switch(hplj_dpp) {
  1348. X        case 1:
  1349. X            b_charsize(FNT13X25);
  1350. X            term_tbl[term].v_char = FNT13X25_VCHAR;
  1351. X            term_tbl[term].h_char = FNT13X25_HCHAR;
  1352. X            break;
  1353. X        case 2:
  1354. X            b_charsize(FNT13X25);
  1355. X            term_tbl[term].v_char = FNT13X25_VCHAR;
  1356. X            term_tbl[term].h_char = FNT13X25_HCHAR;
  1357. X            break;
  1358. X        case 3:
  1359. X            b_charsize(FNT9X17);
  1360. X            term_tbl[term].v_char = FNT9X17_VCHAR;
  1361. X            term_tbl[term].h_char = FNT9X17_HCHAR;
  1362. X            break;
  1363. X        case 4:
  1364. X            b_charsize(FNT5X9);
  1365. X            term_tbl[term].v_char = FNT5X9_VCHAR;
  1366. X            term_tbl[term].h_char = FNT5X9_HCHAR;
  1367. X            break;
  1368. X    }
  1369. X    /* rotate plot -90 degrees by reversing XMAX and YMAX and by 
  1370. X    setting b_rastermode to TRUE */
  1371. X    b_makebitmap(HPLJII_YMAX,HPLJII_XMAX,1);
  1372. X    b_rastermode = TRUE;
  1373. X}
  1374. X
  1375. X
  1376. X/* 0 compression raster bitmap dump. Compatible with HP DeskJet 500
  1377. X   hopefully compatible with other HP Deskjet printers */
  1378. XHPDJtext()
  1379. X{
  1380. X  register int x,j,row;
  1381. X
  1382. X   fprintf(outfile,"\033*b0M");
  1383. X   fprintf(outfile,"\033*t%dR", HPLJII_PPI);
  1384. X   fprintf(outfile, "\033*r1A");
  1385. X
  1386. X   /* dump bitmap in raster mode */
  1387. X   for (x = b_xsize-1; x >= 0; x--) {
  1388. X      row = (b_ysize/8)-1;
  1389. X      fprintf(outfile, "\033*b%dW", b_ysize/8);
  1390. X      for (j = row; j >= 0; j--) {
  1391. X         (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
  1392. X      }
  1393. X   }
  1394. X   fprintf(outfile, "\033*rbC");
  1395. X
  1396. X   b_freebitmap();
  1397. X
  1398. X#ifndef vms  /* most vms spoolers add a formfeed character */
  1399. X   fprintf(outfile,"\f");
  1400. X#endif /* not vms */
  1401. X}
  1402. X
  1403. X#define HPDJtext_angle b_text_angle
  1404. X#define HPDJput_text b_put_text
  1405. X
  1406. X#endif /* HPLJII */
  1407. X
  1408. END_OF_FILE
  1409.   if test 8299 -ne `wc -c <'gnuplot/term/hpljii.trm'`; then
  1410.     echo shar: \"'gnuplot/term/hpljii.trm'\" unpacked with wrong size!
  1411.   fi
  1412.   # end of 'gnuplot/term/hpljii.trm'
  1413. fi
  1414. if test -f 'gnuplot/term/object.h' -a "${1}" != "-c" ; then 
  1415.   echo shar: Will not clobber existing file \"'gnuplot/term/object.h'\"
  1416. else
  1417.   echo shar: Extracting \"'gnuplot/term/object.h'\" \(7748 characters\)
  1418.   sed "s/^X//" >'gnuplot/term/object.h' <<'END_OF_FILE'
  1419. X/*
  1420. X * FIG : Facility for Interactive Generation of figures
  1421. X * Copyright (c) 1985 by Supoj Sutanthavibul
  1422. X *
  1423. X * "Permission to use, copy, modify, distribute, and sell this software and its
  1424. X * documentation for any purpose is hereby granted without fee, provided that
  1425. X * the above copyright notice appear in all copies and that both that
  1426. X * copyright notice and this permission notice appear in supporting
  1427. X * documentation, and that the name of M.I.T. not be used in advertising or
  1428. X * publicity pertaining to distribution of the software without specific,
  1429. X * written prior permission.  M.I.T. makes no representations about the
  1430. X * suitability of this software for any purpose.  It is provided "as is"
  1431. X * without express or implied warranty."
  1432. X *
  1433. X */
  1434. X
  1435. X#define        DEFAULT              (-1)
  1436. X#define        SOLID_LINE        0
  1437. X#define        DASH_LINE        1
  1438. X#define        DOTTED_LINE        2
  1439. X#define        RUBBER_LINE        3
  1440. X/* #define        PANEL_LINE        4  ** not needed for gnuplot */
  1441. X
  1442. X#define        Color            long
  1443. X
  1444. X#define        BLACK            0
  1445. X#define        WHITE            7
  1446. X
  1447. Xtypedef struct f_pattern {
  1448. X    int            w, h;
  1449. X    int           *p;
  1450. X}
  1451. X        F_pattern;
  1452. X
  1453. Xtypedef struct f_point {
  1454. X    int            x, y;
  1455. X    struct f_point *next;
  1456. X}
  1457. X        F_point;
  1458. X
  1459. Xtypedef struct f_pos {
  1460. X    int            x, y;
  1461. X}
  1462. X        F_pos;
  1463. X
  1464. Xtypedef struct f_arrow {
  1465. X    int            type;
  1466. X    int            style;
  1467. X    float        thickness;
  1468. X    float        wid;
  1469. X    float        ht;
  1470. X}
  1471. X        F_arrow;
  1472. X
  1473. Xtypedef struct f_ellipse {
  1474. X    int            tagged;
  1475. X    int            type;
  1476. X#define                    T_ELLIPSE_BY_RAD    1
  1477. X#define                    T_ELLIPSE_BY_DIA    2
  1478. X#define                    T_CIRCLE_BY_RAD        3
  1479. X#define                    T_CIRCLE_BY_DIA        4
  1480. X    int            style;
  1481. X    int            thickness;
  1482. X    Color        color;
  1483. X    int            depth;
  1484. X    int            direction;
  1485. X    float        style_val;
  1486. X    float        angle;
  1487. X    int            pen;
  1488. X    int            fill_style;
  1489. X#define                    UNFILLED    0
  1490. X#define                    WHITE_FILL    1
  1491. X#define                    BLACK_FILL    21
  1492. X    struct f_pos    center;
  1493. X    struct f_pos    radiuses;
  1494. X    struct f_pos    start;
  1495. X    struct f_pos    end;
  1496. X    struct f_ellipse *next;
  1497. X}
  1498. X        F_ellipse;
  1499. X
  1500. Xtypedef struct f_arc {
  1501. X    int            tagged;
  1502. X    int            type;
  1503. X#define                    T_3_POINTS_ARC        1
  1504. X    int            style;
  1505. X    int            thickness;
  1506. X    Color        color;
  1507. X    int            depth;
  1508. X    int            pen;
  1509. X    int            fill_style;
  1510. X    float        style_val;
  1511. X    int            direction;
  1512. X    struct f_arrow *for_arrow;
  1513. X    struct f_arrow *back_arrow;
  1514. X    struct {
  1515. X    float        x, y;
  1516. X    }            center;
  1517. X    struct f_pos    point[3];
  1518. X    struct f_arc   *next;
  1519. X}
  1520. X        F_arc;
  1521. X
  1522. X#define        CLOSED_PATH        0
  1523. X#define        OPEN_PATH        1
  1524. X#define        DEF_BOXRADIUS        7
  1525. X#define        DEF_DASHLENGTH        4
  1526. X#define        DEF_DOTGAP        3
  1527. X
  1528. Xtypedef struct f_line {
  1529. X    int            tagged;
  1530. X    int            type;
  1531. X#define                    T_POLYLINE    1
  1532. X#define                    T_BOX        2
  1533. X#define                    T_POLYGON    3
  1534. X#define                    T_ARC_BOX    4
  1535. X#define                    T_EPS_BOX    5
  1536. X    int            style;
  1537. X    int            thickness;
  1538. X    Color        color;
  1539. X    int            depth;
  1540. X    float        style_val;
  1541. X    int            pen;
  1542. X    int            fill_style;
  1543. X    int            radius;    /* corner radius for T_ARC_BOX */
  1544. X    struct f_arrow *for_arrow;
  1545. X    struct f_arrow *back_arrow;
  1546. X    struct f_point *points;
  1547. X    struct f_eps   *eps;
  1548. X    struct f_line  *next;
  1549. X}
  1550. X        F_line;
  1551. X
  1552. Xtypedef struct f_text {
  1553. X    int            tagged;
  1554. X    int            type;
  1555. X#define                    T_LEFT_JUSTIFIED    0
  1556. X#define                    T_CENTER_JUSTIFIED    1
  1557. X#define                    T_RIGHT_JUSTIFIED    2
  1558. X    int            font;
  1559. X    int            size;    /* point size */
  1560. X    Color        color;
  1561. X    int            depth;
  1562. X    float        angle;    /* in radian */
  1563. X
  1564. X    int            flags;
  1565. X#define                    RIGID_TEXT        1
  1566. X#define                    SPECIAL_TEXT        2
  1567. X#define                    PSFONT_TEXT        4
  1568. X#define                    HIDDEN_TEXT        8
  1569. X
  1570. X    int            height;    /* pixels */
  1571. X    int            length;    /* pixels */
  1572. X    int            base_x;
  1573. X    int            base_y;
  1574. X    int            pen;
  1575. X    char       *cstring;
  1576. X    struct f_text  *next;
  1577. X}
  1578. X        F_text;
  1579. X
  1580. X#define MAXFONT(T) (psfont_text(T) ? NUM_PS_FONTS : NUM_LATEX_FONTS)
  1581. X
  1582. X#define        rigid_text(t) \
  1583. X            (t->flags == DEFAULT \
  1584. X                || (t->flags & RIGID_TEXT))
  1585. X
  1586. X#define        special_text(t) \
  1587. X            ((t->flags != DEFAULT \
  1588. X                && (t->flags & SPECIAL_TEXT)))
  1589. X
  1590. X#define        psfont_text(t) \
  1591. X            (t->flags != DEFAULT \
  1592. X                && (t->flags & PSFONT_TEXT))
  1593. X
  1594. X#define        hidden_text(t) \
  1595. X            (t->flags != DEFAULT \
  1596. X                && (t->flags & HIDDEN_TEXT))
  1597. X
  1598. X#define        text_length(t) \
  1599. X            (hidden_text(t) ? hidden_text_length : t->length)
  1600. X
  1601. X#define        using_ps    (cur_textflags & PSFONT_TEXT)
  1602. X
  1603. Xtypedef struct f_control {
  1604. X    float        lx, ly, rx, ry;
  1605. X    struct f_control *next;
  1606. X}
  1607. X        F_control;
  1608. X
  1609. X#define        int_spline(s)        (s->type & 0x2)
  1610. X#define        normal_spline(s)    (!(s->type & 0x2))
  1611. X#define        closed_spline(s)    (s->type & 0x1)
  1612. X#define        open_spline(s)        (!(s->type & 0x1))
  1613. X
  1614. Xtypedef struct f_spline {
  1615. X    int            tagged;
  1616. X    int            type;
  1617. X#define                    T_OPEN_NORMAL    0
  1618. X#define                    T_CLOSED_NORMAL 1
  1619. X#define                    T_OPEN_INTERP    2
  1620. X#define                    T_CLOSED_INTERP 3
  1621. X    int            style;
  1622. X    int            thickness;
  1623. X    Color        color;
  1624. X    int            depth;
  1625. X    float        style_val;
  1626. X    int            pen;
  1627. X    int            fill_style;
  1628. X    struct f_arrow *for_arrow;
  1629. X    struct f_arrow *back_arrow;
  1630. X    /*
  1631. X     * For T_OPEN_NORMAL and T_CLOSED_NORMAL points are control points while
  1632. X     * they are knots for T_OPEN_INTERP and T_CLOSED_INTERP whose control
  1633. X     * points are stored in controls.
  1634. X     */
  1635. X    struct f_point *points;
  1636. X    struct f_control *controls;
  1637. X    struct f_spline *next;
  1638. X}
  1639. X        F_spline;
  1640. X
  1641. Xtypedef struct f_compound {
  1642. X    int            tagged;
  1643. X    struct f_pos    nwcorner;
  1644. X    struct f_pos    secorner;
  1645. X    struct f_line  *lines;
  1646. X    struct f_ellipse *ellipses;
  1647. X    struct f_spline *splines;
  1648. X    struct f_text  *texts;
  1649. X    struct f_arc   *arcs;
  1650. X    struct f_compound *compounds;
  1651. X    struct f_compound *next;
  1652. X}
  1653. X        F_compound;
  1654. X
  1655. Xtypedef struct f_linkinfo {
  1656. X    struct f_line  *line;
  1657. X    struct f_point *endpt;
  1658. X    struct f_point *prevpt;
  1659. X    int            two_pts;
  1660. X    struct f_linkinfo *next;
  1661. X}
  1662. X        F_linkinfo;
  1663. X
  1664. X#define        ARROW_SIZE        sizeof(struct f_arrow)
  1665. X#define        POINT_SIZE        sizeof(struct f_point)
  1666. X#define        CONTROL_SIZE        sizeof(struct f_control)
  1667. X#define        ELLOBJ_SIZE        sizeof(struct f_ellipse)
  1668. X#define        ARCOBJ_SIZE        sizeof(struct f_arc)
  1669. X#define        LINOBJ_SIZE        sizeof(struct f_line)
  1670. X#define        TEXOBJ_SIZE        sizeof(struct f_text)
  1671. X#define        SPLOBJ_SIZE        sizeof(struct f_spline)
  1672. X#define        COMOBJ_SIZE        sizeof(struct f_compound)
  1673. X#define        EPS_SIZE        sizeof(struct f_eps)
  1674. X#define        LINKINFO_SIZE        sizeof(struct f_linkinfo)
  1675. X
  1676. X/**********************     object codes  **********************/
  1677. X
  1678. X#define        O_ELLIPSE        1
  1679. X#define        O_POLYLINE        2
  1680. X#define        O_SPLINE        3
  1681. X#define        O_TEXT            4
  1682. X#define        O_ARC            5
  1683. X#define        O_COMPOUND        6
  1684. X#define        O_END_COMPOUND        -O_COMPOUND
  1685. X#define        O_ALL_OBJECT        99
  1686. X
  1687. X/*********************    object masks  ************************/
  1688. X
  1689. X#define M_NONE            0x000
  1690. X#define M_POLYLINE_POLYGON    0x001
  1691. X#define M_POLYLINE_LINE        0x002
  1692. X#define M_POLYLINE_BOX        0x004    /* includes ARCBOX */
  1693. X#define M_SPLINE_O_NORMAL    0x008
  1694. X#define M_SPLINE_C_NORMAL    0x010
  1695. X#define M_SPLINE_O_INTERP    0x020
  1696. X#define M_SPLINE_C_INTERP    0x040
  1697. X#define M_TEXT_NORMAL        0x080
  1698. X#define M_TEXT_HIDDEN        0x100
  1699. X#define M_ARC            0x200
  1700. X#define M_ELLIPSE        0x400
  1701. X#define M_COMPOUND        0x800
  1702. X
  1703. X#define M_TEXT        (M_TEXT_HIDDEN | M_TEXT_NORMAL)
  1704. X#define M_SPLINE_O    (M_SPLINE_O_NORMAL | M_SPLINE_O_INTERP)
  1705. X#define M_SPLINE_C    (M_SPLINE_C_NORMAL | M_SPLINE_C_INTERP)
  1706. X#define M_SPLINE_NORMAL (M_SPLINE_O_NORMAL | M_SPLINE_C_NORMAL)
  1707. X#define M_SPLINE_INTERP (M_SPLINE_O_INTERP | M_SPLINE_C_INTERP)
  1708. X#define M_SPLINE    (M_SPLINE_NORMAL | M_SPLINE_INTERP)
  1709. X#define M_POLYLINE    (M_POLYLINE_LINE | M_POLYLINE_POLYGON | M_POLYLINE_BOX)
  1710. X#define M_VARPTS_OBJECT (M_POLYLINE_LINE | M_POLYLINE_POLYGON | M_SPLINE)
  1711. X#define M_OPEN_OBJECT    (M_POLYLINE_LINE | M_SPLINE_O | M_ARC)
  1712. X#define M_ROTATE_ANGLE    (M_VARPTS_OBJECT | M_ARC | M_TEXT | M_COMPOUND)
  1713. X#define M_OBJECT    (M_ELLIPSE | M_POLYLINE | M_SPLINE | M_TEXT | M_ARC)
  1714. X#define M_NO_TEXT    (M_ELLIPSE | M_POLYLINE | M_SPLINE | M_COMPOUND | M_ARC)
  1715. X#define M_ALL        (M_OBJECT | M_COMPOUND)
  1716. END_OF_FILE
  1717.   if test 7748 -ne `wc -c <'gnuplot/term/object.h'`; then
  1718.     echo shar: \"'gnuplot/term/object.h'\" unpacked with wrong size!
  1719.   fi
  1720.   # end of 'gnuplot/term/object.h'
  1721. fi
  1722. if test -f 'gnuplot/term/pstricks.trm' -a "${1}" != "-c" ; then 
  1723.   echo shar: Will not clobber existing file \"'gnuplot/term/pstricks.trm'\"
  1724. else
  1725.   echo shar: Extracting \"'gnuplot/term/pstricks.trm'\" \(7730 characters\)
  1726.   sed "s/^X//" >'gnuplot/term/pstricks.trm' <<'END_OF_FILE'
  1727. X/*
  1728. X * $Id: pstricks.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  1729. X */
  1730. X
  1731. X/* GNUPLOT - pstricks.trm */
  1732. X/*
  1733. X * Copyright (C) 1990 - 1993
  1734. X *
  1735. X * Permission to use, copy, and distribute this software and its
  1736. X * documentation for any purpose with or without fee is hereby granted,
  1737. X * provided that the above copyright notice appear in all copies and
  1738. X * that both that copyright notice and this permission notice appear
  1739. X * in supporting documentation.
  1740. X *
  1741. X * Permission to modify the software is granted, but not the right to
  1742. X * distribute the modified code.  Modifications are to be distributed
  1743. X * as patches to released version.
  1744. X *
  1745. X * This software  is provided "as is" without express or implied warranty.
  1746. X *
  1747. X * This file is included by ../term.c.
  1748. X *
  1749. X * This terminal driver supports:
  1750. X *   The PSTricks macros for LaTeX.
  1751. X *
  1752. X * AUTHORS
  1753. X *   David Kotz
  1754. X *
  1755. X *   Raymond Toy    toy@soho.crd.ge.com
  1756. X *    Modified the eepic.trm file to use PSTricks macros instead.
  1757. X *
  1758. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1759. X *
  1760. X */
  1761. X
  1762. X/*
  1763. X *  This file contains the PSTricks terminal driver, intended for use with the
  1764. X *  pstricks.sty macro package for LaTeX. This is an alternative to the
  1765. X *  eepic and latex driver. You need pstricks.sty, and, of course, a printer
  1766. X *  that understands PostScript.  Ghostscript understands Postscript too.
  1767. X *
  1768. X *  PSTricks is available via anonymous ftp from the /pub directory
  1769. X *  at Princeton.EDU.  This driver comes definitely does not come close to
  1770. X *  using the full capability of the PSTricks package.
  1771. X */
  1772. X
  1773. X#define PSTRICKS_PTS_PER_INCH (72.27)
  1774. X#define DOTS_PER_INCH (300)        /* resolution of printer we expect to use */
  1775. X#define PSTRICKS_UNIT (PSTRICKS_PTS_PER_INCH/DOTS_PER_INCH)    /* dot size in pt */
  1776. X
  1777. X/* 5 inches wide by 3 inches high (default) */
  1778. X#define PSTRICKS_XMAX (5*DOTS_PER_INCH)    /* (PSTRICKS_PTS_PER_INCH/PSTRICKS_UNIT*5.0) */
  1779. X#define PSTRICKS_YMAX (3*DOTS_PER_INCH)    /* (PSTRICKS_PTS_PER_INCH/PSTRICKS_UNIT*3.0) */
  1780. X
  1781. X#define PSTRICKS_HTIC (5*DOTS_PER_INCH/72)    /* (5./PSTRICKS_UNIT) */
  1782. X#define PSTRICKS_VTIC (5*DOTS_PER_INCH/72)    /* (5./PSTRICKS_UNIT) */
  1783. X#define PSTRICKS_HCHAR (DOTS_PER_INCH*53/10/72)    /* (5.3/PSTRICKS_UNIT) */
  1784. X#define PSTRICKS_VCHAR (DOTS_PER_INCH*11/72)    /* (11./PSTRICKS_UNIT) */
  1785. X
  1786. Xstatic unsigned int PSTRICKS_posx;
  1787. Xstatic unsigned int PSTRICKS_posy;
  1788. Xenum JUSTIFY    PSTRICKS_justify = LEFT;
  1789. Xstatic int      PSTRICKS_angle = 0;
  1790. X
  1791. X#define    PSTRICKS_TINY_DOT    0.25    /* A tiny dot, in points */
  1792. X
  1793. X/* POINTS */
  1794. X#define PSTRICKS_POINT_TYPES 12        /* we supply more point types */
  1795. Xstatic char  GPFAR * GPFAR PSTRICKS_points[] =
  1796. X{
  1797. X    "\\psset{dotstyle=square, dotangle=45}",
  1798. X    "\\psset{dotstyle=+}",
  1799. X    "\\psset{dotstyle=square}",
  1800. X    "\\psset{dotstyle=+, dotangle=45}",
  1801. X    "\\psset{dotstyle=triangle}",
  1802. X    "\\psset{dotstyle=pentagon}",
  1803. X    "\\psset{dotstyle=o}",
  1804. X    "\\psset{dotstyle=square*, dotangle=45}",
  1805. X    "\\psset{dotstyle=square*}",
  1806. X    "\\psset{dotstyle=triangle*}",
  1807. X    "\\psset{dotstyle=pentagon*}",
  1808. X    "\\psset{dotstyle=*}",
  1809. X};
  1810. X
  1811. X/* LINES */
  1812. X#define PSTRICKS_NUMLINES 6        /* number of linetypes below */
  1813. Xstatic char  GPFAR * GPFAR PSTRICKS_lines[] =
  1814. X{
  1815. X    "\\psset{linewidth=0.35pt,linestyle=solid}",        /* -2 border        */
  1816. X    "\\psset{linewidth=0.3pt,linestyle=dotted,dotsep=1pt}",    /* -1 axes, grid    */
  1817. X    "\\psset{linewidth=0.35pt,linestyle=solid}",        /*  0 solid thin    */
  1818. X    "\\psset{linewidth=0.35pt,linestyle=dashed,dash=5pt 3pt}",    /*  1 dashed        */
  1819. X    "\\psset{linewidth=0.35pt,linestyle=dotted,dotsep=3pt}",    /*  2 dotted        */
  1820. X    "\\psset{linewidth=0.35pt,linestyle=dashed,dash=10pt 3pt}"    /*  3 long dash    */
  1821. X};
  1822. X
  1823. Xstatic int      PSTRICKS_type;        /* current line type */
  1824. Xstatic TBOOLEAN  PSTRICKS_inline = FALSE;/* are we in the middle of a line */
  1825. Xstatic void     PSTRICKS_endline();    /* terminate any line in progress */
  1826. Xstatic int      PSTRICKS_linecount = 0;    /* number of points in line so far */
  1827. X
  1828. X#define PSTRICKS_LINEMAX 50        /* max value for linecount */
  1829. X
  1830. XPSTRICKS_init()
  1831. X{
  1832. X    PSTRICKS_posx = PSTRICKS_posy = 0;
  1833. X    PSTRICKS_linetype(-1);
  1834. X    fprintf(outfile, "%% GNUPLOT: LaTeX picture using PSTRICKS macros\n");
  1835. X    fprintf(outfile, "\\psset{unit=%fpt}\n", PSTRICKS_UNIT);
  1836. X    fprintf(outfile, "\\psset{arrowsize=3pt 3.2 1.4 .3}\n");
  1837. X}
  1838. X
  1839. X
  1840. XPSTRICKS_scale(xs, ys)
  1841. X    double          xs, ys;        /* scaling factors */
  1842. X{
  1843. X    register struct termentry *t = &term_tbl[term];
  1844. X
  1845. X    /* we change the table for use in graphics.c and PSTRICKS_graphics */
  1846. X    t->xmax = (unsigned int) (PSTRICKS_XMAX * xs);
  1847. X    t->ymax = (unsigned int) (PSTRICKS_YMAX * ys);
  1848. X
  1849. X    return (TRUE);
  1850. X}
  1851. X
  1852. XPSTRICKS_graphics()
  1853. X{
  1854. X    register struct termentry *t = &term_tbl[term];
  1855. X
  1856. X    fprintf(outfile, "\\begin{pspicture}(0,0)(%d,%d)\n", t->xmax, t->ymax);
  1857. X    fprintf(outfile, "\\tenrm\n");
  1858. X}
  1859. X
  1860. X
  1861. XPSTRICKS_text()
  1862. X{
  1863. X    PSTRICKS_endline();
  1864. X    fprintf(outfile, "\\end{pspicture}\n");
  1865. X}
  1866. X
  1867. X
  1868. XPSTRICKS_linetype(linetype)
  1869. X    int             linetype;
  1870. X{
  1871. X    PSTRICKS_endline();
  1872. X
  1873. X    if (linetype >= PSTRICKS_NUMLINES - 2)
  1874. X    linetype %= (PSTRICKS_NUMLINES - 2);
  1875. X
  1876. X    PSTRICKS_type = linetype;
  1877. X}
  1878. X
  1879. X
  1880. X
  1881. XPSTRICKS_move(x, y)
  1882. X    unsigned int    x, y;
  1883. X{
  1884. X    PSTRICKS_endline();
  1885. X
  1886. X    PSTRICKS_posx = x;
  1887. X    PSTRICKS_posy = y;
  1888. X}
  1889. X
  1890. X
  1891. XPSTRICKS_point(x, y, number)        /* version of line_and_point */
  1892. X    unsigned int    x, y;
  1893. X    int             number;        /* type of point */
  1894. X{
  1895. X    PSTRICKS_move(x, y);
  1896. X
  1897. X    /* Print the character defined by 'number'; number < 0 means
  1898. X      to use a dot, otherwise one of the defined points. */
  1899. X
  1900. X    if (number < 0) {
  1901. X    fprintf(outfile, "\\qdisk(%d,%d){%fpt}\n",
  1902. X        x, y, PSTRICKS_TINY_DOT);
  1903. X    } else {
  1904. X    fprintf(outfile, "%s\\psdots(%d,%d)\n",
  1905. X        PSTRICKS_points[number % PSTRICKS_POINT_TYPES],
  1906. X        x, y);
  1907. X    }
  1908. X}
  1909. X
  1910. X
  1911. XPSTRICKS_vector(ux, uy)
  1912. X    unsigned int    ux, uy;
  1913. X{
  1914. X    if (!PSTRICKS_inline) {
  1915. X    PSTRICKS_inline = TRUE;
  1916. X
  1917. X    /* Start a new line. This depends on line type */
  1918. X    fprintf(outfile, "%s\\psline(%u,%u)",
  1919. X        PSTRICKS_lines[PSTRICKS_type + 2],
  1920. X        PSTRICKS_posx, PSTRICKS_posy);
  1921. X    PSTRICKS_linecount = 1;
  1922. X    } else {
  1923. X    /*
  1924. X     * Even though we are in middle of a path,
  1925. X     * we may want to start a new path command.
  1926. X     * If they are too long then latex will choke.
  1927. X     */
  1928. X    if (PSTRICKS_linecount++ >= PSTRICKS_LINEMAX) {
  1929. X        fprintf(outfile, "\n");
  1930. X        fprintf(outfile, "%s\\psline(%u,%u)",
  1931. X            PSTRICKS_lines[PSTRICKS_type + 2],
  1932. X            PSTRICKS_posx, PSTRICKS_posy);
  1933. X        PSTRICKS_linecount = 1;
  1934. X    }
  1935. X    }
  1936. X    fprintf(outfile, "(%u,%u)", ux, uy);
  1937. X    PSTRICKS_posx = ux;
  1938. X    PSTRICKS_posy = uy;
  1939. X}
  1940. X
  1941. Xstatic void
  1942. XPSTRICKS_endline()
  1943. X{
  1944. X    if (PSTRICKS_inline) {
  1945. X    fprintf(outfile, "\n");
  1946. X    PSTRICKS_inline = FALSE;
  1947. X    }
  1948. X}
  1949. X
  1950. X
  1951. XPSTRICKS_arrow(sx, sy, ex, ey, head)
  1952. X    int             sx, sy, ex, ey;
  1953. X    TBOOLEAN         head;
  1954. X{
  1955. X    fprintf(outfile, "\\psline[linestyle=solid]%s(%d,%d)(%d,%d)\n",
  1956. X        head ? "{->}" : "",
  1957. X        sx, sy, ex, ey);
  1958. X
  1959. X    PSTRICKS_posx = ex;
  1960. X    PSTRICKS_posy = ey;
  1961. X}
  1962. X
  1963. X
  1964. XPSTRICKS_put_text(x, y, str)
  1965. X    int             x, y;        /* reference point of string */
  1966. X    char            str[];        /* the text */
  1967. X{
  1968. X    PSTRICKS_endline();
  1969. X
  1970. X    fprintf(outfile, "\\rput");
  1971. X
  1972. X    /* Set justification */
  1973. X
  1974. X    switch (PSTRICKS_justify) {
  1975. X    case LEFT:
  1976. X    fprintf(outfile, "[l]");
  1977. X    break;
  1978. X    case CENTRE:
  1979. X    break;
  1980. X    case RIGHT:
  1981. X    fprintf(outfile, "[r]");
  1982. X    break;
  1983. X    }
  1984. X
  1985. X    /* Set text angle */
  1986. X
  1987. X    switch (PSTRICKS_angle) {
  1988. X    case 0:
  1989. X    break;
  1990. X    case 1:
  1991. X    fprintf(outfile, "{L}");
  1992. X    break;
  1993. X    }
  1994. X
  1995. X    /* Set reference position and text */
  1996. X
  1997. X    fprintf(outfile, "(%d,%d){%s}\n", x, y, str);
  1998. X
  1999. X}
  2000. X
  2001. X
  2002. X
  2003. Xint 
  2004. XPSTRICKS_justify_text(mode)
  2005. X    enum JUSTIFY    mode;
  2006. X{
  2007. X    PSTRICKS_justify = mode;
  2008. X    return (TRUE);
  2009. X}
  2010. X
  2011. Xint 
  2012. XPSTRICKS_text_angle(angle)
  2013. X    int             angle;
  2014. X{
  2015. X    PSTRICKS_angle = angle;
  2016. X    return (TRUE);
  2017. X}
  2018. X
  2019. XPSTRICKS_reset()
  2020. X{
  2021. X    PSTRICKS_endline();
  2022. X    PSTRICKS_posx = PSTRICKS_posy = 0;
  2023. X}
  2024. X
  2025. END_OF_FILE
  2026.   if test 7730 -ne `wc -c <'gnuplot/term/pstricks.trm'`; then
  2027.     echo shar: \"'gnuplot/term/pstricks.trm'\" unpacked with wrong size!
  2028.   fi
  2029.   # end of 'gnuplot/term/pstricks.trm'
  2030. fi
  2031. if test -f 'gnuplot/term/vws.trm' -a "${1}" != "-c" ; then 
  2032.   echo shar: Will not clobber existing file \"'gnuplot/term/vws.trm'\"
  2033. else
  2034.   echo shar: Extracting \"'gnuplot/term/vws.trm'\" \(8085 characters\)
  2035.   sed "s/^X//" >'gnuplot/term/vws.trm' <<'END_OF_FILE'
  2036. X/*
  2037. X * $Id: vws.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  2038. X *
  2039. X */
  2040. X
  2041. X/* GNUPLOT - vws.trm */
  2042. X/*
  2043. X * Copyright (C) 1990 - 1993
  2044. X *
  2045. X * Permission to use, copy, and distribute this software and its
  2046. X * documentation for any purpose with or without fee is hereby granted,
  2047. X * provided that the above copyright notice appear in all copies and
  2048. X * that both that copyright notice and this permission notice appear
  2049. X * in supporting documentation.
  2050. X *
  2051. X * Permission to modify the software is granted, but not the right to
  2052. X * distribute the modified code.  Modifications are to be distributed
  2053. X * as patches to released version.
  2054. X *
  2055. X * This software  is provided "as is" without express or implied warranty.
  2056. X *
  2057. X * This file is included by ../term.c.
  2058. X *
  2059. X * This terminal driver supports:
  2060. X *   IRIS terminals
  2061. X *
  2062. X * AUTHORS
  2063. X *   Walter Speth
  2064. X *           BITNET: SPETH@DBNPIB5
  2065. X *
  2066. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  2067. X *
  2068. X */
  2069. X#define VWS_XMAX   1024
  2070. X#define VWS_YMAX   780
  2071. X#define VWS_VCHAR  25
  2072. X#define VWS_HCHAR  15
  2073. X#define VWS_VTIC   10
  2074. X#define VWS_HTIC   10
  2075. X#include stdio
  2076. X/*
  2077. X#include math
  2078. X#include ssdef
  2079. X*/
  2080. X#include descrip
  2081. X#include <uisentry.h>
  2082. X#include <uisusrdef.h>
  2083. X#define DEFAULT_ATTR 0
  2084. X#define OVER_ATTR 1
  2085. X#define ERAS_ATTR 2
  2086. X#define BIS_ATTR 3
  2087. X#define COLOR_ATTR 4
  2088. X#define TEXT_ATTR 5
  2089. X#define LINE_ATTR 6
  2090. X#define BACK_ATTR 7
  2091. Xfloat current_x, current_y;
  2092. Xint vd_id, wd_id;
  2093. Xint vcm_id;
  2094. Xstatic $DESCRIPTOR(ws_devname, "SYS$WORKSTATION");
  2095. Xstatic $DESCRIPTOR(vd_title, "gnuplot");
  2096. Xstatic float x0, y0, xsiz, ysiz,
  2097. X             wc_xmin_new, wc_ymin_new, wc_xmax_new, wc_ymax_new,
  2098. X             wc_xmin, wc_ymin, wc_xmax, wc_ymax,
  2099. X             vd_width, vd_height;
  2100. XVWS_resize_ast()
  2101. X{ uis$resize_window(&vd_id, &wd_id, &x0, &y0, &xsiz, &ysiz,
  2102. X                     &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax);
  2103. X  replotrequest();
  2104. X}
  2105. X/****************************************************************************/
  2106. XVWS_init()
  2107. X{
  2108. X  int i;
  2109. X  int cattr;
  2110. X  $DESCRIPTOR(a_font,"DTABER0003WK00PG0001UZZZZ02A000");
  2111. X  vd_width  = 14;
  2112. X  vd_height = 10; /* aspect sqrt(2) as DIN A paper */
  2113. X  wc_xmin = 0.0;
  2114. X  wc_ymin = 0.0;
  2115. X  wc_xmax = (float) VWS_XMAX;
  2116. X  wc_ymax = (float) VWS_YMAX;
  2117. X  vcm_id = uis$create_color_map(&8);
  2118. X  vd_id = uis$create_display(&wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax,
  2119. X                             &vd_width, &vd_height, &vcm_id);
  2120. X  uis$set_color(&vd_id, &0, &.5, &.5, &.5);
  2121. X  uis$set_color(&vd_id, &1, &0.0, &0.0, &0.0);
  2122. X  uis$set_color(&vd_id, &2, &0.0, &0.0, &0.0);
  2123. X  uis$set_color(&vd_id, &3, &0.0, &0.0, &0.0);
  2124. X  uis$set_color(&vd_id, &4, &0.0, &0.0, &0.0);
  2125. X  uis$set_color(&vd_id, &5, &0.0, &0.0, &0.0);
  2126. X  uis$set_color(&vd_id, &6, &0.0, &0.0, &0.0);
  2127. X  uis$set_color(&vd_id, &7, &0.0, &0.0, &0.0);
  2128. X/*
  2129. X  uis$set_color(&vd_id, &2, &.2, &.2, &.2);
  2130. X  uis$set_color(&vd_id, &3, &.3, &.3, &.3);
  2131. X  uis$set_color(&vd_id, &4, &.4, &.4, &.4);
  2132. X  uis$set_color(&vd_id, &5, &.5, &.5, &.5);
  2133. X  uis$set_color(&vd_id, &6, &.6, &.6, &.6);
  2134. X  uis$set_color(&vd_id, &7, &.7, &.7, &.7);
  2135. X/* perhaps better for color terms (which I do not have)
  2136. X  uis$set_color(&vd_id, &0, &0.0, &0.0, &0.0);
  2137. X  uis$set_color(&vd_id, &1, &0.9, &0.0, &0.0);
  2138. X  uis$set_color(&vd_id, &2, &0.0, &0.9, &0.0);
  2139. X  uis$set_color(&vd_id, &3, &0.9, &0.9, &0.0);
  2140. X  uis$set_color(&vd_id, &4, &0.0, &0.0, &0.9);
  2141. X  uis$set_color(&vd_id, &5, &0.9, &0.0, &0.9);
  2142. X  uis$set_color(&vd_id, &6, &0.0, &0.9, &0.9);
  2143. X  uis$set_color(&vd_id, &7, &0.9, &0.9, &0.9);
  2144. X/*
  2145. X*/
  2146. X  uis$disable_display_list(&vd_id);
  2147. X  wd_id = uis$create_window(&vd_id, &ws_devname, &vd_title,
  2148. X                            &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax,
  2149. X                            &vd_width, &vd_height);
  2150. X  uis$set_resize_ast(&vd_id, &wd_id, &VWS_resize_ast, &0,
  2151. X                     &x0, &y0, &xsiz, &ysiz,
  2152. X                     &wc_xmin_new, &wc_ymin_new, &wc_xmax_new, &wc_ymax_new);
  2153. X  uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &OVER_ATTR, &UIS$C_MODE_OVER);
  2154. X  uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &ERAS_ATTR, &UIS$C_MODE_ERAS);
  2155. X  uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &BIS_ATTR, &UIS$C_MODE_BIS);
  2156. X/*
  2157. X  for (i=0; i<8; i++) {
  2158. X    cattr = COLOR_ATTR+i;
  2159. X    uis$set_writing_index(&vd_id, ©_ATTR, &cattr, &i);
  2160. X    }
  2161. X*/
  2162. X  uis$set_background_index(&vd_id, &DEFAULT_ATTR, &BACK_ATTR, &0);
  2163. X  uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &TEXT_ATTR, &UIS$C_MODE_OVER);
  2164. X  uis$set_font(&vd_id,&TEXT_ATTR,&TEXT_ATTR,&a_font);
  2165. X  uis$set_char_size(&vd_id,&TEXT_ATTR,&TEXT_ATTR,&0,
  2166. X                    &(float)VWS_HCHAR,&(float)VWS_VCHAR);
  2167. X  uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
  2168. X}
  2169. X/****************************************************************************/
  2170. XVWS_reset()
  2171. X{
  2172. X  uis$delete_display(&vd_id);
  2173. X}
  2174. X/****************************************************************************/
  2175. XVWS_scale(xs,ys)
  2176. Xint xs,ys;
  2177. X{
  2178. X        return FALSE;
  2179. X}
  2180. X/****************************************************************************/
  2181. XVWS_graphics()
  2182. X{
  2183. X    uis$erase(&vd_id, &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax);
  2184. X}
  2185. X/****************************************************************************/
  2186. XVWS_text()
  2187. X{
  2188. X}
  2189. X/****************************************************************************/
  2190. XVWS_move(x,y)
  2191. Xint x,y;
  2192. X{
  2193. X  current_x= (float)(x);
  2194. X  current_y= (float)(y);
  2195. X}
  2196. X/****************************************************************************/
  2197. XVWS_vector(x,y)
  2198. Xint x,y;
  2199. X{ int col;
  2200. X  float fx,fy;
  2201. X  fx=(float) x;
  2202. X  fy=(float) y;
  2203. X      uis$line(&vd_id, &LINE_ATTR,
  2204. X               ¤t_x, ¤t_y, &fx, &fy);
  2205. X      VWS_move (x,y);
  2206. X}
  2207. X/****************************************************************************/
  2208. XVWS_linetype(lt)
  2209. Xint lt;
  2210. X{
  2211. Xlong int lstyle[9]={    0xffffffff,
  2212. X                        0Xff00ff00,
  2213. X                        0xffffff00,
  2214. X                        0xffff0000,
  2215. X                        0xf0f0f0f0,
  2216. X                        0Xfff0fff0,
  2217. X                        0xf000f000,
  2218. X                        0xa5a5a5af,
  2219. X                        0xf00f00f0 };
  2220. X  switch(lt) {
  2221. Xcase -1: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
  2222. X         uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&1.5);
  2223. X         break;
  2224. Xcase -2: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
  2225. X         uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&2.0);
  2226. X         break;
  2227. X/*
  2228. Xdefault:  uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&lstyle[lt % 8]);
  2229. X          makes part of curve disappear on my workstation
  2230. X*/
  2231. Xdefault:  uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
  2232. X         uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&1.0);
  2233. X}
  2234. X}
  2235. X/****************************************************************************/
  2236. Xstatic int justify_mode =CENTRE,up;;
  2237. XVWS_put_text(x,y,str)
  2238. Xint x,y; char* str;
  2239. X{
  2240. X  float fx,fy, thih, twid;
  2241. X/* uis$text parameter is descriptor string not character string */
  2242. X  struct dsc$descriptor_s textline = {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,""};
  2243. X  textline.dsc$a_pointer = str;
  2244. X  textline.dsc$w_length = strlen(textline.dsc$a_pointer);
  2245. X  uis$measure_text(&vd_id,&TEXT_ATTR,&textline,&twid,&thih);
  2246. X  fx=(float)x;
  2247. X  fy=(float)y;
  2248. X  switch (justify_mode) {
  2249. X  case LEFT : fy+=thih/2.;
  2250. X              break;
  2251. X  case RIGHT : fy+=thih/2.;
  2252. X               fx-=twid;
  2253. X              break;
  2254. X  case CENTRE : fy+=thih/2.;
  2255. X               fx-=twid/2;
  2256. X              break;
  2257. X  };
  2258. X  uis$text(&vd_id,&TEXT_ATTR,&textline,&fx,&fy);
  2259. X     /* write to Example Viewport window */
  2260. X}
  2261. X/****************************************************************************/
  2262. XVWS_text_angle(ang)
  2263. Xint ang;
  2264. X{
  2265. X  float degrees;
  2266. X  degrees=90.*(up=ang);
  2267. X  uis$set_text_slope (&vd_id, &TEXT_ATTR, &TEXT_ATTR, °rees);
  2268. Xreturn TRUE;
  2269. X}
  2270. X/****************************************************************************/
  2271. XVWS_justify_text(mode)
  2272. Xint mode;
  2273. X{ justify_mode=mode;
  2274. Xreturn TRUE;
  2275. X}
  2276. X/****************************************************************************/
  2277. XVWS_point(x,y,point)
  2278. Xint x,y,point;
  2279. X{
  2280. Xdo_point(x,y,point);
  2281. X}
  2282. X/****************************************************************************/
  2283. XVWS_arrow(sx,sy,ex,ey)
  2284. Xint sx,sy,ex,ey;
  2285. X{
  2286. Xdo_arrow(sx,sy,ex,ey);
  2287. X}
  2288. END_OF_FILE
  2289.   if test 8085 -ne `wc -c <'gnuplot/term/vws.trm'`; then
  2290.     echo shar: \"'gnuplot/term/vws.trm'\" unpacked with wrong size!
  2291.   fi
  2292.   # end of 'gnuplot/term/vws.trm'
  2293. fi
  2294. if test -f 'gnuplot/win/wgnuplib.h' -a "${1}" != "-c" ; then 
  2295.   echo shar: Will not clobber existing file \"'gnuplot/win/wgnuplib.h'\"
  2296. else
  2297.   echo shar: Extracting \"'gnuplot/win/wgnuplib.h'\" \(8074 characters\)
  2298.   sed "s/^X//" >'gnuplot/win/wgnuplib.h' <<'END_OF_FILE'
  2299. X/*
  2300. X * $Id: wgnuplib.h%v 3.50.1.13 1993/08/19 03:21:26 woo Exp $
  2301. X */
  2302. X
  2303. X/* GNUPLOT - win/wgnuplib.h */
  2304. X/*
  2305. X * Copyright (C) 1992   Russell Lang
  2306. X *
  2307. X * Permission to use, copy, and distribute this software and its
  2308. X * documentation for any purpose with or without fee is hereby granted, 
  2309. X * provided that the above copyright notice appear in all copies and 
  2310. X * that both that copyright notice and this permission notice appear 
  2311. X * in supporting documentation.
  2312. X *
  2313. X * Permission to modify the software is granted, but not the right to
  2314. X * distribute the modified code.  Modifications are to be distributed 
  2315. X * as patches to released version.
  2316. X *  
  2317. X * This software is provided "as is" without express or implied warranty.
  2318. X * 
  2319. X *
  2320. X * AUTHORS
  2321. X * 
  2322. X *   Russell Lang
  2323. X * 
  2324. X * Send your comments or suggestions to 
  2325. X *  info-gnuplot@dartmouth.edu.
  2326. X * This is a mailing list; to join it send a note to 
  2327. X *  info-gnuplot-request@dartmouth.edu.  
  2328. X * Send bug reports to
  2329. X *  bug-gnuplot@dartmouth.edu.
  2330. X */
  2331. X
  2332. X/* this file contains items to be visible outside wgnuplot.dll */
  2333. X
  2334. X#ifdef _WINDOWS
  2335. X#define _Windows
  2336. X#endif
  2337. X
  2338. X#ifdef __DLL__
  2339. X#define WDPROC WINAPI _export
  2340. X#else
  2341. X#define WDPROC WINAPI
  2342. X#endif
  2343. X
  2344. X#define WGNUPLOTVERSION  "1.1   1993-08-14"
  2345. XBOOL WDPROC CheckWGNUPLOTVersion(LPSTR str);
  2346. X
  2347. X/* ================================== */
  2348. X/* For WIN32 API's 
  2349. X#ifdef WIN32
  2350. X#define DEFAULT_CHARSET ANSI_CHARSET
  2351. X#define OFFSETOF(x)  (x)
  2352. X#define SELECTOROF(x)  (x)
  2353. X#define MoveTo(hdc,x,y) MoveToEx(hdc,x,y,(LPPOINT)NULL);
  2354. X#endif
  2355. X/* ================================== */
  2356. X/* wprinter.c - windows printer routines */
  2357. Xvoid WDPROC DumpPrinter(HWND hwnd, LPSTR szAppName, LPSTR szFileName);
  2358. X
  2359. Xtypedef struct tagPRINT {
  2360. X    HDC        hdcPrn;
  2361. X    HWND    hDlgPrint;
  2362. X    BOOL    bUserAbort;
  2363. X    POINT    pdef;
  2364. X    POINT    psize;
  2365. X    POINT    poff;
  2366. X    struct tagPRINT FAR *next;
  2367. X} PRINT;
  2368. Xtypedef PRINT FAR*  LPPRINT;
  2369. X
  2370. X/* ================================== */
  2371. X/* wpause.c - pause window structure */
  2372. Xtypedef struct tagPW
  2373. X{
  2374. X    HINSTANCE    hInstance;        /* required */
  2375. X    HINSTANCE    hPrevInstance;    /* required */
  2376. X    LPSTR    Title;            /* required */
  2377. X    LPSTR    Message;        /* required */
  2378. X    POINT    Origin;            /* optional */
  2379. X    HWND    hWndParent;        /* optional */
  2380. X    HWND    hWndPause;
  2381. X    HWND    hOK;
  2382. X    HWND    hCancel;
  2383. X    BOOL    bPause;
  2384. X    BOOL    bPauseCancel;
  2385. X    BOOL    bDefOK;
  2386. X    WNDPROC    lpfnOK;
  2387. X    WNDPROC    lpfnCancel;
  2388. X    WNDPROC    lpfnPauseButtonProc;
  2389. X} PW;
  2390. Xtypedef PW FAR*  LPPW;
  2391. X
  2392. Xint WDPROC PauseBox(LPPW lppw);
  2393. X
  2394. X/* ================================== */
  2395. X/* wmenu.c - menu structure */
  2396. X#define BUTTONMAX 10
  2397. Xtypedef struct tagMW
  2398. X{
  2399. X    LPSTR    szMenuName;        /* required */
  2400. X    HMENU    hMenu;
  2401. X    BYTE FAR * FAR *macro;
  2402. X    BYTE FAR *macrobuf;
  2403. X    int        nCountMenu;
  2404. X    DLGPROC    lpProcInput;
  2405. X    char    *szPrompt;
  2406. X    char    *szAnswer;
  2407. X    int        nChar;
  2408. X    int        nButton;
  2409. X    HWND    hButton[BUTTONMAX];
  2410. X    int        hButtonID[BUTTONMAX];
  2411. X    WNDPROC    lpfnMenuButtonProc;
  2412. X    WNDPROC    lpfnButtonProc[BUTTONMAX];
  2413. X} MW;
  2414. Xtypedef MW FAR * LPMW;
  2415. X
  2416. X/* ================================== */
  2417. X/* wtext.c text window structure */
  2418. X/* If an optional item is not specified it must be zero */
  2419. X#define MAXFONTNAME 80
  2420. Xtypedef struct tagTW
  2421. X{
  2422. X    LPPRINT    lpr;            /* must be first */
  2423. X    HINSTANCE hInstance;        /* required */
  2424. X    HINSTANCE hPrevInstance;    /* required */
  2425. X    LPSTR    Title;            /* required */
  2426. X    LPMW    lpmw;            /* optional */
  2427. X    POINT    ScreenSize;        /* optional */
  2428. X    unsigned int KeyBufSize;    /* optional */
  2429. X    LPSTR    IniFile;        /* optional */
  2430. X    LPSTR    IniSection;        /* optional */
  2431. X    LPSTR    DragPre;        /* optional */
  2432. X    LPSTR    DragPost;        /* optional */
  2433. X    int        nCmdShow;        /* optional */
  2434. X    FARPROC shutdown;        /* optional */
  2435. X    HICON    hIcon;            /* optional */
  2436. X    LPSTR   AboutText;        /* optional */
  2437. X    HMENU    hPopMenu;
  2438. X    HWND    hWndText;
  2439. X    HWND    hWndParent;
  2440. X    POINT    Origin;
  2441. X    POINT    Size;
  2442. X    BYTE FAR *ScreenBuffer;
  2443. X    BYTE FAR *AttrBuffer;
  2444. X    BYTE FAR *KeyBuf;
  2445. X    BYTE FAR *KeyBufIn;
  2446. X    BYTE FAR *KeyBufOut;
  2447. X    BYTE    Attr;
  2448. X    BOOL    bFocus;
  2449. X    BOOL    bGetCh;
  2450. X    BOOL    bSysColors;
  2451. X    HBRUSH    hbrBackground;
  2452. X    char    fontname[MAXFONTNAME];    /* font name */
  2453. X    int        fontsize;                /* font size in pts */
  2454. X    HFONT    hfont;
  2455. X    int        CharAscent;
  2456. X    int        ButtonHeight;
  2457. X    int        CaretHeight;
  2458. X    int        CursorFlag;
  2459. X    POINT    CursorPos;
  2460. X    POINT    ClientSize;
  2461. X    POINT    CharSize;
  2462. X    POINT    ScrollPos;
  2463. X    POINT    ScrollMax;
  2464. X    POINT    MarkBegin;
  2465. X    POINT    MarkEnd;
  2466. X    BOOL    Marking;
  2467. X} TW;
  2468. Xtypedef TW FAR*  LPTW;
  2469. X
  2470. X
  2471. X/* ================================== */
  2472. X/* wtext.c - Text Window */
  2473. Xvoid WDPROC TextMessage(void);
  2474. Xint WDPROC TextInit(LPTW lptw);
  2475. Xvoid WDPROC TextClose(LPTW lptw);
  2476. Xvoid WDPROC TextToCursor(LPTW lptw);
  2477. Xint WDPROC  TextKBHit(LPTW);
  2478. Xint WDPROC TextGetCh(LPTW);
  2479. Xint WDPROC TextGetChE(LPTW);
  2480. XLPSTR WDPROC TextGetS(LPTW lptw, LPSTR str, unsigned int size);
  2481. Xint WDPROC TextPutCh(LPTW, BYTE);
  2482. Xint WDPROC TextPutS(LPTW lptw, LPSTR str);
  2483. Xvoid WDPROC TextGotoXY(LPTW lptw, int x, int y);
  2484. Xint  WDPROC TextWhereX(LPTW lptw);
  2485. Xint  WDPROC TextWhereY(LPTW lptw);
  2486. Xvoid WDPROC TextCursorHeight(LPTW lptw, int height);
  2487. Xvoid WDPROC TextClearEOL(LPTW lptw);
  2488. Xvoid WDPROC TextClearEOS(LPTW lptw);
  2489. Xvoid WDPROC TextInsertLine(LPTW lptw);
  2490. Xvoid WDPROC TextDeleteLine(LPTW lptw);
  2491. Xvoid WDPROC TextScrollReverse(LPTW lptw);
  2492. Xvoid WDPROC TextAttr(LPTW lptw, BYTE attr);
  2493. Xvoid WDPROC AboutBox(HWND hwnd, LPSTR str);
  2494. X
  2495. X/* ================================== */
  2496. X/* wgraph.c - graphics window */
  2497. X
  2498. X/* windows data */
  2499. X#define WGNUMPENS 15
  2500. X
  2501. X#define GWOPMAX 4096
  2502. X/* GWOP is 8 bytes long. Array of GWOP kept in global block */
  2503. Xstruct GWOP {
  2504. X    WORD op;
  2505. X    WORD x, y; 
  2506. X    HLOCAL htext;
  2507. X};
  2508. X
  2509. X/* memory block for graph operations */
  2510. Xstruct GWOPBLK {            /* kept in local memory */
  2511. X    struct GWOPBLK *next;
  2512. X    HGLOBAL hblk;            /* handle to a global block */
  2513. X    struct GWOP FAR *gwop;    /* pointer to global block if locked */
  2514. X    UINT used;                /* number of GWOP's used */
  2515. X};
  2516. X
  2517. X/* ops */
  2518. X#define W_endoflist 0
  2519. X#define W_dot 10
  2520. X#define W_diamond 11
  2521. X#define W_plus 12
  2522. X#define W_box 13
  2523. X#define W_cross 14
  2524. X#define W_triangle 15
  2525. X#define W_star 16
  2526. X#define W_move 20
  2527. X#define W_vect 21
  2528. X#define W_line_type 22
  2529. X#define W_put_text 23
  2530. X#define W_justify 24
  2531. X#define W_text_angle 25
  2532. X
  2533. Xtypedef struct tagGW {
  2534. X    LPPRINT    lpr;            /* must be first */
  2535. X    HINSTANCE    hInstance;        /* required */
  2536. X    HINSTANCE    hPrevInstance;    /* required */
  2537. X    LPSTR    Title;            /* required */
  2538. X    int        xmax;            /* required */
  2539. X    int        ymax;            /* required */
  2540. X    LPTW    lptw;        /* optional */  /* associated text window */
  2541. X    POINT    Origin;        /* optional */    /* origin of graph window */
  2542. X    POINT    Size;        /* optional */    /* size of graph window */
  2543. X    LPSTR    IniFile;    /* optional */
  2544. X    LPSTR    IniSection;    /* optional */
  2545. X    HWND    hWndGraph;    /* window handle */
  2546. X    HMENU    hPopMenu;    /* popup menu */
  2547. X    int        numsolid;    /* number of solid pen styles */
  2548. X    int        pen;        /* current pen number */
  2549. X    int        htic;        /* horizontal size of point symbol (xmax units) */
  2550. X    int     vtic;        /* vertical size of point symbol (ymax units)*/
  2551. X    int        hchar;        /* horizontal size of character (xmax units) */
  2552. X    int        vchar;        /* vertical size of character (ymax units)*/
  2553. X    int        angle;        /* text angle */
  2554. X    BOOL    rotate;        /* can text be rotated 90 degrees ? */
  2555. X    char    fontname[MAXFONTNAME];    /* font name */
  2556. X    int        fontsize;    /* font size in pts */
  2557. X    HFONT    hfonth;        /* horizonal font */
  2558. X    HFONT    hfontv;        /* vertical font */
  2559. X    BOOL    resized;    /* has graph window been resized? */
  2560. X    BOOL    graphtotop;    /* bring graph window to top after every plot? */
  2561. X    BOOL    color;                    /* color pens? */
  2562. X    HPEN    hbpen;                    /* border pen */
  2563. X    HPEN    hapen;                    /* axis pen */
  2564. X    HPEN    hpen[WGNUMPENS];        /* pens */
  2565. X    LOGPEN    colorpen[WGNUMPENS+2];    /* logical color pens */
  2566. X    LOGPEN    monopen[WGNUMPENS+2];    /* logical mono pens */
  2567. X    COLORREF background;            /* background color */
  2568. X    HBRUSH   hbrush;                /* background brush */
  2569. X    struct GWOPBLK *gwopblk_head;
  2570. X    struct GWOPBLK *gwopblk_tail;
  2571. X    unsigned int nGWOP;
  2572. X    BOOL    locked;                /* locked if being written */
  2573. X} GW;
  2574. Xtypedef GW FAR*  LPGW;
  2575. X
  2576. X#define WINFONTSIZE 10
  2577. X#define WIN30FONT "Courier"
  2578. X#define WINFONT "Arial"
  2579. X
  2580. X#ifndef LEFT
  2581. X#define LEFT 0
  2582. X#endif
  2583. X#ifndef CENTRE
  2584. X#define CENTRE 1
  2585. X#endif
  2586. X#ifndef RIGHT
  2587. X#define RIGHT 2
  2588. X#endif
  2589. X
  2590. Xvoid WDPROC GraphInit(LPGW lpgw);
  2591. Xvoid WDPROC GraphClose(LPGW lpgw);
  2592. Xvoid WDPROC GraphStart(LPGW lpgw);
  2593. Xvoid WDPROC GraphEnd(LPGW lpgw);
  2594. Xvoid WDPROC GraphOp(LPGW lpgw, WORD op, WORD x, WORD y, LPSTR str);
  2595. Xvoid WDPROC GraphPrint(LPGW lpgw);
  2596. Xvoid WDPROC GraphRedraw(LPGW lpgw);
  2597. X
  2598. X/* ================================== */
  2599. END_OF_FILE
  2600.   if test 8074 -ne `wc -c <'gnuplot/win/wgnuplib.h'`; then
  2601.     echo shar: \"'gnuplot/win/wgnuplib.h'\" unpacked with wrong size!
  2602.   fi
  2603.   # end of 'gnuplot/win/wgnuplib.h'
  2604. fi
  2605. if test -f 'gnuplot/win/wpause.c' -a "${1}" != "-c" ; then 
  2606.   echo shar: Will not clobber existing file \"'gnuplot/win/wpause.c'\"
  2607. else
  2608.   echo shar: Extracting \"'gnuplot/win/wpause.c'\" \(7827 characters\)
  2609.   sed "s/^X//" >'gnuplot/win/wpause.c' <<'END_OF_FILE'
  2610. X#ifndef lint
  2611. Xstatic char *RCSid = "$Id: wpause.c%v 3.50 1993/07/09 05:35:24 woo Exp $";
  2612. X#endif
  2613. X
  2614. X/* GNUPLOT - win/wpause.c */
  2615. X/*
  2616. X * Copyright (C) 1992   Russell Lang
  2617. X *
  2618. X * Permission to use, copy, and distribute this software and its
  2619. X * documentation for any purpose with or without fee is hereby granted, 
  2620. X * provided that the above copyright notice appear in all copies and 
  2621. X * that both that copyright notice and this permission notice appear 
  2622. X * in supporting documentation.
  2623. X *
  2624. X * Permission to modify the software is granted, but not the right to
  2625. X * distribute the modified code.  Modifications are to be distributed 
  2626. X * as patches to released version.
  2627. X *  
  2628. X * This software is provided "as is" without express or implied warranty.
  2629. X * 
  2630. X *
  2631. X * AUTHORS
  2632. X * 
  2633. X *   Russell Lang
  2634. X * 
  2635. X * Send your comments or suggestions to 
  2636. X *  info-gnuplot@dartmouth.edu.
  2637. X * This is a mailing list; to join it send a note to 
  2638. X *  info-gnuplot-request@dartmouth.edu.  
  2639. X * Send bug reports to
  2640. X *  bug-gnuplot@dartmouth.edu.
  2641. X */
  2642. X/* PauseBox() */
  2643. X
  2644. X/* MessageBox ALWAYS appears in the middle of the screen so instead */
  2645. X/* we use this PauseBox so we can decide where it is to be placed */
  2646. X
  2647. X#define STRICT
  2648. X#include <windows.h>
  2649. X#include <windowsx.h>
  2650. X#include <string.h>
  2651. X#include "wgnuplib.h"
  2652. X#include "wresourc.h"
  2653. X#include "wcommon.h"
  2654. X
  2655. X/* Pause Window */
  2656. XLRESULT CALLBACK _export WndPauseProc(HWND, UINT, WPARAM, LPARAM);
  2657. XLRESULT CALLBACK _export PauseButtonProc(HWND, UINT, WPARAM, LPARAM);
  2658. X
  2659. X/* Create Pause Class */
  2660. X/* called from PauseBox the first time a pause window is created */
  2661. Xvoid
  2662. XCreatePauseClass(LPPW lppw)
  2663. X{
  2664. X    WNDCLASS wndclass;
  2665. X
  2666. X    wndclass.style = 0;
  2667. X    wndclass.lpfnWndProc = (WNDPROC)WndPauseProc;
  2668. X    wndclass.cbClsExtra = 0;
  2669. X    wndclass.cbWndExtra = sizeof(void FAR *);
  2670. X    wndclass.hInstance = lppw->hInstance;
  2671. X    wndclass.hIcon = NULL;
  2672. X    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
  2673. X    wndclass.hbrBackground = GetStockBrush(WHITE_BRUSH);
  2674. X    wndclass.lpszMenuName = NULL;
  2675. X    wndclass.lpszClassName = szPauseClass;
  2676. X    RegisterClass(&wndclass);
  2677. X}
  2678. X
  2679. X/* PauseBox */
  2680. Xint WDPROC
  2681. XPauseBox(LPPW lppw)
  2682. X{
  2683. X    MSG msg;
  2684. X    HDC hdc;
  2685. X    int width, height;
  2686. X    TEXTMETRIC tm;
  2687. X    RECT rect;
  2688. X
  2689. X    if (!lppw->hPrevInstance)
  2690. X        CreatePauseClass(lppw);
  2691. X    GetWindowRect(GetDesktopWindow(), &rect);
  2692. X    if ( (lppw->Origin.x == CW_USEDEFAULT) || (lppw->Origin.x == 0) )
  2693. X        lppw->Origin.x = (rect.right + rect.left) / 2;
  2694. X    if ( (lppw->Origin.y == CW_USEDEFAULT) || (lppw->Origin.y == 0) )
  2695. X        lppw->Origin.y = (rect.bottom + rect.top) / 2;
  2696. X
  2697. X    hdc = GetDC(NULL);
  2698. X    SelectFont(hdc, GetStockFont(SYSTEM_FIXED_FONT));
  2699. X    GetTextMetrics(hdc, &tm);
  2700. X    width  = max(24,4+_fstrlen(lppw->Message)) * tm.tmAveCharWidth;
  2701. X    width = min(width, rect.right-rect.left);
  2702. X    height = 28 * (tm.tmHeight + tm.tmExternalLeading) / 4;
  2703. X    ReleaseDC(NULL,hdc);
  2704. X
  2705. X    lppw->lpfnPauseButtonProc = 
  2706. X#ifdef __DLL__
  2707. X        (WNDPROC)GetProcAddress(hdllInstance, "PauseButtonProc");
  2708. X#else
  2709. X        (WNDPROC)MakeProcInstance((FARPROC)PauseButtonProc ,hdllInstance);
  2710. X#endif
  2711. X    lppw->hWndPause = CreateWindowEx(WS_EX_DLGMODALFRAME, 
  2712. X        szPauseClass, lppw->Title,
  2713. X        WS_POPUPWINDOW | WS_CAPTION,
  2714. X        lppw->Origin.x - width/2, lppw->Origin.y - height/2,
  2715. X        width, height,
  2716. X        lppw->hWndParent, NULL, lppw->hInstance, lppw);
  2717. X    ShowWindow(lppw->hWndPause, SW_SHOWNORMAL);
  2718. X    BringWindowToTop(lppw->hWndPause);
  2719. X    UpdateWindow(lppw->hWndPause);
  2720. X
  2721. X    lppw->bPause = TRUE;
  2722. X    lppw->bPauseCancel = IDCANCEL;
  2723. X    while (lppw->bPause)
  2724. X            while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
  2725. X            /* wait until window closed */
  2726. X                TranslateMessage(&msg);
  2727. X                DispatchMessage(&msg);
  2728. X            }
  2729. X    DestroyWindow(lppw->hWndPause);
  2730. X#ifndef __DLL__
  2731. X    FreeProcInstance((FARPROC)lppw->lpfnPauseButtonProc);
  2732. X#endif
  2733. X
  2734. X    return(lppw->bPauseCancel);
  2735. X}
  2736. X
  2737. XLRESULT CALLBACK _export
  2738. XWndPauseProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  2739. X{
  2740. X    HDC hdc;
  2741. X    PAINTSTRUCT ps;
  2742. X    RECT rect;
  2743. X    TEXTMETRIC tm;
  2744. X    LPPW lppw;
  2745. X    int cxChar, cyChar, middle;
  2746. X
  2747. X    lppw = (LPPW)GetWindowLong(hwnd, 0);
  2748. X
  2749. X    switch(message) {
  2750. X        case WM_KEYDOWN:
  2751. X            if (wParam == VK_RETURN) {
  2752. X                if (lppw->bDefOK)
  2753. X                    SendMessage(hwnd, WM_COMMAND, IDOK, 0L);
  2754. X                else
  2755. X                    SendMessage(hwnd, WM_COMMAND, IDCANCEL, 0L);
  2756. X            }
  2757. X            return(0);
  2758. X        case WM_COMMAND:
  2759. X            switch(LOWORD(wParam)) {
  2760. X                case IDCANCEL:
  2761. X                case IDOK:
  2762. X                    lppw->bPauseCancel = LOWORD(wParam);
  2763. X                    lppw->bPause = FALSE;
  2764. X                    break;
  2765. X            }
  2766. X            return(0);
  2767. X        case WM_SETFOCUS:
  2768. X            SetFocus(lppw->bDefOK ? lppw->hOK : lppw->hCancel);
  2769. X            return(0);
  2770. X        case WM_PAINT:
  2771. X            {
  2772. X            hdc = BeginPaint(hwnd, &ps);
  2773. X            SelectFont(hdc, GetStockFont(SYSTEM_FIXED_FONT));
  2774. X            SetTextAlign(hdc, TA_CENTER);
  2775. X            GetClientRect(hwnd, &rect);
  2776. X            TextOut(hdc,(rect.right+rect.left)/2, (rect.bottom+rect.top)/6,
  2777. X                lppw->Message,_fstrlen(lppw->Message));
  2778. X            EndPaint(hwnd, &ps);
  2779. X            return 0;
  2780. X            }
  2781. X        case WM_CREATE:
  2782. X            {
  2783. X            HMENU sysmenu = GetSystemMenu(hwnd, FALSE);
  2784. X            lppw = ((CREATESTRUCT FAR *)lParam)->lpCreateParams;
  2785. X            SetWindowLong(hwnd, 0, (LONG)lppw);
  2786. X            lppw->hWndPause = hwnd;
  2787. X            hdc = GetDC(hwnd);
  2788. X            SelectFont(hdc, GetStockFont(SYSTEM_FIXED_FONT));
  2789. X            GetTextMetrics(hdc, &tm);
  2790. X            cxChar = tm.tmAveCharWidth;
  2791. X            cyChar = tm.tmHeight + tm.tmExternalLeading;
  2792. X            ReleaseDC(hwnd,hdc);
  2793. X            middle = ((LPCREATESTRUCT) lParam)->cx / 2;
  2794. X            lppw->hOK = CreateWindow((LPSTR)"button", (LPSTR)"OK",
  2795. X                WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
  2796. X                    middle - 10*cxChar, 3*cyChar,
  2797. X                    8*cxChar, 7*cyChar/4,
  2798. X                    hwnd, (HMENU)IDOK,
  2799. X                    ((LPCREATESTRUCT) lParam)->hInstance, NULL);
  2800. X            lppw->bDefOK = TRUE;
  2801. X            lppw->hCancel = CreateWindow((LPSTR)"button", (LPSTR)"Cancel",
  2802. X                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
  2803. X                    middle + 2*cxChar, 3*cyChar,
  2804. X                    8*cxChar, 7*cyChar/4,
  2805. X                    hwnd, (HMENU)IDCANCEL,
  2806. X                    ((LPCREATESTRUCT) lParam)->hInstance, NULL);
  2807. X            lppw->lpfnOK = (WNDPROC) GetWindowLong(lppw->hOK, GWL_WNDPROC);
  2808. X            SetWindowLong(lppw->hOK, GWL_WNDPROC, (LONG)lppw->lpfnPauseButtonProc);
  2809. X            lppw->lpfnCancel = (WNDPROC) GetWindowLong(lppw->hCancel, GWL_WNDPROC);
  2810. X            SetWindowLong(lppw->hCancel, GWL_WNDPROC, (LONG)lppw->lpfnPauseButtonProc);
  2811. X            if (GetParent(hwnd))
  2812. X                EnableWindow(GetParent(hwnd),FALSE);
  2813. X            DeleteMenu(sysmenu,SC_RESTORE,MF_BYCOMMAND);
  2814. X            DeleteMenu(sysmenu,SC_SIZE,MF_BYCOMMAND);
  2815. X            DeleteMenu(sysmenu,SC_MINIMIZE,MF_BYCOMMAND);
  2816. X            DeleteMenu(sysmenu,SC_MAXIMIZE,MF_BYCOMMAND);
  2817. X            DeleteMenu(sysmenu,SC_TASKLIST,MF_BYCOMMAND);
  2818. X            DeleteMenu(sysmenu,0,MF_BYCOMMAND); /* a separator */
  2819. X            DeleteMenu(sysmenu,0,MF_BYCOMMAND); /* a separator */
  2820. X            }
  2821. X            return 0;
  2822. X        case WM_DESTROY:
  2823. X            GetWindowRect(hwnd, &rect);
  2824. X            lppw->Origin.x = (rect.right+rect.left)/2;
  2825. X            lppw->Origin.y = (rect.bottom+rect.top)/2;
  2826. X            lppw->bPause = FALSE;
  2827. X            if (GetParent(hwnd))
  2828. X                EnableWindow(GetParent(hwnd),TRUE);
  2829. X            break;
  2830. X    }
  2831. X    return DefWindowProc(hwnd, message, wParam, lParam);
  2832. X}
  2833. X
  2834. X
  2835. XLRESULT CALLBACK _export
  2836. XPauseButtonProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  2837. X{
  2838. X    LPPW lppw;
  2839. X#ifdef WIN32
  2840. X    LONG n = GetWindowLong(hwnd, GWL_ID);
  2841. X#else
  2842. X    WORD n = GetWindowWord(hwnd, GWW_ID);
  2843. X#endif
  2844. X    lppw = (LPPW)GetWindowLong(GetParent(hwnd), 0);
  2845. X    switch(message) {
  2846. X        case WM_KEYDOWN:
  2847. X            switch(wParam) {
  2848. X              case VK_TAB:
  2849. X              case VK_BACK:
  2850. X              case VK_LEFT:
  2851. X              case VK_RIGHT:
  2852. X              case VK_UP:
  2853. X              case VK_DOWN:
  2854. X                lppw->bDefOK = !(n == IDOK);
  2855. X                if (lppw->bDefOK) {
  2856. X                    SendMessage(lppw->hOK,     BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE);
  2857. X                    SendMessage(lppw->hCancel, BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE);
  2858. X                    SetFocus(lppw->hOK);
  2859. X                }
  2860. X                else {
  2861. X                    SendMessage(lppw->hOK,     BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE);
  2862. X                    SendMessage(lppw->hCancel, BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE);
  2863. X                    SetFocus(lppw->hCancel);
  2864. X                }
  2865. X                break;
  2866. X              default:
  2867. X                SendMessage(GetParent(hwnd), message, wParam, lParam);
  2868. X            }
  2869. X            break;
  2870. X    }
  2871. X    return CallWindowProc(((n == IDOK) ? lppw->lpfnOK : lppw->lpfnCancel),
  2872. X         hwnd, message, wParam, lParam);
  2873. X}
  2874. END_OF_FILE
  2875.   if test 7827 -ne `wc -c <'gnuplot/win/wpause.c'`; then
  2876.     echo shar: \"'gnuplot/win/wpause.c'\" unpacked with wrong size!
  2877.   fi
  2878.   # end of 'gnuplot/win/wpause.c'
  2879. fi
  2880. echo shar: End of archive 25 \(of 33\).
  2881. cp /dev/null ark25isdone
  2882. MISSING=""
  2883. 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 33 ; do
  2884.     if test ! -f ark${I}isdone ; then
  2885.     MISSING="${MISSING} ${I}"
  2886.     fi
  2887. done
  2888. if test "${MISSING}" = "" ; then
  2889.     echo You have unpacked all 33 archives.
  2890.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2891. else
  2892.     echo You still must unpack the following archives:
  2893.     echo "        " ${MISSING}
  2894. fi
  2895. exit 0
  2896. exit 0 # Just in case...
  2897.