summaryrefslogtreecommitdiffstats
path: root/scilab/modules/data_structures
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2010-01-29 10:59:41 +0100
committerAllan CORNET <allan.cornet@scilab.org>2010-01-29 10:59:41 +0100
commit21b5935253ed6bcc90fa82a32c336931043587b0 (patch)
tree925a7a095f22f5975f47948ec3a6ce14f95c443e /scilab/modules/data_structures
parente83af56bd2cb72bd171ce31b248ca2316a94a0f9 (diff)
parent73a9e6e84f2270c7beb28cb56868cdfc548f8473 (diff)
downloadscilab-21b5935253ed6bcc90fa82a32c336931043587b0.zip
scilab-21b5935253ed6bcc90fa82a32c336931043587b0.tar.gz
Merge remote branch 'refs/remotes/origin/5.2'
Diffstat (limited to 'scilab/modules/data_structures')
-rw-r--r--scilab/modules/data_structures/macros/struct.sci10
1 files changed, 8 insertions, 2 deletions
diff --git a/scilab/modules/data_structures/macros/struct.sci b/scilab/modules/data_structures/macros/struct.sci
index de41446..b147071 100644
--- a/scilab/modules/data_structures/macros/struct.sci
+++ b/scilab/modules/data_structures/macros/struct.sci
@@ -13,7 +13,7 @@ function s=struct(varargin)
13 13
14rhs=argn(2) 14rhs=argn(2)
15 15
16fields=["st","dims"] 16fields=["st","dims"];
17 17
18if rhs==0 then 18if rhs==0 then
19 // No Matlab equivalent 19 // No Matlab equivalent
@@ -22,13 +22,19 @@ if rhs==0 then
22end 22end
23 23
24if floor(rhs/2)*2<>rhs then 24if floor(rhs/2)*2<>rhs then
25 error(msprintf(gettext("%s: Wrong number of input argument(s) : an even number is expected."),"struct")); 25 error(msprintf(gettext("%s: Wrong number of input argument(s) : an even number is expected.\n"),"struct"));
26end 26end
27 27
28nbfields=size(varargin)/2 28nbfields=size(varargin)/2
29 29
30dims=[] 30dims=[]
31for kf=1:2:size(varargin) 31for kf=1:2:size(varargin)
32 if varargin(kf)=="dims" then
33 error(msprintf(gettext("%s: ''dims'' can not be used as a field name.\n"),"struct"));
34 end
35 if or(varargin(kf)==fields(2:$)) then
36 error(msprintf(gettext("%s: field name ''%s'' defined twice.\n"),"struct",varargin(kf)));
37 end
32 fields=[fields varargin(kf)] 38 fields=[fields varargin(kf)]
33end 39end
34 40