Chain-Q mentioned a while back that MT_INF should be returning a pointer to the system variables as a record type. That way, it would/should be easy to access a system variable in a manner similar to this:
Code: Select all
...
TYPE
{ #include sysvars.inc defining the SystemVariables
record type and a pointer to same. }
{$i sysvars.inc}
VAR
system_vars: pSystemVariables;
ver_ascii: Longint;
job_id: Longint;
...
BEGIN
{ Get the system_variables address into system_vars. It's
a pointer to a SystemVariables record type. }
job_id:=mt_inf(@system_vars,@ver_ascii);
{ Get the address of the Common Heap base }
writeln('Common Heap Start: $', hexstr(system_vars^.SYS_CHPB));
...
END.
The example program, sysvars.pp reads in sysvars.inc and the latter file defines the system variables record type -- that was a fun exercise -- and is based on the SMSQ versions and names of the various system variables.
If you run the example program, from an Emulator please as the attached version is not suitable for a bare bones QL unless you add an executabe header with 8KB data space, it will display some pages of information with all the system variables displayed. Use 'C' or 'c' to continue to the next page, or 'Q' or 'q' to quit.
If everyone is happy/nobody complains with the suggestion then I should be able to (easily?) incorporate this into the QDOS unit and I'll create a patch for same when I'm done.
Cheers,
Norm.