Skip to content

Instantly share code, notes, and snippets.

@db48x
Created May 29, 2018 08:38
Show Gist options
  • Save db48x/ac5185816f1b921bb8ca804883165e17 to your computer and use it in GitHub Desktop.
Save db48x/ac5185816f1b921bb8ca804883165e17 to your computer and use it in GitHub Desktop.
bindgen test
#include <stddef.h>
typedef unsigned int bool_bf;
/* Starting with Emacs 20.3, characters from strings and buffers have
both a character and a byte position associated with them. The
following structure holds such a pair of positions. */
struct text_pos
{
/* Character position. */
ptrdiff_t charpos;
/* Corresponding byte position. */
ptrdiff_t bytepos;
};
/* When rendering glyphs, redisplay scans string or buffer text,
overlay strings in that text, and does display table or control
character translations. The following structure captures a
position taking all this into account. */
struct display_pos
{
/* Buffer or string position. */
struct text_pos pos;
/* If this is a position in an overlay string, overlay_string_index
is the index of that overlay string in the sequence of overlay
strings at `pos' in the order redisplay processes them. A value
< 0 means that this is not a position in an overlay string. */
ptrdiff_t overlay_string_index;
/* If this is a position in an overlay string, string_pos is the
position within that string. */
struct text_pos string_pos;
/* If the character at the position above is a control character or
has a display table entry, dpvec_index is an index in the display
table or control character translation of that character. A
value < 0 means this is not a position in such a translation. */
int dpvec_index;
};
/* Area in window glyph matrix. If values are added or removed,
the function mark_glyph_matrix in alloc.c may need to be changed. */
enum glyph_row_area
{
ANY_AREA = -1,
LEFT_MARGIN_AREA,
TEXT_AREA,
RIGHT_MARGIN_AREA,
LAST_AREA
};
/* Number of bits allocated to store fringe bitmap numbers. */
#define FRINGE_ID_BITS 16
/* Number of bits allocated to store fringe bitmap height. */
#define FRINGE_HEIGHT_BITS 8
#define FACE_ID_BITS 20
struct glyph_row
{
/* Pointers to beginnings of areas. The end of an area A is found at
A + 1 in the vector. The last element of the vector is the end
of the whole row.
Kludge alert: Even if used[TEXT_AREA] == 0, glyphs[TEXT_AREA][0]'s
position field is used. It is -1 if this row does not correspond
to any text; it is some buffer position if the row corresponds to
an empty display line that displays a line end. This is what old
redisplay used to do. (Except in code for terminal frames, this
kludge is no longer used, I believe. --gerd).
See also start, end, displays_text_p and ends_at_zv_p for cleaner
ways to do it. The special meaning of positions 0 and -1 will be
removed some day, so don't use it in new code. */
struct glyph *glyphs[1 + LAST_AREA];
/* Number of glyphs actually filled in areas. This could have size
LAST_AREA, but it's 1 + LAST_AREA to simplify offset calculations. */
short used[1 + LAST_AREA];
/* Hash code. This hash code is available as soon as the row
is constructed, i.e. after a call to display_line. */
unsigned hash;
/* Window-relative x and y-position of the top-left corner of this
row. If y < 0, this means that eabs (y) pixels of the row are
invisible because it is partially visible at the top of a window.
If x < 0, this means that eabs (x) pixels of the first glyph of
the text area of the row are invisible because the glyph is
partially visible. */
int x, y;
/* Width of the row in pixels without taking face extension at the
end of the row into account, and without counting truncation
and continuation glyphs at the end of a row on ttys. */
int pixel_width;
/* Logical ascent/height of this line. The value of ascent is zero
and height is 1 on terminal frames. */
int ascent, height;
/* Physical ascent/height of this line. If max_ascent > ascent,
this line overlaps the line above it on the display. Otherwise,
if max_height > height, this line overlaps the line beneath it. */
int phys_ascent, phys_height;
/* Portion of row that is visible. Partially visible rows may be
found at the top and bottom of a window. This is 1 for tty
frames. It may be < 0 in case of completely invisible rows. */
int visible_height;
/* Extra line spacing added after this row. Do not consider this
in last row when checking if row is fully visible. */
int extra_line_spacing;
/* First position in this row. This is the text position, including
overlay position information etc, where the display of this row
started, and can thus be less than the position of the first
glyph (e.g. due to invisible text or horizontal scrolling).
BIDI Note: In R2L rows, that have its reversed_p flag set, this
position is at or beyond the right edge of the row. */
struct display_pos start;
/* Text position at the end of this row. This is the position after
the last glyph on this row. It can be greater than the last
glyph position + 1, due to a newline that ends the line,
truncation, invisible text etc. In an up-to-date display, this
should always be equal to the start position of the next row.
BIDI Note: In R2L rows, this position is at or beyond the left
edge of the row. */
struct display_pos end;
/* The smallest and the largest buffer positions that contributed to
glyphs in this row. Note that due to bidi reordering, these are
in general different from the text positions stored in `start'
and `end' members above, and also different from the buffer
positions recorded in the glyphs displayed the leftmost and
rightmost on the screen. */
struct text_pos minpos, maxpos;
/* Non-zero means the overlay arrow bitmap is on this line.
-1 means use default overlay arrow bitmap, else
it specifies actual fringe bitmap number. */
int overlay_arrow_bitmap;
/* Left fringe bitmap number (enum fringe_bitmap_type). */
unsigned left_user_fringe_bitmap : FRINGE_ID_BITS;
/* Right fringe bitmap number (enum fringe_bitmap_type). */
unsigned right_user_fringe_bitmap : FRINGE_ID_BITS;
/* Left fringe bitmap number (enum fringe_bitmap_type). */
unsigned left_fringe_bitmap : FRINGE_ID_BITS;
/* Right fringe bitmap number (enum fringe_bitmap_type). */
unsigned right_fringe_bitmap : FRINGE_ID_BITS;
/* Face of the left fringe glyph. */
unsigned left_user_fringe_face_id : FACE_ID_BITS;
/* Face of the right fringe glyph. */
unsigned right_user_fringe_face_id : FACE_ID_BITS;
/* Face of the left fringe glyph. */
unsigned left_fringe_face_id : FACE_ID_BITS;
/* Face of the right fringe glyph. */
unsigned right_fringe_face_id : FACE_ID_BITS;
/* Vertical offset of the left fringe bitmap. */
signed left_fringe_offset : FRINGE_HEIGHT_BITS;
/* Vertical offset of the right fringe bitmap. */
signed right_fringe_offset : FRINGE_HEIGHT_BITS;
/* True means that at least one of the left and right fringe bitmaps is
periodic and thus depends on the y-position of the row. */
bool_bf fringe_bitmap_periodic_p : 1;
/* True means that we must draw the bitmaps of this row. */
bool_bf redraw_fringe_bitmaps_p : 1;
/* In a desired matrix, true means that this row must be updated. In a
current matrix, false means that the row has been invalidated, i.e.
the row's contents do not agree with what is visible on the
screen. */
bool_bf enabled_p : 1;
/* True means row displays a text line that is truncated on the left or
right side. */
bool_bf truncated_on_left_p : 1;
bool_bf truncated_on_right_p : 1;
/* True means that this row displays a continued line, i.e. it has a
continuation mark at the right side. */
bool_bf continued_p : 1;
/* False means that this row does not contain any text, i.e., it is
a blank line at the window and buffer end. */
bool_bf displays_text_p : 1;
/* True means that this line ends at ZV. */
bool_bf ends_at_zv_p : 1;
/* True means the face of the last glyph in the text area is drawn to
the right end of the window. This flag is used in
update_text_area to optimize clearing to the end of the area. */
bool_bf fill_line_p : 1;
/* True means display a bitmap on X frames indicating that this
line contains no text and ends in ZV. */
bool_bf indicate_empty_line_p : 1;
/* True means this row contains glyphs that overlap each other because
of lbearing or rbearing. */
bool_bf contains_overlapping_glyphs_p : 1;
/* True means this row is as wide as the window it is displayed in, including
scroll bars, fringes, and internal borders. This also
implies that the row doesn't have marginal areas. */
bool_bf full_width_p : 1;
/* True means row is a mode or header-line. */
bool_bf mode_line_p : 1;
/* True in a current row means this row is overlapped by another row. */
bool_bf overlapped_p : 1;
/* True means this line ends in the middle of a character consisting
of more than one glyph. Some glyphs have been put in this row,
the rest are put in rows below this one. */
bool_bf ends_in_middle_of_char_p : 1;
/* True means this line starts in the middle of a character consisting
of more than one glyph. Some glyphs have been put in the
previous row, the rest are put in this row. */
bool_bf starts_in_middle_of_char_p : 1;
/* True in a current row means this row overlaps others. */
bool_bf overlapping_p : 1;
/* True means some glyphs in this row are displayed in mouse-face. */
bool_bf mouse_face_p : 1;
/* True means this row was ended by a newline from a string. */
bool_bf ends_in_newline_from_string_p : 1;
/* True means this row width is exactly the width of the window, and the
final newline character is hidden in the right fringe. */
bool_bf exact_window_width_line_p : 1;
/* True means this row currently shows the cursor in the right fringe. */
bool_bf cursor_in_fringe_p : 1;
/* True means the last glyph in the row is part of an ellipsis. */
bool_bf ends_in_ellipsis_p : 1;
/* True means display a bitmap on X frames indicating that this
the first line of the buffer. */
bool_bf indicate_bob_p : 1;
/* True means display a bitmap on X frames indicating that this
the top line of the window, but not start of the buffer. */
bool_bf indicate_top_line_p : 1;
/* True means display a bitmap on X frames indicating that this
the last line of the buffer. */
bool_bf indicate_eob_p : 1;
/* True means display a bitmap on X frames indicating that this
the bottom line of the window, but not end of the buffer. */
bool_bf indicate_bottom_line_p : 1;
/* True means the row was reversed to display text in a
right-to-left paragraph. */
bool_bf reversed_p : 1;
/* Continuation lines width at the start of the row. */
int continuation_lines_width;
#ifdef HAVE_WINDOW_SYSTEM
/* Non-NULL means the current clipping area. This is temporarily
set while exposing a region. Coordinates are frame-relative. */
XRectangle *clip;
#endif
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment