Skip to content

Commit

Permalink
- Improved notification on language standard changes.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10989 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Jan 31, 2012
1 parent c7de83f commit 208e97d
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Compiler/Util/Config.mo
Expand Up @@ -414,12 +414,12 @@ algorithm

case _
equation
{"Modelica", version} = System.strtok(inLibraryName, " ");
"Modelica" :: version :: _ = System.strtok(inLibraryName, " ");
new_std = versionStringToStd(version);
current_std = getLanguageStandard();
false = valueEq(new_std, current_std);
setLanguageStandard(new_std);
show_warning = languageStandardAtMost(MODELICA_3_0());
show_warning = hasLanguageStandardChanged(current_std);
new_std_str = languageStandardString(new_std);
Debug.bcall2(show_warning, Error.addMessage, Error.CHANGED_STD_VERSION,
{new_std_str, version});
Expand All @@ -430,6 +430,22 @@ algorithm
end matchcontinue;
end setLanguageStandardFromMSL;

protected function hasLanguageStandardChanged
input LanguageStandard inOldStandard;
output Boolean outHasChanged;
algorithm
outHasChanged := matchcontinue(inOldStandard)
// If the old standard wasn't set by the user, then we consider it to have
// changed only if the new standard is 3.0 or less. This is to avoid
// printing a notice if the user loads e.g. MSL 3.1.
case MODELICA_LATEST()
then languageStandardAtMost(MODELICA_3_0());

// Otherwise is has changed.
else true;
end matchcontinue;
end hasLanguageStandardChanged;

protected function versionStringToStd
input String inVersion;
output LanguageStandard outStandard;
Expand Down

0 comments on commit 208e97d

Please sign in to comment.