Back to index

im-sdk  12.3.91
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
IIIMPClient Class Reference

#include <IIIMPClient.hh>

Collaboration diagram for IIIMPClient:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 IIIMPClient (IIIMProtocol *, IMTransAccept *)
 ~IIIMPClient ()
const CompoundStringgetUser () const
const CompoundStringgetApplicationName () const
const CompoundStringgetOSName () const
const CompoundStringgetOSArch () const
const CompoundStringgetOSVersion () const
const CompoundStringgetXDisplayString () const
const CompoundStringgetXServerVendor () const
int commit_string (IMCommitCBStruct *commit)
int forward_event (IMForwardEventCBStruct *commit)
int preedit_start (IMPreeditCBStruct *preedit)
int preedit_draw (IMPreeditCBStruct *preedit)
int preedit_caret (IMPreeditCBStruct *preedit)
int preedit_done (IMPreeditCBStruct *preedit)
int status_start (IMStatusCBStruct *status)
int status_draw (IMStatusCBStruct *status)
int status_done (IMStatusCBStruct *status)
int lookup_start (IMLookupCBStruct *lookup)
int lookup_draw (IMLookupCBStruct *lookup)
int lookup_process (IMLookupCBStruct *lookup)
int lookup_done (IMLookupCBStruct *lookup)
int auxiliary_start (IMAuxCBStruct *auxiliary)
int auxiliary_draw (IMAuxCBStruct *auxiliary)
int auxiliary_done (IMAuxCBStruct *auxiliary)
int conversion_start (IMConvStateCBStruct *state)
int conversion_end (IMConvStateCBStruct *state)
void register_triggerkeys ()
int getICID (InputContext *ic)

Static Public Member Functions

static void * socket_listener (void *data)

Private Types

enum  PREDEFINED_IMATTRIBID {
  INPUT_METHOD_LIST = 0x1001, OBJECT_DESCRIPTOR_LIST = 0x1010, CLIENT_DESCRIPTOR = 0x1011, CHARACTER_CONVERSION_DEFINITION_RULE = 0x1030,
  JAR_GUI_OBJECT = 0x1031, JAR_LWE_OBJECT = 0x1032, BIN_GUI_OBJECT = 0x1033, BIN_LWE_OBJECT = 0x1034,
  SCRIPT_GUI_OBJECT = 0x1035, SCRIPT_LWE_OBJECT = 0x1036
}
enum  IIIM_PROTOCOL {
  IM_CONNECT = 1, IM_CONNECT_REPLY = 2, IM_DISCONNECT = 3, IM_DISCONNECT_REPLY = 4,
  IM_REGISTER_TRIGGER_KEYS = 5, IM_TRIGGER_NOTIFY = 6, IM_TRIGGER_NOTIFY_REPLY = 7, IM_SETIMVALUES = 8,
  IM_SETIMVALUES_REPLY = 9, IM_GETIMVALUES = 10, IM_GETIMVALUES_REPLY = 11, IM_FORWARD_EVENT = 12,
  IM_FORWARD_EVENT_REPLY = 13, IM_COMMIT_STRING = 14, IM_CREATEIC = 20, IM_CREATEIC_REPLY = 21,
  IM_DESTROYIC = 22, IM_DESTROYIC_REPLY = 23, IM_SETICVALUES = 24, IM_SETICVALUES_REPLY = 25,
  IM_GETICVALUES = 26, IM_GETICVALUES_REPLY = 27, IM_SETICFOCUS = 28, IM_SETICFOCUS_REPLY = 29,
  IM_UNSETICFOCUS = 30, IM_UNSETICFOCUS_REPLY = 31, IM_RESETIC = 32, IM_RESETIC_REPLY = 33,
  IM_PREEDIT_START = 40, IM_PREEDIT_START_REPLY = 41, IM_PREEDIT_DRAW = 42, IM_PREEDIT_DRAW_REPLY = 43,
  IM_PREEDIT_CARET = 44, IM_PREEDIT_CARET_REPLY = 45, IM_PREEDIT_DONE = 46, IM_PREEDIT_DONE_REPLY = 47,
  IM_STATUS_START = 50, IM_STATUS_START_REPLY = 51, IM_STATUS_DRAW = 52, IM_STATUS_DRAW_REPLY = 53,
  IM_STATUS_DONE = 54, IM_STATUS_DONE_REPLY = 55, IM_LOOKUP_START = 70, IM_LOOKUP_START_REPLY = 71,
  IM_LOOKUP_DRAW = 72, IM_LOOKUP_DRAW_REPLY = 73, IM_LOOKUP_DONE = 74, IM_LOOKUP_DONE_REPLY = 75,
  IM_LOOKUP_PROCESS = 76, IM_LOOKUP_PROCESS_REPLY = 77, IM_AUX_START = 90, IM_AUX_START_REPLY = 91,
  IM_AUX_DRAW = 92, IM_AUX_DRAW_REPLY = 93, IM_AUX_DONE = 94, IM_AUX_DONE_REPLY = 95,
  IM_AUX_SETVALUES = 96, IM_AUX_SETVALUES_REPLY = 97, IM_ERROR = 99
}
enum  Msg { MAX_RW_DATA_LEN = 32768 }
enum  ATTR { MAX_ATTRNUM = 10 }
enum  ForwardEventType { FORWARD_STRING = 0, FORWARD_TEXT, FORWARD_KEYEVENT }

Private Member Functions

void SetStringToFrame (FrameMgr fm, UTFCHAR *utf_str, int char_length)
void SetStringToFrame (FrameMgr fm, char *str, int length)
void send_message (int, CompoundString &, int)
void send_message (int, int, int)
void send_message (int, char *, int)
void send_imvalues_message (int, int, ICAttribute *, int)
unsigned char * create_ccdef_object_frame (IMObjectDescriptorStruct *, char *, int, unsigned int *)
unsigned char * create_jarfile_object_frame (IMObjectDescriptorStruct *, char *, int, unsigned int *)
unsigned char * create_binfile_object_frame (IMObjectDescriptorStruct *, unsigned int *)
unsigned char * get_content (char *, int)
unsigned char * get_amessage ()
unsigned char * get_im_connect ()
int read_data (const char *buf, const int len) const
int write_data (const char *buf, const int len) const
void dispatch (unsigned char *, int &)
int Select ()
void change_icvalues (char *, IMProtocolStruct *)
void free_icvalues (IMProtocolStruct *)
ICAttributeget_icattr (unsigned short *, int)
int preedit_state (IMConvStateCBStruct *)
int preedit_erase_text (IMPreeditCBStruct *)
int preedit_draw_text (IMPreeditCBStruct *)
int status_draw_string (IMStatusCBStruct *)
int status_draw_text (IMStatusCBStruct *)
void connect (IMProtocolStruct *, unsigned char *)
void dis_connect (IMProtocolStruct *, unsigned char *)
void set_imvalues (IMProtocolStruct *, unsigned char *)
void get_imvalues (IMProtocolStruct *, unsigned char *)
void create_ic (IMProtocolStruct *, unsigned char *)
void set_icvalues (IMProtocolStruct *, unsigned char *)
void get_icvalues (IMProtocolStruct *, unsigned char *)
void set_icfocus (IMProtocolStruct *, unsigned char *)
void unset_icfocus (IMProtocolStruct *, unsigned char *)
void destroy_ic (IMProtocolStruct *, unsigned char *)
void reset_ic (IMProtocolStruct *, unsigned char *)
void forward_string (IMProtocolStruct *, unsigned char *)
void forward_text (IMProtocolStruct *, unsigned char *)
void forward_keyevent (IMProtocolStruct *, unsigned char *)
void forward_event (IMProtocolStruct *, unsigned char *)
void trigger_notify (IMProtocolStruct *, unsigned char *)
void preedit_start_reply (IMProtocolStruct *, unsigned char *)
void preedit_caret_reply (IMProtocolStruct *, unsigned char *)
void aux_set_values (IMProtocolStruct *, unsigned char *)
void set_card (ICAttribute *, char *, IMAttr *, int)
int read_icvalue (unsigned short, int, void *p, ICAttribute *)
int read_imvalue (unsigned short, int, void *p, ICAttribute *)
int imtext_size (IMText *text)
char * req_put_imtext (char *ptr, IMText *text)
char * req_put_imtext_s (char *ptr, IMText *text)
int utf16_string_size (int len)
char * req_put_utf16_string (char *ptr, UTFCHAR *string, int length)
char * req_put_utf16_string_s (char *ptr, UTFCHAR *string, int length)
int ascii_string_size (char *string)
char * req_put_ascii_string (char *ptr, char *string)
char * req_put_ascii_string_s (char *ptr, char *string)
char * req_get_ascii_string (char *ptr, char **string, int *size_ret, int *buf_size_ret)
char * req_get_ascii_string_s (char *ptr, char **string, int *size_ret, int *buf_size_ret)
int string_list_count (char *p)
int string_list_count2 (char *p, int str_list_size)
int icattr_list_count (char *p)
int icattr_size (ICAttribute *icattr)
char * req_put_icattr_list (char *ptr, ICAttribute *icattr, int num)
char * req_put_icattr_list_s (char *ptr, ICAttribute *icattr, int num)

Private Attributes

IIIMProtocoliiim_protocol
CompoundString username
CompoundString application_name
CompoundString os_name
CompoundString os_arch
CompoundString os_version
CompoundString xDisplayName
CompoundString xServerVendor
ICAttributeimAttribute_list
int alloc_attr
int active_attr
char byteOrder
CompoundStringauthorization_list
int alloc_auth
int need_swap
IMTransAcceptaccept_fd
unsigned int im_id
IMThreadthread
IMList< InputContextinput_context_list
int being_deleted
int respond_keepalive

Detailed Description

Definition at line 73 of file IIIMPClient.hh.


Member Enumeration Documentation

enum IIIMPClient::ATTR [private]
Enumerator:
MAX_ATTRNUM 

Definition at line 311 of file IIIMPClient.hh.

{ MAX_ATTRNUM = 10};
Enumerator:
FORWARD_STRING 
FORWARD_TEXT 
FORWARD_KEYEVENT 

Definition at line 313 of file IIIMPClient.hh.

Enumerator:
IM_CONNECT 
IM_CONNECT_REPLY 
IM_DISCONNECT 
IM_DISCONNECT_REPLY 
IM_REGISTER_TRIGGER_KEYS 
IM_TRIGGER_NOTIFY 
IM_TRIGGER_NOTIFY_REPLY 
IM_SETIMVALUES 
IM_SETIMVALUES_REPLY 
IM_GETIMVALUES 
IM_GETIMVALUES_REPLY 
IM_FORWARD_EVENT 
IM_FORWARD_EVENT_REPLY 
IM_COMMIT_STRING 
IM_CREATEIC 
IM_CREATEIC_REPLY 
IM_DESTROYIC 
IM_DESTROYIC_REPLY 
IM_SETICVALUES 
IM_SETICVALUES_REPLY 
IM_GETICVALUES 
IM_GETICVALUES_REPLY 
IM_SETICFOCUS 
IM_SETICFOCUS_REPLY 
IM_UNSETICFOCUS 
IM_UNSETICFOCUS_REPLY 
IM_RESETIC 
IM_RESETIC_REPLY 
IM_PREEDIT_START 
IM_PREEDIT_START_REPLY 
IM_PREEDIT_DRAW 
IM_PREEDIT_DRAW_REPLY 
IM_PREEDIT_CARET 
IM_PREEDIT_CARET_REPLY 
IM_PREEDIT_DONE 
IM_PREEDIT_DONE_REPLY 
IM_STATUS_START 
IM_STATUS_START_REPLY 
IM_STATUS_DRAW 
IM_STATUS_DRAW_REPLY 
IM_STATUS_DONE 
IM_STATUS_DONE_REPLY 
IM_LOOKUP_START 
IM_LOOKUP_START_REPLY 
IM_LOOKUP_DRAW 
IM_LOOKUP_DRAW_REPLY 
IM_LOOKUP_DONE 
IM_LOOKUP_DONE_REPLY 
IM_LOOKUP_PROCESS 
IM_LOOKUP_PROCESS_REPLY 
IM_AUX_START 
IM_AUX_START_REPLY 
IM_AUX_DRAW 
IM_AUX_DRAW_REPLY 
IM_AUX_DONE 
IM_AUX_DONE_REPLY 
IM_AUX_SETVALUES 
IM_AUX_SETVALUES_REPLY 
IM_ERROR 

Definition at line 156 of file IIIMPClient.hh.

enum IIIMPClient::Msg [private]
Enumerator:
MAX_RW_DATA_LEN 

Definition at line 309 of file IIIMPClient.hh.

{ MAX_RW_DATA_LEN = 32768};
Enumerator:
INPUT_METHOD_LIST 
OBJECT_DESCRIPTOR_LIST 
CLIENT_DESCRIPTOR 
CHARACTER_CONVERSION_DEFINITION_RULE 
JAR_GUI_OBJECT 
JAR_LWE_OBJECT 
BIN_GUI_OBJECT 
BIN_LWE_OBJECT 
SCRIPT_GUI_OBJECT 
SCRIPT_LWE_OBJECT 

Definition at line 140 of file IIIMPClient.hh.


Constructor & Destructor Documentation

Definition at line 56 of file IIIMPClient.cpp.

                                                  {
  accept_fd = ss;
  im_id = accept_fd->connection_id();
  iiim_protocol = imp;

  being_deleted = False;
  respond_keepalive = False;

  application_name = "Unknown"; // get from IMClientName IMAttrib

  // IM Attribute List
  alloc_attr = active_attr = 0;
  imAttribute_list = 0;

  input_context_list.disable_reordering();

  // start creating a thread
  thread = new IMThread(socket_listener, this);
  // done creating a thread
}

Here is the call graph for this function:

Definition at line 78 of file IIIMPClient.cpp.

               {
  // remove self from im client list
  iiim_protocol->iiimp_client_list.remove(this);

  // call destory_ic methods for all input contexts
  InputContext *ic = &(input_context_list.getFirstItem());
  while(ic){
    if (ic && ((IIIMPInputContext*)ic)->is_active()) {
      input_context_list.remove(ic);
      ((IIIMPInputContext*)ic)->unrealize();
      iiim_protocol->proto_handler->DestroyIC((InputContext*)ic);
      // alive ICs should be delete here
      delete ic;
    }
    ic = &(input_context_list.getNextItem());
  }
  if(alloc_attr) {
       delete [] imAttribute_list;
  }
  delete accept_fd;
  accept_fd = 0;
  im_id = 0;
  delete thread;
}

Here is the call graph for this function:


Member Function Documentation

int IIIMPClient::ascii_string_size ( char *  string) [private]

Definition at line 247 of file IIIMPClientCB.cpp.

                                            {
  int size;

  size = 2;          /* byte length of LISTofCHAR */
  if (NULL != string) {     /* string */
    size += (2 * strlen(string));
  }
  if (size & 0x02) { /* padding */
    size += 2;
  }
  return size;
}

Here is the caller graph for this function:

void IIIMPClient::aux_set_values ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 111 of file IIIMPClientAuxSetValues.cpp.

                                           {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
  int im_name_len;
  char *enginename;
  int i;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  FmStatus status;
  extern XimFrameRec im_aux_setvalues_fr[], im_aux_setvalues_reply_fr[];
  XimFrameRec *input_fr = im_aux_setvalues_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  int class_index;
  CARD16 input_method_id, input_context_id;
  CARD32 byte_length = 0;
  int number;
#if !defined(USE_FRAMEMGR_ALWAYS)
  int string_list_num;
#else /* USE_FRAMEMGR_ALWAYS */
  int integer_list_num = IIIMPClient::MAX_ATTRNUM;
  int string_list_num = IIIMPClient::MAX_ATTRNUM;
#endif /* USE_FRAMEMGR_ALWAYS */
  IMAuxDrawCallbackStruct aux_draw;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
    req_get32(ptr, class_index);
    req_get16(ptr, byte_length);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
    req_get32s(ptr, class_index);
    req_get16s(ptr, byte_length);
  }
  if (byte_length & 0x01) {
    byte_length += 1;
  }
  if (byte_length & 0x02) {
    im_name_len = byte_length;
  } else {
    im_name_len = (byte_length + 2);
  }

#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);
  FrameMgrGetToken(fm, class_index);

  /* engine_name */
  CompoundString enginename;

  FrameMgrGetToken(fm, byte_length);
#endif /* USE_FRAMEMGR_ALWAYS */
  if (byte_length == 0) {
    /* something wrong */
    return;
  } else {
    CARD16 str;
    CARD8 byte_data;
    char *enginenamep;

#if !defined(USE_FRAMEMGR_ALWAYS)
    enginename = new char[byte_length + 1];
#else /* USE_FRAMEMGR_ALWAYS */
    enginename = CompoundString(byte_length);
    memset(enginename, 0, byte_length);
#endif /* USE_FRAMEMGR_ALWAYS */

    int i;
    if (False == need_swap) {
      for (i = 0, enginenamep = enginename;
          i < byte_length; i += 2, enginenamep++) {
#if !defined(USE_FRAMEMGR_ALWAYS)
       req_get16(ptr, *enginenamep);
#else /* USE_FRAMEMGR_ALWAYS */
        FrameMgrGetToken(fm, byte_data);
       *(((unsigned char *)&str) + 1) = byte_data;
       FrameMgrGetToken(fm, byte_data);
       *(((unsigned char *)&str) + 0) = byte_data;
       *enginenamep = (char)str;
#endif /* USE_FRAMEMGR_ALWAYS */
      }
    } else {
      for (i = 0, enginenamep = enginename;
          i < byte_length; i += 2, enginenamep++) {
#if !defined(USE_FRAMEMGR_ALWAYS)
       req_get16s(ptr, *enginenamep);
#else /* USE_FRAMEMGR_ALWAYS */
        FrameMgrGetToken(fm, byte_data);
       *(((unsigned char *)&str) + 0) = byte_data;
       FrameMgrGetToken(fm, byte_data);
       *(((unsigned char *)&str) + 1) = byte_data;
       *enginenamep = (char)str;
#endif /* USE_FRAMEMGR_ALWAYS */
      }
    }
    *enginenamep = (char)0;
  }
#if !defined(USE_FRAMEMGR_ALWAYS)
  if ((byte_length + 2) & 0x03) {
    ptr += (4 - ((byte_length + 2) & 0x03));
  }
#else /* USE_FRAMEMGR_ALWAYS */
#endif /* USE_FRAMEMGR_ALWAYS */


  aux_draw.aux_name = enginename;
  aux_draw.aux_index = class_index;

  /* integer value list */
#if !defined(USE_FRAMEMGR_ALWAYS)
  int *integer_list = NULL;
#else /* USE_FRAMEMGR_ALWAYS */
  int *integer_list = new int[integer_list_num];
#endif /* USE_FRAMEMGR_ALWAYS */

  number = 0;
#if !defined(USE_FRAMEMGR_ALWAYS)
  if (False == need_swap) {
    req_get32(ptr, byte_length);
  } else {
    req_get32s(ptr, byte_length);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgrGetToken(fm, byte_length);
#endif /* USE_FRAMEMGR_ALWAYS*/
  if (byte_length) {
#if !defined(USE_FRAMEMGR_ALWAYS)
    integer_list = new int[byte_length / 4];
    if (False == need_swap) {
      for (number = 0; number < (byte_length / 4); number++) {
       req_get32(ptr, *(integer_list + number));
      }
    } else {
      for (number = 0; number < (byte_length / 4); number++) {
       req_get32s(ptr, *(integer_list + number));
      }
    }
#else /* USE_FRAMEMGR_ALWAYS */
    while (FrameMgrIsIterLoopEnd(fm, &status) == False) {
      if (number == integer_list_num) {
       integer_list_num += IIIMPClient::MAX_ATTRNUM;
       int *temp = integer_list;
       integer_list = new int[integer_list_num];
       memmove(integer_list, temp, sizeof(int) * number);
       delete [] temp;
      }
      FrameMgrGetToken(fm, integer_list[number++]);
    }
#endif /* USE_FRAMEMGR_ALWAYS */
  }
  aux_draw.count_integer_values = number;
  aux_draw.integer_values = integer_list;

#if !defined(USE_FRAMEMGR_ALWAYS)
  /* string value list */
  string_list_num = string_list_count(ptr);
#endif

  IMText *string_list = new IMText[string_list_num];
  if (!string_list) {
    delete [] integer_list;
    return;
  }

  number = 0;
#if !defined(USE_FRAMEMGR_ALWAYS)
  if (False == need_swap) {
    req_get32(ptr, byte_length);
  } else {
    req_get32s(ptr, byte_length);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgrGetToken(fm, byte_length);
#endif /* USE_FRAMEMGR_ALWAYS */
  if (byte_length) {
#if !defined(USE_FRAMEMGR_ALWAYS)
    if (False == need_swap) {
      while (4 <= byte_length) {
       CARD16 str_length = 0;
       req_get16(ptr, str_length);
       byte_length -= 2;

       if (str_length & 0x01) {    /* incorrect request */
         str_length += 1;
       }
       if (byte_length < str_length) {    /* incorrect request */
         str_length = byte_length;
       }

       if (65000 < str_length) {
         /* something wrong */
       } else {
         int len = (str_length / 2);
         UTFCHAR *utf_str = new UTFCHAR[len + 1];

         for (i = 0; i < len; i++) {
           req_get16(ptr, *(utf_str + i));
         }
         *(utf_str + len) = 0;

         if ((str_length + 2) & 0x03) {
           byte_length -= (((str_length + 2) & (~0x03)) + 2);
           ptr += 2;
         } else {
           byte_length -= str_length;
         }

         string_list[number].encoding = UTF16_CODESET;
         string_list[number].char_length = len;
         string_list[number].text.utf_chars = utf_str;
         number += 1;
       }
      }
    } else {
      while (4 <= byte_length) {
       CARD16 str_length = 0;
       req_get16s(ptr, str_length);
       byte_length -= 2;

       if (str_length & 0x01) {    /* incorrect request */
         str_length += 1;
       }
       if (byte_length < str_length) {    /* incorrect request */
         str_length = byte_length;
       }

       if (65000 < str_length) {
         /* something wrong */
       } else {
         int len = (str_length / 2);
         UTFCHAR *utf_str = new UTFCHAR[len + 1];

         for (i = 0; i < len; i++) {
           req_get16s(ptr, *(utf_str + i));
         }
         *(utf_str + len) = 0;

         if ((str_length + 2) & 0x03) {
           byte_length -= (((str_length + 2) & (~0x03)) + 2);
           ptr += 2;
         } else {
           byte_length -= str_length;
         }

         string_list[number].encoding = UTF16_CODESET;
         string_list[number].char_length = len;
         string_list[number].text.utf_chars = utf_str;
         number += 1;
       }
      }
    }
#else /* USE_FRAMEMGR_ALWAYS */
    if (1 == (byte_length % 2)) {
      /*
       * byte_length must be even.
       * it should be safe to add 1 to byte_length when it is odd.
       */
      byte_length += 1;
    }

    while (byte_length > 0) {
      CARD16 str_length = 0;
      FrameMgrGetToken(fm, str_length);
      byte_length -= 2;

      if (1 == (str_length % 2)) {
       str_length += 1;
      }
      if (byte_length < str_length) {
       /* incorrect request */
       str_length = byte_length;
      }

      if (str_length > 65000) {
       /* something wrong */
      } else {
       CARD8 first_byte, second_byte;
       int len;
       char *utf_str = new char[str_length + 1];
       char *strp;
       int bl;

       for (strp = utf_str; strp < &utf_str[str_length];) {
         FrameMgrGetToken(fm, first_byte);
         byte_length--;
         FrameMgrGetToken(fm, second_byte);
         byte_length--;
         if (need_swap) {
           *strp++ = second_byte;
           *strp++ = first_byte;
         } else {
           *strp++ = first_byte;
           *strp++ = second_byte;
         }
       }
       /* decrease padding */
       byte_length -= ((str_length + 2) % 4);

       *strp = (char)0;

       if (number == string_list_num) {
         string_list_num += IIIMPClient::MAX_ATTRNUM;
         IMText *temp = string_list;
         string_list = new IMText[string_list_num];
         memmove(string_list, temp, sizeof(IMText) * number);
         delete [] temp;
       }
       const int one_unit = sizeof(UTFCHAR)/sizeof(char);
       string_list[number].encoding = UTF16_CODESET;
       string_list[number].char_length = str_length/one_unit;
       string_list[number++].text.utf_chars = (UTFCHAR*)utf_str;
      }
    }
#endif /* USE_FRAMEMGR_ALWAYS */
  }
  aux_draw.count_string_values = number;
  aux_draw.string_values = string_list;

#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  InputContext *ic = &(input_context_list.getItem(input_context_id));
  if (ic) {
    IMAuxEvent aux_event;
    aux_event.type = IM_EventAux;
    aux_event.aux = &aux_draw;
    iiim_protocol->proto_handler->ForwardEvent((InputContext*)ic,
                                          (IMInputEvent*)&aux_event);
  } else { 
    // need to treate as an error
  }

  /* return AUX_SET_VALUES_REPLY */

#if !defined(USE_FRAMEMGR_ALWAYS)
  const int total_size = (4 + 2 + 2 + 4 + 2 + im_name_len);
  char *reply = new char[total_size];
  memcpy(reply + 4, p, total_size - 4);

  send_message(IM_AUX_SETVALUES_REPLY, reply, total_size);

  delete [] reply;

#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_aux_setvalues_reply_fr, NULL, need_swap);

  /* set iteration count of engine name */
  byte_length = strlen(enginename);
  FrameMgrSetIterCount(fm, byte_length);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, input_method_id);
  FrameMgrPutToken(fm, input_context_id);
  FrameMgrPutToken(fm, class_index);

  for (char *enginenamep = enginename;
       enginenamep < &enginename[byte_length];enginenamep++) {
    CARD16 str = (CARD16)*enginenamep;
    CARD8 byte_data;
    byte_data = (str << 8) & 0xff00;
    FrameMgrPutToken(fm, byte_data);
    byte_data = str & 0x00ff;
    FrameMgrPutToken(fm, byte_data);
  }
  send_message(IM_AUX_SETVALUES_REPLY, reply, total_size);
#endif /* USE_FRAMEMGR_ALWAYS */

#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  delete [] integer_list;

  for (IMText *textp = aux_draw.string_values;
       textp < &aux_draw.string_values[aux_draw.count_string_values];
       textp++) {
    if (textp->text.utf_chars) delete [] textp->text.utf_chars;
  }
  delete [] string_list;

  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1933 of file IIIMPClientCB.cpp.

                                                           {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *data;
  char *ptr;
  int total_size;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_aux_done_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMAuxDoneCallbackStruct *call_data =
    (IMAuxDoneCallbackStruct*)&auxiliary_CB->aux->todo.done;
  char *enginename = call_data->aux_name;
  int i;

  if (!enginename) return True;    // nothing to do

#if !defined(USE_FRAMEMGR_ALWAYS)
  total_size = 4;
  total_size += (2 + 2);
  total_size += 4;
  total_size += ascii_string_size(enginename);
  data = new char[total_size];
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, auxiliary_CB->icid);
    req_put32(ptr, call_data->aux_index);
    ptr = req_put_ascii_string(ptr, enginename);
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, auxiliary_CB->icid);
    req_put32s(ptr, call_data->aux_index);
    ptr = req_put_ascii_string_s(ptr, enginename);
  }
  send_message(IM_AUX_DONE, data, total_size);
  delete [] data;
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_aux_done_fr, (char*)NULL, need_swap);

  /* set iteration count of engine name */
  int byte_length = strlen(enginename);
  FrameMgrSetIterCount(fm, byte_length);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, auxiliary_CB->icid); 
  FrameMgrPutToken(fm, call_data->aux_index);

  if (need_swap == True) {
    for (i = 0; i < byte_length; i++) {
      CARD16 c = (CARD16)enginename[i];
      CARD8 byte_data;
      byte_data = *((CARD8 *)(&c) + 1);
      FrameMgrPutToken(fm, byte_data);
      byte_data = *((CARD8 *)(&c) + 0);
      FrameMgrPutToken(fm, byte_data);
    }
  } else {
    for (i = 0; i < byte_length; i++) {
      CARD16 c = (CARD16)enginename[i];
      CARD8 byte_data;
      byte_data = *((CARD8 *)(&c) + 0);
      FrameMgrPutToken(fm, byte_data);
      byte_data = *((CARD8 *)(&c) + 1);
      FrameMgrPutToken(fm, byte_data);
    }
  }

  send_message(IM_AUX_DONE, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1660 of file IIIMPClientCB.cpp.

                                                           {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *data;
  char *ptr;
  int total_size;
  int string_list_size;
  IMText *string_values;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_aux_draw_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMAuxDrawCallbackStruct *call_data =
    (IMAuxDrawCallbackStruct*)&auxiliary_CB->aux->todo.draw;
  char *enginename = call_data->aux_name;
  int i;

  if (!enginename) return True;    // nothing to do

#if !defined(USE_FRAMEMGR_ALWAYS)
  total_size = 4;
  total_size += (2 + 2);
  total_size += 4;
  total_size += ascii_string_size(enginename);
  total_size += 4;   /* byte length of integer value list */
  total_size += (4 * call_data->count_integer_values);
                     /* integer value list */
  total_size += 4;   /* byte length of string value list */
  string_list_size = 0;
  for (i = 0; i < call_data->count_string_values; i++) {
    string_list_size +=
           utf16_string_size(call_data->string_values[i].char_length);
  }
  total_size += string_list_size;
  data = new char[total_size];
  ptr = (data + 4);
  string_values = call_data->string_values;

  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, auxiliary_CB->icid);
    req_put32(ptr, call_data->aux_index);
    ptr = req_put_ascii_string(ptr, enginename);
    req_put32(ptr, (4 * call_data->count_integer_values));
    for (i = 0; i < call_data->count_integer_values; i++) {
      req_put32(ptr, *(call_data->integer_values + i));
    }
    req_put32(ptr, string_list_size);
    for (i = 0; i < call_data->count_string_values; i++, string_values++) {
      ptr = req_put_utf16_string(ptr,
                             string_values->text.utf_chars,
                             string_values->char_length);
    }
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, auxiliary_CB->icid);
    req_put32s(ptr, call_data->aux_index);
    ptr = req_put_ascii_string_s(ptr, enginename);
    req_put32s(ptr, (4 * call_data->count_integer_values));
    for (i = 0; i < call_data->count_integer_values; i++) {
      req_put32s(ptr, *(call_data->integer_values + i));
    }
    req_put32s(ptr, string_list_size);
    for (i = 0; i < call_data->count_string_values; i++, string_values++) {
      ptr = req_put_utf16_string_s(ptr,
                               string_values->text.utf_chars, 
                               string_values->char_length);
    }
  }

  send_message(IM_AUX_DRAW, data, total_size);
  delete [] data;
  return True;

#else /* USE_FRAMEMGR_ALWAYS */
  /* without FrameMgr */
  int total_length;
  int string_length;
  int enginename_length;
  IMText *    string_values;
  char *      uc;
  int         j;

  total_length = 2 + 2; /* im_id + ic_id */
  total_length += 4; /* aux_index */
  total_length += 2; /* length of engine name */
  enginename_length = strlen(enginename);
  total_length += (enginename_length * 2);
  if (0 == (enginename_length % 2)) {
    total_length += 2; /* padding */
  }
  total_length += 4; /* byte length of integer value list */
  total_length += (4 * call_data->count_integer_values);
                                   /* integer value list */
  total_length += 4; /* byte length of string value list */
  string_length = 0;
  for (i = 0; i < call_data->count_string_values; i++) {
    /* string value */
    string_length += (call_data->string_values[i].char_length * 2) + 2;
    if (0 == (call_data->string_values[i].char_length % 2)) {
      string_length += 2; /* padding */
    }
  }
  total_length += string_length;

  CompoundString request = CompoundString(total_length, 0);
  unsigned char * p;

  p = request.toUchar();

  if (False == need_swap) {
    *((CARD16 *)(p + 0)) = im_id;
    *((CARD16 *)(p + 2)) = auxiliary_CB->icid;
    *((CARD32 *)(p + 4)) = call_data->aux_index;
    *((CARD16 *)(p + 8)) = (enginename_length * 2);

    p += 10;

    for (i = 0; i < enginename_length; i++) {
      CARD16 c;
      c = (CARD16)(*(enginename + i));
      *((CARD16 *)p) = c;
      p += 2;
    }
    if (0 == (enginename_length % 2)) {
      *((CARD16 *)p) = 0;
      p += 2;
    }

    *((CARD32 *)p) = (4 * call_data->count_integer_values);
    p += 4;
    for (i = 0; i < call_data->count_integer_values; i++) {
      *((CARD32 *)p) = *(call_data->integer_values + i);
      p += 4;
    }

    *((CARD32 *)p) = string_length;
    p += 4;

    string_values = call_data->string_values;
    for (i = 0; i < call_data->count_string_values; i++) {
      uc = (char *)((string_values + i)->text.utf_chars);
      *((CARD16 *)p) = ((string_values + i)->char_length * 2);
      p += 2;
      for (j = 0; j < (string_values + i)->char_length; j++) {
       *(p++) = *(uc++);
       *(p++) = *(uc++);
      }
      if (0 == ((string_values + i)->char_length % 2)) {
       *(p++) = 0;
       *(p++) = 0;
      }
    }
  } else {
    *((CARD16 *)(p + 0)) = req_swap16(im_id);
    *((CARD16 *)(p + 2)) = req_swap16(auxiliary_CB->icid);
    *((CARD32 *)(p + 4)) = req_swap32(call_data->aux_index);
    *((CARD16 *)(p + 8)) = req_swap16(enginename_length * 2);

    p += 10;

    for (i = 0; i < enginename_length; i++) {
      CARD16 c;
      c = (CARD16)(*(enginename + i));
      *((CARD16 *)p) = req_swap16(c);
      p += 2;
    }
    if (0 == (enginename_length % 2)) {
      *((CARD16 *)p) = 0;
      p += 2;
    }

    *((CARD32 *)p) = req_swap32(4 * call_data->count_integer_values);
    p += 4;
    for (i = 0; i < call_data->count_integer_values; i++) {
      *((CARD32 *)p) = req_swap32(*(call_data->integer_values + i));
      p += 4;
    }

    *((CARD32 *)p) = req_swap32(string_length);
    p += 4;

    string_values = call_data->string_values;
    for (i = 0; i < call_data->count_string_values; i++) {
      uc = (char *)((string_values + i)->text.utf_chars);
      *((CARD16 *)p) = req_swap16((string_values + i)->char_length * 2);
      p += 2;
      for (j = 0; j < (string_values + i)->char_length; j++) {
       *(p++) = *(uc + 1);
       *(p++) = *(uc + 0);
       uc += 2;
      }
      if (0 == ((string_values + i)->char_length % 2)) {
       *(p++) = 0;
       *(p++) = 0;
      }
    }
  }

  send_message(IM_AUX_DRAW, request, total_length);
  return True;

#if 0
  /* create FrameMgr */
  fm = FrameMgrInit(im_aux_draw_fr, (char*)NULL, need_swap);

  /* set iteration count of engine name */
  int byte_length = strlen(enginename);
  FrameMgrSetIterCount(fm, byte_length);

  /* set iteration count of integer list */
  FrameMgrSetIterCount(fm, call_data->count_integer_values);

  /* set iteration count of string list */
  FrameMgrSetIterCount(fm, call_data->count_string_values);

  for (i = 0; i < call_data->count_string_values; i++) {
    FrameMgrSetIterCount(fm, call_data->string_values[i].char_length);
  }

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, auxiliary_CB->icid); 
  FrameMgrPutToken(fm, call_data->aux_index);

  if (need_swap == True) {
    for (i = 0; i < byte_length; i++) {
      CARD16 c = (CARD16)enginename[i];
      CARD8 byte_data;
      byte_data = *((CARD8 *)(&c) + 1);
      FrameMgrPutToken(fm, byte_data);
      byte_data = *((CARD8 *)(&c) + 0);
      FrameMgrPutToken(fm, byte_data);
    }
  } else {
    for (i = 0; i < byte_length; i++) {
      CARD16 c = (CARD16)enginename[i];
      CARD8 byte_data;
      byte_data = *((CARD8 *)(&c) + 0);
      FrameMgrPutToken(fm, byte_data);
      byte_data = *((CARD8 *)(&c) + 1);
      FrameMgrPutToken(fm, byte_data);
    }
  }

  for (i = 0; i < call_data->count_integer_values; i++) {
    FrameMgrPutToken(fm, call_data->integer_values[i]);
  }

  UTFCHAR *utf_chars;
  int text_length;
  for (i = 0; i < call_data->count_string_values; i++) {
    text_length = call_data->string_values[i].char_length;

    if (call_data->string_values[i].encoding == UTF16_CODESET) {
      utf_chars = call_data->string_values[i].text.utf_chars;
    } else {
      utf_chars = 0;
    }
    SetStringToFrame(fm, utf_chars, text_length);
  }
  send_message(IM_AUX_DRAW, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);
  return True;
#endif
#endif /* USE_FRAMEMGR_ALWAYS */
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1579 of file IIIMPClientCB.cpp.

                                                            {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *data;
  char *ptr;
  int total_size;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_aux_start_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMAuxStartCallbackStruct *call_data =
    (IMAuxStartCallbackStruct*)&auxiliary_CB->aux->todo.start;
  char *enginename = call_data->aux_name;
  int i;

  if (!enginename) return True;    // nothing to do

#if !defined(USE_FRAMEMGR_ALWAYS)
  total_size = 4;
  total_size += (2 + 2);
  total_size += 4;
  total_size += ascii_string_size(enginename);
  data = new char[total_size];
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, auxiliary_CB->icid);
    req_put32(ptr, call_data->aux_index);
    ptr = req_put_ascii_string(ptr, enginename);
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, auxiliary_CB->icid);
    req_put32s(ptr, call_data->aux_index);
    ptr = req_put_ascii_string_s(ptr, enginename);
  }
  send_message(IM_AUX_START, data, total_size);
  delete [] data;
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_aux_start_fr, (char*)NULL, need_swap);

  /* set iteration count of engine name */
  int byte_length = strlen(enginename);
  FrameMgrSetIterCount(fm, byte_length);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, auxiliary_CB->icid); 
  FrameMgrPutToken(fm, call_data->aux_index);

  if (need_swap == True) {
    for (i = 0; i < byte_length; i++) {
      CARD16 c = (CARD16)enginename[i];
      CARD8 byte_data;
      byte_data = *((CARD8 *)(&c) + 1);
      FrameMgrPutToken(fm, byte_data);
      byte_data = *((CARD8 *)(&c) + 0);
      FrameMgrPutToken(fm, byte_data);
    }
  } else {
    for (i = 0; i < byte_length; i++) {
      CARD16 c = (CARD16)enginename[i];
      CARD8 byte_data;
      byte_data = *((CARD8 *)(&c) + 0);
      FrameMgrPutToken(fm, byte_data);
      byte_data = *((CARD8 *)(&c) + 1);
      FrameMgrPutToken(fm, byte_data);
    }
  }

  send_message(IM_AUX_START, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::change_icvalues ( char *  ptr,
IMProtocolStruct call_data 
) [private]

Definition at line 348 of file IIIMPClientDispatcher2.cpp.

                                    {
#if !defined(USE_FRAMEMGR_ALWAYS)
  int attrnum;
  int byte_length;
#else /* USE_FRAMEMGR_ALWAYS */
  FmStatus status;
  int max_attrnum = IIIMPClient::MAX_ATTRNUM;
#endif /* USE_FRAMEMGR_ALWAYS */
  IMChangeICStruct *changeic = (IMChangeICStruct*)&call_data->changeic;
  ICAttribute *icAttribute_list;
  int number;
  int first_ic_index = 0;

#if !defined(USE_FRAMEMGR_ALWAYS)
  attrnum = icattr_list_count(ptr);
  icAttribute_list = new ICAttribute[attrnum];
  if (False == need_swap) {
    req_get16(ptr, byte_length);
  } else {
    req_get16s(ptr, byte_length);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  icAttribute_list = new ICAttribute[max_attrnum];
#endif /* USE_FRAMEMGR_ALWAYS */

  /* Set InputStyle to Callbacks */
  number = 0;
  if (byte_length != 0) {
#if !defined(USE_FRAMEMGR_ALWAYS)
    if (False == need_swap) {
      for (number = 0; number < attrnum; number++) {
       req_get16(ptr, icAttribute_list[number].attribute_id);
       req_get16(ptr, icAttribute_list[number].value_length);
       icAttribute_list[number].value =
              new char[icAttribute_list[number].value_length];
       memcpy(icAttribute_list[number].value, ptr,
              icAttribute_list[number].value_length);
       if (icAttribute_list[number].value_length & 0x03) {
         ptr += ((icAttribute_list[number].value_length & (~0x03)) + 4);
       } else {
         ptr += icAttribute_list[number].value_length;
       }
      }
    } else {
      for (number = 0; number < attrnum; number++) {
       req_get16s(ptr, icAttribute_list[number].attribute_id);
       req_get16s(ptr, icAttribute_list[number].value_length);
       icAttribute_list[number].value =
              new char[icAttribute_list[number].value_length];
       memcpy(icAttribute_list[number].value, ptr,
              icAttribute_list[number].value_length);
       if (icAttribute_list[number].value_length & 0x03) {
         ptr += ((icAttribute_list[number].value_length & (~0x03)) + 4);
       } else {
         ptr += icAttribute_list[number].value_length;
       }
      }
    }
#else /* USE_FRAMEMGR_ALWAYS */
    while (FrameMgrIsIterLoopEnd(fm, &status) == False) {
      void *value;
      int value_length;
      if (number == max_attrnum) {
       max_attrnum += IIIMPClient::MAX_ATTRNUM;
       ICAttribute *temp = icAttribute_list;
       icAttribute_list = new ICAttribute[max_attrnum];
       memmove(icAttribute_list, temp, sizeof(ICAttribute) * number);
       delete [] temp;
      }
      FrameMgrGetToken(fm, icAttribute_list[number].attribute_id);
      FrameMgrGetToken(fm, value_length);
      FrameMgrSetSize(fm, value_length);
      icAttribute_list[number].value_length = value_length;
      FrameMgrGetToken(fm, value);
      icAttribute_list[number].value = new char[value_length];
      memmove(icAttribute_list[number].value, value, value_length);
      number++;
    }
#endif /* USE_FRAMEMGR_ALWAYS */
  }
  /* The value from the protocol may need to be byte-swapped */
  for (ICAttribute *icp = &icAttribute_list[first_ic_index];
       icp < &icAttribute_list[number]; icp++) {
    void *dummy = icp->value;

    if (read_icvalue(icp->attribute_id,
                   icp->value_length,
                   icp->value,
                   icp) == 0) {
      delete dummy;
    }
  }

  changeic->preedit_attr_num = 0;
  changeic->status_attr_num = 0;
  changeic->preedit_attr = 0;
  changeic->status_attr = 0;
  changeic->ic_attr_num = (CARD16)number;
  changeic->ic_attr = icAttribute_list;

  return;
  /* to CreateICMessageProc or SetICValuesProc */
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 308 of file IIIMPClientCB.cpp.

                                                      {
#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_commit_string_string_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMText *text = commit_CB->text;

  if (!text || text->char_length == 0) {
    return True;     // no string to commit
  }

  int text_length = text->char_length;
  UTFCHAR *utf_chars;

  if (text->encoding == UTF16_CODESET) {
    utf_chars = text->text.utf_chars;
    if (*utf_chars == 0xfffe || *utf_chars == 0xfeff) {
      utf_chars++;
      text_length -= 1;
    }
  } else {
    utf_chars = 0;
  }

  /* without FrameMgr */
  int         total_length;
  int         str_len;
  int         contents_type;
  UTFCHAR *   ut;
  int         i;

  total_length = 0;
  contents_type = 0;        /* STRING */

  total_length += 2;        /* im_id */
  total_length += 2;        /* ic_id */

  total_length += 4;        /* contents type */
  total_length += 2;        /* byte length of string */
  str_len = (2 * text_length);     /* unicode code element */
  total_length += str_len;
  if (0 == (text_length % 2)) {
    total_length += 2; /* padding */
  }

  CompoundString request = CompoundString(total_length, 0);
  unsigned char * p;

  p = request.toUchar();

  if (False == need_swap) {
    req_put16(p, im_id);
    req_put16(p, commit_CB->icid);
    req_put32(p, contents_type);
    req_put16(p, str_len);
    for (i = 0, ut = utf_chars; i < text_length; i++, ut++) {
      req_put16(p, *ut);
    }
  } else {
    req_put16s(p, im_id);
    req_put16s(p, commit_CB->icid);
    req_put32s(p, contents_type);
    req_put16s(p, str_len);
    for (i = 0, ut = utf_chars; i < text_length; i++, ut++) {
      req_put16s(p, *ut);
    }
  }

  send_message(IM_COMMIT_STRING, request, total_length);
  return True;

#if 0
  fm = FrameMgrInit(im_commit_string_string_fr, NULL, need_swap);
                  
  int text_length = text->char_length;
  UTFCHAR *utf_chars;

  if (text->encoding == UTF16_CODESET) {
    utf_chars = text->text.utf_chars;
    if (*utf_chars == 0xfffe || *utf_chars == 0xfeff) {
      utf_chars++;
      text_length -= 1;
    }
  } else {
#ifdef DEBUG
    // cerr << "need to do convertion" << endl;
#endif
    utf_chars = 0;
  }
  FrameMgrSetIterCount(fm, text_length);
  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  int flag = 0;      /* #0 for STRING */
  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, commit_CB->icid);
  FrameMgrPutToken(fm, flag);

  SetStringToFrame(fm, utf_chars, text_length);

  send_message(IM_COMMIT_STRING, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);
  return True;
#endif /* 0 */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::connect ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 170 of file IIIMPClientDispatcher.cpp.

                                                                  {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *data;
  char *ptr;
  int language_num;
  int total_size;
  int string_list_size;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_connect_fr[], im_connect_reply_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD8 byte_order;
  CARD8 protocol_version;
  CARD16 byte_length;

  CARD16 *attributes = (CARD16*)0;
#if !defined(USE_FRAMEMGR_ALWAYS)
  int str_length = 0;
#else /* USE_FRAMEMGR_ALWAYS */
  CARD16 str_length = 0;
#endif /* USE_FRAMEMGR_ALWAYS */

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;

  if (False == need_swap) {
    req_get8(ptr, byte_order);
    req_get8(ptr, protocol_version);
    ptr = req_get_ascii_string(ptr, &data, &str_length, NULL);
    if ((0 == str_length) || (str_length & 0x01)) {
      delete [] data;
      return; /* something wrong */
    }
    username = data;
    // 'data' was copied to username by CompoundString's copy constructor.
    // so can be deleted.
    delete [] data;
#ifdef DO_AUTHORIZATION
    /* authorization */
    req_get16(ptr, byte_length);
    alloc_auth = string_list_count2(ptr, byte_length);
    if (0 < alloc_auth) {
      authorization_list = new CompoundString[alloc_auth];
    }
    for (i = 0; i < alloc_auth; i++) {
      ptr = req_get_ascii_string(ptr, &data, NULL, NULL);
      *(authorization_list + i) = data;
      delete [] data;
    }
#endif /* DO_AUTHORIZATION */
  } else {
    req_get8s(ptr, byte_order);
    req_get8s(ptr, protocol_version);
    ptr = req_get_ascii_string_s(ptr, &data, &str_length, NULL);
    if ((0 == str_length) || (str_length & 0x01)) {
      delete [] data;
      return; /* something wrong */
    }
    username = data;
    // 'data' was copied to username by CompoundString's copy constructor.
    // so can be deleted.
    delete [] data;
#ifdef DO_AUTHORIZATION
    /* authorization */
    req_get16s(ptr, byte_length);
    alloc_auth = string_list_count2(ptr, byte_length);
    if (0 < alloc_auth) {
      authorization_list = new CompoundString[alloc_auth];
    }
    for (i = 0; i < alloc_auth; i++) {
      ptr = req_get_ascii_string_s(ptr, &data, NULL, NULL);
      *(authorization_list + i) = data;
      delete [] data;
    }
#endif /* DO_AUTHORIZATION */
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_connect_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, byte_order);
  FrameMgrGetToken(fm, protocol_version);

  /* username */
  FrameMgrGetToken(fm, str_length);
  if (str_length == 0) {
    /* something wrong */
    return;
  } else {
    CARD16 str;
    CARD8 byte_data;
    char *buffer = new char[str_length/2 + 1];
    char *usernamep;
    memset(buffer, 0, str_length/2 + 1);
    for (usernamep = buffer; usernamep < &buffer[str_length/2];
        usernamep++) {
      FrameMgrGetToken(fm, byte_data);
      str = (byte_data << 8) & 0xff00;
      FrameMgrGetToken(fm, byte_data);
      str += byte_data & 0x00ff;
      *usernamep = (char)str;
    }
    *usernamep = (CARD8)0;
    username = buffer;
    // 'buffer' was copied to username by CompoundString's copy constructor.
    // so can be deleted.
    delete [] buffer;
  }

#ifdef DO_AUTHORIZATION
  /* authorization */
  FrameMgrGetToken(fm, byte_length);
  if (byte_length == 0) {
    FrameMgrSetIterCount(fm, 0);
  } else if (byte_length != 0) {
    int length = 0;
    CARD16 str;
    CARD8 byte_data;

    authorization = new char[byte_length/2];
    memset(authorization, 0, byte_length/2);

    number = 0;
    while (length < byte_length && number < byte_length) {
      FrameMgrGetToken(fm, str_length); length += 4;
           
      for (strp = authorization;
          strp < &authorization[byte_length/2];strp++) {
       FrameMgrGetToken(fm, byte_data);
       str = (byte_data << 8) & 0xff00;
       FrameMgrGetToken(fm, byte_data);
       str += byte_data & 0x00ff;
       *strp = str;
      }
      if (number >= byte_length) break;
      authorization[number] = (char)0; number++;
      length += str_length + ((4 - (str_length%4)) % 4);
    }
  }
#endif

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  /* Send IM_REGISTER_TRIGGER_KEYS protocol  */

  if (iiim_protocol->countOnKeys() || iiim_protocol->countOffKeys()) {
    register_triggerkeys();
  }

#if !defined(USE_FRAMEMGR_ALWAYS)

  language_num = iiim_protocol->countLanguages();

  total_size = 4;
  total_size += 2;   /* imid */
  total_size += 2;   /* byte length of list of language names */

  string_list_size = 0;
  for (int i = 0; i < language_num; i++) {
    unsigned char *uc;
    int len;
    uc = iiim_protocol->getLang(i + 1).toUchar();
    len = strlen((char *)uc);
    if (len & 0x01) {
      string_list_size += (2 + (2 * len));
    } else {
      string_list_size += (2 + (2 * len) + 2);
    }
  }
  total_size += string_list_size;
  data = new char[total_size];
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, string_list_size);
    for (int i = 0; i < language_num; i++) {
      unsigned char *uc;
      uc = iiim_protocol->getLang(i + 1).toUchar();
      ptr = req_put_ascii_string(ptr, (char *)uc);
    }
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, string_list_size);
    for (int i = 0; i < language_num; i++) {
      unsigned char *uc;
      uc = iiim_protocol->getLang(i + 1).toUchar();
      ptr = req_put_ascii_string_s(ptr, (char *)uc);
    }
  }
  send_message(IM_CONNECT_REPLY, data, total_size);
  delete [] data;

#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_connect_reply_fr, NULL, need_swap);

  int iter_count = iiim_protocol->countLanguages();
  /* set iteration count of lang names */
  FrameMgrSetIterCount(fm, iter_count);

  /* set byte length of BIT16 item in STRING list */
  int i;
  for (i = 0; i < iter_count; i++) {
    CompoundString langp = iiim_protocol->getLang(i+1);
    int len = strlen((char*)langp);
    FrameMgrSetIterCount(fm, len);
  }

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size, 0);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  /* set input-method ID */
  FrameMgrPutToken(fm, im_id); /* input-method-id */

  for (i = 0; i < iter_count; i++) {
    CompoundString langp = iiim_protocol->getLang(i+1);
    SetStringToFrame(fm, langp, strlen(langp));
  }
  send_message(IM_CONNECT_REPLY, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  if (!iiim_protocol->proto_handler->Authenticate(accept_fd, username)) {
    /* being_deleted = 1; */
    delete this;
  }

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2019 of file IIIMPClientCB.cpp.

                                                             {
  return preedit_state(state_CB);
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2014 of file IIIMPClientCB.cpp.

                                                               {
  return preedit_state(state_CB);
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char * IIIMPClient::create_binfile_object_frame ( IMObjectDescriptorStruct od,
unsigned int *  buf_size 
) [private]

Definition at line 374 of file IIIMPClientDispatcher3.cpp.

                                                            {
  extern XimFrameRec binfileobject_fr[];
  FrameMgr fm;
  int i;

  /* create FrameMgr */
  fm = FrameMgrInit(binfileobject_fr, (char *)NULL, need_swap);

  FrameMgrSetIterCount(fm, strlen(od->path));

  const int total_size = FrameMgrGetTotalSize(fm);
  unsigned char *buffer  = new unsigned char[total_size];
  memset(buffer, 0, total_size);
  FrameMgrSetBuffer(fm, buffer);

#ifdef notdef
  for (i = 0; i < od->count_names; i++) {
    CompoundString name = od->class_names[i];
    int len = strlen((char*)name);
    for (char *strp = name; strp < &(name)[len]; strp++) {
      CARD16 str = (CARD16)*strp;
      CARD8 byte_data;
      byte_data = (str << 8) & 0xff00;
      FrameMgrPutToken(fm, byte_data);
      byte_data = str & 0x00ff;
      FrameMgrPutToken(fm, byte_data);
    }
  }
#endif
  SetStringToFrame(fm, od->path, strlen(od->path));

  FrameMgrFree(fm);

  *buf_size = total_size;
  return buffer;
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char * IIIMPClient::create_ccdef_object_frame ( IMObjectDescriptorStruct od,
char *  contents,
int  ob_size,
unsigned int *  buf_size 
) [private]

Definition at line 349 of file IIIMPClientDispatcher3.cpp.

                                                           {
  extern XimFrameRec ccdef_fr[];
  FrameMgr fm;

  /* create FrameMgr */
  fm = FrameMgrInit(ccdef_fr, (char *)NULL, need_swap);

  FrameMgrSetIterCount(fm, ob_size);

  const int total_size = FrameMgrGetTotalSize(fm);
  unsigned char *buffer  = new unsigned char[total_size];
  memset(buffer, 0, total_size);
  FrameMgrSetBuffer(fm, buffer);

  SetStringToFrame(fm, contents, ob_size);

  FrameMgrFree(fm);

  *buf_size = total_size;
  return buffer;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::create_ic ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 472 of file IIIMPClientDispatcher2.cpp.

                                                                    {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_createic_fr[], im_createic_reply_fr[];
  XimFrameRec *input_fr = im_createic_fr;
  XimFrameRec *output_fr = im_createic_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  IMChangeICStruct *changeic = (IMChangeICStruct*)&call_data->changeic;
  CARD16 input_method_id;
  CARD16 byte_length;
  const int IM_OUTPUT_REPLY = IM_CREATEIC_REPLY;

#ifndef IIIMP_KEEP_ALIVE_PROTOCOL
  /*
    fix for 4108572:
    When JavaOS is booted, it creates a new connection for the dummy
    user name "nobody@<hostname>". If there were any old connection
    done under the same user name, we close it here. It was left unclosed
    when the JavaOS was powered off.
  */
  if (!respond_keepalive) {
    char *at_hostname = strstr(username, "@");
    if (!strncmp((char*)username, "nobody", 6)) {
       IIIMPClient *cl = &(iiim_protocol->iiimp_client_list.getFirstItem());
       while (cl) {
         if (cl != this) {
           CompoundString user = cl->getUser();
           if (strstr(user, at_hostname)) {
             // to close the client
             if (!cl->respond_keepalive) {
               // call destory_ic methods for all input contexts
               InputContext *ic = &(cl->input_context_list.getFirstItem());
               while(ic){
                 if (ic && ((IIIMPInputContext*)ic)->is_active()) {
                  cl->input_context_list.remove(ic);
                  ((IIIMPInputContext*)ic)->unrealize();
                  iiim_protocol->proto_handler->DestroyIC((InputContext*)ic);
                 }
                 ic = &(cl->input_context_list.getNextItem());
               }

               // mark it to be killed later
               cl->being_deleted = 1;
             }
           }
        }
        cl = &(iiim_protocol->iiimp_client_list.getNextItem());
       }
    }
  }
#endif

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    change_icvalues(ptr, call_data);
  } else {
    req_get16s(ptr, input_method_id);
    change_icvalues(ptr, call_data);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, byte_length);

  change_icvalues(fm, byte_length, call_data);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  IIIMPInputContext *ic = new IIIMPInputContext(this);
  input_context_list.addItem(ic);
  CARD16 input_context_id = input_context_list.getIndex(ic);

  // set some icattributes to this new ic
  for (ICAttribute *icp = changeic->ic_attr;
       icp < &changeic->ic_attr[changeic->ic_attr_num]; icp++) {
    if (icp->name == iiim_protocol->ICLocaleName) {
      ic->setLocaleName((char*)icp->value);
    } else if (icp->name == iiim_protocol->ICEngineName) {
      ic->setEngineName((char*)icp->value);
    }
  }

  iiim_protocol->proto_handler->CreateIC((InputContext*)ic);
  iiim_protocol->proto_handler->RealizeIC((InputContext*)ic);

  free_icvalues(call_data);

#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, input_context_id, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, input_context_id,
              output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */
  ic->realize();
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char * IIIMPClient::create_jarfile_object_frame ( IMObjectDescriptorStruct od,
char *  contents,
int  ob_size,
unsigned int *  buf_size 
) [private]

Definition at line 300 of file IIIMPClientDispatcher3.cpp.

                                                            {
  extern XimFrameRec jarfileobject_fr[];
  FrameMgr fm;

  /* create FrameMgr */
  fm = FrameMgrInit(jarfileobject_fr, (char *)NULL, need_swap);

  /* set iteration count for list of ic_attribute */
  FrameMgrSetIterCount(fm, od->count_names);

  /* set byte length of BIT16 item in STRING list */
  int i;
  for (i = 0; i < od->count_names; i++) {
    CompoundString name = od->class_names[i];
    int len = strlen((char*)name);
    FrameMgrSetIterCount(fm, len);
  }

  FrameMgrSetSize(fm, ob_size);    // byte length of jar file

  const int total_size = FrameMgrGetTotalSize(fm);
  unsigned char *buffer  = new unsigned char[total_size];
  memset(buffer, 0, total_size);
  FrameMgrSetBuffer(fm, buffer);

  for (i = 0; i < od->count_names; i++) {
    CompoundString name = od->class_names[i];
    int len = strlen((char*)name);
    for (char *strp = name; strp < &(name)[len]; strp++) {
      CARD16 str = (CARD16)*strp;
      CARD8 byte_data;
      byte_data = (str << 8) & 0xff00;
      FrameMgrPutToken(fm, byte_data);
      byte_data = str & 0x00ff;
      FrameMgrPutToken(fm, byte_data);
    }
  }
  FrameMgrPutToken(fm, ob_size);
  FrameMgrPutToken(fm, contents);

  FrameMgrFree(fm);

  *buf_size = total_size;
  return buffer;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::destroy_ic ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 559 of file IIIMPClientDispatcher.cpp.

                                                                     {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_destroyic_fr[], im_destroyic_reply_fr[];
  XimFrameRec *input_fr = im_destroyic_fr;
  XimFrameRec *output_fr = im_destroyic_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD16 input_method_id, input_context_id;
  const int IM_OUTPUT_REPLY = IM_DESTROYIC_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  InputContext *ic = &(input_context_list.getItem(input_context_id));
  input_context_list.remove(ic);
  if (ic) {
    iiim_protocol->proto_handler->DestroyIC((InputContext*)ic);
  } else { 
    // need to treate as an error
  }

#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, input_context_id, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, input_context_id,
              output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */
  if (ic) {
    ((IIIMPInputContext*)ic)->unrealize();
    // ic should be deleted by DESTROY_IC request from IM client
    delete ic;
  }
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::dis_connect ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 407 of file IIIMPClientDispatcher.cpp.

                                                                      {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char data[4 + 2 + 2];
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_disconnect_fr[], im_disconnect_reply_fr[];
  XimFrameRec *input_fr = im_disconnect_fr;
  XimFrameRec *output_fr = im_disconnect_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD16 input_method_id;
  const int IM_OUTPUT_REPLY = IM_DISCONNECT_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    ptr = (data + 4);
    req_put16(ptr, input_method_id);
    req_put16(ptr, 0);
  } else {
    req_get16s(ptr, input_method_id);
    ptr = (data + 4);
    req_put16s(ptr, input_method_id);
    req_put16s(ptr, 0);
  }
  send_message(IM_OUTPUT_REPLY, data, (sizeof (data)));

#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);
  /* get data */
  FrameMgrGetToken(fm, input_method_id);

  /* free FrameMgr */
  FrameMgrFree(fm);

  /* create FrameMgr */
  fm = FrameMgrInit(output_fr, NULL, need_swap);
                  
  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size, 0);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, input_method_id);
  send_message(IM_OUTPUT_REPLY, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::dispatch ( unsigned char *  p,
int &  flag 
) [private]

Definition at line 335 of file IIIMPClient.cpp.

                                                 {
  IMProtocolStruct call_data;
  IIimpProtoHdr *hdr = (IIimpProtoHdr*)p;
  unsigned char *p1 = (unsigned char *)(hdr + 1);
  if (hdr == (IIimpProtoHdr*)NULL) return;

  memset(&call_data, 0, sizeof(IMProtocolStruct));

  call_data.major_code = hdr->opcode;

  switch (call_data.major_code) {
  case IM_CONNECT:
    connect(&call_data, p1);
    break;
  case IM_DISCONNECT:
    dis_connect(&call_data, p1);
    break;
  case IM_SETIMVALUES:
    set_imvalues(&call_data, p1);
    break;
  case IM_GETIMVALUES:
    get_imvalues(&call_data, p1);
    break;
  case IM_CREATEIC:
    create_ic(&call_data, p1);
    break;
  case IM_SETICVALUES:
    set_icvalues(&call_data, p1);
    break;
  case IM_GETICVALUES:
    get_icvalues(&call_data, p1);
    break;
  case IM_SETICFOCUS:
    set_icfocus(&call_data, p1);
    break;
  case IM_UNSETICFOCUS:
    unset_icfocus(&call_data, p1);
    break;
  case IM_DESTROYIC:
    destroy_ic(&call_data, p1);
    break;
  case IM_RESETIC:
    reset_ic(&call_data, p1);
    break;
  case IM_FORWARD_EVENT:
    forward_event(&call_data, p1);
    break;
  case IM_TRIGGER_NOTIFY:
    trigger_notify(&call_data, p1);
    break;
  case IM_PREEDIT_START_REPLY:
    preedit_start_reply(&call_data, p1);
    break;
  case IM_PREEDIT_CARET_REPLY:
    preedit_caret_reply(&call_data, p1);
    break;
  case IM_AUX_SETVALUES:
    aux_set_values(&call_data, p1);
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 419 of file IIIMPClientCB.cpp.

                                                           {
#if !defined(USE_FRAMEMGR_ALWAYS)
  const int total_size = (4 + 2 + 2 + 4 + 4 + ((4 * 4) * 1));
  char data[total_size];
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_forward_event_keyevent_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id); 
    req_put16(ptr, event_CB->icid);
    req_put32(ptr, 2);             /* KEYEVENT type = #02 */
    req_put32(ptr, 16);            /* one KEYEVENT */
    req_put32(ptr, event_CB->event->keyCode);
    req_put32(ptr, event_CB->event->keyChar);
    req_put32(ptr, event_CB->event->modifier);
    req_put32(ptr, event_CB->event->time_stamp);
  } else {
    req_put16s(ptr, im_id); 
    req_put16s(ptr, event_CB->icid);
    req_put32s(ptr, 2);            /* KEYEVENT type = #02 */
    req_put32s(ptr, 16);    /* one KEYEVENT */
    req_put32s(ptr, event_CB->event->keyCode);
    req_put32s(ptr, event_CB->event->keyChar);
    req_put32s(ptr, event_CB->event->modifier);
    req_put32s(ptr, event_CB->event->time_stamp);
  }
  send_message(IM_FORWARD_EVENT, data, (sizeof (data)));
#else /* USE_FRAMEMGR_ALWAYS */
  fm = FrameMgrInit(im_forward_event_keyevent_fr, NULL, need_swap);

  int iter_count = 1;
  FrameMgrSetIterCount(fm, iter_count);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, event_CB->icid);
  int type = 2; /* KEYEVENT type = #02 */
  FrameMgrPutToken(fm, type);

  IMKeyEventStruct *key = event_CB->event;
  FrameMgrPutToken(fm, key->keyCode);
  FrameMgrPutToken(fm, key->keyChar);
  FrameMgrPutToken(fm, key->modifier);
  FrameMgrPutToken(fm, key->time_stamp);

  send_message(IM_FORWARD_EVENT, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::forward_event ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 794 of file IIIMPClientDispatcher.cpp.

                                                                        {
#if !defined(USE_FRAMEMGR_ALWAYS)
  unsigned char * pp;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_forward_event_fr[];
  extern XimFrameRec im_forward_event_reply_fr[];
  XimFrameRec *output_fr = im_forward_event_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD16 input_method_id, input_context_id;
  CARD32 type;
  const int IM_OUTPUT_REPLY = IM_FORWARD_EVENT_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  pp = p;
  if (False == need_swap) {
    req_get16(pp, input_method_id);
    req_get16(pp, input_context_id);
    req_get32(pp, type);
  } else {
    req_get16s(pp, input_method_id);
    req_get16s(pp, input_context_id);
    req_get32s(pp, type);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_forward_event_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);
  FrameMgrGetToken(fm, type);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  switch (type) {
  case FORWARD_STRING:
    forward_string(call_data, p);
    break;
  case FORWARD_TEXT:
    forward_text(call_data, p);
    break;
  case FORWARD_KEYEVENT:
    forward_keyevent(call_data, p);
    break;
  }

  /* always send a syncroneous reply */
#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, input_context_id, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, input_context_id,
              output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

void IIIMPClient::forward_keyevent ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 665 of file IIIMPClientDispatcher.cpp.

                                                                           {
#if !defined(USE_FRAMEMGR_ALWAYS)
  IMKeyEventStruct *imkev;
  int n_key;
  int i;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  FmStatus status;
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD16 input_method_id, input_context_id;
  CARD32 type, byte_length;
  CARD32 *keyevent_list = (CARD32*)0;
  int number;

#if !defined(USE_FRAMEMGR_ALWAYS)
  if (False == need_swap) {
    req_get16(p, input_method_id);
    req_get16(p, input_context_id);
    req_get32(p, type);
    req_get32(p, byte_length);
    if (0 == byte_length) return;
    n_key = (byte_length / (4 * (sizeof (CARD32))));
    imkev = new IMKeyEventStruct[n_key];
    if (NULL == imkev) return;
    for (i = 0; i < n_key; i++) {
      req_get32(p, (imkev + i)->keyCode);
      req_get32(p, (imkev + i)->keyChar);
      req_get32(p, (imkev + i)->modifier);
      req_get32(p, (imkev + i)->time_stamp);
    }
  } else {
    req_get16s(p, input_method_id);
    req_get16s(p, input_context_id);
    req_get32s(p, type);
    req_get32s(p, byte_length);
    if (0 == byte_length) return;
    n_key = (byte_length / (4 * (sizeof (CARD32))));
    imkev = new IMKeyEventStruct[n_key];
    if (NULL == imkev) return;
    for (i = 0; i < n_key; i++) {
      req_get32s(p, (imkev + i)->keyCode);
      req_get32s(p, (imkev + i)->keyChar);
      req_get32s(p, (imkev + i)->modifier);
      req_get32s(p, (imkev + i)->time_stamp);
    }
  }

  InputContext *ic = &(input_context_list.getItem(input_context_id));

  if (NULL == ic) {
    delete [] imkev;
    return;
  }

  IMKeyListEvent keylist_event;
  keylist_event.type = IM_EventKeyList;
  keylist_event.n_operation = 0;
  keylist_event.operation_list = 0;
  keylist_event.n_key = n_key;
  keylist_event.keylist = imkev;

  iiim_protocol->proto_handler->ForwardEvent((InputContext*)ic,
                                        (IMInputEvent*)&keylist_event);
  delete [] imkev;

  return;

#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_forward_event_keyevent_fr[];
  XimFrameRec *input_fr = im_forward_event_keyevent_fr;

  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);
  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);
  FrameMgrGetToken(fm, type);

  FrameMgrGetToken(fm, byte_length);

  keyevent_list = (CARD32*)new char[byte_length];
  if (keyevent_list == NULL) {
    return;
  }
  if (byte_length != 0) {
    number = 0;
    while (FrameMgrIsIterLoopEnd(fm, &status) == False) {
      /* get a key event */
      FrameMgrGetToken(fm, keyevent_list[number]);
      number++;
    }
  }

  /* free FrameMgr */
  FrameMgrFree(fm);

  InputContext *ic = &(input_context_list.getItem(input_context_id));

  if (ic) {
    IMKeyListEvent keylist_event;
    keylist_event.type = IM_EventKeyList;
    keylist_event.n_operation = 0;
    keylist_event.operation_list = 0;

    int n_key = byte_length/(4 * sizeof(CARD32));
    IMKeyEventStruct *imkev = new IMKeyEventStruct[n_key];

    keylist_event.n_key = n_key;
    int n = 0;
    number = 0;
    while (number < byte_length/4) { 
      imkev[n].keyCode = keyevent_list[number]; /* keyCode */
      imkev[n].keyChar = keyevent_list[number + 1]; /* keyChar */
      imkev[n].modifier = keyevent_list[number + 2]; /* modifier */
      imkev[n].time_stamp = keyevent_list[number + 3]; /* time_stamp */
      number += 4; n++;
    }
    keylist_event.keylist = imkev;
    iiim_protocol->proto_handler->ForwardEvent((InputContext*)ic,
                                   (IMInputEvent*)&keylist_event);
    delete [] imkev;
  } else {
    // need to treate as an error
  }
  delete [] keyevent_list;
  return;
#endif /* USE_FRAMEMGR_ALWAYS */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::forward_string ( IMProtocolStruct ,
unsigned char *   
) [inline, private]

Definition at line 273 of file IIIMPClient.hh.

{}

Here is the caller graph for this function:

void IIIMPClient::forward_text ( IMProtocolStruct ,
unsigned char *   
) [inline, private]

Definition at line 274 of file IIIMPClient.hh.

{}

Here is the caller graph for this function:

void IIIMPClient::free_icvalues ( IMProtocolStruct call_data) [private]

Definition at line 460 of file IIIMPClientDispatcher2.cpp.

                                                      {
  IMChangeICStruct *changeic = (IMChangeICStruct*)&call_data->changeic;

  for (ICAttribute *icp = changeic->ic_attr;
       icp < &changeic->ic_attr[changeic->ic_attr_num]; icp++) {
    delete icp->value;
  }
  delete [] changeic->ic_attr;
  return;
}

Here is the caller graph for this function:

unsigned char * IIIMPClient::get_amessage ( ) [private]

Definition at line 305 of file IIIMPClient.cpp.

                          {
  IIimpProtoHdr hdr;
  int header_len = sizeof(IIimpProtoHdr);

  if (header_len != read_data((char *)&hdr, header_len)) {
    delete accept_fd;
    im_id = 0;
    accept_fd = 0;
    return (unsigned char *)NULL;
  }
  return get_content((char*)&hdr, False);
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char * IIIMPClient::get_content ( char *  packet_header,
int  isConnect 
) [private]

Definition at line 241 of file IIIMPClient.cpp.

                                                           {
#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_packet_header_fr[];
  FrameMgr fm;
#endif /* USE_FRAMEMGR_ALWAYS */
  int total_size;
  unsigned char opcode;
  unsigned char length[3];
  unsigned int data_length = 0;

#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
  ptr = packet_header;
  total_size = 4;
  /* byte swap is not required */
  req_get8(ptr, opcode);
  req_get8(ptr, length[2]);
  req_get8(ptr, length[1]);
  req_get8(ptr, length[0]);
#else /* USE_FRAMEMGR_ALWAYS */
  fm = FrameMgrInit(im_packet_header_fr, (char *)packet_header, need_swap);
  total_size = FrameMgrGetTotalSize(fm);
  /* get data */
  FrameMgrGetToken(fm, opcode);
  FrameMgrGetToken(fm, length[2]);
  FrameMgrGetToken(fm, length[1]);
  FrameMgrGetToken(fm, length[0]);
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  /* calculate length */
  data_length  = (length[2] << 16);
  data_length += (length[1] << 8);
  data_length += length[0];

  unsigned char *p = new unsigned char[total_size + data_length * 4];
  unsigned char *pp = p;
  *pp++ = opcode;
  *pp++ = length[2]; *pp++ = length[1]; *pp++ = length[0];

  if (!isConnect) {
    if (data_length > 0) {
      if ((data_length * 4) != read_data((char *)pp, data_length * 4)) {
       goto read_error;
      }
    }
  } else {
    *pp++ = byteOrder;
    const int to_be_read = data_length * 4 - sizeof(char);
    if (to_be_read != read_data((char *)pp, to_be_read)) {
      goto read_error;
    }
  }
  return (unsigned char *)p;
 read_error:
  delete accept_fd;
  im_id = 0;
  accept_fd = 0;
  return (unsigned char *)NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ICAttribute * IIIMPClient::get_icattr ( unsigned short *  attrID_list,
int  number 
) [private]

Definition at line 650 of file IIIMPClientDispatcher2.cpp.

                                                       {
  ICAttribute *attr_list;
  IMAttr *ic_attr = iiim_protocol->get_icattr();

  attr_list = new ICAttribute[number];
  if (attr_list = NULL)
    return NULL;
  memset(attr_list, 0, sizeof(ICAttribute) * number);

  ICAttribute *attrp;
  CARD16 *idp;
  for (attrp = attr_list, idp = attrID_list;
       attrp < &attr_list[number] && idp < &attrID_list[number];
       attrp++, idp++) {
    for (IMAttr *icp = ic_attr;
        icp < &ic_attr[iiim_protocol->count_icattr()]; icp++) {
      if (icp->attribute_id == *idp) {
       attrp->attribute_id = icp->attribute_id;
       attrp->name_length = icp->length;
       attrp->name = icp->name;
       attrp->type = icp->type;
      }
    }
  }
  return attr_list;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::get_icvalues ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 678 of file IIIMPClientDispatcher2.cpp.

                                                                       {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
  char *data;
  int total_size;
  int attr_size;
  int i;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  FmStatus status;
#endif /* USE_FRAMEMGR_ALWAYS */
  IMChangeICStruct *getic = (IMChangeICStruct*)&call_data->changeic;
  CARD16 input_method_id, input_context_id;
  CARD16 byte_length;
  CARD16 *attrID_list = NULL;
  int number;
  int iter_count;
  ICAttribute *ic_attr = NULL;

#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_geticvalues_fr[], im_geticvalues_reply_fr[];
  XimFrameRec *input_fr = im_geticvalues_fr;
  XimFrameRec *output_fr = im_geticvalues_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  const int IM_OUTPUT_REPLY = IM_GETICVALUES_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
    req_get16(ptr, byte_length);
    if (byte_length != 0) {
      attrID_list = (CARD16*)new char[byte_length];
      number = (byte_length / 2);
      for (i = 0; i < number; i++) {
       req_get16(ptr, *(attrID_list + i));
      }
      ic_attr = get_icattr(attrID_list, number);
      if (ic_attr == NULL) {
       delete [] attrID_list;
       return;
      }
    }
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
    req_get16s(ptr, byte_length);
    if (byte_length != 0) {
      attrID_list = (CARD16*)new char[byte_length];
      number = (byte_length / 2);
      for (i = 0; i < number; i++) {
       req_get16s(ptr, *(attrID_list + i));
      }
      ic_attr = get_icattr(attrID_list, number);
      if (ic_attr == NULL) {
       delete [] attrID_list;
       return;
      }
    }
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);
  FrameMgrGetToken(fm, byte_length);

  if (byte_length != 0) {
    attrID_list = (CARD16*)new char[byte_length];

    number = 0;
    while (FrameMgrIsIterLoopEnd(fm, &status) == False) {
      FrameMgrGetToken(fm, attrID_list[number]);
      number++;
    }
    /* free FrameMgr */
    FrameMgrFree(fm);

    ic_attr = get_icattr(attrID_list, number);
    if (ic_attr == NULL) {
      return;
    }
  }
#endif /* USE_FRAMEMGR_ALWAYS */
  getic->preedit_attr_num = 0; /* no preedit attributes */
  getic->status_attr_num = 0;      /* no status attributes */
  getic->ic_attr_num = (CARD16)number;
  getic->preedit_attr = NULL;
  getic->status_attr = NULL;
  getic->ic_attr = ic_attr;

  InputContext *ic = &(input_context_list.getItem(input_context_id));
  if (ic) {
    iiim_protocol->proto_handler->GetICValues((InputContext*)ic, 0, 0);
  } else {
    // need to treate as an error
  }

  iter_count = getic->ic_attr_num;

#if !defined(USE_FRAMEMGR_ALWAYS)
  total_size = 4;
  total_size += (2 + 2);
  total_size += 2;
  attr_size = 0;
  for (i = 0; i < iter_count; i++) {
    attr_size += icattr_size(ic_attr + i);
  }
  total_size += 2; /* padding */
  data = new char[total_size];
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, input_method_id);
    req_put16(ptr, input_context_id);
    ptr = req_put_icattr_list(ptr, ic_attr, number);
    req_put16(ptr, 0);
  } else {
    req_put16s(ptr, input_method_id);
    req_put16s(ptr, input_context_id);
    ptr = req_put_icattr_list_s(ptr, ic_attr, number);
    req_put16s(ptr, 0);
  }

  send_message(IM_OUTPUT_REPLY, data, total_size);

  delete [] data;
  delete [] ic_attr;
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(output_fr, NULL, need_swap);
       
  /* set iteration count for list of ic_attribute */
  FrameMgrSetIterCount(fm, iter_count);

  /* set length of BARRAY item in xicattribute_fr*/
  ICAttribute *attrp;
  for (attrp = ic_attr;
       attrp < &ic_attr[getic->ic_attr_num]; attrp++) {
    FrameMgrSetSize(fm, attrp->value_length);
  }

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, input_method_id);
  FrameMgrPutToken(fm, input_context_id);

  for (attrp = ic_attr;
       attrp < &ic_attr[getic->ic_attr_num]; attrp++) {
    FrameMgrPutToken(fm, attrp->attribute_id);
    FrameMgrPutToken(fm, attrp->value_length);
    FrameMgrPutToken(fm, attrp->value);
  }

  send_message(IM_OUTPUT_REPLY, reply, total_size);

  delete [] ic_attr;

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char * IIIMPClient::get_im_connect ( ) [private]

Definition at line 209 of file IIIMPClient.cpp.

                            {
  IIimpProtoHdr hdr;
  int header_len = sizeof(IIimpProtoHdr);
#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_packet_header_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */

  while (1) {
    if (header_len != read_data((char *)&hdr, header_len)) {
      goto read_error;
    }
    if (hdr.opcode != IM_CONNECT) {
      // can do nothing
      continue;
    }
    int read_len;
    if ((read_len = read_data((char *)&byteOrder, sizeof(char)))
       != sizeof(char)) {
      goto read_error;
    }
    need_swap = (byteOrder != iiim_protocol->byteOrder());
    return get_content((char*)&hdr, True);
  }
 read_error:
  delete accept_fd;
  im_id = 0;
  accept_fd = 0;
  return (unsigned char *)NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::get_imvalues ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 694 of file IIIMPClientDispatcher3.cpp.

                                                                       {
  CARD16 input_method_id;
  CARD16 byte_length;
  FrameMgr fm;
  FmStatus status;

  extern XimFrameRec im_getimvalues_fr[], im_getimvalues_reply_fr[];
  XimFrameRec *input_fr = im_getimvalues_fr;
  XimFrameRec *output_fr = im_getimvalues_reply_fr;
  const int IM_OUTPUT_REPLY = IM_GETIMVALUES_REPLY;

  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, byte_length);

  CARD16 *attrID_list = NULL;
  int number = 0;
  if (byte_length != 0) {
    attrID_list = (CARD16*)new char[byte_length];
    while (FrameMgrIsIterLoopEnd(fm, &status) == False) {
      FrameMgrGetToken(fm, attrID_list[number]);
      number++;
    }
  }
  /* free FrameMgr */
  FrameMgrFree(fm);


  ICAttribute *im_attr = new ICAttribute[number];
  int i;
  IMObjectDescriptorStruct *od = &(iiim_protocol->getFirstObjectDescriptor());
  memset(im_attr, 0, sizeof(ICAttribute) * number);
  while (od) {
    for (i = 0; i < number; i++) {
      if (im_attr[i].attribute_id) break;
      if (attrID_list[i] == od->id) {
       im_attr[i].attribute_id = od->id;
       char *contents = 0;
       int ob_size = 0;
       unsigned int buf_size;
       unsigned char *buffer;

       switch (od->type) {
       case IM_DOWNLOADINGOBJECT_JARGUI_TYPE:
       case IM_DOWNLOADINGOBJECT_JARLWE_TYPE:
         contents = read_object(od->path, &ob_size);
         buffer = create_jarfile_object_frame(od, contents, ob_size,
                                          &buf_size);
         im_attr[i].value_length = buf_size;
         im_attr[i].value = (void*)buffer;
         delete [] contents;
         break;
       case IM_DOWNLOADINGOBJECT_CCDEF_TYPE:
         contents = read_ccdef(od->path, od->basepath, &ob_size);
         buffer = create_ccdef_object_frame(od, contents, ob_size,
                                        &buf_size);
         im_attr[i].value_length = buf_size;
         im_attr[i].value = (void*)buffer;
         delete [] contents;
         break;
       case IM_DOWNLOADINGOBJECT_BINGUI_TYPE:
       case IM_DOWNLOADINGOBJECT_BINLWE_TYPE:
         buffer = create_binfile_object_frame(od, &buf_size);
         im_attr[i].value_length = buf_size;
         im_attr[i].value = (void*)buffer;
         delete [] contents;
         break;
       case IM_DOWNLOADINGOBJECT_SGUI_TYPE:
       case IM_DOWNLOADINGOBJECT_SLWE_TYPE:
       default:
         break;
       }
       break;
      }
      
    }
    od = &(iiim_protocol->getNextObjectDescriptor());
  }
  send_imvalues_message(input_method_id, IM_GETIMVALUES_REPLY,
                     im_attr, number);
  ICAttribute *attrp;
  for (attrp = im_attr; attrp < &im_attr[number]; attrp++) {
    delete attrp->value;
  }
  delete [] attrID_list;
  delete [] im_attr;
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 81 of file IIIMPClient.hh.

{return application_name;}

Here is the caller graph for this function:

int IIIMPClient::getICID ( InputContext ic) [inline]

Definition at line 117 of file IIIMPClient.hh.

                                {
    return input_context_list.getIndex(ic);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const CompoundString& IIIMPClient::getOSArch ( ) const [inline]

Definition at line 83 of file IIIMPClient.hh.

{return os_arch;}

Here is the caller graph for this function:

const CompoundString& IIIMPClient::getOSName ( ) const [inline]

Definition at line 82 of file IIIMPClient.hh.

{return os_name;}

Here is the caller graph for this function:

const CompoundString& IIIMPClient::getOSVersion ( ) const [inline]

Definition at line 84 of file IIIMPClient.hh.

{return os_version;}

Here is the caller graph for this function:

const CompoundString& IIIMPClient::getUser ( ) const [inline]

Definition at line 78 of file IIIMPClient.hh.

{return username;}

Here is the caller graph for this function:

Definition at line 86 of file IIIMPClient.hh.

{return xDisplayName;}

Here is the caller graph for this function:

const CompoundString& IIIMPClient::getXServerVendor ( ) const [inline]

Definition at line 87 of file IIIMPClient.hh.

{return xServerVendor;}

Here is the caller graph for this function:

int IIIMPClient::icattr_list_count ( char *  p) [private]

Definition at line 58 of file IIIMPClientDispatcher2.cpp.

                                       {
  char *ptr;
  CARD32 icattr_list_size; 
  int num;
  CARD16 icattr_size;

  num = 0;
  ptr = p;
  if (False == need_swap) {
    req_get16(ptr, icattr_list_size);
    if (icattr_list_size & 0x03) {
      icattr_list_size = ((icattr_list_size & (~0x03)) + 4);
    }

    while (4 <= icattr_list_size) {
      ptr += 2;                           /* skip attribute id */
      req_get16(ptr, icattr_size);
      icattr_list_size -= 4;
      if (icattr_size & 0x03) {           /* padding */
       icattr_size = ((icattr_size & (~0x03)) + 4);
      }
      if (icattr_list_size < icattr_size) {
       icattr_size = icattr_list_size;
      }

      ptr += icattr_size;
      icattr_list_size -= icattr_size;
      num += 1;
    }
  } else {
    req_get16s(ptr, icattr_list_size);
    if (icattr_list_size & 0x03) {
      icattr_list_size = ((icattr_list_size & (~0x03)) + 4);
    }

    while (4 <= icattr_list_size) {
      ptr += 2;                           /* skip attribute id */
      req_get16s(ptr, icattr_size);
      icattr_list_size -= 4;
      if (icattr_size & 0x03) {           /* padding */
       icattr_size = ((icattr_size & (~0x03)) + 4);
      }
      if (icattr_list_size < icattr_size) {
       icattr_size = icattr_list_size;
      }

      ptr += icattr_size;
      icattr_list_size -= icattr_size;
      num += 1;
    }
  }
  return num;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::icattr_size ( ICAttribute icattr) [private]

Definition at line 113 of file IIIMPClientDispatcher2.cpp.

                                             {
  int size;
  size = 2;          /* attribute id */
  size += 2;         /* byte length of value */
  if (NULL != icattr) {
    size += icattr->value_length;
  }
  if (size & 0x03) { /* padding */
    size = ((size & (~0x03)) + 4);
  }
  return size;
}

Here is the caller graph for this function:

int IIIMPClient::imtext_size ( IMText text) [private]

Definition at line 53 of file IIIMPClientCB.cpp.

                                     {
  IMFeedbackList *feedback;
  IMAnnotation *ann;
  int size;
  int i;

  if (NULL == text) {
    return (4 + 4);
  }
  size = 0;
  size += 4;  /* byte length of list of char_with_feedback */
  for (i = 0; i < text->char_length; i++) {
    feedback = (text->feedback + i);
    size += 2;       /* character element */
    size += 2;       /* byte length of Feedback attribute array */
    size += (8 * feedback->count_feedbacks);     /* feedback */
  }
  size += 4;  /* byte length of list of annotation */
  for (i = 0; i < text->count_annotations; i++) {
    ann = (text->annotations + i);
    size += 4;       /* attribute ID */
    size += 4;       /* byte length of list of annotation value */
    size += 4;       /* start index */
    size += 4;       /* byte length of value */
    if (ann->value.len & 0x03) {
      size += ((ann->value.len & (~0x03)) + 4);
    } else {
      size += ann->value.len;
    }
  }
  return size;
}

Here is the caller graph for this function:

Definition at line 1525 of file IIIMPClientCB.cpp.

                                                        {
#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(im_id, lookup_CB->icid, IM_LOOKUP_DONE);
#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_lookup_done_fr[];
  send_message(im_id, lookup_CB->icid,
              im_lookup_done_fr, IM_LOOKUP_DONE);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1207 of file IIIMPClientCB.cpp.

                                                        {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *data;
  char *ptr;
  int total_size;
  int choice_list_size;
  int label_list_size;
  int title_size;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_lookup_draw_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMLookupDrawCallbackStruct *draw =
    (IMLookupDrawCallbackStruct *)&lookup_CB->lookup->todo.draw;
  int i, j;

#if !defined(USE_FRAMEMGR_ALWAYS)
  choice_list_size = 0;
  for (i = 0; i < draw->n_choices; i++) {  /* choice list */
    choice_list_size += imtext_size((draw->choices + i)->value);
  }
  label_list_size = 0;
  if (NULL != draw->choices->label) {     /* index label list */
    for (i = 0; i < draw->n_choices; i++) {
      label_list_size += imtext_size((draw->choices + i)->label);
    }
  }
  title_size = imtext_size(draw->title);  /* title */

  total_size = 4;    /* IIIMP header */
  total_size += (2 + 2);
  total_size += 4;   /* index of first candidate */
  total_size += 4;   /* index of last candidate */
  total_size += 4;   /* index of current candidate */
  total_size += 4;   /* byte length of choice list */
  total_size += choice_list_size;  /* choice list */
  total_size += 4;   /* byte length of index label list */
  total_size += label_list_size;   /* index label list */
  total_size += title_size;        /* title */

  data = new char[total_size];
  ptr = (data + 4);

  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, lookup_CB->icid);
    req_put32(ptr, draw->index_of_first_candidate);
    req_put32(ptr, draw->index_of_last_candidate);
    req_put32(ptr, draw->index_of_current_candidate);
    req_put32(ptr, choice_list_size);
    for (i = 0; i < draw->n_choices; i++) {  /* choice list */
      ptr = req_put_imtext(ptr, (draw->choices + i)->value);
    }
    req_put32(ptr, label_list_size);
    for (i = 0; i < draw->n_choices; i++) {  /* choice list */
      ptr = req_put_imtext(ptr, (draw->choices + i)->label);
    }
    ptr = req_put_imtext(ptr, draw->title);
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, lookup_CB->icid);
    req_put32s(ptr, draw->index_of_first_candidate);
    req_put32s(ptr, draw->index_of_last_candidate);
    req_put32s(ptr, draw->index_of_current_candidate);
    req_put32s(ptr, choice_list_size);
    for (i = 0; i < draw->n_choices; i++) {  /* choice list */
      ptr = req_put_imtext_s(ptr, (draw->choices + i)->value);
    }
    req_put32s(ptr, label_list_size);
    for (i = 0; i < draw->n_choices; i++) {  /* choice list */
      ptr = req_put_imtext_s(ptr, (draw->choices + i)->label);
    }
    ptr = req_put_imtext_s(ptr, draw->title);
  }

  send_message(IM_LOOKUP_DRAW, data, total_size);

  delete [] data;

#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_lookup_draw_fr, NULL, need_swap);

  FrameMgrSetIterCount(fm, draw->n_choices);

  /* set iteration count for choice list */
  IMChoiceObject *choicep;
  for (choicep = draw->choices;
       choicep < &draw->choices[draw->n_choices]; choicep++) {
    FrameMgrSetIterCount(fm, choicep->value->char_length);
    for (i = 0; i < choicep->value->char_length; i++) {
      IMFeedbackList *fbl = &(choicep->value->feedback[i]);
      // set iteration count for list of feedback
      FrameMgrSetIterCount(fm, fbl->count_feedbacks);
    }
  }

  /* set iteration count for index label list */
  if (draw->choices->label == 0) {
    FrameMgrSetIterCount(fm, 0); /* no label strings */
  } else {
    FrameMgrSetIterCount(fm, draw->n_choices);
    for (choicep = draw->choices;
        choicep < &draw->choices[draw->n_choices]; choicep++) {
      FrameMgrSetIterCount(fm, choicep->label->char_length);
      for (i = 0; i < choicep->label->char_length; i++) {
       IMFeedbackList *fbl = &(choicep->label->feedback[i]);
       // set iteration count for list of feedback
       FrameMgrSetIterCount(fm, fbl->count_feedbacks);
      }
    }
  }

  if (draw->title == 0) {
    FrameMgrSetIterCount(fm, 0); /* no title */
  } else {
    FrameMgrSetIterCount(fm, draw->title->char_length);
    /* set iteration count for title */
    for (i = 0; i < draw->title->char_length; i++) {
      IMFeedbackList *fbl = &(draw->title->feedback[i]);
      // set iteration count for list of feedback
      FrameMgrSetIterCount(fm, fbl->count_feedbacks);
    }
  }

  /* get total_size */
  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, lookup_CB->icid);
  FrameMgrPutToken(fm, draw->index_of_first_candidate);
  FrameMgrPutToken(fm, draw->index_of_last_candidate);
  FrameMgrPutToken(fm, draw->index_of_current_candidate);

  /* choice list */
  UTFCHAR *utf_chars;
  for (choicep = draw->choices;
       choicep < &draw->choices[draw->n_choices]; choicep++) {
    if (choicep->value->encoding == UTF16_CODESET) {
      utf_chars = choicep->value->text.utf_chars;
    } else {
#ifdef DEBUG
      // cerr << "need to do convertion" << endl;
#endif
      utf_chars = 0;
    }
    CARD8 first_byte, second_byte;
    CARD8 *utf_str = (CARD8*)utf_chars;
    CARD8 *strp = utf_str;

    for (i = 0; i < choicep->value->char_length; i++) {
      if (need_swap) {
       second_byte = *strp++;
       first_byte = *strp++;
      } else {
       first_byte = *strp++;
       second_byte = *strp++;
      }
      FrameMgrPutToken(fm, first_byte);
      FrameMgrPutToken(fm, second_byte);

      if (choicep->value != NULL) {
       IMFeedbackList *fbl = &(choicep->value->feedback[i]);
       for (j = 0; j < fbl->count_feedbacks; j++){
         IMFeedback *fb = &(fbl->feedbacks[j]);
         FrameMgrPutToken(fm, fb->type);
         FrameMgrPutToken(fm, fb->value);
       }
      }
    }
    int annotation_len = 0;
    FrameMgrPutToken(fm, annotation_len); /* annotation_len = 0 */
  }

  /* index label list */
  if (draw->choices->label != 0) {
    for (choicep = draw->choices;
        choicep < &draw->choices[draw->n_choices]; choicep++) {
      if (choicep->label->encoding == UTF16_CODESET) {
       utf_chars = choicep->label->text.utf_chars;
      } else {
#ifdef DEBUG
       // cerr << "need to do convertion" << endl;
#endif
       utf_chars = 0;
      }
      CARD8 first_byte, second_byte;
      CARD8 *utf_str = (CARD8*)utf_chars;
      CARD8 *strp = utf_str;
      for (i = 0; i < choicep->label->char_length; i++) {
       if (need_swap) {
         second_byte = *strp++;
         first_byte =  *strp++;
       } else {
         first_byte = *strp++;
         second_byte = *strp++;
       }
       FrameMgrPutToken(fm, first_byte);
       FrameMgrPutToken(fm, second_byte);

       if (choicep->label != NULL) {
         IMFeedbackList *fbl = &(choicep->label->feedback[i]);
         for (j = 0; j < fbl->count_feedbacks; j++){
           IMFeedback *fb = &(fbl->feedbacks[j]);
           FrameMgrPutToken(fm, fb->type);
           FrameMgrPutToken(fm, fb->value);
         }
       }
      }
      int annotation_len = 0;
      FrameMgrPutToken(fm, annotation_len); /* annotation_len = 0 */
    }
  }

  /* title */
  if (draw->title != 0) {
    if (draw->title->encoding == UTF16_CODESET) {
      utf_chars = draw->title->text.utf_chars;
    } else {
#ifdef DEBUG
      // cerr << "need to do convertion" << endl;
#endif
      utf_chars = 0;
    }
    CARD8 first_byte, second_byte;
    CARD8 *utf_str = (CARD8*)utf_chars;
    CARD8 *strp = utf_str;
    for (i = 0; i < draw->title->char_length; i++) {
      if (need_swap) {
       second_byte = *strp++;
       first_byte = *strp++;
      } else {
       first_byte = *strp++;
       second_byte = *strp++;
      }
      FrameMgrPutToken(fm, first_byte);
      FrameMgrPutToken(fm, second_byte);
      if (draw->title != NULL) {
       IMFeedbackList *fbl = &(draw->title->feedback[i]);
       for (j = 0; j < fbl->count_feedbacks; j++){
         IMFeedback *fb = &(fbl->feedbacks[j]);
         FrameMgrPutToken(fm, fb->type);
         FrameMgrPutToken(fm, fb->value);
       }
      }
    }
    int annotation_len = 0;
    FrameMgrPutToken(fm, annotation_len); /* annotation_len = 0 */
  }
  send_message(IM_LOOKUP_DRAW, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1467 of file IIIMPClientCB.cpp.

                                                           {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char data[4 + 2 + 2 + 2 + 2];
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_lookup_process_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMLookupProcessCallbackStruct *process =
    (IMLookupProcessCallbackStruct *)&lookup_CB->lookup->todo.process;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, lookup_CB->icid);
    req_put16(ptr, process->type);
    if (LookupIndex == process->type) {
      req_put16(ptr, process->value.index_of_choice_selected);
    } else {
      req_put16(ptr, process->value.page_operation_id);
    }
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, lookup_CB->icid);
    req_put16s(ptr, process->type);
    if (LookupIndex == process->type) {
      req_put16s(ptr, process->value.index_of_choice_selected);
    } else {
      req_put16s(ptr, process->value.page_operation_id);
    }
  }
  send_message(IM_LOOKUP_PROCESS, data, (sizeof (data)));
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_lookup_process_fr, NULL, need_swap);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, lookup_CB->icid);
  FrameMgrPutToken(fm, process->type);
  if (process->type == LookupIndex)
    FrameMgrPutToken(fm, process->value.index_of_choice_selected);
  else
    FrameMgrPutToken(fm, process->value.page_operation_id);
  send_message(IM_LOOKUP_PROCESS, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1141 of file IIIMPClientCB.cpp.

                                                         {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char data[4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2];
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_lookup_start_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  LayoutInfo *layout = (LayoutInfo *)0;
  IMLookupStartCallbackStruct *start =
    (IMLookupStartCallbackStruct*)&lookup_CB->lookup->todo.start;
  if (start->whoIsMaster == IMIsMaster)
     layout = start->IMPreference;
  else if (start->whoIsMaster == CBIsMaster) 
          layout = start->CBPreference;
       else 
         return False;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, lookup_CB->icid);
    req_put16(ptr, start->whoIsMaster);
    req_put16(ptr, layout->choice_per_window);
    req_put16(ptr, layout->nrows);
    req_put16(ptr, layout->ncolumns);
    req_put16(ptr, layout->drawUpDirection);
    req_put16(ptr, layout->whoOwnsLabel);
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, lookup_CB->icid);
    req_put16s(ptr, start->whoIsMaster);
    req_put16s(ptr, layout->choice_per_window);
    req_put16s(ptr, layout->nrows);
    req_put16s(ptr, layout->ncolumns);
    req_put16s(ptr, layout->drawUpDirection);
    req_put16s(ptr, layout->whoOwnsLabel);
  }
  send_message(IM_LOOKUP_START, data, (sizeof (data)));
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_lookup_start_fr, NULL, need_swap);
              
  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, lookup_CB->icid);
  FrameMgrPutToken(fm, start->whoIsMaster);
  FrameMgrPutToken(fm, layout->choice_per_window);
  FrameMgrPutToken(fm, layout->nrows);
  FrameMgrPutToken(fm, layout->ncolumns);
  FrameMgrPutToken(fm, layout->drawUpDirection);
  FrameMgrPutToken(fm, layout->whoOwnsLabel);

  send_message(IM_LOOKUP_START, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 767 of file IIIMPClientCB.cpp.

                                                            {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char data[4 + 2 + 2 + 4 + 4 + 4];
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_preedit_caret_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMPreeditCaretCallbackStruct *caret =
    (IMPreeditCaretCallbackStruct *)&preedit_CB->preedit->todo.caret;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, preedit_CB->icid);
    req_put32(ptr, caret->position);
    req_put32(ptr, caret->direction);
    req_put32(ptr, caret->style);
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, preedit_CB->icid);
    req_put32s(ptr, caret->position);
    req_put32s(ptr, caret->direction);
    req_put32s(ptr, caret->style);
  }
  send_message(IM_PREEDIT_CARET, data, (sizeof (data)));
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_preedit_caret_fr, NULL, need_swap);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, preedit_CB->icid);
  FrameMgrPutToken(fm, caret->position);
  FrameMgrPutToken(fm, caret->direction);
  FrameMgrPutToken(fm, caret->style);

  send_message(IM_PREEDIT_CARET, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::preedit_caret_reply ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 956 of file IIIMPClientDispatcher.cpp.

                                               {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_preedit_caret_reply_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMPreeditStruct preedit;
  IMPreeditCaretCallbackStruct *caret =
    (IMPreeditCaretCallbackStruct *)&preedit.todo.caret;
  CARD16 input_method_id, input_context_id;
  int caret_position;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
    req_get16(ptr, caret_position);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
    req_get16s(ptr, caret_position);
  }
#ifdef DEBUG
  // cerr << "Preedit Caret CB reply" << endl;
  // cerr << "need to set caret_position to preedit rendering object" << endl;
#endif
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_preedit_caret_reply_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);
  FrameMgrGetToken(fm, caret_position);

#ifdef DEBUG
  // cerr << "Preedit Caret CB reply" << endl;
  // cerr << "need to set caret_position to preedit rendering object" << endl;
#endif

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 816 of file IIIMPClientCB.cpp.

                                                           {
#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(im_id, preedit_CB->icid, IM_PREEDIT_DONE);
#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_preedit_done_fr[];
  send_message(im_id, preedit_CB->icid,
              im_preedit_done_fr, IM_PREEDIT_DONE);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 754 of file IIIMPClientCB.cpp.

                                                           {
  IMPreeditDrawCallbackStruct *draw =
    (IMPreeditDrawCallbackStruct *)&preedit_CB->preedit->todo.draw;
  int ret;

  if (draw->text == NULL || draw->text->char_length == 0) {
    ret = preedit_erase_text(preedit_CB);
  } else {
    ret = preedit_draw_text(preedit_CB);
  }
  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::preedit_draw_text ( IMPreeditCBStruct preedit_CB) [private]

Definition at line 558 of file IIIMPClientCB.cpp.

                                                                {
#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_preedit_draw_text_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMPreeditDrawCallbackStruct *draw =
    (IMPreeditDrawCallbackStruct *)&preedit_CB->preedit->todo.draw;
  IMText *text = draw->text;
  int i, j;

  if (text->char_length == 0) {
    return True;     /* no string to draw */
  }

#if !defined(USE_FRAMEMGR_ALWAYS)
  int text_length = text->char_length;
  UTFCHAR *utf_chars;

  if (text->encoding == UTF16_CODESET) {
    utf_chars = text->text.utf_chars;
    if (*utf_chars == 0xfffe || *utf_chars == 0xfeff) {
      utf_chars++;
      text_length -= 1;
    }
  } else {
    utf_chars = 0;
  }

  /* without FrameMgr */
  int         total_length;
  int         fa_len;
  int         cwf_len;
  int         annotation_len;
  int         contents_type;
  UTFCHAR *   ut;

  total_length = 0;
  fa_len = 0;
  cwf_len = 0;
  annotation_len = 0;
  contents_type = 1;        /* contents type #1 : TEXT */

  total_length += 4;        /* request header */

  total_length += 2;        /* im_id */
  total_length += 2;        /* ic_id */
  total_length += 4;        /* caret */
  total_length += 4;        /* change_first */
  total_length += 4;        /* change_length */

  total_length += 4;        /* contents type */
  total_length += 4;        /* byte length of list of char_with_feedback */
  cwf_len += (2 * text_length);    /* unicode code element */
  cwf_len += (2 * text_length);    /* byte length of Feedback attribute */
                                   /* array */
  for (i = 0; i < text_length; i++) {     /* feedback_attr */
    fa_len += (8 * (text->feedback + i)->count_feedbacks);
  }
  cwf_len += fa_len;

  total_length += cwf_len;

  total_length += 4;        /* byte length of list of annotation */
  total_length += 0;        /* annotation is not supported yet */

  char * request = new char[total_length];
  char * p;

  p = (request + 4);

  if (False == need_swap) {
    req_put16(p, im_id);
    req_put16(p, preedit_CB->icid);
    req_put32(p, draw->caret);
    req_put32(p, draw->chg_first);
    req_put32(p, draw->chg_length);
    req_put32(p, contents_type);
    req_put32(p, cwf_len);
    for (i = 0, ut = utf_chars; i < text_length; i++, ut++) {
      int cf;
      req_put16(p, *ut);
      cf = (text->feedback + i)->count_feedbacks;
      req_put16(p, (8 * cf));
      for (j = 0; j < cf; j++) {
       req_put32(p, ((text->feedback + i)->feedbacks + j)->type);
       req_put32(p, ((text->feedback + i)->feedbacks + j)->value);
      }
    }
    req_put32(p, annotation_len);  /* annotation is not supported yet */
  } else {
    req_put16s(p, im_id);
    req_put16s(p, preedit_CB->icid);
    req_put32s(p, draw->caret);
    req_put32s(p, draw->chg_first);
    req_put32s(p, draw->chg_length);
    req_put32s(p, contents_type);
    req_put32s(p, cwf_len);
    for (i = 0, ut = utf_chars; i < text_length; i++, ut++) {
      int cf;
      req_put16s(p, *ut);
      cf = (text->feedback + i)->count_feedbacks;
      req_put16s(p, (8 * cf));
      for (j = 0; j < cf; j++) {
       req_put32s(p, ((text->feedback + i)->feedbacks + j)->type);
       req_put32s(p, ((text->feedback + i)->feedbacks + j)->value);
      }
    }
    req_put32s(p, annotation_len); /* annotation is not supported yet */
  }

  send_message(IM_PREEDIT_DRAW, request, total_length);

  delete [] request;

  return True;

#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_preedit_draw_text_fr, NULL, need_swap);
       
  int text_length = text->char_length;
  UTFCHAR *utf_chars;

  if (text->encoding == UTF16_CODESET) {
    utf_chars = text->text.utf_chars;
    if (*utf_chars == 0xfffe || *utf_chars == 0xfeff) {
      utf_chars++;
      text_length -= 1;
    }
  } else {
#ifdef DEBUG
    // cerr << "need to do convertion" << endl;
#endif
    utf_chars = 0;
  }
  FrameMgrSetIterCount(fm, text_length);

  if (text != NULL) {
    for (i = 0; i < text_length; i++) {
      IMFeedbackList *fbl = &(text->feedback[i]);
      // set iteration count for list of feedback
      FrameMgrSetIterCount(fm, fbl->count_feedbacks);
    }
  }

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);
    
  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, preedit_CB->icid);
  FrameMgrPutToken(fm, draw->caret);
  FrameMgrPutToken(fm, draw->chg_first);
  FrameMgrPutToken(fm, draw->chg_length);
  int flag = 1;                    /* #1 for TEXT */
  FrameMgrPutToken(fm, flag);

  CARD8 *utf_str = (CARD8*)utf_chars;
  CARD8 *strp = utf_str;

  const int one_unit = sizeof(UTFCHAR)/sizeof(char);
  for (i = 0; i < text_length, strp < &utf_str[text_length * one_unit];
       i++) {
    CARD8 first_byte, second_byte;
    if (need_swap) {
      second_byte = *strp++;
      first_byte = *strp++;
    } else {
      first_byte = *strp++;
      second_byte = *strp++;
    }
    FrameMgrPutToken(fm, first_byte);
    FrameMgrPutToken(fm, second_byte);

    if (text != NULL) {
       IMFeedbackList *fbl = &(text->feedback[i]);
        for (j = 0; j < fbl->count_feedbacks; j++){
         IMFeedback *fb = &(fbl->feedbacks[j]);
         FrameMgrPutToken(fm, fb->type);
         FrameMgrPutToken(fm, fb->value);
       }
    }
  }
  int annotation_len = 0;   /* annotation is not used */
  FrameMgrPutToken(fm, annotation_len); /* annotation_len = 0 */

  send_message(IM_PREEDIT_DRAW, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);

  return True;
#endif /* USE_FRAMEMGR_ALWAYS */
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::preedit_erase_text ( IMPreeditCBStruct preedit_CB) [private]

Definition at line 493 of file IIIMPClientCB.cpp.

                                                                 {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char data[4 + 2 + 2 + 4 + 4 + 4 + 4 + 4 + 4];
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_preedit_draw_string_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMPreeditDrawCallbackStruct *draw =
    (IMPreeditDrawCallbackStruct *)&preedit_CB->preedit->todo.draw;
  IMText *text = draw->text;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, preedit_CB->icid);
    req_put32(ptr, draw->caret);
    req_put32(ptr, draw->chg_first);
    req_put32(ptr, draw->chg_length);
    req_put32(ptr, 1);      /* #1 for TEXT */
    req_put32(ptr, 0);      /* byte length of list of char_with_feedbac */
    req_put32(ptr, 0);      /* byte length of list of annotatio */
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, preedit_CB->icid);
    req_put32s(ptr, draw->caret);
    req_put32s(ptr, draw->chg_first);
    req_put32s(ptr, draw->chg_length);
    req_put32s(ptr, 1);     /* #1 for TEXT */
    req_put32s(ptr, 0);     /* byte length of list of char_with_feedbac */
    req_put32s(ptr, 0);     /* byte length of list of annotatio */
  }
  send_message(IM_PREEDIT_DRAW, data, (sizeof (data)));

#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_preedit_draw_string_fr, NULL, need_swap);

  const int text_length = 0;
  FrameMgrSetIterCount(fm, text_length);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, preedit_CB->icid);
  FrameMgrPutToken(fm, draw->caret);
  FrameMgrPutToken(fm, draw->chg_first);
  FrameMgrPutToken(fm, draw->chg_length);
  int flag = 1;      /* #1 for TEXT */
  FrameMgrPutToken(fm, flag);

  int annotation_len = 0;   /* annotation is not used */
  FrameMgrPutToken(fm, annotation_len); /* annotation_len = 0 */

  send_message(IM_PREEDIT_DRAW, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 482 of file IIIMPClientCB.cpp.

                                                            {
#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(im_id, preedit_CB->icid, IM_PREEDIT_START);
#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_preedit_start_fr[];
  send_message(im_id, preedit_CB->icid,
              im_preedit_start_fr, IM_PREEDIT_START);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::preedit_start_reply ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 909 of file IIIMPClientDispatcher.cpp.

                                               {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_preedit_start_reply_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMPreeditStruct preedit;
  CARD16 input_method_id, input_context_id;
  int return_value;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
    req_get16(ptr, return_value);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
    req_get16s(ptr, return_value);
  }
#ifdef DEBUG
  // cerr << "Preedit Start CB reply" << endl;
  // cerr << "need to set return_value to preedit rendering object" << endl;
#endif
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_preedit_start_reply_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);
  FrameMgrGetToken(fm, return_value);

#ifdef DEBUG
  // cerr << "Preedit Start CB reply" << endl;
  // cerr << "need to set return_value to preedit rendering object" << endl;
#endif

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::preedit_state ( IMConvStateCBStruct state_CB) [private]

Definition at line 1536 of file IIIMPClientCB.cpp.

                                                            {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char data[4 + 2 + 2 + 2 + 2];
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_trigger_notify_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, state_CB->icid);
    req_put16(ptr, state_CB->conv_state);
    req_put16(ptr, 0);
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, state_CB->icid);
    req_put16s(ptr, state_CB->conv_state);
    req_put16s(ptr, 0);
  }
  send_message(IM_TRIGGER_NOTIFY, data, (sizeof (data)));
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_trigger_notify_fr, (char *)NULL, need_swap);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, state_CB->icid);
  FrameMgrPutToken(fm, state_CB->conv_state);  // #0::ON #1::OFF

  send_message(IM_TRIGGER_NOTIFY, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::read_data ( const char *  buf,
const int  len 
) const [private]

Definition at line 171 of file IIIMPClient.cpp.

                                                           {
  const int max_byte = MAX_RW_DATA_LEN;
#ifdef WIN32
  size_t size = 0;
#else
  ssize_t size = 0;
#endif
  char *bufp = (char*)buf;
  int rest_len = len;

  if (accept_fd == 0) return 0;

  if (len == 0) // this should not happen
    return 0;

  // Read until nbytes have been read. We will break out when the following
  // two conditions occur:
  //  - num_read = 0 ( the connection has probably timed out )
  //  - accumulated size = expected nbyte.

  while (1) {
    int try_len = (rest_len < max_byte)? rest_len : max_byte;
    int num_read = accept_fd->read(bufp, try_len);
    if (num_read == 0)
      break;
    size += num_read;
    if (size == len) // we have got our fill.
      break;
    bufp += num_read;
    rest_len -= num_read;
  }
  if (size == 0) { // lost the connection
    // kill the connection 
  }
  return size;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::read_icvalue ( unsigned  short,
int  ,
void *  p,
ICAttribute  
) [private]

Definition at line 320 of file IIIMPClientDispatcher2.cpp.

                                               {
  IMAttr *ic_attr = iiim_protocol->get_icattr();
  for (IMAttr *attrp = ic_attr;
       attrp < &ic_attr[iiim_protocol->count_icattr()]; attrp++) {
    if (attrp->attribute_id == icvalue_id) {
      set_card(value_ret, (char*)p, attrp, value_length);
      return(0);
    }
  }
  return(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::read_imvalue ( unsigned  short,
int  ,
void *  p,
ICAttribute  
) [private]

Definition at line 334 of file IIIMPClientDispatcher2.cpp.

                                               {
  IMAttr *im_attr = iiim_protocol->get_imattr();
  for (IMAttr *attrp = im_attr;
       attrp < &im_attr[iiim_protocol->count_imattr()]; attrp++) {
    if (attrp->attribute_id == imvalue_id) {
      set_card(value_ret, (char*)p, attrp, value_length);
      return(0);
    }
  }
  return(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1007 of file IIIMPClientDispatcher.cpp.

                                  {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *data;
  char *ptr;
  int total_size;
  CARD32 time_stamp = 0;
  int keycode;
  int modifier;
  IMTriggerKey keyp;
  int i;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_register_triggerkeys_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */

  CARD16 on_key_num = iiim_protocol->countOnKeys();
  CARD16 off_key_num = iiim_protocol->countOffKeys();

  if (on_key_num == 0 && off_key_num == 0) return;

#if !defined(USE_FRAMEMGR_ALWAYS)
  total_size = 4;
  total_size += (2 + 2);
  total_size += 4;                        /* byte length of on-keys */
  total_size += ((4 * 4) * on_key_num);          /* trigger keys to turn on */
  total_size += 4;                        /* byte length of off-keys */
  total_size += ((4 * 4) * off_key_num);  /* trigger keys to turn off */
  data = new char[total_size];
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, 0);             /* padding */
    req_put32(ptr, ((4 * 4) * on_key_num));
    for (i = 0; i < on_key_num; i++) {
      keyp = iiim_protocol->getOnKey(i + 1);
      keycode = keyp.get_keyCode();
      req_put32(ptr, keycode);
      req_put32(ptr, keycode); /* for keychar */
      if ((modifier = keyp.get_modifier()) & (1<<2)) {
        /* Java's control_mask(1<<1) and X's control_mask(1<<2)is
          different, so it should be changed */
       modifier -= (1<<2);
       modifier |= (1<<1);
      }
      req_put32(ptr, modifier);
      req_put32(ptr, time_stamp);
    }
    req_put32(ptr, ((4 * 4) * off_key_num));
    for (i = 0; i < off_key_num; i++) {
      keyp = iiim_protocol->getOffKey(i + 1);
      keycode = keyp.get_keyCode();
      req_put32(ptr, keycode);
      req_put32(ptr, keycode); /* for keychar */
      if ((modifier = keyp.get_modifier()) & (1<<2)) {
        /* Java's control_mask(1<<1) and X's control_mask(1<<2)is
          different, so it should be changed */
       modifier -= (1<<2);
       modifier |= (1<<1);
      }
      req_put32(ptr, modifier);
      req_put32(ptr, time_stamp);
    }
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, 0);            /* padding */
    req_put32s(ptr, ((4 * 4) * on_key_num));
    for (i = 0; i < on_key_num; i++) {
      keyp = iiim_protocol->getOnKey(i + 1);
      keycode = keyp.get_keyCode();
      req_put32s(ptr, keycode);
      req_put32s(ptr, keycode); /* for keychar */
      if ((modifier = keyp.get_modifier()) & (1<<2)) {
        /* Java's control_mask(1<<1) and X's control_mask(1<<2)is
          different, so it should be changed */
       modifier -= (1<<2);
       modifier |= (1<<1);
      }
      req_put32s(ptr, modifier);
      req_put32s(ptr, time_stamp);
    }
    req_put32s(ptr, ((4 * 4) * off_key_num));
    for (i = 0; i < off_key_num; i++) {
      keyp = iiim_protocol->getOffKey(i + 1);
      keycode = keyp.get_keyCode();
      req_put32s(ptr, keycode);
      req_put32s(ptr, keycode); /* for keychar */
      if ((modifier = keyp.get_modifier()) & (1<<2)) {
        /* Java's control_mask(1<<1) and X's control_mask(1<<2)is
          different, so it should be changed */
       modifier -= (1<<2);
       modifier |= (1<<1);
      }
      req_put32s(ptr, modifier);
      req_put32s(ptr, time_stamp);
    }
  }
  send_message(IM_REGISTER_TRIGGER_KEYS, data, total_size);
  delete [] data;
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_register_triggerkeys_fr, NULL, need_swap);

  /* set iteration count for on-keys list */
  FrameMgrSetIterCount(fm, on_key_num);
  /* set iteration count for off-keys list */
  FrameMgrSetIterCount(fm, off_key_num);

  /* get total_size */
  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size, 0);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  /* Right now IM_CONNECT_REPLY hasn't been sent to this new client, so
     the input-method-id is still invalid, but it is set to accept_fd
  */
  FrameMgrPutToken(fm, im_id); /* input-method-id */

  CARD32 time_stamp = 0;
  int keycode, modifier;
  IMTriggerKey keyp;
  int i;

  for (i = 0; i < on_key_num; i++) {
    keyp = iiim_protocol->getOnKey(i+1);
    keycode = keyp.get_keyCode();
    FrameMgrPutToken(fm, keycode);
    FrameMgrPutToken(fm, keycode); /* for keychar */
    if ((modifier = keyp.get_modifier()) & (1<<2)) {
      /* Java's control_mask(1<<1) and X's control_mask(1<<2)is
        different, so it should be changed */
      modifier -= (1<<2);
      modifier |= (1<<1);
    }
    FrameMgrPutToken(fm, modifier);
    FrameMgrPutToken(fm, time_stamp);
  }

  for (i = 0; i < off_key_num; i++) {
    keyp = iiim_protocol->getOffKey(i+1);
    keycode = keyp.get_keyCode();
    FrameMgrPutToken(fm, keycode);
    FrameMgrPutToken(fm, keycode); /* for keychar */
    if ((modifier = keyp.get_modifier()) & (1<<2)) {
      /* Java's control_mask(1<<1) and X's control_mask(1<<2)is
        different, so it should be changed */
      modifier -= (1<<2);
      modifier |= (1<<1);
    }
    FrameMgrPutToken(fm, modifier);
    FrameMgrPutToken(fm, time_stamp);
  }

  send_message(IM_REGISTER_TRIGGER_KEYS, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char * IIIMPClient::req_get_ascii_string ( char *  ptr,
char **  string,
int *  size_ret,
int *  buf_size_ret 
) [private]

Definition at line 103 of file IIIMPClientDispatcher.cpp.

                                                                       {
  char *p;
  int size;
  int len;
  int i;

  req_get16(ptr, size);
  if (NULL != size_ret) {
    *size_ret = size;
  }

  len = (size / 2);
  p = new char[len + 1];
  if (NULL != buf_size_ret) {
    *buf_size_ret = (len + 1);
  }

  for (i = 0; i < len; i++) {
    req_get16(ptr, *(p + i));
  }
  if ((size + 2) & 0x03) {  /* skip padding */
    ptr += (4 - ((size + 2) & 0x03));
  }
  *(p + len) = '\0';

  *string = p;

  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_get_ascii_string_s ( char *  ptr,
char **  string,
int *  size_ret,
int *  buf_size_ret 
) [private]

Definition at line 135 of file IIIMPClientDispatcher.cpp.

                                                                       {
  char *p;
  int size;
  int len;
  int i;

  req_get16s(ptr, size);
  if (NULL != size_ret) {
    *size_ret = size;
  }

  len = (size / 2);
  p = new char[len + 1];
  if (NULL != buf_size_ret) {
    *buf_size_ret = (len + 1);
  }

  for (i = 0; i < len; i++) {
    req_get16s(ptr, *(p + i));
  }
  if ((size + 2) & 0x03) {  /* skip padding */
    ptr += (4 - ((size + 2) & 0x03));
  }
  *(p + len) = '\0';

  *string = p;

  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_put_ascii_string ( char *  ptr,
char *  string 
) [private]

Definition at line 261 of file IIIMPClientCB.cpp.

                                                           {
  int length;
  int i;
  int j;
  char *ptr_hold;

  if (NULL == string) {
    length = 0;
  } else {
    length = strlen(string);
  }
  req_put16(ptr, (2 * length));
  for (i = 0; i < length; i++) {
    req_put16(ptr, *(string + i));
  }
  if (0 == (length & 0x01)) {
    req_put16(ptr, 0);             /* padding */
  }
  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_put_ascii_string_s ( char *  ptr,
char *  string 
) [private]

Definition at line 283 of file IIIMPClientCB.cpp.

                                                             {
  int length;
  int i;
  int j;
  char *ptr_hold;

  if (NULL == string) {
    length = 0;
  } else {
    length = strlen(string);
  }
  req_put16s(ptr, (2 * length));
  for (i = 0; i < length; i++) {
    req_put16s(ptr, *(string + i));
  }
  if (0 == (length & 0x01)) {
    req_put16s(ptr, 0);            /* padding */
  }
  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_put_icattr_list ( char *  ptr,
ICAttribute icattr,
int  num 
) [private]

Definition at line 127 of file IIIMPClientDispatcher2.cpp.

                                                                          {
  int i;
  for (i = 0; i < num; i++, icattr++) {
    req_put16(ptr, icattr->attribute_id);
    req_put16(ptr, icattr->value_length);
    memcpy(ptr, icattr->value, icattr->value_length);
    if (icattr->value_length & 0x03) {
      ptr += ((icattr->value_length & (~0x03)) + 4);
    } else {
      ptr += icattr->value_length;
    }
  }
  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_put_icattr_list_s ( char *  ptr,
ICAttribute icattr,
int  num 
) [private]

Definition at line 143 of file IIIMPClientDispatcher2.cpp.

                                                                            {
  int i;
  for (i = 0; i < num; i++, icattr++) {
    req_put16s(ptr, icattr->attribute_id);
    req_put16s(ptr, icattr->value_length);
    memcpy(ptr, icattr->value, icattr->value_length);
    if (icattr->value_length & 0x03) {
      ptr += ((icattr->value_length & (~0x03)) + 4);
    } else {
      ptr += icattr->value_length;
    }
  }
  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_put_imtext ( char *  ptr,
IMText text 
) [private]

Definition at line 87 of file IIIMPClientCB.cpp.

                                                     {
  IMFeedbackList *feedback;
  IMAnnotation *ann;
  int size;
  int i;
  int j;
  char *ptr_hold;

  if (NULL == text) {
    req_put32(ptr, 0);      /* byte length of list of char_with_feedback */
    req_put32(ptr, 0);      /* byte length of list of annotation */
    return ptr;
  }

  ptr_hold = ptr;
  req_put32(ptr, 0); /* dummy */
  size = 0;
  for (i = 0; i < text->char_length; i++) {
    feedback = (text->feedback + i);
    req_put16(ptr, *(text->text.utf_chars + i));
    req_put16(ptr, (8 * feedback->count_feedbacks));
    size += 4;
    for (j = 0; j < feedback->count_feedbacks; j++) {
      req_put32(ptr, (feedback->feedbacks + j)->type);
      req_put32(ptr, (feedback->feedbacks + j)->value);
      size += 8;
    }
  }
  req_put32(ptr_hold, size);

  ptr_hold = ptr;
  req_put32(ptr, 0); /* dummy */
  size = 0;
  for (i = 0; i < text->count_annotations; i++) {
    ann = (text->annotations + i);
    req_put32(ptr, ann->type);            /* attribute ID */
    req_put32(ptr, ann->value.len);       /* byte length of list of annotation value */
    req_put32(ptr, ann->value.start_pos); /* start index */
    req_put32(ptr, ann->value.end_pos);   /* byte length of value */
    size += (4 * 4);
    for (j = 0; j < ann->value.len; j++) {
      req_put8(ptr, *(((char *)(ann->value.value)) + j));
    }
    for (i = (ann->value.len & 0x03); 0 < i; i++) {
      req_put8(ptr, 0);
    }
    if (ann->value.len & 0x03) {
      size += ((ann->value.len & (~0x03)) + 4);
    } else {
      size += ann->value.len;
    }
  }
  req_put32(ptr_hold, size);

  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_put_imtext_s ( char *  ptr,
IMText text 
) [private]

Definition at line 145 of file IIIMPClientCB.cpp.

                                                       {
  IMFeedbackList *feedback;
  IMAnnotation *ann;
  int size;
  int i;
  int j;
  char *ptr_hold;

  if (NULL == text) {
    req_put32s(ptr, 0);     /* byte length of list of char_with_feedback */
    req_put32s(ptr, 0);     /* byte length of list of annotation */
    return ptr;
  }

  ptr_hold = ptr;
  req_put32s(ptr, 0);       /* dummy */
  size = 0;
  for (i = 0; i < text->char_length; i++) {
    feedback = (text->feedback + i);
    req_put16s(ptr, *(text->text.utf_chars + i));
    req_put16s(ptr, (8 * feedback->count_feedbacks));
    size += 4;
    for (j = 0; j < feedback->count_feedbacks; j++) {
      req_put32s(ptr, (feedback->feedbacks + j)->type);
      req_put32s(ptr, (feedback->feedbacks + j)->value);
      size += 8;
    }
  }
  req_put32s(ptr_hold, size);

  ptr_hold = ptr;
  req_put32s(ptr, 0);       /* dummy */
  size = 0;
  for (i = 0; i < text->count_annotations; i++) {
    ann = (text->annotations + i);
    req_put32s(ptr, ann->type);           /* attribute ID */
    req_put32s(ptr, ann->value.len);      /* byte length of list of annotation value */
    req_put32s(ptr, ann->value.start_pos);       /* start index */
    req_put32s(ptr, ann->value.end_pos);  /* byte length of value */
    size += (4 * 4);
    for (j = 0; j < ann->value.len; j++) {
      req_put8s(ptr, *(((char *)(ann->value.value)) + j));
    }
    for (i = (ann->value.len & 0x03); 0 < i; i++) {
      req_put8s(ptr, 0);
    }
    if (ann->value.len & 0x03) {
      size += ((ann->value.len & (~0x03)) + 4);
    } else {
      size += ann->value.len;
    }
  }
  req_put32s(ptr_hold, size);

  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_put_utf16_string ( char *  ptr,
UTFCHAR string,
int  length 
) [private]

Definition at line 215 of file IIIMPClientCB.cpp.

                                                                          {
  int i;
  int j;
  char *ptr_hold;

  req_put16(ptr, (2 * length));
  for (i = 0; i < length; i++) {
    req_put16(ptr, *(string + i));
  }
  if (0 == (length & 0x01)) {
    req_put16(ptr, 0);             /* padding */
  }
  return ptr;
}

Here is the caller graph for this function:

char * IIIMPClient::req_put_utf16_string_s ( char *  ptr,
UTFCHAR string,
int  length 
) [private]

Definition at line 231 of file IIIMPClientCB.cpp.

                                                                            {
  int i;
  int j;
  char *ptr_hold;

  req_put16s(ptr, (2 * length));
  for (i = 0; i < length; i++) {
    req_put16s(ptr, *(string + i));
  }
  if (0 == (length & 0x01)) {
    req_put16s(ptr, 0);            /* padding */
  }
  return ptr;
}

Here is the caller graph for this function:

void IIIMPClient::reset_ic ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 614 of file IIIMPClientDispatcher.cpp.

                                                                   {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_resetic_fr[], im_resetic_reply_fr[];
  XimFrameRec *input_fr = im_resetic_fr;
  XimFrameRec *output_fr = im_resetic_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD16 input_method_id, input_context_id;
  const int IM_OUTPUT_REPLY = IM_RESETIC_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);
                  
  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  InputContext *ic = &(input_context_list.getItem(input_context_id));
  if (ic) {
    IMText *ret_string =
      iiim_protocol->proto_handler->ResetIC((InputContext*)ic);
    ic->commit_string(ret_string);
  } else { 
    // need to treate as an error
  }
#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, input_context_id, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, input_context_id,
              output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::Select ( ) [private]

Definition at line 319 of file IIIMPClient.cpp.

                    {
  struct timeval timeout;

  if (being_deleted) {
    // wait 10 minutes
    timeout.tv_sec  = 600L;
    timeout.tv_usec = 0L;
  } else {
    // wait 1.0 second
    timeout.tv_sec  = 1L;
    timeout.tv_usec = 0L;
  }
  return accept_fd->select_fd(timeout);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::send_imvalues_message ( int  input_method_id,
int  message_type,
ICAttribute im_attr,
int  n 
) [private]

Definition at line 787 of file IIIMPClientDispatcher3.cpp.

                                                            {
  extern XimFrameRec im_setimvalues_fr[], im_setimvalues_reply_fr[];
  XimFrameRec *input_fr = im_setimvalues_fr;
  XimFrameRec *output_fr = im_setimvalues_reply_fr;
  FrameMgr fm;

  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)NULL, need_swap);

  /* set iteration count for list of im_attribute */
  FrameMgrSetIterCount(fm, n);

  /* set length of BARRAY item in imattribute_fr*/
  ICAttribute *attrp;
  for (attrp = im_attr; attrp < &im_attr[n]; attrp++) {
    FrameMgrSetSize(fm, attrp->value_length);
  }

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  unsigned char *replyp = reply.toUchar();

  FrameMgrPutToken(fm, input_method_id);
  replyp += 2 + 2 + 4;             // imid + pad(2) + byte_length

  for (attrp = im_attr; attrp < &im_attr[n]; attrp++) {
    FrameMgrPutToken(fm, attrp->attribute_id); replyp += 2;
    FrameMgrPutToken(fm, attrp->value_length); replyp += 2 + 4; // padding + len
    memmove(replyp, attrp->value, attrp->value_length);
    replyp += attrp->value_length;
    replyp += ((attrp->value_length) % 4);
    FrameMgrSkipToken(fm, 2);      // value, padding
  }
  send_message(message_type, reply, total_size);

  /* free FrameMgr */
  FrameMgrFree(fm);

  if (message_type == IM_SETIMVALUES) {
    // wait IM_SETIMVALUES_REPLY
    get_amessage();
  }

  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::send_message ( int  opcode,
CompoundString csdata,
int  data_length 
) [private]

Definition at line 1235 of file IIIMPClientDispatcher.cpp.

                                                                             {
  unsigned char *data = csdata.toUchar();
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_packet_header_fr[];
  int header_size;
  unsigned char *replyp;
  int reply_length;
  long p_len = data_length/4;
  CARD8 length[3];
#endif /* USE_FRAMEMGR_ALWAYS */

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = new char[4 + data_length];
  memcpy(ptr + 4, data, data_length);
  send_message(opcode, ptr, 4 + data_length);
  delete [] ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  /* calculate length */
  length[2] = ((p_len >> 16) & 0xff);
  length[1] = ((p_len >> 8) & 0xff);
  length[0] = (p_len & 0xff);

  /* create FrameMgr */
  fm = FrameMgrInit(im_packet_header_fr, NULL, need_swap);

  header_size = FrameMgrGetTotalSize(fm);

  CompoundString reply_hdr = CompoundString(header_size, 0);
  FrameMgrSetBuffer(fm, reply_hdr);

  /* put data */
  FrameMgrPutToken(fm, opcode);
  FrameMgrPutToken(fm, length[2]);
  FrameMgrPutToken(fm, length[1]);
  FrameMgrPutToken(fm, length[0]);

  reply_length = header_size + data_length;

  CompoundString reply = CompoundString(reply_length, 0);
  memmove(reply, reply_hdr, header_size);

  replyp = reply.toUchar();
  replyp += header_size;
  memmove(replyp, data, data_length);

  write_data((char*)reply, reply_length);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::send_message ( int  input_method_id,
int  input_context_id,
int  opcode 
) [private]

Definition at line 1170 of file IIIMPClientDispatcher.cpp.

                                   {
  int  data_len;
  char buf[4 + 2 + 2];
  char *p;

  /* calculate length */
  buf[0] = opcode;
  buf[1] = 0;
  buf[2] = 0;
  buf[3] = 1;

  p = (buf + 4);

  if (False == need_swap) {
    req_put16(p, input_method_id);
    req_put16(p, input_context_id);
  } else {
    req_put16s(p, input_method_id);
    req_put16s(p, input_context_id);
  }

  write_data(buf, sizeof (buf));

  return;
}

Here is the call graph for this function:

void IIIMPClient::send_message ( int  opcode,
char *  request,
int  request_len 
) [private]

Definition at line 1197 of file IIIMPClientDispatcher.cpp.

                                                                     {
  int data_len;

  data_len = ((request_len - 4) / 4);
  *(request + 0) = opcode;
  *(request + 1) = ((data_len >> 16) & 0xff);
  *(request + 2) = ((data_len >>  8) & 0xff);
  *(request + 3) = ((data_len >>  0) & 0xff);

  write_data(request, request_len);

  return;
}

Here is the call graph for this function:

void IIIMPClient::set_card ( ICAttribute value_ret,
char *  p,
IMAttr ic_attr,
int  value_length 
) [private]

Definition at line 163 of file IIIMPClientDispatcher2.cpp.

                                      {
  char *buf, *bufp;
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
  char *ptr_end;
  char *data;
  int data_length;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  FmStatus status;
  extern XimFrameRec string_fr[];
  extern XimFrameRec worddata_fr[];
  extern XimFrameRec longdata_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  short value16;
  int value32;
  int byte_length;
  int value_type = ic_attr->type;
  ICAttribute temp_value;
  IMAttr temp_attr;
  int len, left;

  buf = new char[value_length];

  switch (value_type) {
  case IIIMProtocol::XimType_LISTOF_UTF16_STRING:
#if !defined(USE_FRAMEMGR_ALWAYS)
    ptr = (char *)p;
    ptr_end = (ptr + value_length);
    bufp = buf;
    left = value_length;
    if (False == need_swap) {
      while ((ptr < ptr_end) && (0 < left)) {
       ptr = req_get_ascii_string(ptr, &data, &byte_length, &data_length);
       memcpy(bufp, data, data_length);
       delete [] data;
       bufp += data_length;
       left -= data_length;
      }
    } else {
      while ((ptr < ptr_end) && (0 < left)) {
       ptr = req_get_ascii_string_s(ptr, &data, &byte_length, &data_length);
       memcpy(bufp, data, data_length);
       delete [] data;
       bufp += data_length;
       left -= data_length;
      }
    }
    value_length = (bufp - buf);
#else /* USE_FRAMEMGR_ALWAYS */
    bufp = buf;
    temp_attr.attribute_id = 0;
    temp_attr.length = 0;
    temp_attr.name = NULL;
    temp_attr.type = IIIMProtocol::XimType_UTF16_STRING;
    left = value_length;
    while (left > 0) {
      set_card(&temp_value, (char*)p, &temp_attr, left);
      len = 2 + temp_value.value_length * 2 +
       ((2 + temp_value.value_length * 2) % 4); // evil
      p += len;
      memmove(bufp, temp_value.value, temp_value.value_length);
      free(temp_value.value);
      bufp += temp_value.value_length;
      *bufp++ = (char)0;
      left -= len;
    }
#endif /* USE_FRAMEMGR_ALWAYS */
    break;
  case IIIMProtocol::XimType_UTF16_STRING:
#if !defined(USE_FRAMEMGR_ALWAYS)
    ptr = (char *)p;
    delete [] buf;
    if (False == need_swap) {
      ptr = req_get_ascii_string(ptr, &buf, NULL, &value_length);
    } else {
      ptr = req_get_ascii_string_s(ptr, &buf, NULL, &value_length);
    }
    value_type = IIIMProtocol::XimType_CARD8;
#else /* USE_FRAMEMGR_ALWAYS */
    /* create FrameMgr */
    fm = FrameMgrInit(string_fr, (char *)p, need_swap);
    /* get data */
    FrameMgrGetToken(fm, byte_length);
    bufp = buf;
    value_length = byte_length/2;
    // assume that all the 16bit Unicode characters are ASCII characters
    while (FrameMgrIsIterLoopEnd(fm, &status) == False) {
      CARD16 str;
      CARD8 byte_data;
      FrameMgrGetToken(fm, byte_data);
      str = (byte_data << 8) & 0xff00;
      FrameMgrGetToken(fm, byte_data);
      str += byte_data & 0x00ff;
      if (str != 0 && str != 0xff && str != 0xfe)
       *bufp++ = (char)str;
      else
       value_length--;
    }
    *bufp = (char)0;
    value_type = IIIMProtocol::XimType_CARD8;
    FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
    break;
  case IIIMProtocol::XimType_CARD8:
    memmove(buf, p, value_length);
    break;
  case IIIMProtocol::XimType_CARD16:
#if !defined(USE_FRAMEMGR_ALWAYS)
    ptr = (char *)p;
    if (False == need_swap) {
      req_get16(ptr, value16);
    } else {
      req_get16s(ptr, value16);
    }
#else /* USE_FRAMEMGR_ALWAYS */
    /* create FrameMgr */
    fm = FrameMgrInit(worddata_fr, (char *)p, need_swap);
    /* get data */
    FrameMgrGetToken(fm, value16);
    /* free FrameMgr */
    FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
    memmove(buf, &value16, value_length);
    break;
  case IIIMProtocol::XimType_CARD32:
#if !defined(USE_FRAMEMGR_ALWAYS)
    ptr = (char *)p;
    if (False == need_swap) {
      req_get32(ptr, value16);
    } else {
      req_get32s(ptr, value16);
    }
#else /* USE_FRAMEMGR_ALWAYS */
    /* create FrameMgr */
    fm = FrameMgrInit(longdata_fr, (char *)p, need_swap);
    /* get data */
    FrameMgrGetToken(fm, value32);
    /* free FrameMgr */
    FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
    memmove(buf, &value32, value_length);
    break;
  }

  value_ret->attribute_id = ic_attr->attribute_id;
  value_ret->name = ic_attr->name;
  value_ret->name_length = ic_attr->length;
  value_ret->value_length = value_length;
  value_ret->type = value_type;
  value_ret->value = buf;

  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::set_icfocus ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 461 of file IIIMPClientDispatcher.cpp.

                                                                      {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_seticfocus_fr[], im_seticfocus_reply_fr[];
  XimFrameRec *input_fr = im_seticfocus_fr;
  XimFrameRec *output_fr = im_seticfocus_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD16 input_method_id, input_context_id;
  const int IM_OUTPUT_REPLY = IM_SETICFOCUS_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  InputContext *ic = &(input_context_list.getItem(input_context_id));
  if (ic) { 
    iiim_protocol->proto_handler->SetICFocus((InputContext*)ic);
 } else {
    // need to treate as an error
  }

#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, input_context_id, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, input_context_id,
              output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::set_icvalues ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 579 of file IIIMPClientDispatcher2.cpp.

                                                                       {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_seticvalues_fr[], im_seticvalues_reply_fr[];
  XimFrameRec *input_fr = im_seticvalues_fr;
  XimFrameRec *output_fr = im_seticvalues_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  IMChangeICStruct *changeic =
    (IMChangeICStruct*)&call_data->changeic;
  CARD16 input_method_id, input_context_id;
  CARD16 byte_length;

  const int IM_OUTPUT_REPLY = IM_SETICVALUES_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
    change_icvalues(ptr, call_data);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
    change_icvalues(ptr, call_data);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);
                  
  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);
  FrameMgrGetToken(fm, byte_length);

  change_icvalues(fm, byte_length, call_data);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  InputContext *ic = &(input_context_list.getItem(input_context_id));
  if (ic) {
    IIIMPInputContext *iiimp_ic = (IIIMPInputContext*)ic;
    // set some icattributes to this new ic
    for (ICAttribute *icp = changeic->ic_attr;
        icp < &changeic->ic_attr[changeic->ic_attr_num]; icp++) {
      if (icp->name == iiim_protocol->ICLocaleName) {
       iiimp_ic->setLocaleName((char*)icp->value);
      } else if (icp->name == iiim_protocol->ICEngineName) {
       iiimp_ic->setEngineName((char*)icp->value);
      }
    }
    iiim_protocol->proto_handler->SetICValues((InputContext*)ic, 0, 0);
  } else {
    // need to treate as an error
  }

  free_icvalues(call_data);

#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, input_context_id, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, input_context_id,
              output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::set_imvalues ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 413 of file IIIMPClientDispatcher3.cpp.

                                                                       {
  CARD16 input_method_id;
  CARD16 byte_length;
  FrameMgr fm;
  FmStatus status;

  extern XimFrameRec im_setimvalues_fr[], im_setimvalues_reply_fr[];
  XimFrameRec *input_fr = im_setimvalues_fr;
  XimFrameRec *output_fr = im_setimvalues_reply_fr;
  const int IM_OUTPUT_REPLY = IM_SETIMVALUES_REPLY;

  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, byte_length);

  if (byte_length != 0) {
    if (alloc_attr == 0) {
      alloc_attr = IIIMPClient::MAX_ATTRNUM;
      imAttribute_list = new ICAttribute[alloc_attr];
      memset(imAttribute_list, 0, sizeof(ICAttribute) * alloc_attr);
      active_attr = 0;
    }
    int first_im_index = active_attr;
    while (FrameMgrIsIterLoopEnd(fm, &status) == False) {
      void *value;
      int value_length;
      if (active_attr == alloc_attr) {
       alloc_attr += IIIMPClient::MAX_ATTRNUM;
       ICAttribute *temp = imAttribute_list;
       imAttribute_list = new ICAttribute[alloc_attr];
       memset(imAttribute_list, 0, sizeof(ICAttribute) * alloc_attr);
       memmove(imAttribute_list, temp, sizeof(ICAttribute) * active_attr);
       delete [] temp;
      }
      FrameMgrGetToken(fm, imAttribute_list[active_attr].attribute_id);
      FrameMgrGetToken(fm, value_length);
      FrameMgrSetSize(fm, value_length);
      imAttribute_list[active_attr].value_length = value_length;
      FrameMgrGetToken(fm, value);
      imAttribute_list[active_attr].value = new char[value_length];
      memmove(imAttribute_list[active_attr].value, value, value_length);
      active_attr++;
    }
    /* The value from the protocol may need to be byte-swapped */
    for (ICAttribute *imp = &imAttribute_list[first_im_index];
        imp < &imAttribute_list[active_attr]; imp++) {
      char *tmp_imp_value = (char*) imp->value;
      if (read_imvalue(imp->attribute_id,
                     imp->value_length,
                     imp->value,
                     imp) == 0) {
       if (imp->name == iiim_protocol->IMListName) {
         ;
       }
       else if (imp->name == iiim_protocol->IMClientName) {
#if !defined(USE_FRAMEMGR_ALWAYS)
         int left = imp->value_length;
#else /* USE_FRAMEMGR_ALWAYS */
         int left = imp->value_length/2 - 1; // evil
#endif /* USE_FRAMEMGR_ALWAYS */
         // LISTofSTRING(applicationName, osName, osArck, osVersion)
         char *p = (char*)imp->value;
         size_t len;
         if (left == 0) continue;
         application_name = (char*)p;
         len = strlen(p) + 1; p += len; left -= len;
         if (left == 0) continue;

         os_name = (char*)p;
         len = strlen(p) + 1; p += len; left -= len;
         if (left == 0) continue;

         os_arch = (char*)p;
         len = strlen(p) + 1; p += len; left -= len;
         if (left == 0) continue;

         os_version = (char*)p;
         // LISTofSTRING(display_name, server_vendor) may follow
         len = strlen(p) + 1; p += len; left -= len;
         if (left <= 0) continue;

         xDisplayName = (char*)p;
         len = strlen(p) + 1; p += len; left -= len;
         if (left <= 0) continue;

         xServerVendor = (char*)p;
       }
       else if (imp->name == iiim_protocol->IMObjectListName) {
         ;
       }
       else if (imp->name == iiim_protocol->IMCCDEFName) {
         ;
       }
       else if (imp->name == iiim_protocol->IMGUIObjectName) {
         ;
       }
       else if (imp->name == iiim_protocol->IMLWEObjectName) {
         ;
       }
      }
      delete [] tmp_imp_value;
      delete [] imp->value;
    }
  }

  /* free FrameMgr */
  FrameMgrFree(fm);

  // IF this IM_SETIMVALUES is sent before the 1st input context is
  // created, send OBJECTDESCRIPTOR to the client

  if (input_context_list.getSize() == 0) {

    // return INPUTMETHODLIST to the client if any
    int count = iiim_protocol->countIME();
    int i;
    extern XimFrameRec inputmethod_fr[];
    int iter_count;
    unsigned char *imelist_buf = (unsigned char*)0;
    unsigned int imelist_size = 0;
    IMEditorStruct ime;
    for (i = 0; i < count; i++) {
      ime = iiim_protocol->getIME(i+1);
      fm = FrameMgrInit(inputmethod_fr, NULL, need_swap);

      iter_count = strlen(ime.domain); // object User
      FrameMgrSetIterCount(fm, iter_count);
      iter_count = ime.name_length;
      FrameMgrSetIterCount(fm, iter_count);

      int lang_count = ime.count_locales;

      /* set iteration count of lang names */
      FrameMgrSetIterCount(fm, lang_count);

      // set byte length of BIT16 item in STRING list
      int j;
      for (j = 0; j < lang_count; j++) {
       CompoundString langp(ime.locales[i]);
       int len = strlen((char*)langp);
       FrameMgrSetIterCount(fm, len);
      }

      const int ime_size = FrameMgrGetTotalSize(fm);
      CompoundString ime_buf = CompoundString(ime_size);
      memset(ime_buf, 0, ime_size);
      FrameMgrSetBuffer(fm, ime_buf);

      FrameMgrPutToken(fm, ime.id);
      SetStringToFrame(fm, ime.domain, strlen(ime.domain));
      SetStringToFrame(fm, ime.name, ime.name_length);

      for (j = 0; j < lang_count; j++) {
       CompoundString langp(ime.locales[i]);
       SetStringToFrame(fm, langp, strlen(langp));
      }

      if (!imelist_buf) {
       imelist_buf = new unsigned char[ime_size];
       imelist_size = ime_size;
       memmove(imelist_buf, ime_buf, ime_size);
      } else {
       unsigned char *temp = new unsigned char[imelist_size + ime_size];
       unsigned char *pTemp = temp;
       memmove(pTemp, imelist_buf, imelist_size);
       pTemp += imelist_size;
       memmove(pTemp, ime_buf, ime_size);
       imelist_size += ime_size;
       delete [] imelist_buf;
       imelist_buf = temp;
      }
      /* free FrameMgr */
      FrameMgrFree(fm);
    }

    // return OBJECTDESCRIPTORLIST to the client
    count = iiim_protocol->countObjectDescriptors();
    extern XimFrameRec objectdescriptor_fr[];
    unsigned char *odlist_buf = (unsigned char*)0;
    unsigned int odlist_size = 0;
    IMObjectDescriptorStruct od;

    CompoundString client_type = getApplicationName();

    for (i = 0; i < count; i++) {
      od = iiim_protocol->getObjectDescriptor(i+1);

      if(strstr((char*)client_type, "JDK")){ /* JAVA */
        if(od.type == IM_DOWNLOADINGOBJECT_BINGUI_TYPE ||
           od.type == IM_DOWNLOADINGOBJECT_BINLWE_TYPE) {
          continue;
        }
      } else { /* from xiiimp.so.2 */
        if(od.type == IM_DOWNLOADINGOBJECT_JARGUI_TYPE ||
           od.type == IM_DOWNLOADINGOBJECT_JARLWE_TYPE) {
          continue;
        }
      }

      fm = FrameMgrInit(objectdescriptor_fr, NULL, need_swap);
      iter_count = strlen(od.domain); // reversed unique domain name
      FrameMgrSetIterCount(fm, iter_count);
      iter_count = od.name_length;
      FrameMgrSetIterCount(fm, iter_count);
      iter_count = 0;              // signature
      FrameMgrSetIterCount(fm, iter_count);
      iter_count = strlen(od.scope); // object User
      FrameMgrSetIterCount(fm, iter_count);

      const int od_size = FrameMgrGetTotalSize(fm);
      CompoundString od_buf = CompoundString(od_size);
      memset(od_buf, 0, od_size);
      FrameMgrSetBuffer(fm, od_buf);

      IMObjectCategory category = IM_GUI_OBJECT;
      FrameMgrPutToken(fm, category);
      FrameMgrPutToken(fm, od.size);
      FrameMgrPutToken(fm, od.type);
      FrameMgrPutToken(fm, od.id);
      SetStringToFrame(fm, od.domain, strlen(od.domain));
      SetStringToFrame(fm, od.name, od.name_length);
      SetStringToFrame(fm, od.signature, strlen(od.signature));
      SetStringToFrame(fm, od.scope, strlen(od.scope));

      if (!odlist_buf) {
       odlist_buf = new unsigned char[od_size];
       odlist_size = od_size;
       memmove(odlist_buf, od_buf, od_size);
      } else {
       unsigned char *temp = new unsigned char[odlist_size + od_size];
       unsigned char *pTemp = temp;
       memmove(pTemp, odlist_buf, odlist_size);
       pTemp += odlist_size;
       memmove(pTemp, od_buf, od_size);
       odlist_size += od_size;
       delete [] odlist_buf;
       odlist_buf = temp;
      }
      /* free FrameMgr */
      FrameMgrFree(fm);
    }

    ICAttribute im_attr[2];
    int n = 0;
    if (imelist_size > 0) {
      im_attr[n].attribute_id = INPUT_METHOD_LIST;
      im_attr[n].value_length = imelist_size;
      im_attr[n].value = (void*)imelist_buf;
      n++;
    }
    if (odlist_size > 0) {
      im_attr[n].attribute_id = OBJECT_DESCRIPTOR_LIST;
      im_attr[n].value_length = odlist_size;
      im_attr[n].value = (void*)odlist_buf;
      n++;
    }
    if (n > 0) {
      send_imvalues_message(input_method_id, IM_SETIMVALUES,
                         im_attr, n);
    }

    delete [] imelist_buf;
    delete [] odlist_buf;
  }

  // Send IM_SETIMVALUES_REPLY to the previous
  // IM_SETIMVALUES from the client.
#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, 0, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, 0, output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */

  respond_keepalive = True;
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::SetStringToFrame ( FrameMgr  fm,
UTFCHAR utf_str,
int  char_length 
) [private]

Definition at line 258 of file IIIMPClientDispatcher3.cpp.

                                            {
  CARD8 *str = (CARD8*)utf_str;
  const int one_unit = sizeof(UTFCHAR)/sizeof(char);
  for (CARD8 *strp = str; strp < &str[char_length * one_unit];) {
    CARD8 first_byte, second_byte;
    if (need_swap) {
      second_byte = *strp++;
      first_byte  = *strp++;
    } else {
      first_byte  = *strp++;
      second_byte = *strp++;
    }
    FrameMgrPutToken(fm, first_byte);
    FrameMgrPutToken(fm, second_byte);
  }
}

Here is the caller graph for this function:

void IIIMPClient::SetStringToFrame ( FrameMgr  fm,
char *  str,
int  length 
) [private]

Definition at line 277 of file IIIMPClientDispatcher3.cpp.

                                       {
  CARD8 first_byte, second_byte;
  if (need_swap) {
    for (char *strp = str; strp < &str[length];) {
      CARD16 c = (CARD16)(*(strp++));
      first_byte = *((CARD8 *)(&c) + 1);
      second_byte = *((CARD8 *)(&c) + 0);
      FrameMgrPutToken(fm, first_byte);
      FrameMgrPutToken(fm, second_byte);
    }
  } else {
    for (char *strp = str; strp < &str[length];) {
      CARD16 c = (CARD16)(*(strp++));
      first_byte = *((CARD8 *)(&c) + 0);
      second_byte = *((CARD8 *)(&c) + 1);
      FrameMgrPutToken(fm, first_byte);
      FrameMgrPutToken(fm, second_byte);
    }
  }
}
void * IIIMPClient::socket_listener ( void *  data) [static]

Definition at line 104 of file IIIMPClient.cpp.

                                              {
  IIIMPClient *client = (IIIMPClient*)client_data;
  unsigned char *message;
  int flag = True;

  // wait for IM_CONNECT message
  message = client->get_im_connect();
  client->dispatch(message, flag);
  if (flag == 1) delete message;

  while (1) {
    if (client->accept_fd == 0) return 0;
    switch (client->Select()) {
    case IMTransAccept::Trans_TIMEOUT:
      // timeout
      if (client->being_deleted) {
       delete client;
       return 0;
      }
      continue;
      break;
    case IMTransAccept::Trans_ACCEPT:
      // get a message
      client->being_deleted = False;
      if ((message = client->get_amessage()) == 0) {
       // client dies
       delete client;              // kill self
       return 0;
      }
      client->dispatch(message, flag);
      if (flag == 1) delete message;
      break;
    case IMTransAccept::Trans_ERROR:
    default:
      // error
      delete client;
      break;
    }
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1129 of file IIIMPClientCB.cpp.

                                                        {
#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(im_id, status_CB->icid, IM_STATUS_DONE);
#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_status_done_fr[];
  send_message(im_id,
              status_CB->icid,
              im_status_done_fr, IM_STATUS_DONE);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1117 of file IIIMPClientCB.cpp.

                                                        {
  IMStatusDrawCallbackStruct *draw =
    (IMStatusDrawCallbackStruct *)&status_CB->status->todo.draw;

  if (draw->text != NULL && draw->text->char_length == 0)
    return status_draw_string(status_CB);
  else
    return status_draw_text(status_CB);

  return False;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::status_draw_string ( IMStatusCBStruct status_CB) [private]

Definition at line 838 of file IIIMPClientCB.cpp.

                                                               {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *data;
  char buf[256];
  char *ptr;
  int total_size;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_status_draw_string_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMStatusDrawCallbackStruct *draw =
    (IMStatusDrawCallbackStruct *)&status_CB->status->todo.draw;
  IMText *text = draw->text;

  if (text->char_length == 0) {
    return True;     /* no string to commit */
  }

#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_status_draw_string_fr, NULL, need_swap);
#endif /* USE_FRAMEMGR_ALWAYS */
                  
  int text_length = text->char_length;
  UTFCHAR *utf_chars;

  if (text->encoding == UTF16_CODESET) {
    utf_chars = text->text.utf_chars;
    if (*utf_chars == 0xfffe || *utf_chars == 0xfeff) {
      utf_chars++;
      text_length -= 1;
    }
  } else {
#ifdef DEBUG
    // cerr << "need to do convertion" << endl;
#endif
    utf_chars = 0;
  }
#if !defined(USE_FRAMEMGR_ALWAYS)
  total_size = 4;           /* IIIMP header */
  total_size += (2 + 2);    /* imid + icid */
  total_size += 4;          /* type of CONTENTS */
  total_size += 2;          /* byte length of string */
  total_size += (2 * text_length);
  if (total_size & 0x02) {  /* padding */
    total_size += 2;
  }
  if ((sizeof (buf)) < total_size) {
    data = new char[total_size];
  } else {
    data = buf;
  }
  ptr = (data + 4);
  if (False == need_swap) {
    req_put16(ptr, im_id);
    req_put16(ptr, status_CB->icid);
    req_put32(ptr, 0);             /* #0 for STRING */
    for (int i = 0; i < text_length; i++) {
      req_put16(ptr, *(utf_chars + i));
    }
  } else {
    req_put16s(ptr, im_id);
    req_put16s(ptr, status_CB->icid);
    req_put32s(ptr, 0);            /* #0 for STRING */
    for (int i = 0; i < text_length; i++) {
      req_put16s(ptr, *(utf_chars + i));
    }
  }
  if (total_size & 0x02) {  /* padding */
    req_put16(ptr, 0);             /* no need to swap byte */
  }
  send_message(IM_STATUS_DRAW, data, total_size);
  if ((sizeof (buf)) < total_size) {
    delete [] data;
  }
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgrSetIterCount(fm, text_length);

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);

  int flag = 0;      /* #0 for STRING */
  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, status_CB->icid);
  FrameMgrPutToken(fm, flag);

  SetStringToFrame(fm, utf_chars, text_length);

  send_message(IM_STATUS_DRAW, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::status_draw_text ( IMStatusCBStruct status_CB) [private]

Definition at line 935 of file IIIMPClientCB.cpp.

                                                             {
#if !defined(USE_FRAMEMGR_ALWAYS)
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_status_draw_text_fr[];
#endif /* USE_FRAMEMGR_ALWAYS */
  IMStatusDrawCallbackStruct *draw =
    (IMStatusDrawCallbackStruct *)&status_CB->status->todo.draw;
  IMText *text = draw->text;
  int i, j;

#if !defined(USE_FRAMEMGR_ALWAYS)
  int text_length = text->char_length;
  UTFCHAR *utf_chars;

  if (text->encoding == UTF16_CODESET) {
    utf_chars = text->text.utf_chars;
    if (*utf_chars == 0xfffe || *utf_chars == 0xfeff) {
      utf_chars++;
      text_length -= 1;
    }
  } else {
    utf_chars = 0;
  }

  /* without FrameMgr */
  int         total_length;
  int         fa_len;
  int         cwf_len;
  int         annotation_len;
  int         contents_type;
  UTFCHAR *   ut;


  total_length = 0;
  fa_len = 0;
  cwf_len = 0;
  annotation_len = 0;
  contents_type = 1;        /* contents type #1 : TEXT */

  total_length += 4;        /* request header */

  total_length += 2;        /* im_id */
  total_length += 2;        /* ic_id */

  total_length += 4;        /* contents type */
  total_length += 4;        /* byte length of list of char_with_feedback */
  cwf_len += (2 * text_length);    /* unicode code element */
  cwf_len += (2 * text_length);    /* byte length of Feedback attribute */
                                   /* array */
  for (i = 0; i < text_length; i++) {     /* feedback_attr */
    fa_len += (8 * (text->feedback + i)->count_feedbacks);
  }
  cwf_len += fa_len;

  total_length += cwf_len;

  total_length += 4;        /* byte length of list of annotation */
  total_length += 0;        /* annotation is not supported yet */

  char * request;
  char * p;

  request = new char[total_length];
  p = (request + 4);

  if (False == need_swap) {
    req_put16(p, im_id);
    req_put16(p, status_CB->icid);
    req_put32(p, contents_type);
    req_put32(p, cwf_len);
    for (i = 0, ut = utf_chars; i < text_length; i++, ut++) {
      int cf;
      req_put16(p, *ut);
      cf = (text->feedback + i)->count_feedbacks;
      req_put16(p, (8 * cf));
      for (j = 0; j < cf; j++) {
       req_put32(p, ((text->feedback + i)->feedbacks + j)->type);
       req_put32(p, ((text->feedback + i)->feedbacks + j)->value);
      }
    }
    req_put32(p, annotation_len);  /* annotation is not supported yet */
  } else {
    req_put16s(p, im_id);
    req_put16s(p, status_CB->icid);
    req_put32s(p, contents_type);
    req_put32s(p, cwf_len);
    for (i = 0, ut = utf_chars; i < text_length; i++, ut++) {
      int cf;
      req_put16s(p, *ut);
      cf = (text->feedback + i)->count_feedbacks;
      req_put16s(p, (8 * cf));
      for (j = 0; j < cf; j++) {
       req_put32s(p, ((text->feedback + i)->feedbacks + j)->type);
       req_put32s(p, ((text->feedback + i)->feedbacks + j)->value);
      }
    }
    req_put32s(p, annotation_len); /* annotation is not supported yet */
  }

  send_message(IM_STATUS_DRAW, request, total_length);

  delete [] request;

  return True;

#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(im_status_draw_text_fr, NULL, need_swap);

  int text_length = text->char_length;
  UTFCHAR *utf_chars;

  if (text->encoding == UTF16_CODESET) {
    utf_chars = text->text.utf_chars;
    if (*utf_chars == 0xfffe || *utf_chars == 0xfeff) {
      utf_chars++;
      text_length -= 1;
    }
  } else {
#ifdef DEBUG
    // cerr << "need to do convertion" << endl;
#endif
    utf_chars = 0;
  }
  FrameMgrSetIterCount(fm, text_length);

  if (draw->text != NULL) {
    for (i = 0; i < text_length; i++) {
      IMFeedbackList *fbl = &(draw->text->feedback[i]);
      // set iteration count for list of feedback
      FrameMgrSetIterCount(fm, fbl->count_feedbacks);
    }
  }

  const int total_size = FrameMgrGetTotalSize(fm);
  CompoundString reply = CompoundString(total_size);
  memset(reply, 0, total_size);
  FrameMgrSetBuffer(fm, reply);
    
  FrameMgrPutToken(fm, im_id);
  FrameMgrPutToken(fm, status_CB->icid);
  int flag = 1;                    /* #1 for TEXT */
  FrameMgrPutToken(fm, flag);

  CARD8 *utf_str = (CARD8*)utf_chars;

  CARD8 *strp = utf_str;
  const int one_unit = sizeof(UTFCHAR)/sizeof(char);
  for (i = 0; i < text_length, strp < &utf_str[text_length * one_unit];
       i++) {
    CARD8 first_byte, second_byte;
    if (need_swap) {
      second_byte = *strp++;
      first_byte  = *strp++;
    } else {
      first_byte  = *strp++;
      second_byte = *strp++;
    }
    FrameMgrPutToken(fm, first_byte);
    FrameMgrPutToken(fm, second_byte);

    if (text != NULL) {
       IMFeedbackList *fbl = &(text->feedback[i]);
        for (j = 0; j < fbl->count_feedbacks; j++){
         IMFeedback *fb = &(fbl->feedbacks[j]);
         FrameMgrPutToken(fm, fb->type);
         FrameMgrPutToken(fm, fb->value);
       }
    }
  }
  int annotation_len = 0; /* annotation is not used */
  FrameMgrPutToken(fm, annotation_len); /* annotation_len = 0 */

  send_message(IM_STATUS_DRAW, reply, total_size);
  /* free FrameMgr */
  FrameMgrFree(fm);

  return True;
#endif /* USE_FRAMEMGR_ALWAYS */
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 827 of file IIIMPClientCB.cpp.

                                                         {
#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(im_id, status_CB->icid, IM_STATUS_START);
#else /* USE_FRAMEMGR_ALWAYS */
  extern XimFrameRec im_status_start_fr[];
  send_message(im_id, status_CB->icid,
              im_status_start_fr, IM_STATUS_START);
#endif /* USE_FRAMEMGR_ALWAYS */
  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::string_list_count ( char *  p) [private]

Definition at line 56 of file IIIMPClientAuxSetValues.cpp.

                                      {
  char *ptr;
  CARD32 str_list_size; 
  int num;
  CARD16 str_size;

  num = 0;
  ptr = p;
  if (False == need_swap) {
    req_get32(ptr, str_list_size);
    if (str_list_size & 0x03) {
      str_list_size &= (~0x03);
    }

    while (4 <= str_list_size) {
      req_get16(ptr, str_size);
      str_list_size -= 2;
      if ((str_size + 2) & 0x03) { /* padding */
       str_size = (((str_size + 2) & (~0x03)) + 2);
      }
      if (str_list_size < str_size) {
       str_size = str_list_size;
      }

      ptr += str_size;
      str_list_size -= str_size;
      num += 1;
    }
  } else {
    req_get32s(ptr, str_list_size);
    if (str_list_size & 0x03) {
      str_list_size &= (~0x03);
    }

    while (4 <= str_list_size) {
      req_get16s(ptr, str_size);
      str_list_size -= 2;
      if ((str_size + 2) & 0x03) { /* padding */
       str_size = (((str_size + 2) & (~0x03)) + 2);
      }
      if (str_list_size < str_size) {
       str_size = str_list_size;
      }

      ptr += str_size;
      str_list_size -= str_size;
      num += 1;
    }
  }
  return num;
}

Here is the caller graph for this function:

int IIIMPClient::string_list_count2 ( char *  p,
int  str_list_size 
) [private]

Definition at line 56 of file IIIMPClientDispatcher.cpp.

                                                          {
  char *ptr;
  int num;
  CARD16 str_size;

  num = 0;
  ptr = p;

  if (str_list_size & 0x03) {
    str_list_size &= (~0x03);
  }

  if (False == need_swap) {
    while (4 <= str_list_size) {
      req_get16(ptr, str_size);
      str_list_size -= 2;
      if ((str_size + 2) & 0x03) { /* padding */
       str_size = (((str_size + 2) & (~0x03)) + 2);
      }
      if (str_list_size < str_size) {
       str_size = str_list_size;
      }

      ptr += str_size;
      str_list_size -= str_size;
      num += 1;
    }
  } else {
    while (4 <= str_list_size) {
      req_get16s(ptr, str_size);
      str_list_size -= 2;
      if ((str_size + 2) & 0x03) { /* padding */
       str_size = (((str_size + 2) & (~0x03)) + 2);
      }
      if (str_list_size < str_size) {
       str_size = str_list_size;
      }

      ptr += str_size;
      str_list_size -= str_size;
      num += 1;
    }
  }
  return num;
}

Here is the caller graph for this function:

void IIIMPClient::trigger_notify ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 853 of file IIIMPClientDispatcher.cpp.

                                                                         {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char data[4 + 2 + 2];
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_trigger_notify_fr[], im_trigger_notify_reply_fr[];
  XimFrameRec *input_fr = im_trigger_notify_fr;
  XimFrameRec *output_fr = im_trigger_notify_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD16 input_method_id, input_context_id;
  CARD16 flag;
  const int IM_OUTPUT_REPLY = IM_TRIGGER_NOTIFY_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
    req_get16(ptr, flag);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
    req_get16s(ptr, flag);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);
  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);
  FrameMgrGetToken(fm, flag);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  InputContext *ic = &(input_context_list.getItem(input_context_id));
  if (ic) {
    if (flag == 0)
      iiim_protocol->proto_handler->StartConversion((InputContext*)ic);
    else
      iiim_protocol->proto_handler->EndConversion((InputContext*)ic);
  } else {
    // need to treat as an error
  }

#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, input_context_id, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, input_context_id,
              output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMPClient::unset_icfocus ( IMProtocolStruct call_data,
unsigned char *  p 
) [private]

Definition at line 510 of file IIIMPClientDispatcher.cpp.

                                                                        {
#if !defined(USE_FRAMEMGR_ALWAYS)
  char *ptr;
#else /* USE_FRAMEMGR_ALWAYS */
  FrameMgr fm;
  extern XimFrameRec im_unseticfocus_fr[], im_unseticfocus_reply_fr[];
  XimFrameRec *input_fr = im_unseticfocus_fr;
  XimFrameRec *output_fr = im_unseticfocus_reply_fr;
#endif /* USE_FRAMEMGR_ALWAYS */
  CARD16 input_method_id, input_context_id;
  const int IM_OUTPUT_REPLY = IM_UNSETICFOCUS_REPLY;

#if !defined(USE_FRAMEMGR_ALWAYS)
  ptr = (char *)p;
  if (False == need_swap) {
    req_get16(ptr, input_method_id);
    req_get16(ptr, input_context_id);
  } else {
    req_get16s(ptr, input_method_id);
    req_get16s(ptr, input_context_id);
  }
#else /* USE_FRAMEMGR_ALWAYS */
  /* create FrameMgr */
  fm = FrameMgrInit(input_fr, (char *)p, need_swap);

  /* get data */
  FrameMgrGetToken(fm, input_method_id);
  FrameMgrGetToken(fm, input_context_id);

  /* free FrameMgr */
  FrameMgrFree(fm);
#endif /* USE_FRAMEMGR_ALWAYS */

  InputContext *ic = &(input_context_list.getItem(input_context_id));
  if (ic) {
    iiim_protocol->proto_handler->UnsetICFocus((InputContext*)ic);
  } else { 
    // need to treate as an error
  }

#if !defined(USE_FRAMEMGR_ALWAYS)
  send_message(input_method_id, input_context_id, IM_OUTPUT_REPLY);
#else /* USE_FRAMEMGR_ALWAYS */
  send_message(input_method_id, input_context_id,
              output_fr, IM_OUTPUT_REPLY);
#endif /* USE_FRAMEMGR_ALWAYS */
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IIIMPClient::utf16_string_size ( int  len) [private]

Definition at line 203 of file IIIMPClientCB.cpp.

                                      {
  int size;
  size = 2;          /* byte length of LISTofCHAR */
  size += (2 * len); /* string */
  if (size & 0x02) { /* padding */
    size += 2;
  }

  return size;
}

Here is the caller graph for this function:

int IIIMPClient::write_data ( const char *  buf,
const int  len 
) const [private]

Definition at line 147 of file IIIMPClient.cpp.

                                                            {
  const int max_byte = MAX_RW_DATA_LEN;
#ifdef WIN32
  size_t size = 0;
#else
  ssize_t size = 0;
#endif
  char *bufp = (char *)buf;

  if (accept_fd == 0) return 0;

  for (int rest_len = len; rest_len > 0;
       rest_len -= max_byte, bufp += max_byte) {
    if (rest_len < max_byte) {
      size += accept_fd->write(bufp, rest_len);
      break;
    } else {
      size += accept_fd->write(bufp, max_byte);
    }
  }
  return size;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 227 of file IIIMPClient.hh.

int IIIMPClient::active_attr [private]

Definition at line 210 of file IIIMPClient.hh.

int IIIMPClient::alloc_attr [private]

Definition at line 209 of file IIIMPClient.hh.

int IIIMPClient::alloc_auth [private]

Definition at line 216 of file IIIMPClient.hh.

Definition at line 200 of file IIIMPClient.hh.

Definition at line 215 of file IIIMPClient.hh.

Definition at line 320 of file IIIMPClient.hh.

char IIIMPClient::byteOrder [private]

Definition at line 212 of file IIIMPClient.hh.

Definition at line 196 of file IIIMPClient.hh.

unsigned int IIIMPClient::im_id [private]

Definition at line 228 of file IIIMPClient.hh.

Definition at line 208 of file IIIMPClient.hh.

Definition at line 233 of file IIIMPClient.hh.

int IIIMPClient::need_swap [private]

Definition at line 221 of file IIIMPClient.hh.

Definition at line 202 of file IIIMPClient.hh.

Definition at line 201 of file IIIMPClient.hh.

Definition at line 203 of file IIIMPClient.hh.

Definition at line 323 of file IIIMPClient.hh.

Definition at line 231 of file IIIMPClient.hh.

Definition at line 197 of file IIIMPClient.hh.

Definition at line 205 of file IIIMPClient.hh.

Definition at line 206 of file IIIMPClient.hh.


The documentation for this class was generated from the following files: