Mercurial > MadButterfly
changeset 551:9e69c4a0f565 Android_Skia
rename njs_ev_data_t to njs_runtime_t
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 06 Jun 2010 14:04:03 +0800 |
parents | 127499ab2412 |
children | dd8d32b4c899 |
files | nodejs/X_supp_njs.c nodejs/X_supp_njs.h |
diffstat | 2 files changed, 30 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/nodejs/X_supp_njs.c Sun Jun 06 13:58:01 2010 +0800 +++ b/nodejs/X_supp_njs.c Sun Jun 06 14:04:03 2010 +0800 @@ -15,25 +15,25 @@ #define ASSERT(x) #endif -typedef struct _njs_ev_data { +typedef struct _njs_runtime { ev_io iowatcher; ev_timer tmwatcher; int enable_timer; - void *rt; -} njs_ev_data_t; + void *xrt; +} njs_runtime_t; static void timer_cb(EV_P_ ev_timer *tmwatcher, int revent); /*! \brief Register next timeout with libev. */ static void -set_next_timeout(njs_ev_data_t *ev_data) { +set_next_timeout(njs_runtime_t *ev_data) { mb_tman_t *tman; mb_timeval_t now, tmo; ev_tstamp tout; int r; - tman = X_MB_tman(ev_data->rt); + tman = X_MB_tman(ev_data->xrt); get_now(&now); r = mb_tman_next_timeout(tman, &now, &tmo); if(r == 0) { @@ -49,12 +49,12 @@ static void x_conn_cb(EV_P_ ev_io *iowatcher, int revent) { - njs_ev_data_t *ev_data = MEM2OBJ(iowatcher, njs_ev_data_t, iowatcher); + njs_runtime_t *ev_data = MEM2OBJ(iowatcher, njs_runtime_t, iowatcher); redraw_man_t *rdman; extern void _X_MB_handle_x_event_for_nodejs(void *rt); - rdman = X_MB_rdman(ev_data->rt); - _X_MB_handle_x_event_for_nodejs(ev_data->rt); + rdman = X_MB_rdman(ev_data->xrt); + _X_MB_handle_x_event_for_nodejs(ev_data->xrt); rdman_redraw_changed(rdman); if(ev_data->enable_timer == 0) /* no installed timeout */ @@ -63,19 +63,19 @@ static void timer_cb(EV_P_ ev_timer *tmwatcher, int revent) { - njs_ev_data_t *ev_data = MEM2OBJ(tmwatcher, njs_ev_data_t, tmwatcher); + njs_runtime_t *ev_data = MEM2OBJ(tmwatcher, njs_runtime_t, tmwatcher); mb_tman_t *tman; redraw_man_t *rdman; mb_timeval_t now; extern int _X_MB_flush_x_conn_nodejs(void *rt); - tman = X_MB_tman(ev_data->rt); + tman = X_MB_tman(ev_data->xrt); get_now(&now); mb_tman_handle_timeout(tman, &now); - rdman = X_MB_rdman(ev_data->rt); + rdman = X_MB_rdman(ev_data->xrt); rdman_redraw_changed(rdman); - _X_MB_flush_x_conn_nodejs(ev_data->rt); + _X_MB_flush_x_conn_nodejs(ev_data->xrt); set_next_timeout(ev_data); } @@ -85,8 +85,8 @@ * \param rt is a runtime object for X. */ void -X_njs_MB_handle_connection(njs_ev_data_t *ev_data) { - void *rt = ev_data->rt; +X_njs_MB_handle_connection(njs_runtime_t *ev_data) { + void *xrt = ev_data->xrt; mb_tman_t *tman; mb_timeval_t now, tmo; ev_tstamp tout; @@ -97,17 +97,17 @@ /* * Setup watcher for X connection. */ - fd = _X_MB_get_x_conn_for_nodejs(rt); + fd = _X_MB_get_x_conn_for_nodejs(xrt); ev_io_init(&ev_data->iowatcher, x_conn_cb, fd, EV_READ); ev_io_start(&ev_data->iowatcher); set_next_timeout(ev_data); } -/*! \brief Free njs_ev_data_t. +/*! \brief Free njs_runtime_t. */ void -X_njs_MB_free(njs_ev_data_t *ev_data) { +X_njs_MB_free(njs_runtime_t *ev_data) { /* * stop IO and timer watcher */ @@ -116,23 +116,23 @@ ev_timer_stop(&ev_data->tmwatcher); } -njs_ev_data_t * +njs_runtime_t * X_njs_MB_new(char *display_name, int w, int h) { - njs_ev_data_t *ev_data; - void *rt; + njs_runtime_t *ev_data; + void *xrt; - ev_data = (njs_ev_data_t *)malloc(sizeof(njs_ev_data_t)); + ev_data = (njs_runtime_t *)malloc(sizeof(njs_runtime_t)); ASSERT(ev_data != NULL); - rt = X_MB_new(display_name, w, h); + xrt = X_MB_new(display_name, w, h); - ev_data->rt = rt; + ev_data->xrt = xrt; ev_data->enable_timer = 0; /* no timer, now */ return ev_data; } void * -_X_njs_MB_get_runtime(nsj_ev_data_t *ev_data) { - return ev_data->rt; +_X_njs_MB_get_runtime(njs_runtime_t *ev_data) { + return ev_data->xrt; }
--- a/nodejs/X_supp_njs.h Sun Jun 06 13:58:01 2010 +0800 +++ b/nodejs/X_supp_njs.h Sun Jun 06 14:04:03 2010 +0800 @@ -1,12 +1,12 @@ #ifndef __X_SUPP_NJS_H_ #define __X_SUPP_NJS_H_ -struct _njs_ev_data; -typedef struct _njs_ev_data njs_ev_data_t; +struct _njs_runtime; +typedef struct _njs_runtime njs_runtime_t; -extern void X_njs_MB_handle_connection(njs_ev_data_t *ev_data); -extern void X_njs_MB_free(njs_ev_data_t *ev_data); -extern njs_ev_data_t *X_njs_MB_new(char *display_name, int w, int h); +extern void X_njs_MB_handle_connection(njs_runtime_t *ev_data); +extern void X_njs_MB_free(njs_runtime_t *ev_data); +extern njs_runtime_t *X_njs_MB_new(char *display_name, int w, int h); extern void *_X_njs_MB_get_runtime(nsj_ev_data_t *ev_data); #endif /* __X_SUPP_NJS_H_ */