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