Ejemplo n.º 1
0
int main ()
{
	//FILE* fptr;
	char filename[20];
	while(1)
	{
		printf("please input the file name you wish to parse\n ");
		scanf("%s",filename);
		fptr=fopen(filename,"r");
		if (fptr)
			break;
		printf("invalid file name\n");

	}

	enable_library=-1;
	while (1)
	{
		printf("Do you wish to include library files? Enter 1 for yes and 0 for no\n");
		scanf("%d",&enable_library);
		if (enable_library==0||enable_library==1)
			break;
		printf("Invalid input\n");
	}
	parse_files(filename);
	printtoterminal();
	analyzeresult();
	visualize();
}
Ejemplo n.º 2
0
unsigned long long
dt08rf1(char* aname, char* cname, int seconds)
{
	FILE*		afile = fopen(aname, "r");
	FILE*		cfile = fopen(cname, "r");

	fm_count = 0;

	if (afile == NULL) {
		fprintf(stderr, "could not open file A\n");
		exit(1);
	}

	if (cfile == NULL) {
		fprintf(stderr, "could not open file c\n");
		exit(1);
	}
    /*fm_system* system = (fm_system*)malloc(sizeof(fm_system));
    system->rows = parse_files(afile, cfile);
    system->nbr_rows = count_rows(afile);*/
	fm_system* system = parse_files(afile, cfile);
	print_system(system);

    //TODO: move
    f_m_elim(system);
    elim_2(system);

	if (seconds == 0) {
		/* Just run once for validation. */
			
		// Uncomment when your function and variables exist...
		// return fm_elim(rows, cols, a, c);

		fm_elim(NULL, 0);
		return 1; // return one, i.e. has a solution for now...
	}

	/* Tell operating system to call function DONE when an ALARM comes. */
	signal(SIGALRM, done);
	alarm(seconds);

	/* Now loop until the alarm comes... */
	proceed = true;
	while (proceed) {
		// Uncomment when your function and variables exist...
		// fm_elim(rows, cols, a, c);

		fm_elim(NULL, 0);

		fm_count++;
	}

	return fm_count;
}
Ejemplo n.º 3
0
/*
 * primary method to find overlaps among the peak files
 */
void ProcessPeaks::FindOverlaps() {

    vector<struct interval> A, B;

    fprintf(stderr, "Processing peaks - started\n");
    parse_files(_genome, &_offsets, _peakA, _peakB, &A, &B);
    fprintf(stderr, "Processing peaks - Done\n");

    uint32_t tot_overlaps = get_intersections(&A[0],
            A.size(),
            &B[0],
            B.size(),
            &overlap_index_A,
            &overlap_index_B);
}
Ejemplo n.º 4
0
int main (int argc, char **argv)
{
	struct Node
		*t;
        unsigned int i=0;

	if (argc < 2)
	{
		printf ("parser <file> ...");
		exit (1);
	}

      	t = parse_files (--argc, ++argv);

	if (error_count)
		fprintf (stderr, "%d error%s encountered\n", error_count,
			(error_count > 1) ? "s" : "");

	/* Display nodes... */

        disp_all_nodes(t);

	return 0;
}
Ejemplo n.º 5
0
/**
 * Parse config file options
 */
static gboolean parse_config_file(void)
{
	cfg_t *cfg, *sec_as, *sec_mpd;

	cfg_opt_t mpd_opts[] = {
		CFG_STR("host", "localhost", CFGF_NONE),
		CFG_INT("port", 6600, CFGF_NONE),
		CFG_INT("timeout", 5, CFGF_NONE),
		CFG_INT("interval", 10, CFGF_NONE),
		CFG_STR("password", "", CFGF_NONE),
		CFG_END()
	};
	cfg_opt_t as_opts[] = {
		CFG_STR("username", "", CFGF_NONE),
		CFG_STR("password", "", CFGF_NONE),
		CFG_STR("password_hash", "", CFGF_NONE),
		CFG_END()
	};
	cfg_opt_t opts[] = {
		CFG_INT_CB("log_level", G_LOG_LEVEL_ERROR, CFGF_NONE,
				&cf_log_level),
		CFG_STR("log_file", "/var/log/scmpc.log", CFGF_NONE),
		CFG_STR("pid_file", "/var/run/scmpc.pid", CFGF_NONE),
		CFG_STR("cache_file", "/var/lib/scmpc/scmpc.cache", CFGF_NONE),
		CFG_INT("queue_length", 500, CFGF_NONE),
		CFG_INT("cache_interval", 10, CFGF_NONE),
		CFG_SEC("mpd", mpd_opts, CFGF_NONE),
		CFG_SEC("audioscrobbler", as_opts, CFGF_NONE),
		CFG_END()
	};

	cfg = cfg_init(opts, CFGF_NONE);
	cfg_set_validate_func(cfg, "queue_length", &cf_validate_num);
	cfg_set_validate_func(cfg, "cache_interval", &cf_validate_num);
	cfg_set_validate_func(cfg, "mpd|port", &cf_validate_num);
	cfg_set_validate_func(cfg, "mpd|timeout", &cf_validate_num);

	if (parse_files(cfg) == FALSE) {
		cfg_free(cfg);
		return FALSE;
	}

	g_free(prefs.log_file);
	g_free(prefs.pid_file);
	g_free(prefs.cache_file);
	g_free(prefs.mpd_hostname);
	g_free(prefs.mpd_password);
	g_free(prefs.as_username);
	g_free(prefs.as_password);
	g_free(prefs.as_password_hash);

	prefs.log_level = cfg_getint(cfg, "log_level");
	prefs.log_file = expand_tilde(cfg_getstr(cfg, "log_file"));
	prefs.pid_file = expand_tilde(cfg_getstr(cfg, "pid_file"));
	prefs.cache_file = expand_tilde(cfg_getstr(cfg, "cache_file"));
	prefs.queue_length = cfg_getint(cfg, "queue_length");
	prefs.cache_interval = cfg_getint(cfg, "cache_interval");

	sec_mpd = cfg_getsec(cfg, "mpd");
	prefs.mpd_hostname = g_strdup(cfg_getstr(sec_mpd, "host"));
	prefs.mpd_port = cfg_getint(sec_mpd, "port");
	prefs.mpd_timeout = cfg_getint(sec_mpd, "timeout");
	prefs.mpd_password = g_strdup(cfg_getstr(sec_mpd, "password"));

	sec_as = cfg_getsec(cfg, "audioscrobbler");
	prefs.as_username = g_strdup(cfg_getstr(sec_as, "username"));
	prefs.as_password = g_strdup(cfg_getstr(sec_as, "password"));
	prefs.as_password_hash = g_strdup(cfg_getstr(sec_as, "password_hash"));

	prefs.fork = TRUE;

	cfg_free(cfg);
	return TRUE;
}