v07i037: CRISP release 1.9 part 16/32
Brandon S. Allbery - comp.sources.misc
allbery at uunet.UU.NET
Sun Jul 23 09:25:46 AEST 1989
Posting-number: Volume 7, Issue 37
Submitted-by: fox at marlow.UUCP (Paul Fox)
Archive-name: crisp1.9/part17
#!/bin/sh
# this is part 3 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file src/crisp/hanoi.m continued
#
CurArch=3
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
exit 1; fi
( read Scheck
if test "$Scheck" != $CurArch
then echo "Please unpack part $Scheck next!"
exit 1;
else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file src/crisp/hanoi.m"
sed 's/^X//' << 'SHAR_EOF' >> src/crisp/hanoi.m
X (insert str)
X (move_abs 0 col)
X )
X)
SHAR_EOF
echo "File src/crisp/hanoi.m is complete"
chmod 0444 src/crisp/hanoi.m || echo "restore of src/crisp/hanoi.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/help.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/help.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;Backups
X;Startup processing
X;Help
X; Apropos
X; Bugs
X; Help on individual key
X;Miscellaneous
X; Setting up private defaults
X; Environment Variables
X; Terminal Tailoring
X; Amusements
X
X
X
X# include "crisp.h"
X
X# define WINDOW_WIDTH 66
X(macro _init
X (
X (int kbd_help
X help_level
X )
X (list kbd_labels)
X (global kbd_help
X help_level
X kbd_labels
X )
X
X (autoload "kbd_help" "help_describe_keyboard")
X (keyboard_push)
X (keyboard_typeables)
X (= kbd_help (inq_keyboard))
X (assign_to_key "^G" "objects routines")
X (assign_to_key "<Alt-S>" "search-fwd")
X (assign_to_key "<PgDn>" "page_down")
X (assign_to_key "<PgUp>" "page_up")
X (assign_to_key "<Down>" "down")
X (assign_to_key "<Up>" "up")
X (assign_to_key "<Shift-F5>" "search_next")
X (assign_to_key "<Shift-F6>" "search_prev")
X (assign_to_key "<Home>" "home")
X (assign_to_key "<End>" "end")
X (assign_to_key "<Esc>" (quote_list
X (
X (while (> help_level 0) (
X (-- help_level)
X (exit)))
X )))
X (assign_to_key "<Keypad-minus>" (quote_list
X (
X (message "")
X (-- help_level)
X (exit)
X )))
X (keyboard_pop 1)
X )
X)
X(macro help
X (
X (int users_kbd)
X
X (= users_kbd (inq_keyboard))
X
X (select_list "Help Menu" "" 2 (quote_list
X "Help" "help_help"
X "Command Summary" "help_command_summary"
X "Keyboard" "help_describe_keyboard"
X "Macros" "help_macros"
X "General Concepts" "help_general_concepts"
X "Features" "help_features"
X "Running CRISP" "help_running"
X ) 1)
X )
X)
X(macro help_command_summary
X (
X (int i j
X len_kbd_labels
X curbuf
X curwin
X tag_buf)
X (string key
X buf
X msg
X nl)
X (= curbuf (inq_buffer))
X (= curwin (inq_window))
X
X (= tag_buf (create_buffer "Command-Summary" NULL 0))
X (set_buffer tag_buf)
X (keyboard_push users_kbd)
X (= nl "")
X
X (= len_kbd_labels (length_of_list kbd_labels))
X (message "Generating keyboard summary...")
X (= i 0)
X (while (< i 256) (
X (= key (inq_assignment i))
X (if (!= key "self_insert") (
X (insert nl)
X (= j (- i 128))
X (if (&& (>= j 0) (< j len_kbd_labels))
X (insert (nth j kbd_labels))
X ;else
X (insert (int_to_key i))
X )
X (move_abs 0 20)
X (insert key)
X (= nl "\n")
X )
X )
X (++ i)
X )
X )
X
X (sort_buffer)
X (keyboard_pop 1)
X (message "")
X (= msg (+ (key_label "<Alt-H>") " - help. "))
X (+= msg (+ (key_label "<Alt-C>") " - copy to scrap."))
X
X (= win (sized_window (+ (inq_lines) 1) (inq_line_length) msg))
X (select_buffer tag_buf win SEL_NORMAL
X (
X (assign_to_key "<Alt-C>" "help_command_summary_copy")
X (assign_to_key "<Alt-H>" "help_command_summary_help")
X )
X NULL 1)
X (delete_buffer tag_buf)
X (set_buffer curbuf)
X (set_window curwin)
X (attach_buffer curbuf)
X )
X)
X(macro help_command_summary_help
X (
X (string cmd arg)
X (int i)
X
X (= cmd (trim (ltrim (read))))
X (= cmd (ltrim (substr cmd (+ (index cmd ">") 1))))
X
X /*----------------------------------------
X /* Now extract any argument if there is
X /* one.
X /*----------------------------------------*/
X
X (if (= i (index cmd " ")) (
X (= arg (substr cmd (+ i 1)))
X (= cmd (substr cmd 1 (- i 1)))
X ))
X (explain cmd)
X )
X)
X(macro help_command_summary_copy
X (
X (save_position)
X (top_of_buffer)
X (drop_anchor MK_LINE)
X (end_of_buffer)
X (copy)
X (restore_position)
X (message "Command summary copied to scrap.")
X )
X)
X(macro help_running
X (
X (select_list "Running CRISP" "" 2 (quote_list
X "Environment Variables" "help_display \"env/Env.hlp\" \"Environment Variables\""
X "Startup Processing" "help_display \"env/Startup.hlp\" \"Startup Processing\""
X "Command Line Switches" "help_display \"env/Switches.hlp\" \"Command Line Switches\""
X "Directory Tree" "help_display \"env/Tree.hlp\" \"Directory Layout\""
X ) 1)
X )
X)
X(macro help_features
X (
X (select_list "Features" "" 2 (quote_list
X "ASCII Chart" "help_display \"features/Ascii.hlp\" \"ASCII\""
X "Calculator" "help_display \"features/Calc.hlp\" \"Calculator\""
X "Compilation" "help_display \"features/Compile.hlp\" \"Compiling\""
X "Current Filename" "help_display \"features/Filename.hlp\" \"Current Filename\""
X "GREP" "help_display \"features/Grep.hlp\" \"GREP\""
X "List Buffers" "help_display \"features/Buflist.hlp\" \"List Buffers\""
X "Mail" "help_display \"features/Mail.hlp\" \"Mail\""
X "Options" "help_display \"features/Options.hlp\" \"Options\""
X "Programming Features" "help_display \"features/Program.hlp\" \"Compiling\""
X "Region Manipulation" "help_display \"features/Region.hlp\" \"Regions\""
X "Spell" "help_display \"features/Spell.hlp\" \"Spelling\""
X "Start a Sub-shell" "help_display \"features/Shell.hlp\" \"Shells\""
X "Word Count" "help_display \"features/Wc.hlp\" \"Word Count\""
X ) 1)
X )
X)
X(macro help_macros
X (
X (select_list "Macros" "" 2 (quote_list
X "Explain" "explain"
X "Primitives" "help_usage"
X "Macro Compiler" "help_display \"lang/Compiler.hlp\" \"Macro Compiler\""
X "Macro Files" "help_display \"lang/Macros.hlp\" \"Macro Files\""
X "Variable Types" "help_display \"lang/Vars.hlp\" \"Variables\""
X ) 1)
X )
X)
X(macro help_help
X (
X (select_list "Introduction" "" 2 (quote_list
X "Introduction" "help_display \"Intro.hlp\" \"Introduction to Help\""
X "How to use Help" "help_display \"How.hlp\" \"How to Use Help\""
X "Prompt Line editing" "help_display \"Prompt.hlp\" \"Prompt Line\""
X "Abbreviations" "help_display \"Abbrev.hlp\" \"Abbreviations\""
X "Known Bugs" ""
X ) 1)
X )
X)
X(macro help_usage
X (
X (select_list "Macro Usage" "" 2 (quote_list
X "Arithmetic Ops" "help_section \"Arith\""
X "Buffers" "help_section \"Buffer\""
X "Debugging" "help_section \"Debug\""
X "Environment" "help_section \"Env\""
X "Files" "help_section \"File\""
X "Keyboard" "help_section \"Kbd\""
X "Lists" "help_section \"List\""
X "Macro Primitives" "help_section \"Macro\""
X "Miscellaneous" "help_section \"Misc\""
X "Movement" "help_section \"Movement\""
X "Process Management" "help_section \"Proc\""
X "Scrap" "help_section \"Scrap\""
X "Screen" "help_section \"Screen\""
X "Search & Translate" "help_section \"Search\""
X "String Manipulation" "help_section \"String\""
X "Variable Declaration" "help_section \"Var\""
X "Windows" "help_section \"Window\""
X ) 1)
X )
X)
X(macro help_section
X (
X (string filename
X sec_name
X cmd)
X (int win
X buf
X curbuf
X curwin
X width
X ret)
X
X (= curbuf (inq_buffer))
X (= curwin (inq_window))
X
X (get_parm 0 sec_name)
X (= filename (+
X (+
X (+ (inq_environment "BHELP") "/")
X "sections/") sec_name))
X
X (= buf (create_buffer "Index" filename 1))
X (set_buffer buf)
X (= width (+ (inq_line_length) 1))
X (if (< width 10)
X (= width 10))
X
X (= win (sized_window (+ (inq_lines) 1) width message_string))
X (++ help_level)
X (= ret (select_buffer buf win SEL_NORMAL
X (
X (assign_to_key "<Space>" "help_section_explain")
X (assign_to_key "<Enter>" "help_section_explain")
X )
X NULL 1))
X
X (= cmd (trim (ltrim (read))))
X (delete_buffer buf)
X (set_buffer curbuf)
X (set_window curwin)
X (attach_buffer curbuf)
X (if (< ret 0)
X (return))
X (explain cmd)
X )
X)
X(macro help_section_explain
X (
X (string cmd)
X (= cmd (trim (ltrim (read))))
X (explain cmd)
X )
X)
X(macro explain
X (
X (string filename
X sec_name
X letter
X cmd
X bhelp)
X (int win
X buf
X curbuf
X curwin
X width
X ret)
X
X (= bhelp (+ (inq_environment "BHELP") "/"))
X
X (= curbuf (inq_buffer))
X (= curwin (inq_window))
X (get_parm 0 cmd "Explain: ")
X (= cmd (trim (ltrim (compress cmd))))
X (if (== cmd "") (
X (message "")
X (return)))
X
X (= letter (upper (substr cmd 1 1)))
X (if (== (index "ABCDEFGHIJKLMNOPQRSTUVWXYZ" letter) 0)
X (= letter "Misc"))
X (= filename (+ bhelp (+ "prim/" (+ letter ".cmd"))))
X (= buf (create_buffer cmd filename 1))
X (set_buffer buf)
X (if (<= (search_fwd (+ "<.HU " (quote_regexp cmd))) 0) (
X (error "Sorry, %s not yet available." cmd)
X (set_buffer curbuf)
X (delete_buffer buf)
X (return)))
X
X (drop_anchor MK_LINE)
X (top_of_buffer)
X (delete_block)
X (if (> (search_fwd "<.HU") 0) (
X (drop_anchor MK_LINE)
X (end_of_buffer)
X (delete_block)
X (top_of_buffer)
X ))
X (= win (sized_window (+ (inq_lines) 1) WINDOW_WIDTH ""))
X (set_window win)
X (attach_buffer buf)
X (keyboard_push kbd_help)
X (tabs 4)
X (++ help_level)
X (message "")
X (process)
X (keyboard_pop 1)
X
X (delete_window)
X (delete_buffer buf)
X (set_buffer curbuf)
X (set_window curwin)
X )
X)
X(macro help_general_concepts
X (
X (select_list "General Concepts" "" 2 (quote_list
X "Files" "help_display \"concept/Files.hlp\" \"Files\""
X "Buffers" "help_display \"concept/Buffers.hlp\" \"Buffers\""
X "Windows" "help_display \"concept/Windows.hlp\" \"Windows\""
X "Macros" "help_display \"concept/Macros.hlp\" \"Macros\""
X "Blocks" "help_display \"concept/Blocks.hlp\" \"Blocks and Regions\""
X "Regular Expressions" "help_display \"concept/Regexp.hlp\" \"Regular Expressions\""
X "Registered Macros" "help_display \"concept/Register.hlp\" \"Registered Macros\""
X "Processes" "help_display \"concept/Proc.hlp\" \"Processes\""
X ) 1)
X )
X)
X(macro help_display
X (
X (string filename
X title
X section)
X (int curwin
X curbuf
X win
X line
X buf)
X
X (get_parm 0 filename)
X (get_parm 1 title)
X (get_parm 2 section)
X (= filename (+ (+ (inq_environment "BHELP") "/") filename))
X (= curwin (inq_window))
X (= curbuf (inq_buffer))
X
X (= buf (create_buffer title filename 1))
X (set_buffer buf)
X (= win (sized_window (+ (inq_lines) 1) WINDOW_WIDTH ""))
X (set_window win)
X (attach_buffer buf)
X (if (!= section "") (
X (search_fwd (+ "<" (quote_regexp section)))
X (inq_position line)
X (set_top_left line)
X ))
X
X (keyboard_push kbd_help)
X (++ help_level)
X (message "Type <Ctrl-G> to see section headings.")
X (process)
X (keyboard_pop 1)
X
X (delete_window)
X (delete_buffer buf)
X
X (set_window curwin)
X (set_buffer curbuf)
X )
X)
SHAR_EOF
chmod 0444 src/crisp/help.m || echo "restore of src/crisp/help.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/history.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/history.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 (string hist_last_response)
X (int hist_buf
X hist_no
X hist_line
X hist_last_line)
X (global hist_last_response
X hist_line
X hist_last_line
X hist_no
X hist_buf)
X
X (= hist_buf (create_buffer "History-Buffer" NULL 1))
X (autoload "abbrev" "abbreviate")
X
X )
X)
X(macro _prompt_begin
X (
X (int curbuf
X msg_level)
X (string curr_msg)
X
X (= curr_msg (inq_message))
X (if (index curr_msg ":")
X (= curr_msg (substr curr_msg 1 (index curr_msg ":"))))
X (= curbuf (inq_buffer))
X (set_buffer hist_buf)
X (= hist_no -1)
X (top_of_buffer)
X (= msg_level (inq_msg_level))
X (set_msg_level 3)
X
X (if (<= (search_fwd (+ "<### " (+ curr_msg " ###$"))) 0) (
X (end_of_buffer)
X (insert (+ "### " (+ curr_msg " ###\n")))
X (= hist_last_line -1)
X (inq_position hist_line)
X (set_buffer curbuf)
X (set_msg_level msg_level)
X (return)
X ))
X
X (down)
X (inq_position hist_line)
X (if (<= (search_fwd "<### * ###$") 0) (
X (= hist_last_line (inq_lines))
X (-= hist_last_line hist_line)
X )
X ;else
X (
X (inq_position hist_last_line)
X (-= hist_last_line 2)
X ))
X (goto_line hist_line)
X (set_buffer curbuf)
X (attach_buffer curbuf)
X (set_msg_level msg_level)
X )
X)
X(replacement _bad_key
X (
X (string line
X )
X (int curbuf
X key_pressed
X retval)
X
X (= curbuf (inq_buffer))
X (= key_pressed (read_char))
X
X (switch key_pressed
X (key_to_int "<Up>") (
X (++ hist_no)
X )
X (key_to_int "<Down>") (
X (-- hist_no)
X )
X (key_to_int "<Alt-L>")
X (return hist_last_response)
X (key_to_int "<Tab>") (
X (= line (abbreviate (inq_cmd_line) (inq_message)))
X (if (!= line "") (
X (push_back (key_to_int "<End>"))
X (return line)))
X (return (inq_cmd_line))
X )
X )
X
X
X (if (|| (== (read 1) "#") (< hist_last_line 0)) (
X (beep)
X (return 0)))
X
X
X (if (< hist_no 0)
X (= hist_no (- hist_last_line 1)))
X (if (< hist_no 0) (
X (beep)
X (return 0)))
X (if (>= hist_no hist_last_line)
X (= hist_no 0))
X (set_buffer hist_buf)
X (move_rel hist_no)
X (= line (trim (read)))
X (goto_line hist_line)
X
X (set_buffer curbuf)
X
X (return line)
X )
X)
X(macro _prompt_end
X (
X (int curbuf line)
X (string cmd)
X
X (if (== (inq_message) "Command cancelled.")
X (return))
X
X (= curbuf (inq_buffer))
X (= cmd (inq_cmd_line))
X (if (> (strlen cmd) 2)
X (= hist_last_response cmd))
X (set_buffer hist_buf)
X (inq_position line)
X
X (if (> (strlen cmd) 1) (
X (insert (+ cmd "\n"))
X (if (> (search_fwd (+ "<#|{" (+ cmd "$}"))) 0) (
X (if (!= (read 1) "#")
X (delete_line))
X ))
X ))
X (set_buffer curbuf)
X (attach_buffer curbuf)
X )
X)
SHAR_EOF
chmod 0444 src/crisp/history.m || echo "restore of src/crisp/history.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/kbd_help.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/kbd_help.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; L1 L2 F1 F2 F3 F4 F5 F6 F7 F8 F9 BS R1 R2 R3
X; L3 L4 ESC 1 2 3 4 5 6 7 8 9 0 - = \ ` R4 R5 R6
X; L5 L6 TAB Q W E R T Y U I O P [ ] DEL R7 ^ R9
X; L7 L8 A S D F G H J K L ; ' RETURN <- R11 ->
X; L9 L10 Z X C V B N M , . / LF R13 v R15
X; SPACE
X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
X(macro help_describe_keyboard
X (
X (int curbuf
X curwin
X buf
X win
X )
X (list kbd_list)
X
X (= curbuf (inq_buffer))
X (= buf (create_buffer "Nice-Keyboard" NULL 1))
X (set_buffer buf)
X (switch (inq_environment "BTERM")
X NULL (
X (insert "F1 F2 \\ 1 2 3 4 5 6 7 8 9 0 - = # <- ESC NL SL SR\n")
X (insert "F3 F4 TAB Q W E R T Y U I O P [ ] CR 7 8 9 *\n")
X (insert "F5 F6 A S D F G H J K L ; ' 4 5 6 -\n")
X (insert "F7 F8 Z X C V B N M , . / 1 2 3 +\n")
X (insert "F9 F10 SPACE 0 .\n")
X (= kbd_list (quote_list
X("<F1>" "<Shift-F1>" "<Ctrl-F1>" "<Alt-F1>")
X("<F1>" "<Shift-F2>" "<Ctrl-F2>" "<Alt-F2>")
X("\\" "~" "" "N`")
X("1" "!" "1" "<Alt-1>")
X("2" "@" "" "<Alt-2>")
X("3" "#" "3" "<Alt-3>")
X("4" "$" "4" "<Alt-4>")
X("5" "%" "5" "<Alt-5>")
X("6" "\\^" "" "<Alt-6>")
X("7" "&" "7" "<Alt-7>")
X("8" "*" "8" "<Alt-8>")
X("9" "(" "9" "<Alt-9>")
X("0" ")" "0" "<Alt-0>")
X("-" "+" "" "N-")
X("=" "+" "=" "N=")
X("\\" "|" "" "N\\")
X("" "" "" "")
X("" "" "" "")
X("" "" "" "")
X("" "" "" "")
X("" "" "" "")
X("<F3>" "<Shift-F3>" "<Ctrl-F3>" "<Alt-F3>")
X("<F4>" "<Shift-F4>" "<Ctrl-F4>" "<Alt-F4>")
X("\t" "<Shift-Tab>" "<Ctrl-Tab>" "<Alt-Tab>")
X("q" "Q" "^Q" "<Alt-Q>")
X("w" "W" "^W" "<Alt-W>")
X("e" "E" "^E" "<Alt-E>")
X("r" "R" "^R" "<Alt-R>")
X("t" "T" "^T" "<Alt-T>")
X("y" "Y" "^Y" "<Alt-Y>")
X("u" "U" "^U" "<Alt-U>")
X("i" "I" "^I" "<Alt-I>")
X("o" "O" "^O" "<Alt-O>")
X("p" "P" "^P" "<Alt-P>")
X("[" "{" "^[" "<Alt-[>")
X("]" "}" "^]" "<Alt-]>")
X("<Enter>" "<Enter>" "<Ctrl-Enter>" "<Enter>")
X("<Home>" "7" "<Ctrl-Home>" "<Alt-Home>")
X("<Up>" "8" "<Ctrl-Up>" "<Alt-Up>")
X("<PgUp>" "9" "<Ctrl-PgUp>" "<Alt-PgUp>")
X("<Keypad-*>" "*" "*" "*")
X("<F5>" "<Shift-F5>" "<Ctrl-F5>" "<Alt-F5>")
X("<F6>" "<Shift-F6>" "<Ctrl-F6>" "<Alt-F6>")
X("a" "A" "^A" "<Alt-A>")
X("s" "S" "^S" "<Alt-S>")
X("d" "D" "^D" "<Alt-D>")
X("f" "F" "^F" "<Alt-F>")
X("g" "G" "^G" "<Alt-G>")
X("h" "H" "^H" "<Alt-H>")
X("j" "J" "^J" "<Alt-J>")
X("k" "K" "^K" "<Alt-K>")
X("l" "L" "^L" "<Alt-L>")
X(";" ":" ";" "N;")
X("'" "\"" "'" "N'")
X("<Left>" "4" "<Ctrl-Left>" "<Alt-Left>")
X("O" "5" "]" "O")
X("<Right>" "6" "<Ctrl-Right>" "<Alt-Right>")
X("<Keypad-minus>" "-" "V" "V")
X("<F7>" "<Shift-F7>" "<Ctrl-F7>" "<Alt-F7>")
X("<F8>" "<Shift-F8>" "<Ctrl-F8>" "<Alt-F8>")
X("z" "Z" "^Z" "<Alt-Z>")
X("x" "X" "^X" "<Alt-X>")
X("c" "C" "^C" "<Alt-C>")
X("v" "V" "^V" "<Alt-V>")
X("b" "B" "^B" "<Alt-B>")
X("n" "N" "^N" "<Alt-N>")
X("m" "M" "^M" "<Alt-M>")
X("," "\\<" "," "N,")
X("." ">" "." "N.")
X("/" "?" "" "N/")
X("<End>" "1" "<Ctrl-End>" "<Alt-End>")
X("<Down>" "2" "<Ctrl-Down>" "<Alt-Down>")
X("<PgDn>" "3" "<Ctrl-PgDn>" "<Alt-PgDn>")
X("<Keypad-plus>" "+" "U" "U")
X("<F9>" "<Shift-F9>" "<Ctrl-F9>" "<Alt-F9>")
X("<F10>" "<Shift-F10>" "<Ctrl-F10>" "<Alt-F10>")
X(" " " " "" " ")
X("<Ins>" "0" "X" "J")
X("<Delete>" "." "<Delete>" "N")
X ))
X )
X )
X (= win (sized_window (inq_lines) (inq_line_length) "Hello"))
X (select_word buf win)
X
X (delete_buffer buf)
X (set_buffer curbuf)
X )
X)
X(macro select_word
X (
X (int old_buf
X old_win
X ass_win
X ass_buf
X buf
X number_of_items
X selection
X depth
X word
X retval)
X (list do_list)
X (declare key_list)
X
X (= old_buf (inq_buffer))
X (= old_win (inq_window))
X
X (= word 0)
X
X (get_parm 0 buf)
X (get_parm 1 win)
X (get_parm 3 do_list)
X
X (set_window win)
X (set_buffer buf)
X (attach_buffer buf)
X (top_of_buffer)
X (= number_of_items (inq_lines))
X
X (top_of_buffer)
X (-- number_of_items)
X
X (keyboard_push)
X (keyboard_typeables)
X (assign_to_key "<Home>" (quote_list (
X (= word 0)
X (top_of_buffer)
X (mark_word)
X )))
X (assign_to_key "<End>" (quote_list (
X (= word 30)
X (mark_word)
X )))
X (assign_to_key "<Left>" (quote_list (
X (raise_anchor)
X (default-word_left)
X (-- word)
X (mark_word)
X )))
X (assign_to_key "<Right>" (quote_list (
X (raise_anchor)
X (default-word_right)
X (++ word)
X (mark_word)
X )))
X (assign_to_key "<Up>" (quote_list (
X (raise_anchor)
X (up)
X (default-word_left)
X (default-word_right)
X (mark_word)
X )))
X (assign_to_key "<Down>" (quote_list (
X (raise_anchor)
X (down)
X (default-word_left)
X (default-word_right)
X (mark_word)
X )))
X (assign_to_key "<Esc>" (quote_list (
X (exit)
X )))
X
X (assign_to_key "<Space>" "kbd_key_info")
X (assign_to_key "<Keypad-minus>" "exit")
X (if (length_of_list do_list)
X (assign_to_key "<Enter>" "sel_list")
X ;else
X (assign_to_key "<Enter>" "exit")
X )
X
X (get_parm 2 key_list)
X (register_macro 0 "selw_alpha")
X
X (= ass_buf (create_buffer "Assignments" NULL 1))
X (+= top_line 7)
X (= ass_win (sized_window 5 35 ""))
X (-= top_line 7)
X (set_buffer ass_buf)
X (set_window ass_win)
X (attach_buffer ass_buf)
X
X (mark_word)
X (set_window win)
X (set_buffer buf)
X (refresh)
X (process)
X
X (unregister_macro 0 "selw_alpha")
X (raise_anchor)
X (keyboard_pop)
X
X (delete_window)
X (set_window ass_win)
X (delete_window)
X (delete_buffer ass_buf)
X (set_window old_win)
X (set_buffer old_buf)
X )
X)
X(macro mark_word
X (
X (save_position)
X (search_fwd "\\c[ \t]|>")
X (prev_char)
X (drop_anchor MK_NORMAL)
X (restore_position)
X (display_assignment)
X )
X)
X(macro word_no
X (
X (int word_no
X cur_line
X cur_col
X line
X col
X )
X
X //
X // First calculate which word we are on.
X //
X (save_position)
X (inq_position cur_line cur_col)
X (top_of_buffer)
X (= word_no 0)
X (while (1) (
X (inq_position line col)
X (if (> line cur_line)
X (break))
X (if (&& (== line cur_line) (== col cur_col))
X (break))
X (next_char)
X (search_fwd "<|[ \t]\\c[~ \t]")
X (++ word_no)
X ))
X (restore_position)
X; (message "word no = %d" word_no)
X (return word_no)
X )
X)
X(macro display_assignment
X (
X (int curbuf kbd)
X (string key s)
X (list key_list)
X
X (= curbuf (inq_buffer))
X
X (= key_list (nth word kbd_list))
X (= kbd (inq_keyboard))
X (keyboard_push users_kbd)
X (set_buffer ass_buf)
X (top_of_buffer)
X (drop_anchor MK_LINE)
X (end_of_buffer)
X (delete_block)
X
X (insert " (")
X (= s (nth 0 key_list))
X (if (strlen s)
X (insert (inq_assignment s)))
X (insert ")\nSHIFT: (")
X (= s (nth 1 key_list))
X (if (strlen s)
X (insert (inq_assignment s)))
X (insert ")\nCTRL: (")
X (= s (nth 2 key_list))
X (if (strlen s)
X (insert (inq_assignment s)))
X (insert ")\nALT: (")
X (= s (nth 3 key_list))
X (if (strlen s)
X (insert (inq_assignment s)))
X (insert ")\n")
X (keyboard_pop 1)
X (top_of_buffer)
X (refresh)
X (set_buffer curbuf)
X )
X)
X
X(macro kbd_key_info
X (
X (int word
X buf
X curbuf
X win
X kbd)
X (string key s)
X (list key_list)
X
X (= word (word_no))
X (= curbuf (inq_buffer))
X
X (= ass_buf (create_buffer "Assignments" NULL 1))
X (set_buffer buf)
X (= key_list (nth word kbd_list))
X (= kbd (inq_keyboard))
X (keyboard_push users_kbd)
X
X (insert " (")
X (= s (nth 0 key_list))
X (if (strlen s)
X (insert (inq_assignment s)))
X (insert ")\nSHIFT: (")
X (= s (nth 1 key_list))
X (if (strlen s)
X (insert (inq_assignment s)))
X (insert ")\nCTRL: (")
X (= s (nth 2 key_list))
X (if (strlen s)
X (insert (inq_assignment s)))
X (insert ")\nALT: (")
X (= s (nth 3 key_list))
X (if (strlen s)
X (insert (inq_assignment s)))
X (insert ")\n")
X (keyboard_pop 1)
X
X (+= top_line 7)
X (= win (sized_window 5 (inq_line_length) ""))
X (-= top_line 7)
X (select_buffer buf win)
X (set_buffer curbuf)
X )
X)
SHAR_EOF
chmod 0444 src/crisp/kbd_help.m || echo "restore of src/crisp/kbd_help.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/mail.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/mail.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/*
X/* Macro to send and receive Unix mail.
X/*
X/* Copyright (C) 1989, P. Fox
X/*
X/****************************************************************/
X
X# include "crisp.h"
X
X# define MAILDIR "/usr/spool/mail/" /* BSD (SunOS anyway). */
X/*# define MAILDIR "/usr/mail/" /* System V. */
X
X(macro _init
X (
X (int mail_mtime
X mail_rep_buf)
X (string mailfile)
X (global mailfile
X mail_mtime
X mail_rep_buf)
X
X /*----------------------------------------
X /* Work out where mail for this user is
X /* stored.
X /*----------------------------------------*/
X (= mailfile (inq_environment "MAIL"))
X (if (== mailfile "")
X (= mailfile (+ MAILDIR (inq_environment "USER"))))
X (= mail_rep_buf -1)
X (= mail_mtime -1)
X (register_macro REG_IDLE "mail_watch")
X (mail_watch)
X )
X)
X(macro mail_watch
X (
X (if (mail_changed)
X (message "There is new mail."))
X )
X)
X(macro mail_changed
X (
X (int mtime)
X
X (file_pattern mailfile)
X (if (== (find_file NULL NULL mtime) 0) (
X (= mail_mtime -1)
X (return FALSE)
X ))
X (if (!= mtime mail_mtime) (
X (= mail_mtime mtime)
X (return TRUE)
X ))
X (return FALSE)
X )
X)
X(macro mail
X (
X (mail_read)
X )
X)
X(macro mail_read
X (
X (string from_line
X subject_line
X line)
X (list who_list)
X (int who_len
X space
X msg_no
X line_no
X last_line_no // Used to calculate message size.
X curbuf
X hdrbuf // Buffer containing header summary
X mailbuf // Buffer containing mail file.
X hdrwin // Window for pop-up
X quit_flag // Set if user aborts mail reading.
X )
X
X (= quit_flag FALSE)
X (= curbuf (inq_buffer))
X
X /*----------------------------------------
X /* See if there is any mail.
X /*----------------------------------------*/
X (if (! (exist mailfile)) (
X (error "There is no mail for you.")
X (return)))
X /*----------------------------------------
X /* Build up a list of who the mail is
X /* from.
X /*----------------------------------------*/
X (edit_file mailfile)
X (top_of_buffer)
X (= mailbuf (inq_buffer))
X (= hdrbuf (create_buffer "Mail Messages" NULL 1))
X (= last_line_no 0)
X
X (while (> (search_fwd "<From ") 0) (
X (right 5)
X (inq_position line_no)
X (= from_line (trim (read)))
X (= space (index from_line " "))
X (= from_line (substr from_line 1 (- space 1)))
X
X /*----------------------------------------
X /* Get subject line.
X /*----------------------------------------*/
X (= subject_line "")
X (if (> (search_fwd "^{Subject: }|{From }") 0) (
X (if (== (read 1) "S")
X (= subject_line (ltrim (trim (substr (read) 10)))))
X ))
X (if (< (strlen subject_line) 30)
X (+= subject_line " "))
X (= subject_line (substr subject_line 1 30))
X
X (if (<= (search_fwd "<From ") 0)
X (end_of_buffer))
X (= last_line_no line_no)
X (inq_position line_no)
X
X (set_buffer hdrbuf)
X (if (!= who_len 0)
X (insert "\n"))
X
X (sprintf line "%d. %s [%4d] %s" (+ who_len 1) subject_line (- line_no last_line_no) from_line)
X (insert line)
X (set_buffer mailbuf)
X (put_nth (* 2 who_len) who_list last_line_no)
X (put_nth (+ (* 2 who_len) 1) who_list line_no)
X (++ who_len)
X ))
X (if (!= who_len 0) (
X (message "Use <Esc> to exit and save changes; Q to exit.")
X (= hdrwin (sized_window
X (+ who_len 1)
X 76
X "D to delete. W to write. <Alt-H> for help."))
X (set_buffer curbuf)
X (attach_buffer curbuf)
X (select_buffer hdrbuf hdrwin 0
X (
X (assign_to_key "d" "mail_delete")
X (assign_to_key "D" "mail_delete")
X (assign_to_key "s" "mail_save")
X (assign_to_key "S" "mail_save")
X (assign_to_key "w" "mail_write")
X (assign_to_key "W" "mail_write")
X (assign_to_key "q" "mail_quit")
X (assign_to_key "Q" "mail_quit")
X (assign_to_key "<Enter>" "mail_select")
X )
X NULL
X "help_display \"features/Mail.hlp\" \"Mail\"")
X /*----------------------------------------
X /* Save the unread mail back in the mailbox.
X /*----------------------------------------*/
X (if quit_flag
X (message "Quit - %s not updated." mailfile)
X ;else
X (mail_save_unread))
X )
X ;else
X (message "There is no mail for you."))
X
X
X /*----------------------------------------
X /* Take user back to original buffer.
X /*----------------------------------------*/
X (set_buffer curbuf)
X (delete_buffer mailbuf)
X (attach_buffer curbuf)
X )
X)
X(macro mail_save_unread
X (
X (int n
X pos
X start_line
X end_line
X num_saved
X msg_no)
X
X (message "Updating %s..." mailfile)
X /*----------------------------------------
X /* Delete read articles backwards.
X /* This is necessary otherwise we have
X /* to cater for the fact that the line
X /* indexes in the who_list become
X /* incorrect as we delete each read
X /* article.
X /*----------------------------------------*/
X (= n (- who_len 1))
X (while (>= n 0) (
X (set_buffer hdrbuf)
X (goto_line (+ n 1))
X (= line (read))
X (= pos (search_string "[.*]" line))
X (if (&& (> pos 0) (== (substr line pos 1) "*")) (
X (= msg_no (- (atoi line) 1))
X (= start_line (nth (* 2 msg_no) who_list))
X (= end_line (- (nth (+ (* 2 msg_no) 1) who_list) 1))
X (set_buffer mailbuf)
X (goto_line start_line)
X (drop_anchor MK_LINE)
X (goto_line end_line)
X (delete_block)
X )
X ;else
X (++ num_saved))
X (-- n)
X ))
X (set_buffer mailbuf)
X (if (mail_changed) (
X (error "Sorry - new mail arrived.")
X (return)))
X (if (== num_saved 0)
X (del mailfile)
X ;else
X (write_buffer))
X /*----------------------------------------
X /* Force internal mod time to be updated.
X /*----------------------------------------*/
X (mail_changed)
X (message "%d message%s saved in %s"
X num_saved
X (if (== num_saved 1) "" "s")
X mailfile)
X )
X)
X(macro mail_quit
X (
X (= quit_flag TRUE)
X (exit)
X )
X)
X(macro mail_delete
X (
X (translate "[*.]*$" "* <Message Deleted>" 0)
X (beginning_of_line)
X (push_back (key_to_int "<Down>"))
X )
X)
X(macro mail_write
X (mail_write_msg TRUE)
X)
X(macro mail_save
X (mail_write_msg FALSE)
X)
X(macro mail_write_msg
X (
X (string filename
X msg)
X (int save_headers
X curbuf
X line_no
X start_line
X end_line)
X
X (= curbuf (inq_buffer))
X (get_parm 0 save_headers)
X (= filename "~/mbox")
X (if save_headers
X (= msg "Write to file: ")
X (= msg "Save to file: "))
X (get_parm NULL filename msg NULL filename)
X (= line_no (- (atoi (read)) 1))
X
X (set_buffer mailbuf)
X (= start_line (nth (* 2 line_no) who_list))
X (= end_line (- (nth (+ (* 2 line_no) 1) who_list) 1))
X (goto_line start_line)
X (if (! save_headers) (
X (search_fwd "^$")
X (down)
X ))
X (drop_anchor MK_LINE)
X (goto_line end_line)
X (if (<= (write_block filename 1) 0)
X (message "Error whilst trying to write %s" filename)
X ;else
X (message "Message saved in %s" filename))
X
X (set_buffer curbuf)
X (mail_delete)
X )
X)
X(macro mail_reply
X (
X (string filename
X answer
X mail_cmd
X msg)
X (string from subject)
X (int save_headers
X curbuf
X rep_win
X old_win
X line_no
X start_line
X end_line
X i)
X
X (= curbuf (inq_buffer))
X (= old_win (inq_window))
X (sprintf filename "/tmp/cr.rep.%d" (getpid))
X (save_position)
X (top_of_buffer)
X (drop_anchor MK_LINE)
X (end_of_buffer)
X (copy)
X (restore_position)
X
X (if (< mail_rep_buf 0)
X (= mail_rep_buf (create_buffer "Reply-Buffer" filename 0)))
X (= rep_win (sized_window 24 76 "Type <ESC> to terminate reply"))
X (set_window rep_win)
X (attach_buffer mail_rep_buf)
X
X (set_buffer mail_rep_buf)
X (top_of_buffer)
X (paste)
X (drop_anchor MK_LINE)
X (end_of_buffer)
X (delete_block)
X
X (= from (get_header "From:"))
X (= subject (get_header "Subject:"))
X (top_of_buffer)
X (drop_anchor MK_LINE)
X (if (> (search_fwd "^$") 0) (
X (delete_block)
X (translate "^" "> " ST_GLOBAL)
X (insert "\n")
X (top_of_buffer)
X (insert "To: ")
X (insert from)
X (insert "\n")
X (if (!= (substr (upper subject) 1 3) "RE:")
X (= subject (+ "Re: " subject)))
X (insert "Subject: ")
X (insert subject)
X (insert "\n\n")
X (end_of_buffer)
X (drop_anchor MK_LINE)
X ))
X (raise_anchor)
X (end_of_buffer)
X
X (unregister_macro REG_TYPED "sel_alpha")
X (select_editable)
X (register_macro REG_TYPED "sel_alpha")
X /*----------------------------------------
X /* Insert users .signature if he's got one.
X /*----------------------------------------*/
X (end_of_buffer)
X (insert "\n")
X (read_file "~/.signature")
X (refresh)
X (delete_window)
X
X /*----------------------------------------
X /* Now ask user if he wants to send
X /* the mail response.
X /*----------------------------------------*/
X (= answer "")
X (while (&& (!= answer "y") (!= answer "n")) (
X (get_parm NULL answer "Really send (y/n) ? " 1)
X (= answer (lower answer))
X ))
X (top_of_buffer)
X (drop_anchor MK_LINE)
X (if (> (search_fwd "^$") 0) (
X (delete_block)
X (drop_anchor MK_LINE)
X ))
X (raise_anchor)
X (if (== answer "y") (
X /*----------------------------------------
X /* Remove any characters from title which
X /* might cause shell to blow up.
X /*----------------------------------------*/
X (while (> (= i (search_string "[!^]" subject)) 0)
X (= subject (+ (substr subject 1 (- i 1))
X (substr subject (+ i 1)))))
X (write_buffer)
X (sprintf mail_cmd "mail -s \"%s\" %s < %s >& /tmp/cr.mail.errors" subject from filename)
X (message mail_cmd)
X (shell mail_cmd 1)
X (del filename)
X ))
X (set_window old_win)
X (set_buffer curbuf)
X (attach_buffer curbuf)
X )
X)
X/*
X * This macro grabs an RFC header line. The name of the line
X * is given by the argument passed to this macro. The RFC label
X * is stripped off and a compressed version of the string after
X * the colon is returned.
X */
X(macro get_header
X (
X (string name value)
X (get_parm 0 name)
X (top_of_buffer)
X (if (> (search_fwd (+ "^" name)) 0) (
X (= value (read))
X (= value (substr value (+ (index value ":") 1)))
X (= value (trim (ltrim (compress value))))
X /*----------------------------------------
X /* If its the From: field then we need
X /* to strip off any comments.
X /*----------------------------------------*/
X (if (== name "From:") (
X (if (index value "(")
X (= value (substr value 1 (- (index value "(") 1))))
X (if (index value "<") (
X (= value (substr value (+ (index value "<") 1)))
X (= value (substr value 1 (- (index value ">") 1)))
X ))
X ))
X (return value)
X ))
X (return "DONT KNOW")
X )
X)
X(macro mail_select
X (
X (int line_no
X start_line
X end_line
X buf
X win
X curbuf
X curwin)
X (string tmpfile
X title)
X
X (= curbuf (inq_buffer))
X (= curwin (inq_window))
X (= line_no (atoi (read 4)))
X (= title (ltrim (trim (substr (read) 4 30))))
X (if (== title "<Message Deleted>")
X (return))
X (-- line_no)
X (= start_line (nth (* 2 line_no) who_list))
X (= end_line (- (nth (+ (* 2 line_no) 1) who_list) 1))
X
X (set_buffer mailbuf)
X (goto_line start_line)
X (drop_anchor MK_LINE)
X (goto_line end_line)
X (sprintf tmpfile "/tmp/GRmail.%d" (getpid))
X (write_block tmpfile)
X (raise_anchor)
X (= buf (create_buffer title tmpfile 1))
X (set_buffer buf)
X (= win (sized_window (+ (inq_lines) 1) (inq_line_length) "<Esc> to return to main menu."))
X (select_buffer buf win 0 (
X (assign_to_key "<Ctrl-G>" "mail_routines")
X (assign_to_key "r" "mail_reply")
X (assign_to_key "R" "mail_reply")
X ))
X (del tmpfile)
X (set_window curwin)
X (set_buffer curbuf)
X (attach_buffer curbuf)
X (translate "[*.]" "*" 0)
X (beginning_of_line)
X (push_back (key_to_int "<Down>"))
X )
X)
X
X/*************************************************************/
X/*
X/* Macro called when user hits <Ctrl-G> for use with
X/* things like mailing lists, where we have lots of small
X/* subjects in one file.
X/*************************************************************/
X(macro mail_routines
X (
X (select_routine "<Subject: "
X "Mail Topics" "mail-routines_trim")
X )
X)
X(macro mail-routines_trim
X (
X (int spos)
X (string routine_name)
X
X (get_parm 0 routine_name)
X
X (= spos (search_string ":" routine_name))
X (if (> spos 0)
X (= routine_name (substr routine_name (+ spos 1))))
X (return (ltrim (trim routine_name)))
X
X )
X)
X
SHAR_EOF
chmod 0444 src/crisp/mail.m || echo "restore of src/crisp/mail.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/makeman.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/makeman.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 ME 1 /* nroff -me */
X# define MM 2 /* nroff -mm */
X# define MS 3 /* nroff -ms */
X
X# define INDEXING TRUE /* Set to FALSE to turn index page generation */
X /* off. */
X/****************************************************************************/
X/*----------------------------------------
X/* Values you need to configure.
X/*----------------------------------------*/
X# define MACROS MM
X# define PAGE_LENGTH ".pl 10.5i" /* European page size. */
X/*# define PAGE_LENGTH "" /* American page size. */
X /* I dont know what goes in here, */
X /* but possibly leaving it blank will */
X /* do. */
X/*----------------------------------------
X/* The ROFF_COMMAND is the troff/nroff
X/* command used to generate the output.
X/* It can contain all the normal shell
X/* syntax characters since it is passed
X/* to the shell. It should NOT contain
X/* any pipe characters.
X/*
X/* This definition is needed so that the
X/* index table can be generated.
X/*----------------------------------------*/
X# define ROFF_COMMAND "troff -Tps -mm"
X
X/*----------------------------------------
X/* Name of file to create containing
X/* nroff/troff source.
X/*----------------------------------------*/
X# define OUTPUT_FILE "/tmp/crispman"
X
X/************************************************************************/
X(macro _init
X (
X (string START_SECTION
X END_SECTION
X LINE_LENGTH
X NEW_PARA
X )
X (global START_SECTION
X END_SECTION
X LINE_LENGTH
X NEW_PARA
X )
X
X (switch MACROS
X ME (nroff_me_macros)
X MM (nroff_mm_macros)
X MS (nroff_ms_macros)
X NULL (
X (error "Must specify -me, -mm or -ms macro package")
X (exit)
X (return)
X )
X )
X )
X)
X(macro nroff_mm_macros
X (
X (= START_SECTION ".H")
X (= END_SECTION ".sp\n")
X (= LINE_LENGTH ".ll 6.5i")
X (= NEW_PARA ".P")
X )
X)
X(macro nroff_me_macros
X (
X (= START_SECTION ".sh")
X (= END_SECTION ".sp\n")
X (= LINE_LENGTH ".ll 6.5i")
X (= NEW_PARA ".lp")
X )
X)
X(macro nroff_ms_macros
X (
X (= START_SECTION ".NH")
X (= END_SECTION ".LP\n")
X (= LINE_LENGTH ".nr LL 6.5i\n.nr LT 6.5i")
X (= NEW_PARA ".LP")
X )
X)
X(macro me_end_processing
X (
X (message "nroff -me Special Processing.")
X (top_of_buffer)
X (translate "^.H " ".sh " ST_GLOBAL)
X (top_of_buffer)
X (translate "^.P$" ".lp" ST_GLOBAL)
X (top_of_buffer)
X (translate "^.PF \"{*}\"$" ".fo \\0" ST_GLOBAL)
X (top_of_buffer)
X (translate "^.PH \"{*}\"$" ".he \\0" ST_GLOBAL)
X )
X)
X(macro ms_end_processing
X (
X (message "nroff -ms Special Processing.")
X (top_of_buffer)
X (translate "^.H {?} \"{*}\"$" ".NH \\0\n\\1\n.LP" ST_GLOBAL)
X (top_of_buffer)
X (translate "^.NH {?} \"{*}\"$" ".NH \\0\n\\1\n.LP" ST_GLOBAL)
X (top_of_buffer)
X (translate "^.P$" ".LP" ST_GLOBAL)
X (top_of_buffer)
X (translate "^.PF *'{*}'{*}'{*}'*$" ".ds LF \\0\n.ds CF \\1\n.ds RF \\2\n" ST_GLOBAL)
X (top_of_buffer)
X (translate "^.PH *'{*}'{*}'{*}'*$" ".ds LH \\0\n.ds CH \\1\n.ds RH \\2\n" ST_GLOBAL)
X )
X)
X//
X// This is a macro to take the CRISP help files, put them into some
X// form of order and convert the files to troff with the .mm files
X// so that the manual can be printed off on a nice printer.
X//
X(macro makeman
X (
X (string buf BHELP index_file)
X (int curbuf)
X (int manbuf)
X (int v old_msg_level)
X
X (= BHELP (+ (inq_environment "BHELP") "/"))
X
X (= old_msg_level (inq_msg_level))
X (set_msg_level 1)
X (= v (version))
X (= curbuf (inq_buffer))
X (= manbuf (create_buffer OUTPUT_FILE NULL 1))
X (set_buffer manbuf)
X (attach_buffer manbuf)
X (clear_buffer)
X
X (read_file (+ BHELP "roff/ms.mac"))
X (read_file (+ BHELP "roff/page1.mm"))
X (save_position)
X (top_of_buffer)
X (translate ".ll 6i" LINE_LENGTH ST_GLOBAL)
X (restore_position)
X
X (sprintf buf ".Fc \"CRISP Reference Manual\" %d.%02d \"May, 1989\"\n"
X (/ v 100) (% v 100))
X (insert buf)
X (read_file (+ BHELP "roff/Intro.mm"))
X
X (chapter_2)
X (chapter_3)
X (chapter_4)
X (chapter_5)
X
X (process_sections)
X (save_position)
X (read_file (+ BHELP "prim/Misc.cmd"))
X (read_file (+ BHELP "prim/A.cmd"))
X (read_file (+ BHELP "prim/B.cmd"))
X (read_file (+ BHELP "prim/C.cmd"))
X (read_file (+ BHELP "prim/D.cmd"))
X (read_file (+ BHELP "prim/E.cmd"))
X (read_file (+ BHELP "prim/F.cmd"))
X (read_file (+ BHELP "prim/G.cmd"))
X (read_file (+ BHELP "prim/I.cmd"))
X (read_file (+ BHELP "prim/K.cmd"))
X (read_file (+ BHELP "prim/L.cmd"))
X (read_file (+ BHELP "prim/M.cmd"))
X (read_file (+ BHELP "prim/N.cmd"))
X (read_file (+ BHELP "prim/O.cmd"))
X (read_file (+ BHELP "prim/P.cmd"))
X (read_file (+ BHELP "prim/Q.cmd"))
X (read_file (+ BHELP "prim/R.cmd"))
X (read_file (+ BHELP "prim/S.cmd"))
X (read_file (+ BHELP "prim/T.cmd"))
X (read_file (+ BHELP "prim/U.cmd"))
X (read_file (+ BHELP "prim/V.cmd"))
X (read_file (+ BHELP "prim/W.cmd"))
X (process_prim)
X
X (end_processing)
X
X (write_buffer)
X
X (make_index)
X
X (write_buffer)
X
X /*----------------------------------------
X /* Now we need to format the manual to
X /* get the index entries.
X /*----------------------------------------*/
X (sprintf buf "sh -cfe '%s %s >%s.roff 2>%s.index'"
X ROFF_COMMAND
X OUTPUT_FILE
X OUTPUT_FILE
X OUTPUT_FILE)
X
X (if INDEXING (
X (message buf)
X (shell buf 1)
X (sprintf index_file "%s.index" OUTPUT_FILE)
X (edit_file index_file)
X (format_index)
X (message buf)
X (sprintf buf "sh -cfe '%s %s.index >>%s.roff'"
X ROFF_COMMAND OUTPUT_FILE OUTPUT_FILE)
X (shell buf 1)
X ))
X
X (message "Finished making manual.")
X
X (delete_buffer manbuf)
X (set_buffer curbuf)
X (attach_buffer curbuf)
X (set_msg_level old_msg_level)
X )
X)
X(macro chapter_2
X (
X (read_file (+ BHELP "roff/Env.mm"))
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Command Line Switches\"\n" END_SECTION))))
X (process_file "env/Switches.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Environment Variables\"\n" END_SECTION))))
X (process_file "env/Env.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Starting Up\"\n" END_SECTION))))
X (process_file "env/Startup.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Details on Keyboard Mappings\"\n" END_SECTION))))
X (process_file "env/Kbd.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Directory Tree\"\n" END_SECTION))))
X (process_file "env/Tree.hlp")
X )
X)
X(macro chapter_3
X (
X (read_file (+ BHELP "roff/Concepts.mm"))
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Anchors, Blocks and Regions\"\n" END_SECTION))))
X (process_file "concept/Blocks.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Text Buffers\"\n" END_SECTION))))
X (process_file "concept/Buffers.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Files\"\n" END_SECTION))))
X (process_file "concept/Files.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Windows\"\n" END_SECTION))))
X (process_file "concept/Windows.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Macros\"\n" END_SECTION))))
X (process_file "concept/Macros.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Process Buffers and PTYs\"\n" END_SECTION))))
X (process_file "concept/Proc.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Regular Expressions\"\n" END_SECTION))))
X (process_file "concept/Regexp.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Registered Macros\"\n" END_SECTION))))
X (process_file "concept/Register.hlp")
X )
X)
X(macro chapter_4
X (
X (read_file (+ BHELP "roff/Features.mm"))
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Displaying List of Active Buffers\"\n" END_SECTION))))
X (process_file "features/Buflist.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Macros for Compiling and Linting .c Files\"\n" END_SECTION))))
X (process_file "features/Compile.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Displaying the current Filename\"\n" END_SECTION))))
X (process_file "features/Filename.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"Macro Interface to GREP\"\n" END_SECTION))))
X (process_file "features/Grep.hlp")
X (insert (+ "\n" (+ START_SECTION
X (+ " 2 \"The Options Menu\"\n" END_SECTION))))
X (process_file "features/Options.hlp")
X (insert (+ "\n" (+ START_SECTION
SHAR_EOF
echo "End of part 3"
echo "File src/crisp/makeman.m is continued in part 4"
echo "4" > s2_seq_.tmp
exit 0
--
===================== Reuters Ltd PLC,
Tel: +44 628 891313 x. 212 Westthorpe House,
UUCP: fox%marlow.uucp at idec.stc.co.uk Little Marlow,
Bucks, England SL7 3RQ
More information about the Comp.sources.misc
mailing list