ReactOS 0.4.15-dev-5672-gf73ac17
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 CON_SET_OUTPUT_CP(Console, CodePage)
 
#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

◆ CON_SET_OUTPUT_CP

#define CON_SET_OUTPUT_CP (   Console,
  CodePage 
)
Value:
do { \
(Console)->OutputCodePage = (CodePage); \
(Console)->IsCJK = IsCJKCodePage((Console)->OutputCodePage); \
} while (0)
CConsole Console
UINT OutputCodePage
Definition: console.c:26
#define IsCJKCodePage(CodePage)
Definition: pager.c:42

Definition at line 323 of file conio.h.

◆ DEFAULT_POPUP_ATTRIB

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

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 320 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 341 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
@ SCREEN_BUFFER
Definition: conio.h:27
@ INPUT_BUFFER
Definition: conio.h:28
@ GRAPHICS_BUFFER
Definition: conio.h:26
@ TEXTMODE_BUFFER
Definition: conio.h:25
@ ANY_TYPE_BUFFER
Definition: conio.h:29

◆ _CONSOLE_STATE

Enumerator
CONSOLE_INITIALIZING 
CONSOLE_RUNNING 
CONSOLE_TERMINATING 
CONSOLE_IN_DESTRUCTION 

Definition at line 280 of file conio.h.

281{
282 CONSOLE_INITIALIZING, /* Console is initializing */
283 CONSOLE_RUNNING , /* Console running */
284 CONSOLE_TERMINATING , /* Console about to be destroyed (but still not) */
285 CONSOLE_IN_DESTRUCTION /* Console in destruction */
enum _CONSOLE_STATE CONSOLE_STATE
enum _CONSOLE_STATE * PCONSOLE_STATE
@ CONSOLE_IN_DESTRUCTION
Definition: conio.h:285
@ CONSOLE_TERMINATING
Definition: conio.h:284
@ CONSOLE_RUNNING
Definition: conio.h:283
@ CONSOLE_INITIALIZING
Definition: conio.h:282

Function Documentation

◆ ConDrvPause()

VOID NTAPI ConDrvPause ( PCONSOLE  Console)

Definition at line 304 of file console.c.

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

Referenced by ConioPause().

◆ ConDrvUnpause()

VOID NTAPI ConDrvUnpause ( PCONSOLE  Console)

Definition at line 314 of file console.c.

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

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)
#define X(b, s)
#define ASSERT(a)
Definition: mode.c:44
PCHAR_INFO Buffer
Definition: conio.h:129

◆ ConioResizeBuffer()

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

Definition at line 359 of file text.c.

362{
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}
Definition: bufpool.h:45
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
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
#define min(a, b)
Definition: monoChain.cc:55
HANDLE ScreenBuffer
Definition: notevil.c:37
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
WORD Attributes
Definition: wincon.h:187
WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
Definition: wincon.h:277
union _INPUT_RECORD::@3255 Event
WORD EventType
Definition: wincon.h:273
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:143
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 ConsoleAllocHeap(Flags, Size)
Definition: heap.h:14
#define ConsoleFreeHeap(HeapBase)
Definition: heap.h:15
#define WINDOW_BUFFER_SIZE_EVENT
Definition: wincon.h:130
#define COMMON_LVB_LEADING_BYTE
Definition: wincon.h:48
#define ENABLE_WINDOW_INPUT
Definition: wincon.h:81

Referenced by ConDrvSetConsoleScreenBufferSize(), and ConSrvApplyUserSettings().

◆ mk_wcwidth_cjk()

int mk_wcwidth_cjk ( wchar_t  ucs)

Definition at line 234 of file wcwidth.c.

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

Referenced by mk_wcswidth_cjk().