dev
Bill 2 years ago
parent 09e5f7dbc9
commit 5a163a6af9

5
.gitignore vendored

@ -1,3 +1,8 @@
*.json
!sample_ast.json
*.o
*.pch
*.gch
a.out.*
*.log
*.pyc

@ -1,6 +1,7 @@
OS_SUPPORT =
MonetDB_LIB =
Threading =
ifeq ($(OS),Windows_NT)
OS_SUPPORT += server/winhelper.cpp
MonetDB_LIB += -Imonetdb/msvc msc-plugin/monetdbe.dll
@ -11,6 +12,7 @@ endif
ifeq ($(THREADING),1)
Threading += server/threading.cpp -DTHREADING
endif
info:
$(info $(OS_SUPPORT))
$(info $(OS))
@ -22,6 +24,6 @@ server.so:
# $(CXX) server/server.cpp server/monetdb_conn.cpp -fPIC -shared $(OS_SUPPORT) monetdb/msvc/monetdbe.dll --std=c++1z -O3 -march=native -o server.so -I./monetdb/msvc
$(CXX) -shared -fPIC -flto server/server.cpp server/io.cpp server/table.cpp $(OS_SUPPORT) server/monetdb_conn.cpp $(Threading) $(MonetDB_LIB) --std=c++1z -o server.so -O3
snippet:
$(CXX) -shared -fPIC -flto --std=c++1z out.cpp server/monetdb_conn.cpp server/table.cpp server/io.cpp $(MonetDB_LIB) -O3 -march=native -o dll.so
$(CXX) -shared -fPIC -flto --std=c++1z -include server/aggregations.h out.cpp server/monetdb_conn.cpp server/table.cpp server/io.cpp $(MonetDB_LIB) -O3 -march=native -o dll.so
clean:
rm *.shm -rf

@ -104,7 +104,7 @@ class PromptState():
th = None
send = None
test_parser = True
server_mode : RunType = RunType.Threaded
server_mode: RunType = RunType.Threaded
server_bin = 'server.bin' if server_mode == RunType.IPC else 'server.so'
set_ready = lambda: None
get_ready = lambda: None
@ -381,6 +381,9 @@ def main(running = lambda:True, next = input, state = None):
print(e)
except (KeyboardInterrupt):
break
except SystemExit:
print("\nBye.")
raise
except:
import code, traceback
sh = code.InteractiveConsole({**globals(), **locals()})

@ -245,7 +245,7 @@ class projection(ast_node):
if type(val[1]) is int:
self.context.emitc(f'{self.outtable_name}->get_col<{key}>().initfrom({vid2cname[val[1]]});')
else:
# for funcs evaluate f_i(x, ...)
# for funcs evaluate f_i(x, ...)
self.context.emitc(f'{self.outtable_name}->get_col<{key}>() = {val[1]};')
# print out col_is
self.context.emitc(f'print(*{self.outtable_name});')

@ -140,3 +140,11 @@ void* Server::getCol(int col_idx){
Server::~Server(){
close();
}
bool Server::havehge() {
#if defined(_MONETDBE_LIB_) and defined(HAVE_HGE)
return HAVE_HGE;
#else
return false;
#endif
}

@ -1,3 +1,5 @@
#ifndef __MONETDB_CONN_H__
#define __MONETDB_CONN_H__
struct Context;
@ -19,5 +21,8 @@ struct Server{
void *getCol(int col_idx);
void close();
bool haserror();
static bool havehge();
~Server();
};
#endif

@ -65,8 +65,8 @@ extern "C" int __DLLEXPORT__ binary_info() {
}
__AQEXPORT__(bool) have_hge(){
#if defined(_MONETDBE_LIB_) and defined(HAVE_HGE)
return HAVE_HGE;
#if defined(__MONETDB_CONN_H__)
return Server::havehge();
#else
return false;
#endif
@ -105,10 +105,10 @@ int dll_main(int argc, char** argv, Context* cxt){
}
for(int i = 0; i < n_recv; ++i)
{
printf("%s, %d\n", n_recvd[i], n_recvd[i][0] == 'Q');
//printf("%s, %d\n", n_recvd[i], n_recvd[i][0] == 'Q');
if (n_recvd[i][0] == 'Q'){
server->exec(n_recvd[i] + 1);
printf("Exec Q%d: %s\n", i, n_recvd[i]);
printf("Exec Q%d: %s", i, n_recvd[i]);
}
else if (n_recvd[i][0] == 'P' && handle && !server->haserror()) {
code_snippet c = reinterpret_cast<code_snippet>(dlsym(handle, n_recvd[i]+1));

@ -1,10 +1,10 @@
#ifndef _TYPES_H
#define _TYPES_H
#include <typeinfo>
#include <functional>
#include <cstdint>
#include <type_traits>
#include <string>
#include <tuple>
#ifdef _MSC_VER
#define __restrict__ __restrict

Loading…
Cancel
Save