home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3513 < prev    next >
Encoding:
Internet Message Format  |  1991-06-20  |  39.7 KB

  1. From: gunnar@falcon.ericsson.se (Was a Sunny day)
  2. Newsgroups: alt.sources
  3. Subject: Scantool part 2(5)  (shar)
  4. Message-ID: <1991Jun18.124454.11082@ericsson.se>
  5. Date: 18 Jun 91 12:44:54 GMT
  6.  
  7. #!/bin/sh
  8. # this is scan.02 (part 2 of a multipart archive)
  9. # do not concatenate these parts, unpack them in order with /bin/sh
  10. # file graphics.c continued
  11. #
  12. if test ! -r _shar_seq_.tmp; then
  13.     echo 'Please unpack part 1 first!'
  14.     exit 1
  15. fi
  16. (read Scheck
  17.  if test "$Scheck" != 2; then
  18.     echo Please unpack part "$Scheck" next!
  19.     exit 1
  20.  else
  21.     exit 0
  22.  fi
  23. ) < _shar_seq_.tmp || exit 1
  24. if test ! -f _shar_wnt_.tmp; then
  25.     echo 'x - still skipping graphics.c'
  26. else
  27. echo 'x - continuing file graphics.c'
  28. sed 's/^X//' << 'SHAR_EOF' >> 'graphics.c' &&
  29. X        }
  30. X      else if (curx > butx+400 && curx < butx+400+BUTTON_WIDTH &&
  31. X               cury > buty+10  && cury < buty+10+BUTTON_HEIGHT)
  32. X        {
  33. X          state = CANCEL ;
  34. X          make_button(butx+400, buty+10, "Cancel", B_INVERT) ;
  35. X          finished = 1 ;
  36. X        }
  37. X    }
  38. X  else if (type == KEYBOARD)
  39. X    {
  40. X      c = cur_ch ;
  41. X      if (c == BACKSPACE || c == DEL)
  42. X        picname[strlen(picname)-1] = '\0' ;
  43. X      else if (c == RETURN || c == LINEFEED)
  44. X        {
  45. X          state = OK ;
  46. X          finished = 1 ;
  47. X        }
  48. X      else if (c >= 32) STRNCAT(picname, &c, 1) ;
  49. X      draw_area(butx+71, buty+11, 193, 23, GCLR) ;
  50. X      nochars = (strlen(picname) <= 20) ? strlen(picname) : 20 ;
  51. X      STRNCPY(dummy, &picname[strlen(picname) - nochars], nochars) ;
  52. X      dummy[nochars] = '\0' ;
  53. X      draw_text(butx+80, buty+27, STEN_OFF, BFONT, dummy) ;
  54. X      draw_line(butx + 80 + get_strwidth(BFONT, dummy), buty + 15,
  55. X                butx + 80 + get_strwidth(BFONT, dummy), buty + 30, GSET) ;
  56. X    }
  57. X
  58. X  if (finished)
  59. X    {
  60. X      if (state == CANCEL) STRCPY(picname, old_picname) ;
  61. X      drawstate = DO_NOTHING ;
  62. X      do_repaint() ;              /* Redraw original screen. */
  63. X    }
  64. }
  65. X
  66. X
  67. make_menus()
  68. {
  69. X  create_menu(BRIGHTNESS_M, "BRIGHTNESS", br_strs) ;
  70. X  create_menu(CONTRAST_M,   "CONTRAST",   con_strs) ;
  71. X  create_menu(GRAIN_M,      "GRAIN",      gr_strs) ;
  72. X  create_menu(HELP_M,       "HELP",       help_strs) ;
  73. X  create_menu(RESOLUTION_M, "RESOLUTION", res_strs) ;
  74. X  create_menu(SET_M,        "SET",        set_strs) ;
  75. }
  76. X
  77. X
  78. process_event()
  79. {
  80. X  enum menu_type column ;
  81. X  int row, value ;
  82. X
  83. X       if (type == IGNORE)              return ;
  84. X  else if (type == REPAINT)             do_repaint() ;
  85. X  else if (drawstate == DO_MESSAGE   ||
  86. X           drawstate == DO_HELP      ||
  87. X           drawstate == DO_SETTINGS)    wait_for_ok() ;
  88. X  else if (drawstate == DO_PICNAME)     get_picname() ;
  89. X  else
  90. X    {
  91. X      column = (enum menu_type) ((curx - 10) / MBAR_WIDTH) ;
  92. X      row = cury / MBAR_HEIGHT ;
  93. X      if (type == RIGHT_DOWN && row == 0)
  94. X        {
  95. X          value = display_menu(column) ;
  96. X          if (value) process_menu(column, value) ;
  97. X        }
  98. X      else if (type == LEFT_DOWN)
  99. X        {
  100. X               if (curx > SCAN_WIDTH-150                    &&
  101. X                   curx < SCAN_WIDTH-90                     &&
  102. X                   cury > 4*SWITCH_HEIGHT+20                &&
  103. X                   cury < 4*SWITCH_HEIGHT+20+BUTTON_HEIGHT) make_scan() ;
  104. X          else if (curx > SCAN_WIDTH-150                    &&
  105. X                   curx < SCAN_WIDTH-90                     &&
  106. X                   cury > 4*SWITCH_HEIGHT+60                &&
  107. X                   cury < 4*SWITCH_HEIGHT+60+BUTTON_HEIGHT) stop_scan() ;
  108. X          else if (curx > SCAN_WIDTH-150                    &&
  109. X                   curx < SCAN_WIDTH-90                     &&
  110. X                   cury > 4*SWITCH_HEIGHT+100               &&
  111. X                   cury < 4*SWITCH_HEIGHT+100+BUTTON_HEIGHT) show() ;
  112. X          else test_switch(curx, cury) ;   /* Test for a box switch press. */
  113. X        }
  114. X    }
  115. }
  116. X
  117. X
  118. select_frame()    /* Construct a new scanning window. */
  119. {
  120. X  int oldx = 0 ;
  121. X  int oldy = 0 ;
  122. X  int x1, y1, x2, y2 ;
  123. X  int drawold = 0 ;
  124. X  int found = 0 ;
  125. X
  126. X  set_cursor(FRAME_CUR) ;
  127. X
  128. /* Remove current scan settings, if any. */
  129. X  draw_area(SCAN_FRAME_X+2, SCAN_FRAME_Y+2, 34*LINEGAP-4, 44*LINEGAP-4, GCLR) ;
  130. X  draw_area(SCAN_FRAME_X-9, SCAN_FRAME_Y, 9, 46*LINEGAP-1, GCLR) ;
  131. X  draw_area(SCAN_FRAME_X, SCAN_FRAME_Y-9, 34*LINEGAP-1, 9, GCLR) ;
  132. X
  133. X  do
  134. X    {
  135. X      get_event() ;
  136. X      handle_event() ;
  137. X      if (curx > SCAN_FRAME_X && curx < SCAN_FRAME_X+34*LINEGAP &&
  138. X          cury > SCAN_FRAME_Y && cury < SCAN_FRAME_Y+44*LINEGAP)
  139. X        {
  140. X          curx = (curx / (FRAMEGAP) * (FRAMEGAP)) + 1 ;
  141. X          cury = (cury / (FRAMEGAP) * (FRAMEGAP)) + 2 ;
  142. X          if (type == LEFT_DOWN) found = 1 ;
  143. X          if (type != MOUSE_MOVE) continue ;
  144. X          if (drawold)
  145. X            {
  146. X              draw_line(oldx, SCAN_FRAME_Y-1, oldx, SCAN_FRAME_Y-9, GXOR) ;
  147. X              draw_line(SCAN_FRAME_X-1, oldy, SCAN_FRAME_X-9, oldy, GXOR) ;
  148. X            }
  149. X          draw_line(curx, SCAN_FRAME_Y-1, curx, SCAN_FRAME_Y-9, GXOR) ;
  150. X          draw_line(SCAN_FRAME_X-1, cury, SCAN_FRAME_X-9, cury, GXOR) ;
  151. X          oldx = curx ;
  152. X          oldy = cury ;
  153. X          drawold++ ;
  154. X        }
  155. X    }    
  156. X  while (!found) ;
  157. X  x1 = curx ;
  158. X  y1 = cury ;
  159. X
  160. X  found = 0 ;
  161. X  drawold = 0 ;
  162. X  do
  163. X    {
  164. X      get_event() ;
  165. X      handle_event() ;
  166. X      if (curx > SCAN_FRAME_X && curx < SCAN_FRAME_X+34*LINEGAP &&
  167. X          cury > SCAN_FRAME_Y && cury < SCAN_FRAME_Y+44*LINEGAP)
  168. X        {
  169. X          curx = (curx / (FRAMEGAP) * (FRAMEGAP)) + 1 ;
  170. X          cury = (cury / (FRAMEGAP) * (FRAMEGAP)) + 2 ;
  171. X          if (type == LEFT_UP) found = 1 ;
  172. X          if (type != MOUSE_DRAG) continue ;
  173. X          if (drawold)
  174. X            {
  175. X              draw_line(oldx, SCAN_FRAME_Y-1, oldx, SCAN_FRAME_Y-9, GXOR) ;
  176. X              draw_line(SCAN_FRAME_X-1, oldy, SCAN_FRAME_X-9, oldy, GXOR) ;
  177. X              draw_rect(x1, y1, oldx, oldy, GXOR) ;
  178. X            }
  179. X          draw_line(curx, SCAN_FRAME_Y-1, curx, SCAN_FRAME_Y-9, GXOR) ;
  180. X          draw_line(SCAN_FRAME_X-1, cury, SCAN_FRAME_X-9, cury, GXOR) ;
  181. X          draw_rect(x1, y1, curx, cury, GXOR) ;
  182. X          oldx = curx ;
  183. X          oldy = cury ;
  184. X          drawold++ ;
  185. X        }
  186. X    }
  187. X  while (!found) ;
  188. X
  189. X  x2 = curx ;
  190. X  y2 = cury ;
  191. X  if (x1 > x2)
  192. X    {
  193. X      oldx = x2 ;
  194. X      x2 = x1 ;
  195. X      x1 = oldx ;
  196. X    }
  197. X  if (y1 > y2)
  198. X    {
  199. X      oldy = y2 ;
  200. X      y2 = y1 ;
  201. X      y1 = oldy ;
  202. X    }
  203. X  framevals[X1] = (x1 - SCAN_FRAME_X) / (FRAMEGAP) ;
  204. X  framevals[Y1] = (y1 - SCAN_FRAME_Y) / (FRAMEGAP) ;
  205. X  framevals[X2] = (x2 - SCAN_FRAME_X) / (FRAMEGAP) ;
  206. X  framevals[Y2] = (y2 - SCAN_FRAME_Y) / (FRAMEGAP) ;
  207. X  set_cursor(MAIN_CUR) ;
  208. }
  209. X
  210. X
  211. set_switch(x, y, position)
  212. int x, y, position ;
  213. {
  214. X  if (position == ON) draw_image(x, y-2, 16, 16, S_INVERT) ;
  215. X  else                draw_image(x, y-2, 16, 16, S_NORMAL) ;
  216. }
  217. X
  218. X
  219. stop_scan()       /* Stop the current scan (if there is one). */
  220. {
  221. X  if (!scanning) return ;
  222. X  make_button(SCAN_WIDTH-150, 4*SWITCH_HEIGHT+60, "Cancel", B_INVERT) ;
  223. X  KILL(pid, SIGHUP) ;
  224. }
  225. SHAR_EOF
  226. echo 'File graphics.c is complete' &&
  227. chmod 0644 graphics.c ||
  228. echo 'restore of graphics.c failed'
  229. Wc_c="`wc -c < 'graphics.c'`"
  230. test 12024 -eq "$Wc_c" ||
  231.     echo 'graphics.c: original size 12024, current size' "$Wc_c"
  232. rm -f _shar_wnt_.tmp
  233. fi
  234. # ============= help.cursor ==============
  235. if test -f 'help.cursor' -a X"$1" != X"-c"; then
  236.     echo 'x - skipping help.cursor (File already exists)'
  237.     rm -f _shar_wnt_.tmp
  238. else
  239. > _shar_wnt_.tmp
  240. echo 'x - extracting help.cursor (Text)'
  241. sed 's/^X//' << 'SHAR_EOF' > 'help.cursor' &&
  242. /* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  243. X */
  244. X    0xFFFF,0x8001,0xBFFD,0xA005,0xA385,0xA445,0xA445,0xA085,
  245. X    0xA105,0xA105,0xA005,0xA105,0xA005,0xBFFD,0x8001,0xFFFF
  246. SHAR_EOF
  247. chmod 0644 help.cursor ||
  248. echo 'restore of help.cursor failed'
  249. Wc_c="`wc -c < 'help.cursor'`"
  250. test 193 -eq "$Wc_c" ||
  251.     echo 'help.cursor: original size 193, current size' "$Wc_c"
  252. rm -f _shar_wnt_.tmp
  253. fi
  254. # ============= images.h ==============
  255. if test -f 'images.h' -a X"$1" != X"-c"; then
  256.     echo 'x - skipping images.h (File already exists)'
  257.     rm -f _shar_wnt_.tmp
  258. else
  259. > _shar_wnt_.tmp
  260. echo 'x - extracting images.h (Text)'
  261. sed 's/^X//' << 'SHAR_EOF' > 'images.h' &&
  262. X
  263. /*  @(#)images.h 1.2 90/04/02
  264. X *
  265. X *  Various images used by the different versions of scantool.
  266. X *
  267. X *  Copyright (c) Rich Burridge - Sun Microsystems.
  268. X *                                All rights reserved.
  269. X *
  270. X *  Permission is given to distribute these sources, as long as the
  271. X *  introductory messages are not removed, and no monies are exchanged.
  272. X *
  273. X *  No responsibility is taken for any errors or inaccuracies inherent
  274. X *  either to the comments or the code of this program, but if reported
  275. X *  to me, then an attempt will be made to fix them.
  276. X */
  277. X
  278. unsigned short grey_image[16] =
  279. X                 {
  280. X                   0xAAAA, 0x5555, 0xAAAA, 0x5555,
  281. X                   0xAAAA, 0x5555, 0xAAAA, 0x5555,
  282. X                   0xAAAA, 0x5555, 0xAAAA, 0x5555,
  283. X                   0xAAAA, 0x5555, 0xAAAA, 0x5555
  284. X                 } ;
  285. X
  286. unsigned short icon_image[] = {
  287. #include "scantool.icon"
  288. } ;
  289. X
  290. unsigned short button_invert_image[] = {
  291. #include "button.invert.icon"
  292. } ;
  293. X
  294. unsigned short button_normal_image[] = {
  295. #include "button.normal.icon"
  296. } ;
  297. X
  298. unsigned short switch_invert_image[] = {
  299. #include "switch.invert.cursor"
  300. } ;
  301. X
  302. unsigned short switch_normal_image[] = {
  303. #include "switch.normal.cursor"
  304. } ;
  305. X
  306. unsigned short exclaim_image[] = {
  307. #include "exclaim.icon"
  308. } ;
  309. X
  310. unsigned short main_cursor_array[16] = {
  311. #include "main.cursor"
  312. } ;
  313. X
  314. unsigned short hour_cursor_array[16] = {
  315. #include <images/hglass.cursor>
  316. } ;
  317. unsigned short help_cursor_array[16] = {
  318. #include "help.cursor"
  319. } ;
  320. unsigned short frame_cursor_array[16] = {
  321. #include "frame.cursor"
  322. } ;
  323. SHAR_EOF
  324. chmod 0644 images.h ||
  325. echo 'restore of images.h failed'
  326. Wc_c="`wc -c < 'images.h'`"
  327. test 1552 -eq "$Wc_c" ||
  328.     echo 'images.h: original size 1552, current size' "$Wc_c"
  329. rm -f _shar_wnt_.tmp
  330. fi
  331. # ============= main.cursor ==============
  332. if test -f 'main.cursor' -a X"$1" != X"-c"; then
  333.     echo 'x - skipping main.cursor (File already exists)'
  334.     rm -f _shar_wnt_.tmp
  335. else
  336. > _shar_wnt_.tmp
  337. echo 'x - extracting main.cursor (Text)'
  338. sed 's/^X//' << 'SHAR_EOF' > 'main.cursor' &&
  339. /* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
  340. X */
  341. X    0x8000,0xC000,0xE000,0xF000,0xF800,0xFC00,0xFE00,0xF000,
  342. X    0xD800,0x9800,0x0C00,0x0C00,0x0600,0x0600,0x0300,0x0300
  343. SHAR_EOF
  344. chmod 0644 main.cursor ||
  345. echo 'restore of main.cursor failed'
  346. Wc_c="`wc -c < 'main.cursor'`"
  347. test 193 -eq "$Wc_c" ||
  348.     echo 'main.cursor: original size 193, current size' "$Wc_c"
  349. rm -f _shar_wnt_.tmp
  350. fi
  351. # ============= make.sunview ==============
  352. if test -f 'make.sunview' -a X"$1" != X"-c"; then
  353.     echo 'x - skipping make.sunview (File already exists)'
  354.     rm -f _shar_wnt_.tmp
  355. else
  356. > _shar_wnt_.tmp
  357. echo 'x - extracting make.sunview (Text)'
  358. sed 's/^X//' << 'SHAR_EOF' > 'make.sunview' &&
  359. #!/bin/sh
  360. # This script does a make of the SunView tool.
  361. #
  362. make -f makefile.sunview sunview
  363. echo " "
  364. echo "Sunview tool now in file 'sv_scantool'"
  365. echo " "
  366. SHAR_EOF
  367. chmod 0555 make.sunview ||
  368. echo 'restore of make.sunview failed'
  369. Wc_c="`wc -c < 'make.sunview'`"
  370. test 156 -eq "$Wc_c" ||
  371.     echo 'make.sunview: original size 156, current size' "$Wc_c"
  372. rm -f _shar_wnt_.tmp
  373. fi
  374. # ============= makefile.sunview ==============
  375. if test -f 'makefile.sunview' -a X"$1" != X"-c"; then
  376.     echo 'x - skipping makefile.sunview (File already exists)'
  377.     rm -f _shar_wnt_.tmp
  378. else
  379. > _shar_wnt_.tmp
  380. echo 'x - extracting makefile.sunview (Text)'
  381. sed 's/^X//' << 'SHAR_EOF' > 'makefile.sunview' &&
  382. #
  383. #  Makefile for the Microtek MS-300A to Sun rasterfile converter.
  384. #
  385. #  @(#)Makefile 1.5 90/04/12
  386. #
  387. #  Copyright (c) Rich Burridge - Sun Microsystems Australia.
  388. #
  389. #  No responsibility is taken for any errors inherent either in the comments
  390. #  or the code of this program, but if reported to me then an attempt will
  391. #  be made to fix them.
  392. #
  393. #=========================================================================
  394. #
  395. #  There are various small changes needed when compiling faces on
  396. #  different systems. These have been isolated here, and should
  397. #  be uncommented if needed.
  398. #-------------------------------------------------------------------------
  399. #  Scantool uses a helpfile to supply online help for various functions.
  400. #  By default this file is called "scantool.help". You can also
  401. #  override it's location and name at runtime with the -h option.
  402. #  It can also be specified here by uncommenting the following
  403. #  macro definition and setting appropriately.
  404. #
  405. HELPNAME    = -DHELPNAME=\"$(LIBDIR)/scantool.help\"
  406. #-------------------------------------------------------------------------
  407. #  If you not running under a BSD4.3 derived system, the parameters
  408. #  to the select call are different, and this definition should be
  409. #  uncommented. You need to uncomment this for SunOS v3.x.
  410. #
  411. SELTYPE        = -DNO_4.3SELECT
  412. #-------------------------------------------------------------------------
  413. #  Some versions of Unix use a pointer to a function returning an
  414. #  integer as the return type of signal(). Newer systems use pointer to
  415. #  function returning void. You need to uncomment this for SunOS v3.x.
  416. #
  417. SIGRET        = -DSIGRET=int
  418. #
  419. #=========================================================================
  420. #
  421. #  Default locations where scantool files will be installed.
  422. #  You might wish to alter these values.
  423. #
  424. BINDIR        = /usr/local/bin
  425. LIBDIR      = /usr/local/lib/scantool
  426. MANDIR        = /usr/local/man/manl
  427. MANSECT        = l
  428. #
  429. #  Compilation flags and standard macro definitions.
  430. #
  431. CFLAGS          = -O  $(HELPNAME) $(SELTYPE) $(SIGRET) $(XVIEWINCDIR)
  432. #
  433. #=========================================================================
  434. X
  435. BINARIES    = sv_scantool scan
  436. X
  437. CC        = cc
  438. X
  439. STDSTSRCS    = scantool.c graphics.c misc.c
  440. STDSTOBJS    = scantool.o graphics.o misc.o
  441. X
  442. STDSSRCS    = scan.c scan_compress.c
  443. STDSOBJS    = scan.o scan_compress.o
  444. X
  445. GSRCS        = sunview.c 
  446. HDRS        = images.h patchlevel.h scan.h scan_extern.h \
  447. X          scantool.h scantool_extern.h
  448. OTHERS        = Makefile CHANGES README black.codes white.codes \
  449. X          Imakefile scantool.help scan.1 scantool.1
  450. IMAGES        = exclaim.icon scantool.icon \
  451. X          button.normal.icon button.invert.icon \
  452. X          switch.normal.cursor switch.invert.cursor \
  453. X          frame.cursor help.cursor main.cursor
  454. X
  455. SFILES1        = $(STDSTSRCS) $(STDSSRCS)
  456. SFILES2        = $(GSRCS) $(HDRS)
  457. SFILES3        = $(OTHERS) $(IMAGES)
  458. X
  459. SVIEWLIBS    = -lsuntool -lsunwindow -lpixrect
  460. X
  461. help:
  462. X        @echo
  463. X        @echo "You need to specify one of the following options:"
  464. X        @echo
  465. X        @echo "  make sunview    - to make the SunView version."
  466. X        @echo
  467. X        @echo "This should be followed by:"
  468. X        @echo
  469. X        @echo "  make install"
  470. X        @echo "  make clean"
  471. X        @echo
  472. X
  473. all:            $(BINARIES)
  474. X
  475. sunview:        sv_scantool scan
  476. X        
  477. sv_scantool:    $(STDSTOBJS) sunview.o
  478. X        $(CC) -o sv_scantool $(CFLAGS) $(STDSTOBJS) \
  479. X                sunview.o $(SVIEWLIBS)
  480. #        -cp sv_scantool scantool
  481. X
  482. scan:        $(STDSOBJS)
  483. X        $(CC) -o scan $(CFLAGS) $(STDSOBJS)
  484. install:
  485. X        install -s -m 751 scantool $(BINDIR)
  486. X        install -s -m 751 scan $(BINDIR)
  487. X        install -c -m 644 black.codes $(LIBDIR)
  488. X        install -c -m 644 white.codes $(LIBDIR)
  489. X        install -c -m 644 scantool.help $(LIBDIR)
  490. X        install -c -m 644 scantool.1 $(MANDIR)/scantool.$(MANSECT)
  491. X        install -c -m 644 scan.1 $(MANDIR)/scan.$(MANSECT)
  492. X
  493. clean:;        rm -rf *.o archive.* *~ scantool $(BINARIES) core
  494. X
  495. shar:;        shar.script $(SFILES1) > Part1
  496. X        shar.script $(SFILES2) > Part2
  497. X        shar.script $(SFILES3) > Part3
  498. X
  499. lint:;        lint $(STDSTSRCS) sunview.c $(SVIEWLIBS)
  500. X        lint $(STDSSRCS)
  501. X        lint $(STDSTSRCS) xview.c   $(XVIEWLIBS)
  502. X
  503. create:         SCCS
  504. X        -sccs create $(STDSTSRCS) $(STDSSRCS) $(GSRCS) \
  505. X                $(HDRS) $(OTHERS) $(IMAGES)
  506. X
  507. SCCS:
  508. X        mkdir SCCS
  509. X        chmod 755 SCCS
  510. X
  511. graphics.o:      graphics.c scantool_extern.h scantool.h
  512. misc.o:          misc.c patchlevel.h scantool_extern.h scantool.h
  513. scan.o:          scan.c patchlevel.h scan.h
  514. scan_compress.o: scan_compress.c scan_extern.h scan.h
  515. scantool.o:      scantool.c scantool.h
  516. sunview.o:       sunview.c scantool_extern.h images.h scantool.h \
  517. X         exclaim.icon scantool.icon \
  518. X         button.normal.icon button.invert.icon \
  519. X         switch.normal.cursor switch.invert.cursor \
  520. X         frame.cursor help.cursor main.cursor
  521. SHAR_EOF
  522. chmod 0644 makefile.sunview ||
  523. echo 'restore of makefile.sunview failed'
  524. Wc_c="`wc -c < 'makefile.sunview'`"
  525. test 4598 -eq "$Wc_c" ||
  526.     echo 'makefile.sunview: original size 4598, current size' "$Wc_c"
  527. rm -f _shar_wnt_.tmp
  528. fi
  529. # ============= misc.c ==============
  530. if test -f 'misc.c' -a X"$1" != X"-c"; then
  531.     echo 'x - skipping misc.c (File already exists)'
  532.     rm -f _shar_wnt_.tmp
  533. else
  534. > _shar_wnt_.tmp
  535. echo 'x - extracting misc.c (Text)'
  536. sed 's/^X//' << 'SHAR_EOF' > 'misc.c' &&
  537. /*  @(#)misc.c 1.4 90/04/04
  538. X *
  539. X *  Miscellaneous routines used by the scantool program.
  540. X *
  541. X *  Copyright (c) Rich Burridge.
  542. X *                Sun Microsystems, Australia - All rights reserved.
  543. X *
  544. X *  Permission is given to distribute these sources, as long as the
  545. X *  copyright messages are not removed, and no monies are exchanged.
  546. X *
  547. X *  No responsibility is taken for any errors or inaccuracies inherent
  548. X *  either to the comments or the code of this program, but if
  549. X *  reported to me, then an attempt will be made to fix them.
  550. X */
  551. X
  552. #include <stdio.h>
  553. #include <ctype.h>
  554. #include <strings.h>
  555. #include "scantool.h"
  556. #include "patchlevel.h"
  557. #include "scantool_extern.h"
  558. X
  559. X
  560. draw_settings()     /* Display text for current scanner settings. */
  561. {
  562. X  int texty = 20 ;
  563. X  int x, y ;
  564. X
  565. X  x = (SCAN_WIDTH - 430) / 2 ;
  566. X  y = (SCAN_HEIGHT - 100) / 2 ;
  567. X  draw_frame(x, y, 430, 100) ;
  568. X
  569. X  SPRINTF(output, "Brightness:  %s", br_strs[brightness-1]) ;
  570. X  draw_text(x+10, y+texty, STEN_OFF, NFONT, output) ;
  571. X  SPRINTF(output, "Contrast:    %s", con_strs[contrast-1]) ;
  572. X  draw_text(x+10, y+texty+15, STEN_OFF, NFONT, output) ;
  573. X  SPRINTF(output, "Grain:       %s", gr_strs[grain]) ;
  574. X  draw_text(x+10, y+texty+30, STEN_OFF, NFONT, output) ;
  575. X  SPRINTF(output, "Resolution:  %s", res_strs[resolution]) ;
  576. X  draw_text(x+10, y+texty+45, STEN_OFF, NFONT, output) ;
  577. X  SPRINTF(output, "Filename:    %s", picname) ;
  578. X  draw_text(x+10, y+texty+60, STEN_OFF, NFONT, output) ;
  579. }
  580. X
  581. X
  582. get_help()                 /* Read the help file and display. */
  583. {
  584. X  char help_str[MAXLINE], *p ;
  585. X  int x, y ;
  586. X  int length = 0 ;         /* Length of longest help line. */
  587. X  int nolines = 0 ;        /* Number of lines in help file. */
  588. X  char line[MAXLINE] ;     /* Current line read from help file. */
  589. X  int texty = 20 ;         /* Initial y coordinate for help message. */
  590. X
  591. X  if (nohelp) make_display("No help file found.") ;
  592. X  else
  593. X    {
  594. X      SPRINTF(help_str, "%%%s%%\n", helpname) ;
  595. X      rewind(hfd) ;
  596. X      while (p = fgets(line, MAXLINE, hfd))
  597. X        if (*p == '%' && EQUAL(p, help_str)) break ;
  598. X      for (;;)             /* Check for the length of the longest line. */
  599. X        {
  600. X          FGETS(line, MAXLINE, hfd) ;
  601. X          if (EQUAL(line, "%%\n")) break ;
  602. X          if (strlen(line) > length) length = strlen(line) ;
  603. X          nolines++ ;
  604. X        }
  605. X      rewind(hfd) ;
  606. X      while (p = fgets(line, MAXLINE, hfd))
  607. X        if (*p == '%' && EQUAL(p, help_str)) break ;
  608. X      set_cursor(HELP_CUR) ;
  609. X      x = (SCAN_WIDTH - length*font_width - 20) / 2 ;
  610. X      y = (SCAN_HEIGHT - nolines*15+texty) / 2 ;
  611. X      draw_frame(x, y, length*font_width+20, nolines*15+texty) ;
  612. X
  613. X      for (;;)
  614. X        {
  615. X          FGETS(line, MAXLINE, hfd) ;
  616. X          if (EQUAL(line, "%%\n")) break ;
  617. X          line[strlen(line)-1] = '\0' ;
  618. X          draw_text(x+10, y+texty, STEN_OFF, NFONT, line) ;
  619. X          texty += 15 ;
  620. X        }
  621. X    }
  622. }
  623. X
  624. X
  625. get_options(argc, argv)        /* Extract command line options. */
  626. int argc ;
  627. char *argv[] ;
  628. {
  629. X  INC ;
  630. X  while (argc > 0)
  631. X    {
  632. X      if (argv[0][0] == '-')
  633. X        switch (argv[0][1])
  634. X          {
  635. X            case 'h' : INC ;                         /* Help filename. */
  636. X                       getparam(helpname, argv, "-h needs help filename") ;
  637. X                       break ;
  638. X            case 'v' : FPRINTF(stderr, "%s version 1.4.%1d\n",
  639. X                                        progname, PATCHLEVEL) ;
  640. X                       break ;
  641. X            case '?' : usage() ;
  642. X          }
  643. X      INC ;
  644. X    }
  645. }
  646. X
  647. X
  648. getparam(s, argv, errmes)
  649. char *s, *argv[], *errmes ;
  650. {
  651. X  if (*argv != NULL && argv[0][0] != '-') STRCPY(s, *argv) ;
  652. X  else
  653. X    { 
  654. X      FPRINTF(stderr,"%s: %s as next argument.\n", progname, errmes) ;
  655. X      exit(1) ;
  656. X    }
  657. }
  658. X
  659. X
  660. make_button(x, y, text, state)      /* Draw a text button. */
  661. int x, y ;
  662. char *text ;
  663. enum image_type state ;
  664. {
  665. X  enum sten_type stencil ;
  666. X
  667. X  draw_image(x, y, BUTTON_WIDTH, BUTTON_HEIGHT, state) ;
  668. X  width = get_strwidth(BFONT, text) ;
  669. X  if (state == B_NORMAL) stencil = STEN_ON ;
  670. X  else                   stencil = STEN_INV ;
  671. X  draw_text(x + ((64 - width) / 2),
  672. X            y + FONT_HEIGHT + ((BUTTON_HEIGHT - FONT_HEIGHT) / 2) - 5,
  673. X            stencil, BFONT, text) ;
  674. }
  675. X
  676. make_display(output)       /* Output message to the display window. */
  677. char *output ;
  678. {
  679. X  STRCPY(last_message, output) ;  /* Save in case of a redraw. */
  680. X  make_message() ;                /* Output message as popup to the canvas. */
  681. }
  682. X
  683. X
  684. make_help(value)
  685. {
  686. X  if (value)
  687. X    {
  688. X      STRCPY(helpname, help_strs[value-1]) ;
  689. X      if (isupper(helpname[0])) helpname[0] = tolower(helpname[0]) ;
  690. X      get_help() ;             /* Read the help file and display. */
  691. X      drawstate = DO_HELP ;
  692. X      butx = buty = 0 ;
  693. X    }
  694. }
  695. X
  696. X
  697. make_message()      /* Output message to the display window. */
  698. {
  699. X  int x, y ;
  700. X
  701. X  width = strlen(last_message) * font_width + 20 ;
  702. X  if (width < 300) width = 300 ;
  703. X  x = (SCAN_WIDTH - width) / 2 ;
  704. X  y = (SCAN_HEIGHT - 90) / 2 ;
  705. X  draw_frame(x, y, width, 90) ;
  706. X  draw_image(x + 30, y + 15, 64, 64, EXCLAIM_IMAGE) ;
  707. X  butx = x + width - 90 ;
  708. X  buty = y + 15 ;
  709. X  make_button(x + width - 90, y + 15, "OK", B_NORMAL) ;
  710. X  draw_text(x + 10, y + 65, STEN_OFF, NFONT, last_message) ;
  711. X  drawstate = DO_MESSAGE ;
  712. }
  713. X
  714. X
  715. make_scan()    /* Start scanning process, and wait for it to terminate. */
  716. {
  717. X  char arg_contrast[MAXLINE] ;      /* Contrast value. */
  718. X  char arg_brightness[MAXLINE] ;    /* Brightness value. */
  719. X  char arg_datatrans[MAXLINE] ;     /* Data transfer (or blank). */
  720. X  char arg_framevals[4][MAXLINE] ;  /* Scanning frame values. */
  721. X  char arg_grain[MAXLINE] ;         /* Grain value. */
  722. X  char arg_mode[MAXLINE] ;          /* Mode (or blank). */
  723. X  char arg_picname[MAXLINE] ;       /* Picture name. */
  724. X  char arg_resolution[MAXLINE] ;    /* Resolution value. */
  725. X  char arg_speed[MAXLINE] ;         /* Speed of connection (or blank). */
  726. X  char arg_ttyport[MAXLINE] ;       /* Tty port (or blank). */
  727. X
  728. X  SPRINTF(arg_brightness,    "%1d", brightness) ;
  729. X  SPRINTF(arg_contrast,      "%1d", contrast) ;
  730. X  SPRINTF(arg_datatrans,     "%1d", switches[DATA_TRANSFER]) ;
  731. X  SPRINTF(arg_framevals[X1], "%1d", framevals[X1]) ;
  732. X  SPRINTF(arg_framevals[Y1], "%1d", framevals[Y1]) ;
  733. X  SPRINTF(arg_framevals[X2], "%1d", framevals[X2]) ;
  734. X  SPRINTF(arg_framevals[Y2], "%1d", framevals[Y2]) ;
  735. X  SPRINTF(arg_grain,         "%1d", grain) ;
  736. X  SPRINTF(arg_mode,          "%1d", switches[MODE]) ;
  737. X  SPRINTF(arg_picname,       "%s",  picname) ;
  738. X  SPRINTF(arg_resolution,    "%1d", resolution) ;
  739. X  SPRINTF(arg_speed,         "%1d", switches[BAUD_RATE]) ;
  740. X  SPRINTF(arg_ttyport,       "%1d", switches[SERIAL_PORT]) ;
  741. X
  742. X  if (scanning)
  743. X    {
  744. X      make_display("There is a scan already in progress") ;
  745. X      return ;
  746. X    }
  747. X  scanning = 1 ;
  748. X  make_button(SCAN_WIDTH-150, 4*SWITCH_HEIGHT+20, "Scan", B_INVERT) ;
  749. X  if ((pid = vfork()) == 0)
  750. X    {
  751. X      EXECL("scan"," ","-c", arg_contrast, "-b", arg_brightness,
  752. X                    "-d", arg_datatrans,  "-f", arg_framevals[X1],
  753. X                    arg_framevals[Y1], arg_framevals[X2], arg_framevals[Y2],
  754. X                    "-g", arg_grain,      "-m", arg_mode,
  755. X                    "-p", arg_picname,    "-r", arg_resolution,
  756. X                    "-s", arg_speed,      "-t", arg_ttyport,
  757. X                    (char *) 0) ;
  758. X      FPRINTF(stderr, "%s: Couldn't fork the scan process.\n", progname) ;
  759. X      exit(1) ;                 /* Should never get here. */
  760. X    }
  761. X  wait_on_child(pid) ;
  762. }
  763. X
  764. X
  765. make_set(value)
  766. int value ;
  767. {
  768. X  switch (value)
  769. X    {
  770. X      case SET_PICTURE     : STRCPY(old_picname, picname) ;
  771. X                             draw_picarea() ;
  772. X                             break ;
  773. X      case SET_DEFAULTS    : set_defaults() ;
  774. X                             break ;
  775. X      case SET_CLEAR_FRAME : framevals[X1] = 0 ;
  776. X                             framevals[Y1] = 0 ;
  777. X                             framevals[X2] = 68 ;
  778. X                             framevals[Y2] = 88 ;
  779. X                             draw_area(SCAN_FRAME_X+2, SCAN_FRAME_Y+2,
  780. X                                       34*LINEGAP-4, 44*LINEGAP-4, GCLR) ;
  781. X                             draw_area(SCAN_FRAME_X-9, SCAN_FRAME_Y,
  782. X                                       9, 46*LINEGAP-1, GCLR) ;
  783. X                             draw_area(SCAN_FRAME_X, SCAN_FRAME_Y-9,
  784. X                                       34*LINEGAP-1, 9, GCLR) ;
  785. X                             break ;
  786. X      case SET_NEW_FRAME   : select_frame() ;
  787. X                             break ;
  788. X      case SET_CURRENT     : show_settings() ;
  789. X    } 
  790. }
  791. make_switch(x, y, title, boxa, boxb)
  792. int x, y ;
  793. char *title, *boxa, *boxb ;
  794. {
  795. X  draw_text(x, y, STEN_OFF, BFONT, title) ;
  796. X  set_switch(x, y+10, OFF) ;
  797. X  draw_text(x+30, y+20, STEN_OFF, BFONT, boxa) ;
  798. X  set_switch(x, y+30, OFF) ;
  799. X  draw_text(x+30, y+40, STEN_OFF, BFONT, boxb) ;
  800. }
  801. X
  802. X
  803. process_menu(mtype, value)        /* Process a menu choice. */
  804. enum menu_type mtype ;
  805. int value ;
  806. {
  807. X  switch (mtype)
  808. X    {
  809. X      case BRIGHTNESS_M : brightness = value ;
  810. X                          break ;
  811. X      case CONTRAST_M   : contrast = value ;
  812. X                          break ;
  813. X      case GRAIN_M      : grain = value-1 ;
  814. X                          break ;
  815. X      case HELP_M       : make_help(value) ;
  816. X                          break ;
  817. X      case RESOLUTION_M : resolution = value-1 ;
  818. X                          break ;
  819. X      case SET_M        : make_set(value) ;
  820. X    }
  821. }
  822. X
  823. X
  824. set_defaults()       /* Return scanner setting to default. */
  825. {
  826. X  brightness = 7 ;   /* Brightness value (no adjustment). */
  827. X  contrast = 7 ;     /* Contrast value (no adjustment). */
  828. X  grain = 2 ;        /* Grain value (grain size: 8x8  levels: 33). */
  829. X  resolution = 0 ;   /* Resolution value (300 dpi). */
  830. }
  831. X
  832. X
  833. show_settings()      /* Display current scanner settings in a popup window. */
  834. {
  835. X  draw_settings() ;           /* Display setting values. */
  836. X  drawstate = DO_SETTINGS ;
  837. X  butx = buty = 0 ;
  838. }
  839. X
  840. X
  841. test_switch(x, y)       /* Test for a switch box being pressed. */
  842. int x, y ;
  843. {
  844. X  int i, j ;
  845. X
  846. X  if (x > SCAN_WIDTH-150 && x < SCAN_WIDTH-130)
  847. X    for (i = 0; i < 2; i++)
  848. X      for (j = 0; j < 4; j++)
  849. X        if ((y > j*SWITCH_HEIGHT+50+i*20) && (y < j*SWITCH_HEIGHT+70+i*20))
  850. X          if (i)
  851. X            {   
  852. X              set_switch(SCAN_WIDTH-150, j*SWITCH_HEIGHT+50, OFF) ;
  853. X              set_switch(SCAN_WIDTH-150, j*SWITCH_HEIGHT+70, ON) ;
  854. X              switches[j] = i ;
  855. X            }
  856. X          else
  857. X            { 
  858. X              set_switch(SCAN_WIDTH-150, j*SWITCH_HEIGHT+50, ON) ;
  859. X              set_switch(SCAN_WIDTH-150, j*SWITCH_HEIGHT+70, OFF) ;
  860. X              switches[j] = i ;
  861. X            }
  862. }
  863. X
  864. X
  865. usage()
  866. {
  867. X  FPRINTF(stderr, "Usage: %s: [-h helpname] [-v] [-?]\n", progname) ;
  868. X  exit(1) ;
  869. }
  870. X
  871. X
  872. wait_for_ok()    /* Wait for user to acknowledge. */
  873. {
  874. X  int doexit = 0 ;
  875. X
  876. X  switch (type)
  877. X    {
  878. X      case LEFT_DOWN : if (butx && buty)
  879. X                         {
  880. X                           if (curx > butx && curx < butx+BUTTON_WIDTH &&
  881. X                               cury > buty && cury < buty+BUTTON_HEIGHT)
  882. X                             {
  883. X                               make_button(butx, buty, "OK", B_INVERT) ;
  884. X                               doexit = 1 ;
  885. X                             }
  886. X                         }
  887. X                       else doexit = 1 ;
  888. X                       break ;
  889. X      case KEYBOARD  : if (cur_ch == LINEFEED || cur_ch == RETURN)
  890. X                         doexit = 1 ;
  891. X    }
  892. X  if (doexit)
  893. X    {
  894. X      set_cursor(MAIN_CUR) ;
  895. X      drawstate = DO_NOTHING ;
  896. X      do_repaint() ;
  897. X    }        
  898. }
  899. SHAR_EOF
  900. chmod 0644 misc.c ||
  901. echo 'restore of misc.c failed'
  902. Wc_c="`wc -c < 'misc.c'`"
  903. test 11483 -eq "$Wc_c" ||
  904.     echo 'misc.c: original size 11483, current size' "$Wc_c"
  905. rm -f _shar_wnt_.tmp
  906. fi
  907. # ============= notify.h ==============
  908. if test -f 'notify.h' -a X"$1" != X"-c"; then
  909.     echo 'x - skipping notify.h (File already exists)'
  910.     rm -f _shar_wnt_.tmp
  911. else
  912. > _shar_wnt_.tmp
  913. echo 'x - extracting notify.h (Text)'
  914. sed 's/^X//' << 'SHAR_EOF' > 'notify.h' &&
  915. X
  916. /*    @(#)notify.h 20.18 90/06/19 SMI    */
  917. X
  918. /*
  919. X *    (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents 
  920. X *    pending in the U.S. and foreign countries. See LEGAL NOTICE 
  921. X *    file for terms of the license.
  922. X */
  923. X
  924. #ifndef    xview_notify_DEFINED
  925. #define    xview_notify_DEFINED
  926. X
  927. /*
  928. X ***********************************************************************
  929. X *            Include Files
  930. X ***********************************************************************
  931. X */
  932. X
  933. #include <sys/types.h>
  934. #include <xview/base.h>
  935. X
  936. /*
  937. X ***********************************************************************
  938. X *            Definitions and Macros
  939. X ***********************************************************************
  940. X */
  941. X
  942. /*
  943. X * PUBLIC #defines 
  944. X */
  945. X
  946. #define    NOTIFY_FUNC_NULL    ((Notify_func)0)
  947. X
  948. /*      Macros to examine wait3/waitpid results provided for BSD rather
  949. X *      than adding a lot of #ifdef'ed code in the .c's.  Note that AT&T-
  950. X *      style macros expect the status value (not a pointer to it).
  951. X *      Also provide a dummy rusage structure in the non-BSD case.
  952. X */
  953. #if  !(defined WTERMSIG) && !(defined SVR4)
  954. #define WTERMSIG(status)        ((status).w_termsig)
  955. #endif
  956. #if  !(defined WSTOPSIG) && !(defined SVR4)
  957. #define WSTOPSIG(status)        ((status).w_stopsig)
  958. #endif
  959. #if  !(defined WEXITSTATUS) && !(defined SVR4)
  960. #define WEXITSTATUS(status)     ((status).w_retcode)
  961. #endif
  962. #if  !(defined WCOREDUMP) && !(defined SVR4)
  963. #define WCOREDUMP(status)       ((status).w_coredump)
  964. #endif
  965. #ifdef SVR4
  966. struct rusage {
  967. X    int     notused;                /* to make it valid */
  968. };
  969. #endif SVR4
  970. /*
  971. X * PRIVATE #defines 
  972. X */
  973. X
  974. #define NOTIFY_CLIENT_NULL    ((Notify_client)0)
  975. #define    NOTIFY_COPY_NULL    ((Notify_copy)0)
  976. #define    NOTIFY_RELEASE_NULL    ((Notify_release)0)
  977. #define    NOTIFY_ARG_NULL        ((Notify_arg)0)
  978. X
  979. /*
  980. X * Mask bit generating macros     (for prioritizer):
  981. X */
  982. #define    SIG_BIT(sig)        (1 << ((sig)-1))
  983. X
  984. /*
  985. X ***********************************************************************
  986. X *        Typedefs, enumerations, and structures
  987. X ***********************************************************************
  988. X */
  989. X
  990. /*
  991. X * Opaque client handle.
  992. X */
  993. typedef    Xv_opaque Notify_client;
  994. X
  995. #ifndef _NOTIFY_MIN_SYMBOLS    /* Hack to reduce symbols in libraries. */
  996. X
  997. /*
  998. X * Opaque client event.
  999. X */
  1000. typedef    Xv_opaque Notify_event;
  1001. X
  1002. /*
  1003. X * Opaque client event optional argument.
  1004. X */
  1005. typedef    Xv_opaque Notify_arg;
  1006. X
  1007. /*
  1008. X * A pointer to a function returning a Notify_arg (used for client
  1009. X * event additional argument copying).
  1010. X */
  1011. typedef    Notify_arg (*Notify_copy)();
  1012. X
  1013. /*
  1014. X * A pointer to a function returning void (used for client
  1015. X * event additional argument storage releasing).
  1016. X */
  1017. typedef    void (*Notify_release)();
  1018. X
  1019. /*
  1020. X * For Debugging utility:
  1021. X */
  1022. typedef    enum notify_dump_type {
  1023. X    NOTIFY_ALL=0,
  1024. X    NOTIFY_DETECT=1,
  1025. X    NOTIFY_DISPATCH=2,
  1026. } Notify_dump_type;
  1027. X
  1028. #endif ~_NOTIFY_MIN_SYMBOLS
  1029. X
  1030. /*
  1031. X * Client notification function return values for notifier to client calls.
  1032. X */
  1033. typedef enum notify_value {
  1034. X    NOTIFY_DONE        = 0,    /* Handled notification */
  1035. X    NOTIFY_IGNORED        = 1,    /* Did nothing about notification */
  1036. X    NOTIFY_UNEXPECTED    = 2,    /* Notification not expected */
  1037. } Notify_value;
  1038. X
  1039. /*
  1040. X * A pointer to a function returning a Notify_value.
  1041. X */
  1042. typedef    Notify_value (*Notify_func)();
  1043. X
  1044. /*
  1045. X * Error codes for client to notifier calls (returned when no other
  1046. X * return value or stored in notify_errno when other return value
  1047. X * indicates error condition).
  1048. X */
  1049. typedef enum notify_error {
  1050. X    NOTIFY_OK        = 0,    /* Success */
  1051. X    NOTIFY_UNKNOWN_CLIENT    = 1,    /* Client argument unknown to notifier */
  1052. X    NOTIFY_NO_CONDITION    = 2,    /* Client not registered for given 
  1053. X                     * condition 
  1054. X                     */
  1055. X    NOTIFY_BAD_ITIMER    = 3,    /* Itimer type unknown */
  1056. X    NOTIFY_BAD_SIGNAL    = 4,    /* Signal number out of range */
  1057. X    NOTIFY_NOT_STARTED    = 5,    /* Notify_stop called & notifier not 
  1058. X                     * started 
  1059. X                     */
  1060. X    NOTIFY_DESTROY_VETOED    = 6,    /* Some client didn't want to die when 
  1061. X                     * called notify_die(DESTROY_CHECKING)
  1062. X                     */
  1063. X    NOTIFY_INTERNAL_ERROR    = 7,    /* Something wrong in the notifier */
  1064. X    NOTIFY_SRCH        = 8,    /* No such process */
  1065. X    NOTIFY_BADF        = 9,    /* Bad file number */
  1066. X    NOTIFY_NOMEM        = 10,    /* Not enough core */
  1067. X    NOTIFY_INVAL        = 11,    /* Invalid argument */
  1068. X    NOTIFY_FUNC_LIMIT    = 12,    /* Too many interposition functions */
  1069. } Notify_error;
  1070. X
  1071. X
  1072. /*
  1073. X * Argument types
  1074. X */
  1075. typedef enum notify_signal_mode {
  1076. X    NOTIFY_SYNC        = 0,
  1077. X    NOTIFY_ASYNC        = 1,
  1078. } Notify_signal_mode;
  1079. X
  1080. typedef enum notify_event_type {
  1081. X    NOTIFY_SAFE        = 0,
  1082. X    NOTIFY_IMMEDIATE    = 1,
  1083. } Notify_event_type;
  1084. X
  1085. typedef enum destroy_status {
  1086. X    DESTROY_PROCESS_DEATH    = 0,
  1087. X    DESTROY_CHECKING    = 1,
  1088. X    DESTROY_CLEANUP        = 2,
  1089. X    DESTROY_SAVE_YOURSELF    = 3,
  1090. } Destroy_status;
  1091. X
  1092. /*
  1093. X ***********************************************************************
  1094. X *                Globals
  1095. X ***********************************************************************
  1096. X */
  1097. X
  1098. /*
  1099. X * PUBLIC variables 
  1100. X */
  1101. X
  1102. extern    struct itimerval NOTIFY_POLLING_ITIMER;    /* {{0,1},{0,1}} */
  1103. X
  1104. /*
  1105. X * PRIVATE variables 
  1106. X */
  1107. X
  1108. extern    Notify_error notify_errno;
  1109. X
  1110. #ifndef _NOTIFY_MIN_SYMBOLS
  1111. extern    struct itimerval NOTIFY_NO_ITIMER;    /* {{0,0},{0,0}} */
  1112. #endif    ~_NOTIFY_MIN_SYMBOLS
  1113. X
  1114. /*
  1115. X * PUBLIC functions 
  1116. X */
  1117. X
  1118. #ifndef _NOTIFY_MIN_SYMBOLS
  1119. X
  1120. EXTERN_FUNCTION (Notify_value     notify_default_wait3, (Notify_client nclient, int pid, union wait *status, struct rusage *rusage));
  1121. EXTERN_FUNCTION (Notify_error     notify_dispatch, (void));
  1122. EXTERN_FUNCTION (Notify_error    notify_do_dispatch, (void));
  1123. EXTERN_FUNCTION (Notify_error     notify_itimer_value, (Notify_client nclient, int which, struct itimerval *value));
  1124. EXTERN_FUNCTION (Notify_value     notify_next_destroy_func, (Notify_client nclient, Destroy_status status));
  1125. EXTERN_FUNCTION (Notify_value     notify_next_event_func, (Notify_client nclient, Notify_event event, Notify_arg arg, Notify_event_type when));
  1126. EXTERN_FUNCTION (Notify_error     notify_no_dispatch, (void));
  1127. EXTERN_FUNCTION (Notify_func     notify_set_destroy_func, (Notify_client nclient, Notify_func func));
  1128. EXTERN_FUNCTION (Notify_func     notify_set_exception_func, (Notify_client nclient, Notify_func func, int fd));
  1129. EXTERN_FUNCTION (Notify_func     notify_set_input_func, (Notify_client nclient, Notify_func func, int fd));
  1130. EXTERN_FUNCTION (Notify_func     notify_set_itimer_func, (Notify_client nclient, Notify_func func, int which, struct itimerval *value, struct itimerval *ovalue));
  1131. EXTERN_FUNCTION (Notify_func     notify_set_output_func, (Notify_client nclient,     Notify_func func, int fd));
  1132. EXTERN_FUNCTION (Notify_func     notify_set_signal_func, (Notify_client nclient,    Notify_func func, int sig, Notify_signal_mode mode));
  1133. EXTERN_FUNCTION (Notify_func     notify_set_wait3_func,     (Notify_client nclient, Notify_func func, int pid));
  1134. EXTERN_FUNCTION (Notify_error     notify_start, (void));
  1135. EXTERN_FUNCTION (Notify_error     notify_stop, (void));
  1136. EXTERN_FUNCTION (Notify_error     notify_veto_destroy, (Notify_client nclient));
  1137. EXTERN_FUNCTION (void         notify_perror, (char *str));
  1138. X
  1139. #endif    ~_NOTIFY_MIN_SYMBOLS
  1140. X
  1141. /*
  1142. X * PRIVATE functions 
  1143. X */
  1144. X
  1145. EXTERN_FUNCTION (Notify_func     notify_set_event_func, (Notify_client nclient, Notify_func func, Notify_event_type when));
  1146. EXTERN_FUNCTION (Notify_error     notify_remove, (Notify_client nclient));
  1147. X
  1148. #ifndef _NOTIFY_MIN_SYMBOLS
  1149. X
  1150. EXTERN_FUNCTION (Notify_error     notify_client, (Notify_client nclient));
  1151. EXTERN_FUNCTION (Notify_error     notify_destroy, (Notify_client nclient, Destroy_status status));
  1152. EXTERN_FUNCTION (Notify_error     notify_die, (Destroy_status status));
  1153. EXTERN_FUNCTION (Notify_error     notify_event, (Notify_client nclient, Notify_event event, Notify_arg arg));
  1154. EXTERN_FUNCTION (Notify_error     notify_exception, (Notify_client nclient, int fd));
  1155. EXTERN_FUNCTION (void         notify_flush_pending, (Notify_client nclient));
  1156. EXTERN_FUNCTION (Notify_func     notify_get_destroy_func, (Notify_client));
  1157. EXTERN_FUNCTION (Notify_func     notify_get_event_func, (Notify_client nclient, Notify_event_type when));
  1158. EXTERN_FUNCTION (Notify_func     notify_get_exception_func, (Notify_client nclient, int fd));
  1159. EXTERN_FUNCTION (Notify_func    notify_get_input_func, (Notify_client nclient, int fd));
  1160. EXTERN_FUNCTION (Notify_func    notify_get_itimer_func,    (Notify_client nclient, int which));
  1161. EXTERN_FUNCTION (Notify_func     notify_get_output_func, (Notify_client nclient, int fd));
  1162. EXTERN_FUNCTION (Notify_func     notify_get_prioritizer_func, (Notify_client nclient));
  1163. EXTERN_FUNCTION (Notify_func     notify_get_scheduler_func, (void));
  1164. EXTERN_FUNCTION (int         notify_get_signal_code, (void));
  1165. #ifndef SVR4
  1166. EXTERN_FUNCTION (struct sigcontext *notify_get_signal_context, (void));
  1167. #else SVR4
  1168. EXTERN_FUNCTION (struct ucontext_t *notify_get_signal_context, (void));
  1169. #endif SVR4
  1170. EXTERN_FUNCTION (Notify_func     notify_get_signal_func, (Notify_client nclient, int signal, Notify_signal_mode mode));
  1171. EXTERN_FUNCTION (Notify_func     notify_get_wait3_func, (Notify_client nclient, int pid));
  1172. EXTERN_FUNCTION (Notify_error    notify_input, (Notify_client nclient, int fd));
  1173. EXTERN_FUNCTION (Notify_error    notify_interpose_destroy_func, (Notify_client nclient, Notify_func func));
  1174. EXTERN_FUNCTION (Notify_error     notify_interpose_event_func, (Notify_client nclient, Notify_func func, Notify_event_type when));
  1175. EXTERN_FUNCTION (Notify_error    notify_interpose_exception_func, (Notify_client nclient, Notify_func func, int fd));
  1176. EXTERN_FUNCTION (Notify_error    notify_interpose_input_func, (Notify_client nclient, Notify_func func, int fd));
  1177. EXTERN_FUNCTION (Notify_error    notify_interpose_itimer_func, (Notify_client nclient, Notify_func func, int which));
  1178. EXTERN_FUNCTION (Notify_error     notify_interpose_output_func, (Notify_client nclient, Notify_func func, int fd));
  1179. EXTERN_FUNCTION (Notify_error     notify_interpose_signal_func, (Notify_client nclient, Notify_func func, int signal, Notify_signal_mode mode));
  1180. EXTERN_FUNCTION (Notify_error    notify_interpose_wait3_func, (Notify_client nclient, Notify_func func, int pid));
  1181. EXTERN_FUNCTION (Notify_error     notify_itimer,     (Notify_client nclient, int which));
  1182. EXTERN_FUNCTION (Notify_value     notify_next_exception_func, (Notify_client nclient, int fd));
  1183. EXTERN_FUNCTION (Notify_value     notify_next_input_func, (Notify_client nclient, int fd));
  1184. EXTERN_FUNCTION (Notify_value     notify_next_itimer_func, (Notify_client nclient, int which));
  1185. EXTERN_FUNCTION (Notify_value    notify_next_output_func, (Notify_client nclient, int fd));
  1186. EXTERN_FUNCTION (Notify_value     notify_next_signal_func, (Notify_client nclient, int signal, Notify_signal_mode mode));
  1187. EXTERN_FUNCTION (Notify_value     notify_next_wait3_func, (Notify_client nclient, int pid, union wait *status, struct rusage *rusage));
  1188. EXTERN_FUNCTION (Notify_value    notify_nop, (void));
  1189. EXTERN_FUNCTION (Notify_error     notify_output, (Notify_client nclient, int fd));
  1190. EXTERN_FUNCTION (Notify_error    notify_post_destroy, (Notify_client nclient, Destroy_status status, Notify_event_type type));
  1191. EXTERN_FUNCTION (Notify_error     notify_post_event, (Notify_client nclient, Notify_event event,     Notify_event_type when_hint));
  1192. EXTERN_FUNCTION (Notify_error     notify_post_event_and_arg, (Notify_client nclient, Notify_event event, Notify_event_type when_hint, Notify_copy copy_func, Notify_release release_func));
  1193. EXTERN_FUNCTION (Notify_error     notify_remove_destroy_func, (Notify_client nclient, Notify_func func));
  1194. EXTERN_FUNCTION (Notify_error     notify_remove_event_func, (Notify_client nclient, Notify_func func, Notify_event_type when));
  1195. SHAR_EOF
  1196. true || echo 'restore of notify.h failed'
  1197. fi
  1198. echo 'End of  part 2'
  1199. echo 'File notify.h is continued in part 3'
  1200. echo 3 > _shar_seq_.tmp
  1201. exit 0
  1202.