public static void Main()
    {
        // find project directory
        var path = Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath);

        while (Path.GetFileName(path) != "linux" && Path.GetFileName(path) != "CfxGenerator")
        {
            path = Path.GetDirectoryName(path);
        }

        path = Path.GetDirectoryName(path);

        //GeneratedFileManager.PatchFilesLicense(path);
        //Environment.Exit(0);

        Environment.CurrentDirectory = path;

        var parser = new ApiTypeBuilder();
        var decls  = parser.GetDeclarations();

        var gen = new WrapperGenerator(decls);

        gen.Run();

        if (!DocumentationFormatBugStillExists)
        {
            //remove workaroung for this bug in CSharp.PrepareSummaryLine
            System.Diagnostics.Debugger.Break();
        }
    }
 public Argument(Parser.ArgumentData ad, ApiTypeBuilder api, int index)
 {
     this.ArgumentType   = api.GetApiType(ad.ArgumentType, ad.IsConst);
     this.VarName        = ad.Var;
     this.Index          = index;
     this.IsConst        = ad.IsConst;
     this.IsThisArgument = this.VarName.Equals("self");
 }
 public Parameter(Parser.ParameterNode ad, ApiTypeBuilder api, int index)
 {
     this.ParameterType  = api.GetApiType(ad.ParameterType, ad.IsConst);
     this.VarName        = ad.Var;
     this.Index          = index;
     this.IsConst        = ad.IsConst;
     this.IsThisArgument = this.VarName.Equals("self");
 }
 public CefExportFunction(CefType parent, Parser.FunctionNode fd, ApiTypeBuilder api, CefPlatform platform)
 {
     this.Name           = fd.Name;
     this.Comments       = fd.Comments;
     this.Signature      = Signature.Create(SignatureType.LibraryCall, CefName, CefConfig, CallMode, fd.Signature, api);
     this.PrivateWrapper = GeneratorConfig.HasPrivateWrapper(this.Name);
     this.Parent         = parent;
     this.Platform       = platform;
 }
示例#5
0
    protected void GetCallbackFunctions(Parser.CallbackStructNode sd, ApiTypeBuilder api)
    {
        var cblist = new List <CefCallbackFunction>();

        foreach (var sm in sd.CefCallbacks)
        {
            cblist.Add(new CefCallbackFunction(CefStruct, Category, sm.Name, sm.CefConfig, sm.Signature, api, sm.Comments));
        }
        CallbackFunctions = cblist.ToArray();
    }
 public static void CreateAll(ApiTypeBuilder b)
 {
     b.AddType(new SizeType());
     b.AddType(new SizeTypeOut());
     foreach (var spec in typeSpecs)
     {
         var names = spec.Split('|');
         var t     = new NumericType(names[0], names[1]);
         b.AddType(t);
         b.AddType(new NumericOutType(t));
     }
 }
示例#7
0
    protected void GetCallbackFunctions(Parser.StructData sd, ApiTypeBuilder api)
    {
        var cblist = new List <CefCallbackFunction>();

        for (int i = 1; i < sd.StructMembers.Count; ++i)
        {
            var sm = sd.StructMembers[i];
            Debug.Assert(sm.CallbackSignature != null);
            cblist.Add(new CefCallbackFunction(CefStruct, Category, sm.Name, sm.CefConfig, sm.CallbackSignature, api, sm.Comments));
        }
        CallbackFunctions = cblist.ToArray();
    }
示例#8
0
    protected Signature(SignatureType type, Parser.SignatureData sd, ApiTypeBuilder api)
    {
        Type = type;
        var args  = new List <Argument>();
        var index = 0;

        foreach (var arg in sd.Arguments)
        {
            args.Add(new Argument(arg, api, index));
            index += 1;
        }

        this.Arguments = args.ToArray();

        this.ReturnType         = api.GetApiType(sd.ReturnType, false);
        this.ReturnValueIsConst = sd.ReturnValueIsConst;
    }
示例#9
0
    protected Signature(SignatureType type, Parser.SignatureNode sd, ApiTypeBuilder api)
    {
        Type = type;
        var args  = new List <Parameter>();
        var index = 0;

        foreach (var arg in sd.Parameters)
        {
            args.Add(new Parameter(arg, api, index));
            index += 1;
        }

        this.Parameters = args.ToArray();

        this.ReturnType         = api.GetApiType(sd.ReturnType, false);
        this.ReturnValueIsConst = sd.ReturnValueIsConst;
    }
    public CfxValueClass(CefStructType cefStruct, Parser.ValueStructNode sd, ApiTypeBuilder api)
        : base(cefStruct, sd.Comments)
    {
        var smlist = new List <StructMember>();

        foreach (var smd in sd.StructMembers)
        {
            smlist.Add(new StructMember(cefStruct, Category, smd, api));
        }
        var sm0 = smlist[0];

        if (sm0.Name == "size" && sm0.MemberType.OriginalSymbol == "size_t")
        {
            smlist.RemoveAt(0);
            hasSizeMember = true;
        }
        StructMembers = smlist.ToArray();
    }
示例#11
0
    public CfxLibraryClass(CefStructType cefStruct, Parser.StructData sd, ApiTypeBuilder api)
        : base(cefStruct, sd, api)
    {
        var flist = new List <CefExportFunction>();

        foreach (var fd in sd.CefFunctions)
        {
            flist.Add(new CefExportFunction(cefStruct, fd, api));
        }
        ExportFunctions = flist.ToArray();

        GetCallbackFunctions(sd, api);

        foreach (var cb in CallbackFunctions)
        {
            var isBoolean = false;
            if (cb.IsPropertyGetter(ref isBoolean))
            {
                CefCallbackFunction setter = null;
                foreach (var cb2 in CallbackFunctions)
                {
                    if (cb2.IsPropertySetterFor(cb))
                    {
                        setter = cb2;
                        setter.Signature.ManagedArguments[1].IsPropertySetterArgument = true;
                        break;
                    }
                }
                var prop = new StructProperty(cb, setter, isBoolean);
                m_structProperties.Add(prop);
            }
        }
        foreach (var sm in CallbackFunctions)
        {
            if (!sm.IsProperty)
            {
                m_structFunctions.Add(sm);
            }
        }

        NeedsWrapFunction = true;
    }
示例#12
0
    public static CfxClass Create(CefStructType cefStruct, Parser.StructData sd, ApiTypeBuilder api)
    {
        if (sd.CefConfig != null)
        {
            switch (sd.CefConfig.Source)
            {
            case "client":
                return(new CfxClientClass(cefStruct, sd, api));

            case "library":
                return(new CfxLibraryClass(cefStruct, sd, api));

            default:
                Debug.Assert(false);
                throw new Exception();
            }
        }
        else
        {
            Debug.Assert(sd.StructMembers.Count == 1 || sd.StructMembers[1].CallbackSignature == null);
            return(new CfxValueClass(cefStruct, sd, api));
        }
    }
示例#13
0
    protected CfxClass(CefStructType cefStruct, Parser.StructData sd, ApiTypeBuilder api)
    {
        CefStruct       = cefStruct;
        OriginalSymbol  = cefStruct.OriginalSymbol;
        CfxNativeSymbol = cefStruct.CfxNativeSymbol;
        CfxName         = cefStruct.CfxName;
        ClassName       = cefStruct.ClassName;
        ApiClassName    = ClassName.Substring(3);
        RemoteClassName = cefStruct.RemoteClassName;
        Comments        = sd.Comments;

        if (sd.CefConfig != null)
        {
            switch (sd.CefConfig.Source)
            {
            case "client":
                Category = StructCategory.ApiCallbacks;
                break;

            case "library":
                Category = StructCategory.ApiCalls;
                break;

            default:
                Debug.Assert(false);
                break;
            }
        }
        else
        {
            Debug.Assert(sd.StructMembers.Count == 1 || sd.StructMembers[1].CallbackSignature == null);
            Category = StructCategory.Values;
        }

        Debug.Assert(sd.CefFunctions.Count == 0 || Category == StructCategory.ApiCalls);
    }
    protected Signature(SignatureType type, ISignatureOwner owner, Parser.SignatureData sd, ApiTypeBuilder api)
    {
        Type  = type;
        Owner = owner;
        var args  = new List <Argument>();
        var index = 0;

        foreach (var arg in sd.Arguments)
        {
            args.Add(new Argument(arg, api, index));
            index += 1;
        }

        this.Arguments = args.ToArray();

        this.ReturnType         = api.GetApiType(sd.ReturnType, false);
        this.ReturnValueIsConst = sd.ReturnValueIsConst;
        var comments = owner.Comments;

        DebugPrintUnhandledArrayArguments();
    }
示例#15
0
 public CfxClientClass(CefStructType cefStruct, Parser.CallbackStructNode s, ApiTypeBuilder api)
     : base(cefStruct, s.Comments)
 {
     GetCallbackFunctions(s, api);
 }
示例#16
0
    public static CfxClass Create(CefStructType cefStruct, Parser.CallbackStructNode s, ApiTypeBuilder api)
    {
        switch (cefStruct.Category)
        {
        case StructCategory.Client:
            return(new CfxClientClass(cefStruct, s, api));

        case StructCategory.Library:
            return(new CfxLibraryClass(cefStruct, s, api));

        default:
            Debug.Assert(false);
            throw new Exception();
        }
    }
    public static Signature Create(SignatureType type, ISignatureOwner owner, Parser.SignatureData sd, ApiTypeBuilder api)
    {
        var s = CustomSignatures.ForFunction(type, owner, sd, api);

        if (s == null)
        {
            return(new Signature(type, owner, sd, api));
        }
        else
        {
            return(s);
        }
    }
示例#18
0
 public void SetMembers(Parser.StructData sd, ApiTypeBuilder api)
 {
     m_classBuilder = new CfxClassBuilder(this, sd, api);
 }
示例#19
0
    public static Signature Create(SignatureType type, string cefName, CefConfigData cefConfig, CfxCallMode callMode, Parser.SignatureData sd, ApiTypeBuilder api)
    {
        var s  = new Signature(type, sd, api);
        var cs = CustomSignatures.ForFunction(s, cefName, cefConfig);

        if (cs == null)
        {
            s.DebugPrintUnhandledArrayArguments(cefName, cefConfig, callMode);
            AllSignatures.Add(s);
            return(s);
        }
        else
        {
            cs.DebugPrintUnhandledArrayArguments(cefName, cefConfig, callMode);
            AllSignatures.Add(cs);
            return(cs);
        }
    }
示例#20
0
    public StructMember(CefStructType parent, StructCategory structCategory, Parser.StructMemberData smd, ApiTypeBuilder api)
    {
        Debug.Assert(structCategory == StructCategory.Values);
        Debug.Assert(smd.MemberType != null);

        Name      = smd.Name;
        Comments  = smd.Comments;
        cefConfig = smd.CefConfig;

        MemberType = api.GetApiType(smd.MemberType, false);
        if (MemberType.Name == "int" && Comments != null)
        {
            foreach (var c in Comments.Lines)
            {
                if (c.Contains("true") || c.Contains("false"))
                {
                    MemberType = BooleanInteger.Convert(MemberType);
                }
            }
        }
    }
示例#21
0
    public CefV8HandlerExecuteSignature(ISignatureOwner owner, Parser.SignatureData sd, ApiTypeBuilder api)
        : base(SignatureType.ClientCallback, owner, sd, api, 4, 3)
    {
        Arguments[6]             = new Argument(Arguments[6], new CefStringOutType());
        base.ManagedArguments[5] = new Argument(base.ManagedArguments[5], new CefStringOutType());
        var list = new List <Argument>();

        foreach (var arg in base.ManagedArguments)
        {
            if (arg.VarName != "retval")
            {
                list.Add(arg);
            }
        }
        m_publicArguments = list.ToArray();
    }
示例#22
0
 public static CfxClass Create(CefStructType cefStruct, Parser.ValueStructNode s, ApiTypeBuilder api)
 {
     return(new CfxValueClass(cefStruct, s, api));
 }
 public CefExportFunction(CefType parent, Parser.FunctionNode fd, ApiTypeBuilder api)
     : this(parent, fd, api, CefPlatform.Independent)
 {
 }
示例#24
0
    public CefCallbackType(CefStructType parent, StructCategory category, string name, CefConfigData cefConfig, Parser.SignatureData sd, ApiTypeBuilder api, CommentData comments)
        : base(name)
    {
        this.Parent   = parent;
        this.Comments = comments;
        if (cefConfig == null)
        {
            CefConfig = new CefConfigData();
        }
        else
        {
            CefConfig = cefConfig;
        }

        if (category == StructCategory.ApiCallbacks)
        {
            m_callMode     = CfxCallMode.Callback;
            this.Signature = Signature.Create(SignatureType.ClientCallback, this, sd, api);
        }
        else
        {
            m_callMode     = CfxCallMode.FunctionCall;
            this.Signature = Signature.Create(SignatureType.LibraryCall, this, sd, api);
        }
    }
示例#25
0
 public void SetMembers(Parser.ValueStructNode s, ApiTypeBuilder api)
 {
     m_classBuilder = CfxClass.Create(this, s, api);
 }
示例#26
0
 public GetFrameIdentifiersSignature(ISignatureOwner parent, Parser.SignatureData sd, ApiTypeBuilder api)
     : base(SignatureType.LibraryCall, parent, sd, api)
 {
 }
示例#27
0
    public CefCallbackFunction(CefStructType parent, StructCategory category, string name, CefConfigNode cefConfig, Parser.SignatureNode sd, ApiTypeBuilder api, CommentNode comments)
    {
        Name          = name;
        this.Parent   = parent;
        this.Comments = comments;
        if (cefConfig == null)
        {
            CefConfig = new CefConfigNode();
        }
        else
        {
            CefConfig = cefConfig;
        }

        if (category == StructCategory.Client)
        {
            m_callMode     = CfxCallMode.Callback;
            this.Signature = Signature.Create(SignatureType.ClientCallback, CefName, CefConfig, CallMode, sd, api);
        }
        else
        {
            m_callMode     = CfxCallMode.FunctionCall;
            this.Signature = Signature.Create(SignatureType.LibraryCall, CefName, CefConfig, CallMode, sd, api);
        }
    }
 public StringCollectionAsRetvalSignature(ISignatureOwner parent, Parser.SignatureData sd, ApiTypeBuilder api)
     : base(SignatureType.LibraryCall, parent, sd, api)
 {
 }
 public GetPageRangesSignature(ISignatureOwner parent, Parser.SignatureData sd, ApiTypeBuilder api, int arrayIndex, int countIndex)
     : base(SignatureType.LibraryCall, parent, sd, api, arrayIndex, countIndex)
 {
 }
示例#30
0
 public StructArrayGetterSignature(ISignatureOwner owner, Parser.SignatureData sd, ApiTypeBuilder api)
     : base(SignatureType.LibraryCall, owner, sd, api)
 {
 }