static qcint_t prog_leavefunction(qc_program_t *prog) { prog_section_function_t *prev = nullptr; size_t oldsp; qc_exec_stack_t st = vec_last(prog->stack); if (prog->xflags & VMXF_TRACE) { if (vec_size(prog->function_stack)) vec_pop(prog->function_stack); } #ifdef QCVM_BACKUP_STRATEGY_CALLER_VARS if (vec_size(prog->stack) > 1) { prev = prog->stack[vec_size(prog->stack)-2].function; oldsp = prog->stack[vec_size(prog->stack)-2].localsp; } #else prev = prog->stack[vec_size(prog->stack)-1].function; oldsp = prog->stack[vec_size(prog->stack)-1].localsp; #endif if (prev) { qcint_t *globals = &prog->globals[0] + prev->firstlocal; memcpy(globals, prog->localstack + oldsp, prev->locals * sizeof(prog->localstack[0])); /* vec_remove(prog->localstack, oldsp, vec_size(prog->localstack)-oldsp); */ vec_shrinkto(prog->localstack, oldsp); } vec_pop(prog->stack); return st.stmt - 1; /* offset the ++st */ }
void BlockRender_PutBuffersIntoPlace(World* world) { if (pendingChunks.length > 0) { pendingChunkVtxs vtxData = vec_pop(&pendingChunks); Chunk* c = World_GetChunk(world, vtxData.x, vtxData.z); if (c != NULL) { Cluster* cluster = &c->data[vtxData.y]; for (int i = 0; i < 2; i++) { if (vtxData.buf[i] != NULL) { int vboBytestNeeded = sizeof(world_vertex) * vtxData.vtxCount[i]; if (cluster->vbo[i].memory == NULL || cluster->vbo[i].size == 0) { cluster->vbo[i] = VBO_Alloc(vboBytestNeeded + (sizeof(world_vertex) * 24)); } else if (cluster->vbo[i].size < vboBytestNeeded) { VBO_Free(cluster->vbo[i]); cluster->vbo[i] = VBO_Alloc(vboBytestNeeded + (sizeof(world_vertex) * 24)); } if (!cluster->vbo[i].memory) printf("VBO allocation failed\n"); memcpy(cluster->vbo[i].memory, vtxData.buf[i], vboBytestNeeded); freeBuffer(vtxData.buf[i]); } } cluster->vertexCount[0] = vtxData.vtxCount[0]; cluster->vertexCount[1] = vtxData.vtxCount[1]; } } }
void doc_pop_style(doc_ptr doc) { assert(vec_length(doc->style_stack) > 0); /* the style stack can never empty, and the bottom is always "normal" */ if (vec_length(doc->style_stack) > 1) { doc_style_ptr style = vec_pop(doc->style_stack); free(style); } }
/* 実行膜スタックからmemを削除する。外部関数が膜の削除しようとするとき に、その膜がスタックに積まれている事がある。そのため、安全な削除を行 うために、この手続きが必要になる。外部の機能を使わない通常の実行時に はこの手続きは必要ない*/ void lmn_memstack_delete(LmnMemStack memstack, LmnMembrane *mem) { unsigned long i, j, n = vec_num(memstack); for (i = n-1; i >= 0; i--) { if ((LmnMembrane *)vec_get(memstack, i) == mem) { /* 空いた分後ろの要素を前にを詰める */ for (j = i+1; j < n; j++) { vec_set(memstack, j-1, vec_get(memstack, j)); } break; } } vec_pop(memstack); }
void code_pop_statement(code_t *code) { vec_pop(code->statements); vec_pop(code->linenums); vec_pop(code->columnnums); }
inline LmnMembrane *lmn_memstack_pop(LmnMemStack memstack) { LmnMembrane *m = (LmnMembrane *)vec_pop(memstack); lmn_mem_set_active(m, FALSE); return m; }
static void pop_function(void *ignore) { if (dumpstack) vec_pop(functions); }