longer version of internal.h description
*/
+extern int m17n__core_initialized;
+extern int m17n__shell_initialized;
+extern int m17n__gui_initialized;
+
extern int mdebug_hook ();
/** Return with code RET while setting merror_code to ERR. */
typedef struct
{
/**en Reference count of the object. */
+ /**ja ¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾È¿ô. */
unsigned ref_count : 16;
unsigned ref_count_extended : 1;
/**en A flag bit used for various perpose. */
+ /**ja ¤µ¤Þ¤¶¤Þ¤ÊÌÜŪ¤ËÍѤ¤¤é¤ì¤ë¥Õ¥é¥°¥Ó¥Ã¥È. */
unsigned flag : 15;
union {
/**en If <ref_count_extended> is zero, a function to free the
object. */
+ /**ja <ref_count_extended> ¤¬ 0 ¤Ê¤é¤Ð¥ª¥Ö¥¸¥§¥¯¥È¤ò²òÊü¤¹¤ë´Ø¿ô. */
void (*freer) (void *);
/**en If <ref_count_extended> is nonzero, a pointer to the
struct M17NObjectRecord. */
+ /**ja <ref_count_extended> ¤¬ 0 ¤Ç¤Ê¤±¤ì¤Ð¹½Â¤ÂÎ M17NObjectRecord ¤Ø¤Î¥Ý¥¤¥ó¥¿. */
M17NObjectRecord *record;
} u;
} M17NObject;
/**en Increment the reference count of OBJECT if the count is not
0. */
+/**ja OBJECT ¤Î»²¾È¿ô¤¬ 0 ¤Ç¤Ê¤±¤ì¤Ð 1 Áý¤ä¤¹. */
#define M17N_OBJECT_REF(object) \
do { \
/**en Decrement the reference count of OBJECT if the count is greater
- than 0. In that case, if the count becomes 0, free OBJECT. */
+ than 0. In that case, if the count becomes 0, free OBJECT. */
+/**ja OBJECT ¤Î»²¾È¿ô¤¬ 0 ¤è¤êÂ礤±¤ì¤Ð 1 ¸º¤é¤¹¡£¸º¤é¤·¤Æ 0 ¤Ë¤Ê¤ì¤Ð
+ OBJECT ¤ò²òÊü¤¹¤ë. */
#define M17N_OBJECT_UNREF(object) \
do { \
(((M17NObject *) (object))->u.freer) (object); \
else \
free (object); \
+ (object) = NULL; \
} \
} \
} while (0)
void **objects;
} M17NObjectArray;
+extern void mdebug__register_object (M17NObjectArray *array, void *object);
-#define M17N_OBJECT_REGISTER(array, object) \
- if (mdebug__flag & MDEBUG_FINI) \
- { \
- if ((array).used == 0) \
- MLIST_INIT1 (&(array), objects, 256); \
- (array).count++; \
- MLIST_APPEND1 (&(array), objects, object, MERROR_OBJECT); \
- } \
+#define M17N_OBJECT_REGISTER(array, object) \
+ if (mdebug__flag & MDEBUG_FINI) \
+ mdebug__register_object (&array, object); \
else
-#define M17N_OBJECT_UNREGISTER(array, object) \
- if (mdebug__flag & MDEBUG_FINI) \
- { \
- (array).count--; \
- if ((array).count >= 0) \
- { \
- int i = 0; \
- \
- while (i < (array).used && (array).objects[i] != object) i++; \
- if (i < (array).used) \
- (array).objects[i] = NULL; \
- else \
- mdebug_hook (); \
- } \
- else \
- mdebug_hook (); \
- } \
- else
+extern void mdebug__unregister_object (M17NObjectArray *array, void *object);
+#define M17N_OBJECT_UNREGISTER(array, object) \
+ if (mdebug__flag & MDEBUG_FINI) \
+ mdebug__unregister_object (&array, object); \
+ else
extern void mdebug__report_object (char *name, M17NObjectArray *array);
} while (0)
+#define MTEXT_READ_ONLY_P(mt) ((mt)->allocated < 0)
+
#define M_CHECK_READONLY(mt, ret) \
do { \
if ((mt)->allocated < 0) \
fprintf (stderr, (fmt), (arg1), (arg2), (arg3), (arg4)); \
} while (0)
+#define MDEBUG_PRINT5(fmt, arg1, arg2, arg3, arg4, arg5) \
+ do { \
+ if (mdebug__flag & mdebug_mask) \
+ fprintf (stderr, (fmt), (arg1), (arg2), (arg3), (arg4), (arg5)); \
+ } while (0)
+
#define MDEBUG_PUSH_TIME() \
do { \