Example #1
0
static int parse_dbi_ex_header(char *data, int max_len, SDBIExHeader *dbi_ex_header) {
	ut32 read_bytes = 0, before_read_bytes = 0;

	READ4(read_bytes, max_len, dbi_ex_header->opened, data, ut32);

	before_read_bytes = read_bytes;
	read_bytes += parse_ssymbol_range (data, max_len, &dbi_ex_header->range);
	data += (read_bytes - before_read_bytes);

	READ2(read_bytes, max_len, dbi_ex_header->flags, data, ut16);
	READ2(read_bytes, max_len, dbi_ex_header->stream, data, st16);
	READ4(read_bytes, max_len, dbi_ex_header->symSize, data, ut32);
	READ4(read_bytes, max_len, dbi_ex_header->oldLineSize, data, ut32);
	READ4(read_bytes, max_len, dbi_ex_header->lineSize, data, ut32);
	READ2(read_bytes, max_len, dbi_ex_header->nSrcFiles, data, st16);
	READ2(read_bytes, max_len, dbi_ex_header->padding1, data, st16);
	READ4(read_bytes, max_len, dbi_ex_header->offsets, data, ut32);
	READ4(read_bytes, max_len, dbi_ex_header->niSource, data, ut32);
	READ4(read_bytes, max_len, dbi_ex_header->niCompiler, data, ut32);

	before_read_bytes = read_bytes;
	parse_sctring(&dbi_ex_header->modName, (unsigned char *)data, &read_bytes, max_len);
	data += (read_bytes - before_read_bytes);

	before_read_bytes = read_bytes;
	parse_sctring(&dbi_ex_header->objName, (unsigned char *)data, &read_bytes, max_len);
	data += (read_bytes - before_read_bytes);

	return read_bytes;
}
Example #2
0
static int parse_ssymbol_range(char *data, int max_len, SSymbolRange *symbol_range) {
	int read_bytes = 0;

	READ2(read_bytes, max_len, symbol_range->section, data, st16);
	READ2(read_bytes, max_len, symbol_range->padding1, data, st16);
	READ4(read_bytes, max_len, symbol_range->offset, data, st32);
	READ4(read_bytes, max_len, symbol_range->size, data, st32);
	READ4(read_bytes, max_len, symbol_range->flags, data, ut32);
	READ4(read_bytes, max_len, symbol_range->module, data, st32);

// TODO: why not need to read this padding?
//	READ2(read_bytes, max_len, symbol_range->padding2, data, short);
	READ4(read_bytes, max_len, symbol_range->data_crc, data, ut32);
	READ4(read_bytes, max_len, symbol_range->reloc_crc, data, ut32);

	return read_bytes;
}
Example #3
0
void doubleMul( double x, double* y )
{
	size_t num = 4; 
	for(size_t i = 0; i < num; i++)
		printf("[doubleMul]: y[%d] = %lf\n", i, y[i]);
	setbuf(stdout, NULL);
	x *= y[0] ;
	/*pvm_initsend(PvmDataDefault) ;
	pvm_pkdouble(&x, 1, 1) ;
	pvm_send(pvm_parent(), 1) ;*/
	printf("[doubleMul]: Now x = %lf\n", x);
	input<double> in1(1, 2, 0., 1);
	READ2("main:all_tasks.main.1", "all_tasks", in1);
	x *= in1.data;
	printf("[doubleMul]: And now... x = %lf\n", x);
	return;
}
static void
auacer_upd_chan(struct auacer_softc *sc, struct auacer_chan *chan)
{
	uint32_t sts;
	uint32_t civ;

	sts = READ2(sc, chan->port + ALI_OFF_SR);
	/* intr ack */
	WRITE2(sc, chan->port + ALI_OFF_SR, sts & ALI_SR_W1TC);
	WRITE4(sc, ALI_INTERRUPTSR, ALI_PORT2INTR(chan->port));

	DPRINTF(ALI_DEBUG_INTR, ("auacer_upd_chan: sts=0x%x\n", sts));

	if (sts & ALI_SR_DMA_INT_FIFO) {
		printf("%s: fifo underrun # %u\n",
		       device_xname(&sc->sc_dev), ++chan->fifoe);
	}

	civ = READ1(sc, chan->port + ALI_OFF_CIV);

	DPRINTF(ALI_DEBUG_INTR,("auacer_intr: civ=%u ptr=%u\n",civ,chan->ptr));

	/* XXX */
	while (chan->ptr != civ) {
		auacer_add_entry(chan);
	}

	WRITE1(sc, chan->port + ALI_OFF_LVI, (chan->ptr - 1) & ALI_LVI_MASK);

	while (chan->ack != civ) {
		if (chan->intr) {
			DPRINTF(ALI_DEBUG_INTR,("auacer_upd_chan: callback\n"));
			chan->intr(chan->arg);
		}
		chan->ack++;
		if (chan->ack >= ALI_DMALIST_MAX)
			chan->ack = 0;
	}
}
static int
auacer_read_codec(void *v, uint8_t reg, uint16_t *val)
{
	struct auacer_softc *sc;

	sc = v;
	if (auacer_sema_codec(sc))
		return EIO;

	reg |= ALI_CPR_ADDR_READ;
#if 0
	if (ac97->num)
		reg |= ALI_CPR_ADDR_SECONDARY;
#endif
	WRITE2(sc, ALI_CPR_ADDR, reg);
	if (auacer_ready_codec(sc, ALI_CSPSR_READ_OK))
		return EIO;
	*val = READ2(sc, ALI_SPR);

	DPRINTF(ALI_DEBUG_CODECIO, ("auacer_read_codec: reg=0x%x val=0x%x\n",
				    reg, *val));

	return 0;
}
Example #6
0
void Pref::load() {
	Record r(PREF_GROUP);
#define READ(a) r.read(a, #a)
	READ(fit_to_video);
	READ(remember_stopped);
	READ(ask_record_found);
	READ(pause_minimized);
	READ(pause_video_only);
	READ(hide_cursor);
	READ(hide_cursor_fs_only);
	READ(hide_cursor_delay);
	READ(blur_kern_c);
	READ(blur_kern_n);
	READ(blur_kern_d);
	READ(sharpen_kern_c);
	READ(sharpen_kern_n);
	READ(sharpen_kern_d);
	READ(remap_luma_min);
	READ(remap_luma_max);
	READ(channel_manipulation);

	QList<QByteArray> restore_properties;
	READ(restore_properties);
	this->restore_properties.clear();
	this->restore_properties.reserve(restore_properties.size());
	for (auto &name : _C(restore_properties)) {
		auto &mo = MrlState::staticMetaObject;
		const int idx = mo.indexOfProperty(name.constData());
		if (idx != -1)
			this->restore_properties.append(mo.property(idx));
	}

	READ(invert_wheel);
	READ(enable_system_tray);
	READ(hide_rather_close);
	READ(disable_screensaver);
	READ(sub_enc);
	READ(sub_enc_autodetection);
	READ(sub_enc_accuracy);
	READ(ms_per_char);
	READ(sub_priority);
	READ(seek_step1);
	READ(seek_step2);
	READ(seek_step3);
	READ(speed_step);
	READ(volume_step);
	READ(amp_step);
	READ(sub_pos_step);
	READ(sub_sync_step);
	READ(brightness_step);
	READ(saturation_step);
	READ(contrast_step);
	READ(hue_step);
	READ(sub_ext);

	READ(skin_name);
    READ(enable_hwaccel);
    READ(hwaccel_codecs);
	READ(hwdeints);
	QString backend;
	r.read(backend, "hwaccel_backend");
	hwaccel_backend = HwAcc::backend(backend);

	READ(enable_generate_playist);
	READ(sub_enable_autoload);
	READ(sub_enable_autoselect);
	READ(generate_playlist);
	READ(sub_autoload);
	READ(sub_autoselect);

	READ(normalizer_silence);
	READ(normalizer_target);
	READ(normalizer_min);
	READ(normalizer_max);

	READ(lion_style_fullscreen);

	READ(show_logo);
	READ(bg_color);

	READ(deint_hwdec);
	READ(deint_swdec);

	READ(audio_driver);
	READ(clipping_method);

	READ(cache_local);
	READ(cache_disc);
	READ(cache_network);
	READ(cache_min_playback);
	READ(cache_min_seeking);
	READ(network_folders);
	READ(use_mpris2);
#undef READ

#define READ2(a) a.load(r, #a)
	READ2(open_media_from_file_manager);
	READ2(open_media_by_drag_and_drop);
	READ2(sub_style);
	READ2(double_click_map);
	READ2(middle_click_map);
	READ2(wheel_scroll_map);
#undef READ2

	const auto size = r.beginReadArray("shortcuts");
	if (size > 0) {
		shortcuts.clear();
		for (int i=0; i<size; ++i) {
			r.setArrayIndex(i);
			const auto id = r.value("id").toString();
			if (!id.isEmpty()) {
				const auto keys = fromStringList<QKeySequence>(r.value("keys").toStringList());
				if (!keys.isEmpty())
					shortcuts[id] = keys;
			}
		}
	}
	r.endArray();
}
Example #7
0
AttributeInfo readAttribute(FILE* fp, u2_t cpCount, CpInfo* cp) {
	AttributeInfo attr;
	READ2(fp, attr.nameIndex);
	READ4(fp, attr.length);

	if (cpCount >= attr.nameIndex && cp[attr.nameIndex].tag != 1) { // CONSTANT_Utf8
		printf("WRONG ATTRIBUTE INDEX\n");
		exit(EXIT_FAILURE);
	}

	// TODO info should go
	void* info = malloc(attr.length);
	Code* code;
	SourceFile* sourceFile;

	switch (attributeNameToKind( *((Utf8*) cp[attr.nameIndex].info) )) {
		case CONSTANTVALUE:
			READBYTES(fp, info, attr.length);
			break;
		case CODE:
			attr.kind = CODE;
			code = malloc(sizeof(Code));
			attr.info = code;
			READ2(fp, code->maxStack);
			READ2(fp, code->maxLocals);
			READ4(fp, code->codeLength);
			// TODO incomplete
			READBYTES(fp, info, code->codeLength);
			READ2(fp, code->exceptionTableLength);
			code->exceptionTable = (code->exceptionTableLength == 0) ? NULL : malloc(code->exceptionTableLength * sizeof(ExceptionTableEntry));
			for (u2_t i = 0 ; i < code->exceptionTableLength ; i++) {
				READ2(fp, code->exceptionTable[i].startPC);
				READ2(fp, code->exceptionTable[i].endPC);
				READ2(fp, code->exceptionTable[i].handlerPC);
				READ2(fp, code->exceptionTable[i].catchType);
				printf("%d %d %d %d\n", code->exceptionTable[i].startPC, code->exceptionTable[i].endPC, code->exceptionTable[i].handlerPC, code->exceptionTable[i].catchType);
			}
			READ2(fp, code->attributesCount);
			code->attributes = (code->attributesCount == 0) ? NULL : malloc(code->attributesCount * sizeof(AttributeInfo));
			for (u2_t i = 0 ; i < code->attributesCount ; i++) {
				code->attributes[i] = readAttribute(fp, cpCount, cp);
			}
			break;
		case STACKMAPTABLE:
			READBYTES(fp, info, attr.length);
			break;
		case EXCEPTIONS:
			READBYTES(fp, info, attr.length);
			break;
		case INNERCLASSES:
			READBYTES(fp, info, attr.length);
			break;
		case ENCLOSINGMETHOD:
			READBYTES(fp, info, attr.length);
			break;
		case SYNTHETIC:
			READBYTES(fp, info, attr.length);
			break;
		case SIGNATURE:
			READBYTES(fp, info, attr.length);
			break;
		case SOURCEFILE:
			attr.kind = SOURCEFILE;
			sourceFile = malloc(sizeof(SourceFile));
			attr.info = sourceFile;
			READ2(fp, sourceFile->sourceFileIndex);
			break;
		case SOURCEDEBUGEXTENSION:
			READBYTES(fp, info, attr.length);
			break;
		case LINENUMBERTABLE:
			READBYTES(fp, info, attr.length);
			break;
		case LOCALVARIABLETABLE:
			READBYTES(fp, info, attr.length);
			break;
		case LOCALVARIABLETYPETABLE:
			READBYTES(fp, info, attr.length);
			break;
		case DEPRECATED:
			READBYTES(fp, info, attr.length);
			break;
		case RUNTIMEVISIBLEANNOTATIONS:
			READBYTES(fp, info, attr.length);
			break;
		case RUNTIMEINVISIBLEANNOTATIONS:
			READBYTES(fp, info, attr.length);
			break;
		case RUNTIMEVISIBLEPARAMETERANNOTATIONS:
			READBYTES(fp, info, attr.length);
			break;
		case RUNTIMEINVISIBLEPARAMETERANNOTATIONS:
			READBYTES(fp, info, attr.length);
			break;
		case RUNTIMEVISIBLETYPEANNOTATIONS:
			READBYTES(fp, info, attr.length);
			break;
		case RUNTIMEINVISIBLETYPEANNOTATIONS:
			READBYTES(fp, info, attr.length);
			break;
		case ANNOTATIONDEFAULT:
			READBYTES(fp, info, attr.length);
			break;
		case BOOTSTRAPMETHODS:
			READBYTES(fp, info, attr.length);
			break;
		case METHODPARAMETERS:
			READBYTES(fp, info, attr.length);
			break;
		default:
			printf("UNKNOWN ATTRIBUTE\n");
			exit(EXIT_FAILURE);
	}
	return attr;
}