home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume27 / sfs / part01 next >
Encoding:
Text File  |  1991-12-27  |  57.3 KB  |  2,027 lines

  1. Newsgroups: comp.sources.misc
  2. From: tcamp@hercules.acpub.duke.edu (Ted Campbell)
  3. Subject:  v27i001:  sfs - Space Flight Simulator, Part01/21
  4. Message-ID: <csm-v27i001=sfs.224917@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 17b4173cff3241dc4cce3b900a528ace
  6. Date: Tue, 24 Dec 1991 04:50:21 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: tcamp@hercules.acpub.duke.edu (Ted Campbell)
  10. Posting-number: Volume 27, Issue 1
  11. Archive-name: sfs/part01
  12. Environment: IBMPC && EGA/VGA, UNIX-PC && MGR, UNIX && X11,
  13.  
  14. [ This submission contains uuencoded files and requires uudecode ]
  15. [ to be in your PATH to successfully unpack.            -Kent+   ]
  16.  
  17. Bywater Software is pleased to announce the public availability
  18. of its Space Flight Simulator and User Interface in their first 
  19. complete release, version 1.01.  This software is copyright (c) 
  20. 1991, Ted A. Campbell, and is released under the terms of an 
  21. agreement specified in the file "sfs.ro" and in source code
  22. file headers.  
  23.  
  24. Description:    The Space Flight Simulator offers a graphics-based,
  25.         real-time, animated simulation of orbital flight.  
  26.         Users can develop simulations by specifying a complete
  27.         range of orbital parameters, and can develop simulations
  28.         for all of the planets of the solar system and for some
  29.         other celestial bodies.  A particularly full map is
  30.         given of the earth, which can be viewed as it would
  31.         appear from the orbiting spacecraft, as a ground-track
  32.         map, or as a "distant perspective" in which the earth
  33.         (or another orbital focus) and the orbital track can
  34.         be seen together.
  35.  
  36. User Interface:    The User Interface (ui) was developed to underly
  37.         Bywater's Space Flight Simulator (also available).
  38.         It offers implementation of mouse, window, icon,
  39.         menu, dialog boxes, and other widgets for the
  40.         development of a user environment.
  41.  
  42. Implementation:    Current implementations of the User Interface (ui)
  43.         for which source code is included are the following:
  44.         (a) IBM PC and compatibles, utilizing the Microsoft
  45.         QuickC compiler and requiring Hercules, EGA, or
  46.         VGA graphics; (b) the AT&T Unix PC with a primary
  47.         implementation for the TAM subsystem, and a rather
  48.         poorer implementation for the MGR windowing system;
  49.         (c) Unix-based computers utilizing the X Windows 
  50.         system, version 11 (tested on DecStation 2100 and
  51.         3100).
  52.  
  53. Binaries:    Binaries are available on duke.cs.duke.edu in the
  54.         directory pub/bywater for the IBM PC and compatibles, 
  55.         requiring Hercules, EGA, or VGA graphics.
  56.  
  57.  
  58. Communications:    Bywater Software
  59.         P. O. Box 4023
  60.         Duke Station
  61.         Durham, NC  27707
  62.         USA
  63.  
  64.         email: tcamp@hercules.acpub.duke.edu
  65. -----------------------------------------------------------------------
  66. #!/bin/sh
  67. # This is a shell archive (produced by shar 3.49)
  68. # To extract the files from this archive, save it to a file, remove
  69. # everything above the "!/bin/sh" line above, and type "sh file_name".
  70. #
  71. # made 12/23/1991 20:30 UTC by kent@sparky.IMD.Sterling.COM
  72. #
  73. # existing files will NOT be overwritten unless -c is specified
  74. #
  75. # This is part 1 of a multipart archive                                    
  76. # do not concatenate these parts, unpack them in order with /bin/sh        
  77. #
  78. # This shar contains:
  79. # length  mode       name
  80. # ------ ---------- ------------------------------------------
  81. #   2555 -rw-rw-r-- README
  82. #   1990 -rw-rw-r-- README.first
  83. #   2939 -rw-r--r-- README.sfs
  84. #   2119 -rw-r--r-- README.ui
  85. #   1391 -rw-r--r-- io/bw/bw.h
  86. #   1020 -rw-r--r-- io/bw/bw_cpy.h
  87. #   1641 -rw-r--r-- io/dr/dr.h
  88. #   3516 -rw-r--r-- io/dr/dr_ibmpc.c
  89. #   2379 -rw-r--r-- io/dr/dr_spec.c
  90. #   4111 -rw-r--r-- io/dr/dr_sysv.c
  91. #   2371 -rw-r--r-- io/dr/dr_test.c
  92. #    553 -rw-r--r-- io/dr/dr_test.mak
  93. #   4258 -rw-r--r-- io/dr/dr_unix.c
  94. #   4574 -rw-r--r-- io/gr/gr.h
  95. #  12686 -rw-r--r-- io/gr/gr_def.c
  96. #  34235 -rw-r--r-- io/gr/gr_ibmpc.c
  97. #  23877 -rw-r--r-- io/gr/gr_mgr.c
  98. #  17026 -rw-r--r-- io/gr/gr_spec.c
  99. #  27360 -rw-r--r-- io/gr/gr_tam.c
  100. #  13731 -rw-r--r-- io/gr/gr_test.c
  101. #    643 -rw-r--r-- io/gr/gr_test.mak
  102. #  30654 -rw-r--r-- io/gr/gr_x.c
  103. #    299 -rw-r--r-- io/gr/makefile.tam
  104. #   1891 -rw-r--r-- io/kb/kb.h
  105. #  12842 -rw-r--r-- io/kb/kb_7300.c
  106. #   6035 -rw-r--r-- io/kb/kb_cpm.c
  107. #   6597 -rw-r--r-- io/kb/kb_ibmpc.c
  108. #   3370 -rw-r--r-- io/kb/kb_spec.c
  109. #   5260 -rw-r--r-- io/kb/kb_sysv.c
  110. #   2861 -rw-r--r-- io/kb/kb_test.c
  111. #   3981 -rw-r--r-- io/kb/kb_x.c
  112. #   1832 -rw-r--r-- io/tw/tw.h
  113. #   6629 -rw-r--r-- io/tw/tw_ibmpc.c
  114. #   2119 -rw-r--r-- io/ui/README.ui
  115. #    177 -rw-r--r-- io/ui/backgrnd.pbm
  116. #    221 -rw-r--r-- io/ui/blank.pbm
  117. #    539 -rw-r--r-- io/ui/buildlib.bat
  118. #   1145 -rw-r--r-- io/ui/buildlib.sh
  119. #   2941 -rw-r--r-- io/ui/bywater.pbm
  120. #    144 -rw-r--r-- io/ui/cleanlib.bat
  121. #     68 -rw-r--r-- io/ui/cleanlib.sh
  122. #    132 -rw-r--r-- io/ui/close.pbm
  123. #    944 -rw-r--r-- io/ui/default.pbm
  124. #    221 -rw-r--r-- io/ui/down.pbm
  125. #    231 -rw-r--r-- io/ui/elevator.pbm
  126. #    941 -rw-r--r-- io/ui/exec.pbm
  127. #   1220 -rw-r--r-- io/ui/filesys.pbm
  128. #   1219 -rw-r--r-- io/ui/floppy.pbm
  129. #    943 -rw-r--r-- io/ui/folder.pbm
  130. #    857 -rw-r--r-- io/ui/garbage.pbm
  131. #    221 -rw-r--r-- io/ui/left.pbm
  132. #    536 -rw-r--r-- io/ui/makefile.mgr
  133. #    602 -rw-r--r-- io/ui/makefile.tam
  134. #    543 -rw-r--r-- io/ui/makefile.x
  135. #    260 -rw-r--r-- io/ui/move.pbm
  136. #    316 -rw-r--r-- io/ui/qrf.bat
  137. #    262 -rw-r--r-- io/ui/resize.pbm
  138. #    221 -rw-r--r-- io/ui/right.pbm
  139. #   1975 -rw-r--r-- io/ui/synapsis.pbm
  140. #   2941 -rw-r--r-- io/ui/test.pbm
  141. #  45150 -rw-r--r-- io/ui/ui.doc
  142. #  10420 -rw-r--r-- io/ui/ui.h
  143. #   9808 -rw-r--r-- io/ui/ui_boxes.c
  144. #   2853 -rw-r--r-- io/ui/ui_clock.c
  145. #   9126 -rw-r--r-- io/ui/ui_dial.c
  146. #   2866 -rw-r--r-- io/ui/ui_gets.c
  147. #  31158 -rw-r--r-- io/ui/ui_icon.c
  148. #   3779 -rw-r--r-- io/ui/ui_init.c
  149. #  37627 -rw-r--r-- io/ui/ui_list.c
  150. #   7475 -rw-r--r-- io/ui/ui_pbm.c
  151. #  11199 -rw-r--r-- io/ui/ui_rband.c
  152. #  11977 -rw-r--r-- io/ui/ui_test.c
  153. #   1354 -rw-r--r-- io/ui/ui_test.mak
  154. #   7529 -rw-r--r-- io/ui/ui_text.c
  155. #   2839 -rw-r--r-- io/ui/ui_tw.c
  156. #   1458 -rw-r--r-- io/ui/uitest_n.mak
  157. #    221 -rw-r--r-- io/ui/up.pbm
  158. #   4503 -rw-r--r-- sfs/as/as.h
  159. #   6547 -rw-r--r-- sfs/as/as_focus.c
  160. #   9998 -rw-r--r-- sfs/as/as_orbit.c
  161. #  14480 -rw-r--r-- sfs/as/as_spj.c
  162. #   8757 -rw-r--r-- sfs/as/as_test.c
  163. #    703 -rw-r--r-- sfs/as/as_test.mak
  164. #   2526 -rw-r--r-- sfs/as/as_vpt.c
  165. #     44 -rw-r--r-- sfs/bin/callisto.fd
  166. #    638 -rw-r--r-- sfs/bin/callisto.sfs
  167. #   7626 -rw-r--r-- sfs/bin/callisto.spd
  168. #   1231 -rw-r--r-- sfs/bin/complex.sfs
  169. #    611 -rw-r--r-- sfs/bin/default.sfs
  170. #    636 -rw-r--r-- sfs/bin/distant.sfs
  171. #     33 -rw-r--r-- sfs/bin/earth.fd
  172. #  31674 -rw-r--r-- sfs/bin/earth.spd
  173. #  52034 -rw-r--r-- sfs/bin/earthb.spd
  174. #    619 -rw-r--r-- sfs/bin/hubble.sfs
  175. #    625 -rw-r--r-- sfs/bin/inclined.sfs
  176. #     33 -rw-r--r-- sfs/bin/jupiter.fd
  177. #  18871 -rw-r--r-- sfs/bin/latlon.spd
  178. #     30 -rw-r--r-- sfs/bin/mars.fd
  179. #    613 -rw-r--r-- sfs/bin/mars.sfs
  180. #  13105 -rw-r--r-- sfs/bin/mars.spd
  181. #     37 -rw-r--r-- sfs/bin/mercury.fd
  182. #    458 -rw-r--r-- sfs/bin/meridian.spd
  183. #     37 -rw-r--r-- sfs/bin/moon.fd
  184. #    609 -rw-r--r-- sfs/bin/moon.sfs
  185. #    307 -rw-r--r-- sfs/bin/nasa.spd
  186. #     35 -rw-r--r-- sfs/bin/neptune.fd
  187. #    903 -rw-r--r-- sfs/bin/new.sfs
  188. #     72 -rw-r--r-- sfs/bin/null.spd
  189. #   1511 -rw-r--r-- sfs/bin/orb.spd
  190. #     34 -rw-r--r-- sfs/bin/pluto.fd
  191. #    612 -rw-r--r-- sfs/bin/quick.sfs
  192. #     34 -rw-r--r-- sfs/bin/saturn.fd
  193. #    611 -rw-r--r-- sfs/bin/shuttle.sfs
  194. #   2480 -rw-r--r-- sfs/bin/smallgr.spd
  195. #     35 -rw-r--r-- sfs/bin/sun.fd
  196. #    615 -rw-r--r-- sfs/bin/test.sfs
  197. #     32 -rw-r--r-- sfs/bin/uranus.fd
  198. #     36 -rw-r--r-- sfs/bin/venus.fd
  199. #   2225 -rw-r--r-- sfs/doc/README.pc
  200. #   2939 -rw-r--r-- sfs/doc/README.sfs
  201. #    103 -rw-r--r-- sfs/doc/ansi.tab
  202. #    247 -rw-r--r-- sfs/doc/deskjet.tab
  203. #    210 -rw-r--r-- sfs/doc/laserjet.tab
  204. #     52 -rw-r--r-- sfs/doc/null.tab
  205. #    126 -rw-r--r-- sfs/doc/nx10.tab
  206. #  73260 -rw-r--r-- sfs/doc/sfs.ro
  207. #   3741 -rw-r--r-- sfs/doc/tmac.m
  208. #   2002 -rw-r--r-- sfs/map/README.map
  209. #   1593 -rw-r--r-- sfs/map/makefile.tam
  210. #   1545 -rw-r--r-- sfs/map/makefile.x
  211. #  25899 -rw-r--r-- sfs/map/map.c
  212. #   3311 -rw-r--r-- sfs/map/map.h
  213. #    941 -rw-r--r-- sfs/map/map.mak
  214. #   9366 -rw-r--r-- sfs/map/map_dr.c
  215. #     75 -rw-r--r-- sfs/map/test.spd
  216. #   1320 -rw-r--r-- sfs/sfs/buildsfs.bat
  217. #   1455 -rw-r--r-- sfs/sfs/buildsfs.sh
  218. #    489 -rw-r--r-- sfs/sfs/cleansfs.bat
  219. #    279 -rw-r--r-- sfs/sfs/cleansfs.sh
  220. #   2007 -rw-r--r-- sfs/sfs/makefile.mgr
  221. #   2037 -rw-r--r-- sfs/sfs/makefile.tam
  222. #   2308 -rw-r--r-- sfs/sfs/makefile.x
  223. #   4685 -rw-r--r-- sfs/sfs/sfs.c
  224. #  12242 -rw-r--r-- sfs/sfs/sfs.h
  225. #    546 -rw-r--r-- sfs/sfs/sfs.mak
  226. #   6336 -rw-r--r-- sfs/sfs/sfs_di.c
  227. #   4733 -rw-r--r-- sfs/sfs/sfs_ft.c
  228. #  15884 -rw-r--r-- sfs/sfs/sfs_gt.c
  229. #  19001 -rw-r--r-- sfs/sfs/sfs_pe.c
  230. #  17557 -rw-r--r-- sfs/sfs/sfs_pr.c
  231. #  16784 -rw-r--r-- sfs/sfs/sfs_vi.c
  232. #  17785 -rw-r--r-- sfs/sfs/sfsm.c
  233. #  10462 -rw-r--r-- sfs/sfs/sfsm.h
  234. #   1158 -rw-r--r-- sfs/sfs/sfsm.mak
  235. #   1443 -rw-r--r-- sfs/sfs/sfsm_n.mak
  236. #  20737 -rw-r--r-- sfs/sfs/sfsm_om.c
  237. #  26740 -rw-r--r-- sfs/sfs/sfsx.c
  238. #   7157 -rw-r--r-- sfs/sfs/sfsx.h
  239. #   1444 -rw-r--r-- sfs/sfs/sfsx.mak
  240. #  12780 -rw-r--r-- sfs/sfs/sfsx_cp.c
  241. #   1726 -rw-r--r-- sfs/sfs/sfsx_n.mak
  242. #   6678 -rw-r--r-- sfs/sfs/sfsx_sp.c
  243. #   3875 -rw-r--r-- sfs/sfs/sfsx_var.c
  244. #   1400 -rw-r--r-- smallfont/read.me
  245. #   2336 -rw-r--r-- smallfont/smallfont
  246. #
  247. if test -r _shar_seq_.tmp; then
  248.     echo 'Must unpack archives in sequence!'
  249.     echo Please unpack part `cat _shar_seq_.tmp` next
  250.     exit 1
  251. fi
  252. # ============= README ==============
  253. if test -f 'README' -a X"$1" != X"-c"; then
  254.     echo 'x - skipping README (File already exists)'
  255.     rm -f _shar_wnt_.tmp
  256. else
  257. > _shar_wnt_.tmp
  258. echo 'x - extracting README (Text)'
  259. sed 's/^X//' << 'SHAR_EOF' > 'README' &&
  260. X
  261. Bywater Software at duke.cs.duke.edu
  262. ------------------------------------
  263. X
  264. All Bywater Software is released under specific copyright claims,
  265. for which see the documentation or source code for any of the 
  266. particular applications.  Be careful to use the binary mode of 
  267. ftp to download these files. The directory /pub/bywater at
  268. duke.cs.duke.edu contains the following files:
  269. X
  270. sfs101.zoo    zoo'd binaries and support files for Space Flight
  271. X        Simulator, version 1.01.  This implementation is for
  272. X        the IBM PC and compatibles, and requires Hercules,
  273. X        EGA, or VGA graphics. 
  274. X
  275. map101.zoo    zoo'd binaries and support files for the Map utility
  276. X        for the Space Flight Simulator, version 1.01. Same
  277. X        requirements as the previous file.
  278. X
  279. sfs101.tar.Z    tar'd and compressed source code for Space Flight
  280. X        Simulator, version 1.01. When uncompressed and un-tar'd, 
  281. X        this will produce a directory full of files: "sfs" 
  282. X        (the Space Flight Simulator itself). The README file 
  283. X        contains information on compiling the program. The 
  284. X        document is in the file sfs/doc/sfs.ro and is in "ro" 
  285. X        format (see below). Current implementations available 
  286. X        are for the IBM PC and compatibles using Hercules, EGA, 
  287. X        and VGA graphics, Unix systems utilizing the X Windows 
  288. X        system, and the AT&T Unix PC using the TAM interface. 
  289. X        The compilation of this program requires prior compilation 
  290. X        of the Bywater grahical user interface (see below).
  291. X
  292. ui101.tar.Z    tar'd and compressed source code for the Bywater
  293. X        graphical user interface (ui).  Prior compilation
  294. X        of this subsystem is necessary for compilation
  295. X        of the Space Flight Simulator (see above). Current
  296. X        implementations are for the IBM PC and compatibles
  297. X        utilizing the Microsoft QuickC compiler with Hercules,
  298. X        EGA, or VGA graphics, for the AT&T Unix PC, and for
  299. X        the X Windows system, version 11 (tested only on
  300. X        DecStation 3100 and 2100).
  301. X
  302. smallf.tar.Z    tar'd and compressed files to construct a "smallfont"
  303. X        for the AT&T Unix PC/3B1. See the "read.me" file
  304. X        included. The smallfont is needed for Unix PC/3B1
  305. X        implementation of the ui and Space Flight Simulator
  306. X        under TAM.
  307. X
  308. ro101.tar.Z    tar'd and compressed source code (and PC binary) for
  309. X        "ro", an nroff-like text formatter. When uncompressed
  310. X        and un-tar'd, this will fill the current directory with
  311. X        files. The manual is "ro.doc" which is in ro format.
  312. X
  313. Users are requested not to move or alter these files without my
  314. permission. Thanks. 
  315. X
  316. Ted A. Campbell
  317. Bywater Software
  318. P. O. Box 4023
  319. Duke Station
  320. Durham, NC  27706
  321. X
  322. email: tcamp@hercules.acpub.duke.edu
  323. X
  324. SHAR_EOF
  325. chmod 0664 README ||
  326. echo 'restore of README failed'
  327. Wc_c="`wc -c < 'README'`"
  328. test 2555 -eq "$Wc_c" ||
  329.     echo 'README: original size 2555, current size' "$Wc_c"
  330. rm -f _shar_wnt_.tmp
  331. fi
  332. # ============= README.first ==============
  333. if test -f 'README.first' -a X"$1" != X"-c"; then
  334.     echo 'x - skipping README.first (File already exists)'
  335.     rm -f _shar_wnt_.tmp
  336. else
  337. > _shar_wnt_.tmp
  338. echo 'x - extracting README.first (Text)'
  339. sed 's/^X//' << 'SHAR_EOF' > 'README.first' &&
  340. This directory contains the Space Flight Simulator submission to 
  341. comp.sources.misc.  It consists of sfs101.tar.Z, ui101.tar.Z and smallf.tar.Z
  342. available from Bywater Software at duke.cs.duke.edu.  It does not contain
  343. the .zoo'ed files or ro101.tar.Z.   Ro is available from comp.sources.unix
  344. archives in volume21.  The README file from Duke was included for those
  345. who wish to get pieces not include in the c.s.misc release.
  346. X
  347. Here is a 'lc' of the directories and an explaination of their contents.
  348. X
  349. X    Directories: 
  350. X        io         sfs        smallfont
  351. X    
  352. X    Files: 
  353. X        README     README.sfs README.ui
  354. X    
  355. X
  356. sfs        Source code for Space Flight Simulator, version 1.01. 
  357. X        The README file contains information on compiling the 
  358. X        program. The document is in the file sfs/doc/sfs.ro and 
  359. X        is in "ro"/nroff format Current implementations available 
  360. X        are for the IBM PC and compatibles using Hercules, EGA, 
  361. X        and VGA graphics, Unix systems utilizing the X Windows 
  362. X        system, and the AT&T Unix PC using the TAM interface. 
  363. X        The compilation of this program requires prior compilation 
  364. X        of the Bywater grahical user interface (see below).
  365. X
  366. io (ui)     Source code for the Bywater graphical user interface (ui).  
  367. X        Prior compilation of this subsystem is necessary for 
  368. X        compilation of the Space Flight Simulator (see above). 
  369. X        Current implementations are for the IBM PC and compatibles
  370. X        utilizing the Microsoft QuickC compiler with Hercules,
  371. X        EGA, or VGA graphics, for the AT&T Unix PC, and for
  372. X        the X Windows system, version 11 (tested only on
  373. X        DecStation 3100 and 2100).
  374. X
  375. smallfont       Files to construct a "smallfont" for the AT&T Unix PC/3B1. 
  376. X        See the "read.me" file included. The smallfont is needed 
  377. X        for Unix PC/3B1 implementation of the ui and Space Flight 
  378. X        Simulator under TAM.
  379. X
  380. For more information, please contact the author of SFS.
  381. X
  382. Ted A. Campbell
  383. Bywater Software
  384. P. O. Box 4023
  385. Duke Station
  386. Durham, NC  27706
  387. X
  388. email: tcamp@hercules.acpub.duke.edu
  389. X
  390. X            -Kent+
  391. X
  392. SHAR_EOF
  393. chmod 0664 README.first ||
  394. echo 'restore of README.first failed'
  395. Wc_c="`wc -c < 'README.first'`"
  396. test 1990 -eq "$Wc_c" ||
  397.     echo 'README.first: original size 1990, current size' "$Wc_c"
  398. rm -f _shar_wnt_.tmp
  399. fi
  400. # ============= README.sfs ==============
  401. if test -f 'README.sfs' -a X"$1" != X"-c"; then
  402.     echo 'x - skipping README.sfs (File already exists)'
  403.     rm -f _shar_wnt_.tmp
  404. else
  405. > _shar_wnt_.tmp
  406. echo 'x - extracting README.sfs (Text)'
  407. sed 's/^X//' << 'SHAR_EOF' > 'README.sfs' &&
  408. X
  409. X                     ------------------
  410. X
  411. X                      Bywater Software
  412. X                       Release Notice
  413. X
  414. X                   Space Flight Simulator
  415. X                        version 1.01
  416. X                       (Source Code)
  417. X
  418. X                     ------------------
  419. X
  420. Bywater Software is pleased to announce the public availability
  421. of its Space Flight Simulator in its first complete release, 
  422. version 1.01.  This software is copyright (c) 1991, Ted A. 
  423. Campbell, and is released under the terms of an agreement specified
  424. in the file "sfs.ro" and in all source code file headers.  
  425. X
  426. Description:    The Space Flight Simulator offers a graphics-based,
  427. X        real-time, animated simulation of orbital flight.  
  428. X        Users can develop simulations by specifying a complete
  429. X        range of orbital parameters, and can develop simulations
  430. X        for all of the planets of the solar system and for some
  431. X        other celestial bodies.  A particularly full map is
  432. X        given of the earth, which can be viewed as it would
  433. X        appear from the orbiting spacecraft, as a ground-track
  434. X        map, or as a "distant perspective" in which the earth
  435. X        (or another orbital focus) and the orbital track can
  436. X        be seen together.
  437. X
  438. Implementation:    Current implementations of the Space Flight Simulator
  439. X        for which source code is included are the following:
  440. X        (a) IBM PC and compatibles, utilizing the Microsoft
  441. X        QuickC compiler and requiring Hercules, EGA, or
  442. X        VGA graphics; (b) the AT&T Unix PC with a primary
  443. X        implementation for the TAM subsystem, and a rather
  444. X        poorer implementation for the MGR windowing system;
  445. X        (c) Unix-based computers utilizing the X Windows 
  446. X        system, version 11 (tested on DecStation 2100 and
  447. X        3100).
  448. X
  449. Further Code:    Compilation of this code requires the Bywater
  450. X        graphical User Interface (ui), which is not included
  451. X        in this archive.
  452. X
  453. Documentation:    Complete documentation for this program is in the
  454. X        file "sfs.ro", which is in a format compatible 
  455. X        with the "ro" text formatter (also available). Chapter
  456. X        four contains complete instructions for compiling
  457. X        the program, shorter instructions (for existing
  458. X        implementations) follow this notice.
  459. X
  460. Communications:    Bywater Software
  461. X        P. O. Box 4023
  462. X        Duke Station
  463. X        Durham, NC  27707
  464. X        USA
  465. X
  466. X        email: tcamp@hercules.acpub.duke.edu
  467. X
  468. ------------------------------------------------------
  469. Quick Build Instructions for Existing Implementations:
  470. X
  471. (a) Build the User Interface (ui) using the build scripts
  472. supplied with it.  This will create an include directory
  473. for header files and a lib directory for object modules
  474. of the User Interface.
  475. X
  476. (b) Change to the directory where SFS sourcecode is located:
  477. X
  478. X    Unix:    cd sfs/sfs    
  479. X    MSDOS:    cd sfs\sfs
  480. X
  481. (c) Execute the build script for SFS:
  482. X
  483. X    Unix:    sh buildsfs.sh
  484. X    MSDOS:    buildsfs
  485. X
  486. On Unix systems, the user will be prompted for a number 
  487. corresponding to the particular system to be implemented.   
  488. X
  489. ------------------------------------------------------
  490. X
  491. SHAR_EOF
  492. chmod 0644 README.sfs ||
  493. echo 'restore of README.sfs failed'
  494. Wc_c="`wc -c < 'README.sfs'`"
  495. test 2939 -eq "$Wc_c" ||
  496.     echo 'README.sfs: original size 2939, current size' "$Wc_c"
  497. rm -f _shar_wnt_.tmp
  498. fi
  499. # ============= README.ui ==============
  500. if test -f 'README.ui' -a X"$1" != X"-c"; then
  501.     echo 'x - skipping README.ui (File already exists)'
  502.     rm -f _shar_wnt_.tmp
  503. else
  504. > _shar_wnt_.tmp
  505. echo 'x - extracting README.ui (Text)'
  506. sed 's/^X//' << 'SHAR_EOF' > 'README.ui' &&
  507. X
  508. X                     ------------------
  509. X
  510. X                      Bywater Software
  511. X                       Release Notice
  512. X
  513. X                     User Interface (ui)
  514. X                        version 1.01
  515. X                        (Source Code)
  516. X
  517. X                     ------------------
  518. X
  519. Bywater Software is pleased to announce the public availability
  520. of its graphical User Interface (ui) in its first complete release, 
  521. version 1.01.  This software is copyright (c) 1991, Ted A. 
  522. Campbell, and is released under the terms of an agreement specified
  523. in the headers of all source code files.  
  524. X
  525. Description:    The User Interface (ui) was developed to underly
  526. X        Bywater's Space Flight Simulator (also available).
  527. X        It offers implementation of mouse, window, icon,
  528. X        menu, dialog boxes, and other widgets for the
  529. X        development of a user environment.
  530. X
  531. Implementation:    Current implementations of the User Interface (ui)
  532. X        for which source code is included are the following:
  533. X        (a) IBM PC and compatibles, utilizing the Microsoft
  534. X        QuickC compiler and requiring Hercules, EGA, or
  535. X        VGA graphics; (b) the AT&T Unix PC with a primary
  536. X        implementation for the TAM subsystem, and a rather
  537. X        poorer implementation for the MGR windowing system;
  538. X        (c) Unix-based computers utilizing the X Windows 
  539. X        system, version 11 (tested on DecStation 2100 and
  540. X        3100).
  541. X
  542. Documentation:    A quick reference guide to the abilities of the
  543. X        ui (and its underlying graphics, keyboard, directory,
  544. X        and text window subsystems) is supplied as "io/ui/ui.doc".
  545. X
  546. Communications:    Bywater Software
  547. X        P. O. Box 4023
  548. X        Duke Station
  549. X        Durham, NC  27707
  550. X        USA
  551. X
  552. X        email: tcamp@hercules.acpub.duke.edu
  553. X
  554. ------------------------------------------------------
  555. Quick Build Instructions for Existing Implementations:
  556. X
  557. X
  558. (a) Change to the directory where ui sourcecode is located:
  559. X
  560. X    Unix:    cd io/ui
  561. X    MSDOS:    cd io\ui
  562. X
  563. (b) Execute the build script for ui:
  564. X
  565. X    Unix:    sh buildlib.sh
  566. X    MSDOS:    buildlib
  567. X
  568. On Unix systems, the user will be prompted for a number 
  569. corresponding to the particular system to be implemented.   
  570. X
  571. ------------------------------------------------------
  572. X
  573. SHAR_EOF
  574. chmod 0644 README.ui ||
  575. echo 'restore of README.ui failed'
  576. Wc_c="`wc -c < 'README.ui'`"
  577. test 2119 -eq "$Wc_c" ||
  578.     echo 'README.ui: original size 2119, current size' "$Wc_c"
  579. rm -f _shar_wnt_.tmp
  580. fi
  581. # ============= io/bw/bw.h ==============
  582. if test ! -d 'io'; then
  583.     echo 'x - creating directory io'
  584.     mkdir 'io'
  585. fi
  586. if test ! -d 'io/bw'; then
  587.     echo 'x - creating directory io/bw'
  588.     mkdir 'io/bw'
  589. fi
  590. if test -f 'io/bw/bw.h' -a X"$1" != X"-c"; then
  591.     echo 'x - skipping io/bw/bw.h (File already exists)'
  592.     rm -f _shar_wnt_.tmp
  593. else
  594. > _shar_wnt_.tmp
  595. echo 'x - extracting io/bw/bw.h (Text)'
  596. sed 's/^X//' << 'SHAR_EOF' > 'io/bw/bw.h' &&
  597. /****************************************************************
  598. X
  599. X    bw.h        general header for error- and message-
  600. X            handling routines for all Bywater Software
  601. X
  602. X            Copyright (c) 1990, Ted A. Campbell
  603. X
  604. X            Bywater Software
  605. X            P. O. Box 4023 
  606. X            Duke Station 
  607. X            Durham, NC  27706
  608. X
  609. X            email: tcamp@hercules.acpub.duke.edu
  610. X
  611. X    Copyright and Permissions Information:
  612. X
  613. X    All U.S. and international copyrights are claimed by the
  614. X    author. The author grants permission to use this code
  615. X    and software based on it under the following conditions:
  616. X    (a) in general, the code and software based upon it may be 
  617. X    used by individuals and by non-profit organizations; (b) it
  618. X    may also be utilized by governmental agencies in any country,
  619. X    with the exception of military agencies; (c) the code and/or
  620. X    software based upon it may not be sold for a profit without
  621. X    an explicit and specific permission from the author, except
  622. X    that a minimal fee may be charged for media on which it is
  623. X    copied, and for copying and handling; (d) the code must be 
  624. X    distributed in the form in which it has been released by the
  625. X    author; and (e) the code and software based upon it may not 
  626. X    be used for illegal activities. 
  627. X
  628. ****************************************************************/
  629. X
  630. #define BW_EBUFSIZE     512
  631. X
  632. #define    BW_ERROR    -1
  633. X
  634. extern char bw_ebuf[ BW_EBUFSIZE ];
  635. X
  636. #ifndef TRUE
  637. #define TRUE    1
  638. #define FALSE   0
  639. #endif
  640. X
  641. SHAR_EOF
  642. chmod 0644 io/bw/bw.h ||
  643. echo 'restore of io/bw/bw.h failed'
  644. Wc_c="`wc -c < 'io/bw/bw.h'`"
  645. test 1391 -eq "$Wc_c" ||
  646.     echo 'io/bw/bw.h: original size 1391, current size' "$Wc_c"
  647. rm -f _shar_wnt_.tmp
  648. fi
  649. # ============= io/bw/bw_cpy.h ==============
  650. if test -f 'io/bw/bw_cpy.h' -a X"$1" != X"-c"; then
  651.     echo 'x - skipping io/bw/bw_cpy.h (File already exists)'
  652.     rm -f _shar_wnt_.tmp
  653. else
  654. > _shar_wnt_.tmp
  655. echo 'x - extracting io/bw/bw_cpy.h (Text)'
  656. sed 's/^X//' << 'SHAR_EOF' > 'io/bw/bw_cpy.h' &&
  657. X            Copyright (c) 1991, Ted A. Campbell
  658. X
  659. X            Bywater Software
  660. X            P. O. Box 4023 
  661. X            Duke Station 
  662. X            Durham, NC  27706
  663. X
  664. X            email: tcamp@hercules.acpub.duke.edu
  665. X
  666. X    Copyright and Permissions Information:
  667. X
  668. X    All U.S. and international copyrights are claimed by the
  669. X    author. The author grants permission to use this code
  670. X    and software based on it under the following conditions:
  671. X    (a) in general, the code and software based upon it may be 
  672. X    used by individuals and by non-profit organizations; (b) it
  673. X    may also be utilized by governmental agencies in any country,
  674. X    with the exception of military agencies; (c) the code and/or
  675. X    software based upon it may not be sold for a profit without
  676. X    an explicit and specific permission from the author, except
  677. X    that a minimal fee may be charged for media on which it is
  678. X    copied, and for copying and handling; (d) the code must be 
  679. X    distributed in the form in which it has been released by the
  680. X    author; and (e) the code and software based upon it may not 
  681. X    be used for illegal activities. 
  682. X
  683. SHAR_EOF
  684. chmod 0644 io/bw/bw_cpy.h ||
  685. echo 'restore of io/bw/bw_cpy.h failed'
  686. Wc_c="`wc -c < 'io/bw/bw_cpy.h'`"
  687. test 1020 -eq "$Wc_c" ||
  688.     echo 'io/bw/bw_cpy.h: original size 1020, current size' "$Wc_c"
  689. rm -f _shar_wnt_.tmp
  690. fi
  691. # ============= io/dr/dr.h ==============
  692. if test ! -d 'io/dr'; then
  693.     echo 'x - creating directory io/dr'
  694.     mkdir 'io/dr'
  695. fi
  696. if test -f 'io/dr/dr.h' -a X"$1" != X"-c"; then
  697.     echo 'x - skipping io/dr/dr.h (File already exists)'
  698.     rm -f _shar_wnt_.tmp
  699. else
  700. > _shar_wnt_.tmp
  701. echo 'x - extracting io/dr/dr.h (Text)'
  702. sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr.h' &&
  703. /***************************************************************
  704. X
  705. X    dr.h            Header file for DR (directory)
  706. X            io standards
  707. X
  708. X            Copyright (c) 1991, Ted A. Campbell
  709. X
  710. X            Bywater Software
  711. X            P. O. Box 4023 
  712. X            Duke Station 
  713. X            Durham, NC  27706
  714. X
  715. X            email: tcamp@hercules.acpub.duke.edu
  716. X
  717. X    Copyright and Permissions Information:
  718. X
  719. X    All U.S. and international copyrights are claimed by the
  720. X    author. The author grants permission to use this code
  721. X    and software based on it under the following conditions:
  722. X    (a) in general, the code and software based upon it may be 
  723. X    used by individuals and by non-profit organizations; (b) it
  724. X    may also be utilized by governmental agencies in any country,
  725. X    with the exception of military agencies; (c) the code and/or
  726. X    software based upon it may not be sold for a profit without
  727. X    an explicit and specific permission from the author, except
  728. X    that a minimal fee may be charged for media on which it is
  729. X    copied, and for copying and handling; (d) the code must be 
  730. X    distributed in the form in which it has been released by the
  731. X    author; and (e) the code and software based upon it may not 
  732. X    be used for illegal activities. 
  733. X
  734. ***************************************************************/
  735. X
  736. #define    MAX_PATHLENGTH    64
  737. X
  738. /* File types for return */
  739. X
  740. #define    FILE_NORMAL    0
  741. #define    FILE_DIRECTORY    1
  742. #define    FILE_EXECUTABLE    2
  743. X
  744. /* Structure for directory entries */
  745. X
  746. struct dir_ent
  747. X    {
  748. X    char     filename[ MAX_PATHLENGTH ];
  749. X    char    pathname[ MAX_PATHLENGTH ];
  750. X    int     type;
  751. X    long    size;
  752. X    };
  753. X
  754. /* externals */
  755. X
  756. extern    int    dr_fs;
  757. extern    char    dr_all[ MAX_PATHLENGTH ];
  758. X
  759. #ifndef TRUE
  760. #define TRUE    1
  761. #define FALSE   0
  762. #endif
  763. X
  764. X
  765. X
  766. SHAR_EOF
  767. chmod 0644 io/dr/dr.h ||
  768. echo 'restore of io/dr/dr.h failed'
  769. Wc_c="`wc -c < 'io/dr/dr.h'`"
  770. test 1641 -eq "$Wc_c" ||
  771.     echo 'io/dr/dr.h: original size 1641, current size' "$Wc_c"
  772. rm -f _shar_wnt_.tmp
  773. fi
  774. # ============= io/dr/dr_ibmpc.c ==============
  775. if test -f 'io/dr/dr_ibmpc.c' -a X"$1" != X"-c"; then
  776.     echo 'x - skipping io/dr/dr_ibmpc.c (File already exists)'
  777.     rm -f _shar_wnt_.tmp
  778. else
  779. > _shar_wnt_.tmp
  780. echo 'x - extracting io/dr/dr_ibmpc.c (Text)'
  781. sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_ibmpc.c' &&
  782. /*************************************************************************
  783. X
  784. X    dr_ibmpc.c      Directory (dr) subroutines
  785. X            for Bywater Software.
  786. X
  787. X            Implementation for the IBM PC (tm)
  788. X            and compatible microcomputers
  789. X            utilizing Microsoft QuickC (tm)
  790. X
  791. X            Copyright (c) 1991, Ted A. Campbell
  792. X
  793. X            Bywater Software
  794. X            P. O. Box 4023 
  795. X            Duke Station 
  796. X            Durham, NC  27706
  797. X
  798. X            email: tcamp@hercules.acpub.duke.edu
  799. X
  800. X    Copyright and Permissions Information:
  801. X
  802. X    All U.S. and international copyrights are claimed by the
  803. X    author. The author grants permission to use this code
  804. X    and software based on it under the following conditions:
  805. X    (a) in general, the code and software based upon it may be 
  806. X    used by individuals and by non-profit organizations; (b) it
  807. X    may also be utilized by governmental agencies in any country,
  808. X    with the exception of military agencies; (c) the code and/or
  809. X    software based upon it may not be sold for a profit without
  810. X    an explicit and specific permission from the author, except
  811. X    that a minimal fee may be charged for media on which it is
  812. X    copied, and for copying and handling; (d) the code must be 
  813. X    distributed in the form in which it has been released by the
  814. X    author; and (e) the code and software based upon it may not 
  815. X    be used for illegal activities. 
  816. X
  817. **************************************************************************/
  818. X
  819. #include "stdio.h"
  820. #include "dos.h"
  821. #include "sys\types.h"
  822. #include "sys\stat.h"
  823. #include "dr.h"
  824. X
  825. int     dr_fs = '\\';
  826. char    dr_all[ MAX_PATHLENGTH ] = "*.*";
  827. X
  828. static struct   find_t myfind;
  829. static char      _path[ MAX_PATHLENGTH ];
  830. X
  831. dr_first( findb, retb )
  832. X    char findb[];
  833. X    struct dir_ent *retb;
  834. X    {
  835. X    register int c;
  836. X
  837. X    if ( _dos_findfirst( findb, _A_NORMAL | _A_SUBDIR, &myfind ) == 0 )
  838. X        {
  839. X        strcpy( retb->filename, myfind.name );
  840. X        strcpy( _path, findb );
  841. X
  842. X        c = strlen( _path );
  843. X        while (( c >= 0 ) && ( _path[ c ] != dr_fs ))
  844. X            {
  845. #ifdef  OLD_DEBUG
  846. X            fprintf( stderr, "_path: %s \n", _path );
  847. #endif
  848. X            _path[ c ] = 0;
  849. X            --c;
  850. X            }
  851. X
  852. X        strcpy( retb->pathname, _path );
  853. X
  854. X        fill_buffer( retb );
  855. X        return 1;
  856. X        }
  857. X    else
  858. X        {
  859. X        return 0;
  860. X        }
  861. X    }
  862. X
  863. dr_next( retb )
  864. X    struct dir_ent *retb;
  865. X    {
  866. X    if ( _dos_findnext( &myfind ) == 0 )
  867. X        {
  868. X        strcpy( retb->filename, myfind.name );
  869. X        strcpy( retb->pathname, _path );
  870. X        fill_buffer( retb );
  871. X        return 1;
  872. X        }
  873. X    else
  874. X        {
  875. X        return 0;
  876. X        }
  877. X    }
  878. X
  879. X
  880. fill_buffer( retb )
  881. X    struct dir_ent *retb;
  882. X    {
  883. X    static struct stat s_buf;
  884. X    static char newpath[ MAX_PATHLENGTH ];
  885. X
  886. X    if ( strlen( _path ) > 0  )
  887. X        {
  888. X        sprintf( newpath, "%s%s", _path, retb->filename );
  889. X        }
  890. X    else
  891. X        {
  892. X        strcpy( newpath, retb->filename );
  893. X        }
  894. X
  895. X    if ( stat( newpath, &s_buf ) < 0 )
  896. X        {
  897. #ifdef  DEBUG
  898. X        fprintf( stderr, "stat() to %s failed. \n", newpath );
  899. #endif
  900. X        }
  901. X
  902. X    retb->size = s_buf.st_size;
  903. X
  904. X    if ( ibm_isexec( retb ) == TRUE )
  905. X        {
  906. X        retb->type = FILE_EXECUTABLE;
  907. X        }
  908. X
  909. X    else if ( ( s_buf.st_mode & S_IFDIR ) == S_IFDIR )
  910. X        {
  911. X        retb->type = FILE_DIRECTORY;
  912. X        }
  913. X
  914. X    else
  915. X        {
  916. X        retb->type = FILE_NORMAL;
  917. X        }
  918. X
  919. X    return TRUE;
  920. X
  921. X    }
  922. X
  923. ibm_isexec( retb )
  924. X    struct dir_ent *retb;
  925. X    {
  926. X    static char buffer[ MAX_PATHLENGTH ];
  927. X    register int c, d;
  928. X
  929. X    if ( strlen( retb->filename ) < 5 )
  930. X        {
  931. X        return FALSE;
  932. X        }
  933. X
  934. X    d = 0;
  935. X    for ( c = strlen( retb->filename ) - 4;
  936. X        c < strlen( retb->filename ); ++c )
  937. X        {
  938. X        buffer[ d ] = retb->filename[ c ];
  939. X        ++d;
  940. X        buffer[ d ] = 0;
  941. X        }
  942. X
  943. X    if ( strcmp( buffer, ".EXE" ) == 0 )
  944. X        {
  945. X        return TRUE;
  946. X        }
  947. X    else if ( strcmp( buffer, ".COM" ) == 0 )
  948. X        {
  949. X        return TRUE;
  950. X        }
  951. X    else if ( strcmp( buffer, ".BAT" ) == 0 )
  952. X        {
  953. X        return TRUE;
  954. X        }
  955. X    else
  956. X        {
  957. X        return FALSE;
  958. X        }
  959. X    }
  960. SHAR_EOF
  961. chmod 0644 io/dr/dr_ibmpc.c ||
  962. echo 'restore of io/dr/dr_ibmpc.c failed'
  963. Wc_c="`wc -c < 'io/dr/dr_ibmpc.c'`"
  964. test 3516 -eq "$Wc_c" ||
  965.     echo 'io/dr/dr_ibmpc.c: original size 3516, current size' "$Wc_c"
  966. rm -f _shar_wnt_.tmp
  967. fi
  968. # ============= io/dr/dr_spec.c ==============
  969. if test -f 'io/dr/dr_spec.c' -a X"$1" != X"-c"; then
  970.     echo 'x - skipping io/dr/dr_spec.c (File already exists)'
  971.     rm -f _shar_wnt_.tmp
  972. else
  973. > _shar_wnt_.tmp
  974. echo 'x - extracting io/dr/dr_spec.c (Text)'
  975. sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_spec.c' &&
  976. /*************************************************************************
  977. X
  978. X    dr_spec.c       Directory (dr) subroutines
  979. X            for Bywater Software.
  980. X
  981. X            Specification file.
  982. X
  983. X            Copyright (c) 1991, Ted A. Campbell
  984. X
  985. X            Bywater Software
  986. X            P. O. Box 4023 
  987. X            Duke Station 
  988. X            Durham, NC  27706
  989. X
  990. X            email: tcamp@hercules.acpub.duke.edu
  991. X
  992. X    Copyright and Permissions Information:
  993. X
  994. X    All U.S. and international copyrights are claimed by the
  995. X    author. The author grants permission to use this code
  996. X    and software based on it under the following conditions:
  997. X    (a) in general, the code and software based upon it may be 
  998. X    used by individuals and by non-profit organizations; (b) it
  999. X    may also be utilized by governmental agencies in any country,
  1000. X    with the exception of military agencies; (c) the code and/or
  1001. X    software based upon it may not be sold for a profit without
  1002. X    an explicit and specific permission from the author, except
  1003. X    that a minimal fee may be charged for media on which it is
  1004. X    copied, and for copying and handling; (d) the code must be 
  1005. X    distributed in the form in which it has been released by the
  1006. X    author; and (e) the code and software based upon it may not 
  1007. X    be used for illegal activities. 
  1008. X
  1009. **************************************************************************/
  1010. X
  1011. #include "dr.h"
  1012. X
  1013. /*************************************************************************
  1014. X
  1015. X   dr_first()
  1016. X
  1017. X   This function returns the first instance of a file matching an
  1018. X   ambiguous file specifier (TRUE) or FALSE if no matches are found.
  1019. X
  1020. X   The argument "findb" is a pointer to a character string which
  1021. X   is the ambiguous file specifier.
  1022. X
  1023. X   The argument "retb" is a pointer to a character buffer where
  1024. X   the returned value (if TRUE) will be written.
  1025. X
  1026. **************************************************************************/
  1027. X
  1028. dr_first( findb, retb )
  1029. X    char findb[];
  1030. X    struct dir_ent *retb;
  1031. X    {
  1032. X    }
  1033. X
  1034. /*************************************************************************
  1035. X
  1036. X   dr_next()
  1037. X
  1038. X   This function returns the next instance of a file matching the
  1039. X   ambiguous file specifier previously supplied to dr_first(TRUE),
  1040. X   or FALSE if no further matches are found.
  1041. X
  1042. X   The argument "retb" is a pointer to a character buffer where
  1043. X   the returned value (if TRUE) will be written.
  1044. X
  1045. **************************************************************************/
  1046. X
  1047. dr_next( retb )
  1048. X    struct dir_ent *retb;
  1049. X    {
  1050. X    }
  1051. X
  1052. SHAR_EOF
  1053. chmod 0644 io/dr/dr_spec.c ||
  1054. echo 'restore of io/dr/dr_spec.c failed'
  1055. Wc_c="`wc -c < 'io/dr/dr_spec.c'`"
  1056. test 2379 -eq "$Wc_c" ||
  1057.     echo 'io/dr/dr_spec.c: original size 2379, current size' "$Wc_c"
  1058. rm -f _shar_wnt_.tmp
  1059. fi
  1060. # ============= io/dr/dr_sysv.c ==============
  1061. if test -f 'io/dr/dr_sysv.c' -a X"$1" != X"-c"; then
  1062.     echo 'x - skipping io/dr/dr_sysv.c (File already exists)'
  1063.     rm -f _shar_wnt_.tmp
  1064. else
  1065. > _shar_wnt_.tmp
  1066. echo 'x - extracting io/dr/dr_sysv.c (Text)'
  1067. sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_sysv.c' &&
  1068. /*************************************************************************
  1069. X
  1070. X    dr_sysv.c       Directory (dr) subroutines
  1071. X            for Bywater Software.
  1072. X
  1073. X            Implementation for AT&T Unix System V (tm)
  1074. X
  1075. X            Copyright (c) 1991, Ted A. Campbell
  1076. X
  1077. X            Bywater Software
  1078. X            P. O. Box 4023 
  1079. X            Duke Station 
  1080. X            Durham, NC  27706
  1081. X
  1082. X            email: tcamp@hercules.acpub.duke.edu
  1083. X
  1084. X    Copyright and Permissions Information:
  1085. X
  1086. X    All U.S. and international copyrights are claimed by the
  1087. X    author. The author grants permission to use this code
  1088. X    and software based on it under the following conditions:
  1089. X    (a) in general, the code and software based upon it may be 
  1090. X    used by individuals and by non-profit organizations; (b) it
  1091. X    may also be utilized by governmental agencies in any country,
  1092. X    with the exception of military agencies; (c) the code and/or
  1093. X    software based upon it may not be sold for a profit without
  1094. X    an explicit and specific permission from the author, except
  1095. X    that a minimal fee may be charged for media on which it is
  1096. X    copied, and for copying and handling; (d) the code must be 
  1097. X    distributed in the form in which it has been released by the
  1098. X    author; and (e) the code and software based upon it may not 
  1099. X    be used for illegal activities. 
  1100. X
  1101. **************************************************************************/
  1102. X
  1103. #include "stdio.h"
  1104. #ifdef    __STDC__
  1105. #include "process.h"
  1106. #endif
  1107. #include "string.h"
  1108. #include "time.h"
  1109. #include "sys/types.h"
  1110. #include "sys/stat.h"
  1111. X
  1112. #include "dr.h"
  1113. X
  1114. #ifndef    TRUE
  1115. #define    TRUE    1
  1116. #define    FALSE    0
  1117. #endif
  1118. X
  1119. #ifndef    CR
  1120. #define    CR    13
  1121. #define    LF    10
  1122. #endif
  1123. X
  1124. int    dr_fs = '/';
  1125. char    dr_all[ MAX_PATHLENGTH ] = "*";
  1126. X
  1127. extern char *tmpname();
  1128. X
  1129. char tmpfname[80], command_string[80];
  1130. FILE *unix_fp;
  1131. static char      _path[ MAX_PATHLENGTH ];
  1132. X
  1133. dr_first( findb, retb )
  1134. X    char findb[]; 
  1135. X    struct dir_ent *retb;
  1136. X    {
  1137. X    register int c;
  1138. X    char *name;
  1139. X
  1140. X    strcpy( tmpfname, "/tmp/dr_unix.tmp" );
  1141. X    sprintf( command_string, "ls -a %s | sort > %s", findb, tmpfname );
  1142. X    system( command_string );
  1143. X
  1144. X    if ( ( unix_fp = fopen( tmpfname, "r" )) == NULL) 
  1145. X        {
  1146. X        bw_error( "Cannot open temporary file for directory");
  1147. X        return FALSE;
  1148. X        }
  1149. X
  1150. X    if ( feof( unix_fp ))
  1151. X        {
  1152. X        fclose( unix_fp );
  1153. #ifdef OLD_DEBUG
  1154. X        fprintf( "Temporary file is empty. \n" );
  1155. #else
  1156. X        unlink( tmpfname ); 
  1157. #endif
  1158. X        return FALSE;
  1159. X        }
  1160. X    else
  1161. X        {
  1162. X
  1163. X        strcpy( _path, findb );
  1164. X        c = strlen( _path );
  1165. X
  1166. X        while (( c >= 0 ) && ( _path[ c ] != dr_fs ))
  1167. X            {
  1168. #ifdef  OLD_DEBUG
  1169. X            fprintf( stderr, "_path: %s c: %d\n", _path,
  1170. X                c );
  1171. #endif
  1172. X            _path[ c ] = 0;
  1173. X            --c;
  1174. X            }
  1175. X
  1176. X        strcpy( retb->pathname, _path );
  1177. X
  1178. X        name = fgets( command_string, 80, unix_fp );
  1179. X        if ( fill_buffer( retb, name ) == FALSE )
  1180. X            {
  1181. X            return FALSE;
  1182. X            }
  1183. X        else
  1184. X            {
  1185. X            return TRUE;
  1186. X            }
  1187. X        }
  1188. X    }
  1189. X
  1190. dr_next( retb )
  1191. X    struct dir_ent *retb;
  1192. X    {
  1193. X    char *name;
  1194. X
  1195. X    if ( feof( unix_fp ) )
  1196. X        {
  1197. X        fclose( unix_fp );
  1198. #ifndef    DEBUG
  1199. X        unlink( tmpfname ); 
  1200. #endif
  1201. X        return FALSE;
  1202. X        }
  1203. X    else
  1204. X        {
  1205. X        strcpy( retb->pathname, _path );
  1206. X        name = fgets( command_string, 80, unix_fp );
  1207. X        if ( fill_buffer( retb, name )== FALSE )
  1208. X            {
  1209. X            return FALSE;
  1210. X            }
  1211. X        else
  1212. X            {
  1213. X            return TRUE;
  1214. X            }
  1215. X        }
  1216. X    }
  1217. X
  1218. fill_buffer( retb, name )
  1219. X    struct dir_ent *retb;
  1220. X    char *name;
  1221. X    {
  1222. X    static struct stat s_buf;
  1223. X
  1224. #ifdef OLD_DEBUG
  1225. X    fprintf( stderr, "fill_buffer() received filename: <%s> \n", name );
  1226. #endif
  1227. X
  1228. X    strcpy( retb->filename, name );
  1229. X    unix_truncate( retb->filename );
  1230. X
  1231. X    if ( strlen( retb->filename ) == 0 )
  1232. X        {
  1233. #ifdef OLD_DEBUG
  1234. X        fprintf( stderr, "Null filename returned. \n" );
  1235. #endif
  1236. X        return FALSE;
  1237. X        }
  1238. X
  1239. X    stat( retb->filename, &s_buf );
  1240. X
  1241. X    retb->size = s_buf.st_size;
  1242. X
  1243. X    if ( ( s_buf.st_mode & 0040000 ) == 0040000 )
  1244. X        {
  1245. X        retb->type = FILE_DIRECTORY;
  1246. X        }
  1247. X    else if ( ( s_buf.st_mode & 0000400 ) == 0000007 )
  1248. X        {
  1249. X        retb->type = FILE_EXECUTABLE;
  1250. X        }
  1251. X    else if ( ( s_buf.st_mode & 0000200 ) == 0000070 )
  1252. X        {
  1253. X        retb->type = FILE_EXECUTABLE;
  1254. X        }
  1255. X    else if ( ( s_buf.st_mode & 0000100 ) == 0000100 )
  1256. X        {
  1257. X        retb->type = FILE_EXECUTABLE;
  1258. X        }
  1259. X    else
  1260. X        {
  1261. X        retb->type = FILE_NORMAL;
  1262. X        }
  1263. X
  1264. X    return TRUE;
  1265. X
  1266. X    }
  1267. X
  1268. unix_truncate( buffer )
  1269. X    char *buffer;
  1270. X    {
  1271. X    register char *p;
  1272. X
  1273. X    p = buffer;
  1274. X    while( *p != 0 )
  1275. X        {
  1276. X        if (( *p == CR ) || ( *p == LF ))
  1277. X            {
  1278. X            *p = 0;
  1279. X            }
  1280. X        ++p;
  1281. X        }
  1282. X    }
  1283. X
  1284. SHAR_EOF
  1285. chmod 0644 io/dr/dr_sysv.c ||
  1286. echo 'restore of io/dr/dr_sysv.c failed'
  1287. Wc_c="`wc -c < 'io/dr/dr_sysv.c'`"
  1288. test 4111 -eq "$Wc_c" ||
  1289.     echo 'io/dr/dr_sysv.c: original size 4111, current size' "$Wc_c"
  1290. rm -f _shar_wnt_.tmp
  1291. fi
  1292. # ============= io/dr/dr_test.c ==============
  1293. if test -f 'io/dr/dr_test.c' -a X"$1" != X"-c"; then
  1294.     echo 'x - skipping io/dr/dr_test.c (File already exists)'
  1295.     rm -f _shar_wnt_.tmp
  1296. else
  1297. > _shar_wnt_.tmp
  1298. echo 'x - extracting io/dr/dr_test.c (Text)'
  1299. sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_test.c' &&
  1300. /*************************************************************************
  1301. X
  1302. X    dr_test.c       Directory (dr) subroutines
  1303. X            for Bywater Software.
  1304. X
  1305. X            Test program
  1306. X
  1307. X            Copyright (c) 1991, Ted A. Campbell
  1308. X
  1309. X            Bywater Software
  1310. X            P. O. Box 4023 
  1311. X            Duke Station 
  1312. X            Durham, NC  27706
  1313. X
  1314. X            email: tcamp@hercules.acpub.duke.edu
  1315. X
  1316. X    Copyright and Permissions Information:
  1317. X
  1318. X    All U.S. and international copyrights are claimed by the
  1319. X    author. The author grants permission to use this code
  1320. X    and software based on it under the following conditions:
  1321. X    (a) in general, the code and software based upon it may be 
  1322. X    used by individuals and by non-profit organizations; (b) it
  1323. X    may also be utilized by governmental agencies in any country,
  1324. X    with the exception of military agencies; (c) the code and/or
  1325. X    software based upon it may not be sold for a profit without
  1326. X    an explicit and specific permission from the author, except
  1327. X    that a minimal fee may be charged for media on which it is
  1328. X    copied, and for copying and handling; (d) the code must be 
  1329. X    distributed in the form in which it has been released by the
  1330. X    author; and (e) the code and software based upon it may not 
  1331. X    be used for illegal activities. 
  1332. X
  1333. **************************************************************************/
  1334. X
  1335. #include "stdio.h"
  1336. #ifdef    __STDC__
  1337. #include "malloc.h"
  1338. #else
  1339. extern    char *malloc();
  1340. #endif
  1341. #include "dr.h"
  1342. X
  1343. #define    DIR_ENTRIES    128
  1344. X
  1345. char findname[ MAX_PATHLENGTH ];
  1346. struct dir_ent *retstructs[ DIR_ENTRIES ];
  1347. X
  1348. main()
  1349. X    {
  1350. X    register int c;
  1351. X
  1352. X    for ( c = 0; c < DIR_ENTRIES; ++c )
  1353. X        {
  1354. X        if ( ( retstructs[ c ] 
  1355. X            = (struct dir_ent *) malloc( sizeof( struct dir_ent )) ) == NULL )
  1356. X            {
  1357. X            fprintf( stderr, "Failed to allocate memory for directory structure.\n" );
  1358. X            exit( 1 );
  1359. X            }
  1360. X        }
  1361. X
  1362. X    printf( "Enter an ambiguous file specifier:  " );
  1363. X    gets( findname );
  1364. /*    printf( "\n" ); */
  1365. X
  1366. X    c = 0;
  1367. X    if ( dr_first( findname, retstructs[ c ] ) == 0 )
  1368. X        {
  1369. X        printf( "No matches found.\n" );
  1370. X        exit( 1 );
  1371. X        }
  1372. X
  1373. X
  1374. X    printf( "Pathname: %s\tFilename: %s\tType: %d\tSize: %ld\n",
  1375. X        retstructs[ c ]->pathname,
  1376. X        retstructs[ c ]->filename,
  1377. X        retstructs[ c ]->type,
  1378. X        retstructs[ c ]->size );
  1379. X    ++c; 
  1380. X
  1381. X    while( dr_next( retstructs[ c ] ) != 0 )
  1382. X        {
  1383. X        printf( "Pathname: %s\tFilename: %s\tType: %d\tSize: %ld\n",
  1384. X            retstructs[ c ]->pathname,
  1385. X            retstructs[ c ]->filename,
  1386. X            retstructs[ c ]->type,
  1387. X            retstructs[ c ]->size );
  1388. X        ++c;
  1389. X        }
  1390. X    }
  1391. X
  1392. X
  1393. SHAR_EOF
  1394. chmod 0644 io/dr/dr_test.c ||
  1395. echo 'restore of io/dr/dr_test.c failed'
  1396. Wc_c="`wc -c < 'io/dr/dr_test.c'`"
  1397. test 2371 -eq "$Wc_c" ||
  1398.     echo 'io/dr/dr_test.c: original size 2371, current size' "$Wc_c"
  1399. rm -f _shar_wnt_.tmp
  1400. fi
  1401. # ============= io/dr/dr_test.mak ==============
  1402. if test -f 'io/dr/dr_test.mak' -a X"$1" != X"-c"; then
  1403.     echo 'x - skipping io/dr/dr_test.mak (File already exists)'
  1404.     rm -f _shar_wnt_.tmp
  1405. else
  1406. > _shar_wnt_.tmp
  1407. echo 'x - extracting io/dr/dr_test.mak (Text)'
  1408. sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_test.mak' &&
  1409. PROJ    =DR_TEST
  1410. DEBUG    =0
  1411. CC    =qcl
  1412. CFLAGS_G    = /AS /W1 /Ze 
  1413. CFLAGS_D    = /Zi /Zr /Gi$(PROJ).mdt /Od 
  1414. CFLAGS_R    = /O /Ot /DNDEBUG 
  1415. CFLAGS    =$(CFLAGS_G) $(CFLAGS_R)
  1416. LFLAGS_G    =/NOI
  1417. LFLAGS_D    =/INCR /CO
  1418. LFLAGS_R    =
  1419. LFLAGS    =$(LFLAGS_G) $(LFLAGS_R)
  1420. RUNFLAGS    =
  1421. OBJS_EXT =     
  1422. LIBS_EXT =     
  1423. X
  1424. all:    $(PROJ).exe
  1425. X
  1426. dr_test.obj:    dr_test.c
  1427. X
  1428. dr_ibmpc.obj:    dr_ibmpc.c
  1429. X
  1430. $(PROJ).exe:    dr_test.obj dr_ibmpc.obj $(OBJS_EXT)
  1431. X    echo >NUL @<<$(PROJ).crf
  1432. dr_test.obj +
  1433. dr_ibmpc.obj +
  1434. $(OBJS_EXT)
  1435. $(PROJ).exe
  1436. X
  1437. $(LIBS_EXT);
  1438. <<
  1439. X    link $(LFLAGS) @$(PROJ).crf
  1440. X
  1441. run: $(PROJ).exe
  1442. X    $(PROJ) $(RUNFLAGS)
  1443. X
  1444. SHAR_EOF
  1445. chmod 0644 io/dr/dr_test.mak ||
  1446. echo 'restore of io/dr/dr_test.mak failed'
  1447. Wc_c="`wc -c < 'io/dr/dr_test.mak'`"
  1448. test 553 -eq "$Wc_c" ||
  1449.     echo 'io/dr/dr_test.mak: original size 553, current size' "$Wc_c"
  1450. rm -f _shar_wnt_.tmp
  1451. fi
  1452. # ============= io/dr/dr_unix.c ==============
  1453. if test -f 'io/dr/dr_unix.c' -a X"$1" != X"-c"; then
  1454.     echo 'x - skipping io/dr/dr_unix.c (File already exists)'
  1455.     rm -f _shar_wnt_.tmp
  1456. else
  1457. > _shar_wnt_.tmp
  1458. echo 'x - extracting io/dr/dr_unix.c (Text)'
  1459. sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_unix.c' &&
  1460. /*************************************************************************
  1461. X
  1462. X    dr_unix.c       Directory (dr) subroutines
  1463. X            for Bywater Software.
  1464. X
  1465. X            Implementation for generic (?) Unix
  1466. X
  1467. X            Copyright (c) 1991, Ted A. Campbell
  1468. X
  1469. X            Bywater Software
  1470. X            P. O. Box 4023 
  1471. X            Duke Station 
  1472. X            Durham, NC  27706
  1473. X
  1474. X            email: tcamp@hercules.acpub.duke.edu
  1475. X
  1476. X    Copyright and Permissions Information:
  1477. X
  1478. X    All U.S. and international copyrights are claimed by the
  1479. X    author. The author grants permission to use this code
  1480. X    and software based on it under the following conditions:
  1481. X    (a) in general, the code and software based upon it may be 
  1482. X    used by individuals and by non-profit organizations; (b) it
  1483. X    may also be utilized by governmental agencies in any country,
  1484. X    with the exception of military agencies; (c) the code and/or
  1485. X    software based upon it may not be sold for a profit without
  1486. X    an explicit and specific permission from the author, except
  1487. X    that a minimal fee may be charged for media on which it is
  1488. X    copied, and for copying and handling; (d) the code must be 
  1489. X    distributed in the form in which it has been released by the
  1490. X    author; and (e) the code and software based upon it may not 
  1491. X    be used for illegal activities. 
  1492. X
  1493. **************************************************************************/
  1494. X
  1495. #include "stdio.h"
  1496. #include "string.h"
  1497. #include "time.h"
  1498. #include "sys/types.h"
  1499. #include "sys/stat.h"
  1500. X
  1501. #include "dr.h"
  1502. X
  1503. #define    INFILENAME    "."
  1504. #define    OUTFILENAME    "/tmp/dr_unix.tmp"
  1505. X
  1506. #ifndef    TRUE
  1507. #define    TRUE    1
  1508. #define    FALSE    0
  1509. #endif
  1510. X
  1511. #ifndef    CR
  1512. #define    CR    13
  1513. #define    LF    10
  1514. #endif
  1515. X
  1516. int    dr_fs = '/';
  1517. char    dr_all[ MAX_PATHLENGTH ] = "";
  1518. X
  1519. extern char *tmpname();
  1520. X
  1521. char unix_flpath[ MAX_PATHLENGTH ];
  1522. char command_string[80];
  1523. FILE *unix_fp;
  1524. static char      _path[ MAX_PATHLENGTH ];
  1525. X
  1526. dr_first( findb, retb )
  1527. X    char *findb; 
  1528. X    struct dir_ent *retb;
  1529. X    {
  1530. X    register int c;
  1531. X    char *name;
  1532. X
  1533. X    sprintf( command_string, "ls -a -1 %s >%s", findb, OUTFILENAME );
  1534. X    system( command_string );
  1535. X
  1536. X    if ( ( unix_fp = fopen( OUTFILENAME, "r" )) == NULL) 
  1537. X        {
  1538. #ifdef    DEBUG
  1539. X        bw_error( "Cannot open temp file"); 
  1540. #endif
  1541. X        return FALSE;
  1542. X        }
  1543. X
  1544. X    if ( feof( unix_fp ))
  1545. X        {
  1546. X        fclose( unix_fp );
  1547. #ifdef    DEBUG
  1548. X        bw_error( "Temporary file is empty." );
  1549. #else
  1550. X        unlink( OUTFILENAME ); 
  1551. #endif
  1552. X        return FALSE;
  1553. X        }
  1554. X    else
  1555. X        {
  1556. X
  1557. X        strcpy( _path, findb );
  1558. X        c = strlen( _path );
  1559. X
  1560. X        while (( c >= 0 ) && ( _path[ c ] != dr_fs ))
  1561. X            {
  1562. #ifdef  OLD_DEBUG
  1563. X            fprintf( stderr, "_path: %s c: %d\n", _path,
  1564. X                c );
  1565. #endif
  1566. X            _path[ c ] = 0;
  1567. X            --c;
  1568. X            }
  1569. X
  1570. X        strcpy( retb->pathname, _path );
  1571. X
  1572. X        name = fgets( command_string, 80, unix_fp );
  1573. X        if ( unix_fillbuffer( retb, name ) == FALSE )
  1574. X            {
  1575. X            return FALSE;
  1576. X            }
  1577. X        else
  1578. X            {
  1579. X            return TRUE;
  1580. X            }
  1581. X        }
  1582. X    }
  1583. X
  1584. dr_next( retb )
  1585. X    struct dir_ent *retb;
  1586. X    {
  1587. X    char *name;
  1588. X
  1589. X    if ( feof( unix_fp ) )
  1590. X        {
  1591. X        fclose( unix_fp );
  1592. #ifndef    DEBUG
  1593. X        unlink( OUTFILENAME ); 
  1594. #endif
  1595. X        return FALSE;
  1596. X        }
  1597. X    else
  1598. X        {
  1599. X        strcpy( retb->pathname, _path );
  1600. X        name = fgets( command_string, 80, unix_fp );
  1601. X        if ( unix_fillbuffer( retb, name ) == FALSE )
  1602. X            {
  1603. X            return FALSE;
  1604. X            }
  1605. X        else
  1606. X            {
  1607. X            return TRUE;
  1608. X            }
  1609. X        }
  1610. X    }
  1611. X
  1612. unix_fillbuffer( retb, name )
  1613. X    struct dir_ent *retb;
  1614. X    char *name;
  1615. X    {
  1616. X    static struct stat s_buf;
  1617. X
  1618. #ifdef    OLD_DEBUG
  1619. X    fprintf( stderr, "unix_fillbuffer() received filename: <%s> \n", name );
  1620. #endif
  1621. X
  1622. X    if ( name == NULL )
  1623. X        {
  1624. X        return FALSE;
  1625. X        }
  1626. X
  1627. X    strcpy( retb->filename, name );
  1628. X    unix_truncate( retb->filename );
  1629. X
  1630. X    if ( strlen( retb->filename ) == 0 )
  1631. X        {
  1632. #ifdef    DEBUG
  1633. X        bw_error( "Null filename returned." );
  1634. #endif
  1635. X        return FALSE;
  1636. X        }
  1637. X
  1638. X    if ( stat( retb->filename, &s_buf ) != 0 )
  1639. X        {
  1640. #ifdef    OLD_DEBUG
  1641. X        fprintf( stderr, "Can't stat file %s\n", retb->filename );
  1642. #endif
  1643. X        }
  1644. X
  1645. X    retb->size = s_buf.st_size;
  1646. X
  1647. X    if ( ( s_buf.st_mode & 0040000 ) == 0040000 )
  1648. X        {
  1649. X        retb->type = FILE_DIRECTORY;
  1650. X        }
  1651. X    else if ( ( s_buf.st_mode & 0000400 ) == 0000007 )
  1652. X        {
  1653. X        retb->type = FILE_EXECUTABLE;
  1654. X        }
  1655. X    else if ( ( s_buf.st_mode & 0000200 ) == 0000070 )
  1656. X        {
  1657. X        retb->type = FILE_EXECUTABLE;
  1658. X        }
  1659. X    else if ( ( s_buf.st_mode & 0000100 ) == 0000100 )
  1660. X        {
  1661. X        retb->type = FILE_EXECUTABLE;
  1662. X        }
  1663. X    else
  1664. X        {
  1665. X        retb->type = FILE_NORMAL;
  1666. X        }
  1667. X
  1668. X    return TRUE;
  1669. X
  1670. X    }
  1671. X
  1672. unix_truncate( buffer )
  1673. X    char *buffer;
  1674. X    {
  1675. X    register char *p;
  1676. X
  1677. X    p = buffer;
  1678. X    while( *p != 0 )
  1679. X        {
  1680. X        if (( *p == CR ) || ( *p == LF ))
  1681. X            {
  1682. X            *p = 0;
  1683. X            }
  1684. X        ++p;
  1685. X        }
  1686. X    }
  1687. X
  1688. SHAR_EOF
  1689. chmod 0644 io/dr/dr_unix.c ||
  1690. echo 'restore of io/dr/dr_unix.c failed'
  1691. Wc_c="`wc -c < 'io/dr/dr_unix.c'`"
  1692. test 4258 -eq "$Wc_c" ||
  1693.     echo 'io/dr/dr_unix.c: original size 4258, current size' "$Wc_c"
  1694. rm -f _shar_wnt_.tmp
  1695. fi
  1696. # ============= io/gr/gr.h ==============
  1697. if test ! -d 'io/gr'; then
  1698.     echo 'x - creating directory io/gr'
  1699.     mkdir 'io/gr'
  1700. fi
  1701. if test -f 'io/gr/gr.h' -a X"$1" != X"-c"; then
  1702.     echo 'x - skipping io/gr/gr.h (File already exists)'
  1703.     rm -f _shar_wnt_.tmp
  1704. else
  1705. > _shar_wnt_.tmp
  1706. echo 'x - extracting io/gr/gr.h (Text)'
  1707. sed 's/^X//' << 'SHAR_EOF' > 'io/gr/gr.h' &&
  1708. /****************************************************************
  1709. X
  1710. X    gr.h        Header for Graphics Interface 
  1711. X            for Bywater Software
  1712. X
  1713. X            Copyright (c) 1991, Ted A. Campbell
  1714. X
  1715. X            Bywater Software
  1716. X            P. O. Box 4023 
  1717. X            Duke Station 
  1718. X            Durham, NC  27706
  1719. X
  1720. X            email: tcamp@hercules.acpub.duke.edu
  1721. X
  1722. X    Copyright and Permissions Information:
  1723. X
  1724. X    All U.S. and international copyrights are claimed by the
  1725. X    author. The author grants permission to use this code
  1726. X    and software based on it under the following conditions:
  1727. X    (a) in general, the code and software based upon it may be 
  1728. X    used by individuals and by non-profit organizations; (b) it
  1729. X    may also be utilized by governmental agencies in any country,
  1730. X    with the exception of military agencies; (c) the code and/or
  1731. X    software based upon it may not be sold for a profit without
  1732. X    an explicit and specific permission from the author, except
  1733. X    that a minimal fee may be charged for media on which it is
  1734. X    copied, and for copying and handling; (d) the code must be 
  1735. X    distributed in the form in which it has been released by the
  1736. X    author; and (e) the code and software based upon it may not 
  1737. X    be used for illegal activities. 
  1738. X
  1739. ****************************************************************/
  1740. X
  1741. extern int    gr_screens;
  1742. extern int    gr_colors;
  1743. extern int    gr_pxsize;
  1744. extern int    gr_pysize;
  1745. extern int    gr_ismouse;
  1746. extern int      gr_clipping;
  1747. extern int      gr_blitting;
  1748. extern int      gr_saving;
  1749. X
  1750. /****************************************************************
  1751. X
  1752. X    boolean operators
  1753. X
  1754. ****************************************************************/
  1755. X
  1756. #ifndef    TRUE
  1757. #define    TRUE    1
  1758. #define    FALSE    0
  1759. #endif
  1760. X
  1761. /****************************************************************
  1762. X
  1763. X    boolean operators
  1764. X
  1765. ****************************************************************/
  1766. X
  1767. #ifndef    TRUE
  1768. #define    TRUE    1
  1769. #define    FALSE    0
  1770. #endif
  1771. X
  1772. /****************************************************************
  1773. X
  1774. X    colors
  1775. X
  1776. ****************************************************************/
  1777. X
  1778. #define BLACK           0
  1779. #define WHITE           1
  1780. #define LIGHT_RED       2
  1781. #define LIGHT_GREEN     3
  1782. #define LIGHT_BLUE      4
  1783. #define LIGHT_YELLOW    5
  1784. #define LIGHT_CYAN      6
  1785. #define LIGHT_MAGENTA   7
  1786. #define DARK_RED        10
  1787. #define DARK_GREEN      11
  1788. #define DARK_BLUE       12
  1789. #define DARK_YELLOW     13
  1790. #define DARK_CYAN       14
  1791. #define DARK_MAGENTA    15
  1792. X
  1793. /****************************************************************
  1794. X
  1795. X    fill (and line) styles
  1796. X
  1797. ****************************************************************/
  1798. X
  1799. #define HOLLOW          0        /* Hollow fill -- draw perimeter */
  1800. #define SOLID           1
  1801. #define GRID            2
  1802. #define HATCH           3
  1803. X
  1804. /****************************************************************
  1805. X
  1806. X    input modes
  1807. X
  1808. ****************************************************************/
  1809. X
  1810. #define    STATUS    0
  1811. #define    WAIT    1
  1812. #define    SAMPLE    2
  1813. #define HIDE    3
  1814. #define SHOW    4
  1815. #define POSITION        5
  1816. X
  1817. /****************************************************************
  1818. X
  1819. X    figure drawing modes
  1820. X
  1821. ****************************************************************/
  1822. X
  1823. #define PERIMETER       1
  1824. #define FILL            2
  1825. X
  1826. /****************************************************************
  1827. X
  1828. X    screens
  1829. X
  1830. ****************************************************************/
  1831. X
  1832. #define GR_PRIMARY    0    /* primary drawing screen */
  1833. #define GR_HIDDEN    1    /* secondary or hidden drawing screen */
  1834. X
  1835. /****************************************************************
  1836. X
  1837. X    fonts
  1838. X
  1839. ****************************************************************/
  1840. X
  1841. #define F_DEFAULT       0
  1842. #define F_ROMAN         1
  1843. #define F_GOTHIC        2
  1844. #define F_ITALIC        3
  1845. X
  1846. /****************************************************************
  1847. X
  1848. X    gr_window structure
  1849. X
  1850. ****************************************************************/
  1851. X
  1852. struct gr_window
  1853. X    {
  1854. X    int initialized;        /* Boolean:  successfully initialized?  */
  1855. X    int xmax;               /* Maximum number of pixels, x axis     */
  1856. X    int ymax;               /* Maximum number of pixels, y axis     */
  1857. X    int font;        /* Current font style             */
  1858. X    int fxsize;             /* Font size in pixels, x axis          */
  1859. X    int fysize;             /* Font size in pixels, y axis          */
  1860. X    int clipping;           /* Boolean:  is cliiping in use?        */
  1861. X    int cl_x1;              /* Left of clip window                  */
  1862. X    int cl_y1;              /* Bottom of clip window                */
  1863. X    int cl_x2;              /* Right of clip window                 */
  1864. X    int cl_y2;              /* Top of clip window                   */
  1865. X    };
  1866. X
  1867. extern long gr_imsize();
  1868. extern unsigned int gr_strlen();
  1869. SHAR_EOF
  1870. chmod 0644 io/gr/gr.h ||
  1871. echo 'restore of io/gr/gr.h failed'
  1872. Wc_c="`wc -c < 'io/gr/gr.h'`"
  1873. test 4574 -eq "$Wc_c" ||
  1874.     echo 'io/gr/gr.h: original size 4574, current size' "$Wc_c"
  1875. rm -f _shar_wnt_.tmp
  1876. fi
  1877. # ============= io/gr/gr_def.c ==============
  1878. if test -f 'io/gr/gr_def.c' -a X"$1" != X"-c"; then
  1879.     echo 'x - skipping io/gr/gr_def.c (File already exists)'
  1880.     rm -f _shar_wnt_.tmp
  1881. else
  1882. > _shar_wnt_.tmp
  1883. echo 'x - extracting io/gr/gr_def.c (Text)'
  1884. sed 's/^X//' << 'SHAR_EOF' > 'io/gr/gr_def.c' &&
  1885. /****************************************************************
  1886. X
  1887. X    gr_def.c        default line, rectangle, and circle
  1888. X            routines for Bywater
  1889. X            Graphics Interface standard
  1890. X
  1891. X            Copyright (c) 1991, Ted A. Campbell
  1892. X
  1893. X            Bywater Software
  1894. X            P. O. Box 4023
  1895. X            Duke Station
  1896. X            Durham, NC  27706
  1897. X
  1898. X            email: tcamp@hercules.acpub.duke.edu
  1899. X
  1900. X    Copyright and Permissions Information:
  1901. X
  1902. X    All U.S. and international copyrights are claimed by the
  1903. X    author. The author grants permission to use this code
  1904. X    and software based on it under the following conditions:
  1905. X    (a) in general, the code and software based upon it may be
  1906. X    used by individuals and by non-profit organizations; (b) it
  1907. X    may also be utilized by governmental agencies in any country,
  1908. X    with the exception of military agencies; (c) the code and/or
  1909. X    software based upon it may not be sold for a profit without
  1910. X    an explicit and specific permission from the author, except
  1911. X    that a minimal fee may be charged for media on which it is
  1912. X    copied, and for copying and handling; (d) the code must be
  1913. X    distributed in the form in which it has been released by the
  1914. X    author; and (e) the code and software based upon it may not
  1915. X    be used for illegal activities.
  1916. X
  1917. ****************************************************************/
  1918. X
  1919. X
  1920. #include "stdio.h"
  1921. #include "math.h"
  1922. X
  1923. #ifdef __STDC__
  1924. #include "malloc.h"
  1925. #else
  1926. extern char * malloc();
  1927. #define size_t  int
  1928. #endif
  1929. X
  1930. #include "bw.h"
  1931. #include "gr.h"
  1932. #include "kb.h"
  1933. X
  1934. #define CHECK_PARAMS    FALSE
  1935. #ifndef DEG_RAD
  1936. #define RAD_DEG         5.729577951e1   /* Convert radians to degrees   */
  1937. #define DEG_RAD         1.745329252e-2  /* Convert degrees to radians   */
  1938. #endif
  1939. #ifndef ACCURACY
  1940. #define ACCURACY        10
  1941. #endif
  1942. X
  1943. #ifdef  STANDALONE
  1944. struct gr_window main_window;
  1945. char tbuf[ 128 ];
  1946. char bw_ebuf[ BW_EBUFSIZE ];
  1947. int x_pos, y_pos, b_stat;
  1948. X
  1949. main()
  1950. X   {
  1951. X   register int c;
  1952. X   int x, y;
  1953. X
  1954. X   gr_init( &main_window, NULL );
  1955. X   kb_init();
  1956. X
  1957. X   x = main_window.xmax / 8;
  1958. X   y = ( main_window.ymax / 4 ) * 3;
  1959. X   c = 0;
  1960. X   while ( ( c < gr_colors ) && ( y > main_window.fysize ) )
  1961. X      {
  1962. X      def_line( GR_PRIMARY, x, y, x + main_window.xmax / 20, y,
  1963. X     c, SOLID );
  1964. X      x += main_window.xmax / 10;
  1965. X      def_line( GR_PRIMARY, x, y, x + main_window.xmax / 20, y,
  1966. X     c, HATCH );
  1967. X      sprintf( tbuf, " <- lines, color %d at x = %d, y = %d",
  1968. X     c, x, y );
  1969. X      gr_text( GR_PRIMARY, x + ( 3 * ( main_window.xmax / 20 )),
  1970. X     y - ( main_window.fysize / 2 ), tbuf, WHITE, BLACK );
  1971. X      ++c;
  1972. X      x -= main_window.xmax / 10;
  1973. X      y -= ( main_window.fysize / 2 ) * 3;
  1974. X      }
  1975. X   kb_rx();
  1976. X
  1977. X   gr_cls( GR_PRIMARY );
  1978. X   def_line( GR_PRIMARY, main_window.xmax / 2, main_window.ymax,
  1979. X      main_window.xmax, main_window.ymax / 2, WHITE, GRID );
  1980. X   def_line( GR_PRIMARY, main_window.xmax, main_window.ymax / 2,
  1981. X      main_window.xmax / 2, 0, WHITE, GRID );
  1982. X   def_line( GR_PRIMARY, main_window.xmax / 2, 0,
  1983. X      0, main_window.ymax / 2, WHITE, GRID );
  1984. X   def_line( GR_PRIMARY, 0, main_window.ymax / 2,
  1985. X      main_window.xmax / 2, main_window.ymax, WHITE, GRID );
  1986. X   def_line( GR_PRIMARY, 0, main_window.ymax / 2,
  1987. X      main_window.xmax, main_window.ymax / 2, WHITE, SOLID );
  1988. X   def_line( GR_PRIMARY, main_window.xmax / 2, 0,
  1989. X      main_window.xmax / 2, main_window.ymax, WHITE, SOLID );
  1990. X   kb_rx();
  1991. X
  1992. X   gr_cls( GR_PRIMARY );
  1993. X   x = main_window.xmax / 40;
  1994. X   y = main_window.ymax / 20;
  1995. X   def_rectangle( GR_PRIMARY, x * 4, y * 16, x * 6, y * 18, WHITE, HOLLOW );
  1996. X   gr_text( GR_PRIMARY, x * 10, y * 17, "Hollow rectangle", WHITE, BLACK );
  1997. X   def_rectangle( GR_PRIMARY, x * 4, y * 12, x * 6, y * 14, WHITE, SOLID );
  1998. X   gr_text( GR_PRIMARY, x * 10, y * 13, "Solid rectangle", WHITE, BLACK );
  1999. X    def_rectangle( GR_PRIMARY, x * 4, y * 8, x * 6, y * 10, WHITE, GRID );
  2000. X   gr_text( GR_PRIMARY, x * 10, y * 9, "Grid rectangle", WHITE, BLACK );
  2001. X    def_rectangle( GR_PRIMARY, x * 4, y * 4, x * 6, y * 6, WHITE, HATCH );
  2002. X   gr_text( GR_PRIMARY, x * 10, y * 5, "Hatch rectangle", WHITE, BLACK );
  2003. X   kb_rx();
  2004. X
  2005. X   gr_cls( GR_PRIMARY );
  2006. X   x = main_window.xmax / 40;
  2007. X   y = main_window.ymax / 20;
  2008. X   def_circle( GR_PRIMARY, x * 5, y * 17, (y/2)*3, WHITE, HOLLOW );
  2009. X   gr_text( GR_PRIMARY, x * 10, y * 17, "Hollow circle", WHITE, BLACK );
  2010. X   def_circle( GR_PRIMARY, x * 5, y * 13, (y/2)*3, WHITE, SOLID );
  2011. X   gr_text( GR_PRIMARY, x * 10, y * 13, "Solid circle", WHITE, BLACK );
  2012. X    def_circle( GR_PRIMARY, x * 5, y * 9, (y/2)*3, WHITE, GRID );
  2013. X   gr_text( GR_PRIMARY, x * 10, y * 9, "Grid circle", WHITE, BLACK );
  2014. SHAR_EOF
  2015. true || echo 'restore of io/gr/gr_def.c failed'
  2016. fi
  2017. echo 'End of  part 1'
  2018. echo 'File io/gr/gr_def.c is continued in part 2'
  2019. echo 2 > _shar_seq_.tmp
  2020. exit 0
  2021. exit 0 # Just in case...
  2022. -- 
  2023. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  2024. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  2025. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  2026. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  2027.