… | |
… | |
106 | ***************************************************************************** |
106 | ***************************************************************************** |
107 | * PROTOTYPES |
107 | * PROTOTYPES |
108 | ***************************************************************************** |
108 | ***************************************************************************** |
109 | */ |
109 | */ |
110 | // main.C |
110 | // main.C |
111 | void * rxvt_malloc (size_t size); |
111 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
112 | void * rxvt_calloc (size_t number, size_t size); |
112 | extern bool rxvt_set_locale (const char *locale) NOTHROW; |
113 | void * rxvt_realloc (void *ptr, size_t size); |
113 | extern void rxvt_push_locale (const char *locale) NOTHROW; |
|
|
114 | extern void rxvt_pop_locale () NOTHROW; |
114 | |
115 | |
115 | // misc.C |
116 | // misc.C |
116 | char * rxvt_wcstombs (const wchar_t *str, int len = -1); |
117 | char * rxvt_wcstombs (const wchar_t *str, int len = -1); |
117 | wchar_t * rxvt_mbstowcs (const char *str, int len = -1); |
118 | wchar_t * rxvt_mbstowcs (const char *str, int len = -1); |
118 | char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); |
119 | char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); |
… | |
… | |
127 | |
128 | |
128 | char * rxvt_strtrim (char *str) NOTHROW; |
129 | char * rxvt_strtrim (char *str) NOTHROW; |
129 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
130 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
130 | void rxvt_freecommastring (char **cs) NOTHROW; |
131 | void rxvt_freecommastring (char **cs) NOTHROW; |
131 | |
132 | |
|
|
133 | void * rxvt_malloc (size_t size); |
|
|
134 | void * rxvt_calloc (size_t number, size_t size); |
|
|
135 | void * rxvt_realloc (void *ptr, size_t size); |
|
|
136 | |
132 | ///////////////////////////////////////////////////////////////////////////// |
137 | ///////////////////////////////////////////////////////////////////////////// |
133 | |
138 | |
134 | // temporarily replace the process environment |
139 | // temporarily replace the process environment |
135 | extern char **environ; |
140 | extern char **environ; |
136 | extern char **rxvt_environ; // the original environ pointer |
141 | extern char **rxvt_environ; // the original environ pointer |
137 | |
142 | |
|
|
143 | static inline void |
138 | static inline void set_environ (stringvec *envv) |
144 | set_environ (stringvec *envv) |
139 | { |
145 | { |
140 | #if ENABLE_PERL |
146 | #if ENABLE_PERL |
141 | assert (envv); |
147 | assert (envv); |
142 | #else |
148 | #else |
143 | if (envv) |
149 | if (envv) |
144 | #endif |
150 | #endif |
145 | environ = (char **)envv->begin (); |
151 | environ = (char **)envv->begin (); |
146 | } |
152 | } |
147 | |
153 | |
148 | static inline void set_environ (char **envv) |
154 | static inline void |
|
|
155 | set_environ (char **envv) |
149 | { |
156 | { |
150 | #if ENABLE_PERL |
157 | #if ENABLE_PERL |
151 | assert (envv); |
158 | assert (envv); |
152 | #else |
159 | #else |
153 | if (envv) |
160 | if (envv) |
… | |
… | |
655 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
662 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
656 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
663 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
657 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) |
664 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) |
658 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) |
665 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) |
659 | |
666 | |
660 | // for m >= -n, ensure remainder lies between 0..n-1 |
|
|
661 | #define MOD(m,n) (((m) + (n)) % (n)) |
|
|
662 | |
|
|
663 | #define LINENO(n) MOD (term_start + int(n), total_rows) |
667 | #define LINENO(n) MOD (term_start + int(n), total_rows) |
664 | #define ROW(n) row_buf [LINENO (n)] |
668 | #define ROW(n) row_buf [LINENO (n)] |
665 | |
669 | |
666 | /* how to build & extract colors and attributes */ |
670 | /* how to build & extract colors and attributes */ |
667 | #define GET_BASEFG(x) (((x) & RS_fgMask)) |
671 | #define GET_BASEFG(x) (((x) & RS_fgMask)) |
… | |
… | |
724 | - scrollbar_minheight ()) |
728 | - scrollbar_minheight ()) |
725 | |
729 | |
726 | typedef callback<void (const char *)> log_callback; |
730 | typedef callback<void (const char *)> log_callback; |
727 | typedef callback<int (int)> getfd_callback; |
731 | typedef callback<int (int)> getfd_callback; |
728 | |
732 | |
729 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
|
|
730 | extern bool rxvt_set_locale (const char *locale) NOTHROW; |
|
|
731 | extern void rxvt_push_locale (const char *locale) NOTHROW; |
|
|
732 | extern void rxvt_pop_locale () NOTHROW; |
|
|
733 | |
|
|
734 | /****************************************************************************/ |
733 | /****************************************************************************/ |
735 | |
734 | |
736 | #define LINE_LONGER 0x0001 // line is continued on the next row |
735 | #define LINE_LONGER 0x0001 // line is continued on the next row |
737 | #define LINE_FILTERED 0x0002 // line has been filtered |
736 | #define LINE_FILTERED 0x0002 // line has been filtered |
738 | #define LINE_COMPRESSED 0x0004 // line has been compressed (NYI) |
737 | #define LINE_COMPRESSED 0x0004 // line has been compressed (NYI) |
… | |
… | |
793 | |
792 | |
794 | /****************************************************************************/ |
793 | /****************************************************************************/ |
795 | |
794 | |
796 | #define UNICODE_MASK 0x1fffffUL |
795 | #define UNICODE_MASK 0x1fffffUL |
797 | |
796 | |
798 | #if UNICODE3 |
797 | #if UNICODE_3 |
799 | # define COMPOSE_LO 0x40000000UL |
798 | # define COMPOSE_LO 0x40000000UL |
800 | # define COMPOSE_HI 0x400fffffUL |
799 | # define COMPOSE_HI 0x400fffffUL |
801 | # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) |
800 | # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) |
802 | #else |
801 | #else |
803 | # if ENABLE_PERL |
802 | # if ENABLE_PERL |
… | |
… | |
1044 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1043 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1045 | void rootwin_cb (XEvent &xev); |
1044 | void rootwin_cb (XEvent &xev); |
1046 | xevent_watcher rootwin_ev; |
1045 | xevent_watcher rootwin_ev; |
1047 | #endif |
1046 | #endif |
1048 | #ifdef HAVE_BG_PIXMAP |
1047 | #ifdef HAVE_BG_PIXMAP |
1049 | int update_background (); |
1048 | void update_background (); |
1050 | #if TRACE_PIXMAPS |
1049 | #if TRACE_PIXMAPS |
1051 | int trace_update_background (const char *file, int line); |
1050 | void trace_update_background (const char *file, int line); |
1052 | # define update_background() trace_update_background (__FILE__, __LINE__) |
1051 | # define update_background() trace_update_background (__FILE__, __LINE__) |
1053 | #endif |
1052 | #endif |
1054 | void update_background_cb (ev::timer &w, int revents); |
1053 | void update_background_cb (ev::timer &w, int revents); |
1055 | ev::timer update_background_ev; |
1054 | ev::timer update_background_ev; |
1056 | #endif |
1055 | #endif |
… | |
… | |
1061 | #ifdef HAVE_SCROLLBARS |
1060 | #ifdef HAVE_SCROLLBARS |
1062 | xevent_watcher scrollbar_ev; |
1061 | xevent_watcher scrollbar_ev; |
1063 | #endif |
1062 | #endif |
1064 | |
1063 | |
1065 | void child_cb (ev::child &w, int revents); ev::child child_ev; |
1064 | void child_cb (ev::child &w, int revents); ev::child child_ev; |
1066 | void prepare_cb (ev::prepare &w, int revents); ev::prepare prepare_ev; |
|
|
1067 | void destroy_cb (ev::idle &w, int revents); ev::idle destroy_ev; |
1065 | void destroy_cb (ev::idle &w, int revents); ev::idle destroy_ev; |
|
|
1066 | void refresh_check (); |
1068 | void flush (); |
1067 | void flush (); |
1069 | void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; |
1068 | void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; |
1070 | bool pty_fill (); |
1069 | bool pty_fill (); |
1071 | void pty_cb (ev::io &w, int revents); ev::io pty_ev; |
1070 | void pty_cb (ev::io &w, int revents); ev::io pty_ev; |
1072 | void incr_cb (ev::timer &w, int revents) NOTHROW; ev::timer incr_ev; |
1071 | void incr_cb (ev::timer &w, int revents) NOTHROW; ev::timer incr_ev; |