Beispiel #1
0
static is_same_temp(unsigned char *temps)
{
	unsigned int i;

	for (i = 0; i < LEDS_CNT; i++)
	{
		if (is_different(temps[i], prev_temp[i]))
			return 0;
	}
	return 1;
}
Beispiel #2
0
void
check_declarations(Context& cxt, Type_decl const& d1, Type_decl const& d2)
{
  Type const& t1 = d1.type();
  Type const& t2 = d2.type();
  if (is_different(t1, t2)) {
    // TODO: Get the source location right.
    error(cxt, "declaration of '{}' as a different kind of type", d1.name());
    note("'{}' previously declared as:", d1.name());
    
    // TODO: Don't print the definition. It's not germaine to
    // the error. If we have source locations, I wonder if we
    // can just point at the line.
    note("{}", d1);
    throw Declaration_error();
  }
}
Beispiel #3
0
int main(int argc, char** argv)
{
    Options* options = NULL;

#ifdef ARGV_INPUT
    if (argc < 3) {
        puts("Nombre de parametres insuffisants");
        return 1;
    }
    char* path_a = argv[1];
    char* path_b = argv[2];

    options = parse_options(argc, argv);

#else
    char path_a[256] = {};
    char path_b[256] = {};
    fgets(path_a, 256, stdin);
    fgets(path_b, 256, stdin);
    path_a[strlen(path_a)-1] = '\0';
    path_b[strlen(path_b)-1] = '\0';
#endif

    if (options == NULL)
    {
        puts("Erreur lecture des options");
        return 0;
    }


    int size_a = 0;
    int size_b = 0;

    char** file_a = load_file(options->path_a, &size_a);
    if (file_a == NULL)
        return 0;

    char** file_b = load_file(options->path_b, &size_b);
    if (file_b == NULL)
        return 0;

    char** lcs = calloc(sizeof(char*), max(size_a, size_b) + 1);

    char** matrix = build_lcs_matrix(file_a, file_b, size_a, size_b);
    extract_lcs(matrix, file_a, file_b, size_a, size_b, lcs);

    putchar('\n');

    int size_lcs = 0;
    while (lcs[size_lcs++] != 0);
    size_lcs--;

    if (options->brief)
        is_different(file_a, size_a, file_b, size_b);
    else if (options->output_mode == OUTPUT_MODE_NORMAL)
    {
        if (options->ignore_case_content)
            ignore_casse(file_a, size_a, file_b, size_b, lcs, size_lcs);
        else
            print_diff_normal(file_a, size_a, file_b, size_b, lcs, size_lcs);
    }

    return 0;
}