: obj->ob_type->tp_name)
#define RAISE_NO_EMPTY_KEYS PyErr_SET_STRING(PyExc_ValueError, \
- "empty keys are not allowed")
-#define RAISE_LOCKED(type) PyErr_SET_VIM(_(type " is locked"))
-#define RAISE_LOCKED_DICTIONARY RAISE_LOCKED("dictionary")
-#define RAISE_LOCKED_LIST RAISE_LOCKED("list")
-#define RAISE_UNDO_FAIL PyErr_SET_VIM("cannot save undo information")
-#define RAISE_LINE_FAIL(act) PyErr_SET_VIM("cannot " act " line")
+ N_("empty keys are not allowed"))
+#define RAISE_LOCKED_DICTIONARY PyErr_SET_VIM(N_("dictionary is locked"))
+#define RAISE_LOCKED_LIST PyErr_SET_VIM(N_("list is locked"))
+#define RAISE_UNDO_FAIL PyErr_SET_VIM(N_("cannot save undo information"))
+#define RAISE_DELETE_LINE_FAIL PyErr_SET_VIM(N_("cannot delete line"))
+#define RAISE_INSERT_LINE_FAIL PyErr_SET_VIM(N_("cannot insert line"))
+#define RAISE_REPLACE_LINE_FAIL PyErr_SET_VIM(N_("cannot replace line"))
#define RAISE_KEY_ADD_FAIL(key) \
- PyErr_VIM_FORMAT("failed to add key '%s' to dictionary", key)
+ PyErr_VIM_FORMAT(N_("failed to add key '%s' to dictionary"), key)
#define RAISE_INVALID_INDEX_TYPE(idx) \
- PyErr_FORMAT(PyExc_TypeError, "index must be int or slice, not %s", \
+ PyErr_FORMAT(PyExc_TypeError, N_("index must be int or slice, not %s"), \
Py_TYPE_NAME(idx));
#define INVALID_BUFFER_VALUE ((buf_T *)(-1))
{
PyErr_FORMAT(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
- "expected str() or unicode() instance, but got %s"
+ N_("expected str() or unicode() instance, but got %s")
#else
- "expected bytes() or str() instance, but got %s"
+ N_("expected bytes() or str() instance, but got %s")
#endif
, Py_TYPE_NAME(obj));
return NULL;
{
PyErr_FORMAT(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
- "expected int(), long() or something supporting "
- "coercing to long(), but got %s"
+ N_("expected int(), long() or something supporting "
+ "coercing to long(), but got %s")
#else
- "expected int() or something supporting coercing to int(), "
- "but got %s"
+ N_("expected int() or something supporting coercing to int(), "
+ "but got %s")
#endif
, Py_TYPE_NAME(obj));
return -1;
if (*result > INT_MAX)
{
PyErr_SET_STRING(PyExc_OverflowError,
- "value is too large to fit into C int type");
+ N_("value is too large to fit into C int type"));
return -1;
}
else if (*result < INT_MIN)
{
PyErr_SET_STRING(PyExc_OverflowError,
- "value is too small to fit into C int type");
+ N_("value is too small to fit into C int type"));
return -1;
}
}
if (*result <= 0)
{
PyErr_SET_STRING(PyExc_ValueError,
- "number must be greater then zero");
+ N_("number must be greater then zero"));
return -1;
}
}
if (*result < 0)
{
PyErr_SET_STRING(PyExc_ValueError,
- "number must be greater or equal to zero");
+ N_("number must be greater or equal to zero"));
return -1;
}
}
if (valObject == NULL)
{
PyErr_SET_STRING(PyExc_AttributeError,
- "can't delete OutputObject attributes");
+ N_("can't delete OutputObject attributes"));
return -1;
}
return 0;
}
- PyErr_FORMAT(PyExc_AttributeError, "invalid attribute: %s", name);
+ PyErr_FORMAT(PyExc_AttributeError, N_("invalid attribute: %s"), name);
return -1;
}
if (our_tv == NULL)
{
- PyErr_SET_VIM("invalid expression");
+ PyErr_SET_VIM(N_("invalid expression"));
return NULL;
}
if (our_tv == NULL)
{
- PyErr_SET_VIM("invalid expression");
+ PyErr_SET_VIM(N_("invalid expression"));
return NULL;
}
if (VimTryEnd())
return NULL;
- PyErr_SET_VIM("failed to change directory");
+ PyErr_SET_VIM(N_("failed to change directory"));
return NULL;
}
if (!PyTuple_Check(find_module_result))
{
PyErr_FORMAT(PyExc_TypeError,
- "expected 3-tuple as imp.find_module() result, but got %s",
+ N_("expected 3-tuple as imp.find_module() result, but got %s"),
Py_TYPE_NAME(find_module_result));
return NULL;
}
if (PyTuple_GET_SIZE(find_module_result) != 3)
{
PyErr_FORMAT(PyExc_TypeError,
- "expected 3-tuple as imp.find_module() result, but got "
- "tuple of size %d",
+ N_("expected 3-tuple as imp.find_module() result, but got "
+ "tuple of size %d"),
(int) PyTuple_GET_SIZE(find_module_result));
return NULL;
}
|| !(description = PyTuple_GET_ITEM(find_module_result, 2)))
{
PyErr_SET_STRING(PyExc_RuntimeError,
- "internal error: imp.find_module returned tuple with NULL");
+ N_("internal error: imp.find_module returned tuple with NULL"));
return NULL;
}
if (valObject == NULL)
{
PyErr_SET_STRING(PyExc_AttributeError,
- "cannot delete vim.Dictionary attributes");
+ N_("cannot delete vim.Dictionary attributes"));
return -1;
}
{
if (self->dict->dv_lock == VAR_FIXED)
{
- PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed dictionary");
+ PyErr_SET_STRING(PyExc_TypeError,
+ N_("cannot modify fixed dictionary"));
return -1;
}
else
}
else
{
- PyErr_FORMAT(PyExc_AttributeError, "cannot set attribute %s", name);
+ PyErr_FORMAT(PyExc_AttributeError, N_("cannot set attribute %s"), name);
return -1;
}
}
(*dii)->ht->ht_used != (*dii)->ht_used)
{
PyErr_SET_STRING(PyExc_RuntimeError,
- "hashtab changed during iteration");
+ N_("hashtab changed during iteration"));
return NULL;
}
Py_DECREF(iterator);
Py_DECREF(fast);
PyErr_FORMAT(PyExc_ValueError,
- "expected sequence element of size 2, "
- "but got sequence of size %d",
+ N_("expected sequence element of size 2, "
+ "but got sequence of size %d"),
PySequence_Fast_GET_SIZE(fast));
return NULL;
}
if (kwargs)
{
PyErr_SET_STRING(PyExc_TypeError,
- "list constructor does not accept keyword arguments");
+ N_("list constructor does not accept keyword arguments"));
return NULL;
}
if (index >= ListLength(self))
{
- PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
+ PyErr_SET_STRING(PyExc_IndexError, N_("list index out of range"));
return NULL;
}
li = list_find(self->list, (long) index);
if (li == NULL)
{
/* No more suitable format specifications in python-2.3 */
- PyErr_VIM_FORMAT("internal error: failed to get vim list item %d",
+ PyErr_VIM_FORMAT(N_("internal error: failed to get vim list item %d"),
(int) index);
return NULL;
}
}
if (index > length || (index == length && obj == NULL))
{
- PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
+ PyErr_SET_STRING(PyExc_IndexError, N_("list index out of range"));
return -1;
}
if (list_append_tv(l, &tv) == FAIL)
{
clear_tv(&tv);
- PyErr_SET_VIM("failed to add item to list");
+ PyErr_SET_VIM(N_("failed to add item to list"));
return -1;
}
}
li = list_find(l, (long) first);
if (li == NULL)
{
- PyErr_VIM_FORMAT("internal error: no vim list item %d", (int)first);
+ PyErr_VIM_FORMAT(N_("internal error: no vim list item %d"),
+ (int)first);
return -1;
}
if (last > first)
if (list_insert_tv(l, &v, li) == FAIL)
{
clear_tv(&v);
- PyErr_SET_VIM("internal error: failed to add item to list");
+ PyErr_SET_VIM(N_("internal error: failed to add item to list"));
return -1;
}
clear_tv(&v);
if (valObject == NULL)
{
PyErr_SET_STRING(PyExc_AttributeError,
- "cannot delete vim.List attributes");
+ N_("cannot delete vim.List attributes"));
return -1;
}
{
if (self->list->lv_lock == VAR_FIXED)
{
- PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed list");
+ PyErr_SET_STRING(PyExc_TypeError, N_("cannot modify fixed list"));
return -1;
}
else
}
else
{
- PyErr_FORMAT(PyExc_AttributeError, "cannot set attribute %s", name);
+ PyErr_FORMAT(PyExc_AttributeError, N_("cannot set attribute %s"), name);
return -1;
}
}
if (!translated_function_exists(name))
{
PyErr_FORMAT(PyExc_ValueError,
- "unnamed function %s does not exist", name);
+ N_("unnamed function %s does not exist"), name);
return NULL;
}
self->name = vim_strsave(name);
vim_strchr(name, AUTOLOAD_CHAR) == NULL))
== NULL)
{
- PyErr_FORMAT(PyExc_ValueError, "function %s does not exist", name);
+ PyErr_FORMAT(PyExc_ValueError,
+ N_("function %s does not exist"), name);
return NULL;
}
if (kwargs)
{
PyErr_SET_STRING(PyExc_TypeError,
- "function constructor does not accept keyword arguments");
+ N_("function constructor does not accept keyword arguments"));
return NULL;
}
else if (error != OK)
{
ret = NULL;
- PyErr_VIM_FORMAT("failed to run function %s", (char *)name);
+ PyErr_VIM_FORMAT(N_("failed to run function %s"), (char *)name);
}
else
ret = ConvertToPyObject(&rettv);
else
{
PyErr_SET_STRING(PyExc_RuntimeError,
- "unable to get option value");
+ N_("unable to get option value"));
return NULL;
}
}
else
{
- PyErr_SET_VIM("internal error: unknown option type");
+ PyErr_SET_VIM(N_("internal error: unknown option type"));
return NULL;
}
}
{
if (VimTryEnd())
return -1;
- PyErr_SET_VIM("problem while switching windows");
+ PyErr_SET_VIM(N_("problem while switching windows"));
return -1;
}
set_ret = set_option_value_err(key, numval, stringval, opt_flags);
if (self->opt_type == SREQ_GLOBAL)
{
PyErr_FORMAT(PyExc_ValueError,
- "unable to unset global option %s", key);
+ N_("unable to unset global option %s"), key);
Py_XDECREF(todecref);
return -1;
}
else if (!(flags & SOPT_GLOBAL))
{
PyErr_FORMAT(PyExc_ValueError,
- "unable to unset option %s "
- "which does not have global value", key);
+ N_("unable to unset option %s "
+ "which does not have global value"), key);
Py_XDECREF(todecref);
return -1;
}
{
if (self->tab == INVALID_TABPAGE_VALUE)
{
- PyErr_SET_VIM("attempt to refer to deleted tab page");
+ PyErr_SET_VIM(N_("attempt to refer to deleted tab page"));
return -1;
}
if (n == 0)
return TabPageNew(tp);
- PyErr_SET_STRING(PyExc_IndexError, "no such tab page");
+ PyErr_SET_STRING(PyExc_IndexError, N_("no such tab page"));
return NULL;
}
{
if (self->win == INVALID_WINDOW_VALUE)
{
- PyErr_SET_VIM("attempt to refer to deleted window");
+ PyErr_SET_VIM(N_("attempt to refer to deleted window"));
return -1;
}
if (strcmp(name, "buffer") == 0)
{
- PyErr_SET_STRING(PyExc_TypeError, "readonly attribute: buffer");
+ PyErr_SET_STRING(PyExc_TypeError, N_("readonly attribute: buffer"));
return -1;
}
else if (strcmp(name, "cursor") == 0)
if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count)
{
- PyErr_SET_VIM("cursor position outside buffer");
+ PyErr_SET_VIM(N_("cursor position outside buffer"));
return -1;
}
if (n == 0)
return WindowNew(w, self->tabObject? self->tabObject->tab: curtab);
- PyErr_SET_STRING(PyExc_IndexError, "no such window");
+ PyErr_SET_STRING(PyExc_IndexError, N_("no such window"));
return NULL;
}
--len;
else
{
- PyErr_SET_VIM("string cannot contain newlines");
+ PyErr_SET_VIM(N_("string cannot contain newlines"));
Py_XDECREF(bytes);
return NULL;
}
if (u_savedel((linenr_T)n, 1L) == FAIL)
RAISE_UNDO_FAIL;
else if (ml_delete((linenr_T)n, FALSE) == FAIL)
- RAISE_LINE_FAIL("delete");
+ RAISE_DELETE_LINE_FAIL;
else
{
if (buf == savebuf)
}
else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL)
{
- RAISE_LINE_FAIL("replace");
+ RAISE_REPLACE_LINE_FAIL;
vim_free(save);
}
else
{
if (ml_delete((linenr_T)lo, FALSE) == FAIL)
{
- RAISE_LINE_FAIL("delete");
+ RAISE_DELETE_LINE_FAIL;
break;
}
}
for (i = 0; i < old_len - new_len; ++i)
if (ml_delete((linenr_T)lo, FALSE) == FAIL)
{
- RAISE_LINE_FAIL("delete");
+ RAISE_DELETE_LINE_FAIL;
break;
}
extra -= i;
if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], FALSE)
== FAIL)
{
- RAISE_LINE_FAIL("replace");
+ RAISE_REPLACE_LINE_FAIL;
break;
}
}
if (ml_append((linenr_T)(lo + i - 1),
(char_u *)array[i], 0, FALSE) == FAIL)
{
- RAISE_LINE_FAIL("insert");
+ RAISE_INSERT_LINE_FAIL;
break;
}
vim_free(array[i]);
if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
RAISE_UNDO_FAIL;
else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
- RAISE_LINE_FAIL("insert");
+ RAISE_INSERT_LINE_FAIL;
else
appended_lines_mark((linenr_T)n, 1L);
if (ml_append((linenr_T)(n + i),
(char_u *)array[i], 0, FALSE) == FAIL)
{
- RAISE_LINE_FAIL("insert");
+ RAISE_INSERT_LINE_FAIL;
/* Free the rest of the lines */
while (i < size)
{
if (self->buf == INVALID_BUFFER_VALUE)
{
- PyErr_SET_VIM("attempt to refer to deleted buffer");
+ PyErr_SET_VIM(N_("attempt to refer to deleted buffer"));
return -1;
}
if (n < 0 || n > end - start)
{
- PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
+ PyErr_SET_STRING(PyExc_IndexError, N_("line number out of range"));
return NULL;
}
if (n < 0 || n > end - start)
{
- PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
+ PyErr_SET_STRING(PyExc_IndexError, N_("line number out of range"));
return -1;
}
if (n < 0 || n > max)
{
- PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
+ PyErr_SET_STRING(PyExc_IndexError, N_("line number out of range"));
return NULL;
}
if (ren_ret == FAIL)
{
- PyErr_SET_VIM("failed to rename buffer");
+ PyErr_SET_VIM(N_("failed to rename buffer"));
return -1;
}
return 0;
if (pmark[0] == '\0' || pmark[1] != '\0')
{
PyErr_SET_STRING(PyExc_ValueError,
- "mark name must be a single character");
+ N_("mark name must be a single character"));
Py_XDECREF(todecref);
return NULL;
}
if (posp == NULL)
{
- PyErr_SET_VIM("invalid mark name");
+ PyErr_SET_VIM(N_("invalid mark name"));
return NULL;
}
if (valObject->ob_type != &BufferType)
{
PyErr_FORMAT(PyExc_TypeError,
- "expected vim.Buffer object, but got %s",
+ N_("expected vim.Buffer object, but got %s"),
Py_TYPE_NAME(valObject));
return -1;
}
{
if (VimTryEnd())
return -1;
- PyErr_VIM_FORMAT("failed to switch to buffer %d", count);
+ PyErr_VIM_FORMAT(N_("failed to switch to buffer %d"), count);
return -1;
}
if (valObject->ob_type != &WindowType)
{
PyErr_FORMAT(PyExc_TypeError,
- "expected vim.Window object, but got %s",
+ N_("expected vim.Window object, but got %s"),
Py_TYPE_NAME(valObject));
return -1;
}
if (!count)
{
PyErr_SET_STRING(PyExc_ValueError,
- "failed to find window in the current tab page");
+ N_("failed to find window in the current tab page"));
return -1;
}
if (VimTryEnd())
return -1;
PyErr_SET_STRING(PyExc_RuntimeError,
- "did not switch to the specified window");
+ N_("did not switch to the specified window"));
return -1;
}
if (valObject->ob_type != &TabPageType)
{
PyErr_FORMAT(PyExc_TypeError,
- "expected vim.TabPage object, but got %s",
+ N_("expected vim.TabPage object, but got %s"),
Py_TYPE_NAME(valObject));
return -1;
}
if (VimTryEnd())
return -1;
PyErr_SET_STRING(PyExc_RuntimeError,
- "did not switch to the specified tab page");
+ N_("did not switch to the specified tab page"));
return -1;
}
else
{
PyErr_FORMAT(PyExc_TypeError,
- "unable to convert %s to vim dictionary",
+ N_("unable to convert %s to vim dictionary"),
Py_TYPE_NAME(obj));
ret = -1;
}
else
{
PyErr_FORMAT(PyExc_TypeError,
- "unable to convert %s to vim structure",
+ N_("unable to convert %s to vim structure"),
Py_TYPE_NAME(obj));
return -1;
}
{
if (tv == NULL)
{
- PyErr_SET_VIM("internal error: NULL reference passed");
+ PyErr_SET_VIM(N_("internal error: NULL reference passed"));
return NULL;
}
switch (tv->v_type)
Py_INCREF(Py_None);
return Py_None;
default:
- PyErr_SET_VIM("internal error: invalid value type");
+ PyErr_SET_VIM(N_("internal error: invalid value type"));
return NULL;
}
}