~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/scicos/do_ccomlink.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [ok]=do_ccomlink(funam,txt)
 
2
// Copyright INRIA
 
3
if stripblanks(funam)==emptystr() then 
 
4
  ok=%f;x_message('sorry C file name not defined');return
 
5
end
 
6
if MSDOS then 
 
7
        out_f = strsubst(TMPDIR,'/','\')+'\'+funam+'.c';
 
8
        host('del '+ out_f);
 
9
else 
 
10
        unix_s('\rm -f '+TMPDIR+'/'+funam+'.c');
 
11
end
 
12
write(TMPDIR+'/'+funam+'.c',txt,'(a)')
 
13
if MSDOS then 
 
14
  [a,b]=c_link(funam); while a ; ulink(b);[a,b]=c_link(funam);end  
 
15
  cur_wd = getcwd();
 
16
  chdir(TMPDIR);
 
17
  if (getenv('COMPILER','NO')=='ABSOFT')
 
18
    cmd_win='amake /f '"'+SCI+'\util\MakeC.amk'" TARGET=';
 
19
  else
 
20
    cmd_win='nmake /f '"'+SCI+'\util\MakeC.mak'" TARGET=';
 
21
  end
 
22
  cmd_win=cmd_win+funam+' SCIDIR1='"'+strsubst(SCI,'/','\')+''"';
 
23
  ww=unix_g(cmd_win);
 
24
  chdir(cur_wd);
 
25
else
 
26
  ww=unix_g('cd '+TMPDIR+'; make -f '+SCI+'/util/Make.unx '+funam+'.o SCIDIR='+SCI);
 
27
end 
 
28
 
 
29
if ww==emptystr() then 
 
30
  ok=%f;x_message('sorry compilation problem');return
 
31
else
 
32
  errcatch(-1,'continue')
 
33
if MSDOS then 
 
34
  junk=link(TMPDIR+'/'+funam+'.dll',funam,'c');
 
35
else
 
36
  [a,b]=c_link(funam); while a;  ulink(b);[a,b]=c_link(funam);end
 
37
  junk=link(TMPDIR+'/'+funam+'.o',funam,'c');
 
38
end 
 
39
  if iserror(-1)==1 then 
 
40
    ok=%f;x_message('sorry link problem');
 
41
    errclear(-1)
 
42
    errcatch(-1)
 
43
    return;
 
44
  end
 
45
end
 
46
ok=%t
 
47