diff options
Diffstat (limited to 'util')
77 files changed, 746 insertions, 189 deletions
diff --git a/util/fixnonlatin1/main.cpp b/util/fixnonlatin1/main.cpp index c7ea3aa..8d5eaa7 100644 --- a/util/fixnonlatin1/main.cpp +++ b/util/fixnonlatin1/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/gencmap/gencmap.cpp b/util/gencmap/gencmap.cpp index 2682674..4d01329 100644 --- a/util/gencmap/gencmap.cpp +++ b/util/gencmap/gencmap.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/configfile.cpp b/util/lexgen/configfile.cpp index 7056df5..dab2f61 100644 --- a/util/lexgen/configfile.cpp +++ b/util/lexgen/configfile.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/configfile.h b/util/lexgen/configfile.h index 246b070..b8d483b 100644 --- a/util/lexgen/configfile.h +++ b/util/lexgen/configfile.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/generator.cpp b/util/lexgen/generator.cpp index 59b46d0..7998861 100644 --- a/util/lexgen/generator.cpp +++ b/util/lexgen/generator.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/generator.h b/util/lexgen/generator.h index 9068020..b9df8d7 100644 --- a/util/lexgen/generator.h +++ b/util/lexgen/generator.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/global.h b/util/lexgen/global.h index 64bede5..49f993e 100644 --- a/util/lexgen/global.h +++ b/util/lexgen/global.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/main.cpp b/util/lexgen/main.cpp index 4d18542..1cb5d90 100644 --- a/util/lexgen/main.cpp +++ b/util/lexgen/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/nfa.cpp b/util/lexgen/nfa.cpp index 82ae9c7..4adde3a 100644 --- a/util/lexgen/nfa.cpp +++ b/util/lexgen/nfa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/nfa.h b/util/lexgen/nfa.h index 7a50ce8..02657b3 100644 --- a/util/lexgen/nfa.h +++ b/util/lexgen/nfa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/re2nfa.cpp b/util/lexgen/re2nfa.cpp index 18b4e16..77cf501 100644 --- a/util/lexgen/re2nfa.cpp +++ b/util/lexgen/re2nfa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/re2nfa.h b/util/lexgen/re2nfa.h index f8ee69f..57b8bde 100644 --- a/util/lexgen/re2nfa.h +++ b/util/lexgen/re2nfa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/tests/tst_lexgen.cpp b/util/lexgen/tests/tst_lexgen.cpp index bb6b900..c80de64 100644 --- a/util/lexgen/tests/tst_lexgen.cpp +++ b/util/lexgen/tests/tst_lexgen.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/lexgen/tokenizer.cpp b/util/lexgen/tokenizer.cpp index f0ef4ff..39fc7ca 100644 --- a/util/lexgen/tokenizer.cpp +++ b/util/lexgen/tokenizer.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/local_database/cldr2qlocalexml.py b/util/local_database/cldr2qlocalexml.py index 1d9ccda..b873565 100755 --- a/util/local_database/cldr2qlocalexml.py +++ b/util/local_database/cldr2qlocalexml.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## @@ -50,6 +50,37 @@ import re findEntry = xpathlite.findEntry findEntryInFile = xpathlite._findEntryInFile +findTagsInFile = xpathlite.findTagsInFile + +def parse_number_format(patterns, data): + # this is a very limited parsing of the number format for currency only. + def skip_repeating_pattern(x): + p = x.replace('0', '#').replace(',', '').replace('.', '') + seen = False + result = '' + for c in p: + if c == '#': + if seen: + continue + seen = True + else: + seen = False + result = result + c + return result + patterns = patterns.split(';') + result = [] + for pattern in patterns: + pattern = skip_repeating_pattern(pattern) + pattern = pattern.replace('#', "%1") + # according to http://www.unicode.org/reports/tr35/#Number_Format_Patterns + # there can be doubled or trippled currency sign, however none of the + # locales use that. + pattern = pattern.replace(u'\xa4', "%2") + pattern = pattern.replace("''", "###").replace("'", '').replace("###", "'") + pattern = pattern.replace('-', data['minus']) + pattern = pattern.replace('+', data['plus']) + result.append(pattern) + return result def ordStr(c): if len(c) == 1: @@ -123,11 +154,36 @@ def generateLocaleInfo(path): result['language_id'] = language_id result['country_id'] = country_id + supplementalPath = dir_name + "/../supplemental/supplementalData.xml" + currencies = findTagsInFile(supplementalPath, "currencyData/region[iso3166=%s]"%country_code); + result['currencyIsoCode'] = '' + result['currencyDigits'] = 2 + result['currencyRounding'] = 1 + if currencies: + for e in currencies: + if e[0] == 'currency': + tender = True + t = filter(lambda x: x[0] == 'tender', e[1]) + if t and t[0][1] == 'false': + tender = False; + if tender and not filter(lambda x: x[0] == 'to', e[1]): + result['currencyIsoCode'] = filter(lambda x: x[0] == 'iso4217', e[1])[0][1] + break + if result['currencyIsoCode']: + t = findTagsInFile(supplementalPath, "currencyData/fractions/info[iso4217=%s]"%result['currencyIsoCode']); + if t and t[0][0] == 'info': + result['currencyDigits'] = int(filter(lambda x: x[0] == 'digits', t[0][1])[0][1]) + result['currencyRounding'] = int(filter(lambda x: x[0] == 'rounding', t[0][1])[0][1]) numbering_system = None try: numbering_system = findEntry(path, "numbers/defaultNumberingSystem") except: pass + def findEntryDef(path, xpath, value=''): + try: + return findEntry(path, xpath) + except xpathlite.Error: + return value def get_number_in_system(path, xpath, numbering_system): if numbering_system: try: @@ -150,6 +206,27 @@ def generateLocaleInfo(path): result['longTimeFormat'] = convert_date(findEntry(path, "dates/calendars/calendar[gregorian]/timeFormats/timeFormatLength[full]/timeFormat/pattern")) result['shortTimeFormat'] = convert_date(findEntry(path, "dates/calendars/calendar[gregorian]/timeFormats/timeFormatLength[short]/timeFormat/pattern")) + currency_format = get_number_in_system(path, "numbers/currencyFormats/currencyFormatLength/currencyFormat/pattern", numbering_system) + currency_format = parse_number_format(currency_format, result) + result['currencyFormat'] = currency_format[0] + result['currencyNegativeFormat'] = '' + if len(currency_format) > 1: + result['currencyNegativeFormat'] = currency_format[1] + + result['currencySymbol'] = '' + result['currencyDisplayName'] = '' + if result['currencyIsoCode']: + result['currencySymbol'] = findEntryDef(path, "numbers/currencies/currency[%s]/symbol" % result['currencyIsoCode']) + display_name_path = "numbers/currencies/currency[%s]/displayName" % result['currencyIsoCode'] + result['currencyDisplayName'] \ + = findEntryDef(path, display_name_path) + ";" \ + + findEntryDef(path, display_name_path + "[count=zero]") + ";" \ + + findEntryDef(path, display_name_path + "[count=one]") + ";" \ + + findEntryDef(path, display_name_path + "[count=two]") + ";" \ + + findEntryDef(path, display_name_path + "[count=few]") + ";" \ + + findEntryDef(path, display_name_path + "[count=many]") + ";" \ + + findEntryDef(path, display_name_path + "[count=other]") + ";" + standalone_long_month_path = "dates/calendars/calendar[gregorian]/months/monthContext[stand-alone]/monthWidth[wide]/month" result['standaloneLongMonths'] \ = findEntry(path, standalone_long_month_path + "[1]") + ";" \ @@ -300,7 +377,6 @@ def generateLocaleInfo(path): + findEntry(path, standalone_narrow_day_path + "[fri]") + ";" \ + findEntry(path, standalone_narrow_day_path + "[sat]") + ";" - return result def addEscapes(s): @@ -322,6 +398,40 @@ def usage(): print "Usage: cldr2qlocalexml.py <path-to-cldr-main>" sys.exit() +def integrateWeekData(filePath): + if not filePath.endswith(".xml"): + return {} + monFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=mon]", attribute="territories")[0].split(" ") + tueFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=tue]", attribute="territories")[0].split(" ") + wedFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=wed]", attribute="territories")[0].split(" ") + thuFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=thu]", attribute="territories")[0].split(" ") + friFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=fri]", attribute="territories")[0].split(" ") + satFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=sat]", attribute="territories")[0].split(" ") + sunFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=sun]", attribute="territories")[0].split(" ") + + firstDayByCountryCode = {} + for countryCode in monFirstDayIn: + firstDayByCountryCode[countryCode] = "mon" + for countryCode in tueFirstDayIn: + firstDayByCountryCode[countryCode] = "tue" + for countryCode in wedFirstDayIn: + firstDayByCountryCode[countryCode] = "wed" + for countryCode in thuFirstDayIn: + firstDayByCountryCode[countryCode] = "thu" + for countryCode in friFirstDayIn: + firstDayByCountryCode[countryCode] = "fri" + for countryCode in satFirstDayIn: + firstDayByCountryCode[countryCode] = "sat" + for countryCode in sunFirstDayIn: + firstDayByCountryCode[countryCode] = "sun" + + for (key,locale) in locale_database.iteritems(): + countryCode = locale['country_code'] + if countryCode in firstDayByCountryCode: + locale_database[key]['firstDayOfWeek'] = firstDayByCountryCode[countryCode] + else: + locale_database[key]['firstDayOfWeek'] = firstDayByCountryCode["001"] + if len(sys.argv) != 2: usage() @@ -341,10 +451,18 @@ for file in cldr_files: locale_database[(l['language_id'], l['country_id'], l['script_code'], l['variant_code'])] = l +integrateWeekData(cldr_dir+"/../supplemental/supplementalData.xml") locale_keys = locale_database.keys() locale_keys.sort() +cldr_version = 'unknown' +ldml = open(cldr_dir+"/../dtd/ldml.dtd", "r") +for line in ldml: + if 'version cldrVersion CDATA #FIXED' in line: + cldr_version = line.split('"')[1] + print "<localeDatabase>" +print " <version>" + cldr_version + "</version>" print " <languageList>" for id in enumdata.language_list: l = enumdata.language_list[id] @@ -484,6 +602,7 @@ print \ <exp>101</exp>\n\ <am>AM</am>\n\ <pm>PM</pm>\n\ + <firstDayOfWeek>mon</firstDayOfWeek>\n\ <longDateFormat>EEEE, d MMMM yyyy</longDateFormat>\n\ <shortDateFormat>d MMM yyyy</shortDateFormat>\n\ <longTimeFormat>HH:mm:ss z</longTimeFormat>\n\ @@ -500,6 +619,13 @@ print \ <standaloneLongDays>Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;</standaloneLongDays>\n\ <standaloneShortDays>Sun;Mon;Tue;Wed;Thu;Fri;Sat;</standaloneShortDays>\n\ <standaloneNarrowDays>S;M;T;W;T;F;S;</standaloneNarrowDays>\n\ + <currencyIsoCode></currencyIsoCode>\n\ + <currencySymbol></currencySymbol>\n\ + <currencyDisplayName>;;;;;;;</currencyDisplayName>\n\ + <currencyDigits>2</currencyDigits>\n\ + <currencyRounding>1</currencyRounding>\n\ + <currencyFormat>%1%2</currencyFormat>\n\ + <currencyNegativeFormat></currencyNegativeFormat>\n\ </locale>" for key in locale_keys: @@ -520,6 +646,7 @@ for key in locale_keys: print " <exp>" + fixOrdStrExp(l['exp']) + "</exp>" print " <am>" + l['am'].encode('utf-8') + "</am>" print " <pm>" + l['pm'].encode('utf-8') + "</pm>" + print " <firstDayOfWeek>" + l['firstDayOfWeek'].encode('utf-8') + "</firstDayOfWeek>" print " <longDateFormat>" + l['longDateFormat'].encode('utf-8') + "</longDateFormat>" print " <shortDateFormat>" + l['shortDateFormat'].encode('utf-8') + "</shortDateFormat>" print " <longTimeFormat>" + l['longTimeFormat'].encode('utf-8') + "</longTimeFormat>" @@ -536,6 +663,13 @@ for key in locale_keys: print " <standaloneLongDays>" + l['standaloneLongDays'].encode('utf-8') + "</standaloneLongDays>" print " <standaloneShortDays>" + l['standaloneShortDays'].encode('utf-8') + "</standaloneShortDays>" print " <standaloneNarrowDays>" + l['standaloneNarrowDays'].encode('utf-8') + "</standaloneNarrowDays>" + print " <currencyIsoCode>" + l['currencyIsoCode'].encode('utf-8') + "</currencyIsoCode>" + print " <currencySymbol>" + l['currencySymbol'].encode('utf-8') + "</currencySymbol>" + print " <currencyDisplayName>" + l['currencyDisplayName'].encode('utf-8') + "</currencyDisplayName>" + print " <currencyDigits>" + str(l['currencyDigits']) + "</currencyDigits>" + print " <currencyRounding>" + str(l['currencyRounding']) + "</currencyRounding>" + print " <currencyFormat>" + l['currencyFormat'].encode('utf-8') + "</currencyFormat>" + print " <currencyNegativeFormat>" + l['currencyNegativeFormat'].encode('utf-8') + "</currencyNegativeFormat>" print " </locale>" print " </localeList>" print "</localeDatabase>" diff --git a/util/local_database/dateconverter.py b/util/local_database/dateconverter.py index 3fe94a2..1b3db58 100755 --- a/util/local_database/dateconverter.py +++ b/util/local_database/dateconverter.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/util/local_database/enumdata.py b/util/local_database/enumdata.py index f6b145d..e957349 100644 --- a/util/local_database/enumdata.py +++ b/util/local_database/enumdata.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/util/local_database/qlocalexml2cpp.py b/util/local_database/qlocalexml2cpp.py index b6523af..2f998f3 100755 --- a/util/local_database/qlocalexml2cpp.py +++ b/util/local_database/qlocalexml2cpp.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## @@ -40,7 +40,10 @@ ## ############################################################################# +import os import sys +import tempfile +import datetime import xml.dom.minidom def check_static_char_array_length(name, array): @@ -188,6 +191,10 @@ def convertFormat(format): return result +def convertToQtDayOfWeek(firstDay): + qtDayOfWeek = {"mon":1, "tue":2, "wed":3, "thu":4, "fri":5, "sat":6, "sun":7} + return qtDayOfWeek[firstDay] + class Locale: def __init__(self, elt): self.language = eltText(firstChildElt(elt, "language")) @@ -202,6 +209,7 @@ class Locale: self.exp = int(eltText(firstChildElt(elt, "exp"))) self.am = eltText(firstChildElt(elt, "am")) self.pm = eltText(firstChildElt(elt, "pm")) + self.firstDayOfWeek = convertToQtDayOfWeek(eltText(firstChildElt(elt, "firstDayOfWeek"))) self.longDateFormat = convertFormat(eltText(firstChildElt(elt, "longDateFormat"))) self.shortDateFormat = convertFormat(eltText(firstChildElt(elt, "shortDateFormat"))) self.longTimeFormat = convertFormat(eltText(firstChildElt(elt, "longTimeFormat"))) @@ -218,6 +226,13 @@ class Locale: self.longDays = eltText(firstChildElt(elt, "longDays")) self.shortDays = eltText(firstChildElt(elt, "shortDays")) self.narrowDays = eltText(firstChildElt(elt, "narrowDays")) + self.currencyIsoCode = eltText(firstChildElt(elt, "currencyIsoCode")) + self.currencySymbol = eltText(firstChildElt(elt, "currencySymbol")) + self.currencyDisplayName = eltText(firstChildElt(elt, "currencyDisplayName")) + self.currencyDigits = int(eltText(firstChildElt(elt, "currencyDigits"))) + self.currencyRounding = int(eltText(firstChildElt(elt, "currencyRounding"))) + self.currencyFormat = eltText(firstChildElt(elt, "currencyFormat")) + self.currencyNegativeFormat = eltText(firstChildElt(elt, "currencyNegativeFormat")) def loadLocaleMap(doc, language_map, country_map): result = {} @@ -331,39 +346,67 @@ def printEscapedString(s): print escapedString(s); +def currencyIsoCodeData(s): + if s: + return ",".join(map(lambda x: str(ord(x)), s)) + return "0,0,0" + +def usage(): + print "Usage: qlocalexml2cpp.py <path-to-locale.xml> <path-to-qt-src-tree>" + sys.exit(1) + +GENERATED_BLOCK_START = "// GENERATED PART STARTS HERE\n" +GENERATED_BLOCK_END = "// GENERATED PART ENDS HERE\n" + def main(): - doc = xml.dom.minidom.parse("locale.xml") + if len(sys.argv) != 3: + usage() + + localexml = sys.argv[1] + qtsrcdir = sys.argv[2] + + if not os.path.exists(qtsrcdir) or not os.path.exists(qtsrcdir): + usage() + if not os.path.isfile(qtsrcdir + "/src/corelib/tools/qlocale_data_p.h"): + usage() + if not os.path.isfile(qtsrcdir + "/src/corelib/tools/qlocale.h"): + usage() + if not os.path.isfile(qtsrcdir + "/src/corelib/tools/qlocale.cpp"): + usage() + + (data_temp_file, data_temp_file_path) = tempfile.mkstemp("qlocale_data_p") + data_temp_file = os.fdopen(data_temp_file, "w") + qlocaledata_file = open(qtsrcdir + "/src/corelib/tools/qlocale_data_p.h", "r") + s = qlocaledata_file.readline() + while s and s != GENERATED_BLOCK_START: + data_temp_file.write(s) + s = qlocaledata_file.readline() + data_temp_file.write(GENERATED_BLOCK_START) + + doc = xml.dom.minidom.parse(localexml) language_map = loadLanguageMap(doc) country_map = loadCountryMap(doc) default_map = loadDefaultMap(doc) locale_map = loadLocaleMap(doc, language_map, country_map) dupes = findDupes(language_map, country_map) - # Language enum - print "enum Language {" - language = "" - for key in language_map.keys(): - language = fixedLanguageName(language_map[key][0], dupes) - print " " + language + " = " + str(key) + "," - print " LastLanguage = " + language - print "};" - - print - - # Country enum - print "enum Country {" - country = "" - for key in country_map.keys(): - country = fixedCountryName(country_map[key][0], dupes) - print " " + country + " = " + str(key) + "," - print " LastCountry = " + country - print "};" + cldr_version = eltText(firstChildElt(doc.documentElement, "version")) - print + data_temp_file.write("\n\ +/*\n\ + This part of the file was generated on %s from the\n\ + Common Locale Data Repository v%s\n\ +\n\ + http://www.unicode.org/cldr/\n\ +\n\ + Do not change it, instead edit CLDR data and regenerate this file using\n\ + cldr2qlocalexml.py and qlocalexml2cpp.py.\n\ +*/\n\n\n\ +" % (str(datetime.date.today()), cldr_version) ) # Locale index - print "static const quint16 locale_index[] = {" - print " 0, // unused" + data_temp_file.write("static const quint16 locale_index[] = {\n") + data_temp_file.write(" 0, // unused\n") index = 0 for key in language_map.keys(): i = 0 @@ -371,11 +414,11 @@ def main(): if count > 0: i = index index += count - print "%6d, // %s" % (i, language_map[key][0]) - print " 0 // trailing 0" - print "};" + data_temp_file.write("%6d, // %s\n" % (i, language_map[key][0])) + data_temp_file.write(" 0 // trailing 0\n") + data_temp_file.write("};\n") - print + data_temp_file.write("\n") date_format_data = StringData() time_format_data = StringData() @@ -384,10 +427,13 @@ def main(): days_data = StringData() am_data = StringData() pm_data = StringData() + currency_symbol_data = StringData() + currency_display_name_data = StringData() + currency_format_data = StringData() # Locale data - print "static const QLocalePrivate locale_data[] = {" - print "// lang terr dec group list prcnt zero minus plus exp sDtFmt lDtFmt sTmFmt lTmFmt ssMonth slMonth sMonth lMonth sDays lDays am,len pm,len" + data_temp_file.write("static const QLocalePrivate locale_data[] = {\n") + data_temp_file.write("// lang terr dec group list prcnt zero minus plus exp sDtFmt lDtFmt sTmFmt lTmFmt ssMonth slMonth sMonth lMonth sDays lDays am,len pm,len\n") locale_keys = locale_map.keys() compareLocaleKeys.default_map = default_map @@ -397,7 +443,7 @@ def main(): for key in locale_keys: l = locale_map[key] - print " { %6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s }, // %s/%s" \ + data_temp_file.write(" { %6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s, {%s}, %s,%s,%s,%s,%6d,%6d,%6d }, // %s/%s\n" \ % (key[0], key[1], l.decimal, l.group, @@ -425,136 +471,251 @@ def main(): days_data.append(l.narrowDays), am_data.append(l.am), pm_data.append(l.pm), + currencyIsoCodeData(l.currencyIsoCode), + currency_symbol_data.append(l.currencySymbol), + currency_display_name_data.append(l.currencyDisplayName), + currency_format_data.append(l.currencyFormat), + currency_format_data.append(l.currencyNegativeFormat), + l.currencyDigits, + l.currencyRounding, + l.firstDayOfWeek, l.language, - l.country) - print " { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 } // trailing 0s" - print "};" + l.country)) + data_temp_file.write(" { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, {0,0,0}, 0,0, 0,0, 0,0, 0,0, 0, 0, 0 } // trailing 0s\n") + data_temp_file.write("};\n") - print + data_temp_file.write("\n") # Date format data #check_static_char_array_length("date_format", date_format_data.data) - print "static const ushort date_format_data[] = {" - print wrap_list(date_format_data.data) - print "};" + data_temp_file.write("static const ushort date_format_data[] = {\n") + data_temp_file.write(wrap_list(date_format_data.data)) + data_temp_file.write("\n};\n") - print + data_temp_file.write("\n") # Time format data #check_static_char_array_length("time_format", time_format_data.data) - print "static const ushort time_format_data[] = {" - print wrap_list(time_format_data.data) - print "};" + data_temp_file.write("static const ushort time_format_data[] = {\n") + data_temp_file.write(wrap_list(time_format_data.data)) + data_temp_file.write("\n};\n") - print + data_temp_file.write("\n") # Months data #check_static_char_array_length("months", months_data.data) - print "static const ushort months_data[] = {" - print wrap_list(months_data.data) - print "};" + data_temp_file.write("static const ushort months_data[] = {\n") + data_temp_file.write(wrap_list(months_data.data)) + data_temp_file.write("\n};\n") - print + data_temp_file.write("\n") # Standalone months data #check_static_char_array_length("standalone_months", standalone_months_data.data) - print "static const ushort standalone_months_data[] = {" - print wrap_list(standalone_months_data.data) - print "};" + data_temp_file.write("static const ushort standalone_months_data[] = {\n") + data_temp_file.write(wrap_list(standalone_months_data.data)) + data_temp_file.write("\n};\n") - print + data_temp_file.write("\n") # Days data #check_static_char_array_length("days", days_data.data) - print "static const ushort days_data[] = {" - print wrap_list(days_data.data) - print "};" + data_temp_file.write("static const ushort days_data[] = {\n") + data_temp_file.write(wrap_list(days_data.data)) + data_temp_file.write("\n};\n") - print + data_temp_file.write("\n") # AM data #check_static_char_array_length("am", am_data.data) - print "static const ushort am_data[] = {" - print wrap_list(am_data.data) - print "};" + data_temp_file.write("static const ushort am_data[] = {\n") + data_temp_file.write(wrap_list(am_data.data)) + data_temp_file.write("\n};\n") - print + data_temp_file.write("\n") # PM data #check_static_char_array_length("pm", am_data.data) - print "static const ushort pm_data[] = {" - print wrap_list(pm_data.data) - print "};" + data_temp_file.write("static const ushort pm_data[] = {\n") + data_temp_file.write(wrap_list(pm_data.data)) + data_temp_file.write("\n};\n") + + data_temp_file.write("\n") + + # Currency symbol data + #check_static_char_array_length("currency_symbol", currency_symbol_data.data) + data_temp_file.write("static const ushort currency_symbol_data[] = {\n") + data_temp_file.write(wrap_list(currency_symbol_data.data)) + data_temp_file.write("\n};\n") - print + data_temp_file.write("\n") + + # Currency display name data + #check_static_char_array_length("currency_display_name", currency_display_name_data.data) + data_temp_file.write("static const ushort currency_display_name_data[] = {\n") + data_temp_file.write(wrap_list(currency_display_name_data.data)) + data_temp_file.write("\n};\n") + + data_temp_file.write("\n") + + # Currency format data + #check_static_char_array_length("currency_format", currency_format_data.data) + data_temp_file.write("static const ushort currency_format_data[] = {\n") + data_temp_file.write(wrap_list(currency_format_data.data)) + data_temp_file.write("\n};\n") + + data_temp_file.write("\n") # Language name list - print "static const char language_name_list[] =" - print "\"Default\\0\"" + data_temp_file.write("static const char language_name_list[] =\n") + data_temp_file.write("\"Default\\0\"\n") for key in language_map.keys(): - print "\"" + language_map[key][0] + "\\0\"" - print ";" + data_temp_file.write("\"" + language_map[key][0] + "\\0\"\n") + data_temp_file.write(";\n") - print + data_temp_file.write("\n") # Language name index - print "static const quint16 language_name_index[] = {" - print " 0, // Unused" + data_temp_file.write("static const quint16 language_name_index[] = {\n") + data_temp_file.write(" 0, // Unused\n") index = 8 for key in language_map.keys(): language = language_map[key][0] - print "%6d, // %s" % (index, language) + data_temp_file.write("%6d, // %s\n" % (index, language)) index += len(language) + 1 - print "};" + data_temp_file.write("};\n") - print + data_temp_file.write("\n") # Country name list - print "static const char country_name_list[] =" - print "\"Default\\0\"" + data_temp_file.write("static const char country_name_list[] =\n") + data_temp_file.write("\"Default\\0\"\n") for key in country_map.keys(): if key == 0: continue - print "\"" + country_map[key][0] + "\\0\"" - print ";" + data_temp_file.write("\"" + country_map[key][0] + "\\0\"\n") + data_temp_file.write(";\n") - print + data_temp_file.write("\n") # Country name index - print "static const quint16 country_name_index[] = {" - print " 0, // AnyCountry" + data_temp_file.write("static const quint16 country_name_index[] = {\n") + data_temp_file.write(" 0, // AnyCountry\n") index = 8 for key in country_map.keys(): if key == 0: continue country = country_map[key][0] - print "%6d, // %s" % (index, country) + data_temp_file.write("%6d, // %s\n" % (index, country)) index += len(country) + 1 - print "};" + data_temp_file.write("};\n") - print + data_temp_file.write("\n") # Language code list - print "static const unsigned char language_code_list[] =" - print "\" \\0\" // Unused" + data_temp_file.write("static const unsigned char language_code_list[] =\n") + data_temp_file.write("\" \\0\" // Unused\n") for key in language_map.keys(): code = language_map[key][1] if len(code) == 2: code += r"\0" - print "\"%2s\" // %s" % (code, language_map[key][0]) - print ";" + data_temp_file.write("\"%2s\" // %s\n" % (code, language_map[key][0])) + data_temp_file.write(";\n") - print + data_temp_file.write("\n") # Country code list - print "static const unsigned char country_code_list[] =" + data_temp_file.write("static const unsigned char country_code_list[] =\n") for key in country_map.keys(): code = country_map[key][1] if len(code) == 2: code += "\\0" - print "\"%2s\" // %s" % (code, country_map[key][0]) - print ";" + data_temp_file.write("\"%2s\" // %s\n" % (code, country_map[key][0])) + data_temp_file.write(";\n") + + data_temp_file.write("\n") + data_temp_file.write(GENERATED_BLOCK_END) + s = qlocaledata_file.readline() + # skip until end of the block + while s and s != GENERATED_BLOCK_END: + s = qlocaledata_file.readline() + + s = qlocaledata_file.readline() + while s: + data_temp_file.write(s) + s = qlocaledata_file.readline() + data_temp_file.close() + qlocaledata_file.close() + + os.rename(data_temp_file_path, qtsrcdir + "/src/corelib/tools/qlocale_data_p.h") + + # qlocale.h + + (qlocaleh_temp_file, qlocaleh_temp_file_path) = tempfile.mkstemp("qlocale.h") + qlocaleh_temp_file = os.fdopen(qlocaleh_temp_file, "w") + qlocaleh_file = open(qtsrcdir + "/src/corelib/tools/qlocale.h", "r") + s = qlocaleh_file.readline() + while s and s != GENERATED_BLOCK_START: + qlocaleh_temp_file.write(s) + s = qlocaleh_file.readline() + qlocaleh_temp_file.write(GENERATED_BLOCK_START) + qlocaleh_temp_file.write("// see qlocale_data_p.h for more info on generated data\n") + + # Language enum + qlocaleh_temp_file.write(" enum Language {\n") + language = "" + for key in language_map.keys(): + language = fixedLanguageName(language_map[key][0], dupes) + qlocaleh_temp_file.write(" " + language + " = " + str(key) + ",\n") + # special cases for norwegian. we really need to make it right at some point. + qlocaleh_temp_file.write(" NorwegianBokmal = Norwegian,\n") + qlocaleh_temp_file.write(" NorwegianNynorsk = Nynorsk,\n") + qlocaleh_temp_file.write(" LastLanguage = " + language + "\n") + qlocaleh_temp_file.write(" };\n") + + qlocaleh_temp_file.write("\n") + + # Country enum + qlocaleh_temp_file.write(" enum Country {\n") + country = "" + for key in country_map.keys(): + country = fixedCountryName(country_map[key][0], dupes) + qlocaleh_temp_file.write(" " + country + " = " + str(key) + ",\n") + qlocaleh_temp_file.write(" LastCountry = " + country + "\n") + qlocaleh_temp_file.write(" };\n") + + qlocaleh_temp_file.write(GENERATED_BLOCK_END) + s = qlocaleh_file.readline() + # skip until end of the block + while s and s != GENERATED_BLOCK_END: + s = qlocaleh_file.readline() + + s = qlocaleh_file.readline() + while s: + qlocaleh_temp_file.write(s) + s = qlocaleh_file.readline() + qlocaleh_temp_file.close() + qlocaleh_file.close() + + os.rename(qlocaleh_temp_file_path, qtsrcdir + "/src/corelib/tools/qlocale.h") + + # qlocale.cpp + + (qlocalecpp_temp_file, qlocalecpp_temp_file_path) = tempfile.mkstemp("qlocale.cpp") + qlocalecpp_temp_file = os.fdopen(qlocalecpp_temp_file, "w") + qlocalecpp_file = open(qtsrcdir + "/src/corelib/tools/qlocale.cpp", "r") + s = qlocalecpp_file.readline() + DOCSTRING=" QLocale's data is based on Common Locale Data Repository " + while s: + if DOCSTRING in s: + qlocalecpp_temp_file.write(DOCSTRING + "v" + cldr_version + ".\n") + else: + qlocalecpp_temp_file.write(s) + s = qlocalecpp_file.readline() + qlocalecpp_temp_file.close() + qlocalecpp_file.close() + os.rename(qlocalecpp_temp_file_path, qtsrcdir + "/src/corelib/tools/qlocale.cpp") if __name__ == "__main__": main() diff --git a/util/local_database/testlocales/localemodel.cpp b/util/local_database/testlocales/localemodel.cpp index caf6600..c1916fc 100644 --- a/util/local_database/testlocales/localemodel.cpp +++ b/util/local_database/testlocales/localemodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/local_database/testlocales/localemodel.h b/util/local_database/testlocales/localemodel.h index 0ab159e..9e569f7 100644 --- a/util/local_database/testlocales/localemodel.h +++ b/util/local_database/testlocales/localemodel.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/local_database/testlocales/localewidget.cpp b/util/local_database/testlocales/localewidget.cpp index 9fa6b83..d20868f 100644 --- a/util/local_database/testlocales/localewidget.cpp +++ b/util/local_database/testlocales/localewidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/local_database/testlocales/localewidget.h b/util/local_database/testlocales/localewidget.h index 1ac8e0b..b119db0 100644 --- a/util/local_database/testlocales/localewidget.h +++ b/util/local_database/testlocales/localewidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/local_database/testlocales/main.cpp b/util/local_database/testlocales/main.cpp index 1585ed4..08aacd5 100644 --- a/util/local_database/testlocales/main.cpp +++ b/util/local_database/testlocales/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/local_database/xpathlite.py b/util/local_database/xpathlite.py index 7d569f3..502d85d 100644 --- a/util/local_database/xpathlite.py +++ b/util/local_database/xpathlite.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## @@ -87,6 +87,48 @@ def findChild(parent, tag_name, arg_name=None, arg_value=None, draft=None): return node return False +def findTagsInFile(file, path): + doc = False + if doc_cache.has_key(file): + doc = doc_cache[file] + else: + doc = xml.dom.minidom.parse(file) + doc_cache[file] = doc + + elt = doc.documentElement + tag_spec_list = path.split("/") + last_entry = None + for i in range(len(tag_spec_list)): + tag_spec = tag_spec_list[i] + tag_name = tag_spec + arg_name = 'type' + arg_value = '' + left_bracket = tag_spec.find('[') + if left_bracket != -1: + tag_name = tag_spec[:left_bracket] + arg_value = tag_spec[left_bracket+1:-1].split("=") + if len(arg_value) == 2: + arg_name = arg_value[0] + arg_value = arg_value[1] + else: + arg_value = arg_value[0] + elt = findChild(elt, tag_name, arg_name, arg_value) + if not elt: + return None + ret = [] + if elt.childNodes: + for node in elt.childNodes: + if node.attributes: + element = [node.nodeName, None] + element[1] = node.attributes.items() + ret.append(element) + else: + if elt.attributes: + element = [elt.nodeName, None] + element[1] = elt.attributes.items() + ret.append(element) + return ret + def _findEntryInFile(file, path, draft=None, attribute=None): doc = False if doc_cache.has_key(file): diff --git a/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro b/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro new file mode 100644 index 0000000..9d5f1cf --- /dev/null +++ b/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro @@ -0,0 +1,9 @@ +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +QT = core + +# Input +SOURCES += main.cpp diff --git a/util/network/cookiejar-generateTLDs/main.cpp b/util/network/cookiejar-generateTLDs/main.cpp new file mode 100644 index 0000000..5cdc97c --- /dev/null +++ b/util/network/cookiejar-generateTLDs/main.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the utils of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +static QString utf8encode(const QByteArray &array) // turns e.g. tranøy.no to tran\xc3\xb8y.no +{ + QString result; + result.reserve(array.length() + array.length() / 3); + for (int i = 0; i < array.length(); ++i) { + char c = array.at(i); + // if char is non-ascii, escape it + if (c < 0x20 || uchar(c) >= 0x7f) { + result += "\\x" + QString::number(uchar(c), 16); + } else { + // if previous char was escaped, we need to make sure the next char is not + // interpreted as part of the hex value, e.g. "äc.com" -> "\xabc.com"; this + // should be "\xab""c.com" + QRegExp hexEscape("\\\\x[a-fA-F0-9][a-fA-F0-9]$"); + bool isHexChar = ((c >= '0' && c <= '9') || + (c >= 'a' && c <= 'f') || + (c >= 'A' && c <= 'F')); + if (result.contains(hexEscape) && isHexChar) + result += "\"\""; + result += c; + } + } + return result; +} + +int main(int argc, char **argv) { + + QCoreApplication app(argc, argv); + if (argc < 3) { + printf("\nusage: %s inputFile outputFile\n\n", argv[0]); + printf("'inputFile' should be a list of effective TLDs, one per line,\n"); + printf("as obtained from http://publicsuffix.org . To create indices and data file\n"); + printf("file, do the following:\n\n"); + printf(" wget http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 -O effective_tld_names.dat\n"); + printf(" grep '^[^\\/\\/]' effective_tld_names.dat > effective_tld_names.dat.trimmed\n"); + printf(" %s effective_tld_names.dat.trimmed effective_tld_names.dat.qt\n\n", argv[0]); + printf("Now copy the data from effective_tld_names.dat.qt to the file src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n\n"); + exit(1); + } + QFile file(argv[1]); + QFile outFile(argv[2]); + file.open(QIODevice::ReadOnly); + outFile.open(QIODevice::WriteOnly); + + QByteArray outIndicesBufferBA; + QBuffer outIndicesBuffer(&outIndicesBufferBA); + outIndicesBuffer.open(QIODevice::WriteOnly); + + QByteArray outDataBufferBA; + QBuffer outDataBuffer(&outDataBufferBA); + outDataBuffer.open(QIODevice::WriteOnly); + + int lineCount = 0; + while (!file.atEnd()) { + file.readLine(); + lineCount++; + } + file.reset(); + QVector<QString> strings(lineCount); + while (!file.atEnd()) { + QString s = QString::fromUtf8(file.readLine()); + QString st = s.trimmed(); + int num = qHash(st) % lineCount; + + QString utf8String = utf8encode(st.toUtf8()); + + // for domain 1.com, we could get something like + // a.com\01.com, which would be interpreted as octal 01, + // so we need to separate those strings with quotes + QRegExp regexpOctalEscape(QLatin1String("^[0-9]")); + if (!strings.at(num).isEmpty() && st.contains(regexpOctalEscape)) + strings[num].append("\"\""); + + strings[num].append(utf8String); + strings[num].append("\\0"); + } + + outIndicesBuffer.write("static const quint16 tldCount = "); + outIndicesBuffer.write(QByteArray::number(lineCount)); + outIndicesBuffer.write(";\n"); + outIndicesBuffer.write("static const quint16 tldIndices["); +// outIndicesBuffer.write(QByteArray::number(lineCount+1)); // not needed + outIndicesBuffer.write("] = {\n"); + + int utf8Size = 0; +// int charSize = 0; + for (int a = 0; a < lineCount; a++) { + bool lineIsEmpty = strings.at(a).isEmpty(); + if (!lineIsEmpty) { + strings[a].prepend("\""); + strings[a].append("\""); + } + int zeroCount = strings.at(a).count(QLatin1String("\\0")); + int utf8CharsCount = strings.at(a).count(QLatin1String("\\x")); + int quoteCount = strings.at(a).count('"'); + outDataBuffer.write(strings.at(a).toUtf8()); + if (!lineIsEmpty) + outDataBuffer.write("\n"); + outIndicesBuffer.write(QByteArray::number(utf8Size)); + outIndicesBuffer.write(",\n"); + utf8Size += strings.at(a).count() - (zeroCount + quoteCount + utf8CharsCount * 3); +// charSize += strings.at(a).count(); + } + outIndicesBuffer.write(QByteArray::number(utf8Size)); + outIndicesBuffer.write("};\n"); + outIndicesBuffer.close(); + outFile.write(outIndicesBufferBA); + + outDataBuffer.close(); + outFile.write("\nstatic const char tldData["); +// outFile.write(QByteArray::number(charSize)); // not needed + outFile.write("] = {\n"); + outFile.write(outDataBufferBA); + outFile.write("};\n"); + outFile.close(); + printf("data generated to %s . Now copy the data from this file to src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n", argv[2]); + exit(0); +} diff --git a/util/normalize/main.cpp b/util/normalize/main.cpp index 65b8d51..1983533 100644 --- a/util/normalize/main.cpp +++ b/util/normalize/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/plugintest/main.cpp b/util/plugintest/main.cpp index 438c51f..dab9471 100644 --- a/util/plugintest/main.cpp +++ b/util/plugintest/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/compress.cpp b/util/qlalr/compress.cpp index 6e9d055..d94d38d 100644 --- a/util/qlalr/compress.cpp +++ b/util/qlalr/compress.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/compress.h b/util/qlalr/compress.h index 97790c7..d2aae1b 100644 --- a/util/qlalr/compress.h +++ b/util/qlalr/compress.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/cppgenerator.cpp b/util/qlalr/cppgenerator.cpp index 45de51c..b68a715 100644 --- a/util/qlalr/cppgenerator.cpp +++ b/util/qlalr/cppgenerator.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -51,7 +51,7 @@ QString CppGenerator::copyrightHeader() const return QLatin1String( "/****************************************************************************\n" "**\n" - "** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).\n" + "** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n" "** All rights reserved.\n" "** Contact: Nokia Corporation (qt-info@nokia.com)\n" "**\n" diff --git a/util/qlalr/cppgenerator.h b/util/qlalr/cppgenerator.h index 11cd76d..e6f22be 100644 --- a/util/qlalr/cppgenerator.h +++ b/util/qlalr/cppgenerator.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/doc/src/qlalr.qdoc b/util/qlalr/doc/src/qlalr.qdoc index 0d5fbb9..b2bcdd2 100644 --- a/util/qlalr/doc/src/qlalr.qdoc +++ b/util/qlalr/doc/src/qlalr.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/dotgraph.cpp b/util/qlalr/dotgraph.cpp index bde2e96..5433b31 100644 --- a/util/qlalr/dotgraph.cpp +++ b/util/qlalr/dotgraph.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/dotgraph.h b/util/qlalr/dotgraph.h index 301042b..15d5734 100644 --- a/util/qlalr/dotgraph.h +++ b/util/qlalr/dotgraph.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/examples/dummy-xml/ll/dummy-xml-ll.cpp b/util/qlalr/examples/dummy-xml/ll/dummy-xml-ll.cpp index 943e302..cbb40cb 100644 --- a/util/qlalr/examples/dummy-xml/ll/dummy-xml-ll.cpp +++ b/util/qlalr/examples/dummy-xml/ll/dummy-xml-ll.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/examples/dummy-xml/xml.g b/util/qlalr/examples/dummy-xml/xml.g index 5de30a1..f0017d4 100644 --- a/util/qlalr/examples/dummy-xml/xml.g +++ b/util/qlalr/examples/dummy-xml/xml.g @@ -1,6 +1,6 @@ ---------------------------------------------------------------------------- -- --- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +-- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -- All rights reserved. -- Contact: Nokia Corporation (qt-info@nokia.com) -- diff --git a/util/qlalr/examples/glsl/build.sh b/util/qlalr/examples/glsl/build.sh index 9896815..f1393c8 100644 --- a/util/qlalr/examples/glsl/build.sh +++ b/util/qlalr/examples/glsl/build.sh @@ -1,7 +1,7 @@ #!/bin/sh ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/util/qlalr/examples/glsl/glsl-lex.l b/util/qlalr/examples/glsl/glsl-lex.l index 1258b80..9975b07 100644 --- a/util/qlalr/examples/glsl/glsl-lex.l +++ b/util/qlalr/examples/glsl/glsl-lex.l @@ -2,7 +2,7 @@ %{ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/examples/glsl/glsl.g b/util/qlalr/examples/glsl/glsl.g index 669f334..bad3183 100644 --- a/util/qlalr/examples/glsl/glsl.g +++ b/util/qlalr/examples/glsl/glsl.g @@ -1,6 +1,6 @@ ---------------------------------------------------------------------------- -- --- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +-- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -- All rights reserved. -- Contact: Nokia Corporation (qt-info@nokia.com) -- diff --git a/util/qlalr/examples/lambda/lambda.g b/util/qlalr/examples/lambda/lambda.g index 79be927..7bb0b14 100644 --- a/util/qlalr/examples/lambda/lambda.g +++ b/util/qlalr/examples/lambda/lambda.g @@ -1,6 +1,6 @@ ---------------------------------------------------------------------------- -- --- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +-- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -- All rights reserved. -- Contact: Nokia Corporation (qt-info@nokia.com) -- diff --git a/util/qlalr/examples/lambda/main.cpp b/util/qlalr/examples/lambda/main.cpp index fe43bb6..5610026 100644 --- a/util/qlalr/examples/lambda/main.cpp +++ b/util/qlalr/examples/lambda/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/examples/qparser/calc.g b/util/qlalr/examples/qparser/calc.g index 8fcd4dd..0b8b343 100644 --- a/util/qlalr/examples/qparser/calc.g +++ b/util/qlalr/examples/qparser/calc.g @@ -1,6 +1,6 @@ ---------------------------------------------------------------------------- -- --- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +-- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -- All rights reserved. -- Contact: Nokia Corporation (qt-info@nokia.com) -- diff --git a/util/qlalr/examples/qparser/calc.l b/util/qlalr/examples/qparser/calc.l index cd40b1a..66f745c 100644 --- a/util/qlalr/examples/qparser/calc.l +++ b/util/qlalr/examples/qparser/calc.l @@ -4,7 +4,7 @@ %{ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/examples/qparser/qparser.cpp b/util/qlalr/examples/qparser/qparser.cpp index 5fe2571..e68351a 100644 --- a/util/qlalr/examples/qparser/qparser.cpp +++ b/util/qlalr/examples/qparser/qparser.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/examples/qparser/qparser.h b/util/qlalr/examples/qparser/qparser.h index 3fb11dc..e158098 100644 --- a/util/qlalr/examples/qparser/qparser.h +++ b/util/qlalr/examples/qparser/qparser.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/grammar.cpp b/util/qlalr/grammar.cpp index a056908..1a7a318 100644 --- a/util/qlalr/grammar.cpp +++ b/util/qlalr/grammar.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/grammar_p.h b/util/qlalr/grammar_p.h index ccdcfc9..4a4ec12 100644 --- a/util/qlalr/grammar_p.h +++ b/util/qlalr/grammar_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/lalr.cpp b/util/qlalr/lalr.cpp index c68d8b6..cef4368 100644 --- a/util/qlalr/lalr.cpp +++ b/util/qlalr/lalr.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/lalr.g b/util/qlalr/lalr.g index 67e373c..cee223d 100644 --- a/util/qlalr/lalr.g +++ b/util/qlalr/lalr.g @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------- -- --- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +-- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -- All rights reserved. -- Contact: Nokia Corporation (qt-info@nokia.com) -- @@ -77,7 +77,7 @@ /: /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -191,7 +191,7 @@ protected: /. /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/lalr.h b/util/qlalr/lalr.h index 7d19589..8259a25 100644 --- a/util/qlalr/lalr.h +++ b/util/qlalr/lalr.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/main.cpp b/util/qlalr/main.cpp index 01854ed..8b2fc91 100644 --- a/util/qlalr/main.cpp +++ b/util/qlalr/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/parsetable.cpp b/util/qlalr/parsetable.cpp index d25a045..509ddf1 100644 --- a/util/qlalr/parsetable.cpp +++ b/util/qlalr/parsetable.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/parsetable.h b/util/qlalr/parsetable.h index b58fa90..88ab2e5 100644 --- a/util/qlalr/parsetable.h +++ b/util/qlalr/parsetable.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/recognizer.cpp b/util/qlalr/recognizer.cpp index 89ec3e2..48f372e 100644 --- a/util/qlalr/recognizer.cpp +++ b/util/qlalr/recognizer.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/qlalr/recognizer.h b/util/qlalr/recognizer.h index 68ce9f1..384f2e6 100644 --- a/util/qlalr/recognizer.h +++ b/util/qlalr/recognizer.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/bld.inf b/util/s60pixelmetrics/bld.inf index 1e5de55..90fe081 100644 --- a/util/s60pixelmetrics/bld.inf +++ b/util/s60pixelmetrics/bld.inf @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp index 42ae850..bc05fd2 100644 --- a/util/s60pixelmetrics/pixel_metrics.cpp +++ b/util/s60pixelmetrics/pixel_metrics.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pixel_metrics.h b/util/s60pixelmetrics/pixel_metrics.h index 4b0f57e..ba952cc 100644 --- a/util/s60pixelmetrics/pixel_metrics.h +++ b/util/s60pixelmetrics/pixel_metrics.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pm_mapper.hrh b/util/s60pixelmetrics/pm_mapper.hrh index b194cbb..c1b70c3 100644 --- a/util/s60pixelmetrics/pm_mapper.hrh +++ b/util/s60pixelmetrics/pm_mapper.hrh @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pm_mapper.mmp b/util/s60pixelmetrics/pm_mapper.mmp index f54f387..ddbbc65 100644 --- a/util/s60pixelmetrics/pm_mapper.mmp +++ b/util/s60pixelmetrics/pm_mapper.mmp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pm_mapper.pkg b/util/s60pixelmetrics/pm_mapper.pkg index d81a8b1..f5a2a9b 100644 --- a/util/s60pixelmetrics/pm_mapper.pkg +++ b/util/s60pixelmetrics/pm_mapper.pkg @@ -5,7 +5,7 @@ ; SIS creation. ; Version : ; -; Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +; Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ; This material, including documentation and any related ; computer programs, is protected by copyright controlled by ; Nokia Corporation. All rights are reserved. Copying, diff --git a/util/s60pixelmetrics/pm_mapper.rss b/util/s60pixelmetrics/pm_mapper.rss index d1983af..b7e6d3d 100644 --- a/util/s60pixelmetrics/pm_mapper.rss +++ b/util/s60pixelmetrics/pm_mapper.rss @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pm_mapper_reg.rss b/util/s60pixelmetrics/pm_mapper_reg.rss index 99721fb..42236e9 100644 --- a/util/s60pixelmetrics/pm_mapper_reg.rss +++ b/util/s60pixelmetrics/pm_mapper_reg.rss @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp index b0c4eaf..d905cce 100644 --- a/util/s60pixelmetrics/pm_mapperapp.cpp +++ b/util/s60pixelmetrics/pm_mapperapp.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pm_mapperapp.h b/util/s60pixelmetrics/pm_mapperapp.h index 4800992..15305c5 100644 --- a/util/s60pixelmetrics/pm_mapperapp.h +++ b/util/s60pixelmetrics/pm_mapperapp.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pm_mapperview.cpp b/util/s60pixelmetrics/pm_mapperview.cpp index 0f75314..fe84751 100644 --- a/util/s60pixelmetrics/pm_mapperview.cpp +++ b/util/s60pixelmetrics/pm_mapperview.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60pixelmetrics/pm_mapperview.h b/util/s60pixelmetrics/pm_mapperview.h index 6b1e657..6d43396 100644 --- a/util/s60pixelmetrics/pm_mapperview.h +++ b/util/s60pixelmetrics/pm_mapperview.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60theme/main.cpp b/util/s60theme/main.cpp index 1234fd2..0e54582 100644 --- a/util/s60theme/main.cpp +++ b/util/s60theme/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60theme/s60themeconvert.cpp b/util/s60theme/s60themeconvert.cpp index b1e8022..8fe37fe 100644 --- a/util/s60theme/s60themeconvert.cpp +++ b/util/s60theme/s60themeconvert.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/s60theme/s60themeconvert.h b/util/s60theme/s60themeconvert.h index 4512446..123e094 100644 --- a/util/s60theme/s60themeconvert.h +++ b/util/s60theme/s60themeconvert.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/scripts/make_qfeatures_dot_h b/util/scripts/make_qfeatures_dot_h index c1b30ce..bacb0e7 100755 --- a/util/scripts/make_qfeatures_dot_h +++ b/util/scripts/make_qfeatures_dot_h @@ -1,7 +1,7 @@ #!/usr/bin/perl ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## @@ -132,7 +132,7 @@ open OUT, ">$qtbase/src/corelib/global/qfeatures.h" print OUT '/**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/unicode/codecs/big5/main.cpp b/util/unicode/codecs/big5/main.cpp index 3e0ef12..1f1b5cf 100644 --- a/util/unicode/codecs/big5/main.cpp +++ b/util/unicode/codecs/big5/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index cfe5956..3384e62 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -85,6 +85,41 @@ static void initAgeMap() } +enum Joining { + Joining_None, + Joining_Left, + Joining_Causing, + Joining_Dual, + Joining_Right, + Joining_Transparent + + , Joining_Unassigned +}; + +static QHash<QByteArray, Joining> joining_map; + +static void initJoiningMap() +{ + struct JoiningList { + Joining joining; + const char *name; + } joinings[] = { + { Joining_None, "U" }, + { Joining_Left, "L" }, + { Joining_Causing, "C" }, + { Joining_Dual, "D" }, + { Joining_Right, "R" }, + { Joining_Transparent, "T" }, + { Joining_Unassigned, 0 } + }; + JoiningList *d = joinings; + while (d->name) { + joining_map.insert(d->name, d->joining); + ++d; + } +} + + static const char *grapheme_break_string = " enum GraphemeBreak {\n" " GraphemeBreakOther,\n" @@ -370,6 +405,7 @@ static const char *methods = " inline int script(const QChar &ch)\n" " { return script(ch.unicode()); }\n\n"; +static const int SizeOfPropertiesStruct = 20; struct PropertyFlags { bool operator ==(const PropertyFlags &o) { @@ -460,18 +496,22 @@ struct UnicodeData { p.combiningClass = 0; p.direction = QChar::DirL; + // DerivedBidiClass.txt // DirR for: U+0590..U+05FF, U+07C0..U+08FF, U+FB1D..U+FB4F, U+10800..U+10FFF if ((codepoint >= 0x590 && codepoint <= 0x5ff) || (codepoint >= 0x7c0 && codepoint <= 0x8ff) || (codepoint >= 0xfb1d && codepoint <= 0xfb4f) - || (codepoint >= 0x10800 && codepoint <= 0x10fff)) + || (codepoint >= 0x10800 && codepoint <= 0x10fff)) { p.direction = QChar::DirR; - // DirAL for: U+0600..U+07BF, U+FB50..U+FDCF, U+FDF0..U+FDFF, U+FE70..U+FEFE + } + // DirAL for: U+0600..U+07BF, U+FB50..U+FDFF, U+FE70..U+FEFF + // minus noncharacter code points (intersects with U+FDD0..U+FDEF) if ((codepoint >= 0x600 && codepoint <= 0x7bf) || (codepoint >= 0xfb50 && codepoint <= 0xfdcf) || (codepoint >= 0xfdf0 && codepoint <= 0xfdff) - || (codepoint >= 0xfe70 && codepoint <= 0xfefe)) + || (codepoint >= 0xfe70 && codepoint <= 0xfeff)) { p.direction = QChar::DirAL; + } mirroredChar = 0; decompositionType = QChar::NoDecomposition; @@ -876,24 +916,31 @@ static void readArabicShaping() if (line.isEmpty()) continue; - QList<QByteArray> shaping = line.split(';'); - Q_ASSERT(shaping.size() == 4); + QList<QByteArray> l = line.split(';'); + Q_ASSERT(l.size() == 4); bool ok; - int codepoint = shaping[0].toInt(&ok, 16); + int codepoint = l[0].toInt(&ok, 16); Q_ASSERT(ok); - QChar::Joining j = QChar::OtherJoining; - QByteArray shape = shaping[2].trimmed(); - if (shape == "R") - j = QChar::Right; - else if (shape == "D") - j = QChar::Dual; - else if (shape == "C") - j = QChar::Center; + Joining joining = joining_map.value(l[2].trimmed(), Joining_Unassigned); + if (joining == Joining_Unassigned) + qFatal("unassigned or unhandled joining value: %s", l[2].constData()); + + if (joining == Joining_Left) { + // There are currently no characters of joining type Left_Joining defined in Unicode. + qFatal("%x: joining type '%s' was met; the current implementation needs to be revised!", codepoint, l[2].constData()); + } UnicodeData d = unicodeData.value(codepoint, UnicodeData(codepoint)); - d.p.joining = j; + if (joining == Joining_Right) + d.p.joining = QChar::Right; + else if (joining == Joining_Dual) + d.p.joining = QChar::Dual; + else if (joining == Joining_Causing) + d.p.joining = QChar::Center; + else + d.p.joining = QChar::OtherJoining; unicodeData.insert(codepoint, d); } } @@ -2031,8 +2078,8 @@ static QByteArray createPropertyInfo() qDebug(" block data uses: %d bytes", smp_block_data); qDebug(" trie data uses : %d bytes", smp_trie); - qDebug("\n properties use : %d bytes", uniqueProperties.size()*20); - qDebug(" memory usage: %d bytes", bmp_mem+smp_mem + uniqueProperties.size()*20); + qDebug("\n properties uses : %d bytes", uniqueProperties.size() * SizeOfPropertiesStruct); + qDebug(" memory usage: %d bytes", bmp_mem + smp_mem + uniqueProperties.size() * SizeOfPropertiesStruct); QByteArray out; out += "static const unsigned short uc_property_trie[] = {\n"; @@ -2566,8 +2613,9 @@ int main(int, char **) { initAgeMap(); initCategoryMap(); - initDirectionMap(); initDecompositionMap(); + initDirectionMap(); + initJoiningMap(); initGraphemeBreak(); initWordBreak(); initSentenceBreak(); @@ -2598,7 +2646,7 @@ int main(int, char **) QByteArray header = "/****************************************************************************\n" "**\n" - "** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).\n" + "** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n" "** All rights reserved.\n" "** Contact: Nokia Corporation (qt-info@nokia.com)\n" "**\n" diff --git a/util/unicode/writingSystems.sh b/util/unicode/writingSystems.sh index f675aba..f787181 100755 --- a/util/unicode/writingSystems.sh +++ b/util/unicode/writingSystems.sh @@ -1,7 +1,7 @@ #!/bin/sh ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/util/xkbdatagen/README b/util/xkbdatagen/README new file mode 100644 index 0000000..bae68b8 --- /dev/null +++ b/util/xkbdatagen/README @@ -0,0 +1 @@ +program used to generate qkeymapper_x11_p.cpp diff --git a/util/xkbdatagen/main.cpp b/util/xkbdatagen/main.cpp index 5418fec..b8ececc 100644 --- a/util/xkbdatagen/main.cpp +++ b/util/xkbdatagen/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -416,7 +416,7 @@ int main(int argc, char **argv) // copyright and stuff printf("/****************************************************************************\n" "**\n" - "** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).\n" + "** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n" "** All rights reserved.\n" "** Contact: Nokia Corporation (qt-info@nokia.com)\n" "**\n" @@ -456,6 +456,7 @@ int main(int argc, char **argv) "****************************************************************************/\n" "\n" "// This file is auto-generated, do not edit!\n" + "// (Generated using util/xkbdatagen)\n" "\n"); // data structure |