From 52abbb3afa3775d6f5c82b199c74ad81afc0d2b8 Mon Sep 17 00:00:00 2001 From: "Andrew O. Shadoura" Date: Tue, 31 May 2011 16:35:27 +0300 Subject: sync 9libs with plan9port --- debian/changelog | 1 + debian/patches/11-sync-libs-with-plan9port.patch | 137 +++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 139 insertions(+) create mode 100644 debian/patches/11-sync-libs-with-plan9port.patch diff --git a/debian/changelog b/debian/changelog index 753cb5b..5bdb820 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ wmii (3.9.2+debian-3) unstable; urgency=low * Add a manpage for wihack(1). * Fix the path in LD_PRELOAD for wihack. * Fix some markup in the manpages. + * Sync 9libs with plan9port. * Make the Unicode font default (Closes: #598630). -- Andrew O. Shadoura Mon, 30 May 2011 20:53:25 +0300 diff --git a/debian/patches/11-sync-libs-with-plan9port.patch b/debian/patches/11-sync-libs-with-plan9port.patch new file mode 100644 index 0000000..8e87eb0 --- /dev/null +++ b/debian/patches/11-sync-libs-with-plan9port.patch @@ -0,0 +1,137 @@ +Description: 9libs: Sync with plan9port. + This patch is imported from the upstream's VCS. +Author: Kris Maglione +Origin: upstream, http://hg.suckless.org/wmii/raw-rev/d1296b42f38a + +--- a/include/fmt.h ++++ b/include/fmt.h +@@ -27,10 +27,22 @@ + void *farg; /* to make flush a closure */ + int nfmt; /* num chars formatted so far */ + va_list args; /* args passed to dofmt */ +- int r; /* % format Rune */ ++ Rune r; /* % format Rune */ + int width; + int prec; + unsigned long flags; ++ char *decimal; /* decimal point; cannot be "" */ ++ ++ /* For %'d */ ++ char *thousands; /* separator for thousands */ ++ ++ /* ++ * Each char is an integer indicating #digits before next separator. Values: ++ * \xFF: no more grouping (or \x7F; defined to be CHAR_MAX in POSIX) ++ * \x00: repeat previous indefinitely ++ * \x**: count that many ++ */ ++ char *grouping; /* descriptor of separator placement */ + }; + + enum{ +@@ -40,7 +52,8 @@ + FmtSharp = FmtPrec << 1, + FmtSpace = FmtSharp << 1, + FmtSign = FmtSpace << 1, +- FmtZero = FmtSign << 1, ++ FmtApost = FmtSign << 1, ++ FmtZero = FmtApost << 1, + FmtUnsigned = FmtZero << 1, + FmtShort = FmtUnsigned << 1, + FmtLong = FmtShort << 1, +@@ -121,6 +134,7 @@ + int fmtfdflush(Fmt*); + int fmtfdinit(Fmt*, int fd, char *buf, int size); + int fmtinstall(int, int (*f)(Fmt*)); ++void fmtlocaleinit(Fmt*, char *decimal, char *thousands, char *grouping); + int fmtprint(Fmt*, const char*, ...); + int fmtrune(Fmt*, int); + int fmtrunestrcpy(Fmt*, Rune*); +--- a/include/utf.h ++++ b/include/utf.h +@@ -1,14 +1,15 @@ + #ifndef _UTF_H_ + #define _UTF_H_ 1 + +-typedef unsigned short Rune; /* 16 bits */ ++typedef unsigned int Rune; /* 32 bits */ + + enum + { +- UTFmax = 3, /* maximum bytes per rune */ ++ UTFmax = 4, /* maximum bytes per rune */ + Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */ + Runeself = 0x80, /* rune and UTF sequences are the same (<) */ +- Runeerror = 0xFFFD, /* decoding error in UTF */ ++ Runeerror = 0xFFFD, /* decoding error in UTF */ ++ Runemax = 0x10FFFF /* maximum rune value */ + }; + + /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */ +@@ -19,7 +20,7 @@ + int isspacerune(Rune); + int istitlerune(Rune); + int isupperrune(Rune); +-int runelen(Rune); ++int runelen(long); + int runenlen(const Rune*, int); + Rune* runestrcat(Rune*, const Rune*); + Rune* runestrchr(const Rune*, Rune); +--- /dev/null ++++ b/lib/libfmt/fmtlocale.c +@@ -0,0 +1,55 @@ ++/* Copyright (c) 2004 Google Inc.; see LICENSE */ ++ ++#include ++#include ++#include "plan9.h" ++#include "fmt.h" ++#include "fmtdef.h" ++ ++/* ++ * Fill in the internationalization stuff in the State structure. ++ * For nil arguments, provide the sensible defaults: ++ * decimal is a period ++ * thousands separator is a comma ++ * thousands are marked every three digits ++ */ ++void ++fmtlocaleinit(Fmt *f, char *decimal, char *thousands, char *grouping) ++{ ++ if(decimal == nil || decimal[0] == '\0') ++ decimal = "."; ++ if(thousands == nil) ++ thousands = ","; ++ if(grouping == nil) ++ grouping = "\3"; ++ f->decimal = decimal; ++ f->thousands = thousands; ++ f->grouping = grouping; ++} ++ ++/* ++ * We are about to emit a digit in e.g. %'d. If that digit would ++ * overflow a thousands (e.g.) grouping, tell the caller to emit ++ * the thousands separator. Always advance the digit counter ++ * and pointer into the grouping descriptor. ++ */ ++int ++__needsep(int *ndig, char **grouping) ++{ ++ int group; ++ ++ (*ndig)++; ++ group = *(unsigned char*)*grouping; ++ /* CHAR_MAX means no further grouping. \0 means we got the empty string */ ++ if(group == 0xFF || group == 0x7f || group == 0x00) ++ return 0; ++ if(*ndig > group){ ++ /* if we're at end of string, continue with this grouping; else advance */ ++ if((*grouping)[1] != '\0') ++ (*grouping)++; ++ *ndig = 1; ++ return 1; ++ } ++ return 0; ++} ++ diff --git a/debian/patches/series b/debian/patches/series index e2fda2f..0eec666 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,3 +8,4 @@ 08-manpages-markup.patch 09-wihack-ld-preload.patch 10-wihack-manpage.patch +11-sync-libs-with-plan9port.patch -- cgit v1.2.3