~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to transcode_data.h

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2010-07-31 17:08:39 UTC
  • mfrom: (1.1.4 upstream) (8.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100731170839-j034dmpdqt1cc4p6
Tags: 1.9.2~svn28788-1
* New release based on upstream snapshot from the 1.9.2 branch,
  after 1.9.2 RC2. That branch is (supposed to be) binary-compatible
  with the 1.9.1 branch.
  + Builds fine on i386. Closes: #580852.
* Upgrade to Standards-Version: 3.9.1. No changes needed.
* Updated generated incs.
* Patches that still need work:
  + Unclear status, need more investigation:
   090729_fix_Makefile_deps.dpatch
   090803_exclude_rdoc.dpatch
   203_adjust_base_of_search_path.dpatch
   902_define_YAML_in_yaml_stringio.rb.dpatch
   919_common.mk_tweaks.dpatch
   931_libruby_suffix.dpatch
   940_test_thread_mutex_sync_shorter.dpatch
  + Maybe not needed anymore, keeping but not applying.
   102_skip_test_copy_stream.dpatch (test doesn't block anymore?)
   104_skip_btest_io.dpatch (test doesn't block anymore?)
   201_gem_prelude.dpatch (we don't use that rubygems anyway?)
   202_gem_default_dir.dpatch (we don't use that rubygems anyway?)
   940_test_file_exhaustive_fails_as_root.dpatch
   940_test_priority_fails.dpatch
   100518_load_libc_libm.dpatch
* Add disable-tests.diff: disable some tests that cause failures on FreeBSD.
  Closes: #590002, #543805, #542927.
* However, many new failures on FreeBSD. Since that version is still an
  improvement, add the check that makes test suite failures non-fatal on
  FreeBSD again. That still needs to be investigated.
* Re-add 903_skip_base_ruby_check.dpatch
* Add build-dependency on ruby1.8 and drop all pre-generated files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
  transcode_data.h -
4
4
 
5
 
  $Author: yugui $
 
5
  $Author: duerst $
6
6
  created at: Mon 10 Dec 2007 14:01:47 JST 2007
7
7
 
8
8
  Copyright (C) 2007 Martin Duerst
22
22
 
23
23
#define PType (unsigned int)
24
24
 
25
 
#define NOMAP   (PType 0x01)    /* single byte direct map */
 
25
#define NOMAP   (PType 0x01)    /* direct map */
26
26
#define ONEbt   (0x02)          /* one byte payload */
27
27
#define TWObt   (0x03)          /* two bytes payload */
28
28
#define THREEbt (0x05)          /* three bytes payload */
36
36
#define FUNso   (PType 0x0F)    /* function from start to output */
37
37
#define STR1    (PType 0x11)    /* string 4 <= len <= 259 bytes: 1byte length + content */
38
38
#define GB4bt   (PType 0x12)    /* GB18030 four bytes payload */
 
39
#define FUNsio  (PType 0x13)    /* function from start and info to output */
39
40
 
40
 
#define STR1_LENGTH(byte_addr) (*(byte_addr) + 4)
 
41
#define STR1_LENGTH(byte_addr) (unsigned int)(*(byte_addr) + 4)
41
42
#define STR1_BYTEINDEX(w) ((w) >> 6)
42
43
#define makeSTR1(bi) (((bi) << 6) | STR1)
43
44
#define makeSTR1LEN(len) ((len)-4)
44
45
 
45
46
#define o1(b1)          (PType((((unsigned char)(b1))<<8)|ONEbt))
46
47
#define o2(b1,b2)       (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|TWObt))
47
 
#define o3(b1,b2,b3)    (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned char)(b3))<<24)|THREEbt)&0xffffffffU))
 
48
#define o3(b1,b2,b3)    (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned int)(unsigned char)(b3))<<24)|THREEbt)&0xffffffffU))
48
49
#define o4(b0,b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned char)(b3))<<24)|((((unsigned char)(b0))&0x07)<<5)|FOURbt)&0xffffffffU))
49
 
#define g4(b0,b1,b2,b3) (PType(((((unsigned char)(b0))<<8)|(((unsigned char)(b2))<<16)|((((unsigned char)(b1))&0x0f)<<24)|((((unsigned char)(b3))&0x0f)<<28)|GB4bt)&0xffffffffU))
50
 
 
51
 
#define getBT1(a)       (((a)>> 8)&0xFF)
52
 
#define getBT2(a)       (((a)>>16)&0xFF)
53
 
#define getBT3(a)       (((a)>>24)&0xFF)
54
 
#define getBT0(a)       ((((a)>> 5)&0x07)|0xF0)   /* for UTF-8 only!!! */
55
 
 
56
 
#define getGB4bt0(a)    (((a)>> 8)&0xFF)
57
 
#define getGB4bt1(a)    (((a)>>24)&0x0F|0x30)
58
 
#define getGB4bt2(a)    (((a)>>16)&0xFF)
59
 
#define getGB4bt3(a)    (((a)>>28)&0x0F|0x30)
 
50
#define g4(b0,b1,b2,b3) (PType(((((unsigned char)(b0))<<8)|(((unsigned char)(b2))<<16)|((((unsigned char)(b1))&0x0f)<<24)|((((unsigned int)(unsigned char)(b3))&0x0f)<<28)|GB4bt)&0xffffffffU))
 
51
#define funsio(diff)    (PType((((unsigned int)(diff))<<8)|FUNsio))
 
52
 
 
53
#define getBT1(a)       ((unsigned char)((a)>> 8))
 
54
#define getBT2(a)       ((unsigned char)((a)>>16))
 
55
#define getBT3(a)       ((unsigned char)((a)>>24))
 
56
#define getBT0(a)       (((unsigned char)((a)>> 5)&0x07)|0xF0)   /* for UTF-8 only!!! */
 
57
 
 
58
#define getGB4bt0(a)    ((unsigned char)((a)>> 8))
 
59
#define getGB4bt1(a)    ((unsigned char)((a)>>24)&0x0F|0x30)
 
60
#define getGB4bt2(a)    ((unsigned char)((a)>>16))
 
61
#define getGB4bt3(a)    ((unsigned char)((a)>>28)&0x0F|0x30)
60
62
 
61
63
#define o2FUNii(b1,b2)  (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|FUNii))
62
64
 
69
71
  asciicompat_converter,        /* ASCII-compatible -> ASCII-compatible */
70
72
  asciicompat_decoder,          /* ASCII-incompatible -> ASCII-compatible */
71
73
  asciicompat_encoder           /* ASCII-compatible -> ASCII-incompatible */
72
 
  /* ASCII-incompatible -> ASCII-incompatible is intentionally ommitted. */
 
74
  /* ASCII-incompatible -> ASCII-incompatible is intentionally omitted. */
73
75
} rb_transcoder_asciicompat_type_t;
74
76
 
75
77
typedef struct rb_transcoder rb_transcoder;
98
100
    ssize_t (*finish_func)(void*, unsigned char*, size_t); /* -> output */
99
101
    ssize_t (*resetsize_func)(void*); /* -> len */
100
102
    ssize_t (*resetstate_func)(void*, unsigned char*, size_t); /* -> output */
 
103
    ssize_t (*func_sio)(void*, const unsigned char*, size_t, VALUE, unsigned char*, size_t); /* start -> output */
101
104
};
102
105
 
103
106
void rb_declare_transcoder(const char *enc1, const char *enc2, const char *lib);