示例#1
0
main(int argc, char **argv)
{	char *txtFile = 0;
	unsigned long heapPos;
	int rc;
	unsigned extraSpace;

	if(argc > 1 && *argv[1] == '/' && toupper(argv[1][1]) == 'T') {
		txtFile = &argv[1][2];
		--argc;
		++argv;
	}
	if(argc != 4) {
		puts("Useage: INFORES resfile mapfile exefile");
		return 127;
	}
	if((rc = scanMapFile(argv[2], &heapPos, &extraSpace)) != 0)
		return rc;
	if((rc = addImageDisplacement(argv[3], &heapPos, &extraSpace)) != 0)
		return rc;

	if(txtFile && (txt = fopen(txtFile, "wt")) == 0) {
		printf("Failed to create text file: %s\n", txtFile);
		return 43;
	}
	if((info = fopen(argv[1], "wb")) == 0) {
		printf("Failed to create file: %s\n", argv[1]);
		return 41;
	}
	startResource(info, RES_ID_INFO, 0);
	dumpTagU(INFO_EXTRA_SPACE, extraSpace);
	if(heapPos)
		dumpTag(INFO_POS_HEAPLEN, 4, &heapPos);
#if 0			/* They are external now */
#ifdef FEATURE_ALIASES
	dumpTagU(INFO_ALIASES, 0);
#endif
#ifdef FEATURE_HISTORY
	dumpTagU(INFO_HISTORY, 256);
#endif
#ifdef INCLUDE_CMD_PUSHD
	dumpTagU(INFO_DIRSTACK, DIRSTACK_DEFAULT_SIZE);
#endif
#endif
	dumpTagU(INFO_BUFSIZE, MAX_INTERNAL_COMMAND_SIZE);
	dumpTag(INFO_END, 0, 0);
	endResource(info);

	fflush(info);
	if(ferror(info)) {
		printf("Error writing file: %s\n", argv[1]);
		return 60;
	}

	fclose(info);
	return 0;
}
示例#2
0
int
main()
{
	PdmSuperClusterer super;
	PdmCWDClusterer clust(&super, POL_LEFTCIRCULAR);

	// guestimates for TSS; match test data
	super.setObsParams(2289 - 5.034399, 64, 0.6958917);

	while(cin)
	{
		int count, bin, drift, power;
		cin >> count;
		cin >> bin;
		cin >> drift;
		cin >> power;
		clust.recordHit(bin,drift,power);
	}

	clust.allHitsLoaded();

	super.compute();

	printf("found %d superclusters:\n", super.getCount());
	for (int i = 0; i < super.getCount(); i++)
	{
		const PdmClusterTag &tag = super.getNthMainSignal(i);
		dumpTag("SUPER ",tag);
		for (int j = 0; j < super.getNthClusterCount(i); j++)
		{
			const PdmClusterTag &tag2 = super.getNthMthCluster(i,j);
			dumpTag("      ",tag2);
		}
	}

	return 0;
}
示例#3
0
void dumpTagU(int ttype, unsigned tvalue)
{	dumpTag(ttype, 2, &tvalue);
}