Changeset 0df6e65 in OpenModelica


Ignore:
Timestamp:
2020-06-03T17:49:49+02:00 (4 years ago)
Author:
perost <perost86@…>
Branches:
Added-citation-metadata, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
59c0cf1, afc001c8
Parents:
58b509d7
git-author:
Per Östlund <perost86@…> (06/03/20 14:29:11)
git-committer:
perost <perost86@…> (06/03/20 17:49:49)
Message:

Add more language standards.

  • Add 3.4, 3.5, and experimental as language standards.
  • Change LanguageStandard.latest to mean 3.4.
Location:
OMCompiler/Compiler/Util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/Util/Config.mo

    r5c1cf16 r0df6e65  
    4848public
    4949
    50 type LanguageStandard = enumeration('1.x', '2.x', '3.0', '3.1', '3.2', '3.3', latest)
     50type LanguageStandard = enumeration('1.x', '2.x', '3.0', '3.1', '3.2', '3.3', '3.4', latest, '3.5', experimental)
    5151  "Defines the various modelica language versions that OMC can use.";
    5252
     
    451451  output Integer outValue;
    452452protected
    453   constant Integer lookup[LanguageStandard] = array(10, 20, 30, 31, 32, 33, 1000);
     453  constant Integer lookup[LanguageStandard] = array(10, 20, 30, 31, 32, 33, 34, 1000, 1035, 9999);
    454454algorithm
    455455  outValue := lookup[inStandard];
     
    467467    case 32 then LanguageStandard.'3.2';
    468468    case 33 then LanguageStandard.'3.3';
     469    case 34 then LanguageStandard.'3.4';
    469470    case 1000 then LanguageStandard.latest;
     471    case 1035 then LanguageStandard.'3.5';
     472    case 9999 then LanguageStandard.experimental;
    470473  end match;
    471474end intLanguageStandard;
     
    475478  output String outString;
    476479protected
    477   constant String lookup[LanguageStandard] = array("1.x","2.x","3.0","3.1","3.2","3.3","3.3" /*Change this to latest version if you add more versions!*/);
     480  constant String lookup[LanguageStandard] = array("1.x","2.x","3.0","3.1","3.2","3.3","3.4","3.4","3.5","experimental" /*Change this to latest version if you add more versions!*/);
    478481algorithm
    479482  outString := lookup[inStandard];
     
    493496  _ := matchcontinue(inLibraryName)
    494497    local
    495       String version, new_std_str;
     498      String version;
    496499      LanguageStandard new_std;
    497       Boolean show_warning;
    498500
    499501    case _
     
    501503        "Modelica" :: version :: _ := System.strtok(inLibraryName, " ");
    502504        new_std := versionStringToStd(version);
    503         if new_std==current_std then
    504           return;
    505         end if;
    506         setLanguageStandard(new_std);
    507         show_warning := hasLanguageStandardChanged(current_std);
    508         new_std_str := languageStandardString(new_std);
    509         if show_warning then
    510           Error.addMessage(Error.CHANGED_STD_VERSION, {new_std_str, version});
     505
     506        if new_std <> current_std then
     507          setLanguageStandard(new_std);
     508
     509          if hasLanguageStandardChanged(current_std) then
     510            Error.addMessage(Error.CHANGED_STD_VERSION,
     511              {languageStandardString(new_std), version});
     512          end if;
    511513        end if;
    512514      then ();
     
    545547    case "3" :: "0" :: _ then LanguageStandard.'3.0';
    546548    case "3" :: "1" :: _ then LanguageStandard.'3.1';
     549    //case "3" :: "2" :: "3" :: _ then LanguageStandard.'3.3';
    547550    case "3" :: "2" :: _ then LanguageStandard.'3.2';
    548551    case "3" :: "3" :: _ then LanguageStandard.'3.3';
     
    636639"@autor: adrpo
    637640 checks returns true if language standard is above or equal to Modelica 3.3"
    638   output Boolean outRes;
    639 protected
    640   LanguageStandard std = getLanguageStandard();
    641 algorithm
    642   outRes := intGe(languageStandardInt(std), 33);
     641  output Boolean outRes = getLanguageStandard() >= LanguageStandard.'3.3';
    643642end synchronousFeaturesAllowed;
    644643
  • OMCompiler/Compiler/Util/Flags.mo

    r2a7b5004 r0df6e65  
    595595constant ConfigFlag LANGUAGE_STANDARD = CONFIG_FLAG(8, "std", NONE(), EXTERNAL(),
    596596  ENUM_FLAG(1000,
    597     {("1.x", 10), ("2.x", 20), ("3.0", 30), ("3.1", 31), ("3.2", 32), ("3.3", 33), ("latest",1000)}),
    598   SOME(STRING_OPTION({"1.x", "2.x", "3.1", "3.2", "3.3", "latest"})),
     597    {("1.x", 10), ("2.x", 20), ("3.0", 30), ("3.1", 31), ("3.2", 32), ("3.3", 33),
     598     ("3.4", 34), ("latest",1000), ("3.5", 1035), ("experimental", 9999)}),
     599  SOME(STRING_OPTION({"1.x", "2.x", "3.1", "3.2", "3.3", "3.4", "latest", "3.5", "experimental"})),
    599600  Gettext.gettext("Sets the language standard that should be used."));
    600601
Note: See TracChangeset for help on using the changeset viewer.