/usr/lib/s9fes/arse.porting is in scheme9 2010.11.13-2.
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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | ARSE is mostly written in portable R4RS Scheme but, of
course, there are some portions that cannot be done portably.
This is a summary of the parts that will have to be adapted
in order to port ARSE to a different Scheme environment.
The ARSE source code consists of about 4000 lines of S9fES
code that expand to about 7500 lines of more or less portable
R4RS Scheme code when resolving the library dependencies.
This can be done automatically with the S9RESOLVE program
(prog/) or by including the files listed in the LOAD-FROM-LIBRARY
statements at the beginning of the program manually. (Of
course, you have to do this recursively, because included
files may -- and more than often will -- contain additional
LOAD-FROM-LIBRARY statements.)
HINT: If you want to know what a certain S9fES extension
procedure does, just load the ARSE source code into ARSE,
move the cursor on the procedure name in question and press
[=][h]. This will load the description of the procedure
into the help buffer.
----- SYNTAX-RULES ---------------------------------------------
There are two minor macros (SWAP! and CTL) in the code that use
SYNTAX-RULES. SWAP can easily be expanded in situ, CTL can be
turned into a function with little loss of performance.
----- STRUCTURES -----------------------------------------------
ARSE uses the S9fES DEFINE-STRUCTURE syntax, which is probably
not portable. So you will have to use an alternative structure
syntax or use a vector and create the corresponding setters
and getters manually. The buffer (BUF) is the only structure
used in ARSE.
----- SEMI-PORTABLE EXTENSION PROCEDURES -----------------------
ARSE uses a few extension procedures that are included in
source form in the S9fES package but use extension procedures
internally. So you will probably have to rewrite some of
these procedures:
FIND-HELP-PATH (recommended) Used to locate the S9fES help
pages. When in a hurry, you may just hardwire the path.
FLUSH-OUTPUT-PORT (required) Used to send output to the
REPL.
SEARCH-PATH (required) Used to locate the Scheme interpreter.
SPAWN-COMMAND (required) Used to run the Scheme interpreter.
SPAWN-SHELL-COMMAND (recommended) Used to run filters ([!]
command).
----- CURSES ---------------------------------------------------
Because ARSE is a screen editor, you will, of course, need
some means of cursor addressing. ARSE uses the S9fES Curses
extension to achieve this. The procedures for cursor
addressing are factored out cleanly and listed at the
beginning of the code. None of these procedures are really
optional.
----- SYSTEM PROCEDURES ----------------------------------------
First of all: ARSE relies on the underlying Scheme system to
ignore SIGPIPE as it will happily send REPL input over a broken
pipe. So catch it if you can.
CHMOD (optional) Used to preserve the mode of the edited
file when saving a buffer.
DIRECTORY? (optional) Used by the directory browser to check
whether a file is regular or a directory. If this is hard
to do, just comment out the call to the directory browser.
ERRNO and ERRNO->STRING (optional) Used for error reporting.
FD-CREAT (optional) Used to test whether a file can be
created.
FD-SELECT and FD-READ (required) Used to read input from
the REPL. Because the REPL may stall (e.g. when feeding
it a single opening parenthesis), it has to be read using
read(2) and select(2). Without these the Scheme process
will not work reliably.
GETCWD (optional) Used by the directory browser.
GETENV (required) Used to read the HOME and PATH environment
variables.
GETPID (optional) Used to generate a unique file name.
Probably easy to work around.
MAKE-OUTPUT-PORT (required) Wraps a Scheme output port
around a naked file descriptor. Required to communicate
with the Scheme process.
MODE->STRING (optional) Used by the directory browser.
READ-DIRECTORY (optional) Used by the directory browser.
REMOVE-FILE and RENAME-FILE (required) Used to save buffers.
RUN-SHELL-COMMAND (optional) Used for shell escapes
(:!command).
SEND-SIGNAL (optional) Used to make sure that the REPL goes
down when disconnecting the Scheme process.
STAT-FILE (optional) Used to preserve the file mode when
saving a buffer. Also used in the directory browser.
UNIX-TIME (optional) Used to generate a unique symbol.
Probably easy to work around.
WAIT-FOR-PROCESS (recommended) Used to disconnect the Scheme
process gracefully. Without it, zombies will be left in the
process space.
----------------------------------------------------------------
That's about it I guess. Good luck!
|