diff options
author | Chris Quirk <chrisq@microsoft.com> | 2012-09-24 10:41:03 +0400 |
---|---|---|
committer | Chris Quirk <chrisq@microsoft.com> | 2012-09-24 10:41:03 +0400 |
commit | f0fe5944188c6445644e4a3d9cdf24b9245bf7bb (patch) | |
tree | 9b08f2923499bb74399b39b06dbb1a930af60240 /vowpalwabbit/vwdll.cpp | |
parent | 3261bceca70eae3a3bd9d4c9ccf0c2758e2ebefc (diff) |
fix line endings
Diffstat (limited to 'vowpalwabbit/vwdll.cpp')
-rw-r--r-- | vowpalwabbit/vwdll.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/vowpalwabbit/vwdll.cpp b/vowpalwabbit/vwdll.cpp index 3d13cb94..6fcf899b 100644 --- a/vowpalwabbit/vwdll.cpp +++ b/vowpalwabbit/vwdll.cpp @@ -1,83 +1,83 @@ -#include <memory>
-
-#include "vwdll.h"
-#include "parser.h"
-
-extern "C"
-{
-
- VW_DLL_MEMBER VW_HANDLE VW_CALLING_CONV VW_Initialize(const char * pstrArgs)
- {
- std::auto_ptr<vw> inst(new vw);
- try
- {
- string s(pstrArgs);
- *(inst.get()) = VW::initialize(s);
- initialize_parser_datastructures(*(inst.get()));
- return static_cast<VW_HANDLE>(inst.release());
- }
- catch (...)
- {
- // BUGBUG: should report error here....
- return INVALID_VW_HANDLE;
- }
- }
-
- VW_DLL_MEMBER void VW_CALLING_CONV VW_Finish(VW_HANDLE handle)
- {
- try
- {
- vw * pointer = static_cast<vw*>(handle);
- release_parser_datastructures(*pointer);
- VW::finish(*pointer);
- delete pointer;
- }
- catch (...)
- {}
- }
-
- VW_DLL_MEMBER VW_EXAMPLE VW_CALLING_CONV VW_ReadExample(VW_HANDLE handle, const char * line)
- {
- try
- {
- vw * pointer = static_cast<vw*>(handle);
- // BUGBUG: I really dislike this const_cast. should VW really change the input string?
- return static_cast<VW_EXAMPLE>(VW::read_example(*pointer, const_cast<char*>(line)));
- }
- catch (...)
- {
- // BUGBUG: should report error here....
- return INVALID_VW_EXAMPLE;
- }
- }
-
- VW_DLL_MEMBER void VW_CALLING_CONV VW_FinishExample(VW_HANDLE handle, VW_EXAMPLE e)
- {
- try
- {
- vw * pointer = static_cast<vw*>(handle);
- VW::finish_example(*pointer, static_cast<example*>(e));
- }
- catch (...)
- {
- // BUGBUG: should report error here....
- }
- }
-
- VW_DLL_MEMBER float VW_CALLING_CONV VW_Learn(VW_HANDLE handle, VW_EXAMPLE e)
- {
- try
- {
- vw * pointer = static_cast<vw*>(handle);
- example * ex = static_cast<example*>(e);
- pointer->learn(pointer, ex);
- return ex->final_prediction;
- }
- catch (...)
- {
- // BUGBUG: should report error here....
- return std::numeric_limits<float>::quiet_NaN();
- }
- }
-
+#include <memory> + +#include "vwdll.h" +#include "parser.h" + +extern "C" +{ + + VW_DLL_MEMBER VW_HANDLE VW_CALLING_CONV VW_Initialize(const char * pstrArgs) + { + std::auto_ptr<vw> inst(new vw); + try + { + string s(pstrArgs); + *(inst.get()) = VW::initialize(s); + initialize_parser_datastructures(*(inst.get())); + return static_cast<VW_HANDLE>(inst.release()); + } + catch (...) + { + // BUGBUG: should report error here.... + return INVALID_VW_HANDLE; + } + } + + VW_DLL_MEMBER void VW_CALLING_CONV VW_Finish(VW_HANDLE handle) + { + try + { + vw * pointer = static_cast<vw*>(handle); + release_parser_datastructures(*pointer); + VW::finish(*pointer); + delete pointer; + } + catch (...) + {} + } + + VW_DLL_MEMBER VW_EXAMPLE VW_CALLING_CONV VW_ReadExample(VW_HANDLE handle, const char * line) + { + try + { + vw * pointer = static_cast<vw*>(handle); + // BUGBUG: I really dislike this const_cast. should VW really change the input string? + return static_cast<VW_EXAMPLE>(VW::read_example(*pointer, const_cast<char*>(line))); + } + catch (...) + { + // BUGBUG: should report error here.... + return INVALID_VW_EXAMPLE; + } + } + + VW_DLL_MEMBER void VW_CALLING_CONV VW_FinishExample(VW_HANDLE handle, VW_EXAMPLE e) + { + try + { + vw * pointer = static_cast<vw*>(handle); + VW::finish_example(*pointer, static_cast<example*>(e)); + } + catch (...) + { + // BUGBUG: should report error here.... + } + } + + VW_DLL_MEMBER float VW_CALLING_CONV VW_Learn(VW_HANDLE handle, VW_EXAMPLE e) + { + try + { + vw * pointer = static_cast<vw*>(handle); + example * ex = static_cast<example*>(e); + pointer->learn(pointer, ex); + return ex->final_prediction; + } + catch (...) + { + // BUGBUG: should report error here.... + return std::numeric_limits<float>::quiet_NaN(); + } + } + }
\ No newline at end of file |