/usr/share/jed/lib/maple.sl is in jed-common 1:0.99.19-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
custom_variable ("Maple_Program", "maple");
custom_variable ("Maple_Prompt_Regexp", "^[a-zA-Z]*>");
variable Maple_Pid = -1;
define maple_send_input ()
{
variable buf;
variable this_line, mark_line;
variable m, len;
m = process_mark (Maple_Pid);
this_line = what_line ();
push_mark ();
goto_user_mark (m);
mark_line = what_line ();
if (this_line >= mark_line)
{
% Cursor is after point of last output. Just send everything
% from last output to end of buffer.
pop_mark_0 ();
push_mark_eob ();
buf = bufsubstr ();
}
else
{
% it looks like user wants to re-run this line. Fine.
pop_mark_1 ();
eol ();
push_mark ();
len = re_bsearch (Maple_Prompt_Regexp);
!if (len)
{
pop_mark_0 ();
return;
}
go_right (len - 1);
buf = bufsubstr ();
eob ();
insert (buf);
}
newline ();
move_user_mark (m);
send_process (Maple_Pid, strcat (buf, "\n"));
}
$1 = "MapleMap";
!if (keymap_p ($1)) make_keymap ($1);
definekey ("maple_send_input", "^M", $1);
define maple_signal_handler (pid, flags, status)
{
variable msg;
eob ();
msg = aprocess_stringify_status (pid, flags, status);
vinsert ("\n\n----- %s ------\n\n", msg);
if (flags != 2)
Maple_Pid = -1;
}
define maple_insert_output (pid, str)
{
eob ();
push_spot ();
insert (str);
pop_spot ();
bol ();
replace ("\r", Null_String);
eob ();
move_user_mark (process_mark (pid));
}
define maple ()
{
variable buf = "*maple*";
variable arg, nargs = 0;
if ((Maple_Pid != -1) and bufferp (buf))
{
error ("Currently, only one maple process is supported.");
}
pop2buf (buf);
use_keymap ("MapleMap");
run_mode_hooks ("maple_mode_hook");
erase_buffer ();
% parse possible arguments
forever
{
arg = extract_element (Maple_Program, nargs, ' ');
if (arg == NULL)
break;
nargs++;
arg; % push on stack
}
nargs - 1; % push on stack
Maple_Pid = open_process ();
set_process (Maple_Pid, "signal", "maple_signal_handler");
set_process (Maple_Pid, "output", "maple_insert_output");
}
|