Show a version number in the UI. Automate things so that the version number originates from the Makefile. Get ready for 0.0.8.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4330 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-06-28 23:00:34 +00:00
parent 6022001d66
commit 8f5201b2bc
6 changed files with 27 additions and 13 deletions

View File

@ -14,6 +14,7 @@
#include "tlscontext.js.h"
#include "trace.h"
#include "util.js.h"
#include "version.h"
#include "backtrace.h"
#include "quickjs.h"
@ -35,8 +36,6 @@
#define _countof(a) ((int)(sizeof((a)) / sizeof(*(a))))
#endif
static const char* k_version = "1.0";
static JSClassID _import_class_id;
static int _count;
@ -675,9 +674,11 @@ static JSValue _tf_task_version(JSContext* context, JSValueConst this_val, int a
{
tf_task_t* task = JS_GetContextOpaque(context);
tf_trace_begin(task->_trace, __func__);
JSValue result = JS_NewString(task->_context, k_version);
JSValue version = JS_NewObject(context);
JS_SetPropertyStr(context, version, "number", JS_NewString(context, VERSION_NUMBER));
JS_SetPropertyStr(context, version, "name", JS_NewString(context, VERSION_NAME));
tf_trace_end(task->_trace);
return result;
return version;
}
exportid_t tf_task_export_function(tf_task_t* task, tf_taskstub_t* to, JSValue function)

3
src/version.h Normal file
View File

@ -0,0 +1,3 @@
#define VERSION_NUMBER "0.0.8"
#define VERSION_NAME "The secret ingredient is love."