annotate lib-src/make-mswin-unicode.pl @ 5142:f965e31a35f0

reduce lcrecord headers to 2 words, rename printing_unreadable_object -------------------- ChangeLog entries follow: -------------------- man/ChangeLog addition: 2010-03-13 Ben Wing <ben@xemacs.org> * internals/internals.texi (Working with Lisp Objects): * internals/internals.texi (Writing Macros): * internals/internals.texi (lrecords): More rewriting to correspond with changes from *LRECORD* to *LISP_OBJECT*. modules/ChangeLog addition: 2010-03-13 Ben Wing <ben@xemacs.org> * postgresql/postgresql.c (print_pgconn): * postgresql/postgresql.c (print_pgresult): printing_unreadable_object -> printing_unreadable_object_fmt. 2010-03-13 Ben Wing <ben@xemacs.org> * ldap/eldap.c (print_ldap): printing_unreadable_object -> printing_unreadable_object_fmt. src/ChangeLog addition: 2010-03-13 Ben Wing <ben@xemacs.org> * alloc.c (alloc_sized_lrecord_1): * alloc.c (alloc_sized_lrecord_array): * alloc.c (old_alloc_sized_lcrecord): * alloc.c (disksave_object_finalization_1): * alloc.c (mark_lcrecord_list): * alloc.c (alloc_managed_lcrecord): * alloc.c (free_managed_lcrecord): * alloc.c (tick_lcrecord_stats): * alloc.c (sweep_lcrecords_1): * buffer.c (print_buffer): * buffer.c (DEFVAR_BUFFER_LOCAL_1): * casetab.c: * casetab.c (print_case_table): * console.c (print_console): * console.c (DEFVAR_CONSOLE_LOCAL_1): * data.c (print_weak_list): * data.c (print_weak_box): * data.c (print_ephemeron): * data.c (ephemeron_equal): * database.c (print_database): * database.c (finalize_database): * device-msw.c (sync_printer_with_devmode): * device-msw.c (print_devmode): * device-msw.c (finalize_devmode): * device.c: * device.c (print_device): * elhash.c: * elhash.c (print_hash_table): * eval.c (print_subr): * eval.c (print_multiple_value): * event-stream.c (event_stream_resignal_wakeup): * events.c (clear_event_resource): * events.c (zero_event): * events.c (print_event): * extents.c: * extents.c (print_extent): * file-coding.c (print_coding_system): * font-mgr.c: * font-mgr.c (Ffc_init): * frame.c: * frame.c (print_frame): * gc.c: * gc.c (GC_CHECK_NOT_FREE): * glyphs.c: * glyphs.c (print_image_instance): * glyphs.c (print_glyph): * gui.c (print_gui_item): * gui.c (copy_gui_item): * keymap.c (print_keymap): * keymap.c (MARKED_SLOT): * lisp.h: * lisp.h (struct Lisp_String): * lisp.h (DEFUN): * lisp.h (DEFUN_NORETURN): * lrecord.h: * lrecord.h (NORMAL_LISP_OBJECT_UID): * lrecord.h (struct lrecord_header): * lrecord.h (set_lheader_implementation): * lrecord.h (struct old_lcrecord_header): * lrecord.h (struct free_lcrecord_header): * marker.c (print_marker): * mule-charset.c: * mule-charset.c (print_charset): * objects.c (print_color_instance): * objects.c (print_font_instance): * objects.c (finalize_font_instance): * print.c (print_cons): * print.c (printing_unreadable_object_fmt): * print.c (printing_unreadable_lisp_object): * print.c (external_object_printer): * print.c (internal_object_printer): * print.c (debug_p4): * print.c (ext_print_begin): * process.c (print_process): * rangetab.c (print_range_table): * rangetab.c (range_table_equal): * scrollbar.c (free_scrollbar_instance): * specifier.c (print_specifier): * specifier.c (finalize_specifier): * symbols.c (guts_of_unbound_marker): * symeval.h: * symeval.h (DEFVAR_SYMVAL_FWD): * tooltalk.c: * tooltalk.c (print_tooltalk_message): * tooltalk.c (print_tooltalk_pattern): * ui-gtk.c (ffi_object_printer): * ui-gtk.c (emacs_gtk_object_printer): * ui-gtk.c (emacs_gtk_boxed_printer): * window.c (print_window): * window.c (free_window_mirror): * window.c (debug_print_window): * xemacs.def.in.in: (1) printing_unreadable_object -> printing_unreadable_object_fmt. (2) printing_unreadable_lcrecord -> printing_unreadable_lisp_object and fix up so it no longer requires an lcrecord. These previous changes eliminate most of the remaining places where the terms `lcrecord' and `lrecord' occurred outside of specialized code. (3) Fairly major change: Reduce the number of words in an lcrecord from 3 to 2. The third word consisted of a uid that duplicated the lrecord uid, and a single free bit, which was moved into the lrecord structure. This reduces the size of the `uid' slot from 21 bits to 20 bits. Arguably this isn't enough -- we could easily have more than 1,000,000 or so objects created in a session. The answer is (a) It doesn't really matter if we overflow the uid field because it's only used for debugging, to identify an object uniquely (or pretty much so). (b) If we cared about it overflowing and wanted to reduce this, we could make it so that cons, string, float and certain other frob-block types that never print out the uid simply don't store a uid in them and don't increment the lrecord_uid_counter. (4) In conjunction with (3), create new macro NORMAL_LISP_OBJECT_UID() and use it to abstract out the differences between NEWGC and old-GC in accessing the `uid' value from a "normal Lisp Object pointer". (5) In events.c, use zero_nonsized_lisp_object() in place of custom- written equivalent. In font-mgr.c use external_object_printer() in place of custom-written equivalents.
author Ben Wing <ben@xemacs.org>
date Sat, 13 Mar 2010 05:38:08 -0600
parents 7eec2a1f3412
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
1 : #-*- Perl -*-
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
2
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
3 ### make-mswin-unicode --- generate Unicode-encapsulation code for MS Windows
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
4
4875
49de55c09f18 add "review" lines in intl-encap-win32.c for all unseen functions in processed headers
Ben Wing <ben@xemacs.org>
parents: 4873
diff changeset
5 ## Copyright (C) 2001, 2002, 2004, 2010 Ben Wing.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
6
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
7 ## Author: Ben Wing <ben@xemacs.org>
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
8 ## Maintainer: Ben Wing <ben@xemacs.org>
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
9 ## Current Version: 1.0, August 24, 2001
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
10
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
11 ## This file is part of XEmacs.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
12
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
13 ## XEmacs is free software; you can redistribute it and/or modify it
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
14 ## under the terms of the GNU General Public License as published by
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
15 ## the Free Software Foundation; either version 2, or (at your option)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
16 ## any later version.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
17
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
18 ## XEmacs is distributed in the hope that it will be useful, but
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
19 ## WITHOUT ANY WARRANTY; without even the implied warranty of
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
20 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
21 ## General Public License for more details.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
22
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
23 ## You should have received a copy of the GNU General Public License
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
24 ## along with XEmacs; see the file COPYING. If not, write to the Free
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
25 ## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
26 ## 02111-1307, USA.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
27
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
28 eval 'exec perl -w -S $0 ${1+"$@"}'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
29 if 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
30
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
31 use strict;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
32 use File::Basename;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
33 use Getopt::Long;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
34
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
35 my ($myName, $myPath) = fileparse ($0);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
36
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
37 my $usage="
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
38 Usage: $myName [--c-output FILE] [--h-output FILE] [--help] [FILES ...]
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
39
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
40 The purpose of this script is to auto-generate Unicode-encapsulation
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
41 code for MS Windows library functions that come in two versions (ANSI
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
42 and Unicode). The MS Windows header files provide a way of
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
43 automatically calling the right version, but only at compile-time,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
44 which is *NOT* sufficient for any real-world program. The solution is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
45 run-time Unicode encapsulation, which is not conceptually difficult
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
46 but is time-consuming, and is not supported standardly only due to
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
47 evil marketing decisions made by Microsoft. See src/intl-win32.c
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
48 for more information.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
49
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
50 In XEmacs, this file is normally run using `nmake -f xemacs.mak
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
51 unicode-encapsulate'.
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
52
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
53 This script processes the specified files, looking for commands
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
54 indicating library routines to Unicode-encapsulate, as follows:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
55
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
56 Portions of the files that should be processed are enclosed in lines
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
57 consisting only of the words \"begin-unicode-encapsulation-script\"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
58 and \"end-unicode-encapsulation-script\". More than one section can
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
59 occur in a single file. Processed lines begin with a command word,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
60 followed by one or more args (no quotes are necessary for spaces):
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
61
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
62 file specifies a file to start reading from.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
63 yes indicates a function to be automatically Unicode-encapsulated.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
64 (All parameters either need no special processing or are LPTSTR or
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
65 LPCTSTR.)
4911
7eec2a1f3412 Fix Visual Studio 6 build
Vin Shelton <acs@xemacs.org>
parents: 4903
diff changeset
66 override indidates a function where the prototype can be overridden
7eec2a1f3412 Fix Visual Studio 6 build
Vin Shelton <acs@xemacs.org>
parents: 4903
diff changeset
67 due to errors in Cygwin or Visual Studio.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
68 soon indicates a function that should be automatically Unicode-encapsulated,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
69 but we're not ready to process it yet.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
70 no indicates a function we don't support (it will be #defined to cause
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
71 a compile error, with the text after the function included in the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
72 erroneous definition to indicate why we don't support it).
4875
49de55c09f18 add "review" lines in intl-encap-win32.c for all unseen functions in processed headers
Ben Wing <ben@xemacs.org>
parents: 4873
diff changeset
73 review indicates a function that we still need to review to determine whether
49de55c09f18 add "review" lines in intl-encap-win32.c for all unseen functions in processed headers
Ben Wing <ben@xemacs.org>
parents: 4873
diff changeset
74 or how to support it. This has the same effect as `no', with a comment
49de55c09f18 add "review" lines in intl-encap-win32.c for all unseen functions in processed headers
Ben Wing <ben@xemacs.org>
parents: 4873
diff changeset
75 indicating that the function needs review.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
76 skip indicates a function we support manually; only a comment about this
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
77 will be generated.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
78 split indicates a function with a split structure (different versions
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
79 for Unicode and ANSI), but where the only difference is in pointer
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
80 types, and the actual size does not differ. The structure name
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
81 should follow the function name, and it will be automatically
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
82 Unicode-encapsulated with appropriate casts.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
83 begin-bracket indicates a #if statement to be inserted here.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
84 end-bracket indicates the corresponding #endif statement.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
85 blank lines and lines beginning with // are ignored.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
86 ";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
87
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
88 # ------------------ process command-line options ------------------
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
89
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
90 my %options;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
91 my @SAVE_ARGV = @ARGV;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
92
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
93 $Getopt::Long::ignorecase = 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
94 &GetOptions (
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
95 \%options,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
96 'c-output=s',
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
97 'h-output=s',
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
98 'includedir=s',
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
99 'help',
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
100 );
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
101
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
102 die $usage if $options{"help"};
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
103
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
104 my $in_script;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
105 my $slurp;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
106
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
107 my ($cout, $hout, $dir) = ($options{"c-output"},
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
108 $options{"h-output"},
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
109 $options{"includedir"});
4873
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
110
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
111 $dir = '/usr/include/w32api' if !$dir && -f '/usr/include/w32api/windows.h';
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
112
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
113 if (!$dir)
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
114 {
4467
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
115 for my $sdkroot (("WindowsSdkDir", "MSSdk", "MSVCDIR"))
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
116 {
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
117 if (defined $ENV{$sdkroot}) {
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
118 $dir = $ENV{$sdkroot};
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
119 last;
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
120 }
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
121 }
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
122 unless (defined $dir)
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
123 {
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
124 die "Can't find the Windows SDK headers; run vcvars32.bat from your MSVC installation, or setenv.cmd from the Platform SDK installation";
23ef20edf6ba Check %WindowsSdkDir%, %MSSddk% for the Windows header files too.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3728
diff changeset
125 }
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
126 }
4873
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
127 $dir.='/include' if ((-f $dir.'/include/WINDOWS.H') ||
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
128 (-f $dir.'/include/windows.h'));
3728
6765f2581182 [xemacs-hg @ 2006-12-08 02:21:53 by vins]
vins
parents: 2367
diff changeset
129 die "Can't find MSVC include files in \"$dir\"" unless ((-f $dir.'/WINDOWS.H') || (-f $dir.'/windows.h'));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
130
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
131 open (COUT, ">$cout") or die "Can't open C output file $cout: $!";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
132 open (HOUT, ">$hout") or die "Can't open C output file $hout: $!";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
133
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
134 select (STDOUT); $| = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
135
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
136 print COUT "/* Automatically-generated Unicode-encapsulation file,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
137 using the command
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
138
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
139 $myPath$myName @SAVE_ARGV
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
140
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
141 Do not edit. See `$myName'.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
142 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
143
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
144 #include <config.h>
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
145 #include \"lisp.h\"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
146
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
147 #include \"syswindows.h\"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
148
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
149 ";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
150 print HOUT "/* Automatically-generated Unicode-encapsulation header file.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
151 Do not edit. See `$myName'.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
152 */\n\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
153
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
154 my %files;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
155 my %processed;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
156 my %bracket;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
157
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
158 my $current_file;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
159 my @current_bracket;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
160
4903
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
161 my ($ws_re, $must_ws_re, $tok_ch) =
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
162 ("\\s*", "\\s+", "\\w");
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
163 # unfortunately there is no surefire way short of
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
164 # parsing all include files for typedefs to
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
165 # distinguish types from parameters, and prototypes
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
166 # appear in the include files both with and without
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
167 # parameters -- the latter kinds appear in a very
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
168 # different style and were obviously added later. so
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
169 # we rely on the fact that defined types are all
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
170 # upper-case, and parameters generally are not, and
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
171 # special-case the exceptions.
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
172 my $typeword_re =
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
173 # note the negative lookahead assertions: the first
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
174 # one excludes the words "X" and "Y" from type
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
175 # words, since they appear as parameter names in
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
176 # CreateWindowEx; the second prevents "void
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
177 # *Argument" from being parsed as a type "void *A"
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
178 # followed by a parameter "rgument".
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
179 "(?:(?!(?:X\\b|Y\\b))(?:unsigned|int|long|const|short|va_list|[A-Z_0-9]+)(?!${tok_ch}))";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
180 my $typetoken_re = "(?:$typeword_re$ws_re\\**$ws_re)";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
181 # Regexp matching a particular argument
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
182 my $arg_re = "(?:(?:$typetoken_re+)(?:${tok_ch}+)?(?: OPTIONAL)?)";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
183 # Same, but with groups to match the type and name
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
184 my $argmatch_re = "(?:($typetoken_re+)(${tok_ch}+)?(?: OPTIONAL)?)";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
185 # regexp matching a parenthesized argument list in a prototype
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
186 my $args_re = "\\(((?:${ws_re}${arg_re}${ws_re},)*${ws_re}${arg_re}${ws_re})\\)";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
187 # regexp matching a return type in a protype
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
188 my $rettype_re = "(SHSTDAPI_\\(${tok_ch}+\\)|${tok_ch}" . "[A-Za-z_0-9 \t\n\r\f]*?${tok_ch})";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
189 # regexp matching a function name
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
190 my $funname_re = "(${tok_ch}+)";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
191 # Regexp matching a function prototype, $1 = rettype, $2 = name, $3 = args
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
192 my $fun_re = "${rettype_re}${ws_re}${funname_re}${ws_re}${args_re};";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
193 # Regexp matching a particular Unicode function (ending in ...W)
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
194 my $wfun_re = "${rettype_re}${ws_re}${funname_re}W${ws_re}${args_re};";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
195
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
196 # print "regexp: $wfun_re\n";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
197
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
198 while (<>)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
199 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
200 chomp;
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
201 # remove trailing CR. #### Should not be necessary! Perl should be
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
202 # opening these in text mode by default, as the docs claim, and
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
203 # automatically remove the CR's.
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
204 tr/\r//d;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
205
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
206 if (/^begin-unicode-encapsulation-script$/)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
207 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
208 $in_script = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
209 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
210 elsif (/^end-unicode-encapsulation-script$/)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
211 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
212 $in_script = 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
213 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
214 elsif ($in_script)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
215 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
216 next if (m!^//!);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
217 next if (/^[ \t]*$/);
4903
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
218 if (/(file|yes|soon|no|review|skip|split|begin-bracket|end-bracket|override)(?: (.*))?/)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
219 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
220 my ($command, $parms) = ($1, $2);
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
221 if ($command eq "file")
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
222 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
223 $current_file = $parms;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
224 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
225 elsif ($command eq "begin-bracket")
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
226 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
227 my $current_bracket = $current_bracket[$#current_bracket];
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
228 if (defined ($current_bracket))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
229 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
230 $current_bracket .= "&& $parms";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
231 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
232 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
233 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
234 $current_bracket = "$parms";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
235 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
236 push @current_bracket, $current_bracket;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
237 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
238 elsif ($command eq "end-bracket")
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
239 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
240 pop @current_bracket;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
241 }
4903
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
242 elsif ($command eq "override")
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
243 {
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
244 die "Cannot parse prototype $parms" unless $parms =~ /$wfun_re(?: ?(.*))?/;
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
245 my ($rettype, $fun, $args, $reason) = ($1, $2, $3, $4);
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
246 $files{$current_file}{$fun} =
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
247 [$command, $reason, $rettype, $fun, $args];
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
248 $bracket{$current_file}{$fun} =
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
249 $current_bracket[$#current_bracket];
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
250 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
251 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
252 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
253 my ($fun, $reason) = split /\s+/, $parms, 2;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
254 $files{$current_file}{$fun} = [$command, $reason];
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
255 $bracket{$current_file}{$fun} =
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
256 $current_bracket[$#current_bracket];
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
257 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
258 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
259 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
260 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
261 print "WARNING: Unknown line $_\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
262 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
263 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
264 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
265
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
266
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
267 foreach my $file (keys %files)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
268 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
269 $slurp = &FileContents ($file);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
270 print "Processing file $file\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
271 print HOUT "\n/* Processing file $file */\n\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
272 my $totalspace = 70 - length ("Processing file $file");
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
273 $totalspace = 0 if $totalspace < 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
274 my $alignspaceleft = $totalspace / 2;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
275 my $alignspaceright = ($totalspace + 1) / 2;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
276 print COUT "
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
277 /*----------------------------------------------------------------------*/
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
278 /*" . (" " x $alignspaceleft) . "Processing file $file" .
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
279 (" " x $alignspaceright) . "*/
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
280 /*----------------------------------------------------------------------*/
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
281
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
282 ";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
283
4903
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
284 while ($slurp =~ /$wfun_re/g)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
285 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
286 my ($rettype, $fun, $args) = ($1, $2, $3);
4873
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
287
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
288 if ($processed{$fun})
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
289 {
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
290 print "Warning: Function $fun already seen\n";
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
291 next;
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
292 }
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
293
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
294 $processed{$fun} = 1;
4873
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
295
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
296 print "Processing: $fun";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
297
4903
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
298 #my ($command, $reason) = ($files{$file}{$fun}[0], $files{$file}{$fun}[1]);
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
299 # Fuck perl! There seems to be no way to write something like
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
300 # my ($command, $reason) = @$files{$file}{$fun};
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
301 # You have to use a temporary var.
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
302 my $filesarr = $files{$file}{$fun};
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
303 my ($command, $reason) = @$filesarr;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
304 if (!defined ($command))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
305 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
306 print " (no command found)\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
307 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
308 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
309 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
310 print "\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
311 my $bracket = $bracket{$file}{$fun};
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
312 if (defined ($bracket))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
313 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
314 print HOUT "#if $bracket\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
315 print COUT "#if $bracket\n\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
316 }
4875
49de55c09f18 add "review" lines in intl-encap-win32.c for all unseen functions in processed headers
Ben Wing <ben@xemacs.org>
parents: 4873
diff changeset
317 if ($command eq "no" || $command eq "review")
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
318 {
4875
49de55c09f18 add "review" lines in intl-encap-win32.c for all unseen functions in processed headers
Ben Wing <ben@xemacs.org>
parents: 4873
diff changeset
319 $reason = "Function needs review to determine how to handle it"
49de55c09f18 add "review" lines in intl-encap-win32.c for all unseen functions in processed headers
Ben Wing <ben@xemacs.org>
parents: 4873
diff changeset
320 if !defined ($reason) && $command eq "review";
49de55c09f18 add "review" lines in intl-encap-win32.c for all unseen functions in processed headers
Ben Wing <ben@xemacs.org>
parents: 4873
diff changeset
321
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
322 if (!defined ($reason))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
323 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
324 print "WARNING: No reason given for `no' with function $fun\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
325 $reason = "";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
326 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
327
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
328 print HOUT "#undef $fun\n";
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 800
diff changeset
329 (my $munged_reason = $reason) =~ s/[^A-Za-z0-9]/_/g;
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 800
diff changeset
330 print HOUT "#define $fun error_$munged_reason\n";
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
331 print COUT "/* Error if $fun used: $reason */\n\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
332 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
333 elsif ($command eq "skip")
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
334 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
335 if (!defined ($reason))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
336 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
337 print "WARNING: No reason given for `skip' with function $fun\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
338 $reason = "";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
339 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
340
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
341 print HOUT "/* Skipping $fun because $reason */\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
342 print COUT "/* Skipping $fun because $reason */\n\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
343 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
344 elsif ($command eq "soon")
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
345 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
346 $reason = "" if !defined ($reason);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
347
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
348 print HOUT "/* Not yet: $fun $reason */\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
349 print COUT "/* Not yet: $fun $reason */\n\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
350 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
351 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
352 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
353 my (@args, %argtype, %ansiarg, %xarg, $split_struct,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
354 $split_rettype);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
355 if ($command eq "split")
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
356 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
357 ($split_struct, $reason) = split /\s+/, $reason, 2;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
358 }
4903
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
359 elsif ($command eq "override")
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
360 {
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
361 my ($nrettype, $nfun, $nargs) = @$filesarr[2 .. 4];
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
362 $reason = "$reason.\n NOTE: " if $reason;
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
363 $reason = "${reason}Prototype manually overridden.
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
364 Header file claims:
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
365 $rettype $fun($args)
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
366 Overridden with:
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
367 $nrettype $nfun($nargs)
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
368 Differences in return-type qualifiers, e.g. WINAPI, are not important.
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
369 ";
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
370 ($rettype, $fun, $args) = ($nrettype, $nfun, $nargs);
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
371 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
372 my $argno = 0;
4903
70089046adef fix compile problems in intl-encap* under VS6
Ben Wing <ben@xemacs.org>
parents: 4875
diff changeset
373 while ($args =~ /$argmatch_re/g)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
374 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
375 $argno++;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
376 my ($argtype, $argname) = ($1, $2);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
377 $argtype =~ s/\s*$//;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
378 next if $argtype eq "void" || $argtype eq "VOID";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
379 $argname = "arg$argno" if !defined ($argname);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
380 $argtype{$argname} = $argtype;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
381 $ansiarg{$argname} = $argtype;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
382 $ansiarg{$argname} =~ s/\bLPWSTR\b/LPSTR/;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
383 $ansiarg{$argname} =~ s/\bLPCWSTR\b/LPCSTR/;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
384 $xarg{$argname} = $argtype;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
385 $xarg{$argname} =~ s/\bLPWSTR\b/Extbyte */;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
386 $xarg{$argname} =~ s/\bLPCWSTR\b/const Extbyte */;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
387 if (defined ($split_struct))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
388 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
389 my $fuck_cperl1 = "\\b${split_struct}W\\b";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
390 my $fuck_cperl2 = "${split_struct}A";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
391 $ansiarg{$argname} =~ s/$fuck_cperl1/$fuck_cperl2/;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
392 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
393 push @args, $argname;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
394 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
395 $rettype =~ s/\bSHSTDAPI_\((.*)\)/$1/;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
396 $rettype =~ s/\s*WIN\w*?API\s*//g;
4873
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
397 $rettype =~ s/\bAPIENTRY\b\s*//;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
398 $rettype =~ s/\bSHSTDAPI\b/HRESULT/;
4873
50861fea97f6 regenerate intl-auto-encap-win32.c, now possible from Cygwin /usr/include/w32api headers
Ben Wing <ben@xemacs.org>
parents: 4467
diff changeset
399 $rettype =~ s/\bextern\b\s*//;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
400 if ($rettype =~ /LPC?WSTR/)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
401 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
402 $split_rettype = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
403 $rettype =~ s/\bLPWSTR\b/Extbyte */;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
404 $rettype =~ s/\bLPCWSTR\b/const Extbyte */;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
405 }
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
406 print HOUT "#ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED\n";
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
407 print HOUT "#undef $fun\n";
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 800
diff changeset
408 print HOUT "#define $fun error_use_qxe${fun}_or_${fun}A_and_${fun}W\n";
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
409 print HOUT "#endif\n";
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
410 if (defined ($reason))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
411 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
412 print COUT "/* NOTE: $reason */\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
413 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
414 print COUT "$rettype\nqxe$fun (";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
415 print HOUT "$rettype qxe$fun (";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
416 my $first = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
417 if (!@args)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
418 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
419 print COUT "void";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
420 print HOUT "void";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
421 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
422 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
423 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
424 foreach my $x (@args)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
425 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
426 print COUT ", " if !$first;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
427 print HOUT ", " if !$first;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
428 $first = 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
429 print COUT "$xarg{$x} $x";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
430 print HOUT "$xarg{$x} $x";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
431 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
432 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
433 print HOUT ");\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
434 print COUT ")\n{\n if (XEUNICODE_P)\n ";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
435 if ($rettype ne "void" && $rettype ne "VOID")
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
436 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
437 print COUT "return ";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
438 print COUT "($rettype) " if $split_rettype;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
439 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
440 print COUT "${fun}W (";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
441 $first = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
442 foreach my $x (@args)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
443 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
444 print COUT ", " if !$first;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
445 $first = 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
446 print COUT ($argtype{$x} eq $xarg{$x} ? $x :
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
447 "($argtype{$x}) $x");
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
448 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
449 print COUT ");\n else\n ";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
450 if ($rettype ne "void" && $rettype ne "VOID")
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
451 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
452 print COUT "return ";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
453 print COUT "($rettype) " if $split_rettype;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
454 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
455 print COUT "${fun}A (";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
456 $first = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
457 foreach my $x (@args)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
458 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
459 print COUT ", " if !$first;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
460 $first = 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
461 print COUT ($argtype{$x} eq $ansiarg{$x} ? $x :
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
462 "($ansiarg{$x}) $x");
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
463 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
464 print COUT ");\n}\n\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
465 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
466 if (defined ($bracket))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
467 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
468 print HOUT "#endif /* $bracket */\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
469 print COUT "#endif /* $bracket */\n\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
470 }
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 778
diff changeset
471 print HOUT "\n";
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
472 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
473 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
474 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
475
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
476 foreach my $file (keys %files)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
477 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
478 foreach my $fun (keys %{$files{$file}})
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
479 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
480 if (!$processed{$fun} && $files{$file}{$fun}[0] =~ /^(yes|soon|split)$/)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
481 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
482 print "WARNING: Can't locate prototype for $fun\n";
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
483 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
484 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
485 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
486
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
487
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
488 sub FileContents
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
489 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
490 local $/ = undef;
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 771
diff changeset
491 open (FILE, "< $dir/$_[0]") or die "$dir/$_[0]: $!";
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
492 my $retval = scalar <FILE>;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
493 # must hack away CRLF junk.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
494 $retval =~ s/\r\n/\n/g;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
495 return $retval;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents:
diff changeset
496 }