8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
+
+
+
|
# Copyright (c) P.J.Gawthrop, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.38 2001/03/23 14:57:31 gawthrop
## Now puts space after header fields + writes _port.fig
##
## Revision 1.37 2000/09/14 08:43:32 peterg
## Add additional directional informatiuon to rbonds:
## cols 7-8 Arrow end directional bond
## cols 9-10 Arrow end directional bond
##
## Revision 1.36 1999/11/19 04:00:26 peterg
## Changed a comment to be more accurate.
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
-
+
|
function process_text() {
# 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
# The depth is field 4 (for strings)
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;
|
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
|
+
+
+
+
+
+
+
+
+
|
}
}
function write_fig() {
# Create _fig.fig file from _abg file - not components
# and write out the components in a _cmp.fig file
# and write out the bonds in a _bnd.fig file
# The artwork -- not header and not zero depth
if ((NF>2)&&(!zero_depth)) {
art=$0;
sub("----"," ",art)
printf("%s\n", art) >> art_file
}
#Everything except components
if ( ((object!=text)||(isa_component==0)) ) {
#Replace the data_symbol
if (exact_match($1,data_symbol)) {
field_1 = out_data_symbol
}
|
581
582
583
584
585
586
587
588
589
590
591
592
593
594
|
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
|
+
|
b_file = sprintf("%s_rbg.m", sys_name);
c_file = sprintf("%s_cmp.m", sys_name);
fig_file = sprintf("%s_fig.fig", sys_name);
cmp_file = sprintf("%s_cmp.fig", sys_name);
port_file = sprintf("%s_port.fig", sys_name);
bnd_file = sprintf("%s_bnd.fig", sys_name);
head_file = sprintf("%s_head.fig", sys_name);
art_file = sprintf("%s_art.fig", sys_name);
warning_f = "WARNING %s \t in fig file but not lbl file - using\n";
warning_l = "WARNING %s \t in lbl file but not fig file - ignoring\n";
warning_p = "ERROR system ports are not consecutively numbered\n";
warning_u = "ERROR %s has already appeared in the fig file\n";
comment_regexp = "%|#"
|
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
|
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
|
-
+
|
}
else {
process_fig()
}
}
END {
#Print out the matlab functions
#Print out the Octave functions
printf("function [rbonds, rstrokes,rcomponents,port_coord,port_name,port_list] = %s_rbg\n", sys_name) > b_file;
printf("%% [rbonds,rstrokes,rcomponents,port_coord,port_name,port_list] = %s_rbg\n", sys_name) > b_file;
printf("%% Generated by MTT\n\n") > b_file;
printf("function [comp_type, name, cr, arg, repetitions] = %s_cmp(i)\n",\
sys_name) > c_file;
printf("%% [comp_type, name, cr, arg, repetitions] = %s_cmp\n", sys_name) > c_file;
|