summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-04 21:57:43 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-04 21:57:43 +0100
commit4ba37b5833de99db9e9afe8928b31c864182405c (patch)
tree30662897c6ff3d608e47d22f8bab9ce8703b26e7
parent2ab2e8608f9b2c85432715bb9a7f226fdbf8cd35 (diff)
downloadvim-git-4ba37b5833de99db9e9afe8928b31c864182405c.tar.gz
patch 8.1.2388: using old C style commentsv8.1.2388
Problem: Using old C style comments. Solution: Use // comments where appropriate.
-rw-r--r--src/json.c86
-rw-r--r--src/json_test.c22
-rw-r--r--src/kword_test.c6
-rw-r--r--src/list.c156
-rw-r--r--src/main.c925
-rw-r--r--src/mark.c210
-rw-r--r--src/mbyte.c1030
-rw-r--r--src/memfile.c198
-rw-r--r--src/memfile_test.c24
-rw-r--r--src/memline.c877
-rw-r--r--src/menu.c320
-rw-r--r--src/version.c2
12 files changed, 1926 insertions, 1930 deletions
diff --git a/src/json.c b/src/json.c
index cca6f7044..eedb6062a 100644
--- a/src/json.c
+++ b/src/json.c
@@ -48,7 +48,7 @@ json_encode(typval_T *val, int options)
{
garray_T ga;
- /* Store bytes in the growarray. */
+ // Store bytes in the growarray.
ga_init2(&ga, 1, 4000);
json_encode_gap(&ga, val, options);
ga_append(&ga, NUL);
@@ -104,8 +104,8 @@ write_string(garray_T *gap, char_u *str)
if (!enc_utf8)
{
- /* Convert the text from 'encoding' to utf-8, the JSON string is
- * always utf-8. */
+ // Convert the text from 'encoding' to utf-8, the JSON string is
+ // always utf-8.
conv.vc_type = CONV_NONE;
convert_setup(&conv, p_enc, (char_u*)"utf-8");
if (conv.vc_type != CONV_NONE)
@@ -117,7 +117,7 @@ write_string(garray_T *gap, char_u *str)
while (*res != NUL)
{
int c;
- /* always use utf-8 encoding, ignore 'encoding' */
+ // always use utf-8 encoding, ignore 'encoding'
c = utf_ptr2char(res);
switch (c)
@@ -132,8 +132,8 @@ write_string(garray_T *gap, char_u *str)
ga_append(gap, '\\'); ga_append(gap, 'f'); break;
case 0x0d:
ga_append(gap, '\\'); ga_append(gap, 'r'); break;
- case 0x22: /* " */
- case 0x5c: /* \ */
+ case 0x22: // "
+ case 0x5c: // backslash
ga_append(gap, '\\');
ga_append(gap, c);
break;
@@ -200,9 +200,9 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options)
case VVAL_TRUE: ga_concat(gap, (char_u *)"true"); break;
case VVAL_NONE: if ((options & JSON_JS) != 0
&& (options & JSON_NO_NONE) == 0)
- /* empty item */
+ // empty item
break;
- /* FALLTHROUGH */
+ // FALLTHROUGH
case VVAL_NULL: ga_concat(gap, (char_u *)"null"); break;
}
break;
@@ -222,7 +222,7 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options)
case VAR_PARTIAL:
case VAR_JOB:
case VAR_CHANNEL:
- /* no JSON equivalent TODO: better error */
+ // no JSON equivalent TODO: better error
emsg(_(e_invarg));
return FAIL;
@@ -268,7 +268,7 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options)
&& li->li_next == NULL
&& li->li_tv.v_type == VAR_SPECIAL
&& li->li_tv.vval.v_number == VVAL_NONE)
- /* add an extra comma if the last item is v:none */
+ // add an extra comma if the last item is v:none
ga_append(gap, ',');
li = li->li_next;
if (li != NULL)
@@ -405,21 +405,21 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
if (res != NULL)
ga_init2(&ga, 1, 200);
- p = reader->js_buf + reader->js_used + 1; /* skip over " or ' */
+ p = reader->js_buf + reader->js_used + 1; // skip over " or '
while (*p != quote)
{
- /* The JSON is always expected to be utf-8, thus use utf functions
- * here. The string is converted below if needed. */
+ // The JSON is always expected to be utf-8, thus use utf functions
+ // here. The string is converted below if needed.
if (*p == NUL || p[1] == NUL || utf_ptr2len(p) < utf_byte2len(*p))
{
- /* Not enough bytes to make a character or end of the string. Get
- * more if possible. */
+ // Not enough bytes to make a character or end of the string. Get
+ // more if possible.
if (reader->js_fill == NULL)
break;
len = (int)(reader->js_end - p);
reader->js_used = (int)(p - reader->js_buf);
if (!reader->js_fill(reader))
- break; /* didn't get more */
+ break; // didn't get more
p = reader->js_buf + reader->js_used;
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
continue;
@@ -466,7 +466,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
{
varnumber_T nr2 = 0;
- /* decode surrogate pair: \ud812\u3456 */
+ // decode surrogate pair: \ud812\u3456
len = 0;
vim_str2nr(p + 2, NULL, &len,
STR2NR_HEX + STR2NR_FORCE, &nr2, NULL, 4, TRUE);
@@ -492,7 +492,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
}
break;
default:
- /* not a special char, skip over \ */
+ // not a special char, skip over backslash
++p;
continue;
}
@@ -533,7 +533,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
{
vimconv_T conv;
- /* Convert the utf-8 string to 'encoding'. */
+ // Convert the utf-8 string to 'encoding'.
conv.vc_type = CONV_NONE;
convert_setup(&conv, (char_u*)"utf-8", p_enc);
if (conv.vc_type != CONV_NONE)
@@ -560,14 +560,14 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
}
typedef enum {
- JSON_ARRAY, /* parsing items in an array */
- JSON_OBJECT_KEY, /* parsing key of an object */
- JSON_OBJECT /* parsing item in an object, after the key */
+ JSON_ARRAY, // parsing items in an array
+ JSON_OBJECT_KEY, // parsing key of an object
+ JSON_OBJECT // parsing item in an object, after the key
} json_decode_T;
typedef struct {
json_decode_T jd_type;
- typval_T jd_tv; /* the list or dict */
+ typval_T jd_tv; // the list or dict
typval_T jd_key_tv;
char_u *jd_key;
} json_dec_item_T;
@@ -611,17 +611,17 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
{
retval = MAYBE;
if (top_item->jd_type == JSON_OBJECT)
- /* did get the key, clear it */
+ // did get the key, clear it
clear_tv(&top_item->jd_key_tv);
goto theend;
}
if (top_item->jd_type == JSON_OBJECT_KEY
|| top_item->jd_type == JSON_ARRAY)
{
- /* Check for end of object or array. */
+ // Check for end of object or array.
if (*p == (top_item->jd_type == JSON_ARRAY ? ']' : '}'))
{
- ++reader->js_used; /* consume the ']' or '}' */
+ ++reader->js_used; // consume the ']' or '}'
--stack.ga_len;
if (stack.ga_len == 0)
{
@@ -644,7 +644,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
{
char_u *key;
- /* accept an object key that is not in quotes */
+ // accept an object key that is not in quotes
key = p = reader->js_buf + reader->js_used;
while (*p != NUL && *p != ':' && *p > ' ')
++p;
@@ -660,7 +660,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
{
switch (*p)
{
- case '[': /* start of array */
+ case '[': // start of array
if (top_item && top_item->jd_type == JSON_OBJECT_KEY)
{
retval = FAIL;
@@ -679,7 +679,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
break;
}
- ++reader->js_used; /* consume the '[' */
+ ++reader->js_used; // consume the '['
top_item = ((json_dec_item_T *)stack.ga_data)
+ stack.ga_len;
top_item->jd_type = JSON_ARRAY;
@@ -691,7 +691,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
}
continue;
- case '{': /* start of object */
+ case '{': // start of object
if (top_item && top_item->jd_type == JSON_OBJECT_KEY)
{
retval = FAIL;
@@ -710,7 +710,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
break;
}
- ++reader->js_used; /* consume the '{' */
+ ++reader->js_used; // consume the '{'
top_item = ((json_dec_item_T *)stack.ga_data)
+ stack.ga_len;
top_item->jd_type = JSON_OBJECT_KEY;
@@ -722,7 +722,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
}
continue;
- case '"': /* string */
+ case '"': // string
retval = json_decode_string(reader, cur_item, *p);
break;
@@ -736,15 +736,15 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
}
break;
- case ',': /* comma: empty item */
+ case ',': // comma: empty item
if ((options & JSON_JS) == 0)
{
emsg(_(e_invarg));
retval = FAIL;
break;
}
- /* FALLTHROUGH */
- case NUL: /* empty */
+ // FALLTHROUGH
+ case NUL: // empty
if (cur_item != NULL)
{
cur_item->v_type = VAR_SPECIAL;
@@ -795,7 +795,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
varnumber_T nr;
vim_str2nr(reader->js_buf + reader->js_used,
- NULL, &len, 0, /* what */
+ NULL, &len, 0, // what
&nr, NULL, 0, TRUE);
if (len == 0)
{
@@ -881,7 +881,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
break;
}
#endif
- /* check for truncated name */
+ // check for truncated name
len = (int)(reader->js_end - (reader->js_buf + reader->js_used));
if (
(len < 5 && STRNICMP((char *)p, "false", len) == 0)
@@ -899,8 +899,8 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
break;
}
- /* We are finished when retval is FAIL or MAYBE and when at the
- * toplevel. */
+ // We are finished when retval is FAIL or MAYBE and when at the
+ // toplevel.
if (retval == FAIL)
break;
if (retval == MAYBE || stack.ga_len == 0)
@@ -1037,7 +1037,7 @@ item_end:
}
}
- /* Get here when parsing failed. */
+ // Get here when parsing failed.
if (res != NULL)
{
clear_tv(res);
@@ -1061,7 +1061,7 @@ json_decode_all(js_read_T *reader, typval_T *res, int options)
{
int ret;
- /* We find the end once, to avoid calling strlen() many times. */
+ // We find the end once, to avoid calling strlen() many times.
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
json_skip_white(reader);
ret = json_decode_item(reader, res, options);
@@ -1093,7 +1093,7 @@ json_decode(js_read_T *reader, typval_T *res, int options)
{
int ret;
- /* We find the end once, to avoid calling strlen() many times. */
+ // We find the end once, to avoid calling strlen() many times.
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
json_skip_white(reader);
ret = json_decode_item(reader, res, options);
@@ -1119,7 +1119,7 @@ json_find_end(js_read_T *reader, int options)
int used_save = reader->js_used;
int ret;
- /* We find the end once, to avoid calling strlen() many times. */
+ // We find the end once, to avoid calling strlen() many times.
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
json_skip_white(reader);
ret = json_decode_item(reader, NULL, options);
diff --git a/src/json_test.c b/src/json_test.c
index 47bec8ee6..5fb772ee0 100644
--- a/src/json_test.c
+++ b/src/json_test.c
@@ -14,16 +14,16 @@
#undef NDEBUG
#include <assert.h>
-/* Must include main.c because it contains much more than just main() */
+// Must include main.c because it contains much more than just main()
#define NO_VIM_MAIN
#include "main.c"
-/* This file has to be included because the tested functions are static */
+// This file has to be included because the tested functions are static
#include "json.c"
#if defined(FEAT_EVAL)
/*
- * Test json_find_end() with imcomplete items.
+ * Test json_find_end() with incomplete items.
*/
static void
test_decode_find_end(void)
@@ -33,7 +33,7 @@ test_decode_find_end(void)
reader.js_fill = NULL;
reader.js_used = 0;
- /* string and incomplete string */
+ // string and incomplete string
reader.js_buf = (char_u *)"\"hello\"";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)" \"hello\" ";
@@ -41,13 +41,13 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)"\"hello";
assert(json_find_end(&reader, 0) == MAYBE);
- /* number and dash (incomplete number) */
+ // number and dash (incomplete number)
reader.js_buf = (char_u *)"123";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)"-";
assert(json_find_end(&reader, 0) == MAYBE);
- /* false, true and null, also incomplete */
+ // false, true and null, also incomplete
reader.js_buf = (char_u *)"false";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)"f";
@@ -77,7 +77,7 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)"nul";
assert(json_find_end(&reader, 0) == MAYBE);
- /* object without white space */
+ // object without white space
reader.js_buf = (char_u *)"{\"a\":123}";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)"{\"a\":123";
@@ -93,7 +93,7 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)"{";
assert(json_find_end(&reader, 0) == MAYBE);
- /* object with white space */
+ // object with white space
reader.js_buf = (char_u *)" { \"a\" : 123 } ";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)" { \"a\" : 123 ";
@@ -107,13 +107,13 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)" { ";
assert(json_find_end(&reader, 0) == MAYBE);
- /* JS object with white space */
+ // JS object with white space
reader.js_buf = (char_u *)" { a : 123 } ";
assert(json_find_end(&reader, JSON_JS) == OK);
reader.js_buf = (char_u *)" { a : ";
assert(json_find_end(&reader, JSON_JS) == MAYBE);
- /* array without white space */
+ // array without white space
reader.js_buf = (char_u *)"[\"a\",123]";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)"[\"a\",123";
@@ -129,7 +129,7 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)"[";
assert(json_find_end(&reader, 0) == MAYBE);
- /* array with white space */
+ // array with white space
reader.js_buf = (char_u *)" [ \"a\" , 123 ] ";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)" [ \"a\" , 123 ";
diff --git a/src/kword_test.c b/src/kword_test.c
index 927c4fd0c..c02ba4312 100644
--- a/src/kword_test.c
+++ b/src/kword_test.c
@@ -14,11 +14,11 @@
#undef NDEBUG
#include <assert.h>
-/* Must include main.c because it contains much more than just main() */
+// Must include main.c because it contains much more than just main()
#define NO_VIM_MAIN
#include "main.c"
-/* This file has to be included because the tested functions are static */
+// This file has to be included because the tested functions are static
#include "charset.c"
/*
@@ -38,7 +38,7 @@ test_isword_funcs_utf8(void)
buf.b_p_isk = (char_u *)"@,48-57,_,128-167,224-235";
curbuf = &buf;
- mb_init(); /* calls init_chartab() */
+ mb_init(); // calls init_chartab()
for (c = 0; c < 0x10000; ++c)
{
diff --git a/src/list.c b/src/list.c
index 3038b22f9..6f475fcef 100644
--- a/src/list.c
+++ b/src/list.c
@@ -17,8 +17,8 @@
static char *e_listblobarg = N_("E899: Argument of %s must be a List or Blob");
-/* List heads for garbage collection. */
-static list_T *first_list = NULL; /* list of all lists */
+// List heads for garbage collection.
+static list_T *first_list = NULL; // list of all lists
/*
* Add a watcher to a list.
@@ -77,7 +77,7 @@ list_alloc(void)
l = ALLOC_CLEAR_ONE(list_T);
if (l != NULL)
{
- /* Prepend the list to the list of lists for garbage collection. */
+ // Prepend the list to the list of lists for garbage collection.
if (first_list != NULL)
first_list->lv_used_prev = l;
l->lv_used_prev = NULL;
@@ -165,7 +165,7 @@ list_free_contents(list_T *l)
for (item = l->lv_first; item != NULL; item = l->lv_first)
{
- /* Remove the item before deleting it. */
+ // Remove the item before deleting it.
l->lv_first = item->li_next;
clear_tv(&item->li_tv);
vim_free(item);
@@ -187,9 +187,9 @@ list_free_nonref(int copyID)
if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)
&& ll->lv_watch == NULL)
{
- /* Free the List and ordinary items it contains, but don't recurse
- * into Lists and Dictionaries, they will be in the list of dicts
- * or list of lists. */
+ // Free the List and ordinary items it contains, but don't recurse
+ // into Lists and Dictionaries, they will be in the list of dicts
+ // or list of lists.
list_free_contents(ll);
did_free = TRUE;
}
@@ -199,7 +199,7 @@ list_free_nonref(int copyID)
static void
list_free_list(list_T *l)
{
- /* Remove the list from the list of lists for garbage collection. */
+ // Remove the list from the list of lists for garbage collection.
if (l->lv_used_prev == NULL)
first_list = l->lv_used_next;
else
@@ -221,9 +221,9 @@ list_free_items(int copyID)
if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)
&& ll->lv_watch == NULL)
{
- /* Free the List and ordinary items it contains, but don't recurse
- * into Lists and Dictionaries, they will be in the list of dicts
- * or list of lists. */
+ // Free the List and ordinary items it contains, but don't recurse
+ // into Lists and Dictionaries, they will be in the list of dicts
+ // or list of lists.
list_free_list(ll);
}
}
@@ -287,8 +287,8 @@ list_len(list_T *l)
list_equal(
list_T *l1,
list_T *l2,
- int ic, /* ignore case for strings */
- int recursive) /* TRUE when used recursively */
+ int ic, // ignore case for strings
+ int recursive) // TRUE when used recursively
{
listitem_T *item1, *item2;
@@ -321,32 +321,32 @@ list_find(list_T *l, long n)
if (l == NULL)
return NULL;
- /* Negative index is relative to the end. */
+ // Negative index is relative to the end.
if (n < 0)
n = l->lv_len + n;
- /* Check for index out of range. */
+ // Check for index out of range.
if (n < 0 || n >= l->lv_len)
return NULL;
- /* When there is a cached index may start search from there. */
+ // When there is a cached index may start search from there.
if (l->lv_idx_item != NULL)
{
if (n < l->lv_idx / 2)
{
- /* closest to the start of the list */
+ // closest to the start of the list
item = l->lv_first;
idx = 0;
}
else if (n > (l->lv_idx + l->lv_len) / 2)
{
- /* closest to the end of the list */
+ // closest to the end of the list
item = l->lv_last;
idx = l->lv_len - 1;
}
else
{
- /* closest to the cached index */
+ // closest to the cached index
item = l->lv_idx_item;
idx = l->lv_idx;
}
@@ -355,13 +355,13 @@ list_find(list_T *l, long n)
{
if (n < l->lv_len / 2)
{
- /* closest to the start of the list */
+ // closest to the start of the list
item = l->lv_first;
idx = 0;
}
else
{
- /* closest to the end of the list */
+ // closest to the end of the list
item = l->lv_last;
idx = l->lv_len - 1;
}
@@ -369,18 +369,18 @@ list_find(list_T *l, long n)
while (n > idx)
{
- /* search forward */
+ // search forward
item = item->li_next;
++idx;
}
while (n < idx)
{
- /* search backward */
+ // search backward
item = item->li_prev;
--idx;
}
- /* cache the used index */
+ // cache the used index
l->lv_idx = idx;
l->lv_idx_item = item;
@@ -394,7 +394,7 @@ list_find(list_T *l, long n)
list_find_nr(
list_T *l,
long idx,
- int *errorp) /* set to TRUE when something wrong */
+ int *errorp) // set to TRUE when something wrong
{
listitem_T *li;
@@ -453,7 +453,7 @@ list_append(list_T *l, listitem_T *item)
{
if (l->lv_last == NULL)
{
- /* empty list */
+ // empty list
l->lv_first = item;
l->lv_last = item;
item->li_prev = NULL;
@@ -585,11 +585,11 @@ list_insert_tv(list_T *l, typval_T *tv, listitem_T *item)
list_insert(list_T *l, listitem_T *ni, listitem_T *item)
{
if (item == NULL)
- /* Append new item at end of list. */
+ // Append new item at end of list.
list_append(l, ni);
else
{
- /* Insert new item before existing item. */
+ // Insert new item before existing item.
ni->li_prev = item->li_prev;
ni->li_next = item;
if (item->li_prev == NULL)
@@ -618,8 +618,8 @@ list_extend(list_T *l1, list_T *l2, listitem_T *bef)
listitem_T *item;
int todo = l2->lv_len;
- /* We also quit the loop when we have inserted the original item count of
- * the list, avoid a hang when we extend a list with itself. */
+ // We also quit the loop when we have inserted the original item count of
+ // the list, avoid a hang when we extend a list with itself.
for (item = l2->lv_first; item != NULL && --todo >= 0; item = item->li_next)
if (list_insert_tv(l1, &item->li_tv, bef) == FAIL)
return FAIL;
@@ -638,14 +638,14 @@ list_concat(list_T *l1, list_T *l2, typval_T *tv)
if (l1 == NULL || l2 == NULL)
return FAIL;
- /* make a copy of the first list. */
+ // make a copy of the first list.
l = list_copy(l1, FALSE, 0);
if (l == NULL)
return FAIL;
tv->v_type = VAR_LIST;
tv->vval.v_list = l;
- /* append all items from the second list */
+ // append all items from the second list
return list_extend(l, l2, NULL);
}
@@ -670,8 +670,8 @@ list_copy(list_T *orig, int deep, int copyID)
{
if (copyID != 0)
{
- /* Do this before adding the items, because one of the items may
- * refer back to this list. */
+ // Do this before adding the items, because one of the items may
+ // refer back to this list.
orig->lv_copyID = copyID;
orig->lv_copylist = copy;
}
@@ -715,7 +715,7 @@ vimlist_remove(list_T *l, listitem_T *item, listitem_T *item2)
{
listitem_T *ip;
- /* notify watchers */
+ // notify watchers
for (ip = item; ip != NULL; ip = ip->li_next)
{
--l->lv_len;
@@ -766,13 +766,13 @@ typedef struct join_S {
static int
list_join_inner(
- garray_T *gap, /* to store the result in */
+ garray_T *gap, // to store the result in
list_T *l,
char_u *sep,
int echo_style,
int restore_copyID,
int copyID,
- garray_T *join_gap) /* to keep each list item string */
+ garray_T *join_gap) // to keep each list item string
{
int i;
join_T *p;
@@ -784,7 +784,7 @@ list_join_inner(
listitem_T *item;
char_u *s;
- /* Stringify each item in the list. */
+ // Stringify each item in the list.
for (item = l->lv_first; item != NULL && !got_int; item = item->li_next)
{
s = echo_string_core(&item->li_tv, &tofree, numbuf, copyID,
@@ -809,12 +809,12 @@ list_join_inner(
}
line_breakcheck();
- if (did_echo_string_emsg) /* recursion error, bail out */
+ if (did_echo_string_emsg) // recursion error, bail out
break;
}
- /* Allocate result buffer with its total size, avoid re-allocation and
- * multiple copy operations. Add 2 for a tailing ']' and NUL. */
+ // Allocate result buffer with its total size, avoid re-allocation and
+ // multiple copy operations. Add 2 for a tailing ']' and NUL.
if (join_gap->ga_len >= 2)
sumlen += (int)STRLEN(sep) * (join_gap->ga_len - 1);
if (ga_grow(gap, sumlen + 2) == FAIL)
@@ -856,12 +856,12 @@ list_join(
int i;
if (l->lv_len < 1)
- return OK; /* nothing to do */
+ return OK; // nothing to do
ga_init2(&join_ga, (int)sizeof(join_T), l->lv_len);
retval = list_join_inner(gap, l, sep, echo_style, restore_copyID,
copyID, &join_ga);
- /* Dispose each item in join_ga. */
+ // Dispose each item in join_ga.
if (join_ga.ga_data != NULL)
{
p = (join_T *)join_ga.ga_data;
@@ -931,7 +931,7 @@ get_list_tv(char_u **arg, typval_T *rettv, int evaluate)
*arg = skipwhite(*arg + 1);
while (**arg != ']' && **arg != NUL)
{
- if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */
+ if (eval1(arg, &tv, evaluate) == FAIL) // recursive!
goto failret;
if (evaluate)
{
@@ -1120,7 +1120,7 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
{
if (argvars[2].v_type == VAR_UNKNOWN)
{
- /* Remove one item, return its value. */
+ // Remove one item, return its value.
vimlist_remove(l, item, item);
*rettv = item->li_tv;
vim_free(item);
@@ -1144,7 +1144,7 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
if (li == item2)
break;
}
- if (li == NULL) /* didn't find "item2" after "item" */
+ if (li == NULL) // didn't find "item2" after "item"
emsg(_(e_invrange));
else
{
@@ -1167,14 +1167,14 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
static int item_compare(const void *s1, const void *s2);
static int item_compare2(const void *s1, const void *s2);
-/* struct used in the array that's given to qsort() */
+// struct used in the array that's given to qsort()
typedef struct
{
listitem_T *item;
int idx;
} sortItem_T;
-/* struct storing information about current sort */
+// struct storing information about current sort
typedef struct
{
int item_compare_ic;
@@ -1229,9 +1229,9 @@ item_compare(const void *s1, const void *s2)
}
#endif
- /* tv2string() puts quotes around a string and allocates memory. Don't do
- * that for string variables. Use a single quote when comparing with a
- * non-string to do what the docs promise. */
+ // tv2string() puts quotes around a string and allocates memory. Don't do
+ // that for string variables. Use a single quote when comparing with a
+ // non-string to do what the docs promise.
if (tv1->v_type == VAR_STRING)
{
if (tv2->v_type != VAR_STRING || sortinfo->item_compare_numeric)
@@ -1269,8 +1269,8 @@ item_compare(const void *s1, const void *s2)
res = n1 == n2 ? 0 : n1 > n2 ? 1 : -1;
}
- /* When the result would be zero, compare the item indexes. Makes the
- * sort stable. */
+ // When the result would be zero, compare the item indexes. Makes the
+ // sort stable.
if (res == 0 && !sortinfo->item_compare_keep_zero)
res = si1->idx > si2->idx ? 1 : -1;
@@ -1290,7 +1290,7 @@ item_compare2(const void *s1, const void *s2)
partial_T *partial = sortinfo->item_compare_partial;
funcexe_T funcexe;
- /* shortcut after failure in previous call; compare all items equal */
+ // shortcut after failure in previous call; compare all items equal
if (sortinfo->item_compare_func_err)
return 0;
@@ -1302,12 +1302,12 @@ item_compare2(const void *s1, const void *s2)
else
func_name = partial_name(partial);
- /* Copy the values. This is needed to be able to set v_lock to VAR_FIXED
- * in the copy without changing the original list items. */
+ // Copy the values. This is needed to be able to set v_lock to VAR_FIXED
+ // in the copy without changing the original list items.
copy_tv(&si1->item->li_tv, &argv[0]);
copy_tv(&si2->item->li_tv, &argv[1]);
- rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */
+ rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;
funcexe.partial = partial;
@@ -1321,11 +1321,11 @@ item_compare2(const void *s1, const void *s2)
else
res = (int)tv_get_number_chk(&rettv, &sortinfo->item_compare_func_err);
if (sortinfo->item_compare_func_err)
- res = ITEM_COMPARE_FAIL; /* return value has wrong type */
+ res = ITEM_COMPARE_FAIL; // return value has wrong type
clear_tv(&rettv);
- /* When the result would be zero, compare the pointers themselves. Makes
- * the sort stable. */
+ // When the result would be zero, compare the pointers themselves. Makes
+ // the sort stable.
if (res == 0 && !sortinfo->item_compare_keep_zero)
res = si1->idx > si2->idx ? 1 : -1;
@@ -1346,8 +1346,8 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
long len;
long i;
- /* Pointer to current info struct used in compare function. Save and
- * restore the current one for nested calls. */
+ // Pointer to current info struct used in compare function. Save and
+ // restore the current one for nested calls.
old_sortinfo = sortinfo;
sortinfo = &info;
@@ -1364,7 +1364,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
len = list_len(l);
if (len <= 1)
- goto theend; /* short list sorts pretty quickly */
+ goto theend; // short list sorts pretty quickly
info.item_compare_ic = FALSE;
info.item_compare_numeric = FALSE;
@@ -1377,7 +1377,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
info.item_compare_selfdict = NULL;
if (argvars[1].v_type != VAR_UNKNOWN)
{
- /* optional second argument: {func} */
+ // optional second argument: {func}
if (argvars[1].v_type == VAR_FUNC)
info.item_compare_func = argvars[1].vval.v_string;
else if (argvars[1].v_type == VAR_PARTIAL)
@@ -1388,7 +1388,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
i = (long)tv_get_number_chk(&argvars[1], &error);
if (error)
- goto theend; /* type error; errmsg already given */
+ goto theend; // type error; errmsg already given
if (i == 1)
info.item_compare_ic = TRUE;
else if (argvars[1].v_type != VAR_NUMBER)
@@ -1402,7 +1402,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
{
if (*info.item_compare_func == NUL)
{
- /* empty string means default sort */
+ // empty string means default sort
info.item_compare_func = NULL;
}
else if (STRCMP(info.item_compare_func, "n") == 0)
@@ -1432,7 +1432,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
if (argvars[2].v_type != VAR_UNKNOWN)
{
- /* optional third argument: {dict} */
+ // optional third argument: {dict}
if (argvars[2].v_type != VAR_DICT)
{
emsg(_(e_dictreq));
@@ -1442,7 +1442,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
}
}
- /* Make an array with each entry pointing to an item in the List. */
+ // Make an array with each entry pointing to an item in the List.
ptrs = ALLOC_MULT(sortItem_T, len);
if (ptrs == NULL)
goto theend;
@@ -1450,7 +1450,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
i = 0;
if (sort)
{
- /* sort(): ptrs will be the list to sort */
+ // sort(): ptrs will be the list to sort
for (li = l->lv_first; li != NULL; li = li->li_next)
{
ptrs[i].item = li;
@@ -1460,7 +1460,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
info.item_compare_func_err = FALSE;
info.item_compare_keep_zero = FALSE;
- /* test the compare function */
+ // test the compare function
if ((info.item_compare_func != NULL
|| info.item_compare_partial != NULL)
&& item_compare2((void *)&ptrs[0], (void *)&ptrs[1])
@@ -1468,7 +1468,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
emsg(_("E702: Sort compare function failed"));
else
{
- /* Sort the array with item pointers. */
+ // Sort the array with item pointers.
qsort((void *)ptrs, (size_t)len, sizeof(sortItem_T),
info.item_compare_func == NULL
&& info.item_compare_partial == NULL
@@ -1476,7 +1476,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
if (!info.item_compare_func_err)
{
- /* Clear the List and append the items in sorted order. */
+ // Clear the List and append the items in sorted order.
l->lv_first = l->lv_last = l->lv_idx_item = NULL;
l->lv_len = 0;
for (i = 0; i < len; ++i)
@@ -1488,7 +1488,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
{
int (*item_compare_func_ptr)(const void *, const void *);
- /* f_uniq(): ptrs will be a stack of items to remove */
+ // f_uniq(): ptrs will be a stack of items to remove
info.item_compare_func_err = FALSE;
info.item_compare_keep_zero = TRUE;
item_compare_func_ptr = info.item_compare_func != NULL
@@ -1774,7 +1774,7 @@ f_add(typval_T *argvars, typval_T *rettv)
list_T *l;
blob_T *b;
- rettv->vval.v_number = 1; /* Default: Failed */
+ rettv->vval.v_number = 1; // Default: Failed
if (argvars[0].v_type == VAR_LIST)
{
if ((l = argvars[0].vval.v_list) != NULL
@@ -1935,7 +1935,7 @@ f_extend(typval_T *argvars, typval_T *rettv)
{
before = (long)tv_get_number_chk(&argvars[2], &error);
if (error)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
if (before == l1->lv_len)
item = NULL;
@@ -1967,14 +1967,14 @@ f_extend(typval_T *argvars, typval_T *rettv)
if (d1 != NULL && !var_check_lock(d1->dv_lock, arg_errmsg, TRUE)
&& d2 != NULL)
{
- /* Check the third argument. */
+ // Check the third argument.
if (argvars[2].v_type != VAR_UNKNOWN)
{
static char *(av[]) = {"keep", "force", "error"};
action = tv_get_string_chk(&argvars[2]);
if (action == NULL)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
for (i = 0; i < 3; ++i)
if (STRCMP(action, av[i]) == 0)
break;
@@ -2051,7 +2051,7 @@ f_insert(typval_T *argvars, typval_T *rettv)
if (argvars[2].v_type != VAR_UNKNOWN)
before = (long)tv_get_number_chk(&argvars[2], &error);
if (error)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
if (before == l->lv_len)
item = NULL;
diff --git a/src/main.c b/src/main.c
index 387f8370f..ddb8e388d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -13,8 +13,8 @@
#ifdef __CYGWIN__
# ifndef MSWIN
# include <cygwin/version.h>
-# include <sys/cygwin.h> /* for cygwin_conv_to_posix_path() and/or
- * cygwin_conv_path() */
+# include <sys/cygwin.h> // for cygwin_conv_to_posix_path() and/or
+ // cygwin_conv_path()
# endif
# include <limits.h>
#endif
@@ -23,12 +23,12 @@
# include "iscygpty.h"
#endif
-/* Values for edit_type. */
-#define EDIT_NONE 0 /* no edit type yet */
-#define EDIT_FILE 1 /* file name argument[s] given, use argument list */
-#define EDIT_STDIN 2 /* read file from stdin */
-#define EDIT_TAG 3 /* tag name argument given, use tagname */
-#define EDIT_QF 4 /* start in quickfix mode */
+// Values for edit_type.
+#define EDIT_NONE 0 // no edit type yet
+#define EDIT_FILE 1 // file name argument[s] given, use argument list
+#define EDIT_STDIN 2 // read file from stdin
+#define EDIT_TAG 3 // tag name argument given, use tagname
+#define EDIT_QF 4 // start in quickfix mode
#if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN)
static int file_owned(char *fname);
@@ -82,14 +82,14 @@ static char *(main_errors[]) =
#define ME_INVALID_ARG 5
};
-#ifndef PROTO /* don't want a prototype for main() */
+#ifndef PROTO // don't want a prototype for main()
-/* Various parameters passed between main() and other functions. */
+// Various parameters passed between main() and other functions.
static mparm_T params;
-#ifndef NO_VIM_MAIN /* skip this for unittests */
+#ifndef NO_VIM_MAIN // skip this for unittests
-static char_u *start_dir = NULL; /* current working dir on startup */
+static char_u *start_dir = NULL; // current working dir on startup
static int has_dash_c_arg = FALSE;
@@ -122,9 +122,9 @@ main
argc = get_cmd_argsW(&argv);
#endif
- /* Many variables are in "params" so that we can pass them to invoked
- * functions without a lot of arguments. "argc" and "argv" are also
- * copied, so that they can be changed. */
+ // Many variables are in "params" so that we can pass them to invoked
+ // functions without a lot of arguments. "argc" and "argv" are also
+ // copied, so that they can be changed.
vim_memset(&params, 0, sizeof(params));
params.argc = argc;
params.argv = argv;
@@ -150,7 +150,7 @@ main
#endif
#ifdef STARTUPTIME
- /* Need to find "--startuptime" before actually parsing arguments. */
+ // Need to find "--startuptime" before actually parsing arguments.
for (i = 1; i < argc - 1; ++i)
if (STRICMP(argv[i], "--startuptime") == 0)
{
@@ -162,7 +162,7 @@ main
starttime = time(NULL);
#ifdef CLEAN_RUNTIMEPATH
- /* Need to find "--clean" before actually parsing arguments. */
+ // Need to find "--clean" before actually parsing arguments.
for (i = 1; i < argc; ++i)
if (STRICMP(argv[i], "--clean") == 0)
{
@@ -219,8 +219,8 @@ main
{
gui.starting = FALSE;
- /* When running "evim" or "gvim -y" we need the menus, exit if we
- * don't have them. */
+ // When running "evim" or "gvim -y" we need the menus, exit if we
+ // don't have them.
if (params.evim_mode)
mch_exit(1);
}
@@ -239,9 +239,9 @@ main
start_dir = alloc(MAXPATHL);
if (start_dir != NULL)
mch_dirname(start_dir, MAXPATHL);
- /* Temporarily add '(' and ')' to 'isfname'. These are valid
- * filename characters but are excluded from 'isfname' to make
- * "gf" work on a file name in parenthesis (e.g.: see vim.h). */
+ // Temporarily add '(' and ')' to 'isfname'. These are valid
+ // filename characters but are excluded from 'isfname' to make
+ // "gf" work on a file name in parenthesis (e.g.: see vim.h).
do_cmdline_cmd((char_u *)":set isf+=(,)");
alist_expand(NULL, 0);
do_cmdline_cmd((char_u *)":set isf&");
@@ -256,8 +256,8 @@ main
{
extern void set_alist_count(void);
- /* Remember the number of entries in the argument list. If it changes
- * we don't react on setting 'encoding'. */
+ // Remember the number of entries in the argument list. If it changes
+ // we don't react on setting 'encoding'.
set_alist_count();
}
#endif
@@ -280,10 +280,10 @@ main
#ifdef FEAT_DIFF
if (params.diff_mode && params.window_count == -1)
- params.window_count = 0; /* open up to 3 windows */
+ params.window_count = 0; // open up to 3 windows
#endif
- /* Don't redraw until much later. */
+ // Don't redraw until much later.
++RedrawingDisabled;
/*
@@ -308,16 +308,16 @@ main
#endif
#if defined(FEAT_GUI_MAC) && defined(MACOS_X_DARWIN)
- /* When the GUI is started from Finder, need to display messages in a
- * message box. isatty(2) returns TRUE anyway, thus we need to check the
- * name to know we're not started from a terminal. */
+ // When the GUI is started from Finder, need to display messages in a
+ // message box. isatty(2) returns TRUE anyway, thus we need to check the
+ // name to know we're not started from a terminal.
if (gui.starting && (!isatty(2) || strcmp("/dev/console", ttyname(2)) == 0))
{
params.want_full_screen = FALSE;
- /* Avoid always using "/" as the current directory. Note that when
- * started from Finder the arglist will be filled later in
- * HandleODocAE() and "fname" will be NULL. */
+ // Avoid always using "/" as the current directory. Note that when
+ // started from Finder the arglist will be filled later in
+ // HandleODocAE() and "fname" will be NULL.
if (getcwd((char *)NameBuff, MAXPATHL) != NULL
&& STRCMP(NameBuff, "/") == 0)
{
@@ -368,8 +368,8 @@ main
check_tty(&params);
#ifdef _IOLBF
- /* Ensure output works usefully without a tty: buffer lines instead of
- * fully buffered. */
+ // Ensure output works usefully without a tty: buffer lines instead of
+ // fully buffered.
if (silent_mode)
setvbuf(stdout, NULL, _IOLBF, 0);
#endif
@@ -381,54 +381,54 @@ main
if (params.want_full_screen && !silent_mode)
{
- termcapinit(params.term); /* set terminal name and get terminal
- capabilities (will set full_screen) */
- screen_start(); /* don't know where cursor is now */
+ termcapinit(params.term); // set terminal name and get terminal
+ // capabilities (will set full_screen)
+ screen_start(); // don't know where cursor is now
TIME_MSG("Termcap init");
}
/*
* Set the default values for the options that use Rows and Columns.
*/
- ui_get_shellsize(); /* inits Rows and Columns */
+ ui_get_shellsize(); // inits Rows and Columns
win_init_size();
#ifdef FEAT_DIFF
- /* Set the 'diff' option now, so that it can be checked for in a .vimrc
- * file. There is no buffer yet though. */
+ // Set the 'diff' option now, so that it can be checked for in a .vimrc
+ // file. There is no buffer yet though.
if (params.diff_mode)
diff_win_options(firstwin, FALSE);
#endif
cmdline_row = Rows - p_ch;
msg_row = cmdline_row;
- screenalloc(FALSE); /* allocate screen buffers */
+ screenalloc(FALSE); // allocate screen buffers
set_init_2();
TIME_MSG("inits 2");
msg_scroll = TRUE;
no_wait_return = TRUE;
- init_mappings(); /* set up initial mappings */
+ init_mappings(); // set up initial mappings
- init_highlight(TRUE, FALSE); /* set the default highlight groups */
+ init_highlight(TRUE, FALSE); // set the default highlight groups
TIME_MSG("init highlight");
#ifdef FEAT_EVAL
- /* Set the break level after the terminal is initialized. */
+ // Set the break level after the terminal is initialized.
debug_break_level = params.use_debug_break_level;
#endif
- /* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments.
- * Allows for setting 'loadplugins' there. */
+ // Reset 'loadplugins' for "-u NONE" before "--cmd" arguments.
+ // Allows for setting 'loadplugins' there.
if (params.use_vimrc != NULL
&& (STRCMP(params.use_vimrc, "NONE") == 0
|| STRCMP(params.use_vimrc, "DEFAULTS") == 0))
p_lpl = FALSE;
- /* Execute --cmd arguments. */
+ // Execute --cmd arguments.
exe_pre_commands(&params);
- /* Source startup scripts. */
+ // Source startup scripts.
source_startup_scripts(&params);
#ifdef FEAT_MZSCHEME
@@ -444,8 +444,8 @@ main
return vim_main2();
#endif
}
-#endif /* NO_VIM_MAIN */
-#endif /* PROTO */
+#endif // NO_VIM_MAIN
+#endif // PROTO
/*
* vim_main2() is needed for FEAT_MZSCHEME, but we define it always to keep
@@ -465,11 +465,11 @@ vim_main2(void)
{
char_u *rtp_copy = NULL;
- /* First add all package directories to 'runtimepath', so that their
- * autoload directories can be found. Only if not done already with a
- * :packloadall command.
- * Make a copy of 'runtimepath', so that source_runtime does not use
- * the pack directories. */
+ // First add all package directories to 'runtimepath', so that their
+ // autoload directories can be found. Only if not done already with a
+ // :packloadall command.
+ // Make a copy of 'runtimepath', so that source_runtime does not use
+ // the pack directories.
if (!did_source_packages)
{
rtp_copy = vim_strsave(p_rtp);
@@ -477,7 +477,7 @@ vim_main2(void)
}
source_in_path(rtp_copy == NULL ? p_rtp : rtp_copy,
-# ifdef VMS /* Somehow VMS doesn't handle the "**". */
+# ifdef VMS // Somehow VMS doesn't handle the "**".
(char_u *)"plugin/*.vim",
# else
(char_u *)"plugin/**/*.vim",
@@ -486,13 +486,13 @@ vim_main2(void)
TIME_MSG("loading plugins");
vim_free(rtp_copy);
- /* Only source "start" packages if not done already with a :packloadall
- * command. */
+ // Only source "start" packages if not done already with a :packloadall
+ // command.
if (!did_source_packages)
load_start_packages();
TIME_MSG("loading packages");
-# ifdef VMS /* Somehow VMS doesn't handle the "**". */
+# ifdef VMS // Somehow VMS doesn't handle the "**".
source_runtime((char_u *)"plugin/*.vim", DIP_ALL | DIP_AFTER);
# else
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_AFTER);
@@ -503,13 +503,13 @@ vim_main2(void)
#endif
#ifdef FEAT_DIFF
- /* Decide about window layout for diff mode after reading vimrc. */
+ // Decide about window layout for diff mode after reading vimrc.
if (params.diff_mode && params.window_layout == 0)
{
if (diffopt_horizontal())
- params.window_layout = WIN_HOR; /* use horizontal split */
+ params.window_layout = WIN_HOR; // use horizontal split
else
- params.window_layout = WIN_VER; /* use vertical split */
+ params.window_layout = WIN_VER; // use vertical split
}
#endif
@@ -542,17 +542,17 @@ vim_main2(void)
if (gui.starting)
{
# if defined(UNIX) || defined(VMS)
- /* When something caused a message from a vimrc script, need to output
- * an extra newline before the shell prompt. */
+ // When something caused a message from a vimrc script, need to output
+ // an extra newline before the shell prompt.
if (did_emsg || msg_didout)
putchar('\n');
# endif
- gui_start(NULL); /* will set full_screen to TRUE */
+ gui_start(NULL); // will set full_screen to TRUE
TIME_MSG("starting GUI");
- /* When running "evim" or "gvim -y" we need the menus, exit if we
- * don't have them. */
+ // When running "evim" or "gvim -y" we need the menus, exit if we
+ // don't have them.
if (!gui.in_use && params.evim_mode)
mch_exit(1);
}
@@ -570,7 +570,7 @@ vim_main2(void)
}
#endif
#ifdef FEAT_EVAL
- /* It's better to make v:oldfiles an empty list than NULL. */
+ // It's better to make v:oldfiles an empty list than NULL.
if (get_vim_var_list(VV_OLDFILES) == NULL)
set_vim_var_list(VV_OLDFILES, list_alloc());
#endif
@@ -632,7 +632,7 @@ vim_main2(void)
#endif
#ifdef FEAT_XCLIPBOARD
- /* Start using the X clipboard, unless the GUI was started. */
+ // Start using the X clipboard, unless the GUI was started.
# ifdef FEAT_GUI
if (!gui.in_use)
# endif
@@ -643,7 +643,7 @@ vim_main2(void)
#endif
#ifdef FEAT_CLIENTSERVER
- /* Prepare for being a Vim server. */
+ // Prepare for being a Vim server.
prepare_server(&params);
#endif
@@ -658,8 +658,8 @@ vim_main2(void)
read_stdin();
#if defined(UNIX) || defined(VMS)
- /* When switching screens and something caused a message from a vimrc
- * script, need to output an extra newline on exit. */
+ // When switching screens and something caused a message from a vimrc
+ // script, need to output an extra newline on exit.
if ((did_emsg || msg_didout) && *T_TI != NUL)
newline_on_exit = TRUE;
#endif
@@ -681,13 +681,13 @@ vim_main2(void)
TIME_MSG("waiting for return");
}
- starttermcap(); /* start termcap if not done by wait_return() */
+ starttermcap(); // start termcap if not done by wait_return()
TIME_MSG("start termcap");
setmouse(); // may start using the mouse
if (scroll_region)
- scroll_region_reset(); /* In case Rows changed */
- scroll_start(); /* may scroll the screen to the right position */
+ scroll_region_reset(); // In case Rows changed
+ scroll_start(); // may scroll the screen to the right position
#if defined(FEAT_TITLE) && (defined(UNIX) || defined(VMS) || defined(MACOS_X))
term_push_title(SAVE_RESTORE_BOTH);
@@ -704,7 +704,7 @@ vim_main2(void)
must_redraw = CLEAR;
else
{
- screenclear(); /* clear screen */
+ screenclear(); // clear screen
TIME_MSG("clearing screen");
}
@@ -727,11 +727,11 @@ vim_main2(void)
TIME_MSG("opening buffers");
#ifdef FEAT_EVAL
- /* clear v:swapcommand */
+ // clear v:swapcommand
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
#endif
- /* Ex starts at last line of the file */
+ // Ex starts at last line of the file
if (exmode_active)
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
@@ -762,7 +762,7 @@ vim_main2(void)
{
win_T *wp;
- /* set options in each window for "vimdiff". */
+ // set options in each window for "vimdiff".
FOR_ALL_WINDOWS(wp)
diff_win_options(wp, TRUE);
}
@@ -785,20 +785,20 @@ vim_main2(void)
do_cmdline_cmd(IObuff);
TIME_MSG("jumping to tag");
- /* If the user doesn't want to edit the file then we quit here. */
+ // If the user doesn't want to edit the file then we quit here.
if (swap_exists_did_quit)
getout(1);
}
- /* Execute any "+", "-c" and "-S" arguments. */
+ // Execute any "+", "-c" and "-S" arguments.
if (params.n_commands > 0)
exe_commands(&params);
- /* Must come before the may_req_ calls. */
+ // Must come before the may_req_ calls.
starting = 0;
#if defined(FEAT_TERMRESPONSE)
- /* Must be done before redrawing, puts a few characters on the screen. */
+ // Must be done before redrawing, puts a few characters on the screen.
may_req_ambiguous_char_width();
#endif
@@ -806,18 +806,18 @@ vim_main2(void)
redraw_all_later(NOT_VALID);
no_wait_return = FALSE;
- /* 'autochdir' has been postponed */
+ // 'autochdir' has been postponed
DO_AUTOCHDIR;
#ifdef FEAT_TERMRESPONSE
- /* Requesting the termresponse is postponed until here, so that a "-c q"
- * argument doesn't make it appear in the shell Vim was started from. */
+ // Requesting the termresponse is postponed until here, so that a "-c q"
+ // argument doesn't make it appear in the shell Vim was started from.
may_req_termresponse();
may_req_bg_color();
#endif
- /* start in insert mode */
+ // start in insert mode
if (p_im)
need_start_insertmode = TRUE;
@@ -828,10 +828,10 @@ vim_main2(void)
TIME_MSG("VimEnter autocommands");
#if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD)
- /* Adjust default register name for "unnamed" in 'clipboard'. Can only be
- * done after the clipboard is available and all initial commands that may
- * modify the 'clipboard' setting have run; i.e. just before entering the
- * main loop. */
+ // Adjust default register name for "unnamed" in 'clipboard'. Can only be
+ // done after the clipboard is available and all initial commands that may
+ // modify the 'clipboard' setting have run; i.e. just before entering the
+ // main loop.
{
int default_regname = 0;
@@ -841,8 +841,8 @@ vim_main2(void)
#endif
#if defined(FEAT_DIFF)
- /* When a startup script or session file setup for diff'ing and
- * scrollbind, sync the scrollbind now. */
+ // When a startup script or session file setup for diff'ing and
+ // scrollbind, sync the scrollbind now.
if (curwin->w_p_diff && curwin->w_p_scb)
{
update_topline();
@@ -855,12 +855,12 @@ vim_main2(void)
# ifdef VIMDLL
if (!gui.in_use)
# endif
- mch_set_winsize_now(); /* Allow winsize changes from now on */
+ mch_set_winsize_now(); // Allow winsize changes from now on
#endif
#if defined(FEAT_GUI)
- /* When tab pages were created, may need to update the tab pages line and
- * scrollbars. This is skipped while creating them. */
+ // When tab pages were created, may need to update the tab pages line and
+ // scrollbars. This is skipped while creating them.
if (first_tabpage->tp_next != NULL)
{
out_flush();
@@ -870,8 +870,8 @@ vim_main2(void)
need_mouse_correct = TRUE;
#endif
- /* If ":startinsert" command used, stuff a dummy command to be able to
- * call normal_cmd(), which will then start Insert mode. */
+ // If ":startinsert" command used, stuff a dummy command to be able to
+ // call normal_cmd(), which will then start Insert mode.
if (restart_edit != 0)
stuffcharReadbuff(K_NOP);
@@ -888,7 +888,7 @@ vim_main2(void)
}
# endif
# endif
- /* Tell the client that it can start sending commands. */
+ // Tell the client that it can start sending commands.
netbeans_open(netbeansArg + 3, TRUE);
}
#endif
@@ -900,7 +900,7 @@ vim_main2(void)
*/
main_loop(FALSE, FALSE);
-#endif /* NO_VIM_MAIN */
+#endif // NO_VIM_MAIN
return 0;
}
@@ -913,16 +913,16 @@ common_init(mparm_T *paramp)
{
cmdline_init();
- (void)mb_init(); /* init mb_bytelen_tab[] to ones */
+ (void)mb_init(); // init mb_bytelen_tab[] to ones
#ifdef FEAT_EVAL
- eval_init(); /* init global variables */
+ eval_init(); // init global variables
#endif
#ifdef __QNXNTO__
- qnx_init(); /* PhAttach() for clipboard, (and gui) */
+ qnx_init(); // PhAttach() for clipboard, (and gui)
#endif
- /* Init the table of Normal mode commands. */
+ // Init the table of Normal mode commands.
init_normal_cmds();
/*
@@ -935,8 +935,8 @@ common_init(mparm_T *paramp)
TIME_MSG("Allocated generic buffers");
#ifdef NBDEBUG
- /* Wait a moment for debugging NetBeans. Must be after allocating
- * NameBuff. */
+ // Wait a moment for debugging NetBeans. Must be after allocating
+ // NameBuff.
nbdebug_log_init("SPRO_GVIM_DEBUG", "SPRO_GVIM_DLEVEL");
nbdebug_wait(WT_ENV | WT_WAIT | WT_STOP, "SPRO_GVIM_WAIT", 20);
TIME_MSG("NetBeans debug wait");
@@ -953,7 +953,7 @@ common_init(mparm_T *paramp)
#endif
#ifdef FEAT_GUI
- gui.dofork = TRUE; /* default is to use fork() */
+ gui.dofork = TRUE; // default is to use fork()
#endif
/*
@@ -966,13 +966,13 @@ common_init(mparm_T *paramp)
early_arg_scan(paramp);
#if defined(FEAT_GUI)
- /* Prepare for possibly starting GUI sometime */
+ // Prepare for possibly starting GUI sometime
gui_prepare(&paramp->argc, paramp->argv);
TIME_MSG("GUI prepared");
#endif
#ifdef FEAT_CLIPBOARD
- clip_init(FALSE); /* Initialise clipboard stuff */
+ clip_init(FALSE); // Initialise clipboard stuff
TIME_MSG("clipboard setup");
#endif
@@ -992,9 +992,9 @@ common_init(mparm_T *paramp)
if (win_alloc_first() == FAIL)
mch_exit(0);
- init_yank(); /* init yank buffers */
+ init_yank(); // init yank buffers
- alist_init(&global_alist); /* Init the argument list to empty. */
+ alist_init(&global_alist); // Init the argument list to empty.
global_alist.id = 0;
/*
@@ -1004,7 +1004,7 @@ common_init(mparm_T *paramp)
* msg_outtrans_len_attr().
* First find out the home directory, needed to expand "~" in options.
*/
- init_homedir(); /* find real value of $HOME */
+ init_homedir(); // find real value of $HOME
set_init_1(paramp->clean);
TIME_MSG("inits 1");
@@ -1156,8 +1156,8 @@ may_trigger_safestateagain(void)
*/
void
main_loop(
- int cmdwin, /* TRUE when working in the command-line window */
- int noexmode) /* TRUE when return on entering Ex mode */
+ int cmdwin, // TRUE when working in the command-line window
+ int noexmode) // TRUE when return on entering Ex mode
{
oparg_T oa; // operator arguments
oparg_T *prev_oap; // operator arguments
@@ -1173,10 +1173,10 @@ main_loop(
current_oap = &oa;
#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
- /* Setup to catch a terminating error from the X server. Just ignore
- * it, restore the state and continue. This might not always work
- * properly, but at least we don't exit unexpectedly when the X server
- * exits while Vim is running in a console. */
+ // Setup to catch a terminating error from the X server. Just ignore
+ // it, restore the state and continue. This might not always work
+ // properly, but at least we don't exit unexpectedly when the X server
+ // exits while Vim is running in a console.
if (!cmdwin && !noexmode && SETJMP(x_jump_env))
{
State = NORMAL;
@@ -1213,36 +1213,36 @@ main_loop(
did_check_timestamps = FALSE;
if (need_check_timestamps)
check_timestamps(FALSE);
- if (need_wait_return) /* if wait_return still needed ... */
- wait_return(FALSE); /* ... call it now */
+ if (need_wait_return) // if wait_return still needed ...
+ wait_return(FALSE); // ... call it now
if (need_start_insertmode && goto_im() && !VIsual_active)
{
need_start_insertmode = FALSE;
- stuffReadbuff((char_u *)"i"); /* start insert mode next */
- /* skip the fileinfo message now, because it would be shown
- * after insert mode finishes! */
+ stuffReadbuff((char_u *)"i"); // start insert mode next
+ // skip the fileinfo message now, because it would be shown
+ // after insert mode finishes!
need_fileinfo = FALSE;
}
}
- /* Reset "got_int" now that we got back to the main loop. Except when
- * inside a ":g/pat/cmd" command, then the "got_int" needs to abort
- * the ":g" command.
- * For ":g/pat/vi" we reset "got_int" when used once. When used
- * a second time we go back to Ex mode and abort the ":g" command. */
+ // Reset "got_int" now that we got back to the main loop. Except when
+ // inside a ":g/pat/cmd" command, then the "got_int" needs to abort
+ // the ":g" command.
+ // For ":g/pat/vi" we reset "got_int" when used once. When used
+ // a second time we go back to Ex mode and abort the ":g" command.
if (got_int)
{
if (noexmode && global_busy && !exmode_active && previous_got_int)
{
- /* Typed two CTRL-C in a row: go back to ex mode as if "Q" was
- * used and keep "got_int" set, so that it aborts ":g". */
+ // Typed two CTRL-C in a row: go back to ex mode as if "Q" was
+ // used and keep "got_int" set, so that it aborts ":g".
exmode_active = EXMODE_NORMAL;
State = NORMAL;
}
else if (!global_busy || !exmode_active)
{
if (!quit_more)
- (void)vgetc(); /* flush all buffers */
+ (void)vgetc(); // flush all buffers
got_int = FALSE;
}
previous_got_int = TRUE;
@@ -1280,7 +1280,7 @@ main_loop(
conceal_update_lines = FALSE;
#endif
- /* Trigger CursorMoved if the cursor moved. */
+ // Trigger CursorMoved if the cursor moved.
if (!finish_op && (
has_cursormoved()
#ifdef FEAT_PROP_POPUP
@@ -1327,7 +1327,7 @@ main_loop(
}
#endif
- /* Trigger TextChanged if b:changedtick differs. */
+ // Trigger TextChanged if b:changedtick differs.
if (!finish_op && has_textchanged()
&& curbuf->b_last_changedtick != CHANGEDTICK(curbuf))
{
@@ -1349,8 +1349,8 @@ main_loop(
curtab->tp_diff_update = FALSE;
}
- /* Scroll-binding for diff mode may have been postponed until
- * here. Avoids doing it for every change. */
+ // Scroll-binding for diff mode may have been postponed until
+ // here. Avoids doing it for every change.
if (diff_need_scrollbind)
{
check_scrollbind((linenr_T)0, 0L);
@@ -1358,7 +1358,7 @@ main_loop(
}
#endif
#if defined(FEAT_FOLDING)
- /* Include a closed fold completely in the Visual area. */
+ // Include a closed fold completely in the Visual area.
foldAdjustVisual();
#endif
#ifdef FEAT_FOLDING
@@ -1410,7 +1410,7 @@ main_loop(
#ifdef FEAT_VIMINFO
curbuf->b_last_used = vim_time();
#endif
- /* display message after redraw */
+ // display message after redraw
if (keep_msg != NULL)
{
char_u *p = vim_strsave(keep_msg);
@@ -1427,16 +1427,16 @@ main_loop(
vim_free(p);
}
}
- if (need_fileinfo) /* show file info after redraw */
+ if (need_fileinfo) // show file info after redraw
{
fileinfo(FALSE, TRUE, FALSE);
need_fileinfo = FALSE;
}
- emsg_on_display = FALSE; /* can delete error message now */
+ emsg_on_display = FALSE; // can delete error message now
did_emsg = FALSE;
- msg_didany = FALSE; /* reset lines_left in msg_start() */
- may_clear_sb_text(); /* clear scroll-back text on next msg */
+ msg_didany = FALSE; // reset lines_left in msg_start()
+ may_clear_sb_text(); // clear scroll-back text on next msg
showruler(FALSE);
setcursor();
@@ -1445,8 +1445,8 @@ main_loop(
do_redraw = FALSE;
#ifdef STARTUPTIME
- /* Now that we have drawn the first screen all the startup stuff
- * has been done, close any file for startup messages. */
+ // Now that we have drawn the first screen all the startup stuff
+ // has been done, close any file for startup messages.
if (time_fd != NULL)
{
TIME_MSG("first screen update");
@@ -1483,7 +1483,7 @@ main_loop(
*/
if (exmode_active)
{
- if (noexmode) /* End of ":global/path/visual" commands */
+ if (noexmode) // End of ":global/path/visual" commands
goto theend;
do_exmode(exmode_active == EXMODE_VIM);
}
@@ -1495,9 +1495,9 @@ main_loop(
&& !VIsual_active
&& !skip_term_loop)
{
- /* If terminal_loop() returns OK we got a key that is handled
- * in Normal model. With FAIL we first need to position the
- * cursor and the screen needs to be redrawn. */
+ // If terminal_loop() returns OK we got a key that is handled
+ // in Normal model. With FAIL we first need to position the
+ // cursor and the screen needs to be redrawn.
if (terminal_loop(TRUE) == OK)
normal_cmd(&oa, TRUE);
}
@@ -1525,16 +1525,16 @@ theend:
getout_preserve_modified(int exitval)
{
# if defined(SIGHUP) && defined(SIG_IGN)
- /* Ignore SIGHUP, because a dropped connection causes a read error, which
- * makes Vim exit and then handling SIGHUP causes various reentrance
- * problems. */
+ // Ignore SIGHUP, because a dropped connection causes a read error, which
+ // makes Vim exit and then handling SIGHUP causes various reentrance
+ // problems.
signal(SIGHUP, SIG_IGN);
# endif
- ml_close_notmod(); /* close all not-modified buffers */
- ml_sync_all(FALSE, FALSE); /* preserve all swap files */
- ml_close_all(FALSE); /* close all memfiles, without deleting */
- getout(exitval); /* exit Vim properly */
+ ml_close_notmod(); // close all not-modified buffers
+ ml_sync_all(FALSE, FALSE); // preserve all swap files
+ ml_close_all(FALSE); // close all memfiles, without deleting
+ getout(exitval); // exit Vim properly
}
#endif
@@ -1550,20 +1550,20 @@ getout(int exitval)
ch_log(NULL, "Exiting...");
#endif
- /* When running in Ex mode an error causes us to exit with a non-zero exit
- * code. POSIX requires this, although it's not 100% clear from the
- * standard. */
+ // When running in Ex mode an error causes us to exit with a non-zero exit
+ // code. POSIX requires this, although it's not 100% clear from the
+ // standard.
if (exmode_active)
exitval += ex_exitval;
- /* Position the cursor on the last screen line, below all the text */
+ // Position the cursor on the last screen line, below all the text
#ifdef FEAT_GUI
if (!gui.in_use)
#endif
windgoto((int)Rows - 1, 0);
#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
- /* Optionally print hashtable efficiency. */
+ // Optionally print hashtable efficiency.
hash_debug_results();
#endif
@@ -1578,14 +1578,14 @@ getout(int exitval)
buf_T *buf;
win_T *wp;
- /* Trigger BufWinLeave for all windows, but only once per buffer. */
+ // Trigger BufWinLeave for all windows, but only once per buffer.
for (tp = first_tabpage; tp != NULL; tp = next_tp)
{
next_tp = tp->tp_next;
FOR_ALL_WINDOWS_IN_TAB(tp, wp)
{
if (wp->w_buffer == NULL)
- /* Autocmd must have close the buffer already, skip. */
+ // Autocmd must have close the buffer already, skip.
continue;
buf = wp->w_buffer;
if (CHANGEDTICK(buf) != -1)
@@ -1596,16 +1596,16 @@ getout(int exitval)
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
buf->b_fname, FALSE, buf);
if (bufref_valid(&bufref))
- CHANGEDTICK(buf) = -1; /* note we did it already */
+ CHANGEDTICK(buf) = -1; // note we did it already
- /* start all over, autocommands may mess up the lists */
+ // start all over, autocommands may mess up the lists
next_tp = first_tabpage;
break;
}
}
}
- /* Trigger BufUnload for buffers that are loaded */
+ // Trigger BufUnload for buffers that are loaded
FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp != NULL)
{
@@ -1615,7 +1615,7 @@ getout(int exitval)
apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname,
FALSE, buf);
if (!bufref_valid(&bufref))
- /* autocmd deleted the buffer */
+ // autocmd deleted the buffer
break;
}
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
@@ -1623,7 +1623,7 @@ getout(int exitval)
#ifdef FEAT_VIMINFO
if (*p_viminfo != NUL)
- /* Write out the registers, history, marks etc, to the viminfo file */
+ // Write out the registers, history, marks etc, to the viminfo file
write_viminfo(NULL, FALSE);
#endif
@@ -1652,12 +1652,12 @@ getout(int exitval)
#endif
)
{
- /* give the user a chance to read the (error) message */
+ // give the user a chance to read the (error) message
no_wait_return = FALSE;
wait_return(FALSE);
}
- /* Position the cursor again, the autocommands may have moved it */
+ // Position the cursor again, the autocommands may have moved it
#ifdef FEAT_GUI
if (!gui.in_use)
#endif
@@ -1717,18 +1717,18 @@ init_locale(void)
setlocale(LC_ALL, "");
# ifdef FEAT_GUI_GTK
- /* Tell Gtk not to change our locale settings. */
+ // Tell Gtk not to change our locale settings.
gtk_disable_setlocale();
# endif
# if defined(FEAT_FLOAT) && defined(LC_NUMERIC)
- /* Make sure strtod() uses a decimal point, not a comma. */
+ // Make sure strtod() uses a decimal point, not a comma.
setlocale(LC_NUMERIC, "C");
# endif
# ifdef MSWIN
- /* Apparently MS-Windows printf() may cause a crash when we give it 8-bit
- * text while it's expecting text in the current locale. This call avoids
- * that. */
+ // Apparently MS-Windows printf() may cause a crash when we give it 8-bit
+ // text while it's expecting text in the current locale. This call avoids
+ // that.
setlocale(LC_CTYPE, "C");
# endif
@@ -1738,11 +1738,11 @@ init_locale(void)
char_u *p;
# ifdef DYNAMIC_GETTEXT
- /* Initialize the gettext library */
+ // Initialize the gettext library
dyn_libintl_init();
# endif
- /* expand_env() doesn't work yet, because g_chartab[] is not
- * initialized yet, call vim_getenv() directly */
+ // expand_env() doesn't work yet, because g_chartab[] is not
+ // initialized yet, call vim_getenv() directly
p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
if (p != NULL && *p != NUL)
{
@@ -1802,7 +1802,7 @@ early_arg_scan(mparm_T *parmp UNUSED)
parmp->serverArg = TRUE;
# ifdef FEAT_GUI
if (strstr(argv[i], "-wait") != 0)
- /* don't fork() when starting the GUI to edit files ourself */
+ // don't fork() when starting the GUI to edit files ourself
gui.dofork = FALSE;
# endif
}
@@ -1857,9 +1857,9 @@ early_arg_scan(mparm_T *parmp UNUSED)
*/
static int
get_number_arg(
- char_u *p, /* pointer to argument */
- int *idx, /* index in argument, is incremented */
- int def) /* default value */
+ char_u *p, // pointer to argument
+ int *idx, // index in argument, is incremented
+ int def) // default value
{
if (vim_isdigit(p[*idx]))
{
@@ -1888,16 +1888,15 @@ parse_command_name(mparm_T *parmp)
initstr = gettail((char_u *)parmp->argv[0]);
#ifdef FEAT_GUI_MAC
- /* An issue has been seen when launching Vim in such a way that
- * $PWD/$ARGV[0] or $ARGV[0] is not the absolute path to the
- * executable or a symbolic link of it. Until this issue is resolved
- * we prohibit the GUI from being used.
- */
+ // An issue has been seen when launching Vim in such a way that
+ // $PWD/$ARGV[0] or $ARGV[0] is not the absolute path to the
+ // executable or a symbolic link of it. Until this issue is resolved
+ // we prohibit the GUI from being used.
if (STRCMP(initstr, parmp->argv[0]) == 0)
disallow_gui = TRUE;
- /* TODO: On MacOS X default to gui if argv[0] ends in:
- * /Vim.app/Contents/MacOS/Vim */
+ // TODO: On MacOS X default to gui if argv[0] ends in:
+ // /Vim.app/Contents/MacOS/Vim
#endif
#ifdef FEAT_EVAL
@@ -1911,7 +1910,7 @@ parse_command_name(mparm_T *parmp)
++initstr;
}
- /* Use evim mode for "evim" and "egvim", not for "editor". */
+ // Use evim mode for "evim" and "egvim", not for "editor".
if (TOLOWER_ASC(initstr[0]) == 'e'
&& (TOLOWER_ASC(initstr[1]) == 'v'
|| TOLOWER_ASC(initstr[1]) == 'g'))
@@ -1923,7 +1922,7 @@ parse_command_name(mparm_T *parmp)
++initstr;
}
- /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
+ // "gvim" starts the GUI. Also accept "Gvim" for MS-Windows.
if (TOLOWER_ASC(initstr[0]) == 'g')
{
main_start_gui();
@@ -1944,7 +1943,7 @@ parse_command_name(mparm_T *parmp)
{
readonlymode = TRUE;
curbuf->b_p_ro = TRUE;
- p_uc = 10000; /* don't update very often */
+ p_uc = 10000; // don't update very often
initstr += 4;
}
else if (STRNICMP(initstr, "vim", 3) == 0)
@@ -1982,16 +1981,16 @@ command_line_scan(mparm_T *parmp)
{
int argc = parmp->argc;
char **argv = parmp->argv;
- int argv_idx; /* index in argv[n][] */
- int had_minmin = FALSE; /* found "--" argument */
- int want_argument; /* option argument with argument */
+ int argv_idx; // index in argv[n][]
+ int had_minmin = FALSE; // found "--" argument
+ int want_argument; // option argument with argument
int c;
char_u *p = NULL;
long n;
--argc;
++argv;
- argv_idx = 1; /* active option letter is argv[0][argv_idx] */
+ argv_idx = 1; // active option letter is argv[0][argv_idx]
while (argc > 0)
{
/*
@@ -2001,7 +2000,7 @@ command_line_scan(mparm_T *parmp)
{
if (parmp->n_commands >= MAX_ARG_CMDS)
mainerr(ME_EXTRA_CMD, NULL);
- argv_idx = -1; /* skip to next argument */
+ argv_idx = -1; // skip to next argument
if (argv[0][1] == NUL)
parmp->commands[parmp->n_commands++] = (char_u *)"$";
else
@@ -2030,8 +2029,8 @@ command_line_scan(mparm_T *parmp)
#endif
switch (c)
{
- case NUL: /* "vim -" read from stdin */
- /* "ex -" silent mode */
+ case NUL: // "vim -" read from stdin
+ // "ex -" silent mode
if (exmode_active)
silent_mode = TRUE;
else
@@ -2039,27 +2038,27 @@ command_line_scan(mparm_T *parmp)
if (parmp->edit_type != EDIT_NONE)
mainerr(ME_TOO_MANY_ARGS, (char_u *)argv[0]);
parmp->edit_type = EDIT_STDIN;
- read_cmd_fd = 2; /* read from stderr instead of stdin */
+ read_cmd_fd = 2; // read from stderr instead of stdin
}
- argv_idx = -1; /* skip to next argument */
+ argv_idx = -1; // skip to next argument
break;
- case '-': /* "--" don't take any more option arguments */
- /* "--help" give help message */
- /* "--version" give version message */
- /* "--clean" clean context */
- /* "--literal" take files literally */
- /* "--nofork" don't fork */
- /* "--not-a-term" don't warn for not a term */
- /* "--ttyfail" exit if not a term */
- /* "--noplugin[s]" skip plugins */
- /* "--cmd <cmd>" execute cmd before vimrc */
+ case '-': // "--" don't take any more option arguments
+ // "--help" give help message
+ // "--version" give version message
+ // "--clean" clean context
+ // "--literal" take files literally
+ // "--nofork" don't fork
+ // "--not-a-term" don't warn for not a term
+ // "--ttyfail" exit if not a term
+ // "--noplugin[s]" skip plugins
+ // "--cmd <cmd>" execute cmd before vimrc
if (STRICMP(argv[0] + argv_idx, "help") == 0)
usage();
else if (STRICMP(argv[0] + argv_idx, "version") == 0)
{
- Columns = 80; /* need to init Columns */
- info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
+ Columns = 80; // need to init Columns
+ info_message = TRUE; // use mch_msg(), not mch_errmsg()
list_version();
msg_putchar('\n');
msg_didout = FALSE;
@@ -2083,7 +2082,7 @@ command_line_scan(mparm_T *parmp)
else if (STRNICMP(argv[0] + argv_idx, "nofork", 6) == 0)
{
#ifdef FEAT_GUI
- gui.dofork = FALSE; /* don't fork() when starting GUI */
+ gui.dofork = FALSE; // don't fork() when starting GUI
#endif
}
else if (STRNICMP(argv[0] + argv_idx, "noplugin", 8) == 0)
@@ -2104,11 +2103,11 @@ command_line_scan(mparm_T *parmp)
}
#ifdef FEAT_CLIENTSERVER
else if (STRNICMP(argv[0] + argv_idx, "serverlist", 10) == 0)
- ; /* already processed -- no arg */
+ ; // already processed -- no arg
else if (STRNICMP(argv[0] + argv_idx, "servername", 10) == 0
|| STRNICMP(argv[0] + argv_idx, "serversend", 10) == 0)
{
- /* already processed -- snatch the following arg */
+ // already processed -- snatch the following arg
if (argc > 1)
{
--argc;
@@ -2123,7 +2122,7 @@ command_line_scan(mparm_T *parmp)
else if (STRNICMP(argv[0] + argv_idx, "windowid", 8) == 0)
# endif
{
- /* already processed -- snatch the following arg */
+ // already processed -- snatch the following arg
if (argc > 1)
{
--argc;
@@ -2134,7 +2133,7 @@ command_line_scan(mparm_T *parmp)
#ifdef FEAT_GUI_GTK
else if (STRNICMP(argv[0] + argv_idx, "echo-wid", 8) == 0)
{
- /* already processed, skip */
+ // already processed, skip
}
#endif
else
@@ -2144,10 +2143,10 @@ command_line_scan(mparm_T *parmp)
had_minmin = TRUE;
}
if (!want_argument)
- argv_idx = -1; /* skip to next argument */
+ argv_idx = -1; // skip to next argument
break;
- case 'A': /* "-A" start in Arabic mode */
+ case 'A': // "-A" start in Arabic mode
#ifdef FEAT_ARABIC
set_option_value((char_u *)"arabic", 1L, NULL, 0);
#else
@@ -2156,53 +2155,53 @@ command_line_scan(mparm_T *parmp)
#endif
break;
- case 'b': /* "-b" binary mode */
- /* Needs to be effective before expanding file names, because
- * for Win32 this makes us edit a shortcut file itself,
- * instead of the file it links to. */
+ case 'b': // "-b" binary mode
+ // Needs to be effective before expanding file names, because
+ // for Win32 this makes us edit a shortcut file itself,
+ // instead of the file it links to.
set_options_bin(curbuf->b_p_bin, 1, 0);
- curbuf->b_p_bin = 1; /* binary file I/O */
+ curbuf->b_p_bin = 1; // binary file I/O
break;
- case 'C': /* "-C" Compatible */
+ case 'C': // "-C" Compatible
change_compatible(TRUE);
has_dash_c_arg = TRUE;
break;
- case 'e': /* "-e" Ex mode */
+ case 'e': // "-e" Ex mode
exmode_active = EXMODE_NORMAL;
break;
- case 'E': /* "-E" Improved Ex mode */
+ case 'E': // "-E" Improved Ex mode
exmode_active = EXMODE_VIM;
break;
- case 'f': /* "-f" GUI: run in foreground. Amiga: open
- window directly, not with newcli */
+ case 'f': // "-f" GUI: run in foreground. Amiga: open
+ // window directly, not with newcli
#ifdef FEAT_GUI
- gui.dofork = FALSE; /* don't fork() when starting GUI */
+ gui.dofork = FALSE; // don't fork() when starting GUI
#endif
break;
- case 'g': /* "-g" start GUI */
+ case 'g': // "-g" start GUI
main_start_gui();
break;
- case 'F': /* "-F" was for Farsi mode */
+ case 'F': // "-F" was for Farsi mode
mch_errmsg(_(e_nofarsi));
mch_exit(2);
break;
- case '?': /* "-?" give help message (for MS-Windows) */
- case 'h': /* "-h" give help message */
+ case '?': // "-?" give help message (for MS-Windows)
+ case 'h': // "-h" give help message
#ifdef FEAT_GUI_GNOME
- /* Tell usage() to exit for "gvim". */
+ // Tell usage() to exit for "gvim".
gui.starting = FALSE;
#endif
usage();
break;
- case 'H': /* "-H" start in Hebrew mode: rl + hkmap set */
+ case 'H': // "-H" start in Hebrew mode: rl + hkmap set
#ifdef FEAT_RIGHTLEFT
p_hkmap = TRUE;
set_option_value((char_u *)"rl", 1L, NULL, 0);
@@ -2212,132 +2211,132 @@ command_line_scan(mparm_T *parmp)
#endif
break;
- case 'l': /* "-l" lisp mode, 'lisp' and 'showmatch' on */
+ case 'l': // "-l" lisp mode, 'lisp' and 'showmatch' on
#ifdef FEAT_LISP
set_option_value((char_u *)"lisp", 1L, NULL, 0);
p_sm = TRUE;
#endif
break;
- case 'M': /* "-M" no changes or writing of files */
+ case 'M': // "-M" no changes or writing of files
reset_modifiable();
- /* FALLTHROUGH */
+ // FALLTHROUGH
- case 'm': /* "-m" no writing of files */
+ case 'm': // "-m" no writing of files
p_write = FALSE;
break;
- case 'y': /* "-y" easy mode */
+ case 'y': // "-y" easy mode
#ifdef FEAT_GUI
- gui.starting = TRUE; /* start GUI a bit later */
+ gui.starting = TRUE; // start GUI a bit later
#endif
parmp->evim_mode = TRUE;
break;
- case 'N': /* "-N" Nocompatible */
+ case 'N': // "-N" Nocompatible
change_compatible(FALSE);
break;
- case 'n': /* "-n" no swap file */
+ case 'n': // "-n" no swap file
#ifdef FEAT_NETBEANS_INTG
- /* checking for "-nb", netbeans parameters */
+ // checking for "-nb", netbeans parameters
if (argv[0][argv_idx] == 'b')
{
netbeansArg = argv[0];
- argv_idx = -1; /* skip to next argument */
+ argv_idx = -1; // skip to next argument
}
else
#endif
parmp->no_swap_file = TRUE;
break;
- case 'p': /* "-p[N]" open N tab pages */
+ case 'p': // "-p[N]" open N tab pages
#ifdef TARGET_API_MAC_OSX
- /* For some reason on MacOS X, an argument like:
- -psn_0_10223617 is passed in when invoke from Finder
- or with the 'open' command */
+ // For some reason on MacOS X, an argument like:
+ // -psn_0_10223617 is passed in when invoke from Finder
+ // or with the 'open' command
if (argv[0][argv_idx] == 's')
{
- argv_idx = -1; /* bypass full -psn */
+ argv_idx = -1; // bypass full -psn
main_start_gui();
break;
}
#endif
- /* default is 0: open window for each file */
+ // default is 0: open window for each file
parmp->window_count = get_number_arg((char_u *)argv[0],
&argv_idx, 0);
parmp->window_layout = WIN_TABS;
break;
- case 'o': /* "-o[N]" open N horizontal split windows */
- /* default is 0: open window for each file */
+ case 'o': // "-o[N]" open N horizontal split windows
+ // default is 0: open window for each file
parmp->window_count = get_number_arg((char_u *)argv[0],
&argv_idx, 0);
parmp->window_layout = WIN_HOR;
break;
- case 'O': /* "-O[N]" open N vertical split windows */
- /* default is 0: open window for each file */
+ case 'O': // "-O[N]" open N vertical split windows
+ // default is 0: open window for each file
parmp->window_count = get_number_arg((char_u *)argv[0],
&argv_idx, 0);
parmp->window_layout = WIN_VER;
break;
#ifdef FEAT_QUICKFIX
- case 'q': /* "-q" QuickFix mode */
+ case 'q': // "-q" QuickFix mode
if (parmp->edit_type != EDIT_NONE)
mainerr(ME_TOO_MANY_ARGS, (char_u *)argv[0]);
parmp->edit_type = EDIT_QF;
- if (argv[0][argv_idx]) /* "-q{errorfile}" */
+ if (argv[0][argv_idx]) // "-q{errorfile}"
{
parmp->use_ef = (char_u *)argv[0] + argv_idx;
argv_idx = -1;
}
- else if (argc > 1) /* "-q {errorfile}" */
+ else if (argc > 1) // "-q {errorfile}"
want_argument = TRUE;
break;
#endif
- case 'R': /* "-R" readonly mode */
+ case 'R': // "-R" readonly mode
readonlymode = TRUE;
curbuf->b_p_ro = TRUE;
- p_uc = 10000; /* don't update very often */
+ p_uc = 10000; // don't update very often
break;
- case 'r': /* "-r" recovery mode */
- case 'L': /* "-L" recovery mode */
+ case 'r': // "-r" recovery mode
+ case 'L': // "-L" recovery mode
recoverymode = 1;
break;
case 's':
- if (exmode_active) /* "-s" silent (batch) mode */
+ if (exmode_active) // "-s" silent (batch) mode
silent_mode = TRUE;
- else /* "-s {scriptin}" read from script file */
+ else // "-s {scriptin}" read from script file
want_argument = TRUE;
break;
- case 't': /* "-t {tag}" or "-t{tag}" jump to tag */
+ case 't': // "-t {tag}" or "-t{tag}" jump to tag
if (parmp->edit_type != EDIT_NONE)
mainerr(ME_TOO_MANY_ARGS, (char_u *)argv[0]);
parmp->edit_type = EDIT_TAG;
- if (argv[0][argv_idx]) /* "-t{tag}" */
+ if (argv[0][argv_idx]) // "-t{tag}"
{
parmp->tagname = (char_u *)argv[0] + argv_idx;
argv_idx = -1;
}
- else /* "-t {tag}" */
+ else // "-t {tag}"
want_argument = TRUE;
break;
#ifdef FEAT_EVAL
- case 'D': /* "-D" Debugging */
+ case 'D': // "-D" Debugging
parmp->use_debug_break_level = 9999;
break;
#endif
#ifdef FEAT_DIFF
- case 'd': /* "-d" 'diff' */
+ case 'd': // "-d" 'diff'
# ifdef AMIGA
- /* check for "-dev {device}" */
+ // check for "-dev {device}"
if (argv[0][argv_idx] == 'e' && argv[0][argv_idx + 1] == 'v')
want_argument = TRUE;
else
@@ -2345,8 +2344,8 @@ command_line_scan(mparm_T *parmp)
parmp->diff_mode = TRUE;
break;
#endif
- case 'V': /* "-V{N}" Verbose level */
- /* default is 10: a little bit verbose */
+ case 'V': // "-V{N}" Verbose level
+ // default is 10: a little bit verbose
p_verbose = get_number_arg((char_u *)argv[0], &argv_idx, 10);
if (argv[0][argv_idx] != NUL)
{
@@ -2356,15 +2355,15 @@ command_line_scan(mparm_T *parmp)
}
break;
- case 'v': /* "-v" Vi-mode (as if called "vi") */
+ case 'v': // "-v" Vi-mode (as if called "vi")
exmode_active = 0;
#if defined(FEAT_GUI) && !defined(VIMDLL)
- gui.starting = FALSE; /* don't start GUI */
+ gui.starting = FALSE; // don't start GUI
#endif
break;
- case 'w': /* "-w{number}" set window height */
- /* "-w {scriptout}" write to script */
+ case 'w': // "-w{number}" set window height
+ // "-w {scriptout}" write to script
if (vim_isdigit(((char_u *)argv[0])[argv_idx]))
{
n = get_number_arg((char_u *)argv[0], &argv_idx, 10);
@@ -2375,23 +2374,23 @@ command_line_scan(mparm_T *parmp)
break;
#ifdef FEAT_CRYPT
- case 'x': /* "-x" encrypted reading/writing of files */
+ case 'x': // "-x" encrypted reading/writing of files
parmp->ask_for_key = TRUE;
break;
#endif
- case 'X': /* "-X" don't connect to X server */
+ case 'X': // "-X" don't connect to X server
#if (defined(UNIX) || defined(VMS)) && defined(FEAT_X11)
x_no_connect = TRUE;
#endif
break;
- case 'Z': /* "-Z" restricted mode */
+ case 'Z': // "-Z" restricted mode
restricted = TRUE;
break;
- case 'c': /* "-c{command}" or "-c {command}" execute
- command */
+ case 'c': // "-c{command}" or "-c {command}" execute
+ // command
if (argv[0][argv_idx] != NUL)
{
if (parmp->n_commands >= MAX_ARG_CMDS)
@@ -2401,18 +2400,18 @@ command_line_scan(mparm_T *parmp)
argv_idx = -1;
break;
}
- /* FALLTHROUGH */
- case 'S': /* "-S {file}" execute Vim script */
- case 'i': /* "-i {viminfo}" use for viminfo */
+ // FALLTHROUGH
+ case 'S': // "-S {file}" execute Vim script
+ case 'i': // "-i {viminfo}" use for viminfo
#ifndef FEAT_DIFF
- case 'd': /* "-d {device}" device (for Amiga) */
+ case 'd': // "-d {device}" device (for Amiga)
#endif
- case 'T': /* "-T {terminal}" terminal name */
- case 'u': /* "-u {vimrc}" vim inits file */
- case 'U': /* "-U {gvimrc}" gvim inits file */
- case 'W': /* "-W {scriptout}" overwrite */
+ case 'T': // "-T {terminal}" terminal name
+ case 'u': // "-u {vimrc}" vim inits file
+ case 'U': // "-U {gvimrc}" gvim inits file
+ case 'W': // "-W {scriptout}" overwrite
#ifdef FEAT_GUI_MSWIN
- case 'P': /* "-P {parent title}" MDI parent */
+ case 'P': // "-P {parent title}" MDI parent
#endif
want_argument = TRUE;
break;
@@ -2433,15 +2432,15 @@ command_line_scan(mparm_T *parmp)
mainerr(ME_GARBAGE, (char_u *)argv[0]);
--argc;
- if (argc < 1 && c != 'S') /* -S has an optional argument */
+ if (argc < 1 && c != 'S') // -S has an optional argument
mainerr_arg_missing((char_u *)argv[0]);
++argv;
argv_idx = -1;
switch (c)
{
- case 'c': /* "-c {command}" execute command */
- case 'S': /* "-S {file}" execute Vim script */
+ case 'c': // "-c {command}" execute command
+ case 'S': // "-S {file}" execute Vim script
if (parmp->n_commands >= MAX_ARG_CMDS)
mainerr(ME_EXTRA_CMD, NULL);
if (c == 'S')
@@ -2449,13 +2448,13 @@ command_line_scan(mparm_T *parmp)
char *a;
if (argc < 1)
- /* "-S" without argument: use default session file
- * name. */
+ // "-S" without argument: use default session file
+ // name.
a = SESSION_FILE;
else if (argv[0][0] == '-')
{
- /* "-S" followed by another option: use default
- * session file name. */
+ // "-S" followed by another option: use default
+ // session file name.
a = SESSION_FILE;
++argc;
--argv;
@@ -2477,29 +2476,29 @@ command_line_scan(mparm_T *parmp)
case '-':
if (argv[-1][2] == 'c')
{
- /* "--cmd {command}" execute command */
+ // "--cmd {command}" execute command
if (parmp->n_pre_commands >= MAX_ARG_CMDS)
mainerr(ME_EXTRA_CMD, NULL);
parmp->pre_commands[parmp->n_pre_commands++] =
(char_u *)argv[0];
}
- /* "--startuptime <file>" already handled */
+ // "--startuptime <file>" already handled
break;
- /* case 'd': -d {device} is handled in mch_check_win() for the
- * Amiga */
+ // case 'd': -d {device} is handled in mch_check_win() for the
+ // Amiga
#ifdef FEAT_QUICKFIX
- case 'q': /* "-q {errorfile}" QuickFix mode */
+ case 'q': // "-q {errorfile}" QuickFix mode
parmp->use_ef = (char_u *)argv[0];
break;
#endif
- case 'i': /* "-i {viminfo}" use for viminfo */
+ case 'i': // "-i {viminfo}" use for viminfo
set_option_value((char_u *)"vif", 0L, (char_u *)argv[0], 0);
break;
- case 's': /* "-s {scriptin}" read from script file */
+ case 's': // "-s {scriptin}" read from script file
if (scriptin[0] != NULL)
{
scripterror:
@@ -2518,14 +2517,14 @@ scripterror:
mch_exit(2);
}
if (save_typebuf() == FAIL)
- mch_exit(2); /* out of memory */
+ mch_exit(2); // out of memory
break;
- case 't': /* "-t {tag}" */
+ case 't': // "-t {tag}"
parmp->tagname = (char_u *)argv[0];
break;
- case 'T': /* "-T {terminal}" terminal name */
+ case 'T': // "-T {terminal}" terminal name
/*
* The -T term argument is always available and when
* HAVE_TERMLIB is supported it overrides the environment
@@ -2533,24 +2532,24 @@ scripterror:
*/
#ifdef FEAT_GUI
if (term_is_gui((char_u *)argv[0]))
- gui.starting = TRUE; /* start GUI a bit later */
+ gui.starting = TRUE; // start GUI a bit later
else
#endif
parmp->term = (char_u *)argv[0];
break;
- case 'u': /* "-u {vimrc}" vim inits file */
+ case 'u': // "-u {vimrc}" vim inits file
parmp->use_vimrc = (char_u *)argv[0];
break;
- case 'U': /* "-U {gvimrc}" gvim inits file */
+ case 'U': // "-U {gvimrc}" gvim inits file
#ifdef FEAT_GUI
use_gvimrc = (char_u *)argv[0];
#endif
break;
- case 'w': /* "-w {nr}" 'window' value */
- /* "-w {scriptout}" append to script file */
+ case 'w': // "-w {nr}" 'window' value
+ // "-w {scriptout}" append to script file
if (vim_isdigit(*((char_u *)argv[0])))
{
argv_idx = 0;
@@ -2559,8 +2558,8 @@ scripterror:
argv_idx = -1;
break;
}
- /* FALLTHROUGH */
- case 'W': /* "-W {scriptout}" overwrite script file */
+ // FALLTHROUGH
+ case 'W': // "-W {scriptout}" overwrite script file
if (scriptout != NULL)
goto scripterror;
if ((scriptout = mch_fopen(argv[0],
@@ -2574,7 +2573,7 @@ scripterror:
break;
#ifdef FEAT_GUI_MSWIN
- case 'P': /* "-P {parent title}" MDI parent */
+ case 'P': // "-P {parent title}" MDI parent
gui_mch_set_parent(argv[0]);
break;
#endif
@@ -2587,21 +2586,21 @@ scripterror:
*/
else
{
- argv_idx = -1; /* skip to next argument */
+ argv_idx = -1; // skip to next argument
- /* Check for only one type of editing. */
+ // Check for only one type of editing.
if (parmp->edit_type != EDIT_NONE && parmp->edit_type != EDIT_FILE)
mainerr(ME_TOO_MANY_ARGS, (char_u *)argv[0]);
parmp->edit_type = EDIT_FILE;
#ifdef MSWIN
- /* Remember if the argument was a full path before changing
- * slashes to backslashes. */
+ // Remember if the argument was a full path before changing
+ // slashes to backslashes.
if (argv[0][0] != NUL && argv[0][1] == ':' && argv[0][2] == '\\')
parmp->full_path = TRUE;
#endif
- /* Add the file to the global argument list. */
+ // Add the file to the global argument list.
if (ga_grow(&global_alist.al_ga, 1) == FAIL
|| (p = vim_strsave((char_u *)argv[0])) == NULL)
mch_exit(2);
@@ -2643,22 +2642,22 @@ scripterror:
#endif
#ifdef USE_FNAME_CASE
- /* Make the case of the file name match the actual file. */
+ // Make the case of the file name match the actual file.
fname_case(p, 0);
#endif
alist_add(&global_alist, p,
#ifdef EXPAND_FILENAMES
- parmp->literal ? 2 : 0 /* add buffer nr after exp. */
+ parmp->literal ? 2 : 0 // add buffer nr after exp.
#else
- 2 /* add buffer number now and use curbuf */
+ 2 // add buffer number now and use curbuf
#endif
);
#ifdef MSWIN
{
- /* Remember this argument has been added to the argument list.
- * Needed when 'encoding' is changed. */
+ // Remember this argument has been added to the argument list.
+ // Needed when 'encoding' is changed.
used_file_arg(argv[0], parmp->literal, parmp->full_path,
# ifdef FEAT_DIFF
parmp->diff_mode
@@ -2684,8 +2683,8 @@ scripterror:
}
#ifdef FEAT_EVAL
- /* If there is a "+123" or "-c" command, set v:swapcommand to the first
- * one. */
+ // If there is a "+123" or "-c" command, set v:swapcommand to the first
+ // one.
if (parmp->n_commands > 0)
{
p = alloc(STRLEN(parmp->commands[0]) + 3);
@@ -2706,7 +2705,7 @@ scripterror:
static void
check_tty(mparm_T *parmp)
{
- int input_isatty; /* is active input a terminal? */
+ int input_isatty; // is active input a terminal?
input_isatty = mch_input_isatty();
if (exmode_active)
@@ -2716,7 +2715,7 @@ check_tty(mparm_T *parmp)
}
else if (parmp->want_full_screen && (!stdout_isatty || !input_isatty)
#ifdef FEAT_GUI
- /* don't want the delay when started from the desktop */
+ // don't want the delay when started from the desktop
&& !gui.starting
#endif
&& !parmp->not_a_term)
@@ -2746,14 +2745,14 @@ check_tty(mparm_T *parmp)
&& defined(FEAT_GETTEXT)
char *s, *tofree = NULL;
- /* Set the encoding of the error message based on $LC_ALL or
- * other environment variables instead of 'encoding'.
- * Note that the message is shown on a Cygwin terminal (e.g.
- * mintty) which encoding is based on $LC_ALL or etc., not the
- * current codepage used by normal Win32 console programs. */
+ // Set the encoding of the error message based on $LC_ALL or
+ // other environment variables instead of 'encoding'.
+ // Note that the message is shown on a Cygwin terminal (e.g.
+ // mintty) which encoding is based on $LC_ALL or etc., not the
+ // current codepage used by normal Win32 console programs.
tofree = s = (char *)enc_locale_env(NULL);
if (s == NULL)
- s = "utf-8"; /* Use "utf-8" by default. */
+ s = "utf-8"; // Use "utf-8" by default.
(void)bind_textdomain_codeset(VIMPACKAGE, s);
vim_free(tofree);
# endif
@@ -2818,14 +2817,14 @@ create_windows(mparm_T *parmp UNUSED)
/*
* Create the number of windows that was requested.
*/
- if (parmp->window_count == -1) /* was not set */
+ if (parmp->window_count == -1) // was not set
parmp->window_count = 1;
if (parmp->window_count == 0)
parmp->window_count = GARGCOUNT;
if (parmp->window_count > 1)
{
- /* Don't change the windows if there was a command in .vimrc that
- * already split some windows */
+ // Don't change the windows if there was a command in .vimrc that
+ // already split some windows
if (parmp->window_layout == 0)
parmp->window_layout = WIN_HOR;
if (parmp->window_layout == WIN_TABS)
@@ -2845,13 +2844,13 @@ create_windows(mparm_T *parmp UNUSED)
else
parmp->window_count = 1;
- if (recoverymode) /* do recover */
+ if (recoverymode) // do recover
{
- msg_scroll = TRUE; /* scroll message up */
+ msg_scroll = TRUE; // scroll message up
ml_recover(TRUE);
- if (curbuf->b_ml.ml_mfp == NULL) /* failed */
+ if (curbuf->b_ml.ml_mfp == NULL) // failed
getout(1);
- do_modelines(0); /* do modelines */
+ do_modelines(0); // do modelines
}
else
{
@@ -2892,7 +2891,7 @@ create_windows(mparm_T *parmp UNUSED)
if (curbuf->b_ml.ml_mfp == NULL)
{
#ifdef FEAT_FOLDING
- /* Set 'foldlevel' to 'foldlevelstart' if it's not negative. */
+ // Set 'foldlevel' to 'foldlevelstart' if it's not negative.
if (p_fdls >= 0)
curwin->w_p_fdl = p_fdls;
#endif
@@ -2901,32 +2900,32 @@ create_windows(mparm_T *parmp UNUSED)
set_buflisted(TRUE);
- /* create memfile, read file */
+ // create memfile, read file
(void)open_buffer(FALSE, NULL, 0);
if (swap_exists_action == SEA_QUIT)
{
if (got_int || only_one_window())
{
- /* abort selected or quit and only one window */
- did_emsg = FALSE; /* avoid hit-enter prompt */
+ // abort selected or quit and only one window
+ did_emsg = FALSE; // avoid hit-enter prompt
getout(1);
}
- /* We can't close the window, it would disturb what
- * happens next. Clear the file name and set the arg
- * index to -1 to delete it later. */
+ // We can't close the window, it would disturb what
+ // happens next. Clear the file name and set the arg
+ // index to -1 to delete it later.
setfname(curbuf, NULL, NULL, FALSE);
curwin->w_arg_idx = -1;
swap_exists_action = SEA_NONE;
}
else
handle_swap_exists(NULL);
- dorewind = TRUE; /* start again */
+ dorewind = TRUE; // start again
}
ui_breakcheck();
if (got_int)
{
- (void)vgetc(); /* only break the file loading, not the rest */
+ (void)vgetc(); // only break the file loading, not the rest
break;
}
}
@@ -2947,9 +2946,9 @@ create_windows(mparm_T *parmp UNUSED)
static void
edit_buffers(
mparm_T *parmp,
- char_u *cwd) /* current working dir */
+ char_u *cwd) // current working dir
{
- int arg_idx; /* index in argument list */
+ int arg_idx; // index in argument list
int i;
int advance = TRUE;
win_T *win;
@@ -2961,7 +2960,7 @@ edit_buffers(
++autocmd_no_enter;
++autocmd_no_leave;
- /* When w_arg_idx is -1 remove the window (see create_windows()). */
+ // When w_arg_idx is -1 remove the window (see create_windows()).
if (curwin->w_arg_idx == -1)
{
win_close(curwin, TRUE);
@@ -2973,7 +2972,7 @@ edit_buffers(
{
if (cwd != NULL)
mch_chdir((char *)cwd);
- /* When w_arg_idx is -1 remove the window (see create_windows()). */
+ // When w_arg_idx is -1 remove the window (see create_windows()).
if (curwin->w_arg_idx == -1)
{
++arg_idx;
@@ -2986,7 +2985,7 @@ edit_buffers(
{
if (parmp->window_layout == WIN_TABS)
{
- if (curtab->tp_next == NULL) /* just checking */
+ if (curtab->tp_next == NULL) // just checking
break;
goto_tabpage(0);
// Temporarily reset 'shm' option to not print fileinfo when
@@ -3003,31 +3002,31 @@ edit_buffers(
}
else
{
- if (curwin->w_next == NULL) /* just checking */
+ if (curwin->w_next == NULL) // just checking
break;
win_enter(curwin->w_next, FALSE);
}
}
advance = TRUE;
- /* Only open the file if there is no file in this window yet (that can
- * happen when .vimrc contains ":sall"). */
+ // Only open the file if there is no file in this window yet (that can
+ // happen when .vimrc contains ":sall").
if (curbuf == firstwin->w_buffer || curbuf->b_ffname == NULL)
{
curwin->w_arg_idx = arg_idx;
- /* Edit file from arg list, if there is one. When "Quit" selected
- * at the ATTENTION prompt close the window. */
+ // Edit file from arg list, if there is one. When "Quit" selected
+ // at the ATTENTION prompt close the window.
swap_exists_did_quit = FALSE;
(void)do_ecmd(0, arg_idx < GARGCOUNT
? alist_name(&GARGLIST[arg_idx]) : NULL,
NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
if (swap_exists_did_quit)
{
- /* abort or quit selected */
+ // abort or quit selected
if (got_int || only_one_window())
{
- /* abort selected and only one window */
- did_emsg = FALSE; /* avoid hit-enter prompt */
+ // abort selected and only one window
+ did_emsg = FALSE; // avoid hit-enter prompt
getout(1);
}
win_close(curwin, TRUE);
@@ -3040,7 +3039,7 @@ edit_buffers(
ui_breakcheck();
if (got_int)
{
- (void)vgetc(); /* only break the file loading, not the rest */
+ (void)vgetc(); // only break the file loading, not the rest
break;
}
}
@@ -3055,10 +3054,10 @@ edit_buffers(
goto_tabpage(1);
--autocmd_no_enter;
- /* make the first window the current window */
+ // make the first window the current window
win = firstwin;
#if defined(FEAT_QUICKFIX)
- /* Avoid making a preview window the current window. */
+ // Avoid making a preview window the current window.
while (win->w_p_pvw)
{
win = win->w_next;
@@ -3074,7 +3073,7 @@ edit_buffers(
--autocmd_no_leave;
TIME_MSG("editing files in windows");
if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS)
- win_equal(curwin, FALSE, 'b'); /* adjust heights */
+ win_equal(curwin, FALSE, 'b'); // adjust heights
}
/*
@@ -3089,7 +3088,7 @@ exe_pre_commands(mparm_T *parmp)
if (cnt > 0)
{
- curwin->w_cursor.lnum = 0; /* just in case.. */
+ curwin->w_cursor.lnum = 0; // just in case..
sourcing_name = (char_u *)_("pre-vimrc command line");
# ifdef FEAT_EVAL
current_sctx.sc_sid = SID_CMDARG;
@@ -3142,7 +3141,7 @@ exe_commands(mparm_T *parmp)
msg_scroll = FALSE;
#ifdef FEAT_QUICKFIX
- /* When started with "-q errorfile" jump to first error again. */
+ // When started with "-q errorfile" jump to first error again.
if (parmp->edit_type == EDIT_QF)
qf_jump(NULL, 0, 0, FALSE);
#endif
@@ -3179,7 +3178,7 @@ source_startup_scripts(mparm_T *parmp)
|| STRCMP(parmp->use_vimrc, "NORC") == 0)
{
#ifdef FEAT_GUI
- if (use_gvimrc == NULL) /* don't load gvimrc either */
+ if (use_gvimrc == NULL) // don't load gvimrc either
use_gvimrc = parmp->use_vimrc;
#endif
}
@@ -3195,7 +3194,7 @@ source_startup_scripts(mparm_T *parmp)
struct Process *proc = (struct Process *)FindTask(0L);
APTR save_winptr = proc->pr_WindowPtr;
- /* Avoid a requester here for a volume that doesn't exist. */
+ // Avoid a requester here for a volume that doesn't exist.
proc->pr_WindowPtr = (APTR)-1L;
#endif
@@ -3241,7 +3240,7 @@ source_startup_scripts(mparm_T *parmp)
#endif
&& !has_dash_c_arg)
{
- /* When no .vimrc file was found: source defaults.vim. */
+ // When no .vimrc file was found: source defaults.vim.
do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE);
}
}
@@ -3258,7 +3257,7 @@ source_startup_scripts(mparm_T *parmp)
if (p_exrc)
{
#if defined(UNIX) || defined(VMS)
- /* If ".vimrc" file is not owned by user, set 'secure' mode. */
+ // If ".vimrc" file is not owned by user, set 'secure' mode.
if (!file_owned(VIMRC_FILE))
#endif
secure = p_secure;
@@ -3284,7 +3283,7 @@ source_startup_scripts(mparm_T *parmp)
if (i == FAIL)
{
#if defined(UNIX) || defined(VMS)
- /* if ".exrc" is not owned by user set 'secure' mode */
+ // if ".exrc" is not owned by user set 'secure' mode
if (!file_owned(EXRC_FILE))
secure = p_secure;
else
@@ -3317,7 +3316,7 @@ source_startup_scripts(mparm_T *parmp)
main_start_gui(void)
{
#ifdef FEAT_GUI
- gui.starting = TRUE; /* start GUI a bit later */
+ gui.starting = TRUE; // start GUI a bit later
#else
mch_errmsg(_(e_nogvim));
mch_errmsg("\n");
@@ -3325,7 +3324,7 @@ main_start_gui(void)
#endif
}
-#endif /* NO_VIM_MAIN */
+#endif // NO_VIM_MAIN
/*
* Get an environment variable, and execute it as Ex commands.
@@ -3334,7 +3333,7 @@ main_start_gui(void)
int
process_env(
char_u *env,
- int is_viminit) /* when TRUE, called for VIMINIT */
+ int is_viminit) // when TRUE, called for VIMINIT
{
char_u *initstr;
char_u *save_sourcing_name;
@@ -3381,7 +3380,7 @@ file_owned(char *fname)
stat_T s;
# ifdef UNIX
uid_t uid = getuid();
-# else /* VMS */
+# else // VMS
uid_t uid = ((getgid() << 16) | getuid());
# endif
@@ -3398,11 +3397,11 @@ file_owned(char *fname)
*/
static void
mainerr(
- int n, /* one of the ME_ defines */
- char_u *str) /* extra argument or NULL */
+ int n, // one of the ME_ defines
+ char_u *str) // extra argument or NULL
{
#if defined(UNIX) || defined(VMS)
- reset_signals(); /* kill us with CTRL-C here, if you like */
+ reset_signals(); // kill us with CTRL-C here, if you like
#endif
// If this is a Windows GUI executable, show an error dialog box.
@@ -3464,7 +3463,7 @@ usage(void)
};
#if defined(UNIX) || defined(VMS)
- reset_signals(); /* kill us with CTRL-C here, if you like */
+ reset_signals(); // kill us with CTRL-C here, if you like
#endif
init_longVersion();
@@ -3608,7 +3607,7 @@ usage(void)
main_msg(_("-reverse\t\tUse reverse video (also: -rv)"));
main_msg(_("+reverse\t\tDon't use reverse video (also: +rv)"));
main_msg(_("-xrm <resource>\tSet the specified resource"));
-#endif /* FEAT_GUI_X11 */
+#endif // FEAT_GUI_X11
#ifdef FEAT_GUI_GTK
mch_msg(_("\nArguments recognised by gvim (GTK+ version):\n"));
main_msg(_("-font <font>\t\tUse <font> for normal text (also: -fn)"));
@@ -3630,7 +3629,7 @@ usage(void)
#endif
#ifdef FEAT_GUI_GNOME
- /* Gnome gives extra messages for --help if we continue, but not for -h. */
+ // Gnome gives extra messages for --help if we continue, but not for -h.
if (gui.starting)
{
mch_msg("\n");
@@ -3654,7 +3653,7 @@ check_swap_exists_action(void)
handle_swap_exists(NULL);
}
-#endif /* NO_VIM_MAIN */
+#endif // NO_VIM_MAIN
#if defined(STARTUPTIME) || defined(PROTO)
static struct timeval prev_timeval;
@@ -3702,7 +3701,7 @@ time_push(void *tv_rel, void *tv_start)
*/
void
time_pop(
- void *tp) /* actually (struct timeval *) */
+ void *tp) // actually (struct timeval *)
{
prev_timeval.tv_usec -= ((struct timeval *)tp)->tv_usec;
prev_timeval.tv_sec -= ((struct timeval *)tp)->tv_sec;
@@ -3728,8 +3727,8 @@ time_diff(struct timeval *then, struct timeval *now)
void
time_msg(
char *mesg,
- void *tv_start) /* only for do_source: start time; actually
- (struct timeval *) */
+ void *tv_start) // only for do_source: start time; actually
+ // (struct timeval *)
{
static struct timeval start;
struct timeval now;
@@ -3767,10 +3766,10 @@ set_progpath(char_u *argv0)
char_u *val = argv0;
# ifdef MSWIN
- /* A relative path containing a "/" will become invalid when using ":cd",
- * turn it into a full path.
- * On MS-Windows "vim" should be expanded to "vim.exe", thus always do
- * this. */
+ // A relative path containing a "/" will become invalid when using ":cd",
+ // turn it into a full path.
+ // On MS-Windows "vim" should be expanded to "vim.exe", thus always do
+ // this.
char_u *path = NULL;
if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
@@ -3804,7 +3803,7 @@ set_progpath(char_u *argv0)
# endif
}
-#endif /* NO_VIM_MAIN */
+#endif // NO_VIM_MAIN
#if (defined(FEAT_CLIENTSERVER) && !defined(NO_VIM_MAIN)) || defined(PROTO)
@@ -3823,7 +3822,7 @@ exec_on_server(mparm_T *parmp)
if (parmp->serverName_arg == NULL || *parmp->serverName_arg != NUL)
{
# ifdef MSWIN
- /* Initialise the client/server messaging infrastructure. */
+ // Initialise the client/server messaging infrastructure.
serverInitMessaging();
# endif
@@ -3839,9 +3838,9 @@ exec_on_server(mparm_T *parmp)
parmp->serverStrEnc = vim_strsave(p_enc);
}
- /* If we're still running, get the name to register ourselves.
- * On Win32 can register right now, for X11 need to setup the
- * clipboard first, it's further down. */
+ // If we're still running, get the name to register ourselves.
+ // On Win32 can register right now, for X11 need to setup the
+ // clipboard first, it's further down.
parmp->servername = serverMakeName(parmp->serverName_arg,
parmp->argv[0]);
# ifdef MSWIN
@@ -3947,7 +3946,7 @@ cmdsrv_main(
for (i = 1; i < Argc; i++)
{
res = NULL;
- if (STRCMP(argv[i], "--") == 0) /* end of option arguments */
+ if (STRCMP(argv[i], "--") == 0) // end of option arguments
{
for (; i < *argc; i++)
{
@@ -4006,7 +4005,7 @@ cmdsrv_main(
tabs, argtype == ARGTYPE_EDIT_WAIT);
if (*serverStr == NULL)
{
- /* Probably out of memory, exit. */
+ // Probably out of memory, exit.
didone = TRUE;
exiterr = 1;
break;
@@ -4023,28 +4022,28 @@ cmdsrv_main(
ret = serverSendToVim(xterm_dpy, sname, *serverStr,
NULL, &srv, 0, 0, 0, silent);
# else
- /* Win32 always works? */
+ // Win32 always works?
ret = serverSendToVim(sname, *serverStr, NULL, &srv, 0, 0, silent);
# endif
if (ret < 0)
{
if (argtype == ARGTYPE_SEND)
{
- /* Failed to send, abort. */
+ // Failed to send, abort.
mch_errmsg(_(": Send failed.\n"));
didone = TRUE;
exiterr = 1;
}
else if (!silent)
- /* Let vim start normally. */
+ // Let vim start normally.
mch_errmsg(_(": Send failed. Trying to execute locally\n"));
break;
}
# ifdef FEAT_GUI_MSWIN
- /* Guess that when the server name starts with "g" it's a GUI
- * server, which we can bring to the foreground here.
- * Foreground() in the server doesn't work very well. */
+ // Guess that when the server name starts with "g" it's a GUI
+ // server, which we can bring to the foreground here.
+ // Foreground() in the server doesn't work very well.
if (argtype != ARGTYPE_SEND && TOUPPER_ASC(*sname) == 'G')
SetForegroundWindow(srv);
# endif
@@ -4066,7 +4065,7 @@ cmdsrv_main(
# endif
if (numFiles > 0 && argv[i + 1][0] == '+')
- /* Skip "+cmd" argument, don't wait for it to be edited. */
+ // Skip "+cmd" argument, don't wait for it to be edited.
--numFiles;
# ifdef FEAT_GUI_MSWIN
@@ -4079,7 +4078,7 @@ cmdsrv_main(
Shell_NotifyIcon(NIM_ADD, &ni);
# endif
- /* Wait for all files to unload in remote */
+ // Wait for all files to unload in remote
vim_memset(done, 0, numFiles);
while (memchr(done, 0, numFiles) != NULL)
{
@@ -4113,7 +4112,7 @@ cmdsrv_main(
if (i == *argc - 1)
mainerr_arg_missing((char_u *)argv[i]);
# ifdef MSWIN
- /* Win32 always works? */
+ // Win32 always works?
if (serverSendToVim(sname, (char_u *)argv[i + 1],
&res, NULL, 1, 0, FALSE) < 0)
# else
@@ -4125,7 +4124,7 @@ cmdsrv_main(
{
if (res != NULL && *res != NUL)
{
- /* Output error from remote */
+ // Output error from remote
mch_errmsg((char *)res);
VIM_CLEAR(res);
}
@@ -4135,7 +4134,7 @@ cmdsrv_main(
else if (STRICMP(argv[i], "--serverlist") == 0)
{
# ifdef MSWIN
- /* Win32 always works? */
+ // Win32 always works?
res = serverGetVimNames();
# else
if (xterm_dpy != NULL)
@@ -4146,7 +4145,7 @@ cmdsrv_main(
}
else if (STRICMP(argv[i], "--servername") == 0)
{
- /* Already processed. Take it out of the command line */
+ // Already processed. Take it out of the command line
i++;
continue;
}
@@ -4168,11 +4167,11 @@ cmdsrv_main(
if (didone)
{
- display_errors(); /* display any collected messages */
- exit(exiterr); /* Mission accomplished - get out */
+ display_errors(); // display any collected messages
+ exit(exiterr); // Mission accomplished - get out
}
- /* Return back into main() */
+ // Return back into main()
*argc = newArgC;
vim_free(sname);
}
@@ -4184,7 +4183,7 @@ cmdsrv_main(
build_drop_cmd(
int filec,
char **filev,
- int tabs, /* Use ":tab drop" instead of ":drop". */
+ int tabs, // Use ":tab drop" instead of ":drop".
int sendReply)
{
garray_T ga;
@@ -4200,11 +4199,11 @@ build_drop_cmd(
filev++;
filec--;
}
- /* Check if we have at least one argument. */
+ // Check if we have at least one argument.
if (filec <= 0)
mainerr_arg_missing((char_u *)filev[-1]);
- /* Temporarily cd to the current directory to handle relative file names. */
+ // Temporarily cd to the current directory to handle relative file names.
cwd = alloc(MAXPATHL);
if (cwd == NULL)
return NULL;
@@ -4215,11 +4214,11 @@ build_drop_cmd(
}
cdp = vim_strsave_escaped_ext(cwd,
#ifdef BACKSLASH_IN_FILENAME
- (char_u *)"", /* rem_backslash() will tell what chars to escape */
+ (char_u *)"", // rem_backslash() will tell what chars to escape
#else
- PATH_ESC_CHARS,
+ PATH_ESC_CHARS,
#endif
- '\\', TRUE);
+ '\\', TRUE);
vim_free(cwd);
if (cdp == NULL)
return NULL;
@@ -4227,16 +4226,16 @@ build_drop_cmd(
ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd ");
ga_concat(&ga, cdp);
- /* Call inputsave() so that a prompt for an encryption key works. */
+ // Call inputsave() so that a prompt for an encryption key works.
ga_concat(&ga, (char_u *)"<CR>:if exists('*inputsave')|call inputsave()|endif|");
if (tabs)
ga_concat(&ga, (char_u *)"tab ");
ga_concat(&ga, (char_u *)"drop");
for (i = 0; i < filec; i++)
{
- /* On Unix the shell has already expanded the wildcards, don't want to
- * do it again in the Vim server. On MS-Windows only escape
- * non-wildcard characters. */
+ // On Unix the shell has already expanded the wildcards, don't want to
+ // do it again in the Vim server. On MS-Windows only escape
+ // non-wildcard characters.
p = vim_strsave_escaped((char_u *)filev[i],
#ifdef UNIX
PATH_ESC_CHARS
@@ -4255,22 +4254,21 @@ build_drop_cmd(
}
ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif<CR>");
- /* The :drop commands goes to Insert mode when 'insertmode' is set, use
- * CTRL-\ CTRL-N again. */
+ // The :drop commands goes to Insert mode when 'insertmode' is set, use
+ // CTRL-\ CTRL-N again.
ga_concat(&ga, (char_u *)"<C-\\><C-N>");
- /* Switch back to the correct current directory (prior to temporary path
- * switch) unless 'autochdir' is set, in which case it will already be
- * correct after the :drop command. With line breaks and spaces:
- * if !exists('+acd') || !&acd
- * if haslocaldir()
- * cd -
- * lcd -
- * elseif getcwd() ==# 'current path'
- * cd -
- * endif
- * endif
- */
+ // Switch back to the correct current directory (prior to temporary path
+ // switch) unless 'autochdir' is set, in which case it will already be
+ // correct after the :drop command. With line breaks and spaces:
+ // if !exists('+acd') || !&acd
+ // if haslocaldir()
+ // cd -
+ // lcd -
+ // elseif getcwd() ==# 'current path'
+ // cd -
+ // endif
+ // endif
ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|if haslocaldir()|");
ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd() ==# '");
ga_concat(&ga, cdp);
@@ -4282,14 +4280,14 @@ build_drop_cmd(
ga_concat(&ga, (char_u *)":");
if (inicmd != NULL)
{
- /* Can't use <CR> after "inicmd", because an "startinsert" would cause
- * the following commands to be inserted as text. Use a "|",
- * hopefully "inicmd" does allow this... */
+ // Can't use <CR> after "inicmd", because an "startinsert" would cause
+ // the following commands to be inserted as text. Use a "|",
+ // hopefully "inicmd" does allow this...
ga_concat(&ga, inicmd);
ga_concat(&ga, (char_u *)"|");
}
- /* Bring the window to the foreground, goto Insert mode when 'im' set and
- * clear command line. */
+ // Bring the window to the foreground, goto Insert mode when 'im' set and
+ // clear command line.
ga_concat(&ga, (char_u *)"cal foreground()|if &im|star|en|redr|f<CR>");
ga_append(&ga, NUL);
return ga.ga_data;
@@ -4310,13 +4308,13 @@ serverMakeName(char_u *arg, char *cmd)
else
{
p = vim_strsave_up(gettail((char_u *)cmd));
- /* Remove .exe or .bat from the name. */
+ // Remove .exe or .bat from the name.
if (p != NULL && vim_strchr(p, '.') != NULL)
*vim_strchr(p, '.') = NUL;
}
return p;
}
-#endif /* FEAT_CLIENTSERVER */
+#endif // FEAT_CLIENTSERVER
#if defined(FEAT_CLIENTSERVER) || defined(PROTO)
/*
@@ -4328,18 +4326,17 @@ server_to_input_buf(char_u *str)
char_u *ptr = NULL;
char_u *cpo_save = p_cpo;
- /* Set 'cpoptions' the way we want it.
- * B set - backslashes are *not* treated specially
- * k set - keycodes are *not* reverse-engineered
- * < unset - <Key> sequences *are* interpreted
- * The last but one parameter of replace_termcodes() is TRUE so that the
- * <lt> sequence is recognised - needed for a real backslash.
- */
+ // Set 'cpoptions' the way we want it.
+ // B set - backslashes are *not* treated specially
+ // k set - keycodes are *not* reverse-engineered
+ // < unset - <Key> sequences *are* interpreted
+ // The last but one parameter of replace_termcodes() is TRUE so that the
+ // <lt> sequence is recognised - needed for a real backslash.
p_cpo = (char_u *)"Bk";
str = replace_termcodes((char_u *)str, &ptr, REPTERM_DO_LT, NULL);
p_cpo = cpo_save;
- if (*ptr != NUL) /* trailing CTRL-V results in nothing */
+ if (*ptr != NUL) // trailing CTRL-V results in nothing
{
/*
* Add the string to the input stream.
@@ -4353,8 +4350,8 @@ server_to_input_buf(char_u *str)
del_typebuf(typebuf.tb_len - typebuf.tb_maplen, typebuf.tb_maplen);
(void)ins_typebuf(str, REMAP_NONE, typebuf.tb_len, TRUE, FALSE);
- /* Let input_available() know we inserted text in the typeahead
- * buffer. */
+ // Let input_available() know we inserted text in the typeahead
+ // buffer.
typebuf_was_filled = TRUE;
}
vim_free((char_u *)ptr);
@@ -4372,20 +4369,20 @@ eval_client_expr_to_string(char_u *expr)
funccal_entry_T funccal_entry;
int did_save_funccal = FALSE;
- /* Evaluate the expression at the toplevel, don't use variables local to
- * the calling function. Except when in debug mode. */
+ // Evaluate the expression at the toplevel, don't use variables local to
+ // the calling function. Except when in debug mode.
if (!debug_mode)
{
save_funccal(&funccal_entry);
did_save_funccal = TRUE;
}
- /* Disable debugging, otherwise Vim hangs, waiting for "cont" to be
- * typed. */
+ // Disable debugging, otherwise Vim hangs, waiting for "cont" to be
+ // typed.
debug_break_level = -1;
redir_off = 0;
- /* Do not display error message, otherwise Vim hangs, waiting for "cont"
- * to be typed. Do generate errors so that try/catch works. */
+ // Do not display error message, otherwise Vim hangs, waiting for "cont"
+ // to be typed. Do generate errors so that try/catch works.
++emsg_silent;
res = eval_to_string(expr, NULL, TRUE);
@@ -4398,8 +4395,8 @@ eval_client_expr_to_string(char_u *expr)
if (did_save_funccal)
restore_funccal();
- /* A client can tell us to redraw, but not to display the cursor, so do
- * that here. */
+ // A client can tell us to redraw, but not to display the cursor, so do
+ // that here.
setcursor();
out_flush_cursor(FALSE, FALSE);
diff --git a/src/mark.c b/src/mark.c
index a77e7b9dd..ba24220ac 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -24,7 +24,7 @@
* There are marks 'A - 'Z (set by user) and '0 to '9 (set when writing
* viminfo).
*/
-static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; /* marks with file nr */
+static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; // marks with file nr
static void fname2fnum(xfmark_T *fm);
static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf);
@@ -54,7 +54,7 @@ setmark_pos(int c, pos_T *pos, int fnum)
int i;
buf_T *buf;
- /* Check for a special key (may cause islower() to crash). */
+ // Check for a special key (may cause islower() to crash).
if (c < 0)
return FAIL;
@@ -63,7 +63,7 @@ setmark_pos(int c, pos_T *pos, int fnum)
if (pos == &curwin->w_cursor)
{
setpcmark();
- /* keep it even when the cursor doesn't move */
+ // keep it even when the cursor doesn't move
curwin->w_prev_pcmark = curwin->w_pcmark;
}
else
@@ -81,8 +81,8 @@ setmark_pos(int c, pos_T *pos, int fnum)
return OK;
}
- /* Allow setting '[ and '] for an autocommand that simulates reading a
- * file. */
+ // Allow setting '[ and '] for an autocommand that simulates reading a
+ // file.
if (c == '[')
{
buf->b_op_start = *pos;
@@ -101,7 +101,7 @@ setmark_pos(int c, pos_T *pos, int fnum)
else
buf->b_visual.vi_end = *pos;
if (buf->b_visual.vi_mode == NUL)
- /* Visual_mode has not yet been set, use a sane default. */
+ // Visual_mode has not yet been set, use a sane default.
buf->b_visual.vi_mode = 'v';
return OK;
}
@@ -144,7 +144,7 @@ setpcmark(void)
xfmark_T tempmark;
#endif
- /* for :global the mark is set only once */
+ // for :global the mark is set only once
if (global_busy || listcmd_busy || cmdmod.keepjumps)
return;
@@ -170,7 +170,7 @@ setpcmark(void)
}
# endif
- /* If jumplist is full: remove oldest entry */
+ // If jumplist is full: remove oldest entry
if (++curwin->w_jumplistlen > JUMPLISTSIZE)
{
curwin->w_jumplistlen = JUMPLISTSIZE;
@@ -204,7 +204,7 @@ checkpcmark(void)
|| curwin->w_pcmark.lnum == 0))
{
curwin->w_pcmark = curwin->w_prev_pcmark;
- curwin->w_prev_pcmark.lnum = 0; /* Show it has been checked */
+ curwin->w_prev_pcmark.lnum = 0; // Show it has been checked
}
}
@@ -220,7 +220,7 @@ movemark(int count)
cleanup_jumplist(curwin, TRUE);
- if (curwin->w_jumplistlen == 0) /* nothing to jump to */
+ if (curwin->w_jumplistlen == 0) // nothing to jump to
return (pos_T *)NULL;
for (;;)
@@ -237,7 +237,7 @@ movemark(int count)
if (curwin->w_jumplistidx == curwin->w_jumplistlen)
{
setpcmark();
- --curwin->w_jumplistidx; /* skip the new entry */
+ --curwin->w_jumplistidx; // skip the new entry
if (curwin->w_jumplistidx + count < 0)
return (pos_T *)NULL;
}
@@ -249,16 +249,16 @@ movemark(int count)
fname2fnum(jmp);
if (jmp->fmark.fnum != curbuf->b_fnum)
{
- /* jump to other file */
+ // jump to other file
if (buflist_findnr(jmp->fmark.fnum) == NULL)
- { /* Skip this one .. */
+ { // Skip this one ..
count += count < 0 ? -1 : 1;
continue;
}
if (buflist_getfile(jmp->fmark.fnum, jmp->fmark.mark.lnum,
0, FALSE) == FAIL)
return (pos_T *)NULL;
- /* Set lnum again, autocommands my have changed it */
+ // Set lnum again, autocommands my have changed it
curwin->w_cursor = jmp->fmark.mark;
pos = (pos_T *)-1;
}
@@ -276,7 +276,7 @@ movechangelist(int count)
{
int n;
- if (curbuf->b_changelistlen == 0) /* nothing to jump to */
+ if (curbuf->b_changelistlen == 0) // nothing to jump to
return (pos_T *)NULL;
n = curwin->w_changelistidx;
@@ -335,38 +335,38 @@ getmark_buf_fnum(
posp = NULL;
- /* Check for special key, can't be a mark name and might cause islower()
- * to crash. */
+ // Check for special key, can't be a mark name and might cause islower()
+ // to crash.
if (c < 0)
return posp;
#ifndef EBCDIC
- if (c > '~') /* check for islower()/isupper() */
+ if (c > '~') // check for islower()/isupper()
;
else
#endif
- if (c == '\'' || c == '`') /* previous context mark */
+ if (c == '\'' || c == '`') // previous context mark
{
- pos_copy = curwin->w_pcmark; /* need to make a copy because */
- posp = &pos_copy; /* w_pcmark may be changed soon */
+ pos_copy = curwin->w_pcmark; // need to make a copy because
+ posp = &pos_copy; // w_pcmark may be changed soon
}
- else if (c == '"') /* to pos when leaving buffer */
+ else if (c == '"') // to pos when leaving buffer
posp = &(buf->b_last_cursor);
- else if (c == '^') /* to where Insert mode stopped */
+ else if (c == '^') // to where Insert mode stopped
posp = &(buf->b_last_insert);
- else if (c == '.') /* to where last change was made */
+ else if (c == '.') // to where last change was made
posp = &(buf->b_last_change);
- else if (c == '[') /* to start of previous operator */
+ else if (c == '[') // to start of previous operator
posp = &(buf->b_op_start);
- else if (c == ']') /* to end of previous operator */
+ else if (c == ']') // to end of previous operator
posp = &(buf->b_op_end);
- else if (c == '{' || c == '}') /* to previous/next paragraph */
+ else if (c == '{' || c == '}') // to previous/next paragraph
{
pos_T pos;
oparg_T oa;
int slcb = listcmd_busy;
pos = curwin->w_cursor;
- listcmd_busy = TRUE; /* avoid that '' is changed */
+ listcmd_busy = TRUE; // avoid that '' is changed
if (findpar(&oa.inclusive,
c == '}' ? FORWARD : BACKWARD, 1L, NUL, FALSE))
{
@@ -376,13 +376,13 @@ getmark_buf_fnum(
curwin->w_cursor = pos;
listcmd_busy = slcb;
}
- else if (c == '(' || c == ')') /* to previous/next sentence */
+ else if (c == '(' || c == ')') // to previous/next sentence
{
pos_T pos;
int slcb = listcmd_busy;
pos = curwin->w_cursor;
- listcmd_busy = TRUE; /* avoid that '' is changed */
+ listcmd_busy = TRUE; // avoid that '' is changed
if (findsent(c == ')' ? FORWARD : BACKWARD, 1L))
{
pos_copy = curwin->w_cursor;
@@ -391,7 +391,7 @@ getmark_buf_fnum(
curwin->w_cursor = pos;
listcmd_busy = slcb;
}
- else if (c == '<' || c == '>') /* start/end of visual area */
+ else if (c == '<' || c == '>') // start/end of visual area
{
startp = &buf->b_visual.vi_start;
endp = &buf->b_visual.vi_end;
@@ -414,11 +414,11 @@ getmark_buf_fnum(
pos_copy.coladd = 0;
}
}
- else if (ASCII_ISLOWER(c)) /* normal named mark */
+ else if (ASCII_ISLOWER(c)) // normal named mark
{
posp = &(buf->b_namedm[c - 'a']);
}
- else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) /* named file mark */
+ else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) // named file mark
{
if (VIM_ISDIGIT(c))
c = c - '0' + NMARKS;
@@ -433,7 +433,7 @@ getmark_buf_fnum(
*fnum = namedfm[c].fmark.fnum;
else if (namedfm[c].fmark.fnum != buf->b_fnum)
{
- /* mark is in another file */
+ // mark is in another file
posp = &pos_copy;
if (namedfm[c].fmark.mark.lnum != 0
@@ -442,15 +442,15 @@ getmark_buf_fnum(
if (buflist_getfile(namedfm[c].fmark.fnum,
(linenr_T)1, GETF_SETMARK, FALSE) == OK)
{
- /* Set the lnum now, autocommands could have changed it */
+ // Set the lnum now, autocommands could have changed it
curwin->w_cursor = namedfm[c].fmark.mark;
return (pos_T *)-1;
}
- pos_copy.lnum = -1; /* can't get file */
+ pos_copy.lnum = -1; // can't get file
}
else
- pos_copy.lnum = 0; /* mark exists, but is not valid in
- current buffer */
+ pos_copy.lnum = 0; // mark exists, but is not valid in
+ // current buffer
}
}
@@ -464,8 +464,8 @@ getmark_buf_fnum(
*/
pos_T *
getnextmark(
- pos_T *startpos, /* where to start */
- int dir, /* direction for search */
+ pos_T *startpos, // where to start
+ int dir, // direction for search
int begin_line)
{
int i;
@@ -474,10 +474,10 @@ getnextmark(
pos = *startpos;
- /* When searching backward and leaving the cursor on the first non-blank,
- * position must be in a previous line.
- * When searching forward and leaving the cursor on the first non-blank,
- * position must be in a next line. */
+ // When searching backward and leaving the cursor on the first non-blank,
+ // position must be in a previous line.
+ // When searching forward and leaving the cursor on the first non-blank,
+ // position must be in a next line.
if (dir == BACKWARD && begin_line)
pos.col = 0;
else if (dir == FORWARD && begin_line)
@@ -536,11 +536,11 @@ fname2fnum(xfmark_T *fm)
else
vim_strncpy(NameBuff, fm->fname, MAXPATHL - 1);
- /* Try to shorten the file name. */
+ // Try to shorten the file name.
mch_dirname(IObuff, IOSIZE);
p = shorten_fname(NameBuff, IObuff);
- /* buflist_new() will call fmarks_check_names() */
+ // buflist_new() will call fmarks_check_names()
(void)buflist_new(NameBuff, p, (linenr_T)1, 0);
}
}
@@ -606,8 +606,8 @@ check_mark(pos_T *pos)
}
if (pos->lnum <= 0)
{
- /* lnum is negative if mark is in another file can can't get that
- * file, error message already give then. */
+ // lnum is negative if mark is in another file can can't get that
+ // file, error message already give then.
if (pos->lnum == 0)
emsg(_(e_marknotset));
return FAIL;
@@ -630,7 +630,7 @@ clrallmarks(buf_T *buf)
{
static int i = -1;
- if (i == -1) /* first call ever: initialize */
+ if (i == -1) // first call ever: initialize
for (i = 0; i < NMARKS + 1; i++)
{
namedfm[i].fmark.mark.lnum = 0;
@@ -642,13 +642,13 @@ clrallmarks(buf_T *buf)
for (i = 0; i < NMARKS; i++)
buf->b_namedm[i].lnum = 0;
- buf->b_op_start.lnum = 0; /* start/end op mark cleared */
+ buf->b_op_start.lnum = 0; // start/end op mark cleared
buf->b_op_end.lnum = 0;
- buf->b_last_cursor.lnum = 1; /* '" mark cleared */
+ buf->b_last_cursor.lnum = 1; // '" mark cleared
buf->b_last_cursor.col = 0;
buf->b_last_cursor.coladd = 0;
- buf->b_last_insert.lnum = 0; /* '^ mark cleared */
- buf->b_last_change.lnum = 0; /* '. mark cleared */
+ buf->b_last_insert.lnum = 0; // '^ mark cleared
+ buf->b_last_change.lnum = 0; // '. mark cleared
#ifdef FEAT_JUMPLIST
buf->b_changelistlen = 0;
#endif
@@ -662,7 +662,7 @@ clrallmarks(buf_T *buf)
char_u *
fm_getname(fmark_T *fmark, int lead_len)
{
- if (fmark->fnum == curbuf->b_fnum) /* current buffer */
+ if (fmark->fnum == curbuf->b_fnum) // current buffer
return mark_line(&(fmark->mark), lead_len);
return buflist_nr2name(fmark->fnum, FALSE, TRUE);
}
@@ -742,13 +742,13 @@ show_one_mark(
char_u *arg,
pos_T *p,
char_u *name_arg,
- int current) /* in current file */
+ int current) // in current file
{
static int did_title = FALSE;
int mustfree = FALSE;
char_u *name = name_arg;
- if (c == -1) /* finish up */
+ if (c == -1) // finish up
{
if (did_title)
did_title = FALSE;
@@ -809,7 +809,7 @@ ex_delmarks(exarg_T *eap)
int n;
if (*eap->arg == NUL && eap->forceit)
- /* clear all marks */
+ // clear all marks
clrallmarks(curbuf);
else if (eap->forceit)
emsg(_(e_invarg));
@@ -817,7 +817,7 @@ ex_delmarks(exarg_T *eap)
emsg(_(e_argreq));
else
{
- /* clear specified marks only */
+ // clear specified marks only
for (p = eap->arg; *p != NUL; ++p)
{
lower = ASCII_ISLOWER(*p);
@@ -826,7 +826,7 @@ ex_delmarks(exarg_T *eap)
{
if (p[1] == '-')
{
- /* clear range of marks */
+ // clear range of marks
from = *p;
to = p[2];
if (!(lower ? ASCII_ISLOWER(p[2])
@@ -840,7 +840,7 @@ ex_delmarks(exarg_T *eap)
p += 2;
}
else
- /* clear one lower case mark */
+ // clear one lower case mark
from = to = *p;
for (i = from; i <= to; ++i)
@@ -891,7 +891,7 @@ ex_jumps(exarg_T *eap UNUSED)
cleanup_jumplist(curwin, TRUE);
- /* Highlight title */
+ // Highlight title
msg_puts_title(_("\n jump line col file/text"));
for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i)
{
@@ -948,7 +948,7 @@ ex_changes(exarg_T *eap UNUSED)
int i;
char_u *name;
- /* Highlight title */
+ // Highlight title
msg_puts_title(_("\nchange line col text"));
for (i = 0; i < curbuf->b_changelistlen && !got_int; ++i)
@@ -993,7 +993,7 @@ ex_changes(exarg_T *eap UNUSED)
*lp += amount_after; \
}
-/* don't delete the line, just put at first deleted line */
+// don't delete the line, just put at first deleted line
#define one_adjust_nodel(add) \
{ \
lp = add; \
@@ -1054,12 +1054,12 @@ mark_adjust_internal(
tabpage_T *tab;
static pos_T initpos = {1, 0, 0};
- if (line2 < line1 && amount_after == 0L) /* nothing to do */
+ if (line2 < line1 && amount_after == 0L) // nothing to do
return;
if (!cmdmod.lockmarks)
{
- /* named marks, lower case and upper case */
+ // named marks, lower case and upper case
for (i = 0; i < NMARKS; i++)
{
one_adjust(&(curbuf->b_namedm[i].lnum));
@@ -1072,31 +1072,31 @@ mark_adjust_internal(
one_adjust_nodel(&(namedfm[i].fmark.mark.lnum));
}
- /* last Insert position */
+ // last Insert position
one_adjust(&(curbuf->b_last_insert.lnum));
- /* last change position */
+ // last change position
one_adjust(&(curbuf->b_last_change.lnum));
- /* last cursor position, if it was set */
+ // last cursor position, if it was set
if (!EQUAL_POS(curbuf->b_last_cursor, initpos))
one_adjust(&(curbuf->b_last_cursor.lnum));
#ifdef FEAT_JUMPLIST
- /* list of change positions */
+ // list of change positions
for (i = 0; i < curbuf->b_changelistlen; ++i)
one_adjust_nodel(&(curbuf->b_changelist[i].lnum));
#endif
- /* Visual area */
+ // Visual area
one_adjust_nodel(&(curbuf->b_visual.vi_start.lnum));
one_adjust_nodel(&(curbuf->b_visual.vi_end.lnum));
#ifdef FEAT_QUICKFIX
- /* quickfix marks */
+ // quickfix marks
qf_mark_adjust(NULL, line1, line2, amount, amount_after);
- /* location lists */
+ // location lists
FOR_ALL_TAB_WINDOWS(tab, win)
qf_mark_adjust(win, line1, line2, amount, amount_after);
#endif
@@ -1106,13 +1106,13 @@ mark_adjust_internal(
#endif
}
- /* previous context mark */
+ // previous context mark
one_adjust(&(curwin->w_pcmark.lnum));
- /* previous pcmark */
+ // previous pcmark
one_adjust(&(curwin->w_prev_pcmark.lnum));
- /* saved cursor for formatting */
+ // saved cursor for formatting
if (saved_cursor.lnum != 0)
one_adjust_nodel(&(saved_cursor.lnum));
@@ -1123,8 +1123,8 @@ mark_adjust_internal(
{
#ifdef FEAT_JUMPLIST
if (!cmdmod.lockmarks)
- /* Marks in the jumplist. When deleting lines, this may create
- * duplicate marks in the jumplist, they will be removed later. */
+ // Marks in the jumplist. When deleting lines, this may create
+ // duplicate marks in the jumplist, they will be removed later.
for (i = 0; i < win->w_jumplistlen; ++i)
if (win->w_jumplist[i].fmark.fnum == fnum)
one_adjust_nodel(&(win->w_jumplist[i].fmark.mark.lnum));
@@ -1133,32 +1133,32 @@ mark_adjust_internal(
if (win->w_buffer == curbuf)
{
if (!cmdmod.lockmarks)
- /* marks in the tag stack */
+ // marks in the tag stack
for (i = 0; i < win->w_tagstacklen; i++)
if (win->w_tagstack[i].fmark.fnum == fnum)
one_adjust_nodel(&(win->w_tagstack[i].fmark.mark.lnum));
- /* the displayed Visual area */
+ // the displayed Visual area
if (win->w_old_cursor_lnum != 0)
{
one_adjust_nodel(&(win->w_old_cursor_lnum));
one_adjust_nodel(&(win->w_old_visual_lnum));
}
- /* topline and cursor position for windows with the same buffer
- * other than the current window */
+ // topline and cursor position for windows with the same buffer
+ // other than the current window
if (win != curwin)
{
if (win->w_topline >= line1 && win->w_topline <= line2)
{
- if (amount == MAXLNUM) /* topline is deleted */
+ if (amount == MAXLNUM) // topline is deleted
{
if (line1 <= 1)
win->w_topline = 1;
else
win->w_topline = line1 - 1;
}
- else /* keep topline on the same line */
+ else // keep topline on the same line
win->w_topline += amount;
#ifdef FEAT_DIFF
win->w_topfill = 0;
@@ -1173,7 +1173,7 @@ mark_adjust_internal(
}
if (win->w_cursor.lnum >= line1 && win->w_cursor.lnum <= line2)
{
- if (amount == MAXLNUM) /* line with cursor is deleted */
+ if (amount == MAXLNUM) // line with cursor is deleted
{
if (line1 <= 1)
win->w_cursor.lnum = 1;
@@ -1181,7 +1181,7 @@ mark_adjust_internal(
win->w_cursor.lnum = line1 - 1;
win->w_cursor.col = 0;
}
- else /* keep cursor on the same line */
+ else // keep cursor on the same line
win->w_cursor.lnum += amount;
}
else if (amount_after && win->w_cursor.lnum > line2)
@@ -1189,7 +1189,7 @@ mark_adjust_internal(
}
#ifdef FEAT_FOLDING
- /* adjust folds */
+ // adjust folds
if (adjust_folds)
foldMarkAdjust(win, line1, line2, amount, amount_after);
#endif
@@ -1197,12 +1197,12 @@ mark_adjust_internal(
}
#ifdef FEAT_DIFF
- /* adjust diffs */
+ // adjust diffs
diff_mark_adjust(line1, line2, amount, amount_after);
#endif
}
-/* This code is used often, needs to be fast. */
+// This code is used often, needs to be fast.
#define col_adjust(pp) \
{ \
posp = pp; \
@@ -1239,9 +1239,9 @@ mark_col_adjust(
pos_T *posp;
if ((col_amount == 0L && lnum_amount == 0L) || cmdmod.lockmarks)
- return; /* nothing to do */
+ return; // nothing to do
- /* named marks, lower case and upper case */
+ // named marks, lower case and upper case
for (i = 0; i < NMARKS; i++)
{
col_adjust(&(curbuf->b_namedm[i]));
@@ -1254,29 +1254,29 @@ mark_col_adjust(
col_adjust(&(namedfm[i].fmark.mark));
}
- /* last Insert position */
+ // last Insert position
col_adjust(&(curbuf->b_last_insert));
- /* last change position */
+ // last change position
col_adjust(&(curbuf->b_last_change));
#ifdef FEAT_JUMPLIST
- /* list of change positions */
+ // list of change positions
for (i = 0; i < curbuf->b_changelistlen; ++i)
col_adjust(&(curbuf->b_changelist[i]));
#endif
- /* Visual area */
+ // Visual area
col_adjust(&(curbuf->b_visual.vi_start));
col_adjust(&(curbuf->b_visual.vi_end));
- /* previous context mark */
+ // previous context mark
col_adjust(&(curwin->w_pcmark));
- /* previous pcmark */
+ // previous pcmark
col_adjust(&(curwin->w_prev_pcmark));
- /* saved cursor for formatting */
+ // saved cursor for formatting
col_adjust(&saved_cursor);
/*
@@ -1285,7 +1285,7 @@ mark_col_adjust(
FOR_ALL_WINDOWS(win)
{
#ifdef FEAT_JUMPLIST
- /* marks in the jumplist */
+ // marks in the jumplist
for (i = 0; i < win->w_jumplistlen; ++i)
if (win->w_jumplist[i].fmark.fnum == fnum)
col_adjust(&(win->w_jumplist[i].fmark.mark));
@@ -1293,12 +1293,12 @@ mark_col_adjust(
if (win->w_buffer == curbuf)
{
- /* marks in the tag stack */
+ // marks in the tag stack
for (i = 0; i < win->w_tagstacklen; i++)
if (win->w_tagstack[i].fmark.fnum == fnum)
col_adjust(&(win->w_tagstack[i].fmark.mark));
- /* cursor position for other windows with the same buffer */
+ // cursor position for other windows with the same buffer
if (win != curwin)
col_adjust(&win->w_cursor);
}
@@ -1320,9 +1320,9 @@ cleanup_jumplist(win_T *wp, int loadfiles)
if (loadfiles)
{
- /* If specified, load all the files from the jump list. This is
- * needed to properly clean up duplicate entries, but will take some
- * time. */
+ // If specified, load all the files from the jump list. This is
+ // needed to properly clean up duplicate entries, but will take some
+ // time.
for (i = 0; i < wp->w_jumplistlen; ++i)
{
if ((wp->w_jumplist[i].fmark.fnum == 0) &&
@@ -1343,7 +1343,7 @@ cleanup_jumplist(win_T *wp, int loadfiles)
&& wp->w_jumplist[i].fmark.mark.lnum
== wp->w_jumplist[from].fmark.mark.lnum)
break;
- if (i >= wp->w_jumplistlen) /* no duplicate */
+ if (i >= wp->w_jumplistlen) // no duplicate
wp->w_jumplist[to++] = wp->w_jumplist[from];
else
vim_free(wp->w_jumplist[from].fname);
@@ -1382,7 +1382,7 @@ free_jumplist(win_T *wp)
for (i = 0; i < wp->w_jumplistlen; ++i)
vim_free(wp->w_jumplist[i].fname);
}
-#endif /* FEAT_JUMPLIST */
+#endif // FEAT_JUMPLIST
void
set_last_cursor(win_T *win)
diff --git a/src/mbyte.c b/src/mbyte.c
index 4dfcfc952..5dd256268 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -91,7 +91,7 @@
# define WINBYTE BYTE
# endif
# ifdef WIN32
-# undef WIN32 /* Some windows.h define WIN32, we don't want that here. */
+# undef WIN32 // Some windows.h define WIN32, we don't want that here.
# endif
#else
# define WINBYTE BYTE
@@ -129,8 +129,8 @@
#endif
#if 0
-/* This has been disabled, because several people reported problems with the
- * wcwidth() and iswprint() library functions, esp. for Hebrew. */
+// This has been disabled, because several people reported problems with the
+// wcwidth() and iswprint() library functions, esp. for Hebrew.
# ifdef __STDC_ISO_10646__
# define USE_WCHAR_FUNCTIONS
# endif
@@ -183,7 +183,7 @@ static char utf8len_tab_zero[256] =
* XIM often causes trouble. Define XIM_DEBUG to get a log of XIM callbacks
* in the "xim.log" file.
*/
-/* #define XIM_DEBUG */
+// #define XIM_DEBUG
#ifdef XIM_DEBUG
static void
xim_log(char *s, ...)
@@ -266,7 +266,7 @@ enc_canon_table[] =
#define IDX_UCS4LE 22
{"ucs-4le", ENC_UNICODE + ENC_ENDIAN_L + ENC_4BYTE, 0},
- /* For debugging DBCS encoding on Unix. */
+ // For debugging DBCS encoding on Unix.
#define IDX_DEBUG 23
{"debug", ENC_DBCS, DBCS_DEBUG},
#define IDX_EUC_JP 24
@@ -282,39 +282,39 @@ enc_canon_table[] =
#define IDX_BIG5 29
{"big5", ENC_DBCS, DBCS_CHT},
- /* MS-DOS and MS-Windows codepages are included here, so that they can be
- * used on Unix too. Most of them are similar to ISO-8859 encodings, but
- * not exactly the same. */
+ // MS-DOS and MS-Windows codepages are included here, so that they can be
+ // used on Unix too. Most of them are similar to ISO-8859 encodings, but
+ // not exactly the same.
#define IDX_CP437 30
- {"cp437", ENC_8BIT, 437}, /* like iso-8859-1 */
+ {"cp437", ENC_8BIT, 437}, // like iso-8859-1
#define IDX_CP737 31
- {"cp737", ENC_8BIT, 737}, /* like iso-8859-7 */
+ {"cp737", ENC_8BIT, 737}, // like iso-8859-7
#define IDX_CP775 32
- {"cp775", ENC_8BIT, 775}, /* Baltic */
+ {"cp775", ENC_8BIT, 775}, // Baltic
#define IDX_CP850 33
- {"cp850", ENC_8BIT, 850}, /* like iso-8859-4 */
+ {"cp850", ENC_8BIT, 850}, // like iso-8859-4
#define IDX_CP852 34
- {"cp852", ENC_8BIT, 852}, /* like iso-8859-1 */
+ {"cp852", ENC_8BIT, 852}, // like iso-8859-1
#define IDX_CP855 35
- {"cp855", ENC_8BIT, 855}, /* like iso-8859-2 */
+ {"cp855", ENC_8BIT, 855}, // like iso-8859-2
#define IDX_CP857 36
- {"cp857", ENC_8BIT, 857}, /* like iso-8859-5 */
+ {"cp857", ENC_8BIT, 857}, // like iso-8859-5
#define IDX_CP860 37
- {"cp860", ENC_8BIT, 860}, /* like iso-8859-9 */
+ {"cp860", ENC_8BIT, 860}, // like iso-8859-9
#define IDX_CP861 38
- {"cp861", ENC_8BIT, 861}, /* like iso-8859-1 */
+ {"cp861", ENC_8BIT, 861}, // like iso-8859-1
#define IDX_CP862 39
- {"cp862", ENC_8BIT, 862}, /* like iso-8859-1 */
+ {"cp862", ENC_8BIT, 862}, // like iso-8859-1
#define IDX_CP863 40
- {"cp863", ENC_8BIT, 863}, /* like iso-8859-8 */
+ {"cp863", ENC_8BIT, 863}, // like iso-8859-8
#define IDX_CP865 41
- {"cp865", ENC_8BIT, 865}, /* like iso-8859-1 */
+ {"cp865", ENC_8BIT, 865}, // like iso-8859-1
#define IDX_CP866 42
- {"cp866", ENC_8BIT, 866}, /* like iso-8859-5 */
+ {"cp866", ENC_8BIT, 866}, // like iso-8859-5
#define IDX_CP869 43
- {"cp869", ENC_8BIT, 869}, /* like iso-8859-7 */
+ {"cp869", ENC_8BIT, 869}, // like iso-8859-7
#define IDX_CP874 44
- {"cp874", ENC_8BIT, 874}, /* Thai */
+ {"cp874", ENC_8BIT, 874}, // Thai
#define IDX_CP932 45
{"cp932", ENC_DBCS, DBCS_JPN},
#define IDX_CP936 46
@@ -324,29 +324,29 @@ enc_canon_table[] =
#define IDX_CP950 48
{"cp950", ENC_DBCS, DBCS_CHT},
#define IDX_CP1250 49
- {"cp1250", ENC_8BIT, 1250}, /* Czech, Polish, etc. */
+ {"cp1250", ENC_8BIT, 1250}, // Czech, Polish, etc.
#define IDX_CP1251 50
- {"cp1251", ENC_8BIT, 1251}, /* Cyrillic */
- /* cp1252 is considered to be equal to latin1 */
+ {"cp1251", ENC_8BIT, 1251}, // Cyrillic
+ // cp1252 is considered to be equal to latin1
#define IDX_CP1253 51
- {"cp1253", ENC_8BIT, 1253}, /* Greek */
+ {"cp1253", ENC_8BIT, 1253}, // Greek
#define IDX_CP1254 52
- {"cp1254", ENC_8BIT, 1254}, /* Turkish */
+ {"cp1254", ENC_8BIT, 1254}, // Turkish
#define IDX_CP1255 53
- {"cp1255", ENC_8BIT, 1255}, /* Hebrew */
+ {"cp1255", ENC_8BIT, 1255}, // Hebrew
#define IDX_CP1256 54
- {"cp1256", ENC_8BIT, 1256}, /* Arabic */
+ {"cp1256", ENC_8BIT, 1256}, // Arabic
#define IDX_CP1257 55
- {"cp1257", ENC_8BIT, 1257}, /* Baltic */
+ {"cp1257", ENC_8BIT, 1257}, // Baltic
#define IDX_CP1258 56
- {"cp1258", ENC_8BIT, 1258}, /* Vietnamese */
+ {"cp1258", ENC_8BIT, 1258}, // Vietnamese
#define IDX_MACROMAN 57
- {"macroman", ENC_8BIT + ENC_MACROMAN, 0}, /* Mac OS */
+ {"macroman", ENC_8BIT + ENC_MACROMAN, 0}, // Mac OS
#define IDX_DECMCS 58
- {"dec-mcs", ENC_8BIT, 0}, /* DEC MCS */
+ {"dec-mcs", ENC_8BIT, 0}, // DEC MCS
#define IDX_HPROMAN8 59
- {"hp-roman8", ENC_8BIT, 0}, /* HP Roman8 */
+ {"hp-roman8", ENC_8BIT, 0}, // HP Roman8
#define IDX_COUNT 60
};
@@ -371,10 +371,10 @@ enc_alias_table[] =
{"hebrew", IDX_ISO_8},
#endif
{"latin5", IDX_ISO_9},
- {"turkish", IDX_ISO_9}, /* ? */
+ {"turkish", IDX_ISO_9}, // ?
{"latin6", IDX_ISO_10},
- {"nordic", IDX_ISO_10}, /* ? */
- {"thai", IDX_ISO_11}, /* ? */
+ {"nordic", IDX_ISO_10}, // ?
+ {"thai", IDX_ISO_11}, // ?
{"latin7", IDX_ISO_13},
{"latin8", IDX_ISO_14},
{"latin9", IDX_ISO_15},
@@ -407,9 +407,9 @@ enc_alias_table[] =
{"unix-jis", IDX_EUC_JP},
{"ujis", IDX_EUC_JP},
{"shift-jis", IDX_SJIS},
- {"pck", IDX_SJIS}, /* Sun: PCK */
+ {"pck", IDX_SJIS}, // Sun: PCK
{"euckr", IDX_EUC_KR},
- {"5601", IDX_EUC_KR}, /* Sun: KS C 5601 */
+ {"5601", IDX_EUC_KR}, // Sun: KS C 5601
{"euccn", IDX_EUC_CN},
{"gb2312", IDX_EUC_CN},
{"euctw", IDX_EUC_TW},
@@ -435,7 +435,7 @@ enc_alias_table[] =
};
#ifndef CP_UTF8
-# define CP_UTF8 65001 /* magic number from winnls.h */
+# define CP_UTF8 65001 // magic number from winnls.h
#endif
/*
@@ -471,14 +471,14 @@ enc_canon_props(char_u *name)
{
CPINFO cpinfo;
- /* Get info on this codepage to find out what it is. */
+ // Get info on this codepage to find out what it is.
if (GetCPInfo(atoi((char *)name + 2), &cpinfo) != 0)
{
- if (cpinfo.MaxCharSize == 1) /* some single-byte encoding */
+ if (cpinfo.MaxCharSize == 1) // some single-byte encoding
return ENC_8BIT;
if (cpinfo.MaxCharSize == 2
&& (cpinfo.LeadByte[0] != 0 || cpinfo.LeadByte[1] != 0))
- /* must be a DBCS encoding */
+ // must be a DBCS encoding
return ENC_DBCS;
}
return 0;
@@ -519,7 +519,7 @@ mb_init(void)
if (p_enc == NULL)
{
- /* Just starting up: set the whole table to one's. */
+ // Just starting up: set the whole table to one's.
for (i = 0; i < 256; ++i)
mb_bytelen_tab[i] = 1;
input_conv.vc_type = CONV_NONE;
@@ -533,19 +533,19 @@ mb_init(void)
{
CPINFO cpinfo;
- /* Get info on this codepage to find out what it is. */
+ // Get info on this codepage to find out what it is.
if (GetCPInfo(atoi((char *)p_enc + 2), &cpinfo) != 0)
{
if (cpinfo.MaxCharSize == 1)
{
- /* some single-byte encoding */
+ // some single-byte encoding
enc_unicode = 0;
enc_utf8 = FALSE;
}
else if (cpinfo.MaxCharSize == 2
&& (cpinfo.LeadByte[0] != 0 || cpinfo.LeadByte[1] != 0))
{
- /* must be a DBCS encoding, check below */
+ // must be a DBCS encoding, check below
enc_dbcs_new = atoi((char *)p_enc + 2);
}
else
@@ -561,19 +561,19 @@ codepage_invalid:
else if (STRNCMP(p_enc, "8bit-", 5) == 0
|| STRNCMP(p_enc, "iso-8859-", 9) == 0)
{
- /* Accept any "8bit-" or "iso-8859-" name. */
+ // Accept any "8bit-" or "iso-8859-" name.
enc_unicode = 0;
enc_utf8 = FALSE;
}
else if (STRNCMP(p_enc, "2byte-", 6) == 0)
{
#ifdef MSWIN
- /* Windows: accept only valid codepage numbers, check below. */
+ // Windows: accept only valid codepage numbers, check below.
if (p_enc[6] != 'c' || p_enc[7] != 'p'
|| (enc_dbcs_new = atoi((char *)p_enc + 8)) == 0)
return e_invarg;
#else
- /* Unix: accept any "2byte-" name, assume current locale. */
+ // Unix: accept any "2byte-" name, assume current locale.
enc_dbcs_new = DBCS_2BYTE;
#endif
}
@@ -582,7 +582,7 @@ codepage_invalid:
i = enc_canon_table[idx].prop;
if (i & ENC_UNICODE)
{
- /* Unicode */
+ // Unicode
enc_utf8 = TRUE;
if (i & (ENC_2BYTE | ENC_2WORD))
enc_unicode = 2;
@@ -593,23 +593,23 @@ codepage_invalid:
}
else if (i & ENC_DBCS)
{
- /* 2byte, handle below */
+ // 2byte, handle below
enc_dbcs_new = enc_canon_table[idx].codepage;
}
else
{
- /* Must be 8-bit. */
+ // Must be 8-bit.
enc_unicode = 0;
enc_utf8 = FALSE;
}
}
- else /* Don't know what encoding this is, reject it. */
+ else // Don't know what encoding this is, reject it.
return e_invarg;
if (enc_dbcs_new != 0)
{
#ifdef MSWIN
- /* Check if the DBCS code page is OK. */
+ // Check if the DBCS code page is OK.
if (!IsValidCodePage(enc_dbcs_new))
goto codepage_invalid;
#endif
@@ -624,7 +624,7 @@ codepage_invalid:
enc_latin9 = (STRCMP(p_enc, "iso-8859-15") == 0);
#endif
- /* Detect an encoding that uses latin1 characters. */
+ // Detect an encoding that uses latin1 characters.
enc_latin1like = (enc_utf8 || STRCMP(p_enc, "latin1") == 0
|| STRCMP(p_enc, "iso-8859-15") == 0);
@@ -675,8 +675,8 @@ codepage_invalid:
* Fill the mb_bytelen_tab[] for MB_BYTE2LEN().
*/
#ifdef LEN_FROM_CONV
- /* When 'encoding' is different from the current locale mblen() won't
- * work. Use conversion to "utf-8" instead. */
+ // When 'encoding' is different from the current locale mblen() won't
+ // work. Use conversion to "utf-8" instead.
vimconv.vc_type = CONV_NONE;
if (enc_dbcs)
{
@@ -692,8 +692,8 @@ codepage_invalid:
for (i = 0; i < 256; ++i)
{
- /* Our own function to reliably check the length of UTF-8 characters,
- * independent of mblen(). */
+ // Our own function to reliably check the length of UTF-8 characters,
+ // independent of mblen().
if (enc_utf8)
n = utf8len_tab[i];
else if (enc_dbcs == 0)
@@ -701,9 +701,9 @@ codepage_invalid:
else
{
#if defined(MSWIN) || defined(WIN32UNIX)
- /* enc_dbcs is set by setting 'fileencoding'. It becomes a Windows
- * CodePage identifier, which we can pass directly in to Windows
- * API */
+ // enc_dbcs is set by setting 'fileencoding'. It becomes a Windows
+ // CodePage identifier, which we can pass directly in to Windows
+ // API
n = IsDBCSLeadByteEx(enc_dbcs, (WINBYTE)i) ? 2 : 1;
#else
# if defined(__amigaos4__) || defined(__ANDROID__) || \
@@ -717,7 +717,7 @@ codepage_invalid:
# else
char buf[MB_MAXBYTES + 1];
- if (i == NUL) /* just in case mblen() can't handle "" */
+ if (i == NUL) // just in case mblen() can't handle ""
n = 1;
else
{
@@ -766,37 +766,37 @@ codepage_invalid:
convert_setup(&vimconv, NULL, NULL);
#endif
- /* The cell width depends on the type of multi-byte characters. */
+ // The cell width depends on the type of multi-byte characters.
(void)init_chartab();
- /* When enc_utf8 is set or reset, (de)allocate ScreenLinesUC[] */
+ // When enc_utf8 is set or reset, (de)allocate ScreenLinesUC[]
screenalloc(FALSE);
- /* When using Unicode, set default for 'fileencodings'. */
+ // When using Unicode, set default for 'fileencodings'.
if (enc_utf8 && !option_was_set((char_u *)"fencs"))
set_string_option_direct((char_u *)"fencs", -1,
(char_u *)"ucs-bom,utf-8,default,latin1", OPT_FREE, 0);
#if defined(HAVE_BIND_TEXTDOMAIN_CODESET) && defined(FEAT_GETTEXT)
- /* GNU gettext 0.10.37 supports this feature: set the codeset used for
- * translated messages independently from the current locale. */
+ // GNU gettext 0.10.37 supports this feature: set the codeset used for
+ // translated messages independently from the current locale.
(void)bind_textdomain_codeset(VIMPACKAGE,
enc_utf8 ? "utf-8" : (char *)p_enc);
#endif
#ifdef MSWIN
- /* When changing 'encoding' while starting up, then convert the command
- * line arguments from the active codepage to 'encoding'. */
+ // When changing 'encoding' while starting up, then convert the command
+ // line arguments from the active codepage to 'encoding'.
if (starting != 0)
fix_arg_enc();
#endif
- /* Fire an autocommand to let people do custom font setup. This must be
- * after Vim has been setup for the new encoding. */
+ // Fire an autocommand to let people do custom font setup. This must be
+ // after Vim has been setup for the new encoding.
apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf);
#ifdef FEAT_SPELL
- /* Need to reload spell dictionaries */
+ // Need to reload spell dictionaries
spell_reload();
#endif
@@ -900,18 +900,18 @@ dbcs_class(unsigned lead, unsigned trail)
{
switch (enc_dbcs)
{
- /* please add classify routine for your language in here */
+ // please add classify routine for your language in here
- case DBCS_JPNU: /* ? */
+ case DBCS_JPNU: // ?
case DBCS_JPN:
{
- /* JIS code classification */
+ // JIS code classification
unsigned char lb = lead;
unsigned char tb = trail;
- /* convert process code to JIS */
+ // convert process code to JIS
# if defined(MSWIN) || defined(WIN32UNIX) || defined(MACOS_X)
- /* process code is SJIS */
+ // process code is SJIS
if (lb <= 0x9f)
lb = (lb - 0x81) * 2 + 0x21;
else
@@ -935,58 +935,58 @@ dbcs_class(unsigned lead, unsigned trail)
* process code in most system because it uses
* escape sequences(JIS is context depend encoding).
*/
- /* assume process code is JAPANESE-EUC */
+ // assume process code is JAPANESE-EUC
lb &= 0x7f;
tb &= 0x7f;
# endif
- /* exceptions */
+ // exceptions
switch (lb << 8 | tb)
{
- case 0x2121: /* ZENKAKU space */
+ case 0x2121: // ZENKAKU space
return 0;
- case 0x2122: /* TOU-TEN (Japanese comma) */
- case 0x2123: /* KU-TEN (Japanese period) */
- case 0x2124: /* ZENKAKU comma */
- case 0x2125: /* ZENKAKU period */
+ case 0x2122: // TOU-TEN (Japanese comma)
+ case 0x2123: // KU-TEN (Japanese period)
+ case 0x2124: // ZENKAKU comma
+ case 0x2125: // ZENKAKU period
return 1;
- case 0x213c: /* prolongedsound handled as KATAKANA */
+ case 0x213c: // prolongedsound handled as KATAKANA
return 13;
}
- /* sieved by KU code */
+ // sieved by KU code
switch (lb)
{
case 0x21:
case 0x22:
- /* special symbols */
+ // special symbols
return 10;
case 0x23:
- /* alpha-numeric */
+ // alpha-numeric
return 11;
case 0x24:
- /* hiragana */
+ // hiragana
return 12;
case 0x25:
- /* katakana */
+ // katakana
return 13;
case 0x26:
- /* greek */
+ // greek
return 14;
case 0x27:
- /* russian */
+ // russian
return 15;
case 0x28:
- /* lines */
+ // lines
return 16;
default:
- /* kanji */
+ // kanji
return 17;
}
}
- case DBCS_KORU: /* ? */
+ case DBCS_KORU: // ?
case DBCS_KOR:
{
- /* KS code classification */
+ // KS code classification
unsigned char c1 = lead;
unsigned char c2 = trail;
@@ -1005,56 +1005,55 @@ dbcs_class(unsigned lead, unsigned trail)
*/
if (c1 >= 0xB0 && c1 <= 0xC8)
- /* Hangul */
+ // Hangul
return 20;
#if defined(MSWIN) || defined(WIN32UNIX)
else if (c1 <= 0xA0 || c2 <= 0xA0)
- /* Extended Hangul Region : MS UHC(Unified Hangul Code) */
- /* c1: 0x81-0xA0 with c2: 0x41-0x5A, 0x61-0x7A, 0x81-0xFE
- * c1: 0xA1-0xC6 with c2: 0x41-0x5A, 0x61-0x7A, 0x81-0xA0
- */
+ // Extended Hangul Region : MS UHC(Unified Hangul Code)
+ // c1: 0x81-0xA0 with c2: 0x41-0x5A, 0x61-0x7A, 0x81-0xFE
+ // c1: 0xA1-0xC6 with c2: 0x41-0x5A, 0x61-0x7A, 0x81-0xA0
return 20;
#endif
else if (c1 >= 0xCA && c1 <= 0xFD)
- /* Hanja */
+ // Hanja
return 21;
else switch (c1)
{
case 0xA1:
case 0xA2:
- /* Symbols */
+ // Symbols
return 22;
case 0xA3:
- /* Alpha-numeric */
+ // Alpha-numeric
return 23;
case 0xA4:
- /* Hangul Letter(Alphabet) */
+ // Hangul Letter(Alphabet)
return 24;
case 0xA5:
- /* Roman Numeral/Greek Letter */
+ // Roman Numeral/Greek Letter
return 25;
case 0xA6:
- /* Box Drawings */
+ // Box Drawings
return 26;
case 0xA7:
- /* Unit Symbols */
+ // Unit Symbols
return 27;
case 0xA8:
case 0xA9:
if (c2 <= 0xAF)
- return 25; /* Roman Letter */
+ return 25; // Roman Letter
else if (c2 >= 0xF6)
- return 22; /* Symbols */
+ return 22; // Symbols
else
- /* Circled/Parenthesized Letter */
+ // Circled/Parenthesized Letter
return 28;
case 0xAA:
case 0xAB:
- /* Hiragana/Katakana */
+ // Hiragana/Katakana
return 29;
case 0xAC:
- /* Cyrillic Letter */
+ // Cyrillic Letter
return 30;
}
}
@@ -1103,8 +1102,8 @@ dbcs_char2bytes(int c, char_u *buf)
{
buf[0] = (unsigned)c >> 8;
buf[1] = c;
- /* Never use a NUL byte, it causes lots of trouble. It's an invalid
- * character anyway. */
+ // Never use a NUL byte, it causes lots of trouble. It's an invalid
+ // character anyway.
if (buf[1] == NUL)
buf[1] = '\n';
return 2;
@@ -1131,7 +1130,7 @@ dbcs_ptr2len(
{
int len;
- /* Check if second byte is not missing. */
+ // Check if second byte is not missing.
len = MB_BYTE2LEN(*p);
if (len == 2 && p[1] == NUL)
len = 1;
@@ -1161,7 +1160,7 @@ dbcs_ptr2len_len(char_u *p, int size)
return 0;
if (size == 1)
return 1;
- /* Check that second byte is not missing. */
+ // Check that second byte is not missing.
len = MB_BYTE2LEN(*p);
if (len == 2 && p[1] == NUL)
len = 1;
@@ -1182,11 +1181,11 @@ intable(struct interval *table, size_t size, int c)
{
int mid, bot, top;
- /* first quick check for Latin1 etc. characters */
+ // first quick check for Latin1 etc. characters
if (c < table[0].first)
return FALSE;
- /* binary search in table */
+ // binary search in table
bot = 0;
top = (int)(size / sizeof(struct interval) - 1);
while (top >= bot)
@@ -1202,8 +1201,8 @@ intable(struct interval *table, size_t size, int c)
return FALSE;
}
-/* Sorted list of non-overlapping intervals of East Asian Ambiguous
- * characters, generated with ../runtime/tools/unicode.vim. */
+// Sorted list of non-overlapping intervals of East Asian Ambiguous
+// characters, generated with ../runtime/tools/unicode.vim.
static struct interval ambiguous[] =
{
{0x00a1, 0x00a1},
@@ -1410,8 +1409,8 @@ utf_uint2cells(UINT32_T c)
int
utf_char2cells(int c)
{
- /* Sorted list of non-overlapping intervals of East Asian double width
- * characters, generated with ../runtime/tools/unicode.vim. */
+ // Sorted list of non-overlapping intervals of East Asian double width
+ // characters, generated with ../runtime/tools/unicode.vim.
static struct interval doublewidth[] =
{
{0x1100, 0x115f},
@@ -1529,9 +1528,9 @@ utf_char2cells(int c)
{0x30000, 0x3fffd}
};
- /* Sorted list of non-overlapping intervals of Emoji characters that don't
- * have ambiguous or double width,
- * based on http://unicode.org/emoji/charts/emoji-list.html */
+ // Sorted list of non-overlapping intervals of Emoji characters that don't
+ // have ambiguous or double width,
+ // based on http://unicode.org/emoji/charts/emoji-list.html
static struct interval emoji_width[] =
{
{0x1f1e6, 0x1f1ff},
@@ -1585,12 +1584,12 @@ utf_char2cells(int c)
int n = wcwidth(c);
if (n < 0)
- return 6; /* unprintable, displays <xxxx> */
+ return 6; // unprintable, displays <xxxx>
if (n > 1)
return n;
#else
if (!utf_printable(c))
- return 6; /* unprintable, displays <xxxx> */
+ return 6; // unprintable, displays <xxxx>
if (intable(doublewidth, sizeof(doublewidth), c))
return 2;
#endif
@@ -1598,9 +1597,9 @@ utf_char2cells(int c)
return 2;
}
- /* Characters below 0x100 are influenced by 'isprint' option */
+ // Characters below 0x100 are influenced by 'isprint' option
else if (c >= 0x80 && !vim_isprintc(c))
- return 4; /* unprintable, displays <xx> */
+ return 4; // unprintable, displays <xx>
if (c >= 0x80 && *p_ambw == 'd' && intable(ambiguous, sizeof(ambiguous), c))
return 2;
@@ -1625,14 +1624,14 @@ utf_ptr2cells(
{
int c;
- /* Need to convert to a wide character. */
+ // Need to convert to a wide character.
if (*p >= 0x80)
{
c = utf_ptr2char(p);
- /* An illegal byte is displayed as <xx>. */
+ // An illegal byte is displayed as <xx>.
if (utf_ptr2len(p) == 1 || c == NUL)
return 4;
- /* If the char is ASCII it must be an overlong sequence. */
+ // If the char is ASCII it must be an overlong sequence.
if (c < 0x80)
return char2cells(c);
return utf_char2cells(c);
@@ -1643,8 +1642,8 @@ utf_ptr2cells(
int
dbcs_ptr2cells(char_u *p)
{
- /* Number of cells is equal to number of bytes, except for euc-jp when
- * the first byte is 0x8e. */
+ // Number of cells is equal to number of bytes, except for euc-jp when
+ // the first byte is 0x8e.
if (enc_dbcs == DBCS_JPNU && *p == 0x8e)
return 1;
return MB_BYTE2LEN(*p);
@@ -1666,16 +1665,16 @@ utf_ptr2cells_len(char_u *p, int size)
{
int c;
- /* Need to convert to a wide character. */
+ // Need to convert to a wide character.
if (size > 0 && *p >= 0x80)
{
if (utf_ptr2len_len(p, size) < utf8len_tab[*p])
- return 1; /* truncated */
+ return 1; // truncated
c = utf_ptr2char(p);
- /* An illegal byte is displayed as <xx>. */
+ // An illegal byte is displayed as <xx>.
if (utf_ptr2len(p) == 1 || c == NUL)
return 4;
- /* If the char is ASCII it must be an overlong sequence. */
+ // If the char is ASCII it must be an overlong sequence.
if (c < 0x80)
return char2cells(c);
return utf_char2cells(c);
@@ -1686,8 +1685,8 @@ utf_ptr2cells_len(char_u *p, int size)
static int
dbcs_ptr2cells_len(char_u *p, int size)
{
- /* Number of cells is equal to number of bytes, except for euc-jp when
- * the first byte is 0x8e. */
+ // Number of cells is equal to number of bytes, except for euc-jp when
+ // the first byte is 0x8e.
if (size <= 1 || (enc_dbcs == DBCS_JPNU && *p == 0x8e))
return 1;
return MB_BYTE2LEN(*p);
@@ -1707,11 +1706,11 @@ latin_char2cells(int c UNUSED)
static int
dbcs_char2cells(int c)
{
- /* Number of cells is equal to number of bytes, except for euc-jp when
- * the first byte is 0x8e. */
+ // Number of cells is equal to number of bytes, except for euc-jp when
+ // the first byte is 0x8e.
if (enc_dbcs == DBCS_JPNU && ((unsigned)c >> 8) == 0x8e)
return 1;
- /* use the first byte */
+ // use the first byte
return MB_BYTE2LEN((unsigned)c >> 8);
}
@@ -1744,12 +1743,12 @@ latin_off2cells(unsigned off UNUSED, unsigned max_off UNUSED)
int
dbcs_off2cells(unsigned off, unsigned max_off)
{
- /* never check beyond end of the line */
+ // never check beyond end of the line
if (off >= max_off)
return 1;
- /* Number of cells is equal to number of bytes, except for euc-jp when
- * the first byte is 0x8e. */
+ // Number of cells is equal to number of bytes, except for euc-jp when
+ // the first byte is 0x8e.
if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
return 1;
return MB_BYTE2LEN(ScreenLines[off]);
@@ -1791,7 +1790,7 @@ utf_ptr2char(char_u *p)
{
int len;
- if (p[0] < 0x80) /* be quick for ASCII */
+ if (p[0] < 0x80) // be quick for ASCII
return p[0];
len = utf8len_tab_zero[p[0]];
@@ -1823,7 +1822,7 @@ utf_ptr2char(char_u *p)
}
}
}
- /* Illegal value, just return the first byte */
+ // Illegal value, just return the first byte
return p[0];
}
@@ -1848,40 +1847,40 @@ utf_safe_read_char_adv(char_u **s, size_t *n)
{
int c, k;
- if (*n == 0) /* end of buffer */
+ if (*n == 0) // end of buffer
return 0;
k = utf8len_tab_zero[**s];
if (k == 1)
{
- /* ASCII character or NUL */
+ // ASCII character or NUL
(*n)--;
return *(*s)++;
}
if ((size_t)k <= *n)
{
- /* We have a multibyte sequence and it isn't truncated by buffer
- * limits so utf_ptr2char() is safe to use. Or the first byte is
- * illegal (k=0), and it's also safe to use utf_ptr2char(). */
+ // We have a multibyte sequence and it isn't truncated by buffer
+ // limits so utf_ptr2char() is safe to use. Or the first byte is
+ // illegal (k=0), and it's also safe to use utf_ptr2char().
c = utf_ptr2char(*s);
- /* On failure, utf_ptr2char() returns the first byte, so here we
- * check equality with the first byte. The only non-ASCII character
- * which equals the first byte of its own UTF-8 representation is
- * U+00C3 (UTF-8: 0xC3 0x83), so need to check that special case too.
- * It's safe even if n=1, else we would have k=2 > n. */
+ // On failure, utf_ptr2char() returns the first byte, so here we
+ // check equality with the first byte. The only non-ASCII character
+ // which equals the first byte of its own UTF-8 representation is
+ // U+00C3 (UTF-8: 0xC3 0x83), so need to check that special case too.
+ // It's safe even if n=1, else we would have k=2 > n.
if (c != (int)(**s) || (c == 0xC3 && (*s)[1] == 0x83))
{
- /* byte sequence was successfully decoded */
+ // byte sequence was successfully decoded
*s += k;
*n -= k;
return c;
}
}
- /* byte sequence is incomplete or illegal */
+ // byte sequence is incomplete or illegal
return -1;
}
@@ -1943,7 +1942,7 @@ utf_composinglike(char_u *p1, char_u *p2)
int
utfc_ptr2char(
char_u *p,
- int *pcc) /* return: composing chars, last one is 0 */
+ int *pcc) // return: composing chars, last one is 0
{
int len;
int c;
@@ -1953,7 +1952,7 @@ utfc_ptr2char(
c = utf_ptr2char(p);
len = utf_ptr2len(p);
- /* Only accept a composing char when the first char isn't illegal. */
+ // Only accept a composing char when the first char isn't illegal.
if ((len > 1 || *p < 0x80)
&& p[len] >= 0x80
&& UTF_COMPOSINGLIKE(p, p + len))
@@ -1970,7 +1969,7 @@ utfc_ptr2char(
}
}
- if (i < MAX_MCO) /* last composing char must be 0 */
+ if (i < MAX_MCO) // last composing char must be 0
pcc[i] = 0;
return c;
@@ -1983,7 +1982,7 @@ utfc_ptr2char(
int
utfc_ptr2char_len(
char_u *p,
- int *pcc, /* return: composing chars, last one is 0 */
+ int *pcc, // return: composing chars, last one is 0
int maxlen)
{
int len;
@@ -1993,7 +1992,7 @@ utfc_ptr2char_len(
c = utf_ptr2char(p);
len = utf_ptr2len_len(p, maxlen);
- /* Only accept a composing char when the first char isn't illegal. */
+ // Only accept a composing char when the first char isn't illegal.
if ((len > 1 || *p < 0x80)
&& len < maxlen
&& p[len] >= 0x80
@@ -2013,7 +2012,7 @@ utfc_ptr2char_len(
}
}
- if (i < MAX_MCO) /* last composing char must be 0 */
+ if (i < MAX_MCO) // last composing char must be 0
pcc[i] = 0;
return c;
@@ -2091,9 +2090,9 @@ utf_ptr2len_len(char_u *p, int size)
len = utf8len_tab[*p];
if (len == 1)
- return 1; /* NUL, ascii or illegal lead byte */
+ return 1; // NUL, ascii or illegal lead byte
if (len > size)
- m = size; /* incomplete byte sequence. */
+ m = size; // incomplete byte sequence.
else
m = len;
for (i = 1; i < m; ++i)
@@ -2117,13 +2116,13 @@ utfc_ptr2len(char_u *p)
if (b0 == NUL)
return 0;
- if (b0 < 0x80 && p[1] < 0x80) /* be quick for ASCII */
+ if (b0 < 0x80 && p[1] < 0x80) // be quick for ASCII
return 1;
- /* Skip over first UTF-8 char, stopping at a NUL byte. */
+ // Skip over first UTF-8 char, stopping at a NUL byte.
len = utf_ptr2len(p);
- /* Check for illegal byte. */
+ // Check for illegal byte.
if (len == 1 && b0 >= 0x80)
return 1;
@@ -2139,7 +2138,7 @@ utfc_ptr2len(char_u *p)
if (p[len] < 0x80 || !UTF_COMPOSINGLIKE(p + prevlen, p + len))
return len;
- /* Skip over composing char */
+ // Skip over composing char
#ifdef FEAT_ARABIC
prevlen = len;
#endif
@@ -2163,13 +2162,13 @@ utfc_ptr2len_len(char_u *p, int size)
if (size < 1 || *p == NUL)
return 0;
- if (p[0] < 0x80 && (size == 1 || p[1] < 0x80)) /* be quick for ASCII */
+ if (p[0] < 0x80 && (size == 1 || p[1] < 0x80)) // be quick for ASCII
return 1;
- /* Skip over first UTF-8 char, stopping at a NUL byte. */
+ // Skip over first UTF-8 char, stopping at a NUL byte.
len = utf_ptr2len_len(p, size);
- /* Check for illegal byte and incomplete byte sequence. */
+ // Check for illegal byte and incomplete byte sequence.
if ((len == 1 && p[0] >= 0x80) || len > size)
return 1;
@@ -2198,7 +2197,7 @@ utfc_ptr2len_len(char_u *p, int size)
if (!UTF_COMPOSINGLIKE(p + prevlen, p + len))
break;
- /* Skip over composing char */
+ // Skip over composing char
#ifdef FEAT_ARABIC
prevlen = len;
#endif
@@ -2234,25 +2233,25 @@ utf_char2len(int c)
int
utf_char2bytes(int c, char_u *buf)
{
- if (c < 0x80) /* 7 bits */
+ if (c < 0x80) // 7 bits
{
buf[0] = c;
return 1;
}
- if (c < 0x800) /* 11 bits */
+ if (c < 0x800) // 11 bits
{
buf[0] = 0xc0 + ((unsigned)c >> 6);
buf[1] = 0x80 + (c & 0x3f);
return 2;
}
- if (c < 0x10000) /* 16 bits */
+ if (c < 0x10000) // 16 bits
{
buf[0] = 0xe0 + ((unsigned)c >> 12);
buf[1] = 0x80 + (((unsigned)c >> 6) & 0x3f);
buf[2] = 0x80 + (c & 0x3f);
return 3;
}
- if (c < 0x200000) /* 21 bits */
+ if (c < 0x200000) // 21 bits
{
buf[0] = 0xf0 + ((unsigned)c >> 18);
buf[1] = 0x80 + (((unsigned)c >> 12) & 0x3f);
@@ -2260,7 +2259,7 @@ utf_char2bytes(int c, char_u *buf)
buf[3] = 0x80 + (c & 0x3f);
return 4;
}
- if (c < 0x4000000) /* 26 bits */
+ if (c < 0x4000000) // 26 bits
{
buf[0] = 0xf8 + ((unsigned)c >> 24);
buf[1] = 0x80 + (((unsigned)c >> 18) & 0x3f);
@@ -2269,7 +2268,7 @@ utf_char2bytes(int c, char_u *buf)
buf[4] = 0x80 + (c & 0x3f);
return 5;
}
- /* 31 bits */
+ // 31 bits
buf[0] = 0xfc + ((unsigned)c >> 30);
buf[1] = 0x80 + (((unsigned)c >> 24) & 0x3f);
buf[2] = 0x80 + (((unsigned)c >> 18) & 0x3f);
@@ -2298,8 +2297,8 @@ utf_iscomposing_uint(UINT32_T c)
int
utf_iscomposing(int c)
{
- /* Sorted list of non-overlapping intervals.
- * Generated by ../runtime/tools/unicode.vim. */
+ // Sorted list of non-overlapping intervals.
+ // Generated by ../runtime/tools/unicode.vim.
static struct interval combining[] =
{
{0x0300, 0x036f},
@@ -2600,8 +2599,8 @@ utf_printable(int c)
*/
return iswprint(c);
#else
- /* Sorted list of non-overlapping intervals.
- * 0xd800-0xdfff is reserved for UTF-16, actually illegal. */
+ // Sorted list of non-overlapping intervals.
+ // 0xd800-0xdfff is reserved for UTF-16, actually illegal.
static struct interval nonprint[] =
{
{0x070f, 0x070f}, {0x180b, 0x180e}, {0x200b, 0x200f}, {0x202a, 0x202e},
@@ -2613,8 +2612,8 @@ utf_printable(int c)
#endif
}
-/* Sorted list of non-overlapping intervals of all Emoji characters,
- * based on http://unicode.org/emoji/charts/emoji-list.html */
+// Sorted list of non-overlapping intervals of all Emoji characters,
+// based on http://unicode.org/emoji/charts/emoji-list.html
static struct interval emoji_all[] =
{
{0x203c, 0x203c},
@@ -2776,7 +2775,7 @@ utf_class(int c)
int
utf_class_buf(int c, buf_T *buf)
{
- /* sorted list of non-overlapping intervals */
+ // sorted list of non-overlapping intervals
static struct clinterval
{
unsigned int first;
@@ -2784,10 +2783,10 @@ utf_class_buf(int c, buf_T *buf)
unsigned int class;
} classes[] =
{
- {0x037e, 0x037e, 1}, /* Greek question mark */
- {0x0387, 0x0387, 1}, /* Greek ano teleia */
- {0x055a, 0x055f, 1}, /* Armenian punctuation */
- {0x0589, 0x0589, 1}, /* Armenian full stop */
+ {0x037e, 0x037e, 1}, // Greek question mark
+ {0x0387, 0x0387, 1}, // Greek ano teleia
+ {0x055a, 0x055f, 1}, // Armenian punctuation
+ {0x0589, 0x0589, 1}, // Armenian full stop
{0x05be, 0x05be, 1},
{0x05c0, 0x05c0, 1},
{0x05c3, 0x05c3, 1},
@@ -2797,7 +2796,7 @@ utf_class_buf(int c, buf_T *buf)
{0x061f, 0x061f, 1},
{0x066a, 0x066d, 1},
{0x06d4, 0x06d4, 1},
- {0x0700, 0x070d, 1}, /* Syriac punctuation */
+ {0x0700, 0x070d, 1}, // Syriac punctuation
{0x0964, 0x0965, 1},
{0x0970, 0x0970, 1},
{0x0df4, 0x0df4, 1},
@@ -2806,72 +2805,72 @@ utf_class_buf(int c, buf_T *buf)
{0x0f04, 0x0f12, 1},
{0x0f3a, 0x0f3d, 1},
{0x0f85, 0x0f85, 1},
- {0x104a, 0x104f, 1}, /* Myanmar punctuation */
- {0x10fb, 0x10fb, 1}, /* Georgian punctuation */
- {0x1361, 0x1368, 1}, /* Ethiopic punctuation */
- {0x166d, 0x166e, 1}, /* Canadian Syl. punctuation */
+ {0x104a, 0x104f, 1}, // Myanmar punctuation
+ {0x10fb, 0x10fb, 1}, // Georgian punctuation
+ {0x1361, 0x1368, 1}, // Ethiopic punctuation
+ {0x166d, 0x166e, 1}, // Canadian Syl. punctuation
{0x1680, 0x1680, 0},
{0x169b, 0x169c, 1},
{0x16eb, 0x16ed, 1},
{0x1735, 0x1736, 1},
- {0x17d4, 0x17dc, 1}, /* Khmer punctuation */
- {0x1800, 0x180a, 1}, /* Mongolian punctuation */
- {0x2000, 0x200b, 0}, /* spaces */
- {0x200c, 0x2027, 1}, /* punctuation and symbols */
+ {0x17d4, 0x17dc, 1}, // Khmer punctuation
+ {0x1800, 0x180a, 1}, // Mongolian punctuation
+ {0x2000, 0x200b, 0}, // spaces
+ {0x200c, 0x2027, 1}, // punctuation and symbols
{0x2028, 0x2029, 0},
- {0x202a, 0x202e, 1}, /* punctuation and symbols */
+ {0x202a, 0x202e, 1}, // punctuation and symbols
{0x202f, 0x202f, 0},
- {0x2030, 0x205e, 1}, /* punctuation and symbols */
+ {0x2030, 0x205e, 1}, // punctuation and symbols
{0x205f, 0x205f, 0},
- {0x2060, 0x27ff, 1}, /* punctuation and symbols */
- {0x2070, 0x207f, 0x2070}, /* superscript */
- {0x2080, 0x2094, 0x2080}, /* subscript */
- {0x20a0, 0x27ff, 1}, /* all kinds of symbols */
- {0x2800, 0x28ff, 0x2800}, /* braille */
- {0x2900, 0x2998, 1}, /* arrows, brackets, etc. */
+ {0x2060, 0x27ff, 1}, // punctuation and symbols
+ {0x2070, 0x207f, 0x2070}, // superscript
+ {0x2080, 0x2094, 0x2080}, // subscript
+ {0x20a0, 0x27ff, 1}, // all kinds of symbols
+ {0x2800, 0x28ff, 0x2800}, // braille
+ {0x2900, 0x2998, 1}, // arrows, brackets, etc.
{0x29d8, 0x29db, 1},
{0x29fc, 0x29fd, 1},
- {0x2e00, 0x2e7f, 1}, /* supplemental punctuation */
- {0x3000, 0x3000, 0}, /* ideographic space */
- {0x3001, 0x3020, 1}, /* ideographic punctuation */
+ {0x2e00, 0x2e7f, 1}, // supplemental punctuation
+ {0x3000, 0x3000, 0}, // ideographic space
+ {0x3001, 0x3020, 1}, // ideographic punctuation
{0x3030, 0x3030, 1},
{0x303d, 0x303d, 1},
- {0x3040, 0x309f, 0x3040}, /* Hiragana */
- {0x30a0, 0x30ff, 0x30a0}, /* Katakana */
- {0x3300, 0x9fff, 0x4e00}, /* CJK Ideographs */
- {0xac00, 0xd7a3, 0xac00}, /* Hangul Syllables */
- {0xf900, 0xfaff, 0x4e00}, /* CJK Ideographs */
+ {0x3040, 0x309f, 0x3040}, // Hiragana
+ {0x30a0, 0x30ff, 0x30a0}, // Katakana
+ {0x3300, 0x9fff, 0x4e00}, // CJK Ideographs
+ {0xac00, 0xd7a3, 0xac00}, // Hangul Syllables
+ {0xf900, 0xfaff, 0x4e00}, // CJK Ideographs
{0xfd3e, 0xfd3f, 1},
- {0xfe30, 0xfe6b, 1}, /* punctuation forms */
- {0xff00, 0xff0f, 1}, /* half/fullwidth ASCII */
- {0xff1a, 0xff20, 1}, /* half/fullwidth ASCII */
- {0xff3b, 0xff40, 1}, /* half/fullwidth ASCII */
- {0xff5b, 0xff65, 1}, /* half/fullwidth ASCII */
- {0x1d000, 0x1d24f, 1}, /* Musical notation */
- {0x1d400, 0x1d7ff, 1}, /* Mathematical Alphanumeric Symbols */
- {0x1f000, 0x1f2ff, 1}, /* Game pieces; enclosed characters */
- {0x1f300, 0x1f9ff, 1}, /* Many symbol blocks */
- {0x20000, 0x2a6df, 0x4e00}, /* CJK Ideographs */
- {0x2a700, 0x2b73f, 0x4e00}, /* CJK Ideographs */
- {0x2b740, 0x2b81f, 0x4e00}, /* CJK Ideographs */
- {0x2f800, 0x2fa1f, 0x4e00}, /* CJK Ideographs */
+ {0xfe30, 0xfe6b, 1}, // punctuation forms
+ {0xff00, 0xff0f, 1}, // half/fullwidth ASCII
+ {0xff1a, 0xff20, 1}, // half/fullwidth ASCII
+ {0xff3b, 0xff40, 1}, // half/fullwidth ASCII
+ {0xff5b, 0xff65, 1}, // half/fullwidth ASCII
+ {0x1d000, 0x1d24f, 1}, // Musical notation
+ {0x1d400, 0x1d7ff, 1}, // Mathematical Alphanumeric Symbols
+ {0x1f000, 0x1f2ff, 1}, // Game pieces; enclosed characters
+ {0x1f300, 0x1f9ff, 1}, // Many symbol blocks
+ {0x20000, 0x2a6df, 0x4e00}, // CJK Ideographs
+ {0x2a700, 0x2b73f, 0x4e00}, // CJK Ideographs
+ {0x2b740, 0x2b81f, 0x4e00}, // CJK Ideographs
+ {0x2f800, 0x2fa1f, 0x4e00}, // CJK Ideographs
};
int bot = 0;
int top = sizeof(classes) / sizeof(struct clinterval) - 1;
int mid;
- /* First quick check for Latin1 characters, use 'iskeyword'. */
+ // First quick check for Latin1 characters, use 'iskeyword'.
if (c < 0x100)
{
if (c == ' ' || c == '\t' || c == NUL || c == 0xa0)
- return 0; /* blank */
+ return 0; // blank
if (vim_iswordc_buf(c, buf))
- return 2; /* word character */
- return 1; /* punctuation */
+ return 2; // word character
+ return 1; // punctuation
}
- /* binary search in table */
+ // binary search in table
while (top >= bot)
{
mid = (bot + top) / 2;
@@ -2883,11 +2882,11 @@ utf_class_buf(int c, buf_T *buf)
return (int)classes[mid].class;
}
- /* emoji */
+ // emoji
if (intable(emoji_all, sizeof(emoji_all), c))
return 3;
- /* most other characters are "word" characters */
+ // most other characters are "word" characters
return 2;
}
@@ -3127,14 +3126,14 @@ utf_convert(
convertStruct table[],
int tableSize)
{
- int start, mid, end; /* indices into table */
+ int start, mid, end; // indices into table
int entries = tableSize / sizeof(convertStruct);
start = 0;
end = entries;
while (start < end)
{
- /* need to search further */
+ // need to search further
mid = (end + start) / 2;
if (table[mid].rangeEnd < a)
start = mid + 1;
@@ -3158,7 +3157,7 @@ utf_convert(
utf_fold(int a)
{
if (a < 0x80)
- /* be fast for ASCII */
+ // be fast for ASCII
return a >= 0x41 && a <= 0x5a ? a + 32 : a;
return utf_convert(a, foldCase, (int)sizeof(foldCase));
}
@@ -3537,28 +3536,28 @@ static convertStruct toUpper[] =
int
utf_toupper(int a)
{
- /* If 'casemap' contains "keepascii" use ASCII style toupper(). */
+ // If 'casemap' contains "keepascii" use ASCII style toupper().
if (a < 128 && (cmp_flags & CMP_KEEPASCII))
return TOUPPER_ASC(a);
#if defined(HAVE_TOWUPPER) && defined(__STDC_ISO_10646__)
- /* If towupper() is available and handles Unicode, use it. */
+ // If towupper() is available and handles Unicode, use it.
if (!(cmp_flags & CMP_INTERNAL))
return towupper(a);
#endif
- /* For characters below 128 use locale sensitive toupper(). */
+ // For characters below 128 use locale sensitive toupper().
if (a < 128)
return TOUPPER_LOC(a);
- /* For any other characters use the above mapping table. */
+ // For any other characters use the above mapping table.
return utf_convert(a, toUpper, (int)sizeof(toUpper));
}
int
utf_islower(int a)
{
- /* German sharp s is lower case but has no upper case equivalent. */
+ // German sharp s is lower case but has no upper case equivalent.
return (utf_toupper(a) != a) || a == 0xdf;
}
@@ -3569,21 +3568,21 @@ utf_islower(int a)
int
utf_tolower(int a)
{
- /* If 'casemap' contains "keepascii" use ASCII style tolower(). */
+ // If 'casemap' contains "keepascii" use ASCII style tolower().
if (a < 128 && (cmp_flags & CMP_KEEPASCII))
return TOLOWER_ASC(a);
#if defined(HAVE_TOWLOWER) && defined(__STDC_ISO_10646__)
- /* If towlower() is available and handles Unicode, use it. */
+ // If towlower() is available and handles Unicode, use it.
if (!(cmp_flags & CMP_INTERNAL))
return towlower(a);
#endif
- /* For characters below 128 use locale sensitive tolower(). */
+ // For characters below 128 use locale sensitive tolower().
if (a < 128)
return TOLOWER_LOC(a);
- /* For any other characters use the above mapping table. */
+ // For any other characters use the above mapping table.
return utf_convert(a, toLower, (int)sizeof(toLower));
}
@@ -3619,22 +3618,22 @@ utf_strnicmp(
return cdiff;
}
- /* some string ended or has an incomplete/illegal character sequence */
+ // some string ended or has an incomplete/illegal character sequence
if (c1 == 0 || c2 == 0)
{
- /* some string ended. shorter string is smaller */
+ // some string ended. shorter string is smaller
if (c1 == 0 && c2 == 0)
return 0;
return c1 == 0 ? -1 : 1;
}
- /* Continue with bytewise comparison to produce some result that
- * would make comparison operations involving this function transitive.
- *
- * If only one string had an error, comparison should be made with
- * folded version of the other string. In this case it is enough
- * to fold just one character to determine the result of comparison. */
+ // Continue with bytewise comparison to produce some result that
+ // would make comparison operations involving this function transitive.
+ //
+ // If only one string had an error, comparison should be made with
+ // folded version of the other string. In this case it is enough
+ // to fold just one character to determine the result of comparison.
if (c1 != -1 && c2 == -1)
{
@@ -3692,13 +3691,13 @@ mb_strnicmp(char_u *s1, char_u *s2, size_t nn)
{
for (i = 0; i < n; i += l)
{
- if (s1[i] == NUL && s2[i] == NUL) /* both strings end */
+ if (s1[i] == NUL && s2[i] == NUL) // both strings end
return 0;
l = (*mb_ptr2len)(s1 + i);
if (l <= 1)
{
- /* Single byte: first check normally, then with ignore case. */
+ // Single byte: first check normally, then with ignore case.
if (s1[i] != s2[i])
{
cdiff = MB_TOLOWER(s1[i]) - MB_TOLOWER(s2[i]);
@@ -3708,7 +3707,7 @@ mb_strnicmp(char_u *s1, char_u *s2, size_t nn)
}
else
{
- /* For non-Unicode multi-byte don't ignore case. */
+ // For non-Unicode multi-byte don't ignore case.
if (l > n - i)
l = n - i;
cdiff = STRNCMP(s1 + i, s2 + i, l);
@@ -3733,8 +3732,8 @@ show_utf8(void)
int clen;
int i;
- /* Get the byte length of the char under the cursor, including composing
- * characters. */
+ // Get the byte length of the char under the cursor, including composing
+ // characters.
line = ml_get_cursor();
len = utfc_ptr2len(line);
if (len == 0)
@@ -3748,7 +3747,7 @@ show_utf8(void)
{
if (clen == 0)
{
- /* start of (composing) character, get its length */
+ // start of (composing) character, get its length
if (i > 0)
{
STRCPY(IObuff + rlen, "+ ");
@@ -3757,7 +3756,7 @@ show_utf8(void)
clen = utf_ptr2len(line + i);
}
sprintf((char *)IObuff + rlen, "%02x ",
- (line[i] == NL) ? NUL : line[i]); /* NUL is stored as NL */
+ (line[i] == NL) ? NUL : line[i]); // NUL is stored as NL
--clen;
rlen += (int)STRLEN(IObuff + rlen);
if (rlen > IOSIZE - 20)
@@ -3784,13 +3783,13 @@ dbcs_head_off(char_u *base, char_u *p)
{
char_u *q;
- /* It can't be a trailing byte when not using DBCS, at the start of the
- * string or the previous byte can't start a double-byte. */
+ // It can't be a trailing byte when not using DBCS, at the start of the
+ // string or the previous byte can't start a double-byte.
if (p <= base || MB_BYTE2LEN(p[-1]) == 1 || *p == NUL)
return 0;
- /* This is slow: need to start at the base and go forward until the
- * byte we are looking for. Return 1 when we went past it, 0 otherwise. */
+ // This is slow: need to start at the base and go forward until the
+ // byte we are looking for. Return 1 when we went past it, 0 otherwise.
q = base;
while (q < p)
q += dbcs_ptr2len(q);
@@ -3806,20 +3805,20 @@ dbcs_screen_head_off(char_u *base, char_u *p)
{
char_u *q;
- /* It can't be a trailing byte when not using DBCS, at the start of the
- * string or the previous byte can't start a double-byte.
- * For euc-jp an 0x8e byte in the previous cell always means we have a
- * lead byte in the current cell. */
+ // It can't be a trailing byte when not using DBCS, at the start of the
+ // string or the previous byte can't start a double-byte.
+ // For euc-jp an 0x8e byte in the previous cell always means we have a
+ // lead byte in the current cell.
if (p <= base
|| (enc_dbcs == DBCS_JPNU && p[-1] == 0x8e)
|| MB_BYTE2LEN(p[-1]) == 1
|| *p == NUL)
return 0;
- /* This is slow: need to start at the base and go forward until the
- * byte we are looking for. Return 1 when we went past it, 0 otherwise.
- * For DBCS_JPNU look out for 0x8e, which means the second byte is not
- * stored as the next byte. */
+ // This is slow: need to start at the base and go forward until the
+ // byte we are looking for. Return 1 when we went past it, 0 otherwise.
+ // For DBCS_JPNU look out for 0x8e, which means the second byte is not
+ // stored as the next byte.
q = base;
while (q < p)
{
@@ -3842,21 +3841,21 @@ utf_head_off(char_u *base, char_u *p)
char_u *j;
#endif
- if (*p < 0x80) /* be quick for ASCII */
+ if (*p < 0x80) // be quick for ASCII
return 0;
- /* Skip backwards over trailing bytes: 10xx.xxxx
- * Skip backwards again if on a composing char. */
+ // Skip backwards over trailing bytes: 10xx.xxxx
+ // Skip backwards again if on a composing char.
for (q = p; ; --q)
{
- /* Move s to the last byte of this char. */
+ // Move s to the last byte of this char.
for (s = q; (s[1] & 0xc0) == 0x80; ++s)
;
- /* Move q to the first byte of this char. */
+ // Move q to the first byte of this char.
while (q > base && (*q & 0xc0) == 0x80)
--q;
- /* Check for illegal sequence. Do allow an illegal byte after where we
- * started. */
+ // Check for illegal sequence. Do allow an illegal byte after where we
+ // started.
len = utf8len_tab[*q];
if (len != (int)(s - q + 1) && len != (int)(p - q + 1))
return 0;
@@ -3871,10 +3870,10 @@ utf_head_off(char_u *base, char_u *p)
#ifdef FEAT_ARABIC
if (arabic_maycombine(c))
{
- /* Advance to get a sneak-peak at the next char */
+ // Advance to get a sneak-peak at the next char
j = q;
--j;
- /* Move j to the first byte of this char. */
+ // Move j to the first byte of this char.
while (j > base && (*j & 0xc0) == 0x80)
--j;
if (arabic_combine(utf_ptr2char(j), c))
@@ -3913,15 +3912,15 @@ mb_off_next(char_u *base, char_u *p)
if (enc_utf8)
{
- if (*p < 0x80) /* be quick for ASCII */
+ if (*p < 0x80) // be quick for ASCII
return 0;
- /* Find the next character that isn't 10xx.xxxx */
+ // Find the next character that isn't 10xx.xxxx
for (i = 0; (p[i] & 0xc0) == 0x80; ++i)
;
if (i > 0)
{
- /* Check for illegal sequence. */
+ // Check for illegal sequence.
for (j = 0; p - j > base; ++j)
if ((p[-j] & 0xc0) != 0x80)
break;
@@ -3931,8 +3930,8 @@ mb_off_next(char_u *base, char_u *p)
return i;
}
- /* Only need to check if we're on a trail byte, it doesn't matter if we
- * want the offset to the next or current character. */
+ // Only need to check if we're on a trail byte, it doesn't matter if we
+ // want the offset to the next or current character.
return (*mb_head_off)(base, p);
}
@@ -3951,10 +3950,10 @@ mb_tail_off(char_u *base, char_u *p)
if (enc_utf8)
{
- /* Find the last character that is 10xx.xxxx */
+ // Find the last character that is 10xx.xxxx
for (i = 0; (p[i + 1] & 0xc0) == 0x80; ++i)
;
- /* Check for illegal sequence. */
+ // Check for illegal sequence.
for (j = 0; p - j > base; ++j)
if ((p[-j] & 0xc0) != 0x80)
break;
@@ -3963,12 +3962,12 @@ mb_tail_off(char_u *base, char_u *p)
return i;
}
- /* It can't be the first byte if a double-byte when not using DBCS, at the
- * end of the string or the byte can't start a double-byte. */
+ // It can't be the first byte if a double-byte when not using DBCS, at the
+ // end of the string or the byte can't start a double-byte.
if (enc_dbcs == 0 || p[1] == NUL || MB_BYTE2LEN(*p) == 1)
return 0;
- /* Return 1 when on the lead byte, 0 when on the tail byte. */
+ // Return 1 when on the lead byte, 0 when on the tail byte.
return 1 - dbcs_head_off(base, p);
}
@@ -3987,9 +3986,9 @@ utf_find_illegal(void)
vimconv.vc_type = CONV_NONE;
if (enc_utf8 && (enc_canon_props(curbuf->b_p_fenc) & ENC_8BIT))
{
- /* 'encoding' is "utf-8" but we are editing a 8-bit encoded file,
- * possibly a utf-8 file with illegal bytes. Setup for conversion
- * from utf-8 to 'fileencoding'. */
+ // 'encoding' is "utf-8" but we are editing a 8-bit encoded file,
+ // possibly a utf-8 file with illegal bytes. Setup for conversion
+ // from utf-8 to 'fileencoding'.
convert_setup(&vimconv, p_enc, curbuf->b_p_fenc);
}
@@ -4008,8 +4007,8 @@ utf_find_illegal(void)
while (*p != NUL)
{
- /* Illegal means that there are not enough trail bytes (checked by
- * utf_ptr2len()) or too many of them (overlong sequence). */
+ // Illegal means that there are not enough trail bytes (checked by
+ // utf_ptr2len()) or too many of them (overlong sequence).
len = utf_ptr2len(p);
if (*p >= 0x80 && (len == 1
|| utf_char2len(utf_ptr2char(p)) != len))
@@ -4037,7 +4036,7 @@ utf_find_illegal(void)
curwin->w_cursor.col = 0;
}
- /* didn't find it: don't move and beep */
+ // didn't find it: don't move and beep
curwin->w_cursor = pos;
beep_flush();
@@ -4062,13 +4061,13 @@ utf_valid_string(char_u *s, char_u *end)
{
l = utf8len_tab_zero[*p];
if (l == 0)
- return FALSE; /* invalid lead byte */
+ return FALSE; // invalid lead byte
if (end != NULL && p + l > end)
- return FALSE; /* incomplete byte sequence */
+ return FALSE; // incomplete byte sequence
++p;
while (--l > 0)
if ((*p++ & 0xc0) != 0x80)
- return FALSE; /* invalid trail byte */
+ return FALSE; // invalid trail byte
}
return TRUE;
}
@@ -4081,16 +4080,16 @@ utf_valid_string(char_u *s, char_u *end)
int
dbcs_screen_tail_off(char_u *base, char_u *p)
{
- /* It can't be the first byte if a double-byte when not using DBCS, at the
- * end of the string or the byte can't start a double-byte.
- * For euc-jp an 0x8e byte always means we have a lead byte in the current
- * cell. */
+ // It can't be the first byte if a double-byte when not using DBCS, at the
+ // end of the string or the byte can't start a double-byte.
+ // For euc-jp an 0x8e byte always means we have a lead byte in the current
+ // cell.
if (*p == NUL || p[1] == NUL
|| (enc_dbcs == DBCS_JPNU && *p == 0x8e)
|| MB_BYTE2LEN(*p) == 1)
return 0;
- /* Return 1 when on the lead byte, 0 when on the tail byte. */
+ // Return 1 when on the lead byte, 0 when on the tail byte.
return 1 - dbcs_screen_head_off(base, p);
}
#endif
@@ -4122,8 +4121,8 @@ mb_adjustpos(buf_T *buf, pos_T *lp)
lp->col = 0;
else
lp->col -= (*mb_head_off)(p, p + lp->col);
- /* Reset "coladd" when the cursor would be on the right half of a
- * double-wide character. */
+ // Reset "coladd" when the cursor would be on the right half of a
+ // double-wide character.
if (lp->coladd == 1
&& p[lp->col] != TAB
&& vim_isprintc((*mb_ptr2char)(p + lp->col))
@@ -4137,7 +4136,7 @@ mb_adjustpos(buf_T *buf, pos_T *lp)
*/
char_u *
mb_prevptr(
- char_u *line, /* start of the string */
+ char_u *line, // start of the string
char_u *p)
{
if (p > line)
@@ -4196,9 +4195,9 @@ mb_unescape(char_u **pp)
int m = 0;
char_u *str = *pp;
- /* Must translate K_SPECIAL KS_SPECIAL KE_FILLER to K_SPECIAL and CSI
- * KS_EXTRA KE_CSI to CSI.
- * Maximum length of a utf-8 character is 4 bytes. */
+ // Must translate K_SPECIAL KS_SPECIAL KE_FILLER to K_SPECIAL and CSI
+ // KS_EXTRA KE_CSI to CSI.
+ // Maximum length of a utf-8 character is 4 bytes.
for (n = 0; str[n] != NUL && m < 4; ++n)
{
if (str[n] == K_SPECIAL
@@ -4224,20 +4223,20 @@ mb_unescape(char_u **pp)
|| str[n] == CSI
# endif
)
- break; /* a special key can't be a multibyte char */
+ break; // a special key can't be a multibyte char
else
buf[m++] = str[n];
buf[m] = NUL;
- /* Return a multi-byte character if it's found. An illegal sequence
- * will result in a 1 here. */
+ // Return a multi-byte character if it's found. An illegal sequence
+ // will result in a 1 here.
if ((*mb_ptr2len)(buf) > 1)
{
*pp = str + n + 1;
return buf;
}
- /* Bail out quickly for ASCII. */
+ // Bail out quickly for ASCII.
if (buf[0] < 128)
break;
}
@@ -4309,18 +4308,18 @@ enc_canonize(char_u *enc)
if (STRCMP(enc, "default") == 0)
{
- /* Use the default encoding as it's found by set_init_1(). */
+ // Use the default encoding as it's found by set_init_1().
r = get_encoding_default();
if (r == NULL)
r = (char_u *)"latin1";
return vim_strsave(r);
}
- /* copy "enc" to allocated memory, with room for two '-' */
+ // copy "enc" to allocated memory, with room for two '-'
r = alloc(STRLEN(enc) + 3);
if (r != NULL)
{
- /* Make it all lower case and replace '_' with '-'. */
+ // Make it all lower case and replace '_' with '-'.
p = r;
for (s = enc; *s != NUL; ++s)
{
@@ -4331,40 +4330,40 @@ enc_canonize(char_u *enc)
}
*p = NUL;
- /* Skip "2byte-" and "8bit-". */
+ // Skip "2byte-" and "8bit-".
p = enc_skip(r);
- /* Change "microsoft-cp" to "cp". Used in some spell files. */
+ // Change "microsoft-cp" to "cp". Used in some spell files.
if (STRNCMP(p, "microsoft-cp", 12) == 0)
STRMOVE(p, p + 10);
- /* "iso8859" -> "iso-8859" */
+ // "iso8859" -> "iso-8859"
if (STRNCMP(p, "iso8859", 7) == 0)
{
STRMOVE(p + 4, p + 3);
p[3] = '-';
}
- /* "iso-8859n" -> "iso-8859-n" */
+ // "iso-8859n" -> "iso-8859-n"
if (STRNCMP(p, "iso-8859", 8) == 0 && p[8] != '-')
{
STRMOVE(p + 9, p + 8);
p[8] = '-';
}
- /* "latin-N" -> "latinN" */
+ // "latin-N" -> "latinN"
if (STRNCMP(p, "latin-", 6) == 0)
STRMOVE(p + 5, p + 6);
if (enc_canon_search(p) >= 0)
{
- /* canonical name can be used unmodified */
+ // canonical name can be used unmodified
if (p != r)
STRMOVE(r, p);
}
else if ((i = enc_alias_search(p)) >= 0)
{
- /* alias recognized, get canonical name */
+ // alias recognized, get canonical name
vim_free(r);
r = vim_strsave((char_u *)enc_canon_table[i].name);
}
@@ -4414,20 +4413,19 @@ enc_locale_env(char *locale)
if (s == NULL || *s == NUL)
return NULL;
- /* The most generic locale format is:
- * language[_territory][.codeset][@modifier][+special][,[sponsor][_revision]]
- * If there is a '.' remove the part before it.
- * if there is something after the codeset, remove it.
- * Make the name lowercase and replace '_' with '-'.
- * Exception: "ja_JP.EUC" == "euc-jp", "zh_CN.EUC" = "euc-cn",
- * "ko_KR.EUC" == "euc-kr"
- */
+ // The most generic locale format is:
+ // language[_territory][.codeset][@modifier][+special][,[sponsor][_revision]]
+ // If there is a '.' remove the part before it.
+ // if there is something after the codeset, remove it.
+ // Make the name lowercase and replace '_' with '-'.
+ // Exception: "ja_JP.EUC" == "euc-jp", "zh_CN.EUC" = "euc-cn",
+ // "ko_KR.EUC" == "euc-kr"
if ((p = (char *)vim_strchr((char_u *)s, '.')) != NULL)
{
if (p > s + 2 && STRNICMP(p + 1, "EUC", 3) == 0
&& !isalnum((int)p[4]) && p[4] != '-' && p[-3] == '_')
{
- /* copy "XY.EUC" to "euc-XY" to buf[10] */
+ // copy "XY.EUC" to "euc-XY" to buf[10]
STRCPY(buf + 10, "euc-");
buf[14] = p[-2];
buf[15] = p[-1];
@@ -4536,10 +4534,10 @@ my_iconv_open(char_u *to, char_u *from)
static int iconv_ok = -1;
if (iconv_ok == FALSE)
- return (void *)-1; /* detected a broken iconv() previously */
+ return (void *)-1; // detected a broken iconv() previously
#ifdef DYNAMIC_ICONV
- /* Check if the iconv.dll can be found. */
+ // Check if the iconv.dll can be found.
if (!iconv_enabled(TRUE))
return (void *)-1;
#endif
@@ -4602,50 +4600,50 @@ iconv_string(
{
if (len == 0 || ICONV_ERRNO == ICONV_E2BIG)
{
- /* Allocate enough room for most conversions. When re-allocating
- * increase the buffer size. */
+ // Allocate enough room for most conversions. When re-allocating
+ // increase the buffer size.
len = len + fromlen * 2 + 40;
p = alloc(len);
if (p != NULL && done > 0)
mch_memmove(p, result, done);
vim_free(result);
result = p;
- if (result == NULL) /* out of memory */
+ if (result == NULL) // out of memory
break;
}
to = (char *)result + done;
tolen = len - done - 2;
- /* Avoid a warning for systems with a wrong iconv() prototype by
- * casting the second argument to void *. */
+ // Avoid a warning for systems with a wrong iconv() prototype by
+ // casting the second argument to void *.
if (iconv(vcp->vc_fd, (void *)&from, &fromlen, &to, &tolen)
!= (size_t)-1)
{
- /* Finished, append a NUL. */
+ // Finished, append a NUL.
*to = NUL;
break;
}
- /* Check both ICONV_EINVAL and EINVAL, because the dynamically loaded
- * iconv library may use one of them. */
+ // Check both ICONV_EINVAL and EINVAL, because the dynamically loaded
+ // iconv library may use one of them.
if (!vcp->vc_fail && unconvlenp != NULL
&& (ICONV_ERRNO == ICONV_EINVAL || ICONV_ERRNO == EINVAL))
{
- /* Handle an incomplete sequence at the end. */
+ // Handle an incomplete sequence at the end.
*to = NUL;
*unconvlenp = (int)fromlen;
break;
}
- /* Check both ICONV_EILSEQ and EILSEQ, because the dynamically loaded
- * iconv library may use one of them. */
+ // Check both ICONV_EILSEQ and EILSEQ, because the dynamically loaded
+ // iconv library may use one of them.
else if (!vcp->vc_fail
&& (ICONV_ERRNO == ICONV_EILSEQ || ICONV_ERRNO == EILSEQ
|| ICONV_ERRNO == ICONV_EINVAL || ICONV_ERRNO == EINVAL))
{
- /* Can't convert: insert a '?' and skip a character. This assumes
- * conversion from 'encoding' to something else. In other
- * situations we don't know what to skip anyway. */
+ // Can't convert: insert a '?' and skip a character. This assumes
+ // conversion from 'encoding' to something else. In other
+ // situations we don't know what to skip anyway.
*to++ = '?';
if ((*mb_ptr2cells)((char_u *)from) > 1)
*to++ = '?';
@@ -4662,11 +4660,11 @@ iconv_string(
}
else if (ICONV_ERRNO != ICONV_E2BIG)
{
- /* conversion failed */
+ // conversion failed
VIM_CLEAR(result);
break;
}
- /* Not enough room or skipping illegal sequence. */
+ // Not enough room or skipping illegal sequence.
done = to - (char *)result;
}
@@ -4680,7 +4678,7 @@ iconv_string(
* Dynamically load the "iconv.dll" on Win32.
*/
-# ifndef DYNAMIC_ICONV /* must be generating prototypes */
+# ifndef DYNAMIC_ICONV // must be generating prototypes
# define HINSTANCE int
# endif
static HINSTANCE hIconvDLL = 0;
@@ -4705,8 +4703,8 @@ iconv_enabled(int verbose)
if (hIconvDLL != 0 && hMsvcrtDLL != 0)
return TRUE;
- /* The iconv DLL file goes under different names, try them all.
- * Do the "2" version first, it's newer. */
+ // The iconv DLL file goes under different names, try them all.
+ // Do the "2" version first, it's newer.
#ifdef DYNAMIC_ICONV_DLL_ALT2
if (hIconvDLL == 0)
hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT2);
@@ -4726,8 +4724,8 @@ iconv_enabled(int verbose)
hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL);
if (hIconvDLL == 0 || hMsvcrtDLL == 0)
{
- /* Only give the message when 'verbose' is set, otherwise it might be
- * done whenever a conversion is attempted. */
+ // Only give the message when 'verbose' is set, otherwise it might be
+ // done whenever a conversion is attempted.
if (verbose && p_verbose > 0)
{
verbose_enter();
@@ -4764,7 +4762,7 @@ iconv_enabled(int verbose)
void
iconv_end(void)
{
- /* Don't use iconv() when inputting or outputting characters. */
+ // Don't use iconv() when inputting or outputting characters.
if (input_conv.vc_type == CONV_ICONV)
convert_setup(&input_conv, NULL, NULL);
if (output_conv.vc_type == CONV_ICONV)
@@ -4777,8 +4775,8 @@ iconv_end(void)
hIconvDLL = 0;
hMsvcrtDLL = 0;
}
-# endif /* DYNAMIC_ICONV */
-# endif /* USE_ICONV */
+# endif // DYNAMIC_ICONV
+# endif // USE_ICONV
#ifdef FEAT_GUI
@@ -4807,11 +4805,11 @@ call_imstatusfunc(void)
{
int is_active;
- /* FIXME: Don't execute user function in unsafe situation. */
+ // FIXME: Don't execute user function in unsafe situation.
if (exiting || is_autocmd_blocked())
return FALSE;
- /* FIXME: :py print 'xxx' is shown duplicate result.
- * Use silent to avoid it. */
+ // FIXME: :py print 'xxx' is shown duplicate result.
+ // Use silent to avoid it.
++msg_silent;
is_active = call_func_retnr(p_imsf, 0, NULL);
--msg_silent;
@@ -4822,7 +4820,7 @@ call_imstatusfunc(void)
#if defined(FEAT_XIM) || defined(PROTO)
# if defined(FEAT_GUI_GTK) || defined(PROTO)
-static int xim_has_preediting INIT(= FALSE); /* IM current status */
+static int xim_has_preediting INIT(= FALSE); // IM current status
/*
* Set preedit_start_col to the current cursor position.
@@ -4834,14 +4832,14 @@ init_preedit_start_col(void)
preedit_start_col = cmdline_getvcol_cursor();
else if (curwin != NULL && curwin->w_buffer != NULL)
getvcol(curwin, &curwin->w_cursor, &preedit_start_col, NULL, NULL);
- /* Prevent that preediting marks the buffer as changed. */
+ // Prevent that preediting marks the buffer as changed.
xim_changed_while_preediting = curbuf->b_changed;
}
-static int im_is_active = FALSE; /* IM is enabled for current mode */
+static int im_is_active = FALSE; // IM is enabled for current mode
static int preedit_is_active = FALSE;
-static int im_preedit_cursor = 0; /* cursor offset in characters */
-static int im_preedit_trailing = 0; /* number of characters after cursor */
+static int im_preedit_cursor = 0; // cursor offset in characters
+static int im_preedit_trailing = 0; // number of characters after cursor
static unsigned long im_commit_handler_id = 0;
static unsigned int im_activatekey_keyval = GDK_VoidSymbol;
@@ -4895,7 +4893,7 @@ im_set_position(int row, int col)
}
}
-# if 0 || defined(PROTO) /* apparently only used in gui_x11.c */
+# if 0 || defined(PROTO) // apparently only used in gui_x11.c
void
xim_set_preedit(void)
{
@@ -4906,7 +4904,7 @@ xim_set_preedit(void)
static void
im_add_to_input(char_u *str, int len)
{
- /* Convert from 'termencoding' (always "utf-8") to 'encoding' */
+ // Convert from 'termencoding' (always "utf-8") to 'encoding'
if (input_conv.vc_type != CONV_NONE)
{
str = string_convert(&input_conv, str, &len);
@@ -4918,7 +4916,7 @@ im_add_to_input(char_u *str, int len)
if (input_conv.vc_type != CONV_NONE)
vim_free(str);
- if (p_mh) /* blank out the pointer if necessary */
+ if (p_mh) // blank out the pointer if necessary
gui_mch_mousehide(TRUE);
}
@@ -4986,8 +4984,8 @@ im_preedit_window_open()
if (!pango_font_description_get_size_is_absolute(gui.norm_font))
{
- /* fontsize was given in points. Convert it into that in pixels
- * to use with CSS. */
+ // fontsize was given in points. Convert it into that in pixels
+ // to use with CSS.
GdkScreen * const screen
= gdk_window_get_screen(gtk_widget_get_window(gui.mainwin));
const gdouble dpi = gdk_screen_get_resolution(screen);
@@ -5078,7 +5076,7 @@ im_show_preedit()
{
im_preedit_window_open();
- if (p_mh) /* blank out the pointer if necessary */
+ if (p_mh) // blank out the pointer if necessary
gui_mch_mousehide(TRUE);
}
@@ -5172,26 +5170,26 @@ im_commit_cb(GtkIMContext *context UNUSED,
if (p_imst == IM_ON_THE_SPOT)
{
- /* The imhangul module doesn't reset the preedit string before
- * committing. Call im_delete_preedit() to work around that. */
+ // The imhangul module doesn't reset the preedit string before
+ // committing. Call im_delete_preedit() to work around that.
im_delete_preedit();
- /* Indicate that preediting has finished. */
+ // Indicate that preediting has finished.
if (preedit_start_col == MAXCOL)
{
init_preedit_start_col();
commit_with_preedit = FALSE;
}
- /* The thing which setting "preedit_start_col" to MAXCOL means that
- * "preedit_start_col" will be set forcedly when calling
- * preedit_changed_cb() next time.
- * "preedit_start_col" should not reset with MAXCOL on this part. Vim
- * is simulating the preediting by using add_to_input_str(). when
- * preedit begin immediately before committed, the typebuf is not
- * flushed to screen, then it can't get correct "preedit_start_col".
- * Thus, it should calculate the cells by adding cells of the committed
- * string. */
+ // The thing which setting "preedit_start_col" to MAXCOL means that
+ // "preedit_start_col" will be set forcedly when calling
+ // preedit_changed_cb() next time.
+ // "preedit_start_col" should not reset with MAXCOL on this part. Vim
+ // is simulating the preediting by using add_to_input_str(). when
+ // preedit begin immediately before committed, the typebuf is not
+ // flushed to screen, then it can't get correct "preedit_start_col".
+ // Thus, it should calculate the cells by adding cells of the committed
+ // string.
if (input_conv.vc_type != CONV_NONE)
{
im_str = string_convert(&input_conv, (char_u *)str, &len);
@@ -5207,22 +5205,22 @@ im_commit_cb(GtkIMContext *context UNUSED,
preedit_start_col += clen;
}
- /* Is this a single character that matches a keypad key that's just
- * been pressed? If so, we don't want it to be entered as such - let
- * us carry on processing the raw keycode so that it may be used in
- * mappings as <kSomething>. */
+ // Is this a single character that matches a keypad key that's just
+ // been pressed? If so, we don't want it to be entered as such - let
+ // us carry on processing the raw keycode so that it may be used in
+ // mappings as <kSomething>.
if (xim_expected_char != NUL)
{
- /* We're currently processing a keypad or other special key */
+ // We're currently processing a keypad or other special key
if (slen == 1 && str[0] == xim_expected_char)
{
- /* It's a match - don't do it here */
+ // It's a match - don't do it here
xim_ignored_char = TRUE;
add_to_input = FALSE;
}
else
{
- /* Not a match */
+ // Not a match
xim_ignored_char = FALSE;
}
}
@@ -5232,13 +5230,13 @@ im_commit_cb(GtkIMContext *context UNUSED,
if (p_imst == IM_ON_THE_SPOT)
{
- /* Inserting chars while "im_is_active" is set does not cause a
- * change of buffer. When the chars are committed the buffer must be
- * marked as changed. */
+ // Inserting chars while "im_is_active" is set does not cause a
+ // change of buffer. When the chars are committed the buffer must be
+ // marked as changed.
if (!commit_with_preedit)
preedit_start_col = MAXCOL;
- /* This flag is used in changed() at next call. */
+ // This flag is used in changed() at next call.
xim_changed_while_preediting = TRUE;
}
@@ -5273,15 +5271,15 @@ im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
#endif
im_delete_preedit();
- /* Indicate that preediting has finished */
+ // Indicate that preediting has finished
if (p_imst == IM_ON_THE_SPOT)
preedit_start_col = MAXCOL;
xim_has_preediting = FALSE;
#if 0
- /* Removal of this line suggested by Takuhiro Nishioka. Fixes that IM was
- * switched off unintentionally. We now use preedit_is_active (added by
- * SungHyun Nam). */
+ // Removal of this line suggested by Takuhiro Nishioka. Fixes that IM was
+ // switched off unintentionally. We now use preedit_is_active (added by
+ // SungHyun Nam).
im_is_active = FALSE;
#endif
preedit_is_active = FALSE;
@@ -5349,7 +5347,7 @@ im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED)
xim_log("im_preedit_changed_cb(): %s\n", preedit_string);
#endif
- g_return_if_fail(preedit_string != NULL); /* just in case */
+ g_return_if_fail(preedit_string != NULL); // just in case
if (p_imst == IM_OVER_THE_SPOT)
{
@@ -5366,20 +5364,20 @@ im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED)
}
else
{
- /* If preedit_start_col is MAXCOL set it to the current cursor position. */
+ // If preedit_start_col is MAXCOL set it to the current cursor position.
if (preedit_start_col == MAXCOL && preedit_string[0] != '\0')
{
xim_has_preediting = TRUE;
- /* Urgh, this breaks if the input buffer isn't empty now */
+ // Urgh, this breaks if the input buffer isn't empty now
init_preedit_start_col();
}
else if (cursor_index == 0 && preedit_string[0] == '\0')
{
xim_has_preediting = FALSE;
- /* If at the start position (after typing backspace)
- * preedit_start_col must be reset. */
+ // If at the start position (after typing backspace)
+ // preedit_start_col must be reset.
preedit_start_col = MAXCOL;
}
@@ -5414,8 +5412,8 @@ im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED)
}
if (!is_composing && i >= cursor_index)
{
- /* This is essentially the same as im_preedit_trailing, except
- * composing characters are not counted even if p_deco is set. */
+ // This is essentially the same as im_preedit_trailing, except
+ // composing characters are not counted even if p_deco is set.
++num_move_back;
}
if (preedit_start_col != MAXCOL)
@@ -5466,7 +5464,7 @@ translate_pango_attributes(PangoAttrIterator *iter)
{
const PangoColor *color = &((PangoAttrColor *)attr)->color;
- /* Assume inverse if black background is requested */
+ // Assume inverse if black background is requested
if ((color->red | color->green | color->blue) == 0)
char_attr |= HL_INVERSE;
}
@@ -5494,7 +5492,7 @@ im_get_feedback_attr(int col)
{
int idx;
- /* Get the byte index as used by PangoAttrIterator */
+ // Get the byte index as used by PangoAttrIterator
for (idx = 0; col > 0 && preedit_string[idx] != '\0'; --col)
idx += utfc_ptr2len((char_u *)preedit_string + idx);
@@ -5506,7 +5504,7 @@ im_get_feedback_attr(int col)
char_attr = HL_NORMAL;
iter = pango_attr_list_get_iterator(attr_list);
- /* Extract all relevant attributes from the list. */
+ // Extract all relevant attributes from the list.
do
{
pango_attr_iterator_range(iter, &start, &end);
@@ -5588,7 +5586,7 @@ im_string_to_keyval(const char *str, unsigned int *keyval, unsigned int *state)
mods_end = strrchr(str, '-');
mods_end = (mods_end != NULL) ? mods_end + 1 : str;
- /* Parse modifier keys */
+ // Parse modifier keys
while (str < mods_end)
switch (*str++)
{
@@ -5649,20 +5647,20 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state)
event = (GdkEventKey *)gdk_event_new(GDK_KEY_PRESS);
g_object_ref(gtk_widget_get_window(gui.drawarea));
- /* unreffed by gdk_event_free() */
+ // unreffed by gdk_event_free()
event->window = gtk_widget_get_window(gui.drawarea);
event->send_event = TRUE;
event->time = GDK_CURRENT_TIME;
event->state = state;
event->keyval = keyval;
- event->hardware_keycode = /* needed for XIM */
+ event->hardware_keycode = // needed for XIM
XKeysymToKeycode(GDK_WINDOW_XDISPLAY(event->window), (KeySym)keyval);
event->length = 0;
event->string = NULL;
gtk_im_context_filter_keypress(xic, event);
- /* For consistency, also send the corresponding release event. */
+ // For consistency, also send the corresponding release event.
event->type = GDK_KEY_RELEASE;
event->send_event = FALSE;
gtk_im_context_filter_keypress(xic, event);
@@ -5770,9 +5768,9 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
{
unsigned int state_mask;
- /* Require the state of the 3 most used modifiers to match exactly.
- * Otherwise e.g. <S-C-space> would be unusable for other purposes
- * if the IM activate key is <S-space>. */
+ // Require the state of the 3 most used modifiers to match exactly.
+ // Otherwise e.g. <S-C-space> would be unusable for other purposes
+ // if the IM activate key is <S-space>.
state_mask = im_activatekey_state;
state_mask |= ((int)GDK_SHIFT_MASK | (int)GDK_CONTROL_MASK
| (int)GDK_MOD1_MASK);
@@ -5780,7 +5778,7 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
if ((event->state & state_mask) != im_activatekey_state)
return FALSE;
- /* Don't send it a second time on GDK_KEY_RELEASE. */
+ // Don't send it a second time on GDK_KEY_RELEASE.
if (event->type != GDK_KEY_PRESS)
return TRUE;
@@ -5788,7 +5786,7 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
{
im_set_active(FALSE);
- /* ":lmap" mappings exists, toggle use of mappings. */
+ // ":lmap" mappings exists, toggle use of mappings.
State ^= LANGMAP;
if (State & LANGMAP)
{
@@ -5806,23 +5804,23 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
return gtk_im_context_filter_keypress(xic, event);
}
- /* Don't filter events through the IM context if IM isn't active
- * right now. Unlike with GTK+ 1.2 we cannot rely on the IM module
- * not doing anything before the activation key was sent. */
+ // Don't filter events through the IM context if IM isn't active
+ // right now. Unlike with GTK+ 1.2 we cannot rely on the IM module
+ // not doing anything before the activation key was sent.
if (im_activatekey_keyval == GDK_VoidSymbol || im_is_active)
{
int imresult = gtk_im_context_filter_keypress(xic, event);
if (p_imst == IM_ON_THE_SPOT)
{
- /* Some XIM send following sequence:
- * 1. preedited string.
- * 2. committed string.
- * 3. line changed key.
- * 4. preedited string.
- * 5. remove preedited string.
- * if 3, Vim can't move back the above line for 5.
- * thus, this part should not parse the key. */
+ // Some XIM send following sequence:
+ // 1. preedited string.
+ // 2. committed string.
+ // 3. line changed key.
+ // 4. preedited string.
+ // 5. remove preedited string.
+ // if 3, Vim can't move back the above line for 5.
+ // thus, this part should not parse the key.
if (!imresult && preedit_start_col != MAXCOL
&& event->keyval == GDK_Return)
{
@@ -5831,17 +5829,17 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
}
}
- /* If XIM tried to commit a keypad key as a single char.,
- * ignore it so we can use the keypad key 'raw', for mappings. */
+ // If XIM tried to commit a keypad key as a single char.,
+ // ignore it so we can use the keypad key 'raw', for mappings.
if (xim_expected_char != NUL && xim_ignored_char)
- /* We had a keypad key, and XIM tried to thieve it */
+ // We had a keypad key, and XIM tried to thieve it
return FALSE;
- /* This is supposed to fix a problem with iBus, that space
- * characters don't work in input mode. */
+ // This is supposed to fix a problem with iBus, that space
+ // characters don't work in input mode.
xim_expected_char = NUL;
- /* Normal processing */
+ // Normal processing
return imresult;
}
}
@@ -5871,11 +5869,11 @@ im_is_preediting(void)
return xim_has_preediting;
}
-# else /* !FEAT_GUI_GTK */
+# else // !FEAT_GUI_GTK
-static int xim_is_active = FALSE; /* XIM should be active in the current
- mode */
-static int xim_has_focus = FALSE; /* XIM is really being used for Vim */
+static int xim_is_active = FALSE; // XIM should be active in the current
+ // mode
+static int xim_has_focus = FALSE; // XIM is really being used for Vim
# ifdef FEAT_GUI_X11
static XIMStyle input_style;
static int status_area_enabled = TRUE;
@@ -5890,13 +5888,13 @@ im_set_active(int active_arg)
{
int active = active_arg;
- /* If 'imdisable' is set, XIM is never active. */
+ // If 'imdisable' is set, XIM is never active.
if (p_imdisable)
active = FALSE;
else if (input_style & XIMPreeditPosition)
- /* There is a problem in switching XIM off when preediting is used,
- * and it is not clear how this can be solved. For now, keep XIM on
- * all the time, like it was done in Vim 5.8. */
+ // There is a problem in switching XIM off when preediting is used,
+ // and it is not clear how this can be solved. For now, keep XIM on
+ // all the time, like it was done in Vim 5.8.
active = TRUE;
# if defined(FEAT_EVAL)
@@ -5914,7 +5912,7 @@ im_set_active(int active_arg)
if (xic == NULL)
return;
- /* Remember the active state, it is needed when Vim gets keyboard focus. */
+ // Remember the active state, it is needed when Vim gets keyboard focus.
xim_is_active = active;
xim_set_preedit();
}
@@ -5975,9 +5973,9 @@ xim_set_preedit(void)
if (!xim_has_focus)
{
- /* hide XIM cursor */
+ // hide XIM cursor
over_spot.x = 0;
- over_spot.y = -100; /* arbitrary invisible position */
+ over_spot.y = -100; // arbitrary invisible position
attr_list = (XVaNestedList) XVaCreateNestedList(0,
XNSpotLocation,
&over_spot,
@@ -6155,16 +6153,16 @@ xim_real_init(Window x11_window, Display *x11_display)
if (xim == NULL && (p = XSetLocaleModifiers("")) != NULL && *p != NUL)
xim = XOpenIM(x11_display, NULL, NULL, NULL);
- /* This is supposed to be useful to obtain characters through
- * XmbLookupString() without really using a XIM. */
+ // This is supposed to be useful to obtain characters through
+ // XmbLookupString() without really using a XIM.
if (xim == NULL && (p = XSetLocaleModifiers("@im=none")) != NULL
&& *p != NUL)
xim = XOpenIM(x11_display, NULL, NULL, NULL);
if (xim == NULL)
{
- /* Only give this message when verbose is set, because too many people
- * got this message when they didn't want to use a XIM. */
+ // Only give this message when verbose is set, because too many people
+ // got this message when they didn't want to use a XIM.
if (p_verbose > 0)
{
verbose_enter();
@@ -6241,8 +6239,8 @@ xim_real_init(Window x11_window, Display *x11_display)
if (!found)
{
- /* Only give this message when verbose is set, because too many people
- * got this message when they didn't want to use a XIM. */
+ // Only give this message when verbose is set, because too many people
+ // got this message when they didn't want to use a XIM.
if (p_verbose > 0)
{
verbose_enter();
@@ -6257,8 +6255,8 @@ xim_real_init(Window x11_window, Display *x11_display)
over_spot.y = TEXT_Y(gui.row);
input_style = this_input_style;
- /* A crash was reported when trying to pass gui.norm_font as XNFontSet,
- * thus that has been removed. Hopefully the default works... */
+ // A crash was reported when trying to pass gui.norm_font as XNFontSet,
+ // thus that has been removed. Hopefully the default works...
# ifdef FEAT_XFONTSET
if (gui.fontset != NOFONTSET)
{
@@ -6318,7 +6316,7 @@ xim_real_init(Window x11_window, Display *x11_display)
return TRUE;
}
-# endif /* FEAT_GUI_X11 */
+# endif // FEAT_GUI_X11
/*
* Get IM status. When IM is on, return TRUE. Else return FALSE.
@@ -6336,7 +6334,7 @@ im_get_status(void)
return xim_has_focus;
}
-# endif /* !FEAT_GUI_GTK */
+# endif // !FEAT_GUI_GTK
# if !defined(FEAT_GUI_GTK) || defined(PROTO)
/*
@@ -6362,7 +6360,7 @@ xim_set_status_area(void)
{
XRectangle *needed_rect;
- /* to get status_area width */
+ // to get status_area width
status_list = XVaCreateNestedList(0, XNAreaNeeded,
&needed_rect, NULL);
XGetICValues(xic, XNStatusAttributes, status_list, NULL);
@@ -6398,7 +6396,7 @@ xim_set_status_area(void)
status_area.height = gui.char_height;
}
- if (input_style & XIMPreeditArea) /* off-the-spot */
+ if (input_style & XIMPreeditArea) // off-the-spot
{
pre_area.x = status_area.x + status_area.width;
pre_area.y = gui.char_height * Rows + gui.border_offset;
@@ -6412,7 +6410,7 @@ xim_set_status_area(void)
pre_area.height = gui.char_height;
preedit_list = XVaCreateNestedList(0, XNArea, &pre_area, NULL);
}
- else if (input_style & XIMPreeditPosition) /* over-the-spot */
+ else if (input_style & XIMPreeditPosition) // over-the-spot
{
pre_area.x = 0;
pre_area.y = 0;
@@ -6453,7 +6451,7 @@ xim_get_status_area_height(void)
}
# endif
-#else /* !defined(FEAT_XIM) */
+#else // !defined(FEAT_XIM)
# if defined(IME_WITHOUT_XIM) || defined(VIMDLL)
static int im_was_set_active = FALSE;
@@ -6498,7 +6496,7 @@ im_set_position(int row UNUSED, int col UNUSED)
# endif
# endif
-#endif /* FEAT_XIM */
+#endif // FEAT_XIM
#if defined(FEAT_EVAL) || defined(PROTO)
/*
@@ -6545,7 +6543,7 @@ convert_setup_ext(
int from_is_utf8;
int to_is_utf8;
- /* Reset to no conversion. */
+ // Reset to no conversion.
#ifdef USE_ICONV
if (vcp->vc_type == CONV_ICONV && vcp->vc_fd != (iconv_t)-1)
iconv_close(vcp->vc_fd);
@@ -6554,7 +6552,7 @@ convert_setup_ext(
vcp->vc_factor = 1;
vcp->vc_fail = FALSE;
- /* No conversion when one of the names is empty or they are equal. */
+ // No conversion when one of the names is empty or they are equal.
if (from == NULL || *from == NUL || to == NULL || *to == NUL
|| STRCMP(from, to) == 0)
return OK;
@@ -6572,33 +6570,33 @@ convert_setup_ext(
if ((from_prop & ENC_LATIN1) && to_is_utf8)
{
- /* Internal latin1 -> utf-8 conversion. */
+ // Internal latin1 -> utf-8 conversion.
vcp->vc_type = CONV_TO_UTF8;
- vcp->vc_factor = 2; /* up to twice as long */
+ vcp->vc_factor = 2; // up to twice as long
}
else if ((from_prop & ENC_LATIN9) && to_is_utf8)
{
- /* Internal latin9 -> utf-8 conversion. */
+ // Internal latin9 -> utf-8 conversion.
vcp->vc_type = CONV_9_TO_UTF8;
- vcp->vc_factor = 3; /* up to three as long (euro sign) */
+ vcp->vc_factor = 3; // up to three as long (euro sign)
}
else if (from_is_utf8 && (to_prop & ENC_LATIN1))
{
- /* Internal utf-8 -> latin1 conversion. */
+ // Internal utf-8 -> latin1 conversion.
vcp->vc_type = CONV_TO_LATIN1;
}
else if (from_is_utf8 && (to_prop & ENC_LATIN9))
{
- /* Internal utf-8 -> latin9 conversion. */
+ // Internal utf-8 -> latin9 conversion.
vcp->vc_type = CONV_TO_LATIN9;
}
#ifdef MSWIN
- /* Win32-specific codepage <-> codepage conversion without iconv. */
+ // Win32-specific codepage <-> codepage conversion without iconv.
else if ((from_is_utf8 || encname2codepage(from) > 0)
&& (to_is_utf8 || encname2codepage(to) > 0))
{
vcp->vc_type = CONV_CODEPAGE;
- vcp->vc_factor = 2; /* up to twice as long */
+ vcp->vc_factor = 2; // up to twice as long
vcp->vc_cpfrom = from_is_utf8 ? 0 : encname2codepage(from);
vcp->vc_cpto = to_is_utf8 ? 0 : encname2codepage(to);
}
@@ -6611,7 +6609,7 @@ convert_setup_ext(
else if ((from_prop & ENC_MACROMAN) && to_is_utf8)
{
vcp->vc_type = CONV_MAC_UTF8;
- vcp->vc_factor = 2; /* up to twice as long */
+ vcp->vc_factor = 2; // up to twice as long
}
else if ((from_prop & ENC_LATIN1) && (to_prop & ENC_MACROMAN))
{
@@ -6625,14 +6623,14 @@ convert_setup_ext(
#ifdef USE_ICONV
else
{
- /* Use iconv() for conversion. */
+ // Use iconv() for conversion.
vcp->vc_fd = (iconv_t)my_iconv_open(
to_is_utf8 ? (char_u *)"utf-8" : to,
from_is_utf8 ? (char_u *)"utf-8" : from);
if (vcp->vc_fd != (iconv_t)-1)
{
vcp->vc_type = CONV_ICONV;
- vcp->vc_factor = 4; /* could be longer too... */
+ vcp->vc_factor = 4; // could be longer too...
}
}
#endif
@@ -6681,7 +6679,7 @@ convert_input_safe(
{
if (unconvertlen > 0)
{
- /* Move the unconverted characters to allocated memory. */
+ // Move the unconverted characters to allocated memory.
*restp = alloc(unconvertlen);
if (*restp != NULL)
mch_memmove(*restp, ptr + len - unconvertlen, unconvertlen);
@@ -6690,8 +6688,8 @@ convert_input_safe(
mch_memmove(ptr, d, dlen);
}
else
- /* result is too long, keep the unconverted text (the caller must
- * have done something wrong!) */
+ // result is too long, keep the unconverted text (the caller must
+ // have done something wrong!)
dlen = len;
vim_free(d);
}
@@ -6742,7 +6740,7 @@ string_convert_ext(
switch (vcp->vc_type)
{
- case CONV_TO_UTF8: /* latin1 to utf-8 conversion */
+ case CONV_TO_UTF8: // latin1 to utf-8 conversion
retval = alloc(len * 2 + 1);
if (retval == NULL)
break;
@@ -6763,7 +6761,7 @@ string_convert_ext(
*lenp = (int)(d - retval);
break;
- case CONV_9_TO_UTF8: /* latin9 to utf-8 conversion */
+ case CONV_9_TO_UTF8: // latin9 to utf-8 conversion
retval = alloc(len * 3 + 1);
if (retval == NULL)
break;
@@ -6773,14 +6771,14 @@ string_convert_ext(
c = ptr[i];
switch (c)
{
- case 0xa4: c = 0x20ac; break; /* euro */
- case 0xa6: c = 0x0160; break; /* S hat */
- case 0xa8: c = 0x0161; break; /* S -hat */
- case 0xb4: c = 0x017d; break; /* Z hat */
- case 0xb8: c = 0x017e; break; /* Z -hat */
- case 0xbc: c = 0x0152; break; /* OE */
- case 0xbd: c = 0x0153; break; /* oe */
- case 0xbe: c = 0x0178; break; /* Y */
+ case 0xa4: c = 0x20ac; break; // euro
+ case 0xa6: c = 0x0160; break; // S hat
+ case 0xa8: c = 0x0161; break; // S -hat
+ case 0xb4: c = 0x017d; break; // Z hat
+ case 0xb8: c = 0x017e; break; // Z -hat
+ case 0xbc: c = 0x0152; break; // OE
+ case 0xbd: c = 0x0153; break; // oe
+ case 0xbe: c = 0x0178; break; // Y
}
d += utf_char2bytes(c, d);
}
@@ -6789,8 +6787,8 @@ string_convert_ext(
*lenp = (int)(d - retval);
break;
- case CONV_TO_LATIN1: /* utf-8 to latin1 conversion */
- case CONV_TO_LATIN9: /* utf-8 to latin9 conversion */
+ case CONV_TO_LATIN1: // utf-8 to latin1 conversion
+ case CONV_TO_LATIN9: // utf-8 to latin9 conversion
retval = alloc(len + 1);
if (retval == NULL)
break;
@@ -6806,13 +6804,13 @@ string_convert_ext(
if (l_w == 0)
{
- /* Illegal utf-8 byte cannot be converted */
+ // Illegal utf-8 byte cannot be converted
vim_free(retval);
return NULL;
}
if (unconvlenp != NULL && l_w > len - i)
{
- /* Incomplete sequence at the end. */
+ // Incomplete sequence at the end.
*unconvlenp = len - i;
break;
}
@@ -6824,14 +6822,14 @@ string_convert_ext(
if (vcp->vc_type == CONV_TO_LATIN9)
switch (c)
{
- case 0x20ac: c = 0xa4; break; /* euro */
- case 0x0160: c = 0xa6; break; /* S hat */
- case 0x0161: c = 0xa8; break; /* S -hat */
- case 0x017d: c = 0xb4; break; /* Z hat */
- case 0x017e: c = 0xb8; break; /* Z -hat */
- case 0x0152: c = 0xbc; break; /* OE */
- case 0x0153: c = 0xbd; break; /* oe */
- case 0x0178: c = 0xbe; break; /* Y */
+ case 0x20ac: c = 0xa4; break; // euro
+ case 0x0160: c = 0xa6; break; // S hat
+ case 0x0161: c = 0xa8; break; // S -hat
+ case 0x017d: c = 0xb4; break; // Z hat
+ case 0x017e: c = 0xb8; break; // Z -hat
+ case 0x0152: c = 0xbc; break; // OE
+ case 0x0153: c = 0xbd; break; // oe
+ case 0x0178: c = 0xbe; break; // Y
case 0xa4:
case 0xa6:
case 0xa8:
@@ -6839,9 +6837,9 @@ string_convert_ext(
case 0xb8:
case 0xbc:
case 0xbd:
- case 0xbe: c = 0x100; break; /* not in latin9 */
+ case 0xbe: c = 0x100; break; // not in latin9
}
- if (!utf_iscomposing(c)) /* skip composing chars */
+ if (!utf_iscomposing(c)) // skip composing chars
{
if (c < 0x100)
*d++ = c;
@@ -6888,18 +6886,18 @@ string_convert_ext(
# endif
# ifdef USE_ICONV
- case CONV_ICONV: /* conversion with output_conv.vc_fd */
+ case CONV_ICONV: // conversion with output_conv.vc_fd
retval = iconv_string(vcp, ptr, len, unconvlenp, lenp);
break;
# endif
# ifdef MSWIN
- case CONV_CODEPAGE: /* codepage -> codepage */
+ case CONV_CODEPAGE: // codepage -> codepage
{
int retlen;
int tmp_len;
short_u *tmp;
- /* 1. codepage/UTF-8 -> ucs-2. */
+ // 1. codepage/UTF-8 -> ucs-2.
if (vcp->vc_cpfrom == 0)
tmp_len = utf8_to_utf16(ptr, len, NULL, NULL);
else
@@ -6929,7 +6927,7 @@ string_convert_ext(
MultiByteToWideChar(vcp->vc_cpfrom, 0,
(char *)ptr, len, tmp, tmp_len);
- /* 2. ucs-2 -> codepage/UTF-8. */
+ // 2. ucs-2 -> codepage/UTF-8.
if (vcp->vc_cpto == 0)
retlen = utf16_to_utf8(tmp, tmp_len, NULL);
else
diff --git a/src/memfile.c b/src/memfile.c
index f3af7ebc8..0d167e6b0 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -46,7 +46,7 @@
# include <sys/statfs.h>
# define STATFS statfs
# define F_BSIZE f_bsize
-# ifdef __MINT__ /* do we still need this? */
+# ifdef __MINT__ // do we still need this?
# define fstatfs(fd, buf, len, nul) mch_fstat((fd), (buf))
# endif
# endif
@@ -57,17 +57,17 @@
*/
#ifdef AMIGA
# ifdef FEAT_ARP
-extern int dos2; /* this is in os_amiga.c */
+extern int dos2; // this is in os_amiga.c
# endif
# ifdef SASC
# include <proto/dos.h>
-# include <ios1.h> /* for chkufb() */
+# include <ios1.h> // for chkufb()
# endif
#endif
-#define MEMFILE_PAGE_SIZE 4096 /* default page size */
+#define MEMFILE_PAGE_SIZE 4096 // default page size
-static long_u total_mem_used = 0; /* total memory used for memfiles */
+static long_u total_mem_used = 0; // total memory used for memfiles
static void mf_ins_hash(memfile_T *, bhdr_T *);
static void mf_rem_hash(memfile_T *, bhdr_T *);
@@ -133,7 +133,7 @@ mf_open(char_u *fname, int flags)
if ((mfp = ALLOC_ONE(memfile_T)) == NULL)
return NULL;
- if (fname == NULL) /* no file for this memfile, use memory only */
+ if (fname == NULL) // no file for this memfile, use memory only
{
mfp->mf_fname = NULL;
mfp->mf_ffname = NULL;
@@ -141,9 +141,9 @@ mf_open(char_u *fname, int flags)
}
else
{
- mf_do_open(mfp, fname, flags); /* try to open the file */
+ mf_do_open(mfp, fname, flags); // try to open the file
- /* if the file cannot be opened, return here */
+ // if the file cannot be opened, return here
if (mfp->mf_fd < 0)
{
vim_free(mfp);
@@ -151,8 +151,8 @@ mf_open(char_u *fname, int flags)
}
}
- mfp->mf_free_first = NULL; /* free list is empty */
- mfp->mf_used_first = NULL; /* used list is empty */
+ mfp->mf_free_first = NULL; // free list is empty
+ mfp->mf_used_first = NULL; // used list is empty
mfp->mf_used_last = NULL;
mfp->mf_dirty = FALSE;
mfp->mf_used_count = 0;
@@ -180,7 +180,7 @@ mf_open(char_u *fname, int flags)
if (mfp->mf_fd < 0 || (flags & (O_TRUNC|O_EXCL))
|| (size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0)
- mfp->mf_blocknr_max = 0; /* no file or empty file */
+ mfp->mf_blocknr_max = 0; // no file or empty file
else
mfp->mf_blocknr_max = (blocknr_T)((size + mfp->mf_page_size - 1)
/ mfp->mf_page_size);
@@ -223,7 +223,7 @@ mf_open(char_u *fname, int flags)
int
mf_open_file(memfile_T *mfp, char_u *fname)
{
- mf_do_open(mfp, fname, O_RDWR|O_CREAT|O_EXCL); /* try to open the file */
+ mf_do_open(mfp, fname, O_RDWR|O_CREAT|O_EXCL); // try to open the file
if (mfp->mf_fd < 0)
return FAIL;
@@ -240,7 +240,7 @@ mf_close(memfile_T *mfp, int del_file)
{
bhdr_T *hp, *nextp;
- if (mfp == NULL) /* safety check */
+ if (mfp == NULL) // safety check
return;
if (mfp->mf_fd >= 0)
{
@@ -249,17 +249,17 @@ mf_close(memfile_T *mfp, int del_file)
}
if (del_file && mfp->mf_fname != NULL)
mch_remove(mfp->mf_fname);
- /* free entries in used list */
+ // free entries in used list
for (hp = mfp->mf_used_first; hp != NULL; hp = nextp)
{
total_mem_used -= hp->bh_page_count * mfp->mf_page_size;
nextp = hp->bh_next;
mf_free_bhdr(hp);
}
- while (mfp->mf_free_first != NULL) /* free entries in free list */
+ while (mfp->mf_free_first != NULL) // free entries in free list
vim_free(mf_rem_free(mfp));
mf_hash_free(&mfp->mf_hash);
- mf_hash_free_all(&mfp->mf_trans); /* free hashtable and its items */
+ mf_hash_free_all(&mfp->mf_trans); // free hashtable and its items
vim_free(mfp->mf_fname);
vim_free(mfp->mf_ffname);
vim_free(mfp);
@@ -271,32 +271,32 @@ mf_close(memfile_T *mfp, int del_file)
void
mf_close_file(
buf_T *buf,
- int getlines) /* get all lines into memory? */
+ int getlines) // get all lines into memory?
{
memfile_T *mfp;
linenr_T lnum;
mfp = buf->b_ml.ml_mfp;
- if (mfp == NULL || mfp->mf_fd < 0) /* nothing to close */
+ if (mfp == NULL || mfp->mf_fd < 0) // nothing to close
return;
if (getlines)
{
- /* get all blocks in memory by accessing all lines (clumsy!) */
+ // get all blocks in memory by accessing all lines (clumsy!)
mf_dont_release = TRUE;
for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
(void)ml_get_buf(buf, lnum, FALSE);
mf_dont_release = FALSE;
- /* TODO: should check if all blocks are really in core */
+ // TODO: should check if all blocks are really in core
}
- if (close(mfp->mf_fd) < 0) /* close the file */
+ if (close(mfp->mf_fd) < 0) // close the file
emsg(_(e_swapclose));
mfp->mf_fd = -1;
if (mfp->mf_fname != NULL)
{
- mch_remove(mfp->mf_fname); /* delete the swap file */
+ mch_remove(mfp->mf_fname); // delete the swap file
VIM_CLEAR(mfp->mf_fname);
VIM_CLEAR(mfp->mf_ffname);
}
@@ -309,8 +309,8 @@ mf_close_file(
void
mf_new_page_size(memfile_T *mfp, unsigned new_size)
{
- /* Correct the memory used for block 0 to the new size, because it will be
- * freed with that size later on. */
+ // Correct the memory used for block 0 to the new size, because it will be
+ // freed with that size later on.
total_mem_used += new_size - mfp->mf_page_size;
mfp->mf_page_size = new_size;
}
@@ -323,8 +323,8 @@ mf_new_page_size(memfile_T *mfp, unsigned new_size)
bhdr_T *
mf_new(memfile_T *mfp, int negative, int page_count)
{
- bhdr_T *hp; /* new bhdr_T */
- bhdr_T *freep; /* first block in free list */
+ bhdr_T *hp; // new bhdr_T
+ bhdr_T *freep; // first block in free list
char_u *p;
/*
@@ -360,21 +360,21 @@ mf_new(memfile_T *mfp, int negative, int page_count)
freep->bh_bnum += page_count;
freep->bh_page_count -= page_count;
}
- else if (hp == NULL) /* need to allocate memory for this block */
+ else if (hp == NULL) // need to allocate memory for this block
{
if ((p = alloc(mfp->mf_page_size * page_count)) == NULL)
return NULL;
hp = mf_rem_free(mfp);
hp->bh_data = p;
}
- else /* use the number, remove entry from free list */
+ else // use the number, remove entry from free list
{
freep = mf_rem_free(mfp);
hp->bh_bnum = freep->bh_bnum;
vim_free(freep);
}
}
- else /* get a new number */
+ else // get a new number
{
if (hp == NULL && (hp = mf_alloc_bhdr(mfp, page_count)) == NULL)
return NULL;
@@ -389,7 +389,7 @@ mf_new(memfile_T *mfp, int negative, int page_count)
mfp->mf_blocknr_max += page_count;
}
}
- hp->bh_flags = BH_LOCKED | BH_DIRTY; /* new block is always dirty */
+ hp->bh_flags = BH_LOCKED | BH_DIRTY; // new block is always dirty
mfp->mf_dirty = TRUE;
hp->bh_page_count = page_count;
mf_ins_used(mfp, hp);
@@ -414,7 +414,7 @@ mf_new(memfile_T *mfp, int negative, int page_count)
mf_get(memfile_T *mfp, blocknr_T nr, int page_count)
{
bhdr_T *hp;
- /* doesn't exist */
+ // doesn't exist
if (nr >= mfp->mf_blocknr_max || nr <= mfp->mf_blocknr_min)
return NULL;
@@ -422,12 +422,12 @@ mf_get(memfile_T *mfp, blocknr_T nr, int page_count)
* see if it is in the cache
*/
hp = mf_find_hash(mfp, nr);
- if (hp == NULL) /* not in the hash list */
+ if (hp == NULL) // not in the hash list
{
- if (nr < 0 || nr >= mfp->mf_infile_count) /* can't be in the file */
+ if (nr < 0 || nr >= mfp->mf_infile_count) // can't be in the file
return NULL;
- /* could check here if the block is in the free list */
+ // could check here if the block is in the free list
/*
* Check if we need to flush an existing block.
@@ -441,7 +441,7 @@ mf_get(memfile_T *mfp, blocknr_T nr, int page_count)
hp->bh_bnum = nr;
hp->bh_flags = 0;
hp->bh_page_count = page_count;
- if (mf_read(mfp, hp) == FAIL) /* cannot read the block! */
+ if (mf_read(mfp, hp) == FAIL) // cannot read the block!
{
mf_free_bhdr(hp);
return NULL;
@@ -449,13 +449,13 @@ mf_get(memfile_T *mfp, blocknr_T nr, int page_count)
}
else
{
- mf_rem_used(mfp, hp); /* remove from list, insert in front below */
+ mf_rem_used(mfp, hp); // remove from list, insert in front below
mf_rem_hash(mfp, hp);
}
hp->bh_flags |= BH_LOCKED;
- mf_ins_used(mfp, hp); /* put in front of used list */
- mf_ins_hash(mfp, hp); /* put in front of hash list */
+ mf_ins_used(mfp, hp); // put in front of used list
+ mf_ins_hash(mfp, hp); // put in front of hash list
return hp;
}
@@ -489,7 +489,7 @@ mf_put(
}
hp->bh_flags = flags;
if (infile)
- mf_trans_add(mfp, hp); /* may translate negative in positive nr */
+ mf_trans_add(mfp, hp); // may translate negative in positive nr
}
/*
@@ -498,20 +498,20 @@ mf_put(
void
mf_free(memfile_T *mfp, bhdr_T *hp)
{
- vim_free(hp->bh_data); /* free the memory */
- mf_rem_hash(mfp, hp); /* get *hp out of the hash list */
- mf_rem_used(mfp, hp); /* get *hp out of the used list */
+ vim_free(hp->bh_data); // free the memory
+ mf_rem_hash(mfp, hp); // get *hp out of the hash list
+ mf_rem_used(mfp, hp); // get *hp out of the used list
if (hp->bh_bnum < 0)
{
- vim_free(hp); /* don't want negative numbers in free list */
+ vim_free(hp); // don't want negative numbers in free list
mfp->mf_neg_count--;
}
else
- mf_ins_free(mfp, hp); /* put *hp in the free list */
+ mf_ins_free(mfp, hp); // put *hp in the free list
}
#if defined(__MORPHOS__) && defined(__libnix__)
-/* function is missing in MorphOS libnix version */
+// function is missing in MorphOS libnix version
extern unsigned long *__stdfiledes;
static unsigned long
@@ -541,14 +541,14 @@ mf_sync(memfile_T *mfp, int flags)
bhdr_T *hp;
int got_int_save = got_int;
- if (mfp->mf_fd < 0) /* there is no file, nothing to do */
+ if (mfp->mf_fd < 0) // there is no file, nothing to do
{
mfp->mf_dirty = FALSE;
return FAIL;
}
- /* Only a CTRL-C while writing will break us here, not one typed
- * previously. */
+ // Only a CTRL-C while writing will break us here, not one typed
+ // previously.
got_int = FALSE;
/*
@@ -568,13 +568,13 @@ mf_sync(memfile_T *mfp, int flags)
continue;
if (mf_write(mfp, hp) == FAIL)
{
- if (status == FAIL) /* double error: quit syncing */
+ if (status == FAIL) // double error: quit syncing
break;
status = FAIL;
}
if (flags & MFS_STOP)
{
- /* Stop when char available now. */
+ // Stop when char available now.
if (ui_char_avail())
break;
}
@@ -605,9 +605,9 @@ mf_sync(memfile_T *mfp, int flags)
}
else
# endif
- /* OpenNT is strictly POSIX (Benzinger) */
- /* Tandem/Himalaya NSK-OSS doesn't have sync() */
- /* No sync() on Stratus VOS */
+ // OpenNT is strictly POSIX (Benzinger)
+ // Tandem/Himalaya NSK-OSS doesn't have sync()
+ // No sync() on Stratus VOS
# if defined(__OPENNT) || defined(__TANDEM) || defined(__VOS__)
fflush(NULL);
# else
@@ -649,8 +649,8 @@ mf_sync(memfile_T *mfp, int flags)
# if defined(_DCC) || defined(__GNUC__) || defined(__MORPHOS__)
{
# if defined(__GNUC__) && !defined(__MORPHOS__) && defined(__libnix__)
- /* Have function (in libnix at least),
- * but ain't got no prototype anywhere. */
+ // Have function (in libnix at least),
+ // but ain't got no prototype anywhere.
extern unsigned long fdtofh(int filedescriptor);
# endif
# if !defined(__libnix__)
@@ -662,12 +662,12 @@ mf_sync(memfile_T *mfp, int flags)
Flush(fh);
# endif
}
-# else /* assume Manx */
+# else // assume Manx
Flush(_devtab[mfp->mf_fd].fd);
# endif
# endif
# endif
-#endif /* AMIGA */
+#endif // AMIGA
}
got_int |= got_int_save;
@@ -727,7 +727,7 @@ mf_ins_used(memfile_T *mfp, bhdr_T *hp)
hp->bh_next = mfp->mf_used_first;
mfp->mf_used_first = hp;
hp->bh_prev = NULL;
- if (hp->bh_next == NULL) /* list was empty, adjust last pointer */
+ if (hp->bh_next == NULL) // list was empty, adjust last pointer
mfp->mf_used_last = hp;
else
hp->bh_next->bh_prev = hp;
@@ -741,11 +741,11 @@ mf_ins_used(memfile_T *mfp, bhdr_T *hp)
static void
mf_rem_used(memfile_T *mfp, bhdr_T *hp)
{
- if (hp->bh_next == NULL) /* last block in used list */
+ if (hp->bh_next == NULL) // last block in used list
mfp->mf_used_last = hp->bh_prev;
else
hp->bh_next->bh_prev = hp->bh_prev;
- if (hp->bh_prev == NULL) /* first block in used list */
+ if (hp->bh_prev == NULL) // first block in used list
mfp->mf_used_first = hp->bh_next;
else
hp->bh_prev->bh_next = hp->bh_next;
@@ -769,7 +769,7 @@ mf_release(memfile_T *mfp, int page_count)
int need_release;
buf_T *buf;
- /* don't release while in mf_close_file() */
+ // don't release while in mf_close_file()
if (mf_dont_release)
return NULL;
@@ -786,7 +786,7 @@ mf_release(memfile_T *mfp, int page_count)
*/
if (mfp->mf_fd < 0 && need_release && p_uc)
{
- /* find for which buffer this memfile is */
+ // find for which buffer this memfile is
FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp == mfp)
break;
@@ -808,7 +808,7 @@ mf_release(memfile_T *mfp, int page_count)
for (hp = mfp->mf_used_last; hp != NULL; hp = hp->bh_prev)
if (!(hp->bh_flags & BH_LOCKED))
break;
- if (hp == NULL) /* not a single one that can be released */
+ if (hp == NULL) // not a single one that can be released
return NULL;
/*
@@ -857,11 +857,11 @@ mf_release_all(void)
mfp = buf->b_ml.ml_mfp;
if (mfp != NULL)
{
- /* If no swap file yet, may open one */
+ // If no swap file yet, may open one
if (mfp->mf_fd < 0 && buf->b_may_swap)
ml_open_file(buf);
- /* only if there is a swapfile */
+ // only if there is a swapfile
if (mfp->mf_fd >= 0)
{
for (hp = mfp->mf_used_last; hp != NULL; )
@@ -873,7 +873,7 @@ mf_release_all(void)
mf_rem_used(mfp, hp);
mf_rem_hash(mfp, hp);
mf_free_bhdr(hp);
- hp = mfp->mf_used_last; /* re-start, list was changed */
+ hp = mfp->mf_used_last; // re-start, list was changed
retval = TRUE;
}
else
@@ -897,7 +897,7 @@ mf_alloc_bhdr(memfile_T *mfp, int page_count)
{
if ((hp->bh_data = alloc(mfp->mf_page_size * page_count)) == NULL)
{
- vim_free(hp); /* not enough memory */
+ vim_free(hp); // not enough memory
return NULL;
}
hp->bh_page_count = page_count;
@@ -951,7 +951,7 @@ mf_read(memfile_T *mfp, bhdr_T *hp)
unsigned page_size;
unsigned size;
- if (mfp->mf_fd < 0) /* there is no file, can't read */
+ if (mfp->mf_fd < 0) // there is no file, can't read
return FAIL;
page_size = mfp->mf_page_size;
@@ -969,8 +969,8 @@ mf_read(memfile_T *mfp, bhdr_T *hp)
}
#ifdef FEAT_CRYPT
- /* Decrypt if 'key' is set and this is a data block. And when changing the
- * key. */
+ // Decrypt if 'key' is set and this is a data block. And when changing the
+ // key.
if (*mfp->mf_buffer->b_p_key != NUL || mfp->mf_old_key != NULL)
ml_decrypt_data(mfp, hp->bh_data, offset, size);
#endif
@@ -986,18 +986,18 @@ mf_read(memfile_T *mfp, bhdr_T *hp)
static int
mf_write(memfile_T *mfp, bhdr_T *hp)
{
- off_T offset; /* offset in the file */
- blocknr_T nr; /* block nr which is being written */
+ off_T offset; // offset in the file
+ blocknr_T nr; // block nr which is being written
bhdr_T *hp2;
- unsigned page_size; /* number of bytes in a page */
- unsigned page_count; /* number of pages written */
- unsigned size; /* number of bytes written */
+ unsigned page_size; // number of bytes in a page
+ unsigned page_count; // number of pages written
+ unsigned size; // number of bytes written
if (mfp->mf_fd < 0 && !mfp->mf_reopen)
// there is no file and there was no file, can't write
return FAIL;
- if (hp->bh_bnum < 0) /* must assign file block number */
+ if (hp->bh_bnum < 0) // must assign file block number
if (mf_trans_add(mfp, hp) == FAIL)
return FAIL;
@@ -1014,16 +1014,16 @@ mf_write(memfile_T *mfp, bhdr_T *hp)
int attempt;
nr = hp->bh_bnum;
- if (nr > mfp->mf_infile_count) /* beyond end of file */
+ if (nr > mfp->mf_infile_count) // beyond end of file
{
nr = mfp->mf_infile_count;
- hp2 = mf_find_hash(mfp, nr); /* NULL caught below */
+ hp2 = mf_find_hash(mfp, nr); // NULL caught below
}
else
hp2 = hp;
offset = (off_T)page_size * nr;
- if (hp2 == NULL) /* freed block, fill with dummy data */
+ if (hp2 == NULL) // freed block, fill with dummy data
page_count = 1;
else
page_count = hp2->bh_page_count;
@@ -1067,12 +1067,12 @@ mf_write(memfile_T *mfp, bhdr_T *hp)
}
did_swapwrite_msg = FALSE;
- if (hp2 != NULL) /* written a non-dummy block */
+ if (hp2 != NULL) // written a non-dummy block
hp2->bh_flags &= ~BH_DIRTY;
- /* appended to the file */
+ // appended to the file
if (nr + (blocknr_T)page_count > mfp->mf_infile_count)
mfp->mf_infile_count = nr + page_count;
- if (nr == hp->bh_bnum) /* written the desired block */
+ if (nr == hp->bh_bnum) // written the desired block
break;
}
return OK;
@@ -1094,7 +1094,7 @@ mf_write_block(
int result = OK;
#ifdef FEAT_CRYPT
- /* Encrypt if 'key' is set and this is a data block. */
+ // Encrypt if 'key' is set and this is a data block.
if (*mfp->mf_buffer->b_p_key != NUL)
{
data = ml_encrypt_data(mfp, data, offset, size);
@@ -1127,7 +1127,7 @@ mf_trans_add(memfile_T *mfp, bhdr_T *hp)
NR_TRANS *np;
int page_count;
- if (hp->bh_bnum >= 0) /* it's already positive */
+ if (hp->bh_bnum >= 0) // it's already positive
return OK;
if ((np = ALLOC_ONE(NR_TRANS)) == NULL)
@@ -1164,14 +1164,14 @@ mf_trans_add(memfile_T *mfp, bhdr_T *hp)
mfp->mf_blocknr_max += page_count;
}
- np->nt_old_bnum = hp->bh_bnum; /* adjust number */
+ np->nt_old_bnum = hp->bh_bnum; // adjust number
np->nt_new_bnum = new_bnum;
- mf_rem_hash(mfp, hp); /* remove from old hash list */
+ mf_rem_hash(mfp, hp); // remove from old hash list
hp->bh_bnum = new_bnum;
- mf_ins_hash(mfp, hp); /* insert in new hash list */
+ mf_ins_hash(mfp, hp); // insert in new hash list
- /* Insert "np" into "mf_trans" hashtable with key "np->nt_old_bnum" */
+ // Insert "np" into "mf_trans" hashtable with key "np->nt_old_bnum"
mf_hash_add_item(&mfp->mf_trans, (mf_hashitem_T *)np);
return OK;
@@ -1190,13 +1190,13 @@ mf_trans_del(memfile_T *mfp, blocknr_T old_nr)
np = (NR_TRANS *)mf_hash_find(&mfp->mf_trans, old_nr);
- if (np == NULL) /* not found */
+ if (np == NULL) // not found
return old_nr;
mfp->mf_neg_count--;
new_bnum = np->nt_new_bnum;
- /* remove entry from the trans list */
+ // remove entry from the trans list
mf_hash_rem_item(&mfp->mf_trans, (mf_hashitem_T *)np);
vim_free(np);
@@ -1248,7 +1248,7 @@ mf_need_trans(memfile_T *mfp)
mf_do_open(
memfile_T *mfp,
char_u *fname,
- int flags) /* flags for open() */
+ int flags) // flags for open()
{
#ifdef HAVE_LSTAT
stat_T sb;
@@ -1288,9 +1288,9 @@ mf_do_open(
*/
flags |= O_EXTRA | O_NOFOLLOW;
#ifdef MSWIN
- /* Prevent handle inheritance that cause problems with Cscope
- * (swap file may not be deleted if cscope connection was open after
- * the file) */
+ // Prevent handle inheritance that cause problems with Cscope
+ // (swap file may not be deleted if cscope connection was open after
+ // the file)
flags |= O_NOINHERIT;
#endif
mfp->mf_flags = flags;
@@ -1315,7 +1315,7 @@ mf_do_open(
#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
mch_copy_sec(fname, mfp->mf_fname);
#endif
- mch_hide(mfp->mf_fname); /* try setting the 'hidden' flag */
+ mch_hide(mfp->mf_fname); // try setting the 'hidden' flag
}
}
@@ -1329,7 +1329,7 @@ mf_do_open(
* exceeds 2 ^ MHT_LOG_LOAD_FACTOR.
*/
#define MHT_LOG_LOAD_FACTOR 6
-#define MHT_GROWTH_FACTOR 2 /* must be a power of two */
+#define MHT_GROWTH_FACTOR 2 // must be a power of two
/*
* Initialize an empty hash table.
@@ -1416,7 +1416,7 @@ mf_hash_add_item(mf_hashtab_T *mht, mf_hashitem_T *mhi)
{
if (mf_hash_grow(mht) == FAIL)
{
- /* stop trying to grow after first failure to allocate memory */
+ // stop trying to grow after first failure to allocate memory
mht->mht_fixed = 1;
}
}
@@ -1439,8 +1439,8 @@ mf_hash_rem_item(mf_hashtab_T *mht, mf_hashitem_T *mhi)
mht->mht_count--;
- /* We could shrink the table here, but it typically takes little memory,
- * so why bother? */
+ // We could shrink the table here, but it typically takes little memory,
+ // so why bother?
}
/*
diff --git a/src/memfile_test.c b/src/memfile_test.c
index 0a20330e6..a35261946 100644
--- a/src/memfile_test.c
+++ b/src/memfile_test.c
@@ -15,11 +15,11 @@
#undef NDEBUG
#include <assert.h>
-/* Must include main.c because it contains much more than just main() */
+// Must include main.c because it contains much more than just main()
#define NO_VIM_MAIN
#include "main.c"
-/* This file has to be included because the tested functions are static */
+// This file has to be included because the tested functions are static
#include "memfile.c"
#define index_to_key(i) ((i) ^ 15167)
@@ -39,21 +39,21 @@ test_mf_hash(void)
mf_hash_init(&ht);
- /* insert some items and check invariants */
+ // insert some items and check invariants
for (i = 0; i < TEST_COUNT; i++)
{
assert(ht.mht_count == i);
- /* check that number of buckets is a power of 2 */
+ // check that number of buckets is a power of 2
num_buckets = ht.mht_mask + 1;
assert(num_buckets > 0 && (num_buckets & (num_buckets - 1)) == 0);
- /* check load factor */
+ // check load factor
assert(ht.mht_count <= (num_buckets << MHT_LOG_LOAD_FACTOR));
if (i < (MHT_INIT_SIZE << MHT_LOG_LOAD_FACTOR))
{
- /* first expansion shouldn't have occurred yet */
+ // first expansion shouldn't have occurred yet
assert(num_buckets == MHT_INIT_SIZE);
assert(ht.mht_buckets == ht.mht_small_buckets);
}
@@ -66,7 +66,7 @@ test_mf_hash(void)
key = index_to_key(i);
assert(mf_hash_find(&ht, key) == NULL);
- /* allocate and add new item */
+ // allocate and add new item
item = LALLOC_CLEAR_ONE(mf_hashitem_T);
assert(item != NULL);
item->mhi_key = key;
@@ -76,13 +76,13 @@ test_mf_hash(void)
if (ht.mht_mask + 1 != num_buckets)
{
- /* hash table was expanded */
+ // hash table was expanded
assert(ht.mht_mask + 1 == num_buckets * MHT_GROWTH_FACTOR);
assert(i + 1 == (num_buckets << MHT_LOG_LOAD_FACTOR));
}
}
- /* check presence of inserted items */
+ // check presence of inserted items
for (i = 0; i < TEST_COUNT; i++)
{
key = index_to_key(i);
@@ -91,7 +91,7 @@ test_mf_hash(void)
assert(item->mhi_key == key);
}
- /* delete some items */
+ // delete some items
for (i = 0; i < TEST_COUNT; i++)
{
if (i % 100 < 70)
@@ -114,7 +114,7 @@ test_mf_hash(void)
}
}
- /* check again */
+ // check again
for (i = 0; i < TEST_COUNT; i++)
{
key = index_to_key(i);
@@ -131,7 +131,7 @@ test_mf_hash(void)
}
}
- /* free hash table and all remaining items */
+ // free hash table and all remaining items
mf_hash_free_all(&ht);
}
diff --git a/src/memline.c b/src/memline.c
index 1c24b59af..860438cfc 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -7,8 +7,8 @@
* See README.txt for an overview of the Vim source code.
*/
-/* for debugging */
-/* #define CHECK(c, s) do { if (c) emsg((s)); } while (0) */
+// for debugging
+// #define CHECK(c, s) do { if (c) emsg((s)); } while (0)
#define CHECK(c, s) do { /**/ } while (0)
/*
@@ -44,32 +44,32 @@
#include "vim.h"
-#ifndef UNIX /* it's in os_unix.h for Unix */
+#ifndef UNIX // it's in os_unix.h for Unix
# include <time.h>
#endif
#if defined(SASC) || defined(__amigaos4__)
-# include <proto/dos.h> /* for Open() and Close() */
+# include <proto/dos.h> // for Open() and Close()
#endif
-typedef struct block0 ZERO_BL; /* contents of the first block */
-typedef struct pointer_block PTR_BL; /* contents of a pointer block */
-typedef struct data_block DATA_BL; /* contents of a data block */
-typedef struct pointer_entry PTR_EN; /* block/line-count pair */
+typedef struct block0 ZERO_BL; // contents of the first block
+typedef struct pointer_block PTR_BL; // contents of a pointer block
+typedef struct data_block DATA_BL; // contents of a data block
+typedef struct pointer_entry PTR_EN; // block/line-count pair
-#define DATA_ID (('d' << 8) + 'a') /* data block id */
-#define PTR_ID (('p' << 8) + 't') /* pointer block id */
-#define BLOCK0_ID0 'b' /* block 0 id 0 */
-#define BLOCK0_ID1 '0' /* block 0 id 1 */
-#define BLOCK0_ID1_C0 'c' /* block 0 id 1 'cm' 0 */
-#define BLOCK0_ID1_C1 'C' /* block 0 id 1 'cm' 1 */
-#define BLOCK0_ID1_C2 'd' /* block 0 id 1 'cm' 2 */
+#define DATA_ID (('d' << 8) + 'a') // data block id
+#define PTR_ID (('p' << 8) + 't') // pointer block id
+#define BLOCK0_ID0 'b' // block 0 id 0
+#define BLOCK0_ID1 '0' // block 0 id 1
+#define BLOCK0_ID1_C0 'c' // block 0 id 1 'cm' 0
+#define BLOCK0_ID1_C1 'C' // block 0 id 1 'cm' 1
+#define BLOCK0_ID1_C2 'd' // block 0 id 1 'cm' 2
#if defined(FEAT_CRYPT)
static int id1_codes[] = {
- BLOCK0_ID1_C0, /* CRYPT_M_ZIP */
- BLOCK0_ID1_C1, /* CRYPT_M_BF */
- BLOCK0_ID1_C2, /* CRYPT_M_BF2 */
+ BLOCK0_ID1_C0, // CRYPT_M_ZIP
+ BLOCK0_ID1_C1, // CRYPT_M_BF
+ BLOCK0_ID1_C2, // CRYPT_M_BF2
};
#endif
@@ -78,10 +78,10 @@ static int id1_codes[] = {
*/
struct pointer_entry
{
- blocknr_T pe_bnum; /* block number */
- linenr_T pe_line_count; /* number of lines in this branch */
- linenr_T pe_old_lnum; /* lnum for this block (for recovery) */
- int pe_page_count; /* number of pages in block pe_bnum */
+ blocknr_T pe_bnum; // block number
+ linenr_T pe_line_count; // number of lines in this branch
+ linenr_T pe_old_lnum; // lnum for this block (for recovery)
+ int pe_page_count; // number of pages in block pe_bnum
};
/*
@@ -89,11 +89,11 @@ struct pointer_entry
*/
struct pointer_block
{
- short_u pb_id; /* ID for pointer block: PTR_ID */
- short_u pb_count; /* number of pointers in this block */
- short_u pb_count_max; /* maximum value for pb_count */
- PTR_EN pb_pointer[1]; /* list of pointers to blocks (actually longer)
- * followed by empty space until end of page */
+ short_u pb_id; // ID for pointer block: PTR_ID
+ short_u pb_count; // number of pointers in this block
+ short_u pb_count_max; // maximum value for pb_count
+ PTR_EN pb_pointer[1]; // list of pointers to blocks (actually longer)
+ // followed by empty space until end of page
};
/*
@@ -105,15 +105,15 @@ struct pointer_block
*/
struct data_block
{
- short_u db_id; /* ID for data block: DATA_ID */
- unsigned db_free; /* free space available */
- unsigned db_txt_start; /* byte where text starts */
- unsigned db_txt_end; /* byte just after data block */
- linenr_T db_line_count; /* number of lines in this block */
- unsigned db_index[1]; /* index for start of line (actually bigger)
- * followed by empty space upto db_txt_start
- * followed by the text in the lines until
- * end of page */
+ short_u db_id; // ID for data block: DATA_ID
+ unsigned db_free; // free space available
+ unsigned db_txt_start; // byte where text starts
+ unsigned db_txt_end; // byte just after data block
+ linenr_T db_line_count; // number of lines in this block
+ unsigned db_index[1]; // index for start of line (actually bigger)
+ // followed by empty space upto db_txt_start
+ // followed by the text in the lines until
+ // end of page
};
/*
@@ -127,12 +127,12 @@ struct data_block
#define DB_MARKED ((unsigned)1 << ((sizeof(unsigned) * 8) - 1))
#define DB_INDEX_MASK (~DB_MARKED)
-#define INDEX_SIZE (sizeof(unsigned)) /* size of one db_index entry */
-#define HEADER_SIZE (sizeof(DATA_BL) - INDEX_SIZE) /* size of data block header */
+#define INDEX_SIZE (sizeof(unsigned)) // size of one db_index entry
+#define HEADER_SIZE (sizeof(DATA_BL) - INDEX_SIZE) // size of data block header
-#define B0_FNAME_SIZE_ORG 900 /* what it was in older versions */
-#define B0_FNAME_SIZE_NOCRYPT 898 /* 2 bytes used for other things */
-#define B0_FNAME_SIZE_CRYPT 890 /* 10 bytes used for other things */
+#define B0_FNAME_SIZE_ORG 900 // what it was in older versions
+#define B0_FNAME_SIZE_NOCRYPT 898 // 2 bytes used for other things
+#define B0_FNAME_SIZE_CRYPT 890 // 10 bytes used for other things
#define B0_UNAME_SIZE 40
#define B0_HNAME_SIZE 40
/*
@@ -159,20 +159,20 @@ struct data_block
*/
struct block0
{
- char_u b0_id[2]; /* id for block 0: BLOCK0_ID0 and BLOCK0_ID1,
- * BLOCK0_ID1_C0, BLOCK0_ID1_C1, etc. */
- char_u b0_version[10]; /* Vim version string */
- char_u b0_page_size[4];/* number of bytes per page */
- char_u b0_mtime[4]; /* last modification time of file */
- char_u b0_ino[4]; /* inode of b0_fname */
- char_u b0_pid[4]; /* process id of creator (or 0) */
- char_u b0_uname[B0_UNAME_SIZE]; /* name of user (uid if no name) */
- char_u b0_hname[B0_HNAME_SIZE]; /* host name (if it has a name) */
- char_u b0_fname[B0_FNAME_SIZE_ORG]; /* name of file being edited */
- long b0_magic_long; /* check for byte order of long */
- int b0_magic_int; /* check for byte order of int */
- short b0_magic_short; /* check for byte order of short */
- char_u b0_magic_char; /* check for last char */
+ char_u b0_id[2]; // id for block 0: BLOCK0_ID0 and BLOCK0_ID1,
+ // BLOCK0_ID1_C0, BLOCK0_ID1_C1, etc.
+ char_u b0_version[10]; // Vim version string
+ char_u b0_page_size[4];// number of bytes per page
+ char_u b0_mtime[4]; // last modification time of file
+ char_u b0_ino[4]; // inode of b0_fname
+ char_u b0_pid[4]; // process id of creator (or 0)
+ char_u b0_uname[B0_UNAME_SIZE]; // name of user (uid if no name)
+ char_u b0_hname[B0_HNAME_SIZE]; // host name (if it has a name)
+ char_u b0_fname[B0_FNAME_SIZE_ORG]; // name of file being edited
+ long b0_magic_long; // check for byte order of long
+ int b0_magic_int; // check for byte order of int
+ short b0_magic_short; // check for byte order of short
+ char_u b0_magic_char; // check for last char
};
/*
@@ -195,20 +195,20 @@ struct block0
*/
#define b0_seed b0_fname[B0_FNAME_SIZE_ORG - 2 - MF_SEED_LEN]
-/* The lowest two bits contain the fileformat. Zero means it's not set
- * (compatible with Vim 6.x), otherwise it's EOL_UNIX + 1, EOL_DOS + 1 or
- * EOL_MAC + 1. */
+// The lowest two bits contain the fileformat. Zero means it's not set
+// (compatible with Vim 6.x), otherwise it's EOL_UNIX + 1, EOL_DOS + 1 or
+// EOL_MAC + 1.
#define B0_FF_MASK 3
-/* Swap file is in directory of edited file. Used to find the file from
- * different mount points. */
+// Swap file is in directory of edited file. Used to find the file from
+// different mount points.
#define B0_SAME_DIR 4
-/* The 'fileencoding' is at the end of b0_fname[], with a NUL in front of it.
- * When empty there is only the NUL. */
+// The 'fileencoding' is at the end of b0_fname[], with a NUL in front of it.
+// When empty there is only the NUL.
#define B0_HAS_FENC 8
-#define STACK_INCR 5 /* nr of entries added to ml_stack at a time */
+#define STACK_INCR 5 // nr of entries added to ml_stack at a time
/*
* The line number where the first mark may be is remembered.
@@ -221,17 +221,17 @@ static linenr_T lowest_marked = 0;
/*
* arguments for ml_find_line()
*/
-#define ML_DELETE 0x11 /* delete line */
-#define ML_INSERT 0x12 /* insert line */
-#define ML_FIND 0x13 /* just find the line */
-#define ML_FLUSH 0x02 /* flush locked block */
-#define ML_SIMPLE(x) (x & 0x10) /* DEL, INS or FIND */
+#define ML_DELETE 0x11 // delete line
+#define ML_INSERT 0x12 // insert line
+#define ML_FIND 0x13 // just find the line
+#define ML_FLUSH 0x02 // flush locked block
+#define ML_SIMPLE(x) (x & 0x10) // DEL, INS or FIND
-/* argument for ml_upd_block0() */
+// argument for ml_upd_block0()
typedef enum {
- UB_FNAME = 0 /* update timestamp and filename */
- , UB_SAME_DIR /* update the B0_SAME_DIR flag */
- , UB_CRYPT /* update crypt key */
+ UB_FNAME = 0 // update timestamp and filename
+ , UB_SAME_DIR // update the B0_SAME_DIR flag
+ , UB_CRYPT // update crypt key
} upd_block0_T;
#ifdef FEAT_CRYPT
@@ -281,11 +281,11 @@ ml_open(buf_T *buf)
/*
* init fields in memline struct
*/
- buf->b_ml.ml_stack_size = 0; /* no stack yet */
- buf->b_ml.ml_stack = NULL; /* no stack yet */
- buf->b_ml.ml_stack_top = 0; /* nothing in the stack */
- buf->b_ml.ml_locked = NULL; /* no cached block */
- buf->b_ml.ml_line_lnum = 0; /* no cached line */
+ buf->b_ml.ml_stack_size = 0; // no stack yet
+ buf->b_ml.ml_stack = NULL; // no stack yet
+ buf->b_ml.ml_stack_top = 0; // nothing in the stack
+ buf->b_ml.ml_locked = NULL; // no cached block
+ buf->b_ml.ml_line_lnum = 0; // no cached line
#ifdef FEAT_BYTEOFF
buf->b_ml.ml_chunksize = NULL;
#endif
@@ -383,7 +383,7 @@ ml_open(buf_T *buf)
pp->pb_pointer[0].pe_bnum = 2;
pp->pb_pointer[0].pe_page_count = 1;
pp->pb_pointer[0].pe_old_lnum = 1;
- pp->pb_pointer[0].pe_line_count = 1; /* line count after insertion */
+ pp->pb_pointer[0].pe_line_count = 1; // line count after insertion
mf_put(mfp, hp, TRUE, FALSE);
/*
@@ -398,10 +398,10 @@ ml_open(buf_T *buf)
}
dp = (DATA_BL *)(hp->bh_data);
- dp->db_index[0] = --dp->db_txt_start; /* at end of block */
+ dp->db_index[0] = --dp->db_txt_start; // at end of block
dp->db_free -= 1 + INDEX_SIZE;
dp->db_line_count = 1;
- *((char_u *)dp + dp->db_txt_start) = NUL; /* empty line */
+ *((char_u *)dp + dp->db_txt_start) = NUL; // empty line
return OK;
@@ -410,7 +410,7 @@ error:
{
if (hp)
mf_put(mfp, hp, FALSE, FALSE);
- mf_close(mfp, TRUE); /* will also free(mfp->mf_fname) */
+ mf_close(mfp, TRUE); // will also free(mfp->mf_fname)
}
buf->b_ml.ml_mfp = NULL;
return FAIL;
@@ -429,7 +429,7 @@ ml_set_mfp_crypt(buf_T *buf)
if (method_nr > CRYPT_M_ZIP)
{
- /* Generate a seed and store it in the memfile. */
+ // Generate a seed and store it in the memfile.
sha2_seed(buf->b_ml.ml_mfp->mf_seed, MF_SEED_LEN, NULL, 0);
}
}
@@ -450,7 +450,7 @@ ml_set_b0_crypt(buf_T *buf, ZERO_BL *b0p)
b0p->b0_id[1] = id1_codes[method_nr];
if (method_nr > CRYPT_M_ZIP)
{
- /* Generate a seed and store it in block 0 and in the memfile. */
+ // Generate a seed and store it in block 0 and in the memfile.
sha2_seed(&b0p->b0_seed, MF_SEED_LEN, NULL, 0);
mch_memmove(buf->b_ml.ml_mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
}
@@ -484,11 +484,11 @@ ml_set_crypt_key(
int old_method;
if (mfp == NULL)
- return; /* no memfile yet, nothing to do */
+ return; // no memfile yet, nothing to do
old_method = crypt_method_nr_from_name(old_cm);
- /* First make sure the swapfile is in a consistent state, using the old
- * key and method. */
+ // First make sure the swapfile is in a consistent state, using the old
+ // key and method.
{
char_u *new_key = buf->b_p_key;
char_u *new_buf_cm = buf->b_p_cm;
@@ -500,14 +500,14 @@ ml_set_crypt_key(
buf->b_p_cm = new_buf_cm;
}
- /* Set the key, method and seed to be used for reading, these must be the
- * old values. */
+ // Set the key, method and seed to be used for reading, these must be the
+ // old values.
mfp->mf_old_key = old_key;
mfp->mf_old_cm = old_method;
if (old_method > 0 && *old_key != NUL)
mch_memmove(mfp->mf_old_seed, mfp->mf_seed, MF_SEED_LEN);
- /* Update block 0 with the crypt flag and may set a new seed. */
+ // Update block 0 with the crypt flag and may set a new seed.
ml_upd_block0(buf, UB_CRYPT);
if (mfp->mf_infile_count > 2)
@@ -518,24 +518,24 @@ ml_set_crypt_key(
* similar to what happens in ml_recover(), but we skip negative block
* numbers.
*/
- ml_flush_line(buf); /* flush buffered line */
- (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); /* flush locked block */
+ ml_flush_line(buf); // flush buffered line
+ (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); // flush locked block
hp = NULL;
- bnum = 1; /* start with block 1 */
- page_count = 1; /* which is 1 page */
- idx = 0; /* start with first index in block 1 */
+ bnum = 1; // start with block 1
+ page_count = 1; // which is 1 page
+ idx = 0; // start with first index in block 1
error = 0;
buf->b_ml.ml_stack_top = 0;
VIM_CLEAR(buf->b_ml.ml_stack);
- buf->b_ml.ml_stack_size = 0; /* no stack yet */
+ buf->b_ml.ml_stack_size = 0; // no stack yet
for ( ; !got_int; line_breakcheck())
{
if (hp != NULL)
- mf_put(mfp, hp, FALSE, FALSE); /* release previous block */
+ mf_put(mfp, hp, FALSE, FALSE); // release previous block
- /* get the block (pointer or data) */
+ // get the block (pointer or data)
if ((hp = mf_get(mfp, (blocknr_T)bnum, page_count)) == NULL)
{
if (bnum == 1)
@@ -545,30 +545,30 @@ ml_set_crypt_key(
else
{
pp = (PTR_BL *)(hp->bh_data);
- if (pp->pb_id == PTR_ID) /* it is a pointer block */
+ if (pp->pb_id == PTR_ID) // it is a pointer block
{
if (pp->pb_count == 0)
{
- /* empty block? */
+ // empty block?
++error;
}
- else if (idx < (int)pp->pb_count) /* go a block deeper */
+ else if (idx < (int)pp->pb_count) // go a block deeper
{
if (pp->pb_pointer[idx].pe_bnum < 0)
{
- /* Skip data block with negative block number.
- * Should not happen, because of the ml_preserve()
- * above. Get same block again for next index. */
+ // Skip data block with negative block number.
+ // Should not happen, because of the ml_preserve()
+ // above. Get same block again for next index.
++idx;
continue;
}
- /* going one block deeper in the tree, new entry in
- * stack */
+ // going one block deeper in the tree, new entry in
+ // stack
if ((top = ml_add_stack(buf)) < 0)
{
++error;
- break; /* out of memory */
+ break; // out of memory
}
ip = &(buf->b_ml.ml_stack[top]);
ip->ip_bnum = bnum;
@@ -580,31 +580,31 @@ ml_set_crypt_key(
continue;
}
}
- else /* not a pointer block */
+ else // not a pointer block
{
dp = (DATA_BL *)(hp->bh_data);
- if (dp->db_id != DATA_ID) /* block id wrong */
+ if (dp->db_id != DATA_ID) // block id wrong
++error;
else
{
- /* It is a data block, need to write it back to disk. */
+ // It is a data block, need to write it back to disk.
mf_put(mfp, hp, TRUE, FALSE);
hp = NULL;
}
}
}
- if (buf->b_ml.ml_stack_top == 0) /* finished */
+ if (buf->b_ml.ml_stack_top == 0) // finished
break;
- /* go one block up in the tree */
+ // go one block up in the tree
ip = &(buf->b_ml.ml_stack[--(buf->b_ml.ml_stack_top)]);
bnum = ip->ip_bnum;
- idx = ip->ip_index + 1; /* go to next index */
+ idx = ip->ip_index + 1; // go to next index
page_count = 1;
}
if (hp != NULL)
- mf_put(mfp, hp, FALSE, FALSE); /* release previous block */
+ mf_put(mfp, hp, FALSE, FALSE); // release previous block
if (error > 0)
emsg(_("E843: Error while updating swap file crypt"));
@@ -630,14 +630,14 @@ ml_setname(buf_T *buf)
#endif
mfp = buf->b_ml.ml_mfp;
- if (mfp->mf_fd < 0) /* there is no swap file yet */
+ if (mfp->mf_fd < 0) // there is no swap file yet
{
/*
* When 'updatecount' is 0 and 'noswapfile' there is no swap file.
* For help files we will make a swap file now.
*/
if (p_uc != 0 && !cmdmod.noswapfile)
- ml_open_file(buf); /* create a swap file */
+ ml_open_file(buf); // create a swap file
return;
}
@@ -647,13 +647,13 @@ ml_setname(buf_T *buf)
dirp = p_dir;
for (;;)
{
- if (*dirp == NUL) /* tried all directories, fail */
+ if (*dirp == NUL) // tried all directories, fail
break;
fname = findswapname(buf, &dirp, mfp->mf_fname);
- /* alloc's fname */
- if (dirp == NULL) /* out of memory */
+ // alloc's fname
+ if (dirp == NULL) // out of memory
break;
- if (fname == NULL) /* no file name found for this dir */
+ if (fname == NULL) // no file name found for this dir
continue;
#if defined(MSWIN)
@@ -667,21 +667,21 @@ ml_setname(buf_T *buf)
if (fname == NULL)
continue;
#endif
- /* if the file name is the same we don't have to do anything */
+ // if the file name is the same we don't have to do anything
if (fnamecmp(fname, mfp->mf_fname) == 0)
{
vim_free(fname);
success = TRUE;
break;
}
- /* need to close the swap file before renaming */
+ // need to close the swap file before renaming
if (mfp->mf_fd >= 0)
{
close(mfp->mf_fd);
mfp->mf_fd = -1;
}
- /* try to rename the swap file */
+ // try to rename the swap file
if (vim_rename(mfp->mf_fname, fname) == 0)
{
success = TRUE;
@@ -689,22 +689,22 @@ ml_setname(buf_T *buf)
mfp->mf_fname = fname;
vim_free(mfp->mf_ffname);
#if defined(MSWIN)
- mfp->mf_ffname = NULL; /* mf_fname is full pathname already */
+ mfp->mf_ffname = NULL; // mf_fname is full pathname already
#else
mf_set_ffname(mfp);
#endif
ml_upd_block0(buf, UB_SAME_DIR);
break;
}
- vim_free(fname); /* this fname didn't work, try another */
+ vim_free(fname); // this fname didn't work, try another
}
- if (mfp->mf_fd == -1) /* need to (re)open the swap file */
+ if (mfp->mf_fd == -1) // need to (re)open the swap file
{
mfp->mf_fd = mch_open((char *)mfp->mf_fname, O_RDWR | O_EXTRA, 0);
if (mfp->mf_fd < 0)
{
- /* could not (re)open the swap file, what can we do???? */
+ // could not (re)open the swap file, what can we do????
emsg(_("E301: Oops, lost the swap file!!!"));
return;
}
@@ -749,15 +749,15 @@ ml_open_file(buf_T *buf)
mfp = buf->b_ml.ml_mfp;
if (mfp == NULL || mfp->mf_fd >= 0 || !buf->b_p_swf || cmdmod.noswapfile)
- return; /* nothing to do */
+ return; // nothing to do
#ifdef FEAT_SPELL
- /* For a spell buffer use a temp file name. */
+ // For a spell buffer use a temp file name.
if (buf->b_spell)
{
fname = vim_tempname('s', FALSE);
if (fname != NULL)
- (void)mf_open_file(mfp, fname); /* consumes fname! */
+ (void)mf_open_file(mfp, fname); // consumes fname!
buf->b_may_swap = FALSE;
return;
}
@@ -771,15 +771,15 @@ ml_open_file(buf_T *buf)
{
if (*dirp == NUL)
break;
- /* There is a small chance that between choosing the swap file name
- * and creating it, another Vim creates the file. In that case the
- * creation will fail and we will use another directory. */
- fname = findswapname(buf, &dirp, NULL); /* allocates fname */
+ // There is a small chance that between choosing the swap file name
+ // and creating it, another Vim creates the file. In that case the
+ // creation will fail and we will use another directory.
+ fname = findswapname(buf, &dirp, NULL); // allocates fname
if (dirp == NULL)
- break; /* out of memory */
+ break; // out of memory
if (fname == NULL)
continue;
- if (mf_open_file(mfp, fname) == OK) /* consumes fname! */
+ if (mf_open_file(mfp, fname) == OK) // consumes fname!
{
#if defined(MSWIN)
/*
@@ -790,16 +790,16 @@ ml_open_file(buf_T *buf)
#endif
ml_upd_block0(buf, UB_SAME_DIR);
- /* Flush block zero, so others can read it */
+ // Flush block zero, so others can read it
if (mf_sync(mfp, MFS_ZERO) == OK)
{
- /* Mark all blocks that should be in the swapfile as dirty.
- * Needed for when the 'swapfile' option was reset, so that
- * the swap file was deleted, and then on again. */
+ // Mark all blocks that should be in the swapfile as dirty.
+ // Needed for when the 'swapfile' option was reset, so that
+ // the swap file was deleted, and then on again.
mf_set_dirty(mfp);
break;
}
- /* Writing block 0 failed: close the file and try another dir */
+ // Writing block 0 failed: close the file and try another dir
mf_close_file(buf, FALSE);
}
}
@@ -813,7 +813,7 @@ ml_open_file(buf_T *buf)
--no_wait_return;
}
- /* don't try to open a swap file again */
+ // don't try to open a swap file again
buf->b_may_swap = FALSE;
}
@@ -839,9 +839,9 @@ check_need_swap(
void
ml_close(buf_T *buf, int del_file)
{
- if (buf->b_ml.ml_mfp == NULL) /* not open */
+ if (buf->b_ml.ml_mfp == NULL) // not open
return;
- mf_close(buf->b_ml.ml_mfp, del_file); /* close the .swp file */
+ mf_close(buf->b_ml.ml_mfp, del_file); // close the .swp file
if (buf->b_ml.ml_line_lnum != 0 && (buf->b_ml.ml_flags & ML_LINE_DIRTY))
vim_free(buf->b_ml.ml_line_ptr);
vim_free(buf->b_ml.ml_stack);
@@ -850,8 +850,8 @@ ml_close(buf_T *buf, int del_file)
#endif
buf->b_ml.ml_mfp = NULL;
- /* Reset the "recovered" flag, give the ATTENTION prompt the next time
- * this buffer is loaded. */
+ // Reset the "recovered" flag, give the ATTENTION prompt the next time
+ // this buffer is loaded.
buf->b_flags &= ~BF_RECOVERED;
}
@@ -870,10 +870,10 @@ ml_close_all(int del_file)
ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0
|| vim_strchr(p_cpo, CPO_PRESERVE) == NULL));
#ifdef FEAT_SPELL
- spell_delete_wordlist(); /* delete the internal wordlist */
+ spell_delete_wordlist(); // delete the internal wordlist
#endif
#ifdef TEMPDIRNAMES
- vim_deltempdir(); /* delete created temp directory */
+ vim_deltempdir(); // delete created temp directory
#endif
}
@@ -888,7 +888,7 @@ ml_close_notmod(void)
FOR_ALL_BUFFERS(buf)
if (!bufIsChanged(buf))
- ml_close(buf, TRUE); /* close all not-modified buffers */
+ ml_close(buf, TRUE); // close all not-modified buffers
}
/*
@@ -934,7 +934,7 @@ ml_upd_block0(buf_T *buf, upd_block0_T what)
if (hp == NULL)
{
#ifdef FEAT_CRYPT
- /* Possibly update the seed in the memfile before there is a block0. */
+ // Possibly update the seed in the memfile before there is a block0.
if (what == UB_CRYPT)
ml_set_mfp_crypt(buf);
#endif
@@ -952,7 +952,7 @@ ml_upd_block0(buf_T *buf, upd_block0_T what)
else if (what == UB_CRYPT)
ml_set_b0_crypt(buf, b0p);
#endif
- else /* what == UB_SAME_DIR */
+ else // what == UB_SAME_DIR
set_b0_dir_flag(b0p, buf);
}
mf_put(mfp, hp, TRUE, FALSE);
@@ -973,9 +973,9 @@ set_b0_fname(ZERO_BL *b0p, buf_T *buf)
else
{
#if defined(MSWIN) || defined(AMIGA)
- /* Systems that cannot translate "~user" back into a path: copy the
- * file name unmodified. Do use slashes instead of backslashes for
- * portability. */
+ // Systems that cannot translate "~user" back into a path: copy the
+ // file name unmodified. Do use slashes instead of backslashes for
+ // portability.
vim_strncpy(b0p->b0_fname, buf->b_ffname, B0_FNAME_SIZE_CRYPT - 1);
# ifdef BACKSLASH_IN_FILENAME
forward_slash(b0p->b0_fname);
@@ -996,7 +996,7 @@ set_b0_fname(ZERO_BL *b0p, buf_T *buf)
if (b0p->b0_fname[0] == '~')
{
flen = STRLEN(b0p->b0_fname);
- /* If there is no user name or it is too long, don't use "~/" */
+ // If there is no user name or it is too long, don't use "~/"
if (get_user_name(uname, B0_UNAME_SIZE) == FAIL
|| (ulen = STRLEN(uname)) + flen > B0_FNAME_SIZE_CRYPT - 1)
vim_strncpy(b0p->b0_fname, buf->b_ffname,
@@ -1030,7 +1030,7 @@ set_b0_fname(ZERO_BL *b0p, buf_T *buf)
}
}
- /* Also add the 'fileencoding' if there is room. */
+ // Also add the 'fileencoding' if there is room.
add_b0_fenc(b0p, curbuf);
}
@@ -1061,9 +1061,9 @@ add_b0_fenc(
int size = B0_FNAME_SIZE_NOCRYPT;
#ifdef FEAT_CRYPT
- /* Without encryption use the same offset as in Vim 7.2 to be compatible.
- * With encryption it's OK to move elsewhere, the swap file is not
- * compatible anyway. */
+ // Without encryption use the same offset as in Vim 7.2 to be compatible.
+ // With encryption it's OK to move elsewhere, the swap file is not
+ // compatible anyway.
if (*buf->b_p_key != NUL)
size = B0_FNAME_SIZE_CRYPT;
#endif
@@ -1134,7 +1134,7 @@ ml_recover(int checkext)
* Otherwise a search is done to find the swap file(s).
*/
fname = curbuf->b_fname;
- if (fname == NULL) /* When there is no file name */
+ if (fname == NULL) // When there is no file name
fname = (char_u *)"";
len = (int)STRLEN(fname);
if (checkext && len >= 4 &&
@@ -1149,24 +1149,24 @@ ml_recover(int checkext)
&& ASCII_ISALPHA(fname[len - 1]))
{
directly = TRUE;
- fname_used = vim_strsave(fname); /* make a copy for mf_open() */
+ fname_used = vim_strsave(fname); // make a copy for mf_open()
}
else
{
directly = FALSE;
- /* count the number of matching swap files */
+ // count the number of matching swap files
len = recover_names(fname, FALSE, 0, NULL);
- if (len == 0) /* no swap files found */
+ if (len == 0) // no swap files found
{
semsg(_("E305: No swap file found for %s"), fname);
goto theend;
}
- if (len == 1) /* one swap file found, use it */
+ if (len == 1) // one swap file found, use it
i = 1;
- else /* several swap files found, choose */
+ else // several swap files found, choose
{
- /* list the names of the swap files */
+ // list the names of the swap files
(void)recover_names(fname, TRUE, 0, NULL);
msg_putchar('\n');
msg_puts(_("Enter number of swap file to use (0 to quit): "));
@@ -1174,13 +1174,13 @@ ml_recover(int checkext)
if (i < 1 || i > len)
goto theend;
}
- /* get the swap file name that will be used */
+ // get the swap file name that will be used
(void)recover_names(fname, FALSE, i, &fname_used);
}
if (fname_used == NULL)
- goto theend; /* out of memory */
+ goto theend; // out of memory
- /* When called from main() still need to initialize storage structure */
+ // When called from main() still need to initialize storage structure
if (called_from_main && ml_open(curbuf) == FAIL)
getout(1);
@@ -1195,11 +1195,11 @@ ml_recover(int checkext)
/*
* init fields in memline struct
*/
- buf->b_ml.ml_stack_size = 0; /* no stack yet */
- buf->b_ml.ml_stack = NULL; /* no stack yet */
- buf->b_ml.ml_stack_top = 0; /* nothing in the stack */
- buf->b_ml.ml_line_lnum = 0; /* no cached line */
- buf->b_ml.ml_locked = NULL; /* no locked block */
+ buf->b_ml.ml_stack_size = 0; // no stack yet
+ buf->b_ml.ml_stack = NULL; // no stack yet
+ buf->b_ml.ml_stack_top = 0; // nothing in the stack
+ buf->b_ml.ml_line_lnum = 0; // no cached line
+ buf->b_ml.ml_locked = NULL; // no locked block
buf->b_ml.ml_flags = 0;
#ifdef FEAT_CRYPT
buf->b_p_key = empty_option;
@@ -1209,8 +1209,8 @@ ml_recover(int checkext)
/*
* open the memfile from the old swap file
*/
- p = vim_strsave(fname_used); /* save "fname_used" for the message:
- mf_open() will consume "fname_used"! */
+ p = vim_strsave(fname_used); // save "fname_used" for the message:
+ // mf_open() will consume "fname_used"!
mfp = mf_open(fname_used, O_RDONLY);
fname_used = p;
if (mfp == NULL || mfp->mf_fd < 0)
@@ -1274,7 +1274,7 @@ ml_recover(int checkext)
msg_puts_attr(_(" cannot be used on this computer.\n"),
attr | MSG_HIST);
msg_puts_attr(_("The file was created on "), attr | MSG_HIST);
- /* avoid going past the end of a corrupted hostname */
+ // avoid going past the end of a corrupted hostname
b0p->b0_fname[0] = NUL;
msg_puts_attr((char *)b0p->b0_hname, attr | MSG_HIST);
msg_puts_attr(_(",\nor the file has been damaged."), attr | MSG_HIST);
@@ -1316,12 +1316,12 @@ ml_recover(int checkext)
goto theend;
}
if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0)
- mfp->mf_blocknr_max = 0; /* no file or empty file */
+ mfp->mf_blocknr_max = 0; // no file or empty file
else
mfp->mf_blocknr_max = (blocknr_T)(size / mfp->mf_page_size);
mfp->mf_infile_count = mfp->mf_blocknr_max;
- /* need to reallocate the memory used to store the data */
+ // need to reallocate the memory used to store the data
p = alloc(mfp->mf_page_size);
if (p == NULL)
goto theend;
@@ -1363,14 +1363,14 @@ ml_recover(int checkext)
emsg(_("E308: Warning: Original file may have been changed"));
out_flush();
- /* Get the 'fileformat' and 'fileencoding' from block zero. */
+ // Get the 'fileformat' and 'fileencoding' from block zero.
b0_ff = (b0p->b0_flags & B0_FF_MASK);
if (b0p->b0_flags & B0_HAS_FENC)
{
int fnsize = B0_FNAME_SIZE_NOCRYPT;
#ifdef FEAT_CRYPT
- /* Use the same size as in add_b0_fenc(). */
+ // Use the same size as in add_b0_fenc().
if (b0p->b0_id[1] != BLOCK0_ID1)
fnsize = B0_FNAME_SIZE_CRYPT;
#endif
@@ -1379,7 +1379,7 @@ ml_recover(int checkext)
b0_fenc = vim_strnsave(p, (int)(b0p->b0_fname + fnsize - p));
}
- mf_put(mfp, hp, FALSE, FALSE); /* release block 0 */
+ mf_put(mfp, hp, FALSE, FALSE); // release block 0
hp = NULL;
/*
@@ -1401,8 +1401,8 @@ ml_recover(int checkext)
#ifdef FEAT_CRYPT
if (b0_cm >= 0)
{
- /* Need to ask the user for the crypt key. If this fails we continue
- * without a key, will probably get garbage text. */
+ // Need to ask the user for the crypt key. If this fails we continue
+ // without a key, will probably get garbage text.
if (*curbuf->b_p_key != NUL)
{
smsg(_("Swap file is encrypted: \"%s\""), fname_used);
@@ -1426,7 +1426,7 @@ ml_recover(int checkext)
}
#endif
- /* Use the 'fileformat' and 'fileencoding' as stored in the swap file. */
+ // Use the 'fileformat' and 'fileencoding' as stored in the swap file.
if (b0_ff != 0)
set_fileformat(b0_ff - 1, OPT_LOCAL);
if (b0_fenc != NULL)
@@ -1436,15 +1436,15 @@ ml_recover(int checkext)
}
unchanged(curbuf, TRUE, TRUE);
- bnum = 1; /* start with block 1 */
- page_count = 1; /* which is 1 page */
- lnum = 0; /* append after line 0 in curbuf */
+ bnum = 1; // start with block 1
+ page_count = 1; // which is 1 page
+ lnum = 0; // append after line 0 in curbuf
line_count = 0;
- idx = 0; /* start with first index in block 1 */
+ idx = 0; // start with first index in block 1
error = 0;
buf->b_ml.ml_stack_top = 0;
buf->b_ml.ml_stack = NULL;
- buf->b_ml.ml_stack_size = 0; /* no stack yet */
+ buf->b_ml.ml_stack_size = 0; // no stack yet
if (curbuf->b_ffname == NULL)
cannot_open = TRUE;
@@ -1455,7 +1455,7 @@ ml_recover(int checkext)
for ( ; !got_int; line_breakcheck())
{
if (hp != NULL)
- mf_put(mfp, hp, FALSE, FALSE); /* release previous block */
+ mf_put(mfp, hp, FALSE, FALSE); // release previous block
/*
* get block
@@ -1471,12 +1471,12 @@ ml_recover(int checkext)
ml_append(lnum++, (char_u *)_("???MANY LINES MISSING"),
(colnr_T)0, TRUE);
}
- else /* there is a block */
+ else // there is a block
{
pp = (PTR_BL *)(hp->bh_data);
- if (pp->pb_id == PTR_ID) /* it is a pointer block */
+ if (pp->pb_id == PTR_ID) // it is a pointer block
{
- /* check line count when using pointer block first time */
+ // check line count when using pointer block first time
if (idx == 0 && line_count != 0)
{
for (i = 0; i < (int)pp->pb_count; ++i)
@@ -1495,7 +1495,7 @@ ml_recover(int checkext)
(colnr_T)0, TRUE);
++error;
}
- else if (idx < (int)pp->pb_count) /* go a block deeper */
+ else if (idx < (int)pp->pb_count) // go a block deeper
{
if (pp->pb_pointer[idx].pe_bnum < 0)
{
@@ -1520,17 +1520,17 @@ ml_recover(int checkext)
ml_append(lnum++, (char_u *)_("???LINES MISSING"),
(colnr_T)0, TRUE);
}
- ++idx; /* get same block again for next index */
+ ++idx; // get same block again for next index
continue;
}
/*
* going one block deeper in the tree
*/
- if ((top = ml_add_stack(buf)) < 0) /* new entry in stack */
+ if ((top = ml_add_stack(buf)) < 0) // new entry in stack
{
++error;
- break; /* out of memory */
+ break; // out of memory
}
ip = &(buf->b_ml.ml_stack[top]);
ip->ip_bnum = bnum;
@@ -1543,10 +1543,10 @@ ml_recover(int checkext)
continue;
}
}
- else /* not a pointer block */
+ else // not a pointer block
{
dp = (DATA_BL *)(hp->bh_data);
- if (dp->db_id != DATA_ID) /* block id wrong */
+ if (dp->db_id != DATA_ID) // block id wrong
{
if (bnum == 1)
{
@@ -1578,7 +1578,7 @@ ml_recover(int checkext)
dp->db_txt_end = page_count * mfp->mf_page_size;
}
- /* make sure there is a NUL at the end of the block */
+ // make sure there is a NUL at the end of the block
*((char_u *)dp + dp->db_txt_end - 1) = NUL;
/*
@@ -1613,7 +1613,7 @@ ml_recover(int checkext)
}
}
- if (buf->b_ml.ml_stack_top == 0) /* finished */
+ if (buf->b_ml.ml_stack_top == 0) // finished
break;
/*
@@ -1621,7 +1621,7 @@ ml_recover(int checkext)
*/
ip = &(buf->b_ml.ml_stack[--(buf->b_ml.ml_stack_top)]);
bnum = ip->ip_bnum;
- idx = ip->ip_index + 1; /* go to next index */
+ idx = ip->ip_index + 1; // go to next index
page_count = 1;
}
@@ -1634,8 +1634,8 @@ ml_recover(int checkext)
*/
if (orig_file_status != OK || curbuf->b_ml.ml_line_count != lnum * 2 + 1)
{
- /* Recovering an empty file results in two lines and the first line is
- * empty. Don't set the modified flag then. */
+ // Recovering an empty file results in two lines and the first line is
+ // empty. Don't set the modified flag then.
if (!(curbuf->b_ml.ml_line_count == 2 && *ml_get(1) == NUL))
{
changed_internal();
@@ -1646,7 +1646,7 @@ ml_recover(int checkext)
{
for (idx = 1; idx <= lnum; ++idx)
{
- /* Need to copy one line, fetching the other one may flush it. */
+ // Need to copy one line, fetching the other one may flush it.
p = vim_strsave(ml_get(idx));
i = STRCMP(p, ml_get(idx + lnum));
vim_free(p);
@@ -1709,7 +1709,7 @@ theend:
{
if (hp != NULL)
mf_put(mfp, hp, FALSE, FALSE);
- mf_close(mfp, FALSE); /* will also vim_free(mfp->mf_fname) */
+ mf_close(mfp, FALSE); // will also vim_free(mfp->mf_fname)
}
if (buf != NULL)
{
@@ -1743,10 +1743,10 @@ theend:
*/
int
recover_names(
- char_u *fname, /* base for swap file name */
- int list, /* when TRUE, list the swap file names */
- int nr, /* when non-zero, return nr'th swap file name */
- char_u **fname_out) /* result when "nr" > 0 */
+ char_u *fname, // base for swap file name
+ int list, // when TRUE, list the swap file names
+ int nr, // when non-zero, return nr'th swap file name
+ char_u **fname_out) // result when "nr" > 0
{
int num_names;
char_u *(names[6]);
@@ -1766,8 +1766,8 @@ recover_names(
if (fname != NULL)
{
#ifdef HAVE_READLINK
- /* Expand symlink in the file name, because the swap file is created
- * with the actual file instead of with the symlink. */
+ // Expand symlink in the file name, because the swap file is created
+ // with the actual file instead of with the symlink.
if (resolve_symlink(fname, fname_buf) == OK)
fname_res = fname_buf;
else
@@ -1777,7 +1777,7 @@ recover_names(
if (list)
{
- /* use msg() to start the scrolling properly */
+ // use msg() to start the scrolling properly
msg(_("Swap files found:"));
msg_putchar('\n');
}
@@ -1797,7 +1797,7 @@ recover_names(
*/
(void)copy_option_part(&dirp, dir_name, 31000, ",");
- if (dir_name[0] == '.' && dir_name[1] == NUL) /* check current dir */
+ if (dir_name[0] == '.' && dir_name[1] == NUL) // check current dir
{
if (fname == NULL)
{
@@ -1807,8 +1807,8 @@ recover_names(
names[0] = vim_strsave((char_u *)"*.sw?");
#endif
#if defined(UNIX) || defined(MSWIN)
- /* For Unix names starting with a dot are special. MS-Windows
- * supports this too, on some file systems. */
+ // For Unix names starting with a dot are special. MS-Windows
+ // supports this too, on some file systems.
names[1] = vim_strsave((char_u *)".*.sw?");
names[2] = vim_strsave((char_u *)".sw?");
num_names = 3;
@@ -1824,7 +1824,7 @@ recover_names(
else
num_names = recov_file_names(names, fname_res, TRUE);
}
- else /* check directory dir_name */
+ else // check directory dir_name
{
if (fname == NULL)
{
@@ -1834,8 +1834,8 @@ recover_names(
names[0] = concat_fnames(dir_name, (char_u *)"*.sw?", TRUE);
#endif
#if defined(UNIX) || defined(MSWIN)
- /* For Unix names starting with a dot are special. MS-Windows
- * supports this too, on some file systems. */
+ // For Unix names starting with a dot are special. MS-Windows
+ // supports this too, on some file systems.
names[1] = concat_fnames(dir_name, (char_u *)".*.sw?", TRUE);
names[2] = concat_fnames(dir_name, (char_u *)".sw?", TRUE);
num_names = 3;
@@ -1856,7 +1856,7 @@ recover_names(
p = dir_name + len;
if (after_pathsep(dir_name, p) && len > 1 && p[-1] == p[-2])
{
- /* Ends with '//', Use Full path for swap name */
+ // Ends with '//', Use Full path for swap name
tail = make_percent_swname(dir_name, fname_res);
}
else
@@ -1953,7 +1953,7 @@ recover_names(
{
*fname_out = vim_strsave(
files[nr - 1 + num_files - file_count]);
- dirp = (char_u *)""; /* stop searching */
+ dirp = (char_u *)""; // stop searching
}
}
else if (list)
@@ -1976,7 +1976,7 @@ recover_names(
{
for (i = 0; i < num_files; ++i)
{
- /* print the swap file name */
+ // print the swap file name
msg_outnum((long)++file_count);
msg_puts(". ");
msg_puts((char *)gettail(files[i]));
@@ -2057,7 +2057,7 @@ get_b0_dict(char_u *fname, dict_T *d)
dict_add_string(d, "error", (char_u *)"Magic number mismatch");
else
{
- /* we have swap information */
+ // we have swap information
dict_add_string_len(d, "version", b0.b0_version, 10);
dict_add_string_len(d, "user", b0.b0_uname, B0_UNAME_SIZE);
dict_add_string_len(d, "host", b0.b0_hname, B0_HNAME_SIZE);
@@ -2138,7 +2138,7 @@ get_ctime(time_t thetime, int add_newline)
struct tm *curtime;
curtime = vim_localtime(&thetime, &tmval);
- /* MSVC returns NULL for an invalid value of seconds. */
+ // MSVC returns NULL for an invalid value of seconds.
if (curtime == NULL)
vim_strncpy((char_u *)buf, (char_u *)_("(Invalid)"), sizeof(buf) - 1);
else
@@ -2373,12 +2373,12 @@ recov_file_names(char_u **names, char_u *path, int prepend_dot)
#endif
if (names[num_names] == NULL)
goto end;
- if (num_names >= 1) /* check if we have the same name twice */
+ if (num_names >= 1) // check if we have the same name twice
{
p = names[num_names - 1];
i = (int)STRLEN(names[num_names - 1]) - (int)STRLEN(names[num_names]);
if (i > 0)
- p += i; /* file name has been expanded to full path */
+ p += i; // file name has been expanded to full path
if (STRCMP(p, names[num_names]) != 0)
++num_names;
@@ -2407,7 +2407,7 @@ recov_file_names(char_u **names, char_u *path, int prepend_dot)
p = names[num_names];
i = STRLEN(names[num_names]) - STRLEN(names[num_names - 1]);
if (i > 0)
- p += i; /* file name has been expanded to full path */
+ p += i; // file name has been expanded to full path
if (STRCMP(names[num_names - 1], p) == 0)
vim_free(names[num_names]);
else
@@ -2438,10 +2438,10 @@ ml_sync_all(int check_file, int check_char)
FOR_ALL_BUFFERS(buf)
{
if (buf->b_ml.ml_mfp == NULL || buf->b_ml.ml_mfp->mf_fname == NULL)
- continue; /* no file */
+ continue; // no file
- ml_flush_line(buf); /* flush buffered line */
- /* flush locked block */
+ ml_flush_line(buf); // flush buffered line
+ // flush locked block
(void)ml_find_line(buf, (linenr_T)0, ML_FLUSH);
if (bufIsChanged(buf) && check_file && mf_need_trans(buf->b_ml.ml_mfp)
&& buf->b_ffname != NULL)
@@ -2456,14 +2456,14 @@ ml_sync_all(int check_file, int check_char)
{
ml_preserve(buf, FALSE);
did_check_timestamps = FALSE;
- need_check_timestamps = TRUE; /* give message later */
+ need_check_timestamps = TRUE; // give message later
}
}
if (buf->b_ml.ml_mfp->mf_dirty)
{
(void)mf_sync(buf->b_ml.ml_mfp, (check_char ? MFS_STOP : 0)
| (bufIsChanged(buf) ? MFS_FLUSH : 0));
- if (check_char && ui_char_avail()) /* character available now */
+ if (check_char && ui_char_avail()) // character available now
break;
}
}
@@ -2495,15 +2495,15 @@ ml_preserve(buf_T *buf, int message)
return;
}
- /* We only want to stop when interrupted here, not when interrupted
- * before. */
+ // We only want to stop when interrupted here, not when interrupted
+ // before.
got_int = FALSE;
- ml_flush_line(buf); /* flush buffered line */
- (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); /* flush locked block */
+ ml_flush_line(buf); // flush buffered line
+ (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); // flush locked block
status = mf_sync(mfp, MFS_ALL | MFS_FLUSH);
- /* stack is invalid after mf_sync(.., MFS_ALL) */
+ // stack is invalid after mf_sync(.., MFS_ALL)
buf->b_ml.ml_stack_top = 0;
/*
@@ -2532,11 +2532,11 @@ ml_preserve(buf_T *buf, int message)
CHECK(buf->b_ml.ml_locked_low != lnum, "low != lnum");
lnum = buf->b_ml.ml_locked_high + 1;
}
- (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); /* flush locked block */
- /* sync the updated pointer blocks */
+ (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); // flush locked block
+ // sync the updated pointer blocks
if (mf_sync(mfp, MFS_ALL | MFS_FLUSH) == FAIL)
status = FAIL;
- buf->b_ml.ml_stack_top = 0; /* stack is invalid now */
+ buf->b_ml.ml_stack_top = 0; // stack is invalid now
}
theend:
got_int |= got_int_save;
@@ -2607,18 +2607,18 @@ ml_get_cursor(void)
ml_get_buf(
buf_T *buf,
linenr_T lnum,
- int will_change) /* line will be changed */
+ int will_change) // line will be changed
{
bhdr_T *hp;
DATA_BL *dp;
static int recursive = 0;
- if (lnum > buf->b_ml.ml_line_count) /* invalid line number */
+ if (lnum > buf->b_ml.ml_line_count) // invalid line number
{
if (recursive == 0)
{
- /* Avoid giving this message for a recursive call, may happen when
- * the GUI redraws part of the text. */
+ // Avoid giving this message for a recursive call, may happen when
+ // the GUI redraws part of the text.
++recursive;
siemsg(_("E315: ml_get: invalid lnum: %ld"), lnum);
--recursive;
@@ -2660,8 +2660,8 @@ errorret:
{
if (recursive == 0)
{
- /* Avoid giving this message for a recursive call, may happen
- * when the GUI redraws part of the text. */
+ // Avoid giving this message for a recursive call, may happen
+ // when the GUI redraws part of the text.
++recursive;
get_trans_bufname(buf);
shorten_dir(NameBuff);
@@ -2825,11 +2825,11 @@ ml_append_int(
buf->b_ml.ml_flags &= ~ML_EMPTY;
- if (lnum == 0) /* got line one instead, correct db_idx */
- db_idx = -1; /* careful, it is negative! */
+ if (lnum == 0) // got line one instead, correct db_idx
+ db_idx = -1; // careful, it is negative!
else
db_idx = lnum - buf->b_ml.ml_locked_low;
- /* get line count before the insertion */
+ // get line count before the insertion
line_count = buf->b_ml.ml_locked_high - buf->b_ml.ml_locked_low;
dp = (DATA_BL *)(hp->bh_data);
@@ -2854,8 +2854,8 @@ ml_append_int(
if ((hp = ml_find_line(buf, lnum + 1, ML_INSERT)) == NULL)
goto theend;
- db_idx = -1; /* careful, it is negative! */
- /* get line count before the insertion */
+ db_idx = -1; // careful, it is negative!
+ // get line count before the insertion
line_count = buf->b_ml.ml_locked_high - buf->b_ml.ml_locked_low;
CHECK(buf->b_ml.ml_locked_low != lnum + 1, "locked_low != lnum + 1");
@@ -2864,7 +2864,7 @@ ml_append_int(
++buf->b_ml.ml_line_count;
- if ((int)dp->db_free >= space_needed) /* enough room in data block */
+ if ((int)dp->db_free >= space_needed) // enough room in data block
{
/*
* Insert the new line in an existing data block, or in the data block
@@ -2878,7 +2878,7 @@ ml_append_int(
* move the text of the lines that follow to the front
* adjust the indexes of the lines that follow
*/
- if (line_count > db_idx + 1) /* if there are following lines */
+ if (line_count > db_idx + 1) // if there are following lines
{
/*
* Offset is the start of the previous line.
@@ -2913,7 +2913,7 @@ ml_append_int(
if (!newfile)
buf->b_ml.ml_flags |= ML_LOCKED_POS;
}
- else /* not enough space in data block */
+ else // not enough space in data block
{
long line_count_left, line_count_right;
int page_count_left, page_count_right;
@@ -2921,8 +2921,8 @@ ml_append_int(
bhdr_T *hp_right;
bhdr_T *hp_new;
int lines_moved;
- int data_moved = 0; /* init to shut up gcc */
- int total_moved = 0; /* init to shut up gcc */
+ int data_moved = 0; // init to shut up gcc
+ int total_moved = 0; // init to shut up gcc
DATA_BL *dp_right, *dp_left;
int stack_idx;
int in_left;
@@ -2948,18 +2948,18 @@ ml_append_int(
* also put in the right block. This method is more efficient when
* inserting a lot of lines at one place.
*/
- if (db_idx < 0) /* left block is new, right block is existing */
+ if (db_idx < 0) // left block is new, right block is existing
{
lines_moved = 0;
in_left = TRUE;
- /* space_needed does not change */
+ // space_needed does not change
}
- else /* left block is existing, right block is new */
+ else // left block is existing, right block is new
{
lines_moved = line_count - db_idx - 1;
if (lines_moved == 0)
- in_left = FALSE; /* put new line in right block */
- /* space_needed does not change */
+ in_left = FALSE; // put new line in right block
+ // space_needed does not change
else
{
data_moved = ((dp->db_index[db_idx]) & DB_INDEX_MASK) -
@@ -2967,12 +2967,12 @@ ml_append_int(
total_moved = data_moved + lines_moved * INDEX_SIZE;
if ((int)dp->db_free + total_moved >= space_needed)
{
- in_left = TRUE; /* put new line in left block */
+ in_left = TRUE; // put new line in left block
space_needed = total_moved;
}
else
{
- in_left = FALSE; /* put new line in right block */
+ in_left = FALSE; // put new line in right block
space_needed += total_moved;
}
}
@@ -2981,19 +2981,19 @@ ml_append_int(
page_count = ((space_needed + HEADER_SIZE) + page_size - 1) / page_size;
if ((hp_new = ml_new_data(mfp, newfile, page_count)) == NULL)
{
- /* correct line counts in pointer blocks */
+ // correct line counts in pointer blocks
--(buf->b_ml.ml_locked_lineadd);
--(buf->b_ml.ml_locked_high);
goto theend;
}
- if (db_idx < 0) /* left block is new */
+ if (db_idx < 0) // left block is new
{
hp_left = hp_new;
hp_right = hp;
line_count_left = 0;
line_count_right = line_count;
}
- else /* right block is new */
+ else // right block is new
{
hp_left = hp;
hp_right = hp_new;
@@ -3063,12 +3063,12 @@ ml_append_int(
++line_count_left;
}
- if (db_idx < 0) /* left block is new */
+ if (db_idx < 0) // left block is new
{
lnum_left = lnum + 1;
lnum_right = 0;
}
- else /* right block is new */
+ else // right block is new
{
lnum_left = 0;
if (in_left)
@@ -3098,7 +3098,7 @@ ml_append_int(
*/
lineadd = buf->b_ml.ml_locked_lineadd;
buf->b_ml.ml_locked_lineadd = 0;
- ml_find_line(buf, (linenr_T)0, ML_FLUSH); /* flush data block */
+ ml_find_line(buf, (linenr_T)0, ML_FLUSH); // flush data block
/*
* update pointer blocks for the new data block
@@ -3110,7 +3110,7 @@ ml_append_int(
pb_idx = ip->ip_index;
if ((hp = mf_get(mfp, ip->ip_bnum, 1)) == NULL)
goto theend;
- pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */
+ pp = (PTR_BL *)(hp->bh_data); // must be pointer block
if (pp->pb_id != PTR_ID)
{
iemsg(_("E317: pointer block id wrong 3"));
@@ -3121,7 +3121,7 @@ ml_append_int(
* TODO: If the pointer block is full and we are adding at the end
* try to insert in front of the next block
*/
- /* block not full, add one entry */
+ // block not full, add one entry
if (pp->pb_count < pp->pb_count_max)
{
if (pb_idx + 1 < (int)pp->pb_count)
@@ -3142,14 +3142,14 @@ ml_append_int(
pp->pb_pointer[pb_idx + 1].pe_old_lnum = lnum_right;
mf_put(mfp, hp, TRUE, FALSE);
- buf->b_ml.ml_stack_top = stack_idx + 1; /* truncate stack */
+ buf->b_ml.ml_stack_top = stack_idx + 1; // truncate stack
if (lineadd)
{
--(buf->b_ml.ml_stack_top);
- /* fix line count for rest of blocks in the stack */
+ // fix line count for rest of blocks in the stack
ml_lineadd(buf, lineadd);
- /* fix stack itself */
+ // fix stack itself
buf->b_ml.ml_stack[buf->b_ml.ml_stack_top].ip_high +=
lineadd;
++(buf->b_ml.ml_stack_top);
@@ -3160,7 +3160,7 @@ ml_append_int(
*/
break;
}
- else /* pointer block full */
+ else // pointer block full
{
/*
* split the pointer block
@@ -3168,10 +3168,10 @@ ml_append_int(
* move some of the pointer into the new block
* prepare for updating the parent block
*/
- for (;;) /* do this twice when splitting block 1 */
+ for (;;) // do this twice when splitting block 1
{
hp_new = ml_new_ptr(mfp);
- if (hp_new == NULL) /* TODO: try to fix tree */
+ if (hp_new == NULL) // TODO: try to fix tree
goto theend;
pp_new = (PTR_BL *)(hp_new->bh_data);
@@ -3190,12 +3190,12 @@ ml_append_int(
pp->pb_pointer[0].pe_line_count = buf->b_ml.ml_line_count;
pp->pb_pointer[0].pe_old_lnum = 1;
pp->pb_pointer[0].pe_page_count = 1;
- mf_put(mfp, hp, TRUE, FALSE); /* release block 1 */
- hp = hp_new; /* new block is to be split */
+ mf_put(mfp, hp, TRUE, FALSE); // release block 1
+ hp = hp_new; // new block is to be split
pp = pp_new;
CHECK(stack_idx != 0, _("stack_idx should be 0"));
ip->ip_index = 0;
- ++stack_idx; /* do block 1 again later */
+ ++stack_idx; // do block 1 again later
}
/*
* move the pointers after the current one to the new block
@@ -3256,12 +3256,12 @@ ml_append_int(
if (stack_idx < 0)
{
iemsg(_("E318: Updated too many blocks?"));
- buf->b_ml.ml_stack_top = 0; /* invalidate stack */
+ buf->b_ml.ml_stack_top = 0; // invalidate stack
}
}
#ifdef FEAT_BYTEOFF
- /* The line was inserted below 'lnum' */
+ // The line was inserted below 'lnum'
ml_updatechunk(buf, lnum + 1, (long)len, ML_CHNK_ADDLINE);
#endif
#ifdef FEAT_NETBEANS_INTG
@@ -3329,12 +3329,12 @@ ml_append_flush(
*/
int
ml_append(
- linenr_T lnum, /* append after this line (can be 0) */
- char_u *line, /* text of the new line */
- colnr_T len, /* length of new line, including NUL, or 0 */
- int newfile) /* flag, see above */
+ linenr_T lnum, // append after this line (can be 0)
+ char_u *line, // text of the new line
+ colnr_T len, // length of new line, including NUL, or 0
+ int newfile) // flag, see above
{
- /* When starting up, we might still need to create the memfile */
+ // When starting up, we might still need to create the memfile
if (curbuf->b_ml.ml_mfp == NULL && open_buffer(FALSE, NULL, 0) == FAIL)
return FAIL;
return ml_append_flush(curbuf, lnum, line, len, newfile);
@@ -3348,10 +3348,10 @@ ml_append(
int
ml_append_buf(
buf_T *buf,
- linenr_T lnum, /* append after this line (can be 0) */
- char_u *line, /* text of the new line */
- colnr_T len, /* length of new line, including NUL, or 0 */
- int newfile) /* flag, see above */
+ linenr_T lnum, // append after this line (can be 0)
+ char_u *line, // text of the new line
+ colnr_T len, // length of new line, including NUL, or 0
+ int newfile) // flag, see above
{
if (buf->b_ml.ml_mfp == NULL)
return FAIL;
@@ -3397,10 +3397,10 @@ ml_replace_len(
char_u *line = line_arg;
colnr_T len = len_arg;
- if (line == NULL) /* just checking... */
+ if (line == NULL) // just checking...
return FAIL;
- /* When starting up, we might still need to create the memfile */
+ // When starting up, we might still need to create the memfile
if (curbuf->b_ml.ml_mfp == NULL && open_buffer(FALSE, NULL, 0) == FAIL)
return FAIL;
@@ -3606,7 +3606,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
DATA_BL *dp;
PTR_BL *pp;
infoptr_T *ip;
- int count; /* number of entries in block */
+ int count; // number of entries in block
int idx;
int stack_idx;
int text_start;
@@ -3625,7 +3625,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
/*
* If the file becomes empty the last line is replaced by an empty line.
*/
- if (buf->b_ml.ml_line_count == 1) /* file becomes empty */
+ if (buf->b_ml.ml_line_count == 1) // file becomes empty
{
if (message
#ifdef FEAT_NETBEANS_INTG
@@ -3634,7 +3634,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
)
set_keep_msg((char_u *)_(no_lines_msg), 0);
- /* FEAT_BYTEOFF already handled in there, don't worry 'bout it below */
+ // FEAT_BYTEOFF already handled in there, don't worry 'bout it below
i = ml_replace((linenr_T)1, (char_u *)"", TRUE);
buf->b_ml.ml_flags |= ML_EMPTY;
@@ -3654,7 +3654,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
return FAIL;
dp = (DATA_BL *)(hp->bh_data);
- /* compute line count before the delete */
+ // compute line count before the delete
count = (long)(buf->b_ml.ml_locked_high)
- (long)(buf->b_ml.ml_locked_low) + 2;
idx = lnum - buf->b_ml.ml_locked_low;
@@ -3662,7 +3662,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
--buf->b_ml.ml_line_count;
line_start = ((dp->db_index[idx]) & DB_INDEX_MASK);
- if (idx == 0) /* first line in block, text at the end */
+ if (idx == 0) // first line in block, text at the end
line_size = dp->db_txt_end - line_start;
else
line_size = ((dp->db_index[idx - 1]) & DB_INDEX_MASK) - line_start;
@@ -3697,18 +3697,18 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
*/
if (count == 1)
{
- mf_free(mfp, hp); /* free the data block */
+ mf_free(mfp, hp); // free the data block
buf->b_ml.ml_locked = NULL;
for (stack_idx = buf->b_ml.ml_stack_top - 1; stack_idx >= 0;
--stack_idx)
{
- buf->b_ml.ml_stack_top = 0; /* stack is invalid when failing */
+ buf->b_ml.ml_stack_top = 0; // stack is invalid when failing
ip = &(buf->b_ml.ml_stack[stack_idx]);
idx = ip->ip_index;
if ((hp = mf_get(mfp, ip->ip_bnum, 1)) == NULL)
goto theend;
- pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */
+ pp = (PTR_BL *)(hp->bh_data); // must be pointer block
if (pp->pb_id != PTR_ID)
{
iemsg(_("E317: pointer block id wrong 4"));
@@ -3716,17 +3716,17 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
goto theend;
}
count = --(pp->pb_count);
- if (count == 0) /* the pointer block becomes empty! */
+ if (count == 0) // the pointer block becomes empty!
mf_free(mfp, hp);
else
{
- if (count != idx) /* move entries after the deleted one */
+ if (count != idx) // move entries after the deleted one
mch_memmove(&pp->pb_pointer[idx], &pp->pb_pointer[idx + 1],
(size_t)(count - idx) * sizeof(PTR_EN));
mf_put(mfp, hp, TRUE, FALSE);
- buf->b_ml.ml_stack_top = stack_idx; /* truncate stack */
- /* fix line count for rest of blocks in the stack */
+ buf->b_ml.ml_stack_top = stack_idx; // truncate stack
+ // fix line count for rest of blocks in the stack
if (buf->b_ml.ml_locked_lineadd != 0)
{
ml_lineadd(buf, buf->b_ml.ml_locked_lineadd);
@@ -3794,10 +3794,10 @@ ml_setmarked(linenr_T lnum)
{
bhdr_T *hp;
DATA_BL *dp;
- /* invalid line number */
+ // invalid line number
if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count
|| curbuf->b_ml.ml_mfp == NULL)
- return; /* give error message? */
+ return; // give error message?
if (lowest_marked == 0 || lowest_marked > lnum)
lowest_marked = lnum;
@@ -3808,7 +3808,7 @@ ml_setmarked(linenr_T lnum)
* This also releases any locked block.
*/
if ((hp = ml_find_line(curbuf, lnum, ML_FIND)) == NULL)
- return; /* give error message? */
+ return; // give error message?
dp = (DATA_BL *)(hp->bh_data);
dp->db_index[lnum - curbuf->b_ml.ml_locked_low] |= DB_MARKED;
@@ -3841,7 +3841,7 @@ ml_firstmarked(void)
* block This also releases any locked block.
*/
if ((hp = ml_find_line(curbuf, lnum, ML_FIND)) == NULL)
- return (linenr_T)0; /* give error message? */
+ return (linenr_T)0; // give error message?
dp = (DATA_BL *)(hp->bh_data);
@@ -3870,7 +3870,7 @@ ml_clearmarked(void)
linenr_T lnum;
int i;
- if (curbuf->b_ml.ml_mfp == NULL) /* nothing to do */
+ if (curbuf->b_ml.ml_mfp == NULL) // nothing to do
return;
/*
@@ -3884,7 +3884,7 @@ ml_clearmarked(void)
* block and releases any locked block.
*/
if ((hp = ml_find_line(curbuf, lnum, ML_FIND)) == NULL)
- return; /* give error message? */
+ return; // give error message?
dp = (DATA_BL *)(hp->bh_data);
@@ -3922,12 +3922,12 @@ ml_flush_line(buf_T *buf)
static int entered = FALSE;
if (buf->b_ml.ml_line_lnum == 0 || buf->b_ml.ml_mfp == NULL)
- return; /* nothing to do */
+ return; // nothing to do
if (buf->b_ml.ml_flags & ML_LINE_DIRTY)
{
- /* This code doesn't work recursively, but Netbeans may call back here
- * when obtaining the cursor position. */
+ // This code doesn't work recursively, but Netbeans may call back here
+ // when obtaining the cursor position.
if (entered)
return;
entered = TRUE;
@@ -3944,42 +3944,42 @@ ml_flush_line(buf_T *buf)
idx = lnum - buf->b_ml.ml_locked_low;
start = ((dp->db_index[idx]) & DB_INDEX_MASK);
old_line = (char_u *)dp + start;
- if (idx == 0) /* line is last in block */
+ if (idx == 0) // line is last in block
old_len = dp->db_txt_end - start;
- else /* text of previous line follows */
+ else // text of previous line follows
old_len = (dp->db_index[idx - 1] & DB_INDEX_MASK) - start;
new_len = buf->b_ml.ml_line_len;
- extra = new_len - old_len; /* negative if lines gets smaller */
+ extra = new_len - old_len; // negative if lines gets smaller
/*
* if new line fits in data block, replace directly
*/
if ((int)dp->db_free >= extra)
{
- /* if the length changes and there are following lines */
+ // if the length changes and there are following lines
count = buf->b_ml.ml_locked_high - buf->b_ml.ml_locked_low + 1;
if (extra != 0 && idx < count - 1)
{
- /* move text of following lines */
+ // move text of following lines
mch_memmove((char *)dp + dp->db_txt_start - extra,
(char *)dp + dp->db_txt_start,
(size_t)(start - dp->db_txt_start));
- /* adjust pointers of this and following lines */
+ // adjust pointers of this and following lines
for (i = idx + 1; i < count; ++i)
dp->db_index[i] -= extra;
}
dp->db_index[idx] -= extra;
- /* adjust free space */
+ // adjust free space
dp->db_free -= extra;
dp->db_txt_start -= extra;
- /* copy new line into the data block */
+ // copy new line into the data block
mch_memmove(old_line - extra, new_line, (size_t)new_len);
buf->b_ml.ml_flags |= (ML_LOCKED_DIRTY | ML_LOCKED_POS);
#ifdef FEAT_BYTEOFF
- /* The else case is already covered by the insert and delete */
+ // The else case is already covered by the insert and delete
ml_updatechunk(buf, lnum, (long)extra, ML_CHNK_UPDLINE);
#endif
}
@@ -3992,7 +3992,7 @@ ml_flush_line(buf_T *buf)
* that has only one line.
* Don't forget to copy the mark!
*/
- /* How about handling errors??? */
+ // How about handling errors???
(void)ml_append_int(buf, lnum, new_line, new_len, FALSE,
(dp->db_index[idx] & DB_MARKED));
(void)ml_delete_int(buf, lnum, FALSE);
@@ -4095,7 +4095,7 @@ ml_find_line(buf_T *buf, linenr_T lnum, int action)
&& buf->b_ml.ml_locked_high >= lnum
&& !mf_dont_release)
{
- /* remember to update pointer blocks and stack later */
+ // remember to update pointer blocks and stack later
if (action == ML_INSERT)
{
++(buf->b_ml.ml_locked_lineadd);
@@ -4121,15 +4121,15 @@ ml_find_line(buf_T *buf, linenr_T lnum, int action)
ml_lineadd(buf, buf->b_ml.ml_locked_lineadd);
}
- if (action == ML_FLUSH) /* nothing else to do */
+ if (action == ML_FLUSH) // nothing else to do
return NULL;
- bnum = 1; /* start at the root of the tree */
+ bnum = 1; // start at the root of the tree
page_count = 1;
low = 1;
high = buf->b_ml.ml_line_count;
- if (action == ML_FIND) /* first try stack entries */
+ if (action == ML_FIND) // first try stack entries
{
for (top = buf->b_ml.ml_stack_top - 1; top >= 0; --top)
{
@@ -4139,15 +4139,15 @@ ml_find_line(buf_T *buf, linenr_T lnum, int action)
bnum = ip->ip_bnum;
low = ip->ip_low;
high = ip->ip_high;
- buf->b_ml.ml_stack_top = top; /* truncate stack at prev entry */
+ buf->b_ml.ml_stack_top = top; // truncate stack at prev entry
break;
}
}
if (top < 0)
- buf->b_ml.ml_stack_top = 0; /* not found, start at the root */
+ buf->b_ml.ml_stack_top = 0; // not found, start at the root
}
- else /* ML_DELETE or ML_INSERT */
- buf->b_ml.ml_stack_top = 0; /* start at the root */
+ else // ML_DELETE or ML_INSERT
+ buf->b_ml.ml_stack_top = 0; // start at the root
/*
* search downwards in the tree until a data block is found
@@ -4166,7 +4166,7 @@ ml_find_line(buf_T *buf, linenr_T lnum, int action)
--high;
dp = (DATA_BL *)(hp->bh_data);
- if (dp->db_id == DATA_ID) /* data block */
+ if (dp->db_id == DATA_ID) // data block
{
buf->b_ml.ml_locked = hp;
buf->b_ml.ml_locked_low = low;
@@ -4176,20 +4176,20 @@ ml_find_line(buf_T *buf, linenr_T lnum, int action)
return hp;
}
- pp = (PTR_BL *)(dp); /* must be pointer block */
+ pp = (PTR_BL *)(dp); // must be pointer block
if (pp->pb_id != PTR_ID)
{
iemsg(_("E317: pointer block id wrong"));
goto error_block;
}
- if ((top = ml_add_stack(buf)) < 0) /* add new entry to stack */
+ if ((top = ml_add_stack(buf)) < 0) // add new entry to stack
goto error_block;
ip = &(buf->b_ml.ml_stack[top]);
ip->ip_bnum = bnum;
ip->ip_low = low;
ip->ip_high = high;
- ip->ip_index = -1; /* index not known yet */
+ ip->ip_index = -1; // index not known yet
dirty = FALSE;
for (idx = 0; idx < (int)pp->pb_count; ++idx)
@@ -4221,7 +4221,7 @@ ml_find_line(buf_T *buf, linenr_T lnum, int action)
break;
}
}
- if (idx >= (int)pp->pb_count) /* past the end: something wrong! */
+ if (idx >= (int)pp->pb_count) // past the end: something wrong!
{
if (lnum > buf->b_ml.ml_line_count)
siemsg(_("E322: line number out of range: %ld past the end"),
@@ -4273,10 +4273,10 @@ ml_add_stack(buf_T *buf)
top = buf->b_ml.ml_stack_top;
- /* may have to increase the stack size */
+ // may have to increase the stack size
if (top == buf->b_ml.ml_stack_size)
{
- CHECK(top > 0, _("Stack size increases")); /* more than 5 levels??? */
+ CHECK(top > 0, _("Stack size increases")); // more than 5 levels???
newstack = ALLOC_MULT(infoptr_T, buf->b_ml.ml_stack_size + STACK_INCR);
if (newstack == NULL)
@@ -4317,7 +4317,7 @@ ml_lineadd(buf_T *buf, int count)
ip = &(buf->b_ml.ml_stack[idx]);
if ((hp = mf_get(mfp, ip->ip_bnum, 1)) == NULL)
break;
- pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */
+ pp = (PTR_BL *)(hp->bh_data); // must be pointer block
if (pp->pb_id != PTR_ID)
{
mf_put(mfp, hp, FALSE, FALSE);
@@ -4348,12 +4348,12 @@ resolve_symlink(char_u *fname, char_u *buf)
if (fname == NULL)
return FAIL;
- /* Put the result so far in tmp[], starting with the original name. */
+ // Put the result so far in tmp[], starting with the original name.
vim_strncpy(tmp, fname, MAXPATHL - 1);
for (;;)
{
- /* Limit symlink depth to 100, catch recursive loops. */
+ // Limit symlink depth to 100, catch recursive loops.
if (++depth == 100)
{
semsg(_("E773: Symlink loop for \"%s\""), fname);
@@ -4365,17 +4365,17 @@ resolve_symlink(char_u *fname, char_u *buf)
{
if (errno == EINVAL || errno == ENOENT)
{
- /* Found non-symlink or not existing file, stop here.
- * When at the first level use the unmodified name, skip the
- * call to vim_FullName(). */
+ // Found non-symlink or not existing file, stop here.
+ // When at the first level use the unmodified name, skip the
+ // call to vim_FullName().
if (depth == 1)
return FAIL;
- /* Use the resolved name in tmp[]. */
+ // Use the resolved name in tmp[].
break;
}
- /* There must be some error reading links, use original name. */
+ // There must be some error reading links, use original name.
return FAIL;
}
buf[ret] = NUL;
@@ -4430,7 +4430,7 @@ makeswapname(
s = dir_name + len;
if (after_pathsep(dir_name, s) && len > 1 && s[-1] == s[-2])
- { /* Ends with '//', Use Full path */
+ { // Ends with '//', Use Full path
r = NULL;
if ((s = make_percent_swname(dir_name, fname)) != NULL)
{
@@ -4442,8 +4442,8 @@ makeswapname(
#endif
#ifdef HAVE_READLINK
- /* Expand symlink in the file name, so that we put the swap file with the
- * actual file instead of with the symlink. */
+ // Expand symlink in the file name, so that we put the swap file with the
+ // actual file instead of with the symlink.
if (resolve_symlink(fname, fname_buf) == OK)
fname_res = fname_buf;
#endif
@@ -4457,9 +4457,9 @@ makeswapname(
#else
".swp",
#endif
- /* Prepend a '.' to the swap file name for the current directory. */
+ // Prepend a '.' to the swap file name for the current directory.
dir_name[0] == '.' && dir_name[1] == NUL);
- if (r == NULL) /* out of memory */
+ if (r == NULL) // out of memory
return NULL;
s = get_file_in_dir(r, dir_name);
@@ -4482,7 +4482,7 @@ makeswapname(
char_u *
get_file_in_dir(
char_u *fname,
- char_u *dname) /* don't use "dirname", it is a global for Alpha */
+ char_u *dname) // don't use "dirname", it is a global for Alpha
{
char_u *t;
char_u *tail;
@@ -4495,7 +4495,7 @@ get_file_in_dir(
retval = vim_strsave(fname);
else if (dname[0] == '.' && vim_ispathsep(dname[1]))
{
- if (tail == fname) /* no path before file name */
+ if (tail == fname) // no path before file name
retval = concat_fnames(dname + 2, tail, TRUE);
else
{
@@ -4503,7 +4503,7 @@ get_file_in_dir(
*tail = NUL;
t = concat_fnames(fname, dname + 2, TRUE);
*tail = save_char;
- if (t == NULL) /* out of memory */
+ if (t == NULL) // out of memory
retval = NULL;
else
{
@@ -4530,8 +4530,8 @@ get_file_in_dir(
*/
static void
attention_message(
- buf_T *buf, /* buffer being edited */
- char_u *fname) /* swap file name */
+ buf_T *buf, // buffer being edited
+ char_u *fname) // swap file name
{
stat_T st;
time_t swap_mtime;
@@ -4556,8 +4556,8 @@ attention_message(
if (swap_mtime != 0 && st.st_mtime > swap_mtime)
msg_puts(_(" NEWER than swap file!\n"));
}
- /* Some of these messages are long to allow translation to
- * other languages. */
+ // Some of these messages are long to allow translation to
+ // other languages.
msg_puts(_("\n(1) Another program may be editing the same file. If this is the case,\n be careful not to end up with two different instances of the same\n file when making changes. Quit, or continue with caution.\n"));
msg_puts(_("(2) An edit session for this file crashed.\n"));
msg_puts(_(" If this is the case, use \":recover\" or \"vim -r "));
@@ -4588,8 +4588,8 @@ do_swapexists(buf_T *buf, char_u *fname)
set_vim_var_string(VV_SWAPNAME, fname, -1);
set_vim_var_string(VV_SWAPCHOICE, NULL, -1);
- /* Trigger SwapExists autocommands with <afile> set to the file being
- * edited. Disallow changing directory here. */
+ // Trigger SwapExists autocommands with <afile> set to the file being
+ // edited. Disallow changing directory here.
++allbuf_lock;
apply_autocmds(EVENT_SWAPEXISTS, buf->b_fname, NULL, FALSE, NULL);
--allbuf_lock;
@@ -4624,8 +4624,8 @@ do_swapexists(buf_T *buf, char_u *fname)
static char_u *
findswapname(
buf_T *buf,
- char_u **dirp, /* pointer to list of directories */
- char_u *old_fname) /* don't give warning for this file name */
+ char_u **dirp, // pointer to list of directories
+ char_u *old_fname) // don't give warning for this file name
{
char_u *fname;
int n;
@@ -4681,16 +4681,16 @@ findswapname(
/*
* we try different names until we find one that does not exist yet
*/
- if (dir_name == NULL) /* out of memory */
+ if (dir_name == NULL) // out of memory
fname = NULL;
else
fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name);
for (;;)
{
- if (fname == NULL) /* must be out of memory */
+ if (fname == NULL) // must be out of memory
break;
- if ((n = (int)STRLEN(fname)) == 0) /* safety check */
+ if ((n = (int)STRLEN(fname)) == 0) // safety check
{
VIM_CLEAR(fname);
break;
@@ -4725,10 +4725,9 @@ findswapname(
if (fname2 != NULL)
{
STRCPY(fname2, fname);
- /* if fname == "xx.xx.swp", fname2 = "xx.xx.swx"
- * if fname == ".xx.swp", fname2 = ".xx.swpx"
- * if fname == "123456789.swp", fname2 = "12345678x.swp"
- */
+ // if fname == "xx.xx.swp", fname2 = "xx.xx.swx"
+ // if fname == ".xx.swp", fname2 = ".xx.swpx"
+ // if fname == "123456789.swp", fname2 = "12345678x.swp"
if (vim_strchr(tail, '.') != NULL)
fname2[n - 1] = 'x';
else if (*gettail(fname) == '.')
@@ -4783,7 +4782,7 @@ findswapname(
vim_free(fname);
fname = makeswapname(buf_fname, buf->b_ffname,
buf, dir_name);
- continue; /* try again with b_shortname set */
+ continue; // try again with b_shortname set
}
}
}
@@ -4792,7 +4791,7 @@ findswapname(
/*
* check if the swapfile already exists
*/
- if (mch_getperm(fname) < 0) /* it does not exist */
+ if (mch_getperm(fname) < 0) // it does not exist
{
#ifdef HAVE_LSTAT
stat_T sb;
@@ -4810,7 +4809,7 @@ findswapname(
* but is being used by another program. This happens if you edit
* a file twice.
*/
- if (fh != (BPTR)NULL) /* can open file, OK */
+ if (fh != (BPTR)NULL) // can open file, OK
{
Close(fh);
mch_remove(fname);
@@ -4832,7 +4831,7 @@ findswapname(
/*
* get here when file already exists
*/
- if (fname[n - 2] == 'w' && fname[n - 1] == 'p') /* first try */
+ if (fname[n - 2] == 'w' && fname[n - 1] == 'p') // first try
{
/*
* on MS-DOS compatible filesystems (e.g. messydos) file.doc.swp
@@ -4842,18 +4841,18 @@ findswapname(
* underscores for this file), and try again. If it doesn't we
* assume that "file.doc.swp" already exists.
*/
- if (!(buf->b_p_sn || buf->b_shortname)) /* not tried yet */
+ if (!(buf->b_p_sn || buf->b_shortname)) // not tried yet
{
fname[n - 1] = 'x';
- r = mch_getperm(fname); /* try "file.swx" */
+ r = mch_getperm(fname); // try "file.swx"
fname[n - 1] = 'p';
- if (r >= 0) /* "file.swx" seems to exist */
+ if (r >= 0) // "file.swx" seems to exist
{
buf->b_shortname = TRUE;
vim_free(fname);
fname = makeswapname(buf_fname, buf->b_ffname,
buf, dir_name);
- continue; /* try again with '.' replaced with '_' */
+ continue; // try again with '.' replaced with '_'
}
}
/*
@@ -4891,9 +4890,9 @@ findswapname(
|| !same_directory(fname, buf->b_ffname))
{
#ifdef CHECK_INODE
- /* Symlinks may point to the same file even
- * when the name differs, need to check the
- * inode too. */
+ // Symlinks may point to the same file even
+ // when the name differs, need to check the
+ // inode too.
expand_env(b0.b0_fname, NameBuff, MAXPATHL);
if (fnamecmp_ino(buf->b_ffname, NameBuff,
char_to_long(b0.b0_ino)))
@@ -4921,8 +4920,8 @@ findswapname(
close(fd);
}
- /* give the ATTENTION message when there is an old swap file
- * for the current file, and the buffer was not recovered. */
+ // give the ATTENTION message when there is an old swap file
+ // for the current file, and the buffer was not recovered.
if (differ == FALSE && !(curbuf->b_flags & BF_RECOVERED)
&& vim_strchr(p_shm, SHM_ATTENTION) == NULL)
{
@@ -4931,10 +4930,10 @@ findswapname(
#ifdef CREATE_DUMMY_FILE
int did_use_dummy = FALSE;
- /* Avoid getting a warning for the file being created
- * outside of Vim, it was created at the start of this
- * function. Delete the file now, because Vim might exit
- * here if the window is closed. */
+ // Avoid getting a warning for the file being created
+ // outside of Vim, it was created at the start of this
+ // function. Delete the file now, because Vim might exit
+ // here if the window is closed.
if (dummyfd != NULL)
{
fclose(dummyfd);
@@ -5020,11 +5019,11 @@ findswapname(
# ifdef HAVE_PROCESS_STILL_RUNNING
if (process_still_running && choice >= 4)
- choice++; /* Skip missing "Delete it" button */
+ choice++; // Skip missing "Delete it" button
# endif
vim_free(name);
- /* pretend screen didn't scroll, need redraw anyway */
+ // pretend screen didn't scroll, need redraw anyway
msg_scrolled = 0;
redraw_all_later(NOT_VALID);
}
@@ -5054,7 +5053,7 @@ findswapname(
break;
}
- /* If the file was deleted this fname can be used. */
+ // If the file was deleted this fname can be used.
if (mch_getperm(fname) < 0)
break;
}
@@ -5062,12 +5061,12 @@ findswapname(
{
msg_puts("\n");
if (msg_silent == 0)
- /* call wait_return() later */
+ // call wait_return() later
need_wait_return = TRUE;
}
#ifdef CREATE_DUMMY_FILE
- /* Going to try another name, need the dummy file again. */
+ // Going to try another name, need the dummy file again.
if (did_use_dummy)
dummyfd = mch_fopen((char *)buf_fname, "w");
#endif
@@ -5081,23 +5080,23 @@ findswapname(
* If that still isn't enough decrement the last but one char: ".svz"
* Can happen when editing many "No Name" buffers.
*/
- if (fname[n - 1] == 'a') /* ".s?a" */
+ if (fname[n - 1] == 'a') // ".s?a"
{
- if (fname[n - 2] == 'a') /* ".saa": tried enough, give up */
+ if (fname[n - 2] == 'a') // ".saa": tried enough, give up
{
emsg(_("E326: Too many swap files found"));
VIM_CLEAR(fname);
break;
}
- --fname[n - 2]; /* ".svz", ".suz", etc. */
+ --fname[n - 2]; // ".svz", ".suz", etc.
fname[n - 1] = 'z' + 1;
}
- --fname[n - 1]; /* ".swo", ".swn", etc. */
+ --fname[n - 1]; // ".swo", ".swn", etc.
}
vim_free(dir_name);
#ifdef CREATE_DUMMY_FILE
- if (dummyfd != NULL) /* file has been created temporarily */
+ if (dummyfd != NULL) // file has been created temporarily
{
fclose(dummyfd);
mch_remove(buf_fname);
@@ -5171,17 +5170,17 @@ b0_magic_wrong(ZERO_BL *b0p)
static int
fnamecmp_ino(
- char_u *fname_c, /* current file name */
- char_u *fname_s, /* file name from swap file */
+ char_u *fname_c, // current file name
+ char_u *fname_s, // file name from swap file
long ino_block0)
{
stat_T st;
- ino_t ino_c = 0; /* ino of current file */
- ino_t ino_s; /* ino of file from swap file */
- char_u buf_c[MAXPATHL]; /* full path of fname_c */
- char_u buf_s[MAXPATHL]; /* full path of fname_s */
- int retval_c; /* flag: buf_c valid */
- int retval_s; /* flag: buf_s valid */
+ ino_t ino_c = 0; // ino of current file
+ ino_t ino_s; // ino of file from swap file
+ char_u buf_c[MAXPATHL]; // full path of fname_c
+ char_u buf_s[MAXPATHL]; // full path of fname_s
+ int retval_c; // flag: buf_c valid
+ int retval_s; // flag: buf_s valid
if (mch_stat((char *)fname_c, &st) == 0)
ino_c = (ino_t)st.st_ino;
@@ -5217,7 +5216,7 @@ fnamecmp_ino(
return STRCMP(fname_c, fname_s) != 0;
return TRUE;
}
-#endif /* CHECK_INODE */
+#endif // CHECK_INODE
/*
* Move a long integer into a four byte character array.
@@ -5315,14 +5314,14 @@ ml_encrypt_data(
text_start = (char_u *)dp + dp->db_txt_start;
text_len = size - dp->db_txt_start;
- /* Copy the header and the text. */
+ // Copy the header and the text.
mch_memmove(new_data, dp, head_end - (char_u *)dp);
- /* Encrypt the text. */
+ // Encrypt the text.
crypt_encode(state, text_start, text_len, new_data + dp->db_txt_start);
crypt_free_state(state);
- /* Clear the gap. */
+ // Clear the gap.
if (head_end < text_start)
vim_memset(new_data + (head_end - data), 0, text_start - head_end);
@@ -5353,12 +5352,12 @@ ml_decrypt_data(
if (head_end > text_start || dp->db_txt_start > size
|| dp->db_txt_end > size)
- return; /* data was messed up */
+ return; // data was messed up
state = ml_crypt_prepare(mfp, offset, TRUE);
if (state != NULL)
{
- /* Decrypt the text in place. */
+ // Decrypt the text in place.
crypt_decode_inplace(state, text_start, text_len);
crypt_free_state(state);
}
@@ -5380,7 +5379,7 @@ ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading)
if (reading && mfp->mf_old_key != NULL)
{
- /* Reading back blocks with the previous key/method/seed. */
+ // Reading back blocks with the previous key/method/seed.
method_nr = mfp->mf_old_cm;
key = mfp->mf_old_key;
seed = mfp->mf_old_seed;
@@ -5396,14 +5395,14 @@ ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading)
if (method_nr == CRYPT_M_ZIP)
{
- /* For PKzip: Append the offset to the key, so that we use a different
- * key for every block. */
+ // For PKzip: Append the offset to the key, so that we use a different
+ // key for every block.
vim_snprintf((char *)salt, sizeof(salt), "%s%ld", key, (long)offset);
return crypt_create(method_nr, salt, NULL, 0, NULL, 0);
}
- /* Using blowfish or better: add salt and seed. We use the byte offset
- * of the block for the salt. */
+ // Using blowfish or better: add salt and seed. We use the byte offset
+ // of the block for the salt.
vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset);
return crypt_create(method_nr, key, salt, (int)STRLEN(salt),
seed, MF_SEED_LEN);
@@ -5414,8 +5413,8 @@ ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading)
#if defined(FEAT_BYTEOFF) || defined(PROTO)
-#define MLCS_MAXL 800 /* max no of lines in chunk */
-#define MLCS_MINL 400 /* should be half of MLCS_MAXL */
+#define MLCS_MAXL 800 // max no of lines in chunk
+#define MLCS_MINL 400 // should be half of MLCS_MAXL
/*
* Keep information for finding byte offset of a line, updtype may be one of:
@@ -5487,7 +5486,7 @@ ml_updatechunk(
else if (curix < buf->b_ml.ml_usedchunks - 1
&& line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines)
{
- /* Adjust cached curix & curline */
+ // Adjust cached curix & curline
curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines;
curix++;
}
@@ -5500,7 +5499,7 @@ ml_updatechunk(
{
curchnk->mlcs_numlines++;
- /* May resize here so we don't have to do it in both cases below */
+ // May resize here so we don't have to do it in both cases below
if (buf->b_ml.ml_usedchunks + 1 >= buf->b_ml.ml_numchunks)
{
chunksize_T *t_chunksize = buf->b_ml.ml_chunksize;
@@ -5511,7 +5510,7 @@ ml_updatechunk(
sizeof(chunksize_T) * buf->b_ml.ml_numchunks);
if (buf->b_ml.ml_chunksize == NULL)
{
- /* Hmmmm, Give up on offset for this buffer */
+ // Hmmmm, Give up on offset for this buffer
vim_free(t_chunksize);
buf->b_ml.ml_usedchunks = -1;
return;
@@ -5520,7 +5519,7 @@ ml_updatechunk(
if (buf->b_ml.ml_chunksize[curix].mlcs_numlines >= MLCS_MAXL)
{
- int count; /* number of entries in block */
+ int count; // number of entries in block
int idx;
int end_idx;
int text_end;
@@ -5530,7 +5529,7 @@ ml_updatechunk(
buf->b_ml.ml_chunksize + curix,
(buf->b_ml.ml_usedchunks - curix) *
sizeof(chunksize_T));
- /* Compute length of first half of lines in the split chunk */
+ // Compute length of first half of lines in the split chunk
size = 0;
linecnt = 0;
while (curline < buf->b_ml.ml_line_count
@@ -5573,7 +5572,7 @@ ml_updatechunk(
else
#endif
{
- if (idx == 0)/* first line in block, text at the end */
+ if (idx == 0)// first line in block, text at the end
text_end = dp->db_txt_end;
else
text_end = ((dp->db_index[idx - 1]) & DB_INDEX_MASK);
@@ -5585,7 +5584,7 @@ ml_updatechunk(
buf->b_ml.ml_chunksize[curix].mlcs_totalsize = size;
buf->b_ml.ml_chunksize[curix + 1].mlcs_totalsize -= size;
buf->b_ml.ml_usedchunks++;
- ml_upd_lastbuf = NULL; /* Force recalc of curix & curline */
+ ml_upd_lastbuf = NULL; // Force recalc of curix & curline
return;
}
else if (buf->b_ml.ml_chunksize[curix].mlcs_numlines >= MLCS_MINL
@@ -5632,7 +5631,7 @@ ml_updatechunk(
else if (updtype == ML_CHNK_DELLINE)
{
curchnk->mlcs_numlines--;
- ml_upd_lastbuf = NULL; /* Force recalc of curix & curline */
+ ml_upd_lastbuf = NULL; // Force recalc of curix & curline
if (curix < (buf->b_ml.ml_usedchunks - 1)
&& (curchnk->mlcs_numlines + curchnk[1].mlcs_numlines)
<= MLCS_MINL)
@@ -5654,7 +5653,7 @@ ml_updatechunk(
return;
}
- /* Collapse chunks */
+ // Collapse chunks
curchnk[-1].mlcs_numlines += curchnk->mlcs_numlines;
curchnk[-1].mlcs_totalsize += curchnk->mlcs_totalsize;
buf->b_ml.ml_usedchunks--;
@@ -5687,7 +5686,7 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
long size;
bhdr_T *hp;
DATA_BL *dp;
- int count; /* number of entries in block */
+ int count; // number of entries in block
int idx;
int start_idx;
int text_end;
@@ -5696,7 +5695,7 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
int ffdos = (get_fileformat(buf) == EOL_DOS);
int extra = 0;
- /* take care of cached line first */
+ // take care of cached line first
ml_flush_line(curbuf);
if (buf->b_ml.ml_usedchunks == -1
@@ -5709,7 +5708,7 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
else
offset = *offp;
if (lnum == 0 && offset <= 0)
- return 1; /* Not a "find offset" and offset 0 _must_ be in line 1 */
+ return 1; // Not a "find offset" and offset 0 _must_ be in line 1
/*
* Find the last chunk before the one containing our line. Last chunk is
* special because it will never qualify
@@ -5739,11 +5738,11 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
count = (long)(buf->b_ml.ml_locked_high) -
(long)(buf->b_ml.ml_locked_low) + 1;
start_idx = idx = curline - buf->b_ml.ml_locked_low;
- if (idx == 0)/* first line in block, text at the end */
+ if (idx == 0)// first line in block, text at the end
text_end = dp->db_txt_end;
else
text_end = ((dp->db_index[idx - 1]) & DB_INDEX_MASK);
- /* Compute index of last line to use in this MEMLINE */
+ // Compute index of last line to use in this MEMLINE
if (lnum != 0)
{
if (curline + (count - idx) >= lnum)
@@ -5794,7 +5793,7 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
- (text_end - ((dp->db_index[idx - 1]) & DB_INDEX_MASK));
curline += idx - start_idx + extra;
if (curline > buf->b_ml.ml_line_count)
- return -1; /* exactly one byte beyond the end */
+ return -1; // exactly one byte beyond the end
return curline;
}
curline = buf->b_ml.ml_locked_high + 1;
@@ -5802,12 +5801,12 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
if (lnum != 0)
{
- /* Count extra CR characters. */
+ // Count extra CR characters.
if (ffdos)
size += lnum - 1;
- /* Don't count the last line break if 'noeol' and ('bin' or
- * 'nofixeol'). */
+ // Don't count the last line break if 'noeol' and ('bin' or
+ // 'nofixeol').
if ((!buf->b_p_fixeol || buf->b_p_bin) && !buf->b_p_eol
&& lnum > buf->b_ml.ml_line_count)
size -= ffdos + 1;
@@ -5825,12 +5824,12 @@ goto_byte(long cnt)
long boff = cnt;
linenr_T lnum;
- ml_flush_line(curbuf); /* cached line may be dirty */
+ ml_flush_line(curbuf); // cached line may be dirty
setpcmark();
if (boff)
--boff;
lnum = ml_find_line_or_offset(curbuf, (linenr_T)0, &boff);
- if (lnum < 1) /* past the end */
+ if (lnum < 1) // past the end
{
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
curwin->w_curswant = MAXCOL;
@@ -5845,7 +5844,7 @@ goto_byte(long cnt)
}
check_cursor();
- /* Make sure the cursor is on the first byte of a multi-byte char. */
+ // Make sure the cursor is on the first byte of a multi-byte char.
if (has_mbyte)
mb_adjust_cursor();
}
diff --git a/src/menu.c b/src/menu.c
index 26327941c..d82f04d8f 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -16,7 +16,7 @@
#if defined(FEAT_MENU) || defined(PROTO)
-#define MENUDEPTH 10 /* maximum depth of menus */
+#define MENUDEPTH 10 // maximum depth of menus
#ifdef FEAT_GUI_MSWIN
static int add_menu_path(char_u *, vimmenu_T *, int *, char_u *, int);
@@ -56,7 +56,7 @@ static void menu_unescape_name(char_u *p);
static char_u *menu_translate_tab_and_shift(char_u *arg_start);
-/* The character for each menu mode */
+// The character for each menu mode
static char *menu_mode_chars[] = {"n", "v", "s", "o", "i", "c", "tl", "t"};
static char_u e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu");
@@ -106,7 +106,7 @@ get_root_menu(char_u *name)
*/
void
ex_menu(
- exarg_T *eap) /* Ex command arguments */
+ exarg_T *eap) // Ex command arguments
{
char_u *menu_path;
int modes;
@@ -126,8 +126,8 @@ ex_menu(
# endif
#endif
int pri_tab[MENUDEPTH + 1];
- int enable = MAYBE; /* TRUE for "menu enable", FALSE for "menu
- * disable */
+ int enable = MAYBE; // TRUE for "menu enable", FALSE for "menu
+ // disable
#ifdef FEAT_TOOLBAR
char_u *icon = NULL;
#endif
@@ -161,7 +161,7 @@ ex_menu(
}
- /* Locate an optional "icon=filename" argument. */
+ // Locate an optional "icon=filename" argument.
if (STRNCMP(arg, "icon=", 5) == 0)
{
arg += 5;
@@ -208,7 +208,7 @@ ex_menu(
i = 0;
while (i < MENUDEPTH)
pri_tab[i++] = 500;
- pri_tab[MENUDEPTH] = -1; /* mark end of the table */
+ pri_tab[MENUDEPTH] = -1; // mark end of the table
/*
* Check for "disable" or "enable" argument.
@@ -301,7 +301,7 @@ ex_menu(
root_menu_ptr = get_root_menu(menu_path);
if (root_menu_ptr == &curwin->w_winbar)
- /* Assume the window toolbar menu will change. */
+ // Assume the window toolbar menu will change.
redraw_later(NOT_VALID);
if (enable != MAYBE)
@@ -311,7 +311,7 @@ ex_menu(
* For the PopUp menu, remove a menu for each mode separately.
* Careful: menu_nable_recurse() changes menu_path.
*/
- if (STRCMP(menu_path, "*") == 0) /* meaning: do all menus */
+ if (STRCMP(menu_path, "*") == 0) // meaning: do all menus
menu_path = (char_u *)"";
if (menu_is_popup(menu_path))
@@ -335,7 +335,7 @@ ex_menu(
/*
* Delete menu(s).
*/
- if (STRCMP(menu_path, "*") == 0) /* meaning: remove all menus */
+ if (STRCMP(menu_path, "*") == 0) // meaning: remove all menus
menu_path = (char_u *)"";
/*
@@ -355,7 +355,7 @@ ex_menu(
}
}
- /* Careful: remove_menu() changes menu_path */
+ // Careful: remove_menu() changes menu_path
remove_menu(root_menu_ptr, menu_path, modes, FALSE);
}
else
@@ -364,13 +364,13 @@ ex_menu(
* Add menu(s).
* Replace special key codes.
*/
- if (STRICMP(map_to, "<nop>") == 0) /* "<Nop>" means nothing */
+ if (STRICMP(map_to, "<nop>") == 0) // "<Nop>" means nothing
{
map_to = (char_u *)"";
map_buf = NULL;
}
else if (modes & MENU_TIP_MODE)
- map_buf = NULL; /* Menu tips are plain text. */
+ map_buf = NULL; // Menu tips are plain text.
else
map_to = replace_termcodes(map_to, &map_buf,
REPTERM_DO_LT | (special ? REPTERM_SPECIAL : 0), NULL);
@@ -397,7 +397,7 @@ ex_menu(
p = popup_mode_name(menu_path, i);
if (p != NULL)
{
- /* Include all modes, to make ":amenu" work */
+ // Include all modes, to make ":amenu" work
menuarg.modes = modes;
#ifdef FEAT_TOOLBAR
menuarg.iconfile = NULL;
@@ -418,7 +418,7 @@ ex_menu(
}
#if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK))
- /* If the menubar height changed, resize the window */
+ // If the menubar height changed, resize the window
if (gui.in_use
&& (gui.menu_height != old_menu_height
# if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)
@@ -451,12 +451,12 @@ theend:
static int
add_menu_path(
char_u *menu_path,
- vimmenu_T *menuarg, /* passes modes, iconfile, iconidx,
- icon_builtin, silent[0], noremap[0] */
+ vimmenu_T *menuarg, // passes modes, iconfile, iconidx,
+ // icon_builtin, silent[0], noremap[0]
int *pri_tab,
char_u *call_data
#ifdef FEAT_GUI_MSWIN
- , int addtearoff /* may add tearoff item */
+ , int addtearoff // may add tearoff item
#endif
)
{
@@ -486,7 +486,7 @@ add_menu_path(
#endif
vimmenu_T **root_menu_ptr;
- /* Make a copy so we can stuff around with it, since it could be const */
+ // Make a copy so we can stuff around with it, since it could be const
path_name = vim_strsave(menu_path);
if (path_name == NULL)
return FAIL;
@@ -496,8 +496,8 @@ add_menu_path(
name = path_name;
while (*name)
{
- /* Get name of this element in the menu hierarchy, and the simplified
- * name (without mnemonic and accelerator text). */
+ // Get name of this element in the menu hierarchy, and the simplified
+ // name (without mnemonic and accelerator text).
next_name = menu_name_skip(name);
#ifdef FEAT_MULTI_LANG
map_to = menutrans_lookup(name, (int)STRLEN(name));
@@ -514,12 +514,12 @@ add_menu_path(
goto erret;
if (*dname == NUL)
{
- /* Only a mnemonic or accelerator is not valid. */
+ // Only a mnemonic or accelerator is not valid.
emsg(_("E792: Empty menu name"));
goto erret;
}
- /* See if it's already there */
+ // See if it's already there
lower_pri = menup;
#ifdef FEAT_GUI
idx = 0;
@@ -550,8 +550,8 @@ add_menu_path(
}
menup = &menu->next;
- /* Count menus, to find where this one needs to be inserted.
- * Ignore menus that are not in the menubar (PopUp and Toolbar) */
+ // Count menus, to find where this one needs to be inserted.
+ // Ignore menus that are not in the menubar (PopUp and Toolbar)
if (parent != NULL || menu_is_menubar(menu->name))
{
#ifdef FEAT_GUI
@@ -582,7 +582,7 @@ add_menu_path(
goto erret;
}
- /* Not already there, so lets add it */
+ // Not already there, so lets add it
menu = ALLOC_CLEAR_ONE(vimmenu_T);
if (menu == NULL)
goto erret;
@@ -590,7 +590,7 @@ add_menu_path(
menu->modes = modes;
menu->enabled = MENU_ALL_MODES;
menu->name = vim_strsave(name);
- /* separate mnemonic and accelerator text from actual menu name */
+ // separate mnemonic and accelerator text from actual menu name
menu->dname = menu_text(name, &menu->mnemonic, &menu->actext);
#ifdef FEAT_MULTI_LANG
if (en_name != NULL)
@@ -607,13 +607,13 @@ add_menu_path(
menu->priority = pri_tab[pri_idx];
menu->parent = parent;
#ifdef FEAT_GUI_MOTIF
- menu->sensitive = TRUE; /* the default */
+ menu->sensitive = TRUE; // the default
#endif
#ifdef FEAT_BEVAL_TIP
menu->tip = NULL;
#endif
#ifdef FEAT_GUI_ATHENA
- menu->image = None; /* X-Windows definition for NULL*/
+ menu->image = None; // X-Windows definition for NULL
#endif
/*
@@ -631,7 +631,7 @@ add_menu_path(
menu->iconfile = vim_strsave(menuarg->iconfile);
#endif
#if defined(FEAT_GUI_MSWIN) && defined(FEAT_TEAROFF)
- /* the tearoff item must be present in the modes of each item. */
+ // the tearoff item must be present in the modes of each item.
if (parent != NULL && menu_is_tearoff(parent->children->dname))
parent->children->modes |= modes;
#endif
@@ -646,7 +646,7 @@ add_menu_path(
* Also enable a menu when it's created or changed.
*/
#ifdef FEAT_GUI_MSWIN
- /* If adding a tearbar (addtearoff == FALSE) don't update modes */
+ // If adding a tearbar (addtearoff == FALSE) don't update modes
if (addtearoff)
#endif
{
@@ -663,25 +663,25 @@ add_menu_path(
if ((old_modes & MENU_ALL_MODES) == 0
&& (menu->modes & MENU_ALL_MODES) != 0)
{
- if (gui.in_use) /* Otherwise it will be added when GUI starts */
+ if (gui.in_use) // Otherwise it will be added when GUI starts
{
if (*next_name == NUL)
{
- /* Real menu item, not sub-menu */
+ // Real menu item, not sub-menu
gui_mch_add_menu_item(menu, new_idx);
- /* Want to update menus now even if mode not changed */
+ // Want to update menus now even if mode not changed
force_menu_update = TRUE;
}
else
{
- /* Sub-menu (not at end of path yet) */
+ // Sub-menu (not at end of path yet)
gui_mch_add_menu(menu, new_idx);
}
}
# if defined(FEAT_GUI_MSWIN) & defined(FEAT_TEAROFF)
- /* When adding a new submenu, may add a tearoff item */
+ // When adding a new submenu, may add a tearoff item
if ( addtearoff
&& *next_name
&& vim_strchr(p_go, GO_TEAROFF) != NULL
@@ -721,7 +721,7 @@ add_menu_path(
}
# endif
}
-#endif /* FEAT_GUI */
+#endif // FEAT_GUI
menup = &menu->children;
parent = menu;
@@ -748,17 +748,17 @@ add_menu_path(
#endif
p = (call_data == NULL) ? NULL : vim_strsave(call_data);
- /* loop over all modes, may add more than one */
+ // loop over all modes, may add more than one
for (i = 0; i < MENU_MODES; ++i)
{
if (modes & (1 << i))
{
- /* free any old menu */
+ // free any old menu
free_menu_string(menu, i);
- /* For "amenu", may insert an extra character.
- * Don't do this if adding a tearbar (addtearoff == FALSE).
- * Don't do this for "<Nop>". */
+ // For "amenu", may insert an extra character.
+ // Don't do this if adding a tearbar (addtearoff == FALSE).
+ // Don't do this for "<Nop>".
c = 0;
d = 0;
if (amenu && call_data != NULL && *call_data != NUL
@@ -799,7 +799,7 @@ add_menu_path(
{
int len = (int)STRLEN(menu->strings[i]);
- /* Append CTRL-\ CTRL-G to obey 'insertmode'. */
+ // Append CTRL-\ CTRL-G to obey 'insertmode'.
menu->strings[i][len] = Ctrl_BSL;
menu->strings[i][len + 1] = Ctrl_G;
menu->strings[i][len + 2] = NUL;
@@ -814,7 +814,7 @@ add_menu_path(
}
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) \
&& (defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_GTK))
- /* Need to update the menu tip. */
+ // Need to update the menu tip.
if (modes & MENU_TIP_MODE)
gui_mch_menu_set_tip(menu);
#endif
@@ -825,8 +825,8 @@ erret:
vim_free(path_name);
vim_free(dname);
- /* Delete any empty submenu we added before discovering the error. Repeat
- * for higher levels. */
+ // Delete any empty submenu we added before discovering the error. Repeat
+ // for higher levels.
while (parent != NULL && parent->children == NULL)
{
if (parent->parent == NULL)
@@ -835,7 +835,7 @@ erret:
menup = &parent->parent->children;
for ( ; *menup != NULL && *menup != parent; menup = &((*menup)->next))
;
- if (*menup == NULL) /* safety check */
+ if (*menup == NULL) // safety check
break;
parent = parent->parent;
free_menu(menup);
@@ -857,12 +857,12 @@ menu_nable_recurse(
char_u *p;
if (menu == NULL)
- return OK; /* Got to bottom of hierarchy */
+ return OK; // Got to bottom of hierarchy
- /* Get name of this element in the menu hierarchy */
+ // Get name of this element in the menu hierarchy
p = menu_name_skip(name);
- /* Find the menu */
+ // Find the menu
while (menu != NULL)
{
if (*name == NUL || *name == '*' || menu_name_equal(name, menu))
@@ -901,7 +901,7 @@ menu_nable_recurse(
}
#ifdef FEAT_GUI
- /* Want to update menus now even if mode not changed */
+ // Want to update menus now even if mode not changed
force_menu_update = TRUE;
#endif
@@ -917,19 +917,19 @@ remove_menu(
vimmenu_T **menup,
char_u *name,
int modes,
- int silent) /* don't give error messages */
+ int silent) // don't give error messages
{
vimmenu_T *menu;
vimmenu_T *child;
char_u *p;
if (*menup == NULL)
- return OK; /* Got to bottom of hierarchy */
+ return OK; // Got to bottom of hierarchy
- /* Get name of this element in the menu hierarchy */
+ // Get name of this element in the menu hierarchy
p = menu_name_skip(name);
- /* Find the menu */
+ // Find the menu
while ((menu = *menup) != NULL)
{
if (*name == NUL || menu_name_equal(name, menu))
@@ -971,8 +971,8 @@ remove_menu(
if (*name != NUL)
break;
- /* Remove the menu item for the given mode[s]. If the menu item
- * is no longer valid in ANY mode, delete it */
+ // Remove the menu item for the given mode[s]. If the menu item
+ // is no longer valid in ANY mode, delete it
menu->modes &= ~modes;
if (modes & MENU_TIP_MODE)
free_menu_string(menu, MENU_INDEX_TIP);
@@ -994,11 +994,11 @@ remove_menu(
}
- /* Recalculate modes for menu based on the new updated children */
+ // Recalculate modes for menu based on the new updated children
menu->modes &= ~modes;
#if defined(FEAT_GUI_MSWIN) & defined(FEAT_TEAROFF)
- if ((s_tearoffs) && (menu->children != NULL)) /* there's a tear bar.. */
- child = menu->children->next; /* don't count tearoff bar */
+ if ((s_tearoffs) && (menu->children != NULL)) // there's a tear bar..
+ child = menu->children->next; // don't count tearoff bar
else
#endif
child = menu->children;
@@ -1009,16 +1009,16 @@ remove_menu(
free_menu_string(menu, MENU_INDEX_TIP);
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) \
&& (defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_GTK))
- /* Need to update the menu tip. */
+ // Need to update the menu tip.
if (gui.in_use)
gui_mch_menu_set_tip(menu);
#endif
}
if ((menu->modes & MENU_ALL_MODES) == 0)
{
- /* The menu item is no longer valid in ANY mode, so delete it */
+ // The menu item is no longer valid in ANY mode, so delete it
#if defined(FEAT_GUI_MSWIN) & defined(FEAT_TEAROFF)
- if (s_tearoffs && menu->children != NULL) /* there's a tear bar.. */
+ if (s_tearoffs && menu->children != NULL) // there's a tear bar..
free_menu(&menu->children);
#endif
*menup = menu;
@@ -1051,14 +1051,14 @@ free_menu(vimmenu_T **menup)
menu = *menup;
#ifdef FEAT_GUI
- /* Free machine specific menu structures (only when already created) */
- /* Also may rebuild a tearoff'ed menu */
+ // Free machine specific menu structures (only when already created)
+ // Also may rebuild a tearoff'ed menu
if (gui.in_use)
gui_mch_destroy_menu(menu);
#endif
- /* Don't change *menup until after calling gui_mch_destroy_menu(). The
- * MacOS code needs the original structure to properly delete the menu. */
+ // Don't change *menup until after calling gui_mch_destroy_menu(). The
+ // MacOS code needs the original structure to properly delete the menu.
*menup = menu->next;
vim_free(menu->name);
vim_free(menu->dname);
@@ -1078,7 +1078,7 @@ free_menu(vimmenu_T **menup)
vim_free(menu);
#ifdef FEAT_GUI
- /* Want to update menus now even if mode not changed */
+ // Want to update menus now even if mode not changed
force_menu_update = TRUE;
#endif
}
@@ -1116,7 +1116,7 @@ show_menus(char_u *path_name, int modes)
return FAIL;
menu = *get_root_menu(path_name);
- /* First, find the (sub)menu with the given name */
+ // First, find the (sub)menu with the given name
while (*name)
{
p = menu_name_skip(name);
@@ -1124,7 +1124,7 @@ show_menus(char_u *path_name, int modes)
{
if (menu_name_equal(name, menu))
{
- /* Found menu */
+ // Found menu
if (*p != NUL && menu->children == NULL)
{
emsg(_(e_notsubmenu));
@@ -1153,8 +1153,8 @@ show_menus(char_u *path_name, int modes)
}
vim_free(path_name);
- /* Now we have found the matching menu, and we list the mappings */
- /* Highlight title */
+ // Now we have found the matching menu, and we list the mappings
+ // Highlight title
msg_puts_title(_("\n--- Menus ---"));
show_menus_recursive(parent, modes, 0);
@@ -1176,7 +1176,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth)
if (menu != NULL)
{
msg_putchar('\n');
- if (got_int) /* "q" hit for "--more--" */
+ if (got_int) // "q" hit for "--more--"
return;
for (i = 0; i < depth; i++)
msg_puts(" ");
@@ -1185,7 +1185,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth)
msg_outnum((long)menu->priority);
msg_puts(" ");
}
- /* Same highlighting as for directories!? */
+ // Same highlighting as for directories!?
msg_outtrans_attr(menu->name, HL_ATTR(HLF_D));
}
@@ -1195,7 +1195,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth)
if ((menu->modes & modes & (1 << bit)) != 0)
{
msg_putchar('\n');
- if (got_int) /* "q" hit for "--more--" */
+ if (got_int) // "q" hit for "--more--"
return;
for (i = 0; i < depth + 2; i++)
msg_puts(" ");
@@ -1231,7 +1231,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth)
else
menu = menu->children;
- /* recursively show all children. Skip PopUp[nvoci]. */
+ // recursively show all children. Skip PopUp[nvoci].
for (; menu != NULL && !got_int; menu = menu->next)
if (!menu_is_hidden(menu->dname))
show_menus_recursive(menu, modes, depth + 1);
@@ -1244,7 +1244,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth)
static vimmenu_T *expand_menu = NULL;
static vimmenu_T *expand_menu_alt = NULL;
static int expand_modes = 0x0;
-static int expand_emenu; /* TRUE for ":emenu" command */
+static int expand_emenu; // TRUE for ":emenu" command
/*
* Work out what to complete when doing command line completion of menu names.
@@ -1267,7 +1267,7 @@ set_context_in_menu_cmd(
xp->xp_context = EXPAND_UNSUCCESSFUL;
- /* Check for priority numbers, enable and disable */
+ // Check for priority numbers, enable and disable
for (p = arg; *p; ++p)
if (!VIM_ISDIGIT(*p) && *p != '.')
break;
@@ -1297,12 +1297,12 @@ set_context_in_menu_cmd(
after_dot = p + 1;
}
- /* ":tearoff" and ":popup" only use menus, not entries */
+ // ":tearoff" and ":popup" only use menus, not entries
expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p');
expand_emenu = (*cmd == 'e');
if (expand_menus && VIM_ISWHITE(*p))
- return NULL; /* TODO: check for next command? */
- if (*p == NUL) /* Complete the menu name */
+ return NULL; // TODO: check for next command?
+ if (*p == NUL) // Complete the menu name
{
int try_alt_menu = TRUE;
@@ -1331,7 +1331,7 @@ set_context_in_menu_cmd(
{
if (menu_name_equal(name, menu))
{
- /* Found menu */
+ // Found menu
if ((*p != NUL && menu->children == NULL)
|| ((menu->modes & expand_modes) == 0x0))
{
@@ -1353,7 +1353,7 @@ set_context_in_menu_cmd(
}
if (menu == NULL)
{
- /* No menu found with the name we were looking for */
+ // No menu found with the name we were looking for
vim_free(path_name);
return NULL;
}
@@ -1371,7 +1371,7 @@ set_context_in_menu_cmd(
else
expand_menu_alt = NULL;
}
- else /* We're in the mapping part */
+ else // We're in the mapping part
xp->xp_context = EXPAND_NOTHING;
return NULL;
}
@@ -1390,7 +1390,7 @@ get_menu_name(expand_T *xp UNUSED, int idx)
static int should_advance = FALSE;
#endif
- if (idx == 0) /* first call: start at first item */
+ if (idx == 0) // first call: start at first item
{
menu = expand_menu;
did_alt_menu = FALSE;
@@ -1399,7 +1399,7 @@ get_menu_name(expand_T *xp UNUSED, int idx)
#endif
}
- /* Skip PopUp[nvoci]. */
+ // Skip PopUp[nvoci].
while (menu != NULL && (menu_is_hidden(menu->dname)
|| menu_is_separator(menu->dname)
|| menu_is_tearoff(menu->dname)
@@ -1413,7 +1413,7 @@ get_menu_name(expand_T *xp UNUSED, int idx)
}
}
- if (menu == NULL) /* at end of linked list */
+ if (menu == NULL) // at end of linked list
return NULL;
if (menu->modes & expand_modes)
@@ -1436,7 +1436,7 @@ get_menu_name(expand_T *xp UNUSED, int idx)
if (should_advance)
#endif
{
- /* Advance to next menu entry. */
+ // Advance to next menu entry.
menu = menu->next;
if (menu == NULL && !did_alt_menu)
{
@@ -1462,13 +1462,13 @@ get_menu_names(expand_T *xp UNUSED, int idx)
static vimmenu_T *menu = NULL;
static int did_alt_menu = FALSE;
#define TBUFFER_LEN 256
- static char_u tbuffer[TBUFFER_LEN]; /*hack*/
+ static char_u tbuffer[TBUFFER_LEN]; //hack
char_u *str;
#ifdef FEAT_MULTI_LANG
static int should_advance = FALSE;
#endif
- if (idx == 0) /* first call: start at first item */
+ if (idx == 0) // first call: start at first item
{
menu = expand_menu;
did_alt_menu = FALSE;
@@ -1477,7 +1477,7 @@ get_menu_names(expand_T *xp UNUSED, int idx)
#endif
}
- /* Skip Browse-style entries, popup menus and separators. */
+ // Skip Browse-style entries, popup menus and separators.
while (menu != NULL
&& ( menu_is_hidden(menu->dname)
|| (expand_emenu && menu_is_separator(menu->dname))
@@ -1495,7 +1495,7 @@ get_menu_names(expand_T *xp UNUSED, int idx)
}
}
- if (menu == NULL) /* at end of linked list */
+ if (menu == NULL) // at end of linked list
return NULL;
if (menu->modes & expand_modes)
@@ -1514,8 +1514,8 @@ get_menu_names(expand_T *xp UNUSED, int idx)
should_advance = TRUE;
}
#endif
- /* hack on menu separators: use a 'magic' char for the separator
- * so that '.' in names gets escaped properly */
+ // hack on menu separators: use a 'magic' char for the separator
+ // so that '.' in names gets escaped properly
STRCAT(tbuffer, "\001");
str = tbuffer;
}
@@ -1542,7 +1542,7 @@ get_menu_names(expand_T *xp UNUSED, int idx)
if (should_advance)
#endif
{
- /* Advance to next menu entry. */
+ // Advance to next menu entry.
menu = menu->next;
if (menu == NULL && !did_alt_menu)
{
@@ -1621,7 +1621,7 @@ menu_namecmp(char_u *name, char_u *mname)
static int
get_menu_cmd_modes(
char_u *cmd,
- int forceit, /* Was there a "!" after the command? */
+ int forceit, // Was there a "!" after the command?
int *noremap,
int *unmenu)
{
@@ -1629,50 +1629,50 @@ get_menu_cmd_modes(
switch (*cmd++)
{
- case 'v': /* vmenu, vunmenu, vnoremenu */
+ case 'v': // vmenu, vunmenu, vnoremenu
modes = MENU_VISUAL_MODE | MENU_SELECT_MODE;
break;
- case 'x': /* xmenu, xunmenu, xnoremenu */
+ case 'x': // xmenu, xunmenu, xnoremenu
modes = MENU_VISUAL_MODE;
break;
- case 's': /* smenu, sunmenu, snoremenu */
+ case 's': // smenu, sunmenu, snoremenu
modes = MENU_SELECT_MODE;
break;
- case 'o': /* omenu */
+ case 'o': // omenu
modes = MENU_OP_PENDING_MODE;
break;
- case 'i': /* imenu */
+ case 'i': // imenu
modes = MENU_INSERT_MODE;
break;
case 't':
- if (*cmd == 'l') /* tlmenu, tlunmenu, tlnoremenu */
+ if (*cmd == 'l') // tlmenu, tlunmenu, tlnoremenu
{
modes = MENU_TERMINAL_MODE;
++cmd;
break;
}
- modes = MENU_TIP_MODE; /* tmenu */
+ modes = MENU_TIP_MODE; // tmenu
break;
- case 'c': /* cmenu */
+ case 'c': // cmenu
modes = MENU_CMDLINE_MODE;
break;
- case 'a': /* amenu */
+ case 'a': // amenu
modes = MENU_INSERT_MODE | MENU_CMDLINE_MODE | MENU_NORMAL_MODE
| MENU_VISUAL_MODE | MENU_SELECT_MODE
| MENU_OP_PENDING_MODE;
break;
case 'n':
- if (*cmd != 'o') /* nmenu, not noremenu */
+ if (*cmd != 'o') // nmenu, not noremenu
{
modes = MENU_NORMAL_MODE;
break;
}
- /* FALLTHROUGH */
+ // FALLTHROUGH
default:
--cmd;
- if (forceit) /* menu!! */
+ if (forceit) // menu!!
modes = MENU_INSERT_MODE | MENU_CMDLINE_MODE;
- else /* menu */
+ else // menu
modes = MENU_NORMAL_MODE | MENU_VISUAL_MODE | MENU_SELECT_MODE
| MENU_OP_PENDING_MODE;
}
@@ -1761,7 +1761,7 @@ menu_text(char_u *str, int *mnemonic, char_u **actext)
char_u *p;
char_u *text;
- /* Locate accelerator text, after the first TAB */
+ // Locate accelerator text, after the first TAB
p = vim_strchr(str, TAB);
if (p != NULL)
{
@@ -1772,13 +1772,13 @@ menu_text(char_u *str, int *mnemonic, char_u **actext)
else
text = vim_strsave(str);
- /* Find mnemonic characters "&a" and reduce "&&" to "&". */
+ // Find mnemonic characters "&a" and reduce "&&" to "&".
for (p = text; p != NULL; )
{
p = vim_strchr(p, '&');
if (p != NULL)
{
- if (p[1] == NUL) /* trailing "&" */
+ if (p[1] == NUL) // trailing "&"
break;
if (mnemonic != NULL && p[1] != '&')
#if !defined(__MVS__) || defined(MOTIF390_MNEMONIC_FIXED)
@@ -1901,7 +1901,7 @@ get_menu_mode(void)
return MENU_INDEX_OP_PENDING;
if (State & NORMAL)
return MENU_INDEX_NORMAL;
- if (State & LANGMAP) /* must be a "r" command, like Insert mode */
+ if (State & LANGMAP) // must be a "r" command, like Insert mode
return MENU_INDEX_INSERT;
return MENU_INDEX_INVALID;
}
@@ -1941,14 +1941,14 @@ show_popupmenu(void)
if (STRNCMP("PopUp", menu->name, 5) == 0 && STRNCMP(menu->name + 5, mode, mode_len) == 0)
break;
- /* Only show a popup when it is defined and has entries */
+ // Only show a popup when it is defined and has entries
if (menu != NULL && menu->children != NULL)
{
# if defined(FEAT_GUI)
if (gui.in_use)
{
- /* Update the menus now, in case the MenuPopup autocommand did
- * anything. */
+ // Update the menus now, in case the MenuPopup autocommand did
+ // anything.
gui_update_menus(0);
gui_mch_show_popupmenu(menu);
}
@@ -1998,7 +1998,7 @@ gui_create_initial_menus(vimmenu_T *menu)
while (menu != NULL)
{
- /* Don't add a menu when only a tip was defined. */
+ // Don't add a menu when only a tip was defined.
if (menu->modes & MENU_ALL_MODES)
{
if (menu->children != NULL)
@@ -2033,11 +2033,11 @@ gui_update_menus_recurse(vimmenu_T *menu, int mode)
else
grey = TRUE;
# ifdef FEAT_GUI_ATHENA
- /* Hiding menus doesn't work for Athena, it can cause a crash. */
+ // Hiding menus doesn't work for Athena, it can cause a crash.
gui_mch_menu_grey(menu, grey);
# else
- /* Never hide a toplevel menu, it may make the menubar resize or
- * disappear. Same problem for ToolBar items. */
+ // Never hide a toplevel menu, it may make the menubar resize or
+ // disappear. Same problem for ToolBar items.
if (vim_strchr(p_go, GO_GREY) != NULL || menu->parent == NULL
# ifdef FEAT_TOOLBAR
|| menu_is_toolbar(menu->parent->name)
@@ -2097,7 +2097,7 @@ gui_is_menu_shortcut(int key)
return FALSE;
}
# endif
-#endif /* FEAT_GUI */
+#endif // FEAT_GUI
#if (defined(FEAT_GUI_MSWIN) && defined(FEAT_TEAROFF)) || defined(PROTO)
@@ -2145,8 +2145,8 @@ gui_create_tearoffs_recurse(
{
if (menu->children != NULL && menu_is_menubar(menu->name))
{
- /* Add the menu name to the menu path. Insert a backslash before
- * dots (it's used to separate menu names). */
+ // Add the menu name to the menu path. Insert a backslash before
+ // dots (it's used to separate menu names).
len = (int)STRLEN(pname) + (int)STRLEN(menu->name);
for (s = menu->name; *s; ++s)
if (*s == '.' || *s == '\\')
@@ -2164,11 +2164,11 @@ gui_create_tearoffs_recurse(
}
*d = NUL;
- /* check if tearoff already exists */
+ // check if tearoff already exists
if (STRCMP(menu->children->name, TEAR_STRING) != 0)
{
gui_add_tearoff(newpname, pri_tab, pri_idx - 1);
- *d = NUL; /* remove TEAR_STRING */
+ *d = NUL; // remove TEAR_STRING
}
STRCAT(newpname, ".");
@@ -2204,7 +2204,7 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx)
STRCAT(tearpath, ".");
STRCAT(tearpath, TEAR_STRING);
- /* Priority of tear-off is always 1 */
+ // Priority of tear-off is always 1
t = pri_tab[pri_idx + 1];
pri_tab[pri_idx + 1] = 1;
@@ -2238,20 +2238,20 @@ gui_destroy_tearoffs_recurse(vimmenu_T *menu)
{
if (menu->children)
{
- /* check if tearoff exists */
+ // check if tearoff exists
if (STRCMP(menu->children->name, TEAR_STRING) == 0)
{
- /* Disconnect the item and free the memory */
+ // Disconnect the item and free the memory
free_menu(&menu->children);
}
- if (menu->children != NULL) /* if not the last one */
+ if (menu->children != NULL) // if not the last one
gui_destroy_tearoffs_recurse(menu->children);
}
menu = menu->next;
}
}
-#endif /* FEAT_GUI_MSWIN && FEAT_TEAROFF */
+#endif // FEAT_GUI_MSWIN && FEAT_TEAROFF
/*
* Execute "menu". Use by ":emenu" and the window toolbar.
@@ -2266,7 +2266,7 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx)
if (idx < 0)
{
- /* Use the Insert mode entry when returning to Insert mode. */
+ // Use the Insert mode entry when returning to Insert mode.
if (restart_edit
#ifdef FEAT_EVAL
&& !current_sctx.sc_sid
@@ -2291,14 +2291,14 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx)
idx = MENU_INDEX_VISUAL;
- /* GEDDES: This is not perfect - but it is a
- * quick way of detecting whether we are doing this from a
- * selection - see if the range matches up with the visual
- * select start and end. */
+ // GEDDES: This is not perfect - but it is a
+ // quick way of detecting whether we are doing this from a
+ // selection - see if the range matches up with the visual
+ // select start and end.
if ((curbuf->b_visual.vi_start.lnum == eap->line1)
&& (curbuf->b_visual.vi_end.lnum) == eap->line2)
{
- /* Set it up for visual mode - equivalent to gv. */
+ // Set it up for visual mode - equivalent to gv.
VIsual_mode = curbuf->b_visual.vi_mode;
tpos = curbuf->b_visual.vi_end;
curwin->w_cursor = curbuf->b_visual.vi_start;
@@ -2306,7 +2306,7 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx)
}
else
{
- /* Set it up for line-wise visual mode */
+ // Set it up for line-wise visual mode
VIsual_mode = 'V';
curwin->w_cursor.lnum = eap->line1;
curwin->w_cursor.col = 1;
@@ -2315,7 +2315,7 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx)
tpos.coladd = 0;
}
- /* Activate visual mode */
+ // Activate visual mode
VIsual_active = TRUE;
VIsual_reselect = TRUE;
check_cursor();
@@ -2324,23 +2324,23 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx)
check_cursor();
- /* Adjust the cursor to make sure it is in the correct pos
- * for exclusive mode */
+ // Adjust the cursor to make sure it is in the correct pos
+ // for exclusive mode
if (*p_sel == 'e' && gchar_cursor() != NUL)
++curwin->w_cursor.col;
}
}
- /* For the WinBar menu always use the Normal mode menu. */
+ // For the WinBar menu always use the Normal mode menu.
if (idx == -1 || eap == NULL)
idx = MENU_INDEX_NORMAL;
if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL
&& (menu->modes & (1 << idx)))
{
- /* When executing a script or function execute the commands right now.
- * Also for the window toolbar.
- * Otherwise put them in the typeahead buffer. */
+ // When executing a script or function execute the commands right now.
+ // Also for the window toolbar.
+ // Otherwise put them in the typeahead buffer.
if (eap == NULL
#ifdef FEAT_EVAL
|| current_sctx.sc_sid != 0
@@ -2432,7 +2432,7 @@ ex_emenu(exarg_T *eap)
name = saved_name;
while (*name)
{
- /* Find in the menu hierarchy */
+ // Find in the menu hierarchy
p = menu_name_skip(name);
while (menu != NULL)
@@ -2496,8 +2496,8 @@ winbar_click(win_T *wp, int col)
if (wp != curwin)
{
- /* Clicking in the window toolbar of a not-current window.
- * Make that window the current one and save Visual mode. */
+ // Clicking in the window toolbar of a not-current window.
+ // Make that window the current one and save Visual mode.
save_curwin = curwin;
VIsual_active = FALSE;
curwin = wp;
@@ -2547,7 +2547,7 @@ gui_find_menu(char_u *path_name)
name = saved_name;
while (*name)
{
- /* find the end of one dot-separated name and put a NUL at the dot */
+ // find the end of one dot-separated name and put a NUL at the dot
p = menu_name_skip(name);
while (menu != NULL)
@@ -2556,7 +2556,7 @@ gui_find_menu(char_u *path_name)
{
if (menu->children == NULL)
{
- /* found a menu item instead of a sub-menu */
+ // found a menu item instead of a sub-menu
if (*p == NUL)
emsg(_("E336: Menu path must lead to a sub-menu"));
else
@@ -2564,16 +2564,16 @@ gui_find_menu(char_u *path_name)
menu = NULL;
goto theend;
}
- if (*p == NUL) /* found a full match */
+ if (*p == NUL) // found a full match
goto theend;
break;
}
menu = menu->next;
}
- if (menu == NULL) /* didn't find it */
+ if (menu == NULL) // didn't find it
break;
- /* Found a match, search the sub-menu. */
+ // Found a match, search the sub-menu.
menu = menu->children;
name = p;
}
@@ -2593,9 +2593,9 @@ theend:
typedef struct
{
- char_u *from; /* English name */
- char_u *from_noamp; /* same, without '&' */
- char_u *to; /* translated name */
+ char_u *from; // English name
+ char_u *from_noamp; // same, without '&'
+ char_u *to; // translated name
} menutrans_T;
static garray_T menutrans_ga = {0, 0, 0, 0, NULL};
@@ -2632,13 +2632,13 @@ ex_menutranslate(exarg_T *eap UNUSED)
}
ga_clear(&menutrans_ga);
# ifdef FEAT_EVAL
- /* Delete all "menutrans_" global variables. */
+ // Delete all "menutrans_" global variables.
del_menutrans_vars();
# endif
}
else
{
- /* ":menutrans from to": add translation */
+ // ":menutrans from to": add translation
from = arg;
arg = menu_skip_part(arg);
to = skipwhite(arg);
@@ -2713,7 +2713,7 @@ menutrans_lookup(char_u *name, int len)
if (STRNICMP(name, tp[i].from, len) == 0 && tp[i].from[len] == NUL)
return tp[i].to;
- /* Now try again while ignoring '&' characters. */
+ // Now try again while ignoring '&' characters.
i = name[len];
name[len] = NUL;
dname = menu_text(name, NULL, NULL);
@@ -2744,7 +2744,7 @@ menu_unescape_name(char_u *name)
if (*p == '\\')
STRMOVE(p, p + 1);
}
-#endif /* FEAT_MULTI_LANG */
+#endif // FEAT_MULTI_LANG
/*
* Isolate the menu name.
@@ -2773,4 +2773,4 @@ menu_translate_tab_and_shift(char_u *arg_start)
return arg;
}
-#endif /* FEAT_MENU */
+#endif // FEAT_MENU
diff --git a/src/version.c b/src/version.c
index 27d785ba9..43244d47e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2388,
+/**/
2387,
/**/
2386,