Skip to content

Commit 9cee7ab

Browse files
committed
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
1 parent 97f3a44 commit 9cee7ab

5 files changed

Lines changed: 34 additions & 16 deletions

File tree

core/alsp_src/builtins/blt_shl.pro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ ss_load_the_dot_alspro(AutoFile, Verbosity)
303303
print_banner(OutS,L)
304304
:-
305305
system_name(L, Name),
306-
dmember(os_variation = OSVar, L),
306+
dmember(sysname = Sysname, L),
307+
dmember(machine = Machine, L),
307308
dmember(prologVersion = Version, L),
308309
dmember(prologYear = Year, L),
309310
current_prolog_flag(windows_system, WinsName),
@@ -312,9 +313,9 @@ print_banner(OutS,L)
312313
name(WBan, [UInC | WNCs]),
313314
!,
314315
#if (all_procedures(syscfg,intconstr,0,_))
315-
printf(OutS,'CLP(BNR)(r) \[%s Version %s \[%s\]\]\n',[Name,Version,OSVar]),
316+
printf(OutS,'CLP(BNR)(r) \[%s Version %s \[%s/%s\]\]\n',[Name,Version,Sysname,Machine]),
316317
#else
317-
printf(OutS,'%s Version %s \[%s\]\n',[Name,Version,OSVar]),
318+
printf(OutS,'%s Version %s \[%s/%s\]\n',[Name,Version,Sysname,Machine]),
318319
#endif
319320
printf(OutS,' Copyright (c) 1987-%s Applied Logic Systems, Inc.\n\n',[Year]),
320321
flush_output(OutS).

core/alsp_src/builtins/builtins.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ use debugger.
3636
| processor i8086, i286, i386, i486
3737
| m68k, m88k, vax, ...
3838
| portable
39-
| manufacturer (.e.g. sun3).....
39+
| sysname (e.g. SunOS)...
40+
| release -- 'nn.mm' --
41+
| machine (e.g. Sparc)...
4042
| prolog_version -- 'nnn.mm' ---
4143
|
4244
|

core/alsp_src/generic/defs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
| script instead, and configure appropriately inside the sources.
4444
*---------------------------------------------------------------------*/
4545

46-
/* #define SysName "ALS Prolog" -- now computed in blt_shl.pro */
47-
#define SysManufacturer "generic"
48-
4946
/* Like UNIX and OSStr above, assume that the OS has a brk() call. */
5047

5148
#ifdef MacOS

core/alsp_src/generic/main.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#ifdef HAVE_UNISTD_H
3636
#include <unistd.h>
37+
#include <sys/utsname.h>
3738
#endif
3839
#ifdef HAVE_FCNTL_H
3940
#include <fcntl.h>
@@ -129,8 +130,8 @@ static void panic_continue ( void );
129130
static void abolish_predicate ( const char *, const char *, int );
130131
static void assert_sys_searchdir ( char * );
131132
static void assert_als_system (const char *, const char *,
132-
const char *, const char *,
133-
const char *, const char *, int);
133+
const char *, const char *, const char *,
134+
const char *, const char *, const char *, int);
134135
static void assert_atom_in_module ( const char*, const char * );
135136

136137

@@ -426,19 +427,34 @@ static int PI_prolog_init0(const PI_system_setup *setup)
426427
/*---------------------------------------*
427428
| Set up the als_system fact.
428429
*---------------------------------------*/
429-
430+
431+
const char *System = "sys", *Machine = "arch", *Release = "";
432+
433+
#ifdef UNIX
434+
435+
struct utsname name;
436+
uname(&name);
437+
System = name.sysname;
438+
Machine = name.machine;
439+
Release = name.release;
440+
441+
#endif
442+
430443
#ifdef MSWin32
431444

432445

433446
if (IS_NT) MinorOSStr = "mswinnt";
434447
else if (IS_WIN32S) MinorOSStr = "mswin32s";
435448
else if (IS_WIN95) MinorOSStr = "mswin95";
436449

450+
System = OSStr;
451+
Machine = MinorOSStr;
452+
437453
#endif
438454

439455
#ifndef KERNAL
440456
assert_als_system(OSStr, MinorOSStr, ProcStr,
441-
SysManufacturer, versionNum, versionYear, heapWordBytes);
457+
System, Release, Machine, versionNum, versionYear, heapWordBytes);
442458

443459
/*-------------------------------------------*
444460
| Set up conditional configuration controls:
@@ -618,19 +634,19 @@ assert_atom_in_module(const char *mod_name, const char *atom_name)
618634
*-----------------------------------------------------------------------------*/
619635
static void
620636
assert_als_system(const char *os, const char *os_var, const char *proc,
621-
const char *man, const char *ver, const char *year, int hwb)
637+
const char *sys, const char *rel, const char *mach, const char *ver, const char *year, int hwb)
622638
{
623639
char command[2048];
624640

625641
if (noautoload && !pckgloaded)
626642
return;
627643

628644
sprintf(command,
629-
"assertz(builtins,als_system([os='%s',os_variation='%s',processor='%s',manufacturer='%s',prologVersion='%s',prologYear='%s',heapWordBytes=%d]),_,0)",
645+
"assertz(builtins,als_system([os='%s',os_variation='%s',processor='%s',sysname='%s',release='%s',machine='%s',prologVersion='%s',prologYear='%s',heapWordBytes=%d]),_,0)",
630646
os,
631647
os_var,
632648
proc,
633-
man,
649+
sys, rel, mach,
634650
ver,
635651
year,
636652
heapWordBytes);

docs/docs/ref/als_system.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ Each property appears at most once. The properties and their possible values are
3737
| os | unix, dos, macos, mswins32, vms |
3838
| os_variation |(unix) : solaris2.4 |
3939
| processor | port_thread, port_byte, i386, m68k, m88k, sparc, powerpc |
40-
| manufacturer | generic, sun, motorola, dec, |
40+
| sysname | SunOS, Linux, Darwin, ... |
41+
| release | OS release version |
42+
| machine | sparc, i368, arm64, ... |
4143
| prologVersion | `nnn-mm` |
4244
| wins | nowins, motif, macos, ... |
4345

@@ -59,5 +61,5 @@ On a Sun SPARC running Solaris 2.4, TTY portable version :
5961
?- als_system(X).
6062
6163
X = [os = unix, os_variation = solaris2.4, processor = port_thread,
62-
manufacturer = generic, prologVersion = '1-76 ', wins = nowins ]
64+
sysname = 'SunOS', release = '2.4', machine = sparc, prologVersion = '1-76', wins = nowins ]
6365
```

0 commit comments

Comments
 (0)