Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add expression function evaluation, and endianness() function to retr…
…ieve endianness of current platform
- Loading branch information
Showing
9 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "stdafx.h" | ||
#include "ExpressionFunctions.h" | ||
#include "Misc.h" | ||
#include "Common.h" | ||
|
||
ExpressionValue expressionFunctionEndianness(const std::vector<ExpressionValue>& parameters) | ||
{ | ||
Endianness endianness = g_fileManager->getEndianness(); | ||
|
||
ExpressionValue result; | ||
result.type = ExpressionValueType::String; | ||
|
||
switch (endianness) | ||
{ | ||
case Endianness::Little: | ||
result.strValue = L"little"; | ||
break; | ||
case Endianness::Big: | ||
result.strValue = L"big"; | ||
break; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
const ExpressionFunctionMap expressionFunctions = { | ||
{ L"endianness", { &expressionFunctionEndianness, 0, 0 } }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#include "Expression.h" | ||
#include <map> | ||
|
||
typedef ExpressionValue (*ExpressionFunction)(const std::vector<ExpressionValue>&); | ||
|
||
struct ExpressionFunctionEntry { | ||
ExpressionFunction function; | ||
size_t minParams; | ||
size_t maxParams; | ||
}; | ||
|
||
typedef std::map<std::wstring, const ExpressionFunctionEntry> ExpressionFunctionMap; | ||
|
||
extern const ExpressionFunctionMap expressionFunctions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters