Overview
Comment:Tests for null string with strcmp
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 819feffbe29c46ef7932929649750a86aeace44a5cba169726752bfc45ac53a0
User & Date: gawthrop@users.sourceforge.net on 1996-12-07 21:34:52
Other Links: branch diff | manifest | tags
Context
1996-12-10
16:04:11
Changed file handling on mtt_info. check-in: 84b3830d14 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1996-12-07
21:34:52
Tests for null string with strcmp check-in: 819feffbe2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
21:33:52
Changed _input file to give unit step on ALL inputs check-in: 98908c2fdd user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/cbg2fig.m from [3d1ae6eab3] to [7021a58a40].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18




19

20
21
22
23
24
25
26
27




28
29
30
31
32
33
34
function cbg2fig(system_name, ...
                 system_type, full_name, ...
                 stroke_length, stroke_thickness, stroke_colour, ...
                 comp_font, comp_colour_u, comp_colour_o)
 
% $$$ cbg2fig(system_name, ...
% $$$                  system_type, full_name, ...
% $$$                  stroke_length, stroke_thickness, stroke_colour, ...
% $$$                  comp_font, comp_colour_u, comp_colour_o)
 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Matlab function  cbg_m2fig
% Causal bond graph:  mfile format to fig file format
% The resultant fig file is the original _abg.fig with
% additional causal strokes superimposed.




%

% P.J.Gawthrop May 1996
% Copyright (c) P.J.Gawthrop, 1996.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$




% %% Revision 1.2  1996/08/05 20:15:39  peter
% %% Prepared for recursive version.
% %%
% %% Revision 1.1  1996/08/05 18:12:25  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




|
<
<
<
<
|








>
>
>
>
|
>








>
>
>
>







1
2
3
4
5




6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function cbg2fig(system_name, ...
                 system_type, full_name, ...
                 stroke_length, stroke_thickness, stroke_colour, ...
                 comp_font, comp_colour_u, comp_colour_o)
% cbg2fig - converts causal bg to figure




%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Matlab function  cbg_m2fig
% Causal bond graph:  mfile format to fig file format
% The resultant fig file is the original _abg.fig with
% additional causal strokes superimposed.
% cbg2fig(system_name, ...
%                  system_type, full_name, ...
%                  stroke_length, stroke_thickness, stroke_colour, ...
%                  comp_font, comp_colour_u, comp_colour_o)
 

% P.J.Gawthrop May 1996
% Copyright (c) P.J.Gawthrop, 1996.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/08/08  15:52:28  peter
% %% Recursive version.
% %% Fails due to octave bug - reported.
% %%
% %% Revision 1.2  1996/08/05 20:15:39  peter
% %% Prepared for recursive version.
% %%
% %% Revision 1.1  1996/08/05 18:12:25  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53
54
55
56
57
58
59
60



61
62
63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
if nargin<8
  comp_colour_u = 12; %Green
end;

if nargin<9
  comp_colour_o = 4; %Red
end;




% Create the (full) system name
if length(full_name)==0
  full_name = system_name;
  system_type = system_name;
else
  full_name = [full_name, '_', system_name];
end;

full_name_type = [full_name, '_', system_type];
fig_name = [full_name_type, '_cbg.fig'];


% Return if cbg file doesn't exist
if exist(fig_name)~=2
  return
end;

% Setup file - append to the fig file
filenum = fopen(fig_name, 'a');

% Get the raw and the processed bonds
eval(['[rbonds,rstrokes,rcomponents] = ', system_type, '_rbg;']);
eval(['[bonds] = ', system_type, '_abg;']);

% Get the causal bonds
eval(['[cbonds,status]=', full_name_type, '_cbg;']);

% Check sizes
[N_components,Columns] = size(rcomponents);
if (Columns ~= 13)
  error('Incorrect rcomponents matrix: must have 13 columns');
end;
M_components = Columns;








>
>
>

|







|
>
|













|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
if nargin<8
  comp_colour_u = 12; %Green
end;

if nargin<9
  comp_colour_o = 4; %Red
end;

% Create a back slash '\' character.
bs = setstr(92);

% Create the (full) system name
if strcmp(full_name,'')
  full_name = system_name;
  system_type = system_name;
else
  full_name = [full_name, '_', system_name];
end;

full_name_type = [full_name, '_', system_type];
% $$$ fig_name = [full_name_type, '_cbg.fig'];
fig_name = [full_name, '_cbg.fig']
 
% Return if cbg file doesn't exist
if exist(fig_name)~=2
  return
end;

% Setup file - append to the fig file
filenum = fopen(fig_name, 'a');

% Get the raw and the processed bonds
eval(['[rbonds,rstrokes,rcomponents] = ', system_type, '_rbg;']);
eval(['[bonds] = ', system_type, '_abg;']);

% Get the causal bonds
eval(['[cbonds,status]=', full_name, '_cbg;']);

% Check sizes
[N_components,Columns] = size(rcomponents);
if (Columns ~= 13)
  error('Incorrect rcomponents matrix: must have 13 columns');
end;
M_components = Columns;
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
    fig_params(6) = comp_font;
  end;


  %Now print the component in fig format
  eval(['[comp_type,comp_name] = ', system_type, '_cmp(i);']);

  Terminator = '\\001';   
  for j = 1:length(fig_params)
    fprintf(filenum, '%1.0f ', fig_params(j));
  end;
  fprintf(filenum, '%1.0f %1.0f ', coords(1), coords(2)); 
  fprintf(filenum, '%s:%s%s\n', comp_type, comp_name, Terminator);
  
  % If it's a subsystem, do the fig file for that as well







|







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
    fig_params(6) = comp_font;
  end;


  %Now print the component in fig format
  eval(['[comp_type,comp_name] = ', system_type, '_cmp(i);']);

  Terminator = [bs, '001'];   
  for j = 1:length(fig_params)
    fprintf(filenum, '%1.0f ', fig_params(j));
  end;
  fprintf(filenum, '%1.0f %1.0f ', coords(1), coords(2)); 
  fprintf(filenum, '%s:%s%s\n', comp_type, comp_name, Terminator);
  
  % If it's a subsystem, do the fig file for that as well


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]