sdf-xarray 0.4.0__cp314-cp314-macosx_10_13_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ /*
2
+ * SDF (Self-Describing Format) Software Library
3
+ * Copyright (c) 2012-2016, SDF Development Team
4
+ *
5
+ * Distributed under the terms of the BSD 3-clause License.
6
+ * See the LICENSE file for details.
7
+ */
8
+
9
+ /**
10
+ @internal
11
+ @file sdf_derived.h
12
+
13
+ @brief Declarations for the SDF C-library.
14
+ @details Routines for reading and writing SDF files.
15
+ @author Dr Keith Bennett
16
+ @date 15/02/2014
17
+ */
18
+
19
+ #ifndef _SDF_DERIVED_H_
20
+ #define _SDF_DERIVED_H_
21
+ #include <sdf.h>
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ int sdf_add_derived_blocks(sdf_file_t *h);
28
+ int sdf_add_derived_blocks_final(sdf_file_t *h);
29
+
30
+ #ifdef __cplusplus
31
+ }
32
+ #endif
33
+
34
+ #endif
@@ -0,0 +1,36 @@
1
+ /*
2
+ * SDF (Self-Describing Format) Software Library
3
+ * Copyright (c) 2012-2016, SDF Development Team
4
+ *
5
+ * Distributed under the terms of the BSD 3-clause License.
6
+ * See the LICENSE file for details.
7
+ */
8
+
9
+ #ifndef _SDF_EXTENSION_H_
10
+ #define _SDF_EXTENSION_H_
11
+
12
+ #include "sdf.h"
13
+
14
+ #define SDF_EXTENSION_VERSION 1
15
+ #define SDF_EXTENSION_REVISION 1
16
+
17
+ typedef struct derived_template_struct derived_template_t;
18
+ typedef struct sdf_extension_struct sdf_extension_t;
19
+
20
+ struct sdf_extension_struct {
21
+ derived_template_t *derived_list;
22
+ int (*read_blocklist)(sdf_extension_t *, sdf_file_t *h);
23
+ int (*timestate_update)(sdf_extension_t *, sdf_file_t *h);
24
+ void (*get_version)(sdf_extension_t *, int *major, int *minor);
25
+ char *(*get_name)(sdf_extension_t *);
26
+ char **(*preload)(sdf_extension_t *, sdf_file_t *);
27
+ char *(*get_commit_id)(sdf_extension_t *);
28
+ char *(*get_commit_date)(sdf_extension_t *);
29
+ char *(*get_info)(sdf_extension_t *);
30
+ };
31
+
32
+ typedef sdf_extension_t *sdf_extension_create_t(sdf_file_t *h);
33
+ typedef void sdf_extension_destroy_t(sdf_extension_t *);
34
+ typedef void sdf_extension_free_t(sdf_file_t *h);
35
+
36
+ #endif
@@ -0,0 +1,46 @@
1
+ /*
2
+ * SDF (Self-Describing Format) Software Library
3
+ * Copyright (c) 2014-2016, SDF Development Team
4
+ *
5
+ * Distributed under the terms of the BSD 3-clause License.
6
+ * See the LICENSE file for details.
7
+ */
8
+
9
+ /**
10
+ @file sdf_helper.h
11
+
12
+ @brief Helper routines for the SDF C-library.
13
+ @details High-level routines for simplifying the use of the SDF library.
14
+ @author Dr Keith Bennett
15
+ @date 19/02/2014
16
+ */
17
+
18
+ #ifndef _SDF_HELPER_H_
19
+ #define _SDF_HELPER_H_
20
+ #include <sdf.h>
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif
25
+
26
+
27
+ /**
28
+ @brief Populate data for and SDF block.
29
+
30
+ This routine does all the work necessary in order to populate
31
+ the data in an SDF block. This includes allocating memory, if
32
+ necessary, reading derived block dependencies and populating
33
+ derived data using callback functions.
34
+
35
+ @param[in] h SDF file handle
36
+ @param[in] b The block whose data will be populated
37
+
38
+ @return 0 on success, 1 on error
39
+ */
40
+ int sdf_helper_read_data(sdf_file_t *h, sdf_block_t *b);
41
+
42
+ #ifdef __cplusplus
43
+ }
44
+ #endif
45
+
46
+ #endif
@@ -0,0 +1,68 @@
1
+ /*
2
+ * SDF (Self-Describing Format) Software Library
3
+ * Copyright (c) 2013-2016, SDF Development Team
4
+ *
5
+ * Distributed under the terms of the BSD 3-clause License.
6
+ * See the LICENSE file for details.
7
+ */
8
+
9
+ #ifndef _SDF_LIST_TYPE_H_
10
+ #define _SDF_LIST_TYPE_H_
11
+ #include <stdlib.h>
12
+
13
+ /* Linked list datatype and helper routines */
14
+
15
+ typedef struct list_type list_t;
16
+
17
+
18
+ struct list_type {
19
+ struct list_entry {
20
+ void *value;
21
+ struct list_entry *next;
22
+ } *head, *tail;
23
+ int count;
24
+ };
25
+
26
+ static void list_init(list_t **lt_ptr)
27
+ {
28
+ list_t *lt = *lt_ptr;
29
+
30
+ *lt_ptr = lt = calloc(1, sizeof(*lt));
31
+ lt->head = lt->tail = calloc(1, sizeof(*(lt->head)));
32
+ }
33
+
34
+ static void list_append(list_t *lt, void *value)
35
+ {
36
+ lt->tail = lt->tail->next = calloc(1, sizeof(*(lt->head)));
37
+ lt->tail->value = value;
38
+ lt->count++;
39
+ }
40
+
41
+ static void *list_start(list_t *lt)
42
+ {
43
+ lt->tail = lt->head->next;
44
+ return (lt->tail?lt->tail->value:NULL);
45
+ }
46
+
47
+ static void *list_next(list_t *lt)
48
+ {
49
+ lt->tail = lt->tail->next;
50
+ return (lt->tail?lt->tail->value:NULL);
51
+ }
52
+
53
+ static void list_destroy(list_t **lt_ptr)
54
+ {
55
+ list_t *lt = *lt_ptr;
56
+ int i;
57
+
58
+ lt->tail = lt->head;
59
+ for (i = 0; i < lt->count+1; i++) {
60
+ lt->head = lt->tail->next;
61
+ free(lt->tail);
62
+ lt->tail = lt->head;
63
+ }
64
+ free(lt);
65
+ *lt_ptr = NULL;
66
+ }
67
+
68
+ #endif
@@ -0,0 +1,68 @@
1
+ /*
2
+ * SDF (Self-Describing Format) Software Library
3
+ * Copyright (c) 2013-2016, SDF Development Team
4
+ *
5
+ * Distributed under the terms of the BSD 3-clause License.
6
+ * See the LICENSE file for details.
7
+ */
8
+
9
+ #ifndef _SDF_VECTOR_TYPE_H_
10
+ #define _SDF_VECTOR_TYPE_H_
11
+ #include <stdlib.h>
12
+ #include <string.h>
13
+
14
+ /* Growable array datatype and helper routines */
15
+
16
+ typedef struct vector_type vector_t;
17
+
18
+ struct vector_type {
19
+ int *data;
20
+ int allocated, size;
21
+ };
22
+
23
+ static vector_t *vector_new(void)
24
+ {
25
+ vector_t *vector;
26
+
27
+ vector = (vector_t*)malloc(sizeof(vector_t));
28
+ vector->allocated = 32;
29
+ vector->size = 0;
30
+ vector->data = (int*)malloc(vector->allocated * sizeof(*vector->data));
31
+
32
+ return vector;
33
+ }
34
+
35
+ static void vector_push_back(vector_t *vector, int val)
36
+ {
37
+ int *data;
38
+
39
+ // Grow vector if necessary
40
+ if (vector->size == vector->allocated) {
41
+ vector->allocated = vector->allocated << 1;
42
+ data = (int*)malloc(vector->allocated * sizeof(*data));
43
+ memcpy(data, vector->data, vector->size * sizeof(*data));
44
+ free(vector->data);
45
+ vector->data = data;
46
+ }
47
+
48
+ vector->data[vector->size++] = val;
49
+ }
50
+
51
+ static void vector_truncate(vector_t *vector)
52
+ {
53
+ int *data;
54
+
55
+ vector->allocated = vector->size;
56
+ data = (int*)malloc(vector->allocated * sizeof(*data));
57
+ memcpy(data, vector->data, vector->size * sizeof(*data));
58
+ free(vector->data);
59
+ vector->data = data;
60
+ }
61
+
62
+ static void vector_free(vector_t *vector)
63
+ {
64
+ free(vector->data);
65
+ free(vector);
66
+ }
67
+
68
+ #endif
@@ -0,0 +1,49 @@
1
+ /*
2
+ * SDF (Self-Describing Format) Software Library
3
+ * Copyright (c) 2014-2016, SDF Development Team
4
+ *
5
+ * Distributed under the terms of the BSD 3-clause License.
6
+ * See the LICENSE file for details.
7
+ */
8
+
9
+ /**
10
+ @internal
11
+ @file stack_allocator.h
12
+
13
+ @brief Declarations for the SDF stack allocator helper routines.
14
+ @details Routines for stack-based memory management.
15
+ @author Dr Keith Bennett
16
+ @date 15/02/2014
17
+ */
18
+
19
+ #ifndef _STACK_ALLOCATOR_H_
20
+ #define _STACK_ALLOCATOR_H_
21
+ #include <sdf.h>
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ typedef struct stack_handle stack_handle_t;
28
+
29
+ void stack_alloc(stack_handle_t *sh, sdf_block_t *b);
30
+ void stack_free_block(stack_handle_t *sh, sdf_block_t *b);
31
+ void stack_push_to_bottom(stack_handle_t *sh, sdf_block_t *b);
32
+ void stack_freeup_memory(stack_handle_t *sh);
33
+ void stack_free(stack_handle_t *sh);
34
+ void stack_destroy(stack_handle_t *sh);
35
+ stack_handle_t *stack_init(void);
36
+
37
+ void sdf_stack_alloc(sdf_file_t *h, sdf_block_t *b);
38
+ void sdf_stack_free_block(sdf_file_t *h, sdf_block_t *b);
39
+ void sdf_stack_push_to_bottom(sdf_file_t *h, sdf_block_t *b);
40
+ void sdf_stack_freeup_memory(sdf_file_t *h);
41
+ void sdf_stack_free(sdf_file_t *h);
42
+ void sdf_stack_destroy(sdf_file_t *h);
43
+ void sdf_stack_init(sdf_file_t *h);
44
+
45
+ #ifdef __cplusplus
46
+ }
47
+ #endif
48
+
49
+ #endif