# kc-20220628/README.ja.txt for kc.c on Unix

Copyleft (C) 2022 Taiji Yamada <taiji@aihara.co.jp>

## kc.c for Unix

This is a complieable modified kc.c on POSIX systems other than
DOS. The original can be found at source/kc/kc.c below.

	https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.0/pkgs/keybs.zip

It is just a text processing program in the first place, so it can be
ported without difficulty, but the one that was a little troublesome
was the realization of the DOS-specific `itoa` function. It is not a
hassle if it is only for `kc.c`, but it is okay if the horizontal code
is accidentally disseminated, so I realized the `itoa` specufication.

## itoa.h, itoa.c for Unix

The need for inverse functions of `atoi` series other than radix 2, 8,
10, 16 is unclear, but that is what `itoa` supports radix from 2
through 32. Other functions are available as follows.

--------
char *itoa(int v, char *b, const int r);
char *i16toa(int16_t v, char *b, const int r);
char *ui16toa(uint16_t v, char *b, const int r);
char *i32toa(int32_t v, char *b, const int r);
char *ui32toa(uint32_t v, char *b, const int r);
--------

For verification, I prepared the inverse functions of `itoa` series,
which are stoi instead of `atoi`.

--------
int stoi(const char *b, const int r);
int16_t stoi16(const char *b, const int r);
int16_t stoui16(const char *b, const int r);
int32_t stoi32(const char *b, const int r);
uint32_t stoui32(const char *b, const int r);
--------

By the way, the same policy as above would not work to implement the
following: I will consider it soon.

--------
char *i64toa(int64_t v, char *b, const int r);
char *ui64toa(uint64_t v, char *b, const int r);
int64_t stoi64(const char *b, const int r);
uint64_t stoui64(const char *b, const int r);
--------

## Reference(s)

[1] Microsoft, ``itoa, ...,'' https://docs.microsoft.com/ja-jp/cpp/c-runtime-library/reference/itoa-itow?view=msvc-170, 2022/06/28 view.
