summaryrefslogtreecommitdiff
path: root/src/Scilab2C/FunctionTableManagement/Example.sce
diff options
context:
space:
mode:
authornutricato2007-03-22 11:16:08 +0000
committernutricato2007-03-22 11:16:08 +0000
commite733d0ce2c4d804896031c0789fa192106508a35 (patch)
treede48d20cd612719258ca77cc1a989b76bdf834b8 /src/Scilab2C/FunctionTableManagement/Example.sce
parent1f7bc0e6e253814dcb748da0eb8f931f45de7952 (diff)
downloadscilab2c-e733d0ce2c4d804896031c0789fa192106508a35.tar.gz
scilab2c-e733d0ce2c4d804896031c0789fa192106508a35.tar.bz2
scilab2c-e733d0ce2c4d804896031c0789fa192106508a35.zip
Preliminary version to generate a tree for each library function
Diffstat (limited to 'src/Scilab2C/FunctionTableManagement/Example.sce')
-rw-r--r--src/Scilab2C/FunctionTableManagement/Example.sce152
1 files changed, 152 insertions, 0 deletions
diff --git a/src/Scilab2C/FunctionTableManagement/Example.sce b/src/Scilab2C/FunctionTableManagement/Example.sce
new file mode 100644
index 00000000..dde9e9c2
--- /dev/null
+++ b/src/Scilab2C/FunctionTableManagement/Example.sce
@@ -0,0 +1,152 @@
+// in the following you can find some examples that help you to use the biuild in functions.
+
+// the first operation is to find the path where the files are stored
+// cd <path>
+
+ clear;
+ clc;
+
+ getf("main.sci");
+ [SCI2CLib, USER2CLib] = main();
+
+//
+// I add the same function with two inputs
+//
+// Branch=FunctionStructure;
+// TreeBase=USER2CLib;
+//
+ getf("SearchFunctionName.sci");
+ getf("AddBranch.sci");
+
+ FunctionStructure = "fn.S.R.D.S.R.D.CINFO";
+
+ clear CINFO;
+
+ CINFO.CPROT = "y=SRDSRDfnSRD";
+ CINFO.SIZE = "S";
+ CINFO.TYPE = "R";
+ CINFO.PREC = "D";
+
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "SCI2CLib");
+
+ if FlagFind==%F then
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "USER2CLib");
+
+ if FlagFind==%F then
+ USER2CLib = AddBranch( USER2CLib, FunctionStructure, CINFO );
+ end
+
+ end
+
+ eval("USER2CLib." + FunctionStructure)
+
+//
+// now I change one output type
+//
+// Branch=FunctionStructure;
+// TREE="USER2CLib";
+//
+ getf("SearchFunctionName.sci");
+ getf("AddBranch.sci");
+
+ FunctionStructure = "fn.S.R.D.CINFO";
+
+ clear CINFO;
+
+ CINFO.CPROT = "y=SRDfnSRD";
+ CINFO.SIZE = "S";
+ CINFO.TYPE = "R";
+ CINFO.PREC = "D";
+
+
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "SCI2CLib");
+
+ if FlagFind==%F then
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "USER2CLib");
+
+ if FlagFind==%F then
+ USER2CLib = AddBranch( USER2CLib, FunctionStructure, CINFO );
+ end
+
+ end
+
+ eval("USER2CLib." + FunctionStructure)
+
+//
+// I add the same function with two outputs:
+// 1. the first output is S.R.D
+// 2. the second output is M.R.D.
+//
+// Branch=FunctionStructure;
+// TREE="USER2CLib";
+//
+ FunctionStructure = "fn.S.R.D.CINFO(2)";
+
+ clear CINFO;
+
+ S(1) = "S";
+ R(1) = "R";
+ D(1) = "D";
+
+ S(2) = "M";
+ R(2) = "R";
+ D(2) = "D";
+
+ CINFO.CPROT = "y=SRDfnSRDSRD";
+ CINFO.SIZE = S;
+ CINFO.TYPE = R;
+ CINFO.PREC = D;
+
+
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "SCI2CLib");
+
+ if FlagFind==%F then
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "USER2CLib");
+
+ if FlagFind==%F then
+ USER2CLib = AddBranch( USER2CLib, FunctionStructure, CINFO );
+ end
+
+ end
+
+ eval("USER2CLib." + FunctionStructure)
+
+//
+// fn.S.R.F.CINFO
+//
+// where
+//
+// CINFO.
+// CPRO = "y=SRFfnSRF(x)"
+// SIZE = "S"
+// TYPE = "R"
+// PREC = "F"
+
+// Branch=FunctionStructure;
+// TREE="USER2CLib";
+
+ getf("SearchFunctionName.sci");
+ getf("AddBranch.sci");
+
+ FunctionStructure = "fn.S.R.F.CINFO";
+
+ CINFO(1).CPROT = "y=SRFfnSRF";
+ CINFO(1).SIZE = "S";
+ CINFO(1).TYPE = "R";
+ CINFO(1).PREC = "F";
+
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "SCI2CLib");
+
+ if FlagFind==%F then
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "USER2CLib");
+
+ if FlagFind==%F then
+
+ USER2CLib = AddBranch(USER2CLib, FunctionStructure, CINFO );
+
+ end
+
+ end
+
+ eval("USER2CLib." + FunctionStructure)
+