Mercurial > vim
annotate src/osdef.sh @ 26578:06693d1afc48
patch 8.2.3818: cannot filter or map characters in a string
Commit: https://github.com/vim/vim/commit/c479ce032f5d4d14bab9e479acbf42d758879893
Author: rbtnn <naru123456789@gmail.com>
Date: Wed Dec 15 19:14:54 2021 +0000
patch 8.2.3818: cannot filter or map characters in a string
Problem: Cannot filter or map characters in a string.
Solution: Make filter() and map() work on a string. (Naruhiko Nishino,
closes #9327)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 15 Dec 2021 20:15:03 +0100 |
parents | befdf44737d1 |
children |
rev | line source |
---|---|
7 | 1 #! /bin/sh |
2 # | |
3 # osdef.sh -- copy osdef.h.in to osdef.h while removing declarations | |
4 # found in the system header files. Caution: weird sed magic going on here. | |
5 # Warnings are printed if sed did not survive. | |
6 # | |
7 # (C) Michael Schroeder, Juergen Weigert | |
8 # | |
9 # osdef.h.in has been split into osdef1.h.in and osdef2.h.in, because some | |
10 # sed's could not handle the amount of commands (is 50 commands the limit?). | |
11 # | |
12 # 31.10.95 jw. | |
13 | |
14 if test -z "$CC"; then | |
15 CC=cc | |
16 fi | |
17 if test -z "$srcdir"; then | |
18 srcdir=. | |
19 fi | |
20 | |
19235
befdf44737d1
patch 8.2.0176: generating os headers does not work for Swedish
Bram Moolenaar <Bram@vim.org>
parents:
7722
diff
changeset
|
21 # Make sure collation works as expected |
befdf44737d1
patch 8.2.0176: generating os headers does not work for Swedish
Bram Moolenaar <Bram@vim.org>
parents:
7722
diff
changeset
|
22 # swedish range [a-z] does not match 'w' |
befdf44737d1
patch 8.2.0176: generating os headers does not work for Swedish
Bram Moolenaar <Bram@vim.org>
parents:
7722
diff
changeset
|
23 export LC_COLLATE=C |
befdf44737d1
patch 8.2.0176: generating os headers does not work for Swedish
Bram Moolenaar <Bram@vim.org>
parents:
7722
diff
changeset
|
24 export LC_ALL= |
befdf44737d1
patch 8.2.0176: generating os headers does not work for Swedish
Bram Moolenaar <Bram@vim.org>
parents:
7722
diff
changeset
|
25 |
7 | 26 rm -f core* *.core |
27 | |
28 cat << EOF > osdef0.c | |
29 #ifndef __APPLE__ | |
30 # define select select_declared_wrong | |
31 #endif | |
32 #define tgetstr tgetstr_declared_wrong | |
33 #include "auto/config.h" | |
34 #include "os_unix.h" /* bring in most header files, more follow below */ | |
35 #include "os_unixx.h" /* bring in header files for os_unix.c */ | |
36 | |
37 #ifdef HAVE_TERMCAP_H | |
38 # include <termcap.h> /* only for term.c */ | |
39 #endif | |
40 | |
41 #ifdef HAVE_FCNTL_H | |
42 # include <fcntl.h> /* only used in a few files */ | |
43 #endif | |
44 | |
45 #ifdef HAVE_SYS_STATFS_H | |
46 # include <sys/types.h> | |
47 # include <sys/statfs.h> /* only for memfile.c */ | |
48 #endif | |
49 | |
50 #ifdef HAVE_X11 | |
51 # include <X11/Intrinsic.h> | |
52 #endif | |
53 EOF | |
54 | |
5436 | 55 $CC -I. -I$srcdir -E osdef0.c >osdef0.cc |
7 | 56 |
57 # insert a space in front of each line, so that a function name at the | |
58 # start of the line is matched with "[)*, ]\1[ (]" | |
59 sed < osdef0.cc -e '/\(..*\)/s// \1/' > osdef0.ccc | |
60 | |
7722
c4f8b1d48f20
commit https://github.com/vim/vim/commit/e240c2da796531e807ea9df78bdbcc7b1012870c
Christian Brabandt <cb@256bit.org>
parents:
5436
diff
changeset
|
61 sed < $srcdir/osdef1.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([a-zA-Z_][a-zA-Z0-9_]*\)(.*@/[)*, ][(]*\1[)]*[ (]/i\\\ |
c4f8b1d48f20
commit https://github.com/vim/vim/commit/e240c2da796531e807ea9df78bdbcc7b1012870c
Christian Brabandt <cb@256bit.org>
parents:
5436
diff
changeset
|
62 \\/\\[^a-zA-Z_\\]\1(\\/d@p' > osdef11.sed |
7 | 63 |
7722
c4f8b1d48f20
commit https://github.com/vim/vim/commit/e240c2da796531e807ea9df78bdbcc7b1012870c
Christian Brabandt <cb@256bit.org>
parents:
5436
diff
changeset
|
64 sed < $srcdir/osdef2.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([a-zA-Z_][a-zA-Z0-9_]*\)(.*@/[)*, ][(]*\1[)]*[ (]/i\\\ |
c4f8b1d48f20
commit https://github.com/vim/vim/commit/e240c2da796531e807ea9df78bdbcc7b1012870c
Christian Brabandt <cb@256bit.org>
parents:
5436
diff
changeset
|
65 \\/\\[^a-zA-Z_\\]\1(\\/d@p' > osdef21.sed |
7 | 66 |
67 cat << EOF > osdef2.sed | |
68 1i\\ | |
69 /* | |
70 1i\\ | |
71 * osdef.h is automagically created from osdef?.h.in by osdef.sh -- DO NOT EDIT | |
72 1i\\ | |
73 */ | |
74 EOF | |
75 | |
76 cat osdef0.ccc | sed -n -f osdef11.sed >> osdef2.sed | |
77 sed -f osdef2.sed < $srcdir/osdef1.h.in > auto/osdef.h | |
78 | |
79 cat osdef0.ccc | sed -n -f osdef21.sed > osdef2.sed | |
80 sed -f osdef2.sed < $srcdir/osdef2.h.in >> auto/osdef.h | |
81 | |
82 rm osdef0.c osdef0.cc osdef0.ccc osdef11.sed osdef21.sed osdef2.sed | |
83 | |
84 if test -f core*; then | |
85 file core* | |
86 echo " Sorry, your sed is broken. Call the system administrator." | |
87 echo " Meanwhile, you may try to compile Vim with an empty osdef.h file." | |
88 echo " If you compiler complains about missing prototypes, move the needed" | |
89 echo " ones from osdef1.h.in and osdef2.h.in to osdef.h." | |
90 exit 1 | |
91 fi | |
92 cat $srcdir/osdef1.h.in $srcdir/osdef2.h.in >osdefX.h.in | |
93 if eval test "`diff auto/osdef.h osdefX.h.in | wc -l`" -eq 4; then | |
94 echo " Hmm, sed is very pessimistic about your system header files." | |
95 echo " But it did not dump core -- strange! Let's continue carefully..." | |
96 echo " If this fails, you may want to remove offending lines from osdef.h" | |
97 echo " or try with an empty osdef.h file, if your compiler can do without" | |
98 echo " function declarations." | |
99 fi | |
100 rm osdefX.h.in |