Commit 120290b3 authored by Matt Mascarenhas's avatar Matt Mascarenhas

cinera.c: Support a combination of modes

Specifically, with the addition of MODE_ONESHOT in v0.5.12 we must allow
for the possibility of being in both that mode and MODE_INTEGRATE
parent 4a954b6a
......@@ -14,7 +14,7 @@ typedef struct
version CINERA_APP_VERSION = {
.Major = 0,
.Minor = 5,
.Patch = 12
.Patch = 13
};
#define CINERA_DB_VERSION 2
......@@ -68,9 +68,9 @@ enum
enum
{
MODE_BARE,
MODE_INTEGRATE,
MODE_ONESHOT
MODE_BARE = 1 << 0,
MODE_INTEGRATE = 1 << 1,
MODE_ONESHOT = 1 << 2
} modes;
enum
......@@ -3228,7 +3228,7 @@ BuffersToHTML(buffers *CollationBuffers, template *Template, char *OutputPath, i
fclose(MemLog);
#endif
if(Config.Mode == MODE_INTEGRATE)
if(Config.Mode & MODE_INTEGRATE)
{
if(Template->Metadata.Validity & PageType)
{
......@@ -4601,7 +4601,7 @@ main(int ArgC, char **Args)
Config.ProjectID = optarg;
break;
case 'q':
Config.Mode = MODE_ONESHOT;
Config.Mode |= MODE_ONESHOT;
break;
case 'r':
Config.RootDir = StripTrailingSlash(optarg);
......@@ -4614,7 +4614,7 @@ main(int ArgC, char **Args)
break;
case 't':
Config.TemplatePlayerLocation = optarg;
Config.Mode = MODE_INTEGRATE;
Config.Mode |= MODE_INTEGRATE;
break;
case 'U':
Config.UpdateInterval = StringToInt(optarg);
......@@ -4624,7 +4624,7 @@ main(int ArgC, char **Args)
return RC_SUCCESS;
case 'x':
Config.TemplateIndexLocation = optarg;
Config.Mode = MODE_INTEGRATE;
Config.Mode |= MODE_INTEGRATE;
break;
case 'h':
default:
......@@ -4721,13 +4721,13 @@ main(int ArgC, char **Args)
// Config will contain paths of multiple templates
// App is running all the time, and picking up changes to the config as we go
// If we find a new template, we first of all validate it
// In our case here, we just want to straight up validate a template if Config.Mode == MODE_INTEGRATE
// In our case here, we just want to straight up validate a template if Config.Mode & MODE_INTEGRATE
// And, in that same state, we gotta keep a Template buffer around
template *PlayerTemplate;
template *IndexTemplate;
if(Config.Mode == MODE_INTEGRATE)
if(Config.Mode & MODE_INTEGRATE)
{
switch(ValidateTemplate(&Errors, &PlayerTemplate, PAGE_PLAYER))
{
......@@ -4790,7 +4790,7 @@ main(int ArgC, char **Args)
StringsDiffer(Config.ImagesDir, "") ? Config.ImagesDir : "(same as root)",
StringsDiffer(Config.JSDir, "") ? Config.JSDir : "(same as root)");
if(Config.Mode == MODE_INTEGRATE)
if(Config.Mode & MODE_INTEGRATE)
{
printf(" Index Template: \e[1;30m(-x)\e[0m\t\t%s\n"
" Player Template: \e[1;30m(-t)\e[0m\t\t%s\n",
......@@ -4835,7 +4835,7 @@ main(int ArgC, char **Args)
printf("┌╼ Synchronising with annotation files in Project Input Directory ╾┐\n");
SyncIndexWithInput(&CollationBuffers, IndexTemplate, PlayerTemplate);
if(Config.Mode == MODE_ONESHOT)
if(Config.Mode & MODE_ONESHOT)
{
goto RIP;
}
......@@ -4892,7 +4892,7 @@ NextFile:
}
}
if(Config.Mode == MODE_INTEGRATE)
if(Config.Mode & MODE_INTEGRATE)
{
DeclaimTemplate(PlayerTemplate);
if(Config.Edition == EDITION_PROJECT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment