forked from cory/tildefriends
Enough glue to load a web page from our web server in the iOS simulator. Next challenge is uv_spawn: permission denied.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4519 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
38
src/main.c
38
src/main.c
@ -36,7 +36,8 @@
|
||||
|
||||
struct backtrace_state* g_backtrace_state;
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
const char* k_db_path_default = "db.sqlite";
|
||||
|
||||
#define XOPT_PARSE(name, flags, options, config_ptr, argc, argv, extrac_ptr, extrav_ptr, err_ptr, autohelp_file, autohelp_usage, autohelp_prefix, autohelp_suffix, autohelp_spacer) do { \
|
||||
xoptContext *_xopt_ctx; \
|
||||
*(err_ptr) = NULL; \
|
||||
@ -65,6 +66,7 @@ struct backtrace_state* g_backtrace_state;
|
||||
break; \
|
||||
} while (false)
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
static int _tf_command_test(const char* file, int argc, char* argv[]);
|
||||
static int _tf_command_import(const char* file, int argc, char* argv[]);
|
||||
static int _tf_command_export(const char* file, int argc, char* argv[]);
|
||||
@ -88,8 +90,6 @@ const command_t k_commands[] = {
|
||||
{ "check", _tf_command_check, "Validate messages in the SSB database." },
|
||||
};
|
||||
|
||||
const char* k_db_path_default = "db.sqlite";
|
||||
|
||||
void shedPrivileges()
|
||||
{
|
||||
#if !defined(_WIN32)
|
||||
@ -309,6 +309,7 @@ xopt_help:
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct tf_run_args_t {
|
||||
const char* script;
|
||||
@ -373,6 +374,7 @@ static void _tf_run_task_thread(void* data)
|
||||
info->result = _tf_run_task(&info->args, info->index);
|
||||
}
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
static int _tf_command_run(const char* file, int argc, char* argv[])
|
||||
{
|
||||
xoptOption options[] = {
|
||||
@ -654,3 +656,33 @@ done:
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
void tf_run_thread_start(const char* zip_path)
|
||||
{
|
||||
uv_thread_t* thread = tf_malloc(sizeof(uv_thread_t));
|
||||
tf_run_thread_data_t* data = tf_malloc(sizeof(tf_run_thread_data_t));
|
||||
tf_run_args_t args =
|
||||
{
|
||||
.count = 1,
|
||||
.script = "core/core.js",
|
||||
.http_port = 12345,
|
||||
.https_port = 12346,
|
||||
.ssb_port = 8008,
|
||||
.db_path = k_db_path_default,
|
||||
.zip = zip_path,
|
||||
};
|
||||
*data = (tf_run_thread_data_t)
|
||||
{
|
||||
.args = args,
|
||||
};
|
||||
uv_thread_create(thread, _tf_run_task_thread, data);
|
||||
#if 0
|
||||
uv_thread_join(&threads[i]);
|
||||
if (data[i].result != 0)
|
||||
{
|
||||
result = data[i].result;
|
||||
}
|
||||
tf_free(data);
|
||||
tf_free(threads);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user