Macros

Grief is built on the concept of extensibility and programmability.  Macros are so ingrained in the design of BRIEF that many of the standard editing functions are implemented in the macro language, rather than in compiled code.

By writing your own macros, you can tailor the standard editor in both small ways (such as setting start-up colors, tab settings, or window positions), and large ways (such as modifying existing commands or creating new commands of your own design).

Summary
MacrosGrief is built on the concept of extensibility and programmability.
Types of MacrosA function can be called from the macro language.
CommandsPrompt line and keyword command macros.
Startup and mainEvery macro source may have a main() function; where you place it is a matter of preference.
File Extension MacrosFile extension callbacks are executed whenever GriefEdit edits a file via the edit_file primitive.
Registered MacrosA registered macro is one that is executed when an associated event ocurrs.
Replacement MacrosA replacement macros is an overloaded function, whereby an existing macro or builtin can be replaced and extended, yet allowing the replacment macro to then execute the origin
Special Purpose MacrosSimilar to registered macros, special purpose macros act a signal handlers.
Built-in FunctionsA built-in function is a function that was implemented in the interpreter and was not written in the Grief language.
Macro Resources
KeyboardsMost of Grief’s keyboard input is either via the command prompt get_parm or executed through the use of keyboard resources.
BuffersBuffers are the basic editing construct utilised by Grief.
Buffer IdentifiersBuffers can are identfied by one of two means, firstly by name and secondary its associated unique buffer handle or identifier.
Marked RegionsMany commands work on certain regions of text.
Scrap BufferThe scrap is a special buffer used for moving or copying blocks of text.
BookMarksA bookmark allows a record of the current buffer position to be saved for quick navigation to the same location at a later time.
Buffer ListBuffers are maintained in a circular list, refered to as the buffer list.
System BufferThere are two primary categories of buffers, user and system buffers.
Scrap BuffersScrap buffers are buffers which have been assigned the job of cut and paste storage.
Buffer ContentThe following primitives are used to manage buffer content.
Buffer AttributesAs buffers are the basic editing construct utilised by Grief, they also represent the primary user interface.
EncodingGrief supports both explicit and auto-detection of most file encoding types including;
Hilite RegionsSimilar to marked regions, buffers may have one or more special highlighting regions defined, allowing macros to show specific buffer content.
Syntax HighlightingSyntax highlighting allow different colors and text styles to be given to dozens of different lexical sub-elements of syntax.
Process BuffersAn external, for example a command shell, may be attached to specific buffer providing a tty style view for the underlining process.
DictionariesA dictionary is a collections of associations.
WindowsWindows are used to create views into buffers.
DialogsA dialog is a small window resource that prompts the user to make a decision or enter additional information.
Regular ExpressionsA regular expression is a pattern that the regular expression engine attempts to match in input text.

Types of Macros

A function can be called from the macro language.  Grief has a number of different kinds of macros or functions;

The following sections describe each of the function types.

Commands

Prompt line and keyword command macros.

A command function is a macro which are assigned to a key or key sequence.  As these are normally explicitly designed to be called directly by the user from the keyboard, these shall be referred to as commands.

There is no specific differences between command macros and other macros, as commands can be called also from other macros.

Note:

The _command keyword has been reserved for a possible extension to the macro language, whereby command macros must be explicity declared, hiding all not command macros from direct user usage.

Startup and main

Every macro source may have a main() function; where you place it is a matter of preference.

static int buffer;

void
main()
{                       // initial our private working buffer
        buffer = create_buffer("--working-buffer--", NULL, 1);
}

Note:

As such like C, some programmers place main at the beginning of the file, others at the very end.  Like all macros, their location of order of function declarations contained the macro source has not effect of the execution order.

File Extension Macros

File extension callbacks are executed whenever GriefEdit edits a file via the edit_file primitive.

It is provided to allow macros to hooks buffer loads, for example to setup defaults tabs before any extension specific settings are applied.

Once executed if defined the extension specific handler shall be executed, which should be named as _ext.  If not available the default extension handler _default shall be executed.

The extension case shall be preserved on case sensitive file-systems otherwise the extension is converted to lower case.

Registered Macros

A registered macro is one that is executed when an associated event ocurrs.

Types of events which can be registered include;

  • A character has been typed.
  • A invalid key is typed.
  • A new user buffer is created.
  • The current buffer is changed.
  • Exiting the editor.

These events are registered using the register_macro() primitive and can then be unregistered using the unregister_macro() primitive.  One or more macros can be registered against any given event, in which case each macro shall be executed upon the event, in the same order as there were registered.

Registered macro primitive include;

Replacement Macros

A replacement macros is an overloaded function, whereby an existing macro or builtin can be replaced and extended, yet allowing the replacment macro to then execute the origin

The replacement keyword is used to explicity declare overloaded interfaces, which is a macro that supersedes (or complements) another macro of the same name.

Special Purpose Macros

Similar to registered macros, special purpose macros act a signal handlers.

These macros are execute upon a specific event occurring, allowing macros to trail these events.

Special purpose macros include;

Built-in Functions

A built-in function is a function that was implemented in the interpreter and was not written in the Grief language.

See the Library Reference for the list of built-in functions.

Keyboards

Most of Grief’s keyboard input is either via the command prompt get_parm or executed through the use of keyboard resources.

Keyboard resources map key strokes to actions allowing

  • Assignment of any commands to a virtual key-code.
  • Manage individual keyboards on a keyboard stack.
  • Provide local keyboards for a buffer.
  • Tie keyboards to macros.

Primitives

The following primitives are used to manage keyboards.

Command Prompt

Prompts are used to request direct user input, either indirectly then invoking a primitive or directly through the use of get_parm.  The command prompt has a number of macro callbacks which are invoked during the prompt session, which may be replaced to modify and/or extend the prompt behaviour.

The following special macros _prompt_begin, _bad_key and _prompt_end:

_prompt_beginThis callback is invoked priot to prompt display.  If the macro _prompt_begin has been loaded, it is executed with a string parameter containing the value of prompt to be presented on the prompt.
This macro may set the default response, use the prompt as key to load previous values or other similar functions.
_bad_keyThis callback may be invoked one or more times during the command line edit session upon an invalid/unknown key being used during the edit.  The read_char primitive retrieves the associated bad key, which can be ignored, processed or replaced.
_prompt_endThis callback is invoked during the prompt completion process.  The primitive inq_cmd_line retrieves the value entered during the edit session.

Buffers

Buffers are the basic editing construct utilised by Grief.  One buffer corresponds to one piece of text being edited.  You can have several buffers open at once, but can edit only one at a time.

Each buffer may hold text only limited by the available system memory with as many buffers active at any given time in memory as desired, again only limited by system resources.

Several buffers can be visible at the same time when you’re splitting your window, see Windows.

Primitives

The following primitives are used to create and delete buffers

Buffer Identifiers

Buffers can are identfied by one of two means, firstly by name and secondary its associated unique buffer handle or identifier.

Primitives

The following primitives are used to select buffers

Marked Regions

Many commands work on certain regions of text.  A region is defined by two points, the first being the anchor and the other the cursor position.  Each buffer may have their own region, yet commands generally only work on the marked region within the current buffer.

Primitives

The following primitives are used to manage regions

Scrap Buffer

The scrap is a special buffer used for moving or copying blocks of text.  A scrap buffer differs from a regular buffer because:

  • Blocks of text can only be copied into it or pasted from it; the content cannot be modified by the user.
  • It is automatically managed whenever the user cuts or copies text.

Primitives

The following primitives are used to manage the scrap buffer.

BookMarks

A bookmark allows a record of the current buffer position to be saved for quick navigation to the same location at a later time.

There is no visible indication of where bookmarks are set.

Primitives

Buffer List

Buffers are maintained in a circular list, refered to as the buffer list.  New buffers are automaticly inserted into the list on creation.  To locate a buffer that is not current, the next_buffer and previous_buffer primitives along with set_buffer can be use to manipulate the current buffer.

Primitives

System Buffer

There are two primary categories of buffers, user and system buffers.  System buffers are similar to user buffer except thery are normally skipped by user level buffer functions.

Primitives

Scrap Buffers

Scrap buffers are buffers which have been assigned the job of cut and paste storage.

Primitives

The cut and paste working storage is a special scape buffer which is controlled using the following primitives.

Buffer Content

Primitives

The following primitives are used to manage buffer content.

Buffer Attributes

As buffers are the basic editing construct utilised by Grief, they also represent the primary user interface.  Each buffer has many run-time attributes which effect the way content is presented to the user.

These attributes include.

  • Built-in features.
  • Display effects.
  • Tabs and filling.

Primitives

The following primitives are used to manage buffer attributes.

Built-in features
Display effects
Tabs and filling

Encoding

Grief supports both explicit and auto-detection of most file encoding types including;

  • UTF-8.
  • UTF-16.
  • UTF-32.
  • Latin1 (ISO8859-1).
  • Extended ASCII.
  • ASCII.

Primitives

The following primitives are used to manage character maps and buffer encodings.

Character Map
Line termination support
Auto detection support

Hilite Regions

Similar to marked regions, buffers may have one or more special highlighting regions defined, allowing macros to show specific buffer content.

Primitives

The following primitives are used to manage hiliting resources.

Syntax Highlighting

Syntax highlighting allow different colors and text styles to be given to dozens of different lexical sub-elements of syntax.  These include keywords, comments, control-flow statements, variables, and other elements

There are several forms of highlighting engines.

  • Simple tokeniser.
  • DFA regular expression tokeniser.

Primitives

The following primitives are used to manage syntax resources.

Process Buffers

An external, for example a command shell, may be attached to specific buffer providing a tty style view for the underlining process.

Primitives

The following primitives are used to manage processes.

Dictionaries

A dictionary is a collections of associations.  Dictionaries consist of pairs of keys and their corresponding values, both arbitrary data values.  Dictionaries are also known as associative arrays or hash tables.

Dictionaries require more space than lists, yet allow fast searches.  Only one association in a dictionary may have a given key, that item keys must be unique.

You can iterate over a dictionary’s associations using the dict_each primitive; at each step of the statement, the loop index will contain a list [key, value] for the current association.

Primitives

The following primitives are used to manage dictionary resources; see the descriptions of each function for details.

Windows

Windows are used to create views into buffers.  Windows are either tiled or popup.

Tiled windows

Tiled windows are the normal user views into buffers, allowing direct user interaction so that they may edit the buffer content.

The Grief window manager organises the screen into mutually non-overlapping frames.  Tiled windows are not permitted to be overlapped with other tiled windows, as such are sized and positioned to own a specified rectangled area of the display.

The following primitives are used to create and delete tiled windows.

Popup windows

Unlike Tiled windows, Popup Windows when displayed overlay any tiled windows positioned behind and maybe sized and positions anywhere within the visible arena.

Usually, popup windows are utilised to display temporary information, for example the results of a command.  They are generally created dynamically and managed by macros and are destroyed on completion of that macro.

In addition popup windows stack, allowing multiple popups to represent nested structures; one example being the help system which allows the user to drill down thru command relationships and then backout in reverse.

Primitives

The following primitives are used to create and delete popup windows.

Like buffers each windows has a set of attributes which effect the presentation of connected buffer contentt, these are managed using the following primitives.

Dialogs

A dialog is a small window resource that prompts the user to make a decision or enter additional information.  A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.

Primitives

The following primitives are used to manage dialogs.

Regular Expressions

A regular expression is a pattern that the regular expression engine attempts to match in input text.  A pattern consists of one or more character literals, operators, or constructs.

Primitives

The following primitives are used to utilise regular expressions.

in addition the following are Brief compatible interfaces which also support regular expressions.

$Id: macros.txt,v 1.4 2014/10/31 01:09:05 ayoung Exp $

To send feedback on this topic email: grie.nosp@m.fedit@gmai.nosp@m.l.com

Copyright © Adam Young All Rights Reserved.

int edit_file(...)
Edit a file.
int get_parm( [int argument],
declare &symbol,
  [string prompt],
 [int length = MAXPROMPT],
  [declare default],
 [int one = FALSE])
Retrieve the value of a macro parameter.
Prompt line and keyword command macros.
Every macro source may have a main() function; where you place it is a matter of preference.
File extension callbacks are executed whenever GriefEdit edits a file via the edit_file primitive.
A registered macro is one that is executed when an associated event ocurrs.
A replacement macros is an overloaded function, whereby an existing macro or builtin can be replaced and extended, yet allowing the replacment macro to then execute the origin
Similar to registered macros, special purpose macros act a signal handlers.
A built-in function is a function that was implemented in the interpreter and was not written in the Grief language.
void _default(string ext)
Default extension handler.
int register_macro(int type,
 string macro,
 [int local = FALSE])
Register a callback procedure.
void _extension(string ext)
Buffer load handler.
int unregister_macro(int type,
 string macro,
 [int local = FALSE])
Remove a registered macro.
int call_registered_macro(int type)
Invoke registered macro callbacks.
void _startup_complete(int mode)
Startup event callback.
void _prompt_begin(string prompt)
Command prompt session begin callback.
void _prompt_end()
Command prompt session end callback.
string _bad_key()
Command prompt unknown key callback.
void _invalid_key()
Invalid key event.
void _fatal_error(int signo,
string desc)
Fatal condition callback.
void _chg_properties()
Property change event.
This section contains the description for the all the Grief macro primitives.
Most of Grief’s keyboard input is either via the command prompt get_parm or executed through the use of keyboard resources.
Buffers are the basic editing construct utilised by Grief.
Buffers can are identfied by one of two means, firstly by name and secondary its associated unique buffer handle or identifier.
Buffers are maintained in a circular list, refered to as the buffer list.
Many commands work on certain regions of text.
There are two primary categories of buffers, user and system buffers.
Scrap buffers are buffers which have been assigned the job of cut and paste storage.
Windows are used to create views into buffers.
A dialog is a small window resource that prompts the user to make a decision or enter additional information.
A dictionary is a collections of associations.
A regular expression is a pattern that the regular expression engine attempts to match in input text.
int assign_to_key([string key],
[string macro])
Assign command to key or key sequence.
int copy_keyboard(int kbdid,
  [string cmd ...])
Copy a keyboard.
string inq_assignment(int|string val,
 [int tokey = FALSE])
Get key assignment for function.
int inq_kbd_char()
Peek at the keyboard.
int inq_keyboard()
Retrieve the keyboard identifier.
int inq_local_keyboard()
Retrieve local keyboard identifier.
void keyboard_flush()
Flush the keyboard buffer.
void keyboard_pop([int save = FALSE])
Pop a keyboard from the keyboard stack.
void keyboard_push([int kbdid])
Push a keyboard onto the keyboard stack.
int keyboard_typeables()
Assign self_insert to all typeable keys.
void pause()
Pause keystroke definition.
void process()
Invoke a Grief engine.
void push_back(int key,
  [int front],
 [int x],
 [int y])
Push back a character into the keyboard.
void read_char([int timeout = 0],
[int mode = 0])
Read next key from the keyboard.
int remember([string|int overwrite],
[int macroid])
Start remembering keystrokes.
void self_insert([int character])
Insert a character as if it was typed.
int use_local_keyboard(int kbdid)
Associate a keyboard with a buffer.
string inq_cmd_line()
Retrieve the command line message.
int create_buffer(string bufname,
 [string filename],
  [int sysflag = FALSE],
 [int editflags = 0],
  [string encoding = ""])
Create and load a buffer.
void attach_buffer(int bufnum)
Attach a buffer to a window.
void delete_buffer(int bufnum)
Delete a buffer.
int inq_buffer([string filename])
Retrieve a buffer identifier.
int set_buffer(int bufnum)
Set the current buffer.
int inq_marked([int &start_line],
[int &start_col],
 [int &end_line],
[int &end_col])
Determine the current marked region.
int drop_anchor([int type = MK_NORMAL])
Start marking a selection.
int end_anchor([int line],
[int column])
Set the end of the anchor.
int raise_anchor()
Raise the last dropped mark.
int swap_anchor()
Swaps the mark with the current position.
int delete_block()
Deleted selected region.
int cut([int append = FALSE],
[int syscopy = FALSE])
Cut marked area to scrap.
int copy([int append = FALSE],
[int keep = FALSE])
Copy marked area to scrap.
int paste([int syspaste = FALSE])
Insert scrap buffer at cursor location.
int transfer(int bufnum,
 int sline,
 [int scolumn],
int eline,
 [int ecolumn])
Buffer to buffer transfer.
int inq_scrap([int &last],
[int &type])
Obtain the scrap buffer identifier.
void set_scrap_info(  [int last],
[int type],
[int bufnum])
Set the scrap buffer details.
int drop_bookmark([int bookid],
[string yesno],
 [int bufnum],
[int line],
[int column],
[int local = FALSE])
Create or update a bookmark.
void delete_bookmark(int bookid)
Delete a bookmark.
int goto_bookmark(int bookid =  NULL,
  [int &bufnum],  
 [int &line],  
 [int &column]  )
Seek a bookmark.
list bookmark_list()
Retrieve existing bookmark list.
int next_buffer([int sysflag = 0],
 [int previous],
[int tab])
Identifier of the next buffer.
int previous_buffer([int sysflag = 0],
[int tab])
Identifier of the previous buffer.
void set_buffer_flags([int bufnum],
 [string|int or_mask],
[string|int and_mask],
 [int set = 1])
Set buffer flags.
int inq_system([int bufnum])
Determine if buffer is a system buffer.
int get_region([int bufnum])
Retrieve marked region content.
int insert(string|int val,
 [int num = 1])
Insert string into current buffer.
int insertf(string format,
 ...)
Insert a formatted string.
int insert_buffer(int bufnum,
string format,
 ...)
Insert format text into a buffer.
int inq_buffer_flags([int bufnum],
 [string flag|int set = 1],
[string ~flags])
Retrieve buffer flags.
int set_attribute(  [int|string text],
[int|string normal],
 [int bufnum])
Set the color attributes.
int inq_attribute(  [int &normal],
[int bufnum])
Retrieve the current attributes.
int tabs([string tabs | list tabs | int tab, ...])
Set buffer tab stops.
string|list inq_tabs([int bufnum],
[int min_count],
[int aslist = FALSE]))
Retrieves the buffer tab specification.
int set_ruler([int bufnum],
[list|string|int ...])
Configure the buffer ruler.
string|list inq_ruler([int bufnum],
[int min_count],
[int aslist = FALSE])
Retrieves the ruler specification.
int set_indent([int indent],
[int bufnum])
Set the buffers default indentation.
int inq_indent([int bufnum])
Get current indentation settings.
int set_margins([int bufnum],
 [int left = NULL],
[int right = NULL],
 [int style = NULL],
[int colorcolumn = NULL])
Set buffer formatting margins.
int inq_margins([int bufnum],
 [int &left],
[int &right],
[int &style],
[int &colorcolumn],
 [int global = TRUE])
Retrieve buffer formatting margins.
int set_encoding([string encoding = NULL],
 [int bufnum = NULL])
Set a buffers character encoding.
string inq_encoding([int bufnum])
Retrieve a buffers character encoding.
int create_char_map([int mapid|string name],
 [int start = 0],
[list chars],
 [list flags],
[string name])
Create a display character-map.
int set_buffer_cmap([int mapid|string name],
[int bufnum])
Set a buffers character-map.
int inq_char_map([int winnum],
[string &name])
Retrieve the character-map.
int set_terminator( [int bufnum],
int|string term)
Set a buffers line terminator.
int inq_terminator([int bufnum],
[string &term])
Retrieve a buffers line terminator.
int set_file_magic([string encoding],
[int cost])
Define the file type detection rules.
string inq_file_magic([int &isdefault])
Retrieve the file type detection rules.
int hilite_create([int bufnam],
[int type],
[int timeout],
 [int sline],
[int scol],
[int eline],
[int ecol],
 [string | int attr],
[int ident])
Create a hilite resource.
int hilite_destroy([int bufnum],
[int type])
Destroy hilite resources.
int attach_syntax(int|string syntable)
Attach a syntax to a buffer.
int create_syntax(string table)
Syntax table creation.
void define_keywords([int|string] keywords,
string words|list words,
 [int length],
  [int flags],
 [int|string syntable])
Add keywords to a syntax dictionary.
void syntax_token(int type,
  [<type1> param1],
 [<type2> param2],
 [int|string syntable])
Define a syntax token.
void detach_syntax()
Detach a syntax from a buffer.
void get_color_pair(string name|int ident,
  [int|string fg],
 [int|string bg],
 [int|string sf])
Retrieve the specific color.
void syntax_build([int timestamp],
 [string cache],
[int|string syntable])
Build a syntax hiliting engine.
void syntax_rule(string pattern,
 string attribute,
 [int|string syntable])
Define a syntax hilite rule.
int inq_syntax([int &flags],
[int|string syntable])
Retrieve the syntax identifier.
void set_color_pair(string|int ident,
  [int|string fg],
 [int|string bg],
 [int|string sf])
Set a specific color.
int set_syntax_flags(int flags,
 [int|string syntable])
Set syntax flags.
int syntax_column_ruler(  list ruler,
 [string attribute],
 [int|string syntable])
Column syntax coloriser.
int connect(int mode,  
string shell =  NULL,
string cwd =  NULL)
Attach a process to a process.
int disconnect()
Disconnect a buffer from a process.
int insert_process(string|int val,
 [int num = 1])
Send string to a attached process.
int set_process_position([int line],
[int column])
Set process insertion position.
int inq_process_position([int &line],
[int &column])
Get position of process buffer.
int wait([int &status])
Wait for attached process to terminate.
int wait_for( [int timeout],
 list|string pattern,
 [int flags = 0])
Wait for process output.
int send_signal(int signal)
Send signal to a process buffer.
int dict_each(int obj_id,
  [string key],
 [declare value])
Iterator a dictionary.
int create_dictionary(string ~name,
 int ~tablesize,
int ~tablefactor)
Create a dictionary.
int delete_dictionary(int obj_id)
Destroy a dictionary.
int set_property(  int obj_id,
string key,
 [declare value])
Set a dictionary item.
declare get_property(int obj_id,
string key)
Retrieve a dictionary item.
int dict_delete(int obj_id,
string key)
Remove a dictionary item.
int dict_exists(  int obj_id,
string key)
Dictionary item existence check.
int dict_keys(int obj_id,
  [string key])
Iterator dictionary keys.
int dict_values(int obj_id,
  [declare value])
Iterator dictionary values.
list dict_list(int obj_id)
Retrieve dictionary items.
string dict_name(int obj_id)
Retrieve a dictionary name.
list list_of_dictionaries(  [bool nonempty = false],
[bool named = false])
List of created dictionaries.
int create_tiled_window(int lx,
int by,
int rx,
int ty,
 [int bufnum])
Creates a tiled window.
int display_windows([int mode])
Control window display.
void change_window([int direction],
[string message])
Selects a new window.
int move_edge([int direction],
[int amount])
Modify a window.
int create_edge([int direction])
Create an edge, splitting the window.
int delete_edge([int direction])
Delete an edge, combining a split window.
int inq_top_left([int &top],
[int &indent],
[int winnum],
 [int &line],
[int &col],
[int &bufnum])
Retrieve window view port coordinates.
int inq_window()
Retrieve the current window.
int inq_window_info([int &winnum],
[int &bufnum],
 [int &lx],
[int &by],
[int &rx],
[int &ty],
 [string &title = NULL],
[string &message = NULL])
Retrieve the current window information.
int set_top_left([int line],
[int column],
 [int winnum],
[int csrline],
[int csrcolumn],
[int bufnum])
Manages window view port coordinates.
int set_window(int winnum)
Set the active window.
int next_window(int winnum)
Obtain the next window identifier.
int create_window(int lx,
int by,
 int rx,
int ty,
 [string message])
Create a popup window.
void delete_window([int winum])
Delete a window.
void set_window_flags([int winnum],
 [string set|int or_mask],
[string clear|int and_mask])
Set window flags.
int inq_window_flags([int winnum],
[string flags])
Retrieve window flags.
int dialog_create(list decl)
Build a dialog resource.
int dialog_delete(int dialog)
Delete a dialog resource.
int dialog_exit(int retval =  0,
 [int dialog]  )
Exit a dialog resource.
int dialog_run(int dialog,
 [string args])
Execute a dialog resource.
int inq_dialog()
Retrieve the current dialog resource.
declare widget_get([int dialog],
 [int name|string name],
 [int attr = DLGA_VALUE],
 [int index = 0])
Retrieve a widget attribute.
declare widget_set( [int dialog],
  [int name|string name],
declare value,
  [int attr = DLGA_VALUE],
 [int index = 0])
Set a widget attribute.
string quote_regexp(string text)
Quote regexp special characters.
list re_comp( [int flags],
string pattern,
 [string &error])
Compile a regular expression.
int re_delete(list handle)
Delete a compiled expression.
int re_result([int capture],
 [string &value],
[int &offset],
[int &length])
Retrieve search captures.
int re_search([int flags],
[string pattern],
 [declare object],
[int start],
[int lensym])
Search for a string.
int re_syntax([int re],
[int case],
[int capture])
Set the regular expression mode.
int|string re_translate( [int flags],
string pattern,
  [string replacement],
 [declare object])
Search and replace.
int search_case([int case])
Set the search pattern case mode.
int search_back(string pattern,
 [int re],
 [int case],
  [int block],
 [int length])
Backwards buffer search.
int search_fwd(string pattern,
 [int re],
 [int case],
  [int block],
 [int length])
Buffer search.
int search_list( [int start],
string pattern,
 list expr,
 [int re],
 [int case])
Search list contents.
int search_string(string pattern,
string text,
  [int &length],
 [int re],
 [int case])
Searches for a pattern in a string.
int translate(string pattern,
string replacement,
  [int global],
 [int re],
 [int case],
  [int block],
 [int forward])
Buffer search and replace.