diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/Makefile xyzzy-0.2.235.copy/src/Makefile --- xyzzy-0.2.235.org/src/Makefile 2005-12-07 23:20:10.000000000 +0900 +++ xyzzy-0.2.235.copy/src/Makefile 2009-09-23 01:37:40.000000000 +0900 @@ -1,8 +1,8 @@ # define VC++ version (4, 6, or 7) -VCVER=4 +VCVER=9 .SUFFIXES: .cc .rc .res .d SRCS=\ Buffer.cc \ @@ -138,11 +138,15 @@ !ELSE CXXOPT=-GF -EHa !ENDIF DEFS=-DSTRICT -DWIN32 -D_WIN32 -D_MT -D__XYZZY__ -DPRIVCTRL_NODLL -DHAVE_DIMM_H -DDEBUG_GC +!IF "$(VCVER)" == "9" +CXX=cl -nologo -Zc:wchar_t- -Zc:forScope- -D_CRT_SECURE_NO_DEPRECATE +!ELSE CXX=cl -nologo +!ENDIF CPP=cl -nologo -E LD=link -nologo LIBS=kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib \ comctl32.lib imm32.lib setargv.obj comdlg32.lib mpr.lib ole32.lib \ oleaut32.lib winspool.lib zlib/zlib.lib diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/afxres.h xyzzy-0.2.235.copy/src/afxres.h --- xyzzy-0.2.235.org/src/afxres.h 1970-01-01 09:00:00.000000000 +0900 +++ xyzzy-0.2.235.copy/src/afxres.h 2009-09-23 01:37:40.000000000 +0900 @@ -0,0 +1,2 @@ +#include +#define IDC_STATIC (-1) diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/arc-if.cc xyzzy-0.2.235.copy/src/arc-if.cc --- xyzzy-0.2.235.org/src/arc-if.cc 2005-03-16 20:47:46.000000000 +0900 +++ xyzzy-0.2.235.copy/src/arc-if.cc 2009-09-23 01:37:40.000000000 +0900 @@ -1,7 +1,8 @@ #include "arc-if.h" #include "vfs.h" +#include const char *ArchiverInterface::ai_names[] = { "GetVersion", "GetRunning", @@ -45,14 +46,35 @@ } ArchiverInterface::lock::lock (const ArchiverInterface &ai) : l_ai (const_cast (ai)), l_omodule (ai.ai_hmodule) { + const int max_path = 1024; + /* get module path */ + char module_path_name[max_path]; + GetModuleFileName (0, module_path_name, sizeof module_path_name); + char *p = (char *)_mbsrchr ((const unsigned char *)module_path_name, '\\'); + if (p) p[1] = 0; + /* set module_path_name */ + const char * lib_path_name = "lib\\"; + if ((strlen(module_path_name) + + strlen(lib_path_name) + + strlen(l_ai.ai_module_name)) + > (max_path - 1)) { + MessageBox (0, "Too long path of archive dir!", "xyzzy error", MB_OK | MB_ICONHAND); + } + else { + strcat(module_path_name, lib_path_name); + strcat(module_path_name, l_ai.ai_module_name); + } if (l_omodule) return; UINT omode = SetErrorMode (SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); l_ai.ai_hmodule = WINFS::LoadLibrary (l_ai.ai_module_name); + if (! l_ai.ai_hmodule) { + l_ai.ai_hmodule = WINFS::LoadLibrary (module_path_name); + } SetErrorMode (omode); if (l_ai.ai_hmodule) l_ai.patch_module ((void *)l_ai.ai_hmodule); } diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/archiver.cc xyzzy-0.2.235.copy/src/archiver.cc --- xyzzy-0.2.235.org/src/archiver.cc 2002-08-12 01:58:40.000000000 +0900 +++ xyzzy-0.2.235.copy/src/archiver.cc 2009-09-23 01:37:40.000000000 +0900 @@ -75,11 +75,11 @@ } static char * copy_path (char *b, const char *o, const char *d, int dirp = 0) { - char *spc = strchr (d, ' '); + const char *spc = strchr (d, ' '); if (spc) *b++ = '"'; b = stpcpy (b, o); char *b0 = b; b = docopy (b, d); diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/dyn-handle.h xyzzy-0.2.235.copy/src/dyn-handle.h --- xyzzy-0.2.235.org/src/dyn-handle.h 1997-12-20 18:15:48.000000000 +0900 +++ xyzzy-0.2.235.copy/src/dyn-handle.h 2009-09-23 01:37:40.000000000 +0900 @@ -2,11 +2,11 @@ # define _DYN_HANDLE_H_ class dyn_handle { private: - operator = (const dyn_handle &); + void operator = (const dyn_handle &); protected: HANDLE h; public: dyn_handle (); dyn_handle (HANDLE); diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/encoding.cc xyzzy-0.2.235.copy/src/encoding.cc --- xyzzy-0.2.235.org/src/encoding.cc 2005-03-16 20:55:04.000000000 +0900 +++ xyzzy-0.2.235.copy/src/encoding.cc 2009-09-23 01:37:40.000000000 +0900 @@ -615,19 +615,19 @@ switch (lang) { default: case ENCODING_LANG_JP: case ENCODING_LANG_JP2: - return putw_jp; + return &putw_jp; case ENCODING_LANG_KR: case ENCODING_LANG_CN_GB: case ENCODING_LANG_CN_BIG5: - return putw_gen; + return &putw_gen; case ENCODING_LANG_CN: - return putw_cn; + return &putw_cn; } } void utf_to_internal_stream::putw_jp (ucs2_t wc) diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/environ.cc xyzzy-0.2.235.copy/src/environ.cc --- xyzzy-0.2.235.org/src/environ.cc 2005-12-03 23:25:02.000000000 +0900 +++ xyzzy-0.2.235.copy/src/environ.cc 2009-09-23 01:37:40.000000000 +0900 @@ -849,10 +849,20 @@ char *e = getenv (v); return e ? make_string (e) : Qnil; } lisp +Fsi_putenv (lisp var) +{ + check_string (var); + char *v = (char *)alloca (xstring_length (var) * 2 + 1); + w2s (v, var); + int ret = _putenv(v); + return (ret) ? Qnil : make_string (v); +} + +lisp Fsi_system_root () { return xsymbol_value (Qmodule_dir); } diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/environ.h xyzzy-0.2.235.copy/src/environ.h --- xyzzy-0.2.235.org/src/environ.h 2001-03-17 06:05:46.000000000 +0900 +++ xyzzy-0.2.235.copy/src/environ.h 2009-09-23 01:37:40.000000000 +0900 @@ -35,11 +35,11 @@ { if (hkey) RegCloseKey (hkey); } -inline +inline int Registry::fail () const { return !hkey; } diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/gen-syms.cc xyzzy-0.2.235.copy/src/gen-syms.cc --- xyzzy-0.2.235.org/src/gen-syms.cc 2005-12-03 23:24:50.000000000 +0900 +++ xyzzy-0.2.235.copy/src/gen-syms.cc 2009-09-23 01:37:40.000000000 +0900 @@ -897,10 +897,11 @@ SI_DEFUN3 (*structure-reader, 2, 0, 0), /* environ.cc */ SI_DEFUN3 (system-root, 0, 0, 0), SI_DEFUN3 (getenv, 1, 0, 0), + SI_DEFUN3 (putenv, 1, 0, 0), SI_DEFUN3 (delete-registry-tree, 0, 0, 0), SI_DEFUN3 (performance-counter, 0, 0, 0), SI_DEFUN3 (dump-image-path, 0, 0, 0), DEFCONST2Q (*performance-counter-frequency*), diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/init.cc xyzzy-0.2.235.copy/src/init.cc --- xyzzy-0.2.235.org/src/init.cc 2005-12-04 07:49:54.000000000 +0900 +++ xyzzy-0.2.235.copy/src/init.cc 2009-09-23 01:37:40.000000000 +0900 @@ -127,39 +127,33 @@ } static void init_home_dir () { - char path[PATH_MAX]; - static const char xyzzyhome[] = "XYZZYHOME"; - static const char cfgInit[] = "init"; - - if (read_conf (cfgInit, "homeDir", path, sizeof path) - && init_home_dir (path)) - return; - - for (int i = 0; i <= 5; i += 5) - { - char *e = getenv (xyzzyhome + i); - if (e && init_home_dir (e)) - return; - } - - char *drive = getenv ("HOMEDRIVE"); - char *dir = getenv ("HOMEPATH"); - if (drive && dir && strlen (drive) + strlen (dir) < sizeof path - 1) - { - strcpy (stpcpy (path, drive), dir); - if (init_home_dir (path)) - return; - } - - if (read_conf (cfgInit, "logDir", path, sizeof path) - && init_home_dir (path)) - return; - - xsymbol_value (Qhome_dir) = xsymbol_value (Qmodule_dir); + char module_path[PATH_MAX]; + char module_drive[PATH_MAX]; + char buffer[PATH_MAX]; + char *p; + /* get module_path */ + GetModuleFileName (0, module_path, sizeof module_path); + p = jrindex (module_path, '\\'); + if (p) p[1] = 0; + /* get module_drive */ + strcpy(&module_drive[0], module_path); + p = jindex (module_drive, '\\'); + if (p) p[1] = 0; + /* $xyzzy\home */ + strcpy(&buffer[0], module_path); + if (init_home_dir(strcat(buffer, "home\\"))) return; + /* :\xyzzyhome */ + strcpy(&buffer[0], module_drive); + if (init_home_dir(strcat(buffer, "xyzzyhome\\"))) return; + /* :\home */ + strcpy(&buffer[0], module_drive); + if (init_home_dir(strcat(buffer, "home\\"))) return; + /* $xyzzy */ + xsymbol_value (Qhome_dir) = make_path(module_path); } static void init_load_path () { @@ -567,10 +561,50 @@ init_lisp_objects () { const char *config_path = 0, *ini_file = 0; *app.dump_image = 0; + const char * image_file_name = "xyzzy.image"; + const char * config_path_name = "usr\\"; + char module_path[PATH_MAX]; + char temp_path[PATH_MAX]; + char image_file_preset[PATH_MAX]; + char config_path_preset[PATH_MAX]; + + /* get module_path */ + GetModuleFileName (0, module_path, sizeof module_path); + char *p = jrindex (module_path, '\\'); + if (p) + p[1] = 0; + /* get temp_path */ + GetTempPath(sizeof temp_path, temp_path); + + /* set image_file_preset */ + image_file_preset[0] = '\0'; + if ((strlen(temp_path) + strlen(image_file_name)) > (PATH_MAX - 1)) { + MessageBox (0, "Too long path of xyzzy.image!", TitleBarString, MB_OK | MB_ICONHAND); + return 0; + } + else { + strcat(image_file_preset, temp_path); + strcat(image_file_preset, image_file_name); + } + + /* set config_path_preset */ + config_path_preset[0] = '\0'; + if ((strlen(module_path) + strlen(config_path_name)) > (PATH_MAX - 1)) { + MessageBox (0, "Too long path of config!", TitleBarString, MB_OK | MB_ICONHAND); + return 0; + } + else { + strcat(config_path_preset, module_path); + strcat(config_path_preset, config_path_name); + } + + strcpy(app.dump_image ,image_file_preset); + config_path = config_path_preset; + for (int ac = 1; ac < __argc - 1; ac += 2) if (!strcmp (__argv[ac], "-image")) { char *tem; int l = WINFS::GetFullPathName (__argv[ac + 1], sizeof app.dump_image, diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/insdel.cc xyzzy-0.2.235.copy/src/insdel.cc --- xyzzy-0.2.235.org/src/insdel.cc 2001-07-22 21:39:52.000000000 +0900 +++ xyzzy-0.2.235.copy/src/insdel.cc 2009-09-23 01:37:40.000000000 +0900 @@ -163,13 +163,13 @@ { memmove (dp->c_text + dst, sp->c_text + src, sizeof (Char) * size); } static void -adjust (const Chunk *&chunk, int &offset) +adjust (Chunk *&chunk, int &offset) { - const Chunk *cp = chunk; + Chunk *cp = chunk; int o = offset; while (o > cp->c_used) { o -= cp->c_used; cp = cp->c_next; @@ -225,13 +225,13 @@ w_point.p_chunk = prev; w_point.p_offset = pused; } static void -adjust_dst (const Chunk *&chunk, int &offset) +adjust_dst (Chunk *&chunk, int &offset) { - const Chunk *cp = chunk; + Chunk *cp = chunk; int o = offset; while (o > Chunk::TEXT_SIZE) { o -= Chunk::TEXT_SIZE; cp = cp->c_next; diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/minibuf.cc xyzzy-0.2.235.copy/src/minibuf.cc --- xyzzy-0.2.235.org/src/minibuf.cc 2002-03-06 23:42:24.000000000 +0900 +++ xyzzy-0.2.235.copy/src/minibuf.cc 2009-09-23 01:37:40.000000000 +0900 @@ -255,11 +255,11 @@ lpkg = Ffind_package (lpkg); if (lpkg != Qnil) package = lpkg; } - const Char *b = xstring_contents (string); + Char *b = xstring_contents (string); int l = xstring_length (string); maybe_symbol_string mss (package); mss.parse (b, l); package = mss.current_package (); @@ -525,11 +525,11 @@ lpkg = Ffind_package (lpkg); if (lpkg != Qnil) package = lpkg; } - const Char *b = xstring_contents (c_target); + Char *b = xstring_contents (c_target); int l = xstring_length (c_target); maybe_symbol_string mss (package); mss.parse (b, l); package = mss.current_package (); diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/package.cc xyzzy-0.2.235.copy/src/package.cc --- xyzzy-0.2.235.org/src/package.cc 2000-04-02 03:44:10.000000000 +0900 +++ xyzzy-0.2.235.copy/src/package.cc 2009-09-23 01:37:40.000000000 +0900 @@ -651,15 +651,15 @@ } return 0; } void -maybe_symbol_string::parse (const Char *&xb, int &xl) +maybe_symbol_string::parse (Char *&xb, int &xl) { - const Char *b = xb; - const Char *be = b + xl; - for (const Char *colon = b; colon < be; colon++) + Char *b = xb; + Char *be = b + xl; + for (Char *colon = b; colon < be; colon++) if (*colon == ':') { if (colon == b) package = xsymbol_value (Vkeyword_package); else diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/package.h xyzzy-0.2.235.copy/src/package.h --- xyzzy-0.2.235.org/src/package.h 1997-12-06 23:55:24.000000000 +0900 +++ xyzzy-0.2.235.copy/src/package.h 2009-09-23 01:37:40.000000000 +0900 @@ -93,10 +93,10 @@ lisp package; const Char *pkge; public: maybe_symbol_string (lisp pkg) : package (pkg), pkge (0) {} lisp current_package () const {return package;} - void parse (const Char *&b, int &l); + void parse (Char *&b, int &l); const Char *pkg_end () const {return pkge;} }; #endif diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/syntax.cc xyzzy-0.2.235.copy/src/syntax.cc --- xyzzy-0.2.235.org/src/syntax.cc 2004-01-21 23:41:56.000000000 +0900 +++ xyzzy-0.2.235.copy/src/syntax.cc 2009-09-23 01:37:40.000000000 +0900 @@ -3876,11 +3876,11 @@ u_char syntax_state::ss_maybe_comment[SS_MAX]; lisp syntax_state::ss_hashtab; const syntax_table *syntax_state::ss_tab; Buffer *syntax_state::ss_bp; Chunk *syntax_state::ss_chunk; -void (syntax_state::*syntax_state::update)(Char); +void (syntax_state::*syntax_state::update)(const Char *); void syntax_state::init_color_table () { int prev, cur, next; diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/xdde.h xyzzy-0.2.235.copy/src/xdde.h --- xyzzy-0.2.235.org/src/xdde.h 1999-08-11 01:27:52.000000000 +0900 +++ xyzzy-0.2.235.copy/src/xdde.h 2009-09-23 01:37:40.000000000 +0900 @@ -226,11 +226,11 @@ : hdata (h_) { d = DdeAccessData (hdata, &len); } -inline +inline int DdeDataP::length () const { return len; } diff -U5 -rN --strip-trailing-cr -x '*.obj' -x '*.exe' -x '*.lib' -x '*.res' -x '*.dll' xyzzy-0.2.235.org/src/xyzzycli.cc xyzzy-0.2.235.copy/src/xyzzycli.cc --- xyzzy-0.2.235.org/src/xyzzycli.cc 2001-06-03 08:45:02.000000000 +0900 +++ xyzzy-0.2.235.copy/src/xyzzycli.cc 2009-09-23 01:38:17.000000000 +0900 @@ -132,11 +132,11 @@ } static HANDLE dup_handle (HANDLE hsrc, DWORD pid) { - HANDLE hproc = OpenProcess (PROCESS_ALL_ACCESS, 0, pid); + HANDLE hproc = OpenProcess (PROCESS_DUP_HANDLE, 0, pid); if (!hproc) return 0; HANDLE hdst; if (!DuplicateHandle (hproc, hsrc, GetCurrentProcess (), &hdst, 0, 0, DUPLICATE_SAME_ACCESS))