Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
#!/usr/bin/env node
// Regenerates src/display_table.rs from kernel/fixtures/identity-v1.json's
// frozen `displayForbidden` table. Run after the fixture is regenerated; the
// conformance test fails until the two agree.
import { readFileSync, writeFileSync } from 'node:fs'
const here = new URL('.', import.meta.url).pathname
const d = JSON.parse(readFileSync(here + '../../../kernel/fixtures/identity-v1.json', 'utf8')).displayForbidden
const hex = (n) => '0x' + n.toString(16).padStart(4, '0')
const rows = []
for (let i = 0; i < d.ranges.length; i += 6) rows.push(' ' + d.ranges.slice(i, i + 6).map(([a, b]) => `(${hex(a)}, ${hex(b)})`).join(', ') + ',')
writeFileSync(here + 'src/display_table.rs', `// SPDX-License-Identifier: MIT
// Copyright (c) 2026 The Bento authors
//
// GENERATED by gen-display-table.mjs from kernel/fixtures/identity-v1.json
// (\`displayForbidden\`, Unicode ${d.unicode}). Do not edit by hand.
//
// The display refusal set, frozen as explicit code-point ranges so every host
// refuses the same characters whatever Unicode tables its platform ships.
pub const UNICODE: &str = "${d.unicode}";
/// Sorted, non-overlapping, inclusive.
pub const DISPLAY_FORBIDDEN_RANGES: [(u32, u32); ${d.ranges.length}] = [
${rows.join('\n')}
];
`)
console.log(`${d.ranges.length} ranges, Unicode ${d.unicode}`)