2 * divsufsort@W64BIT@.h for libdivsufsort@W64BIT@
3 * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef _DIVSUFSORT@W64BIT@_H
28 #define _DIVSUFSORT@W64BIT@_H 1
32 #endif /* __cplusplus */
36 #ifndef DIVSUFSORT_API
37 # ifdef DIVSUFSORT_BUILD_DLL
38 # define DIVSUFSORT_API @DIVSUFSORT_EXPORT@
40 # define DIVSUFSORT_API @DIVSUFSORT_IMPORT@
47 typedef @SAUCHAR_TYPE@ sauchar_t;
48 #endif /* SAUCHAR_T */
51 typedef @SAINT32_TYPE@ saint_t;
53 #ifndef SAIDX@W64BIT@_T
54 #define SAIDX@W64BIT@_T
55 typedef @SAINDEX_TYPE@ saidx@W64BIT@_t;
56 #endif /* SAIDX@W64BIT@_T */
58 #define PRIdSAINT_T @SAINT_PRId@
59 #endif /* PRIdSAINT_T */
60 #ifndef PRIdSAIDX@W64BIT@_T
61 #define PRIdSAIDX@W64BIT@_T @SAINDEX_PRId@
62 #endif /* PRIdSAIDX@W64BIT@_T */
68 * Constructs the suffix array of a given string.
69 * @param T[0..n-1] The input string.
70 * @param SA[0..n-1] The output array of suffixes.
71 * @param n The length of the given string.
72 * @return 0 if no error occurred, -1 or -2 otherwise.
76 divsufsort@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t *SA, saidx@W64BIT@_t n);
79 * Constructs the burrows-wheeler transformed string of a given string.
80 * @param T[0..n-1] The input string.
81 * @param U[0..n-1] The output string. (can be T)
82 * @param A[0..n-1] The temporary array. (can be NULL)
83 * @param n The length of the given string.
84 * @return The primary index if no error occurred, -1 or -2 otherwise.
88 divbwt@W64BIT@(const sauchar_t *T, sauchar_t *U, saidx@W64BIT@_t *A, saidx@W64BIT@_t n);
91 * Returns the version of the divsufsort library.
92 * @return The version number string.
96 divsufsort@W64BIT@_version(void);
100 * Constructs the burrows-wheeler transformed string of a given string and suffix array.
101 * @param T[0..n-1] The input string.
102 * @param U[0..n-1] The output string. (can be T)
103 * @param SA[0..n-1] The suffix array. (can be NULL)
104 * @param n The length of the given string.
105 * @param idx The output primary index.
106 * @return 0 if no error occurred, -1 or -2 otherwise.
110 bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U,
111 saidx@W64BIT@_t *SA /* can NULL */,
112 saidx@W64BIT@_t n, saidx@W64BIT@_t *idx);
115 * Inverse BW-transforms a given BWTed string.
116 * @param T[0..n-1] The input string.
117 * @param U[0..n-1] The output string. (can be T)
118 * @param A[0..n-1] The temporary array. (can be NULL)
119 * @param n The length of the given string.
120 * @param idx The primary index.
121 * @return 0 if no error occurred, -1 or -2 otherwise.
125 inverse_bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U,
126 saidx@W64BIT@_t *A /* can NULL */,
127 saidx@W64BIT@_t n, saidx@W64BIT@_t idx);
130 * Checks the correctness of a given suffix array.
131 * @param T[0..n-1] The input string.
132 * @param SA[0..n-1] The input suffix array.
133 * @param n The length of the given string.
134 * @param verbose The verbose mode.
135 * @return 0 if no error occurred.
139 sufcheck@W64BIT@(const sauchar_t *T, const saidx@W64BIT@_t *SA, saidx@W64BIT@_t n, saint_t verbose);
142 * Search for the pattern P in the string T.
143 * @param T[0..Tsize-1] The input string.
144 * @param Tsize The length of the given string.
145 * @param P[0..Psize-1] The input pattern string.
146 * @param Psize The length of the given pattern string.
147 * @param SA[0..SAsize-1] The input suffix array.
148 * @param SAsize The length of the given suffix array.
149 * @param idx The output index.
150 * @return The count of matches if no error occurred, -1 otherwise.
154 sa_search@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize,
155 const sauchar_t *P, saidx@W64BIT@_t Psize,
156 const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize,
157 saidx@W64BIT@_t *left);
160 * Search for the character c in the string T.
161 * @param T[0..Tsize-1] The input string.
162 * @param Tsize The length of the given string.
163 * @param SA[0..SAsize-1] The input suffix array.
164 * @param SAsize The length of the given suffix array.
165 * @param c The input character.
166 * @param idx The output index.
167 * @return The count of matches if no error occurred, -1 otherwise.
171 sa_simplesearch@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize,
172 const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize,
173 saint_t c, saidx@W64BIT@_t *left);
178 #endif /* __cplusplus */
180 #endif /* _DIVSUFSORT@W64BIT@_H */