LIBSTRING-INMOS(3)

NAME
append.char, append.hex.int, append.hex.int64, append.int, append.int64, append.real32, append.real64, append.text, char.pos, compare.strings, delete.string, eqstr, insert.string, is.digit, is.hex.digit, is.id.char, is.in.range, is.lower, is.upper, next.int.from.line, next.word.from.line, search.match, search.no.match, str.shift, string.pos, to.lower.case, to.uppwer.case - KRoC INMOS occam toolset string library

SYNOPSIS
#INCLUDE "string.module"

PROC append.char (INT len, []BYTE str, VAL BYTE char)
PROC append.hex.int (INT len, []BYTE str, VAL INT number, VAL INT width)
PROC append.hex.int64 (INT len, []BYTE str, VAL INT64 number, VAL INT width)
PROC append.int (INT len, []BYTE str, VAL INT number, VAL INT field)
PROC append.int64 (INT len, []BYTE str, VAL INT64 number, VAL INT field)
PROC append.real32 (INT len, []BYTE str, VAL REAL32 number, VAL INT Ip, VAL INT Dp)
PROC append.real64 (INT len, []BYTE str, VAL REAL64 number, VAL INT Ip, VAL INT Dp)
PROC append.text (INT len, []BYTE str, VAL []BYTE text)

INT FUNCTION char.pos (VAL BYTE search, VAL []BYTE str)
INT FUNCTION compare.strings (VAL []BYTE str1, VAL []BYTE str2)
PROC delete.string (INT len, []BYTE str, VAL INT start, VAL INT size, BOOL not.done)
BOOL FUNCTION eqstr (VAL []BYTE s1, VAL []BYTE s2)
PROC insert.string (VAL []BYTE new.str, INT len, []BYTE str, VAL INT start, BOOL not.done)

BOOL FUNCTION is.digit (VAL BYTE char)
BOOL FUNCTION is.hex.digit (VAL BYTE char)
BOOL FUNCTION is.id.char (VAL BYTE char)
BOOL FUNCTION is.in.range (VAL BYTE char, VAL BYTE bottom, VAL BYTE top)
BOOL FUNCTION is.lower (VAL BYTE char)
BOOL FUNCTION is.upper (VAL BYTE char)

PROC next.int.from.line (VAL []BYTE line, INT ptr, INT number, BOOL ok)
PROC next.word.from.line (VAL []BYTE line, INT ptr, INT len, []BYTE word, BOOL ok)
INT,BYTE FUNCTION search.match (VAL []BYTE possibles, VAL []BYTE str)
INT,BYTE FUNCTION search.no.match (VAL []BYTE possibles, VAL []BYTE str)
PROC str.shift ([]BYTE str, VAL INT start, VAL INT len, VAL INT shift, BOOL not.done)
INT FUNCTION string.pos (VAL []BYTE search, VAL []BYTE str)
PROC to.lower.case ([]BYTE str)
PROC to.upper.case ([]BYTE str)

SUMMARY
The occam toolset library string.lib provides various string handling functions and procedures.

DESCRIPTION
append.char, append.hex.int, append.hex.int64, append.int, append.int64, append.real32, append.real64 and append.text append the given data type to an array str at position len using formatting where necessary and possibly padding with spaces to a given field width or printing Ip integer places and Dp decimal places for REAL32 and REAL64 types. Hex numbers are formatted prefixed by a '#'. STOPs if the array overflows. len is updated to the new position.

char.pos returns the position of the first occurence of character search in str or -1 if not found. See also string.pos.

compare.strings compares two strings and returns the result of the comparison:
-2 | if str1 is earlier than str2
-1 | if str1 is a leading substring of str2
0 | if the strings are identical
1 | if str2 is a leading substring of str1
2 | if str2 is earlier than str1

delete.string deletes size characters from position start of string str of size len characters. not.done is TRUE if the range is invalid. See also str.shift.

eqstr returns TRUE if the strings are identical.

insert.string inserts new.str into str of size len characters at position start. not.done is TRUE if the range is invalid. See also str.shift.

is.digit and is.hex.digit return TRUE if the given character is a valid decimal or hex digit respectively.

is.id.char returns TRUE if the given character can be part of an occam identifier.

is.in.range returns TRUE if bottom <= char <= top.

is.lower and is.upper return TRUE if the given character is an upper or lower case letter.

next.int.from.line and next.word.from.line return the next white-space separated integer/word from the array line, using ptr as a index into it. Updates ptr and sets ok to FALSE if the operation fails. len is the returned length of word or zero on end of line.

search.match searches str for any of the characters in possibles. Return the position and character or -1,255(BYTE) if none are found.

Return the position and character or -1,255(BYTE) if none are found.

str.shift moves the substring [str FROM start FOR len right shift places. not.done is TRUE if the operation is invalid. See also delete.string and insert.string.

string.pos returns the position of the string search in str or -1 if not found. See also char.pos.

to.lower.case and to.upper.case convert the given string to lower/upper case respectively.

SEE ALSO
kroc(1)
INMOS occam 2 toolset user manual - part 2 (occam libraries and appendices) INMOS document number 72 TDS 276 02.

AUTHOR
This document is Copyright (C) 1993 David Beckett, University of Kent at Canterbury. Thie manual page is maintained by Fred Barnes <frmb@kent.ac.uk>

The library contents are Copyright (C) 1991 INMOS Limited.