1*c08cbc64SXin LI/* 2*c08cbc64SXin LI * divsufsort@W64BIT@.h for libdivsufsort@W64BIT@ 3*c08cbc64SXin LI * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. 4*c08cbc64SXin LI * 5*c08cbc64SXin LI * Permission is hereby granted, free of charge, to any person 6*c08cbc64SXin LI * obtaining a copy of this software and associated documentation 7*c08cbc64SXin LI * files (the "Software"), to deal in the Software without 8*c08cbc64SXin LI * restriction, including without limitation the rights to use, 9*c08cbc64SXin LI * copy, modify, merge, publish, distribute, sublicense, and/or sell 10*c08cbc64SXin LI * copies of the Software, and to permit persons to whom the 11*c08cbc64SXin LI * Software is furnished to do so, subject to the following 12*c08cbc64SXin LI * conditions: 13*c08cbc64SXin LI * 14*c08cbc64SXin LI * The above copyright notice and this permission notice shall be 15*c08cbc64SXin LI * included in all copies or substantial portions of the Software. 16*c08cbc64SXin LI * 17*c08cbc64SXin LI * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18*c08cbc64SXin LI * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19*c08cbc64SXin LI * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20*c08cbc64SXin LI * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21*c08cbc64SXin LI * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22*c08cbc64SXin LI * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23*c08cbc64SXin LI * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24*c08cbc64SXin LI * OTHER DEALINGS IN THE SOFTWARE. 25*c08cbc64SXin LI */ 26*c08cbc64SXin LI 27*c08cbc64SXin LI#ifndef _DIVSUFSORT@W64BIT@_H 28*c08cbc64SXin LI#define _DIVSUFSORT@W64BIT@_H 1 29*c08cbc64SXin LI 30*c08cbc64SXin LI#ifdef __cplusplus 31*c08cbc64SXin LIextern "C" { 32*c08cbc64SXin LI#endif /* __cplusplus */ 33*c08cbc64SXin LI 34*c08cbc64SXin LI@INCFILE@ 35*c08cbc64SXin LI 36*c08cbc64SXin LI#ifndef DIVSUFSORT_API 37*c08cbc64SXin LI# ifdef DIVSUFSORT_BUILD_DLL 38*c08cbc64SXin LI# define DIVSUFSORT_API @DIVSUFSORT_EXPORT@ 39*c08cbc64SXin LI# else 40*c08cbc64SXin LI# define DIVSUFSORT_API @DIVSUFSORT_IMPORT@ 41*c08cbc64SXin LI# endif 42*c08cbc64SXin LI#endif 43*c08cbc64SXin LI 44*c08cbc64SXin LI/*- Datatypes -*/ 45*c08cbc64SXin LI#ifndef SAUCHAR_T 46*c08cbc64SXin LI#define SAUCHAR_T 47*c08cbc64SXin LItypedef @SAUCHAR_TYPE@ sauchar_t; 48*c08cbc64SXin LI#endif /* SAUCHAR_T */ 49*c08cbc64SXin LI#ifndef SAINT_T 50*c08cbc64SXin LI#define SAINT_T 51*c08cbc64SXin LItypedef @SAINT32_TYPE@ saint_t; 52*c08cbc64SXin LI#endif /* SAINT_T */ 53*c08cbc64SXin LI#ifndef SAIDX@W64BIT@_T 54*c08cbc64SXin LI#define SAIDX@W64BIT@_T 55*c08cbc64SXin LItypedef @SAINDEX_TYPE@ saidx@W64BIT@_t; 56*c08cbc64SXin LI#endif /* SAIDX@W64BIT@_T */ 57*c08cbc64SXin LI#ifndef PRIdSAINT_T 58*c08cbc64SXin LI#define PRIdSAINT_T @SAINT_PRId@ 59*c08cbc64SXin LI#endif /* PRIdSAINT_T */ 60*c08cbc64SXin LI#ifndef PRIdSAIDX@W64BIT@_T 61*c08cbc64SXin LI#define PRIdSAIDX@W64BIT@_T @SAINDEX_PRId@ 62*c08cbc64SXin LI#endif /* PRIdSAIDX@W64BIT@_T */ 63*c08cbc64SXin LI 64*c08cbc64SXin LI 65*c08cbc64SXin LI/*- Prototypes -*/ 66*c08cbc64SXin LI 67*c08cbc64SXin LI/** 68*c08cbc64SXin LI * Constructs the suffix array of a given string. 69*c08cbc64SXin LI * @param T[0..n-1] The input string. 70*c08cbc64SXin LI * @param SA[0..n-1] The output array of suffixes. 71*c08cbc64SXin LI * @param n The length of the given string. 72*c08cbc64SXin LI * @return 0 if no error occurred, -1 or -2 otherwise. 73*c08cbc64SXin LI */ 74*c08cbc64SXin LIDIVSUFSORT_API 75*c08cbc64SXin LIsaint_t 76*c08cbc64SXin LIdivsufsort@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t *SA, saidx@W64BIT@_t n); 77*c08cbc64SXin LI 78*c08cbc64SXin LI/** 79*c08cbc64SXin LI * Constructs the burrows-wheeler transformed string of a given string. 80*c08cbc64SXin LI * @param T[0..n-1] The input string. 81*c08cbc64SXin LI * @param U[0..n-1] The output string. (can be T) 82*c08cbc64SXin LI * @param A[0..n-1] The temporary array. (can be NULL) 83*c08cbc64SXin LI * @param n The length of the given string. 84*c08cbc64SXin LI * @return The primary index if no error occurred, -1 or -2 otherwise. 85*c08cbc64SXin LI */ 86*c08cbc64SXin LIDIVSUFSORT_API 87*c08cbc64SXin LIsaidx@W64BIT@_t 88*c08cbc64SXin LIdivbwt@W64BIT@(const sauchar_t *T, sauchar_t *U, saidx@W64BIT@_t *A, saidx@W64BIT@_t n); 89*c08cbc64SXin LI 90*c08cbc64SXin LI/** 91*c08cbc64SXin LI * Returns the version of the divsufsort library. 92*c08cbc64SXin LI * @return The version number string. 93*c08cbc64SXin LI */ 94*c08cbc64SXin LIDIVSUFSORT_API 95*c08cbc64SXin LIconst char * 96*c08cbc64SXin LIdivsufsort@W64BIT@_version(void); 97*c08cbc64SXin LI 98*c08cbc64SXin LI 99*c08cbc64SXin LI/** 100*c08cbc64SXin LI * Constructs the burrows-wheeler transformed string of a given string and suffix array. 101*c08cbc64SXin LI * @param T[0..n-1] The input string. 102*c08cbc64SXin LI * @param U[0..n-1] The output string. (can be T) 103*c08cbc64SXin LI * @param SA[0..n-1] The suffix array. (can be NULL) 104*c08cbc64SXin LI * @param n The length of the given string. 105*c08cbc64SXin LI * @param idx The output primary index. 106*c08cbc64SXin LI * @return 0 if no error occurred, -1 or -2 otherwise. 107*c08cbc64SXin LI */ 108*c08cbc64SXin LIDIVSUFSORT_API 109*c08cbc64SXin LIsaint_t 110*c08cbc64SXin LIbw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U, 111*c08cbc64SXin LI saidx@W64BIT@_t *SA /* can NULL */, 112*c08cbc64SXin LI saidx@W64BIT@_t n, saidx@W64BIT@_t *idx); 113*c08cbc64SXin LI 114*c08cbc64SXin LI/** 115*c08cbc64SXin LI * Inverse BW-transforms a given BWTed string. 116*c08cbc64SXin LI * @param T[0..n-1] The input string. 117*c08cbc64SXin LI * @param U[0..n-1] The output string. (can be T) 118*c08cbc64SXin LI * @param A[0..n-1] The temporary array. (can be NULL) 119*c08cbc64SXin LI * @param n The length of the given string. 120*c08cbc64SXin LI * @param idx The primary index. 121*c08cbc64SXin LI * @return 0 if no error occurred, -1 or -2 otherwise. 122*c08cbc64SXin LI */ 123*c08cbc64SXin LIDIVSUFSORT_API 124*c08cbc64SXin LIsaint_t 125*c08cbc64SXin LIinverse_bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U, 126*c08cbc64SXin LI saidx@W64BIT@_t *A /* can NULL */, 127*c08cbc64SXin LI saidx@W64BIT@_t n, saidx@W64BIT@_t idx); 128*c08cbc64SXin LI 129*c08cbc64SXin LI/** 130*c08cbc64SXin LI * Checks the correctness of a given suffix array. 131*c08cbc64SXin LI * @param T[0..n-1] The input string. 132*c08cbc64SXin LI * @param SA[0..n-1] The input suffix array. 133*c08cbc64SXin LI * @param n The length of the given string. 134*c08cbc64SXin LI * @param verbose The verbose mode. 135*c08cbc64SXin LI * @return 0 if no error occurred. 136*c08cbc64SXin LI */ 137*c08cbc64SXin LIDIVSUFSORT_API 138*c08cbc64SXin LIsaint_t 139*c08cbc64SXin LIsufcheck@W64BIT@(const sauchar_t *T, const saidx@W64BIT@_t *SA, saidx@W64BIT@_t n, saint_t verbose); 140*c08cbc64SXin LI 141*c08cbc64SXin LI/** 142*c08cbc64SXin LI * Search for the pattern P in the string T. 143*c08cbc64SXin LI * @param T[0..Tsize-1] The input string. 144*c08cbc64SXin LI * @param Tsize The length of the given string. 145*c08cbc64SXin LI * @param P[0..Psize-1] The input pattern string. 146*c08cbc64SXin LI * @param Psize The length of the given pattern string. 147*c08cbc64SXin LI * @param SA[0..SAsize-1] The input suffix array. 148*c08cbc64SXin LI * @param SAsize The length of the given suffix array. 149*c08cbc64SXin LI * @param idx The output index. 150*c08cbc64SXin LI * @return The count of matches if no error occurred, -1 otherwise. 151*c08cbc64SXin LI */ 152*c08cbc64SXin LIDIVSUFSORT_API 153*c08cbc64SXin LIsaidx@W64BIT@_t 154*c08cbc64SXin LIsa_search@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize, 155*c08cbc64SXin LI const sauchar_t *P, saidx@W64BIT@_t Psize, 156*c08cbc64SXin LI const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize, 157*c08cbc64SXin LI saidx@W64BIT@_t *left); 158*c08cbc64SXin LI 159*c08cbc64SXin LI/** 160*c08cbc64SXin LI * Search for the character c in the string T. 161*c08cbc64SXin LI * @param T[0..Tsize-1] The input string. 162*c08cbc64SXin LI * @param Tsize The length of the given string. 163*c08cbc64SXin LI * @param SA[0..SAsize-1] The input suffix array. 164*c08cbc64SXin LI * @param SAsize The length of the given suffix array. 165*c08cbc64SXin LI * @param c The input character. 166*c08cbc64SXin LI * @param idx The output index. 167*c08cbc64SXin LI * @return The count of matches if no error occurred, -1 otherwise. 168*c08cbc64SXin LI */ 169*c08cbc64SXin LIDIVSUFSORT_API 170*c08cbc64SXin LIsaidx@W64BIT@_t 171*c08cbc64SXin LIsa_simplesearch@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize, 172*c08cbc64SXin LI const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize, 173*c08cbc64SXin LI saint_t c, saidx@W64BIT@_t *left); 174*c08cbc64SXin LI 175*c08cbc64SXin LI 176*c08cbc64SXin LI#ifdef __cplusplus 177*c08cbc64SXin LI} /* extern "C" */ 178*c08cbc64SXin LI#endif /* __cplusplus */ 179*c08cbc64SXin LI 180*c08cbc64SXin LI#endif /* _DIVSUFSORT@W64BIT@_H */ 181