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

« back to all changes in this revision

Viewing changes to macros/m2sci/sci_format.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function [stk,txt,top]=sci_format()
2
 
// Copyright INRIA
3
 
txt=[]
4
 
rhs1=rhs
5
 
if rhs==2 then
6
 
  fp=sci2exp('e')
7
 
  rhs=rhs-1
8
 
  top=top-1
9
 
else
10
 
  fp=sci2exp('v')
11
 
end
12
 
d=5;hex=%f;bank=%f;compact=%f;loose=%f,ratf=%f;symb=%f;unk=%f
13
 
if rhs==1 then
14
 
  f=stk(top)(1)
15
 
  select f
16
 
  case '''short''' then
17
 
    d=5
18
 
  case '''long''' then
19
 
    d=15
20
 
  case '''hex''' then
21
 
    hex=%t
22
 
  case '''+''' then
23
 
    symb=%t
24
 
  case '''bank''' then
25
 
    bank=%t
26
 
  case '''compact''' then
27
 
    compact=%t
28
 
  case '''loose''' then
29
 
    loose=%t
30
 
  case '''rat''' then
31
 
    ratf=%t
32
 
  else
33
 
    unk=%t
34
 
  end
35
 
else
36
 
  d=5
37
 
end
38
 
 
39
 
if unk then
40
 
  if rhs1==1 then
41
 
    stk=list('mtlb_format('+stk(top)(1)+')','0','0','0','0')
42
 
  else
43
 
    stk=list('mtlb_format('+stk(top)(1)+','+stk(top+1)(1)+')','0','0','0','0')
44
 
  end
45
 
elseif ratf|loose|compact|bank|hex then
46
 
  set_infos('No equivalent to '+f+' format. Ignored',2)
47
 
  stk=list(' ','-2','0','0','0','0')
48
 
else
49
 
  if rhs1==1 then
50
 
    stk=list('format('+string(d+1)+')','0','0','0','0')
51
 
  elseif rhs1==2 then
52
 
     stk=list('format('+fp+','+string(d+1)+')','0','0','0','0')
53
 
  else
54
 
    stk=list('format(''v'',6)','0','0','0','0')
55
 
    top=top+1
56
 
  end
57
 
end
58