macros for dynamic_link
Allan Cornet [Mon, 28 Jan 2008 10:46:30 +0000 (10:46 +0000)]
scilab/modules/dynamic_link/macros/chooselcccompiler.sci
scilab/modules/dynamic_link/macros/configure_lcc.sci
scilab/modules/dynamic_link/macros/findlcccompiler.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_gateway.sci
scilab/modules/dynamic_link/macros/ilib_gen_loader.sci
scilab/modules/dynamic_link/macros/ilib_mex_build.sci
scilab/modules/dynamic_link/macros/with_lcc.sci

index 80415c7..f096ba8 100644 (file)
@@ -1,15 +1,18 @@
-//-----------------------------------------------------------------------------\r
+//==========================================\r
+// INRIA 2008\r
 // Allan CORNET\r
-// INRIA 2007\r
+//==========================================\r
 // force to use LCC-Win32 compiler\r
-//-----------------------------------------------------------------------------\r
-function res=chooselcccompiler()\r
-  res=findlcccompiler();\r
+//==========================================\r
+function res = chooselcccompiler()\r
+\r
+  res = findlcccompiler();\r
   if (res) then\r
     global LCC;\r
     LCC=res;\r
     clear LCC;\r
+    configure_lcc();\r
   end\r
-  configure_lcc();\r
+  \r
 endfunction\r
-//-----------------------------------------------------------------------------
\ No newline at end of file
+//==========================================\r
index 3348463..315683e 100644 (file)
@@ -1,30 +1,43 @@
-//-----------------------------------------------------------------------------\r
+//==========================================\r
 // Allan CORNET\r
-// INRIA 2007\r
-//-----------------------------------------------------------------------------\r
-function bOK=configure_lcc()\r
+// INRIA 2008\r
+//==========================================\r
+function bOK = configure_lcc()\r
+  bOK = %F;\r
+  \r
   if MSDOS then\r
+\r
     try\r
-      lccincludepath=winqueryreg('HKEY_CURRENT_USER','Software\lcc\compiler','includepath');\r
-      lcclibpath=winqueryreg('HKEY_CURRENT_USER','Software\lcc\lcclnk','libpath');\r
-      index=strindex(lccincludepath,filesep());\r
-      szindex=size(index);\r
-      lccbasepath=part(lccincludepath,[1:index(szindex(2))]);\r
-      lccbinpath=lccbasepath+'bin';\r
-      lccexe=lccbinpath+'\lcc.exe';\r
-      if (fileinfo(lccexe)<>[]) then\r
-        PATH=getenv('PATH');\r
-        NEWPATH=lccbinpath+';'+lccincludepath+';'+lcclibpath+';'+PATH;\r
-        setenv('PATH',NEWPATH);\r
-        bOK=%T;\r
-      else\r
-        bOK=%F;\r
-      end\r
+      lccincludepath = winqueryreg('HKEY_CURRENT_USER','Software\lcc\compiler','includepath');\r
     catch\r
+      return;\r
+    end\r
+\r
+    try\r
+      lcclibpath = winqueryreg('HKEY_CURRENT_USER','Software\lcc\lcclnk','libpath');\r
+    catch\r
+      return;\r
+    end\r
+      \r
+    index = strindex(lccincludepath,filesep());\r
+    szindex = size(index);\r
+    lccbasepath = part(lccincludepath,[1:index(szindex(2))]);\r
+    lccbinpath = lccbasepath + 'bin';\r
+    lccexe = lccbinpath + filesep() + 'lcc.exe';\r
+      \r
+    if ( fileinfo(lccexe) <> [] ) then\r
+      PATH = getenv('PATH');\r
+      NEWPATH = lccbinpath + pathsep() + ..\r
+                lccincludepath + pathsep() + ..\r
+                lcclibpath + pathsep() + ..\r
+                PATH;\r
+      err = setenv('PATH',NEWPATH);\r
+      if (err == %F) then bOK = %F,return,end\r
+      bOK=%T;\r
+    else\r
       bOK=%F;\r
     end\r
-  else  \r
-    bOK=%F;\r
   end\r
+  \r
 endfunction\r
-//-----------------------------------------------------------------------------\r
+//==========================================\r
index e9ba600..b31cb4e 100644 (file)
@@ -1,28 +1,28 @@
-//-----------------------------------------------------------------------------\r
+//==========================================\r
 // Allan CORNET\r
-// INRIA 2007\r
+// INRIA 2008\r
 // Detect LCC-Win32 compiler\r
-//-----------------------------------------------------------------------------\r
-function res=findlcccompiler()\r
+//==========================================\r
+function res = findlcccompiler()\r
+  res = %F;\r
   if MSDOS then\r
-    res=%F;\r
     try\r
-      winqueryreg('HKEY_CURRENT_USER','Software\lcc\compiler','includepath')\r
-      res=%T;\r
+      winqueryreg('HKEY_CURRENT_USER', ..\r
+                  'Software\lcc\compiler', ..\r
+                  'includepath');\r
     catch\r
-      res=%F;\r
+      return;\r
     end\r
-    if (res) then\r
-      try\r
-        winqueryreg('HKEY_CURRENT_USER','Software\lcc\lcclnk','libpath')\r
-        res=%T;\r
-      catch\r
-        res=%F;\r
-      end\r
+  \r
+    try\r
+      winqueryreg('HKEY_CURRENT_USER', ..\r
+                  'Software\lcc\lcclnk', ..\r
+                  'libpath');\r
+      res = %T;\r
+    catch\r
+      return; \r
     end\r
-  else\r
-    res=%F\r
   end\r
 endfunction\r
-//-----------------------------------------------------------------------------\r
+//==========================================\r
 \r
index 6287a81..609556a 100644 (file)
@@ -23,24 +23,27 @@ function [make_command,lib_name_make,lib_name,path,makename,files] = ilib_compil
   lib_name_make = lib_name;\r
   \r
   if MSDOS then // WINDOWS\r
-    if ( with_lcc() == %T ) then // LCC-WIN32\r
   \r
-       makename = makename + '.lcc' ; \r
-      make_command = 'make -f ';\r
-      \r
-      if files<>[] then \r
-        files = files + '.obj' ;\r
-      end\r
-      \r
-    else // Visual Studio C++ \r
-    \r
+    // Visual Studio C++ \r
+    if ( findmsvccompiler() <> 'unknown' ) then \r
       makename = makename + '.mak' ; \r
       make_command = 'nmake /Y /nologo /f '\r
       \r
       if files<>[] then \r
              files = files + '.obj' ;\r
       end\r
+    else\r
+      // LCC-WIN32\r
+      if findlcccompiler() then\r
+        makename = makename + '.lcc' ; \r
+        make_command = 'make -f ';\r
       \r
+        if files<>[] then \r
+          files = files + '.obj' ;\r
+        end\r
+      else\r
+      // TO DO : Add another compiler here\r
+      end\r
     end\r
   else // LINUX\r
   \r
@@ -55,9 +58,6 @@ function [make_command,lib_name_make,lib_name,path,makename,files] = ilib_compil
 endfunction \r
 //==========================================\r
 \r
-\r
-\r
-\r
   if ~haveacompiler() then\r
        error(_('A Fortran or C compiler is required.'))  \r
        return;\r
index 79c3d0a..00c19c1 100644 (file)
@@ -1,15 +1,20 @@
-function libn=ilib_for_link(names,files,libs,flag,makename,loadername,libname,ldflags,cflags,fflags,cc)\r
-// Copyright Enpc\r
-// Copyright INRIA\r
-// Generate a shared library which can be used by link \r
-// command. \r
-// names = names of entry points or the name of the library to \r
-// be built (when flag == 'g') \r
-// files = object files to be built \r
-// flag = 'c' or 'f' or '\r
-// \r
-  [lhs,rhs]=argn(0);\r
-  info=1\r
+//==========================================\r
+// Generate a shared library which can be used by link command. \r
+//==========================================\r
+function libn = ilib_for_link(names, ..\r
+                              files, ..\r
+                              libs, ..\r
+                              flag, ..\r
+                              makename, ..\r
+                              loadername, ..\r
+                              libname, ..\r
+                              ldflags, ..\r
+                              cflags, ..\r
+                              fflags, ..\r
+                              cc)\r
+                            \r
+  [lhs,rhs] = argn(0);\r
+  \r
   if rhs <= 4 then makename = 'Makelib';end\r
   if rhs <= 5 then loadername = 'loader.sce';end\r
   if rhs <= 6 then libname = ""; end\r
@@ -17,61 +22,133 @@ function libn=ilib_for_link(names,files,libs,flag,makename,loadername,libname,ld
   if rhs <= 8 then cflags  = ""; end \r
   if rhs <= 9 then fflags  = ""; end \r
   if rhs <= 10 then cc  = ""; end \r
+  \r
+  warningmode = warning('query');\r
+  \r
   // generate a loader file\r
-  if info==1 then write(%io(2),'   Generate a loader file');end\r
+  if ( warningmode == 'on' ) then\r
+    write(%io(2),'   Generate a loader file');\r
+  end\r
   ilib_link_gen_loader(names,flag,loadername,libs,libname);\r
+  \r
   // generate a Makefile\r
-  if info==1 then write(%io(2),'   Generate a Makefile');end\r
-  ilib_link_gen_Make(names,files,libs,makename,libname,...\r
-                    ldflags,cflags,fflags,cc,flag);\r
+  if ( warningmode == 'on' ) then\r
+    write(%io(2),'   Generate a Makefile');\r
+  end\r
+  ilib_link_gen_Make(names, ..\r
+                     files, ..\r
+                     libs, ..\r
+                     makename, ..\r
+                     libname, ..\r
+                                ldflags, ..\r
+                                cflags, ..\r
+                                fflags, ..\r
+                                cc, ..\r
+                                flag);\r
+                                \r
   // we call make\r
-  if info==1 then write(%io(2),'   Running the Makefile');end\r
-  if libname=="" then libname = names(1);end\r
-  libn=ilib_compile('lib'+libname,makename,files);\r
+  if ( warningmode == 'on' ) then\r
+    write(%io(2),'   Running the Makefile');\r
+  end\r
+  if (libname == "") then libname = names(1);end\r
+  libn = ilib_compile('lib' + libname, makename, files);\r
+  \r
 endfunction\r
-\r
+//==========================================\r
+function ilib_link_gen_Make(names, ..\r
+                            files, ..\r
+                            libs, ..\r
+                            makename, ..\r
+                            libname, ..\r
+                            ldflags, ..\r
+                            cflags, ..\r
+                            fflags, ..\r
+                            cc, ..\r
+                            flag)\r
+  // generate a Makefile for gateway\r
+  [lhs,rhs] = argn(0);\r
+  if rhs <= 2 then libs = [];end\r
+  if rhs <= 3 then makename = 'Makelib';end\r
+  if rhs <= 4 then libname = "";end\r
+  if rhs <= 5 then ldflags = ""; end \r
+  if rhs <= 6 then cflags  = ""; end \r
+  if rhs <= 7 then fflags  = ""; end \r
+  if rhs <= 8 then cc  = ""; end \r
+  if rhs <= 9 then flag  = "c"; end \r
+  \r
+  if MSDOS then // Windows\r
+    // Visual Studio C++ \r
+    if ( findmsvccompiler() <> 'unknown' ) then \r
+      Makename = makename+'.mak';\r
+      ilib_link_gen_Make_msvc(names, ..\r
+                              files, ..\r
+                              libs, ..\r
+                              Makename, ..\r
+                              libname, ..\r
+                                               ldflags, ..\r
+                                               cflags, ..\r
+                                               fflags, ..\r
+                                               cc);\r
+    else\r
+      // LCC-WIN32\r
+      if findlcccompiler() then\r
+        Makename = makename+'.lcc';\r
+           ilib_link_gen_Make_lcc(names, ..\r
+                                  files, ..\r
+                                  libs, ..\r
+                                  Makename, ..\r
+                                  libname, ..\r
+                                  ldflags, ..\r
+                                  cflags, ..\r
+                                  fflags, ..\r
+                                  cc, ..\r
+                                  flag);\r
+      else\r
+      // TO DO : Add another compiler here\r
+      end\r
+    end\r
+  \r
+  else // LINUX\r
+   Makename = makename;\r
+   ilib_link_gen_Make_unix(names, ..\r
+                           files, ..\r
+                           libs, ..\r
+                           Makename, ..\r
+                           libname, ..\r
+                           ldflags, ..\r
+                           cflags, ..\r
+                           fflags, ..\r
+                           cc);\r
+  end\r
+  \r
+endfunction\r
+//==========================================\r
 function ilib_link_gen_loader(names,flag,loadername,libs,libname)\r
-//------------------------------------\r
-  rhs=argn(2)\r
+\r
+  rhs = argn(2);\r
   if rhs <= 4 then libname = ""; end \r
   if rhs <= 3 then libs=[]; end \r
   if rhs <= 2 then loadername = 'loader.sce' ; end \r
-  comp_target = COMPILER;\r
-  // suffix to be used for dll\r
-  if with_lcc()==%T then\r
-       if getenv('WIN32','NO')=='OK' then\r
-               lib_suf='dll';\r
-       end\r
   \r
-  else if getenv('WIN32','NO')=='OK' then\r
-       select comp_target\r
-               case 'VC++'   then lib_suf='dll';\r
-               else lib_suf='dll';\r
-       end\r
-       else\r
-               lib_suf=ilib_unix_soname();\r
-       end\r
-  end\r
+  lib_suf = getdynlibext();\r
   if libname=="" then libname = names(1);end \r
     \r
   fd=mopen(loadername,"w");\r
+  mfprintf(fd,"// ------------------------------------------------------\n");\r
   mfprintf(fd,"// generated by builder.sce: Please do not edit this file\n");\r
   mfprintf(fd,"// ------------------------------------------------------\n");\r
-  if MSDOS then\r
-  mfprintf(fd,"%s_path=get_absolute_file_path(''%s'');\n",libname,basename(loadername+'.x'));\r
-  else\r
-  mfprintf(fd,"%s_path=get_absolute_file_path(''%s'')+%s;\n",libname,basename(loadername+'.x'),"''.libs/''");\r
-//  mfprintf(fd,"%s_path='.libs/';\n",libname);\r
-  end\r
+  mfprintf(fd,"\n");\r
+  mfprintf(fd,"%s_path = get_absolute_file_path(''%s'');\n",libname,basename(loadername+'.x'));\r
+  mfprintf(fd,"\n");\r
   \r
-  nl=size(libs,'*') \r
+  nl=size(libs,'*') ;\r
   for i=1:nl \r
-    if part(libs(i),1)=='/' then\r
+    if ( part(libs(i),1) == '/') then\r
       mfprintf(fd,"link(''%s.%s'');\n",libs(i),lib_suf);\r
     else\r
-      [diri,basenamei,exti]=fileparts(libs(i));\r
+      [diri, basenamei, exti] = fileparts(libs(i));\r
       if (diri == '') then\r
-        mfprintf(fd,"link(%s_path+''%s.%s'');\n",libname,libs(i),lib_suf);\r
+         mfprintf(fd,"link(%s_path+''%s.%s'');\n",libname,libs(i),lib_suf);\r
       else\r
         mfprintf(fd,"link(''%s.%s'');\n",libs(i),lib_suf);\r
       end\r
@@ -81,170 +158,216 @@ function ilib_link_gen_loader(names,flag,loadername,libs,libname)
   names=names(:)';\r
   n = size(names,'*');\r
   for i=1:n\r
-       mfprintf(fd,"''%s''",names(i))\r
+    mfprintf(fd,"''%s''",names(i))\r
     if i <>n ; mfprintf(fd,","); else mfprintf(fd,"],");end\r
   end\r
+  \r
   mfprintf(fd,"''%s'');\n",flag);\r
   mfprintf(fd,"// remove temp. variables on stack\n");\r
   mfprintf(fd,"clear %s_path;\n",libname);\r
-  mfprintf(fd,"clear functions;\n");\r
   mfprintf(fd,"clear get_file_path;\n");\r
+  mfprintf(fd,"// ------------------------------------------------------\n");\r
   mclose(fd);\r
 endfunction\r
-\r
-function ilib_link_gen_Make(names,files,libs,makename,libname,ldflags,cflags,fflags,cc,flag)\r
-//------------------------------------\r
-// generate a Makefile for gateway\r
-  [lhs,rhs]=argn(0);\r
-  if rhs <= 2 then libs = [];end\r
-  if rhs <= 3 then makename = 'Makelib';end\r
-  if rhs <= 4 then libname = "";end\r
-  if rhs <= 5 then ldflags = ""; end \r
-  if rhs <= 6 then cflags  = ""; end \r
-  if rhs <= 7 then fflags  = ""; end \r
-  if rhs <= 8 then cc  = ""; end \r
-  if rhs <= 9 then flag  = "c"; end \r
-  comp_target = COMPILER;\r
-  if with_lcc()==%T then\r
-       Makename = makename+'.lcc';\r
-       ilib_link_gen_Make_lcc(names,files,libs,Makename,libname,...\r
-                              ldflags,cflags,fflags,cc,flag)\r
-  else if getenv('WIN32','NO')=='OK' then\r
-     Makename = makename+'.mak'\r
-      ilib_link_gen_Make_win32(names,files,libs,Makename,libname,...\r
-                              ldflags,cflags,fflags,cc)\r
-  else\r
-     Makename = makename;\r
-     ilib_link_gen_Make_unix(names,files,libs,Makename,libname,...\r
-                            ldflags,cflags,fflags,cc)\r
-  end\r
-  end\r
-endfunction\r
-\r
-function ilib_link_gen_Make_unix(names,files,libs,Makename,libname, ...\r
-                                ldflags,cflags,fflags,cc)\r
+//==========================================\r
+function ilib_link_gen_Make_unix(names, ..\r
+                                 files, ..\r
+                                 libs, ..\r
+                                 Makename, ..\r
+                                 libname, ..\r
+                                                        ldflags, ..\r
+                                                        cflags, ..\r
+                                                        fflags, ..\r
+                                                        cc)\r
+  \r
+  if libname == "" then libname = names(1);end \r
+  oldPath = pwd();\r
+  linkpath = TMPDIR();\r
+  commandpath = SCI+"/modules/incremental_link/src/scripts/";\r
   \r
-  if libname=="" then libname = names(1);end \r
-  linkpath=TMPDIR;\r
-  commandpath=SCI+"/modules/incremental_link/src/scripts/";\r
-//  chdir(commandpath);\r
        // We launch ./configure in order to produce a "generic" Makefile \r
        // for this computer\r
        printf(gettext("configure : Generate Makefile in %s\n"),commandpath );\r
-       unix_w(commandpath+"/compilerDetection.sh");\r
+       [msg,ierr] = unix_g(commandpath+"/compilerDetection.sh");\r
+       if ierr <> 0 then\r
+         disp(msg);\r
+         return;\r
+       end\r
 \r
        // Copy files => linkpath\r
-       chdir(linkpath)\r
+       chdir(linkpath);\r
        printf(gettext("Copy compilation files (Makefile*, libtool...) to %s\n"),linkpath);\r
-       mandatoryFiles=["Makefile.orig", "configure.ac", "configure", "Makefile.am","Makefile.in","config.sub","config.guess","config.status","depcomp","install-sh","ltmain.sh","libtool","missing","aclocal.m4"]\r
-       for x=mandatoryFiles(:)' ;\r
+\r
+       // List of the files mandatory to generate a lib with the detection of the env\r
+       mandatoryFiles = ["Makefile.orig", ..\r
+                         "configure.ac", ..\r
+                         "configure", ..\r
+                         "Makefile.am", ..\r
+                         "Makefile.in", ..\r
+                         "config.sub", ..\r
+                         "config.guess", ..\r
+                         "config.status", ..\r
+                         "depcomp", ..\r
+                         "install-sh", ..\r
+                         "ltmain.sh", ..\r
+                         "libtool", ..\r
+                         "missing", ..\r
+                         "aclocal.m4"];\r
+\r
+       // Copy files to the working tmpdir\r
+       for x = mandatoryFiles(:)' ;\r
                copyfile(commandpath+"/"+x,linkpath);\r
        end\r
-       filelist=""\r
-       for x=files(:)' ; filelist = filelist +" " +x;end\r
 \r
-//    printf(""+commandpath+"/scicompile.sh "+libname+ " " +filelist);\r
+       filelist = "";  \r
+       for x = files(:)' ;  \r
+               // Old way: to compile a fun.c file, the user had to provide fun.o\r
+               filename = strsubst(x,'.o','');\r
+               filesMatching = ls(oldPath+"/"+filename+".*");\r
+\r
+               // The user provided the real filename\r
+               if filesMatching == [] then\r
+                       copyfile(x, linkpath);\r
+               else\r
+               // Or copy the file matching to what we were looking for (this stuff\r
+               // could lead to bug if you have fun.c fun.f or fun.cxx but it was \r
+               // already the case before ...\r
+                       for f=filesMatching(:)' ;\r
+                               printf("Copy %s to %s\n",f, linkpath);\r
+                               copyfile(f, linkpath)\r
+                       end\r
+               end\r
+\r
+               filelist = filelist + " " + x ;\r
+       end\r
+\r
+       // Alter the Makefile in order to compile the right files\r
        printf("Modification of the Makefile in " + linkpath+"\n");\r
-       unix_w(""+commandpath+"/scicompile.sh "+libname+ " " +filelist);\r
-// on devrait catcher le code de retour du script et gere/afficher l'erreur\r
-// TODO : voir quoi faire du CFLAGS\r
-       unix_w("make CFLAGS=-I"+SCI+"/modules/core/includes/");\r
+       [msg,ierr] = unix_g("" + commandpath + "/scicompile.sh " + libname + " " + filelist);\r
+       if ierr <> 0 then\r
+         disp(msg);\r
+         return;\r
+       end\r
 \r
-//  chdir(oldpath)\r
+       // on devrait catcher le code de retour du script et gere/afficher l'erreur\r
+       // TODO : voir quoi faire du CFLAGS\r
 \r
-       return;\r
-    \r
-  fd=mopen(Makename,"w");\r
-  mfprintf(fd,"# generated by builder.sce: Please do not edit this file\n");\r
-  mfprintf(fd,"# ------------------------------------------------------\n");\r
-  mfprintf(fd,"SCIDIR = %s\n",SCI);\r
-  mfprintf(fd,"OBJS = ")\r
-  \r
-  // add .a \r
-  // for compatibility test if we have already a .a\r
-  for x=libs(:)' ;\r
-   [path,fname,extension]=fileparts(x);\r
-   if (extension == '') then\r
-     mfprintf(fd," %s.a",x);\r
-   else\r
-     mfprintf(fd," %s",x);\r
-   end\r
-  end\r
-  \r
-  mfprintf(fd,"\n") ;\r
-  mfprintf(fd,"OTHERLIBS = ")\r
-  for x=libs(:)' ; mfprintf(fd," %s",x);end\r
-  mfprintf(fd,"\n") ;\r
-  mfprintf(fd,"LIBRARY = lib%s\n",libname);\r
-  mfprintf(fd,"include $(SCIDIR)/Makefile.incl\n");\r
-  if cc<>"" then \r
-    mfprintf(fd,"CC="+cc+ "\n");\r
-  end\r
-  mfprintf(fd,"CFLAGS = $(CC_OPTIONS) "+cflags+ "\n");\r
-  mfprintf(fd,"FFLAGS = $(FC_OPTIONS) "+fflags+ "\n");\r
-  \r
-  mfprintf(fd,"EXTRA_LDFLAGS = "+ ldflags+ "\n");\r
-  mfprintf(fd,"include $(SCIDIR)/config/Makeso.incl\n");\r
-  mclose(fd);\r
-endfunction\r
+       [msg,ierr] = unix_g("make CFLAGS=-I"+SCI+"/modules/core/includes/");\r
+               if ierr <> 0 then\r
+         disp(msg);\r
+         return;\r
+       end\r
 \r
-function ilib_link_gen_Make_win32(names,files,libs,Makename,libname,ldflags, ...\r
-                                 cflags,fflags,cc)\r
-                                 \r
-  if libname=="" then libname = names(1);end \r
-  fd=mopen(Makename,"w");\r
-  mfprintf(fd,"# generated by builder.sce : Please do not edit this file\n");\r
-  mfprintf(fd,"# ------------------------------------------------------\n");\r
-  mfprintf(fd,"SCIDIR =%s\n",SCI);\r
-  mfprintf(fd,"SCIDIR1 =%s\n",pathconvert(SCI,%f,%f,'w'));\r
-  mfprintf(fd,"# name of the dll to be built\n"); \r
-  mfprintf(fd,"LIBRARY = lib%s\n",libname);\r
-  mfprintf(fd,"# list of objects file\n");\r
-  mfprintf(fd,"OBJS =");\r
-  for x=files(:)' ; mfprintf(fd," %s",strsubst(x,".o",".obj"));end\r
-  mfprintf(fd,"\n# added libraries \n");\r
-  mfprintf(fd,"OTHERLIBS = ");\r
-  for x=libs(:)' ; mfprintf(fd," %s.lib",x);end\r
-  mfprintf(fd,"\n");\r
-  mfprintf(fd,"!include $(SCIDIR1)\\Makefile.incl.mak\n");\r
-  if cc<>"" then \r
-    mfprintf(fd,"CC="+cc+ "\n");\r
+       lib_name = "lib" + libname + '.' + ilib_unix_soname();\r
+       copyfile(".libs/" + lib_name, oldPath);\r
+       chdir(oldPath);\r
+\r
+endfunction\r
+//==========================================    \r
+function ilib_link_gen_Make_msvc(names, ..\r
+                                  files, ..\r
+                                  libs, ..\r
+                                  Makename, ..\r
+                                  libname, ..\r
+                                  ldflags, ..\r
+                                  cflags, ..\r
+                                  fflags, ..\r
+                                  cc)\r
+  try\r
+    MAKEFILE_VC = mgetl(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC');\r
+  catch\r
+    MAKEFILE_VC = '';\r
   end\r
-  \r
-  if findmsvccompiler() <>'msvc90express' then\r
-    mfprintf(fd,"CFLAGS = $(CC_OPTIONS) -DFORDLL -I\""$(SCIDIR)/modules\"" -I\""$(SCIDIR)/modules/core/includes\"""+...\r
-          " -Dmexfunction_=mex$*_  -DmexFunction=mex_$* "+ cflags +" \n"); \r
-    mfprintf(fd,"FFLAGS = $(FC_OPTIONS) -DFORDLL -I\""$(SCIDIR)/modules\"" -I\""$(SCIDIR)/modules/core/includes\"""+...\r
-          " -Dmexfunction=mex$* "+ fflags +"\n"); \r
+\r
+       if ( MAKEFILE_VC <> '') then\r
+         MAKEFILE_VC = strsubst(MAKEFILE_VC,"__SCI__",SCI);\r
+         MAKEFILE_VC = strsubst(MAKEFILE_VC,"__SCIDIR1__",pathconvert(SCI,%f,%f,'w'));\r
+         \r
+         if (libname == '') then libname = names(1);end \r
+    MAKEFILE_VC = strsubst(MAKEFILE_VC,"__LIBNAME__",sprintf("lib%s",libname));\r
+    \r
+    if (files <> []) then\r
+      OBJS = '';\r
+      for x = files(:)'\r
+        OBJS = OBJS + ' ' + strsubst(x,'.o','.obj');\r
+      end\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__OBJS__",OBJS);\r
+    else\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__OBJS__","");\r
+    end\r
+    \r
+    if (libs <> []) then\r
+      LIBS = '';\r
+      for x = libs(:)'\r
+        LIBS = LIBS + ' ' + sprintf("%s.lib",x);\r
+      end\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__OTHERSLIBS__",LIBS);\r
+    else\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__OTHERSLIBS__","");\r
+    end\r
+    \r
+    if cc <> "" then\r
+    \r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__CC__",cc);\r
+    else\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"CC = __CC__","#CC = ");\r
+    end\r
+    \r
+    if cflags <> "" then\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__CFLAGS__",cflags);\r
+    else\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__CFLAGS__","");    \r
+    end\r
+    \r
+    if fflags <> "" then\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__FFLAGS__",fflags);\r
+    else\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__FFLAGS__","");    \r
+    end\r
+    \r
+    if ldflags <> "" then\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__LDFLAGS__",ldflags);\r
+    else\r
+      MAKEFILE_VC = strsubst(MAKEFILE_VC,"__LDFLAGS__","");\r
+    end\r
+    \r
+    fd = mopen(Makename,"w");\r
+    mputl(MAKEFILE_VC,fd);\r
+    mclose(fd);\r
+    \r
        else\r
-    mfprintf(fd,"CFLAGS = $(CC_OPTIONS) -DFORDLL -I\""$(SCIDIR)/modules\"" -I\""$(SCIDIR)/modules/core/includes\"""+...\r
-          " "+ cflags +" \n"); \r
-    mfprintf(fd,"FFLAGS = $(FC_OPTIONS) -DFORDLL -I\""$(SCIDIR)/modules\"" -I\""$(SCIDIR)/modules/core/includes\"""+...\r
-          " "+ fflags +"\n");  \r
+        // TEMPLATE_MAKEFILE.VC not found\r
+        warning(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC'+ 'not found.');\r
        end\r
-  mfprintf(fd,"EXTRA_LDFLAGS = "+ ldflags+"\n");\r
-  mfprintf(fd,"!include $(SCIDIR1)\\modules\\incremental_link\\src\\scripts\\Makedll.incl \n");\r
-  mclose(fd);\r
+                                  \r
 endfunction\r
-\r
-//-------------------------------------------------------------------------------------\r
-function ilib_link_gen_Make_lcc(names,files,libs,Makename,libname,ldflags,cflags,fflags,cc,flag)\r
-// Allan CORNET\r
-// INRIA 2004\r
+//==========================================    \r
+function ilib_link_gen_Make_lcc(names, ..\r
+                                files, ..\r
+                                libs, ..\r
+                                Makename, ..\r
+                                libname, ..\r
+                                ldflags, ..\r
+                                cflags, ..\r
+                                fflags, ..\r
+                                cc, ..\r
+                                flag)\r
+                                \r
+  // TO DO rewrite with a template \r
   \r
   if libname == "" then libname = names(1);end \r
-  fd=mopen(Makename,"w");\r
+  fd = mopen(Makename,"w");\r
   mfprintf(fd,"# ------------------------------------------------------------\n");\r
   mfprintf(fd,"# generated by builder.sce (lcc): Please do not edit this file\n");\r
   mfprintf(fd,"# ------------------------------------------------------------\n\n");\r
-  mfprintf(fd,"SCIDIR =%s\n",SCI);\r
-  mfprintf(fd,"SCIDIR1 =%s\n",pathconvert(SCI,%f,%f,'w'));\r
-  mfprintf(fd,"DUMPEXTS=""$(SCIDIR1)\\bin\\dumpexts""\n");\r
-  mfprintf(fd,"SCIIMPLIB=$(SCIDIR1)\\bin\\lcclib\\LibScilab.lib $(SCIDIR1)\\bin\\lcclib\\blasplus.lib $(SCIDIR1)\\bin\\lcclib\\libf2c.lib $(SCIDIR1)\\bin\\lcclib\\intersci.lib $(SCIDIR1)\\bin\\lapack.lib $(SCIDIR1)\\bin\\scicos.lib\n\n");\r
-  mfprintf(fd,"CC=lcc\n");\r
-  mfprintf(fd,"LINKER=lcclnk\n");\r
-  mfprintf(fd,"CFLAGS=-I""$(SCIDIR)/modules/core/includes"" -I""$(SCIDIR)/libs/f2c"" -I""$(SCIDIR)/modules/mexlib/includes"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__ -DHAVE_EXP10 "+ cflags +" \n"); \r
-  mfprintf(fd,"LINKER_FLAGS=-dll -nounderscores\n");\r
+  mfprintf(fd,"SCIDIR = %s\n",SCI);\r
+  mfprintf(fd,"SCIDIR1 = %s\n",pathconvert(SCI,%f,%f,'w'));\r
+  mfprintf(fd,"DUMPEXTS = ""$(SCIDIR1)\\bin\\dumpexts""\n");\r
+  mfprintf(fd,"SCIIMPLIB = $(SCIDIR1)\\bin\\lcclib\\LibScilab.lib $(SCIDIR1)\\bin\\lcclib\\blasplus.lib $(SCIDIR1)\\bin\\lcclib\\libf2c.lib $(SCIDIR1)\\bin\\lcclib\\intersci.lib $(SCIDIR1)\\bin\\lapack.lib $(SCIDIR1)\\bin\\scicos.lib\n\n");\r
+  mfprintf(fd,"CC = lcc\n");\r
+  mfprintf(fd,"LINKER = lcclnk\n");\r
+  mfprintf(fd,"CFLAGS = -I""$(SCIDIR)/modules/core/includes"" -I""$(SCIDIR)/libs/f2c"" -I""$(SCIDIR)/modules/mexlib/includes"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__ -DHAVE_EXP10 "+ cflags +" \n"); \r
+  mfprintf(fd,"LINKER_FLAGS = -dll -nounderscores\n");\r
   mfprintf(fd,"EXTRA_LDFLAGS = "+ ldflags+"\n");\r
   mfprintf(fd,"O=.obj\n");\r
  \r
@@ -254,9 +377,9 @@ function ilib_link_gen_Make_lcc(names,files,libs,Makename,libname,ldflags,cflags
   \r
   if (flag =='c') then\r
        mfprintf(fd,"OBJSC =");\r
-       for x=files(:)' ;\r
-               x=strsubst(x,".obj","");\r
-               x=strsubst(x,".o","");\r
+       for x = files(:)' ;\r
+               x = strsubst(x,".obj","");\r
+               x = strsubst(x,".o","");\r
                mfprintf(fd," %s$(O)",x);\r
        end\r
   \r
@@ -264,9 +387,9 @@ function ilib_link_gen_Make_lcc(names,files,libs,Makename,libname,ldflags,cflags
   else\r
        mfprintf(fd,"OBJSC =\n");\r
        mfprintf(fd,"\nOBJSF=");\r
-       for x=files(:)' ;\r
-               x=strsubst(x,".obj","");\r
-               x=strsubst(x,".o","");\r
+       for x = files(:)' ;\r
+               x = strsubst(x,".obj","");\r
+               x = strsubst(x,".o","");\r
                mfprintf(fd," %s$(O)",x);\r
        end\r
   end\r
@@ -275,7 +398,7 @@ function ilib_link_gen_Make_lcc(names,files,libs,Makename,libname,ldflags,cflags
   \r
   mfprintf(fd,"\n# added libraries \n");\r
   mfprintf(fd,"OTHERLIBS =");\r
-  for x=libs(:)' ;\r
+  for x = libs(:)' ;\r
        mfprintf(fd," ""%s.lib""",x);\r
   end\r
   mfprintf(fd,"\n");\r
@@ -283,20 +406,19 @@ function ilib_link_gen_Make_lcc(names,files,libs,Makename,libname,ldflags,cflags
   mfprintf(fd,"\nall :: $(LIBRARY).dll\n");\r
   mfprintf(fd,"\n$(LIBRARY).dll: $(OBJS)\n");\r
   mfprintf(fd,"        $(DUMPEXTS) -o ""$(LIBRARY).def"" ""$*"" $(OBJS)\n");\r
-  mfprintf(fd,"        $(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCIIMPLIB) $(XLIBSBIN) $(TERMCAPLIB) $(EXTRA_LDFLAGS) $*.def -o $(LIBRARY).dll\n\n");\r
+  mfprintf(fd,"        $(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCIIMPLIB) $(EXTRA_LDFLAGS) $*.def -o $(LIBRARY).dll\n\n");\r
  \r
-\r
-  for x=files(:)' ;\r
-       x=strsubst(x,".obj","");\r
-       x=strsubst(x,".o","");\r
+  for x = files(:)' ;\r
+       x = strsubst(x,".obj","");\r
+       x = strsubst(x,".o","");\r
        mfprintf(fd,"%s$(O):\n",x);\r
        if (flag =='c') then\r
                mfprintf(fd,"   $(CC) $(CFLAGS) $*.c\n\n");\r
        else\r
                mfprintf(fd,"   @$(SCIDIR1)\\bin\\f2c.exe $*.f \n");\r
-               mfprintf(fd,"   @$(CC) $(CFLAGS) $*.c \n");\r
-               mfprintf(fd,"   del $*.c \n");\r
-       end\r
+                 mfprintf(fd," @$(CC) $(CFLAGS) $*.c \n");\r
+                 mfprintf(fd," del $*.c \n");\r
+         end\r
   end\r
        \r
   mfprintf(fd,"clean:\n");\r
@@ -305,6 +427,6 @@ function ilib_link_gen_Make_lcc(names,files,libs,Makename,libname,ldflags,cflags
   mfprintf(fd,"        del *.lib\n");\r
   mfprintf(fd,"        del *.def\n");\r
  \r
- mclose(fd);\r
+  mclose(fd);\r
 endfunction\r
-//-------------------------------------------------------------------------------------\r
+//==========================================    \r
index da7d641..66cfcfd 100644 (file)
-function ilib_gen_gateway(name,tables)\r
-// Copyright Enpc \r
-//------------------------------------\r
+//==========================================\r
 // generate an interface gateway named name\r
 // from table table taking into account \r
 // attributes of function i.e mex fmex or scilab interface \r
 // if name is a full path just extract the filename \r
-  k=strindex(name,['/','\'])\r
+//==========================================\r
+// ilib_gen_gateway used by ilib_build\r
+//==========================================\r
+function ilib_gen_gateway(name,tables)\r
+\r
+//==========================================\r
+// new_names only used by ilib_gen_gateway\r
+//==========================================\r
+function [gate,names] = new_names(table) \r
+  // change names according to types \r
+  [mt,nt] = size(table);\r
+  gate = "mex_gateway"; \r
+  gate = gate(ones(mt,1)); \r
+  names = " "; \r
+  names = names(ones(mt,1)); \r
+  for i = 1:mt \r
+    select table(i,3) \r
+     case 'cmex' then \r
+       names(i) = "mex_" + table(i,2) ;\r
+     case 'fmex' then \r
+       gate(i) = "(Myinterfun)fortran_mex_gateway" ;\r
+       names(i) = "C2F(mex" + table(i,2) + ")" ;\r
+     case 'Fmex' then \r
+       gate(i) = "(Myinterfun)fortran_mex_gateway" ;\r
+       names(i) = "C2F(mex" + table(i,2) + ")" ;\r
+     case 'csci'  then \r
+       gate(i) = "(Myinterfun)sci_gateway" ;\r
+       names(i) = table(i,2) ;\r
+     case 'fsci'  then \r
+       gate(i) = "(Myinterfun)sci_gateway" ;\r
+       names(i) = "C2F(" + table(i,2) + ")" ;\r
+     case 'direct'  then \r
+       gate(i) = "(Myinterfun)direct_gateway" ;\r
+       names(i) = "C2F(" + table(i,2) + ")" ;\r
+    else \r
+      error(999,"wrong interface type " + table(i,3)); \r
+    end \r
+  end \r
+endfunction\r
+//==========================================\r
+\r
+  k = strindex(name,['/','\']);\r
   if k~=[] then\r
-    path=part(name,1:k($))\r
-    name=part(name,k($)+1:length(name))\r
+    path = part(name,1:k($));\r
+    name = part(name,k($)+1:length(name));\r
   else\r
-     path=''\r
+     path='';\r
   end\r
-  name=strsubst(name,'.c','')\r
+  \r
+  name = strsubst(name,'.c','');\r
   \r
   if typeof(tables)<>'list' then \r
-    tables= list(tables)\r
+    tables = list(tables);\r
   end\r
   \r
-  L=length(tables); \r
+  L = length(tables); \r
 \r
-  for itable=1:L \r
+  for itable = 1:L \r
     // loop on a list of tables \r
-    if L<> 1 then \r
+    if L <> 1 then \r
       tname = name +string(itable);\r
     else \r
-       tname = name ;\r
+      tname = name ;\r
     end\r
+    \r
     table = tables(itable);\r
-    [mt,nt]=size(table);\r
-    if nt==2 then col= "csci"; table = [table, col(ones(mt,1))];nt = 3 ; end \r
-    if nt<>3 then error('second argument has wrong size ');end \r
-    [gate,names]=new_names(table); \r
-    t=[ '#include <mex.h> ';\r
-       'static int direct_gateway(char *fname,void F(void)) { F();return 0;};'\r
-       'extern Gatefunc ' + names(:) + ';';\r
-       'static GenericTable Tab[]={';\r
-       '  {'+ gate(:)+','+ names(:)+',""'+table(:,1)+'""},';\r
-       '};'\r
-       ' '\r
-       'int C2F('+tname+')()'\r
-       '{'\r
-       '  Rhs = Max(0, Rhs);'\r
-       '  (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);'\r
-       '  return 0;'\r
-       '}'];\r
+    [mt,nt] = size(table);\r
+    \r
+    if (nt == 2) then \r
+      col = "csci";\r
+      table = [table, col(ones(mt,1))];\r
+      nt = 3;\r
+    end \r
+    \r
+    if ( nt <> 3 ) then \r
+      error('second argument has wrong size ');\r
+    end \r
+    [gate,names] = new_names(table); \r
+    \r
+    t = [ '#include <mex.h> ';\r
+               'static int direct_gateway(char *fname,void F(void)) { F();return 0;};'\r
+               'extern Gatefunc ' + names(:) + ';';\r
+               'static GenericTable Tab[]={';\r
+               '  {'+ gate(:)+','+ names(:)+',""'+table(:,1)+'""},';\r
+               '};'\r
+               ' '\r
+               'int C2F('+tname+')()'\r
+               '{'\r
+               '  Rhs = Max(0, Rhs);'\r
+               '  (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);'\r
+               '  return 0;'\r
+               '}'];\r
+\r
+               \r
     // first chek if we already have a gateway \r
-    [fd,ierr]=mopen(path+tname+'.c')\r
-    if ierr== 0 then;\r
+    [fd,ierr] = mopen(path+tname+'.c');\r
+    if ierr== 0 then\r
       mclose(fd);\r
-      t1=mgetl(path+tname+'.c') \r
-      if t1==t then \r
-       //      write(%io(2),'   gateway '+path+tname+'.c'+' unchanged ');\r
-      else\r
-        mputl(t,path+tname+'.c')    \r
+      t1 = mgetl(path+tname+'.c') \r
+      if t1 <> t then \r
+             mputl(t,path+tname+'.c')    \r
       end\r
     else\r
        // file does not exists we create it \r
@@ -61,34 +111,4 @@ function ilib_gen_gateway(name,tables)
     end\r
   end\r
 endfunction\r
-\r
-function [gate,names]=new_names(table) \r
-// change names according to types \r
-  [mt,nt]=size(table);\r
-  gate= "mex_gateway"; \r
-  gate = gate(ones(mt,1)); \r
-  names= " "; \r
-  names= names(ones(mt,1)); \r
-  for i=1:mt \r
-    select table(i,3) \r
-     case 'cmex' then \r
-      names(i) = "mex_" + table(i,2)\r
-     case 'fmex' then \r
-      gate(i)="(Myinterfun)fortran_mex_gateway" \r
-      names(i) = "C2F(mex" + table(i,2) + ")"\r
-     case 'Fmex' then \r
-      gate(i)="(Myinterfun)fortran_mex_gateway" \r
-      names(i) = "C2F(mex" + table(i,2) + ")"\r
-     case 'csci'  then \r
-      gate(i)="(Myinterfun)sci_gateway" \r
-      names(i) = table(i,2)\r
-     case 'fsci'  then \r
-      gate(i)="(Myinterfun)sci_gateway" \r
-      names(i) = "C2F(" + table(i,2) + ")"\r
-     case 'direct'  then \r
-      gate(i)="(Myinterfun)direct_gateway" \r
-      names(i) = "C2F(" + table(i,2) + ")"\r
-    else error(999,"wrong interface type "+table(i,3)); \r
-    end \r
-  end \r
-endfunction\r
+//==========================================\r
index ba1d1d9..a509eac 100644 (file)
@@ -1,66 +1,71 @@
 function ilib_gen_loader(name,tables,libs)\r
-// Copyright Enpc \r
-//------------------------------------\r
-// generate a loader file for gateway\r
-  if rhs < 3 then libs=[];end \r
 \r
-  if typeof(tables)<>'list' then \r
-    tables= list(tables)\r
-  end\r
-  L=length(tables); \r
+  if rhs < 3 then \r
+    libs = [];\r
+  end \r
 \r
-  for it=1:L \r
-    [mt,nt]=size(tables(it));\r
-    if nt<>3 & nt<>2 then error('second argument has wrong size ');end \r
+  if ( typeof(tables) <> 'list') then \r
+    tables = list(tables);\r
   end\r
   \r
-  comp_target = COMPILER;\r
-  if getenv('WIN32','NO')=='OK' then\r
-    select comp_target\r
-     case 'VC++'   then lib_suf='dll';\r
-     case 'gcc' then lib_suf='dll';\r
-    else lib_suf='dll';\r
-    end\r
-  else\r
-     lib_suf=ilib_unix_soname();\r
-  end\r
+  L = length(tables); \r
 \r
-  fd=mopen('loader.sce',"w");\r
+  for it = 1:L \r
+    [mt,nt] = size(tables(it));\r
+    if ( (nt <> 3) & ( nt <> 2) ) then \r
+      error('second argument has wrong size ');\r
+    end \r
+  end\r
+  \r
+  fd=mopen('loader.sce',"wt");\r
+  mfprintf(fd,"// ------------------------------------------------------\n");\r
   mfprintf(fd,"// generated by builder.sce: Please do not edit this file\n");\r
   mfprintf(fd,"// ------------------------------------------------------\n");\r
-  mfprintf(fd,"%s_path=get_file_path(''loader.sce'');\n",name);\r
+  mfprintf(fd,"\n");\r
+  mfprintf(fd,"%s_path = get_file_path(''loader.sce'');\n",name);\r
 \r
-  nl=size(libs,'*') \r
+  nl = size(libs,'*');\r
   for i=1:nl \r
-    mfprintf(fd,"link(%s_path+''/%s.%s'');\n",name,libs(i),lib_suf);\r
+    mfprintf(fd,"link(%s_path+''/%s%s'');\n",name,libs(i),getdynlibext());\r
   end \r
 \r
   if L == 1 then \r
     // direct call to addinter \r
     table = tables(1);\r
-    mfprintf(fd,"functions=[ ''%s'';\n",table(1,1));\r
-    for x=table(2:$,1)' ;mfprintf(fd,"            ''%s'';\n",x);end\r
+    \r
+    mfprintf(fd,"list_functions = [ ''%s'';\n",table(1,1));\r
+    for x = table(2:$,1)' \r
+      mfprintf(fd,"            ''%s'';\n",x);\r
+    end\r
     mfprintf(fd,"];\n");\r
-    mfprintf(fd,"addinter(%s_path+''/%s.%s'',''%s'',functions);\n",name, ...\r
-            name,lib_suf,name);\r
+    \r
+    mfprintf(fd,"addinter(%s_path+''/%s%s'',''%s'',list_functions);\n",name, ..\r
+                     name,getdynlibext(),name);\r
   else\r
-     // on link then a set of addinter \r
-     mfprintf(fd,"ilib=link(%s_path+''/%s.%s'');\n",name, ...\r
-               name,lib_suf);\r
-     for itable=1:L \r
-       // loop on a list of tables \r
-       table = tables(itable);\r
-       mfprintf(fd,"functions=[ ''%s'';\n",table(1,1));\r
-       for x=table(2:$,1)' ;mfprintf(fd,"            ''%s'';\n",x);end\r
-       mfprintf(fd,"];\n");\r
-       mfprintf(fd,"addinter(ilib,''%s'',functions);\n",name+ ...\r
-               string(itable));\r
+    // on link then a set of addinter \r
+    mfprintf(fd,"ilib = link(%s_path+filesep()+''%s%s'');\n",name, ..\r
+                name,getdynlibext());\r
+    for itable=1:L \r
+      // loop on a list of tables \r
+      table = tables(itable);\r
+      \r
+      mfprintf(fd,"list_functions = [ ''%s'';\n",table(1,1));\r
+      for x=table(2:$,1)' \r
+        mfprintf(fd,"            ''%s'';\n",x);\r
+      end\r
+      mfprintf(fd,"];\n");\r
+      \r
+      mfprintf(fd,"addinter(ilib,''%s'',list_functions);\n", ..\r
+                  name+ string(itable));\r
      end\r
   end\r
+  \r
   mfprintf(fd,"// remove temp. variables on stack\n");\r
   mfprintf(fd,"clear %s_path;\n",name);\r
-  mfprintf(fd,"clear functions;\n");\r
+  mfprintf(fd,"clear list_functions;\n");\r
   mfprintf(fd,"clear get_file_path;\n");\r
+  mfprintf(fd,"// ------------------------------------------------------\n");\r
   mclose(fd);\r
+  \r
 endfunction\r
-\r
+//==========================================\r
index c7129b9..9dd7278 100644 (file)
@@ -17,7 +17,6 @@ function ilib_mex_build(ilib_name,table,files,libs,makename,ldflags,cflags,fflag
   \r
   ilib_build(ilib_name,table,files,libs,makename,ldflags,cflags,fflags,%t);\r
   \r
-  \r
 endfunction\r
 //==========================================\r
 \r
index b9edf0b..c1bec43 100644 (file)
@@ -1,4 +1,9 @@
-function r=with_lcc()\r
-global LCC\r
-  r=LCC;\r
-endfunction
\ No newline at end of file
+//==========================================\r
+// INRIA 2008\r
+// Allan CORNET\r
+//==========================================\r
+function r = with_lcc()\r
+  global LCC\r
+  r = LCC;\r
+endfunction\r
+//==========================================
\ No newline at end of file