libgrapheme

Freestanding C library for unicode string handling
git clone https://git.sinitax.com/suckless/libgrapheme
Log | Files | Refs | README | LICENSE | sfeed.txt

is_case.sh (1563B)


      1if [ "$ENCODING" = "utf8" ]; then
      2	UNIT="byte"
      3	ARRAYTYPE="UTF-8-encoded string"
      4	SUFFIX="_utf8"
      5	ANTISUFFIX=""
      6	DATATYPE="char"
      7else
      8	UNIT="codepoint"
      9	ARRAYTYPE="codepoint array"
     10	SUFFIX=""
     11	ANTISUFFIX="_utf8"
     12	DATATYPE="uint_least32_t"
     13fi
     14
     15cat << 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
     27The
     28.Fn grapheme_is_${CASE}${SUFFIX}
     29function checks if the ${ARRAYTYPE}
     30.Va str
     31is ${CASE} and writes the length of the matching ${CASE}-sequence to the integer pointed to by
     32.Va caselen ,
     33unless
     34.Va caselen
     35is set to
     36.Dv NULL .
     37.Pp
     38If
     39.Va len
     40is set to
     41.Dv SIZE_MAX
     42(stdint.h is already included by grapheme.h) the ${ARRAYTYPE}
     43.Va src
     44is interpreted to be NUL-terminated and processing stops when a
     45NUL-byte is encountered.
     46.Pp
     47For $(if [ "$ENCODING" != "utf8" ]; then printf "UTF-8-encoded"; else printf "non-UTF-8"; fi) input data
     48.Xr grapheme_is_${CASE}${ANTISUFFIX} 3
     49can be used instead.
     50.Sh RETURN VALUES
     51The
     52.Fn grapheme_is_${CASE}${SUFFIX}
     53function returns
     54.Dv true
     55if the ${ARRAYTYPE}
     56.Va str
     57is ${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}
     64is compliant with the Unicode ${UNICODE_VERSION} specification.
     65.Sh AUTHORS
     66.An Laslo Hunhold Aq Mt dev@frign.de
     67EOF