Description: Documentation

## variable BATCH

### Synopsis

Non-Zero if in Batch Mode

### Usage

Int_Type BATCH

### Description

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.

### See also

## variable JED_ROOT

### Synopsis

Location of the JED root directory

### Usage

String_Type JED_ROOT

### Description

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.

### See also

get_jed_library_path , set_jed_library_path , getenv

## variable _jed_secure_mode

### Synopsis

Indicates whether or not the editor is in secure mode

### Usage

Int_Type _jed_secure_mode

### Description

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.

### See also

system

## variable _jed_version

### Synopsis

The JED version number

### Usage

Int_Type _jed_version

### Description

The value of _jed_version represents the version number of the editor.

### See also

_jed_version_string , _slang_version

## variable _jed_version_string

### Synopsis

The JED version number as a string

### Usage

String_Type _jed_version_string

### Description

The value of _jed_version_string represents the version number of the editor.

### See also

_jed_version , _slang_version_string

## function call

### Synopsis

call

### Usage

Void call(String f);

### Description

The call function is used to execute an internal function which is not directly accessable to the S-Lang interpreter.

### See also

is_internal

## function core_dump

### Synopsis

core_dump

### Usage

Void core_dump(String msg, Integer severity);

### Description

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.

### See also

exit_jed , quit_jed , message , error

## function define_word

### Synopsis

define_word

### Usage

Void define_word (String s);

### Description

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.

## function exit_jed

### Synopsis

exit_jed

### Usage

Void exit_jed ();

### Description

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.

### See also

quit_jed , suspend , flush , getkey

### See also

BATCH

## function get_doc_string

### Synopsis

get_doc_string

### Usage

Integer get_doc_string (String obj, String filename);

### Description

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.

## function get_last_macro

### Synopsis

get_last_macro

### Usage

String get_last_macro ();

### Description

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    ---->   \@
             \      ---->   \\
             '"'    ---->   \"

## function get_passwd_info

### Synopsis

get_passwd_info

### Usage

(dir, shell, pwd, uid, gid) = get_passwd_info (String username);

### Description

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 .

## function getpid

### Synopsis

getpid

### Usage

Integer getpid ();

### Description

This function returns the process identification number for the current editor process.

## function is_internal

### Synopsis

is_internal

### Usage

Integer is_internal(String f);

### Description

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.

### See also

call

## function quit_jed

### Synopsis

quit_jed

### Usage

Void quit_jed ();

### Description

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.

### See also

exit_jed

## function random

### Synopsis

random

### Usage

Integer random (Integer seed, Integer nmax);

### Description

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;

## function set_line_readonly

### Synopsis

set_line_readonly

### Usage

Void set_line_readonly (Integer flag);

### Description

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.

### See also

getbuf_info

## function suspend

### Synopsis

suspend

### Usage

Void suspend ();

### Description

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.

## function usleep

### Synopsis

usleep

### Usage

Void usleep (Integer ms);

### Description

A call to usleep will cause the editor to pause for ms milliseconds.

### See also

input_psnding

## function vms_get_help

### Synopsis

vms_get_help

### Usage

Void vms_get_help (String hlp_file, String hlp_topic);

### Description

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.

## function vms_send_mail

### Synopsis

vms_send_mail

### Usage

Integer vms_send_mail (String recip_lis, String subj);

### Description

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.