1996-07-17 22:02:21 +02:00
|
|
|
|
/*
|
|
|
|
|
* Line-editing routines
|
|
|
|
|
*
|
|
|
|
|
* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* This software is not subject to any license of the American Telephone
|
|
|
|
|
* and Telegraph Company or of the Regents of the University of California.
|
|
|
|
|
*
|
|
|
|
|
* Permission is granted to anyone to use this software for any purpose on
|
|
|
|
|
* any computer system, and to alter it and redistribute it freely, subject
|
|
|
|
|
* to the following restrictions:
|
|
|
|
|
* 1. The authors are not responsible for the consequences of use of this
|
|
|
|
|
* software, no matter how awful, even if they arise from flaws in it.
|
|
|
|
|
* 2. The origin of this software must not be misrepresented, either by
|
|
|
|
|
* explicit claim or by omission. Since few users ever read sources,
|
|
|
|
|
* credits must appear in the documentation.
|
|
|
|
|
* 3. Altered versions must be plainly marked as such, and must not be
|
|
|
|
|
* misrepresented as being the original software. Since few users
|
|
|
|
|
* ever read sources, credits must appear in the documentation.
|
|
|
|
|
* 4. This notice may not be removed or altered.
|
|
|
|
|
*
|
|
|
|
|
* The code was heavily simplified for inclusion in Wine. -- AJ
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
1993-09-29 13:21:49 +01:00
|
|
|
|
#include <ctype.h>
|
1996-07-17 22:02:21 +02:00
|
|
|
|
#include <stdio.h>
|
Release 941122
Sun Nov 20 18:30:06 1994 Alexandre Julliard (julliard@lamisun.epfl.ch)
* [controls/scroll.c] [include/scroll.h]
Rewritten most of scroll-bar code for better Windows look & feel.
Implemented EnableScrollBar().
Preliminary keyboard support.
* [objects/bitblt.c]
Fixed BadMatch error for BitBlt() and StretchBlt() when reading
bits from outside the visible region.
* [objects/oembitmap.c] [include/bitmaps/obm_*]
Use XPM symbolic colors to load bitmaps. This allows the colors
of the bitmaps to depend on the system colors.
* [tools/make_debug]
Made the make_debug script more robust.
* [windows/dialog.c]
Fixed CheckRadioButton().
* [windows/nonclient.c]
A few changes to scroll-bar drawing and tracking.
* [windows/winpos.c]
Renamed NextWindowFromPoint() to WINPOS_NextWindowFromPoint() to
avoid confusion, and optimized it somewhat.
Nov 19, 94 Martin Ayotte (wine@trgcorp.mksinfo.qc.ca)
* [misc/audio.c]
* [misc/mcianim.c]
more coding but nothing spectacular.
* [misc/mmaux.c]
some coding to access '/dev/mixer'.
* [misc/midi.c]
some coding to read .MID files, but it's not playing yet.
Sun Nov 13 19:31:03 1994 James Youngman (mbcstjy@afs.man.ac.uk)
* [objects/dib.c]
Reimplemented DIB_SetImageBits_RLE8() so that it would cope with
bitmaps which don't end 0x00, 0x02 (previously it blew up). This
includes some bitmaps output by Paint Shop Pro. Implementation is
possibly now too lax. Please see the notes on the function about
why.
* [controls/desktop.c]
The desktop pattern should be painted if the wallpaper doesn't
cover the whole screen width OR the whole screen height.
Sun Nov 13 00:07:11 MET 1994 Erik Bos <erik@xs4all.nl>
* [objects/dib.c]
Small bug in DIB_SetImageBits() fixed, bitmaps in 16,24 bpp
now work.
* [loader/ne_resource.c] [include/resource.h]
Some cleanup.
Thu Nov 10 20:44:58 1994 Martin von Loewis (martin@cs.csufresno.edu)
* [Configure]
[rc/sysres.rc]
Primitive compile-time support for multiple languages
* [rc/sysres_De.rc]
New file
* [loader/resource.c]
LoadBitmap: Recognize end of sysresbm properly
* [rc/Imakefile]
Rules to compile resources simplified, dependencies changed
* [rc/sysresbm.rc]
Don't use sysresbm if using XPM
* [windows/dialog.c]
CreateDialogIndirectParam: Reverse Z-order of controls
* [windows/message.c]
MSG_TranslateMouseMsg: Fix HTTRANSPARENT handling
* [windows/winpos.c]
NextWindowFromPoint: New function
* [controls/button.c]
WM_NCHITTEST: Group Box is HTTRANSPARENT
BUTTON_CheckAutoRadioButton: New function
BM_SETCHECK: Added call to BUTTON_CheckAutoRadioButton
Mon Nov 7 11:20:26 1994 Paul Falstad (pf@zoof.cts.com)
* [objects/text.c]
Fix hang when using DrawText(..., DT_WORDBREAK) with a word that
is too long to break.
* [objects/font.c]
Don't assume helvetica if there is no font family; let the other
font attributes decide what font to use.
* [controls/widgets.c]
Listboxes and combo boxes need to be notified of double-clicks.
* [controls/listbox.c]
[include/listbox.h]
scrolling to bottom of list box should display last item at the
bottom, not at the top.
list boxes need to allocate a separate heap for their item data,
rather than using the user heap. Otherwise, it's very easy to run
out of memory for list box items.
removed redundant code in ListBoxAddString(). Implemented simple
version of LBS_SORT.
Don't put [.] in the list box when using DDL_DIRECTORY.
* [controls/combo.c]
Combos should pass CBS_SORT onto their list box.
* [windows/win.c]
If window creation is aborted, remove the window from the
linked lists.
* [controls/static.c]
static controls with SS_ICON were always returning 0 from
WM_NCCREATE.
Make sure static controls have text to draw before drawing it.
1994-11-22 17:31:29 +01:00
|
|
|
|
#include <stdlib.h>
|
1999-06-26 16:58:24 +02:00
|
|
|
|
#include <unistd.h>
|
1996-07-17 22:02:21 +02:00
|
|
|
|
#include <string.h>
|
1999-01-17 17:32:32 +01:00
|
|
|
|
#include <errno.h>
|
1996-07-17 22:02:21 +02:00
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
1999-03-14 17:35:05 +01:00
|
|
|
|
#include "windef.h"
|
1999-04-25 14:24:42 +02:00
|
|
|
|
#include "debugger.h"
|
1993-09-29 13:21:49 +01:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Manifest constants.
|
|
|
|
|
*/
|
|
|
|
|
#define SCREEN_WIDTH 80
|
|
|
|
|
#define SCREEN_ROWS 24
|
|
|
|
|
#define NO_ARG (-1)
|
|
|
|
|
#define DEL 127
|
|
|
|
|
#define CTL(x) ((x) & 0x1F)
|
|
|
|
|
#define ISCTL(x) ((x) && (x) < ' ')
|
|
|
|
|
#define UNCTL(x) ((x) + 64)
|
|
|
|
|
#define META(x) ((x) | 0x80)
|
|
|
|
|
#define ISMETA(x) ((x) & 0x80)
|
|
|
|
|
#define UNMETA(x) ((x) & 0x7F)
|
|
|
|
|
#if !defined(HIST_SIZE)
|
|
|
|
|
#define HIST_SIZE 20
|
|
|
|
|
#endif /* !defined(HIST_SIZE) */
|
1996-07-17 22:02:21 +02:00
|
|
|
|
#define CRLF "\r\n"
|
|
|
|
|
#define MEM_INC 64
|
|
|
|
|
#define SCREEN_INC 256
|
|
|
|
|
|
1999-04-25 14:24:42 +02:00
|
|
|
|
#define DISPOSE(p) DBG_free((char *)(p))
|
1996-07-17 22:02:21 +02:00
|
|
|
|
#define NEW(T, c) \
|
1999-04-25 14:24:42 +02:00
|
|
|
|
((T *)DBG_alloc((unsigned int)(sizeof (T) * (c))))
|
1996-07-17 22:02:21 +02:00
|
|
|
|
#define RENEW(p, T, c) \
|
1999-04-25 14:24:42 +02:00
|
|
|
|
(p = (T *)DBG_realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
|
1996-07-17 22:02:21 +02:00
|
|
|
|
#define COPYFROMTO(new, p, len) \
|
|
|
|
|
(void)memcpy((char *)(new), (char *)(p), (int)(len))
|
1993-09-29 13:21:49 +01:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Command status codes.
|
|
|
|
|
*/
|
|
|
|
|
typedef enum _STATUS {
|
|
|
|
|
CSdone, CSeof, CSmove, CSdispatch, CSstay
|
|
|
|
|
} STATUS;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** The type of case-changing to perform.
|
|
|
|
|
*/
|
|
|
|
|
typedef enum _CASE {
|
|
|
|
|
TOupper, TOlower
|
|
|
|
|
} CASE;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Key to command mapping.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct _KEYMAP {
|
|
|
|
|
CHAR Key;
|
|
|
|
|
STATUS (*Function)();
|
|
|
|
|
} KEYMAP;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Command history structure.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct _HISTORY {
|
|
|
|
|
int Size;
|
|
|
|
|
int Pos;
|
|
|
|
|
CHAR *Lines[HIST_SIZE];
|
|
|
|
|
} HISTORY;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Globals.
|
|
|
|
|
*/
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static int rl_eof;
|
|
|
|
|
static int rl_erase;
|
|
|
|
|
static int rl_intr;
|
|
|
|
|
static int rl_kill;
|
|
|
|
|
|
|
|
|
|
static CHAR NIL[] = "";
|
|
|
|
|
static const CHAR *Input = NIL;
|
|
|
|
|
static CHAR *Line;
|
|
|
|
|
static const char *Prompt;
|
|
|
|
|
static CHAR *Yanked;
|
|
|
|
|
static char *Screen;
|
|
|
|
|
static char NEWLINE[]= CRLF;
|
|
|
|
|
static HISTORY H;
|
|
|
|
|
static int rl_quit;
|
|
|
|
|
static int Repeat;
|
|
|
|
|
static int End;
|
|
|
|
|
static int Mark;
|
|
|
|
|
static int OldPoint;
|
|
|
|
|
static int Point;
|
|
|
|
|
static int PushBack;
|
|
|
|
|
static int Pushed;
|
|
|
|
|
static KEYMAP Map[33];
|
|
|
|
|
static KEYMAP MetaMap[16];
|
|
|
|
|
static size_t Length;
|
|
|
|
|
static size_t ScreenCount;
|
|
|
|
|
static size_t ScreenSize;
|
|
|
|
|
static char *backspace;
|
|
|
|
|
static int TTYwidth;
|
|
|
|
|
static int TTYrows;
|
1993-09-29 13:21:49 +01:00
|
|
|
|
|
|
|
|
|
/* Display print 8-bit chars as `M-x' or as the actual 8-bit char? */
|
|
|
|
|
int rl_meta_chars = 1;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Declarations.
|
|
|
|
|
*/
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static CHAR *editinput();
|
1993-09-29 13:21:49 +01:00
|
|
|
|
extern int read();
|
|
|
|
|
extern int write();
|
|
|
|
|
#if defined(USE_TERMCAP)
|
|
|
|
|
extern char *getenv();
|
|
|
|
|
extern char *tgetstr();
|
|
|
|
|
extern int tgetent();
|
|
|
|
|
#endif /* defined(USE_TERMCAP) */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** TTY input/output functions.
|
|
|
|
|
*/
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
#ifdef HAVE_TCGETATTR
|
|
|
|
|
#include <termios.h>
|
|
|
|
|
|
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
rl_ttyset(int Reset)
|
1996-07-17 22:02:21 +02:00
|
|
|
|
{
|
|
|
|
|
static struct termios old;
|
|
|
|
|
struct termios new;
|
|
|
|
|
|
|
|
|
|
if (Reset == 0) {
|
|
|
|
|
(void)tcgetattr(0, &old);
|
|
|
|
|
rl_erase = old.c_cc[VERASE];
|
|
|
|
|
rl_kill = old.c_cc[VKILL];
|
|
|
|
|
rl_eof = old.c_cc[VEOF];
|
|
|
|
|
rl_intr = old.c_cc[VINTR];
|
|
|
|
|
rl_quit = old.c_cc[VQUIT];
|
|
|
|
|
|
|
|
|
|
new = old;
|
|
|
|
|
new.c_cc[VINTR] = -1;
|
|
|
|
|
new.c_cc[VQUIT] = -1;
|
|
|
|
|
new.c_lflag &= ~(ECHO | ICANON);
|
|
|
|
|
new.c_iflag &= ~(ISTRIP | INPCK);
|
|
|
|
|
new.c_cc[VMIN] = 1;
|
|
|
|
|
new.c_cc[VTIME] = 0;
|
|
|
|
|
(void)tcsetattr(0, TCSANOW, &new);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
(void)tcsetattr(0, TCSANOW, &old);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else /* HAVE_TCGETATTR */
|
|
|
|
|
|
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
rl_ttyset(int Reset)
|
1996-07-17 22:02:21 +02:00
|
|
|
|
{
|
|
|
|
|
static struct sgttyb old_sgttyb;
|
|
|
|
|
static struct tchars old_tchars;
|
|
|
|
|
struct sgttyb new_sgttyb;
|
|
|
|
|
struct tchars new_tchars;
|
|
|
|
|
|
|
|
|
|
if (Reset == 0) {
|
|
|
|
|
(void)ioctl(0, TIOCGETP, &old_sgttyb);
|
|
|
|
|
rl_erase = old_sgttyb.sg_erase;
|
|
|
|
|
rl_kill = old_sgttyb.sg_kill;
|
|
|
|
|
|
|
|
|
|
(void)ioctl(0, TIOCGETC, &old_tchars);
|
|
|
|
|
rl_eof = old_tchars.t_eofc;
|
|
|
|
|
rl_intr = old_tchars.t_intrc;
|
|
|
|
|
rl_quit = old_tchars.t_quitc;
|
|
|
|
|
|
|
|
|
|
new_sgttyb = old_sgttyb;
|
|
|
|
|
new_sgttyb.sg_flags &= ~ECHO;
|
|
|
|
|
new_sgttyb.sg_flags |= RAW;
|
|
|
|
|
#if defined(PASS8)
|
|
|
|
|
new_sgttyb.sg_flags |= PASS8;
|
|
|
|
|
#endif /* defined(PASS8) */
|
|
|
|
|
(void)ioctl(0, TIOCSETP, &new_sgttyb);
|
|
|
|
|
|
|
|
|
|
new_tchars = old_tchars;
|
|
|
|
|
new_tchars.t_intrc = -1;
|
|
|
|
|
new_tchars.t_quitc = -1;
|
|
|
|
|
(void)ioctl(0, TIOCSETC, &new_tchars);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
(void)ioctl(0, TIOCSETP, &old_sgttyb);
|
|
|
|
|
(void)ioctl(0, TIOCSETC, &old_tchars);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* HAVE_TCGETATTR */
|
|
|
|
|
|
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYflush(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (ScreenCount) {
|
|
|
|
|
(void)write(1, Screen, ScreenCount);
|
|
|
|
|
ScreenCount = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYput(CHAR c)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
Screen[ScreenCount] = c;
|
|
|
|
|
if (++ScreenCount >= ScreenSize - 1) {
|
|
|
|
|
ScreenSize += SCREEN_INC;
|
|
|
|
|
RENEW(Screen, char, ScreenSize);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYputs(CHAR *p)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
while (*p)
|
|
|
|
|
TTYput(*p++);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYshow(CHAR c)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (c == DEL) {
|
|
|
|
|
TTYput('^');
|
|
|
|
|
TTYput('?');
|
|
|
|
|
}
|
|
|
|
|
else if (ISCTL(c)) {
|
|
|
|
|
TTYput('^');
|
|
|
|
|
TTYput(UNCTL(c));
|
|
|
|
|
}
|
|
|
|
|
else if (rl_meta_chars && ISMETA(c)) {
|
|
|
|
|
TTYput('M');
|
|
|
|
|
TTYput('-');
|
|
|
|
|
TTYput(UNMETA(c));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
TTYput(c);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYstring(CHAR *p)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
while (*p)
|
|
|
|
|
TTYshow(*p++);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static unsigned int
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYget(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
CHAR c;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
int retv;
|
1993-09-29 13:21:49 +01:00
|
|
|
|
|
|
|
|
|
TTYflush();
|
|
|
|
|
if (Pushed) {
|
|
|
|
|
Pushed = 0;
|
|
|
|
|
return PushBack;
|
|
|
|
|
}
|
|
|
|
|
if (*Input)
|
|
|
|
|
return *Input++;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
|
|
|
|
|
while ( ( retv = read( 0, &c, (size_t)1 ) ) == -1 )
|
|
|
|
|
{
|
|
|
|
|
if ( errno != EINTR )
|
1999-03-24 16:07:20 +01:00
|
|
|
|
{
|
1999-01-17 17:32:32 +01:00
|
|
|
|
perror( "read" );
|
1999-03-24 16:07:20 +01:00
|
|
|
|
return EOF;
|
|
|
|
|
}
|
1999-01-17 17:32:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return retv == 1 ? c : EOF;
|
1993-09-29 13:21:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define TTYback() (backspace ? TTYputs((CHAR *)backspace) : TTYput('\b'))
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYbackn(int n)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
while (--n >= 0)
|
|
|
|
|
TTYback();
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYinfo(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
static int init;
|
|
|
|
|
#if defined(USE_TERMCAP)
|
|
|
|
|
char *term;
|
|
|
|
|
char buff[2048];
|
|
|
|
|
char *bp;
|
|
|
|
|
#endif /* defined(USE_TERMCAP) */
|
|
|
|
|
#if defined(TIOCGWINSZ)
|
|
|
|
|
struct winsize W;
|
|
|
|
|
#endif /* defined(TIOCGWINSZ) */
|
|
|
|
|
|
|
|
|
|
if (init) {
|
|
|
|
|
#if defined(TIOCGWINSZ)
|
|
|
|
|
/* Perhaps we got resized. */
|
|
|
|
|
if (ioctl(0, TIOCGWINSZ, &W) >= 0
|
|
|
|
|
&& W.ws_col > 0 && W.ws_row > 0) {
|
|
|
|
|
TTYwidth = (int)W.ws_col;
|
|
|
|
|
TTYrows = (int)W.ws_row;
|
|
|
|
|
}
|
|
|
|
|
#endif /* defined(TIOCGWINSZ) */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
init++;
|
|
|
|
|
|
|
|
|
|
TTYwidth = TTYrows = 0;
|
|
|
|
|
#if defined(USE_TERMCAP)
|
|
|
|
|
bp = &buff[0];
|
|
|
|
|
if ((term = getenv("TERM")) == NULL)
|
|
|
|
|
term = "dumb";
|
|
|
|
|
if (tgetent(buff, term) < 0) {
|
|
|
|
|
TTYwidth = SCREEN_WIDTH;
|
|
|
|
|
TTYrows = SCREEN_ROWS;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
backspace = tgetstr("le", &bp);
|
|
|
|
|
TTYwidth = tgetnum("co");
|
|
|
|
|
TTYrows = tgetnum("li");
|
|
|
|
|
#endif /* defined(USE_TERMCAP) */
|
|
|
|
|
|
|
|
|
|
#if defined(TIOCGWINSZ)
|
|
|
|
|
if (ioctl(0, TIOCGWINSZ, &W) >= 0) {
|
|
|
|
|
TTYwidth = (int)W.ws_col;
|
|
|
|
|
TTYrows = (int)W.ws_row;
|
|
|
|
|
}
|
|
|
|
|
#endif /* defined(TIOCGWINSZ) */
|
|
|
|
|
|
|
|
|
|
if (TTYwidth <= 0 || TTYrows <= 0) {
|
|
|
|
|
TTYwidth = SCREEN_WIDTH;
|
|
|
|
|
TTYrows = SCREEN_ROWS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
reposition(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
CHAR *p;
|
|
|
|
|
|
|
|
|
|
TTYput('\r');
|
|
|
|
|
TTYputs((CHAR *)Prompt);
|
|
|
|
|
for (i = Point, p = Line; --i >= 0; p++)
|
|
|
|
|
TTYshow(*p);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
left(STATUS Change)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
TTYback();
|
|
|
|
|
if (Point) {
|
|
|
|
|
if (ISCTL(Line[Point - 1]))
|
|
|
|
|
TTYback();
|
|
|
|
|
else if (rl_meta_chars && ISMETA(Line[Point - 1])) {
|
|
|
|
|
TTYback();
|
|
|
|
|
TTYback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Change == CSmove)
|
|
|
|
|
Point--;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
right(STATUS Change)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
TTYshow(Line[Point]);
|
|
|
|
|
if (Change == CSmove)
|
|
|
|
|
Point++;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
ring_bell(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
TTYput('\07');
|
|
|
|
|
TTYflush();
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
do_macro(unsigned int c)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
CHAR name[4];
|
|
|
|
|
|
|
|
|
|
name[0] = '_';
|
|
|
|
|
name[1] = c;
|
|
|
|
|
name[2] = '_';
|
|
|
|
|
name[3] = '\0';
|
|
|
|
|
|
|
|
|
|
if ((Input = (CHAR *)getenv((char *)name)) == NULL) {
|
|
|
|
|
Input = NIL;
|
|
|
|
|
return ring_bell();
|
|
|
|
|
}
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
do_forward(STATUS move)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
CHAR *p;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
do {
|
|
|
|
|
p = &Line[Point];
|
|
|
|
|
for ( ; Point < End && (*p == ' ' || !isalnum(*p)); Point++, p++)
|
|
|
|
|
if (move == CSmove)
|
|
|
|
|
right(CSstay);
|
|
|
|
|
|
|
|
|
|
for (; Point < End && isalnum(*p); Point++, p++)
|
|
|
|
|
if (move == CSmove)
|
|
|
|
|
right(CSstay);
|
|
|
|
|
|
|
|
|
|
if (Point == End)
|
|
|
|
|
break;
|
|
|
|
|
} while (++i < Repeat);
|
|
|
|
|
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
do_case(CASE type)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int end;
|
|
|
|
|
int count;
|
|
|
|
|
CHAR *p;
|
|
|
|
|
|
|
|
|
|
(void)do_forward(CSstay);
|
|
|
|
|
if (OldPoint != Point) {
|
|
|
|
|
if ((count = Point - OldPoint) < 0)
|
|
|
|
|
count = -count;
|
|
|
|
|
Point = OldPoint;
|
|
|
|
|
if ((end = Point + count) > End)
|
|
|
|
|
end = End;
|
|
|
|
|
for (i = Point, p = &Line[i]; i < end; i++, p++) {
|
|
|
|
|
if (type == TOupper) {
|
|
|
|
|
if (islower(*p))
|
|
|
|
|
*p = toupper(*p);
|
|
|
|
|
}
|
|
|
|
|
else if (isupper(*p))
|
|
|
|
|
*p = tolower(*p);
|
|
|
|
|
right(CSmove);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
case_down_word(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return do_case(TOlower);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
case_up_word(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return do_case(TOupper);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
ceol(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int extras;
|
|
|
|
|
int i;
|
|
|
|
|
CHAR *p;
|
|
|
|
|
|
|
|
|
|
for (extras = 0, i = Point, p = &Line[i]; i <= End; i++, p++) {
|
|
|
|
|
TTYput(' ');
|
|
|
|
|
if (ISCTL(*p)) {
|
|
|
|
|
TTYput(' ');
|
|
|
|
|
extras++;
|
|
|
|
|
}
|
|
|
|
|
else if (rl_meta_chars && ISMETA(*p)) {
|
|
|
|
|
TTYput(' ');
|
|
|
|
|
TTYput(' ');
|
|
|
|
|
extras += 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i += extras; i > Point; i--)
|
|
|
|
|
TTYback();
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
clear_line(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
Point = -strlen(Prompt);
|
|
|
|
|
TTYput('\r');
|
|
|
|
|
ceol();
|
|
|
|
|
Point = 0;
|
|
|
|
|
End = 0;
|
|
|
|
|
Line[0] = '\0';
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
insert_string(CHAR *p)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
1996-07-17 22:02:21 +02:00
|
|
|
|
size_t len;
|
1993-09-29 13:21:49 +01:00
|
|
|
|
int i;
|
|
|
|
|
CHAR *new;
|
|
|
|
|
CHAR *q;
|
|
|
|
|
|
|
|
|
|
len = strlen((char *)p);
|
|
|
|
|
if (End + len >= Length) {
|
|
|
|
|
if ((new = NEW(CHAR, Length + len + MEM_INC)) == NULL)
|
|
|
|
|
return CSstay;
|
|
|
|
|
if (Length) {
|
|
|
|
|
COPYFROMTO(new, Line, Length);
|
|
|
|
|
DISPOSE(Line);
|
|
|
|
|
}
|
|
|
|
|
Line = new;
|
|
|
|
|
Length += len + MEM_INC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (q = &Line[Point], i = End - Point; --i >= 0; )
|
|
|
|
|
q[len + i] = q[i];
|
|
|
|
|
COPYFROMTO(&Line[Point], p, len);
|
|
|
|
|
End += len;
|
|
|
|
|
Line[End] = '\0';
|
|
|
|
|
TTYstring(&Line[Point]);
|
|
|
|
|
Point += len;
|
|
|
|
|
|
|
|
|
|
return Point == End ? CSstay : CSmove;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static CHAR *
|
1999-06-26 16:58:24 +02:00
|
|
|
|
next_hist(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return H.Pos >= H.Size - 1 ? NULL : H.Lines[++H.Pos];
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static CHAR *
|
1993-09-29 13:21:49 +01:00
|
|
|
|
prev_hist()
|
|
|
|
|
{
|
|
|
|
|
return H.Pos == 0 ? NULL : H.Lines[--H.Pos];
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
do_insert_hist(CHAR *p)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (p == NULL)
|
|
|
|
|
return ring_bell();
|
|
|
|
|
Point = 0;
|
|
|
|
|
reposition();
|
|
|
|
|
ceol();
|
|
|
|
|
End = 0;
|
|
|
|
|
return insert_string(p);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
do_hist(CHAR *(*move)(void))
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
CHAR *p;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
do {
|
|
|
|
|
if ((p = (*move)()) == NULL)
|
|
|
|
|
return ring_bell();
|
|
|
|
|
} while (++i < Repeat);
|
|
|
|
|
return do_insert_hist(p);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
h_next(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return do_hist(next_hist);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
h_prev(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return do_hist(prev_hist);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
h_first(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return do_insert_hist(H.Lines[H.Pos = 0]);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
h_last(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return do_insert_hist(H.Lines[H.Pos = H.Size - 1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Return zero if pat appears as a substring in text.
|
|
|
|
|
*/
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static int
|
1999-06-26 16:58:24 +02:00
|
|
|
|
substrcmp(char *text, char *pat, int len)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
CHAR c;
|
|
|
|
|
|
|
|
|
|
if ((c = *pat) == '\0')
|
|
|
|
|
return *text == '\0';
|
|
|
|
|
for ( ; *text; text++)
|
1995-01-09 19:21:16 +01:00
|
|
|
|
if ((CHAR)*text == c && strncmp(text, pat, len) == 0)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static CHAR *
|
1999-06-26 16:58:24 +02:00
|
|
|
|
search_hist(CHAR *search, CHAR *(*move)(void))
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
static CHAR *old_search;
|
|
|
|
|
int len;
|
|
|
|
|
int pos;
|
|
|
|
|
int (*match)();
|
|
|
|
|
char *pat;
|
|
|
|
|
|
|
|
|
|
/* Save or get remembered search pattern. */
|
|
|
|
|
if (search && *search) {
|
|
|
|
|
if (old_search)
|
|
|
|
|
DISPOSE(old_search);
|
1999-04-25 14:24:42 +02:00
|
|
|
|
old_search = (CHAR *)DBG_strdup((char *)search);
|
1993-09-29 13:21:49 +01:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (old_search == NULL || *old_search == '\0')
|
|
|
|
|
return NULL;
|
|
|
|
|
search = old_search;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set up pattern-finder. */
|
|
|
|
|
if (*search == '^') {
|
|
|
|
|
match = strncmp;
|
|
|
|
|
pat = (char *)(search + 1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
match = substrcmp;
|
|
|
|
|
pat = (char *)search;
|
|
|
|
|
}
|
|
|
|
|
len = strlen(pat);
|
|
|
|
|
|
|
|
|
|
for (pos = H.Pos; (*move)() != NULL; )
|
|
|
|
|
if ((*match)((char *)H.Lines[H.Pos], pat, len) == 0)
|
|
|
|
|
return H.Lines[H.Pos];
|
|
|
|
|
H.Pos = pos;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
h_search(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
static int Searching;
|
1996-07-17 22:02:21 +02:00
|
|
|
|
const char *old_prompt;
|
1993-09-29 13:21:49 +01:00
|
|
|
|
CHAR *(*move)();
|
|
|
|
|
CHAR *p;
|
|
|
|
|
|
|
|
|
|
if (Searching)
|
|
|
|
|
return ring_bell();
|
|
|
|
|
Searching = 1;
|
|
|
|
|
|
|
|
|
|
clear_line();
|
|
|
|
|
old_prompt = Prompt;
|
|
|
|
|
Prompt = "Search: ";
|
|
|
|
|
TTYputs((CHAR *)Prompt);
|
|
|
|
|
move = Repeat == NO_ARG ? prev_hist : next_hist;
|
|
|
|
|
p = search_hist(editinput(), move);
|
|
|
|
|
clear_line();
|
|
|
|
|
Prompt = old_prompt;
|
|
|
|
|
TTYputs((CHAR *)Prompt);
|
|
|
|
|
|
|
|
|
|
Searching = 0;
|
|
|
|
|
return do_insert_hist(p);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
fd_char(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
do {
|
|
|
|
|
if (Point >= End)
|
|
|
|
|
break;
|
|
|
|
|
right(CSmove);
|
|
|
|
|
} while (++i < Repeat);
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
save_yank(int begin, int i)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (Yanked) {
|
|
|
|
|
DISPOSE(Yanked);
|
|
|
|
|
Yanked = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i < 1)
|
|
|
|
|
return;
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
if ((Yanked = NEW(CHAR, (size_t)i + 1)) != NULL) {
|
1993-09-29 13:21:49 +01:00
|
|
|
|
COPYFROMTO(Yanked, &Line[begin], i);
|
|
|
|
|
Yanked[i] = '\0';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
delete_string(int count)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
CHAR *p;
|
|
|
|
|
|
|
|
|
|
if (count <= 0 || End == Point)
|
|
|
|
|
return ring_bell();
|
|
|
|
|
|
|
|
|
|
if (count == 1 && Point == End - 1) {
|
|
|
|
|
/* Optimize common case of delete at end of line. */
|
|
|
|
|
End--;
|
|
|
|
|
p = &Line[Point];
|
|
|
|
|
i = 1;
|
|
|
|
|
TTYput(' ');
|
|
|
|
|
if (ISCTL(*p)) {
|
|
|
|
|
i = 2;
|
|
|
|
|
TTYput(' ');
|
|
|
|
|
}
|
|
|
|
|
else if (rl_meta_chars && ISMETA(*p)) {
|
|
|
|
|
i = 3;
|
|
|
|
|
TTYput(' ');
|
|
|
|
|
TTYput(' ');
|
|
|
|
|
}
|
|
|
|
|
TTYbackn(i);
|
|
|
|
|
*p = '\0';
|
|
|
|
|
return CSmove;
|
|
|
|
|
}
|
|
|
|
|
if (Point + count > End && (count = End - Point) <= 0)
|
|
|
|
|
return CSstay;
|
|
|
|
|
|
|
|
|
|
if (count > 1)
|
|
|
|
|
save_yank(Point, count);
|
|
|
|
|
|
|
|
|
|
for (p = &Line[Point], i = End - (Point + count) + 1; --i >= 0; p++)
|
|
|
|
|
p[0] = p[count];
|
|
|
|
|
ceol();
|
|
|
|
|
End -= count;
|
|
|
|
|
TTYstring(&Line[Point]);
|
|
|
|
|
return CSmove;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
bk_char(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
do {
|
|
|
|
|
if (Point == 0)
|
|
|
|
|
break;
|
|
|
|
|
left(CSmove);
|
|
|
|
|
} while (++i < Repeat);
|
|
|
|
|
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
bk_del_char(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
do {
|
|
|
|
|
if (Point == 0)
|
|
|
|
|
break;
|
|
|
|
|
left(CSmove);
|
|
|
|
|
} while (++i < Repeat);
|
|
|
|
|
|
|
|
|
|
return delete_string(i);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
redisplay(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
TTYputs((CHAR *)NEWLINE);
|
|
|
|
|
TTYputs((CHAR *)Prompt);
|
|
|
|
|
TTYstring(Line);
|
|
|
|
|
return CSmove;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
kill_line(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (Repeat != NO_ARG) {
|
|
|
|
|
if (Repeat < Point) {
|
|
|
|
|
i = Point;
|
|
|
|
|
Point = Repeat;
|
|
|
|
|
reposition();
|
|
|
|
|
(void)delete_string(i - Point);
|
|
|
|
|
}
|
|
|
|
|
else if (Repeat > Point) {
|
|
|
|
|
right(CSmove);
|
|
|
|
|
(void)delete_string(Repeat - Point - 1);
|
|
|
|
|
}
|
|
|
|
|
return CSmove;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
save_yank(Point, End - Point);
|
|
|
|
|
Line[Point] = '\0';
|
|
|
|
|
ceol();
|
|
|
|
|
End = Point;
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
insert_char(int c)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
STATUS s;
|
|
|
|
|
CHAR buff[2];
|
|
|
|
|
CHAR *p;
|
|
|
|
|
CHAR *q;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (Repeat == NO_ARG || Repeat < 2) {
|
|
|
|
|
buff[0] = c;
|
|
|
|
|
buff[1] = '\0';
|
|
|
|
|
return insert_string(buff);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((p = NEW(CHAR, Repeat + 1)) == NULL)
|
|
|
|
|
return CSstay;
|
|
|
|
|
for (i = Repeat, q = p; --i >= 0; )
|
|
|
|
|
*q++ = c;
|
|
|
|
|
*q = '\0';
|
|
|
|
|
Repeat = 0;
|
|
|
|
|
s = insert_string(p);
|
|
|
|
|
DISPOSE(p);
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
meta(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned int c;
|
|
|
|
|
KEYMAP *kp;
|
|
|
|
|
|
|
|
|
|
if ((c = TTYget()) == EOF)
|
|
|
|
|
return CSeof;
|
|
|
|
|
/* Also include VT-100 arrows. */
|
|
|
|
|
if (c == '[' || c == 'O')
|
|
|
|
|
switch (c = TTYget()) {
|
|
|
|
|
default: return ring_bell();
|
|
|
|
|
case EOF: return CSeof;
|
|
|
|
|
case 'A': return h_prev();
|
|
|
|
|
case 'B': return h_next();
|
|
|
|
|
case 'C': return fd_char();
|
|
|
|
|
case 'D': return bk_char();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isdigit(c)) {
|
|
|
|
|
for (Repeat = c - '0'; (c = TTYget()) != EOF && isdigit(c); )
|
|
|
|
|
Repeat = Repeat * 10 + c - '0';
|
|
|
|
|
Pushed = 1;
|
|
|
|
|
PushBack = c;
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isupper(c))
|
|
|
|
|
return do_macro(c);
|
|
|
|
|
for (OldPoint = Point, kp = MetaMap; kp->Function; kp++)
|
|
|
|
|
if (kp->Key == c)
|
|
|
|
|
return (*kp->Function)();
|
|
|
|
|
|
|
|
|
|
return ring_bell();
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
emacs(unsigned int c)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
STATUS s;
|
|
|
|
|
KEYMAP *kp;
|
|
|
|
|
|
|
|
|
|
if (ISMETA(c)) {
|
|
|
|
|
Pushed = 1;
|
|
|
|
|
PushBack = UNMETA(c);
|
|
|
|
|
return meta();
|
|
|
|
|
}
|
|
|
|
|
for (kp = Map; kp->Function; kp++)
|
|
|
|
|
if (kp->Key == c)
|
|
|
|
|
break;
|
|
|
|
|
s = kp->Function ? (*kp->Function)() : insert_char((int)c);
|
|
|
|
|
if (!Pushed)
|
|
|
|
|
/* No pushback means no repeat count; hacky, but true. */
|
|
|
|
|
Repeat = NO_ARG;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
TTYspecial(unsigned int c)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (ISMETA(c))
|
|
|
|
|
return CSdispatch;
|
|
|
|
|
|
|
|
|
|
if (c == rl_erase || c == DEL)
|
|
|
|
|
return bk_del_char();
|
|
|
|
|
if (c == rl_kill) {
|
|
|
|
|
if (Point != 0) {
|
|
|
|
|
Point = 0;
|
|
|
|
|
reposition();
|
|
|
|
|
}
|
|
|
|
|
Repeat = NO_ARG;
|
|
|
|
|
return kill_line();
|
|
|
|
|
}
|
|
|
|
|
if (c == rl_intr || c == rl_quit) {
|
|
|
|
|
Point = End = 0;
|
|
|
|
|
Line[0] = '\0';
|
|
|
|
|
return redisplay();
|
|
|
|
|
}
|
|
|
|
|
if (c == rl_eof && Point == 0 && End == 0)
|
|
|
|
|
return CSeof;
|
|
|
|
|
|
|
|
|
|
return CSdispatch;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static CHAR *
|
1999-06-26 16:58:24 +02:00
|
|
|
|
editinput(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned int c;
|
|
|
|
|
|
|
|
|
|
Repeat = NO_ARG;
|
|
|
|
|
OldPoint = Point = Mark = End = 0;
|
|
|
|
|
Line[0] = '\0';
|
|
|
|
|
|
|
|
|
|
while ((c = TTYget()) != EOF)
|
|
|
|
|
switch (TTYspecial(c)) {
|
|
|
|
|
case CSdone:
|
|
|
|
|
return Line;
|
|
|
|
|
case CSeof:
|
|
|
|
|
return NULL;
|
|
|
|
|
case CSmove:
|
|
|
|
|
reposition();
|
|
|
|
|
break;
|
|
|
|
|
case CSdispatch:
|
|
|
|
|
switch (emacs(c)) {
|
|
|
|
|
case CSdone:
|
|
|
|
|
return Line;
|
|
|
|
|
case CSeof:
|
|
|
|
|
return NULL;
|
|
|
|
|
case CSmove:
|
|
|
|
|
reposition();
|
|
|
|
|
break;
|
|
|
|
|
case CSdispatch:
|
|
|
|
|
case CSstay:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CSstay:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
hist_add(CHAR *p)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
1999-04-25 14:24:42 +02:00
|
|
|
|
if ((p = (CHAR *)DBG_strdup((char *)p)) == NULL)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
return;
|
|
|
|
|
if (H.Size < HIST_SIZE)
|
|
|
|
|
H.Lines[H.Size++] = p;
|
|
|
|
|
else {
|
|
|
|
|
DISPOSE(H.Lines[0]);
|
|
|
|
|
for (i = 0; i < HIST_SIZE - 1; i++)
|
|
|
|
|
H.Lines[i] = H.Lines[i + 1];
|
|
|
|
|
H.Lines[i] = p;
|
|
|
|
|
}
|
|
|
|
|
H.Pos = H.Size - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *
|
1999-06-26 16:58:24 +02:00
|
|
|
|
readline(const char *prompt)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
CHAR *line;
|
|
|
|
|
|
|
|
|
|
if (Line == NULL) {
|
|
|
|
|
Length = MEM_INC;
|
|
|
|
|
if ((Line = NEW(CHAR, Length)) == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TTYinfo();
|
|
|
|
|
rl_ttyset(0);
|
|
|
|
|
hist_add(NIL);
|
|
|
|
|
ScreenSize = SCREEN_INC;
|
|
|
|
|
Screen = NEW(char, ScreenSize);
|
|
|
|
|
Prompt = prompt ? prompt : (char *)NIL;
|
|
|
|
|
TTYputs((CHAR *)Prompt);
|
|
|
|
|
if ((line = editinput()) != NULL) {
|
1999-04-25 14:24:42 +02:00
|
|
|
|
line = (CHAR *)DBG_strdup((char *)line);
|
1993-09-29 13:21:49 +01:00
|
|
|
|
TTYputs((CHAR *)NEWLINE);
|
|
|
|
|
TTYflush();
|
|
|
|
|
}
|
|
|
|
|
rl_ttyset(1);
|
|
|
|
|
DISPOSE(Screen);
|
|
|
|
|
DISPOSE(H.Lines[--H.Size]);
|
|
|
|
|
return (char *)line;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
1999-06-26 16:58:24 +02:00
|
|
|
|
add_history(char *p)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (p == NULL || *p == '\0')
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
#if defined(UNIQUE_HISTORY)
|
|
|
|
|
if (H.Pos && strcmp(p, H.Lines[H.Pos - 1]) == 0)
|
|
|
|
|
return;
|
|
|
|
|
#endif /* defined(UNIQUE_HISTORY) */
|
|
|
|
|
hist_add((CHAR *)p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
beg_line(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (Point) {
|
|
|
|
|
Point = 0;
|
|
|
|
|
return CSmove;
|
|
|
|
|
}
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
del_char(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return delete_string(Repeat == NO_ARG ? 1 : Repeat);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
end_line(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (Point != End) {
|
|
|
|
|
Point = End;
|
|
|
|
|
return CSmove;
|
|
|
|
|
}
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
accept_line(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
Line[End] = '\0';
|
|
|
|
|
return CSdone;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
transpose(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
CHAR c;
|
|
|
|
|
|
|
|
|
|
if (Point) {
|
|
|
|
|
if (Point == End)
|
|
|
|
|
left(CSmove);
|
|
|
|
|
c = Line[Point - 1];
|
|
|
|
|
left(CSstay);
|
|
|
|
|
Line[Point - 1] = Line[Point];
|
|
|
|
|
TTYshow(Line[Point - 1]);
|
|
|
|
|
Line[Point++] = c;
|
|
|
|
|
TTYshow(c);
|
|
|
|
|
}
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
quote(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned int c;
|
|
|
|
|
|
|
|
|
|
return (c = TTYget()) == EOF ? CSeof : insert_char((int)c);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
wipe(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (Mark > End)
|
|
|
|
|
return ring_bell();
|
|
|
|
|
|
|
|
|
|
if (Point > Mark) {
|
|
|
|
|
i = Point;
|
|
|
|
|
Point = Mark;
|
|
|
|
|
Mark = i;
|
|
|
|
|
reposition();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return delete_string(Mark - Point);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
mk_set(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
Mark = Point;
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
exchange(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned int c;
|
|
|
|
|
|
|
|
|
|
if ((c = TTYget()) != CTL('X'))
|
|
|
|
|
return c == EOF ? CSeof : ring_bell();
|
|
|
|
|
|
|
|
|
|
if ((c = Mark) <= End) {
|
|
|
|
|
Mark = Point;
|
|
|
|
|
Point = c;
|
|
|
|
|
return CSmove;
|
|
|
|
|
}
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
yank(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (Yanked && *Yanked)
|
|
|
|
|
return insert_string(Yanked);
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
copy_region(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
if (Mark > End)
|
|
|
|
|
return ring_bell();
|
|
|
|
|
|
|
|
|
|
if (Point > Mark)
|
|
|
|
|
save_yank(Mark, Point - Mark);
|
|
|
|
|
else
|
|
|
|
|
save_yank(Point, Mark - Point);
|
|
|
|
|
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
move_to_char(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned int c;
|
|
|
|
|
int i;
|
|
|
|
|
CHAR *p;
|
|
|
|
|
|
|
|
|
|
if ((c = TTYget()) == EOF)
|
|
|
|
|
return CSeof;
|
|
|
|
|
for (i = Point + 1, p = &Line[i]; i < End; i++, p++)
|
|
|
|
|
if (*p == c) {
|
|
|
|
|
Point = i;
|
|
|
|
|
return CSmove;
|
|
|
|
|
}
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
fd_word(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
return do_forward(CSmove);
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
fd_kill_word(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
(void)do_forward(CSstay);
|
|
|
|
|
if (OldPoint != Point) {
|
|
|
|
|
i = Point - OldPoint;
|
|
|
|
|
Point = OldPoint;
|
|
|
|
|
return delete_string(i);
|
|
|
|
|
}
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
bk_word(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
CHAR *p;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
do {
|
|
|
|
|
for (p = &Line[Point]; p > Line && !isalnum(p[-1]); p--)
|
|
|
|
|
left(CSmove);
|
|
|
|
|
|
|
|
|
|
for (; p > Line && p[-1] != ' ' && isalnum(p[-1]); p--)
|
|
|
|
|
left(CSmove);
|
|
|
|
|
|
|
|
|
|
if (Point == 0)
|
|
|
|
|
break;
|
|
|
|
|
} while (++i < Repeat);
|
|
|
|
|
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
bk_kill_word(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
(void)bk_word();
|
|
|
|
|
if (OldPoint != Point)
|
|
|
|
|
return delete_string(OldPoint - Point);
|
|
|
|
|
return CSstay;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static int
|
1999-06-26 16:58:24 +02:00
|
|
|
|
argify(CHAR *line, CHAR ***avp)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
CHAR *c;
|
|
|
|
|
CHAR **p;
|
|
|
|
|
CHAR **new;
|
|
|
|
|
int ac;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = MEM_INC;
|
|
|
|
|
if ((*avp = p = NEW(CHAR*, i))== NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (c = line; isspace(*c); c++)
|
|
|
|
|
continue;
|
|
|
|
|
if (*c == '\n' || *c == '\0')
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (ac = 0, p[ac++] = c; *c && *c != '\n'; ) {
|
|
|
|
|
if (isspace(*c)) {
|
|
|
|
|
*c++ = '\0';
|
|
|
|
|
if (*c && *c != '\n') {
|
|
|
|
|
if (ac + 1 == i) {
|
|
|
|
|
new = NEW(CHAR*, i + MEM_INC);
|
|
|
|
|
if (new == NULL) {
|
|
|
|
|
p[ac] = NULL;
|
|
|
|
|
return ac;
|
|
|
|
|
}
|
|
|
|
|
COPYFROMTO(new, p, i * sizeof (char **));
|
|
|
|
|
i += MEM_INC;
|
|
|
|
|
DISPOSE(p);
|
|
|
|
|
*avp = p = new;
|
|
|
|
|
}
|
|
|
|
|
p[ac++] = c;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
*c = '\0';
|
|
|
|
|
p[ac] = NULL;
|
|
|
|
|
return ac;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static STATUS
|
1999-06-26 16:58:24 +02:00
|
|
|
|
last_argument(void)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{
|
|
|
|
|
CHAR **av;
|
|
|
|
|
CHAR *p;
|
|
|
|
|
STATUS s;
|
|
|
|
|
int ac;
|
|
|
|
|
|
|
|
|
|
if (H.Size == 1 || (p = H.Lines[H.Size - 2]) == NULL)
|
|
|
|
|
return ring_bell();
|
|
|
|
|
|
1999-04-25 14:24:42 +02:00
|
|
|
|
if ((p = (CHAR *)DBG_strdup((char *)p)) == NULL)
|
1993-09-29 13:21:49 +01:00
|
|
|
|
return CSstay;
|
|
|
|
|
ac = argify(p, &av);
|
|
|
|
|
|
|
|
|
|
if (Repeat != NO_ARG)
|
|
|
|
|
s = Repeat < ac ? insert_string(av[Repeat]) : ring_bell();
|
|
|
|
|
else
|
|
|
|
|
s = ac ? insert_string(av[ac - 1]) : CSstay;
|
|
|
|
|
|
|
|
|
|
if (ac)
|
|
|
|
|
DISPOSE(av);
|
|
|
|
|
DISPOSE(p);
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static KEYMAP Map[33] = {
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{ CTL('@'), ring_bell },
|
|
|
|
|
{ CTL('A'), beg_line },
|
|
|
|
|
{ CTL('B'), bk_char },
|
|
|
|
|
{ CTL('D'), del_char },
|
|
|
|
|
{ CTL('E'), end_line },
|
|
|
|
|
{ CTL('F'), fd_char },
|
|
|
|
|
{ CTL('G'), ring_bell },
|
|
|
|
|
{ CTL('H'), bk_del_char },
|
Release 950727
Sat Jul 22 22:39:09 IDT 1995 Michael Veksler <e1678223@tochnapc2.technion.ac.il>
* [ipc/*]
New directory. This directory contains the new inter-wine
communications support. It enables DDE protocols between two wine
instances. Currently it is limited to DDE, but can be enhanced to
support OLE between 2 different wine instances. This is very
important for libwine.a DDE/OLE support.
* [tools/ipcl]
A script to delete garbage IPC handles (shared memory, semaphores
and message queues). The current inter-wine communication is not
perfect, and sometimes leaves garbage behind.
* [if1632/relay.c] [include/atom.h] [include/global.h]
[loader/selector.c] [loader/task.c] [loader/module.c]
[loader/signal.c] [memory/global.c] [misc/atom.c]
[windows/class.c] [windows/message.c] [windows/win.c]
[Imakefile]
Hooks for inter-wine DDE support, current Global.*Atom functions
renamed to Local.*Atom since Global.*Atom are used for Inter-Wine
DDE communication. (The first call to these functions sets up the
IPC structures - which otherwise cause unneeded overhead.
Mon Jul 17 19:55:21 1995 Alexandre Julliard <julliard@sunsite.unc.edu>
* [controls/menu.c]
Don't crash if a NULL string is passed to menu functions.
* [memory/selector.c]
We now use a bit in ldt_flags_copy to indicate free LDT entries.
Fixed a bug in SELECTOR_ReallocBlock that could cause it to
overwrite valid LDT entries when growing a block.
* [miscemu/instr.c]
Emulate int xx instruction by storing the interrupt vector in
CS:IP and returning directly. This allows a program to install an
interrupt vector.
* [windows/win.c]
Added function WIN_GetTopParent to get the top-level parent of a
window.
Sun Jul 16 18:17:17 1995 Gregory Trubetskoy <grisha@mira.com>
* [loader/resource.c]
Added LoadIconHandler. It doesn't do anything yet, but now you
can use borland help files with winhelp.exe.
Sun Jul 16 11:58:45 1995 Anand Kumria <akumria@ozemail.com.au>
* [misc/main.c]
Fixed to return 386 Enhanced mode correctly. Also return the same
type of CPU, for both Enhanced and Standard mode, namely a 386.
Sun Jul 16 00:02:04 1995 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [Configure] [include/options.h] [include/wineopts.h]
[misc/main.c][misc/spy.c]
Removed support of spy file. Redirected spy messages to stddeb.
Removed -spy option. Added -debugmsg +spy option.
* [debugger/dbg.y][debugger/debug.l]
Enabled segmented addresses (seg:offs) for break and x commands.
* [if1632/gdi.spec] [objects/region.c] [windows/graphics.c]
[include/region.h]
FrameRgn, REGION_FrameRgn: New functions
* [if1632/kernel.spec]
IsWinOldApTask: Return false
* [if1632/mouse.spec]
CplApplet: Removed
* [if1632/user.spec] [windows/win.c]
ShowOwnedPopups: New function
* [if1632/winsock.spec] [misc/winsocket.c]
inet_addr, select: New prototypes in relay code
Fixed memory layout for netdb functions (getXbyY).
WINSOCK_ioctlsocket: Translated FIONREAD, FIONBIO, and FIOASYNC
* [objects/clipping.c]
RectVisible: Fixed call to LPToDP
* [rc/winerc.c]
main: Removed extra argument to getopt for Linux.
Tue Jul 11 00:14:41 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [controls/listbox.c]
Yet another fix for ListBoxDirectory().
* [loader/module.c] [if1632/kernel.spec]
Make GetModuleHandle() accept instance handles as parameter.
* [if1632/relay.c] [loader/task.c]
Put a magic cookie at the bottom of the 32 bit stack, and check on
each return from a 32 bit function whether it's still there. Complain
if it's not.
* [if1632/user.spec]
Wrong entry for CloseDriver().
* [misc/dos_fs.c] [loader/task.c] [include/dos_fs.h] [misc/file.c]
[miscemu/int21.c]
Large parts of dos_fs.c simplified. Changed it to use one
current drive/directory per task, which is set to the module path on
task creation.
Prevent CorelPaint from closing stdin.
open() with O_CREAT set must be passed three parameters.
DOS FindFirst()/FindNext() could crash when FA_LABEL was set. Fixed,
it's in DOS_readdir() now.
* [misc/profile.c]
Some badly written software (Lotus Freelance Graphics) passes a bogus
size parameter that caused Wine to write off the end of a segment.
Fixed. (It's probably too paranoid now.)
* [multimedia/mmsystem.c] [multimedia/time.c] [multimedia/joystick.c]
[multimedia/Imakefile] [if1632/winprocs.spec]
16 bit entry point for MMSysTimeCallback.
Split off time.c and joystick.c from mmsystem.c.
* [objects/dib.c]
GetDIBits(): call XGetImage() via CallTo32_LargeStack.
* [windows/cursor.c]
DestroyCursor(): do nothing for builtin cursors.
* [windows/mdi.c]
Half of WM_MDISETMENU implemented.
* [windows/win.c]
EnumWindows() and EnumTaskWindows() never enumerated any windows.
Fixed.
* [windows/*.c]
Fixed GetParent() to return correct values for owned windows.
* [windows/message.c]
Don't try to activate disabled top-level windows.
* [windows/nonclient.c]
Work around a bug in gcc-2.7.0.
* [tools/build.c] [include/stackframe.h] [memory/global.c]
[loader/task.c] [memory/selector.c]
Some Visual Basic programs (and possibly others, too) expect ES to be
preserved by a call to an API function, so we have to save it.
In GlobalFree() and FreeSelector(), we must clear CURRENT_STACK16->es
to prevent segfaults if ES contained the selector to be freed.
Sun Jul 9 20:21:20 1995 Jon Tombs <jon@gtex02.us.es>
* [*/*]
Added missing prototypes to header files and relevant includes
to reduce compile time warnings.
Sun Jul 9 18:32:56 1995 Michael Patra <micky@marie.physik.tu-berlin.de>
* [configure.in] [include/config.h] [*/Makefile.in]
New configuration scheme based on autoconf.
Sat Jul 8 14:12:45 1995 Morten Welinder <terra+@cs.cmu.edu>
* [miscemu/ioports.c]
Revamp to have only one in- and one out- variant, both really
implemented.
* [miscemu/instr.c]
INSTR_EmulateInstruction: Use new ioport interface. Implement
string io. Correct instruction pointer for 32-bit code.
* [include/miscemu.h]
Update port function prototypes.
* [include/registers.h]
Defined FS and GS.
Sat Jul 8 13:38:54 1995 Hans de Graaff <graaff@twi72.twi.tudelft.nl>
* [misc/dos_fs.c]
ChopOffSlash(): A path consisting off a single slash is left
intact, and multiple slashes are all removed.
1995-07-29 15:09:43 +02:00
|
|
|
|
{ CTL('I'), ring_bell },
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{ CTL('J'), accept_line },
|
|
|
|
|
{ CTL('K'), kill_line },
|
|
|
|
|
{ CTL('L'), redisplay },
|
|
|
|
|
{ CTL('M'), accept_line },
|
|
|
|
|
{ CTL('N'), h_next },
|
|
|
|
|
{ CTL('O'), ring_bell },
|
|
|
|
|
{ CTL('P'), h_prev },
|
|
|
|
|
{ CTL('Q'), ring_bell },
|
|
|
|
|
{ CTL('R'), h_search },
|
|
|
|
|
{ CTL('S'), ring_bell },
|
|
|
|
|
{ CTL('T'), transpose },
|
|
|
|
|
{ CTL('U'), ring_bell },
|
|
|
|
|
{ CTL('V'), quote },
|
|
|
|
|
{ CTL('W'), wipe },
|
|
|
|
|
{ CTL('X'), exchange },
|
|
|
|
|
{ CTL('Y'), yank },
|
|
|
|
|
{ CTL('Z'), ring_bell },
|
|
|
|
|
{ CTL('['), meta },
|
|
|
|
|
{ CTL(']'), move_to_char },
|
|
|
|
|
{ CTL('^'), ring_bell },
|
|
|
|
|
{ CTL('_'), ring_bell },
|
|
|
|
|
{ 0, NULL }
|
|
|
|
|
};
|
|
|
|
|
|
1996-07-17 22:02:21 +02:00
|
|
|
|
static KEYMAP MetaMap[16]= {
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{ CTL('H'), bk_kill_word },
|
|
|
|
|
{ DEL, bk_kill_word },
|
|
|
|
|
{ ' ', mk_set },
|
|
|
|
|
{ '.', last_argument },
|
|
|
|
|
{ '<', h_first },
|
|
|
|
|
{ '>', h_last },
|
Release 950727
Sat Jul 22 22:39:09 IDT 1995 Michael Veksler <e1678223@tochnapc2.technion.ac.il>
* [ipc/*]
New directory. This directory contains the new inter-wine
communications support. It enables DDE protocols between two wine
instances. Currently it is limited to DDE, but can be enhanced to
support OLE between 2 different wine instances. This is very
important for libwine.a DDE/OLE support.
* [tools/ipcl]
A script to delete garbage IPC handles (shared memory, semaphores
and message queues). The current inter-wine communication is not
perfect, and sometimes leaves garbage behind.
* [if1632/relay.c] [include/atom.h] [include/global.h]
[loader/selector.c] [loader/task.c] [loader/module.c]
[loader/signal.c] [memory/global.c] [misc/atom.c]
[windows/class.c] [windows/message.c] [windows/win.c]
[Imakefile]
Hooks for inter-wine DDE support, current Global.*Atom functions
renamed to Local.*Atom since Global.*Atom are used for Inter-Wine
DDE communication. (The first call to these functions sets up the
IPC structures - which otherwise cause unneeded overhead.
Mon Jul 17 19:55:21 1995 Alexandre Julliard <julliard@sunsite.unc.edu>
* [controls/menu.c]
Don't crash if a NULL string is passed to menu functions.
* [memory/selector.c]
We now use a bit in ldt_flags_copy to indicate free LDT entries.
Fixed a bug in SELECTOR_ReallocBlock that could cause it to
overwrite valid LDT entries when growing a block.
* [miscemu/instr.c]
Emulate int xx instruction by storing the interrupt vector in
CS:IP and returning directly. This allows a program to install an
interrupt vector.
* [windows/win.c]
Added function WIN_GetTopParent to get the top-level parent of a
window.
Sun Jul 16 18:17:17 1995 Gregory Trubetskoy <grisha@mira.com>
* [loader/resource.c]
Added LoadIconHandler. It doesn't do anything yet, but now you
can use borland help files with winhelp.exe.
Sun Jul 16 11:58:45 1995 Anand Kumria <akumria@ozemail.com.au>
* [misc/main.c]
Fixed to return 386 Enhanced mode correctly. Also return the same
type of CPU, for both Enhanced and Standard mode, namely a 386.
Sun Jul 16 00:02:04 1995 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [Configure] [include/options.h] [include/wineopts.h]
[misc/main.c][misc/spy.c]
Removed support of spy file. Redirected spy messages to stddeb.
Removed -spy option. Added -debugmsg +spy option.
* [debugger/dbg.y][debugger/debug.l]
Enabled segmented addresses (seg:offs) for break and x commands.
* [if1632/gdi.spec] [objects/region.c] [windows/graphics.c]
[include/region.h]
FrameRgn, REGION_FrameRgn: New functions
* [if1632/kernel.spec]
IsWinOldApTask: Return false
* [if1632/mouse.spec]
CplApplet: Removed
* [if1632/user.spec] [windows/win.c]
ShowOwnedPopups: New function
* [if1632/winsock.spec] [misc/winsocket.c]
inet_addr, select: New prototypes in relay code
Fixed memory layout for netdb functions (getXbyY).
WINSOCK_ioctlsocket: Translated FIONREAD, FIONBIO, and FIOASYNC
* [objects/clipping.c]
RectVisible: Fixed call to LPToDP
* [rc/winerc.c]
main: Removed extra argument to getopt for Linux.
Tue Jul 11 00:14:41 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [controls/listbox.c]
Yet another fix for ListBoxDirectory().
* [loader/module.c] [if1632/kernel.spec]
Make GetModuleHandle() accept instance handles as parameter.
* [if1632/relay.c] [loader/task.c]
Put a magic cookie at the bottom of the 32 bit stack, and check on
each return from a 32 bit function whether it's still there. Complain
if it's not.
* [if1632/user.spec]
Wrong entry for CloseDriver().
* [misc/dos_fs.c] [loader/task.c] [include/dos_fs.h] [misc/file.c]
[miscemu/int21.c]
Large parts of dos_fs.c simplified. Changed it to use one
current drive/directory per task, which is set to the module path on
task creation.
Prevent CorelPaint from closing stdin.
open() with O_CREAT set must be passed three parameters.
DOS FindFirst()/FindNext() could crash when FA_LABEL was set. Fixed,
it's in DOS_readdir() now.
* [misc/profile.c]
Some badly written software (Lotus Freelance Graphics) passes a bogus
size parameter that caused Wine to write off the end of a segment.
Fixed. (It's probably too paranoid now.)
* [multimedia/mmsystem.c] [multimedia/time.c] [multimedia/joystick.c]
[multimedia/Imakefile] [if1632/winprocs.spec]
16 bit entry point for MMSysTimeCallback.
Split off time.c and joystick.c from mmsystem.c.
* [objects/dib.c]
GetDIBits(): call XGetImage() via CallTo32_LargeStack.
* [windows/cursor.c]
DestroyCursor(): do nothing for builtin cursors.
* [windows/mdi.c]
Half of WM_MDISETMENU implemented.
* [windows/win.c]
EnumWindows() and EnumTaskWindows() never enumerated any windows.
Fixed.
* [windows/*.c]
Fixed GetParent() to return correct values for owned windows.
* [windows/message.c]
Don't try to activate disabled top-level windows.
* [windows/nonclient.c]
Work around a bug in gcc-2.7.0.
* [tools/build.c] [include/stackframe.h] [memory/global.c]
[loader/task.c] [memory/selector.c]
Some Visual Basic programs (and possibly others, too) expect ES to be
preserved by a call to an API function, so we have to save it.
In GlobalFree() and FreeSelector(), we must clear CURRENT_STACK16->es
to prevent segfaults if ES contained the selector to be freed.
Sun Jul 9 20:21:20 1995 Jon Tombs <jon@gtex02.us.es>
* [*/*]
Added missing prototypes to header files and relevant includes
to reduce compile time warnings.
Sun Jul 9 18:32:56 1995 Michael Patra <micky@marie.physik.tu-berlin.de>
* [configure.in] [include/config.h] [*/Makefile.in]
New configuration scheme based on autoconf.
Sat Jul 8 14:12:45 1995 Morten Welinder <terra+@cs.cmu.edu>
* [miscemu/ioports.c]
Revamp to have only one in- and one out- variant, both really
implemented.
* [miscemu/instr.c]
INSTR_EmulateInstruction: Use new ioport interface. Implement
string io. Correct instruction pointer for 32-bit code.
* [include/miscemu.h]
Update port function prototypes.
* [include/registers.h]
Defined FS and GS.
Sat Jul 8 13:38:54 1995 Hans de Graaff <graaff@twi72.twi.tudelft.nl>
* [misc/dos_fs.c]
ChopOffSlash(): A path consisting off a single slash is left
intact, and multiple slashes are all removed.
1995-07-29 15:09:43 +02:00
|
|
|
|
{ '?', ring_bell },
|
1993-09-29 13:21:49 +01:00
|
|
|
|
{ 'b', bk_word },
|
|
|
|
|
{ 'd', fd_kill_word },
|
|
|
|
|
{ 'f', fd_word },
|
|
|
|
|
{ 'l', case_down_word },
|
|
|
|
|
{ 'u', case_up_word },
|
|
|
|
|
{ 'y', yank },
|
|
|
|
|
{ 'w', copy_region },
|
|
|
|
|
{ 0, NULL }
|
|
|
|
|
};
|