Example #1
0
 public Function Find(FunctionType type, bool isStatic)
 {
     MakeConcrete();
     FunctionGroupName gname = new FunctionGroupName(type, isStatic);
     FunctionGroupName oldName = functions.Find(gname);
     if(oldName != null)
         return oldName.GetFunction();
     return null;
 }
Example #2
0
        public FunctionGroupInstance(FunctionGroup template, GenericInstance instance, ScopeMember factory)
            : base(template.GetName(), (Scope)factory)
        {
            // Instance all of the functions.
            foreach(FunctionGroupName gname in template.GetFunctions())
            {
                // Instance the function.
                Function tmplFunction = gname.GetFunction();
                Function function = (Function)tmplFunction.InstanceMember(factory, instance);

                // Create the new group name.
                FunctionGroupName groupName = new FunctionGroupName(function.GetFunctionType(), gname.IsStatic());
                groupName.SetFunction(function);

                // Store the group name.
                functions.Add(groupName);
            }
        }
Example #3
0
        public FunctionGroupInstance(FunctionGroup template, GenericInstance instance, ScopeMember factory)
            : base(template.GetName(), (Scope)factory)
        {
            // Instance all of the functions.
            foreach (FunctionGroupName gname in template.GetFunctions())
            {
                // Instance the function.
                Function tmplFunction = gname.GetFunction();
                Function function     = (Function)tmplFunction.InstanceMember(factory, instance);

                // Create the new group name.
                FunctionGroupName groupName = new FunctionGroupName(function.GetFunctionType(), gname.IsStatic());
                groupName.SetFunction(function);

                // Store the group name.
                functions.Add(groupName);
            }
        }
        private IntPtr moduleAsyncAPIResult;// Returning results

        // Constructor using WorkFunction enumerator
        public WorkItem(FunctionGroupName GroupName,
                        AsyncCallName AsyncCallName,
                        Object Parameters,
                        AsyncCallback CallBackFunction,
                        Object AsyncStates)
        {
            // Initialize members
            asyncState             = AsyncState;
            asyncCompletedEvent    = new ManualResetEvent(false);
            completedSynchronously = false;
            isCompleted            = false;
            isDisposed             = false;
            callBackFunction       = CallBackFunction;
            groupName                    = GroupName;
            functionName                 = AsyncCallName;
            inputParameters              = Parameters;
            outputParameters             = null;
            exceptionCode                = ErrorAndExceptionCode.NoException;
            exception                    = null;
            moduleAsyncAPICompletedEvent = new AutoResetEvent(false);
            moduleAsyncAPIResult         = IntPtr.Zero;
        }
Example #5
0
 /// <summary>
 /// Find a group with the same function type than another group.
 /// </summary>
 private FunctionGroupName Find(FunctionGroupName group)
 {
     return (FunctionGroupName)functions.Find(group);
 }
Example #6
0
        private void AppendLevelContent(FunctionGroup level, bool isNamespaceLevel)
        {
            level.MakeConcrete();
            foreach(FunctionGroupName gname in level.functions)
            {
                // Check if the object belongs to the included namespace level
                bool isNamespace = gname.IsNamespaceLevel || isNamespaceLevel;

                // Read the name data.
                FunctionType type = gname.GetFunctionType();
                bool isStatic = gname.IsStatic();

                // Find a similar group.
                FunctionGroupName old = Find(gname);
                if(old == null)
                {
                    FunctionGroupName newName = new FunctionGroupName(type, isStatic);
                    newName.IsNamespaceLevel = isNamespace;
                    newName.SetFunction(gname.GetFunction());
                    functions.Add(newName);
                    continue;
                }

                // Ignore names of lower scopes.
                if(!isNamespace || !old.IsNamespaceLevel)
                    continue;

                // Now the old name is a namespace level, and we are adding another
                // namespace level function, in other words, we have detected an ambiguity.
                Function oldFunction = old.GetFunction();
                FunctionAmbiguity amb;
                if(!oldFunction.IsAmbiguity())
                {
                    amb = new FunctionAmbiguity(oldFunction.GetName(), oldFunction.GetFlags(), oldFunction.GetParentScope());
                    amb.AddCandidate(oldFunction);
                    old.SetFunction(amb);
                }
                else
                {
                    amb = (FunctionAmbiguity)oldFunction;
                }

                // Add the new function into the ambiguity list.
                amb.AddCandidate(gname.GetFunction());
            }
        }
Example #7
0
 public void Insert(Function function)
 {
     FunctionGroupName gname = new FunctionGroupName(function.GetFunctionType(), function.IsStatic());
     gname.SetFunction(function);
     functions.Add(gname);
 }