From 4e65a7f1c0c9828be8d9995e95053f0a0c35ba32 Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Mon, 12 Jun 2023 17:29:54 +0000 Subject: [PATCH] add: strlen, putchar, putstr --- src/putchar.🗿 | 3 +++ src/putstr.🗿 | 11 +++++++++++ src/strlen.🗿 | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100644 src/putchar.🗿 create mode 100644 src/putstr.🗿 create mode 100644 src/strlen.🗿 diff --git a/src/putchar.🗿 b/src/putchar.🗿 new file mode 100644 index 0000000..7514988 --- /dev/null +++ b/src/putchar.🗿 @@ -0,0 +1,3 @@ +putchar(c){ + wrt c; +} diff --git a/src/putstr.🗿 b/src/putstr.🗿 new file mode 100644 index 0000000..b0d64ae --- /dev/null +++ b/src/putstr.🗿 @@ -0,0 +1,11 @@ +putstr(str) +{ + local i; + i = 0; + loop { + if ([str + i] == 0) + return; + putchar([str + i]); + i = i + 1; + } +} diff --git a/src/strlen.🗿 b/src/strlen.🗿 new file mode 100644 index 0000000..f7d9911 --- /dev/null +++ b/src/strlen.🗿 @@ -0,0 +1,9 @@ +strlen(str) { + local i; + i = 0; + loop { + if ([str + i] == 0) + return (i); + i = i + 1; + } +}