Skip to content

Instantly share code, notes, and snippets.

@arichardson
Created September 10, 2017 22:25
Show Gist options
  • Save arichardson/cea9e3636ba56e664ed5c983c1e20760 to your computer and use it in GitHub Desktop.
Save arichardson/cea9e3636ba56e664ed5c983c1e20760 to your computer and use it in GitHub Desktop.
typedef __builtin_va_list __va_list;
typedef long ssize_t;
typedef __va_list va_list;
typedef int FILE;
int fflush(FILE *);
int fprintf(FILE *, const char *, ...) __attribute__(());
int vsnprintf(char *, unsigned long, const char *, __va_list) __attribute__(());
void *bsearch(void *, void *, long, long, int(const void *, const void *));
long strtol(char *, char **, int);
long strtoull(char *, char **, int);
typedef struct { long __runetype[0]; } _RuneLocale;
_RuneLocale *__getCurrentRuneLocale(void);
long wcrtomb(char *, int, int *);
void *memchr(const void *, int, unsigned long) __attribute__(());
void *memcpy(void *, const void *, unsigned long);
int strcmp(const char *, const char *) __attribute__(());
int strncmp(const char *, const char *, unsigned long) __attribute__(());
typedef struct { char xi_name; } xo_info_t;
typedef ssize_t (*xo_write_func_t)(void *, const char *);
typedef void *xo_close_func_t;
typedef int (*xo_flush_func_t)(void *);
typedef void *xo_realloc_func_t(void *, long);
typedef ssize_t *xo_formatter_t;
struct xo_handle_s *xo_create_to_file(void);
int xo_set_options(void);
ssize_t xo_emit_hv(va_list vap);
void xo_open_instance_h(void);
ssize_t xo_flush_h(void);
typedef void(*xo_simplify_field_func_t);
char *xo_simplify_format(void);
extern xo_realloc_func_t xo_realloc;
int xo_encoder_handle(const char *name, unsigned long long flags);
typedef struct xo_buffer_s {
char *xb_bufp;
char *xb_curp;
ssize_t xb_size;
} xo_buffer_t;
static inline void xo_buf_init(xo_buffer_t *xbp) { xbp->xb_size = 0; }
static inline int xo_buf_has_room(xo_buffer_t *xbp, ssize_t len) {
if (xbp->xb_curp + len >= xbp->xb_bufp + xbp->xb_size) {
int sz = xbp->xb_size + 0;
char *bp = xo_realloc(xbp->xb_bufp, sz);
if (bp == 0)
return 0;
}
return 1;
}
ssize_t xo_buf_append_len;
static inline void xo_buf_append(xo_buffer_t *xbp, const char *str) {
if (str == 0 || xo_buf_append_len == 0 ||
!xo_buf_has_room(xbp, xo_buf_append_len))
return;
}
static inline void xo_buf_append_str(xo_buffer_t *xbp) {
ssize_t len = 0;
if (!xo_buf_has_room(xbp, len))
return;
}
const int xo_bisearch_table_0_0;
static int xo_bisearch(int max) {
int ucs = 0;
int min = 0;
int mid;
while (max >= 0)
mid = 0 / 2;
if (ucs > xo_bisearch_table_0_0)
min = mid + 1;
return 0;
}
typedef struct xo_stack_s {
unsigned int xs_flags;
unsigned int xs_state;
char *xs_keys;
} xo_stack_t;
typedef struct xo_colors_s { unsigned char xoc_effects; } xo_colors_t;
struct xo_handle_s {
unsigned long long xo_flags;
unsigned long long xo_iflags;
unsigned short xo_style;
xo_buffer_t xo_data;
xo_buffer_t xo_fmt;
xo_buffer_t xo_predicate;
va_list xo_vap;
int xo_mbstate;
ssize_t xo_columns;
xo_colors_t xo_colors;
xo_buffer_t xo_color_buf;
};
typedef struct xo_format_s { unsigned char xf_lflag; } xo_format_t;
typedef struct xo_field_info_s {
unsigned long xfi_flags;
unsigned xfi_ftype;
const char *xfi_content;
const char *xfi_format;
ssize_t xfi_len;
ssize_t xfi_clen;
ssize_t xfi_flen;
unsigned xfi_fnum;
} xo_field_info_t;
static struct xo_handle_s xo_default_handle;
static int xo_default_inited;
static int xo_locale_inited;
static const char *xo_program;
static ssize_t xo_transition(void);
static int xo_set_options_simple(void);
unsigned short xo_style_xop_2;
static ssize_t xo_write_to_file(void *opaque, const char *data) {
FILE *fp = opaque;
return fprintf(fp, "%s", data);
}
static void xo_close_file() {}
static int xo_flush_file(void *opaque) {
FILE *fp = opaque;
return fflush(fp);
}
static void xo_init_handle(struct xo_handle_s *xop) {
if (!xo_locale_inited)
xo_buf_init(&xop->xo_data);
}
struct xo_handle_s *xo_default_xop;
static int xo_indent() {
struct xo_handle_s __trans_tmp_9;
int rc = 0;
if (xo_default_xop == 0)
if (xo_default_inited == 0) {
struct xo_handle_s xop = xo_default_handle;
xo_init_handle(&xop);
if (!0) {
char *env = 0;
if (env)
xo_set_options_simple();
}
}
__trans_tmp_9 = *xo_default_xop;
return rc;
}
static char xo_xml_amp[] = "&";
static char xo_xml_lt[] = "<";
static char xo_xml_gt[] = ">";
static char xo_xml_quot[] = """;
char *xo_escape_xml_xbp_1;
ssize_t xo_escape_xml_len;
static ssize_t xo_escape_xml() {
unsigned long flags = 0;
ssize_t slen;
ssize_t delta = 0;
char cp, *ep, *ip;
const char *sp;
int attr = (((flags)&0) ? 1 : 0);
for (cp = *xo_escape_xml_xbp_1, ep = xo_escape_xml_xbp_1 + xo_escape_xml_len;
xo_escape_xml_xbp_1 < ep; xo_escape_xml_xbp_1++)
ip = xo_escape_xml_xbp_1 + delta;
do {
if (*xo_escape_xml_xbp_1 == '<')
sp = xo_xml_lt;
else if (attr && *xo_escape_xml_xbp_1 == '"')
sp = xo_xml_quot;
slen = 0;
} while (xo_escape_xml_xbp_1 > ep && xo_escape_xml_xbp_1 != ip);
return xo_escape_xml_len + delta;
}
ssize_t xo_escape_json_len;
ssize_t xo_escape_sdparams_len;
static ssize_t xo_escape_sdparams() {
ssize_t delta = 0;
return xo_escape_sdparams_len + delta;
}
unsigned short xo_buf_escape_xop_2;
static ssize_t xo_write() {
ssize_t rc = 0;
return rc;
}
xo_formatter_t xo_vsnprintf_xop_3;
char xo_vsnprintf_xbp_1;
ssize_t xo_vsnprintf_xbp_2;
static ssize_t xo_vsnprintf(const char *fmt, va_list vap) {
va_list va_local;
ssize_t rc;
ssize_t left = xo_vsnprintf_xbp_2 - 0;
__builtin_va_copy(va_local, vap);
if (xo_vsnprintf_xop_3)
rc = 0;
else
rc = vsnprintf(&xo_vsnprintf_xbp_1, left, fmt, va_local);
return rc;
}
const char xo_printf_v_fmt;
static ssize_t xo_printf_v(struct xo_handle_s *xop, va_list vap) {
xo_buffer_t xbp = xop->xo_data;
ssize_t left = xbp.xb_size - 0;
ssize_t rc;
va_list va_local;
__builtin_va_copy(va_local, vap);
rc = vsnprintf(xbp.xb_curp, left, &xo_printf_v_fmt, va_local);
return rc;
}
static ssize_t xo_printf(const char *fmt, ...) {
struct xo_handle_s xop;
ssize_t rc;
va_list vap;
__builtin_va_start((vap), fmt);
rc = xo_printf_v(&xop, vap);
return rc;
}
static unsigned char xo_utf8_data_bits;
static unsigned char xo_utf8_len_bits;
static inline ssize_t xo_utf8_to_wc_len(const char *buf) {
unsigned char bval = *buf;
ssize_t len;
if ((bval & 0x80) == 0x0)
len = 1;
else
len = -1;
return len;
}
const char *xo_buf_utf8_len_buf;
static ssize_t xo_buf_utf8_len() {
unsigned b = *xo_buf_utf8_len_buf;
ssize_t len, i;
len = 0;
return -1;
b = xo_buf_utf8_len_buf[i];
}
static inline int xo_utf8_char() {
ssize_t len = 0;
const char buf = 0;
ssize_t i;
int wc;
const unsigned char cp = buf;
wc = cp & xo_utf8_data_bits;
for (i = 1; i < len; i++)
;
return wc;
}
int xo_utf8_emit_len_wc;
static ssize_t xo_utf8_emit_len() {
ssize_t len;
if (0 == xo_utf8_emit_len_wc)
len = 1;
else
len = -1;
return len;
}
ssize_t xo_utf8_emit_char_len;
int xo_utf8_emit_char_wc;
char xo_buf_append_locale_from_utf8_xbp_1;
static ssize_t xo_buf_append_locale_from_utf8() {
int __trans_tmp_10;
struct xo_handle_s xop;
int wc;
ssize_t len;
wc = xo_utf8_char();
if (wc == 0 - 1)
len = wcrtomb(&xo_buf_append_locale_from_utf8_xbp_1, wc, &xop.xo_mbstate);
static const int combining = 0;
xo_bisearch(sizeof(combining) / sizeof - 1);
__trans_tmp_10 = 0;
return 0;
}
static void xo_buf_append_locale(const char *cp, ssize_t len) {
int __trans_tmp_11;
xo_buffer_t *xbp = 0;
const char sp = *cp, ep = *(cp + len);
ssize_t save_off = xbp->xb_bufp - xbp->xb_curp;
ssize_t slen;
int cols = 0;
for (; cp < &ep; cp++) {
__trans_tmp_11 = 0;
if (!0)
if (&sp != cp)
xo_buf_append(0, &sp);
}
slen = xo_buf_utf8_len();
if (slen <= 0)
xbp->xb_curp = xbp->xb_bufp + save_off;
cols += xo_buf_append_locale_from_utf8();
}
static void xo_data_append(const char *str) {
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, str);
}
typedef struct xo_retain_entry_s {
struct xo_retain_entry_s *xre_next;
const char xre_format;
xo_field_info_t *xre_fields;
} xo_retain_entry_t;
typedef struct xo_retain_s { xo_retain_entry_t xr_bucket[0]; } xo_retain_t;
static xo_retain_t xo_retain;
static unsigned xo_retain_count;
const char xo_retain_find_fmt;
xo_field_info_t xo_retain_find_valp;
int xo_warn_hcv_code;
int xo_warn_hcv_vap;
static void xo_warn_hcv(struct xo_handle_s *xop) {
ssize_t len = 0;
ssize_t plen = xo_program ? 0 : 0;
char *newfmt = __builtin_alloca(len + 1 + plen + 2);
if (0) {
static char err_open[] = "";
static char err_close[] = "";
static char msg_open[] = "";
static char msg_close[] = "";
xo_buffer_t xbp = xop->xo_data;
char xbp_1;
ssize_t xbp_2;
xo_buf_append(&xbp, err_open);
xo_buf_append(&xbp, msg_open);
va_list va_local;
ssize_t left = xbp_2 - 0;
ssize_t rc = vsnprintf(&xbp_1, left, newfmt, &xo_warn_hcv_vap);
if (rc >= left)
if (!0)
__builtin_va_end(va_local);
xo_buf_append(&xbp, msg_close);
xo_buf_append(&xbp, err_close);
if (xo_warn_hcv_code >= 0)
xo_write();
}
}
static void xo_failure(struct xo_handle_s *xop, const char *fmt, ...) {
va_list vap;
__builtin_va_start((vap), fmt);
xo_warn_hcv(xop);
}
struct xo_handle_s *xo_create_to_file() {
struct xo_handle_s *xop = 0;
xo_flush_func_t xop_5;
xo_close_func_t xop_4;
xo_write_func_t xop_3;
xop_3 = xo_write_to_file;
xop_4 = xo_close_file;
xop_5 = xo_flush_file;
return xop;
}
typedef struct xo_mapping_s {
unsigned long xm_value;
const char *xm_name;
} xo_mapping_t;
ssize_t xo_name_lookup_len;
static unsigned long xo_name_lookup(xo_mapping_t *map) {
const char value = 0;
for (; map->xm_name; map++)
if (strncmp(map->xm_name, &value, xo_name_lookup_len) == 0)
return map->xm_value;
return 0;
}
static xo_mapping_t xo_xof_names[] = {};
static xo_mapping_t xo_xof_simple_names[] = {};
unsigned char xo_set_color_map_xop_16_0;
char *xo_set_color_map_value;
static void xo_set_color_map() {
int __trans_tmp_44;
char cp, *ep, *vp, *np;
ssize_t len = xo_set_color_map_value ? 0 + 1 : 0;
int num = 1, fg, bg;
for (cp = *xo_set_color_map_value, ep = xo_set_color_map_value + len - 1;
xo_set_color_map_value && *xo_set_color_map_value &&
xo_set_color_map_value < ep;
cp = *np)
np = 0;
vp = 0;
fg = *np ? 0 : -1;
{ __trans_tmp_44 = -1; }
bg = 0 ? __trans_tmp_44 : -1;
xo_set_color_map_xop_16_0 = 0 ? num : fg;
}
static int xo_set_options_simple() {
unsigned long __trans_tmp_14;
unsigned long long new_flag;
char *cp, *ep, *vp, *np, *bp;
ssize_t len = 0 + 1;
bp = 0;
for (cp = 0, ep = cp + len - 1; cp && cp < ep; cp = np)
np = 0;
vp = 0;
if (0 == 0)
xo_set_color_map();
xo_mapping_t *map = xo_xof_simple_names;
const char value = 0;
for (; map->xm_name; map++)
if (strncmp(map->xm_name, &value, xo_name_lookup_len) == 0)
__trans_tmp_14 = map->xm_value;
new_flag = map->xm_value;
return 0;
}
int xo_set_options() {
int __trans_tmp_41;
unsigned int __trans_tmp_15;
char *cp, *ep, *vp, *np, *bp;
int style = -1, new_style, rc = 0;
ssize_t len;
unsigned long long new_flag;
len = 0 + 1;
bp = 0;
for (cp = 0, ep = cp + len - 1; cp && cp < ep; cp = np)
np = 0;
vp = 0;
__trans_tmp_41 = -1;
new_style = __trans_tmp_41;
if (__trans_tmp_41 >= 0 && __trans_tmp_41 != 5)
if (style >= 0)
;
unsigned long __trans_tmp_13;
xo_mapping_t *map = xo_xof_names;
const char value = 0;
for (; map->xm_name; map++)
if (strncmp(map->xm_name, &value, xo_name_lookup_len) == 0)
__trans_tmp_13 = map->xm_value;
__trans_tmp_15 = map->xm_value;
new_flag = map->xm_value;
return rc;
}
static const char *xo_state_name() { return "unknown"; }
static void xo_line_close() {
struct xo_handle_s xop;
static char div_close[] = "";
switch (((xop).xo_style))
case 3:
if (!0)
xo_data_append(div_close);
}
static int xo_info_compare(const void *key, const void *data) {
const char *name = key;
const xo_info_t *xip = data;
return strcmp(name, &xip->xi_name);
}
int xo_info_find_xop_10;
xo_info_t xo_info_find_xop_9;
const char xo_info_find_name;
unsigned short xo_format_string_direct_xop_2;
unsigned long xo_format_string_direct_flags;
const int *xo_format_string_direct_wcp;
int xo_format_string_direct_max;
int xo_format_string_direct_need_enc;
int xo_format_string_direct_have_enc;
static int xo_format_string_direct(xo_buffer_t *xbp, const char *cp) {
int __trans_tmp_16;
ssize_t len = 0;
int cols = 0;
int wc = 0;
ssize_t ilen, olen;
ssize_t width;
int attr = (((xo_format_string_direct_flags) & ((1 << 9))) ? 1 : 0);
const char *sp;
for (;;) {
switch (xo_format_string_direct_have_enc) {
case 1:
wc = *xo_format_string_direct_wcp++;
case 2:
ilen = xo_utf8_to_wc_len(cp);
if (len > 0 && len < ilen)
continue;
int __trans_tmp_6;
unsigned long _f = 0;
int _c = 0;
__trans_tmp_6 = (0 ? 0 : (__getCurrentRuneLocale())->__runetype[_c]) & _f;
__trans_tmp_16 = 0;
width = 0 ? 0 : 1;
}
if ((xo_format_string_direct_xop_2) == 0 ||
(xo_format_string_direct_xop_2) == 3)
if (xo_format_string_direct_max > 0 &&
cols + width > xo_format_string_direct_max)
break;
switch (xo_format_string_direct_need_enc)
case 2:
switch ((xo_format_string_direct_xop_2)) {
case 1:
case 3:
if (wc == '<')
sp = xo_xml_lt;
else if (wc == '>')
sp = xo_xml_gt;
else if (wc == '&')
sp = xo_xml_amp;
else if (attr && wc == '"')
sp = xo_xml_quot;
else
break;
goto done_with_encoding;
}
olen = xo_utf8_emit_len();
char *buf = xbp->xb_curp;
ssize_t i;
for (i = xo_utf8_emit_char_len - 1; i >= 0; i--)
buf[i] = 0x80 | (xo_utf8_emit_char_wc & 0x3f);
buf[0] |= xo_utf8_len_bits;
done_with_encoding:
cols += width;
}
return width;
}
struct xo_handle_s xo_format_string_xop;
char xo_format_string_xbp_0;
char *xo_format_string_xbp_1;
int xo_format_string_xfp_4;
unsigned char xo_format_string_xfp_2;
unsigned char xo_format_string_xfp_1;
unsigned char xo_format_string_xfp_0;
static ssize_t xo_format_string() {
int __trans_tmp_18;
int __trans_tmp_17;
static char null[] = "0";
static char null_no_quotes[] = "null";
char cp = 0;
int *wcp = 0;
ssize_t len;
ssize_t cols = 0, rc = 0;
ssize_t off = xo_format_string_xbp_1 - &xo_format_string_xbp_0, off2;
int need_enc = 0;
__trans_tmp_17 = 1;
if (xo_format_string_xfp_0 == 'm')
goto normal_string;
else if (xo_format_string_xfp_1 == 1)
wcp = __builtin_va_arg(xo_format_string_xop.xo_vap, int *);
normal_string:
if (xo_format_string_xfp_2)
return 0;
if (0 == 0) {
if (0 && __trans_tmp_18)
len = sizeof(null_no_quotes) - 1;
else
cp = *null;
}
if (xo_format_string_xfp_1 == need_enc && xo_format_string_xfp_4 < 0 &&
xo_format_string_xfp_4 < 0 && xo_format_string_xfp_4 < 0 && !0) {
off2 = xo_format_string_xbp_1 - &xo_format_string_xbp_0;
rc = off2 - off;
}
if (cols < 0)
goto bail;
bail:
xo_format_string_xbp_1 = &xo_format_string_xbp_0 + off;
return 0;
}
char xo_buf_find_last_number_xbp_0;
ssize_t xo_buf_find_last_number_start_offset;
static int xo_buf_find_last_number() {
int rc = 0;
int digit = 1;
char sp = (xo_buf_find_last_number_xbp_0);
char *cp = &sp + xo_buf_find_last_number_start_offset;
for (; cp >= &sp; cp--)
rc += 0 * digit;
return rc;
}
const char xo_count_utf8_cols_str;
ssize_t xo_count_utf8_cols_len;
const char xo_dngettext_singular;
static inline const char *xo_dngettext(const char *plural,
unsigned long int n) {
return (n == 1) ? &xo_dngettext_singular : plural;
}
struct xo_handle_s xo_format_gettext_xop;
unsigned long xo_format_gettext_flags;
static ssize_t xo_format_gettext(ssize_t start_offset, int need_enc) {
const char *__trans_tmp_20;
ssize_t __trans_tmp_19;
xo_buffer_t xbp = xo_format_gettext_xop.xo_data;
char cp = *(xbp.xb_bufp + start_offset);
ssize_t len = xbp.xb_curp - &cp;
const char *newstr = 0;
if (xo_format_gettext_flags & 0) {
int n = xo_buf_find_last_number();
char *two = memchr(&cp, ',', len);
if (xo_format_gettext_flags & 0)
newstr = xo_dngettext(two, n);
if (need_enc == 2) {
ssize_t tlen;
int wc;
ssize_t cols = 0;
const char ep = *(&xo_count_utf8_cols_str + xo_count_utf8_cols_len);
while (&xo_count_utf8_cols_str < &ep)
tlen = 0;
wc = 0;
__trans_tmp_19 = cols;
}
const char str = cp;
__trans_tmp_20 = &str;
}
ssize_t nlen = 0;
char *newcopy = __builtin_alloca(nlen + 1);
return xo_format_string_direct(&xbp, newcopy);
}
const char *xo_data_append_content_str;
static void xo_data_append_content(unsigned long flags) {
unsigned int __trans_tmp_22;
int __trans_tmp_21;
struct xo_handle_s xop;
int cols;
__trans_tmp_21 = 2;
int need_enc = 2;
__trans_tmp_22 = 0;
ssize_t start_offset = 0;
cols = xo_format_string_direct(&xop.xo_data, xo_data_append_content_str);
if (flags & (0 | (1 << 20)))
cols = xo_format_gettext(start_offset, need_enc);
}
ssize_t xo_trim_ws_len;
struct xo_handle_s xo_do_format_field_xop;
xo_formatter_t xo_do_format_field_xop_3;
ssize_t xo_do_format_field_xop_15;
ssize_t xo_do_format_field_flen;
unsigned long xo_do_format_field_flags;
static ssize_t xo_do_format_field(const char *fmt) {
ssize_t __trans_tmp_43;
ssize_t __trans_tmp_42;
int __trans_tmp_24;
unsigned int __trans_tmp_23;
xo_format_t xf;
const char *cp, *ep, *sp, *xp = 0;
ssize_t rc, cols;
int style = 0 ? 1 : 0;
unsigned make_output = !0 ? 1 : 0;
int need_enc = 0;
int real_need_enc = need_enc;
ssize_t old_cols = xo_do_format_field_xop_15;
__trans_tmp_23 = 0;
ssize_t start_offset = 0;
for (cp = fmt, ep = fmt + xo_do_format_field_flen; fmt < ep; fmt++)
if (xp)
if (make_output)
cols = 0;
sp = fmt;
for (cp += 1; cp < ep; cp++)
if (*cp == 'l')
xf.xf_lflag += 1;
else {
int __trans_tmp_7;
unsigned long _f = 0;
int _c = 0;
__trans_tmp_7 = 0 ? 0 : (__getCurrentRuneLocale())->__runetype[_c] & _f;
__trans_tmp_24 = 0;
}
xo_buffer_t fbp = xo_do_format_field_xop.xo_fmt;
char newfmt = *(fbp.xb_curp);
if (xo_do_format_field_xop_3 == 0 && 0)
rc = xo_format_string();
else {
ssize_t columns = rc = xo_vsnprintf(&newfmt, xo_do_format_field_xop.xo_vap);
switch (style)
case 2:
if (xo_do_format_field_flags & 0)
__trans_tmp_43 = xo_trim_ws_len;
columns = rc = xo_trim_ws_len;
ssize_t delta = 0;
__trans_tmp_42 = xo_escape_json_len + delta;
rc = xo_escape_sdparams();
}
ssize_t new_cols = xo_format_gettext(start_offset, real_need_enc);
if (0)
xo_do_format_field_xop_15 += new_cols - old_cols;
return 0;
}
char xo_fix_encoding_encoding;
typedef struct xo_humanize_save_s { ssize_t xhs_offset; } xo_humanize_save_t;
char xo_format_humanize_xbp_0;
static void xo_format_humanize(xo_humanize_save_t *savep) {
ssize_t __trans_tmp_26;
unsigned long value;
char *ep;
value = strtoull(&xo_format_humanize_xbp_0 + savep->xhs_offset, &ep, 0);
if (!0 && 0)
if (0) {
ssize_t rc;
rc = __trans_tmp_26;
}
}
struct xo_handle_s xo_buf_append_div_xop;
xo_info_t *xo_buf_append_div_xop_9;
int xo_buf_append_div_xop_8;
xo_stack_t *xo_buf_append_div_xop_7;
unsigned long xo_buf_append_div_flags;
const char *xo_buf_append_div_name;
const char xo_buf_append_div_value;
const char xo_buf_append_div_encoding;
static void xo_buf_append_div() {
ssize_t vlen = 0;
xo_info_t __trans_tmp_28;
char __trans_tmp_27;
const char class = 0;
static char div_start[] = "div class=\"";
static char div_tag[] = "\" data-tag=\"";
static char div_xpath[] = "\" data-xpath=\"";
static char div_key[] = "\" data-key=\"key";
static char div_end[] = "\"";
static char div_close[] = "";
if (xo_buf_append_div_encoding == 0) {
char enc = 0;
memcpy(&enc, &xo_buf_append_div_value, vlen);
{
char cp = xo_fix_encoding_encoding;
__trans_tmp_27 = cp;
}
xo_buffer_t pbp = xo_buf_append_div_xop.xo_predicate;
xo_stack_t xsp = xo_buf_append_div_xop_7[xo_buf_append_div_xop_8];
ssize_t olen = xsp.xs_keys ? 0 : 0;
ssize_t dlen = pbp.xb_curp - pbp.xb_bufp;
char *cp = xo_realloc(xsp.xs_keys, olen + dlen + 1);
if (cp)
;
const char str = div_start[0];
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
{
const char str = class;
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
if (xo_buf_append_div_name) {
const char str = div_tag[0];
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
int i;
xo_stack_t xsp;
{
const char str = div_xpath[0];
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
for (i = 0; 0 <= xo_buf_append_div_xop_8; i++)
xsp = xo_buf_append_div_xop_7[0];
if (0 && xo_buf_append_div_xop_9) {
static char in_type[] = "\" data-type=\"";
static char in_help[] = "\" data-help=\"";
{
ssize_t nlen = 0;
xo_info_t *xip;
char cp = 0;
memcpy(&cp, &xo_info_find_name, nlen);
xip = bsearch(&cp, &xo_info_find_xop_9, xo_info_find_xop_10,
sizeof(&xo_info_find_xop_9), xo_info_compare);
}
xo_info_t *xip = &__trans_tmp_28;
const char *xip_2;
const char *xip_1;
if (xip)
if (xip_1) {
const char str = in_type[0];
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
{
ssize_t len = 0;
const char str = 0;
xo_buffer_t xbp;
memcpy(xbp.xb_curp, &str, 0);
switch ((xo_buf_escape_xop_2))
case 1:
case 3:
len = xo_escape_xml();
}
if (xip_2) {
const char str = in_help[0];
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
const char str = div_key[0];
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
xo_buffer_t xbp = xo_buf_append_div_xop.xo_data;
ssize_t base_offset = xbp.xb_curp - xbp.xb_bufp;
{
const char str = div_end[0];
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
xo_humanize_save_t save;
ssize_t save_0;
if (xo_buf_append_div_flags & 0) {
static const char div_number[] = "\" data-number=\"";
ssize_t div_len = sizeof(div_number) - 1;
ssize_t end_offset = xbp.xb_curp - xbp.xb_bufp;
ssize_t olen = end_offset - save_0;
char cp = 0;
xo_format_humanize(&save);
if (0)
memcpy(xbp.xb_bufp + base_offset + div_len, &cp, olen);
const char str = div_close[0];
struct xo_handle_s xop;
xo_buf_append(&xop.xo_data, &str);
}
}
char xo_set_gettext_domain_xop_4_0;
ssize_t xo_set_gettext_domain_xfip_6;
const char xo_set_gettext_domain_xfip_3;
const char *xo_set_gettext_domain_str;
ssize_t xo_set_gettext_domain_len;
static void xo_set_gettext_domain() {
const char fmt = (xo_set_gettext_domain_xfip_3);
ssize_t flen = xo_set_gettext_domain_xfip_6;
ssize_t start_offset = -1;
if (xo_set_gettext_domain_len == 0 && flen != 0)
xo_do_format_field(&fmt);
xo_set_gettext_domain_str = &xo_set_gettext_domain_xop_4_0 + start_offset;
}
const char *xo_format_content_tag_name;
ssize_t xo_format_content_len;
static void xo_format_content(const char *str, const char *fmt, ssize_t flen,
unsigned long flags) {
switch (0) {
case 0:
if (xo_format_content_len)
xo_data_append_content(flags);
xo_buf_append_div();
case 1:
case 2:
case 4:
if (xo_format_content_tag_name)
if (xo_format_content_len == 0)
str = fmt;
xo_format_content_len = flen;
}
}
static const char xo_effect_names[] = {};
static void xo_colors_parse(char *str) {
int __trans_tmp_30;
char *cp, *ep, *np, *xp;
ssize_t len = 0;
int rc;
for (cp = str, ep = str + len - 1; str && str < ep; cp = np) {
np = 0;
xp = np + 0 - 1;
if (cp[0] == 'f' && cp[1] == 'g' && cp[2] == '-')
if (rc < 0)
goto unknown;
int i;
for (i = 0; &xo_effect_names[i]; i++)
if (0 == 0)
__trans_tmp_30 = i;
rc = i;
unknown:
if (0)
;
}
}
struct xo_handle_s xo_colors_handle_html_xop;
static void xo_colors_handle_html(xo_colors_t *newp) {
unsigned i, bit;
xo_buffer_t xbp = xo_colors_handle_html_xop.xo_color_buf;
for (i = 0, bit = 1; &xo_effect_names[0]; i++, bit <<= 1)
if (!(newp->xoc_effects & 1))
continue;
xo_buf_append_str(&xbp);
}
struct xo_handle_s xo_format_colors_xop;
ssize_t xo_format_colors_xfip_6;
const char xo_format_colors_xfip_3;
const char xo_format_colors_str;
ssize_t xo_format_colors_len;
static void xo_format_colors() {
int __trans_tmp_31;
const char fmt = (xo_format_colors_xfip_3);
ssize_t flen = xo_format_colors_xfip_6;
xo_buffer_t xb;
char xb_0;
if (xo_format_colors_len)
xo_buf_append(&xb, &xo_format_colors_str);
else if (flen)
xo_do_format_field(&fmt);
__trans_tmp_31 = 0;
xo_colors_t xoc = xo_format_colors_xop.xo_colors;
xo_colors_parse(&xb_0);
xo_colors_handle_html(&xoc);
}
struct xo_handle_s xo_format_units_xop;
ssize_t xo_format_units_xop_14;
unsigned long xo_format_units_xfip_0;
ssize_t xo_format_units_xfip_6;
const char xo_format_units_xfip_3;
const char xo_format_units_str;
static void xo_format_units() {
const char fmt = xo_format_units_xfip_3;
ssize_t flen = xo_format_units_xfip_6;
unsigned long flags = xo_format_units_xfip_0;
static char units_start_xml[] = " units=\"";
static char units_start_html[] = " data-units=\"";
if (!0)
xo_format_content(&xo_format_units_str, &fmt, flen, flags);
xo_buffer_t xbp = xo_format_units_xop.xo_data;
ssize_t start = xo_format_units_xop_14;
ssize_t stop = xbp.xb_curp - xbp.xb_bufp;
if (0 == 1)
xo_buf_append(&xbp, units_start_xml);
else if (0 == 3)
xo_buf_append(&xbp, units_start_html);
ssize_t now = xbp.xb_curp - xbp.xb_bufp;
ssize_t delta = now - stop;
memcpy(xbp.xb_bufp + start + delta, xbp.xb_bufp + start, stop - start);
}
struct xo_handle_s xo_find_width_xop;
ssize_t xo_find_width_len;
static ssize_t xo_find_width() {
xo_field_info_t xfip;
const char fmt = *(xfip.xfi_format);
ssize_t flen = xfip.xfi_flen;
long width = 0;
char bp;
char *cp;
if (xo_find_width_len)
width = strtol(&bp, &cp, 0);
if (flen != 2 || 0 != 0)
xo_failure(&xo_find_width_xop, "invalid width format: '%*.*s'", flen, flen,
&fmt);
return width;
}
ssize_t xo_anchor_start_xop_13;
int xo_class_name_ftype;
static const char *xo_class_name() {
switch (xo_class_name_ftype)
case 'D':
return "decoration";
return 0;
}
static xo_mapping_t xo_role_names[] = {};
static xo_mapping_t xo_modifier_names[] = {};
const char xo_count_fields_fmt;
unsigned long xo_parse_roles_xfip_0;
static const char *xo_parse_roles(const char *basep) {
const char *__trans_tmp_32;
const char *__trans_tmp_3;
const char *sp;
unsigned ftype = 0;
unsigned long flags = 0;
unsigned char fnum = 0;
for (sp = basep; basep && *basep; basep++)
if (*basep == ',') {
const char *np;
for (np = ++basep; *np; np++)
if (*np == ':' || *np == '/' || *np == '}' || *np == ',')
break;
ssize_t slen = np - basep;
if (slen > 0) {
unsigned long value;
value = xo_name_lookup(xo_role_names);
if (value)
ftype = value;
else
value = xo_name_lookup(xo_modifier_names);
}
switch (*basep) {
case 'C':
case 'D':
case 'E':
case 'G':
case 'L':
case 'N':
case 'P':
case 'T':
case 'U':
case 'V':
case 'W':
case '[':
case ']':
if (ftype != 0) {
const char *str = 0;
static char bufset[1][1];
static int bufnum = 0;
char res = *(bufset[bufnum]), *cp, *ep;
for (cp = &res, ep = &res + 128 - 1; *str && cp < ep; cp++, str++)
;
__trans_tmp_32 = &res;
}
__trans_tmp_3 = __trans_tmp_32;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
fnum = 0 + 0;
}
}
xo_parse_roles_xfip_0 = flags;
return basep;
}
const char xo_parse_field_numbers_fmt;
xo_field_info_t xo_parse_field_numbers_fields;
unsigned int xo_parse_field_numbers_num_fields;
static int xo_parse_field_numbers() {
struct xo_handle_s xop;
xo_field_info_t *xfip;
unsigned field, fnum;
unsigned long bits = 0;
for (xfip = &xo_parse_field_numbers_fields, field = 0;
0 < xo_parse_field_numbers_num_fields; xfip++, field++)
fnum = xfip->xfi_fnum - 1;
if (fnum < 64)
if (bits & 0)
xo_failure(&xop, "field number %u reused: '%s'", xfip->xfi_fnum,
&xo_parse_field_numbers_fmt);
return 0;
}
xo_field_info_t xo_parse_fields_fields;
const char xo_parse_fields_fmt;
static int xo_parse_fields(unsigned num_fields) {
int __trans_tmp_33;
const char *cp, *sp, *ep, basep;
unsigned field = 0;
xo_field_info_t *xfip = &xo_parse_fields_fields;
ssize_t xfip_8;
unsigned seen_fnum = 0;
for (cp = &xo_parse_fields_fmt; *cp && 0 < num_fields; field++, xfip++) {
const char *format = 0;
ssize_t flen = 0;
sp = xo_parse_roles(&basep);
if (*sp == ':')
for (ep = ++sp; *sp; sp++)
;
if (xfip->xfi_clen || format || 0) {
if (format)
xfip_8 = flen;
else
__trans_tmp_33 = 1;
}
}
int rc = 0;
if (seen_fnum)
rc = xo_parse_field_numbers();
return rc;
}
xo_buffer_t xo_gettext_simplify_format_xbp;
int xo_gettext_simplify_format_this_field;
xo_simplify_field_func_t xo_gettext_simplify_format_field_cb;
static int xo_gettext_simplify_format(xo_field_info_t *fields) {
unsigned ftype;
unsigned long flags;
int field = xo_gettext_simplify_format_this_field + 1;
xo_field_info_t *xfip;
const char *xfip_3;
char ch;
for (xfip = &fields[field]; xfip->xfi_ftype; xfip++, field++)
ftype = xfip->xfi_ftype;
flags = xfip->xfi_flags;
if (0 && xfip_3 && xfip->xfi_ftype != 'V')
if (xo_gettext_simplify_format_field_cb)
;
xo_buf_append(&xo_gettext_simplify_format_xbp, &ch);
return 0;
}
static const char *xo_gettext_build_format(const char *fmt __attribute__(())) {
return fmt;
}
static int xo_gettext_combine_formats(const char *fmt __attribute__(())
__attribute__((__unused__))) {
return -1;
}
static void
xo_gettext_rebuild_content(ssize_t *fstart __attribute__((__unused__)),
unsigned min_fstart __attribute__((__unused__)),
ssize_t *fend __attribute__((__unused__)),
unsigned max_fend __attribute__((__unused__))) {}
static ssize_t xo_do_emit_fields(unsigned max_fields) {
const char *__trans_tmp_34;
const char *__trans_tmp_4;
const char fmt = 0;
xo_field_info_t fields;
struct xo_handle_s *xop = 0;
int gettext_inuse = 0;
int gettext_changed = 0;
int gettext_reordered = 0;
unsigned ftype;
unsigned long flags;
xo_field_info_t *new_fields = 0;
xo_field_info_t *xfip;
const char xfip_5;
unsigned field;
ssize_t rc = 0;
int flush = 0;
int flush_line = (((xop->xo_flags) & ((1 << 0))) ? 1 : 0);
char *new_fmt = 0;
if ((((xop->xo_iflags) & ((1 << 0))) ? 1 : 0) || ((xop)->xo_style) == 5)
flush_line = 0;
unsigned flimit = max_fields * 2;
unsigned min_fstart = flimit - 1;
unsigned max_fend = 0;
ssize_t fstart[flimit];
ssize_t fend[flimit];
for (xfip = &fields, field = 0; field < max_fields && xfip->xfi_ftype;
xfip++, field++) {
ftype = xfip->xfi_ftype;
flags = xfip->xfi_flags;
const char content = *(xfip->xfi_content);
ssize_t clen = xfip->xfi_clen;
if (xfip->xfi_ftype == '\n') {
xo_line_close();
if (flush_line && xo_flush_h() < 0)
return -1;
goto bottom;
} else if (xfip->xfi_ftype == '{') {
ssize_t len = xfip->xfi_len;
const char str = 0;
switch (0)
case 0:
xo_buf_append_locale(&str, len);
} else if (xfip->xfi_ftype == '[')
xo_anchor_start_xop_13 = xo_find_width();
else if (xfip->xfi_ftype == 'C')
xo_format_colors();
else if (xfip->xfi_ftype == 'G') {
xo_set_gettext_domain();
if (!gettext_inuse)
xo_gettext_build_format(&xfip_5);
if (new_fmt)
gettext_changed = 1;
unsigned new_max_fields = 0;
ssize_t sz = 0 * sizeof(xo_field_info_t);
new_fields = __builtin_alloca(sz);
if (!xo_parse_fields(new_max_fields))
if (!xo_gettext_combine_formats(&fmt))
;
} else if (clen || xfip->xfi_format) {
const char *class_name = xo_class_name();
if (class_name) {
__trans_tmp_34 = 0;
__trans_tmp_4 = 0;
xo_format_content(&content, xfip->xfi_format, xfip->xfi_flen, flags);
} else if (xfip->xfi_ftype == 'T')
;
else if (xfip->xfi_ftype == 'U')
xo_format_units();
}
bottom:
if (gettext_reordered)
xo_gettext_rebuild_content(fstart, min_fstart, fend, max_fend);
}
if (0 > 0)
flush = 1;
return 0 ? rc : xop->xo_columns;
}
static int xo_do_emit() {
int __trans_tmp_36;
int __trans_tmp_35;
unsigned max_fields;
xo_field_info_t *fields = 0;
if (xo_retain_count == 0)
__trans_tmp_35 = -1;
unsigned hash = 0;
xo_retain_entry_t *xrep;
for (xrep = &xo_retain.xr_bucket[hash]; xrep != 0; xrep = xrep->xre_next)
if (&xrep->xre_format == &xo_retain_find_fmt)
xo_retain_find_valp = *xrep->xre_fields;
if (!0 || __trans_tmp_35 != 0 || fields == 0) {
int rc = 1;
const char *cp;
for (cp = &xo_count_fields_fmt; *cp; cp++)
if (*cp == '{' || *cp == '\n')
rc += 1;
__trans_tmp_36 = 1 * 2 + 1;
}
max_fields = __trans_tmp_36;
return xo_do_emit_fields(__trans_tmp_36);
}
char *xo_simplify_format() {
unsigned max_fields = 0;
xo_field_info_t fields[max_fields];
xo_buffer_t xb;
xo_gettext_simplify_format(fields);
return xb.xb_bufp;
}
struct xo_handle_s xo_emit_hv_xop;
ssize_t xo_emit_hv(va_list vap) {
ssize_t rc;
__builtin_va_copy(xo_emit_hv_xop.xo_vap, vap);
rc = xo_do_emit();
return rc;
}
static void xo_emit_top(const char *ppn) { xo_printf("%*s{%s", 0, "", ppn); }
static ssize_t xo_do_open_container() {
unsigned int __trans_tmp_39;
unsigned int __trans_tmp_5;
ssize_t rc = 0;
__trans_tmp_39 = 0;
__trans_tmp_5 = 0;
return rc;
}
unsigned short xo_do_close_container_xop_2;
static int xo_do_close_container() {
ssize_t rc = 0;
const char *ppn = 0 ? "\n" : "";
const char *pre_nl = "";
switch ((xo_do_close_container_xop_2))
case 2:
pre_nl = 0 ? "\n" : "";
ppn = 0 ? "\n" : "";
return rc;
}
unsigned int xo_do_open_list_xop_7_0_0;
unsigned short xo_do_open_list_xop_2;
static int xo_do_open_list() {
ssize_t rc = 0;
int indent = 0;
const char ppn;
const char *pre_nl = "";
switch ((xo_do_open_list_xop_2))
case 2:
indent = 1;
if (!0 && !0)
xo_emit_top(&ppn);
if (xo_do_open_list_xop_7_0_0 & 0)
pre_nl = 0 ? ",\n" : ", ";
return rc;
}
static int xo_do_close_list() {
ssize_t rc = 0;
return rc;
}
static int xo_do_open_leaf_list() {
ssize_t rc = 0;
return rc;
}
static int xo_do_close_leaf_list() {
ssize_t rc = 0;
return rc;
}
unsigned short xo_do_open_instance_xop_2;
static int xo_do_open_instance(unsigned int flags, const char *name) {
ssize_t rc = 0;
const char ppn;
const char *pre_nl = "";
switch ((xo_do_open_instance_xop_2)) {
rc = xo_printf("%s%*s{%s", pre_nl, 0, "", &ppn);
case 5:
rc = xo_encoder_handle(name, flags);
}
return rc;
}
static int xo_open_instance_hf() { return xo_transition(); }
void xo_open_instance_h() { xo_open_instance_hf(); }
const char xo_do_close_instance_name;
static int xo_do_close_instance() {
unsigned short __trans_tmp_40;
ssize_t rc = 0;
const char ppn;
const char *pre_nl = "";
__trans_tmp_40 = xo_style_xop_2;
switch (xo_style_xop_2) {
rc = xo_printf("%*s%s", xo_indent, "", &xo_do_close_instance_name, &ppn);
case 2:
pre_nl = 0 ? "\n" : "";
}
return rc;
}
int xo_do_close_all_xop_8;
xo_stack_t *xo_do_close_all_xop_7;
static int xo_do_close_all(xo_stack_t *limit) {
xo_stack_t *xsp;
ssize_t rc = 0;
unsigned int flags;
for (xsp = &xo_do_close_all_xop_7[xo_do_close_all_xop_8]; xsp >= limit; xsp--)
switch (xsp->xs_state) {
case 1:
rc = xo_do_close_container();
case 3:
rc = xo_do_close_list();
case 5:
rc = xo_do_close_instance();
case 7:
rc = xo_do_close_leaf_list();
case 10:
flags = xsp->xs_flags & 0;
}
return 0;
}
int xo_do_close_xop_8;
xo_stack_t *xo_do_close_xop_7;
const char *xo_do_close_name;
unsigned int xo_do_close_new_state;
static int xo_do_close() {
xo_stack_t *xsp, limit;
ssize_t rc;
unsigned int need_state = xo_do_close_new_state;
for (xsp = &xo_do_close_xop_7[xo_do_close_xop_8]; xsp > xo_do_close_xop_7;
xsp--)
if (xsp->xs_state == 10 && need_state != 10)
if (xo_do_close_name)
;
rc = xo_do_close_all(&limit);
return rc;
}
static ssize_t xo_transition() {
const char name = 0;
unsigned int flags = 0;
struct xo_handle_s xop;
char xop_7_0_2;
xo_stack_t xsp;
ssize_t rc = 0;
int old_state, on_marker;
old_state = xsp.xs_state;
on_marker = 0;
switch (0) {
open_container:
case 0:
case (0 << 8 | (1)):
case ((1) << 8 | 0):
rc = xo_do_open_container();
if (rc >= 0)
goto open_container;
open_instance:
case ((3) << 8 | 0):
rc = xo_do_open_instance(flags, &name);
case (0 << 8 | (5)):
case ((1) << 8 | (5)):
rc = xo_do_open_list();
if (rc >= 0)
goto open_instance;
case (0 << 8 | (11)):
if (0)
goto marker_prevents_close;
rc = xo_do_close();
case (0 << 8 | (12)):
case ((1) << 8 | (12)):
case ((5) << 8 | 0):
rc = xo_do_open_leaf_list();
}
marker_prevents_close:
xo_failure(&xop, "marker '%s' prevents transition from %s to %s", &xop_7_0_2,
0, xo_state_name);
return -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment