Ejemplo n.º 1
0
void Mesh::fillColors(bool force) {
  if (force || colors.size()) {
    if (colors.size() != positions.size()) {
      add_all(colors, VVec3(positions.size() - colors.size(), color));
    }
  }
}
Ejemplo n.º 2
0
Archivo: ae.c Proyecto: flygoast/verben
int main(int argc, char *argv[]) {
    long long id;
    ae_event_loop *el = ae_create_event_loop();
    add_all(el);
    ae_main(el);
    delete_all(el);
    exit(0);
}
Ejemplo n.º 3
0
void
dsum(void)
{
    int h = tos;
    p1 = cdr(p1);
    while (iscons(p1)) {
        push(car(p1));
        push(p2);
        derivative();
        p1 = cdr(p1);
    }
    add_all(tos - h);
}
Ejemplo n.º 4
0
int
parse_columns(columns_t columns, add_column_cb ac, map_name_cb cn,
		const char str[], void *arg)
{
	column_info_t *list;
	size_t list_len;
	if((list = parse_all(cn, str, &list_len, arg)) != NULL)
	{
		add_all(columns, ac, list, list_len);
		free(list);
		return 0;
	}
	return 1;
}
Ejemplo n.º 5
0
void Mesh::addMesh(const Mesh & mesh, bool forceColor) {
  int indexOffset = positions.size();

  // Positions are transformed
  add_all_transformed(model.top(), positions, mesh.positions);

  // normals are transformed with only the rotation, not the translation
  model.push().untranslate();
  add_all_transformed(model.top(), normals, mesh.normals);
  model.pop();

  // colors and tex coords are simply copied
  add_all(colors, mesh.colors);
  fillColors(forceColor);

  add_all(texCoords, mesh.texCoords);
  if (texCoords.size() && texCoords.size() != positions.size()) {
    add_all(texCoords, VVec2(positions.size() - texCoords.size(), glm::vec2()));
  }

  // indices are copied and incremented
  add_all_incremented(indexOffset, indices, mesh.indices);
}
Ejemplo n.º 6
0
int main(int argc, char *argv[]) 
{
    //long long id;
    int mask, fd;

    fd = open("test_ae.file", O_RDWR );
    mask = MSD_AE_WRITABLE | MSD_AE_READABLE;
    msd_ae_event_loop *el = msd_ae_create_event_loop();
    add_all(el);
    /* 如果是epoll,不支持 */
    msd_ae_create_file_event(el, fd, mask, file_process, "hello\n");
    msd_ae_main_loop(el);
    delete_all(el);
    exit(0);
}
Ejemplo n.º 7
0
void
dproduct(void)
{
    int i, j, n;
    n = length(p1) - 1;
    for (i = 0; i < n; i++) {
        p3 = cdr(p1);
        for (j = 0; j < n; j++) {
            push(car(p3));
            if (i == j) {
                push(p2);
                derivative();
            }
            p3 = cdr(p3);
        }
        multiply_all(n);
    }
    add_all(n);
}
Ejemplo n.º 8
0
void
simfac(void)
{
	int h;
	save();
	p1 = pop();
	if (car(p1) == symbol(ADD)) {
		h = tos;
		p1 = cdr(p1);
		while (p1 != symbol(NIL)) {
			push(car(p1));
			simfac_term();
			p1 = cdr(p1);
		}
		add_all(tos - h);
	} else {
		push(p1);
		simfac_term();
	}
	restore();
}
Ejemplo n.º 9
0
void
distill_sum(void)
{
	int h;

	// distill terms involving x

	p3 = cdr(p1);

	while (iscons(p3)) {
		if (find(car(p3), p2)) {
			push(car(p3));
			push(p2);
			distill();
		}
		p3 = cdr(p3);
	}

	// add together all constant terms

	h = tos;

	p3 = cdr(p1);

	while (iscons(p3)) {
		if (find(car(p3), p2) == 0)
			push(car(p3));
		p3 = cdr(p3);
	}

	if (tos - h) {
		add_all(tos - h);
		p3 = pop();
		push(p3);
		push(p3);
		negate();	// need both +a, -a for some integrals
	}
}
Ejemplo n.º 10
0
static void macmenu_construct(AppletType* applet)
{
  MacMenu *mmb = g_slice_new0(MacMenu);
  mmb->applet = applet;
  mmb->screen = wnck_screen_get(gdk_screen_get_number(
      gtk_widget_get_screen(GTK_WIDGET(applet))
      ));
  mmb->mbars_scks = g_hash_table_new(NULL, NULL);
  mmb->title_subs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
  mmb->ts_mtime = 0;

  mmb->basebox = GTK_BOX(gtk_hbox_new(FALSE, 0));
  gtk_container_set_border_width(GTK_CONTAINER(mmb->basebox), 0);
  gtk_container_add(GTK_CONTAINER(applet), GTK_WIDGET(mmb->basebox));

  mmb->label = GTK_LABEL(gtk_label_new(MAIN_LABEL_TEXT));
  PangoAttrList *pattr = pango_attr_list_new();
  PangoAttribute *pa = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
  pa->start_index = 0; pa->end_index = 1024;
  pango_attr_list_insert(pattr, pa);
  gtk_label_set_attributes(mmb->label, pattr);
  pango_attr_list_unref(pattr);
  gtk_label_set_ellipsize(mmb->label, PANGO_ELLIPSIZE_END);
  gtk_label_set_max_width_chars(mmb->label, MAX_LABEL_WIDTH_N_CHARS * 10);
  gtk_label_set_single_line_mode(mmb->label, TRUE);
  gtk_box_pack_start(mmb->basebox, GTK_WIDGET(mmb->label), FALSE, FALSE, 0);

  mmb->label_space = gtk_event_box_new();
  gtk_widget_set_size_request(mmb->label_space, 8, 1);
  gtk_box_pack_start(mmb->basebox, mmb->label_space, FALSE, FALSE, 0);

  mmb->notebook = GTK_NOTEBOOK(gtk_notebook_new());
  gtk_notebook_set_show_tabs(mmb->notebook, FALSE);
  gtk_notebook_set_show_border(mmb->notebook, FALSE);
  gtk_box_pack_start(mmb->basebox, GTK_WIDGET(mmb->notebook), TRUE, TRUE, 0);

  mmb->dummysck = gtk_hbox_new(FALSE, 0);
  gtk_notebook_append_page(mmb->notebook, mmb->dummysck, NULL);

  mmb->mainsck = gtk_hbox_new(FALSE, SHORTCUT_SPACING);
  gtk_notebook_append_page(mmb->notebook, mmb->mainsck, NULL);
  //initialize_mainsck(mmb);

  mmb->button = GTK_BUTTON(gtk_button_new());
  gtk_button_set_relief(mmb->button, GTK_RELIEF_NONE);
  gtk_button_set_focus_on_click(GTK_BUTTON(mmb->button), FALSE);
  gtk_box_pack_start(mmb->basebox, GTK_WIDGET(mmb->button),
                     FALSE, FALSE, 0);

  g_signal_connect(mmb->screen, "active-window-changed",
                   G_CALLBACK(desktop_active_window_changed), mmb);
  g_signal_connect(mmb->screen, "window-opened",
                   G_CALLBACK(desktop_window_opened), mmb);

#ifdef FOR_XFCE
  g_signal_connect(applet, "free-data",
                   G_CALLBACK(macmenu_free_data), mmb);
  g_signal_connect(applet, "size-changed",
                   G_CALLBACK(macmenu_set_size), mmb);
  // setup panel applet
  gtk_widget_show_all(GTK_WIDGET(mmb->basebox));
  xfce_panel_plugin_add_action_widget (applet, GTK_WIDGET(mmb->button));
  xfce_panel_plugin_set_expand(applet, TRUE);
  macmenu_set_size(applet, xfce_panel_plugin_get_size(applet), mmb);
  // load config, set popup
  macmenu_load_from_rc(mmb);
  GtkWidget* label_toggle = gtk_check_menu_item_new_with_label("Hide Label");
  g_signal_connect(label_toggle, "toggled", G_CALLBACK(on_label_toggled), mmb);
  gtk_widget_show(label_toggle);
  gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(label_toggle), mmb->hide_label);
  gtk_check_menu_item_toggled(GTK_CHECK_MENU_ITEM(label_toggle));
  xfce_panel_plugin_menu_insert_item(mmb->applet, GTK_MENU_ITEM(label_toggle));

#elif FOR_GNOME
  g_signal_connect(applet, "destroy", G_CALLBACK(macmenu_free_data), mmb);
  // setup panel applet
  gtk_widget_show_all(GTK_WIDGET(applet));
  g_signal_connect(GTK_WIDGET(mmb->button), "pressed",
                   G_CALLBACK(on_button_pressed), mmb);
  panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MAJOR);
  macmenu_set_size(applet, panel_applet_get_size(applet), mmb);
  // load config, set popup
  mmb->gconf = gconf_client_get_default();
  macmenu_load_from_gconf(mmb);
  macmenu_write_gconf(mmb);
  static const char toggle_menu_xml [] =
   "<popup name=\"button3\">\n"
   "   <menuitem name=\"hide_label\" "
   "             verb=\"hide_label\" "
   "           _label=\"_Hide Label\"\n"
   "             type=\"toggle\"/>\n"
   "</popup>\n";
  static const BonoboUIVerb toggle_menu_verbs[] =
  {
    BONOBO_UI_VERB_END
  };
  panel_applet_setup_menu(mmb->applet, toggle_menu_xml, toggle_menu_verbs, mmb);
  BonoboUIComponent* popup_component = panel_applet_get_popup_component(mmb->applet);
  bonobo_ui_component_set_prop(popup_component, "/commands/hide_label",
                               "state", mmb->hide_label ? "1": "0", NULL);
  bonobo_ui_component_add_listener(panel_applet_get_popup_component(mmb->applet),
                                   "hide_label",
                                   (BonoboUIListenerFn) on_label_toggled,
                                   mmb);
  on_label_toggled(NULL, NULL, 0, NULL, mmb);
#endif // FOR_XFCE/FOR_GNOME

  add_all(mmb);
  XSetErrorHandler(handle_x_error);
}
Ejemplo n.º 11
0
 void RM::mle(){
   add_all();
   set_Beta(suf()->beta_hat());
   set_sigsq(suf()->SSE()/suf()->n());
 }