void cv_vector_insert_block(cv_vector hwv, size_t pos, cv_iterator begin, cv_iterator end)
{
if (cv_vector_empty(hwv))
CV_Error(STS_NULL_PTR, "cv_vector is a null pointer");
// 判断 pos 是否越界 < 0 || > cv_size
if (pos < 0 || pos > hwv->cv_size)
CV_Error(STS_BAD_ARG, "param is bad");
// 计算新尺寸
size_t new_size = hwv->cv_size + ((char*)end - (char*)begin) / hwv->elem_size;
// 计算并调节新容量
while (hwv->cv_capacity < new_size)
hwv->cv_capacity <<= EXPANED_VAL;
adjust_capacity(hwv, hwv->cv_capacity);
// pos 是不是末尾元素 = cv_size
if (pos == hwv->cv_size) {
memcpy((char*)hwv
->data
+ pos
* hwv
->elem_size
, begin
, (char*)end
- (char*)begin
);
} else {
cv_iterator src = cv_vector_index_to_iter(hwv, pos);
size_t bytes = ((char*)end - (char*)begin);
cv_iterator dst = (char*)src + bytes;
}
// 更新尺寸
hwv->cv_size = new_size;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}