/// <summary>
 /// 取消注册资源
 /// </summary>
 /// <param name="nameRegister">命名服务注册器</param>
 /// <param name="name">资源名</param>
 public static void UnRegisterResourceByName(this NameRegister nameRegister, string name)
 {
     if (nameRegister.Resources.Contains(name))
     {
         nameRegister.Resources.Remove(name);
     }
 }
 /// <summary>
 /// 注册资源
 /// </summary>
 /// <param name="nameRegister">命名服务注册器</param>
 /// <param name="name">资源名</param>
 /// <param name="value">资源</param>
 public static void RegisterResourceByName(this NameRegister nameRegister, string name, object value)
 {
     if (!nameRegister.Resources.Contains(name))
     {
         nameRegister.Resources.Add(name, value);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Sets the name to the special name of
        /// anonymous.
        /// </summary>
        public void SetNameAnonymous()
        {
            // Retrieve name from the name counter.
            string name = NameRegister.GetAnonymous();

            // Assign the name.
            this.SetName(name);
        }
Exemplo n.º 4
0
        public void Setup()
        {
            // Reset the name counter before every test.
            NameRegister.Reset();

            // Prepare a new parser test wrapper instance.
            this.Wrapper = new ConstructWrapper();
        }
        /// <summary>
        /// 取消注册资源
        /// </summary>
        /// <param name="nameRegister">命名服务注册器</param>
        /// <param name="name">资源名</param>
        public static void UnRegisterResource(this NameRegister nameRegister, object value)
        {
            string _1 = nameRegister.namePrix + value.GetHashCode().ToString();

            if (nameRegister.Resources.Contains(_1))
            {
                nameRegister.Resources.Remove(_1);
            }
        }
Exemplo n.º 6
0
        public async Task <string> RegisterYourNameWithImages(Stream[] streams, string uniqueId)
        {
            foreach (var service in _services)
            {
                var register = new NameRegister(service);

                await register.RegisterYourNameWithImages(streams, uniqueId);
            }

            return(uniqueId);
        }
Exemplo n.º 7
0
        public override LLVMValueRef Emit(PipeContext <LLVMBuilderRef> context)
        {
            // Retrieve a string name.
            string name = NameRegister.GetString();

            // Create the global string pointer.
            LLVMValueRef stringPtr = LLVM.BuildGlobalStringPtr(context.Target, this.value, name);

            // Register the value on the symbol table.
            context.SymbolTable.strings.Add(name, stringPtr);

            // Return the string pointer value.
            return(stringPtr);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates a prototype for this function, overriding
        /// any existing prototype property value. Creates arguments.
        /// </summary>
        public Prototype CreatePrototype()
        {
            // Default the return type to void.
            ITypeEmitter returnType = PrimitiveTypeFactory.Void();

            // Create a new prototype instance.
            this.Prototype = new Prototype(NameRegister.GetAnonymous(), null, returnType);

            // Create formal arguments after assigning prototype to avoid infinite loop.
            FormalArgs args = this.CreateArgs();

            // Assign the formal arguments.
            this.Prototype.Args = args;

            // Return the prototype.
            return(this.Prototype);
        }
Exemplo n.º 9
0
        public async Task <string> RegisterYourNameWithImage(Stream stream, string uniqueId)
        {
            foreach (var service in _services)
            {
                stream.Position = 0;
                var register = new NameRegister(service);
                using (var mem = new MemoryStream())
                {
                    await stream.CopyToAsync(mem);

                    mem.Position = 0;
                    await register.RegisterYourNameWithImage(mem, uniqueId);
                }
            }

            return(uniqueId);
        }
Exemplo n.º 10
0
        public override LLVMValueRef Emit(PipeContext <LLVMBuilderRef> context)
        {
            // Create a new function.
            Function function = new Function();

            // Assign the function's body.
            function.Body = this.Body;

            // Create the function's prototype.
            function.Prototype = new Prototype(NameRegister.GetLambda(), this.Args, this.ReturnType);

            // Emit the created function.
            LLVMValueRef functionRef = function.Emit(context.ModuleContext);

            // TODO: What about input arguments?
            // Create a function call.
            CallExpr call = new CallExpr(function.Prototype.Identifier);

            // Emit the function call.
            LLVMValueRef result = call.Emit(context);

            // Return the resulting function call.
            return(result);
        }
Exemplo n.º 11
0
 public static void Setup()
 {
     // Reset the name counter before every test.
     NameRegister.Reset();
 }
Exemplo n.º 12
0
 public Block()
 {
     this.Expressions = new List <Expr>();
     this.SetName(NameRegister.GetBlock());
 }