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.16 1996/12/30 20:00:29 peterg
## Fixed bent-bond bug.
## NB unfixed problems:
## 1. xfig writes multi line fields if more than about 5 segments.
## 2. rbg2abg takes a multi-segment bond as a straignt line between the
## end points - so computation of stroke and arrow directions may be
## iffy.
|
>
>
>
>
>
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# Copyright (c) P.J.Gawthrop, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.17 1997/01/02 11:21:17 peterg
# Now assumes all components bonds etc at depth zero in fig file.
# Ie anything at depth>0 is ignored.
# Thanks to Donald for suggesting this.
#
## Revision 1.16 1996/12/30 20:00:29 peterg
## Fixed bent-bond bug.
## NB unfixed problems:
## 1. xfig writes multi line fields if more than about 5 segments.
## 2. rbg2abg takes a multi-segment bond as a straignt line between the
## end points - so computation of stroke and arrow directions may be
## iffy.
|
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
strokes[i_stroke] = sprintf("%s %s %s %s", $2, $3, $4, $5);
}
}
}
function write_fig() {
# Create _fig.fig file from _abg file - not components
if ( (isa_fig_file)&&((object!=text)||(isa_component==0))) {
if (exact_match($1,data_symbol)) {
field_1 = out_data_symbol
}
else {
field_1 = $1
}
printf field_1 >> fig_file
for (i=2; i<=NF; i++)
printf(" %s", $i) >> fig_file;
printf("\n") >> fig_file
}
}
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);
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>
>
>
>
>
>
|
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
strokes[i_stroke] = sprintf("%s %s %s %s", $2, $3, $4, $5);
}
}
}
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
#Everything except components
if ( ((object!=text)||(isa_component==0)) ) {
#Replace the data_symbol
if (exact_match($1,data_symbol)) {
field_1 = out_data_symbol
}
else {
field_1 = $1
}
printf field_1 >> fig_file
for (i=2; i<=NF; i++)
printf(" %s", $i) >> fig_file;
printf("\n") >> fig_file
}
# Header
if ( NF<3 ) {
printf("%s", $1) >> head_file;
for (i=2; i<=NF; i++)
printf(" %s", $i) >> head_file;
printf("\n") >> head_file
}
# Bonds
if (isa_bond) {
#Replace the data_symbol
if (exact_match($1,data_symbol)) {
field_1 = out_data_symbol
}
else {
field_1 = $1
}
printf field_1 >> bnd_file
for (i=2; i<=NF; i++)
printf(" %s", $i) >> bnd_file;
printf("\n") >> bnd_file
}
# Components
if ( (isa_component==1) ) {
for (i=1; i<=NF; i++)
printf(" %s", $i) >> cmp_file;
printf("\n") >> cmp_file
}
}
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);
|
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
|
#Process text
if (object==text) {
process_text()
}
# Process bond
if ( \
(data_line)&& zero_depth &&\
(object==polyline)&& \
(sub_type==sub_polyline)&& \
(style==firm_style) \
) {
process_bond()
}
write_fig()
}
BEGIN {
sys_name = ARGV[1];
delete ARGV[1];
b_file = sprintf("%s_rbg.m", sys_name);
c_file = sprintf("%s_cmp.m", sys_name);
fig_file = sprintf("%s_fig.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 = "WARNING system ports are not consecutively numbered\n";
data_symbol = "----";
out_data_symbol = "\t";
default_cr = "";
|
<
|
|
>
>
>
>
|
>
>
>
>
>
>
|
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
|
#Process text
if (object==text) {
process_text()
}
# Process bond
isa_bond = (zero_depth &&\
(object==polyline)&& \
(sub_type==sub_polyline)&& \
(style==firm_style) \
);
if ( isa_bond && data_line)
{
process_bond()
}
if (isa_fig_file){
write_fig()
}
}
BEGIN {
sys_name = ARGV[1];
delete ARGV[1];
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);
bnd_file = sprintf("%s_bnd.fig", sys_name);
head_file = sprintf("%s_head.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 = "WARNING system ports are not consecutively numbered\n";
data_symbol = "----";
out_data_symbol = "\t";
default_cr = "";
|