From c0723e47c05ef92516df10c86db892c8472bfa6b Mon Sep 17 00:00:00 2001 From: nutricato Date: Fri, 13 Jul 2007 10:05:05 +0000 Subject: --- .../ASTGenerator/DescriptionOfmacr2tree.txt | 82 ---------------------- src/Scilab2C/ASTGenerator/GenerateASTfoo.sci | 6 -- src/Scilab2C/ASTGenerator/GetASTFile.sci | 42 +++++++++++ src/Scilab2C/ASTGenerator/foo.sci | 8 --- src/Scilab2C/ASTGenerator/foo1.sci | 8 --- 5 files changed, 42 insertions(+), 104 deletions(-) delete mode 100644 src/Scilab2C/ASTGenerator/DescriptionOfmacr2tree.txt delete mode 100644 src/Scilab2C/ASTGenerator/GenerateASTfoo.sci create mode 100644 src/Scilab2C/ASTGenerator/GetASTFile.sci delete mode 100644 src/Scilab2C/ASTGenerator/foo.sci delete mode 100644 src/Scilab2C/ASTGenerator/foo1.sci 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 - - Equal - Expression: - Operation - Operands: - x - 1 - Operator: + - EndOperation - Lhs : - y - EndEqual - - Funcall : return - #lhs : 0 - Rhs : - - EndFuncall - -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 -- cgit