|
@@ -175,11 +175,12 @@ static bool getHomeFolder(StringBuffer & homepath)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-struct EclCompileInstance
|
|
|
+class EclCC;
|
|
|
+struct EclCompileInstance : public CInterfaceOf<ICodegenContextCallback>
|
|
|
{
|
|
|
public:
|
|
|
- EclCompileInstance(IFile * _inputFile, IErrorReceiver & _errorProcessor, FILE * _errout, const char * _outputFilename, bool _legacyImport, bool _legacyWhen, bool _ignoreSignatures, bool _optXml) :
|
|
|
- inputFile(_inputFile), errorProcessor(&_errorProcessor), errout(_errout), outputFilename(_outputFilename), legacyImport(_legacyImport), legacyWhen(_legacyWhen), ignoreSignatures(_ignoreSignatures), optXml(_optXml)
|
|
|
+ EclCompileInstance(EclCC & _eclcc, IFile * _inputFile, IErrorReceiver & _errorProcessor, FILE * _errout, const char * _outputFilename, bool _legacyImport, bool _legacyWhen, bool _ignoreSignatures, bool _optXml) :
|
|
|
+ eclcc(_eclcc), inputFile(_inputFile), errorProcessor(&_errorProcessor), errout(_errout), outputFilename(_outputFilename), legacyImport(_legacyImport), legacyWhen(_legacyWhen), ignoreSignatures(_ignoreSignatures), optXml(_optXml)
|
|
|
{
|
|
|
stats.parseTime = 0;
|
|
|
stats.generateTime = 0;
|
|
@@ -192,8 +193,17 @@ public:
|
|
|
bool reportErrorSummary();
|
|
|
inline IErrorReceiver & queryErrorProcessor() { return *errorProcessor; }
|
|
|
|
|
|
+// interface ICodegenContextCallback
|
|
|
+ virtual void noteCluster(const char *clusterName) override;
|
|
|
+ virtual void pushCluster(const char *clusterName) override;
|
|
|
+ virtual void popCluster() override;
|
|
|
+ virtual bool allowAccess(const char * category, bool isSigned) override;
|
|
|
+ virtual IHqlExpression *lookupDFSlayout(const char *filename, IErrorReceiver &errs, const ECLlocation &location, bool isOpt) const override;
|
|
|
+ virtual unsigned lookupClusterSize() const override;
|
|
|
+ virtual void getTargetPlatform(StringBuffer & result) override;
|
|
|
|
|
|
public:
|
|
|
+ EclCC & eclcc;
|
|
|
Linked<IFile> inputFile;
|
|
|
Linked<IPropertyTree> archive;
|
|
|
Linked<IWorkUnit> wu;
|
|
@@ -223,7 +233,7 @@ protected:
|
|
|
Linked<IErrorReceiver> errorProcessor;
|
|
|
};
|
|
|
|
|
|
-class EclCC : public CInterfaceOf<ICodegenContextCallback>
|
|
|
+class EclCC
|
|
|
{
|
|
|
public:
|
|
|
EclCC(int _argc, const char **_argv)
|
|
@@ -257,12 +267,12 @@ public:
|
|
|
|
|
|
// interface ICodegenContextCallback
|
|
|
|
|
|
- virtual void noteCluster(const char *clusterName) override;
|
|
|
- virtual void pushCluster(const char *clusterName) override;
|
|
|
- virtual void popCluster() override;
|
|
|
- virtual bool allowAccess(const char * category, bool isSigned) override;
|
|
|
- virtual IHqlExpression *lookupDFSlayout(const char *filename, IErrorReceiver &errs, const ECLlocation &location, bool isOpt) const override;
|
|
|
- virtual unsigned lookupClusterSize() const override;
|
|
|
+ void pushCluster(const char *clusterName);
|
|
|
+ void popCluster();
|
|
|
+ bool allowAccess(const char * category, bool isSigned);
|
|
|
+ IHqlExpression *lookupDFSlayout(const char *filename, IErrorReceiver &errs, const ECLlocation &location, bool isOpt) const;
|
|
|
+ unsigned lookupClusterSize() const;
|
|
|
+ void getTargetPlatform(StringBuffer & result);
|
|
|
|
|
|
protected:
|
|
|
bool checkDaliConnected() const;
|
|
@@ -775,7 +785,7 @@ void EclCC::instantECL(EclCompileInstance & instance, IWorkUnit *wu, const char
|
|
|
bool optSaveCpp = optSaveTemps || optNoCompile || wu->getDebugValueBool("saveCppTempFiles", false) || wu->getDebugValueBool("saveCpp", false);
|
|
|
//New scope - testing things are linked correctly
|
|
|
{
|
|
|
- Owned<IHqlExprDllGenerator> generator = createDllGenerator(&errorProcessor, processName.str(), NULL, wu, templateDir, optTargetClusterType, this, false, false);
|
|
|
+ Owned<IHqlExprDllGenerator> generator = createDllGenerator(&errorProcessor, processName.str(), NULL, wu, templateDir, optTargetClusterType, &instance, false, false);
|
|
|
|
|
|
setWorkunitHash(wu, instance.query);
|
|
|
if (!optShared)
|
|
@@ -1135,7 +1145,7 @@ void EclCC::processSingleQuery(EclCompileInstance & instance,
|
|
|
|
|
|
{
|
|
|
//Minimize the scope of the parse context to reduce lifetime of cached items.
|
|
|
- HqlParseContext parseCtx(instance.dataServer, this, instance.archive);
|
|
|
+ HqlParseContext parseCtx(instance.dataServer, &instance, instance.archive);
|
|
|
if (optFastSyntax)
|
|
|
parseCtx.setFastSyntax();
|
|
|
unsigned maxErrorsDebugOption = instance.wu->getDebugValueInt("maxErrors", 0);
|
|
@@ -1924,7 +1934,7 @@ bool EclCC::processFiles()
|
|
|
else if (inputFiles.ordinality() == 0)
|
|
|
{
|
|
|
assertex(optQueryRepositoryReference);
|
|
|
- EclCompileInstance info(NULL, *errs, stderr, optOutputFilename, optLegacyImport, optLegacyWhen, optIgnoreSignatures, optXml);
|
|
|
+ EclCompileInstance info(*this, NULL, *errs, stderr, optOutputFilename, optLegacyImport, optLegacyWhen, optIgnoreSignatures, optXml);
|
|
|
processReference(info, optQueryRepositoryReference);
|
|
|
ok = (errs->errCount() == 0);
|
|
|
|
|
@@ -1932,7 +1942,7 @@ bool EclCC::processFiles()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- EclCompileInstance info(&inputFiles.item(0), *errs, stderr, optOutputFilename, optLegacyImport, optLegacyWhen, optIgnoreSignatures, optXml);
|
|
|
+ EclCompileInstance info(*this, &inputFiles.item(0), *errs, stderr, optOutputFilename, optLegacyImport, optLegacyWhen, optIgnoreSignatures, optXml);
|
|
|
processFile(info);
|
|
|
ok = (errs->errCount() == 0);
|
|
|
|
|
@@ -2014,10 +2024,44 @@ bool EclCompileInstance::reportErrorSummary()
|
|
|
return errorProcessor->errCount() != 0;
|
|
|
}
|
|
|
|
|
|
-//=========================================================================================
|
|
|
+void EclCompileInstance::noteCluster(const char *clusterName)
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void EclCompileInstance::pushCluster(const char *clusterName)
|
|
|
+{
|
|
|
+ eclcc.pushCluster(clusterName);
|
|
|
+}
|
|
|
|
|
|
-void EclCC::noteCluster(const char *clusterName)
|
|
|
+void EclCompileInstance::popCluster()
|
|
|
{
|
|
|
+ eclcc.popCluster();
|
|
|
+}
|
|
|
+
|
|
|
+unsigned EclCompileInstance::lookupClusterSize() const
|
|
|
+{
|
|
|
+ return eclcc.lookupClusterSize();
|
|
|
+}
|
|
|
+
|
|
|
+bool EclCompileInstance::allowAccess(const char * category, bool isSigned)
|
|
|
+{
|
|
|
+ return eclcc.allowAccess(category, isSigned);
|
|
|
+}
|
|
|
+
|
|
|
+IHqlExpression * EclCompileInstance::lookupDFSlayout(const char *filename, IErrorReceiver &errs, const ECLlocation &location, bool isOpt) const
|
|
|
+{
|
|
|
+ return eclcc.lookupDFSlayout(filename, errs, location, isOpt);
|
|
|
+}
|
|
|
+
|
|
|
+void EclCompileInstance::getTargetPlatform(StringBuffer & result)
|
|
|
+{
|
|
|
+ SCMStringBuffer targetText;
|
|
|
+ wu->getDebugValue("targetClusterType", targetText);
|
|
|
+ ClusterType clusterType = getClusterType(targetText.s.str());
|
|
|
+ if (clusterType != NoCluster)
|
|
|
+ result.append(clusterTypeString(clusterType, true));
|
|
|
+ else
|
|
|
+ return eclcc.getTargetPlatform(result);
|
|
|
}
|
|
|
|
|
|
void EclCC::pushCluster(const char *clusterName)
|
|
@@ -2229,6 +2273,11 @@ bool EclCC::allowAccess(const char * category, bool isSigned)
|
|
|
return defaultAllowed[isSigned];
|
|
|
}
|
|
|
|
|
|
+void EclCC::getTargetPlatform(StringBuffer & result)
|
|
|
+{
|
|
|
+ result.append(clusterTypeString(optTargetClusterType, true));
|
|
|
+}
|
|
|
+
|
|
|
//=========================================================================================
|
|
|
int EclCC::parseCommandLineOptions(int argc, const char* argv[])
|
|
|
{
|
|
@@ -2679,7 +2728,7 @@ void EclCC::processBatchedFile(IFile & file, bool multiThreaded)
|
|
|
}
|
|
|
|
|
|
Owned<IErrorReceiver> localErrs = createFileErrorReceiver(logFile);
|
|
|
- EclCompileInstance info(&file, *localErrs, logFile, outFilename, optLegacyImport, optLegacyWhen, optIgnoreSignatures, optXml);
|
|
|
+ EclCompileInstance info(*this, &file, *localErrs, logFile, outFilename, optLegacyImport, optLegacyWhen, optIgnoreSignatures, optXml);
|
|
|
info.metaOutputFilename.set(metaFilename);
|
|
|
processFile(info);
|
|
|
if (info.wu &&
|