diff src/libvterm/include/vterm.h @ 17777:811a12a78164 v8.1.1885

patch 8.1.1885: comments in libvterm are inconsistent commit https://github.com/vim/vim/commit/db1085a5630ffdaa2e9f342c06cc739ebdf1a99a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 18 20:41:38 2019 +0200 patch 8.1.1885: comments in libvterm are inconsistent Problem: Comments in libvterm are inconsistent. Solution: Use // comments. Als update the table of combining characters.
author Bram Moolenaar <Bram@vim.org>
date Sun, 18 Aug 2019 20:45:04 +0200
parents 2449b6ce1456
children e8d1f3209dcd
line wrap: on
line diff
--- a/src/libvterm/include/vterm.h
+++ b/src/libvterm/include/vterm.h
@@ -15,7 +15,7 @@ extern "C" {
 #define TRUE 1
 #define FALSE 0
 
-/* from stdint.h */
+// from stdint.h
 typedef unsigned char		uint8_t;
 typedef unsigned int		uint32_t;
 
@@ -23,7 +23,7 @@ typedef struct VTerm VTerm;
 typedef struct VTermState VTermState;
 typedef struct VTermScreen VTermScreen;
 
-/* Specifies a screen point. */
+// Specifies a screen point.
 typedef struct {
   int row;
   int col;
@@ -48,7 +48,7 @@ INLINE int vterm_pos_cmp(VTermPos a, VTe
 }
 #endif
 
-/* Specifies a rectangular screen area. */
+// Specifies a rectangular screen area.
 typedef struct {
   int start_row;
   int end_row;
@@ -56,7 +56,7 @@ typedef struct {
   int end_col;
 } VTermRect;
 
-/* Return true if the rect "r" contains the point "p". */
+// Return true if the rect "r" contains the point "p".
 int vterm_rect_contains(VTermRect r, VTermPos p);
 
 #if defined(DEFINE_INLINES) || USE_INLINE
@@ -67,8 +67,8 @@ INLINE int vterm_rect_contains(VTermRect
 }
 #endif
 
-/* Move "rect" "row_delta" down and "col_delta" right.
- * Does not check boundaries. */
+// Move "rect" "row_delta" down and "col_delta" right.
+// Does not check boundaries.
 void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta);
 
 #if defined(DEFINE_INLINES) || USE_INLINE
@@ -79,12 +79,12 @@ INLINE void vterm_rect_move(VTermRect *r
 }
 #endif
 
-/* The ansi_index is used for the lower 16 colors, which can be set to any
- * color. */
-#define VTERM_ANSI_INDEX_DEFAULT 0	/* color cleared */
+// The ansi_index is used for the lower 16 colors, which can be set to any
+// color.
+#define VTERM_ANSI_INDEX_DEFAULT 0	// color cleared
 #define VTERM_ANSI_INDEX_MIN 1
 #define VTERM_ANSI_INDEX_MAX 16
-#define VTERM_ANSI_INDEX_NONE 255	/* non-ANSI color, use red/green/blue */
+#define VTERM_ANSI_INDEX_NONE 255	// non-ANSI color, use red/green/blue
 
 typedef struct {
   uint8_t red, green, blue;
@@ -92,7 +92,7 @@ typedef struct {
 } VTermColor;
 
 typedef enum {
-  /* VTERM_VALUETYPE_NONE = 0 */
+  // VTERM_VALUETYPE_NONE = 0
   VTERM_VALUETYPE_BOOL = 1,
   VTERM_VALUETYPE_INT,
   VTERM_VALUETYPE_STRING,
@@ -109,7 +109,7 @@ typedef union {
 } VTermValue;
 
 typedef enum {
-  /* VTERM_ATTR_NONE = 0 */
+  // VTERM_ATTR_NONE = 0
   VTERM_ATTR_BOLD = 1,   // bool:   1, 22
   VTERM_ATTR_UNDERLINE,  // number: 4, 21, 24
   VTERM_ATTR_ITALIC,     // bool:   3, 23
@@ -124,7 +124,7 @@ typedef enum {
 } VTermAttr;
 
 typedef enum {
-  /* VTERM_PROP_NONE = 0 */
+  // VTERM_PROP_NONE = 0
   VTERM_PROP_CURSORVISIBLE = 1, // bool
   VTERM_PROP_CURSORBLINK,       // bool
   VTERM_PROP_ALTSCREEN,         // bool
@@ -158,33 +158,33 @@ enum {
 typedef struct {
   const uint32_t *chars;
   int             width;
-  unsigned int    protected_cell:1;  /* DECSCA-protected against DECSEL/DECSED */
-  unsigned int    dwl:1;             /* DECDWL or DECDHL double-width line */
-  unsigned int    dhl:2;             /* DECDHL double-height line (1=top 2=bottom) */
+  unsigned int    protected_cell:1;  // DECSCA-protected against DECSEL/DECSED
+  unsigned int    dwl:1;             // DECDWL or DECDHL double-width line
+  unsigned int    dhl:2;             // DECDHL double-height line (1=top 2=bottom)
 } VTermGlyphInfo;
 
 typedef struct {
-  unsigned int    doublewidth:1;     /* DECDWL or DECDHL line */
-  unsigned int    doubleheight:2;    /* DECDHL line (1=top 2=bottom) */
+  unsigned int    doublewidth:1;     // DECDWL or DECDHL line
+  unsigned int    doubleheight:2;    // DECDHL line (1=top 2=bottom)
 } VTermLineInfo;
 
 typedef struct {
-  /* libvterm relies on the allocated memory to be zeroed out before it is
-   * returned by the allocator. */
+  // libvterm relies on the allocated memory to be zeroed out before it is
+  // returned by the allocator.
   void *(*malloc)(size_t size, void *allocdata);
   void  (*free)(void *ptr, void *allocdata);
 } VTermAllocatorFunctions;
 
-/* Allocate and initialize a new terminal with default allocators. */
+// Allocate and initialize a new terminal with default allocators.
 VTerm *vterm_new(int rows, int cols);
 
-/* Allocate and initialize a new terminal with specified allocators. */
+// Allocate and initialize a new terminal with specified allocators.
 VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata);
 
-/* Free and cleanup a terminal and all its data. */
+// Free and cleanup a terminal and all its data.
 void   vterm_free(VTerm* vt);
 
-/* Get the current size of the terminal and store in "rowsp" and "colsp". */
+// Get the current size of the terminal and store in "rowsp" and "colsp".
 void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp);
 
 void vterm_set_size(VTerm *vt, int rows, int cols);
@@ -207,8 +207,8 @@ void vterm_keyboard_start_paste(VTerm *v
 void vterm_keyboard_end_paste(VTerm *vt);
 
 void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod);
-/* "button" is 1 for left, 2 for middle, 3 for right.
- * Button 4 is scroll wheel down, button 5 is scroll wheel up. */
+// "button" is 1 for left, 2 for middle, 3 for right.
+// Button 4 is scroll wheel down, button 5 is scroll wheel up.
 void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod);
 
 // ------------
@@ -229,7 +229,7 @@ void vterm_mouse_button(VTerm *vt, int b
 #define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE)
 #define CSI_ARG(a)          ((a) & CSI_ARG_MASK)
 
-/* Can't use -1 to indicate a missing argument; use this instead */
+// Can't use -1 to indicate a missing argument; use this instead
 #define CSI_ARG_MISSING ((1<<30)-1)
 
 #define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING)
@@ -261,8 +261,8 @@ typedef struct {
   int (*erase)(VTermRect rect, int selective, void *user);
   int (*initpen)(void *user);
   int (*setpenattr)(VTermAttr attr, VTermValue *val, void *user);
-  /* Callback for setting various properties.  Must return 1 if the property
-   * was accepted, 0 otherwise. */
+  // Callback for setting various properties.  Must return 1 if the property
+  // was accepted, 0 otherwise.
   int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
   int (*bell)(void *user);
   int (*resize)(int rows, int cols, VTermPos *delta, void *user);
@@ -279,7 +279,7 @@ typedef struct {
 #define MOUSE_WANT_CLICK 0x01
 #define MOUSE_WANT_DRAG  0x02
 #define MOUSE_WANT_MOVE  0x04
-  /* useful to add protocol? */
+  // useful to add protocol?
 } VTermMouseState;
 
 VTermState *vterm_obtain_state(VTerm *vt);
@@ -291,7 +291,7 @@ void *vterm_state_get_cbdata(VTermState 
 void  vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermParserCallbacks *fallbacks, void *user);
 void *vterm_state_get_unrecognised_fbdata(VTermState *state);
 
-/* Initialize the state. */
+// Initialize the state.
 void vterm_state_reset(VTermState *state, int hard);
 
 void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos);
@@ -318,9 +318,9 @@ typedef struct {
     unsigned int blink     : 1;
     unsigned int reverse   : 1;
     unsigned int strike    : 1;
-    unsigned int font      : 4; /* 0 to 9 */
-    unsigned int dwl       : 1; /* On a DECDWL or DECDHL line */
-    unsigned int dhl       : 2; /* On a DECDHL line (1=top 2=bottom) */
+    unsigned int font      : 4; // 0 to 9
+    unsigned int dwl       : 1; // On a DECDWL or DECDHL line
+    unsigned int dhl       : 2; // On a DECDHL line (1=top 2=bottom)
 } VTermScreenCellAttrs;
 
 typedef struct {
@@ -331,7 +331,7 @@ typedef struct {
   VTermColor fg, bg;
 } VTermScreenCell;
 
-/* All fields are optional, NULL when not used. */
+// All fields are optional, NULL when not used.
 typedef struct {
   int (*damage)(VTermRect rect, void *user);
   int (*moverect)(VTermRect dest, VTermRect src, void *user);
@@ -339,14 +339,14 @@ typedef struct {
   int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
   int (*bell)(void *user);
   int (*resize)(int rows, int cols, void *user);
-  /* A line was pushed off the top of the window.
-   * "cells[cols]" contains the cells of that line.
-   * Return value is unused. */
+  // A line was pushed off the top of the window.
+  // "cells[cols]" contains the cells of that line.
+  // Return value is unused.
   int (*sb_pushline)(int cols, const VTermScreenCell *cells, void *user);
   int (*sb_popline)(int cols, VTermScreenCell *cells, void *user);
 } VTermScreenCallbacks;
 
-/* Return the screen of the vterm. */
+// Return the screen of the vterm.
 VTermScreen *vterm_obtain_screen(VTerm *vt);
 
 /*
@@ -356,25 +356,25 @@ VTermScreen *vterm_obtain_screen(VTerm *
 void  vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user);
 void *vterm_screen_get_cbdata(VTermScreen *screen);
 
-// Only invokes control, csi, osc, dcs
+/* Only invokes control, csi, osc, dcs */
 void  vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user);
 void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen);
 
-/* Enable support for using the alternate screen if "altscreen" is non-zero.
- * Before that switching to the alternate screen won't work.
- * Calling with "altscreen" zero has no effect. */
+// Enable support for using the alternate screen if "altscreen" is non-zero.
+// Before that switching to the alternate screen won't work.
+// Calling with "altscreen" zero has no effect.
 void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen);
 
 typedef enum {
-  VTERM_DAMAGE_CELL,    /* every cell */
-  VTERM_DAMAGE_ROW,     /* entire rows */
-  VTERM_DAMAGE_SCREEN,  /* entire screen */
-  VTERM_DAMAGE_SCROLL,  /* entire screen + scrollrect */
+  VTERM_DAMAGE_CELL,    // every cell
+  VTERM_DAMAGE_ROW,     // entire rows
+  VTERM_DAMAGE_SCREEN,  // entire screen
+  VTERM_DAMAGE_SCROLL,  // entire screen + scrollrect
 
   VTERM_N_DAMAGES
 } VTermDamageSize;
 
-/* Invoke the relevant callbacks to update the screen. */
+// Invoke the relevant callbacks to update the screen.
 void vterm_screen_flush_damage(VTermScreen *screen);
 
 void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size);
@@ -385,7 +385,7 @@ void vterm_screen_set_damage_merge(VTerm
  */
 void   vterm_screen_reset(VTermScreen *screen, int hard);
 
-/* Neither of these functions NUL-terminate the buffer */
+// Neither of these functions NUL-terminate the buffer
 size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect);
 size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect);