Skip to content

Commit

Permalink
Merge pull request #33 from idrassi/patch
Browse files Browse the repository at this point in the history
Allow building core LK engine without wxWidgets
  • Loading branch information
sjanzou authored Aug 13, 2023
2 parents 5546454 + b6a6cf2 commit 91c5608
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
29 changes: 29 additions & 0 deletions include/lk/absyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,42 @@ typedef wxStringEqual lk_string_equal;

#else
#include <string>
#include <sstream>

typedef std::string::value_type lk_char;
typedef std::string lk_string;

typedef std::hash<std::string> lk_string_hash;
typedef std::equal_to<std::string> lk_string_equal;

inline lk_string& operator << (lk_string& a, const lk_string& lstr)
{
a += lstr;
return a;
}

inline lk_string& operator << (lk_string& a, const char* s)
{
a += s;
return a;
}

inline lk_string& operator << (lk_string& a, int i)
{
std::stringstream sstr;
sstr << i;
a += sstr.str();
return a;
}

inline lk_string& operator << (lk_string& a, size_t i)
{
std::stringstream sstr;
sstr << i;
a += sstr.str();
return a;
}

#endif

#define lk_tr(s) lk::get_translation(s)
Expand Down
5 changes: 5 additions & 0 deletions include/lk/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef __lk_stdlib_h
#define __lk_stdlib_h

#ifdef LK_USE_WXWIDGETS
#include <wx/wx.h>
#endif

#include <lk/env.h>

Expand Down Expand Up @@ -169,6 +171,8 @@ namespace lk {
double erfc(double x);
};

#ifdef LK_USE_WXWIDGETS

class MyMessageDialog : public wxDialog {
public:
MyMessageDialog(wxWindow *parent,
Expand Down Expand Up @@ -261,5 +265,6 @@ DECLARE_EVENT_TABLE();
};

wxWindow *GetCurrentTopLevelWindow();
#endif

#endif
2 changes: 2 additions & 0 deletions src/stdlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4105,6 +4105,7 @@ double lk::erfc(double x) {
return x < 0.0 ? 1.0 + gammp(0.5, x * x) : gammq(0.5, x * x);
}

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

return 0;
}
#endif

#ifdef WIN32

Expand Down

0 comments on commit 91c5608

Please sign in to comment.