Windows porting: port hyperscan and chimera tools to windows.

This commit is contained in:
Lu, Qi
2018-05-08 12:05:44 -04:00
committed by Wang, Xiang W
parent bf87f8c003
commit 5a0885d235
34 changed files with 563 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2017, Intel Corporation
* Copyright (c) 2015-2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -305,9 +305,10 @@ public:
}
/// Bitwise OR.
bitfield operator|(bitfield a) const {
a |= *this;
return a;
bitfield operator|(const bitfield &a) const {
bitfield b = a;
b |= *this;
return b;
}
/// Bitwise OR-equals.
@@ -325,9 +326,10 @@ public:
}
/// Bitwise AND.
bitfield operator&(bitfield a) const {
a &= *this;
return a;
bitfield operator&(const bitfield &a) const {
bitfield b = a;
b &= *this;
return b;
}
/// Bitwise AND-equals.

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2017, Intel Corporation
* Copyright (c) 2015-2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -56,7 +56,11 @@ void describeChar(ostream &os, char c, enum cc_output_t out_type) {
const string backslash((out_type == CC_OUT_DOT ? 2 : 1), '\\');
#ifdef _WIN32
if (c >= 0x21 && c < 0x7F && c != '\\') {
#else
if (isgraph(c) && c != '\\') {
#endif
if (escaped.find(c) != string::npos) {
os << backslash << c;
} else if (out_type == CC_OUT_DOT

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016, Intel Corporation
* Copyright (c) 2015-2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -1197,7 +1197,11 @@ u32 mmbit_sparse_iter_begin(const u8 *bits, u32 total_bits, u32 *idx,
assert(ISALIGNED_N(it_root, alignof(struct mmbit_sparse_iter)));
// Our state _may_ be on the stack
#ifndef _WIN32
assert(ISALIGNED_N(s, alignof(struct mmbit_sparse_state)));
#else
assert(ISALIGNED_N(s, 4));
#endif
MDEBUG_PRINTF("%p total_bits %u\n", bits, total_bits);
// iterator should have _something_ at the root level
@@ -1305,7 +1309,11 @@ u32 mmbit_sparse_iter_next(const u8 *bits, u32 total_bits, u32 last_key,
assert(ISALIGNED_N(it_root, alignof(struct mmbit_sparse_iter)));
// Our state _may_ be on the stack
#ifndef _WIN32
assert(ISALIGNED_N(s, alignof(struct mmbit_sparse_state)));
#else
assert(ISALIGNED_N(s, 4));
#endif
MDEBUG_PRINTF("%p total_bits %u\n", bits, total_bits);
MDEBUG_PRINTF("NEXT (total_bits=%u, last_key=%u)\n", total_bits, last_key);
@@ -1458,7 +1466,11 @@ void mmbit_sparse_iter_unset(u8 *bits, u32 total_bits,
assert(ISALIGNED_N(it, alignof(struct mmbit_sparse_iter)));
// Our state _may_ be on the stack
#ifndef _WIN32
assert(ISALIGNED_N(s, alignof(struct mmbit_sparse_state)));
#else
assert(ISALIGNED_N(s, 4));
#endif
MDEBUG_PRINTF("%p total_bits %u\n", bits, total_bits);

View File

@@ -46,7 +46,7 @@ using namespace std;
namespace ue2 {
u32 HS_CDECL mmbit_size(u32 total_bits) {
u32 mmbit_size(u32 total_bits) {
if (total_bits > MMB_MAX_BITS) {
throw ResourceLimitError();
}

View File

@@ -63,10 +63,8 @@ namespace ue2 {
*
* This will throw a resource limit assertion if the requested mmbit is too
* large.
*
* TODO:add temporary HS_CDECL for chimera on Windows, need improve this.
*/
u32 HS_CDECL mmbit_size(u32 total_bits);
u32 mmbit_size(u32 total_bits);
/** \brief Construct a sparse iterator over the values in \a bits for a
* multibit of size \a total_bits. */