[comp.binaries.ibm.pc.d] Turbo Pascal asm string functions upload to SIMTEL20

w8sdz@WSMR-SIMTEL20.ARMY.MIL (Keith Petersen) (09/14/89)

[--forwarded message--]
From: Rich Winkel    UMC Math Department <MATHRICH@UMCVMB.MISSOURI.EDU>
Re:   Turbo Pascal asm string functions upload

I uploaded TPSTRING.ARC for directory <MSDOS.TURBOPAS>.  This should
replace PSTRING5.ARC.  This is version 1.2 of my STRINGS.TPU for Turbo
Pascal. This tpu contains 29 string-oriented functions paralleling the
string functions available in IBM's mainframe language Rexx.  All
functions are implemented in assembler and make extensive use of the
80x86's string opcodes (REPxx SCASB, CMPSB, MOVSB).  The routines are
highly optimized, FAST and compact.  Included are:

LASTPOS(findstr,instr,start), FIRSTPOS(findstr,instr,start)
   Last and first position of FINDSTR in INSTR, subject to START.
   Firstpos is equivalent to TP's POS function (except for the start
   option) but runs nearly 10 times faster! (On my IBM XT with V20 cpu)
SUBSTR(str,start,len) identical to TP's COPY function.
INSTR(new,str,pos,pad) similar to TP's INSERT procedure, but 60% faster.
DELSTR(str,pos,len) similar to TP's DELETE procedure, but 50% faster.
LEFT(str,width,pad), RIGHT(str,width,pad), CENTER(str,width,pad)
   Positions/truncates STR in a field of width WIDTH, padding out with PAD
   if needed.
WORDS(str) Number of words in STR.
SUBWORD(str,n,count), WERD(str,n)
   Extract COUNT (or 1) words from STR, starting at word N.
DELWORD(str,n,count)
   Delete COUNT words from STR, starting at word N.
WORD2POS(str,wrd), POS2WORD(str,pos)
   Convert between word number and character position.
JUSTIFY(str,len)
   Distribute blanks between words in STR to left and right justify.
SPACE(str,spc) Adjust number of spaces between each word in STR.
OVERLAY(new,str,pos,pad) Overlays NEW onto STR starting at position POS.
STRIP(str,opt,ch) Strips all leading and/or trailing CH characters from STR.
COPIES(str,count) Returns STR concatenated with itself COUNT times.
XRANGE(c1,c2) Returns string consisting of all characters from C1 to C2
   inclusive.
TRANSLATE(str,intable,outable)
   Translates characters in STR via F(intable[i]) = outable[i].
D2X(d) X2D(x) Converts between hex string and WORD type.
COMPARE(str1,str2) Character position where STR1 differs from STR2.
UPPERCASE(str), lowercase(str) Case conversion.
ABBREV(str,abbr,len) Boolean: checks if ABBR is valid abbreviation for STR.
REVERSE(str) Returns contents of STR in reverse order.
VERIFY(str,reference,opt,start) Check for valid or invalid chars in STR.

TPU's for Tpas 4.0, 5.0 and 5.5 are included.
Benchmark and test suite programs are also included.

Rich Winkel
MATHRICH@UMCVMB.MISSOURI.EDU or MATHRICH@UMCVMB.BITNET

---

Thanks, Rich!  TPSTRING.ARC is now in directory pd1:<msdos.turbopas>.

--Keith