예제 #1
0
파일: avl.c 프로젝트: asabeeh18/PROgrammin
struct Tree* insert(int a,struct Tree *top)
{
	if(a<=top->a)
	{
		if(top->left!=NULL)
			insert(a,top->left);
		else
		{
			top->left=(struct Tree*)malloc(sizeof(struct Tree));
			top->left->a=a;
		}
	}
	else
	{
		if(top->right!=NULL)
			insert(a,top->right);
		else
		{
			top->right=(struct Tree*)malloc(sizeof(struct Tree));
			top->right->a=a;
		}

	}
	return balancer(a,top);
	printf("\nIn Insert!\n");
	inorder(top);
	printf("\n\n");
}
예제 #2
0
int main(int argc, char** argv) {
    int i;
    char notice[256];
    struct config arguments;

    /* Defaults */
    arguments.verbosity = INFO_V;
    arguments.threads = DEFAULT_THREADS;
    arguments.framerate = DEFAULT_FRAMERATE;
    arguments.compositor = DEFAULT_COMPOSITOR;
    arguments.dont_run = false;
    arguments.preserve = false;
    arguments.greyscale = false;
    arguments.darken = DEFAULT_DARKEN;
    arguments.x = 0;

    argp_parse(&argp, argc, argv, 0, 0, &arguments);

    if (arguments.dont_run) {
        for (i = 0; i < compositors_count; i++) {
            printf("Compositor %i - %s\n", i, compositor_names[i]);
        }
        return EXIT_SUCCESS;
    }

    if (filesize(arguments.input) > 1e9) {
        fprintf(stderr, "Not supporting big files right now");
        return EXIT_FAILURE;
    }

    Log log(&arguments);

    sprintf(notice, "Lapse '%s' -> '%s'\n"
            "Using compositor '%s'\n"
            "Using %i fps with %i threads",
            arguments.input, arguments.output,
            compositor_names[arguments.compositor],
            arguments.framerate, arguments.threads);
    log.log(notice, INFO_V);

    Balancer balancer(&arguments, &log);
    balancer.prepare_work_units();
    balancer.run();

    return EXIT_SUCCESS;
}