annotate nt/runemacs.c @ 103616:af77bf73dfe0

* verilog-mode.el (verilog-beg-of-statement) (verilog-endcomment-reason-re): Support unique case and priority case. (verilog-basic-complete-re): Support localparam lineup. (verilog-beg-of-statement-1): Fix for robustness, unique case. (verilog-set-auto-endcomments): Fix for unique case, always_comb commenting. (verilog-leap-to-case-head): Now support *nested* unique & priority case statements. (verilog-auto-lineup): Make just declarations the default (as it had been). (verilog-leap-to-case-head): Support priority/unique case statements. (verilog-auto-lineup): Rework to give users radio buttons to select the various styles of automatic lineup (verilog-error-regexp-alist): Rework to support the XEmacs style of error regular expressions from compilers, lint tools & simulators. Note that GNU Emacs has made it impossible for a mode to load such things. (electric-verilog-terminate-line, verilog-indent-declaration) (verilog-auto-wiure): Rework for radio button selection of auto-lineup selection of specification of auto lineup. (verilog-beg-of-statement-1): Redesign to support proper operation in additional code, based on testing with auto-lineup. (verilog-calculate-indent, assignments & declarations) (verilog-backward-token): Enhance to support auto-lineup of assignments & declarations. (verilog-in-directive-p, verilog-at-struct-p): New function for easy test of whether we are. (verilog-pretty-declarations, verilog-pretty-expr): Massive rework to support safe execution at almost anyline. (verilog-calc-1): Properly support indenting deep inside generate blocks. (verilog-init-font) Remove definition & use of verilog-init-font, as it is redundant with font-lock-defaults. (verilog-mode): Alter the definition of verilog-font-lock-defualts to avoid circular calls if syntax-ppss is a function (as is the case now in 22.x GNU Emacs) as that function would sometimes call itself, leading to (nearly) infinite recursion (verilog-ovm-begin-re, verilog-ovm-end-re) (verilog-ovm-statement-re, verilog-leap-to-head) (verilog-backward-token): Add support for OVM macros. Some are complete statements, and others open and close scopes like begin and end. (verilog-defun-level-not-generate-re, verilog-defun-level-re) (verilog-defun-level-generate-only-re): Really fix the defun-list compilation issue (verilog-calc-1) (verilog-beg-of-statement): Enhance support for coverpoint, constraint and cross statements (verilog-defun-level-list, verilog-generate-defun-level-list) (verilog-all-defun-level-list): Redo these specifications - it is too hard to support eval-when compile aggregation of lists also built at when-compile time. (verilog-defun-level-list): Place defconsts of variables used in building regular expressions which are built in eval-when-compile bodies in the same eval-when-compile body to facilitate compile without load. (verilog-beg-block-re-ordered): Support indenting virtual/protected tasks and functions. (verilog-defun-level-list,verilog-in-generate-region-p) (verilog-backward-ws&directives, verilog-calc-1): Speed up indentation of some module items (generate items). (verilog-forward-sexp, verilog-leap-to-head): Support stepping across virtual/protected tasks and functions. * verilog-mode.el (verilog-auto-arg, verilog-auto-arg-sort): Allow sorting AUTOARG lists. Suggested by Andrea Fedeli. (verilog-read-sub-decls-line): Fix AUTOWIRE signals getting lost in concatenations. Reported by Yishay Belkind. (verilog-auto-ascii-enum): Support one-hot state machines in AUTOASCIIENUM. Suggested by Lloyd Gomez. (verilog-auto-inst, verilog-auto-inst-port): Include interface modport in AUTOINST and add vl-modport for users. Reported by David Rogoff. (verilog-auto-inout-module, verilog-auto-inst) (verilog-decls-get-interfaces, verilog-insert-definition) (verilog-insert-one-definition, verilog-read-decls) (verilog-read-sub-decls, verilog-read-sub-decls-sig) (verilog-sig-modport, verilog-signals-combine-bus) (verilog-subdecls-get-interfaces): Fix expansion of SystemVerilog interfaces in AUTOINOUTMODULE, AUTOINOUTCOMP, and AUTOINST. Suggested by David Rogoff. (verilog-repair-open-comma): Fix non-insertion of comma when `DEFINE occurs in V2K argument list. Reported by Lane Brooks. (verilog-make-width-expression): Simplify [A-1:0] expression widths to just {A{1'b0}}. (verilog-mode): Cleanup checkdoc warnings. (verilog-auto-inout-module, verilog-signals-matching-dir-re): Add third optional regexp to AUTOINOUTMODULE to allow selecting only inputs/outputs or data type. Suggested by Vasu Kandadi. (next-error-last-buffer): Fix byte-compiler warning. (verilog-auto, verilog-auto-insert-lisp, verilog-auto-inst) (verilog-delete-auto): Add AUTOINSERTLISP to insert arbitrary lisp or shell command text during AUTO expansion. Suggested by Tad Truex. (verilog-read-sub-decls-expr, verilog-read-sub-decls-line) (verilog-read-sub-decls-sig, verilog-symbol-detick-text): Fix dotted nets {a.b,c.d} and excaped identifiers being mis-included in AUTOINOUT. Reported by Matthew Lovell. (verilog-read-always-signals-recurse): Fix AUTORESET "if (a<=b)" causing use of <= assignments. Reported by Alex Reed. (verilog-read-decls): Fix triand, trior, wand, wor to be recognized by AUTOWIRE. Reported by Spencer Isaacson. (verilog-extended-complete-re): Support import "DPI-C" functions. (verilog-read-always-signals-recurse): Fix AUTORESET of "x <= y[a+1:a+1]" to not include a in reset list. Reported by Dan Dever. (verilog-insert-date, verilog-insert-year) (verilog-sk-header-tmpl): Fix verilog-header inserting error on Windows systems. Reported by Michael Potts. (verilog-read-module-name): Fix AUTOINST when the child module declaration's name is a tick define. Reported by Elliot Mednick. (verilog-read-decls): Fix V2K parameter bit subscripts getting passed to next parameter's definition. Reported by Bruce T. (verilog-read-decls): Fix detecting "parameter int" when using AUTOINSTPARAM. Reported by Bruce T. (verilog-goto-defun): Fix goto not finding modules unless first perform a verilog-auto expansion. Suggested by Lawrence Butcher. (verilog-mode): Expand -f flag arguments on entry to mode so verilog-goto-defun will work. Reported by Lawrence Butcher. (verilog-getopt): Expand environment variables in -f file arguments. Suggested by Lawrence Butcher. (verilog-set-define): Fix "Symbol's value as variable is void" when reading enumerations. (verilog-auto-ascii-enum): Fix duplicate labels in AUTOASCIIENUM. Suggested by Stephen Peltan. (verilog-read-defines): Fix reading of enumerations in include files. Reported by Steve Peltan.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sun, 28 Jun 2009 17:52:45 +0000
parents aeceb2460b39
children 48d529d3a5a4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
100954
aeceb2460b39 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 94795
diff changeset
1 /* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
75249
4ad431d8e164 Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 73541
diff changeset
2 Free Software Foundation, Inc.
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
3
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
4 This file is part of GNU Emacs.
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
5
94795
188974bfdea0 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79730
diff changeset
6 GNU Emacs is free software: you can redistribute it and/or modify
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
7 it under the terms of the GNU General Public License as published by
94795
188974bfdea0 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79730
diff changeset
8 the Free Software Foundation, either version 3 of the License, or
188974bfdea0 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79730
diff changeset
9 (at your option) any later version.
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
10
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
14 GNU General Public License for more details.
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
15
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
16 You should have received a copy of the GNU General Public License
94795
188974bfdea0 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79730
diff changeset
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
18
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
19
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20 /*
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 Simple program to start Emacs with its console window hidden.
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 This program is provided purely for convenience, since most users will
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 use Emacs in windowing (GUI) mode, and will not want to have an extra
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 console window lying around. */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
27 /*
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
28 You may want to define this if you want to be able to install updated
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
29 emacs binaries even when other users are using the current version.
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
30 The problem with some file servers (notably Novell) is that an open
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
31 file cannot be overwritten, deleted, or even renamed. So if someone
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
32 is running emacs.exe already, you cannot install a newer version.
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
33 By defining CHOOSE_NEWEST_EXE, you can name your new emacs.exe
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
34 something else which matches "emacs*.exe", and runemacs will
73541
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
35 automatically select the newest emacs executable in the bin directory.
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
36 (So you'll probably be able to delete the old version some hours/days
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
37 later).
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
38 */
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
39
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
40 /* #define CHOOSE_NEWEST_EXE */
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
41
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 #include <windows.h>
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 #include <string.h>
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 #include <malloc.h>
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 int WINAPI
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 {
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 STARTUPINFO start;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 SECURITY_ATTRIBUTES sec_attrs;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 PROCESS_INFORMATION child;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52 int wait_for_child = FALSE;
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
53 DWORD priority_class = NORMAL_PRIORITY_CLASS;
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54 DWORD ret_code = 0;
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
55 char *new_cmdline;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
56 char *p;
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 char modname[MAX_PATH];
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
58
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 if (!GetModuleFileName (NULL, modname, MAX_PATH))
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60 goto error;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61 if ((p = strrchr (modname, '\\')) == NULL)
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
62 goto error;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 *p = 0;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64
38139
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
65 new_cmdline = alloca (MAX_PATH + strlen (cmdline) + 3);
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
66 /* Quote executable name in case of spaces in the path. */
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
67 *new_cmdline = '"';
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
68 strcpy (new_cmdline + 1, modname);
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
69
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
70 #ifdef CHOOSE_NEWEST_EXE
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
71 {
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
72 /* Silly hack to allow new versions to be installed on
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
73 server even when current version is in use. */
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
74
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
75 char * best_name = alloca (MAX_PATH + 1);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
76 FILETIME best_time = {0,0};
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
77 WIN32_FIND_DATA wfd;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
78 HANDLE fh;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
79 p = new_cmdline + strlen (new_cmdline);
38139
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
80 strcpy (p, "\\emacs*.exe\" ");
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
81 fh = FindFirstFile (new_cmdline, &wfd);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
82 if (fh == INVALID_HANDLE_VALUE)
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
83 goto error;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
84 do
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
85 {
73541
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
86 if (wfd.ftLastWriteTime.dwHighDateTime > best_time.dwHighDateTime
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
87 || (wfd.ftLastWriteTime.dwHighDateTime == best_time.dwHighDateTime
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
88 && wfd.ftLastWriteTime.dwLowDateTime > best_time.dwLowDateTime))
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
89 {
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
90 best_time = wfd.ftLastWriteTime;
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
91 strcpy (best_name, wfd.cFileName);
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
92 }
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
93 }
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
94 while (FindNextFile (fh, &wfd));
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
95 FindClose (fh);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
96 *p++ = '\\';
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
97 strcpy (p, best_name);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
98 strcat (p, " ");
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
99 }
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
100 #else
38139
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
101 strcat (new_cmdline, "\\emacs.exe\" ");
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
102 #endif
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
103
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
104 /* Append original arguments if any; first look for arguments we
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
105 recognise (-wait, -high, and -low), and apply them ourselves. */
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
106 while (cmdline[0] == '-' || cmdline[0] == '/')
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
107 {
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
108 if (strncmp (cmdline+1, "wait", 4) == 0)
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
109 {
73541
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
110 wait_for_child = TRUE;
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
111 cmdline += 5;
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
112 }
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
113 else if (strncmp (cmdline+1, "high", 4) == 0)
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
114 {
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
115 priority_class = HIGH_PRIORITY_CLASS;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
116 cmdline += 5;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
117 }
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
118 else if (strncmp (cmdline+1, "low", 3) == 0)
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
119 {
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
120 priority_class = IDLE_PRIORITY_CLASS;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
121 cmdline += 4;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
122 }
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
123 else
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
124 break;
73541
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
125 /* Look for next argument. */
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
126 while (*++cmdline == ' ');
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
127 }
73541
964e568f1d1d (WinMain): Process all recognized arguments, not just the first one.
Juanma Barranquero <lekktu@gmail.com>
parents: 69378
diff changeset
128
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129 strcat (new_cmdline, cmdline);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
131 /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132 if ((p = strrchr (modname, '\\')) && stricmp (p, "\\bin") == 0)
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
133 {
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
134 *p = 0;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
135 for (p = modname; *p; p++)
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
136 if (*p == '\\') *p = '/';
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
137 SetEnvironmentVariable ("emacs_dir", modname);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
138 }
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140 memset (&start, 0, sizeof (start));
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141 start.cb = sizeof (start);
69378
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
142 start.dwFlags = STARTF_USESHOWWINDOW | STARTF_USECOUNTCHARS;
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143 start.wShowWindow = SW_HIDE;
69378
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
144 /* Ensure that we don't waste memory if the user has specified a huge
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
145 default screen buffer for command windows. */
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
146 start.dwXCountChars = 80;
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
147 start.dwYCountChars = 25;
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 sec_attrs.nLength = sizeof (sec_attrs);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 sec_attrs.lpSecurityDescriptor = NULL;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 sec_attrs.bInheritHandle = FALSE;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
152
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
153 if (CreateProcess (NULL, new_cmdline, &sec_attrs, NULL, TRUE, priority_class,
54773
a4825fc03ab1 (WinMain): Let emacs environment default to parent.
Jason Rumney <jasonr@gnu.org>
parents: 52401
diff changeset
154 NULL, NULL, &start, &child))
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 {
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 if (wait_for_child)
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 {
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 WaitForSingleObject (child.hProcess, INFINITE);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 GetExitCodeProcess (child.hProcess, &ret_code);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 }
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161 CloseHandle (child.hThread);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162 CloseHandle (child.hProcess);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 }
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 else
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 goto error;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 return (int) ret_code;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
168 error:
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 MessageBox (NULL, "Could not start Emacs.", "Error", MB_ICONSTOP);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 return 1;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 38139
diff changeset
172
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 38139
diff changeset
173 /* arch-tag: 7e02df73-4df7-4aa0-baea-99c6d047a384
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 38139
diff changeset
174 (do not change this comment) */