Exemple #1
0
static void context_notification_handler(int notification, void *data) {
    if (notification == FS_GL_CONTEXT_DESTROY) {
        if (g_text_texture != 0) {
            glDeleteTextures(1, &g_text_texture);
            g_text_texture = 0;
        }

        // FIXME: clear text cache..
        //printf("FIXME: clear text cache\n");

        GList* list = g_cache;
        while (list) {
            cache_item *item = (cache_item *) list->data;
            g_free(item->text);
            g_free(item);
            list = list->next;
        }
        g_list_free(g_cache);
        g_cache = NULL;
        initialize_cache();
    }
    else if (notification == FS_GL_CONTEXT_CREATE) {
        create_text_texture();
    }
}
Exemple #2
0
static void initialize() {
    g_texture_width = 2048;
    g_texture_height = 2048;
    int max_texture_size = fs_ml_get_max_texture_size();
    if (max_texture_size > 0) {
        if (max_texture_size < g_texture_width) {
            g_texture_width = max_texture_size;
        }
        if (max_texture_size < g_texture_height) {
            g_texture_height = max_texture_size;
        }
    }
    fs_log("using text cache texture size %dx%d\n", g_texture_width,
            g_texture_height);

    initialize_cache();
    create_text_texture();
    fs_gl_add_context_notification(context_notification_handler, NULL);
    g_buffer = malloc(g_texture_width * 32 * 4);

#ifdef USE_FREETYPE
    init_freetype();
#endif
    g_initialized = 1;
}
Exemple #3
0
void initialize() {
    initialize_cache();
    create_text_texture();
    fs_gl_add_context_notification(context_notification_handler, NULL);
    g_buffer = g_malloc(TEXTURE_WIDTH * 32 * 4);
    g_initialized = 1;
}
Exemple #4
0
template<class ST> void CDenseFeatures<ST>::set_num_vectors(int32_t num)
{
	if (m_subset_stack->has_subsets())
		SG_ERROR("A subset is set, cannot call set_num_vectors\n");

	num_vectors = num;
	initialize_cache();
}
Exemple #5
0
int main(int argc, char **argv)
{
	get_operation(argc, argv);
	Cache cache;
    initialize_cache(&cache);
    read_file(&cache);
    printSummary(num_hit,num_miss,num_eviction);
	return 0;
}
Exemple #6
0
template<class ST> CDenseFeatures<ST>::CDenseFeatures(const CDenseFeatures & orig) :
		CDotFeatures(orig)
{
	set_feature_matrix(orig.feature_matrix);
	initialize_cache();
	init();

	m_subset_stack=orig.m_subset_stack;
	SG_REF(m_subset_stack);
}
Exemple #7
0
template<class ST> void CDenseFeatures<ST>::copy_feature_matrix(SGMatrix<ST> src)
{
	if (m_subset_stack->has_subsets())
		SG_ERROR("A subset is set, cannot call copy_feature_matrix\n")

	free_feature_matrix();
	feature_matrix = src.clone();
	num_features = src.num_rows;
	num_vectors = src.num_cols;
	initialize_cache();
}
Exemple #8
0
template<class ST> CDenseFeatures<ST>::CDenseFeatures(const CDenseFeatures & orig) :
		CDotFeatures(orig)
{
	init();
	set_feature_matrix(orig.feature_matrix);
	initialize_cache();

	if (orig.m_subset_stack != NULL)
	{
		SG_UNREF(m_subset_stack);
		m_subset_stack=new CSubsetStack(*orig.m_subset_stack);
		SG_REF(m_subset_stack);
	}
}
int main(void)
{
    initialize_cache();
    
    long sum = 0;
    for(int i = 1; i < MAX_START; i++)
    {
	if(reaches_89(i))
	{
	    sum++;
	}
    }

    printf("%ld starting numbers reach 89.\n", sum);
}
Exemple #10
0
void initialize_kernel() {
    bwsetfifo(COM2, OFF);

    void (**syscall_handler)() = (void (**)())0x28;
    *syscall_handler = &kernel_enter;

    void (**irq_handler)() = (void (**)())0x38;
    *irq_handler = &irq_enter;

    initialize_cache();
    initialize_memory();
    initialize_fine_timer();
    initialize_scheduling();
    initialize_tasks();
    initialize_messaging();
    initialize_events();
    initialize_waiting();
}
Exemple #11
0
int main(int argc, char **argv) 
{
    int listenfd, port, clientlen;
    struct sockaddr_in clientaddr;

    /* Check command line args */
    if (argc != 2) {
		fprintf(stderr, "usage: %s <port>\n", argv[0]);
		exit(1);
    }
    Signal(SIGPIPE, SIG_IGN);
    pthread_rwlock_init(&lock, 0);
    port = atoi(argv[1]);
    pthread_t tid;
    proxy_cache = initialize_cache();
    listenfd = Open_listenfd(port);
    while (1) {
		clientlen = sizeof(clientaddr);
		int *connfdp = Malloc(sizeof(int));
		*connfdp = Accept(listenfd, (SA *)&clientaddr, (socklen_t *)&clientlen);
		Pthread_create(&tid, NULL, doit_thread, connfdp);
    }
}
Exemple #12
0
template<class ST> void CDenseFeatures<ST>::set_num_features(int32_t num)
{
	num_features = num;
	initialize_cache();
}