~ubuntu-branches/ubuntu/saucy/m17n-lib/saucy

« back to all changes in this revision

Viewing changes to src/input.c

  • Committer: Bazaar Package Importer
  • Author(s): Harshula Jayasuriya
  • Date: 2010-11-23 01:39:29 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20101123013929-rs3kpqgu4kr3qx32
Tags: 1.6.2-1
* New upstream release 1.6.2.
* Update Standards-Version to Debian Policy 3.9.1. (No changes)
* debian/control: Depends: m17n-db and m17n-contrib. (Closes: #599643)
* PATCH: (make_locale): Don't call setlocale.  Just parse the arg NAME.
         (Closes: #601858)

Show diffs side-by-side

added added

removed removed

Lines of Context:
269
269
static MInputMethodInfo *get_im_info (MSymbol, MSymbol, MSymbol, MSymbol);
270
270
 
271
271
 
272
 
void
 
272
static void
273
273
fully_initialize ()
274
274
{
275
275
  char *key_names[32]
401
401
        msymbol_put (alias[j], M_key_alias, alias[j + 1]);
402
402
    }
403
403
 
404
 
  buf3[0] = 255;
 
404
  buf3[0] = (char) 255;
405
405
  alias[0] = alias[3] = msymbol (buf3);
406
406
  alias[1] = one_char_symbol[255] = msymbol ("M-Delete");
407
407
  alias[2] = msymbol ("A-Delete");
2395
2395
static int take_action_list (MInputContext *ic, MPlist *action_list);
2396
2396
static void preedit_commit (MInputContext *ic, int need_prefix);
2397
2397
 
 
2398
/* Shift to the state of name STATE_NAME.  If STATE_NAME is `t', shift
 
2399
   to the previous state (if any).  If STATE_NAME is `nil', shift to
 
2400
   the initial state.  */
 
2401
 
2398
2402
static void
2399
2403
shift_state (MInputContext *ic, MSymbol state_name)
2400
2404
{
2441
2445
    preedit_commit (ic, 0);
2442
2446
  mtext_cpy (ic_info->preedit_saved, ic->preedit);
2443
2447
  ic_info->state_pos = ic->cursor_pos;
2444
 
  if (state != orig_state)
 
2448
  if (state != orig_state || state_name == Mnil)
2445
2449
    {
2446
2450
      if (state == (MIMState *) MPLIST_VAL (im_info->states))
2447
2451
        {
2458
2462
      else
2459
2463
        ic->status = im_info->title;
2460
2464
      ic->status_changed = 1;
2461
 
      if (ic_info->map == ic_info->state->map
2462
 
          && ic_info->map->map_actions)
2463
 
        {
2464
 
          MDEBUG_PRINT1 ("  [IM] [%s] init-actions:",
2465
 
                         MSYMBOL_NAME (state->name));
2466
 
          take_action_list (ic, ic_info->map->map_actions);
2467
 
        }
 
2465
      ic_info->state_hook = ic_info->map->map_actions;
2468
2466
    }
2469
2467
}
2470
2468
 
3516
3514
  MSymbol alias = Mnil;
3517
3515
  int i;
3518
3516
 
 
3517
  if (ic_info->state_hook)
 
3518
    {
 
3519
      MDEBUG_PRINT1 ("  [IM] [%s] init-actions:",
 
3520
                     MSYMBOL_NAME (ic_info->state->name));
 
3521
      take_action_list (ic, ic_info->state_hook);
 
3522
      ic_info->state_hook = NULL;
 
3523
    }
 
3524
 
3519
3525
  MDEBUG_PRINT2 ("  [IM] [%s] handle `%s'", 
3520
3526
                 MSYMBOL_NAME (ic_info->state->name), msymbol_name (key));
3521
3527
 
3606
3612
              && ic_info->key_head < ic_info->used)
3607
3613
            {
3608
3614
              MDEBUG_PRINT (" unhandled\n");
 
3615
              ic_info->state_hook = map->map_actions;
3609
3616
              return -1;
3610
3617
            }
3611
3618
 
3788
3795
{
3789
3796
  MInputMethodInfo *im_info = get_im_info (im->language, im->name, Mnil, Mnil);
3790
3797
 
3791
 
  if (! im_info || ! im_info->states)
 
3798
  if (! im_info || ! im_info->states || MPLIST_LENGTH (im_info->states) == 0)
3792
3799
    MERROR (MERROR_IM, -1);
3793
3800
  im->info = im_info;
3794
3801
 
4004
4011
  memset (prefix, 32, indent);
4005
4012
  prefix[indent] = '\0';
4006
4013
 
4007
 
  fprintf (stderr, "(\"%s\" ", msymbol_name (key));
 
4014
  fprintf (mdebug__output, "(\"%s\" ", msymbol_name (key));
4008
4015
  if (map->map_actions)
4009
4016
    mdebug_dump_plist (map->map_actions, indent + 2);
4010
4017
  if (map->submaps)
4011
4018
    {
4012
4019
      MPLIST_DO (map_list, map->submaps)
4013
4020
        {
4014
 
          fprintf (stderr, "\n%s  ", prefix);
 
4021
          fprintf (mdebug__output, "\n%s  ", prefix);
4015
4022
          dump_im_map (map_list, indent + 2);
4016
4023
        }
4017
4024
    }
4018
4025
  if (map->branch_actions)
4019
4026
    {
4020
 
      fprintf (stderr, "\n%s  (branch\n%s    ", prefix, prefix);
 
4027
      fprintf (mdebug__output, "\n%s  (branch\n%s    ", prefix, prefix);
4021
4028
      mdebug_dump_plist (map->branch_actions, indent + 4);
4022
 
      fprintf (stderr, ")");      
 
4029
      fprintf (mdebug__output, ")");      
4023
4030
    }
4024
 
  fprintf (stderr, ")");
 
4031
  fprintf (mdebug__output, ")");
4025
4032
}
4026
4033
 
4027
4034
 
4035
4042
  memset (prefix, 32, indent);
4036
4043
  prefix[indent] = '\0';
4037
4044
 
4038
 
  fprintf (stderr, "(%s", msymbol_name (state->name));
 
4045
  fprintf (mdebug__output, "(%s", msymbol_name (state->name));
4039
4046
  if (state->map->submaps)
4040
4047
    {
4041
4048
      MPLIST_DO (map_list, state->map->submaps)
4042
4049
        {
4043
 
          fprintf (stderr, "\n%s  ", prefix);
 
4050
          fprintf (mdebug__output, "\n%s  ", prefix);
4044
4051
          dump_im_map (map_list, indent + 2);
4045
4052
        }
4046
4053
    }
4047
 
  fprintf (stderr, ")");
 
4054
  fprintf (mdebug__output, ")");
4048
4055
}
4049
4056
 
4050
4057
 
6346
6353
    @brief Dump an input method.
6347
6354
 
6348
6355
    The mdebug_dump_im () function prints the input method $IM in a
6349
 
    human readable way to the stderr.  $INDENT specifies how many
6350
 
    columns to indent the lines but the first one.
 
6356
    human readable way to the stderr or to what specified by the
 
6357
    environment variable MDEBUG_OUTPUT_FILE.  $INDENT specifies how
 
6358
    many columns to indent the lines but the first one.
6351
6359
 
6352
6360
    @return
6353
6361
    This function returns $IM.  */
6354
6362
/***ja
6355
6363
    @brief ���ϥ᥽�åɤ����פ���.
6356
6364
 
6357
 
    �ؿ� mdebug_dump_im () �����ϥ᥽�å� $IM �� stderr 
6358
 
    �˿ʹ֤˲��ɤʷ��ǰ������롣$INDENT �ϣ����ܰʹߤΥ���ǥ�Ȥ���ꤹ�롣
 
6365
    �ؿ� mdebug_dump_im () �����ϥ᥽�å� $IM ��ɸ�२�顼���Ϥ⤷����
 
6366
    �Ķ��ѿ� MDEBUG_DUMP_FONT �ǻ��ꤵ�줿�ե�����˿ʹ֤˲��ɤʷ��ǽ�
 
6367
    �Ϥ��롣$INDENT �ϣ����ܰʹߤΥ���ǥ�Ȥ���ꤹ�롣
6359
6368
 
6360
6369
    @return
6361
6370
    ���δؿ��� $IM ���֤���  */
6370
6379
  memset (prefix, 32, indent);
6371
6380
  prefix[indent] = '\0';
6372
6381
 
6373
 
  fprintf (stderr, "(input-method %s %s ", msymbol_name (im->language),
 
6382
  fprintf (mdebug__output, "(input-method %s %s ", msymbol_name (im->language),
6374
6383
           msymbol_name (im->name));
6375
6384
  mdebug_dump_mtext (im_info->title, 0, 0);
6376
6385
  if (im->name != Mnil)
6379
6388
 
6380
6389
      MPLIST_DO (state, im_info->states)
6381
6390
        {
6382
 
          fprintf (stderr, "\n%s  ", prefix);
 
6391
          fprintf (mdebug__output, "\n%s  ", prefix);
6383
6392
          dump_im_state (MPLIST_VAL (state), indent + 2);
6384
6393
        }
6385
6394
    }
6386
 
  fprintf (stderr, ")");
 
6395
  fprintf (mdebug__output, ")");
6387
6396
  return im;
6388
6397
}
6389
6398