summaryrefslogtreecommitdiff
path: root/src/Scilab2C/ASTGenerator
diff options
context:
space:
mode:
authornutricato2007-07-13 10:05:05 +0000
committernutricato2007-07-13 10:05:05 +0000
commitc0723e47c05ef92516df10c86db892c8472bfa6b (patch)
tree08dd0ad734d8dd15dc9d93d6821cc4ffb0dd4b6b /src/Scilab2C/ASTGenerator
parentc25b43cf50da3a1e2bbbc459448e6b80806df51c (diff)
downloadscilab2c-c0723e47c05ef92516df10c86db892c8472bfa6b.tar.gz
scilab2c-c0723e47c05ef92516df10c86db892c8472bfa6b.tar.bz2
scilab2c-c0723e47c05ef92516df10c86db892c8472bfa6b.zip
Diffstat (limited to 'src/Scilab2C/ASTGenerator')
-rw-r--r--src/Scilab2C/ASTGenerator/DescriptionOfmacr2tree.txt82
-rw-r--r--src/Scilab2C/ASTGenerator/GenerateASTfoo.sci6
-rw-r--r--src/Scilab2C/ASTGenerator/GetASTFile.sci42
-rw-r--r--src/Scilab2C/ASTGenerator/foo.sci8
-rw-r--r--src/Scilab2C/ASTGenerator/foo1.sci8
5 files changed, 42 insertions, 104 deletions
diff --git a/src/Scilab2C/ASTGenerator/DescriptionOfmacr2tree.txt b/src/Scilab2C/ASTGenerator/DescriptionOfmacr2tree.txt
deleted file mode 100644
index 21ec28d7..00000000
--- a/src/Scilab2C/ASTGenerator/DescriptionOfmacr2tree.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-Description from Serge Steer
-Date:
-Fri, 28 Jul 2006 12:14:14 +0200
-To:
-raffaele.nutricato@tiscali.it
-CC:
-Fabio.Bovenga@ba.infn.it, Claude.Gomez@Inria.fr, Didier.Halgand@Inria.fr, Serge.Steer@Inria.fr
-
->> Let me to ask you one more question: I read in the Scilab2C.doc
->> document that among the tasks related to the Scilab team/ INRIA
->> there is the "*_FORTRAN to C code translation"_* task. Is it
->> possible to have more details about this activity?
-
-
-I am not able to answer this question, please ask it to Claude Gomez
-who wrote this document.
-
-
-
->> Could you please send us a preliminary version of the output that
->> will be generated by the Scilab2tree tool starting from the
->> testscilab.sci code?
-
-
-
-If you have Scilab-4.0 installed you can play with it. The
-preliminary version of Scilab2tree is named macr2tree.
-
-here is very simple example of use
-
--->function y=foo(x)
---> y=x+1
--->endfunction
-
--->t=macr2tree(foo)
-
-It returns the full abstract syntax tree coded by a hierarchical
-structure of tlists and lists Scilab objects. To get a more readable
-display and also to illustrate how Scilab can deal with such a
-structure, I give you below a file of scilab functions for display
-overloading. If this file is loaded into Scilab
-
---> exec %program_p.sci;
-
-The display of the t structure above become
-
--->t
- t =
-
-Program
-Name : foo
-Outputs: y
-Inputs : x
-Statements
- <EOL>
- Equal
- Expression:
- Operation
- Operands:
- x
- 1
- Operator: +
- EndOperation
- Lhs :
- y
- EndEqual
- <EOL>
- Funcall : return
- #lhs : 0
- Rhs :
- <empty>
- EndFuncall
- <EOL>
-EndProgram
-
-
-These functions work with your testscilab function too (but select
-case constructs are not yet handled). Just try it and look at the
-comment for the structure explanation
-
-Serge Steer
-Scilab Team
diff --git a/src/Scilab2C/ASTGenerator/GenerateASTfoo.sci b/src/Scilab2C/ASTGenerator/GenerateASTfoo.sci
deleted file mode 100644
index 70001632..00000000
--- a/src/Scilab2C/ASTGenerator/GenerateASTfoo.sci
+++ /dev/null
@@ -1,6 +0,0 @@
-// Generate the Abstract Syntactic Tree for the foo Scilab function
-
-getf("foo.sci");
-exec %program_p.sci;
-t=macr2tree(foo);
-t
diff --git a/src/Scilab2C/ASTGenerator/GetASTFile.sci b/src/Scilab2C/ASTGenerator/GetASTFile.sci
new file mode 100644
index 00000000..3c9b4f48
--- /dev/null
+++ b/src/Scilab2C/ASTGenerator/GetASTFile.sci
@@ -0,0 +1,42 @@
+function GetASTFile(FileInfoDatFile);
+// function GetASTFile(FileInfoDatFile);
+// -----------------------------------------------------------------
+// Generates the AST file starting from the .sci file specified
+// in SharedInfo.Next(1).SCIFileName.
+//
+// Input data:
+// FileInfoDatFile: name of the .dat file containing the FileInfo structure.
+// SharedInfoDatFile: it is a buffer containing parameters that are exchanged by the
+// functions of the SCI2C tool.
+//
+// Output data:
+//
+// Status:
+// 11-Apr-2007 -- Nutricato Raffaele: Author.
+// -----------------------------------------------------------------
+
+// ---------------------------------
+// --- Load File Info Structure. ---
+// ---------------------------------
+load(FileInfoDatFile,'FileInfo');
+
+// -----------------------------------
+// --- Load Shared Info Structure. ---
+// -----------------------------------
+load(FileInfo.SharedInfoDatFile,'SharedInfo');
+
+// Extraction of the function name and number.
+funname = SharedInfo.Next(1).SCIFunName;
+funnumber = SharedInfo.NextSCIFunNumber;
+
+PrintStepInfo('Generate the AST in '+FileInfo.Funct(funnumber).ASTFileName,...
+ FileInfo.GeneralReport,'both');
+
+// --- Generation of the AST file. ---
+SciFile2ASTFile(FileInfo.Funct(funnumber).SCIFileName,...
+ FileInfo.Funct(funnumber).ASTFileName);
+
+// --- Save File Info Structure. ---
+// save(FileInfoDatFile,FileInfo);
+
+endfunction
diff --git a/src/Scilab2C/ASTGenerator/foo.sci b/src/Scilab2C/ASTGenerator/foo.sci
deleted file mode 100644
index 1aad4c34..00000000
--- a/src/Scilab2C/ASTGenerator/foo.sci
+++ /dev/null
@@ -1,8 +0,0 @@
-// example to show how the AST is generated.
-// In the Scilab workspace type the following commands:
-//
-function y=foo(x)
-
-y = sin(cos(x));
-y = sin(convol(x,y));
-endfunction
diff --git a/src/Scilab2C/ASTGenerator/foo1.sci b/src/Scilab2C/ASTGenerator/foo1.sci
deleted file mode 100644
index a988bfd8..00000000
--- a/src/Scilab2C/ASTGenerator/foo1.sci
+++ /dev/null
@@ -1,8 +0,0 @@
-// example to show how the AST is generated.
-// In the Scilab workspace type the following commands:
-//
-function y=foo(x)
-
-y=x+1;
-
-endfunction