Skip to content

Commit

Permalink
- Additional fixes for bootstrapping (parsing, etc)
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7148 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 21, 2010
1 parent 7532ed2 commit 130fe76
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 41 deletions.
31 changes: 16 additions & 15 deletions Compiler/runtime/BackendDAEEXT_omc.cpp
Expand Up @@ -42,83 +42,84 @@
*/

#include "BackendDAEEXT.cpp"
#include <stdlib.h>

extern "C" {

extern int BackendDAEEXT_getVMark(int _inInteger)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void* BackendDAEEXT_getMarkedEqns()
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_eMark(int _inInteger)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_clearDifferentiated()
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void* BackendDAEEXT_getDifferentiatedEqns()
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern int BackendDAEEXT_getLowLink(int _inInteger)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void* BackendDAEEXT_getMarkedVariables()
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern int BackendDAEEXT_getNumber(int _inInteger)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_setNumber(int _inInteger1, int _inInteger2)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_initMarks(int _inInteger1, int _inInteger2)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_initLowLink(int _inInteger)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_markDifferentiated(int _inInteger)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_initNumber(int _inInteger)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_setLowLink(int _inInteger1, int _inInteger2)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}
extern void BackendDAEEXT_vMark(int _inInteger)
{
fprintf(stderr, "BackendDAEEXT NYI\n");
throw 1;
exit(1);
}

}
7 changes: 4 additions & 3 deletions Compiler/runtime/SimulationResults_omc.cpp
Expand Up @@ -29,25 +29,26 @@
*/

#include <stdio.h>
#include <stdlib.h>

extern "C" {

void* SimulationResults_readPtolemyplotVariables(const char *filename, const char *visvars)
{
fprintf(stderr, "SimulationResults_readPtolemyplotVariables NYI\n");
throw 1;
exit(1);
}

void* SimulationResults_readPtolemyplotDataset(const char *filename, void *vars, int i)
{
fprintf(stderr, "SimulationResults_readPtolemyplotDataset NYI\n");
throw 1;
exit(1);
}

void* SimulationResults_readPtolemyplotDatasetSize(const char *filename)
{
fprintf(stderr, "SimulationResults_readPtolemyplotDatasetSize NYI\n");
throw 1;
exit(1);
}

}
10 changes: 5 additions & 5 deletions Compiler/runtime/System_omc.cpp
Expand Up @@ -243,13 +243,13 @@ void System_setClassnamesForSimulation(const char *class_names)
extern double System_getVariableValue(double _timeStamp, void* _timeValues, void* _varValues)
{
fprintf(stderr, "System_getVariableValue NYI\n");
throw 1;
exit(1);
}

extern const char* System_getVariableNames(const char* _modelname)
{
fprintf(stderr, "System_getVariableNames NYI\n");
throw 1;
exit(1);
}

extern void* System_getFileModificationTime(const char *fileName)
Expand Down Expand Up @@ -309,19 +309,19 @@ void* System_moFiles(const char *directory)
extern int System_lookupFunction(int _inLibHandle, const char* _inFunc)
{
fprintf(stderr, "System_lookupFunction NYI\n");
throw 1;
exit(1);
}

extern void System_freeFunction(int _inFuncHandle)
{
fprintf(stderr, "System_freeFunction NYI\n");
throw 1;
exit(1);
}

extern void System_freeLibrary(int _inLibHandle)
{
fprintf(stderr, "System_freeLibrary NYI\n");
throw 1;
exit(1);
}

extern int System_getHasSendDataSupport()
Expand Down
1 change: 0 additions & 1 deletion Compiler/runtime/UnitParserExt_rml.cpp
Expand Up @@ -9,7 +9,6 @@ extern "C"

void UnitParserExt_5finit(void)
{
unitParser = new UnitParser;
}

RML_BEGIN_LABEL(UnitParserExt__initSIUnits)
Expand Down
4 changes: 3 additions & 1 deletion Compiler/runtime/rtoptsimpl.c
Expand Up @@ -285,7 +285,9 @@ static enum RTOpts__arg__result RTOptsImpl__arg(const char* arg)
char *tmp;
debug_none = 1;

if (strcmp(arg,TESTSCRIPT) == 0) {
if (strcmp(arg,"--") == 0) {
return ARG_CONSUME;
} else if (strcmp(arg,TESTSCRIPT) == 0) {
running_testsuite = 1;
} else if (strcmp(arg,VERSION_OPT1) == 0 || strcmp(arg,VERSION_OPT2) == 0) {
version_request = 1;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/runtime/unitparserext.cpp
Expand Up @@ -5,7 +5,7 @@
#include <stack>

using namespace std;
UnitParser* unitParser=0;
UnitParser* unitParser = new UnitParser;
stack<UnitParser*> rollbackStack;

extern "C"
Expand Down
18 changes: 9 additions & 9 deletions Parser/Modelica.g
Expand Up @@ -414,32 +414,32 @@ component_clause returns [void* ast] @declarations {
if (RML_GETHDR(path) == RML_STRUCTHDR(2, Absyn__TPATH_3dBOX2)) // is TPATH(path, arr)
{
struct rml_struct *p = (struct rml_struct*)RML_UNTAGPTR(path);
ar_option = p->data[1]; // get the array option
p->data[1] = mk_none(); // replace the array with nothing
ar_option = p->data[1+UNBOX_OFFSET]; // get the array option
p->data[1+UNBOX_OFFSET] = mk_none(); // replace the array with nothing
}
else if (RML_GETHDR(path) == RML_STRUCTHDR(3, Absyn__TCOMPLEX_3dBOX3))
{
struct rml_struct *p = (struct rml_struct*)RML_UNTAGPTR(path);
ar_option = p->data[2]; // get the array option
p->data[2] = mk_none(); // replace the array with nothing
ar_option = p->data[2+UNBOX_OFFSET]; // get the array option
p->data[2+UNBOX_OFFSET] = mk_none(); // replace the array with nothing
}
else
{
fprintf(stderr, "component_clause error\n");
}

{ /* adrpo - use the ANSI C standard */
{ /* adrpo - use the ANSI C standard */
// no arr was set, inspect ar_option and fix it
struct rml_struct *p = (struct rml_struct*)RML_UNTAGPTR(ar_option);
if (RML_GETHDR(ar_option) == RML_STRUCTHDR(0,0)) // is NONE
if (optionNone(ar_option))
{
arr = mk_nil();
}
else // is SOME(arr)
{
arr = p->data[0];
}
}
}

ast = Absyn__COMPONENTS(Absyn__ATTR(tp.flow, tp.stream, tp.variability, tp.direction, arr), path, clst);
}
Expand Down Expand Up @@ -681,7 +681,7 @@ assign_clause_a returns [void* ast] @declarations {
assign_clause_a, $start->line, $start->charPosition+1, LT(1)->line, LT(1)->charPosition);
{ /* uselsess block for ANSI C crap */
struct rml_struct *p = (struct rml_struct*)RML_UNTAGPTR(e1);
$ast = Absyn__ALG_5fNORETCALL(p->data[0],p->data[1]);
$ast = Absyn__ALG_5fNORETCALL(p->data[0+UNBOX_OFFSET],p->data[1+UNBOX_OFFSET]);
}
}
)
Expand All @@ -693,7 +693,7 @@ equality_or_noretcall_equation returns [void* ast] :
| {LA(1) != EQUALS && RML_GETHDR(e1) == RML_STRUCTHDR(2, Absyn__CALL_3dBOX2)}? /* It has to be a CALL */
{
struct rml_struct *p = (struct rml_struct*)RML_UNTAGPTR(e1);
ast = Absyn__EQ_5fNORETCALL(p->data[0],p->data[1]);
ast = Absyn__EQ_5fNORETCALL(p->data[0+UNBOX_OFFSET],p->data[1+UNBOX_OFFSET]);
}
)
;
Expand Down
1 change: 1 addition & 0 deletions Parser/ModelicaParser_omc.c
Expand Up @@ -28,6 +28,7 @@
*
*/

#define UNBOX_OFFSET 1
#include "meta_modelica.h"
#include "rml_compatibility.h"
extern "C" {
Expand Down
2 changes: 2 additions & 0 deletions Parser/ModelicaParser_rml.c
Expand Up @@ -38,4 +38,6 @@ extern "C" {
}
#endif

#define UNBOX_OFFSET 0
#define optionNone(X) (RML_GETHDR(X) == RML_STRUCTHDR(0,0))
#include "ModelicaParser.c"
5 changes: 1 addition & 4 deletions Parser/Parser_omc.cpp
Expand Up @@ -36,16 +36,15 @@ extern "C" {

void* Parser_parse(const char* filename)
{
fprintf(stderr, "Parser.mo NYI\n");throw 1;
void *res = parseFile(filename,PARSE_MODELICA);
if (res == NULL)
throw 1;
// printAny(res);
return res;
}

void* Parser_parseexp(const char* filename)
{
fprintf(stderr, "Parser.mo NYI\n");throw 1;
void *res = parseFile(filename,PARSE_EXPRESSION);
if (res == NULL)
throw 1;
Expand All @@ -54,7 +53,6 @@ void* Parser_parseexp(const char* filename)

void* Parser_parsestring(const char* data, const char** msg)
{
fprintf(stderr, "Parser.mo NYI\n");throw 1;
ErrorImpl__setCheckpoint("parsestring");
void *res = parseString(data,PARSE_MODELICA);
if (res != NULL) {
Expand All @@ -69,7 +67,6 @@ void* Parser_parsestring(const char* data, const char** msg)

void* Parser_parsestringexp(const char* data, const char** msg)
{
fprintf(stderr, "Parser.mo NYI\n");throw 1;
ErrorImpl__setCheckpoint("parsestringexp");
void *res = parseString(data,PARSE_EXPRESSION);
if (res != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion c_runtime/meta_modelica_real.cpp
Expand Up @@ -149,7 +149,7 @@ realString_rettype realString(modelica_real r)
buffer[ix++] = '0';
buffer[ix] = '\0';
}
res = init_modelica_string(buffer);
res = strdup(buffer);
}
return res;
}
Expand Down
2 changes: 1 addition & 1 deletion c_runtime/rml_compatibility.h
Expand Up @@ -52,7 +52,7 @@
#define RML_IMMEDIATE MMC_IMMEDIATE
#define RML_GETHDR MMC_GETHDR
#define RML_UNTAGPTR MMC_UNTAGPTR
#define RML_STRUCTHDR MMC_STRUCTHDR
#define RML_STRUCTHDR(X,Y) MMC_STRUCTHDR(X+1,Y)

struct rml_struct {
mmc_uint_t header; /* MMC_STRUCTHDR(slots,ctor) */
Expand Down

0 comments on commit 130fe76

Please sign in to comment.