annotate scripts/control/system/__sysgroupn__.m @ 7016:93c65f2a5668

[project @ 2007-10-12 06:40:56 by jwe]
author jwe
date Fri, 12 Oct 2007 06:41:26 +0000
parents 6bbf56a9718a
children a1dbe9d80eee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 1996, 1998 Auburn University. All rights reserved.
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
2 ##
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
4 ##
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
6 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
8 ## your option) any later version.
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
9 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
13 ## General Public License for more details.
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
14 ##
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
17 ## <http://www.gnu.org/licenses/>.
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
18
6945
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 5307
diff changeset
19 ## Undocumented internal function.
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 5307
diff changeset
20
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
21 ## -*- texinfo -*-
3500
7923abdeb4e5 [project @ 2000-01-31 06:35:00 by jwe]
jwe
parents: 3438
diff changeset
22 ## @deftypefn {Function File} {} __sysgroupn__ (@var{names})
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
23 ## Locate and mark duplicate names
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
24 ## inputs:
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
25 ## names: list of signal names
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
26 ## kind: kind of signal name (used for diagnostic message purposes only)
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
27 ## outputs:
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
28 ## returns names with unique suffixes added; diagnostic warning
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
29 ## message is printed to inform the user of the new signal name
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
30 ##
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
31 ## used internally in sysgroup and elsewhere.
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
32 ## @end deftypefn
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
33
3438
2e06c3941943 [project @ 2000-01-14 06:33:18 by jwe]
jwe
parents: 3437
diff changeset
34 function names = __sysgroupn__ (names, kind)
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
35
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
36 ## check for duplicate names
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
37 l = length(names);
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
38 ii = 1;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
39 while(ii <= l-1)
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3500
diff changeset
40 st1 = names{ii};
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
41 jj = ii+1;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
42 while ( jj <= l)
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3500
diff changeset
43 st2 = names{jj};
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
44 if(strcmp(st1,st2))
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
45 suffix = ["_",num2str(jj)];
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
46 warning("sysgroup: %s name(%d) = %s name(%d) = %s", ...
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
47 kind,ii,kind,jj,st1);
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
48 strval = sprintf("%s%s",st2,suffix);
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3500
diff changeset
49 names{jj} = strval;
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
50 warning("sysgroup: changed %s name %d to %s",kind,jj,strval);
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
51 ## restart the check (just to be sure there's no further duplications)
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
52 ii = 0; jj = l;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
53 endif
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
54 jj = jj+1;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
55 endwhile
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
56 ii = ii+1;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
57 endwhile
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
58 endfunction