From a52ad3c704bd345c3aedbd40ad96e1a677f8b05f Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 30 Jul 2021 04:59:58 +1000 Subject: Add comment banners for some major sections of the code. --- src/sledjchisl/sledjchisl.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 767a894..e616108 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -6789,6 +6789,9 @@ static void cleanup(void) } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Main function. +//////////////////////////////////////////////////////////////////////////////////////////////////// void sledjchisl_main(void) { char *cmd = *toys.optargs; @@ -6864,6 +6867,9 @@ void sledjchisl_main(void) } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Read configuration. +//////////////////////////////////////////////////////////////////////////////////////////////////// /* From http://luajit.org/install.html - To change or extend the list of standard libraries to load, copy src/lib_init.c to your project and modify it accordingly. Make sure the @@ -6955,6 +6961,9 @@ jit library is loaded or the JIT compiler will not be activated. if ((tmp = configs->getstr(configs, "webIframers", false)) != NULL) {webIframers = tmp; D("Setting webIframers = %s", webIframers);} +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Sort out directories. +//////////////////////////////////////////////////////////////////////////////////////////////////// // Use a FHS compatible setup - if (strcmp("/", scRoot) == 0) { @@ -7006,6 +7015,9 @@ jit library is loaded or the JIT compiler will not be activated. } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Figure out what and where we are. +//////////////////////////////////////////////////////////////////////////////////////////////////// // TODO - still a bit chicken and egg here about the tmux socket and reading configs from scEtc /.sledjChisl.conf.lua if (!isWeb) { @@ -7071,6 +7083,9 @@ jit library is loaded or the JIT compiler will not be activated. } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Sort out directories, part 2 +//////////////////////////////////////////////////////////////////////////////////////////////////// // Doing this here coz at this point we should be the correct user. I("Making directories in %s.", scRoot); if ((! qfile_exist(scBin)) && (! qfile_mkdir(scBin, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scBin); @@ -7092,8 +7107,11 @@ jit library is loaded or the JIT compiler will not be activated. if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); free(tmp); - getSims(); +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Other start up stuff. +//////////////////////////////////////////////////////////////////////////////////////////////////// + getSims(); if (isTmux || isWeb) { @@ -7129,6 +7147,9 @@ jit library is loaded or the JIT compiler will not be activated. memset(toybuf, 0, sizeof(toybuf)); snprintf(toybuf, sizeof(toybuf), "%s/config/config.ini", scRoot); +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Connect to database. +//////////////////////////////////////////////////////////////////////////////////////////////////// // TODO - it looks like OpenSim invented their own half arsed backwards INI file include system. // I doubt qLibc supports it, like it supports what seems to be the standard include system. // Not sure if we need to worry about it just yet. @@ -7197,6 +7218,9 @@ jit library is loaded or the JIT compiler will not be activated. } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Start of web wrangling section. +//////////////////////////////////////////////////////////////////////////////////////////////////// if (isWeb) { char **initialEnv = environ; @@ -7219,6 +7243,9 @@ jit library is loaded or the JIT compiler will not be activated. } printEnv(environ); +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Web processing loop. +//////////////////////////////////////////////////////////////////////////////////////////////////// /* ? https://stackoverflow.com/questions/30707792/how-to-disable-buffering-with-apache2-and-mod-proxy-fcgi https://z-issue.com/wp/apache-2-4-the-event-mpm-php-via-mod_proxy_fcgi-and-php-fpm-with-vhosts/ @@ -7570,9 +7597,15 @@ fcgiDone: goto finished; } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// End of web wrangling section. +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Start of OpenSim wrangling section. +//////////////////////////////////////////////////////////////////////////////////////////////////// char *target = NULL; struct sysinfo info; float la; @@ -7607,6 +7640,9 @@ fcgiDone: //T("ARGS - %i |%s| |%s|", currentMode, toys.optargs[0], target); +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Start ROBUST or join the tmux session. +//////////////////////////////////////////////////////////////////////////////////////////////////// if ((START == currentMode) && !checkSimIsRunning("ROBUST")) { char *d = xmprintf("%s.{right}", Ttab); @@ -7658,6 +7694,9 @@ sims = -- Note these are .shini / tmux tab short names. E("Failed to run script: %s", lua_tostring(L, -1)); else { +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Sim wrangling loop. +//////////////////////////////////////////////////////////////////////////////////////////////////// lua_getglobal(L, "sims"); lua_pushnil(L); // lua_next() needs the last key at the top, but we don't start with one. @@ -7973,6 +8012,9 @@ nextSim: I("Closing all the panes."); // TODO - Wait for all the sims to stop, close all the sim panes, even the empty ones. } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// End of OpenSim wrangling section. +//////////////////////////////////////////////////////////////////////////////////////////////////// /* -- cgit v1.1