灵符lingfu

LingSys

↓ 0 downloads

Your machine's memory, GPU, motherboard and network, drawn and played in the Ling design system: LingSys, a small build for USB liquid-cooler displays, LingNet for IPv4/IPv6, DNS and packets, and a LingOS edition. 64-bit and 32-bit Windows builds included.

Keywords system-monitor, visualization, network, ipv6, gpu, lcd, lingos, ling
lingfu install LingSys
LicenseMIT
AuthorsLing Lin <taellinglin@gmail.com>
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (48)

tools/build.py
#!/usr/bin/env python3
"""Build hatchsys.ling (everything) and hatchmini.ling (the small LCD build) from the parts in src/

The Ling JIT does not see top-level bindings of `use`d modules, so the program has to be one file.
This script concatenates src/*.ling in name order and drops the generated glyph block
(DAEMON / CHESILIN outlines, kept in hatchmem.ling by tools/gen_glyphs.py) in right after 10_head.ling.

    python tools/build.py
"""
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
BEGIN, END = '# ---- BEGIN GLYPHS ----', '# ---- END GLYPHS ----'

mem = (ROOT / 'hatchmem.ling').read_text(encoding='utf8')
if BEGIN not in mem or END not in mem:
    sys.exit('glyph markers missing in hatchmem.ling')
glyphs = mem[mem.index(BEGIN):mem.index(END) + len(END)] + '\n\n'

out = []
for part in sorted(p for p in (ROOT / 'src').glob('*.ling') if not p.name.startswith(('66_', '95_', '97_'))):
    out.append(part.read_text(encoding='utf8').rstrip('\n') + '\n\n')
    if part.name.startswith('10_'):
        out.append(glyphs)

dest = ROOT / 'hatchsys.ling'
dest.write_text(''.join(out).rstrip('\n') + '\n', encoding='utf8', newline='\n')
print('wrote', dest, dest.stat().st_size, 'bytes,', sum(s.count('\n') for s in out), 'lines')

# the small build for a liquid-cooler LCD: only the parts it needs
MINI = ['10_head', '20_helpers', '30_data', '40_memory', '55_common', '86_alert', '95_mini']
out = []
for name in MINI:
    out.append((ROOT / 'src' / (name + '.ling')).read_text(encoding='utf8').rstrip('\n') + '\n\n')
    if name == '10_head':
        out.append(glyphs)
dest = ROOT / 'hatchmini.ling'
dest.write_text(''.join(out).rstrip('\n') + '\n', encoding='utf8', newline='\n')
print('wrote', dest, dest.stat().st_size, 'bytes,', sum(s.count('\n') for s in out), 'lines')

# the detailed network program (LingNet)
NET = ['10_head', '20_helpers', '30_data', '40_memory', '55_common', '64_net', '66_netx', '97_netmain']
out = []
for name in NET:
    out.append((ROOT / 'src' / (name + '.ling')).read_text(encoding='utf8').rstrip('\n') + '\n\n')
    if name == '10_head':
        out.append(glyphs)
dest = ROOT / 'hatchnet.ling'
dest.write_text(''.join(out).rstrip('\n') + '\n', encoding='utf8', newline='\n')
print('wrote', dest, dest.stat().st_size, 'bytes,', sum(s.count('\n') for s in out), 'lines')

← Back to index