-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2bdfcd
commit 9d2f3f0
Showing
15 changed files
with
484 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "ib-pinyin-c" | ||
edition = "2021" | ||
version.workspace = true | ||
authors.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
license.workspace = true | ||
keywords.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
crate-type = ["staticlib", "cdylib"] | ||
|
||
[dependencies] | ||
diplomat = "0.7.0" | ||
diplomat-runtime = "0.7.0" | ||
ib-pinyin = { path = "../..", features = ["minimal"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# IbPinyinLib.C | ||
```sh | ||
diplomat-tool c bindings/c/include/ib_pinyin -e bindings/c/src/lib.rs | ||
``` | ||
|
||
Manually update: `notation.h` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vs/ | ||
|
||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# CMakeList.txt : CMake project for cmake, include source and define | ||
# project specific logic here. | ||
# | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
project("cmake") | ||
|
||
# Add source to this project's executable. | ||
add_executable(cmake "main.c") | ||
|
||
target_include_directories(cmake PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include) | ||
|
||
# target_link_libraries(cmake PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../../target/debug/ib_pinyin_c.lib) | ||
target_link_libraries(cmake PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../../target/debug/ib_pinyin_c.dll.lib) | ||
add_custom_command(TARGET cmake POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../target/debug/ib_pinyin_c.dll" | ||
$<TARGET_FILE_DIR:cmake>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"version": 3, | ||
"configurePresets": [ | ||
{ | ||
"name": "windows-base", | ||
"hidden": true, | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/out/build/${presetName}", | ||
"installDir": "${sourceDir}/out/install/${presetName}", | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "cl.exe", | ||
"CMAKE_CXX_COMPILER": "cl.exe" | ||
}, | ||
"condition": { | ||
"type": "equals", | ||
"lhs": "${hostSystemName}", | ||
"rhs": "Windows" | ||
} | ||
}, | ||
{ | ||
"name": "x64-debug", | ||
"displayName": "x64 Debug", | ||
"inherits": "windows-base", | ||
"architecture": { | ||
"value": "x64", | ||
"strategy": "external" | ||
}, | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug" | ||
} | ||
}, | ||
{ | ||
"name": "x64-release", | ||
"displayName": "x64 Release", | ||
"inherits": "x64-debug", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Release" | ||
} | ||
}, | ||
{ | ||
"name": "x86-debug", | ||
"displayName": "x86 Debug", | ||
"inherits": "windows-base", | ||
"architecture": { | ||
"value": "x86", | ||
"strategy": "external" | ||
}, | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug" | ||
} | ||
}, | ||
{ | ||
"name": "x86-release", | ||
"displayName": "x86 Release", | ||
"inherits": "x86-debug", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Release" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <ib_pinyin/ib_pinyin.h> | ||
#include <ib_pinyin/notation.h> | ||
|
||
int main() | ||
{ | ||
const char *pattern = u8"pysousuoeve"; | ||
const char *haystack = u8"拼音搜索Everything"; | ||
// 0x3 | ||
const PinyinNotation notations = PINYIN_NOTATION_ASCII_FIRST_LETTER | PINYIN_NOTATION_ASCII; | ||
|
||
printf("%d\n", ib_pinyin_is_match_u8(pattern, strlen(pattern), haystack, strlen(haystack), notations)); | ||
|
||
printf("%d\n", ib_pinyin_is_match_u8c(pattern, haystack, notations)); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.