add debug info

This commit is contained in:
Hieu Hoang 2024-03-12 15:44:02 -07:00
parent 58400043b4
commit 0fc225c004

11
moses2/DLLEntryApi.cpp Normal file → Executable file
View File

@ -1,5 +1,6 @@
#include "Moses2Wrapper.h"
#include <iostream>
#include <fstream>
#include <string.h>
@ -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 {