0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.1.2395: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
This commit is contained in:
Bram Moolenaar
2019-12-05 21:33:15 +01:00
parent 63d9e730f7
commit 0d6f5d9740
9 changed files with 3175 additions and 3188 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

651
src/tag.c

File diff suppressed because it is too large Load Diff

1039
src/term.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5,10 +5,10 @@
* inclusion of this notice. * inclusion of this notice.
*/ */
/* Modified by Bram Moolenaar for use with VIM - Vi Improved. */ // Modified by Bram Moolenaar for use with VIM - Vi Improved.
/* A few bugs removed by Olaf 'Rhialto' Seibert. */ // A few bugs removed by Olaf 'Rhialto' Seibert.
/* TERMLIB: Terminal independent database. */ // TERMLIB: Terminal independent database.
#include "vim.h" #include "vim.h"
#include "termlib.pro" #include "termlib.pro"
@@ -27,10 +27,10 @@ static char *_find(char *, char *);
* Global variables for termlib * Global variables for termlib
*/ */
char *tent; /* Pointer to terminal entry, set by tgetent */ char *tent; // Pointer to terminal entry, set by tgetent
char PC = 0; /* Pad character, default NULL */ char PC = 0; // Pad character, default NULL
char *UP = 0, *BC = 0; /* Pointers to UP and BC strings from database */ char *UP = 0, *BC = 0; // Pointers to UP and BC strings from database
short ospeed; /* Baud rate (1-16, 1=300, 16=19200), as in stty */ short ospeed; // Baud rate (1-16, 1=300, 16=19200), as in stty
/* /*
* Module: tgetent * Module: tgetent
@@ -67,12 +67,12 @@ short ospeed; /* Baud rate (1-16, 1=300, 16=19200), as in stty */
int int
tgetent( tgetent(
char *tbuf, /* Buffer to hold termcap entry, TBUFSZ bytes max */ char *tbuf, // Buffer to hold termcap entry, TBUFSZ bytes max
char *term) /* Name of terminal */ char *term) // Name of terminal
{ {
char tcbuf[32]; /* Temp buffer to handle */ char tcbuf[32]; // Temp buffer to handle
char *tcptr = tcbuf; /* extended entries */ char *tcptr = tcbuf; // extended entries
char *tcap = TERMCAPFILE; /* Default termcap file */ char *tcap = TERMCAPFILE; // Default termcap file
char *tmp; char *tmp;
FILE *termcap; FILE *termcap;
int retval = 0; int retval = 0;
@@ -80,28 +80,28 @@ tgetent(
if ((tmp = (char *)mch_getenv((char_u *)"TERMCAP")) != NULL) if ((tmp = (char *)mch_getenv((char_u *)"TERMCAP")) != NULL)
{ {
if (*tmp == '/') /* TERMCAP = name of termcap file */ if (*tmp == '/') // TERMCAP = name of termcap file
{ {
tcap = tmp ; tcap = tmp ;
#if defined(AMIGA) #if defined(AMIGA)
/* Convert /usr/share/lib/termcap to usr:share/lib/termcap */ // Convert /usr/share/lib/termcap to usr:share/lib/termcap
tcap++; tcap++;
tmp = strchr(tcap, '/'); tmp = strchr(tcap, '/');
if (tmp) if (tmp)
*tmp = ':'; *tmp = ':';
#endif #endif
} }
else /* TERMCAP = termcap entry itself */ else // TERMCAP = termcap entry itself
{ {
int tlen = strlen(term); int tlen = strlen(term);
while (*tmp && *tmp != ':') /* Check if TERM matches */ while (*tmp && *tmp != ':') // Check if TERM matches
{ {
char *nexttmp; char *nexttmp;
while (*tmp == '|') while (*tmp == '|')
tmp++; tmp++;
nexttmp = _find(tmp, ":|"); /* Rhialto */ nexttmp = _find(tmp, ":|"); // Rhialto
if (tmp+tlen == nexttmp && _match(tmp, term) == tlen) if (tmp+tlen == nexttmp && _match(tmp, term) == tlen)
{ {
strcpy(tbuf, tmp); strcpy(tbuf, tmp);
@@ -122,8 +122,8 @@ tgetent(
len = 0; len = 0;
while (getent(tbuf + len, term, termcap, TBUFSZ - len)) while (getent(tbuf + len, term, termcap, TBUFSZ - len))
{ {
tcptr = tcbuf; /* Rhialto */ tcptr = tcbuf; // Rhialto
if ((term = tgetstr("tc", &tcptr))) /* extended entry */ if ((term = tgetstr("tc", &tcptr))) // extended entry
{ {
rewind(termcap); rewind(termcap);
len = strlen(tbuf); len = strlen(tbuf);
@@ -131,7 +131,7 @@ tgetent(
else else
{ {
retval = 1; retval = 1;
tent = tbuf; /* reset it back to the beginning */ tent = tbuf; // reset it back to the beginning
break; break;
} }
} }
@@ -145,23 +145,23 @@ getent(char *tbuf, char *term, FILE *termcap, int buflen)
char *tptr; char *tptr;
int tlen = strlen(term); int tlen = strlen(term);
while (nextent(tbuf, termcap, buflen)) /* For each possible entry */ while (nextent(tbuf, termcap, buflen)) // For each possible entry
{ {
tptr = tbuf; tptr = tbuf;
while (*tptr && *tptr != ':') /* : terminates name field */ while (*tptr && *tptr != ':') // : terminates name field
{ {
char *nexttptr; char *nexttptr;
while (*tptr == '|') /* | separates names */ while (*tptr == '|') // | separates names
tptr++; tptr++;
nexttptr = _find(tptr, ":|"); /* Rhialto */ nexttptr = _find(tptr, ":|"); // Rhialto
if (tptr + tlen == nexttptr && if (tptr + tlen == nexttptr &&
_match(tptr, term) == tlen) /* FOUND! */ _match(tptr, term) == tlen) // FOUND!
{ {
tent = tbuf; tent = tbuf;
return 1; return 1;
} }
else /* Look for next name */ else // Look for next name
tptr = nexttptr; tptr = nexttptr;
} }
} }
@@ -174,33 +174,33 @@ getent(char *tbuf, char *term, FILE *termcap, int buflen)
static int static int
nextent(char *tbuf, FILE *termcap, int buflen) nextent(char *tbuf, FILE *termcap, int buflen)
{ {
char *lbuf = tbuf; /* lbuf=line buffer */ char *lbuf = tbuf; // lbuf=line buffer
/* read lines straight into buffer */ // read lines straight into buffer
while (lbuf < tbuf+buflen && /* There's room and */ while (lbuf < tbuf+buflen && // There's room and
fgets(lbuf, (int)(tbuf+buflen-lbuf), termcap)) /* another line */ fgets(lbuf, (int)(tbuf+buflen-lbuf), termcap)) // another line
{ {
int llen = strlen(lbuf); int llen = strlen(lbuf);
if (*lbuf == '#') /* eat comments */ if (*lbuf == '#') // eat comments
continue; continue;
if (lbuf[-1] == ':' && /* and whitespace */ if (lbuf[-1] == ':' && // and whitespace
lbuf[0] == '\t' && lbuf[0] == '\t' &&
lbuf[1] == ':') lbuf[1] == ':')
{ {
STRMOVE(lbuf, lbuf + 2); STRMOVE(lbuf, lbuf + 2);
llen -= 2; llen -= 2;
} }
if (lbuf[llen-2] == '\\') /* and continuations */ if (lbuf[llen-2] == '\\') // and continuations
lbuf += llen-2; lbuf += llen-2;
else else
{ {
lbuf[llen-1]=0; /* no continuation, return */ lbuf[llen-1]=0; // no continuation, return
return 1; return 1;
} }
} }
return 0; /* ran into end of file */ return 0; // ran into end of file
} }
/* /*
@@ -280,44 +280,44 @@ tgetstr(char *id, char **buf)
int i; int i;
do { do {
tmp = _find(tmp, ":"); /* For each field */ tmp = _find(tmp, ":"); // For each field
while (*tmp == ':') /* skip empty fields */ while (*tmp == ':') // skip empty fields
tmp++; tmp++;
if (!*tmp) if (!*tmp)
break; break;
if (_match(id, tmp) == len) { if (_match(id, tmp) == len) {
tmp += len; /* find '=' '@' or '#' */ tmp += len; // find '=' '@' or '#'
if (*tmp == '@') /* :xx@: entry for tc */ if (*tmp == '@') // :xx@: entry for tc
return 0; /* deleted entry */ return 0; // deleted entry
hold= *buf; hold= *buf;
while (*++tmp && *tmp != ':') { /* not at end of field */ while (*++tmp && *tmp != ':') { // not at end of field
switch(*tmp) { switch(*tmp) {
case '\\': /* Expand escapes here */ case '\\': // Expand escapes here
switch(*++tmp) { switch(*++tmp) {
case 0: /* ignore backslashes */ case 0: // ignore backslashes
tmp--; /* at end of entry */ tmp--; // at end of entry
break; /* shouldn't happen */ break; // shouldn't happen
case 'e': case 'e':
case 'E': /* ESC */ case 'E': // ESC
*(*buf)++ = ESC; *(*buf)++ = ESC;
break; break;
case 'n': /* \n */ case 'n': // \n
*(*buf)++ = '\n'; *(*buf)++ = '\n';
break; break;
case 'r': /* \r */ case 'r': // \r
*(*buf)++ = '\r'; *(*buf)++ = '\r';
break; break;
case 't': /* \t */ case 't': // \t
*(*buf)++ = '\t'; *(*buf)++ = '\t';
break; break;
case 'b': /* \b */ case 'b': // \b
*(*buf)++ = '\b'; *(*buf)++ = '\b';
break; break;
case 'f': /* \f */ case 'f': // \f
*(*buf)++ = '\f'; *(*buf)++ = '\f';
break; break;
case '0': /* \nnn */ case '0': // \nnn
case '1': case '1':
case '2': case '2':
case '3': case '3':
@@ -328,17 +328,17 @@ tgetstr(char *id, char **buf)
case '8': case '8':
case '9': case '9':
**buf = 0; **buf = 0;
/* get up to three digits */ // get up to three digits
for (i = 0; i < 3 && VIM_ISDIGIT(*tmp); ++i) for (i = 0; i < 3 && VIM_ISDIGIT(*tmp); ++i)
**buf = **buf * 8 + *tmp++ - '0'; **buf = **buf * 8 + *tmp++ - '0';
(*buf)++; (*buf)++;
tmp--; tmp--;
break; break;
default: /* \x, for all other x */ default: // \x, for all other x
*(*buf)++= *tmp; *(*buf)++= *tmp;
} }
break; break;
case '^': /* control characters */ case '^': // control characters
++tmp; ++tmp;
*(*buf)++ = Ctrl_chr(*tmp); *(*buf)++ = Ctrl_chr(*tmp);
break; break;
@@ -382,96 +382,96 @@ tgetstr(char *id, char **buf)
char * char *
tgoto( tgoto(
char *cm, /* cm string, from termcap */ char *cm, // cm string, from termcap
int col, /* column, x position */ int col, // column, x position
int line) /* line, y position */ int line) // line, y position
{ {
char gx, gy, /* x, y */ char gx, gy, // x, y
*ptr, /* pointer in 'cm' */ *ptr, // pointer in 'cm'
reverse = 0, /* reverse flag */ reverse = 0, // reverse flag
*bufp, /* pointer in returned string */ *bufp, // pointer in returned string
addup = 0, /* add upline */ addup = 0, // add upline
addbak = 0, /* add backup */ addbak = 0, // add backup
c; c;
static char buffer[32]; static char buffer[32];
if (!cm) if (!cm)
return "OOPS"; /* Kludge, but standard */ return "OOPS"; // Kludge, but standard
bufp = buffer; bufp = buffer;
ptr = cm; ptr = cm;
while (*ptr) { while (*ptr) {
if ((c = *ptr++) != '%') { /* normal char */ if ((c = *ptr++) != '%') { // normal char
*bufp++ = c; *bufp++ = c;
} else { /* % escape */ } else { // % escape
switch(c = *ptr++) { switch(c = *ptr++) {
case 'd': /* decimal */ case 'd': // decimal
bufp = _addfmt(bufp, "%d", line); bufp = _addfmt(bufp, "%d", line);
line = col; line = col;
break; break;
case '2': /* 2 digit decimal */ case '2': // 2 digit decimal
bufp = _addfmt(bufp, "%02d", line); bufp = _addfmt(bufp, "%02d", line);
line = col; line = col;
break; break;
case '3': /* 3 digit decimal */ case '3': // 3 digit decimal
bufp = _addfmt(bufp, "%03d", line); bufp = _addfmt(bufp, "%03d", line);
line = col; line = col;
break; break;
case '>': /* %>xy: if >x, add y */ case '>': // %>xy: if >x, add y
gx = *ptr++; gx = *ptr++;
gy = *ptr++; gy = *ptr++;
if (col>gx) col += gy; if (col>gx) col += gy;
if (line>gx) line += gy; if (line>gx) line += gy;
break; break;
case '+': /* %+c: add c */ case '+': // %+c: add c
line += *ptr++; line += *ptr++;
case '.': /* print x/y */ case '.': // print x/y
if (line == '\t' || /* these are */ if (line == '\t' || // these are
line == '\n' || /* chars that */ line == '\n' || // chars that
line == '\004' || /* UNIX hates */ line == '\004' || // UNIX hates
line == '\0') { line == '\0') {
line++; /* so go to next pos */ line++; // so go to next pos
if (reverse == (line == col)) if (reverse == (line == col))
addup=1; /* and mark UP */ addup=1; // and mark UP
else else
addbak=1; /* or BC */ addbak=1; // or BC
} }
*bufp++=line; *bufp++=line;
line = col; line = col;
break; break;
case 'r': /* r: reverse */ case 'r': // r: reverse
gx = line; gx = line;
line = col; line = col;
col = gx; col = gx;
reverse = 1; reverse = 1;
break; break;
case 'i': /* increment (1-origin screen) */ case 'i': // increment (1-origin screen)
col++; col++;
line++; line++;
break; break;
case '%': /* %%=% literally */ case '%': // %%=% literally
*bufp++='%'; *bufp++='%';
break; break;
case 'n': /* magic DM2500 code */ case 'n': // magic DM2500 code
line ^= 0140; line ^= 0140;
col ^= 0140; col ^= 0140;
break; break;
case 'B': /* bcd encoding */ case 'B': // bcd encoding
line = line/10<<4+line%10; line = line/10<<4+line%10;
col = col/10<<4+col%10; col = col/10<<4+col%10;
break; break;
case 'D': /* magic Delta Data code */ case 'D': // magic Delta Data code
line = line-2*(line&15); line = line-2*(line&15);
col = col-2*(col&15); col = col-2*(col&15);
break; break;
default: /* Unknown escape */ default: // Unknown escape
return "OOPS"; return "OOPS";
} }
} }
} }
if (addup) /* add upline */ if (addup) // add upline
if (UP) { if (UP) {
ptr=UP; ptr=UP;
while (VIM_ISDIGIT(*ptr) || *ptr == '.') while (VIM_ISDIGIT(*ptr) || *ptr == '.')
@@ -482,7 +482,7 @@ tgoto(
*bufp++ = *ptr++; *bufp++ = *ptr++;
} }
if (addbak) /* add backspace */ if (addbak) // add backspace
if (BC) { if (BC) {
ptr=BC; ptr=BC;
while (VIM_ISDIGIT(*ptr) || *ptr == '.') while (VIM_ISDIGIT(*ptr) || *ptr == '.')
@@ -528,12 +528,12 @@ long _bauds[16]={
int int
tputs( tputs(
char *cp, /* string to print */ char *cp, // string to print
int affcnt, /* Number of lines affected */ int affcnt, // Number of lines affected
void (*outc)(unsigned int)) /* routine to output 1 character */ void (*outc)(unsigned int)) // routine to output 1 character
{ {
long frac, /* 10^(#digits after decimal point) */ long frac, // 10^(#digits after decimal point)
counter, /* digits */ counter, // digits
atol(const char *); atol(const char *);
if (VIM_ISDIGIT(*cp)) { if (VIM_ISDIGIT(*cp)) {
@@ -546,20 +546,20 @@ tputs(
counter = counter * 10L + (long)(*cp++ - '0'); counter = counter * 10L + (long)(*cp++ - '0');
frac = frac * 10; frac = frac * 10;
} }
if (*cp!='*') { /* multiply by affected lines */ if (*cp!='*') { // multiply by affected lines
if (affcnt>1) affcnt = 1; if (affcnt>1) affcnt = 1;
} }
else else
cp++; cp++;
/* Calculate number of characters for padding counter/frac ms delay */ // Calculate number of characters for padding counter/frac ms delay
if (ospeed) if (ospeed)
counter = (counter * _bauds[ospeed] * (long)affcnt) / frac; counter = (counter * _bauds[ospeed] * (long)affcnt) / frac;
while (*cp) /* output string */ while (*cp) // output string
(*outc)(*cp++); (*outc)(*cp++);
if (ospeed) if (ospeed)
while (counter--) /* followed by pad characters */ while (counter--) // followed by pad characters
(*outc)(PC); (*outc)(PC);
} }
else else

View File

@@ -813,8 +813,8 @@ f_test_refcount(typval_T *argvars, typval_T *rettv)
void void
f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED) f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{ {
/* This is dangerous, any Lists and Dicts used internally may be freed // This is dangerous, any Lists and Dicts used internally may be freed
* while still in use. */ // while still in use.
garbage_collect(TRUE); garbage_collect(TRUE);
} }

View File

@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2395,
/**/ /**/
2394, 2394,
/**/ /**/