libk  explain.fn.c at [8d478e0b3c]

File mod/kcore/explain.fn.c artifact 97dcae5195 part of check-in 8d478e0b3c


#include <k/core.h>
#include <k/type.h>
#include <k/internal.egroup.h>

kerror kexplain(kcond val) {
	kcond idx = val / kglobal_module_offset;
	/* module index in table */
	kcond offset = val % kglobal_module_offset;
	/* error index in module error table */

	struct kglobal_module_record* rec = kglobal_module_ident + idx;
	/* retrieve module identity from global table */

	kerror k = {
		.module_name = rec -> name,
		.module_desc = rec -> desc,
		.error_string = rec -> error_list[offset],
		.cond = val,
	};

	return k;
}