comparison src/emacs.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 84b14dcb0985
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
57 #include <locale.h> 57 #include <locale.h>
58 #endif 58 #endif
59 59
60 #ifdef TOOLTALK 60 #ifdef TOOLTALK
61 #include TT_C_H_PATH 61 #include TT_C_H_PATH
62 #endif
63
64 #ifdef APOLLO
65 #ifndef APOLLO_SR10
66 #include <default_acl.h>
67 #endif
68 #endif 62 #endif
69 63
70 #if defined (WINDOWSNT) 64 #if defined (WINDOWSNT)
71 #include <windows.h> 65 #include <windows.h>
72 #endif 66 #endif
369 if (i == 0) 363 if (i == 0)
370 { 364 {
371 /* Do not trust to what crt0 has stuffed into argv[0] */ 365 /* Do not trust to what crt0 has stuffed into argv[0] */
372 char full_exe_path [MAX_PATH]; 366 char full_exe_path [MAX_PATH];
373 GetModuleFileName (NULL, full_exe_path, MAX_PATH); 367 GetModuleFileName (NULL, full_exe_path, MAX_PATH);
374 result = Fcons (build_ext_string (full_exe_path, FORMAT_FILENAME), 368 result = Fcons (build_ext_string (full_exe_path, Qfile_name),
375 result); 369 result);
376 #if defined(HAVE_SHLIB) 370 #if defined(HAVE_SHLIB)
377 (void)dll_init(full_exe_path); 371 (void)dll_init(full_exe_path);
378 #endif 372 #endif
379 } 373 }
380 else 374 else
381 #endif 375 #endif
382 result = Fcons (build_ext_string (argv [i], FORMAT_FILENAME), result); 376 result = Fcons (build_ext_string (argv [i], Qfile_name),
377 result);
383 } 378 }
384 } 379 }
385 return result; 380 return result;
386 } 381 }
387 382
404 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next)) 399 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next))
405 { 400 {
406 CONST char *temp; 401 CONST char *temp;
407 CHECK_STRING (XCAR (next)); 402 CHECK_STRING (XCAR (next));
408 403
409 GET_C_STRING_EXT_DATA_ALLOCA (XCAR (next), FORMAT_OS, temp); 404 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (next),
405 C_STRING_ALLOCA, temp,
406 Qnative);
410 (*argv) [i] = xstrdup (temp); 407 (*argv) [i] = xstrdup (temp);
411 } 408 }
412 (*argv) [n] = 0; 409 (*argv) [n] = 0;
413 *argc = i; 410 *argc = i;
414 } 411 }
618 brk ((void *) bss_end); 615 brk ((void *) bss_end);
619 #endif 616 #endif
620 617
621 clearerr (stdin); 618 clearerr (stdin);
622 619
623 #ifdef APOLLO
624 #ifndef APOLLO_SR10
625 /* If USE_DOMAIN_ACLS environment variable exists,
626 use ACLs rather than UNIX modes. */
627 if (egetenv ("USE_DOMAIN_ACLS"))
628 default_acl (USE_DEFACL);
629 #endif
630 #endif /* APOLLO */
631
632 #if defined (HAVE_MMAP) && defined (REL_ALLOC) 620 #if defined (HAVE_MMAP) && defined (REL_ALLOC)
633 /* ralloc can only be used if using the GNU memory allocator. */ 621 /* ralloc can only be used if using the GNU memory allocator. */
634 init_ralloc (); 622 init_ralloc ();
635 #elif defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC) 623 #elif defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
636 if (initialized) 624 if (initialized)
908 Order does not matter in these functions. 896 Order does not matter in these functions.
909 */ 897 */
910 898
911 syms_of_abbrev (); 899 syms_of_abbrev ();
912 syms_of_alloc (); 900 syms_of_alloc ();
913 #ifdef HAVE_X_WINDOWS
914 syms_of_balloon_x ();
915 #endif
916 syms_of_buffer (); 901 syms_of_buffer ();
917 syms_of_bytecode (); 902 syms_of_bytecode ();
918 syms_of_callint (); 903 syms_of_callint ();
919 syms_of_callproc (); 904 syms_of_callproc ();
920 syms_of_casefiddle (); 905 syms_of_casefiddle ();
924 syms_of_cmds (); 909 syms_of_cmds ();
925 syms_of_console (); 910 syms_of_console ();
926 syms_of_data (); 911 syms_of_data ();
927 #ifdef DEBUG_XEMACS 912 #ifdef DEBUG_XEMACS
928 syms_of_debug (); 913 syms_of_debug ();
914 syms_of_tests ();
929 #endif /* DEBUG_XEMACS */ 915 #endif /* DEBUG_XEMACS */
930 syms_of_device (); 916 syms_of_device ();
931 #ifdef HAVE_DIALOGS 917 #ifdef HAVE_DIALOGS
932 syms_of_dialog (); 918 syms_of_dialog ();
933 #endif 919 #endif
1016 syms_of_device_tty (); 1002 syms_of_device_tty ();
1017 syms_of_objects_tty (); 1003 syms_of_objects_tty ();
1018 #endif 1004 #endif
1019 1005
1020 #ifdef HAVE_X_WINDOWS 1006 #ifdef HAVE_X_WINDOWS
1007 syms_of_balloon_x ();
1021 syms_of_device_x (); 1008 syms_of_device_x ();
1022 #ifdef HAVE_DIALOGS 1009 #ifdef HAVE_DIALOGS
1023 syms_of_dialog_x (); 1010 syms_of_dialog_x ();
1024 #endif 1011 #endif
1025 syms_of_frame_x (); 1012 syms_of_frame_x ();
1026 syms_of_glyphs_x (); 1013 syms_of_glyphs_x ();
1027 syms_of_objects_x (); 1014 syms_of_objects_x ();
1028 #ifdef HAVE_MENUBARS 1015 #ifdef HAVE_MENUBARS
1029 syms_of_menubar_x (); 1016 syms_of_menubar_x ();
1030 #endif 1017 #endif
1031 syms_of_xselect (); 1018 syms_of_select_x ();
1032 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 1019 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1033 syms_of_gui_x (); 1020 syms_of_gui_x ();
1034 #endif 1021 #endif
1035 #ifdef HAVE_XIM 1022 #ifdef HAVE_XIM
1036 #ifdef XIM_XLIB 1023 #ifdef XIM_XLIB
1044 syms_of_device_mswindows (); 1031 syms_of_device_mswindows ();
1045 syms_of_frame_mswindows (); 1032 syms_of_frame_mswindows ();
1046 syms_of_objects_mswindows (); 1033 syms_of_objects_mswindows ();
1047 syms_of_select_mswindows (); 1034 syms_of_select_mswindows ();
1048 syms_of_glyphs_mswindows (); 1035 syms_of_glyphs_mswindows ();
1036 syms_of_gui_mswindows ();
1049 #ifdef HAVE_MENUBARS 1037 #ifdef HAVE_MENUBARS
1050 syms_of_menubar_mswindows (); 1038 syms_of_menubar_mswindows ();
1051 #endif 1039 #endif
1052 #ifdef HAVE_SCROLLBARS 1040 #ifdef HAVE_SCROLLBARS
1053 syms_of_scrollbar_mswindows (); 1041 syms_of_scrollbar_mswindows ();
1313 /* Do that before any specifier creation (esp. vars_of_glyphs()) */ 1301 /* Do that before any specifier creation (esp. vars_of_glyphs()) */
1314 vars_of_specifier (); 1302 vars_of_specifier ();
1315 1303
1316 vars_of_abbrev (); 1304 vars_of_abbrev ();
1317 vars_of_alloc (); 1305 vars_of_alloc ();
1318 #ifdef HAVE_X_WINDOWS
1319 vars_of_balloon_x ();
1320 #endif
1321 vars_of_buffer (); 1306 vars_of_buffer ();
1322 vars_of_bytecode (); 1307 vars_of_bytecode ();
1323 vars_of_callint (); 1308 vars_of_callint ();
1324 vars_of_callproc (); 1309 vars_of_callproc ();
1325 vars_of_chartab (); 1310 vars_of_chartab ();
1327 vars_of_cmds (); 1312 vars_of_cmds ();
1328 vars_of_console (); 1313 vars_of_console ();
1329 vars_of_data (); 1314 vars_of_data ();
1330 #ifdef DEBUG_XEMACS 1315 #ifdef DEBUG_XEMACS
1331 vars_of_debug (); 1316 vars_of_debug ();
1317 vars_of_tests ();
1332 #endif 1318 #endif
1333 vars_of_console_stream (); 1319 vars_of_console_stream ();
1334 vars_of_device (); 1320 vars_of_device ();
1335 #ifdef HAVE_DIALOGS 1321 #ifdef HAVE_DIALOGS
1336 vars_of_dialog (); 1322 vars_of_dialog ();
1394 vars_of_minibuf (); 1380 vars_of_minibuf ();
1395 #ifdef HAVE_SHLIB 1381 #ifdef HAVE_SHLIB
1396 vars_of_module (); 1382 vars_of_module ();
1397 #endif 1383 #endif
1398 #ifdef WINDOWSNT 1384 #ifdef WINDOWSNT
1385 vars_of_nt ();
1399 vars_of_ntproc (); 1386 vars_of_ntproc ();
1400 #endif 1387 #endif
1401 vars_of_objects (); 1388 vars_of_objects ();
1402 vars_of_print (); 1389 vars_of_print ();
1403 1390
1435 vars_of_frame_tty (); 1422 vars_of_frame_tty ();
1436 vars_of_objects_tty (); 1423 vars_of_objects_tty ();
1437 #endif 1424 #endif
1438 1425
1439 #ifdef HAVE_X_WINDOWS 1426 #ifdef HAVE_X_WINDOWS
1427 vars_of_balloon_x ();
1440 vars_of_device_x (); 1428 vars_of_device_x ();
1441 #ifdef HAVE_DIALOGS 1429 #ifdef HAVE_DIALOGS
1442 vars_of_dialog_x (); 1430 vars_of_dialog_x ();
1443 #endif 1431 #endif
1444 vars_of_frame_x (); 1432 vars_of_frame_x ();
1445 vars_of_glyphs_x (); 1433 vars_of_glyphs_x ();
1446 #ifdef HAVE_MENUBARS 1434 #ifdef HAVE_MENUBARS
1447 vars_of_menubar_x (); 1435 vars_of_menubar_x ();
1448 #endif 1436 #endif
1449 vars_of_objects_x (); 1437 vars_of_objects_x ();
1450 vars_of_xselect (); 1438 vars_of_select_x ();
1451 #ifdef HAVE_SCROLLBARS 1439 #ifdef HAVE_SCROLLBARS
1452 vars_of_scrollbar_x (); 1440 vars_of_scrollbar_x ();
1453 #endif 1441 #endif
1454 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 1442 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1455 vars_of_gui_x (); 1443 vars_of_gui_x ();
1456 #endif 1444 #endif
1457 #endif 1445 #endif /* HAVE_X_WINDOWS */
1458 1446
1459 #ifdef HAVE_MS_WINDOWS 1447 #ifdef HAVE_MS_WINDOWS
1460 vars_of_device_mswindows (); 1448 vars_of_device_mswindows ();
1461 vars_of_console_mswindows (); 1449 vars_of_console_mswindows ();
1462 vars_of_frame_mswindows (); 1450 vars_of_frame_mswindows ();
1557 #ifdef MULE 1545 #ifdef MULE
1558 /* These two depend on hash tables and various variables declared 1546 /* These two depend on hash tables and various variables declared
1559 earlier. The second may also depend on the first. */ 1547 earlier. The second may also depend on the first. */
1560 complex_vars_of_mule_charset (); 1548 complex_vars_of_mule_charset ();
1561 #endif 1549 #endif
1562 #if defined(FILE_CODING) 1550 #ifdef FILE_CODING
1563 complex_vars_of_file_coding (); 1551 complex_vars_of_file_coding ();
1564 #endif 1552 #endif
1565 1553
1566 /* This calls allocate_glyph(), which creates specifiers 1554 /* This calls allocate_glyph(), which creates specifiers
1567 and also relies on a variable (Vthe_nothing_vector) initialized 1555 and also relies on a variable (Vthe_nothing_vector) initialized
1642 } 1630 }
1643 #endif 1631 #endif
1644 #ifdef PDUMP 1632 #ifdef PDUMP
1645 } else if (!restart) { 1633 } else if (!restart) {
1646 reinit_alloc_once_early (); 1634 reinit_alloc_once_early ();
1635 reinit_symbols_once_early ();
1647 reinit_opaque_once_early (); 1636 reinit_opaque_once_early ();
1648 1637
1649 reinit_console_type_create_stream (); 1638 reinit_console_type_create_stream ();
1650 #ifdef HAVE_TTY 1639 #ifdef HAVE_TTY
1651 reinit_console_type_create_tty (); 1640 reinit_console_type_create_tty ();
1718 #endif 1707 #endif
1719 reinit_vars_of_objects (); 1708 reinit_vars_of_objects ();
1720 reinit_vars_of_print (); 1709 reinit_vars_of_print ();
1721 reinit_vars_of_redisplay (); 1710 reinit_vars_of_redisplay ();
1722 reinit_vars_of_search (); 1711 reinit_vars_of_search ();
1723 reinit_vars_of_scrollbar_x ();
1724 reinit_vars_of_undo (); 1712 reinit_vars_of_undo ();
1725 reinit_vars_of_window (); 1713 reinit_vars_of_window ();
1726 1714
1727 #ifdef HAVE_MS_WINDOWS 1715 #ifdef HAVE_MS_WINDOWS
1728 reinit_vars_of_frame_mswindows (); 1716 reinit_vars_of_frame_mswindows ();
1729 #endif 1717 #endif
1730 1718
1731 #ifdef HAVE_X_WINDOWS 1719 #ifdef HAVE_X_WINDOWS
1732 reinit_vars_of_device_x (); 1720 reinit_vars_of_device_x ();
1733 #endif
1734 #ifdef HAVE_SCROLLBARS 1721 #ifdef HAVE_SCROLLBARS
1735 reinit_vars_of_scrollbar_x (); 1722 reinit_vars_of_scrollbar_x ();
1723 #endif
1736 #ifdef HAVE_MENUBARS 1724 #ifdef HAVE_MENUBARS
1737 reinit_vars_of_menubar_x (); 1725 reinit_vars_of_menubar_x ();
1738 #endif 1726 #endif
1739 reinit_vars_of_xselect (); 1727 reinit_vars_of_select_x ();
1740 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 1728 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1741 reinit_vars_of_gui_x (); 1729 reinit_vars_of_gui_x ();
1742 #endif 1730 #endif
1743 #endif 1731 #endif /* HAVE_X_WINDOWS */
1744 1732
1745 #if defined(MULE) && defined(HAVE_WNN) 1733 #if defined(MULE) && defined(HAVE_WNN)
1746 reinit_vars_of_mule_wnn (); 1734 reinit_vars_of_mule_wnn ();
1747 #endif 1735 #endif
1748 1736
1749 reinit_complex_vars_of_buffer (); 1737 reinit_complex_vars_of_buffer ();
1750 reinit_complex_vars_of_console (); 1738 reinit_complex_vars_of_console ();
1751 reinit_complex_vars_of_minibuf (); 1739 reinit_complex_vars_of_minibuf ();
1752 #endif 1740 #endif /* PDUMP */
1753 } 1741 }
1754 1742
1755 1743
1756 /* CONGRATULATIONS!!! We have successfully initialized the Lisp 1744 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
1757 engine. */ 1745 engine. */
2168 error ("I've lost my temacs-hood."); 2156 error ("I've lost my temacs-hood.");
2169 2157
2170 /* Need to convert the orig_invoc_name and all of the arguments 2158 /* Need to convert the orig_invoc_name and all of the arguments
2171 to external format. */ 2159 to external format. */
2172 2160
2173 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum, 2161 TO_EXTERNAL_FORMAT (LISP_STRING, orig_invoc_name,
2174 namesize); 2162 ALLOCA, (wampum, namesize),
2163 Qnative);
2175 namesize++; 2164 namesize++;
2176 2165
2177 for (ac = 0, total_len = namesize; ac < nargs; ac++) 2166 for (ac = 0, total_len = namesize; ac < nargs; ac++)
2178 { 2167 {
2179 CHECK_STRING (args[ac]); 2168 CHECK_STRING (args[ac]);
2180 GET_STRING_EXT_DATA_ALLOCA (args[ac], FORMAT_OS, 2169 TO_EXTERNAL_FORMAT (LISP_STRING, args[ac],
2181 wampum_all[ac], 2170 ALLOCA, (wampum_all[ac], wampum_all_len[ac]),
2182 wampum_all_len[ac]); 2171 Qnative);
2183 wampum_all_len[ac]++; 2172 wampum_all_len[ac]++;
2184 total_len += wampum_all_len[ac]; 2173 total_len += wampum_all_len[ac];
2185 } 2174 }
2186 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char); 2175 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char);
2187 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+2, char *); 2176 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+2, char *);
2538 2527
2539 } 2528 }
2540 2529
2541 2530
2542 #ifndef CANNOT_DUMP 2531 #ifndef CANNOT_DUMP
2543 /* Nothing like this can be implemented on an Apollo. 2532
2544 What a loss! */ 2533 #if !defined(PDUMP) || !defined(SYSTEM_MALLOC)
2545
2546 extern char my_edata[]; 2534 extern char my_edata[];
2535 #endif
2547 2536
2548 #ifdef HAVE_SHM 2537 #ifdef HAVE_SHM
2549 2538
2550 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /* 2539 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /*
2551 Dump current state of XEmacs into data file FILENAME. 2540 Dump current state of XEmacs into data file FILENAME.
2658 #else /* not MSDOS and EMX */ 2647 #else /* not MSDOS and EMX */
2659 { 2648 {
2660 char *intoname_ext; 2649 char *intoname_ext;
2661 char *symname_ext; 2650 char *symname_ext;
2662 2651
2663 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext); 2652 TO_EXTERNAL_FORMAT (LISP_STRING, intoname,
2653 C_STRING_ALLOCA, intoname_ext,
2654 Qfile_name);
2655
2664 if (STRINGP (symname)) 2656 if (STRINGP (symname))
2665 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext); 2657 TO_EXTERNAL_FORMAT (LISP_STRING, symname,
2658 C_STRING_ALLOCA, symname_ext,
2659 Qfile_name);
2666 else 2660 else
2667 symname_ext = 0; 2661 symname_ext = 0;
2668 2662
2669 garbage_collect_1 (); 2663 garbage_collect_1 ();
2670 2664
2731 } 2725 }
2732 return Fnreverse (result); 2726 return Fnreverse (result);
2733 } 2727 }
2734 2728
2735 /* The same as the above, except PATH is an external C string (it is 2729 /* The same as the above, except PATH is an external C string (it is
2736 converted as FORMAT_FILENAME), and sepchar is hardcoded to SEPCHAR 2730 converted using Qfile_name), and sepchar is hardcoded to SEPCHAR
2737 (':' or whatever). */ 2731 (':' or whatever). */
2738 Lisp_Object 2732 Lisp_Object
2739 decode_path (CONST char *path) 2733 decode_path (CONST char *path)
2740 { 2734 {
2741 int len; 2735 Bytecount newlen;
2742 Bufbyte *newpath; 2736 Bufbyte *newpath;
2743 if (!path) 2737 if (!path)
2744 return Qnil; 2738 return Qnil;
2745 2739
2746 GET_C_CHARPTR_INT_FILENAME_DATA_ALLOCA (path, newpath); 2740 TO_INTERNAL_FORMAT (C_STRING, path, ALLOCA, (newpath, newlen), Qfile_name);
2747 2741
2748 len = strlen ((const char *) newpath);
2749 /* #### Does this make sense? It certainly does for 2742 /* #### Does this make sense? It certainly does for
2750 decode_env_path(), but it looks dubious here. Does any code 2743 decode_env_path(), but it looks dubious here. Does any code
2751 depend on decode_path("") returning nil instead of an empty 2744 depend on decode_path("") returning nil instead of an empty
2752 string? */ 2745 string? */
2753 if (!len) 2746 if (!newlen)
2754 return Qnil; 2747 return Qnil;
2755 2748
2756 return split_string_by_emchar_1 (newpath, (Bytecount)len, SEPCHAR); 2749 return split_string_by_emchar_1 (newpath, newlen, SEPCHAR);
2757 } 2750 }
2758 2751
2759 Lisp_Object 2752 Lisp_Object
2760 decode_env_path (CONST char *evarname, CONST char *default_) 2753 decode_env_path (CONST char *evarname, CONST char *default_)
2761 { 2754 {