/* -*-C-*-
-$Id: ntscreen.c,v 1.41 2000/01/13 16:27:52 cph Exp $
+$Id: ntscreen.c,v 1.42 2000/04/19 03:21:06 cph Exp $
Copyright (c) 1993-2000 Massachusetts Institute of Technology
static VOID RegisterScreen (SCREEN);
static VOID UnregisterScreen (SCREEN);
-#ifdef TRACE_SCREEN_MSGS
static const char * translate_message_code (UINT);
-#endif
/* FILE GLOBAL VARIABLES */
static SCREEN_EVENT_LINK * event_queue_head;
static SCREEN_EVENT_LINK * event_queue_tail;
-#ifdef TRACE_SCREEN_MSGS
-FILE * trace_file;
-#endif
+FILE * win32_trace_file;
+unsigned long win32_trace_level;
\f
static long
screen_x_extra (SCREEN screen)
char * envvar = getenv (color_symbol);
if (envvar == NULL)
return FALSE;
- /* Use GetNearestColor to ensure consistency with the background text color. */
+ /* Use GetNearestColor to ensure consistency with the background
+ text color. */
hdc = GetDC (hWnd);
*color = GetNearestColor (hdc, strtoul (envvar, NULL, 0));
ReleaseDC (hWnd, hdc);
if (font_name)
ScreenSetDefaultFont (font_name);
-#ifdef TRACE_SCREEN_MSGS
- trace_file = (fopen (TRACE_SCREEN_FILENAME, "w"));
-#endif
+ win32_trace_file = 0;
+ win32_trace_level = 0;
#ifdef WINDOWSLOSES
init_MIT_Keyboard ();
{
SCREEN screen = GETSCREEN (hWnd);
-#ifdef TRACE_SCREEN_MSGS
- if (trace_file)
+ if (win32_trace_level > 0)
{
const char * name = (translate_message_code (uMsg));
- fprintf (trace_file, "hWnd=0x%x, ", hWnd);
+ fprintf (win32_trace_file, "ScreenWndProc: ");
+ fprintf (win32_trace_file, "hWnd=0x%x, ", hWnd);
if (name)
- fprintf (trace_file, "uMsg=%s, ", name);
+ fprintf (win32_trace_file, "uMsg=%s, ", name);
else
- fprintf (trace_file, "uMsg=0x%x, ", uMsg);
- fprintf (trace_file, "wParam=0x%x, lParam=0x%x\n", wParam, lParam);
- fflush (trace_file);
+ fprintf (win32_trace_file, "uMsg=0x%x, ", uMsg);
+ fprintf (win32_trace_file, "wParam=0x%x, lParam=0x%x\n",
+ wParam, lParam);
+ fflush (win32_trace_file);
}
-#endif
switch (uMsg)
{
case WM_CREATE:
((event -> event.key) . ch) = ch;
((event -> event.key) . control_key_state) = modifiers;
-#ifdef TRACE_SCREEN_MSGS
- fprintf
- (trace_file,
- "make_key_event: handle=0x%x keycode=0x%x scancode=0x%x ch=0x%x modifiers=0x%x\n",
- handle, wparam, (LP_SCAN_CODE (lparam)), ch, modifiers);
- fflush (trace_file);
-#endif
+ if (win32_trace_level > 0)
+ {
+ fprintf (win32_trace_file, "make_key_event: ");
+ fprintf
+ (win32_trace_file,
+ "handle=0x%x keycode=0x%x scancode=0x%x ch=0x%x modifiers=0x%x\n",
+ handle, wparam, (LP_SCAN_CODE (lparam)), ch, modifiers);
+ fflush (win32_trace_file);
+ }
}
/* Process WM_KEYDOWN and WM_SYSKEYDOWN. Return 1 to indicate that
Screen_read_event (SCREEN_EVENT * event)
{
int result = (read_event (0, 0, 1, event));
-#ifdef TRACE_SCREEN_MSGS
- fprintf (trace_file, "Screen_read_event: result=%d\n", result);
- fflush (trace_file);
-#endif
+ if (win32_trace_level > 1)
+ {
+ fprintf (win32_trace_file, "Screen_read_event: result=%d\n", result);
+ fflush (win32_trace_file);
+ }
return (result);
}
return change_colour (screen, colour, &screen->rgbBGColour);
}
\f
-#ifdef TRACE_SCREEN_MSGS
static const char *
translate_message_code (UINT uMsg)
{
default: return (0);
}
}
-#endif
/* -*-C-*-
-$Id: prntio.c,v 1.11 1999/02/23 06:13:14 cph Exp $
+$Id: prntio.c,v 1.12 2000/04/19 03:21:09 cph Exp $
-Copyright (c) 1993-1999 Massachusetts Institute of Technology
+Copyright (c) 1993-2000 Massachusetts Institute of Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
PRIMITIVE_RETURN (ulong_to_integer (arg_channel (1)));
}
+DEFINE_PRIMITIVE ("WIN32-GUI-TRACE", Prim_win32_gui_trace, 2, 2, 0)
+{
+ PRIMITIVE_HEADER (2);
+ {
+ unsigned long old_level = win32_trace_level;
+ win32_trace_level = (arg_ulong_integer (1));
+ if (win32_trace_file != 0)
+ {
+ fflush (win32_trace_file);
+ fclose (win32_trace_file);
+ win32_trace_file = 0;
+ }
+ if (win32_trace_level > 0)
+ win32_trace_file
+ = (fopen ((((ARG_REF (2)) == SHARP_F)
+ ? WIN32_TRACE_FILENAME
+ : (STRING_ARG (2))),
+ "w"));
+ }
+ PRIMITIVE_RETURN (UNSPECIFIC);
+}
+
DEFINE_PRIMITIVE ("NT:MSGWAITFORMULTIPLEOBJECTS", Prim_nt_msgwaitformultipleobjects, 4, 4, 0)
{
PRIMITIVE_HEADER (4);
wait_for_multiple_objects (unsigned long n_channels, Tchannel * channels,
long console_index, int blockp)
{
-#ifdef TRACE_SCREEN_MSGS
- fprintf
- (trace_file,
- "wait_for_multiple_objects: n_channels=%d console_index=%d blockp=%d\n",
- n_channels, console_index, blockp);
- fflush (trace_file);
+ if (win32_trace_level > 1)
+ {
+ fprintf (win32_trace_file, "wait_for_multiple_objects: ");
+ fprintf (win32_trace_file, "n_channels=%d console_index=%d blockp=%d\n",
+ n_channels, console_index, blockp);
+ fflush (win32_trace_file);
+ }
{
long result
= (wait_for_multiple_objects_1
(n_channels, channels, console_index, blockp));
- fprintf (trace_file, "wait_for_multiple_objects: result=0x%x\n", result);
- fflush (trace_file);
+ if (win32_trace_level > 1)
+ {
+ fprintf (win32_trace_file, "wait_for_multiple_objects: ");
+ fprintf (win32_trace_file, "result=0x%x\n", result);
+ fflush (win32_trace_file);
+ }
return (result);
}
-#else
- return
- (wait_for_multiple_objects_1
- (n_channels, channels, console_index, blockp));
-#endif
}
static long