Esempio n. 1
0
static char *
do_mangle_classname (const char *string)
{
    const char *ptr;
    int count = 0;

    obstack_grow (&name_obstack, "_ZN", 3);

    for (ptr = string; *ptr; ptr++ )
    {
        if (*ptr == '.')
        {
            append_gpp_mangled_name (ptr - count, count);
            count = 0;
        }
        else
            count++;
    }
    append_gpp_mangled_name (&ptr [-count], count);
    obstack_grow (mangle_obstack, "6class$E", strlen ("6class$E"));
    obstack_1grow (mangle_obstack, '\0');
    return XOBFINISH (mangle_obstack, char *);
}
Esempio n. 2
0
static char *
do_mangle_classname (const char *string)
{
  const char *ptr;
  int count = 0;

  obstack_grow (&name_obstack, "_ZN", 3);

  for (ptr = string; *ptr; ptr++ )
    {
      if (ptr[0] == '.')
	{
	  append_gpp_mangled_name (&ptr [-count], count);
	  count = 0;
	}
      else
	count++;
    }
  append_gpp_mangled_name (&ptr [-count], count);
  obstack_grow (mangle_obstack, "6class$E", 8);
  obstack_1grow (mangle_obstack, '\0');
  return obstack_finish (mangle_obstack);
}
tree
java_mangle_resource_name (const char *name)
{
  int len = strlen (name);
  char *buf = (char *) alloca (2 * len + 1);
  char *pos;
  const unsigned char *w1 = (const unsigned char *) name;
  const unsigned char *w2;
  const unsigned char *limit = w1 + len;

  pos = buf;

  init_mangling ();
  MANGLE_RAW_STRING ("Gr");

  *pos++ = '_';
  while (w1 < limit)
    {
      int ch;
      w2 = w1;
      ch = UTF8_GET (w1, limit);
      gcc_assert (ch > 0);
      switch (ch)
	{
	case '$':
	  *pos++ = '$';
	  *pos++ = '$';
	  break;
	case '.':
	  *pos++ = '$';
	  *pos++ = '_';
	  break;
	case '/':
	  *pos++ = '$';
	  *pos++ = 'S';
	  break;
	default:
	  memcpy (pos, w2, w1 - w2);
	  pos += w1 - w2;
	  break;
	}
    }
  append_gpp_mangled_name (buf, pos - buf);

  return finish_mangling ();
}
static int
mangle_record_type (tree type, int for_pointer)
{
  tree current;
  int match;
  int nadded_p = 0;
  int qualified;
  
  /* Does this name have a package qualifier? */
  qualified = QUALIFIED_P (DECL_NAME (TYPE_NAME (type)));

#define ADD_N() \
  do { obstack_1grow (mangle_obstack, 'N'); nadded_p = 1; } while (0)

  gcc_assert (TREE_CODE (type) == RECORD_TYPE);

  if (!TYPE_PACKAGE_LIST (type))
    set_type_package_list (type);

  match = find_compression_record_match (type, &current);
  if (match >= 0)
    {
      /* If we had a pointer, and there's more, we need to emit
	 'N' after 'P' (for_pointer tells us we already emitted it.) */
      if (for_pointer && current)
	ADD_N();
      emit_compression_string (match);
    }
  while (current)
    {
      /* Add the new type to the table */
      compression_table_add (TREE_PURPOSE (current));
      /* Add 'N' if we never got a chance to, but only if we have a qualified
         name.  For non-pointer elements, the name is always qualified. */
      if ((qualified || !for_pointer) && !nadded_p)
	ADD_N();
      /* Use the bare type name for the mangle. */
      append_gpp_mangled_name (IDENTIFIER_POINTER (TREE_VALUE (current)),
			       IDENTIFIER_LENGTH (TREE_VALUE (current)));
      current = TREE_CHAIN (current);
    }
  return nadded_p;
#undef ADD_N
}
static void
mangle_member_name (tree name)
{
  append_gpp_mangled_name (IDENTIFIER_POINTER (name),
			   IDENTIFIER_LENGTH (name));
}