Skip to content

Commit

Permalink
- add ModelicaBuiltin.mo and MetaModelicaBuiltin.mo directly to the
Browse files Browse the repository at this point in the history
  initial environment in Builtin.initialEnv and NFSCodeEnv.buildInitialEnv
- this way we avoid translating them and adding them to SCode.Program again
- also, as a bonus we get saveTotalSCode to NOT display any classes from the
  builtin environment


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17772 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Oct 20, 2013
1 parent 8e76a86 commit d634810
Show file tree
Hide file tree
Showing 11 changed files with 381 additions and 229 deletions.
33 changes: 4 additions & 29 deletions Compiler/FrontEnd/Builtin.mo
Expand Up @@ -36,12 +36,9 @@ encapsulated package Builtin

RCS: $Id$

This module defines the builtin types, variables and functions in
Modelica. The only exported functions are Builtin.initialEnv and
Builtin.simpleInitialEnv.
This module defines the builtin types, variables and functions in Modelica.

There are several builtin attributes defined in the builtin types,
such as unit, start, etc."
There are several builtin attributes defined in the builtin types, such as unit, start, etc."

public import Absyn;
public import DAE;
Expand Down Expand Up @@ -568,29 +565,6 @@ algorithm
end match;
end isDer;

public function simpleInitialEnv "
function: simpleInitialEnv
The initial environment where instantiation takes place is built
up using this function. It creates an empty environment and adds
all the built-in types to it.
This only creates a minimal environment, useful for debugging purposes."
output list<Env.Frame> env;
algorithm
env := Env.newEnvironment(NONE());
env := Env.extendFrameC(env, rlType);
env := Env.extendFrameC(env, intType);
env := Env.extendFrameC(env, strType);
env := Env.extendFrameC(env, boolType);
env := Env.extendFrameC(env, enumType);
env := Env.extendFrameC(env, ExternalObjectType);
env := Env.extendFrameC(env, realType);
env := Env.extendFrameC(env, integerType);
env := Env.extendFrameC(env, stringType);
env := Env.extendFrameC(env, booleanType);
env := Env.extendFrameC(env, stateSelectType);
env := Env.extendFrameC(env, uncertaintyType);
end simpleInitialEnv;

public function initialEnv
"The initial environment where instantiation takes place is built
up using this function. It creates an empty environment and adds
Expand Down Expand Up @@ -705,8 +679,9 @@ algorithm

env = initialEnvMetaModelica(env);

// add the builtin classes from ModelicaBuiltin.mo and MetaModelicaBuiltin.mo
Absyn.PROGRAM(classes=initialClasses) = getInitialFunctions();
env = Env.extendFrameClasses(env, listReverse(List.fold(initialClasses, SCodeUtil.translate2, {})), SOME(Env.BUILTIN())) "Add classes in the initial env";
env = Env.extendFrameClasses(env, listReverse(List.fold(initialClasses, SCodeUtil.translate2, {})), SOME(Env.BUILTIN()));
cache = Env.setCachedInitialEnv(cache,env);
_ = getSetInitialEnv(SOME(env));
then
Expand Down

0 comments on commit d634810

Please sign in to comment.