Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2002 18:23:16 +0800 (CST)
From:      Michael Hsin <mhsin@mhsin.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/45912: [PATCH] New patches for chinese/irssi
Message-ID:  <200212021023.gB2ANG0A078788@Ada.mhsin.org>

next in thread | raw e-mail | index | archive | help

>Number:         45912
>Category:       ports
>Synopsis:       [PATCH] New patches for chinese/irssi
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 02 02:30:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Michael Hsin
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
NTU CSIE
>Environment:
System: FreeBSD a.mhsin.org 4.6-STABLE FreeBSD 4.6-STABLE #2: Sun Sep 1 19:42:18 CST 2002 root@a.mhsin.org:/usr/obj/usr/src/sys/fake i386


>Description:
	We need new patches for chinese/irssi to match its master port. 
>How-To-Repeat:
	Just try to make chinese/irssi. 
>Fix:

The shar file below: 


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	files
#	files/patch-irssi.conf
#	files/patch-src::fe-text::gui-entry.c
#	files/patch-src::fe-text::gui-entry.h
#	files/patch-src::fe-text::term-terminfo.c
#	files/patch-src::fe-text::textbuffer-view.c
#	files/patch-src::fe-text::utf8.h
#
echo c - files
mkdir -p files > /dev/null 2>&1
echo x - files/patch-irssi.conf
sed 's/^X//' >files/patch-irssi.conf << 'END-of-files/patch-irssi.conf'
X--- irssi.conf.orig	Thu Sep 12 07:00:08 2002
X+++ irssi.conf	Sat Nov 23 18:28:25 2002
X@@ -1,115 +1,17 @@
X servers = (
X-  { address = "irc.stealth.net"; chatnet = "IRCnet"; port = "6668"; },
X-  { address = "irc.efnet.net"; chatnet = "EFNet"; port = "6667"; },
X-  { 
X-    address = "irc.undernet.org";
X-    chatnet = "Undernet";
X-    port = "6667";
X-  },
X-  { address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; },
X-  { address = "irc.freenode.net"; chatnet = "freenode"; port = "6667"; },
X-  { address = "irc.gnome.org"; chatnet = "GIMPNet"; port = "6667"; },
X-  { address = "irc.ptlink.net"; chatnet = "PTlink"; port = "6667"; },
X-  { 
X-    address = "irc.sorcery.net";
X-    chatnet = "SorceryNet";
X-    port = "6667";
X-  },
X-  { 
X-    address = "irc.hashmark.net";
X-    chatnet = "Hashmark";
X-    port = "6667";
X-  },
X-  { address = "irc.ptnet.org"; chatnet = "PTnet"; port = "6667"; },
X-  { address = "irc.azzurra.org"; chatnet = "AzzurraNET"; port = "6667"; },
X-  { address = "silc.pspt.fi"; chatnet = "SILC"; port = "706"; }
X+  { address = "irc.hinet.net"; chatnet = "Hinet"; port = "6667"; },
X+  { address = "irc.seed.net.tw"; chatnet = "BSDChat"; port = "6667"; },
X+  { address = "irc.csie.nctu.edu.tw"; chatnet = "BSDChat"; port = "6667"; },
X+  { address = "irc.tw.freebsd.org"; chatnet = "BSDChat"; port = "6667"; }
X );
X 
X chatnets = {
X-  IRCnet = {
X-    type = "IRC";
X-    max_kicks = "4";
X-    max_modes = "3";
X-    max_msgs = "5";
X-    max_whois = "4";
X-    max_query_chans = "5";
X-  };
X-  EFNet = {
X-    type = "IRC";
X-    max_kicks = "4";
X-    max_modes = "4";
X-    max_msgs = "3";
X-    max_whois = "1";
X-  };
X-  Undernet = {
X-    type = "IRC";
X-    max_kicks = "4";
X-    max_modes = "3";
X-    max_msgs = "3";
X-    max_whois = "30";
X-  };
X-  DALnet = {
X-    type = "IRC";
X-    max_kicks = "4";
X-    max_modes = "6";
X-    max_msgs = "3";
X-    max_whois = "30";
X-  };
X-  freenode = {
X-    type = "IRC";
X-    max_kicks = "4";
X-    max_modes = "4";
X-    max_msgs = "1";
X-    max_whois = "1";
X-  };
X-  GIMPNet = {
X-    type = "IRC";
X-    max_kicks = "4";
X-    max_modes = "4";
X-    max_msgs = "3";
X-    max_whois = "1";
X-  };
X-  PTlink = {
X-    type = "IRC";
X-    max_kicks = "1";
X-    max_modes = "6";
X-    max_msgs = "30";
X-    max_whois = "1";
X-  };
X-  SorceryNet = {
X-    type = "IRC";
X-    max_kicks = "30";
X-    max_modes = "6";
X-    max_msgs = "30";
X-    max_whois = "30";
X-  };
X-  Hashmark = {
X-    type = "IRC";
X-    max_kicks = "4";
X-    max_modes = "3";
X-    max_msgs = "3";
X-    max_whois = "30";
X-  };
X-  PTnet = {
X-    type = "IRC";
X-    max_kicks = "30";
X-    max_modes = "13";
X-    max_msgs = "10";
X-    max_whois = "30";
X-  };
X-  AzzurraNET = {
X-    type = "IRC";
X-    max_kicks = "4";
X-    max_modes = "6";
X-    max_msgs = "3";
X-  };
X-  SILC = { type = "SILC"; };
X+  Hinet = { type = "IRC"; max_kicks = "3"; max_modes = "3"; max_msgs = "3"; };
X+  BSDChat = { type = "IRC"; max_kicks = 4; max_modes = 6; max_msgs = 3; };
X };
X 
X channels = (
X-  { name = "#irssi"; chatnet = "ircnet"; autojoin = "No"; },
X-  { name = "#irssi"; chatnet = "freenode"; autojoin = "No"; },
X-  { name = "#silc"; chatnet = "silc"; autojoin = "No"; }
X+  { name = "#bsdchat"; chatnet = "BSDChat"; autojoin = "No"; }
X );
X 
X aliases = {
END-of-files/patch-irssi.conf
echo x - files/patch-src::fe-text::gui-entry.c
sed 's/^X//' >files/patch-src::fe-text::gui-entry.c << 'END-of-files/patch-src::fe-text::gui-entry.c'
X--- src/fe-text/gui-entry.c.orig	Tue Oct 15 02:45:08 2002
X+++ src/fe-text/gui-entry.c	Sat Nov 23 17:28:31 2002
X@@ -68,6 +68,27 @@
X         g_free(entry);
X }
X 
X+/* Fixes the cursor position if it at big5_lo .
X+   Direct: -1    ,  left shift 1 byte.
X+   Direct: 0, +1 ,  right shift 1 byte.
X+*/
X+static int _fix_big5_pos(unichar *p, int pos, int direct)
X+{
X+	int newpos;
X+
X+	for (newpos=0; newpos<pos && p[newpos] != 0; ) {
X+		if (is_big5(p[newpos], p[newpos+1]))
X+			newpos += 2;
X+		else
X+			newpos ++;
X+	}
X+
X+	if (newpos != pos)
X+		pos += direct > 0 ? 1 : -1;
X+
X+	return pos;
X+}
X+
X /* Fixes the cursor position in screen */
X static void gui_entry_fix_cursor(GUI_ENTRY_REC *entry)
X {
X@@ -85,6 +106,8 @@
X 		entry->scrstart = entry->pos - entry->scrpos;
X 	}
X 
X+	entry->scrstart = _fix_big5_pos(entry->text, entry->scrstart, -1);
X+
X 	if (old_scrstart != entry->scrstart)
X                 entry->redraw_needed_from = 0;
X }
X@@ -200,7 +223,7 @@
X 	}
X }
X 
X-void gui_entry_set_prompt(GUI_ENTRY_REC *entry, const char *str)
X+void gui_entry_set_prompt(GUI_ENTRY_REC *entry, const unsigned char *str)
X {
X 	int oldlen;
X 
X@@ -236,7 +259,7 @@
X         entry->utf8 = utf8;
X }
X 
X-void gui_entry_set_text(GUI_ENTRY_REC *entry, const char *str)
X+void gui_entry_set_text(GUI_ENTRY_REC *entry, const unsigned char *str)
X {
X 	g_return_if_fail(entry != NULL);
X 	g_return_if_fail(str != NULL);
X@@ -265,7 +288,7 @@
X 	return buf;
X }
X 
X-void gui_entry_insert_text(GUI_ENTRY_REC *entry, const char *str)
X+void gui_entry_insert_text(GUI_ENTRY_REC *entry, const unsigned char *str)
X {
X         unichar chr;
X 	int i, len;
X@@ -343,11 +366,18 @@
X 
X void gui_entry_erase(GUI_ENTRY_REC *entry, int size, int update_cutbuffer)
X {
X+	int newpos;
X+
X         g_return_if_fail(entry != NULL);
X 
X 	if (entry->pos < size)
X 		return;
X 
X+	/* recount the erase size with big5 charsets */
X+	for (newpos = entry->pos; newpos >= 0 && size > 0; size--)
X+		newpos = _fix_big5_pos(entry->text, newpos-1, -1);
X+	size = entry->pos - newpos;
X+
X 	if (update_cutbuffer) {
X 		/* put erased text to cutbuffer */
X 		if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) {
X@@ -471,10 +501,24 @@
X 
X void gui_entry_move_pos(GUI_ENTRY_REC *entry, int pos)
X {
X+	int newpos;
X+
X         g_return_if_fail(entry != NULL);
X 
X-	if (entry->pos+pos >= 0 && entry->pos+pos <= entry->text_len)
X-		entry->pos += pos;
X+	/* move cursor with big5 charset */
X+	newpos = _fix_big5_pos(entry->text, entry->pos, -1);
X+	if (pos > 0) {
X+		while (pos > 0 && newpos < entry->text_len) {
X+			newpos = _fix_big5_pos(entry->text, newpos+1, 1);
X+			pos --;
X+		}
X+	} else {
X+		while (pos < 0 && newpos > 0) {
X+			newpos = _fix_big5_pos(entry->text, newpos-1, -1);
X+			pos ++;
X+		}
X+	}
X+	entry->pos = newpos;
X 
X 	gui_entry_fix_cursor(entry);
X 	gui_entry_draw(entry);
END-of-files/patch-src::fe-text::gui-entry.c
echo x - files/patch-src::fe-text::gui-entry.h
sed 's/^X//' >files/patch-src::fe-text::gui-entry.h << 'END-of-files/patch-src::fe-text::gui-entry.h'
X--- src/fe-text/gui-entry.h.orig	Wed Feb 20 20:46:45 2002
X+++ src/fe-text/gui-entry.h	Sat Nov 23 17:28:32 2002
X@@ -28,14 +28,14 @@
X void gui_entry_move(GUI_ENTRY_REC *entry, int xpos, int ypos, int width);
X void gui_entry_set_active(GUI_ENTRY_REC *entry);
X 
X-void gui_entry_set_prompt(GUI_ENTRY_REC *entry, const char *str);
X+void gui_entry_set_prompt(GUI_ENTRY_REC *entry, const unsigned char *str);
X void gui_entry_set_hidden(GUI_ENTRY_REC *entry, int hidden);
X void gui_entry_set_utf8(GUI_ENTRY_REC *entry, int utf8);
X 
X-void gui_entry_set_text(GUI_ENTRY_REC *entry, const char *str);
X+void gui_entry_set_text(GUI_ENTRY_REC *entry, const unsigned char *str);
X char *gui_entry_get_text(GUI_ENTRY_REC *entry);
X 
X-void gui_entry_insert_text(GUI_ENTRY_REC *entry, const char *str);
X+void gui_entry_insert_text(GUI_ENTRY_REC *entry, const unsigned char *str);
X void gui_entry_insert_char(GUI_ENTRY_REC *entry, unichar chr);
X 
X char *gui_entry_get_cutbuffer(GUI_ENTRY_REC *entry);
END-of-files/patch-src::fe-text::gui-entry.h
echo x - files/patch-src::fe-text::term-terminfo.c
sed 's/^X//' >files/patch-src::fe-text::term-terminfo.c << 'END-of-files/patch-src::fe-text::term-terminfo.c'
X--- src/fe-text/term-terminfo.c.orig	Sun May 12 22:48:11 2002
X+++ src/fe-text/term-terminfo.c	Sat Nov 23 17:28:36 2002
X@@ -564,12 +564,6 @@
X 	}
X }
X 
X-/* XXX I didn't check the encoding range of big5+. This is standard big5. */
X-#define is_big5_los(lo) (0x40 <= (lo) && (lo) <= 0x7E) /* standard */
X-#define is_big5_lox(lo) (0x80 <= (lo) && (lo) <= 0xFE) /* extended */
X-#define is_big5_hi(hi)  (0x81 <= (hi) && (hi) <= 0xFE)
X-#define is_big5(hi,lo) (is_big5_hi(hi) && (is_big5_los(lo) || is_big5_lox(lo)))
X-
X static int input_big5(const unsigned char *buffer, int size, unichar *result)
X {
X 	if (is_big5_hi(*buffer)) {
END-of-files/patch-src::fe-text::term-terminfo.c
echo x - files/patch-src::fe-text::textbuffer-view.c
sed 's/^X//' >files/patch-src::fe-text::textbuffer-view.c << 'END-of-files/patch-src::fe-text::textbuffer-view.c'
X--- src/fe-text/textbuffer-view.c.orig	Tue Oct 15 02:45:08 2002
X+++ src/fe-text/textbuffer-view.c	Sat Nov 23 18:04:04 2002
X@@ -199,8 +199,14 @@
X 		}
X 
X 		if (!view->utf8) {
X-			next_ptr = ptr+1;
X+			/* MH */
X 			char_len = 1;
X+			if(ptr[1] != '\0' && is_big5(ptr[0], ptr[1]))
X+			{
X+			  char_len = 2;
X+			}
X+			next_ptr = ptr+char_len;
X+			/*    */
X 		} else {
X 			char_len = 1;
X 			while (ptr[char_len] != '\0' && char_len < 6)
X@@ -251,7 +257,15 @@
X 			continue;
X 		}
X 
X-		if (*ptr == ' ') {
X+		/* MH */
X+		if (!view->utf8 && char_len > 1)
X+		{
X+			last_space = xpos;
X+			last_space_ptr = next_ptr;
X+			last_color = color;
X+		}
X+		/*    */
X+		else if (*ptr == ' ') {
X 			last_space = xpos;
X 			last_space_ptr = ptr;
X 			last_color = color;
END-of-files/patch-src::fe-text::textbuffer-view.c
echo x - files/patch-src::fe-text::utf8.h
sed 's/^X//' >files/patch-src::fe-text::utf8.h << 'END-of-files/patch-src::fe-text::utf8.h'
X--- src/fe-text/utf8.h.orig	Tue Oct 15 02:45:08 2002
X+++ src/fe-text/utf8.h	Sat Nov 23 17:28:38 2002
X@@ -18,6 +18,13 @@
X    Make sure out is at least 6 x length of str. */
X void utf16_to_utf8(const unichar *str, char *out);
X 
X+/* XXX I didn't check the encoding range of big5+. This is standard big5. */
X+#define is_big5_los(lo) (0x40 <= (lo) && (lo) <= 0x7E) /* standard */
X+#define is_big5_lox(lo) (0x80 <= (lo) && (lo) <= 0xFE) /* extended */
X+#define is_big5_lo(lo)	((is_big5_los(lo) || is_big5_lox(lo)))
X+#define is_big5_hi(hi)  (0x81 <= (hi) && (hi) <= 0xFE)
X+#define is_big5(hi,lo) (is_big5_hi(hi) && is_big5_lo(lo))
X+
X /* Returns width for character (0-2). */
X int utf8_width(unichar c);
X 
END-of-files/patch-src::fe-text::utf8.h
exit


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212021023.gB2ANG0A078788>