Ejemplo n.º 1
0
        //private static Pipes.Standard.StandardInpoint StdIn;

        public static void Main()
        {
            BasicConsole.WriteLine("Device Manager started.");

            Hardware.Processes.ProcessManager.CurrentProcess.InitHeap();
            SystemCallResults SysCallResult = SystemCalls.StartThread(GCCleanupTask.Main, out GCThreadId);

            if (SysCallResult != SystemCallResults.OK)
            {
                BasicConsole.WriteLine("Device Manager: GC thread failed to create!");
            }

            try
            {
                StdOut = new Pipes.Standard.StandardOutpoint(true);
                int StdOutPipeId = StdOut.WaitForConnect();

                //int numOutpoints;
                //Pipes.BasicOutpoint.GetNumPipeOutpoints(out numOutpoints, out SysCallResult, Pipes.PipeClasses.Standard, Pipes.PipeSubclasses.Standard_In);
                //if (SysCallResult == SystemCallResults.OK && numOutpoints > 0)
                //{
                //    Pipes.PipeOutpointDescriptor[] OutpointDescriptors;
                //    Pipes.BasicOutpoint.GetOutpointDescriptors(numOutpoints, out SysCallResult, out OutpointDescriptors, Pipes.PipeClasses.Standard, Pipes.PipeSubclasses.Standard_In);
                //
                //    if (SysCallResult == SystemCallResults.OK)
                //    {
                //        for (int i = 0; i < OutpointDescriptors.Length; i++)
                //        {
                //            Pipes.PipeOutpointDescriptor Descriptor = OutpointDescriptors[i];
                //            //TODO: Filter to target
                //            StdIn = new Pipes.Standard.StandardInpoint(Descriptor.ProcessId, false);
                //        }
                //    }
                //}

                uint loops = 0;
                while (!Terminating)
                {
                    try
                    {
                        StdOut.Write(StdOutPipeId, "DM > Hello, world! (" + (FOS_System.String)loops++ + ")\n", true);
                        SystemCalls.SleepThread(SystemCalls.IndefiniteSleepThread);
                    }
                    catch
                    {
                        BasicConsole.WriteLine("DM > Error writing to StdOut!");
                        BasicConsole.WriteLine(ExceptionMethods.CurrentException.Message);
                    }

                    SystemCalls.SleepThread(1000);
                }
            }
            catch
            {
                BasicConsole.WriteLine("DM > Error initialising!");
                BasicConsole.WriteLine(ExceptionMethods.CurrentException.Message);
            }
        }
Ejemplo n.º 2
0
        //private static Pipes.Standard.StandardInpoint StdIn;

        public static void Main()
        {
            BasicConsole.WriteLine("Device Manager started.");

            Hardware.Processes.ProcessManager.CurrentProcess.InitHeap();
            SystemCallResults SysCallResult = SystemCalls.StartThread(GCCleanupTask.Main, out GCThreadId);
            if (SysCallResult != SystemCallResults.OK)
            {
                BasicConsole.WriteLine("Device Manager: GC thread failed to create!");
            }

            try
            {
                StdOut = new Pipes.Standard.StandardOutpoint(true);
                int StdOutPipeId = StdOut.WaitForConnect();

                //int numOutpoints;
                //Pipes.BasicOutpoint.GetNumPipeOutpoints(out numOutpoints, out SysCallResult, Pipes.PipeClasses.Standard, Pipes.PipeSubclasses.Standard_In);
                //if (SysCallResult == SystemCallResults.OK && numOutpoints > 0)
                //{
                //    Pipes.PipeOutpointDescriptor[] OutpointDescriptors;
                //    Pipes.BasicOutpoint.GetOutpointDescriptors(numOutpoints, out SysCallResult, out OutpointDescriptors, Pipes.PipeClasses.Standard, Pipes.PipeSubclasses.Standard_In);
                //
                //    if (SysCallResult == SystemCallResults.OK)
                //    {
                //        for (int i = 0; i < OutpointDescriptors.Length; i++)
                //        {
                //            Pipes.PipeOutpointDescriptor Descriptor = OutpointDescriptors[i];
                //            //TODO: Filter to target
                //            StdIn = new Pipes.Standard.StandardInpoint(Descriptor.ProcessId, false);
                //        }
                //    }
                //}

                uint loops = 0;
                while (!Terminating)
                {
                    try
                    {
                        StdOut.Write(StdOutPipeId, "DM > Hello, world! (" + (FOS_System.String)loops++ + ")\n", true);
                        SystemCalls.SleepThread(SystemCalls.IndefiniteSleepThread);
                    }
                    catch
                    {
                        BasicConsole.WriteLine("DM > Error writing to StdOut!");
                        BasicConsole.WriteLine(ExceptionMethods.CurrentException.Message);
                    }

                    SystemCalls.SleepThread(1000);
                }
            }
            catch
            {
                BasicConsole.WriteLine("DM > Error initialising!");
                BasicConsole.WriteLine(ExceptionMethods.CurrentException.Message);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Clears the screen (currently by outputting 25 new lines, meaning scrolling back is still possible).
 /// </summary>
 public override void Clear()
 {
     //25 new lines clear out the screen
     StdOut.Write(StdOutPipeId, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", true);
 }