Skip to content

Commit

Permalink
WIP. Trying to run emscripten-generated code in the browser.
Browse files Browse the repository at this point in the history
  • Loading branch information
nseam committed Dec 1, 2022
1 parent d393683 commit e36c9c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Common.extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
#include "DateTime.enum.h"
#include "Terminal.define.h"

void DebugBreak() { raise(SIGTRAP); }
void DebugBreak() {
#ifdef _MSC_VER
// @see https://learn.microsoft.com/en-us/cpp/intrinsics/debugbreak?view=msvc-170
__debugbreak();
#else
raise(SIGTRAP);
#endif
}

int _LastError = 0;

Expand Down
5 changes: 3 additions & 2 deletions DateTime.extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

// Includes.
#include <time.h>

#include "DateTime.enum.h"
#include "String.mqh"

Expand All @@ -44,7 +45,7 @@ class datetime {
public:
datetime() { dt = 0; }
datetime(const long& _time) { dt = _time; }
datetime(const int& _time);
// datetime(const int& _time);
bool operator==(const int _time) const = delete;
bool operator==(const datetime& _time) const { return dt == _time; }
bool operator<(const int _time) const = delete;
Expand Down Expand Up @@ -82,7 +83,7 @@ string TimeToString(datetime value, int mode = TIME_DATE | TIME_MINUTES) {
}

template <char... T>
extern datetime operator"" _D();
datetime operator"" _D();

#define DATETIME_LITERAL(STR) _D " ## STR ## "

Expand Down
1 change: 1 addition & 0 deletions Math.extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#ifndef __MQL__
#pragma once

#include <algorithm>
#include <cmath>

template <typename T>
Expand Down
5 changes: 4 additions & 1 deletion Std.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ class _cpp_array {
// E.g., size = 10, new_size = 90, reserve_size = 50
// thus: new_reserve_size = new_size + reserve_size - (new_size % reserve_size)
// which is: 90 + reserve_size - (90 % reserve_size) = 90 + 50 - 40 = 100.
m_data.reserve(new_size + reserve_size - (new_size % reserve_size));
if (reserve_size > 0) {
new_size = reserve_size - (new_size % reserve_size);
}
m_data.reserve(new_size);
m_data.resize(new_size);
}

Expand Down

0 comments on commit e36c9c9

Please sign in to comment.