view src/w32reg.c @ 23791:364d36c8f631

Improved and fixed customize for variables: ispell-highlight-p, ispell-check-comments, ispell-help-in-bufferp, ispell-dictionary-alist, ispell-skip-sgml. Improved and fixed comments in variables and messages for functions: ispell-help-in-bufferp, ispell-local-dictionary, ispell-menu-map, ispell-checking-message, ispell-parser, ispell-word, lookup-words, ispell-change-dictionary, ispell-region, ispell-begin-tex-skip-regexp, ispell-begin-skip-region, ispell-comments-and-strings, ispell-continue, ispell-complete-word, ispell-message-text-end, ispell-add-per-file-word-list. (ispell-dictionary-alist-1): (ispell-dictionary-alist2): A coding system is now required for all languages. Casechars improved for castellano, castellano8, and norsk dictionaries. Dictionary norsk7-tex removed. Dictionary polish added. (ispell-dictionary-alist): Redefined at load-time to support dictionary changes. (ispell-menu-map): Redefined at load-time to support menu changes. (ispell-check-version): New alias for `check-ispell-version'. (ispell-parse-output): Fixed matching for ispell error messages. Correctly returns spelling suggestions in order generated by ispell process. (check-ispell-version): Ensure `case-fold-search' doesn't get redefined. (ispell-complete-word): Ensure `case-fold-search' doesn't get redefined. Fix bug that didn't respect case of word being completed. (ispell-init-process): Set process coding system to be compatible with emacs processes and the ispell process. (ispell-kill-ispell): Ensures ispell process has terminated before starting new process. This can otherwise confuse process filters and hang the ispell process. (ispell-begin-skip-region-regexp): (ispell-skip-region): Improved skipping support for sgml. (ispell-minor-check): Support sgml labels. Fix mapping ^M to \r which could cause `ispell-complete-word' to hang. (ispell-message): Improved message reference matching. Ensure `case-fold-search' doesn't get redefined. (ispell-buffer-local-parsing): Ensure `case-fold-search' doesn't get redefined. Fixed bug in returning to nroff mode from tex mode. (ispell-add-per-file-word-list): Ensure `case-fold-search' doesn't get redefined.
author Richard M. Stallman <rms@gnu.org>
date Tue, 01 Dec 1998 07:23:27 +0000
parents 481b7874a1e9
children 8387918b52c6
line wrap: on
line source

/* Emulate the X Resource Manager through the registry.
   Copyright (C) 1990, 1993, 1994 Free Software Foundation.

This file is part of GNU Emacs.

GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING.  If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.  */

/* Written by Kevin Gallo */

#include <config.h>
#include "lisp.h"
#include "w32term.h"
#include "blockinput.h"

#include <stdio.h>
#include <string.h>

#define REG_ROOT "SOFTWARE\\GNU\\Emacs"

LPBYTE 
w32_get_string_resource (name, class, dwexptype)
     char *name, *class;
     DWORD dwexptype;
{
  LPBYTE lpvalue = NULL;
  HKEY hrootkey = NULL;
  DWORD dwType;
  DWORD cbData;
  BOOL ok = FALSE;
  
  BLOCK_INPUT;
  
  /* Check both the current user and the local machine to see if we have any resources */
  
  if (RegOpenKeyEx (HKEY_CURRENT_USER, REG_ROOT, 0, KEY_READ, &hrootkey) == ERROR_SUCCESS
      || RegOpenKeyEx (HKEY_LOCAL_MACHINE, REG_ROOT, 0, KEY_READ, &hrootkey) == ERROR_SUCCESS)
    {
      char *keyname;
      
      if (RegQueryValueEx (hrootkey, name, NULL, &dwType, NULL, &cbData) == ERROR_SUCCESS
	  && dwType == dwexptype)
	{
	  keyname = name;
	} 
      else if (RegQueryValueEx (hrootkey, class, NULL, &dwType, NULL, &cbData) == ERROR_SUCCESS
	       && dwType == dwexptype)
	{
	  keyname = class;
	}
      else
	{
	  keyname = NULL;
	}
      
      ok = (keyname
	    && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
	    && RegQueryValueEx (hrootkey, keyname, NULL, NULL, lpvalue, &cbData) == ERROR_SUCCESS);
      
      RegCloseKey (hrootkey);
    }
  
  UNBLOCK_INPUT;
  
  if (!ok) 
    {
      if (lpvalue) xfree (lpvalue);
      return (NULL);
    } 
  else 
    {
      return (lpvalue);
    }
}

/* Retrieve the string resource specified by NAME with CLASS from
   database RDB. */

char *
x_get_string_resource (rdb, name, class)
     int rdb;
     char *name, *class;
{
  return (w32_get_string_resource (name, class, REG_SZ));
}