Move all JS interface things into .js.c files with _register() functions.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3671 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
28
src/task.c
28
src/task.c
@ -1,15 +1,15 @@
|
||||
#include "task.h"
|
||||
|
||||
#include "bcrypt.h"
|
||||
#include "database.h"
|
||||
#include "file.h"
|
||||
#include "bcrypt.js.h"
|
||||
#include "database.js.h"
|
||||
#include "file.js.h"
|
||||
#include "packetstream.h"
|
||||
#include "serialize.h"
|
||||
#include "socket.h"
|
||||
#include "socket.js.h"
|
||||
#include "ssb.h"
|
||||
#include "ssb.qjs.h"
|
||||
#include "taskstub.h"
|
||||
#include "tlscontextwrapper.h"
|
||||
#include "ssb.js.h"
|
||||
#include "taskstub.js.h"
|
||||
#include "tlscontext.js.h"
|
||||
#include "trace.h"
|
||||
|
||||
#include <assert.h>
|
||||
@ -1359,18 +1359,18 @@ void tf_task_activate(tf_task_t* task)
|
||||
sqlite3_open(task->_db_path ? task->_db_path : "db.sqlite", &task->_db);
|
||||
|
||||
JS_SetPropertyStr(context, global, "require", JS_NewCFunction(context, _tf_task_require, "require", 1));
|
||||
JS_SetPropertyStr(context, global, "Task", tf_taskstub_init(context));
|
||||
JS_SetPropertyStr(context, global, "Socket", tf_socket_init(context));
|
||||
JS_SetPropertyStr(context, global, "TlsContext", tf_tls_context_wrapper_init(context));
|
||||
tf_database_init(context, task->_db);
|
||||
tf_file_init(context);
|
||||
JS_SetPropertyStr(context, global, "Task", tf_taskstub_register(context));
|
||||
JS_SetPropertyStr(context, global, "Socket", tf_socket_register(context));
|
||||
JS_SetPropertyStr(context, global, "TlsContext", tf_tls_context_register(context));
|
||||
tf_database_register(context, task->_db);
|
||||
tf_file_register(context);
|
||||
|
||||
task->_trace = tf_trace_create();
|
||||
|
||||
task->_ssb = tf_ssb_create(task->_loop, task->_context, task->_db, task->_secrets_path);
|
||||
tf_ssb_set_trace(task->_ssb, task->_trace);
|
||||
tf_ssb_broadcast_listener_start(task->_ssb, false);
|
||||
tf_ssb_init(context, task->_ssb);
|
||||
tf_ssb_register(context, task->_ssb);
|
||||
if (task->_ssb_port)
|
||||
{
|
||||
tf_ssb_server_open(task->_ssb, task->_ssb_port);
|
||||
@ -1383,7 +1383,7 @@ void tf_task_activate(tf_task_t* task)
|
||||
JS_SetPropertyStr(context, global, "require", JS_NewCFunction(context, _tf_task_sandbox_require, "sandboxRequire", 0));
|
||||
}
|
||||
|
||||
tf_bcrypt_init(context);
|
||||
tf_bcrypt_register(context);
|
||||
JS_SetPropertyStr(context, global, "utf8Decode", JS_NewCFunction(context, _tf_task_utf8Decode, "utf8Decode", 1));
|
||||
JS_SetPropertyStr(context, global, "print", JS_NewCFunction(context, _tf_task_print, "print", 0));
|
||||
JS_SetPropertyStr(context, global, "exit", JS_NewCFunction(context, _tf_task_exit, "exit", 1));
|
||||
|
Reference in New Issue
Block a user