namespace M17N
{
- public class M17N
+ public static class M17n
{
- public static readonly int MajorVersion = 0;
- public static readonly int MinorVersion = 0;
- public static readonly int ReleaseNumber = 0;
+ public const int Version = 0x020101;
+
+ public static int MajorVersion { get { return (Version >> 16); } }
+ public static int MinorVersion { get { return ((Version >> 8) & 0xFF); } }
+ public static int ReleaseNumber { get { return (Version & 0xFF); } }
public static bool debug = false;
{
private class MDatabaseDir
{
+ private const string ListFileName = "mdb.dir";
+
public string Dirname;
- public DirectoryInfo Info;
+ public DirectoryInfo DirInfo;
public DateTime LastScanned;
+ public FileInfo ListInfo;
+
+ private static void GetInfo (string dirname, out DirectoryInfo dirinfo,
+ out FileInfo listinfo)
+ {
+ if (Directory.Exists (dirname))
+ try { dirinfo = new DirectoryInfo (dirname);
+ try { listinfo = dirinfo.GetFiles (ListFileName)[0];
+ } catch { listinfo = null; }
+ } catch { dirinfo = null; listinfo = null; }
+ else
+ {
+ dirinfo = null;
+ listinfo = null;
+ }
+ }
public MDatabaseDir (string dirname)
{
Dirname = dirname;
- try {
- Info = new DirectoryInfo (dirname);
- } finally {
- Info = null;
- }
+ GetInfo (dirname, out DirInfo, out ListInfo);
}
public bool StatusChanged {
get {
bool exists = Directory.Exists (Dirname);
- if (Info != null)
+ if (DirInfo != null)
{
if (! exists)
{
- Info = null;
- return true;
+ DirInfo = null;
+ ListInfo = null;
+ LastScanned = new DateTime (0);
}
- Info.Refresh ();
- return (LastScanned < Info.LastWriteTime);
+ if (LastScanned.Year == 0)
+ return true;
+ DirInfo.Refresh ();
+ if (ListInfo != null)
+ ListInfo.Refresh ();
+ return (LastScanned < DirInfo.LastWriteTime
+ || LastScanned < ListInfo.LastWriteTime);
}
else
{
if (exists)
{
- Info = new DirectoryInfo (Dirname);
+ DirInfo = new DirectoryInfo (Dirname);
+ try {
+ ListInfo = DirInfo.GetFiles (ListFileName)[0];
+ } catch {
+ ListInfo = null;
+ }
return true;
}
return false;
public void UpdateStatus ()
{
- LastScanned = DateTime.Now;
- }
- }
-
- private class MDatabaseDefinition
- {
- private static readonly MSymbol Mversion;
- public MDatabaseTag Tag;
- public string Description;
- public MText Filename;
- public bool IsWildcard;
- public MSymbol Format;
- public MSymbol Schema;
- public MText SchemaFile;
- public MPlist props;
- public bool Supported;
-
- static MDatabaseDefinition ()
- {
- Mversion = new MSymbol ("version");
+ if (DirInfo != null)
+ LastScanned = DateTime.UtcNow;
}
- public MDatabaseDefinition (MPlist plist)
+ public FileInfo[] Scan (string filename)
{
- MSymbol[] tags = new MSymbol[4];
- int i;
-
- for (i = 0; plist.IsSymbol; i++, plist = plist.Next)
- tags[i] = plist.Symbol;
- while (i < 4)
- tags[i++] = MSymbol.nil;
- Tag = new MDatabaseTag (tags[0], tags[1], tags[2], tags[3]);
- if (plist.IsMText)
- {
- Filename = plist.Text;
- plist = plist.Next;
- }
- else if (plist.IsPlist)
- {
- MPlist p = plist.Plist;
-
- if (p.IsMText)
- Filename = plist.Text;
- p = p.Next;
- if (! p.IsEmpty)
- {
- if (p.IsSymbol)
- Format = p.Symbol;
- p = p.Next;
- if (! p.IsEmpty)
- {
- if (p.IsSymbol)
- Schema = p.Symbol;
- p = p.Next;
- if (p.IsMText)
- SchemaFile = p.Text;
- }
- }
- plist = plist.Next;
- }
- Supported = true;
- props = new MPlist ();
- foreach (MPlist pl in plist)
- {
- if (pl.IsPlist)
- {
- MPlist p = pl.Plist;
-
- if (p.IsSymbol && p.Symbol == Mversion
- && ! check_version (p.Next))
- Supported = false;
- props.Put (pl);
- }
- }
+ if (DirInfo == null)
+ return null;
+ DirInfo.Refresh ();
+ return DirInfo.GetFiles (filename);
}
+ }
- private bool check_version (MPlist plist)
- {
- string[] str;
- int major, minor, release;
-
- if (! plist.IsMText)
- return false;
- str = plist.Text.ToString ().Split ('.');
- if (str.Length != 3)
- return false;
- try { major = int.Parse (str[0]); } catch { return false; }
- try { minor = int.Parse (str[1]); } catch { return false; }
- try { release = int.Parse (str[2]); } catch { return false; }
- return (M17N.MajorVersion > major
- || (M17N.MajorVersion == major
- && (M17N.MinorVersion > minor
- || (M17N.MinorVersion == minor
- && M17N.ReleaseNumber >= release))));
- }
+ internal class MDatabaseInfo {
+ internal DirectoryInfo Dir;
+ internal string Description;
+ internal MText Filename;
+ internal FileInfo FileInfo;
+ internal FileInfo Validater;
+ internal int Version;
+ internal MSymbol Format;
+ internal MSymbol Schema;
+ internal MText SchemaFile;
+ internal DateTime ModifiedTime;
+ internal MPlist Props;
}
+ private static Dictionary<MDatabaseTag, MDatabase> DBDict
+ = new Dictionary<MDatabaseTag, MDatabase> ();
+
private static MDatabaseDir[] DBDirs = new MDatabaseDir[3];
private const string SystemDirectory = "/usr/share/m17n";
-
- private static Dictionary<MDatabaseTag, MDatabase> DBDict
- = new Dictionary<MDatabaseTag, MDatabase> ();
+ private readonly MSymbol Mversion = new MSymbol ("version");
/// Type of database
private enum MDBType
{
- /// The database was defined automatically (from mdb.dir
- /// file(s)) with no wildcard tag.
+ /// The database was defined automatically from mdb.dir
+ /// file(s) with no wildcard tag.
AUTO,
- /// The database was defined automatically (from mdb.dir
- /// file(s)) with a wildcard tag to define multiple databases
+ /// The database was defined automatically from mdb.dir
+ /// file(s) with a wildcard tag to define multiple databases
/// of the same kind.
- AUTO_WILDCARD,
- /// The database was defined explicitely (by MDatabaseDefine).
- EXPLICIT
+ MULTIPLE,
+ /// The database was defined explicitely by MDatabase.Define
+ /// without a special loader.
+ EXPLICIT,
+ /// The database was defined explicitely by MDatabase.Define
+ /// with a special loader.
+ UNKNOWN,
};
/// Status of database
// The database file has not been modified after the previous
// loading.
UPDATED,
- // The database file is updated but the validation was failed.
- // If this is for a database directory, the directory is
- // readable but "mdb.dir" doesn't exist in it.
- INVALID
+ // The database file is updated but the validation was failed
+ // or the version is not supported by the current system.
+ INVALID,
};
public readonly MDatabaseTag Tag;
private MDatabaseLoader Loader;
private object ExtraInfo;
-
- private bool IsSystemDatabase;
- private DirectoryInfo Dir;
- private MText Filename;
- private FileInfo FileInfo;
- private FileInfo Validater;
- private int MajorVersion, MinorVersion, ReleaseNumber;
private MDBType DBType;
private MDBStatus DBStatus;
- private MSymbol Format;
- private MSymbol Schema;
- private DateTime Mtime;
- private DateTime Ltime;
- private MPlist Props;
+ internal DateTime LoadedTime;
+ internal MDatabaseInfo Info;
public static string ApplicationDirectory;
private MDatabase (MDatabaseTag tag, string filename)
{
Tag = tag;
- Filename = new MText (filename);
+ Info = new MDatabaseInfo ();
+ Info.Filename = new MText (filename);
+ }
+
+ private MDatabase (MPlist plist)
+ {
+ MSymbol[] tags = new MSymbol[4];
+ int i;
+
+ for (i = 0; plist.IsSymbol; i++, plist = plist.Next)
+ tags[i] = plist.Symbol;
+ while (i < 4)
+ tags[i++] = MSymbol.nil;
+ Tag = new MDatabaseTag (tags[0], tags[1], tags[2], tags[3]);
+ if (plist.IsMText)
+ {
+ Info.Filename = plist.Text;
+ plist = plist.Next;
+ }
+ else if (plist.IsPlist)
+ {
+ MPlist p = plist.Plist;
+
+ if (p.IsMText)
+ Info.Filename = plist.Text;
+ p = p.Next;
+ if (! p.IsEmpty)
+ {
+ if (p.IsSymbol)
+ Info.Format = p.Symbol;
+ p = p.Next;
+ if (! p.IsEmpty)
+ {
+ if (p.IsSymbol)
+ Info.Schema = p.Symbol;
+ p = p.Next;
+ if (p.IsMText)
+ Info.SchemaFile = p.Text;
+ }
+ }
+ plist = plist.Next;
+ }
+ DBStatus = MDBStatus.OUTDATED;;
+ Info.Version = 0;
+ Info.Props = new MPlist ();
+ foreach (MPlist pl in plist)
+ {
+ if (pl.IsPlist)
+ {
+ MPlist p = pl.Plist;
+
+ if (p.IsSymbol && p.Symbol == Mversion)
+ {
+ Info.Version = parse_version (p.Next);
+ if (M17n.Version < Info.Version)
+ DBStatus = MDBStatus.DISABLED;
+ }
+ }
+ Info.Props.Put (pl.Key, pl.Val);
+ }
+ }
+
+ private static int parse_version (MPlist plist)
+ {
+ string[] str;
+ int major, minor, release;
+
+ if (! plist.IsMText)
+ return 0xFFFFFF;
+ str = plist.Text.ToString ().Split ('.');
+ if (str.Length != 3)
+ return 0xFFFFFF;
+ try { major = int.Parse (str[0]); } catch { return 0xFFFFFF; }
+ try { minor = int.Parse (str[1]); } catch { return 0xFFFFFF; }
+ try { release = int.Parse (str[2]); } catch { return 0xFFFFFF; }
+ return ((major << 16) | (minor << 8) | release);
}
public static MDatabase Define (MDatabaseTag tag, MDatabaseLoader loader,
{
db.Loader = loader;
db.ExtraInfo = extra_info;
+ db.DBType = MDBType.EXPLICIT;
+ db.DBStatus = MDBStatus.OUTDATED;
+ db.Info = null;
return db;
}
return new MDatabase (tag, loader, extra_info);
if (db != null)
{
db.Loader = null;
- db.Filename = new MText (filename);
+ db.DBType = MDBType.EXPLICIT;
+ db.DBStatus = MDBStatus.OUTDATED;
+ db.Info = new MDatabaseInfo ();
+ db.Info.Filename = new MText (filename);
+
return db;
}
return new MDatabase (tag, filename);
try {
DBDirs[0] = new MDatabaseDir (Path.Combine (usr_dir, ".m17n.d"));
} catch (ArgumentException) {
- DBDirs[0] = new MDatabaseDir (Path.Combine (usr_dir, "_m17n.d"));
+ DBDirs[0] = new MDatabaseDir (Path.Combine (usr_dir, "_m17n_d"));
}
DBDirs[1] = null;
DBDirs[2] = new MDatabaseDir (Path.Combine (share_dir, "m17n"));
}
- internal static void Update ()
+ private static void Update ()
{
}
private object load (MSymbol key, MSymbol stop)
{
- Ltime = DateTime.Now;
+ LoadedTime = DateTime.UtcNow;
return p.Push (key, val);
}
+ public MPlist Clear ()
+ {
+ Key = MSymbol.nil;
+ Val = null;
+ next = null;
+ return this;
+ }
+
// Implement IEnumerable interface.
// foreach (MPlist p in plist) { ... }
private class MSymbolData
{
- public string name;
- public object value;
- public MPlist plist;
+ public readonly string Name;
+ public readonly MTextProperty.Flags Flags;
+ public object Value;
+ public MPlist Plist;
- public MSymbolData (string name)
+ public MSymbolData (string name, MTextProperty.Flags flags)
{
- this.name = name;
+ Name = name;
+ Flags = flags;
}
}
{
if (! pool.ContainsKey (name))
{
- data = new MSymbolData (name);
+ data = new MSymbolData (name, MTextProperty.Flags.None);
pool.Add (name, data);
}
else
data = (MSymbolData) pool[name];
}
+ public MSymbol (string name, MTextProperty.Flags flags)
+ {
+ if (! pool.ContainsKey (name))
+ {
+ data = new MSymbolData (name, flags);
+ pool.Add (name, data);
+ }
+ else
+ {
+ if (((MSymbolData) pool[name]).Flags != flags)
+ throw new ArgumentException ("Invalid MTextProperty.Flags");
+ }
+ }
+
+ public MTextProperty.Flags TextPropertyFlags { get { return data.Flags; } }
+
public override string ToString ()
{
string str = "";
- foreach (char c in data.name)
+ foreach (char c in data.Name)
{
if (c == '\\' || c == ' ' || c == '\'' || c == '\"' || c == ':')
str += "\\";
public override int GetHashCode ()
{
- return (data.name.GetHashCode ());
+ return (data.Name.GetHashCode ());
}
public MPlist Find (MSymbol key)
{
- return (data.plist == null ? null : data.plist.Find (key));
+ return (data.Plist == null ? null : data.Plist.Find (key));
}
public object Get (MSymbol key)
{
- return (data.plist == null ? null : data.plist.Get (key));
+ return (data.Plist == null ? null : data.Plist.Get (key));
}
public object Put (MSymbol key, object val)
{
- if (data.plist == null)
- data.plist = new MPlist ();
- return data.plist.Put (key, val);
+ if (data.Plist == null)
+ data.Plist = new MPlist ();
+ return data.Plist.Put (key, val);
}
}
}
public class MTextProperty
{
+ [FlagsAttribute]
+ public enum Flags
+ {
+ None = 0,
+ /// A text inserted before a character that has this property
+ /// inherits this property. If the text already has properties
+ /// of the same key, they are deleted. See the documentation of
+ /// Sensitive for exception.
+ FrontSticky = 1,
+ /// A text inserted after a character that has this property
+ /// inherits this property. If the text already has properties
+ /// of the same key, they are deleted. See the documentation of
+ /// Sensitive for exception.
+ RearSticky = 2,
+ /// This property is deleted from a span of text if the span is
+ /// modified (i.e. a character is changed, a text is inserted,
+ /// some part is deleted). If this property is also FrontSticky
+ /// (or RearSticky), text insertion just before (or after) the
+ /// span also deletes this property from the span of text.
+ Sensitive = 4
+ };
+
internal MSymbol key;
internal object val;
- [FlagsAttribute]
- internal enum Flag : byte
- {
- None = 0,
- FrontSticky = 1,
- RearSticky = 2,
- Sensitive = 4
- };
- internal Flag flags;
-
public MSymbol Key { get { return key; } }
public object Val { get { return val; } }
- public bool FrontSticky
- {
- get { return (flags & Flag.FrontSticky) != Flag.None; }
- }
- public bool RearSticky
- {
- get { return (flags & Flag.RearSticky) != Flag.None; }
- }
- public bool Sensitive
- {
- get { return (flags & Flag.Sensitive) != Flag.None; }
- }
public MTextProperty (MSymbol key, object val)
{
this.val = val;
}
- public MTextProperty (MSymbol key, object val,
- bool front_sticky, bool rear_sticky, bool sensitive)
- {
- this.key = key;
- this.val = val;
- if (front_sticky)
- flags |= Flag.FrontSticky;
- if (rear_sticky)
- flags |= Flag.RearSticky;
- if (sensitive)
- flags |= Flag.Sensitive;
- }
-
public override string ToString ()
{
return key.ToString () + ":" + val;
return mt;
}
+ public MText Dup (int from, int to)
+ {
+ if (check_range (from, to, true))
+ return new MText ();
+
+ MText mt = new MText (sb.ToString ().Substring (pos_to_idx (this, from),
+ pos_to_idx (this, to)));
+ foreach (MPlist p in intervals)
+ mt.intervals.Add (p.Key, ((MInterval) p.Val).Copy (mt, from, to));
+ return mt;
+ }
+
public MText Ins (int pos, int c)
{
insert (pos, c);
((MInterval) plist.Val).Delete (from, to);
else
intervals = new MPlist ();
- if (M17N.debug)
+ if (M17n.debug)
DumpPropNested ();
return this;
}
ID = count++;
}
+ private bool isRearSticky
+ {
+ get { return ((Key.TextPropertyFlags & MTextProperty.Flags.RearSticky)
+ != MTextProperty.Flags.None); }
+ }
+
+ private bool isFrontSticky
+ {
+ get { return ((Key.TextPropertyFlags & MTextProperty.Flags.FrontSticky)
+ != MTextProperty.Flags.None); }
+ }
+
+ private bool isSensitive
+ {
+ get { return ((Key.TextPropertyFlags & MTextProperty.Flags.Sensitive)
+ != MTextProperty.Flags.None); }
+ }
+
private void update_from_to ()
{
if (Parent == null)
copy = new MInterval (Key, null, end - start, Stack);
copy.mtext = mt;
- remove_properties (MTextProperty.Flag.Sensitive);
+
+ if (isSensitive)
+ {
+ if (isRearSticky && start < From && ! Left.Stack.IsEmpty)
+ Stack.Clear ();
+ else if (isFrontSticky && end > To && ! Right.Stack.IsEmpty)
+ Stack.Clear ();
+ }
if (left_copy != null)
{
copy.Left = left_copy;
{
MInterval interval = new MInterval (Key, mtext, To - pos, Stack);
- M17N.DebugPrint ("divide-right({0}) at ", pos); DumpOne (false, true);
+ M17n.DebugPrint ("divide-right({0}) at ", pos); DumpOne (false, true);
To = pos;
if (Right != null)
{
{
MInterval interval = new MInterval (Key, mtext, pos - From, Stack);
- M17N.DebugPrint ("divide-left({0}) at ", pos); DumpOne (false, true);
+ M17n.DebugPrint ("divide-left({0}) at ", pos); DumpOne (false, true);
From = pos;
if (Left != null)
{
return interval;
}
- private void remove_properties (MTextProperty.Flag flags)
+ private void remove_properties (MTextProperty.Flags flags)
{
- for (MPlist p = Stack; ! p.IsEmpty;)
- {
- MTextProperty prop = (MTextProperty) p.Val;
-
- if ((prop.flags & flags) == flags)
- p.Pop ();
- else
- p = p.Next;
- }
+ if (! Stack.IsEmpty
+ && (Key.TextPropertyFlags & flags) == flags)
+ Stack.Clear ();
}
private void inherit_front_properties (MPlist plist)
{
MTextProperty prop = (MTextProperty) p.Val;
- if ((prop.flags & MTextProperty.Flag.RearSticky)
- == MTextProperty.Flag.RearSticky)
+ if ((p.Key.TextPropertyFlags & MTextProperty.Flags.RearSticky)
+ == MTextProperty.Flags.RearSticky)
i.Stack.Add (prop.key, prop);
}
}
{
MTextProperty prop = (MTextProperty) p.Val;
- if ((prop.flags & MTextProperty.Flag.FrontSticky)
- == MTextProperty.Flag.FrontSticky)
+ if ((p.Key.TextPropertyFlags & MTextProperty.Flags.FrontSticky)
+ == MTextProperty.Flags.FrontSticky)
i.Stack.Add (prop.key, prop);
}
}
return interval;
Length += len;
To += len;
- M17N.DebugPrint ("grafted {0} in ", len); DumpOne (false, true);
+ M17n.DebugPrint ("grafted {0} in ", len); DumpOne (false, true);
for (MInterval prev = this, ii = this.Parent; ii != null;
prev = ii, ii = ii.Parent)
{
public void Insert (int pos, MInterval interval)
{
update_from_to ();
- M17N.DebugPrint ("insert({0}) at {1} in ", interval.Length, pos);
+ M17n.DebugPrint ("insert({0}) at {1} in ", interval.Length, pos);
DumpOne (false, false);
interval.set_mtext (mtext);
return;
}
prev.remove_properties
- (MTextProperty.Flag.Sensitive|MTextProperty.Flag.RearSticky);
+ (MTextProperty.Flags.Sensitive|MTextProperty.Flags.RearSticky);
interval.inherit_front_properties (prev.Stack);
}
remove_properties
- (MTextProperty.Flag.Sensitive|MTextProperty.Flag.FrontSticky);
+ (MTextProperty.Flags.Sensitive|MTextProperty.Flags.FrontSticky);
interval.inherit_rear_properties (Stack);
int len;
}
else if (pos < To)
{
- remove_properties (MTextProperty.Flag.Sensitive);
+ remove_properties (MTextProperty.Flags.Sensitive);
int len;
interval = graft (interval, true, out len);
return;
}
next.remove_properties
- (MTextProperty.Flag.Sensitive|MTextProperty.Flag.FrontSticky);
+ (MTextProperty.Flags.Sensitive|MTextProperty.Flags.FrontSticky);
interval.inherit_rear_properties (next.Stack);
}
remove_properties
- (MTextProperty.Flag.Sensitive|MTextProperty.Flag.RearSticky);
+ (MTextProperty.Flags.Sensitive|MTextProperty.Flags.RearSticky);
interval.inherit_front_properties (Stack);
int len;
}
else // (pos > To)
Next.Insert (pos, interval);
- M17N.DebugPrint (" done\n");
+ M17n.DebugPrint (" done\n");
}
private void vacate_node (MInterval interval)
private void vacate_node (MInterval interval, MInterval stop)
{
if (interval != null)
- M17N.DebugPrint ("vacate #{0} to #{1}\n", ID, interval.ID);
+ M17n.DebugPrint ("vacate #{0} to #{1}\n", ID, interval.ID);
else
- M17N.DebugPrint ("vacate #{0} to null\n", ID);
+ M17n.DebugPrint ("vacate #{0} to null\n", ID);
if (interval != null)
interval.Parent = Parent;
if (Parent == null)
public void Delete (int start, int end)
{
update_from_to ();
- M17N.DebugPrint ("delete({0} {1}) from ", start, end); DumpOne (false, true);
+ M17n.DebugPrint ("delete({0} {1}) from ", start, end); DumpOne (false, true);
if (start < From)
{
if (end <= From)
public void Push (int start, int end, MTextProperty prop)
{
update_from_to ();
- M17N.DebugPrint ("push({0} {1}) at ", start, end); DumpOne (false, true);
+ M17n.DebugPrint ("push({0} {1}) at ", start, end); DumpOne (false, true);
if (start < From)
{
if (end <= From)
private static void merge_nodes (MInterval head, MInterval tail)
{
- M17N.DebugPrint ("merging "); head.DumpOne (true, false);
- M17N.DebugPrint (" through "); tail.DumpOne (true, false);
+ M17n.DebugPrint ("merging "); head.DumpOne (true, false);
+ M17n.DebugPrint (" through "); tail.DumpOne (true, false);
int from = head.From;
int to = tail.To;
for (root = head; root.To + root.RightLength < to;
root = root.Parent);
- M17N.DebugPrint (" common root is "); root.DumpOne (false, true);
+ M17n.DebugPrint (" common root is "); root.DumpOne (false, true);
if (from < root.From)
{
while (true)
{
- M17N.DebugPrint ("merging "); prev.DumpOne (false, true);
+ M17n.DebugPrint ("merging "); prev.DumpOne (false, true);
prev.vacate_node (prev.Left, root);
if (prev == head)
break;
while (true)
{
- M17N.DebugPrint ("merging "); next.DumpOne (false, true);
+ M17n.DebugPrint ("merging "); next.DumpOne (false, true);
next.vacate_node (next.Right, root);
if (next == tail)
break;
public void Pop (int start, int end)
{
update_from_to ();
- M17N.DebugPrint ("pop({0} {1}) at ", start, end); DumpOne (false, true);
+ M17n.DebugPrint ("pop({0} {1}) at ", start, end); DumpOne (false, true);
if (start < From)
{
if (end <= From)
private void DumpOne (bool with_prop, bool newline, bool force)
{
- if (force || M17N.debug)
+ if (force || M17n.debug)
{
Console.Write ("#{0}({1} {2} {3}", ID, Length, From, To);
if (with_prop)
public void Dump (bool force)
{
- if (force || M17N.debug)
+ if (force || M17n.debug)
{
update_from_to ();
public void DumpNested (string indent, bool force)
{
- if (force || M17N.debug)
+ if (force || M17n.debug)
{
int indent_type = (Parent == null ? 1
: Parent.Left == this ? 0 : 2);
Console.WriteLine (p.Key + ":" + p.Val);
Console.WriteLine (plist.Clone ());
- M17N.M17N.debug = true;
+ M17n.debug = true;
using (FileStream stream = File.OpenRead ("temp.plist"))
{
MSymbol sym2 = new MSymbol ("symbol");
MSymbol sym3 = new MSymbol ("another sym:bol");
- Console.WriteLine ("version {0}-{1}-{2}", M17N.M17N.MajorVersion,
- M17N.M17N.MinorVersion, M17N.M17N.ReleaseNumber);
+ Console.WriteLine ("version {0}-{1}-{2}", M17n.MajorVersion,
+ M17n.MinorVersion, M17n.ReleaseNumber);
Console.WriteLine ("sym1 = {0}", sym1);
Console.WriteLine ("sym2 = {0}", sym2);
Console.WriteLine (sym1.Get (sym2) + "," + sym1.Get (sym3));
Console.WriteLine (sym2.Get (sym2) + "," + sym2.Get (sym3));
Console.WriteLine (sym3.Get (sym2));
+
+ MSymbol sym4;
+ try {
+ sym4 = new MSymbol ("symbol", MTextProperty.Flags.Sensitive);
+ } catch {
+ Console.WriteLine ("MTextProperty.Flags mismatch");
+ }
+ sym4 = new MSymbol ("sensitive", MTextProperty.Flags.Sensitive);
}
}
using System;
using System.Collections.Generic;
+using M17N;
using M17N.Core;
public class Test
{
mt.DumpPropNested ();
Dump ();
- M17N.M17N.debug = true;
+ M17n.debug = true;
}
int from = r.Next (LENGTH);