Lugaru's Epsilon
Programmer's
Editor 14.00

Context:
Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      . . .
      File Primitives
         File Reading Primitives
         File Writing Primitives
         Line Translation Primitives
         . . .
         Tagging Internals
      Operating System Primitives
         System Primitives
         Window System Primitives
         Timing
         . . .
      Control Primitives
         Control Flow
         Character Types
         Examining Strings
         . . .
         Help Subroutines
      . . .

Previous   Up    Next
Tagging Internals  Primitives and EEL Subroutines   Window System Primitives


Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Operating System Primitives >

System Primitives

char *getenv(char *name)
get_substitution_variables(int flags)
putenv(char *name)
char *verenv(char *name)

Use the getenv( ) primitive to return entries from the environment. The primitive returns a null pointer if no environment variable name exists. For example, after the Windows command "set waldo=abcdef", the expression getenv("waldo") will return the string "abcdef".

The get_substitution_variables( ) primitive inserts all environment variables and their values into the current buffer, much like the "set" command in Windows or the "env" command on other platforms, whenever the 1 bit is specified in its flags parameter. The 2 bit makes it include Windows shell folder names and their values.

The putenv( ) primitive puts strings in the environment. Normally environment entries have the form "NAME=definition". This primitive manipulates Epsilon's copy of the environment, which is passed on to any program that Epsilon runs, but it doesn't affect the environment you get when you exit from Epsilon. The value of the argument to putenv( ) is evaluated later, when you actually invoke some other program from within Epsilon. For this reason, it is important that the argument to putenv( ) not be a local variable. Use putenv(strkeep(value)); to conveniently preserve the setting.

The verenv( ) primitive gets configuration variables. Epsilon for Windows looks in the system registry. Under Unix it retrieves the variables from the environment, like getenv( ).

Regardless of the operating system, this primitive looks for alternate, version-specific forms of the specified configuration variable. For example, in version 7.0 of Epsilon, verenv("MYVAR") would return the value of a variable named MYVAR70, if one existed. If not, it would try the name MYVAR7. If neither existed, it would return the value of MYVAR (or a null pointer if none of these variables were found). See Configuration Variables for complete information on configuration variables.

short opsys;
#define OS_WINDOWS  1    /* All Windows versions */
#define OS_UNIX     3    /* Includes Linux, FreeBSD, Mac OS. */

The opsys variable tells which operating system version of Epsilon is running, using the macros shown above and defined in codes.h.

short is_gui;
#define IS_NT       2 /* All Windows GUI versions */

The is_gui variable lets an EEL program determine if it's running in a version of Epsilon that provides general-purpose dialogs. Currently, the variable is nonzero only in the Windows GUI version, where it is always set to IS_NT.

short is_unix;
#define IS_UNIX_TERM   1
#define IS_UNIX_XWIN   2

The is_unix variable is nonzero if Epsilon for Unix is running. It's set to the constant IS_UNIX_XWIN if Epsilon is running as an X11 program, or IS_UNIX_TERM if Epsilon is running as a terminal program.

short is_unix_flavor;
#define IS_UNIX_LINUX   1
#define IS_UNIX_BSD     2
#define IS_UNIX_MACOS   3

The is_unix_flavor variable is nonzero if Epsilon for Unix is running. It's set to the constant macro IS_UNIX_LINUX in the Linux version, IS_UNIX_BSD in the FreeBSD version, and IS_UNIX_MACOS in the Mac OS version.

short is_mswindows;
#define IS_MSWINDOWS_64BIT    1
#define IS_MSWINDOWS_32BIT    2

The is_mswindows variable is nonzero if a version of Epsilon for Windows is running, either the GUI version or the Windows console version. The constant IS_MSWINDOWS_64BIT means the 64-bit version of Epsilon is running. The constant IS_MSWINDOWS_32BIT means the 32-bit version of Epsilon is running.

int has_feature;

Epsilon provides the has_feature variable so an EEL function can determine which facilities are available in the current environment. Bits represent possible features. Often these indicate whether a certain primitive is implemented.

 FEAT_ANYCOLOR  Epsilon can use all RGB colors, not just certain ones.
 FEAT_GUI_DIALOGS  display_dialog_box( ) is implemented.
 FEAT_FILE_DIALOG  common_file_dlg( ) is implemented.
 FEAT_COLOR_DIALOG  comm_dlg_color( ) is implemented.
 FEAT_SEARCH_DIALOG  find_dialog( ) is implemented.
 FEAT_FONT_DIALOG  windows_set_font( ) is implemented.
 FEAT_SET_WIN_CAPTION  set_window_caption( ) is implemented.
 FEAT_OS_PRINTING  print_window( ) is implemented.
 FEAT_WINHELP  win_help_string( ) and similar are implemented.
 FEAT_WINHELP_NATIVE  The WinHelp program is always available.
 FEAT_OS_MENUS  win_load_menu( ) and similar are implemented.
 FEAT_ANSI_CHARS  Does this system normally use ANSI fonts, not DOS/OEM?
 FEAT_EEL_RESIZE_SCREEN  Does EEL code control resizing the screen?
 FEAT_INTERNET  Are Epsilon's Internet functions available?
 FEAT_SET_FONT  Can EEL set the font via variables?
 FEAT_MULT_CONCUR  Does Epsilon support multiple concurrent processes?
 FEAT_DETECT_CONCUR_WAIT  Can Epsilon learn that a concurrent process waits for input?
 FEAT_EEL_COMPILE  eel_compile( ) is implemented.
 FEAT_LCS_PRIMITIVES  lcs( ) and related are implemented.
 FEAT_PROC_SEND_TEXT  process_send_text( ) is implemented.
 FEAT_UNICODE  16-bit Unicode characters are supported.

The FEAT_WINHELP and FEAT_WINHELP_NATIVE bits differ on systems that don't include WinHelp support by default, but have it as an installable option (Windows Vista through Windows 8.1). For these, the first bit but not the second is present. Starting in Windows 10, neither bit is present.

#define MAX_CHAR        65535

The MAX_CHAR macro indicates the largest character code that can appear in a buffer.

ding()
maybe_ding(int want)        /* disp.e */
user int want_bell;          /* EEL variable */
user short beep_duration;
user short beep_frequency;

The ding( ) primitive produces a beeping sound, usually called the bell. It is useful for alerting the user to some error. Instead of calling ding( ) directly, however, EEL commands should call the maybe_ding( ) subroutine defined in disp.e instead. It calls ding( ) only if the variable want_bell is nonzero, and its parameter is nonzero. Pass one of the bell_on_ variables listed in The Bell as the parameter. The sound that ding( ) makes is controlled by the beep-duration and beep-frequency variables. See The Bell.

int clipboard_available()
int buffer_to_clipboard(int buffer_number, int flags,
                        int clipboard_format)
int clipboard_to_buffer(int buffer_number, int flags,
                        int clipboard_format)
#define CLIP_CONVERT_NEWLINES   1
#define CLIP_ADD_FORMAT         2
copy_line_to_clipboard(char *line, int flags)

The clipboard_available( ) primitive tells whether Epsilon can access the system clipboard in this environment. It returns nonzero if the clipboard is available, or zero if not. Epsilon for Windows can always access the clipboard. Epsilon for Unix can access the clipboard when it runs as an X11 program.

The buffer_to_clipboard( ) primitive copies the indicated buffer to the clipboard. A clipboard_format of zero means use the default format; otherwise, it specifies a particular Windows clipboard format code. If you provide CLIP_CONVERT_NEWLINES in the flags argument, Epsilon will add a <Return> character before each <Newline> character it puts on the clipboard. This is the normal format for clipboard text. Without this flag, Epsilon will put an exact copy of the buffer on the clipboard. With the CLIP_ADD_FORMAT flag, Epsilon will add the specified data to the clipboard without clearing its current contents first. The new data should use a different format code that the clipboard's current contents, and the additional format will be added. Only Epsilon for Windows recognizes this flag.

The clipboard_to_buffer( ) primitive replaces the contents of the given buffer with the text on the clipboard. The clipboard_format parameter has the same meaning as above. If CLIP_CONVERT_NEWLINES is used, Epsilon will strip all <Return> characters from the clipboard text before putting it in the buffer.

The copy_line_to_clipboard( ) subroutine copies a single line to the clipboard, also displaying it. Mode-specific functions called by the copy-include-file-name command often use it. Passing a flag of 1 makes it add a newline after the provided text; a flag of 2 makes it skip displaying a message indicating what it copied.

signal_suspend()

In Epsilon for Unix, the signal_suspend( ) primitive suspends Epsilon's job. Use the shell's fg command to resume it. When Epsilon runs as an X11 program, this primitive minimizes Epsilon instead.



Previous   Up    Next
Tagging Internals  Primitives and EEL Subroutines   Window System Primitives


Lugaru Epsilon Programmer's Editor 14.00 manual. Copyright (C) 1984, 2020 by Lugaru Software Ltd. All rights reserved.