Back to index

im-sdk  12.3.91
composer.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2003 Sun Microsystems Inc.
00003  *
00004  * This is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  *
00019  * Authors: Karl Park <karl.park@sun.com>
00020  */
00021 
00022 #ifndef COMPOSER_H
00023 #define COMPOSER_H
00024 #include <IMProtocolStruct.h>
00025 #include <SunIM.h>
00026 #include <koinput.h>
00027 #if 0
00028 #define logf(...) 
00029 #endif
00030 typedef enum _JAMO_T { JM_NONE, JAEUM, MOEUM } JAMO_T;
00031 
00032 typedef enum _CHOJUNGJONG_T {
00033   CJJ_NONE = -1,
00034   CJJ_CHOSUNG, CJJ_JUNGSUNG, CJJ_JONGSUNG
00035 } CHOJUNGJONG_T;
00036 
00037 typedef struct _HANGUL HANGUL, *HANGULList;
00038 
00039 typedef struct _Jamo Jamo;
00040 struct _Jamo {
00041   UTFCHAR first;
00042   UTFCHAR second;
00043   UTFCHAR coupled;
00044 };
00045 
00046 struct _HANGUL {
00047   Jamo L;                   /* leading consonant */
00048   Jamo V;                   /* vowel */
00049   Jamo T;                   /* trailing consonan */
00050   Bool completed;  
00051 };
00052 
00053 
00054 typedef struct _HANGULBuffer HANGULBuffer;
00055 struct _HANGULBuffer {
00056   int                count;
00057   HANGULList  *buffer;
00058 };
00059 
00060 typedef struct _MapInfo MapInfo;
00061 struct _MapInfo{
00062   unsigned short val;
00063   CHOJUNGJONG_T type;
00064 };
00065 
00066 
00067 typedef struct _KeymapData KeymapData;
00068 struct _KeymapData{
00069   MapInfo layout[LAYOUT_NUM];
00070 };
00071 
00072 typedef enum _ComposerRetVal {
00073   ComposerRetErr = -1, ComposerRetKeep, ComposerRetBreak,
00074 } AutomataRetVal;
00075 
00076 void
00077 composer_hangul_initialize (HANGUL *a_hangul);
00078 
00079 void
00080 composer_hangul_free (HANGUL *a_hangul);
00081 
00082 void
00083 composer_hangul_copy (HANGUL *dst, HANGUL *src);
00084 
00085 HANGULBuffer *
00086 composer_hangul_buffer_new (void);
00087 
00088 void
00089 composer_hangul_buffer_initialize (HANGULBuffer *hangul_buffer);
00090 
00091 
00092 HANGUL *
00093 composer_hangul_buffer_get_next_hangul (HANGULBuffer *hangul_buffer, HANGUL *current_hangul);
00094 
00095 int
00096 composer_hangul_buffer_get_hangul_length (HANGULBuffer *hangul_buffer);
00097 
00098 void
00099 composer_hangul_buffer_print (HANGULBuffer *hangul_buffer);
00100 
00101 Boolean
00102 composer_hangul_buffer_delete_hangul_character (HANGULBuffer *hangul_buffer, 
00103                                           Boolean delete_whole_character,
00104                                           HANGUL *deleted_hangul_return);
00105 /* create a copy of HANGUL a_hangul and append it to the array */
00106 HANGUL *
00107 composer_hangul_buffer_add_hangul (HANGULBuffer *hangul_buffer, HANGUL *a_hangul);
00108 
00109 
00110 /* NULL return indicates either
00111    hangul_buffer was not valid
00112    or
00113    there was not HANGUL element in the buffer
00114 */
00115 HANGUL *composer_hangul_buffer_get_last_hangul (HANGULBuffer *hangul_buffer);
00116 
00117 HANGUL *composer_hangul_buffer_pop_hangul (HANGULBuffer *hangul_buffer);
00118 
00119 UTFCHAR
00120 composer_hangul_combine_cho_jung_jong (HANGUL *a_hangul);
00121 
00122 int
00123 composer_hangul_automata_2pair (int keyCode, int keyChar, int state, HANGULBuffer *hangul_buffer, Config *pconfig);
00124 
00125 
00126 Boolean
00127 composer_hangul_hanja_lookup_start (HANGULBuffer *hangul_buffer,
00128                                     int *number_of_candidates,
00129                                     UTFCHAR ***hanja_list_return);
00130 Bool composer_hangul_buffer_get_content_in_u16 (HANGULBuffer *hbuf, UTFCHAR **u16hangul_return);
00131 
00132 
00133 
00134 Bool _jamo_is_clean (Jamo *jamo);
00135 UTFCHAR _jamo_get_value (Jamo *jamo);
00136 
00137 /* language engine configuartion methods */
00138 void composer_config_switch_codeset (Config *pconfig, int *newcodeset);
00139 void composer_config_switch_keyboard (Config *pconfig);
00140 void composer_config_switch_commit_method (Config *pconfig);
00141 
00142 UTFCHAR get_utf_input_by_keyboard (IMEKeyEventStruct *, KEYBOARD_LAYOUT_T);
00143 
00144 #endif /* COMPOSER_H */