Differences From Artifact [39acd0804a]:

To Artifact [6b24a93f28]:


9
10
11
12
13
14
15



16
17
18
19
20
21
22
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+
+
+







# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.33  1998/08/10 15:51:06  peterg
## Comments may now be prefaced by # as well as %
##
## Revision 1.32  1998/07/27 20:30:03  peterg
## *** empty log message ***
##
## Revision 1.31  1998/04/16 13:18:13  peterg
## Now ignores spurious ports (in lbl but not Figure \ref{) but gives
## warning
##
175
176
177
178
179
180
181




182
183
184
185
186
187
188
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195







+
+
+
+







#             field 1 = 4
#		fields 12 and 13 are the coordinates
#		field 14 is the type:name string terminated by \001
# To prevent text being confused with components, components consist
# of alphanumeric characters and : and _ only.
# The lbl file is used to sort the components.
##############################################################

function modulo10(x) {
  return x-int(x/10)*10
    }

function exact_match(name1, name2) {
  return ((match(name1,name2)>0)&&(length(name1)==length(name2)))
    }

function write_component(i) {
    name = label[i,1];
232
233
234
235
236
237
238
239

240
241
242
243
244
245
246

247
248
249
250
251
252
253
239
240
241
242
243
244
245

246
247
248
249
250
251
252

253
254
255
256
257
258
259
260







-
+






-
+







# The text string is field 14 onwards
  str = $14; 
  for (i=15; i<=NF; i++) {
    str = sprintf("%s %s", str, $i)
      }

# The depth is field 4
  depth = $4; 
  depth = modulo10($4);

# It is terminated by \001 - so delete this termination
  str = substr(str,1,length(str)-4);

# A component string contains only alphanumeric  _ and :
  isa_plain_component = match(str, component_regexp)==0;
# It must also be specified at depth 0
# It must also be specified at depth 0 (modulo 10)
  isa_plain_component = isa_plain_component && (depth==0);

# A port is a string within []
  isa_port = (match(str, port_regexp)>0)

# It must also be specified at depth 0
  isa_port = isa_port && (depth==0);
355
356
357
358
359
360
361
362

363
364
365
366
367
368
369
362
363
364
365
366
367
368

369
370
371
372
373
374
375
376







-
+







	label[i_label,3] = args
	  }
    }

# Unnamed component
    if (named_component==0) {
      i_name++;
      name = sprintf("%1.0f", i_name);
      name = sprintf("mtt%i", i_name);
      type = str;
      i_label++;
      label[i_label,1] = name;
      label[i_label,2] = default_cr;
      label[i_label,3] = default_args
	}

482
483
484
485
486
487
488
489
490
491
492
493
494
495

496
497
498
499
500
501
502
489
490
491
492
493
494
495

496
497
498
499
500

501
502
503
504
505
506
507
508







-





-
+







}
}

function process_fig() {
# Test for the fig format first line and data line
  data_line = (match($1,data_symbol)>0);
  first_line = (data_line==0)&&(NF>min_line_length);

#Process firstline
  if (first_line) {
    object = $1;
    sub_type = $2;
    style = $3;
    zero_depth = (($7==0)&&(object=polyline)) || (($4==0)&&(object=text));
    zero_depth = ((modulo10($7)==0)&&(object==polyline)) || ((modulo10($4)==0)&&(object==text))
    f_arrow = ($14==1)&&(object=polyline);
    b_arrow = ($15==1)&&(object=polyline);
    arrow = f_arrow||b_arrow;
    arg_count = 0;
  }

#Process text

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