The Minimum Profit API (3.3.17)

By Source

mp_conf.c

mpc_read_config

mp_core.c

_im_alive, _mp_active, _mp_auto_indent, _mp_case_cmp, _mp_clipboard, _mp_error, _mp_save_tabs, _mp_tab_size, _mp_txts, _mp_wheel_scroll_rows, _mp_word_wrap, mp_adjust, mp_change_cursor, mp_copy_mark, mp_create_block, mp_create_sys_txt, mp_create_txt, mp_debug_hook, mp_delete_char, mp_delete_line, mp_delete_mark, mp_delete_sys_txt, mp_delete_txt, mp_empty_txt, mp_end_tmp_txt, mp_find_text, mp_get_char, mp_get_encryption_format, mp_get_str, mp_get_tmp_txt, mp_get_word, mp_insert_char, mp_insert_line, mp_insert_tab, mp_is_sep, mp_load_file, mp_log, mp_mark, mp_mark_match, mp_marked, mp_match_bracket, mp_modified, mp_move_bof, mp_move_bol, mp_move_down, mp_move_eof, mp_move_eol, mp_move_left, mp_move_right, mp_move_to_visual_column, mp_move_up, mp_move_word_left, mp_move_word_right, mp_move_xy, mp_name_txt, mp_next_txt, mp_notify_stub, mp_over_char, mp_paste_mark, mp_peek_char, mp_prev_txt, mp_put_char, mp_put_str, mp_put_strf, mp_recalc_x, mp_reformat_paragraph, mp_replace, mp_save_file, mp_save_state, mp_seek, mp_seek_plain, mp_seek_regex, mp_set_notify, mp_set_password, mp_show_sys_txt, mp_shutdown, mp_sort, mp_startup, mp_unmark, mp_visual_column

mp_func.c

mpf_bind_key, mpf_call_func_by_funcname, mpf_desc_user_fn, mpf_get_desc_by_funcname, mpf_get_func_by_keyname, mpf_get_funcname_by_keyname, mpf_get_keyname_by_funcname, mpf_key_help, mpf_makeargs, mpf_new_user_fn, mpf_toggle_function_value

mp_iface.c

mpi_args_1, mpi_args_2, mpi_close, mpi_color_draw_all, mpi_completion, mpi_current_list, mpi_draw_all, mpi_exec, mpi_exec_function, mpi_find_tag, mpi_goto, mpi_grep, mpi_help, mpi_insert_template, mpi_move_page_down, mpi_move_page_up, mpi_move_wheel_down, mpi_move_wheel_up, mpi_new, mpi_open, mpi_play_macro, mpi_process, mpi_record_macro, mpi_replace, mpi_replace_all, mpi_save, mpi_save_as, mpi_seek, mpi_seek_next, mpi_set_tab_size, mpi_set_word_wrap, mpi_shutdown, mpi_startup, mpi_sync

mp_lang.c

L, mpl_set_language

mp_synhi.c

_wrd_cmp, _wrd_icmp, mps_auto_synhi, mps_enumerate_modes, mps_is_sep, mps_quoting, mps_set_override_mode, mps_startup, mps_word_color

mp_tags.c

mpt_open_tag, mpt_seek_tag, mpt_select_tag

mp_video.c

mpv_about, mpv_add_menu, mpv_add_menu_item, mpv_alert, mpv_args, mpv_char, mpv_check_menu, mpv_clipboard_to_system, mpv_confirm, mpv_cursor, mpv_filetabs, mpv_glob, mpv_goto, mpv_help, mpv_list, mpv_mainloop, mpv_menu, mpv_readline, mpv_refresh, mpv_scrollbar, mpv_set_variable, mpv_shutdown, mpv_startup_1, mpv_status_line, mpv_str, mpv_strcasecmp, mpv_suspend, mpv_syscmd, mpv_system_to_clipboard, mpv_title, mpv_usage, mpv_zoom

mp_wordp.c

mpw_spellcheck_word

mpv_curses.c

_mpv_create_colors, _mpv_open_file_list, _mpv_sigwinch, _mpv_title_status, mpv_notify

mpv_gtk.c

_mpv_create_colors

mpv_unix_common.c

_mpv_strip_cwd

mpv_win32.c

AboutDlgProc, ListDlgProc, TextDlgProc, WndProc, _mpv_init_fonts, _mpv_paint, mpv_akey, mpv_create_colors, mpv_vkey

Alphabetical

AboutDlgProc - Procedure for the about box
L - Translate a string
ListDlgProc - Procedure for the list input dialog
TextDlgProc - Procedure for text input dialog
WndProc - Main window callback.
_im_alive - The infamous spinning bar
_mp_active - Pointer to the active text
_mp_auto_indent - Auto indentation flag.
_mp_case_cmp - Case sensitive compare flag.
_mp_clipboard - Pointer to the clipboard
_mp_error - Bangs an error
_mp_save_tabs - Tab saving flag.
_mp_tab_size - Size (in spaces) of a tab character
_mp_txts - Chained list of texts
_mp_wheel_scroll_rows - Number of rows to scroll wheel wheel is rolled.
_mp_word_wrap - Column where the word wrapping is done.
_mpv_create_colors - Creates the colors defined in the color database
_mpv_create_colors - Creates the colors defined in the color database
_mpv_init_fonts - Starts up font stuff.
_mpv_open_file_list - Shows a list of files to open
_mpv_paint - Dump the frame buffer to screen.
_mpv_sigwinch - SIGWINCH capture function.
_mpv_strip_cwd - Strips current working directory
_mpv_title_status - Draws the title or status line.
_wrd_cmp - qsort compare function
_wrd_icmp - qsort compare function
mp_adjust - Adjusts the current window pointers.
mp_change_cursor - set the block where the cursor is
mp_copy_mark - Copies the selection block into the clipboard
mp_create_block - Creates a block
mp_create_sys_txt - Creates a new text
mp_create_txt - Creates a new text
mp_debug_hook - Dummy debug hook function.
mp_delete_char - Deletes a char.
mp_delete_line - Deletes current line.
mp_delete_mark - Deletes the marked selection block.
mp_delete_sys_txt - Deletes a text
mp_delete_txt - Deletes a text
mp_empty_txt - Empties a text
mp_end_tmp_txt - Stop using the temporal text
mp_find_text - Find a text by its name
mp_get_char - Gets the char at cursor and advances
mp_get_encryption_format - Tests if file is encrypted
mp_get_str - Gets a string from a text until a delimiter
mp_get_tmp_txt - Gets a temporal text
mp_get_word - Gets the word over the cursor.
mp_insert_char - Inserts a char in cursor position
mp_insert_line - Inserts a new line
mp_insert_tab - Inserts a tab
mp_is_sep - separator test
mp_load_file - Loads a file into the text.
mp_log - Logs to Minimum Profit's internal log
mp_mark - Marks the beginning or end of the selection block.
mp_mark_match - Marks (selects) the last successful match
mp_marked - Tests if selection block is marked.
mp_match_bracket - Matches the bracket over the cursor
mp_modified - Marks a text as modified
mp_move_bof - Moves to beginning of file
mp_move_bol - Move to the beginning of the line.
mp_move_down - Moves cursor one line down
mp_move_eof - Moves to end of file
mp_move_eol - Move to the end of the line.
mp_move_left - Moves cursor one char to the right
mp_move_right - Moves cursor one char to the right
mp_move_to_visual_column - Tries to recover a column position
mp_move_up - Moves cursor one line up
mp_move_word_left - Moves a word to the left.
mp_move_word_right - Moves a word to the right.
mp_move_xy - Moves to x, y position
mp_name_txt - Names a text
mp_next_txt - Select next text
mp_notify_stub - Dummy notify function
mp_over_char - Overwrites a char.
mp_paste_mark - Pastes the clipboard into cursor position.
mp_peek_char - Returns the character over the cursor
mp_prev_txt - Select previous text
mp_put_char - Writes a char.
mp_put_str - Writes a string.
mp_put_strf - Writes a string with formatting
mp_recalc_x - Recalculates txt->x
mp_reformat_paragraph - Reformats a paragraph using word-wrapping
mp_replace - Seeks and replaces a string.
mp_save_file - Writes the text into file
mp_save_state - Saves/restores current state
mp_seek - Seeks the string.
mp_seek_plain - Seeks the string as plain text.
mp_seek_regex - Seeks the string as a regular expression.
mp_set_notify - Sets the notify function.
mp_set_password - Assigns a password to a text
mp_show_sys_txt - Shows an internal (system) text
mp_shutdown - Shuts down the mp core.
mp_sort - Sorts a txt buffer
mp_startup - Starts up the mp core.
mp_unmark - Unmarks the selection block.
mp_visual_column - Returns the visual column
mpc_read_config - Reads and parses the configuration file
mpf_bind_key - Binds a key to a function
mpf_call_func_by_funcname - Calls a function by its name
mpf_desc_user_fn - Redefines a user function description
mpf_get_desc_by_funcname - Gets a function description by its name
mpf_get_func_by_keyname - Gets a function by the key bound to it
mpf_get_funcname_by_keyname - Returns the function name bound to a key
mpf_get_keyname_by_funcname - Returns the key bound to a function
mpf_key_help - Shows the key binding help to the user
mpf_makeargs - Splits a string into an argument list
mpf_new_user_fn - Create an user defined function
mpf_toggle_function_value - Returns the value of a toggle function
mpi_args_1 - Command line argument processing, 1st pass
mpi_args_2 - Command line argument processing, 2nd pass
mpi_close - Closes the text.
mpi_color_draw_all - Draws the document window using colors.
mpi_completion - Tries to complete a symbol
mpi_current_list - Shows a selection list with the opened files
mpi_draw_all - Draws the document window.
mpi_exec - Executes a command related to text.
mpi_exec_function - Executes an editor function
mpi_find_tag - Asks for a tag and finds it
mpi_goto - Moves to a line by its number
mpi_grep - Greps (searches text) in several files
mpi_help - Cries for help
mpi_insert_template - Shows a list with the available templates
mpi_move_page_down - Moves one page down
mpi_move_page_up - Moves one page up
mpi_move_wheel_down - Moves preferred number of rows down
mpi_move_wheel_up - Moves preferred number of rows up
mpi_new - Creates a new text
mpi_open - Loads a file.
mpi_play_macro - Plays the previously recorded macro
mpi_process - Main action processing function
mpi_record_macro - Starts/stops recording a macro
mpi_replace - Searchs and replaces a text
mpi_replace_all - Replaces a string in all open files
mpi_save - Saves the text.
mpi_save_as - Asks for a name for the text and save.
mpi_seek - Seeks a text
mpi_seek_next - Seeks a text again
mpi_set_tab_size - Asks for a tab size value
mpi_set_word_wrap - Asks for a word wrapping value
mpi_shutdown - Shutdown interface function.
mpi_startup - Startup interface function.
mpi_sync - Synchronizes the modified texts to disk
mpl_set_language - Sets the current language
mps_auto_synhi - Autodetects syntax hilight mode
mps_enumerate_modes - Returns the available synhi modes
mps_is_sep - separator test
mps_quoting - Test if we are inside quotes
mps_set_override_mode - Forces the syntax hilight mode
mps_startup - Syntax hilight engine startup
mps_word_color - returns the color associated to the word
mpt_open_tag - Selects a tag from a list and opens its location
mpt_seek_tag - Seeks a tag
mpt_select_tag - Selects from a list of tags given a partial string
mpv_about - Shows the 'About Minimum Profit...' information.
mpv_add_menu - Creates a new menu bar.
mpv_add_menu_item - Adds a menu item to current menu bar.
mpv_akey - Converts ascii keys to key names.
mpv_alert - Alerts the user.
mpv_args - Driver command line argument processing
mpv_char - Draws a char with color in the document window.
mpv_check_menu - Checks or unchecks a menu item
mpv_clipboard_to_system - Copies to the system clipboard
mpv_confirm - Asks for confirmation.
mpv_create_colors - Creates the colors defined in the color database
mpv_cursor - Positions the hardware cursor.
mpv_filetabs - Draws the tab set containing the file names
mpv_glob - Returns a result of a file globbing
mpv_goto - Positions the cursor to start drawing.
mpv_help - Shows the available help for a term
mpv_list - Manages a selection list
mpv_mainloop - Main message processing loop.
mpv_menu - Manages the menu.
mpv_notify - The notify function.
mpv_readline - Ask for user input.
mpv_refresh - Refresh the screen.
mpv_scrollbar - Draws / updates the scrollbar.
mpv_set_variable - Sets a driver-dependent variable
mpv_shutdown - Shuts down the system dependent driver.
mpv_startup_1 - Finds a usable video driver
mpv_status_line - Sets the string to be drawn as status line
mpv_str - Draws a string with color in the document window.
mpv_strcasecmp - Case ignoring string compare
mpv_suspend - Suspend the system dependant driver
mpv_syscmd - System dependant command execution
mpv_system_to_clipboard - Copies from the system clipboard
mpv_title - Sets the string to be drawn as title
mpv_usage - Prints the usage help.
mpv_vkey - Converts Windows keys to key names.
mpv_zoom - Zooms the document window.
mpw_spellcheck_word - Tests if a word is correctly spelled

AboutDlgProc

Top

Name

AboutDlgProc - Procedure for the about box

Synopsis

BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);

Arguments

hwnd
the window handler
msg
the message sent
wparam
the word param
lparam
the long word param

Description

Procedure for the about box. Called from inside MS Windows.


L

Top

Name

L - Translate a string

Synopsis

char * L(char * msgid);

Arguments

msgid
the string to be translated

Description

Translate msgid using the current language info. If no translation string is found, the same msgid is returned.


ListDlgProc

Top

Name

ListDlgProc - Procedure for the list input dialog

Synopsis

BOOL CALLBACK ListDlgProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);

Arguments

hwnd
the window handler
msg
the message sent
wparam
the word param
lparam
the long word param

Description

Procedure for list input dialog. Called from inside MS Windows.


TextDlgProc

Top

Name

TextDlgProc - Procedure for text input dialog

Synopsis

BOOL CALLBACK TextDlgProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);

Arguments

hwnd
the window handler
msg
the message sent
wparam
the word param
lparam
the long word param

Description

Procedure for text input dialog. Called from inside MS Windows.


WndProc

Top

Name

WndProc - Main window callback.

Synopsis

long STDCALL WndProc(HWND hwnd, UINT msg, UINT wparam, LONG lparam);

Arguments

hwnd
the window handler
msg
the message
wparam
the word param
lparam
the long word param

Description

Main window callback.


_im_alive

Top

Name

_im_alive - The infamous spinning bar

Synopsis

char * _im_alive(void);

Description

Each time it's called, this function returns a string with a frame of an animated spinning bar. Just to show the user the program is alive.


_mp_active

Top

Name

_mp_active - Pointer to the active text

Synopsis

mp_txt * _mp_active=NULL;

Description

Pointer to the active text. Assumed to be always non-NULL.


_mp_auto_indent

Top

Name

_mp_auto_indent - Auto indentation flag.

Synopsis

int _mp_auto_indent=AUTO_INDENT;

Description

If this flag is set, a new line will have the same spaces at the beginning as the previous one, if any. Otherwise, a new line will start always exactly at the first column.


_mp_case_cmp

Top

Name

_mp_case_cmp - Case sensitive compare flag.

Synopsis

int _mp_case_cmp=1;

Description

When this flag is set, searches are made case sensitive.


_mp_clipboard

Top

Name

_mp_clipboard - Pointer to the clipboard

Synopsis

mp_txt * _mp_clipboard=NULL;

Description

Pointer to a text containing the clipboard. Used for copying and pasting.


_mp_error

Top

Name

_mp_error - Bangs an error

Synopsis

void _mp_error(char * s, int line);

Arguments

s
The error string
line
the code file line number

Description

Dumps an error to stdout. Usually called only from an assert-like macro on a probably fatal internal error. It must not happen; this usually means that it will be called when less expected.


_mp_save_tabs

Top

Name

_mp_save_tabs - Tab saving flag.

Synopsis

int _mp_save_tabs=1;

Description

If this flag is set, a string of spaces that crosses a tab column boundary will be saved as a tab. Otherwise, the spaces themselves will be saved.


_mp_tab_size

Top

Name

_mp_tab_size - Size (in spaces) of a tab character

Synopsis

int _mp_tab_size=DEFAULT_TAB_SIZE;

Description

Size in spaces of each tab column position.


_mp_txts

Top

Name

_mp_txts - Chained list of texts

Synopsis

mp_txt * _mp_txts=NULL;

Description

The chained list of texts. This is where all the document texts are stored.


_mp_wheel_scroll_rows

Top

Name

_mp_wheel_scroll_rows - Number of rows to scroll wheel wheel is rolled.

Synopsis

int _mp_wheel_scroll_rows=DEFAULT_WHEEL_SCROLL_ROWS;

Description

Rolling the wheel scrolls this number of line up or down. A value of 0, will scroll a full page.


_mp_word_wrap

Top

Name

_mp_word_wrap - Column where the word wrapping is done.

Synopsis

int _mp_word_wrap=0;

Description

Any word crossing the column boundary marked by this variable will be sent to the next line. A value of 0 means no word wrapping (so right margin expands forever).


_mpv_create_colors

Top

Name

_mpv_create_colors - Creates the colors defined in the color database

Synopsis

static void _mpv_create_colors(void);

Description

Creates the colors defined in the color database, probably set from the configuration file.


_mpv_init_fonts

Top

Name

_mpv_init_fonts - Starts up font stuff.

Synopsis

static void _mpv_init_fonts(HDC hdc);

Arguments

hdc
the device context

Description

Starts up font stuff.


_mpv_open_file_list

Top

Name

_mpv_open_file_list - Shows a list of files to open

Synopsis

static int _mpv_open_file_list(char * rcpt);

Arguments

rcpt
buffer to receive the selected file

Description

Asks for a file scheme and shows a list of files matching it. Returns the pushed key to exit ('\r' or '\e'). If no or just one file is matched, '\r' is also returned. The selected file will be written into the rcpt buffer. This is an ugly hack: it will be rewritten sooner or later.


_mpv_paint

Top

Name

_mpv_paint - Dump the frame buffer to screen.

Synopsis

static void _mpv_paint(HWND hwnd);

Arguments

hwnd
the window handler

Description

Dumps the document window frame buffer to the window.


_mpv_sigwinch

Top

Name

_mpv_sigwinch - SIGWINCH capture function.

Synopsis

static void _mpv_sigwinch(int s);

Arguments

s
signal

Description

The capture function for the SIGWINCH signal, raised whenever a window resize has been done (from i.e. xterm).


_mpv_strip_cwd

Top

Name

_mpv_strip_cwd - Strips current working directory

Synopsis

void _mpv_strip_cwd(char * buf, int size);

Arguments

buf
buffer containing a file name
size
size of the buffer

Description

If the file name contained in buf begins with the current working directory, strips it (effectively converting an absolute pathname to relative). If the file name path is different from the current working directory, nothing is done.


_mpv_title_status

Top

Name

_mpv_title_status - Draws the title or status line.

Synopsis

static void _mpv_title_status(int y, unsigned char * str1,
	unsigned char * str2);

Arguments

y
the y position
str1
first string
str2
second (optional) string

Description

Draws the title or status line with str1 and, if defined, concatenates str2. The y variable indicates the vertical position where the line will be drawn. It is filled with spaces to the right margin (internal).


_wrd_cmp

Top

Name

_wrd_cmp - qsort compare function

Synopsis

static int _wrd_cmp(const void * s1, const void * s2);

Arguments

s1
first string
s2
second string

Description

Compare function (qsort and bsearch) to search a word. Returns -1, 0, or 1. Internal (do not use).


_wrd_icmp

Top

Name

_wrd_icmp - qsort compare function

Synopsis

static int _wrd_icmp(const void * s1, const void * s2);

Arguments

s1
first string
s2
second string

Description

Compare function (qsort and bsearch) to search a word. Case insensitive version. Returns -1, 0, or 1. Internal (do not use).


mp_adjust

Top

Name

mp_adjust - Adjusts the current window pointers.

Synopsis

void mp_adjust(mp_txt * txt, int tx, int ty);

Arguments

txt
the text
tx
the current window width
ty
the current window height

Description

Adjust the current window pointers (variables vx and vy of the text) to a window of tx width and ty height so that the cursor is visible.


mp_change_cursor

Top

Name

mp_change_cursor - set the block where the cursor is

Synopsis

static int mp_change_cursor(mp_txt * txt, mp_blk * blk);

Arguments

txt
the text to be changed
blk
the block where the cursor is

Description

Sets the block where the cursor is over. This function is internal and must not be used.


mp_copy_mark

Top

Name

mp_copy_mark - Copies the selection block into the clipboard

Synopsis

int mp_copy_mark(mp_txt * txt);

Arguments

txt
the text

Description

Copies the selection block into the internal clipboard. Returns 0 if the selection block is not marked.


mp_create_block

Top

Name

mp_create_block - Creates a block

Synopsis

static mp_blk * mp_create_block(void);

Description

Creates a new block of text. Returns the zero filled block or NULL if out of memory or any other horrible event.


mp_create_sys_txt

Top

Name

mp_create_sys_txt - Creates a new text

Synopsis

mp_txt * mp_create_sys_txt(char * name);

Arguments

name
the name of the new text

Description

Returns a new text with its first block, or NULL if out of memory. The new text is NOT appended to the active texts list; this function must only be used to create special-purpose texts (as the clipboard).


mp_create_txt

Top

Name

mp_create_txt - Creates a new text

Synopsis

mp_txt * mp_create_txt(char * name);

Arguments

name
the name of the new text

Description

Creates a new text and links it to the list of loaded texts. Returns a pointer to it or NULL if out of memory. The new text is set as the active one.


mp_debug_hook

Top

Name

mp_debug_hook - Dummy debug hook function.

Synopsis

void mp_debug_hook(void);

Description

This function does nothing. It is just defined to be inserted as a breakpoint for the debugger.


mp_delete_char

Top

Name

mp_delete_char - Deletes a char.

Synopsis

int mp_delete_char(mp_txt * txt);

Arguments

txt
the text

Description

Deletes the character in cursor position. Returns 0 if character could not be deleted (readonly text, errors, etc).


mp_delete_line

Top

Name

mp_delete_line - Deletes current line.

Synopsis

int mp_delete_line(mp_txt * txt);

Arguments

txt
the text

Description

Deletes current line. Returns 0 if the line could not be deleted (readonly text, errors, etc).


mp_delete_mark

Top

Name

mp_delete_mark - Deletes the marked selection block.

Synopsis

int mp_delete_mark(mp_txt * txt);

Arguments

txt
the text

Description

Deletes the marked selection block. It is done by deleting char by char and this is slow; an optimized version (releasing entire blocks) should be written. Returns 0 if text is read-only or there is no marked selection block.


mp_delete_sys_txt

Top

Name

mp_delete_sys_txt - Deletes a text

Synopsis

void mp_delete_sys_txt(mp_txt * txt);

Arguments

txt
the text to be deleted

Description

Destroys a text and its blocks. Only to be used in special-purpose texts (that returned by mp_create_sys_txt()).


mp_delete_txt

Top

Name

mp_delete_txt - Deletes a text

Synopsis

void mp_delete_txt(mp_txt * txt);

Arguments

txt
the text to be deleted

Description

Deletes a text and its blocks. The next one in the list (if any) will become the active one.


mp_empty_txt

Top

Name

mp_empty_txt - Empties a text

Synopsis

void mp_empty_txt(mp_txt * txt);

Arguments

txt
the text

Description

Empties a text, cleaning all content.


mp_end_tmp_txt

Top

Name

mp_end_tmp_txt - Stop using the temporal text

Synopsis

void mp_end_tmp_txt(void);

Description

Stop using the temporal copy returned by mp_get_tmp_txt(). Now it's just a dummy.


mp_find_text

Top

Name

mp_find_text - Find a text by its name

Synopsis

mp_txt * mp_find_txt(char * name);

Arguments

name
The name of the text to be found

Description

Returns a pointer to a text if found, or NULL if there is no text with this name.


mp_get_char

Top

Name

mp_get_char - Gets the char at cursor and advances

Synopsis

int mp_get_char(mp_txt * txt);

Arguments

txt
the text

Description

Returns the char over the cursor and advances to the right. Returns '\0' at EOF.


mp_get_encryption_format

Top

Name

mp_get_encryption_format - Tests if file is encrypted

Synopsis

int mp_get_encryption_format(FILE * f);

Arguments

f
the file stream

Description

Returns the encryption format of the open file f. 0 means an unencrypted one (ordinary text file). In any case, the file pointer is left to the start of the actual file data (i.e., after any possible signatures). By now, only types 0 (unencrypted) or 1 (ARCFOUR algorithm encryption) are implemented.


mp_get_str

Top

Name

mp_get_str - Gets a string from a text until a delimiter

Synopsis

int mp_get_str(mp_txt * txt, char * str, int maxsize, int delim);

Arguments

txt
the text
str
the buffer where the string is get
maxsize
maximum size of buffer
delim
the delimiter to be found

Description

Gets a string from a text until the delimiter is found or the maximum size of buffer is reached. Returns the number of chars written into str.


mp_get_tmp_txt

Top

Name

mp_get_tmp_txt - Gets a temporal text

Synopsis

mp_txt * mp_get_tmp_txt(mp_txt * otxt);

Arguments

otxt
the original text

Description

Returns a text that is a copy of otxt.


mp_get_word

Top

Name

mp_get_word - Gets the word over the cursor.

Synopsis

void mp_get_word(mp_txt * txt, char * buf, int size);

Arguments

txt
the text
buf
the buffer to hold the word
size
maximum size of the buffer

Description

Gets the word over the cursor and writes it over the buffer, using the global word separators.


mp_insert_char

Top

Name

mp_insert_char - Inserts a char in cursor position

Synopsis

int mp_insert_char(mp_txt * txt, int c);

Arguments

txt
the text
c
the char

Description

Inserts a character, moving forward the cursor position. Returns 0 if character could not be inserted (readonly text, errors, etc).


mp_insert_line

Top

Name

mp_insert_line - Inserts a new line

Synopsis

int mp_insert_line(mp_txt * txt);

Arguments

txt
the text

Description

Inserts a new line, taking account of indentations and unmarking the (possible) block.


mp_insert_tab

Top

Name

mp_insert_tab - Inserts a tab

Synopsis

int mp_insert_tab(mp_txt * txt);

Arguments

txt
the text

Description

Inserts a tab, moving forward the cursor position. Returns 0 if character could not be inserted (readonly text, errors, etc).


mp_is_sep

Top

Name

mp_is_sep - separator test

Synopsis

int mp_is_sep(char c);

Arguments

c
the char to test

Description

Returns 1 if c is a word separator.


mp_load_file

Top

Name

mp_load_file - Loads a file into the text.

Synopsis

int mp_load_file(mp_txt * txt, FILE * f);

Arguments

txt
the text
f
the file

Description

Loads a file into the text. Returns 0 if some character could not be put (readonly text, errors, etc).


mp_log

Top

Name

mp_log - Logs to Minimum Profit's internal log

Synopsis

void mp_log(char * <...class='funcarg'>..., ...);

Arguments

fmt
printf() like format string
...
variable list of arguments

Description

Writes a formatted string to the internal log txt.


mp_mark

Top

Name

mp_mark - Marks the beginning or end of the selection block.

Synopsis

void mp_mark(mp_txt * txt);

Arguments

txt
the text

Description

Marks the current cursor position as the beginning or the end of the selection block. Both boundaries can be reselected.


mp_mark_match

Top

Name

mp_mark_match - Marks (selects) the last successful match

Synopsis

int mp_mark_match(mp_txt * txt);

Arguments

txt
the text

Description

Marks (as a block) the last successful match.


mp_marked

Top

Name

mp_marked - Tests if selection block is marked.

Synopsis

int mp_marked(mp_txt * txt);

Arguments

txt
the text

Description

Returns 1 if a selection block is marked.


mp_match_bracket

Top

Name

mp_match_bracket - Matches the bracket over the cursor

Synopsis

void mp_match_bracket(mp_txt * txt, int max);

Arguments

txt
the text
max
maximum characters to search (-1, no limit)

Description

If the cursor is over an opening bracket (round, square or curly) of over a closing one, this function sets the internal brx and bry of txt with the position of the twin matching bracket, searching forward or backwards, respectively. A maximum of max characters will be tested, unless set to -1, where the full text will be scanned.


mp_modified

Top

Name

mp_modified - Marks a text as modified

Synopsis

void mp_modified(mp_txt * txt);

Arguments

txt
the text

Description

Marks a text as modified.


mp_move_bof

Top

Name

mp_move_bof - Moves to beginning of file

Synopsis

int mp_move_bof(mp_txt * txt);

Arguments

txt
the text

Description

Moves to the beginning of the file.


mp_move_bol

Top

Name

mp_move_bol - Move to the beginning of the line.

Synopsis

int mp_move_bol(mp_txt * txt);

Arguments

txt
the text

Description

Moves to the beginning of the current line.


mp_move_down

Top

Name

mp_move_down - Moves cursor one line down

Synopsis

int mp_move_down(mp_txt * txt);

Arguments

txt
the text

Description

Moves the cursor one line down. Returns 0 if the movement could not be done (i.e., at EOF). The x position is preserved if possible.


mp_move_eof

Top

Name

mp_move_eof - Moves to end of file

Synopsis

int mp_move_eof(mp_txt * txt);

Arguments

txt
the text

Description

Moves to the last line of the file. If the last line doesn't end in a new line, the cursor may not actually be at the end of file; use mp_move_eol() after it to be sure.


mp_move_eol

Top

Name

mp_move_eol - Move to the end of the line.

Synopsis

int mp_move_eol(mp_txt * txt);

Arguments

txt
the text

Description

Moves to the end of the current line.


mp_move_left

Top

Name

mp_move_left - Moves cursor one char to the right

Synopsis

int mp_move_left(mp_txt * txt);

Arguments

txt
the text

Description

Moves the cursor one char to the left. Returns 0 if the movement could not be done (i.e., at BOF). If it moves to the left of the first column, moves to the end of the previous line.


mp_move_right

Top

Name

mp_move_right - Moves cursor one char to the right

Synopsis

int mp_move_right(mp_txt * txt);

Arguments

txt
the text

Description

Moves the cursor one char to the right. Returns 0 if the movement could not be done (i.e., at EOF). If cursor moves over the end of line, it moves to the beginning of the next line.


mp_move_to_visual_column

Top

Name

mp_move_to_visual_column - Tries to recover a column position

Synopsis

void mp_move_to_visual_column(mp_txt * txt, int r);

Arguments

txt
the text
r
the position

Description

Tries to move to the r visual column position, taking tabs into account.


mp_move_up

Top

Name

mp_move_up - Moves cursor one line up

Synopsis

int mp_move_up(mp_txt * txt);

Arguments

txt
the text

Description

Moves the cursor one line up. Returns 0 if the movement could not be done (i.e., at BOF). The x position is preserved if possible.


mp_move_word_left

Top

Name

mp_move_word_left - Moves a word to the left.

Synopsis

int mp_move_word_left(mp_txt * txt);

Arguments

txt
the text

Description

Moves the cursor one word to the left. Returns 0 if the movement could not be done (i.e., at BOF).


mp_move_word_right

Top

Name

mp_move_word_right - Moves a word to the right.

Synopsis

int mp_move_word_right(mp_txt * txt);

Arguments

txt
the text

Description

Moves the cursor one word to the right. Returns 0 if the movement could not be done (i.e., at EOF).


mp_move_xy

Top

Name

mp_move_xy - Moves to x, y position

Synopsis

int mp_move_xy(mp_txt * txt, int x, int y);

Arguments

txt
the text
x
the new x position
y
the new y position

Description

Sets the cursor position of text to x, y. Returns 0 if the movement cannot be done.


mp_name_txt

Top

Name

mp_name_txt - Names a text

Synopsis

void mp_name_txt(mp_txt * txt, char * name);

Arguments

txt
The text to be named
name
the name to set

Description

Assigns name to a text. This usually is the file name. If name is NULL, the empty string will be set.


mp_next_txt

Top

Name

mp_next_txt - Select next text

Synopsis

void mp_next_txt(void);

Description

Selects the next text as the active one.


mp_notify_stub

Top

Name

mp_notify_stub - Dummy notify function

Synopsis

static void mp_notify_stub(char * str);

Arguments

str
message (ignored)

Description

_mp_notify points here at startup. The upper level must provide a function (with this prototype), that will be called from within the engine when a message must be notified to the user (str will be that message).


mp_over_char

Top

Name

mp_over_char - Overwrites a char.

Synopsis

int mp_over_char(mp_txt * txt, char c);

Arguments

arg
the text
c
the char

Description

Overwrites current char, moving forward the cursor position. Returns 0 if character could not be written (readonly text, errors, etc).


mp_paste_mark

Top

Name

mp_paste_mark - Pastes the clipboard into cursor position.

Synopsis

int mp_paste_mark(mp_txt * txt);

Arguments

txt
the text

Description

Pastes the clipboard into cursor position. Returns 0 if text is read-only or if there is no clipboard to paste.


mp_peek_char

Top

Name

mp_peek_char - Returns the character over the cursor

Synopsis

int mp_peek_char(mp_txt * txt);

Arguments

txt
the text

Description

Returns the character over the cursor without moving it. If the cursor is at EOF, '\0' is returned.


mp_prev_txt

Top

Name

mp_prev_txt - Select previous text

Synopsis

void mp_prev_txt(void);

Description

Selects the previous text as the active one.


mp_put_char

Top

Name

mp_put_char - Writes a char.

Synopsis

int mp_put_char(mp_txt * txt, int c, int insert);

Arguments

arg
the text
c
the char
insert
current insert status

Description

Inserts or overwrites a character, depending of the insert status. Also manages word wrapping, tabs and newlines. Main character writing function. Returns 0 if character could not be put (readonly text, errors, etc).


mp_put_str

Top

Name

mp_put_str - Writes a string.

Synopsis

int mp_put_str(mp_txt * txt, char * str, int insert);

Arguments

txt
the text
str
the string
insert
current insert status

Description

Writes a string, calling mp_put_char() for each character. Returns 0 if any character could not be put (readonly text, errors, etc).


mp_put_strf

Top

Name

mp_put_strf - Writes a string with formatting

Synopsis

int mp_put_strf(mp_txt * txt, char * fmt, ...);

Arguments

txt
the text
fmt
the format string

Description

Writes a string into txt, using fmt as a formatting printf()-like string.


mp_recalc_x

Top

Name

mp_recalc_x - Recalculates txt->x

Synopsis

void mp_recalc_x(mp_txt * txt);

Arguments

txt
the text

Description

Recalculates the value of the x cursor position. Only called internally.


mp_reformat_paragraph

Top

Name

mp_reformat_paragraph - Reformats a paragraph using word-wrapping

Synopsis

void mp_reformat_paragraph(mp_txt * txt);

Arguments

txt
the text

Description

Cuts current paragraph (i.e. a block of text delimited by two blank lines), and reformats it using word-wrapping. If word-wrapping is not active, nothing is done.


mp_replace

Top

Name

mp_replace - Seeks and replaces a string.

Synopsis

int mp_replace(mp_txt * txt, char * src, char * des);

Arguments

txt
the text
src
the string to be searched.
des
the string to replace src.

Description

Seeks a string and, if it is found, replaces it with another. Returns 0 if the text is read-only or the string is not found.


mp_save_file

Top

Name

mp_save_file - Writes the text into file

Synopsis

int mp_save_file(mp_txt * txt, FILE * f);

Arguments

txt
the text
f
the file

Description

Writes the text into the file, previously opened for writing. Returns always 1 (no error checking is done).


mp_save_state

Top

Name

mp_save_state - Saves/restores current state

Synopsis

void mp_save_state(int state);

Arguments

state
state flag

Description

Saves (if state is > 0) or restores (state < 0) current state of word-wrapping and auto-indenting.


mp_seek

Top

Name

mp_seek - Seeks the string.

Synopsis

int mp_seek(mp_txt * txt, char * str);

Arguments

txt
the text
str
the string

Description

Seeks the string into text. If found, the cursor is moved there. Returns 1 if the string is found.


mp_seek_plain

Top

Name

mp_seek_plain - Seeks the string as plain text.

Synopsis

int mp_seek_plain(mp_txt * txt, char * str);

Arguments

txt
the text
str
the string

Description

Seeks the string into text. If found, the cursor is moved there. The string must be found as-is (i.e., it does not contain any special characters). Returns 1 if the string is found.


mp_seek_regex

Top

Name

mp_seek_regex - Seeks the string as a regular expression.

Synopsis

int mp_seek_regex(mp_txt * txt, char * str);

Arguments

txt
the text
str
the string

Description

Seeks the string into text. If found, the cursor is moved there. The string must be a GNU regular expression. Returns 1 if the string is found.


mp_set_notify

Top

Name

mp_set_notify - Sets the notify function.

Synopsis

void mp_set_notify(void (* func)(char *));

Arguments

func
the new notify function.

Description

The notify function is called from inside file loading and searching routines to inform the user about what is happening, sending a message in a character string. This function changes the current (dummy) one.


mp_set_password

Top

Name

mp_set_password - Assigns a password to a text

Synopsis

void mp_set_password(mp_txt * txt, char * passwd);

Arguments

txt
the text
passwd
the password

Description

Assigns a password to a text. Next time the text is loaded or saved, the password will be used to en/decrypt it.


mp_show_sys_txt

Top

Name

mp_show_sys_txt - Shows an internal (system) text

Synopsis

void mp_show_sys_txt(mp_txt * txt);

Arguments

txt
the system text

Description

Links to the 'visible' chain of normal (user) texts a internal (system) text, as the clipboard or the log. This make them be shown as read-only texts.


mp_shutdown

Top

Name

mp_shutdown - Shuts down the mp core.

Synopsis

void mp_shutdown(void);

Description

Shuts down the mp core. By now, it does nothing.


mp_sort

Top

Name

mp_sort - Sorts a txt buffer

Synopsis

void mp_sort(mp_txt *txt);

Arguments

txt
text to sort

Description

Sorts a buffer. If the mark is defined it will sort only the contents of the txt inside the mark


mp_startup

Top

Name

mp_startup - Starts up the mp core.

Synopsis

int mp_startup(void);

Description

Starts up the mp core. By now, it does nothing. Returns 1 is succesful.


mp_unmark

Top

Name

mp_unmark - Unmarks the selection block.

Synopsis

void mp_unmark(mp_txt * txt);

Arguments

txt
the text

Description

Unmarks the selection block.


mp_visual_column

Top

Name

mp_visual_column - Returns the visual column

Synopsis

int mp_visual_column(mp_txt * txt);

Arguments

txt
the text

Description

Returns the visual column where the cursor is, taking into account the possible tabs in the line. If there are no tabs in the line, the return value should be equal to txt->x.


mpc_read_config

Top

Name

mpc_read_config - Reads and parses the configuration file

Synopsis

static void _mpc_read_config(char * file, int level);

Description

Reads and parses the configuration file.


mpf_bind_key

Top

Name

mpf_bind_key - Binds a key to a function

Synopsis

int mpf_bind_key(char * key_name, char * func_name);

Arguments

key_name
name of the key to be bound
func_name
name of the function

Description

Binds a key to a function. func_name is the name of the function to be assigned, or if the key is to be unbounded. key_name is the name of the key, or if the function is to be bound to ALL keys (mainly thought to be used in combination with to clean all key bindings). Returns 0 if key_name or func_name is not a defined one, or 1 if the key was bound.


mpf_call_func_by_funcname

Top

Name

mpf_call_func_by_funcname - Calls a function by its name

Synopsis

int mpf_call_func_by_funcname(char *func_name,char **args);

Description

func_name: name of the function args: additional optional arguments to pass

Returns -1 for function not found, or the return value of the function being called with should correspond to: 0 for no change, 1 for redraw, 2 for update tabs and redraw.


mpf_desc_user_fn

Top

Name

mpf_desc_user_fn - Redefines a user function description

Synopsis

void mpf_desc_user_fn(char *func,char *desc);

Description

func: function name desc: command description

This function lets you change the description of a user defined function. Potentially for the purpose of localisation.


mpf_get_desc_by_funcname

Top

Name

mpf_get_desc_by_funcname - Gets a function description by its name

Synopsis

char * mpf_get_desc_by_funcname(char * func_name);

Arguments

func_name
name of the function

Description

Returns a pointer to the func_name description text, or NULL if it's not found.


mpf_get_func_by_keyname

Top

Name

mpf_get_func_by_keyname - Gets a function by the key bound to it

Synopsis

struct _mpf_functions * mpf_get_func_by_keyname(char * key_name);

Arguments

key_name
name of the key

Description

Returns a pointer to the function bound to the key_name, or NULL if no function is bound to that key name.


mpf_get_funcname_by_keyname

Top

Name

mpf_get_funcname_by_keyname - Returns the function name bound to a key

Synopsis

char * mpf_get_funcname_by_keyname(char * key_name);

Arguments

key_name
name of the key

Description

Returns the name of the function bound to the key_name, or NULL otherwise.


mpf_get_keyname_by_funcname

Top

Name

mpf_get_keyname_by_funcname - Returns the key bound to a function

Synopsis

char * mpf_get_keyname_by_funcname(char * func_name);

Arguments

func_name
name of the function

Description

Returns the name of the key bound to the function called func_name, or NULL of none is.


mpf_key_help

Top

Name

mpf_key_help - Shows the key binding help to the user

Synopsis

int mpf_key_help() /* DESC: Help on keys */;

Description

Shows the key binding help to the user.


mpf_makeargs

Top

Name

mpf_makeargs - Splits a string into an argument list

Synopsis

char **mpf_makeargs(char *str);

Description

str: string to split

Splits a string into an argument list. It is mindful of respecting double quotes and backslashes. Returns an array of pointers. The caller is responsible of freeing the returned pointer. Returns NULL on failure.


mpf_new_user_fn

Top

Name

mpf_new_user_fn - Create an user defined function

Synopsis

void mpf_new_user_fn(char *func,char *desc,char **args);

Description

func: function name desc: function description args: functions to execute

This function creates an user defined functions. User defined functions are sequence of functions that can be defined as function names and later bound to different keys or menu items.


mpf_toggle_function_value

Top

Name

mpf_toggle_function_value - Returns the value of a toggle function

Synopsis

int * mpf_toggle_function_value(char * func_name);

Arguments

func_name
name of the function

Description

Returns a pointer to an integer containing the boolean value of a toggle function, or NULL if func_name does not exist.


mpi_args_1

Top

Name

mpi_args_1 - Command line argument processing, 1st pass

Synopsis

int mpi_args_1(int argc, char * argv[]);

Arguments

argc
argument count
argv
the arguments

Description

First pass to argument processing, mainly on/off switches. Returns -1 if usage printing needed, -2 if version number, 0 otherwise.


mpi_args_2

Top

Name

mpi_args_2 - Command line argument processing, 2nd pass

Synopsis

int mpi_args_2(int argc, char * argv[]);

Arguments

argc
argument count
argv
the arguments

Description

Second pass to argument processing, commands and files to load. Returns -1 if an invalid mode is requested, -2 if non- existing tags are requested, 0 otherwise.


mpi_close

Top

Name

mpi_close - Closes the text.

Synopsis

int mpi_close(mp_txt * txt);

Arguments

txt
the text

Description

Closes the text. If it has changed, asks user if file must be saved; if ok, file is saved using mpi_save().


mpi_color_draw_all

Top

Name

mpi_color_draw_all - Draws the document window using colors.

Synopsis

void mpi_color_draw_all(mp_txt * txt);

Arguments

txt
the text

Description

Draws the document window, with syntax highlighting decorations and other colors, if applicable.


mpi_completion

Top

Name

mpi_completion - Tries to complete a symbol

Synopsis

int mpi_completion(mp_txt * txt);

Arguments

txt
the text

Description

Takes the word below the cursor and tries to find it in the tags. The matching tags are shown in a list, and the user is asked for selection; upon user confirmation, the word below the cursor is replaced by the selected tag.


mpi_current_list

Top

Name

mpi_current_list - Shows a selection list with the opened files

Synopsis

void mpi_current_list(void);

Description

Shows a selection list with the opened files. Selecting one of them makes it the active one.


mpi_draw_all

Top

Name

mpi_draw_all - Draws the document window.

Synopsis

void mpi_draw_all(mp_txt * txt);

Arguments

txt
the text

Description

Draws the document window.


mpi_exec

Top

Name

mpi_exec - Executes a command related to text.

Synopsis

int mpi_exec(mp_txt * txt, char *cmd);

Arguments

txt
the text
cmd
the command to execute

Description

Asks for a system command to be executed if none was specified in cmd. If the command is preceded by the | (pipe) char, the complete text is sent as the command's standard input; If the command is preceded by the < char, the standard output is displayed in a new read-only buffer. If the character following < is another <, then the text between a < > will be used as the buffer title. If the command is preceded by the @ char, the command is executed as a spawned. i.e. the command gets full control of the screen. Otherwise, the standard output of the command is written into cursor position.


mpi_exec_function

Top

Name

mpi_exec_function - Executes an editor function

Synopsis

int mpi_exec_function(void);

Description

Asks for an internal editor function name and executes it on the currently active text. Returns the function's exit code.


mpi_find_tag

Top

Name

mpi_find_tag - Asks for a tag and finds it

Synopsis

int mpi_find_tag(mp_txt * txt);

Arguments

txt
the text

Description

Asks for a tag and searches it. If tag is found, the file that has it is shown, or the user is informed otherwise.


mpi_goto

Top

Name

mpi_goto - Moves to a line by its number

Synopsis

int mpi_goto(mp_txt * txt);

Arguments

txt
the txt

Description

Asks for a line number and moves the cursor there.


mpi_grep

Top

Name

mpi_grep - Greps (searches text) in several files

Synopsis

int mpi_grep(void);

Description

Asks for a string and a file spec and scans the files searching for the string. A list with the search hits is shown, asking the user to select one; the file will be open (if necessary) and the cursor moved to the selected line.


mpi_help

Top

Name

mpi_help - Cries for help

Synopsis

int mpi_help(mp_txt * txt);

Arguments

txt
the text

Description

Takes the word below the cursor and asks the system for help.


mpi_insert_template

Top

Name

mpi_insert_template - Shows a list with the available templates

Synopsis

int mpi_insert_template(void);

Description

Shows a list with the available templates to select one. If ENTER is pressed, the template is inserted into cursor position.


mpi_move_page_down

Top

Name

mpi_move_page_down - Moves one page down

Synopsis

int mpi_move_page_down(mp_txt * txt);

Arguments

txt
the text

Description

Moves one page down.


mpi_move_page_up

Top

Name

mpi_move_page_up - Moves one page up

Synopsis

int mpi_move_page_up(mp_txt * txt);

Arguments

txt
the text

Description

Moves one page up.


mpi_move_wheel_down

Top

Name

mpi_move_wheel_down - Moves preferred number of rows down

Synopsis

int mpi_move_wheel_down(mp_txt * txt);

Arguments

txt
the text

Description

Moves preferred number of rows down. Moves a full page if preferred is 0 or greater than a page of rows.


mpi_move_wheel_up

Top

Name

mpi_move_wheel_up - Moves preferred number of rows up

Synopsis

int mpi_move_wheel_up(mp_txt * txt);

Arguments

txt
the text

Description

Moves preferred number of rows up. Moves a full page if preferred is 0 or greater than a page of rows.


mpi_new

Top

Name

mpi_new - Creates a new text

Synopsis

int mpi_new(void);

Description

Creates an empty unnamed text, unless an unnamed text already exists; in that case, it's made the current one.


mpi_open

Top

Name

mpi_open - Loads a file.

Synopsis

void mpi_open(char * name, int reopen);

Arguments

name
the file name.
reopen
if reopening is allowed.

Description

Opens a file and sets it as the current one, or otherwise communicates the error to the user.


mpi_play_macro

Top

Name

mpi_play_macro - Plays the previously recorded macro

Synopsis

void mpi_play_macro(void);

Description

Plays the previously recorded macro.


mpi_process

Top

Name

mpi_process - Main action processing function

Synopsis

int mpi_process(int c, char * key_name, char * func_name);

Arguments

c
character pressed
key_name
name of the key to process
func_name
name of the function to execute

Description

Main action processing function. If keyname is not null, the function associated to it is executed; else, if funcname is not null, the function with that name is executed; otherwise, the c character is inserted into the currently active text. Based upon the function return value, a complete or partial redraw is ordered to the underlying driver; other actions as macro processing or menu toggling are done.


mpi_record_macro

Top

Name

mpi_record_macro - Starts/stops recording a macro

Synopsis

void mpi_record_macro(void);

Description

Starts or stops recording a macro.


mpi_replace

Top

Name

mpi_replace - Searchs and replaces a text

Synopsis

int mpi_replace(mp_txt * txt);

Arguments

txt
the txt

Description

Asks for two strings, one to be searched and the other to replace the first one if found. It also asks if this replacement should be done to the end of the text. If found, the cursor is left there, or the user is informed otherwise.


mpi_replace_all

Top

Name

mpi_replace_all - Replaces a string in all open files

Synopsis

int mpi_replace_all(void);

Description

Asks for two strings, one to be searched and the other to replace the first one if found. The search+replace is performed onto all the currently open texts. No information is shown to the user.


mpi_save

Top

Name

mpi_save - Saves the text.

Synopsis

int mpi_save(mp_txt * txt);

Arguments

txt
the text

Description

Saves the text. If it already has a name, saves directly to disk, otherwise asks for one using mpi_save_as().


mpi_save_as

Top

Name

mpi_save_as - Asks for a name for the text and save.

Synopsis

int mpi_save_as(mp_txt * txt);

Arguments

txt
the text

Description

Asks for a name for the text and saves it. If the text already has a name, it is replaced. On error, communicates it to the user.


mpi_seek

Top

Name

mpi_seek - Seeks a text

Synopsis

int mpi_seek(mp_txt * txt);

Arguments

txt
the text

Description

Asks for a string to be searched and searches the text, positioning the cursor there if it's found or signalling the user otherwise.


mpi_seek_next

Top

Name

mpi_seek_next - Seeks a text again

Synopsis

int mpi_seek_next(mp_txt * txt);

Arguments

txt
the text

Description

Seeks again the previously entered string in a text, positioning the cursor there if it's found or signalling the user otherwise.


mpi_set_tab_size

Top

Name

mpi_set_tab_size - Asks for a tab size value

Synopsis

int mpi_set_tab_size(void);

Description

Asks for a tab size value and sets it.


mpi_set_word_wrap

Top

Name

mpi_set_word_wrap - Asks for a word wrapping value

Synopsis

int mpi_set_word_wrap(void);

Description

Asks for a word wrapping value and sets it.


mpi_shutdown

Top

Name

mpi_shutdown - Shutdown interface function.

Synopsis

void mpi_shutdown(void);

Description

Shuts down the interface.


mpi_startup

Top

Name

mpi_startup - Startup interface function.

Synopsis

void mpi_startup(void);

Description

Starts up the interface.


mpi_sync

Top

Name

mpi_sync - Synchronizes the modified texts to disk

Synopsis

void mpi_sync(void);

Description

Synchonizes the modified texts saving its contents to disk.


mpl_set_language

Top

Name

mpl_set_language - Sets the current language

Synopsis

void mpl_set_language(char * langname);

Arguments

langname
name of the language to be set

Description

Sets the current language for language-dependent strings. The langname can be a two letter standard or the english name for the language. If the required language is not found in the internal database, english is set.


mps_auto_synhi

Top

Name

mps_auto_synhi - Autodetects syntax hilight mode

Synopsis

void mps_auto_synhi(mp_txt * txt);

Arguments

txt
text to inspect

Description

Tries to detect the type of the document in txt by the file extension and the content in the first lines. If a type is matched, internal synhi index txt->synhi is set.


mps_enumerate_modes

Top

Name

mps_enumerate_modes - Returns the available synhi modes

Synopsis

char * mps_enumerate_modes(void);

Description

Returns a pointer to a static buffer containing the names, concatenated by spaces, of the available syntax hilighters.


mps_is_sep

Top

Name

mps_is_sep - separator test

Synopsis

int mps_is_sep(char c, int synhi);

Arguments

c
character to test
synhi
syntax highlighter index

Description

Tests if c is a character separator. If no synhi is defined or the synhi separators are set to NULL, mp_is_sep() is used. Returns 1 if it is.


mps_quoting

Top

Name

mps_quoting - Test if we are inside quotes

Synopsis

int mps_quoting(int c, int color, int synhi);

Arguments

c
character to test
color
color previously calculated
synhi
syntax hilighter index

Description

If current text is between quotes, returns the quoting color.


mps_set_override_mode

Top

Name

mps_set_override_mode - Forces the syntax hilight mode

Synopsis

int mps_set_override_mode(char * mode);

Arguments

mode
mode name to set

Description

Forces the syntax hilight to be the one named as mode. If mode is not found, 0 is returned.


mps_startup

Top

Name

mps_startup - Syntax hilight engine startup

Synopsis

void mps_startup(void);

Description

Initializes the syntax highlighting engine.


mps_word_color

Top

Name

mps_word_color - returns the color associated to the word

Synopsis

int mps_word_color(int synhi, char * word, int col, int line);

Arguments

synhi
syntax hilighter index
word
the word to search
col
first column of word
line
the line being drawn

Description

Returns the color associated to the word, or MP_COLOR_NORMAL if the word has nothing special.


mpt_open_tag

Top

Name

mpt_open_tag - Selects a tag from a list and opens its location

Synopsis

void mpt_open_tag(char * partial_tag);

Arguments

partial_tag
Partial tag string to search

Description

Shows a list of tags matching partial_tag and, if the user selects one, it's opened.


mpt_seek_tag

Top

Name

mpt_seek_tag - Seeks a tag

Synopsis

struct tag_index * mpt_seek_tag(char * tag);

Arguments

tag
tag to be search

Description

Seeks a tag. Returns the structure defining the tag, or NULL if the tag is not found.


mpt_select_tag

Top

Name

mpt_select_tag - Selects from a list of tags given a partial string

Synopsis

struct tag_index * mpt_select_tag(char * partial_tag);

Arguments

partial_tag
Partial tag string to search

Description

Makes a partial seek in the tag database and shows a list for the user to select a tag. If no tag is found, an error message is shown and NULL returned; if the user cancel on the list, NULL is also returned. Otherwise, a struct tag_index is returned.


mpv_about

Top

Name

mpv_about - Shows the 'About Minimum Profit...' information.

Synopsis

void mpv_about(void);

Description

Shows a text or dialog box showing the information about the program, version and such.


mpv_add_menu

Top

Name

mpv_add_menu - Creates a new menu bar.

Synopsis

void mpv_add_menu(char * label);

Arguments

label
the label

Description

Creates a new menu bar.


mpv_add_menu_item

Top

Name

mpv_add_menu_item - Adds a menu item to current menu bar.

Synopsis

void mpv_add_menu_item(char * f);

Arguments

f
the name of the function to invoke

Description

Adds a menu item to the current menu bar.


mpv_akey

Top

Name

mpv_akey - Converts ascii keys to key names.

Synopsis

static void _mpv_akey(int k);

Arguments

k
the key

Description

Converts ascii keys to key names.


mpv_alert

Top

Name

mpv_alert - Alerts the user.

Synopsis

void mpv_alert(char * m1, char * m2);

Arguments

m1
the alert message
m2
a possible second message.

Description

Alerts the user by showing the message and asking for validation.


mpv_args

Top

Name

mpv_args - Driver command line argument processing

Synopsis

int mpv_args(int argc, char * argv[]);

Arguments

argc
argument count
argv
the arguments

Description

Driver dependent argument processing, after video driver is initialised. Called from within mpi_args_2().


mpv_char

Top

Name

mpv_char - Draws a char with color in the document window.

Synopsis

void mpv_char(int c, int color);

Arguments

c
the char
color
the color (one of MP_COLOR_ constants)

Description

Draws a char with color in current cursor position of the document window.


mpv_check_menu

Top

Name

mpv_check_menu - Checks or unchecks a menu item

Synopsis

void mpv_check_menu(char * f, int t);

Arguments

f
function name which menu item should be (un)checked
t
boolean value

Description

Checks or unchecks the menu item that executes funcname.


mpv_clipboard_to_system

Top

Name

mpv_clipboard_to_system - Copies to the system clipboard

Synopsis

void mpv_clipboard_to_system(void);

Description

Copies the clipboard's content from Minimum Profit to the underlying system's one.


mpv_confirm

Top

Name

mpv_confirm - Asks for confirmation.

Synopsis

int mpv_confirm(char * prompt);

Arguments

prompt
the question to ask

Description

Asks for confirmation. Returns 1 if choosen 'yes'.


mpv_create_colors

Top

Name

mpv_create_colors - Creates the colors defined in the color database

Synopsis

static void _mpv_create_colors(void);

Description

Creates the colors defined in the color database, probably set from the configuration file.


mpv_cursor

Top

Name

mpv_cursor - Positions the hardware cursor.

Synopsis

void mpv_cursor(int x, int y);

Arguments

x
the real x position
y
the real y position

Description

Sets the hardware cursor to x, y position.


mpv_filetabs

Top

Name

mpv_filetabs - Draws the tab set containing the file names

Synopsis

void mpv_filetabs(void);

Description

Draws the names of the opened files in the form of a tab set.


mpv_glob

Top

Name

mpv_glob - Returns a result of a file globbing

Synopsis

mp_txt * mpv_glob(char * spec);

Arguments

spec
the file pattern

Description

Executes a file globbing using spec as a pattern and returns a mp_txt containing the files matching the glob.


mpv_goto

Top

Name

mpv_goto - Positions the cursor to start drawing.

Synopsis

void mpv_goto(int x, int y);

Arguments

x
the x position
y
the y position

Description

Positions the cursor to start drawing the document window.


mpv_help

Top

Name

mpv_help - Shows the available help for a term

Synopsis

int mpv_help(char * term, int synhi);

Arguments

term
the term
synhi
the syntax highlighter

Description

Shows the available help for the term. The argument filetype is a string describing the file type, taken from the syntax hilighter (this allows to retrieve the help from different sources for C or Perl code, for example). Returns 0 on error or if no help is available for this term.


mpv_list

Top

Name

mpv_list - Manages a selection list

Synopsis

int mpv_list(char * title, mp_txt * txt, int pos);

Arguments

title
the title or caption of the list
txt
the text containing the list to show
pos
element to be set by default

Description

Shows a unique element selection list to the user. The list must be previously built into txt. Returns the selected element (the number of the line where the element is) or -1 on cancellation.


mpv_mainloop

Top

Name

mpv_mainloop - Main message processing loop.

Synopsis

void mpv_main_loop(void);

Description

Main message processing loop.


mpv_menu

Top

Name

mpv_menu - Manages the menu.

Synopsis

int mpv_menu(void);

Description

Manages the menu (drawing it, if applicable). Returns the key associated to the activated menu item, or 0 if none was.


mpv_notify

Top

Name

mpv_notify - The notify function.

Synopsis

static void mpv_notify(char * str);

Arguments

str
the str

Description

The notify function for mp_set_notify().


mpv_readline

Top

Name

mpv_readline - Ask for user input.

Synopsis

char * mpv_readline(int t, char * p, char * d);

Arguments

t
the type of input asked (one of MPR_ constants)
p
the prompt
d
the default value

Description

Asks for user input. The expected data type is described in type. Returns a pointer to a static buffer with the data entered by the user, or NULL if user cancelled.


mpv_refresh

Top

Name

mpv_refresh - Refresh the screen.

Synopsis

void mpv_refresh(void);

Description

Orders the underlying system to redraw the screen.


mpv_scrollbar

Top

Name

mpv_scrollbar - Draws / updates the scrollbar.

Synopsis

void mpv_scrollbar(int pos, int size, int max);

Arguments

pos
current position
size
vertical size
max
maximum value

Description

Draws / updates the scrollbar. pos is current position (the line where the cursor is), size is the number of lines of the document window and max is the maximum value (the total number of lines in current text).


mpv_set_variable

Top

Name

mpv_set_variable - Sets a driver-dependent variable

Synopsis

void mpv_set_variable(char * var, char * value);

Arguments

var
the name of the variable to be set
value
the new value

Description

Sets a variable from the configuration file that is driver-specific.


mpv_shutdown

Top

Name

mpv_shutdown - Shuts down the system dependent driver.

Synopsis

void mpv_shutdown(void);

Description

Shuts down the system dependent driver.


mpv_startup_1

Top

Name

mpv_startup_1 - Finds a usable video driver

Synopsis

int mpv_startup_1(void);

Description

Finds a usable video driver, pre-initializing it. If no usable driver is found, 0 is returned, or nonzero otherwise.


mpv_status_line

Top

Name

mpv_status_line - Sets the string to be drawn as status line

Synopsis

void mpv_status_line(char * str);

Arguments

str
the string

Description

Sets the string to be drawn as the status line.


mpv_str

Top

Name

mpv_str - Draws a string with color in the document window.

Synopsis

void mpv_str(char * str, int color);

Arguments

str
the string
color
the color (one of MP_COLOR_ constants)

Description

Draws a string, calling mpv_char() for each of their chars.


mpv_strcasecmp

Top

Name

mpv_strcasecmp - Case ignoring string compare

Synopsis

int mpv_strcasecmp(char * s1, char * s2);

Arguments

s1
first string
s2
second string

Description

Case ignoring string compare. System dependent (strcasecmp in Unix, stricmp in Win32)


mpv_suspend

Top

Name

mpv_suspend - Suspend the system dependant driver

Synopsis

void mpv_suspend(void);

Description

Suspend the execution of the application. For windowed interfaces, this will put the application in minimized mode.


mpv_syscmd

Top

Name

mpv_syscmd - System dependant command execution

Synopsis

int mpv_syscmd(mp_txt *txt,char *cmd,char *mode);

Description

Executes external commands. This is system dependant. It will take care of I/O redirection as needed as well as setting up the necessary TTY modes.

Returns 0 on success, -1 on error.


mpv_system_to_clipboard

Top

Name

mpv_system_to_clipboard - Copies from the system clipboard

Synopsis

int mpv_system_to_clipboard(void);

Description

Copies the clipboard's content from the underlying system to Minimum Profit's internal one. A returning value of 0 means the actual pasting is already done (or done from a system callback), so it won't be necessary to do it.


mpv_title

Top

Name

mpv_title - Sets the string to be drawn as title

Synopsis

void mpv_title(char * str);

Arguments

str
the string

Description

Sets the string to be drawn as title of the document window.


mpv_usage

Top

Name

mpv_usage - Prints the usage help.

Synopsis

void mpv_usage(void);

Description

Prints the usage help.


mpv_vkey

Top

Name

mpv_vkey - Converts Windows keys to key names.

Synopsis

static void _mpv_vkey(int c);

Arguments

c
the key

Description

Converts Windows virtual keys to key names.


mpv_zoom

Top

Name

mpv_zoom - Zooms the document window.

Synopsis

int mpv_zoom(int inc);

Arguments

inc
the increment (+1 or -1)

Description

Increases / decreases font size of the document window, if applicable.


mpw_spellcheck_word

Top

Name

mpw_spellcheck_word - Tests if a word is correctly spelled

Synopsis

int mpw_spellcheck_word(char * word);

Arguments

word
the word to be checked

Description

Tests if word is correctly spelled. Returns MP_COLOR_NORMAL in case it is or MP_COLOR_MISSPELLED otherwise.


Angel Ortega - angel@triptico.comBuilt with mp_doccer 1.2.0