Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

hello_world_ucs2.c

Example of UCS2 - Hello World in Russian.
/*
 * Copyright (C) 2003, 2004, 2005 BLADOX, s.r.o.  All rights reserved.
 * 
 * This file is part of an example program for Turbo. This example
 * program may be used, distributed and modified without limitation.
 *
 */

#include <config.h>
#include <turbo/turbo.h>

u8 PROGMEM t_menu[] = "\204\10\17\200\4\42\4\100\4\65\4\62\4\76\4\63\4\60";

/* *INDENT-OFF* */

lc_char PROGMEM lc_Text[] = {
  LC_RU ("\204\10\23\200\4\35\4\60\4\101\4\102\4\100\4\76\4\71\4\72\4\60")
  LC_END
};

lc_char PROGMEM lc_Text_1[] = {
  LC_RU ("\204\10\31\200\4\20\4\72\4\102\4\70\4\62\4\70\4\100\4\76\4\62\4\60\4\102\4\114")
  LC_END
};

lc_char PROGMEM lc_Text_2[] = {
  LC_RU ("\204\10\35\200\4\24\4\65\4\60\4\72\4\102\4\70\4\62\4\70\4\100\4\76\4\62\4\60\4\102\4\114")
  LC_END
};

lc_char PROGMEM lc_Text_3[] = {
  LC_RU ("\204\10\27\200\4\35\4\76\4\62\4\113\4\71\0\40\4\35\4\76\4\74\4\65\4\100")
  LC_END
};

/* *INDENT-ON* */

u8 show (SCtx * ctx, u8 action)
{
  if (action == APP_ENTER)
  {
    SNode *n = ctx->n;
    u8 *s = rw (&n->text);
    u8 i;

    s = locale (s);
    if (s)
    {
      i = display_text (s, NULL);
      if (i != APP_END)
        return APP_BACK;
      return i;
    }
    else
      return APP_BACK;
  }
  return APP_OK;
}

SNodeP ex_n = { lc_Text, NULL };
SNodeP ex_n_1 = { lc_Text_1, show };
SNodeP ex_n_2 = { lc_Text_2, show };
SNodeP ex_n_3 = { lc_Text_3, show };

/* *INDENT-OFF* */

SEdgeP ex_edges_p[] = {
  {&ex_n, &ex_n_1},
  {&ex_n, &ex_n_2},
  {&ex_n, &ex_n_3},
  NULL
};

/* *INDENT-ON* */

void action_menu (Menu_selection_data * x)
{
  u8 item = x->item;
  SCtx *c;

  c = spider_init ();
  c->eP = &ex_edges_p;
  c->n = &ex_n;
  spider (c);
}

void turbo_handler (u8 action, void *data)
{
  switch (action)
  {
    case ACTION_APP_INIT:
      set_proc_8 (PROC_8_LANGUAGE, LC_RUSSIAN);
      break;
    case ACTION_INSERT_MENU:
      insert_menu (t_menu);
      break;
    case ACTION_MENU_SELECTION:
      stk_thread (action_menu, data);
      break;
    default:
      break;
  }
}


Copyright © 2004-2006 BLADOX
Turbo version 1.2