Lugaru's Epsilon
Editor 14.04

Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      Buffer Primitives
         . . .
         Other Movement Functions
         Sorting Primitives
         Other Formatting Functions
         Comparing Primitives
         Managing Buffers
         . . .
      Display Primitives
         Creating & Destroying Windows
         Window Resizing Primitives
         Preserving Window Arrangements
         . . .
      . . .

Previous   Up    Next
Sorting Primitives  Primitives and EEL Subroutines   Comparing Primitives

Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Buffer Primitives >

Other Formatting Functions

int unicode_character_name(char *name, int ch, ?int trail_ch)
#define IS_LEADING_SURROGATE(c)   (((c)&0xfffffc00)==0xd800)
#define IS_TRAILING_SURROGATE(c)  (((c)&0xfffffc00)==0xdc00)

The unicode_character_name( ) primitive converts between the name of a Unicode character and its numeric code. It may be used in several ways.

When ch is the code for a Unicode character and trail_ch is zero, the primitive writes the character's name to the supplied array name and returns ch.

When ch is a leading Unicode surrogate character and the optional trail_ch is a trailing surrogate character, the primitive combines them to form a Unicode character code, writes the name of the combined character to name, and returns the combined character code. (The macros IS_LEADING_SURROGATE() and IS_TRAILING_SURROGATE() may be used to check if a character is a surrogate.

When ch is -1, the primitive looks up the Unicode character name given in name and returns its character number. If the name is unknown it returns -1 and puts an error message in name.

If none of these apply, it puts an error message in name and returns -1.

right_align_columns(char *pat)

The right_align_columns( ) subroutine locates all lines containing a match for the regular expression pattern pat. It notes the ending column of each match. (It assumes that pat occurs no more than one per line.)

Then, if some matches end at an earlier column than others, it adds indentation before each match as needed, so all matches will end at the same column.

columnize_buffer_text(int buf, int width, int margin)

The columnize_buffer_text( ) subroutine takes the lines in the buffer buf and reformats them into columns. It leaves a margin between columns of margin spaces, and chooses the number of columns so that the resulting buffer is at most width characters wide (unless an original line in the buffer is already wider than width).

do_buffer_to_hex(char *b, char transp[256], ?int flags)

The do_buffer_to_hex( ) primitive writes a hex view of the current buffer to the buffer b, creating or emptying it first. It ignores any narrowing in the original buffer. It uses the 256 character transp array to help construct the last column of the hex view; each character from the buffer will be replaced by the character at that offset in the transp array. If the buffer contains Unicode characters with codes higher than 255, they'll appear as-is.

If a buffer might contain Unicode characters, the primitive uses a display format that leaves room for 16 bits per character; otherwise it uses a format with room for 8 bits per character. The optional flags argument, if 1, forces 8 bits per character. If any character in the buffer doesn't fit in 8 bits, only its lower 8 bits will be shown in the hex listing.

Previous   Up    Next
Sorting Primitives  Primitives and EEL Subroutines   Comparing Primitives

Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.