Skip to content

Commit 496660b

Browse files
committed
doctor json refinement
1 parent 320961f commit 496660b

5 files changed

Lines changed: 58 additions & 21 deletions

File tree

+stdlib/doctor.m

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@
44

55
function json = doctor()
66

7-
raw = struct('matlab_arch', computer('arch'));
7+
raw = struct('matlab', []);
8+
raw.matlab.arch = computer('arch');
89

910
if ~stdlib.isoctave()
1011
try
1112
r = matlabRelease().Release;
1213
catch
1314
r = ['R' version('-release')];
1415
end
15-
raw.matlab_release = r;
16+
raw.matlab.release = r;
1617

1718
m = stdlib.matlab_bin_path();
18-
raw.matlab_extern_bin = m.extern_bin;
19-
raw.matlab_root = m.root;
20-
raw.matlab_arch_bin = m.arch_bin;
21-
raw.matlab_bin = m.bin;
19+
raw.matlab.extern_bin = m.extern_bin;
20+
raw.matlab.root = m.root;
21+
raw.matlab.arch_bin = m.arch_bin;
22+
raw.matlab.bin = m.bin;
2223
end
2324

2425
h5v = stdlib.h5get_version();
@@ -32,27 +33,27 @@
3233
end
3334

3435
if stdlib.has_java()
35-
raw.java_vendor = stdlib.java_vendor();
36-
raw.java_version = stdlib.java_version();
37-
raw.java_home = stdlib.java_home();
36+
raw.java.vendor = stdlib.java_vendor();
37+
raw.java.version = stdlib.java_version();
38+
raw.java.home = stdlib.java_home();
3839
end
3940

4041
if stdlib.has_dotnet()
41-
raw.dotnet_version = stdlib.dotnet_version();
42+
raw.dotnet.version = stdlib.dotnet_version();
4243
end
4344

4445
if stdlib.has_perl()
45-
raw.perl_version = sprintf('%d.%d.%d', stdlib.perl_version());
46-
raw.perl_exe = stdlib.perl_exe();
46+
raw.perl.version = sprintf('%d.%d.%d', stdlib.perl_version());
47+
raw.perl.exe = stdlib.perl_exe();
4748
end
4849

4950
if stdlib.has_python()
50-
raw.python_version = sprintf('%d.%d.%d', stdlib.python_version());
51-
raw.python_home = stdlib.python_home();
51+
raw.python.version = sprintf('%d.%d.%d', stdlib.python_version());
52+
raw.python.home = stdlib.python_home();
5253
end
5354

5455
if ismac()
55-
raw.xcode_version = stdlib.xcode_version();
56+
raw.xcode.version = stdlib.xcode_version();
5657
end
5758

5859
if ~stdlib.isoctave()
@@ -61,19 +62,18 @@
6162
for i = 1:length(langs)
6263
lang = langs{i};
6364
co = mex.getCompilerConfigurations(lang);
64-
ct = ['compiler_' lang];
65-
vt = ['compiler_' lang '_version'];
66-
raw.(ct) = '';
67-
raw.(vt) = '';
65+
raw.compiler.(lang).name = '';
66+
raw.compiler.(lang).version = '';
6867

6968
if ~isempty(co)
70-
raw.(ct) = co.Name;
71-
raw.(vt) = co.Version;
69+
raw.compiler.(lang).name = co(1).Name;
70+
raw.compiler.(lang).version = co(1).Version;
7271
end
7372
end
7473

7574
end
7675

76+
7777
try
7878
json = jsonencode(raw, 'PrettyPrint', true);
7979
catch e

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
* text=auto
22

3+
*.oct binary
4+
35
*.fig binary
46
*.mat binary
57
*.mdl binary diff merge=mlAutoMerge

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ resources/
1616

1717
*.mex*
1818
*.exe
19+
*.oct
1920

2021
test/printenv
2122
test/stdout_stderr_c

Readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ For macOS, `brew install dotnet` and then in Matlab `edit(fullfile(userpath, 'st
6262
## Acknowledgments
6363

6464
Stdlib for Matlab was partly funded by NASA NNH19ZDA001N-HDEE grant 80NSSC20K0176.
65+
66+
## Relevant Matlab / GNU Octave projects
67+
68+
* [Matlab or GNU Octave HDF5 interface](https://www.mathworks.com/matlabcentral/fileexchange/180491-easyh5-a-tiny-hdf5-reader-writer-for-matlab-octave)
69+
* [GNU Octave hdf5oct package](https://gnu-octave.github.io/packages/hdf5oct/)
70+
* [GNU Octave netcdf package](https://gnu-octave.github.io/packages/netcdf/)

scripts/hdf5_version.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
% build from GNU Octave with:
2+
%
3+
% mkoctfile('hdf5_version.cpp', __octave_config_info__("HDF5_CPPFLAGS"), __octave_config_info__("HDF5_LDFLAGS"), __octave_config_info__("HDF5_LIBS"))
4+
%
5+
% then from GNU octave:
6+
%
7+
% [maj, min, rel] = hdf5_version()
8+
%
9+
10+
#include <octave/oct.h>
11+
#include <hdf5.h>
12+
13+
DEFUN_DLD (hdf5_version, args, nargout,
14+
"Return HDF5 library version as [major, minor, release]")
15+
{
16+
unsigned maj = 0, min = 0, rel = 0;
17+
herr_t status = H5get_libversion(&maj, &min, &rel);
18+
19+
if (status < 0)
20+
error("H5get_libversion() failed");
21+
22+
octave_value_list retval;
23+
retval(0) = octave_value(maj);
24+
retval(1) = octave_value(min);
25+
retval(2) = octave_value(rel);
26+
27+
return retval;
28+
}

0 commit comments

Comments
 (0)