Beispiel #1
0
void egxp_node_add_in_order (Ecore_DList * l, Egxp_Node * n) {
#ifdef EGXP_DEBUG
  printf("TRACE: egxp_node_add_in_order\n");
#endif

  assert (l && n);
  Egxp_Node * pn = NULL;

  /* before doing anything, check if there is condition,
     if not we add it to the end if the list */
  if (n->conditions == NULL || ecore_list_nodes (l) == 0) {
    ecore_dlist_append (l, n);
    return;
  }
  
  
  /* go to the first node */
  ecore_dlist_goto_first(l);
  
  while((pn = EGXP_NODE(ecore_dlist_next(l))) != NULL) {
    if (pn->conditions == NULL || 
        ecore_dlist_nodes (n->conditions) > ecore_dlist_nodes(pn->conditions)) {
      ecore_dlist_previous(l);
      ecore_dlist_insert (l, n);
      return;
    }
  }
  
  ecore_dlist_append (l, n);
}
Ecore_DList *
ewl_engine_dependancies(void)
{
        Ecore_DList *d;

        DENTER_FUNCTION(DLEVEL_STABLE);

        d = ecore_dlist_new();
        ecore_dlist_append(d, strdup("x11"));
        ecore_dlist_append(d, strdup("evas"));

        DRETURN_PTR(d, DLEVEL_STABLE);
}
Beispiel #3
0
static void
help_reader_window_history_add(Help_Reader_Window * win, const char * path)
{
    /* first remove every item after the current one in the history,
     * ie. remove the future :) */
    while (help_reader_window_history_has_next(win))
    {
        void * data;
        data = ecore_dlist_last_remove(win->history);
        free(data);
    }

    ecore_dlist_append(win->history, strdup(path));

    /* move the iterator to the end */
    ecore_dlist_last_goto(win->history);
    help_reader_window_buttons_update(win);
}
Beispiel #4
0
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;
}