Example #1
0
        public void Preprocess(Driver driver, ASTContext ctx)
        {
            driver.Context.TypeMaps.TypeMaps.Add("openblas_complex_float", new ComplexFloat());
            driver.Context.TypeMaps.TypeMaps.Add("openblas_complex_double", new ComplexDouble());
            // driver.Context.TypeMaps.TypeMaps.Add("lapack_complex_float", new ComplexFloat());
            // driver.Context.TypeMaps.TypeMaps.Add("lapack_complex_double", new ComplexDouble());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_ORDER", new CBLAS_LAYOUT());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_TRANSPOSE", new CBLAS_TRANSPOSE());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_UPLO", new CBLAS_UPLO());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_DIAG", new CBLAS_DIAG());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_SIDE", new CBLAS_SIDE());

            ctx.IgnoreFunctionWithPattern("^/(?!LAPACKE|openblas|cblas)([A-Za-z0-9_]+)$");
            ctx.IgnoreHeadersWithName("lapack.h");
            // ctx.IgnoreHeadersWithName("lapacke_config.h");
        }
Example #2
0
        public void Preprocess(Driver driver, ASTContext ctx)
        {
            driver.Context.TypeMaps.TypeMaps.Add("MKL_Complex8", new ComplexFloat());
            driver.Context.TypeMaps.TypeMaps.Add("MKL_Complex16", new ComplexDouble());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_LAYOUT", new CBLAS_LAYOUT());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_TRANSPOSE", new CBLAS_TRANSPOSE());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_UPLO", new CBLAS_UPLO());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_DIAG", new CBLAS_DIAG());
            driver.Context.TypeMaps.TypeMaps.Add("CBLAS_SIDE", new CBLAS_SIDE());

            driver.Context.TypeMaps.TypeMaps.Add("MKL_LAYOUT", new CBLAS_LAYOUT());
            driver.Context.TypeMaps.TypeMaps.Add("MKL_TRANSPOSE", new CBLAS_TRANSPOSE());
            driver.Context.TypeMaps.TypeMaps.Add("MKL_UPLO", new CBLAS_UPLO());
            driver.Context.TypeMaps.TypeMaps.Add("MKL_DIAG", new CBLAS_DIAG());
            driver.Context.TypeMaps.TypeMaps.Add("MKL_SIDE", new CBLAS_SIDE());

            ctx.IgnoreFunctionWithPattern("^/(?!LAPACKE|mkl|cblas)([A-Za-z0-9_]+)$");
            ctx.IgnoreFunctionWithPattern("_batch$");
            ctx.IgnoreFunctionWithPattern("_pack$");
            ctx.IgnoreFunctionWithPattern("_compute$");
            ctx.IgnoreFunctionWithPattern("_alloc$");
            ctx.IgnoreFunctionWithPattern("_free$");
            ctx.IgnoreFunctionWithPattern("_pack_get_size$");
            ctx.IgnoreFunctionWithPattern("_pack_get_size$");
            ctx.IgnoreFunctionWithPattern("_jit_");
            ctx.IgnoreFunctionWithPattern("s16s16s32");
            ctx.IgnoreFunctionWithPattern("s8u8s32");

            ctx.IgnoreEnumWithMatchingItem("CBLAS_STORAGE");
            ctx.IgnoreEnumWithMatchingItem("CBLAS_IDENTIFIER");
            ctx.IgnoreEnumWithMatchingItem("CBLAS_OFFSET");
            ctx.IgnoreEnumWithMatchingItem("MklJitStatusT");
            ctx.IgnoreEnumWithMatchingItem("MKL_COMPACT_PACK");
        }
Example #3
0
        public void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.IgnoreHeadersWithName("API.h");
            ctx.IgnoreHeadersWithName("Concurrency.h");
            ctx.IgnoreHeadersWithName("ConcurrentQueue.h");
            ctx.IgnoreHeadersWithName("Delegate.h");
            ctx.IgnoreHeadersWithName("Event.h");
            ctx.IgnoreHeadersWithName("Handle.h");
            ctx.IgnoreHeadersWithName("Object.h");
            ctx.IgnoreHeadersWithName("Pointers.h");
            ctx.IgnoreHeadersWithName("References.h");
            ctx.IgnoreHeadersWithName("Reflection.h");
            ctx.IgnoreHeadersWithName("ReflectionHelpers.h");
            ctx.IgnoreHeadersWithName("Task.h");
            ctx.IgnoreHeadersWithName("Timer.h");
            ctx.IgnoreHeadersWithName("Swap.h");

            //Core
            ctx.IgnoreClassWithName("Object");
            ctx.IgnoreClassWithName("Class");
            ctx.IgnoreClassWithName("ReferenceCounted");
            ctx.IgnoreClassWithName("HandleManager");

            ctx.IgnoreClassWithName("Delegate0");
            ctx.IgnoreClassWithName("Delegate1");
            ctx.IgnoreClassWithName("Delegate2");

            ctx.IgnoreClassWithName("TaskPool");
            ctx.IgnoreClassWithName("ConcurrentQueue");

            ctx.SetClassAsValueType("StringHash");
            ctx.IgnoreClassWithName("RawStringCompare");

            ctx.SetClassAsValueType("LogEntry");
            ctx.IgnoreFunctionWithName("LogCreate");

            ctx.IgnoreFunctionWithName("AllocatorAllocate");
            ctx.IgnoreFunctionWithName("AllocatorDeallocate");
            ctx.SetNameOfFunction("AllocatorReset", "AllocatorResetMemory");

            ctx.IgnoreClassWithName("StreamFuncs");
            ctx.IgnoreClassWithName("FileStream");
            ctx.SetClassAsValueType("FileWatchEvent");

            ctx.IgnoreFunctionWithPattern(".+GetType");
            ctx.IgnoreFunctionWithName("ClassGetIdMap");

            ctx.IgnoreFunctionWithName("ReflectionSetHandleContext");
            ctx.IgnoreFunctionWithName("SerializerCreateJSON");
            ctx.IgnoreFunctionWithName("SerializerCreateBinary");
            ctx.IgnoreClassWithName("ReflectionContext");
            ctx.IgnoreClassWithName("ValueContext");

            ctx.SetClassAsValueType("ExtensionMetadata");

            ctx.IgnoreClassWithName("MemoryStream");
            ctx.IgnoreClassWithName("Serializer");
            ctx.IgnoreClassWithName("Thread");

            // Math
            ctx.SetClassAsValueType("ColorP");
            ctx.SetClassAsValueType("Color");
            ctx.SetClassAsValueType("Vector2P");
            ctx.SetClassAsValueType("Vector2");
            ctx.SetClassAsValueType("Vector2i");
            ctx.SetClassAsValueType("Vector3P");
            ctx.SetClassAsValueType("Vector3");
            ctx.SetClassAsValueType("Vector4");
            ctx.SetClassAsValueType("EulerAngles");
            ctx.SetClassAsValueType("QuaternionP");
            ctx.SetClassAsValueType("Quaternion");
            ctx.SetClassAsValueType("Matrix4x3");
            ctx.SetClassAsValueType("Matrix4x4");

            ctx.CopyClassFields("ColorP", "Color");
            ctx.CopyClassFields("Vector2P", "Vector2");
            ctx.CopyClassFields("Vector3P", "Vector3");
            ctx.CopyClassFields("QuaternionP", "Quaternion");

            ctx.IgnoreClassWithName("ColorP");
            ctx.IgnoreClassWithName("Vector2P");
            ctx.IgnoreClassWithName("Vector3P");
            ctx.IgnoreClassWithName("QuaternionP");

            ctx.SetNameOfClassMethod("Matrix4x3", "identity", "setIdentity");
            ctx.SetNameOfClassMethod("Matrix4x4", "identity", "setIdentity");
            ctx.SetNameOfClassMethod("Quaternion", "identity", "setIdentity");
            ctx.SetNameOfClassMethod("Vector2", "zero", "setZero");
            ctx.SetNameOfClassMethod("Vector3", "zero", "setZero");
            ctx.SetNameOfClassMethod("Vector4", "zero", "setZero");

            // Resources
            ctx.IgnoreFunctionWithName("ResourcesInitialize");
            ctx.IgnoreFunctionWithName("ResourcesDeinitialize");
            //lib.SetClassAsValueType("ResourceEvent");
            ctx.SetClassAsValueType("ResourceLoadOption");
            ctx.SetClassAsValueType("ResourceLoadOptions");
            ctx.SetNameOfClassMethod("Texture", "allocate", "alloc");
            ctx.ExcludeFromPass("ResourceHandleCreate", typeof (FunctionToInstanceMethodPass));

            // Set generic type constraints on template methods
            var resourceManager = ctx.FindClass("ResourceManager").FirstOrDefault();
            if (resourceManager != null)
                foreach (var template in resourceManager.Templates)
                {
                    for (var i = 0; i < template.Parameters.Count; ++i)
                    {
                        var param = template.Parameters[i];
                        param.Constraint = "Flood::Resource";
                        template.Parameters[i] = param;
                    }
                }

            // Graphics
            ctx.SetClassAsValueType("RenderContextSettings");
            ctx.SetClassAsValueType("RenderBatchRange");
            ctx.SetClassAsValueType("VertexElementP");
            ctx.SetClassAsValueType("VertexElement");
            ctx.SetClassAsValueType("UniformBufferElement");
            ctx.SetClassAsValueType("RenderState");
            ctx.SetClassAsValueType("LightState");
            ctx.IgnoreHeadersWithName("MaxRectsBinPack.h");
            ctx.IgnoreClassWithName("MaxRectsBinPack");
            ctx.IgnoreClassWithName("CompareHandle");
            ctx.SetClassAsValueType("Glyph");
            ctx.SetClassAsValueType("Rectangle");
            ctx.SetClassAsValueType("RectangleF");
            ctx.SetClassAsValueType("SubTexture");
            ctx.SetMethodParameterUsage("TextureAtlas", "getImageSubTexture", 2, ParameterUsage.Out);
            ctx.SetMethodParameterUsage("Font", "getGlyphInfo", 3, ParameterUsage.Out);

            // Engine
            ctx.IgnoreClassMethodWithName("Engine", "addSubsystem");
        }