summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-06-03 21:17:25 +0200
committerBram Moolenaar <Bram@vim.org>2010-06-03 21:17:25 +0200
commit2c704a77c1e3a6eb20e273503bc23a4e2fb4d506 (patch)
treead6f922872dc6dbddf305cd26cd5693565b44386
parent9160441955bc6aae91bc2d3ca415b410bad36403 (diff)
downloadvim-git-2c704a77c1e3a6eb20e273503bc23a4e2fb4d506.tar.gz
Add patch to improve support of z/OS (OS/390). (Ralf Schandl)
-rw-r--r--runtime/doc/os_390.txt305
-rw-r--r--src/INSTALL2
-rwxr-xr-xsrc/auto/configure24
-rw-r--r--src/config.mk.in3
-rw-r--r--src/configure.in28
-rw-r--r--src/eval.c48
-rw-r--r--src/feature.h19
-rw-r--r--src/regexp.c41
8 files changed, 191 insertions, 279 deletions
diff --git a/runtime/doc/os_390.txt b/runtime/doc/os_390.txt
index a0a715549..5a9d36814 100644
--- a/runtime/doc/os_390.txt
+++ b/runtime/doc/os_390.txt
@@ -1,4 +1,4 @@
-*os_390.txt* For Vim version 7.3a. Last change: 2008 Dec 17
+*os_390.txt* For Vim version 7.3a. Last change: 2010 May 30
VIM REFERENCE MANUAL by Ralf Schandl
@@ -6,24 +6,12 @@
*zOS* *z/OS* *OS390* *os390* *MVS*
This file contains the particulars for the z/OS UNIX version of Vim.
-1. Open source on z/OS UNIX |zOS-open-source|
-2. Your feedback is needed |zOS-feedback|
-3. Building VIM for z/OS UNIX |zOS-building|
-4. ASCII/EBCDIC dependent scripts |zOS-has-ebcdic|
-5. XTerm Problems |zOS-xterm|
-6. Motif Problems |zOS-Motif|
-7. Bugs |zOS-Bugs|
-8. Known weaknesses |zOS-weaknesses|
-9. Changes |zOS-changes|
-
-DISCLAIMER: ~
-We are IBM employees, but IBM is not responsible for this port. This is our
-private fun, and is provided in the hopes that it may be useful to others.
-
-Please note that this software has NOT been submitted to any formal IBM
-testing and is published AS IS. Please do not contact IBM for support for this
-software, as it is not an official component of any IBM product. IT IS NOT
-SUPPORTED, GUARANTEED, OR RELATED WHATSOEVER TO IBM.
+1. ASCII/EBCDIC dependent scripts |zOS-has-ebcdic|
+2. Putty and Colors |zOS-Putty|
+3. Motif Problems |zOS-Motif|
+4. Bugs |zOS-Bugs|
+5. Limitations |zOS-limitations|
+6. Open source on z/OS UNIX |zOS-open-source|
Contributors: ~
The port to z/OS UNIX was done by Ralf Schandl for the Redbook mentioned
@@ -32,128 +20,11 @@ below.
Changes, bug-reports, or both by:
David Moore
- Anthony Giorgio <agiorgio@fastmail.fm>
+ Anthony Giorgio
and others
-This document was written by Ralf Schandl and revised by Anthony Giorgio.
-
-==============================================================================
-1. Open source on z/OS UNIX *OS390-open-source* *zOS-open-source*
-
-If you are interested in other Open Source Software on z/OS UNIX, have a
-look at the following Redbook:
-
- Mike MacIsaac et al
- "Open Source Software for z/OS and OS/390 UNIX"
- IBM Form Number: SG24-5944-01
- ISBN: 0738424633
-
-You can find out more information, order a hard copy, or download a PDF
-version of these Redbooks at:
-
- http://www.redbooks.ibm.com
-
-==============================================================================
-2. Your feedback is needed *OS390-feedback* *zOS-feedback*
-
-Vim should compile, link, and run right out of the box on a standard IBM z/OS
-UNIX mainframe. I've personally run it on z/OS V1R2 and V1R3 machines without
-problems.
-
-Many changes had to be done to the code to port Vim to z/OS UNIX. As like
-most UNIX programs, Vim contained heavy ASCII dependencies. I might have
-missed an ASCII dependency, or it is possible that a new one has been added
-with a feature or bug fix. Most programmers are simply not aware of possible
-ASCII/EBCDIC conversion issues. If you hit a problem that seems related to
-this, feel free to contact us at the email addresses above.
-
-One indication of ASCII/EBCDIC conversion problems is screen corruption with
-"unprintable" characters. For example, at one point the errorbell was broken
-in Vim. Any time Vim tried to ring the terminal bell an ASCII character 0x07
-would be printed. This works fine on most terminals, but is broken on an
-EBCDIC one. The correct solution was to define a different value for the bell
-character on EBCDIC systems.
-
-Remember, it's only possible to fix a bug if the community knows about it.
-Don't rely on someone else to report it! See the section |bug-reports|.
-
==============================================================================
-3. Building VIM for z/OS UNIX *OS390-building* *zOS-building*
-
-A word on debugging code first: ~
-
-The normal run of configure adds the flag '-g' to the compiler options,
-to include debugging information into the executable. This information
-are normally removed from the executable with the strip command during
-installation. On z/OS UNIX, it is not possible to remove this from
-the executable. The strip command exists on z/OS UNIX and is called
-during the installation, but it does nothing. It is equivalent to the
-'touch' command. This is due to the way debug symbols are stored in the
-objects generated by the compiler.
-
-If you want to build Vim without debugging code, export the environment
-variable CFLAGS set to an empty string before you call the configure script.
->
- export CFLAGS=""
-
-
-Building without X11: ~
-
-Note: Use cc to build Vim. The c89 compiler has stricter syntax checking
-and will not compile Vim cleanly.
-
-If you build VIM without X11 support, compiling and building is
-straightforward. Don't forget to export _CC_CCMODE=1 before calling
-configure and make.
->
- $ export _CC_CCMODE=1
- $./configure --with-features=big --without-x --enable-gui=no
- $ make
- $ make test
-<
- Test notes:
- Test 11 will fail if you do not have gzip installed.
- Test 42 will fail, as VIM on z/OS UNIX doesn't support the multibyte
- feature. (David Moore: "Doesn't work _yet_! :-) I'll see what I
- can do.")
->
-
- $ make install
-
-
-Building with X11: ~
-
-There are two ways for building Vim with X11 support. You can link it
-statically with the X11 libraries or can bind it with the X11 DLLs. The
-statically linked version results in a huge executable (~13MB), while the
-dynamically linked executable is much smaller (~4.5MB).
-
-Here is what you do, if you want Motif:
-
- a) Static link >
- $ configure --with-features=big --enable-gui=motif
- $ make
-<
- VIM is now linked statically with the X11 libraries.
-
- b) Dynamic link:
- Make VIM as described for the static link. Then change the contents of
- the 'auto/link.sed' file by appending: >
- s%-lXm *%/usr/lib/Xm.x %g
- s%-lX11 *%/usr/lib/X11.x %g
- s%-lSM *%/usr/lib/SM.x %g
- s%-lICE *%/usr/lib/ICE.x %g
-<
- Then do: >
- $ rm vim
- $ make
-<
- Now Vim is linked with the X11-DLLs.
-
-See the Makefile and the file link.sh on how link.sed is used.
-
-==============================================================================
-4. ASCII/EBCDIC dependent scripts *OS390-has-ebcdic* *zOS-has-ebcdic*
+1. ASCII/EBCDIC dependent scripts *OS390-has-ebcdic* *zOS-has-ebcdic*
For the internal script language the feature "ebcdic" was added. With this
you can fix ASCII dependent scripts like this:
@@ -164,24 +35,28 @@ you can fix ASCII dependent scripts like this:
let space = 32
endif
<
+
==============================================================================
-5. XTerm problems *OS390-xterm* *zOS-xterm*
+2. PuTTY and Colors *OS390-PuTTY* *zOS-PuTTY*
-Note: This problem was resolved in version 6.1b. ~
+If you see problems with syntax highlighting or screen corruptions when you
+connect to z/OS using Putty, try the following:
-I saw one problem with XTerm on z/OS UNIX. The terminal code for moving the
-cursor to the left is wrong in the termlib database. Perhaps not wrong, but
-it didn't work with VIM syntax highlighting and command line cursor movement.
+- Configure Putty as "vt220" terminal (Connection->Data)
+- Add the following 3 lines to your vimrc:
-If the highlighting is messed up while you type, but is okay after you refreshed
-the screen with <C-L> or if you can't move to the left with the cursor key on
-the command line, try adding >
- :set t_le=^H
+>
+ set t_AB=[4%p1%dm
+ set t_AF=[3%p1%dm
+ set t_CO=8
<
-to your .vimrc. Note: '^H' is one character, hit <C-V><C-H> to get it.
+
+Note:  is one character use <C-V><Esc> to enter it.
==============================================================================
-6. Motif Problems *OS390-Motif* *zOS-Motif*
+3. Motif Problems *OS390-Motif* *zOS-Motif*
+
+Note: Seen with Vim 6.*, never tested since.
It seems that in porting the Motif library to z/OS, a translation from EBCDIC
to ASCII for the accelerator characters of the pull-down menus was forgotten.
@@ -193,14 +68,14 @@ the file browser).
There is no solution for this yet.
==============================================================================
-7. Bugs *OS390-bugs* *zOS-Bugs*
+4. Bugs *OS390-bugs* *zOS-Bugs*
- Vim will consistently hang when a large amount of text is selected in
visual block mode. This may be due to a memory corruption issue. Note that
this occurs in both the terminal and gui versions.
==============================================================================
-8. Known weaknesses *OS390-weaknesses* *zOS-weaknesses*
+5. Limitations *OS390-limitations* *zOS-limitations*
- No binary search in tag files.
The program /bin/sort sorts by ASCII value by default. This program is
@@ -208,9 +83,6 @@ There is no solution for this yet.
ctags out there, that does it right, but we can't be sure. So this seems to
be a permanent restriction.
-- Multibyte support (utf-8) doesn't work, it's disabled at compile time.
- (|multibyte|)
-
- The cscope interface (|cscope|) doesn't work for the version of cscope
that we use on our mainframe. We have a copy of version 15.0b12, and it
causes Vim to hang when using the "cscope add" command. I'm guessing that
@@ -221,6 +93,13 @@ There is no solution for this yet.
- No glib/gtk support. I have not been able to successfully compile glib on
z/OS UNIX. This means you'll have to live without the pretty gtk toolbar.
+
+Disabled at compile time:
+ - Multibyte support (|multibyte|)
+ - Right-to-left mode (|rileft|)
+ - Farsi key map (|Farsi|)
+ - Arabic language support (|Arabic|)
+ - Spell checking (|spell|)
Never tested:
- Perl interface (|perl|)
@@ -233,108 +112,24 @@ Never tested:
- TCL interface (|tcl|)
...
-If you try any of these features and they work, drop us a note!
-
==============================================================================
-9. Changes *OS390-changes* *zOS-changes*
-
-This is a small reference of the changes made to the z/OS port of Vim. It is
-not an exhaustive summary of all the modifications made to the code base.
-
-6.1b (beta):
- Changed KS_LE in term.c to be "\b" instead of "\010" This fixed the
- screen corruption problems in gVim reported by Anthony Giorgio.
-
- Anthony Giorgio updated this document:
- - Changed OS/390 to z/OS where appropriate. IBM decided to rename
- all of its servers and operating systems. z/OS and OS/390
- are the same product, but the version numbering system was
- reset for the name change (e.g. OS/390 V2R11 == z/OS V1R1).
- - Added information about second edition of the Open Source Redbook.
- - Moved Redbook information to a separate section.
- - Various tweaks and changes.
- - Updated testing section.
-
-6.0au:
- Changed configure.in
- Changed documentation.
- Anthony Giorgio fixed the errorbell.
-
- David Moore found some problems, which were fixed by Bram and/or David for
- 6.0au.
-
-6.0q (alpha):
- Minor changes for nrformats=alpha (see |'nrformats'|).
- Problem with hard-coded keycode for the English pound sign. Added a define in
- ascii.h
- Disabled multibyte for EBCDIC in feature.h
-
-6.0f (alpha):
- First compile of Vim 6 on z/OS UNIX. Some minor changes were needed.
-
- Finally found the reason why make from the top level didn't work (I must have
- been blind before!). The Makefile contained a list of targets in one target
- line. On all other UNIX's the macro $@ evaluates to the first target in this
- list, only on z/OS UNIX it evaluates to the last one :-(.
-
-5.6-390d:
- Cleaned up some hacks.
-
-5.6-390c:
- I grepped through the source and examined every spot with a character
- involved in an operation (+-). I hope I now found all EBCDIC/ASCII
- stuff, but ....
-
- Fixed:
- - fixed warning message in do_fixdel()
- - fixed translation from Ctrl-Char to symbolic name (like ^h to CTRL-H)
- for :help
- - fixed yank/delete/... into register
- - fixed :register command
- - fixed viminfo register storing
- - fixed quick-access table in findoptions()
- - fixed 'g^H' select mode
- - fixed tgetstr() 'get terminal capability string', ESC and
- Ctrl chars where wrong. (Not used on OS/390 UNIX)
-
-
- ctags:
- - added trigraphs support (used in prolog of system header files)
- (get.c)
- - fixed sorting order with LC_COLLATE=S390 to force EBCDIC sorting.
- (sort.c)
-
-5.6-390b:
- Changed:
- - configure.in:
- - added test for OS/390 UNIX
- - added special compiler and linker options if building with X11
- - configure:
- - after created via autoconf hand-edited it to make the test for
- ICEConnectionNumber work. This is an autoconf problem. OS/390 UNIX
- needs -lX11 for this.
- - Makefile
- - Don't include the lib directories ('-L...') into the variable
- ALL_LIBS. Use own variable ALL_LIB_DIRS instead. A fully POSIX
- compliant compiler must not accept objects/libraries and options
- mixed. Now we can call the linker like this:
-
- $(CC) $(LDFLAGS) $(ALL_LIB_DIRS) $(OBJ) $(ALL_LIBS)
-
- Fixed:
- - Double quote couldn't be entered
- Missed ASCII dependencies while setting up terminal
- In ASCII 127 is the delete char, in EBCDIC codepage 1047 the value 127
- is the double quote.
- - fixed ':fixdel'
-
-5.6-390a:
- first alpha release for OS/390 UNIX.
-
- Addition:
- - For the internal script language I added the feature "ebcdic".
- This can be queried with the has()-function of the internal
- script language.
+6. Open source on z/OS UNIX *OS390-open-source* *zOS-open-source*
+
+If you are interested in other Open Source Software on z/OS UNIX, have a
+look at the following Redbook:
+
+ Mike MacIsaac et al
+ "Open Source Software for z/OS and OS/390 UNIX"
+ IBM Form Number: SG24-5944-01
+ ISBN: 0738424633
+ http://www-03.ibm.com/systems/resources/servers_eserver_zseries_zos_unix_redbook_sg245944.pdf
+
+Also look at:
+ http://www.redbooks.ibm.com
+ http://www-03.ibm.com/systems/z/os/zos/features/unix/
+ http://www-03.ibm.com/systems/z/os/zos/features/unix/library/IBM+Redbooks/index.html
+
+
------------------------------------------------------------------------------
vim:tw=78:fo=tcq2:ts=8:ft=help:norl:
diff --git a/src/INSTALL b/src/INSTALL
index a4a992529..82275d452 100644
--- a/src/INSTALL
+++ b/src/INSTALL
@@ -15,7 +15,7 @@ See INSTALLmac.txt for Macintosh
See INSTALLpc.txt for PC (MS-DOS, Windows 95/98/NT/XP)
See INSTALLvms.txt for VMS
See INSTALLx.txt for cross-compiling on Unix
-See ../runtime/doc/os_390.txt for OS/390 Unix
+See ../README_390.txt for OS/390 Unix
See ../runtime/doc/os_beos.txt for BeBox
diff --git a/src/auto/configure b/src/auto/configure
index b87825f4d..baeaebc22 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -669,6 +669,7 @@ vi_cv_path_mzscheme
compiledby
dogvimdiff
dovimdiff
+QUOTESED
line_break
VIEWNAME
EXNAME
@@ -4384,10 +4385,10 @@ esac
if test "$cf_cv_ebcdic" = "yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OS/390 Unix" >&5
-$as_echo_n "checking for OS/390 Unix... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for z/OS Unix" >&5
+$as_echo_n "checking for z/OS Unix... " >&6; }
case `uname` in
- OS/390) OS390Unix="yes";
+ OS/390) zOSUnix="yes";
if test "$CC" = "cc"; then
ccm="$_CC_CCMODE"
ccn="CC"
@@ -4402,7 +4403,7 @@ case `uname` in
if test "$ccm" != "1"; then
echo ""
echo "------------------------------------------"
- echo " On OS/390 Unix, the environment variable"
+ echo " On z/OS Unix, the environment variable"
echo " __CC_${ccn}MODE must be set to \"1\"!"
echo " Do:"
echo " export _CC_${ccn}MODE=1"
@@ -4410,17 +4411,26 @@ case `uname` in
echo "------------------------------------------"
exit 1
fi
- CFLAGS="$CFLAGS -D_ALL_SOURCE"; LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
+ CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
+ LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
;;
- *) OS390Unix="no";
+ *) zOSUnix="no";
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
;;
esac
fi
+if test "$zOSUnix" = "yes"; then
+ QUOTESED="sed -e 's/[\\\\\"]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
+else
+ QUOTESED="sed -e 's/[\\\\\"]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
+fi
+
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-selinux argument" >&5
$as_echo_n "checking --disable-selinux argument... " >&6; }
# Check whether --enable-selinux was given.
@@ -6697,7 +6707,7 @@ fi
fi
- if test "$OS390Unix" = "yes"; then
+ if test "$zOSUnix" = "yes"; then
CFLAGS="$CFLAGS -W c,dll"
LDFLAGS="$LDFLAGS -W l,dll"
X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
diff --git a/src/config.mk.in b/src/config.mk.in
index a950413a6..a298fae2f 100644
--- a/src/config.mk.in
+++ b/src/config.mk.in
@@ -100,6 +100,9 @@ INSTALLGVIMDIFF = @dogvimdiff@
INSTALL_LANGS = @INSTALL_LANGS@
INSTALL_TOOL_LANGS = @INSTALL_TOOL_LANGS@
+### sed command to fix quotes while creating pathdef.c
+QUOTESED = @QUOTESED@
+
### Line break character as octal number for "tr"
NL = @line_break@
diff --git a/src/configure.in b/src/configure.in
index b98af27d1..f44cf0f76 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -275,7 +275,7 @@ AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a
AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
AC_MSG_RESULT(no))
-dnl Check for EBCDIC stolen from the LYNX port to OS390 Unix
+dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
AC_MSG_CHECKING(if character set is EBCDIC)
AC_TRY_COMPILE([ ],
[ /* TryCompile function for CharSet.
@@ -301,10 +301,10 @@ esac
AC_SUBST(line_break)
if test "$cf_cv_ebcdic" = "yes"; then
-dnl If we have EBCDIC we most likley have OS390 Unix, let's test it!
-AC_MSG_CHECKING(for OS/390 Unix)
+dnl If we have EBCDIC we most likley have z/OS Unix, let's test it!
+AC_MSG_CHECKING(for z/OS Unix)
case `uname` in
- OS/390) OS390Unix="yes";
+ OS/390) zOSUnix="yes";
dnl If using cc the environment variable _CC_CCMODE must be
dnl set to "1", so that some compiler extensions are enabled.
dnl If using c89 the environment variable is named _CC_C89MODE.
@@ -323,7 +323,7 @@ case `uname` in
if test "$ccm" != "1"; then
echo ""
echo "------------------------------------------"
- echo " On OS/390 Unix, the environment variable"
+ echo " On z/OS Unix, the environment variable"
echo " __CC_${ccn}MODE must be set to \"1\"!"
echo " Do:"
echo " export _CC_${ccn}MODE=1"
@@ -331,15 +331,25 @@ case `uname` in
echo "------------------------------------------"
exit 1
fi
- CFLAGS="$CFLAGS -D_ALL_SOURCE"; LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
+ CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
+ LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
AC_MSG_RESULT(yes)
;;
- *) OS390Unix="no";
+ *) zOSUnix="no";
AC_MSG_RESULT(no)
;;
esac
fi
+dnl Set QUOTESED. Needs additional backslashes on zOS
+if test "$zOSUnix" = "yes"; then
+ QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
+else
+ QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
+fi
+AC_SUBST(QUOTESED)
+
+
dnl Link with -lselinux for SELinux stuff; if not found
AC_MSG_CHECKING(--disable-selinux argument)
AC_ARG_ENABLE(selinux,
@@ -1166,10 +1176,10 @@ else
AC_PATH_XTRA
- dnl On OS390Unix the X libraries are DLLs. To use them the code must
+ dnl On z/OS Unix the X libraries are DLLs. To use them the code must
dnl be compiled with a special option.
dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
- if test "$OS390Unix" = "yes"; then
+ if test "$zOSUnix" = "yes"; then
CFLAGS="$CFLAGS -W c,dll"
LDFLAGS="$LDFLAGS -W l,dll"
X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
diff --git a/src/eval.c b/src/eval.c
index 865dc3a7d..6ad71d5ae 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -820,6 +820,13 @@ static int searchpair_cmn __ARGS((typval_T *argvars, pos_T *match_pos));
static int search_cmn __ARGS((typval_T *argvars, pos_T *match_pos, int *flagsp));
static void setwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
+
+#ifdef EBCDIC
+static int compare_func_name __ARGS((const void *s1, const void *s2));
+static void sortFunctions __ARGS(());
+#endif
+
+
/* Character used as separated in autoload function/variable names. */
#define AUTOLOAD_CHAR '#'
@@ -856,6 +863,13 @@ eval_init()
hash_add(&compat_hashtab, p->vv_di.di_key);
}
set_vim_var_nr(VV_SEARCHFORWARD, 1L);
+
+#ifdef EBCDIC
+ /*
+ * Sort the function table, to enable binary sort.
+ */
+ sortFunctions();
+#endif
}
#if defined(EXITFREE) || defined(PROTO)
@@ -7901,6 +7915,36 @@ get_expr_name(xp, idx)
#endif /* FEAT_CMDL_COMPL */
+#if defined(EBCDIC) || defined(PROTO)
+/*
+ * Compare struct fst by function name.
+ */
+ static int
+compare_func_name(s1, s2)
+ const void *s1;
+ const void *s2;
+{
+ struct fst *p1 = (struct fst *)s1;
+ struct fst *p2 = (struct fst *)s2;
+
+ return STRCMP(p1->f_name, p2->f_name);
+}
+
+/*
+ * Sort the function table by function name.
+ * The sorting of the table above is ASCII dependant.
+ * On machines using EBCDIC we have to sort it.
+ */
+ static void
+sortFunctions()
+{
+ int funcCnt = (int)(sizeof(functions) / sizeof(struct fst)) - 1;
+
+ qsort(functions, (size_t)funcCnt, sizeof(struct fst), compare_func_name);
+}
+#endif
+
+
/*
* Find internal function in table above.
* Return index, or -1 if not found
@@ -19243,7 +19287,7 @@ new_script_vars(id)
while (ga_scripts.ga_len < id)
{
- sv = SCRIPT_SV(ga_scripts.ga_len + 1) =
+ sv = SCRIPT_SV(ga_scripts.ga_len + 1) =
(scriptvar_T *)alloc_clear(sizeof(scriptvar_T));
init_var_dict(&sv->sv_dict, &sv->sv_var);
++ga_scripts.ga_len;
@@ -22481,7 +22525,7 @@ get_short_pathname(fnamep, bufp, fnamelen)
* append the remaining non-existing path.
*
* fname - Pointer to the filename to shorten. On return, contains the
- * pointer to the shortened pathname
+ * pointer to the shortened pathname
* bufp - Pointer to an allocated buffer for the filename.
* fnamelen - Length of the filename pointed to by fname
*
diff --git a/src/feature.h b/src/feature.h
index e786e282e..4f35280b7 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -300,16 +300,20 @@
/*
* +rightleft Right-to-left editing/typing support.
+ *
+ * Disabled for EBCDIC as it requires multibyte.
*/
-#ifdef FEAT_BIG
+#if defined(FEAT_BIG) && !defined(EBCDIC)
# define FEAT_RIGHTLEFT
#endif
/*
* +farsi Farsi (Persian language) Keymap support.
* Requires FEAT_RIGHTLEFT.
+ *
+ * Disabled for EBCDIC as it requires multibyte.
*/
-#ifdef FEAT_BIG
+#if defined(FEAT_BIG) && !defined(EBCDIC)
# define FEAT_FKMAP
#endif
#ifdef FEAT_FKMAP
@@ -321,6 +325,8 @@
/*
* +arabic Arabic keymap and shaping support.
* Requires FEAT_RIGHTLEFT and FEAT_MBYTE.
+ *
+ * Disabled for EBCDIC as it requires multibyte.
*/
#if defined(FEAT_BIG) && !defined(WIN16) && SIZEOF_INT >= 4 && !defined(EBCDIC)
# define FEAT_ARABIC
@@ -343,7 +349,7 @@
* +tag_binary Can use a binary search for the tags file.
*
* Disabled for EBCDIC:
- * On OS/390 Unix we have the problem that /bin/sort sorts ASCII instead of
+ * On z/OS Unix we have the problem that /bin/sort sorts ASCII instead of
* EBCDIC. With this binary search doesn't work, as VIM expects a tag file
* sorted by character values. I'm not sure how to fix this. Should we really
* do a EBCDIC to ASCII conversion for this??
@@ -530,8 +536,11 @@
/*
* +spell spell checking
+ *
+ * Disabled for EBCDIC:
+ * Doesn't work (SIGSEGV).
*/
-#if defined(FEAT_NORMAL) || defined(PROTO)
+#if (defined(FEAT_NORMAL) || defined(PROTO)) && !defined(EBCDIC)
# define FEAT_SPELL
#endif
@@ -622,7 +631,7 @@
* with 16 bit ints. Required for GTK+ 2.
*
* Disabled for EBCDIC:
- * Multibyte support doesn't work on OS390 Unix currently.
+ * Multibyte support doesn't work on z/OS Unix currently.
*/
#if (defined(FEAT_BIG) || defined(HAVE_GTK2) || defined(FEAT_ARABIC)) \
&& !defined(FEAT_MBYTE) && !defined(WIN16) \
diff --git a/src/regexp.c b/src/regexp.c
index 53559455e..ae1b03a11 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -731,6 +731,30 @@ get_equi_class(pp)
return 0;
}
+#ifdef EBCDIC
+/*
+ * Table for equivalence class "c". (IBM-1047)
+ */
+char *EQUIVAL_CLASS_C[16] = {
+ "A\x62\x63\x64\x65\x66\x67",
+ "C\x68",
+ "E\x71\x72\x73\x74",
+ "I\x75\x76\x77\x78",
+ "N\x69",
+ "O\xEB\xEC\xED\xEE\xEF",
+ "U\xFB\xFC\xFD\xFE",
+ "Y\xBA",
+ "a\x42\x43\x44\x45\x46\x47",
+ "c\x48",
+ "e\x51\x52\x53\x54",
+ "i\x55\x56\x57\x58",
+ "n\x49",
+ "o\xCB\xCC\xCD\xCE\xCF",
+ "u\xDB\xDC\xDD\xDE",
+ "y\x8D\xDF",
+};
+#endif
+
/*
* Produce the bytes for equivalence class "c".
* Currently only handles latin1, latin9 and utf-8.
@@ -744,6 +768,22 @@ reg_equi_class(c)
|| STRCMP(p_enc, "iso-8859-15") == 0)
#endif
{
+#ifdef EBCDIC
+ int i;
+
+ /* This might be slower than switch/case below. */
+ for (i = 0; i < 16; i++)
+ {
+ if (vim_strchr(EQUIVAL_CLASS_C[i], c) != NULL)
+ {
+ char *p = EQUIVAL_CLASS_C[i];
+
+ while (*p != 0)
+ regmbc(*p++);
+ return;
+ }
+ }
+#else
switch (c)
{
case 'A': case '\300': case '\301': case '\302':
@@ -811,6 +851,7 @@ reg_equi_class(c)
regmbc('y'); regmbc('\375'); regmbc('\377');
return;
}
+#endif
}
regmbc(c);
}