Back to index

im-sdk  12.3.91
Typedefs | Functions | Variables
im-message.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <iiimp-data.h>
#include <iiimp-opcode.h>
#include "iiimp-dataP.h"
#include "iiimp-message.h"
#include "print-misc.h"

Go to the source code of this file.

Typedefs

typedef void(* IIIMP_message_print_func )(IIIMP_data_s *data_s, IIIMP_message *m)

Functions

void iiimp_message_delete (IIIMP_data_s *data_s, IIIMP_message *m)
uchar_t * iiimp_message_pack (IIIMP_data_s *data_s, IIIMP_message *m, size_t *nbyte)
IIIMP_messageiiimp_message_unpack (IIIMP_data_s *data_s, IIIMP_card7 opcode, size_t *nbyte, const uchar_t **ptr)
void iiimp_message_header_print (IIIMP_data_s *data_s, int opcode, int im_id, int ic_id)
void iiimp_message_print (IIIMP_data_s *data_s, IIIMP_message *m)

Variables

static IIIMP_message_delete_func message_delete_func []
static IIIMP_message_unpack_func message_unpack_func []
static IIIMP_message_print_func message_print_func []

Typedef Documentation

typedef void(* IIIMP_message_print_func)(IIIMP_data_s *data_s, IIIMP_message *m)

Definition at line 614 of file im-message.c.


Function Documentation

void iiimp_message_delete ( IIIMP_data_s *  data_s,
IIIMP_message m 
)

Definition at line 169 of file im-message.c.

{
    (message_delete_func[m->opcode & 0x7f])(data_s, m);
    return;
}

Here is the caller graph for this function:

void iiimp_message_header_print ( IIIMP_data_s *  data_s,
int  opcode,
int  im_id,
int  ic_id 
)

Definition at line 596 of file im-message.c.

{
    if (im_id < 0) {
       (void)fprintf(data_s->print_fp, ":*:*:");
    } else if (ic_id < 0) {
       (void)fprintf(data_s->print_fp, ":%d:*:", im_id);
    } else {
       (void)fprintf(data_s->print_fp, ":%d:%d:", im_id, ic_id);
    }
    (void)fprintf(data_s->print_fp, " %s\n", opcode_string_get(opcode));
}

Here is the call graph for this function:

Here is the caller graph for this function:

uchar_t* iiimp_message_pack ( IIIMP_data_s *  data_s,
IIIMP_message m,
size_t *  nbyte 
)

Definition at line 177 of file im-message.c.

{
    uchar_t * p;
   
    switch (m->opcode) {
      case IM_DISCONNECT:
      case IM_DISCONNECT_REPLY:
      case IM_TRIGGER_NOTIFY_REPLY:
      case IM_HOTKEY_NOTIFY_REPLY:
      case IM_SETIMVALUES_REPLY:
      case IM_FORWARD_EVENT_REPLY:
      case IM_CREATEIC_REPLY:
      case IM_DESTROYIC:
      case IM_DESTROYIC_REPLY:
      case IM_SETICVALUES_REPLY:
      case IM_SETICFOCUS:
      case IM_SETICFOCUS_REPLY:
      case IM_UNSETICFOCUS:
      case IM_UNSETICFOCUS_REPLY:
      case IM_RESETIC:
      case IM_RESETIC_REPLY:
      case IM_PREEDIT_START:
      case IM_PREEDIT_DRAW_REPLY:
      case IM_PREEDIT_DONE:
      case IM_PREEDIT_DONE_REPLY:
      case IM_STATUS_START:
      case IM_STATUS_START_REPLY:
      case IM_STATUS_DRAW_REPLY:
      case IM_STATUS_DONE:
      case IM_STATUS_DONE_REPLY:
      case IM_LOOKUP_CHOICE_START_REPLY:
      case IM_LOOKUP_CHOICE_DRAW_REPLY:
      case IM_LOOKUP_CHOICE_DONE:
      case IM_LOOKUP_CHOICE_DONE_REPLY:
      case IM_LOOKUP_CHOICE_PROCESS_REPLY:
       p = iiimp_simple_pack(data_s, m->opcode, m->im_id, m->ic_id, nbyte);
       break;

      case IM_CONNECT:
       p = iiimp_connect_pack(data_s, m->v.connect.user_name,
                           m->v.connect.auth, nbyte);
       break;

      case IM_CONNECT_REPLY:
       p = iiimp_connect_reply_pack(data_s, m->im_id,
                                m->v.connect_reply.language, nbyte);
       break;

      case IM_REGISTER_TRIGGER_KEYS:
       p = iiimp_register_trigger_keys_pack(
          data_s, m->im_id,
          m->v.register_trigger_keys.trigger_on,
          m->v.register_trigger_keys.trigger_off, nbyte);
       break;

      case IM_TRIGGER_NOTIFY:
       p = iiimp_trigger_notify_pack(data_s, m->im_id, m->ic_id,
                                 m->v.trigger_notify.flag, nbyte);
       break;

      case IM_REGISTER_HOTKEYS:
       p = iiimp_register_hotkeys_pack(
          data_s, m->im_id, m->v.register_hotkeys.scope_and_profile_id,
          m->v.register_hotkeys.hotkeys, nbyte);
       break;

      case IM_HOTKEY_NOTIFY:
       p = iiimp_hotkey_notify_pack(data_s, m->im_id, m->ic_id,
                                m->v.hotkey_notify.hotkey_id, 
                                m->v.hotkey_notify.index,nbyte);
       break;

      case IM_HOTKEY_STATE_NOTIFY:
       p = iiimp_hotkey_state_notify_pack(data_s, m->im_id, m->ic_id,
                                     m->v.hotkey_state_notify.hotkey_id,
                                     m->v.hotkey_state_notify.current_state_flag,nbyte);
       break;

      case IM_SELECT_HOTKEY_PROFILE:
       p = iiimp_select_hotkey_profile_pack(data_s, m->im_id,
                                       m->v.select_hotkey_profile.scope_and_profile_id, nbyte);
       break;

      case IM_SETIMVALUES:
       p = iiimp_setimvalues_pack(data_s, m->im_id,
                              m->v.setimvalues.attr_list, nbyte);
       break;

      case IM_GETIMVALUES:
       p = iiimp_getimvalues_pack(data_s, m->im_id,
                              m->v.getimvalues.attr_list, nbyte);
       break;

      case IM_GETIMVALUES_REPLY:
       p = iiimp_getimvalues_reply_pack(data_s, m->im_id,
                                   m->v.getimvalues_reply.attr_list,
                                   nbyte);
       break;

      case IM_FORWARD_EVENT:
       p = iiimp_forward_event_pack(data_s, m->im_id, m->ic_id,
                                m->v.forward_event.contents,
                                nbyte);
       break;

      case IM_COMMIT_STRING:
       p = iiimp_commit_string_pack(data_s, m->im_id, m->ic_id,
                                m->v.commit_string.contents,
                                nbyte);
       break;

      case IM_FORWARD_EVENT_WITH_OPERATIONS:
       p = iiimp_forward_event_with_operations_pack(
          data_s, m->im_id, m->ic_id,
          m->v.forward_event_with_operations.contents,
          m->v.forward_event_with_operations.operation, nbyte);
       break;

      case IM_FORWARD_EVENT_WITH_OPERATIONS_REPLY:
       p = iiimp_forward_event_with_operations_reply_pack(
          data_s, m->im_id, m->ic_id,
          m->v.forward_event_with_operations_reply.operation,
          nbyte);
       break;

      case IM_CREATEIC:
       p = iiimp_createic_pack(data_s, m->im_id,
                            m->v.createic.attr_list, nbyte);
       break;

      case IM_SETICVALUES:
       p = iiimp_seticvalues_pack(data_s, m->im_id, m->ic_id,
                              m->v.seticvalues.attr_list, nbyte);
       break;

      case IM_GETICVALUES:
       p = iiimp_geticvalues_pack(data_s, m->im_id, m->ic_id,
                              m->v.geticvalues.attr_list, nbyte);
       break;

      case IM_GETICVALUES_REPLY:
       p = iiimp_geticvalues_reply_pack(data_s, m->im_id, m->ic_id,
                                   m->v.geticvalues_reply.attr_list,
                                   nbyte);
       break;

      case IM_PREEDIT_START_REPLY:
       p = iiimp_preedit_start_reply_pack(
          data_s, m->im_id, m->ic_id,
          m->v.preedit_start_reply.maximum_length, nbyte);
       break;

      case IM_PREEDIT_DRAW:
       p = iiimp_preedit_draw_pack(data_s, m->im_id, m->ic_id,
                               m->v.preedit_draw.caret,
                               m->v.preedit_draw.change_first,
                               m->v.preedit_draw.change_length,
                               m->v.preedit_draw.preedit,
                               nbyte);
       break;

      case IM_STATUS_DRAW:
       p = iiimp_status_draw_pack(data_s, m->im_id, m->ic_id,
                              m->v.status_draw.status, nbyte);
       break;

      case IM_LOOKUP_CHOICE_START:
       p = iiimp_lookup_choice_start_pack(
          data_s, m->im_id, m->ic_id,
          m->v.lookup_choice_start.master,
          m->v.lookup_choice_start.choice_per_window,
          m->v.lookup_choice_start.rows,
          m->v.lookup_choice_start.columns,
          m->v.lookup_choice_start.direction,
          m->v.lookup_choice_start.label_owner,
          nbyte);
       break;

      case IM_LOOKUP_CHOICE_DRAW:
       p = iiimp_lookup_choice_draw_pack(data_s, m->im_id, m->ic_id,
                                    m->v.lookup_choice_draw.first,
                                    m->v.lookup_choice_draw.last,
                                    m->v.lookup_choice_draw.current,
                                    m->v.lookup_choice_draw.choice,
                                    m->v.lookup_choice_draw.index_label,
                                    m->v.lookup_choice_draw.title, nbyte);
       break;

      case IM_LOOKUP_CHOICE_PROCESS:
       p = iiimp_lookup_choice_process_pack(data_s, m->im_id, m->ic_id,
                                       m->v.lookup_choice_process.type,
                                       m->v.lookup_choice_process.value,
                                       nbyte);
       break;

      case IM_AUX_START:
      case IM_AUX_START_REPLY:
      case IM_AUX_DRAW_REPLY:
      case IM_AUX_DONE_REPLY:
      case IM_AUX_DONE:
      case IM_AUX_SETVALUES_REPLY:
       p = iiimp_aux_simple_pack(data_s, m->opcode, m->im_id, m->ic_id,
                             m->v.aux_simple.class_index,
                             m->v.aux_simple.input_method_name,
                             nbyte);
       break;

      case IM_AUX_DRAW:
      case IM_AUX_SETVALUES:
      case IM_AUX_GETVALUES:
      case IM_AUX_GETVALUES_REPLY:
       p = iiimp_aux_value_pack(data_s, m->opcode, m->im_id, m->ic_id,
                            m->v.aux_value.class_index,
                            m->v.aux_value.input_method_name,
                            m->v.aux_value.integer_value,
                            m->v.aux_value.string_value,
                            nbyte);
       break;

      case IM_PROTOCOL_VERSION:
       p = iiimp_protocol_version_pack(data_s, m->im_id,
                                   m->v.protocol_version.number,
                                   nbyte);
       break;

      case IM_FILE_OPERATION:
       p = iiimp_file_operation_pack(data_s, m->im_id,
                                 m->v.file_operation.type,
                                 m->v.file_operation.value,
                                 nbyte);
       break;

      case IM_FILE_OPERATION_REPLY:
       p = iiimp_file_operation_reply_pack(data_s, m->im_id,
                                      m->v.file_operation_reply.type,
                                      m->v.file_operation_reply.value,
                                      nbyte);
       break;

      default:
       p = NULL;
       data_s->status = IIIMP_DATA_INVALID;
    }

    return p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void iiimp_message_print ( IIIMP_data_s *  data_s,
IIIMP_message m 
)

Definition at line 773 of file im-message.c.

{
    if (NULL == m) return;
    (message_print_func[0x7f & m->opcode])(data_s, m);
    // (message_print_func[m->opcode & 0x7f])(data_s, m);
}

Here is the caller graph for this function:

IIIMP_message* iiimp_message_unpack ( IIIMP_data_s *  data_s,
IIIMP_card7  opcode,
size_t *  nbyte,
const uchar_t **  ptr 
)

Definition at line 585 of file im-message.c.

{
    return (message_unpack_func[opcode & 0x7f])(data_s, opcode, nbyte, ptr);
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 13 of file im-message.c.

Definition at line 618 of file im-message.c.

Definition at line 428 of file im-message.c.