8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# Copyright (c) P.J.Gawthrop, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7 1996/08/05 18:44:56 peter
## Now writes out a _cbg file without ----- symbol.
##
## Revision 1.6 1996/08/05 12:17:37 peter
## n_ports now appear in the _abg file instead.
##
## Revision 1.5 1996/08/05 12:01:28 peter
|
>
>
>
|
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.8 1996/08/05 20:12:43 peter
## Now writes a _fig.fig file.
##
## Revision 1.7 1996/08/05 18:44:56 peter
## Now writes out a _cbg file without ----- symbol.
##
## Revision 1.6 1996/08/05 12:17:37 peter
## n_ports now appear in the _abg file instead.
##
## Revision 1.5 1996/08/05 12:01:28 peter
|
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
}
# It is terminated by /001 - so delete this termination
str = substr(str,1,length(str)-4);
# A component string contain only alphanumeric _ and :
isa_plain_component = match(str, component_regexp)==0;
# A port is an integer within []
isa_port = exact_match(str, port_regexp)>0;
# A port component is SS followed by : followed by a port string
isa_port_component = 0;
if (match(str, delimiter)) {
split(str,a,delimiter);
isa_port_component = (exact_match(a[1], "SS"))&&
(match(a[2], port_regexp)>0)
}
# A component is a plain or a port component
isa_component = isa_plain_component||isa_port_component;
# Coordinates in fields 12 & 13
x_coord = $12;
y_coord = $13;
# Do the port components
if (isa_port_component) {
i_port_component++;
# Port number is the bit between the []
port_number = substr(a[2],2,length(a[2])-2);
x_port[port_number] = x_coord;
|
|
|
>
>
>
>
>
>
>
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
}
# It is terminated by /001 - so delete this termination
str = substr(str,1,length(str)-4);
# A component string contain only alphanumeric _ and :
isa_plain_component = match(str, component_regexp)==0;
# A port is an integer within [] and no alpha characters
isa_port = (match(str, port_regexp)>0)&&(match(str, nonport_regexp)==0);
# A port component is SS followed by : followed by a port string
isa_port_component = 0;
if (match(str, delimiter)) {
split(str,a,delimiter);
isa_port_component = (exact_match(a[1], "SS"))&&
(match(a[2], port_regexp)>0)
}
# A component is a plain or a port component
isa_component = isa_plain_component||isa_port_component;
# Coordinates in fields 12 & 13
x_coord = $12;
y_coord = $13;
# Do the ports
if (isa_port) {
i_port++;
port_index = substr(str,2,length(str)-2);
ports[i_port] = sprintf("%s %s %s", x_coord, y_coord, port_index);
}
# Do the port components
if (isa_port_component) {
i_port_component++;
# Port number is the bit between the []
port_number = substr(a[2],2,length(a[2])-2);
x_port[port_number] = x_coord;
|
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
# Save in associative arrays by name
comp_type[name] = type;
x[name] = x_coord;
y[name] = y_coord;
info[name] = fig_info();
}
if (isa_port) {
i_port++;
port_index = substr(str,2,length(str)-2);
ports[i_port] = sprintf("%s %s %s", x_coord, y_coord, port_index);
}
}
function process_bond() {
arg_count++;
if ( (arg_count-arrow)==1 )
{
|
<
<
<
<
<
|
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
# Save in associative arrays by name
comp_type[name] = type;
x[name] = x_coord;
y[name] = y_coord;
info[name] = fig_info();
}
}
function process_bond() {
arg_count++;
if ( (arg_count-arrow)==1 )
{
|
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
default_cr = "";
default_args = "";
delimiter = ":";
q = "\047";
terminator = "\\001";
component_regexp = "[^0-9a-zA-Z_:]";
port_regexp = "\[[0-9]*\]";
isa_fig_file = 0;
min_line_length = 10;
object = 0;
polyline = 2;
sub_polyline=1;
firm_style = 0;
|
>
|
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
|
default_cr = "";
default_args = "";
delimiter = ":";
q = "\047";
terminator = "\\001";
component_regexp = "[^0-9a-zA-Z_:]";
port_regexp = "\[[0-9]*\]";
nonport_regexp = "a-zA-Z";
isa_fig_file = 0;
min_line_length = 10;
object = 0;
polyline = 2;
sub_polyline=1;
firm_style = 0;
|
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
|
printf("\tcr = %s%s%s;\n", q, cr, q) >> c_file;
printf("\targ = %s%s%s;\n", q, arg, q) >> c_file;
print "end" >> c_file
}
}
printf("];\n") >> b_file;
printf("rports = [\n") >> b_file;
for (i = 1; i <= i_port; i++)
print ports[i] >> b_file;
printf("];\n\n") >> b_file;
printf("n_ports = %1.0f;\n", i_port_component) >> b_file;
}
|
>
>
>
|
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
|
printf("\tcr = %s%s%s;\n", q, cr, q) >> c_file;
printf("\targ = %s%s%s;\n", q, arg, q) >> c_file;
print "end" >> c_file
}
}
printf("];\n") >> b_file;
# Print the ports list
printf("rports = [\n") >> b_file;
for (i = 1; i <= i_port; i++)
print ports[i] >> b_file;
printf("];\n\n") >> b_file;
# Print the number of ports
printf("n_ports = %1.0f;\n", i_port_component) >> b_file;
}
|