Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -174,10 +174,6 @@ namespace Mono.Tools.LocaleBuilder
writer.WriteLine ("{0}: {1}", "NumberGroupSeparator", nf.NumberGroupSeparator);
Dump (writer, nf.NumberGroupSizes, "NumberGroupSizes", true);
writer.WriteLine ("{0}: {1}", "NumberNegativePattern", nf.NumberNegativePattern);
writer.WriteLine ("{0}: {1}", "PercentDecimalDigits", nf.PercentDecimalDigits);
writer.WriteLine ("{0}: {1}", "PercentDecimalSeparator", nf.PercentDecimalSeparator);
writer.WriteLine ("{0}: {1}", "PercentGroupSeparator", nf.PercentGroupSeparator);
Dump (writer, nf.PercentGroupSizes, "PercentGroupSizes", true);
writer.WriteLine ("{0}: {1}", "PercentNegativePattern", nf.PercentNegativePattern);
writer.WriteLine ("{0}: {1}", "PercentPositivePattern", nf.PercentPositivePattern);
writer.WriteLine ("{0}: {1}", "PercentSymbol", nf.PercentSymbol);
@@ -935,12 +931,10 @@ namespace Mono.Tools.LocaleBuilder
// We don't add 3 as it's for some arabic states only
switch (data.ThreeLetterISOLanguageName) {
case "amh":
data.NumberFormatEntry.NumberDecimalDigits =
data.NumberFormatEntry.PercentDecimalDigits = 1;
data.NumberFormatEntry.NumberDecimalDigits = 1;
break;
default:
data.NumberFormatEntry.NumberDecimalDigits =
data.NumberFormatEntry.PercentDecimalDigits = 2;
data.NumberFormatEntry.NumberDecimalDigits = 2;
break;
}
@@ -973,7 +967,7 @@ namespace Mono.Tools.LocaleBuilder
string calendar;
// Default calendar is for now always "gregorian"
switch (ci.Name) {
switch (ci.OriginalName) {
case "th": case "th-TH":
calendar = "buddhist";
ci.CalendarType = CalendarType.ThaiBuddhist; // typeof (ThaiBuddhistCalendar);
@@ -1006,6 +1000,12 @@ namespace Mono.Tools.LocaleBuilder
nodes = node.SelectNodes ("months/monthContext[@type='stand-alone']/monthWidth[@type='wide']/month");
ProcessAllNodes (nodes, df.MonthNames, AddOrReplaceValue);
if (df.MonthNames != null) {
if (ci.Name == "sv" || ci.Name == "sv-SE") {
ToLower (df.MonthNames);
}
}
// Apply global rule first <alias source="locale" path="../../monthContext[@type='format']/monthWidth[@type='abbreviated']"/>
if (ci.Name == "ja" || ci.Name == "ja-JP") {
// Use common number style
@@ -1016,6 +1016,12 @@ namespace Mono.Tools.LocaleBuilder
ProcessAllNodes (nodes, df.AbbreviatedMonthNames, AddOrReplaceValue);
}
if (df.AbbreviatedMonthNames != null) {
if (ci.Name == "sv" || ci.Name == "sv-SE") {
ToLower (df.AbbreviatedMonthNames);
}
}
nodes = node.SelectNodes ("months/monthContext[@type='format']/monthWidth[@type='wide']/month");
if (nodes != null) {
ProcessAllNodes (nodes, df.MonthGenitiveNames, AddOrReplaceValue);
@@ -1033,6 +1039,12 @@ namespace Mono.Tools.LocaleBuilder
nodes = node.SelectNodes ("days/dayContext[@type='stand-alone']/dayWidth[@type='abbreviated']/day");
ProcessAllNodes (nodes, df.AbbreviatedDayNames, AddOrReplaceDayValue);
if (df.AbbreviatedDayNames != null) {
if (ci.Name == "sv" || ci.Name == "sv-SE") {
ToLower (df.AbbreviatedDayNames);
}
}
// TODO: This is not really ShortestDayNames as .NET uses it
// Apply global rules first <alias source="locale" path="../../dayContext[@type='stand-alone']/dayWidth[@type='narrow']"/>
nodes = node.SelectNodes ("days/dayContext[@type='format']/dayWidth[@type='narrow']/day");
@@ -1110,12 +1122,6 @@ namespace Mono.Tools.LocaleBuilder
node = doc.SelectSingleNode ("ldml/numbers/symbols");
if (node != null) {
el = node.SelectSingleNode ("decimal");
if (el != null) {
ni.NumberDecimalSeparator =
ni.PercentDecimalSeparator = el.InnerText;
}
el = node.SelectSingleNode ("plusSign");
if (el != null)
ni.PositiveSign = el.InnerText;
@@ -1179,9 +1185,20 @@ namespace Mono.Tools.LocaleBuilder
}
if (value != null) {
ni.NumberGroupSeparator =
ni.PercentGroupSeparator =
ni.CurrencyGroupSeparator = value;
ni.NumberGroupSeparator = ni.CurrencyGroupSeparator = value;
}
}
static void ToLower (string[] values)
{
if (values == null)
return;
for (int i = 0; i < values.Length; ++i) {
if (values [i] == null)
continue;
values [i] = values [i].ToLower ();
}
}

View File

@@ -49,10 +49,12 @@ namespace Mono.Tools.LocaleBuilder
public string NumberGroupSeparator = ",";
public string[] NumberGroupSizes = new string[Constants.GROUP_SIZE];
public string NumberNegativePattern;
/*
public int PercentDecimalDigits;
public string PercentDecimalSeparator = ",";
public string PercentGroupSeparator = ",";
public string[] PercentGroupSizes = new string[Constants.GROUP_SIZE];
*/
public string PercentNegativePattern;
public string PercentPositivePattern;
public string PercentSymbol = "%";
@@ -89,8 +91,6 @@ namespace Mono.Tools.LocaleBuilder
builder.Append (EncodeStringIdx (CurrencyDecimalSeparator) + ", ");
builder.Append (EncodeStringIdx (CurrencyGroupSeparator) + ", ");
builder.Append (EncodeStringIdx (PercentDecimalSeparator) + ", ");
builder.Append (EncodeStringIdx (PercentGroupSeparator) + ", ");
builder.Append (EncodeStringIdx (NumberDecimalSeparator) + ", ");
builder.Append (EncodeStringIdx (NumberGroupSeparator) + ", ");
@@ -111,13 +111,10 @@ namespace Mono.Tools.LocaleBuilder
builder.Append (NumberNegativePattern + ", ");
builder.Append (CurrencyDecimalDigits + ", ");
builder.Append (PercentDecimalDigits + ", ");
builder.Append (NumberDecimalDigits + ", ");
AppendGroupSizes (builder, CurrencyGroupSizes);
builder.Append (", ");
AppendGroupSizes (builder, PercentGroupSizes);
builder.Append (", ");
AppendGroupSizes (builder, NumberGroupSizes);
builder.Append ('}');

View File

@@ -1 +1 @@
b2e7e8b961017e7fb586222c7827496d7c82d1f7
5acbc5535da9977890582be2151836a36f5070c6

View File

@@ -8,7 +8,7 @@
#define SGEN_BINARY_PROTOCOL
#define MONO_INTERNAL
#include <mono/metadata/sgen-protocol.h>
#include <mono/sgen/sgen-protocol.h>
#define SGEN_PROTOCOL_EOF 255
@@ -122,7 +122,7 @@ read_entry (EntryStream *stream, void *data)
#define END_PROTOCOL_ENTRY
#define END_PROTOCOL_ENTRY_HEAVY
#include <mono/metadata/sgen-protocol-def.h>
#include <mono/sgen/sgen-protocol-def.h>
default: assert (0);
}
@@ -182,7 +182,7 @@ is_always_match (int type)
#define END_PROTOCOL_ENTRY
#define END_PROTOCOL_ENTRY_HEAVY
#include <mono/metadata/sgen-protocol-def.h>
#include <mono/sgen/sgen-protocol-def.h>
default: assert (0);
}
@@ -207,6 +207,7 @@ typedef struct {
#define TYPE_LONGLONG 1
#define TYPE_SIZE 2
#define TYPE_POINTER 3
#define TYPE_BOOL 4
static void
print_entry_content (int entries_size, PrintEntry *entries, gboolean color_output)
@@ -230,6 +231,9 @@ print_entry_content (int entries_size, PrintEntry *entries, gboolean color_outpu
case TYPE_POINTER:
printf ("%p", *(gpointer*) entries [i].data);
break;
case TYPE_BOOL:
printf ("%s", *(gboolean*) entries [i].data ? "true" : "false");
break;
default:
assert (0);
}
@@ -416,7 +420,7 @@ print_entry (int type, void *data, int num_nums, int *match_indices, gboolean co
#define END_PROTOCOL_ENTRY_HEAVY \
END_PROTOCOL_ENTRY
#include <mono/metadata/sgen-protocol-def.h>
#include <mono/sgen/sgen-protocol-def.h>
default: assert (0);
}
@@ -499,7 +503,7 @@ match_index (gpointer ptr, int type, void *data)
#define END_PROTOCOL_ENTRY_HEAVY \
END_PROTOCOL_ENTRY
#include <mono/metadata/sgen-protocol-def.h>
#include <mono/sgen/sgen-protocol-def.h>
default: assert (0);
}
@@ -562,7 +566,7 @@ is_vtable_match (gpointer ptr, int type, void *data)
#define END_PROTOCOL_ENTRY_HEAVY \
END_PROTOCOL_ENTRY
#include <mono/metadata/sgen-protocol-def.h>
#include <mono/sgen/sgen-protocol-def.h>
default: assert (0);
}
@@ -594,6 +598,8 @@ main (int argc, char *argv[])
const char *input_path = NULL;
int input_file;
EntryStream stream;
unsigned long long entry_index;
unsigned long long first_entry_to_consider = 0;
for (i = 0; i < num_args; ++i) {
char *arg = argv [i + 1];
@@ -605,11 +611,37 @@ main (int argc, char *argv[])
} else if (!strcmp (arg, "-v") || !strcmp (arg, "--vtable")) {
vtables [num_vtables++] = strtoul (next_arg, NULL, 16);
++i;
} else if (!strcmp (arg, "-s") || !strcmp (arg, "--start-at")) {
first_entry_to_consider = strtoull (next_arg, NULL, 10);
++i;
} else if (!strcmp (arg, "-c") || !strcmp (arg, "--color")) {
color_output = TRUE;
} else if (!strcmp (arg, "-i") || !strcmp (arg, "--input")) {
input_path = next_arg;
++i;
} else if (!strcmp (arg, "--help")) {
printf (
"\n"
"Usage:\n"
"\n"
"\tsgen-grep-binprot [options] [pointer...]\n"
"\n"
"Examples:\n"
"\n"
"\tsgen-grep-binprot --all </tmp/binprot\n"
"\tsgen-grep-binprot --input /tmp/binprot --color 0xdeadbeef\n"
"\n"
"Options:\n"
"\n"
"\t--all Print all entries.\n"
"\t--color, -c Highlight matches in color.\n"
"\t--help You're looking at it.\n"
"\t--input FILE, -i FILE Read input from FILE instead of standard input.\n"
"\t--pause-times Print GC pause times.\n"
"\t--start-at N, -s N Begin filtering at the Nth entry.\n"
"\t--vtable PTR, -v PTR Search for vtable pointer PTR.\n"
"\n");
return 0;
} else {
nums [num_nums++] = strtoul (arg, NULL, 16);
}
@@ -622,7 +654,10 @@ main (int argc, char *argv[])
input_file = input_path ? open (input_path, O_RDONLY) : STDIN_FILENO;
init_stream (&stream, input_file);
entry_index = 0;
while ((type = read_entry (&stream, data)) != SGEN_PROTOCOL_EOF) {
if (entry_index < first_entry_to_consider)
goto next_entry;
if (pause_times) {
switch (type) {
case PROTOCOL_ID (binary_protocol_world_stopping): {
@@ -670,11 +705,15 @@ main (int argc, char *argv[])
}
}
}
if (match || dump_all)
printf ("%12lld ", entry_index);
if (dump_all)
printf (match ? "* " : " ");
if (match || dump_all)
print_entry (type, data, num_nums, match_indices, color_output);
}
next_entry:
++entry_index;
}
close_stream (&stream);
if (input_path)