- static int AddString (string s, int size)
- {
- if (!hash.ContainsKey (s)) {
- int ret;
- string_order.Add (s);
- ret = curpos;
- hash.Add (s, curpos);
- curpos += size + 1; // null terminator
- return ret;
+ // serialize the strings in Hashtable.
+ public string GetStrings ()
+ {
+ Console.WriteLine ("Total string data size: {0}", curpos);
+ if (curpos > UInt16.MaxValue)
+ throw new Exception ("need to increase idx size in culture-info.h");
+ StringBuilder ret = new StringBuilder ();
+ // the null entry
+ ret.Append ("\t\"\\0\"\n");
+ foreach (string s in string_order) {
+ ret.Append ("\t\"");
+ ret.Append (s);
+ ret.Append ("\\0\"\n");
+ }
+ return ret.ToString ();