Callbacks

Summary
Callbacks
Macros
_bad_keyCommand prompt unknown key callback.
_chg_propertiesProperty change event.
_defaultDefault extension handler.
_extensionBuffer load handler.
_fatal_errorFatal condition callback.
_initInternal macro initialisation.
_invalid_keyInvalid key event.
_prompt_beginCommand prompt session begin callback.
_prompt_endCommand prompt session end callback.
_startup_completeStartup event callback.
mainMacro entry point.

Macros

_bad_key

string _bad_key()

Command prompt unknown key callback.

Description

The _bad_key() callback is executed by GRIEF upon an unknown key being pressed during a command prompt session.

Parameters

none

Returns

The _bad_key() callback should return the replacement string otherwise NULL.

Portability

n/a

See Also

get_parm, _prompt_begin, _prompt_end, inq_command, inq_cmd_line

_chg_properties

void _chg_properties()

Property change event.

Description

The _chg_properties callback is executed by GriefEdit upon the borders configuration changing.

Parameters

none

Returns

nothing

Portability

n/a

See Also

Callbacks, borders

_default

void _default(string ext)

Default extension handler.

Description

The _default() callback is executed whenever GRIEF edits a file via the edit_file primitive and a extension specific macro of the format _ext was not available to be executed.

It is provided to allow macros to hooks buffer loads, for example to setup defaults tabs on a file extension basis.

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

Note:

This interface is considered defunct; register_macro is the preferred method of capturing buffer edit events.

Parameters

extFile extension.

Returns

nothing

Portability

n/a

See Also

edit_file, _extension

_extension

void _extension(string ext)

Buffer load handler.

Description

The _extension() callback is executed whenever GRIEF 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 _default handler is executed.

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

Note:

This interface is considered defunct; register_macro is the preferred method of capturing buffer edit events.

Parameters

extFile extension.

Returns

nothing

Portability

The ext parameter is a GriefEdit extension.

See Also

edit_file, _default

_fatal_error

void _fatal_error(int signo,
string desc)

Fatal condition callback.

Description

The _fatal_error callback is executed by GriefEdit upon a fatal signal condition being thrown by the operating system; these generally represent editor bugs or possible macro usage violations.

The list of trapped condition is very system dependent, yet the following are generally included.

Constant
Description
SIGBUS
Bus error
SIGSEGV
Segmentation violation.
SIGILL
Illegal instruction.
SIGFPE
Floating point error.

Note:

The macro implementation should utilise as few GriefEdit facilities as possible to avoid re-triggering the same condition.

Refer to the core macro for an example.

Parameters

signoInteger signal number.
descString containing the signal description.

Returns

The _start_complete should return nothing

Portability

n/a

See Also

Callbacks

_init

void _init()

Internal macro initialisation.

Description

The _init macro is utilised by the Compiler to set-up file level variables (See: global).

Note:

This interface is an internal primitive, reserved for exclusive use by the GRIEF Macro Compiler and may change without notice.  Management of variable scoping and argument binding shall be handled automatically by the compiler.

Returns

nothing

Portability

n/a

See Also

main, global, load_macro

_invalid_key

void _invalid_key()

Invalid key event.

Description

The _invalid_key callback is a legacy BRIEF interface.

This interface is provided for BRIEF compatibility, if the macro _invalid_key exists, it shall be called instead of any registered macros.  When invoked the keystroke awaiting is the invalid key.

Parameters

none

Returns

The _invalid_key callback should return an integer value.

Portability

BRIEF compatibility.

See Also

register_macro

_prompt_begin

void _prompt_begin(string prompt)

Command prompt session begin callback.

Description

The _prompt_begin() callback is executed at the beginning of a command prompt session.

The interface allows the command line history and abbreviations mechanisms to be implemented.

Parameters

promptString containing the prompt.

Returns

nothing

Portability

n/a

See Also

get_parm, _prompt_end, _bad_key, inq_command, inq_cmd_line

_prompt_end

void _prompt_end()

Command prompt session end callback.

Description

The _prompt_end() callback is executed at the termination of a command prompt session.

Parameters

none

Returns

nothing

Portability

n/a

See Also

get_parm, _prompt_begin, _bad_key, inq_command, inq_cmd_line

_startup_complete

void _startup_complete(int mode)

Startup event callback.

Description

The _startup_complete() callback is executed by GRIEF upon startup.

It is executed after all command line switches have been process, after all command line files have been read in, and after the startup() macro has been called.

The specified mode states the command line status as follows.

0No command line files were specified.
1Command line file were specified.

This callback is utilised by the restore macro to avoid restoring the state of buffers and files when files have been specified on the command line.

Parameters

modeCommand line operational mode.

Returns

The _start_complete() callback should return the nothing.

Portability

n/a

See Also

Callbacks

main

void main()

Macro entry point.

Description

The main macro is an optional callback which may be defined within each macro source module.

Upon a macro load, the macro main is executed if it is present within the macro object.  This macro can be used to initialise and perform load-time specific variable initialisation and/or functions.

Note:

The main function is indirectly executed on the successful loading of a macro object by the _init entry point.

Returns

nothing

Portability

n/a

See Also

_init, load_macro

$Id: $

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

Copyright © Adam Young All Rights Reserved.

string _bad_key()
Command prompt unknown key callback.
void _chg_properties()
Property change event.
void _default(string ext)
Default extension handler.
void _extension(string ext)
Buffer load handler.
void _fatal_error(int signo,
string desc)
Fatal condition callback.
void _init()
Internal macro initialisation.
void _invalid_key()
Invalid key event.
void _prompt_begin(string prompt)
Command prompt session begin callback.
void _prompt_end()
Command prompt session end callback.
void _startup_complete(int mode)
Startup event callback.
void main()
Macro entry point.
int get_parm( [int argument],
declare &symbol,
  [string prompt],
 [int length = MAXPROMPT],
  [declare default],
 [int one = FALSE])
Retrieve the value of a macro parameter.
string inq_command()
Retrieve name of last keyboard command.
string inq_cmd_line()
Retrieve the command line message.
int borders([int borders])
Set window border status.
int edit_file(...)
Edit a file.
int register_macro(int type,
 string macro,
 [int local = FALSE])
Register a callback procedure.
global sym1, sym2, ..;
Declare a global variable.
int load_macro(string filename,
 [int reload = 1])
Load a macro object.