SYNOPSIS
|
DESCRIPTION
![]() |
INHERITANCE HIERARCHY
AG_Object(3)-> AG_Widget(3)-> AG_Console. |
INITIALIZATION
MESSAGES
The AG_ConsoleMsg() function appends a new message to the console log. Unless an error occurs, the function returns a pointer to the created AG_ConsoleLine. If the message contains newlines, create a group of lines (which will be displayed in an indented style) and return a pointer to the first line (which will be the parent of the subsequent lines). The returned AG_ConsoleLine remains valid until deleted (or AG_ConsoleClear() is used). As a special case, if a cons argument of NULL is passed to AG_ConsoleMsg() then the message is passed to AG_Verbose(3) (and the function returns NULL). AG_ConsoleBinary() displays binary data in canonical hex+ASCII format. If non-NULL, label is prepended to every line. If non-NULL, format specifies an alternate format string (such as "%02d " for decimal). The default format is "%02x ". The format string must generate 3 characters. AG_ConsoleMsgEdit() replaces an existing log entry's text with the given string. AG_ConsoleMsgCatS() appends the given string to an existing log entry's text. AG_ConsoleMsgPtr() sets an optional user pointer for this log entry. AG_ConsoleMsgColor() sets an alternate, line-specific color for this log entry. AG_ConsoleClear() clears all messages from the console. AG_ConsoleExportText() returns a C string containing all currently selected lines, joined by newlines of the given variety. Similarly, AG_ConsoleExportBuffer() joins all lines in the buffer with the specified type of newline. |
FILE MONITORING
AG_ConsoleOpenFile() opens a file for reading, displays its contents on the console and then arranges for AG_Console to follow changes made to the file (similar to "tail -f" in Unix). Internally the function uses AG_AddEventSink(3) to set up an event sink of type AG_SINK_READ on the open file descriptor. The newline argument indicates the style of newline to use:
Possible flags include:
If AG_CONSOLE_FILE_BINARY is used then AG_Console produces a canonical hex+ASCII dump of the file (and any changes to it). The AG_CONSOLE_FILE_LEAVE_OPEN option causes AG_ConsoleClose() to leave the file descriptor (or FILE * handle) open. The AG_ConsoleOpenFD() variant accepts an integer file descriptor, and AG_ConsoleOpenFILE() accepts the FILE * handle of an open stream. AG_ConsoleClose() closes a file being followed. |
EVENTS
The AG_Console widget does not generate any event. |
STRUCTURE DATA
For the
AG_Console object:
For the AG_ConsoleLine structure:
|
SEE ALSO
AG_Color(3), AG_Intro(3), AG_Text(3), AG_Textbox(3), AG_Widget(3), AG_Window(3) |
HISTORY
The AG_Console widget first appeared in Agar 1.3. In Agar 1.6.0, AG_ConsoleSetPadding() was deprecated by the generic "padding" style attribute. Agar 1.6.0 added support for multi-line entries and introduced AG_ConsoleOpenFile(), AG_ConsoleOpenFD(), AG_ConsoleOpenStream(), AG_ConsoleClose(), AG_ConsoleMsgCatS(), AG_ConsoleBinary() and AG_ConsoleExportBuffer(). |