Previous: karcm2 Up: ../karrtn.html Next: karget


KARCMP

       INTEGER FUNCTION KARCMP (TEXTA,LOCA,TEXTB,LOCB,LENGTH)

          Given two  packed character  strings, TEXTA(*)  and
 TEXTB(*), beginning at  character positions LOCA in TEXTA(*)
 and LOCB in TEXTB(*),  compare the next LENGTH characters of
 the two strings, and return -1, 0, or +1 according to A < B,
 A = B, or A  > B, respectively.  The collating sequence that
 MUST be used is that defined by the ASCII character set. The
 overhead for this is minimal, and often will require no more
 than an indexed register load, rather than a direct load, in
 an assembly language implementation.  Thus

       I = KARCMP(1H ,1,1HA,1,1)

 will  ALWAYS give I  = -1, even on  a machine such  as a CDC
 computer  which uses  an internal representation  in which a
 space  is greater than  the letter A.  Note  that upper- and
 lower-case letters are NOT equivalent with this function. If
 any of LOCTAR, LOCSRC, or LENGTH is less than 1, then KARCMP
 =  0 on return.   This result  is chosen to  comply with the
 interpretation  that invalid  strings are  null strings, and
 all null strings are equivalent.