-
-
Notifications
You must be signed in to change notification settings - Fork 751
Open
Labels
Description
Something is broken with Hyperscan build. The following code doesn't work.
import static org.bytedeco.hyperscan.global.hyperscan.HS_FLAG_UCP;
import org.bytedeco.hyperscan.hs_compile_error_t;
import org.bytedeco.hyperscan.hs_database_t;
import static org.bytedeco.hyperscan.global.hyperscan.HS_FLAG_UTF8;
import static org.bytedeco.hyperscan.global.hyperscan.HS_MODE_BLOCK;
import static org.bytedeco.hyperscan.global.hyperscan.hs_compile;
public class Sample {
public static void main(String[] args) {
String[] patterns = {"ok.*", "not ok кириллица.*"};
for (var pattern : patterns) {
try (var db = new hs_database_t();
var err = new hs_compile_error_t()) {
var code = hs_compile(pattern, HS_FLAG_UTF8 | HS_FLAG_UCP, HS_MODE_BLOCK, null, db, err);
var errMsg = "";
if (!err.isNull()) {
errMsg = err.message().getString();
}
System.out.printf("Word: '%s'; retcode '%d'; message '%s' %n", pattern, code, errMsg);
}
}
}
}
Output:
Word: 'ok.*'; retcode '0'; message ''
Word: 'not ok кириллица.*'; retcode '-4'; message 'Expression is not valid UTF-8.'
Meanwhile, https://github.com/gliwka/hyperscan-java binaries work as expected