* Makefile.in: Put -lgcc last in list of libraries, since stdc++ library needs

it.
* cygwin.din: Remove obsolete "__empty" export.
* exceptions.cc (call_signal_handler_now): Force inclusion of function even
when -finline-functions is specified.
* sigproc.h: Remove obsolete call_signal_handler declaration.
* fhandler_console.cc (cp_get_internal): New function.
(cp_convert): New function.
(con_to_str): New function.
(str_to_con): New function.
(fhandler_console::read): Replace OemToCharBuff with con_to_str.
(fhandler_console::write_normal): Replace CharToOemBuff with str_to_con.
This commit is contained in:
Christopher Faylor 2001-04-09 00:44:25 +00:00
parent 97101b51aa
commit aa970c616c
8 changed files with 493 additions and 416 deletions

View File

@ -1,3 +1,21 @@
Sun Apr 8 20:40:58 2001 Christopher Faylor <cgf@cygnus.com>
* Makefile.in: Put -lgcc last in list of libraries, since stdc++
library needs it.
* cygwin.din: Remove obsolete "__empty" export.
* exceptions.cc (call_signal_handler_now): Force inclusion of function
even when -finline-functions is specified.
* sigproc.h: Remove obsolete call_signal_handler declaration.
Sun Apr 8 20:36:55 2001 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
* fhandler_console.cc (cp_get_internal): New function.
(cp_convert): New function.
(con_to_str): New function.
(str_to_con): New function.
(fhandler_console::read): Replace OemToCharBuff with con_to_str.
(fhandler_console::write_normal): Replace CharToOemBuff with str_to_con.
Thu Apr 5 22:41:00 2001 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (stat_worker): Fix conditional which still allowed

View File

@ -190,7 +190,7 @@ new-$(LIB_NAME): $(LIB_NAME)
new-$(DLL_NAME): $(DLL_OFILES) $(DEF_FILE) $(DLL_IMPORTS) $(LIBC) $(LIBM) Makefile winver_stamp
$(CXX) $(CXXFLAGS) -nostdlib -Wl,-shared -o $@ -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o \
winver.o $(DLL_IMPORTS) $(MALLOC_OBJ) $(LIBM) $(LIBC) -lgcc -lstdc++ -lshell32 -luuid
winver.o $(DLL_IMPORTS) $(MALLOC_OBJ) $(LIBM) $(LIBC) -lstdc++ -lshell32 -luuid -lgcc
dll_ofiles: $(DLL_OFILES)

View File

@ -938,7 +938,6 @@ getpgrp
_getpgrp = getpgrp
getgrent
_getgrent = getgrent
__empty
ntohl
_ntohl = ntohl
htonl

View File

@ -1128,6 +1128,10 @@ call_signal_handler_now ()
sigdelayed0 ();
return sa_flags & SA_RESTART;
}
/* This kludge seems to keep a copy of call_signal_handler_now around
even when compiling with -finline-functions. */
static int __stdcall call_signal_handler_now_dummy ()
__attribute__((alias ("call_signal_handler_now")));
};
int

View File

@ -18,6 +18,7 @@ details. */
#include <wingdi.h>
#include <winuser.h>
#include <wincon.h>
#include <winnls.h> // MultiByteToWideChar () and friends
#include <ctype.h>
#include <sys/cygwin.h>
#include "cygheap.h"
@ -29,6 +30,53 @@ details. */
#include "shared_info.h"
#include "security.h"
#define CONVERT_LIMIT 4096
/* The codepages are resolved here instead of using CP_ACP and
CP_OEMCP, so that they can later be compared for equality. */
inline UINT
cp_get_internal ()
{
return current_codepage == ansi_cp ? GetACP() : GetOEMCP();
}
static BOOL
cp_convert (UINT destcp, char * dest, UINT srccp, const char * src, DWORD size)
{
if (!size)
/* no action */;
else if (destcp == srccp)
{
if (dest != src)
memcpy (dest, src, size);
}
else
{
WCHAR wbuffer[CONVERT_LIMIT]; /* same size as the maximum input, s.b. */
if (!MultiByteToWideChar (srccp, 0, src, size, wbuffer, sizeof (wbuffer)))
return FALSE;
if (!WideCharToMultiByte (destcp, 0, wbuffer, size, dest, size,
NULL, NULL))
return FALSE;
}
return TRUE;
}
/* The results of GetConsoleCP() and GetConsoleOutputCP() cannot be
cached, because a program or the user can change these values at
any time. */
inline BOOL
con_to_str (char *d, const char *s, DWORD sz)
{
return cp_convert (cp_get_internal (), d, GetConsoleCP (), s, sz);
}
inline BOOL
str_to_con (char *d, const char *s, DWORD sz)
{
return cp_convert (GetConsoleOutputCP (), d, cp_get_internal (), s, sz);
}
/*
* Scroll the screen context.
* x1, y1 - ul corner
@ -248,8 +296,8 @@ fhandler_console::read (void *pv, size_t buflen)
tmp[1] = ich;
/* Need this check since US code page seems to have a bug when
converting a CTRL-U. */
if ((unsigned char)ich > 0x7f && current_codepage == ansi_cp)
OemToCharBuff (tmp + 1, tmp + 1, 1);
if ((unsigned char)ich > 0x7f)
con_to_str (tmp + 1, tmp + 1, 1);
/* Determine if the keystroke is modified by META. */
if (!(input_rec.Event.KeyEvent.dwControlKeyState & meta_mask))
toadd = tmp + 1;
@ -1330,24 +1378,31 @@ fhandler_console::write_normal (const unsigned char *src,
break;
found++;
}
/* Print all the base ones out */
if (found != src)
{
char buf[4096];
size_t len = found - src;
do {
size_t l2 = min (sizeof (buf), len);
if (current_codepage == ansi_cp)
CharToOemBuff ((LPCSTR)src, buf, l2);
else
strncpy (buf, (LPCSTR)src, l2);
DWORD len = found - src;
do
{
DWORD buf_len;
char buf[CONVERT_LIMIT];
done = buf_len = min (sizeof (buf), len);
if (!str_to_con (buf, (const char *) src, buf_len))
{
debug_printf ("conversion error, handle %p", get_output_handle ());
__seterrno ();
return 0;
}
if (insert_mode)
{
int x, y;
cursor_get (&x, &y);
scroll_screen (x, y, -1, y, x + l2, y);
scroll_screen (x, y, -1, y, x + buf_len, y);
}
if (!WriteFile (get_output_handle (), buf, l2, &done, 0))
if (!WriteFile (get_output_handle (), buf, buf_len, &done, 0))
{
debug_printf ("write failed, handle %p", get_output_handle ());
__seterrno ();
@ -1355,8 +1410,10 @@ fhandler_console::write_normal (const unsigned char *src,
}
len -= done;
src += done;
} while (len > 0);
}
while (len > 0);
}
if (src < end)
{
int x, y;

View File

@ -110,7 +110,6 @@ BOOL __stdcall pid_exists (pid_t) __attribute__ ((regparm(1)));
int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0)) __attribute__ ((regparm(3)));
void __stdcall signal_fixup_after_fork ();
void __stdcall signal_fixup_after_exec (bool);
extern "C" int __stdcall call_signal_handler ();
extern char myself_nowait_dummy[];
extern char myself_nowait_nonmain_dummy[];