cleaner.sce generated
Allan CORNET [Mon, 18 May 2009 08:37:36 +0000 (10:37 +0200)]
40 files changed:
scilab/CHANGES_5.2.X
scilab/contrib/toolbox_skeleton/.gitignore
scilab/contrib/toolbox_skeleton/builder.sce
scilab/contrib/toolbox_skeleton/macros/cleanmacros.sce [new file with mode: 0644]
scilab/contrib/toolbox_skeleton/sci_gateway/builder_gateway.sce
scilab/contrib/toolbox_skeleton/src/cleaner_src.sce [new file with mode: 0644]
scilab/modules/development_tools/help/en_US/tbx_build_cleaner.xml [new file with mode: 0644]
scilab/modules/development_tools/help/en_US/tbx_build_gateway_clean.xml [new file with mode: 0644]
scilab/modules/development_tools/macros/tbx_build_cleaner.sci [new file with mode: 0644]
scilab/modules/development_tools/macros/tbx_build_gateway_clean.sci [new file with mode: 0644]
scilab/modules/dynamic_link/help/en_US/ilib_gen_cleaner.xml [new file with mode: 0644]
scilab/modules/dynamic_link/macros/ilib_build.sci
scilab/modules/dynamic_link/macros/ilib_compile.sci
scilab/modules/dynamic_link/macros/ilib_for_link.sci
scilab/modules/dynamic_link/macros/ilib_gen_cleaner.sci [new file with mode: 0644]
scilab/modules/dynamic_link/macros/ilib_gen_gateway.sci
scilab/modules/dynamic_link/tests/nonreg_tests/bug_2085.macosx.dia.ref
scilab/modules/dynamic_link/tests/nonreg_tests/bug_2085.unix.dia.ref
scilab/modules/dynamic_link/tests/nonreg_tests/bug_2085.win.dia.ref
scilab/modules/dynamic_link/tests/nonreg_tests/bug_2119.unix.dia.ref
scilab/modules/dynamic_link/tests/nonreg_tests/bug_2119.win.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/addinter.macosx.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/addinter.unix.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/addinter.win.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build.macosx.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build.unix.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build.win.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build_2.macosx.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build_2.unix.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build_2.win.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build_cpp.macosx.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build_cpp.unix.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_build_cpp.win.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_for_link.macosx.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_for_link.unix.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/ilib_for_link.win.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/optim_external.unix.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/optim_external.win.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/schur_external.unix.dia.ref
scilab/modules/dynamic_link/tests/unit_tests/schur_external.win.dia.ref

index 2a95aaa..d26672b 100644 (file)
@@ -38,6 +38,7 @@ Source reorganisation:
 toolbox_skeleton:
 =================
  - examples of gateways functions (c_sum, f_sum, cpp_find) rewritten with new API.
+ - cleaner added
 
 Input/Output functions:
 =======================
@@ -80,6 +81,8 @@ Dynamic link:
  
  - add a example to call a scilab macro from a C interface
    (see SCI/modules/dynamic_link/examples/interfaces/call_scilab_function directory)
+   
+ - a 'cleaner.sce' file is generated by 'ilib_for_link' and 'ilib_build'.
 
 Online Help :
 =============
index 1386b44..cd92024 100644 (file)
@@ -1,13 +1,17 @@
 #
+# Generated files (common)
+#
+loader.sce
+cleaner.sce
+loader_gateway.sce
+#
 # Generated files (Windows)
 #
 *.dll
 *.def
 *.obj
 Makelib.mak
-loader.sce
 master_help.xml
-loader_gateway.sce
 skeleton_*.c
 scilab_*_help
 #
index 7ab700f..6f4aabc 100644 (file)
@@ -26,6 +26,7 @@ tbx_builder_src(toolbox_dir);
 tbx_builder_gateway(toolbox_dir);
 tbx_builder_help(toolbox_dir);
 tbx_build_loader(TOOLBOX_NAME, toolbox_dir);
+tbx_build_cleaner(TOOLBOX_NAME, toolbox_dir);
 
 clear toolbox_dir TOOLBOX_NAME TOOLBOX_TITLE;
 // ====================================================================
diff --git a/scilab/contrib/toolbox_skeleton/macros/cleanmacros.sce b/scilab/contrib/toolbox_skeleton/macros/cleanmacros.sce
new file mode 100644 (file)
index 0000000..0b2db48
--- /dev/null
@@ -0,0 +1,16 @@
+// ====================================================================
+// Allan CORNET
+// DIGITEO 2009
+// This file is released into the public domain
+// ====================================================================
+libpath = get_absolute_file_path('cleanmacros.sce');
+
+binfiles = ls(libpath+'/*.bin');
+for i = 1:size(binfiles,'*')
+  mdelete(binfiles(i));
+end
+
+mdelete(libpath+'/names');
+mdelete(libpath+'/lib');
+
+// ====================================================================
index ab1367a..2fc21a0 100644 (file)
@@ -18,6 +18,7 @@ else
 end
 
 tbx_build_gateway_loader(languages, sci_gateway_dir);
+tbx_build_gateway_clean(languages, sci_gateway_dir);
 
 clear tbx_builder_gateway_lang tbx_build_gateway_loader;
 clear sci_gateway_dir;
diff --git a/scilab/contrib/toolbox_skeleton/src/cleaner_src.sce b/scilab/contrib/toolbox_skeleton/src/cleaner_src.sce
new file mode 100644 (file)
index 0000000..0f4b334
--- /dev/null
@@ -0,0 +1,17 @@
+// ====================================================================
+// Allan CORNET
+// DIGITEO 2009
+// This file is released into the public domain
+// ====================================================================
+
+src_dir = get_absolute_file_path('cleaner_src.sce');
+
+langs = ['c','cpp','fortran'];
+for l = langs
+  if fileinfo(src_dir +'/' + l + '/cleaner.sce') <> [] then
+    exec(src_dir +'/' + l + '/cleaner.sce');
+    mdelete(src_dir +'/' + l + '/cleaner.sce');
+  end
+end
+
+clear src_dir;
diff --git a/scilab/modules/development_tools/help/en_US/tbx_build_cleaner.xml b/scilab/modules/development_tools/help/en_US/tbx_build_cleaner.xml
new file mode 100644 (file)
index 0000000..f039915
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) DIGITEO - 2009 - Allan CORNET
+ * 
+ * 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    
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ -->
+<refentry version="5.0-subset Scilab" xml:id="tbx_build_cleaner" xml:lang="en"
+          xmlns="http://docbook.org/ns/docbook"
+          xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg"
+          xmlns:ns5="http://www.w3.org/1999/xhtml"
+          xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook">
+  <info>
+    <pubdate>$LastChangedDate: 2008-08-19 17:25:59 +0200 $</pubdate>
+  </info>
+
+  <refnamediv>
+    <refname>tbx_build_cleaner</refname>
+
+    <refpurpose>Generate a cleaner.sce script (toolbox compilation
+    process)</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <title>Calling Sequence</title>
+
+    <synopsis>
+  tbx_build_loader(toolbox_name)
+  tbx_build_loader(toolbox_name, toolbox_path)
+    </synopsis>
+  </refsynopsisdiv>
+
+  <refsection>
+    <title>Parameters</title>
+
+    <variablelist>
+      <varlistentry>
+        <term>toolbox_name</term>
+
+        <listitem>
+          <para>Toolbox short name ; that is, the prefix of the .start file of
+          the toolbox (which shall be in the etc subdirectory).</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>toolbox_path</term>
+
+        <listitem>
+          <para>Root directory of toolbox sources ; the script will be
+          generated here (default: current directory).</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsection>
+
+  <refsection>
+    <title>Examples</title>
+
+    <programlisting role="example">
+// Recommended usage
+tbx_build_cleaner("mytoolbox", get_absolute_file_path('builder.sce'))
+   </programlisting>
+  </refsection>
+
+  <refsection>
+    <title>Authors</title>
+
+    <simplelist type="vert">
+      <member>Allan CORNET</member>
+    </simplelist>
+  </refsection>
+</refentry>
diff --git a/scilab/modules/development_tools/help/en_US/tbx_build_gateway_clean.xml b/scilab/modules/development_tools/help/en_US/tbx_build_gateway_clean.xml
new file mode 100644 (file)
index 0000000..6bb1508
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) DIGITEO - 2009 - Allan CORNET
+ * 
+ * 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    
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ -->
+<refentry version="5.0-subset Scilab" xml:id="thx_build_gateway_clean"
+          xml:lang="en" xmlns="http://docbook.org/ns/docbook"
+          xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg"
+          xmlns:ns5="http://www.w3.org/1999/xhtml"
+          xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook">
+  <info>
+    <pubdate>$LastChangedDate: 2008-09-19 13:51:04 +0200 $</pubdate>
+  </info>
+
+  <refnamediv>
+    <refname>tbx_build_gateway_clean</refname>
+
+    <refpurpose>Generate a cleaner_gateway.sce script (toolbox compilation
+    process)</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <title>Calling Sequence</title>
+
+    <synopsis>
+  tbx_build_gateway_loader(langs)
+  tbx_build_gateway_loader(langs, gateway_path)
+    </synopsis>
+  </refsynopsisdiv>
+
+  <refsection>
+    <title>Parameters</title>
+
+    <variablelist>
+      <varlistentry>
+        <term>langs</term>
+
+        <listitem>
+          <para>Languages of source files.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>gateway_path</term>
+
+        <listitem>
+          <para>Path to the sources of the gateway ; in a normal toolbox it
+          should be the directory containing the builder_gateway.sce script
+          (which should be the script calling this function). Default is
+          current directory.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsection>
+
+  <refsection>
+    <title>Examples</title>
+
+    <programlisting role="example">
+// Recommended usage
+tbx_build_gateway_clean(['c', 'fortran'], get_absolute_file_path('builder_gateway.sce'))
+   </programlisting>
+  </refsection>
+
+  <refsection>
+    <title>Authors</title>
+
+    <simplelist type="vert">
+      <member>Allan CORNET</member>
+    </simplelist>
+  </refsection>
+</refentry>
diff --git a/scilab/modules/development_tools/macros/tbx_build_cleaner.sci b/scilab/modules/development_tools/macros/tbx_build_cleaner.sci
new file mode 100644 (file)
index 0000000..a95ba38
--- /dev/null
@@ -0,0 +1,56 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+// 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
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+// Generate a cleaner.sce script for the toolbox
+function tbx_build_cleaner(toolbox_name, toolbox_path)
+       oldpath = pwd();
+       
+       if(exists('toolbox_path', 'local')) then
+               chdir(toolbox_path);
+       end
+       
+       mprintf(gettext('Generating cleaner.sce...\n'));
+       cleaner = [
+         "// ====================================================================",
+         "// generated by builder.sce",
+         "// Copyright DIGITEO 2009",
+         "// ====================================================================",
+         "try",
+         " getversion(''scilab'');",
+         "catch",
+         " warning(''Scilab 5.0 or more is required.'');",
+         " return;",
+         "end;",
+         "// ====================================================================",
+         "root_tlbx = get_absolute_file_path(''cleaner.sce'');",
+         "",
+         "if fileinfo(root_tlbx+''/macros/cleanmacros.sce'') <> [] then",
+         "  exec(root_tlbx+''/macros/cleanmacros.sce'');",
+         "end",
+         "",
+         "if fileinfo(root_tlbx+''/src/cleaner_src.sce'') <> [] then",
+         "  exec(root_tlbx+''/src/cleaner_src.sce'');",
+         "end",
+         "",
+         "if fileinfo(root_tlbx+''/sci_gateway/cleaner_gateway.sce'') <> [] then",
+         "  exec(root_tlbx+''/sci_gateway/cleaner_gateway.sce'');",
+         "  mdelete(root_tlbx+''/sci_gateway/cleaner_gateway.sce'');",
+         "end",
+         "",
+         "if fileinfo(root_tlbx+''/loader.sce'') <> [] then",
+         "  mdelete(root_tlbx+''/loader.sce'');",
+         "end",
+         "// ====================================================================",
+         "clear root_tlbx;",
+         "// ===================================================================="
+       ];
+       mputl(cleaner,'cleaner.sce');
+       
+       chdir(oldpath);
+endfunction
diff --git a/scilab/modules/development_tools/macros/tbx_build_gateway_clean.sci b/scilab/modules/development_tools/macros/tbx_build_gateway_clean.sci
new file mode 100644 (file)
index 0000000..9983b56
--- /dev/null
@@ -0,0 +1,55 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+// 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
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+// Generate a cleaner_gateway.sce script for the gateway
+function tbx_build_gateway_clean(langs, gateway_path)
+       oldpath = pwd();
+       
+       if(exists('gateway_path', 'local')) then
+               chdir(gateway_path);
+       end
+       
+       mprintf(gettext('Generating cleaner_gateway.sce...\n'));
+       cleaner = [
+         "// ====================================================================",
+         "// Allan CORNET",
+         "// Simon LIPP",
+         "// INRIA 2008",
+         "// ====================================================================",
+         "// Generated by cleaner_gateway.sce, do not edit",
+         "// ====================================================================",
+         "sci_gateway_dir = get_absolute_file_path(''cleaner_gateway.sce'');",
+         "",
+         "current_dir = pwd();",
+         ""];
+       
+       for i = 1:size(langs, "*")
+               cleaner = [cleaner, 
+                 "chdir(sci_gateway_dir);",
+                 "if ( isdir(''"+langs(i)+"'') ) then",
+                 "  chdir(''"+langs(i)+"'');",
+                 "  exec(''cleaner.sce'');",
+                 "  mdelete(''cleaner.sce'');",
+                 "end",
+                 ""
+               ];
+       end
+       
+       cleaner = [cleaner,
+         "chdir(current_dir);",
+         "// ====================================================================",
+         "clear sci_gateway_dir;",
+         "clear current_dir;",
+         "// ===================================================================="
+       ];
+       
+       mputl(cleaner,'cleaner_gateway.sce');
+       
+       chdir(oldpath);
+endfunction
diff --git a/scilab/modules/dynamic_link/help/en_US/ilib_gen_cleaner.xml b/scilab/modules/dynamic_link/help/en_US/ilib_gen_cleaner.xml
new file mode 100644 (file)
index 0000000..60f807c
--- /dev/null
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) DIGITEO - 2009 - Allan CORNET
+ * 
+ * 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    
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="ilib_gen_cleaner">
+  <info>
+    <pubdate>$LastChangedDate: 2006-09-03 11:54:48 +0200 (Sun, 03 Sep 2006) $</pubdate>
+  </info>
+  <refnamediv>
+    <refname>ilib_gen_cleaner</refname>
+    <refpurpose> utility for ilib_build: generates a cleaner file</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <title>Calling Sequence</title>
+    <synopsis>ilib_gen_cleaner(makename,[loadername],[files])</synopsis>
+  </refsynopsisdiv>
+  <refsection>
+    <title>Parameters</title>
+    <variablelist>
+       
+      <varlistentry>
+        <term>makename</term>
+        <listitem>
+          <para>character string. The pathname of the Makefile file without extension (default value <literal>Makelib</literal>).</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term>loadername</term>
+        <listitem>
+          <para>character string. The pathname of the loader file (default value is <literal>loader.sce</literal>).</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term>files</term>
+        <listitem>
+          <para>matrix of character string. files to delete.</para>
+        </listitem>
+      </varlistentry>
+      
+      
+    </variablelist>
+  </refsection>
+  <refsection>
+    <title>Description</title>
+    <para>
+    Utility function used by <literal>ilib_build and ilib_for_link</literal>
+    This function generates a cleaner file.</para>
+  </refsection>
+  <refsection>
+    <title>See Also</title>
+    <simplelist type="inline">
+      <member>
+        <link linkend="ilib_gen_loader">ilib_gen_loader</link>
+      </member>
+      <member>
+        <link linkend="ilib_build">ilib_build</link>
+      </member>
+      <member>
+        <link linkend="ilib_for_link">ilib_for_link</link>
+      </member>
+    </simplelist>
+  </refsection>
+</refentry>
index ea3246b..6e6fd38 100644 (file)
@@ -31,7 +31,7 @@ function ilib_build(ilib_name,table,files,libs,makename,ldflags,cflags,fflags,is
   if ( ilib_verbose() <> 0 ) then
     mprintf(_("   Generate a gateway file\n"));
   end    
-  ilib_gen_gateway(ilib_name,table);
+  file_gw_name = ilib_gen_gateway(ilib_name,table);
   
   // generate a loader file
   if ( ilib_verbose() <> 0 ) then
@@ -63,7 +63,12 @@ function ilib_build(ilib_name,table,files,libs,makename,ldflags,cflags,fflags,is
     mprintf(_("   Running the makefile\n"));
   end
   
-  ilib_compile(ilib_name,makename,files);
+  libn = ilib_compile(ilib_name,makename,files);
+  
+  if ( ilib_verbose() <> 0 ) then
+    mprintf(_("   Generate a cleaner file\n"));
+  end
+  ilib_gen_cleaner(makename,'loader.sce',[libn;file_gw_name]);
   
 endfunction
 //==========================================
index 62db562..1fad948 100644 (file)
@@ -1,6 +1,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
 // Copyright (C) ENPC
+// Copyright (C) DIGITEO - 2009
 // 
 // This file must be used under the terms of the CeCILL.
 // This source file is licensed as described in the file COPYING, which
index 90e068a..33c272f 100644 (file)
@@ -38,6 +38,7 @@ function libn = ilib_for_link(names, ..
   
   ilib_gen_loader(names,flag,loadername,libs,libname);
   
+  
   // generate a Makefile
   if ( ilib_verbose() <> 0 ) then
     mprintf(gettext("   Generate a Makefile\n"));
@@ -61,6 +62,12 @@ function libn = ilib_for_link(names, ..
   if (libname == "") then libname = names(1);end
   libn = ilib_compile('lib' + libname, makename, files);
   
+  if ( ilib_verbose() <> 0 ) then
+    mprintf(_("   Generate a cleaner file\n"));
+  end
+  ilib_gen_cleaner(makename,loadername,libn);
+
+  
 endfunction
 //==========================================
 function ilib_link_gen_Make(names, ..
diff --git a/scilab/modules/dynamic_link/macros/ilib_gen_cleaner.sci b/scilab/modules/dynamic_link/macros/ilib_gen_cleaner.sci
new file mode 100644 (file)
index 0000000..3d7bb51
--- /dev/null
@@ -0,0 +1,106 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) DIGITEO - 2009 - Allan CORNET
+// 
+// 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    
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+//==========================================
+function ilib_gen_cleaner(makename,loadername,files)
+
+  [lhs,rhs] = argn(0);
+
+  if (rhs < 1) then
+    makename = 'makelib';
+  end
+
+  if (rhs < 2) then
+    loadername = 'loader.sce';
+  end
+  
+  if (rhs < 3) then
+    files = [];
+  end
+
+  cleanername = 'cleaner.sce';
+
+  fd = mopen(cleanername,"wt");
+  mfprintf(fd,"// ------------------------------------------------------\n");
+  mfprintf(fd,"// generated by builder.sce: Please do not edit this file\n");
+  mfprintf(fd,"// cleaner.sce\n");
+  mfprintf(fd,"// ------------------------------------------------------\n");
+  mfprintf(fd,"curdir = pwd();\n");
+  mfprintf(fd,"cleaner_path = get_file_path(''cleaner.sce'');\n");
+  mfprintf(fd,"chdir(cleaner_path);\n");
+  mfprintf(fd,"// ------------------------------------------------------\n");
+  mfprintf(fd,"if fileinfo(''%s'') <> [] then\n",loadername);
+  mfprintf(fd,"  mdelete(''%s'');\n",loadername);
+  mfprintf(fd,"end\n");
+  mfprintf(fd,"// ------------------------------------------------------\n");
+  
+  if MSDOS then
+    make_command = get_make_command(makename);  
+    mfprintf(fd,"if fileinfo(''%s%s'') <> [] then\n",makename,get_makefile_ext());
+    mfprintf(fd,"  unix_s(''%s'');\n",make_command);  
+    mfprintf(fd,"  mdelete(''%s%s'');\n",makename,get_makefile_ext());
+    mfprintf(fd,"end\n");
+    mfprintf(fd,"// ------------------------------------------------------\n");
+  end 
+
+  if files <> [] then 
+    for i = 1:size(files,'*')
+      if ( files(i) <> '' ) then
+        mfprintf(fd,"if fileinfo(''%s'') <> [] then\n", files(i));
+        mfprintf(fd,"  mdelete(''%s'');\n", files(i));
+        mfprintf(fd,"end\n");
+        mfprintf(fd,"// ------------------------------------------------------\n");
+      end
+    end
+  end
+
+  mfprintf(fd,"chdir(curdir);\n");
+  mfprintf(fd,"// ------------------------------------------------------\n");  
+  mclose(fd);
+
+  if ilib_verbose() > 1 then
+    disp(mgetl('cleaner.sce'));
+  end
+endfunction
+//==========================================
+function cmd = get_make_command(makename)
+  if MSDOS then // WINDOWS
+    // Visual Studio C++ 
+    if ( findmsvccompiler() <> 'unknown' ) then 
+      cmd = 'nmake /Y /nologo /f ' + makename + '.mak' + ' clean';
+    else
+      // LCC-WIN32
+      if findlcccompiler() then
+        cmd = 'make -f ' + makename + '.lcc' + ' clean';
+      else
+      // TO DO : Add another compiler here
+      end
+    end
+  else // LINUX
+    cmd = 'make ' + makename + ' clean'; 
+  end  
+endfunction
+//==========================================
+function ext = get_makefile_ext()
+  if MSDOS then // WINDOWS
+    // Visual Studio C++ 
+    if ( findmsvccompiler() <> 'unknown' ) then 
+      ext = '.mak';
+    else
+      // LCC-WIN32
+      if findlcccompiler() then
+        ext = '.lcc';
+      else
+      // TO DO : Add another compiler here
+      end
+    end
+  else // LINUX
+    ext = '';
+  end  
+endfunction
+//==========================================
index 145d5f7..6661964 100644 (file)
@@ -15,8 +15,8 @@
 // attributes of function i.e mex fmex or scilab interface 
 // if name is a full path just extract the filename 
 
-function ilib_gen_gateway(name,tables)
-
+function gateway_filename = ilib_gen_gateway(name,tables)
+  gateway_filename = '';
   k = strindex(name,['/','\']);
   if k~=[] then
     path = part(name,1:k($));
@@ -73,18 +73,18 @@ function ilib_gen_gateway(name,tables)
                '  return 0;'
                '}'];
 
-               
+         gateway_filename = path + tname + '.c';
     // first chek if we already have a gateway 
-    [fd,ierr] = mopen(path+tname+'.c');
+    [fd,ierr] = mopen(gateway_filename);
     if ierr == 0 then
       mclose(fd);
-      t1 = mgetl(path+tname+'.c') 
+      t1 = mgetl(gateway_filename);
       if t1 <> t then 
-             mputl(t,path+tname+'.c');    
+             mputl(t, gateway_filename);    
       end
     else
        // file does not exist we create it 
-       mputl(t,path+tname+'.c') ;   
+       mputl(t, gateway_filename) ;   
     end
     
     if ilib_verbose() > 1 then
index 1975001..3814795 100644 (file)
@@ -33,6 +33,7 @@ ilib_build('bug',['ex2c_1','intex2c'],files,[]);
    ilib_gen_Make: Copy libbug.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index ff28e98..711396e 100644 (file)
@@ -33,6 +33,7 @@ ilib_build('bug',['ex2c_1','intex2c'],files,[]);
    ilib_gen_Make: Copy libbug.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index 6214710..00c9e7a 100644 (file)
@@ -31,6 +31,7 @@ ilib_build('bug',['ex2c_1','intex2c'],files,[]);
    Running the makefile
    Compilation of bug_2085
    Building shared library (be patient)
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index 87cb8f2..74fbcaa 100644 (file)
@@ -57,6 +57,7 @@ libn=ilib_for_link('dgesvtst','dgesvtst.o',[],'f');
    ilib_gen_Make: Copy dgesvtst.f to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the Makefile
+   Generate a cleaner file   
 exec loader.sce;
 Shared archive loaded.
 Link done.
index 50a1921..cdcabf3 100644 (file)
@@ -56,6 +56,7 @@ libn=ilib_for_link('dgesvtst','dgesvtst.o',[],'f');
    Running the Makefile
    Compilation of dgesvtst
    Building shared library (be patient)
+   Generate a cleaner file   
 exec loader.sce;
 Shared archive loaded.
 Link done.
index b18120a..3f8c233 100644 (file)
@@ -25,6 +25,7 @@ if ~c_link('libintertest') then
    ilib_gen_Make: Copy libintertest.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
   // load the shared library
   exec loader.sce ;
 Shared archive loaded.
index 321a923..261bd46 100644 (file)
@@ -24,6 +24,7 @@ if ~c_link('libintertest') then
    ilib_gen_Make: Copy libintertest.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file
   // load the shared library
   exec loader.sce ;
 Shared archive loaded.
index b6baf83..895696a 100644 (file)
@@ -13,6 +13,7 @@ if ~c_link('libintertest') then
    Running the makefile
    Compilation of addinter
    Building shared library (be patient)
+   Generate a cleaner file
   // load the shared library
   exec loader.sce ;
 Shared archive loaded.
index 5d62e48..fb879e3 100644 (file)
@@ -54,6 +54,7 @@ ilib_build('foo',['scifun1','intfun1'],files,[]);
    ilib_gen_Make: Copy libfoo.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index 6ab4d29..2a8c399 100644 (file)
@@ -54,6 +54,7 @@ ilib_build('foo',['scifun1','intfun1'],files,[]);
    ilib_gen_Make: Copy libfoo.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index 007a105..2c632a6 100644 (file)
@@ -52,6 +52,7 @@ ilib_build('foo',['scifun1','intfun1'],files,[]);
    Compilation of fun2
    Compilation of intfun1
    Building shared library (be patient)
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index df37350..684fad9 100644 (file)
@@ -81,6 +81,7 @@ ilib_build('foo',['c_sum','sci_csum';'c_sub','sci_csub'],files,[]);
    ilib_gen_Make: Copy libfoo.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index e0d8c5b..46a7c84 100644 (file)
@@ -81,6 +81,7 @@ ilib_build('foo',['c_sum','sci_csum';'c_sub','sci_csub'],files,[]);
    ilib_gen_Make: Copy libfoo.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index fa8d471..7d1b9cb 100644 (file)
@@ -79,6 +79,7 @@ ilib_build('foo',['c_sum','sci_csum';'c_sub','sci_csub'],files,[]);
    Compilation of c_sum.c
    Compilation of sci_csum.c
    Building shared library (be patient)
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index dd76f6b..0e59ee7 100644 (file)
@@ -53,6 +53,7 @@ ilib_build('foo',['cppfind','sci_cppfind'],files,[]);
    ilib_gen_Make: Copy libfoo.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index e76a829..2b5eaa4 100644 (file)
@@ -53,6 +53,7 @@ ilib_build('foo',['cppfind','sci_cppfind'],files,[]);
    ilib_gen_Make: Copy libfoo.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the makefile
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index c3b8df4..cf76c63 100644 (file)
@@ -48,6 +48,7 @@ ilib_build('foo',['cppfind','sci_cppfind'],files,[]);
    Running the makefile
    Compilation of sci_cppfind.cxx
    Building shared library (be patient)
+   Generate a cleaner file   
 // load the shared library
 exec loader.sce
  
index d6962d4..3bf844e 100644 (file)
@@ -34,6 +34,7 @@ ilib_for_link('ext1c','fun1.o',[],"c")
    ilib_gen_Make: Copy fun1.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the Makefile
+   Generate a cleaner file   
  ans  =
  
  libext1c.dylib   
index f664c9e..1fbc6b8 100644 (file)
@@ -34,6 +34,7 @@ ilib_for_link('ext1c','fun1.o',[],"c")
    ilib_gen_Make: Copy fun1.c to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the Makefile
+   Generate a cleaner file   
  ans  =
  
  libext1c.so   
index 38f3bfd..0c13bd5 100644 (file)
@@ -33,6 +33,7 @@ ilib_for_link('ext1c','fun1.o',[],"c")
    Running the Makefile
    Compilation of fun1
    Building shared library (be patient)
+   Generate a cleaner file
  ans  =
  
  libext1c.dll   
index 2d49711..595a476 100644 (file)
@@ -43,6 +43,7 @@ l=ilib_for_link('rosenc','rosenc.o',[],'c',TMPDIR+'/Makefile');
    ilib_gen_Make: Copy rosenc.o to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the Makefile
+   Generate a cleaner file   
 // incremental linking
 link(l,'rosenc','c');
 Shared archive loaded.
@@ -90,6 +91,7 @@ l=ilib_for_link('rosenf','rosenf.o',[],'f',TMPDIR+'/Makefile');
    ilib_gen_Make: Copy rosenf.o to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the Makefile
+   Generate a cleaner file   
 // incremental linking
 link(l,'rosenf','f');
 Shared archive loaded.
index 281ee42..c08aad2 100644 (file)
@@ -42,6 +42,7 @@ l=ilib_for_link('rosenc','rosenc.o',[],'c',TMPDIR+'/Makefile');
    Running the Makefile
    Compilation of rosenc
    Building shared library (be patient)
+   Generate a cleaner file   
 // incremental linking
 link(l,'rosenc','c');
 Shared archive loaded.
@@ -88,6 +89,7 @@ l=ilib_for_link('rosenf','rosenf.o',[],'f',TMPDIR+'/Makefile');
    Running the Makefile
    Compilation of rosenf
    Building shared library (be patient)
+   Generate a cleaner file   
 // incremental linking
 link(l,'rosenf','f');
 Shared archive loaded.
index 5b5755c..7422ee7 100644 (file)
@@ -25,6 +25,7 @@ lp=ilib_for_link('mytest','mytest.o',[],'c',TMPDIR+'/Makefile');
    ilib_gen_Make: Copy mytest.o to TMPDIR
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the Makefile
+   Generate a cleaner file   
 link(lp,'mytest','c');
 Shared archive loaded.
 Link done.
index 9b3fdf7..b067979 100644 (file)
@@ -21,6 +21,7 @@ lp=ilib_for_link('mytest','mytest.o',[],'c',TMPDIR+'/Makefile');
    Running the Makefile
    Compilation of mytest
    Building shared library (be patient)
+   Generate a cleaner file   
 link(lp,'mytest','c');
 Shared archive loaded.
 Link done.