Back to index

im-sdk  12.3.91
Classes | Defines | Typedefs | Enumerations | Functions | Variables
EIMIL.h File Reference
#include <IMProtocolStruct.h>

Go to the source code of this file.

Classes

struct  EIMIL_prop
struct  EIMIL_mtext_props
struct  EIMIL_mtext
struct  EIMIL_event
struct  EIMIL_value
struct  EIMIL_function
struct  EIMIL_variable
struct  EIMIL_tprop
struct  EIMIL_message
struct  EIMIL_exception
struct  EIMIL_dependency
struct  EIMIL_operation
struct  EIMIL_optional
union  EIMIL_object
struct  EIMIL_symbol
union  EIMIL_value.v

Defines

#define ASSERT(X)   ((void) 0)
#define EIMIL_VOID_HANDLE   ((void*)0)
#define EIMIL_ADDREF(v)   (((v).refcount)++)
#define EIMIL_RMREF(v)   ((--((v).refcount) <= 0) ? (EIMIL_destruct_value(&(v)), 0) : 0)
#define EIMIL_RMREF_WITHOUT_DESTRUCTION(v)   (--((v).refcount))
#define EIMIL_REFCHECK(v)   ((((v).refcount) <= 0) ? (EIMIL_destruct_value(&(v)), 0) : 0)
#define EIMIL_REFCHECK_GUARD(v, gv)

Typedefs

typedef CARD32BIT UTF32
typedef CARD16BIT UTF16
typedef CARD8BIT UTF8
typedef CARD32BIT EIMIL_TID
typedef CARD32BIT EIMIL_SYMID
typedef CARD8BIT Ebyte
typedef void * EIMIL_handle
typedef struct EIMIL_prop
typedef struct EIMIL_mtext_props
typedef struct EIMIL_mtext
typedef struct EIMIL_event
typedef struct EIMIL_value
typedef struct EIMIL_exception
typedef struct EIMIL_dependency
typedef struct EIMIL_operation
typedef struct EIMIL_optional
typedef union EIMIL_object
typedef struct EIMIL_function
typedef struct EIMIL_variable
typedef struct EIMIL_tprop
typedef struct EIMIL_message
typedef struct EIMIL_symbol
typedef int(* EIMIL_EVENT_PROC )(EIMIL_handle eh, EIMIL_event *pevent)
typedef int(* EIMIL_UICHANGE_PROC )(EIMIL_handle eh, EIMIL_value *pval, int uichange_flags)
typedef int(* EIMIL_OPISSUE_PROC )(EIMIL_handle eh, EIMIL_symbol *psym)

Enumerations

enum  EIMIL_CATEGORY {
  EIMIL_CAT_VARIABLE, EIMIL_CAT_PROPERTY, EIMIL_CAT_FUNCTION, EIMIL_CAT_EXCEPTION,
  EIMIL_CAT_OPERATION, EIMIL_CAT_OPTIONAL, EIMIL_CAT_VARIABLE, EIMIL_CAT_PROPERTY,
  EIMIL_CAT_FUNCTION, EIMIL_CAT_EXCEPTION, EIMIL_CAT_OPERATION, EIMIL_CAT_OPTIONAL,
  EIMIL_CAT_VARIABLE, EIMIL_CAT_PROPERTY, EIMIL_CAT_FUNCTION, EIMIL_CAT_EXCEPTION,
  EIMIL_CAT_OPERATION, EIMIL_CAT_OPTIONAL, EIMIL_CAT_VARIABLE, EIMIL_CAT_PROPERTY,
  EIMIL_CAT_FUNCTION, EIMIL_CAT_EXCEPTION, EIMIL_CAT_OPERATION, EIMIL_CAT_OPTIONAL,
  EIMIL_CAT_VARIABLE, EIMIL_CAT_PROPERTY, EIMIL_CAT_FUNCTION, EIMIL_CAT_EXCEPTION,
  EIMIL_CAT_OPERATION, EIMIL_CAT_OPTIONAL
}
enum  EIMIL_TYPE {
  EIMIL_TYPE_INVALID = 0, EIMIL_TYPE_NONE = (1 << 0), EIMIL_TYPE_BOOL = (1 << 1), EIMIL_TYPE_NUMBER = (1 << 2),
  EIMIL_TYPE_CHAR = (1 << 3), EIMIL_TYPE_MTEXT = (1 << 4), EIMIL_TYPE_EVENT = (1 << 5), EIMIL_TYPE_PROP = (1 << 6),
  EIMIL_TYPE_NIL = (1 << 7), EIMIL_TYPE_T = -1, EIMIL_TYPE_FEEDBACK = -2, EIMIL_TYPE_CANDIDATES = -3,
  EIMIL_TYPE_CONST = (1 << 15), EIMIL_TYPE_ANY = (1 << 16), EIMIL_TYPE_OPTION1 = (1 << 17), EIMIL_TYPE_OPTION2 = (1 << 18),
  EIMIL_TYPE_INVALID = 0, EIMIL_TYPE_NONE = (1 << 0), EIMIL_TYPE_BOOL = (1 << 1), EIMIL_TYPE_NUMBER = (1 << 2),
  EIMIL_TYPE_CHAR = (1 << 3), EIMIL_TYPE_MTEXT = (1 << 4), EIMIL_TYPE_EVENT = (1 << 5), EIMIL_TYPE_PROP = (1 << 6),
  EIMIL_TYPE_NIL = (1 << 7), EIMIL_TYPE_T = -1, EIMIL_TYPE_FEEDBACK = -2, EIMIL_TYPE_CANDIDATES = -3,
  EIMIL_TYPE_CONST = (1 << 15), EIMIL_TYPE_ANY = (1 << 16), EIMIL_TYPE_OPTION1 = (1 << 17), EIMIL_TYPE_OPTION2 = (1 << 18),
  EIMIL_TYPE_INVALID = 0, EIMIL_TYPE_NONE = (1 << 0), EIMIL_TYPE_BOOL = (1 << 1), EIMIL_TYPE_NUMBER = (1 << 2),
  EIMIL_TYPE_CHAR = (1 << 3), EIMIL_TYPE_MTEXT = (1 << 4), EIMIL_TYPE_EVENT = (1 << 5), EIMIL_TYPE_PROP = (1 << 6),
  EIMIL_TYPE_NIL = (1 << 7), EIMIL_TYPE_T = -1, EIMIL_TYPE_FEEDBACK = -2, EIMIL_TYPE_CANDIDATES = -3,
  EIMIL_TYPE_CONST = (1 << 15), EIMIL_TYPE_ANY = (1 << 16), EIMIL_TYPE_OPTION1 = (1 << 17), EIMIL_TYPE_OPTION2 = (1 << 18),
  EIMIL_TYPE_INVALID = 0, EIMIL_TYPE_NONE = (1 << 0), EIMIL_TYPE_BOOL = (1 << 1), EIMIL_TYPE_NUMBER = (1 << 2),
  EIMIL_TYPE_CHAR = (1 << 3), EIMIL_TYPE_MTEXT = (1 << 4), EIMIL_TYPE_EVENT = (1 << 5), EIMIL_TYPE_PROP = (1 << 6),
  EIMIL_TYPE_NIL = (1 << 7), EIMIL_TYPE_T = -1, EIMIL_TYPE_FEEDBACK = -2, EIMIL_TYPE_CANDIDATES = -3,
  EIMIL_TYPE_CONST = (1 << 15), EIMIL_TYPE_ANY = (1 << 16), EIMIL_TYPE_OPTION1 = (1 << 17), EIMIL_TYPE_OPTION2 = (1 << 18),
  EIMIL_TYPE_INVALID = 0, EIMIL_TYPE_NONE = (1 << 0), EIMIL_TYPE_BOOL = (1 << 1), EIMIL_TYPE_NUMBER = (1 << 2),
  EIMIL_TYPE_CHAR = (1 << 3), EIMIL_TYPE_MTEXT = (1 << 4), EIMIL_TYPE_EVENT = (1 << 5), EIMIL_TYPE_PROP = (1 << 6),
  EIMIL_TYPE_NIL = (1 << 7), EIMIL_TYPE_T = -1, EIMIL_TYPE_FEEDBACK = -2, EIMIL_TYPE_CANDIDATES = -3,
  EIMIL_TYPE_CONST = (1 << 15), EIMIL_TYPE_ANY = (1 << 16), EIMIL_TYPE_OPTION1 = (1 << 17), EIMIL_TYPE_OPTION2 = (1 << 18)
}
enum  EIMIL_SYMBOL_TYPE_ID {
  EIMIL_SYMBOL_ID_OPERATION = 1, EIMIL_SYMBOL_ID_VARIABLE_NUMBER = 2, EIMIL_SYMBOL_ID_VARIABLE_BOOL = 3, EIMIL_SYMBOL_ID_VARIABLE_CHAR = 4,
  EIMIL_SYMBOL_ID_VARIABLE_MTEXT = 5, EIMIL_SYMBOL_ID_VARIABLE_EVENT = 6, EIMIL_SYMBOL_ID_VARIABLE_PROP = 7, EIMIL_SYMBOL_ID_PROPERTY_MASK = 0x10,
  EIMIL_SYMBOL_ID_PROPERTY_NUMBER, EIMIL_SYMBOL_ID_PROPERTY_BOOL, EIMIL_SYMBOL_ID_PROPERTY_CHAR, EIMIL_SYMBOL_ID_PROPERTY_MTEXT,
  EIMIL_SYMBOL_ID_EXCEPTION = 0x20, EIMIL_SYMBOL_ID_PRIVATE = 0x80, EIMIL_SYMBOL_ID_FUNCTION = 0x81, EIMIL_SYMBOL_ID_OPERATION = 1,
  EIMIL_SYMBOL_ID_VARIABLE_NUMBER = 2, EIMIL_SYMBOL_ID_VARIABLE_BOOL = 3, EIMIL_SYMBOL_ID_VARIABLE_CHAR = 4, EIMIL_SYMBOL_ID_VARIABLE_MTEXT = 5,
  EIMIL_SYMBOL_ID_VARIABLE_EVENT = 6, EIMIL_SYMBOL_ID_VARIABLE_PROP = 7, EIMIL_SYMBOL_ID_PROPERTY_MASK = 0x10, EIMIL_SYMBOL_ID_PROPERTY_NUMBER,
  EIMIL_SYMBOL_ID_PROPERTY_BOOL, EIMIL_SYMBOL_ID_PROPERTY_CHAR, EIMIL_SYMBOL_ID_PROPERTY_MTEXT, EIMIL_SYMBOL_ID_EXCEPTION = 0x20,
  EIMIL_SYMBOL_ID_PRIVATE = 0x80, EIMIL_SYMBOL_ID_FUNCTION = 0x81, EIMIL_SYMBOL_ID_OPERATION = 1, EIMIL_SYMBOL_ID_VARIABLE_NUMBER = 2,
  EIMIL_SYMBOL_ID_VARIABLE_BOOL = 3, EIMIL_SYMBOL_ID_VARIABLE_CHAR = 4, EIMIL_SYMBOL_ID_VARIABLE_MTEXT = 5, EIMIL_SYMBOL_ID_VARIABLE_EVENT = 6,
  EIMIL_SYMBOL_ID_VARIABLE_PROP = 7, EIMIL_SYMBOL_ID_PROPERTY_MASK = 0x10, EIMIL_SYMBOL_ID_PROPERTY_NUMBER, EIMIL_SYMBOL_ID_PROPERTY_BOOL,
  EIMIL_SYMBOL_ID_PROPERTY_CHAR, EIMIL_SYMBOL_ID_PROPERTY_MTEXT, EIMIL_SYMBOL_ID_EXCEPTION = 0x20, EIMIL_SYMBOL_ID_PRIVATE = 0x80,
  EIMIL_SYMBOL_ID_FUNCTION = 0x81, EIMIL_SYMBOL_ID_OPERATION = 1, EIMIL_SYMBOL_ID_VARIABLE_NUMBER = 2, EIMIL_SYMBOL_ID_VARIABLE_BOOL = 3,
  EIMIL_SYMBOL_ID_VARIABLE_CHAR = 4, EIMIL_SYMBOL_ID_VARIABLE_MTEXT = 5, EIMIL_SYMBOL_ID_VARIABLE_EVENT = 6, EIMIL_SYMBOL_ID_VARIABLE_PROP = 7,
  EIMIL_SYMBOL_ID_PROPERTY_MASK = 0x10, EIMIL_SYMBOL_ID_PROPERTY_NUMBER, EIMIL_SYMBOL_ID_PROPERTY_BOOL, EIMIL_SYMBOL_ID_PROPERTY_CHAR,
  EIMIL_SYMBOL_ID_PROPERTY_MTEXT, EIMIL_SYMBOL_ID_EXCEPTION = 0x20, EIMIL_SYMBOL_ID_PRIVATE = 0x80, EIMIL_SYMBOL_ID_FUNCTION = 0x81,
  EIMIL_SYMBOL_ID_OPERATION = 1, EIMIL_SYMBOL_ID_VARIABLE_NUMBER = 2, EIMIL_SYMBOL_ID_VARIABLE_BOOL = 3, EIMIL_SYMBOL_ID_VARIABLE_CHAR = 4,
  EIMIL_SYMBOL_ID_VARIABLE_MTEXT = 5, EIMIL_SYMBOL_ID_VARIABLE_EVENT = 6, EIMIL_SYMBOL_ID_VARIABLE_PROP = 7, EIMIL_SYMBOL_ID_PROPERTY_MASK = 0x10,
  EIMIL_SYMBOL_ID_PROPERTY_NUMBER, EIMIL_SYMBOL_ID_PROPERTY_BOOL, EIMIL_SYMBOL_ID_PROPERTY_CHAR, EIMIL_SYMBOL_ID_PROPERTY_MTEXT,
  EIMIL_SYMBOL_ID_EXCEPTION = 0x20, EIMIL_SYMBOL_ID_PRIVATE = 0x80, EIMIL_SYMBOL_ID_FUNCTION = 0x81
}
enum  EIMIL_UNIVERSAL_SYMBOL_ID {
  EIMIL_SYMBOL_ID_NIL = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 1, EIMIL_SYMBOL_ID_T = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 2, EIMIL_SYMBOL_ID_FEEDBACK = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 3, EIMIL_SYMBOL_ID_CANDIDATES = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 4,
  EIMIL_SYMBOL_ID_NIL = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 1, EIMIL_SYMBOL_ID_T = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 2, EIMIL_SYMBOL_ID_FEEDBACK = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 3, EIMIL_SYMBOL_ID_CANDIDATES = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 4,
  EIMIL_SYMBOL_ID_NIL = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 1, EIMIL_SYMBOL_ID_T = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 2, EIMIL_SYMBOL_ID_FEEDBACK = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 3, EIMIL_SYMBOL_ID_CANDIDATES = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 4,
  EIMIL_SYMBOL_ID_NIL = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 1, EIMIL_SYMBOL_ID_T = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 2, EIMIL_SYMBOL_ID_FEEDBACK = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 3, EIMIL_SYMBOL_ID_CANDIDATES = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 4,
  EIMIL_SYMBOL_ID_NIL = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 1, EIMIL_SYMBOL_ID_T = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 2, EIMIL_SYMBOL_ID_FEEDBACK = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 3, EIMIL_SYMBOL_ID_CANDIDATES = (EIMIL_SYMBOL_ID_PRIVATE << 16) | 4
}
enum  EIMIL_UICHANGE_FLAGS {
  EIMIL_ENABLE_PREEDIT, EIMIL_DISABLE_PREEDIT, EIMIL_UPDATE_PREEDIT, EIMIL_ENABLE_LOOKUP_CHOICE = 0x100,
  EIMIL_DISABLE_LOOKUP_CHOICE, EIMIL_UPDATE_LOOKUP_CHOICE, EIMIL_COMMIT_STRING = 0x200, EIMIL_ENABLE_PREEDIT,
  EIMIL_DISABLE_PREEDIT, EIMIL_UPDATE_PREEDIT, EIMIL_ENABLE_LOOKUP_CHOICE = 0x100, EIMIL_DISABLE_LOOKUP_CHOICE,
  EIMIL_UPDATE_LOOKUP_CHOICE, EIMIL_COMMIT_STRING = 0x200, EIMIL_ENABLE_PREEDIT, EIMIL_DISABLE_PREEDIT,
  EIMIL_UPDATE_PREEDIT, EIMIL_ENABLE_LOOKUP_CHOICE = 0x100, EIMIL_DISABLE_LOOKUP_CHOICE, EIMIL_UPDATE_LOOKUP_CHOICE,
  EIMIL_COMMIT_STRING = 0x200, EIMIL_ENABLE_PREEDIT, EIMIL_DISABLE_PREEDIT, EIMIL_UPDATE_PREEDIT,
  EIMIL_ENABLE_LOOKUP_CHOICE = 0x100, EIMIL_DISABLE_LOOKUP_CHOICE, EIMIL_UPDATE_LOOKUP_CHOICE, EIMIL_COMMIT_STRING = 0x200,
  EIMIL_ENABLE_PREEDIT, EIMIL_DISABLE_PREEDIT, EIMIL_UPDATE_PREEDIT, EIMIL_ENABLE_LOOKUP_CHOICE = 0x100,
  EIMIL_DISABLE_LOOKUP_CHOICE, EIMIL_UPDATE_LOOKUP_CHOICE, EIMIL_COMMIT_STRING = 0x200
}

Functions

EIMIL_valueEIMIL_construct_number (int number)
EIMIL_valueEIMIL_construct_bool (int bool_val)
EIMIL_valueEIMIL_construct_char (UTF32 ch)
EIMIL_valueEIMIL_construct_prop (EIMIL_symbol *psym)
EIMIL_valueEIMIL_construct_prop2 (enum EIMIL_TYPE type)
EIMIL_valueEIMIL_construct_event (UTF8 *type, EIMIL_value *pv_val, EIMIL_value *pv_mod, EIMIL_value *pv_char, EIMIL_value *pv_mtext)
int EIMIL_construct_events_from_IMInputEvent (IMInputEvent *pimev, EIMIL_value ***pppevs)
IMInputEventEIMIL_convert_event_to_IMInputEvent (EIMIL_event *pev)
int EIMIL_add_prop (EIMIL_prop *pprop, EIMIL_value *pv)
int EIMIL_delete_prop (EIMIL_prop *pprop, int idx)
EIMIL_valueEIMIL_copy_value (EIMIL_value *pv)
int EIMIL_value_equal (EIMIL_value *pv1, EIMIL_value *pv2)
int EIMIL_generate_diff (EIMIL_symbol *psym, EIMIL_value *pv2, IMDifferential *pdiff)
int EIMIL_duplicate_handle (EIMIL_handle *peh, EIMIL_handle eh)
int EIMIL_free_handle (EIMIL_handle eh)
int EIMIL_send_event (EIMIL_handle eh, EIMIL_value *pv_event)
void EIMIL_destruct_value (EIMIL_value *pv)
void EIMIL_detach_prop_from_mtext (EIMIL_value *pv)
int EIMIL_initialize ()
int EIMIL_finalize ()
int EIMIL_register_class (unsigned char *classname, unsigned char *dirname)
unsigned char * EIMIL_find_file (const unsigned char *classname, const unsigned char *name)
int EIMIL_parse_file (EIMIL_handle *peh, const unsigned char *filename)
int EIMIL_enumerate_class (unsigned char *classname)
int EIMIL_register_file (unsigned char *classname)
int EIMIL_file_symbolid (unsigned char *classname, unsigned char *name)
int EIMIL_UTF32_string_len (const UTF32 *pstr)
int EIMIL_UTF32_strcmp (const UTF32 *pstr1, const UTF32 *pstr2)
int EIMIL_convert_UTF32char_to_UTF8 (UTF32 ch, UTF8 *p)
UTF8EIMIL_convert_UTF32_to_UTF8 (const UTF32 *putf32)
int EIMIL_convert_UTF8_to_UTF32char (const UTF8 *p, UTF32 *pch)
UTF32EIMIL_convert_UTF8_to_UTF32 (const UTF8 *putf8)
int EIMIL_adjust_UTF16_pos_to_UTF32 (int pos, const UTF32 *pbase, const UTF32 *pbaseend)
int EIMIL_adjust_UTF32_pos_to_UTF16 (int pos, const UTF32 *pbase, const UTF32 *pbaseend)
int EIMIL_convert_UTF32_to_UTF16 (const UTF32 *pu32, int u32len, UTF16 **ppu16, int *pu16len)
int EIMIL_convert_UTF16_to_UTF32 (const UTF16 *pu16, int u16len, UTF32 **ppu32, int *pu32len)
EIMIL_valueEIMIL_construct_mtext_from_UTF8 (const unsigned char *in)
EIMIL_valueEIMIL_construct_mtext_from_UTF16 (int len, const UTF16 *in)
EIMIL_valueEIMIL_construct_mtext_from_UTF32 (int len, const UTF32 *in)
EIMIL_valueEIMIL_construct_mtext_from_UTF32_char (UTF32 in)
EIMIL_valueEIMIL_mtext_concat (int num, EIMIL_value **pvs)
EIMIL_valueEIMIL_mtext_substr (EIMIL_value *pv_mtext, int st, int end)
EIMIL_valueEIMIL_get_prop_from_mtext (EIMIL_mtext *pm, EIMIL_symbol *property_sym, int pos)
EIMIL_valueEIMIL_find_prop_from_mtext (EIMIL_mtext *pm, EIMIL_symbol *property_sym, int pos)
EIMIL_mtextEIMIL_add_prop_on_mtext (EIMIL_mtext *pm, EIMIL_value *pv, int st, int end)
EIMIL_mtextEIMIL_set_prop_on_mtext (EIMIL_mtext *pm, EIMIL_value *pv, int st, int end)
int EIMIL_convert_mtext_to_IMText (IMText *pim, EIMIL_mtext *psrc)
EIMIL_valueEIMIL_construct_mtext_from_IMText (IMText *pim)
int EIMIL_sync_mtext (EIMIL_mtext *pm, IMDifferential *pdiff)
int EIMIL_journal_prev_val (EIMIL_handle eh, EIMIL_TID tid, EIMIL_symbol *psym, EIMIL_value **pv)
int EIMIL_journal_record_change (EIMIL_handle eh, EIMIL_symbol *psym)
int EIMIL_journal_set_point (EIMIL_handle eh, EIMIL_TID *ptid)

Variables

EIMIL_symbolpEIMIL_nil_sym
EIMIL_symbolpEIMIL_t_sym
EIMIL_symbolpEIMIL_feedback_sym
EIMIL_symbolpEIMIL_candidates_sym

Class Documentation

struct EIMIL_prop

Definition at line 127 of file EIMIL.h.

Collaboration diagram for EIMIL_prop:
Class Members
int end
EIMIL_symbol * property_sym
int st
EIMIL_mtext * target
struct EIMIL_mtext_props

Definition at line 137 of file EIMIL.h.

Collaboration diagram for EIMIL_mtext_props:
Class Members
int num
EIMIL_value ** pprops
EIMIL_symbol * property_sym
struct EIMIL_mtext

Definition at line 143 of file EIMIL.h.

Collaboration diagram for EIMIL_mtext:
Class Members
int len
EIMIL_mtext_props * pslots
int slotsnum
int UIdatap
UTF32 * ustr
struct EIMIL_event

Definition at line 151 of file EIMIL.h.

Collaboration diagram for EIMIL_event:
Class Members
EIMIL_value * pv_char
EIMIL_value * pv_mod
EIMIL_value * pv_mtext
EIMIL_value * pv_val
UTF8 * type
struct EIMIL_value

Definition at line 159 of file EIMIL.h.

Class Members
int refcount
enum EIMIL_TYPE union EIMIL_value v
enum EIMIL_TYPE union EIMIL_value v
enum EIMIL_TYPE union EIMIL_value v
enum EIMIL_TYPE union EIMIL_value v
enum EIMIL_TYPE union EIMIL_value v
struct EIMIL_function

Definition at line 176 of file EIMIL.h.

struct EIMIL_variable

Definition at line 181 of file EIMIL.h.

struct EIMIL_tprop

Definition at line 187 of file EIMIL.h.

struct EIMIL_message

Definition at line 191 of file EIMIL.h.

Class Members
UTF32 * lang
UTF32 * msg
struct EIMIL_exception

Definition at line 196 of file EIMIL.h.

Collaboration diagram for EIMIL_exception:
Class Members
EIMIL_message * msgs
struct EIMIL_dependency

Definition at line 200 of file EIMIL.h.

Collaboration diagram for EIMIL_dependency:
Class Members
EIMIL_symbol ** affects
EIMIL_symbol ** depends
int numaffects
int numdepends
struct EIMIL_operation

Definition at line 207 of file EIMIL.h.

Collaboration diagram for EIMIL_operation:
Class Members
int commitnotifyp
int numdepends
EIMIL_dependency * pdeps
struct EIMIL_optional

Definition at line 213 of file EIMIL.h.

Class Members
void * optarg
int optnum1
int optnum2
union EIMIL_object

Definition at line 219 of file EIMIL.h.

Class Members
EIMIL_exception e
EIMIL_function f
EIMIL_operation o
EIMIL_optional opt
EIMIL_tprop p
EIMIL_variable v
struct EIMIL_symbol

Definition at line 228 of file EIMIL.h.

union EIMIL_value.v

Definition at line 162 of file EIMIL.h.

Class Members
int bool_val
UTF32 ch
EIMIL_event event
EIMIL_mtext mtext
int number
EIMIL_prop prop

Define Documentation

#define ASSERT (   X)    ((void) 0)

Definition at line 24 of file EIMIL.h.

#define EIMIL_ADDREF (   v)    (((v).refcount)++)

Definition at line 511 of file EIMIL.h.

#define EIMIL_REFCHECK (   v)    ((((v).refcount) <= 0) ? (EIMIL_destruct_value(&(v)), 0) : 0)

Definition at line 515 of file EIMIL.h.

#define EIMIL_REFCHECK_GUARD (   v,
  gv 
)
Value:
do { \
    if (((v).refcount) <= 0) { \
       (gv).refcount++; \
       EIMIL_destruct_value(&(v)); \
       (gv).refcount--; \
    } \
} while(0)

Definition at line 517 of file EIMIL.h.

#define EIMIL_RMREF (   v)    ((--((v).refcount) <= 0) ? (EIMIL_destruct_value(&(v)), 0) : 0)

Definition at line 512 of file EIMIL.h.

#define EIMIL_RMREF_WITHOUT_DESTRUCTION (   v)    (--((v).refcount))

Definition at line 514 of file EIMIL.h.

#define EIMIL_VOID_HANDLE   ((void*)0)

Definition at line 35 of file EIMIL.h.


Typedef Documentation

typedef CARD8BIT Ebyte

Definition at line 33 of file EIMIL.h.

typedef struct EIMIL_dependency

Definition at line 116 of file EIMIL.h.

typedef struct EIMIL_event

Definition at line 113 of file EIMIL.h.

typedef int(* EIMIL_EVENT_PROC)(EIMIL_handle eh, EIMIL_event *pevent)

Definition at line 253 of file EIMIL.h.

typedef struct EIMIL_exception

Definition at line 115 of file EIMIL.h.

typedef struct EIMIL_function

Definition at line 121 of file EIMIL.h.

typedef void* EIMIL_handle

Definition at line 34 of file EIMIL.h.

typedef struct EIMIL_message

Definition at line 124 of file EIMIL.h.

typedef struct EIMIL_mtext

Definition at line 112 of file EIMIL.h.

typedef struct EIMIL_mtext_props

Definition at line 111 of file EIMIL.h.

typedef union EIMIL_object

Definition at line 119 of file EIMIL.h.

typedef struct EIMIL_operation

Definition at line 117 of file EIMIL.h.

typedef int(* EIMIL_OPISSUE_PROC)(EIMIL_handle eh, EIMIL_symbol *psym)

Definition at line 262 of file EIMIL.h.

typedef struct EIMIL_optional

Definition at line 118 of file EIMIL.h.

typedef struct EIMIL_prop

Definition at line 110 of file EIMIL.h.

typedef struct EIMIL_symbol

Definition at line 125 of file EIMIL.h.

Definition at line 32 of file EIMIL.h.

Definition at line 31 of file EIMIL.h.

typedef struct EIMIL_tprop

Definition at line 123 of file EIMIL.h.

typedef int(* EIMIL_UICHANGE_PROC)(EIMIL_handle eh, EIMIL_value *pval, int uichange_flags)

Definition at line 257 of file EIMIL.h.

typedef struct EIMIL_value

Definition at line 114 of file EIMIL.h.

typedef struct EIMIL_variable

Definition at line 122 of file EIMIL.h.

typedef CARD16BIT UTF16

Definition at line 29 of file EIMIL.h.

typedef CARD32BIT UTF32

Definition at line 28 of file EIMIL.h.

typedef CARD8BIT UTF8

Definition at line 30 of file EIMIL.h.


Enumeration Type Documentation

Enumerator:
EIMIL_CAT_VARIABLE 
EIMIL_CAT_PROPERTY 
EIMIL_CAT_FUNCTION 
EIMIL_CAT_EXCEPTION 
EIMIL_CAT_OPERATION 
EIMIL_CAT_OPTIONAL 
EIMIL_CAT_VARIABLE 
EIMIL_CAT_PROPERTY 
EIMIL_CAT_FUNCTION 
EIMIL_CAT_EXCEPTION 
EIMIL_CAT_OPERATION 
EIMIL_CAT_OPTIONAL 
EIMIL_CAT_VARIABLE 
EIMIL_CAT_PROPERTY 
EIMIL_CAT_FUNCTION 
EIMIL_CAT_EXCEPTION 
EIMIL_CAT_OPERATION 
EIMIL_CAT_OPTIONAL 
EIMIL_CAT_VARIABLE 
EIMIL_CAT_PROPERTY 
EIMIL_CAT_FUNCTION 
EIMIL_CAT_EXCEPTION 
EIMIL_CAT_OPERATION 
EIMIL_CAT_OPTIONAL 
EIMIL_CAT_VARIABLE 
EIMIL_CAT_PROPERTY 
EIMIL_CAT_FUNCTION 
EIMIL_CAT_EXCEPTION 
EIMIL_CAT_OPERATION 
EIMIL_CAT_OPTIONAL 

Definition at line 41 of file EIMIL.h.

Enumerator:
EIMIL_SYMBOL_ID_OPERATION 
EIMIL_SYMBOL_ID_VARIABLE_NUMBER 
EIMIL_SYMBOL_ID_VARIABLE_BOOL 
EIMIL_SYMBOL_ID_VARIABLE_CHAR 
EIMIL_SYMBOL_ID_VARIABLE_MTEXT 
EIMIL_SYMBOL_ID_VARIABLE_EVENT 
EIMIL_SYMBOL_ID_VARIABLE_PROP 
EIMIL_SYMBOL_ID_PROPERTY_MASK 
EIMIL_SYMBOL_ID_PROPERTY_NUMBER 
EIMIL_SYMBOL_ID_PROPERTY_BOOL 
EIMIL_SYMBOL_ID_PROPERTY_CHAR 
EIMIL_SYMBOL_ID_PROPERTY_MTEXT 
EIMIL_SYMBOL_ID_EXCEPTION 
EIMIL_SYMBOL_ID_PRIVATE 
EIMIL_SYMBOL_ID_FUNCTION 
EIMIL_SYMBOL_ID_OPERATION 
EIMIL_SYMBOL_ID_VARIABLE_NUMBER 
EIMIL_SYMBOL_ID_VARIABLE_BOOL 
EIMIL_SYMBOL_ID_VARIABLE_CHAR 
EIMIL_SYMBOL_ID_VARIABLE_MTEXT 
EIMIL_SYMBOL_ID_VARIABLE_EVENT 
EIMIL_SYMBOL_ID_VARIABLE_PROP 
EIMIL_SYMBOL_ID_PROPERTY_MASK 
EIMIL_SYMBOL_ID_PROPERTY_NUMBER 
EIMIL_SYMBOL_ID_PROPERTY_BOOL 
EIMIL_SYMBOL_ID_PROPERTY_CHAR 
EIMIL_SYMBOL_ID_PROPERTY_MTEXT 
EIMIL_SYMBOL_ID_EXCEPTION 
EIMIL_SYMBOL_ID_PRIVATE 
EIMIL_SYMBOL_ID_FUNCTION 
EIMIL_SYMBOL_ID_OPERATION 
EIMIL_SYMBOL_ID_VARIABLE_NUMBER 
EIMIL_SYMBOL_ID_VARIABLE_BOOL 
EIMIL_SYMBOL_ID_VARIABLE_CHAR 
EIMIL_SYMBOL_ID_VARIABLE_MTEXT 
EIMIL_SYMBOL_ID_VARIABLE_EVENT 
EIMIL_SYMBOL_ID_VARIABLE_PROP 
EIMIL_SYMBOL_ID_PROPERTY_MASK 
EIMIL_SYMBOL_ID_PROPERTY_NUMBER 
EIMIL_SYMBOL_ID_PROPERTY_BOOL 
EIMIL_SYMBOL_ID_PROPERTY_CHAR 
EIMIL_SYMBOL_ID_PROPERTY_MTEXT 
EIMIL_SYMBOL_ID_EXCEPTION 
EIMIL_SYMBOL_ID_PRIVATE 
EIMIL_SYMBOL_ID_FUNCTION 
EIMIL_SYMBOL_ID_OPERATION 
EIMIL_SYMBOL_ID_VARIABLE_NUMBER 
EIMIL_SYMBOL_ID_VARIABLE_BOOL 
EIMIL_SYMBOL_ID_VARIABLE_CHAR 
EIMIL_SYMBOL_ID_VARIABLE_MTEXT 
EIMIL_SYMBOL_ID_VARIABLE_EVENT 
EIMIL_SYMBOL_ID_VARIABLE_PROP 
EIMIL_SYMBOL_ID_PROPERTY_MASK 
EIMIL_SYMBOL_ID_PROPERTY_NUMBER 
EIMIL_SYMBOL_ID_PROPERTY_BOOL 
EIMIL_SYMBOL_ID_PROPERTY_CHAR 
EIMIL_SYMBOL_ID_PROPERTY_MTEXT 
EIMIL_SYMBOL_ID_EXCEPTION 
EIMIL_SYMBOL_ID_PRIVATE 
EIMIL_SYMBOL_ID_FUNCTION 
EIMIL_SYMBOL_ID_OPERATION 
EIMIL_SYMBOL_ID_VARIABLE_NUMBER 
EIMIL_SYMBOL_ID_VARIABLE_BOOL 
EIMIL_SYMBOL_ID_VARIABLE_CHAR 
EIMIL_SYMBOL_ID_VARIABLE_MTEXT 
EIMIL_SYMBOL_ID_VARIABLE_EVENT 
EIMIL_SYMBOL_ID_VARIABLE_PROP 
EIMIL_SYMBOL_ID_PROPERTY_MASK 
EIMIL_SYMBOL_ID_PROPERTY_NUMBER 
EIMIL_SYMBOL_ID_PROPERTY_BOOL 
EIMIL_SYMBOL_ID_PROPERTY_CHAR 
EIMIL_SYMBOL_ID_PROPERTY_MTEXT 
EIMIL_SYMBOL_ID_EXCEPTION 
EIMIL_SYMBOL_ID_PRIVATE 
EIMIL_SYMBOL_ID_FUNCTION 

Definition at line 72 of file EIMIL.h.

enum EIMIL_TYPE
Enumerator:
EIMIL_TYPE_INVALID 
EIMIL_TYPE_NONE 
EIMIL_TYPE_BOOL 
EIMIL_TYPE_NUMBER 
EIMIL_TYPE_CHAR 
EIMIL_TYPE_MTEXT 
EIMIL_TYPE_EVENT 
EIMIL_TYPE_PROP 
EIMIL_TYPE_NIL 
EIMIL_TYPE_T 
EIMIL_TYPE_FEEDBACK 
EIMIL_TYPE_CANDIDATES 
EIMIL_TYPE_CONST 
EIMIL_TYPE_ANY 
EIMIL_TYPE_OPTION1 
EIMIL_TYPE_OPTION2 
EIMIL_TYPE_INVALID 
EIMIL_TYPE_NONE 
EIMIL_TYPE_BOOL 
EIMIL_TYPE_NUMBER 
EIMIL_TYPE_CHAR 
EIMIL_TYPE_MTEXT 
EIMIL_TYPE_EVENT 
EIMIL_TYPE_PROP 
EIMIL_TYPE_NIL 
EIMIL_TYPE_T 
EIMIL_TYPE_FEEDBACK 
EIMIL_TYPE_CANDIDATES 
EIMIL_TYPE_CONST 
EIMIL_TYPE_ANY 
EIMIL_TYPE_OPTION1 
EIMIL_TYPE_OPTION2 
EIMIL_TYPE_INVALID 
EIMIL_TYPE_NONE 
EIMIL_TYPE_BOOL 
EIMIL_TYPE_NUMBER 
EIMIL_TYPE_CHAR 
EIMIL_TYPE_MTEXT 
EIMIL_TYPE_EVENT 
EIMIL_TYPE_PROP 
EIMIL_TYPE_NIL 
EIMIL_TYPE_T 
EIMIL_TYPE_FEEDBACK 
EIMIL_TYPE_CANDIDATES 
EIMIL_TYPE_CONST 
EIMIL_TYPE_ANY 
EIMIL_TYPE_OPTION1 
EIMIL_TYPE_OPTION2 
EIMIL_TYPE_INVALID 
EIMIL_TYPE_NONE 
EIMIL_TYPE_BOOL 
EIMIL_TYPE_NUMBER 
EIMIL_TYPE_CHAR 
EIMIL_TYPE_MTEXT 
EIMIL_TYPE_EVENT 
EIMIL_TYPE_PROP 
EIMIL_TYPE_NIL 
EIMIL_TYPE_T 
EIMIL_TYPE_FEEDBACK 
EIMIL_TYPE_CANDIDATES 
EIMIL_TYPE_CONST 
EIMIL_TYPE_ANY 
EIMIL_TYPE_OPTION1 
EIMIL_TYPE_OPTION2 
EIMIL_TYPE_INVALID 
EIMIL_TYPE_NONE 
EIMIL_TYPE_BOOL 
EIMIL_TYPE_NUMBER 
EIMIL_TYPE_CHAR 
EIMIL_TYPE_MTEXT 
EIMIL_TYPE_EVENT 
EIMIL_TYPE_PROP 
EIMIL_TYPE_NIL 
EIMIL_TYPE_T 
EIMIL_TYPE_FEEDBACK 
EIMIL_TYPE_CANDIDATES 
EIMIL_TYPE_CONST 
EIMIL_TYPE_ANY 
EIMIL_TYPE_OPTION1 
EIMIL_TYPE_OPTION2 

Definition at line 50 of file EIMIL.h.

                {
/* bitwise type flags.  */
       EIMIL_TYPE_INVALID = 0,
       EIMIL_TYPE_NONE = (1 << 0),
       EIMIL_TYPE_BOOL = (1 << 1),
       EIMIL_TYPE_NUMBER = (1 << 2),
       EIMIL_TYPE_CHAR = (1 << 3),
       EIMIL_TYPE_MTEXT = (1 << 4),
       EIMIL_TYPE_EVENT = (1 << 5),
       EIMIL_TYPE_PROP = (1 << 6),
/* special type attribute for unique objects.  */
       EIMIL_TYPE_NIL = (1 << 7),
       EIMIL_TYPE_T = -1,
       EIMIL_TYPE_FEEDBACK = -2,
       EIMIL_TYPE_CANDIDATES = -3,

       EIMIL_TYPE_CONST = (1 << 15),
       EIMIL_TYPE_ANY = (1 << 16),
       EIMIL_TYPE_OPTION1 = (1 << 17),
       EIMIL_TYPE_OPTION2 = (1 << 18)
};
Enumerator:
EIMIL_ENABLE_PREEDIT 
EIMIL_DISABLE_PREEDIT 
EIMIL_UPDATE_PREEDIT 
EIMIL_ENABLE_LOOKUP_CHOICE 
EIMIL_DISABLE_LOOKUP_CHOICE 
EIMIL_UPDATE_LOOKUP_CHOICE 
EIMIL_COMMIT_STRING 
EIMIL_ENABLE_PREEDIT 
EIMIL_DISABLE_PREEDIT 
EIMIL_UPDATE_PREEDIT 
EIMIL_ENABLE_LOOKUP_CHOICE 
EIMIL_DISABLE_LOOKUP_CHOICE 
EIMIL_UPDATE_LOOKUP_CHOICE 
EIMIL_COMMIT_STRING 
EIMIL_ENABLE_PREEDIT 
EIMIL_DISABLE_PREEDIT 
EIMIL_UPDATE_PREEDIT 
EIMIL_ENABLE_LOOKUP_CHOICE 
EIMIL_DISABLE_LOOKUP_CHOICE 
EIMIL_UPDATE_LOOKUP_CHOICE 
EIMIL_COMMIT_STRING 
EIMIL_ENABLE_PREEDIT 
EIMIL_DISABLE_PREEDIT 
EIMIL_UPDATE_PREEDIT 
EIMIL_ENABLE_LOOKUP_CHOICE 
EIMIL_DISABLE_LOOKUP_CHOICE 
EIMIL_UPDATE_LOOKUP_CHOICE 
EIMIL_COMMIT_STRING 
EIMIL_ENABLE_PREEDIT 
EIMIL_DISABLE_PREEDIT 
EIMIL_UPDATE_PREEDIT 
EIMIL_ENABLE_LOOKUP_CHOICE 
EIMIL_DISABLE_LOOKUP_CHOICE 
EIMIL_UPDATE_LOOKUP_CHOICE 
EIMIL_COMMIT_STRING 

Definition at line 241 of file EIMIL.h.

Enumerator:
EIMIL_SYMBOL_ID_NIL 
EIMIL_SYMBOL_ID_T 
EIMIL_SYMBOL_ID_FEEDBACK 
EIMIL_SYMBOL_ID_CANDIDATES 
EIMIL_SYMBOL_ID_NIL 
EIMIL_SYMBOL_ID_T 
EIMIL_SYMBOL_ID_FEEDBACK 
EIMIL_SYMBOL_ID_CANDIDATES 
EIMIL_SYMBOL_ID_NIL 
EIMIL_SYMBOL_ID_T 
EIMIL_SYMBOL_ID_FEEDBACK 
EIMIL_SYMBOL_ID_CANDIDATES 
EIMIL_SYMBOL_ID_NIL 
EIMIL_SYMBOL_ID_T 
EIMIL_SYMBOL_ID_FEEDBACK 
EIMIL_SYMBOL_ID_CANDIDATES 
EIMIL_SYMBOL_ID_NIL 
EIMIL_SYMBOL_ID_T 
EIMIL_SYMBOL_ID_FEEDBACK 
EIMIL_SYMBOL_ID_CANDIDATES 

Definition at line 98 of file EIMIL.h.


Function Documentation

int EIMIL_add_prop ( EIMIL_prop pprop,
EIMIL_value pv 
)

Definition at line 1439 of file EIMIL.c.

{
    EIMIL_value **ppv;

    ASSERT((!pv) || (pv->type == pprop->type));

    ppv = pprop->pvals;
    ppv = (EIMIL_value**) realloc(ppv, sizeof(EIMIL_value*) * (pprop->size + 1));
    if (!ppv) return 0;
    pprop->pvals = ppv;
    if (pv) EIMIL_ADDREF(*pv);
    ppv[pprop->size] = pv;
    pprop->size++;

    return 1;
}
EIMIL_mtext* EIMIL_add_prop_on_mtext ( EIMIL_mtext pm,
EIMIL_value pv,
int  st,
int  end 
)

Definition at line 721 of file EIMILTextUtil.c.

{
    int i, n;
    EIMIL_mtext_props *pmp;
    EIMIL_value **ppv, *pv2;
    EIMIL_prop *pprop;

    ASSERT(pv->type == EIMIL_TYPE_PROP);

    pmp = EIMIL_prepare_mtext_props_slot(pm, pv->v.prop.property_sym);
    if (!pmp) return NULL;
    n = pmp->num;

    for (ppv = pmp->pprops, i = 0; i < n; ppv++, i++) {
       pv2 = *ppv;
       ASSERT(pv2->type == EIMIL_TYPE_PROP);
       pprop = &pv2->v.prop;
       ASSERT(pprop->property_sym == pmp->property_sym);
       if (EIMIL_INTERVAL_OVERLAP_P(st, end, pprop->st, pprop->end)) break;
    }
    pmp->pprops = (EIMIL_value**) realloc(pmp->pprops,
                                     sizeof(EIMIL_value*) * n + 1);
    if (!pmp->pprops) return NULL;
    ppv = pmp->pprops + i;
    if (n > i) {
       memmove(ppv + 1, ppv, sizeof(EIMIL_value*) * (n - i));
    }
    *ppv = pv;
    pmp->num++;
    pv->v.prop.st = st;
    pv->v.prop.end = end;
    pv->v.prop.target = pm;
    EIMIL_ADDREF(*pv);

    return pm;
}
int EIMIL_adjust_UTF16_pos_to_UTF32 ( int  pos,
const UTF32 pbase,
const UTF32 pbaseend 
)

Definition at line 269 of file EIMILTextUtil.c.

{
    int i, npos;

    for (i = 0, npos = 0;i < pos;npos++, pbase++) {
       if (pbase >= pbaseend) return -1;
       if (*pbase < 0x10000) {
           i++;
       }else{
           i += 2;
       }
    }
    return npos;
}
int EIMIL_adjust_UTF32_pos_to_UTF16 ( int  pos,
const UTF32 pbase,
const UTF32 pbaseend 
)

Definition at line 289 of file EIMILTextUtil.c.

{
    const UTF32 *pe;
    int npos;

    pe = pbase + pos;
    for (npos = 0;pbase < pe;pbase++) {
       if (pbase >= pbaseend) return -1;
       if (*pbase < 0x10000) {
           npos++;
       }else{
           npos += 2;
       }
    }
    return npos;
}
EIMIL_value* EIMIL_construct_bool ( int  bool_val)

Definition at line 1270 of file EIMIL.c.

{
    if (!bool_val) return NULL;
    return &EIMIL_t_val;
}

Definition at line 1279 of file EIMIL.c.

{
    EIMIL_value *pv;
    pv = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pv) return NULL;
    pv->type = EIMIL_TYPE_CHAR;
    pv->v.ch = ch;
    pv->refcount = 0;
    return pv;
}
EIMIL_value* EIMIL_construct_event ( UTF8 type,
EIMIL_value pv_val,
EIMIL_value pv_mod,
EIMIL_value pv_char,
EIMIL_value pv_mtext 
)

Definition at line 1293 of file EIMIL.c.

{
    EIMIL_value *pv;
    ASSERT(!pv_val || pv_val->type == EIMIL_TYPE_NUMBER);
    ASSERT(!pv_mod || pv_mod->type == EIMIL_TYPE_NUMBER);
    ASSERT(!pv_char || pv_char->type == EIMIL_TYPE_CHAR);
    ASSERT(!pv_mtext || pv_mtext->type == EIMIL_TYPE_MTEXT);
    pv = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pv) return NULL;
    pv->type = EIMIL_TYPE_EVENT;

    pv->v.event.type = strdup(type);
    pv->v.event.pv_val = pv_val;
    if (pv_val) EIMIL_ADDREF(*pv_val);
    pv->v.event.pv_mod = pv_mod;
    if (pv_mod) EIMIL_ADDREF(*pv_mod);
    pv->v.event.pv_char = pv_char;
    if (pv_char) EIMIL_ADDREF(*pv_char);
    pv->v.event.pv_mtext = pv_mtext;
    if (pv_mtext) EIMIL_ADDREF(*pv_mtext);
    pv->refcount = 0;

    return pv;
}

Definition at line 1325 of file EIMIL.c.

{
    EIMIL_value *pev;

    switch (pimev->type) {
      case IM_EventKeyList:
      {
         IMKeyListEvent *pimkev = (IMKeyListEvent*) pimev;
         IMKeyList keylist = pimkev->keylist;
         int i, n = pimkev->n_key;
         EIMIL_value **ppevs;
         EIMIL_value *pev_code, *pev_char, *pev_mod;

         ppevs = (EIMIL_value**) malloc(sizeof(EIMIL_value*) * n);
         if (!ppevs) return 0;

         for (i = 0; i < n; i++) {
             pev_code = EIMIL_construct_number(keylist[i].keyCode);
             if (!pev_code) return 0;
             pev_char = EIMIL_construct_char(keylist[i].keyChar);
             if (!pev_char) return 0;
             pev_mod = EIMIL_construct_number(keylist[i].modifier);
             if (!pev_mod) return 0;
             pev = EIMIL_construct_event("keyevent",
                                     pev_code, pev_char, pev_mod,
                                     NULL);
             if (!pev) return 0;
             ppevs[i] = pev;
         }
         *pppevs = ppevs;
         return n;
      }
    }

    return 0;
}

Definition at line 1391 of file EIMILTextUtil.c.

{
    EIMIL_value *pv;

    pv = EIMIL_construct_mtext_from_UTF16(pim->char_length, pim->text.utf_chars);
    if (!pv) return NULL;
    if (!EIMIL_add_props_of_IMText(&pv->v.mtext, pim)) return NULL;

    return pv;
}
EIMIL_value* EIMIL_construct_mtext_from_UTF16 ( int  len,
const UTF16 in 
)

Definition at line 463 of file EIMILTextUtil.c.

{
    EIMIL_value *pv;
    EIMIL_mtext *pm;

    pv = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pv) return NULL;
    memset(pv, 0, sizeof(EIMIL_value));
    pv->type = EIMIL_TYPE_MTEXT;
    pm = &pv->v.mtext;
    if (!EIMIL_convert_UTF16_to_UTF32(in, len, &pm->ustr, &pm->len))
       return NULL;
    pm->slotsnum = 0;
    pm->pslots = NULL;
    pm->UIdatap = 0;

    return pv;
}
EIMIL_value* EIMIL_construct_mtext_from_UTF32 ( int  len,
const UTF32 in 
)

Definition at line 486 of file EIMILTextUtil.c.

{
    int i;
    UTF32 *pu;
    EIMIL_value *pv;
    EIMIL_mtext *pm;

    pv = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pv) return NULL;
    memset(pv, 0, sizeof(EIMIL_value));
    pv->type = EIMIL_TYPE_MTEXT;
    pm = &pv->v.mtext;
    pu = (UTF32*) malloc(sizeof(UTF32) * (len + 1));
    if (!pu) {
       free(pm);
       return NULL;
    }
    pm->len = len;
    pm->slotsnum = 0;
    pm->pslots = NULL;
    pm->UIdatap = 0;
    pm->ustr = pu;

    for (i = 0; i < len; i++) *pu++ = *in++;
    *pu = 0;

    return pv;
}

Definition at line 519 of file EIMILTextUtil.c.

{
    UTF32 *pu;
    EIMIL_value *pv;
    EIMIL_mtext *pm;

    pv = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pv) return NULL;
    memset(pv, 0, sizeof(EIMIL_value));
    pv->type = EIMIL_TYPE_MTEXT;
    pm = &pv->v.mtext;
    pu = (UTF32*) malloc(sizeof(UTF32) * 2);
    if (!pu) {
       free(pm);
       return NULL;
    }
    pm->len = 1;
    pm->slotsnum = 0;
    pm->pslots = NULL;
    pm->UIdatap = 0;
    pm->ustr = pu;
    *pu = in;
    pu[1] = 0;

    return pv;
}
EIMIL_value* EIMIL_construct_mtext_from_UTF8 ( const unsigned char *  in)

Definition at line 1256 of file EIMIL.c.

{
    EIMIL_value *pv;
    pv = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pv) return NULL;
    pv->type = EIMIL_TYPE_NUMBER;
    pv->v.number = number;
    pv->refcount = 0;
    return pv;
}

Definition at line 1397 of file EIMIL.c.

{
    EIMIL_value *pv;
    EIMIL_prop *pprop;

    ASSERT(psym->cat == EIMIL_CAT_PROPERTY);

    pv = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pv) return NULL;
    pv->type = EIMIL_TYPE_PROP;
    pprop = &pv->v.prop;
    memset(pprop, 0, sizeof(EIMIL_prop));
    pprop->st = -1;
    pprop->end = -1;
    pprop->property_sym = psym;
    pprop->type = psym->obj.p.type;
    pv->refcount = 0;
    return pv;
}

Definition at line 1420 of file EIMIL.c.

{
    EIMIL_value *pv;
    EIMIL_prop *pprop;
    pv = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pv) return NULL;
    pv->type = EIMIL_TYPE_PROP;
    pprop = &pv->v.prop;
    memset(pprop, 0, sizeof(EIMIL_prop));
    pprop->st = -1;
    pprop->end = -1;
    pprop->type = type;
    pv->refcount = 0;
    return pv;
}

Definition at line 1366 of file EIMIL.c.

{
    if (strcmp(pev->type, "keyevent") == 0) {
       IMKeyListEvent *pimkev;
       IMKeyList keylist;

       pimkev = (IMKeyListEvent*) malloc(sizeof(IMKeyListEvent));
       if (!pimkev) return NULL;
       memset(pimkev, 0, sizeof(IMKeyListEvent));
       keylist = (IMKeyList) malloc(sizeof(IMKeyEventStruct));
       if (!keylist) return NULL;
       memset(keylist, 0, sizeof(IMKeyEventStruct));

       pimkev->type = IM_EventKeyList;
       pimkev->n_key = 1;
       pimkev->keylist = keylist;
       if (pev->pv_val) {
           keylist->keyCode = pev->pv_val->v.number;
           keylist->keyChar = pev->pv_char->v.ch;
           keylist->modifier = pev->pv_mod->v.number;
       }

       return (IMInputEvent*) pimkev;
    }

    return NULL;
}
int EIMIL_convert_mtext_to_IMText ( IMText pim,
EIMIL_mtext psrc 
)

Definition at line 1260 of file EIMILTextUtil.c.

{
    int i, j;
    EIMIL_value **ppv, *pv;
    EIMIL_mtext_props *pmp;
    EIMIL_prop *pprop;

    IMAnnotation *pima;
    IMAnnotationValue *pimav;
    IMProp *pimp;

    memset(pim, 0, sizeof(IMText));
    pim->encoding = UTF16_CODESET;
    pim->count_annotations = psrc->slotsnum;
    pima = (IMAnnotation*) malloc(sizeof(IMAnnotation)
                              * pim->count_annotations);
    pim->annotations = pima;
    if (!pima) {
       free(pim);
       return 0;
    }
    /* UTF16 string */
    if (!EIMIL_convert_UTF32_to_UTF16(psrc->ustr, psrc->len,
                                  &pim->text.utf_chars,
                                  &pim->char_length)) {
       free(pim->annotations);
       free(pim);
       return 0;
    }

    pim->feedback = create_feedback(pim->char_length);
    if (!pim->feedback) {
       free(pim->text.utf_chars);
       free(pim->annotations);
       free(pim);
       return 0;
    }
    /* feedback & annotation */
    for (pmp = psrc->pslots, i = 0;
        i < psrc->slotsnum;
        pmp++, pima++, i++) {
       pima->type = pmp->property_sym->symbolid;

       if (pima->type == EIMIL_SYMBOL_ID_FEEDBACK) {
           for (ppv = pmp->pprops, j = 0;
               j < pmp->num;
               ppv++, pimav++, j++) {
              pv = *ppv;
              ASSERT(pv->type == EIMIL_TYPE_PROP);
              pprop = &pv->v.prop;
              set_feedback(psrc->ustr, psrc->ustr + psrc->len,
                          pprop, pim->feedback);
           }
       }

       pima->num_values = pmp->num;
       pimav = (IMAnnotationValue*) malloc(sizeof(IMAnnotationValue) * pmp->num);
       if (!pimav) {
           free(pim->annotations);
           free(pim);
           return 0;
       }
       pima->values = pimav;
       for (ppv = pmp->pprops, j = 0;
            j < pmp->num;
            ppv++, pimav++, j++) {
           pv = *ppv;
           ASSERT(pv->type == EIMIL_TYPE_PROP);
           pprop = &pv->v.prop;
           pimav->start_pos = EIMIL_adjust_UTF32_pos_to_UTF16(pprop->st,
                                                        psrc->ustr,
                                                        psrc->ustr
                                                        + psrc->len);
           ASSERT(pimav->start_pos >= 0);
           pimav->end_pos = EIMIL_adjust_UTF32_pos_to_UTF16(pprop->end,
                                                      psrc->ustr,
                                                      psrc->ustr
                                                      + psrc->len);
           ASSERT(pimav->end_pos >= 0);
           pimav->len = -1;
           pimp = EIMIL_prop_convert_to_IMProp(pprop);
           if (!pimp) {
              free(pim->annotations);
              free(pim);
              return 0;
           }
       }
    }

    return 1;
}
int EIMIL_convert_UTF16_to_UTF32 ( const UTF16 pu16,
int  u16len,
UTF32 **  ppu32,
int *  pu32len 
)

Definition at line 352 of file EIMILTextUtil.c.

{
    int i, rlen;
    UTF16 hs1, hs2;
    UTF32 *pr, *prh;

    prh = (UTF32*) malloc(sizeof(UTF32) * (u16len + 1));
    if (!prh) return 0;
    pr = prh;

    for (i = 0; i < u16len;) {
       hs1 = *pu16++;
       i++;
       if (UTF16_HS_P(hs1)) {
           hs2 = *pu16++;
           i++;
           if (i > u16len) {
              /* Invalid code.
                 TODO:We should output error.  */
              break;
           }
           if (UTF16_LS_P(hs2)) {
              *pr++ = (((hs1 & 0x3FF) << 10) | (hs2 & 0x3FF)) + 0x10000;
           }else{
              /* Invalid code.
                 TODO:We should output error.  */
              *pr++ = hs2;
           }
       }else{
           *pr++ = hs1;
       }
    }
    rlen = pr - prh;
    if (rlen != u16len)
       prh = (UTF32*) realloc(prh, sizeof(UTF32) * (rlen + 1));
    *pr = 0;
    *pu32len = rlen;
    *ppu32 = prh;
       
    return 1;
}
int EIMIL_convert_UTF32_to_UTF16 ( const UTF32 pu32,
int  u32len,
UTF16 **  ppu16,
int *  pu16len 
)

Definition at line 311 of file EIMILTextUtil.c.

{
    int i, rlen;
    UTF32 u32;
    UTF16 *pr, *prh;

    prh = (UTF16*) malloc(sizeof(UTF16) * (u32len * 2 + 1));
    if (!prh) return 0;
    pr = prh;

    for (i = 0; i < u32len; i++) {
       u32 = *pu32++;
       if (UTF16_S_P(u32)) {
           /* invalid code.
              TODO:We should output error.  */
       }else if (u32 < 0x10000) {
           *pr++ = (UTF16) u32;
       }else if (u32 < 0x110000) {
           u32 -= 0x10000;
           *pr++ = ((u32 >> 10) | 0xD800);
           *pr++ = ((u32 & 0x3FF) | 0xDC00);
       }else{
           /* invalid code.
              TODO:We should output error.  */
       }
    }
    *pr = 0;
    rlen = pr - prh;
    prh = (UTF16*) realloc(prh, sizeof(UTF16) * (rlen + 1));
    *pu16len = rlen;
    *ppu16 = prh;

    return 1;
}
UTF8* EIMIL_convert_UTF32_to_UTF8 ( const UTF32 putf32)

Definition at line 107 of file EIMILTextUtil.c.

{
    int n;
    const UTF32 *pu32;
    UTF8 *ps, *p;

    for (n = 0, pu32 = putf32; *pu32; pu32++) {
       if (*pu32 < 0x80) n++;
       else if (*pu32 < 0x800) n += 2;
       else if (*pu32 < 0x10000) n += 3;
       else if (*pu32 < 0x200000) n += 4;
       else if (*pu32 < 0x4000000) n += 5;
       else n += 6;
    }

    ps = p = (UTF8*) malloc(sizeof(UTF8) * (n + 1));
    if (!ps) return NULL;

    for (; *putf32; putf32++) {
       if (*putf32 < 0x80) {
           *p++ = *putf32;
       } else if (*putf32 < 0x800) {
           *p++ = (*putf32 >> 6) | 0xC0;
           *p++ = (*putf32 & 0x3F) | 0x80;
       } else if (*putf32 < 0x10000) {
           *p++ = (*putf32 >> 12) | 0xE0;
           *p++ = ((*putf32 >> 6) & 0x3F) | 0x80;
           *p++ = (*putf32 & 0x3F) | 0x80;
       } else if (*putf32 < 0x200000) {
           *p++ = (*putf32 >> 18) | 0xF0;
           *p++ = ((*putf32 >> 12) & 0x3F) | 0x80;
           *p++ = ((*putf32 >> 6) & 0x3F) | 0x80;
           *p++ = (*putf32 & 0x3F) | 0x80;
       } else if (*putf32 < 0x4000000) {
           /* actually, UTF-32 forbids the area over 0x10FFFF. */
           *p++ = (*putf32 >> 24) | 0xF8;
           *p++ = ((*putf32 >> 18) & 0x3F) | 0x80;
           *p++ = ((*putf32 >> 12) & 0x3F) | 0x80;
           *p++ = ((*putf32 >> 6) & 0x3F) | 0x80;
           *p++ = (*putf32 & 0x3F) | 0x80;
       } else {
           /* actually, UTF-32 forbids the area over 0x10FFFF. */
           *p++ = ((*putf32 >> 30) & 0x1) | 0xFC;
           *p++ = ((*putf32 >> 24) & 0x3F) | 0x80;
           *p++ = ((*putf32 >> 18) & 0x3F) | 0x80;
           *p++ = ((*putf32 >> 12) & 0x3F) | 0x80;
           *p++ = ((*putf32 >> 6) & 0x3F) | 0x80;
           *p++ = (*putf32 & 0x3F) | 0x80;
       }
    }
    *p = 0;
    return ps;
}

Definition at line 62 of file EIMILTextUtil.c.

{
    if (ch < 0x80) {
       *p++ = ch;
       return 1;
    } else if (ch < 0x800) {
       *p++ = (ch >> 6) | 0xC0;
       *p++ = (ch & 0x3F) | 0x80;
       return 2;
    } else if (ch < 0x10000) {
       *p++ = (ch >> 12) | 0xE0;
       *p++ = ((ch >> 6) & 0x3F) | 0x80;
       *p++ = (ch & 0x3F) | 0x80;
       return 3;
    } else if (ch < 0x200000) {
       *p++ = (ch >> 18) | 0xF0;
       *p++ = ((ch >> 12) & 0x3F) | 0x80;
       *p++ = ((ch >> 6) & 0x3F) | 0x80;
       *p++ = (ch & 0x3F) | 0x80;
       return 4;
    } else if (ch < 0x4000000) {
       /* actually, UTF-32 forbids the area over 0x10FFFF. */
       *p++ = (ch >> 24) | 0xF8;
       *p++ = ((ch >> 18) & 0x3F) | 0x80;
       *p++ = ((ch >> 12) & 0x3F) | 0x80;
       *p++ = ((ch >> 6) & 0x3F) | 0x80;
       *p++ = (ch & 0x3F) | 0x80;
       return 5;
    } else {
       /* actually, UTF-32 forbids the area over 0x10FFFF. */
       *p++ = ((ch >> 30) & 0x1) | 0xFC;
       *p++ = ((ch >> 24) & 0x3F) | 0x80;
       *p++ = ((ch >> 18) & 0x3F) | 0x80;
       *p++ = ((ch >> 12) & 0x3F) | 0x80;
       *p++ = ((ch >> 6) & 0x3F) | 0x80;
       *p++ = (ch & 0x3F) | 0x80;
       return 6;
    }
    return 0;
}
UTF32* EIMIL_convert_UTF8_to_UTF32 ( const UTF8 putf8)

Definition at line 209 of file EIMILTextUtil.c.

{
    int n;
    const UTF8 *pu8;
    UTF32 *ps, *p;

    for (n = 0, pu8 = putf8; *pu8; n++) {
       if (*pu8 < 0x80) pu8++;
       else if (*pu8 < 0xE0) pu8 += 2;
       else if (*pu8 < 0xF0) pu8 += 3;
       else if (*pu8 < 0xF8) pu8 += 4;
       else if (*pu8 < 0xFC) pu8 += 5;
       else pu8 += 6;
    }

    ps = p = (UTF32*) malloc(sizeof(UTF32) * (n + 1));
    if (!ps) return NULL;

    while (*putf8) {
       if (*putf8 < 0x80) {
           *p++ = *putf8++;
       } else if (*putf8 < 0xE0) {
           *p++ = (((putf8[0] & 0x1F) << 6)
                  | (putf8[1] & 0x3F));
           putf8 += 2;
       } else if (*putf8 < 0xF0) {
           *p++ = (((putf8[0] & 0x0F) << 12)
                  | ((putf8[1] & 0x3F) << 6)
                  | (putf8[2] & 0x3F));
           putf8 += 3;
       } else if (*putf8 < 0xF8) {
           *p++ = (((putf8[0] & 0x07) << 18)
                  | ((putf8[1] & 0x3F) << 12)
                  | ((putf8[2] & 0x3F) << 6)
                  | (putf8[3] & 0x3F));
           putf8 += 4;
       } else if (*putf8 < 0xFC) {
           *p++ = (((putf8[0] & 0x03) << 24)
                  | ((putf8[1] & 0x3F) << 18)
                  | ((putf8[2] & 0x3F) << 12)
                  | ((putf8[3] & 0x3F) << 6)
                  | (putf8[4] & 0x3F));
           putf8 += 5;
       } else {
           *p++ = (((putf8[0] & 0x01) << 30)
                  | ((putf8[1] & 0x3F) << 24)
                  | ((putf8[2] & 0x3F) << 18)
                  | ((putf8[3] & 0x3F) << 12)
                  | ((putf8[4] & 0x3F) << 6)
                  | (putf8[5] & 0x3F));
           putf8 += 6;
       }
    }
    *p = 0;
    return ps;
}
int EIMIL_convert_UTF8_to_UTF32char ( const UTF8 p,
UTF32 pch 
)

Definition at line 164 of file EIMILTextUtil.c.

{
    if (!p) return 0;

    if (*p < 0x80) {
       if (pch) *pch = *p;
       return 1;
    } else if (*p < 0xE0) {
       if (pch) *pch = (((p[0] & 0x1F) << 6)
              | (p[1] & 0x3F));
       return 2;
    } else if (*p < 0xF0) {
       if (pch) *pch = (((p[0] & 0x0F) << 12)
              | ((p[1] & 0x3F) << 6)
              | (p[2] & 0x3F));
       return 3;
    } else if (*p < 0xF8) {
       if (pch) *pch = (((p[0] & 0x07) << 18)
              | ((p[1] & 0x3F) << 12)
              | ((p[2] & 0x3F) << 6)
              | (p[3] & 0x3F));
       return 4;
    } else if (*p < 0xFC) {
       if (pch) *pch = (((p[0] & 0x03) << 24)
              | ((p[1] & 0x3F) << 18)
              | ((p[2] & 0x3F) << 12)
              | ((p[3] & 0x3F) << 6)
              | (p[4] & 0x3F));
       return 5;
    } else {
       if (pch) *pch = (((p[0] & 0x01) << 30)
              | ((p[1] & 0x3F) << 24)
              | ((p[2] & 0x3F) << 18)
              | ((p[3] & 0x3F) << 12)
              | ((p[4] & 0x3F) << 6)
              | (p[5] & 0x3F));
       return 6;
    }
    return 0;
}

Definition at line 1516 of file EIMIL.c.

{
    EIMIL_value *pv2;

    if (pv->type == EIMIL_TYPE_BOOL) {
       ASSERT(pv == &EIMIL_t_val);
       return pv;
    }

    pv2 = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    memset(pv2, 0, sizeof(EIMIL_value));
    if (!pv2) return NULL;
    pv2->type = pv->type;
    pv2->refcount = 0;

    switch(pv->type) {
      case EIMIL_TYPE_NUMBER:
       pv2->v.number = pv->v.number;
       break;

      case EIMIL_TYPE_CHAR:
       pv2->v.ch = pv->v.ch;
       break;

      case EIMIL_TYPE_PROP:
      {
         int i;
         EIMIL_value *pvtmp;
         pv2->v.prop = pv->v.prop;
         pv2->v.prop.pvals = (EIMIL_value**) malloc(sizeof(EIMIL_value*)
                                               * pv->v.prop.size);
         if (!pv2->v.prop.pvals) return NULL;
         for (i = 0; i < pv->v.prop.size; i++) {
             pvtmp = pv->v.prop.pvals[i];
             EIMIL_ADDREF(*pvtmp);
             pv2->v.prop.pvals[i] = pvtmp;
         }
         break;
      }
      case EIMIL_TYPE_EVENT:
       pv2->v.event.type = strdup(pv->v.event.type);
       if (!pv2->v.event.type) {
          free(pv2);
          return NULL;
       }
       if (pv->v.event.pv_val) {
          pv2->v.event.pv_val = EIMIL_copy_value(pv->v.event.pv_val);
          if (!pv2->v.event.pv_val) {
              free(pv2->v.event.type);
              free(pv2);
              return NULL;
          }
       }
       if (pv->v.event.pv_mod) {
          pv2->v.event.pv_mod = EIMIL_copy_value(pv->v.event.pv_mod);
          if (!pv2->v.event.pv_mod) {
              EIMIL_destruct_value(pv->v.event.pv_val);
              free(pv2->v.event.type);
              free(pv2);
              return NULL;
          }
       }
       if (pv->v.event.pv_char) {
          pv2->v.event.pv_char = EIMIL_copy_value(pv->v.event.pv_char);
          if (!pv2->v.event.pv_char) {
              EIMIL_destruct_value(pv->v.event.pv_val);
              EIMIL_destruct_value(pv->v.event.pv_mod);
              free(pv2->v.event.type);
              free(pv2);
              return NULL;
          }
       }
       if (!pv->v.event.pv_mtext) break;
      case EIMIL_TYPE_MTEXT:
      {
         int i, j;
         EIMIL_mtext *pmt2, *pmt;
         EIMIL_mtext_props *pmp;
         EIMIL_value **ppv;

         if (pv->type == EIMIL_TYPE_MTEXT) {
             pv2->v.mtext = pv->v.mtext;
             pmt = &pv->v.mtext;
             pmt2 = &pv2->v.mtext;
         }else{
             pmt = &pv->v.event.pv_mtext->v.mtext;
             pmt2 = &pv2->v.event.pv_mtext->v.mtext;
         }
         pmt2->ustr = (UTF32*) malloc(sizeof(UTF32) * pmt->len);
         if (!pmt2->ustr) {
             free(pv2);
             return NULL;
         }
         memcpy(pmt2->ustr, pmt->ustr, sizeof(UTF32) * pmt->len);

         pmt2->pslots = (EIMIL_mtext_props*) malloc(sizeof(EIMIL_mtext_props)
                                               * pmt->slotsnum);
         if (!pmt2->pslots) {
             free(pmt2->ustr);
             free(pv2);
             return NULL;
         }
         memcpy(pmt2->pslots, pmt->pslots,
               sizeof(EIMIL_mtext_props) * pmt->slotsnum);

         for (pmp = pmt2->pslots, i = 0;
              i < pmt2->slotsnum;
              i++, pmp++) {
             ppv = (EIMIL_value**) malloc(sizeof(EIMIL_value*) * pmp->num);
             if (!ppv) {
                free(pmt2->pslots);
                free(pmt2->ustr);
                free(pv2);
                return NULL;
             }
             memcpy(ppv, pmp->pprops, sizeof(EIMIL_value*) * pmp->num);
             pmp->pprops = ppv;
             for (j = 0; j < pmp->num; j++, ppv++) {
                ASSERT((*ppv)->type == EIMIL_TYPE_PROP);
                *ppv = EIMIL_copy_value(*ppv);
                if (!*ppv) {
                    free(pmt2->pslots);
                    free(pmt2->ustr);
                    free(pv2);
                    return NULL;
                                   
                }
                (*ppv)->v.prop.target = pmt2;
                EIMIL_ADDREF(**ppv);
             }
         }
         break;
      }
      default:
       abort();
    }

    return pv2;
}
int EIMIL_delete_prop ( EIMIL_prop pprop,
int  idx 
)

Definition at line 1460 of file EIMIL.c.

{
    EIMIL_value **ppv;

    if ((idx < 0) || (idx >= pprop->size)) return 0;
    ppv = pprop->pvals + idx;
    EIMIL_RMREF(**ppv);
    if ((pprop->size - idx - 1) > 0)
       memmove(ppv, ppv + 1, sizeof(EIMIL_value*) * (pprop->size - idx - 1));
    pprop->size--;

    return 1;
}

Definition at line 1478 of file EIMIL.c.

{
    if (!pv) return;
    switch(pv->type) {
      case EIMIL_TYPE_PROP:
      {
         int i;
         EIMIL_value **ppv;

         EIMIL_detach_prop_from_mtext(pv);
         for (ppv = pv->v.prop.pvals, i = 0;
              i < pv->v.prop.size;
              ppv++, i++) {
             EIMIL_RMREF(**ppv);
         }
         if (pv->v.prop.pvals) free(pv->v.prop.pvals);
         break;
      }
      case EIMIL_TYPE_EVENT:
       if (pv->v.event.type) free(pv->v.event.type);
       if (pv->v.event.pv_val) EIMIL_RMREF(*pv->v.event.pv_val);
       if (pv->v.event.pv_mod) EIMIL_RMREF(*pv->v.event.pv_mod);
       if (pv->v.event.pv_char) EIMIL_RMREF(*pv->v.event.pv_char);
       if (pv->v.event.pv_mtext) EIMIL_RMREF(*pv->v.event.pv_mtext);
       break;
      case EIMIL_TYPE_MTEXT:
       EIMIL_destruct_mtext(&pv->v.mtext);
       break;
      default:
       break;
    }

    free(pv);
}

Definition at line 667 of file EIMILTextUtil.c.

{
    int i, n;
    EIMIL_mtext *pmt;
    EIMIL_mtext_props *pmp;
    EIMIL_value **ppv;
    EIMIL_prop *pprop;

    ASSERT(pv->type == EIMIL_TYPE_PROP);

    pprop = &pv->v.prop;
    pmt = pprop->target;
       
    if (!pmt) return;

    pmp = EIMIL_find_mtext_props(pmt, pprop->property_sym);
    ASSERT(pmp);
    n = pmp->num;

    for (ppv = pmp->pprops, i = 0; i < pmp->num; ppv++, i++) {
       if (*ppv == pv) {
           pmp->num--;
           if ((n - i - 1) > 0) {
              memmove(ppv, ppv + 1, sizeof(EIMIL_value*) * (n - i - 1));
           }
           pprop->st = pprop->end = -1;
           pprop->target = NULL;
           EIMIL_RMREF(*pv);
           return;
       }
    }
    /* not reached */
    abort();

    return;
}

Definition at line 3476 of file EIMIL.c.

{
    EIMIL_data *peds, *pedd;
    EIMIL_symbol *psym;
    EIMIL_dictionary *pdic;
    int i, n;

    peds = (EIMIL_data*) eh;
    pedd = EIMIL_make_handle_data(peds->pcommon);
    if (!pedd) return 0;

    /* copy handle data */
    *pedd = *peds;

    /* dupliacte dictionary */
    pdic = EIMIL_duplicate_dictionary(peds->pdic);
    if (!pdic) return 0;
    pedd->pdic = pdic;

    /* engine context */
    {
       void **pecs, **pecd;
       EIMIL_engine *pe;
       EIMIL_engine_table *pt;

       n = peds->pcommon->num_engines;
       pecs = pedd->pengine_context;
       pecd = (void**) malloc(sizeof(void*) * n);
       if (!pecd) return 0;
       for (i = 0; i < n; i++, pecs++, pecd++) {
           if (*pecs) {
              pe = peds->pcommon->pengine + i;
              pt = pe->ptable;
              *pecd = (*pt->handler)(EIMIL_ENGINE_DUPLICATE, peds,
                                   pe->private, *pecs);
              if (*pecd) return 0;
           } else {
              *pecd = NULL;
           }
       }
    }

    /* set psym_uidata. */
    if (peds->psym_uidata) {
       psym = EIMIL_lookup_symbol_internal(pdic, peds->psym_uidata->symbolid);
       ASSERT(psym);
       pedd->psym_uidata = psym;
    }

    /* set commitnotify_ops. */
    if (peds->commitnotify_numops > 0) {
       EIMIL_symbol **psyms_s, **psyms_d;
       psyms_d = (EIMIL_symbol**) malloc(sizeof(EIMIL_symbol*)
                                     * peds->commitnotify_numops);
       if (!psyms_d) return 0;
       pedd->commitnotify_ops = psyms_d;
       psyms_s = peds->commitnotify_ops;
       for (i = 0;
            peds->commitnotify_numops;
            i++, psyms_s++, psyms_d++) {
           *psyms_d = EIMIL_lookup_symbol_internal(pdic, psyms_s[0]->symbolid);
           ASSERT(*psyms_d);
       }
    }

    /* Reset journal state */
    pedd->current_journal_id = 0;
    pedd->pjst = NULL;

    /* Success */

    *peh = pedd;
                    
    return 1;
}
int EIMIL_enumerate_class ( unsigned char *  classname)

Definition at line 278 of file EIMILFile.c.

{
    return -1;
}
int EIMIL_file_symbolid ( unsigned char *  classname,
unsigned char *  name 
)

Definition at line 286 of file EIMILFile.c.

{
    return -1;
}
int EIMIL_finalize ( )
unsigned char* EIMIL_find_file ( const unsigned char *  classname,
const unsigned char *  name 
)

Definition at line 252 of file EIMILFile.c.

{
    int i, n;
    unsigned char buf[MAXPATHLEN];
    unsigned char *unmatched;
    EIMIL_class *pec;

    LOCK_CLASSLIST;
    n = classlist.num;
    pec = classlist.pclasses;
    for (i = 0;i < n;i++, pec++) {
       if ((match_classname(pec->classname, classname, &unmatched))
           && (find_file(pec->topdir, unmatched, name, buf, sizeof(buf)))) {
           UNLOCK_CLASSLIST;
           return strdup(buf);
       }
    }
    UNLOCK_CLASSLIST;

    return NULL;
}
EIMIL_value* EIMIL_find_prop_from_mtext ( EIMIL_mtext pm,
EIMIL_symbol property_sym,
int  pos 
)

Definition at line 600 of file EIMILTextUtil.c.

{
    int i, n;
    int minpos, minpos_idx;
    EIMIL_mtext_props *pmp;
    EIMIL_value **ppv, *pv;
    EIMIL_prop *pprop;

    minpos_idx = -1;

    pmp = EIMIL_find_mtext_props(pm, property_sym);
    if (!pmp) return NULL;

    n = pmp->num;
    for (ppv = pmp->pprops, i = 0; i < n; ppv++, i++) {
       pv = *ppv;
       ASSERT(pv->type == EIMIL_TYPE_PROP);
       pprop = &pv->v.prop;
       ASSERT(pprop->property_sym == property_sym);
       if ((pprop->st <= pos)
           && (pprop->end > pos))
           return pv;
       if ((pprop->st > pos)
           && ((minpos_idx < 0) || (minpos > pprop->st))) {
           minpos_idx = i;
           minpos = pprop->st;
       }
    }
    if (minpos_idx > 0)
       return pmp->pprops[minpos_idx];

    return NULL;
}

Definition at line 3556 of file EIMIL.c.

{
    EIMIL_data *ped;

    if (!eh) return 0;
    ped = (EIMIL_data*) eh;
    EIMIL_journal_free(eh);

    if (!ped->duplicated) {
       EIMIL_cdata *pc = ped->pcommon;
       if (pc->ps.buf) free(pc->ps.buf);
        if (pc->ps.pxmlns) free(pc->ps.pxmlns);
       DESTROY_SYNC_OBJECT(pc->sync_object);
       free(pc);
    }

    EIMIL_free_dictionary(ped->pdic);

    free(ped);

    return 1;
}
int EIMIL_generate_diff ( EIMIL_symbol psym,
EIMIL_value pv2,
IMDifferential pdiff 
)

Definition at line 1672 of file EIMIL.c.

{
    EIMIL_value *pv1;

    ASSERT(psym->cat == EIMIL_CAT_VARIABLE);
    pv1 = psym->obj.v.pv;

    memset(pdiff, 0, sizeof(IMDifferential));

    ASSERT((!pv2) || (psym->obj.v.type == pv2->type));
    switch(psym->obj.v.type) {
      case EIMIL_TYPE_NUMBER:
       if ((pv1 != pv2)
          || (pv1->v.number != pv2->v.number)) {
          pdiff->number = pv1->v.number;
          return 1;
       }
       break;

      case EIMIL_TYPE_BOOL:
       if ((pv1 != pv2)
          || (pv1->v.bool_val != pv2->v.bool_val)) {
          pdiff->bool_val = pv2->v.bool_val;
          return 1;
       }
       break;

      case EIMIL_TYPE_CHAR:
       if ((pv1 != pv2)
          || (pv1->v.ch != pv2->v.ch)) {
          pdiff->ch = pv2->v.ch;
          return 1;
       }
       break;

      case EIMIL_TYPE_MTEXT:
       return EIMIL_mtext_diff(&pv2->v.mtext, &pv1->v.mtext, pdiff);
       break;
      default:
       abort();
    }

    return 0;
}
EIMIL_value* EIMIL_get_prop_from_mtext ( EIMIL_mtext pm,
EIMIL_symbol property_sym,
int  pos 
)

Definition at line 638 of file EIMILTextUtil.c.

{
    int i, n;
    EIMIL_mtext_props *pmp;
    EIMIL_value **ppv, *pv;
    EIMIL_prop *pprop;

    pmp = EIMIL_find_mtext_props(pm, property_sym);
    if (!pmp) return NULL;

    n = pmp->num;
    for (ppv = pmp->pprops, i = 0; i < n; ppv++, i++) {
       pv = *ppv;
       ASSERT(pv->type == EIMIL_TYPE_PROP);
       pprop = &pv->v.prop;
       ASSERT(pprop->property_sym == property_sym);
       if ((pprop->st <= pos)
           && (pprop->end > pos))
           return pv;
    }

    return NULL;
}

Definition at line 3640 of file EIMIL.c.

{

    if (EIMIL_inited) return 1;

    /* initialize internal object */
    EIMIL_t_val.refcount = 1;
    EIMIL_t_val.type = EIMIL_TYPE_BOOL;
    EIMIL_t_val.v.bool_val = 1;

    if (!EIMIL_init_predefined_symbol()) return 0;
    if (!EIMILFile_init()) return 0;
    if (!PCE_init()) return 0;

    EIMIL_inited = 1;
    return 1;
}
int EIMIL_journal_prev_val ( EIMIL_handle  eh,
EIMIL_TID  tid,
EIMIL_symbol psym,
EIMIL_value **  pv 
)

Definition at line 136 of file EIMILJournal.c.

{
    int i;
    EIMIL_data *ped = (EIMIL_data*) eh;
    EIMIL_journal *pcj, *pj;

    ASSERT(psym->cat == EIMIL_CAT_VARIABLE);
    if (!ped->pjst) return 0;
    pcj = ped->pjst;
    pj = NULL;
    for (i = 0; i < EIMIL_JOURNAL_MAX_SLOT_SIZE; i++) {
       if (pcj->psym == psym) pj = pcj;
       if (pcj->id == tid) break;
       pcj = pcj->prev;
       ASSERT(pcj->pv);
    }
    if (!pj) return 0;
    *ppv = pj->pv;

    return 1;
}

Definition at line 107 of file EIMILJournal.c.

{
    EIMIL_data *ped = (EIMIL_data*) eh;
    EIMIL_journal *pcj;

    ASSERT(psym->cat == EIMIL_CAT_VARIABLE);
    if (!EIMIL_JOURNAL_CHECK(eh)) return 0;
    pcj = ped->pjst;

    pcj->pv = EIMIL_copy_value(psym->obj.v.pv);
    EIMIL_ADDREF(*pcj->pv);
              
    if (EIMIL_JOURNAL_EMPTY_SLOT(*pcj)) {
       pcj->id = EIMIL_JOURNAL_NONRECORD_TID;
    }
    pcj = pcj->next;
    pcj->id = EIMIL_JOURNAL_EMPTY_TID;
    if (pcj->pv) {
       EIMIL_RMREF(*pcj->pv);
       pcj->pv = NULL;
    }
    ped->pjst = pcj;
    return 1;
}

Definition at line 79 of file EIMILJournal.c.

{
    int cid;
    EIMIL_journal *pcj;
    EIMIL_data *ped = (EIMIL_data*) eh;

    if (!EIMIL_JOURNAL_CHECK(eh)) return 0;
    pcj = ped->pjst->next;
    cid = ped->current_journal_id;
    cid++;
    pcj->id = cid;
    if (pcj->pv) {
       EIMIL_RMREF(*pcj->pv);
       pcj->pv = NULL;
    }
    if (ped->current_journal_id >= EIMIL_JOURNAL_ID_MAX) {
       ped->current_journal_id = 1;
    }else{
       ped->current_journal_id = cid;
    }

    return 0;
}
EIMIL_value* EIMIL_mtext_concat ( int  num,
EIMIL_value **  pvs 
)

Definition at line 917 of file EIMILTextUtil.c.

{
    int i, j, k;
    int clen, pos;
    EIMIL_mtext *pm, *pmr;
    EIMIL_value **pvs2, *pvr;

    EIMIL_value **ppv;
    EIMIL_mtext_props *pmp, *pmp2;
    UTF32 *pu;

    pvr = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pvr) return NULL;
    memset(pvr, 0, sizeof(EIMIL_value));
    pvr->type = EIMIL_TYPE_MTEXT;
    pmr = &pvr->v.mtext;

    pmp2 = NULL;
    pos = 0;
    for (pvs2 = pvs, i = 0; i < num; pvs2++, i++) {
       if ((*pvs2)->type == EIMIL_TYPE_MTEXT) {
           pm = &((*pvs2)->v.mtext);
           clen = pm->len;
           for (pmp = pm->pslots, j = 0; j < pm->slotsnum; pmp++, j++) {
              pmp2 = EIMIL_prepare_mtext_props_slot(pmr, pmp->property_sym);
              if (!pmp2) goto error;
              pmp2->pprops = realloc(pmp2->pprops,
                                   sizeof(EIMIL_value*)
                                   * (pmp2->num + pmp->num));
              if (!pmp2->pprops) goto error;
              ppv = pmp2->pprops + pmp2->num;
              for (k = 0; k < pmp->num; k++) {
                  *ppv = EIMIL_move_prop(pmr, pmp->pprops[k],
                                      pos, pos + clen);
                  if (!*ppv) goto error;
                  ppv++;
              }
              pmp2->num += pmp->num;
           }
           pos += pm->len;
       } else if ((*pvs2)->type == EIMIL_TYPE_CHAR) {
           pos++;
       } else {
           ERROR_INTERNAL("Invalid type(must be mtext or char).");
       }
    }
    pmr->len = pos;
    pu = (UTF32*) malloc(sizeof(UTF32) * (pos + 1));
    if (!pu) goto error;
    pmr->ustr = pu;

    for (pvs2 = pvs, i = 0; i < num; pvs2++, i++) {
       if ((*pvs2)->type == EIMIL_TYPE_MTEXT) {
           pm = &((*pvs2)->v.mtext);
           memcpy(pu, pm->ustr, sizeof(UTF32) * pm->len);
           pu += pm->len;
       } else {
           /* EIMIL_TYPE_CHAR */
           *pu++ = (*pvs2)->v.ch;
       }
    }
    *pu = 0;

    return pvr;

error:
    EIMIL_destruct_value(pvr);
    return NULL;
}
EIMIL_value* EIMIL_mtext_substr ( EIMIL_value pv_mtext,
int  st,
int  end 
)

Definition at line 991 of file EIMILTextUtil.c.

{
    int i, j, len, num_props;
    int mst, mend;
    EIMIL_mtext *pm, *pmr;
    EIMIL_mtext_props *pmp, *pmp2;
    EIMIL_value **ppv, **ppv2, *pv, *pvr;
    UTF32 *pu;


    ASSERT(end > st);

    pm = &pv_mtext->v.mtext;

    if (st >= pm->len) return NULL;
    if (end > pm->len) end = pm->len;

    pvr = (EIMIL_value*) malloc(sizeof(EIMIL_value));
    if (!pvr) return NULL;
    memset(pvr, 0, sizeof(EIMIL_value));
    pvr->type = EIMIL_TYPE_MTEXT;
    pmr = &pvr->v.mtext;

    len = end - st;
    pmr->len = len;

    pu = (UTF32*) malloc(sizeof(UTF32) * (len + 1));
    if (!pu) {
       free(pmr);
       return NULL;
    }
    pmr->ustr = pu;
    memcpy(pu, pm->ustr + st, sizeof(UTF32) * len);
    pu[len] = 0;

    for (pmp = pm->pslots, i = 0; i < pm->slotsnum; pmp++, i++) {
       pmp2 = EIMIL_prepare_mtext_props_slot(pmr, pmp->property_sym);
       if (!pmp2) goto error;
       num_props = 0;
       ppv2 = (EIMIL_value**) malloc(sizeof(EIMIL_value*) * pmp->num);
       pmp2->pprops = ppv2;
       for (ppv = pmp->pprops, j = 0; j < pmp->num; ppv++, j++) {
           pv = *ppv;
           mst = pv->v.prop.st;
           mend = pv->v.prop.end;
           if (EIMIL_INTERVAL_OVERLAP_P(st, end, mst, mend)) {
              *ppv2 = EIMIL_move_prop(pmr, pv, -st, len);
              if (!*ppv2) goto error;
              ppv2++;
              num_props++;
           }
       }
       if (num_props > 0) {
           pmp2->pprops = (EIMIL_value**) realloc(pmp2->pprops,
                                             sizeof(EIMIL_value*) * num_props);
           if (!pmp2->pprops) goto error;
       } else {
           free(pmp2->pprops);
           pmp2->pprops = NULL;
       }
       pmp2->num = num_props;
    }

    return pvr;

error:
    EIMIL_destruct_mtext(pmr);
    free(pmr);
    return NULL;
}
int EIMIL_parse_file ( EIMIL_handle peh,
const unsigned char *  filename 
)

Definition at line 295 of file EIMILFile.c.

{
    int ret;
    EIMIL_data *ped;
    EIMIL_parser_state *pps;

    ped = EIMIL_make_handle_data(NULL);
    if (!ped) return 0;

    pps = &ped->pcommon->ps;

    if (!load_file(filename, ped)) return 0;

    ret = EIMIL_parse_start(ped);

    free(pps->buf);
    pps->buf = NULL;

    *peh = ped;

    return ret;
}
int EIMIL_register_class ( unsigned char *  classname,
unsigned char *  dirname 
)

Definition at line 146 of file EIMILFile.c.

{
    int i, n, len;
    EIMIL_class *pec;

    LOCK_CLASSLIST;
    n = classlist.num;
    pec = classlist.pclasses;
    for (i = 0; i < n; i++, pec++) {
       if (strcmp(pec->classname, classname) == 0) break;
    }
    if (i == n) {
       pec = classlist.pclasses;
       pec = (EIMIL_class*) realloc(pec, sizeof(EIMIL_class) * (n + 1));
       if (!pec) return 0;
       classlist.pclasses = pec;

       /*
         longer classname takes higher order.
         Should we apply more efficient algorithm?
       */
       len = strlen(classname);
       for (i = 0;i < n;i++) {
           if (len > strlen(pec->classname)) break;
       }
       if (i < n) memmove(pec + 1, pec, sizeof(EIMIL_class));
       pec->topdir = NULL;
       pec->classname = strdup(classname);
       if (!pec->classname) return 0;
       classlist.num++;
    }
    if (pec->topdir) free(pec->topdir);
    pec->topdir = strdup(dirname);
    if (!pec->topdir) return 0;
    UNLOCK_CLASSLIST;

    return 1;
}
int EIMIL_register_file ( unsigned char *  classname)
int EIMIL_send_event ( EIMIL_handle  eh,
EIMIL_value pv_event 
)

Definition at line 3842 of file EIMIL.c.

{
    int i, n;
    EIMIL_data *ped = (EIMIL_data*) eh;
    EIMIL_cdata *pcommon = ped->pcommon;
    EIMIL_engine *pe = pcommon->pengine;
    void **pengine_ctx;

    n = pcommon->num_engines;
    pengine_ctx = ped->pengine_context;

    /* if event, store event */
    if (pv_event) {
       ASSERT(pv_event->type == EIMIL_TYPE_EVENT);
       EIMIL_queue_event(ped, pv_event);
    }

    for (i = 0; i < n; i++) {
       if ((*pe->ptable->execute_handler)(*pengine_ctx)
           != EIMIL_ENGINE_STATUS_SKIPPED)
           break;
       pe++;
       pengine_ctx++;
    }

    if (pv_event) EIMIL_destruct_value(pv_event);
    return 1;
}
EIMIL_mtext* EIMIL_set_prop_on_mtext ( EIMIL_mtext pm,
EIMIL_value pv,
int  st,
int  end 
)

Definition at line 783 of file EIMILTextUtil.c.

{
    int i, n, idx;
    int mst, mend;
    EIMIL_mtext_props *pmp;
    EIMIL_value **ppv, *pv2, *pv3;
    EIMIL_prop *pprop;

    ASSERT(pv->type == EIMIL_TYPE_PROP);
       
    pmp = EIMIL_prepare_mtext_props_slot(pm, pv->v.prop.property_sym);
    if (!pmp) return NULL;
    n = pmp->num;

    idx = -1;
    ppv = pmp->pprops;
    for (i = 0; i < n;) {
       pv2 = ppv[i];
       ASSERT(pv2->type == EIMIL_TYPE_PROP);
       pprop = &pv2->v.prop;
       ASSERT(pprop->target == pm);
       ASSERT(pprop->property_sym == pmp->property_sym);
       mst = pprop->st;
       mend = pprop->end;
       if ((mend >= st) && (mst < st)) {
           /* <--->         */
           /*   <===>       */
           pprop->end = st;
           i++;
       }else if ((mend <= end) && (mst >= st)) {
           /*   <--->       */
           /*  <======>     */
           pprop->st = -1;
           pprop->end = -1;
           pprop->target = NULL;
           n--;
           if (n > i) {
              memmove(ppv + i, ppv + i + 1,
                     sizeof(EIMIL_value*) * (n - i));
           }
           EIMIL_RMREF(*pv2);
       }else if ((mst <= end) && (mend > end)) {
           /*       <--->   */
           /*  <======>     */
           pprop->st = end;
           i++;
       }else if ((mst < st) && (mend > end)) {
           /* <-------->    */
           /*    <===>      */
           /*     |         */
           /*     V         */
           /* <-><===><>    */
           /*  i      i+1   */
           pv3 = EIMIL_copy_value(pv2);
           if (!pv3) return NULL;
           pv3->v.prop.st = end;
           EIMIL_ADDREF(*pv3);
           pprop->end = st;
           ppv = (EIMIL_value**) realloc(ppv, sizeof(EIMIL_value*) * (n + 1));
           pmp->pprops = ppv;
           if (n > (i + 1)) {
              memmove(ppv + i + 2, ppv + i + 1,
                     sizeof(EIMIL_value*) * (n - i));
           }
           ppv[i + 1] = pv3;
           n++;
           if (idx < 0) idx = i + 1;
           i += 2;
       }else if (mst < st) {
           /* <---->        */
           /*       <====>  */
           if (idx < 0) idx = i;
           i++;
       }else{
           /*        <----> */
           /* <====>        */
           i++;
       }
    }
    pmp->pprops = (EIMIL_value**) realloc(pmp->pprops,
                                     sizeof(EIMIL_value*) * (n + 1));
    if (!pmp->pprops) return NULL;
    ppv = pmp->pprops + i;
    if (n > i) {
       memmove(ppv + 1, ppv, sizeof(EIMIL_value*) * (n - i));
    }
    *ppv = pv;
    pmp->num = n + 1;
    pv->v.prop.st = st;
    pv->v.prop.end = end;
    pv->v.prop.target = pm;
    EIMIL_ADDREF(*pv);

    return pm;
}
int EIMIL_sync_mtext ( EIMIL_mtext pm,
IMDifferential pdiff 
)

Definition at line 1419 of file EIMILTextUtil.c.

{
    int i, j, n;
    int st, end, nend, mst, mend, nlen, dlen;
    UTF32 *pustr, ulen;
    EIMIL_mtext_props *pmp;
    EIMIL_value **ppv, *pv, *pv2;
    EIMIL_prop *pprop;
    IMText *ptx;

    ptx = &pdiff->text;

    /* STEP1: replace the interval with the text.  */
    st = EIMIL_adjust_UTF16_pos_to_UTF32(pdiff->chg_first, pm->ustr,
                                    pm->ustr + pm->len);
    if (st < 0) return 0;
    end = EIMIL_adjust_UTF16_pos_to_UTF32(pdiff->chg_len, pm->ustr + st,
                                     pm->ustr + pm->len);
    if (end < 0) return 0;
    end += st;
    if (!EIMIL_convert_UTF16_to_UTF32(ptx->text.utf_chars, ptx->char_length,
                                  &pustr, &ulen))
       return 0;
    dlen = ulen - (end - st);
    nlen = pm->len + dlen;
    if ((end - st) > ulen) {
       memmove(pm->ustr + st + ulen, pm->ustr + end,
              sizeof(UTF32) * (pm->len - end));
       pm->ustr = (UTF32*) realloc(pm->ustr, sizeof(UTF32) * nlen);
    }else if ((end - st) < ulen) {
       pm->ustr = (UTF32*) realloc(pm->ustr, sizeof(UTF32) * nlen);
       memmove(pm->ustr + st + ulen, pm->ustr + end,
              sizeof(UTF32) * (pm->len - end));
    }
    memcpy(pm->ustr + st, pustr, sizeof(UTF32) * ulen);
    free(pustr);

    /* STEP2: strip or move props in the interval.  */
    for (pmp = pm->pslots, i = 0; i < pm->slotsnum; pmp++, i++) {
       n = pmp->num;
       ppv = pmp->pprops;
       for (j = 0; j < n;) {
           pv = ppv[j];
           ASSERT(pv->type == EIMIL_TYPE_PROP);
           pprop = &pv->v.prop;
           mst = pprop->st;
           mend = pprop->end;
           if ((mend >= st) && (mst < st)) {
              /* <--->         */
              /*   <===>       */
              pprop->end = st;
              j++;
           }else if ((mend <= end) && (mst >= st)) {
              /*   <--->       */
              /*  <======>     */
              pprop->st = -1;
              pprop->end = -1;
              pprop->target = NULL;
              n--;
              if (n > j) {
                  memmove(ppv + j, ppv + j + 1,
                         sizeof(EIMIL_value*) * (n - i));
              }
              EIMIL_RMREF(*pv);
           }else if ((mst <= end) && (mend > end)) {
              /*       <--->   */
              /*  <======>     */
              pprop->st = nend;
              j++;
           }else if ((mst < st) && (mend > end)) {
              /* <-------->    */
              /*    <===>      */
              /*     |         */
              /*     V         */
              /* <-><===><>    */
              /*  i      i+1   */
              pv2 = EIMIL_copy_value(pv);
              if (!pv2) return 0;
              pv2->v.prop.st = nend;
              EIMIL_ADDREF(*pv2);
              pprop->end = st;
              ppv = (EIMIL_value**) realloc(ppv, sizeof(EIMIL_value*) * (n + 1));
              pmp->pprops = ppv;
              if (n > (j + 1)) {
                  memmove(ppv + j + 2, ppv + j + 1,
                         sizeof(EIMIL_value*) * (n - j));
              }
              ppv[j + 1] = pv2;
              n++;
              j += 2;
           }else if (mst < st) {
              /* <---->        */
              /*       <====>  */
              j++;
           }else{
              /*        <----> */
              /* <====>        */
              pprop->st += dlen;
              pprop->end += dlen;
              j++;
           }
       }
    }

    /* STEP3: add props of the text. */
    if (!EIMIL_add_props_of_IMText(pm, ptx)) return 0;

    return 1;
}
int EIMIL_UTF32_strcmp ( const UTF32 pstr1,
const UTF32 pstr2 
)

Definition at line 48 of file EIMILTextUtil.c.

{
    for (;; pstr1++, pstr2++) {
       if (*pstr1 > *pstr2) return 1;
       if (*pstr1 < *pstr2) return -1;
       if (*pstr1 == 0) return 0;
    }
    return 0;
}
int EIMIL_UTF32_string_len ( const UTF32 pstr)

Definition at line 38 of file EIMILTextUtil.c.

{
    int i;
    for (i = 0;*pstr;pstr++, i++);
    return i;
}
int EIMIL_value_equal ( EIMIL_value pv1,
EIMIL_value pv2 
)

Definition at line 1659 of file EIMIL.c.

{
       if (pv1 == pv2) return 1;

       /* TODO!!! */

       return 0;
}

Variable Documentation

Definition at line 25 of file EIMIL.c.

Definition at line 24 of file EIMIL.c.

Definition at line 22 of file EIMIL.c.

Definition at line 23 of file EIMIL.c.