/************************************************************************ * * * implant( par, param ) - Implant calculates a simple gaussian * * or a pearson model of an implant. * * * * Original: MEL 1/85 * * * ************************************************************************/ int implant( char * par, int param ) { register int i, j; int imp, impa, ion, sol; int isol, vsol; int damage; double dose, energy; struct tms before, after; double ang; if( InvalidMeshCheck()) return -1; /*get the impurity number of the place to put the implant*/ if (imp_select( param, &imp, &ion ) == -1) return(-1); sol = imptosol[imp]; /*get the main descriptive values for the implant*/ dose = get_float( param, "dose" ); energy = get_float( param, "energy" ); /*get the model type for this implant*/ if ( get_bool( param, "pearson" ) ) imp_model = PEARS; else if ( get_bool( param, "gaussian" ) ) imp_model = GAUSS; /*check for override of the model values*/ if ( is_specified( param, "range" ) && is_specified( param, "std.dev" ) ) { override = TRUE; Rp = get_float( param, "range" ); delRp = get_float( param, "std.dev" ); Rgam = get_float( param, "gamma" ); Rkurt = get_float( param, "kurtosis" ); }
char * playback_get_title (void) { g_return_val_if_fail (playing, NULL); wait_until_ready (); char s[32]; if (current_length) { int len = current_length / 1000; if (len < 3600) snprintf (s, sizeof s, get_bool (NULL, "leading_zero") ? " (%02d:%02d)" : " (%d:%02d)", len / 60, len % 60); else snprintf (s, sizeof s, " (%d:%02d:%02d)", len / 3600, (len / 60) % 60, len % 60); } else s[0] = 0; if (get_bool (NULL, "show_numbers_in_pl")) return str_printf ("%d. %s%s", 1 + playlist_get_position (playlist_get_playing ()), current_title, s); return str_printf ("%s%s", current_title, s); }
void init_conf(map<string,string>& config,Configuration& conf) { conf.TEST_CASE_NUM=get_num(config["TEST_CASE_NUM"]); conf.CAPACITY_NUM=get_num(config["CAPACITY_NUM"]); conf.CREATE_SLICE=get_bool(config["CREATE_SLICE"]); conf.OUTPUT_PATH=config["OUTPUT_PATH"]; conf.Multi_Test_Case=get_bool(config["Multi_Test_Case"]); }
static int read_old_format(struct G_3dview *v, FILE * fp) { char buffer[80]; int req_keys = 0; double td; char boo[8]; strcpy((v->pgm_id), "d.3d"); if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[1][0]))) ++req_keys; if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[1][1]))) ++req_keys; if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[1][2]))) ++req_keys; if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[0][0]))) ++req_keys; if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[0][1]))) ++req_keys; if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->from_to[0][2]))) ++req_keys; if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->exag))) ++req_keys; sscanf(fgets(buffer, 80, fp), "%d", &(v->mesh_freq)); if (1 == sscanf(fgets(buffer, 80, fp), "%f", &(v->fov))) ++req_keys; if (1 == sscanf(fgets(buffer, 80, fp), "%lf", &td)) { /* resolution */ v->vwin.rows = (v->vwin.north - v->vwin.south) / td; v->vwin.cols = (v->vwin.east - v->vwin.west) / td; v->vwin.ew_res = v->vwin.ns_res = td; } sscanf(fgets(buffer, 80, fp), "%s", boo); /* linesonly */ v->display_type = get_bool(boo) ? 1 : 3; sscanf(fgets(buffer, 80, fp), "%s", boo); v->dozero = get_bool(boo); sscanf(fgets(buffer, 80, fp), "%s", v->grid_col); if (!strcmp(v->grid_col, "color")) v->colorgrid = 1; sscanf(fgets(buffer, 80, fp), "%s", v->other_col); sscanf(fgets(buffer, 80, fp), "%s", v->bg_col); sscanf(fgets(buffer, 80, fp), "%s", boo); v->doavg = get_bool(boo); if (v->exag) { /* old 3d.view files saved height with no exag */ v->from_to[0][2] /= v->exag; v->from_to[1][2] /= v->exag; } fclose(fp); if (req_keys == REQ_KEYS) return (1); else return (-1); }
gboolean mpris_player_get_status(MprisPlayer * obj, GValueArray * *status, GError * *error) { *status = g_value_array_new(4); append_int_value(*status, (gint) get_playback_status()); append_int_value (* status, get_bool (NULL, "shuffle")); append_int_value (* status, get_bool (NULL, "no_playlist_advance")); append_int_value (* status, get_bool (NULL, "repeat")); return TRUE; }
static int get_not_cond(char **p) { int cond; const char *tok = odbc_get_tok(p); if (!tok) odbc_fatal(": wrong condition syntax\n"); if (!strcmp(tok, "not")) cond = !get_bool(odbc_get_tok(p)); else cond = get_bool(tok); return cond; }
bool dsm_options_bogofilter(int option, const char *name, const char *val) { switch (option) { case O_DB_TRANSACTION: eTransaction = get_txn(name, val); return true; #ifdef HAVE_DECL_DB_CREATE case O_DB_LOG_AUTOREMOVE: db_log_autoremove = get_bool(name, val); return true; #ifdef FUTURE_DB_OPTIONS case O_DB_TXN_DURABLE: db_txn_durable = get_bool(name, val); return true; #endif #endif default: return false; } }
void Flag::print_on(outputStream* st, bool withComments) { st->print("%9s %-40s %c= ", type, name, (origin != DEFAULT ? ':' : ' ')); if (is_bool()) st->print("%-16s", get_bool() ? "true" : "false"); if (is_intx()) st->print("%-16ld", get_intx()); if (is_uintx()) st->print("%-16lu", get_uintx()); if (is_uint64_t()) st->print("%-16lu", get_uint64_t()); if (is_double()) st->print("%-16f", get_double()); if (is_ccstr()) { const char* cp = get_ccstr(); if (cp != NULL) { const char* eol; while ((eol = strchr(cp, '\n')) != NULL) { char format_buffer[FORMAT_BUFFER_LEN]; size_t llen = pointer_delta(eol, cp, sizeof(char)); jio_snprintf(format_buffer, FORMAT_BUFFER_LEN, "%%." SIZE_FORMAT "s", llen); st->print(format_buffer, cp); st->cr(); cp = eol+1; st->print("%5s %-35s += ", "", name); } st->print("%-16s", cp); } else st->print("%-16s", ""); } st->print("%-20s", kind); if (withComments) { #ifndef PRODUCT st->print("%s", doc ); #endif } st->cr(); }
void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype) { if (outtype == intype) { *(DWORD *)outdata = *(DWORD *)indata; return; } switch (outtype) { case D3DXPT_FLOAT: *(FLOAT *)outdata = get_float(intype, indata); break; case D3DXPT_BOOL: *(BOOL *)outdata = get_bool(intype, indata); break; case D3DXPT_INT: *(INT *)outdata = get_int(intype, indata); break; default: FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(outtype)); *(DWORD *)outdata = 0; break; } }
const char * parse_setting_from_defs(pool_t pool, const struct setting_def *defs, void *base, const char *key, const char *value) { const struct setting_def *def; for (def = defs; def->name != NULL; def++) { if (strcmp(def->name, key) == 0) { void *ptr = STRUCT_MEMBER_P(base, def->offset); switch (def->type) { case SET_STR: *((char **)ptr) = p_strdup(pool, value); return NULL; case SET_INT: /* use %i so we can handle eg. 0600 as octal value with umasks */ return get_uint(value, (unsigned int *) ptr); case SET_BOOL: return get_bool(value, (bool *) ptr); } } } return t_strconcat("Unknown setting: ", key, NULL); }
/* ECMA-262 3rd Edition 9.2 */ HRESULT to_boolean(jsval_t val, BOOL *ret) { switch(jsval_type(val)) { case JSV_UNDEFINED: case JSV_NULL: *ret = FALSE; return S_OK; case JSV_OBJECT: *ret = get_object(val) != NULL; return S_OK; case JSV_STRING: *ret = jsstr_length(get_string(val)) != 0; return S_OK; case JSV_NUMBER: *ret = !isnan(get_number(val)) && get_number(val); return S_OK; case JSV_BOOL: *ret = get_bool(val); return S_OK; case JSV_VARIANT: FIXME("unimplemented for variant %s\n", debugstr_variant(get_variant(val))); return E_NOTIMPL; } assert(0); return E_FAIL; }
void Write::select_type(int a, void*p, std::string &str) { switch(a) { case jyjson_string: get_string(p,str); break; case jyjson_numint: get_int(p,str); break; case jyjson_numdouble: get_double(p,str); break; case jyjson_object: get_object(p,str); break; case jyjson_array: get_array(p,str); break; case jyjson_bool: get_bool(p,str); break; case jyjson_null: get_null(p,str); break; case jyjson_nothing: break; } }
options_iterate(curr_options, poption) { switch (option_type(poption)) { case OT_BOOLEAN: option_bool_set(poption, get_bool(poption)); break; case OT_INTEGER: option_int_set(poption, get_int(poption)); break; case OT_STRING: option_str_set(poption, get_string(poption)); break; case OT_ENUM: option_enum_set_int(poption, get_enum(poption)); break; case OT_BITWISE: option_bitwise_set(poption, get_bitwise(poption)); break; case OT_FONT: option_font_set(poption, get_button_font(poption)); break; case OT_COLOR: option_color_set(poption, get_color(poption)); break; case OT_VIDEO_MODE: log_error("Option type %s (%d) not supported yet.", option_type_name(option_type(poption)), option_type(poption)); break; } } options_iterate_end;
svn_error_t * svn_config_get_yes_no_ask(svn_config_t *cfg, const char **valuep, const char *section, const char *option, const char* default_value) { const char *tmp_value; svn_config_get(cfg, &tmp_value, section, option, NULL); if (! tmp_value) tmp_value = default_value; if (tmp_value && (0 == svn_cstring_casecmp(tmp_value, SVN_CONFIG_ASK))) { *valuep = SVN_CONFIG_ASK; } else { svn_boolean_t bool_val; /* We already incorporated default_value into tmp_value if necessary, so the FALSE below will be ignored unless the caller is doing something it shouldn't be doing. */ SVN_ERR(get_bool(&bool_val, tmp_value, FALSE, section, option)); *valuep = bool_val ? SVN_CONFIG_TRUE : SVN_CONFIG_FALSE; } return SVN_NO_ERROR; }
T get( const field_desc_type *fld ) const { switch(fld->cpp_type( )) { case field_desc_type::CPPTYPE_INT32: return boost::lexical_cast<T>(get_int32(fld)); case field_desc_type::CPPTYPE_INT64: return boost::lexical_cast<T>(get_int64(fld)); case field_desc_type::CPPTYPE_UINT32: return boost::lexical_cast<T>(get_uint32(fld)); case field_desc_type::CPPTYPE_UINT64: return boost::lexical_cast<T>(get_uint64(fld)); case field_desc_type::CPPTYPE_FLOAT: return boost::lexical_cast<T>(get_float(fld)); case field_desc_type::CPPTYPE_DOUBLE: return boost::lexical_cast<T>(get_double(fld)); case field_desc_type::CPPTYPE_ENUM: return boost::lexical_cast<T>(get_enum(fld)->number()); case field_desc_type::CPPTYPE_STRING: return boost::lexical_cast<T>(get_string(fld)); case field_desc_type::CPPTYPE_BOOL: return boost::lexical_cast<T>(get_bool(fld)); case field_desc_type::CPPTYPE_MESSAGE: throw std::bad_cast( ); default: return T( ); } }
svn_error_t * svn_config_get_tristate(svn_config_t *cfg, svn_tristate_t *valuep, const char *section, const char *option, const char *unknown_value, svn_tristate_t default_value) { const char *tmp_value; svn_config_get(cfg, &tmp_value, section, option, NULL); if (! tmp_value) { *valuep = default_value; } else if (0 == svn_cstring_casecmp(tmp_value, unknown_value)) { *valuep = svn_tristate_unknown; } else { svn_boolean_t bool_val; /* We already incorporated default_value into tmp_value if necessary, so the FALSE below will be ignored unless the caller is doing something it shouldn't be doing. */ SVN_ERR(get_bool(&bool_val, tmp_value, FALSE, section, option)); *valuep = bool_val ? svn_tristate_true : svn_tristate_false; } return SVN_NO_ERROR; }
MemoryServer::MemoryServer(const char *name, string_map_t *opts) : FileServer(name, opts) { m_private_memory = get_bool(m_options, "Private", false); m_inode = 0; m_volsize = get_int(m_options, "VolumeSize", 1 << 28); m_root.name = "/"; m_root.stat.fs_ino = ++m_inode; m_root.stat.fs_size = 0; m_root.stat.fs_blocks = m_volsize >> 12; m_root.stat.fs_atime = m_root.stat.fs_mtime = m_root.stat.fs_ctime = time(0); m_root.stat.fs_mode = S_IFDIR | 0755; m_root.stat.fs_nlink = 2; m_root.stat.fs_uid = 65534; m_root.stat.fs_gid = 65534; m_root.stat.fs_blksize = 4096; m_fs_stat.f_block_size = 1 << 12; m_fs_stat.f_fragment_size = 1 << 12; m_fs_stat.f_blocks = m_volsize >> 12; m_fs_stat.f_used_blocks = 1; m_fs_stat.f_free_blocks = m_fs_stat.f_blocks - m_fs_stat.f_used_blocks; m_fs_stat.f_total_inodes = m_volsize >> 12; m_fs_stat.f_used_inodes = 1; m_fs_stat.f_free_inodes = m_fs_stat.f_total_inodes - m_fs_stat.f_used_inodes; m_fs_stat.f_fsid = 0xAF000077; m_fs_stat.f_flags = 0; m_fs_stat.f_namemax = 1024; }
gboolean mpris_emit_status_change(MprisPlayer * obj, PlaybackStatus status) { GValueArray *ar = g_value_array_new(4); if (status == MPRIS_STATUS_INVALID) status = get_playback_status (); append_int_value(ar, (gint) status); append_int_value (ar, get_bool (NULL, "shuffle")); append_int_value (ar, get_bool (NULL, "no_playlist_advance")); append_int_value (ar, get_bool (NULL, "repeat")); g_signal_emit(obj, signals[STATUS_CHANGE_SIG], 0, ar); g_value_array_free(ar); return TRUE; }
void Flag::print_as_flag(outputStream* st) { if (is_bool()) { st->print("-XX:%s%s", get_bool() ? "+" : "-", name); } else if (is_intx()) { st->print("-XX:%s=" INTX_FORMAT, name, get_intx()); } else if (is_uintx()) { st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx()); } else if (is_uint64_t()) { st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t()); } else if (is_double()) { st->print("-XX:%s=%f", name, get_double()); } else if (is_ccstr()) { st->print("-XX:%s=", name); const char* cp = get_ccstr(); if (cp != NULL) { // Need to turn embedded '\n's back into separate arguments // Not so efficient to print one character at a time, // but the choice is to do the transformation to a buffer // and print that. And this need not be efficient. for (; *cp != '\0'; cp += 1) { switch (*cp) { default: st->print("%c", *cp); break; case '\n': st->print(" -XX:%s=", name); break; } } } } else { ShouldNotReachHere(); } }
void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype) { TRACE("Changing from type %s to type %s\n", debug_d3dxparameter_type(intype), debug_d3dxparameter_type(outtype)); if (outtype == intype) { *(DWORD *)outdata = *(DWORD *)indata; return; } switch (outtype) { case D3DXPT_FLOAT: *(FLOAT *)outdata = get_float(intype, indata); break; case D3DXPT_BOOL: *(BOOL *)outdata = get_bool(intype, indata); break; case D3DXPT_INT: *(INT *)outdata = get_int(intype, indata); break; default: FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(outtype)); *(DWORD *)outdata = 0; break; } }
void drct_pl_next (void) { int playlist = playlist_get_playing (); if (playlist < 0) playlist = playlist_get_active (); playlist_next_song (playlist, get_bool (NULL, "repeat")); }
bool JsonIn::read(bool &b) { if (!test_bool()) { return false; } b = get_bool(); return true; }
static e_txn get_txn(const char *name, const char *arg) { e_txn t = get_bool(name, arg) ? T_ENABLED : T_DISABLED; if (DEBUG_CONFIG(2)) fprintf(dbgout, "%s -> %s\n", name, t ? "enabled" : "disabled"); return t; }
void drct_pl_next (void) { gboolean play = playback_get_playing (); if (playlist_get_playing () < 0) playlist_set_playing (playlist_get_active ()); if (playlist_next_song (playlist_get_playing (), get_bool (NULL, "repeat")) && play) playback_play (0, FALSE); }
int main() { std::thread([&]{ set_bool(true); }).detach(); while (!get_bool()) { std::this_thread::yield(); } }
svn_error_t * svn_config_get_bool(svn_config_t *cfg, svn_boolean_t *valuep, const char *section, const char *option, svn_boolean_t default_value) { const char *tmp_value; svn_config_get(cfg, &tmp_value, section, option, NULL); return get_bool(valuep, tmp_value, default_value, section, option); }
PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL void Flag::print_on(outputStream* st, bool withComments) { // Don't print notproduct and develop flags in a product build. if (is_constant_in_binary()) { return; } st->print("%9s %-40s %c= ", _type, _name, (!is_default() ? ':' : ' ')); if (is_bool()) { st->print("%-16s", get_bool() ? "true" : "false"); } if (is_intx()) { st->print("%-16ld", get_intx()); } if (is_uintx()) { st->print("%-16lu", get_uintx()); } if (is_uint64_t()) { st->print("%-16lu", get_uint64_t()); } if (is_double()) { st->print("%-16f", get_double()); } if (is_ccstr()) { const char* cp = get_ccstr(); if (cp != NULL) { const char* eol; while ((eol = strchr(cp, '\n')) != NULL) { char format_buffer[FORMAT_BUFFER_LEN]; size_t llen = pointer_delta(eol, cp, sizeof(char)); jio_snprintf(format_buffer, FORMAT_BUFFER_LEN, "%%." SIZE_FORMAT "s", llen); PRAGMA_DIAG_PUSH PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(format_buffer, cp); PRAGMA_DIAG_POP st->cr(); cp = eol+1; st->print("%5s %-35s += ", "", _name); } st->print("%-16s", cp); } else st->print("%-16s", ""); } st->print("%-20s", " "); print_kind(st); if (withComments) { #ifndef PRODUCT st->print("%s", _doc); #endif } st->cr(); }
bool SendingMessage::parse_value_only(char* src, struct MessageComponent* newcomp) { char valueOnly[KEYWORD_SIZE]; getKeywordParam(src, "value_only=", valueOnly); if (valueOnly[0] != '\0') { newcomp->valueOnly = get_bool(valueOnly , "Value Only"); return true; } return false; }
void SendingMessage::parse_generated(char* src, struct MessageComponent* newcomp) { char generated[KEYWORD_SIZE]; getKeywordParam(src, "generated=", generated); if (generated[0]!='\0') { newcomp->auto_generate_remote_tag = get_bool(generated, "Generated"); } else { newcomp->auto_generate_remote_tag = false; } }
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv) { switch(jsval_type(val)) { case JSV_UNDEFINED: V_VT(retv) = VT_EMPTY; return S_OK; case JSV_NULL: V_VT(retv) = VT_NULL; return S_OK; case JSV_OBJECT: V_VT(retv) = VT_DISPATCH; if(get_object(val)) IDispatch_AddRef(get_object(val)); V_DISPATCH(retv) = get_object(val); return S_OK; case JSV_STRING: { jsstr_t *str = get_string(val); V_VT(retv) = VT_BSTR; if(str->length_flags & JSSTR_FLAG_NULLBSTR) { V_BSTR(retv) = NULL; } else { V_BSTR(retv) = SysAllocStringLen(NULL, jsstr_length(str)); if(V_BSTR(retv)) jsstr_flush(str, V_BSTR(retv)); else return E_OUTOFMEMORY; } return S_OK; } case JSV_NUMBER: { double n = get_number(val); if(is_int32(n)) { V_VT(retv) = VT_I4; V_I4(retv) = n; } else { V_VT(retv) = VT_R8; V_R8(retv) = n; } return S_OK; } case JSV_BOOL: V_VT(retv) = VT_BOOL; V_BOOL(retv) = get_bool(val) ? VARIANT_TRUE : VARIANT_FALSE; return S_OK; case JSV_VARIANT: V_VT(retv) = VT_EMPTY; return VariantCopy(retv, get_variant(val)); } assert(0); return E_FAIL; }