コード例 #1
0
        public static void Write(String format, Object arg0, Object arg1, Object arg2, Object arg3, __arglist)
        {
            Object[] objArgs;
            int      argCount;

            ArgIterator args = new ArgIterator(__arglist);

            //+4 to account for the 4 hard-coded arguments at the beginning of the list.
            argCount = args.GetRemainingCount() + 4;

            objArgs = new Object[argCount];

            //Handle the hard-coded arguments
            objArgs[0] = arg0;
            objArgs[1] = arg1;
            objArgs[2] = arg2;
            objArgs[3] = arg3;

            //Walk all of the args in the variable part of the argument list.
            for (int i = 4; i < argCount; i++)
            {
                objArgs[i] = TypedReference.ToObject(args.GetNextArg());
            }

            Out.Write(format, objArgs);
        }
コード例 #2
0
		private static void ArglistMethod (__arglist)
		{
			var iter = new ArgIterator (__arglist);

			for (int n = iter.GetRemainingCount (); n > 0; n--)
				Console.WriteLine (TypedReference.ToObject (iter.GetNextArg ()));
		}
 public void VariableArguments(__arglist)
 {
     ArgIterator argumentIterator = new ArgIterator(__arglist);
     for(int i = 0; i < argumentIterator.GetRemainingCount(); i++)
     {
         Console.WriteLine(
             __refvalue(argumentIterator.GetNextArg(), string));
     }
 }
コード例 #4
0
 public static void DisplayNumbersOnConsole(__arglist)
 {
     ArgIterator ai = new ArgIterator(__arglist);
     while (ai.GetRemainingCount() > 0)
     {
         TypedReference tr = ai.GetNextArg();
         Console.WriteLine(TypedReference.ToObject(tr));
     }
 }
コード例 #5
0
ファイル: CLibUtils.cs プロジェクト: soywiz/ilcc
        /*
        static public TType Cast<TType>(object Value)
        {
            if (typeof(TType) == typeof(int)) return (TType)(dynamic)Convert.ToInt32(Value);
            if (typeof(TType) == typeof(uint)) return (TType)(dynamic)Convert.ToUInt32(Value);

            if (Value.GetType() == typeof(int)) return (TType)(dynamic)(int)Value;
            if (Value.GetType() == typeof(uint)) return (TType)(dynamic)(uint)Value;
            return (TType)(dynamic)Value;
        }
        */
        public static object[] GetObjectsFromArgsIterator(ArgIterator ArgIterator)
        {
            var Params = new object[ArgIterator.GetRemainingCount()];
            for (int n = 0; n < Params.Length; n++)
            {
                Params[n] = TypedReference.ToObject(ArgIterator.GetNextArg());
            }
            ArgIterator.End();
            return Params;
        }
コード例 #6
0
ファイル: Stdarg.cs プロジェクト: edgar-pek/VCDryad
        /*?*/
        public static object va_arg(va_list argp, Type t)
        {
            ArgIterator ai = argp;

              if (ai.GetRemainingCount() > 0) {
            TypedReference tr = ai.GetNextArg();
            // TODO: coerce return value to type t...
            return (object)(__refvalue(tr, object));
              }
              throw new FormatException();
        }
コード例 #7
0
ファイル: Numbers.cs プロジェクト: kaptainzero/monomath
        /// <summary>
        /// Arrangements the specified n and list of argument.
        /// A = n! / [(n_1)!.(n_2)!. ... . (n_i)!]
        /// </summary>
        /// <param name='...'>
        /// List of arguments
        /// </param>
        public static Int64 Arrangements(Int32 n, __arglist)
        {
            Int64 result = 1;
            ArgIterator iter = new ArgIterator(__arglist);

            Int32 argCount = iter.GetRemainingCount();

                for (Int32 i = 0; i < argCount; i++) {
                        TypedReference typedRef = iter.GetNextArg();
                        result *= Factorial((Int32)TypedReference.ToObject( typedRef ) );
                }
            return Factorial(n)/result;
        }
コード例 #8
0
ファイル: test-399-lib.cs プロジェクト: nobled/mono
	public static Result VtAddASecondBunchOfInts (int a, __arglist)
	{
		int result = 0;

		System.ArgIterator iter = new System.ArgIterator (__arglist);
		int argCount = iter.GetRemainingCount();

		for (int i = 0; i < argCount; i++) {
			System.TypedReference typedRef = iter.GetNextArg();
			result += (int)TypedReference.ToObject( typedRef );
		}
		
		return new Result (result);
	}
コード例 #9
0
ファイル: vararg2.cs プロジェクト: Zman0169/mono
    static int AddABunchOfShorts (__arglist)
    {
	int result = 0;

	System.ArgIterator iter = new System.ArgIterator (__arglist);
	int argCount = iter.GetRemainingCount();

	for (int i = 0; i < argCount; i++) {
	    System.TypedReference typedRef = iter.GetNextArg();
	    result += (short)TypedReference.ToObject( typedRef );
	}

	return result;
    }
コード例 #10
0
ファイル: vararg2.cs プロジェクト: xia13520/dnSpy-Unity-mono
    static int AddABunchOfShorts(__arglist)
    {
        int result = 0;

        System.ArgIterator iter = new System.ArgIterator(__arglist);
        int argCount            = iter.GetRemainingCount();

        for (int i = 0; i < argCount; i++)
        {
            System.TypedReference typedRef = iter.GetNextArg();
            result += (short)TypedReference.ToObject(typedRef);
        }

        return(result);
    }
コード例 #11
0
ファイル: VarArgs.cs プロジェクト: modulexcite/DWX-Trickbox
        /// <summary>
        /// Hey children - don't do that at home
        /// </summary>
        public static void Flexible(__arglist)
        {
            // Actually pretty raw access here
            var ai = new ArgIterator(__arglist);

            while (ai.GetRemainingCount() > 0)
            {
                var typeRef = ai.GetNextArg();
                // Need to get the object reference from the
                // combined (typeref, objectref) element
                var obj = TypedReference.ToObject(typeRef);

                Debug.WriteLine(obj);
            }
        }
コード例 #12
0
ファイル: test-269.cs プロジェクト: andyhebear/Csharp-Parser
    int InstAddASecondBunchOfInts(int a, __arglist)
    {
        int result = 0;

        System.ArgIterator iter = new System.ArgIterator(__arglist);
        int argCount            = iter.GetRemainingCount();

        for (int i = 0; i < argCount; i++)
        {
            System.TypedReference typedRef = iter.GetNextArg();
            result += (int)TypedReference.ToObject(typedRef);
        }

        return(result);
    }
コード例 #13
0
ファイル: Console.cs プロジェクト: vernon016/mono
		public static void WriteLine (string format, object arg0, object arg1, object arg2, object arg3, __arglist)
		{
			ArgIterator iter = new ArgIterator (__arglist);
			int argCount = iter.GetRemainingCount();

			object[] args = new object [argCount + 4];
			args [0] = arg0;
			args [1] = arg1;
			args [2] = arg2;
			args [3] = arg3;
			for (int i = 0; i < argCount; i++) {
				TypedReference typedRef = iter.GetNextArg ();
				args [i + 4] = TypedReference.ToObject (typedRef);
			}

			stdout.WriteLine (String.Format (format, args));
		}
コード例 #14
0
        public static void WriteLine(string format, object arg0, object arg1, object arg2, object arg3, __arglist)
        {
            ArgIterator argIterator    = new ArgIterator(__arglist);
            int         remainingCount = argIterator.GetRemainingCount();

            object[] array = new object[remainingCount + 4];
            array[0] = arg0;
            array[1] = arg1;
            array[2] = arg2;
            array[3] = arg3;
            for (int i = 0; i < remainingCount; i++)
            {
                TypedReference nextArg = argIterator.GetNextArg();
                array[i + 4] = TypedReference.ToObject(nextArg);
            }
            Console.stdout.WriteLine(string.Format(format, array));
        }
コード例 #15
0
ファイル: Console.cs プロジェクト: ForNeVeR/pnet
        public static void WriteLine(String format, Object arg0, Object arg1,
                                     Object arg2, Object arg3, __arglist)
        {
            ArgIterator iter = new ArgIterator(__arglist);

            Object[] list = new Object [4 + iter.GetRemainingCount()];
            list[0] = arg0;
            list[1] = arg1;
            list[2] = arg2;
            list[3] = arg3;
            int posn = 4;

            while (posn < list.Length)
            {
                list[posn] = TypedReference.ToObject(iter.GetNextArg());
                ++posn;
            }
            Out.WriteLine(format, list);
        }
コード例 #16
0
ファイル: ConsoleColor.cs プロジェクト: AlkindiX/packager
 /// <summary>
 /// Write the specified color, format, arg0, arg1, arg2, arg3 and .
 /// </summary>
 /// <param name="">.</param>
 /// <param name="format">Format.</param>
 /// <param name="arg0">Arg0.</param>
 /// <param name="arg1">Arg1.</param>
 /// <param name="arg2">Arg2.</param>
 /// <param name="arg3">Arg3.</param>
 public static void Write(System.ConsoleColor color, string format, object arg0, object arg1, object arg2, object arg3, __arglist
 )
 {
     ArgIterator argIterator = new ArgIterator (__arglist);
     int remainingCount = argIterator.GetRemainingCount ();
     object[] array = new object[remainingCount + 4];
     array [0] = arg0;
     array [1] = arg1;
     array [2] = arg2;
     array [3] = arg3;
     for (int i = 0; i < remainingCount; i++) {
         TypedReference nextArg = argIterator.GetNextArg ();
         array [i + 4] = TypedReference.ToObject (nextArg);
     }
     var old_font = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.Write (string.Format (format, array));
     Console.ForegroundColor = old_font;
 }
コード例 #17
0
 public static string Concat(object arg0, object arg1, object arg2, object arg3, __arglist)
 {
   ArgIterator iterator = new ArgIterator(__arglist);
   int num = iterator.GetRemainingCount() + 4;
   object[] objArray = new object[num];
   objArray[0] = arg0;
   objArray[1] = arg1;
   objArray[2] = arg2;
   objArray[3] = arg3;
   for (int i = 4; i < num; i++)
   {
     objArray[i] = TypedReference.ToObject(iterator.GetNextArg());
   }
   return Concat(objArray);
 }
コード例 #18
0
ファイル: Stdarg.cs プロジェクト: edgar-pek/VCDryad
 public static void va_end(va_list argp)
 {
 }
コード例 #19
0
ファイル: Stdarg.cs プロジェクト: edgar-pek/VCDryad
 // First attempt
 public static void va_start(va_list argp, object dontcare)
 {
 }
コード例 #20
0
ファイル: Stdio.cs プロジェクト: edgar-pek/VCDryad
 private static int getInt(ArgIterator ai)
 {
     TypedReference tr = ai.GetNextArg();
       Type t = __reftype(tr);
       if (t == typeof(int)) {
     return (int)(__refvalue(tr, int));
       }
       throw new FormatException("expecting an integer");
 }
コード例 #21
0
ファイル: argiterator.cs プロジェクト: wwkkww1983/ZJCredit
 public unsafe ArgIterator(RuntimeArgumentHandle arglist, void *ptr)
 {
     this = new ArgIterator(arglist.Value, ptr);
 }
コード例 #22
0
ファイル: Console.cs プロジェクト: sjyanxin/WPFSource
        public static void Write(String format, Object arg0, Object arg1, Object arg2, Object arg3, __arglist) 
        {
            Object[]   objArgs;
            int        argCount;
 
            ArgIterator args = new ArgIterator(__arglist);
 
            //+4 to account for the 4 hard-coded arguments at the beginning of the list. 
            argCount = args.GetRemainingCount() + 4;
 
            objArgs = new Object[argCount];

            //Handle the hard-coded arguments
            objArgs[0] = arg0; 
            objArgs[1] = arg1;
            objArgs[2] = arg2; 
            objArgs[3] = arg3; 

            //Walk all of the args in the variable part of the argument list. 
            for (int i=4; i<argCount; i++) {
                objArgs[i] = TypedReference.ToObject(args.GetNextArg());
            }
 
            Out.Write(format, objArgs);
        } 
コード例 #23
0
 public static extern string lua_pushvfstring(LuaState luaState, string fmt, ArgIterator argp);
コード例 #24
0
	public static void WriteLine(String format, Object arg0, Object arg1,
							     Object arg2, Object arg3, __arglist)
			{
				ArgIterator iter = new ArgIterator(__arglist);
				Object[] list = new Object [4 + iter.GetRemainingCount()];
				list[0] = arg0;
				list[1] = arg1;
				list[2] = arg2;
				list[3] = arg3;
				int posn = 4;
				while(posn < list.Length)
				{
					list[posn] = TypedReference.ToObject(iter.GetNextArg());
					++posn;
				}
				Out.WriteLine(format, list);
			}
コード例 #25
0
ファイル: Stdio.cs プロジェクト: edgar-pek/VCDryad
 private static unsafe string getString(ArgIterator ai)
 {
     TypedReference tr = ai.GetNextArg();
       Type t = __reftype(tr);
       if (t == typeof(sbyte*)) {
     return new String(__refvalue(tr, sbyte*));
       }
       throw new FormatException("expecting a string");
 }
コード例 #26
0
		public unsafe ArgIterator(RuntimeArgumentHandle arglist, void* ptr)
		{
			this = new ArgIterator(arglist.Value, ptr);
		}
コード例 #27
0
ファイル: Stdio.cs プロジェクト: edgar-pek/VCDryad
 private static char getChar(ArgIterator ai)
 {
     TypedReference tr = ai.GetNextArg();
       Type t = __reftype(tr);
       if (t == typeof(sbyte)) {
     return (char)(__refvalue(tr, sbyte));
       }
       throw new FormatException("expecting a char");
 }
コード例 #28
0
ファイル: Stdio.cs プロジェクト: edgar-pek/VCDryad
        public static int printf(sbyte* _Format, __arglist)
        {
            StringBuilder output = new StringBuilder();
              ArgIterator ai = new ArgIterator(__arglist);
              string format = new string(_Format);
              int i = 0, n = format.Length;

              bool after_parse_width = false;

              while (i < n) {
            char c = format[i];
            if (c == '%' || after_parse_width ) {
              if (i + 1 <= n) {
            i++;
            char next = format[i];
            switch (next) {
              // ignore width for now.
              case 'd': i++; output.AppendFormat("{0}", TypedReference.ToObject(ai.GetNextArg())); break;
              case 'c': i++; output.Append(getChar(ai)); break;
              case 'x': i++; output.AppendFormat("{0}", TypedReference.ToObject(ai.GetNextArg())); break;
              case 's': i++; output.Append(getString(ai)); break;
              case 'f': i++; output.AppendFormat("{0}", TypedReference.ToObject(ai.GetNextArg())); break;
              case 'l': i++;
                if (format[i] == 'f') {
                  i++;
                  output.AppendFormat("{0}", TypedReference.ToObject(ai.GetNextArg()));
                }
                else {
                  output.AppendFormat("{0}", TypedReference.ToObject(ai.GetNextArg()));
                }
                break;
              default:
                if (Char.IsDigit(next)) {
                  StringBuilder sb = new StringBuilder();
                  while (i < n && Char.IsDigit(format[i])) {
                    sb.Append(format[i]);
                    i++;
                  }
                  width = int.Parse(sb.ToString());
                  width2 = 0;
                  if (format[i] == '.') {
                    i++;
                    StringBuilder sb2 = new StringBuilder();
                    while (i < n && Char.IsDigit(format[i])) {
                      sb2.Append(format[i]);
                      i++;
                    }
                    width2 = int.Parse(sb2.ToString());
                  }
                }
                break;
            }
              }
              else break; // break the loop
            }
            else if (c == '\\') {
              // it is impossible for the next char to be out of bound.
              i++;
              char escaped = format[i];
              output.Append(c);
              output.Append(escaped);
              i ++;
            }
            else {
              output.Append(c);
              i++;
            }
              }
              Console.Write(output.ToString());
              return 0;
        }
コード例 #29
0
 public static string lua_pushvfstring(string fmt, ArgIterator argp) => lua_pushvfstring(_state, fmt, argp);
コード例 #30
0
		public ArgIterator(RuntimeArgumentHandle arglist)
		{
			this = new ArgIterator(arglist.Value);
		}
コード例 #31
0
ファイル: NativeFunction.cs プロジェクト: WLSF/SampSharp
        private object[] CreateRefArray(RuntimeArgumentHandle handle)
        {
            var iterator = new ArgIterator(handle);
            var len = iterator.GetRemainingCount();

            if ((_format != null && _format.Length != len) || (_format == null && len != 0))
                throw new ArgumentException("Invalid arguments");

            var args = new object[len];
            for (var idx = 0; idx < len; idx++)
                args[idx] = TypedReference.ToObject(iterator.GetNextArg());

            return args;
        }
コード例 #32
0
		public static void Write(string format, object arg0, object arg1, object arg2, object arg3, __arglist)
		{
			ArgIterator argIterator = new ArgIterator(__arglist);
			int num = argIterator.GetRemainingCount() + 4;
			object[] array = new object[num];
			array[0] = arg0;
			array[1] = arg1;
			array[2] = arg2;
			array[3] = arg3;
			for (int i = 4; i < num; i++)
			{
				array[i] = TypedReference.ToObject(argIterator.GetNextArg());
			}
			Console.Out.Write(format, array);
		}
コード例 #33
0
ファイル: argiterator.cs プロジェクト: wwkkww1983/ZJCredit
 public ArgIterator(RuntimeArgumentHandle arglist)
 {
     this = new ArgIterator(arglist.Value);
 }
コード例 #34
0
	public static String Concat(Object obj1, Object obj2,
								Object obj3, Object obj4,
								__arglist)
			{
				ArgIterator iter = new ArgIterator(__arglist);
				String[] list = new String [4 + iter.GetRemainingCount()];
				list[0] = (obj1 != null ? obj1.ToString() : null);
				list[1] = (obj2 != null ? obj2.ToString() : null);
				list[2] = (obj3 != null ? obj3.ToString() : null);
				list[3] = (obj4 != null ? obj4.ToString() : null);
				int posn = 4;
				Object obj;
				while(posn < list.Length)
				{
					obj = TypedReference.ToObject(iter.GetNextArg());
					if(obj != null)
					{
						list[posn] = obj.ToString();
					}
					else
					{
						list[posn] = null;
					}
					++posn;
				}
				return Concat(list);
			}
コード例 #35
0
 public static string lua_pushvfstring(this LuaState luaState, string fmt, ArgIterator argp) => Lua.lua_pushvfstring(luaState, fmt, argp);
コード例 #36
0
ファイル: Stdio.cs プロジェクト: edgar-pek/VCDryad
 private static double getFloat(ArgIterator ai)
 {
     TypedReference tr = ai.GetNextArg();
       Type t = __reftype(tr);
       if (t == typeof(double)) {
     return __refvalue( tr, double);
       }
       throw new FormatException("expecting a double");
 }
コード例 #37
0
ファイル: Console.cs プロジェクト: TelsaV/corefx
        private static object[] ToObjectArgs(object arg0, object arg1, object arg2, object arg3, ArgIterator args)
        {
            var objArgs = new object[4 + args.GetRemainingCount()];

            objArgs[0] = arg0;
            objArgs[1] = arg1;
            objArgs[2] = arg2;
            objArgs[3] = arg3;

            for (int i = 4; i < objArgs.Length; i++)
            {
                objArgs[i] = TypedReference.ToObject(args.GetNextArg());
            }
            return(objArgs);
        }
コード例 #38
0
 public void InitializeSamples()
 {
     m_emptyIterator = new ArgIterator(new string[] { });
     m_singleItemIterator = new ArgIterator(new string[] { "one" });
     m_fiveItemIterator = new ArgIterator(new string[] { "1", "2", "3", "4", "5" });
 }
コード例 #39
0
ファイル: Console.cs プロジェクト: razzfazz/mono
		public static void WriteLine (string format, object arg0, object arg1, object arg2, object arg3, __arglist)
		{
			ArgIterator iter = new ArgIterator (__arglist);
			int argCount = iter.GetRemainingCount();

			object[] args = new object [argCount + 4];
			args [0] = arg0;
			args [1] = arg1;
			args [2] = arg2;
			args [3] = arg3;
			for (int i = 0; i < argCount; i++) {
				TypedReference typedRef = iter.GetNextArg ();
				args [i + 4] = TypedReference.ToObject (typedRef);
			}

			stdout.WriteLine (String.Format (format, args));
		}
コード例 #40
0
 public static extern uint FormatMessage(int dwFlags, ref long lpSource, uint dwMessageId, uint dwLanguageZId, StringBuilder lpBuffer, uint nSize, System.ArgIterator Arguments);