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