Skip to content

Commit

Permalink
Added ksa.h for ksa.
Browse files Browse the repository at this point in the history
  • Loading branch information
KOLANICH committed Feb 2, 2022
1 parent 4263b7c commit e6b644e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
4 changes: 2 additions & 2 deletions C/ksa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ buildAndPackageLib("ksa32"
COMPONENT "ksa32"
DESCRIPTION "${PROJECT_DESCRIPTION}\n\n${DESCR}\n\nUses 32-bit integers."
CMAKE_EXPORT_NAMESPACE "${PROJECT_NAME}"
PUBLIC_INCLUDES "${CMAKE_CURRENT_LIST_DIR}"
PUBLIC_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/ksa32.h"
INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
)

buildAndPackageLib("ksa64"
COMPONENT "ksa64"
DESCRIPTION "${PROJECT_DESCRIPTION}\n\n${DESCR}\n\nUses 64-bit integers."
CMAKE_EXPORT_NAMESPACE "${PROJECT_NAME}"
PUBLIC_INCLUDES "${CMAKE_CURRENT_LIST_DIR}"
PUBLIC_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/ksa64.h"
INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
)

Expand Down
30 changes: 30 additions & 0 deletions C/ksa/ksa32.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

int ksa_bwt(unsigned char *T, int n, int k);

/**
* Recursively construct the suffix array for a string containing multiple
* sentinels. NULL is taken as the sentinel.
*
* @param T NULL terminated input string (there can be multiple NULLs)
* @param SA output suffix array
* @param fs working space available in SA (typically 0 when first called)
* @param n length of T, including the trailing NULL
* @param k size of the alphabet (typically 256 when first called)
* @param cs # bytes per element in T; 1 or sizeof(saint_t) (typically 1 when first called)
*
* @return 0 upon success
*/
int ksa_core(unsigned char const *T, int *SA, int fs, int n, int k, int cs);

/**
* Construct the suffix array for a NULL terminated string possibly containing
* multiple sentinels (NULLs).
*
* @param T[0..n-1] NULL terminated input string
* @param SA[0..n-1] output suffix array
* @param n length of the given string, including NULL
* @param k size of the alphabet including the sentinel; no more than 256
* @return 0 upon success
*/
int ksa_sa(unsigned char const *T, int *SA, int n, int k);
30 changes: 30 additions & 0 deletions C/ksa/ksa64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

int ksa_bwt64(unsigned char *T, long int n, int k);

/**
* Recursively construct the suffix array for a string containing multiple
* sentinels. NULL is taken as the sentinel.
*
* @param T NULL terminated input string (there can be multiple NULLs)
* @param SA output suffix array
* @param fs working space available in SA (typically 0 when first called)
* @param n length of T, including the trailing NULL
* @param k size of the alphabet (typically 256 when first called)
* @param cs # bytes per element in T; 1 or sizeof(saint_t) (typically 1 when first called)
*
* @return 0 upon success
*/
int ksa_core64(unsigned char const *T, long int *SA, long int fs, long int n, long int k, int cs);

/**
* Construct the suffix array for a NULL terminated string possibly containing
* multiple sentinels (NULLs).
*
* @param T[0..n-1] NULL terminated input string
* @param SA[0..n-1] output suffix array
* @param n length of the given string, including NULL
* @param k size of the alphabet including the sentinel; no more than 256
* @return 0 upon success
*/
int ksa_sa64(unsigned char const *T, long int *SA, long int n, int k);

0 comments on commit e6b644e

Please sign in to comment.