Example #1
0
        public static int Execute(tCLIFile *pThis, string[] args)
        {
            tThread *          pThread;
            /*HEAP_PTR*/ byte *pArgs;
            int i;

            // Create a string array for the program arguments
            // Don't include the argument that is the program name.
            pArgs = System_Array.NewVector(Type.types[Type.TYPE_SYSTEM_ARRAY_STRING], (uint)(args.Length - 1));
            Heap.MakeUndeletable(pArgs);
            for (i = 1; i < args.Length; i++)
            {
                tSystemString *pArgStr = System_String.FromMonoString(args[i]);
                System_Array.StoreElement(pArgs, (uint)(i - 1), (byte *)&pArgStr);
            }

            // Create the main application thread
            pThread = Thread.New();
            Thread.SetEntryPoint(pThread, pThis->pMetaData, pThis->entryPoint, (byte *)&pArgs, (uint)sizeof(void *));

            return(Thread.Execute());
        }
Example #2
0
        private static tAsyncCall *ToString_Internal(byte *pThis, byte *pParams, byte *pReturnValue, System.TypeCode typecode)
        {
            tSystemString *pFormat;
//            byte* pFormatProvider;
            string         format, s;
            tSystemString *pResult;

            pFormat = (*((tSystemString **)(pParams + 0)));
            format  = ToMonoString(pFormat);

            // Ignore IFormatProvider for now!
            //pFormatProvider = (*((tSystemString**)(pParams + Sys.S_PTR)));

            switch (typecode)
            {
            case System.TypeCode.Byte:
                s = (*(byte *)pThis).ToString(format);
                break;

            case System.TypeCode.SByte:
                s = (*(sbyte *)pThis).ToString(format);
                break;

            case System.TypeCode.UInt16:
                s = (*(ushort *)pThis).ToString(format);
                break;

            case System.TypeCode.Int16:
                s = (*(short *)pThis).ToString(format);
                break;

            case System.TypeCode.UInt32:
                s = (*(uint *)pThis).ToString(format);
                break;

            case System.TypeCode.Int32:
                s = (*(int *)pThis).ToString(format);
                break;

            case System.TypeCode.UInt64:
                s = (*(ulong *)pThis).ToString(format);
                break;

            case System.TypeCode.Int64:
                s = (*(long *)pThis).ToString(format);
                break;

            case System.TypeCode.Single:
                s = (*(float *)pThis).ToString(format);
                break;

            case System.TypeCode.Double:
                s = (*(double *)pThis).ToString(format);
                break;

            default:
                throw new System.NotImplementedException();
            }

            pResult = System_String.FromMonoString(s);

            Sys.INTERNALCALL_RESULT_PTR(pReturnValue, pResult);

            return(null);
        }