Previous: argument-list-summary Up: ../chrrtn.html Next: argument-summary


COMPARISON-WITH-KAR-FAMILY

 The following list is  a pairwise comparison  of the CHRxxx  primitives
 with the old KARxxx routines.  The argument types are listed in  square
 brackets at the  end of  each line,  with I  = INTEGER,  H =  Hollerith
 (stored in INTEGER), and C = CHARACTER.

 The names CHAR, ICHAR, and LEN  are FORTRAN 77 intrinsic functions,  so
 they are no longer  used for argument names.   Although FORTRAN has  no
 reserved keywords,  I  have encountered  at  least one  compiler  which
 raised an error at the use of names of intrinsics as variable names.

 The offset arguments (LOCx)  are not required  in the CHRxxx  routines.
 KARGET and KARPUT have no CHRxxx equivalents because they are trivially
 done by inline assignment with CHARACTER data.

 KARPAK and KARUPK have no CHRxxx equivalents because CHARACTER  strings
 are stored packed in all implementations that I am aware of.

 CHRRI2 and CHRRIX are new; equivalents should have been defined for the
 KARxxx family.

 CHRMAT is new; it is a  complement to CHRVFY, and an equivalent  should
 have been included in the KARxxx family.

 CHRCTH and CHRHTC are not required in a pure CHARACTER environment, but
 are provided to allow conversion between packed Hollerith and CHARACTER
 data for environments  where both continue  to co-exist.  For  example,
 some FORTRAN  77 implementations  require  string parameters  in  OPEN,
 CLOSE, and  INQUIRE  statements  to  be  of  type  CHARACTER,  although
 Hollerith data are permitted elsewhere.

 Apart from  argument type  differences, the  functionality of  each  is
 identical with three exceptions.

 First, since  CHRLCL  returns  a  host CHARACTER  value  for  an  ASCII
 ordinal, it is no longer possible to return a special value as an error
 flag, as KARLCL  does, when the  host character set  has no  equivalent
 character.  This  is unlikely  to  be a  problem,  in that  almost  all
 machines no use 7 or more bits for each character, so equivalents do in
 fact exist.  If  it becomes  necessary to do  so, then  the least  used
 character, preferably that corresponding to  host ordinal 0, should  be
 returned.

 Second, the comparison routines, CHRCM2  and CHRCMP, return values  -k,
 0, +k, instead of -1, 0, +1, when the first string lexically  precedes,
 is equal to, or follows, the second string.  The absolute value of k is
 the index of the character at which the first mismatch is found.  Thus,
 CHRIDX('ABC','ABD',3) will  return  -3,  indicating  that  the  strings
 differ in the  third character,  and the first  lexically precedes  the
 second in the ASCII character set.

 Third, the substring index routines,  CHRID2 and CHRIDX, return  values
 in the range 0 ..  LENA-LENB+1, instead of either  0, or values in  the
 range LOCA .. LOCA+LENA-LENB+1.  This  is consistent with the  omission
 of the offset arguments.

 CHARACTER FUNCTION  CHRCHR (ORD)                           [I]
 INTEGER FUNCTION    KARCHR (ORD)                           [I]

 INTEGER FUNCTION  CHRASC (C)                               [C]
 INTEGER FUNCTION  KARASC (CHAR)                            [H]

 INTEGER FUNCTION  CHRCM2 (TEXTA,TEXTB,LENGTH)              [CCI]
 INTEGER FUNCTION  KARCM2 (TEXTA,LOCA,TEXTB,LOCB,LENGTH)    [HIHII]

 INTEGER FUNCTION  CHRCMP (TEXTA,TEXTB,LENGTH)              [CCI]
 INTEGER FUNCTION  KARCMP (TEXTA,LOCA,TEXTB,LOCB,LENGTH)    [HIHII]

 SUBROUTINE  CHRCTH (HOLLER,LOC,LENGTH,TEXT)                [HIIC]
 -- no equivalent --

 -- equivalent not required --
 SUBROUTINE  KARGET (CHAR, TEXT, LOC)                       [HHI]

 SUBROUTINE  CHRHTC (TEXT,HOLLER,LOC,LENGTH)                [CHII]
 -- no equivalent --

 INTEGER FUNCTION  CHRID2 (TEXTA,LENA,TEXTB,LENB)           [CICI]
 INTEGER FUNCTION  KARID2 (TEXTA,LOCA,LENA,TEXTB,LOCB,LENB) [HIIHII]

 INTEGER FUNCTION  CHRIDX (TEXTA,LENA,TEXTB,LENB)           [CICI]
 INTEGER FUNCTION  KARIDX (TEXTA,LOCA,LENA,TEXTB,LOCB,LENB) [HIIHII]

 CHARACTER FUNCTION  CHRLC (C)                              [C]
 INTEGER FUNCTION    KARLC (CHAR)                           [H]

 CHARACTER FUNCTION  CHRLCL (ASCORD)                        [I]
 INTEGER FUNCTION    KARLCL (ASCORD)                        [I]

 INTEGER FUNCTION  CHRLEN (TEXT,LENGTH)                     [CI]
 -- no equivalent defined --

 INTEGER FUNCTION  CHRMAT (TEXT,LENTXT,PATERN,LENPAT)       [CICI]
 -- no equivalent defined --

 SUBROUTINE  CHRMOV (TARGET,SOURCE,LENGTH)                  [CCI]
 SUBROUTINE  KARMOV (TARGET,LOCTAR,SOURCE,LOCSRC,LENGTH)    [HIHII]

 INTEGER FUNCTION  CHRORD (C)                               [C]
 INTEGER FUNCTION  KARORD (CHAR)                            [H]

 -- equivalent not required --
 SUBROUTINE  KARPAK (TARGET,LOCTAR,SOURCE,LENGTH)           [HIHI]

 -- equivalent not required --
 SUBROUTINE  KARPUT (CHAR, TEXT, LOC)                       [HHI]

 INTEGER FUNCTION  CHRRI2 (TEXTA,LENA,TEXTB,LENB)           [CICI]
 -- no equivalent defined --

 INTEGER FUNCTION  CHRRIX (TEXTA,LENA,TEXTB,LENB)           [CICI]
 -- no equivalent defined --

 SUBROUTINE  CHRSWP (TEXTA,TEXTB,LENGTH)                    [CCI]
 SUBROUTINE  KARSWP (TEXTA,LOCA,TEXTB,LOCB,LENGTH)          [HIHII]

 CHARACTER FUNCTION  CHRUC (C)                              [C]
 INTEGER FUNCTION    KARUC (CHAR)                           [H]

 -- equivalent not required --
 SUBROUTINE  KARUPK (TARGET,SOURCE,LOCSRC,LENGTH)           [HHII]

 INTEGER FUNCTION  CHRVFY (TEXT,LENTXT,PATERN,LENPAT)       [CICI]
 INTEGER FUNCTION  KARVFY (TEXT,LOCTXT,LENTXT,PATERN,LOCPAT,LENPAT)
                                                            [HIIHII]

 SUBROUTINE  CHRXLT (TEXT,LENTXT,OLD,NEW,LENSUB)            [CICCI]
 SUBROUTINE  KARXLT (TEXT,LOCTXT,LENTXT,OLD,LOCOLD,NEW,LOCNEW,LEN)
                                                            [HIIHIHII]