author: kx <kx@radix-linux.su> 2025-01-05 15:42:39 +0300
committer: kx <kx@radix-linux.su> 2025-01-05 15:42:39 +0300
commit: 41c271dacd0d2e4eae1378b098448e3554ea657b
parent: 662a29cbe51f565cb7e04345772b16795fbf4182
Commit Summary:
Diffstat:
1 file changed, 107 insertions, 0 deletions
diff --git a/man/iitoa.3mpu b/man/iitoa.3mpu
new file mode 100644
index 0000000..e8f43e6
--- /dev/null
+++ b/man/iitoa.3mpu
@@ -0,0 +1,115 @@
+.TH iitoa 3 "December 27, 2024" "libmpu" "LibMPU Programmer's Manual"
+.SH NAME
+\fBiitoa\fP, \fBiuitoa\fP \- functions for converting an integer to an ASCII string
+.SH SYNOPSIS
+.nf
+.B #include <libmpu.h>
+.PP
+.BI "void iitoa( __mpu_char8_t *" str ", mpu_int *" a ", int " radix ", int " uf ", int " nb " );
+.BI "void iuitoa( __mpu_char8_t *" str ", mpu_int *" a ", int " radix ", int " uf ", int " nb " );
+.fi
+.SH DESCRIPTION
+The functions \fBiitoa()\fP, \fBiuitoa()\fP convert an integer variable located at \fBa\fP into
+a string constant. The base of the numerical system is selected according to the value of the
+parameter \fBradix\fP. Valid bases are presented in the header file \fBlibmpu.h\fP:
+.nf
+.sp
+#define RADIX_BIN 2
+#define RADIX_OCT 8
+#define RADIX_DEC 10
+#define RADIX_HEX 16
+.fi
+.sp
+If you select the base \fBRADIX_BIN\fP or \fBRADIX_HEX\fP, you can additionally select the prefix
+representation register with the parameter \fBuf\fP, the allowed values of which are:
+.nf
+.sp
+#define LOWERCASE 0
+#define UPPERCASE 1
+.fi
+.sp
+are also represented in the header file \fBlibmpu.h\fP.
+.PP
+The \fBnb\fP parameter specifies the size of the \fBa\fP variable in bytes.
+.PP
+The \fBiitoa()\fP, \fBiuitoa()\fP functions do not affect flags.
+.PP
+The size of memory allocated under the \fBstr\fP pointer must be sufficient to accommodate the resultant
+string constant.
+.PP
+The \fBiitoa()\fP function assumes that the \fBa\fP variable is a signed variable, and the \fBiuitoa()\fP
+function treats the argument as an unsigned integer. For example, an 8-bit binary integer \fB0b10000000\fP
+will be converted to the string "\-128" by the function \fBiitoa()\fP, while the function \fBiuitoa()\fP
+will output the positive number "128".
+.sp
+.SH EXAMPLES
+.nf
+.sp
+#include <libmpu.h>
+#include <stdio.h>
+
+int main( void )
+{
+ int rc = 0;
+
+ __mpu_init();
+ __mpu_extra_warnings = 1;
+
+ {
+ mpu_int8_t a;
+ int nb = NB_I8;
+ __mpu_char8_t s[32];
+
+ iatoui( a, "0b10000000", nb ); /* evaluate the A variable */
+
+ iitoa( s, a, RADIX_DEC, LOWERCASE, nb ); /* convert A value to ASCII string S */
+ printf( "a = %s;\\n", s ); /* a = -128; */
+
+ iuitoa( s, a, RADIX_DEC, LOWERCASE, nb ); /* convert A value to ASCII string S */
+ printf( "a = %s;\\n", s ); /* a = 128; */
+ }
+
+ __mpu_free_context();
+
+ return( rc );
+}
+.fi
+.SH SEE ALSO
+.BR iadd(3),
+.BR isub(3),
+.BR iadc(3),
+.BR isbb(3),
+.BR ishl(3),
+.BR ishr(3),
+.BR isal(3),
+.BR isar(3),
+.BR irol(3),
+.BR iror(3),
+.BR ircl(3),
+.BR ircr(3),
+.BR ishln(3),
+.BR ishrn(3),
+.BR isaln(3),
+.BR isarn(3),
+.BR iroln(3),
+.BR irorn(3),
+.BR ircln(3),
+.BR ircrn(3),
+.BR ineg(3),
+.BR inot(3),
+.BR iand(3),
+.BR itest(3),
+.BR icmp(3),
+.BR ior(3),
+.BR ixor(3),
+.BR iinc(3),
+.BR idec(3),
+.BR ixchg(3),
+.BR icpy(3),
+.BR icvt(3),
+.BR imul(3),
+.BR ismul(3),
+.BR idiv(3),
+.BR isdiv(3),
+.BR iatoi(3),
+.BR iatoui(3).