Beispiel #1
0
SETUP()
{
	curr_view = &lwin;
	other_view = &rwin;

	init_commands();

	cfg.slow_fs_list = strdup("");

	init_view(&lwin);
	init_view(&rwin);
}
Beispiel #2
0
void
init_default_views()
{
	char *str;
	int i, j, add_custom_fields, add_custom_view = 0;
	
	add_custom_fields =
		!strcasecmp(opt_get_str(STR_PRESERVE_FIELDS), "standard");

	/* if the user has configured views, no need to provide defaults */
	if(abook_views)
		goto out;
	add_custom_view = 1;

	struct {
		char *name;
		int fields[MAX_DEFAULT_FIELDS_PER_VIEW + 1];
	} default_views[] = {
		{ N_("CONTACT"), {NAME, EMAIL, -1} },
		{ N_("ADDRESS"),
			{ ADDRESS, ADDRESS2, CITY, STATE, ZIP, COUNTRY, -1 } },
		{ N_("PHONE"), { PHONE, WORKPHONE, FAX, MOBILEPHONE, -1 } },
		{ N_("OTHER"), { NICK, URL, NOTES, ANNIVERSARY, -1 } },
		{ 0 }
	};

	for(i = 0; default_views[i].name; i++) {
		for(j = 0; j < MAX_DEFAULT_FIELDS_PER_VIEW; j++) {
			if(default_views[i].fields[j] == -1)
				break;
			str = standard_fields[default_views[i].fields[j]].key;
			add_field_to_view(gettext(default_views[i].name), str);
		}
	}
out:

#define init_view(view, key, name) do { \
	if(add_custom_fields || add_custom_view) \
		declare_new_field(key, name, "string", \
				0 /*"standard" field already declared above*/);\
	if(add_custom_view) \
		add_field_to_view(view, key); \
} while(0);

	init_view(_("CUSTOM"), "custom1", _("Custom1"));
	init_view(_("CUSTOM"), "custom2", _("Custom2"));
	init_view(_("CUSTOM"), "custom3", _("Custom3"));
	init_view(_("CUSTOM"), "custom4", _("Custom4"));
	init_view(_("CUSTOM"), "custom5", _("Custom5"));
}
Beispiel #3
0
SETUP()
{
	assert_success(chdir(SANDBOX_PATH));

	curr_view = &lwin;
	other_view = &rwin;

	init_commands();

	cfg.slow_fs_list = strdup("");
	cfg.chase_links = 1;

	init_view(&lwin);
	init_view(&rwin);
}
Beispiel #4
0
//+++++++++++++++++++++++++
view_player::view_player(library *lib, QWidget *parent) :
    QWidget(parent), _ref_library(lib), _ref_model_player(0)
{

    //
    init_view();
}
Beispiel #5
0
/*
 * Switch to the next viewport (do not re-display, this is handled elsewhere)
 */
static void
next_view(void)
{
    if (++curview >= maxview)
	curview = 0;
    init_view();
}
Beispiel #6
0
ENTRYPOINT void 
init_stonerview (ModeInfo *mi)
{
  stonerview_configuration *bp;

  if (!bps) {
    bps = (stonerview_configuration *)
      calloc (MI_NUM_SCREENS(mi), sizeof (stonerview_configuration));
    if (!bps) {
      fprintf(stderr, "%s: out of memory\n", progname);
      exit(1);
    }

    bp = &bps[MI_SCREEN(mi)];
  }

  bp = &bps[MI_SCREEN(mi)];

  bp->glx_context = init_GL(mi);

  bp->trackball = gltrackball_init ();
  bp->st = init_view(MI_IS_WIREFRAME(mi));
  init_move(bp->st);

  reshape_stonerview (mi, MI_WIDTH(mi), MI_HEIGHT(mi));
}
Beispiel #7
0
int main (int argc, char ** argv)
{

  if (argc <= 1)
    {
      fprintf (stderr, "File name not specified\n");
      exit (EXIT_FAILURE);
    }
  mySkeleton = md5mesh_loadfile (argv[1]);

  glutInit (&argc, argv);
  glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
  glutInitWindowSize (GWH, GWH);
  glutInitWindowPosition (200, 100);
  
  glutCreateWindow ("Model Render");
  init_view();
  glutDisplayFunc (glut_display_func);
  glutReshapeFunc (glut_reshape_func);
  glutIdleFunc    (glut_idle_func);
  glutKeyboardFunc(glut_keyboard_func);
  glutMouseFunc   (glut_mouse_func);
  glutMotionFunc  (glut_motion_func);
  glutMainLoop ();
  skeletonCleanUp (mySkeleton);
  return 0;
}
Beispiel #8
0
void CheckerBoard::initWindow()
{
	char fakeParam[] = "fake";
	char *fakeargv[] = { fakeParam, NULL };
	
	init_view (1, fakeargv);
}
Beispiel #9
0
int view_text(const char *title, const char *text)
{
    struct view_info info;
    const struct button_mapping *view_contexts[] = {
        pla_main_ctx,
    };
    int button;

    init_view(&info, title, text);
    draw_text(&info);

    /* wait for keypress */
    while(1)
    {
        button = pluginlib_getaction(TIMEOUT_BLOCK, view_contexts,
                                     ARRAYLEN(view_contexts));
        switch (button)
        {
        case PLA_UP:
        case PLA_UP_REPEAT:
#ifdef HAVE_SCROLLWHEEL
        case PLA_SCROLL_BACK:
        case PLA_SCROLL_BACK_REPEAT:
#endif
            scroll_up(&info, 1);
            break;
        case PLA_DOWN:
        case PLA_DOWN_REPEAT:
#ifdef HAVE_SCROLLWHEEL
        case PLA_SCROLL_FWD:
        case PLA_SCROLL_FWD_REPEAT:
#endif
            scroll_down(&info, 1);
            break;
        case PLA_LEFT:
            scroll_up(&info, info.display_lines);
            break;
        case PLA_RIGHT:
            scroll_down(&info, info.display_lines);
            break;
        case PLA_LEFT_REPEAT:
            scroll_to_top(&info);
            break;
        case PLA_RIGHT_REPEAT:
            scroll_to_bottom(&info);
            break;
        case PLA_EXIT:
        case PLA_CANCEL:
            return PLUGIN_OK;
        default:
            if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
                return PLUGIN_USB_CONNECTED;
            break;
        }
   }

    return PLUGIN_OK;
}
Beispiel #10
0
int				main(void)
{
	t_global_data		d;

	set_env(&d);
	create_renderer(&d);
	init_view(&d, &d.view);
	init_world(&d.world, 1000);
	SDL_ShowCursor(0);
	main_loop(&d);
	SDL_ShowCursor(1);
	return (0);
}
Beispiel #11
0
static void
init_logo_view (GtkWidget *widget)
{
  GtkAllocation allocation;
  init_logo_quat ();
  init_view ();
  mode = 0;
  counter = 0;

  if (!animate)
    {
      gtk_widget_get_allocation (widget, &allocation);
      gdk_window_invalidate_rect (gtk_widget_get_window (widget), &allocation, FALSE);
    }
}
Beispiel #12
0
double		inter_sphere(t_obj *obj, t_calc *calc)
{
  t_coord	abc;
  t_coord	tmp_eye;
  t_coord	tmp_view;
  double	delta;

  init_view(&tmp_eye, &tmp_view, obj, calc);
  abc.x = SQ(tmp_view.x) + SQ(tmp_view.y) + SQ(tmp_view.z);
  abc.y = 2 * ((tmp_eye.x * tmp_view.x) + (tmp_eye.y * tmp_view.y)
	       + (tmp_eye.z * tmp_view.z));
  abc.z = (SQ(tmp_eye.x) + SQ(tmp_eye.y) + SQ(tmp_eye.z)) - SQ(RAYON_OBJ);
  delta = SQ(abc.y) - (4 * abc.x * abc.z);
  return (calc_delta(&abc, delta));
}
Beispiel #13
0
RING *
row2VIEW(RING * gbl, int row)
{
    VIEW *vp;
    unsigned n, nn;

    for (n = 0; n < maxview; n++) {
	vp = viewlist + n;
	nn = ROW2FILE(vp, (unsigned) row);
	if (FILE_VISIBLE(vp, nn)) {
	    curview = n;
	    vp->curfile = nn;
	    init_view();
	    gbl = vue->gbl;
	    showC(gbl);
	    break;
	}
    }
    return gbl;
}
Beispiel #14
0
double		inter_cone(t_obj *obj, t_calc *calc)
{
  t_coord	abc;
  double	delta;
  t_coord	tmp_view;
  t_coord	tmp_eye;
  double	res;

  init_view(&tmp_eye, &tmp_view, obj, calc);
  abc.x = (SQ(VIEW_X) + SQ(VIEW_Y) -
	   ((SQ(VIEW_Z)) / SQ(tan(RAD(ANGLE)))));
  abc.y = ((EYE_X * 2 * VIEW_X) + (EYE_Y * 2 * VIEW_Y) -
	   ((EYE_Z * 2 * VIEW_Z) / SQ(tan(RAD(ANGLE)))));
  abc.z = (SQ(EYE_X) + SQ(EYE_Y) -
	   (SQ(EYE_Z) / SQ(tan(RAD(ANGLE)))));
  delta = SQ(abc.y) - (4 * abc.x * abc.z);
  res = calc_delta(&abc, delta);
  if (res != -1.0 && (obj->typdef.size_x != -1 || obj->typdef.size_y != -1))
    res = check_limit(obj, res, &tmp_eye, &tmp_view);
  return (res);
}
Beispiel #15
0
int oversight_main(int argc,char **argv,int send_content_type_header)
{
    int result=0;
    int done=0;

    g_start_clock = time(NULL);
    assert(sizeof(long long) >= 8);

    init_view();
    adjust_path();

    char *q=getenv("QUERY_STRING");
    char *sp=getenv("SCRIPT_NAME");

    char *p;
    char *req;
    if (q && (p = delimited_substring(q,"&",REMOTE_VOD_PREFIX2,"=",1,0)) != NULL) {

        gaya_auto_load(p+strlen(REMOTE_VOD_PREFIX2)+1);
        done=1;

    } else if (q && strstr(q,YAMJ_PREFIX2)) {

        g_query=parse_query_string(q,g_query);
        //req = url_decode(q+strlen(YAMJ_PREFIX2));
        req = url_decode(query_val("yamj"));
        yamj_xml(req);
        FREE(req);
        done=1;
    } else if (sp && (req=strstr(sp,YAMJ_PREFIX)) != NULL) {
        // If oversight script is launched as /oversight/yamj/xxxxx.xml
        // then use xxxxxx.xml as a yamj xml request.
        // This is to allow for Apache ModAlias to serve static images whilst calling oversight for CGI
        // The rewrite rules should be 
        //    ScriptAliasMatch ^/oversight/yamj/(.*).xml  /share/Apps/oversight/oversight.cgi
        //    AliasMatch ^/oversight/yamj/banner_(.*jpg) /oversight/db/global/_b/ovs_$1
        //    AliasMatch ^/oversight/yamj/fanart_(.*jpg) /oversight/db/global/_fa/ovs_$1
        //    AliasMatch ^/oversight/yamj/poster_(.*jpg) /oversight/db/global/_J/ovs_$1
        //    AliasMatch ^/oversight/yamj/thumb_(.*).jpg  /oversight/db/global/_J/ovs_$1.thumb.jpg
        //    AliasMatch ^/oversight/yamj/boxset_(.*).jpg  /oversight/db/global/_J/ovs_$1.thumb.boxset.jpg`
        //
        req += strlen(YAMJ_PREFIX);
        yamj_xml(req);
        done=1;

    } else if (q == NULL || strchr(q,'=') == NULL ) {

        if (argc > 1 ) {

            if ( argv[1] && *argv[1] && argv[2] == NULL && util_starts_with(argv[1],YAMJ_PREFIX) ) {
                char *req = url_decode(argv[1]+strlen(YAMJ_PREFIX));
                yamj_xml(req);
                FREE(req);
                done=1;

            } else if ( argv[1] && *argv[1] && argv[2] == NULL && strchr(argv[1],'=') == NULL) {
                // Single argument passed.
                //
                char *path = url_decode(argv[1]);
                char *dot = strrchr(path,'.');
                if (dot < path) dot = strchr(path,'\0');
                int result = 0;

                fprintf(stderr,"path=[%s]",path);

                // should really use file command or magic number to determine file type

                if (dot && STRCMP(dot,".png") == 0 ) {

                    result = cat(CONTENT_TYPE"image/png",path);

                } else if (dot &&  STRCMP(dot,".jpg") == 0 ) {

                    result = cat(CONTENT_TYPE"image/jpeg",path);

                } else if (dot &&  STRCMP(dot,".gif") == 0) {

                    result = cat(CONTENT_TYPE"image/gif",path);

                } else if (dot &&  (STRCMP(dot,".swf") == 0 || STRCMP(dot,".phf" ) == 0) ) {

                    result = cat(CONTENT_TYPE"application/x-shockwave-flash",path);

                } else if (browsing_from_lan() ) {

                    if (is_dir(path)) {

                        // load_configs(); // load configs so we can use file_to_url() functions 
                        result = ls(path);
                    } else {
                        int exists = is_file(path);

                        char *all_headers = NULL;
                        char *content_headers = NULL;

                        if (exists) {
                            if (strstr(path,".tar.gz") || strcmp(dot,".tgz") == 0) {

                                ovs_asprintf(&content_headers,"%s%s\n%s%s",
                                        CONTENT_TYPE,"application/x-tar",CONTENT_ENC,"gzip");

                            } else if (strcmp(dot,".gz") == 0 ) {

                                ovs_asprintf(&content_headers,"%s%s\n%s%s",
                                        CONTENT_TYPE,"application/x-gzip",CONTENT_ENC,"identity");

                            } else if (strcmp(dot,".html") == 0 ) {

                                ovs_asprintf(&content_headers,"%s%s",
                                        CONTENT_TYPE,"text/html;charset=utf-8");

                            } else {
                                ovs_asprintf(&content_headers,"%s%s",
                                        CONTENT_TYPE,"text/plain;charset=utf-8");
                            }
                        } else {
                            // .gz.txt is a fake extension added by the ls command to view log.gz inline without browser downloading.
                            if (strstr(path,".gz.txt")) {
                                ovs_asprintf(&content_headers,"%s%s\n%s%s",
                                        CONTENT_TYPE,"text/plain;charset=utf-8", CONTENT_ENC,"gzip");
                                // remove .txt to get real zip file.
                                // .txt is needed so a certain browser displays inline. (might be other ways)
                                *dot = '\0';
                            } else {
                                // 404 error would be here
                            }
                        }
                        ovs_asprintf(&all_headers,"%s\n%s%ld",content_headers,CONTENT_LENGTH,file_size(path));
                        FREE(content_headers);
                        result = cat(all_headers,path);
                        FREE(all_headers);

                    }
                }
                FREE(path);
                fflush(stdout);
                done=1;
            }
        }
    }



    if (!done) {
        if (send_content_type_header) {
            printf("Content-Type: text/html; charset=utf-8\n\n");

            start_page("CGI");
        } else {
            start_page("WGET");
        }

        html_log_level_set(2);

        load_configs();
        //html_hashtable_dump(0,"settings",g_nmt_settings);

        long log_level;
        if (config_check_long(g_oversight_config,"ovs_log_level",&log_level)) {
            html_log_level_set(log_level);
        }

        html_comment("Appdir= [%s]",appDir());

        //array_unittest();
        //util_unittest();
        //config_unittest();

        g_query = string_string_hashtable("g_query2",16);

        html_comment("default query ... ");
        add_default_html_parameters(g_query);
        html_hashtable_dump(0,"prequery",g_query);

        html_comment("read query ... ");
        g_query=parse_query_string(getenv("QUERY_STRING"),g_query);
        html_hashtable_dump(0,"query",g_query);

        html_comment("read post ... ");

        struct hashtable *post=read_post_data(getenv("TEMP_FILE"));
        html_hashtable_dump(0,"post",g_query);
        
        html_comment("merge query and post data");
        merge_hashtables(g_query,post,1); // post is destroyed

        html_hashtable_dump(0,"query final",g_query);


#if 0
        html_comment("utf8len expect 2 = %d",utf8len("a"));
        html_comment("utf8len expect 2 = %d",utf8len("à€€a"));
        html_comment("utf8len expect 2 = %d",utf8len("ü€€€€€a"));
        html_comment("utf8cmp_char 0 = %d",utf8cmp_char("ü€€€€€a","ü€€€€€b"));
        html_comment("utf8cmp_char !0 = %d",utf8cmp_char("ü€€€€€a","ü€€€€€a"));
        html_comment("utf8cmp_char 0 = %d",utf8cmp_char("a","a"));
        html_comment("utf8cmp_char !0 = %d",utf8cmp_char("a","b"));
        html_comment("utf8cmp_char !0 = %d",utf8cmp_char("ü€€€€€a","üa"));
        html_comment("utf8cmp_char !0 = %d",utf8cmp_char("a","ü€€€€€a"));
        Abet *a = abet_create("abcdefghijklmnopqrstuvwxyz");
        html_comment("inc a %d",abet_letter_inc_or_add(a,"a",1));
        html_comment("inc a %d",abet_letter_inc_or_add(a,"a",1));
        html_comment("inc z %d",abet_letter_inc_or_add(a,"z",1));
        html_comment("inc 4 %d",abet_letter_inc_or_add(a,"4",1));
        html_comment("inc 5 %d",abet_letter_inc_or_add(a,"5",1));
        html_comment("inc 5 %d",abet_letter_inc_or_add(a,"5",1));
        html_comment("inc 6* %d",abet_letter_inc_or_add(a,"6",0));
        html_comment("inc 7* %d",abet_letter_inc_or_add(a,"7",0));
        html_comment("inc a %d",abet_letter_inc_or_add(a,"a",1));
        abet_free(a);
#endif


        config_read_dimensions(1);

        HTML_LOG(0,"Begin Actions");
        do_actions();
       
        ViewMode *view;

        DbSortedRows *sortedRows = NULL;


        while(1) {
            view=get_view_mode(1);  
            HTML_LOG(0,"view mode = [%s]",view->name);

            // If movie view but all ids have been removed , then move up
            if (view == VIEW_MOVIE && !*query_val(QUERY_PARAM_IDLIST)) {
                query_pop();
                view=get_view_mode(1);  
            }

            sortedRows = get_sorted_rows_from_params();
            dump_all_rows("sorted",sortedRows->num_rows,sortedRows->rows);

            // If it's not a tv/movie detail or boxset view then break
            if (view == VIEW_MENU ||  view == VIEW_ADMIN ) {
                break;
            }

            // Found some data - as we are on a smaller view - filter it
            if (sortedRows->num_rows && sortedRows->num_rows < 50 ) {
                int new_num = sortedRows->num_rows;
                int max_new = sortedRows->num_rows;
                DbItem **new_list = filter_page_items(0,sortedRows->num_rows,sortedRows->rows,max_new,&new_num);
                FREE(sortedRows->rows);
                sortedRows->rows = new_list;
                sortedRows->num_rows=new_num;
            }
            if (sortedRows->num_rows) break;

            // No data found in this view - try to return to the previous view.
            query_pop();
            // Adjust config - 
            // TODO Change the config structure to reload more efficiently.
            //reload_configs();

            config_read_dimensions(1);

            // Now refetch all data again with new parameters.
            sorted_rows_free_all(sortedRows);
            HTML_LOG(0,"reparsing database");
        }

        // Remove and store the last navigation cell. eg if user clicked on cell 12 this is passed in 
        // the URL as @i=12. The url that returns to this page then has i=12. If we have returned to this
        // page we must remove i=12 from the query so that it is not passed to the new urls created for this 
        // page.
        set_selected_item();

        char *skin_name=get_skin_name();


        if (strchr(skin_name,'/') || *skin_name == '.' || !*skin_name ) {

            html_error("Invalid skin name[%s]",skin_name);

        } else {

            playlist_open();
            //exp_test();

            if (view->view_class == VIEW_CLASS_ADMIN) {

                setPermissions();
                display_admin(sortedRows);

            } else {

                char *template = query_val(QUERY_PARAM_TEMPLATE_NAME);
                if (EMPTY_STR(template)) {
Beispiel #16
0
/* the main game function */
static int play_game()
{ 
   ALLEGRO_TIMER *inc_counter;
   int gameover = 0;
   int cyclenum = 0;

   /* init */
   score = 0;

   init_view();
   init_player();
   init_badguys();
   init_bullets();
   init_explode();
   init_message();

   #define TIMER_SPEED  ALLEGRO_BPS_TO_SECS(30*(cyclenum+2))

   inc_counter = al_create_timer(TIMER_SPEED);
   al_start_timer(inc_counter);

   while (!gameover) {

      /* move everyone */
      while ((al_get_timer_count(inc_counter) > 0) && (!gameover)) {
	 update_view();
	 update_bullets();
	 update_explode();
	 update_message();

	 if (update_badguys()) {
	    if (advance_view()) {
	       cyclenum++;
	       al_set_timer_count(inc_counter, 0);
	       lay_attack_wave(TRUE);
	       advance_player(TRUE);
	    }
	    else {
	       lay_attack_wave(FALSE);
	       advance_player(FALSE);
	    }
	 }

	 gameover = update_player();

	 al_set_timer_count(inc_counter, al_get_timer_count(inc_counter)-1);
      }

      /* take a screenshot? */
      if (key[ALLEGRO_KEY_PRINTSCREEN]) {
	 static int ss_count = 0;

	 char fname[80];

	 sprintf(fname, "speed%03d.tga", ++ss_count);

	 al_save_bitmap(fname, al_get_backbuffer(screen));

	 while (key[ALLEGRO_KEY_PRINTSCREEN])
	    poll_input_wait();

	 al_set_timer_count(inc_counter, 0);
      }

      /* toggle fullscreen window */
      if (key[ALLEGRO_KEY_F]) {
         int flags = al_get_display_flags(screen);
         al_set_display_flag(screen, ALLEGRO_FULLSCREEN_WINDOW,
            !(flags & ALLEGRO_FULLSCREEN_WINDOW));

         while (key[ALLEGRO_KEY_F])
            poll_input_wait();
      }

      /* draw everyone */
      draw_view();
   }

   /* cleanup */
   al_destroy_timer(inc_counter);

   shutdown_view();
   shutdown_player();
   shutdown_badguys();
   shutdown_bullets();
   shutdown_explode();
   shutdown_message();

   if (gameover < 0) {
      sfx_ping(1);
      return FALSE;
   }

   return TRUE;
}
Beispiel #17
0
static void
realize (GtkWidget *widget,
	 gpointer   data)
{
  GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
  GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);

  static GLfloat light0_position[] = { 0.0, 0.0, 30.0, 0.0 };
  static GLfloat light0_diffuse[]  = { 1.0, 1.0, 1.0, 1.0 };
  static GLfloat light0_specular[] = { 1.0, 1.0, 1.0, 1.0 };

  static GLfloat mat_specular[]  = { 0.5, 0.5, 0.5, 1.0 };
  static GLfloat mat_shininess[] = { 10.0 };
  static GLfloat mat_black[]     = { 0.0, 0.0, 0.0, 1.0 };
  static GLfloat mat_red[]       = { 1.0, 0.0, 0.0, 1.0 };
  static GLfloat mat_green[]     = { 0.0, 1.0, 0.0, 1.0 };
  static GLfloat mat_blue[]      = { 0.0, 0.0, 1.0, 1.0 };

  /*** OpenGL BEGIN ***/
  if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
    return;

  glClearColor (0.5, 0.5, 0.8, 1.0);
  glClearDepth (1.0);

  glLightfv (GL_LIGHT0, GL_POSITION, light0_position);
  glLightfv (GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
  glLightfv (GL_LIGHT0, GL_SPECULAR, light0_specular);

  glEnable (GL_LIGHTING);
  glEnable (GL_LIGHT0);
  glEnable (GL_DEPTH_TEST);

  glEnable (GL_CULL_FACE);

  glShadeModel (GL_SMOOTH);

  glMaterialfv (GL_FRONT, GL_SPECULAR, mat_specular);
  glMaterialfv (GL_FRONT, GL_SHININESS, mat_shininess);

  /* Center black cube. */
  glNewList (LOGO_CUBE, GL_COMPILE);
    glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_black);
    logo_draw_cube ();
  glEndList ();

  /* Forward "G". */
  glNewList (LOGO_G_FORWARD, GL_COMPILE);
    glDisable (GL_CULL_FACE);
    glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_blue);
    logo_draw_g_plane ();
    glEnable (GL_CULL_FACE);

    glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_black);
    logo_draw_g ();
  glEndList ();

  /* Backward "G". */
  glNewList (LOGO_G_BACKWARD, GL_COMPILE);
    glPushMatrix ();
      glRotatef (180.0, 1.0, 0.0, 0.0);

      glDisable (GL_CULL_FACE);
      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_blue);
      logo_draw_g_plane ();
      glEnable (GL_CULL_FACE);

      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_black);
      logo_draw_g ();

    glPopMatrix ();
  glEndList ();

  /* Forward "T". */
  glNewList (LOGO_T_FORWARD, GL_COMPILE);
    glDisable (GL_CULL_FACE);
    glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_red);
    logo_draw_t_plane ();
    glEnable (GL_CULL_FACE);

    glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_black);
    logo_draw_t ();
  glEndList ();

  /* Backward "T". */
  glNewList (LOGO_T_BACKWARD, GL_COMPILE);
    glPushMatrix ();
      glRotatef (180.0, 1.0, 0.0, 0.0);

      glDisable (GL_CULL_FACE);
      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_red);
      logo_draw_t_plane ();
      glEnable (GL_CULL_FACE);

      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_black);
      logo_draw_t ();

    glPopMatrix ();
  glEndList ();

  /* Forward "K". */
  glNewList (LOGO_K_FORWARD, GL_COMPILE);
    glDisable (GL_CULL_FACE);
    glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_green);
    logo_draw_k_plane ();
    glEnable (GL_CULL_FACE);

    glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_black);
    logo_draw_k ();
  glEndList ();

  /* Backward "K". */
  glNewList (LOGO_K_BACKWARD, GL_COMPILE);
    glPushMatrix ();
      glRotatef (180.0, 0.0, 0.0, 1.0);

      glDisable (GL_CULL_FACE);
      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_green);
      logo_draw_k_plane ();
      glEnable (GL_CULL_FACE);

      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_black);
      logo_draw_k ();
    glPopMatrix ();
  glEndList ();

  glEnable (GL_NORMALIZE);

  /* Init logo orientation. */
  init_logo_quat ();

  /* Init view. */
  init_view ();

  gdk_gl_drawable_gl_end (gldrawable);
  /*** OpenGL END ***/
}
Beispiel #18
0
int main(int argc, char *argv[])
{
    int script_shmid;
    int ret;
    char **args;
    char binary[16] = "launcher";
    pid_t launcher_pid;
    char buffer[128];
    FILE *from_child;
    char *test_case_id_s;
    int test_case_id;
    char *result_s;
    int result;
    struct item_data it_data;
    char *exdata;
    int exdata_len;

    /* init script and view */
    db_msg("core: parse script %s...\n", SCRIPT_NAME);
    script_shmid = parse_script(SCRIPT_NAME);
    if (script_shmid == -1) {
        db_error("core: parse script failed\n");
        return -1;
    }

    db_msg("core: init script...\n");
    ret = init_script(script_shmid);
    if (ret) {
        db_error("core: init script failed(%d)\n", ret);
        return -1;
    }

    db_msg("core: init view...\n");
    ret = init_view();
    if (ret) {
        db_error("core: init view failed(%d)\n", ret);
        return -1;
    }

    /* parse and draw all test cases to view */
    db_msg("core: parse test case from script...\n");
    ret = parse_testcase();
    if (ret < 0) {
        db_error("core: parse all test case from script failed(%d)\n", ret);
        return -1;
    }
    else if (ret == 0) {
        db_warn("core: NO TEST CASE to be run\n");
        return -1;
    }

    db_msg("core: draw test case to view...\n");
    ret = draw_testcases();
    if (ret) {
        db_error("core: draw all test cases to view failed(%d)\n", ret);
        return -1;
    }
    view_sync();

    /* create named pipe */
    unlink(CMD_PIPE_NAME);
    if (mkfifo(CMD_PIPE_NAME, S_IFIFO | 0666) == -1) {
        db_error("core: mkfifo error(%s)\n", strerror(errno));
        return -1;
    }

    /* fork launcher process */
    db_msg("core: fork launcher process...\n");
    args = malloc(sizeof(char *) * 6);
    args[0] = binary;
    args[1] = malloc(10);
    sprintf(args[1], "%d", DRAGONBOARD_VERSION);
    args[2] = malloc(10);
    sprintf(args[2], "%d", script_shmid);
    args[3] = malloc(10);
    sprintf(args[3], "%d", total_testcases);
    args[4] = malloc(10);
    sprintf(args[4], "%d", base_info_shmid);
    args[5] = NULL;

    launcher_pid = fork();
    if (launcher_pid < 0) {
        db_error("core: fork launcher process failed(%s)\n", strerror(errno));
    }
    else if (launcher_pid == 0) {
        execvp(binary, args);
        db_error("core: can't run %s(%s)\n", binary, strerror(errno));
        _exit(-1);
    }

    /* listening to child process */
    db_msg("core: listening to child process, starting...\n");
    from_child = fopen(CMD_PIPE_NAME, "r");
    while (1) {
        if (fgets(buffer, sizeof(buffer), from_child) == NULL) {
            continue;
        }

        db_dump("core: command from child: %s", buffer);

        /* test completion */
        test_case_id_s = strtok(buffer, " \n");
        db_dump("test case id #%s\n", test_case_id_s);
        if (strcmp(buffer, TEST_COMPLETION) == 0)
            break;

        if (test_case_id_s == NULL)
            continue;
        test_case_id = atoi(test_case_id_s);

        result_s = strtok(NULL, " \n");
        db_dump("result: %s\n", result_s);
        if (result_s == NULL)
            continue;
        result = atoi(result_s);

        exdata = strtok(NULL, "\n");

        db_dump("%s TEST %s\n", base_info[test_case_id].name, 
                (result == 0) ? "OK" : "Fail");

        /* update view item */
        memset(&it_data, 0, sizeof(struct item_data));
        strncpy(it_data.name, base_info[test_case_id].name, 32);
        strncpy(it_data.display_name, base_info[test_case_id].display_name, 64);
        it_data.category = base_info[test_case_id].category;
        it_data.status = result;
        if (exdata) {
            /* trim space */
            while (*exdata == ' ' || *exdata == '\t')
                exdata++;
            exdata_len = strlen(exdata);
            exdata_len--;
            while (exdata >= 0 && (exdata[exdata_len] == ' ' || 
                   exdata[exdata_len] == '\t'))
                exdata_len--;

            if (exdata_len > 0) {
                exdata[++exdata_len] = '\0';
                db_dump("extra data len #%d: %s\n", exdata_len, exdata);
                strncpy(it_data.exdata, exdata, 64);
            }
        }
        view_update_item(test_case_id, &it_data);
    }
    fclose(from_child);

    db_msg("core: listening to child process, stoping...\n");

    deparse_testcase();
    exit_view();
    deinit_script();
    deparse_script(script_shmid);

    return 0;
}
// Main function with event loop
int main(void)
{
	int n = -1;
	int count = 0;
	static bc_buf_ptr_t buf_pa;
	int dev_fd;
	unsigned long chunkSize;

	printf("Initializing egl..\n\n");
	if( 0 == initEGL(0)) //No profiling
	{	
		printf("EGL init failed");
		goto exitNone;
	}
	
	//Also initialise the pipes
	n = initPipes(&initAttrib);
	if(n) 	{ 		goto exitPipes; 	}

	//Initialise CMEM allocator - TODO check err status
	mem_cmem_init();
	//Allocate mem
	chunkSize = initAttrib.widthPixels* 
							initAttrib.heightPixels* 
							initAttrib.bytesPerPixel*  
							initAttrib.numBuffers;
	if(mem_cmem_alloc( chunkSize, &virtualAddress, &physicalAddress )) {goto exitCMEMInit;}

	paArray = (unsigned long*)malloc(initAttrib.numBuffers * sizeof(unsigned long));
	freeArray = (unsigned long*)malloc(initAttrib.numBuffers * sizeof(unsigned long));	
	if(!paArray || !freeArray) {goto exitCMEMAlloc;}

	for(count = 0; count < initAttrib.numBuffers; count++)
	{
		paArray[count]  = physicalAddress + count*(chunkSize/initAttrib.numBuffers);
		freeArray[count] = 0;
	}
	//TODO - give the allocated buffers back to requestor via answer
	//write_init_buffer_pipe();
	
	init_view();

	//Loop reading new data and rendering, till something happens
	//TODO - exit cleanly using last msg
	while(read_pipe() != -1)
	{
		render(bcbuf.index);
		
		//TODO - clean up message passing
		//if( write_pipe() != sizeof(GstBufferClassBuffer *))
		{	
			printf("Error Writing into Init Queue\n");
			//TODO - try again n times ?
			break;
		}
	}
exit:
	release_view();
	deInitEGL();
exitCMEMAlloc:
	mem_cmem_free( virtualAddress);
exitPipes:	
	if(paArray) free(paArray);
	if(freeArray) free(freeArray);
	deinit_pipes();
exitCMEMInit:
	mem_cmem_deinit();
exitNone:
	return 0;
}
Beispiel #20
0
void demo_init_gui(void)
{
    InitBMPINFO(&icon);
    LoadBmp(&icon, "icon.bmp");
    load_fonts();

    gui_desktop_enable();
    gui_desktop_set_color(CLRSCR_COLOR2);
    
    form = gui_create_widget(GUI_WIDGET_FORM, 180, 120, 632, 500, 0, 0, 0, FORM_STYLE_XP_BORDER|FORM_STYLE_TITLE);
    if(!form)
        goto err;
    gui_form_init_private(form, 128);
    gui_form_set_caption(form, "控件演示");
    gui_form_set_icon(form, &icon);

    edit = gui_create_widget(GUI_WIDGET_EDIT, 80, 270, 460, 48, color, bkcolor, 0, style);
    if(!edit)
        goto err;
    gui_edit_init_private(edit, 128);
    gui_edit_set_text(edit, "这是一个文本框");

    button = gui_create_widget(GUI_WIDGET_BUTTON, 235+156, 142+100, 236, 32, COLOR_YELLOW, 64, font16, 0); /*BUTTON_STYLE_CLIENT_BDR*/
    if(!edit)
        goto err;
    gui_button_init_private(button, 128);
    gui_button_set_caption(button, "将那个Label盖住");

    test = gui_create_widget(GUI_WIDGET_EDIT, 80, 330, 460, 32, 0, 0, 0, 0);
    if(!test)
        goto err;
    gui_edit_init_private(test, 128);
    gui_edit_set_text(test, "");

    label = gui_create_widget(GUI_WIDGET_LABEL, 80, 380, 460, 64, COLOR_WHITE, 66, font48, LABEL_STYLE_SUBSIDE);
    if(!edit)
        goto err;
    gui_label_init_private(label, 128);
    gui_label_set_text(label, "Startting...");

    view = gui_create_widget(GUI_WIDGET_VIEW, 80, 48, 460, 200, 0, 0, 0, VIEW_STYLE_NONE_FIRST|VIEW_STYLE_FIELDS_TITLE|VIEW_STYLE_STATISTIC_BAR);
    if(!view)
        goto err;
    init_view(view);

    progress1 = gui_create_widget(GUI_WIDGET_PROGRESS, 80, 251, 460, 14, 0, 0, 0, PROGRESS_STYLE_BORDER);
    if(!progress1)
        goto err;
    gui_progress_init_private(progress1, 100);

    dialog = input_dialog_initialize(&abcde);
    if(!dialog)
        goto err;

    gui_widget_link(NULL, form);
    gui_widget_link(form, view);
    gui_widget_link(form, edit);
    gui_widget_link(form, label);
    gui_widget_link(form, progress1);
    gui_widget_link(form, test);

    gui_widget_link(NULL, dialog);

    gui_widget_link(NULL, button);

    window1 = gui_create_window(form);
    gui_show_window(window1);

    window2 = gui_create_window(dialog);
    gui_show_window(window2);

    window3 = gui_create_window(button);
    gui_show_window(window3);

    gui_form_set_caption(form, os_get_description());

    StartGUI();
    
err:
    return;
}
Beispiel #21
0
void set_file(t_x11 *x11, t_manager *man, const char *trajectory,
              const char *status)
{
    gmx_atomprop_t    aps;
    t_tpxheader       sh;
    t_atoms          *at;
    bool             *bB;
    int               i;

    read_tpxheader(status, &sh, true);
    snew(man->ix, sh.natoms);
    snew(man->zz, sh.natoms);
    snew(man->col, sh.natoms);
    snew(man->size, sh.natoms);
    snew(man->vdw, sh.natoms);
    snew(man->bLabel, sh.natoms);
    snew(man->bVis, sh.natoms);
    for (i = 0; (i < sh.natoms); i++)
    {
        man->bVis[i] = false;
    }

    man->bPbc = false;

    snew(man->szLab, sh.natoms);
    snew(man->bHydro, sh.natoms);
    snew(bB, sh.natoms);
    read_tpx_top(status, nullptr, man->box, &man->natom, nullptr, nullptr, &man->top);
    man->gpbc = gmx_rmpbc_init(&man->top.idef, -1, man->natom);

    man->natom =
        read_first_x(man->oenv, &man->status, trajectory, &(man->time), &(man->x),
                     man->box);
    man->trajfile = gmx_strdup(trajectory);
    if (man->natom > man->top.atoms.nr)
    {
        gmx_fatal(FARGS, "Topology %s (%d atoms) and trajectory %s (%d atoms) "
                  "do not match", status, man->top.atoms.nr,
                  trajectory, man->natom);
    }

    man->title.text = gmx_strdup(gmx::formatString("%s: %s", *man->top.name, gmx::getCoolQuote().c_str()).c_str());
    man->view       = init_view(man->box);
    at              = &(man->top.atoms);
    aps             = gmx_atomprop_init();
    for (i = 0; (i < man->natom); i++)
    {
        char      *aname = *(at->atomname[i]);
        t_resinfo *ri    = &at->resinfo[at->atom[i].resind];

        man->col[i] = Type2Color(aname);
        snew(man->szLab[i], 20);
        if (ri->ic != ' ')
        {
            std::sprintf(man->szLab[i], "%s%d%c, %s", *ri->name, ri->nr, ri->ic, aname);
        }
        else
        {
            std::sprintf(man->szLab[i], "%s%d, %s", *ri->name, ri->nr, aname);
        }
        man->bHydro[i] = (toupper(aname[0]) == 'H');
        if (man->bHydro[i])
        {
            man->vdw[i] = 0;
        }
        else if (!gmx_atomprop_query(aps, epropVDW, *ri->name, aname, &(man->vdw[i])))
        {
            man->vdw[i] = 0;
        }
    }
    gmx_atomprop_destroy(aps);
    add_bpl(man, &(man->top.idef), bB);
    for (i = 0; (i < man->natom); i++)
    {
        if (!bB[i])
        {
            add_object(man, eOSingle, (int) i, 0);
        }
    }
    sfree(bB);

    ExposeWin(x11->disp, man->molw->wd.self);
}
Beispiel #22
0
void set_file(t_x11 *x11,t_manager *man,char *trajectory,char *status)
{
  gmx_atomprop_t aps;
  char         buf[256],quote[256];
  t_tpxheader  sh;
  t_atoms      *at;
  bool         *bB;
  int          i,idum;
  real         rdum;

  read_tpxheader(status,&sh,TRUE,NULL,NULL);
  snew(man->ix,sh.natoms);
  snew(man->zz,sh.natoms);
  snew(man->col,sh.natoms);
  snew(man->size,sh.natoms);
  snew(man->vdw,sh.natoms);
  snew(man->bLabel,sh.natoms);
  snew(man->bVis,sh.natoms);
  for(i=0; (i<sh.natoms); i++)
    man->bVis[i]=FALSE;

  man->bPbc=FALSE;

  snew(man->szLab,sh.natoms);
  snew(man->bHydro,sh.natoms);
  snew(bB,sh.natoms);
  read_tpx_top(status,&(man->step),&(man->time),&rdum,NULL,man->box,
	       &man->natom,NULL,NULL,NULL,&man->top);
  
  man->natom=
    read_first_x(&man->status,trajectory,&(man->time),&(man->x),man->box);
  man->trajfile=strdup(trajectory);
  if (man->natom > man->top.atoms.nr)
    gmx_fatal(FARGS,"Topology %s (%d atoms) and trajectory %s (%d atoms) "
		"do not match",status,man->top.atoms.nr,
		trajectory,man->natom);
 
  cool_quote(quote,255,NULL);
  sprintf(buf,"%s: %s",*man->top.name,quote);
  man->title.text = strdup(buf);
  man->view       = init_view(man->box);
  at  = &(man->top.atoms);
  aps = gmx_atomprop_init();
  for(i=0; (i<man->natom); i++) {
    char *aname=*(at->atomname[i]);
    int  resnr=at->atom[i].resnr;

    man->col[i]=Type2Color(aname);
    snew(man->szLab[i],20);
    sprintf(man->szLab[i],"%s%d, %s",*(at->resname[resnr]),resnr+1,aname);
    man->bHydro[i]=(toupper(aname[0])=='H');
    if ( man->bHydro[i] )
      man->vdw[i]=0;
    else if (!gmx_atomprop_query(aps,epropVDW,
				 *(at->resname[resnr]),aname,
				 &(man->vdw[i])))
      man->vdw[i] = 0;
  }
  gmx_atomprop_destroy(aps);
  add_bpl(man,&(man->top.idef),bB);
  for(i=0; (i<man->natom); i++)
    if (!bB[i]) 
      add_object(man,eOSingle,(atom_id) i,0);
  sfree(bB);

  ExposeWin(x11->disp,man->molw->wd.self);
}
Beispiel #23
0
int
main (int argc, char *argv[])
{
  vc_component *v = NULL;
  fpos_t *fpos = NULL;
  long pos = 0;
  FILE *fp = NULL;
  ITEM *it = NULL;
  int entry_number = 0;

  bool done = FALSE;
  int win_state = WINDOW_INDEX;
  int command = 0;

  set_defaults ();
  process_command_line_args (argc, argv);
  /*
   * process_environment_variables(); 
   * process_configuration_file(); 
   */

  signal (SIGINT, finish);      /* catch interrupt for exiting */
  signal (SIGWINCH, resize);    /* catch interrupt for resizing */
  initscr ();

  keypad (stdscr, TRUE);        /* enable keypad for use of arrow keys */
  nonl ();                      /* tell curses not to do NL->CR/NL on output */
  cbreak ();                    /* take input chars immediately */
  noecho ();

  init_index (data_path);
  set_index_help_fcn (show_index_help);
  init_view ();
  set_view_help_fcn (show_view_help);
  init_edit ();
  set_edit_help_fcn (show_edit_help);
  init_help ();

  while (!done)
    {
      switch (win_state)
        {
        case WINDOW_INDEX:

      /*-------------------
         display the index
        -------------------*/

          display_index ();
          command = process_index_commands ();

          switch (command)
            {
            case INDEX_COMMAND_VIEW:
              win_state = WINDOW_VIEW;
              break;
            case INDEX_COMMAND_RAW_VIEW:
              win_state = WINDOW_RAW_VIEW;
              break;
            case INDEX_COMMAND_EDIT:
              win_state = WINDOW_EDIT;
              break;
            case INDEX_COMMAND_ADD:
              win_state = WINDOW_ADD;
              break;
            case INDEX_COMMAND_DELETE:
              win_state = WINDOW_DELETE;
              break;
            case INDEX_COMMAND_QUIT:
              done = TRUE;
              break;
            default:
              break;
            }

          break;

        case WINDOW_RAW_VIEW:

      /*-------------------------------------------------
         view the currently selected item with the pager
        -------------------------------------------------*/

          it = get_current_item ();

          /* only display if there is an item that is selected */
          if (NULL == it)
            {
              v = NULL;
            }
          else
            {
              fpos = (fpos_t *) item_userptr (it);

              fp = fopen (data_path, "r");
              fsetpos (fp, fpos);
              v = parse_vcard_file (fp);
              fclose (fp);
            }

          if (v != NULL)
            {
              raw_view (v);
              vc_delete_deep (v);
              v = NULL;
            }

          win_state = WINDOW_INDEX;

          break;

        case WINDOW_VIEW:

      /*----------------------------------
         view the currently selected item
        ----------------------------------*/

          it = get_current_item ();

          /* only display if there is an item that is selected */
          if (NULL == it)
            {
              v = NULL;
            }
          else
            {
              fpos = (fpos_t *) item_userptr (it);

              fp = fopen (data_path, "r");
              fsetpos (fp, fpos);
              v = parse_vcard_file (fp);
              fclose (fp);
            }

          if (v != NULL)
            {
              entry_number = get_entry_number (it);
              view_vcard (entry_number, v);
              command = process_view_commands ();

              switch (command)
                {
                case VIEW_COMMAND_EDIT:
                  win_state = WINDOW_EDIT;
                  break;
                case VIEW_COMMAND_INDEX:
                  win_state = WINDOW_INDEX;
                  break;
                case VIEW_COMMAND_PREVIOUS:
                  select_previous_item ();
                  win_state = WINDOW_VIEW;
                  break;
                case VIEW_COMMAND_NEXT:
                  select_next_item ();
                  win_state = WINDOW_VIEW;
                  break;
                default:
                  break;
                }
            }
          else
            {
              win_state = WINDOW_INDEX;
            }

          vc_delete_deep (v);
          v = NULL;

          break;

        case WINDOW_EDIT:

      /*--------------
         edit a vcard
        --------------*/

          it = get_current_item ();

          /* only display if there is an item that is selected */
          if (NULL != it)
            {
              fpos = (fpos_t *) item_userptr (it);

              fp = fopen (data_path, "r");
              fsetpos (fp, fpos);
              pos = ftell (fp);
              fclose (fp);
              fp = NULL;

              if (EDIT_SUCCESSFUL == edit_entry (data_path, pos))
                {
                  refresh_index ();
                }
            }

          win_state = WINDOW_INDEX;
          break;

        case WINDOW_ADD:
          if (ADD_SUCCESSFUL == add_entry (data_path))
            {
              refresh_index ();
            }

          win_state = WINDOW_INDEX;
          break;
        case WINDOW_DELETE:

          it = get_current_item ();

          /* only delete if there is an item that is selected */
          if (NULL != it)
            {
              fpos = (fpos_t *) item_userptr (it);

              fp = fopen (data_path, "r");
              fsetpos (fp, fpos);
              pos = ftell (fp);
              fclose (fp);
              fp = NULL;

              if (DELETE_SUCCESSFUL == delete_entry (data_path, pos))
                {
                  refresh_index ();
                }
            }

          win_state = WINDOW_INDEX;
          break;
        default:
          break;
        }
    }

  finish (0);
  exit (EXIT_SUCCESS);
  return (0);
}
Beispiel #24
0
/**
* \fn int main(int argc, char *argv[])
* \brief Fonction principale.
*
*
* La fonction principale récupère les arguments et le fichier de configuration,
* initialise la vue, le modèle, puis éxécute la boucle de calcul.
* Une fois cette boucle terminée, elle libère la mémoire et finalise l'éxécution.
*
*
*/
int main(int argc, char *argv[])
{
	config_t *conf = parse_args(argc, argv);

	int error = 0;
	error_t *error_cell = NULL;

	if(conf == NULL)
	{
		return 1;
	}

	view_t *view = init_view(conf);

	model_t *model = init_model(conf);

	double delta_time = 0;
	event_t event;

	init_event(&event);

	vect_t chunk_pos;
	init_vect(&chunk_pos, 0.4, 0.4, 0.4);
	add_chunk(model, &chunk_pos);
	//add_chunk(model, &chunk_pos);
	//add_chunk(model, &chunk_pos);
	//add_chunk(model, &chunk_pos);
	//add_chunk(model, &chunk_pos);
	//add_chunk(model, &chunk_pos);


	while(!event.exit_wanted)
	{
		delta_time = temporize(conf);
		get_event(&event, view);

		if(event.click_callback != NULL)
			(*(event.click_callback))(model);

		error = update_model(model, &event, delta_time);

		if(error)
		{
			printf("ERREUR DETECTEE !\n");
			error_cell = get_error_list();
			int error_count = 0;

			while(error_cell != NULL)
			{
				printf("%s\n", error_cell->comment);
				error_cell = error_cell->next;
				error_count++;
				if(error_count >= 10)
				{
					printf("Appuyez sur ENTREE pour voir la suite, q puis ENTREE pour quitter.\n");
					if(getchar() == 'q')
						return 1;
					error_count = 0;
				}
			}
			return 1;
		}

		update_view(view, model, &event);
	}

	close_conf(conf);
	close_view(view);
	close_model(model);

	return 0;
}