From e720a48ee9ca1e53bf7333b801bf7b6cbc6148b7 Mon Sep 17 00:00:00 2001 From: Xavier G Date: Sat, 23 Apr 2016 00:51:55 +0200 Subject: [PATCH] Move wcwidth.c and utf8.{h,c} to core. This move makes sense since these files contain rather fundamental functions (fundamental here means that we shouldn't have had to implement them) which are required by other functions located in core/special-vars.c. --- src/core/Makefile.am | 2 ++ src/{fe-common => }/core/utf8.c | 0 src/{fe-common => }/core/utf8.h | 4 +++- src/{fe-common => }/core/wcwidth.c | 1 + src/fe-common/core/Makefile.am | 5 ----- src/fe-common/core/module.h | 2 +- src/fe-text/term.h | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename src/{fe-common => }/core/utf8.c (100%) rename src/{fe-common => }/core/utf8.h (91%) rename src/{fe-common => }/core/wcwidth.c (99%) diff --git a/src/core/Makefile.am b/src/core/Makefile.am index fc32e17e..2918c6ef 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -44,6 +44,8 @@ libcore_a_SOURCES = \ settings.c \ signals.c \ special-vars.c \ + utf8.c \ + wcwidth.c \ write-buffer.c structure_headers = \ diff --git a/src/fe-common/core/utf8.c b/src/core/utf8.c similarity index 100% rename from src/fe-common/core/utf8.c rename to src/core/utf8.c diff --git a/src/fe-common/core/utf8.h b/src/core/utf8.h similarity index 91% rename from src/fe-common/core/utf8.h rename to src/core/utf8.h index 972a8848..6462f579 100644 --- a/src/fe-common/core/utf8.h +++ b/src/core/utf8.h @@ -8,12 +8,14 @@ #define is_big5_hi(hi) (0x81 <= (hi) && (hi) <= 0xFE) #define is_big5(hi,lo) (is_big5_hi(hi) && is_big5_lo(lo)) +typedef guint32 unichar; + /* Returns width for character (0-2). */ int mk_wcwidth(unichar c); /* Return the number of columns occupied by a given string. */ int get_utf8_char_width(const gchar *); -int get_utf8_string_width(const gchar *); +int get_utf8_string_width(const gchar *, int); int get_utf8_chars_for_width(const gchar *, unsigned int, int, unsigned int *); #define unichar_isprint(c) (((c) & ~0x80) >= 32) diff --git a/src/fe-common/core/wcwidth.c b/src/core/wcwidth.c similarity index 99% rename from src/fe-common/core/wcwidth.c rename to src/core/wcwidth.c index 80d20fa1..4988ba93 100644 --- a/src/fe-common/core/wcwidth.c +++ b/src/core/wcwidth.c @@ -60,6 +60,7 @@ */ #include "module.h" +#include "utf8.h" struct interval { int first; diff --git a/src/fe-common/core/Makefile.am b/src/fe-common/core/Makefile.am index e755b510..63f91fa6 100644 --- a/src/fe-common/core/Makefile.am +++ b/src/fe-common/core/Makefile.am @@ -24,8 +24,6 @@ libfe_common_core_a_SOURCES = \ fe-queries.c \ fe-server.c \ fe-settings.c \ - utf8.c \ - wcwidth.c \ formats.c \ hilight-text.c \ keyboard.c \ @@ -62,6 +60,3 @@ pkginc_fe_common_core_HEADERS = \ window-items.h \ windows-layout.h \ fe-windows.h - -noinst_HEADERS = \ - utf8.h diff --git a/src/fe-common/core/module.h b/src/fe-common/core/module.h index 51b61b3e..db712ec7 100644 --- a/src/fe-common/core/module.h +++ b/src/fe-common/core/module.h @@ -2,7 +2,7 @@ #define MODULE_NAME "fe-common/core" -typedef guint32 unichar; +#include "utf8.h" typedef struct { time_t time; char *nick; diff --git a/src/fe-text/term.h b/src/fe-text/term.h index 9b726d82..0c7847f6 100644 --- a/src/fe-text/term.h +++ b/src/fe-text/term.h @@ -27,7 +27,7 @@ typedef struct _TERM_WINDOW TERM_WINDOW; #define TERM_TYPE_UTF8 1 #define TERM_TYPE_BIG5 2 -typedef guint32 unichar; +#include "utf8.h" extern TERM_WINDOW *root_window; extern int term_width, term_height;