Mercurial > hg > xemacs-beta
annotate src/syswindows.h @ 4952:19a72041c5ed
Mule-izing, various fixes related to char * arguments
-------------------- ChangeLog entries follow: --------------------
modules/ChangeLog addition:
2010-01-26 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c:
* postgresql/postgresql.c (CHECK_LIVE_CONNECTION):
* postgresql/postgresql.c (print_pgresult):
* postgresql/postgresql.c (Fpq_conn_defaults):
* postgresql/postgresql.c (Fpq_connectdb):
* postgresql/postgresql.c (Fpq_connect_start):
* postgresql/postgresql.c (Fpq_result_status):
* postgresql/postgresql.c (Fpq_res_status):
Mule-ize large parts of it.
2010-01-26 Ben Wing <ben@xemacs.org>
* ldap/eldap.c (print_ldap):
* ldap/eldap.c (allocate_ldap):
Use write_ascstring().
src/ChangeLog addition:
2010-01-26 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (build_ascstring):
* alloc.c (build_msg_cistring):
* alloc.c (staticpro_1):
* alloc.c (staticpro_name):
* alloc.c (staticpro_nodump_1):
* alloc.c (staticpro_nodump_name):
* alloc.c (unstaticpro_nodump_1):
* alloc.c (mcpro_1):
* alloc.c (mcpro_name):
* alloc.c (object_memory_usage_stats):
* alloc.c (common_init_alloc_early):
* alloc.c (init_alloc_once_early):
* buffer.c (print_buffer):
* buffer.c (vars_of_buffer):
* buffer.c (common_init_complex_vars_of_buffer):
* buffer.c (init_initial_directory):
* bytecode.c (invalid_byte_code):
* bytecode.c (print_compiled_function):
* bytecode.c (mark_compiled_function):
* chartab.c (print_table_entry):
* chartab.c (print_char_table):
* config.h.in:
* console-gtk.c:
* console-gtk.c (gtk_device_to_console_connection):
* console-gtk.c (gtk_semi_canonicalize_console_connection):
* console-gtk.c (gtk_canonicalize_console_connection):
* console-gtk.c (gtk_semi_canonicalize_device_connection):
* console-gtk.c (gtk_canonicalize_device_connection):
* console-stream.c (stream_init_frame_1):
* console-stream.c (vars_of_console_stream):
* console-stream.c (init_console_stream):
* console-x.c (x_semi_canonicalize_console_connection):
* console-x.c (x_semi_canonicalize_device_connection):
* console-x.c (x_canonicalize_device_connection):
* console-x.h:
* data.c (eq_with_ebola_notice):
* data.c (Fsubr_interactive):
* data.c (Fnumber_to_string):
* data.c (digit_to_number):
* device-gtk.c (gtk_init_device):
* device-msw.c (print_devmode):
* device-x.c (x_event_name):
* dialog-msw.c (handle_directory_dialog_box):
* dialog-msw.c (handle_file_dialog_box):
* dialog-msw.c (vars_of_dialog_mswindows):
* doc.c (weird_doc):
* doc.c (Fsnarf_documentation):
* doc.c (vars_of_doc):
* dumper.c (pdump):
* dynarr.c:
* dynarr.c (Dynarr_realloc):
* editfns.c (Fuser_real_login_name):
* editfns.c (get_home_directory):
* elhash.c (print_hash_table_data):
* elhash.c (print_hash_table):
* emacs.c (main_1):
* emacs.c (vars_of_emacs):
* emodules.c:
* emodules.c (_emodules_list):
* emodules.c (Fload_module):
* emodules.c (Funload_module):
* emodules.c (Flist_modules):
* emodules.c (find_make_module):
* emodules.c (attempt_module_delete):
* emodules.c (emodules_load):
* emodules.c (emodules_doc_subr):
* emodules.c (emodules_doc_sym):
* emodules.c (syms_of_module):
* emodules.c (vars_of_module):
* emodules.h:
* eval.c (print_subr):
* eval.c (signal_call_debugger):
* eval.c (build_error_data):
* eval.c (signal_error):
* eval.c (maybe_signal_error):
* eval.c (signal_continuable_error):
* eval.c (maybe_signal_continuable_error):
* eval.c (signal_error_2):
* eval.c (maybe_signal_error_2):
* eval.c (signal_continuable_error_2):
* eval.c (maybe_signal_continuable_error_2):
* eval.c (signal_ferror):
* eval.c (maybe_signal_ferror):
* eval.c (signal_continuable_ferror):
* eval.c (maybe_signal_continuable_ferror):
* eval.c (signal_ferror_with_frob):
* eval.c (maybe_signal_ferror_with_frob):
* eval.c (signal_continuable_ferror_with_frob):
* eval.c (maybe_signal_continuable_ferror_with_frob):
* eval.c (syntax_error):
* eval.c (syntax_error_2):
* eval.c (maybe_syntax_error):
* eval.c (sferror):
* eval.c (sferror_2):
* eval.c (maybe_sferror):
* eval.c (invalid_argument):
* eval.c (invalid_argument_2):
* eval.c (maybe_invalid_argument):
* eval.c (invalid_constant):
* eval.c (invalid_constant_2):
* eval.c (maybe_invalid_constant):
* eval.c (invalid_operation):
* eval.c (invalid_operation_2):
* eval.c (maybe_invalid_operation):
* eval.c (invalid_change):
* eval.c (invalid_change_2):
* eval.c (maybe_invalid_change):
* eval.c (invalid_state):
* eval.c (invalid_state_2):
* eval.c (maybe_invalid_state):
* eval.c (wtaerror):
* eval.c (stack_overflow):
* eval.c (out_of_memory):
* eval.c (print_multiple_value):
* eval.c (issue_call_trapping_problems_warning):
* eval.c (backtrace_specials):
* eval.c (backtrace_unevalled_args):
* eval.c (Fbacktrace):
* eval.c (warn_when_safe):
* event-Xt.c (modwarn):
* event-Xt.c (modbarf):
* event-Xt.c (check_modifier):
* event-Xt.c (store_modifier):
* event-Xt.c (emacs_Xt_format_magic_event):
* event-Xt.c (describe_event):
* event-gtk.c (dragndrop_data_received):
* event-gtk.c (store_modifier):
* event-gtk.c (gtk_reset_modifier_mapping):
* event-msw.c (dde_eval_string):
* event-msw.c (Fdde_alloc_advise_item):
* event-msw.c (mswindows_dde_callback):
* event-msw.c (FROB):
* event-msw.c (emacs_mswindows_format_magic_event):
* event-stream.c (external_debugging_print_event):
* event-stream.c (execute_help_form):
* event-stream.c (vars_of_event_stream):
* events.c (print_event_1):
* events.c (print_event):
* events.c (event_equal):
* extents.c (print_extent_1):
* extents.c (print_extent):
* extents.c (vars_of_extents):
* faces.c (print_face):
* faces.c (complex_vars_of_faces):
* file-coding.c:
* file-coding.c (print_coding_system):
* file-coding.c (print_coding_system_in_print_method):
* file-coding.c (default_query_method):
* file-coding.c (find_coding_system):
* file-coding.c (make_coding_system_1):
* file-coding.c (chain_print):
* file-coding.c (undecided_print):
* file-coding.c (gzip_print):
* file-coding.c (vars_of_file_coding):
* file-coding.c (complex_vars_of_file_coding):
* fileio.c:
* fileio.c (report_file_type_error):
* fileio.c (report_error_with_errno):
* fileio.c (report_file_error):
* fileio.c (barf_or_query_if_file_exists):
* fileio.c (vars_of_fileio):
* floatfns.c (matherr):
* fns.c (print_bit_vector):
* fns.c (Fmapconcat):
* fns.c (add_suffix_to_symbol):
* fns.c (add_prefix_to_symbol):
* frame-gtk.c:
* frame-gtk.c (Fgtk_window_id):
* frame-x.c (def):
* frame-x.c (x_cde_transfer_callback):
* frame.c:
* frame.c (Fmake_frame):
* gc.c (show_gc_cursor_and_message):
* gc.c (vars_of_gc):
* glyphs-eimage.c (png_instantiate):
* glyphs-eimage.c (tiff_instantiate):
* glyphs-gtk.c (gtk_print_image_instance):
* glyphs-msw.c (mswindows_print_image_instance):
* glyphs-x.c (x_print_image_instance):
* glyphs-x.c (update_widget_face):
* glyphs.c (make_string_from_file):
* glyphs.c (print_image_instance):
* glyphs.c (signal_image_error):
* glyphs.c (signal_image_error_2):
* glyphs.c (signal_double_image_error):
* glyphs.c (signal_double_image_error_2):
* glyphs.c (xbm_mask_file_munging):
* glyphs.c (pixmap_to_lisp_data):
* glyphs.h:
* gui.c (gui_item_display_flush_left):
* hpplay.c (player_error_internal):
* hpplay.c (myHandler):
* intl-win32.c:
* intl-win32.c (langcode_to_lang):
* intl-win32.c (sublangcode_to_lang):
* intl-win32.c (Fmswindows_get_locale_info):
* intl-win32.c (lcid_to_locale_mule_or_no):
* intl-win32.c (mswindows_multibyte_to_unicode_print):
* intl-win32.c (complex_vars_of_intl_win32):
* keymap.c:
* keymap.c (print_keymap):
* keymap.c (ensure_meta_prefix_char_keymapp):
* keymap.c (Fkey_description):
* keymap.c (Ftext_char_description):
* lisp.h:
* lisp.h (struct):
* lisp.h (DECLARE_INLINE_HEADER):
* lread.c (Fload_internal):
* lread.c (locate_file):
* lread.c (read_escape):
* lread.c (read_raw_string):
* lread.c (read1):
* lread.c (read_list):
* lread.c (read_compiled_function):
* lread.c (init_lread):
* lrecord.h:
* marker.c (print_marker):
* marker.c (marker_equal):
* menubar-msw.c (displayable_menu_item):
* menubar-x.c (command_builder_operate_menu_accelerator):
* menubar.c (vars_of_menubar):
* minibuf.c (reinit_complex_vars_of_minibuf):
* minibuf.c (complex_vars_of_minibuf):
* mule-charset.c (Fmake_charset):
* mule-charset.c (complex_vars_of_mule_charset):
* mule-coding.c (iso2022_print):
* mule-coding.c (fixed_width_query):
* number.c (bignum_print):
* number.c (ratio_print):
* number.c (bigfloat_print):
* number.c (bigfloat_finalize):
* objects-msw.c:
* objects-msw.c (mswindows_color_to_string):
* objects-msw.c (mswindows_color_list):
* objects-tty.c:
* objects-tty.c (tty_font_list):
* objects-tty.c (tty_find_charset_font):
* objects-xlike-inc.c (xft_find_charset_font):
* objects-xlike-inc.c (endif):
* print.c:
* print.c (write_istring):
* print.c (write_ascstring):
* print.c (Fterpri):
* print.c (Fprint):
* print.c (print_error_message):
* print.c (print_vector_internal):
* print.c (print_cons):
* print.c (print_string):
* print.c (printing_unreadable_object):
* print.c (print_internal):
* print.c (print_float):
* print.c (print_symbol):
* process-nt.c (mswindows_report_winsock_error):
* process-nt.c (nt_canonicalize_host_name):
* process-unix.c (unix_canonicalize_host_name):
* process.c (print_process):
* process.c (report_process_error):
* process.c (report_network_error):
* process.c (make_process_internal):
* process.c (Fstart_process_internal):
* process.c (status_message):
* process.c (putenv_internal):
* process.c (vars_of_process):
* process.h:
* profile.c (vars_of_profile):
* rangetab.c (print_range_table):
* realpath.c (vars_of_realpath):
* redisplay.c (vars_of_redisplay):
* search.c (wordify):
* search.c (Freplace_match):
* sheap.c (sheap_adjust_h):
* sound.c (report_sound_error):
* sound.c (Fplay_sound_file):
* specifier.c (print_specifier):
* symbols.c (Fsubr_name):
* symbols.c (do_symval_forwarding):
* symbols.c (set_default_buffer_slot_variable):
* symbols.c (set_default_console_slot_variable):
* symbols.c (store_symval_forwarding):
* symbols.c (default_value):
* symbols.c (defsymbol_massage_name_1):
* symbols.c (defsymbol_massage_name_nodump):
* symbols.c (defsymbol_massage_name):
* symbols.c (defsymbol_massage_multiword_predicate_nodump):
* symbols.c (defsymbol_massage_multiword_predicate):
* symbols.c (defsymbol_nodump):
* symbols.c (defsymbol):
* symbols.c (defkeyword):
* symbols.c (defkeyword_massage_name):
* symbols.c (check_module_subr):
* symbols.c (deferror_1):
* symbols.c (deferror):
* symbols.c (deferror_massage_name):
* symbols.c (deferror_massage_name_and_message):
* symbols.c (defvar_magic):
* symeval.h:
* symeval.h (DEFVAR_SYMVAL_FWD):
* sysdep.c:
* sysdep.c (init_system_name):
* sysdll.c:
* sysdll.c (MAYBE_PREPEND_UNDERSCORE):
* sysdll.c (dll_function):
* sysdll.c (dll_variable):
* sysdll.c (dll_error):
* sysdll.c (dll_open):
* sysdll.c (dll_close):
* sysdll.c (image_for_address):
* sysdll.c (my_find_image):
* sysdll.c (search_linked_libs):
* sysdll.h:
* sysfile.h:
* sysfile.h (DEFAULT_DIRECTORY_FALLBACK):
* syswindows.h:
* tests.c (DFC_CHECK_LENGTH):
* tests.c (DFC_CHECK_CONTENT):
* tests.c (Ftest_hash_tables):
* text.c (vars_of_text):
* text.h:
* tooltalk.c (tt_opnum_string):
* tooltalk.c (tt_message_arg_ival_string):
* tooltalk.c (Ftooltalk_default_procid):
* tooltalk.c (Ftooltalk_default_session):
* tooltalk.c (init_tooltalk):
* tooltalk.c (vars_of_tooltalk):
* ui-gtk.c (Fdll_load):
* ui-gtk.c (type_to_marshaller_type):
* ui-gtk.c (Fgtk_import_function_internal):
* ui-gtk.c (emacs_gtk_object_printer):
* ui-gtk.c (emacs_gtk_boxed_printer):
* unicode.c (unicode_to_ichar):
* unicode.c (unicode_print):
* unicode.c (unicode_query):
* unicode.c (vars_of_unicode):
* unicode.c (complex_vars_of_unicode):
* win32.c:
* win32.c (mswindows_report_process_error):
* window.c (print_window):
* xemacs.def.in.in:
BASIC IDEA: Further fixing up uses of char * and CIbyte *
to reflect their actual semantics; Mule-izing some code;
redoing of the not-yet-working code to handle message translation.
Clean up code to handle message-translation (not yet working).
Create separate versions of build_msg_string() for working with
Ibyte *, CIbyte *, and Ascbyte * arguments. Assert that Ascbyte *
arguments are pure-ASCII. Make build_msg_string() be the same
as build_msg_ascstring(). Create same three versions of GETTEXT()
and DEFER_GETTEXT(). Also create build_defer_string() and
variants for the equivalent of DEFER_GETTEXT() when building a
string. Remove old CGETTEXT(). Clean up code where GETTEXT(),
DEFER_GETTEXT(), build_msg_string(), etc. was being called and
introduce some new calls to build_msg_string(), etc. Remove
GETTEXT() from calls to weird_doc() -- we assume that the
message snarfer knows about weird_doc(). Remove uses of
DEFER_GETTEXT() from error messages in sysdep.c and instead use
special comments /* @@@begin-snarf@@@ */ and /* @@@end-snarf@@@ */
that the message snarfer presumably knows about.
Create build_ascstring() and use it in many instances in place
of build_string(). The purpose of having Ascbyte * variants is
to make the code more self-documenting in terms of what sort of
semantics is expected for char * strings. In fact in the process
of looking for uses of build_string(), much improperly Mule-ized
was discovered.
Mule-ize a lot of code as described in previous paragraph,
e.g. in sysdep.c.
Make the error functions take Ascbyte * strings and fix up a
couple of places where non-pure-ASCII strings were being passed in
(file-coding.c, mule-coding.c, unicode.c). (It's debatable whether
we really need to make the error functions work this way. It
helps catch places where code is written in a way that message
translation won't work, but we may well never implement message
translation.)
Make staticpro() and friends take Ascbyte * strings instead of
raw char * strings. Create a const_Ascbyte_ptr dynarr type
to describe what's held by staticpro_names[] and friends,
create pdump descriptions for const_Ascbyte_ptr dynarrs, and
use them in place of specially-crafted staticpro descriptions.
Mule-ize certain other functions (e.g. x_event_name) by correcting
raw use of char * to Ascbyte *, Rawbyte * or another such type,
and raw use of char[] buffers to another type (usually Ascbyte[]).
Change many uses of write_c_string() to write_msg_string(),
write_ascstring(), etc.
Mule-ize emodules.c, emodules.h, sysdll.h.
Fix some un-Mule-ized code in intl-win32.c.
A comment in event-Xt.c and the limitations of the message
snarfer (make-msgfile or whatever) is presumably incorrect --
it should be smart enough to handle function calls spread over
more than one line. Clean up code in event-Xt.c that was
written awkwardly for this reason.
In config.h.in, instead of NEED_ERROR_CHECK_TYPES_INLINES,
create a more general XEMACS_DEFS_NEEDS_INLINE_DECLS to
indicate when inlined functions need to be declared in
xemacs.defs.in.in, and make use of it in xemacs.defs.in.in.
We need to do this because postgresql.c now calls qxestrdup(),
which is an inline function.
Make nconc2() and other such functions MODULE_API and put
them in xemacs.defs.in.in since postgresql.c now uses them.
Clean up indentation in lread.c and a few other places.
In text.h, document ASSERT_ASCTEXT_ASCII() and
ASSERT_ASCTEXT_ASCII_LEN(), group together the stand-in
encodings and add some more for DLL symbols, function and
variable names, etc.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Tue, 26 Jan 2010 23:22:30 -0600 |
parents | 8b63e21b0436 |
children | 304aebb79cd3 |
rev | line source |
---|---|
442 | 1 /* Copyright (C) 2000 Free Software Foundation, Inc. |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
2 Copyright (C) 2000, 2001, 2002, 2004, 2010 Ben Wing. |
442 | 3 |
4 This file is part of XEmacs. | |
5 | |
6 XEmacs is free software; you can redistribute it and/or modify it | |
7 under the terms of the GNU General Public License as published by the | |
8 Free Software Foundation; either version 2, or (at your option) any | |
9 later version. | |
10 | |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with XEmacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 Boston, MA 02111-1307, USA. */ | |
20 | |
21 /* Synched up with: Not in FSF. */ | |
22 | |
23 /* Authorship: | |
24 | |
771 | 25 Current primary author: Ben Wing <ben@xemacs.org> |
26 | |
442 | 27 Created May 2000 by Andy Piper. |
771 | 28 Windows-Mule stuff added by Ben Wing, 2000-2001. |
29 September 2001 Ben Wing reorganized and included nt.h and ntheap.h into | |
30 this file; comments in those files say: | |
31 * Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> | |
32 * Sync'ed with Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> | |
33 (Note: Sync messages from Marc Paquette may indicate | |
34 incomplete synching, so beware.) | |
35 (in ntheap.h only) Geoff Voelker (voelker@cs.washington.edu) 7-29-94 | |
36 | |
442 | 37 */ |
38 | |
39 #ifndef INCLUDED_syswindows_h_ | |
40 #define INCLUDED_syswindows_h_ | |
41 | |
2367 | 42 /* See win32.c for info about the different Windows files in XEmacs. */ |
442 | 43 |
771 | 44 /* ------------------------- Basic includes ------------------------- */ |
442 | 45 |
46 #ifndef WIN32_LEAN_AND_MEAN | |
47 #define WIN32_LEAN_AND_MEAN | |
48 #endif | |
49 | |
4858
e1d8b6b0c589
Define CYGWIN_HEADERS in s/cygwin32.h and s/mingw32.h instead of syswindows.h, so they're available everywhere
Ben Wing <ben@xemacs.org>
parents:
4854
diff
changeset
|
50 #ifdef CYGWIN_HEADERS |
771 | 51 # ifndef _WIN32_IE |
52 # define _WIN32_IE 0x0400 | |
53 # endif | |
665 | 54 |
1743 | 55 BEGIN_C_DECLS |
665 | 56 |
4827
11daf37dae4d
more fixes to get a clean compile
Ben Wing <ben@xemacs.org>
parents:
4824
diff
changeset
|
57 #if 0 /* breaks the build, as of GCC 3.4.4 or earlier, since the prototype |
11daf37dae4d
more fixes to get a clean compile
Ben Wing <ben@xemacs.org>
parents:
4824
diff
changeset
|
58 is now declared static */ |
665 | 59 /* Fucking GCC complains about "no previous prototype" for inline |
60 functions. DUH! See DECLARE_INLINE_HEADER. */ | |
61 extern __inline void *GetCurrentFiber (void); | |
62 extern __inline void *GetFiberData (void); | |
4824
c12b646d84ee
changes to get things to compile under latest cygwin
Ben Wing <ben@xemacs.org>
parents:
4538
diff
changeset
|
63 #endif |
665 | 64 |
1743 | 65 END_C_DECLS |
665 | 66 |
67 #endif | |
68 | |
771 | 69 /* Defines for COM so it's usable in both C and C++. XECOMCALLn() calls a |
70 method with the specified number of parameters. XECOMID() surrounds a | |
71 class or interface name when passed to CoCreateInstance, a | |
72 QueryInterface method, or the like. */ | |
73 #ifdef __cplusplus | |
74 #define XECOMCALL0(cl, meth) ((cl)->meth ()) | |
75 #define XECOMCALL1(cl, meth, a1) ((cl)->meth (a1)) | |
76 #define XECOMCALL2(cl, meth, a1, a2) ((cl)->meth (a1, a2)) | |
77 #define XECOMCALL3(cl, meth, a1, a2, a3) ((cl)->meth (a1, a2, a3)) | |
78 #define XECOMCALL4(cl, meth, a1, a2, a3, a4) ((cl)->meth (a1, a2, a3, a4)) | |
79 #define XECOMID(id) (id) | |
80 #else | |
81 #define XECOMCALL0(cl, meth) ((cl)->lpVtbl->meth (cl)) | |
82 #define XECOMCALL1(cl, meth, a1) ((cl)->lpVtbl->meth (cl, a1)) | |
83 #define XECOMCALL2(cl, meth, a1, a2) ((cl)->lpVtbl->meth (cl, a1, a2)) | |
84 #define XECOMCALL3(cl, meth, a1, a2, a3) ((cl)->lpVtbl->meth (cl, a1, a2, a3)) | |
85 #define XECOMCALL4(cl, meth, a1, a2, a3, a4) \ | |
86 ((cl)->lpVtbl->meth (cl, a1, a2, a3, a4)) | |
87 #define XECOMID(id) (&(id)) | |
88 #endif | |
89 | |
90 #define OEMRESOURCE /* Define OCR_ and friend constants */ | |
442 | 91 #include <windows.h> |
92 | |
3728 | 93 #include <aclapi.h> |
94 | |
558 | 95 #if defined (WIN32_LEAN_AND_MEAN) |
96 # ifdef HAVE_X_WINDOWS | |
442 | 97 /* Christ almighty. The problems you get when combining two large code bases, |
98 neither with any respect for namespace purity. */ | |
558 | 99 # undef Status |
100 # endif | |
101 # include <winspool.h> | |
102 # ifdef HAVE_X_WINDOWS | |
103 # define Status int | |
104 # endif | |
105 # include <mmsystem.h> | |
673 | 106 # include <shlobj.h> |
558 | 107 # include <shellapi.h> |
108 # include <ddeml.h> | |
442 | 109 #endif |
110 | |
546 | 111 #include <lmaccess.h> /* next three for NetUserEnum and friends */ |
531 | 112 #include <lmapibuf.h> |
113 #include <lmerr.h> | |
546 | 114 #include <lmcons.h> /* for UNLEN and possibly other constants */ |
531 | 115 |
771 | 116 #include <cderr.h> |
117 #include <commdlg.h> | |
118 | |
119 #ifdef NEED_MSWINDOWS_COMMCTRL | |
120 #include <commctrl.h> | |
442 | 121 #endif |
771 | 122 #ifdef NEED_MSWINDOWS_OBJBASE |
123 #include <objbase.h> | |
442 | 124 #endif |
771 | 125 #ifdef NEED_MSWINDOWS_SHLOBJ |
126 #include <shlobj.h> | |
442 | 127 #endif |
128 | |
771 | 129 #include <zmouse.h> /* WHEEL_PAGESCROLL under Cygwin */ |
130 | |
131 #include <wchar.h> | |
442 | 132 |
771 | 133 /* ------------------------- Cygwin header brokenness ---------------------- */ |
134 | |
135 #ifdef CYGWIN_HEADERS | |
136 | |
1683 | 137 #include <cygwin/stat.h> /* for struct stat */ |
1304 | 138 #include <w32api.h> /* for version info */ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
139 #include <sys/cygwin.h> /* path conversion functions */ |
1304 | 140 |
1683 | 141 /* Test for a specific version of w32api */ |
142 #define W32API_VER(major,minor) (((major) << 16) + (minor)) | |
143 #define W32API_INSTALLED_VER \ | |
144 W32API_VER (__W32API_MAJOR_VERSION, __W32API_MINOR_VERSION) | |
1304 | 145 |
771 | 146 /* Various brokennesses in various versions of Cygwin */ |
673 | 147 |
442 | 148 /* windows.h defines. */ |
149 #ifndef SPI_GETWHEELSCROLLLINES | |
150 #define SPI_GETWHEELSCROLLLINES 104 | |
151 #endif | |
771 | 152 |
153 /* commctrl.h defines. */ | |
154 #ifndef TB_SETIMAGELIST | |
155 #define TB_SETIMAGELIST (WM_USER + 48) | |
442 | 156 #endif |
771 | 157 #ifndef TB_GETIMAGELIST |
158 #define TB_GETIMAGELIST (WM_USER + 49) | |
159 #endif | |
160 #ifndef TB_SETDISABLEDIMAGELIST | |
161 #define TB_SETDISABLEDIMAGELIST (WM_USER + 54) | |
162 #endif | |
163 #ifndef TB_GETDISABLEDIMAGELIST | |
164 #define TB_GETDISABLEDIMAGELIST (WM_USER + 55) | |
442 | 165 #endif |
771 | 166 #ifndef TB_SETPADDING |
167 #define TB_SETPADDING (WM_USER + 87) | |
168 #endif | |
169 #ifndef TB_GETBUTTONINFOA | |
170 #define TB_GETBUTTONINFOA (WM_USER + 65) | |
171 #endif | |
172 #ifndef TB_GETBUTTONINFOW | |
173 #define TB_GETBUTTONINFOW (WM_USER + 63) | |
442 | 174 #endif |
771 | 175 #ifndef TB_SETBUTTONINFOA |
176 #define TB_SETBUTTONINFOA (WM_USER + 66) | |
177 #endif | |
178 #ifndef TB_SETBUTTONINFOW | |
179 #define TB_SETBUTTONINFOW (WM_USER + 64) | |
180 #endif | |
181 #ifndef TB_INSERTBUTTONA | |
182 #define TB_INSERTBUTTONA (WM_USER + 21) | |
442 | 183 #endif |
771 | 184 #ifndef TB_INSERTBUTTONW |
185 #define TB_INSERTBUTTONW (WM_USER + 67) | |
186 #endif | |
187 #ifndef TB_ADDBUTTONSA | |
188 #define TB_ADDBUTTONSA (WM_USER + 20) | |
189 #endif | |
190 #ifndef TB_ADDBUTTONSW | |
191 #define TB_ADDBUTTONSW (WM_USER + 68) | |
442 | 192 #endif |
771 | 193 #ifndef LVM_SETBKIMAGEA |
194 #define LVM_SETBKIMAGEA (LVM_FIRST + 68) | |
195 #endif | |
196 #ifndef LVM_SETBKIMAGEW | |
197 #define LVM_SETBKIMAGEW (LVM_FIRST + 138) | |
198 #endif | |
199 #ifndef LVM_GETBKIMAGEA | |
200 #define LVM_GETBKIMAGEA (LVM_FIRST + 69) | |
442 | 201 #endif |
771 | 202 #ifndef LVM_GETBKIMAGEW |
203 #define LVM_GETBKIMAGEW (LVM_FIRST + 139) | |
204 #endif | |
205 #ifndef WC_COMBOBOXEXW | |
206 #define WC_COMBOBOXEXW L"ComboBoxEx32" | |
207 #endif | |
208 #ifndef CBEM_INSERTITEMA | |
209 #define CBEM_INSERTITEMA (WM_USER + 1) | |
442 | 210 #endif |
771 | 211 #ifndef CBEM_INSERTITEMW |
212 #define CBEM_INSERTITEMW (WM_USER + 11) | |
442 | 213 #endif |
771 | 214 #ifndef CBEM_SETITEMA |
215 #define CBEM_SETITEMA (WM_USER + 5) | |
216 #endif | |
217 #ifndef CBEM_SETITEMW | |
218 #define CBEM_SETITEMW (WM_USER + 12) | |
442 | 219 #endif |
771 | 220 #ifndef CBEM_GETITEMA |
221 #define CBEM_GETITEMA (WM_USER + 4) | |
222 #endif | |
223 #ifndef CBEM_GETITEMW | |
224 #define CBEM_GETITEMW (WM_USER + 13) | |
442 | 225 #endif |
771 | 226 #ifndef HDN_GETDISPINFOA |
227 #define HDN_GETDISPINFOA (HDN_FIRST - 9) | |
228 #endif | |
229 #ifndef HDN_GETDISPINFOW | |
230 #define HDN_GETDISPINFOW (HDN_FIRST - 29) | |
231 #endif | |
232 #ifndef TBN_GETDISPINFOA | |
233 #define TBN_GETDISPINFOA (TBN_FIRST - 16) | |
442 | 234 #endif |
771 | 235 #ifndef TBN_GETDISPINFOW |
236 #define TBN_GETDISPINFOW (TBN_FIRST - 17) | |
237 #endif | |
238 #ifndef TBN_GETINFOTIPA | |
239 #define TBN_GETINFOTIPA (TBN_FIRST - 18) | |
442 | 240 #endif |
771 | 241 #ifndef TBN_GETINFOTIPW |
242 #define TBN_GETINFOTIPW (TBN_FIRST - 19) | |
243 #endif | |
244 #ifndef TTN_GETDISPINFOA | |
245 #define TTN_GETDISPINFOA (TTN_FIRST - 0) | |
246 #endif | |
247 #ifndef TTN_GETDISPINFOW | |
248 #define TTN_GETDISPINFOW (TTN_FIRST - 10) | |
442 | 249 #endif |
771 | 250 |
251 #if (_WIN32_IE >= 0x0400) | |
252 | |
253 #ifndef LVN_GETINFOTIPA | |
254 #define LVN_GETINFOTIPA (LVN_FIRST - 57) | |
255 #endif | |
256 #ifndef LVN_GETINFOTIPW | |
257 #define LVN_GETINFOTIPW (LVN_FIRST - 58) | |
442 | 258 #endif |
771 | 259 #ifndef TVN_GETINFOTIPA |
260 #define TVN_GETINFOTIPA (TVN_FIRST - 13) | |
261 #endif | |
262 #ifndef TVN_GETINFOTIPW | |
263 #define TVN_GETINFOTIPW (TVN_FIRST - 14) | |
264 #endif | |
265 #ifndef CBEN_GETDISPINFOA | |
266 #define CBEN_GETDISPINFOA (CBEN_FIRST - 0) | |
442 | 267 #endif |
771 | 268 #ifndef CBEN_GETDISPINFOW |
269 #define CBEN_GETDISPINFOW (CBEN_FIRST - 7) | |
270 #endif | |
271 #ifndef CBEN_DRAGBEGINA | |
272 #define CBEN_DRAGBEGINA (CBEN_FIRST - 8) | |
273 #endif | |
274 #ifndef CBEN_DRAGBEGINW | |
275 #define CBEN_DRAGBEGINW (CBEN_FIRST - 9) | |
442 | 276 #endif |
771 | 277 |
278 #endif /* (_WIN32_IE >= 0x0400) */ | |
279 | |
280 #ifndef CBEN_ENDEDITA | |
281 #define CBEN_ENDEDITA (CBEN_FIRST - 5) | |
442 | 282 #endif |
771 | 283 #ifndef CBEN_ENDEDITW |
284 #define CBEN_ENDEDITW (CBEN_FIRST - 6) | |
285 #endif | |
286 | |
287 #ifndef CBEMAXSTRLEN | |
288 #define CBEMAXSTRLEN 260 | |
442 | 289 #endif |
290 | |
1111 | 291 #ifndef NMCBEENDEDIT |
292 | |
293 typedef struct | |
294 { | |
295 NMHDR hdr; | |
296 BOOL fChanged; | |
297 int iNewSelection; | |
298 WCHAR szText[CBEMAXSTRLEN]; | |
299 int iWhy; | |
771 | 300 } NMCBEENDEDITW, *LPNMCBEENDEDITW, *PNMCBEENDEDITW; |
301 | |
1111 | 302 typedef struct |
303 { | |
304 NMHDR hdr; | |
305 BOOL fChanged; | |
306 int iNewSelection; | |
307 char szText[CBEMAXSTRLEN]; | |
308 int iWhy; | |
771 | 309 } NMCBEENDEDITA, *LPNMCBEENDEDITA,*PNMCBEENDEDITA; |
310 | |
1111 | 311 #endif /* not NMCBEENDEDIT */ |
312 | |
771 | 313 #if (_WIN32_IE >= 0x0400) |
314 | |
1111 | 315 #ifndef NMCBEDRAGBEGIN |
316 | |
317 typedef struct | |
318 { | |
319 NMHDR hdr; | |
320 int iItemid; | |
321 WCHAR szText[CBEMAXSTRLEN]; | |
322 } NMCBEDRAGBEGINW, *LPNMCBEDRAGBEGINW, *PNMCBEDRAGBEGINW; | |
771 | 323 |
1111 | 324 typedef struct |
325 { | |
326 NMHDR hdr; | |
327 int iItemid; | |
328 char szText[CBEMAXSTRLEN]; | |
329 } NMCBEDRAGBEGINA, *LPNMCBEDRAGBEGINA, *PNMCBEDRAGBEGINA; | |
330 | |
331 #endif /* not NMCBEDRAGBEGIN */ | |
332 | |
771 | 333 typedef struct tagNMDATETIMEFORMATA |
334 { | |
1111 | 335 NMHDR nmhdr; |
336 LPCSTR pszFormat; | |
337 SYSTEMTIME st; | |
338 LPCSTR pszDisplay; | |
339 CHAR szDisplay[64]; | |
771 | 340 } NMDATETIMEFORMATA, FAR * LPNMDATETIMEFORMATA; |
341 | |
342 typedef struct tagNMDATETIMEFORMATW | |
343 { | |
1111 | 344 NMHDR nmhdr; |
345 LPCWSTR pszFormat; | |
346 SYSTEMTIME st; | |
347 LPCWSTR pszDisplay; | |
348 WCHAR szDisplay[64]; | |
771 | 349 } NMDATETIMEFORMATW, FAR * LPNMDATETIMEFORMATW; |
350 | |
1683 | 351 #if W32API_INSTALLED_VER < W32API_VER(2,2) |
1304 | 352 |
1111 | 353 typedef struct tagNMTTDISPIFNOA |
354 { | |
355 NMHDR hdr; | |
356 LPSTR lpszText; | |
357 char szText[80]; | |
358 HINSTANCE hinst; | |
359 UINT uFlags; | |
771 | 360 #if (_WIN32_IE >= 0x0300) |
1111 | 361 LPARAM lParam; |
771 | 362 #endif |
363 } NMTTDISPINFOA, FAR *LPNMTTDISPINFOA; | |
364 | |
1111 | 365 typedef struct tagNMTTDISPINFOW |
366 { | |
367 NMHDR hdr; | |
368 LPWSTR lpszText; | |
369 WCHAR szText[80]; | |
370 HINSTANCE hinst; | |
371 UINT uFlags; | |
771 | 372 #if (_WIN32_IE >= 0x0300) |
1111 | 373 LPARAM lParam; |
771 | 374 #endif |
375 } NMTTDISPINFOW, FAR *LPNMTTDISPINFOW; | |
376 | |
1683 | 377 #endif /* W32API_INSTALLED_VER < W32API_VER(2,2) */ |
1304 | 378 |
771 | 379 #endif /* (_WIN32_IE >= 0x0400) */ |
442 | 380 |
771 | 381 /* shlobj.h defines */ |
382 #ifndef BFFM_VALIDATEFAILEDA | |
383 #define BFFM_VALIDATEFAILEDA 3 | |
384 #endif | |
385 #ifndef BFFM_VALIDATEFAILEDW | |
386 #define BFFM_VALIDATEFAILEDW 4 | |
387 #endif | |
388 #ifndef BFFM_SETSELECTIONA | |
389 #define BFFM_SETSELECTIONA (WM_USER + 102) | |
390 #endif | |
391 #ifndef BFFM_SETSELECTIONW | |
392 #define BFFM_SETSELECTIONW (WM_USER + 103) | |
393 #endif | |
394 #ifndef BFFM_SETSTATUSTEXTA | |
395 #define BFFM_SETSTATUSTEXTA (WM_USER + 100) | |
396 #endif | |
397 #ifndef BFFM_SETSTATUSTEXTW | |
398 #define BFFM_SETSTATUSTEXTW (WM_USER + 104) | |
399 #endif | |
400 #ifndef SHARD_PATHA | |
401 #define SHARD_PATHA 2 | |
402 #endif | |
403 #ifndef SHARD_PATHW | |
404 #define SHARD_PATHW 3 | |
405 #endif | |
406 #ifndef SHCNF_PATHA | |
407 #define SHCNF_PATHA 1 | |
408 #endif | |
409 #ifndef SHCNF_PATHW | |
410 #define SHCNF_PATHW 5 | |
411 #endif | |
412 #ifndef SHCNF_PRINTERA | |
413 #define SHCNF_PRINTERA 2 | |
414 #endif | |
415 #ifndef SHCNF_PRINTERW | |
416 #define SHCNF_PRINTERW 6 | |
417 #endif | |
418 #ifndef BFFM_VALIDATEFAILED | |
419 #ifdef UNICODE | |
420 #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDW | |
421 #else | |
422 #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDA | |
423 #endif | |
819 | 424 #endif |
442 | 425 |
800 | 426 /* winnls.h defines */ |
819 | 427 #ifndef MAC_CHARSET |
428 #define MAC_CHARSET 77 | |
429 #endif | |
800 | 430 #ifndef LOCALE_RETURN_NUMBER |
819 | 431 #define LOCALE_RETURN_NUMBER 0x20000000 |
800 | 432 #endif |
433 | |
771 | 434 /* OEM resources */ |
435 #ifndef OCR_ICOCUR | |
436 #define OCR_ICOCUR 32647 | |
437 #define OIC_SAMPLE 32512 | |
438 #define OIC_HAND 32513 | |
439 #define OIC_QUES 32514 | |
440 #define OIC_BANG 32515 | |
441 #define OIC_NOTE 32516 | |
442 #define OIC_WINLOGO 32517 | |
443 #endif | |
444 | |
445 /* More Cygwin stupidity: Current w32api's winuser.h has IME message | |
446 constants and they conflict with imm.h. (NOTE: Currently fixed, but | |
447 I'm sure the problems were present post 1.0.) */ | |
448 #undef WM_IME_STARTCOMPOSITION | |
449 #undef WM_IME_ENDCOMPOSITION | |
450 #undef WM_IME_COMPOSITION | |
451 #undef WM_IME_KEYLAST | |
452 #undef WM_IME_SETCONTEXT | |
453 #undef WM_IME_NOTIFY | |
454 #undef WM_IME_CONTROL | |
455 #undef WM_IME_COMPOSITIONFULL | |
456 #undef WM_IME_SELECT | |
457 #undef WM_IME_CHAR | |
458 #undef WM_IME_KEYDOWN | |
459 #undef WM_IME_KEYUP | |
460 | |
461 #include <imm.h> | |
462 | |
1683 | 463 #if W32API_INSTALLED_VER < W32API_VER(2,4) |
771 | 464 typedef struct _SHQUERYRBINFO |
465 { | |
466 DWORD cbSize; | |
467 __int64 i64Size; | |
468 __int64 i64NumItems; | |
469 } SHQUERYRBINFO, *LPSHQUERYRBINFO; | |
1683 | 470 #endif |
771 | 471 |
472 typedef LPCDLGTEMPLATE LPCDLGTEMPLATEW; | |
473 typedef LPCDLGTEMPLATE LPCDLGTEMPLATEA; | |
474 | |
1685 | 475 #else /* !CYGWIN_HEADERS */ |
476 #define W32API_VER(major,minor) 0 | |
477 #define W32API_INSTALLED_VER 0 | |
771 | 478 #endif /* CYGWIN_HEADERS */ |
479 | |
480 /* Not in VC 6 */ | |
481 #ifndef BIF_NEWDIALOGSTYLE | |
482 #define BIF_NEWDIALOGSTYLE 64 | |
483 #endif | |
442 | 484 |
4538 | 485 #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_COMBINED < 190) |
442 | 486 |
487 /* All but wcscmp and wcslen left out of Cygwin headers -- but present | |
771 | 488 in /usr/include/mingw/string.h! */ |
442 | 489 wchar_t* wcscat (wchar_t*, const wchar_t*); |
490 wchar_t* wcschr (const wchar_t*, wchar_t); | |
491 int wcscoll (const wchar_t*, const wchar_t*); | |
492 wchar_t* wcscpy (wchar_t*, const wchar_t*); | |
771 | 493 wchar_t* wcsdup (const wchar_t*); |
442 | 494 size_t wcscspn (const wchar_t*, const wchar_t*); |
495 /* Note: No wcserror in CRTDLL. */ | |
496 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t); | |
771 | 497 int wcsncmp (const wchar_t*, const wchar_t*, size_t); |
498 wchar_t* wcsncpy (wchar_t*, const wchar_t*, size_t); | |
499 wchar_t* wcspbrk (const wchar_t*, const wchar_t*); | |
500 wchar_t* wcsrchr (const wchar_t*, wchar_t); | |
501 size_t wcsspn (const wchar_t*, const wchar_t*); | |
502 wchar_t* wcsstr (const wchar_t*, const wchar_t*); | |
503 wchar_t* wcstok (wchar_t*, const wchar_t*); | |
504 size_t wcsxfrm (wchar_t*, const wchar_t*, size_t); | |
442 | 505 |
506 #endif /* CYGWIN */ | |
507 | |
771 | 508 /* ------------------------- Unicode encapsulation ------------------------- */ |
509 | |
2367 | 510 /* See intl-win32.c for more information about Unicode-encapsulation */ |
771 | 511 |
800 | 512 #define ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
513 | |
771 | 514 #include "intl-auto-encap-win32.h" |
515 | |
516 /* would be encapsulatable but for parsing problems */ | |
800 | 517 |
518 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
519 #undef DefWindowProc | |
520 #define DefWindowProc error use qxeDefWindowProc or DefWindowProcA/DefWindowProcW | |
521 #endif | |
771 | 522 LRESULT qxeDefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); |
800 | 523 |
524 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
525 #undef CallWindowProc | |
526 #define CallWindowProc error use qxeCallWindowProc or CallWindowProcA/CallWindowProcW | |
527 #endif | |
771 | 528 LRESULT qxeCallWindowProc (WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, |
529 WPARAM wParam, LPARAM lParam); | |
800 | 530 |
531 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
532 #undef DefDlgProc | |
533 #define DefDlgProc error use qxeDefDlgProc or DefDlgProcA/DefDlgProcW | |
534 #endif | |
771 | 535 LRESULT qxeDefDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam); |
800 | 536 |
537 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
538 #undef SetWindowsHook | |
539 #define SetWindowsHook error use qxeSetWindowsHook or SetWindowsHookA/SetWindowsHookW | |
540 #endif | |
771 | 541 HHOOK qxeSetWindowsHook (int nFilterType, HOOKPROC pfnFilterProc); |
800 | 542 |
543 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
544 #undef DefMDIChildProc | |
545 #define DefMDIChildProc error use qxeDefMDIChildProc or DefMDIChildProcA/DefMDIChildProcW | |
546 #endif | |
771 | 547 LRESULT qxeDefMDIChildProc (HWND hWnd, UINT uMsg, WPARAM wParam, |
548 LPARAM lParam); | |
549 | |
800 | 550 #undef GetEnvironmentStrings |
551 #undef GetEnvironmentStringsA | |
552 #define GetEnvironmentStringsA GetEnvironmentStrings | |
553 Extbyte * qxeGetEnvironmentStrings (void); | |
554 | |
771 | 555 /* would be encapsulatable but for Cygwin problems */ |
800 | 556 |
557 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
1111 | 558 #undef DdeCreateStringHandle |
559 #define DdeCreateStringHandle error use qxeDdeCreateStringHandle or DdeCreateStringHandleA/DdeCreateStringHandleW | |
560 #endif | |
561 HSZ qxeDdeCreateStringHandle (DWORD idInst, const Extbyte * psz, int iCodePage); | |
562 | |
563 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
800 | 564 #undef RegConnectRegistry |
565 #define RegConnectRegistry error use qxeRegConnectRegistry or RegConnectRegistryA/RegConnectRegistryW | |
566 #endif | |
771 | 567 LONG qxeRegConnectRegistry (const Extbyte * lpMachineName, HKEY hKey, PHKEY phkResult); |
800 | 568 |
569 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
570 #undef ExtractIconEx | |
571 #define ExtractIconEx error use qxeExtractIconEx or ExtractIconExA/ExtractIconExW | |
572 #endif | |
771 | 573 UINT qxeExtractIconEx (const Extbyte * lpszFile, int nIconIndex, HICON FAR * phiconLarge, HICON FAR * phiconSmall, UINT nIcons); |
800 | 574 |
575 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
576 #undef GetICMProfile | |
577 #define GetICMProfile error use qxeGetICMProfile or GetICMProfileA/GetICMProfileW | |
578 #endif | |
771 | 579 BOOL qxeGetICMProfile (HDC arg1, LPDWORD arg2, Extbyte * arg3); |
800 | 580 |
581 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
582 #undef UpdateICMRegKey | |
583 #define UpdateICMRegKey error use qxeUpdateICMRegKey or UpdateICMRegKeyA/UpdateICMRegKeyW | |
584 #endif | |
771 | 585 BOOL qxeUpdateICMRegKey (DWORD arg1, Extbyte * arg2, Extbyte * arg3, UINT arg4); |
586 | |
2500 | 587 /* would be encapsulatable but for header changes in different versions of VC++ */ |
588 | |
589 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
590 #undef EnumResourceTypes | |
591 #define EnumResourceTypes error_use_qxeEnumResourceTypes_or_EnumResourceTypesA_and_EnumResourceTypesW | |
592 #endif | |
593 #if MSC_VERSION >= 1300 | |
594 BOOL qxeEnumResourceTypes (HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG lParam); | |
595 #else | |
596 BOOL qxeEnumResourceTypes (HMODULE hModule, ENUMRESTYPEPROC lpEnumFunc, LONG lParam); | |
597 #endif | |
598 | |
599 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
600 #undef EnumResourceNames | |
601 #define EnumResourceNames error_use_qxeEnumResourceNames_or_EnumResourceNamesA_and_EnumResourceNamesW | |
602 #endif | |
603 #if MSC_VERSION >= 1300 | |
604 BOOL qxeEnumResourceNames (HMODULE hModule, const Extbyte * lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG lParam); | |
605 #else | |
606 BOOL qxeEnumResourceNames (HMODULE hModule, const Extbyte * lpType, ENUMRESNAMEPROC lpEnumFunc, LONG lParam); | |
607 #endif | |
608 | |
609 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
610 #undef EnumResourceLanguages | |
611 #define EnumResourceLanguages error_use_qxeEnumResourceLanguages_or_EnumResourceLanguagesA_and_EnumResourceLanguagesW | |
612 #endif | |
613 #if MSC_VERSION >= 1300 | |
614 BOOL qxeEnumResourceLanguages (HMODULE hModule, const Extbyte * lpType, const Extbyte * lpName, ENUMRESLANGPROCW lpEnumFunc, LONG lParam); | |
615 #else | |
616 BOOL qxeEnumResourceLanguages (HMODULE hModule, const Extbyte * lpType, const Extbyte * lpName, ENUMRESLANGPROC lpEnumFunc, LONG lParam); | |
617 #endif | |
618 | |
771 | 619 /* files */ |
800 | 620 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
621 #undef FindFirstFile | |
622 #define FindFirstFile error use qxeFindFirstFile or FindFirstFileA/FindFirstFileW | |
623 #endif | |
771 | 624 HANDLE qxeFindFirstFile (const Extbyte *lpFileName, |
625 WIN32_FIND_DATAW *lpFindFileData); | |
800 | 626 |
627 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
628 #undef FindNextFile | |
629 #define FindNextFile error use qxeFindNextFile or FindNextFileA/FindNextFileW | |
630 #endif | |
771 | 631 BOOL qxeFindNextFile (HANDLE hFindFile, WIN32_FIND_DATAW *lpFindFileData); |
632 | |
633 /* shell */ | |
800 | 634 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
635 #undef SHGetFileInfo | |
636 #define SHGetFileInfo error use qxeSHGetFileInfo or SHGetFileInfoA/SHGetFileInfoW | |
637 #endif | |
771 | 638 DWORD qxeSHGetFileInfo (const Extbyte *pszPath, DWORD dwFileAttributes, |
639 SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags); | |
800 | 640 |
641 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
642 #undef SHBrowseForFolder | |
643 #define SHBrowseForFolder error use qxeSHBrowseForFolder or SHBrowseForFolderA/SHBrowseForFolderW | |
644 #endif | |
771 | 645 LPITEMIDLIST qxeSHBrowseForFolder (LPBROWSEINFOW lpbi); |
800 | 646 |
647 /* Not Unicode-split */ | |
771 | 648 VOID qxeSHAddToRecentDocs (UINT uFlags, LPCVOID pv); |
800 | 649 |
650 /* Not Unicode-split */ | |
771 | 651 VOID qxeSHChangeNotify (LONG wEventId, UINT uFlags, LPCVOID dwItem1, |
652 LPCVOID dwItem2); | |
800 | 653 |
654 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
655 #undef SHGetDataFromIDList | |
656 #define SHGetDataFromIDList error use qxeSHGetDataFromIDList or SHGetDataFromIDListA/SHGetDataFromIDListW | |
657 #endif | |
771 | 658 HRESULT qxeSHGetDataFromIDList (IShellFolder *psf, LPCITEMIDLIST pidl, |
659 int nFormat, PVOID pv, int cb); | |
660 | |
661 /* devmode */ | |
800 | 662 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
663 #undef CreateDC | |
664 #define CreateDC error use qxeCreateDC or CreateDCA/CreateDCW | |
665 #endif | |
771 | 666 HDC qxeCreateDC (const Extbyte *lpszDriver, const Extbyte *lpszDevice, |
667 const Extbyte *lpszOutput, CONST DEVMODEW *lpInitData); | |
800 | 668 |
669 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
670 #undef ResetDC | |
671 #define ResetDC error use qxeResetDC or ResetDCA/ResetDCW | |
672 #endif | |
771 | 673 HDC qxeResetDC (HDC hdc, CONST DEVMODEW *lpInitData); |
800 | 674 |
675 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
676 #undef OpenPrinter | |
677 #define OpenPrinter error use qxeOpenPrinter or OpenPrinterA/OpenPrinterW | |
678 #endif | |
771 | 679 DWORD qxeOpenPrinter (Extbyte *pPrinterName, LPHANDLE phPrinter, |
680 LPPRINTER_DEFAULTSW pDefaultconst); | |
800 | 681 |
682 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
683 #undef DocumentProperties | |
684 #define DocumentProperties error use qxeDocumentProperties or DocumentPropertiesA/DocumentPropertiesW | |
685 #endif | |
771 | 686 LONG qxeDocumentProperties (HWND hWnd, HANDLE hPrinter, Extbyte *pDeviceName, |
687 DEVMODEW *pDevModeOutput, DEVMODEW *pDevModeInput, | |
688 DWORD fMode); | |
800 | 689 |
690 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
691 #undef PrintDlg | |
692 #define PrintDlg error use qxePrintDlg or PrintDlgA/PrintDlgW | |
693 #endif | |
771 | 694 BOOL qxePrintDlg (PRINTDLGW *lppd); |
800 | 695 |
696 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
697 #undef PageSetupDlg | |
698 #define PageSetupDlg error use qxePageSetupDlg or PageSetupDlgA/PageSetupDlgW | |
699 #endif | |
771 | 700 BOOL qxePageSetupDlg (PAGESETUPDLGW *lppd); |
701 | |
702 /* fonts */ | |
800 | 703 |
704 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
705 #undef EnumFontFamiliesEx | |
706 #define EnumFontFamiliesEx error use qxeEnumFontFamiliesEx or EnumFontFamiliesExA/EnumFontFamiliesExW | |
707 #endif | |
771 | 708 int qxeEnumFontFamiliesEx (HDC hdc, LOGFONTW *lpLogfont, |
709 FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam, | |
710 DWORD dwFlags); | |
800 | 711 |
712 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
713 #undef CreateFontIndirect | |
714 #define CreateFontIndirect error use qxeCreateFontIndirect or CreateFontIndirectA/CreateFontIndirectW | |
715 #endif | |
771 | 716 HFONT qxeCreateFontIndirect (CONST LOGFONTW *lplf); |
800 | 717 |
2500 | 718 #if defined (HAVE_MS_WINDOWS) |
800 | 719 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
720 #undef ImmSetCompositionFont | |
721 #define ImmSetCompositionFont error use qxeImmSetCompositionFont or ImmSetCompositionFontA/ImmSetCompositionFontW | |
722 #endif | |
771 | 723 BOOL qxeImmSetCompositionFont (HIMC imc, LOGFONTW *lplf); |
2500 | 724 #endif /* defined (HAVE_MS_WINDOWS) */ |
800 | 725 |
2500 | 726 #if defined (HAVE_MS_WINDOWS) |
800 | 727 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED |
728 #undef ImmGetCompositionFont | |
729 #define ImmGetCompositionFont error use qxeImmGetCompositionFont or ImmGetCompositionFontA/ImmGetCompositionFontW | |
730 #endif | |
771 | 731 BOOL qxeImmGetCompositionFont (HIMC imc, LOGFONTW *lplf); |
2500 | 732 #endif /* defined (HAVE_MS_WINDOWS) */ |
733 | |
734 #if defined (HAVE_MS_WINDOWS) | |
735 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
736 #undef ImmSetCompositionString | |
737 #define ImmSetCompositionString error_use_qxeImmSetCompositionString_or_ImmSetCompositionStringA_and_ImmSetCompositionStringW | |
738 #endif | |
739 #if MSC_VERSION >= 1300 | |
740 BOOL qxeImmSetCompositionString (HIMC arg1, DWORD dwIndex, LPVOID lpComp, DWORD arg4, LPCVOID lpRead, DWORD arg6); | |
741 #else | |
742 BOOL qxeImmSetCompositionString (HIMC arg1, DWORD dwIndex, LPCVOID lpComp, DWORD arg4, LPCVOID lpRead, DWORD arg6); | |
743 #endif | |
744 #endif /* defined (HAVE_MS_WINDOWS) */ | |
800 | 745 |
746 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
747 #undef GetObject | |
748 #define GetObject error use qxeGetObject or GetObjectA/GetObjectW | |
749 #endif | |
771 | 750 int qxeGetObject (HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject); |
800 | 751 |
752 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
753 #undef GetTextMetrics | |
754 #define GetTextMetrics error use qxeGetTextMetrics or GetTextMetricsA/GetTextMetricsW | |
755 #endif | |
771 | 756 BOOL qxeGetTextMetrics (HDC hdc, LPTEXTMETRICW lptm); |
757 | |
758 /* COMMCTRL.H */ | |
800 | 759 |
760 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
761 #undef SendMessage | |
762 #define SendMessage error use qxeSendMessage or SendMessageA/SendMessageW | |
763 #endif | |
771 | 764 LRESULT qxeSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); |
765 | |
766 /* windows */ | |
800 | 767 |
768 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
769 #undef RegisterClass | |
770 #define RegisterClass error use qxeRegisterClass or RegisterClassA/RegisterClassW | |
771 #endif | |
771 | 772 ATOM qxeRegisterClass (CONST WNDCLASSW * lpWndClass); |
800 | 773 |
774 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
775 #undef UnregisterClass | |
776 #define UnregisterClass error use qxeUnregisterClass or UnregisterClassA/UnregisterClassW | |
777 #endif | |
771 | 778 BOOL qxeUnregisterClass (const Extbyte * lpClassName, HINSTANCE hInstance); |
800 | 779 |
780 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
781 #undef RegisterClassEx | |
782 #define RegisterClassEx error use qxeRegisterClassEx or RegisterClassExA/RegisterClassExW | |
783 #endif | |
771 | 784 ATOM qxeRegisterClassEx (CONST WNDCLASSEXW * arg1); |
800 | 785 |
786 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED | |
787 #undef CreateWindow | |
788 #define CreateWindow error use qxeCreateWindow or CreateWindowA/CreateWindowW | |
789 #endif | |
771 | 790 #define qxeCreateWindow(lpClassName, lpWindowName, dwStyle, x, y, \ |
791 nWidth, nHeight, hWndParent, hMenu, hInstance, \ | |
792 lpParam) \ | |
793 qxeCreateWindowEx (0L, lpClassName, lpWindowName, dwStyle, x, y, \ | |
794 nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) | |
795 | |
796 /* ------------------------- Unicode conversion ------------------------- */ | |
797 | |
798 /* Set early in command-line processing, when -nuni or | |
799 --no-unicode-lib-calls is seen. */ | |
800 extern int no_mswin_unicode_lib_calls; | |
2367 | 801 /* Set early, in init_win32_very_very_early(). */ |
771 | 802 extern int mswindows_windows9x_p; |
803 #define XEUNICODE_P (!mswindows_windows9x_p && !no_mswin_unicode_lib_calls) | |
804 | |
805 #define XELPTSTR LPWSTR | |
806 #define XELPCTSTR LPCWSTR | |
442 | 807 |
808 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR)) | |
809 #define MAX_XETCHAR_SIZE sizeof (WCHAR) | |
810 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg)) | |
811 /* We need to do this indirection in case ARG is also a manifest constant. | |
812 I don't really understand why. --ben */ | |
813 #define XETEXT(arg) XETEXT1(arg) | |
814 #define XECOPY_TCHAR(ptr, ch) \ | |
815 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch))) | |
2421 | 816 #define qxetcslen(arg) \ |
771 | 817 (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg)) |
2421 | 818 #define qxetcsbytelen(arg) \ |
771 | 819 (XEUNICODE_P ? wcslen ((wchar_t *) arg) * XETCHAR_SIZE : strlen (arg)) |
2421 | 820 #define qxetcscmp(s1, s2) \ |
442 | 821 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \ |
822 : strcmp (s1, s2)) | |
2421 | 823 #define qxetcscpy(s1, s2) \ |
442 | 824 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \ |
825 : strcpy (s1, s2)) | |
2421 | 826 #define qxetcsncpy(s1, s2, n) \ |
771 | 827 (XEUNICODE_P ? (char *) wcsncpy ((wchar_t *) s1, (wchar_t *) s2, n) \ |
828 : strncpy (s1, s2, n)) | |
2421 | 829 #define qxetcschr(s, ch) \ |
442 | 830 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \ |
831 : strchr (s, ch)) | |
2421 | 832 #define qxetcsrchr(s, ch) \ |
442 | 833 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \ |
834 : strrchr (s, ch)) | |
2421 | 835 #define qxetcsdup(s) \ |
771 | 836 (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \ |
837 : xstrdup (s)) | |
442 | 838 |
771 | 839 #define C_STRING_TO_TSTR(in, out) \ |
840 C_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr) | |
841 #define LISP_STRING_TO_TSTR(in, out) \ | |
842 LISP_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr) | |
843 #define TSTR_TO_C_STRING(in, out) \ | |
844 EXTERNAL_TO_C_STRING (in, out, Qmswindows_tstr) | |
845 #define TSTR_TO_C_STRING_MALLOC(in, out) \ | |
846 EXTERNAL_TO_C_STRING_MALLOC (in, out, Qmswindows_tstr) | |
847 | |
848 #define build_tstr_string(in) \ | |
2421 | 849 make_ext_string (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr) |
771 | 850 |
851 #define MAX_ANSI_CHAR_LEN 1 | |
852 #define MAX_UNICODE_CHAR_LEN 2 | |
853 | |
854 DECLARE_INLINE_HEADER (int ansi_char_to_text (int ch, Extbyte *t)) | |
855 { | |
856 ch &= 0xFF; | |
857 t[0] = ch; | |
858 return 1; | |
859 } | |
860 | |
861 DECLARE_INLINE_HEADER (int unicode_char_to_text (int ch, Extbyte *t)) | |
862 { | |
863 t[0] = ch & 0xFF; | |
864 t[1] = (ch >> 8) & 0xFF; | |
865 return 2; | |
866 } | |
442 | 867 |
771 | 868 Extbyte *convert_multibyte_to_unicode_malloc (const Extbyte *src, |
869 Bytecount n, | |
870 int cp, Bytecount *size_out); | |
2367 | 871 Extbyte *convert_unicode_to_multibyte_malloc (const Extbyte *src, |
872 Bytecount n, | |
873 int cp, Bytecount *size_out); | |
867 | 874 Ibyte *convert_multibyte_to_internal_malloc (const Extbyte *src, |
771 | 875 Bytecount n, |
876 int cp, Bytecount *size_out); | |
877 void convert_multibyte_to_unicode_dynarr (const Extbyte *src, Bytecount n, | |
878 int cp, unsigned_char_dynarr *dst); | |
2367 | 879 void convert_unicode_to_multibyte_dynarr (const Extbyte *src, Bytecount n, |
880 int cp, unsigned_char_dynarr *dst); | |
881 | |
882 Bytecount unicode_multibyte_convert_size (const char *srctext, const void *src, | |
883 Bytecount src_size, int to_unicode, | |
884 int cp); | |
885 void *unicode_multibyte_convert_copy_data (const char *srctext, | |
886 void *alloca_data); | |
887 | |
888 /* NOTE: If you make two invocations of the following functions in the same | |
889 subexpression and use the exact same expression for the source in both | |
890 cases, you will lose. In this unlikely case, you may get an abort, and | |
891 need to rewrite the code. | |
892 | |
893 We need to use ALLOCA_FUNCALL_OK here, see NEW_DFC in text.h. | |
894 */ | |
895 | |
896 #ifdef WEXTTEXT_IS_WIDE | |
897 #define MULTIBYTE_TO_WEXTTEXT(str) \ | |
898 ((Wexttext *) \ | |
899 unicode_multibyte_convert_copy_data \ | |
900 (#str, ALLOCA_FUNCALL_OK (unicode_multibyte_convert_size \ | |
901 (#str, str, strlen (str) + 1, 1, CP_ACP)))) | |
902 | |
903 #define WEXTTEXT_TO_MULTIBYTE(str) \ | |
904 ((Extbyte *) \ | |
905 unicode_multibyte_convert_copy_data \ | |
906 (#str, ALLOCA_FUNCALL_OK (unicode_multibyte_convert_size \ | |
907 (#str, str, \ | |
908 (wcslen (str) + 1) * sizeof (WCHAR), 0, \ | |
909 CP_ACP)))) | |
910 #else | |
911 #define MULTIBYTE_TO_WEXTTEXT(str) ((Wexttext *) (str)) | |
912 #define WEXTTEXT_TO_MULTIBYTE(str) ((Extbyte *) (str)) | |
913 #endif | |
914 | |
915 /* #### mbstowcs() uses MB_ERR_INVALID_CHARS in addition to MB_PRECOMPOSED. | |
916 Should we do this? But then we have to handle errors. | |
917 #### Do we already check for invalid sequences in the coding system? */ | |
918 #define MBTOWC_OPTIONS MB_PRECOMPOSED /* | MB_ERR_INVALID_CHARS */ | |
919 /* The following options are what wcstombs() uses in the CRT. It uses | |
920 NULL in place of "~". */ | |
921 #define WCTOMB_OPTIONS WC_COMPOSITECHECK | WC_SEPCHARS | |
922 #define WCTOMB_INVALID_STRING "~" | |
771 | 923 |
924 /* ------------------------- Other Mule stuff ------------------------- */ | |
925 | |
926 LCID mswindows_current_locale (void); | |
927 int mswindows_locale_to_code_page (LCID lcid); | |
928 int mswindows_locale_to_oem_code_page (LCID lcid); | |
929 | |
930 /* ------------------------- Filename conversion ------------------------- */ | |
931 | |
932 #ifdef CYGWIN | |
1743 | 933 |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
934 /* We should just remove the Windows 9x support */ |
1743 | 935 |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
936 #define CCP_POSIX_TO_WIN_T \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
937 (XEUNICODE_P ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
938 #define CCP_WIN_T_TO_POSIX \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
939 (XEUNICODE_P ? CCP_WIN_W_TO_POSIX : CCP_WIN_A_TO_POSIX) |
1743 | 940 |
771 | 941 #endif |
942 | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
943 #ifdef HAVE_CYGWIN_CONV_PATH |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
944 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
945 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
946 const Ibyte *lfftt = (path); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
947 if (isalpha (lfftt[0]) && (IS_DEVICE_SEP (lfftt[1]))) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
948 PATHNAME_CONVERT_OUT_TSTR (lfftt, out); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
949 else \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
950 { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
951 int lfftt_size; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
952 Extbyte *lfftt_utf8_path; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
953 Extbyte *lfftt_tstr_path; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
954 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
955 PATHNAME_CONVERT_OUT_UTF_8 (lfftt, lfftt_utf8_path); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
956 lfftt_size = cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
957 lfftt_utf8_path, NULL, 0); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
958 lfftt_tstr_path = alloca_extbytes (lfftt_size); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
959 cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
960 lfftt_utf8_path, lfftt_tstr_path, lfftt_size); \ |
4854 | 961 * (const Extbyte **) &(out) = lfftt_tstr_path; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
962 } \ |
442 | 963 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
964 #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
965 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
966 const Extbyte *ttlff = (path); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
967 int ttlff_size; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
968 Extbyte *ttlff_utf8_path; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
969 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
970 ttlff_size = cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
971 ttlff, NULL, 0); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
972 ttlff_utf8_path = alloca_extbytes (ttlff_size); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
973 cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
974 ttlff, ttlff_utf8_path, ttlff_size); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
975 EXTERNAL_TO_C_STRING (ttlff_utf8_path, out, Qutf_8); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
976 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
977 #else /* not HAVE_CYGWIN_CONV_PATH */ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
978 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
979 do { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
980 const Ibyte *lfftt; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
981 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
982 LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN (path, lfftt); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
983 PATHNAME_CONVERT_OUT_TSTR (lfftt, out); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
984 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
985 #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
986 do { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
987 const Ibyte *ttlff; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
988 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
989 TSTR_TO_C_STRING (path, ttlff); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
990 INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, out); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
991 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
992 #endif /* (not) HAVE_CYGWIN_CONV_PATH */ |
442 | 993 |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
994 #define LISP_LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
995 LOCAL_FILE_FORMAT_TO_TSTR (XSTRING_DATA (path), out) |
826 | 996 /* Convert from local file format, as used in XEmacs, to valid win32 |
997 filenames as can be given to Windows API routines. Under native XEmacs, | |
998 this is a no-op, but under Cygwin, the local names look different -- | |
999 Cygwin mount points, forward slashes, etc. Currently, under Cygwin, we | |
1000 actually allow local names to be of both formats, i.e. Cygwin or Win32 | |
1001 native. So we check to see if we have Win32 native already (a cheesy | |
1002 check, look for letter plus colon at beginning of name) and do nothing | |
1003 in that case. */ | |
1004 | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1005 #ifdef HAVE_CYGWIN_CONV_PATH |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1006 /* When Cygwin uses UTF-8, we can't just manipulate internal-format data |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1007 with its routines because it will mangle the high bytes, so we need to |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1008 convert to UTF-8 first, then to Win32 TSTR format (i.e. UTF-16, on |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1009 Windows NT), then back to internal format. Routines that want external |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1010 format should avoid this by using LISP_LOCAL_FILE_FORMAT_TO_TSTR(). |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1011 Same thing applies going the other direction. */ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1012 #define LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1013 do \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1014 { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
1015 const Extbyte *lfftiwp; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1016 \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1017 LOCAL_FILE_FORMAT_TO_TSTR (path, lfftiwp); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1018 TSTR_TO_C_STRING (lfftiwp, pathout); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1019 } \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1020 while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1021 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1022 do { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
1023 const Extbyte *iwtlffp; \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1024 C_STRING_TO_TSTR (path, iwtlffp); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1025 TSTR_TO_LOCAL_FILE_FORMAT (iwtlffp, pathout); \ |
442 | 1026 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1027 #elif defined (CYGWIN) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1028 #define LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1029 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1030 /* NOTE: It is a bit evil that here and below we are passing \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1031 internal-format data to a function that (nominally) should work \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1032 with external-format data. But in point of fact, the Cygwin \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1033 conversion functions are *NOT* localized, and will fail if they \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1034 get 7-bit ISO2022-encoded data. We know that our internal format \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1035 is ASCII-compatible, and so these functions will work fine with \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1036 this data. */ \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
1037 const Ibyte *lfftiwp = (path); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1038 if (isalpha (lfftiwp[0]) && (IS_DEVICE_SEP (lfftiwp[1]))) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1039 pathout = lfftiwp; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1040 else \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1041 { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1042 int lfftiw2 = \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1043 cygwin_posix_to_win32_path_list_buf_size ((char *) lfftiwp); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1044 pathout = alloca_ibytes (lfftiw2); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1045 cygwin_posix_to_win32_path_list ((char *) lfftiwp, (char *) pathout); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1046 } \ |
442 | 1047 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1048 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ |
593 | 1049 do { \ |
4867
7822019c5d98
Revert cast in check_writable() and fix up macros to use const.
Vin Shelton <acs@xemacs.org>
parents:
4858
diff
changeset
|
1050 const Ibyte *wtlff1 = (path); \ |
593 | 1051 int wtlff2 = \ |
1052 cygwin_win32_to_posix_path_list_buf_size ((char *) wtlff1); \ | |
2367 | 1053 Ibyte *wtlff3 = alloca_ibytes (wtlff2); \ |
593 | 1054 cygwin_win32_to_posix_path_list ((char *) wtlff1, (char *) wtlff3); \ |
771 | 1055 (pathout) = wtlff3; \ |
442 | 1056 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1057 #else /* not defined (CYGWIN) */ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1058 #define LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1059 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1060 (pathout) = (path); \ |
442 | 1061 } while (0) |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1062 #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1063 do { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1064 (pathout) = (path); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1065 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1066 #endif /* (not) defined (CYGWIN) */ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1067 |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1068 Lisp_Object tstr_to_local_file_format (Extbyte *pathout); |
442 | 1069 |
826 | 1070 /* Convert a local-format file name or URL in internal format into a Win32 |
1071 file name or URL in tstr format. */ | |
1072 | |
1073 #ifdef CYGWIN | |
1074 | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1075 #define LISP_LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \ |
2526 | 1076 do \ |
1077 { \ | |
1078 Ibyte *lffmutt_fname1; \ | |
1079 Ibyte *lffmutt_pathint = XSTRING_DATA (lispstr); \ | |
1080 \ | |
1081 if ((lffmutt_fname1 = qxestrchr (lffmutt_pathint, ':')) != NULL \ | |
1082 && *++lffmutt_fname1 == '/' && *++lffmutt_fname1 == '/') \ | |
1083 { \ | |
1084 /* If URL style file, the innards may have Cygwin mount points and \ | |
1085 the like. so separate out the innards, process them, and put back \ | |
1086 together. */ \ | |
1087 if (qxestrncasecmp_ascii (lffmutt_pathint, "file://", 7) == 0) \ | |
1088 { \ | |
1089 Ibyte *lffmutt_path1, *lffmutt_path2; \ | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1090 LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN (lffmutt_pathint + 7, \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1091 lffmutt_path1); \ |
2526 | 1092 if (lffmutt_path1 == lffmutt_pathint + 7) /* Optimization */ \ |
1093 lffmutt_path2 = lffmutt_pathint; \ | |
1094 else \ | |
1095 { \ | |
867 | 1096 lffmutt_path2 = alloca_ibytes (7 + qxestrlen (lffmutt_path1) \ |
2526 | 1097 + 1); \ |
1098 qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \ | |
1099 qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \ | |
1100 } \ | |
1101 C_STRING_TO_TSTR (lffmutt_path2, pathout); \ | |
1102 } \ | |
1103 else \ | |
1104 /* A straight URL, just convert */ \ | |
1105 LISP_STRING_TO_TSTR (lispstr, pathout); \ | |
1106 } \ | |
1107 else \ | |
1108 /* Not URL-style, must be a straight filename. */ \ | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1109 LISP_LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout); \ |
826 | 1110 } while (0) |
1111 | |
1112 #else /* not CYGWIN */ | |
1113 | |
1114 /* URL's (and everything else) are already in the right format */ | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1115 #define LISP_LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4827
diff
changeset
|
1116 LISP_LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout) |
826 | 1117 |
1118 #endif /* not CYGWIN */ | |
1119 | |
1120 | |
867 | 1121 Ibyte *urlify_filename (Ibyte *filename); |
1122 Ibyte *mswindows_canonicalize_filename (Ibyte *name); | |
771 | 1123 #define MSWINDOWS_NORMALIZE_FILENAME(name) \ |
867 | 1124 IBYTE_STRING_TO_ALLOCA (mswindows_canonicalize_filename (name), name) |
771 | 1125 |
1126 /* ------------------- Functions needed dynamic binding ------------------- */ | |
1127 | |
1128 typedef BOOL (WINAPI *pfSwitchToThread_t) (VOID); | |
1129 | |
1130 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetUserEnum_t) | |
1131 (LPCWSTR, DWORD, DWORD, LPBYTE *, DWORD, LPDWORD, LPDWORD, LPDWORD); | |
1132 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetApiBufferFree_t) (LPVOID); | |
1133 | |
1134 extern pfSwitchToThread_t xSwitchToThread; | |
1135 | |
1136 extern pfNetUserEnum_t xNetUserEnum; | |
1137 extern pfNetApiBufferFree_t xNetApiBufferFree; | |
1138 | |
1139 /* --------- Useful routines for manipulating memory-mapped files -------- */ | |
1140 | |
1141 typedef struct file_data | |
1142 { | |
867 | 1143 const Ibyte *name; |
771 | 1144 unsigned long size; |
1145 HANDLE file; | |
1146 HANDLE file_mapping; | |
1147 void *file_base; | |
1148 } file_data; | |
1149 | |
1150 #define OFFSET_TO_RVA(var,section) \ | |
1151 (section->VirtualAddress + \ | |
1152 ((DWORD)(var) - section->PointerToRawData)) | |
1153 | |
1154 #define RVA_TO_OFFSET(var,section) \ | |
1155 (section->PointerToRawData + \ | |
1156 ((DWORD)(var) - section->VirtualAddress)) | |
442 | 1157 |
771 | 1158 #define RVA_TO_PTR(var,section,filedata) \ |
1159 ((void *)(RVA_TO_OFFSET(var,section) + \ | |
1160 (char *)(filedata).file_base)) | |
1161 | |
867 | 1162 int open_input_file (file_data *p_file, const Ibyte *name); |
1163 int open_output_file (file_data *p_file, const Ibyte *name, | |
771 | 1164 unsigned long size); |
1165 void close_file_data (file_data *p_file); | |
1166 | |
1167 /* ------------------------- Heap related stuff ------------------------- */ | |
1168 | |
1169 #ifdef WIN32_NATIVE | |
442 | 1170 |
771 | 1171 #define get_reserved_heap_size() reserved_heap_size |
1172 #define get_committed_heap_size() (get_data_end () - get_data_start ()) | |
1173 #define get_heap_start() get_data_start () | |
1174 #define get_heap_end() get_data_end () | |
1175 #define get_page_size() sysinfo_cache.dwPageSize | |
1176 #define get_allocation_unit() sysinfo_cache.dwAllocationGranularity | |
1177 #define get_processor_type() sysinfo_cache.dwProcessorType | |
1178 #define get_nt_major_version() nt_major_version | |
1179 #define get_nt_minor_version() nt_minor_version | |
1180 | |
814 | 1181 unsigned char *get_data_start (void); |
1182 unsigned char *get_data_end (void); | |
771 | 1183 extern unsigned long data_region_size; |
1184 extern unsigned long reserved_heap_size; | |
1185 extern SYSTEM_INFO sysinfo_cache; | |
1186 extern int nt_major_version; | |
1187 extern int nt_minor_version; | |
1188 | |
1189 /* To prevent zero-initialized variables from being placed into the bss | |
1190 section, use non-zero values to represent an uninitialized state. */ | |
1191 #define UNINIT_PTR ((unsigned char*) 0xF0A0F0A0) | |
1192 #define UNINIT_LONG (0xF0A0F0A0L) | |
1193 | |
1194 /* Recreate the heap created during dumping. */ | |
814 | 1195 void recreate_heap (Extbyte *executable_path); |
771 | 1196 |
1197 /* Round the heap to this size. */ | |
814 | 1198 void round_heap (unsigned long size); |
771 | 1199 |
1200 /* Load in the dumped .bss section. */ | |
814 | 1201 void read_in_bss (Extbyte *name); |
771 | 1202 |
1203 /* Map in the dumped heap. */ | |
814 | 1204 void map_in_heap (Extbyte *name); |
771 | 1205 |
1206 /* Cache system info, e.g., the NT page size. */ | |
814 | 1207 void cache_system_info (void); |
771 | 1208 |
1209 /* Round ADDRESS up to be aligned with ALIGN. */ | |
814 | 1210 unsigned char *round_to_next (unsigned char *address, |
1211 unsigned long align); | |
771 | 1212 #endif /* WIN32_NATIVE */ |
1213 | |
1214 /* ------------------------- Misc prototypes ------------------------- */ | |
1215 | |
1216 #ifdef WIN32_NATIVE | |
1217 DECLARE_INLINE_HEADER (int strcasecmp (const char *a, const char *b)) | |
1218 { | |
867 | 1219 return qxestrcasecmp ((const Ibyte *) a, (const Ibyte *) b); |
771 | 1220 } |
1221 #endif /* WIN32_NATIVE */ | |
442 | 1222 |
771 | 1223 /* in nt.c */ |
867 | 1224 int mswindows_access (const Ibyte *path, int mode); |
3025 | 1225 int mswindows_link (const Ibyte *old, const Ibyte *new_); |
867 | 1226 int mswindows_rename (const Ibyte *oldname, const Ibyte *newname); |
1227 int mswindows_unlink (const Ibyte *path); | |
1228 int mswindows_stat (const Ibyte *path, struct stat *buf); | |
771 | 1229 int mswindows_fstat (int desc, struct stat *buf); |
1230 time_t mswindows_convert_time (FILETIME ft); | |
1204 | 1231 int mswindows_is_executable (const Ibyte *filename); |
1232 void mswindows_executable_type (const Ibyte *filename, int *is_dos_app, | |
1233 int *is_cygnus_app); | |
867 | 1234 Ibyte *mswindows_getdcwd (int drivelet); |
771 | 1235 |
872 | 1236 /* in process-nt.c */ |
771 | 1237 extern int mswindows_compare_env (const void *strp1, const void *strp2); |
1238 | |
1239 /* in win32.c */ | |
814 | 1240 Extbyte *mswindows_get_module_file_name (void); |
4932 | 1241 void mswindows_output_last_error (const Ascbyte *frob); |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1242 DECLARE_DOESNT_RETURN (mswindows_report_process_error (const Ascbyte *reason, |
771 | 1243 Lisp_Object data, |
1244 int errnum)); | |
1245 Lisp_Object mswindows_lisp_error (int errnum); | |
2526 | 1246 Ibyte *mswindows_read_link (const Ibyte *fname); |
771 | 1247 |
872 | 1248 /* in intl-win32.c */ |
1249 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode; | |
1250 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode; | |
1251 | |
442 | 1252 #endif /* INCLUDED_syswindows_h_ */ |