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

« back to all changes in this revision

Viewing changes to src/character.h

  • 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:
146
146
#define STRING_CHAR STRING_CHAR_UTF8
147
147
 
148
148
 
149
 
#define STRING_CHAR_ADVANCE_UTF8(p)                     \
150
 
  (!(*(p) & 0x80) ? *(p)++                              \
151
 
   : !(*(p) & 0x20) ? (((*(p)++ & 0x1F) << 6)           \
152
 
                       | (*(p)++ & 0x3F))               \
153
 
   : !(*(p) & 0x10) ? (((*(p)++ & 0x0F) << 12)          \
154
 
                       | ((*(p)++ & 0x3F) << 6)         \
155
 
                       | (*(p)++ & 0x3F))               \
156
 
   : !(*(p) & 0x08) ? (((*(p)++ & 0x07) << 18)          \
157
 
                       | ((*(p)++ & 0x3F) << 12)        \
158
 
                       | ((*(p)++ & 0x3F) << 6)         \
159
 
                       | (*(p)++ & 0x3F))               \
160
 
   : !(*(p) & 0x04) ? (((*(p)++ & 0x03) << 24)          \
161
 
                       | ((*(p)++ & 0x3F) << 18)        \
162
 
                       | ((*(p)++ & 0x3F) << 12)        \
163
 
                       | ((*(p)++ & 0x3F) << 6)         \
164
 
                       | (*(p)++ & 0x3F))               \
165
 
   : (((*(p)++ & 0x01) << 30)                           \
166
 
      | ((*(p)++ & 0x3F) << 24)                         \
167
 
      | ((*(p)++ & 0x3F) << 18)                         \
168
 
      | ((*(p)++ & 0x3F) << 12)                         \
169
 
      | ((*(p)++ & 0x3F) << 6)                          \
170
 
      | (*(p)++ & 0x3F)))
 
149
#define STRING_CHAR_ADVANCE_UTF8(p)                             \
 
150
  (!(*(p) & 0x80) ? ((p)++, (p)[-1])                            \
 
151
   : !(*(p) & 0x20) ? ((p) += 2, ((((p)[-2] & 0x1F) << 6)       \
 
152
                                  | ((p)[-1] & 0x3F)))          \
 
153
   : !(*(p) & 0x10) ? ((p) += 3, ((((p)[-3] & 0x0F) << 12)      \
 
154
                                  | (((p)[-2] & 0x3F) << 6)     \
 
155
                                  | ((p)[-1] & 0x3F)))          \
 
156
   : !(*(p) & 0x08) ? ((p) += 4, ((((p)[-4] & 0x07) << 18)      \
 
157
                                  | (((p)[-3] & 0x3F) << 12)    \
 
158
                                  | (((p)[-2] & 0x3F) << 6)     \
 
159
                                  | ((p)[-1] & 0x3F)))          \
 
160
   : !(*(p) & 0x04) ? ((p) += 5, ((((p)[-5] & 0x03) << 24)      \
 
161
                                  | (((p)[-4] & 0x3F) << 18)    \
 
162
                                  | (((p)[-3] & 0x3F) << 12)    \
 
163
                                  | (((p)[-2] & 0x3F) << 6)     \
 
164
                                  | ((p)[-1] & 0x3F)))          \
 
165
   : ((p) += 6, ((((p)[-6] & 0x01) << 30)                       \
 
166
                 | (((p)[-5] & 0x3F) << 24)                     \
 
167
                 | (((p)[-4] & 0x3F) << 18)                     \
 
168
                 | (((p)[-3] & 0x3F) << 12)                     \
 
169
                 | (((p)[-2] & 0x3F) << 6)                      \
 
170
                 | ((p)[-1] & 0x3F))))
171
171
 
172
 
#define STRING_CHAR_ADVANCE_UTF16(p)                                       \
173
 
  (((unsigned short) (p)[0] < 0xD800 || (unsigned short) (p)[0] >= 0xDC00) \
174
 
   ? *(p)++                                                                \
175
 
   : (((*(p)++ - 0xD800) << 10) + (*(p)++ - 0xDC00) + 0x10000))
 
172
#define STRING_CHAR_ADVANCE_UTF16(p)            \
 
173
  (((p)[0] < 0xD800 ||  (p)[0] >= 0xDC00)       \
 
174
   ? ((p)++, (p)[-1])                           \
 
175
   : ((p) += 2, ((((p)[-2] - 0xD800) << 10) + ((p)[-1] - 0xDC00) + 0x10000)))
176
176
 
177
177
#define STRING_CHAR_ADVANCE STRING_CHAR_ADVANCE_UTF8
178
178