Back to index

lightning-sunbird  0.9+nobinonly
lineterm.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is lineterm.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Ramalingam Saravanan.
00018  * Portions created by the Initial Developer are Copyright (C) 1999
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 /* lineterm.h: Line terminal (LTERM) public interface header file
00038  * LINETERM provides a "stream" interface to an XTERM-like terminal,
00039  * using line-oriented input/output.
00040  */
00041 
00042 #ifndef _LINETERM_H
00043 
00044 #define _LINETERM_H   1
00045 
00046 #include "unistring.h"
00047 
00048 /* Define LTERM read callback function type */
00049 #ifdef USE_GTK_WIDGETS
00050 #include <gtk/gtk.h>
00051 typedef void (*lterm_callback_func_t)(gpointer, gint, GdkInputCondition);
00052 #else
00053 typedef void* lterm_callback_func_t;
00054 #endif
00055 
00056 /* Unicode character style information (same type as UNICHAR) */
00057 typedef UNICHAR UNISTYLE;
00058 
00059 #ifdef  __cplusplus
00060 extern "C" {
00061 #endif
00062 
00063 /* lineterm functions */
00064 
00065 /* LTERM module number (used for trace/log operations) */
00066 #define LTERM_TLOG_MODULE  1
00067 
00083 int lterm_init(int messageLevel);
00084 
00085 
00093 int lterm_new();
00094 
00168 int lterm_open(int lterm, char *const argv[],
00169                const char* cookie, const char* init_command,
00170                const UNICHAR* prompt_regexp, int options, int process_type,
00171                int rows, int cols, int x_pixels, int y_pixels,
00172                lterm_callback_func_t callback_func, void *callback_data);
00173 
00174 
00181 int lterm_close(int lterm);
00182 
00183 
00188 int lterm_delete(int lterm);
00189 
00190 
00195 void lterm_close_all(void);
00196 
00197 
00203 int lterm_setecho(int lterm, int echo_flag);
00204 
00205 
00211 int lterm_resize(int lterm, int rows, int cols);
00212 
00213 
00222 int lterm_setcursor(int lterm, int row, int col);
00223 
00224 
00243 int lterm_write(int lterm, const UNICHAR *buf, int count, int dataType);
00244 
00245 
00252 int lterm_metacomplete(int lterm, const UNICHAR *buf, int count);
00253 
00254 
00327 int lterm_read(int lterm, int timeout, UNICHAR *buf, int count,
00328                UNISTYLE *style, int *opcodes, int *opvals,
00329                int *buf_row, int *buf_col, int *cursor_row, int *cursor_col);
00330 
00331 /* opcodes describing terminal operations:
00332  */
00333 #define LTERM_STREAMDATA_CODE  0x0001U  /* Stream mode */
00334 #define LTERM_SCREENDATA_CODE  0x0002U  /* Screen mode */
00335 #define LTERM_LINEDATA_CODE    0x0004U  /* Line mode */
00336 #define LTERM_BELL_CODE        0x0008U  /* Ring bell */
00337 #define LTERM_CLEAR_CODE       0x0010U  /* Clear screen */
00338 #define LTERM_INSERT_CODE      0x0020U  /* Insert lines above current line */
00339 #define LTERM_DELETE_CODE      0x0040U  /* Delete lines below current line */
00340 #define LTERM_SCROLL_CODE      0x0080U  /* Define scrolling region */
00341 #define LTERM_INPUT_CODE       0x0100U  /* Contains STDIN at end of line */
00342 #define LTERM_PROMPT_CODE      0x0200U  /* Contains prompt at beginning */
00343 #define LTERM_OUTPUT_CODE      0x0400U  /* Contains STDOUT/STDERR/ALTOUT */
00344 #define LTERM_META_CODE        0x0800U  /* Meta input */
00345 #define LTERM_COMPLETION_CODE  0x1000U  /* Completion requested */
00346 #define LTERM_NEWLINE_CODE     0x2000U  /* Complete (new) line */
00347 #define LTERM_HIDE_CODE        0x4000U  /* Hide output */
00348 #define LTERM_ERROR_CODE       0x8000U  /* Error in output */
00349 
00350 #define LTERM_COOKIESTR_CODE  0x10000U  /* Stream prefixed with cookie */
00351 #define LTERM_DOCSTREAM_CODE  0x20000U  /* Stream contains complete document */
00352 #define LTERM_XMLSTREAM_CODE  0x40000U  /* Stream contains XML, not HTML */
00353 #define LTERM_JSSTREAM_CODE   0x80000U  /* Stream contains Javascript */
00354 #define LTERM_WINSTREAM_CODE 0x100000U  /* Display stream in entire window */
00355 
00356 
00357 /* LTERM/XTERM 16-bit style mask:
00358  * PROMPT, STDIN, STDOUT, STDERR, ALTOUT are mutually exclusive.
00359  * The markup styles apply to STDIN/STDOUT/ALTOUT data.
00360  * The highlighting styles only apply to STDOUT data.
00361  * The VT100 foreground and background styles are not implemented.
00362  */
00363 
00364 #define LTERM_PROMPT_STYLE     0x0001UL /* prompt string    */
00365 #define LTERM_STDIN_STYLE      0x0002UL /* standard input   */
00366 #define LTERM_STDOUT_STYLE     0x0004UL /* standard output  */
00367 #define LTERM_STDERR_STYLE     0x0008UL /* standard error   */
00368 #define LTERM_ALTOUT_STYLE     0x0010UL /* alternate output */
00369 
00370 #define LTERM_URI_STYLE        0x0020UL /* URI markup */
00371 #define LTERM_HTML_STYLE       0x0040UL /* HTML markup */
00372 #define LTERM_XML_STYLE        0x0080UL /* XML markup */
00373 
00374 #define LTERM_BOLD_STYLE       0x0100UL /* boldface */
00375 #define LTERM_ULINE_STYLE      0x0200UL /* underline */
00376 #define LTERM_BLINK_STYLE      0x0400UL /* blink */
00377 #define LTERM_INVERSE_STYLE    0x0800UL /* inverse video */
00378 
00379 /* LTERM option flags */
00380 #define LTERM_NOCANONICAL_FLAG   0x0001U
00381 #define LTERM_NOEDIT_FLAG        0x0002U
00382 #define LTERM_NOCOMPLETION_FLAG  0x0004U
00383 #define LTERM_NOMETA_FLAG        0x0008U
00384 #define LTERM_NOECHO_FLAG        0x0010U
00385 #define LTERM_NOMARKUP_FLAG      0x0020U
00386 #define LTERM_NOPTY_FLAG         0x0040U
00387 #define LTERM_NONUL_FLAG         0x0080U
00388 #define LTERM_NOLINEWRAP_FLAG    0x0100U
00389 #define LTERM_NOEXPORT_FLAG      0x0200U
00390 #define LTERM_STDERR_FLAG        0x0400U
00391 #define LTERM_PARTLINE_FLAG      0x0800U
00392 
00393 /* Process type codes */
00394 #define LTERM_DETERMINE_PROCESS -1       /* Determine process type from name */
00395 #define LTERM_UNKNOWN_PROCESS    0       /* Unknown process type */
00396 #define LTERM_SH_PROCESS         1       /* Bourne shell */
00397 #define LTERM_KSH_PROCESS        2       /* Korn shell */
00398 #define LTERM_BASH_PROCESS       3       /* Bourne Again shell */
00399 #define LTERM_CSH_PROCESS        4       /* C shell */
00400 #define LTERM_TCSH_PROCESS       5       /* TC shell */
00401 
00402 /* lterm_write data type codes (XML server output not permitted) */
00403 #define LTERM_WRITE_PLAIN_INPUT     0    /* Plain text user input */
00404 #define LTERM_WRITE_XML_INPUT       1    /* XML element user input */
00405 #define LTERM_WRITE_PLAIN_OUTPUT    2    /* Plain text server output */
00406 #define LTERM_WRITE_CLOSE_MESSAGE   3    /* End of file message */
00407 
00408 #ifdef  __cplusplus
00409 }
00410 #endif
00411 
00412 #endif  /* _LINETERM_H */