void initialize(const QApplication& app) { const auto appdir = app.applicationDirPath(); initialize_value(appdir, "config/is_authorized", subara::config::is_authorized); initialize_value(appdir, "config/oauth_token", subara::config::oauth_token); initialize_value(appdir, "config/oauth_token_secret", subara::config::oauth_token_secret); }
static void add_static_variables(MVM_VirtualMachine *mvm, MVM_Executable *exe) { int i; MVM_Class *pos = exe->class_definition; mvm->static_v.variable = MEM_malloc(sizeof(MVM_Value) * exe->global_variable_count); mvm->static_v.variable_count = exe->global_variable_count; for (i = 0; i < exe->global_variable_count; i++) { if (exe->global_variable[i].type->basic_type == MVM_STRING_TYPE) { mvm->static_v.variable[i].object = NULL; } else if(exe->global_variable[i].type->basic_type == MVM_CLASS_TYPE) { mvm->static_v.variable[i].object = malloc(sizeof(MVM_Object)); mvm->static_v.variable[i].object->type = CLASS_OBJECT; mvm->static_v.variable[i].object->u.class_object.field_count = exe->class_definition->field_count; mvm->static_v.variable[i].object->u.class_object.field = malloc(sizeof(MVM_Value)*exe->class_definition->field_count); } } for (i = 0; i < exe->global_variable_count; i++) { initialize_value(mvm, exe->global_variable[i].type, &mvm->static_v.variable[i]); } }
int main(int argc, char **argv, char **env) { t_tetris game; t_list list; bool files; files = true; initialize_struct(&game); initialize_value(&game, argv[0], env); if (argc > 1) options(&game, argc, argv); init_list(&list); files = (!(initialize_files(&list, &game))) ? false : true; if (game.debug == true) mode_debug(&game, list); game.list = list; if (files == true) { if ((game.scene->rows + 2 > (tgetnum("lines"))) || (game.scene->colums + 43 > (tgetnum("cols")))) my_puterr("Terminal too small\n"); else if ((check_one_valid(&list)) == 1) initialize_game(&game); } my_free(&game, &list); endwin(); return (0); }
static void initialize_local_variables(MVM_VirtualMachine *mvm, MVM_Function *func, int from_sp) { int i; int sp_idx; for (i = 0, sp_idx = from_sp; i < func->local_variable_count; i++, sp_idx++) { mvm->stack.pointer_flags[i] = MVM_FALSE; } for (i = 0, sp_idx = from_sp; i < func->local_variable_count; i++, sp_idx++) { initialize_value(mvm, func->local_variable[i].type, &mvm->stack.stack[sp_idx]); if (func->local_variable[i].type->basic_type == MVM_STRING_TYPE) { mvm->stack.pointer_flags[i] = MVM_TRUE; } } }
void floating_point(double value) { initialize_value(value); complete_value(); }
void integer(std::int64_t value) { initialize_value(value); complete_value(); }
void datetime(const std::string &value) { initialize_value(value); complete_value(); }
void string(const std::string &value) { initialize_value(value); complete_value(); }
void boolean(bool value) { initialize_value(value); complete_value(); }
void start_inline_table() { initialize_value(kora::dynamic_t::object_t()); }
void start_array() { initialize_value(kora::dynamic_t::array_t()); }