-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCLB.R
2810 lines (2266 loc) · 59.5 KB
/
SCLB.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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
151
152
153
154
155
156
157
158
159
160
161
162
163
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
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
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
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
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
404
405
406
407
408
409
410
411
412
413
414
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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
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
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# sclb - terminal-independent screen control package
# Ver Date Who Remarks
# --- ------- --- ------------------------------------------------------
# 04s 31Jan85 cal .Fixed bell sequence in built in dumb capabilities code.
# 04r 12Oct84 cal .Added sclinit() to allow use of sclb when terminal
# information isn't available. Trimmed and reformatted
# revision history.
# 04q 04Oct84 cal .Fixed minor format bug in scerror().
# 04p 26Sep84 cal .Modified to use environments to get the terminal type
# and to find the termcap file.
# 04o 18Jul84 cal .Modified to use new iolb routine names.
# 04n 08Jun84 cal .Changed scend() to not fool with the cursor postion.
# Added sctermcap().
#
# This library assumes that the characters and integers can be assigned to
# each other, and that characters have ascii values when viewed as integers.
#
include "sclb"
include "sclb.i"
include "tslb"
### scinit - initialization for the screen package
#
# SYNOPSIS
# call scinit
#
# DESCRIPTION
# One of scinit() or sclinit() must be called before any others in
# this package except scsetup(), which can be used to read a termcap
# file without actually doing work on a terminal.
#
subroutine scinit
NOIMPLICIT
call sclinit ( .false. ) # don't assume "dumb" as a last resort
return
end
### sclinit - low level initialization for the screen package
#
# SYNOPSIS
# logical dodumb
# call sclinit ( dodumb )
#
# dodumb - .true. means to assume "dumb" as a last resort
# .false. means to abort if there are problems
#
# DESCRIPTION
# One of scinit() or sclinit() must be called before any others in
# this package except scsetup(), which can be used to read a termcap
# file without actually doing work on a terminal.
#
subroutine sclinit ( dodumb )
NOIMPLICIT
logical dodumb
integer i, j, enopen, engetnext, enfldn, envget
character buf(MAXLINE), tcfilename(FILENAMESIZE), ttype(32)
include "sclb.c"
include "sclb.ic"
# Get terminal type.
if ( envget ( "TERM", ttype ) != OK )
if ( ! dodumb )
call error ( "scinit: Environment TERM undefined." )
else
{
call scsetup ( .true. ) # do dumb entry
call screinit
call ioflush
return
}
# Find the correct entry from the termcap file.
call sctermcap ( tcfilename )
if ( enopen ( tcfilename ) != OK )
if ( ! dodumb )
{
call fprintf ( ERROUT, "scinit: Can't open termcap file %s",
tcfilename )
call error ( "" )
}
else
{
call scsetup ( .true. ) # do dumb entry
call screinit
call ioflush
return
}
repeat
{
if ( engetnext(0) == EOF )
if ( ! dodumb )
{
call fprintf ( ERROUT, "scinit: Unknown terminal type @"%s@"",
ttype )
call error ( "" )
}
else
{
call scsetup ( .true. ) # do dumb entry
call screinit
call ioflush
return
}
if ( enfldn ( 2, buf, MAXLINE ) != OK )
call error ( "scinit: enfldn() failed" )
# Scan the various names.
i = 1
while ( buf(i) != EOS )
{
j = 1
while ( ttype(j) == buf(i) )
{
j = j + 1
i = i + 1
if ( ( buf(i) == '|' | buf(i) == EOS ) & ttype(j) == EOS )
break 3 # found it
}
for ( ; buf(i) != '|'; i = i + 1 )
if ( buf(i) == EOS )
next 3 # try next entry
i = i + 1
}
}
call enclose
# Set up from termcap entry.
call scsetup ( .false. ) # read termcap file
# Reinitialize the terminal.
call screinit
call ioflush
return
end
### scsetup - set up termcap values from current entry
#
# SYNOPSIS
# call scsetup ( dodumb )
#
# DESCRIPTION
# This routine sets up the tables describing the terminal from the
# current termcap entry.
#
subroutine scsetup ( dodumb )
NOIMPLICIT
logical dodumb
integer i
integer scnxtent
integer n
character name ( MAXLINE )
character rest ( MAXLINE )
integer length
integer min0
include "sclb.c"
include "sclb.ic"
string horiz "()-"
string vert "()|"
string cross "()+"
# Set up so that nothing is specified.
scnatt = 0
scautonl = .false.
sccbeep = CANT
sccbol = CANT
scbs = .false.
scccel = CANT
sccchscroll = CANT
sccclear = CANT
scpcols = 0
# sccdepill = CANT
sccdlc = CANT
sccdll = CANT
sccdown = CANT
# sccenpill = CANT
for ( i = 1 ; i <= NUMBER_GRAPHICS_CHARS ; i = i + 1 )
sccgraphics ( i ) = CANT
schardcopy = .false.
scchome = CANT
scciim = CANT
sccikey = CANT
sccinc = CANT
sccinit = CANT
sccinl = CANT
sccleft = CANT
scplins = 0
sclshigh = .false.
sccmove = CANT
scnoautonl = .false.
# scblclear = .true.
scnotilde = .false.
sccoim = CANT
sccokey = CANT
scoverstrike = .false.
scpbeep = 0.0
scpbol = 0.0
scpcel = 0.0
scpclear = 0.0
scpdlc = 0.0
scpdll = 0.0
scpdown = 0.0
scpinc = 0.0
scpinl = 0.0
scpsdown = 0.0
scpsup = 0.0
scptab = 0.0
scpadc = '@^?'
sccright = CANT
sccsdown = CANT
sccsup = CANT
scctab = CANT
# for ( i = 1 ; i <= MAX_ATTRIBUTES ; i = i + 1 )
# sctabs ( i ) = .false.
sccup = CANT
scvisdel = .false.
scwrtop = .false.
scxonoff = .false.
if ( ! dodumb )
{
# Read termcap entries.
n = 2
while ( scnxtent ( n, name, rest ) == OK )
call scsu ( name, rest )
}
else
{
# Fake it.
call scsu ( "lins#", "24" )
call scsu ( "cols#", "80" )
##
## The following should be "^G", but esc() is (stupidly)
## called in enfldn() instead of scsu().
##
call scsu ( "beep=", "@^G" )
call scsu ( "autonl", "" )
call scsu ( "bs", "" )
}
# use defaults, if necessary
if ( sccbol == CANT )
{
seqbol(1) = '@^m'
seqbol(2) = EOS
sccbol = length ( seqbol )
}
# if ( sccdepill == CANT )
# {
# seqdepill(1) = EOS
# sccdepill = length ( seqdepill )
# }
# if ( sccenpill == CANT )
# {
# seqenpill(1) = EOS
# sccenpill = length ( seqenpill )
# }
if ( sccleft == CANT )
{
if ( scbs )
{
seqleft(1) = '@^h'
seqleft(2) = EOS
sccleft = length ( seqleft )
}
}
if ( sccgraphics ( GRAPHICS_PILLOW ) == CANT )
call sccapg ( "()X", GRAPHICS_PILLOW )
if ( sccgraphics ( LSEG_D ) == CANT )
call sccapg ( vert, LSEG_D )
if ( sccgraphics ( LSEG_L ) == CANT )
call sccapg ( horiz, LSEG_L )
if ( sccgraphics ( LSEG_LD ) == CANT )
call sccapg ( cross, LSEG_LD )
if ( sccgraphics ( LSEG_U ) == CANT )
call sccapg ( vert, LSEG_U )
if ( sccgraphics ( LSEG_UD ) == CANT )
call sccapg ( vert, LSEG_UD )
if ( sccgraphics ( LSEG_UL ) == CANT )
call sccapg ( cross, LSEG_UL )
if ( sccgraphics ( LSEG_ULD ) == CANT )
call sccapg ( cross, LSEG_ULD )
if ( sccgraphics ( LSEG_R ) == CANT )
call sccapg ( horiz, LSEG_R )
if ( sccgraphics ( LSEG_RD ) == CANT )
call sccapg ( cross, LSEG_RD )
if ( sccgraphics ( LSEG_RL ) == CANT )
call sccapg ( horiz, LSEG_RL )
if ( sccgraphics ( LSEG_RLD ) == CANT )
call sccapg ( cross, LSEG_RLD )
if ( sccgraphics ( LSEG_RU ) == CANT )
call sccapg ( cross, LSEG_RU )
if ( sccgraphics ( LSEG_RUD ) == CANT )
call sccapg ( cross, LSEG_RUD )
if ( sccgraphics ( LSEG_RUL ) == CANT )
call sccapg ( cross, LSEG_RUL )
if ( sccgraphics ( LSEG_RULD ) == CANT )
call sccapg ( cross, LSEG_RULD )
# figure out usable lines and columns
sclins = min0 ( scplins, MAXSCLINS )
sccols = min0 ( scpcols, MAXSCCOLS )
# if neither autonl or noautonl was specified (or if both were),
# delete a column from the screen
if ( scautonl == scnoautonl )
# delete a column from the screen
sccols = sccols - 1
# Adjust sccmove to account for the "l" and the "c".
if ( sccmove != CANT )
sccmove = sccmove - 2 # ** not correct for VT100s... **
# Initialize the scprch array, which tells which characters are
# printable on the terminal.
for ( i=0; i <= '@^_'; i=i+1 )
scprch(i+1) = .false.
for ( i=' '; i <= '~'; i=i+1 )
scprch(i+1) = .true.
scprch('@^?'+1) = .false.
if ( scnotilde )
scprch('~'+1) = .false.
if ( scvisdel )
scprch('@^?'+1) = .true.
# figure out the number of pad character required
call tsinit
call tsgspeed ( scispeed, scospeed )
call tsend
scnbeep = scpbeep * scospeed
scnbol = scpbol * scospeed
scncel = scpcel * scospeed
scnclear = scpclear * scospeed
scndlc = scpdlc * scospeed
scndll = scpdll * scospeed
scndown = scpdown * scospeed
scninc = scpinc * scospeed
scninl = scpinl * scospeed
scnsdown = scpsdown * scospeed
scnsup = scpsup * scospeed
scntab = scptab * scospeed
# decode attribute groups
call scasu
# set current and desired attributes off
for ( i = 1 ; i <= MAX_ATTRIBUTES ; i = i + 1 )
{
curatt ( i ) = .false.
desatt ( i ) = .false.
}
# # Pillow mode starts out off.
# pillmode = .false.
# assume we're not debugging things
debug = .false.
# Initialize the raw I/O package.
call ioinit
# No Characters in input buffer
inbufp = 0
return
end
### scsu - internal routine to process termcap entry
#
# SYNOPSIS
# call scsu ( name, rest )
#
# DESCRIPTION
# Process termcap entry with name 'name' and argument 'rest'.
#
# PASSED
# name - name of termcap entry
# rest - rest of termcap entry
#
# COMMENT
# Yes, this is one mother of a subroutine.
#
subroutine scsu ( name, rest )
NOIMPLICIT
character name ( ARB )
character rest ( ARB )
integer equal, sccapn
logical done, sccapb
real sccapr
character sccapc
include "sclb.c"
include "sclb.ic"
done = .true. # assume done
if ( equal ( name, "att=" ) )
call sccapa ( rest )
else if ( equal ( name, "autonl" ) == YES )
scautonl = sccapb ( rest )
else if ( equal ( name, "beep=" ) == YES )
call sccaps ( rest, seqbeep, sccbeep )
else if ( equal ( name, "bol=" ) == YES )
call sccaps ( rest, seqbol, sccbol )
else if ( equal ( name, "bs" ) == YES )
scbs = sccapb ( rest )
else if ( equal ( name, "cel=" ) == YES )
call sccaps ( rest, seqcel, scccel )
else if ( equal ( name, "chscroll=" ) == YES )
call sccaps ( rest, seqchscroll, sccchscroll )
else if ( equal ( name, "clear=" ) == YES )
call sccaps ( rest, seqclear, sccclear )
else if ( equal ( name, "cols#" ) == YES )
scpcols = sccapn ( rest )
# else if ( equal ( name, "depill=" ) == YES )
# call sccaps ( rest, seqdepill, sccdepill )
else if ( equal ( name, "dlc=" ) == YES )
call sccaps ( rest, seqdlc, sccdlc )
else if ( equal ( name, "dll=" ) == YES )
call sccaps ( rest, seqdll, sccdll )
else if ( equal ( name, "down=" ) == YES )
call sccaps ( rest, seqdown, sccdown )
# else if ( equal ( name, "enpill=" ) == YES )
# call sccaps ( rest, seqenpill, sccenpill )
else if ( equal ( name, "f0=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F0 ), scckey ( KEYPAD_F0 ) )
else if ( equal ( name, "f1=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F1 ), scckey ( KEYPAD_F1 ) )
else if ( equal ( name, "f2=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F2 ), scckey ( KEYPAD_F2 ) )
else if ( equal ( name, "f3=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F3 ), scckey ( KEYPAD_F3 ) )
else if ( equal ( name, "f4=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F4 ), scckey ( KEYPAD_F4 ) )
else if ( equal ( name, "f5=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F5 ), scckey ( KEYPAD_F5 ) )
else if ( equal ( name, "f6=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F6 ), scckey ( KEYPAD_F6 ) )
else if ( equal ( name, "f7=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F7 ), scckey ( KEYPAD_F7 ) )
else if ( equal ( name, "f8=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F8 ), scckey ( KEYPAD_F8 ) )
else if ( equal ( name, "f9=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_F9 ), scckey ( KEYPAD_F9 ) )
else if ( equal ( name, "hardcopy" ) == YES )
schardcopy = sccapb ( rest )
else
done = .false.
if ( done )
return
if ( equal ( name, "home=" ) == YES )
call sccaps ( rest, seqhome, scchome )
else if ( equal ( name, "iim=" ) == YES )
call sccaps ( rest, seqiim, scciim )
else if ( equal ( name, "ikey=" ) == YES )
call sccaps ( rest, seqikey, sccikey )
else if ( equal ( name, "inc=" ) == YES )
call sccaps ( rest, seqinc, sccinc )
else if ( equal ( name, "init=" ) == YES )
call sccaps ( rest, seqinit, sccinit )
else if ( equal ( name, "inl=" ) == YES )
call sccaps ( rest, seqinl, sccinl )
else if ( equal ( name, "k0=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_0 ), scckey ( KEYPAD_0 ) )
else if ( equal ( name, "k1=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_1 ), scckey ( KEYPAD_1 ) )
else if ( equal ( name, "k2=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_2 ), scckey ( KEYPAD_2 ) )
else if ( equal ( name, "k3=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_3 ), scckey ( KEYPAD_3 ) )
else if ( equal ( name, "k4=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_4 ), scckey ( KEYPAD_4 ) )
else if ( equal ( name, "k5=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_5 ), scckey ( KEYPAD_5 ) )
else if ( equal ( name, "k6=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_6 ), scckey ( KEYPAD_6 ) )
else if ( equal ( name, "k7=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_7 ), scckey ( KEYPAD_7 ) )
else if ( equal ( name, "k8=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_8), scckey ( KEYPAD_8 ) )
else if ( equal ( name, "k9=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_9 ), scckey ( KEYPAD_9 ) )
else if ( equal ( name, "kcomma=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_COMMA ), scckey (KEYPAD_COMMA) )
else if ( equal ( name, "kdown=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_DOWN ), scckey (KEYPAD_DOWN) )
else if ( equal ( name, "kenter=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_ENTER ), scckey (KEYPAD_ENTER) )
else if ( equal ( name, "kleft=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_LEFT ), scckey (KEYPAD_LEFT) )
else if ( equal ( name, "kminus=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_MINUS ), scckey (KEYPAD_MINUS) )
else if ( equal ( name, "kperiod=" ) == YES )
call sccaps ( rest, seqkey (1, KEYPAD_PERIOD), scckey (KEYPAD_PERIOD) )
else if ( equal ( name, "kright=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_RIGHT ), scckey (KEYPAD_RIGHT) )
else if ( equal ( name, "kup=" ) == YES )
call sccaps ( rest, seqkey ( 1, KEYPAD_UP ), scckey (KEYPAD_UP) )
else if ( equal ( name, "left=" ) == YES )
call sccaps ( rest, seqleft, sccleft )
else
done = .false.
if ( done )
return
if ( equal ( name, "lins#" ) == YES )
scplins = sccapn ( rest )
else if ( equal ( name, "lsegd=" ) == YES )
call sccapg ( rest, LSEG_D )
else if ( equal ( name, "lsegl=" ) == YES )
call sccapg ( rest, LSEG_L )
else if ( equal ( name, "lsegld=" ) == YES )
call sccapg ( rest, LSEG_LD )
else if ( equal ( name, "lsegu=" ) == YES )
call sccapg ( rest, LSEG_U )
else if ( equal ( name, "lsegud=" ) == YES )
call sccapg ( rest, LSEG_UD )
else if ( equal ( name, "lsegul=" ) == YES )
call sccapg ( rest, LSEG_UL )
else if ( equal ( name, "lseguld=" ) == YES )
call sccapg ( rest, LSEG_ULD )
else if ( equal ( name, "lsegr=" ) == YES )
call sccapg ( rest, LSEG_R )
else if ( equal ( name, "lsegrd=" ) == YES )
call sccapg ( rest, LSEG_RD )
else if ( equal ( name, "lsegrl=" ) == YES )
call sccapg ( rest, LSEG_RL )
else if ( equal ( name, "lsegrld=" ) == YES )
call sccapg ( rest, LSEG_RLD )
else if ( equal ( name, "lsegru=" ) == YES )
call sccapg ( rest, LSEG_RU )
else if ( equal ( name, "lsegrud=" ) == YES )
call sccapg ( rest, LSEG_RUD )
else if ( equal ( name, "lsegrul=" ) == YES )
call sccapg ( rest, LSEG_RUL )
else if ( equal ( name, "lsegruld=" ) == YES )
call sccapg ( rest, LSEG_RULD )
else if ( equal ( name, "lshigh" ) == YES )
sclshigh = sccapb ( rest )
else if ( equal ( name, "move=" ) == YES )
call sccaps ( rest, seqmove, sccmove )
else if ( equal ( name, "noautonl" ) == YES )
scnoautonl = sccapb ( rest )
# else if ( equal ( name, "noblclear" ) == YES )
# scblclear = ! sccapb ( rest )
else if ( equal ( name, "notilde" ) == YES )
scnotilde = sccapb ( rest )
else if ( equal ( name, "oim=" ) == YES )
call sccaps ( rest, seqoim, sccoim )
else if ( equal ( name, "okey=" ) == YES )
call sccaps ( rest, seqokey, sccokey )
else if ( equal ( name, "overstrike" ) == YES )
scoverstrike = sccapb ( rest )
else if ( equal ( name, "padc=" ) == YES )
scpadc = sccapc ( rest )
else
done = .false.
if ( done )
return
if ( equal ( name, "pbeep#" ) == YES )
scpbeep = sccapr ( rest )
else if ( equal ( name, "pbol#" ) == YES )
scpbol = sccapr ( rest )
else if ( equal ( name, "pcel#" ) == YES )
scpcel = sccapr ( rest )
else if ( equal ( name, "pclear#" ) == YES )
scpclear = sccapr ( rest )
else if ( equal ( name, "pdlc#" ) == YES )
scpdlc = sccapr ( rest )
else if ( equal ( name, "pdll#" ) == YES )
scpdll = sccapr ( rest )
else if ( equal ( name, "pdown#" ) == YES )
scpdown = sccapr ( rest )
else if ( equal ( name, "pillow=" ) == YES )
call sccapg ( rest, GRAPHICS_PILLOW )
else if ( equal ( name, "pinc#" ) == YES )
scpinc = sccapr ( rest )
else if ( equal ( name, "pinl#" ) == YES )
scpinl = sccapr ( rest )
else if ( equal ( name, "psdown#" ) == YES )
scpsdown = sccapr ( rest )
else if ( equal ( name, "psup#" ) == YES )
scpsup = sccapr ( rest )
else if ( equal ( name, "ptab#" ) == YES )
scptab = sccapr ( rest )
else if ( equal ( name, "right=" ) == YES )
call sccaps ( rest, seqright, sccright )
else if ( equal ( name, "sdown=" ) == YES )
call sccaps ( rest, seqsdown, sccsdown )
else if ( equal ( name, "sup=" ) == YES )
call sccaps ( rest, seqsup, sccsup )
else if ( equal ( name, "tab=" ) == YES )
call sccaps ( rest, seqtab, scctab )
# else if ( equal ( name, "tabs=" ) == YES )
# call sccapt ( rest )
else if ( equal ( name, "up=" ) == YES )
call sccaps ( rest, sequp, sccup )
else if ( equal ( name, "visdel" ) == YES )
scvisdel = sccapb ( rest )
else if ( equal ( name, "wrtop" ) == YES )
scwrtop = sccapb ( rest )
else if ( equal ( name, "xonoff" ) == YES )
scxonoff = sccapb ( rest )
# If we didn't reconize it, ignore it.
return
end
### sctermcap - internal routine to return the pathname of the termcap file
#
# SYNOPSIS
# call sctermcap ( file )
#
# RETURNED
# file - name of termcap
#
subroutine sctermcap ( file )
NOIMPLICIT
character file(ARB)
call scopy ( "+LIB/termcap", 1, file, 1 )
return
end
### scnxtent - internal routine to get next argument of termcap entry
#
# SYNOPSIS
# status = scnxtent ( i, name, rest )
#
# DESCRIPTION
# scnxtent gets the next termcap entry and puts the name of the entry
# in 'name' and the rest (usually an escape sequence) in 'rest'
#
# PASSED
# i - the last entry that was gotten (initially should be '2')
#
# RETURNED
# name - the name of the next termcap entry
# rest - the rest of the termcap entry
# status - OK if there was another termcap entry, ERR otherwise
integer function scnxtent ( i, name, rest )
NOIMPLICIT
integer i
character name ( MAXLINE )
character rest ( MAXLINE )
integer enfldn
character temp ( MAXLINE )
character type
integer n
# advance pointer
i = i + 1
# try to get field 'i'
scnxtent = enfldn ( i, temp, MAXLINE )
if ( scnxtent == OK )
{
# split into 'name' and 'rest'
# name is of form [a-zA-Z0-9]*[[#:]]
n = 1
while ( type ( temp ( n ) ) == LETTER |
type ( temp ( n ) ) == DIGIT )
call chcopy ( temp ( n ), name, n )
if ( temp ( n ) == '#' | temp ( n ) == '=' )
call chcopy ( temp ( n ), name, n )
name ( n ) = EOS # in case it is null string
# put rest of string in 'rest'
call scopy ( temp, n, rest, 1 )
}
return
end
### sccapa - internal routine to add attribute description
#
# SYNOPSIS
# call sccapa ( rest )
#
# DESCRIPTION
# Adds attribute specification to the list of attribute sequences.
# The format of 'rest', the argument to the "att=" command should be
# ([+|-]{h|u|r|b|g|a})*=seq
# (where h, u, r, b, g, and a are the currently recognized attributes)
#
# PASSED
# rest - the argument to the "att=" command
subroutine sccapa ( rest )
NOIMPLICIT
character rest ( ARB )
integer i
integer action
integer index
integer n
include "sclb.c"
include "sclb.ic"
string atts ATTRIBUTE_STRING
scnatt = scnatt + 1
for ( i = 1 ; i <= MAX_ATTRIBUTES ; i = i + 1 )
scattact ( i, scnatt ) = ATTRIBUTE_UNCHANGED
for ( i = 1 ; rest ( i ) != '=' & rest ( i ) != EOS ; i = i + 1 )
{
if ( rest ( i ) == '-' )
{
action = ATTRIBUTE_OFF
i = i + 1
}
else if ( rest ( i ) == '+' )
{
action = ATTRIBUTE_ON
i = i + 1
}
else
{
# assume they want to turn the attribute on
action = ATTRIBUTE_ON
}
# add action (if legal)
n = index ( atts, rest ( i ) )
if ( 0 < n & n <= MAX_ATTRIBUTES )
scattact ( n, scnatt ) = action
}
if ( rest ( i ) != EOS )
i = i + 1
# copy control sequence to seqatt
call scopy ( rest, i, seqatt ( 1, scnatt ), 1 )
return
end
### sccapb - internal routine to get a boolean field from the termcap entry
#
# SYNOPSIS
# logical fieldpresent, sccapb
# character rest()
# fieldpresent = sccapb ( rest )
#
# DESCRIPTION
# Interprets the argument to a termcap command as a boolean quantity.
# Returns .true. if the boolean quantity is set, .false. otherwise.
#
# The entry is set if and only if rest is the null string.
#
# PASSED
# rest - the argument to the termcap command
#
# RETURNED
# fieldpresent - whether the entry is set or not
logical function sccapb ( rest )
NOIMPLICIT
character rest ( ARB )
integer length
sccapb = ( length ( rest ) == 0 )
return
end
### sccapc - internal routine to get a character from the termcap entry
#
# SYNOPSIS
# character char, sccapc
# char = sccapc ( rest )
#
# DESCRIPTION
# Interprets the argument to a termcap command as a character.
#
# PASSED
# rest - the argument to the termcap command
#
# RETURNED
# char - the character corresponding to rest
character function sccapc ( rest )
NOIMPLICIT
character rest ( ARB )
sccapc = rest ( 1 )
return
end
### sccapg - internal routine to decode attribute list string combination
#
# call sccapg ( rest, n )
#
# description
# decodes the string 'rest' as an attribute list followed by a command
# sequence, and sets graphics character 'n' to this combination
#
# passed
# rest - of the form ({h|u|r|b|g|a}*)seq
# n - the number of the graphics character
subroutine sccapg ( rest, n )
NOIMPLICIT
character rest ( ARB )
integer n
character resta ( MAXLINE )
character rests ( MAXLINE )
integer i
integer j
include "sclb.c"
include "sclb.ic"
if ( rest ( 1 ) == '(' )
{
j = 1
for ( i = 2 ; rest ( i ) != ')' & rest ( i ) != EOS ; i = i + 1 )
call chcopy ( rest ( i ), resta, j )
resta ( j ) = EOS
if ( rest ( i ) == ')' )
i = i + 1
call scopy ( rest, i, rests, 1 )
}
else
{
resta ( 1 ) = EOS
call scopy ( rest, 1, rests, 1 )
}
call sccapl ( resta, satgraphics ( 1, n ) )
call sccaps ( rests, seqgraphics ( 1, n ), sccgraphics ( n ) )
return
end
### sccapl - internal routine to decode attribute list
#
# SYNOPSIS
# call sccapl ( rest, att )
#
# DESCRIPTION
# Looks at the attributes listed in 'rest' and sets the corresponding
# entries in the logical array 'att' to .true. (and the rest to .false.)
#
# PASSED
# rest - a list of attributes (i.e. {h|u|r|b|g|a}*)
#
# RETURNED
# att - each element .true. if and only if it is list 'rest'
subroutine sccapl ( rest, att )
NOIMPLICIT
character rest ( ARB )
logical att ( MAX_ATTRIBUTES )
integer i
integer index
integer n
string atts ATTRIBUTE_STRING
for ( n = 1 ; n <= MAX_ATTRIBUTES ; n = n + 1 )
att ( n ) = .false.
for ( i = 1 ; rest ( i ) != EOS ; i = i + 1 )
{
n = index ( atts, rest ( i ) )
# if legal, add it
if ( 0 < n & n <= MAX_ATTRIBUTES )
att ( n ) = .true.
}
return
end
### sccapn - internal routine to get a numeric field from the termcap entry
#
# SYNOPSIS
# integer num, sccapn
# character rest()
# num = sccapn ( rest )
#
# DESCRIPTION
# Returns the value of the numeric string 'rest', which is normally
# the argument to a termcap command (i.e., line width or page length)
#
# The null string is assigned a value of '0'
#
# PASSED
# rest - the argument to a termcap command
#
# RETURNED
# num - the number specified by 'rest'
integer function sccapn ( rest )
NOIMPLICIT
character rest(ARB)
integer ctoi
integer i
i = 1
sccapn = ctoi ( rest, i )
return
end
### sccapr - internal routine to get a real numeric field from termcap entry
#
# SYNOPSIS
# real num, sccapr
# character rest()
# num = sccapr ( rest )
#
# DESCRIPTION
# Returns the value of the numeric string 'rest', which is normally
# the argument to a termcap command (i.e., line width or page length)
#
# The null string is assigned a value of '0.0'
#
# PASSED
# rest - the argument to a termcap command
#
# RETURNED
# num - the number specified by 'rest'
real function sccapr ( rest )
NOIMPLICIT
character rest(ARB)
real ctor
integer i
i = 1
sccapr = ctor ( rest, i )
return
end
### sccaps - internal routine to get a string field from the termcap entry