home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / tcleditr / part02 < prev    next >
Encoding:
Text File  |  1992-03-17  |  60.7 KB  |  2,086 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!think.com!mips!msi!dcmartin
  3. From: crowley@chaco.cs.unm.edu (Charlie Crowley)
  4. Subject: v17i003: point text editor (TCL and TK), Part02/16
  5. Message-ID: <1992Mar18.141319.26527@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-17i002-tcl-editor@uunet.UU.NET>
  10. Date: Wed, 18 Mar 1992 14:13:19 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: crowley@chaco.cs.unm.edu (Charlie Crowley)
  14. Posting-number: Volume 17, Issue 3
  15. Archive-name: tcl-editor/part02
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 1 (of 15)."
  24. # Contents:  Imakefile KnownBugs Make.dist README ToDo command.h doc
  25. #   file.h findfiles.c help help/fkeys.help help/general.help
  26. #   help/index.help help/mmenus.help help/options.help
  27. #   help/scroll.help lines.c patchlevel.h piece.c tags.c tcl.c tclLib
  28. #   tclLib/anaBoxes.tcl tclLib/cmd.tcl tclLib/macros.tcl
  29. #   tclLib/makeMenus.tcl tclLib/ptsetup.tcl tclLib/startup.tcl
  30. #   tclLib/tclIndex version.c
  31. # Wrapped by crowley@chaco.cs.unm.edu on Tue Mar 10 15:05:31 1992
  32. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  33. if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  34.   echo shar: Will not clobber existing file \"'Imakefile'\"
  35. else
  36. echo shar: Extracting \"'Imakefile'\" \(1932 characters\)
  37. sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
  38. X# $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/Imakefile,v 1.8 1992/03/04 17:06:40 crowley Exp crowley $
  39. X
  40. X#
  41. X# Point - a text editor for X Windows
  42. X#
  43. X# Author: Charles Crowley
  44. X#         Computer Science Dept.
  45. X#         University of New Mexico
  46. X#         Albuquerque, NM 87131
  47. X#         (office) 505-277-5446
  48. X#         (messages) 505-277-3112
  49. X#         (net) crowley@unmvax.cs.unm.edu
  50. X
  51. X# **************** CHANGES REQUIRED ***************
  52. X# This must be set to where you have the Tk distribution
  53. TK_DIR        = FullPathNameOfTkDistribution
  54. X
  55. X# This must be set to the library of Point tcl files
  56. POINT_LIBRARY   = FullPathNameOfPointDistribution/tclLib
  57. X
  58. X
  59. X
  60. TK_INCLUDES    = -I${TK_DIR} -I${TK_DIR}/tcl
  61. X
  62. CFLAGS        = -O ${TK_INCLUDES} -DPOINT_LIBRARY=\"${POINT_LIBRARY}\"
  63. X
  64. SYS_LIBRARIES    = ${TK_DIR}/libtk.a ${TK_DIR}/tcl/libtcl.a -lX11 -lm
  65. X
  66. OTHERFILES    = README ToDo KnownBugs Imakefile Make.dist ptsetup.tcl \
  67. X            doc/point.n doc/userman.tex doc/cmds.tex \
  68. X            doc/userman.ps help/fkeys.help help/index.help \
  69. X            help/options.help help/general.help help/mmenus.help \
  70. X            help/scroll.help
  71. X
  72. X
  73. INCLUDEFILES    = ana.h command.h file.h funcdecl.h pt.h
  74. X
  75. SOURCES        = anaDialogs.c anaObjects.c anaSources.c \
  76. X            browser.c buffers.c cmdTable.c command.c \
  77. X            copymove.c cursor.c display.c fileio.c \
  78. X            findfiles.c findpos.c goto.c \
  79. X            inschar.c insdel.c \
  80. X            library.c lines.c mouse.c options.c piece.c \
  81. X            point.c pt.c regex.c repaint.c replace.c search.c \
  82. X            select.c spans.c stats.c tags.c tcl.c tkColbox.c \
  83. X            undoredo.c version.c windows.c
  84. X
  85. OBJS        = anaDialogs.o anaObjects.o anaSources.o browser.o \
  86. X            buffers.o cmdTable.o command.o copymove.o \
  87. X            cursor.o display.o fileio.o \
  88. X            findfiles.o findpos.o goto.o \
  89. X            inschar.o insdel.o \
  90. X            library.o lines.o mouse.o options.o piece.o \
  91. X            point.o regex.o repaint.o replace.o search.o select.o \
  92. X            spans.o stats.o tags.o tcl.o tkColbox.o undoredo.o \
  93. X            version.o windows.o
  94. X
  95. ComplexProgramTarget(point)
  96. X
  97. END_OF_FILE
  98. if test 1932 -ne `wc -c <'Imakefile'`; then
  99.     echo shar: \"'Imakefile'\" unpacked with wrong size!
  100. fi
  101. # end of 'Imakefile'
  102. fi
  103. if test -f 'KnownBugs' -a "${1}" != "-c" ; then 
  104.   echo shar: Will not clobber existing file \"'KnownBugs'\"
  105. else
  106. echo shar: Extracting \"'KnownBugs'\" \(876 characters\)
  107. sed "s/^X//" >'KnownBugs' <<'END_OF_FILE'
  108. X            KNOWN BUGS
  109. X
  110. This is a list of know bugs in Point.  Most of them are minor and are on
  111. my to-do list but near the bottom of it.
  112. X
  113. X* MoveToLastPlace acts seems to lose places sometimes.
  114. X* The line numbers on the title bar sometimes get messed up.
  115. X* FindMatchingBrackets does not work correctly.
  116. X* Justify lines is very rough.
  117. X* The undoMotion option is not implemented.
  118. X* The backupByCopy option is not implemented.
  119. X* The showSizes option is not fully debugged.
  120. X* The lineNumbers option screws up if you try to edit the file while line
  121. X    numbers are present.
  122. X* The autoZoom option has no effect.
  123. X* The showPartialLines option has no effect.
  124. X* The filePattern option has no effect.
  125. X* Undo begin and Undo end do not work properly when redoing edits.
  126. X* When pt has to start point things sometimes fail.
  127. X* Internal search and replace does not honor the 'withing selection' option.
  128. X
  129. END_OF_FILE
  130. if test 876 -ne `wc -c <'KnownBugs'`; then
  131.     echo shar: \"'KnownBugs'\" unpacked with wrong size!
  132. fi
  133. # end of 'KnownBugs'
  134. fi
  135. if test -f 'Make.dist' -a "${1}" != "-c" ; then 
  136.   echo shar: Will not clobber existing file \"'Make.dist'\"
  137. else
  138. echo shar: Extracting \"'Make.dist'\" \(1947 characters\)
  139. sed "s/^X//" >'Make.dist' <<'END_OF_FILE'
  140. X# /* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/Make.dist,v 1.10 1992/03/04 17:06:40 crowley Exp crowley $ */
  141. X#
  142. X# Point - a text editor for X Windows
  143. X#
  144. X# Author: Charles Crowley
  145. X#         Computer Science Dept.
  146. X#         University of New Mexico
  147. X#         Albuquerque, NM 87131
  148. X#         (office) 505-277-5446
  149. X#         (messages) 505-277-3112
  150. X#         (net) crowley@unmvax.cs.unm.edu
  151. X
  152. X
  153. X# **************** CHANGES REQUIRED ***************
  154. X# This must be set to where you have the Tk distribution
  155. TK_DIR        = FullPathNameOfTkDistribution
  156. X
  157. X# This must be set to the library of Point tcl files
  158. POINT_LIBRARY   = FullPathNameOfPointDistribution/tclLib
  159. X
  160. X
  161. X
  162. TK_INCLUDES =    -I${TK_DIR} -I${TK_DIR}/tcl
  163. X
  164. CFLAGS =    -O ${TK_INCLUDES} -DPOINT_LIBRARY=\"${POINT_LIBRARY}\"
  165. X
  166. LDFLAGS =    -O ${TK_DIR}/libtk.a ${TK_DIR}/tcl/libtcl.a -lX11 -lm
  167. X
  168. CC =        cc
  169. X
  170. OTHERS = README ToDo KnownBugs Imakefile Make.dist ptsetup.tcl \
  171. X        doc/point.n doc/userman.tex doc/cmds/tex \
  172. X        doc/userman.ps help/*.help tclLib/*.tcl tclLib/tclIndex
  173. X
  174. INCLUDES = ana.h command.h file.h funcdecl.h pt.h
  175. X
  176. SOURCES    = anaDialogs.c anaObjects.c anaSources.c \
  177. X    browser.c buffers.c cmdTable.c command.c \
  178. X    copymove.c cursor.c display.c fileio.c \
  179. X    findfiles.c findpos.c goto.c \
  180. X    inschar.c insdel.c \
  181. X    library.c lines.c mouse.c options.c piece.c \
  182. X    point.c pt.c regex.c repaint.c replace.c search.c \
  183. X    select.c spans.c stats.c tags.c tcl.c tkColbox.c undoredo.c \
  184. X    version.c windows.c
  185. X
  186. OBJS    = anaDialogs.o anaObjects.o anaSources.o browser.o \
  187. X    buffers.o cmdTable.o command.o copymove.o \
  188. X    cursor.o display.o fileio.o \
  189. X    findfiles.o findpos.o goto.o \
  190. X    inschar.o insdel.o \
  191. X    library.o lines.o mouse.o options.o piece.o \
  192. X    point.o regex.o repaint.o replace.o search.o select.o \
  193. X    spans.o stats.o tags.o tcl.o tkColbox.o undoredo.o \
  194. X    version.o windows.o
  195. X
  196. point: $(OBJS)
  197. X    -rm -f point
  198. X    ${CC} -o point $(OBJS) $(LDFLAGS)
  199. X
  200. pt: pt.o
  201. X    -rm -f pt
  202. X    ${CC} -o pt pt.o $(LDFLAGS)
  203. X
  204. clean:
  205. X    rm -f $(OBJS) point pt
  206. X
  207. END_OF_FILE
  208. if test 1947 -ne `wc -c <'Make.dist'`; then
  209.     echo shar: \"'Make.dist'\" unpacked with wrong size!
  210. fi
  211. # end of 'Make.dist'
  212. fi
  213. if test -f 'README' -a "${1}" != "-c" ; then 
  214.   echo shar: Will not clobber existing file \"'README'\"
  215. else
  216. echo shar: Extracting \"'README'\" \(6903 characters\)
  217. sed "s/^X//" >'README' <<'END_OF_FILE'
  218. X$Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/README,v 1.6 1992/03/04 17:06:40 crowley Exp crowley $
  219. X
  220. X        THE POINT TEXT EDITOR FOR X
  221. X
  222. Point is a text editor for X windows.  It is specifically designed to use
  223. the mouse as much as possible in editing.  It also provided convenient
  224. ways to keep a number of windows open on files and ways to copy text
  225. between and within files using the mouse.
  226. X
  227. Some features of Point:
  228. X* Unlimited number of windows and files
  229. X* Easy move and copy within and between windows
  230. X* Completely configurable: menus, key meanings, titles, etc.
  231. X* Extensive options to modify the look and behavior
  232. X* Uses Tcl as a macro language and the Tk toolkit
  233. X* Flexible searching: for selection, for last string searched for,
  234. X    for a regular expression, for the last regular expression,
  235. X    for a string in a list of files, for a C tag.
  236. X* File browsers vaguely similar to NeXT to load files.
  237. X* Circular mouse menus, that is, "gesture" commands
  238. X* Unlimited undo, redo and again (repeat last command)
  239. X
  240. I have built Point on:
  241. X
  242. X(1) SUN 4 running SunOS 4.1
  243. X(2) DEC 5000/200 running Ultrix 4.1
  244. X
  245. The distribution builds fine on both of them.
  246. I have also built it on:
  247. X
  248. X(3) Macintosh FX running AUX where point runs but the file browser does
  249. X    not show the files correctly, something about the opendir/readdir
  250. X    interface I think.
  251. X
  252. If you have any problems please feel free to call me or send me email.
  253. X
  254. X
  255. X        RECENT CHANGES
  256. X
  257. X"Changes.log" describes the recent changes to point in chronilogical
  258. order.  "Changes.doc" gives longer explanations of some of the
  259. changes.
  260. X
  261. X
  262. X        FIRST GET TK/TCL
  263. X
  264. Point uses the Tk/Tcl distribution, using Tcl as its macro language and
  265. Tk as its widget set.  In order to build point you have to first build
  266. Tk/Tcl.  This version of Point works with Tcl version 6.2 and Tk version 1.4.
  267. The first thing to do is to get the Tk/Tcl distribution.  You can get
  268. this from allspice.berkeley.edu in tcl/tk1.4.tar.Z,from unmvax.cs.unm.edu
  269. in pub/Point/tk1.4.tar.Z or from several other places.
  270. X
  271. Tcl/Tk is very interesting in its own right and I encourage you to look
  272. through it.  The Tk distribution creates a directory "tk1.4".
  273. X
  274. X
  275. X        THEN BUILD POINT
  276. X
  277. Once you have built Tk/Tcl you can build Point:
  278. X
  279. X1. Execute "zcat pt.tar.Z | tar xvf -" to uncompress and untar the files.
  280. X   It puts everything into the current directory so create a subdirectory
  281. X   "Point" and move to it before you untar.
  282. X
  283. X2. On a System V UNIX set the SYSV preprocessor variable at the top of pt.h.
  284. X   The SYSV variable only affects the way opendir and readdir are used.
  285. X   You might look at that code and see which form your system supports
  286. X   by looking at the man page for "opendir".
  287. X
  288. X3. Set the TK_DIR variable in Imakefile and/or Make.dist to the path name
  289. X   of the main directory of the tk distribution. The makefiles expect the
  290. X   libraries to be where they are built in tk: $(TK_DIR)/libtk.a and
  291. X   $(TK_DIR)/libtcl/tcl.a.  If they are somewhere else you must edit the
  292. X   makefile.  The compiles also require the include files in the TK_DIR tree.
  293. X
  294. X4. The POINT_LIBRARY must be set correctly, that is, to the subdirectory
  295. X   of the Point distribution where the startup file is.  This should be
  296. X   a full pathname that Point will work no matter which directory you
  297. X   start point in.
  298. X
  299. X5. Use "xmkmf" to create the Makefile from the Imakefile.
  300. X   If you do not have or do not like imake you can use "Make.dist",
  301. X   use "ln Make.dist Makefile" or "make -f Make.dist".
  302. X   You will have to modify the link step if you keep your X libraries
  303. X   in a place other than /usr/lib.  We keep our's in /usr/local/X11/lib.
  304. X
  305. X6. Run make.
  306. X
  307. X
  308. X        THEN BE SURE THE INITIALIZATION FILES IN ORDER
  309. X
  310. Point requires a number of files to run correctly and these must be in files
  311. where Point can find them.  The key is the POINT_LIBRARY which was
  312. specified in the Makefile.  This allows Point to start up from any
  313. directory and always find the necessary files.  These files can be in a
  314. system area or in your personal directory tree if you are building Point
  315. for your own use and not installing it on the system in general.
  316. The default startup file is the file "POINT_LIBRARY/startup.tcl" which
  317. completes the Point initialization.  It tries three things until one works:
  318. X
  319. X1. Look for ~/.ptrc and use it as the initialization file.  Otherwise:
  320. X
  321. X2. Look for ./ptsetup.tcl and use it as the initialization file.  Otherwise:
  322. X
  323. X3. Look for $POINT_LIBRARY/ptsetup.tcl and use it as the initialization
  324. X     file.  Otherwise give up.
  325. X
  326. X
  327. This gets you to "ptsetup.tcl" which does the main initialization:
  328. X
  329. X1. It sets up some variables used in other tcl files. See 4 below.
  330. X
  331. X2. It sets personal option preferences.
  332. X
  333. X3. It initializes tcl and autoloading and explicitly loads in the files
  334. X     necessary to run point.
  335. X
  336. X4. Finally you should set HelpDirectory (line 5 in ptsetup.tcl) to the
  337. X     directory where the help files are located.  In the distribution they
  338. X     are in a subdirectory "help".  They are the files of the form *.help.
  339. X
  340. Thus there is one important directory that contains all the tcl files.
  341. This is "tclLib" in the distribution.  Setting POINT_LIBRARY to "tclLib"
  342. and using the default files there should make everything work.
  343. X
  344. This may all seem complicated and it is.  I set things up this way so
  345. that Point would always find system default files no matter where you
  346. start it.  Also the minimum information is kept in the Point binary
  347. and almost all of the setup sequence is in tcl code that is easily changed.
  348. X
  349. X
  350. X        THEN RUN POINT
  351. X
  352. Now you can run "point README" to test it out.
  353. X
  354. You can generate the manual page(s) from doc/point.n with nroff or troff
  355. or ptroff or whatever ("ptroff -man doc/pt.n" in my system).  The reference
  356. manual is in doc/userman.tex. The reference manual is in LaTeX format but
  357. I have also included a Postscript version in doc/userman.ps.  If you are
  358. getting this from comp.sources.x then there will be no Postscript file
  359. and doc/userman.tex will be divided into userman.part1 and userman.part2.
  360. Just cat them together to create the tex file:
  361. X    cat userman.part[12] >userman.tex
  362. X    rm userman.part[12]
  363. X
  364. X
  365. X        PROBLEMS?
  366. X
  367. If you have any problems building Point please call me at 505-277-5446
  368. or email me at crowley@unmvax.cs.unm.edu and I will try my best to
  369. help you overcome your problem.  Even if you find a workaround for a
  370. build problem I would like to hear about it so I can fix it in my stuff.
  371. X
  372. Point is still under active development and any suggestions for changes
  373. and improvement are welcome and very much appreciated.  Also bug reports,
  374. of course.  I will be happy to add features for people who make suggestions.
  375. The file TODO records some of my plans for improvements.
  376. X
  377. X
  378. X        HISTORY
  379. X
  380. Point is an X version of a PC text editor of the same name that was bundled
  381. with the Logitech mouse for a couple of years.  I have been working on the X
  382. version off and on for over a year (mostly off unfortunately).
  383. X
  384. END_OF_FILE
  385. if test 6903 -ne `wc -c <'README'`; then
  386.     echo shar: \"'README'\" unpacked with wrong size!
  387. fi
  388. # end of 'README'
  389. fi
  390. if test -f 'ToDo' -a "${1}" != "-c" ; then 
  391.   echo shar: Will not clobber existing file \"'ToDo'\"
  392. else
  393. echo shar: Extracting \"'ToDo'\" \(380 characters\)
  394. sed "s/^X//" >'ToDo' <<'END_OF_FILE'
  395. This file describes some of the plans I have for improving Point.
  396. X
  397. X* better undo/redo with selective (non-sequential) undo and redo
  398. X* file splits within a single window
  399. X* folded lines as an alternative to horizontal scrolling
  400. X* zero-width selections and typing deletes the selection
  401. X* remove the option limiting the number of open files
  402. X* add hypertext features
  403. X* convert to C++
  404. X
  405. END_OF_FILE
  406. if test 380 -ne `wc -c <'ToDo'`; then
  407.     echo shar: \"'ToDo'\" unpacked with wrong size!
  408. fi
  409. # end of 'ToDo'
  410. fi
  411. if test -f 'command.h' -a "${1}" != "-c" ; then 
  412.   echo shar: Will not clobber existing file \"'command.h'\"
  413. else
  414. echo shar: Extracting \"'command.h'\" \(1608 characters\)
  415. sed "s/^X//" >'command.h' <<'END_OF_FILE'
  416. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/command.h,v 1.9 1992/02/19 16:43:42 crowley Exp crowley $ */
  417. X
  418. struct commandTableEntry {
  419. X    char *command_name;
  420. X    int command_number;
  421. X};
  422. X
  423. X/* Define the functions */
  424. typedef enum {
  425. X    FNOTUSED,    /* so 0 is not a valid command */
  426. X    FDONOTHING,
  427. X    FEXTEND,
  428. X    FINSASCII,
  429. X    FINSERT,
  430. X    FJUSTIFY,
  431. X    FDELETE,
  432. X    FEXCHSCRAP,
  433. X    FCOPYSCRAP,
  434. X    FCOPYTO,
  435. X    FMOVETO,
  436. X    FCOPYFROM,/* duplicate */
  437. X    FMOVEFROM,/* extract */
  438. X    FREDO,
  439. X    FUNDO,
  440. X    FREPLACE,
  441. X    FCTAG,
  442. X    FMATCHCHAR,
  443. X    FBOTFILE,
  444. X    FGOTOSELECTION,
  445. X    FGOBACKTO,
  446. X    FGOTOLINE,
  447. X    FMOVESEL,
  448. X    FWINDOWFONT,
  449. X    FREADONLY,
  450. X    FCANCEL,
  451. X    FSAVEFILE,
  452. X    FWRITEFILE,
  453. X    FSAVEALL,
  454. X    FCLOSEWINDOW,
  455. X    FINFORMONCLOSE,
  456. X    FZOOM,
  457. X    FQUITPOINT,
  458. X    FEXECCMD,
  459. X    FHELP,
  460. X    FREDRAW,
  461. X    FCD,
  462. X    FCHANGECASE,
  463. X    FBROWSERFONT,
  464. X    FINSBLOCK,
  465. X    FCREATEBLOCK,
  466. X    FCREATEATTRIBUTE,
  467. X    FCREATELINK,
  468. X    FCREATEMAP,
  469. X    FCREATEDOCUMENT,
  470. X    FCREATEVIEW,
  471. X    FADDFILETODOCUMENT,
  472. X    FCHANGEMAP,
  473. X    FCLOSEDOCUMENT,
  474. X    FSHOWATTRIBUTES,
  475. X    FSHOWBLOCKS,
  476. X    FSHOWDOCUMENTS,
  477. X    FSHOWFILES,
  478. X    FSHOWLINKS,
  479. X    FSHOWMAPS,
  480. X    FSHOWTEXTS,
  481. X    FSHOWVIEWS,
  482. X    FGOTODIGIT,
  483. X    FSEARCHLETTER,
  484. X    FBROWSER,
  485. X    FPRINTSTATS,
  486. X    FCLOSEBROWSER,
  487. X    FSHOWUNDOS,
  488. X    FREPEATSEARCH,
  489. X    FREPEATSEARCHBACK,
  490. X    FAGAIN,
  491. X    FSCROLLWINDOW,
  492. X    FPOINTSELECTION,
  493. X    FINSERTSTRING,
  494. X    FSEARCHFORS,
  495. X    FGETFILECHARS,
  496. X    FGETROWCOL,
  497. X    FGETWINDOWLIST,
  498. X    FWINDOWNAME,
  499. X    FGETWINDOWINFO,
  500. X    FGETFILEINFO,
  501. X    FRAISELISTWINDOW,
  502. X    FRAISE,
  503. X    FLOWER,
  504. X    FOPTION,
  505. X    FKEY,
  506. X    FMOUSE,
  507. X    FCONFIGURE,
  508. X    FEXPOSE,
  509. X    FVSCROLL,
  510. X    FHSCROLL,
  511. X    FENTERTEXT,
  512. X    FENTERBROWSER,
  513. X    FSETTEXTCOLOR,
  514. X    FOPENWINDOW,
  515. X    FWAITFORRETURNSTRING,
  516. X    FBARRIER,
  517. X    FREGEXSEARCH,
  518. X    FREPEATREGEXSEARCH,
  519. X    FREGEXREPLACEONE,
  520. X    FREGEXREPLACEALL,
  521. X    FLINENUMBERS,
  522. X    FLASTCOMMAND
  523. X} PointCommand;
  524. END_OF_FILE
  525. if test 1608 -ne `wc -c <'command.h'`; then
  526.     echo shar: \"'command.h'\" unpacked with wrong size!
  527. fi
  528. # end of 'command.h'
  529. fi
  530. if test ! -d 'doc' ; then
  531.     echo shar: Creating directory \"'doc'\"
  532.     mkdir 'doc'
  533. fi
  534. if test -f 'file.h' -a "${1}" != "-c" ; then 
  535.   echo shar: Will not clobber existing file \"'file.h'\"
  536. else
  537. echo shar: Extracting \"'file.h'\" \(3257 characters\)
  538. sed "s/^X//" >'file.h' <<'END_OF_FILE'
  539. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/file.h,v 1.2 91/08/01 16:57:49 crowley Exp Locker: crowley $ */
  540. X
  541. X/* a PIECE is a sequence of characters that is contiguous in the logical */
  542. X/* and physical files.  Originally the file is one (big) piece.  As edits */
  543. X/* are made it is divided into more pieces.  The characters in a piece */
  544. X/* are either in the original (unchanged) file or in the add file (which) */
  545. X/* contains all characters that have been added to the file in this editing */
  546. X/* session */
  547. X
  548. struct piece {
  549. X    char flags;        /* record various Boolean data */
  550. X    int file;        /* Unix file handle */
  551. X    BlockID blockID;    /* block piece comes from or NullObject */
  552. X                /* if it comes from a format string */
  553. X    Offset position;    /* start of the piece */
  554. X    Offset length;        /* length of the piece */
  555. X    struct piece *nextClone;/* next piece in the clone list */
  556. X    struct piece *nextPiece;/* next piece in the list */
  557. X    struct piece *prevPiece;/* previous piece in the list */
  558. X};
  559. X
  560. X/* piece.flags constants */
  561. X#define IS_CLONED_PIECE        1
  562. X#define IS_DECORATION        2
  563. X
  564. typedef struct piece *Piece;
  565. X
  566. X/* An open file consists of the original file (which is not changed during */
  567. X/* an editing session) and an add file (where all new characters go). */
  568. X/* The logical file is described in the pieces table which shows where */
  569. X/* the logically contiguous characters in the file are physically located */
  570. X
  571. struct openFile {
  572. X
  573. X    /* flag to keep track of whether this is a view or not */
  574. X    int isView;
  575. X
  576. X    /* the original file size */
  577. X    Offset origFileSize;
  578. X
  579. X    /* the current logical file size -- changed as the file is edited */
  580. X    /* NOT the same as the size of origfile or addfile or their sum */
  581. X    Offset fileSize;
  582. X
  583. X    /* the file being edited -- this is read only */
  584. X    char origName[FILENAMESIZE];
  585. X    int origHandle;
  586. X
  587. X    /* the piece list */
  588. X    Piece pieceList;
  589. X    
  590. X    /* the command history */
  591. X    struct changeItem * cmdHistory;
  592. X
  593. X    /* optimization fields */
  594. X    /* loLogPiece and hiLogPiece are the low and high logical addresses */
  595. X    /* that are mapped by piece number logPiece which is the last piece */
  596. X    /* where a byte was found and is initialized to the one big piece */
  597. X    /* that is the whole file when you start editing. */
  598. X    /* The idea is that once you map a logical byte to a piece, it is */
  599. X    /* likely that the next mapping is in the same piece. */
  600. X    /* loLogBuffer and hiLogBuffer are the logical character limits of */
  601. X    /* some valid characters in a buffer pointed to by logBuffer. */
  602. X    Offset loLogPiece, hiLogPiece, loLogBuffer, hiLogBuffer;
  603. X    Piece logPiece;
  604. X    unsigned char *logBuf;
  605. X
  606. X    /* some file status flags */
  607. X    char useCount;    /* the number of windows using the file */
  608. X    char flags;    /* various information (see below) */
  609. X};
  610. X
  611. X/* flags */
  612. X#define BAK_MADE    1    /* a backup copy has been made */
  613. X#define READ_ONLY    2    /* file cannot be written (changeable) */
  614. X#define IS_CHANGED    4    /* file has been changed but not yet saved */
  615. X#define NO_WRITES    8    /* file can never be written (no changeable) */
  616. X
  617. X/* a disk buffer (both in and out of the address space) */
  618. struct diskBuffer {
  619. X    int handle;    /* DOS file handle */
  620. X    /* double linked hash chain links */
  621. X    struct diskBuffer *forwardHash, *backwardHash;
  622. X    int blockNumber;
  623. X    unsigned char *bufferAddress;
  624. X    char written;    /* =1 if an add file block */
  625. X};
  626. END_OF_FILE
  627. if test 3257 -ne `wc -c <'file.h'`; then
  628.     echo shar: \"'file.h'\" unpacked with wrong size!
  629. fi
  630. # end of 'file.h'
  631. fi
  632. if test -f 'findfiles.c' -a "${1}" != "-c" ; then 
  633.   echo shar: Will not clobber existing file \"'findfiles.c'\"
  634. else
  635. echo shar: Extracting \"'findfiles.c'\" \(2511 characters\)
  636. sed "s/^X//" >'findfiles.c' <<'END_OF_FILE'
  637. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/findfiles.c,v 1.5 1992/03/04 17:07:18 crowley Exp crowley $ */
  638. X
  639. X#include <sys/types.h>
  640. X#include "pt.h"
  641. X#ifdef SYSV
  642. X#include <dirent.h>
  643. X#else
  644. X#include <sys/dir.h>
  645. X#endif
  646. X#include <ctype.h>
  647. X#include <string.h>
  648. X#include <stdio.h>
  649. X
  650. X/* scratch file name */
  651. char scratchFileName[FILENAMESIZE];
  652. X
  653. char *
  654. makeFullPathname(origName)
  655. X    char *origName;
  656. X{
  657. X    extern char msgBuffer[];
  658. X    extern char scratchFileName[];
  659. X
  660. X    int n;
  661. X    register char *p;
  662. X    char *fromPtr, *toPtr;
  663. X
  664. X    /* first figure out what we have to do */
  665. X    if( origName[0] != '/' ) {
  666. X        /* must prepend the current drive and directory */
  667. X        (void)getcwd(scratchFileName, FILENAMESIZE);
  668. X        n = strlen(scratchFileName);
  669. X        if( scratchFileName[n-1] != '/' ) {
  670. X            scratchFileName[n++] = '/';
  671. X            scratchFileName[n] = '\0';
  672. X        }
  673. X    } else
  674. X        scratchFileName[0] = '\0';
  675. X    strncat(scratchFileName, origName, FILENAMESIZE);
  676. X    
  677. X    /* now eliminate any ".." components */
  678. X    p = scratchFileName;
  679. X    while( *p != '\0' ) {
  680. X        /* look for a "/../" */
  681. X        if( *p=='.' && *(p+1)=='.' && *(p-1)=='/' && *(p+2)=='/' ) {
  682. X            /* find the previous path component */
  683. X            n = 2;
  684. X            while( 1 ) {
  685. X                if( (p-n) < scratchFileName )
  686. X                    /* string is "component/../ ..." */
  687. X                    break;
  688. X                if( *(p-n) == '/' )
  689. X                    break;
  690. X                ++n;
  691. X            }
  692. X            /* eliminate the "component/../" by copying the */
  693. X            /* rest of the  string up n character positions */
  694. X            fromPtr = p + 3;
  695. X            /* *(p-n) is the last character to keep so: */
  696. X            toPtr = p - n + 1;
  697. X            /* move p to continue the scan at the beginning */
  698. X            /* of the moved part of the string */
  699. X            p = toPtr;
  700. X            while( 1 ) {
  701. X                if( (*toPtr++ = *fromPtr++) == '\0' )
  702. X                    break;
  703. X            }
  704. X        } else
  705. X            ++p;
  706. X    }
  707. X
  708. X    return scratchFileName;
  709. X}
  710. X
  711. int
  712. striccmp( a, b )
  713. X    char *a, *b;
  714. X{
  715. X    char cha, chb;
  716. X
  717. X    while( 1 ) {
  718. X        chb = *b++;
  719. X        if( (cha = *a++) == '\0' )
  720. X            break;
  721. X        /* not end of string for 'a' */
  722. X        if( cha != chb ) {
  723. X            if( isupper(cha) )
  724. X                cha = tolower(cha);
  725. X            if( isupper(chb) )
  726. X                chb = tolower(chb);
  727. X            if( cha != chb )    
  728. X                break;
  729. X            /* either chb is a letter hence not end of string */
  730. X            /* for 'b' or if cha != chb we break */
  731. X        } /* else cha == chb hence not end of string for 'b' either */
  732. X    }
  733. X    return cha - chb;
  734. X}
  735. X
  736. struct window *
  737. findFilenameWindow(filename)
  738. X    char *filename;
  739. X{
  740. X    extern struct window *windowList;
  741. X    extern struct openFile *files;
  742. X
  743. X    register struct window *w;
  744. X
  745. X    w = windowList;
  746. X    while( w != NULL ) {
  747. X        if( striccmp(files[w->fileId].origName, filename) == 0 )
  748. X            return w;
  749. X        w = w->nextWindow;
  750. X    }
  751. X    return NULL;
  752. X}
  753. END_OF_FILE
  754. if test 2511 -ne `wc -c <'findfiles.c'`; then
  755.     echo shar: \"'findfiles.c'\" unpacked with wrong size!
  756. fi
  757. # end of 'findfiles.c'
  758. fi
  759. if test ! -d 'help' ; then
  760.     echo shar: Creating directory \"'help'\"
  761.     mkdir 'help'
  762. fi
  763. if test -f 'help/fkeys.help' -a "${1}" != "-c" ; then 
  764.   echo shar: Will not clobber existing file \"'help/fkeys.help'\"
  765. else
  766. echo shar: Extracting \"'help/fkeys.help'\" \(1313 characters\)
  767. sed "s/^X//" >'help/fkeys.help' <<'END_OF_FILE'
  768. XFUNCTION KEY BINDINGS
  769. X
  770. XF1    Delete the selection to the scrap buffer
  771. XF2    Insert the contents of the scrap buffer in front of the selection
  772. XF3    Search backwards for the last string that was searched for
  773. XF4    Search forewards for the last string that was searched for
  774. XF5    Repeat the last edit but with the current selection and insertion point
  775. XF6    Redo the most recently undone edit in the file
  776. XF7    Scroll the window up (towards the beginning of the file) one screenful
  777. XF8    Scroll the window down (towards the end of the file) one screenful
  778. XF9    Undo the most recently done edit
  779. Up    Move the selection up one line
  780. Down    Move the selection down one line
  781. Right    Move the selection one character to the right
  782. Left    Move the selection one character to the left
  783. Home    Move the selection to the first non-white space character on the line
  784. XEnd    Move the selection to the last character on the line (the newline)
  785. PageUp    Scroll the window one page up (towards the beginning of the file)
  786. PageDown Scroll the window one page down (towards the end of the file)
  787. X
  788. TO CLOSE THIS WINDOW: click the left mouse button on the `Close' command
  789. X            on the menu bar at the top of this window.
  790. X
  791. TO CHANGE THESE BINDING: edit the startup file `ptsetup.tcl'.  Search for
  792. X            the string 'TextBindings' and you can probably figure
  793. X            out how to change a binding.
  794. END_OF_FILE
  795. if test 1313 -ne `wc -c <'help/fkeys.help'`; then
  796.     echo shar: \"'help/fkeys.help'\" unpacked with wrong size!
  797. fi
  798. # end of 'help/fkeys.help'
  799. fi
  800. if test -f 'help/general.help' -a "${1}" != "-c" ; then 
  801.   echo shar: Will not clobber existing file \"'help/general.help'\"
  802. else
  803. echo shar: Extracting \"'help/general.help'\" \(651 characters\)
  804. sed "s/^X//" >'help/general.help' <<'END_OF_FILE'
  805. X        GENERAL HELP ON POINT
  806. X
  807. TO CLOSE THIS WINDOW: click the left mouse button on the `Close' command
  808. X            on the menu bar at the top of this window.
  809. X
  810. TO EXIT POINT: If a file browser window is in your screen, move the mouse to
  811. X        the `QUIT' box on the right side of its top menu bar.  Press
  812. X        the left mouse button and select a quit option.
  813. X           If there is no file browser visible, move the mouse sprite to
  814. X        to the `FILE' box on the left side of the menu bar of this
  815. X        window. Press the left mouse button and move the mouse sprite
  816. X        down to the box labelled `Open ...' and release the mouse
  817. X        button.  When the file browser appears use its QUIT menu.
  818. X
  819. END_OF_FILE
  820. if test 651 -ne `wc -c <'help/general.help'`; then
  821.     echo shar: \"'help/general.help'\" unpacked with wrong size!
  822. fi
  823. # end of 'help/general.help'
  824. fi
  825. if test -f 'help/index.help' -a "${1}" != "-c" ; then 
  826.   echo shar: Will not clobber existing file \"'help/index.help'\"
  827. else
  828. echo shar: Extracting \"'help/index.help'\" \(300 characters\)
  829. sed "s/^X//" >'help/index.help' <<'END_OF_FILE'
  830. fkeys.help 500 400 +0 +0 function keys function key keyboard keystroke
  831. general.help 500 400 +0 +0 general
  832. mmenus.help 500 400 +0 +0 mouse menus mouse menu popup menus popup menu
  833. scroll.help 500 400 +0 +0 scroll scrolling scroll bar slider
  834. options.help 500 400 +0 +0 option options resource resources
  835. END_OF_FILE
  836. if test 300 -ne `wc -c <'help/index.help'`; then
  837.     echo shar: \"'help/index.help'\" unpacked with wrong size!
  838. fi
  839. # end of 'help/index.help'
  840. fi
  841. if test -f 'help/mmenus.help' -a "${1}" != "-c" ; then 
  842.   echo shar: Will not clobber existing file \"'help/mmenus.help'\"
  843. else
  844. echo shar: Extracting \"'help/mmenus.help'\" \(1053 characters\)
  845. sed "s/^X//" >'help/mmenus.help' <<'END_OF_FILE'
  846. X        HELP ON POPUP MOUSE MENUS
  847. X
  848. TO POPUP A MOUSE MENU: With the mouse sprite inside the text area, press the
  849. X    middle or right mouse button.  Wait 0.6 seconds and the menu will
  850. X    pop up.
  851. TO CANCEL A MOUSE MENU WITHOUT EXECUTING ANY COMMANDS: Click the left mouse
  852. X    button and then release the middle or right mouse button.
  853. TO SELECT ITEMS ON THE MOUSE MENU: While holding down the middle or right 
  854. X    mouse button, move around the menu.  The item closest to the mouse
  855. X    sprite will be selected.
  856. TO EXECUTE A COMMAND ON A MOUSE MENU: Select the item and release the middle
  857. X    or right mouse button while it is selected.
  858. TO EXECUTE A MOUSE MENU COMMAND QUICKLY: Press the middle or right mouse
  859. X    button (do not wait for the menu to come up), move in the direction
  860. X    of the item and release the mouse button.  For the first 0.6 second
  861. X    the menu is logically there but doesn't appear.
  862. MIDDLE MOUSE BUTTON COMMANDS:
  863. X        Del        Del:  Delete the selection
  864. X         |        Move: Move the selection to this point
  865. Move <- Dup -> Copy    Dup:  CopyToHereMode
  866. X         |
  867. X        Ins
  868. END_OF_FILE
  869. if test 1053 -ne `wc -c <'help/mmenus.help'`; then
  870.     echo shar: \"'help/mmenus.help'\" unpacked with wrong size!
  871. fi
  872. # end of 'help/mmenus.help'
  873. fi
  874. if test -f 'help/options.help' -a "${1}" != "-c" ; then 
  875.   echo shar: Will not clobber existing file \"'help/options.help'\"
  876. else
  877. echo shar: Extracting \"'help/options.help'\" \(1436 characters\)
  878. sed "s/^X//" >'help/options.help' <<'END_OF_FILE'
  879. X        HELP ON OPTIONS
  880. X
  881. TO ACCESS OPTIONS: Move the mouse sprite to the box labelled `PREFS' on the
  882. X    left side of the top menu bar of the file browser.  Press the
  883. X    left mouse button and a menu will drop down.
  884. X
  885. TO KEEP THE OPTIONS MENU ON THE SCREEN: Move the mouse sprite to the box
  886. X    labelled `PREFS' on the left side of the top menu bar of the file
  887. X    browser.  Hold down the SHIFT key and press the left mouse button.
  888. X    Hold down the left mouse button and move the menu where you want it
  889. X    to go and then release the left mouse button.
  890. X
  891. TO CHANGE BOOLEAN OPTIONS: Boolean option have a square box on the left.
  892. X    The square is dark if the option is on or true.  Change them
  893. X    (off to on or on to off) by clicking on them.
  894. X
  895. TO CHANGE 'ONE OF SEVERAL' OPTIONS: These options have diamonds on their left.
  896. X    Click on the new one to change to it, the old value will be
  897. X    automatically turned off.
  898. X
  899. TO CHANGE STRING VALUED OPTIONS: Menu items followed by `...' will pop up a
  900. X    dialogue box when you select them.  These are used for options that
  901. X    have a string value.  Move the mouse cursor to the entry field
  902. X    (no mouse click is necessary) and type in the new value.  Entering
  903. X    a carriage return at the end signals the end of the string and
  904. X    sets the new value.
  905. X    
  906. TO GET TO SUBMENUS: Submenus have a `==>' on their right.  Move the mouse
  907. X    sprite over the item and the submenu will appear.  Move directly
  908. X    right over to the submenu to select items on it.
  909. X
  910. END_OF_FILE
  911. if test 1436 -ne `wc -c <'help/options.help'`; then
  912.     echo shar: \"'help/options.help'\" unpacked with wrong size!
  913. fi
  914. # end of 'help/options.help'
  915. fi
  916. if test -f 'help/scroll.help' -a "${1}" != "-c" ; then 
  917.   echo shar: Will not clobber existing file \"'help/scroll.help'\"
  918. else
  919. echo shar: Extracting \"'help/scroll.help'\" \(1270 characters\)
  920. sed "s/^X//" >'help/scroll.help' <<'END_OF_FILE'
  921. X        HELP ON SCROLLING AND SCROLLBARS
  922. X
  923. TO SCROLL DOWN (towards the end of the file): Move the mouse sprite inside
  924. X        the scrollbar on the left side of the window next to the line
  925. X        you want to be the new top line in the window.  Then click the
  926. X        RIGHT mouse button.  Hold down for continuous scrolling.
  927. X
  928. TO SCROLL UP (towards the beginning of the file): Move the mouse sprite inside
  929. X        the scrollbar on the left side of the window next to the line
  930. X        you want to be the new top line in the window.  Then click the
  931. X        LEFT mouse button.  Hold down for continuous scrolling.
  932. X
  933. TO KNOW WHERE YOU ARE IN THE FILE: The entire scrollbar represent the whole
  934. X        file.  The slider inside it represents the part of the file
  935. X        you are seeing.
  936. X
  937. TO JUMP TO A PLACE IN THE FILE: Move the mouse sprite inside the scrollbar
  938. X        on the left side of the window at the approximate place in
  939. X        the file you want to jump to.  That is, if you want to go to
  940. X        a place about 3/4 of the way through the file, move the mouse
  941. X        sprite 3/4 of the way down the scroll bar.  Then press the
  942. X        MIDDLE mouse button.  The window will jump to that spot.
  943. X        Move the mouse up or down while holding down the middle mouse
  944. X        button to adject.  Release the mouse button when you are
  945. X        happy with where you are in the file.
  946. END_OF_FILE
  947. if test 1270 -ne `wc -c <'help/scroll.help'`; then
  948.     echo shar: \"'help/scroll.help'\" unpacked with wrong size!
  949. fi
  950. # end of 'help/scroll.help'
  951. fi
  952. if test -f 'lines.c' -a "${1}" != "-c" ; then 
  953.   echo shar: Will not clobber existing file \"'lines.c'\"
  954. else
  955. echo shar: Extracting \"'lines.c'\" \(3332 characters\)
  956. sed "s/^X//" >'lines.c' <<'END_OF_FILE'
  957. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/lines.c,v 1.1 1991/07/05 16:34:41 crowley Exp crowley $ */
  958. X
  959. X#include <ctype.h>
  960. X#include "pt.h"
  961. X
  962. Offset
  963. readLine( fid, cp, buffer, makeLowerCase )
  964. X    int fid;
  965. X    Offset cp;
  966. X    char *buffer;
  967. X    int makeLowerCase;
  968. X{
  969. X    extern int getSpanSize;
  970. X
  971. X    char *limit = buffer + MSGBUFFERSIZE - 1;
  972. X    char ch;
  973. X    unsigned char *firstByte = (unsigned char *)1;
  974. X    unsigned char *lastByte = (unsigned char *)0;
  975. X
  976. X    while( buffer < limit ) {
  977. X                if( firstByte > lastByte ) {
  978. X                        if( getSpan( fid, cp, &firstByte, &lastByte, 0 ) )
  979. X                break;
  980. X                }
  981. X        ++cp;
  982. X        ch = (char)(*firstByte++);
  983. X++getSpanSize;
  984. X        if( makeLowerCase && isupper(ch) )
  985. X            ch = tolower(ch);
  986. X        *buffer++ = ch;
  987. X        if( ch == '\n' )
  988. X            break;
  989. X    }
  990. X    *buffer = '\0';
  991. X    return cp;
  992. X}
  993. X
  994. Offset
  995. nextLine( fid, cp, n)
  996. X    int fid;
  997. X    Offset cp;
  998. X    int *n;
  999. X{
  1000. X    extern int getSpanSize;
  1001. X
  1002. X    int nLines = 0;
  1003. X    unsigned char *firstByte = (unsigned char *)1;
  1004. X    unsigned char *lastByte = (unsigned char *)0;
  1005. X
  1006. X    while( nLines < *n ) {
  1007. X                if( firstByte > lastByte ) {
  1008. X                        if( getSpan( fid, cp, &firstByte, &lastByte, 0 ) )
  1009. X                break;
  1010. X                }
  1011. X        if( (char)(*firstByte++) == '\n' )
  1012. X            ++nLines;
  1013. X++getSpanSize;
  1014. X        ++cp;
  1015. X    }
  1016. X    *n = nLines;
  1017. X    return cp;
  1018. X}
  1019. X
  1020. X/*
  1021. X * prevLine backs up 'n' lines or partial lines.  That is, if it starts at the
  1022. X * beginning of a line it will not count that line but if it starts in the
  1023. X * middle of a line it will count that part of the line.
  1024. X *
  1025. X * A special case is when n == -1, then prevLine backs up to the beginning
  1026. X * of the current line.  If it is already at the beginning of the line it
  1027. X * does not change cp, else it moves cp to the first character of the line.
  1028. X */
  1029. Offset
  1030. prevLine( fid, cp, n )
  1031. X    int fid;
  1032. X    Offset cp;
  1033. X    int *n;
  1034. X{
  1035. X    int uch;
  1036. X    int nLines = 0;
  1037. X    unsigned char *firstByte = (unsigned char *)1;
  1038. X    unsigned char *lastByte = (unsigned char *)0;
  1039. X
  1040. X    /* are we already off one of the beginning? */
  1041. X    if( cp <= 0 ) {
  1042. X        *n = 0;
  1043. X        return (Offset)0;
  1044. X    }
  1045. X
  1046. X    /* read the characters before the one we are on */
  1047. X    uch = getFileByte( fid, --cp );
  1048. X
  1049. X    /* you can't move past the beginning of the text so just return */
  1050. X    if( uch == BLOCK_EOF ) {
  1051. X        *n = 0;
  1052. X        /* Move back to the first character of the file. */
  1053. X        return (Offset)0;
  1054. X    }
  1055. X
  1056. X    /* Now see if we are starting at the beginning of a line */
  1057. X    if( (char)uch == '\n' ) {
  1058. X        if( *n == -1 ) {
  1059. X            *n = 0;
  1060. X            return cp + 1;
  1061. X        }
  1062. X    }
  1063. X
  1064. X    /* since we handled the beginning of line case above.  The n==-1 */
  1065. X    /* special case reduces to the case of n==1 */
  1066. X    if( *n == -1 )
  1067. X        *n = 1;
  1068. X
  1069. X    /* Now loop through the lines */
  1070. X    while( nLines < *n ) {
  1071. X        --cp;
  1072. X                if( firstByte > lastByte ) {
  1073. X                        if( getSpan( fid, cp, &firstByte, &lastByte, 1 ) ) {
  1074. X                            /* end of file, count as a line */
  1075. X                ++nLines;
  1076. X                break;
  1077. X            }
  1078. X                }
  1079. X        if( ((char)(*lastByte--)) == '\n' )
  1080. X            ++nLines;
  1081. X#ifdef XXXXXX
  1082. X                uch = getFileByte( fid, --cp );
  1083. X                if( uch == BLOCK_EOF ) {
  1084. X                        ++nLines;
  1085. X                        break;
  1086. X                }
  1087. X                if( ((char)uch) == '\n' )
  1088. X                        ++nLines;
  1089. X#endif
  1090. X    }
  1091. X    /* send back the number of lines we really did back up */
  1092. X    *n = nLines;
  1093. X
  1094. X    /* we moved one past the character we are looking for */
  1095. X    return cp + 1;
  1096. X}
  1097. END_OF_FILE
  1098. if test 3332 -ne `wc -c <'lines.c'`; then
  1099.     echo shar: \"'lines.c'\" unpacked with wrong size!
  1100. fi
  1101. # end of 'lines.c'
  1102. fi
  1103. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  1104.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  1105. else
  1106. echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
  1107. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  1108. X#define PATCHLEVEL 0
  1109. END_OF_FILE
  1110. if test 21 -ne `wc -c <'patchlevel.h'`; then
  1111.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  1112. fi
  1113. # end of 'patchlevel.h'
  1114. fi
  1115. if test -f 'piece.c' -a "${1}" != "-c" ; then 
  1116.   echo shar: Will not clobber existing file \"'piece.c'\"
  1117. else
  1118. echo shar: Extracting \"'piece.c'\" \(3377 characters\)
  1119. sed "s/^X//" >'piece.c' <<'END_OF_FILE'
  1120. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/piece.c,v 1.4 1992/03/04 17:07:18 crowley Exp crowley $ */
  1121. X
  1122. X#include "pt.h"
  1123. X
  1124. X/* piece table */
  1125. Piece freePList;
  1126. unsigned int bytesLeft;
  1127. unsigned int piecesLeft;
  1128. X
  1129. Piece 
  1130. dupPieces(pp)
  1131. X    Piece pp;
  1132. X{
  1133. X    Piece pp2;
  1134. X    Piece lastpp, retpp;
  1135. X
  1136. X    lastpp = retpp = NULL;
  1137. X    while( pp != NULL ) {
  1138. X        pp2 = getFreePiece();
  1139. X        /* link to the previous piece */
  1140. X        if( lastpp != NULL )
  1141. X            lastpp->nextPiece = pp2;
  1142. X        else    /* first time through, remember the first piece */
  1143. X            retpp = pp2;
  1144. X        pp2->prevPiece = lastpp;
  1145. X        /* copy the field values */
  1146. X        pp2->file = pp->file;
  1147. X        pp2->position = pp->position;
  1148. X        pp2->length = pp->length;
  1149. X        lastpp = pp2;
  1150. X        pp = pp->nextPiece;
  1151. X    }
  1152. X    /* pp2->nextPiece == NULL already since getFreePiece does that */
  1153. X    return retpp;
  1154. X}
  1155. X
  1156. Piece 
  1157. getFreePiece()
  1158. X{
  1159. X    extern char msgBuffer[];
  1160. X    extern Piece freePList;
  1161. X    extern unsigned int bytesLeft;
  1162. X    extern unsigned int piecesLeft;
  1163. X    extern int piecesRequested;
  1164. X    extern int piecesAllocated;
  1165. X    extern int debug;
  1166. X    
  1167. X    Piece pp;
  1168. X    
  1169. X++piecesRequested;
  1170. X    pp = freePList;
  1171. X    if( pp != NULL ) {
  1172. X        --piecesLeft;
  1173. X        freePList = freePList->nextPiece;
  1174. X    } else { /* we have to allocate a piece structure from the free space */
  1175. X++piecesAllocated;
  1176. X        pp = (Piece)PtMalloc(sizeof(struct piece), "piece" );
  1177. X    }
  1178. X    pp->nextPiece = pp->prevPiece = NULL;
  1179. X    pp->flags = 0;
  1180. X    pp->blockID = NullObject;
  1181. X    pp->nextClone = pp;
  1182. X    return pp;
  1183. X}
  1184. X
  1185. void
  1186. freePieces(pp)
  1187. X    Piece pp;
  1188. X{
  1189. X    extern Piece freePList;
  1190. X    extern unsigned int piecesLeft;
  1191. X    extern int piecesFreed;
  1192. X    
  1193. X    Piece pp2;
  1194. X    
  1195. X    if( pp == NULL )
  1196. X        return;
  1197. X++piecesFreed;
  1198. X    pp2 = pp;
  1199. X    while( pp2->nextPiece != NULL ) {
  1200. X        pp2 = pp2->nextPiece;
  1201. X        ++piecesLeft;
  1202. X    }
  1203. X    pp2->nextPiece = freePList;
  1204. X    freePList = pp;
  1205. X    ++piecesLeft;
  1206. X}
  1207. X
  1208. Piece 
  1209. findPiece(logPos, ff, beginLogPos)
  1210. X    Offset logPos, *beginLogPos;
  1211. X    struct openFile *ff;
  1212. X{
  1213. X    extern char msgBuffer[];
  1214. X    extern int piecesSearchedFor;
  1215. X    extern int piecesScanned;
  1216. X    extern int scanned0pieces;
  1217. X    extern int scanned1pieces;
  1218. X    extern int scanned2pieces;
  1219. X    extern int scanned3PlusPieces;
  1220. X
  1221. X    Piece pp;
  1222. X    Offset nn, n2;
  1223. X    int savePiecesScanned;
  1224. X
  1225. X++piecesSearchedFor;
  1226. savePiecesScanned = piecesScanned;
  1227. X    /* see if we already know what piece it is in */
  1228. X    pp = ff->logPiece;
  1229. X    nn = ff->loLogPiece;
  1230. X    if( ff->loLogPiece <= logPos && logPos <= ff->hiLogPiece )
  1231. X        /*EMPTY*/
  1232. X    {
  1233. X        /* now nn = first logical byte in this piece */
  1234. X    } else {    /* go through the piece table */
  1235. X        if( logPos < nn ) {    /* below this piece? */
  1236. X            if( logPos < 0 ) {  /* error checking to be safe */
  1237. X                msg("findPiece: byte number < 0", 1);
  1238. X                return pp;    /* what else? */
  1239. X            }
  1240. X            /* search down for the piece */
  1241. X            while( logPos < nn ) {
  1242. X                pp = pp->prevPiece;
  1243. X++piecesScanned;
  1244. X                nn -= pp->length;
  1245. X            }
  1246. X        } else {    /* must be at or above this piece */
  1247. X            if( logPos >= ff->fileSize ) {
  1248. X                /* return the last piece */
  1249. X                while( pp->nextPiece != NULL ) {
  1250. X                    nn += pp->length;
  1251. X++piecesScanned;
  1252. X                    pp = pp->nextPiece;
  1253. X                }
  1254. X            } else {
  1255. X                /* search up for the piece */
  1256. X                while( 1 ) {
  1257. X                    n2 = nn + pp->length;
  1258. X                    if( logPos < n2 )
  1259. X                        break;
  1260. X                    if( pp->nextPiece == NULL )
  1261. X                        break;
  1262. X                    nn = n2;
  1263. X++piecesScanned;
  1264. X                    pp = pp->nextPiece;
  1265. X                }
  1266. X            }
  1267. X        }
  1268. X    }
  1269. X    *beginLogPos = nn;
  1270. switch( piecesScanned - savePiecesScanned ) {
  1271. case 0: ++scanned0pieces; break;
  1272. case 1: ++scanned1pieces; break;
  1273. case 2: ++scanned2pieces; break;
  1274. default: ++scanned3PlusPieces; break;
  1275. X}
  1276. X    return pp;
  1277. X}
  1278. END_OF_FILE
  1279. if test 3377 -ne `wc -c <'piece.c'`; then
  1280.     echo shar: \"'piece.c'\" unpacked with wrong size!
  1281. fi
  1282. # end of 'piece.c'
  1283. fi
  1284. if test -f 'tags.c' -a "${1}" != "-c" ; then 
  1285.   echo shar: Will not clobber existing file \"'tags.c'\"
  1286. else
  1287. echo shar: Extracting \"'tags.c'\" \(3563 characters\)
  1288. sed "s/^X//" >'tags.c' <<'END_OF_FILE'
  1289. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/tags.c,v 1.6 1992/03/04 17:07:18 crowley Exp crowley $ */
  1290. X
  1291. X#include <stdio.h>
  1292. X#include "pt.h"
  1293. X
  1294. void
  1295. findCTag( ctag )
  1296. X    char *ctag;
  1297. X{
  1298. X    extern struct window *selWindow;
  1299. X    extern Offset selBegin, selEnd;
  1300. X    extern int selMode;
  1301. X    extern int ignoreCase;
  1302. X    extern int linesOverFind;
  1303. X    extern char msgBuffer[];
  1304. X    extern struct openFile *files;
  1305. X    extern char * textGeometry;
  1306. X
  1307. X    int tags_file;
  1308. X    char *p, *p_limit, *file_name, *search_string;
  1309. X    int ctag_len, f_len, line_number;
  1310. X    int n, len, linesPassed;
  1311. X    Offset cp;
  1312. X    char ch;
  1313. X    int saveIgnoreCase;
  1314. X    struct window *w;
  1315. X
  1316. X    ctag_len = strlen( ctag );
  1317. X
  1318. X    /* open the tags file */
  1319. X    tags_file = getFileId( "tags" );
  1320. X    if( tags_file < 0 ) {
  1321. X        msg("Could not open 'tags' file\n", 1);
  1322. X        goto CleanUp1;
  1323. X    }
  1324. X
  1325. X    /* search for the selection in the tags file */
  1326. X    f_len = fileSize( tags_file );
  1327. X    line_number = 0;
  1328. X    saveIgnoreCase = ignoreCase;
  1329. X    ignoreCase = 0;
  1330. X    cp = -1;
  1331. X    while( 1 ) {
  1332. X        cp = searchSpans( tags_file, cp+1, f_len, ctag, ctag_len,
  1333. X                            &line_number);
  1334. X        if( cp < 0 ) {
  1335. X            sprintf( msgBuffer, "%s not found in the tags file\n",
  1336. X                                    ctag);
  1337. X            msg( msgBuffer, 1);
  1338. X            goto CleanUp2;
  1339. X        }
  1340. X        /* make sure it is at the beginning of a line */
  1341. X        if( cp == 0 )
  1342. X            break;
  1343. X        ch = getFileByte( tags_file, cp-1 );
  1344. X        if( ch == '\n' )
  1345. X            break;
  1346. X    }
  1347. X
  1348. X    /* extract the file name and the search string for the tag */
  1349. X    file_name = (char *)PtMalloc( MSGBUFFERSIZE, "file name" );
  1350. X    search_string = (char *)PtMalloc( MSGBUFFERSIZE, "search string" );
  1351. X    /* scan to the first tab */
  1352. X    while( 1 ) {
  1353. X        ch = getFileByte( tags_file, cp++ );
  1354. X        if( (char)ch == '\t' )
  1355. X            break;
  1356. X    }
  1357. X    /* copy the file name */
  1358. X    p = file_name;
  1359. X    p_limit = p + MSGBUFFERSIZE;
  1360. X    while( p < p_limit ) {
  1361. X        ch = (char)getFileByte( tags_file, cp++ );
  1362. X        if( ch == '\t' )
  1363. X            break;
  1364. X        *p++ = ch;
  1365. X    }
  1366. X    *p = '\0';    /* terminate the string */
  1367. X    /* copy the search string */
  1368. X    cp += 2;    /* skip the '/^' */
  1369. X    p = search_string;
  1370. X    p_limit = p + MSGBUFFERSIZE;
  1371. X    while( p < p_limit ) {
  1372. X        ch = (char)getFileByte( tags_file, cp++ );
  1373. X        if( ch == '\n' )
  1374. X            break;
  1375. X        *p++ = ch;
  1376. X    }
  1377. X    p -= 2;        /* skip the '$/' */
  1378. X    *p = '\0';    /* terminate the string */
  1379. X
  1380. X    /* see if the file is already in a window */
  1381. X    p = makeFullPathname( file_name );
  1382. X    w = findFilenameWindow( p );
  1383. X    if( w != NULL )
  1384. X        topWindow( w );
  1385. X    else
  1386. X        w = createWindow( NULL, file_name, textGeometry );
  1387. X
  1388. X    /* make the string we found the selection */
  1389. X    /* first erase the old selection */
  1390. X    if( selWindow != w ) {
  1391. X        drawSelection( 1 );
  1392. X        selWindow = w;
  1393. X    }
  1394. X    /* then find the search string in the file */
  1395. X    len = strlen( search_string );
  1396. X    cp = searchSpans( w->fileId, 0, fileSize(w->fileId),
  1397. X        search_string, len, &linesPassed);
  1398. X    if( cp == -1 ) {
  1399. X        printf("listCB: ERROR: ctag %s not found in file %s\n",
  1400. X            search_string, files[w->fileId].origName);
  1401. X        goto CleanUp3;
  1402. X    }
  1403. X
  1404. X    /* make it the selection */
  1405. X    selBegin = cp;
  1406. X    selEnd = cp + len - 1;
  1407. X    selMode = SELCHAR;
  1408. X    AssertSelectionOwnership();
  1409. X
  1410. X    /* jump the window to show the string we found */
  1411. X    /* find the number of lines in the window */
  1412. X    n = selWindow->nRows;
  1413. X    if( linesOverFind > n )
  1414. X        /* if linesOverFind would place it outside the */
  1415. X        /* window then put it in the middle of the window */
  1416. X        n >>= 1;
  1417. X    else
  1418. X        /* otherwise put it linesOverFind lines down */
  1419. X        n = linesOverFind;
  1420. X    linesPassed -= n;
  1421. X    if( linesPassed < 0 )
  1422. X        linesPassed = 0;
  1423. X    doGoto( w, linesPassed, 0 );
  1424. X
  1425. X    /* close the tags file and free the strings */
  1426. CleanUp3:
  1427. X    PtFree( file_name );
  1428. X    PtFree( search_string );
  1429. CleanUp2:
  1430. X    ignoreCase = saveIgnoreCase;
  1431. X    closeFile( tags_file, 2 );
  1432. CleanUp1:
  1433. X    PtFree( ctag );
  1434. X}
  1435. END_OF_FILE
  1436. if test 3563 -ne `wc -c <'tags.c'`; then
  1437.     echo shar: \"'tags.c'\" unpacked with wrong size!
  1438. fi
  1439. # end of 'tags.c'
  1440. fi
  1441. if test -f 'tcl.c' -a "${1}" != "-c" ; then 
  1442.   echo shar: Will not clobber existing file \"'tcl.c'\"
  1443. else
  1444. echo shar: Extracting \"'tcl.c'\" \(1559 characters\)
  1445. sed "s/^X//" >'tcl.c' <<'END_OF_FILE'
  1446. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/tcl.c,v 1.1 1991/10/10 23:46:27 crowley Exp $ */
  1447. X
  1448. X#include <stdio.h>
  1449. X#include "pt.h"
  1450. X
  1451. Tcl_Interp * interp = NULL;
  1452. X
  1453. char *
  1454. XExecTclCommand( command )
  1455. X    char * command;
  1456. X{
  1457. X    extern Tcl_Interp * interp;
  1458. X
  1459. X    int result = Tcl_Eval( interp, command, 0, (char **)NULL );
  1460. X
  1461. X    if( *interp->result != 0 && result != TCL_OK )
  1462. X            printf("%s\n", interp->result);
  1463. X    return interp->result;
  1464. X}
  1465. X
  1466. X/*ARGSUSED*/
  1467. int
  1468. doPtCommand( clientData, interp, argc, argv )
  1469. X    ClientData clientData;
  1470. X    Tcl_Interp * interp;
  1471. X    int argc;
  1472. X    char *argv[];
  1473. X{
  1474. X    extern struct window *activeWindow;
  1475. X    extern int debug;
  1476. X    
  1477. X    int i;
  1478. X    char *args[6];
  1479. X
  1480. X    for( i = 1; i < argc; ++i )
  1481. X        args[i-1] = argv[i];
  1482. X    for( ; i <= 6; ++i )
  1483. X        args[i-1] = "";
  1484. X    (void)command( (int)clientData, args[0], args[1], args[2], args[3],
  1485. X                            args[4], args[5] );
  1486. X    return TCL_OK;
  1487. X}
  1488. X
  1489. X/*ARGSUSED*/
  1490. void
  1491. ptTcl(w, event, args, nargs)
  1492. X    int w;
  1493. X    XButtonEvent *event;
  1494. X    String *args;
  1495. X    Cardinal *nargs;
  1496. X{
  1497. X    extern char msgBuffer[];
  1498. X    extern Tcl_Interp * interp;
  1499. X
  1500. X    int i;
  1501. X    char ch, *to, *from, *limit;
  1502. X
  1503. X    to = msgBuffer;
  1504. X    limit = msgBuffer + MSGBUFFERSIZE - 1;
  1505. X    *to = '\0';    /* make it empty to begin with */
  1506. X    for( i = 0; i < *nargs; ++i ) {
  1507. X        *to++ = ' ';
  1508. X        from = args[i];
  1509. X        while( 1 ) {
  1510. X            if( to >= limit ) {
  1511. X                sprintf( msgBuffer,
  1512. X                  "Tcl command over %d bytes was ignored.",
  1513. X                  MSGBUFFERSIZE );
  1514. X                msg( msgBuffer, 1 );
  1515. X                to = limit - 1;
  1516. X                break;
  1517. X            }
  1518. X            ch = *to++ = *from++;
  1519. X            if( ch == '\0' ) {
  1520. X                --to;    /* back up over '\0' */
  1521. X                break;
  1522. X            }
  1523. X        }
  1524. X    }
  1525. X    (void)ExecTclCommand( msgBuffer );
  1526. X}
  1527. X
  1528. END_OF_FILE
  1529. if test 1559 -ne `wc -c <'tcl.c'`; then
  1530.     echo shar: \"'tcl.c'\" unpacked with wrong size!
  1531. fi
  1532. # end of 'tcl.c'
  1533. fi
  1534. if test ! -d 'tclLib' ; then
  1535.     echo shar: Creating directory \"'tclLib'\"
  1536.     mkdir 'tclLib'
  1537. fi
  1538. if test -f 'tclLib/anaBoxes.tcl' -a "${1}" != "-c" ; then 
  1539.   echo shar: Will not clobber existing file \"'tclLib/anaBoxes.tcl'\"
  1540. else
  1541. echo shar: Extracting \"'tclLib/anaBoxes.tcl'\" \(2380 characters\)
  1542. sed "s/^X//" >'tclLib/anaBoxes.tcl' <<'END_OF_FILE'
  1543. proc MakeMapBox {} {
  1544. X    global raised sunken
  1545. X    set name .MapBox
  1546. X
  1547. X    catch ".destroy $name"
  1548. X    toplevel $name
  1549. X    wm title $name "Create Map"
  1550. X    wm iconname $name "Create Map"
  1551. X    wm minsize $name 0 0
  1552. X    
  1553. X    set attrList ""
  1554. X
  1555. X    label $name.label1 -text "Create Map"
  1556. X
  1557. X    label $name.label2 -text "Name of map:"
  1558. X    entry $name.mapname -relief $sunken
  1559. X    bind.entry $name.mapname
  1560. X
  1561. X    frame $name.alist
  1562. X    scrollbar $name.alist.scrollbar -relief sunken \
  1563. X        -command "$name.alist.items view"
  1564. X    listbox $name.alist.items -scroll "$name.alist.scrollbar set"  \
  1565. X        -relief sunken
  1566. X    bind $name.alist.items <1> "
  1567. X        set index \[%W nearest %y\]
  1568. X        lappend \$attrList \$index
  1569. X        $name.label3 configure -text \$attrList
  1570. X    "
  1571. X    pack append $name.alist \
  1572. X        $name.alist.scrollbar {left fill} \
  1573. X        $name.alist.items {right fill expand}
  1574. X
  1575. X    label $name.label3 -text "Attributes Chosen"
  1576. X
  1577. X    frame $name.buttons
  1578. X    button $name.buttons.create -text "Create Attribute" -command "
  1579. X        Option set returnString \$attrList
  1580. X        destroy $name
  1581. X    "
  1582. X    button $name.buttons.cancel -text "Cancel" -command "
  1583. X        Option set returnString XXXcancelXXX
  1584. X        destroy $name
  1585. X    "
  1586. X    pack append $name.buttons \
  1587. X        $name.buttons.create {left fill} \
  1588. X        $name.buttons.cancel {right fill}
  1589. X
  1590. X    pack append $name \
  1591. X        $name.label1 {top fill} \
  1592. X        $name.label2 {top fill} \
  1593. X        $name.mapname {top fill} \
  1594. X        $name.alist {top fill} \
  1595. X        $name.label3 {top fill} \
  1596. X        $name.buttons {top fill}
  1597. X    return $name
  1598. X}
  1599. X
  1600. proc MakePickBox {label} {
  1601. X    global wcounter raised sunken
  1602. X
  1603. X    set wcounter [expr $wcounter+1]
  1604. X    set name [format ".pb%05d" $wcounter]
  1605. X
  1606. X    toplevel $name -relief $raised
  1607. X    wm title $name $label
  1608. X    wm iconname $name $label
  1609. X    wm minsize $name 0 0
  1610. X    label $name.label1 -text $label
  1611. X
  1612. X    entry $name.keyword -relief $sunken
  1613. X    bind.entry $name.keyword
  1614. X
  1615. X    frame $name.slist
  1616. X    scrollbar $name.slist.scrollbar -relief sunken \
  1617. X        -command "$name.slist.items view"
  1618. X    listbox $name.slist.items -scroll "$name.slist.scrollbar set"  \
  1619. X        -relief sunken
  1620. X    bind $name.slist.items <1> "
  1621. X        set index \[%W nearest %y\]
  1622. X        Option set returnString \$index
  1623. X        destroy $name
  1624. X    "
  1625. X    pack append $name.slist \
  1626. X        $name.slist.scrollbar {left fill} \
  1627. X        $name.slist.items {right fill expand}
  1628. X
  1629. X    button $name.close -text "Cancel" -command "
  1630. X        Option set returnString XXXcancelXXX
  1631. X        destroy $name
  1632. X    "
  1633. X
  1634. X    pack append $name \
  1635. X        $name.label1 {top fill} \
  1636. X        $name.keyword {top fill} \
  1637. X        $name.slist {top fill} \
  1638. X        $name.close {top fill}
  1639. X    return $name
  1640. X}
  1641. X
  1642. END_OF_FILE
  1643. if test 2380 -ne `wc -c <'tclLib/anaBoxes.tcl'`; then
  1644.     echo shar: \"'tclLib/anaBoxes.tcl'\" unpacked with wrong size!
  1645. fi
  1646. # end of 'tclLib/anaBoxes.tcl'
  1647. fi
  1648. if test -f 'tclLib/cmd.tcl' -a "${1}" != "-c" ; then 
  1649.   echo shar: Will not clobber existing file \"'tclLib/cmd.tcl'\"
  1650. else
  1651. echo shar: Extracting \"'tclLib/cmd.tcl'\" \(620 characters\)
  1652. sed "s/^X//" >'tclLib/cmd.tcl' <<'END_OF_FILE'
  1653. proc CreateCmdInfo {{file ../doc/cmds.tex}} {
  1654. X    global CmdName CmdInfo
  1655. X    set CmdName ""
  1656. X    set CmdInfo ""
  1657. X    set fid [open $file r]
  1658. X    set gettingPara 0
  1659. X    while {![eof $fid]} {
  1660. X        set line [gets $fid]
  1661. X        if {[string index $line 0]=="\\" && $gettingPara} {
  1662. X            set gettingPara 0
  1663. X            lappend CmdInfo $para
  1664. X        }
  1665. X        if $gettingPara {
  1666. X            set para [format "%s %s" $para $line]
  1667. X        }
  1668. X        if [regexp "\\subsubsection{(.*)}" $line junk cmd] {
  1669. X            set gettingPara 1
  1670. X            lappend CmdName [lindex $cmd 0]
  1671. X            set para [format "%s\n" $cmd]
  1672. X        }
  1673. X    }
  1674. X    if $gettingPara {
  1675. X        lappend CmdInfo $para
  1676. X    }
  1677. X}
  1678. X#CreateCmdInfo
  1679. X#foreach x $CmdInfo {
  1680. X#    puts stdout "<$x>"
  1681. X#}
  1682. END_OF_FILE
  1683. if test 620 -ne `wc -c <'tclLib/cmd.tcl'`; then
  1684.     echo shar: \"'tclLib/cmd.tcl'\" unpacked with wrong size!
  1685. fi
  1686. # end of 'tclLib/cmd.tcl'
  1687. fi
  1688. if test -f 'tclLib/macros.tcl' -a "${1}" != "-c" ; then 
  1689.   echo shar: Will not clobber existing file \"'tclLib/macros.tcl'\"
  1690. else
  1691. echo shar: Extracting \"'tclLib/macros.tcl'\" \(1221 characters\)
  1692. sed "s/^X//" >'tclLib/macros.tcl' <<'END_OF_FILE'
  1693. X#
  1694. X# Some macros to extend Point commands
  1695. X#
  1696. proc Filter {{cmd fmt}} {
  1697. X    set s [selection get]
  1698. X    set ret [catch {exec $cmd << $s} ns]
  1699. X    # if the command failed then do not delete the selection
  1700. X    if {$ret==0} DeleteToScrap
  1701. X    # insert the result or the error message
  1702. X    InsertString $ns
  1703. X}
  1704. X
  1705. proc IndentSelection {{outdent 0}} {
  1706. X    set sel [Sel get]
  1707. X    set here [lindex $sel 0]
  1708. X    set stop [lindex $sel 1]
  1709. X    for {} 1 {} {
  1710. X        MoveSel line left0
  1711. X        set here [lindex [Sel get] 0]
  1712. X        if {$here>$stop} \
  1713. X            break;
  1714. X        if $outdent {
  1715. X            DeleteToScrap
  1716. X        } else {
  1717. X            InsertString \t
  1718. X        }
  1719. X        set stop [expr $stop+1]
  1720. X        MoveSel char down
  1721. X    }
  1722. X}
  1723. X
  1724. proc DefineMacro {{id 0}} {
  1725. X    set name Macro$id
  1726. X    global $name
  1727. X    set $name [selection get]
  1728. X}
  1729. X
  1730. proc ExecMacro {{id 0}} {
  1731. X    set name Macro$id
  1732. X    global $name
  1733. X    eval [set $name]
  1734. X}
  1735. X
  1736. proc ExecSel {{id 0}} {
  1737. X    eval [selection get]
  1738. X}
  1739. X
  1740. proc MoveWindow {geometry} {
  1741. X    set aw [WindowName get active]
  1742. X    wm geometry $aw [FixGeometry $geometry]
  1743. X    RaiseWindow
  1744. X}
  1745. X
  1746. proc ExtendSelToLines {} {
  1747. X    set endSel [lindex [Sel get] 1]
  1748. X    MoveSel line left0 noupdate
  1749. X    set beginSel [lindex [Sel get] 0]
  1750. X    Sel set $endSel $endSel
  1751. X    MoveSel line right noupdate
  1752. X    set endSel [lindex [Sel get] 1]
  1753. X    Sel set $beginSel $endSel
  1754. X    set w [WindowName get sel]
  1755. X    Redraw
  1756. X}
  1757. X
  1758. X
  1759. END_OF_FILE
  1760. if test 1221 -ne `wc -c <'tclLib/macros.tcl'`; then
  1761.     echo shar: \"'tclLib/macros.tcl'\" unpacked with wrong size!
  1762. fi
  1763. # end of 'tclLib/macros.tcl'
  1764. fi
  1765. if test -f 'tclLib/makeMenus.tcl' -a "${1}" != "-c" ; then 
  1766.   echo shar: Will not clobber existing file \"'tclLib/makeMenus.tcl'\"
  1767. else
  1768. echo shar: Extracting \"'tclLib/makeMenus.tcl'\" \(3504 characters\)
  1769. sed "s/^X//" >'tclLib/makeMenus.tcl' <<'END_OF_FILE'
  1770. X#
  1771. X#
  1772. X# Make the menus and menu bars
  1773. X#
  1774. X#
  1775. proc MakeMenubar {name menuString} {
  1776. X    global raised bd
  1777. X    frame $name -relief $raised -bd $bd
  1778. X    foreach item $menuString {
  1779. X        set kind [lindex $item 0]
  1780. X        set buttonName "[lindex $item 1]"
  1781. X        case $kind in \
  1782. X        "button"    {MakeButton $name.$buttonName \
  1783. X                "[lindex $item 2]" "[lindex $item 3]" } \
  1784. X        "menu"      {MakeMenu $name.$buttonName \
  1785. X                "[lindex $item 2]" "[lindex $item 3]" }
  1786. X        pack append $name $name.$buttonName {left fill}
  1787. X    }
  1788. X}
  1789. X
  1790. proc MakeButton {name text cmd} {
  1791. X    global raised bd
  1792. X    button $name -text "$text" -relief $raised -bd $bd
  1793. X    bind $name <Any-Enter> {global insideButton;set insideButton 1}
  1794. X    bind $name <Any-Leave> {global insideButton;set insideButton 0}
  1795. X    bind $name <Any-ButtonRelease-1> "+execButton $name \{[lindex $cmd 0]\}"
  1796. X    bind $name <Any-ButtonRelease-2> "execButton $name \{[lindex $cmd 1]\}"
  1797. X    bind $name <Any-ButtonRelease-3> "execButton $name \{[lindex $cmd 2]\}"
  1798. X}
  1799. X
  1800. proc MakeMenuItems {name menuString} {
  1801. X    set n 0
  1802. X    foreach item $menuString {
  1803. X        set kind [lindex $item 0]
  1804. X        case $kind in {
  1805. X        "cascade"   {
  1806. X            $name add cascade -label [lindex $item 1] \
  1807. X                -menu $name.$n
  1808. X            menu $name.$n 
  1809. X            bind.menu $name.$n
  1810. X            if {[llength [lindex $item 2]]==1} then {
  1811. X                set m [lindex $item 2]
  1812. X                global $m
  1813. X                MakeMenuItems $name.$n [set $m]
  1814. X            } else {
  1815. X                MakeMenuItems $name.$n [lindex $item 2]
  1816. X            }
  1817. X        }
  1818. X        "separator" { $name add separator }
  1819. X        "command"   {MakeCommand $name \
  1820. X            [lindex $item 1] [lindex $item 2] }
  1821. X        "check"     {MakeCheck $name $n \
  1822. X            [lindex $item 1]  [lindex $item 2] [lindex $item 3] }
  1823. X        "radio"     {MakeRadio $name $n \
  1824. X            [lindex $item 1]  [lindex $item 2] \
  1825. X            [lindex $item 3]  [lindex $item 4] }
  1826. X        }
  1827. X        if "[string compare $kind "separator"] != 0" \
  1828. X            {set n [expr $n+1]}
  1829. X    }
  1830. X}
  1831. X
  1832. proc MakeCommand {name text cmd} {
  1833. X    $name add command -label "$text" -command "$cmd"
  1834. X}
  1835. X
  1836. proc MakeCheck {name index text variable cmd} {
  1837. X    global $variable
  1838. X    $name add checkbutton -label "$text" -variable $variable \
  1839. X                            -command "$cmd"
  1840. X    set xx [Option get $variable]
  1841. X    if {$xx!=[set $variable]} {catch {$name invoke $index}}
  1842. X}
  1843. X
  1844. proc MakeRadio {name index text variable value cmd} {
  1845. X    global $variable
  1846. X    $name add radio -label "$text" -variable $variable -value $value \
  1847. X        -command $cmd
  1848. X    if ![string compare "[Option get $variable]" "$value"] {
  1849. X        catch {$name invoke $index}
  1850. X    }
  1851. X}
  1852. X
  1853. proc MakeMenu {name text menuString} {
  1854. X    global raised bd
  1855. X    global menuBarButton
  1856. X    menubutton $name -text $text -relief $raised -bd $bd -menu $name.m
  1857. X    menu $name.m
  1858. X    bind $name <Any-Enter> "set postedMenu {};$name activate"
  1859. X    bind $name <Any-B1-Enter> "set menuBarButton 1;$name activate; $name post"
  1860. X    bind $name <Any-B3-Enter> "set menuBarButton 3;$name activate; $name post"
  1861. X    bind $name <Any-B1-Leave> "$name deactivate"
  1862. X    bind $name <Any-B3-Leave> "$name deactivate"
  1863. X    bind $name <Shift-B1-Leave> "$name deactivate"
  1864. X    bind $name <Shift-B3-Leave> "$name deactivate"
  1865. X    bind $name <Any-Leave> "$name deactivate"
  1866. X    bind $name <Any-1> "set menuBarButton 1;$name post"
  1867. X    bind $name <Any-3> "set menuBarButton 3;$name post"
  1868. X    bind $name <Shift-1> "set menuBarButton 1;$name.m post %X %Y"
  1869. X    bind $name <Shift-3> "set menuBarButton 3;$name.m post %X %Y"
  1870. X    bind $name <Any-ButtonRelease-1> "$name unpost"
  1871. X    bind $name <Any-ButtonRelease-3> "$name unpost"
  1872. X    bind $name <Shift-B1-Motion> "set menuBarButton 1;$name.m post %X %Y"
  1873. X    bind $name <Shift-B3-Motion> "set menuBarButton 1;$name.m post %X %Y"
  1874. X    global $menuString
  1875. X    MakeMenuItems $name.m [set $menuString]
  1876. X    bind.menu $name.m
  1877. X}
  1878. X
  1879. END_OF_FILE
  1880. if test 3504 -ne `wc -c <'tclLib/makeMenus.tcl'`; then
  1881.     echo shar: \"'tclLib/makeMenus.tcl'\" unpacked with wrong size!
  1882. fi
  1883. # end of 'tclLib/makeMenus.tcl'
  1884. fi
  1885. if test -f 'tclLib/ptsetup.tcl' -a "${1}" != "-c" ; then 
  1886.   echo shar: Will not clobber existing file \"'tclLib/ptsetup.tcl'\"
  1887. else
  1888. echo shar: Extracting \"'tclLib/ptsetup.tcl'\" \(1119 characters\)
  1889. sed "s/^X//" >'tclLib/ptsetup.tcl' <<'END_OF_FILE'
  1890. X#
  1891. X# Setup some variables used in the tcl code
  1892. X#
  1893. X# CHANGE THIS:
  1894. set HelpDirectory help
  1895. X#
  1896. X# these work well for an 1152x900 screen
  1897. X#
  1898. set location1 "502x410+0+0"
  1899. set location2 "502x390-200+415"
  1900. set location3 "502x390-0+0"
  1901. set location4 "502x390+0+435"
  1902. set browserBig 490x465-0+0
  1903. set browser1 135x380+510+0
  1904. set browser2 135x380+651+0
  1905. set browser3 135x380+787+0
  1906. Option set textGeometry            $location1
  1907. Option set browserGeometry        $browserBig
  1908. Option set thinBrowserGeometry        $browser1
  1909. X#
  1910. X# Set Point options
  1911. X#
  1912. Option set wrapAroundSearches        True
  1913. X#
  1914. X# Setup some variables used in the tcl code
  1915. X#
  1916. set wcounter 0
  1917. X#
  1918. X# monochrome screen adjustments
  1919. X#
  1920. set raised "raised"
  1921. X#set raised "flat"
  1922. set sunken "sunken"
  1923. X#set sunken "flat"
  1924. set bd 1
  1925. X#set bd 2
  1926. X#
  1927. X# set up autoloading
  1928. X#
  1929. global PointTclLibrary
  1930. source $PointTclLibrary/init.tcl
  1931. set auto_path "$PointTclLibrary"
  1932. X#
  1933. X# define menus
  1934. X#
  1935. source $PointTclLibrary/browserMenu.tcl
  1936. source $PointTclLibrary/cmd.tcl
  1937. source $PointTclLibrary/macros.tcl
  1938. source $PointTclLibrary/makeBoxes.tcl
  1939. source $PointTclLibrary/makeMenus.tcl
  1940. source $PointTclLibrary/subs.tcl
  1941. source $PointTclLibrary/textMenu.tcl
  1942. X
  1943. END_OF_FILE
  1944. if test 1119 -ne `wc -c <'tclLib/ptsetup.tcl'`; then
  1945.     echo shar: \"'tclLib/ptsetup.tcl'\" unpacked with wrong size!
  1946. fi
  1947. # end of 'tclLib/ptsetup.tcl'
  1948. fi
  1949. if test -f 'tclLib/startup.tcl' -a "${1}" != "-c" ; then 
  1950.   echo shar: Will not clobber existing file \"'tclLib/startup.tcl'\"
  1951. else
  1952. echo shar: Extracting \"'tclLib/startup.tcl'\" \(338 characters\)
  1953. sed "s/^X//" >'tclLib/startup.tcl' <<'END_OF_FILE'
  1954. if [file exists ~/.ptrc] then {
  1955. X    source ~/.ptrc
  1956. X} else {
  1957. X    if [file exists ./ptsetup.tcl] then {
  1958. X        source ./ptsetup.tcl
  1959. X    } else {
  1960. X        global PointTclLibrary
  1961. X        if [file exists $PointTclLibrary/ptsetup.tcl] {
  1962. X            source $PointTclLibrary/ptsetup.tcl
  1963. X        } else {
  1964. X            puts stderr \
  1965. X                "CANNOT FIND A STARTUP FILE. POINT WILL NOT WORK."
  1966. X        }
  1967. X    }
  1968. X}
  1969. END_OF_FILE
  1970. if test 338 -ne `wc -c <'tclLib/startup.tcl'`; then
  1971.     echo shar: \"'tclLib/startup.tcl'\" unpacked with wrong size!
  1972. fi
  1973. # end of 'tclLib/startup.tcl'
  1974. fi
  1975. if test -f 'tclLib/tclIndex' -a "${1}" != "-c" ; then 
  1976.   echo shar: Will not clobber existing file \"'tclLib/tclIndex'\"
  1977. else
  1978. echo shar: Extracting \"'tclLib/tclIndex'\" \(1713 characters\)
  1979. sed "s/^X//" >'tclLib/tclIndex' <<'END_OF_FILE'
  1980. X# Tcl autoload index file: each line identifies a Tcl
  1981. X# procedure and the file where that procedure is
  1982. X# defined.  Generated by the "auto_mkindex" command.
  1983. X
  1984. XFilter macros.tcl
  1985. IndentSelection macros.tcl
  1986. DefineMacro macros.tcl
  1987. XExecMacro macros.tcl
  1988. XExecSel macros.tcl
  1989. MoveWindow macros.tcl
  1990. XExtendSelToLines macros.tcl
  1991. BrowserMenuBindings browserMenu.tcl
  1992. TextMenuBindings textMenu.tcl
  1993. TextBindings textMenu.tcl
  1994. BrowserWindow windows.tcl
  1995. TextWindow windows.tcl
  1996. MakeMenubar makeMenus.tcl
  1997. MakeButton makeMenus.tcl
  1998. MakeMenuItems makeMenus.tcl
  1999. MakeCommand makeMenus.tcl
  2000. MakeCheck makeMenus.tcl
  2001. MakeRadio makeMenus.tcl
  2002. MakeMenu makeMenus.tcl
  2003. HelpWindow makeBoxes.tcl
  2004. GetSelectedKeyword makeBoxes.tcl
  2005. MakeSearchOptionsBox makeBoxes.tcl
  2006. MakeOtherOptionsBox makeBoxes.tcl
  2007. MakeVerifyBox makeBoxes.tcl
  2008. DoRegexReplace makeBoxes.tcl
  2009. DoReplace makeBoxes.tcl
  2010. MakeRegexReplaceBox makeBoxes.tcl
  2011. MakeReplaceBox makeBoxes.tcl
  2012. MakeModalEntry makeBoxes.tcl
  2013. MakeModalYesNo makeBoxes.tcl
  2014. MakeMsgBox makeBoxes.tcl
  2015. MakemmBox makeBoxes.tcl
  2016. MakeUndoBox makeBoxes.tcl
  2017. MakeColorBox makeBoxes.tcl
  2018. MakeCtagBox makeBoxes.tcl
  2019. XFillKeywordBox makeBoxes.tcl
  2020. MakeKeywordBox makeBoxes.tcl
  2021. MakeGotoBox makeBoxes.tcl
  2022. MakeDebugBox makeBoxes.tcl
  2023. MakeAsciiBox makeBoxes.tcl
  2024. MakeAboutBox makeBoxes.tcl
  2025. MakeQuitBox makeBoxes.tcl
  2026. MakeSearchBox makeBoxes.tcl
  2027. MakeRebindWindow makeBoxes.tcl
  2028. UpdateRebindHelp makeBoxes.tcl
  2029. InsertSelectedString subs.tcl
  2030. SearchForSel subs.tcl
  2031. XFixGeometry subs.tcl
  2032. execButton subs.tcl
  2033. pr subs.tcl
  2034. OpenFileOrCD subs.tcl
  2035. bind.entry subs.tcl
  2036. bind.menu subs.tcl
  2037. bs subs.tcl
  2038. tkerror subs.tcl
  2039. CreateCmdInfo cmd.tcl
  2040. MakeMapBox anaBoxes.tcl
  2041. MakePickBox anaBoxes.tcl
  2042. unknown init.tcl
  2043. auto_load init.tcl
  2044. auto_execok init.tcl
  2045. auto_reset init.tcl
  2046. END_OF_FILE
  2047. if test 1713 -ne `wc -c <'tclLib/tclIndex'`; then
  2048.     echo shar: \"'tclLib/tclIndex'\" unpacked with wrong size!
  2049. fi
  2050. # end of 'tclLib/tclIndex'
  2051. fi
  2052. if test -f 'version.c' -a "${1}" != "-c" ; then 
  2053.   echo shar: Will not clobber existing file \"'version.c'\"
  2054. else
  2055. echo shar: Extracting \"'version.c'\" \(31 characters\)
  2056. sed "s/^X//" >'version.c' <<'END_OF_FILE'
  2057. char * version_string = "1.3";
  2058. END_OF_FILE
  2059. if test 31 -ne `wc -c <'version.c'`; then
  2060.     echo shar: \"'version.c'\" unpacked with wrong size!
  2061. fi
  2062. # end of 'version.c'
  2063. fi
  2064. echo shar: End of archive 1 \(of 15\).
  2065. cp /dev/null ark1isdone
  2066. MISSING=""
  2067. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
  2068.     if test ! -f ark${I}isdone ; then
  2069.     MISSING="${MISSING} ${I}"
  2070.     fi
  2071. done
  2072. if test "${MISSING}" = "" ; then
  2073.     echo You have unpacked all 15 archives.
  2074.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2075. else
  2076.     echo You still need to unpack the following archives:
  2077.     echo "        " ${MISSING}
  2078. fi
  2079. ##  End of shell archive.
  2080. exit 0
  2081. -- 
  2082. --
  2083. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  2084. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  2085. Sunnyvale, California 94086            at&t: 408/522-9236
  2086.