libgrapheme

unicode string library
git clone git://git.suckless.org/libgrapheme
Log | Files | Refs | README | LICENSE

is_case.sh (1563B)


      1 if [ "$ENCODING" = "utf8" ]; then
      2 	UNIT="byte"
      3 	ARRAYTYPE="UTF-8-encoded string"
      4 	SUFFIX="_utf8"
      5 	ANTISUFFIX=""
      6 	DATATYPE="char"
      7 else
      8 	UNIT="codepoint"
      9 	ARRAYTYPE="codepoint array"
     10 	SUFFIX=""
     11 	ANTISUFFIX="_utf8"
     12 	DATATYPE="uint_least32_t"
     13 fi
     14 
     15 cat << EOF
     16 .Dd ${MAN_DATE}
     17 .Dt GRAPHEME_IS_$(printf "%s%s" "$CASE" "$SUFFIX" | tr [:lower:] [:upper:]) 3
     18 .Os suckless.org
     19 .Sh NAME
     20 .Nm grapheme_is_${CASE}${SUFFIX}
     21 .Nd check if ${ARRAYTYPE} is ${CASE}
     22 .Sh SYNOPSIS
     23 .In grapheme.h
     24 .Ft size_t
     25 .Fn grapheme_is_${CASE}${SUFFIX} "const ${DATATYPE} *str" "size_t len" "size_t *caselen"
     26 .Sh DESCRIPTION
     27 The
     28 .Fn grapheme_is_${CASE}${SUFFIX}
     29 function checks if the ${ARRAYTYPE}
     30 .Va str
     31 is ${CASE} and writes the length of the matching ${CASE}-sequence to the integer pointed to by
     32 .Va caselen ,
     33 unless
     34 .Va caselen
     35 is set to
     36 .Dv NULL .
     37 .Pp
     38 If
     39 .Va len
     40 is set to
     41 .Dv SIZE_MAX
     42 (stdint.h is already included by grapheme.h) the ${ARRAYTYPE}
     43 .Va src
     44 is interpreted to be NUL-terminated and processing stops when a
     45 NUL-byte is encountered.
     46 .Pp
     47 For $(if [ "$ENCODING" != "utf8" ]; then printf "UTF-8-encoded"; else printf "non-UTF-8"; fi) input data
     48 .Xr grapheme_is_${CASE}${ANTISUFFIX} 3
     49 can be used instead.
     50 .Sh RETURN VALUES
     51 The
     52 .Fn grapheme_is_${CASE}${SUFFIX}
     53 function returns
     54 .Dv true
     55 if the ${ARRAYTYPE}
     56 .Va str
     57 is ${CASE}, otherwise
     58 .Dv false .
     59 .Sh SEE ALSO
     60 .Xr grapheme_is_${CASE}${ANTISUFFIX} 3 ,
     61 .Xr libgrapheme 7
     62 .Sh STANDARDS
     63 .Fn grapheme_is_${CASE}${SUFFIX}
     64 is compliant with the Unicode ${UNICODE_VERSION} specification.
     65 .Sh AUTHORS
     66 .An Laslo Hunhold Aq Mt dev@frign.de
     67 EOF