1a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod/*
22409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 1998-2004  David Turner and Werner Lemberg
32409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 2004,2007,2009,2010  Red Hat, Inc.
405207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod * Copyright © 2011,2012  Google, Inc.
56b347138b597c41af24453f630336ba2fc033dc5Behdad Esfahbod *
68f0d7e0c3fd4b05c43ac449be4f374dc2dc56127Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
76b347138b597c41af24453f630336ba2fc033dc5Behdad Esfahbod *
8a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * Permission is hereby granted, without written agreement and without
9a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
10a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * software and its documentation for any purpose, provided that the
11a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
12a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * all copies of this software.
136b347138b597c41af24453f630336ba2fc033dc5Behdad Esfahbod *
14a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * DAMAGE.
19a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod *
20a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod *
26a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * Red Hat Author(s): Owen Taylor, Behdad Esfahbod
27468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod * Google Author(s): Behdad Esfahbod
286b347138b597c41af24453f630336ba2fc033dc5Behdad Esfahbod */
29a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod
30da8edbb62204dc39f93d500ef85929e234e0bd19Behdad Esfahbod#ifndef HB_BUFFER_PRIVATE_HH
31da8edbb62204dc39f93d500ef85929e234e0bd19Behdad Esfahbod#define HB_BUFFER_PRIVATE_HH
326b347138b597c41af24453f630336ba2fc033dc5Behdad Esfahbod
33c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-private.hh"
345c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod#include "hb-buffer.h"
35fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod#include "hb-object-private.hh"
36fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod#include "hb-unicode-private.hh"
376b347138b597c41af24453f630336ba2fc033dc5Behdad Esfahbod
386b347138b597c41af24453f630336ba2fc033dc5Behdad Esfahbod
3988474c6fdaf35c56368694a5b164f4988a004d49Behdad EsfahbodASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
40f1322e52d557726baa010be8d35a594748e8fa1aBehdad EsfahbodASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
41f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod
422f87cebe1062c7007021ebd05c1664e60da80825Behdad Esfahbod
432f87cebe1062c7007021ebd05c1664e60da80825Behdad Esfahbod/*
442f87cebe1062c7007021ebd05c1664e60da80825Behdad Esfahbod * hb_buffer_t
452f87cebe1062c7007021ebd05c1664e60da80825Behdad Esfahbod */
46f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod
471bc1cb3603167f5da309336f7018c8b0608ac104Behdad Esfahbodstruct hb_buffer_t {
48fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod  hb_object_header_t header;
496220e5fc0dad728e67a92e838d3ac275d032f2c7Behdad Esfahbod  ASSERT_POD ();
50d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod
51d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod  /* Information about how the text in the buffer should be treated */
524e4ef24e46f273ad2bdda2f718223e05b37dd50fBehdad Esfahbod
53a7c5046d6b676a32298b97403a49235f7f255161Behdad Esfahbod  hb_unicode_funcs_t *unicode; /* Unicode functions */
54a7c5046d6b676a32298b97403a49235f7f255161Behdad Esfahbod  hb_segment_properties_t props; /* Script, language, direction */
550c7df2222862122ebbdc8665a21d6771ef5e0252Behdad Esfahbod  hb_buffer_flags_t flags; /* BOT / EOT / etc. */
56d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod
57d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod  /* Buffer contents */
58d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod
5996fdc04e5c6daafce3d45e7508418e4db94df44cBehdad Esfahbod  hb_buffer_content_type_t content_type;
6096fdc04e5c6daafce3d45e7508418e4db94df44cBehdad Esfahbod
61e0db4b868f9fdd8e680890f87dd4e13a1c27b7a1Behdad Esfahbod  bool in_error; /* Allocation failed */
62fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod  bool have_output; /* Whether we have an output buffer going on */
63fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod  bool have_positions; /* Whether we have positions */
64910a33fe8457a8e13f7eb77fc92fa59c31f5e8fdBehdad Esfahbod
65468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  unsigned int idx; /* Cursor into ->info and ->pos arrays */
66910a33fe8457a8e13f7eb77fc92fa59c31f5e8fdBehdad Esfahbod  unsigned int len; /* Length of ->info and ->pos arrays */
67cc1a8a938b4c13e76b58825a9e1951c4134e634aBehdad Esfahbod  unsigned int out_len; /* Length of ->out array if have_output */
68d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod
69c0af193c8e25c4f11d23b8893e9ce1c2d2615bb2Behdad Esfahbod  unsigned int allocated; /* Length of allocated arrays */
7088474c6fdaf35c56368694a5b164f4988a004d49Behdad Esfahbod  hb_glyph_info_t     *info;
7188474c6fdaf35c56368694a5b164f4988a004d49Behdad Esfahbod  hb_glyph_info_t     *out_info;
7288474c6fdaf35c56368694a5b164f4988a004d49Behdad Esfahbod  hb_glyph_position_t *pos;
73d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod
7499c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod  inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; }
7599c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod  inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; }
7699c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod
7799c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod  inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
7899c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod  inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
7999c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod
8099c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod  inline hb_glyph_info_t &prev (void) { return out_info[out_len - 1]; }
8199c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod  inline hb_glyph_info_t prev (void) const { return info[out_len - 1]; }
8299c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod
83f4a579bc42fb811ff5c391a0e97b7d8656ef59b1Behdad Esfahbod  unsigned int serial;
8405207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod
8505207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod  /* These reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
86f4a579bc42fb811ff5c391a0e97b7d8656ef59b1Behdad Esfahbod  uint8_t allocated_var_bytes[8];
87f4a579bc42fb811ff5c391a0e97b7d8656ef59b1Behdad Esfahbod  const char *allocated_var_owner[8];
88f4a579bc42fb811ff5c391a0e97b7d8656ef59b1Behdad Esfahbod
8905207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod  /* Text before / after the main buffer contents.
9005207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod   * Always in Unicode, and ordered outward.
9105207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod   * Index 0 is for "pre-context", 1 for "post-context". */
9205207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod  static const unsigned int CONTEXT_LENGTH = 5;
9305207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod  hb_codepoint_t context[2][CONTEXT_LENGTH];
9405207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod  unsigned int context_len[2];
9505207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod
96d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod
97d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod  /* Methods */
98468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod
99468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void reset (void);
10082ecaff736e245e117d70b6ec1497508c6eb08d2Behdad Esfahbod  HB_INTERNAL void clear (void);
101468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod
102cc1a8a938b4c13e76b58825a9e1951c4134e634aBehdad Esfahbod  inline unsigned int backtrack_len (void) const
103468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  { return have_output? out_len : idx; }
104dbf56b1d94910f04823e53e39ace1e5145bddc04Behdad Esfahbod  inline unsigned int next_serial (void) { return serial++; }
105468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod
106f4a579bc42fb811ff5c391a0e97b7d8656ef59b1Behdad Esfahbod  HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, const char *owner);
107f4a579bc42fb811ff5c391a0e97b7d8656ef59b1Behdad Esfahbod  HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, const char *owner);
108965c280de09b49d711cb78d629da321c802084deBehdad Esfahbod  HB_INTERNAL void assert_var (unsigned int byte_i, unsigned int count, const char *owner);
109a9ad3d3460ba863a8d8f3766ccbeab288c3c6822Behdad Esfahbod  HB_INTERNAL void deallocate_var_all (void);
110f4a579bc42fb811ff5c391a0e97b7d8656ef59b1Behdad Esfahbod
111468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void add (hb_codepoint_t  codepoint,
112468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod			unsigned int    cluster);
113847794e929831750e97525137ab5e285ccd1064eBehdad Esfahbod  HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info);
114468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod
115468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void reverse_range (unsigned int start, unsigned int end);
116468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void reverse (void);
117468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void reverse_clusters (void);
1183f82f8ff07a9d16a7c047129658c1bbedfdb5436Behdad Esfahbod  HB_INTERNAL void guess_segment_properties (void);
119468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod
120468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void swap_buffers (void);
1210bc7a38463bfb37f12efeb1b8cb2024cf4a347bcBehdad Esfahbod  HB_INTERNAL void remove_output (void);
122468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void clear_output (void);
123468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void clear_positions (void);
12469cc492dc120847ed00cae65ec958593ebf550c5Behdad Esfahbod
1259ebe8c0286856d46430ae184ba7303bd34485883Behdad Esfahbod  HB_INTERNAL void replace_glyphs (unsigned int num_in,
1269ebe8c0286856d46430ae184ba7303bd34485883Behdad Esfahbod				   unsigned int num_out,
1278e3715f8a16b315c1c7dd4b256e7f68a36c53e7cBehdad Esfahbod				   const hb_codepoint_t *glyph_data);
12869cc492dc120847ed00cae65ec958593ebf550c5Behdad Esfahbod
129468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void replace_glyph (hb_codepoint_t glyph_index);
130468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  /* Makes a copy of the glyph at idx to output and replace glyph_index */
131468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void output_glyph (hb_codepoint_t glyph_index);
132847794e929831750e97525137ab5e285ccd1064eBehdad Esfahbod  HB_INTERNAL void output_info (const hb_glyph_info_t &glyph_info);
133468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  /* Copies glyph at idx to output but doesn't advance idx */
134468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void copy_glyph (void);
135468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  /* Copies glyph at idx to output and advance idx.
136468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod   * If there's no output, just advance idx. */
1371be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod  inline void
1381be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod  next_glyph (void)
1391be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod  {
1401be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod    if (have_output)
1411be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod    {
1421be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod      if (unlikely (out_info != info || out_len != idx)) {
1431be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod	if (unlikely (!make_room_for (1, 1))) return;
1441be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod	out_info[out_len] = info[idx];
1451be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod      }
1461be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod      out_len++;
1471be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod    }
1481be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod
1491be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod    idx++;
1501be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod  }
1511be368e96fb7de8c77bf992874e0d5bd6b272ebeBehdad Esfahbod
152468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  /* Advance idx without copying to output. */
153468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  inline void skip_glyph (void) { idx++; }
1541ce7b87c4d8d1ab3ec1d5198351d71b7199f7c64Behdad Esfahbod
155bd7378b2ef9793de4e7f57b920f29f48ac9d0c25Behdad Esfahbod  inline void reset_masks (hb_mask_t mask)
156bd7378b2ef9793de4e7f57b920f29f48ac9d0c25Behdad Esfahbod  {
15731f18abecb149f8888a72510f2660328dd6de16dBehdad Esfahbod    for (unsigned int j = 0; j < len; j++)
15831f18abecb149f8888a72510f2660328dd6de16dBehdad Esfahbod      info[j].mask = mask;
159bd7378b2ef9793de4e7f57b920f29f48ac9d0c25Behdad Esfahbod  }
160bd7378b2ef9793de4e7f57b920f29f48ac9d0c25Behdad Esfahbod  inline void add_masks (hb_mask_t mask)
161bd7378b2ef9793de4e7f57b920f29f48ac9d0c25Behdad Esfahbod  {
16231f18abecb149f8888a72510f2660328dd6de16dBehdad Esfahbod    for (unsigned int j = 0; j < len; j++)
16331f18abecb149f8888a72510f2660328dd6de16dBehdad Esfahbod      info[j].mask |= mask;
164bd7378b2ef9793de4e7f57b920f29f48ac9d0c25Behdad Esfahbod  }
165468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL void set_masks (hb_mask_t value,
166468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod			      hb_mask_t mask,
167468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod			      unsigned int cluster_start,
168468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod			      unsigned int cluster_end);
169468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod
170d4cc44716c1e098f8abbc0e495404598026ef242Behdad Esfahbod  HB_INTERNAL void merge_clusters (unsigned int start,
171d4cc44716c1e098f8abbc0e495404598026ef242Behdad Esfahbod				   unsigned int end);
172d4cc44716c1e098f8abbc0e495404598026ef242Behdad Esfahbod  HB_INTERNAL void merge_out_clusters (unsigned int start,
173d4cc44716c1e098f8abbc0e495404598026ef242Behdad Esfahbod				       unsigned int end);
174d4cc44716c1e098f8abbc0e495404598026ef242Behdad Esfahbod
175468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  /* Internal methods */
176468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL bool enlarge (unsigned int size);
177468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod
178468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  inline bool ensure (unsigned int size)
179d16ccc4ae7aa8be460881042413fa2637929fedeBehdad Esfahbod  { return likely (size < allocated) ? true : enlarge (size); }
180468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod
181468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod  HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out);
182e62df43649e31b7815c272f01808b3f726c7d07dBehdad Esfahbod
183e62df43649e31b7815c272f01808b3f726c7d07dBehdad Esfahbod  HB_INTERNAL void *get_scratch_buffer (unsigned int *size);
18405207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod
18505207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod  inline void clear_context (unsigned int side) { context_len[side] = 0; }
186d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod};
187d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod
188d0316a81f59a4e814b0af78797d915d7ce04d119Behdad Esfahbod
189b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod#define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \
190b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod  b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
191b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod	   sizeof (b->info[0].var), owner)
192b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod#define HB_BUFFER_ALLOCATE_VAR(b, var) \
193b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod	HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
194b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod#define HB_BUFFER_DEALLOCATE_VAR(b, var) \
195b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod	HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var)
196965c280de09b49d711cb78d629da321c802084deBehdad Esfahbod#define HB_BUFFER_ASSERT_VAR(b, var) \
197965c280de09b49d711cb78d629da321c802084deBehdad Esfahbod	HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var)
198b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod
199b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod
200da8edbb62204dc39f93d500ef85929e234e0bd19Behdad Esfahbod#endif /* HB_BUFFER_PRIVATE_HH */
201