static struct pbc_wmessage * test_wmessage(struct pbc_env * env) { struct pbc_wmessage * msg = pbc_wmessage_new(env, "real"); pbc_wmessage_real(msg, "f", 1.0); pbc_wmessage_real(msg, "d" , 4.0); //pbc_wmessage_integer(msg,"e",4294967295,9223372032559808512); return msg; }
static int _wmessage_real(lua_State *L) { struct pbc_wmessage * m = (struct pbc_wmessage *)checkuserdata(L,1); const char * key = luaL_checkstring(L,2); double number = luaL_checknumber(L,3); pbc_wmessage_real(m, key, number); return 0; }
static struct pbc_wmessage * test_wmessage(struct pbc_env * env) { struct pbc_wmessage * msg = pbc_wmessage_new(env, "test"); int i; for ( i = 0;i<5;i++) { struct pbc_wmessage * element = pbc_wmessage_message(msg , "el"); pbc_wmessage_string(element , "str", "abcedf" , -1); pbc_wmessage_integer(element, "int8_min", 1*(i+1),0); pbc_wmessage_integer(element, "int8_max", 2*(i+1),0); pbc_wmessage_integer(element, "uint8_min", 3*(i+1),0); pbc_wmessage_integer(element, "uint8_max", 4*(i+1),0); pbc_wmessage_integer(element, "int16_min", 5*(i+1),0); pbc_wmessage_integer(element, "int16_max", 6*(i+1),0); pbc_wmessage_integer(element, "uint16_min", 7*(i+1),0); pbc_wmessage_integer(element, "uint16_max", 8*(i+1),0); pbc_wmessage_integer(element, "int32_min", 9*(i+1),0); pbc_wmessage_integer(element, "int32_max", 10*(i+1),0); pbc_wmessage_integer(element, "uint32_min", 11*(i+1),0); pbc_wmessage_integer(element, "uint32_max", 12*(i+1),0); pbc_wmessage_integer(element, "int64_min", 13*(i+1),0); pbc_wmessage_integer(element, "int64_max", 14*(i+1),0); pbc_wmessage_integer(element, "uint64_min", 15*(i+1),0); pbc_wmessage_integer(element, "uint64_max", 16*(i+1),0); pbc_wmessage_real(element, "double_min", 17*(i+1)); pbc_wmessage_real(element, "double_max", 18*(i+1)); } return msg; }