void egxp_node_add_child (Egxp_Node * parent, Egxp_Node * child) { #ifdef EGXP_DEBUG printf("TRACE: egxp_node_add_child\n"); #endif assert (parent && child); if (parent->childs == NULL) { /* create a hash */ parent->childs = ecore_hash_new (ecore_direct_hash, ecore_direct_compare); /* destroy each element */ ecore_hash_set_free_value (parent->childs, (Ecore_Free_Cb)ecore_dlist_destroy); } /* try to get the list for the special tag */ Ecore_DList * ltmp = ECORE_DLIST (ecore_hash_get (parent->childs, (int*)child->tag)); if (ltmp == NULL) { /* doesn't exist, so create it */ ltmp = ecore_dlist_new (); ecore_dlist_set_free_cb (ltmp,(Ecore_Free_Cb)egxp_node_free); /* append the list to the hash, hash is indexed by the tag id */ ecore_hash_set (parent->childs, (int*)child->tag, ltmp); } /* now append the child to the list */ egxp_node_add_in_order (ltmp, child); /* set the parent for the child */ child->parent = parent; }
Ecore_DList * ewl_engine_dependancies(void) { Ecore_DList *d; DENTER_FUNCTION(DLEVEL_STABLE); d = ecore_dlist_new(); ecore_dlist_append(d, strdup("evas")); DRETURN_PTR(d, DLEVEL_STABLE); }
/* * Internal functions */ static Ewl_Widget * help_reader_window_new(void) { Ewl_Widget * win, * c, * w, * vbox; win = calloc(1, sizeof(Help_Reader_Window)); ewl_window_init(EWL_WINDOW(win)); ewl_object_size_request(EWL_OBJECT(win), 600, 500); ewl_window_name_set(EWL_WINDOW(win), "Elitaire Help"); ewl_window_class_set(EWL_WINDOW(win), "Elitaire"); ewl_callback_append(win, EWL_CALLBACK_DESTROY, help_reader_window_cb_destroy, NULL); ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, help_reader_window_cb_delete, NULL); ewl_widget_show(win); /* vbox to hold the toolbar and the text view */ vbox = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(win), vbox); ewl_widget_show(vbox); /* the toolbar */ c = ewl_htoolbar_new(); ewl_toolbar_icon_part_hide(EWL_TOOLBAR(c), EWL_ICON_PART_LABEL); ewl_container_child_append(EWL_CONTAINER(vbox), c); ewl_widget_show(c); /* the toolbar buttons */ w = ewl_icon_simple_new(); ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_ARROW_LEFT); ewl_callback_append(w, EWL_CALLBACK_CLICKED, help_reader_prev_button_cb_clicked, win); ewl_container_child_append(EWL_CONTAINER(c), w); ewl_widget_disable(w); ewl_widget_show(w); HELP_READER_WINDOW(win)->prev_button = w; w = ewl_icon_simple_new(); ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_ARROW_RIGHT); ewl_callback_append(w, EWL_CALLBACK_CLICKED, help_reader_next_button_cb_clicked, win); ewl_container_child_append(EWL_CONTAINER(c), w); ewl_widget_disable(w); ewl_widget_show(w); HELP_READER_WINDOW(win)->next_button = w; w = ewl_icon_simple_new(); ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_HOME); ewl_callback_append(w, EWL_CALLBACK_CLICKED, help_reader_home_button_cb_clicked, win); ewl_container_child_append(EWL_CONTAINER(c), w); ewl_widget_show(w); /* the text view */ c = ewl_scrollpane_new(); ewl_container_child_append(EWL_CONTAINER(vbox), c); ewl_widget_show(c); w = ewl_text_new(); ewl_container_child_append(EWL_CONTAINER(c), w); ewl_widget_show(w); HELP_READER_WINDOW(win)->text = w; /* the histroy */ HELP_READER_WINDOW(win)->history = ecore_dlist_new(); ecore_dlist_free_cb_set(HELP_READER_WINDOW(win)->history, free); return win; }
Ecore_DList * evfs_tokenize_uri(char *uri) { Ecore_DList *tokens = ecore_dlist_new(); Ecore_DList *reserved = ecore_dlist_new(); Ecore_DList *plugin = ecore_dlist_new(); char *dup_uri = malloc(strlen(uri) + 2); /*dup_uri = realloc(dup_uri, strlen(uri)+2); * strcat(dup_uri," "); */ char *l_uri = dup_uri; int solid_alpha = 0; int new_alpha = 0; evfs_uri_token *token; char *cmp; char tmp_tok[255]; /*This need to be longer? */ int i = 0; int j = 1; int len = 0; char tagged = 0; snprintf(dup_uri, strlen(uri) + 1, "%s ", uri); ecore_dlist_append(plugin, "smb"); /*Shift these to register when a plugin registers */ ecore_dlist_append(plugin, "file"); ecore_dlist_append(plugin, "tar"); ecore_dlist_append(plugin, "bzip2"); ecore_dlist_append(plugin, "ftp"); ecore_dlist_append(plugin, "gzip"); ecore_dlist_append(plugin, "sftp"); ecore_dlist_append(plugin, "posix"); ecore_dlist_append(plugin, "vfolder"); ecore_dlist_append(plugin, "trash"); ecore_dlist_append(reserved, "://"); ecore_dlist_append(reserved, "@"); ecore_dlist_append(reserved, "/"); ecore_dlist_append(reserved, ":"); ecore_dlist_append(reserved, "#"); ecore_dlist_append(reserved, ";"); //printf ("Lexing '%s'\n", dup_uri); //printf("Strlen(uri): %d\n", strlen(uri)); while (j <= strlen(dup_uri)) { new_alpha = (isalnum(l_uri[i]) || l_uri[i] == '.'); len = 0; tagged = 0; strncpy(tmp_tok, l_uri, 3); tmp_tok[3] = '\0'; //printf("Current token is: '%s'\n", tmp_tok); /*Check if it's an operator */ ecore_dlist_first_goto(reserved); while ((cmp = ecore_dlist_next(reserved))) { if (!strncmp(tmp_tok, cmp, strlen(cmp))) { //printf("Found token (operator) %s, added %d to l_uri\n", cmp, strlen(cmp)); l_uri += strlen(cmp); len = strlen(cmp); tagged = 1; //printf("L_URI becomes '%s'\n", l_uri); token = NEW(evfs_uri_token); token->token_s = strdup(cmp); token->type = EVFS_URI_TOKEN_OPERATOR; ecore_dlist_append(tokens, token); bzero(tmp_tok, 255); goto cont_loop; } } /*Check if it's a keyword */ strncpy(tmp_tok, l_uri, i); tmp_tok[i] = '\0'; //printf("Current token (keyword match) is: '%s'\n", tmp_tok); ecore_dlist_first_goto(plugin); while ((cmp = ecore_dlist_next(plugin))) { if (!strncmp(tmp_tok, cmp, strlen(cmp))) { //printf("Found token (keyword) %s, added %d to l_uri\n", cmp, strlen(cmp)); l_uri += strlen(cmp); tagged = 2; token = NEW(evfs_uri_token); token->token_s = strdup(cmp); token->type = EVFS_URI_TOKEN_KEYWORD; ecore_dlist_append(tokens, token); bzero(tmp_tok, 255); goto cont_loop; /*Eww goto - but we're in two while loops */ } } if (solid_alpha && !new_alpha) { strncpy(tmp_tok, l_uri, i); /*There is a lexer position bug for now- this will fix it FIXME */ if (tmp_tok[0] == '\0') goto lexer_done; tmp_tok[i] = '\0'; token = NEW(evfs_uri_token); token->token_s = strdup(tmp_tok); token->type = EVFS_URI_TOKEN_STRING; ecore_dlist_append(tokens, token); bzero(tmp_tok, 255); l_uri += i; tagged = 3; } solid_alpha = new_alpha; cont_loop: if (tagged > 0) { if (tagged == 1 || tagged == 2) j += strlen(cmp); else j += i; i = 0; } i++; //printf("i:J (%d:%d) - %d\n", i,j,strlen(dup_uri)); } lexer_done: /*This is really evil - we assume the last token is a string */ /*There is something wrong with the offsets above if this is * the case*/ if (strlen(tmp_tok) > 0) { printf("libevfs.c evil - FIXME\n"); token = NEW(evfs_uri_token); token->token_s = strdup(tmp_tok); token->type = EVFS_URI_TOKEN_STRING; ecore_dlist_append(tokens, token); } ecore_dlist_destroy(plugin); ecore_dlist_destroy(reserved); free(dup_uri); return tokens; }