Home /Modules/operating-system/SLOSShape.sleela

SLOSShape.sleela

lib/operating-system/SLOSShape.sleela · 142 line(s) · sleela

<< lib/operating-system/SLOSShape.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLOSShape — the design-time "shape" an OS being
     constructed should take. A shape is the family of conventions a target OS
     adopts: how it boots, what its init/service manager is called, how its
     filesystem namespace is laid out, what its path separator is, and which
     desktop/session stack sits on top. The three canonical shapes mirror the
     real world: Windows, Linux, and macOS.
   
   This is the OOD extrapolation axis. One SLOSModel (the aggregate being
   built) composes exactly one SLOSShape; the shape supplies the per-family
   defaults that the kernel, bootloader, filesystem, service, and desktop
   specs read when a developer does not override them. The three preset model
   classes (SLWindowsOSModel / SLLinuxOSModel / SLMacOSModel) are thin presets
   over the shapes defined here.
   
   This class describes an OS a developer is DESIGNING. It is distinct from the
   host-facing SLOperatingSystem/SLWindowsOS/SLLinuxOS/SLMacOS classes, which
   drive the REAL host OS the VM already runs on.
   
   Family: operating-system. Pure design model; no native bridge calls. >>
#sleela 2.5
material;
class SLOSShape {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10933;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-10";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  < Canonical shape ordinals. >
  static final int SHAPE_LINUX   = 0;
  static final int SHAPE_WINDOWS = 1;
  static final int SHAPE_MACOS   = 2;

  < one of SHAPE_* >
  int shape;
  < "Linux" / "Windows" / "macOS" >
  String label;
  int configured;

  < ---- Construction ------------------------------------------------------- >
  void linux()   { shape = SHAPE_LINUX;   label = "Linux";   configured = 1; }
  void windows() { shape = SHAPE_WINDOWS; label = "Windows"; configured = 1; }
  void macos()   { shape = SHAPE_MACOS;   label = "macOS";   configured = 1; }

  < Choose by name; defaults to Linux for an unrecognised label. >
  void configure(String name) {
    if (name == "Windows") { windows(); return; }
    if (name == "macOS")   { macos();   return; }
    linux();
  }

  boolean isLinux()   { return shape == SHAPE_LINUX; }
  boolean isWindows() { return shape == SHAPE_WINDOWS; }
  boolean isMac()     { return shape == SHAPE_MACOS; }
  int ordinal()       { return shape; }
  String name()       { return label; }

  < ---- Per-family defaults the composed specs read ----------------------- >
  < The path separator convention for this shape. >
  String pathSeparator() {
    if (shape == SHAPE_WINDOWS) { return "\\"; }
    return "/";
  }
  < The PATH-list separator convention for this shape. >
  String listSeparator() {
    if (shape == SHAPE_WINDOWS) { return ";"; }
    return ":";
  }
  < The name of the first user-space process / service manager. >
  String initManager() {
    if (shape == SHAPE_WINDOWS) { return "smss+ServiceControlManager"; }
    if (shape == SHAPE_MACOS)   { return "launchd"; }
    return "systemd";
  }
  < The default firmware/boot style for this shape. >
  String bootStyle() {
    if (shape == SHAPE_WINDOWS) { return "UEFI+BOOTMGR"; }
    if (shape == SHAPE_MACOS)   { return "UEFI+boot.efi"; }
    return "UEFI+GRUB";
  }
  < The default root-filesystem format for this shape. >
  String rootFilesystem() {
    if (shape == SHAPE_WINDOWS) { return "NTFS"; }
    if (shape == SHAPE_MACOS)   { return "APFS"; }
    return "ext4";
  }
  < The default desktop/session shell for this shape. >
  String desktopSession() {
    if (shape == SHAPE_WINDOWS) { return "Explorer/DWM"; }
    if (shape == SHAPE_MACOS)   { return "Aqua/WindowServer"; }
    return "GNOME/Wayland";
  }
  < The conventional system-root directory for this shape. >
  String systemRoot() {
    if (shape == SHAPE_WINDOWS) { return "C:\\Windows"; }
    if (shape == SHAPE_MACOS)   { return "/System"; }
    return "/usr";
  }
  < The conventional installed-executable extension for this shape. >
  String executableExtension() {
    if (shape == SHAPE_WINDOWS) { return ".exe"; }
    return "";
  }
}