コード例 #1
0
/* PUBLIC */
Plist back_subsumption(Topform c)
{
  Plist p1 = back_subsume(c, Unit_fpa_idx);
#if 0
  Plist p2 = back_subsume(c, Nonunit_fpa_idx);
#else
  Plist p2 = back_feature_subsume(c, Nonunit_features_idx);
#endif

  Plist p3 = plist_cat(p1, p2);
  return p3;
}  /* back_subsumption */
コード例 #2
0
static
Plist read_tptp_file(FILE *fp)
{
  Plist formulas = NULL;
  Term t = read_term(fp, stderr);

  while (t != NULL) {
    if (is_term(t, "include", 1) || is_term(t, "include", 2))
      formulas = plist_cat(formulas, tptp_include(t));
    else if (is_term(t, "cnf", 3) || is_term(t, "cnf", 4))
      formulas = plist_prepend(formulas, tptp_formula(t));
    else if (is_term(t, "fof", 3) || is_term(t, "fof", 4))
      formulas = plist_prepend(formulas, tptp_formula(t));
    else {
      p_term(t);
      fatal_error("read_tptp_file: unknown term");
    }

    zap_term(t);
    t = read_term(stdin, stderr);
  }
  return reverse_plist(formulas);
}  /* read_tptp_file */
コード例 #3
0
ファイル: audio.c プロジェクト: nihlaeth/read-the-room
/* Move to the next file depending on the options set, the user
 * request and whether or not there are files in the queue. */
static void go_to_another_file ()
{
	int shuffle = options_get_int ("Shuffle");
	int go_next = (play_next || options_get_int("AutoNext"));
	int curr_playing_curr_pos;
	/* XXX: Shouldn't play_next be protected by mutex? */

	LOCK (curr_playing_mut);
	LOCK (plist_mut);

	/* If we move forward in the playlist and there are some songs in
	 * the queue, then play them. */
	if (plist_count(&queue) && go_next) {
		logit ("Playing file from queue");

		if (!before_queue_fname && curr_playing_fname)
			before_queue_fname = xstrdup (curr_playing_fname);

		curr_plist = &queue;
		curr_playing = plist_next (&queue, -1);

		server_queue_pop (queue.items[curr_playing].file);
		plist_delete (&queue, curr_playing);
	}
	else {
		/* If we just finished playing files from the queue and the
		 * appropriate option is set, continue with the file played
		 * before playing the queue. */
		if (before_queue_fname && options_get_int("QueueNextSongReturn")) {
			free (curr_playing_fname);
			curr_playing_fname = before_queue_fname;
			before_queue_fname = NULL;
		}

		if (shuffle) {
			curr_plist = &shuffled_plist;

			if (plist_count(&playlist)
					&& !plist_count(&shuffled_plist)) {
				plist_cat (&shuffled_plist, &playlist);
				plist_shuffle (&shuffled_plist);

				if (curr_playing_fname)
					plist_swap_first_fname (&shuffled_plist,
							curr_playing_fname);
			}
		}
		else
			curr_plist = &playlist;

		curr_playing_curr_pos = plist_find_fname (curr_plist,
				curr_playing_fname);

		/* If we came from the queue and the last file in
		 * queue wasn't in the playlist, we try to revert to
		 * the QueueNextSongReturn = 1 behaviour. */
		if (curr_playing_curr_pos == -1 && before_queue_fname) {
			curr_playing_curr_pos = plist_find_fname (curr_plist,
					before_queue_fname);
		}

		if (play_prev && plist_count(curr_plist)) {
			logit ("Playing previous...");

			if (curr_playing_curr_pos == -1
					|| started_playing_in_queue) {
				curr_playing = plist_prev (curr_plist, -1);
				started_playing_in_queue = 0;
			}
			else
				curr_playing = plist_prev (curr_plist,
						curr_playing_curr_pos);

			if (curr_playing == -1) {
				if (options_get_int("Repeat"))
					curr_playing = plist_last (curr_plist);
				logit ("Beginning of the list.");
			}
			else
				logit ("Previous item.");
		}
		else if (go_next && plist_count(curr_plist)) {
			logit ("Playing next...");

			if (curr_playing_curr_pos == -1
					|| started_playing_in_queue) {
				curr_playing = plist_next (curr_plist, -1);
				started_playing_in_queue = 0;
			}
			else
				curr_playing = plist_next (curr_plist,
						curr_playing_curr_pos);

			if (curr_playing == -1 && options_get_int("Repeat")) {
				if (shuffle) {
					plist_clear (&shuffled_plist);
					plist_cat (&shuffled_plist, &playlist);
					plist_shuffle (&shuffled_plist);
				}
				curr_playing = plist_next (curr_plist, -1);
				logit ("Going back to the first item.");
			}
			else if (curr_playing == -1)
				logit ("End of the list");
			else
				logit ("Next item");

		}
		else if (!options_get_int("Repeat")) {
			curr_playing = -1;
		}
		else
			debug ("Repeating file");

		if (before_queue_fname)
			free (before_queue_fname);
		before_queue_fname = NULL;
	}

	UNLOCK (plist_mut);
	UNLOCK (curr_playing_mut);
}
コード例 #4
0
ファイル: mace4.c プロジェクト: axelrod9/ladr
static
Plist read_mace4_input(int argc, char **argv, BOOL allow_unknown_things,
		      Mace_options opt)
{
  Plist wild_formulas, goals;
  Plist distinct_lists, distinct_forms;
  Plist wild_terms, hints;  /* we won't use these */

  /* Tell the top_input package what lists to accept and where to put them. */

  /* Accept hints, but they will not be used. */

  accept_list("hints", FORMULAS, TRUE, &hints);

  /* Accept goals; these are negated individually (each must be falsified) */

  accept_list("goals", FORMULAS, FALSE, &goals);

  /* Accept lists of distinct items */

  accept_list("distinct", TERMS, FALSE, &distinct_lists);

  /* Accept any other clauses and formulas.  Each must be true. */

  accept_list("",    FORMULAS, FALSE, &wild_formulas);

  /* Accept any terms.  These will not be used. */

  accept_list("",      TERMS,    FALSE, &wild_terms);

  /* Read commands such as set, clear, op, lex. */
  /* Read lists, filling in variables given to the accept_list calls. */

  print_separator(stdout, "INPUT", TRUE);

  read_all_input(argc, argv, stdout, TRUE,
		 allow_unknown_things ? WARN_UNKNOWN : KILL_UNKNOWN);

  if (wild_terms)
    printf("%%   term list(s) ignored\n");
  if (hints)
    printf("%%   hints list(s) ignored\n");

  process_command_line_args(argc, argv, opt);

  print_separator(stdout, "end of input", TRUE);

  if (!option_dependencies_state()) {
    /* This might be needed in the future. */
    printf("\n%% Enabling option dependencies (ignore applies only on input).\n");
    enable_option_dependencies();
  }

  distinct_forms = process_distinct_terms(distinct_lists);
  wild_formulas = plist_cat(wild_formulas, distinct_forms);

  wild_formulas = embed_formulas_in_topforms(wild_formulas, TRUE);
  goals = embed_formulas_in_topforms(goals, FALSE);

  /* Clausify */

  print_separator(stdout, "PROCESS NON-CLAUSAL FORMULAS", TRUE);
  printf("\n%% Formulas that are not ordinary clauses:\n");

  wild_formulas = process_input_formulas(wild_formulas, TRUE);
  goals = process_goal_formulas(goals, TRUE);  /* negates goals */

  print_separator(stdout, "end of process non-clausal formulas", TRUE);

  wild_formulas = plist_cat(wild_formulas, goals);

  return wild_formulas;
}  /* read_mace4_input */