TEXT
Textové řetězce
Textové řetězce TEXT vznikly jako snaha o jednotné a snadné používání textů jak systémem, tak aplikacemi. Součástí textu je délka textového řetězce (slovo). Přes původní záměr nejsou textové řetězce v systému důsledně používány, neboť vyžadují realokaci paměti, což je časově i paměťově náročné a je proto jejich použití ponecháno spíše pro aplikaci.
Texty jsou v systému Litos8 kódovány jako 8bitové znaky buď v kódu IBM 437 nebo KEYBCS2 = Kamenických, podle jazyku zvoleného klávesou Scroll Lock. Na zvoleném jazyku jsou závislé pouze funkce pro převod malých a velkých písmen s využitím národní tabulky znaků.
Misc functions
CharHexToBin - convert ASCII HEX character to a number
INPUT:
AL = HEX character ("0" to "9", "A"
to "F" or "a" to "f")
OUTPUT:
AL = number 0 to 15 (if NC) or AL not changed (if CY)
CY = invalid HEX character (AL not changed)
CharDecToBin - convert ASCII decimal character to a number
INPUT:
AL = ASCII decimal character ("0" to "9")
OUTPUT:
AL = number 0 to 9 (if NC) or AL not changed (if CY)
CY = invalid decimal character (AL not changed)
IsDigit - check digit character
INPUT:
AL = character
OUTPUT:
CY = not digit character
IsAlpha - check alpha character
INPUT:
AL = character
OUTPUT: CY = not alpha character
UpperCase - convert to uppercase letter
INPUT:
AL = character
OUTPUT:
AL = uppercase letter (not national characters)
CY = not converted (not lowercase letter)
LowerCase - convert to lowercase letter
INPUT:
AL = character
OUTPUT:
AL = lowercase letter (not national characters)
CY = not converted (not lowercase letter)
UpperLowerCase - convert uppercase/lowercase letter
INPUT:
AL = character
OUTPUT:
AL = changed letter (not national characters)
CY = not converted (not letter)
UpperCaseNat - convert to uppercase letter with national
INPUT:
AL = character
OUTPUT:
AL = uppercase letter
CY = not converted (not letter)
LowerCaseNat - convert to lowercase letter with national
INPUT:
AL = character
OUTPUT:
AL = lowercase letter
CY = not converted (not letter)
UpperLowerCaseNat - convert uppercase/lowercase letter with national
INPUT:
AL = character
OUTPUT:
AL = changed letter
CY = not converted (not letter)
Text managing
TextZLength - get length of ASCIIZ string
INPUT:
SI = pointer to ASCII string (it can be NULL)
OUTPUT:
AX = length of ASCII string (0 if SI=NULL)
TextLength - get length of text string
INPUT:
BX = pointer to TEXT structure (it can be NULL)
OUTPUT:
AX = length of text string (0 if BX=NULL)
TextCheckInx - check if character index is valid
INPUT:
BX = pointer to TEXT
SI = character index
OUTPUT:
CY = index is not valid (it is out of valid range)
TextDup - duplicate text string
INPUT:
BX = pointer to TEXT structure (may be CTEXT)
OUTPUT:
AX = new TEXT structure or NULL on error
CY = memory error (AX = NULL)
INPUT:
BX = pointer to TEXT structure
OUTPUT:
BX = old address or NULL on error
CY = invalid pointer (BX = NULL)
TextResize - resize text string
INPUT:
BX = pointer to TEXT structure
CX = required new length of text string
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error
New text string
TextNew - allocate new text string
INPUT:
CX = length of text string
OUTPUT:
AX = pointer to TEXT structure or NULL on error
CY = memory error (AX = NULL)
TextNewEmpty - allocate new empty text string
OUTPUT:
AX = pointer to TEXT structure or NULL on error
CY = memory error (AX = NULL)
TextNewZ - create text string from ASCIIZ text
INPUT:
SI = pointer to ASCIIZ text (it can be NULL)
OUTPUT:
AX = new TEXT structure or NULL on error
CY = memory error (AX = NULL)
TextNewBuf - create text string from buffer
INPUT:
CX = length of text string
SI = pointer to source text
OUTPUT: AX = pointer to TEXT
structure or NULL on error
CY = memory error (AX = NULL)
Get/set character
TextGetChar - get character from text
INPUT:
AL = default character, if index is out of range
BX = pointer to TEXT structure
SI = character index (0...)
OUTPUT:
AL = character from the text (or default character if CY)
CY = error, index is out of range (AL not changed)
TextSetChar - set character in text
INPUT:
AL = character
BX = pointer to TEXT structure
SI = character index (0...) (it may be out of range)
OUTPUT:
CY = error, index is out of range (text not changed)
TextGetFirst - get first character from text
INPUT:
AL = default character, if no text
BX = pointer to TEXT structure
OUTPUT:
AL = character from the text (or default character if CY)
CY = error, no text (AL not changed)
TextGetLast - get last character from text
INPUT:
AL = default character, if no text
BX = pointer to TEXT structure
OUTPUT:
AL = character from the text (or default character if CY)
CY = error, no text (AL not changed)
Add text/character
TextAddText - add text string to end of text
INPUT:
AX = pointer to second TEXT structure
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddBuf - add text string from buffer to end of text
INPUT:
BX = pointer to TEXT structure
CX = length of second text
SI = pointer to second text
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddTextZ - add ASCIIZ text to end of text
INPUT:
BX = pointer to TEXT structure
SI = pointer to second ASCIIZ text (it can be NULL)
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddChar - add character to end of text
INPUT:
AL = character
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddSpc - add space character to end of text
INPUT:
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddMinus - add minus character to end of text
INPUT:
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddNewLine - add new line CR/LF to end of text
INPUT:
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddDate - add date to end of text
INPUT:
AH = date format (DATEFORM_EURO,...)
BX = pointer to TEXT structure
DL = day
DH = month
SI = year
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error or invalid date format
TextAddTime - add time to end of text
INPUT:
BX = pointer to TEXT structure
CL = minute
CH = hour
DH = second
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error
TextAddDiskSize - add disk size
INPUT:
DX:AX = number of 512 B sectors
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error
TextAddPathSep - add path separator
INPUT:
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error
Number conversion
TextAddDig - add one digit character to end of text
INPUT:
AL = number (in range 0 to 9)
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAdd2Dig - add two digit characters to end of text
INPUT:
AL = number (in range 0 to 99)
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAdd2DigSpc - add two digit characters with space to end of text
INPUT:
AL = number (in range 0 to 99)
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddByte - add unsigned byte number to end of text
INPUT:
AL = unsigned data byte
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddWord - add unsigned word number to end of text
INPUT:
AX = unsigned data word
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddDWord - add unsigned dword number to end of text
INPUT:
DX:AX = unsigned data dword
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddSByte - add signed byte number to end of text
INPUT:
AL = signed data byte
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddSWord - add signed word number to end of text
INPUT:
AX = signed data word
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddSDWord - add signed dword number to end of text
INPUT:
DX:AX = signed data dword
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddHByte - add HEX byte to end of text
INPUT:
AL = data byte
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddHWord - add HEX word to end of text
INPUT:
AX = data word
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error
TextAddHDWord - add HEX dword to end of text
INPUT:
DX:AX = data dword
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error
TextAddBByte - add BIN byte to end of text
INPUT:
AL = data byte
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error (text not changed)
TextAddBWord - add BIN word to end of text
INPUT:
AX = data word
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error
TextAddBDWord - add BIN dword to end of text
INPUT:
DX:AX = data dword
BX = pointer to TEXT structure
OUTPUT:
BX = old or new pointer to TEXT structure
CY = memory error
Delete text
TextDel - delete part of text
INPUT:
BX = pointer to TEXT structure
CX = length of text to delete
SI = offset of text to delete
OUTPUT:
BX = old or new pointer to TEXT structure
NOTES: It limits length and offset to a valid range.
TextDelStart - delete start of text
INPUT:
BX = pointer to TEXT structure
CX = length of text to delete
OUTPUT:
BX = old or new pointer to TEXT structure
NOTES: It limits length to a valid range.
TextDelFrom - delete rest of text from given position
INPUT:
BX = pointer to TEXT structure
SI = offset of text to delete
OUTPUT:
BX = old or new pointer to TEXT structure
NOTES: It limits offset to a valid range.
TextDelEnd - delete end of text
INPUT:
BX = pointer to TEXT structure
CX = length of text to delete
OUTPUT:
BX = old or new pointer to TEXT structure
NOTES: It limits length to a valid range.
TextDelChar - delete one character from text
INPUT:
BX = pointer to TEXT structure
SI = index of character to delete
OUTPUT:
BX = old or new pointer to TEXT structure
NOTES: It checks validity of character position.
TextDelPathSep - delete end path separator (except root)
INPUT:
BX = pointer to TEXT structure
Extract text
TextLeft - get left part of text
INPUT:
BX = pointer to TEXT structure
CX = length of left part of text
OUTPUT:
AX = new TEXT structure or NULL on error
CY = memory error (AX = NULL)
NOTES: It limits length to a valid range.
TextRight - get right part of text
INPUT:
BX = pointer to TEXT structure
CX = length of right part of text
OUTPUT:
AX = new TEXT structure or NULL on error
CY = memory error (AX = NULL)
NOTES: It limits length to a valid range.
TextFrom - get text from given position
INPUT:
BX = pointer to TEXT structure
SI = start position of right part
OUTPUT:
AX = new TEXT structure or NULL on error
CY = memory error (AX = NULL)
NOTES: It limits position to a valid range.
TextMid - get middle part of text
INPUT:
BX = pointer to TEXT structure
CX = length of part of text
SI = start position of part of text
OUTPUT:
AX = new TEXT structure or NULL on error
CY = memory error (AX = NULL)
NOTES: It limits length and position to a valid range.
Conversions
TextUpper - convert text to uppercase letters (only a..z are affected)
INPUT:
BX = pointer to TEXT structure
NOTES: It does not convert national characters.
TextLower - convert text to lowercase letters (only A..Z are affected)
INPUT:
BX = pointer to TEXT structure
NOTES: It does not convert national characters.
TextUpLow - change uppercase/lowercase letters (only a..z, A..Z are affected)
INPUT:
BX = pointer to TEXT structure
NOTES: It does not convert national characters. It changes lowercase letters to uppercase and contrariwise.
TextUpperNat - convert text to uppercase letters with national chars
INPUT:
BX = pointer to TEXT structure
TextLowerNat - convert text to lowercase letters with national chars
INPUT:
BX = pointer to TEXT structure
TextUpLowNat - change uppercase/lowercase letters with national chars
INPUT:
BX = pointer to TEXT structure
NOTES: It changes lowercase letters to uppercase and contrariwise,
TextCapital - capitalize words (only a..z, A..Z are affected)
INPUT:
BX = pointer to TEXT structure
NOTES: It does not convert national characters. It changes first letter of words to uppercase, other lowercase.
Compare text
TextEqu - compare text strings to equality
INPUT:
AX = pointer to second TEXT structure
BX = pointer to first TEXT structure
OUTPUT:
CY = strings are not equal
NOTES: Comparison is case sensitive.
TextComp - compare text strings alphabeticaly
INPUT:
AX = pointer to second TEXT structure
BX = pointer to first TEXT structure
OUTPUT:
AX = first string is 1:greater (later), -1:smaller, 0:equal.
flags SF,ZF contains result (as "or ax,ax")
NOTES: Comparison is not case sensitive (not national characters).
Trim text
TextTrimLeft - trim text from left (delete spaces and control characters from start)
INPUT:
BX = pointer to TEXT structure
TextTrimRight - trim text from right (delete spaces and control characters from end)
INPUT:
BX = pointer to TEXT structure
TextTrim - trim text from left and right (delete spaces and control characters)
INPUT:
BX = pointer to TEXT structure
OUTPUT:
CY = memory error (text may be changed)
TextTrimMid - trim from the text
INPUT:
BX = pointer to TEXT structure
TextTrimList - trim text using list of forbidden characters
INPUT:
AX = pointer to TEXT with list of forbidden characters
BX = pointer to TEXT structure
TextTrimUnlist - trim text using list of allowed characters
INPUT:
AX = pointer to TEXT with list of allowed characters
BX = pointer to TEXT structure
Search text
TextFindChFirst - find first character in text
INPUT:
AL = character to find
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindChNext - find next character in text
INPUT:
AL = character to find
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindChLast - find last character in text
INPUT:
AL = character to find
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindChPrev - find previous character in text
INPUT:
AL = character to find
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind2ChFirst - find first two characters in text
INPUT:
AL = first character to find
AH = second character to find
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found characters (or SI = -1 if not found)
CY = characters not found (SI = -1)
TextFind2ChNext - find next two characters in text
INPUT:
AL = first character to find
AH = second character to find
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found characters (or SI = -1 if not found)
CY = characters not found (SI = -1)
TextFind2ChLast - find last two characters in text
INPUT:
AL = first character to find
AH = second character to find
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found characters (or SI = -1 if not found)
CY = characters not found (SI = -1)
TextFind2ChPrev - find previous two characters in text
INPUT:
AL = first character to find
AH = second character to find
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found characters (or SI = -1 if not found)
CY = characters not found (SI = -1)
TextFindFirst - find first string in text
INPUT:
AX = pointer to TEXT to find
BX = pointer to TEXT where to search
OUTPUT:
SI = offset of found text (or SI = -1 if text not found)
CY = text not found (SI = -1)
TextFindNext - find next string in text
INPUT:
AX = pointer to TEXT to find
BX = pointer to TEXT where to search
SI = start offset
OUTPUT:
SI = offset of found text (or SI = -1 if text not found)
CY = text not found (SI = -1)
TextFindLast - find last string in text
INPUT:
AX = pointer to TEXT to find
BX = pointer to TEXT where to search
OUTPUT:
SI = offset of found text (or SI = -1 if text not found)
CY = text not found (SI = -1)
TextFindPrev - find previous string in text
INPUT:
AX = pointer to TEXT to find
BX = pointer to TEXT where to search
SI = start offset
OUTPUT:
SI = offset of found text (or SI = -1 if text not found)
CY = text not found (SI = -1)
TextFindListFirst - find first character from list in text
INPUT:
AX = pointer to TEXT with list of characters
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindListNext - find next character from list in text
INPUT:
AX = pointer to TEXT with list of characters
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindUnlistFirst - find first character not in list in text
INPUT:
AX = pointer to TEXT with list of characters to skip
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindUnlistNext - find next character not in list in text
INPUT:
AX = pointer to TEXT with list of characters to skip
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindListLast - find last character from list in text
INPUT:
AX = pointer to TEXT with list of characters
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindListPrev - find previous character from list in text
INPUT:
AX = pointer to TEXT with list of characters
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindUnlistLast - find last character not in list in text
INPUT:
AX = pointer to TEXT with list of characters to skip
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFindUnlistPrev - find previous character not in list in text
INPUT:
AX = pointer to TEXT with list of characters to skip
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind2ListFirst - find first character from 2-character list
INPUT:
AL = character 1
AH = character 2
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind2ListNext - find next character from 2-character list
INPUT:
AL = character 1
AH = character 2
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind3ListFirst - find first character from 3-character list
INPUT:
AL = character 1
AH = character 2
DL = character 3
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind3ListNext - find next character from 3-character list
INPUT:
AL = character 1
AH = character 2
DL = character 3
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind4ListFirst - find first character from 4-character list
INPUT:
AL = character 1
AH = character 2
DL = character 3
DH = character 4
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind4ListNext - find next character from 4-character list
INPUT:
AL = character 1
AH = character 2
DL = character 3
DH = character 4
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind2ListLast - find last character from 2-character list
INPUT:
AL = character 1
AH = character 2
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind2ListPrev - find previous character from 2-character list
INPUT:
AL = character 1
AH = character 2
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind3ListLast - find last character from 3-character list
INPUT:
AL = character 1
AH = character 2
DL = character 3
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind3ListPrev - find previous character from 3-character list
INPUT:
AL = character 1
AH = character 2
DL = character 3
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind4ListLast - find last character from 4-character list
INPUT:
AL = character 1
AH = character 2
DL = character 3
DH = character 4
BX = pointer to TEXT structure
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextFind4ListPrev - find previous character from 4-character list
INPUT:
AL = character 1
AH = character 2
DL = character 3
DH = character 4
BX = pointer to TEXT structure
SI = start offset
OUTPUT:
SI = offset of found character (or SI = -1 if not found)
CY = character not found (SI = -1)
TextSubstCh - substitute character
INPUT:
AL = old character (to search for)
AH = new character (to substitute with)
BX = pointer to TEXT structure
Parse text
ParseInt - get unsigned number from text
INPUT:
SI = text
CX = text length
OUTPUT:
DX:AX = number
CY = invalid character (not digit) or overflow
text string TEXT:
TEXT_Length: (word) text length (in bytes)
TEXT_Text: (N bytes) text
CTEXT - macro, constant text string. This is ordinary text string TEXT with text entered as parameter of macro. It usually resides in constant memory. CTEXT should not be freed using TextFree function.
DATEFORM_EURO: (=0) Europe: day.month.year
DATEFORM_USA: (=1) USA: month/day/year
DATEFORM_JAPAN: (=2) Japan: year-month-day