From 87935c66787d35c8df055d6aae944ace91d1613c Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Mon, 25 Apr 2016 18:35:02 +0200 Subject: [PATCH] Fixed all compilation problems with new function names, locations etc --- python/obitools3/obidms/_obidms.pyx | 15 ++++++++------- python/obitools3/obidms/capi/obidmscolumn.pxd | 2 -- python/obitools3/obidms/capi/obiutils.pxd | 12 ++++++++++++ python/obitools3/obidms/capi/obiview.pxd | 8 ++++---- src/obiview.c | 8 ++++---- src/obiview.h | 4 ++-- 6 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 python/obitools3/obidms/capi/obiutils.pxd diff --git a/python/obitools3/obidms/_obidms.pyx b/python/obitools3/obidms/_obidms.pyx index 0b04446..0d7b987 100644 --- a/python/obitools3/obidms/_obidms.pyx +++ b/python/obitools3/obidms/_obidms.pyx @@ -6,9 +6,10 @@ from .capi.obidms cimport obi_dms, \ obi_close_dms from .capi.obidmscolumn cimport obi_close_column, \ - obi_column_format_date, \ OBIDMS_column_p, \ OBIDMS_column_header_p + +from .capi.obiutils cimport obi_format_date from .capi.obitypes cimport const_char_p, \ OBIType_t, \ @@ -57,8 +58,8 @@ from .capi.obiview cimport Obiview_p, \ obi_new_view_cloned_from_name, \ obi_new_view_nuc_seqs_cloned_from_name, \ obi_open_view, \ - obi_read_views, \ - obi_unmap_read_views, \ + obi_read_view_infos, \ + obi_close_view_infos, \ obi_view_delete_column, \ obi_view_add_column, \ obi_view_get_column, \ @@ -131,7 +132,7 @@ cdef class OBIDMS_column : return (self.pointer)[0].header.lines_used cpdef str get_creation_date(self): - return bytes2str(obi_column_format_date((self.pointer)[0].header.creation_date)) + return bytes2str(obi_format_date((self.pointer)[0].header.creation_date)) cpdef str get_comments(self): return bytes2str((self.pointer)[0].header.comments) @@ -703,7 +704,7 @@ cdef class OBIDMS : cdef bytes name_b views = {} - all_views_p = obi_read_views(self.pointer) + all_views_p = obi_read_view_infos(self.pointer) if all_views_p == NULL : raise Exception("No views to read") nb_views = (all_views_p.header).view_count @@ -717,7 +718,7 @@ cdef class OBIDMS : views[view_name]["line_count"] = view_p.line_count views[view_name]["view_number"] = view_p.view_number views[view_name]["created_from"] = bytes2str(view_p.created_from) - views[view_name]["creation_date"] = bytes2str(obi_column_format_date(view_p.creation_date)) # TODO move this function in utils or somethings + views[view_name]["creation_date"] = bytes2str(obi_format_date(view_p.creation_date)) # TODO move this function in utils or somethings if (view_p.all_lines) : views[view_name]["line_selection"] = None else : @@ -731,7 +732,7 @@ cdef class OBIDMS : views[view_name]["column_references"][column_name] = {} views[view_name]["column_references"][column_name]["version"] = column_refs[j].version - obi_unmap_read_views(all_views_p); + obi_close_view_infos(all_views_p); return views diff --git a/python/obitools3/obidms/capi/obidmscolumn.pxd b/python/obitools3/obidms/capi/obidmscolumn.pxd index 73f682e..cc151e4 100644 --- a/python/obitools3/obidms/capi/obidmscolumn.pxd +++ b/python/obitools3/obidms/capi/obidmscolumn.pxd @@ -70,8 +70,6 @@ cdef extern from "obidmscolumn.h" nogil: obiversion_t version_number) int obi_close_header(OBIDMS_column_header_p header) - - char* obi_column_format_date(time_t date) int obi_select(OBIDMS_column_p line_selection_column, index_t line_to_grep) diff --git a/python/obitools3/obidms/capi/obiutils.pxd b/python/obitools3/obidms/capi/obiutils.pxd new file mode 100644 index 0000000..726ad0e --- /dev/null +++ b/python/obitools3/obidms/capi/obiutils.pxd @@ -0,0 +1,12 @@ +#cython: language_level=3 + + +from posix.types cimport time_t + +from ..capi.obitypes cimport const_char_p + + +cdef extern from "utils.h" nogil: + + const_char_p obi_format_date(time_t date) + diff --git a/python/obitools3/obidms/capi/obiview.pxd b/python/obitools3/obidms/capi/obiview.pxd index a818110..79cb4d0 100644 --- a/python/obitools3/obidms/capi/obiview.pxd +++ b/python/obitools3/obidms/capi/obiview.pxd @@ -84,10 +84,6 @@ cdef extern from "obiview.h" nogil: Obiview_p obi_open_view(OBIDMS_p dms, const_char_p view_name) - Obiviews_infos_all_p obi_read_views(OBIDMS_p dms) - - int obi_unmap_read_views(Obiviews_infos_all_p views) - int obi_view_add_column(Obiview_p view, const_char_p column_name, obiversion_t version_number, @@ -115,6 +111,10 @@ cdef extern from "obiview.h" nogil: int obi_save_and_close_view(Obiview_p view) + Obiviews_infos_all_p obi_read_view_infos(OBIDMS_p dms) + + int obi_close_view_infos(Obiviews_infos_all_p views) + int obi_column_set_obiint_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, diff --git a/src/obiview.c b/src/obiview.c index e13266e..d395d94 100644 --- a/src/obiview.c +++ b/src/obiview.c @@ -435,7 +435,7 @@ Obiview_p obi_new_view(OBIDMS_p dms, const char* view_name, Obiview_p view_to_cl Obiviews_infos_all_p views_infos; // Check uniqueness of name TODO but problem if view not written yet has the same name. Save lists of open views in DMS ? - views_infos = obi_read_views(dms); + views_infos = obi_read_view_infos(dms); if (views_infos != NULL) { for (i=0; i<((views_infos->header)->view_count); i++) @@ -444,11 +444,11 @@ Obiview_p obi_new_view(OBIDMS_p dms, const char* view_name, Obiview_p view_to_cl { obi_set_errno(OBIVIEW_ERROR); obidebug(1, "\nView name already exists for a previous view"); - obi_unmap_read_views(views_infos); + obi_close_view_infos(views_infos); return NULL; } } - obi_unmap_read_views(views_infos); + obi_close_view_infos(views_infos); } view = (Obiview_p) malloc(sizeof(Obiview_t)); @@ -826,7 +826,7 @@ int obi_view_add_column(Obiview_p view, if (view->line_count > nb_lines) nb_lines = view->line_count; else if (nb_lines > view->line_count) - obi_view_update_lines(view, nb_lines); + update_lines(view, nb_lines); // Open or create the column if (create) diff --git a/src/obiview.h b/src/obiview.h index 50fcfa5..052bffd 100644 --- a/src/obiview.h +++ b/src/obiview.h @@ -72,7 +72,7 @@ typedef struct Obiview { */ char created_from[OBIVIEW_NAME_MAX_LENGTH+1]; /**< Name of the view from which that view was cloned if the view was cloned. */ - char view_type[VIEW_TYPE_MAX_NAME+1]; /**< Type of the view if there is one. + char view_type[VIEW_TYPE_MAX_LENGTH+1]; /**< Type of the view if there is one. * Types existing: NUC_SEQS_VIEW. */ bool read_only; /**< Whether the view is read-only or can be modified. @@ -125,7 +125,7 @@ typedef struct Obiview_infos { */ char created_from[OBIVIEW_NAME_MAX_LENGTH+1]; /**< Name of the view from which that view was cloned, if it was cloned. */ - char view_type[VIEW_TYPE_MAX_NAME+1]; /**< Type of the view if there is one. + char view_type[VIEW_TYPE_MAX_LENGTH+1]; /**< Type of the view if there is one. * Types existing: NUC_SEQS_VIEW. */ bool all_lines; /**< Whether there is a line selection associated with the view.