many rewrites, let rote_vt_write be a more simple wrapper around write
[apps/madtty.git] / madtty / madtty.h
index 69d7288..e8123db 100644 (file)
@@ -85,7 +85,7 @@
 
 /* Represents each of the text cells in the terminal screen */
 typedef struct RoteCell_ {
-    unsigned char ch;    /* >= 32, that is, control characters are not
+    unsigned int ch;     /* >= 32, that is, control characters are not
                           * allowed to be on the virtual screen */
 
     unsigned char attr;  /* a color attribute, as described previously */
@@ -125,6 +125,7 @@ typedef struct RoteTerm_ {
     RoteTermPrivate *pd;         /* private state data */
 
     bool insert;                 /* insert or replace mode */
+
     /* --- dirtiness flags: the following flags will be raised when the
      * corresponding items are modified. They can only be unset by YOU
      * (when, for example, you redraw the term or something) --- */
@@ -175,22 +176,8 @@ pid_t rote_vt_forkpty(RoteTerm *rt, const char *path, const char *argv[]);
  * certainly tidy. */
 void rote_vt_forsake_child(RoteTerm *rt);
 
-/* Does some data plumbing, that is, sees if the sub process has
- * something to write to the terminal, and if so, write it. If you
- * called rote_vt_fork to start a forked process, you must call
- * this function regularly to update the terminal. 
- *
- * This function will not block, that is, if there is no data to be
- * read from the child process it will return immediately. */
-void rote_vt_update(RoteTerm *rt);
-
 int rote_vt_read(RoteTerm *rt, char *buf, int buflen);
-
-/* Puts data into the terminal: if there is a forked process running,
- * the data will be sent to it. If there is no forked process,
- * the data will simply be injected into the terminal (as in
- * rote_vt_inject) */
-void rote_vt_write(RoteTerm *rt, const char *data, int length);
+int rote_vt_write(RoteTerm *rt, const char *data, int length);
 
 /* Inject data into the terminal. <data> needs NOT be 0-terminated:
  * its length is solely determined by the <length> parameter. Please
@@ -199,7 +186,7 @@ void rote_vt_write(RoteTerm *rt, const char *data, int length);
  * running in the terminal (if any). For that, you might want
  * to use rote_vt_write.
  */
-void rote_vt_inject(RoteTerm *rt, const char *data, int length);
+int rote_vt_inject(RoteTerm *rt, const char *data, int length);
 
 #ifdef USE_NCURSES
 /* Paints the virtual terminal screen on the given window, putting
@@ -217,8 +204,6 @@ void rote_vt_inject(RoteTerm *rt, const char *data, int length);
  * cursor of the terminal is supposed to be.
  *
  * This function does not call wrefresh(win); you have to do that yourself.
- * This function automatically calls rote_vt_update prior to drawing
- * so that the drawn contents are accurate.
  */
 void rote_vt_draw(RoteTerm *rt, WINDOW *win, int startrow, int startcol,
                   void (*cur_set_attr)(WINDOW *win, unsigned char attr));