コード例 #1
0
ファイル: wiggle.c プロジェクト: trws/wiggle-nowhite
static int multi_merge(int argc, char *argv[], int obj,
		       int reverse, int ignore, int show_wiggles,
		       int replace, int strip,
		       int quiet)
{
	FILE *f;
	char *filename;
	struct plist *pl;
	int num_patches;
	int rv = 0;
	int i;

	if (!replace) {
		fprintf(stderr,
			"%s: -p in merge mode requires -r\n",
			Cmd);
		return 2;
	}
	if (argc != 1) {
		fprintf(stderr,
			"%s: -p in merge mode requires exactly one file\n",
			Cmd);
		return 2;
	}
	filename = argv[0];
	f = fopen(filename, "r");
	if (!f) {
		fprintf(stderr, "%s: cannot open %s\n",
			Cmd, filename);
		return 2;
	}
	pl = parse_patch(f, NULL, &num_patches);
	fclose(f);
	if (set_prefix(pl, num_patches, strip) == 0) {
		fprintf(stderr, "%s: aborting\n", Cmd);
		return 2;
	}
	for (i = 0; i < num_patches; i++) {
		char *name;
		char *av[2];
		asprintf(&name, "_wiggle_:%d:%d:%s",
			 pl[i].start, pl[i].end, filename);
		av[0] = pl[i].file;
		av[1] = name;
		rv |= do_merge(2, av, obj, reverse, 1, ignore,
			 show_wiggles, quiet);
	}
	return rv;
}
コード例 #2
0
ファイル: gen-md-tests.c プロジェクト: LogosBible/mono
static void
parse_test_entry (scanner_t *scanner, test_set_t *test_set)
{
	test_entry_t entry = { 0 };
	
	entry.validity = parse_validity (scanner);

	do {
		if (entry.patches)
			CONSUME_SPECIFIC_PUNCT (",");
		entry.patches = g_slist_append (entry.patches, parse_patch (scanner));
	} while (match_current_type_and_text (scanner, TOKEN_PUNC, ","));

	process_test_entry (test_set, &entry);

	test_entry_free (&entry);
}
コード例 #3
0
ファイル: event.c プロジェクト: billpage/open-axiom
static HyperDocPage *
paste_button(PasteNode * paste)
{
    HyperDocPage *page = NULL;
    auto pastewhere = paste->where;


    if ( paste->end_node ==NULL || paste->begin_node==NULL || paste->arg_node==NULL ){
        BeepAtTheUser();
        return NULL;
        }

    page=parse_patch(paste);
/* paste has changed after this call so use pastewhere*/

    if (pastewhere != SourceInputKind{ } && page ) {
        if (0 == strcmp(page->name, "ErrorPage"))
            page = NULL;
    }
    else
        BeepAtTheUser();

    return page;
}