From 9cee7ab04d8ed9807e540a63cc9c0a0c8d3c7e61 Mon Sep 17 00:00:00 2001 From: Chuck Houpt Date: Tue, 9 Jun 2026 06:30:28 -0400 Subject: [PATCH] Updated banner to show system architecture and improved als_system/1 Banner now displays system name and arch (e.g. "Linux/i386"), which is useful for identifying compilation target. Changes to als_system/1: - Added system related fields from uname() - Removed "manufacturer" field, which was always "generic" - Updated docs --- core/alsp_src/builtins/blt_shl.pro | 7 ++++--- core/alsp_src/builtins/builtins.pro | 4 +++- core/alsp_src/generic/defs.h | 3 --- core/alsp_src/generic/main.c | 30 ++++++++++++++++++++++------- docs/docs/ref/als_system.md | 6 ++++-- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/core/alsp_src/builtins/blt_shl.pro b/core/alsp_src/builtins/blt_shl.pro index 0605215a7..0a6dc1e9d 100644 --- a/core/alsp_src/builtins/blt_shl.pro +++ b/core/alsp_src/builtins/blt_shl.pro @@ -303,7 +303,8 @@ ss_load_the_dot_alspro(AutoFile, Verbosity) print_banner(OutS,L) :- system_name(L, Name), - dmember(os_variation = OSVar, L), + dmember(sysname = Sysname, L), + dmember(machine = Machine, L), dmember(prologVersion = Version, L), dmember(prologYear = Year, L), current_prolog_flag(windows_system, WinsName), @@ -312,9 +313,9 @@ print_banner(OutS,L) name(WBan, [UInC | WNCs]), !, #if (all_procedures(syscfg,intconstr,0,_)) - printf(OutS,'CLP(BNR)(r) \[%s Version %s \[%s\]\]\n',[Name,Version,OSVar]), + printf(OutS,'CLP(BNR)(r) \[%s Version %s \[%s/%s\]\]\n',[Name,Version,Sysname,Machine]), #else - printf(OutS,'%s Version %s \[%s\]\n',[Name,Version,OSVar]), + printf(OutS,'%s Version %s \[%s/%s\]\n',[Name,Version,Sysname,Machine]), #endif printf(OutS,' Copyright (c) 1987-%s Applied Logic Systems, Inc.\n\n',[Year]), flush_output(OutS). diff --git a/core/alsp_src/builtins/builtins.pro b/core/alsp_src/builtins/builtins.pro index 80d0d007a..700a83f75 100644 --- a/core/alsp_src/builtins/builtins.pro +++ b/core/alsp_src/builtins/builtins.pro @@ -36,7 +36,9 @@ use debugger. | processor i8086, i286, i386, i486 | m68k, m88k, vax, ... | portable - | manufacturer (.e.g. sun3)..... + | sysname (e.g. SunOS)... + | release -- 'nn.mm' -- + | machine (e.g. Sparc)... | prolog_version -- 'nnn.mm' --- | | diff --git a/core/alsp_src/generic/defs.h b/core/alsp_src/generic/defs.h index 160b3f322..086fc6173 100644 --- a/core/alsp_src/generic/defs.h +++ b/core/alsp_src/generic/defs.h @@ -43,9 +43,6 @@ | script instead, and configure appropriately inside the sources. *---------------------------------------------------------------------*/ - /* #define SysName "ALS Prolog" -- now computed in blt_shl.pro */ -#define SysManufacturer "generic" - /* Like UNIX and OSStr above, assume that the OS has a brk() call. */ #ifdef MacOS diff --git a/core/alsp_src/generic/main.c b/core/alsp_src/generic/main.c index 8d450e89a..e41c07388 100644 --- a/core/alsp_src/generic/main.c +++ b/core/alsp_src/generic/main.c @@ -34,6 +34,7 @@ #ifdef HAVE_UNISTD_H #include +#include #endif #ifdef HAVE_FCNTL_H #include @@ -129,8 +130,8 @@ static void panic_continue ( void ); static void abolish_predicate ( const char *, const char *, int ); static void assert_sys_searchdir ( char * ); static void assert_als_system (const char *, const char *, - const char *, const char *, - const char *, const char *, int); + const char *, const char *, const char *, + const char *, const char *, const char *, int); static void assert_atom_in_module ( const char*, const char * ); @@ -426,7 +427,19 @@ static int PI_prolog_init0(const PI_system_setup *setup) /*---------------------------------------* | Set up the als_system fact. *---------------------------------------*/ - + + const char *System = "sys", *Machine = "arch", *Release = ""; + +#ifdef UNIX + + struct utsname name; + uname(&name); + System = name.sysname; + Machine = name.machine; + Release = name.release; + +#endif + #ifdef MSWin32 @@ -434,11 +447,14 @@ static int PI_prolog_init0(const PI_system_setup *setup) else if (IS_WIN32S) MinorOSStr = "mswin32s"; else if (IS_WIN95) MinorOSStr = "mswin95"; + System = OSStr; + Machine = MinorOSStr; + #endif #ifndef KERNAL assert_als_system(OSStr, MinorOSStr, ProcStr, - SysManufacturer, versionNum, versionYear, heapWordBytes); + System, Release, Machine, versionNum, versionYear, heapWordBytes); /*-------------------------------------------* | Set up conditional configuration controls: @@ -618,7 +634,7 @@ assert_atom_in_module(const char *mod_name, const char *atom_name) *-----------------------------------------------------------------------------*/ static void assert_als_system(const char *os, const char *os_var, const char *proc, - const char *man, const char *ver, const char *year, int hwb) + const char *sys, const char *rel, const char *mach, const char *ver, const char *year, int hwb) { char command[2048]; @@ -626,11 +642,11 @@ assert_als_system(const char *os, const char *os_var, const char *proc, return; sprintf(command, - "assertz(builtins,als_system([os='%s',os_variation='%s',processor='%s',manufacturer='%s',prologVersion='%s',prologYear='%s',heapWordBytes=%d]),_,0)", + "assertz(builtins,als_system([os='%s',os_variation='%s',processor='%s',sysname='%s',release='%s',machine='%s',prologVersion='%s',prologYear='%s',heapWordBytes=%d]),_,0)", os, os_var, proc, - man, + sys, rel, mach, ver, year, heapWordBytes); diff --git a/docs/docs/ref/als_system.md b/docs/docs/ref/als_system.md index 4de662957..0f0c3639c 100644 --- a/docs/docs/ref/als_system.md +++ b/docs/docs/ref/als_system.md @@ -37,7 +37,9 @@ Each property appears at most once. The properties and their possible values are | os | unix, dos, macos, mswins32, vms | | os_variation |(unix) : solaris2.4 | | processor | port_thread, port_byte, i386, m68k, m88k, sparc, powerpc | -| manufacturer | generic, sun, motorola, dec, | +| sysname | SunOS, Linux, Darwin, ... | +| release | OS release version | +| machine | sparc, i368, arm64, ... | | prologVersion | `nnn-mm` | | wins | nowins, motif, macos, ... | @@ -59,5 +61,5 @@ On a Sun SPARC running Solaris 2.4, TTY portable version : ?- als_system(X). X = [os = unix, os_variation = solaris2.4, processor = port_thread, -manufacturer = generic, prologVersion = '1-76 ', wins = nowins ] +sysname = 'SunOS', release = '2.4', machine = sparc, prologVersion = '1-76', wins = nowins ] ```