Skip to content

Commit

Permalink
- added OSC 1.3 specific expressions (sin,cos,...)
Browse files Browse the repository at this point in the history
- update to version 1.4.0
  • Loading branch information
kmfrank committed Aug 21, 2024
1 parent 4e92a41 commit fa187a4
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 32 deletions.
10 changes: 5 additions & 5 deletions cpp/applications/expressionsTester/rc/expressionsTester.rc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,3,0,0 // e.g. 19,11,39,707
FILEVERSION 1,4,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,4,0,0 // e.g. 19,11,39,707
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -75,15 +75,15 @@ BEGIN
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "Comments", "OpenSCENARIO Standard 1.2.0"
VALUE "Comments", "OpenSCENARIO Standard 1.3.0"
VALUE "CompanyName", "RA Consulting GmbH - Zeiloch 6a - 76646 Bruchsal - Germany" // e.g. RA Consulting GmbH -> companyInfo.txt
VALUE "FileDescription", "" // e.g. Web Service -> productInfo.txt
VALUE "FileVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "FileVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "InternalName", "ExpressionsTester.exe"
VALUE "LegalCopyright", "Copyright (C) 2024 by RA Consulting GmbH" // e.g. Copyright (C) 2019 -> companyInfo.txt + autogen by CMakeList.txt
VALUE "OriginalFilename", "ExpressionsTester.exe"
VALUE "ProductName", "OpenScenarioTester" // e.g. Web Service -> productInfo.txt
VALUE "ProductVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "ProductVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
END
END
BLOCK "VarFileInfo"
Expand Down
10 changes: 5 additions & 5 deletions cpp/applications/indexerTester/rc/IndexerTester.rc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,3,0,0 // e.g. 19,11,39,707
FILEVERSION 1,4,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,4,0,0 // e.g. 19,11,39,707
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -75,15 +75,15 @@ BEGIN
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "Comments", "OpenSCENARIO Standard 1.2.0"
VALUE "Comments", "OpenSCENARIO Standard 1.3.0"
VALUE "CompanyName", "RA Consulting GmbH - Zeiloch 6a - 76646 Bruchsal - Germany" // e.g. RA Consulting GmbH -> companyInfo.txt
VALUE "FileDescription", "" // e.g. Web Service -> productInfo.txt
VALUE "FileVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "FileVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "InternalName", "IndexerTester.exe"
VALUE "LegalCopyright", "Copyright (C) 2024 by RA Consulting GmbH" // e.g. Copyright (C) 2019 -> companyInfo.txt + autogen by CMakeList.txt
VALUE "OriginalFilename", "IndexerTester.exe"
VALUE "ProductName", "IndexerTester" // e.g. Web Service -> productInfo.txt
VALUE "ProductVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "ProductVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
END
END
BLOCK "VarFileInfo"
Expand Down
10 changes: 5 additions & 5 deletions cpp/applications/openScenarioReader/rc/OpenScenarioReader.rc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,3,0,0 // e.g. 19,11,39,707
FILEVERSION 1,4,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,4,0,0 // e.g. 19,11,39,707
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -75,15 +75,15 @@ BEGIN
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "Comments", "OpenSCENARIO Standard 1.2.0"
VALUE "Comments", "OpenSCENARIO Standard 1.3.0"
VALUE "CompanyName", "RA Consulting GmbH - Zeiloch 6a - 76646 Bruchsal - Germany" // e.g. RA Consulting GmbH -> companyInfo.txt
VALUE "FileDescription", "" // e.g. Web Service -> productInfo.txt
VALUE "FileVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "FileVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "InternalName", "OpenScenarioReader.exe"
VALUE "LegalCopyright", "Copyright (C) 2024 by RA Consulting GmbH" // e.g. Copyright (C) 2019 -> companyInfo.txt + autogen by CMakeList.txt
VALUE "OriginalFilename", "OpenScenarioReader.exe"
VALUE "ProductName", "OpenScenarioReader" // e.g. Web Service -> productInfo.txt
VALUE "ProductVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "ProductVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
END
END
BLOCK "VarFileInfo"
Expand Down
10 changes: 5 additions & 5 deletions cpp/applications/openScenarioTester/rc/OpenScenarioTester.rc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,3,0,0 // e.g. 19,11,39,707
FILEVERSION 1,4,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,4,0,0 // e.g. 19,11,39,707
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -75,15 +75,15 @@ BEGIN
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "Comments", "OpenSCENARIO Standard 1.2.0"
VALUE "Comments", "OpenSCENARIO Standard 1.3.0"
VALUE "CompanyName", "RA Consulting GmbH - Zeiloch 6a - 76646 Bruchsal - Germany" // e.g. RA Consulting GmbH -> companyInfo.txt
VALUE "FileDescription", "" // e.g. Web Service -> productInfo.txt
VALUE "FileVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "FileVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "InternalName", "OpenScenarioTester.exe"
VALUE "LegalCopyright", "Copyright (C) 2024 by RA Consulting GmbH" // e.g. Copyright (C) 2019 -> companyInfo.txt + autogen by CMakeList.txt
VALUE "OriginalFilename", "OpenScenarioTester.exe"
VALUE "ProductName", "OpenScenarioTester" // e.g. Web Service -> productInfo.txt
VALUE "ProductVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "ProductVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
END
END
BLOCK "VarFileInfo"
Expand Down
4 changes: 2 additions & 2 deletions cpp/common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#pragma once

#define OSC_MAJORVERSION 1
#define OSC_MINORVERSION 2
#define OSC_MINORVERSION 3
#define OSC_PATCHNUMBER 0

#define MAJORVERSION 1
#define MINORVERSION 3
#define MINORVERSION 4
#define PATCHNUMBER 0
10 changes: 5 additions & 5 deletions cpp/expressionsLib/rc/ExpressionsLib.rc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,3,0,0 // e.g. 19,11,39,707
FILEVERSION 1,4,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,4,0,0 // e.g. 19,11,39,707
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -75,15 +75,15 @@ BEGIN
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "Comments", "OpenSCENARIO Standard 1.2.0"
VALUE "Comments", "OpenSCENARIO Standard 1.3.0"
VALUE "CompanyName", "RA Consulting GmbH - Zeiloch 6a - 76646 Bruchsal - Germany" // e.g. RA Consulting GmbH -> companyInfo.txt
VALUE "FileDescription", "Library for validating OpenSCENARIO files." // e.g. Web Service -> productInfo.txt
VALUE "FileVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "FileVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "InternalName", "ExpressionsLib.dll"
VALUE "LegalCopyright", "Copyright (C) 2024 by RA Consulting GmbH" // e.g. Copyright (C) 2019 -> companyInfo.txt + autogen by CMakeList.txt
VALUE "OriginalFilename", "ExpressionsLib.dll"
VALUE "ProductName", "ExpressionsLib" // e.g. Web Service -> productInfo.txt
VALUE "ProductVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "ProductVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
END
END
BLOCK "VarFileInfo"
Expand Down
53 changes: 53 additions & 0 deletions cpp/expressionsLib/src/EvaluatorListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,39 @@ namespace OscExpression
result = ExprValue::CreateDoubleValue(round(firstExprValue->getDoubleValue()));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::SIN) {
result = ExprValue::CreateDoubleValue(sin(firstExprValue->getDoubleValue()));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::COS) {
result = ExprValue::CreateDoubleValue(cos(firstExprValue->getDoubleValue()));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::TAN) {
result = ExprValue::CreateDoubleValue(tan(firstExprValue->getDoubleValue()));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::ASIN) {
result = ExprValue::CreateDoubleValue(asin(firstExprValue->getDoubleValue()));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::ACOS) {
result = ExprValue::CreateDoubleValue(acos(firstExprValue->getDoubleValue()));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::ATAN) {
result = ExprValue::CreateDoubleValue(atan(firstExprValue->getDoubleValue()));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::SIGN)
{
result = ExprValue::CreateDoubleValue((firstExprValue->getDoubleValue() > 0) - (firstExprValue->getDoubleValue() < 0));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::ABS) {
result = ExprValue::CreateDoubleValue(abs(firstExprValue->getDoubleValue()));
this->valueStack.push(result);
}
}

void EvaluatorListener::exitNumLiteral(OscExprParser::NumLiteralContext *ctx)
Expand Down Expand Up @@ -495,6 +528,26 @@ namespace OscExpression

result = ExprValue::CreateDoubleValue(powResult);
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::MAX)
{
double firstValue = -1;
double secondValue = -1;
firstValue = firstExprValue->getDoubleValue();
secondValue = secondExprValue->getDoubleValue();

result = ExprValue::CreateDoubleValue(std::max(firstValue, secondValue));
this->valueStack.push(result);
}
else if (ctx->func->getType() == OscExprLexer::MIN)
{
double firstValue = -1;
double secondValue = -1;
firstValue = firstExprValue->getDoubleValue();
secondValue = secondExprValue->getDoubleValue();

result = ExprValue::CreateDoubleValue(std::min(firstValue, secondValue));
this->valueStack.push(result);
}
}

Expand Down
11 changes: 11 additions & 0 deletions cpp/expressionsLib/src/antlr/OscExprLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ AND : 'and';
OR : 'or';
FALSE_LITERAL : 'false';
TRUE_LITERAL : 'true';

SIN: 'sin';
COS: 'cos';
TAN: 'tan';
ASIN: 'asin';
ACOS: 'acos';
ATAN: 'atan';
SIGN: 'sign';
ABS: 'abs';
MAX: 'max';
MIN: 'min';

fragment INT : '0' | [1-9] [0-9]* ; // no leading zeros
fragment EXP : [Ee] [+\-]? INT ; // \- since - means "range" inside [...]
10 changes: 10 additions & 0 deletions cpp/expressionsLib/src/antlr/OscExprParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@ expr: func=POW OPEN_BRACKET expr COLON expr CLOSE_BRACKET # FunctionTwoArguments
| TRUE_LITERAL #TrueLiteral
| ID # IdExpr
| OPEN_BRACKET expr CLOSE_BRACKET # SquaredExpr
| func=SIN OPEN_BRACKET expr CLOSE_BRACKET # FunctionOneArgument
| func=COS OPEN_BRACKET expr CLOSE_BRACKET # FunctionOneArgument
| func=TAN OPEN_BRACKET expr CLOSE_BRACKET # FunctionOneArgument
| func=ASIN OPEN_BRACKET expr CLOSE_BRACKET # FunctionOneArgument
| func=ACOS OPEN_BRACKET expr CLOSE_BRACKET # FunctionOneArgument
| func=ATAN OPEN_BRACKET expr CLOSE_BRACKET # FunctionOneArgument
| func=SIGN OPEN_BRACKET expr CLOSE_BRACKET # FunctionOneArgument
| func=ABS OPEN_BRACKET expr CLOSE_BRACKET # FunctionOneArgument
| func=MAX OPEN_BRACKET expr COLON expr CLOSE_BRACKET # FunctionTwoArguments
| func=MIN OPEN_BRACKET expr COLON expr CLOSE_BRACKET # FunctionTwoArguments
;
10 changes: 5 additions & 5 deletions cpp/openScenarioLib/rc/OpenScenarioLib.rc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,3,0,0 // e.g. 19,11,39,707
FILEVERSION 1,4,0,0 // e.g. 19,11,39,707
PRODUCTVERSION 1,4,0,0 // e.g. 19,11,39,707
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -75,15 +75,15 @@ BEGIN
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "Comments", "OpenSCENARIO Standard 1.2.0"
VALUE "Comments", "OpenSCENARIO Standard 1.3.0"
VALUE "CompanyName", "RA Consulting GmbH - Zeiloch 6a - 76646 Bruchsal - Germany" // e.g. RA Consulting GmbH -> companyInfo.txt
VALUE "FileDescription", "Library for validating OpenSCENARIO files." // e.g. Web Service -> productInfo.txt
VALUE "FileVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "FileVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "InternalName", "OpenScenarioLib.dll"
VALUE "LegalCopyright", "Copyright (C) 2024 by RA Consulting GmbH" // e.g. Copyright (C) 2019 -> companyInfo.txt + autogen by CMakeList.txt
VALUE "OriginalFilename", "OpenScenarioLib.dll"
VALUE "ProductName", "OpenScenarioLib" // e.g. Web Service -> productInfo.txt
VALUE "ProductVersion", "1.3.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
VALUE "ProductVersion", "1.4.0.0" // e.g. 19.11.39.707 -> automatically generated by according CMakeList.txt
END
END
BLOCK "VarFileInfo"
Expand Down

0 comments on commit fa187a4

Please sign in to comment.