ReactOS  0.4.14-dev-1331-g167fa2c
conio.h File Reference
#include "rect.h"
#include "conio_winsrv.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_VTBL
 
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 _CONSRV_CONSOLE   _CONSOLE
 
#define CONSRV_CONSOLE   CONSOLE
 
#define PCONSRV_CONSOLE   PCONSOLE
 
#define DEFAULT_SCREEN_ATTRIB   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
 
#define DEFAULT_POPUP_ATTRIB
 
#define GetType(This)   (This)->Vtbl->GetType(This)
 
#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 _CONSOLE_SCREEN_BUFFER_VTBL CONSOLE_SCREEN_BUFFER_VTBL
 
typedef struct _CONSOLE_SCREEN_BUFFER_VTBLPCONSOLE_SCREEN_BUFFER_VTBL
 
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 _TERMINAL TERMINAL
 
typedef struct _TERMINALPTERMINAL
 
typedef struct _CONSOLE_INFO CONSOLE_INFO
 
typedef struct _CONSOLE_INFOPCONSOLE_INFO
 
typedef struct _TERMINAL_VTBL TERMINAL_VTBL
 
typedef struct _TERMINAL_VTBLPTERMINAL_VTBL
 
typedef enum _CONSOLE_STATE CONSOLE_STATE
 
typedef enum _CONSOLE_STATEPCONSOLE_STATE
 
typedef struct _CONSOLEPCONSOLE
 
typedef struct _CONSOLE CONSOLE
 

Enumerations

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

Functions

VOID NTAPI ConDrvPause (PCONSOLE Console)
 
VOID NTAPI ConDrvUnpause (PCONSOLE Console)
 
NTSTATUS ConSrvConsoleCtrlEvent (IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData)
 
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

◆ _CONSRV_CONSOLE

#define _CONSRV_CONSOLE   _CONSOLE

Definition at line 25 of file conio.h.

◆ CONSRV_CONSOLE

#define CONSRV_CONSOLE   CONSOLE

Definition at line 26 of file conio.h.

◆ 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 33 of file conio.h.

◆ DEFAULT_SCREEN_ATTRIB

#define DEFAULT_SCREEN_ATTRIB   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)

Definition at line 32 of file conio.h.

◆ GetConsoleInputBufferMode

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

Definition at line 363 of file conio.h.

◆ GetType

#define GetType (   This)    (This)->Vtbl->GetType(This)

Definition at line 78 of file conio.h.

◆ IS_FULL_WIDTH

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

Definition at line 378 of file conio.h.

◆ PCONSRV_CONSOLE

#define PCONSRV_CONSOLE   PCONSOLE

Definition at line 27 of file conio.h.

Typedef Documentation

◆ CONSOLE

◆ CONSOLE_INFO

◆ CONSOLE_INPUT_BUFFER

◆ CONSOLE_IO_OBJECT

◆ CONSOLE_IO_OBJECT_TYPE

◆ CONSOLE_SCREEN_BUFFER

Definition at line 70 of file conio.h.

◆ CONSOLE_SCREEN_BUFFER_VTBL

◆ CONSOLE_STATE

◆ GRAPHICS_BUFFER_INFO

◆ GRAPHICS_SCREEN_BUFFER

◆ PCONSOLE

Definition at line 313 of file conio.h.

◆ PCONSOLE_INFO

◆ PCONSOLE_INPUT_BUFFER

◆ PCONSOLE_IO_OBJECT

◆ PCONSOLE_SCREEN_BUFFER

Definition at line 70 of file conio.h.

◆ PCONSOLE_SCREEN_BUFFER_VTBL

◆ PCONSOLE_STATE

◆ PGRAPHICS_BUFFER_INFO

◆ PGRAPHICS_SCREEN_BUFFER

◆ PTERMINAL

Definition at line 201 of file conio.h.

◆ PTERMINAL_VTBL

◆ PTEXTMODE_BUFFER_INFO

◆ PTEXTMODE_SCREEN_BUFFER

◆ TERMINAL

Definition at line 201 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 
TEXTMODE_BUFFER 
GRAPHICS_BUFFER 
SCREEN_BUFFER 
INPUT_BUFFER 

Definition at line 38 of file conio.h.

39 {
40  UNKNOWN = 0x00, // --> Unknown object
41  TEXTMODE_BUFFER = 0x01, // --> Output-type object for text SBs
42  GRAPHICS_BUFFER = 0x02, // --> Output-type object for graphics SBs
43  SCREEN_BUFFER = 0x03, // --> Any SB type
44  INPUT_BUFFER = 0x04, // --> Input-type object
45  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 
CONSOLE_INITIALIZING 
CONSOLE_RUNNING 
CONSOLE_TERMINATING 
CONSOLE_IN_DESTRUCTION 

Definition at line 303 of file conio.h.

304 {
305  CONSOLE_INITIALIZING, /* Console is initializing */
306  CONSOLE_RUNNING , /* Console running */
307  CONSOLE_TERMINATING , /* Console about to be destroyed (but still not) */
308  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 80 of file console.c.

81 {
82  /* In case we are already paused, just exit... */
83  if (Console->ConsolePaused) return;
84 
85  /* ... otherwise set the flag */
86  Console->ConsolePaused = TRUE;
87 }
#define TRUE
Definition: types.h:120
CConsole Console

Referenced by ConioPause().

◆ ConDrvUnpause()

VOID NTAPI ConDrvUnpause ( PCONSOLE  Console)

Definition at line 90 of file console.c.

91 {
92  /* In case we are already unpaused, just exit... */
93  if (!Console->ConsolePaused) return;
94 
95  /* ... otherwise reset the flag */
96  Console->ConsolePaused = FALSE;
97 }
CConsole Console

Referenced by ConioUnpause().

◆ ConioCoordToPointer()

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

Definition at line 156 of file text.c.

157 {
158  ASSERT(X < Buff->ScreenBufferSize.X);
159  ASSERT(Y < Buff->ScreenBufferSize.Y);
160  return &Buff->Buffer[((Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y) * Buff->ScreenBufferSize.X + X];
161 }
#define Y(I)
X(int i_=0)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PCHAR_INFO Buffer
Definition: conio.h:154
#define X(b, s)

◆ ConioResizeBuffer()

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

Definition at line 372 of file text.c.

375 {
377  PCHAR_INFO Ptr;
378  ULONG_PTR Offset = 0;
379  WORD CurrentAttribute;
380  USHORT CurrentY;
381  PCHAR_INFO OldBuffer;
382  DWORD i;
383  DWORD diff;
384 
385  /* Zero size is invalid */
386  if (Size.X == 0 || Size.Y == 0)
388 
389  /* Buffer size is not allowed to be smaller than the view size */
390  if (Size.X < ScreenBuffer->ViewSize.X || Size.Y < ScreenBuffer->ViewSize.Y)
392 
393  if (Size.X == ScreenBuffer->ScreenBufferSize.X && Size.Y == ScreenBuffer->ScreenBufferSize.Y)
394  {
395  // FIXME: Trigger a buffer resize event ??
396  return STATUS_SUCCESS;
397  }
398 
399  if (Console->FixedSize)
400  {
401  /*
402  * The console is in fixed-size mode, so we cannot resize anything
403  * at the moment. However, keep those settings somewhere so that
404  * we can try to set them up when we will be allowed to do so.
405  */
406  ScreenBuffer->OldScreenBufferSize = Size;
407  return STATUS_NOT_SUPPORTED; // STATUS_SUCCESS
408  }
409 
411  if (!Buffer) return STATUS_NO_MEMORY;
412 
413  DPRINT("Resizing (%d,%d) to (%d,%d)\n", ScreenBuffer->ScreenBufferSize.X, ScreenBuffer->ScreenBufferSize.Y, Size.X, Size.Y);
414 
415  OldBuffer = ScreenBuffer->Buffer;
416 
417  for (CurrentY = 0; CurrentY < ScreenBuffer->ScreenBufferSize.Y && CurrentY < Size.Y; CurrentY++)
418  {
419  Ptr = ConioCoordToPointer(ScreenBuffer, 0, CurrentY);
420 
421  if (Size.X <= ScreenBuffer->ScreenBufferSize.X)
422  {
423  /* Reduce size */
424  RtlCopyMemory(Buffer + Offset, Ptr, Size.X * sizeof(CHAR_INFO));
425  Offset += Size.X;
426 
427  /* If we have cut a trailing full-width character in half, remove it completely */
428  Ptr = Buffer + Offset - 1;
429  if (Ptr->Attributes & COMMON_LVB_LEADING_BYTE)
430  {
431  Ptr->Char.UnicodeChar = L' ';
432  /* Keep all the other original attributes intact */
433  Ptr->Attributes &= ~COMMON_LVB_SBCSDBCS;
434  }
435  }
436  else
437  {
438  /* Enlarge size */
439  RtlCopyMemory(Buffer + Offset, Ptr, ScreenBuffer->ScreenBufferSize.X * sizeof(CHAR_INFO));
440  Offset += ScreenBuffer->ScreenBufferSize.X;
441 
442  /* The attribute to be used is the one of the last cell of the current line */
443  CurrentAttribute = ConioCoordToPointer(ScreenBuffer,
444  ScreenBuffer->ScreenBufferSize.X - 1,
445  CurrentY)->Attributes;
446  CurrentAttribute &= ~COMMON_LVB_SBCSDBCS;
447 
448  diff = Size.X - ScreenBuffer->ScreenBufferSize.X;
449 
450  /* Zero-out the new part of the buffer */
451  for (i = 0; i < diff; i++)
452  {
453  Ptr = Buffer + Offset;
454  Ptr->Char.UnicodeChar = L' ';
455  Ptr->Attributes = CurrentAttribute;
456  ++Offset;
457  }
458  }
459  }
460 
461  if (Size.Y > ScreenBuffer->ScreenBufferSize.Y)
462  {
463  diff = Size.X * (Size.Y - ScreenBuffer->ScreenBufferSize.Y);
464 
465  /* Zero-out the new part of the buffer */
466  for (i = 0; i < diff; i++)
467  {
468  Ptr = Buffer + Offset;
469  Ptr->Char.UnicodeChar = L' ';
470  Ptr->Attributes = ScreenBuffer->ScreenDefaultAttrib;
471  ++Offset;
472  }
473  }
474 
476  ConsoleFreeHeap(OldBuffer);
477  ScreenBuffer->ScreenBufferSize = ScreenBuffer->OldScreenBufferSize = Size;
478  ScreenBuffer->VirtualY = 0;
479 
480  /* Ensure the cursor and the view are within the buffer */
481  ScreenBuffer->CursorPosition.X = min(ScreenBuffer->CursorPosition.X, Size.X - 1);
482  ScreenBuffer->CursorPosition.Y = min(ScreenBuffer->CursorPosition.Y, Size.Y - 1);
483  ScreenBuffer->ViewOrigin.X = min(ScreenBuffer->ViewOrigin.X, Size.X - ScreenBuffer->ViewSize.X);
484  ScreenBuffer->ViewOrigin.Y = min(ScreenBuffer->ViewOrigin.Y, Size.Y - ScreenBuffer->ViewSize.Y);
485 
486  /*
487  * Trigger a buffer resize event
488  */
489  if (Console->InputBuffer.Mode & ENABLE_WINDOW_INPUT)
490  {
491  ULONG NumEventsWritten;
492  INPUT_RECORD er;
493 
495  er.Event.WindowBufferSizeEvent.dwSize = ScreenBuffer->ScreenBufferSize;
496 
497  // ConioProcessInputEvent(Console, &er);
499  &Console->InputBuffer,
500  TRUE,
501  &er,
502  1,
503  &NumEventsWritten);
504  }
505 
506  return STATUS_SUCCESS;
507 }
#define TRUE
Definition: types.h:120
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 STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:156
#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:64
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
union _INPUT_RECORD::@3182 Event
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:359
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#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:123
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:409
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ ConSrvConsoleCtrlEvent()

NTSTATUS ConSrvConsoleCtrlEvent ( IN ULONG  CtrlEvent,
IN PCONSOLE_PROCESS_DATA  ProcessData 
)

Definition at line 861 of file console.c.

863 {
864  return ConSrvConsoleCtrlEventTimeout(CtrlEvent, ProcessData, 0);
865 }
NTSTATUS ConSrvConsoleCtrlEventTimeout(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData, IN ULONG Timeout)
Definition: console.c:810

◆ 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().