BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
stringfunclib.c File Reference
#include "blitzlib.h"

Functions

void leftstring (void)
void rightstring (void)
void midstring (void)
void midstring2 (void)
void hexstring (void)
void binstring (void)
void chrstring (void)
 Chr$(Expression) - a string of one character.
void ascii (void)
void stringstr (void)
void instrstring (void)
void instrstring2 (void)
void replace (void)
void mkistring (void)
void mklstring (void)
void cvistring (void)
void cvlstring (void)
void lenstring (void)
 Len(String$) - the length of the string.
void unleftstring (void)
void unrightstring (void)
void striplead (void)
void striptrail (void)
void lsetstring (void)
void rsetstring (void)
void centrestring (void)
void lcasestring (void)
void ucasestring (void)
void casesensestring (void)
void stringfunclib_codeinit (void)
void movestring (void)
void cvichk (void)
void cvlchk (void)
void cvqchk (void)
void instrchk (void)
static ULONG movestr (const UBYTE **src, ULONG len)
static ULONG movelong (const UBYTE *src, ULONG len)
BL_ALWAYS_INLINE ULONG movecut (const UBYTE *src, ULONG len)
static UBYTE upcase (UBYTE c)
static ULONG movestring_c (const UBYTE *src, ULONG len)
static ULONG codeinit_c (void)
static void casesensestring_c (UWORD on)
 CaseSense On|Off - case sensitive or insensitive Instr and Replace$.
 BLITZ_ALIAS (casesensestring, casesensestring_c)
static ULONG striptrail_c (UBYTE *s, UWORD ch, const ULONG *lens)
 StripTrail$(String$,Ascii) - the string without the trailing characters Ascii.
 BLITZ_ALIAS (striptrail, striptrail_c)
BL_ALWAYS_INLINE ULONG left (UBYTE *s, LONG n, const ULONG *sp)
static ULONG leftstring_c (UBYTE *s, LONG n, const ULONG *lens)
 Left$(String$,Length) - the first Length characters.
 BLITZ_ALIAS (leftstring, leftstring_c)
static ULONG unleftstring_c (UBYTE *s, LONG n, const ULONG *lens)
 UnLeft$(String$,Length) - the string without its last Length characters.
 BLITZ_ALIAS (unleftstring, unleftstring_c)
static ULONG lsetstring_c (UBYTE *s, LONG n, const ULONG *lens)
 LSet$(String$,Characters) - the string left justified in Characters characters.
 BLITZ_ALIAS (lsetstring, lsetstring_c)
static ULONG rsetstring_c (UBYTE *s, LONG n, const ULONG *lens)
 RSet$(String$,Characters) - the string right justified in Characters characters.
 BLITZ_ALIAS (rsetstring, rsetstring_c)
static ULONG centrestring_c (UBYTE *s, LONG n, const ULONG *lens)
 Centre$(String$,Characters) - the string centred in Characters characters.
 BLITZ_ALIAS (centrestring, centrestring_c)
static ULONG lcasestring_c (UBYTE *s, const ULONG *lens)
 LCase$(String$) - the string in lower case ('A'..'Z' only).
 BLITZ_ALIAS (lcasestring, lcasestring_c)
static BLITZ_ENTRYPOINT ULONG ucasestring_c (UBYTE *s, const ULONG *lens)
 UCase$(String$) - the string in upper case ('a'..'z' only).
 BLITZ_ALIAS_EP (ucasestring, ucasestring_c)
static ULONG striplead_c (UBYTE *s, UWORD ch, const ULONG *lens)
 StripLead$(String$,Ascii) - the string without the leading characters Ascii.
 BLITZ_ALIAS (striplead, striplead_c)
BL_ALWAYS_INLINE ULONG right (UBYTE *s, LONG n, const ULONG *sp)
static BLITZ_ENTRYPOINT ULONG rightstring_c (UBYTE *s, LONG n, const ULONG *lens)
 Right$(String$,Length) - the last Length characters.
 BLITZ_ALIAS_EP (rightstring, rightstring_c)
static BLITZ_ENTRYPOINT ULONG unrightstring_c (UBYTE *s, LONG n, const ULONG *lens)
 UnRight$(String$,Length) - the string without its first Length characters.
 BLITZ_ALIAS_EP (unrightstring, unrightstring_c)
BL_ALWAYS_INLINE ULONG mid (UBYTE *s, LONG start, LONG n, const ULONG *sp)
static BLITZ_ENTRYPOINT ULONG midstring_c (UBYTE *s, LONG start, LONG n, const ULONG *lens)
 Mid$(String$,Startchar,Length) - Length characters from Startchar (1 = the first).
 BLITZ_ALIAS_EP (midstring, midstring_c)
static BLITZ_ENTRYPOINT ULONG midstring2_c (UBYTE *s, LONG start, const ULONG *lens)
 Mid$(String$,Startchar) - the rest of the string from Startchar.
 BLITZ_ALIAS_EP (midstring2, midstring2_c)
static BLITZ_ENTRYPOINT ULONG binstring_c (ULONG v)
 Bin$(Expression) - the value as 32 binary digits.
 BLITZ_ALIAS_EP (binstring, binstring_c)
static BLITZ_ENTRYPOINT ULONG hexstring_c (ULONG v)
 Hex$(Expression) - the value as 8 hexadecimal digits.
 BLITZ_ALIAS_EP (hexstring, hexstring_c)
static ULONG stringstr_c (UBYTE *s, LONG count, const ULONG *lens)
 String$(String$,Repeats) - Repeats copies of the string.
 BLITZ_ALIAS (stringstr, stringstr_c)
static ULONG ascii_c (UBYTE *s, const ULONG *lens)
 Asc(String$) - the code of the first character.
 BLITZ_ALIAS (ascii, ascii_c)
BL_ALWAYS_INLINE ULONG instr (UBYTE *s, const UBYTE *f, LONG start, const ULONG *sp)
static BLITZ_ENTRYPOINT ULONG instrstring_c (UBYTE *s, const UBYTE *f, const ULONG *lens)
 Instr(String$,Findstring$) - the position of Findstring$ in String$.
 BLITZ_ALIAS_EP (instrstring, instrstring_c)
static BLITZ_ENTRYPOINT ULONG instrstring2_c (UBYTE *s, const UBYTE *f, LONG start, const ULONG *lens)
 Instr(String$,Findstring$,Startpos) - the position of Findstring$ in String$, searching from Startpos.
 BLITZ_ALIAS_EP (instrstring2, instrstring2_c)
static ULONG replace_c (UBYTE *s, const UBYTE *f, const UBYTE *r, const ULONG *lens)
 Replace$(String$,Findstring$,Replacestring$) - String$ with every Findstring$ replaced by Replacestring$.
 BLITZ_ALIAS (replace, replace_c)
static ULONG mkistring_c (ULONG v)
 Mki$(Integer) - the low word as a 2 byte string (big endian).
 BLITZ_ALIAS (mkistring, mkistring_c)
static ULONG mklstring_c (ULONG v)
 Mkl$(Long), Mkq$(Quick) - the value as a 4 byte string (big endian).
 BLITZ_ALIAS (mklstring, mklstring_c)
BL_ALWAYS_INLINE ULONG cvbytes (const UBYTE *s, ULONG len, ULONG n, ULONG v)
static BLITZ_ENTRYPOINT ULONG cvistring_c (const UBYTE *s, const ULONG *lens)
 Cvi(String$) - the first 2 bytes of the string as a word.
 BLITZ_ALIAS_EP (cvistring, cvistring_c)
static BLITZ_ENTRYPOINT ULONG cvlstring_c (const UBYTE *s, const ULONG *lens)
 Cvl(String$), Cvq(String$) - the first 4 bytes of the string as a long (Cvq: as a Quick).
 BLITZ_ALIAS_EP (cvlstring, cvlstring_c)
static void cvichk_c (const ULONG *lens)
static void cvlchk_c (const ULONG *lens)
static void cvqchk_c (const ULONG *lens)
static void instrchk_c (LONG start)

Variables

static UWORD csense

Function Documentation

◆ ascii()

void ascii ( void )

◆ ascii_c()

ULONG ascii_c ( UBYTE * s,
const ULONG * lens )
static

Asc(String$) - the code of the first character.

a3 = d0$; the empty string leaves a3 unchanged.

Parameters
sd0: the string
lensa2: the length stack (the string's length)
Returns
d0: the first character (0-255), -1 for the empty string

◆ binstring()

void binstring ( void )

◆ binstring_c()

BLITZ_ENTRYPOINT ULONG binstring_c ( ULONG v)
static

Bin$(Expression) - the value as 32 binary digits.

From bit 31 down, written at a3. The original writes a digit per bit (LSL.l #1,d0:ADDX d3,d1, 36 cycles); here a rotate by 4 brings four bits into the low nibble and a table of the 16 groups of four digits (PC relative) gives their characters, copied by bytes (a3 may be odd): the same text.

Parameters
vd0: the value
Returns
d0: 32, the length; a3 = the end of the result

◆ BLITZ_ALIAS() [1/14]

BLITZ_ALIAS ( ascii ,
ascii_c  )

◆ BLITZ_ALIAS() [2/14]

BLITZ_ALIAS ( casesensestring ,
casesensestring_c  )

◆ BLITZ_ALIAS() [3/14]

BLITZ_ALIAS ( centrestring ,
centrestring_c  )

◆ BLITZ_ALIAS() [4/14]

BLITZ_ALIAS ( lcasestring ,
lcasestring_c  )

◆ BLITZ_ALIAS() [5/14]

BLITZ_ALIAS ( leftstring ,
leftstring_c  )

◆ BLITZ_ALIAS() [6/14]

BLITZ_ALIAS ( lsetstring ,
lsetstring_c  )

◆ BLITZ_ALIAS() [7/14]

BLITZ_ALIAS ( mkistring ,
mkistring_c  )

◆ BLITZ_ALIAS() [8/14]

BLITZ_ALIAS ( mklstring ,
mklstring_c  )

◆ BLITZ_ALIAS() [9/14]

BLITZ_ALIAS ( replace ,
replace_c  )

◆ BLITZ_ALIAS() [10/14]

BLITZ_ALIAS ( rsetstring ,
rsetstring_c  )

◆ BLITZ_ALIAS() [11/14]

BLITZ_ALIAS ( stringstr ,
stringstr_c  )

◆ BLITZ_ALIAS() [12/14]

BLITZ_ALIAS ( striplead ,
striplead_c  )

◆ BLITZ_ALIAS() [13/14]

BLITZ_ALIAS ( striptrail ,
striptrail_c  )

◆ BLITZ_ALIAS() [14/14]

BLITZ_ALIAS ( unleftstring ,
unleftstring_c  )

◆ BLITZ_ALIAS_EP() [1/11]

BLITZ_ALIAS_EP ( binstring ,
binstring_c  )

◆ BLITZ_ALIAS_EP() [2/11]

BLITZ_ALIAS_EP ( cvistring ,
cvistring_c  )

◆ BLITZ_ALIAS_EP() [3/11]

BLITZ_ALIAS_EP ( cvlstring ,
cvlstring_c  )

◆ BLITZ_ALIAS_EP() [4/11]

BLITZ_ALIAS_EP ( hexstring ,
hexstring_c  )

◆ BLITZ_ALIAS_EP() [5/11]

BLITZ_ALIAS_EP ( instrstring ,
instrstring_c  )

◆ BLITZ_ALIAS_EP() [6/11]

BLITZ_ALIAS_EP ( instrstring2 ,
instrstring2_c  )

◆ BLITZ_ALIAS_EP() [7/11]

BLITZ_ALIAS_EP ( midstring ,
midstring_c  )

◆ BLITZ_ALIAS_EP() [8/11]

BLITZ_ALIAS_EP ( midstring2 ,
midstring2_c  )

◆ BLITZ_ALIAS_EP() [9/11]

BLITZ_ALIAS_EP ( rightstring ,
rightstring_c  )

◆ BLITZ_ALIAS_EP() [10/11]

BLITZ_ALIAS_EP ( ucasestring ,
ucasestring_c  )

◆ BLITZ_ALIAS_EP() [11/11]

BLITZ_ALIAS_EP ( unrightstring ,
unrightstring_c  )

◆ casesensestring()

void casesensestring ( void )

◆ casesensestring_c()

void casesensestring_c ( UWORD on)
static

CaseSense On|Off - case sensitive or insensitive Instr and Replace$.

MOVE d0,csense:RTS. The init sets On (-1). Keeps all registers.

Parameters
ond0.w: 0 (Off) = 'a'..'z' compare as upper case, else On

◆ centrestring()

void centrestring ( void )

◆ centrestring_c()

ULONG centrestring_c ( UBYTE * s,
LONG n,
const ULONG * lens )
static

Centre$(String$,Characters) - the string centred in Characters characters.

End of the moved characters: s + d1/2 + len/2 (+1 if both d1 and len are odd: the LSR #1 of d1&len sets the carry, SCS/EXT/SUBA); spaces: (d1-len)/2 in front (written backwards), the rest behind. A longer string keeps the middle d1 characters: s + len/2 - d1/2 (LSR.l). A negative width counts as 0.

Parameters
sd0: the string
nd1: the width
lensa2: the length stack (the string's length)
Returns
d0: the width; a3 = the end of the result

◆ chrstring()

void chrstring ( void )

Chr$(Expression) - a string of one character.

Inline code (copied into the program): MOVE.b d0,(a3)+:MOVEQ #1,d0. Parameter d0.w: the character code (low byte). Result d0: 1, the length; a3 behind the character.

◆ codeinit_c()

ULONG codeinit_c ( void )
static

◆ cvbytes()

BL_ALWAYS_INLINE ULONG cvbytes ( const UBYTE * s,
ULONG len,
ULONG n,
ULONG v )

◆ cvichk()

void cvichk ( void )

◆ cvichk_c()

void cvichk_c ( const ULONG * lens)
static

◆ cvistring()

void cvistring ( void )

◆ cvistring_c()

BLITZ_ENTRYPOINT ULONG cvistring_c ( const UBYTE * s,
const ULONG * lens )
static

Cvi(String$) - the first 2 bytes of the string as a word.

a3 = d0$. Cvi leaves the upper word of the string address in the upper word of d0 (MOVE.b/LSL #8 on the low word only; Cvi is a word function). DIFF: the original does not pop the length (a2 unchanged, unlike the other string functions); the C version is BLITZ_ENTRYPOINT and may change a2, as the other entrypoints (the compiler does not read a2 after the call; same result).

Fixed (#288): only the string's own bytes are read, the missing ones of a shorter string are 0 (the original read 2 bytes whatever the length: the terminating 0 and the bytes behind it). Errors (debugger, cvichk): "Cvi needs a String of at least 2 Characters" (#288: the original had no check).

Parameters
sd0: the string
lensa2: the length stack (the string's length)
Returns
d0.w: the word (big endian)

◆ cvlchk()

void cvlchk ( void )

◆ cvlchk_c()

void cvlchk_c ( const ULONG * lens)
static

◆ cvlstring()

void cvlstring ( void )

◆ cvlstring_c()

BLITZ_ENTRYPOINT ULONG cvlstring_c ( const UBYTE * s,
const ULONG * lens )
static

Cvl(String$), Cvq(String$) - the first 4 bytes of the string as a long (Cvq: as a Quick).

a3 = d0$. DIFF: the length is not popped, as in Cvi.

Fixed (#288): only the string's own bytes are read, the missing ones of a shorter string are 0 (the original read 4 bytes whatever the length). Errors (debugger, cvlchk/cvqchk): "Cvl needs a String of at least 4 Characters", "Cvq needs ..." (#288: the original had no check).

Parameters
sd0: the string
lensa2: the length stack (the string's length)
Returns
d0: the long (big endian)

◆ cvqchk()

void cvqchk ( void )

◆ cvqchk_c()

void cvqchk_c ( const ULONG * lens)
static

◆ hexstring()

void hexstring ( void )

◆ hexstring_c()

BLITZ_ENTRYPOINT ULONG hexstring_c ( ULONG v)
static

Hex$(Expression) - the value as 8 hexadecimal digits.

Upper case, written at a3. The original takes each digit with four LSL.l/ROXL.w pairs and adds "0" (and 7 above "9"); here a rotate by 4 brings it into the low nibble and a table of the 16 digits (PC relative) gives the character: the same text.

Parameters
vd0: the value
Returns
d0: 8, the length; a3 = the end of the result

◆ instr()

BL_ALWAYS_INLINE ULONG instr ( UBYTE * s,
const UBYTE * f,
LONG start,
const ULONG * sp )

◆ instrchk()

void instrchk ( void )

◆ instrchk_c()

void instrchk_c ( LONG start)
static

◆ instrstring()

void instrstring ( void )

◆ instrstring2()

void instrstring2 ( void )

◆ instrstring2_c()

BLITZ_ENTRYPOINT ULONG instrstring2_c ( UBYTE * s,
const UBYTE * f,
LONG start,
const ULONG * lens )
static

Instr(String$,Findstring$,Startpos) - the position of Findstring$ in String$, searching from Startpos.

d4 = Startpos-2 in the original; CaseSense Off compares 'a'..'z' as upper case. a3 = String$.

Fixed (#287): Startpos <= 0 counts as 1, the first character (the original compared before the string: Instr(s$,"",0) = 0, Instr(s$,"",-5) = -5). Errors (debugger, instrchk): "Instr Startpos MUST be greater than zero" (#287: the original had no check).

Parameters
sd0: the string to search in
fd1: the string to find
startd2: the 1-based start position
lensa2: the length stack (String$'s length on top, then Findstring$'s)
Returns
d0: the 1-based position, 0 if not found

◆ instrstring_c()

BLITZ_ENTRYPOINT ULONG instrstring_c ( UBYTE * s,
const UBYTE * f,
const ULONG * lens )
static

Instr(String$,Findstring$) - the position of Findstring$ in String$.

Searches from the first character (d4 = -1 in the original); CaseSense Off compares 'a'..'z' as upper case. a3 = String$.

Parameters
sd0: the string to search in
fd1: the string to find
lensa2: the length stack (String$'s length on top, then Findstring$'s)
Returns
d0: the 1-based position, 0 if not found

◆ lcasestring()

void lcasestring ( void )

◆ lcasestring_c()

ULONG lcasestring_c ( UBYTE * s,
const ULONG * lens )
static

LCase$(String$) - the string in lower case ('A'..'Z' only).

In place. An empty string leaves a3 at its entry value (MOVE.l -(a2),d1:BEQ 'done before MOVE.l d0,a3).

Parameters
sd0: the string
lensa2: the length stack (the string's length)
Returns
d0: the length; a3 = the end of the result

◆ left()

BL_ALWAYS_INLINE ULONG left ( UBYTE * s,
LONG n,
const ULONG * sp )

◆ leftstring()

void leftstring ( void )

◆ leftstring_c()

ULONG leftstring_c ( UBYTE * s,
LONG n,
const ULONG * lens )
static

Left$(String$,Length) - the first Length characters.

In place. A negative length counts as 0 ("simon was here"); a length beyond the string gives the whole string.

Parameters
sd0: the string
nd1: the length
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ lenstring()

void lenstring ( void )

Len(String$) - the length of the string.

Inline code (copied into the program): MOVE.l d0,a3:MOVE.l -(a2),d0 - pops the length (a2 changes, unlike the C routines). Parameter d0: the string; a2: the length stack. Result d0: the length; a3 = the string.

◆ lsetstring()

void lsetstring ( void )

◆ lsetstring_c()

ULONG lsetstring_c ( UBYTE * s,
LONG n,
const ULONG * lens )
static

LSet$(String$,Characters) - the string left justified in Characters characters.

Pads with spaces from the end of the argument (-1(a3)) or cuts. The length is d1 (negative: 0). For d1 = Len(d0$) a3 is left at its entry value - 1 (not a bug: the compiler always leaves a3 one past the argument's 0, so that is the right end).

Parameters
sd0: the string
nd1: the width
lensa2: the length stack (the string's length)
Returns
d0: the width; a3 = the end of the result

◆ mid()

BL_ALWAYS_INLINE ULONG mid ( UBYTE * s,
LONG start,
LONG n,
const ULONG * sp )

◆ midstring()

void midstring ( void )

◆ midstring2()

void midstring2 ( void )

◆ midstring2_c()

BLITZ_ENTRYPOINT ULONG midstring2_c ( UBYTE * s,
LONG start,
const ULONG * lens )
static

Mid$(String$,Startchar) - the rest of the string from Startchar.

Mid$ with the length Len(d0$)-d1+1 (read from -4(a2)).

Fixed (#286): see Mid$ with three arguments.

Parameters
sd0: the string
startd1: the first character (1-based)
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ midstring_c()

BLITZ_ENTRYPOINT ULONG midstring_c ( UBYTE * s,
LONG start,
LONG n,
const ULONG * lens )
static

Mid$(String$,Startchar,Length) - Length characters from Startchar (1 = the first).

First position = 0 after SUBQ.l #1,d1, then negative start/length count as 0. Start beyond the end: empty; the length is cut at the end.

Fixed (#286): the length is cut at the end also when start-1+length exceeds $7FFFFFFF (the original compared the sum signed and copied length bytes).

Parameters
sd0: the string
startd1: the first character (1-based)
nd2: the length
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ mkistring()

void mkistring ( void )

◆ mkistring_c()

ULONG mkistring_c ( ULONG v)
static

Mki$(Integer) - the low word as a 2 byte string (big endian).

Parameters
vd0: the value
Returns
d0: 2, the length; a3 = the end of the result

◆ mklstring()

void mklstring ( void )

◆ mklstring_c()

ULONG mklstring_c ( ULONG v)
static

Mkl$(Long), Mkq$(Quick) - the value as a 4 byte string (big endian).

Parameters
vd0: the value
Returns
d0: 4, the length; a3 = the end of the result

◆ movecut()

BL_ALWAYS_INLINE ULONG movecut ( const UBYTE * src,
ULONG len )

◆ movelong()

ULONG movelong ( const UBYTE * src,
ULONG len )
static

◆ movestr()

ULONG movestr ( const UBYTE ** src,
ULONG len )
inlinestatic

◆ movestring()

void movestring ( void )

◆ movestring_c()

ULONG movestring_c ( const UBYTE * src,
ULONG len )
static

◆ replace()

void replace ( void )

◆ replace_c()

ULONG replace_c ( UBYTE * s,
const UBYTE * f,
const UBYTE * r,
const ULONG * lens )
static

Replace$(String$,Findstring$,Replacestring$) - String$ with every Findstring$ replaced by Replacestring$.

The result is built at a3 (behind the arguments), then moved to d0$. End test: a0+Len(f$) > address of f$ (BHI) - the find string is expected right behind s$ in the work area. CaseSense Off compares 'a'..'z' as upper case. DIFF: with an empty find string the original pops only two lengths (two MOVE.l -(a2) before BEQ 'skip), otherwise three (SUBQ #4,a2), so a2 is left at different positions; the C version leaves a2 unchanged.

Fixed (#424): an empty find string returns s$ unchanged with a3 on its terminating 0; the original left a3 at its entry value, behind all three arguments.

Parameters
sd0: the string
fd1: the string to find
rd2: the replacement
lensa2: the length stack (the three lengths, String$'s on top)
Returns
d0: the length of the result; a3 = its end

◆ right()

BL_ALWAYS_INLINE ULONG right ( UBYTE * s,
LONG n,
const ULONG * sp )

◆ rightstring()

void rightstring ( void )

◆ rightstring_c()

BLITZ_ENTRYPOINT ULONG rightstring_c ( UBYTE * s,
LONG n,
const ULONG * lens )
static

Right$(String$,Length) - the last Length characters.

Moved to the start of the argument (movestring). A negative length counts as 0; a length beyond the string gives the whole string.

Fixed (#285): the offset Len-Length is a long (the original took it as a word: for Len-Length >= 32768 the characters before the string).

Parameters
sd0: the string
nd1: the length
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ rsetstring()

void rsetstring ( void )

◆ rsetstring_c()

ULONG rsetstring_c ( UBYTE * s,
LONG n,
const ULONG * lens )
static

RSet$(String$,Characters) - the string right justified in Characters characters.

The characters are moved to the end of d1 characters (backwards from -1(a3)), spaces in front; a longer string keeps its last d1 characters (movestring). A negative width counts as 0.

Parameters
sd0: the string
nd1: the width
lensa2: the length stack (the string's length)
Returns
d0: the width; a3 = the end of the result

◆ stringfunclib_codeinit()

void stringfunclib_codeinit ( void )

◆ stringstr()

void stringstr ( void )

◆ stringstr_c()

ULONG stringstr_c ( UBYTE * s,
LONG count,
const ULONG * lens )
static

String$(String$,Repeats) - Repeats copies of the string.

movestring copies the argument behind itself (from -1(a3) on) with a0 trailing by one length, then the whole block is moved to the start. A count <= 0 gives the empty string. DIFF: for a count <= 0 the original returns the empty string without popping the argument's length (MOVE.l d1,d3:BLE 'skip comes first), so a2 is left at another position than for count > 0; the C version leaves a2 unchanged in both cases (same results).

Parameters
sd0: the string
countd1: the number of copies
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ striplead()

void striplead ( void )

◆ striplead_c()

ULONG striplead_c ( UBYTE * s,
UWORD ch,
const ULONG * lens )
static

StripLead$(String$,Ascii) - the string without the leading characters Ascii.

Strips the leading characters d1.b; the rest is moved to the start (movestring); all stripped: d0 = 0, a3 = d0$.

Parameters
sd0: the string
chd1.w: the character to strip (low byte)
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ striptrail()

void striptrail ( void )

◆ striptrail_c()

ULONG striptrail_c ( UBYTE * s,
UWORD ch,
const ULONG * lens )
static

StripTrail$(String$,Ascii) - the string without the trailing characters Ascii.

In place: a3 is moved back over the trailing characters d1.b.

Parameters
sd0: the string
chd1.w: the character to strip (low byte)
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ ucasestring()

void ucasestring ( void )

◆ ucasestring_c()

BLITZ_ENTRYPOINT ULONG ucasestring_c ( UBYTE * s,
const ULONG * lens )
static

UCase$(String$) - the string in upper case ('a'..'z' only).

In place. An empty string leaves a3 at its entry value, as LCase$.

Parameters
sd0: the string
lensa2: the length stack (the string's length)
Returns
d0: the length; a3 = the end of the result

◆ unleftstring()

void unleftstring ( void )

◆ unleftstring_c()

ULONG unleftstring_c ( UBYTE * s,
LONG n,
const ULONG * lens )
static

UnLeft$(String$,Length) - the string without its last Length characters.

Left$(d0$,Len(d0$)-d1); the length is read with -4(a2).

Parameters
sd0: the string
nd1: the number of characters to remove
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ unrightstring()

void unrightstring ( void )

◆ unrightstring_c()

BLITZ_ENTRYPOINT ULONG unrightstring_c ( UBYTE * s,
LONG n,
const ULONG * lens )
static

UnRight$(String$,Length) - the string without its first Length characters.

Right$(d0$,Len(d0$)-d1); the length is read with -4(a2).

Fixed (#285): as Right$, a long offset into the string.

Parameters
sd0: the string
nd1: the number of characters to remove
lensa2: the length stack (the string's length)
Returns
d0: the length of the result; a3 = its end

◆ upcase()

UBYTE upcase ( UBYTE c)
inlinestatic

Variable Documentation

◆ csense

UWORD csense
static