diff options
author | jofret | 2010-06-21 06:24:38 +0000 |
---|---|---|
committer | jofret | 2010-06-21 06:24:38 +0000 |
commit | 8b44229ef44f0558ce045e46ff833fb44df913c9 (patch) | |
tree | 4fdd89b2258c18c905d2f17ef4bea8ea9cf32893 /macros/ASTManagement/SciFile2ASTFile.sci | |
parent | af0366230e14cc75d9e9a183375ee9cb69fb46b6 (diff) | |
download | scilab2c-8b44229ef44f0558ce045e46ff833fb44df913c9.tar.gz scilab2c-8b44229ef44f0558ce045e46ff833fb44df913c9.tar.bz2 scilab2c-8b44229ef44f0558ce045e46ff833fb44df913c9.zip |
Tagging the 2.0 release of scilab2crelease-2.0
Diffstat (limited to 'macros/ASTManagement/SciFile2ASTFile.sci')
-rw-r--r-- | macros/ASTManagement/SciFile2ASTFile.sci | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/macros/ASTManagement/SciFile2ASTFile.sci b/macros/ASTManagement/SciFile2ASTFile.sci new file mode 100644 index 00000000..be978c57 --- /dev/null +++ b/macros/ASTManagement/SciFile2ASTFile.sci @@ -0,0 +1,36 @@ +function SciFile2ASTFile(SciFile,ASTFile); +// function SciFile2ASTFile(SciFile,ASTFile); +// ----------------------------------------------------------------- +// This function makes use of the macr2tree function to generate +// the ASTFile containing the AST (Abstract Syntactic Tree) of the +// input Scilab function (SciFile). +// +// Input data: +// SciFile: full path of the input function. +// ASTFile: full path of the file that will store the AST. +// +// Output data: +// --- +// +// Status: +// 12-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +exec(SciFile); +[tmppath,ScilabFunName,tmpext] = fileparts(SciFile); +AST=eval('macr2tree('+ScilabFunName+')'); + + +[ASTx,ASTierr]=fileinfo(ASTFile); +if ASTierr == 0 + mdelete(ASTFile); +end + +fd = mopen(ASTFile, "wt"); +mputl(string(AST), fd); +mclose(fd); + +endfunction |