_mp_txts - Chained list of texts
_mp_active - Pointer to the active text
_mp_clipboard - Pointer to the clipboard
_mp_tab_size - Size (in spaces) of a tab character
_mp_word_wrap - Column where the word wrapping is done.
_mp_save_tabs - Tab saving flag.
_mp_auto_indent - Auto indentation flag.
_mp_case_cmp - Case sensitive compare flag.
_im_alive - The infamous spinning bar
mp_notify_stub - Dummy notify function
_mp_error - Bangs an error
mp_create_block - Creates a block
mp_name_txt - Names a text
mp_find_text - Find a text by its name
mp_create_sys_txt - Creates a new text
mp_create_txt - Creates a new text
mp_get_tmp_txt - Gets a temporal text
mp_end_tmp_txt - Stop using the temporal text
mp_delete_sys_txt - Deletes a text
mp_delete_txt - Deletes a text
mp_change_cursor - set the block where the cursor is
mp_peek_char - Returns the character over the cursor
mp_is_sep - separator test
mp_recalc_x - Recalculates txt->x
mp_move_right - Moves cursor one char to the right
mp_move_left - Moves cursor one char to the right
mp_move_down - Moves cursor one line down
mp_move_bol - Move to the beginning of the line.
mp_move_eol - Move to the end of the line.
mp_move_up - Moves cursor one line up
mp_move_bof - Moves to beginning of file
mp_move_eof - Moves to end of file
mp_move_word_right - Moves a word to the right.
mp_move_word_left - Moves a word to the left.
mp_move_xy - Moves to x, y position
mp_get_char - Gets the char at cursor and advances
mp_get_str - Gets a string from a text until a delimiter
mp_insert_char - Inserts a char in cursor position
mp_insert_tab - Inserts a tab
mp_insert_line - Inserts a new line
mp_over_char - Overwrites a char.
mp_put_char - Writes a char.
mp_put_str - Writes a string.
mp_delete_char - Deletes a char.
mp_delete_line - Deletes current line.
mp_load_open_file - Loads a file into the text.
mp_load_file - Opens and loads a file into text.
mp_write_open_file - Writes the text into file
mp_write_file - Opens the file and writes the text into it.
mp_unmark - Unmarks the selection block.
mp_marked - Tests if selection block is marked.
mp_mark - Marks the beginning or end of the selection block.
mp_copy_mark - Copies the selection block into the clipboard
mp_paste_mark - Pastes the clipboard into cursor position.
mp_delete_mark - Deletes the marked selection block.
mp_seek - Seeks the string.
mp_replace - Seeks and replaces a string.
mp_adjust - Adjusts the current window pointers.
mp_get_word - Gets the word over the cursor.
mp_set_notify - Sets the notify function.
mp_debug_hook - Dummy debug hook function.
mp_startup - Starts up the mp core.
mp_shutdown - Shuts down the mp core.
mpi_plain_draw_all - Draws the document window (simple version)
mpi_color_draw_all - Draws the document window using colors.
mpi_draw_all - Draws the document window.
mpi_save_as - Ask for a name for the text and save.
mpi_save - Saves the text.
mpi_open - Loads a file.
mpi_close - Closes the text.
mpi_exec - Executes a command related to text.
mpi_find_tag - Finds a tag.
mpi_current_list - Shows a selection list with the opened files
mpi_insert_template - Shows a list with the available templates
mpi_action - Process the action key.
mpi_startup - Startup interface function.
mpi_shutdown - Shutdown interface function.
mpi_args_1 - Command line argument processing, 1st pass
mpi_args_2 - Command line argument processing, 2nd pass
_wrd_cmp - qsort compare function
_wrd_icmp - qsort compare function
_local_cmp - qsort compare function
mps_is_sep - separator test
mps_auto_synhi - Autodetects syntax hilight mode
mps_word_color - returns the color associated to the word
mps_quoting - Test if we are inside quotes
mps_set_override_mode - Forces the syntax hilight mode
mps_enumerate_modes - Returns the available synhi modes
mps_add_local_token - Adds a local token
mps_startup - Syntax hilight engine startup
_sigwinch - SIGWINCH capture function.
mpv_strcasecmp - Case ignoring string compare
mpv_goto - Positions the cursor to start drawing.
mpv_char - Draws a char with color in the document window.
mpv_str - Draws a string with color in the document window.
mpv_cursor - Positions the hardware cursor.
mpv_refresh - Refresh the screen.
_mpv_title_status - Draws the title or status line.
mpv_title - Sets the string to be drawn as title
mpv_status_line - Sets the string to be drawn as status line
mpv_zoom - Zooms the document window.
_mpv_key - Processes a key.
mpv_key - Reads a key from terminal and processes it.
mpv_add_menu - Creates a new menu bar.
mpv_add_menu_item - Adds a menu item to current menu bar.
mpv_menu - Manages the menu.
_mpv_prompt - Asks yes or no.
mpv_confirm - Asks for confirmation.
mpv_alert - Alerts the user.
mpv_list - Manages a selection list
open_file_list - Shows a list of files to open
mpv_readline - Ask for user input.
mpv_help - Shows the available help for a term
mpv_about - Shows the 'About Minimum Profit...' information.
mpv_notify - The notify function.
mpv_scrollbar - Draws / updates the scrollbar.
mpv_filetabs - Draws the tab set containing the file names
mpv_startup - Starts up the system dependent driver.
mpv_shutdown - Shuts down the system dependent driver.
usage - Prints the usage help.
mpv_strcasecmp - Case ignoring string compare
usage - Prints the usage help.
mpv_strcasecmp - Case ignoring string compare
mpv_goto - Positions the cursor to start drawing.
mpv_char - Draws a char with color in the document window.
mpv_str - Draws a string with color in the document window.
mpv_cursor - Positions the hardware cursor.
mpv_refresh - Refresh the screen.
_mpv_title_status - Sets the window caption
mpv_title - Sets the string to be drawn as title
mpv_status_line - Sets the string to be drawn as status line
mpv_add_menu - Creates a new menu bar.
mpv_add_menu_item - Adds a menu item to current menu bar.
mpv_menu - Manages the menu.
mpv_alert - Alerts the user.
mpv_confirm - Asks for confirmation.
TextDlgProc - Procedure for text input dialog
ListDlgProc - Procedure for the list input dialog
AboutDlgProc - Procedure for the about box
mpv_list - Manages a selection list
mpv_readline - Ask for user input.
mpv_about - Shows the 'About Minimum Profit...' information.
mpv_help - Shows the available help for a term
_mpv_init_fonts - Starts up font stuff.
mpv_zoom - Zooms the document window.
_mpv_paint - Dump the frame buffer to screen.
_windows_to_clpbrd - Copies MS Windows clipboard to MP
_clpbrd_to_windows - Copies MP clipboard to MS Windows
mpv_vkey - Converts Windows keys to MPK_ constants.
mpv_akey - Converts ascii keys to MPK_ constants.
_mpv_action - Process the action.
_check_menus - (Un)Checks menu item marks
WndProc - Main window callback.
mpv_scrollbar - Draws / updates the scrollbar.
mpv_filetabs - Draws the tab set containing the file names
mpv_startup - Starts up the system dependent driver.
mpv_mainloop - Main message processing loop.
mpv_shutdown - Shuts down the system dependent driver.
_mp_txts | Top |
Name
_mp_txts - Chained list of textsSynopsis
mp_txt * _mp_txts=NULL;Description
The chained list of texts. This is where all the document texts are stored.
_mp_active | Top |
Name
_mp_active - Pointer to the active textSynopsis
mp_txt * _mp_active=NULL;Description
Pointer to the active text. Assumed to be always non-NULL.
_mp_clipboard | Top |
Name
_mp_clipboard - Pointer to the clipboardSynopsis
mp_txt * _mp_clipboard=NULL;Description
Pointer to a text containing the clipboard. Used for copying and pasting.
_mp_tab_size | Top |
Name
_mp_tab_size - Size (in spaces) of a tab characterSynopsis
int _mp_tab_size=DEFAULT_TAB_SIZE;Description
Size in spaces of each tab column position.
_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).
_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_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.
_im_alive | Top |
Name
_im_alive - The infamous spinning barSynopsis
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_notify_stub | Top |
Name
mp_notify_stub - Dummy notify functionSynopsis
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_error | Top |
Name
_mp_error - Bangs an errorSynopsis
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_create_block | Top |
Name
mp_create_block - Creates a blockSynopsis
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_name_txt | Top |
Name
mp_name_txt - Names a textSynopsis
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_find_text | Top |
Name
mp_find_text - Find a text by its nameSynopsis
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_create_sys_txt | Top |
Name
mp_create_sys_txt - Creates a new textSynopsis
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 textSynopsis
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_get_tmp_txt | Top |
Name
mp_get_tmp_txt - Gets a temporal textSynopsis
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_end_tmp_txt | Top |
Name
mp_end_tmp_txt - Stop using the temporal textSynopsis
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_delete_sys_txt | Top |
Name
mp_delete_sys_txt - Deletes a textSynopsis
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 textSynopsis
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_change_cursor | Top |
Name
mp_change_cursor - set the block where the cursor isSynopsis
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_peek_char | Top |
Name
mp_peek_char - Returns the character over the cursorSynopsis
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_is_sep | Top |
Name
mp_is_sep - separator testSynopsis
int mp_is_sep(char c);Arguments
- c
- the char to test
Description
Returns 1 if c is a word separator.
mp_recalc_x | Top |
Name
mp_recalc_x - Recalculates txt->xSynopsis
void mp_recalc_x(mp_txt * txt);Arguments
- txt
- the text
Description
Recalculates the value of the x cursor position. Only called internally.
mp_move_right | Top |
Name
mp_move_right - Moves cursor one char to the rightSynopsis
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_left | Top |
Name
mp_move_left - Moves cursor one char to the rightSynopsis
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_down | Top |
Name
mp_move_down - Moves cursor one line downSynopsis
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_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_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_up | Top |
Name
mp_move_up - Moves cursor one line upSynopsis
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_bof | Top |
Name
mp_move_bof - Moves to beginning of fileSynopsis
int mp_move_bof(mp_txt * txt);Arguments
- txt
- the text
Description
Moves to the beginning of the file.
mp_move_eof | Top |
Name
mp_move_eof - Moves to end of fileSynopsis
int mp_move_eof(mp_txt * txt);Arguments
- txt
- the text
Description
Moves to the end of the file.
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_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_xy | Top |
Name
mp_move_xy - Moves to x, y positionSynopsis
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_get_char | Top |
Name
mp_get_char - Gets the char at cursor and advancesSynopsis
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_str | Top |
Name
mp_get_str - Gets a string from a text until a delimiterSynopsis
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 buffer.
mp_insert_char | Top |
Name
mp_insert_char - Inserts a char in cursor positionSynopsis
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_tab | Top |
Name
mp_insert_tab - Inserts a tabSynopsis
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_insert_line | Top |
Name
mp_insert_line - Inserts a new lineSynopsis
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_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_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_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_load_open_file | Top |
Name
mp_load_open_file - Loads a file into the text.Synopsis
int mp_load_open_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_load_file | Top |
Name
mp_load_file - Opens and loads a file into text.Synopsis
int mp_load_file(mp_txt * txt, char * filename);Arguments
- txt
- the text
- filename
- the file name
Description
Opens and loads the file named by filename into text. Returns -1 if file cannot be open, or the output from
mp_load_open_file()
otherwise.
mp_write_open_file | Top |
Name
mp_write_open_file - Writes the text into fileSynopsis
int mp_write_open_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_write_file | Top |
Name
mp_write_file - Opens the file and writes the text into it.Synopsis
int mp_write_file(mp_txt * txt, char * filename);Arguments
- txt
- the text
- filename
- the filename
Description
Opens filename for writing and writes text into it. Returns -1 if file cannot be open for writing or 1 otherwise.
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_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_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_copy_mark | Top |
Name
mp_copy_mark - Copies the selection block into the clipboardSynopsis
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_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_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_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_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_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_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_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_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_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_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.
mpi_plain_draw_all | Top |
Name
mpi_plain_draw_all - Draws the document window (simple version)Synopsis
void mpi_plain_draw_all(mp_txt * txt);Description
Stripped down version of
mpi_color_draw_all()
that doesn't draw any color other than the cursor and the selected block. It's used when 'plain' or no syntax highlighter is selected, as it's also faster.
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_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_save_as | Top |
Name
mpi_save_as - Ask for a name for the text and save.Synopsis
void 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_save | Top |
Name
mpi_save - Saves the text.Synopsis
void 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_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_close | Top |
Name
mpi_close - Closes the text.Synopsis
void 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_exec | Top |
Name
mpi_exec - Executes a command related to text.Synopsis
void mpi_exec(mp_txt * txt);Arguments
- txt
- the text
Description
Asks for a system command to be executed. If the command is preceded by the | (pipe) char, the complete text is sent as the command's standard input; otherwise, the standard output of command is written into cursor position.
mpi_find_tag | Top |
Name
mpi_find_tag - Finds a tag.Synopsis
int mpi_find_tag(char * tag, int select_only);Arguments
- tag
- the tag to be found
Description
Searches the tag from file 'tags' (created by the 'ctags' utility). If found, opens the associated text (or activates it if already open) and puts the cursor there. The tag can be NULL; in this special case, only the local token database is filled and no searching is done. Otherwise (assuming the tag *needs* to be found), the creation of the 'tags' file is forced by executing the 'ctags' program. Returns -1 on cancellation.
mpi_current_list | Top |
Name
mpi_current_list - Shows a selection list with the opened filesSynopsis
void mpi_current_list(void);Description
Shows a selection list with the opened files. Selecting one of them makes it the active one.
mpi_insert_template | Top |
Name
mpi_insert_template - Shows a list with the available templatesSynopsis
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. Returns 0 if no template is available.
mpi_action | Top |
Name
mpi_action - Process the action key.Synopsis
int mpi_action(mp_txt * txt, int key);Arguments
- txt
- the text
- key
- the key
Description
Main key processing function. Returns: 0 if no action was made, 1 if the action modified the active text and 2 if the active text is another one (it was closed, another opened, etc) and a complete redraw is needed.
mpi_startup | Top |
Name
mpi_startup - Startup interface function.Synopsis
void mpi_startup(void);Description
Starts up the interface.
mpi_shutdown | Top |
Name
mpi_shutdown - Shutdown interface function.Synopsis
void mpi_shutdown(void);Description
Shuts down the interface.
mpi_args_1 | Top |
Name
mpi_args_1 - Command line argument processing, 1st passSynopsis
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 passSynopsis
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.
_wrd_cmp | Top |
Name
_wrd_cmp - qsort compare functionSynopsis
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 functionSynopsis
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).
_local_cmp | Top |
Name
_local_cmp - qsort compare functionSynopsis
static int _local_cmp(const void * s1, const void * s2);Arguments
- s1
- first string
- s2
- second string
Description
Compare function (qsort and bsearch) to search a local token. Returns -1, 0, or 1. Internal (do not use).
mps_is_sep | Top |
Name
mps_is_sep - separator testSynopsis
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, using
mp_is_sep()
first and then the local syntax hilighter separator. Returns 1 if it is.
mps_auto_synhi | Top |
Name
mps_auto_synhi - Autodetects syntax hilight modeSynopsis
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_word_color | Top |
Name
mps_word_color - returns the color associated to the wordSynopsis
int mps_word_color(int synhi, char * word, int line);Arguments
- synhi
- syntax hilighter index
- word
- the word to search
- line
- the line being drawn
Description
Returns the color associated to the word, or MP_COLOR_NORMAL if the word has nothing special.
mps_quoting | Top |
Name
mps_quoting - Test if we are inside quotesSynopsis
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 modeSynopsis
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_enumerate_modes | Top |
Name
mps_enumerate_modes - Returns the available synhi modesSynopsis
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_add_local_token | Top |
Name
mps_add_local_token - Adds a local tokenSynopsis
void mps_add_local_token(char * token);Arguments
- token
- the token
Description
Adds a token to the local database. This database is sorted and searched to be highlighted with the MP_COLOR_LOCAL color. Called when reading the 'tags' file. If token is NULL, it's taken as the end of local tokens (and the next calling to this function resets the database to start again).
mps_startup | Top |
Name
mps_startup - Syntax hilight engine startupSynopsis
void mps_startup(void);Description
Initializes the syntax highlighting engine.
_sigwinch | Top |
Name
_sigwinch - SIGWINCH capture function.Synopsis
static void _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_strcasecmp | Top |
Name
mpv_strcasecmp - Case ignoring string compareSynopsis
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_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_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_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_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_refresh | Top |
Name
mpv_refresh - Refresh the screen.Synopsis
void mpv_refresh(void);Description
Orders the underlying system to redraw the screen.
_mpv_title_status | Top |
Name
_mpv_title_status - Draws the title or status line.Synopsis
static void _mpv_title_status(int y, char * str1, 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).
mpv_title | Top |
Name
mpv_title - Sets the string to be drawn as titleSynopsis
void mpv_title(char * str);Arguments
- str
- the string
Description
Sets the string to be drawn as title of the document window.
mpv_status_line | Top |
Name
mpv_status_line - Sets the string to be drawn as status lineSynopsis
void mpv_status_line(char * str);Arguments
- str
- the string
Description
Sets the string to be drawn as the status line.
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.
_mpv_key | Top |
Name
_mpv_key - Processes a key.Synopsis
static int _mpv_key(int k);Arguments
- k
- the key
Description
Processes a raw (curses) key and converts it to a MPK_ constant or normal ISO-8859-1 character.
mpv_key | Top |
Name
mpv_key - Reads a key from terminal and processes it.Synopsis
static int mpv_key(void);Description
Reads a key from terminal and processes it via
_mpv_key()
.
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 * label, int key, int * toggle);Arguments
- label
- the label
- key
- the associated MPK_ key.
- toggle
- a pointer to int with the toggle variable status.
Description
Adds a menu item to current menu bar. If toggle is defined, it is a pointer to an integer to toggle if the item is activated.
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_prompt | Top |
Name
_mpv_prompt - Asks yes or no.Synopsis
static int _mpv_prompt(char * prompt, char * prompt2);Arguments
- prompt
- the prompt
- prompt2
- an optional second prompt.
Description
Asks yes or no. Returns 1 if 'yes' choosen.
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_alert | Top |
Name
mpv_alert - Alerts the user.Synopsis
void mpv_alert(char * msg, char * msg2);Arguments
- msg
- the alert message
- msg2
- a possible second message.
Description
Alerts the user by showing the message and asking for validation.
mpv_list | Top |
Name
mpv_list - Manages a selection listSynopsis
int mpv_list(char * title, mp_txt * txt);Arguments
- title
- the title or caption of the list
- txt
- the text containing the list to show
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.
open_file_list | Top |
Name
open_file_list - Shows a list of files to openSynopsis
static int 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 MPK_ESCAPE). If no or just one file is matched, or if
glob()
is unsupported, '\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_readline | Top |
Name
mpv_readline - Ask for user input.Synopsis
char * mpv_readline(int type, char * prompt, char * def);Arguments
- type
- the type of input asked (one of MPR_ constants)
- prompt
- the prompt
- def
- 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_help | Top |
Name
mpv_help - Shows the available help for a termSynopsis
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_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_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_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_filetabs | Top |
Name
mpv_filetabs - Draws the tab set containing the file namesSynopsis
void mpv_filetabs(void);Description
Draws the names of the opened files in the form of a tab set.
mpv_startup | Top |
Name
mpv_startup - Starts up the system dependent driver.Synopsis
int mpv_startup(void);Description
Starts up the system dependent driver. Returns 1 if succesful.
mpv_shutdown | Top |
Name
mpv_shutdown - Shuts down the system dependent driver.Synopsis
void mpv_shutdown(void);Description
Shuts down the system dependent driver.
usage | Top |
Name
usage - Prints the usage help.Synopsis
void usage(void);Description
Prints the usage help to standard output.
TextDlgProc | Top |
Name
TextDlgProc - Procedure for text input dialogSynopsis
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.
ListDlgProc | Top |
Name
ListDlgProc - Procedure for the list input dialogSynopsis
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.
AboutDlgProc | Top |
Name
AboutDlgProc - Procedure for the about boxSynopsis
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.
_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_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.
_windows_to_clpbrd | Top |
Name
_windows_to_clpbrd - Copies MS Windows clipboard to MPSynopsis
static void _windows_to_clpbrd(void);Description
Copies MS Windows clipboard to MP's one
_clpbrd_to_windows | Top |
Name
_clpbrd_to_windows - Copies MP clipboard to MS WindowsSynopsis
static void _clpbrd_to_windows(void);Description
Copies MP clipboard to MS Windows's one
mpv_vkey | Top |
Name
mpv_vkey - Converts Windows keys to MPK_ constants.Synopsis
static int mpv_vkey(int c);Arguments
- c
- the key
Description
Converts Windows virtual keys to MPK_ constants.
mpv_akey | Top |
Name
mpv_akey - Converts ascii keys to MPK_ constants.Synopsis
static int mpv_akey(int k);Arguments
- k
- the key
Description
Converts ascii keys to MPK_ constants.
_mpv_action | Top |
Name
_mpv_action - Process the action.Synopsis
static void _mpv_action(int c);Arguments
- c
- the key to act upon
Description
Calls
mpi_action()
and takes into account another Windows-dependent actions.
_check_menus | Top |
Name
_check_menus - (Un)Checks menu item marksSynopsis
static void _check_menus(void);Description
Updates the check/uncheck status of toggleable menu items.
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.
mpv_mainloop | Top |
Name
mpv_mainloop - Main message processing loop.Synopsis
void mpv_mainloop(void);Description
Main message processing loop.
Angel Ortega - angel@triptico.com