1########################################################################
2# This program is Copyright (C) 1986-1996 by Jonathan Payne.  JOVE is  #
3# provided to you without charge, and with no warranty.  You may give  #
4# away copies of JOVE, including sources, provided that this notice is #
5# included in all the files.                                           #
6########################################################################
7
8Changes for 4.16:
9
10Mac support had been left to run down for quite some time.  In
11December 1995, Hugh re-ported it to Think C 5.0 (a compiler circa
121991).  Hugh is neither a Mac hack, nor a Mac user, so this port
13should be considered amateur.  More excuses and apologies appear in
14the mac.c source file.
15
16Changes in usage:
17
18- Since "recover" is not yet supported, the .jrecXXX file is no longer
19  created.
20
21- For file name completion, the set of mounted volumes now acts much
22  like a UNIX root.  Note that no files may appear here.
23
24- The Option key is used as a meta key if the meta-key variable is on.
25  This doesn't work well for the Option combinations that are accents
26  ("dead keys") since JOVE doesn't get those keystrokes.  Pressing a
27  combination twice does work.
28
29- C-@ now generates NUL too.  C-\ no longer does so (it generates C-\).
30
31- The arrow keys are now bound appropriately in the default main keymap.
32  The codes ^\, ^], ^^, and ^_ are generated by the left, right, up, and
33  down keys.  Beware that previous default bindings for these keys
34  no longer apply.
35
36- mode-line-should-standout now works on the Mac.
37
38Changes in building:
39
40- "setmaps" now automatically processes the appropriate files when you
41  run it: you no longer have to type in a "command line".
42
43- The libraries have changed.
44  + setmaps uses only "ANSI"
45  + JOVE uses only "ANSI" and MacTraps.
46  Perhaps these could be optimized by customizing them.
47
48- The msetmaps project needs only the setmaps.c source file.
49
50- The mjove project needs all .c files in the main directory except
51  for setmaps.c, teachjove.c, and recover.c (other inapplicable files
52  are protected by #ifdef).  Segmenting is necessary.  Since I didn't
53  do a careful job, I won't specify how to do it.  Far data was not
54  needed (but only just).
55
56- I think that little is specific to Think C.  I used 2-byte ints, but
57  4-byte ints should work too.  I used strict prototype checking.
58  None of the Think Class Library was used.
59
60We welcome any contributions from Mac users.
61
62
63Changes between 4.9 and 4.10:
64
65  New features:
66    1) Reshapeable windows with zoom boxes.
67    2) Filename/directory name completion with macify OFF.
68    3) Double click mouse to set the mark.
69    4) Control-space and control-@ correctly send NUL on MacII/SE.
70    5) Control-` fixed to send backquote char.
71    6) Display update code fixed.
72
73  Sources:
74    1) Compiles under LSC 3.0. (Probably under 2.13 as well, but
75       not tested with that version).
76    2) Include files redone, with fewer total lines of code.
77    3) No need to modify include files, unless NBUF changed.
78    4) "keymaps.txt" is now "keys.txt".
79
80  Planned:
81    1) Recover command as separate application.
82    2) Support for MPW compiler vers 2.02.
83
84
85Introduction
86
87This file contains a brief description of MacJove, along with
88information necessary to make MacJove from the source files.
89It is assumed that the reader is familiar with Jove from other
90systems, and is somewhat familiar with the Macintosh as well. In
91the future there may be a separate user's manual for MacJove:
92for the time being, the reader should refer to the Jove manual
93for Unix users.
94
95Description
96
97MacJove is a direct port of Jove to the Macintosh, with the
98overall structure, commands and key bindings left intact. In
99addition, elements of the Macintosh user interface - menus,
100window controls, and the mouse, have been integrated in a manner
101consistent with the overall functioning of Jove.
102
103While the integration of these tools into the Jove environment
104is consistent and, to most users, familiar, Jove departs in
105several places from "Macintosh User Interface Guidelines". Most
106notably, the mouse is used to position the point only, not to
107drag or select text, and the Jove buffer structure is not
108integrated with the clipboard. Also, key bindings conform to
109Jove/Emacs tradition, and not to Macintosh guidelines: i.e.
110control (command)-N is next-line, not "NewFile". The reason for
111these departures is that the majority of MacJove users are likely
112to be those already familiar with Jove or other Emacs editors
113on other systems, and for these users, consistency between machines
114and operating systems is more important than fully exploiting
115the features of a single system. There are numerous other text
116editors which fully follow the Macintosh User Interface Guidelines.
117
118MacJove retains most features of other Joves, but certain commands
119cannot be implemented because of the Macintosh operating system.
120Thus, there is no way to run a sub-process or a shell in a window,
121because there are no shells to run on the Macintosh, and a program
122(currently) can only transfer control to another program, not run
123a child process. For similar reasons, commands dealing with mail,
124with running make, and checking errors, are omitted.
125
126
127
128                      Running MacJove
129
130System Requirements
131
132MacJove should run without difficulty on any Macintosh Plus, SE, or
133Macintosh II, providing that the hierarchical file system (HFS) is used, and
134assuming a reasonably current system file is used. An upgraded 512K Mac
135(with 128K rom) should also work if there is enough memory.  MacJove was
136developed on a Macintosh Plus and Macintosh II running system 4.2 and Finder
1376.0., and has not been fully tested on earlier systems - however, it is
138likely that it will run on system 3.2 and later versions. MacJove has been
139used to a limited extent with Switcher and under Multifinder. In both cases,
140it is important to reserve enough memory for MacJove, as discussed below.
141
142MacJove, as compiled from the sources, uses memory as follows:
143
144   Program Code     approx 116K
145   Static Data      approx  20K
146   Tempfile Cache           64K (heap)
147                           ____
148                           200K total before stack/heap considerations
149
150To this must be added stack and heap space. A bare minimum for this is
151probably 100K or so, but the usage will vary as buffers are created.  With
152Jove, the file itself takes up space only in the tempfile and its cache, but
153the buffer structure requires 3 pointers (12 bytes) for each line in the
154file. For a reasonable editing session with files totalling, say 10000 to
15520000 lines, this additional space can add up. For this reason, it is
156unrealistic to expect to run Jove on a 512K system, unless a very small
157system file is used, few, small files are edited each session, and the
158tempfile cache is reduced (see cache size under Making Jove). You can
159experiment with various memory allocations under Switcher and Multifinder to
160see what works with your editing habits (backup your files first!), but a
161realistic minimum is 400K - 500K and more is great.
162
163When first using MacJove, and if memory space is questionable, SAVE YOUR
164FILES FREQUENTLY. If it is necessary to edit many files, it is often better
165to exit MacJove and restart once in a while, especially if there is a
166question of limited memory.
167
168
169Operation
170
171Running MacJove is similar to other Macintosh applications, and should be
172intuitive. You start up MacJove by either opening, or double-clicking,
173the MacJove icon. If you have previously saved files created with MacJove,
174double-clicking on them will also start up the program, and the files will
175be put into buffers. Several files can be selected simultaneously by this
176method. There is no current way to select command-line options with
177MacJove, but this may change in the future.
178
179The .joverc file, if used, must be present in the same directory as MacJove,
180the "home" directory. The help file, "cmds.doc", must also be in this
181directory. The tempfile, ".joveXXX", will be placed in whatever directory is
182current when the tempfile is first opened - this may or may not be the home
183directory, and may change in the future. The recover file, ".jrecXXX" is
184placed in the home directory. While this file is created and updated as on
185Unix versions of Jove, there is currently no "recover" program for MacJove.
186Hopefully, this will be available soon.
187
188MacJove can edit any text file on the Macintosh, whether created with
189MacJove or another editor. It cannot be used to edit graphics material, and
190graphics material cannot be inserted during operation of MacJove. Files
191created with MacJove are of type 'TEXT' and of signature 'JV01'. This
192signature is being registered with Apple, and may change if necessary. Note
193that once MacJove files have been re-edited with another editor, they likely
194will have new signatures, and double-clicking on them will start the other
195editor, not MacJove.
196
197The standard Macintosh keyboard is inadequate for MacJove (and most anything
198else), so that it is necessary to change a couple of keys. The "`" key
199becomes the ESCAPE key, since it is in the right place for one: to send a
200real "'", hold the command key down while typing it. The command key is used
201for a control key - unfortunately, the location of it is horrible for such a
202purpose. On Macintosh SE and Macintosh II models, a real escape key exists,
203and also a real control key. Note, however, that because of a small bug in
204the keyboard encoding in MacJove, you cannot directly send a NUL (control-@)
205with the control key. Typing command-@ or command-2 will still do this,
206however.
207
208During operation, you can use the keyboard as you would when running Jove on
209any other system. However, many commands also have menu equivalents:  as
210long as MacJove is waiting for a command, you can use either the keyboard or
211the menus. Once you begin selecting a command with either the menus or the
212keyboard, the other is locked out: thus, once you type control-X, MacJove
213expects more characters, and will not let you choose menu items.  Also, if
214you are prompted for input on the command line, the menus are locked out.
215Regardless of how a command is begun, however, only the prompt line (message
216line) is used for input: MacJove does not use dialog boxes, except under the
217"About Jove" menu selection.
218
219Commands listed in the menus are given exactly as their string name in
220the command list, for example "write-file". In addition, variables are
221listed under the "Set" menu. Variables are grouped by type. Non-boolean
222variables are changed on the message line after being selected. Boolean
223variables are marked with a check mark if on, and selecting them toggles
224the value of the variable.
225
226The "Buffer" menu is a special menu, whose action is different from the
227others. The first entries on this menu are the major and minor modes of
228operation, with those of the current buffer marked with check marks.
229Clicking on a major mode will change the major mode of the current buffer to
230that mode, while clicking on a minor mode will toggle that mode's status
231(on/off) for the current buffer. Beneath this is a list of buffers, one for
232each menu item, with the current buffer marked. Clicking on a buffer selects
233that as the current buffer, and the active window will change accordingly.
234
235Window controls (scroll bars) work as expected, and are simply bound to
236the appropriate MacJove command. Occasionally the position of the
237scroll bar may appear inaccurate, particularly with a small buffer.
238
239Files and directories may be selected in two ways. The default method
240is to use the message line to input filenames, and to change directories
241using "cd". If the variable "macify" is set, however, filenames and
242directories can also be set using the standard file dialogs familiar to
243most Mac users. Filename paths are normally given via Unix conventions,
244and not Macintosh conventions: i.e. directories are separated with "/"
245and not ":". On the Buffer menu, however, filenames are listed with ":"
246as the separation character, since "/" cannot be displayed in menu items.
247It is not possible to back up directories beyond the volume level, so
248there is not true "root". To change volumes (disks), macify must be on,
249and the "Drive" selection used.
250
251"Macify" only works for those commands which REQUIRE a file operation, such
252as "visit-file", "insert-file", "write-file".  Operations which first look
253in buffers for files, such as "window-find" and "find-file" never use the
254standard file dialogs.
255
256For a list of all commands and bindings, click on "About Jove" in the
257Apple menu. In the future this may also support the help file.
258
259
260                      Making MacJove
261
262System Requirements
263
264To make MacJove from the sources, you need a hard disk based Macintosh, at
265least 1 mb of ram, and the LightspeedC compiler, version 2.13 or later.
266Earlier versions may work but have not been used recently. Allow for the
267MacJove files to take up to 1.5 mb of your hard disk. You will need a copy
268of the "BinHex" utility, also.
269
270Since LightspeedC does not work with a Makefile, none is supplied. In
271general, the compiler itself will figure out dependencies for you, within a
272"project". Since there are three separate projects to MacJove, you will
273still have to keep track of some changes, particularly for the setmaps
274project. Also, since LightspeedC only knows of .c and .h dependencies,
275you will have to keep track of setmaps.txt and menumaps.txt yourself.
276
277Preliminary Steps
278
2790) CREATE A FOLDER (DIRECTORY) FOR JOVE. If I have to tell you how to do
280that, don't go any further! Copy the source files - a few aren't needed
281by MacJove, but copy them anyway, so you'll have them in one place. You
282do not need anything in the "doc" subdirectory to create MacJove (but
283you will eventually need cmds.doc, the help file, if you want the
284"describe-command" command to work).
285
2861) CREATE THE RESOURCE FILE: There is only one eight-bit file supplied,
287"mjove.rsrc". This is a small file which contains the program icon and a
288dialog template. This file must have the same name as the MacJove project,
289plus extension ".rsrc". The MacJove project (below), has name "mjove", so
290this file is "mjove.rsrc".  IF YOU RENAME THE PROJECT YOU MUST RENAME THIS
291FILE, ALSO. Using "BinHex", unload the file "mjovers.Hqx" --> "mjove.rsrc".
292
2932) CREATE THE "MJOVELIB" PROJECT: MacJove does not use many of the library
294functions. Despite what the LightspeedC manual states, projects are loaded
295as a whole: since we need only a few functions, we will build a "library" of
296them in the form of a project. Run LightspeedC and create a new project,
297and name it "mjovelib". Add the following files, from the Library Sources,
298to the project. They all go in the same segment:
299
300     onexit.c
301     qsort.c
302     stddata_ctype.c
303     unixexit.c
304     unixid.c
305     unixmem.c
306     unixtime.c
307
3083) EXAMINE THE FILE UNIXTIME.C and make the following correction, if
309necessary. The LightspeedC library function "unixtime.c" returns a string
310containing the time for what is supposed to be Greenwich Mean Time, instead
311of local time. Using the LightspeedC editor, and with the project open,
312examine the file, comment out the definition of "GMTzonedif", and add:
313
314     #define GMTzonedif 0
315
3164) MAKE THE "MJOVELIB" PROJECT. Keeping the edited "unixtime.c" open,
317run "make" on the project - everything will be compiled, with the altered
318version of "unixtime.c". You do not have to permanently save the change
319to unixtime.c, but if you do not, the next time you run "make" on the
320project, it will tell you that it needs recompiling - simply ignore it.
321After the mjovelib project is made, close it. You do not have to convert it
322to a library - it is okay to leave it as a project.
323
3246) CREATE THE "MSETMAPS" PROJECT. Create a new project, name it "msetmaps",
325and add the following files to it:
326
327     setmaps.c
328     stdio
329     strings           (segment 1)
330     unix
331     unix main.c
332     --------
333     MacTraps          (segment 2)
334
335
336You should not change anything else at this point - unless you want to
337reduce memory requirements (see "Running MacJove", above). If it is
338necessary to reduce the memory requirements, then reduce the number of cache
339buffers, NBUF, which is defined near the end of the file (each buffer takes
340up 1K of space while MacJove is running).
341
342#ifdef MAC
343# undef F_COMPLETION
344# define F_COMPLETION 1
345# define rindex strrchr
346# define bzero(s,n) setmem(s,n,0)
347# define swritef sprintf
348# define LINT_ARGS 1
349# define NBUF 64 <---- here
350# define BUFSIZ 1024
351# undef LISP
352# define LISP 1
353# define ANSICODES 0
354# undef ABBREV
355# define ABBREV 1
356# undef CMT_FMT
357# define CMT_FMT 1
358#endif
359
3607) MAKE THE "MSETMAPS" PROJECT. Then choose "Build Application",and name it
361"setmaps".
362
3638) RUN "SETMAPS" ON THE KEYMAPS.TXT FILE. You can either run "setmaps" from
364LightspeedC, before closing the project, or as the standalone application.
365When prompted for the "Unix command line", enter:
366
367     < keys.txt > keys.c
368
369You will get a few messages from setmaps that it can't find certain
370commands. You can ignore these.
371
3729) RUN "SETMAPS" ON THE MENUMAPS.TXT FILE. Just as before, run "setmaps"
373and enter the following command line:
374
375     < menumaps.txt > menumaps.c
376
377You should not get any messages from setmaps. If the "msetmaps" project is
378still open, close it.
379
38010) CREATE THE "MJOVE" PROJECT. Create a new project, name it "MJOVE" and
381set the Creator (signature) to 'JV01'. Add the following files in the
382following segments:
383
384     abbrev.c
385     argcount.c
386     ask.c
387     buf.c
388     c.c
389     case.c        (segment 1)
390     jctype.c
391     delete.c
392     disp.c
393     extend.c
394     keys.c
395     --------
396     fmt.c
397     fp.c
398     funcdefs.c    (segment 2)
399     insert.c
400     io.c
401     jove.c
402     keymaps.c
403     list.c
404     --------
405     mac.c
406     macros.c
407     marks.c
408     menumaps.c    (segment 3)
409     misc.c
410     move.c
411     paragraph.c
412     --------
413     re.c
414     re1.c
415     rec.c
416     screen.c
417     term.c       (segment 4)
418     util.c
419     vars.c
420     version.c
421     wind.c
422     --------
423     MacTraps
424     mjovelib
425     setjmp.Lib    (segment 5)
426     storage
427     strings
428
42911) MAKE THE MJOVE PROJECT. If you experience any errors, it will most
430likely be from #include files not being in the default path - see the
431LightspeedC manual on setting up your directories. When you are done,
432run the program from the compiler to verify that it is okay, then save it as
433"MacJove" using the "Build Application" command.
434
43512) (Optional) CREATE THE HELP FILE, "CMDS.DOC". If you do not have a copy
436of "cmds.doc", it must be created using nroff. Assuming you have the Jove
437sources on a Unix machine, run "Make doc/cmds.doc" to create this file in
438the "doc" subdirectory, then move the file to the Mac. If you obtained the
439sources from a non-Unix source, this file may already be supplied. Place the
440file in the same directory that MacJove will be in.
441
442                      COMMENTS AND QUESTIONS, BUGS
443
444Although Jove appears to work well on the Mac, I know there are some
445problems. Since Jove cannot effectively use the TextEdit routines, it
446does not comply with some aspects of the Macintosh User Interface
447Guidelines. As has recently been brought to my attention, Jove accesses
448files by pathname only, so that if you have two disks in your machine
449with the same volume (disk) name, it will become confused. This has not
450been fixed. Support for variant keyboards is not good at present.
451
452I try to reply to all inquiries about MacJove, but my schedule is busy,
453and it may be several days before you hear from me on the net. Please
454reply via email to me, or through usenet if possible: the chances that
455I will respond quickly to a written question or suggestion are very
456small, and I am difficult to reach by phone. Please do NOT send disks
457unless I ask you to.
458
459    Ken Mitchum
460    Decision Systems Laboratory
461    University of Pittsburgh
462    1360 Scaife Hall
463    Pittsburgh, Pa. 15261
464
465    (km@cadre.dsl.pittsburgh.edu)
466
467[Ken's email address (1995): Ken Mitchum <km@ky3b.pgh.pa.us>]
468