bluez/common/glib-ectomy.h

93 lines
1.9 KiB
C
Raw Normal View History

2004-12-13 21:58:56 +08:00
#ifndef __GLIB_ECTOMY_H
#define __GLIB_ECTOMY_H
2003-03-08 07:10:29 +08:00
#include <stdlib.h>
#include <sys/poll.h>
2004-12-13 21:58:56 +08:00
typedef char gchar;
typedef short gshort;
typedef long glong;
typedef int gint;
typedef gint gboolean;
2003-03-08 07:10:29 +08:00
2004-12-13 21:58:56 +08:00
typedef unsigned char guchar;
typedef unsigned short gushort;
typedef unsigned long gulong;
typedef unsigned int guint;
2003-03-08 07:10:29 +08:00
2004-12-13 21:58:56 +08:00
typedef float gfloat;
typedef double gdouble;
2003-03-08 07:10:29 +08:00
2004-12-13 21:58:56 +08:00
typedef void * gpointer;
typedef const void * gconstpointer;
2003-03-08 07:10:29 +08:00
2004-12-13 21:58:56 +08:00
typedef size_t gsize;
typedef ssize_t gssize;
2003-03-08 07:10:29 +08:00
2003-04-27 23:46:45 +08:00
#ifndef SSIZE_MAX
#define SSIZE_MAX INT_MAX
#endif
2003-03-08 07:10:29 +08:00
typedef struct _GIOChannel {
int fd;
} GIOChannel;
typedef struct _GMainContext {
int dummy;
} GMainContext;
typedef struct _GMainLoop {
int bail;
} GMainLoop;
2004-12-13 21:58:56 +08:00
typedef enum {
G_IO_ERROR_NONE,
G_IO_ERROR_AGAIN,
G_IO_ERROR_INVAL,
G_IO_ERROR_UNKNOWN
2003-03-08 07:10:29 +08:00
} GIOError;
2004-12-13 21:58:56 +08:00
typedef enum {
G_IO_STATUS_ERROR = -1,
G_IO_STATUS_NORMAL = 0,
G_IO_STATUS_EOF = 1,
G_IO_STATUS_AGAIN = 2
2003-03-08 07:10:29 +08:00
} GIOStatus;
2004-12-13 21:58:56 +08:00
#ifndef FALSE
#define FALSE (0)
2003-03-08 07:10:29 +08:00
#endif
2004-12-13 21:58:56 +08:00
#ifndef TRUE
#define TRUE (!FALSE)
2003-03-08 07:10:29 +08:00
#endif
2004-12-13 21:58:56 +08:00
typedef enum {
G_IO_IN = POLLIN,
G_IO_OUT = POLLOUT,
G_IO_PRI = POLLPRI,
G_IO_ERR = POLLERR,
G_IO_HUP = POLLHUP,
G_IO_NVAL = POLLNVAL
2003-03-08 07:10:29 +08:00
} GIOCondition;
2004-12-13 21:58:56 +08:00
typedef gboolean (*GIOFunc) (GIOChannel *source, GIOCondition condition, gpointer data);
2003-03-08 07:10:29 +08:00
2004-12-13 21:58:56 +08:00
GIOError g_io_channel_read(GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read);
void g_io_channel_close(GIOChannel *channel);
2004-02-18 02:04:03 +08:00
2004-12-13 21:58:56 +08:00
GIOChannel *g_io_channel_unix_new(int fd);
gint g_io_channel_unix_get_fd(GIOChannel *channel);
guint g_io_add_watch(GIOChannel *channel, GIOCondition condition, GIOFunc func, gpointer user_data);
void g_io_remove_watch(guint id);
2003-03-08 07:10:29 +08:00
2004-12-13 21:58:56 +08:00
GMainLoop *g_main_loop_new(GMainContext *context, gboolean is_running);
void g_main_loop_run(GMainLoop *loop);
void g_main_loop_quit(GMainLoop *loop);
2003-03-08 07:10:29 +08:00
2004-12-13 21:58:56 +08:00
#define g_main_new(is_running) g_main_loop_new(NULL, is_running);
#define g_main_run(loop) g_main_loop_run(loop)
#define g_main_quit(loop) g_main_loop_quit(loop)
2003-03-08 07:10:29 +08:00
2004-12-13 21:58:56 +08:00
#endif /* __GLIB_ECTOMY_H */