From patchwork Tue Feb 23 09:21:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 11003 Received: (qmail 123085 invoked by alias); 23 Feb 2016 09:21:51 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 123025 invoked by uid 89); 23 Feb 2016 09:21:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=accelerated, S390, Emit, AWK X-HELO: e06smtp15.uk.ibm.com X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: stli@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org From: Stefan Liebler To: libc-alpha@sourceware.org Cc: Stefan Liebler Subject: [PATCH 02/14] S390: Mention s390-specific gconv-modues before common ones. Date: Tue, 23 Feb 2016 10:21:06 +0100 Message-Id: <1456219278-5258-3-git-send-email-stli@linux.vnet.ibm.com> In-Reply-To: <1456219278-5258-1-git-send-email-stli@linux.vnet.ibm.com> References: <1456219278-5258-1-git-send-email-stli@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16022309-0021-0000-0000-000020430E2A This patch changes the order in gconv-modules. Now the s390-specific modules are mentioned before the common ones, because these modules aren't used in all possible conversions. E.g. the converting-step from INTERNAL to UTF-16 used the common UTF-16.so module instead of UTF16_UTF32_Z9.so. The awk script is parsing the source gconv-modules file and copies it line by line. The s390 modules are emitted between the header-comments and the first common-code-module. ChangeLog: * sysdeps/s390/s390-64/Makefile ($(objpfx)gconv-modules-s390): Mention s390-specific gconv-modules before common ones. --- sysdeps/s390/s390-64/Makefile | 82 ++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/sysdeps/s390/s390-64/Makefile b/sysdeps/s390/s390-64/Makefile index de249a7..d1ee59d 100644 --- a/sysdeps/s390/s390-64/Makefile +++ b/sysdeps/s390/s390-64/Makefile @@ -40,39 +40,55 @@ $(inst_gconvdir)/%.so: $(objpfx)%.so $(+force) $(do-install-program) $(objpfx)gconv-modules-s390: gconv-modules - cp $< $@ - echo >> $@ - echo "# S/390 hardware accelerated modules" >> $@ - echo -n "module ISO-8859-1// IBM037// " >> $@ - echo " ISO-8859-1_CP037_Z900 1" >> $@ - echo -n "module IBM037// ISO-8859-1// " >> $@ - echo " ISO-8859-1_CP037_Z900 1" >> $@ - echo -n "module ISO-10646/UTF8/ UTF-32// " >> $@ - echo " UTF8_UTF32_Z9 1" >> $@ - echo -n "module UTF-32BE// ISO-10646/UTF8/ " >> $@ - echo " UTF8_UTF32_Z9 1" >> $@ - echo -n "module ISO-10646/UTF8/ UTF-32BE// " >> $@ - echo " UTF8_UTF32_Z9 1" >> $@ - echo -n "module UTF-16BE// UTF-32// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-32BE// UTF-16// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module INTERNAL UTF-16// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-32BE// UTF-16BE// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module INTERNAL UTF-16BE// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-16BE// UTF-32BE// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-16BE// INTERNAL " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-16BE// ISO-10646/UTF8/ " >> $@ - echo " UTF8_UTF16_Z9 1" >> $@ - echo -n "module ISO-10646/UTF8/ UTF-16// " >> $@ - echo " UTF8_UTF16_Z9 1" >> $@ - echo -n "module ISO-10646/UTF8/ UTF-16BE// " >> $@ - echo " UTF8_UTF16_Z9 1" >> $@ + ${AWK} 'BEGIN { emitted = 0 } \ + emitted || NF == 0 || $$1 ~ /^#/ { print; next; } \ + !emitted { emit_s390_modules(); emitted = 1; print; } \ + function emit_s390_modules() { \ + # Emit header line. \ + print "# S/390 hardware accelerated modules"; \ + print_val("#", 8); \ + print_val("from", 24); \ + print_val("to", 24); \ + print_val("module", 24); \ + printf "cost\n"; \ + # Emit s390-specific modules. \ + modul("ISO-8859-1//", "IBM037//", "ISO-8859-1_CP037_Z900"); \ + modul("IBM037//", "ISO-8859-1//", "ISO-8859-1_CP037_Z900"); \ + modul("ISO-10646/UTF8/", "UTF-32//", "UTF8_UTF32_Z9"); \ + modul("UTF-32BE//", "ISO-10646/UTF8/", "UTF8_UTF32_Z9"); \ + modul("ISO-10646/UTF8/", "UTF-32BE//", "UTF8_UTF32_Z9"); \ + modul("UTF-16BE//", "UTF-32//", "UTF16_UTF32_Z9"); \ + modul("UTF-32BE//", "UTF-16//", "UTF16_UTF32_Z9"); \ + modul("INTERNAL", "UTF-16//", "UTF16_UTF32_Z9"); \ + modul("UTF-32BE//", "UTF-16BE//", "UTF16_UTF32_Z9"); \ + modul("INTERNAL", "UTF-16BE//", "UTF16_UTF32_Z9"); \ + modul("UTF-16BE//", "UTF-32BE//", "UTF16_UTF32_Z9"); \ + modul("UTF-16BE//", "INTERNAL", "UTF16_UTF32_Z9"); \ + modul("UTF-16BE//", "ISO-10646/UTF8/", "UTF8_UTF16_Z9"); \ + modul("ISO-10646/UTF8/", "UTF-16//", "UTF8_UTF16_Z9"); \ + modul("ISO-10646/UTF8/", "UTF-16BE//", "UTF8_UTF16_Z9"); \ + printf "\n# Default glibc modules\n"; \ + } \ + function modul(from, to, file, cost) { \ + print_val("module", 8); \ + print_val(from, 24); \ + print_val(to, 24); \ + print_val(file, 24); \ + if (cost == 0) cost = 1; \ + printf "%d\n", cost; \ + } \ + function print_val(val, width) { \ + # Emit value followed by tabs. \ + printf "%s", val; \ + len = length(val); \ + if (len < width) { \ + len = width - len; \ + nr_tabs = len / 8; \ + if (len % 8 != 0) nr_tabs++; \ + } \ + else nr_tabs = 1; \ + for (i = 1; i <= nr_tabs; i++) printf "\t"; \ + }' < $< > $@ GCONV_MODULES = gconv-modules-s390