"pathname" |
First element is character other than #\< #\> #\|Treat entire string as a path name of file. If a file with the given name already exists on output procedure, the result is unspecified. |
"<pathname" |
First element is #\<Valid on input procedure. Treat susbstring starting from the second character as a path name of file. |
">pathname" |
First element is #\> and second is not #\>Valid on output procedure. Treat substring starting from the second character as a path name of file. If a file with the given name already exists, overwrite it. |
">>pathname" |
First element is #\> and second is #\>Valid on output procedure. Treat substring starting from the third character as a path name of file. If a file with the given name already exists, append to it. |
"|command" |
Frist element is #\|Treat substring starting from the second character as a command string. On input procedure, resulting port inputs from its standard output. On output procedure, resulting port outputs to its standard input. Exit status can be retrieved by rp:file-status (see below.) |
Because whether the string is for input or for output is determined by the
procedure it is supplied for, pipe symbol is always put on the head. Notice
that the syntax is different from that in perl in this point.
General
(gensym) procedure
(rp:symbol-value symbol) procedure
symbol (in the toplevel environment.)
This is intended to be used to implement features such as property list
seen in other lisp dialects. Mixing the usage of symbol as a variable
on program and the usage of rp:symbol-value is discouraged.
(rp:symbol-value-set! symbol value) procedure
value of symbol
(in the toplevel environment.) See note on rp:symbol-value.
(rp:symbol-bound? symbol) procedure
#t if symbol is bound in the
toplevel environment, otherwise returns #f.
(eval expression) procedure
expression in toplevel environment.
(break [prompt]) procedure
Prompt is given
as string. If it is not supplied, defaults to "break> ".
(continue) procedure
continue is unbound if break loop is
not executing.
(rp:eval-in-compiler-environment expression) syntax
(rp:load-into-compiler-environment file) syntax
(load file) on
interpreter. Put in toplevel, file will be loaded to the environment
of compiler when compiled. So the content of the file will affect the
compilation process insted of included in the output code.
(exit [exit-code]) procedure
exit-code as status. Default of
exit-code is 0.
(system string) procedure
system() in the standard library and returns its
vaule.
(getenv string) procedure
string.
(file-exists? string) procedure
string exists,
#f otherwise.
*invocation-arg* global variable
(rp:command-line-arguments) procedure
(rp:time) procedure
#(real user sys).
(rp:errno) procedure
errno in the standard library.
(rp:strerror errono) procedure
strerror(errno) in
standard library.
(error [error-code]) procedure
(rp:catch-error procedure expression) syntax
procedure. The result must be a
procedure with one argument. Next, evaluate
expression and return its vaule. If error is
caused in evaluating expression,
procedure is called in the form
(procedure error-code)and the vaule will be the value of entire form. The error processing environment consists a part of continuation.
(rp:call-with-error-handler error-proc thunk) procedure
(rp:catch-error procedure expression)
is implemented as a macro expanded to the following.
(rp:call-with-error-handler error-proc (lambda () expression))
(rp:error-message error-code) procedure
(rp:print-error-message error-code [port]) procedure
port
(default is current-output-port.)
(rp:set-signal-handler signal procedure) procedure
Signal is a signal numberd by system,
procedure is a procedure with one argument or
#t or #f. If signal
is raised, procedure is called as
(procedure signal)No particular restriction is imposed on the behavior of this
procedure. If procedure
is #t, the default action is restored. If
procedure is #f,
signal will be ignored. Vaule is the previous signal handler.
(rp:signal-message signal) procedure
(rp:print-signal-message signal [port]) procedure
port
(default is current-output-port.)
(rp:current-error-port) procedure
stderr.
(rp:set-current-input-port [port]) procedure
(rp:set-current-output-port [port]) procedure
current-input-port, current-output-port
respectively. If the argument is omitted, the original one at
invocation is restored.
(open-input-string string) procedure
string.
(open-output-string) procedure
(get-output-string port) procedure
Port must be a output port made by
rp:open-output-string. Retrieves string consisting of
characters outputted to the port so far.
(rp:open-input-procedure procs) procedure
Procs is a vector with four
elements, say
#(getchar ungetchar getlinecount char-readyp)Each element is a procedure. Doing a input from resulting port causes invocation of
getchar.
(getchar) => (char . procs')
procs' is a vector simillar to
procs (simillar in the following,) say
#(getchar' ungetchar' getlinecount' char-readyp')If
char is a character, it will be a charecter
read from the port. If char is a number,
input lasts with a error and the number will be its error code.
If char is #f, port is effectively
in a end-of-file status. In the next usage of port,
procs' will be used.Ungetchar gets called as
(ungetchar char) => procs'Here,
(getchar') => (char . procs''), procs == procs''
is expected.Getlinecount gets called as
(getlinecount) => (linecount . procs')
linecount is a integer, treated as a line
number when getlinecount is called. In particular, if it was 0, it means
the line number is not applicable.
Char-readyp gets called as
(char-readyp) => (ready? . procs')If
ready? is a Boolean value, it will be a
vaule of char-ready? of that port.
If it is a number, error is caused with that error number.
Note: In the duration of execution of these procedures, the port will be unusable. So, in particular, errors should not be generated. Errorneous conditions should be reported to the mechanism which calls the procedure via the interface above. The effect is unpreditable if an instance of invocation of these procedures returns multiple times.
(rp:open-output-procedure proc) procedure
Proc is a procedure.
Doing a output to resulting port causes invocation of
proc in the form
(proc char) => (result . proc')
Char is a character to be outputted.
If result is #t, the output is assumed to be done normally.
If result is a number, error will be generated with the error number.
In the next usage of port, proc' will be used.
The same note is applied as rp:open-output-procedure.
(rp:file-status port) procedure
Port must be a port result from
open-output-file or open-input-file.
The following vaules are returned accroding to the status of
port at closing time.
#f |
Port is not closed yet. |
| Generates a error | Underlying close operation (flose or pclose) returned -1. |
| Integer vaule | Return vaule other than -1 of underlying close operation (fclose of pclose.) |
(rp:apply-with-evaluator-hook hook-function procedure arguments)
(rp:hook-evaluator hook-function expression environment continuation)
(rp:call-evaluator expression environment)
(rp:top-level-environment)
(rp:expression->data expression environment)
(rp:hook-applicator hook-function procedure)
(rp:unhook-applicator procedure)