本文整理汇总了C++中pushInt函数的典型用法代码示例。如果您正苦于以下问题:C++ pushInt函数的具体用法?C++ pushInt怎么用?C++ pushInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pushInt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test1
void test1() {
printf("Test 1: Objects on stack are preserved.\n");
VM* vm = newVM();
pushInt(vm, 1);
pushInt(vm, 2);
gc(vm);
assert(vm->numObjects == 2, "Should have preserved objects.");
freeVM(vm);
}
开发者ID:ChelinTsien,项目名称:mark-sweep,代码行数:10,代码来源:main.c
示例2: test2
void test2() {
printf("Test 2: Unreached objects are collected.\n");
VM* vm = newVM();
pushInt(vm, 1);
pushInt(vm, 2);
pop(vm);
pop(vm);
gc(vm);
assert(vm->numObjects == 0, "Should have collected objects.");
freeVM(vm);
}
开发者ID:ChelinTsien,项目名称:mark-sweep,代码行数:12,代码来源:main.c
示例3: CCLOG
void GameNetDelegate::onMessageReceived(const char *data, unsigned short size)
{
CCLOG("onMessageReceived, size is %d %d", size, size - sizeof(CMD_Head));
CMD_Command Command = ((CMD_Head *)data)->CommandInfo;
auto stack = LuaEngine::getInstance()->getLuaStack();
stack->pushInt(Command.wMainCmdID);
stack->pushInt(Command.wSubCmdID);
stack->pushString(data + sizeof(CMD_Head), size - sizeof(CMD_Head));
auto it = m_callBacks.find("onReceived");
stack->executeFunctionByHandler(it->second, 3);
stack->clean();
}
开发者ID:1005491398,项目名称:DDZ,代码行数:13,代码来源:GameNetDelegate.cpp
示例4: luaopen_int64
LUALIB_API int luaopen_int64(lua_State *L)
{
if (sizeof(Int)<8) luaL_error(L,"int64 cannot work with %d-byte values",sizeof(Int));
luaL_newmetatable(L,MYTYPE);
luaL_setfuncs(L,R,0);
lua_pushliteral(L,"version"); /** version */
lua_pushliteral(L,MYVERSION);
lua_settable(L,-3);
pushInt(L,LLONG_MIN);
lua_setfield(L,-2,"min"); /** min */
pushInt(L,LLONG_MAX);
lua_setfield(L,-2,"max"); /** max */
return 1;
}
开发者ID:lindianyin,项目名称:test,代码行数:14,代码来源:lint64.c
示例5: pushInt
void BenchmarkTcpClient::buildWriteChunk() {
if (writeBuffer.empty()) {
if (server) {
if (answerSizeRemain > 0) {
int size = std::min(answerSizeRemain, 1024);
writeBuffer.reserve(size);
for(char *c = (char*)writeBuffer.end(), *end = c + size; c != end; ++c)
*c = (int)random(currentSeed)%256 - 128;
writeBuffer.push(size);
answerSizeRemain -= size;
eventWrite.setTimeRelativeNow();
if (answerSizeRemain <= 0) {
requestSize = -1;
answerSize = -1;
}
}
} else {
int size = std::min(requestSize + 3*(int)sizeof(int), 1024);
writeBuffer.reserve(size);
if (requestsCountRemain == requestsCount) {
pushInt(requestsCount);
requestSizeRemain = requestSize;
}
if (requestSizeRemain == requestSize) {
if (requestsCountRemain <= 0 || requestSize <= 0 || answerSize <= 0)
{ formatError(); return; }
pushInt(requestSize);
pushInt(answerSize);
--requestsCountRemain;
}
if (requestSizeRemain > 0) {
size -= writeBuffer.size();
size = std::min(requestSizeRemain, size);
if (size > 0) {
for(char *c = (char*)writeBuffer.end(), *end = c + size; c != end; ++c)
*c = (int)random(currentSeed)%256 - 128;
currentCrc32 = Packet::crc32(writeBuffer.end(), size, currentCrc32);
writeBuffer.push(size);
requestSizeRemain -= size;
}
if (requestSizeRemain <= 0) {
answerSizeRemain = answerSize;
currentSeed = currentCrc32;
currentCrc32 = 0;
}
eventWrite.setTimeRelativeNow();
}
}
}
}
开发者ID:blackwarthog,项目名称:icetunnel,代码行数:50,代码来源:benchmarktcpclient.cpp
示例6: test3
void test3() {
printf("Test 3: Reach nested objects.\n");
VM* vm = newVM();
pushInt(vm, 1);
pushInt(vm, 2);
pushPair(vm);
pushInt(vm, 3);
pushInt(vm, 4);
pushPair(vm);
pushPair(vm);
gc(vm);
assert(vm->numObjects == 7, "Should have reached objects.");
freeVM(vm);
}
开发者ID:ChelinTsien,项目名称:mark-sweep,代码行数:15,代码来源:main.c
示例7: popInt
void Interpreter::divInts() {
int64_t right = popInt();
int64_t left = popInt();
//cout << "Dividing " << left << " " << right << endl;
pushInt(left / right);
}
开发者ID:nvmd,项目名称:spbau-mathvm,代码行数:7,代码来源:Interpreter.cpp
示例8: topContext
void Interpreter::loadCtxInt() {
FunctionContext* ctx = topContext();
uint16_t ctxId = getNext2Bytes();
uint16_t id = getNext2Bytes();
pushInt(ctx->readInt(ctxId, id));
}
开发者ID:nvmd,项目名称:spbau-mathvm,代码行数:7,代码来源:Interpreter.cpp
示例9: LANDRU_DECL_FN
LANDRU_DECL_FN(ColorVarObj, getInt)
{
ColorVarObj* o = (ColorVarObj*) p->vo.get();
p->stack->pop();
pushInt(p, (int) o->c);
}
开发者ID:meshula,项目名称:Landru,代码行数:7,代码来源:ColorVarObj.cpp
示例10: pushInt
int CCLuaEngine::pushCCLuaValue(const CCLuaValue& value)
{
const CCLuaValueType type = value.getType();
if (type == CCLuaValueTypeInt)
{
return pushInt(value.intValue());
}
else if (type == CCLuaValueTypeFloat)
{
return pushFloat(value.floatValue());
}
else if (type == CCLuaValueTypeBoolean)
{
return pushBoolean(value.booleanValue());
}
else if (type == CCLuaValueTypeString)
{
return pushString(value.stringValue().c_str());
}
else if (type == CCLuaValueTypeDict)
{
pushCCLuaValueDict(value.dictValue());
}
else if (type == CCLuaValueTypeArray)
{
pushCCLuaValueArray(value.arrayValue());
}
else if (type == CCLuaValueTypeCCObject)
{
pushCCObject(value.ccobjectValue(), value.getCCObjectTypename().c_str());
}
return lua_gettop(m_state);
}
开发者ID:JoeHu,项目名称:ccgui,代码行数:34,代码来源:CCLuaEngine.cpp
示例11: unregisterMovementEventHandler
void DBCCArmatureNode::registerMovementEventHandler(cocos2d::LUA_FUNCTION func)
{
unregisterMovementEventHandler();
_movementEventHandler = func;
auto dispatcher = getCCEventDispatcher();
auto f = [this](cocos2d::EventCustom *event)
{
auto eventData = (dragonBones::EventData*)(event->getUserData());
auto type = (int) eventData->getType();
auto movementId = eventData->animationState->name;
auto lastState = eventData->armature->getAnimation()->getLastAnimationState();
auto stack = cocos2d::LuaEngine::getInstance()->getLuaStack();
stack->pushObject(this, "db.DBCCArmatureNode");
stack->pushInt(type);
stack->pushString(movementId.c_str(), movementId.size());
stack->pushBoolean(lastState == eventData->animationState);
stack->executeFunctionByHandler(_movementEventHandler, 4);
};
dispatcher->addCustomEventListener(dragonBones::EventData::COMPLETE, f);
dispatcher->addCustomEventListener(dragonBones::EventData::LOOP_COMPLETE, f);
}
开发者ID:602147629,项目名称:Tui-x,代码行数:26,代码来源:DBCCArmatureNode.cpp
示例12: pushInt
void LuaStack::pushLuaValue(const LuaValue& value)
{
const LuaValueType type = value.getType();
if (type == LuaValueTypeInt)
{
return pushInt(value.intValue());
}
else if (type == LuaValueTypeFloat)
{
return pushFloat(value.floatValue());
}
else if (type == LuaValueTypeBoolean)
{
return pushBoolean(value.booleanValue());
}
else if (type == LuaValueTypeString)
{
return pushString(value.stringValue().c_str());
}
else if (type == LuaValueTypeDict)
{
pushLuaValueDict(value.dictValue());
}
else if (type == LuaValueTypeArray)
{
pushLuaValueArray(value.arrayValue());
}
else if (type == LuaValueTypeObject)
{
pushObject(value.ccobjectValue(), value.getObjectTypename().c_str());
}
}
开发者ID:Ben-Cortina,项目名称:GameBox,代码行数:32,代码来源:CCLuaStack.cpp
示例13: autoMatchResponse
void autoMatchResponse(const boids::MatchResponse& response)
{
auto stack = cocos2d::LuaEngine::getInstance()->getLuaStack();
stack->pushInt(response.ret_value());
stack->pushString(response.ret_info().c_str());
if (response.ret_value() == boids::MatchResponse_Value_Success)
{
cocos2d::log("autoMatch success. ip: %s, port: %d", response.game_server_ip().c_str(), response.game_server_port());
if (NetworkAdapter::getInstance()->init(response.game_server_ip(), response.game_server_port()))
{
processGameInit(response.game_init_data(), stack);
stack->executeFunctionByHandler(autoMatchCallback, 3);
}
else
{
cocos2d::log("[ERROR] udp init failed !");
}
}
else
{
cocos2d::log("autoMatch error: %d %s", response.ret_value(), response.ret_info().c_str());
stack->executeFunctionByHandler(autoMatchCallback, 2);
}
}
开发者ID:wyrover,项目名称:boids,代码行数:25,代码来源:Net.cpp
示例14: op_aload_0
//--------------------------------------------------------------------------------
// aload_0
int op_aload_0( unsigned char **opCode, StackFrame *stack, SimpleConstantPool *p ) {
pushInt(stack, 0);
#if SIMPLE_JVM_DEBUG
printf("push 0 into stack\n");
#endif
*opCode = *opCode + 1;
return 0;
}
开发者ID:wicanr2,项目名称:simple_jvm_and_dvm,代码行数:10,代码来源:simple_jvm_bytecodes.c
示例15: op_iconst_5
// iconst_5
int op_iconst_5( unsigned char **opCode, StackFrame *stack, SimpleConstantPool *p ) {
pushInt(stack, 5);
#if SIMPLE_JVM_DEBUG
printf("iconst_5: push 5 into stack\n");
#endif
*opCode = *opCode + 1;
return 0;
}
开发者ID:wicanr2,项目名称:simple_jvm_and_dvm,代码行数:9,代码来源:simple_jvm_bytecodes.c
示例16: luaopen_int64
int luaopen_int64(lua_State *L)
{
if (sizeof(Int)<8) luaL_error(L,"int64 cannot work with %d-byte values",sizeof(Int));
luaL_newmetatable(L, MYTYPE); /*stack: mt*/
lua_setglobal(L, MYNAME); /*_G[MYNAME] = mt stack: */
luaL_register(L, MYNAME, R); /*_G[MYNAME].__add = ..., _G[MYNAME].__div = ldiv.. stack: mt*/
lua_pushliteral(L,"version"); /** version */
lua_pushliteral(L, MYVERSION);
lua_settable(L,-3); /*mt[version] = MYVERSION, stack:mt*/
pushInt(L,LLONG_MIN);
lua_setfield(L,-2,"min"); /** min */
pushInt(L,LLONG_MAX);
lua_setfield(L,-2,"max"); /** max */
lua_pop(L, 1);
return 0;
}
开发者ID:caiguangwen1,项目名称:test,代码行数:17,代码来源:lint64.cpp
示例17: test4
void test4() {
printf("Test 4: Handle cycles.\n");
VM* vm = newVM();
pushInt(vm, 1);
pushInt(vm, 2);
Object* a = pushPair(vm);
pushInt(vm, 3);
pushInt(vm, 4);
Object* b = pushPair(vm);
a->tail = b;
b->tail = a;
gc(vm);
assert(vm->numObjects == 4, "Should have collected objects.");
freeVM(vm);
}
开发者ID:ChelinTsien,项目名称:mark-sweep,代码行数:17,代码来源:main.c
示例18: op_iload_3
//iload_3
int op_iload_3( unsigned char **opCode, StackFrame *stack, SimpleConstantPool *p ) {
int value = localVariables.integer[3];
#if SIMPLE_JVM_DEBUG
printf("iload_3: load value from local variable 3(%d)\n",localVariables.integer[3]);
#endif
pushInt(stack, value);
*opCode = *opCode + 1;
return 0;
}
开发者ID:wicanr2,项目名称:simple_jvm_and_dvm,代码行数:10,代码来源:simple_jvm_bytecodes.c
示例19: op_getstatic
/*
* Execute the GETSTATIC instruction
*/
void op_getstatic() {
Ref field = resolve(u16(1), ID_FIELD);
if (field == NULL) { return; } // rollback
// read field values
Ref type = getRef(field, ENTRY_OWNER);
Ref statics = getRef(type, TYPE_STATICS);
Int index = getInt(field, FIELD_INDEX);
Int flag = getInt(field, FIELD_REFERENCE_FLAG);
Int size = getInt(field, FIELD_SIZE);
int offset = STATICS_FIELDS + index;
// read values and push on stack
if (flag) { pushRef(getRef(statics, offset)); }
else { pushInt(getInt(statics, offset)); }
if (size == 2) { pushInt(getInt(statics, offset + 1)); }
pc += 3;
}
开发者ID:ahua,项目名称:java,代码行数:21,代码来源:field.c
示例20: op_bipush
//bipush
int op_bipush( unsigned char **opCode, StackFrame *stack, SimpleConstantPool *p ) {
int value = opCode[0][1];
pushInt(stack, value);
#if SIMPLE_JVM_DEBUG
printf("push a byte %d onto the stack \n", value);
#endif
*opCode = *opCode + 2;
return 0;
}
开发者ID:wicanr2,项目名称:simple_jvm_and_dvm,代码行数:10,代码来源:simple_jvm_bytecodes.c
注:本文中的pushInt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论