Skip to content

Commit

Permalink
feat(api): provide a flavor of api using stdbool
Browse files Browse the repository at this point in the history
API type: RimeApi_stdbool
API entry function: rime_get_api_stdbool
  • Loading branch information
lotem committed May 19, 2024
1 parent 67d245b commit b1cbc30
Show file tree
Hide file tree
Showing 10 changed files with 1,550 additions and 1,420 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ install(FILES cmake/RimeConfig.cmake
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/cmake/rime)

file(GLOB rime_public_header_files ${PROJECT_SOURCE_DIR}/src/*.h)
list(FILTER rime_public_header_files EXCLUDE REGEX .*_impl\.h$)
install(FILES ${rime_public_header_files}
DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR})
if(INSTALL_PRIVATE_HEADERS)
Expand Down
20 changes: 8 additions & 12 deletions src/rime/setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,27 @@ RIME_API void LoadModules(const char* module_names[]) {
}
}

// assume member is a non-null pointer in struct *p.
#define PROVIDED(p, member) \
((p) && RIME_STRUCT_HAS_MEMBER(*(p), (p)->member) && (p)->member)

RIME_API void SetupDeployer(RimeTraits* traits) {
if (!traits)
return;
Deployer& deployer(Service::instance().deployer());
if (PROVIDED(traits, shared_data_dir))
if (RIME_PROVIDED(traits, shared_data_dir))
deployer.shared_data_dir = path(traits->shared_data_dir);
if (PROVIDED(traits, user_data_dir))
if (RIME_PROVIDED(traits, user_data_dir))
deployer.user_data_dir = path(traits->user_data_dir);
if (PROVIDED(traits, distribution_name))
if (RIME_PROVIDED(traits, distribution_name))
deployer.distribution_name = traits->distribution_name;
if (PROVIDED(traits, distribution_code_name))
if (RIME_PROVIDED(traits, distribution_code_name))
deployer.distribution_code_name = traits->distribution_code_name;
if (PROVIDED(traits, distribution_version))
if (RIME_PROVIDED(traits, distribution_version))
deployer.distribution_version = traits->distribution_version;
if (PROVIDED(traits, app_name))
if (RIME_PROVIDED(traits, app_name))
deployer.app_name = traits->app_name;
if (PROVIDED(traits, prebuilt_data_dir))
if (RIME_PROVIDED(traits, prebuilt_data_dir))
deployer.prebuilt_data_dir = path(traits->prebuilt_data_dir);
else
deployer.prebuilt_data_dir = deployer.shared_data_dir / "build";
if (PROVIDED(traits, staging_dir))
if (RIME_PROVIDED(traits, staging_dir))
deployer.staging_dir = path(traits->staging_dir);
else
deployer.staging_dir = deployer.user_data_dir / "build";
Expand Down
Loading

0 comments on commit b1cbc30

Please sign in to comment.