From 10d6876de4f996269e73c0d2c85874c0e16f87aa Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 5 Feb 2026 04:07:59 +0000 Subject: [PATCH] reader: implement read_err_to_cstr --- src/reader.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/reader.c diff --git a/src/reader.c b/src/reader.c new file mode 100644 index 0000000..eb756cc --- /dev/null +++ b/src/reader.c @@ -0,0 +1,43 @@ +/* reader.c: Stream reader implementation + * Created: 2026-02-04 + * Author: Aryadev Chavali + * License: See end of file + * Commentary: + */ + +#include +#include + +#include +#include + +const char *read_err_to_cstr(read_err_t err) +{ + switch (err) + { + case READ_ERR_OK: + return "OK"; + break; + case READ_ERR_EOF: + return "EOF"; + break; + case READ_ERR_UNKNOWN_CHAR: + return "UNKNOWN_CHAR"; + break; + default: + FAIL("Unreachable"); + } +} + +/* Copyright (C) 2026 Aryadev Chavali + + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for + * details. + + * You may distribute and modify this code under the terms of the GNU General + * Public License Version 2, which you should have received a copy of along with + * this program. If not, please go to . + + */