Beispiel #1
0
void unload_gs(void){

	store_double("Operation", "OutputGain", gs->OutputGain);
	store_double("Operation", "Ch0Gain", gs->Ch0Gain);
	store_double("Operation", "Ch1Gain", gs->Ch1Gain);
	store_double("Operation", "Ch2Gain", gs->Ch2Gain);

	store_int("Task","Priority",gs->task_prio);
}
void unload_gs(void){	//block specific

	store_string("Operation", "Wave", gs->wave);

	store_double("Operation", "DC", gs->wave_dc);
	store_double("Operation", "Amplitude", gs->wave_amp);
	store_double("Operation", "Frequency", gs->wave_freq);
	store_double("Operation", "DutyCycle", gs->wave_duty);

	store_int("Task","Priority",gs->task_prio);
}
Beispiel #3
0
void FileAccess::store_real(real_t p_real) {

	if (sizeof(real_t) == 4)
		store_float(p_real);
	else
		store_double(p_real);
}
Beispiel #4
0
//
// store a double in the set
PyObject *PyStorageSet_storeDouble(PyObject *self, PyObject *args) { 
  char  *key = NULL;
  double val = 0;
  PYSTORE_PARSE(args, key, val, "sd");
  store_double(((PyStorageSet *)self)->set, key, val);
  return Py_BuildValue("i", 1);
}
Beispiel #5
0
STORAGE_SET *containerDataStore(CONTAINER_DATA *data) {
  STORAGE_SET *set = new_storage_set();
  store_double(set, "capacity", data->capacity);
  store_string(set, "key",      data->key);
  store_int   (set, "pick_diff",data->pick_diff);
  store_int   (set, "closable", data->closable);
  store_int   (set, "closed",   data->closed);
  store_int   (set, "locked",   data->locked);
  return set;
}
void unload_gs(void){

	/*
	 * Change this code.
	 */
	store_string("Operation", "aString", gs->aString);
	store_int("Operation", "anInt", gs->anInt);
	store_double("Operation", "aDouble", gs->aDouble);
	store_matrix("Operation","aMatrix",&gs->aMatrix);

	store_int("Task","Priority",gs->task_prio);
}
Beispiel #7
0
static int
opt_set(void *opts, const struct opt_def *def, const char **val,
	struct region *region, uint32_t errcode, uint32_t field_no)
{
	int64_t ival;
	uint64_t uval;
	char *errmsg = tt_static_buf();
	double dval;
	uint32_t str_len;
	const char *str;
	char *ptr;
	char *opt = ((char *) opts) + def->offset;
	switch (def->type) {
	case OPT_BOOL:
		if (mp_typeof(**val) != MP_BOOL)
			goto type_mismatch_err;
		store_bool(opt, mp_decode_bool(val));
		break;
	case OPT_UINT32:
		if (mp_typeof(**val) != MP_UINT)
			goto type_mismatch_err;
		uval = mp_decode_uint(val);
		if (uval > UINT32_MAX)
			goto type_mismatch_err;
		store_u32(opt, uval);
		break;
	case OPT_INT64:
		if (mp_read_int64(val, &ival) != 0)
			goto type_mismatch_err;
		store_u64(opt, ival);
		break;
	case OPT_FLOAT:
		if (mp_read_double(val, &dval) != 0)
			goto type_mismatch_err;
		store_double(opt, dval);
		break;
	case OPT_STR:
		if (mp_typeof(**val) != MP_STR)
			goto type_mismatch_err;
		str = mp_decode_str(val, &str_len);
		str_len = MIN(str_len, def->len - 1);
		memcpy(opt, str, str_len);
		opt[str_len] = '\0';
		break;
	case OPT_STRPTR:
		if (mp_typeof(**val) != MP_STR)
			goto type_mismatch_err;
		str = mp_decode_str(val, &str_len);
		if (str_len > 0) {
			ptr = (char *) region_alloc(region, str_len + 1);
			if (ptr == NULL) {
				diag_set(OutOfMemory, str_len + 1, "region",
					 "opt string");
				return -1;
			}
			memcpy(ptr, str, str_len);
			ptr[str_len] = '\0';
			assert (strlen(ptr) == str_len);
		} else {
			ptr = NULL;
		}
		*(const char **)opt = ptr;
		break;
	case OPT_ENUM:
		if (mp_typeof(**val) != MP_STR)
			goto type_mismatch_err;
		str = mp_decode_str(val, &str_len);
		if (def->to_enum == NULL) {
			ival = strnindex(def->enum_strs, str, str_len,
					 def->enum_max);
		} else {
			ival = def->to_enum(str, str_len);
		}
		switch(def->enum_size) {
		case sizeof(uint8_t):
			store_u8(opt, (uint8_t)ival);
			break;
		case sizeof(uint16_t):
			store_u16(opt, (uint16_t)ival);
			break;
		case sizeof(uint32_t):
			store_u32(opt, (uint32_t)ival);
			break;
		case sizeof(uint64_t):
			store_u64(opt, (uint64_t)ival);
			break;
		default:
			unreachable();
		};
		break;
	case OPT_ARRAY:
		if (mp_typeof(**val) != MP_ARRAY)
			goto type_mismatch_err;
		ival = mp_decode_array(val);
		assert(def->to_array != NULL);
		if (def->to_array(val, ival, opt, errcode, field_no) != 0)
			return -1;
		break;
	case OPT_LEGACY:
		mp_next(val);
		break;
	default:
		unreachable();
	}
	return 0;

type_mismatch_err:
	snprintf(errmsg, TT_STATIC_BUF_LEN, "'%s' must be %s", def->name,
		 opt_type_strs[def->type]);
	diag_set(ClientError, errcode, field_no, errmsg);
	return -1;
}
Beispiel #8
0
void unload_gs(void){

	store_double("Operation", "Setpoint", gs->setpoint);

	store_int("Task","Priority",gs->task_prio);
}