static bool load_content_from_settings_file(json_t *settings_json, const char *settings_file) { bool return_value = false; config_file = get_str_value(settings_json, "config_file"); werr2(config_file == NULL, goto _finish, "There is no config_file entry in %s", settings_file); home = get_str_value(settings_json, "home"); werr2(home == NULL, goto _finish, "There is no home entry in %s", settings_file); mount_file = get_str_value(settings_json, "mount_file"); werr2(mount_file == NULL, goto _finish, "There is no mount_file entry in %s", settings_file); build_file = get_str_value(settings_json, "build_file"); werr2(build_file == NULL, goto _finish, "There is no build_file entry in %s", settings_file); shell = get_str_value(settings_json, "shell"); werr2(shell == NULL, goto _finish, "There is no shell entry in %s", settings_file); run = get_str_value(settings_json, "run"); werr2(run == NULL, goto _finish, "There is no run entry in %s", settings_file); stop = get_str_value(settings_json, "stop"); werr2(stop == NULL, goto _finish, "There is no stop entry in %s", settings_file); poweroff = get_str_value(settings_json, "poweroff"); werr2(poweroff == NULL, goto _finish, "There is no poweroff entry in %s", settings_file); logout_path = get_str_value(settings_json, "hlogout"); if (logout_path == NULL) { logout_path = LOCAL_STDOUT_PATH; } logerr_path = get_str_value(settings_json, "hlogerr"); if (logerr_path == NULL) { logerr_path = LOCAL_STDERR_PATH; } /* Success */ return_value = true; _finish: ; return return_value; }
void solid_import(solid_vm *vm) { char *input = get_str_value(pop_stack(vm)); char *dot = strrchr(input, '.'); char *extension; if (!dot || dot == input) { extension = ""; } extension = dot + 1; if (strcmp(extension, "sol") == 0) { solid_object *func = parse_tree(parse_file(input)); solid_call_func(vm, func); } else if (strcmp(extension, "so") == 0) { void *handle = dlopen(input, RTLD_LAZY); void (*init)(solid_vm *); if (handle == NULL) { log_err("Loading external library %s failed with error %s", input, dlerror()); } dlerror(); *(void **) (&init) = dlsym(handle, "solid_init"); init(vm); //dlclose(handle); } }
static bool load_content_from_config_file(json_t *config_json, const char *config_file) { bool return_value = false; jid = get_str_value(config_json, "jid"); werr2(jid == NULL, goto _finish, "There is no jid entry in %s", config_file); password = get_str_value(config_json, "password"); werr2(password == NULL, goto _finish, "There is no password entry in %s", config_file); owner = get_str_value(config_json, "owner"); werr2(owner == NULL, goto _finish, "There is no owner entry in %s", config_file); ssid = get_str_value(config_json, "ssid"); psk = get_str_value(config_json, "psk"); /* Set privacy based on privacy value from wyliodrin.json (if exists) */ json_t *privacy_json = json_object_get(config_json, "privacy"); if (privacy_json != NULL && json_is_boolean(privacy_json) && json_is_true(privacy_json)) { privacy = true; } const char *pong_timeout_str = get_str_value(config_json, "pong_timeout"); if (pong_timeout_str != NULL) { char *pEnd; pong_timeout = strtol(pong_timeout_str, &pEnd, 10); if (pong_timeout == 0) { pong_timeout = DEFAULT_PONG_TIMEOUT; } } /* Success */ return_value = true; _finish: ; return return_value; }
void solid_compile(solid_vm *vm) { vm->regs[255] = parse_tree(parse_expr(get_str_value(pop_stack(vm)))); }
void Exp_A_CInt::Dump( std::ostream& os, const std::vector<std::shared_ptr<ParamSpec> >& param_specs) const { os << get_str_value(); }