Move DS_ErrorCodeToErrorMessage impl to its own object so it can be used without including all of libdeepspeech
This commit is contained in:
parent
39696f0d67
commit
03ca94887c
@ -89,13 +89,14 @@ cc_library(
|
|||||||
tf_cc_shared_object(
|
tf_cc_shared_object(
|
||||||
name = "libdeepspeech.so",
|
name = "libdeepspeech.so",
|
||||||
srcs = [
|
srcs = [
|
||||||
|
"alphabet.h",
|
||||||
"deepspeech.cc",
|
"deepspeech.cc",
|
||||||
"deepspeech.h",
|
"deepspeech.h",
|
||||||
"alphabet.h",
|
"deepspeech_errors.cc",
|
||||||
"modelstate.h",
|
|
||||||
"modelstate.cc",
|
"modelstate.cc",
|
||||||
"workspace_status.h",
|
"modelstate.h",
|
||||||
"workspace_status.cc",
|
"workspace_status.cc",
|
||||||
|
"workspace_status.h",
|
||||||
] + select({
|
] + select({
|
||||||
"//native_client:tflite": [
|
"//native_client:tflite": [
|
||||||
"tflitemodelstate.h",
|
"tflitemodelstate.h",
|
||||||
|
@ -501,20 +501,3 @@ DS_Version()
|
|||||||
{
|
{
|
||||||
return strdup(ds_version());
|
return strdup(ds_version());
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
|
||||||
DS_ErrorCodeToErrorMessage(int aErrorCode)
|
|
||||||
{
|
|
||||||
#define RETURN_MESSAGE(NAME, VALUE, DESC) \
|
|
||||||
case NAME: \
|
|
||||||
return strdup(DESC);
|
|
||||||
|
|
||||||
switch(aErrorCode)
|
|
||||||
{
|
|
||||||
DS_FOR_EACH_ERROR(RETURN_MESSAGE)
|
|
||||||
default:
|
|
||||||
return strdup("Unknown error, please make sure you are using the correct native binary.");
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef RETURN_MESSAGE
|
|
||||||
}
|
|
||||||
|
19
native_client/deepspeech_errors.cc
Normal file
19
native_client/deepspeech_errors.cc
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "deepspeech.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
char*
|
||||||
|
DS_ErrorCodeToErrorMessage(int aErrorCode)
|
||||||
|
{
|
||||||
|
#define RETURN_MESSAGE(NAME, VALUE, DESC) \
|
||||||
|
case NAME: \
|
||||||
|
return strdup(DESC);
|
||||||
|
|
||||||
|
switch(aErrorCode)
|
||||||
|
{
|
||||||
|
DS_FOR_EACH_ERROR(RETURN_MESSAGE)
|
||||||
|
default:
|
||||||
|
return strdup("Unknown error, please make sure you are using the correct native binary.");
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef RETURN_MESSAGE
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user