Skip to content

Commit

Permalink
no use %z for windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Apr 12, 2012
1 parent 42ecd09 commit c1a2705
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tora/disasm.cc
Expand Up @@ -36,7 +36,7 @@ void Disasm::disasm(const SharedPtr<OPArray>& ops) {
printf("-- OP DUMP --\n"); printf("-- OP DUMP --\n");
for (size_t i=0; i<ops->size(); i++) { for (size_t i=0; i<ops->size(); i++) {
const OP* op = ops->at(i); const OP* op = ops->at(i);
printf("[%03zd] %s", i, opcode2name[op->op_type]); printf("[%03d] %s", i, opcode2name[op->op_type]);
switch (op->op_type) { switch (op->op_type) {
case OP_GETDYNAMIC: { case OP_GETDYNAMIC: {
int level = (op->operand.int_value >> 16) & 0x0000FFFF; int level = (op->operand.int_value >> 16) & 0x0000FFFF;
Expand Down
14 changes: 7 additions & 7 deletions vm.inc
Expand Up @@ -35,7 +35,7 @@ OP_GETARG {
int index = mark_stack.back() - no - 1; int index = mark_stack.back() - no - 1;
#ifndef NDEBUG #ifndef NDEBUG
if (index >= stack.size()) { if (index >= stack.size()) {
fprintf(stderr, "[BUG] Invalid index in OP_GETARG. mark_stack.back(): %d, no: %d, stack.size(): %zd\n", mark_stack.back(), no, stack.size()); fprintf(stderr, "[BUG] Invalid index in OP_GETARG. mark_stack.back(): %d, no: %d, stack.size(): %d\n", mark_stack.back(), no, (int) stack.size());
dump_stack(); dump_stack();
abort(); abort();
} }
Expand Down Expand Up @@ -254,7 +254,7 @@ OP_BUILTIN_FUNCALL {
} }
if (!(stack.size() >= (size_t) argcnt)) { if (!(stack.size() >= (size_t) argcnt)) {
dump_stack(); dump_stack();
this->die("[BUG] bad argument: %s requires %d arguments but only %zd items available on stack(OP_BUILTINFUNCALL)\n", this->symbol_table->id2name(funname->upcast<SymbolValue>()->id()).c_str(), argcnt, stack.size()); this->die("[BUG] bad argument: %s requires %d arguments but only %d items available on stack(OP_BUILTINFUNCALL)\n", this->symbol_table->id2name(funname->upcast<SymbolValue>()->id()).c_str(), argcnt, (int) stack.size());
} }
ID id = funname->upcast<SymbolValue>()->id(); ID id = funname->upcast<SymbolValue>()->id();
assert(funname->value_type == VALUE_TYPE_SYMBOL); assert(funname->value_type == VALUE_TYPE_SYMBOL);
Expand Down Expand Up @@ -283,7 +283,7 @@ OP_FUNCALL {
#ifndef NDEBUG #ifndef NDEBUG
if (!(stack.size() >= (size_t) argcnt)) { if (!(stack.size() >= (size_t) argcnt)) {
dump_stack(); dump_stack();
this->die("[BUG] bad argument: %s requires %d arguments but only %zd items available on stack(OP_FUNCALL)\n", this->symbol_table->id2name(funname->upcast<SymbolValue>()->id()).c_str(), argcnt, stack.size()); this->die("[BUG] bad argument: %s requires %d arguments but only %d items available on stack(OP_FUNCALL)\n", this->symbol_table->id2name(funname->upcast<SymbolValue>()->id()).c_str(), argcnt, (int) stack.size());
} }
#endif #endif
ID id = funname->upcast<SymbolValue>()->id(); ID id = funname->upcast<SymbolValue>()->id();
Expand Down Expand Up @@ -318,7 +318,7 @@ OP_FUNCALL {
int start_stack_size = stack.size() - argcnt; int start_stack_size = stack.size() - argcnt;
this->ops = code->code_opcodes(); this->ops = code->code_opcodes();


// printf("PARAM count: %zd\n", code->code_params->size()); // printf("PARAM count: %d\n", (int) code->code_params->size());
if (code->code_params().get()) { if (code->code_params().get()) {
for (size_t i=0; i<code->code_params()->size(); i++) { for (size_t i=0; i<code->code_params()->size(); i++) {
if (argcnt <= i) { if (argcnt <= i) {
Expand Down Expand Up @@ -407,7 +407,7 @@ OP_RETURN {
assert(mark_stack.size() > 0); assert(mark_stack.size() > 0);
int top = mark_stack.back(); int top = mark_stack.back();
SharedPtr<Value> retval; SharedPtr<Value> retval;
// printf("TOP: %zd, %d, %zd\n", mark_stack.size(), top, stack.size()); // printf("TOP: %d, %d, %d\n", (int) mark_stack.size(), top, (int) stack.size());
// dump_stack(); // dump_stack();
if (top < stack.size()) { if (top < stack.size()) {
retval.reset(stack.back().get()); retval.reset(stack.back().get());
Expand Down Expand Up @@ -615,7 +615,7 @@ OP_GETDYNAMIC {


// dump_frame(); // dump_frame();
// frame_stack->back()->dump_pad(this); // frame_stack->back()->dump_pad(this);
//// printf("DUMP: %d, %d, %s, %zd\n", level, no, frame->type_str(), frame->vars.size()); //// printf("DUMP: %d, %d, %s, %d\n", level, no, frame->type_str(), (int) frame->vars.size());
stack.push_back(v); stack.push_back(v);
} }


Expand Down Expand Up @@ -697,7 +697,7 @@ OP_PRE_INCREMENT {
// ++$i // ++$i
SharedPtr<Value> i = stack.back(); SharedPtr<Value> i = stack.back();
stack.pop_back(); stack.pop_back();
// printf("stack %zd\n", stack.size()); // printf("stack %d\n", (int) stack.size());
if (i->value_type == VALUE_TYPE_INT) { if (i->value_type == VALUE_TYPE_INT) {
i->upcast<IntValue>()->tora__incr__(); i->upcast<IntValue>()->tora__incr__();
stack.push_back(i); stack.push_back(i);
Expand Down

0 comments on commit c1a2705

Please sign in to comment.