diff options
author | onefang | 2021-07-31 00:11:20 +1000 |
---|---|---|
committer | onefang | 2021-07-31 00:11:20 +1000 |
commit | 13f68831ca45955cfbcae9913dddea246ecc1762 (patch) | |
tree | 1bcb6af0f0c8654fc9db5408fa112cf639b84658 /src/sledjchisl/sledjchisl.c | |
parent | Dump and free Lua trees. (diff) | |
download | opensim-SC-13f68831ca45955cfbcae9913dddea246ecc1762.zip opensim-SC-13f68831ca45955cfbcae9913dddea246ecc1762.tar.gz opensim-SC-13f68831ca45955cfbcae9913dddea246ecc1762.tar.bz2 opensim-SC-13f68831ca45955cfbcae9913dddea246ecc1762.tar.xz |
Next stage of the sim loop rewrite - actually use the new ourSims->simsLua.
Still in debugging mode.
Diffstat (limited to '')
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index c158a61..2f282f9 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -1212,7 +1212,7 @@ simList *getSims() | |||
1212 | size_t l = strlen(tnm); | 1212 | size_t l = strlen(tnm); |
1213 | 1213 | ||
1214 | ourSims->simsLua = Lua2tree(file, "sims"); | 1214 | ourSims->simsLua = Lua2tree(file, "sims"); |
1215 | dumpLuaTree(ourSims->simsLua, "simsLua", 0); | 1215 | // dumpLuaTree(ourSims->simsLua, "simsLua", 0); |
1216 | 1216 | ||
1217 | if (s) | 1217 | if (s) |
1218 | { | 1218 | { |
@@ -7818,10 +7818,84 @@ sims = -- Note these are .shini / tmux tab short names. | |||
7818 | {["type"] = "Heavies"; ["number"] = 18; "DP", "ARSE"}, | 7818 | {["type"] = "Heavies"; ["number"] = 18; "DP", "ARSE"}, |
7819 | } | 7819 | } |
7820 | */ | 7820 | */ |
7821 | qtreetbl_obj_t obj0, obj1; | ||
7822 | qLua *q0, *q1; | ||
7823 | int count = 0, window = 0, panes = 4, pane = 0; | ||
7824 | |||
7825 | memset((void*)&obj0, 0, sizeof(obj0)); | ||
7826 | ourSims->simsLua->lock(ourSims->simsLua); | ||
7827 | while(ourSims->simsLua->getnext(ourSims->simsLua, &obj0, false) == true) | ||
7828 | { | ||
7829 | q0 = obj0.data; | ||
7830 | char *type = "unsorted"; | ||
7831 | |||
7832 | if (LUA_TTABLE == q0->type) | ||
7833 | { | ||
7834 | panes = 4; | ||
7835 | q1 = q0->v.t->get(q0->v.t, "number", NULL, false); if (NULL != q1) window = q1->v.f - 1; | ||
7836 | q1 = q0->v.t->get(q0->v.t, "panes", NULL, false); if (NULL != q1) panes = q1->v.f; | ||
7837 | q1 = q0->v.t->get(q0->v.t, "type", NULL, false); if (NULL != q1) type = q1->v.s; | ||
7838 | if (0 == panes) | ||
7839 | { | ||
7840 | pane = 2; | ||
7841 | window = 0; | ||
7842 | } | ||
7843 | else if (0 != pane) | ||
7844 | { | ||
7845 | pane = 0; | ||
7846 | window++; | ||
7847 | } | ||
7848 | |||
7849 | T("Doing sims of type %s, window %d, %d panes per window. %d", type, window, panes, pane); | ||
7850 | memset((void*)&obj1, 0, sizeof(obj1)); | ||
7851 | q0->v.t->lock(q0->v.t); | ||
7852 | while(q0->v.t->getnext(q0->v.t, &obj1, false) == true) | ||
7853 | { | ||
7854 | q1 = obj1.data; | ||
7855 | |||
7856 | if ((strcmp("number", obj1.name) != 0) && (strcmp("panes", obj1.name) != 0) && (strcmp("type", obj1.name) != 0)) | ||
7857 | { | ||
7858 | char *sim = q1->v.s; | ||
7859 | qlisttbl_t *ini = ourSims->byTab->get(ourSims->byTab, sim, NULL, false); | ||
7860 | |||
7861 | if (NULL == ini) | ||
7862 | E("Sim %s not found in ini list!", sim); | ||
7863 | else | ||
7864 | { | ||
7865 | simData *simd = ini->get(ini, "SIM DATA", NULL, false); | ||
7866 | char *nm = simd->tab; | ||
7867 | char *name = simd->name; | ||
7868 | |||
7869 | simd->window = window; | ||
7870 | simd->pane = pane; | ||
7871 | I("%s is starting up in tab [%d:%s](pane %d), tmux ID = %s, from %s/sim%d.", name, window, type, pane, simd->paneID, scTemp, count); | ||
7872 | |||
7873 | |||
7874 | |||
7875 | count++; | ||
7876 | } | ||
7877 | |||
7878 | pane++; | ||
7879 | if (pane >= panes) | ||
7880 | { | ||
7881 | pane = 0; | ||
7882 | window++; | ||
7883 | } | ||
7884 | } | ||
7885 | } | ||
7886 | q0->v.t->unlock(q0->v.t); | ||
7887 | } | ||
7888 | } | ||
7889 | ourSims->simsLua->unlock(ourSims->simsLua); | ||
7890 | goto finished; | ||
7891 | |||
7892 | |||
7893 | |||
7894 | |||
7821 | snprintf(toybuf, sizeof(toybuf), "%s/sims.lua", scEtc); | 7895 | snprintf(toybuf, sizeof(toybuf), "%s/sims.lua", scEtc); |
7822 | if (0 == lstat(toybuf, &st)) | 7896 | if (0 == lstat(toybuf, &st)) |
7823 | { | 7897 | { |
7824 | int count = 0, window = 0, panes = 4, pane = 0; | 7898 | // int count = 0, window = 0, panes = 4, pane = 0; |
7825 | 7899 | ||
7826 | I("Loading sims file - %s", toybuf); | 7900 | I("Loading sims file - %s", toybuf); |
7827 | status = luaL_loadfile(L, toybuf); | 7901 | status = luaL_loadfile(L, toybuf); |