call_scilab: fix compilation fortran example 83/15383/2
Simon Marchetto [Wed, 15 Oct 2014 12:40:48 +0000 (14:40 +0200)]
Change-Id: Iccc54ef1feca281a5169eb80c30335aecfbdc528

scilab/modules/call_scilab/examples/call_scilab/fortran/example.sln
scilab/modules/call_scilab/examples/call_scilab/fortran/example.vfproj
scilab/modules/call_scilab/examples/call_scilab/fortran/matz.f [new file with mode: 0644]

index 7426663..d59459e 100644 (file)
@@ -1,18 +1,24 @@
 
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
 Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "example", "example.vfproj", "{B6C96508-D326-4691-A49D-FD9D8A369A44}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Win32 = Debug|Win32
+               Debug|x64 = Debug|x64
                Release|Win32 = Release|Win32
+               Release|x64 = Release|x64
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
                {B6C96508-D326-4691-A49D-FD9D8A369A44}.Debug|Win32.ActiveCfg = Debug|Win32
                {B6C96508-D326-4691-A49D-FD9D8A369A44}.Debug|Win32.Build.0 = Debug|Win32
+               {B6C96508-D326-4691-A49D-FD9D8A369A44}.Debug|x64.ActiveCfg = Debug|x64
+               {B6C96508-D326-4691-A49D-FD9D8A369A44}.Debug|x64.Build.0 = Debug|x64
                {B6C96508-D326-4691-A49D-FD9D8A369A44}.Release|Win32.ActiveCfg = Release|Win32
                {B6C96508-D326-4691-A49D-FD9D8A369A44}.Release|Win32.Build.0 = Release|Win32
+               {B6C96508-D326-4691-A49D-FD9D8A369A44}.Release|x64.ActiveCfg = Release|x64
+               {B6C96508-D326-4691-A49D-FD9D8A369A44}.Release|x64.Build.0 = Release|x64
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index c529c04..9deaf8a 100644 (file)
@@ -1,11 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <VisualStudioProject ProjectCreator="Intel Fortran" Keyword="Console Application" Version="11.0" ProjectIdGuid="{B6C96508-D326-4691-A49D-FD9D8A369A44}">
        <Platforms>
-               <Platform Name="Win32"/></Platforms>
+               <Platform Name="Win32"/>
+               <Platform Name="x64"/></Platforms>
        <Configurations>
                <Configuration Name="Debug|Win32" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)">
-                               <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" ExternalNameInterpretation="extNameLowerCase" CallingConvention="callConventionCRef" ExternalNameUnderscore="true" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug"/>
-                               <Tool Name="VFLinkerTool" OutputFile="../../../../../bin/example.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/example.pdb" SubSystem="subSystemConsole" AdditionalDependencies="../../../../../bin/core.lib"/>
+                               <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" AdditionalIncludeDirectories="../../../../core/includes" ExternalNameInterpretation="extNameLowerCase" CallingConvention="callConventionCRef" ExternalNameUnderscore="true" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug"/>
+                               <Tool Name="VFLinkerTool" OutputFile="../../../../../bin/example.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="../../../../../bin" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/example.pdb" SubSystem="subSystemConsole" AdditionalDependencies="core_f.lib elementary_functions_f.lib output_stream.lib"/>
                                <Tool Name="VFResourceCompilerTool"/>
                                <Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/>
                                <Tool Name="VFCustomBuildTool"/>
                                <Tool Name="VFCustomBuildTool"/>
                                <Tool Name="VFPreLinkEventTool"/>
                                <Tool Name="VFPreBuildEventTool"/>
+                               <Tool Name="VFPostBuildEventTool"/></Configuration>
+               <Configuration Name="Debug|x64" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)">
+                               <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" AdditionalIncludeDirectories="../../../../core/includes" ExternalNameInterpretation="extNameLowerCase" CallingConvention="callConventionCRef" ExternalNameUnderscore="true" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug"/>
+                               <Tool Name="VFLinkerTool" OutputFile="../../../../../bin/example.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="../../../../../bin" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/example.pdb" SubSystem="subSystemConsole" AdditionalDependencies="core_f.lib elementary_functions_f.lib output_stream.lib"/>
+                               <Tool Name="VFResourceCompilerTool"/>
+                               <Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/>
+                               <Tool Name="VFCustomBuildTool"/>
+                               <Tool Name="VFPreLinkEventTool"/>
+                               <Tool Name="VFPreBuildEventTool"/>
+                               <Tool Name="VFPostBuildEventTool"/>
+                               <Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
+               <Configuration Name="Release|x64" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)">
+                               <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" ExternalNameInterpretation="extNameLowerCase" CallingConvention="callConventionCRef" ExternalNameUnderscore="true" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/"/>
+                               <Tool Name="VFLinkerTool" OutputFile="../../../../../bin/example.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" SubSystem="subSystemConsole" AdditionalDependencies="../../../../../bin/core.lib"/>
+                               <Tool Name="VFResourceCompilerTool"/>
+                               <Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/>
+                               <Tool Name="VFCustomBuildTool"/>
+                               <Tool Name="VFPreLinkEventTool"/>
+                               <Tool Name="VFPreBuildEventTool"/>
                                <Tool Name="VFPostBuildEventTool"/></Configuration></Configurations>
        <Files>
                <Filter Name="Header Files" Filter="fi;fd"/>
                <Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"/>
                <Filter Name="Source Files" Filter="f90;for;f;fpp;ftn;def;odl;idl">
-               <File RelativePath="callsci.f"/></Filter>
+               <File RelativePath="callsci.f"/>
+               <File RelativePath=".\matz.f"/></Filter>
                <File RelativePath="..\..\..\..\..\bin\core.lib"/>
                <File RelativePath=".\readme.txt"/></Files>
        <Globals/></VisualStudioProject>
diff --git a/scilab/modules/call_scilab/examples/call_scilab/fortran/matz.f b/scilab/modules/call_scilab/examples/call_scilab/fortran/matz.f
new file mode 100644 (file)
index 0000000..728a20c
--- /dev/null
@@ -0,0 +1,124 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c 
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution.  The terms
+c are also available at    
+c http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+      subroutine matz(ar,ai,lda,m,n,name,job)
+c!purpose
+c     matz reads or writes in scilab's internal stack
+c
+c!calling sequence
+c
+c     integer lda,m,n,job
+c     character*(*) name
+c     double precision ar(lda,*),ai(lda,*)
+c
+c     ar,ai   : working array of size n*lda. Contains the a matrix
+c               If a is real ai is null
+c     lda     : number of rows in the calling program
+c     name    : character string; name of the scilab variable.
+c     job     : job= 0  scilab  -> fortran , real matrix
+c               job= 1 fortran -> scilab  , real matrix
+c               job=10  scilab  -> fortran , complex matrix
+c               job=11 fortran -> scilab  , complex matrix
+c
+c    CAUTION: For scilab->fortran   m and n
+c    are defined by  matz. Calling sequence must be:
+c    call matz(x,y,lda,m,n,name,0) and NOT
+c    call matz(x,y,lda,10,10,name,0) in the case where a
+c     is a 10 by 10 matrix. (Here y is not referenced: real case).
+c
+c!
+      integer lda,m,n,job
+      character*(*) name
+      double precision ar(lda,*),ai(lda,*)
+c
+      include 'stack.h'
+      integer iadr,sadr
+      integer il,it,l,l4,lec,srhs,id(nsiz)
+c
+      iadr(l)=l+l-1
+      sadr(l)=(l/2)+1
+c
+      it=0
+      if(job.ge.10) it=1
+      lec=job-10*it
+c
+      lon=0
+      lon1=len(name)
+      do 100 i=1,lon1
+         if(name(i:i).eq.char(0)) goto 200
+         lon=lon+1
+ 100  continue
+ 200  continue
+      if((lon1.gt.0).and.(lon1.lt.lon)) then
+         ln=lon1
+      else
+         ln=lon
+      endif
+      ln=min(nlgh,ln)
+      call cvname(id,name(1:ln),0)
+      srhs=rhs
+      rhs=0
+c
+      if(lec.ge.1) goto 10
+c
+c read   : from scilab stack -> fortran variable ar
+c -------
+c
+      fin=-1
+      call stackg(id)
+      if (err .gt. 0) return
+      if (fin .eq. 0) then
+         call putid(ids(1,pt+1),id)
+         call error(4)
+         return
+      endif
+      il=iadr(lstk(fin))
+      if(istk(il).ne.1.or.istk(il+3).ne.it) call error(44)
+      if(err.gt.0) return
+      m=istk(il+1)
+      n=istk(il+2)
+      l=sadr(il+4)
+      call dmcopy(stk(l),m,ar,lda,m,n)
+      if(it.eq.1) call dmcopy(stk(l+m*n),m,ai,lda,m,n)
+      goto 99
+c
+c write   : fortran -> scilab
+c --------
+c
+   10 if(top+2.ge.bot) then
+         call error(18)
+         return
+      endif
+      top=top+1
+      il=iadr(lstk(top))
+      l=sadr(il+4)
+      err=l+m*n*(it+1)-lstk(bot)
+      if(err.gt.0) then
+         call error(17)
+         return
+      endif
+      istk(il)=1
+      istk(il+1)=m
+      istk(il+2)=n
+      istk(il+3)=it
+c
+      call dmcopy(ar,lda,stk(l),m,m,n)
+      if(it.eq.1) call dmcopy(ai,lda,stk(l+m*n),m,m,n)
+      lstk(top+1)=l+m*n*(it+1)
+      l4=lct(4)
+      lct(4)=-1
+      call stackp(id,0)
+      lct(4)=l4
+      if(err.gt.0) return
+      goto 99
+c
+   99 rhs=srhs
+      return
+c
+      end