Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export jl_alloc_array_nd, re-add convenience wrappers #52248

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/jl_exported_funcs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
XX(jl_adopt_thread) \
XX(jl_alignment) \
XX(jl_alloc_array_1d) \
XX(jl_alloc_array_nd) \
XX(jl_alloc_string) \
XX(jl_alloc_svec) \
XX(jl_alloc_svec_uninit) \
Expand Down
14 changes: 14 additions & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1821,6 +1821,7 @@ JL_DLLEXPORT jl_array_t *jl_ptr_to_array(jl_value_t *atype, void *data,
jl_value_t *dims, int own_buffer);

JL_DLLEXPORT jl_array_t *jl_alloc_array_1d(jl_value_t *atype, size_t nr);
JL_DLLEXPORT jl_array_t *jl_alloc_array_nd(jl_value_t *atype, size_t *dims, size_t ndims);
JL_DLLEXPORT jl_array_t *jl_pchar_to_array(const char *str, size_t len);
JL_DLLEXPORT jl_value_t *jl_pchar_to_string(const char *str, size_t len);
JL_DLLEXPORT jl_value_t *jl_cstr_to_string(const char *str);
Expand All @@ -1832,6 +1833,19 @@ JL_DLLEXPORT void jl_array_del_end(jl_array_t *a, size_t dec);
JL_DLLEXPORT void jl_array_ptr_1d_push(jl_array_t *a, jl_value_t *item);
JL_DLLEXPORT void jl_array_ptr_1d_append(jl_array_t *a, jl_array_t *a2);
JL_DLLEXPORT jl_value_t *jl_apply_array_type(jl_value_t *type, size_t dim);

STATIC_INLINE jl_array_t *jl_alloc_array_2d(jl_value_t *atype, size_t nr, size_t nc)
{
size_t dims[2] = {nr, nc};
return jl_alloc_array_nd(atype, &dims[0], 2);
}

STATIC_INLINE jl_array_t *jl_alloc_array_3d(jl_value_t *atype, size_t nr, size_t nc, size_t z)
{
size_t dims[3] = {nr, nc, z};
return jl_alloc_array_nd(atype, &dims[0], 3);
}

// property access
JL_DLLEXPORT void *jl_array_ptr(jl_array_t *a);
JL_DLLEXPORT void *jl_array_eltype(jl_value_t *a);
Expand Down