summaryrefslogtreecommitdiffstats
path: root/scilab/modules/data_structures/macros/struct.sci
diff options
context:
space:
mode:
authorVincent COUVERT <vincent.couvert@scilab.org>2010-01-28 16:44:49 +0100
committerVincent COUVERT <vincent.couvert@scilab.org>2010-01-28 16:44:49 +0100
commitd97b6a170313dc3c6fc70df30338a63a2920aa69 (patch)
treef0234d8f308a48bea6be0919b79a4a0bd0245c63 /scilab/modules/data_structures/macros/struct.sci
parentad6d59ad324e97774b3fb09e4daf906ddc7126cc (diff)
downloadscilab-d97b6a170313dc3c6fc70df30338a63a2920aa69.zip
scilab-d97b6a170313dc3c6fc70df30338a63a2920aa69.tar.gz
Mistake in last commit
Diffstat (limited to 'scilab/modules/data_structures/macros/struct.sci')
-rw-r--r--scilab/modules/data_structures/macros/struct.sci7
1 files changed, 3 insertions, 4 deletions
diff --git a/scilab/modules/data_structures/macros/struct.sci b/scilab/modules/data_structures/macros/struct.sci
index 1fa4cce..b147071 100644
--- a/scilab/modules/data_structures/macros/struct.sci
+++ b/scilab/modules/data_structures/macros/struct.sci
@@ -13,6 +13,8 @@ function s=struct(varargin)
13 13
14rhs=argn(2) 14rhs=argn(2)
15 15
16fields=["st","dims"];
17
16if rhs==0 then 18if rhs==0 then
17 // No Matlab equivalent 19 // No Matlab equivalent
18 s=mlist(fields,int32([0,0])) 20 s=mlist(fields,int32([0,0]))
@@ -26,19 +28,16 @@ end
26nbfields=size(varargin)/2 28nbfields=size(varargin)/2
27 29
28dims=[] 30dims=[]
29fields = [];
30for kf=1:2:size(varargin) 31for kf=1:2:size(varargin)
31 if varargin(kf)=="dims" then 32 if varargin(kf)=="dims" then
32 error(msprintf(gettext("%s: ''dims'' can not be used as a field name.\n"),"struct")); 33 error(msprintf(gettext("%s: ''dims'' can not be used as a field name.\n"),"struct"));
33 end 34 end
34 if or(varargin(kf)==fields) then 35 if or(varargin(kf)==fields(2:$)) then
35 error(msprintf(gettext("%s: field name ''%s'' defined twice.\n"),"struct",varargin(kf))); 36 error(msprintf(gettext("%s: field name ''%s'' defined twice.\n"),"struct",varargin(kf)));
36 end 37 end
37 fields=[fields varargin(kf)] 38 fields=[fields varargin(kf)]
38end 39end
39 40
40fields=["st","dims", fields]
41
42dims=[1 1] 41dims=[1 1]
43// Search struct size 42// Search struct size
44for kf=2:2:size(varargin) 43for kf=2:2:size(varargin)