ReactOS  0.4.15-dev-1068-g467feb9
conio.h File Reference
#include "rect.h"
Include dependency graph for conio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _CONSOLE_IO_OBJECT
 
struct  _CONSOLE_SCREEN_BUFFER
 
struct  _TEXTMODE_BUFFER_INFO
 
struct  _TEXTMODE_SCREEN_BUFFER
 
struct  _GRAPHICS_BUFFER_INFO
 
struct  _GRAPHICS_SCREEN_BUFFER
 
struct  _CONSOLE_INPUT_BUFFER
 
struct  _CONSOLE_INFO
 
struct  _TERMINAL_VTBL
 
struct  _TERMINAL
 
struct  _CONSOLE
 

Macros

#define DEFAULT_SCREEN_ATTRIB   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
 
#define DEFAULT_POPUP_ATTRIB
 
#define GetType(This)   (((PCONSOLE_SCREEN_BUFFER)(This))->Header.Type)
 
#define GetConsoleInputBufferMode(Console)   (Console)->InputBuffer.Mode
 
#define IS_FULL_WIDTH(wch)   (((USHORT)(wch) >= 0x0080) && (mk_wcwidth_cjk(wch) == 2))
 

Typedefs

typedef enum _CONSOLE_IO_OBJECT_TYPE CONSOLE_IO_OBJECT_TYPE
 
typedef struct _CONSOLE_IO_OBJECT CONSOLE_IO_OBJECT
 
typedef struct _CONSOLE_IO_OBJECTPCONSOLE_IO_OBJECT
 
typedef struct _CONSOLE_SCREEN_BUFFER CONSOLE_SCREEN_BUFFER
 
typedef struct _CONSOLE_SCREEN_BUFFERPCONSOLE_SCREEN_BUFFER
 
typedef struct _TEXTMODE_BUFFER_INFO TEXTMODE_BUFFER_INFO
 
typedef struct _TEXTMODE_BUFFER_INFOPTEXTMODE_BUFFER_INFO
 
typedef struct _TEXTMODE_SCREEN_BUFFER TEXTMODE_SCREEN_BUFFER
 
typedef struct _TEXTMODE_SCREEN_BUFFERPTEXTMODE_SCREEN_BUFFER
 
typedef struct _GRAPHICS_BUFFER_INFO GRAPHICS_BUFFER_INFO
 
typedef struct _GRAPHICS_BUFFER_INFOPGRAPHICS_BUFFER_INFO
 
typedef struct _GRAPHICS_SCREEN_BUFFER GRAPHICS_SCREEN_BUFFER
 
typedef struct _GRAPHICS_SCREEN_BUFFERPGRAPHICS_SCREEN_BUFFER
 
typedef struct _CONSOLE_INPUT_BUFFER CONSOLE_INPUT_BUFFER
 
typedef struct _CONSOLE_INPUT_BUFFERPCONSOLE_INPUT_BUFFER
 
typedef struct _CONSOLE_INFO CONSOLE_INFO
 
typedef struct _CONSOLE_INFOPCONSOLE_INFO
 
typedef struct _TERMINAL TERMINAL
 
typedef struct _TERMINALPTERMINAL
 
typedef struct _TERMINAL_VTBL TERMINAL_VTBL
 
typedef struct _TERMINAL_VTBLPTERMINAL_VTBL
 
typedef enum _CONSOLE_STATE CONSOLE_STATE
 
typedef enum _CONSOLE_STATEPCONSOLE_STATE
 
typedef struct _CONSOLE CONSOLE
 
typedef struct _CONSOLEPCONSOLE
 

Enumerations

enum  _CONSOLE_IO_OBJECT_TYPE {
  UNKNOWN = 0x00, TEXTMODE_BUFFER = 0x01, GRAPHICS_BUFFER = 0x02, SCREEN_BUFFER = 0x03,
  INPUT_BUFFER = 0x04, ANY_TYPE_BUFFER = 0x07
}
 
enum  _CONSOLE_STATE { CONSOLE_INITIALIZING, CONSOLE_RUNNING, CONSOLE_TERMINATING, CONSOLE_IN_DESTRUCTION }
 

Functions

VOID NTAPI ConDrvPause (PCONSOLE Console)
 
VOID NTAPI ConDrvUnpause (PCONSOLE Console)
 
PCHAR_INFO ConioCoordToPointer (PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
 
NTSTATUS ConioResizeBuffer (PCONSOLE Console, PTEXTMODE_SCREEN_BUFFER ScreenBuffer, COORD Size)
 
int mk_wcwidth_cjk (wchar_t ucs)
 

Macro Definition Documentation

◆ DEFAULT_POPUP_ATTRIB

#define DEFAULT_POPUP_ATTRIB
Value:
#define BACKGROUND_RED
Definition: blue.h:67
#define BACKGROUND_INTENSITY
Definition: blue.h:68
#define FOREGROUND_RED
Definition: blue.h:63
#define BACKGROUND_GREEN
Definition: blue.h:66
#define FOREGROUND_BLUE
Definition: blue.h:61

Definition at line 17 of file conio.h.

◆ DEFAULT_SCREEN_ATTRIB

#define DEFAULT_SCREEN_ATTRIB   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)

Definition at line 16 of file conio.h.

◆ GetConsoleInputBufferMode

#define GetConsoleInputBufferMode (   Console)    (Console)->InputBuffer.Mode

Definition at line 318 of file conio.h.

◆ GetType

#define GetType (   This)    (((PCONSOLE_SCREEN_BUFFER)(This))->Header.Type)

Definition at line 54 of file conio.h.

◆ IS_FULL_WIDTH

#define IS_FULL_WIDTH (   wch)    (((USHORT)(wch) >= 0x0080) && (mk_wcwidth_cjk(wch) == 2))

Definition at line 333 of file conio.h.

Typedef Documentation

◆ CONSOLE

◆ CONSOLE_INFO

◆ CONSOLE_INPUT_BUFFER

◆ CONSOLE_IO_OBJECT

◆ CONSOLE_IO_OBJECT_TYPE

◆ CONSOLE_SCREEN_BUFFER

◆ CONSOLE_STATE

◆ GRAPHICS_BUFFER_INFO

◆ GRAPHICS_SCREEN_BUFFER

◆ PCONSOLE

◆ PCONSOLE_INFO

◆ PCONSOLE_INPUT_BUFFER

◆ PCONSOLE_IO_OBJECT

◆ PCONSOLE_SCREEN_BUFFER

◆ PCONSOLE_STATE

◆ PGRAPHICS_BUFFER_INFO

◆ PGRAPHICS_SCREEN_BUFFER

◆ PTERMINAL

Definition at line 196 of file conio.h.

◆ PTERMINAL_VTBL

◆ PTEXTMODE_BUFFER_INFO

◆ PTEXTMODE_SCREEN_BUFFER

◆ TERMINAL

Definition at line 196 of file conio.h.

◆ TERMINAL_VTBL

◆ TEXTMODE_BUFFER_INFO

◆ TEXTMODE_SCREEN_BUFFER

Enumeration Type Documentation

◆ _CONSOLE_IO_OBJECT_TYPE

Enumerator
UNKNOWN 
TEXTMODE_BUFFER 
GRAPHICS_BUFFER 
SCREEN_BUFFER 
INPUT_BUFFER 
ANY_TYPE_BUFFER 

Definition at line 22 of file conio.h.

23 {
24  UNKNOWN = 0x00, // --> Unknown object
25  TEXTMODE_BUFFER = 0x01, // --> Output-type object for text SBs
26  GRAPHICS_BUFFER = 0x02, // --> Output-type object for graphics SBs
27  SCREEN_BUFFER = 0x03, // --> Any SB type
28  INPUT_BUFFER = 0x04, // --> Input-type object
29  ANY_TYPE_BUFFER = 0x07, // --> Any IO object
enum _CONSOLE_IO_OBJECT_TYPE CONSOLE_IO_OBJECT_TYPE

◆ _CONSOLE_STATE

Enumerator
CONSOLE_INITIALIZING 
CONSOLE_RUNNING 
CONSOLE_TERMINATING 
CONSOLE_IN_DESTRUCTION 

Definition at line 278 of file conio.h.

279 {
280  CONSOLE_INITIALIZING, /* Console is initializing */
281  CONSOLE_RUNNING , /* Console running */
282  CONSOLE_TERMINATING , /* Console about to be destroyed (but still not) */
283  CONSOLE_IN_DESTRUCTION /* Console in destruction */
enum _CONSOLE_STATE * PCONSOLE_STATE
enum _CONSOLE_STATE CONSOLE_STATE

Function Documentation

◆ ConDrvPause()

VOID NTAPI ConDrvPause ( PCONSOLE  Console)

Definition at line 303 of file console.c.

304 {
305  /* In case we are already paused, just exit... */
306  if (Console->ConsolePaused) return;
307 
308  /* ... otherwise set the flag */
309  Console->ConsolePaused = TRUE;
310 }
#define TRUE
Definition: types.h:120
CConsole Console

Referenced by ConioPause().

◆ ConDrvUnpause()

VOID NTAPI ConDrvUnpause ( PCONSOLE  Console)

Definition at line 313 of file console.c.

314 {
315  /* In case we are already unpaused, just exit... */
316  if (!Console->ConsolePaused) return;
317 
318  /* ... otherwise reset the flag */
319  Console->ConsolePaused = FALSE;
320 }
#define FALSE
Definition: types.h:117
CConsole Console

Referenced by ConioUnpause().

◆ ConioCoordToPointer()

PCHAR_INFO ConioCoordToPointer ( PTEXTMODE_SCREEN_BUFFER  Buff,
ULONG  X,
ULONG  Y 
)

Definition at line 143 of file text.c.

144 {
145  ASSERT(X < Buff->ScreenBufferSize.X);
146  ASSERT(Y < Buff->ScreenBufferSize.Y);
147  return &Buff->Buffer[((Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y) * Buff->ScreenBufferSize.X + X];
148 }
#define Y(I)
X(int i_=0)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PCHAR_INFO Buffer
Definition: conio.h:129
#define X(b, s)

◆ ConioResizeBuffer()

NTSTATUS ConioResizeBuffer ( PCONSOLE  Console,
PTEXTMODE_SCREEN_BUFFER  ScreenBuffer,
COORD  Size 
)

Definition at line 359 of file text.c.

362 {
364  PCHAR_INFO Ptr;
365  ULONG_PTR Offset = 0;
366  WORD CurrentAttribute;
367  USHORT CurrentY;
368  PCHAR_INFO OldBuffer;
369  DWORD i;
370  DWORD diff;
371 
372  /* Zero size is invalid */
373  if (Size.X == 0 || Size.Y == 0)
375 
376  /* Buffer size is not allowed to be smaller than the view size */
377  if (Size.X < ScreenBuffer->ViewSize.X || Size.Y < ScreenBuffer->ViewSize.Y)
379 
380  if (Size.X == ScreenBuffer->ScreenBufferSize.X && Size.Y == ScreenBuffer->ScreenBufferSize.Y)
381  {
382  // FIXME: Trigger a buffer resize event ??
383  return STATUS_SUCCESS;
384  }
385 
386  if (Console->FixedSize)
387  {
388  /*
389  * The console is in fixed-size mode, so we cannot resize anything
390  * at the moment. However, keep those settings somewhere so that
391  * we can try to set them up when we will be allowed to do so.
392  */
393  ScreenBuffer->OldScreenBufferSize = Size;
394  return STATUS_NOT_SUPPORTED; // STATUS_SUCCESS
395  }
396 
398  if (!Buffer) return STATUS_NO_MEMORY;
399 
400  DPRINT("Resizing (%d,%d) to (%d,%d)\n", ScreenBuffer->ScreenBufferSize.X, ScreenBuffer->ScreenBufferSize.Y, Size.X, Size.Y);
401 
402  OldBuffer = ScreenBuffer->Buffer;
403 
404  for (CurrentY = 0; CurrentY < ScreenBuffer->ScreenBufferSize.Y && CurrentY < Size.Y; CurrentY++)
405  {
406  Ptr = ConioCoordToPointer(ScreenBuffer, 0, CurrentY);
407 
408  if (Size.X <= ScreenBuffer->ScreenBufferSize.X)
409  {
410  /* Reduce size */
411  RtlCopyMemory(Buffer + Offset, Ptr, Size.X * sizeof(CHAR_INFO));
412  Offset += Size.X;
413 
414  /* If we have cut a trailing full-width character in half, remove it completely */
415  Ptr = Buffer + Offset - 1;
416  if (Ptr->Attributes & COMMON_LVB_LEADING_BYTE)
417  {
418  Ptr->Char.UnicodeChar = L' ';
419  /* Keep all the other original attributes intact */
420  Ptr->Attributes &= ~COMMON_LVB_SBCSDBCS;
421  }
422  }
423  else
424  {
425  /* Enlarge size */
426  RtlCopyMemory(Buffer + Offset, Ptr, ScreenBuffer->ScreenBufferSize.X * sizeof(CHAR_INFO));
427  Offset += ScreenBuffer->ScreenBufferSize.X;
428 
429  /* The attribute to be used is the one of the last cell of the current line */
430  CurrentAttribute = ConioCoordToPointer(ScreenBuffer,
431  ScreenBuffer->ScreenBufferSize.X - 1,
432  CurrentY)->Attributes;
433  CurrentAttribute &= ~COMMON_LVB_SBCSDBCS;
434 
435  diff = Size.X - ScreenBuffer->ScreenBufferSize.X;
436 
437  /* Zero-out the new part of the buffer */
438  for (i = 0; i < diff; i++)
439  {
440  Ptr = Buffer + Offset;
441  Ptr->Char.UnicodeChar = L' ';
442  Ptr->Attributes = CurrentAttribute;
443  ++Offset;
444  }
445  }
446  }
447 
448  if (Size.Y > ScreenBuffer->ScreenBufferSize.Y)
449  {
450  diff = Size.X * (Size.Y - ScreenBuffer->ScreenBufferSize.Y);
451 
452  /* Zero-out the new part of the buffer */
453  for (i = 0; i < diff; i++)
454  {
455  Ptr = Buffer + Offset;
456  Ptr->Char.UnicodeChar = L' ';
457  Ptr->Attributes = ScreenBuffer->ScreenDefaultAttrib;
458  ++Offset;
459  }
460  }
461 
463  ConsoleFreeHeap(OldBuffer);
464  ScreenBuffer->ScreenBufferSize = ScreenBuffer->OldScreenBufferSize = Size;
465  ScreenBuffer->VirtualY = 0;
466 
467  /* Ensure the cursor and the view are within the buffer */
468  ScreenBuffer->CursorPosition.X = min(ScreenBuffer->CursorPosition.X, Size.X - 1);
469  ScreenBuffer->CursorPosition.Y = min(ScreenBuffer->CursorPosition.Y, Size.Y - 1);
470  ScreenBuffer->ViewOrigin.X = min(ScreenBuffer->ViewOrigin.X, Size.X - ScreenBuffer->ViewSize.X);
471  ScreenBuffer->ViewOrigin.Y = min(ScreenBuffer->ViewOrigin.Y, Size.Y - ScreenBuffer->ViewSize.Y);
472 
473  /*
474  * Trigger a buffer resize event
475  */
476  if (Console->InputBuffer.Mode & ENABLE_WINDOW_INPUT)
477  {
478  ULONG NumEventsWritten;
479  INPUT_RECORD er;
480 
482  er.Event.WindowBufferSizeEvent.dwSize = ScreenBuffer->ScreenBufferSize;
483 
484  // ConioProcessInputEvent(Console, &er);
486  &Console->InputBuffer,
487  TRUE,
488  &er,
489  1,
490  &NumEventsWritten);
491  }
492 
493  return STATUS_SUCCESS;
494 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:143
#define WINDOW_BUFFER_SIZE_EVENT
Definition: wincon.h:130
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define COMMON_LVB_SBCSDBCS
Definition: wincon.h:56
#define ConsoleAllocHeap(Flags, Size)
Definition: heap.h:14
WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
Definition: wincon.h:280
uint32_t ULONG_PTR
Definition: typedefs.h:65
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
WORD Attributes
Definition: wincon.h:187
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define ENABLE_WINDOW_INPUT
Definition: wincon.h:81
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
union _INPUT_RECORD::@3235 Event
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define min(a, b)
Definition: monoChain.cc:55
NTSTATUS NTAPI ConDrvWriteConsoleInput(IN PCONSOLE Console, IN PCONSOLE_INPUT_BUFFER InputBuffer, IN BOOLEAN AppendToEnd, IN PINPUT_RECORD InputRecord, IN ULONG NumEventsToWrite, OUT PULONG NumEventsWritten OPTIONAL)
Definition: coninput.c:330
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
CConsole Console
WORD EventType
Definition: wincon.h:276
#define ConsoleFreeHeap(HeapBase)
Definition: heap.h:15
HANDLE ScreenBuffer
Definition: notevil.c:37
#define COMMON_LVB_LEADING_BYTE
Definition: wincon.h:48
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by ConDrvSetConsoleScreenBufferSize(), and ConSrvApplyUserSettings().

◆ mk_wcwidth_cjk()

int mk_wcwidth_cjk ( wchar_t  ucs)

Definition at line 230 of file wcwidth.c.

231 {
232  /* sorted list of non-overlapping intervals of East Asian Ambiguous
233  * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
234  static const struct interval ambiguous[] = {
235  { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 },
236  { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 },
237  { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 },
238  { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 },
239  { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED },
240  { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA },
241  { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 },
242  { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B },
243  { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 },
244  { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 },
245  { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 },
246  { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE },
247  { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 },
248  { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA },
249  { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 },
250  { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB },
251  { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB },
252  { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 },
253  { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 },
254  { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 },
255  { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 },
256  { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 },
257  { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 },
258  { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 },
259  { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC },
260  { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 },
261  { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 },
262  { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 },
263  { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 },
264  { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 },
265  { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 },
266  { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B },
267  { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 },
268  { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 },
269  { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E },
270  { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 },
271  { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 },
272  { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F },
273  { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 },
274  { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF },
275  { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B },
276  { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 },
277  { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 },
278  { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 },
279  { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 },
280  { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 },
281  { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 },
282  { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 },
283  { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 },
284  { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F },
285  { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF },
286  { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD }
287  };
288 
289  /* binary search in table of non-spacing characters */
290  if (bisearch(ucs, ambiguous,
291  sizeof(ambiguous) / sizeof(struct interval) - 1))
292  return 2;
293 
294  return mk_wcwidth(ucs);
295 }
int mk_wcwidth(wchar_t ucs)
Definition: wcwidth.c:122
static int bisearch(wchar_t ucs, const struct interval *table, int max)
Definition: wcwidth.c:70

Referenced by mk_wcswidth_cjk().