#include <string.h>
#include <libld.h>
#include "_conv.h"
#include "entry_msg.h"
#define ENTSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
MSG_FLG_EC_BUILTIN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
MSG_FLG_EC_USED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
MSG_FLG_EC_CATCHALL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
#if (CONV_ENT_FLAGS_BUFSIZE != ENTSZ) && !defined(__lint)
#define REPORT_BUFSIZE ENTSZ
#include "report_bufsize.h"
#error "CONV_ENT_FLAGS_BUFSIZE does not match ENTSZ"
#endif
const char *
conv_ent_flags(ec_flags_t flags, Conv_ent_flags_buf_t *ent_flags_buf)
{
static Val_desc vda[] = {
{ FLG_EC_BUILTIN, MSG_FLG_EC_BUILTIN },
{ FLG_EC_USED, MSG_FLG_EC_USED },
{ FLG_EC_CATCHALL, MSG_FLG_EC_CATCHALL },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
NULL, sizeof (ent_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = ent_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
(void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)ent_flags_buf->buf);
}
#define ECFSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
MSG_TYP_ECF_PATH_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
MSG_TYP_ECF_BASENAME_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
MSG_TYP_ECF_OBJNAME_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
MSG_FLG_ECF_ARMEMBER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
#if (CONV_ENT_FILES_FLAGS_BUFSIZE != ECFSZ) && !defined(__lint)
#define REPORT_BUFSIZE ECFSZ
#include "report_bufsize.h"
#error "CONV_ENT_FILES_FLAGS_BUFSIZE does not match ECFSZ"
#endif
const char *
conv_ent_files_flags(Word flags, Conv_fmt_flags_t fmt_flags,
Conv_ent_files_flags_buf_t *flags_buf)
{
static const Msg types[] = {
MSG_TYP_ECF_PATH, MSG_TYP_ECF_BASENAME, MSG_TYP_ECF_OBJNAME
};
#if TYP_ECF_NUM != (TYP_ECF_OBJNAME + 1)
#error "types has grown"
#endif
static Val_desc vda[] = {
{ FLG_ECF_ARMEMBER, MSG_FLG_ECF_ARMEMBER },
{ 0, 0 }
};
static const char *leading_str_arr[2];
static CONV_EXPN_FIELD_ARG conv_arg = {
NULL, sizeof (flags_buf->buf), leading_str_arr };
Word type_idx;
type_idx = flags & TYP_ECF_MASK;
if (type_idx < TYP_ECF_NUM) {
leading_str_arr[0] = MSG_ORIG(types[type_idx]);
flags &= ~TYP_ECF_MASK;
} else {
leading_str_arr[0] = NULL;
}
conv_arg.buf = flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
(void) conv_expn_field(&conv_arg, vda, fmt_flags);
return (conv_arg.buf);
}