Skip to content

Commit

Permalink
- Propagate some more information so we can store functions in the fu…
Browse files Browse the repository at this point in the history
…ture

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12057 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jun 14, 2012
1 parent 52d7c51 commit 56f61ec
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 122 deletions.
77 changes: 77 additions & 0 deletions Compiler/FrontEnd/EvalFunction.mo
@@ -0,0 +1,77 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Linköping University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/

encapsulated package EvalFunction
" file: EvalFunction.mo
package: EvalFunction
description: This module constant evaluates InstTypes.Function objects, i.e.
modelica functions defined by the user.

RCS: $Id$

TODO:
* Implement evaluation of MetaModelica statements.
* Enable NORETCALL (see comment in evaluateStatement).
* Implement terminate and assert(false, ...).
* Arrays of records probably doesn't work yet.
"

// Jump table for CevalFunction:
// [TYPE] Types.
// [EVAL] Constant evaluation functions.
// [EENV] Environment extension functions (add variables).
// [MENV] Environment manipulation functions (set and get variables).
// [DEPS] Function variable dependency handling.
// [EOPT] Expression optimization functions.

// public imports
public import InstTypes;

// protected imports
protected import ExpressionSimplify;

// [TYPE] Types

// LoopControl is used to control the functions behaviour in different
// situations. All evaluation functions returns a LoopControl variable that
// tells the caller whether it should continue evaluating or not.
protected uniontype LoopControl
record NEXT "Continue to the next statement." end NEXT;
record BREAK "Exit the current loop." end BREAK;
record RETURN "Exit the function." end RETURN;
end LoopControl;

// [EVAL] Constant evaluation functions.

public function evaluate
end evaluate;

end EvalFunction;

0 comments on commit 56f61ec

Please sign in to comment.