예제 #1
0
 public bool CloseNow(string path)
 {
     lock (times){
         if (!times.ContainsKey(path))
         {
             return(false);
         }
         times.Remove(path);
     }
     cache.Close(path);
     return(true);
 }
예제 #2
0
 private static void EasyParse_addfactor(ref Rational r, Gen::Dictionary <string, int> dic, string w, char mode)
 {
     try{
         long val = long.Parse(w);
         if (mode == '/')
         {
             r /= val;
         }
         else
         {
             r *= val;
         }
     }catch {
         int exp = mode == '/'?-1:1;
         if (!dic.ContainsKey(w))
         {
             dic[w] = exp;
         }
         else
         {
             if ((dic[w] += exp) == 0)
             {
                 dic.Remove(w);
             }
         }
     }
 }
예제 #3
0
파일: Window.cs 프로젝트: akinomyoga/mwg
        /// <summary>
        /// 実際の COM のインスタンスから Window クラスを生成します。
        /// </summary>
        /// <param name="obj">COM の HTMLWindow インスタンスを指定します。</param>
        /// <returns>引数に渡した obj に対応して作成した Window インスタンスを作成します。</returns>
        internal static Window FromObj(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            Window ret;

            if (!instances.TryGetValue(obj, out ret))
            {
                ret           = new Window(obj);
                ret.onunload += delegate(){ instances.Remove(obj); };
                instances.Add(obj, ret);
            }
            return(ret);
        }
예제 #4
0
        private void process(string text)
        {
            CppWordReader wr_orig = this.wr;

            this.wr = new CppWordReader(text);
            while (wr.ReadNext())
            {
                switch (wr.CurrentType.value)
                {
                case WordType.vKeyWord:
                    // @ マクロ
                    break;

                case WordType.vTag:
                    // # マクロ
                    // #line
                {
                    Rgx.Capture c = Rgx.Match(@"#:bline:b((?<line>\d+):b)?(?<filename>:"")", wr.CurrentWord);
                    if (c != null)
                    {
                        filename = c.Groups["filename"].Last.Value;
                        if (c.Groups["line"].Count > 0)
                        {
                            int line;
                            if (int.TryParse(c.Groups["line"].Last.Value, out line))
                            {
                                wr.LineNumber = line - 1;
                            }
                        }
                        buf.AppendFormat("#line {0} {1}", wr.LineNumber + 1, filename);
                        break;
                    }
                }
                    // #pragma begin(define)
                    {
                        Rgx.Capture c = DefineMacro.REG_DECL.Match(wr.CurrentWord);
                        if (c != null)
                        {
                            DefineMacro macro = this.ReadDefineMacro(c);
                            if (!macros.ContainsKey(macro.Name))
                            {
                                macros.Add(macro.Name, macro);
                                break;
                            }
                            else
                            {
                                buf.AppendLine();
                                buf.AppendLine("#error マクロ " + macro.Name + " は既に定義されています");
                                buf.AppendFormat("#line {0} {1}", wr.LineNumber + 1, filename);
                            }
                        }
                    }
                    // #pragma undef
                    {
                        Rgx.Capture c = DefineMacro.REG_UNDEF.Match(wr.CurrentWord);
                        if (c != null)
                        {
                            string name = c.Groups["name"].Last.Value;
                            if (macros.Remove(name))
                            {
                                break;
                            }
                            buf.AppendLine("#error " + name + " は定義されていないマクロです");
                            buf.AppendFormat("#line {0} {1}\r\n", wr.LineNumber + 1, filename);
                        }
                    }
                    goto default;

                case WordType.vIdentifier:
                    if (!macros.ContainsKey(wr.CurrentWord))
                    {
                        goto default;
                    }
                    this.ReadMacroRef(wr.CurrentWord);
                    break;

                case WordType.vComment:
                default:
                    buf.Append(wr.CurrentWord);
                    break;
                }
            }
            this.wr = wr_orig;
        }
예제 #5
0
 public bool ClearList(string path)
 {
     lock (sync_root) return(diclist.Remove(path));
 }
예제 #6
0
 public bool ClearFile(string path)
 {
     lock (sync_root) return(dicattr.Remove(path));
 }
예제 #7
0
 public bool ClearList(string path)
 {
     return(diclist.Remove(path));
 }
예제 #8
0
 public void ClearFile(string path)
 {
     lock (sync_root) dicattr.Remove(path);
 }
예제 #9
0
 public override void Close(string name)
 {
     dic_cache.Remove(name);
     base.Close(name);
 }