Non-Zero if in Batch Mode
Int_Type BATCH
BATCH
is a read-only variable will be zero if the editor is run
in interactive or full-screen mode. It will be 1
if the editor is
in batch mode (via the -batch
comment line argument). If the
editor is in script mode (via -script
), then the value of
BATCH
will be 2
.
Location of the JED root directory
String_Type JED_ROOT
This is a read-only string variable whose value indicates JED's root
directory. This variable may be set using the JED_ROOT
environment variable.
get_jed_library_path, set_jed_library_path, getenv
Indicates whether or not the editor is in secure mode
Int_Type _jed_secure_mode
The value of _jed_secure_mode
will be non-zero if the editor
is running in secure mode. This mode does not allow any access to
the shell.
system
The JED version number
Int_Type _jed_version
The value of _jed_version
represents the version number of the
editor.
_jed_version_string, _slang_version
The JED version number as a string
String_Type _jed_version_string
The value of _jed_version_string
represents the version number
of the editor.
_jed_version, _slang_version_string
call
Void call(String f);
The call
function is used to execute an internal function which is
not directly accessable to the S-Lang interpreter.
is_internal
core_dump
Void core_dump(String msg, Integer severity);
core_dump
will exit the editor dumping the state of some crucial
variables. If severity
is 1
, a core dump will result. Immediately
before dumping, msg
will be displayed.
exit_jed, quit_jed, message, error
define_word
Void define_word (String s);
This function is used to define the set of characters that form a
word. The string s
consists of those characters or ranges of
characters that define the word. For example, to define only the
characters A-Z
and a-z
as word characters, use:
define_word ("A-Za-z");
To include a hyphen as part of a word, it must be the first character
of the control string s
. So for example,
define_word ("-i-n");
defines a word to consist only of the letters i
to n
and the
hyphen character.
exit_jed
Void exit_jed ();
This function should be called to exit JED is a graceful and safe
manner. If any buffers have been modified but not saved, the user is
queried about whether or not to save each one first. exit_jed
calls
the S-Lang hook exit_hook
if it is defined. If exit_hook
is
defined, it must either call quit_jed
or exit_jed
to really exit
the editor. If exit_jed
is called from exit_hook
, exit_hook
will
not be called again. For example:
define exit_hook ()
{
flush ("Really Exit?");
forever
{
switch (getkey () & 0x20) % map to lowercase
{ case 'y': exit_jed (); }
{ case 'n': return; }
beep ();
}
}
may be used to prompt user for confirmation of exit.
quit_jed, suspend, flush, getkey
BATCH
get_doc_string
Integer get_doc_string (String obj, String filename);
This function may be used to extract the documentation for a variable
or function from a jed documentation file given by filename
.
If successful, it returns non-zero as well as the documentation string.
It returns zero upon failure. The first character of obj
determines
whether obj
refers to a function or to a variable. The rest of the
characters specify the name of the object.
get_last_macro
String get_last_macro ();
This function returns characters composing the last keyboard macro. The charactors that make up the macro are encoded as themselves except the following characters:
'\n' ----> \J
null ----> \@
\ ----> \\
'"' ----> \"
get_passwd_info
(dir, shell, pwd, uid, gid) = get_passwd_info (String username);
This function returns password information about the user with name
username
. The returned variables have the following meaning:
dir: login directory
shell: login shell
pwd: encripted password
uid: user identification number
gid: group identification number
If the user does not exist, or the system call fails, the function
returns with uid
and gid
set to -1
.
getpid
Integer getpid ();
This function returns the process identification number for the current editor process.
is_internal
Integer is_internal(String f);
is_internal
returns non-zero is function f
is defined as an
internal function or returns zero if not. Internal functions not
immediately accessable from S-Lang; rather, they must be called using
the call
function. See also the related S-Lang function
is_defined
in the S-Lang Programmer's Reference.
call
quit_jed
Void quit_jed ();
This function quits the editor immediately. No buffers are
auto-saved and no hooks are called. The function exit_jed
should be
called when it is desired to exit in a safe way.
exit_jed
random
Integer random (Integer seed, Integer nmax);
The random
function returns a random number in the range 0 to, but
not including, nmax
. If the first parameter seed
is 0, the
number generated depends on a previous seed. If seed
is -1, the
current time and process id will be used to seed the random number
generator; otherwise seed
will be used.
Example: generate 1000 random integers in the range 0-500 and insert them into buffer:
() = random (-1, 0); % seed generator usingtime and pid
loop (1000)
insert (Sprintf ("%d\n", random (0, 500), 1));
Note: The random number is generated via the expression:
r = r * 69069UL + 1013904243UL;
set_line_readonly
Void set_line_readonly (Integer flag);
This function may be used to turn on or off the read-only state of the
current line. If the integer parameter flag
is non-zero, the line
will be made read-only. If the paramter is zero, the read-only state
will be turned off.
getbuf_info
suspend
Void suspend ();
The action of this command varies with the operating system.
Under Unix, the editor will be suspended and control will pass to the
parent process. Under VMS and MSDOS, a new subprocess will be spawned.
Before suspension, suspend_hook
is called. When the editor is
resumed, resume_hook
will be called. These hooks are user-defined
functions that take no arguments and return no values.
usleep
Void usleep (Integer ms);
A call to usleep will cause the editor to pause for ms
milliseconds.
input_psnding
vms_get_help
Void vms_get_help (String hlp_file, String hlp_topic);
This function may be used on VMS systems to interact with the VMS help
system from within the editor. hlp_file
is the name of the help file
to use and hlp_topic
is the topic for which help is desired.
vms_send_mail
Integer vms_send_mail (String recip_lis, String subj);
This VMS specific function provides an interface to the VMS callable
mail facility. The first argument, recip_lis
, is a comma separated list
of email addresses and subj
is a string that represents the subject of
the email. The current buffer will be emailed. It returns 1
upon
success and 0
upon failure.