comparison src/emacs.c @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 25f70ba0133c
children 5a88923fcbfe
comparison
equal deleted inserted replaced
162:4de2936b4e77 163:0132846995bd
81 /* Variable whose value is symbol giving operating system type. */ 81 /* Variable whose value is symbol giving operating system type. */
82 Lisp_Object Vsystem_type; 82 Lisp_Object Vsystem_type;
83 83
84 /* Variable whose value is string giving configuration built for. */ 84 /* Variable whose value is string giving configuration built for. */
85 Lisp_Object Vsystem_configuration; 85 Lisp_Object Vsystem_configuration;
86 86
87 /* The name under which XEmacs was invoked, with any leading directory 87 /* The name under which XEmacs was invoked, with any leading directory
88 names discarded. */ 88 names discarded. */
89 Lisp_Object Vinvocation_name; 89 Lisp_Object Vinvocation_name;
90 90
91 /* The directory name from which XEmacs was invoked. */ 91 /* The directory name from which XEmacs was invoked. */
139 /* Value of Lisp variable `noninteractive'. 139 /* Value of Lisp variable `noninteractive'.
140 Normally same as C variable `noninteractive' 140 Normally same as C variable `noninteractive'
141 but nothing terrible happens if user sets this one. */ 141 but nothing terrible happens if user sets this one. */
142 142
143 int noninteractive1; 143 int noninteractive1;
144
145 /* Major & Minor version numbers are needed in temacs as of 20.3 */
146 /* Version numbers and strings */
147 int emacs_beta_version;
148 int emacs_major_version;
149 int emacs_minor_version;
150 Lisp_Object Vxemacs_codename;
144 151
145 /* Save argv and argc. */ 152 /* Save argv and argc. */
146 char **initial_argv; 153 char **initial_argv;
147 int initial_argc; 154 int initial_argc;
148 155
311 318
312 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next)) 319 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next))
313 { 320 {
314 CONST char *temp; 321 CONST char *temp;
315 CHECK_STRING (XCAR (next)); 322 CHECK_STRING (XCAR (next));
316 323
317 GET_C_STRING_EXT_DATA_ALLOCA (XCAR (next), FORMAT_OS, temp); 324 GET_C_STRING_EXT_DATA_ALLOCA (XCAR (next), FORMAT_OS, temp);
318 (*argv) [i] = xstrdup (temp); 325 (*argv) [i] = xstrdup (temp);
319 } 326 }
320 (*argv) [n] = 0; 327 (*argv) [n] = 0;
321 *argc = i; 328 *argc = i;
438 { 445 {
439 return 0; 446 return 0;
440 } 447 }
441 } 448 }
442 449
450 /* Make stack traces always identify version + configuration */
451 /* C makes this bizarre circumlocution necessary. */
452 #define PASTE_1(x,y) PASTE_2(x,y)
453 #define PASTE_2(x,y) x##y
454 #define main_1 PASTE_1(main_, CANONICAL_VERSION)
455
443 static DOESNT_RETURN 456 static DOESNT_RETURN
444 main_1 (int argc, char **argv, char **envp) 457 main_1 (int argc, char **argv, char **envp)
445 { 458 {
446 char stack_bottom_variable; 459 char stack_bottom_variable;
447 int skip_args = 0; 460 int skip_args = 0;
450 #ifdef NeXT 463 #ifdef NeXT
451 extern int malloc_cookie; 464 extern int malloc_cookie;
452 #endif 465 #endif
453 466
454 #ifndef SYSTEM_MALLOC 467 #ifndef SYSTEM_MALLOC
455 /* Make sure that any libraries we link against haven't installed a 468 /* Make sure that any libraries we link against haven't installed a
456 hook for a gmalloc of a potentially incompatible version. */ 469 hook for a gmalloc of a potentially incompatible version. */
457 __malloc_hook = NULL; 470 __malloc_hook = NULL;
458 __realloc_hook = NULL; 471 __realloc_hook = NULL;
459 __free_hook = NULL; 472 __free_hook = NULL;
460 #endif /* not SYSTEM_MALLOC */ 473 #endif /* not SYSTEM_MALLOC */
597 if (open (term, O_RDWR, 2) < 0) 610 if (open (term, O_RDWR, 2) < 0)
598 fatal ("%s: %s", term, strerror (errno)); 611 fatal ("%s: %s", term, strerror (errno));
599 dup (0); 612 dup (0);
600 if (! isatty (0)) 613 if (! isatty (0))
601 fatal ("%s: not a tty", term); 614 fatal ("%s: not a tty", term);
602 615
603 #if 0 616 #if 0
604 stderr_out ("Using %s", ttyname (0)); 617 stderr_out ("Using %s", ttyname (0));
605 #endif 618 #endif
606 stderr_out ("Using %s", term); 619 stderr_out ("Using %s", term);
607 inhibit_window_system = 1; /* -t => -nw */ 620 inhibit_window_system = 1; /* -t => -nw */
624 noninteractive = 1, skip_args--; 637 noninteractive = 1, skip_args--;
625 638
626 if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args) || 639 if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args) ||
627 argmatch (argv, argc, "-V", 0, 2, NULL, &skip_args)) 640 argmatch (argv, argc, "-V", 0, 2, NULL, &skip_args))
628 noninteractive = 1, skip_args--; 641 noninteractive = 1, skip_args--;
629 642
630 /* Now, figure out which type of console is our first console. */ 643 /* Now, figure out which type of console is our first console. */
631 644
632 display_arg = 0; 645 display_arg = 0;
633 646
634 if (noninteractive) 647 if (noninteractive)
649 if (!inhibit_window_system && !noninteractive) 662 if (!inhibit_window_system && !noninteractive)
650 { 663 {
651 #ifdef HAVE_X_WINDOWS 664 #ifdef HAVE_X_WINDOWS
652 char *dpy = 0; 665 char *dpy = 0;
653 int count_before = skip_args; 666 int count_before = skip_args;
654 667
655 if (argmatch (argv, argc, "-d", "--display", 3, &dpy, &skip_args) || 668 if (argmatch (argv, argc, "-d", "--display", 3, &dpy, &skip_args) ||
656 argmatch (argv, argc, "-display", 0, 3, &dpy, &skip_args)) 669 argmatch (argv, argc, "-display", 0, 3, &dpy, &skip_args))
657 { 670 {
658 display_arg = 1; 671 display_arg = 1;
659 display_use = "x"; 672 display_use = "x";
686 /* If there is a non-empty environment var DISPLAY, set 699 /* If there is a non-empty environment var DISPLAY, set
687 `display_use', but not `display_arg', which is only to be set 700 `display_use', but not `display_arg', which is only to be set
688 if the display was specified on the command line. */ 701 if the display was specified on the command line. */
689 if ((dpy = getenv ("DISPLAY")) && dpy[0]) 702 if ((dpy = getenv ("DISPLAY")) && dpy[0])
690 display_use = "x"; 703 display_use = "x";
691 704
692 #endif /* HAVE_X_WINDOWS */ 705 #endif /* HAVE_X_WINDOWS */
693 } 706 }
694 #endif /* HAVE_WINDOW_SYSTEM */ 707 #endif /* HAVE_WINDOW_SYSTEM */
695 708
696 noninteractive1 = noninteractive; 709 noninteractive1 = noninteractive;
886 #ifdef SYMS_MACHINE 899 #ifdef SYMS_MACHINE
887 SYMS_MACHINE; 900 SYMS_MACHINE;
888 #endif 901 #endif
889 902
890 #ifdef EMACS_BTL 903 #ifdef EMACS_BTL
891 syms_of_btl (); 904 syms_of_btl ();
892 #endif 905 #endif
893 906
894 #ifdef ENERGIZE 907 #ifdef ENERGIZE
895 syms_of_energize (); 908 syms_of_energize ();
896 #endif 909 #endif
1244 1257
1245 /* Calls Fmake_hashtable(). */ 1258 /* Calls Fmake_hashtable(). */
1246 complex_vars_of_event_stream (); 1259 complex_vars_of_event_stream ();
1247 /* Calls make_lisp_hashtable(). */ 1260 /* Calls make_lisp_hashtable(). */
1248 complex_vars_of_extents (); 1261 complex_vars_of_extents ();
1249 1262
1250 /* Depends on hashtables and specifiers. */ 1263 /* Depends on hashtables and specifiers. */
1251 complex_vars_of_faces (); 1264 complex_vars_of_faces ();
1252 1265
1253 #ifdef MULE 1266 #ifdef MULE
1254 /* These two depend on hashtables and various variables declared 1267 /* These two depend on hashtables and various variables declared
1521 { "-r", "--reverse-video", 5, 0 }, 1534 { "-r", "--reverse-video", 5, 0 },
1522 { "-rv", 0, 5, 0 }, 1535 { "-rv", 0, 5, 0 },
1523 { "-reverse", 0, 5, 0 }, 1536 { "-reverse", 0, 5, 0 },
1524 { "-hb", "--horizontal-scroll-bars", 5, 0 }, 1537 { "-hb", "--horizontal-scroll-bars", 5, 0 },
1525 { "-vb", "--vertical-scroll-bars", 5, 0 }, 1538 { "-vb", "--vertical-scroll-bars", 5, 0 },
1526 1539
1527 /* These have the same priority as ordinary file name args, 1540 /* These have the same priority as ordinary file name args,
1528 so they are not reordered with respect to those. */ 1541 so they are not reordered with respect to those. */
1529 { "-L", "--directory", 0, 1 }, 1542 { "-L", "--directory", 0, 1 },
1530 { "-directory", 0, 0, 1 }, 1543 { "-directory", 0, 0, 1 },
1531 { "-l", "--load", 0, 1 }, 1544 { "-l", "--load", 0, 1 },
1644 } 1657 }
1645 /* Skip option arguments--they are tied to the options. */ 1658 /* Skip option arguments--they are tied to the options. */
1646 if (options[from] > 0) 1659 if (options[from] > 0)
1647 from += options[from]; 1660 from += options[from];
1648 } 1661 }
1649 1662
1650 if (best < 0) 1663 if (best < 0)
1651 abort (); 1664 abort ();
1652 1665
1653 /* Copy the highest priority remaining option, with its args, to NEW. */ 1666 /* Copy the highest priority remaining option, with its args, to NEW. */
1654 new[to++] = argv[best]; 1667 new[to++] = argv[best];
1711 if (run_temacs_argc < 0) 1724 if (run_temacs_argc < 0)
1712 error ("I've lost my temacs-hood."); 1725 error ("I've lost my temacs-hood.");
1713 1726
1714 /* Need to convert the orig_invoc_name and all of the arguments 1727 /* Need to convert the orig_invoc_name and all of the arguments
1715 to external format. */ 1728 to external format. */
1716 1729
1717 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum, 1730 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum,
1718 namesize); 1731 namesize);
1719 namesize++; 1732 namesize++;
1720 1733
1721 for (ac = 0, total_len = namesize; ac < nargs; ac++) 1734 for (ac = 0, total_len = namesize; ac < nargs; ac++)
1749 LONGJMP (run_temacs_catch, 1); 1762 LONGJMP (run_temacs_catch, 1);
1750 return Qnil; /* not reached; warning suppression */ 1763 return Qnil; /* not reached; warning suppression */
1751 } 1764 }
1752 1765
1753 /* ARGSUSED */ 1766 /* ARGSUSED */
1754 DOESNT_RETURN 1767 int
1755 main (int argc, char **argv, char **envp) 1768 main (int argc, char **argv, char **envp)
1756 { 1769 {
1757 int volatile vol_argc = argc; 1770 int volatile vol_argc = argc;
1758 char ** volatile vol_argv = argv; 1771 char ** volatile vol_argv = argv;
1759 char ** volatile vol_envp = envp; 1772 char ** volatile vol_envp = envp;
1781 several people using this stuff. We've compared versions on 1794 several people using this stuff. We've compared versions on
1782 everything we can think of. We can find no difference. 1795 everything we can think of. We can find no difference.
1783 However, on both my systems environ is a plain old global 1796 However, on both my systems environ is a plain old global
1784 variable initialized to zero. _environ is the one that 1797 variable initialized to zero. _environ is the one that
1785 contains pointers to the actual environment. 1798 contains pointers to the actual environment.
1786 1799
1787 Since we can't figure out the difference (and we're hours 1800 Since we can't figure out the difference (and we're hours
1788 away from a release), this takes a very cowardly approach and 1801 away from a release), this takes a very cowardly approach and
1789 is bracketed with both a system specific preprocessor test 1802 is bracketed with both a system specific preprocessor test
1790 and a runtime "do you have this problem" test 1803 and a runtime "do you have this problem" test
1791 1804
1792 06/20/96 robertl@dgii.com */ 1805 06/20/96 robertl@dgii.com */
1793 { 1806 {
1794 extern char *_environ; 1807 extern char *_environ;
1795 if ((unsigned) environ == 0) 1808 if ((unsigned) environ == 0)
1796 environ=_environ; 1809 environ=_environ;
1799 vol_envp = environ; 1812 vol_envp = environ;
1800 } 1813 }
1801 run_temacs_argc = -1; 1814 run_temacs_argc = -1;
1802 1815
1803 main_1 (vol_argc, vol_argv, vol_envp); 1816 main_1 (vol_argc, vol_argv, vol_envp);
1817 return 0; /* unreached */
1804 } 1818 }
1805 1819
1806 1820
1807 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /* 1821 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /*
1808 Exit the XEmacs job and kill it. Ask for confirmation, without argument. 1822 Exit the XEmacs job and kill it. Ask for confirmation, without argument.
2283 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /* 2297 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /*
2284 Value is string indicating configuration XEmacs was built for. 2298 Value is string indicating configuration XEmacs was built for.
2285 */ ); 2299 */ );
2286 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION)); 2300 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION));
2287 2301
2302 DEFVAR_INT ("emacs-beta-version", &emacs_beta_version /*
2303 Beta number of this version of Emacs, as an integer.
2304 The value is nil if this is an officially released version of XEmacs.
2305 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
2306 earlier than 20.3.
2307 */ );
2308 #ifndef EMACS_BETA_VERSION
2309 #define EMACS_BETA_VERSION Qnil
2310 #endif
2311 emacs_beta_version = EMACS_BETA_VERSION;
2312
2313 DEFVAR_LISP ("xemacs-codename", &Vxemacs_codename /*
2314 Codename of this version of Emacs (a string).
2315 */ );
2316 #ifndef XEMACS_CODENAME
2317 #define XEMACS_CODENAME Qnil
2318 #endif
2319 Vxemacs_codename = Fpurecopy (build_string (XEMACS_CODENAME));
2320
2288 DEFVAR_BOOL ("noninteractive", &noninteractive1 /* 2321 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
2289 Non-nil means XEmacs is running without interactive terminal. 2322 Non-nil means XEmacs is running without interactive terminal.
2290 */ ); 2323 */ );
2291 2324
2292 DEFVAR_INT ("emacs-priority", &emacs_priority /* 2325 DEFVAR_INT ("emacs-priority", &emacs_priority /*
2296 it to change priority. (XEmacs sets its uid back to the real uid.) 2329 it to change priority. (XEmacs sets its uid back to the real uid.)
2297 Currently, you need to define SET_EMACS_PRIORITY in `config.h' 2330 Currently, you need to define SET_EMACS_PRIORITY in `config.h'
2298 before you compile XEmacs, to enable the code for this feature. 2331 before you compile XEmacs, to enable the code for this feature.
2299 */ ); 2332 */ );
2300 emacs_priority = 0; 2333 emacs_priority = 0;
2301 } 2334
2335 DEFVAR_INT ("emacs-major-version", &emacs_major_version /*
2336 Major version number of this version of Emacs, as an integer.
2337 Warning, this variable did not exist in Emacs versions earlier than:
2338 FSF Emacs: 19.23
2339 XEmacs: 19.10
2340 This variable was not available to temacs prior to:
2341 XEmacs: 20.3
2342 */ );
2343 emacs_major_version = EMACS_MAJOR_VERSION;
2344
2345 DEFVAR_INT ("emacs-minor-version", &emacs_minor_version /*
2346 Minor version number of this version of Emacs, as an integer.
2347 Warning, this variable did not exist in Emacs versions earlier than:
2348 FSF Emacs: 19.23
2349 XEmacs: 19.10
2350 This variable was not available to temacs prior to:
2351 XEMacs: 20.3
2352 */ );
2353 emacs_minor_version = EMACS_MINOR_VERSION;
2354 }