ucx/ucx.h

changeset 152
62921b370c60
parent 124
80609f9675f1
equal deleted inserted replaced
151:11f3bb408051 152:62921b370c60
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2015 Olaf Wintermann. All rights reserved. 4 * Copyright 2016 Olaf Wintermann. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
38 38
39 /** Major UCX version as integer constant. */ 39 /** Major UCX version as integer constant. */
40 #define UCX_VERSION_MAJOR 0 40 #define UCX_VERSION_MAJOR 0
41 41
42 /** Minor UCX version as integer constant. */ 42 /** Minor UCX version as integer constant. */
43 #define UCX_VERSION_MINOR 9 43 #define UCX_VERSION_MINOR 12
44
45 /** The UCX version in format [major].[minor] */
46 #define UCX_VERSION UCX_VERSION_MAJOR.UCX_VERSION_MINOR
47 44
48 #include <stdlib.h> 45 #include <stdlib.h>
46 #include <stdint.h>
49 47
50 #ifdef _WIN32 48 #ifdef _WIN32
51 #if !(defined __ssize_t_defined || defined _SSIZE_T_) 49 #if !(defined __ssize_t_defined || defined _SSIZE_T_)
52 #include <BaseTsd.h> 50 #include <BaseTsd.h>
53 typedef SSIZE_T ssize_t; 51 typedef SSIZE_T ssize_t;
87 * The function shall then return -1 if the first argument is less than the 85 * The function shall then return -1 if the first argument is less than the
88 * second argument, 1 if the first argument is greater than the second argument 86 * second argument, 1 if the first argument is greater than the second argument
89 * and 0 if both arguments are equal. If the third argument is 87 * and 0 if both arguments are equal. If the third argument is
90 * <code>NULL</code>, it shall be ignored. 88 * <code>NULL</code>, it shall be ignored.
91 */ 89 */
92 typedef int(*cmp_func)(void*,void*,void*); 90 typedef int(*cmp_func)(const void*,const void*,void*);
91
92 /**
93 * Function pointer to a distance function.
94 *
95 * The distance function shall take three arguments: the two values for which
96 * the distance shall be computed and optional additional data.
97 * The function shall then return the signed distance as integer value.
98 */
99 typedef intmax_t(*distance_func)(const void*,const void*,void*);
93 100
94 /** 101 /**
95 * Function pointer to a copy function. 102 * Function pointer to a copy function.
96 * 103 *
97 * The copy function shall create a copy of the first argument and may use 104 * The copy function shall create a copy of the first argument and may use
100 107
101 * <b>Attention:</b> if pointers returned by functions of this type may be 108 * <b>Attention:</b> if pointers returned by functions of this type may be
102 * passed to <code>free()</code> depends on the implementation of the 109 * passed to <code>free()</code> depends on the implementation of the
103 * respective <code>copy_func</code>. 110 * respective <code>copy_func</code>.
104 */ 111 */
105 typedef void*(*copy_func)(void*,void*); 112 typedef void*(*copy_func)(const void*,void*);
106 113
107 /** 114 /**
108 * Function pointer to a write function. 115 * Function pointer to a write function.
109 * 116 *
110 * The signature of the write function shall be compatible to the signature 117 * The signature of the write function shall be compatible to the signature

mercurial