9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Copyright (c) P.J.Gawthrop, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.27 1998/04/04 10:54:58 peterg
## Remove a debugging print statement
##
## Revision 1.26 1998/04/04 07:29:26 peterg
## SS now only port component
##
## Revision 1.25 1998/04/03 15:07:20 peterg
|
>
>
>
|
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.28 1998/04/06 08:41:48 peterg
## Fixed bug due to adding (and then removing) 0 and 1 as port types
##
## Revision 1.27 1998/04/04 10:54:58 peterg
## Remove a debugging print statement
##
## Revision 1.26 1998/04/04 07:29:26 peterg
## SS now only port component
##
## Revision 1.25 1998/04/03 15:07:20 peterg
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# of alphanumeric characters and : and _ only.
# The lbl file is used to sort the components.
##############################################################
function exact_match(name1, name2) {
return ((match(name1,name2)>0)&&(length(name1)==length(name2)))
}
function process_lbl() {
# This puts the components in the lable file at the top of the list
# and saves up the corresponding CR and arguments
# note that there may be more than one component per label
if ((match($1,"%")==0)&&(NF>0))
{
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
# of alphanumeric characters and : and _ only.
# The lbl file is used to sort the components.
##############################################################
function exact_match(name1, name2) {
return ((match(name1,name2)>0)&&(length(name1)==length(name2)))
}
function write_component(i) {
name = label[i,1];
cr = label[i,2];
arg = label[i,3];
if (length(x[name])==0) {
# print error unless its a port component
if (match(name,port_regexp)==0)
printf(warning_l, name);
}
else {
component_index++;
print x[name], y[name], info[name] >> b_file;
printf("if i==%1.0f\n", component_index) >> c_file;
printf("\tcomp_type = %s%s%s;\n", q, comp_type[name], q) >> c_file;
printf("\tname = %s%s%s;\n", q, name, q) >> c_file;
printf("\tcr = %s%s%s;\n", q, cr, q) >> c_file;
printf("\targ = %s%s%s;\n", q, arg, q) >> c_file;
printf("\trepetitions = %s;\n", reps[name]) >> c_file;
print "end" >> c_file
}
}
function process_lbl() {
# This puts the components in the lable file at the top of the list
# and saves up the corresponding CR and arguments
# note that there may be more than one component per label
if ((match($1,"%")==0)&&(NF>0))
{
|
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
if (isa_port) {
i_port++;
port_name = str;
ports[i_port] = sprintf("%s %s %s", x_coord, y_coord, port_name);
}
# Do the port components
if (isa_port_component) {
i_port_component++;
type = a[1];
# Port name is the bit between the []
port_label = substr(a[2],2,length(a[2])-2);
x_port[i_port_component] = x_coord;
y_port[i_port_component] = y_coord;
info_port[i_port_component] = fig_info();
port_labels[i_port_component] = port_label;
}
# Do the plain components
if (isa_plain_component) {
i_text++;
# Get repetitions (if any)
if (match(str,repetition_regexp) > 0) {
split(str,b,repetition_delimiter);
repetitions = b[2];
str = b[1];
|
|
|
|
|
|
|
|
|
|
>
|
<
|
|
|
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
if (isa_port) {
i_port++;
port_name = str;
ports[i_port] = sprintf("%s %s %s", x_coord, y_coord, port_name);
}
# Do the port components
# if (isa_port_component) {
# i_port_component++;
# type = a[1];
# # Port name is the bit between the []
# port_label = substr(a[2],2,length(a[2])-2);
# x_port[i_port_component] = x_coord;
# y_port[i_port_component] = y_coord;
# info_port[i_port_component] = fig_info();
# port_labels[i_port_component] = port_label;
# }
# Do the components
if (isa_component) {
i_text++;
# Get repetitions (if any)
if (match(str,repetition_regexp) > 0) {
split(str,b,repetition_delimiter);
repetitions = b[2];
str = b[1];
|
532
533
534
535
536
537
538
539
540
541
542
543
544
545
|
i_stroke = 0;
i_arrow = 0;
i_label = 0;
i_text = 0;
i_name = 0;
i_port_component = 0;
}
{
# Start of .fig file?
if ( (NF>0) && (match("#FIG", $1) > 0) ) {
isa_fig_file=1;
}
|
>
|
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
|
i_stroke = 0;
i_arrow = 0;
i_label = 0;
i_text = 0;
i_name = 0;
i_port_component = 0;
component_index = 0;
}
{
# Start of .fig file?
if ( (NF>0) && (match("#FIG", $1) > 0) ) {
isa_fig_file=1;
}
|
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
|
printf("];\n") >> b_file;
printf("rcomponents = [") >> b_file;
j = 0;
# Do the port components, in order of appearance, first
for (i = 1; i <= i_port_component; i++) {
name = sprintf("[%s]", port_labels[i]);
port_type = "SS";
cr = "MTT_port";
arg = i;
if (length(x_port[i])==0)
printf(warning_p);
else {
j++;
print x_port[i], y_port[i], info_port[i] >> b_file;
printf("if i==%1.0f\n", j) >> c_file;
printf("\tcomp_type = %s%s%s;\n", q, port_type, q) >> c_file;
printf("\tname = %s%s%s;\n", q, name, q) >> c_file;
printf("\tcr = %s%s%s;\n", q, cr, q) >> c_file;
printf("\targ = %s%s%s;\n", q, arg, q) >> c_file;
printf("\trepetitions = 1;\n") >> c_file;
print "end" >> c_file
}
}
# Now do the ordinary components (in no particular order)
for (i = 1; i <= i_label; i++) {
name = label[i,1];
cr = label[i,2];
arg = label[i,3];
if (length(x[name])==0) {
# print error unless its a port component
if (match(name,port_regexp)==0)
printf(warning_l, name);
}
else {
j++;
print x[name], y[name], info[name] >> b_file;
printf("if i==%1.0f\n", j) >> c_file;
printf("\tcomp_type = %s%s%s;\n", q, comp_type[name], q) >> c_file;
printf("\tname = %s%s%s;\n", q, name, q) >> c_file;
printf("\tcr = %s%s%s;\n", q, cr, q) >> c_file;
printf("\targ = %s%s%s;\n", q, arg, q) >> c_file;
printf("\trepetitions = %s;\n", reps[name]) >> c_file;
print "end" >> c_file
}
}
printf("];\n") >> b_file;
# Print the (internal) ports list
printf("port_coord = [\n") >> b_file;
for (i = 1; i <= i_port; i++) {
split(ports[i],a, " ");
printf("%s %s\n", a[1], a[2]) >> b_file;
|
|
|
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
|
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
|
printf("];\n") >> b_file;
printf("rcomponents = [") >> b_file;
j = 0;
# Do the port components, in order of appearance, first
for (i = 1; i <= i_label; i++) {
name = label[i,1];
if (match(name,port_regexp))
write_component(i);
}
# Now do the ordinary components (in no particular order)
for (i = 1; i <= i_label; i++) {
name = label[i,1];
if (!match(name,port_regexp))
write_component(i);
}
printf("];\n") >> b_file;
# Print the (internal) ports list
printf("port_coord = [\n") >> b_file;
for (i = 1; i <= i_port; i++) {
split(ports[i],a, " ");
printf("%s %s\n", a[1], a[2]) >> b_file;
|