Пример #1
0
        public override DelegateCollection ReadDelegates(StreamReader specFile)
        {
            DelegateCollection delegates = new DelegateCollection();
            XPathDocument      specs     = new XPathDocument(specFile);
            XPathDocument      overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));

            foreach (XPathNavigator nav in new XPathNavigator[] {
                specs.CreateNavigator().SelectSingleNode("/signatures"),
                overrides.CreateNavigator().SelectSingleNode("/overrides/add")
            })
            {
                if (nav != null)
                {
                    foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
                    {
                        Delegate d = new Delegate();
                        d.Name = node.GetAttribute("name", String.Empty);
                        //d.Extension = node.GetAttribute("extension");
                        d.Version  = node.GetAttribute("version", String.Empty);
                        d.Category = node.GetAttribute("category", String.Empty);
                        foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
                        {
                            switch (param.Name)
                            {
                            case "returns":
                                d.ReturnType.CurrentType = param.GetAttribute("type", String.Empty);
                                break;

                            case "param":
                                Parameter p = new Parameter();
                                p.CurrentType = param.GetAttribute("type", String.Empty);
                                p.Name        = param.GetAttribute("name", String.Empty);

                                string element_count = param.GetAttribute("elementcount", String.Empty);
                                if (!String.IsNullOrEmpty(element_count))
                                {
                                    p.ElementCount = Int32.Parse(element_count);
                                }

                                p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty));

                                d.Parameters.Add(p);
                                break;
                            }
                        }
                        d.Translate(overrides);
                        delegates.Add(d);
                    }
                }
            }

            return(delegates);
        }
Пример #2
0
        public virtual DelegateCollection ReadDelegates(StreamReader specFile)
        {
            Console.WriteLine("Reading function specs.");

            DelegateCollection delegates = new DelegateCollection();

            XPathDocument function_overrides = new XPathDocument(Path.Combine(Settings.InputPath, functionOverridesFile));

            do
            {
                string line = NextValidLine(specFile);
                if (String.IsNullOrEmpty(line))
                    break;

                while (line.Contains("(") && !specFile.EndOfStream)
                {
                    // Get next OpenGL function

                    Delegate d = new Delegate();

                    // Get function name:
                    d.Name = line.Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)[0];

                    do
                    {
                        // Get function parameters and return value

                        line = specFile.ReadLine();
                        List<string> words = new List<string>(
                            line.Replace('\t', ' ').Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)
                        );

                        if (words.Count == 0)
                            break;

                        // Identify line:
                        switch (words[0])
                        {
                            case "return":  // Line denotes return value
                                d.ReturnType.CurrentType = words[1];
                                break;

                            case "param":   // Line denotes parameter
                                Parameter p = new Parameter();

                                p.Name = Utilities.Keywords.Contains(words[1]) ? "@" + words[1] : words[1];
                                p.CurrentType = words[2];
                                p.Pointer += words[4].Contains("array") ? 1 : 0;
                                p.Pointer += words[4].Contains("reference") ? 1 : 0;
                                if (p.Pointer != 0 && words.Count > 5 && words[5].Contains("[1]"))
                                    p.ElementCount = 1;
                                p.Flow = words[3] == "in" ? FlowDirection.In : FlowDirection.Out;

                                d.Parameters.Add(p);
                                break;

                            // GetTexParameterIivEXT and GetTexParameterIuivEXT define two(!) versions (why?)
                            case "version": // Line denotes function version (i.e. 1.0, 1.2, 1.5)
                                d.Version = words[1];
                                break;

                            case "category":
                                d.Category = words[1];
                                break;
                        }
                    }
                    while (!specFile.EndOfStream);

                    d.Translate(function_overrides);

                    delegates.Add(d);
                }
            }
            while (!specFile.EndOfStream);

            return delegates;
        }
Пример #3
0
        public virtual DelegateCollection ReadDelegates(StreamReader specFile)
        {
            Console.WriteLine("Reading function specs.");

            //List<Bind.Structures.Delegate> delegates = new List<Bind.Structures.Delegate>();
            DelegateCollection delegates = new DelegateCollection();

            do
            {
                string line = NextValidLine(specFile);
                if (String.IsNullOrEmpty(line))
                    break;

                while (line.Contains("(") && !specFile.EndOfStream)
                {
                    // Get next OpenGL function

                    Bind.Structures.Delegate d = new Bind.Structures.Delegate();

                    // Get function name:
                    d.Name = line.Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)[0];

                    //if (d.Name.Contains("QueryHyperpipeBestAttribSGIX"))
                    //{
                    //}

                    do
                    {
                        // Get function parameters and return value

                        line = specFile.ReadLine();
                        List<string> words = new List<string>(
                            line.Replace('\t', ' ').Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)
                        );

                        if (words.Count == 0)
                            break;

                        // Identify line:
                        switch (words[0])
                        {
                            case "return":  // Line denotes return value
                                d.ReturnType.CurrentType = words[1];
                                break;

                            case "param":   // Line denotes parameter
                                Parameter p = new Parameter();

                                p.Name = Utilities.Keywords.Contains(words[1]) ? "@" + words[1] : words[1];
                                p.CurrentType = words[2];
                                p.Pointer = words[4].Contains("array") ? true : words[4].Contains("reference") ? true : false;
                                p.Flow = words[3] == "in" ? Parameter.FlowDirection.In : Parameter.FlowDirection.Out;
 
                                d.Parameters.Add(p);
                                break;

                            // Version directive is not used. GetTexParameterIivEXT and GetTexParameterIuivEXT define two(!) versions (why?)
                            //case "version": // Line denotes function version (i.e. 1.0, 1.2, 1.5)
                            //    d.UserData.Add("version", words[1]);
                            //    break;

                            case "category":
                                d.Category = words[1];
                                break;
                        }
                    }
                    while (!specFile.EndOfStream);

                    d.Translate();

                    delegates.Add(d);
                }
            }
            while (!specFile.EndOfStream);

            return delegates;
        }
Пример #4
0
        public virtual DelegateCollection ReadDelegates(StreamReader specFile)
        {
            Console.WriteLine("Reading function specs.");

            DelegateCollection delegates = new DelegateCollection();

            XPathDocument function_overrides = new XPathDocument(Path.Combine(Settings.InputPath, functionOverridesFile));

            do
            {
                string line = NextValidLine(specFile);
                if (String.IsNullOrEmpty(line))
                {
                    break;
                }

                while (line.Contains("(") && !specFile.EndOfStream)
                {
                    // Get next OpenGL function

                    Delegate d = new Delegate();

                    // Get function name:
                    d.Name = line.Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)[0];

                    do
                    {
                        // Get function parameters and return value

                        line = specFile.ReadLine();
                        List <string> words = new List <string>(
                            line.Replace('\t', ' ').Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)
                            );

                        if (words.Count == 0)
                        {
                            break;
                        }

                        // Identify line:
                        switch (words[0])
                        {
                        case "return":      // Line denotes return value
                            d.ReturnType.CurrentType = words[1];
                            break;

                        case "param":       // Line denotes parameter
                            Parameter p = new Parameter();

                            p.Name        = Utilities.Keywords.Contains(words[1]) ? "@" + words[1] : words[1];
                            p.CurrentType = words[2];
                            p.Pointer    += words[4].Contains("array") ? 1 : 0;
                            p.Pointer    += words[4].Contains("reference") ? 1 : 0;
                            if (p.Pointer != 0 && words.Count > 5 && words[5].Contains("[1]"))
                            {
                                p.ElementCount = 1;
                            }
                            p.Flow = words[3] == "in" ? FlowDirection.In : FlowDirection.Out;

                            d.Parameters.Add(p);
                            break;

                        // GetTexParameterIivEXT and GetTexParameterIuivEXT define two(!) versions (why?)
                        case "version":     // Line denotes function version (i.e. 1.0, 1.2, 1.5)
                            d.Version = words[1];
                            break;

                        case "category":
                            d.Category = words[1];
                            break;
                        }
                    }while (!specFile.EndOfStream);

                    d.Translate(function_overrides);

                    delegates.Add(d);
                }
            }while (!specFile.EndOfStream);

            return(delegates);
        }
Пример #5
0
        public override DelegateCollection ReadDelegates(StreamReader specFile)
        {
            DelegateCollection delegates = new DelegateCollection();
            XPathDocument specs = new XPathDocument(specFile);
            XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));

            foreach (XPathNavigator nav in new XPathNavigator[] {
                specs.CreateNavigator().SelectSingleNode("/signatures"),
                overrides.CreateNavigator().SelectSingleNode("/overrides/add") })
            {
                if (nav != null)
                {
                    foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
                    {
                        Delegate d = new Delegate();
                        d.Name = node.GetAttribute("name", String.Empty);
                        //d.Extension = node.GetAttribute("extension");
                        d.Version = node.GetAttribute("version", String.Empty);
                        d.Category = node.GetAttribute("category", String.Empty);
                        foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
                        {
                            switch (param.Name)
                            {
                                case "returns":
                                    d.ReturnType.CurrentType = param.GetAttribute("type", String.Empty);
                                    break;

                                case "param":
                                    Parameter p = new Parameter();
                                    p.CurrentType = param.GetAttribute("type", String.Empty);
                                    p.Name = param.GetAttribute("name", String.Empty);

                                    string element_count = param.GetAttribute("elementcount", String.Empty);
                                    if (!String.IsNullOrEmpty(element_count))
                                        p.ElementCount = Int32.Parse(element_count);

                                    p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty));

                                    d.Parameters.Add(p);
                                    break;
                            }
                        }
                        d.Translate(overrides);
                        delegates.Add(d);
                    }
                }
            }

            return delegates;
        }
Пример #6
0
        public virtual DelegateCollection ReadDelegates(StreamReader specFile)
        {
            Console.WriteLine("Reading function specs.");

            //List<Bind.Structures.Delegate> delegates = new List<Bind.Structures.Delegate>();
            DelegateCollection delegates = new DelegateCollection();

            do
            {
                string line = NextValidLine(specFile);
                if (String.IsNullOrEmpty(line))
                {
                    break;
                }

                while (line.Contains("(") && !specFile.EndOfStream)
                {
                    // Get next OpenGL function

                    Bind.Structures.Delegate d = new Bind.Structures.Delegate();

                    // Get function name:
                    d.Name = line.Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)[0];

                    //if (d.Name.Contains("QueryHyperpipeBestAttribSGIX"))
                    //{
                    //}

                    do
                    {
                        // Get function parameters and return value

                        line = specFile.ReadLine();
                        List <string> words = new List <string>(
                            line.Replace('\t', ' ').Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)
                            );

                        if (words.Count == 0)
                        {
                            break;
                        }

                        // Identify line:
                        switch (words[0])
                        {
                        case "return":      // Line denotes return value
                            d.ReturnType.CurrentType = words[1];
                            break;

                        case "param":       // Line denotes parameter
                            Parameter p = new Parameter();

                            p.Name        = Utilities.Keywords.Contains(words[1]) ? "@" + words[1] : words[1];
                            p.CurrentType = words[2];
                            p.Pointer     = words[4].Contains("array") ? true : words[4].Contains("reference") ? true : false;
                            p.Flow        = words[3] == "in" ? Parameter.FlowDirection.In : Parameter.FlowDirection.Out;

                            d.Parameters.Add(p);
                            break;

                        // Version directive is not used. GetTexParameterIivEXT and GetTexParameterIuivEXT define two(!) versions (why?)
                        //case "version": // Line denotes function version (i.e. 1.0, 1.2, 1.5)
                        //    d.UserData.Add("version", words[1]);
                        //    break;

                        case "category":
                            d.Category = words[1];
                            break;
                        }
                    }while (!specFile.EndOfStream);

                    d.Translate();

                    delegates.Add(d);
                }
            }while (!specFile.EndOfStream);

            return(delegates);
        }