home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume17 / mgr / part38 < prev    next >
Encoding:
Internet Message Format  |  1989-01-19  |  48.2 KB

  1. Subject:  v17i039:  MGR, Bellcore window manager, Part38/61
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Stephen A. Uhler <sau@bellcore.com>
  6. Posting-number: Volume 17, Issue 39
  7. Archive-name: mgr/part38
  8.  
  9.  
  10.  
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 38 (of 61)."
  19. # Contents:  doc/mgr.1 lib/term.h src/blit/blit.C
  20. # Wrapped by rsalz@papaya.bbn.com on Thu Nov 17 21:05:47 1988
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'doc/mgr.1' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'doc/mgr.1'\"
  24. else
  25. echo shar: Extracting \"'doc/mgr.1'\" \(14459 characters\)
  26. sed "s/^X//" >'doc/mgr.1' <<'END_OF_FILE'
  27. X'\"                        Copyright (c) 1988 Bellcore
  28. X'\"                            All Rights Reserved
  29. X'\"       Permission is granted to copy or use this program, EXCEPT that it
  30. X'\"       may not be sold for profit, the copyright notice must be reproduced
  31. X'\"       on copies, and credit should be given to Bellcore where it is due.
  32. X'\"       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  33. X'\"
  34. X'\"    $Header: mgr.1,v 4.5 88/07/18 08:08:00 sau Exp $
  35. X'\"    $Source: /tmp/mgrsrc/doc/RCS/mgr.1,v $
  36. X.ds M \fBM\s-2GR\s+2\fP
  37. X.TH \*M 1L "April 30, 1985"
  38. X.SH NAME
  39. Xmgr \- manage windows on a \fB\s-2SUN\s+2\fP Workstation
  40. X.SH SYNOPSIS
  41. Xmgr
  42. X[ \fB\-f\fP\fIfont_dir\fP ]
  43. X[ \fB\-i\fP\fIicon_dir\fP ]
  44. X[ \fB\-s\fP\fIstartup_file\fP ]
  45. X.if n .ti +0.5i
  46. X[ \fB\-n\fP ]
  47. X[ \fB\-x\fP ]
  48. X[ \fB\-v\fP ]
  49. X[ \fB\-V\fP ]
  50. X[ \fB\-F\fP\fIdefault_font\fP ]
  51. X.ti +0.5i
  52. X{
  53. X[ \fB\-d\fP\fIlist\fP ]
  54. X[ \fB\-m\fP \fImouse_device\fP ]
  55. X[ \fB\-B\fP\fIwindow_buff\fP ]
  56. X[ \fB\-b\fP\fIshell_buff\fP ]
  57. X.if n .ti +0.5i
  58. X[ \fB\-P\fP\fIpoll_interval\fP ]
  59. X.ti +0.5i
  60. X[ \fB\-S\fP\fIscreen\fP ]
  61. X}
  62. X.SH DESCRIPTION
  63. X.I Mgr
  64. Xis a window manager for the \fB\s-2SUN\s+2\fP
  65. Xworkstation.
  66. XIt permits the creation and manipulation of overlapping
  67. Xwindows, with different processes running in each window.
  68. XThe user controls the function and layout of the display with a mouse.
  69. XWindows are updated asynchronously even if they are partially (or
  70. Xcompletely) obscured by other windows,
  71. Xalthough obscured windows may arrange to have their
  72. Xoutput suspended until the window is uncovered.
  73. X.LP
  74. XEach window runs a terminal emulator which, in addition to the functions
  75. Xnormally required to run screen oriented programs, such as
  76. X.I vi,
  77. Xprovides primitives for drawing lines, doing 
  78. X.I bit-blts,
  79. Xand performing administrative functions such as 
  80. X.I reshaping
  81. Xthe window,
  82. Xchanging
  83. X.I fonts,
  84. Xor
  85. Xstarting a new window.
  86. XDetails of of the terminal emulator operation are described in
  87. Xthe \*M - C Language Application Interface.
  88. X.LP
  89. XThe useful command line options are:
  90. X.TP
  91. X.BI \-f font_dir
  92. XUse
  93. X.I font_dir
  94. Xas the directory to find the fonts, instead of
  95. X.B /usr/mgr/font.
  96. X.TP
  97. X.BI \-i icon_dir
  98. XUse
  99. X.I icon_dir
  100. Xas the directory to find the icons, instead of
  101. X.B /usr/mgr/icon.
  102. X.TP
  103. X.BI \-s startup_file
  104. XUse 
  105. X.I startup file
  106. Xinstead of
  107. X.B $HOME/.mgrc
  108. Xto obtain initial configuration information.
  109. XSee the description of startup commands below.
  110. X.TP 
  111. X.B \-n
  112. XBitmap files are created using the new, portable bitmap format.  The
  113. Xportable format has an 8 byte header, and each row is padded to a byte
  114. Xboundary.
  115. XOrdinarily the old (6 byte) bitmap header is
  116. Xproduced, followed by the bitmap data with each line padded to an 16
  117. Xbit boundary.  Eventually, the sense of 
  118. X.B \-n
  119. Xwill change, when all of the programs that were written in the old
  120. Xformat are changed.
  121. X.TP 
  122. X.B \-x
  123. XDon't use a startup file upon execution.
  124. X.TP 
  125. X.B \-v
  126. XDon't run 
  127. X\*M
  128. Xat all.  Print the current version number and creation date instead.
  129. X.TP 
  130. X.B \-V
  131. XJust like
  132. X.B \-v
  133. Xabove only prints the compile flags used to make
  134. X\*M and its home directory.
  135. X.TP
  136. X.BI \-F default_font
  137. XUse
  138. X.I default_font
  139. Xas the pathname of a \*M font to be used in place of \*M's
  140. Xbuiltin default font.
  141. X.LP
  142. XThe rest of the options are:
  143. X.TP 
  144. X.BI \-d list
  145. XPrint debugging information on 
  146. X.I stderr.
  147. X.I list
  148. Xis one or more of the characters:
  149. X.B *ABCEFMNPSUbcdefilmnopsuwxy
  150. Xeach of which turns on debugging output for some aspect of \*M.
  151. X.TP 
  152. X.BI \-m mouse_device
  153. XUse 
  154. X.I mouse_device
  155. Xinstead of
  156. X.B /dev/mouse
  157. Xto obtain mouse coordinates.
  158. X.TP
  159. X.BI \-S screen
  160. XUse
  161. X.I screen
  162. Xinstead of
  163. X.B /dev/bwtwo0
  164. Xas the display device.
  165. X.TP
  166. X.BI \-B win_buff
  167. XProcess characters to a window in up to
  168. X.I win_buff
  169. Xbyte chunks (the default is 40).
  170. X.TP
  171. X.BI \-b shell_buff
  172. XBuffer up to 
  173. X.I shell_buff
  174. Xbytes of output from a program before writing it on a window
  175. X(the default is 256).
  176. X.TP
  177. X.BI \-P poll_interval
  178. XWhen output is pending in a window, wait
  179. X.I poll_interval
  180. Xmicro-seconds on every polling loop to give more
  181. Xprocess time to the processes running in the windows.
  182. XThe default is zero.
  183. X.SS "Startup File Format"
  184. XUpon invocation
  185. X\*M
  186. Xreads commands from the "startup file",
  187. X.B $HOME/.mgrc
  188. X(see 
  189. X.B \-s
  190. Xflag above)
  191. Xto initialize the display.
  192. XCommands are placed one per line with the command arguments separated
  193. Xby spaces or tabs.
  194. XThe following commands are supported:
  195. X.LP
  196. X.TP
  197. X\fBinitcmd\fP \fIcommand\fP [ \fIargs...\fP ]
  198. XThis command line is handed to the shell and executed
  199. Xat the time the startup file is read.
  200. X.TP
  201. X\fBsuspendcmd\fP \fIcommand\fP [ \fIargs...\fP ]
  202. XThis command line is handed to the shell and executed
  203. Xeach time \*M suspends it self,
  204. Xeither due to a main menu selection or the Left-z key.
  205. X.TP
  206. X\fBresumecmd\fP \fIcommand\fP [ \fIargs...\fP ]
  207. XThis command line is handed to the shell and executed
  208. Xeach time \*M resumes after a suspension.
  209. X.TP
  210. X\fBquitcmd\fP \fIcommand\fP [ \fIargs...\fP ]
  211. XThis command line is handed to the shell and executed
  212. Xjust before \*M quits,
  213. Xeither due to a main menu selection or the Left-Q key.
  214. X.TP
  215. X\fBmap\fP \fIn0 n1 n2 n3 n4 n5 n6 n7\fP
  216. XThis changes the meaning of the mouse buttons.
  217. XEach
  218. X.I n[0-7]
  219. Xrepresents one of the 8 states of the three
  220. X.I mouse buttons.
  221. XThe default mapping is: 0 1 2 3 4 5 6 7.
  222. XTo change the meaning of the 
  223. X.I left
  224. Xand
  225. X.I right
  226. Xbuttons, 0 2 4 6 1 3 5 7 would be used.
  227. XIt is possible to map a button out of existence, which may have
  228. Xgrave consequences.
  229. X.TP
  230. X\fBfont\fP \fIfont_number font_name\fP
  231. XThe default font may be overridden by specifying the font
  232. X.I font name
  233. Xwhich is to be substituted for the font at position
  234. X.IR font_number .
  235. XFont numbers
  236. Xare small integers, in the range of 0-99.
  237. XThe
  238. X.IR font_name s
  239. Xare found in the font directory, by default
  240. X.BR /usr/mgr/font .
  241. XSee the
  242. X.B \-f
  243. Xflag above.
  244. X.TP
  245. X\fBwindow\fP \fIx y wide high\fP [ \fIfont_number\fP ]
  246. XA window is created whose corner is at the coordinates
  247. X.I (x, y)
  248. Xand whose size is
  249. X.I (wide, high).
  250. XUnits are in pixels, with 
  251. X.I x
  252. Xand
  253. X.I y
  254. Xincreasing to the 
  255. X.I right
  256. Xand
  257. X.I
  258. Xdown
  259. Xrespectively.
  260. X.I Wide
  261. Xand
  262. X.I high
  263. Xcan be set in terms of characters in the current font by appending
  264. Xthe letter "c" to the value.
  265. XIf
  266. X.I x
  267. Xand
  268. X.I y
  269. Xare
  270. X.BR \-1 ,
  271. Xthen they are replaced by values that causes new windows to
  272. X"tile" across the screen.
  273. XSetting
  274. X.I wide
  275. Xand
  276. X.I high
  277. Xto
  278. X.B \-1
  279. Xis identical to setting them to "80c" and "24c" respectively.
  280. XThe scope of the
  281. X.B window
  282. Xcommand continues until either another 
  283. X.B window
  284. Xcommand or
  285. X.B done
  286. Xis reached.
  287. XThe rest of the options,
  288. X.B shell, start, init,
  289. X.B flags,
  290. Xand
  291. X.B newwindow
  292. Xapply only to the current
  293. X.B window
  294. Xcommand.
  295. X.RS
  296. X.TP
  297. X\fBshell\fP \fIcommand\fP [ \fIargs...\fP ]
  298. X.I Command
  299. Xis the name of the command or shell to be started in the window.
  300. XIf
  301. X.I command 
  302. Xis not specified, then the environment variable
  303. X.B $SHELL,
  304. Xor 
  305. X.B /bin/csh
  306. Xis used.
  307. X.TP
  308. X\fBstart\fP \fIcommand\fP
  309. XThe
  310. X.I command 
  311. Xis sent to the 
  312. X.I shell
  313. Xupon startup, as if it had
  314. Xbeen typed at the keyboard.
  315. X.TP
  316. X\fBinit\fP \fIinitial_string\fP
  317. XThe 
  318. X.I
  319. Xinitial string
  320. Xis sent to the 
  321. X.I window
  322. Xupon startup.
  323. XThe string is terminated by white space, the remainder of the
  324. Xline may be used as a comment.
  325. XThe codes:
  326. X.B \e\e, \eb, \ef \ee, \en, \er, \eMx
  327. Xor
  328. X.B \es
  329. Xmay be used to represent
  330. X.I \e, backspace formfeed, escape, newline, return, x|0200,
  331. Xor
  332. X.I space
  333. Xrespectively.
  334. X.TP
  335. X\fBflags\fP \fIflag...\fP
  336. XNormally a window self destructs when the original process running in it dies.
  337. Xif
  338. X.B nokill,
  339. Xcurrently the only flag,
  340. Xis specified, the window hangs around until specifically snuffed by
  341. Xthe user.
  342. X.TP
  343. X.B newwindow
  344. XThe current window specification is not to be used to initialize the display,
  345. Xbut instead will be used when
  346. X.B "Left n"
  347. Xor
  348. X.B "Right n"
  349. Xto create a new window.
  350. X.RE
  351. X.TP
  352. X.B done
  353. X.B done
  354. Xmust be the last line in the startup file if any
  355. X.B window
  356. Xcommands are specified, or the last
  357. X.B window
  358. Xcommand will not take affect.
  359. X.SS "Using The Mouse"
  360. XUser interaction with 
  361. X\*M
  362. Xis with the mouse.
  363. XMoving the mouse causes a corresponding movement of the 
  364. X.I mouse cursor,
  365. Xusually an arrow pointing to the upper left.
  366. XThe
  367. X.I left
  368. Xor
  369. X.I command button
  370. Xof mouse activates a
  371. X.I menu
  372. Xwhose options depend upon the current mouse position.
  373. XAn option is chosen by moving the mouse vertically while the
  374. X.I command
  375. Xbutton is depressed, releasing the button when the appropriate
  376. Xselection is highlighted.
  377. X.LP
  378. XWhen the mouse is over the background pattern, or at the extreme
  379. Xleft edge of the screen, the
  380. X.I command menu 
  381. Xis activated by the 
  382. Xmouse.
  383. XThe
  384. X.I command
  385. Xmenu options are:
  386. X.TP 12
  387. X.B new window
  388. XA new window is created by moving the the mouse cursor
  389. X(now a box) to the upper left corner of the window, depressing
  390. Xthe
  391. X.I command button,
  392. Xsweeping out the window, then releasing the
  393. X.I command button.
  394. XThe new window, if it is big enough, is started with a shell
  395. Xrunning in it.
  396. X.TP 12
  397. X.B redraw
  398. XThe background and windows are redrawn.
  399. XThis is useful if a process unknown to
  400. X\*M
  401. Xscribbles on the display.
  402. XIt is left to the processing running in a window to fix the contents
  403. Xof its window.
  404. X.TP 12
  405. X.B quit
  406. X\*M
  407. Xis terminated, after the
  408. X.I quit
  409. Xis confirmed.
  410. XAlternately,
  411. X\*M
  412. Xmay be suspended (ala
  413. X.B ^Z 
  414. Xin
  415. X.B csh
  416. X).
  417. X.LP
  418. XWhen the mouse is over the 
  419. X.I active
  420. Xwindow, the fat bordered window the keyboard is connected to,
  421. Xthe 
  422. X.I window menu
  423. Xis activated by depressing the
  424. X.I command button.
  425. XThe
  426. X.I window
  427. Xmenu options are:
  428. X.TP 12
  429. X.B reshape
  430. X.I Reshape
  431. Xreshapes the 
  432. X.I active
  433. Xwindow, using a procedure similar to
  434. X.I new window
  435. Xabove.
  436. X.TP 12
  437. X.B move
  438. XAn outline of the current window
  439. Xis moved along with the mouse until the
  440. X.I command button
  441. Xis depressed and released.
  442. XThe current window is then moved to the new location.
  443. X.TP 12
  444. X.B bury
  445. XThe current window is made inactive.
  446. XAnother window (if any) becomes the
  447. X.I active
  448. Xwindow.
  449. X.TP 12
  450. X.B cut
  451. XThe mouse may be used to sweep out and save text 
  452. Xfrom the current window into a global buffer.
  453. XA small scissors appears as the mouse cursor.
  454. XPosition the upper left corner of the scissors with the upper left
  455. Xcorner of the first character to be saved, then push one of the
  456. Xmouse buttons, moving the mouse to sweep out the desired text.
  457. XReleasing the button causes the outlined text to be saved.
  458. XUsing the 
  459. X.I command button
  460. Xwith 
  461. X.I cut
  462. Xcauses the current contents of the global buffer (if any) to be
  463. Xreplaced by the indicated text.
  464. XEither of the other two buttons causes the indicated text to be appended
  465. Xto the global buffer.
  466. X.IP
  467. XThe
  468. X.I cut
  469. Xfacility currently works only for windows containing a single font, aligned
  470. Xon the default character boundaries.  Applications which use only
  471. Xthe terminal emulator sub-set of
  472. X.I MGR
  473. Xcapabilities, such as the
  474. X.I shell,
  475. X.I mail, 
  476. Xand
  477. X.I editors
  478. Xautomatically meet this restriction.
  479. XCuttability may be restored by issuing a 
  480. X.I clear
  481. X(i.e. form feed)
  482. Xto the window.
  483. XThe window flashes and beeps if the 
  484. X.I cut
  485. Xoperation could not be completed,
  486. Xusually the result of corrupted data in the window.  In such cases,
  487. Xno text is saved.
  488. XSee 
  489. X\*M - C Language Application Interface
  490. Xfor a detailed description of the various 
  491. X.I cut
  492. Xoption settings.
  493. X.TP 12
  494. X.B paste
  495. XThe contents of the global buffer (if any) are inserted into the input
  496. Xstream of the current window.  The global buffer is filled using 
  497. X.B cut
  498. Xabove, or under program control.
  499. X.TP 12
  500. X.B destroy
  501. XAll processes associated with the current window are sent
  502. Xa
  503. X.I  hangup
  504. Xsignal, and the window is destroyed.
  505. X.LP
  506. XWhen the mouse is clicked on any window except the
  507. X.I active
  508. Xwindow, that window moves to the
  509. X.I front
  510. Xand becomes the
  511. X.I active 
  512. Xwindow.
  513. X.SS "Using The Left and Right Keys"
  514. XWhen
  515. X\*M
  516. Xis invoked from the console keyboard,
  517. Xmany of the system menu functions have keyboard equivalents.
  518. XSome of the more interesting ones are
  519. Xactivated by holding down the
  520. X.B Left
  521. Xor
  522. X.B Right
  523. Xkeys, and then pressing:
  524. X.TP 6
  525. Xspace bar
  526. Xto activate the previous window
  527. X.TP 6
  528. XBack Space
  529. Xto activate the bottom window
  530. X.TP 6
  531. Xc
  532. Xto initiate a 
  533. X.I cut-text
  534. Xoperation
  535. X.TP 6
  536. Xp
  537. Xto initiate a 
  538. X.I paste
  539. Xoperation
  540. X.TP 6
  541. Xh
  542. Xhide the top window on the bottom
  543. X.TP 6
  544. Xl
  545. Xto clear the active window
  546. X.TP 6
  547. Xm
  548. Xinitiate a
  549. X.I cut-text
  550. Xoperation which will automatically cause a
  551. X.I paste
  552. Xoperation when completed
  553. X.TP 6
  554. Xn
  555. Xto start a new window, 80 x 24 characters (if it will fit),
  556. Xplaced in the "tile" position of its window-set ID
  557. X.TP 6
  558. XN
  559. Xstart a new window by sweeping with the mouse
  560. X.TP 6
  561. XQ
  562. Xto exit
  563. X\*M
  564. Xquickly
  565. X.TP 6
  566. X1\-9
  567. Xto activate the window with window-set ID 1 through 9
  568. X.TP 6
  569. X0
  570. Xactivates the window with window-set ID 10,
  571. Xa synonym for w10<Return>
  572. X.TP 6
  573. Xw\fInumber\fP<Return>
  574. Xactivate the window with window-set ID
  575. X.I number
  576. X.TP 6
  577. Xr
  578. Xto redraw the windows
  579. X.TP 6
  580. XR
  581. Xto redraw the windows
  582. X.TP 6
  583. X.TP 6
  584. Xz
  585. Xto suspend 
  586. X\*M
  587. X.LP
  588. XThere are other characters that cause \*M to display debugging information
  589. Xwhich may disrupt the screen; they are
  590. Xi,
  591. XI,
  592. XM,
  593. X+,
  594. X-,
  595. X#,
  596. Xand
  597. X?.
  598. XUse "redraw", either from the command menu on the mouse or "right r"
  599. Xto restore the screen display.
  600. X.LP
  601. XThe environment variable
  602. X.B \s-2DEFAULT_FONT\s+2
  603. Xmay be assigned the full path name of a
  604. X\*M
  605. Xfont,
  606. Xwhich will then replace
  607. X\*M's
  608. Xbuilt in default font.
  609. X.SH FILES
  610. X.TP 20
  611. X.B /dev/mouse
  612. Xplace to obtain mouse coordinates.
  613. X.TP 20
  614. X.B /dev/bwtwo0
  615. Xname of the display.
  616. X.TP 20
  617. X.B /usr/mgr/icon
  618. Xplace to find 
  619. X\*M
  620. Xicons.
  621. X.TP 20
  622. X.B /usr/mgr/font
  623. Xplace to find 
  624. X\*M
  625. Xfonts.
  626. X.TP 20
  627. X.B /usr/mgr/font/.mgrc
  628. Xthe global default startup file;
  629. Xdelivered with 15 fonts specified.
  630. X.TP 20
  631. X.B $HOME/.mgrc
  632. Xplace to find startup commands.
  633. X.TP 20
  634. X.B /dev/bell
  635. XFor ringing the bell.
  636. X.TP 20
  637. X.B /dev/[pt]ty[pq]?
  638. XName of the pseudo-tty's.
  639. X.SH SEE ALSO
  640. X\*M - C Language Application Interface
  641. X.br
  642. Xbounce(1L)
  643. Xbrowse(1L)
  644. Xbury(1L)
  645. Xclock(1L)
  646. Xclock2(1L)
  647. Xclose(1L)
  648. Xdmgr(1L)
  649. Xether(1L)
  650. Xfont(1L)
  651. Xiconmail(1L)
  652. Xiconmsgs(1L)
  653. Xloadfont(1L)
  654. Xmaze(1L)
  655. Xmenu(1L)
  656. Xmgr(1L)
  657. Xmgrmail(1L)
  658. Xmgrmsgs(1L)
  659. Xoclose(1L)
  660. Xomgrmail(1L)
  661. Xrotate(1L)
  662. Xset_console(1L)
  663. Xset_termcap(1L)
  664. Xshape(1L)
  665. Xshow(1L)
  666. Xshowfont(1L)
  667. Xsnap(1L)
  668. Xstartup(1L)
  669. Xstat(1L)
  670. Xstringart(1L)
  671. Xtjfilter(1L)
  672. Xwindow_print(1L)
  673. Xzoom(1L)
  674. Xbitmap(5L)
  675. Xfont(5L)
  676. X.SH DIAGNOSTICS
  677. X.TP
  678. XCan't find a frame buffer
  679. XNo display device available.  Make
  680. Xsure 
  681. X.I /dev/bwtwo0
  682. Xexists in 
  683. X.I /dev.
  684. X.TP
  685. XCan't find a mouse, or it is already in use
  686. X\*M
  687. Xmust have exclusive control of the mouse.
  688. X.TP
  689. XInternal \*M error 
  690. Xeverything else.
  691. X.SH BUGS
  692. X.TP 3
  693. X*
  694. XA separate application program,
  695. Xset_console(1L)
  696. Xis required to prevent others from scribbling on 
  697. X.B /dev/console
  698. Xand messing up the display.
  699. X.TP 3
  700. X*
  701. XAs 
  702. X\*M
  703. Xrequires exclusive control of the mouse, 
  704. Xit may not be invoked from within itself.
  705. X.TP 3
  706. X*
  707. XOnly fixed-width fonts are supported.
  708. X.SH AUTHOR
  709. XStephen A. Uhler
  710. END_OF_FILE
  711. # end of 'doc/mgr.1'
  712. fi
  713. if test -f 'lib/term.h' -a "${1}" != "-c" ; then 
  714.   echo shar: Will not clobber existing file \"'lib/term.h'\"
  715. else
  716. echo shar: Extracting \"'lib/term.h'\" \(15350 characters\)
  717. sed "s/^X//" >'lib/term.h' <<'END_OF_FILE'
  718. X/*                        Copyright (c) 1987 Bellcore
  719. X *                            All Rights Reserved
  720. X *       Permission is granted to copy or use this program, EXCEPT that it
  721. X *       may not be sold for profit, the copyright notice must be reproduced
  722. X *       on copies, and credit should be given to Bellcore where it is due.
  723. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  724. X */
  725. X/*    $Header: term.h,v 4.6 88/08/18 10:17:05 sau Exp $
  726. X    $Source: /tmp/mgrsrc/lib/RCS/term.h,v $
  727. X*/
  728. Xstatic char    h_term_[] = "$Source: /tmp/mgrsrc/lib/RCS/term.h,v $$Revision: 4.6 $";
  729. X
  730. X/* macros for writing to mgr terminal emulator */
  731. X
  732. X#ifndef _TERM_INCL
  733. X#define _TERM_INCL
  734. X
  735. X#include "window.h"
  736. X
  737. X#ifndef stderr
  738. X#include <stdio.h>
  739. X#endif
  740. X#ifndef ECHO
  741. X#include <sgtty.h>
  742. X#endif
  743. X
  744. X#define TTYMAX        10    /* stack size for ttyset() */
  745. X
  746. X#define M_FLUSH        0x1    /* autoflush output after each write */
  747. X#define M_DEBUG        0x2    /* use stderr instead of /dev/tty mgr i/o */
  748. X#define M_MODEOK    0x4    /* assume tty modes are always ok */
  749. X
  750. X#ifndef M_DEVICEIN
  751. X#define M_DEVICEIN    "/dev/tty"
  752. X#endif
  753. X
  754. X#ifndef M_DEVICEOUT
  755. X#define M_DEVICEOUT    "/dev/tty"
  756. X#endif
  757. X
  758. X
  759. X#define m_flush()        fflush(m_termout)
  760. X
  761. X#define BTWN(a,x,b)    \
  762. X    ((x)<(a)?a:(x)>(b)?b:x)
  763. X#define LIMIT(x)    BTWN(0,x,1152)
  764. X
  765. X#ifndef M_NOFLUSH
  766. X#define _m_flsh        ,(m_flags&M_FLUSH?m_flush():m_flags)
  767. X#else
  768. X#define _m_flsh
  769. X#endif
  770. X
  771. X/* vi-like stuff */
  772. X
  773. X#define m_addline() \
  774. X    (fprintf(m_termout,"%c%c",m_escchar,E_ADDLINE)_m_flsh)
  775. X
  776. X#define m_addlines(n) \
  777. X    (fprintf(m_termout,"%c%d%c",m_escchar,n,E_ADDLINE)_m_flsh)
  778. X
  779. X#define m_addchar() \
  780. X    (fprintf(m_termout,"%c%c",m_escchar,E_ADDCHAR)_m_flsh)
  781. X
  782. X#define m_addchars(n) \
  783. X    (fprintf(m_termout,"%c%d%c",m_escchar,n,E_ADDCHAR)_m_flsh)
  784. X
  785. X#define m_deleteline() \
  786. X    (fprintf(m_termout,"%c%c",m_escchar,E_DELETELINE)_m_flsh)
  787. X
  788. X#define m_deletelines(n) \
  789. X    (fprintf(m_termout,"%c%d%c",m_escchar,n,E_DELETELINE)_m_flsh)
  790. X
  791. X#define m_deletechar() \
  792. X    (fprintf(m_termout,"%c%c",m_escchar,E_DELETECHAR)_m_flsh)
  793. X
  794. X#define m_deletechars(n) \
  795. X    (fprintf(m_termout,"%c%d%c",m_escchar,n,E_DELETECHAR)_m_flsh)
  796. X
  797. X#define m_standend() \
  798. X    (fprintf(m_termout,"%c%c",m_escchar,E_STANDEND)_m_flsh)
  799. X
  800. X#define m_standout() \
  801. X    (fprintf(m_termout,"%c%c",m_escchar,E_STANDOUT)_m_flsh)
  802. X
  803. X#define m_bell() \
  804. X    (fprintf(m_termout,"\007")_m_flsh)
  805. X
  806. X#define m_setcursor(n) \
  807. X    (fprintf(m_termout,"%c%d%c",m_escchar,n,E_SETCURSOR)_m_flsh)
  808. X
  809. X/* lines */
  810. X
  811. X/*
  812. X#define m_line(x0,y0,x1,y1) \
  813. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c",m_escchar, \
  814. X    LIMIT(x0),LIMIT(y0),LIMIT(x1),LIMIT(y1),E_LINE)_m_flsh)
  815. X*/
  816. X
  817. X#define m_line(x0,y0,x1,y1) \
  818. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c",m_escchar, \
  819. X    x0,y0,x1,y1,E_LINE)_m_flsh)
  820. X
  821. X#define m_lineto(to,x0,y0,x1,y1) \
  822. X    (fprintf(m_termout,"%c%d,%d,%d,%d,%d%c",m_escchar, \
  823. X    x0,y0,x1,y1,to,E_LINE)_m_flsh)
  824. X
  825. X#define m_draw(x,y) \
  826. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar, \
  827. X    LIMIT(x),LIMIT(y),E_LINE)_m_flsh)
  828. X
  829. X#define m_fastdraw(x,y,count,buff) \
  830. X    (fprintf(m_termout,"%c%d,%d,%d%c",m_escchar, \
  831. X    LIMIT(x),LIMIT(y),count,E_GRUNCH), \
  832. X    fwrite(buff,1,count,m_termout)_m_flsh)
  833. X
  834. X#define m_rfastdraw(count,buff) \
  835. X    (fprintf(m_termout,"%c%d%c",m_escchar, \
  836. X    count,E_GRUNCH), \
  837. X    fwrite(buff,1,count,m_termout)_m_flsh)
  838. X
  839. X#define m_aligntext() \
  840. X    (fprintf(m_termout,"%c%c",m_escchar, \
  841. X    E_LINE)_m_flsh)
  842. X
  843. X#define m_gotext() \
  844. X    (fprintf(m_termout,"%c%c",m_escchar, \
  845. X    E_GO)_m_flsh)
  846. X
  847. X#define m_go(x,y) \
  848. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar, \
  849. X    LIMIT(x),LIMIT(y),E_GO)_m_flsh)
  850. X
  851. X/* bitblits */
  852. X
  853. X#define m_clear() \
  854. X    (fprintf(m_termout,"%c",C_FF)_m_flsh)
  855. X
  856. X#define m_func(func)\
  857. X    (fprintf(m_termout,"%c%d%c",m_escchar,func,E_BITBLT)_m_flsh)
  858. X
  859. X#define m_bitwrite(x,y,w,h) \
  860. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c",m_escchar,x,y,w,h,E_BITBLT)_m_flsh)
  861. X
  862. X#define m_bitwriteto(x,y,w,h,to) \
  863. X    (fprintf(m_termout,"%c%d,%d,%d,%d,%d%c", \
  864. X    m_escchar,x,y,w,h,to,E_BITBLT)_m_flsh)
  865. X
  866. X#define m_bitcopy(xd,yd,w,h,xs,ys) \
  867. X    (fprintf(m_termout,"%c%d,%d,%d,%d,%d,%d%c", \
  868. X    m_escchar,xd,yd,w,h,xs,ys,E_BITBLT)_m_flsh)
  869. X
  870. X#define m_bitcopyto(xd,yd,w,h,xs,ys,to,from) \
  871. X    (fprintf(m_termout,"%c%d,%d,%d,%d,%d,%d,%d,%d%c", \
  872. X    m_escchar,xd,yd,w,h,xs,ys,to,from,E_BITBLT)_m_flsh)
  873. X
  874. X#define m_bitld(w,h,x,y,size) \
  875. X    (fprintf(m_termout,"%c%d,%d,%d,%d,%d%c",\
  876. X    m_escchar,w,h,x,y,size,E_BITLOAD),m_flush())
  877. X
  878. X#define m_bitldto(w,h,x,y,to,size) \
  879. X    (fprintf(m_termout,"%c%d,%d,%d,%d,%d,%d%c",\
  880. X    m_escchar,w,h,x,y,to,size,E_BITLOAD),m_flush())
  881. X
  882. X#define m_bitdestroy(n) \
  883. X    (fprintf(m_termout,"%c%d%c",\
  884. X    m_escchar,n,E_BITCRT),m_flush())
  885. X
  886. X#define m_bitcreate(n,w,h) \
  887. X    (fprintf(m_termout,"%c%d,%d,%d%c",\
  888. X    m_escchar,n,w,h,E_BITCRT),m_flush())
  889. X
  890. X#define m_bitget(from,size,offset) \
  891. X    (fprintf(m_termout,"%c%d,%d,%d%c",\
  892. X    m_escchar,from,size,offset,E_BITGET),m_flush())
  893. X#define m_othersave(id,sub,name) \
  894. X    (fprintf(m_termout,"%c%d,%d,%d%c%s",\
  895. X    m_escchar,id,sub,strlen(name),E_SMAP,name)_m_flsh)
  896. X#define m_windowsave(name) \
  897. X    (fprintf(m_termout,"%c%d%c%s",\
  898. X    m_escchar,strlen(name),E_SMAP,name)_m_flsh)
  899. X#define m_bitsave(from,name) \
  900. X    (fprintf(m_termout,"%c%d,%d%c%s",\
  901. X    m_escchar,from,strlen(name),E_SMAP,name)_m_flsh)
  902. X#define m_bitfromfile(to,name) \
  903. X    (fprintf(m_termout,"%c%d,%d%c%s",\
  904. X    m_escchar,to,strlen(name),E_GMAP,name)_m_flsh)
  905. X#define m_highlight(x,y,w,h) \
  906. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c",\
  907. X    m_escchar,x,y,w,h,E_BLEEP),m_flush())
  908. X#define m_stringto(to,x,y,text) \
  909. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c%s",\
  910. X    m_escchar,to,x,y,strlen(text),E_STRING,text)_m_flsh)
  911. X
  912. X/* other graphic functions */
  913. X
  914. X#define m_circle(x,y,r) \
  915. X    (fprintf(m_termout,"%c%d,%d,%d%c",m_escchar, \
  916. X    LIMIT(x),LIMIT(y),LIMIT(r),E_CIRCLE)_m_flsh)
  917. X
  918. X#define m_ellipse(x,y,r1,r2) \
  919. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c",m_escchar, \
  920. X    LIMIT(x),LIMIT(y),LIMIT(r1),LIMIT(r2),E_CIRCLE)_m_flsh)
  921. X
  922. X#define m_arc(x,y,x1,y1,x2,y2) \
  923. X    (fprintf(m_termout,"%c%d,%d,%d,%d,%d,%d%c",m_escchar, \
  924. X    LIMIT(x),LIMIT(y),LIMIT(x1),LIMIT(y1),LIMIT(x2),LIMIT(y2), \
  925. X    E_CIRCLE)_m_flsh)
  926. X
  927. X#define m_ellipseto(to,x,y,r1,r2) \
  928. X    (fprintf(m_termout,"%c%d,%d,%d,%d,%d%c",m_escchar, \
  929. X    LIMIT(x),LIMIT(y),LIMIT(r1),LIMIT(r2),to,E_CIRCLE)_m_flsh)
  930. X
  931. X#define m_rcircle(r) \
  932. X    (fprintf(m_termout,"%c%d%c",m_escchar, \
  933. X    LIMIT(r),E_CIRCLE)_m_flsh)
  934. X
  935. X#define m_rellipse(r1,r2) \
  936. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar, \
  937. X    LIMIT(r1),LIMIT(r2),E_CIRCLE)_m_flsh)
  938. X
  939. X
  940. X#define m_movemouse(x,y) \
  941. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,x,y,E_MOUSE)_m_flsh)
  942. X
  943. X#define m_movecursor(x,y) \
  944. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,x,y,E_MOVE)_m_flsh)
  945. X
  946. X#define m_move(col,row) \
  947. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,col,row,E_CUP)_m_flsh)
  948. X
  949. X#define m_moveprint(x,y,str) \
  950. X    (fprintf(m_termout,"%c%d,%d%c%s",m_escchar,x,y,E_MOVE,str)_m_flsh)
  951. X
  952. X#define m_incr(x) \
  953. X    (fprintf(m_termout,"%c%d%c",m_escchar,x,E_MOVE)_m_flsh)
  954. X
  955. X#define m_cleareol() \
  956. X    (fprintf(m_termout,"%c%c",m_escchar,E_CLEAREOL)_m_flsh)
  957. X
  958. X#define m_cleareos() \
  959. X    (fprintf(m_termout,"%c%c",m_escchar,E_CLEAREOS)_m_flsh)
  960. X
  961. X/* window manipulation */
  962. X
  963. X#define m_movewindow(x,y) \
  964. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,x,y,E_SHAPE)_m_flsh)
  965. X
  966. X#define m_shapewindow(x,y,dx,dy) \
  967. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c",m_escchar,x,y,dx,dy,E_SHAPE)_m_flsh)
  968. X
  969. X#define m_font(x) \
  970. X    (fprintf(m_termout,"%c%d%c",m_escchar,x,E_FONT)_m_flsh)
  971. X
  972. X#define m_loadfont(n,name) \
  973. X    (fprintf(m_termout,"%c%d,%d%c%s", \
  974. X    m_escchar,n,strlen(name),E_FONT,name)_m_flsh)
  975. X
  976. X#define m_size(cols,rows) \
  977. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,cols,rows,E_SIZE)_m_flsh)
  978. X
  979. X#define m_sizeall(x,y,cols,rows) \
  980. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c", \
  981. X         m_escchar,x,y,cols,rows,E_SIZE)_m_flsh)
  982. X
  983. X#define m_scrollregion(first,last) \
  984. X    (fprintf(m_termout,"%c%d,%d%c", \
  985. X    m_escchar,first,last,E_TEXTREGION)_m_flsh)
  986. X
  987. X#define m_textregion(x,y,wide,high) \
  988. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c", \
  989. X    m_escchar,x,y,wide,high,E_TEXTREGION)_m_flsh)
  990. X
  991. X#define m_textreset() \
  992. X    (fprintf(m_termout,"%c%c",m_escchar,E_TEXTREGION)_m_flsh)
  993. X
  994. X/* window creation/ destruction */
  995. X
  996. X#define m_newwin(x,y,w,h) \
  997. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c",m_escchar,x,y,w,h,E_MAKEWIN)_m_flsh)
  998. X
  999. X#define m_destroywin(n) \
  1000. X    (fprintf(m_termout,"%c%d,0%c",m_escchar,n,E_MAKEWIN)_m_flsh)
  1001. X
  1002. X#define m_selectwin(n) \
  1003. X    (fprintf(m_termout,"%c%d%c",m_escchar,n,E_MAKEWIN)_m_flsh)
  1004. X
  1005. X/* events */
  1006. X
  1007. X#define m_setevent(event,x) \
  1008. X    (fprintf(m_termout,"%c%d,%d%c%s", \
  1009. X    m_escchar,_mapevent(event),strlen(x),E_EVENT,x)_m_flsh)
  1010. X
  1011. X#define m_clearevent(event) \
  1012. X    (fprintf(m_termout,"%c%d%c", \
  1013. X    m_escchar,_mapevent(event),E_EVENT)_m_flsh)
  1014. X
  1015. X/* message passing */
  1016. X
  1017. X#define m_sendme(str) \
  1018. X    (fprintf(m_termout,"%c%d%c%s", \
  1019. X    m_escchar,strlen(str),E_GIMME,str)_m_flsh)
  1020. X
  1021. X#define m_sendto(pid,str) \
  1022. X    (fprintf(m_termout,"%c%d,%d%c%s", \
  1023. X    m_escchar,pid,strlen(str),E_SEND,str)_m_flsh)
  1024. X
  1025. X#define m_broadcast(str) \
  1026. X    (fprintf(m_termout,"%c%d%c%s", \
  1027. X    m_escchar,strlen(str),E_SEND,str)_m_flsh)
  1028. X
  1029. X#define m_snarf(str) \
  1030. X    (fprintf(m_termout,"%c%d%c%s", \
  1031. X    m_escchar,strlen(str),E_SNARF,str)_m_flsh)
  1032. X
  1033. X#define m_put() \
  1034. X    (fprintf(m_termout,"%c%c", \
  1035. X    m_escchar,E_PUTSNARF)_m_flsh)
  1036. X
  1037. X/* environment stacking */
  1038. X
  1039. X#define m_push(mode) \
  1040. X    (m_envcount++, \
  1041. X         fprintf(m_termout,"%c%d%c",m_escchar,(mode)|P_CLEAR,E_PUSH) \
  1042. X         _m_flsh)
  1043. X
  1044. X#define m_pushsave(mode) \
  1045. X    (m_envcount++, \
  1046. X    fprintf(m_termout,"%c%d%c",m_escchar,(mode),E_PUSH)_m_flsh)
  1047. X
  1048. X#define m_pop() \
  1049. X    (m_envcount?m_envcount--:0, \
  1050. X         fprintf(m_termout,"%c%c",m_escchar,E_POP)_m_flsh)
  1051. X
  1052. X#define m_popall() \
  1053. X    while(m_envcount--) \
  1054. X         (fprintf(m_termout,"%c%c",m_escchar,E_POP)_m_flsh)
  1055. X
  1056. X/* tty mode settings */
  1057. X
  1058. X#define m_setraw() \
  1059. X    m_setflags(RAW)
  1060. X
  1061. X#define m_setnoraw() \
  1062. X    m_resetflags(RAW)
  1063. X#define m_unsetraw    m_setnoraw        /* obsolete */
  1064. X
  1065. X#define m_setecho()     \
  1066. X        m_setflags(ECHO)
  1067. X
  1068. X#define m_setnoecho() \
  1069. X        m_resetflags(ECHO)
  1070. X
  1071. X/* other stuff */
  1072. X
  1073. X#define m_setmode(mode) \
  1074. X    (fprintf(m_termout,"%c%d%c",m_escchar,mode,E_SETMODE)_m_flsh)
  1075. X
  1076. X#define m_dupkey(key) \
  1077. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,M_DUPKEY,key,E_SETMODE)_m_flsh)
  1078. X
  1079. X#define m_clearmode(mode) \
  1080. X    (fprintf(m_termout,"%c%d%c",m_escchar,mode,E_CLEARMODE)_m_flsh)
  1081. X
  1082. X#define m_getinfo(x) \
  1083. X    (fprintf(m_termout,"%c%d%c",m_escchar,x,E_GETINFO),m_flush())
  1084. X
  1085. X#define m_whatsat(x,y) \
  1086. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,x,y,E_GETINFO),m_flush())
  1087. X
  1088. X#define m_get()\
  1089. X    (m_flush(),fgets(m_linebuf,sizeof(m_linebuf),m_termin))
  1090. X
  1091. X#define m_getchar()\
  1092. X    (getc(m_termin))
  1093. X
  1094. X#define m_gets(buff)\
  1095. X    (m_flush(),fgets(buff,sizeof(buff),m_termin))
  1096. X
  1097. X#define m_putchar(c) \
  1098. X    (putc(c,m_termout)_m_flsh)
  1099. X
  1100. X#define m_printstr(str) \
  1101. X    (fprintf(m_termout,"%s",str)_m_flsh)
  1102. X
  1103. X#define m_setesc(x) \
  1104. X    (m_escchar = (x))
  1105. X
  1106. X#define m_resetesc() \
  1107. X    (m_escchar = ESC)
  1108. X
  1109. X#define m_sleep() \
  1110. X    (fprintf(m_termout,"%c%c",m_escchar,E_NULL)_m_flsh)
  1111. X
  1112. X/* menu stuff */
  1113. X
  1114. X#ifndef M_DELIM
  1115. X#define M_DELIM    '\005'        /* menu delimiter character */
  1116. X#endif
  1117. X
  1118. X#define m_selectmenu(n) \
  1119. X    (fprintf(m_termout,"%c%d%c",m_escchar,n,E_MENU)_m_flsh)
  1120. X
  1121. X#define m_selectmenu2(n) \
  1122. X    (fprintf(m_termout,"%c-%d%c",m_escchar,n,E_MENU)_m_flsh)
  1123. X
  1124. X#define m_nomenu() \
  1125. X    (fprintf(m_termout,"%c%d%c",m_escchar,999,E_MENU)_m_flsh)
  1126. X
  1127. X#define m_nomenu2() \
  1128. X    (fprintf(m_termout,"%c-%d%c",m_escchar,999,E_MENU)_m_flsh)
  1129. X
  1130. X#define m_loadmenu(n,str) \
  1131. X    (fprintf(m_termout,"%c%d,%d%c%s",m_escchar,n,strlen(str),E_MENU,str)_m_flsh)
  1132. X
  1133. X#define m_clearmenu(n) \
  1134. X    (fprintf(m_termout,"%c%d,0%c",m_escchar,n,E_MENU)_m_flsh)
  1135. X
  1136. X#define m_linkmenu(parent,item,child,flags) \
  1137. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c", \
  1138. X    m_escchar,parent,item,child,flags,E_MENU)_m_flsh)
  1139. X
  1140. X#define m_unlinkmenu(parent,item) \
  1141. X    (fprintf(m_termout,"%c%d,%d,%d,%c", \
  1142. X    m_escchar,parent,item,-1,E_MENU)_m_flsh)
  1143. X
  1144. X#define m_pagemenu(parent,child) \
  1145. X    (fprintf(m_termout,"%c%d,%d,%d,%c", \
  1146. X    m_escchar,parent,-1,child,E_MENU)_m_flsh)
  1147. X
  1148. X#define m_unpagemenu(parent) \
  1149. X    (fprintf(m_termout,"%c%d,%d,%d,%c", \
  1150. X    m_escchar,parent,-1,-1,E_MENU)_m_flsh)
  1151. X
  1152. X/* temporary menu stuff */
  1153. X
  1154. X#define m_menuitem(menu,item) \
  1155. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,menu,item,E_FOO)_m_flsh)
  1156. X
  1157. X#define m_menuerase(menu) \
  1158. X    (fprintf(m_termout,"%c%d%c",m_escchar,menu,E_FOO)_m_flsh)
  1159. X
  1160. X#define m_menushow(x,y,menu) \
  1161. X    (fprintf(m_termout,"%c%d,%d,%d%c",m_escchar,x,y,menu,E_FOO)_m_flsh)
  1162. X
  1163. X#define m_menubar(x,y,menu,item) \
  1164. X    (fprintf(m_termout,"%c%d,%d,%d,%d%c",m_escchar,x,y,menu,item,E_FOO)_m_flsh)
  1165. X
  1166. X/* temporary relative character motion */
  1167. X
  1168. X#define m_right(tenths) \
  1169. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,tenths,10,E_RIGHT)_m_flsh)
  1170. X
  1171. X#define m_left(tenths) \
  1172. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,tenths,-10,E_RIGHT)_m_flsh)
  1173. X
  1174. X#define m_up(tenths) \
  1175. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,tenths,10,E_UP)_m_flsh)
  1176. X
  1177. X#define m_down(tenths) \
  1178. X    (fprintf(m_termout,"%c%d,%d%c",m_escchar,tenths,10,E_DOWN)_m_flsh)
  1179. X
  1180. X/* color stuff */
  1181. X
  1182. X#define m_fcolor(color) \
  1183. X        (fprintf(m_termout,"%c%d%c",m_escchar,color,E_FCOLOR)_m_flsh)
  1184. X#define m_bcolor(color) \
  1185. X        (fprintf(m_termout,"%c%d%c",m_escchar,color,E_BCOLOR)_m_flsh)
  1186. X#define m_linecolor(op,color) \
  1187. X        (fprintf(m_termout,"%c%d,%d%c",m_escchar,op,color,E_BITBLT)_m_flsh)
  1188. X
  1189. X#define _mapevent(z)                ((z)==3||(z)==4?2-(z):z)
  1190. X
  1191. X/* events */
  1192. X
  1193. X#define BUTTON_1        1        /* end button depressed */
  1194. X#define BUTTON_2        2        /* middle button depressed */
  1195. X#define BUTTON_1U        3        /* end button released */
  1196. X#define BUTTON_2U        4        /* middle button released */
  1197. X#define RESHAPE            5        /* window was reshaped */
  1198. X#define RESHAPED        5        /* window was reshaped */
  1199. X#define REDRAW            6        /* screen was redrawn */
  1200. X#define REDRAWN            6        /* screen was redrawn */
  1201. X#define ACTIVATE        7        /* window was activated */
  1202. X#define ACTIVATED        7        /* window was activated */
  1203. X#define DEACTIVATE        8        /* window was deactivated */
  1204. X#define DEACTIVATED        8        /* window was deactivated */
  1205. X#define COVERED            9        /* window was covered */
  1206. X#define UNCOVERED        10        /* window was uncovered */
  1207. X#define MOVE            11        /* window was moved */
  1208. X#define MOVED            11        /* window was moved */
  1209. X#define DESTROY            12        /* window was destroyed */
  1210. X#define ACCEPT            13        /* accept messages */
  1211. X#define NOTIFY            14        /* set notification */
  1212. X#define SNARFED            16        /* text was just snarfed */
  1213. X#define PASTE            17        /* text was just pasted */
  1214. X
  1215. X/* stuff for setting terminal modes */
  1216. X
  1217. X#define _m_ttyset()        (m_flags&M_MODEOK?m_flags:m_ttyset())
  1218. X#define _m_ttyreset()        (m_flags&M_MODEOK?m_flags:m_ttyreset())
  1219. X
  1220. X/* global variables */
  1221. X
  1222. X#define MAXLINE        256    /* maximum line size from mgr */
  1223. X
  1224. Xextern FILE *m_termin;        /* output to window */
  1225. Xextern FILE *m_termout;        /* input from mgr */
  1226. Xextern int m_flags;        /* setup flags */
  1227. Xextern int m_envcount;        /* # of stacked environments */
  1228. Xextern int m_saveenvcount;    /* ??? */
  1229. Xextern char m_escchar;        /* \033, change only for debugging */
  1230. Xextern char m_menuchar;        /* menu field seperator char (\005) */
  1231. Xextern char m_linebuf[MAXLINE];
  1232. X
  1233. Xextern int get_info(), get_size(), parse(), get_font(), is_active(), menu_load();
  1234. Xextern char *m_lastline(), *get_termcap();
  1235. X
  1236. X/* structure definitions */
  1237. X
  1238. X#define MENU_SIZE(x)    (sizeof(x)/sizeof(struct menu_entry))
  1239. X
  1240. Xstruct menu_entry {
  1241. X   char *value;        /* this appears in the menu */
  1242. X   char *action;    /* this gets sent by mgr upon selection */
  1243. X   };
  1244. X
  1245. Xstruct window_data {
  1246. X   int x,y;        /* origin */
  1247. X   int w,h;        /* width, height */
  1248. X   char tty[3];        /* name of controlling tty */
  1249. X   char status;        /* activation status */
  1250. X   int num;        /* window number (>0 for client) */
  1251. X   int setid;        /* window set ID */
  1252. X   };
  1253. X
  1254. Xstruct icon {
  1255. X   char *name;        /* name of icon */
  1256. X   int type;        /* always 1 */
  1257. X   int w;        /* bitmap width */
  1258. X   int h;        /* bitmap height */
  1259. X   unsigned char *data;    /* data goes here */
  1260. X   };
  1261. X
  1262. X#endif _TERM_INCL
  1263. END_OF_FILE
  1264. # end of 'lib/term.h'
  1265. fi
  1266. if test -f 'src/blit/blit.C' -a "${1}" != "-c" ; then 
  1267.   echo shar: Will not clobber existing file \"'src/blit/blit.C'\"
  1268. else
  1269. echo shar: Extracting \"'src/blit/blit.C'\" \(15535 characters\)
  1270. sed "s/^X//" >'src/blit/blit.C' <<'END_OF_FILE'
  1271. X/*                        Copyright (c) 1988 Bellcore
  1272. X *                            All Rights Reserved
  1273. X *       Permission is granted to copy or use this program, EXCEPT that it
  1274. X *       may not be sold for profit, the copyright notice must be reproduced
  1275. X *       on copies, and credit should be given to Bellcore where it is due.
  1276. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  1277. X */
  1278. X/*    $Header: blit.C,v 4.1 88/06/21 13:19:02 bianchi Exp $
  1279. X    $Source: /tmp/mgrsrc/src/blit/RCS/blit.C,v $
  1280. X*/
  1281. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/src/blit/RCS/blit.C,v $$Revision: 4.1 $";
  1282. X
  1283. X/* bitblit code for 68020's */
  1284. X
  1285. X#include <stdio.h>
  1286. X#include "bitmap.h"
  1287. X#include "asm.h"
  1288. X
  1289. X#define UP        0x10    /* direction bottom up */
  1290. X#define LEFT    0x20    /* direction right to left */
  1291. X#define SMALL    0x40    /* > 32 bits */
  1292. X
  1293. X#define NSRC    1        /* no source required */
  1294. X
  1295. X/* multiword source <op> destination, long aligned on destination */
  1296. X
  1297. X#define ROP_TOP(name) \
  1298. X        GOTO(LL4!name); \
  1299. X    LABEL(LL1!name)
  1300. X
  1301. X#define ROP_BOTTOM(how,name) \
  1302. X        how($d_skip,$d_base); \
  1303. X        how($s_skip,$s_offset); \
  1304. X    LABEL(LL4!name); \
  1305. X        LOOP($count,LL1!name)
  1306. X
  1307. X/* bits at left edge of long boundary */
  1308. X
  1309. X#define ROP_LEFT(how,op1,op2) \
  1310. X        MOVE($l_width,$i); \
  1311. X        MOVE($l_width,$T_DST); \
  1312. X        NEG($T_DST); \
  1313. X        BF_EXT($T_DST,$d_base,$T_DST,$i); \
  1314. X        BF_EXT($T_SRC,$s_base,$s_offset,$i); \
  1315. X        op1($T_DST,$T_SRC); \
  1316. X        op2($T_DST,$T_SRC); \
  1317. X        MOVE($l_width,$T_DST); \
  1318. X        NEG($T_DST); \
  1319. X        BF_INS($T_SRC,$d_base,$T_DST,$i)
  1320. X
  1321. X/* full words in middle Left to Right */
  1322. X
  1323. X#define ROP_LR(how,op1,op2,name) \
  1324. X        ADD($i,$s_offset); \
  1325. X        MOVE($words,$i); \
  1326. X        GOTO(LL3!name); \
  1327. X    LABEL(LL2!name); \
  1328. X        BF_EXT($T_SRC,$s_base,$s_offset,IMM(0)); \
  1329. X        MOVE(IND($d_base),$T_DST); \
  1330. X        op1($T_DST,$T_SRC); \
  1331. X        op2($T_DST,$T_SRC); \
  1332. X        MOVE($T_SRC,INCR($d_base)); \
  1333. X        ADD(IMM(32),$s_offset); \
  1334. X    LABEL(LL3!name); \
  1335. X        LOOP($i,LL2!name)
  1336. X
  1337. X/* full words in middle Right to Left */
  1338. X
  1339. X#define ROP_RL(how,op1,op2,name) \
  1340. X        MOVE($words,$i); \
  1341. X        GOTO(LL3!name); \
  1342. X    LABEL(LL2!name); \
  1343. X        SUB(IMM(32),$s_offset); \
  1344. X        BF_EXT($T_SRC,$s_base,$s_offset,IMM(0)); \
  1345. X        MOVE(DECR($d_base),$T_DST); \
  1346. X        op1($T_DST,$T_SRC); \
  1347. X        op2($T_DST,$T_SRC); \
  1348. X        MOVE($T_SRC,IND($d_base)); \
  1349. X    LABEL(LL3!name); \
  1350. X        LOOP($i,LL2!name); \
  1351. X        MOVE($l_width,$i); \
  1352. X        SUB($i,$s_offset);
  1353. X
  1354. X/* bits at right edge of long boundary */
  1355. X
  1356. X#define ROP_RIGHT(how,op1,op2) \
  1357. X        MOVE($r_width,$i); \
  1358. X        BF_EXT($T_SRC,$s_base,$s_offset,$i); \
  1359. X        BF_EXT($T_DST,$d_base,IMM(0),$i); \
  1360. X        op1($T_DST,$T_SRC); \
  1361. X        op2($T_DST,$T_SRC); \
  1362. X        BF_INS($T_SRC,$d_base,IMM(0),$i);
  1363. X
  1364. X/* multiword set/clear/invert - top half */
  1365. X
  1366. X#define ROP1(how,name) \
  1367. X            GOTO(L4!name); \
  1368. X         LABEL(L1!name);\
  1369. X                MOVE($l_width,$i); \
  1370. X                MOVE($l_width,$T_DST); \
  1371. X                NEG($T_DST); \
  1372. X                how($d_base,$T_DST,$i);\
  1373. X               MOVE($words,$i);\
  1374. X               GOTO(L3!name);\
  1375. X         LABEL(L2!name)
  1376. X
  1377. X/* multiword set/clear/invert - bottom half */
  1378. X
  1379. X#define ROP2(how,name) \
  1380. X         LABEL(L3!name); \
  1381. X               LOOP($i,L2!name); \
  1382. X            MOVE($r_width,$i); \
  1383. X            how($d_base,IMM(0),$i);\
  1384. X               ADD($d_skip,$d_base); \
  1385. X         LABEL(L4!name);\
  1386. X            LOOP($count,L1!name)
  1387. X
  1388. X/* (<=32 bits) no source, used for SET, CLEAR and INVERT */
  1389. X
  1390. X#define NO_SRC(func)            \
  1391. X          GOTO(L2!func);                        \
  1392. X        LABEL(L1!func);                        \
  1393. X          func($d_base,$words,$i);    \
  1394. X          ADD($d_skip,$words);            \
  1395. X        LABEL(L2!func);            \
  1396. X          LOOP($count,L1!func)
  1397. X
  1398. X/*
  1399. X *  (<=32 bits) DST doesn't count. Use for SRC, ~SRC.
  1400. X *  how is ADD for top down, SUB for bottom up
  1401. X */
  1402. X
  1403. X#define NO_DST(how,op)    \
  1404. X          GOTO(L2!op!how); \
  1405. X        LABEL(L1!op!how); \
  1406. X          BF_EXT($T_SRC,$s_base,$s_offset,$i); \
  1407. X          op($T_DST,$T_SRC); \
  1408. X          BF_INS($T_SRC,$d_base,$words,$i); \
  1409. X          how($d_skip,$words); \
  1410. X          how($s_skip,$s_offset); \
  1411. X        LABEL(L2!op!how); \
  1412. X          LOOP($count,L1!op!how)
  1413. X
  1414. X/*
  1415. X * (<=32 bits) both SRC and DST count
  1416. X *  how is ADD for top down, SUB for bottom up
  1417. X */
  1418. X
  1419. X#define ROP(how,op1,op2)    \
  1420. X          GOTO(L2!op1!op2!how); \
  1421. X        LABEL(L1!op1!op2!how); \
  1422. X          BF_EXT($T_SRC,$s_base,$s_offset,$i); \
  1423. X          BF_EXT($T_DST,$d_base,$words,$i); \
  1424. X          op1($T_DST,$T_SRC); \
  1425. X          op2($T_DST,$T_SRC); \
  1426. X          BF_INS($T_SRC,$d_base,$words,$i); \
  1427. X          how($d_skip,$words); \
  1428. X          how($s_skip,$s_offset); \
  1429. X        LABEL(L2!op1!op2!how); \
  1430. X          LOOP($count,L1!op1!op2!how)
  1431. X
  1432. X/* generic case >32 bits */
  1433. X
  1434. X#define ROP_CASE(op,name,op1,op2) \
  1435. X      case GET_OP(op):                    /* name  left->right top->bottom */\
  1436. X         ROP_TOP(name!td_lr);\
  1437. X         ROP_LEFT(ADD,op1,op2);\
  1438. X         ROP_LR(ADD,op1,op2,name!td_lr);\
  1439. X         ROP_RIGHT(ADD,op1,op2);\
  1440. X         ROP_BOTTOM(ADD,name!td_lr);\
  1441. X         break;\
  1442. X      case GET_OP(op) | UP:            /* name left->right  bottom->up */\
  1443. X         ROP_TOP(name!bu_lr);\
  1444. X         ROP_LEFT(SUB,op1,op2);\
  1445. X         ROP_LR(SUB,op1,op2,name!bu_lr);\
  1446. X         ROP_RIGHT(SUB,op1,op2);\
  1447. X         ROP_BOTTOM(SUB,name!bu_lr);\
  1448. X         break;\
  1449. X      case GET_OP(op) | LEFT:            /* name right->left  top->bottom */\
  1450. X         ROP_TOP(name!td_rl);\
  1451. X         ROP_RIGHT(ADD,op1,op2);\
  1452. X         ROP_RL(ADD,op1,op2,name!td_rl);\
  1453. X         ROP_LEFT(ADD,op1,op2);\
  1454. X         ROP_BOTTOM(ADD,name!td_rl);\
  1455. X         break;\
  1456. X      case GET_OP(op) | UP | LEFT:    /* name right->left  bottom->up */\
  1457. X         ROP_TOP(name!bu_rl);\
  1458. X         ROP_RIGHT(SUB,op1,op2);\
  1459. X         ROP_RL(SUB,op1,op2,name!bu_rl);\
  1460. X         ROP_LEFT(SUB,op1,op2);\
  1461. X         ROP_BOTTOM(SUB,name!bu_rl);\
  1462. X         break
  1463. X
  1464. X            /* generic case <= 32 bits */
  1465. X
  1466. X#define SMALL_CASE(op,op1,op2) \
  1467. X        case GET_OP(op) | SMALL:\
  1468. X            i = wide; \
  1469. X            ROP(ADD,op1,op2);\
  1470. X            break;\
  1471. X        case GET_OP(op) | SMALL | UP:\
  1472. X            i = wide; \
  1473. X            ROP(SUB,op1,op2);\
  1474. X            break
  1475. X
  1476. X#define dprintf if(Bdebug)fprintf
  1477. Xint Bdebug = 0;
  1478. X
  1479. Xstatic char nsrc[16] = {        /* fold no source cases */
  1480. X    0,0,0,0,
  1481. X    0xf&~DST, 0xf&~DST, 0xf&~DST, 0xf&~DST,
  1482. X    0xf&DST, 0xf&DST, 0xf&DST, 0xf&DST, 
  1483. X    0xf, 0xf, 0xf, 0xf
  1484. X    };
  1485. X
  1486. Xstatic char zsrc[16] = {        /* no source req'd cases */
  1487. X    1,0,0,0,0,
  1488. X    1,0,0,0,0,
  1489. X    1,0,0,0,0,
  1490. X    1 };    
  1491. X
  1492. Xmem_rop(dst,x_dst,y_dst,wide,high,op,src,x_src,y_src)
  1493. XBITMAP *dst;                /* bitmaps */
  1494. XBITMAP *src;                /* bitmaps */
  1495. Xint x_dst,y_dst;            /* destination coords */
  1496. Xint x_src,y_src;            /* source coords */
  1497. Xint wide,high;                /* bitmap size */
  1498. Xint op;                        /* bitmap function */
  1499. X   {
  1500. X    /* address registers */
  1501. X
  1502. X    register int *d_base;            /* destination bitmap base addresses */
  1503. X    register int *s_base;            /* source bitmap base addresses */
  1504. X
  1505. X    /* data registers */
  1506. X
  1507. X    register int s_offset;            /* source bit offset */
  1508. X    register int d_skip;                /* bytes to next line in dst */
  1509. X    register int s_skip;                /* bits to next line in src */
  1510. X   register int i = 0;                /* temporary data register */
  1511. X                                            /* width in bits (<= 32 bits) */
  1512. X    register int count=high;        /* # of rows */
  1513. X   register int words;                /* words across in inner loop (>32 bits) */
  1514. X                                            /* dest bit offset (<= 32 bits) */
  1515. X
  1516. X    /* temporary address reg. storage for 'i' above (>32 bits only) */
  1517. X
  1518. X   register int *l_width;            /* bits on left to next long boundary */
  1519. X   register int *r_width;            /* bits from last long boundary on right */
  1520. X
  1521. X    /* clipping and argument checking */
  1522. X
  1523. X    if (!src) {
  1524. X      if (Bdebug && op&0xf != 0xf&nsrc[op&0xf])
  1525. X           dprintf(stderr,"no src, setting op %d -> %d\n",op&0xf,nsrc[op&0xf]);
  1526. X      op = 0xf&nsrc[op&0xf];                        /* a NULL src sources 1's */
  1527. X        }
  1528. X
  1529. X    else if (zsrc[op&0xf])                     {
  1530. X      if (Bdebug && src)
  1531. X           dprintf(stderr,"op=%d, setting src->NULL\n",op&0xf);
  1532. X        src == BIT_NULL;                            /* don't check no src cases */
  1533. X        }
  1534. X    
  1535. X    if (wide<0) {
  1536. X        dprintf(stderr,"Clip: w<0 (%d)\n",wide);
  1537. X        x_dst += wide;
  1538. X        wide = - wide;
  1539. X        }
  1540. X
  1541. X    if (count<0) {
  1542. X        y_dst += count;
  1543. X        count = - count;
  1544. X        dprintf(stderr,"Clip: h<0 (%d)\n",count);
  1545. X        }
  1546. X
  1547. X   if (x_dst < 0) {
  1548. X        dprintf(stderr,"Clip: x_dst<0 (%d)\n",x_dst);
  1549. X        if (src)
  1550. X            x_src -= x_dst;
  1551. X        wide += x_dst;
  1552. X        x_dst = 0;
  1553. X        }
  1554. X
  1555. X   if (y_dst < 0) {
  1556. X        dprintf(stderr,"Clip: y_dst<0 (%d)\n",y_dst);
  1557. X        if (src)
  1558. X            y_src -= y_dst;
  1559. X        count += y_dst;
  1560. X        y_dst = 0;
  1561. X        }
  1562. X
  1563. X    if (src) {
  1564. X        if (x_src < 0) {
  1565. X            dprintf(stderr,"Clip: x_src<0 (%d)\n",x_src);
  1566. X            x_dst -= x_src;
  1567. X            wide += x_src;
  1568. X            x_src = 0;
  1569. X            }
  1570. X
  1571. X        if (y_src < 0) {
  1572. X            dprintf(stderr,"Clip: y_src<0 (%d)\n",y_src);
  1573. X            y_dst-=y_src;
  1574. X            count+=y_src;
  1575. X            y_src=0;
  1576. X            }
  1577. X            
  1578. X        if ((i = x_src+wide - src->wide) > 0) {
  1579. X            dprintf(stderr,"Clip: wide too big for src (%d->%d)\n",wide,wide-i);
  1580. X            wide -= i;
  1581. X            }
  1582. X
  1583. X        if ((i = y_src+count - src->high) > 0) {
  1584. X            dprintf(stderr,"Clip: high too big for src (%d->%d)\n",count,count-i);
  1585. X            count -= i;
  1586. X            }
  1587. X
  1588. X        x_src += src->x0;
  1589. X        y_src += src->y0;
  1590. X        }
  1591. X
  1592. X    if ((i = x_dst + wide - dst->wide) > 0) {
  1593. X        dprintf(stderr,"Clip: wide too big for dst (%d->%d)\n",wide,wide-i);
  1594. X        wide -= i;
  1595. X        }
  1596. X    if ((i = y_dst + count - dst->high) > 0) {
  1597. X        dprintf(stderr,"Clip: high too big for dst (%d->%d)\n",count,count-i);
  1598. X        count -= i;
  1599. X        }
  1600. X
  1601. X    if (wide<1 || count < 1) {
  1602. X        dprintf(stderr,"Clip: high or wide < 1 (%d,%d)\n",wide,count);
  1603. X        return(-1);
  1604. X        }
  1605. X    x_dst += dst->x0;
  1606. X    y_dst += dst->y0;
  1607. X
  1608. X
  1609. X    /* end of clipping code */
  1610. X
  1611. X   /* set up common initial conditions */
  1612. X
  1613. X    if (wide <= 32) {            /* small cases */
  1614. X        i = SMALL;
  1615. X        }
  1616. X    else {
  1617. X        i = 0;
  1618. X        l_width = (int *) (32 - (x_dst&31));    /* bits on left edge 1-32 */
  1619. X        r_width = (int *) ((x_dst + wide) & 31);    /* bits on right edge 0-31 */
  1620. X        words =   (wide - (int) l_width)>>5;    /* longs in middle */
  1621. X        if (!r_width) {                                /* change 0-31 to 1-32 */
  1622. X            r_width = (int *) 32;
  1623. X            words--;
  1624. X            }
  1625. X        }
  1626. X
  1627. X   /* find bitblt direction */
  1628. X
  1629. X   if (src && src->data == dst->data)  {
  1630. X      if (y_dst>y_src)
  1631. X         i |= UP;
  1632. X      if (x_dst>x_src && wide > 32)
  1633. X           i |= LEFT;
  1634. X        }
  1635. X       
  1636. X    /* set initial conditions */
  1637. X
  1638. X   switch(i) {
  1639. X    case 0:                /* top->bottom        left->right */
  1640. X      d_base = dst->data +((BIT_LINE(dst)*y_dst+x_dst+32)>>5);
  1641. X       d_skip = (BIT_LINE(dst)>>3) - (words<<2);        /* bytes to next row */
  1642. X        if (src) {
  1643. X            s_base = src->data;
  1644. X            s_skip = BIT_LINE(src) - (wide - (int)r_width);        /* in bits */
  1645. X            s_offset = BIT_LINE(src) * y_src + x_src;                /* in bits */
  1646. X            }
  1647. X        /* dprintf(stderr,"RIGHT DOWN\n"); */
  1648. X      break;
  1649. X
  1650. X    case UP:                /* bottom->top        left->right */
  1651. X      d_base = dst->data +((BIT_LINE(dst)*(y_dst+count-1)+x_dst+32)>>5);
  1652. X       d_skip = (BIT_LINE(dst)>>3) + (words<<2);        /* bytes to next row */
  1653. X        s_base = src->data;
  1654. X        s_skip = BIT_LINE(src) + (wide - (int)r_width);        /* in bits */
  1655. X        s_offset = BIT_LINE(src) * (y_src+count-1) + x_src;
  1656. X        /* dprintf(stderr,"RIGHT UP\n"); */
  1657. X      break;
  1658. X
  1659. X    case LEFT:            /* top->bottom        right->left */
  1660. X      d_base = dst->data +((BIT_LINE(dst)*y_dst+x_dst+wide-1)>>5);
  1661. X       d_skip = (BIT_LINE(dst)>>3) + (words<<2);        /* bytes to next row */
  1662. X        s_base = src->data;
  1663. X        s_skip = BIT_LINE(src) + (words<<5) + (int) l_width;
  1664. X        s_offset = BIT_LINE(src)*y_src + x_src+wide-(int)r_width;
  1665. X        /* dprintf(stderr,"LEFT DOWN\n"); */
  1666. X      break;
  1667. X
  1668. X    case UP|LEFT:        /* bottom->top        right->left */
  1669. X      d_base = dst->data +((BIT_LINE(dst)*(y_dst+count-1)+x_dst+wide-1)>>5);
  1670. X       d_skip = (BIT_LINE(dst)>>3) - (words<<2);        /* bytes to next row */
  1671. X        s_base = src->data;
  1672. X        s_skip = BIT_LINE(src) - (words<<5) - (int) l_width;
  1673. X        s_offset = BIT_LINE(src)*(y_src+count-1) + x_src+wide-(int)r_width;
  1674. X        /* dprintf(stderr,"LEFT UP\n"); */
  1675. X      break;
  1676. X
  1677. X    case SMALL:            /* <= 32 bits */
  1678. X        d_base =  dst->data;    /* destination base address */
  1679. X        d_skip = BIT_LINE(dst->primary);    /* bits/row */
  1680. X        words = d_skip*y_dst+x_dst;
  1681. X        if (src) {
  1682. X            s_base = src->data; /* source base address */
  1683. X            s_skip = BIT_LINE(src->primary);    /* bits/row */
  1684. X            s_offset = s_skip*y_src+x_src;
  1685. X            }
  1686. X        /* dprintf(stderr,"SMALL DOWN\n"); */
  1687. X      break;
  1688. X
  1689. X    case SMALL | UP:
  1690. X        d_base =  dst->data;    /* destination base address */
  1691. X        d_skip = BIT_WIDE(dst->primary);    /* bits/row */
  1692. X        words = d_skip*(y_dst+count-1)+x_dst;
  1693. X        s_base = (int *) src->data; /* source base address */
  1694. X        s_skip = BIT_WIDE(src->primary);    /* bits/row */
  1695. X        s_offset = s_skip*(y_src+count-1)+x_src;
  1696. X        /* dprintf(stderr,"SMALL UP\n"); */
  1697. X      break;
  1698. X
  1699. X    default:
  1700. X        dprintf(stderr,"Invalid direction: 0x%x\n",i);
  1701. X        break;
  1702. X        }
  1703. X
  1704. X/*
  1705. X   dprintf(stderr,"op:%d d_base:0x%x\td_skip:%d\    (%d %d*32 %d)\n",
  1706. X                        op&0xf,d_base,d_skip,(int)l_width,words,(int)r_width);                    
  1707. X   if (src)
  1708. X        dprintf(stderr,"\ts_base:0x%x\ts_skip:%d\ts_offset:%d\n",
  1709. X                        s_base,s_skip,s_offset);                    
  1710. X
  1711. X    dprintf(stderr,"go %x\n",i);
  1712. X*/
  1713. X
  1714. X    /* @+        DON't DISTURB THIS COMMENT */
  1715. X
  1716. X    switch(op&0xf | i) {
  1717. X
  1718. X        /* no source involvement <= 32 bits */
  1719. X
  1720. X        case GET_OP(BIT_SET) | SMALL:
  1721. X        case GET_OP(BIT_SET) | UP | SMALL:
  1722. X            i = wide;
  1723. X            NO_SRC(BF_SET);
  1724. X            break;    
  1725. X        case GET_OP(BIT_CLR) | SMALL:
  1726. X        case GET_OP(BIT_CLR) | UP | SMALL:
  1727. X            i = wide;
  1728. X            NO_SRC(BF_CLR);
  1729. X            break;    
  1730. X        case GET_OP(BIT_NOT(BIT_DST)) | SMALL:
  1731. X        case GET_OP(BIT_NOT(BIT_DST)) | UP | SMALL:
  1732. X            i = wide;
  1733. X            NO_SRC(BF_INV);
  1734. X            break;    
  1735. X
  1736. X        /* no dest involement */
  1737. X
  1738. X        case GET_OP(BIT_SRC) | SMALL:
  1739. X            i = wide;
  1740. X            NO_DST(ADD,NOP);
  1741. X            break;
  1742. X        case GET_OP(~BIT_SRC) | SMALL:
  1743. X            i = wide;
  1744. X            NO_DST(ADD,NOT_SRC);
  1745. X            break;
  1746. X
  1747. X        case GET_OP(BIT_SRC) | UP | SMALL:
  1748. X            i = wide;
  1749. X            NO_DST(SUB,NOP);
  1750. X            break;
  1751. X        case GET_OP(~BIT_SRC) | UP | SMALL:
  1752. X            i = wide;
  1753. X            NO_DST(SUB,NOT_SRC);
  1754. X            break;
  1755. X
  1756. X        /* source and dest  and cases */
  1757. X
  1758. X        SMALL_CASE(BIT_SRC&BIT_DST,AND,NOP);
  1759. X        SMALL_CASE(~(BIT_SRC&BIT_DST),AND,NOT_SRC);
  1760. X        SMALL_CASE(~BIT_SRC&BIT_DST,NOT_SRC,AND);
  1761. X        SMALL_CASE(BIT_SRC&~BIT_DST,NOT_DST,AND);
  1762. X
  1763. X        /* source and dest  or cases */
  1764. X
  1765. X        SMALL_CASE(BIT_SRC|BIT_DST,OR,NOP);
  1766. X        SMALL_CASE(~(BIT_SRC|BIT_DST),OR,NOT_SRC);
  1767. X        SMALL_CASE(~BIT_SRC|BIT_DST,NOT_SRC,OR);
  1768. X        SMALL_CASE(BIT_SRC|~BIT_DST,NOT_DST,OR);
  1769. X
  1770. X        /* source and dest  xor cases */
  1771. X
  1772. X        SMALL_CASE(BIT_SRC^BIT_DST,XOR,NOP);
  1773. X        SMALL_CASE(~(BIT_SRC^BIT_DST),XOR,NOT_SRC);
  1774. X
  1775. X
  1776. X        /****************************************************************
  1777. X         * > 32 bits
  1778. X         */
  1779. X
  1780. X        /* no source involvement */
  1781. X
  1782. X        case GET_OP(BIT_SET):
  1783. X        case GET_OP(BIT_SET) | UP:
  1784. X        case GET_OP(BIT_SET) | LEFT:
  1785. X        case GET_OP(BIT_SET) | UP | LEFT:
  1786. X            MOVEQ(0,$T_SRC);
  1787. X         NOT($T_SRC);
  1788. X          ROP1(BF_SET,set);
  1789. X         MOVE($T_SRC,INCR($d_base));
  1790. X           ROP2(BF_SET,set);
  1791. X            break;    
  1792. X
  1793. X        case GET_OP(BIT_CLR):
  1794. X        case GET_OP(BIT_CLR) | UP:
  1795. X        case GET_OP(BIT_CLR) | LEFT:
  1796. X        case GET_OP(BIT_CLR) | UP | LEFT:
  1797. X            MOVEQ(0,$T_SRC);
  1798. X          ROP1(BF_CLR,clear);
  1799. X         MOVE($T_SRC,INCR($d_base));
  1800. X          ROP2(BF_CLR,clear);
  1801. X            break;    
  1802. X
  1803. X        case GET_OP(~BIT_DST):
  1804. X        case GET_OP(~BIT_DST) | UP:
  1805. X        case GET_OP(~BIT_DST) | LEFT:
  1806. X        case GET_OP(~BIT_DST) | UP | LEFT:
  1807. X          ROP1(BF_INV,invert);
  1808. X           MOVE(IND($d_base),$T_SRC);
  1809. X          NOT($T_SRC);
  1810. X         MOVE($T_SRC,INCR($d_base));
  1811. X          ROP2(BF_INV,invert);
  1812. X            break;    
  1813. X
  1814. X        /* source involvement, no DST  (this could be better) */
  1815. X      /* The optimizer doesn't toss the un-needed loads of the destination */
  1816. X
  1817. X        ROP_CASE(BIT_SRC,src,NOP,NOP);
  1818. X        ROP_CASE(~BIT_SRC,not_src,NOP,NOT_SRC);
  1819. X
  1820. X        /* source involvement  - and operations */
  1821. X
  1822. X        ROP_CASE(BIT_SRC&BIT_DST,and,AND,NOP);
  1823. X        ROP_CASE(~(BIT_SRC&BIT_DST),not_and,AND,NOT_SRC);
  1824. X        ROP_CASE(~BIT_SRC&BIT_DST,mask,NOT_SRC,AND);
  1825. X        ROP_CASE(BIT_SRC&~BIT_DST,not_mask,NOT_DST,AND);
  1826. X
  1827. X        /* source involvement  - or operations */
  1828. X
  1829. X        ROP_CASE(BIT_SRC|BIT_DST,or,OR,NOP);
  1830. X        ROP_CASE(~(BIT_SRC|BIT_DST),not_or,OR,NOT_SRC);
  1831. X        ROP_CASE(~BIT_SRC|BIT_DST,project,NOT_SRC,OR);
  1832. X        ROP_CASE(BIT_SRC|~BIT_DST,not_project,NOT_DST,OR);
  1833. X
  1834. X        /* source involvement  - xor operations */
  1835. X
  1836. X        ROP_CASE(BIT_SRC^BIT_DST,xor,XOR,NOP);
  1837. X        ROP_CASE(~(BIT_SRC^BIT_DST),not_xor,XOR,NOT_SRC);
  1838. X
  1839. X        /* no-op cases */
  1840. X
  1841. X        case GET_OP(DST) :    
  1842. X        case GET_OP(DST) | LEFT:
  1843. X        case GET_OP(DST) | SMALL:
  1844. X        case GET_OP(DST) | UP | SMALL:
  1845. X            break;
  1846. X
  1847. X      default:                                    /* not implemented */
  1848. X         fprintf(stderr,"operation 0x%x not implemented\n",op);
  1849. X         break;
  1850. X        }
  1851. X    return(0);
  1852. X      }
  1853. END_OF_FILE
  1854. # end of 'src/blit/blit.C'
  1855. fi
  1856. echo shar: End of archive 38 \(of 61\).
  1857. cp /dev/null ark38isdone
  1858. MISSING=""
  1859. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1860.     21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 \
  1861.     38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 \
  1862.     55 56 57 58 59 60 61 ; do
  1863.     if test ! -f ark${I}isdone ; then
  1864.     MISSING="${MISSING} ${I}"
  1865.     fi
  1866. done
  1867. if test "${MISSING}" = "" ; then
  1868.     echo You have unpacked all 61 archives.
  1869.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1870. else
  1871.     echo You still need to unpack the following archives:
  1872.     echo "        " ${MISSING}
  1873. fi
  1874. ##  End of shell archive.
  1875. exit 0
  1876.