0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.0.0769: build problems with terminal on MS-Windows

Problem:    Build problems with terminal on MS-Windows using MSVC.
Solution:   Remove stdbool.h dependency. Only use ScreenLinesUC when it was
            allocated. Fix typos. (Ken Takata)
This commit is contained in:
Bram Moolenaar
2017-07-24 22:29:21 +02:00
parent 2155441460
commit 8a77306fa1
8 changed files with 71 additions and 42 deletions

View File

@@ -1,3 +1,5 @@
CFLAGS = /DINLINE= /Iinclude
OBJS = \
src\encoding.c \
src\keyboard.c \
@@ -24,7 +26,10 @@ all : vterm.lib
.c.obj :
cl /DINLINE= /Iinclude /Fo$@ /c $<
cl $(CFLAGS) /Fo$@ /c $<
vterm.lib : $(OBJS)
lib /OUT:$@ $(OBJS)
clean:
del $(OBJS) vterm.lib

View File

@@ -1,10 +1,11 @@
#define _XOPEN_SOURCE 500 /* strdup */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define streq(a,b) (strcmp(a,b)==0)
#define TRUE 1
#define FALSE 0
#include <termios.h>
@@ -60,13 +61,14 @@ static char *helptext[] = {
NULL
};
static bool seticanon(bool icanon, bool echo)
static int seticanon(int icanon, int echo)
{
struct termios termios;
int ret;
tcgetattr(0, &termios);
bool ret = (termios.c_lflag & ICANON);
ret = (termios.c_lflag & ICANON);
if(icanon) termios.c_lflag |= ICANON;
else termios.c_lflag &= ~ICANON;
@@ -84,16 +86,16 @@ static void await_c1(int c1)
int c;
/* await CSI - 8bit or 2byte 7bit form */
bool in_esc = false;
int in_esc = FALSE;
while((c = getchar())) {
if(c == c1)
break;
if(in_esc && c == (char)(c1 - 0x40))
break;
if(!in_esc && c == 0x1b)
in_esc = true;
in_esc = TRUE;
else
in_esc = false;
in_esc = FALSE;
}
}
@@ -121,7 +123,7 @@ static char *read_csi()
static char *read_dcs()
{
unsigned char dcs[32];
bool in_esc = false;
int in_esc = FALSE;
int i;
await_c1(0x90);
@@ -133,10 +135,10 @@ static char *read_dcs()
if(in_esc && c == 0x5c)
break;
if(!in_esc && c == 0x1b)
in_esc = true;
in_esc = TRUE;
else {
dcs[i++] = c;
in_esc = false;
in_esc = FALSE;
}
}
dcs[++i] = 0;
@@ -158,7 +160,7 @@ static void usage(int exitcode)
exit(exitcode);
}
static bool query_dec_mode(int mode)
static int query_dec_mode(int mode)
{
char *s = NULL;
@@ -189,12 +191,12 @@ static bool query_dec_mode(int mode)
free(s);
if(reply_value == 1 || reply_value == 3)
return true;
return TRUE;
if(reply_value == 2 || reply_value == 4)
return false;
return FALSE;
printf("Unrecognised reply to DECRQM: %d\n", reply_value);
return false;
return FALSE;
} while(1);
}
@@ -247,11 +249,11 @@ static int query_rqss_numeric(char *cmd)
} while(1);
}
bool wasicanon;
int wasicanon;
void restoreicanon(void)
{
seticanon(wasicanon, true);
seticanon(wasicanon, TRUE);
}
int main(int argc, char *argv[])
@@ -261,7 +263,7 @@ int main(int argc, char *argv[])
if(argc == 1)
usage(0);
wasicanon = seticanon(false, false);
wasicanon = seticanon(FALSE, FALSE);
atexit(restoreicanon);
while(argi < argc) {