Exemplo n.º 1
0
        private IGeneratable ParseSymbol(XmlElement symbol)
        {
            string       type   = symbol.GetAttribute("type");
            string       cname  = symbol.GetAttribute("cname");
            string       name   = symbol.GetAttribute("name");
            IGeneratable result = null;

            if (type == "simple")
            {
                if (symbol.HasAttribute("default_value"))
                {
                    result = new SimpleGen(cname, name, symbol.GetAttribute("default_value"));
                }
                else
                {
                    Console.WriteLine("Simple type element " + cname + " has no specified default value");
                    result = new SimpleGen(cname, name, String.Empty);
                }
            }
            else if (type == "manual")
            {
                result = new ManualGen(cname, name);
            }
            else if (type == "ownable")
            {
                result = new OwnableGen(cname, name);
            }
            else if (type == "alias")
            {
                result = new AliasGen(cname, name);
            }
            else if (type == "marshal")
            {
                string mtype = symbol.GetAttribute("marshal_type");
                string call  = symbol.GetAttribute("call_fmt");
                string from  = symbol.GetAttribute("from_fmt");
                result = new MarshalGen(cname, name, mtype, call, from);
            }
            else if (type == "struct")
            {
                result = new ByRefGen(symbol.GetAttribute("cname"), symbol.GetAttribute("name"));
            }
            else
            {
                Console.WriteLine("Parser::ParseSymbol - Unexpected symbol type " + type);
            }

            return(result);
        }
Exemplo n.º 2
0
        private IGeneratable ParseSymbol(XmlElement symbol)
        {
            string type = symbol.GetAttribute ("type");
            string cname = symbol.GetAttribute ("cname");
            string name = symbol.GetAttribute ("name");
            IGeneratable result = null;

            if (type == "simple") {
                if (symbol.HasAttribute ("default_value"))
                    result = new SimpleGen (cname, name, symbol.GetAttribute ("default_value"));
                else {
                    Console.WriteLine ("Simple type element " + cname + " has no specified default value");
                    result = new SimpleGen (cname, name, String.Empty);
                }
            } else if (type == "manual")
                result = new ManualGen (cname, name);
            else if (type == "ownable")
                result = new OwnableGen (cname, name);
            else if (type == "alias")
                result = new AliasGen (cname, name);
            else if (type == "marshal") {
                string mtype = symbol.GetAttribute ("marshal_type");
                string call = symbol.GetAttribute ("call_fmt");
                string from = symbol.GetAttribute ("from_fmt");
                result = new MarshalGen (cname, name, mtype, call, from);
            } else if (type == "struct") {
                result = new ByRefGen (symbol.GetAttribute ("cname"), symbol.GetAttribute ("name"));
            } else
                Console.WriteLine ("Parser::ParseSymbol - Unexpected symbol type " + type);

            return result;
        }