Skip to content

Commit 009db39

Browse files
committed
- the system call is the same for Windows/Linux, moved at the end.
- also added tracing to the System__systemCall function. git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5451 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent dd92b62 commit 009db39

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

Compiler/runtime/systemimpl.c

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -780,17 +780,6 @@ RML_BEGIN_LABEL(System__compileCFile)
780780
}
781781
RML_END_LABEL
782782

783-
RML_BEGIN_LABEL(System__systemCall)
784-
{
785-
int ret_val;
786-
char* str = RML_STRINGDATA(rmlA0);
787-
ret_val = system(str);
788-
rmlA0 = (void*) mk_icon(ret_val);
789-
790-
RML_TAILCALLK(rmlSC);
791-
}
792-
RML_END_LABEL
793-
794783
RML_BEGIN_LABEL(System__pathDelimiter)
795784
{
796785
rmlA0 = (void*) mk_scon("/");
@@ -2571,18 +2560,6 @@ RML_BEGIN_LABEL(System__compileCFile)
25712560
}
25722561
RML_END_LABEL
25732562

2574-
2575-
RML_BEGIN_LABEL(System__systemCall)
2576-
{
2577-
int ret_val;
2578-
char* str = RML_STRINGDATA(rmlA0);
2579-
ret_val = system(str);
2580-
rmlA0 = (void*) mk_icon(ret_val);
2581-
2582-
RML_TAILCALLK(rmlSC);
2583-
}
2584-
RML_END_LABEL
2585-
25862563
RML_BEGIN_LABEL(System__cd)
25872564
{
25882565
char* str = RML_STRINGDATA(rmlA0);
@@ -3739,3 +3716,27 @@ RML_BEGIN_LABEL(System__disableTrace)
37393716
}
37403717
RML_END_LABEL
37413718

3719+
/* is the same for both Windows/Linux */
3720+
RML_BEGIN_LABEL(System__systemCall)
3721+
{
3722+
int ret_val;
3723+
char* str = RML_STRINGDATA(rmlA0);
3724+
3725+
if (rml_trace_enabled)
3726+
{
3727+
fprintf(stderr, "System.systemCall: %s\n", str); fflush(stderr);
3728+
}
3729+
3730+
ret_val = system(str);
3731+
3732+
if (rml_trace_enabled)
3733+
{
3734+
fprintf(stderr, "System.systemCall: returned value: %d\n", ret_val); fflush(stderr);
3735+
}
3736+
3737+
rmlA0 = (void*) mk_icon(ret_val);
3738+
3739+
RML_TAILCALLK(rmlSC);
3740+
}
3741+
RML_END_LABEL
3742+

0 commit comments

Comments
 (0)