Skip to content

Commit

Permalink
sclang: rename gLibraryConfig to gLanguageConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Blechmann <tim@klingt.org>
  • Loading branch information
timblechmann committed Sep 27, 2012
1 parent be5dcda commit fb13d4e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion include/lang/SC_LibraryConfig.h
Expand Up @@ -105,6 +105,6 @@ class SC_LanguageConfig
DirVector mExcludedDirectories;
};

extern SC_LanguageConfig* gLibraryConfig;
extern SC_LanguageConfig* gLanguageConfig;

#endif // SC_LIBRARYCONFIG_H_INCLUDED
14 changes: 7 additions & 7 deletions lang/LangPrimSource/PyrPrimitive.cpp
Expand Up @@ -3438,8 +3438,8 @@ static int prLanguageConfig_getLibraryPaths(struct VMGlobals * g, int numArgsPus

typedef SC_LanguageConfig::DirVector DirVector;

DirVector const & dirVector = (pathType == includePaths) ? gLibraryConfig->includedDirectories()
: gLibraryConfig->excludedDirectories();
DirVector const & dirVector = (pathType == includePaths) ? gLanguageConfig->includedDirectories()
: gLanguageConfig->excludedDirectories();

size_t numberOfPaths = dirVector.size();
PyrObject * resultArray = newPyrArray(g->gc, numberOfPaths, 0, true);
Expand Down Expand Up @@ -3471,9 +3471,9 @@ static int prLanguageConfig_addLibraryPath(struct VMGlobals * g, int numArgsPush
return errWrongType;

if (pathType == includePaths)
gLibraryConfig->addIncludedDirectory(path);
gLanguageConfig->addIncludedDirectory(path);
else
gLibraryConfig->addExcludedDirectory(path);
gLanguageConfig->addExcludedDirectory(path);
return errNone;
}

Expand All @@ -3497,9 +3497,9 @@ static int prLanguageConfig_removeLibraryPath(struct VMGlobals * g, int numArgsP
return errWrongType;

if (pathType == includePaths)
gLibraryConfig->removeIncludedDirectory(path);
gLanguageConfig->removeIncludedDirectory(path);
else
gLibraryConfig->removeExcludedDirectory(path);
gLanguageConfig->removeExcludedDirectory(path);
return errNone;
}

Expand Down Expand Up @@ -3527,7 +3527,7 @@ static int prLanguageConfig_writeConfigFile(struct VMGlobals * g, int numArgsPus
sc_AppendToPath(path, MAXPATHLEN, "sclang_conf.yaml");
}

gLibraryConfig->writeLibraryConfigYAML(path);
gLanguageConfig->writeLibraryConfigYAML(path);
return errNone;
}

Expand Down
8 changes: 4 additions & 4 deletions lang/LangSource/PyrLexer.cpp
Expand Up @@ -1923,7 +1923,7 @@ static bool passOne_ProcessDir(const char *dirname, int level)

bool success = true;

if (gLibraryConfig && gLibraryConfig->pathIsExcluded(dirname)) {
if (gLanguageConfig && gLanguageConfig->pathIsExcluded(dirname)) {
post("\texcluding dir: '%s'\n", dirname);
return success;
}
Expand Down Expand Up @@ -1966,7 +1966,7 @@ bool passOne()
if (!passOne_ProcessDir(gCompileDir, 0))
return false;
} else
if (!gLibraryConfig->forEachIncludedDirectory(passOne_ProcessDir))
if (!gLanguageConfig->forEachIncludedDirectory(passOne_ProcessDir))
return false;

finiPassOne();
Expand Down Expand Up @@ -2005,7 +2005,7 @@ bool passOne_ProcessOneFile(const char * filenamearg, int level)
return success;
}

if (gLibraryConfig && gLibraryConfig->pathIsExcluded(filename)) {
if (gLanguageConfig && gLanguageConfig->pathIsExcluded(filename)) {
post("\texcluding file: '%s'\n", filename);
return success;
}
Expand Down Expand Up @@ -2118,7 +2118,7 @@ SC_DLLEXPORT_C bool compileLibrary()
compiledOK = false;

// FIXME: the library config should have been initialized earlier!
if (!gLibraryConfig)
if (!gLanguageConfig)
SC_LanguageConfig::readDefaultLibraryConfig();

compileStartTime = elapsedTime();
Expand Down
34 changes: 17 additions & 17 deletions lang/LangSource/SC_LibraryConfig.cpp
Expand Up @@ -45,7 +45,7 @@

using namespace std;

SC_LanguageConfig *gLibraryConfig = 0;
SC_LanguageConfig *gLanguageConfig = 0;

void SC_LanguageConfig::postExcludedDirectories(void)
{
Expand Down Expand Up @@ -117,14 +117,14 @@ void SC_LanguageConfig::removeExcludedDirectory(const char *path)
bool SC_LanguageConfig::readLibraryConfig(const char* fileName)
{
freeLibraryConfig();
gLibraryConfig = new SC_LanguageConfig();
gLanguageConfig = new SC_LanguageConfig();

SC_LibraryConfigFile file(::post);
bool success = file.open(fileName);
if (!success)
return false;

bool error = file.read(fileName, gLibraryConfig);
bool error = file.read(fileName, gLanguageConfig);
file.close();

if (!error)
Expand All @@ -138,7 +138,7 @@ extern bool gPostInlineWarnings;
bool SC_LanguageConfig::readLibraryConfigYAML(const char* fileName)
{
freeLibraryConfig();
gLibraryConfig = new SC_LanguageConfig();
gLanguageConfig = new SC_LanguageConfig();

using namespace YAML;
try {
Expand All @@ -155,7 +155,7 @@ bool SC_LanguageConfig::readLibraryConfigYAML(const char* fileName)
continue;
string path;
pathNode.GetScalar(path);
gLibraryConfig->addIncludedDirectory(path.c_str());
gLanguageConfig->addIncludedDirectory(path.c_str());
}
}

Expand All @@ -167,7 +167,7 @@ bool SC_LanguageConfig::readLibraryConfigYAML(const char* fileName)
continue;
string path;
pathNode.GetScalar(path);
gLibraryConfig->addExcludedDirectory(path.c_str());
gLanguageConfig->addExcludedDirectory(path.c_str());
}
}

Expand Down Expand Up @@ -202,15 +202,15 @@ bool SC_LanguageConfig::writeLibraryConfigYAML(const char* fileName)

out << Key << "includePaths";
out << Value << BeginSeq;
for (DirVector::iterator it = gLibraryConfig->mIncludedDirectories.begin();
it != gLibraryConfig->mIncludedDirectories.end(); ++it)
for (DirVector::iterator it = gLanguageConfig->mIncludedDirectories.begin();
it != gLanguageConfig->mIncludedDirectories.end(); ++it)
out << *it;
out << EndSeq;

out << Key << "excludePaths";
out << Value << BeginSeq;
for (DirVector::iterator it = gLibraryConfig->mExcludedDirectories.begin();
it != gLibraryConfig->mExcludedDirectories.end(); ++it)
for (DirVector::iterator it = gLanguageConfig->mExcludedDirectories.begin();
it != gLanguageConfig->mExcludedDirectories.end(); ++it)
out << *it;
out << EndSeq;

Expand All @@ -226,22 +226,22 @@ bool SC_LanguageConfig::writeLibraryConfigYAML(const char* fileName)
bool SC_LanguageConfig::defaultLibraryConfig(void)
{
freeLibraryConfig();
gLibraryConfig = new SC_LanguageConfig();
gLanguageConfig = new SC_LanguageConfig();

char compileDir[MAXPATHLEN];
char systemExtensionDir[MAXPATHLEN];
char userExtensionDir[MAXPATHLEN];

sc_GetResourceDirectory(compileDir, MAXPATHLEN-32);
sc_AppendToPath(compileDir, MAXPATHLEN, "SCClassLibrary");
gLibraryConfig->addIncludedDirectory(compileDir);
gLanguageConfig->addIncludedDirectory(compileDir);

if (!sc_IsStandAlone()) {
sc_GetSystemExtensionDirectory(systemExtensionDir, MAXPATHLEN);
gLibraryConfig->addIncludedDirectory(systemExtensionDir);
gLanguageConfig->addIncludedDirectory(systemExtensionDir);

sc_GetUserExtensionDirectory(userExtensionDir, MAXPATHLEN);
gLibraryConfig->addIncludedDirectory(userExtensionDir);
gLanguageConfig->addIncludedDirectory(userExtensionDir);
}
return true;
}
Expand Down Expand Up @@ -309,9 +309,9 @@ bool SC_LanguageConfig::readDefaultLibraryConfig()

void SC_LanguageConfig::freeLibraryConfig()
{
if (gLibraryConfig) {
delete gLibraryConfig;
gLibraryConfig = 0;
if (gLanguageConfig) {
delete gLanguageConfig;
gLanguageConfig = 0;
}
}

Expand Down

0 comments on commit fb13d4e

Please sign in to comment.