Skip to content

Commit afb550f

Browse files
committed
refactor
1 parent 5b47696 commit afb550f

File tree

14 files changed

+152
-125
lines changed

14 files changed

+152
-125
lines changed

.github/workflows/matlab.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
run-tests:
88
strategy:
99
matrix:
10-
os: [ubuntu-latest, macos-latest, windows-latest]
10+
os: [ubuntu-latest, macos-15-intel, macos-latest, windows-latest]
1111

1212
runs-on: ${{ matrix.os }}
1313

@@ -21,3 +21,8 @@ jobs:
2121
uses: matlab-actions/run-command@v2
2222
with:
2323
command: cd zarr-matlab, wkwBuild
24+
25+
- uses: actions/upload-artifact@v4
26+
with:
27+
name: mex-{{ matrix.os }}
28+
path: zarr-matlab/zarrMex.mex*

zarr-matlab/rust/wkw_load/src/lib.rs

Lines changed: 0 additions & 98 deletions
This file was deleted.

zarr-matlab/rust/wkw_load/target/.rustc_info.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

zarr-matlab/rust/wkw_mex/Cargo.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

zarr-matlab/rust/wkw_mex/src/lib.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

zarr-matlab/rust/wkw_mex/target/.rustc_info.json

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[package]
2-
name = "wkw_load"
2+
name = "zarr_mex"
33
version = "1.4.0"
44
authors = ["Alessandro Motta <[email protected]>"]
55
build = "build.rs"
66

77
[dependencies]
88
zarrs = "0.22.4"
9-
wkw_mex = { path = "../wkw_mex" }
9+
libc = "0.2"
1010

1111
[profile.release]
1212
lto = true
1313

1414
[lib]
15-
name = "wkw_load"
15+
name = "zarr_mex"
1616
crate-type = ["cdylib"]
File renamed without changes.
File renamed without changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
extern crate libc;
2+
extern crate zarrs;
3+
4+
mod ffi;
5+
mod macros;
6+
mod read;
7+
mod util;
8+
9+
use ffi::*;
10+
use util::*;
11+
12+
use std::slice;
13+
14+
unsafe fn read(
15+
nlhs: c_int,
16+
plhs: *mut MxArrayMut,
17+
nrhs: c_int,
18+
prhs: *const MxArray,
19+
) -> Result<()> {
20+
let rhs = match nrhs == 2 {
21+
true => slice::from_raw_parts(prhs, nrhs as usize),
22+
false => return Err("Invalid number of input arguments".to_string()),
23+
};
24+
25+
let lhs = match nlhs == 1 {
26+
true => slice::from_raw_parts_mut(plhs, nlhs as usize),
27+
false => return Err("Invalid number of output arguments".to_string()),
28+
};
29+
30+
let mat_arr = crate::read::read(rhs)?;
31+
32+
// set output
33+
lhs[0] = mat_arr;
34+
35+
Ok(())
36+
}
37+
38+
mex_function!(nlhs, lhs, nrhs, rhs, { read(nlhs, lhs, nrhs, rhs) });

0 commit comments

Comments
 (0)