Ejemplo n.º 1
0
Archivo: docs.c Proyecto: tasn/efl
static void
_gen_doc_brief(const Eolian_State *state, const char *summary, const char *since,
               const char *group, const char *el, int indent, Eina_Strbuf *buf)
{
   int curl = 4 + indent;
   Eina_Strbuf *wbuf = eina_strbuf_new();
   if (indent)
     eina_strbuf_append(buf, "/**< ");
   else
     eina_strbuf_append(buf, "/** ");
   curl = _append_section(state, summary, indent, curl, buf, wbuf);
   eina_strbuf_free(wbuf);
   curl = _append_extra(el, indent, curl, EINA_FALSE, buf);
   curl = _append_since(since, indent, curl, buf);
   char *sgrp = _sanitize_group(group);
   if (((curl + 3) > DOC_LIMIT(indent)) || sgrp)
     {
        eina_strbuf_append_char(buf, '\n');
        _indent_line(buf, indent);
        if (sgrp) eina_strbuf_append(buf, " *");
     }
   if (sgrp)
     {
        eina_strbuf_append_char(buf, '\n');
        _indent_line(buf, indent);
     }
   _append_group(buf, sgrp, indent);
   eina_strbuf_append(buf, " */");
}
Ejemplo n.º 2
0
Archivo: docs.c Proyecto: tasn/efl
Eina_Strbuf *
eo_gen_docs_event_gen(const Eolian_State *state, const Eolian_Event *ev,
                      const char *group)
{
   if (!ev) return NULL;

   const Eolian_Documentation *doc = eolian_event_documentation_get(ev);

   char buf[1024];
   const Eolian_Type *rt = eolian_event_type_get(ev);
   const char *p = NULL;
   if (rt)
     {
        p = buf;
        Eina_Stringshare *rts = eolian_type_c_type_get(rt, EOLIAN_C_TYPE_DEFAULT);
        snprintf(buf, sizeof(buf), "@return %s", rts);
        eina_stringshare_del(rts);
     }

   if (!doc)
     {
        Eina_Strbuf *bufs = eina_strbuf_new();
        eina_strbuf_append(bufs, "/**\n * No description\n");
        if (p)
          {
             eina_strbuf_append(bufs, " * ");
             eina_strbuf_append(bufs, p);
             eina_strbuf_append_char(bufs, '\n');
          }
        eina_strbuf_append(bufs, " */");
        return bufs;
     }

   return _gen_doc_buf(state, doc, group, p, 0);
}
Ejemplo n.º 3
0
static void
_gen_doc_brief(const char *summary, const char *since, const char *group,
               int indent, Eina_Strbuf *buf, Eina_Bool use_legacy)
{
   int curl = 4 + indent;
   Eina_Strbuf *wbuf = eina_strbuf_new();
   eina_strbuf_append(buf, "/** ");
   curl = _append_section(summary, indent, curl, buf, wbuf, use_legacy);
   eina_strbuf_free(wbuf);
   curl = _append_since(since, indent, curl, buf);
   char *sgrp = _sanitize_group(group);
   if (((curl + 3) > DOC_LIMIT(indent)) || sgrp)
     {
        eina_strbuf_append_char(buf, '\n');
        _indent_line(buf, indent);
        if (sgrp) eina_strbuf_append(buf, " *");
     }
   if (sgrp)
     {
        eina_strbuf_append_char(buf, '\n');
        _indent_line(buf, indent);
     }
   _append_group(buf, sgrp, indent);
   eina_strbuf_append(buf, " */");
}
Ejemplo n.º 4
0
EAPI Eina_Stringshare *
eolian_function_full_c_name_get(const Eolian_Function *foo_id,
                                Eolian_Function_Type ftype)
{
   char tbuf[512];
   tbuf[0] = '\0';
   const char *prefix = (ftype != EOLIAN_FUNCTION_POINTER) ? _get_eo_prefix(foo_id, tbuf): tbuf;

   if (!prefix)
     return NULL;

   const char  *funcn = eolian_function_name_get(foo_id);
   Eina_Strbuf *buf = eina_strbuf_new();
   Eina_Stringshare *ret;

   char *abbr = _get_abbreviated_name(prefix, funcn);
   eina_strbuf_append(buf, abbr);
   free(abbr);

   if ((ftype == EOLIAN_PROP_GET) || (ftype == EOLIAN_PROPERTY))
     eina_strbuf_append(buf, "_get");
   else if (ftype == EOLIAN_PROP_SET)
     eina_strbuf_append(buf, "_set");

   ret = eina_stringshare_add(eina_strbuf_string_get(buf));
   eina_strbuf_free(buf);
   return ret;
}
Ejemplo n.º 5
0
static Eina_Bool
em_file_open(void *video,
             const char   *file)
{
   Emotion_Gstreamer_Video *ev = video;
   Eina_Strbuf *sbuf = NULL;
   const char *uri;

   if (!file) return EINA_FALSE;
   if (strstr(file, "://") == NULL)
     {
        sbuf = eina_strbuf_new();
        eina_strbuf_append(sbuf, "file://");
        if (strncmp(file, "./", 2) == 0)
          file += 2;
	if (strstr(file, ":/") != NULL)
	  { /* We absolutely need file:///C:/ under Windows, so adding it here */
             eina_strbuf_append(sbuf, "/");
	  }
	else if (*file != '/')
          {
             char tmp[PATH_MAX];

             if (getcwd(tmp, PATH_MAX))
               {
                  eina_strbuf_append(sbuf, tmp);
                  eina_strbuf_append(sbuf, "/");
               }
          }
        eina_strbuf_append(sbuf, file);
     }

   ev->play_started = 0;
   ev->pipeline_parsed = 0;

   uri = sbuf ? eina_strbuf_string_get(sbuf) : file;
   DBG("setting file to '%s'", uri);
   ev->pipeline = gstreamer_video_sink_new(ev, ev->obj, uri);
   if (sbuf) eina_strbuf_free(sbuf);

   if (!ev->pipeline)
     return EINA_FALSE;

   ev->eos_bus = gst_pipeline_get_bus(GST_PIPELINE(ev->pipeline));
   if (!ev->eos_bus)
     {
        ERR("could not get the bus");
        return EINA_FALSE;
     }

   gst_bus_set_sync_handler(ev->eos_bus, _eos_sync_fct, ev);

   ev->position = 0.0;

   return 1;
}
Ejemplo n.º 6
0
static void
_append_group(Eina_Strbuf *buf, char *sgrp, int indent)
{
   if (!sgrp) return;
   eina_strbuf_append(buf, " * @ingroup ");
   eina_strbuf_append(buf, sgrp);
   eina_strbuf_append_char(buf, '\n');
   _indent_line(buf, indent);
   free(sgrp);
}
Ejemplo n.º 7
0
static Eina_Bool
_expr_serialize(const Eolian_Expression *expr, Eina_Strbuf *buf, Eina_Bool outer)
{
   switch (expr->type)
     {
      case EOLIAN_EXPR_UNKNOWN:
        return EINA_FALSE;
      case EOLIAN_EXPR_INT:
      case EOLIAN_EXPR_UINT:
      case EOLIAN_EXPR_LONG:
      case EOLIAN_EXPR_ULONG:
      case EOLIAN_EXPR_LLONG:
      case EOLIAN_EXPR_ULLONG:
      case EOLIAN_EXPR_FLOAT:
      case EOLIAN_EXPR_DOUBLE:
      case EOLIAN_EXPR_STRING:
      case EOLIAN_EXPR_CHAR:
        {
           Eolian_Value *v = (Eolian_Value*)&expr->type;
           const char *x = eolian_expression_value_to_literal(v);
           if (!x)
             return EINA_FALSE;
           eina_strbuf_append(buf, x);
           eina_stringshare_del(x);
           break;
        }
      case EOLIAN_EXPR_NULL:
        eina_strbuf_append(buf, "null");
        break;
      case EOLIAN_EXPR_BOOL:
        eina_strbuf_append(buf, expr->value.b ? "true" : "false");
        break;
      case EOLIAN_EXPR_NAME:
        {
           eina_strbuf_append(buf, expr->value.s);
           break;
        }
      case EOLIAN_EXPR_UNARY:
        eina_strbuf_append(buf, _unops[expr->unop]);
        _expr_serialize(expr->expr, buf, EINA_FALSE);
        break;
      case EOLIAN_EXPR_BINARY:
        if (!outer)
          eina_strbuf_append_char(buf, '(');
        _expr_serialize(expr->lhs, buf, EINA_FALSE);
        eina_strbuf_append_printf(buf, " %s ", _binops[expr->binop]);
        _expr_serialize(expr->rhs, buf, EINA_FALSE);
        if (!outer)
          eina_strbuf_append_char(buf, ')');
        break;
      default:
        return EINA_FALSE;
     }
   return EINA_TRUE;
}
Ejemplo n.º 8
0
static void
_markup_get_text_utf8_append(Eina_Strbuf *sbuf, const char *text)
{
   int ch, pos = 0, pos2 = 0;

   for (;;)
     {
        pos = pos2;
        ch = eina_unicode_utf8_next_get(text, &pos2);
        if ((ch <= 0) || (pos2 <= 0)) break;

        if (ch == _NEWLINE)
           eina_strbuf_append(sbuf, "<br/>");
        else if (ch == _TAB)
           eina_strbuf_append(sbuf, "<tab/>");
        else if (ch == '<')
           eina_strbuf_append(sbuf, "&lt;");
        else if (ch == '>')
           eina_strbuf_append(sbuf, "&gt;");
        else if (ch == '&')
           eina_strbuf_append(sbuf, "&amp;");
        else if (ch == '"')
           eina_strbuf_append(sbuf, "&quot;");
        else if (ch == _PARAGRAPH_SEPARATOR)
           eina_strbuf_append(sbuf, "<ps/>");
        else if (ch == _REPLACEMENT_CHAR)
           eina_strbuf_append(sbuf, "&#xfffc;");
        else if (ch != '\r')
          {
             eina_strbuf_append_length(sbuf, text + pos, pos2 - pos);
          }
     }
}
Ejemplo n.º 9
0
static inline void
_introspect_append_method(Eina_Strbuf *buf, const Eldbus_Method *method)
{
   eina_strbuf_append_printf(buf, "<method name=\"%s\">", method->member);

   if (method->flags & ELDBUS_METHOD_FLAG_DEPRECATED)
     eina_strbuf_append(buf, DBUS_ANNOTATION_DEPRECATED);

   if (method->flags & ELDBUS_METHOD_FLAG_NOREPLY)
     eina_strbuf_append(buf, DBUS_ANNOTATION_NOREPLY);

   _introspect_arguments_append(buf, method->in, "in");
   _introspect_arguments_append(buf, method->out, "out");
   eina_strbuf_append(buf, "</method>");
}
Ejemplo n.º 10
0
static int
_append_since(const char *since, int indent, int curl, Eina_Strbuf *buf)
{
   if (since)
     {
        eina_strbuf_append_char(buf, '\n');
        _indent_line(buf, indent);
        eina_strbuf_append(buf, " *\n");
        curl = _indent_line(buf, indent);
        eina_strbuf_append(buf, " * @since ");
        eina_strbuf_append(buf, since);
        curl += strlen(since) + sizeof(" * @since ") - 1;
     }
   return curl;
}
Ejemplo n.º 11
0
static char *
_get_abbreviated_name(const char *prefix, const char *fname)
{
   Eina_Strbuf *buf = eina_strbuf_new();

   const char *last_p = strrchr(prefix, '_');
   last_p = (last_p) ? (last_p + 1) : prefix;

   const char *tmp = strstr(fname, last_p);
   int len = strlen(last_p);

   if ((tmp) &&
       ((tmp == fname) || (*(tmp - 1) == '_')) &&
       ((*(tmp + len) == '\0') || (*(tmp + len) == '_')))
     {
        int plen = strlen(prefix);
        len += (tmp - fname);

        if ((plen >= len) && !strncmp(prefix + plen - len, fname, len))
          {
             eina_strbuf_append_n(buf, prefix, plen - len);
          }
     }

   if (eina_strbuf_length_get(buf) == 0)
     eina_strbuf_append_printf(buf, "%s_", prefix);
   eina_strbuf_append(buf, fname);

   char *ret = eina_strbuf_string_steal(buf);
   eina_strbuf_free(buf);
   return ret;
}
Ejemplo n.º 12
0
char *
dbus_name_to_c(const char *dbus)
{
   char *str_cpy = strdup(dbus), *pch, *ret;
   Eina_Strbuf *buffer = eina_strbuf_new();
   unsigned i;

   pch = strtok(str_cpy, "/.");
   if (!pch)
     {
        ret = strdup("root");
        goto end;
     }
   eina_strbuf_append(buffer, pch);

   while ((pch = strtok(NULL, "/.")))
     eina_strbuf_append_printf(buffer, "_%s",pch);

   ret = strdup(eina_strbuf_string_get(buffer));
   eina_strbuf_reset(buffer);
   for (i = 0; ret[i]; i++)
     {
        if (i > 0 && ret[i-1] != '_' && ret[i] > '@' && ret[i] < '[')//upper case
          eina_strbuf_append_printf(buffer, "_%c", tolower(ret[i]));
        else
          eina_strbuf_append_char(buffer, tolower(ret[i]));
     }
   free(ret);
   ret = strdup(eina_strbuf_string_get(buffer));
end:
   free(str_cpy);
   eina_strbuf_free(buffer);
   return ret;
}
Ejemplo n.º 13
0
static void
_introspect_append_interface(Eina_Strbuf *buf, Eldbus_Service_Interface *iface)
{
   const Eldbus_Method *method;
   Property *prop;
   Eina_Iterator *iterator;
   unsigned short i;

   eina_strbuf_append_printf(buf, "<interface name=\"%s\">", iface->name);

   iterator = eina_hash_iterator_data_new(iface->methods);
   EINA_ITERATOR_FOREACH(iterator, method)
     _introspect_append_method(buf, method);
   eina_iterator_free(iterator);

   for (i = 0; i < eina_array_count(iface->sign_of_signals); i++)
     _introspect_append_signal(buf, &iface->signals[i]);

   iterator = eina_hash_iterator_data_new(iface->properties);
   EINA_ITERATOR_FOREACH(iterator, prop)
     _instrospect_append_property(buf, prop->property, iface);
   eina_iterator_free(iterator);

   eina_strbuf_append(buf, "</interface>");
}
Ejemplo n.º 14
0
static char *
evas_gl_common_shader_glsl_get(unsigned int flags, const char *base)
{
   Eina_Strbuf *s = eina_strbuf_new();
   unsigned int k;
   char *str;

   /* This is an env var to use for debugging purposes only */
   static const char *evas_gl_shader_glsl_version = NULL;
   if (!evas_gl_shader_glsl_version)
     {
        evas_gl_shader_glsl_version = getenv("EVAS_GL_SHADER_GLSL_VERSION");
        if (!evas_gl_shader_glsl_version) evas_gl_shader_glsl_version = "";
        else WRN("Using GLSL version tag: '%s'", evas_gl_shader_glsl_version);
     }

   if (*evas_gl_shader_glsl_version)
     eina_strbuf_append_printf(s, "#version %s\n", evas_gl_shader_glsl_version);

   for (k = 0; k < SHADER_FLAG_COUNT; k++)
     {
        if (flags & (1 << k))
          eina_strbuf_append_printf(s, "#define SHD_%s\n", _shader_flags[k]);
     }

   eina_strbuf_append(s, base);
   str = eina_strbuf_string_steal(s);
   eina_strbuf_free(s);
   return str;
}
Ejemplo n.º 15
0
static void
_append_defval(const Eolian_Unit *src, Eina_Strbuf *buf,
               const Eolian_Expression *exp, const Eolian_Type *tp)
{
   if (exp)
     {
        Eolian_Value val = eolian_expression_eval_type(src, exp, tp);
        Eina_Stringshare *lit = eolian_expression_value_to_literal(&val);
        if (lit)
          {
             eina_strbuf_append(buf, lit);
             Eina_Stringshare *exps = eolian_expression_serialize(exp);
             if (exps && strcmp(lit, exps))
               eina_strbuf_append_printf(buf, " /* %s */", exps);
             eina_stringshare_del(exps);
             eina_stringshare_del(lit);
             return;
          }
        else WRN("evaluation of default value failed");
     }
   /* default value or fallback */
   const Eolian_Type *btp = eolian_type_aliased_base_get(tp);
   if (eolian_type_is_ptr(btp))
     {
        eina_strbuf_append(buf, "NULL");
        return;
     }
   const Eolian_Typedecl *tdcl = eolian_type_typedecl_get(btp);
   if (tdcl && (eolian_typedecl_type_get(tdcl) == EOLIAN_TYPEDECL_STRUCT))
     {
        char *sn = eo_gen_c_full_name_get(eolian_typedecl_full_name_get(tdcl));
        eina_strbuf_append_printf(buf, "((%s){0})", sn);
        free(sn);
        return;
     }
   Eina_Stringshare *ctp = eolian_type_c_type_get(btp);
   if (strchr(ctp, '*'))
     {
        eina_strbuf_append(buf, "NULL");
        return;
     }
   eina_stringshare_del(ctp);
   /* enums and remaining regulars... 0 should do */
   eina_strbuf_append(buf, "0");
}
Ejemplo n.º 16
0
Archivo: docs.c Proyecto: tasn/efl
static void
_gen_doc_full(const Eolian_State *state, const char *summary,
              const char *description, const char *since,
              const char *group, const char *el, int indent, Eina_Strbuf *buf)
{
   int curl = 0;
   Eina_Strbuf *wbuf = eina_strbuf_new();
   if (indent)
     eina_strbuf_append(buf, "/**<\n");
   else
     eina_strbuf_append(buf, "/**\n");
   curl += _indent_line(buf, indent);
   eina_strbuf_append(buf, " * @brief ");
   curl += sizeof(" * @brief ") - 1;
   _append_section(state, summary, indent, curl, buf, wbuf);
   eina_strbuf_append_char(buf, '\n');
   _indent_line(buf, indent);
   eina_strbuf_append(buf, " *\n");
   curl = _indent_line(buf, indent);
   eina_strbuf_append(buf, " * ");
   _append_section(state, description, indent, curl + 3, buf, wbuf);
   curl = _append_extra(el, indent, curl, EINA_TRUE, buf);
   curl = _append_since(since, indent, curl, buf);
   eina_strbuf_append_char(buf, '\n');
   _indent_line(buf, indent);
   char *sgrp = _sanitize_group(group);
   if (sgrp)
     {
        eina_strbuf_append(buf, " *\n");
        _indent_line(buf, indent);
     }
   _append_group(buf, sgrp, indent);
   eina_strbuf_append(buf, " */");
   eina_strbuf_free(wbuf);
}
Ejemplo n.º 17
0
static char *
_module_patterns_str_new(void)
{
   Eina_Strbuf *buf;
   char * const *itr;
   char *ret;
   if (!module_patterns) return strdup("*");

   buf = eina_strbuf_new();
   for (itr = module_patterns; *itr != NULL; itr++)
     {
        eina_strbuf_append(buf, *itr);
        if (itr[1]) eina_strbuf_append(buf, ", ");
     }
   ret = eina_strbuf_string_steal(buf);
   eina_strbuf_free(buf);
   return ret;
}
Ejemplo n.º 18
0
Eina_Strbuf *
url_normalize_str(const char *str)
{
  Eina_Strbuf *buf;
  buf = eina_strbuf_new();
  eina_strbuf_append(buf, str);
  eina_strbuf_replace_all(buf, " ", "%20");
  return buf;
}
Ejemplo n.º 19
0
Archivo: docs.c Proyecto: tasn/efl
static int
_append_extra(const char *el, int indent, int curl, Eina_Bool nl, Eina_Strbuf *buf)
{
   if (el)
     {
        eina_strbuf_append_char(buf, '\n');
        if (nl)
          {
             _indent_line(buf, indent);
             eina_strbuf_append(buf, " *\n");
          }
        curl = _indent_line(buf, indent);
        eina_strbuf_append(buf, " * ");
        eina_strbuf_append(buf, el);
        curl += strlen(el) + sizeof(" * ") - 1;
     }
   return curl;
}
Ejemplo n.º 20
0
EAPI void
ede_game_debug_panel_update(double now)
{
   Eina_Strbuf *t;
   char *ts;
   static int last_second = 0;
   static int fps_counter = 0;
   static int FPS = 0;

   if (!_debug_panel_enable) return;

   // calc FPS
   fps_counter++;
   if ((int)now > last_second)
   {
      //~ D("last second %d %d", last_second, fps_counter);
      last_second = now;
      FPS = fps_counter;
      fps_counter = 0;
   }

   t = eina_strbuf_new();

   // game info
   eina_strbuf_append(t, "<h3>game:</h3><br>");

   ts = ede_game_time_get(now);
   eina_strbuf_append_printf(t, "FPS %d  time %s<br>", FPS, ts);
   EDE_FREE(ts);

   eina_strbuf_append_printf(t, "lives %d<br>bucks %d<br>",
                             _player_lives, _player_bucks);
   eina_strbuf_append(t, "<br>");

   // info from other components
   ede_enemy_debug_info_fill(t);
   ede_tower_debug_info_fill(t);
   ede_bullet_debug_info_fill(t);
   ede_level_debug_info_fill(t);

   ede_gui_debug_text_set(eina_strbuf_string_get(t));
   eina_strbuf_free(t);

}
Ejemplo n.º 21
0
EAPI char *
ecore_timer_dump(void)
{
#ifdef WANT_ECORE_TIMER_DUMP
   Eina_Strbuf *result;
   char *out;
   Ecore_Timer *tm;
   Eina_List *tmp = NULL;
   int living_timer = 0;
   int unknow_timer = 0;

   _ecore_lock();
   result = eina_strbuf_new();

   EINA_INLIST_FOREACH(timers, tm)
     tmp = eina_list_sorted_insert(tmp, _ecore_timer_cmp, tm);

   EINA_LIST_FREE(tmp, tm)
     {
        char **strings;
        int j;

        if (!tm->frozen && !tm->delete_me)
          living_timer++;

        strings = backtrace_symbols((void **)tm->timer_bt, tm->timer_bt_num);
        if (tm->timer_bt_num <= 0 || strings == NULL)
          {
             unknow_timer++;
             continue;
          }

        eina_strbuf_append_printf(result, "*** timer: %f ***\n", tm->in);
        if (tm->frozen)
          eina_strbuf_append(result, "FROZEN\n");
        if (tm->delete_me)
          eina_strbuf_append(result, "DELETED\n");
        for (j = 0; j < tm->timer_bt_num; j++)
          eina_strbuf_append_printf(result, "%s\n", strings[j]);

        free(strings);
     }
Ejemplo n.º 22
0
static inline void
_introspect_append_signal(Eina_Strbuf *buf, const Eldbus_Signal *sig)
{
   eina_strbuf_append_printf(buf, "<signal name=\"%s\"", sig->name);

   if (!sig->flags && !(sig->args && sig->args->signature))
     {
        eina_strbuf_append(buf, " />");
        return;
     }

   eina_strbuf_append(buf, ">");

   if (sig->flags & ELDBUS_SIGNAL_FLAG_DEPRECATED)
     eina_strbuf_append(buf, DBUS_ANNOTATION_DEPRECATED);

   _introspect_arguments_append(buf, sig->args, NULL);

   eina_strbuf_append(buf, "</signal>");
}
Ejemplo n.º 23
0
static inline void
_instrospect_append_property(Eina_Strbuf *buf, const Eldbus_Property *prop, const Eldbus_Service_Interface *iface)
{
   eina_strbuf_append_printf(buf, "<property name=\"%s\" type=\"%s\" access=\"",
                             prop->name, prop->type);

   if (iface->get_func || prop->get_func)
     eina_strbuf_append(buf, "read");

   if (iface->set_func || prop->set_func)
     eina_strbuf_append(buf, "write");

   if (!prop->flags)
     {
        eina_strbuf_append(buf, "\" />");
        return;
     }

   eina_strbuf_append(buf, "\">");

   if (prop->flags & ELDBUS_PROPERTY_FLAG_DEPRECATED)
     eina_strbuf_append(buf, DBUS_ANNOTATION_DEPRECATED);

   eina_strbuf_append(buf, "</property>");
}
Ejemplo n.º 24
0
static void
_gen_doc_full(const char *summary, const char *description, const char *since,
              const char *group, int indent, Eina_Strbuf *buf, Eina_Bool use_legacy)
{
   int curl = 0;
   Eina_Strbuf *wbuf = eina_strbuf_new();
   eina_strbuf_append(buf, "/**\n");
   curl += _indent_line(buf, indent);
   eina_strbuf_append(buf, " * @brief ");
   curl += sizeof(" * @brief ") - 1;
   _append_section(summary, indent, curl, buf, wbuf, use_legacy);
   eina_strbuf_append_char(buf, '\n');
   _indent_line(buf, indent);
   eina_strbuf_append(buf, " *\n");
   curl = _indent_line(buf, indent);
   eina_strbuf_append(buf, " * ");
   _append_section(description, indent, curl + 3, buf, wbuf, use_legacy);
   curl = _append_since(since, indent, curl, buf);
   eina_strbuf_append_char(buf, '\n');
   _indent_line(buf, indent);
   char *sgrp = _sanitize_group(group);
   if (sgrp)
     {
        eina_strbuf_append(buf, " *\n");
        _indent_line(buf, indent);
     }
   _append_group(buf, sgrp, indent);
   eina_strbuf_append(buf, " */");
   eina_strbuf_free(wbuf);
}
Ejemplo n.º 25
0
EAPI Eina_Stringshare *
eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl)
{
   Eina_Stringshare *ret;
   Eina_Strbuf *buf;
   char *bufp, *p;
   EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
   buf = eina_strbuf_new();
   if (fl->base_enum->legacy)
     eina_strbuf_append(buf, fl->base_enum->legacy);
   else
     eina_strbuf_append(buf, fl->base_enum->base.name);
   eina_strbuf_append_char(buf, '_');
   eina_strbuf_append(buf, fl->base.name);
   bufp = eina_strbuf_string_steal(buf);
   eina_strbuf_free(buf);
   eina_str_toupper(&bufp);
   while ((p = strchr(bufp, '.'))) *p = '_';
   ret = eina_stringshare_add(bufp);
   free(bufp);
   return ret;
}
Ejemplo n.º 26
0
/* expand fname to full path name (so that PATH is ignored) plus turn
 * stuff into a command, and also verify whether the path exists */
static char *
get_cmdline_from_argv(const char *fname, const char **argv)
{
   Eina_Strbuf *buf;
   char        *ret;
   char         pbuf[PATH_MAX];
   const char  *arg = NULL;

   FILE *testf = fopen(fname, "rb");
   if  (!testf)
      return NULL;

   fclose(testf);

   /* for windows, we have realpath in evil, no need for GetFullPathName */
   if (!realpath(fname, pbuf))
      return NULL;

   buf = eina_strbuf_new();
   eina_strbuf_append_char(buf, '"');
   eina_strbuf_append(buf, pbuf);
   eina_strbuf_append_char(buf, '"');

   while ((arg = *(argv++)))
     {
        char c;
        eina_strbuf_append_char(buf, ' ');
        eina_strbuf_append_char(buf, '"');

        while ((c = *(arg++)))
          {
#ifndef _WIN32
             if (c == '"' || c == '$') eina_strbuf_append_char(buf, '\\');
             eina_strbuf_append_char(buf, c);
#else
             if      (c == '"') eina_strbuf_append_char(buf, '\\');
             else if (c == '%') eina_strbuf_append_char(buf,  '"');
             eina_strbuf_append_char(buf, c);
             if (c == '%') eina_strbuf_append_char(buf,  '"');
#endif
          }

        eina_strbuf_append_char(buf, '"');
     }

   ret = strdup(eina_strbuf_string_get(buf));
   eina_strbuf_free(buf);
   return ret;
}
Ejemplo n.º 27
0
void on_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) {
	Evas_Object *object = (Evas_Object*)data;
	int col, row;
	char buf[5];

	col = atoi(edje_object_data_get(object, "col"));
	row = atoi(edje_object_data_get(object, "row"));

	if(mouse_down == EINA_TRUE) {
		snprintf(buf, 5, ",%dx%d", col, row);
		eina_strbuf_append(password, buf);
		printf(_("Password is '%s'\n"), eina_strbuf_string_get(password));
	}
	printf(_("Mouse in on %dx%d\n"), col, row);
}
Ejemplo n.º 28
0
static int
_text_escape(Eina_Strbuf *txt, const char *text)
{
   const char *escaped;
   int advance;

   escaped = evas_textblock_string_escape_get(text, &advance);
   if (!escaped)
     {
        eina_strbuf_append_char(txt, text[0]);
        advance = 1;
     }
   else
     eina_strbuf_append(txt, escaped);
   return advance;
}
Ejemplo n.º 29
0
static inline void
_introspect_arguments_append(Eina_Strbuf *buf, const Eldbus_Arg_Info *args,
                             const char *direction)
{
   for (; args && args->signature; args++)
     {
        if (args->name && args->name[0])
          eina_strbuf_append_printf(buf, "<arg type=\"%s\" name=\"%s\"",
                                    args->signature, args->name);
        else
          eina_strbuf_append_printf(buf, "<arg type=\"%s\"", args->signature);

        if (direction)
          eina_strbuf_append_printf(buf, " direction=\"%s\" />", direction);
        else
          eina_strbuf_append(buf, " />");
     }
}
Ejemplo n.º 30
0
char *
replace_string(const char *string, const char *substr, const char *replacement)
{
   char *str_cpy = strdup(string);
   char *pch;
   char *ret;
   Eina_Strbuf *buffer = eina_strbuf_new();

   pch = strtok(str_cpy, substr);
   eina_strbuf_append(buffer, pch);

   while ((pch = strtok(NULL, substr)))
     eina_strbuf_append_printf(buffer, "%s%s", replacement, pch);

   ret = strdup(eina_strbuf_string_get(buffer));
   free(str_cpy);
   eina_strbuf_free(buffer);
   return ret;
}