/[qemacs]/qemacs/input.c
ViewVC logotype

Diff of /qemacs/input.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by chqrlie, Thu May 5 16:31:02 2005 UTC revision 1.4 by chqrlie, Wed May 11 15:48:31 2005 UTC
# Line 39  static int unicode_input(int *match_len_ Line 39  static int unicode_input(int *match_len_
39      c = 0;      c = 0;
40      if (len > 5)      if (len > 5)
41          len = 5;          len = 5;
42      for(i=1;i<len;i++) {      for (i = 1; i < len; i++) {
43          h = to_hex(buf[i]);          h = to_hex(buf[i]);
44          if (h == -1)          if (h == -1)
45              return INPUTMETHOD_NOMATCH;              return INPUTMETHOD_NOMATCH;
# Line 89  int kmap_input(int *match_len_ptr, Line 89  int kmap_input(int *match_len_ptr,
89      prefix_len = 0;      prefix_len = 0;
90      if (nb_prefixes > 0) {      if (nb_prefixes > 0) {
91          p1 = p;          p1 = p;
92          for(i=0;i<nb_prefixes;i++) {          for (i = 0; i < nb_prefixes; i++) {
93              if (buf[0] == p1[0])              if (buf[0] == p1[0])
94                  goto prefix_match;                  goto prefix_match;
95              p1 += 4;              p1 += 4;
# Line 105  int kmap_input(int *match_len_ptr, Line 105  int kmap_input(int *match_len_ptr,
105      match_char = 0;      match_char = 0;
106      match_count = 0;      match_count = 0;
107      last_outputc = 0;      last_outputc = 0;
108      for(;;) {      for (;;) {
109          match = 1;          match = 1;
110          l1 = prefix_len; /* length of input pattern */          l1 = prefix_len; /* length of input pattern */
111          for(;;) {          for (;;) {
112              c = *p++;              c = *p++;
113              d = c & 0x80;              d = c & 0x80;
114              c = c & 0x7f;              c = c & 0x7f;
# Line 173  static int input_method_fd; Line 173  static int input_method_fd;
173    
174  void load_input_methods(void)  void load_input_methods(void)
175  {  {
176      char buf[1024], *q;      char buf[MAX_FILENAME_SIZE], *q;
177      long file_size;      long file_size;
178      int fd, offset;      int fd, offset;
179      const unsigned char *file_ptr, *p;      const unsigned char *file_ptr, *p;
# Line 184  void load_input_methods(void) Line 184  void load_input_methods(void)
184      if (find_resource_file(buf, sizeof(buf), "kmaps") < 0)      if (find_resource_file(buf, sizeof(buf), "kmaps") < 0)
185          return;          return;
186    
187      fd = open (buf, O_RDONLY);      fd = open(buf, O_RDONLY);
188      if (fd < 0)      if (fd < 0)
189          return;          return;
190      file_size = lseek(fd, 0, SEEK_END);      file_size = lseek(fd, 0, SEEK_END);
# Line 199  void load_input_methods(void) Line 199  void load_input_methods(void)
199          goto fail;          goto fail;
200            
201      p = file_ptr + 4;      p = file_ptr + 4;
202      for(;;) {      for (;;) {
203          offset = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];          offset = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
204          p+= 4;          p += 4;
205          if (offset == 0)          if (offset == 0)
206              break;              break;
207          m = malloc(sizeof(InputMethod));          m = malloc(sizeof(InputMethod));
# Line 210  void load_input_methods(void) Line 210  void load_input_methods(void)
210              m->input_match = kmap_input;              m->input_match = kmap_input;
211              q = buf;              q = buf;
212              while (*p != '\0') {              while (*p != '\0') {
213                  if ((q - buf) < ((int)sizeof(buf) - 1))                  if (q < buf + sizeof(buf) - 1)
214                      *q++ = *p;                      *q++ = *p;
215                  p++;                  p++;
216              }              }
217              *q = '\0';              *q = '\0';
218              p++;              p++;
219              m->name =strdup(buf);              m->name = strdup(buf);
220              register_input_method(m);              register_input_method(m);
221          }          }
222      }      }
# Line 239  void input_completion(StringArray *cs, c Line 239  void input_completion(StringArray *cs, c
239      int len;      int len;
240    
241      len = strlen(input);      len = strlen(input);
242      for(m = input_methods; m != NULL; m = m->next) {      for (m = input_methods; m != NULL; m = m->next) {
243          if (!strncmp(m->name, input, len))          if (!strncmp(m->name, input, len))
244              add_string(cs, m->name);              add_string(cs, m->name);
245      }      }
# Line 250  void do_set_input_method(EditState *s, c Line 250  void do_set_input_method(EditState *s, c
250      InputMethod *m;      InputMethod *m;
251    
252      m = input_methods;      m = input_methods;
253      for(;;) {      for (;;) {
254          if (!m) {          if (!m) {
255              put_status(s, "'%s' not found", input_str);              put_status(s, "'%s' not found", input_str);
256              return;              return;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26