2005-07-10 19:54:58 -07:00
|
|
|
/*
|
2005-10-13 07:08:18 -07:00
|
|
|
* mootermpt-private.h
|
2005-07-10 19:54:58 -07:00
|
|
|
*
|
2006-02-23 06:03:17 -08:00
|
|
|
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2005-07-10 19:54:58 -07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
2005-07-23 21:58:57 -07:00
|
|
|
*/
|
2005-07-10 19:54:58 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#ifndef MOOTERM_COMPILATION
|
|
|
|
#error "This file may not be included"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __MOO_TERM_PT_PRIVATE_H__
|
|
|
|
#define __MOO_TERM_PT_PRIVATE_H__
|
2005-07-10 19:54:58 -07:00
|
|
|
|
|
|
|
#include "mooterm/mootermpt.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
|
|
struct _MooTermPtPrivate {
|
|
|
|
struct _MooTerm *term;
|
2005-07-14 23:34:31 -07:00
|
|
|
gboolean child_alive;
|
2005-07-10 19:54:58 -07:00
|
|
|
GQueue *pending_write; /* list->data is GByteArray* */
|
|
|
|
guint pending_write_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
inline static void pt_discard (GSList **list)
|
|
|
|
{
|
|
|
|
GSList *l;
|
|
|
|
|
|
|
|
for (l = *list; l != NULL; ++l)
|
|
|
|
g_byte_array_free (l->data, TRUE);
|
|
|
|
|
|
|
|
g_slist_free (*list);
|
|
|
|
*list = NULL;
|
|
|
|
}
|
|
|
|
|
2006-04-03 00:56:05 -07:00
|
|
|
inline static void pt_discard_pending_write (MooTermPt *pt)
|
2005-07-10 19:54:58 -07:00
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
for (l = pt->priv->pending_write->head; l != NULL; l = l->next)
|
|
|
|
g_byte_array_free (l->data, TRUE);
|
|
|
|
|
|
|
|
while (!g_queue_is_empty (pt->priv->pending_write))
|
|
|
|
g_queue_pop_head (pt->priv->pending_write);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline static void pt_add_data (GSList **list, const char *data, gssize len)
|
|
|
|
{
|
|
|
|
if (data && len && (len > 0 || data[0]))
|
|
|
|
{
|
|
|
|
GByteArray *ar;
|
|
|
|
|
|
|
|
if (len < 0)
|
|
|
|
len = strlen (data);
|
|
|
|
|
|
|
|
ar = g_byte_array_sized_new ((guint) len);
|
|
|
|
*list = g_slist_append (*list,
|
2005-07-19 07:01:41 -07:00
|
|
|
g_byte_array_append (ar, (const guint8 *)data, len));
|
2005-07-10 19:54:58 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#endif /* __MOO_TERM_PT_PRIVATE_H__ */
|