1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00
emacs/src/s/ms-w32.h

407 lines
11 KiB
C
Raw Normal View History

1994-11-01 10:27:02 +00:00
/* System description file for Windows NT.
Copyright (C) 1993-1995, 2001-2011 Free Software Foundation, Inc.
1994-11-01 10:27:02 +00:00
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
1994-11-01 10:27:02 +00:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
1994-11-01 10:27:02 +00:00
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1994-11-01 10:27:02 +00:00
2010-05-12 06:53:03 +00:00
/* Define symbols to identify the version of Unix this is.
Define all the symbols that apply correctly. */
1994-11-01 10:27:02 +00:00
#ifndef WINDOWSNT
#define WINDOWSNT
#endif
#ifndef DOS_NT
#define DOS_NT /* MSDOS or WINDOWSNT */
#endif
/* If you are compiling with a non-C calling convention but need to
2010-05-12 06:53:03 +00:00
declare vararg routines differently, put it here. */
#define _VARARGS_ __cdecl
/* If you are providing a function to something that will call the
function back (like a signal handler and signal, or main) its calling
2010-05-12 06:53:03 +00:00
convention must be whatever standard the libraries expect. */
#define _CALLBACK_ __cdecl
1994-11-01 10:27:02 +00:00
/* SYSTEM_TYPE should indicate the kind of system you are using.
2010-05-12 06:53:03 +00:00
It sets the Lisp variable system-type. */
1994-11-01 10:27:02 +00:00
#define SYSTEM_TYPE "windows-nt"
#define NO_MATHERR 1
1994-11-01 10:27:02 +00:00
/* Letter to use in finding device name of first pty,
2010-05-12 06:53:03 +00:00
if system supports pty's. 'a' means it is /dev/ptya0 */
1994-11-01 10:27:02 +00:00
#define FIRST_PTY_LETTER 'a'
2010-05-12 06:53:03 +00:00
/* Define HAVE_TIMEVAL if the system supports the BSD style clock values.
Look in <sys/time.h> for a timeval structure. */
#define HAVE_TIMEVAL 1
1994-11-01 10:27:02 +00:00
2010-05-12 06:53:03 +00:00
/* NT supports Winsock which is close enough (with some hacks). */
#define HAVE_SOCKETS 1
/* But our select implementation doesn't allow us to make non-blocking
connects. So until that is fixed, this is necessary: */
#define BROKEN_NON_BLOCKING_CONNECT 1
2006-12-25 13:30:18 +00:00
/* And the select implementation does 1-byte read-ahead waiting
for received packets, so datagrams are broken too. */
#define BROKEN_DATAGRAM_SOCKETS 1
#define MAIL_USE_POP 1
#define MAIL_USE_SYSTEM_LOCK 1
1994-11-01 10:27:02 +00:00
/* If the character used to separate elements of the executable path
is not ':', #define this to be the appropriate character constant. */
#define SEPCHAR ';'
2000-09-03 17:40:40 +00:00
#define ORDINARY_LINK 1
1994-11-01 10:27:02 +00:00
/* ============================================================ */
2010-05-12 06:53:03 +00:00
/* Here, add any special hacks needed to make Emacs work on this
system. For example, you might define certain system call names
that don't exist on your system, or that do different things on
your system and must be used only through an encapsulation (which
you should place, by convention, in sysdep.c). */
1994-11-01 10:27:02 +00:00
2010-05-12 06:53:03 +00:00
/* Define this to be the separator between devices and paths. */
1994-11-01 10:27:02 +00:00
#define DEVICE_SEP ':'
/* We'll support either convention on NT. */
#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
#include <sys/types.h>
Support MSVC build with newer versions of Visual Studio. Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
2011-11-05 11:34:56 +00:00
#ifdef _MSC_VER
typedef unsigned long sigset_t;
typedef int ssize_t;
#endif
struct sigaction {
int sa_flags;
void (*sa_handler)(int);
sigset_t sa_mask;
};
#define SIG_BLOCK 1
#define SIG_SETMASK 2
#define SIG_UNBLOCK 3
2010-05-12 06:53:03 +00:00
/* The null device on Windows NT. */
1994-11-01 10:27:02 +00:00
#define NULL_DEVICE "NUL:"
#ifndef MAXPATHLEN
#define MAXPATHLEN _MAX_PATH
#endif
#define HAVE_SOUND 1
#define LISP_FLOAT_TYPE 1
#define HAVE_SYS_TIMEB_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_UNISTD_H 1
#undef HAVE_UTIME_H
#undef HAVE_LINUX_VERSION_H
#undef HAVE_SYS_SYSTEMINFO_H
2005-04-22 22:31:15 +00:00
#define HAVE_PWD_H 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_GETHOSTNAME 1
#undef HAVE_GETDOMAINNAME
#define HAVE_DUP2 1
#define HAVE_RENAME 1
#define HAVE_CLOSEDIR 1
#define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
#undef TM_IN_SYS_TIME
#undef HAVE_TM_ZONE
#define HAVE_LONG_FILE_NAMES 1
#define HAVE_MKDIR 1
#define HAVE_RMDIR 1
#define HAVE_RANDOM 1
#undef HAVE_SYSINFO
#undef HAVE_LRAND48
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp * alloc.c (overrun_check_malloc, overrun_check_realloc) (overrun_check_free, xstrdup, allocate_string) (allocate_string_data, compact_small_strings, Fmake_string) (make_unibyte_string, make_multibyte_string) (make_string_from_bytes, make_specified_string, make_float) (Fcons, allocate_terminal, allocate_frame, make_pure_string) (Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp. * atimer.c (start_atimer, set_alarm): Likewise. * buffer.c (clone_per_buffer_values, report_overlay_modification) (mmap_realloc, init_buffer_once): Likewise. * callint.c (Fcall_interactively): Likewise. * callproc.c (Fcall_process, Fcall_process_region, child_setup) (getenv_internal_1): Likewise. * casefiddle.c (casify_object): Likewise. * ccl.c (ccl_driver): Likewise. * character.c (str_as_multibyte, str_to_multibyte): Likewise. * charset.c (load_charset_map_from_file) (load_charset_map_from_file, load_charset_map_from_vector) (Fdefine_charset_internal): Likewise. * cm.c (Wcm_clear): Likewise. * coding.c (decode_eol, decode_coding_object) (Fset_coding_system_priority, make_subsidiaries): Likewise. * data.c (Faset): Likewise. * dired.c (directory_files_internal, file_name_completion_stat): Likewise. * dispnew.c (new_glyph_matrix, adjust_glyph_matrix) (clear_glyph_row, copy_row_except_pointers) (copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool) (save_current_matrix, restore_current_matrix) (build_frame_matrix_from_leaf_window, mirrored_line_dance) (mirror_line_dance, scrolling_window): Likewise. * doc.c (Fsnarf_documentation, Fsubstitute_command_keys): Likewise. * doprnt.c (doprnt): Likewise. * editfns.c (Fuser_full_name, make_buffer_string_both) (Fmessage_box, Fformat, Ftranspose_regions): Likewise. * emacs.c (sort_args): Likewise. * eval.c (Fapply, Ffuncall): Likewise. * fileio.c (Ffile_name_directory, make_temp_name) (Fexpand_file_name, search_embedded_absfilename) (Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents) (auto_save_error): Likewise. * fns.c (Fstring_equal, Fcopy_sequence, concat) (string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte) (internal_equal, Fclear_string, larger_vector, copy_hash_table) (Fmake_hash_table): Likewise. * fringe.c (Fdefine_fringe_bitmap): Likewise. * ftfont.c (ftfont_text_extents): Likewise. * getloadavg.c (getloadavg): Likewise. * image.c (define_image_type, make_image, make_image_cache) (x_create_x_image_and_pixmap, xbm_image_p) (w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color) (xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load) (init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, png_read_from_memory, png_load, jpeg_image_p) (tiff_image_p, tiff_read_from_memory, gif_image_p) (gif_read_from_memory, gif_load, svg_image_p, gs_image_p): Likewise. * indent.c (scan_for_column, compute_motion): Likewise. * insdel.c (gap_left, gap_right, make_gap_smaller, copy_text) (insert_1_both, insert_from_gap, replace_range_2): Likewise. * intervals.c (reproduce_tree, reproduce_tree_obj): Likewise. * keyboard.c (echo_char, save_getcjmp, restore_getcjmp) (kbd_buffer_store_event_hold, apply_modifiers_uncached) (store_user_signal_events, menu_bar_items, tool_bar_items) (process_tool_bar_item, append_tool_bar_item) (read_char_minibuf_menu_prompt, read_key_sequence) (Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys): Likewise. * keymap.c (current_minor_maps, Fdescribe_buffer_bindings): Likewise. * lisp.h (STRING_COPYIN): Likewise. * lread.c (Fload, read1, oblookup): Likewise. * msdos.c (Frecent_doskeys): Likewise. * nsfns.m (Fx_create_frame): Likewise. * nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics): Likewise. * nsimage.m (EmacsImage-initFromSkipXBM:width:height:) (EmacsImage-initForXPMWithDepth:width:height:flip:length:): Likewise. * nsmenu.m (ns_update_menubar): Likewise. * nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise. * print.c (print_unwind, printchar, strout, print_string) (print_error_message): Likewise. * process.c (conv_lisp_to_sockaddr, set_socket_option) (Fmake_network_process, Fnetwork_interface_list) (Fnetwork_interface_info, read_process_output, Fprocess_send_eof) (init_process): Likewise. * ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise. * regex.c (init_syntax_once, regex_compile, re_compile_fastmap): Likewise. * scroll.c (do_scrolling, do_direct_scrolling) (scrolling_max_lines_saved): Likewise. * search.c (search_buffer, wordify, Freplace_match): Likewise. * sound.c (wav_init, au_init, Fplay_sound_internal): Likewise. * syntax.c (skip_chars, skip_syntaxes): Likewise. * sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty) (emacs_set_tty): Likewise. * term.c (encode_terminal_code, calculate_costs) (produce_special_glyphs, create_tty_output, init_tty, delete_tty): Likewise. * termcap.c (tgetst1, gobble_line): Likewise. * termhooks.h (EVENT_INIT): Likewise. * tparam.c (tparam1): Likewise. * unexalpha.c (unexec): Likewise. * unexec.c (write_segment): Likewise. * unexmacosx.c (unexec_write_zero): Likewise. * w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame) (Fx_file_dialog, Fsystem_move_file_to_trash): Likewise. * w32font.c (w32font_list_family, w32font_text_extents) (w32font_list_internal, w32font_match_internal) (w32font_open_internal, compute_metrics, Fx_select_font): Likewise. * w32menu.c (set_frame_menubar, add_menu_item) (w32_menu_display_help, w32_free_submenu_strings): Likewise. * w32term.c (XCreateGC, w32_initialize_display_info): Likewise. * w32uniscribe.c (uniscribe_list_family): Likewise. * w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise. * window.c (make_window, replace_window, set_window_buffer) (Fsplit_window): Likewise. * xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string) (add_to_log, message3, x_consider_frame_title) (append_space_for_newline, extend_face_to_end_of_line) (decode_mode_spec_coding, init_glyph_string): Likewise. * xfaces.c (x_create_gc, get_lface_attributes_no_remap) (Finternal_copy_lisp_face, Finternal_merge_in_global_face) (face_attr_equal_p, make_realized_face, make_face_cache) (free_realized_faces, lookup_named_face, smaller_face) (face_with_height, lookup_derived_face) (x_supports_face_attributes_p, Finternal_set_font_selection_order) (Finternal_set_font_selection_order, realize_default_face) (compute_char_face, face_at_buffer_position) (face_for_overlay_string, face_at_string_position, merge_faces): Likewise. * xfns.c (xic_create_fontsetname, Fx_create_frame) (Fx_window_property, x_create_tip_frame) (Fx_backspace_delete_keys_p): Likewise. * xfont.c (xfont_list, xfont_match, xfont_list_family) (xfont_text_extents): Likewise. * xmenu.c (set_frame_menubar, xmenu_show): Likewise. * xrdb.c (magic_file_p, x_get_resource): Likewise. * xselect.c (x_queue_event, x_get_window_property) (receive_incremental_selection): Likewise. * xsmfns.c (x_session_check_input): Likewise. * xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT) (handle_one_xevent, x_check_errors, xim_initialize, x_term_init): Likewise. * character.h (BCOPY_SHORT): Removed. * config.in: Regenerate. * dispnew.c (safe_bcopy): Only define as dummy if PROFILING. * emacs.c (main) [PROFILING]: Don't declare dump_opcode_frequencies. * lisp.h (safe_bcopy): Remove declaration. (memset) [!HAVE_MEMSET]: Declare. (memcpy) [!HAVE_MEMCPY]: Likewise. (memmove) [!HAVE_MEMMOVE]: Likewise. (memcmp) [!HAVE_MEMCMP]: Likewise. * s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY) (BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP): Don't define. (HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define. * s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE) (BCOPY_DOWNWARD_SAFE): Don't define. * sysdep.c (memset) [!HAVE_MEMSET]: Define. (memcpy) [!HAVE_MEMCPY]: Define. (memmove) [!HAVE_MEMMOVE]: Define. (memcmp) [!HAVE_MEMCMP]: Define. * config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs. (HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs. * sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1. (HAVE_BZERO): Don't edit. * lwlib.c (lwlib_memset, lwlib_bcopy): Remove. (malloc_widget_value, free_widget_info, allocate_widget_instance) (lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by memset, memcpy, memcmp. * lwlib-utils.c (XtApplyToWidgets): Likewise. * xlwmenu.c (XlwMenuInitialize): Likewise. * lwlib.h (lwlib_bcopy): Remove declaration. * ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by memcpy, memmove, memset. * pop.c (pop_retrieve, socket_connection, pop_getline): Likewise. * CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE) (GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero): Remove. * configure.in: Don't check for bcopy, bcmp, bzero. Don't include <strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
#define HAVE_MEMCMP 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMSET 1
#define HAVE_LOGB 1
#define HAVE_FREXP 1
#define HAVE_FMOD 1
#undef HAVE_RINT
#undef HAVE_CBRT
#define HAVE_FTIME 1
#undef HAVE_RES_INIT /* For -lresolv on Suns. */
#undef HAVE_SETSID
#undef HAVE_FPATHCONF
2002-05-03 20:42:33 +00:00
#define HAVE_SELECT 1
#undef HAVE_EUIDACCESS
#define HAVE_GETPAGESIZE 1
#define HAVE_TZSET 1
#define HAVE_SETLOCALE 1
#undef HAVE_UTIMES
#undef HAVE_SETRLIMIT
#undef HAVE_SETPGID
#undef HAVE_GETCWD
#define HAVE_SHUTDOWN 1
1998-12-10 06:41:00 +00:00
#define LOCALTIME_CACHE
2006-11-13 11:26:30 +00:00
#define HAVE_INET_SOCKETS 1
#undef HAVE_AIX_SMT_EXP
2007-11-09 12:17:57 +00:00
#define USE_TOOLKIT_SCROLL_BARS 1
/* Define if you have the ANSI `strerror' function.
Otherwise you must have the variable `char *sys_errlist[]'. */
#define HAVE_STRERROR 1
/* Define if `struct utimbuf' is declared by <utime.h>. */
#undef HAVE_STRUCT_UTIMBUF
#define HAVE_MOUSE 1
#define HAVE_H_ERRNO 1
#ifdef HAVE_NTGUI
#define HAVE_WINDOW_SYSTEM 1
#define HAVE_MENUS 1
#endif
2010-05-12 06:53:03 +00:00
/* Get some redefinitions in place. */
#ifdef emacs
Support MSVC build with newer versions of Visual Studio. Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
2011-11-05 11:34:56 +00:00
#ifdef _MSC_VER
#include <sys/timeb.h>
#include <sys/stat.h>
#include <signal.h>
/* MSVC gets link-time errors without these redirections. */
#define fstat(a, b) sys_fstat(a, b)
#define stat(a, b) sys_stat(a, b)
#define utime sys_utime
Support MSVC build with newer versions of Visual Studio. Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
2011-11-05 11:34:56 +00:00
#endif
2010-05-12 06:53:03 +00:00
/* Calls that are emulated or shadowed. */
#undef access
#define access sys_access
#undef chdir
#define chdir sys_chdir
#undef chmod
#define chmod sys_chmod
2005-06-24 10:39:20 +00:00
#define chown sys_chown
#undef close
#define close sys_close
#undef creat
#define creat sys_creat
#define ctime sys_ctime
#undef dup
#define dup sys_dup
#undef dup2
#define dup2 sys_dup2
#define fopen sys_fopen
#define link sys_link
#define localtime sys_localtime
#define mkdir sys_mkdir
#undef mktemp
#define mktemp sys_mktemp
#undef open
#define open sys_open
#define pipe sys_pipe
#undef read
#define read sys_read
#define rename sys_rename
#define rmdir sys_rmdir
#define select sys_select
#define sleep sys_sleep
#define strerror sys_strerror
#undef unlink
#define unlink sys_unlink
#undef write
#define write sys_write
2010-05-12 06:53:03 +00:00
/* Subprocess calls that are emulated. */
#define spawnve sys_spawnve
#define wait sys_wait
#define kill sys_kill
#define signal sys_signal
2010-05-12 06:53:03 +00:00
/* termcap.c calls that are emulated. */
#define tputs sys_tputs
#define tgetstr sys_tgetstr
2010-05-12 06:53:03 +00:00
/* cm.c calls that are emulated. */
#define chcheckmagic sys_chcheckmagic
#define cmcostinit sys_cmcostinit
#define cmgoto sys_cmgoto
#define cmputc sys_cmputc
#define Wcm_clear sys_Wcm_clear
#endif /* emacs */
2010-05-12 06:53:03 +00:00
/* Map to MSVC names. */
#define execlp _execlp
#define execvp _execvp
#define fdopen _fdopen
#ifndef fileno
#define fileno _fileno
#endif
#define fsync _commit
#define ftruncate _chsize
#define getpid _getpid
2006-04-10 20:10:33 +00:00
#ifdef _MSC_VER
typedef int pid_t;
#endif
#define isatty _isatty
#define logb _logb
#define _longjmp longjmp
#define lseek _lseek
#define popen _popen
#define pclose _pclose
#define umask _umask
1998-04-23 23:41:42 +00:00
#define utimbuf _utimbuf
#define strdup _strdup
#define strupr _strupr
#define strnicmp _strnicmp
#define stricmp _stricmp
#define tzset _tzset
2006-12-29 14:49:25 +00:00
#if !defined (_MSC_VER) || (_MSC_VER < 1400)
#define tzname _tzname
#undef utime
2006-12-29 15:58:08 +00:00
#define utime _utime
2006-12-29 14:49:25 +00:00
#endif
1994-11-01 10:27:02 +00:00
2010-05-12 06:53:03 +00:00
/* This is hacky, but is necessary to avoid warnings about macro
redefinitions using the SDK compilers. */
#ifndef __STDC__
#define __STDC__ 1
#define MUST_UNDEF__STDC__
#endif
#include <direct.h>
#include <io.h>
#include <stdio.h>
#ifdef MUST_UNDEF__STDC__
#undef __STDC__
#undef MUST_UNDEF__STDC__
#endif
2010-05-12 06:53:03 +00:00
/* Defines that we need that aren't in the standard signal.h. */
1994-11-01 10:27:02 +00:00
#define SIGHUP 1 /* Hang up */
#define SIGQUIT 3 /* Quit process */
#define SIGTRAP 5 /* Trace trap */
#define SIGKILL 9 /* Die, die die */
#define SIGPIPE 13 /* Write on pipe with no readers */
#define SIGALRM 14 /* Alarm */
#define SIGCHLD 18 /* Death of child */
#ifndef NSIG
#define NSIG 23
#endif
1994-11-01 10:27:02 +00:00
/* For integration with MSDOS support. */
#define getdisk() (_getdrive () - 1)
#ifdef emacs
#define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
#else
1994-11-01 10:27:02 +00:00
#define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
#endif
1994-11-01 10:27:02 +00:00
extern char *get_emacs_configuration (void);
extern char *get_emacs_configuration_options (void);
#define EMACS_CONFIGURATION get_emacs_configuration ()
#define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
/* Define this so that winsock.h definitions don't get included with
windows.h. For this to have proper effect, config.h must always be
included before windows.h. */
1994-11-01 10:27:02 +00:00
#define _WINSOCKAPI_ 1
#define _WINSOCK_H
1994-11-01 10:27:02 +00:00
/* Defines size_t and alloca (). */
Support MSVC build with newer versions of Visual Studio. Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
2011-11-05 11:34:56 +00:00
#if (defined(_MSC_VER) && defined(emacs)) || defined(USE_CRT_DLL)
#define malloc e_malloc
#define free e_free
#define realloc e_realloc
#define calloc e_calloc
#endif
Support MSVC build with newer versions of Visual Studio. Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
2011-11-05 11:34:56 +00:00
#ifdef _MSC_VER
#define alloca _alloca
#else
#include <malloc.h>
Support MSVC build with newer versions of Visual Studio. Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
2011-11-05 11:34:56 +00:00
#endif
#include <sys/stat.h>
2010-05-12 06:53:03 +00:00
/* Define for those source files that do not include enough NT system files. */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
1994-11-01 10:31:35 +00:00
/* For proper declaration of environ. */
#include <stdlib.h>
#ifndef sys_nerr
#define sys_nerr _sys_nerr
#endif
#include <string.h>
extern int getloadavg (double *, int);
2007-11-14 16:57:56 +00:00
/* We need a little extra space, see ../../lisp/loadup.el. */
2007-05-15 23:04:35 +00:00
#define SYSTEM_PURESIZE_EXTRA 50000
/* For unexec to work on Alpha systems, we need to put Emacs'
initialized data into a separate section from the CRT initialized
data (because the Alpha linker freely reorders data variables, even
across libraries, so our data and the CRT data get intermingled).
Starting with MSVC 5.0, we must also place the uninitialized data
into its own section. VC5 intermingles uninitialized data from the CRT
between Emacs' static uninitialized data and its public uninitialized
data. A separate .bss section for Emacs groups both static and
2007-11-14 16:57:56 +00:00
public uninitialized together.
2007-11-14 16:57:56 +00:00
Note that unexw32.c relies on this fact, and must be modified
accordingly if this section name is changed, or if this pragma is
removed. Also, obviously, all files that define initialized data
must include config.h to pick up this pragma. */
2010-05-12 06:53:03 +00:00
/* Names must be < 8 bytes. */
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de> * w32select.c: Summary: Thorough rework to implement Unicode clipboard operations and delayed rendering. Drop last_clipboard_text and related code, keep track of ownership via clipboard_owner instead. Drop old #if0 sections. (DEFAULT_LCID, ANSICP, OEMCP, QUNICODE, QANSICP, QOEMCP) (clipboard_owner, modifying_clipboard, cfg_coding_system) (cfg_codepage, cfg_lcid, cfg_clipboard_type, current_text) (current_coding_system, current_requires_encoding) (current_num_nls, current_clipboard_type, current_lcid): New static variables. (convert_to_handle_as_ascii, convert_to_handle_as_coded) (render, render_all, run_protected, lisp_error_handler) (owner_callback, create_owner, setup_config) (enum_locale_callback, cp_from_locale, coding_from_cp): New local functions. (term_w32select, globals_of_w32select): New global functions. (Fw32_set_clipboard_data): Ignore parameter FRAME, use clipboard_owner instead. Use delayed rendering and provide all text formats. Provide CF_LOCALE if necessary. (Fw32_get_clipboard_data): Handle CF_UNICODETEXT and CF_LOCALE. Fall back to CF_TEXT, if CF_UNICODETEXT is not available. Force DOS line-ends for decoding. (Fx_selection_exists_p): Handle CF_UNICODETEXT. (syms_of_w32select): Init and register new variables. * w32.h: Add prototypes for globals_of_w32select and term_w32select. Make the neighboring K&R declarations into prototypes, too. * emacs.c: Include w32.h to get function prototypes. (main): Call globals_of_w32select. * w32.c (term_ntproc): Call term_w32select. * mule-cmds.el (set-locale-environment): Remove call to set-selection-coding-system on Windows. * s/ms-w32.h: Guard MSC-specific #pragmas with an #ifdef.
2005-02-15 23:19:26 +00:00
#ifdef _MSC_VER
#pragma data_seg("EMDATA")
#pragma bss_seg("EMBSS")
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de> * w32select.c: Summary: Thorough rework to implement Unicode clipboard operations and delayed rendering. Drop last_clipboard_text and related code, keep track of ownership via clipboard_owner instead. Drop old #if0 sections. (DEFAULT_LCID, ANSICP, OEMCP, QUNICODE, QANSICP, QOEMCP) (clipboard_owner, modifying_clipboard, cfg_coding_system) (cfg_codepage, cfg_lcid, cfg_clipboard_type, current_text) (current_coding_system, current_requires_encoding) (current_num_nls, current_clipboard_type, current_lcid): New static variables. (convert_to_handle_as_ascii, convert_to_handle_as_coded) (render, render_all, run_protected, lisp_error_handler) (owner_callback, create_owner, setup_config) (enum_locale_callback, cp_from_locale, coding_from_cp): New local functions. (term_w32select, globals_of_w32select): New global functions. (Fw32_set_clipboard_data): Ignore parameter FRAME, use clipboard_owner instead. Use delayed rendering and provide all text formats. Provide CF_LOCALE if necessary. (Fw32_get_clipboard_data): Handle CF_UNICODETEXT and CF_LOCALE. Fall back to CF_TEXT, if CF_UNICODETEXT is not available. Force DOS line-ends for decoding. (Fx_selection_exists_p): Handle CF_UNICODETEXT. (syms_of_w32select): Init and register new variables. * w32.h: Add prototypes for globals_of_w32select and term_w32select. Make the neighboring K&R declarations into prototypes, too. * emacs.c: Include w32.h to get function prototypes. (main): Call globals_of_w32select. * w32.c (term_ntproc): Call term_w32select. * mule-cmds.el (set-locale-environment): Remove call to set-selection-coding-system on Windows. * s/ms-w32.h: Guard MSC-specific #pragmas with an #ifdef.
2005-02-15 23:19:26 +00:00
#endif
/* #define FULL_DEBUG */
/* #define EMACSDEBUG */
#ifdef EMACSDEBUG
extern void _DebPrint (const char *fmt, ...);
#define DebPrint(stuff) _DebPrint stuff
#else
#define DebPrint(stuff)
#endif
/* ============================================================ */