# HG changeset patch # User Juanma Barranquero # Date 1195071777 0 # Node ID 0ca197abc593164d87cf4ec5d78b045eca8f252b # Parent 892ada09f04477687e251f306a557ce17b9a3dab (Fw32_registered_hot_keys): Don't return the nil values corresponding to deleted entries; they are an implementation detail. (gray_bitmap_width, gray_bitmap_height, gray_bitmap_bits): Remove variables. (Fw32_define_rgb_color, Fw32_load_color_file): Fix typos in docstrings. (Fx_server_version): Reflow docstring. (Fw32_shell_execute): Doc fixes. diff -r 892ada09f044 -r 0ca197abc593 src/w32fns.c --- a/src/w32fns.c Wed Nov 14 10:26:09 2007 +0000 +++ b/src/w32fns.c Wed Nov 14 20:22:57 2007 +0000 @@ -73,14 +73,6 @@ extern char *lispy_function_keys[]; -/* The gray bitmap `bitmaps/gray'. This is done because w32term.c uses - it, and including `bitmaps/gray' more than once is a problem when - config.h defines `static' as an empty replacement string. */ - -int gray_bitmap_width = gray_width; -int gray_bitmap_height = gray_height; -unsigned char *gray_bitmap_bits = gray_bits; - /* The colormap for converting color names to RGB values */ Lisp_Object Vw32_color_map; @@ -460,7 +452,7 @@ DEFUN ("w32-define-rgb-color", Fw32_define_rgb_color, Sw32_define_rgb_color, 4, 4, 0, doc: /* Convert RGB numbers to a windows color reference and associate with NAME. -This adds or updates a named color to w32-color-map, making it +This adds or updates a named color to `w32-color-map', making it available for use. The original entry's RGB ref is returned, or nil if the entry is new. */) (red, green, blue, name) @@ -475,7 +467,7 @@ CHECK_NUMBER (blue); CHECK_STRING (name); - XSETINT (rgb, RGB(XUINT (red), XUINT (green), XUINT (blue))); + XSETINT (rgb, RGB (XUINT (red), XUINT (green), XUINT (blue))); BLOCK_INPUT; @@ -500,7 +492,7 @@ DEFUN ("w32-load-color-file", Fw32_load_color_file, Sw32_load_color_file, 1, 1, 0, doc: /* Create an alist of color entries from an external file. -Assign this value to w32-color-map to replace the existing color map. +Assign this value to `w32-color-map' to replace the existing color map. The file should define one named RGB color per line like so: R G B name @@ -935,7 +927,7 @@ int size; color = colorname + 1; - size = strlen(color); + size = strlen (color); if (size == 3 || size == 6 || size == 9 || size == 12) { UINT colorval; @@ -953,11 +945,11 @@ /* The check for 'x' in the following conditional takes into account the fact that strtol allows a "0x" in front of our numbers, and we don't. */ - if (!isxdigit(color[0]) || color[1] == 'x') + if (!isxdigit (color[0]) || color[1] == 'x') break; t = color[size]; color[size] = '\0'; - value = strtoul(color, &end, 16); + value = strtoul (color, &end, 16); color[size] = t; if (errno == ERANGE || end - color != size) break; @@ -987,7 +979,7 @@ } } } - else if (strnicmp(colorname, "rgb:", 4) == 0) + else if (strnicmp (colorname, "rgb:", 4) == 0) { char *color; UINT colorval; @@ -1004,9 +996,9 @@ /* The check for 'x' in the following conditional takes into account the fact that strtol allows a "0x" in front of our numbers, and we don't. */ - if (!isxdigit(color[0]) || color[1] == 'x') + if (!isxdigit (color[0]) || color[1] == 'x') break; - value = strtoul(color, &end, 16); + value = strtoul (color, &end, 16); if (errno == ERANGE) break; switch (end - color) @@ -1042,7 +1034,7 @@ color = end + 1; } } - else if (strnicmp(colorname, "rgbi:", 5) == 0) + else if (strnicmp (colorname, "rgbi:", 5) == 0) { /* This is an RGB Intensity specification. */ char *color; @@ -1058,7 +1050,7 @@ double value; UINT val; - value = strtod(color, &end); + value = strtod (color, &end); if (errno == ERANGE) break; if (value < 0.0 || value > 1.0) @@ -1556,7 +1548,6 @@ #endif /* TODO */ } -/* Defined in w32term.c. */ void x_set_cursor_color (f, arg, oldval) struct frame *f; @@ -1910,7 +1901,7 @@ name = ENCODE_SYSTEM (name); BLOCK_INPUT; - SetWindowText(FRAME_W32_WINDOW (f), SDATA (name)); + SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); UNBLOCK_INPUT; } } @@ -1962,7 +1953,7 @@ name = ENCODE_SYSTEM (name); BLOCK_INPUT; - SetWindowText(FRAME_W32_WINDOW (f), SDATA (name)); + SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); UNBLOCK_INPUT; } } @@ -2009,7 +2000,7 @@ w32_load_cursor (LPCTSTR name) { /* Try first to load cursor from application resource. */ - Cursor cursor = LoadImage ((HINSTANCE) GetModuleHandle(NULL), + Cursor cursor = LoadImage ((HINSTANCE) GetModuleHandle (NULL), name, IMAGE_CURSOR, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED); if (!cursor) @@ -2050,10 +2041,10 @@ { return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, /* Position and size of scroll bar. */ - XINT(bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM, - XINT(bar->top), - XINT(bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, - XINT(bar->height), + XINT (bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM, + XINT (bar->top), + XINT (bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, + XINT (bar->height), FRAME_W32_WINDOW (f), NULL, hinst, @@ -2433,12 +2424,12 @@ } /* List of special key combinations which w32 would normally capture, - but emacs should grab instead. Not directly visible to lisp, to + but Emacs should grab instead. Not directly visible to lisp, to simplify synchronization. Each item is an integer encoding a virtual key code and modifier combination to capture. */ Lisp_Object w32_grabbed_keys; -#define HOTKEY(vk,mods) make_number (((vk) & 255) | ((mods) << 8)) +#define HOTKEY(vk, mods) make_number (((vk) & 255) | ((mods) << 8)) #define HOTKEY_ID(k) (XFASTINT (k) & 0xbfff) #define HOTKEY_VK_CODE(k) (XFASTINT (k) & 255) #define HOTKEY_MODIFIERS(k) (XFASTINT (k) >> 8) @@ -2665,7 +2656,7 @@ deferred_msg * msg_buf = find_deferred_msg (hwnd, msg); if (msg_buf == NULL) - /* Message may have been cancelled, so don't abort(). */ + /* Message may have been cancelled, so don't abort. */ return; msg_buf->result = result; @@ -2753,7 +2744,7 @@ /* Detect quit_char and set quit-flag directly. Note that we still need to post a message to ensure the main thread will be - woken up if blocked in sys_select(), but we do NOT want to post + woken up if blocked in sys_select, but we do NOT want to post the quit_char message itself (because it will usually be as if the user had typed quit_char twice). Instead, we post a dummy message that has no particular effect. */ @@ -2908,7 +2899,7 @@ /* If GetUpdateRect returns 0 (meaning there is no update region), assume the whole window needs to be repainted. */ - GetClientRect(hwnd, &wmsg.rect); + GetClientRect (hwnd, &wmsg.rect); my_post_msg (&wmsg, hwnd, msg, wParam, lParam); return 0; } @@ -3694,7 +3685,7 @@ DWORD scrollbar_extra; RECT wr; - wp.length = sizeof(wp); + wp.length = sizeof (wp); GetWindowRect (hwnd, &wr); enter_crit (); @@ -4472,11 +4463,12 @@ /* Return the charset portion of a font name. */ -char * xlfd_charset_of_font (char * fontname) +char * +xlfd_charset_of_font (char * fontname) { char *charset, *encoding; - encoding = strrchr(fontname, '-'); + encoding = strrchr (fontname, '-'); if (!encoding || encoding == fontname) return NULL; @@ -4484,7 +4476,7 @@ if (*charset == '-') break; - if (charset == fontname || strcmp(charset, "-*-*") == 0) + if (charset == fontname || strcmp (charset, "-*-*") == 0) return NULL; return charset + 1; @@ -4498,7 +4490,7 @@ static BOOL x_to_w32_font (char *lpxstr, LOGFONT *lplogfont); static struct font_info * -w32_load_system_font (f,fontname,size) +w32_load_system_font (f, fontname, size) struct frame *f; char * fontname; int size; @@ -4601,7 +4593,7 @@ GetFontLanguageInfo, we check the properties of the codepage directly, since that is ultimately what we are working from anyway. */ - /* font->double_byte_p = GetFontLanguageInfo(hdc) & GCP_DBCS; */ + /* font->double_byte_p = GetFontLanguageInfo (hdc) & GCP_DBCS; */ CPINFO cpi = {0}; GetCPInfo (codepage, &cpi); font->double_byte_p = cpi.MaxCharSize > 1; @@ -4737,10 +4729,10 @@ pointer to the structure font_info while allocating it dynamically. If loading fails, return NULL. */ struct font_info * -w32_load_font (f,fontname,size) -struct frame *f; -char * fontname; -int size; +w32_load_font (f, fontname, size) + struct frame *f; + char * fontname; + int size; { Lisp_Object bdf_fonts; struct font_info *retval = NULL; @@ -4776,7 +4768,7 @@ if (retval) return retval; - return w32_load_system_font(f, fontname, size); + return w32_load_system_font (f, fontname, size); } @@ -4790,7 +4782,7 @@ if (font->per_char) xfree (font->per_char); if (font->bdf) w32_free_bdf_font (font->bdf); - if (font->hfont) DeleteObject(font->hfont); + if (font->hfont) DeleteObject (font->hfont); xfree (font); } } @@ -4824,16 +4816,16 @@ { if (!lpw) return (FW_DONTCARE); - if (stricmp (lpw,"heavy") == 0) return FW_HEAVY; - else if (stricmp (lpw,"extrabold") == 0) return FW_EXTRABOLD; - else if (stricmp (lpw,"bold") == 0) return FW_BOLD; - else if (stricmp (lpw,"demibold") == 0) return FW_SEMIBOLD; - else if (stricmp (lpw,"semibold") == 0) return FW_SEMIBOLD; - else if (stricmp (lpw,"medium") == 0) return FW_MEDIUM; - else if (stricmp (lpw,"normal") == 0) return FW_NORMAL; - else if (stricmp (lpw,"light") == 0) return FW_LIGHT; - else if (stricmp (lpw,"extralight") == 0) return FW_EXTRALIGHT; - else if (stricmp (lpw,"thin") == 0) return FW_THIN; + if (stricmp (lpw, "heavy") == 0) return FW_HEAVY; + else if (stricmp (lpw, "extrabold") == 0) return FW_EXTRABOLD; + else if (stricmp (lpw, "bold") == 0) return FW_BOLD; + else if (stricmp (lpw, "demibold") == 0) return FW_SEMIBOLD; + else if (stricmp (lpw, "semibold") == 0) return FW_SEMIBOLD; + else if (stricmp (lpw, "medium") == 0) return FW_MEDIUM; + else if (stricmp (lpw, "normal") == 0) return FW_NORMAL; + else if (stricmp (lpw, "light") == 0) return FW_LIGHT; + else if (stricmp (lpw, "extralight") == 0) return FW_EXTRALIGHT; + else if (stricmp (lpw, "thin") == 0) return FW_THIN; else return FW_DONTCARE; } @@ -4879,12 +4871,12 @@ Format of each entry is (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). */ - this_entry = Fassoc (build_string(charset), Vw32_charset_info_alist); - - if (NILP(this_entry)) + this_entry = Fassoc (build_string (charset), Vw32_charset_info_alist); + + if (NILP (this_entry)) { /* At startup, we want iso8859-1 fonts to come up properly. */ - if (stricmp(charset, "iso8859-1") == 0) + if (stricmp (charset, "iso8859-1") == 0) return ANSI_CHARSET; else return DEFAULT_CHARSET; @@ -4952,7 +4944,7 @@ case ANSI_CHARSET: /* Handle startup case of w32-charset-info-alist not being set up yet. */ - if (NILP(Vw32_charset_info_alist)) + if (NILP (Vw32_charset_info_alist)) return "iso8859-1"; charset_type = Qw32_charset_ansi; break; @@ -5091,7 +5083,7 @@ return buf; } - strncpy(buf, best_match, 31); + strncpy (buf, best_match, 31); buf[31] = '\0'; return buf; } @@ -5112,7 +5104,7 @@ case ANSI_CHARSET: /* Handle startup case of w32-charset-info-alist not being set up yet. */ - if (NILP(Vw32_charset_info_alist)) + if (NILP (Vw32_charset_info_alist)) return Fcons (build_string ("iso8859-1"), Qnil); charset_type = Qw32_charset_ansi; @@ -5272,7 +5264,7 @@ *end = '\0'; } - entry = Fassoc (build_string(charset), Vw32_charset_info_alist); + entry = Fassoc (build_string (charset), Vw32_charset_info_alist); if (NILP (entry)) return CP_UNKNOWN; @@ -5329,9 +5321,9 @@ coding.composing = COMPOSITION_DISABLED; bufsz = decoding_buffer_size (&coding, LF_FACESIZE); - fontname = alloca(sizeof(*fontname) * bufsz); + fontname = alloca (sizeof (*fontname) * bufsz); decode_coding (&coding, lplogfont->lfFaceName, fontname, - strlen(lplogfont->lfFaceName), bufsz - 1); + strlen (lplogfont->lfFaceName), bufsz - 1); *(fontname + coding.produced) = '\0'; /* Replace dashes with underscores so the dashes are not @@ -5542,7 +5534,7 @@ if (fields > 0) { - strncpy (lplogfont->lfFaceName,name, LF_FACESIZE); + strncpy (lplogfont->lfFaceName, name, LF_FACESIZE); lplogfont->lfFaceName[LF_FACESIZE-1] = 0; } else @@ -5741,7 +5733,7 @@ } return (fast_string_match_ignore_case (build_string (regex), - build_string(font_name_copy)) >= 0); + build_string (font_name_copy)) >= 0); } /* Callback functions, and a structure holding info they need, for @@ -5976,7 +5968,8 @@ /* Interface to fontset handler. (adapted from mw32font.c in Meadow and xterm.c in Emacs 20.3) */ -static Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names) +static Lisp_Object +w32_list_bdf_fonts (Lisp_Object pattern, int max_names) { char *fontname, *ptnstr; Lisp_Object list, tem, newlist = Qnil; @@ -6047,7 +6040,7 @@ codepage = w32_codepage_for_font (SDATA (tpat)); if (codepage != CP_8BIT && codepage != CP_UNICODE && codepage != CP_DEFAULT && codepage != CP_UNKNOWN - && !IsValidCodePage(codepage)) + && !IsValidCodePage (codepage)) continue; /* See if we cached the result for this particular query. @@ -6158,7 +6151,7 @@ XSETCDR (tem, make_number (0)); SelectObject (hdc, oldobj); ReleaseDC (dpyinfo->root_window, hdc); - DeleteObject(thisinfo.hfont); + DeleteObject (thisinfo.hfont); UNBLOCK_INPUT; } found_size = XINT (XCDR (tem)); @@ -6207,7 +6200,7 @@ Lisp_Object combined[2]; combined[0] = w32_list_bdf_fonts (pattern, maxnames - n_fonts); combined[1] = newlist; - newlist = Fnconc(2, combined); + newlist = Fnconc (2, combined); } return newlist; @@ -6234,7 +6227,7 @@ for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++) { - if (stricmp(pfi->name, fontname) == 0) return pfi; + if (stricmp (pfi->name, fontname) == 0) return pfi; } return NULL; @@ -6271,7 +6264,7 @@ } /* directory-files from dired.c. */ -Lisp_Object Fdirectory_files P_((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); +Lisp_Object Fdirectory_files P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); /* Find BDF files in a specified directory. (use GCPRO when calling, @@ -6282,13 +6275,13 @@ Lisp_Object filelist, list = Qnil; char fontname[100]; - if (!STRINGP(directory)) + if (!STRINGP (directory)) return Qnil; filelist = Fdirectory_files (directory, Qt, build_string (".*\\.[bB][dD][fF]"), Qt); - for ( ; CONSP(filelist); filelist = XCDR (filelist)) + for ( ; CONSP (filelist); filelist = XCDR (filelist)) { Lisp_Object filename = XCAR (filelist); if (w32_BDF_to_x_font (SDATA (filename), fontname, 100)) @@ -6318,8 +6311,8 @@ pair[0] = list; pair[1] = Qnil; GCPRO2 (directory, list); - pair[1] = w32_find_bdf_fonts_in_dir( XCAR (directory) ); - list = Fnconc( 2, pair ); + pair[1] = w32_find_bdf_fonts_in_dir ( XCAR (directory) ); + list = Fnconc ( 2, pair ); UNGCPRO; } return list; @@ -6458,7 +6451,7 @@ /* We force 24+ bit depths to 24-bit, both to prevent an overflow and because probably is more meaningful on Windows anyway */ if (cap < 0) - cap = 1 << min(dpyinfo->n_planes * dpyinfo->n_cbits, 24); + cap = 1 << min (dpyinfo->n_planes * dpyinfo->n_cbits, 24); ReleaseDC (dpyinfo->root_window, hdc); @@ -6494,8 +6487,8 @@ DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, doc: /* Returns the version numbers of the server of DISPLAY. The value is a list of three integers: the major and minor -version numbers of the X Protocol in use, and the distributor-specific release -number. See also the function `x-server-vendor'. +version numbers of the X Protocol in use, and the distributor-specific +release number. See also the function `x-server-vendor'. The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). @@ -6719,7 +6712,7 @@ Lisp_Object color_file; struct gcpro gcpro1; - color_file = build_string("~/rgb.txt"); + color_file = build_string ("~/rgb.txt"); GCPRO1 (color_file); @@ -7955,7 +7948,7 @@ *last = '\0'; } - file = DECODE_FILE(build_string (filename)); + file = DECODE_FILE (build_string (filename)); } /* User cancelled the dialog without making a selection. */ else if (!CommDlgExtendedError ()) @@ -8090,13 +8083,13 @@ also be a program executable to run, or a directory to open in the Windows Explorer. -If DOCUMENT is a program executable, the optional arg PARAMETERS can -be a string containing command line parameters that will be passed to -the program; otherwise, PARAMETERS should be nil or unspecified. - -Second optional argument SHOW-FLAG can be used to control how the +If DOCUMENT is a program executable, the optional third arg PARAMETERS +can be a string containing command line parameters that will be passed +to the program; otherwise, PARAMETERS should be nil or unspecified. + +Optional fourth argument SHOW-FLAG can be used to control how the application will be displayed when it is invoked. If SHOW-FLAG is nil -or unspceified, the application is displayed normally, otherwise it is +or unspecified, the application is displayed normally, otherwise it is an integer representing a ShowWindow flag: 0 - start hidden @@ -8281,7 +8274,6 @@ #else if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, (WPARAM) XINT (XCAR (item)), (LPARAM) item)) - #endif { MSG msg; @@ -8297,7 +8289,7 @@ doc: /* Return list of registered hot-key IDs. */) () { - return Fcopy_sequence (w32_grabbed_keys); + return Fdelq (Qnil, Fcopy_sequence (w32_grabbed_keys)); } DEFUN ("w32-reconstruct-hot-key", Fw32_reconstruct_hot_key, @@ -8460,10 +8452,10 @@ LARGE_INTEGER freebytes; LARGE_INTEGER totalbytes; - if (pfn_GetDiskFreeSpaceEx(rootname, - (ULARGE_INTEGER *)&availbytes, - (ULARGE_INTEGER *)&totalbytes, - (ULARGE_INTEGER *)&freebytes)) + if (pfn_GetDiskFreeSpaceEx (rootname, + (ULARGE_INTEGER *)&availbytes, + (ULARGE_INTEGER *)&totalbytes, + (ULARGE_INTEGER *)&freebytes)) value = list3 (make_float ((double) totalbytes.QuadPart), make_float ((double) freebytes.QuadPart), make_float ((double) availbytes.QuadPart)); @@ -8475,11 +8467,11 @@ DWORD free_clusters; DWORD total_clusters; - if (GetDiskFreeSpace(rootname, - §ors_per_cluster, - &bytes_per_sector, - &free_clusters, - &total_clusters)) + if (GetDiskFreeSpace (rootname, + §ors_per_cluster, + &bytes_per_sector, + &free_clusters, + &total_clusters)) value = list3 (make_float ((double) total_clusters * sectors_per_cluster * bytes_per_sector), make_float ((double) free_clusters @@ -8525,12 +8517,12 @@ ClosePrinter (hPrn); return Qnil; } - /* Call GetPrinter() again with big enouth memory block */ + /* Call GetPrinter again with big enouth memory block */ err = GetPrinter (hPrn, 2, (LPBYTE)ppi2, dwNeeded, &dwReturned); ClosePrinter (hPrn); if (!err) { - xfree(ppi2); + xfree (ppi2); return Qnil; } @@ -8540,23 +8532,23 @@ { /* a remote printer */ if (*ppi2->pServerName == '\\') - _snprintf(pname_buf, sizeof (pname_buf), "%s\\%s", ppi2->pServerName, - ppi2->pShareName); + _snprintf (pname_buf, sizeof (pname_buf), "%s\\%s", ppi2->pServerName, + ppi2->pShareName); else - _snprintf(pname_buf, sizeof (pname_buf), "\\\\%s\\%s", ppi2->pServerName, - ppi2->pShareName); + _snprintf (pname_buf, sizeof (pname_buf), "\\\\%s\\%s", ppi2->pServerName, + ppi2->pShareName); pname_buf[sizeof (pname_buf) - 1] = '\0'; } else { /* a local printer */ - strncpy(pname_buf, ppi2->pPortName, sizeof (pname_buf)); + strncpy (pname_buf, ppi2->pPortName, sizeof (pname_buf)); pname_buf[sizeof (pname_buf) - 1] = '\0'; /* `pPortName' can include several ports, delimited by ','. * we only use the first one. */ - strtok(pname_buf, ","); + strtok (pname_buf, ","); } - xfree(ppi2); + xfree (ppi2); } return build_string (pname_buf); @@ -8817,14 +8809,14 @@ Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); DEFVAR_LISP ("x-sensitive-text-pointer-shape", - &Vx_sensitive_text_pointer_shape, + &Vx_sensitive_text_pointer_shape, doc: /* The shape of the pointer when over mouse-sensitive text. This variable takes effect when you create a new frame or when you set the mouse color. */); Vx_sensitive_text_pointer_shape = Qnil; DEFVAR_LISP ("x-window-horizontal-drag-cursor", - &Vx_window_horizontal_drag_shape, + &Vx_window_horizontal_drag_shape, doc: /* Pointer shape to use for indicating a window can be dragged horizontally. This variable takes effect when you create a new frame or when you set the mouse color. */); @@ -9050,7 +9042,8 @@ variable initialized is 0 and directly from main when initialized is non zero. */ -void globals_of_w32fns () +void +globals_of_w32fns () { HMODULE user32_lib = GetModuleHandle ("user32.dll"); /* @@ -9077,7 +9070,7 @@ void w32_abort (void) NO_RETURN; void -w32_abort() +w32_abort () { int button; button = MessageBox (NULL, @@ -9105,7 +9098,7 @@ /* For convenience when debugging. */ int -w32_last_error() +w32_last_error () { return GetLastError (); }