<commit_before>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include <hw/dos/dos.h>
#include <hw/utty/utty.h>

#if defined(TARGET_PC98)
// There is no background on PC-98, only foreground, and no intensity control either.
# define UTTY_COLOR_FG(c)                   (PC98_TATTR_COLOR(c) | PC98_TATTR_NOTSECRET)
# define UTTY_COLOR_BG(c)                   (0u)
# define UTTY_COLOR_FB(fg,bg)               (UTTY_COLOR_FG(fg))
# define UTTY_COLOR_MAKE_INTENSITY_FG(x)    (x)
# define UTTY_COLOR_MAKE_INTENSITY_BG(x)    (x)
# define UTTY_COLOR_MAKE_INTENSITY_FB(x)    (x)
# define UTTY_COLOR_MAKE_REVERSE(x)         ((x) | PC98_TATTR_REVERSE)
# define UTTY_COLOR_MAKE_BLINK(x)           ((x) | PC98_TATTR_BLINK)
# define UTTY_COLOR_MAKE_UNDERLINE(x)       ((x) | PC98_TATTR_UNDERLINE)

// PC-98 msb-lsb Green-Red-Blue order
# define UTTY_COLOR_BLACK               (0u)
# define UTTY_COLOR_BLUE                (1u)
# define UTTY_COLOR_RED                 (2u)
# define UTTY_COLOR_PURPLE              (3u)
# define UTTY_COLOR_GREEN               (4u)
# define UTTY_COLOR_CYAN                (5u)
# define UTTY_COLOR_YELLOW              (6u)
# define UTTY_COLOR_WHITE               (7u)
#else
// MDA/CGA/EGA/VGA/etc. have foreground in lower 4 bits, background in upper 4 bits.
// background may be limited to 7 colors (3 bits) when the 4th background bit is
// interpreted as "blink", foreground may be limited to 7 colors (3 bits) when the
// 4th foreground bit is interpreted as bit 8 of the character code.
//
// underline is available ONLY if the foreground color is blue and the background is
// black (MDA compat).<commit_msg>allow inverse from _FB macro, PC-98<commit_after>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include <hw/dos/dos.h>
#include <hw/utty/utty.h>

#if defined(TARGET_PC98)
// There is no background on PC-98, only foreground, and no intensity control either.
# define UTTY_COLOR_FG(c)                   (PC98_TATTR_COLOR(c) | PC98_TATTR_NOTSECRET)
# define UTTY_COLOR_BG(c)                   (0u)
# define UTTY_COLOR_FB(fg,bg)               (((fg) != 0u) ? (UTTY_COLOR_FG(fg)) : (UTTY_COLOR_FG(bg) | PC98_TATTR_REVERSE))
# define UTTY_COLOR_MAKE_INTENSITY_FG(x)    (x)
# define UTTY_COLOR_MAKE_INTENSITY_BG(x)    (x)
# define UTTY_COLOR_MAKE_INTENSITY_FB(x)    (x)
# define UTTY_COLOR_MAKE_REVERSE(x)         ((x) | PC98_TATTR_REVERSE)
# define UTTY_COLOR_MAKE_BLINK(x)           ((x) | PC98_TATTR_BLINK)
# define UTTY_COLOR_MAKE_UNDERLINE(x)       ((x) | PC98_TATTR_UNDERLINE)

// PC-98 msb-lsb Green-Red-Blue order
# define UTTY_COLOR_BLACK               (0u)
# define UTTY_COLOR_BLUE                (1u)
# define UTTY_COLOR_RED                 (2u)
# define UTTY_COLOR_PURPLE              (3u)
# define UTTY_COLOR_GREEN               (4u)
# define UTTY_COLOR_CYAN                (5u)
# define UTTY_COLOR_YELLOW              (6u)
# define UTTY_COLOR_WHITE               (7u)
#else
// MDA/CGA/EGA/VGA/etc. have foreground in lower 4 bits, background in upper 4 bits.
// background may be limited to 7 colors (3 bits) when the 4th background bit is
// interpreted as "blink", foreground may be limited to 7 colors (3 bits) when the
// 4th foreground bit is interpreted as bit 8 of the character code.
//
// underline is available ONLY if the foreground color is blue and the background is
// black (MDA compat).
{'fraction_non_alphanumeric': 0.09952465834818776, 'fraction_numerical': 0.021687462863933454, 'mean_word_length': 2.883506343713956, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4960050', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1229, 'n_words': 320}