Mercurial > hg > xemacs-beta
changeset 657:ce0b3f2eff35
[xemacs-hg @ 2001-09-09 04:37:41 by andyp]
DDE, netinstall and cygwin file fixes
author | andyp |
---|---|
date | Sun, 09 Sep 2001 04:37:48 +0000 |
parents | 4035041996d8 |
children | 6693b6f85480 |
files | netinstall/ChangeLog netinstall/Makefile.in.in netinstall/choose.cc netinstall/desktop.cc netinstall/dialog.h netinstall/download.cc netinstall/ini.h netinstall/main.cc netinstall/nio-ie5.cc netinstall/regedit.cc netinstall/regedit.h netinstall/reginfo.h netinstall/res.rc netinstall/resource.h netinstall/root.cc netinstall/splash.cc netinstall/state.h netinstall/uninstall.cc netinstall/win32.h src/ChangeLog src/device-msw.c src/emacs.c src/event-msw.c src/fileio.c src/symsinit.h |
diffstat | 25 files changed, 924 insertions(+), 206 deletions(-) [+] |
line wrap: on
line diff
--- a/netinstall/ChangeLog Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/ChangeLog Sun Sep 09 04:37:48 2001 +0000 @@ -1,3 +1,54 @@ +2001-09-08 Andy Piper <andy@xemacs.org> + + * Makefile.in.in (OBJS): + * Makefile.in.in (all): + * Makefile.in.in (extraclean): + * choose.cc (base): + * desktop.cc: + * desktop.cc (remove_link): + * desktop.cc (start_menu): + * desktop.cc (desktop_icon): + * desktop.cc (remove_desktop_setup): + * desktop.cc (do_desktop_setup): + * desktop.cc (load_dialog): + * desktop.cc (save_dialog): + * desktop.cc (do_desktop): + * dialog.h: + * download.cc (download_one): + * ini.h (pinfo): + * main.cc (WinMain): + * nio-ie5.cc: + * regedit.cc: + * regedit.cc (create_xemacs_root): + * regedit.cc (set_app_path): + * regedit.cc (set_install_path): + * regedit.cc (setup_explorer): + * regedit.cc (remove_app_path): + * regedit.cc (remove_uninstall_path): + * regedit.h (remove_app_path): + * reginfo.h: + * reginfo.h (XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME): + * reginfo.h (XEMACS_NATIVE_ARCH_NAME): + * res.rc: + * resource.h (IDD_UNINSTALL): + * resource.h (IDC_TXT_TYPE): + * root.cc: + * root.cc (browse_cb): + * root.cc (set_default_root): + * splash.cc (do_splash): + * state.h: + * state.h (MIRROR_SITE): + * uninstall.cc: + * uninstall.cc (dialog_proc): + * uninstall.cc (progress): + * uninstall.cc (uninstall_one): + * uninstall.cc (do_uninstall): + * uninstall.cc (read_installed_db): + * uninstall.cc (uninstall_all): + * win32.h: + * win32.h (NOCOMATTRIBUTE): Update netinstaller to support + uninstallation and register standard file-types. + 2001-09-07 Stephen J. Turnbull <stephen@xemacs.org> * XEmacs 21.5.3 "asparagus" is released. @@ -226,3 +277,7 @@ 2000-11-12 Andy Piper <andy@xemacs.org> * all: port from cygwin setup. + +%%% $Id: ChangeLog,v 1.7 2001/09/09 04:37:46 andyp Exp $ +$Revision: 1.7 $ +
--- a/netinstall/Makefile.in.in Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/Makefile.in.in Sun Sep 09 04:37:48 2001 +0000 @@ -111,6 +111,7 @@ ini.o \ inilex.o \ iniparse.o \ + init.o \ install.o \ localdir.o \ log.o \ @@ -135,6 +136,7 @@ splash.o \ state.o \ tar.o \ + uninstall.o \ version.o .SUFFIXES: @@ -151,12 +153,12 @@ -L$(MINGW_ZLIB_DIR) -lz -lmingw32 @chmod a-x $@ -setup.ini: setup.exe +setup-bin.ini: setup.exe V=`grep '^\$$Revision.*' $(srcdir)/ChangeLog \ | sed -e 's/\$$Revision:* *//' \ -e 's/ *$$.*//'` ;\ $(XEMACS) -batch -vanilla -l ${srcdir}/../lisp/package-net.el \ - -f package-net-batch-convert-index-to-ini . $$V + -f package-net-batch-generate-bin-ini . $$V install: @echo; echo "Installing net setup." @@ -207,7 +209,7 @@ msg.h log.h find.h reginfo.h concat.o: concat.cc desktop.o: desktop.cc win32.h resource.h ini.h msg.h state.h concat.h \ - mkdir.h dialog.h version.h port.h + mkdir.h dialog.h version.h port.h reginfo.h dialog.o: dialog.cc win32.h dialog.h msg.h log.h diskfull.o: diskfull.cc win32.h diskfull.h download.o: download.cc win32.h resource.h msg.h ini.h dialog.h \ @@ -229,6 +231,10 @@ install.o: install.cc win32.h \ resource.h ini.h dialog.h concat.h geturl.h mkdir.h state.h tar.h \ diskfull.h msg.h regedit.h reginfo.h log.h hash.h port.h +init.o: init.cc win32.h resource.h dialog.h state.h msg.h log.h +uninstall.o: uninstall.cc win32.h \ + resource.h ini.h dialog.h concat.h geturl.h mkdir.h state.h tar.h \ + diskfull.h msg.h regedit.h reginfo.h log.h hash.h port.h localdir.o: localdir.cc win32.h dialog.h resource.h state.h msg.h \ concat.h log.h log.o: log.cc win32.h resource.h msg.h log.h dialog.h state.h concat.h \
--- a/netinstall/choose.cc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/choose.cc Sun Sep 09 04:37:48 2001 +0000 @@ -623,7 +623,7 @@ return FALSE; } -static char * +char * base (char *s) { if (!s)
--- a/netinstall/desktop.cc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/desktop.cc Sun Sep 09 04:37:48 2001 +0000 @@ -40,6 +40,7 @@ #include "reginfo.h" #include "regedit.h" #include "port.h" +#include "log.h" extern "C" { void make_link_2 (char *exepath, char *args, char *icon, char *lname); @@ -123,7 +124,19 @@ } static void -start_menu (char *title, char *target) +remove_link (char *linkpath, char* title) +{ + char *fname = concat (linkpath, "/", title, ".lnk", 0); + + if (_access (fname, 0) != 0) + return; /* doesn't exist */ + + msg ("remove_link %s, %s, %s\n", fname, title); + _unlink (fname); +} + +static void +start_menu (char *title, char *target, int remove) { char path[_MAX_PATH]; LPITEMIDLIST id; @@ -141,11 +154,14 @@ // end of Win95 addition strcat (path, "/"); strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME); - make_link (path, title, target); + if (remove == 0) + make_link (path, title, target); + else + remove_link (path, title); } static void -desktop_icon (char *title, char *target) +desktop_icon (char *title, char *target, int remove) { char path[_MAX_PATH]; LPITEMIDLIST id; @@ -162,59 +178,10 @@ msg("Desktop directory for deskop link changed to: %s",path); } // end of Win95 addition - make_link (path, title, target); -} - -static int -uexists (char *path) -{ - char *f = concat (root_dir, path, 0); - int a = _access (f, 0); - free (f); - if (a == 0) - return 1; - return 0; -} - -static void -make_passwd_group () -{ - if (verinfo.dwPlatformId != VER_PLATFORM_WIN32_NT) - { - int i; - - LOOP_PACKAGES - { - if (!strcmp (package[i].name, "cygwin")) - { - /* mkpasswd and mkgroup are not working on 9x/ME up to 1.1.5-4 */ - char *border_version = canonicalize_version ("1.1.5-4"); - char *inst_version = canonicalize_version (pi.version); - - if (strcmp (inst_version, border_version) <= 0) - return; - - break; - } - } - } - - if (uexists ("/etc/passwd") && uexists ("/etc/group")) - return; - - char *fname = concat (root_dir, "/etc/postinstall/passwd-grp.bat", 0); - mkdir_p (0, fname); - - FILE *p = fopen (fname, "wb"); - if (!p) - return; - - if (!uexists ("/etc/passwd")) - fprintf (p, "bin\\mkpasswd -l > etc\\passwd\n"); - if (!uexists ("/etc/group")) - fprintf (p, "bin\\mkgroup -l > etc\\group\n"); - - fclose (p); + if (remove == 0) + make_link (path, title, target); + else + remove_link (path, title); } static void @@ -240,46 +207,102 @@ } } +void +remove_desktop_setup() +{ + start_menu ("XEmacs", 0, 1); + desktop_icon ("XEmacs", 0, 1); + + if (xemacs_package != 0) + { + int issystem = (root_scope == IDC_ROOT_SYSTEM ? 1 : 0); +#define FROB(exe) remove_app_path ((exe), \ + issystem) + /* FROB (find_xemacs_exe_name ()); */ + FROB ("runemacs.exe"); + FROB ("xemacs.exe"); +#undef FROB + } +} + static void do_desktop_setup() { save_icon (); if (root_menu && batname) { - start_menu ("XEmacs", batname); + start_menu ("XEmacs", batname, 0); } if (root_desktop && batname) { - desktop_icon ("XEmacs", batname); + desktop_icon ("XEmacs", batname, 0); } // set regkeys for the application if (xemacs_package != 0) { int issystem = (root_scope == IDC_ROOT_SYSTEM ? 1 : 0); - if (xemacs_package->type == TY_NATIVE) + if (xemacs_package->type == TY_NATIVE + || xemacs_package->type == TY_CYGWIN) { + if (xemacs_package->type == TY_NATIVE) + { #define FROB(exe) set_app_path ((exe), \ find_xemacs_exe_path (), \ issystem) - FROB (find_xemacs_exe_name ()); - FROB ("runemacs.exe"); - FROB ("xemacs.exe"); + FROB (find_xemacs_exe_name ()); + FROB ("runemacs.exe"); + FROB ("xemacs.exe"); #undef FROB - } - else if (xemacs_package->type == TY_CYGWIN) - { - int junk; - char* root = find_cygwin_root (&junk); + } + else if (xemacs_package->type == TY_CYGWIN) + { + int junk; + char* root = find_cygwin_root (&junk); #define FROB(exe) set_app_path ((exe), \ concat (find_xemacs_exe_path (), ";", \ root, "\\bin;", \ root, "\\usr\\bin", 0), \ issystem) - FROB (find_xemacs_exe_name ()); - FROB ("runemacs.exe"); - FROB ("xemacs.exe"); + FROB (find_xemacs_exe_name ()); + FROB ("runemacs.exe"); + FROB ("xemacs.exe"); #undef FROB + } + set_install_path (find_xemacs_exe_path(), issystem); + } + // Register file types + if (batname) + { + if (reg_java) + { + log (0, "Registering .java files"); + setup_explorer ("java", "Java Source file", batname); + setup_explorer ("jav", "Java Source file", batname); + } + if (reg_cpp) + { + log (0, "Registering .cpp files"); + setup_explorer ("cpp", "C++ Source file", batname); + setup_explorer ("cc", "C++ Source file", batname); + setup_explorer ("hh", "C++ Header file", batname); + } + if (reg_c) + { + log (0, "Registering .c files"); + setup_explorer ("c", "C Source file", batname); + setup_explorer ("h", "C Header file", batname); + } + if (reg_elisp) + { + log (0, "Registering .el files"); + setup_explorer ("el", "E-Lisp Source file", batname); + } + if (reg_txt) + { + log (0, "Registering .txt files"); + setup_explorer ("txt", "Text file", batname); + } } } } @@ -287,6 +310,12 @@ static int da[] = { IDC_ROOT_DESKTOP, 0 }; static int ma[] = { IDC_ROOT_MENU, 0 }; +static int ct[] = { IDC_C_TYPE, 0 }; +static int javat[] = { IDC_JAVA_TYPE, 0 }; +static int cppt[] = { IDC_CPP_TYPE, 0 }; +static int elispt[] = { IDC_ELISP_TYPE, 0 }; +static int txtt[] = { IDC_TXT_TYPE, 0 }; + static void check_if_enable_next (HWND h) { @@ -298,6 +327,11 @@ { rbset (h, da, root_desktop); rbset (h, ma, root_menu); + rbset (h, ct, reg_c); + rbset (h, javat, reg_java); + rbset (h, cppt, reg_cpp); + rbset (h, elispt, reg_elisp); + rbset (h, txtt, reg_txt); check_if_enable_next (h); } @@ -366,6 +400,11 @@ { root_desktop= rbget (h, da); root_menu = rbget (h, ma); + reg_c = rbget (h, ct); + reg_java = rbget (h, javat); + reg_cpp = rbget (h, cppt); + reg_elisp = rbget (h, elispt); + reg_txt = rbget (h, txtt); } static BOOL @@ -428,11 +467,21 @@ 0); root_desktop = check_desktop ("XEmacs", batname); root_menu = check_startmenu ("XEmacs", batname); + reg_c = IDC_C_TYPE; + reg_cpp = IDC_CPP_TYPE; + reg_java = IDC_JAVA_TYPE; + reg_elisp = IDC_ELISP_TYPE; + reg_txt = IDC_TXT_TYPE; } else { root_desktop = 0; root_menu = 0; + reg_c = 0; + reg_cpp = 0; + reg_java = 0; + reg_elisp = 0; + reg_txt = 0; } int rv = 0;
--- a/netinstall/dialog.h Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/dialog.h Sun Sep 09 04:37:48 2001 +0000 @@ -31,11 +31,13 @@ D(do_download); D(do_fromcwd); D(do_ini); +D(do_init); D(do_install); D(do_local_dir); D(do_net); D(do_other); D(do_postinstall); +D(do_uninstall); D(do_root); D(do_site); D(do_source);
--- a/netinstall/download.cc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/download.cc Sun Sep 09 04:37:48 2001 +0000 @@ -32,8 +32,6 @@ #include "mkdir.h" #include "log.h" -#define pi (package[i].info[package[i].trust]) - static int download_one (char *name, int expected_size) {
--- a/netinstall/ini.h Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/ini.h Sun Sep 09 04:37:48 2001 +0000 @@ -73,7 +73,8 @@ Package *new_package (char *name); void ini_init (char *string); -#define pi (package[i].info[package[i].trust]) +#define pinfo(p) ((p).info[(p).trust]) +#define pi pinfo(package[i]) #define LOOP_PACKAGES \ for (i=0; i<npackages; i++) \
--- a/netinstall/main.cc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/main.cc Sun Sep 09 04:37:48 2001 +0000 @@ -51,21 +51,29 @@ int cmd_show) { hinstance = h; - - next_dialog = IDD_SPLASH; - - log (LOG_TIMESTAMP, "Starting XEmacs install"); + int pos = -1; + if ((pos = strcspn(command_line, "-")) >= 0 + && + command_line[pos+1] == 'u') + { + next_dialog = IDD_UNINSTALL; + log (LOG_TIMESTAMP, "Starting XEmacs uninstall"); + uninstall = 1; + } + else + { + next_dialog = IDD_SPLASH; + log (LOG_TIMESTAMP, "Starting XEmacs install"); + } - char cwd[_MAX_PATH]; - GetCurrentDirectory (sizeof (cwd), cwd); - local_dir = strdup (cwd); - log (0, "Current Directory: %s", cwd); + do_init(h); while (next_dialog) { switch (next_dialog) { case IDD_SPLASH: do_splash (h); break; + case IDD_UNINSTALL: do_uninstall (h); break; case IDD_SOURCE: do_source (h); break; case IDD_LOCAL_DIR: do_local_dir (h); break; case IDD_ROOT: do_root (h); break;
--- a/netinstall/nio-ie5.cc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/nio-ie5.cc Sun Sep 09 04:37:48 2001 +0000 @@ -18,8 +18,6 @@ must already have installed and configured IE5. This module is called from netio.cc, which is called from geturl.cc */ -static char *cvsid = "\n%%% $Id: nio-ie5.cc,v 1.3 2001/04/13 09:11:35 michaels Exp $\n"; - #include "win32.h" #include "resource.h"
--- a/netinstall/regedit.cc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/regedit.cc Sun Sep 09 04:37:48 2001 +0000 @@ -180,6 +180,7 @@ path, path); RegSetValueEx (key, XEMACS_INFO_XEMACS_PACKAGE_KEY, 0, REG_SZ, (BYTE *)buf, strlen (buf)+1); + RegCloseKey (key); } void @@ -201,6 +202,117 @@ RegSetValueEx (key, "Path", 0, REG_SZ, (BYTE *)path, strlen (path)+1); + RegCloseKey (key); +} + +void +set_install_path (char* path, int issystem) +{ + char buf[1000]; + HKEY key; + DWORD disposition; + + sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\XEmacs"); + + HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + RegDeleteKey (kr, buf); + + if (RegCreateKeyEx (kr, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS, + 0, &key, &disposition) != ERROR_SUCCESS) + fatal ("set_install_path"); + + RegSetValueEx (key, "DisplayName", + 0, REG_SZ, (BYTE *)"XEmacs", strlen ("XEmacs")+1); + + sprintf (buf, "%s\\setup.exe -u", path); + RegSetValueEx (key, "UninstallString", + 0, REG_SZ, (BYTE *)buf, strlen (buf)+1); + RegCloseKey (key); +} + +void +setup_explorer (char* file_type, char* name, char *exe) +{ + char buf[1000]; + char ftype[32]; + HKEY key; + DWORD disposition; + + sprintf (buf, ".%s", file_type); + RegDeleteKey (HKEY_CLASSES_ROOT, buf); + + if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS, + 0, &key, &disposition) != ERROR_SUCCESS) + fatal ("setup_explorer"); + + // set default key + sprintf (ftype, "%sfile", file_type); + RegSetValueEx (key, NULL, + 0, REG_SZ, (BYTE *)ftype, strlen (ftype)+1); + RegCloseKey (key); + + // create file type entry + RegDeleteKey (HKEY_CLASSES_ROOT, ftype); + if (RegCreateKeyEx (HKEY_CLASSES_ROOT, ftype, 0, "XEmacs", + 0, KEY_ALL_ACCESS, + 0, &key, &disposition) != ERROR_SUCCESS) + fatal ("setup_explorer"); + RegSetValueEx (key, NULL, + 0, REG_SZ, (BYTE *)name, strlen (name)+1); + RegSetValueEx (key, "AlwaysShowExt", + 0, REG_SZ, (BYTE *)"", strlen ("")+1); + RegCloseKey (key); + + // make xemacs file the default icon + sprintf(buf, "%s\\DefaultIcon", ftype); + if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS, + 0, &key, &disposition) != ERROR_SUCCESS) + fatal ("setup_explorer"); + + sprintf(buf, "%s,1", exe); + RegSetValueEx (key, NULL, + 0, REG_SZ, (BYTE *)buf, strlen (buf)+1); + RegCloseKey (key); + + // command default key (exe) + sprintf(buf, "%s\\shell\\Open\\command", ftype); + if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS, + 0, &key, &disposition) != ERROR_SUCCESS) + fatal ("setup_explorer"); + + sprintf(buf, "\"%s\"", exe); // Don't need %1 because dde will open the file + RegSetValueEx (key, NULL, + 0, REG_SZ, (BYTE *)buf, strlen (buf)+1); + RegCloseKey (key); + + // ddeexec + sprintf(buf, "%s\\shell\\Open\\ddeexec", ftype); + if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS, + 0, &key, &disposition) != ERROR_SUCCESS) + fatal ("setup_explorer"); + +#define DDE_OPEN "Open(\"%1\")" + RegSetValueEx (key, NULL, + 0, REG_SZ, (BYTE *)DDE_OPEN, strlen (DDE_OPEN)+1); + RegCloseKey (key); + + // ddeexec application + sprintf(buf, "%s\\shell\\Open\\ddeexec\\application", ftype); + if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS, + 0, &key, &disposition) != ERROR_SUCCESS) + fatal ("setup_explorer"); + RegSetValueEx (key, NULL, + 0, REG_SZ, (BYTE *)"XEmacs", strlen ("XEmacs")+1); + RegCloseKey (key); + + // ddeexec topic + sprintf(buf, "%s\\shell\\Open\\ddeexec\\topic", ftype); + if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS, + 0, &key, &disposition) != ERROR_SUCCESS) + fatal ("setup_explorer"); + RegSetValueEx (key, NULL, + 0, REG_SZ, (BYTE *)"system", strlen ("system")+1); + RegCloseKey (key); } static void @@ -222,3 +334,23 @@ remove1 (HKEY_CURRENT_USER); } +void +remove_app_path (char *exe, int issystem) +{ + char buf[1000]; + sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%s", + exe); + + HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + RegDeleteKey (kr, buf); +} + +void +remove_uninstall_path () +{ + char buf[1000]; + sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\XEmacs"); + + RegDeleteKey (HKEY_LOCAL_MACHINE, buf); + RegDeleteKey (HKEY_CURRENT_USER, buf); +}
--- a/netinstall/regedit.h Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/regedit.h Sun Sep 09 04:37:48 2001 +0000 @@ -23,4 +23,8 @@ void create_xemacs_root (char *posix, int issystem, int isnative); void remove_xemacs_root (); void set_app_path (char *exe, char* path, int issystem); +void set_install_path (char* path, int issystem); +void setup_explorer (char* file_type, char* name, char *exe); +void remove_app_path (char *exe, int issystem); +void remove_uninstall_path ();
--- a/netinstall/reginfo.h Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/reginfo.h Sun Sep 09 04:37:48 2001 +0000 @@ -2,7 +2,7 @@ Copyright (C) 2000 Andy Piper. */ -#define XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME "GNU" +#define XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME "XEmacs" #define XEMACS_INFO_XEMACS_REGISTRY_NAME "XEmacs" /* Keys */ #define XEMACS_INFO_XEMACS_ROOT_KEY "emacs_dir" @@ -20,8 +20,8 @@ #define XEMACS_PACKAGE_DIR \ ((char*)(install_type == IDC_INSTALL_NATIVE ? "\\xemacs-packages\\" \ : "/lib/xemacs/xemacs-packages/")) -#define XEMACS_NATIVE_ARCH_NAME "i386-pc-win32" -#define XEMACS_CYGWIN_ARCH_NAME "i686-pc-cygwin32" +#define XEMACS_NATIVE_ARCH_NAME "i586-pc-win32" +#define XEMACS_CYGWIN_ARCH_NAME "i686-pc-cygwin" /* * Installation hierarchy is: @@ -35,8 +35,8 @@ * \pkginfo * \site-packages * \mule-packages - * \XEmacs-21.2 - * \i386-pc-win32 + * \XEmacs-21.4 + * \i586-pc-win32 * \etc * \info * \lisp @@ -45,12 +45,12 @@ * /xemacs/xemacs-packages * /xemacs/site-packages * /xemacs/mule-packages - * /xemacs-21.2 - * /i686-pc-cygwin32 + * /xemacs-21.4 + * /i686-pc-cygwin * /etc * /info * /lisp - * /usr/local/bin/i686-pc-cygwin32 + * /usr/local/bin/i686-pc-cygwin */
--- a/netinstall/res.rc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/res.rc Sun Sep 09 04:37:48 2001 +0000 @@ -142,7 +142,7 @@ CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 END -IDD_NET DIALOG 0, 0, 311, 201 +IDD_NET DIALOG DISCARDABLE 0, 0, 311, 201 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "XEmacs Setup" FONT 8, "MS Sans Serif" @@ -216,6 +216,31 @@ CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 END +IDD_UNINSTALL DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +CAPTION "Uninstall XEmacs" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancel",IDCANCEL,199,176,45,15 + DEFPUSHBUTTON "Uninstall",IDOK,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "Uninstalling Packages",IDC_STATIC,112,10,170,17 + LTEXT "(PKG)",IDC_UNINS_PKG,112,26,170,11 + LTEXT "(FILE)",IDC_UNINS_FILE,112,41,166,11 + CONTROL "Progress1",IDC_UNINS_DISKFULL,"msctls_progress32", + WS_BORDER,123,143,165,10 + CONTROL "Progress1",IDC_UNINS_IPROGRESS,"msctls_progress32", + WS_BORDER,125,106,163,10 + CONTROL "Progress1",IDC_UNINS_PPROGRESS,"msctls_progress32", + WS_BORDER,125,67,163,10 + GROUPBOX "Disk",IDC_STATIC,112,130,186,31 + GROUPBOX "Package",IDC_STATIC,112,54,186,31 + GROUPBOX "Total",IDC_STATIC,112,93,186,31 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + IDD_PROXY_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "XEmacs Setup" @@ -250,7 +275,7 @@ PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 END -IDD_SPLASH DIALOG 0, 0, 311, 201 +IDD_SPLASH DIALOG DISCARDABLE 0, 0, 311, 201 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "XEmacs Setup" FONT 8, "MS Sans Serif" @@ -301,16 +326,27 @@ DEFPUSHBUTTON "Finish",IDOK,199,176,45,15 PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP LTEXT "Setup has now finished. To create desktop shortcuts, please select from the following options.", IDC_STATIC,112,11,170,17 LTEXT "To complete setup click Finish.",IDC_STATIC,112,32,166, 17 CONTROL "Create Desktop Icon",IDC_ROOT_DESKTOP,"Button", - BS_AUTOCHECKBOX,113,76,100,8 + BS_AUTOCHECKBOX,113,50,100,8 CONTROL "Add to Start Menu",IDC_ROOT_MENU,"Button", - BS_AUTOCHECKBOX,113,97,100,8 + BS_AUTOCHECKBOX,113,66,100,8 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 + CONTROL "Text",IDC_TXT_TYPE,"Button",BS_AUTOCHECKBOX,209,101,38, + 8 + CONTROL "Java",IDC_JAVA_TYPE,"Button",BS_AUTOCHECKBOX,113,100,50, + 8 + CONTROL "C",IDC_C_TYPE,"Button",BS_AUTOCHECKBOX,113,116,41,8 + CONTROL "C++",IDC_CPP_TYPE,"Button",BS_AUTOCHECKBOX,113,133,38,8 + CONTROL "E-Lisp",IDC_ELISP_TYPE,"Button",BS_AUTOCHECKBOX,113,148, + 38,8 + LTEXT "Register XEmacs for these file types:",IDC_STATIC,113, + 84,166,13 + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 END @@ -433,6 +469,7 @@ IDD_DESKTOP, DIALOG BEGIN VERTGUIDE, 113 + VERTGUIDE, 209 END END #endif // APSTUDIO_INVOKED @@ -449,7 +486,7 @@ IDB_CHECK_YES BITMAP DISCARDABLE "check-yes.bmp" IDB_CHECK_NO BITMAP DISCARDABLE "check-no.bmp" IDB_CHECK_NA BITMAP DISCARDABLE "check-na.bmp" -GNU BITMAP DISCARDABLE "gnu.bmp" +GNU BITMAP DISCARDABLE "gnu.bmp" IDB_GNU BITMAP DISCARDABLE "gnu.bmp" ///////////////////////////////////////////////////////////////////////////// @@ -478,7 +515,7 @@ IDS_ERR_OPEN_READ "Can't open %s for reading: %s" IDS_ROOT_ABSOLUTE "The install directory must be absolute, with both a drive letter and leading slash, like C:\\Cygwin" IDS_DOWNLOAD_COMPLETE "Download Complete" - IDS_CVSID "\n%%% $Id: res.rc,v 1.3 2001/04/13 09:11:35 michaels Exp $\n" + IDS_CVSID "\n%%% $Id: res.rc,v 1.4 2001/09/09 04:37:47 andyp Exp $\n" IDS_NOLOGFILE "Cannot open log file %s for writing" IDS_UNINSTALL_COMPLETE "Uninstalls complete." IDS_WININET "Unable to find or load the Internet Explorer 5 DLLs"
--- a/netinstall/resource.h Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/resource.h Sun Sep 09 04:37:48 2001 +0000 @@ -54,6 +54,7 @@ #define IDB_CHECK_NO 124 #define IDB_CHECK_NA 125 #define IDB_GNU 126 +#define IDD_UNINSTALL 127 #define IDC_SOURCE_DOWNLOAD 1000 #define IDC_SOURCE_NETINST 1001 #define IDC_SOURCE_CWD 1002 @@ -94,9 +95,20 @@ #define IDC_ROOT_DESKTOP 1041 #define IDC_ROOT_MENU 1042 #define IDC_LOCAL_DIR_BROWSE 1043 +#define IDC_TXT_TYPE 1043 #define IDC_LOCAL_DIR 1044 +#define IDC_JAVA_TYPE 1044 #define IDC_INSTALL_NATIVE 1045 +#define IDC_C_TYPE 1045 #define IDC_INSTALL_CYGWIN 1046 +#define IDC_CPP_TYPE 1046 +#define IDC_UNINS_PKG 1047 +#define IDC_ELISP_TYPE 1047 +#define IDC_UNINS_FILE 1048 +#define IDC_UNINS_DISKFULL 1049 +#define IDC_UNINS_IPROGRESS 1050 +#define IDC_UNINS_PPROGRESS 1051 +#define IDC_UNINS_ACTION 1052 #define IDC_STATIC -1 // Next default values for new objects
--- a/netinstall/root.cc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/root.cc Sun Sep 09 04:37:48 2001 +0000 @@ -137,32 +137,6 @@ } } -static void -read_mount_table () -{ - int isnative, issystem; - root_dir = find_root_location (&issystem, &isnative); - if (root_dir) - { - if (isnative) - install_type = IDC_INSTALL_NATIVE; - else - install_type = IDC_INSTALL_CYGWIN; - - if (issystem) - root_scope = IDC_ROOT_SYSTEM; - else - root_scope = IDC_ROOT_USER; - root_dir_default = 0; - } - else - { - change_default_root (IDC_INSTALL_NATIVE); - root_scope = (is_admin()) ? IDC_ROOT_SYSTEM : IDC_ROOT_USER; - root_dir_default = 1; - } -} - static int CALLBACK browse_cb (HWND h, UINT m, LPARAM lp, LPARAM data) { @@ -317,11 +291,21 @@ return FALSE; } +static void +set_default_root () +{ + change_default_root (IDC_INSTALL_NATIVE); + root_scope = (is_admin()) ? IDC_ROOT_SYSTEM : IDC_ROOT_USER; + root_dir_default = 1; +} + void do_root (HINSTANCE h) { int rv = 0; - read_mount_table (); + // init will have read a previous root + if (!root_dir) + set_default_root (); rv = DialogBox (h, MAKEINTRESOURCE (IDD_ROOT), 0, dialog_proc); if (rv == -1)
--- a/netinstall/splash.cc Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/splash.cc Sun Sep 09 04:37:48 2001 +0000 @@ -68,7 +68,6 @@ do_splash (HINSTANCE h) { int rv = 0; - HANDLE gnu = LoadImage (h, MAKEINTRESOURCE (IDB_GNU), IMAGE_BITMAP, 0, 0, 0); rv = DialogBox (h, MAKEINTRESOURCE (IDD_SPLASH), 0, dialog_proc); if (rv == -1) fatal (IDS_DIALOG_FAILED);
--- a/netinstall/state.h Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/state.h Sun Sep 09 04:37:48 2001 +0000 @@ -29,6 +29,12 @@ extern int root_menu; extern int root_desktop; +extern int reg_c; +extern int reg_cpp; +extern int reg_java; +extern int reg_elisp; +extern int reg_txt; + extern int net_method; extern char * net_proxy_host; extern int net_proxy_port; @@ -42,5 +48,6 @@ extern char * other_url; extern int trust_level; +extern int uninstall; #define MIRROR_SITE (mirror_site ? mirror_site : other_url)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netinstall/uninstall.cc Sun Sep 09 04:37:48 2001 +0000 @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2000, Red Hat, Inc. + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + * Written by DJ Delorie <dj@cygnus.com> + * + */ + +/* The purpose of this file is to intall all the packages selected in + the install list (in ini.h). Note that we use a separate thread to + maintain the progress dialog, so we avoid the complexity of + handling two tasks in one thread. We also create or update all the + files in /etc/setup and create the mount points. */ + +#include <io.h> +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#ifndef WIN32_NATIVE +#include <unistd.h> +#endif +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <zlib.h> + +#include "win32.h" +#include "commctrl.h" + +#include "resource.h" +#include "ini.h" +#include "dialog.h" +#include "concat.h" +#include "geturl.h" +#include "mkdir.h" +#include "state.h" +#include "tar.h" +#include "diskfull.h" +#include "msg.h" +#include "regedit.h" +#include "reginfo.h" +#include "log.h" +#include "hash.h" + +#include "port.h" + +#define XM_DONE (WM_USER + 101) + +static HWND unins_dialog = 0; +static HWND unins_action = 0; +static HWND unins_pkgname = 0; +static HWND unins_filename = 0; +static HWND unins_pprogress = 0; +static HWND unins_iprogress = 0; +static HWND unins_diskfull = 0; +static HANDLE init_event; + +static int package_bytes = 0; +static int uninstall_started = 0; + +extern char * map_filename (char *fn, int type); +void remove_desktop_setup (); +static void start_uninstall (); + +char * +base (char *s); + +static BOOL +dialog_cmd (HWND h, int id, HWND hwndctl, UINT code) +{ + switch (id) + { + case IDCANCEL: + exit_setup (1); + case IDOK: + if (uninstall_started == 0) { + uninstall_started = 1; + start_uninstall(); + } + else + exit_setup(0); + break; + } + return FALSE; +} + +static BOOL CALLBACK +dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + unins_dialog = h; + unins_action = GetDlgItem (h, IDC_UNINS_ACTION); + unins_pkgname = GetDlgItem (h, IDC_UNINS_PKG); + unins_filename = GetDlgItem (h, IDC_UNINS_FILE); + unins_pprogress = GetDlgItem (h, IDC_UNINS_PPROGRESS); + unins_iprogress = GetDlgItem (h, IDC_UNINS_IPROGRESS); + unins_diskfull = GetDlgItem (h, IDC_UNINS_DISKFULL); + SendMessage (unins_pprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); + SendMessage (unins_iprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); + SendMessage (unins_diskfull, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); + SetWindowText (unins_pkgname, ""); + SetWindowText (unins_filename, ""); + SendMessage (unins_pprogress, PBM_SETPOS, (WPARAM) 0, 0); + SendMessage (unins_iprogress, PBM_SETPOS, (WPARAM) 0, 0); + SendMessage (unins_diskfull, PBM_SETPOS, (WPARAM) 0, 0); + return FALSE; + + case XM_DONE: + { + SetWindowText (GetDlgItem (h, IDOK), "Ok"); + LONG style = GetWindowLong (GetDlgItem (h, IDCANCEL), + GWL_STYLE); + SetWindowLong (GetDlgItem (h, IDCANCEL), + GWL_STYLE, style & WS_DISABLED); + } + return FALSE; + + case WM_COMMAND: + return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); + } + return DefWindowProc (h, message, wParam, lParam); +} + +static DWORD WINAPI uninstall_all (void *); + +static void +start_uninstall () +{ + DWORD tid; + HANDLE thread; + init_event = CreateEvent (0, 0, 0, 0); + thread = CreateThread (0, 0, uninstall_all, 0, 0, &tid); + WaitForSingleObject (init_event, 10000); + CloseHandle (init_event); +} + +static void +progress (int bytes, int num) +{ + int perc; + log (0, "%d bytes", bytes); + if (package_bytes > 100) + { + perc = (bytes * 100) / package_bytes; + SendMessage (unins_pprogress, PBM_SETPOS, (WPARAM) perc, 0); + } + + if (npackages > 0) + { + perc = (num * 100) / npackages; + SendMessage (unins_iprogress, PBM_SETPOS, (WPARAM) perc, 0); + } +} + +static int num_installs, num_uninstalls; + +static void +uninstall_one (char *name, int type, int num) +{ + hash dirs; + char line[_MAX_PATH]; + char* fname = (type == TY_GENERIC ? + concat (root_dir, XEMACS_PACKAGE_DIR, "pkginfo/MANIFEST.", + name, 0) : + concat (root_dir, XEMACS_SETUP_DIR, "MANIFEST.", name, 0)); + + FILE* lst = fopen (fname, "rb"); + int pos = 0; + + if (lst) + { + fseek (lst, 0, SEEK_END); + package_bytes = ftell (lst); + fseek (lst, 0, SEEK_SET); + + SetWindowText (unins_pkgname, name); + SetWindowText (unins_action, "Uninstalling..."); + log (0, "uninstalling %s", name); + + while (fgets (line, sizeof (line), lst)) + { + progress (pos, num); + pos += strlen(line); + if (line[strlen(line)-1] == '\n') + line[strlen(line)-1] = 0; + + dirs.add_subdirs (line); + + char *d = map_filename (line, type); + DWORD dw = GetFileAttributes (d); + if (dw != 0xffffffff && !(dw & FILE_ATTRIBUTE_DIRECTORY)) + { + log (LOG_BABBLE, "unlink %s", d); + DeleteFile (d); + } + } + fclose (lst); + remove (fname); + + dirs.reverse_sort (); + char *subdir = 0; + while ((subdir = dirs.enumerate (subdir)) != 0) + { + char *d = map_filename (subdir, type); + if (RemoveDirectory (d)) + log (LOG_BABBLE, "rmdir %s", d); + } + num_uninstalls ++; + } +} + +void +do_uninstall (HINSTANCE h) +{ + num_installs = 0, num_uninstalls = 0; + + next_dialog = 0; // we're done after this + + if (!root_dir) + fatal ("no installation found"); + + int rv = DialogBox (h, MAKEINTRESOURCE (IDD_UNINSTALL), 0, dialog_proc); + if (rv == -1) + fatal (IDS_DIALOG_FAILED); +} + +static void +read_installed_db () +{ + if (!root_dir) + return; + + char line[1000], pkg[1000], inst[1000], src[1000]; + int instsz, srcsz; + + FILE *db = fopen (concat (root_dir, XEMACS_SETUP_DIR, "installed.db", 0), "rt"); + if (!db) + return; + + while (fgets (line, 1000, db)) + { + src[0] = 0; + srcsz = 0; + sscanf (line, "%s %s %d %s %d", pkg, inst, &instsz, src, &srcsz); + + log (0, "read %s", pkg); + Package* np = new_package(strdup(pkg)); + pinfo(*np).install = inst; + pinfo(*np).install_size = instsz; + // pick up versoin + char *v, *d; + for (v=base (inst); *v; v++) + if (*v == '-' && isdigit(v[1])) + { + v++; + break; + } + if (!v) + v = inst; + for (d=v; *d; d++) + if (strncmp (d, ".tar", 4) == 0 + || strncmp (d, "-pkg", 4) == 0) + { + *d = 0; + break; + } + if (v[0]) + pinfo(*np).version = strdup (v); + else + pinfo(*np).version = "0"; + // Crude but effective + if (pkg != 0) + if (strncmp ("xemacs-i686", pkg, 11) == 0 + || (strncmp ("xemacs-i586", pkg, 11) == 0)) + np->type = install_type; + } + fclose (db); +} + +static DWORD WINAPI +uninstall_all (void *) +{ + int i; + SetEvent (init_event); + + int df = diskfull (root_dir); + SendMessage (unins_diskfull, PBM_SETPOS, (WPARAM) df, 0); + + read_installed_db(); + + log (0, "There are %d packages\n", npackages); + for (i=0; i<npackages; i++) + { + log (0, "uninstalling %s\n", package[i].name); + uninstall_one (package[i].name, package[i].type, i); + } + + PostMessage (unins_dialog, XM_DONE, 0, 0); + + remove_desktop_setup(); + char *odbn = concat (root_dir, XEMACS_SETUP_DIR, "installed.db", 0); + char *sdbn = concat (root_dir, XEMACS_SETUP_DIR, "installed.db.old", 0); + + remove (sdbn); + remove (odbn); + + remove_xemacs_root(); + remove_uninstall_path(); + + if (num_installs == 0) + { + // exit_msg = IDS_UNINSTALL_COMPLETE; + return FALSE; + } + + return FALSE; +}
--- a/netinstall/win32.h Sat Sep 08 09:12:09 2001 +0000 +++ b/netinstall/win32.h Sun Sep 09 04:37:48 2001 +0000 @@ -21,24 +21,14 @@ #ifndef _MINI_WIN32_ #define _MINI_WIN32_ -#define _UNION_NAME(x) -#define _STRUCT_NAME(x) #define NOCOMATTRIBUTE #include <stdarg.h> -#ifdef WIN32_NATIVE -/* MSVC is barking with the list above, something else is missing, so - I'm using <windows.h> and lean-n-mean. FP, 2000-23-12 */ + +#define WIN32_LEAN_AND_MEAN #include <windows.h> -#endif -#include <windef.h> -#include <basetyps.h> -#include <winbase.h> -#include <wingdi.h> -#include <winuser.h> + #include <wininet.h> -#include <winreg.h> - #include <windowsx.h> /* Cope with native win32 & mingw differences. Written by F. Popineau
--- a/src/ChangeLog Sat Sep 08 09:12:09 2001 +0000 +++ b/src/ChangeLog Sun Sep 09 04:37:48 2001 +0000 @@ -1,3 +1,29 @@ +2001-09-08 Andy Piper <andy@xemacs.org> + + * device-msw.c (mswindows_finish_init_device): remove dde + initialization. + * device-msw.c (mswindows_init_dde): factor out from + mswindows_finish_init_device() + * device-msw.c (init_mswindows_very_early): new function + initialize but don't enable dde. + * emacs.c (main_1): call init_mswindows_very_early. + * event-msw.c: + * event-msw.c (mswindows_dde_callback): only execute when we are + ready. + * symsinit.h: declare init_mswindows_very_early. + +2001-09-08 Andy Piper <andy@xemacs.org> + + * fileio.c (normalize_filename): copied from nt.c + * (Ffile_name_directory): enable win32 paths under cygwin. + * (Ffile_name_nondirectory): ditto. + * (directory_file_name): ditto. + * (Fexpand_file_name): ditto. + * (Ffile_truename): ditto. + * (Fsubstitute_in_file_name): ditto. + * (Ffile_name_absolute_p): ditto. + * (Ffile_readable_p): ditto. + 2001-07-30 Adrian Aichner <adrian@xemacs.org> * event-msw.c: Typo fix.
--- a/src/device-msw.c Sat Sep 08 09:12:09 2001 +0000 +++ b/src/device-msw.c Sun Sep 09 04:37:48 2001 +0000 @@ -50,6 +50,7 @@ /* win32 DDE management library globals */ #ifdef HAVE_DRAGNDROP DWORD mswindows_dde_mlid; +int mswindows_dde_enable; HSZ mswindows_dde_service; HSZ mswindows_dde_topic_system; HSZ mswindows_dde_item_open; @@ -179,17 +180,18 @@ #endif } +#ifdef HAVE_DRAGNDROP static void -mswindows_finish_init_device (struct device *d, Lisp_Object props) +mswindows_init_dde () { /* Initialize DDE management library and our related globals. We execute a * dde Open("file") by simulating a drop, so this depends on dnd support. */ -#ifdef HAVE_DRAGNDROP # if !(defined(CYGWIN) || defined(MINGW)) CoInitialize (NULL); # endif mswindows_dde_mlid = 0; + mswindows_dde_enable = 1; DdeInitialize (&mswindows_dde_mlid, (PFNCALLBACK)mswindows_dde_callback, APPCMD_FILTERINITS|CBF_FAIL_SELFCONNECTIONS|CBF_FAIL_ADVISES| CBF_FAIL_POKES|CBF_FAIL_REQUESTS|CBF_SKIP_ALLNOTIFICATIONS, @@ -202,6 +204,27 @@ mswindows_dde_item_open = DdeCreateStringHandle (mswindows_dde_mlid, TEXT(MSWINDOWS_DDE_ITEM_OPEN), 0); DdeNameService (mswindows_dde_mlid, mswindows_dde_service, 0L, DNS_REGISTER); +} +#endif + +void +init_mswindows_very_early() +{ +#ifdef HAVE_DRAGNDROP + /* Initializing dde when the device is created is too late - the + client will give up waiting. Instead we initialize here and tell + the client we're too busy until the rest of initialization has + happened. */ + mswindows_init_dde(); +#endif +} + +static void +mswindows_finish_init_device (struct device *d, Lisp_Object props) +{ +#ifdef HAVE_DRAGNDROP + /* Tell pending clients we are ready. */ + mswindows_dde_enable = 1; #endif }
--- a/src/emacs.c Sat Sep 08 09:12:09 2001 +0000 +++ b/src/emacs.c Sun Sep 09 04:37:48 2001 +0000 @@ -1147,6 +1147,11 @@ so we can be fairly accurate. */ init_intl_very_early (); /* set up the locale and domain for gettext and such. */ +#ifdef HAVE_MS_WINDOWS + init_mswindows_very_early (); /* Some things - like dde need to be + initialized early so that the + client doesn't give up waiting. */ +#endif /* Now initialize the Lisp engine and the like. Done only during dumping. No dependence on anything that may be in the user's
--- a/src/event-msw.c Sat Sep 08 09:12:09 2001 +0000 +++ b/src/event-msw.c Sun Sep 09 04:37:48 2001 +0000 @@ -1607,6 +1607,8 @@ * depends on dnd support. */ #ifdef HAVE_DRAGNDROP +extern int mswindows_dde_enable; + HDDEDATA CALLBACK mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv, HSZ hszTopic, HSZ hszItem, HDDEDATA hdata, @@ -1633,6 +1635,9 @@ return (HDDEDATA)NULL; case XTYP_EXECUTE: + if (!mswindows_dde_enable) + return (HDDEDATA) DDE_FBUSY; + if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system)) { DWORD len = DdeGetData (hdata, NULL, 0, 0); @@ -1640,7 +1645,7 @@ char *end; char *filename; struct gcpro gcpro1, gcpro2; - Lisp_Object l_dndlist = Qnil; + Lisp_Object l_dndlist = Qnil; Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); Lisp_Object frmcons, devcons, concons; Lisp_Event *event = XEVENT (emacs_event);
--- a/src/fileio.c Sat Sep 08 09:12:09 2001 +0000 +++ b/src/fileio.c Sun Sep 09 04:37:48 2001 +0000 @@ -53,14 +53,43 @@ #endif /* HPUX_PRE_8_0 */ #endif /* HPUX */ +#if defined(WIN32_NATIVE) || defined(CYGWIN) +#define WIN32_FILENAMES #ifdef WIN32_NATIVE #include "nt.h" +#endif /* WIN32_NATIVE */ #define IS_DRIVE(x) isalpha (x) /* Need to lower-case the drive letter, or else expanded filenames will sometimes compare inequal, because `expand-file-name' doesn't always down-case the drive letter. */ #define DRIVE_LETTER(x) tolower (x) -#endif /* WIN32_NATIVE */ +#ifndef CORRECT_DIR_SEPS +#define CORRECT_DIR_SEPS(s) \ + normalize_filename(s, DIRECTORY_SEP) +/* Default implementation that coerces a file to use path_sep. */ +static void +normalize_filename (char *fp, char path_sep) +{ + /* Always lower-case drive letters a-z, even if the filesystem + preserves case in filenames. + This is so filenames can be compared by string comparison + functions that are case-sensitive. Even case-preserving filesystems + do not distinguish case in drive letters. */ + if (fp[1] == ':' && *fp >= 'A' && *fp <= 'Z') + { + *fp += 'a' - 'A'; + fp += 2; + } + + while (*fp) + { + if (*fp == '/' || *fp == '\\') + *fp = path_sep; + fp++; + } +} +#endif /* CORRECT_DIR_SEPS */ +#endif /* WIN32_NATIVE || CYGWIN */ int lisp_to_time (Lisp_Object, time_t *); Lisp_Object time_to_lisp (time_t); @@ -359,7 +388,7 @@ p = beg + XSTRING_LENGTH (filename); while (p != beg && !IS_ANY_SEP (p[-1]) -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* only recognize drive specifier at beginning */ && !(p[-1] == ':' && p == beg + 2) #endif @@ -414,7 +443,7 @@ end = p = beg + XSTRING_LENGTH (filename); while (p != beg && !IS_ANY_SEP (p[-1]) -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* only recognize drive specifier at beginning */ && !(p[-1] == ':' && p == beg + 2) #endif @@ -518,9 +547,9 @@ strcpy (dst, src); if (slen > 1 && IS_DIRECTORY_SEP (dst[slen - 1]) -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES && !IS_ANY_SEP (dst[slen - 2]) -#endif /* WIN32_NATIVE */ +#endif /* WIN32_FILENAMES */ ) dst[slen - 1] = 0; return 1; @@ -687,12 +716,13 @@ Bufbyte *newdir, *p, *o; int tlen; Bufbyte *target; -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES int drive = 0; int collapse_newdir = 1; -#else +#endif +#ifndef WIN32_NATIVE struct passwd *pw; -#endif /* WIN32_NATIVE */ +#endif /* WIN32_FILENAMES */ int length; Lisp_Object handler = Qnil; #ifdef CYGWIN @@ -742,14 +772,13 @@ /* Save time in some common cases - as long as default_directory is not relative, it can be canonicalized with name below (if it is needed at all) without requiring it to be expanded now. */ -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* Detect Windows file names with drive specifiers. */ && ! (IS_DRIVE (o[0]) && (IS_DEVICE_SEP (o[1]) && IS_DIRECTORY_SEP (o[2]))) /* Detect Windows file names in UNC format. */ && ! (IS_DIRECTORY_SEP (o[0]) && IS_DIRECTORY_SEP (o[1])) - -#else /* not WIN32_NATIVE */ - +#endif /* not WIN32_FILENAMES */ +#ifndef WIN32_NATIVE /* Detect Unix absolute file names (/... alone is not absolute on Windows). */ && ! (IS_DIRECTORY_SEP (o[0])) @@ -766,7 +795,7 @@ into name should be safe during all of this, though. */ nm = XSTRING_DATA (name); -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* We will force directory separators to be either all \ or /, so make a local copy to modify, even if there ends up being no change. */ nm = strcpy ((char *)alloca (strlen ((char *)nm) + 1), (char *)nm); @@ -777,6 +806,7 @@ Bufbyte *colon = (Bufbyte *) strrchr ((char *)nm, ':'); if (colon) + { /* Only recognize colon as part of drive specifier if there is a single alphabetic character preceding the colon (and if the character before the drive letter, if present, is a directory @@ -797,6 +827,7 @@ if (colon[0] == ':') goto look_again; } + } } /* If we see "c://somedir", we want to strip the first slash after the @@ -804,7 +835,7 @@ "//somedir". */ if (drive && IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1])) nm++; -#endif /* WIN32_NATIVE */ +#endif /* WIN32_FILENAMES */ /* If nm is absolute, look for /./ or /../ sequences; if none are found, we can probably return right away. We will avoid allocating @@ -842,25 +873,29 @@ } if (!lose) { -#ifdef WIN32_NATIVE - /* Make sure directories are all separated with / or \ as - desired, but avoid allocation of a new string when not - required. */ - CORRECT_DIR_SEPS (nm); - if (IS_DIRECTORY_SEP (nm[1])) +#ifdef WIN32_FILENAMES + if (drive || IS_DIRECTORY_SEP (nm[1])) { - if (strcmp (nm, XSTRING_DATA (name)) != 0) - name = build_string (nm); + /* Make sure directories are all separated with / or \ as + desired, but avoid allocation of a new string when not + required. */ + CORRECT_DIR_SEPS (nm); + if (IS_DIRECTORY_SEP (nm[1])) + { + if (strcmp (nm, XSTRING_DATA (name)) != 0) + name = build_string (nm); + } + /* drive must be set, so this is okay */ + else if (strcmp (nm - 2, XSTRING_DATA (name)) != 0) + { + name = make_string (nm - 2, p - nm + 2); + XSTRING_DATA (name)[0] = DRIVE_LETTER (drive); + XSTRING_DATA (name)[1] = ':'; + } + RETURN_UNGCPRO (name); } - /* drive must be set, so this is okay */ - else if (strcmp (nm - 2, XSTRING_DATA (name)) != 0) - { - name = make_string (nm - 2, p - nm + 2); - XSTRING_DATA (name)[0] = DRIVE_LETTER (drive); - XSTRING_DATA (name)[1] = ':'; - } - RETURN_UNGCPRO (name); -#else /* not WIN32_NATIVE */ +#endif /* not WIN32_FILENAMES */ +#ifndef WIN32_NATIVE if (nm == XSTRING_DATA (name)) RETURN_UNGCPRO (name); RETURN_UNGCPRO (build_string ((char *) nm)); @@ -901,7 +936,7 @@ Qfile_name); nm++; -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES collapse_newdir = 0; #endif } @@ -951,11 +986,12 @@ } } -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* On DOS and Windows, nm is absolute if a drive name was specified; use the drive's current directory as the prefix if needed. */ if (!newdir && drive) { +#ifdef WIN32_NATIVE /* Get default directory if needed to make nm absolute. */ if (!IS_DIRECTORY_SEP (nm[0])) { @@ -963,6 +999,7 @@ if (!_getdcwd (toupper (drive) - 'A' + 1, newdir, MAXPATHLEN)) newdir = NULL; } +#endif /* WIN32_NATIVE */ if (!newdir) { /* Either nm starts with /, or drive isn't mounted. */ @@ -973,7 +1010,7 @@ newdir[3] = 0; } } -#endif /* WIN32_NATIVE */ +#endif /* WIN32_FILENAMES */ /* Finally, if no prefix has been specified and nm is not absolute, then it must be expanded relative to default_directory. */ @@ -982,7 +1019,8 @@ #ifndef WIN32_NATIVE /* /... alone is not absolute on DOS and Windows. */ && !IS_DIRECTORY_SEP (nm[0]) -#else +#endif +#ifdef WIN32_FILENAMES && !(IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1])) #endif && !newdir) @@ -990,7 +1028,7 @@ newdir = XSTRING_DATA (default_directory); } -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES if (newdir) { /* First ensure newdir is an absolute name. */ @@ -1002,6 +1040,10 @@ && ! (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1])) /* Detect drive spec by itself */ && ! (IS_DEVICE_SEP (newdir[1]) && newdir[2] == 0) + /* Detect unix format. */ +#ifndef WIN32_NATIVE + && ! (IS_DIRECTORY_SEP (newdir[0])) +#endif ) { /* Effectively, let newdir be (expand-file-name newdir cwd). @@ -1025,7 +1067,9 @@ newdir = alloca (MAXPATHLEN + 1); if (drive) { +#ifdef WIN32_NATIVE if (!_getdcwd (toupper (drive) - 'A' + 1, newdir, MAXPATHLEN)) +#endif newdir = "/"; } else @@ -1041,7 +1085,11 @@ /* Keep only a prefix from newdir if nm starts with slash (/ /server/share for UNC, nothing otherwise). */ - if (IS_DIRECTORY_SEP (nm[0]) && collapse_newdir) + if (IS_DIRECTORY_SEP (nm[0]) +#ifndef WIN32_NATIVE + && IS_DIRECTORY_SEP (nm[1]) +#endif + && collapse_newdir) { if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1])) { @@ -1056,7 +1104,7 @@ newdir = ""; } } -#endif /* WIN32_NATIVE */ +#endif /* WIN32_FILENAMES */ if (newdir) { @@ -1064,7 +1112,7 @@ just // (an incomplete UNC name). */ length = strlen ((char *) newdir); if (length > 1 && IS_DIRECTORY_SEP (newdir[length - 1]) -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES && !(length == 2 && IS_DIRECTORY_SEP (newdir[0])) #endif ) @@ -1081,14 +1129,14 @@ /* Now concatenate the directory and name to new space in the stack frame */ tlen += strlen ((char *) nm) + 1; -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* Add reserved space for drive name. (The Microsoft x86 compiler produces incorrect code if the following two lines are combined.) */ target = (Bufbyte *) alloca (tlen + 2); target += 2; -#else /* not WIN32_NATIVE */ +#else /* not WIN32_FILENAMES */ target = (Bufbyte *) alloca (tlen); -#endif /* not WIN32_NATIVE */ +#endif /* not WIN32_FILENAMES */ *target = 0; if (newdir) @@ -1137,7 +1185,7 @@ ++o; p += 3; } -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* if drive is set, we're not dealing with an UNC, so multiple dir-seps are redundant (and reportedly cause trouble under win95) */ @@ -1150,7 +1198,7 @@ } } -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* At last, set drive name, except for network file name. */ if (drive) { @@ -1158,12 +1206,14 @@ target[0] = DRIVE_LETTER (drive); target[1] = ':'; } +#ifdef WIN32_NATIVE else { assert (IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1])); } +#endif CORRECT_DIR_SEPS (target); -#endif /* WIN32_NATIVE */ +#endif /* WIN32_FILENAMES */ RETURN_UNGCPRO (make_string (target, o - target)); } @@ -1240,7 +1290,7 @@ { Extbyte *pos; -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES if (IS_DRIVE (p[0]) && IS_DEVICE_SEP (p[1]) && IS_DIRECTORY_SEP (p[2])) /* don't test c: on windows */ @@ -1360,12 +1410,12 @@ for (p = nm; p != endp; p++) { if ((p[0] == '~' -#if defined (WIN32_NATIVE) || defined (CYGWIN) +#if defined (WIN32_FILENAMES) /* // at start of file name is meaningful in WindowsNT systems */ || (IS_DIRECTORY_SEP (p[0]) && p - 1 != nm) -#else /* not (WIN32_NATIVE || CYGWIN) */ +#else /* not (WIN32_FILENAMES) */ || IS_DIRECTORY_SEP (p[0]) -#endif /* not (WIN32_NATIVE || CYGWIN) */ +#endif /* not (WIN32_FILENAMES) */ ) && p != nm && (IS_DIRECTORY_SEP (p[-1]))) @@ -1373,7 +1423,7 @@ nm = p; substituted = 1; } -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES /* see comment in expand-file-name about drive specifiers */ else if (IS_DRIVE (p[0]) && p[1] == ':' && p > nm && IS_DIRECTORY_SEP (p[-1])) @@ -1381,7 +1431,7 @@ nm = p; substituted = 1; } -#endif /* WIN32_NATIVE */ +#endif /* WIN32_FILENAMES */ } /* See if any variables are substituted into the string @@ -1491,16 +1541,16 @@ for (p = xnm; p != x; p++) if ((p[0] == '~' -#if defined (WIN32_NATIVE) +#if defined (WIN32_FILENAMES) || (IS_DIRECTORY_SEP (p[0]) && p - 1 != xnm) -#else /* not WIN32_NATIVE */ +#else /* not WIN32_FILENAMES */ || IS_DIRECTORY_SEP (p[0]) -#endif /* not WIN32_NATIVE */ +#endif /* not WIN32_FILENAMES */ ) /* don't do p[-1] if that would go off the beginning --jwz */ && p != nm && p > xnm && IS_DIRECTORY_SEP (p[-1])) xnm = p; -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES else if (IS_DRIVE (p[0]) && p[1] == ':' && p > nm && IS_DIRECTORY_SEP (p[-1])) xnm = p; @@ -2097,7 +2147,7 @@ CHECK_STRING (filename); ptr = XSTRING_DATA (filename); return (IS_DIRECTORY_SEP (*ptr) || *ptr == '~' -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES || (IS_DRIVE (*ptr) && ptr[1] == ':' && IS_DIRECTORY_SEP (ptr[2])) #endif ) ? Qt : Qnil; @@ -2215,14 +2265,14 @@ if (!NILP (handler)) RETURN_UNGCPRO (call2 (handler, Qfile_readable_p, abspath)); -#if defined(WIN32_NATIVE) || defined(CYGWIN) +#if defined(WIN32_FILENAMES) /* Under MS-DOS and Windows, open does not work for directories. */ UNGCPRO; if (access ((char *) XSTRING_DATA (abspath), 0) == 0) return Qt; else return Qnil; -#else /* not WIN32_NATIVE */ +#else /* not WIN32_FILENAMES */ { int desc = interruptible_open ((char *) XSTRING_DATA (abspath), O_RDONLY | OPEN_BINARY, 0); UNGCPRO; @@ -2231,7 +2281,7 @@ close (desc); return Qt; } -#endif /* not WIN32_NATIVE */ +#endif /* not WIN32_FILENAMES */ } /* Having this before file-symlink-p mysteriously caused it to be forgotten
--- a/src/symsinit.h Sat Sep 08 09:12:09 2001 +0000 +++ b/src/symsinit.h Sun Sep 09 04:37:48 2001 +0000 @@ -32,6 +32,7 @@ void init_process_times_very_early (void); void init_ralloc (void); void init_signals_very_early (void); +void init_mswindows_very_early (void); /* Early Lisp-engine initialization (dump-time for init, run-time for reinit). */