Dropping libstdc++ dep

This commit is contained in:
Michal Moskal 2017-07-04 16:11:54 +02:00
parent d174307651
commit dcd293abe4
3 changed files with 28 additions and 16 deletions

7
libs/core/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"files.associations": {
"functional": "cpp",
"tuple": "cpp",
"algorithm": "cpp"
}
}

View File

@ -7,7 +7,8 @@ LDFLAGS = -Wl,--gc-sections -Wl,--sort-common -Wl,--sort-section=alignment
PREF = arm-linux-gnueabi-
CC = $(PREF)gcc
LD = $(PREF)gcc
LIBSTDCPP = /usr/lib/gcc/arm-linux-gnueabi/4.9/libstdc++.a
#LIBSTDCPP = /usr/lib/gcc/arm-linux-gnueabi/4.9/libstdc++.a
LIBSTDCPP =
NPM_LIBS = $(wildcard node_modules/*/lib/*.a)
NPM_INCLUDES = $(addprefix -I, $(wildcard node_modules/*/include))

View File

@ -7,7 +7,6 @@
#include <cstdarg>
#include <pthread.h>
#include <assert.h>
#include <map>
#define DEVICE_EVT_ANY 0
@ -22,11 +21,23 @@ void dmesg(const char *format, ...) {
fprintf(stderr, "DMESG: %s\n", buf);
}
void *operator new(size_t size) {
return malloc(size);
}
void *operator new[](size_t size) {
return malloc(size);
}
void operator delete(void *p) {
free(p);
}
void operator delete[](void *p) {
free(p);
}
namespace pxt {
static int startTime;
static std::map<std::pair<int, int>, Action> handlersMap;
static pthread_mutex_t execMutex;
static pthread_cond_t newEventBroadcast;
@ -190,13 +201,13 @@ void waitForEvent(int source, int value) {
static void dispatchEvent(Event &e) {
lastEvent = e;
Action curr = handlersMap[{e.source, e.value}];
auto curr = findBinding(e.source, e.value);
if (curr)
setupThread(curr, fromInt(e.value));
setupThread(curr->action, fromInt(e.value));
curr = handlersMap[{e.source, DEVICE_EVT_ANY}];
curr = findBinding(e.source, DEVICE_EVT_ANY);
if (curr)
setupThread(curr, fromInt(e.value));
setupThread(curr->action, fromInt(e.value));
}
static void *evtDispatcher(void *dummy) {
@ -236,14 +247,7 @@ void raiseEvent(int id, int event) {
}
void registerWithDal(int id, int event, Action a) {
Action prev = handlersMap[{id, event}];
if (prev)
decr(prev);
else {
// first time processing?
}
incr(a);
handlersMap[{id, event}] = a;
setBinding(id, event, a);
}
uint32_t afterProgramPage() {