示例#1
0
        private string FormatUpdateFunction(string objname, Declarations decls, IEnumerable <Rule> rules)
        {
            UpdateRule[] urules = (rules.Where(x => x is UpdateRule).Select(x => (UpdateRule)x).ToArray());
            if (urules == null || urules.Length == 0)
            {
                return(NULL);
            }

            string funcname        = String.Format("updatefunc_{0}", objname);
            ExpressionGenerator eg = new ExpressionGenerator(getUniqueName, decls, StateStructName);

            app("static void {0}()", funcname);
            app("{{");
            foreach (UpdateRule ur in urules)
            {
                app("    {0}", eg.generate(ur));
            }
            app("}};");
            return(funcname);
        }