Back to index

lightning-sunbird  0.9+nobinonly
ltermPrivate.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 /* ltermPrivate.h: Line terminal (LTERM) private header file
00038  * LTERM provides a "stream" interface to an XTERM-like terminal,
00039  * using line input/output.
00040  * CPP options:
00041  *   LINUX:          for Linux2.0/glibc
00042  *   SOLARIS:        for Solaris2.6
00043  *   BSDFAMILY:      for FreeBSD, ...
00044  *   DEBUG_LTERM:          to enable some debugging output
00045  *   NO_PTY:         force use of pipes rather than PTY for process
00046  *                   communication
00047  *   MOZILLA_CLIENT: set if embedded in Mozilla
00048  *   USE_NSPR_BASE:  use basic NSPR API (excluding I/O and process creation)
00049  *   USE_NSPR_LOCK:  use NSPR lock API instead of Unix mutex API
00050  *   USE_NSPR_IO:    use NSPR I/O and process API instead of Unix API
00051  *             (current implementation of pseudo-TTY is incompatible with
00052  *              the NSPR I/O API; set the USE_NSPR_IO option only on platforms
00053  *              where PTYSTREAM is not implemented)
00054  */
00055 
00056 #ifndef _LTERMPRIVATE_H
00057 
00058 #define _LTERMPRIVATE_H 1
00059 
00060 /* Standard C header files */
00061 #include <string.h>
00062 
00063 /* public declarations */
00064 #include "lineterm.h"
00065 #include "tracelog.h"
00066 
00067 /* private declarations */
00068 
00069 /* Force use of basic NSPR API if MOZILLA_CLIENT or USE_NSPR_IO are defined */
00070 #if defined(MOZILLA_CLIENT) || defined(USE_NSPR_IO)
00071 #define USE_NSPR_BASE 1
00072 #endif
00073 
00074 /* pseudo-TTY stream interface */
00075 #include "ptystream.h"
00076 
00077 #define LTERM_ERROR                           TLOG_ERROR
00078 #define LTERM_WARNING                         TLOG_WARNING
00079 #define LTERM_LOG(procname,level,args)        TLOG_PRINT(LTERM_TLOG_MODULE,procname,level,args)
00080 #define LTERM_LOGUNICODE(procname,level,args) TLOG_UNICHAR(LTERM_TLOG_MODULE,procname,level,args)
00081 
00082 #ifdef USE_NSPR_BASE           /* Use basic NSPR API (excluding I/O) */
00083 
00084 #include "nspr.h"
00085 
00086 #define assert       PR_ASSERT
00087 
00088 #define int32        PRInt32
00089 
00090 #define getenv       PR_GetEnv
00091 
00092 #define MALLOC(x)    PR_Malloc(x)
00093 #define REALLOC(x,y) PR_Realloc((x),(y))
00094 #define CALLOC(x,y)  PR_Calloc((x),(y))
00095 #define FREE(x)      PR_Free(x)
00096 
00097 #else   /* not USE_NSPR_BASE */
00098 
00099 #include <assert.h>
00100 
00101 #define int32        long
00102 
00103 #define MALLOC(x)    malloc(x)
00104 #define REALLOC(x,y) realloc((x),(y))
00105 #define CALLOC(x,y)  calloc((x),(y))
00106 #define FREE(x)      free(x)
00107 
00108 #endif  /* not USE_NSPR_BASE */
00109 
00110 
00111 #ifdef USE_NSPR_IO           /* Use NSPR I/O API (no PTY implementation) */
00112 
00113 typedef PRFileDesc  *FILEDESC;
00114 #define NULL_FILEDESC     0
00115 #define VALID_FILEDESC(x) (x != 0)
00116 
00117 typedef PRFileDesc FILESTREAM;
00118 
00119 #define SIZE_T   PRInt32
00120 #define WRITE    PR_Write
00121 #define READ     PR_Read
00122 #define CLOSE(x) (PR_Close(x) != PR_SUCCESS)
00123 #define PIPE(x)  (PR_CreatePipe((x),(x)+1) != PR_SUCCESS)
00124 
00125 #define POLL(x,y,z)  PR_Poll((x),(y),(z))
00126 #define POLLFD       PRPollDesc
00127 #define POLL_EVENTS  in_flags
00128 #define POLL_REVENTS out_flags
00129 #define POLL_READ    PR_POLL_READ
00130 
00131 #define PROCESS           PRProcess *
00132 #define NULL_PROCESS      0
00133 #define VALID_PROCESS(x)  (x != 0)
00134 
00135 #else   /* not USE_NSPR_IO */
00136 
00137 /* system header files */
00138 #include <unistd.h>
00139 #include <signal.h>
00140 
00141 /* Diagnostic/debugging files */
00142 #include <stdio.h>
00143 #include <errno.h>
00144 #include <stdarg.h>
00145 
00146 #if defined(SOLARIS)
00147 #include <poll.h>
00148 #else
00149 #include <sys/poll.h>
00150 #endif
00151 
00152 typedef int FILEDESC;
00153 #define NULL_FILEDESC     -1
00154 #define VALID_FILEDESC(x) (x >= 0)
00155 
00156 typedef FILE FILESTREAM;
00157 
00158 #define SIZE_T   size_t
00159 #define WRITE    write
00160 #define READ     read
00161 #define CLOSE(x) close(x)
00162 #define PIPE(x)  pipe(x)
00163 
00164 #define POLL(x,y,z)  poll((x),(y),(z))
00165 #define POLLFD       pollfd
00166 #define POLL_EVENTS  events
00167 #define POLL_REVENTS revents
00168 #define POLL_READ    POLLIN
00169 
00170 #define PROCESS          long
00171 #define NULL_PROCESS     0
00172 #define VALID_PROCESS(x) (x > 0)
00173 
00174 #endif  /* not USE_NSPR_IO */
00175 
00176 
00177 #ifdef USE_NSPR_LOCK           /* Use NSPR lock API */
00178 
00179 #define MUTEX_DECLARE(x)     PRLock *x
00180 #define MUTEX_INITIALIZE(x)  ((x=PR_NewLock()) == NULL)
00181 #define MUTEX_LOCK(x)        PR_Lock(x)
00182 #define MUTEX_UNLOCK(x)      PR_Unlock(x)
00183 #define MUTEX_DESTROY(x)     PR_DestroyLock(x)
00184 
00185 #define THREAD_DECLARE(x)    PRThread *x
00186 #define THREAD_CREATE        ((x=PR_CreateThread(PR_USER_THREAD, (y), (z), \
00187                                   PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,    \
00188                                   PR_JOINABLE_THREAD, 0)) == NULL)
00189 #define THREAD_SELF          PR_GetCurrentThread
00190 #define THREAD_EQUAL(x,y)    ((x) == (y))
00191 #define THREAD_JOIN(x)       (PR_JoinThread(x) != PR_SUCCESS)
00192 
00193 #else   /* not USE_NSPR_LOCK */
00194 
00195 #include <pthread.h>
00196 
00197 #define MUTEX_DECLARE(x)     pthread_mutex_t x
00198 #define MUTEX_INITIALIZE(x)  pthread_mutex_init(&(x), NULL)
00199 #define MUTEX_LOCK(x)        pthread_mutex_lock(&(x))
00200 #define MUTEX_UNLOCK(x)      pthread_mutex_unlock(&(x))
00201 #define MUTEX_DESTROY(x)     pthread_mutex_destroy(&(x))
00202 
00203 #define THREAD_DECLARE(x)    pthread_t x
00204 #define THREAD_CREATE(x,y,z) pthread_create(&(x),NULL,(y),(z))
00205 #define THREAD_SELF          pthread_self
00206 #define THREAD_EQUAL(x,y)    pthread_equal(x,y)
00207 #define THREAD_JOIN(x)       pthread_join((x),NULL)
00208 
00209 #endif  /* not USE_NSPR_LOCK */
00210 
00211 
00212 #define MAXTERM 256            /* Maximum number of LTERMs;
00213                                 * affects static memory "footprint"
00214                                 */
00215 
00216 #define MAXCOL 4096            /* Maximum columns in line buffer;
00217                                 * affects static memory "footprint";
00218                                 * the only limitation on this value is that
00219                                 * it must fit into a UNICHAR, because of the
00220                                 * way lterm_write and ltermWrite implement
00221                                 * the input buffer pipe.
00222                                 */
00223 
00224 #define MAXROW 1024            /* Maximum rows in screen;
00225                                 * primarily affects dynamically allocated
00226                                 * memory
00227                                 */
00228 
00229 /* The only obvious limitation on the following is that they should be
00230  * significantly less than MAXCOL
00231  */
00232 #define MAXPROMPT 256          /* Maximum length of prompt regexp+1 */
00233 #define MAXRAWINCOMPLETE 5     /* Maximum incomplete raw buffer size */
00234 #define MAXSTREAMTERM 11       /* Maximum stream terminator buffer size */
00235 #define MAXCOOKIESTR 64        /* Maximum length of cookie string+1 */
00236 #define MAXESCAPEPARAMS 16     /* Maximum no. of numeric ESCAPE parameters */
00237 #define MAXSTRINGPARAM  512    /* Maximum length of string ESCAPE parameters */
00238 #define MAXSHELLINITCMD   2    /* Maximum no. of shell init commands */
00239 #define MAXSHELLINITSTR 256    /* Maximum length of shell init string+1 */
00240 
00241 #define MAXPTYIN 128           /* 1/2 POSIX minimum MAX_INPUT for PTY */
00242 
00243 #define MAXCOLM1 (MAXCOL-1)    /* Maximum columns in line buffer - 1 */
00244 
00245 #define MAXTTYCONTROL   8      /* Maximum TTY control character list */
00246 #define TTYINTERRUPT    0
00247 #define TTYERASE        1
00248 #define TTYKILL         2
00249 #define TTYEOF          3
00250 #define TTYSUSPEND      4
00251 #define TTYREPRINT      5
00252 #define TTYDISCARD      6
00253 #define TTYWERASE       7
00254 
00255 /* input modes */
00256 #define LTERM0_RAW_MODE         0
00257 #define LTERM1_CANONICAL_MODE   1
00258 #define LTERM2_EDIT_MODE        2
00259 #define LTERM3_COMPLETION_MODE  3
00260 
00261 /* completion request codes */
00262 #define LTERM_NO_COMPLETION       0
00263 #define LTERM_TAB_COMPLETION      1
00264 #define LTERM_HISTORY_COMPLETION  2
00265 
00266 /* output modes */
00267 #define LTERM0_STREAM_MODE  0
00268 #define LTERM1_SCREEN_MODE  1
00269 #define LTERM2_LINE_MODE    2
00270 
00271 /* character/line action codes */
00272 #define LTERM_INSERT_ACTION 0
00273 #define LTERM_DELETE_ACTION 1
00274 #define LTERM_ERASE_ACTION  2
00275 
00276 /* List of characters escaped in XML */
00277 #define LTERM_AMP_ESCAPE    0
00278 #define LTERM_LT_ESCAPE     1
00279 #define LTERM_GT_ESCAPE     2
00280 #define LTERM_QUOT_ESCAPE   3
00281 #define LTERM_APOS_ESCAPE   4
00282 
00283 #define LTERM_XML_ESCAPES   5
00284 #define LTERM_PLAIN_ESCAPES 3
00285 
00286 /* Maximum no. of characters in an XML escape sequence (excluding NUL) */
00287 #define LTERM_MAXCHAR_ESCAPE 6
00288 
00289 /* input buffer pipe header "character" count */
00290 #define PIPEHEADER  2
00291 
00292 /* input buffer pipe header components */
00293 #define PHDR_CHARS  0
00294 #define PHDR_TYPE   1
00295 
00296 /* LTERM read in/out parameter structure */
00297 struct LtermRead {
00298   UNICHAR *buf;     /* Pointer to Unicode character buffer   (IN param) */
00299   UNISTYLE *style;  /* Pointer to character style buffer     (IN param) */
00300   int max_count;    /* max. number of characters in buffers  (IN param) */
00301   int read_count;   /* actual number of characters in buffers */
00302   int opcodes;      /* Returned opcodes */
00303   int opvals;       /* Returned opvalues */
00304   int buf_row;      /* row at which to display buffer data */
00305   int buf_col;      /* starting column at which to display buffer data */
00306   int cursor_row;   /* final cursor row position */
00307   int cursor_col;   /* final cursor column position */
00308 };
00309 
00310 /* LTERM input structure: managed by lterm_write */
00311 struct LtermInput {
00312 
00313   UNICHAR inputBuf[PIPEHEADER+MAXCOL]; /* holds data read from input buffer
00314                                         * pipe
00315                                         */
00316   int inputBufBytes;           /* Count of bytes already read in */
00317 
00318   int inputMode;               /* input mode:
00319                                 * 0 = raw mode
00320                                 * 1 = canonical mode
00321                                 * 2 = edit + canonical mode
00322                                 * 3 = completion + edit + canonical mode
00323                                 */
00324 
00325   int escapeFlag;              /* processing ESCAPE in line mode */
00326   int escapeCSIFlag;           /* processing ESCAPE Code Sequence Introducer */
00327   int escapeCSIArg;            /* ESCAPE Code Sequence Argument value */
00328 
00329   int inputOpcodes;            /* input opcodes */
00330 
00331   int clearInputLine;          /* true if input line buffer needs to be
00332                                 * cleared (after echoing) */
00333 
00334   UNICHAR inputLine[MAXCOL];   /* input line buffer:
00335                                   only MAXCOL-1 characters should actually
00336                                   be inserted in the buffer, to allow
00337                                   one character padding if necessary */
00338 
00339   int inputChars;              /* length of input line (characters);
00340                                 * should never exceed MAXCOL-1,
00341                                 * to allow for null termination
00342                                 */
00343   int inputCols;               /* number of displayed columns in input line;
00344                                 * a column corresponds to a single
00345                                 * plain text character transmitted to the
00346                                 * subordinate process, although it may occupy
00347                                 * multiple character positions, e.g.,
00348                                 * e.g., &lt represents "<"
00349                                 */
00350   int inputGlyphs;             /* number of displayed glyphs in input line;
00351                                 * a glyph corresponds to a logical column
00352                                 * on the layout, i.e., a single Unicode
00353                                 * character or an XML element, such as an
00354                                 * iconic representiion of an URI.
00355                                 */
00356 
00357   unsigned short inputColCharIndex[MAXCOL]; /* starting character index of
00358                                              * each column, including the
00359                                              * cursor column at end of line.
00360                                              * (inputCols+1 values should be
00361                                              * defined)
00362                                              */
00363 
00364   unsigned short inputGlyphCharIndex[MAXCOL]; /* starting character index
00365                                                * of each glyph, including
00366                                                * empty glyph at the end of
00367                                                * the line.
00368                                                * (inputGlyphs+1 values
00369                                                * should be defined)
00370                                                */
00371   unsigned short inputGlyphColIndex[MAXCOL]; /* starting column index of
00372                                               * each glyph
00373                                               * (inputGlyphs+1 values)
00374                                               */
00375 
00376   int inputCursorGlyph;           /* current input cursor glyph number (>=0) */
00377 };
00378 
00379 /* LtermOutput poll structure index count and values */
00380 #define POLL_COUNT 3
00381 #define POLL_INPUTBUF 0
00382 #define POLL_STDOUT   1
00383 #define POLL_STDERR   2
00384 
00385 /* LTERM output structure: managed by lterm_read */
00386 struct LtermOutput {
00387   struct POLLFD pollFD[POLL_COUNT];  /* output polling structure */
00388   long callbackTag[POLL_COUNT]; /* GTK callback tag for each FD (0 if none) */
00389   int nfds;                     /* count of "files" to be polled */
00390   int outputMode;               /* output mode:
00391                                  * 0 = full screen mode
00392                                  * 1 = line mode
00393                                  * 2 = command line mode
00394                                  */
00395 
00396   UNICHAR streamTerminator[MAXSTREAMTERM]; /* stream terminator buffer */
00397   int streamOpcodes;            /* Stream opcodes */
00398   int savedOutputMode;          /* saved output mode (prior to stream mode) */
00399 
00400   int insertMode;               /* character insert mode */
00401   int automaticNewline;         /* automatic newline mode */
00402 
00403   UNISTYLE styleMask;           /* current output style mask */
00404 
00405   char rawOUTBuf[MAXRAWINCOMPLETE]; /* incomplete raw STDOUT buffer */
00406   int rawOUTBytes;               /* incomplete raw STDOUT byte count */
00407 
00408   char rawERRBuf[MAXRAWINCOMPLETE]; /* incomplete raw STDERR buffer */
00409   int rawERRBytes;               /* incomplete raw STDERR byte count */
00410 
00411   UNICHAR decodedOutput[MAXCOL]; /* decoded output buffer:
00412                                     only MAXCOL-1 characters should actually
00413                                     be inserted in the buffer, to allow
00414                                     one character padding if necessary */
00415   UNISTYLE decodedStyle[MAXCOL]; /* decoded output style buffer */
00416   int decodedChars;              /* decoded character count;
00417                                     should never exceed MAXCOL-1 */
00418   int incompleteEscapeSequence;  /* Incomplete ESCAPE sequence flag */
00419 
00420   UNICHAR outputLine[MAXCOL];  /* output line buffer (processed);
00421                                   only MAXCOL-1 characters should actually
00422                                   be inserted in the buffer, to allow
00423                                   one character padding if necessary */
00424   UNISTYLE outputStyle[MAXCOL]; /* output style buffer for each character */
00425 
00426   int outputChars;             /* length of output line (characters)
00427                                   should never exceed MAXCOL-1 */
00428   int outputCursorChar;        /* output cursor character position (>=0) */
00429   int promptChars;             /* prompt character count */
00430   int outputModifiedChar;      /* leftmost modified character in output line */
00431 
00432   int cursorRow, cursorCol;    /* screen cursor row and column */
00433   int returnedCursorRow, returnedCursorCol;
00434                                /* returned screen cursor row and column */
00435 
00436   int topScrollRow, botScrollRow;    /* top and bottom scrolling rows */
00437 
00438   int modifiedCol[MAXROW];     /* first modified column in each row;
00439                                   -1 if no column has been modified */
00440 
00441   UNICHAR  *screenChar;        /* Screen character array (nRows*nCols long) */
00442   UNISTYLE *screenStyle;       /* Screen style array (nRows*nCols long) */
00443 };
00444 
00445 /* LTERM process structure: managed by lterm_create, lterm_close */
00446 struct LtermProcess {
00447   PROCESS processID;           /* process ID */
00448   FILEDESC processIN;          /* process input pipe */
00449   FILEDESC processOUT;         /* process output pipe */
00450   FILEDESC processERR;         /* process error pipe */
00451 };
00452 
00453 /* line terminal (LTERM) structure: managed by lterm_open, lterm_close */
00454 struct lterms { 
00455   int opened;                      /* LTERM opened status flag */
00456   int suspended;                   /* LTERM suspended flag:
00457                                     * an LTERM is suspended when an error
00458                                     * occurs, to prevent further I/O operations
00459                                     * which have unpredictable results.
00460                                     * The LTERM still needs to be closed to
00461                                     * release any resources used by it.
00462                                     * (a suspended LTERM is still open)
00463                                     */
00464 
00465   MUTEX_DECLARE(adminMutex);       /* LTERM administrative mutex */
00466   MUTEX_DECLARE(outputMutex);      /* LTERM output thread mutex */
00467 
00468   int adminMutexLocked;            /* administrative mutex lock status */
00469   int outputMutexLocked;           /* output mutex lock status */
00470 
00471   FILEDESC writeBUFFER, readBUFFER; /* input character BUFFER pipe */
00472 
00473   int options;                     /* TTY options */
00474   int ptyMode;                     /* pseudo-TTY mode flag */
00475   int noTTYEcho;                   /* no TTY echo flag */
00476   int disabledInputEcho;           /* disabled input echo flag */
00477   int restoreInputEcho;            /* restore input echo flag */
00478 
00479   int processType;                 /* Process type code */
00480   int maxInputMode;                /* maximum allowed input mode value */
00481   int readERRfirst;                /* Read STDERR before STDOUT */
00482   int interleave;                  /* interleave STDERR/STDOUT flag */
00483   UNICHAR control[MAXTTYCONTROL];  /* TTY control characters */
00484 
00485 
00486   int commandNumber;               /* output command number
00487                                     * (0 if not command line)
00488                                     */
00489   unsigned short lastCommandNum;   /* last command number */
00490   int completionRequest;           /* command completion request code:
00491                                     * LTERM_NO_COMPLETION, or
00492                                     * LTERM_TAB_COMPLETION, or
00493                                     * LTERM_HISTORY_COMPLETION
00494                                     */
00495   int completionChars;             /* command completion insert count */
00496 
00497   int inputBufRecord;              /* True if input buffer contains record */
00498 
00499   int inputLineBreak;              /* True if input line was transmitted
00500                                     * and plain text copy saved in echo buffer
00501                                     */
00502   UNICHAR echoLine[MAXCOL];        /* Plain text of echo line */
00503   int echoChars;                   /* Count of echo characters */
00504 
00505   int nRows;                       /* Number of rows */
00506   int nCols;                       /* Number of columns */
00507   int xPixels;                     /* Number of X pixels in screen */
00508   int yPixels;                     /* Number of Y pixels in screen */
00509 
00510   UNICHAR promptRegexp[MAXPROMPT]; /* prompt regular expression
00511                                       JUST A LIST OF DELIMITERS AT PRESENT */
00512 
00513   char cookie[MAXCOOKIESTR];       /* cookie string */
00514   char shellInitStr[MAXSHELLINITCMD][MAXSHELLINITSTR];
00515                                    /* shell initialization strings */
00516   int shellInitCommands;           /* shell init command count */
00517 
00518   struct ptys pty;                 /* pseudo-tty (PTY) stream info for LTERM */
00519   struct LtermProcess ltermProcess; /* LTERM process structure */
00520   struct LtermInput ltermInput;     /* LTERM input structure */
00521   struct LtermOutput ltermOutput;   /* LTERM output structure */
00522 };
00523 
00524 /* LTERM global variables */
00525 typedef struct { 
00526   int initialized;                  /* Initialization flag */
00527   struct lterms *termList[MAXTERM]; /* List of LTERMS */
00528   MUTEX_DECLARE(listMutex);         /* Thread lock to access to LTERM list */
00529   UNICHAR metaDelimiter;            /* Meta command delimiter (usually :) */
00530   char escapeChars[LTERM_XML_ESCAPES+1]; /* String of chars escaped in XML */
00531   UNICHAR escapeSeq[LTERM_XML_ESCAPES][LTERM_MAXCHAR_ESCAPE+1];
00532                                         /* XML character escape sequences */
00533   int escapeLen[LTERM_XML_ESCAPES];     /* XML char. escape sequence lengths */
00534 } LtermGlobal;
00535 
00536 extern LtermGlobal ltermGlobal;
00537 
00538 
00539 /* Visible prototypes */
00540 
00541 /* ltermIO.c */
00542 int ltermInterruptOutput(struct lterms *lts);
00543 int ltermSendLine(struct lterms *lts, UNICHAR uch,
00544                   int echoControl, int completionCode);
00545 int ltermRead(struct lterms *lts, struct LtermRead *ltr, int timeout);
00546 
00547 /* ltermInput.c */
00548 int ltermPlainTextInput(struct lterms *lts,
00549                         const UNICHAR *buf, int count, int *opcodes);
00550 int ltermCancelCompletion(struct lterms *lts);
00551 int ltermInsertChar(struct LtermInput *lti, UNICHAR uch);
00552 void ltermSwitchToRawMode(struct lterms *lts);
00553 void ltermClearInputLine(struct lterms *lts);
00554 int ltermDeleteGlyphs(struct LtermInput *lti, int count);
00555 int ltermSendData(struct lterms *lts, const UNICHAR *buf, int count);
00556 int ltermSendChar(struct lterms *lts, const char *buf, int count);
00557 
00558 /* ltermOutput.c */
00559 int ltermProcessOutput(struct lterms *lts, int *opcodes, int *opvals,
00560                        int *oprow);
00561 int ltermReceiveData(struct lterms *lts, int readERR);
00562 void ltermClearOutputLine(struct lterms *lts);
00563 int ltermClearOutputScreen(struct lterms *lts);
00564 int ltermSwitchToStreamMode(struct lterms *lts, int streamOpcodes,
00565                             const UNICHAR *streamTerminator);
00566 int ltermSwitchToScreenMode(struct lterms *lts);
00567 int ltermSwitchToLineMode(struct lterms *lts);
00568 
00569 /* ltermEscape.c */
00570 int ltermProcessEscape(struct lterms *lts, const UNICHAR *buf,
00571                        int count, const UNISTYLE *style, int *consumed,
00572                        int *opcodes, int *opvals, int *oprow);
00573 int ltermInsDelEraseChar(struct lterms *lts, int count, int action);
00574 int ltermInsDelEraseLine(struct lterms *lts, int count, int row, int action);
00575 
00576 #endif  /* _LTERMPRIVATE_H */