# HG changeset patch # User Thinker K.F. Li # Date 1290584668 -28800 # Node ID df6ee4568ca2bedb0b24f2e0c2e8e97f5da663b5 # Parent 1f93f38688c2ce402b46aaa9b3326769968d6b65 Rename X_njs_MB_* to njs_mb_* for nodejs plugin. diff -r 1f93f38688c2 -r df6ee4568ca2 nodejs/X_supp_njs.c --- a/nodejs/X_supp_njs.c Wed Nov 24 14:45:17 2010 +0800 +++ b/nodejs/X_supp_njs.c Wed Nov 24 15:44:28 2010 +0800 @@ -109,7 +109,7 @@ } void -X_njs_MB_reg_timer_man(void) { +njs_mb_reg_timer_man(void) { mb_reg_timer_factory(&njs_timer_factory); } @@ -276,7 +276,7 @@ /*! \brief Register an IO factory with MadButterfly backend. */ void -X_njs_MB_reg_IO_man(void) { +njs_mb_reg_IO_man(void) { mb_reg_IO_factory(&njs_io_factory); } @@ -288,7 +288,7 @@ * \param rt is a runtime object for X. */ void -X_njs_MB_init_handle_connection(njs_runtime_t *rt) { +njs_mb_init_handle_connection(njs_runtime_t *rt) { void *xrt = rt->xrt; int fd; extern int _X_MB_get_x_conn_for_nodejs(void *rt); @@ -308,7 +308,7 @@ /*! \brief Free njs_runtime_t. */ void -X_njs_MB_free(njs_runtime_t *rt) { +njs_mb_free(njs_runtime_t *rt) { /*! * TODO: Release all IO and timer request. */ @@ -319,7 +319,7 @@ /*! \brief Free njs_runtime_t. */ void -X_njs_MB_free_keep_win(njs_runtime_t *rt) { +njs_mb_free_keep_win(njs_runtime_t *rt) { /* * TODO: Release all IO and timer request. */ @@ -328,7 +328,7 @@ } int -X_njs_MB_flush(njs_runtime_t *rt) { +njs_mb_flush(njs_runtime_t *rt) { mb_rt_t *mb_rt = rt->xrt; int r; @@ -337,7 +337,7 @@ } njs_runtime_t * -X_njs_MB_new(char *display_name, int w, int h) { +njs_mb_new(char *display_name, int w, int h) { njs_runtime_t *rt; mb_rt_t *mb_rt; @@ -354,10 +354,10 @@ /*! \brief Create a njs_runtime_t for an existed window. * * The njs_runtime_t created by this function must be free by - * X_njs_MB_free_keep_win(). + * njs_mb_free_keep_win(). */ njs_runtime_t * -X_njs_MB_new_with_win(void *display, long win) { +njs_mb_new_with_win(void *display, long win) { njs_runtime_t *rt; mb_rt_t *mb_rt; @@ -374,7 +374,7 @@ /*! \brief Pass a X event to X runtime. */ void -X_njs_MB_handle_single_event(njs_runtime_t *rt, void *evt) { +njs_mb_handle_single_event(njs_runtime_t *rt, void *evt) { #if 0 void *xrt = rt->xrt; extern void _X_MB_handle_single_event(void *rt, void *evt); @@ -386,7 +386,7 @@ /*! \brief Called at end of an iteration of event loop. */ void -X_njs_MB_no_more_event(njs_runtime_t *rt) { +njs_mb_no_more_event(njs_runtime_t *rt) { #if 0 mb_rt_t *xrt = rt->xrt; extern void _X_MB_no_more_event(mb_rt_t *rt); @@ -398,6 +398,6 @@ /*! \brief Get X runtime that is backend of this njs runtime. */ mb_rt_t * -_X_njs_MB_get_X_runtime(njs_runtime_t *rt) { +_njs_mb_get_runtime(njs_runtime_t *rt) { return rt->xrt; } diff -r 1f93f38688c2 -r df6ee4568ca2 nodejs/X_supp_njs.h --- a/nodejs/X_supp_njs.h Wed Nov 24 14:45:17 2010 +0800 +++ b/nodejs/X_supp_njs.h Wed Nov 24 15:44:28 2010 +0800 @@ -1,7 +1,7 @@ // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- // vim: sw=4:ts=8:sts=4 -#ifndef __X_SUPP_NJS_H_ -#define __X_SUPP_NJS_H_ +#ifndef __SUPP_NJS_H_ +#define __SUPP_NJS_H_ #include #include @@ -10,22 +10,22 @@ mb_rt_t *xrt; } njs_runtime_t; -extern void X_njs_MB_reg_timer_man(void); -extern void X_njs_MB_reg_IO_man(void); -/* extern void X_njs_MB_init_handle_connection(njs_runtime_t *rt); */ -extern void X_njs_MB_free(njs_runtime_t *rt); -extern njs_runtime_t *X_njs_MB_new(char *display_name, int w, int h); -extern void X_njs_MB_free_keep_win(njs_runtime_t *rt); -extern njs_runtime_t *X_njs_MB_new_with_win(void *display, long win); -extern int X_njs_MB_flush(njs_runtime_t *rt); -extern void X_njs_MB_handle_single_event(njs_runtime_t *rt, void *evt); -extern void X_njs_MB_no_more_event(njs_runtime_t *rt); -extern mb_rt_t *_X_njs_MB_get_X_runtime(njs_runtime_t *rt); +extern void njs_mb_reg_timer_man(void); +extern void njs_mb_reg_IO_man(void); +/* extern void njs_mb_init_handle_connection(njs_runtime_t *rt); */ +extern void njs_mb_free(njs_runtime_t *rt); +extern njs_runtime_t *njs_mb_new(char *display_name, int w, int h); +extern void njs_mb_free_keep_win(njs_runtime_t *rt); +extern njs_runtime_t *njs_mb_new_with_win(void *display, long win); +extern int njs_mb_flush(njs_runtime_t *rt); +extern void njs_mb_handle_single_event(njs_runtime_t *rt, void *evt); +extern void njs_mb_no_more_event(njs_runtime_t *rt); +extern mb_rt_t *_njs_mb_get_runtime(njs_runtime_t *rt); -#define X_njs_MB_kbevents(rt) mb_runtime_kbevents((rt)->xrt) -#define X_njs_MB_rdman(rt) mb_runtime_rdman((rt)->xrt) -#define X_njs_MB_timer_man(rt) mb_runtime_timer_man((rt)->xrt) -#define X_njs_MB_ob_factory(rt) mb_runtime_ob_factory((rt)->xrt) -#define X_njs_MB_img_ldr(rt) mb_runtime_img_ldr((rt)->xrt) +#define njs_mb_kbevents(rt) mb_runtime_kbevents((rt)->xrt) +#define njs_mb_rdman(rt) mb_runtime_rdman((rt)->xrt) +#define njs_mb_timer_man(rt) mb_runtime_timer_man((rt)->xrt) +#define njs_mb_ob_factory(rt) mb_runtime_ob_factory((rt)->xrt) +#define njs_mb_img_ldr(rt) mb_runtime_img_ldr((rt)->xrt) -#endif /* __X_SUPP_NJS_H_ */ +#endif /* __SUPP_NJS_H_ */ diff -r 1f93f38688c2 -r df6ee4568ca2 nodejs/mbfly_njs.cc --- a/nodejs/mbfly_njs.cc Wed Nov 24 14:45:17 2010 +0800 +++ b/nodejs/mbfly_njs.cc Wed Nov 24 15:44:28 2010 +0800 @@ -22,7 +22,7 @@ coord_t *coord; redraw_man_t *rdman; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); coord = rdman_coord_new(rdman, parent); if(coord == NULL) { *err = "Can not allocate a redraw_man_t"; @@ -46,7 +46,7 @@ xnjsmb_redraw_changed(njs_runtime_t *rt) { redraw_man_t *rdman; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); rdman_redraw_changed(rdman); } @@ -54,35 +54,35 @@ xnjsmb_redraw_all(njs_runtime_t *rt) { redraw_man_t *rdman; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); rdman_redraw_all(rdman); } static void xnjsmb_handle_single_event(njs_runtime_t *rt, void *evt) { - X_njs_MB_handle_single_event(rt, evt); + njs_mb_handle_single_event(rt, evt); } static void xnjsmb_no_more_event(njs_runtime_t *rt) { - X_njs_MB_no_more_event(rt); + njs_mb_no_more_event(rt); } static njs_runtime_t * -_X_njs_MB_new(Handle self, char *display_name, +_njs_mb_new(Handle self, char *display_name, int width, int height) { njs_runtime_t *obj; subject_t *subject; Handle subject_o; - obj = X_njs_MB_new(display_name, width, height); + obj = njs_mb_new(display_name, width, height); WRAP(self, obj); /* mkroot need a wrapped object, but * it is wrapped after returning of * this function. So, we wrap it * here. */ xnjsmb_coord_mkroot(self); - subject = X_njs_MB_kbevents(obj); + subject = njs_mb_kbevents(obj); subject_o = export_xnjsmb_auto_subject_new(subject); SET(self, "kbevents", subject_o); @@ -90,20 +90,20 @@ } static njs_runtime_t * -_X_njs_MB_new_with_win(Handle self, void *display, +_njs_mb_new_with_win(Handle self, void *display, long win) { njs_runtime_t *obj; subject_t *subject; Handle subject_o; - obj = X_njs_MB_new_with_win(display, win); + obj = njs_mb_new_with_win(display, win); WRAP(self, obj); /* mkroot need a wrapped object, but * it is wrapped after returning of * this function. So, we wrap it * here. */ xnjsmb_coord_mkroot(self); - subject = X_njs_MB_kbevents(obj); + subject = njs_mb_kbevents(obj); subject_o = export_xnjsmb_auto_subject_new(subject); SET(self, "kbevents", subject_o); @@ -143,7 +143,7 @@ redraw_man_t *rdman; rt = (njs_runtime_t *)UNWRAP(mbrt); - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); return rdman; } @@ -170,8 +170,8 @@ xnjsmb_auto_mb_rt_init(); xnjsmb_auto_mb_rt_display_init(); xnjsmb_auto_mb_rt_with_win_init(); - X_njs_MB_reg_timer_man(); - X_njs_MB_reg_IO_man(); + njs_mb_reg_timer_man(); + njs_mb_reg_IO_man(); /* * Add properties to mb_rt templates for other modules. diff -r 1f93f38688c2 -r df6ee4568ca2 nodejs/mbfly_njs.m4 --- a/nodejs/mbfly_njs.m4 Wed Nov 24 14:45:17 2010 +0800 +++ b/nodejs/mbfly_njs.m4 Wed Nov 24 15:44:28 2010 +0800 @@ -8,7 +8,7 @@ (([MOD], [xnjsmb_mb_rt_objs_mod]))), METHOD([redraw_changed], [xnjsmb_redraw_changed], (), 0, []), METHOD([redraw_all], [xnjsmb_redraw_all], (), 0, []), - METHOD([flush], [X_njs_MB_flush], (), 0, []), + METHOD([flush], [njs_mb_flush], (), 0, []), METHOD([path_new], [xnjsmb_path_new], (STR(txt)), 1, [OBJ([path], [shape_t])], (([MOD], [xnjsmb_mb_rt_objs_mod]))), METHOD([stext_new], [xnjsmb_stext_new], @@ -44,7 +44,7 @@ (OBJ([evt], [event], [void])), 1, []), METHOD([no_more_event], [xnjsmb_no_more_event], (), 0, [])], - ((CTOR, ([_X_njs_MB_new], (SELF, STR(display_name), INT(width), INT(height)), 3)))dnl + ((CTOR, ([_njs_mb_new], (SELF, STR(display_name), INT(width), INT(height)), 3)))dnl ) dnl dnl @@ -57,7 +57,7 @@ dnl STRUCT([mb_rt_with_win], [njs_runtime_t], [], [], - ((CTOR, ([_X_njs_MB_new_with_win],dnl + ((CTOR, ([_njs_mb_new_with_win],dnl (SELF, OBJ([display], [mb_rt_display], [void]),dnl INT([window])),dnl 2)),dnl diff -r 1f93f38688c2 -r df6ee4568ca2 nodejs/paints.cc --- a/nodejs/paints.cc Wed Nov 24 14:45:17 2010 +0800 +++ b/nodejs/paints.cc Wed Nov 24 15:44:28 2010 +0800 @@ -195,7 +195,7 @@ paint_t *paint; redraw_man_t *rdman; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); paint = rdman_paint_color_new(rdman, r, g, b, a); if(paint == NULL) { *err = "can not allocate a paint_color_t"; @@ -211,7 +211,7 @@ paint_t *paint; redraw_man_t *rdman; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); paint = rdman_paint_image_new(rdman, img); if(paint == NULL) { *err = "can not allocate a paint_image_t"; @@ -228,7 +228,7 @@ paint_t *paint; redraw_man_t *rdman; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); paint = rdman_paint_linear_new(rdman, x1, y1, x2, y2); if(paint == NULL) { *err = "can not allocate a paint_linear_t"; @@ -245,7 +245,7 @@ paint_t *paint; redraw_man_t *rdman; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); paint = rdman_paint_radial_new(rdman, cx, cy, r); if(paint == NULL) { *err = "can not allocate a paint_radial_t"; diff -r 1f93f38688c2 -r df6ee4568ca2 nodejs/shapes.cc --- a/nodejs/shapes.cc Wed Nov 24 14:45:17 2010 +0800 +++ b/nodejs/shapes.cc Wed Nov 24 15:44:28 2010 +0800 @@ -282,7 +282,7 @@ redraw_man_t *rdman; shape_t *sh; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); sh = rdman_shape_path_new(rdman, d); /* Code generator supposes that callee should free the memory */ free((void *)d); @@ -295,7 +295,7 @@ redraw_man_t *rdman; shape_t *sh; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); sh = rdman_shape_stext_new(rdman, txt, x, y); /* Code generator supposes that callee should free the memory */ free((void *)txt); @@ -308,7 +308,7 @@ redraw_man_t *rdman; shape_t *sh; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); sh = rdman_shape_image_new(rdman, x, y, w, h); return sh; @@ -320,7 +320,7 @@ redraw_man_t *rdman; shape_t *sh; - rdman = X_njs_MB_rdman(rt); + rdman = njs_mb_rdman(rt); sh = rdman_shape_rect_new(rdman, x, y, w, h, rx, ry); if(sh == NULL) { *err = "Can not create a sh_rect_t";