From 0fc225c0048cea90e2a1b83d125500c337234c9d Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Tue, 12 Mar 2024 15:44:02 -0700 Subject: [PATCH] add debug info --- moses2/DLLEntryApi.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) mode change 100644 => 100755 moses2/DLLEntryApi.cpp diff --git a/moses2/DLLEntryApi.cpp b/moses2/DLLEntryApi.cpp old mode 100644 new mode 100755 index 060bea678..58eb96335 --- a/moses2/DLLEntryApi.cpp +++ b/moses2/DLLEntryApi.cpp @@ -1,5 +1,6 @@ #include "Moses2Wrapper.h" #include +#include #include @@ -23,7 +24,6 @@ using namespace std; using namespace Moses2; extern "C" EXPORT MosesApiErrorCode __stdcall GetMosesSystem(const char* filePath, Moses2::Moses2Wrapper * *pObject) { - if (*pObject == NULL) { *pObject = new Moses2::Moses2Wrapper(filePath); return MS_API_OK; @@ -34,10 +34,19 @@ extern "C" EXPORT MosesApiErrorCode __stdcall GetMosesSystem(const char* filePat } extern "C" EXPORT MosesApiErrorCode __stdcall Translate(Moses2::Moses2Wrapper * pObject, long id, const char* input, char** output) { + ofstream tmpfile; + tmpfile.open("C:\\moses.log", ios::app); + tmpfile << "Start Translate: " << endl; + tmpfile << pObject << " " << endl; + tmpfile << id << " " << endl; + tmpfile << string(input) << endl; + if (pObject != NULL) { std::string tr = pObject->Translate(input, id); + tmpfile << "tr=" << tr << endl; *output = Moses2Wrapper::CopyString(tr.c_str()); + tmpfile << "output=" << string(*output) << endl; return MS_API_OK; } else {