Browse Source

feat: all_cases export api

master
Dnomd343 2 years ago
parent
commit
0dd562ab4a
  1. 2
      src/klotski/CMakeLists.txt
  2. 23
      src/klotski/ffi/all_cases.cc
  3. 20
      src/klotski/ffi/klotski.h
  4. 2
      src/main.c

2
src/klotski/CMakeLists.txt

@ -63,7 +63,7 @@ add_subdirectory(benchmark)
################################################################################
set(FFI_SRC codec.cc tmain.cc version.cc)
set(FFI_SRC codec.cc all_cases.cc tmain.cc version.cc)
list(TRANSFORM FFI_SRC PREPEND "ffi/")
add_library(klotski-ffi OBJECT ${FFI_SRC})

23
src/klotski/ffi/all_cases.cc

@ -0,0 +1,23 @@
#include "klotski.h"
#include "all_cases.h"
using klotski::AllCases;
using klotski::BasicRanges;
using klotski::BASIC_RANGES_SIZE;
using klotski::ALL_CASES_SIZE_SUM;
void all_cases_build() {
AllCases::build();
}
void basic_ranges_build() {
BasicRanges::build();
}
bool is_all_cases_available() {
return AllCases::status() == AllCases::AVAILABLE;
}
bool is_basic_ranges_available() {
return BasicRanges::status() == BasicRanges::AVAILABLE;
}

20
src/klotski/ffi/klotski.h

@ -38,6 +38,25 @@ extern "C" {
}
#endif
/// ------------------------------- klotski all cases export --------------------------------
#ifdef __cplusplus
extern "C" {
#endif
extern void all_cases_build();
extern void basic_ranges_build();
extern bool is_all_cases_available();
extern bool is_basic_ranges_available();
extern const uint32_t all_cases_size;
extern void export_all_cases(uint64_t *buffer);
extern const uint32_t basic_ranges_size;
extern void export_basic_ranges(uint32_t *buffer);
#ifdef __cplusplus
}
#endif
/// -------------------------------- klotski codec interface --------------------------------
#ifdef __cplusplus
@ -70,7 +89,6 @@ extern "C" {
extern bool common_code_to_string(uint64_t common_code, char common_code_str[]);
extern bool common_code_to_string_shorten(uint64_t common_code, char common_code_str[]);
extern bool common_code_from_string(const char common_code_str[], uint64_t *common_code);
#ifdef __cplusplus
}
#endif

2
src/main.c

@ -4,7 +4,7 @@
int main() {
// printf("cli boot\n");
tmain();
// tmain();
return 0;
// bool ret = common_code_check(0x1A9BF0C00);

Loading…
Cancel
Save