/* * demangle Java symbol between str and end positions and stores * up to maxlen characters into buf. The parser starts in mode. * * Use MODE_PREFIX to process entire prototype till end position * Use MODE_TYPE to process return type if str starts on return type char * * Return: * success: buf * error : NULL
*/ staticchar *
__demangle_java_sym(constchar *str, constchar *end, char *buf, int maxlen, int mode)
{ int rlen = 0; int array = 0; int narg = 0; constchar *q;
/* * Demangle Java function signature (openJDK, not GCJ) * input: * str: string to parse. String is not modified * flags: combination of JAVA_DEMANGLE_* flags to modify demangling * return: * if input can be demangled, then a newly allocated string is returned. * if input cannot be demangled, then NULL is returned * * Note: caller is responsible for freeing demangled string
*/ char *
java_demangle_sym(constchar *str, int flags)
{ char *buf, *ptr; char *p;
size_t len, l1 = 0;
if (!str) return NULL;
/* find start of return type */
p = strrchr(str, ')'); if (!p) return NULL;
/* * expansion factor estimated to 3x
*/
len = strlen(str) * 3 + 1;
buf = malloc(len); if (!buf) return NULL;
buf[0] = '\0'; if (!(flags & JAVA_DEMANGLE_NORET)) { /* * get return type first
*/
ptr = __demangle_java_sym(p + 1, NULL, buf, len, MODE_TYPE); if (!ptr) goto error;
/* add space between return type and function prototype */
l1 = strlen(buf);
buf[l1++] = ' ';
}
/* process function up to return type */
ptr = __demangle_java_sym(str, p + 1, buf + l1, len - l1, MODE_PREFIX); if (!ptr) goto error;
return buf;
error:
free(buf); return NULL;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.