ChrisOS Research ProjectOperating systems · language systems · graphics · machine emulation
DOCUMENTATION ARCHIVEMAIN BRANCH
ChrisOS/Source reference: APPS/PREFS/PREFS.CC

Source reference: APPS/PREFS/PREFS.CC

Deterministic source record. The complete textual file is reproduced below; this page does not replace architectural interpretation in the authored chapters.

File identity

Field Value
Path APPS/PREFS/PREFS.CC
Lines 46
Bytes 1205
SHA-256 95e4ddf7954ad1cb5a00592be8170a0cecfa658e0e812a943d326f51346a49b1
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Detected syntactic dependencies

Line Include
— No preprocessor include detected.

Detected symbols

Line Symbol
4 main

Complete source

The following block is the complete textual file at the recorded revision. No lines are elided, abbreviated or paraphrased.

int g_prev;
int g_layout;

void main() {
  int live;
  int cur;
  g_prev = 0;
  g_layout = kb_get();
  while (1) {
    live = win_begin(420, 220, "Prefs");
    if (live == 0) {
      return;
    }
    cur = kb_get();
    g_layout = cur;
    text(16, 48, "Keyboard layout", 0x001C1814);
    text(16, 68, "Choose US or ABNT-2 (Brazil).", 0x00504038);
    if (g_layout == 1) {
      fillrgb(16, 100, 160, 28, 0x00406080);
      text(36, 108, "US QWERTY", 0x00FFFFFF);
      fillrgb(196, 100, 160, 28, 0x00008050);
      text(220, 108, "ABNT-2", 0x00FFFFFF);
      text(16, 150, "Active: ABNT-2", 0x00603818);
    } else {
      fillrgb(16, 100, 160, 28, 0x00008050);
      text(36, 108, "US QWERTY", 0x00FFFFFF);
      fillrgb(196, 100, 160, 28, 0x00406080);
      text(220, 108, "ABNT-2", 0x00FFFFFF);
      text(16, 150, "Active: US", 0x00603818);
    }
    text(16, 178, "Saved to SYS/KB.CFG", 0x00504038);
    text(16, win_h() - 28, "layout persists across reboot", 0x00504038);
    if (win_click(16, 100, 160, 28)) {
      kb_layout(0);
      g_layout = 0;
    }
    if (win_click(196, 100, 160, 28)) {
      mkdir("SYS");
      kb_layout(1);
      g_layout = 1;
    }
    win_end();
    wait(1);
  }
}

Role of this record

The atlas guarantees file-by-file traceability. Responsibility, invariants, ownership, concurrency, security, performance and subsystem interactions belong in authored chapters and must cite this file when applicable.

Document record ID: source-95e4ddf7954ad1cb Reviewed source: da3df29cb397 Class: generated-source-reference