private IRacetrackSettingsSource CreateSource(CallInfo arg)
 {
     return new RacetrackSettingsSource(( double ) arg [ 0 ],
                                        ( double ) arg [ 1 ],
                                        ( bool ) arg [ 2 ],
                                        ( bool ) arg [ 3 ]);
 }
Exemplo n.º 2
0
 private static int currentpc(LuaState L, CallInfo ci)
 {
     if (!isLua(ci)) return -1;  /* function is not a Lua function? */
     if (ci == L.ci)
         ci.savedpc = InstructionPtr.Assign(L.savedpc);
     return pcRel(ci.savedpc, ci_func(ci).l.p);
 }
	public void SetUp ()
	{
		ins = new TransactedInstaller ();
		state = new Hashtable ();
		sub1 = new SucceedInstaller ();
		sub2 = new FailureInstaller ();
		sub3 = new SucceedInstaller ();

		BfInstEvt = new CallInfo ();
		AfInstEvt = new CallInfo ();
		CommittingEvt = new CallInfo ();
		CommittedEvt = new CallInfo ();
		BfRbackEvt = new CallInfo ();
		AfRbackEvt = new CallInfo ();
		BfUninsEvt = new CallInfo ();
		AfUninsEvt = new CallInfo ();

		ins.Installers.Add (sub1);
		string [] cmdLine = new string [] { "/logToConsole=false" };
		ins.Context = new InstallContext ("", cmdLine);	// no log file

		ins.BeforeInstall += new InstallEventHandler (onBeforeInstall);
		ins.AfterInstall += new InstallEventHandler (onAfterInstall);
		ins.Committing += new InstallEventHandler (onCommitting);
		ins.Committed += new InstallEventHandler (onCommitted);
		ins.BeforeRollback += new InstallEventHandler (onBeforeRollback);
		ins.AfterRollback += new InstallEventHandler (onAfterRollback);
		ins.BeforeUninstall += new InstallEventHandler (onBeforeUninstall);
		ins.AfterUninstall += new InstallEventHandler (onAfterUninstall);
	}
Exemplo n.º 4
0
        public static MemberInfo GetMember(CallInfo callInfo)
        {
            var member = callInfo.MemberInfo;
            if (member != null)
                return member;

            if (callInfo.MemberTypes == MemberTypes.Property)
            {
                member = callInfo.TargetType.Property(callInfo.Name, callInfo.BindingFlags);
                if (member == null)
                {
                    const string fmt = "No match for property with name {0} and flags {1} on type {2}.";
                    throw new MissingMemberException(string.Format(fmt, callInfo.Name, callInfo.BindingFlags, callInfo.TargetType));
                }
                callInfo.MemberInfo = member;
                return member;
            }
            if (callInfo.MemberTypes == MemberTypes.Field)
            {
                member = callInfo.TargetType.Field(callInfo.Name, callInfo.BindingFlags);
                if (member == null)
                {
                    const string fmt = "No match for field with name {0} and flags {1} on type {2}.";
                    throw new MissingFieldException(string.Format(fmt, callInfo.Name, callInfo.BindingFlags, callInfo.TargetType));
                }
                callInfo.MemberInfo = member;
                return member;
            }
            throw new ArgumentException(callInfo.MemberTypes + " is not supported");
        }
	public void SetUp ()
	{
		ins = new Installer ();
		state = new Hashtable ();
		sub1 = new MyInstaller ();
		sub2 = new MyInstaller ();

		BfInstEvt = new CallInfo ();
		AfInstEvt = new CallInfo ();
		CommittingEvt = new CallInfo ();
		CommittedEvt = new CallInfo ();
		BfRbackEvt = new CallInfo ();
		AfRbackEvt = new CallInfo ();
		BfUninsEvt = new CallInfo ();
		AfUninsEvt = new CallInfo ();;

		ins.Installers.Add (sub1);
		ins.Installers.Add (sub2);

		ins.BeforeInstall += new InstallEventHandler (onBeforeInstall);
		ins.AfterInstall += new InstallEventHandler (onAfterInstall);
		ins.Committing += new InstallEventHandler (onCommitting);
		ins.Committed += new InstallEventHandler (onCommitted);
		ins.BeforeRollback += new InstallEventHandler (onBeforeRollback);
		ins.AfterRollback += new InstallEventHandler (onAfterRollback);
		ins.BeforeUninstall += new InstallEventHandler (onBeforeUninstall);
		ins.AfterUninstall += new InstallEventHandler (onAfterUninstall);
	}
Exemplo n.º 6
0
        internal ComInvokeBinder(
                CallInfo callInfo, 
                DynamicMetaObject[] args,
                bool[] isByRef,
                BindingRestrictions restrictions, 
                Expression method, 
                Expression dispatch, 
                ComMethodDesc methodDesc
                ) {

            Debug.Assert(callInfo != null, "arguments");
            Debug.Assert(args != null, "args");
            Debug.Assert(isByRef != null, "isByRef");
            Debug.Assert(method != null, "method");
            Debug.Assert(dispatch != null, "dispatch");

            Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(ComMethodDesc), method.Type), "method");
            Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(IDispatch), dispatch.Type), "dispatch");

            _method = method;
            _dispatch = dispatch;
            _methodDesc = methodDesc;

            _callInfo = callInfo;
            _args = args;
            _isByRef = isByRef;
            _restrictions = restrictions;

            // Set Instance to some value so that CallBinderHelper has the right number of parameters to work with
            _instance = dispatch;
        }
Exemplo n.º 7
0
        public void Equality()
        {
            CallInfo a = new CallInfo(5, "a", "b");
            CallInfo b = new CallInfo(5, "a", "b");
            CallInfo c = new CallInfo(5, a.ArgumentNames);
            CallInfo d = new CallInfo(5, "b", "a");
            CallInfo e = new CallInfo(4, "a", "b");
            CallInfo f = new CallInfo(5, "a");
            CallInfo x = new CallInfo(3);
            CallInfo y = new CallInfo(3);
            CallInfo z = new CallInfo(2);

            Assert.Equal(a, a);
            Assert.Equal(a, b);
            Assert.Equal(a, c);
            Assert.NotEqual(a, d);
            Assert.NotEqual(a, e);
            Assert.NotEqual(a, f);
            Assert.Equal(x, y);
            Assert.NotEqual(x, z);

            var dict = new Dictionary<CallInfo, int> { { a, 1 }, { x, 2 } };

            Assert.Equal(1, dict[a]);
            Assert.Equal(1, dict[b]);
            Assert.Equal(1, dict[c]);
            Assert.False(dict.ContainsKey(d));
            Assert.False(dict.ContainsKey(e));
            Assert.False(dict.ContainsKey(f));
            Assert.Equal(2, dict[y]);
            Assert.False(dict.ContainsKey(z));
        }
Exemplo n.º 8
0
		private static int CurrentLine (LuaState L, CallInfo ci) {
		  int pc = CurrentPC(L, ci);
		  if (pc < 0)
			return -1;  /* only active lua functions have current-line information */
		  else
			return GetLine(CIFunc(ci).l.p, pc);
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="InvokeMemberBinder" />.
        /// </summary>
        /// <param name="name">The name of the member to invoke.</param>
        /// <param name="ignoreCase">true if the name should be matched ignoring case; false otherwise.</param>
        /// <param name="callInfo">The signature of the arguments at the call site.</param>
        protected InvokeMemberBinder(string name, bool ignoreCase, CallInfo callInfo) {
            ContractUtils.RequiresNotNull(name, "name");
            ContractUtils.RequiresNotNull(callInfo, "callInfo");

            _name = name;
            _ignoreCase = ignoreCase;
            _callInfo = callInfo;
        }
Exemplo n.º 10
0
 private static int currentline(LuaState L, CallInfo ci)
 {
     int pc = currentpc(L, ci);
     if (pc < 0)
         return -1;  /* only active lua functions have current-line information */
     else
         return getline(ci_func(ci).l.p, pc);
 }
Exemplo n.º 11
0
 public void ArgumentCountMatches()
 {
     for (int i = 0; i != 10; ++i)
     {
         var info = new CallInfo(i);
         Assert.Equal(i, info.ArgumentCount);
     }
 }
 private IQueryable<ApiToken> FakeTokens(CallInfo callInfo)
 {
     var list = new List<ApiToken>
     {
         new ApiToken{Id = 1, Key = "1234ASDF", UserId = 1, Created = DateTime.Now.AddMinutes(-1), ValidUntil = DateTime.Now.AddDays(30)},
         new ApiToken{Id = 1, Key = "2345ASDF", UserId = 1, Created = DateTime.Now.AddMinutes(-1), ValidUntil = DateTime.Now.AddDays(30)},
         new ApiToken{Id = 1, Key = "3456ASDF", UserId = 2, Created = DateTime.Now.AddMinutes(-1), ValidUntil = DateTime.Now.AddDays(30)}
     };
     return list.AsQueryable();
 }
        private IQueryable<ISlot> CreateList(CallInfo arg)
        {
            var list = new Collection <ISlot>
                       {
                           Substitute.For <ISlot>(),
                           Substitute.For <ISlot>()
                       };

            return list.AsQueryable();
        }
Exemplo n.º 14
0
        public void InvokePerArgumentActions(CallInfo callInfo)
        {
            var arguments = callInfo.Args();
            var argSpecs = _argumentSpecifications;

            for (var i = 0; i < arguments.Length; i++)
            {
                argSpecs[i].RunAction(arguments[i]);
            }
        }
Exemplo n.º 15
0
 public static FieldInfo GetField(CallInfo callInfo)
 {
     var field = callInfo.TargetType.Field(callInfo.Name, callInfo.BindingFlags);
     if (field == null)
     {
         const string fmt = "No match for field with name {0} and flags {1} on type {2}.";
         throw new MissingFieldException(string.Format(fmt, callInfo.Name, callInfo.BindingFlags, callInfo.TargetType));
     }
     callInfo.MemberInfo = field;
     return field;
 }
Exemplo n.º 16
0
        private ILine LineForIndex(CallInfo callInfo)
        {
            switch ( m_NodeIndexToLineConverter.NodeIndex )
            {
                case 0:
                case 1:
                    return m_LineOne;

                default:
                    return m_LineTwo;
            }
        }
 private ITrailDetails Create(CallInfo callInfo)
 {
     return new TrailDetails(( int ) callInfo [ 0 ],
                             ( int[] ) callInfo [ 1 ],
                             ( double ) callInfo [ 2 ],
                             ( double ) callInfo [ 3 ],
                             ( double ) callInfo [ 4 ],
                             ( string ) callInfo [ 5 ],
                             ( double ) callInfo [ 6 ],
                             ( double ) callInfo [ 7 ],
                             ( double ) callInfo [ 8 ]);
 }
Exemplo n.º 18
0
        public static ConstructorInfo GetConstructor(CallInfo callInfo)
        {
            var constructor = callInfo.MemberInfo as ConstructorInfo;
            if (constructor != null)
                return constructor;

            constructor = callInfo.TargetType.Constructor(callInfo.BindingFlags, callInfo.ParamTypes);
            if (constructor == null)
                throw new MissingMemberException("Constructor does not exist");
            callInfo.MemberInfo = constructor;
            callInfo.MethodParamTypes = constructor.GetParameters().ToTypeArray();
            return constructor;
        }
Exemplo n.º 19
0
        private void StationOnCallInfoAdded(object sender, CallInfo callInfo)
        {
            var fromAccount  = GetAccount(callInfo.Source);
            var toAccount = GetAccount(callInfo.Target);
            if (fromAccount == null) return;
            double outCost = fromAccount.AddIncomingMinutes(callInfo.Duration.TotalMinutes);

            if (toAccount == null) return;
            double inCost = toAccount.AddIncomingMinutes(callInfo.Duration.TotalMinutes);

            AddCallStatistic(fromAccount, new CallStatistic(callInfo, outCost));
            AddCallStatistic(toAccount, new CallStatistic(callInfo, inCost));
        }
Exemplo n.º 20
0
 private DynamicMetaObject BindComInvoke(DynamicMetaObject[] args, ComMethodDesc method, CallInfo callInfo, bool[] isByRef) {
     return new ComInvokeBinder(
         callInfo,
         args,
         isByRef,
         IDispatchRestriction(),
         Expression.Constant(method),
         Expression.Property(
             Helpers.Convert(Expression, typeof(IDispatchComObject)),
             typeof(IDispatchComObject).GetProperty("DispatchObject")
         ),
         method
     ).Invoke();
 }
Exemplo n.º 21
0
 public static MethodInfo GetMethod(CallInfo callInfo)
 {
     var method = callInfo.MemberInfo as MethodInfo;
     if (method != null)
         return method;
     method = callInfo.TargetType.Method(callInfo.GenericTypes, callInfo.Name, callInfo.ParamTypes, callInfo.BindingFlags);
     if (method == null)
     {
         const string fmt = "No match for method with name {0} and flags {1} on type {2}.";
         throw new MissingMethodException(string.Format(fmt, callInfo.Name, callInfo.BindingFlags, callInfo.TargetType));
     }
     callInfo.MemberInfo = method;
     callInfo.MethodParamTypes = method.GetParameters().ToTypeArray();
     return method;
 }
        private Constants.LineDirection DirectionForIndex(CallInfo callInfo)
        {
            var index = ( int ) callInfo [ 0 ];

            switch ( index )
            {
                case 0:
                case 2:
                case 4:
                    return Constants.LineDirection.Forward;

                default:
                    return Constants.LineDirection.Reverse;
            }
        }
Exemplo n.º 23
0
        public void CallInfoHandler(object sender, CallInfo callInfo)
        {
            var sourcePair = GetUserTerminalMapPair(callInfo.Source);
            var targetPair = GetUserTerminalMapPair(callInfo.Target);
            var targetCallInfo = new CallInfo(callInfo.Target, callInfo.Source, TerminalState.IncomingCall)
            {
                TimeBegin = callInfo.TimeBegin,
                Duration = callInfo.Duration,
                Cost = 0
            };

            callInfo.Cost = sourcePair.Key.TariffPlan.CalculateCallCost(callInfo.Duration);

            UserCallinfoDictionary[sourcePair.Value].Add(callInfo);
            UserCallinfoDictionary[targetPair.Value].Add(targetCallInfo);
        }
        private ILine LineForIndex(CallInfo callInfo)
        {
            var index = ( int ) callInfo [ 0 ];

            switch ( index )
            {
                case 0:
                case 1:
                    return m_LineOne;

                case 2:
                case 3:
                    return m_LineTwo;

                default:
                    return m_LineThree;
            }
        }
Exemplo n.º 25
0
 public void EqualityBasedOnNamesAndCount()
 {
     string[] names = new[] {"foo", "bar", "baz", "quux", "quuux"};
     for (int i = 0; i <= names.Length; ++i)
     {
         for (int j = 0; j != 3; ++j)
         {
             for (int x = 0; x <= names.Length; ++x)
             {
                 for (int y = 0; y != 3; ++y)
                 {
                     var info0 = new CallInfo(i + j, names.Take(i));
                     var info1 = new CallInfo(x + y, names.Take(x));
                     Assert.Equal(i == x & j == y, info0.Equals(info1));
                 }
             }
         }
     }
 }
Exemplo n.º 26
0
        private DynamicMetaObject BindGetOrInvoke(DynamicMetaObject[] args, CallInfo callInfo) {
            //
            // Demand Full Trust to proceed with the binding.
            //

            new PermissionSet(PermissionState.Unrestricted).Demand();

            ComMethodDesc method;
            var target = _callable.DispatchComObject;
            var name = _callable.MemberName;

            if (target.TryGetMemberMethod(name, out method) ||
                target.TryGetMemberMethodExplicit(name, out method)) {

                bool[] isByRef = ComBinderHelpers.ProcessArgumentsForCom(ref args);
                return BindComInvoke(method, args, callInfo, isByRef);
            }
            return null;
        }
Exemplo n.º 27
0
        protected override void InnerConnectionHandler(object sender, CallInfo callInfo)
        {
            var targetPort = GetPortByPhoneNumber(callInfo.Target);
            if (targetPort.State == PortState.Unpluged || targetPort.State == PortState.Call ||
                callInfo.Source == callInfo.Target)
            {
                SetTerminalStateTo(callInfo.Source, TerminalState.Free);

                callInfo.TimeBegin = TimeHelper.Now;
                callInfo.Duration = TimeSpan.Zero;
                OnCallInfoPrepared(this, callInfo);
            }
            else
            {
                SetPortsStateTo(callInfo.Source, callInfo.Target, PortState.Call);
                SetTerminalStateTo(callInfo.Source, TerminalState.OutGoingCall);
                SetTerminalStateTo(callInfo.Target, TerminalState.IncomingCall);
                var targetTerminal = _terminalCollection.FirstOrDefault(x => x.Number == callInfo.Target);

                targetTerminal?.GetReqest(callInfo.Source);
                _callInfoCollection.Add(callInfo);
                _waitActionTerminals.Add(targetTerminal);
            }
        }
Exemplo n.º 28
0
 private static ArchivedPictureModel SaveImageFails(CallInfo callInfo)
 {
     throw new Exception();
 }
Exemplo n.º 29
0
        /// <summary>
        /// Creates a delegate which can set the value of the field specified by <paramref name="name"/> and
        /// matching <paramref name="bindingFlags"/> on the given <paramref name="type"/>.
        /// </summary>
        public static MemberSetter DelegateForSetFieldValue(this Type type, string name, Flags bindingFlags)
        {
            var callInfo = new CallInfo(type, null, bindingFlags, MemberTypes.Field, name, null, null, false);

            return((MemberSetter) new MemberSetEmitter(callInfo).GetDelegate());
        }
Exemplo n.º 30
0
 public static bool FIsLua(CallInfo ci)
 {
     return(CIFunc(ci).c.isC == 0);
 }
Exemplo n.º 31
0
        private static CharPtr getobjname(lua_State L, CallInfo ci, int reg,
                                          ref CharPtr name)
        {
            Proto   p      = ci_func(ci).p;
            CharPtr what   = null;
            int     lastpc = currentpc(ci);
            int     pc;

            name = luaF_getlocalname(p, reg + 1, lastpc);
            if (name != null)        /* is a local? */
            {
                return("local");
            }
            /* else try symbolic execution */
            for (pc = 0; pc < lastpc; pc++)
            {
                Instruction i  = p.code[pc];
                OpCode      op = GET_OPCODE(i);
                int         a  = GETARG_A(i);
                switch (op)
                {
                case OpCode.OP_MOVE: {
                    if (reg == a)
                    {
                        int b = GETARG_B(i);    /* move from 'b' to 'a' */
                        if (b < a)
                        {
                            what = getobjname(L, ci, b, ref name);  /* get name for 'b' */
                        }
                        else
                        {
                            what = null;
                        }
                    }
                    break;
                }

                case OpCode.OP_GETTABUP:
                case OpCode.OP_GETTABLE: {
                    if (reg == a)
                    {
                        int     k  = GETARG_C(i);               /* key index */
                        int     t  = GETARG_B(i);
                        CharPtr vn = (op == OpCode.OP_GETTABLE) /* name of indexed variable */
                                           ? luaF_getlocalname(p, t + 1, pc)
                                           : getstr(p.upvalues[t].name);
                        kname(L, ci, k, a, what, ref name);
                        what = (vn != null && strcmp(vn, LUA_ENV) == 0) ? "global" : "field";
                    }
                    break;
                }

                case OpCode.OP_GETUPVAL: {
                    if (reg == a)
                    {
                        int     u  = GETARG_B(i); /* upvalue index */
                        TString tn = p.upvalues[u].name;
                        name = tn != null?getstr(tn) : "?";

                        what = "upvalue";
                    }
                    break;
                }

                case OpCode.OP_LOADK:
                case OpCode.OP_LOADKX: {
                    if (reg == a)
                    {
                        int b = (op == OpCode.OP_LOADK) ? GETARG_Bx(i)
                                           : GETARG_Ax(p.code[pc + 1]);
                        if (ttisstring(p.k[b]))
                        {
                            what = "constant";
                            name = svalue(p.k[b]);
                        }
                    }
                    break;
                }

                case OpCode.OP_LOADNIL: {
                    int b = GETARG_B(i);
                    if (a <= reg && reg <= a + b)      /* set registers from 'a' to 'a+b' */
                    {
                        what = null;
                    }
                    break;
                }

                case OpCode.OP_SELF: {
                    if (reg == a)
                    {
                        int k = GETARG_C(i);    /* key index */
                        kname(L, ci, k, a, what, ref name);
                        what = "method";
                    }
                    break;
                }

                case OpCode.OP_TFORCALL: {
                    if (reg >= a + 2)
                    {
                        what = null;                    /* affect all regs above its base */
                    }
                    break;
                }

                case OpCode.OP_CALL:
                case OpCode.OP_TAILCALL: {
                    if (reg >= a)
                    {
                        what = null;                /* affect all registers above base */
                    }
                    break;
                }

                case OpCode.OP_JMP: {
                    int b    = GETARG_sBx(i);
                    int dest = pc + 1 + b;
                    /* jump is forward and do not skip `lastpc'? */
                    if (pc < dest && dest <= lastpc)
                    {
                        pc += b;    /* do the jump */
                    }
                    break;
                }

                case OpCode.OP_TEST: {
                    if (reg == a)
                    {
                        what = null;                /* jumped code can change 'a' */
                    }
                    break;
                }

                default:
                    if (testAMode(op) != 0 && reg == a)
                    {
                        what = null;
                    }
                    break;
                }
            }
            return(what);
        }
Exemplo n.º 32
0
 public SymplInvokeMemberBinder(String name, CallInfo callinfo) : base(name, true, callinfo)
 {
 }
Exemplo n.º 33
0
 /* Active Lua function (given call info) */
 private static LClosure ci_func(CallInfo ci)
 {
     return(clLvalue(ci.func));
 }
Exemplo n.º 34
0
 public LuaInvokeBinder(Lua lua, CallInfo callInfo)
     : base(callInfo)
 {
     this.lua = lua;
 }             // ctor
Exemplo n.º 35
0
 public LuaSetIndexBinder(Lua lua, CallInfo callInfo)
     : base(callInfo)
 {
     this.lua = lua;
 }             // ctor
Exemplo n.º 36
0
        //static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
        //                                    const char **name);


        private static int currentpc(CallInfo ci)
        {
            lua_assert(isLua(ci));
            return(pcRel(ci.u.l.savedpc, ci_func(ci).p));
        }
        void HandleDatabusProperty(CallInfo callInfo)
        {
            if (DataBus == null)
            {
                throw new InvalidOperationException("Databus transmission received without a configured databus");
            }

            TimeSpan timeToBeReceived;
            if (!TimeSpan.TryParse(callInfo.Headers["NServiceBus.TimeToBeReceived"], out timeToBeReceived))
            {
                timeToBeReceived = TimeSpan.FromHours(1);
            }

            var newDatabusKey = DataBus.Put(callInfo.Data, timeToBeReceived);
            using (var databusStream = DataBus.Get(newDatabusKey))
            {
                CheckHashOfGatewayStream(databusStream, callInfo.Headers[HttpHeaders.ContentMd5Key]);
            }

            var specificDataBusHeaderToUpdate = callInfo.Headers[GatewayHeaders.DatabusKey];
            headerManager.InsertHeader(callInfo.ClientId, specificDataBusHeaderToUpdate, newDatabusKey);
        }
Exemplo n.º 38
0
 private static int currentline(CallInfo ci)
 {
     return(getfuncline(ci_func(ci).p, currentpc(ci)));
 }
Exemplo n.º 39
0
 public VBScriptInvokeMemberBinder(string name, CallInfo callinfo)
     : base(name, true, callinfo)
 { // true = ignoreCase
 }
Exemplo n.º 40
0
        /* }====================================================== */



        /*
        ** The subtraction of two potentially unrelated pointers is
        ** not ISO C, but it should not crash a program; the subsequent
        ** checks are ISO C and ensure a correct result.
        */
        private static int isinstack(CallInfo ci, TValue o)
        {
            ptrdiff_t i = o - ci.u.l.base_;

            return((0 <= i && i < (ci.top - ci.u.l.base_) && ci.u.l.base_ + i == o)?1:0);
        }
Exemplo n.º 41
0
 public LuaInvokeMemberBinder(Lua lua, string name, CallInfo callInfo)
     : base(name, false, callInfo)
 {
     this.lua = lua;
 }             // ctor
Exemplo n.º 42
0
 public MemberCallInfo(string sMember, CallInfo ci)
 {
     this.sMember = sMember;
     this.ci      = ci;
 }             // ctor
Exemplo n.º 43
0
 public LuaInvokeMemberBinder(Context context, string name, CallInfo callInfo)
     : base(name, false, callInfo)
 {
     this.context = context;
 }
Exemplo n.º 44
0
 // interop binders: the target is a foreign meta-object, the binder is context-bound:
 internal CallArguments(RubyContext /*!*/ context, DynamicMetaObject /*!*/ target, DynamicMetaObject /*!*/[] /*!*/ args, CallInfo /*!*/ callInfo)
     : this(
         new DynamicMetaObject(AstUtils.Constant(context), BindingRestrictions.Empty, context),
         target,
         args,
         RubyCallSignature.Interop(callInfo.ArgumentCount)
         )
 {
 }
Exemplo n.º 45
0
        private static CharPtr getfuncname(lua_State L, CallInfo ci, ref CharPtr name)
        {
            TMS         tm = 0;
            Instruction i;

            if ((ci.callstatus & CIST_TAIL) != 0 || isLua(ci.previous) == 0)
            {
                return(null);                              /* calling function is not Lua (or is unknown) */
            }
            ci = ci.previous;                              /* calling function */
            i  = ci_func(ci).p.code[currentpc(ci)];
            if (GET_OPCODE(i) == OpCode.OP_EXTRAARG)       /* extra argument? */
            {
                i = ci_func(ci).p.code[currentpc(ci) - 1]; /* get 'real' instruction */
            }
            switch (GET_OPCODE(i))
            {
            case OpCode.OP_CALL:
            case OpCode.OP_TAILCALL:
                return(getobjname(L, ci, GETARG_A(i), ref name));

            case OpCode.OP_TFORCALL: {
                name = "for iterator";
                return("for iterator");
            }

            case OpCode.OP_SELF:
            case OpCode.OP_GETTABUP:
            case OpCode.OP_GETTABLE: tm = TMS.TM_INDEX; break;

            case OpCode.OP_SETTABUP:
            case OpCode.OP_SETTABLE: tm = TMS.TM_NEWINDEX; break;

            case OpCode.OP_EQ: tm = TMS.TM_EQ; break;

            case OpCode.OP_ADD: tm = TMS.TM_ADD; break;

            case OpCode.OP_SUB: tm = TMS.TM_SUB; break;

            case OpCode.OP_MUL: tm = TMS.TM_MUL; break;

            case OpCode.OP_DIV: tm = TMS.TM_DIV; break;

            case OpCode.OP_MOD: tm = TMS.TM_MOD; break;

            case OpCode.OP_POW: tm = TMS.TM_POW; break;

            case OpCode.OP_UNM: tm = TMS.TM_UNM; break;

            case OpCode.OP_LEN: tm = TMS.TM_LEN; break;

            case OpCode.OP_LT: tm = TMS.TM_LT; break;

            case OpCode.OP_LE: tm = TMS.TM_LE; break;

            case OpCode.OP_CONCAT: tm = TMS.TM_CONCAT; break;

            default:
                return(null);                    /* else no useful name can be found */
            }
            name = getstr(G(L).tmname[(int)tm]); //FIXME:(int)
            return("metamethod");
        }
Exemplo n.º 46
0
        /// <summary>
        ///   Creates the cacheable method or indexer or property call.
        /// </summary>
        /// <param name="kind"> The kind. </param>
        /// <param name="name"> The name. </param>
        /// <param name="callinfo"> The callinfo. </param>
        /// <param name="context"> The context. </param>
        /// <returns> </returns>
        public static CacheableInvocation CreateCall(InvocationKind kind, String_OR_InvokeMemberName name = null, CallInfo callinfo = null, object context = null)
        {
            var tArgCount = callinfo != null ? callinfo.ArgumentCount : 0;
            var tArgNames = callinfo != null?callinfo.ArgumentNames.ToArray() : null;

            return(new CacheableInvocation(kind, name, tArgCount, tArgNames, context));
        }
Exemplo n.º 47
0
        public const int CIST_FIN       = (1 << 8);  /* call is running a finalizer */

        public static int isLua(CallInfo ci)
        {
            return(((ci.callstatus & CIST_LUA) != 0) ? 1 : 0);
        }
Exemplo n.º 48
0
            }             // ctor

            private void UpdateCallSite(CallInfo callInfo, CallSite callSite)
            {
                this.callSite = callSite;
            }             // proc UpdateCallSite
Exemplo n.º 49
0
 public static bool IsLua(CallInfo ci)
 {
     return(TTIsFunction((ci).func) && FIsLua(ci));
 }
Exemplo n.º 50
0
 public static CallInfo dec(ref CallInfo value)
 {
     value = value[-1];
     return(value[1]);
 }
Exemplo n.º 51
0
 public static Closure CIFunc(CallInfo ci)
 {
     return(CLValue(ci.func));
 }
Exemplo n.º 52
0
 public static Closure ci_func(CallInfo ci)
 {
     return(clvalue(ci.func));
 }
Exemplo n.º 53
0
 private static ArchivedPictureModel SaveImageSucceeds(CallInfo callInfo) => new ArchivedPictureModel();
Exemplo n.º 54
0
 public static bool f_isLua(CallInfo ci)
 {
     return(ci_func(ci).c.isC == 0);
 }
Exemplo n.º 55
0
 public override void RunCSharpScript(IVimBuffer vimBuffer, CallInfo callInfo, bool createEachTime)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 56
0
        /*
        ** Try to find a name for a function based on the code that called it.
        ** (Only works when function was called by a Lua function.)
        ** Returns what the name is (e.g., "for iterator", "method",
        ** "metamethod") and sets '*name' to point to the name.
        */
        private static CharPtr funcnamefromcode(lua_State L, CallInfo ci,
                                                ref CharPtr name)
        {
            TMS         tm = (TMS)0; /* (initial value avoids warnings) */ //FIXME:added, = 0
            Proto       p  = ci_func(ci).p;                                /* calling function */
            int         pc = currentpc(ci);                                /* calling instruction index */
            Instruction i  = p.code[pc];                                   /* calling instruction */

            if (0 != (ci.callstatus & CIST_HOOKED))                        /* was it called inside a hook? */
            {
                name = "?";
                return("hook");
            }
            switch (GET_OPCODE(i))
            {
            case OpCode.OP_CALL:
            case OpCode.OP_TAILCALL:
                return(getobjname(p, pc, GETARG_A(i), ref name)); /* get function name */

            case OpCode.OP_TFORCALL: {                            /* for iterator */
                name = "for iterator";
                return("for iterator");
            }

            /* other instructions can do calls through metamethods */
            case OpCode.OP_SELF:
            case OpCode.OP_GETTABUP:
            case OpCode.OP_GETTABLE:
                tm = TMS.TM_INDEX;
                break;

            case OpCode.OP_SETTABUP:
            case OpCode.OP_SETTABLE:
                tm = TMS.TM_NEWINDEX;
                break;

            case OpCode.OP_ADD:
            case OpCode.OP_SUB:
            case OpCode.OP_MUL:
            case OpCode.OP_MOD:
            case OpCode.OP_POW:
            case OpCode.OP_DIV:
            case OpCode.OP_IDIV:
            case OpCode.OP_BAND:
            case OpCode.OP_BOR:
            case OpCode.OP_BXOR:
            case OpCode.OP_SHL:
            case OpCode.OP_SHR: {
                int offset = cast_int(GET_OPCODE(i)) - cast_int(OpCode.OP_ADD); /* ORDER OP */
                tm = (TMS)(offset + cast_int(TMS.TM_ADD));                      /* ORDER TM */
                break;
            }

            case OpCode.OP_UNM: tm = TMS.TM_UNM; break;

            case OpCode.OP_BNOT: tm = TMS.TM_BNOT; break;

            case OpCode.OP_LEN: tm = TMS.TM_LEN; break;

            case OpCode.OP_CONCAT: tm = TMS.TM_CONCAT; break;

            case OpCode.OP_EQ: tm = TMS.TM_EQ; break;

            case OpCode.OP_LT: tm = TMS.TM_LT; break;

            case OpCode.OP_LE: tm = TMS.TM_LE; break;

            default:
                return(null);                    /* cannot find a reasonable name */
            }
            name = getstr(G(L).tmname[(int)tm]); //FIXME:(int)
            return("metamethod");
        }
 /// <summary>
 /// Initializes a new intsance of the <see cref="CreateInstanceBinder" />.
 /// </summary>
 /// <param name="callInfo">The signature of the arguments at the call site.</param>
 protected CreateInstanceBinder(CallInfo callInfo) {
     ContractUtils.RequiresNotNull(callInfo, "callInfo");
     _callInfo = callInfo;
 }
Exemplo n.º 58
0
        public InteropBinder.InvokeMember /*!*/ InteropInvokeMember(string /*!*/ name, CallInfo /*!*/ callInfo)
        {
            if (_interopInvokeMember == null)
            {
                _interopInvokeMember = new Dictionary <Key <string, CallInfo>, InteropBinder.InvokeMember>();
            }

            var key = Key.Create(name, callInfo);

            lock (_interopInvokeMember) {
                InteropBinder.InvokeMember result;
                if (!_interopInvokeMember.TryGetValue(key, out result))
                {
                    _interopInvokeMember.Add(key, result = new InteropBinder.InvokeMember(_context, name, callInfo, null));
                }
                return(result);
            }
        }
        void HandleSubmit(CallInfo callInfo)
        {
            using (var stream = new MemoryStream())
            {
                callInfo.Data.CopyTo(stream);
                stream.Position = 0;

                CheckHashOfGatewayStream(stream, callInfo.Headers[HttpHeaders.ContentMd5Key]);

                var msg = HeaderMapper.Map(headerManager.Reassemble(callInfo.ClientId, callInfo.Headers));
                msg.Body = new byte[stream.Length];
                stream.Read(msg.Body, 0, msg.Body.Length);

                if (deduplicator.DeduplicateMessage(callInfo.ClientId, DateTime.UtcNow))
                {
                    MessageReceived(this, new MessageReceivedOnChannelArgs {Message = msg});
                }
                else
                {
                    Logger.InfoFormat("Message with id: {0} is already on the bus, dropping the request",
                        callInfo.ClientId);
                }
            }
        }
Exemplo n.º 60
0
        public InteropBinder.SetIndexedProperty /*!*/ InteropSetIndexedProperty(string /*!*/ name, CallInfo /*!*/ callInfo)
        {
            if (_interopSetIndexedProperty == null)
            {
                _interopSetIndexedProperty = new Dictionary <Key <string, CallInfo>, InteropBinder.SetIndexedProperty>();
            }

            var key = Key.Create(name, callInfo);

            lock (_interopSetIndexedProperty) {
                InteropBinder.SetIndexedProperty result;
                if (!_interopSetIndexedProperty.TryGetValue(key, out result))
                {
                    _interopSetIndexedProperty.Add(key, result = new InteropBinder.SetIndexedProperty(_context, name, callInfo));
                }
                return(result);
            }
        }