のねのBlog

パソコンやソフト開発で起きた問題など書きます。よろしくお願いします。

HB_BUFFER_FLAG_BOT

177 typedef enum { /*< flags >*/
178  HB_BUFFER_FLAG_DEFAULT			= 0x00000000u,
179  HB_BUFFER_FLAG_BOT				= 0x00000001u, /* Beginning-of-text */
180  HB_BUFFER_FLAG_EOT				= 0x00000002u, /* End-of-text */
181  HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES	= 0x00000004u
182 } hb_buffer_flags_t;
205  void setup_buffer (hb_buffer_t *buffer)
206  {
207    hb_buffer_set_direction (buffer, hb_direction_from_string (direction, -1));
208    hb_buffer_set_script (buffer, hb_script_from_string (script, -1));
209    hb_buffer_set_language (buffer, hb_language_from_string (language, -1));
210    hb_buffer_set_flags (buffer, (hb_buffer_flags_t) (HB_BUFFER_FLAG_DEFAULT |
211			 (bot ? HB_BUFFER_FLAG_BOT : 0) |
212			 (eot ? HB_BUFFER_FLAG_EOT : 0) |
213			 (preserve_default_ignorables ? HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES : 0)));
214    hb_buffer_set_cluster_level (buffer, cluster_level);
215    hb_buffer_guess_segment_properties (buffer);
216  }
1073 void
1074 hb_buffer_set_flags (hb_buffer_t       *buffer,
1075		     hb_buffer_flags_t  flags)
1076 {
1077  if (unlikely (hb_object_is_inert (buffer)))
1078    return;
1079
1080  buffer->flags = flags;
1081 }
145 static inline bool hb_object_is_inert (const Type *obj)
146 {
147  return unlikely (obj->header.ref_count.is_inert ());
148 }
64  inline bool is_inert (void) const { return ref_count.get_unsafe () == HB_REFERENCE_COUNT_INERT_VALUE; }
65  inline bool is_valid (void) const { return ref_count.get_unsafe () > 0; }
47
48/* reference_count */
49
50 #define HB_REFERENCE_COUNT_INERT_VALUE -1
51 #define HB_REFERENCE_COUNT_POISON_VALUE -0x0000DEAD
52 #define HB_REFERENCE_COUNT_INIT {HB_ATOMIC_INT_INIT(HB_REFERENCE_COUNT_INERT_VALUE)}
53
54struct hb_reference_count_t
55{
56  hb_atomic_int_t ref_count;
57
58  inline void init (int v)                      { ref_count.set_unsafe (v); }
59  inline int get_unsafe (void) const { return ref_count.get_unsafe (); }
60  inline int inc (void)                         { return ref_count.inc (); }
61  inline int dec (void)                        { return ref_count.dec (); }
62  inline void finish (void) { ref_count.set_unsafe (HB_REFERENCE_COUNT_POISON_VALUE); }
63