[comp.sources.misc] v07i035: CRISP release 1.9 part 14/32

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (06/12/89)

Posting-number: Volume 7, Issue 35
Submitted-by: fox@marlow.UUCP (Paul Fox)
Archive-name: crisp1.9/part15



#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  MAC.README
#	  src/crisp/Makefile
#	  src/crisp/crisp.h
#	  src/crisp/welcome.h
#	  src/crisp/abbrev.m
#	  src/crisp/ansi.m
#	  src/crisp/ascii.m
#	  src/crisp/autosave.m
#	  src/crisp/box.m
#	  src/crisp/brace.m
#	  src/crisp/calc.m
#	  src/crisp/compile.m
#	  src/crisp/copyr.m
#	  src/crisp/core.m
#	  src/crisp/crisp.m
#	  src/crisp/dial.m
#	  src/crisp/edt.m
#	  src/crisp/features.m
#	  src/crisp/g_macros.m
#	  src/crisp/g_vi.m
#	  src/crisp/hanoi.m
#	  src/crisp/help.m
#	  src/crisp/history.m
#	  src/crisp/kbd_help.m
#	  src/crisp/mail.m
#	  src/crisp/makeman.m
#	  src/crisp/misc.m
#	  src/crisp/options.m
#	  src/crisp/region.m
#	  src/crisp/regress.m
#	  src/crisp/sdb.m
#	  src/crisp/search.m
#	  src/crisp/select.m
#	  src/crisp/shell.m
#	  src/crisp/startup.m
#	  src/crisp/stest.m
#	  src/crisp/tags.m
#	  src/crisp/telnet.m
#	  src/crisp/text.m
#	  src/crisp/tty.m
#	  src/crisp/unix.m
#	  src/crisp/welcome.m
#	  src/crisp/window.m
#	  src/crisp/wp.m
#	  src/crisp/kbd/pc.m
#	  src/crisp/kbd/sun3.m
#	  src/crisp/tty/at386.m
#	  src/crisp/tty/dec.m
#	  src/crisp/tty/ibm5081.m
#	  src/crisp/tty/isc.m
#	  src/crisp/tty/sun.m
#	  src/crisp/tty/tty.h
#	  src/crisp/tty/tty.m
#	  src/crisp/tty/wyse50.m
#	  src/crisp/tty/xenix.m
#	  src/crisp/tty/xterm.m
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
echo "x - extracting MAC.README (Text)"
sed 's/^X//' << 'SHAR_EOF' > MAC.README &&
XThis is the README file for the GRIEF macros.
X
XThe macros in this package will only work with GRIEF v1.6 or later,
Xdue to some of the new keywords, or bug fixes.
X
X	Major Features of this Release
X	------------------------------
X
XThis release supports a lot of new macros. Major functionality features
Xcan be accessed via <Alt-F>. Nearly everything is explained in
Xthe help (HLP_1.* package). The help is a separate set of files
Xbecause of the bulk involved. 
X
X===
XFile                            Version
X============                    =======
X
X
Xsrc/crisp/Makefile              1.5
Xsrc/crisp/abbrev.m              1.2
Xsrc/crisp/ansi.m                1.3
Xsrc/crisp/ascii.m               1.2
Xsrc/crisp/autosave.m            1.2
Xsrc/crisp/box.m                 1.2
Xsrc/crisp/brace.m               1.2
Xsrc/crisp/calc.m                1.2
Xsrc/crisp/compile.m             1.3
Xsrc/crisp/crisp.h               1.3
Xsrc/crisp/crisp.m               1.6
Xsrc/crisp/dial.m                1.2
Xsrc/crisp/features.m            1.2
Xsrc/crisp/g_macros.m            1.3
Xsrc/crisp/g_vi.m                1.2
Xsrc/crisp/hanoi.m               1.2
Xsrc/crisp/help.m                1.3
Xsrc/crisp/history.m             1.2
Xsrc/crisp/kbd_help.m            1.2
Xsrc/crisp/mail.m                1.4
Xsrc/crisp/makeman.m             1.5
Xsrc/crisp/misc.m                1.4
Xsrc/crisp/options.m             1.3
Xsrc/crisp/region.m              1.2
Xsrc/crisp/regress.m             1.2
Xsrc/crisp/sdb.m                 1.2
Xsrc/crisp/search.m              1.3
Xsrc/crisp/select.m              1.4
Xsrc/crisp/shell.m               1.4
Xsrc/crisp/startup.m             1.2
Xsrc/crisp/stest.m               1.2
Xsrc/crisp/tags.m                1.3
Xsrc/crisp/telnet.m              1.2
Xsrc/crisp/text.m                1.5
Xsrc/crisp/tty-at386.m           1.2
Xsrc/crisp/tty-isc.m             1.2
Xsrc/crisp/tty-sun.m             1.2
Xsrc/crisp/tty-xenix.m           1.2
Xsrc/crisp/tty-xterm.m           1.2
Xsrc/crisp/tty.h                 1.2
Xsrc/crisp/tty.m                 1.3
Xsrc/crisp/welcome.h             1.2
Xsrc/crisp/welcome.m             1.2
Xsrc/crisp/window.m              1.2
Xsrc/crisp/wp.m                  1.4
SHAR_EOF
chmod 0444 MAC.README || echo "restore of MAC.README fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/Makefile &&
XMACDIR	= /usr/local/crisp/macros
XH	= crisp.h tty/tty.h
XSRC	= Makefile *.h *.m kbd/* tty/*
XCM	=	$(MACDIR)/abbrev.cm \
X		$(MACDIR)/ansi.cm \
X		$(MACDIR)/ascii.cm \
X		$(MACDIR)/autosave.cm \
X		$(MACDIR)/box.cm \
X		$(MACDIR)/brace.cm \
X		$(MACDIR)/calc.cm \
X		$(MACDIR)/compile.cm \
X		$(MACDIR)/copyr.cm \
X		$(MACDIR)/core.cm \
X		$(MACDIR)/crisp.cm \
X		$(MACDIR)/dial.cm \
X		$(MACDIR)/edt.cm \
X		$(MACDIR)/features.cm \
X		$(MACDIR)/g_macros.cm \
X		$(MACDIR)/g_vi.cm \
X		$(MACDIR)/hanoi.cm \
X		$(MACDIR)/help.cm \
X		$(MACDIR)/history.cm \
X		$(MACDIR)/kbd_help.cm \
X		$(MACDIR)/kbd/pc.cm \
X		$(MACDIR)/kbd/sun3.cm \
X		$(MACDIR)/mail.cm \
X		$(MACDIR)/makeman.cm \
X		$(MACDIR)/misc.cm \
X		$(MACDIR)/options.cm \
X		$(MACDIR)/region.cm \
X		$(MACDIR)/regress.cm \
X		$(MACDIR)/sdb.cm \
X		$(MACDIR)/search.cm \
X		$(MACDIR)/select.cm \
X		$(MACDIR)/shell.cm \
X		$(MACDIR)/startup.cm \
X		$(MACDIR)/stest.cm \
X		$(MACDIR)/tags.cm \
X		$(MACDIR)/telnet.cm \
X		$(MACDIR)/text.cm \
X		$(MACDIR)/tty/at386.cm \
X		$(MACDIR)/tty/dec.cm \
X		$(MACDIR)/tty/ibm5081.cm \
X		$(MACDIR)/tty/isc.cm \
X		$(MACDIR)/tty/sun.cm \
X		$(MACDIR)/tty/wyse50.cm \
X		$(MACDIR)/tty/xenix.cm \
X		$(MACDIR)/tty/xterm.cm \
X		$(MACDIR)/tty/tty.cm \
X		$(MACDIR)/unix.cm \
X		$(MACDIR)/welcome.cm \
X		$(MACDIR)/window.cm \
X		$(MACDIR)/wp.cm
X
X
Xall:	$(CM)
X	@echo Macro binaries upto date.
X
Xdist:
X	sccs update < /dev/null
Xdist-list:
X	@echo $(SRC)
X$(MACDIR)/abbrev.cm: $(H) abbrev.m
X	cm -o $(MACDIR)/abbrev.cm abbrev.m
X$(MACDIR)/ansi.cm: $(H) ansi.m
X	cm -o $(MACDIR)/ansi.cm ansi.m
X$(MACDIR)/ascii.cm: $(H) ascii.m
X	cm -o $(MACDIR)/ascii.cm ascii.m
X$(MACDIR)/autosave.cm: $(H) autosave.m
X	cm -o $(MACDIR)/autosave.cm autosave.m
X$(MACDIR)/box.cm: $(H) box.m
X	cm -o $(MACDIR)/box.cm box.m
X$(MACDIR)/brace.cm: $(H) brace.m
X	cm -o $(MACDIR)/brace.cm brace.m
X$(MACDIR)/calc.cm: $(H) calc.m
X	cm -o $(MACDIR)/calc.cm calc.m
X$(MACDIR)/compile.cm: $(H) compile.m
X	cm -o $(MACDIR)/compile.cm compile.m
X$(MACDIR)/copyr.cm: $(H) copyr.m
X	cm -o $(MACDIR)/copyr.cm copyr.m
X$(MACDIR)/core.cm: $(H) core.m
X	cm -o $(MACDIR)/core.cm core.m
X$(MACDIR)/crisp.cm: $(H) crisp.m
X	cm -o $(MACDIR)/crisp.cm crisp.m
X$(MACDIR)/dial.cm: $(H) dial.m
X	cm -o $(MACDIR)/dial.cm dial.m
X$(MACDIR)/edt.cm: $(H) edt.m
X	cm -o $(MACDIR)/edt.cm edt.m
X$(MACDIR)/features.cm: $(H) features.m
X	cm -o $(MACDIR)/features.cm features.m
X$(MACDIR)/g_macros.cm: $(H) g_macros.m
X	cm -o $(MACDIR)/g_macros.cm g_macros.m
X$(MACDIR)/g_vi.cm: $(H) g_vi.m
X	cm -o $(MACDIR)/g_vi.cm g_vi.m
X$(MACDIR)/hanoi.cm: $(H) hanoi.m
X	cm -o $(MACDIR)/hanoi.cm hanoi.m
X$(MACDIR)/help.cm: $(H) help.m
X	cm -o $(MACDIR)/help.cm help.m
X$(MACDIR)/history.cm: $(H) history.m
X	cm -o $(MACDIR)/history.cm history.m
X$(MACDIR)/kbd_help.cm: $(H) kbd_help.m
X	cm -o $(MACDIR)/kbd_help.cm kbd_help.m
X$(MACDIR)/kbd/pc.cm: $(H) kbd/pc.m
X	cm -o $(MACDIR)/kbd/pc.cm kbd/pc.m
X$(MACDIR)/kbd/sun3.cm: $(H) kbd/sun3.m
X	cm -o $(MACDIR)/kbd/sun3.cm kbd/sun3.m
X$(MACDIR)/mail.cm: $(H) mail.m
X	cm -o $(MACDIR)/mail.cm mail.m
X$(MACDIR)/makeman.cm: $(H) makeman.m
X	cm -o $(MACDIR)/makeman.cm makeman.m
X$(MACDIR)/misc.cm: $(H) misc.m
X	cm -o $(MACDIR)/misc.cm misc.m
X$(MACDIR)/options.cm: $(H) options.m
X	cm -o $(MACDIR)/options.cm options.m
X$(MACDIR)/region.cm: $(H) region.m
X	cm -o $(MACDIR)/region.cm region.m
X$(MACDIR)/regress.cm: $(H) regress.m
X	cm -o $(MACDIR)/regress.cm regress.m
X$(MACDIR)/sdb.cm: $(H) sdb.m
X	cm -o $(MACDIR)/sdb.cm sdb.m
X$(MACDIR)/search.cm: $(H) search.m
X	cm -o $(MACDIR)/search.cm search.m
X$(MACDIR)/select.cm: $(H) select.m
X	cm -o $(MACDIR)/select.cm select.m
X$(MACDIR)/shell.cm: $(H) shell.m
X	cm -o $(MACDIR)/shell.cm shell.m
X$(MACDIR)/startup.cm: $(H) startup.m
X	cm -o $(MACDIR)/startup.cm startup.m
X$(MACDIR)/stest.cm: $(H) stest.m
X	cm -o $(MACDIR)/stest.cm stest.m
X$(MACDIR)/tags.cm: $(H) tags.m
X	cm -o $(MACDIR)/tags.cm tags.m
X$(MACDIR)/telnet.cm: $(H) telnet.m
X	cm -o $(MACDIR)/telnet.cm telnet.m
X$(MACDIR)/text.cm: $(H) text.m
X	cm -o $(MACDIR)/text.cm text.m
X$(MACDIR)/tty/at386.cm: $(H) tty/at386.m
X	cm -o $(MACDIR)/tty/at386.cm tty/at386.m
X$(MACDIR)/tty/dec.cm: $(H) tty/dec.m
X	cm -o $(MACDIR)/tty/dec.cm tty/dec.m
X$(MACDIR)/tty/ibm5081.cm: $(H) tty/ibm5081.m
X	cm -o $(MACDIR)/tty/ibm5081.cm tty/ibm5081.m
X$(MACDIR)/tty/isc.cm: $(H) tty/isc.m
X	cm -o $(MACDIR)/tty/isc.cm tty/isc.m
X$(MACDIR)/tty/sun.cm: $(H) tty/sun.m
X	cm -o $(MACDIR)/tty/sun.cm tty/sun.m
X$(MACDIR)/tty/wyse50.cm: $(H) tty/wyse50.m
X	cm -o $(MACDIR)/tty/wyse50.cm tty/wyse50.m
X$(MACDIR)/tty/xenix.cm: $(H) tty/xenix.m
X	cm -o $(MACDIR)/tty/xenix.cm tty/xenix.m
X$(MACDIR)/tty/xterm.cm: $(H) tty/xterm.m
X	cm -o $(MACDIR)/tty/xterm.cm tty/xterm.m
X$(MACDIR)/tty/tty.cm: $(H) tty/tty.m
X	cm -o $(MACDIR)/tty/tty.cm tty/tty.m
X$(MACDIR)/unix.cm: $(H) unix.m
X	cm -o $(MACDIR)/unix.cm unix.m
X$(MACDIR)/welcome.cm: $(H) welcome.m
X	cm -o $(MACDIR)/welcome.cm welcome.m
X$(MACDIR)/window.cm: $(H) window.m
X	cm -o $(MACDIR)/window.cm window.m
X$(MACDIR)/wp.cm: $(H) wp.m
X	cm -o $(MACDIR)/wp.cm wp.m
X
SHAR_EOF
chmod 0444 src/crisp/Makefile || echo "restore of src/crisp/Makefile fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/crisp.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/crisp.h &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X# define	TRUE	1
X# define	FALSE	0
X;*
X;*  Buffer flags.
X;*
X# define 	BF_CHANGED	0x01
X# define 	BF_BACKUP	0x02
X# define	BF_READONLY	0x04
X# define	BF_READ		0x08
X# define	BF_EXEC		0x10
X# define	BF_PROCESS	0x20
X# define	BF_BINARY	0x40
X# define	BF_ANSI		0x80
X;*
X;*  Region mark types.
X;*
X# define	MK_NORMAL	1
X# define	MK_COLUMN	2
X# define	MK_LINE		3
X# define	MK_NONINC	4
X;*
X;* Process flags.
X;*
X# define	PF_ECHO		0x0001
X# define	PF_NOINSERT	0x0002
X# define	PF_WAIT		0x8000
X;*
X;* Fields for search & translate
X;*
X# define	ST_GLOBAL	1
X# define	ST_REGEXP	1
X# define	ST_CASE		1
X# define	ST_BLOCK	1
X;
X;  Bits for file-selection. This may need changing
X;  for different Unix systems.
X;
X# define	S_IFDIR	0x4000
X# define	S_IFREG	0x8000
X;
X;  Registered macro types:
X# define	REG_TYPED	0	// Character typed.		*/
X# define	REG_EDIT	1	// Different file edited.	*/
X# define	REG_ALT_H	2	// ALT-H pressed in response	*/
X					// to a prompt.			*/
X# define	REG_UNASSIGNED	3	// Unassigned key pressed.	*/
X# define	REG_IDLE	4	// Idle time expired.		*/
X# define	REG_EXIT	5	// About to exit.		*/
X# define	REG_NEW		6	// New file edited and readin. 	*/
X# define	REG_CTRLC	7	// CTRL-C (SIGINT) pressed 	*/
X					// during macro execution.	*/
X# define	REG_INVALID	8	// Invalid key pressed during	*/
X;
X;   Flags for (select_buffer) macro.
X# define	SEL_NORMAL	0	// Text is not centered.
X# define	SEL_CENTER	1	// Text is centered.
SHAR_EOF
chmod 0444 src/crisp/crisp.h || echo "restore of src/crisp/crisp.h fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/welcome.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/welcome.h &&
X
X
X         Welcome to CRISP v1.6
X         =====================
X
XLatest news:
X
X    - Use <Alt-F> to gain access to new features via
X      menus.
SHAR_EOF
chmod 0444 src/crisp/welcome.h || echo "restore of src/crisp/welcome.h fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/abbrev.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/abbrev.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X# include	"crisp.h"
X
X(macro _init
X	(
X		(list	abbrev_list)
X		(global abbrev_list)
X
X		(= abbrev_list (quote_list
X			"Edit file:"			"abbrev_file"
X			"File to read:"		"abbrev_file"
X			))
X		(autoload "select" "window_offset")
X	)
X)
X(macro abbreviate
X	(
X		(string	word
X					prompt
X					cmd)
X		(int		len 
X					n 
X					ret
X					match_count)
X		(list		cmd_list
X					match_list)
X		
X		(get_parm 0 word)
X		(get_parm 1 prompt)
X
X		(= n (index prompt ":"))
X		(if (> n 0) (
X			(= prompt (substr prompt 1 n))
X			(if (>= (= n (search_list 0 prompt abbrev_list)) 0) (
X				(return (execute_macro (nth (+ n 1) abbrev_list) word))
X				))
X			))
X
X		(= len (strlen word))
X		(if (== len 0) (
X			(beep)
X			(return "")))
X
X		(= match_count -1)
X		(= word (+ "<" word))
X
X		(= cmd_list (command_list))
X		(= n (search_list 0 word cmd_list ST_REGEXP ST_CASE))
X		(while (>= n 0) (
X			(++ match_count)
X			(put_nth match_count match_list (nth n cmd_list))
X			(= n (search_list (+ n 1) word cmd_list ST_REGEXP ST_CASE))
X			))
X
X		(if (< match_count 0) (
X			(beep)
X			(return "")))
X
X		(if (== match_count 0)
X			(= ret 0)
X		;else
X			(
X				(= ret (select_list "Abbreviations" "" 1 match_list TRUE
X						"help_display \"features/Abbrev.hlp\" \"Help on Abbreviations\""
X						))
X				(refresh)
X			))
X		(if (< ret 0) (
X			(beep)
X			(return "")))
X		(return (nth (- ret 1) match_list))
X	)
X)
X(macro abbrev_file
X	(
X		(string file)
X		(get_parm 0 file)
X		(return (select_file file))
X	)
X)
X
SHAR_EOF
chmod 0444 src/crisp/abbrev.m || echo "restore of src/crisp/abbrev.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/ansi.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/ansi.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X(macro	ansi
X	(
X		(assign_to_key "<Ctrl-A>"	"mark 1")
X		(assign_to_key "<Ctrl-B>"	"buffer_list 1")
X		(assign_to_key "<Ctrl-C>"	"mark 2")
X		(assign_to_key "<Ctrl-D>"	"delete_line")
X		(assign_to_key "<Ctrl-E>"	"edit_file")
X		(assign_to_key "<Ctrl-F>"	"display_file_name")
X		(assign_to_key "<Ctrl-G>"	"goto_line")
X		(assign_to_key "<Ctrl-H>"	"backspace")
X		(assign_to_key "<Ctrl-I>"	"self_insert")
X		(assign_to_key "<Ctrl-J>"	"open_line")
X		(assign_to_key "<Ctrl-K>"	"delete_to_eol")
X		(assign_to_key "<Ctrl-L>"	"mark 3")
X		(assign_to_key "<Ctrl-M>"	"self_insert")
X		(assign_to_key "<Ctrl-N>"	"edit_next_buffer")
X		(assign_to_key "<Ctrl-O>"	"output_file")
X		(assign_to_key "<Ctrl-P>"	"edit_prev_buffer")
X		(assign_to_key "<Ctrl-Q>"	"quote")
X		(assign_to_key "<Ctrl-R>"	"read_file")
X		(assign_to_key "<Ctrl-S>"	"search_fwd")
X		(assign_to_key "<Ctrl-T>"	"translate")
X		(assign_to_key "<Ctrl-U>"	"undo")
X 		(assign_to_key "^V^B"		"set_bottom_of_window")
X		(assign_to_key "^V^C"		"set_center_of_window")
X		(assign_to_key "^V^D"		"page_down")
X		(assign_to_key "^V^G"		"objects routines")
X		(assign_to_key "^V^H"		"help")
X		(assign_to_key "^V^J"		"goto_bookmark")
X		(assign_to_key "^V^K"		"objects delete_word_left")
X		(assign_to_key "^V^L"		"objects delete_word_right")
X		(assign_to_key "^V^N"		"next_error")
X		(assign_to_key "^V^P"		"next_error 1")
X		(assign_to_key "^V^R"		"repeat")
X		(assign_to_key "^V^T"		"set_top_of_window")
X		(assign_to_key "^V^U"		"page_up")
X		(assign_to_key "^V^V"		"version")
X		(assign_to_key "^V^W"		"set_backup")
X		(assign_to_key "<Ctrl-W>"	"write_buffer")
X		(assign_to_key "<Ctrl-X>"	"exit")
X		(assign_to_key "<Ctrl-Y>"	"self_insert")
X		(assign_to_key "<Ctrl-Z>"	"dos")
X	)
X)
SHAR_EOF
chmod 0444 src/crisp/ansi.m || echo "restore of src/crisp/ansi.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/ascii.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/ascii.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X//
X//		Display an ASCII chart.
X//
X(macro ascii
X	(
X		(select_list "ASCII Chart" "" 3 (quote_list
X			"Hex Chart"		"ascii_chart 16"
X								"help_display \"features/Ascii.hlp\" \"Hex ASCII Chart\""
X			"Octal Chart"	"ascii_chart 8"
X								"help_display \"features/Ascii.hlp\" \"Octal ASCII Chart\""
X			"Decimal Chart" "ascii_chart 10"
X								"help_display \"features/Ascii.hlp\" \"Decimal ASCII Chart\""
X			) 2)
X	)
X)
X(macro ascii_chart
X	(
X		(int	radix
X				buf
X				win
X				curbuf
X				curwin
X				ch)
X		(list l)
X		(string name fmt str)
X		
X		(get_parm 0 radix)
X		(= curbuf (inq_buffer))
X		(= curwin (inq_window))
X		
X		(= fmt (switch radix
X				8	"%03d"
X				10 "%3d"
X				16	"%02x"))
X				
X		(sprintf name "%s Ascii Chart" (if (== radix 16) "Hex"
X												 (if (== radix 10) "Decimal" "Octal")))
X		(= buf (create_buffer "Ascii Chart" NULL 1))
X		(set_buffer buf)
X		(= l (quote_list
X			"NUL" "SOH" "STX" "ETX" "EOT" "ENQ" "ACK" "BEL" 
X			"BS " "HT " "NL " "VT " "NP " "CR " "SO " "SI " 
X			"DLE" "DC1" "DC2" "DC3" "DC4" "NAK" "SYN" "ETB" 
X			"CAN" "EM " "SUB" "ESC" "FS " "GS " "RS " "US "))
X		(= ch 0)
X		(while (< ch ' ') (
X			(sprintf str fmt ch)
X			(insert str)
X			(insert " ")
X			(insert (nth ch l))
X			(insert "| ")
X			(if (== (& ch 7) 7)
X				(insert "\n"))
X			(++ ch)
X			))
X		(while (< ch 0x80) (
X			(if (== ch '%')
X				(sprintf str (+ fmt "  %% | ") ch)
X			;else
X				(sprintf str (+ fmt "  %c | ") ch ch)
X				)
X			(insert str)
X			(if (== (& ch 7) 7)
X				(insert "\n"))
X			(++ ch)
X			))
X		(= win (sized_window 17 
X				(switch radix
X					8	71
X					10	71
X					16	63
X				) ""))
X		(select_buffer buf win)
X		(delete_buffer buf)
X		(set_buffer curbuf)
X		(set_window curwin)
X		(attach_buffer curbuf)
X	)
X)
SHAR_EOF
chmod 0444 src/crisp/ascii.m || echo "restore of src/crisp/ascii.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/autosave.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/autosave.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X# include	"crisp.h"
X
X(macro _init
X	(
X		(list	asv_list			;* List of file-names of auto-saved
X									;* files, which need to be deleted when
X									;* we exit.
X				 asvd_list)		;* List of files which dont want to be
X									;* autosaved.
X		(int	asv_len asv_idle_time asvd_len)
X		(string	asv_prefix	;* Filename prefix -- O/S dependent.
X					asv_suffix)	;* Filename suffix.
X		(global asv_list asv_len asv_idle_time asvd_list asvd_len
X					asv_prefix asv_suffix)
X
X		(= asv_len 0)
X		(switch CRISP_OPSYS
X			"VMS"	(
X						(= asv_prefix "ASV-")
X						(= asv_suffix "")
X					)
X			"UNIX" (
X						(= asv_prefix "@")
X						(= asv_suffix "@")
X					)
X			)
X	)
X)
X(macro autosave
X	(					  
X		(register_macro 4 "autosave_files")
X		(register_macro 5 "autosave_exit")
X	)
X)
X(macro autosave_disable
X	(
X		(string filename)
X
X		(get_parm 0 filename)
X		(put_nth asvd_len asvd_list filename)
X		(++ asvd_len)
X	)
X)
X(macro autosave_files
X	(
X		(int	curbuf
X				slash 
X				n
X				num_written
X				h m s
X				time_now
X				time_since_last
X				nextbuf)
X		(string filename afile bufnam)
X
X		;*
X		;*   Check to see if user has typed anything recently.
X		;*
X		(if (< (inq_idle_time) (inq_idle_default))
X			(return))
X		;*
X		;*   Check to see if its at least idle time since last
X		;*   key press.
X		;*
X		(time h m s)
X		(= time_now (+ (* (+ (* 60 h) m) 60) s))
X		(= time_since_last (- time_now asv_idle_time))
X		(if (< time_since_last (inq_idle_default))
X			(return))
X		(= asv_idle_time time_now)
X
X
X		(= curbuf (inq_buffer))
X		(save_position)
X
X		(= num_written 0)
X		(while 1 (
X			(= nextbuf (next_buffer))
X			(set_buffer nextbuf)
X			;*
X			;*   Write buffer away if its been modified.
X			;*
X			(if (inq_modified) (
X				;*
X				;*   Check to see if file occurs in disabled
X				;*   list.
X				;*
X				(inq_names filename NULL bufnam)
X				(= n 0)
X				(while (< n asvd_len) (
X					(if (== filename (nth n asvd_list))
X						(break))					
X					(++ n)
X					))
X				(if (>= n asvd_len) (
X					;*
X					;*   Create a file-name for autosaving into.
X					;*
X					(= slash (rindex filename CRISP_SLASH))
X					(= filename (+ (substr filename 1 slash)
X									(+ asv_prefix (substr filename (+ slash 1)))))
X					(+= filename asv_suffix)
X					(message "Autosave %s." bufnam)
X					(++ num_written)
X					;*
X					;*   Delete file we are gonna write first -- this
X					;*   ensures under VMS that we dont end up with a million
X					;*   and one versions of the autosave file.
X					;*
X					(del filename)
X					(write_buffer filename)
X					;*
X					;*   Check to see if entry occurs in asv list. If not
X					;*   add it. (So we can delete file on exit).
X					;*
X					(= n 0)
X					(while (< n asv_len) (
X						(= afile (nth n asv_list))
X						(if (== filename afile)
X							(break))
X						(++ n)
X						))
X					(if (>= n asv_len) (
X						(put_nth asv_len asv_list filename)
X						(++ asv_len)
X						))
X					))
X				))
X			(if (== nextbuf curbuf)
X				(break))
X			))
X
X		(set_buffer curbuf)
X		(restore_position)
X		(if num_written
X	 		(message "Autosave complete."))
X	)
X)
X;*
X;*   This macro is called when we are about to exit. It is
X;*   responsible for deleting any of the @ files we may have
X;*   accumulated.
X;*
X(macro autosave_exit
X	(
X		(int n)
X		(string	afile)
X
X		(= n 0)
X		(while (< n asv_len) (
X			(del (nth n asv_list))
X			(++ n)
X			))
X	)
X)
SHAR_EOF
chmod 0444 src/crisp/autosave.m || echo "restore of src/crisp/autosave.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/box.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/box.m &&
X/*
X/*   Macros to help in drawing diagrams.
X/**/
X(macro x
X	(box 8 4)
X)
X(macro box
X	(
X		(int	length height i line col)
X		(get_parm 0 length)
X		(get_parm 1 height)
X		(insert_mode)
X		
X		(inq_position line col)
X		(self_insert '+')
X      (= i 0)
X      (while (< i length) (
X   		(self_insert '-')
X         (++ i)))
X		(self_insert '+')
X		(= i 0)
X		(while (< i height) (
X			(down)
X			(left)
X         (self_insert '|')
X			(++ i)))
X		(move_abs (+ line 1) col)
X      (message "line=%d col=%d" line col)
X		(= i 1)
X		(while (< i height) (
X         (self_insert '|')
X			(down)
X			(left)
X			(++ i)))
X		(move_abs (+ line height) col)
X		(self_insert '+')
X      (= i 0)
X      (while (< i length) (
X   		(self_insert '-')
X         (++ i)))
X		(self_insert '+')
X		(insert_mode)
X	)
X)
SHAR_EOF
chmod 0444 src/crisp/box.m || echo "restore of src/crisp/box.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/brace.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/brace.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X# include	"crisp.h"
X
X# define	BRACKETS	"[](){}"
X(macro brace
X	(
X		(string bracket mbracket search move_char s s1)
X		(int	br_level i incr fwd)
X
X		(save_position)
X		(= bracket (read 1))
X		(if (== (index bracket BRACKETS) 0) (
X			(if (<= (search_fwd "[()[\\]{}]") 0) (
X				(beep)
X				(return)))
X			(= bracket (read 1))
X			))
X		(message "Locating matching bracket...")
X		(= i (- (index BRACKETS bracket) 1))
X		(= fwd (& i 1))
X		(= incr (if fwd 1 -1))
X		(= i (+ (* i 2) 1))
X		(= mbracket (substr "[][]()(){}{}" i 2))
X		(= s (+ "[" (+ (quote_regexp mbracket) "]")))
X		(= br_level 1)
X		(= s1 (substr mbracket 1 1))
X
X		(while (> br_level 0) (
X			(if fwd (
X					(prev_char)
X					(if (<= (search_back s ST_REGEXP) 0)
X						(break))
X				)
X			;else
X				(
X					(next_char)
X					(if (<= (search_fwd s ST_REGEXP) 0)
X						(break))
X				))
X			(if (== (read 1) s1) 
X				(-= br_level incr)
X			;else
X				(+= br_level incr)
X				)
X			))
X		(if br_level (
X			(error "Matching %s not found." mbracket)
X			(restore_position)
X			(beep)
X			(return)))
X		(restore_position 0)
X		(message "")
X
X	)
X)
SHAR_EOF
chmod 0444 src/crisp/brace.m || echo "restore of src/crisp/brace.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/calc.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/calc.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X# include	"crisp.h"
X
X//
X//    A simple calculator useful for doing number base conversions.
X//
X# define	OP_STATE		1		// User just typed an operator.
X# define	NUM_STATE	2		// User is typing a number.
X# define	EQ_STATE		3		// User just typed an =
X(macro _init
X	(
X		(list mem)
X		(= mem (quote_list 0 0 0 0 0 0 0 0 0 0))
X	)
X)
X(macro calc
X	(
X		(int	curbuf
X				curwin
X				buf
X				win
X				accumulator
X				yaccumulator
X				number
X				radix
X				calc_state
X				)
X		(string	op)
X		
X		(= radix 10)
X		(= op "+")
X		(= yaccumulator 0)
X		(= calc_state OP_STATE)
X		
X		(= curbuf (inq_buffer))
X		(= curwin (inq_window))
X		(= buf (create_buffer "Calculator" NULL 1))
X		(= win (sized_window 11 23 "<Alt-H> for Help"))
X		(set_window win)
X		(set_buffer buf)
X		(attach_buffer buf)
X		
X		(insert "\n")
X		(insert "-------------------------\n")
X		(insert "Hex | Oct | Dec | rec\n")
X		(insert "Not | And | oR  | sto\n")
X		(insert " a  |  b  |  c  |     \n")
X		(insert " d  |  e  |  f  |  %\n")
X		(insert " 9  |  8  |  7  |  /\n")
X		(insert " 6  |  5  |  4  |  *\n")
X		(insert " 3  |  2  |  1  |  -\n")
X		(insert " 0  |  =  | Sign|  +\n")
X		(top_of_buffer)
X		
X		(keyboard_push)
X		(keyboard_typeables)
X		(assign_to_key "<Esc>" "exit")
X		(assign_to_key "D" "calc_radix 10")
X		(assign_to_key "r" (quote_list (
X				(int	i)
X				(message "Recall Memory - type a digit.")
X				(while (== (= i (read_char)) -1)
X					(continue))
X				(if (&& (>= i '0') (<= i '9')) (
X					(= accumulator (nth (- i '0') mem))
X					(calc_display_acc)))
X				(message "")
X				)))
X		(assign_to_key "s" (quote_list (
X				(int	i)
X				(message "Store in Memory - type a digit.")
X				(while (== (= i (read_char)) -1)
X					(continue))
X				(if (&& (>= i '0') (<= i '9')) (
X					(-= i '0')
X					(put_nth i mem accumulator)
X					(message "%d stored in MEM%d" accumulator i)
X					))
X				)))
X		(assign_to_key "H" "calc_radix 16")
X		(assign_to_key "N" (quote_list (
X				(= accumulator (~ accumulator))
X				(calc_display_acc)
X				)))
X		(assign_to_key "O" "calc_radix 8")
X		(assign_to_key "S" (quote_list (
X				(= accumulator (- 0 accumulator))
X				(calc_display_acc)
X				)))
X		(assign_to_key "<Alt-H>" "help_display \"features/Calc.hlp\" \"Help for the Calculator\"")
X		(register_macro REG_TYPED "calc_typed")
X		(calc_display_acc)
X		(+= window_offset 9)
X		(+= top_line 2)
X		(process)
X		(-= window_offset 9)
X		(-= top_line 2)
X		(keyboard_pop)
X		(unregister_macro REG_TYPED "calc_typed")
X		
X		(delete_buffer buf)
X		(delete_window)
X		
X		(set_buffer curbuf)
X		(set_window curwin)
X		(attach_buffer curbuf)
X		(refresh)
X	)
X)
X(macro calc_radix
X	(
X		(get_parm 0 radix)
X		(= calc_state OP_STATE)
X		(calc_display_acc)
X	)
X)
X(macro calc_display_acc
X	(
X		(string str)
X		
X		(top_of_buffer)
X		(delete_to_eol)
X		(switch radix
X			8		(sprintf str "OCT %14o" accumulator)
X			10		(sprintf str "DEC %14d" accumulator)
X			16		(sprintf str "HEX %14x" accumulator)
X			)
X		(insert str)
X	)
X)
X(macro calc_typed
X	(
X		(string char str)
X		(int	i)
X		
X		(prev_char)
X		(= char (read 1))
X		(delete_char)
X		
X		(if (index "0123456789abcdef" char) (
X			(switch calc_state
X				OP_STATE			(= accumulator 0)
X				EQ_STATE			(
X										(= yaccumulator 0)
X										(= accumulator 0)
X									)
X				)
X			(if (index "abcdef" char)
X				(sprintf char "%d" (+ 9 (index "abcdef" char))))
X			(= accumulator (+ (* accumulator radix) (atoi char)))
X			(calc_display_acc)
X			(= calc_state NUM_STATE)
X			(return)
X			))
X		(if (index "+-*/%ARX=" char) (
X			(int old_acc)
X			(= old_acc accumulator)
X//			(message "x=%d y=%d op=%s" accumulator yaccumulator op)
X			(switch op
X				"+"	(= accumulator (+ yaccumulator accumulator))
X				"-"	(= accumulator (- yaccumulator accumulator))
X				"*"	(= accumulator (* yaccumulator accumulator))
X				"/"	(= accumulator (/ yaccumulator accumulator))
X				"%"	(= accumulator (% yaccumulator accumulator))
X				"A"	(= accumulator (& yaccumulator accumulator))
X				"R"	(= accumulator (| yaccumulator accumulator))
X				"X"	(= accumulator (^ yaccumulator accumulator))
X				)
X			(calc_display_acc)
X			(= yaccumulator accumulator)
X			(= accumulator old_acc)
X			(if (== char "=")
X				(= calc_state EQ_STATE)
X			;else
X				(
X					(= calc_state OP_STATE)
X					(= op char)
X				))
X			(return)
X			))
X		(= i (atoi char 0))
X		(switch (int_to_key i)
X			"<Backspace>"	(
X						(backspace)
X						(beginning_of_line)
X						(right 3)
X						(search_fwd "[~ ]")
X						(= str (trim (read)))
X						(= accumulator (atoi str))
X						(calc_display_acc)
X						(return)
X						)
X			)
X	)
X)
SHAR_EOF
chmod 0444 src/crisp/calc.m || echo "restore of src/crisp/calc.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/compile.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/compile.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X# include	"crisp.h"
X
X# define	TRUE	1
X# define	FALSE	0
X
X(macro _init
X	(
X		(int		compile_buf		;* Buffer containing result of last
X										;* make/compilation.
X					err_line_no		;* Line we are currently on in error file.
X					)
X		(string	compile_filename)
X		(global	compile_buf err_line_no compile_filename)
X
X		(= compile_buf (create_buffer "Compilation-Buffer" NULL 0))
X		(= err_line_no 1)
X	)
X)
X(macro cm
X	(
X		(string filename)
X
X		(if (inq_modified)
X			(write_buffer))
X		(inq_names filename)
X
X		(if (> (load_macro filename) 0)
X			(message "Macro successfully loaded."))
X	)
X)
X(macro make
X	(
X		(string	arg
X					space)
X		(int	curwin
X				curbuf
X				win
X				wait_stat
X				line col
X				)
X
X		(get_parm 0 arg)
X		(= err_line_no 1)
X
X		(= curwin (inq_window))
X		(= curbuf (inq_buffer))
X		(= win (sized_window 12 60 ""))
X		(set_window win)
X		(set_buffer compile_buf)
X		(clear_buffer)
X		(attach_buffer compile_buf)
X
X		(connect 0x8001 "/bin/sh")
X		(refresh)
X		(wait_for 10 "\$") ;"<*[%$:>]")
X		(insert (+ "exec make " (+ arg "\n")))
X		(inq_position line col)
X		(set_process_position line col)
X		(insert_process (+ "exec make " (+ arg "\n")))
X		(refresh)
X		;*
X		;*   Wait for process to die.
X		;*
X		(wait wait_stat)
X		;*
X		;*   Tidy windows & buffers up.
X		;*
X		(delete_window)
X		(set_buffer curbuf)
X		(set_window curwin)
X		;*
X		;*   If any errors occured, display first one screen.
X		;*
X		(assign_to_key "<Ctrl-N>"	"default-next_error")
X		(assign_to_key "<Ctrl-P>"	"default-prev_error")
X		(if wait_stat
X			(default-next_error)
X		;else
X			(message "Make completed successfully.")
X		)
X	)
X)
X;*
X;*		Object routines for finding errors.
X;*
X(macro default-next_error
X	(
X		(next_error  
X"<{\"*\", line [0-9]+:}|{*:[ \t]*[0-9]+:[ \t]}|{*([0-9]+):}"
X;*
X;* 
X						 (quote_list
X("<\"\\c[^():,\"]+\"" 1	"[0-9]+:" 	1)	;* PCC: "fred.c", line 49: ...
X("<[^():]+:" 		1	"[0-9]+:" 		1)	;* cpp: fred.c: 49: ...
X("<[^(]+("			1	"[0-9]+):"		2)	;* SUNOS lint: fred.c(49): ...
X						))
X	)
X)
X;*
X;*	lint macro. This macro expects there to be a makefile entry for
X;* lint, so that we can automatically generate the output via a
X;* 'make lint'. The output is then massaged so that the output from
X;* lint looks like the normal C compiler error messages, which allows
X;* the display error macro to then be used to skip from one error to
X;* the next.
X;*
X(macro lint
X	(
X		(string	filename
X					warning)
X		(int	line)
X
X		//
X		//   Do a make lint.
X		//
X		(make "lint")
X
X		(set_buffer compile_buf)
X
X		//
X		//   Convert all lines of the form:
X		//		(28) (31) (45) ...
X		//   have each '(..)' start on a separate line so we
X		//   can then prefix each line with the file name.
X		//
X		(message "Putting errors in separate lines.")
X		(top_of_buffer)
X		(while (> (search_fwd "^[ \t]+([0-9]+)  \t") 0) (
X			(drop_anchor MK_LINE)
X			(translate ")" ")\n" 1 NULL NULL 1)
X			(raise_anchor)
X			(delete_line)
X			))
X		//
X		//   Now take lines of the form:
X		//    alarm   	llib-lc(15) :: clock.c(45)
X		//   and move the file-name/line-no to the start of the line,
X		//   append the lint error occuring before this block.
X		//
X		(message "Massaging lint summary errors.")
X		(top_of_buffer)
X		(while (> (search_fwd " :: ") 0) (
X			(up)
X			(beginning_of_line)
X			(= warning (trim (read)))
X			(down)
X			(while (== (read 1) " ") (
X				(translate "{<*}\t*:: {*$}" "\\1: \\0 - " 0)
X				(end_of_line)
X				(insert warning)
X				(next_char)
X				))
X			))
X		//
X		//   Delete all leading spaces/tabs
X		//
X		(message "Removing leading white space.")
X		(top_of_buffer)
X		(translate "^[ \t]+" "" 1 -1)
X		//
X		//   Now suffix all of the above lines [ (..) ] with the
X		//   warning message that preceeds them.
X		//
X		(message "Putting error messages on each line.")
X		(top_of_buffer)
X		(while (> (search_fwd "^warning") 0) (
X			(= warning (trim (read)))
X			//
X			//   Look at following lines for lines beginning with '('
X			//
X			(down)
X			(while (== (read 1) "(") (
X				(end_of_line)
X				(insert warning)
X				(beginning_of_line)
X				(down)
X				))
X			))
X		//
X		//   Ensure all lines with errors/warnings put the filename
X		//   at the beginning of the line.
X		//
X		(message "Making errors into a normalised format.")
X		(top_of_buffer)
X		(while (> (search_fwd "^==============$") 0) (
X			(up)
X			(= filename (trim (ltrim (compress (read)))))
X			(move_rel 2 0)
X			(if (index filename " ")
X				(= filename (substr filename 1 (- (index filename " ") 1))))
X			(save_position)
X			(drop_anchor MK_LINE)
X			(if (<= (search_fwd "^==============$") 0) 
X				(end_of_buffer))
X			(translate "<{([0-9]+)}" (+ filename "\\0:") 1 1 NULL 1)
X			(raise_anchor)
X			(restore_position)
X			))
X		//
X		//   Trim down some of the error messages.
X		//
X		(message "Tidying errors up.")
X		(top_of_buffer)
X		(translate "( number ) " "" 1 -1)
X		(top_of_buffer)
X		(translate "( arg {[0-9]} )" "(\\0)" 1 -1)
X		//
X		//   Display first error.
X		//
X		(= err_line_no 1)
X		(default-next_error)
X	)
X)
X(macro next_error
X	(
X		(list	token_list)
X		(string regexp)
X
X		(get_parm 0 regexp)
X		(get_parm 1 token_list)
X
X		(display_error regexp token_list)
X	)
X)
X(macro display_error
X	(
X		(string	regexp
X					filename_pat
X					line_no_pat
X					line)
X		(int		curbuf
X					filename_trail
X					line_no_trail
X					line_no
X					length
X					n
X					offset)
X		(list		token_list re_list)
X		(declare	cs_macro)	;* Context-sensitive callback macro.
X
X		(= curbuf (inq_buffer))
X		(set_buffer compile_buf)
X		(get_parm 0 regexp)
X		(get_parm 1 token_list)
X
X
X		(goto_line err_line_no)
X		(if (<= (search_fwd regexp) 0) (
X			(= err_line_no 1)
X			(message "No more errors.")
X			(set_buffer curbuf)
X			(return)
X			))
X		(inq_position err_line_no)
X		(++ err_line_no)
X
X		(beginning_of_line)
X		(= line (trim (ltrim (compress (read)))))
X
X		;*
X		;*   Scan token_list trying to find an entry which matches the
X		;* filename.
X		;*
X		(= n 0)
X		(= offset -1)
X		(while (< n (length_of_list token_list)) (
X				(= re_list (nth n token_list))
X				(= filename_pat (nth 0 re_list))
X				(= filename_trail (nth 1 re_list))
X				(= line_no_pat (nth 2 re_list))
X				(= line_no_trail (nth 3 re_list))
X				(= offset (search_string filename_pat line length))
X				(++ n)
X				(if (> offset 0)
X					(break))
X				))
X		(set_buffer curbuf)
X		;*
X		;*   Extract file-name.
X		;*
X		(if (>= filename_trail 0) (
X			(if (<= offset 0) (
X				(error "Couldn't locate file-name")
X				(return)))
X			(= compile_filename (substr line offset (- length filename_trail)))
X			))
X
X		;*
X		;*   Extract line number.
X		;*
X		(= offset (search_string line_no_pat line length))
X		(if (<= offset 0) (
X			(error "Couldn't locate line_no")
X			(return)))
X
X		(= line_no (atoi (substr line offset (- length line_no_trail))))
X
X		;*
X		;*   Trim off filename & line no at start of line.
X		;*
X		(= line (substr line (+ offset length)))
X
X		;*
X		;*   Goto specified file & line no.
X		;*
X		(if (! (exist compile_filename)) (
X			(error "%s: %s" compile_filename (ltrim line))
X			(return)
X			))
X		(edit_file compile_filename)
X		(goto_old_line line_no)
X
X		;*
X		;*   Now display error -- this ensures that error appears
X		;*   last on the display, rather than any filename stuff
X		;*   generated by the (edit_file) macro above.
X		(error "%s" (ltrim line))
X
X	)
X)
SHAR_EOF
chmod 0444 src/crisp/compile.m || echo "restore of src/crisp/compile.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/copyr.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/copyr.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
X *           Bucks.                                                 *
X *              England SL7 1TX                                     *
X *                                                                  *
X *                                                                  *
X *    Please See COPYRIGHT notice.                                  *
X *                                                                  *
X ********************************************************************/
X(macro copyr
X	(
X        (int old_insert_mode i line column)
X        (= old_insert_mode ( insert_mode 1 ) )
X        (inq_position line column)
X		(string	ok file_name ext description)
X		(top_of_buffer)
X		(refresh)
X		(if (> (search_fwd "Copyright ") 0)	(
X			(top_of_buffer)
X			(drop_anchor 3)
X			(search_fwd "< \\*\\*")
X			(refresh)
X			(get_parm NULL ok "OK to delete marked region (y/n) ? ")
X			(if (== ok "y")
X				(delete_block)
X			;else
X				(
X					(raise_anchor)
X					(refresh)
X                    ( insert_mode old_insert_mode )
X					(return)
X				)
X				)
X			)
X		)
X		(inq_names NULL ext file_name)
X		(= file_name (substr file_name (+ (rindex file_name "/") 1)))
X		(insert "/************************************************************************\n")
X		(insert " *                                                                      *\n")
X		(insert " *  Program:                    fn                                      *\n")
X		(up)
X		(search_fwd "fn")
X        (= i ( strlen file_name ) )
X        (while ( > i 0 )
X            (
X                (delete_char)
X                (-- i)
X            )
X        )
X		(insert file_name)
X		(down)
X		(beginning_of_line)
X		(insert " *                                                                      *\n")
X		(insert " *----------------------------------------------------------------------*\n")
X		(insert " *  Description:  mcm                                                   *\n")
X		(insert " *                                                                      *\n")
X		(insert " *----------------------------------------------------------------------*\n")
X		(insert " *  Copyright (c) 1989 Reuters Ltd.                                     *\n")
X		(insert " *                                                                      *\n")
X		(insert " *            CONFIDENTIAL INFORMATION OF REUTERS                       *\n")
X		(insert " *                                                                      *\n")
X		(insert " *                                                                      *\n")
X		(insert " *    This program  must not be copied or its contents  disclosed       *\n")
X		(insert " *    without the written approval of the originator. It must not       *\n")
X		(insert " *    be copied in any electronic form, or distributed in printed       *\n")
X		(insert " *    form to anybody without the permission of the above author.       *\n")
X		(insert " *    Failure to comply will be dealt  with  by  the Disciplinary       *\n")
X		(insert " *    Procedure.                                                        *\n")
X		(insert " *                                                                      *\n")
X		(insert " ************************************************************************/\n")
X		(insert "\n")
X;
X;	Look for SCCS string and modify it if necessary
X;
X		(if (> (search_fwd "{SCCS}|{sccs}|{\\@(#)}") 0)
X			(nothing)
X			(if (== ext "h")
X				(insert "/* SCCS ID: %Z% %M% %R%.%L% */\n")
X				(insert "static char sccs_id[] = \"%Z% %M% %R%.%L%\";\n\n")
X			)
X		)
X    (goto_line 1)
X    (search_fwd "mcm")
X    (get_parm 0 description "Enter description: " 50)
X    (= i ( strlen description ) )
X    (while ( > i 0 )
X        (
X            (delete_char)
X            (-- i)
X        )
X    )
X    (insert description)
X    (insert_mode old_insert_mode)
X    (goto_old_line line)
X    (beginning_of_line)
X    (move_rel 0 column)
X	)
X)
X
X
X(macro revision
X    (
X    (int year month day i)
X    (string date_string initials comment ok)
X    (top_of_buffer)
X	(if (<= (search_fwd "Copyright ") 0)
X        (
X        (get_parm NULL ok "Generate copyright notice (y/n) ? ")
X        (if (!= ok "y")
X            (
X            (return -1)
X            )
X        )
X        (copyr)
X        )
X    )
X    (top_of_buffer)
X    (if (<= (search_fwd "Revision") 0) 
X        (
X        (get_parm NULL ok "Generate revision history (y/n) ? ")
X		(if (!= ok "y")
X            (
X            (return -1)
X            )
X        )
X        (search_fwd "{SCCS}|{sccs}|{\\@(#)}")
X        (end_of_line)
X        (insert "\n\n/\* Revision History\n \* ================\n \*\n \*/\n")
X        (search_back "Revision")
X        )
X    )
X    (search_fwd "\*/")
X    (move_rel -1)
X    (end_of_line)
X    (date year month day)    
X    (sprintf date_string "\n *  %d-%d-%d" day month year)
X    (insert date_string)
X    (= i ( - 17 ( strlen date_string ) ) )
X    (while ( > i 0 )
X        (
X            (insert " ")
X            (-- i)
X        )
X    )
X    (get_parm 0 initials "Enter your initials: " 6)
X    (insert initials)
X    (= i ( - 8 ( strlen initials ) ) )
X    (while ( > i 0 )
X        (
X            (insert " ")
X            (-- i)
X        )
X    )
X    (insert ": ")
X    (get_parm 0 comment "Enter comment: " 40)
X    (insert comment)
X    )
X)
X    
SHAR_EOF
chmod 0644 src/crisp/copyr.m || echo "restore of src/crisp/copyr.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/core.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/core.m &&
X/********************************************************************
X *                                                                  *
X *      CRISP - Custom Reduced Instruction Set Programmers Editor   *
X *                                                                  *
X *      (C) Paul Fox, 1989                                          *
X *      43, Jerome Close                Tel: +44 6284 4222          *
X *          Marlow                                                  *
SHAR_EOF
echo "End of part 1"
echo "File src/crisp/core.m is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0
-- 
=====================			Reuters Ltd PLC, 
Tel: +44 628 891313 x. 212		 Westthorpe House,
UUCP:     fox%marlow.uucp@idec.stc.co.uk  Little Marlow,
					   Bucks, England SL7 3RQ