예제 #1
0
        private void insertPlatformData(List<ParsedClass> classes)
        {
            // Some platforms have weird data which we don't know the layout of but need to know the size
            // to properly resolve members.
            // This is hackery to handle it.

            if (CommandLine.args.target == CommandLineArgs.WINDOWS)
            {

            }
            else
            {
                ParsedClass pthread_cond_t = new ParsedClass("pthread_cond_t");
                pthread_cond_t.addData(new List<NamedCppType> { new NamedCppType("char m_placeholder[48];") });
                classes.Add(pthread_cond_t);

                ParsedClass pthread_mutex_t = new ParsedClass("pthread_mutex_t");
                pthread_mutex_t.addData(new List<NamedCppType> { new NamedCppType("char m_placeholder[24];") });
                classes.Add(pthread_mutex_t);
            }
        }
예제 #2
0
        private void addStructsToClasses(List<ParsedStruct> structs, List<ParsedClass> classes)
        {
            List<ParsedClass> classesToAdd = new List<ParsedClass>();

            foreach (ParsedStruct theStruct in structs)
            {
                ParsedClass matchingClass = null;

                foreach (ParsedClass theClass in classes)
                {
                    if (theClass.name == theStruct.name)
                    {
                        matchingClass = theClass;
                        break;
                    }
                }

                List<NamedCppType> data = theStruct.members.Select(member => member.data).ToList();

                if (matchingClass == null)
                {
                    ParsedClass newParsedClass = new ParsedClass(theStruct.name);
                    newParsedClass.addData(data);
                    newParsedClass.addAttributes(theStruct.attributes);
                    classesToAdd.Add(newParsedClass);
                }
                else
                {
                    matchingClass.addData(data);
                    matchingClass.addAttributes(theStruct.attributes);
                }
            }

            classes.AddRange(classesToAdd);
            classes = classes.OrderBy(theClass => theClass.name).ToList();

            foreach (ParsedStruct theStruct in structs)
            {
                ParsedClass matchingClass = null;

                foreach (ParsedClass theClass in classes)
                {
                    if (theClass.name == theStruct.name)
                    {
                        matchingClass = theClass;
                        break;
                    }
                }

                Debug.Assert(matchingClass != null);

                foreach (string inh in theStruct.inheritsFrom)
                {
                    ParsedClass inheritsFromClass = null;

                    foreach (ParsedClass theClass in classes)
                    {
                        if (theClass.name == inh)
                        {
                            inheritsFromClass = theClass;
                            break;
                        }
                    }

                    Debug.Assert(inheritsFromClass != null);

                    if (matchingClass != null)
                    {
                        matchingClass.inherits.Add(inheritsFromClass);
                    }
                }
            }
        }