Browse Source

First step to implement utf-8. The tinyrl library contain utf8 flag.

git-svn-id: https://klish.googlecode.com/svn/trunk@338 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
c435c58a3e
3 changed files with 25 additions and 2 deletions
  1. 1 0
      tinyrl/private.h
  2. 18 2
      tinyrl/tinyrl.c
  3. 6 0
      tinyrl/tinyrl.h

+ 1 - 0
tinyrl/private.h

@@ -38,4 +38,5 @@ struct _tinyrl
                                               buffer for redisplay purposes */
     unsigned                  last_point; /* hold record of the previous 
                                               cursor position for redisplay purposes */
+    bool_t                    utf8; /* Is the encoding UTF-8 */
 };

+ 18 - 2
tinyrl/tinyrl.c

@@ -445,7 +445,8 @@ tinyrl_init(tinyrl_t                 *this,
         this->isatty = BOOL_FALSE;
     this->last_buffer                   = NULL;
     this->last_point                    = 0;
-    
+    this->utf8                          = BOOL_FALSE;
+
     /* create the vt100 terminal */
     this->term = tinyrl_vt100_new(instream,outstream);
 
@@ -1432,8 +1433,23 @@ tinyrl__get_prompt(const tinyrl_t *this)
 {
     return this->prompt;
 }
+
+/*-------------------------------------------------------- */
+bool_t
+tinyrl__get_utf8(const tinyrl_t *this)
+{
+    return this->utf8;
+}
+
 /*-------------------------------------------------------- */
-bool_t 
+void
+tinyrl__set_utf8(tinyrl_t *this, bool_t utf8)
+{
+    this->utf8 = utf8;
+}
+
+/*-------------------------------------------------------- */
+bool_t
 tinyrl_is_quoting(const tinyrl_t *this)
 {
     bool_t result = BOOL_FALSE;

+ 6 - 0
tinyrl/tinyrl.h

@@ -134,6 +134,12 @@ extern FILE *
 extern FILE *
     tinyrl__get_ostream(const tinyrl_t *instance);
 
+extern bool_t
+    tinyrl__get_utf8(const tinyrl_t *instance);
+
+extern void
+    tinyrl__set_utf8(tinyrl_t *instance, bool_t utf8);
+
 extern char *
     tinyrl_readline(tinyrl_t   *instance,
                     const char *prompt,