Skip to content

Commit

Permalink
added wasm for blingfire, removed old pregenerated VC projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Alonichau committed Aug 1, 2020
1 parent 2bb33e6 commit eba488c
Show file tree
Hide file tree
Showing 67 changed files with 436 additions and 3,993 deletions.
5 changes: 5 additions & 0 deletions blingfireclient.library/inc/FAConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
#define HANDLE void*
#endif

#include <stdint.h>

/* because we have stdint.h
#ifndef __int32
#define __int32 int32_t
#endif
Expand All @@ -96,6 +99,8 @@
#ifndef uint8_t
#define uint8_t u_int8_t
#endif
*/


#ifndef __fallthrough
#define __fallthrough
Expand Down
57 changes: 49 additions & 8 deletions blingfiretools/blingfiretokdll/blingfiretokdll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,20 +782,15 @@ const int TextToHashes(const char * pInUtf8Str, int InUtf8StrByteCount, int32_t


//
// Loads a model and return a handle.
// Returns 0 in case of an error.
// Helper, sets up pNewModelData object with model data from memory
// Returns 0 in case of an error otherwise initialized pNewModelData object is returned
//
extern "C"
void* LoadModel(const char * pszLdbFileName)
void* SetModelData(FAModelData * pNewModelData, const unsigned char * pImgBytes)
{
FAModelData * pNewModelData = new FAModelData();
if (NULL == pNewModelData) {
return 0;
}

// load the bin file
pNewModelData->m_Img.Load (pszLdbFileName);
const unsigned char * pImgBytes = pNewModelData->m_Img.GetImageDump ();
if (NULL == pImgBytes) {
return 0;
}
Expand Down Expand Up @@ -844,6 +839,52 @@ void* LoadModel(const char * pszLdbFileName)
}


//
// Same as LoadModel except a model is created from a memory pointer
// Returns 0 in case of an error
//
extern "C"
void* SetModel(const unsigned char * pImgBytes, int ModelByteCount)
{
FAModelData * pNewModelData = new FAModelData();
if (NULL == pNewModelData) {
return 0;
}

// load the bin file
if (NULL == pImgBytes || 0 == ModelByteCount) {
return 0;
}

// return the initialized model handle
return SetModelData(pNewModelData, pImgBytes);
}


//
// Loads a model and return a handle.
// Returns 0 in case of an error.
//
extern "C"
void* LoadModel(const char * pszLdbFileName)
{
FAModelData * pNewModelData = new FAModelData();
if (NULL == pNewModelData) {
return 0;
}

// load the bin file
pNewModelData->m_Img.Load (pszLdbFileName);
const unsigned char * pImgBytes = pNewModelData->m_Img.GetImageDump ();
if (NULL == pImgBytes) {
return 0;
}

// return the initialized model handle
return SetModelData(pNewModelData, pImgBytes);
}


//
// Implements a word-piece algorithm. Returns ids of words or sub-words, returns upto MaxIdsArrLength ids,
// the rest of the array is unchanged, so the array can be set to initial length and fill with 0's for padding.
Expand Down
2 changes: 1 addition & 1 deletion blingfiretools/blingfiretokdll/blingfiretokdll.def
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ EXPORTS
TextToIdsWithOffsets_wp
TextToIdsWithOffsets
NormalizeSpaces

SetModel
61 changes: 0 additions & 61 deletions projs/fa_align2chain.vcxproj

This file was deleted.

61 changes: 0 additions & 61 deletions projs/fa_bin2ngrams.vcxproj

This file was deleted.

61 changes: 0 additions & 61 deletions projs/fa_build_conf.vcxproj

This file was deleted.

61 changes: 0 additions & 61 deletions projs/fa_chains2mindfa.vcxproj

This file was deleted.

Loading

0 comments on commit eba488c

Please sign in to comment.