2f974fd9d7c272800946a8da2d47f0f5953532cf
[scilab.git] / scilab / modules / dynamic_link / macros / VCtoLCCLib.sci
1 //-------------------------------------------------------------------
2 // Allan CORNET INRIA 2004 - 2006
3 // Export LibScilab for LCC compiler
4 //-------------------------------------------------------------------
5 function VCtoLCCLib()
6 if with_lcc()==%t then
7         if MSDOS==%t then
8                 DirCur=pwd();
9                 chdir(WSCI+'\bin');
10                 mkdir('lcclib');
11         
12                 Exportalibrary('LibScilab');
13                 ExportAtlasLibrary();
14                 Exportalibrary('lapack');
15                 Exportalibrary('scicos');
16                 Exportalibrary('libf2c');
17                 Exportalibrary('intersci');
18         
19                 chdir(DirCur);
20         end
21 end
22 endfunction
23 //-------------------------------------------------------------------
24 function bOK=Exportalibrary(libraryname)
25   printf('\nExports from '+libraryname+'.dll\n');
26         unix('pedump /exp '+libraryname+'.dll >'+TMPDIR+filesep()+libraryname+'.lcc');
27         printf('Converting Library');
28         
29         fw=mopen(TMPDIR+filesep()+libraryname+'.exp',"w");
30         fr=mopen(TMPDIR+filesep()+libraryname+'.lcc',"r");
31         
32         if (meof(fr) == 0) then 
33                 line=mfscanf(1,fr,"%s");
34                 mfprintf(fw,"%s\n",line);
35                 printf('.');
36         end
37
38         while ( meof(fr) == 0)
39                 line=mfscanf(1,fr,"%s");
40                 if (line ~= []) then
41                         mfprintf(fw,"_%s\n",line);
42                 end
43         end
44
45         mclose(fw);
46         mclose(fr);
47         
48         printf('\nBuild '+libraryname+'.lib (Please waiting).\n');
49         command='buildLib ""'+TMPDIR+filesep()+libraryname+'.exp""'+' ""'+WSCI+'\bin\lcclib\'+libraryname+'.lib""';
50         unix(command);
51         bOK=%T;
52 endfunction
53 //-------------------------------------------------------------------
54 function ExportAtlasLibrary()
55         
56         printf('\nExports from blasplus.dll\n')
57         unix('pedump /exp blasplus.dll >'+TMPDIR+'\blasplus.lcc');
58         printf('Converting Library');
59         
60         fw=mopen(TMPDIR+'\blaspluslcc.exp',"w");
61         fr=mopen(TMPDIR+'\blasplus.lcc',"r");
62
63         if (meof(fr) == 0) then 
64                 line=mfscanf(1,fr,"%s");
65                 mfprintf(fw,"blasplus.dll\n");
66         end
67
68         i=1;
69         while ( meof(fr) == 0)
70                 line=mfscanf(1,fr,"%s");
71                 if (line ~= []) then
72                         mfprintf(fw,"_%s_  %s @%d\n",line,line,i);
73                         i=i+1;
74                         end
75         end
76
77         mclose(fw);
78         mclose(fr);
79         
80         printf('\nBuild Atlas.lib\n');
81         unix('buildLib ""'+TMPDIR+'\Atlaslcc.exp""'+' ""'+WSCI+'\bin\lcclib\'+'blasplus.lib""');
82 endfunction
83 //-------------------------------------------------------------------