libk  explain.fn.c at tip

File mod/kcore/explain.fn.c from the latest check-in


#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;
}