Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added test mosfiles/FinalTests, from MathCore
- Added the ModelicaUtilities.h header (Utility functions for external C function) - Changed the generation of makesfiles to make it possible to reference these functions. - Added a simple implementation of these functions. - Added test mosfiles/ModelicaUtilities - Fixed a bug in SimCodegen where solved string would not be escaped before printed as C-code. git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5136 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
Showing
5 changed files
with
94 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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. | ||
* | ||
*/ | ||
|
||
#include "ModelicaUtilities.h" | ||
#include "modelica_string.h" | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdarg.h> | ||
|
||
void ModelicaMessage(const char* string) { | ||
ModelicaFormatMessage("%s", string); | ||
} | ||
|
||
void ModelicaFormatMessage(const char* string,...) { | ||
va_list args; | ||
va_start(args, string); | ||
vfprintf(stdout, string, args); | ||
va_end(args); | ||
fflush(stdout); | ||
} | ||
|
||
void ModelicaError(const char* string) { | ||
ModelicaFormatError("%s", string); | ||
} | ||
|
||
void ModelicaFormatError(const char* string, ...) { | ||
va_list args; | ||
va_start(args, string); | ||
vfprintf(stderr, string, args); | ||
va_end(args); | ||
} | ||
|
||
char* ModelicaAllocateString(size_t len) { | ||
char* res; | ||
alloc_modelica_string(&res,len); | ||
return res; | ||
} | ||
|
||
char* ModelicaAllocateStringWithErrorReturn(size_t len) { | ||
char* res; | ||
alloc_modelica_string(&res,len); | ||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef MODELICA_UTILITIES_H | ||
#define MODELICA_UTILITIES_H | ||
|
||
#include <stddef.h> | ||
/* | ||
* Utility functions for external functions. | ||
* The functionality is defined in the Modelica 2.x and 3.x specifications. | ||
*/ | ||
|
||
void ModelicaMessage(const char* string); | ||
void ModelicaFormatMessage(const char* string,...); | ||
void ModelicaError(const char* string); | ||
void ModelicaFormatError(const char* string, ...); | ||
char* ModelicaAllocateString(size_t len); | ||
char* ModelicaAllocateStringWithErrorReturn(size_t len); | ||
|
||
#endif /* MODELICA_UTILITIES_H */ |