Some editing operations called by menus can be executed from Smac. But in this case the information asked for by Xcoral menus have to be given as arguments of the corresponding functions (questions are not performed).
int read_file(char * filename)
Changes the current buffer to the file associated to
filename like the Read File menu entry, except that if the current
buffer is not saved, its contents is lost (see current\_
buffer\_
is\_
modified() §7.3.8 page ).
Returns 0 if there is no file matching filename and -1
if
the file is already loaded in an other buffer of the current session, leaving the
buffer unchanged. Otherwise returns 1 and loads filename in the current buffer.
The current position becomes the beginning of buffer.
Saves the buffer into the corresponding file in the same way as the Save File menu entry does.
void write_file(char * newfilename)
Saves the buffer into the file corresponding to newfilename like the Write File menu entry does.
int insert_file(char * filename)
Inserts the contents of the file associated to filename at the current position. Current position stays unchanged (it is the beginning of the inserted file). Returns 1 on success, otherwise 0 (if Smac cannot read filename).
Empties the current buffer. If it has not already been saved, its contents is lost.
int current_buffer_is_modified()
Returns 1 if the current buffer is modified, else 0. Here is an example of this function use:
Returns the current buffer number of lines, a non terminated line is counted, therefore an empty buffer has 1 line. Its definition is equivalent to:
Updates the contents of windows needing redisplay. Of course this update is immediate, and not delayed until current Smac execution ends.
Returns a new allocated string containing the absolute filename corresponding to the current buffer, or 0 when the buffer is untitled.
ATTENTION Be careful, the string is allocated each time the function is called, use free() to release it.
Scrolls to position the current line as the window first line. Note that the window will not be updated until the current Smac execution ends.
ATTENTION Be careful, if you change the current position after this function call, the window appearance could be changed and the line designated might not become the first of the window.
void set_font(char * fontname)
Changes the current buffer font to fontname.
See also current\_
window() and select\_
window() below.