Skip to content

Commit

Permalink
- More runtime functions for bootstrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Oct 19, 2010
1 parent 83d6d21 commit fd3e0bb
Show file tree
Hide file tree
Showing 6 changed files with 3,205 additions and 3,139 deletions.
4 changes: 2 additions & 2 deletions Compiler/System.mo
Expand Up @@ -293,7 +293,7 @@ public function readFile
input String inString;
output String outString;

external "C" ;
external "C" outString = SystemImpl__readFile(inString);
end readFile;

public function getVariableNames
Expand Down Expand Up @@ -384,7 +384,7 @@ public function regularFileExists
input String inString;
output Boolean outBool;

external "C" ;
external "C" outBool = SystemImpl__regularFileExists(inString);
end regularFileExists;

public function removeFile "Removes a file, returns 0 if suceeds, implemented using remove() in stdio.h"
Expand Down
6 changes: 4 additions & 2 deletions Compiler/runtime/Makefile.in
Expand Up @@ -32,11 +32,11 @@ IDL = @IDLCMD@
CFLAGS += @CFLAGS@
CXXFLAGS = $(CFLAGS)
CPPFLAGS = -I$(RMLINCLUDE) -I$(top_builddir)/c_runtime -I$(srcdir) -I. $(CORBAINCL) -Ilpsolve
SRC = rtopts.c socketimpl.c Print_rml.c systemimpl.c settingsimpl.c dynload.c SimulationResults.c IOStreamExt.c rtclock.c Database.c
SRC = rtopts.c socketimpl.c Print_rml.c System_rml.c settingsimpl.c dynload.c SimulationResults.c IOStreamExt.c rtclock.c Database.c

CPPSRC = unitparser.cpp unitparserext.cpp ptolemyio.cpp daeext.cpp ErrorMessage.cpp Error_rml.cpp optmanager.cpp systemimplmisc.cpp dynload_try.o $(CORBASRC)
OBJ = $(SRC:.c=.o) $(CPPSRC:.cpp=.o) $(CPPSRC:.cc=.o)
OMC_OBJ = Error_omc.o Print_omc.o RTOpts_omc.o ErrorMessage.o
OMC_OBJ = Error_omc.o Print_omc.o RTOpts_omc.o System_omc.o ErrorMessage.o

all: runtime.a install
.PHONY: all install
Expand All @@ -62,6 +62,8 @@ Print_rml.o : printimpl.c
Print_omc.o : printimpl.c
Error_rml.o : errorext.cpp
Error_omc.o : errorext.cpp
System_rml.o : systemimpl.c config.unix.h
System_omc.o : systemimpl.c config.unix.h

clean:
$(RM) -rf *.a *.o omc_communication.cc omc_communication.h omc_communication-*
Expand Down
56 changes: 56 additions & 0 deletions Compiler/runtime/System_omc.cpp
@@ -0,0 +1,56 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2010, Linköpings University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF 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öpings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
* 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 "systemimpl.c"

extern "C" {

extern int System__regularFileExists(const char* str)
{
fprintf(stderr, "NYI: %s\n", __FUNCTION__);
//return SystemImpl__regularFileExists(str);
throw 1;
}

extern void writeFile(const char* filename, const char* data)
{
fprintf(stderr, "NYI: %s\n", __FUNCTION__);
//if (SystemImpl__writeFile(filename, data))
throw 1;
}

extern char* System__readFile(const char* filename)
{
fprintf(stderr, "NYI: %s\n", __FUNCTION__);
//return SystemImpl__readFile(filename);
throw 1;
}

}

0 comments on commit fd3e0bb

Please sign in to comment.