libgrapheme

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

to_case.sh (1616B)


      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_TO_$(printf "%s%s" "$CASE" "$SUFFIX" | tr [:lower:] [:upper:]) 3
     18.Os suckless.org
     19.Sh NAME
     20.Nm grapheme_to_${CASE}${SUFFIX}
     21.Nd convert ${ARRAYTYPE} to ${CASE}
     22.Sh SYNOPSIS
     23.In grapheme.h
     24.Ft size_t
     25.Fn grapheme_to_${CASE}${SUFFIX} "const ${DATATYPE} *src" "size_t srclen" "${DATATYPE} *dest" "size_t destlen"
     26.Sh DESCRIPTION
     27The
     28.Fn grapheme_to_${CASE}${SUFFIX}
     29function converts the ${ARRAYTYPE}
     30.Va str
     31to ${CASE} and writes the result to
     32.Va dest
     33up to
     34.Va destlen ,
     35unless
     36.Va dest
     37is set to
     38.Dv NULL .
     39.Pp
     40If
     41.Va srclen
     42is set to
     43.Dv SIZE_MAX
     44(stdint.h is already included by grapheme.h) the ${ARRAYTYPE}
     45.Va src
     46is interpreted to be NUL-terminated and processing stops when a
     47NUL-byte is encountered.
     48.Pp
     49For $(if [ "$ENCODING" != "utf8" ]; then printf "UTF-8-encoded"; else printf "non-UTF-8"; fi) input data
     50.Xr grapheme_to_${CASE}${ANTISUFFIX} 3
     51can be used instead.
     52.Sh RETURN VALUES
     53The
     54.Fn grapheme_to_${CASE}${SUFFIX}
     55function returns the number of ${UNIT}s in the array resulting
     56from converting
     57.Va src
     58to ${CASE}, even if
     59.Va destlen
     60is not large enough or
     61.Va dest
     62is
     63.Dv NULL .
     64.Sh SEE ALSO
     65.Xr grapheme_to_${CASE}${ANTISUFFIX} 3 ,
     66.Xr libgrapheme 7
     67.Sh STANDARDS
     68.Fn grapheme_to_${CASE}${SUFFIX}
     69is compliant with the Unicode ${UNICODE_VERSION} specification.
     70.Sh AUTHORS
     71.An Laslo Hunhold Aq Mt dev@frign.de
     72EOF