Skip to content

Commit 91c5608

Browse files
authored
Merge pull request #33 from idrassi/patch
Allow building core LK engine without wxWidgets
2 parents 5546454 + b6a6cf2 commit 91c5608

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

include/lk/absyn.h

+29
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,42 @@ typedef wxStringEqual lk_string_equal;
6161

6262
#else
6363
#include <string>
64+
#include <sstream>
6465

6566
typedef std::string::value_type lk_char;
6667
typedef std::string lk_string;
6768

6869
typedef std::hash<std::string> lk_string_hash;
6970
typedef std::equal_to<std::string> lk_string_equal;
7071

72+
inline lk_string& operator << (lk_string& a, const lk_string& lstr)
73+
{
74+
a += lstr;
75+
return a;
76+
}
77+
78+
inline lk_string& operator << (lk_string& a, const char* s)
79+
{
80+
a += s;
81+
return a;
82+
}
83+
84+
inline lk_string& operator << (lk_string& a, int i)
85+
{
86+
std::stringstream sstr;
87+
sstr << i;
88+
a += sstr.str();
89+
return a;
90+
}
91+
92+
inline lk_string& operator << (lk_string& a, size_t i)
93+
{
94+
std::stringstream sstr;
95+
sstr << i;
96+
a += sstr.str();
97+
return a;
98+
}
99+
71100
#endif
72101

73102
#define lk_tr(s) lk::get_translation(s)

include/lk/stdlib.h

+5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
#ifndef __lk_stdlib_h
3333
#define __lk_stdlib_h
3434

35+
#ifdef LK_USE_WXWIDGETS
3536
#include <wx/wx.h>
37+
#endif
3638

3739
#include <lk/env.h>
3840

@@ -169,6 +171,8 @@ namespace lk {
169171
double erfc(double x);
170172
};
171173

174+
#ifdef LK_USE_WXWIDGETS
175+
172176
class MyMessageDialog : public wxDialog {
173177
public:
174178
MyMessageDialog(wxWindow *parent,
@@ -261,5 +265,6 @@ DECLARE_EVENT_TABLE();
261265
};
262266

263267
wxWindow *GetCurrentTopLevelWindow();
268+
#endif
264269

265270
#endif

src/stdlib.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -4105,6 +4105,7 @@ double lk::erfc(double x) {
41054105
return x < 0.0 ? 1.0 + gammp(0.5, x * x) : gammq(0.5, x * x);
41064106
}
41074107

4108+
#ifdef LK_USE_WXWIDGETS
41084109
wxWindow *GetCurrentTopLevelWindow() {
41094110
wxWindowList &wl = ::wxTopLevelWindows;
41104111
for (wxWindowList::iterator it = wl.begin(); it != wl.end(); ++it)
@@ -4114,6 +4115,7 @@ wxWindow *GetCurrentTopLevelWindow() {
41144115

41154116
return 0;
41164117
}
4118+
#endif
41174119

41184120
#ifdef WIN32
41194121

0 commit comments

Comments
 (0)