Exemple #1
0
        void addMethod(String type)
        {
            Function func;// = new Function(type, reader_, this);

            switch(type)
            {
            case "Constructor":		func = new Constructor(type, reader_, this); break;
            case "Destructor":		func = new Destructor(type, reader_, this); break;
            default:				func = new Function(type, reader_, this); break;
            }

            Context con = contextMap_[func.ContextId];
            con.Functions.Add(func);
            lastFunction_ = func;
        }
Exemple #2
0
        public void validate(CompileObject obj, bool export, bool import, bool getter, bool setter, bool nodtor)
        {
            if(_export && !export)
            {
                Console.WriteLine (obj.DebugTag + " : cannot be exported");
                Environment.Exit(-1);
            }

            if(_import && !import)
            {
                Console.WriteLine (obj.DebugTag + " : cannot be imported");
                Environment.Exit(-1);
            }

            if(_nodtor && !nodtor)
            {
                Console.WriteLine (obj.DebugTag + " : only functions can be tagged with __nodtor");
                Environment.Exit(-1);
            }

            if((getter == false) & (_get != null))
            {
                Console.WriteLine (obj.DebugTag + " : cannot generate a get property");
                Environment.Exit(-1);
            }

            if((setter == false) & (_set != null))
            {
                Console.WriteLine (obj.DebugTag + " : cannot generate a set property");
                Environment.Exit(-1);
            }
        }
Exemple #3
0
        public void process()
        {
            _types.Add (new UnknownType ());
            while(reader_.Read())
            {
                if(reader_.NodeType == XmlNodeType.Element)
                {
                    switch(reader_.Name)
                    {
                    case "Namespace":			addContext(reader_.Name); break;
                    case "Class":				addContext(reader_.Name); break;
                    case "Struct":				addContext(reader_.Name); break;
                    case "Union":				addContext(reader_.Name); break;

                    case "Constructor":			addMethod(reader_.Name); break;
                    case "Destructor":			addMethod(reader_.Name); break;
                    case "Method":				addMethod(reader_.Name); break;
                    case "OperatorFunction":	addMethod(reader_.Name); break;
                    case "OperatorMethod":		addMethod(reader_.Name); break;
                    case "Function":			addMethod(reader_.Name); break;

                    case "Argument":			addArguement(); break;

                    case "Field":				Field f = new Field(reader_, this); ContextMap[f.ContextId].Fields.Add(f); break;

                    case "Unimplemented":		_types.Add(new Unimplemented(reader_)); break;
                    case "Typedef":				_types.Add (new Typedef(reader_)); break;
                    case "FundamentalType":		_types.Add (new FundamentalType(reader_)); break;
                    case "PointerType": 		_types.Add (new PointerType(reader_)); break;
                    case "ReferenceType": 		_types.Add (new ReferenceType(reader_)); break;
                    case "CvQualifiedType":		_types.Add (new CvQualifiedType(reader_)); break;
                    case "FunctionType":
                    {
                        FunctionType ftype = new FunctionType(reader_);
                        _types.Add (ftype);
                        lastFunction_ = ftype;
                        break;
                    }

                    case "File":
                    {
                        FileMap.Add(reader_["id"], reader_["name"]);
                        FileInfo info = new FileInfo(reader_, OutDir);
                        Files.Add(info.Id, info);
                        break;
                    }

                    case "EnumValue":			_lastEnum.addValue(new Enumeration.Value(reader_)); break;
                    case "Enumeration":			addEnumeration(); break;

            //					default:	Console.WriteLine ("could not parse \"" + reader_.Name + "\""); break;
                    }
                }
            } // while
            postProcess();
        }