dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnetlib/runtime/System Console.cs, 1.15, 1.16 Cons


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/runtime/System Console.cs, 1.15, 1.16 ConsoleKey.cs, 1.1, 1.2
Date: Mon, 03 Nov 2003 05:20:38 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv8431/runtime/System

Modified Files:
        Console.cs ConsoleKey.cs 
Log Message:


Modifications to the C# library to match internalcall changes for the
extended console.


Index: Console.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Console.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Console.cs  2 Nov 2003 02:55:24 -0000       1.15
--- Console.cs  3 Nov 2003 05:20:36 -0000       1.16
***************
*** 603,611 ****
  
        // Clear the display to the current foreground and background color.
        public static void Clear()
                        {
                                lock(typeof(Console))
                                {
!                                       SpecialMode();
                                        Stdio.Clear();
                                }
--- 603,626 ----
  
        // Clear the display to the current foreground and background color.
+       // If "Clear" is the first extended console method called, then it
+       // indicates that the terminal should enter the "alternative" mode
+       // used for programs like "vi".  Returning to the normal mode will
+       // restore what used to be displayed previously.
        public static void Clear()
                        {
                                lock(typeof(Console))
                                {
!                                       if(!specialMode)
!                                       {
!                                               specialMode = true;
!                                               if(treatControlCAsInput)
!                                               {
!                                                       
Stdio.SetConsoleMode(Stdio.MODE_RAW_ALT);
!                                               }
!                                               else
!                                               {
!                                                       
Stdio.SetConsoleMode(Stdio.MODE_CBREAK_ALT);
!                                               }
!                                       }
                                        Stdio.Clear();
                                }
***************
*** 625,631 ****
                                        char ch;
                                        int key, modifiers;
!                                       Stdio.ReadKey(out ch, out key, out 
modifiers);
!                                       return new ConsoleKeyInfo
!                                               (ch, (ConsoleKey)key, 
(ConsoleModifiers)modifiers);
                                }
                        }
--- 640,663 ----
                                        char ch;
                                        int key, modifiers;
!                                       for(;;)
!                                       {
!                                               Stdio.ReadKey(out ch, out key, 
out modifiers);
!                                               if(key == 0x1202)               
// Interrupt
!                                               {
!                                                       
HandleCancel(ConsoleSpecialKeys.ControlC);
!                                                       continue;
!                                               }
!                                               else if(key == 0x1203)  // 
CtrlBreak
!                                               {
!                                                       
HandleCancel(ConsoleSpecialKeys.ControlBreak);
!                                                       continue;
!                                               }
!                                               if(!intercept && ch != '\0')
!                                               {
!                                                       Stdio.StdWrite(1, ch);
!                                               }
!                                               return new ConsoleKeyInfo
!                                                       (ch, (ConsoleKey)key, 
(ConsoleModifiers)modifiers);
!                                       }
                                }
                        }
***************
*** 827,842 ****
        public static event ConsoleCancelEventHandler CancelKeyPress;
  
!       // Method that is called from the runtime engine to handle "cancel" 
events.
!       // Returns "false" to quit the application, or "true" to continue.
!       private static bool HandleCancel(int specialKeys)
                        {
                                ConsoleCancelEventArgs args;
!                               args = new ConsoleCancelEventArgs
!                                       ((ConsoleSpecialKeys)specialKeys);
                                if(CancelKeyPress != null)
                                {
                                        CancelKeyPress(null, args);
                                }
!                               return args.Cancel;
                        }
  
--- 859,876 ----
        public static event ConsoleCancelEventHandler CancelKeyPress;
  
!       // Method that is called to handle "cancel" events.
!       private static void HandleCancel(ConsoleSpecialKeys specialKeys)
                        {
                                ConsoleCancelEventArgs args;
!                               args = new ConsoleCancelEventArgs(specialKeys);
                                if(CancelKeyPress != null)
                                {
                                        CancelKeyPress(null, args);
                                }
!                               if(!(args.Cancel))
!                               {
!                                       NormalMode();
!                                       Environment.Exit(1);
!                               }
                        }
  

Index: ConsoleKey.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/ConsoleKey.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConsoleKey.cs       1 Nov 2003 11:53:51 -0000       1.1
--- ConsoleKey.cs       3 Nov 2003 05:20:36 -0000       1.2
***************
*** 171,174 ****
--- 171,180 ----
        OemClear                        = 0xFE,
  
+       // Special key codes that are used internally by our implementation.
+       //SizeChanged           = 0x1200,               // Window size has 
changed.
+       //Resumed                       = 0x1201,               // Resumed 
after CTRL-Z suspend.
+       //Interrupt                     = 0x1202,               // CTRL-C 
interrupt detected.
+       //CtrlBreak                     = 0x1203,               // CTRL-BREAK 
interrupt detected.
+ 
  }; // enum ConsoleKey
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]