v07i039: CRISP release 1.9 part 18/32
Brandon S. Allbery - comp.sources.misc
allbery at uunet.UU.NET
Sun Jul 23 09:26:14 AEST 1989
Posting-number: Volume 7, Issue 39
Submitted-by: fox at marlow.UUCP (Paul Fox)
Archive-name: crisp1.9/part19
#!/bin/sh
# this is part 5 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file src/crisp/select.m continued
#
CurArch=5
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/select.m"
sed 's/^X//' << 'SHAR_EOF' >> src/crisp/select.m
X (set_buffer buf)
X (get_parm 1 wild-card)
X (if (|| (== wild-card "") (== wild_card "*")) (
X (insert "../")
X (= nl "\n")
X (= wild-card "*")))
X (file_pattern wild-card)
X
X (while (find_file name size mtime mtime mode) (
X (sprintf tmpbuf "%s%s" name (if (& mode S_IFDIR) "/" ""))
X (insert nl)
X (= nl "\n")
X (insert tmpbuf)
X ))
X (= file "")
X (if (== (inq_lines) 0) (
X (beep)
X )
X ;else
X (
X (= width (inq_line_length))
X (if (< width min_width)
X (= width min_width))
X (sort_buffer)
X (end_of_buffer)
X (insert "\n")
X (+= window_offset 20)
X (= win (sized_window (inq_lines) width ""))
X (-= window_offset 20)
X (= ret (select_buffer buf win NULL NULL NULL
X "help_display \"features/AbbFiles.hlp\" \"Filename Abbreviations\""
X ))
X (if (>= ret 0) (
X (goto_line ret)
X (= file (trim (read)))
X ))
X ))
X (delete_buffer buf)
X (set_buffer curbuf)
X (attach_buffer curbuf)
X (return file)
X )
X)
X/*************************************************************
X/* select_editable
X/*
X/* Allows current buffer to be edited and we return when
X/* <Esc> key is hit.
X/*************************************************************/
X(macro select_editable
X (
X (int old_kbd)
X (string old_escape)
X
X (= old_kbd (inq_keyboard))
X (keyboard_push kbd_normal)
X (= old_escape (inq_assignment "<Esc>"))
X (assign_to_key "<Esc>" "exit")
X (process)
X (assign_to_key "<Esc>" old_escape)
X (keyboard_pop TRUE)
X )
X)
X# define SEL_SELECTED 1 ;* Enter/Space typed.
X# define SEL_ABORTED 2 ;* Escape typed.
X// Usage:
X// (select_list title
X// message_string
X// step
X// list
X// center
X// [help_string]
X// )
X//
X(macro select_list
X (
X (int depth width)
X (list l do_list help_list)
X (int buffer
X old_buffer
X i lines
X step
X win
X old_win
X center
X retval)
X (declare option help_var)
X (string title
X message_string)
X (int menu_level)
X
X (get_parm 0 title)
X (get_parm 1 message_string)
X (get_parm 2 step)
X (get_parm 3 l)
X (get_parm 4 center)
X (get_parm 5 help_var)
X
X ;*
X ;* Save position so that cursor doesn't move to
X ;* the top of the screen when the user has finished
X ;* selecting.
X ;*
X (save_position)
X
X (= old_buffer (inq_buffer))
X (= buffer (create_buffer title NULL 1))
X (set_buffer buffer)
X (= width (+ (strlen title) 4))
X
X (= option "")
X (while (1) (
X (= option (nth (* step depth) l))
X (if (! (is_string option))
X (break))
X (if (> step 1) (
X (put_nth depth do_list (nth (+ (* step depth) 1) l))
X (if (> step 2)
X (put_nth depth help_list (nth (+ (* step depth) 2) l)))
X ))
X (if (> depth 0)
X (insert "\n"))
X (insert option)
X (++ depth)
X ))
X
X (= width (inq_line_length))
X
X (= old_win (inq_window))
X (= win (sized_window (+ (inq_lines) 1) (+ width 2) message_string))
X (+= top_line 2)
X (+= window_offset 6)
X
X (if (! (is_string help_var))
X (= help_var help_list))
X (= retval (select_buffer buffer win center NULL do_list help_var))
X
X (-= top_line 2)
X (-= window_offset 6)
X
X (delete_buffer buffer)
X (set_buffer old_buffer)
X (set_window old_win)
X (attach_buffer old_buffer)
X
X ;*
X ;* Restore position -- leaves cursor in same place
X ;* on screen as when user entered this macro.
X ;*
X (restore_position)
X
X (return retval)
X )
X)
X;*
X;* Macro to select an entry from a buffer (passed as a parameter).
X;* The cursor keys and <Home>, <End> allow movement; typing a letter
X;* looks for a line which matches the character typed.
X;*
X;* This macro returns a number indicating the line in the buffer
X;* selected, or < 0 to indicate the user pressed <Esc> to abort
X;* the selection.
X;*
X;* (macro select_buffer
X;* buf Buffer to make selection from
X;* win Window in which to display buffer.
X;* [center] If non-zero, center each line in the buffer.
X;* key_list List of commands to execute to set up local
X;* keyboard definitions.
X;* [do_list] Action to perform if item is selected (<Enter>).
X;* [help_list] List of macros to call if <Alt-H> typed on menu
X;* item.
X;* )
X(macro select_buffer
X (
X (int old_buf
X old_win
X buf
X number_of_items
X selection
X center
X width
X depth
X retval)
X (list do_list)
X (declare key_list help_list)
X
X (= old_buf (inq_buffer))
X (= old_win (inq_window))
X
X (get_parm 0 buf)
X (get_parm 1 win)
X (get_parm 4 do_list)
X (get_parm 5 help_list)
X
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 (if (&& (get_parm 2 center) center) (
X (= depth 0)
X (= width (inq_line_length))
X (while (<= (++ depth) number_of_items) (
X (insert " " (+ (/ (- width (strlen (read))) 2) 1))
X (down)
X (beginning_of_line)
X ))
X ))
X
X (top_of_buffer)
X (-- number_of_items)
X
X (keyboard_push)
X (keyboard_typeables)
X (assign_to_key "<Alt-H>" "select_help")
X (assign_to_key "<Home>" (quote_list (
X (raise_anchor)
X (move_abs 1 0)
X (drop_anchor 3)
X )))
X (assign_to_key "<End>" (quote_list (
X (raise_anchor)
X (move_abs (inq_lines) 0)
X (drop_anchor 3)
X (refresh)
X (set_bottom_of_window)
X )))
X (assign_to_key "<Up>" (quote_list (
X (raise_anchor)
X (up)
X (drop_anchor 3)
X )))
X (assign_to_key "<Down>" (quote_list (
X (int current_item)
X
X (inq_position current_item)
X (if (<= current_item number_of_items) (
X (raise_anchor)
X (down)
X (drop_anchor 3)
X ))
X )))
X (assign_to_key "<Esc>" (quote_list (
X (= selection SEL_ABORTED)
X (exit)
X )))
X (assign_to_key "<Keypad-minus>" (quote_list (
X (= selection SEL_ABORTED)
X (exit)
X )))
X (assign_to_key "<Alt-P>" "screen_dump")
X
X (if (length_of_list do_list) (
X (assign_to_key "<Space>" "sel_list")
X (assign_to_key "<Enter>" "sel_list")
X )
X ;else
X (
X (assign_to_key "<Space>" "exit")
X (assign_to_key "<Enter>" "exit")
X ))
X (assign_to_key "<PgUp>" (quote_list (
X (raise_anchor)
X (page_up)
X (drop_anchor 3)
X )))
X (assign_to_key "<PgDn>" (quote_list (
X (int line)
X (raise_anchor)
X (page_down)
X (inq_position line)
X (if (> line (inq_lines))
X (goto_line (inq_lines)))
X (drop_anchor 3)
X )))
X
X (drop_anchor 3)
X (get_parm 3 key_list)
X (++ select_nest_level)
X (if (== select_nest_level 1)
X (register_macro REG_TYPED "sel_alpha"))
X
X (process)
X (if (== selection SEL_ABORTED)
X (= retval -1)
X ;else
X (inq_position retval)
X )
X (if (== select_nest_level 1)
X (unregister_macro REG_TYPED "sel_alpha"))
X (-- select_nest_level)
X (raise_anchor)
X (keyboard_pop)
X
X (delete_window)
X (set_window old_win)
X (set_buffer old_buf)
X (attach_buffer old_buf)
X
X (return retval)
X )
X)
X(macro select_help
X (
X (int line)
X (declare macro_name)
X
X (inq_position line)
X
X (if (is_string help_list)
X (= macro_name help_list)
X ;else
X (= macro_name (nth (- line 1) help_list)))
X
X (if (! (is_string macro_name)) (
X (message "Sorry, no help for this topic.")
X (return)))
X (+= top_line 2)
X (execute_macro macro_name)
X (-= top_line 2)
X )
X)
X(macro sel_alpha
X (
X (string char pat)
X (int current_item)
X
X (prev_char)
X (= char (read 1))
X (delete_char)
X (inq_position current_item)
X
X (= pat (+ "<[ ]@" char))
X (move_rel 0 1)
X (if (|| (|| (search_fwd pat) (search_fwd (upper pat)))
X ((top_of_buffer) (|| (search_fwd pat) (search_fwd (upper pat)))) ) (
X (raise_anchor)
X (drop_anchor 3)
X (move_rel 0 -1)
X )
X ;* else
X (move_abs current_item 0)
X )
X )
X)
X(macro sel_list
X (
X (int line)
X (declare function)
X
X (inq_position line)
X (-- line)
X (= function (nth line do_list))
X (if (is_string function) (
X (if (== function "")
X (exit)
X ;else
X (execute_macro function))
X )
X ;else
X (select_list "XYZ" "ABC" 1 function))
X )
X)
X;*
X;* This macro returns a window buffer of a reasonable size for
X;* the terminal. This macro takes into account that we may not be
X;* running on a plain 80x25, and gives us as many lines as will
X;* fit on the screen whilst taking the callers request into account.
X;*
X;* (macro sized_window
X;* lines maximum number of lines wanted.
X;* width width of window.
X;* msg message to appear on the bottom of the
X;* window.
X;* )
X(macro sized_window ;; lines width msg
X (
X (int curwin)
X (int newwin)
X (int lines width)
X (string msg)
X (int screen_lines screen_cols)
X (int lx by rx ty)
X
X (get_parm 0 lines)
X (get_parm 1 width)
X (get_parm 2 msg)
X
X
X (inq_screen_size screen_lines screen_cols)
X (= curwin (inq_window))
X
X (if (< width 0)
X (= width (- screen_cols MARGIN)))
X (= lx (- screen_cols (+ window_offset width)))
X (if (< lx 1)
X (= lx 1))
X (= rx (+ lx width))
X (-- screen_cols)
X (if (> rx screen_cols)
X (= rx screen_cols))
X (= ty top_line)
X (= by (+ ty lines))
X
X (if (> by screen_lines)
X (= by (- screen_lines 2)))
X
X (create_window lx by rx ty msg)
X (= newwin (inq_window))
X (set_window curwin)
X
X (return newwin)
X
X )
X)
X# define TRUE 1
X# define FALSE 0
X
X//
X// Macro to display a list of items and allow the user to toggle
X// the values in the list. The valid values for each item are given
X// in a list-of-lists. This is a primitive but useful forms-entry
X// macro.
X//
X// Usage:
X// (field_list "title to appear on top of window"
X// (list of default values)
X// (list of items and values)
X// )
X//
X// Returns:
X// List of integers indicating which options were selected.
X//
X(macro field_list
X (
X (list arg)
X (int old_buf
X old_win
X buf
X line
X ty)
X (list result)
X (string title)
X (declare option)
X
X
X (= old_buf (inq_buffer))
X (= old_win (inq_window))
X
X (get_parm 0 title)
X (get_parm 1 result)
X (get_parm 2 arg)
X
X (= buf (create_buffer title NULL 1))
X (set_buffer buf)
X
X (= line 0)
X (while (1) (
X (if (! (field_display arg line))
X (break))
X (++ line)
X ))
X (++ line)
X
X (= ty 4)
X (create_window 5 (+ ty line) 60 ty "<Up>, <Down> to select. <Esc> to exit.")
X (attach_buffer buf)
X
X (= line 0)
X (field_display arg line)
X (keyboard_push)
X
X (assign_to_key "<Esc>" "exit")
X (assign_to_key "<Down>" "field_down")
X (assign_to_key "<Up>" "field_up")
X (assign_to_key "<Space>" "field_space")
X (process)
X
X (keyboard_pop)
X (message "")
X
X (delete_window)
X (delete_buffer buf)
X (set_buffer old_buf)
X (return result)
X )
X)
X(macro field_down
X (
X (++ line)
X (field_display arg line)
X )
X)
X(macro field_up
X (
X (if (> line 0) (
X (-- line)
X (field_display arg line)
X ))
X )
X)
X(macro field_space
X (
X (int l n m)
X (declare option)
X
X (= l line)
X (= m (nth l result))
X (= option (nth (+ (* 2 line) 1) arg))
X (if (&& (is_list option) (> (length_of_list option) (+ m 1)))
X (put_nth l result (+ m 1))
X ;else
X (put_nth l result 0)
X )
X (field_display arg l)
X )
X)
X(macro field_display
X (
X (int n ; Index of top-level options.
X m) ; Current option selected.
X (list arg)
X (declare prompt)
X (declare option)
X
X (get_parm 0 arg)
X (get_parm 1 n)
X (= m (nth n result))
X
X (= prompt (nth (* 2 n) arg))
X (if (! (is_string prompt))
X (return FALSE))
X
X (raise_anchor)
X
X (move_abs (+ n 1) 1)
X (delete_line)
X (insert prompt)
X
X (save_position)
X (= option (nth (+ (* 2 n) 1) arg))
X (if (is_string option) (
X (message "Type in new value of option.")
X (insert option)))
X (if (is_list option) (
X (message "Press <Space> to select alternate option.")
X (insert (nth m option))
X ))
X (insert "\n")
X (restore_position)
X (drop_anchor 4)
X (end_of_line)
X
X (return TRUE)
X
X )
X)
X
SHAR_EOF
echo "File src/crisp/select.m is complete"
chmod 0444 src/crisp/select.m || echo "restore of src/crisp/select.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/shell.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/shell.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# define LINE 0
X# define CHAR 1
X
X# define MAX_HISTORY 20
X
X# define LOCAL 1
X
X(macro _init
X (
X (int sh_key_map sh_id)
X (string prompt_regexp)
X (global sh_key_map sh_id prompt_regexp)
X
X (keyboard_push)
X (keyboard_typeables)
X (= sh_key_map (inq_keyboard))
X
X (assign_to_key "<Enter>" "sh_send_line")
X (assign_to_key "<Backspace>" "sh_backspace")
X (assign_to_key "<Ins>" "sh_paste")
X (assign_to_key "<Ctrl-N>" "sh_next_cmd")
X (assign_to_key "<Ctrl-P>" "sh_prev_cmd")
X (keyboard_pop 1)
X
X (= prompt_regexp "^*[:$#%] @\\c")
X )
X)
X(macro ksh
X (create_shell "/bin/ksh" "Korn-Shell-Buffer" (| PF_ECHO PF_NOINSERT))
X)
X(macro sh
X (create_shell "/bin/sh" "Shell-Buffer" (| PF_ECHO PF_NOINSERT))
X)
X(macro csh
X (create_shell "/bin/csh" "Cshell-Buffer" (| PF_ECHO PF_NOINSERT))
X)
X(macro create_shell
X (
X (string shell_path
X tmpbuf
X buffer_name
X sh_newline /* Newline character for buffer. */
X )
X (int sh_start_line ;* Place where input started.
X sh_start_col
X sh_end_line ;* Place where input cursor
X sh_end_col ;* has got to.
X sh_cmd ;* Where to place next command on history
X sh_index ;* Index to current command.
X sh_flags /* Flags for initial connect to pty. */
X sh_mode
X )
X (list sh_history)
X (int sh_buf)
X
X (get_parm 0 shell_path)
X (get_parm 1 buffer_name)
X (get_parm 2 sh_flags)
X
X (if (> (++ sh_id) 1) (
X (sprintf tmpbuf "-%d" sh_id)
X (+= buffer_name tmpbuf)
X ))
X
X (= sh_buf (create_buffer buffer_name NULL 0))
X (set_buffer sh_buf)
X (set_buffer_flags NULL BF_ANSI)
X (attach_buffer sh_buf)
X (inq_names tmpbuf NULL NULL)
X (autosave_disable tmpbuf)
X
X (make_local_variable
X sh_start_line sh_start_col
X sh_end_line sh_end_col
X sh_mode
X sh_index
X sh_cmd
X sh_history
X sh_newline
X sh_flags
X )
X (= sh_cmd 0)
X (= sh_index 0)
X (= sh_mode LINE)
X (= sh_start_line -1)
X /*----------------------------------------
X /* Default newline character is \n but
X /* allow calling macro to override it.
X /*----------------------------------------*/
X (= sh_newline "\n")
X (get_parm 3 sh_newline)
X (register_macro REG_TYPED "sh_insert" LOCAL)
X (connect sh_flags shell_path)
X (use_local_keyboard sh_key_map)
X
X (return sh_buf)
X )
X)
X(macro sh_backspace
X (
X (int line col)
X
X (if (== sh_mode CHAR) (
X (insert_process "\x8")
X; (self_insert)
X (return)))
X
X (backspace)
X )
X)
X(macro sh_insert
X (
X (int line col)
X (string line_buf)
X
X (if (== sh_mode CHAR) (
X (prev_char)
X (insert_process (read 1))
X (if (& sh_flags PF_ECHO)
X (next_char)
X /* else */
X (delete_char))
X (return)))
X
X (if (< sh_start_line 0) (
X (inq_position sh_start_line sh_start_col)
X (-- sh_start_col)
X (return)))
X )
X)
X(macro sh_char_mode
X (
X (connect 0)
X (= sh_mode CHAR)
X )
X)
X(macro sh_line_mode
X (
X (connect (| PF_ECHO PF_NOINSERT))
X (= sh_mode LINE)
X )
X)
X(macro sh_next_cmd
X (sh_recall sh_index 1)
X)
X(macro sh_prev_cmd
X (sh_recall sh_index -1)
X)
X(macro sh_recall
X (
X (int n inc)
X (declare atom)
X
X (if (== sh_mode CHAR) (
X (self_insert)
X (return)))
X
X (get_parm 0 n)
X (get_parm 1 inc)
X (+= n inc)
X
X (if (< n 0)
X (= n (- MAX_HISTORY 1))
X )
X (if (>= n MAX_HISTORY)
X (= n 0)
X )
X
X (= atom (nth n sh_history))
X (if (! (is_string atom)) (
X (= atom "")
X (get_parm 0 n)
X ))
X (if (>= sh_start_line 0) (
X (move_abs sh_start_line sh_start_col)
X (delete_to_eol)
X ))
X
X (inq_position sh_start_line sh_start_col)
X; (unregister_macro 0 "sh_insert")
X (insert atom)
X
X (= sh_index n)
X )
X)
X(macro sh_paste
X (
X (if (< sh_start_line 0) (
X (inq_position sh_start_line sh_start_col)
X; (unregister_macro 0 "sh_insert")
X ))
X (paste)
X (sh_insert)
X )
X)
X(macro sh_send_line
X (
X (string line)
X (int l c pl pc)
X
X (if (== sh_mode CHAR) (
X (end_of_buffer)
X (insert "\n")
X (inq_position l c)
X (set_process_position l c)
X (insert_process sh_newline)
X (return)))
X
X ;*
X ;* Try and locate where line came from. If on
X ;* last line of buffer, then we can believe the
X ;* sh_start_col field, otherwise we try and strip
X ;* off the possible prompt at the beginning of the
X ;* line.
X ;*
X (inq_process_position pl pc)
X (inq_position l c)
X (if (== l pl) (
X (move_abs 0 (+ pc 0))
X (= line (read))))
X
X (= line (ltrim (trim line)))
X
X (if (!= line "") (
X (put_nth sh_cmd sh_history line)
X (++ sh_cmd)
X (if (>= sh_cmd MAX_HISTORY)
X (= sh_cmd 0))
X (= sh_index sh_cmd)
X ))
X
X (= sh_start_line -1)
X (end_of_buffer)
X (insert "\n")
X (inq_position l c)
X (set_process_position l c)
X (insert_process (+ line "\n"))
X )
X)
X
X
SHAR_EOF
chmod 0444 src/crisp/shell.m || echo "restore of src/crisp/shell.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/startup.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/startup.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 startup
X (
X (autosave)
X (autoindent "y")
X )
X)
SHAR_EOF
chmod 0444 src/crisp/startup.m || echo "restore of src/crisp/startup.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/stest.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/stest.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// This macro file is used to exercise the regular expression
X// parser. The macro (search_test) is called with a pattern, a
X// string to match and a start and length count. A (string_search)
X// is performed and if the results aren't the expected ones,
X// we've boobed somewhere.
X//
X// A start offset of zero means the search should fail.
X(macro search
X (
X (int passed failed test)
X
X (= passed 0)
X (= failed 0)
X (= test 0)
X
X (search_test "xyz" "xyz" 1 3)
X (search_test "x*z" "xyz" 1 3)
X (search_test "<x*z" "xyz" 1 3)
X (search_test "<x*z" "xyz" 1 3)
X (search_test "x?z" "xyz" 1 3)
X (search_test "x?a" "xyz" 0 3)
X (search_test "xyz>" "xyz" 1 3)
X (search_test "x[y]z>" "xyz" 1 3)
X (search_test "x[^y]z>" "xyz" 0 3)
X (search_test "x[y]+z>" "xyz" 1 3)
X (search_test "x[y]@z>" "xyz" 1 3)
X (search_test "x{[y]|x}@z>" "xyz" 1 3)
X (search_test "x{[y]|x|a}@z>" "xyz" 1 3)
X (search_test "x{[y]|x|a+}@z>" "xyz" 1 3)
X (search_test "x{[y]|x|{a}+}@z>" "xyz" 1 3)
X (search_test "([^)]@)" "(hello)" 1 7)
X (search_test "([^)]@*)" "(hello)" 1 7)
X (search_test "([^)]+*)" "(hello)" 1 7)
X (message "Passed: %d Failed: %d" passed failed)
X )
X)
X(macro search_test
X (
X (string pat str buf)
X (int start length s len)
X
X (get_parm 0 pat)
X (get_parm 1 str)
X (get_parm 2 start)
X (get_parm 3 len)
X (= s (search_string pat str length))
X (if (&& (== s 0) (== start 0)) (
X (++ passed)
X (return)
X ))
X (if (|| (!= s start) (!= len length)) (
X (++ failed)
X (sprintf buf "Test %d: ('%s' '%s' %d %d)" test pat str start len)
X (insert buf)
X (sprintf buf "==> (%d %d)\n" s length)
X (insert buf)
X )
X ;else
X (++ passed))
X )
X)
SHAR_EOF
chmod 0444 src/crisp/stest.m || echo "restore of src/crisp/stest.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/tags.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/tags.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 tags
X (tag)
X)
X(macro tag
X (
X (string function
X sstring)
X (int tag_buf
X old_buf)
X
X (get_parm 0 function "Function: ")
X (= old_buf (inq_buffer))
X (= tag_buf (create_buffer "Tags" "tags" 1))
X (set_buffer tag_buf)
X (top_of_buffer)
X (sprintf sstring "^%s" function)
X (if (search_fwd sstring)
X (
X (string line file pattern)
X (int i j)
X (= line (read))
X (= i (+ (search_string "\t" line) 1) )
X (= j (- (search_string "[?/]" line) 1))
X (= file (substr line i (- j i) ))
X (edit_file file)
X (top_of_buffer)
X (+= j 2)
X (= i (- (- (strlen line) j) 1))
X (= pattern (substr line j i))
X (if (<= (search_fwd pattern) 0)
X (error "Function not found.")
X )
X )
X ;else
X (
X (error "Function %s not found." function)
X (set_buffer old_buf)
X )
X )
X )
X)
X(macro tag_function
X (
X (string function)
X (int i)
X
X (save_position)
X (search_back "<|{[~_A-Za-z0-9]\\c}")
X (= function (ltrim (trim (read))))
X (= i (search_string "[~_A-Za-z0-9]" function NULL ST_REGEXP))
X (if (> i 0)
X (= function (substr function 1 (- i 1))))
X (restore_position)
X (if (== function "") (
X (beep)
X (return)
X ))
X (tag function)
X )
X)
X(macro mtags
X (
X (int curbuf
X buf)
X (= curbuf (inq_buffer))
X (message "Creating .m tags file.")
X (= buf (perform_unix_command "grep '^(macro' *.m | awk '{printf \"%s\t%s\\n\",$2,$0}' | sort" ""))
X (set_buffer buf)
X (top_of_buffer)
X (translate ":" " /^" ST_GLOBAL)
X (top_of_buffer)
X (translate "$" "$/" ST_GLOBAL)
X (write_buffer "tags")
X (set_buffer curbuf)
X (message "'tags' file created.")
X )
X)
SHAR_EOF
chmod 0444 src/crisp/tags.m || echo "restore of src/crisp/tags.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/telnet.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/telnet.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 * Macro to allow telnet/rlogin to a host. Very simple minded at *
X * the moment. *
X ********************************************************************/
X
X# include "crisp.h"
X
X(macro telnet
X (
X (string host)
X (if (== (get_parm 0 host) 0)
X (= host (get_host_entry)))
X (if (== host "")
X (return))
X (telnet_rlogin "telnet" host)
X )
X)
X(macro rlogin
X (
X (string host)
X (if (== (get_parm 0 host) 0)
X (= host (get_host_entry)))
X
X (if (== host "")
X (return))
X (telnet_rlogin "rlogin" host)
X )
X)
X(macro telnet_rlogin
X (
X (string prog host cmd)
X
X (get_parm 0 prog)
X (get_parm 1 host)
X (create_shell "/bin/sh" (+ host "-Buffer") PF_NOINSERT "\r")
X (= cmd (+ prog (+ " " (+ host "\n"))))
X (insert cmd)
X (insert_process cmd)
X (sh_char_mode)
X (refresh)
X )
X)
X/*****************************************
X/* Macro to select an entry from the
X/* /etc/hosts file.
X/*****************************************/
X(macro get_host_entry
X (
X (int curbuf
X buf
X win
X line_no
X )
X (string host)
X
X (message "Press <Enter> to select a host.")
X (= curbuf (inq_buffer))
X (= buf (create_buffer "Remote Hosts" "/etc/hosts" 1))
X (set_buffer buf)
X
X /*----------------------------------------
X /* Delete comment lines.
X /*----------------------------------------*/
X (top_of_buffer)
X (while (> (search_fwd "^#|$") 0)
X (delete_line))
X (top_of_buffer)
X (translate "^[0-9A-Fa-fxX.]+[ \t]+{[-a-zA-Z0-9.]+}$|{[ \t#]*$}" "\\0" ST_GLOBAL)
X (sort_buffer)
X (= win (sized_window (inq_lines) 20 ""))
X (= line_no (select_buffer buf win NULL NULL NULL ""))
X (if (>= line_no 0)
X (= host (trim (ltrim (read)))))
X
X (delete_buffer buf)
X (set_buffer curbuf)
X (attach_buffer curbuf)
X (message "")
X (return host)
X )
X)
SHAR_EOF
chmod 0444 src/crisp/telnet.m || echo "restore of src/crisp/telnet.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/text.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/text.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 (int grep_buf
X grep_line_no
X spell_buf
X spell_line_no)
X (string grep_old_file)
X (global grep_buf
X grep_line_no
X grep_old_file
X spell_buf
X spell_line_no)
X
X (= grep_buf (create_buffer "GREP-Buffer" NULL 0))
X (= grep_line_no 1)
X )
X)
X;*
X;* Macro to report how many words in current buffer, and
X;* display average word length.
X;*
X(macro wc
X (
X (string tmp_file ;* Current buffer contents.
X buf)
X (int curbuf
X tmp_buf
X num_words
X num_chars)
X
X (save_position)
X
X (top_of_buffer)
X (drop_anchor MK_LINE)
X (end_of_buffer)
X
X (sprintf tmp_file "/tmp/gr.wc%d" (getpid))
X (write_block tmp_file)
X (sprintf buf "wc -wc %s" tmp_file)
X (message "Counting number of words...")
X (= tmp_buf (perform_unix_command buf "wc-buffer"))
X
X (= curbuf (inq_buffer))
X (set_buffer tmp_buf)
X (end_of_buffer)
X (beginning_of_line)
X (search_fwd "[0-9]")
X (= num_words (atoi (read)))
X (search_fwd " \\c[0-9]")
X (= num_chars (atoi (read)))
X
X (message "Words: %d Avg. len: %d" num_words (/ num_chars num_words))
X
X (del tmp_file)
X
X (set_buffer curbuf)
X (delete_buffer tmp_buf)
X (attach_buffer curbuf)
X (restore_position)
X )
X)
X;*
X;* Macro to perform a grep and display buffers at location
X;* of matched strings.
X;*
X(macro grep
X (
X (string buf
X pattern
X msg
X files)
X (int curbuf
X grep_win
X num_lines
X line
X )
X
X (= curbuf (inq_buffer))
X
X (get_parm 0 pattern "GREP pattern: ")
X (= pattern (trim (ltrim pattern)))
X (if (== pattern "")
X (return))
X (get_parm 1 files "GREP files: ")
X
X (sprintf buf "grep -n %s %s /dev/null" pattern files)
X (message "Locating text...")
X (assign_to_key "<Ctrl-N>" "grep_next")
X (assign_to_key "<Ctrl-P>" "grep_prev")
X (= grep_buf (perform_unix_command buf "GREP-Buffer" grep_buf))
X (message "")
X
X (set_buffer grep_buf)
X (end_of_buffer)
X (insert "\n")
X (top_of_buffer)
X (= num_lines (inq_lines))
X /*----------------------------------------
X /* Dont let autosave and the exit code know
X /* we changed the buffer.
X /*----------------------------------------*/
X (set_buffer_flags (~ BF_CHANGED))
X (set_buffer curbuf)
X
X (if (<= num_lines 1) (
X (error "No matching lines found.")
X (return)))
X
X (= msg (+ (key_label "<Alt-E>") " to edit, <Enter> to select, <Esc> to quit."))
X (= grep_win (sized_window num_lines -1 msg))
X
X (= grep_line_no (select_buffer grep_buf grep_win NULL
X (
X (assign_to_key "<Alt-E>" "grep_edit")
X )
X NULL
X "help_display \"features/Grep.hlp\" \"Help on Grep Window\""
X ))
X (if (< grep_line_no 0) (
X (return)))
X
X (grep_display)
X )
X)
X(macro grep_edit
X (
X (string answer)
X
X (raise_anchor)
X (while 1 (
X (message "Type <Esc> to terminate translate mode.")
X (select_editable)
X (= answer (prompt_ync "GREP translate/continue/abort ? " "tca"))
X (if (!= answer "c")
X (break))
X ))
X (if (== answer "t")
X (grep_translate))
X
X )
X)
X(macro prompt_ync
X (
X (string msg
X responses
X answer)
X
X (get_parm 0 msg)
X (get_parm 1 responses)
X (= answer "9")
X (while (== (index responses answer) 0) (
X (get_parm NULL answer msg 1)
X (= answer (lower answer))
X ))
X (return answer)
X )
X)
X(macro grep_translate
X (
X (int line
X i j
X buf
X line_no)
X (string lbuf
X filename)
X
X (= buf (inq_buffer))
X (top_of_buffer)
X (= line 1)
X
X (while (< line (inq_lines)) (
X (= lbuf (read))
X (= i (index lbuf ":"))
X (= filename (substr lbuf 1 (- i 1)))
X (= lbuf (substr lbuf (+ i 1)))
X (= j (index lbuf ":"))
X (= line_no (atoi (substr lbuf 1 (- j 1))))
X (= lbuf (substr lbuf (+ j 1)))
X (edit_file filename)
X (move_abs line_no 0)
X (delete_line)
X (insert lbuf)
X (message "File='%s' line=%d" filename line_no)
X (set_buffer buf)
X (++ line)
X (down)
X ))
X (attach_buffer buf)
X )
X)
X
X(macro grep_next
X (
X (++ grep_line_no)
X (grep_display)
X )
X)
X(macro grep_prev
X (
X (-- grep_line_no)
X (grep_display)
X )
X)
X(macro grep_display
X (
X (string pattern
X files
X text
X filename
X )
X (int lines
X colon
X curbuf
X line_no
X )
X
X (= curbuf (inq_buffer))
X (set_buffer grep_buf)
X (= lines (inq_lines))
X
X (if (|| (< grep_line_no 1) (>= grep_line_no lines)) (
X (= grep_line_no 1)
X (message "No more matching lines.")
X (return)))
X
X (move_abs grep_line_no 1)
X (= text (read))
X
X (= colon (index text ":"))
X (= filename (substr text 1 (- colon 1)))
X (= line_no (atoi (substr text (+ colon 1))))
X (if (== filename grep_old_file)
X (set_buffer curbuf)
X ;else
X (
X (edit_file filename)
X (top_of_buffer)
X (= grep_old_file filename)
X ))
X (move_abs line_no 1)
X (message "<Ctrl-P> previous match, <Ctrl-N> next match.")
X )
X)
X;*
X;* Macro to perform spell on the current buffer, and then allow user
X;* to move from word to word.
X;*
X(macro spell
X (
X (string tmp_file
X buf)
X (int curbuf
X num_lines)
X
X (= curbuf (inq_buffer))
X
X (top_of_buffer)
X (drop_anchor MK_LINE)
X (end_of_buffer)
X
X (sprintf tmp_file "/tmp/gr.sp%d" (getpid))
X (write_block tmp_file)
X (sprintf buf "spell -b %s" tmp_file)
X (message "Checking for mis-spelled words...")
X (= spell_buf (perform_unix_command buf "wc-buffer"))
X
X (del tmp_file)
X
X (set_buffer spell_buf)
X (end_of_buffer)
X (insert "\n")
X (top_of_buffer)
X (= num_lines (inq_lines))
X (set_buffer curbuf)
X
X (if (<= num_lines 1) (
X (error "No spelling mistakes.")
X (return)))
X
X (= spell_line_no 0)
X
X (assign_to_key "<Ctrl-N>" "spell_next")
X (assign_to_key "<Ctrl-P>" "spell_prev")
X (spell_next)
X
X )
X)
X(macro spell_next
X (
X (while (>= (spell_display (+ spell_line_no 1)) 0)
X (continue))
X )
X)
X(macro spell_prev
X (
X (while (>= (spell_display (- spell_line_no 1)) 0)
X (continue))
X )
X)
X;*
X;* macro to display next incorrect word on screen and allow
X;* user to type in a correction.
X;*
X;* macro returns -1 if an error occurs;
X;* 0 user doesnt want to correct word
X;* 1 user corrected word.
X;*
X(macro spell_display
X (
X (int curbuf
X word_no)
X (string word
X new_word
X buf)
X
X (get_parm 0 word_no)
X (if (<= word_no 0)
X (= word_no 1))
X
X (= curbuf (inq_buffer))
X
X //
X // Read next word from list.
X //
X (set_buffer spell_buf)
X (goto_line word_no)
X (= spell_line_no word_no)
X (= word (trim (ltrim (compress (read)))))
X (set_buffer curbuf)
X
X (if (== word "") (
X (message "No further words to correct.")
X (return -1)))
X
X //
X // Now get word onto screen and let user decide to translate
X // word.
X //
X (top_of_buffer)
X (sprintf buf "Correct '%s': " word)
X (message "Searching for '%s'..." word)
X (search_fwd word 0)
X (drop_anchor MK_NORMAL)
X (right (strlen word))
X (set_center_of_window)
X (refresh)
X
X (if (<= (get_parm NULL new_word buf NULL word) 0) (
X (message "<Ctrl-N>/<Ctrl-P> checks next or previous word.")
X (left (strlen word))
X (raise_anchor)
X (return -1)))
X
X (message "")
X (left (strlen word))
X (raise_anchor)
X
X (if (|| (== new_word "") (== new_word word))
X (return 0))
X (translate word new_word NULL 0 1)
X (return 1)
X )
X)
SHAR_EOF
chmod 0444 src/crisp/text.m || echo "restore of src/crisp/text.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/tty.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/tty.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;* This is the default terminal description file. It is used if
X;* we cannot find a tty-$BTERM.m file to load.
X;*
X
X# include "tty.h"
X
X(macro _init
X (
X ;*
X ;* Set characters used for extended graphics support when
X ;* drawing windows.
X ;*
X (set_term_characters
X '+' ;* Top left of window.
X '+' ;* Top right of window.
X '+' ;* Bottom left of window.
X '+' ;* Bottom right of window.
X '|' ;* Vertical bar for window sides.
X '-' ;* Top and bottom horizontal bar for window.
X NULL ;* Top join.
X NULL ;* Bottom join.
X NULL ;* Window 4-way intersection.
X NULL ;* Left hand join.
X NULL ;* Right hand join.
X )
X ;*
X ;* Define escape sequences used for special optimisations on
X ;* output.
X ;*
X (set_term_features
X NULL ;* Sequence to clear 'n' spaces.
X NULL ;* Sequence to print characters with top
X ;* bit set.
X NULL ;* Insert-mode cursor.
X NULL ;* Overwrite-mode cursor.
X NULL ;* Insert-mode cursor (on virtual space).
X NULL ;* Overwrite-mode cursor (on virtual space).
X NULL ;* Print ESCAPE character graphically.
X NULL ;* Escape sequence to repeat last character.
X FALSE ;* ESC [0m resets color.
X FALSE ;* Terminal does not supports color.
X )
X ;*
X ;* Define keyboard layout for non-ascii characters.
X ;* (These can only be used for the console).
X ;*
X (set_term_keyboard
X F1-F12
X (quote_list "\x1BOP" "\x1BOQ" "\x1BOR" "\x1BOS" "\x1BOT"
X "\x1BOU" "\x1BOV" "\x1BOW" "\x1BOX" "\x1BOY"
X "\x1BOZ" "\x1BO[" )
X
X SHIFT-F1-F12
X (quote_list "\x1BOp" "\x1BOq" "\x1BOr" "\x1BOs" "\x1BOt"
X "\x1BOu" "\x1BOv" "\x1BOw" "\x1BOx" "\x1BOy"
X "\x1BOz" "\x1BO{" )
X CTRL-F1-F12
X (quote_list "\x1BO\x10" "\x1BO\x11" "\x1BO\x12" "\x1BO\x13" "\x1BO\x14"
X "\x1BO\x15" "\x1BO\x16" "\x1BO\x17" "\x1BO\x18" "\x1BO\x19"
X "\x1BO\x1a" "\x1BO\x1B" )
X
X ;*
X ;* We map the useful ALT-keys into CTRL-key equivalents,
X ;*
X ;*
X ALT-A-Z
X (quote_list "\x01" "\x02" "\x03" "\x04" "\x05" ;* ALT-A..E
X "\x06" "\x07" NULL "\x09" "\x0a" ;* ALT-F..J
X "\x0b" "\x0c" NULL "\x0e" "\x0f" ;* ALT-K..O
X "\x10" "\x11" "\x12" "\x13" "\x14" ;* ALT-P..T
X "\x15" NULL "\x17" "\x18" "\x19" ;* ALT-U..Y
X "\x1a")
X KEYPAD-0-9
X (quote_list "\x1B[@" "\x1B[Y" "\x1B[B" "\x1B[U" "\x1B[D"
X "\x1B[G" "\x1B[C" "\x1B[H" "\x1B[A" "\x1B[V")
X CTRL-KEYPAD-0-9
X (quote_list "\x1B?0" "\x1B?1" "\x1B?2" "\x1B?3" "\x1B?4"
X "\x1B?5" "\x1B?6" "\x1B?7" "\x1B?8" "\x1B?9")
X ALT-0-9
X (quote_list "\x1BN0" "\x1BN1" "\x1BN2" "\x1BN3" "\x1BN4"
X "\x1BN5" "\x1BN6" "\x1BN7" "\x1BN8" "\x1BN9")
X CUT "\x1B[S"
X COPY "\x1B[T"
X BACK-TAB "\x1B[Z"
X )
X ;*
X ;* Following are useful ways to access the BRIEF default CTRL-keys.
X ;* (We cant do these direct because we substituted the ALT-keys
X ;* above).
X (assign_to_key "^V^B" "to_bottom")
X (assign_to_key "^V^C" "center_line")
X (assign_to_key "^V^D" "screen_down")
X (assign_to_key "^V^G" "macros")
X (assign_to_key "^V^H" "help")
X (assign_to_key "^V^J" "goto_bookmark")
X (assign_to_key "^V^K" "delete_previous_word")
X (assign_to_key "^V^L" "delete_next_word")
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" "to_top")
X (assign_to_key "^V^U" "screen_up")
X (assign_to_key "^V^V" "version")
X (assign_to_key "^V^W" "set_backup")
X )
X)
SHAR_EOF
chmod 0444 src/crisp/tty.m || echo "restore of src/crisp/tty.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/unix.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/unix.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 to execute a unix command and read the output into
X * a buffer. The allocated buffer is returned.
X *
X * (perform_unix_command
X * cmd - Unix command to execute.
X * header - Header to display at top of window.
X * [buf] - If specified name of existing buffer to
X * apply command to otherwise, create a new one.
X * )
X **************************************************************/
X(macro perform_unix_command
X (
X (string cmd
X header
X file
X bufnam
X )
X (int tmp_buf curbuf)
X
X (get_parm 0 cmd)
X (get_parm 1 header)
X
X (= curbuf (inq_buffer))
X (sprintf file "/tmp/GR.%d" (getpid))
X
X (shell (+ cmd (+ ">" file)) 1)
X
X (if (> (get_parm 2 tmp_buf) 0) (
X (set_buffer tmp_buf)
X (clear_buffer)
X (read_file file)
X (top_of_buffer)
X (set_buffer curbuf))
X ;else
X (= tmp_buf (create_buffer header file 1)))
X (del file)
X (set_buffer curbuf)
X (return tmp_buf)
X )
X)
X
SHAR_EOF
chmod 0644 src/crisp/unix.m || echo "restore of src/crisp/unix.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/welcome.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/welcome.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;* Macro to display latest news information.
X;*
X# define WELCOME 3
X
X(macro welcome
X (
X (string space line tmp)
X (int old_buf)
X (int buf)
X
X (= old_buf (inq_buffer))
X (edit_file "~/.crisp")
X (= buf (inq_buffer))
X (= line (read))
X (if (|| (== line "")
X (< (atoi line) WELCOME)) (
X (int buf1)
X (edit_file "/usr/local/crisp/src/crisp/welcome.h")
X (= buf1 (inq_buffer))
X (refresh)
X (get_parm NULL space "Press any key to continue." 1)
X (delete_buffer buf1)
X (set_buffer buf1)
X (delete_line)
X (sprintf tmp "%d\n" WELCOME)
X (insert tmp)
X (write_buffer)
X ))
X (delete_buffer buf)
X (set_buffer old_buf)
X )
X)
SHAR_EOF
chmod 0444 src/crisp/welcome.m || echo "restore of src/crisp/welcome.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/window.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/window.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;* CRISP - Good Riddance to Interactive Editing Facilities
X;*
X;* (C) Paul Fox, 1988
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;* File containing various utility routines for manipulating
X;* windows.
X;**************************************************************/
X
X;*
X;* Macro to move current line to top of window.
X;*
X(macro set_top_of_window
X (
X (int cur_line)
X (inq_position cur_line)
X
X (set_top_left cur_line)
X )
X)
X;*
X;* Macro to move current line to bottom of window if its
X;* possible. If buffer size < size of window, then we make
X;* first line of buffer at top of window.
X;*
X(macro set_bottom_of_window
X (
X (int cur_line)
X (inq_position cur_line)
X
X (if (<= (inq_lines) (inq_window_size))
X (set_top_left 1)
X ;else
X (set_top_left (+ (- cur_line (inq_window_size)) 1))
X )
X )
X)
X;*
X;* Macro to move current line to center of window (if possible).
X;*
X(macro set_center_of_window
X (
X (int cur_line)
X
X (inq_position cur_line)
X (set_top_left (- cur_line (/ (inq_window_size) 2)))
X )
X)
X
SHAR_EOF
chmod 0444 src/crisp/window.m || echo "restore of src/crisp/window.m fails"
mkdir src src/crisp >/dev/null 2>&1
echo "x - extracting src/crisp/wp.m (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/crisp/wp.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 ********************************************************************/
SHAR_EOF
echo "End of part 5"
echo "File src/crisp/wp.m is continued in part 6"
echo "6" > 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