int to size_t conversion
This commit is contained in:
parent
f8a32d7d60
commit
7350f7e71e
26
codegen.c
26
codegen.c
|
@ -1075,20 +1075,20 @@ static int
|
||||||
index_local(codegen_state *state, pic_sym sym)
|
index_local(codegen_state *state, pic_sym sym)
|
||||||
{
|
{
|
||||||
codegen_context *cxt = state->cxt;
|
codegen_context *cxt = state->cxt;
|
||||||
int i, offset;
|
size_t i, offset;
|
||||||
pic_sym *var;
|
pic_sym *var;
|
||||||
|
|
||||||
offset = 1;
|
offset = 1;
|
||||||
for (i = 0; i < (int)xv_size(&cxt->args); ++i) {
|
for (i = 0; i < xv_size(&cxt->args); ++i) {
|
||||||
var = xv_get(&cxt->args, i);
|
var = xv_get(&cxt->args, i);
|
||||||
if (*var == sym)
|
if (*var == sym)
|
||||||
return i + offset;
|
return (int)(i + offset);
|
||||||
}
|
}
|
||||||
offset += i;
|
offset += i;
|
||||||
for (i = 0; i < (int)xv_size(&cxt->locals); ++i) {
|
for (i = 0; i < xv_size(&cxt->locals); ++i) {
|
||||||
var = xv_get(&cxt->locals, i);
|
var = xv_get(&cxt->locals, i);
|
||||||
if (*var == sym)
|
if (*var == sym)
|
||||||
return i + offset;
|
return (int)(i + offset);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1126,7 +1126,7 @@ codegen(codegen_state *state, pic_value obj)
|
||||||
name = pic_sym(pic_list_ref(pic, obj, 1));
|
name = pic_sym(pic_list_ref(pic, obj, 1));
|
||||||
if ((i = index_capture(state, name, 0)) != -1) {
|
if ((i = index_capture(state, name, 0)) != -1) {
|
||||||
cxt->code[cxt->clen].insn = OP_LREF;
|
cxt->code[cxt->clen].insn = OP_LREF;
|
||||||
cxt->code[cxt->clen].u.i = i + xv_size(&cxt->args) + xv_size(&cxt->locals) + 1;
|
cxt->code[cxt->clen].u.i = i + (int)xv_size(&cxt->args) + (int)xv_size(&cxt->locals) + 1;
|
||||||
cxt->clen++;
|
cxt->clen++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1172,7 +1172,7 @@ codegen(codegen_state *state, pic_value obj)
|
||||||
name = pic_sym(pic_list_ref(pic, var, 1));
|
name = pic_sym(pic_list_ref(pic, var, 1));
|
||||||
if ((i = index_capture(state, name, 0)) != -1) {
|
if ((i = index_capture(state, name, 0)) != -1) {
|
||||||
cxt->code[cxt->clen].insn = OP_LSET;
|
cxt->code[cxt->clen].insn = OP_LSET;
|
||||||
cxt->code[cxt->clen].u.i = i + xv_size(&cxt->args) + xv_size(&cxt->locals) + 1;
|
cxt->code[cxt->clen].u.i = i + (int)xv_size(&cxt->args) + (int)xv_size(&cxt->locals) + 1;
|
||||||
cxt->clen++;
|
cxt->clen++;
|
||||||
cxt->code[cxt->clen].insn = OP_PUSHNONE;
|
cxt->code[cxt->clen].insn = OP_PUSHNONE;
|
||||||
cxt->clen++;
|
cxt->clen++;
|
||||||
|
@ -1193,7 +1193,7 @@ codegen(codegen_state *state, pic_value obj)
|
||||||
cxt->icapa *= 2;
|
cxt->icapa *= 2;
|
||||||
cxt->irep = pic_realloc(pic, cxt->irep, sizeof(struct pic_irep *) * cxt->icapa);
|
cxt->irep = pic_realloc(pic, cxt->irep, sizeof(struct pic_irep *) * cxt->icapa);
|
||||||
}
|
}
|
||||||
k = cxt->ilen++;
|
k = (int)cxt->ilen++;
|
||||||
cxt->code[cxt->clen].insn = OP_LAMBDA;
|
cxt->code[cxt->clen].insn = OP_LAMBDA;
|
||||||
cxt->code[cxt->clen].u.i = k;
|
cxt->code[cxt->clen].u.i = k;
|
||||||
cxt->clen++;
|
cxt->clen++;
|
||||||
|
@ -1207,18 +1207,18 @@ codegen(codegen_state *state, pic_value obj)
|
||||||
codegen(state, pic_list_ref(pic, obj, 1));
|
codegen(state, pic_list_ref(pic, obj, 1));
|
||||||
|
|
||||||
cxt->code[cxt->clen].insn = OP_JMPIF;
|
cxt->code[cxt->clen].insn = OP_JMPIF;
|
||||||
s = cxt->clen++;
|
s = (int)cxt->clen++;
|
||||||
|
|
||||||
/* if false branch */
|
/* if false branch */
|
||||||
codegen(state, pic_list_ref(pic, obj, 3));
|
codegen(state, pic_list_ref(pic, obj, 3));
|
||||||
cxt->code[cxt->clen].insn = OP_JMP;
|
cxt->code[cxt->clen].insn = OP_JMP;
|
||||||
t = cxt->clen++;
|
t = (int)cxt->clen++;
|
||||||
|
|
||||||
cxt->code[s].u.i = cxt->clen - s;
|
cxt->code[s].u.i = (int)cxt->clen - s;
|
||||||
|
|
||||||
/* if true branch */
|
/* if true branch */
|
||||||
codegen(state, pic_list_ref(pic, obj, 2));
|
codegen(state, pic_list_ref(pic, obj, 2));
|
||||||
cxt->code[t].u.i = cxt->clen - t;
|
cxt->code[t].u.i = (int)cxt->clen - t;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (sym == pic->sBEGIN) {
|
else if (sym == pic->sBEGIN) {
|
||||||
|
@ -1266,7 +1266,7 @@ codegen(codegen_state *state, pic_value obj)
|
||||||
cxt->pcapa *= 2;
|
cxt->pcapa *= 2;
|
||||||
cxt->pool = pic_realloc(pic, cxt->pool, sizeof(pic_value) * cxt->pcapa);
|
cxt->pool = pic_realloc(pic, cxt->pool, sizeof(pic_value) * cxt->pcapa);
|
||||||
}
|
}
|
||||||
pidx = cxt->plen++;
|
pidx = (int)cxt->plen++;
|
||||||
cxt->pool[pidx] = obj;
|
cxt->pool[pidx] = obj;
|
||||||
cxt->code[cxt->clen].insn = OP_PUSHCONST;
|
cxt->code[cxt->clen].insn = OP_PUSHCONST;
|
||||||
cxt->code[cxt->clen].u.i = pidx;
|
cxt->code[cxt->clen].u.i = pidx;
|
||||||
|
|
|
@ -52,8 +52,8 @@ struct pic_code {
|
||||||
int i;
|
int i;
|
||||||
char c;
|
char c;
|
||||||
struct {
|
struct {
|
||||||
short depth;
|
int depth;
|
||||||
short idx;
|
int idx;
|
||||||
} r;
|
} r;
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
4
string.c
4
string.c
|
@ -240,14 +240,14 @@ pic_str_string(pic_state *pic)
|
||||||
|
|
||||||
pic_get_args(pic, "*", &argc, &argv);
|
pic_get_args(pic, "*", &argc, &argv);
|
||||||
|
|
||||||
buf = pic_alloc(pic, argc);
|
buf = pic_alloc(pic, (size_t)argc);
|
||||||
|
|
||||||
for (i = 0; i < argc; ++i) {
|
for (i = 0; i < argc; ++i) {
|
||||||
pic_assert_type(pic, argv[i], char);
|
pic_assert_type(pic, argv[i], char);
|
||||||
buf[i] = pic_char(argv[i]);
|
buf[i] = pic_char(argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
str = pic_make_str(pic, buf, argc);
|
str = pic_make_str(pic, buf, (size_t)argc);
|
||||||
pic_free(pic, buf);
|
pic_free(pic, buf);
|
||||||
|
|
||||||
return pic_obj_value(str);
|
return pic_obj_value(str);
|
||||||
|
|
2
symbol.c
2
symbol.c
|
@ -80,7 +80,7 @@ pic_ungensym(pic_state *pic, pic_sym base)
|
||||||
if ((occr = strrchr(name, '@')) == NULL) {
|
if ((occr = strrchr(name, '@')) == NULL) {
|
||||||
pic_panic(pic, "logic flaw");
|
pic_panic(pic, "logic flaw");
|
||||||
}
|
}
|
||||||
return pic_intern(pic, name, occr - name);
|
return pic_intern(pic, name, (size_t)(occr - name));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
2
system.c
2
system.c
|
@ -110,7 +110,7 @@ pic_system_getenvs(pic_state *pic)
|
||||||
for (i = 0; (*envp)[i] != '='; ++i)
|
for (i = 0; (*envp)[i] != '='; ++i)
|
||||||
;
|
;
|
||||||
|
|
||||||
key = pic_make_str(pic, *envp, i);
|
key = pic_make_str(pic, *envp, (size_t)i);
|
||||||
val = pic_make_str_cstr(pic, getenv(pic_str_cstr(key)));
|
val = pic_make_str_cstr(pic, getenv(pic_str_cstr(key)));
|
||||||
|
|
||||||
/* push */
|
/* push */
|
||||||
|
|
Loading…
Reference in New Issue