Removing console specific defines [2/4]

Eric Pouech eric.pouech at wanadoo.fr
Mon Jan 6 15:54:33 CST 2003


See 1/4 for the details.
A+
-- 
Eric Pouech
-------------- next part --------------
Name:          con_edit
ChangeLog:     - Set the edition mode as a specific attribute, not an extension of the console mode
License:       X11
GenDate:       2003/01/06 21:45:55 UTC
ModifiedFiles: dlls/kernel/console.c dlls/kernel/editline.c dlls/kernel/console_private.h server/console.c server/console.h server/protocol.def include/wincon.h
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/kernel/console.c,v
retrieving revision 1.12
diff -u -u -r1.12 console.c
--- dlls/kernel/console.c	12 Dec 2002 23:34:02 -0000	1.12
+++ dlls/kernel/console.c	5 Jan 2003 21:27:00 -0000
@@ -1053,7 +1053,7 @@
 	if (!S_EditString || S_EditString[S_EditStrPos] == 0)
 	{
 	    if (S_EditString) HeapFree(GetProcessHeap(), 0, S_EditString);
-	    if (!(S_EditString = CONSOLE_Readline(hConsoleInput, mode & WINE_ENABLE_LINE_INPUT_EMACS)))
+	    if (!(S_EditString = CONSOLE_Readline(hConsoleInput)))
 		return FALSE;
 	    S_EditStrPos = 0;
 	}
@@ -2238,6 +2238,24 @@
     {
         req->handle = 0;
         if (!wine_server_call_err( req )) ret = reply->history_index;
+    }
+    SERVER_END_REQ;
+    return ret;
+}
+
+/******************************************************************
+ *		CONSOLE_GetEditionMode
+ *
+ *
+ */
+BOOL CONSOLE_GetEditionMode(HANDLE hConIn, int* mode)
+{
+    unsigned ret = FALSE;
+    SERVER_START_REQ(get_console_input_info)
+    {
+        req->handle = hConIn;
+        if ((ret = !wine_server_call_err( req )))
+            *mode = reply->edition_mode;
     }
     SERVER_END_REQ;
     return ret;
Index: dlls/kernel/editline.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/kernel/editline.c,v
retrieving revision 1.2
diff -u -u -r1.2 editline.c
--- dlls/kernel/editline.c	4 Sep 2002 18:41:03 -0000	1.2
+++ dlls/kernel/editline.c	5 Jan 2003 21:28:06 -0000
@@ -785,7 +785,7 @@
  *
  * ====================================================================*/
 
-WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, int use_emacs)
+WCHAR* CONSOLE_Readline(HANDLE hConsoleIn)
 {
     WCEL_Context	ctx;
     INPUT_RECORD	ir;
@@ -794,10 +794,15 @@
     unsigned		ofs;
     void		(*func)(struct WCEL_Context* ctx);
     DWORD               ks;
+    int                 use_emacs;
 
     memset(&ctx, 0, sizeof(ctx));
     ctx.hConIn = hConsoleIn;
     WCEL_HistoryInit(&ctx);
+
+    if (!CONSOLE_GetEditionMode(hConsoleIn, &use_emacs))
+        use_emacs = 0;
+
     if ((ctx.hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL,
 				    OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE ||
 	!GetConsoleScreenBufferInfo(ctx.hConOut, &ctx.csbi))
Index: dlls/kernel/console_private.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/kernel/console_private.h,v
retrieving revision 1.1
diff -u -u -r1.1 console_private.h
--- dlls/kernel/console_private.h	4 Sep 2002 18:41:03 -0000	1.1
+++ dlls/kernel/console_private.h	5 Jan 2003 21:28:28 -0000
@@ -28,8 +28,9 @@
 extern BOOL     CONSOLE_AppendHistory(const WCHAR *p);
 extern unsigned CONSOLE_GetNumHistoryEntries(void);
 extern void     CONSOLE_FillLineUniform(HANDLE hConsoleOutput, int i, int j, int len, LPCHAR_INFO lpFill);
+extern BOOL     CONSOLE_GetEditionMode(HANDLE, int*);
 
 /* editline.c */
-extern WCHAR*   CONSOLE_Readline(HANDLE, int);
+extern WCHAR*   CONSOLE_Readline(HANDLE);
 
 #endif  /* __WINE_CONSOLE_PRIVATE_H */
Index: server/console.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/server/console.c,v
retrieving revision 1.43
diff -u -u -r1.43 console.c
--- server/console.c	5 Jan 2003 01:07:34 -0000	1.43
+++ server/console.c	5 Jan 2003 21:12:24 -0000
@@ -241,6 +241,7 @@
     console_input->history       = calloc( console_input->history_size, sizeof(WCHAR*) );
     console_input->history_index = 0;
     console_input->history_mode  = 0;
+    console_input->edition_mode  = 0;
 
     if (!console_input->history || !console_input->evt)
     {
@@ -666,6 +667,10 @@
 	console->history = mem;
 	console->history_size = req->history_size;
     }
+    if (req->mask & SET_CONSOLE_INPUT_INFO_EDITION_MODE)
+    {
+        console->edition_mode = req->edition_mode;
+    }
     release_object( console );
     return 1;
  error:
@@ -1363,6 +1368,8 @@
     reply->history_mode  = console->history_mode;
     reply->history_size  = console->history_size;
     reply->history_index = console->history_index;
+    reply->edition_mode  = console->edition_mode;
+
     release_object( console );
 }
 
Index: server/console.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/server/console.h,v
retrieving revision 1.5
diff -u -u -r1.5 console.h
--- server/console.h	30 May 2002 20:12:58 -0000	1.5
+++ server/console.h	5 Jan 2003 21:09:28 -0000
@@ -41,6 +41,7 @@
     int                          history_size;  /* number of entries in history array */
     int                          history_index; /* number of used entries in history array */
     int                          history_mode;  /* mode of history (non zero means remove doubled strings */
+    int                          edition_mode;  /* index to edition mode flavors */
 };
 
 /* console functions */
Index: server/protocol.def
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/server/protocol.def,v
retrieving revision 1.53
diff -u -u -r1.53 protocol.def
--- server/protocol.def	25 Nov 2002 02:47:32 -0000	1.53
+++ server/protocol.def	5 Jan 2003 21:08:34 -0000
@@ -853,12 +864,14 @@
     obj_handle_t active_sb;     /* active screen buffer */
     int          history_mode;  /* whether we duplicate lines in history */
     int          history_size;  /* number of lines in history */
+    int          edition_mode;  /* index to the edition mode flavors */
     VARARG(title,unicode_str);  /* console title */
 @END
 #define SET_CONSOLE_INPUT_INFO_ACTIVE_SB        0x01
 #define SET_CONSOLE_INPUT_INFO_TITLE            0x02
 #define SET_CONSOLE_INPUT_INFO_HISTORY_MODE     0x04
 #define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE     0x08
+#define SET_CONSOLE_INPUT_INFO_EDITION_MODE     0x10
 
 
 /* Get info about a console (input only) */
@@ -868,6 +881,7 @@
     int          history_mode;  /* whether we duplicate lines in history */
     int          history_size;  /* number of lines in history */
     int          history_index; /* number of used lines in history */
+    int          edition_mode;  /* index to the edition mode flavors */
     VARARG(title,unicode_str);  /* console title */
 @END
 
Index: include/wincon.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/include/wincon.h,v
retrieving revision 1.18
diff -u -u -r1.18 wincon.h
--- include/wincon.h	21 Nov 2002 23:45:31 -0000	1.18
+++ include/wincon.h	5 Jan 2003 21:29:18 -0000
@@ -35,8 +35,6 @@
 #define ENABLE_ECHO_INPUT      0x04
 #define ENABLE_WINDOW_INPUT    0x08
 #define ENABLE_MOUSE_INPUT     0x10
-/* Wine only code (extension) */
-#define WINE_ENABLE_LINE_INPUT_EMACS 0x80
 
 #define ENABLE_PROCESSED_OUTPUT   0x01
 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02


More information about the wine-patches mailing list