Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
969a33d8
Commit
969a33d8
authored
Jul 29, 2016
by
Jerome Hugues
Browse files
* Use runOcarinaFunction instead of copy/pasting same piece of
code For issue #71
parent
333b9aac
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/mknodes/parser.adb
View file @
969a33d8
...
...
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-201
5
ESA & ISAE. --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-201
6
ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
...
...
@@ -2723,56 +2723,12 @@ package body Parser is
Output
.
Write_Str
(
" (N):"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"info = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"error = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"raisedError = []"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"res = ''"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"with std_redirector(info,error):"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"try:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"res = libocarina_python."
);
Output
.
Write_Str
(
"return runOcarinaFunction (libocarina_python."
);
Output
.
Write_Str
(
Ada
.
Directories
.
Base_Name
(
Namet
.
Get_Name_String
(
Output_Name
)));
Output
.
Write_Str
(
"_"
);
Output
.
Write_Str
(
A
);
Output
.
Write_Str
(
" ("
);
Output
.
Write_Eol
;
W_Indentation
(
4
);
Output
.
Write_Str
(
"N)"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"except:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"raisedError.append(getErrorMessage())"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"stderrMsg = sortStderrMessages(error"
);
Output
.
Write_Str
(
".getvalue().decode('utf-8'))"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"if stderrMsg[1]!=[]:"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError.append(stderrMsg[1])"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"return [ res , info.getvalue()."
);
Output
.
Write_Str
(
"decode('utf-8'), stderrMsg[0] , "
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError ]"
);
Output
.
Write_Str
(
", N)"
);
Output
.
Write_Eol
;
Output
.
Write_Eol
;
...
...
@@ -2784,56 +2740,12 @@ package body Parser is
Output
.
Write_Str
(
" (N, V):"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"info = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"error = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"raisedError = []"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"res = ''"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"with std_redirector(info,error):"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"try:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"libocarina_python."
);
Output
.
Write_Str
(
"return runOcarinaFunction (libocarina_python."
);
Output
.
Write_Str
(
Ada
.
Directories
.
Base_Name
(
Namet
.
Get_Name_String
(
Output_Name
)));
Output
.
Write_Str
(
"_"
);
Output
.
Write_Str
(
WS
(
A
));
Output
.
Write_Str
(
" ("
);
Output
.
Write_Eol
;
W_Indentation
(
4
);
Output
.
Write_Str
(
"N, V)"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"except:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"raisedError.append(getErrorMessage())"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"stderrMsg = sortStderrMessages(error."
);
Output
.
Write_Str
(
"getvalue().decode('utf-8'))"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"if stderrMsg[1]!=[]:"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError.append(stderrMsg[1])"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"return [ res , info.getvalue()."
);
Output
.
Write_Str
(
"decode('utf-8'), stderrMsg[0] , "
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError ]"
);
Output
.
Write_Str
(
", N, V)"
);
Output
.
Write_Eol
;
Output
.
Write_Eol
;
...
...
@@ -2859,56 +2771,12 @@ package body Parser is
Output
.
Write_Str
(
" (N):"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"info = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"error = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"raisedError = []"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"res = ''"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"with std_redirector(info,error):"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"try:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"res = libocarina_python."
);
Output
.
Write_Str
(
"return runOcarinaFunction (libocarina_python."
);
Output
.
Write_Str
(
Ada
.
Directories
.
Base_Name
(
Namet
.
Get_Name_String
(
Output_Name
))
&
"_python"
);
Output
.
Write_Str
(
"_"
);
Output
.
Write_Str
(
GNS
(
Identifier
(
A
)));
Output
.
Write_Str
(
" ("
);
Output
.
Write_Eol
;
W_Indentation
(
4
);
Output
.
Write_Str
(
"N)"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"except:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"raisedError.append(getErrorMessage())"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"stderrMsg = sortStderrMessages(error."
);
Output
.
Write_Str
(
"getvalue().decode('utf-8'))"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"if stderrMsg[1]!=[]:"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError.append(stderrMsg[1])"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"return [ res , info.getvalue()."
);
Output
.
Write_Str
(
"decode('utf-8'), stderrMsg[0] , "
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError ]"
);
Output
.
Write_Str
(
", N)"
);
Output
.
Write_Eol
;
Output
.
Write_Eol
;
...
...
@@ -2920,56 +2788,12 @@ package body Parser is
Output
.
Write_Str
(
" (N, V):"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"info = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"error = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"raisedError = []"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"res = ''"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"with std_redirector(info,error):"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"try:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"libocarina_python."
);
Output
.
Write_Str
(
"return runOcarinaFunction (libocarina_python."
);
Output
.
Write_Str
(
Ada
.
Directories
.
Base_Name
(
Namet
.
Get_Name_String
(
Output_Name
))
&
"_python"
);
Output
.
Write_Str
(
"_"
);
Output
.
Write_Str
(
WS
(
GNS
(
Identifier
(
A
))));
Output
.
Write_Str
(
" ("
);
Output
.
Write_Eol
;
W_Indentation
(
4
);
Output
.
Write_Str
(
"N, V)"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"except:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"raisedError.append(getErrorMessage())"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"stderrMsg = sortStderrMessages(error."
);
Output
.
Write_Str
(
"getvalue().decode('utf-8'))"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"if stderrMsg[1]!=[]:"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError.append(stderrMsg[1])"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"return [ res , info.getvalue()."
);
Output
.
Write_Str
(
"decode('utf-8'), stderrMsg[0] , "
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError ]"
);
Output
.
Write_Str
(
", N, V)"
);
Output
.
Write_Eol
;
Output
.
Write_Eol
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment