Skip to content

Commit

Permalink
fix the c-code to not cause any errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hhoeflin committed Jan 7, 2024
1 parent f194993 commit 91a378d
Show file tree
Hide file tree
Showing 28 changed files with 413 additions and 30 deletions.
4 changes: 3 additions & 1 deletion inst/CWrappers_1.10.0/makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.ONESHELL:
R=R


Expand All @@ -14,6 +15,7 @@ output/all_const_df_code.txt output/all_const_enum_names.txt ./create_constants_

output_code/export_auto.h output/library_names.txt output/makevars_files.txt ./createCWrappers.Rout output/include_file_names.txt: createCWrappers.R helperFunctions.R injectionCode.R store/functions_for_wrappping.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ createCWrappers.R ./createCWrappers.Rout
cd output_code && patch -F 0 < ../patches/empty_attrs.patch

output/DT_enum_base_type.txt output/DT_enum_enum.txt output/enum_assign.txt output/base_type_assign.txt output/DT_enum_struct.txt output/enum_create_code_c.txt output/enum_create_code_h.txt output/struct_create_code_h.txt output/DT_enum_all_types.txt output/h5t_public_types_assign.txt output/all_types_dt_return_df.txt output/struct_create_code_c.txt ./create_datatype_wrappers.Rout output/struct_assign.txt: store/all_types.rds create_datatype_wrappers.R store/enum_info.rds store/struct_info.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ create_datatype_wrappers.R ./create_datatype_wrappers.Rout
Expand All @@ -22,7 +24,7 @@ store/functions_for_wrappping.rds store/all_types.rds store/struct_info.rds stor
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ identify_prototypes.R ./identify_prototypes.Rout


clean:
clean:
rm -r output_code output store src_nocomments *.Rout

copy:
Expand Down
53 changes: 53 additions & 0 deletions inst/CWrappers_1.10.0/patches/empty_attrs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/src/1_12_0/Wrapper_auto_H5A.c b/src/1_12_0/Wrapper_auto_H5A.c
index 4ce99a9..49b8ff0 100644
--- a/src/1_12_0/Wrapper_auto_H5A.c
+++ b/src/1_12_0/Wrapper_auto_H5A.c
@@ -614,13 +614,13 @@ SEXP R_H5Aread(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf, SEXP _dupl_buf){
R_buf = PROTECT(duplicate(R_buf));
vars_protected++;
}
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Aread(attr_id, type_id, buf);
@@ -690,13 +690,13 @@ SEXP R_H5Arename_by_name(SEXP R_loc_id, SEXP R_obj_name, SEXP R_old_attr_name, S
/* H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); */
SEXP R_H5Awrite(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf){
int vars_protected=0;
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
const void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Awrite(attr_id, type_id, buf);
diff --git a/src/1_12_0/Wrapper_auto_H5D.c b/src/1_12_0/Wrapper_auto_H5D.c
index 515f8db..8844fb6 100644
--- a/src/1_12_0/Wrapper_auto_H5D.c
+++ b/src/1_12_0/Wrapper_auto_H5D.c
@@ -856,13 +856,13 @@ SEXP R_H5Dvlen_reclaim(SEXP R_type_id, SEXP R_space_id, SEXP R_plist_id, SEXP R_
vars_protected++;
}
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
hid_t space_id = SEXP_to_longlong(R_space_id, 0);
hid_t plist_id = SEXP_to_longlong(R_plist_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Dvlen_reclaim(type_id, space_id, plist_id, buf);
4 changes: 3 additions & 1 deletion inst/CWrappers_1.10.2/makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.ONESHELL:
R=R


Expand All @@ -14,6 +15,7 @@ output/all_const_df_code.txt output/all_const_enum_names.txt ./create_constants_

output_code/export_auto.h output/library_names.txt output/makevars_files.txt ./createCWrappers.Rout output/include_file_names.txt: createCWrappers.R helperFunctions.R injectionCode.R store/functions_for_wrappping.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ createCWrappers.R ./createCWrappers.Rout
cd output_code && patch -F 0 < ../patches/empty_attrs.patch

output/DT_enum_base_type.txt output/DT_enum_enum.txt output/enum_assign.txt output/base_type_assign.txt output/DT_enum_struct.txt output/enum_create_code_c.txt output/enum_create_code_h.txt output/struct_create_code_h.txt output/DT_enum_all_types.txt output/h5t_public_types_assign.txt output/all_types_dt_return_df.txt output/struct_create_code_c.txt ./create_datatype_wrappers.Rout output/struct_assign.txt: store/all_types.rds create_datatype_wrappers.R store/enum_info.rds store/struct_info.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ create_datatype_wrappers.R ./create_datatype_wrappers.Rout
Expand All @@ -22,7 +24,7 @@ store/functions_for_wrappping.rds store/all_types.rds store/struct_info.rds stor
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ identify_prototypes.R ./identify_prototypes.Rout


clean:
clean:
rm -r output_code output store src_nocomments *.Rout

copy:
Expand Down
53 changes: 53 additions & 0 deletions inst/CWrappers_1.10.2/patches/empty_attrs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/src/1_12_0/Wrapper_auto_H5A.c b/src/1_12_0/Wrapper_auto_H5A.c
index 4ce99a9..49b8ff0 100644
--- a/src/1_12_0/Wrapper_auto_H5A.c
+++ b/src/1_12_0/Wrapper_auto_H5A.c
@@ -614,13 +614,13 @@ SEXP R_H5Aread(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf, SEXP _dupl_buf){
R_buf = PROTECT(duplicate(R_buf));
vars_protected++;
}
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Aread(attr_id, type_id, buf);
@@ -690,13 +690,13 @@ SEXP R_H5Arename_by_name(SEXP R_loc_id, SEXP R_obj_name, SEXP R_old_attr_name, S
/* H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); */
SEXP R_H5Awrite(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf){
int vars_protected=0;
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
const void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Awrite(attr_id, type_id, buf);
diff --git a/src/1_12_0/Wrapper_auto_H5D.c b/src/1_12_0/Wrapper_auto_H5D.c
index 515f8db..8844fb6 100644
--- a/src/1_12_0/Wrapper_auto_H5D.c
+++ b/src/1_12_0/Wrapper_auto_H5D.c
@@ -856,13 +856,13 @@ SEXP R_H5Dvlen_reclaim(SEXP R_type_id, SEXP R_space_id, SEXP R_plist_id, SEXP R_
vars_protected++;
}
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
hid_t space_id = SEXP_to_longlong(R_space_id, 0);
hid_t plist_id = SEXP_to_longlong(R_plist_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Dvlen_reclaim(type_id, space_id, plist_id, buf);
5 changes: 4 additions & 1 deletion inst/CWrappers_1.10.3/makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.ONESHELL:

R=R


Expand All @@ -14,6 +16,7 @@ output/all_const_df_code.txt output/all_const_enum_names.txt ./create_constants_

output_code/export_auto.h output/library_names.txt output/makevars_files.txt ./createCWrappers.Rout output/include_file_names.txt: createCWrappers.R helperFunctions.R injectionCode.R store/functions_for_wrappping.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ createCWrappers.R ./createCWrappers.Rout
cd output_code && patch -F 0 < ../patches/empty_attrs.patch

output/DT_enum_base_type.txt output/DT_enum_enum.txt output/enum_assign.txt output/base_type_assign.txt output/DT_enum_struct.txt output/enum_create_code_c.txt output/enum_create_code_h.txt output/struct_create_code_h.txt output/DT_enum_all_types.txt output/h5t_public_types_assign.txt output/all_types_dt_return_df.txt output/struct_create_code_c.txt ./create_datatype_wrappers.Rout output/struct_assign.txt: store/all_types.rds create_datatype_wrappers.R store/enum_info.rds store/struct_info.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ create_datatype_wrappers.R ./create_datatype_wrappers.Rout
Expand All @@ -22,7 +25,7 @@ store/functions_for_wrappping.rds store/all_types.rds store/struct_info.rds stor
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ identify_prototypes.R ./identify_prototypes.Rout


clean:
clean:
rm -r output_code output store src_nocomments *.Rout

copy:
Expand Down
53 changes: 53 additions & 0 deletions inst/CWrappers_1.10.3/patches/empty_attrs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/src/1_12_0/Wrapper_auto_H5A.c b/src/1_12_0/Wrapper_auto_H5A.c
index 4ce99a9..49b8ff0 100644
--- a/src/1_12_0/Wrapper_auto_H5A.c
+++ b/src/1_12_0/Wrapper_auto_H5A.c
@@ -614,13 +614,13 @@ SEXP R_H5Aread(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf, SEXP _dupl_buf){
R_buf = PROTECT(duplicate(R_buf));
vars_protected++;
}
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Aread(attr_id, type_id, buf);
@@ -690,13 +690,13 @@ SEXP R_H5Arename_by_name(SEXP R_loc_id, SEXP R_obj_name, SEXP R_old_attr_name, S
/* H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); */
SEXP R_H5Awrite(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf){
int vars_protected=0;
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
const void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Awrite(attr_id, type_id, buf);
diff --git a/src/1_12_0/Wrapper_auto_H5D.c b/src/1_12_0/Wrapper_auto_H5D.c
index 515f8db..8844fb6 100644
--- a/src/1_12_0/Wrapper_auto_H5D.c
+++ b/src/1_12_0/Wrapper_auto_H5D.c
@@ -856,13 +856,13 @@ SEXP R_H5Dvlen_reclaim(SEXP R_type_id, SEXP R_space_id, SEXP R_plist_id, SEXP R_
vars_protected++;
}
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
hid_t space_id = SEXP_to_longlong(R_space_id, 0);
hid_t plist_id = SEXP_to_longlong(R_plist_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Dvlen_reclaim(type_id, space_id, plist_id, buf);
5 changes: 2 additions & 3 deletions inst/CWrappers_1.12.0/makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
R=R


.PHONY: all clean copy


all: ./create_constants_wrapper.Rout ./createCWrappers.Rout ./create_datatype_wrappers.Rout ./identify_prototypes.Rout


Expand All @@ -14,6 +12,7 @@ output/all_const_df_code.txt output/all_const_enum_names.txt ./create_constants_

output_code/export_auto.h output/library_names.txt output/makevars_files.txt ./createCWrappers.Rout output/include_file_names.txt: createCWrappers.R helperFunctions.R injectionCode.R store/functions_for_wrappping.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ createCWrappers.R ./createCWrappers.Rout
cd output_code && patch -F 0 < ../patches/empty_attrs.patch

output/DT_enum_base_type.txt output/DT_enum_enum.txt output/enum_assign.txt output/base_type_assign.txt output/DT_enum_struct.txt output/enum_create_code_c.txt output/enum_create_code_h.txt output/struct_create_code_h.txt output/DT_enum_all_types.txt output/h5t_public_types_assign.txt output/all_types_dt_return_df.txt output/struct_create_code_c.txt ./create_datatype_wrappers.Rout output/struct_assign.txt: store/all_types.rds create_datatype_wrappers.R store/enum_info.rds store/struct_info.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ create_datatype_wrappers.R ./create_datatype_wrappers.Rout
Expand All @@ -22,7 +21,7 @@ store/functions_for_wrappping.rds store/all_types.rds store/struct_info.rds stor
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ identify_prototypes.R ./identify_prototypes.Rout


clean:
clean:
rm -r output_code output store src_nocomments *.Rout

copy:
Expand Down
53 changes: 53 additions & 0 deletions inst/CWrappers_1.12.0/patches/empty_attrs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/src/1_12_0/Wrapper_auto_H5A.c b/src/1_12_0/Wrapper_auto_H5A.c
index 4ce99a9..49b8ff0 100644
--- a/src/1_12_0/Wrapper_auto_H5A.c
+++ b/src/1_12_0/Wrapper_auto_H5A.c
@@ -614,13 +614,13 @@ SEXP R_H5Aread(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf, SEXP _dupl_buf){
R_buf = PROTECT(duplicate(R_buf));
vars_protected++;
}
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Aread(attr_id, type_id, buf);
@@ -690,13 +690,13 @@ SEXP R_H5Arename_by_name(SEXP R_loc_id, SEXP R_obj_name, SEXP R_old_attr_name, S
/* H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); */
SEXP R_H5Awrite(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf){
int vars_protected=0;
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
const void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Awrite(attr_id, type_id, buf);
diff --git a/src/1_12_0/Wrapper_auto_H5D.c b/src/1_12_0/Wrapper_auto_H5D.c
index 515f8db..8844fb6 100644
--- a/src/1_12_0/Wrapper_auto_H5D.c
+++ b/src/1_12_0/Wrapper_auto_H5D.c
@@ -856,13 +856,13 @@ SEXP R_H5Dvlen_reclaim(SEXP R_type_id, SEXP R_space_id, SEXP R_plist_id, SEXP R_
vars_protected++;
}
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
hid_t space_id = SEXP_to_longlong(R_space_id, 0);
hid_t plist_id = SEXP_to_longlong(R_plist_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Dvlen_reclaim(type_id, space_id, plist_id, buf);
4 changes: 3 additions & 1 deletion inst/CWrappers_1.8.12/makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.ONESHELL:
R=R


Expand All @@ -14,6 +15,7 @@ output/all_const_df_code.txt output/all_const_enum_names.txt ./create_constants_

output_code/export_auto.h output/library_names.txt output/makevars_files.txt ./createCWrappers.Rout output/include_file_names.txt: createCWrappers.R helperFunctions.R injectionCode.R store/functions_for_wrappping.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ createCWrappers.R ./createCWrappers.Rout
cd output_code && patch -F 0 < ../patches/empty_attrs.patch

output/DT_enum_base_type.txt output/DT_enum_enum.txt output/enum_assign.txt output/base_type_assign.txt output/DT_enum_struct.txt output/enum_create_code_c.txt output/enum_create_code_h.txt output/struct_create_code_h.txt output/DT_enum_all_types.txt output/h5t_public_types_assign.txt output/all_types_dt_return_df.txt output/struct_create_code_c.txt ./create_datatype_wrappers.Rout output/struct_assign.txt: store/all_types.rds create_datatype_wrappers.R store/enum_info.rds store/struct_info.rds
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ create_datatype_wrappers.R ./create_datatype_wrappers.Rout
Expand All @@ -22,7 +24,7 @@ store/functions_for_wrappping.rds store/all_types.rds store/struct_info.rds stor
$(R) CMD BATCH --no-save --no-restore --no-site-file --no-environ identify_prototypes.R ./identify_prototypes.Rout


clean:
clean:
rm -r output_code output store src_nocomments *.Rout

copy:
Expand Down
53 changes: 53 additions & 0 deletions inst/CWrappers_1.8.12/patches/empty_attrs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/src/1_12_0/Wrapper_auto_H5A.c b/src/1_12_0/Wrapper_auto_H5A.c
index 4ce99a9..49b8ff0 100644
--- a/src/1_12_0/Wrapper_auto_H5A.c
+++ b/src/1_12_0/Wrapper_auto_H5A.c
@@ -614,13 +614,13 @@ SEXP R_H5Aread(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf, SEXP _dupl_buf){
R_buf = PROTECT(duplicate(R_buf));
vars_protected++;
}
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Aread(attr_id, type_id, buf);
@@ -690,13 +690,13 @@ SEXP R_H5Arename_by_name(SEXP R_loc_id, SEXP R_obj_name, SEXP R_old_attr_name, S
/* H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); */
SEXP R_H5Awrite(SEXP R_attr_id, SEXP R_type_id, SEXP R_buf){
int vars_protected=0;
hid_t attr_id = SEXP_to_longlong(R_attr_id, 0);
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
const void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Awrite(attr_id, type_id, buf);
diff --git a/src/1_12_0/Wrapper_auto_H5D.c b/src/1_12_0/Wrapper_auto_H5D.c
index 515f8db..8844fb6 100644
--- a/src/1_12_0/Wrapper_auto_H5D.c
+++ b/src/1_12_0/Wrapper_auto_H5D.c
@@ -856,13 +856,13 @@ SEXP R_H5Dvlen_reclaim(SEXP R_type_id, SEXP R_space_id, SEXP R_plist_id, SEXP R_
vars_protected++;
}
hid_t type_id = SEXP_to_longlong(R_type_id, 0);
hid_t space_id = SEXP_to_longlong(R_space_id, 0);
hid_t plist_id = SEXP_to_longlong(R_plist_id, 0);
void* buf;
- if(XLENGTH(R_buf) == 0) {
+ if(TYPEOF(R_buf) == NILSXP) {
buf = NULL;
}
else {
buf = (void *) VOIDPTR(R_buf);
}
herr_t return_val = H5Dvlen_reclaim(type_id, space_id, plist_id, buf);
Loading

0 comments on commit 91a378d

Please sign in to comment.