Fix the few non-portable uses of "char" (where a -1 might be relevant): All uses of char are now either "int", "unsigned char" or char arrays for storing strings. Also, went to consistent "char* foo" coding convention. (There were only a few ambiguous uses.)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25400 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
@@ -93,7 +93,7 @@ ShBinding FixedAttributeBindings[] = {
|
|||||||
ShBindingTable FixedAttributeTable = { 3, FixedAttributeBindings };
|
ShBindingTable FixedAttributeTable = { 3, FixedAttributeBindings };
|
||||||
|
|
||||||
EShLanguage FindLanguage(const std::string& name);
|
EShLanguage FindLanguage(const std::string& name);
|
||||||
void CompileFile(const char *fileName, ShHandle);
|
void CompileFile(const char* fileName, ShHandle);
|
||||||
void usage();
|
void usage();
|
||||||
void FreeFileData(char** data);
|
void FreeFileData(char** data);
|
||||||
char** ReadFileData(const char* fileName);
|
char** ReadFileData(const char* fileName);
|
||||||
@@ -212,7 +212,7 @@ const char* DefaultConfig =
|
|||||||
void ProcessConfigFile()
|
void ProcessConfigFile()
|
||||||
{
|
{
|
||||||
char** configStrings = 0;
|
char** configStrings = 0;
|
||||||
char *config = 0;
|
char* config = 0;
|
||||||
if (ConfigFile.size() > 0) {
|
if (ConfigFile.size() > 0) {
|
||||||
configStrings = ReadFileData(ConfigFile.c_str());
|
configStrings = ReadFileData(ConfigFile.c_str());
|
||||||
if (configStrings)
|
if (configStrings)
|
||||||
@@ -746,7 +746,7 @@ EShLanguage FindLanguage(const std::string& name)
|
|||||||
// Read a file's data into a string, and compile it using the old interface ShCompile,
|
// Read a file's data into a string, and compile it using the old interface ShCompile,
|
||||||
// for non-linkable results.
|
// for non-linkable results.
|
||||||
//
|
//
|
||||||
void CompileFile(const char *fileName, ShHandle compiler)
|
void CompileFile(const char* fileName, ShHandle compiler)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char** shaderStrings = ReadFileData(fileName);
|
char** shaderStrings = ReadFileData(fileName);
|
||||||
@@ -832,8 +832,8 @@ void usage()
|
|||||||
|
|
||||||
int fopen_s(
|
int fopen_s(
|
||||||
FILE** pFile,
|
FILE** pFile,
|
||||||
const char *filename,
|
const char* filename,
|
||||||
const char *mode
|
const char* mode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!pFile || !filename || !mode) {
|
if (!pFile || !filename || !mode) {
|
||||||
@@ -858,11 +858,11 @@ int fopen_s(
|
|||||||
//
|
//
|
||||||
// Malloc a string of sufficient size and read a string into it.
|
// Malloc a string of sufficient size and read a string into it.
|
||||||
//
|
//
|
||||||
char** ReadFileData(const char *fileName)
|
char** ReadFileData(const char* fileName)
|
||||||
{
|
{
|
||||||
FILE *in;
|
FILE *in;
|
||||||
int errorCode = fopen_s(&in, fileName, "r");
|
int errorCode = fopen_s(&in, fileName, "r");
|
||||||
char *fdata;
|
char* fdata;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
const int maxSourceStrings = 5;
|
const int maxSourceStrings = 5;
|
||||||
char** return_data = (char**)malloc(maxSourceStrings+1);
|
char** return_data = (char**)malloc(maxSourceStrings+1);
|
||||||
@@ -879,7 +879,7 @@ char** ReadFileData(const char *fileName)
|
|||||||
fseek(in, 0, SEEK_SET);
|
fseek(in, 0, SEEK_SET);
|
||||||
|
|
||||||
|
|
||||||
if (!(fdata = (char *)malloc(count+2))) {
|
if (!(fdata = (char*)malloc(count+2))) {
|
||||||
printf("Error allocating memory\n");
|
printf("Error allocating memory\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -917,7 +917,7 @@ char** ReadFileData(const char *fileName)
|
|||||||
return return_data;
|
return return_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeFileData(char **data)
|
void FreeFileData(char** data)
|
||||||
{
|
{
|
||||||
for(int i=0;i<NumShaderStrings;i++)
|
for(int i=0;i<NumShaderStrings;i++)
|
||||||
free(data[i]);
|
free(data[i]);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void append(const char *s);
|
void append(const char* s);
|
||||||
|
|
||||||
void append(int count, char c);
|
void append(int count, char c);
|
||||||
void append(const TPersistString& t);
|
void append(const TPersistString& t);
|
||||||
|
|||||||
@@ -900,8 +900,8 @@ public:
|
|||||||
{
|
{
|
||||||
const int maxSize = GlslangMaxTypeLength;
|
const int maxSize = GlslangMaxTypeLength;
|
||||||
char buf[maxSize];
|
char buf[maxSize];
|
||||||
char *p = &buf[0];
|
char* p = &buf[0];
|
||||||
char *end = &buf[maxSize];
|
char* end = &buf[maxSize];
|
||||||
|
|
||||||
if (qualifier.hasLayout()) {
|
if (qualifier.hasLayout()) {
|
||||||
// To reduce noise, skip this if the only layout is an xfb_buffer
|
// To reduce noise, skip this if the only layout is an xfb_buffer
|
||||||
|
|||||||
@@ -9,5 +9,5 @@
|
|||||||
// source have to figure out how to create revision.h just to get a build
|
// source have to figure out how to create revision.h just to get a build
|
||||||
// going. However, if it is not updated, it can be a version behind.
|
// going. However, if it is not updated, it can be a version behind.
|
||||||
|
|
||||||
#define GLSLANG_REVISION "25351"
|
#define GLSLANG_REVISION "25392"
|
||||||
#define GLSLANG_DATE "2014/02/13 12:14:33"
|
#define GLSLANG_DATE "2014/02/18 14:55:42"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
namespace glslang {
|
namespace glslang {
|
||||||
|
|
||||||
void TInfoSinkBase::append(const char *s)
|
void TInfoSinkBase::append(const char* s)
|
||||||
{
|
{
|
||||||
if (outputStream & EString) {
|
if (outputStream & EString) {
|
||||||
checkMem(strlen(s));
|
checkMem(strlen(s));
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ bool TParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& inp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is called from bison when it has a parse (syntax) error
|
// This is called from bison when it has a parse (syntax) error
|
||||||
void TParseContext::parserError(const char *s)
|
void TParseContext::parserError(const char* s)
|
||||||
{
|
{
|
||||||
if (afterEOF) {
|
if (afterEOF) {
|
||||||
if (tokensBeforeEOF == 1)
|
if (tokensBeforeEOF == 1)
|
||||||
@@ -324,8 +324,8 @@ bool TParseContext::parseVectorFields(TSourceLoc loc, const TString& compString,
|
|||||||
//
|
//
|
||||||
// Used to output syntax, parsing, and semantic errors.
|
// Used to output syntax, parsing, and semantic errors.
|
||||||
//
|
//
|
||||||
void C_DECL TParseContext::error(TSourceLoc loc, const char *szReason, const char *szToken,
|
void C_DECL TParseContext::error(TSourceLoc loc, const char* szReason, const char* szToken,
|
||||||
const char *szExtraInfoFormat, ...)
|
const char* szExtraInfoFormat, ...)
|
||||||
{
|
{
|
||||||
const int maxSize = GlslangMaxTokenLength + 200;
|
const int maxSize = GlslangMaxTokenLength + 200;
|
||||||
char szExtraInfo[maxSize];
|
char szExtraInfo[maxSize];
|
||||||
@@ -344,8 +344,8 @@ void C_DECL TParseContext::error(TSourceLoc loc, const char *szReason, const cha
|
|||||||
++numErrors;
|
++numErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_DECL TParseContext::warn(TSourceLoc loc, const char *szReason, const char *szToken,
|
void C_DECL TParseContext::warn(TSourceLoc loc, const char* szReason, const char* szToken,
|
||||||
const char *szExtraInfoFormat, ...)
|
const char* szExtraInfoFormat, ...)
|
||||||
{
|
{
|
||||||
if (messages & EShMsgSuppressWarnings)
|
if (messages & EShMsgSuppressWarnings)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ public:
|
|||||||
|
|
||||||
void setLimits(const TBuiltInResource&);
|
void setLimits(const TBuiltInResource&);
|
||||||
bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false);
|
bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false);
|
||||||
void parserError(const char *s); // for bison's yyerror
|
void parserError(const char* s); // for bison's yyerror
|
||||||
const char* getPreamble();
|
const char* getPreamble();
|
||||||
|
|
||||||
void C_DECL error(TSourceLoc, const char *szReason, const char *szToken,
|
void C_DECL error(TSourceLoc, const char* szReason, const char* szToken,
|
||||||
const char *szExtraInfoFormat, ...);
|
const char* szExtraInfoFormat, ...);
|
||||||
void C_DECL warn(TSourceLoc, const char *szReason, const char *szToken,
|
void C_DECL warn(TSourceLoc, const char* szReason, const char* szToken,
|
||||||
const char *szExtraInfoFormat, ...);
|
const char* szExtraInfoFormat, ...);
|
||||||
void reservedErrorCheck(TSourceLoc, const TString&);
|
void reservedErrorCheck(TSourceLoc, const TString&);
|
||||||
void reservedPpErrorCheck(TSourceLoc, const char* name, const char* op);
|
void reservedPpErrorCheck(TSourceLoc, const char* name, const char* op);
|
||||||
bool lineContinuationCheck(TSourceLoc, bool endOfComment);
|
bool lineContinuationCheck(TSourceLoc, bool endOfComment);
|
||||||
@@ -188,14 +188,14 @@ public:
|
|||||||
|
|
||||||
// The following are implemented in Versions.cpp to localize version/profile/stage/extensions control
|
// The following are implemented in Versions.cpp to localize version/profile/stage/extensions control
|
||||||
void initializeExtensionBehavior();
|
void initializeExtensionBehavior();
|
||||||
void requireProfile(TSourceLoc, int queryProfiles, const char *featureDesc);
|
void requireProfile(TSourceLoc, int queryProfiles, const char* featureDesc);
|
||||||
void profileRequires(TSourceLoc, int queryProfiles, int minVersion, int numExtensions, const char* const extensions[], const char *featureDesc);
|
void profileRequires(TSourceLoc, int queryProfiles, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc);
|
||||||
void profileRequires(TSourceLoc, int queryProfiles, int minVersion, const char* const extension, const char *featureDesc);
|
void profileRequires(TSourceLoc, int queryProfiles, int minVersion, const char* const extension, const char* featureDesc);
|
||||||
void requireStage(TSourceLoc, EShLanguageMask, const char *featureDesc);
|
void requireStage(TSourceLoc, EShLanguageMask, const char* featureDesc);
|
||||||
void requireStage(TSourceLoc, EShLanguage, const char *featureDesc);
|
void requireStage(TSourceLoc, EShLanguage, const char* featureDesc);
|
||||||
void checkDeprecated(TSourceLoc, int queryProfiles, int depVersion, const char *featureDesc);
|
void checkDeprecated(TSourceLoc, int queryProfiles, int depVersion, const char* featureDesc);
|
||||||
void requireNotRemoved(TSourceLoc, int queryProfiles, int removedVersion, const char *featureDesc);
|
void requireNotRemoved(TSourceLoc, int queryProfiles, int removedVersion, const char* featureDesc);
|
||||||
void requireExtensions(TSourceLoc, int numExtensions, const char* const extensions[], const char *featureDesc);
|
void requireExtensions(TSourceLoc, int numExtensions, const char* const extensions[], const char* featureDesc);
|
||||||
TExtensionBehavior getExtensionBehavior(const char*);
|
TExtensionBehavior getExtensionBehavior(const char*);
|
||||||
bool extensionsTurnedOn(int numExtensions, const char* const extensions[]);
|
bool extensionsTurnedOn(int numExtensions, const char* const extensions[]);
|
||||||
void updateExtensionBehavior(const char* const extension, const char* behavior);
|
void updateExtensionBehavior(const char* const extension, const char* behavior);
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ void* TPoolAllocator::allocate(size_t numBytes)
|
|||||||
//
|
//
|
||||||
// Safe to allocate from currentPageOffset.
|
// Safe to allocate from currentPageOffset.
|
||||||
//
|
//
|
||||||
unsigned char* memory = reinterpret_cast<unsigned char *>(inUseList) + currentPageOffset;
|
unsigned char* memory = reinterpret_cast<unsigned char*>(inUseList) + currentPageOffset;
|
||||||
currentPageOffset += allocationSize;
|
currentPageOffset += allocationSize;
|
||||||
currentPageOffset = (currentPageOffset + alignmentMask) & ~alignmentMask;
|
currentPageOffset = (currentPageOffset + alignmentMask) & ~alignmentMask;
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ void* TPoolAllocator::allocate(size_t numBytes)
|
|||||||
new(memory) tHeader(inUseList, 1);
|
new(memory) tHeader(inUseList, 1);
|
||||||
inUseList = memory;
|
inUseList = memory;
|
||||||
|
|
||||||
unsigned char* ret = reinterpret_cast<unsigned char *>(inUseList) + headerSkip;
|
unsigned char* ret = reinterpret_cast<unsigned char*>(inUseList) + headerSkip;
|
||||||
currentPageOffset = (headerSkip + allocationSize + alignmentMask) & ~alignmentMask;
|
currentPageOffset = (headerSkip + allocationSize + alignmentMask) & ~alignmentMask;
|
||||||
|
|
||||||
return initializeAllocation(inUseList, ret, numBytes);
|
return initializeAllocation(inUseList, ret, numBytes);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace glslang {
|
|||||||
// read past any white space
|
// read past any white space
|
||||||
void TInputScanner::consumeWhiteSpace(bool& foundNonSpaceTab)
|
void TInputScanner::consumeWhiteSpace(bool& foundNonSpaceTab)
|
||||||
{
|
{
|
||||||
char c = peek(); // don't accidentally consume anything other than whitespace
|
int c = peek(); // don't accidentally consume anything other than whitespace
|
||||||
while (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
|
while (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
|
||||||
if (c == '\r' || c == '\n')
|
if (c == '\r' || c == '\n')
|
||||||
foundNonSpaceTab = true;
|
foundNonSpaceTab = true;
|
||||||
@@ -72,7 +72,7 @@ bool TInputScanner::consumeComment()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
get(); // consume the '/'
|
get(); // consume the '/'
|
||||||
char c = peek();
|
int c = peek();
|
||||||
if (c == '/') {
|
if (c == '/') {
|
||||||
|
|
||||||
// a '//' style comment
|
// a '//' style comment
|
||||||
@@ -139,7 +139,7 @@ void TInputScanner::consumeWhitespaceComment(bool& foundNonSpaceTab)
|
|||||||
consumeWhiteSpace(foundNonSpaceTab);
|
consumeWhiteSpace(foundNonSpaceTab);
|
||||||
|
|
||||||
// if not starting a comment now, then done
|
// if not starting a comment now, then done
|
||||||
char c = peek();
|
int c = peek();
|
||||||
if (c != '/' || c < 0)
|
if (c != '/' || c < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ bool TInputScanner::scanVersion(int& version, EProfile& profile)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// whitespace
|
// whitespace
|
||||||
char c;
|
int c;
|
||||||
do {
|
do {
|
||||||
c = get();
|
c = get();
|
||||||
} while (c == ' ' || c == '\t');
|
} while (c == ' ' || c == '\t');
|
||||||
|
|||||||
@@ -62,12 +62,12 @@ public:
|
|||||||
// anything else is the next character
|
// anything else is the next character
|
||||||
|
|
||||||
// retrieve the next character and advance one character
|
// retrieve the next character and advance one character
|
||||||
char get()
|
int get()
|
||||||
{
|
{
|
||||||
if (currentSource >= numSources)
|
if (currentSource >= numSources)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
char ret = sources[currentSource][currentChar];
|
int ret = sources[currentSource][currentChar];
|
||||||
if (ret == '\n')
|
if (ret == '\n')
|
||||||
++loc[currentSource].line;
|
++loc[currentSource].line;
|
||||||
advance();
|
advance();
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// retrieve the next character, no advance
|
// retrieve the next character, no advance
|
||||||
char peek()
|
int peek()
|
||||||
{
|
{
|
||||||
if (currentSource >= numSources)
|
if (currentSource >= numSources)
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ const char* ProfileName(EProfile profile)
|
|||||||
// Operation: If the current profile is not one of the profileMask,
|
// Operation: If the current profile is not one of the profileMask,
|
||||||
// give an error message.
|
// give an error message.
|
||||||
//
|
//
|
||||||
void TParseContext::requireProfile(TSourceLoc loc, int profileMask, const char *featureDesc)
|
void TParseContext::requireProfile(TSourceLoc loc, int profileMask, const char* featureDesc)
|
||||||
{
|
{
|
||||||
if (! (profile & profileMask))
|
if (! (profile & profileMask))
|
||||||
error(loc, "not supported with this profile:", featureDesc, ProfileName(profile));
|
error(loc, "not supported with this profile:", featureDesc, ProfileName(profile));
|
||||||
@@ -265,7 +265,7 @@ const char* StageName(EShLanguage stage)
|
|||||||
//
|
//
|
||||||
|
|
||||||
// entry point that takes multiple extensions
|
// entry point that takes multiple extensions
|
||||||
void TParseContext::profileRequires(TSourceLoc loc, int profileMask, int minVersion, int numExtensions, const char* const extensions[], const char *featureDesc)
|
void TParseContext::profileRequires(TSourceLoc loc, int profileMask, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc)
|
||||||
{
|
{
|
||||||
if (profile & profileMask) {
|
if (profile & profileMask) {
|
||||||
bool okay = false;
|
bool okay = false;
|
||||||
@@ -290,7 +290,7 @@ void TParseContext::profileRequires(TSourceLoc loc, int profileMask, int minVers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// entry point for the above that takes a single extension
|
// entry point for the above that takes a single extension
|
||||||
void TParseContext::profileRequires(TSourceLoc loc, int profileMask, int minVersion, const char* extension, const char *featureDesc)
|
void TParseContext::profileRequires(TSourceLoc loc, int profileMask, int minVersion, const char* extension, const char* featureDesc)
|
||||||
{
|
{
|
||||||
profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc);
|
profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc);
|
||||||
}
|
}
|
||||||
@@ -302,7 +302,7 @@ void TParseContext::profileRequires(TSourceLoc loc, int profileMask, int minVers
|
|||||||
//
|
//
|
||||||
// Operation: If the current stage is not present, give an error message.
|
// Operation: If the current stage is not present, give an error message.
|
||||||
//
|
//
|
||||||
void TParseContext::requireStage(TSourceLoc loc, EShLanguageMask languageMask, const char *featureDesc)
|
void TParseContext::requireStage(TSourceLoc loc, EShLanguageMask languageMask, const char* featureDesc)
|
||||||
{
|
{
|
||||||
if (((1 << language) & languageMask) == 0)
|
if (((1 << language) & languageMask) == 0)
|
||||||
error(loc, "not supported in this stage:", featureDesc, StageName(language));
|
error(loc, "not supported in this stage:", featureDesc, StageName(language));
|
||||||
@@ -310,7 +310,7 @@ void TParseContext::requireStage(TSourceLoc loc, EShLanguageMask languageMask, c
|
|||||||
|
|
||||||
// If only one stage supports a feature, this can be called. But, all supporting stages
|
// If only one stage supports a feature, this can be called. But, all supporting stages
|
||||||
// must be specified with one call.
|
// must be specified with one call.
|
||||||
void TParseContext::requireStage(TSourceLoc loc, EShLanguage stage, const char *featureDesc)
|
void TParseContext::requireStage(TSourceLoc loc, EShLanguage stage, const char* featureDesc)
|
||||||
{
|
{
|
||||||
requireStage(loc, static_cast<EShLanguageMask>(1 << stage), featureDesc);
|
requireStage(loc, static_cast<EShLanguageMask>(1 << stage), featureDesc);
|
||||||
}
|
}
|
||||||
@@ -319,7 +319,7 @@ void TParseContext::requireStage(TSourceLoc loc, EShLanguage stage, const char *
|
|||||||
// Within a set of profiles, see if a feature is deprecated and give an error or warning based on whether
|
// Within a set of profiles, see if a feature is deprecated and give an error or warning based on whether
|
||||||
// a future compatibility context is being use.
|
// a future compatibility context is being use.
|
||||||
//
|
//
|
||||||
void TParseContext::checkDeprecated(TSourceLoc loc, int profileMask, int depVersion, const char *featureDesc)
|
void TParseContext::checkDeprecated(TSourceLoc loc, int profileMask, int depVersion, const char* featureDesc)
|
||||||
{
|
{
|
||||||
if (profile & profileMask) {
|
if (profile & profileMask) {
|
||||||
if (version >= depVersion) {
|
if (version >= depVersion) {
|
||||||
@@ -336,7 +336,7 @@ void TParseContext::checkDeprecated(TSourceLoc loc, int profileMask, int depVers
|
|||||||
// Within a set of profiles, see if a feature has now been removed and if so, give an error.
|
// Within a set of profiles, see if a feature has now been removed and if so, give an error.
|
||||||
// The version argument is the first version no longer having the feature.
|
// The version argument is the first version no longer having the feature.
|
||||||
//
|
//
|
||||||
void TParseContext::requireNotRemoved(TSourceLoc loc, int profileMask, int removedVersion, const char *featureDesc)
|
void TParseContext::requireNotRemoved(TSourceLoc loc, int profileMask, int removedVersion, const char* featureDesc)
|
||||||
{
|
{
|
||||||
if (profile & profileMask) {
|
if (profile & profileMask) {
|
||||||
if (version >= removedVersion) {
|
if (version >= removedVersion) {
|
||||||
@@ -352,7 +352,7 @@ void TParseContext::requireNotRemoved(TSourceLoc loc, int profileMask, int remov
|
|||||||
// Use when there are no profile/version to check, it's just an error if one of the
|
// Use when there are no profile/version to check, it's just an error if one of the
|
||||||
// extensions is not present.
|
// extensions is not present.
|
||||||
//
|
//
|
||||||
void TParseContext::requireExtensions(TSourceLoc loc, int numExtensions, const char* const extensions[], const char *featureDesc)
|
void TParseContext::requireExtensions(TSourceLoc loc, int numExtensions, const char* const extensions[], const char* featureDesc)
|
||||||
{
|
{
|
||||||
// First, see if any of the extensions are enabled
|
// First, see if any of the extensions are enabled
|
||||||
for (int i = 0; i < numExtensions; ++i) {
|
for (int i = 0; i < numExtensions; ++i) {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ using namespace glslang;
|
|||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
int val;
|
int val;
|
||||||
const char *str;
|
const char* str;
|
||||||
} tokens[] = {
|
} tokens[] = {
|
||||||
{ CPP_AND_OP, "&&" },
|
{ CPP_AND_OP, "&&" },
|
||||||
{ CPP_AND_ASSIGN, "&=" },
|
{ CPP_AND_ASSIGN, "&=" },
|
||||||
@@ -128,7 +128,7 @@ namespace glslang {
|
|||||||
//
|
//
|
||||||
// Map a new or existing string to an atom, inventing a new atom if necessary.
|
// Map a new or existing string to an atom, inventing a new atom if necessary.
|
||||||
//
|
//
|
||||||
int TPpContext::LookUpAddString(const char *s)
|
int TPpContext::LookUpAddString(const char* s)
|
||||||
{
|
{
|
||||||
TAtomMap::const_iterator it = atomMap.find(s);
|
TAtomMap::const_iterator it = atomMap.find(s);
|
||||||
if (it == atomMap.end())
|
if (it == atomMap.end())
|
||||||
@@ -140,7 +140,7 @@ int TPpContext::LookUpAddString(const char *s)
|
|||||||
//
|
//
|
||||||
// Map an already created atom to its string.
|
// Map an already created atom to its string.
|
||||||
//
|
//
|
||||||
const char *TPpContext::GetAtomString(int atom)
|
const char* TPpContext::GetAtomString(int atom)
|
||||||
{
|
{
|
||||||
if (atom == 0)
|
if (atom == 0)
|
||||||
return "<null atom>";
|
return "<null atom>";
|
||||||
@@ -159,7 +159,7 @@ const char *TPpContext::GetAtomString(int atom)
|
|||||||
//
|
//
|
||||||
// Add forced mapping of string to atom.
|
// Add forced mapping of string to atom.
|
||||||
//
|
//
|
||||||
int TPpContext::AddAtomFixed(const char *s, int atom)
|
int TPpContext::AddAtomFixed(const char* s, int atom)
|
||||||
{
|
{
|
||||||
TAtomMap::const_iterator it = atomMap.insert(std::pair<TString, int>(s, atom)).first;
|
TAtomMap::const_iterator it = atomMap.insert(std::pair<TString, int>(s, atom)).first;
|
||||||
if (stringMap.size() < (size_t)atom + 1)
|
if (stringMap.size() < (size_t)atom + 1)
|
||||||
@@ -175,7 +175,7 @@ int TPpContext::AddAtomFixed(const char *s, int atom)
|
|||||||
void TPpContext::InitAtomTable()
|
void TPpContext::InitAtomTable()
|
||||||
{
|
{
|
||||||
// Add single character tokens to the atom table:
|
// Add single character tokens to the atom table:
|
||||||
const char *s = "~!%^&*()-+=|,.<>/?;:[]{}#";
|
const char* s = "~!%^&*()-+=|,.<>/?;:[]{}#";
|
||||||
char t[2];
|
char t[2];
|
||||||
|
|
||||||
t[1] = '\0';
|
t[1] = '\0';
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ protected:
|
|||||||
int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor)
|
int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor)
|
||||||
bool elseSeen[maxIfNesting]; // Keep a track of whether an else has been seen at a particular depth
|
bool elseSeen[maxIfNesting]; // Keep a track of whether an else has been seen at a particular depth
|
||||||
int elsetracker; // #if-#else and #endif constructs...Counter.
|
int elsetracker; // #if-#else and #endif constructs...Counter.
|
||||||
const char *ErrMsg;
|
const char* ErrMsg;
|
||||||
|
|
||||||
class tMacroInput : public tInput {
|
class tMacroInput : public tInput {
|
||||||
public:
|
public:
|
||||||
@@ -371,17 +371,17 @@ protected:
|
|||||||
class tStringInput : public tInput {
|
class tStringInput : public tInput {
|
||||||
public:
|
public:
|
||||||
tStringInput(TPpContext* pp, TInputScanner& i) : tInput(pp), input(&i) { }
|
tStringInput(TPpContext* pp, TInputScanner& i) : tInput(pp), input(&i) { }
|
||||||
virtual int scan(TPpToken *);
|
virtual int scan(TPpToken*);
|
||||||
virtual int getch();
|
virtual int getch();
|
||||||
virtual void ungetch();
|
virtual void ungetch();
|
||||||
protected:
|
protected:
|
||||||
TInputScanner* input;
|
TInputScanner* input;
|
||||||
};
|
};
|
||||||
|
|
||||||
int InitScanner(TPpContext *cpp);
|
int InitScanner(TPpContext* cpp);
|
||||||
int ScanFromString(char *s);
|
int ScanFromString(char* s);
|
||||||
void missingEndifCheck();
|
void missingEndifCheck();
|
||||||
int lFloatConst(char *str, int len, int ch, TPpToken * ppToken);
|
int lFloatConst(char* str, int len, int ch, TPpToken* ppToken);
|
||||||
|
|
||||||
bool inComment;
|
bool inComment;
|
||||||
|
|
||||||
@@ -394,17 +394,17 @@ protected:
|
|||||||
TStringMap stringMap;
|
TStringMap stringMap;
|
||||||
int nextAtom;
|
int nextAtom;
|
||||||
void InitAtomTable();
|
void InitAtomTable();
|
||||||
int AddAtomFixed(const char *s, int atom);
|
int AddAtomFixed(const char* s, int atom);
|
||||||
int LookUpAddString(const char *s);
|
int LookUpAddString(const char* s);
|
||||||
const char *GetAtomString(int atom);
|
const char* GetAtomString(int atom);
|
||||||
|
|
||||||
//
|
//
|
||||||
// From PpMemory.cpp
|
// From PpMemory.cpp
|
||||||
//
|
//
|
||||||
MemoryPool *mem_CreatePool(size_t chunksize, unsigned align);
|
MemoryPool *mem_CreatePool(size_t chunksize, unsigned align);
|
||||||
void mem_FreePool(MemoryPool *);
|
void mem_FreePool(MemoryPool*);
|
||||||
void *mem_Alloc(MemoryPool *p, size_t size);
|
void *mem_Alloc(MemoryPool* p, size_t size);
|
||||||
int mem_AddCleanup(MemoryPool *p, void (*fn)(void *, void*), void *arg1, void* arg2);
|
int mem_AddCleanup(MemoryPool* p, void (*fn)(void *, void*), void* arg1, void* arg2);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|||||||
@@ -98,15 +98,15 @@ namespace glslang {
|
|||||||
*/
|
*/
|
||||||
TPpContext::Symbol* TPpContext::NewSymbol(int atom)
|
TPpContext::Symbol* TPpContext::NewSymbol(int atom)
|
||||||
{
|
{
|
||||||
Symbol *lSymb;
|
Symbol* lSymb;
|
||||||
char *pch;
|
char* pch;
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
lSymb = (Symbol *) mem_Alloc(pool, sizeof(Symbol));
|
lSymb = (Symbol *) mem_Alloc(pool, sizeof(Symbol));
|
||||||
lSymb->atom = atom;
|
lSymb->atom = atom;
|
||||||
|
|
||||||
// Clear macro
|
// Clear macro
|
||||||
pch = (char *) &lSymb->mac;
|
pch = (char*) &lSymb->mac;
|
||||||
for (ii = 0; ii < sizeof(lSymb->mac); ii++)
|
for (ii = 0; ii < sizeof(lSymb->mac); ii++)
|
||||||
*pch++ = 0;
|
*pch++ = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ int TPpContext::lReadByte(TokenStream *pTok)
|
|||||||
*/
|
*/
|
||||||
void TPpContext::RecordToken(TokenStream *pTok, int token, TPpToken* ppToken)
|
void TPpContext::RecordToken(TokenStream *pTok, int token, TPpToken* ppToken)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char* s;
|
||||||
char *str = NULL;
|
char* str = NULL;
|
||||||
|
|
||||||
if (token > 256)
|
if (token > 256)
|
||||||
lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
|
lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
|
||||||
@@ -164,7 +164,7 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
|||||||
{
|
{
|
||||||
char tokenText[TPpToken::maxTokenLength + 1];
|
char tokenText[TPpToken::maxTokenLength + 1];
|
||||||
int ltoken, len;
|
int ltoken, len;
|
||||||
char ch;
|
int ch;
|
||||||
|
|
||||||
ltoken = lReadByte(pTok);
|
ltoken = lReadByte(pTok);
|
||||||
ppToken->loc = parseContext.getCurrentLoc();
|
ppToken->loc = parseContext.getCurrentLoc();
|
||||||
|
|||||||
Reference in New Issue
Block a user