diff options
author | jofret | 2009-05-11 06:26:59 +0000 |
---|---|---|
committer | jofret | 2009-05-11 06:26:59 +0000 |
commit | 37a6f946f56b27a34897eeece4e57c7e01ee6b31 (patch) | |
tree | 69c3e9819ce68099d50b5424a118265a10ccbcbc /macros | |
parent | ca2830ea969db3a183ab732fec89cde14e8fb3df (diff) | |
download | scilab2c-37a6f946f56b27a34897eeece4e57c7e01ee6b31.tar.gz scilab2c-37a6f946f56b27a34897eeece4e57c7e01ee6b31.tar.bz2 scilab2c-37a6f946f56b27a34897eeece4e57c7e01ee6b31.zip |
Link GUI and code generator
Diffstat (limited to 'macros')
-rw-r--r-- | macros/cb_sci2c_gui.sci | 64 | ||||
-rw-r--r-- | macros/runscicode.sci | 1 | ||||
-rw-r--r-- | macros/scilab2c.sci | 6 |
3 files changed, 37 insertions, 34 deletions
diff --git a/macros/cb_sci2c_gui.sci b/macros/cb_sci2c_gui.sci index 65509c20..1c426f62 100644 --- a/macros/cb_sci2c_gui.sci +++ b/macros/cb_sci2c_gui.sci @@ -1,11 +1,11 @@ // // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab -// Copyright (C) 2009 - INRIA - Vincent COUVERT -// +// Copyright (C) 2009 - INRIA - Vincent COUVERT +// // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms -// are also available at +// are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt // @@ -17,63 +17,63 @@ function cb_sci2c_gui // --- File to convert --- // if get(gcbo,"tag")=="filebtn" then - + filename = uigetfile("*.sci", getcwd(), gettext("Select the file to translate")); if ~isempty(filename) then set(findobj("tag", "fileedit"), "string", filename); end - + // // --- Sub-functions directory --- // elseif get(gcbo,"tag")=="subfunsbtn" then - + directory = uigetdir(getcwd(), gettext("Select your sub-functions directory")); if ~isempty(directory) then set(findobj("tag", "subfunsedit"), "string", directory); end - + // // --- Header file --- // elseif get(gcbo,"tag")=="headerbtn" then - + filename = uigetfile("*.h", getcwd(), gettext("Select SciLib main header file")); if ~isempty(filename) then set(findobj("tag", "headeredit"), "string", filename); end - + // // --- Output directory --- // elseif get(gcbo,"tag")=="outbtn" then - + directory = uigetdir(getcwd(), gettext("Select the directory for generated files")); if ~isempty(directory) then set(findobj("tag", "outedit"), "string", directory); end - + // // --- Run mode option --- // elseif or(get(gcbo, "tag")==["runradioall","runradiotranslate","runradiogenlib"]) then - + set(findobj("tag", "runradioall"), "value", 0); set(findobj("tag", "runradiotranslate"), "value", 0); set(findobj("tag", "runradiogenlib"), "value", 0); - + set(gcbo, "value", 1); - + // // --- Copy Scilab code into C option --- // elseif or(get(gcbo, "tag")==["sciintocradioyes","sciintocradiono"]) then - + set(findobj("tag", "sciintocradioyes"), "value", 0); set(findobj("tag", "sciintocradiono"), "value", 0); set(gcbo, "value", 1); - + // // --- Paths style option --- // @@ -82,9 +82,9 @@ elseif or(get(gcbo, "tag")==["pathsradiowin","pathsradiounix","pathsradiocygwin" set(findobj("tag", "pathsradiowin"), "value", 0); set(findobj("tag", "pathsradiounix"), "value", 0); set(findobj("tag", "pathsradiocygwin"), "value", 0); - + set(gcbo, "value", 1); - + // // --- Cancel conversion --- // @@ -96,13 +96,13 @@ elseif get(gcbo, "tag")=="cancelbtn" | get(gcbo, "tag")=="close_menu" then // elseif get(gcbo, "tag")=="convertbtn" then UserScilabMainFile = get(findobj("tag", "fileedit"), "string"); - + UserSciFilesPaths = get(findobj("tag", "subfunsedit"), "string"); - + Sci2CLibMainHeaderFName = get(findobj("tag", "headeredit"), "string"); - + UserSciCodeMainDir = get(findobj("tag", "outedit"), "string"); - + if get(findobj("tag", "runradioall"), "value") == 1 then RunMode = "All"; elseif get(findobj("tag", "runradiotranslate"), "value") == 1 then @@ -110,9 +110,9 @@ elseif get(gcbo, "tag")=="convertbtn" then else RunMode = "GenLibraryStructure"; end - + CopySciCodeIntoCCode = get(findobj("tag", "sciintocradioyes"), "value") == 1; - + if get(findobj("tag", "pathsradiowin"), "value") == 1 then CCompilerPathStyle = "windows"; elseif get(findobj("tag", "pathsradiounix"), "value") == 1 then @@ -120,15 +120,15 @@ elseif get(gcbo, "tag")=="convertbtn" then else CCompilerPathStyle = "cygwin"; end - - mprintf("UserScilabMainFile = %s\n", UserScilabMainFile); - mprintf("UserSciFilesPaths = %s\n", UserSciFilesPaths); - mprintf("Sci2CLibMainHeaderFName = %s\n", Sci2CLibMainHeaderFName); - mprintf("UserSciCodeMainDir = %s\n", UserSciCodeMainDir); - mprintf("RunMode = %s\n", RunMode); - mprintf("CopySciCodeIntoCCode = %d\n", bool2s(CopySciCodeIntoCCode)); - mprintf("CCompilerPathStyle = %s\n", CCompilerPathStyle); + mprintf("UserScilabMainFile = {%s}\n", UserScilabMainFile); + mprintf("UserSciFilesPaths = {%s}\n", UserSciFilesPaths); + mprintf("Sci2CLibMainHeaderFName = {%s}\n", Sci2CLibMainHeaderFName); + mprintf("UserSciCodeMainDir = {%s}\n", UserSciCodeMainDir); + mprintf("RunMode = {%s}\n", RunMode); + mprintf("CopySciCodeIntoCCode = {%d}\n", bool2s(CopySciCodeIntoCCode)); + mprintf("CCompilerPathStyle = {%s}\n", CCompilerPathStyle); + scilab2c(UserScilabMainFile, UserSciCodeMainDir, UserSciFilesPaths, RunMode); // // --- sci2c help --- // diff --git a/macros/runscicode.sci b/macros/runscicode.sci index 6a34a931..d6bdc37d 100644 --- a/macros/runscicode.sci +++ b/macros/runscicode.sci @@ -45,7 +45,6 @@ function runscicode(UserScilabMainFile, UserSciFilesPaths) // --- Read user parameters. --- //exec(SCI2CInputPrmFile); - // --- Add all user paths. --- for cntpath = 1:size(UserSciFilesPaths,1) getd(UserSciFilesPaths(cntpath)); diff --git a/macros/scilab2c.sci b/macros/scilab2c.sci index 332053ff..b068c970 100644 --- a/macros/scilab2c.sci +++ b/macros/scilab2c.sci @@ -48,7 +48,11 @@ function scilab2c(varargin) end UserScilabMainFile = varargin(1); CCodeOutputDir = varargin(2); - UserSciFilesPaths = varargin(3); + if varargin(3) == "" + UserSciFilesPaths = []; + else + UserSciFilesPaths = varargin(3); + end RunMode = "All"; // // scilab2c(UserScilabMainFile, CCodeOutputDir, UserSciFilesPaths, RunMode) |