2010-07-22 Jonathan Yong <jon_y@users.sourceforge.net>
* include/libmangle: Rename pGcElem to libmangle_gc.
Rename sGcCtx to libmangle_gc_context.
Rename pMToken to libmangle_tokens.
Rename release_gc to libmangle_release_gc.
Rename generate_gc to libmangle_generate_gc.
Rename dump_tok to libmangle_dump_tok.
Rename print_decl to libmangle_print_decl.
Rename decode_ms_name to libmangle_decode_ms_name.
Rename sprint_decl to libmangle_sprint_decl.
Rename encode_ms_name to libmangle_encode_ms_name.
* src/m_token.h: Likewise.
* src/m_ms.h: Likewise.
* src/m_token.c: Likewise.
* src/m_ms.c: Likewise.
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@2921 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-libraries/libmangle/src/m_ms.c b/mingw-w64-libraries/libmangle/src/m_ms.c
index 8383732..239e574 100644
--- a/mingw-w64-libraries/libmangle/src/m_ms.c
+++ b/mingw-w64-libraries/libmangle/src/m_ms.c
@@ -90,7 +90,7 @@
static uMToken *get_ext_data_type (sMSCtx *c, uMToken *superType);
uMToken *
-decode_ms_name (sGcCtx *gc, const char *name)
+libmangle_decode_ms_name (libmangle_gc_context *gc, const char *name)
{
sMSCtx ctx;
sCached ZNameList, ArgList, TempArgList;
@@ -141,7 +141,7 @@
}
char *
-encode_ms_name (sGcCtx *gc, uMToken *tok)
+libmangle_encode_ms_name (libmangle_gc_context *gc, uMToken *tok)
{
return NULL;
}
diff --git a/mingw-w64-libraries/libmangle/src/m_ms.h b/mingw-w64-libraries/libmangle/src/m_ms.h
index 1df981d..75a14c6 100644
--- a/mingw-w64-libraries/libmangle/src/m_ms.h
+++ b/mingw-w64-libraries/libmangle/src/m_ms.h
@@ -62,7 +62,7 @@
} sCached;
typedef struct sMSCtx {
- sGcCtx *gc;
+ libmangle_gc_context *gc;
const char *name; /**< MSVC export name. */
const char *end; /**< Last character in the export name. */
const char *pos; /**< Export name processing position marker. */
@@ -83,13 +83,13 @@
* Decodes an MSVC export name.
* @param[in] gc sGcCtx pointer for collecting memory allocations.
* @param[in] name MSVC C++ mangled export string.
- * @see sprint_decl()
- * @see release_gc()
+ * @see libmangle_sprint_decl()
+ * @see libmangle_release_gc()
* @see uMToken
* @return Token containing information about the mangled string,
- * use release_gc() to free after use.
+ * use libmangle_release_gc() to free after use.
*/
-uMToken *decode_ms_name (sGcCtx *gc, const char *name);
-char *encode_ms_name (sGcCtx *gc, uMToken *tok);
+uMToken *libmangle_decode_ms_name (libmangle_gc_context *gc, const char *name);
+char *libmangle_encode_ms_name (libmangle_gc_context *gc, uMToken *tok);
#endif
diff --git a/mingw-w64-libraries/libmangle/src/m_token.c b/mingw-w64-libraries/libmangle/src/m_token.c
index 03085d6..9c5598e 100644
--- a/mingw-w64-libraries/libmangle/src/m_token.c
+++ b/mingw-w64-libraries/libmangle/src/m_token.c
@@ -40,17 +40,17 @@
static char *mt_strcat (char *h, const char *add);
-sGcCtx *
-generate_gc (void)
+libmangle_gc_context *
+libmangle_generate_gc (void)
{
- sGcCtx *h = (sGcCtx *) malloc (sizeof (sGcCtx));
+ libmangle_gc_context *h = (libmangle_gc_context *) malloc (sizeof (libmangle_gc_context));
if (h)
- memset (h, 0, sizeof (sGcCtx));
+ memset (h, 0, sizeof (libmangle_gc_context));
return h;
}
static void *
-alloc_gc (sGcCtx *gc, size_t size)
+alloc_gc (libmangle_gc_context *gc, size_t size)
{
sGcElem *n = (sGcElem *) malloc (size + sizeof (sGcElem));
if (!n)
@@ -70,7 +70,7 @@
}
void
-release_gc (sGcCtx *gc)
+libmangle_release_gc (libmangle_gc_context *gc)
{
sGcElem *n;
if (!gc)
@@ -85,7 +85,7 @@
}
static void
-free_gc (sGcCtx *gc, const void *p)
+free_gc (libmangle_gc_context *gc, const void *p)
{
sGcElem *n, *l = NULL;
@@ -112,7 +112,7 @@
}
uMToken *
-gen_tok (sGcCtx *gc, enum eMToken kind, enum eMSToken subkind, size_t addend)
+gen_tok (libmangle_gc_context *gc, enum eMToken kind, enum eMSToken subkind, size_t addend)
{
uMToken *ret;
switch (kind)
@@ -170,24 +170,24 @@
break;
case eMToken_dim:
fprintf (fp,"'dim:%d %s", MTOKEN_SUBKIND (p), MTOKEN_DIM_NEGATE (p) ? "-" : "");
- dump_tok (fp, MTOKEN_DIM_VALUE (p));
+ libmangle_dump_tok (fp, MTOKEN_DIM_VALUE (p));
if (MTOKEN_DIM_NTTP (p))
{
fprintf (fp," ");
- dump_tok (fp, MTOKEN_DIM_NTTP (p));
+ libmangle_dump_tok (fp, MTOKEN_DIM_NTTP (p));
}
fprintf (fp,"'");
break;
case eMToken_unary:
fprintf (fp,"'unary:%d ", MTOKEN_SUBKIND (p));
- dump_tok (fp, MTOKEN_UNARY (p));
+ libmangle_dump_tok (fp, MTOKEN_UNARY (p));
fprintf (fp, "'");
break;
case eMToken_binary:
fprintf (fp,"'binary:%d ", MTOKEN_SUBKIND (p));
- dump_tok (fp, MTOKEN_BINARY_LEFT (p));
+ libmangle_dump_tok (fp, MTOKEN_BINARY_LEFT (p));
fprintf (fp," ");
- dump_tok (fp, MTOKEN_BINARY_RIGHT (p));
+ libmangle_dump_tok (fp, MTOKEN_BINARY_RIGHT (p));
fprintf (fp, "'");
break;
default:
@@ -197,7 +197,7 @@
}
void
-dump_tok (FILE *fp, uMToken *p)
+libmangle_dump_tok (FILE *fp, uMToken *p)
{
if (!p)
return;
@@ -228,7 +228,7 @@
}
uMToken *
-gen_value (sGcCtx *gc, enum eMSToken skind, uint64_t val, int is_signed, int size)
+gen_value (libmangle_gc_context *gc, enum eMSToken skind, uint64_t val, int is_signed, int size)
{
uMToken *ret = gen_tok (gc, eMToken_value, skind, 0);
MTOKEN_VALUE (ret) = val;
@@ -239,7 +239,7 @@
}
uMToken *
-gen_name (sGcCtx *gc, enum eMSToken skind, const char *name)
+gen_name (libmangle_gc_context *gc, enum eMSToken skind, const char *name)
{
uMToken *ret;
@@ -252,7 +252,7 @@
}
uMToken *
-gen_dim (sGcCtx *gc, enum eMSToken skind, uint64_t val, const char *non_tt_param, int fSigned, int fNegate)
+gen_dim (libmangle_gc_context *gc, enum eMSToken skind, uint64_t val, const char *non_tt_param, int fSigned, int fNegate)
{
uMToken *ret = gen_tok (gc, eMToken_dim, skind, 0);
@@ -264,7 +264,7 @@
}
uMToken *
-gen_unary (sGcCtx *gc, enum eMSToken skind, uMToken *un)
+gen_unary (libmangle_gc_context *gc, enum eMSToken skind, uMToken *un)
{
uMToken *ret = gen_tok (gc, eMToken_unary, skind, 0);
MTOKEN_UNARY (ret) = un;
@@ -272,7 +272,7 @@
}
uMToken *
-gen_binary (sGcCtx *gc, enum eMSToken skind, uMToken *l, uMToken *r)
+gen_binary (libmangle_gc_context *gc, enum eMSToken skind, uMToken *l, uMToken *r)
{
uMToken *ret = gen_tok (gc, eMToken_binary, skind, 0);
MTOKEN_BINARY_LEFT (ret) = l;
@@ -492,7 +492,7 @@
}
char *
-sprint_decl (uMToken *r)
+libmangle_sprint_decl (uMToken *r)
{
char *ret = NULL;
if (r)
@@ -502,9 +502,9 @@
}
void
-print_decl (FILE *fp, uMToken *r)
+libmangle_print_decl (FILE *fp, uMToken *r)
{
- char *ret = sprint_decl (r);
+ char *ret = libmangle_sprint_decl (r);
if (ret)
{
fprintf (fp, "%s\n", ret);
@@ -577,12 +577,12 @@
char *txt;
for (i = 0; szTest[i]!=NULL; i++)
{
- sGcCtx *gc = generate_gc ();
- h = decode_ms_name (gc, szTest[i]);
- txt = sprint_decl (h);
+ libmangle_gc_context *gc = libmangle_generate_gc ();
+ h = libmangle_decode_ms_name (gc, szTest[i]);
+ txt = libmangle_sprint_decl (h);
fprintf (stderr, "%s\n", txt);
free (txt);
- release_gc (gc);
+ libmangle_release_gc (gc);
}
return 0;
}
diff --git a/mingw-w64-libraries/libmangle/src/m_token.h b/mingw-w64-libraries/libmangle/src/m_token.h
index 9451420..e52e83c 100644
--- a/mingw-w64-libraries/libmangle/src/m_token.h
+++ b/mingw-w64-libraries/libmangle/src/m_token.h
@@ -27,7 +27,7 @@
/**
* Garbage collector elements.
* Tracks allocated memory and points to the next element from the same context.
- * @see sGcCtx
+ * @see libmangle_gc_context
*/
typedef struct sGcElem {
struct sGcElem *chain; /**< Next element in chain. */
@@ -38,13 +38,13 @@
/**
* Garbage collector context.
* Tracks first and last of elements in gc context.
- * @see generate_gc()
- * @see release_gc()
+ * @see libmangle_generate_gc()
+ * @see libmangle_release_gc()
*/
-typedef struct sGcCtx {
+typedef struct libmangle_gc_context {
sGcElem *head; /**< Pointer to first gc element in context.*/
sGcElem *tail; /**< Pointer to last gc element in context. */
-} sGcCtx;
+} libmangle_gc_context;
/**
* Token "Kind" enumeration list.
@@ -237,28 +237,28 @@
/**
* gen_tok constructs uMToken instances
- * Instances are destroyed with release_gc().
+ * Instances are destroyed with libmangle_release_gc().
* @param[in] gc Pointer to garbage collection context.
* @param[in] kind Kind of token to construct
* @param[in] subkind Subkind of token to construct
* @param[in] addend Additional byte padding at the end.
- * @see release_gc()
+ * @see libmangle_release_gc()
*/
-uMToken *gen_tok (sGcCtx *gc, enum eMToken kind, enum eMSToken subkind, size_t addend);
+uMToken *libmangle_gen_tok (libmangle_gc_context *gc, enum eMToken kind, enum eMSToken subkind, size_t addend);
/**
* Releases memory tracked by context.
* @param[in] gc Garbage collection context to work on.
- * @see generate_gc()
+ * @see libmangle_generate_gc()
*/
-void release_gc (sGcCtx *gc);
+void libmangle_release_gc (libmangle_gc_context *gc);
/**
* Constructs a garbage collection context token.
* @return Pointer to context.
- * @see release_gc()
+ * @see libmangle_release_gc()
*/
-sGcCtx *generate_gc (void);
+libmangle_gc_context *libmangle_generate_gc (void);
/**
* Chains uMTokens together.
@@ -273,24 +273,24 @@
* @param[in] fp File descriptor to print the token to.
* @param[in] p uMToken chain to print.
*/
-void dump_tok (FILE *fp, uMToken *p);
+void libmangle_dump_tok (FILE *fp, uMToken *p);
/**
* Prints C++ name to file descriptor.
* @param[in] fp Output file descriptor.
* @param[in] p Token containing information about the C++ name.
- * @see decode_ms_name()
+ * @see libmangle_decode_ms_name()
*/
-void print_decl (FILE *fp, uMToken *p);
+void libmangle_print_decl (FILE *fp, uMToken *p);
/**
* Get pointer to decoded C++ name string.
* Use free() to release returned string.
* @param[in] r C++ name token.
* @return pointer to decoded C++ name string.
- * @see decode_ms_name()
+ * @see libmangle_decode_ms_name()
*/
-char *sprint_decl (uMToken *r);
+char *libmangle_sprint_decl (uMToken *r);
/**
* Constructs a "value" kind token.
@@ -302,7 +302,7 @@
* @return Pointer to value token.
* @see sMToken_value
*/
-uMToken *gen_value (sGcCtx *gc, enum eMSToken skind, uint64_t val, int is_signed, int size);
+uMToken *gen_value (libmangle_gc_context *gc, enum eMSToken skind, uint64_t val, int is_signed, int size);
/**
* Constructs a "name" kind token.
@@ -312,7 +312,7 @@
* @return Pointer to name token.
* @see sMToken_name
*/
-uMToken *gen_name (sGcCtx *gc, enum eMSToken skind, const char *name);
+uMToken *gen_name (libmangle_gc_context *gc, enum eMSToken skind, const char *name);
/**
* Constructs a "dim" kind token.
@@ -325,7 +325,7 @@
* @return Pointer to dim token.
* @see sMToken_dim
*/
-uMToken *gen_dim (sGcCtx *gc, enum eMSToken skind, uint64_t val, const char *non_tt_param, int fSigned, int fNegate);
+uMToken *gen_dim (libmangle_gc_context *gc, enum eMSToken skind, uint64_t val, const char *non_tt_param, int fSigned, int fNegate);
/**
* Constructs a "unary" kind token.
@@ -335,7 +335,7 @@
* @return Pointer to a unary token.
* @see sMToken_unary
*/
-uMToken *gen_unary (sGcCtx *gc, enum eMSToken skind, uMToken *un);
+uMToken *gen_unary (libmangle_gc_context *gc, enum eMSToken skind, uMToken *un);
/**
* Generates a binary node token.
@@ -346,6 +346,6 @@
* @return Pointer to binary token.
* @see sMToken_binary
*/
-uMToken *gen_binary (sGcCtx *gc, enum eMSToken skind, uMToken *l, uMToken *r);
+uMToken *gen_binary (libmangle_gc_context *gc, enum eMSToken skind, uMToken *l, uMToken *r);
#endif