File: kfor.h

package info (click to toggle)
mn-fit 5.13-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,148 kB
  • ctags: 3,571
  • sloc: ansic: 9,357; sh: 957; makefile: 831; pascal: 666; cpp: 578; fortran: 33
file content (1421 lines) | stat: -rw-r--r-- 46,471 bytes parent folder | download | duplicates (3)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
/*
 * $Id: kfor.h,v 1.1.1.1 2004/02/17 14:24:51 brock Exp $
 *
 * $Log: kfor.h,v $
 * Revision 1.1.1.1  2004/02/17 14:24:51  brock
 * Mn_Fit in CVS
 *
 * Revision 1.1  2004/02/16 15:35:09  brock
 * CERNLIB include files that Mn_Fit needs.
 *
 * Revision 1.4  1998/12/17 14:20:22  couet
 * - new routine kxdsig to delete the temporary vectors created
 *  by $SIGMA. On NT a direct call to kuvdel didn't work
 *
 * Revision 1.3  1997/09/02 14:49:59  mclareni
 * WINNT corrections
 *
 * Revision 1.2  1997/03/14 17:16:37  mclareni
 * WNT mods
 *
 * Revision 1.1.1.1.2.1  1997/01/21 11:33:02  mclareni
 * All mods for Winnt 96a on winnt branch
 *
 * Revision 1.1.1.1  1996/03/08 15:33:00  mclareni
 * Kuip
 *
 */
/* kfor.h: Fortran-C interface */

/*
 * Fortran data types
 */
typedef  int      INTEGER;
typedef  int      LOGICAL;
typedef  float    REAL;
typedef  double   DBLPREC;
typedef  struct { REAL re; REAL im; } COMPLEX;

typedef  INTEGER        INT_FUNCTION();
typedef  INT_FUNCTION  *INT_FUNCPTR;

#if defined(CERNLIB_WINNT) || defined(WIN32)
#  ifdef CERNLIB_MSSTDCALL
#   ifndef F77_EXTERN_UPPERCASE 
#     define F77_EXTERN_UPPERCASE
#   endif
#   define  type_of_call _stdcall
#  endif
#endif
 
#ifndef type_of_call
#define type_of_call
#endif

typedef  void         (*SUBRPTR)();
typedef  void   type_of_call      SUBROUTINE();

#ifdef   IBM370
#pragma  linkage(SUBROUTINE,FORTRAN)
#pragma  linkage(INT_FUNCTION,FORTRAN)

#pragma  map(__CTOF,"@@CTOF")
extern INTEGER __CTOF( INT_FUNCPTR, ... );
#endif

typedef union _EQUIV_INT_REAL {
  INTEGER i;
  LOGICAL l;
  REAL    r;
} EQUIV_INT_REAL;


/*
 * Mapping of C-routine name for Fortran CALL SUB
 *
 *   #define F77_EXTERN_LOWERCASE   ==>  void sub()
 *   #define F77_EXTERN_UPPERCASE   ==>  void SUB()
 *           otherwise              ==>  void sub_()
 */
#ifdef   F77_EXTERN_UPPERCASE
#  define  F77_NAME(name,NAME) NAME
#else
#  ifdef   F77_EXTERN_LOWERCASE
#    define  F77_NAME(name,NAME) name
#  else
#    define  F77_NAME(name,NAME) ConCat(name,_)
#  endif
#endif

#ifndef  F77_BLOCK
#  define  F77_BLOCK(name,NAME) F77_NAME(name,NAME)
#endif

#ifndef  F77_COMMON
#  define  F77_COMMON(name) name
#endif


/*
 * Routine address in CALL SUB(FUN) ; EXTERNAL FUN
 *
 *   #define F77_EXTERN_INDIRECT    ==>  void (**fun)();
 *           otherwise              ==>  void (*fun)();
 */
#ifdef F77_EXTERN_INDIRECT
#  define F77_EXTERN_ARG(e) ConCat(e,_ptr)
#  define F77_EXTERN_DCL(e) SUBROUTINE **ConCat(e,_ptr);
#  define F77_EXTERN_DEF(e) SUBROUTINE *e = *ConCat(e,_ptr);
#else
#  define F77_EXTERN_ARG(e) e
#  define F77_EXTERN_DCL(e) SUBROUTINE *e;
#  define F77_EXTERN_DEF(e)
#endif

#define F77_EXTERN2ARG(e1,e2) F77_EXTERN_ARG(e1),F77_EXTERN_ARG(e2)
#define F77_EXTERN2DCL(e1,e2) F77_EXTERN_DCL(e1) F77_EXTERN_DCL(e2)
#define F77_EXTERN2DEF(e1,e2) F77_EXTERN_DEF(e1) F77_EXTERN_DEF(e2)

#define F77_EXTERN3ARG(e1,e2,e3) F77_EXTERN_ARG(e1),F77_EXTERN2ARG(e2,e3)
#define F77_EXTERN3DCL(e1,e2,e3) F77_EXTERN_DCL(e1) F77_EXTERN2DCL(e2,e3)
#define F77_EXTERN3DEF(e1,e2,e3) F77_EXTERN_DEF(e1) F77_EXTERN2DEF(e2,e3)

#define F77_EXTERN4ARG(e1,e2,e3,e4) F77_EXTERN_ARG(e1),F77_EXTERN3ARG(e2,e3,e4)
#define F77_EXTERN4DCL(e1,e2,e3,e4) F77_EXTERN_DCL(e1) F77_EXTERN3DCL(e2,e3,e4)
#define F77_EXTERN4DEF(e1,e2,e3,e4) F77_EXTERN_DEF(e1) F77_EXTERN3DEF(e2,e3,e4)


#ifdef F77_ARG_CONSTANT

/*
 * If the Fortran compiler (e.g. VSFORTRAN and Convex fc without -sa option)
 * uses constant argument blocks we have to make a private copy in case the
 * routine uses the arguments as local variables.
 */

#  define F77_XXXX_ARG_PTR(t,x) ConCat(x,_ptr)
#  define F77_XXXX_ARG_DCL(t,x) t *ConCat(x,_ptr);
#  define F77_XXXX_ARG_DEF(t,x) t *x = ConCat(x,_ptr);

#else

#  define F77_XXXX_ARG_PTR(t,x) x
#  define F77_XXXX_ARG_DCL(t,x) t *x;
#  define F77_XXXX_ARG_DEF(t,x)

#endif

#define F77_REAL_ARG_PTR(r) F77_XXXX_ARG_PTR(REAL,r)
#define F77_REAL_ARG_DCL(r) F77_XXXX_ARG_DCL(REAL,r)
#define F77_REAL_ARG_DEF(r) F77_XXXX_ARG_DEF(REAL,r)

#define F77_INTG_ARG_PTR(i) F77_XXXX_ARG_PTR(INTEGER,i)
#define F77_INTG_ARG_DCL(i) F77_XXXX_ARG_DCL(INTEGER,i)
#define F77_INTG_ARG_DEF(i) F77_XXXX_ARG_DEF(INTEGER,i)

#define F77_INTG_ARG2PTR(i1,i2) F77_INTG_ARG_PTR(i1),F77_INTG_ARG_PTR(i2)
#define F77_INTG_ARG2DCL(i1,i2) F77_INTG_ARG_DCL(i1) F77_INTG_ARG_DCL(i2)
#define F77_INTG_ARG2DEF(i1,i2) F77_INTG_ARG_DEF(i1) F77_INTG_ARG_DEF(i2)

#define F77_INTG_ARG3PTR(i1,i2,i3) F77_INTG_ARG_PTR(i1),F77_INTG_ARG2PTR(i2,i3)
#define F77_INTG_ARG3DCL(i1,i2,i3) F77_INTG_ARG_DCL(i1) F77_INTG_ARG2DCL(i2,i3)
#define F77_INTG_ARG3DEF(i1,i2,i3) F77_INTG_ARG_DEF(i1) F77_INTG_ARG2DEF(i2,i3)

#define F77_INTG_ARG4PTR(i1,i2,i3,i4) F77_INTG_ARG_PTR(i1), \
                                      F77_INTG_ARG3PTR(i2,i3,i4)
#define F77_INTG_ARG4DCL(i1,i2,i3,i4) F77_INTG_ARG_DCL(i1) \
                                      F77_INTG_ARG3DCL(i2,i3,i4)
#define F77_INTG_ARG4DEF(i1,i2,i3,i4) F77_INTG_ARG_DEF(i1) \
                                      F77_INTG_ARG3DEF(i2,i3,i4)


/*
 * Access to Fortran CHARACTER arguments
 */

#ifdef vms                      /* VMS string descriptors */


#  define F77_CHAR_ARG_PTR(s) ConCat(s,_ptr)
#  define F77_CHAR_ARG_LEN(s)
#  define F77_CHAR_ARG_DCL(s) struct dsc$descriptor_s *ConCat(s,_ptr);
#  define F77_CHAR_ARG_DEF(s) char *s = ConCat(s,_ptr)->dsc$a_pointer; \
                   int ConCat(len_,s) = ConCat(s,_ptr)->dsc$w_length;

#  define F77_CHAR_DEF_DSC(s,p,l) struct dsc$descriptor_s ConCat(s,_dsc);
#  define F77_CHAR_ASS_DSC(s,p,l) ConCat(s,_dsc).dsc$w_length = l; \
                                  ConCat(s,_dsc).dsc$b_dtype = DSC$K_DTYPE_T;\
                                  ConCat(s,_dsc).dsc$b_class = DSC$K_CLASS_S;\
                                  ConCat(s,_dsc).dsc$a_pointer = (char*)p;
#  define F77_CHAR_USE_PTR(s,p,l) &ConCat(s,_dsc)
#  define F77_CHAR_USE_LEN(s,p,l)


#else
#ifdef CRAY                     /* Cray string descriptors */


#  define F77_CHAR_ARG_PTR(s) ConCat(s,_ptr)
#  define F77_CHAR_ARG_LEN(s)
#  define F77_CHAR_ARG_DCL(s) _fcd ConCat(s,_ptr);
#  define F77_CHAR_ARG_DEF(s) char *s = _fcdtocp(ConCat(s,_ptr)); \
                   int ConCat(len_,s) = _fcdlen(ConCat(s,_ptr));

#  define F77_CHAR_DEF_DSC(s,p,l)
#  define F77_CHAR_ASS_DSC(s,p,l)
#  define F77_CHAR_USE_PTR(s,p,l) _cptofcd(p,l)
#  define F77_CHAR_USE_LEN(s,p,l)


#else                           /* length passed as additional argument */


# ifdef F77_CHAR_LEN_IND        /* length passed by reference */
#  define F77_CHAR_LEN_STAR(len) *len
# else
#  define F77_CHAR_LEN_STAR(len)  len
# endif

# ifndef F77_CHAR_LEN_TYPE
#  define F77_CHAR_LEN_TYPE int
# endif


# ifdef F77_ARG_CONSTANT

#  define F77_CHAR_ARG_PTR(s) ConCat(s,_ptr)
#  define F77_CHAR_ARG_LEN(s) , ConCat(s,_len)
#  define F77_CHAR_ARG_DCL(s) char *ConCat(s,_ptr); \
          F77_CHAR_LEN_TYPE F77_CHAR_LEN_STAR(ConCat(s,_len));
#  define F77_CHAR_ARG_DEF(s) char *s = ConCat(s,_ptr); \
       int ConCat(len_,s) = F77_CHAR_LEN_STAR(ConCat(s,_len));

# else
# ifdef F77_CHAR_LEN_IND

#  define F77_CHAR_ARG_PTR(s) s
#  define F77_CHAR_ARG_LEN(s) , ConCat(s,_len)
#  define F77_CHAR_ARG_DCL(s) char *s; \
          F77_CHAR_LEN_TYPE F77_CHAR_LEN_STAR(ConCat(s,_len));
#  define F77_CHAR_ARG_DEF(s) \
       int ConCat(len_,s) = F77_CHAR_LEN_STAR(ConCat(s,_len));

# else

#  ifdef CERNLIB_MSSTDCALL
#    define F77_CHAR_ARG_PTR(s) s, ConCat(len_,s)
#    define F77_CHAR_ARG_LEN(s)
#  else
#    define F77_CHAR_ARG_PTR(s) s
#    define F77_CHAR_ARG_LEN(s) , ConCat(len_,s)
#  endif

#  define F77_CHAR_ARG_DCL(s) char *s; int ConCat(len_,s);
#  define F77_CHAR_ARG_DEF(s)

# endif
# endif


# if defined(F77_CHAR_LEN_IND)

#  define F77_CHAR_DEF_DSC(s,p,l) F77_CHAR_LEN_TYPE ConCat(s,_dsc) = l;
#  define F77_CHAR_ASS_DSC(s,p,l)
#  define F77_CHAR_USE_PTR(s,p,l) p
#  define F77_CHAR_USE_LEN(s,p,l) , &ConCat(s,_dsc)

# else

#  define F77_CHAR_DEF_DSC(s,p,l)
#  define F77_CHAR_ASS_DSC(s,p,l)

#   ifndef CERNLIB_MSSTDCALL
#     define F77_CHAR_USE_PTR(s,p,l) p
#     define F77_CHAR_USE_LEN(s,p,l) , l
#   else
#     define F77_CHAR_USE_PTR(s,p,l) p, l
#     define F77_CHAR_USE_LEN(s,p,l)
#   endif
 

# endif

#endif
#endif


#ifndef F77_XXXX_ARG_LEN   /* length argument of non-CHARACTER arguments */

#  define F77_XXXX_ARG_LEN(x)   /* nil */
#  define F77_XXXX_USE_LEN(x)   /* nil */

#endif


#define F77_CHAR_ARG2PTR(c1,c2) \
        F77_CHAR_ARG_PTR(c1),F77_CHAR_ARG_PTR(c2)
#define F77_CHAR_ARG2LEN(c1,c2) \
        F77_CHAR_ARG_LEN(c1) F77_CHAR_ARG_LEN(c2)
#define F77_XXXX_ARG2LEN(c1,c2) \
        F77_XXXX_ARG_LEN(c1) F77_XXXX_ARG_LEN(c2)
#define F77_CHAR_ARG2DCL(c1,c2) \
        F77_CHAR_ARG_DCL(c1) F77_CHAR_ARG_DCL(c2)
#define F77_CHAR_ARG2DEF(c1,c2) \
        F77_CHAR_ARG_DEF(c1) F77_CHAR_ARG_DEF(c2)

#define F77_CHAR_ARG3PTR(c1,c2,c3) \
        F77_CHAR_ARG2PTR(c1,c2),F77_CHAR_ARG_PTR(c3)
#define F77_CHAR_ARG3LEN(c1,c2,c3) \
        F77_CHAR_ARG2LEN(c1,c2) F77_CHAR_ARG_LEN(c3)
#define F77_XXXX_ARG3LEN(c1,c2,c3) \
        F77_XXXX_ARG2LEN(c1,c2) F77_XXXX_ARG_LEN(c3)
#define F77_CHAR_ARG3DCL(c1,c2,c3) \
        F77_CHAR_ARG2DCL(c1,c2) F77_CHAR_ARG_DCL(c3)
#define F77_CHAR_ARG3DEF(c1,c2,c3) \
        F77_CHAR_ARG2DEF(c1,c2) F77_CHAR_ARG_DEF(c3)

#define F77_CHAR_ARG4PTR(c1,c2,c3,c4) \
        F77_CHAR_ARG3PTR(c1,c2,c3),F77_CHAR_ARG_PTR(c4)
#define F77_CHAR_ARG4LEN(c1,c2,c3,c4) \
        F77_CHAR_ARG3LEN(c1,c2,c3) F77_CHAR_ARG_LEN(c4)
#define F77_XXXX_ARG4LEN(c1,c2,c3,c4) \
        F77_XXXX_ARG3LEN(c1,c2,c3) F77_XXXX_ARG_LEN(c4)
#define F77_CHAR_ARG4DCL(c1,c2,c3,c4) \
        F77_CHAR_ARG3DCL(c1,c2,c3) F77_CHAR_ARG_DCL(c4)
#define F77_CHAR_ARG4DEF(c1,c2,c3,c4) \
        F77_CHAR_ARG3DEF(c1,c2,c3) F77_CHAR_ARG_DEF(c4)

#define F77_CHAR_ARG5PTR(c1,c2,c3,c4,c5) \
        F77_CHAR_ARG4PTR(c1,c2,c3,c4),F77_CHAR_ARG_PTR(c5)
#define F77_CHAR_ARG5LEN(c1,c2,c3,c4,c5) \
        F77_CHAR_ARG4LEN(c1,c2,c3,c4) F77_CHAR_ARG_LEN(c5)
#define F77_CHAR_ARG5DCL(c1,c2,c3,c4,c5) \
        F77_CHAR_ARG4DCL(c1,c2,c3,c4) F77_CHAR_ARG_DCL(c5)
#define F77_CHAR_ARG5DEF(c1,c2,c3,c4,c5) \
        F77_CHAR_ARG4DEF(c1,c2,c3,c4) F77_CHAR_ARG_DEF(c5)


/*
 * Fortran-calls-C interface
 *
 * To define a C function called by Fortran CALL SUB(A,B,C):
 *
 *   #define Sub  F77_NAME(sub,SUB)
 *   #pragma linkage(SUB,FORTRAN)   // for IBM C/370 compiler
 *
 *   F77_ENTRY_xyz(Sub,a,b,c)       // opening { contained in macro
 *   // body ...
 *   }
 *
 * Each character in xyz declares the type of the corresponding parameter:
 *
 *   C = CHARACTER
 *   E = EXTERNAL
 *   I = INTEGER
 *   R = REAL
 *
 * If a parameter PAR is declared as CHARACTER the macro defines:
 *
 *   char *PAR;     // pointer to string (not terminated by \0 !!!)
 *   int len_PAR;   // length of string as defined by Fortran's LEN(PAR)
 *
 * The names PAR_dsc and PAR_ptr are reserved for internal use.
 *
 * Note: The function body follows the F77_ENTRY_... macro call directly.
 *       The opening { is generated by the macro.
 */

#define F77_ENTRY(name) \
  type_of_call \
  name() {

#define F77_ENTRY_C(name,c1) \
  type_of_call \
  name( F77_CHAR_ARG_PTR(c1) F77_CHAR_ARG_LEN(c1) ) \
        F77_CHAR_ARG_DCL(c1) \
      { F77_CHAR_ARG_DEF(c1)


#define F77_ENTRY_CC(name,c1,c2) \
  type_of_call \
  name( F77_CHAR_ARG2PTR(c1,c2) F77_CHAR_ARG2LEN(c1,c2) ) \
        F77_CHAR_ARG2DCL(c1,c2) \
      { F77_CHAR_ARG2DEF(c1,c2)


#define F77_ENTRY_C3(name,c1,c2,c3) \
  type_of_call \
  name( F77_CHAR_ARG3PTR(c1,c2,c3) \
        F77_CHAR_ARG3LEN(c1,c2,c3) ) \
        F77_CHAR_ARG3DCL(c1,c2,c3) \
      { F77_CHAR_ARG3DEF(c1,c2,c3)


#define F77_ENTRY_C5(name,c1,c2,c3,c4,c5) \
  type_of_call \
  name( F77_CHAR_ARG5PTR(c1,c2,c3,c4,c5) \
        F77_CHAR_ARG5LEN(c1,c2,c3,c4,c5) ) \
        F77_CHAR_ARG5DCL(c1,c2,c3,c4,c5) \
      { F77_CHAR_ARG5DEF(c1,c2,c3,c4,c5)


#define F77_ENTRY_C4E(name,c1,c2,c3,c4,e5) \
  type_of_call \
  name( F77_CHAR_ARG4PTR(c1,c2,c3,c4),F77_EXTERN_ARG(e5) \
        F77_CHAR_ARG4LEN(c1,c2,c3,c4) ) \
        F77_CHAR_ARG4DCL(c1,c2,c3,c4) F77_EXTERN_DCL(e5) \
      { F77_CHAR_ARG4DEF(c1,c2,c3,c4) F77_EXTERN_DEF(e5)


#define F77_ENTRY_C4I(name,c1,c2,c3,c4,i5) \
  type_of_call \
  name( F77_CHAR_ARG4PTR(c1,c2,c3,c4),F77_INTG_ARG_PTR(i5) \
        F77_CHAR_ARG4LEN(c1,c2,c3,c4) ) \
        F77_CHAR_ARG4DCL(c1,c2,c3,c4) F77_INTG_ARG_DCL(i5) \
      { F77_CHAR_ARG4DEF(c1,c2,c3,c4) F77_INTG_ARG_DEF(i5)


#define F77_ENTRY_C5E(name,c1,c2,c3,c4,c5,e6) \
  type_of_call \
  name( F77_CHAR_ARG5PTR(c1,c2,c3,c4,c5),F77_EXTERN_ARG(e6) \
        F77_CHAR_ARG5LEN(c1,c2,c3,c4,c5) ) \
        F77_CHAR_ARG5DCL(c1,c2,c3,c4,c5) F77_EXTERN_DCL(e6) \
      { F77_CHAR_ARG5DEF(c1,c2,c3,c4,c5) F77_EXTERN_DEF(e6)


#define F77_ENTRY_CCE(name,c1,c2,e3) \
  type_of_call \
  name( F77_CHAR_ARG2PTR(c1,c2),F77_EXTERN_ARG(e3) \
        F77_CHAR_ARG2LEN(c1,c2) ) \
        F77_CHAR_ARG2DCL(c1,c2) F77_EXTERN_DCL(e3) \
      { F77_CHAR_ARG2DEF(c1,c2) F77_EXTERN_DEF(e3)


#define F77_ENTRY_CCEE(name,c1,c2,e3,e4) \
  type_of_call \
  name( F77_CHAR_ARG2PTR(c1,c2),F77_EXTERN2ARG(e3,e4) \
        F77_CHAR_ARG2LEN(c1,c2) ) \
        F77_CHAR_ARG2DCL(c1,c2) F77_EXTERN2DCL(e3,e4) \
      { F77_CHAR_ARG2DEF(c1,c2) F77_EXTERN2DEF(e3,e4)


#define F77_ENTRY_CCI(name,c1,c2,i3) \
  type_of_call \
  name( F77_CHAR_ARG2PTR(c1,c2),F77_INTG_ARG_PTR(i3) \
        F77_CHAR_ARG2LEN(c1,c2) ) \
        F77_CHAR_ARG2DCL(c1,c2) F77_INTG_ARG_DCL(i3) \
      { F77_CHAR_ARG2DEF(c1,c2) F77_INTG_ARG_DEF(i3)


#define F77_ENTRY_CCIC(name,c1,c2,i3,c4) \
  type_of_call \
  name( F77_CHAR_ARG2PTR(c1,c2),F77_INTG_ARG_PTR(i3),F77_CHAR_ARG_PTR(c4) \
        F77_CHAR_ARG2LEN(c1,c2) F77_XXXX_ARG_LEN(i3) F77_CHAR_ARG_LEN(c4) ) \
        F77_CHAR_ARG3DCL(c1,c2,c4) F77_INTG_ARG_DCL(i3) \
      { F77_CHAR_ARG3DEF(c1,c2,c4) F77_INTG_ARG_DEF(i3)


#define F77_ENTRY_CCI3(name,c1,c2,i3,i4,i5) \
  type_of_call \
  name( F77_CHAR_ARG2PTR(c1,c2),F77_INTG_ARG3PTR(i3,i4,i5) \
        F77_CHAR_ARG2LEN(c1,c2) ) \
        F77_CHAR_ARG2DCL(c1,c2) F77_INTG_ARG3DCL(i3,i4,i5) \
      { F77_CHAR_ARG2DEF(c1,c2) F77_INTG_ARG3DEF(i3,i4,i5)


#define F77_ENTRY_CCIRCC(name,c1,c2,i3,r4,c5,c6) \
  type_of_call \
  name( F77_CHAR_ARG2PTR(c1,c2), \
            F77_INTG_ARG_PTR(i3),F77_REAL_ARG_PTR(r4),F77_CHAR_ARG2PTR(c5,c6) \
        F77_CHAR_ARG2LEN(c1,c2) \
            F77_XXXX_ARG2LEN(i3,r4) F77_CHAR_ARG2LEN(c5,c6) ) \
        F77_CHAR_ARG4DCL(c1,c2,c5,c6) \
            F77_INTG_ARG_DCL(i3) F77_REAL_ARG_DCL(r4) \
      { F77_CHAR_ARG4DEF(c1,c2,c5,c6) \
            F77_INTG_ARG_DEF(i3) F77_REAL_ARG_DEF(r4) \


#define F77_ENTRY_CE(name,c1,e2) \
  type_of_call \
  name( F77_CHAR_ARG_PTR(c1),F77_EXTERN_ARG(e2) \
        F77_CHAR_ARG_LEN(c1) ) \
        F77_CHAR_ARG_DCL(c1) F77_EXTERN_DCL(e2) \
      { F77_CHAR_ARG_DEF(c1) F77_EXTERN_DEF(e2)


#define F77_ENTRY_CI(name,c1,i2) \
  type_of_call \
  name( F77_CHAR_ARG_PTR(c1),F77_INTG_ARG_PTR(i2) \
        F77_CHAR_ARG_LEN(c1) ) \
        F77_CHAR_ARG_DCL(c1) F77_INTG_ARG_DCL(i2) \
      { F77_CHAR_ARG_DEF(c1) F77_INTG_ARG_DEF(i2)


#define F77_ENTRY_CICI(name,c1,i2,c3,i4) \
  type_of_call \
  name( F77_CHAR_ARG_PTR(c1),F77_INTG_ARG_PTR(i2), \
            F77_CHAR_ARG_PTR(c3),F77_INTG_ARG_PTR(i4) \
        F77_CHAR_ARG_LEN(c1) F77_XXXX_ARG_LEN(i2) \
            F77_CHAR_ARG_LEN(c3) ) \
        F77_CHAR_ARG2DCL(c1,c3) F77_INTG_ARG2DCL(i2,i4) \
      { F77_CHAR_ARG2DEF(c1,c3) F77_INTG_ARG2DEF(i2,i4)


#define F77_ENTRY_CII(name,c1,i2,i3) \
  type_of_call \
  name( F77_CHAR_ARG_PTR(c1),F77_INTG_ARG2PTR(i2,i3) \
        F77_CHAR_ARG_LEN(c1) ) \
        F77_CHAR_ARG_DCL(c1) F77_INTG_ARG2DCL(i2,i3) \
      { F77_CHAR_ARG_DEF(c1) F77_INTG_ARG2DEF(i2,i3)


#define F77_ENTRY_CIIC(name,c1,i2,i3,c4) \
  type_of_call \
  name( F77_CHAR_ARG_PTR(c1),F77_INTG_ARG2PTR(i2,i3),F77_CHAR_ARG_PTR(c4) \
        F77_CHAR_ARG_LEN(c1) F77_XXXX_ARG2LEN(i2,i3) F77_CHAR_ARG_LEN(c4) ) \
        F77_CHAR_ARG2DCL(c1,c4) F77_INTG_ARG2DCL(i2,i3) \
      { F77_CHAR_ARG2DEF(c1,c4) F77_INTG_ARG2DEF(i2,i3)


#define F77_ENTRY_CR(name,c1,r2) \
  type_of_call \
  name( F77_CHAR_ARG_PTR(c1),F77_REAL_ARG_PTR(r2) \
        F77_CHAR_ARG_LEN(c1) ) \
        F77_CHAR_ARG_DCL(c1) F77_REAL_ARG_DCL(r2) \
      { F77_CHAR_ARG_DEF(c1) F77_REAL_ARG_DEF(r2)

#define F77_ENTRY_R(name,r1)   \
  type_of_call                 \
  name( F77_REAL_ARG_PTR(r1) ) \
        F77_REAL_ARG_DCL(r1)   \
      { F77_REAL_ARG_DEF(r1)

#define F77_ENTRY_E(name,e1) \
  type_of_call \
  name( F77_EXTERN_ARG(e1) ) \
        F77_EXTERN_DCL(e1) \
      { F77_EXTERN_DEF(e1)


#define F77_ENTRY_E4(name,e1,e2,e3,e4) \
  type_of_call \
  name( F77_EXTERN4ARG(e1,e2,e3,e4) ) \
        F77_EXTERN4DCL(e1,e2,e3,e4) \
      { F77_EXTERN4DEF(e1,e2,e3,e4)

#define F77_ENTRY_I(name,i1)    \
  type_of_call                  \
  name(  F77_INTG_ARG_PTR(i1) ) \
         F77_INTG_ARG_DCL(i1)   \
      {  F77_INTG_ARG_DEF(i1)
 
#define F77_ENTRY_IC(name,i1,c2) \
  type_of_call \
  name( F77_INTG_ARG_PTR(i1),F77_CHAR_ARG_PTR(c2) \
        F77_XXXX_ARG_LEN(i1) F77_CHAR_ARG_LEN(c2) ) \
        F77_INTG_ARG_DCL(i1) F77_CHAR_ARG_DCL(c2) \
      { F77_INTG_ARG_DEF(i1) F77_CHAR_ARG_DEF(c2)


#define F77_ENTRY_ICI(name,i1,c2,i3) \
  type_of_call \
  name( F77_INTG_ARG_PTR(i1),   F77_CHAR_ARG_PTR(c2),F77_INTG_ARG_PTR(i3) \
        F77_XXXX_ARG_LEN(i1)    F77_CHAR_ARG_LEN(c2) ) \
        F77_INTG_ARG2DCL(i1,i3) F77_CHAR_ARG_DCL(c2) \
      { F77_INTG_ARG2DEF(i1,i3) F77_CHAR_ARG_DEF(c2)


#define F77_ENTRY_IIC(name,i1,i2,c3) \
  type_of_call \
  name( F77_INTG_ARG2PTR(i1,i2),F77_CHAR_ARG_PTR(c3) \
        F77_XXXX_ARG2LEN(i1,i2) F77_CHAR_ARG_LEN(c3) ) \
        F77_INTG_ARG2DCL(i1,i2) F77_CHAR_ARG_DCL(c3) \
      { F77_INTG_ARG2DEF(i1,i2) F77_CHAR_ARG_DEF(c3)


#define F77_ENTRY_I3C(name,i1,i2,i3,c4) \
  type_of_call \
  name( F77_INTG_ARG3PTR(i1,i2,i3),F77_CHAR_ARG_PTR(c4) \
        F77_XXXX_ARG3LEN(i1,i2,i3) F77_CHAR_ARG_LEN(c4) ) \
        F77_INTG_ARG3DCL(i1,i2,i3) F77_CHAR_ARG_DCL(c4) \
      { F77_INTG_ARG3DEF(i1,i2,i3) F77_CHAR_ARG_DEF(c4)


#define F77_ENTRY_I4CCC(name,i1,i2,i3,i4,c5,c6,c7) \
  type_of_call \
  name( F77_INTG_ARG4PTR(i1,i2,i3,i4),F77_CHAR_ARG3PTR(c5,c6,c7) \
        F77_XXXX_ARG4LEN(i1,i2,i3,i4) F77_CHAR_ARG3LEN(c5,c6,c7) ) \
        F77_INTG_ARG4DCL(i1,i2,i3,i4) F77_CHAR_ARG3DCL(c5,c6,c7) \
      { F77_INTG_ARG4DEF(i1,i2,i3,i4) F77_CHAR_ARG3DEF(c5,c6,c7)


#define F77_CHAR_DEF2DSC(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_DEF_DSC(s1,p1,l1) F77_CHAR_DEF_DSC(s2,p2,l2)
#define F77_CHAR_ASS2DSC(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_ASS_DSC(s1,p1,l1) F77_CHAR_ASS_DSC(s2,p2,l2)
#define F77_CHAR_USE2PTR(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_USE_PTR(s1,p1,l1),F77_CHAR_USE_PTR(s2,p2,l2)
#define F77_CHAR_USE2LEN(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_USE_LEN(s1,p1,l1) F77_CHAR_USE_LEN(s2,p2,l2)
#define F77_XXXX_USE2LEN(x1,x2) \
        F77_XXXX_USE_LEN(x1) F77_XXXX_USE_LEN(x2)


#define F77_CHAR_DEF3DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3) \
        F77_CHAR_DEF2DSC(s1,p1,l1,s2,p2,l2) F77_CHAR_DEF_DSC(s3,p3,l3)
#define F77_CHAR_ASS3DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3) \
        F77_CHAR_ASS2DSC(s1,p1,l1,s2,p2,l2) F77_CHAR_ASS_DSC(s3,p3,l3)
#define F77_CHAR_USE3PTR(s1,p1,l1,s2,p2,l2,s3,p3,l3) \
        F77_CHAR_USE2PTR(s1,p1,l1,s2,p2,l2),F77_CHAR_USE_PTR(s3,p3,l3)
#define F77_CHAR_USE3LEN(s1,p1,l1,s2,p2,l2,s3,p3,l3) \
        F77_CHAR_USE2LEN(s1,p1,l1,s2,p2,l2) F77_CHAR_USE_LEN(s3,p3,l3)
#define F77_XXXX_USE3LEN(x1,x2,x3) \
        F77_XXXX_USE2LEN(x1,x2) F77_XXXX_USE_LEN(x3)


#define F77_CHAR_DEF4DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3,s4,p4,l4) \
        F77_CHAR_DEF3DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3) F77_CHAR_DEF_DSC(s4,p4,l4)
#define F77_CHAR_ASS4DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3,s4,p4,l4) \
        F77_CHAR_ASS3DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3) F77_CHAR_ASS_DSC(s4,p4,l4)
#define F77_CHAR_USE4PTR(s1,p1,l1,s2,p2,l2,s3,p3,l3,s4,p4,l4) \
        F77_CHAR_USE3PTR(s1,p1,l1,s2,p2,l2,s3,p3,l3),F77_CHAR_USE_PTR(s4,p4,l4)
#define F77_CHAR_USE4LEN(s1,p1,l1,s2,p2,l2,s3,p3,l3,s4,p4,l4) \
        F77_CHAR_USE3LEN(s1,p1,l1,s2,p2,l2,s3,p3,l3) F77_CHAR_USE_LEN(s4,p4,l4)
#define F77_XXXX_USE4LEN(x1,x2,x3,x4) \
        F77_XXXX_USE3LEN(x1,x2,x3) F77_XXXX_USE_LEN(x4)


#define F77_XXXX_USE5LEN(x1,x2,x3,x4,x5) \
        F77_XXXX_USE4LEN(x1,x2,x3,x4) F77_XXXX_USE_LEN(x5)


#define F77_XXXX_USE6LEN(x1,x2,x3,x4,x5,x6) \
        F77_XXXX_USE5LEN(x1,x2,x3,x4,x5) F77_XXXX_USE_LEN(x6)


#define F77_XXXX_USE7LEN(x1,x2,x3,x4,x5,x6,x7) \
        F77_XXXX_USE6LEN(x1,x2,x3,x4,x5,x6) F77_XXXX_USE_LEN(x7)


#define F77_XXXX_USE8LEN(x1,x2,x3,x4,x5,x6,x7,x8) \
        F77_XXXX_USE7LEN(x1,x2,x3,x4,x5,x6,x7) F77_XXXX_USE_LEN(x8)


EXTERN INTEGER F77_i0;          /* dummy */

#ifdef IBM370
#pragma linkage(K77C,FORTRAN)
#define F77_IFUN_C(i0,name,p1,l1) do { \
        i0 = K77C(&name,p1,l1); } while(0)
#else
#define F77_IFUN_C(i0,name,p1,l1) do { \
        F77_CHAR_DEF_DSC(s1,p1,l1) \
        F77_CHAR_ASS_DSC(s1,p1,l1) \
        i0 = (*name)( \
        F77_CHAR_USE_PTR(s1,p1,l1) \
        F77_CHAR_USE_LEN(s1,p1,l1) \
       ); } while(0)
#endif
#define F77_CALL_C(name,p1,l1) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_C(F77_i0,_p0_,p1,l1); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77CC,FORTRAN)
#define F77_IFUN_CC(i0,name,p1,l1,p2,l2) do { \
        i0 = K77CC(&name,p1,l1,p2,l2); } while(0)
#else
#define F77_IFUN_CC(i0,name,p1,l1,p2,l2) do { \
        F77_CHAR_DEF2DSC(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_ASS2DSC(s1,p1,l1,s2,p2,l2) \
        i0 = (*name)( \
        F77_CHAR_USE2PTR(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_USE2LEN(s1,p1,l1,s2,p2,l2) \
       ); } while(0)
#endif
#define F77_CALL_CC(name,p1,l1,p2,l2) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_CC(F77_i0,_p0_,p1,l1,p2,l2); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77C3,FORTRAN)
#define F77_IFUN_C3(i0,name,p1,l1,p2,l2,p3,l3) do { \
        i0 = K77C3(&name,p1,l1,p2,l2,p3,l3); } while(0)
#else
#define F77_IFUN_C3(i0,name,p1,l1,p2,l2,p3,l3) do { \
        F77_CHAR_DEF3DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3) \
        F77_CHAR_ASS3DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3) \
        i0 = (*name)( \
        F77_CHAR_USE3PTR(s1,p1,l1,s2,p2,l2,s3,p3,l3) \
        F77_CHAR_USE3LEN(s1,p1,l1,s2,p2,l2,s3,p3,l3) \
       ); } while(0)
#endif
#define F77_CALL_C3(name,p1,l1,p2,l2,p3,l3) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_C3(F77_i0,_p0_,p1,l1,p2,l2,p3,l3); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77C7,FORTRAN)
#define F77_IFUN_C7(i0,name,p1,l1,p2,l2,p3,l3,p4,l4,p5,l5,p6,l6,p7,l7) do { \
        i0 = K77C7(&name,p1,l1,p2,l2,p3,l3,p4,l4,p5,l5,p6,l6,p7,l7); } while(0)
#else
#define F77_IFUN_C7(i0,name,p1,l1,p2,l2,p3,l3,p4,l4,p5,l5,p6,l6,p7,l7) do { \
        F77_CHAR_DEF4DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3,s4,p4,l4) \
        F77_CHAR_DEF3DSC(s5,p5,l5,s6,p6,l6,s7,p7,l7) \
        F77_CHAR_ASS4DSC(s1,p1,l1,s2,p2,l2,s3,p3,l3,s4,p4,l4) \
        F77_CHAR_ASS3DSC(s5,p5,l5,s6,p6,l6,s7,p7,l7) \
        i0 = (*name)( \
        F77_CHAR_USE4PTR(s1,p1,l1,s2,p2,l2,s3,p3,l3,s4,p4,l4), \
        F77_CHAR_USE3PTR(s5,p5,l5,s6,p6,l6,s7,p7,l7) \
        F77_CHAR_USE4LEN(s1,p1,l1,s2,p2,l2,s3,p3,l3,s4,p4,l4) \
        F77_CHAR_USE3LEN(s5,p5,l5,s6,p6,l6,s7,p7,l7) \
       ); } while(0)
#endif
#define F77_CALL_C7(name,p1,l1,p2,l2,p3,l3,p4,l4,p5,l5,p6,l6,p7,l7) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_C7(F77_i0,_p0_,p1,l1,p2,l2,p3,l3,p4,l4,p5,l5,p6,l6,p7,l7); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77CCx,FORTRAN)
#define F77_CALL_CCx(name,p1,l1,p2,l2,x3) do { \
        SUBROUTINE *F77 = name; \
        K77CCx(&F77,p1,l1,p2,l2,x3); } while(0)
#else
#define F77_CALL_CCx(name,p1,l1,p2,l2,x3) do { \
        F77_CHAR_DEF2DSC(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_ASS2DSC(s1,p1,l1,s2,p2,l2) \
  name( F77_CHAR_USE2PTR(s1,p1,l1,s2,p2,l2), \
                         x3 \
        F77_CHAR_USE2LEN(s1,p1,l1,s2,p2,l2) \
        F77_XXXX_USE_LEN(x3) \
       ); } while(0)
#endif


#ifdef IBM370
#pragma linkage(K77CCxx,FORTRAN)
#define F77_IFUN_CCxx(i0,name,p1,l1,p2,l2,x3,x4) do { \
        i0 = K77CCxx(&name,p1,l1,p2,l2,x3,x4); } while(0)
#else
#define F77_IFUN_CCxx(i0,name,p1,l1,p2,l2,x3,x4) do { \
        F77_CHAR_DEF2DSC(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_ASS2DSC(s1,p1,l1,s2,p2,l2) \
        i0 = (*name)( \
        F77_CHAR_USE2PTR(s1,p1,l1,s2,p2,l2), \
                         x3,x4 \
        F77_CHAR_USE2LEN(s1,p1,l1,s2,p2,l2) \
       ); } while(0)
#endif
#define F77_CALL_CCxx(name,p1,l1,p2,l2,x3,x4) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_CCxx(F77_i0,_p0_,p1,l1,p2,l2,x3,x4); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77CCx3,FORTRAN)
#define F77_IFUN_CCx3(i0,name,p1,l1,p2,l2,x3,x4,x5) do { \
        i0 = K77CCx3(&name,p1,l1,p2,l2,x3,x4,x5); } while(0)
#else
#define F77_IFUN_CCx3(i0,name,p1,l1,p2,l2,x3,x4,x5) do { \
        F77_CHAR_DEF2DSC(s1,p1,l1,s2,p2,l2) \
        F77_CHAR_ASS2DSC(s1,p1,l1,s2,p2,l2) \
        i0 = (*name)( \
        F77_CHAR_USE2PTR(s1,p1,l1,s2,p2,l2), \
                         x3,x4,x5 \
        F77_CHAR_USE2LEN(s1,p1,l1,s2,p2,l2) \
       ); } while(0)
#endif
#define F77_CALL_CCx3(name,p1,l1,p2,l2,x3,x4,x5) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_CCx3(F77_i0,_p0_,p1,l1,p2,l2,x3,x4,x5); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77Cx,FORTRAN)
#define F77_IFUN_Cx(i0,name,p1,l1,x2) do { \
        i0 = K77Cx(&name,p1,l1,x2); } while(0)
#else
#define F77_IFUN_Cx(i0,name,p1,l1,x2) do { \
        F77_CHAR_DEF_DSC(s1,p1,l1) \
        F77_CHAR_ASS_DSC(s1,p1,l1) \
  i0 = (*name)( \
        F77_CHAR_USE_PTR(s1,p1,l1), \
                         x2 \
        F77_CHAR_USE_LEN(s1,p1,l1) \
        F77_XXXX_USE_LEN(x2) \
       ); } while(0)
#endif

#define F77_CALL_Cx(name,p1,l1,x2) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_Cx(F77_i0,_p0_,p1,l1,x2); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77CxC,FORTRAN)
#define F77_CALL_CxC(name,p1,l1,x2,p3,l3) do { \
        SUBROUTINE *F77 = name; \
        K77CxC(&F77,p1,l1,x2,p3,l3); } while(0)
#else
#define F77_CALL_CxC(name,p1,l1,x2,p3,l3) do { \
        F77_CHAR_DEF2DSC(s1,p1,l1,s3,p3,l3) \
        F77_CHAR_ASS2DSC(s1,p1,l1,s3,p3,l3) \
  name( F77_CHAR_USE_PTR(s1,p1,l1), \
                         x2, \
        F77_CHAR_USE_PTR(s3,p3,l3) \
        F77_CHAR_USE_LEN(s1,p1,l1) \
        F77_XXXX_USE_LEN(x2) \
        F77_CHAR_USE_LEN(s3,p3,l3) \
       ); } while(0)
#endif


#ifdef IBM370
#pragma linkage(K77Cxx,FORTRAN)
#define F77_CALL_Cxx(name,p1,l1,x2,x3) do { \
        SUBROUTINE *F77 = name; \
        K77Cxx(&F77,p1,l1,x2,x3); } while(0)
#else
#define F77_CALL_Cxx(name,p1,l1,x2,x3) do { \
        F77_CHAR_DEF_DSC(s1,p1,l1) \
        F77_CHAR_ASS_DSC(s1,p1,l1) \
  name( F77_CHAR_USE_PTR(s1,p1,l1), \
                         x2,x3 \
        F77_CHAR_USE_LEN(s1,p1,l1) \
        F77_XXXX_USE2LEN(x2,x3) \
       ); } while(0)
#endif


#ifdef IBM370
#pragma linkage(K77xC,FORTRAN)
#define F77_CALL_xC(name,x1,p2,l2) do { \
        SUBROUTINE *F77 = name; \
        K77xC(&F77,x1,p2,l2); } while(0)
#else
#define F77_CALL_xC(name,x1,p2,l2) do { \
        F77_CHAR_DEF_DSC(s2,p2,l2) \
        F77_CHAR_ASS_DSC(s2,p2,l2) \
  name(                  x1, \
        F77_CHAR_USE_PTR(s2,p2,l2) \
        F77_XXXX_USE_LEN(x1) \
        F77_CHAR_USE_LEN(s2,p2,l2) \
       ); } while(0)
#endif


#ifdef IBM370
#pragma linkage(K77xCCx,FORTRAN)
#define F77_CALL_xCCx(name,x1,p2,l2,p3,l3,x4) do { \
        SUBROUTINE *F77 = name; \
        K77xCCx(&F77,x1,p2,l2,p3,l3,x4); } while(0)
#else
#define F77_CALL_xCCx(name,x1,p2,l2,p3,l3,x4) do { \
        F77_CHAR_DEF2DSC(s2,p2,l2,s3,p3,l3) \
        F77_CHAR_ASS2DSC(s2,p2,l2,s3,p3,l3) \
  name(                  x1, \
        F77_CHAR_USE2PTR(s2,p2,l2,s3,p3,l3), \
                         x4 \
        F77_XXXX_USE_LEN(x1) \
        F77_CHAR_USE2LEN(s2,p2,l2,s3,p3,l3) \
        F77_XXXX_USE_LEN(x4) \
       ); } while(0)
#endif


#ifdef IBM370
#pragma linkage(K77xCC,FORTRAN)
#define F77_IFUN_xCC(i0,name,x1,p2,l2,p3,l3) do { \
        i0 = K77xCC(&name,x1,p2,l2,p3,l3); } while(0)
#else
#define F77_IFUN_xCC(i0,name,x1,p2,l2,p3,l3) do { \
        F77_CHAR_DEF2DSC(s2,p2,l2,s3,p3,l3) \
        F77_CHAR_ASS2DSC(s2,p2,l2,s3,p3,l3) \
  i0 = (*name)(          x1, \
        F77_CHAR_USE2PTR(s2,p2,l2,s3,p3,l3) \
        F77_XXXX_USE_LEN(x1) \
        F77_CHAR_USE2LEN(s2,p2,l2,s3,p3,l3) \
       ); } while(0)
#endif

#define F77_CALL_xCC(name,x1,p2,l2,p3,l3) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_xCC(F77_i0,_p0_,x1,p2,l2,p3,l3); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77xCx,FORTRAN)
#define F77_IFUN_xCx(i0,name,x1,p2,l2,x3) do { \
        i0 = K77xCx(&name,x1,p2,l2,x3); } while(0)
#else
#define F77_IFUN_xCx(i0,name,x1,p2,l2,x3) do { \
        F77_CHAR_DEF_DSC(s2,p2,l2) \
        F77_CHAR_ASS_DSC(s2,p2,l2) \
  i0 = (*name)(          x1, \
        F77_CHAR_USE_PTR(s2,p2,l2), \
                         x3 \
        F77_XXXX_USE_LEN(x1) \
        F77_CHAR_USE_LEN(s2,p2,l2) \
        F77_XXXX_USE_LEN(x3) \
       ); } while(0)
#endif

#define F77_CALL_xCx(name,x1,p2,l2,x3) do { \
        INT_FUNCPTR _p0_ = (INT_FUNCPTR)name; \
        F77_IFUN_xCx(F77_i0,_p0_,x1,p2,l2,x3); \
        } while(0)


#ifdef IBM370
#pragma linkage(K77x4C,FORTRAN)
#define F77_CALL_x4C(name,x1,x2,x3,x4,p5,l5) do { \
        SUBROUTINE *F77 = name; \
        K77x4C(&F77,x1,x2,x3,x4,p5,l5); } while(0)
#else
#define F77_CALL_x4C(name,x1,x2,x3,x4,p5,l5) do { \
        F77_CHAR_DEF_DSC(s5,p5,l5) \
        F77_CHAR_ASS_DSC(s5,p5,l5) \
  name(                  x1,x2,x3,x4, \
        F77_CHAR_USE_PTR(s5,p5,l5) \
        F77_XXXX_USE4LEN(x1,x2,x3,x4) \
        F77_CHAR_USE_LEN(s5,p5,l5) \
       ); } while(0)
#endif


#ifdef IBM370
#pragma linkage(K77x4Cxx,FORTRAN)
#define F77_CALL_x4Cxx(name,x1,x2,x3,x4,p5,l5,x6,x7) do { \
        SUBROUTINE *F77 = name; \
        K77x4Cxx(&F77,x1,x2,x3,x4,p5,l5,x6,x7); } while(0)
#else
#define F77_CALL_x4Cxx(name,x1,x2,x3,x4,p5,l5,x6,x7) do { \
        F77_CHAR_DEF_DSC(s5,p5,l5) \
        F77_CHAR_ASS_DSC(s5,p5,l5) \
  name(                  x1,x2,x3,x4, \
        F77_CHAR_USE_PTR(s5,p5,l5), \
                         x6,x7 \
        F77_XXXX_USE4LEN(x1,x2,x3,x4) \
        F77_CHAR_USE_LEN(s5,p5,l5) \
        F77_XXXX_USE2LEN(x6,x7) \
       ); } while(0)
#endif


#ifdef IBM370
#pragma linkage(KIGMENU,FORTRAN)
/*                               1  2  3 4 5 6 7  8  9 10  11  12 13 14 */
#define F77_CALL_xCx5CxC3xC(name,a,b,B,c,d,e,f,g,h,H,i,j,J,k,K,l,L,m,n,N) do {\
        SUBROUTINE *F77 = name; \
        KIGMENU(&F77,a,b,B,c,d,e,f,g,h,H,i,j,J,k,K,l,L,m,n,N); } while(0)
#else
#define F77_CALL_xCx5CxC3xC(name,a,b,B,c,d,e,f,g,h,H,i,j,J,k,K,l,L,m,n,N) do {\
        F77_CHAR_DEF_DSC(sb,b,B) \
        F77_CHAR_DEF_DSC(sh,h,H) \
        F77_CHAR_DEF3DSC(sj,j,J,sk,k,K,sl,l,L) \
        F77_CHAR_DEF_DSC(sn,n,N) \
        F77_CHAR_ASS_DSC(sb,b,B) \
        F77_CHAR_ASS_DSC(sh,h,H) \
        F77_CHAR_ASS3DSC(sj,j,J,sk,k,K,sl,l,L) \
        F77_CHAR_ASS_DSC(sn,n,N) \
  name(                  a, \
        F77_CHAR_USE_PTR(sb,b,B), \
                         c,d,e,f,g, \
        F77_CHAR_USE_PTR(sh,h,H), \
                         i, \
        F77_CHAR_USE3PTR(sj,j,J,sk,k,K,sl,l,L), \
                         m, \
        F77_CHAR_USE_PTR(sn,n,N) \
        F77_XXXX_USE_LEN(a) \
        F77_CHAR_USE_LEN(sb,b,B) \
        F77_XXXX_USE5LEN(c,d,e,f,g) \
        F77_CHAR_USE_LEN(sh,h,H) \
        F77_XXXX_USE_LEN(i) \
        F77_CHAR_USE3LEN(sj,j,J,sk,k,K,sl,l,L) \
        F77_XXXX_USE_LEN(m) \
        F77_CHAR_USE_LEN(sn,n,N) \
       ); } while(0)
#endif


#ifdef IBM370
#define F77_IFUN_x(i0,name,x1) i0 = __CTOF(name,x1)
#else
#define F77_IFUN_x(i0,name,x1) i0 = (*name)(x1)
#endif


#ifdef IBM370
#define F77_IFUN_xx(i0,name,x1,x2) i0 = __CTOF(name,x1,x2)
#else
#define F77_IFUN_xx(i0,name,x1,x2) i0 = (*name)(x1,x2)
#endif


#ifdef IBM370
#pragma linkage(K77xCx8,FORTRAN)
#define F77_IFUN_xCx8(i0,name,x1,p2,l2,x3,x4,x5,x6,x7,x8,x9,x10) do { \
        i0 = K77xCx8(&name,x1,p2,l2,x3,x4,x5,x6,x7,x8,x9,x10); } while(0)
#else
#define F77_IFUN_xCx8(i0,name,x1,p2,l2,x3,x4,x5,x6,x7,x8,x9,x10) do { \
        F77_CHAR_DEF_DSC(s2,p2,l2) \
        F77_CHAR_ASS_DSC(s2,p2,l2) \
  i0 = (*name)(          x1, \
        F77_CHAR_USE_PTR(s2,p2,l2), \
                         x3,x4,x5,x6,x7,x8,x9,x10 \
        F77_XXXX_USE_LEN(x1) \
        F77_CHAR_USE_LEN(s2,p2,l2) \
        F77_XXXX_USE8LEN(x3,x4,x5,x6,x7,x8,x9,x10) \
       ); } while(0)
#endif


extern LOGICAL ku_true( int return_true );


/*
 * routines called by Fortran
 */
#define  Errrun           F77_NAME(errrun,ERRRUN)
#define  Fmemcpy          F77_NAME(fmemcpy,FMEMCPY)

#define  Getarg           F77_NAME(getarg,GETARG)
                 extern SUBROUTINE Getarg;
#define  Goparm           F77_NAME(goparm,GOPARM)
                 extern SUBROUTINE Goparm;

#define  Iclrwk           F77_NAME(iclrwk,ICLRWK)
                 extern SUBROUTINE Iclrwk;
#define  Iginit           F77_NAME(iginit,IGINIT)
                 extern SUBROUTINE Iginit;
#define  Igmenu           F77_NAME(igmenu,IGMENU)
                 extern SUBROUTINE Igmenu;
#define  Igrng            F77_NAME(igrng,IGRNG)
                 extern SUBROUTINE Igrng;
#define  Igsse            F77_NAME(igsse,IGSSE)
                 extern SUBROUTINE Igsse;
#define  Igsrap           F77_NAME(igsrap,IGSRAP)
                 extern SUBROUTINE Igsrap;
#define  Igwkty           F77_NAME(igwkty,IGWKTY)
                 extern SUBROUTINE Igwkty;

#define  Kcexec           F77_NAME(kcexec,KCEXEC)

#define  Kdialo           F77_NAME(kdialo,KDIALO)
                 extern SUBROUTINE Kdialo;

#define  Kgetar           F77_NAME(kgetar,KGETAR)

#define  Kiargc           F77_NAME(kiargc,KIARGC)
               extern INT_FUNCTION Kiargc;
#define  Kibres           F77_NAME(kibres,KIBRES)
                 extern SUBROUTINE Kibres;
#define  Kiclos           F77_NAME(kiclos,KICLOS)
                 extern SUBROUTINE Kiclos;
#define  Kicomv           F77_NAME(kicomv,KICOMV)
#define  Kierrf           F77_NAME(kierrf,KIERRF)
#ifdef CERNLIB_MSSTDCALL
                 extern type_of_call Kierrf
                 (char *, int); /* To make MS Fortran happy */
#else
                  extern SUBROUTINE Kierrf;
#endif

#define  Kiinit           F77_NAME(kiinit,KIINIT)
#ifdef CERNLIB_MSSTDCALL
                 extern type_of_call Kiinit
                 (int *);
#else
                 extern SUBROUTINE Kiinit;
#endif
#define  Kilun            F77_NAME(kilun,KILUN)
                 extern SUBROUTINE Kilun;
#define  Kipawc           F77_NAME(kipawc,KIPAWC)
#define  Kipiaf           F77_NAME(kipiaf,KIPIAF)
#define  Kiprmt           F77_NAME(kiprmt,KIPRMT)
#define  Kirtim           F77_NAME(kirtim,KIRTIM)
#define  Kisigm           F77_NAME(kisigm,KISIGM)
#define  Kivect           F77_NAME(kivect,KIVECT)

#define  Kmbrset          F77_NAME(kmbrset,KMBRSET)
#define  Kmvsed           F77_NAME(kmvsed,KMVSED)
                 extern SUBROUTINE Kmvsed;
#define  Kmvspg           F77_NAME(kmvspg,KMVSPG)
                 extern SUBROUTINE Kmvspg;
#define  Kmvssh           F77_NAME(kmvssh,KMVSSH)
                 extern SUBROUTINE Kmvssh;

#define  Ksvpar           F77_NAME(ksvpar,KSVPAR)

#define  Kuach            F77_NAME(kuach,KUACH)
#define  Kuact            F77_NAME(kuact,KUACT)
#define  Kualfa           F77_NAME(kualfa,KUALFA)
#define  Kuappl           F77_NAME(kuappl,KUAPPL)
#define  Kuargs           F77_NAME(kuargs,KUARGS)
#define  Kubrek           F77_NAME(kubrek,KUBREK)
#define  Kubrof           F77_NAME(kubrof,KUBROF)
#define  Kubron           F77_NAME(kubron,KUBRON)
#define  Kuclos           F77_NAME(kuclos,KUCLOS)
#ifdef CERNLIB_MSSTDCALL
                 extern type_of_call Kuclos
                 (int *, char *, int , int *);
#else
                 extern SUBROUTINE Kuclos;
#endif

#define  Kucmd            F77_NAME(kucmd,KUCMD)
#define  Kucmdl           F77_NAME(kucmdl,KUCMDL)
#define  Kucomv           F77_NAME(kucomv,KUCOMV)
#define  Kuedit           F77_NAME(kuedit,KUEDIT)
#define  Kuesvr           F77_NAME(kuesvr,KUESVR)
#define  Kueusr           F77_NAME(kueusr,KUEUSR)
#define  Kuexec           F77_NAME(kuexec,KUEXEC)
#define  Kuexel           F77_NAME(kuexel,KUEXEL)
#define  Kuexit           F77_NAME(kuexit,KUEXIT)
#define  Kufcas           F77_NAME(kufcas,KUFCAS)
#define  Kufdef           F77_NAME(kufdef,KUFDEF)
#define  Kugetc           F77_NAME(kugetc,KUGETC)
#define  Kugete           F77_NAME(kugete,KUGETE)
#define  Kugetf           F77_NAME(kugetf,KUGETF)
#define  Kugeti           F77_NAME(kugeti,KUGETI)
#define  Kugetl           F77_NAME(kugetl,KUGETL)
#define  Kugetr           F77_NAME(kugetr,KUGETR)
#define  Kugets           F77_NAME(kugets,KUGETS)
#define  Kugrfl           F77_NAME(kugrfl,KUGRFL)
#define  Kuguid           F77_NAME(kuguid,KUGUID)
#define  Kuhelp           F77_NAME(kuhelp,KUHELP)
#define  Kuhome           F77_NAME(kuhome,KUHOME)
#define  Kuidf1           F77_NAME(kuidf1,KUIDF1)
                 extern SUBROUTINE Kuidf1;
#define  Kuidf2           F77_NAME(kuidf2,KUIDF2)
                 extern SUBROUTINE Kuidf2;
#define  Kuidfm           F77_NAME(kuidfm,KUIDFM)
#define  Kuinim           F77_NAME(kuinim,KUINIM)
#define  Kuinit           F77_NAME(kuinit,KUINIT)
#define  Kuinps           F77_NAME(kuinps,KUINPS)
#define  Kuinqf           F77_NAME(kuinqf,KUINQF)
#define  Kxdsig           F77_NAME(kxdsig,KXDSIG)
                 extern SUBROUTINE Kxdsig;
#ifdef CERNLIB_MSSTDCALL
                 extern type_of_call Kuinqf
                 (char *, int , int *);
#else
                 extern SUBROUTINE Kuinqf;
#endif
#define  Kulun            F77_NAME(kulun,KULUN)
#define  Kumloc           F77_NAME(kumloc,KUMLOC)
#define  Kumout           F77_NAME(kumout,KUMOUT)
#define  Kundpv           F77_NAME(kundpv,KUNDPV)
#define  Kunpar           F77_NAME(kunpar,KUNPAR)
#define  Kunwg            F77_NAME(kunwg,KUNWG)
#define  Kuopen           F77_NAME(kuopen,KUOPEN)
                 extern SUBROUTINE Kuopen;
#define  Kupad            F77_NAME(kupad,KUPAD)
#define  Kupar            F77_NAME(kupar,KUPAR)
#define  Kupath           F77_NAME(kupath,KUPATH)
#define  Kupatl           F77_NAME(kupatl,KUPATL)
#define  Kuproc           F77_NAME(kuproc,KUPROC)
#define  Kuprof           F77_NAME(kuprof,KUPROF)
#define  Kuproi           F77_NAME(kuproi,KUPROI)
#define  Kuprop           F77_NAME(kuprop,KUPROP)
#define  Kupror           F77_NAME(kupror,KUPROR)
#define  Kupros           F77_NAME(kupros,KUPROS)
#define  Kumess           F77_NAME(kumess,KUMESS)
#define  Kupval           F77_NAME(kupval,KUPVAL)
#define  Kuqcas           F77_NAME(kuqcas,KUQCAS)
#define  Kuqenv           F77_NAME(kuqenv,KUQENV)
#define  Kuqexe           F77_NAME(kuqexe,KUQEXE)
#define  Kuqkey           F77_NAME(kuqkey,KUQKEY)
#define  Kuqsvr           F77_NAME(kuqsvr,KUQSVR)
#define  Kuquit           F77_NAME(kuquit,KUQUIT)
#define  Kuqvar           F77_NAME(kuqvar,KUQVAR)
#define  Kuread           F77_NAME(kuread,KUREAD)
#ifdef CERNLIB_MSSTDCALL
                 extern type_of_call Kuread
                 (int *, char *, int , int *);
#else
                 extern SUBROUTINE Kuread;
#endif
#define  Kusapp           F77_NAME(kusapp,KUSAPP)
#define  Kuser            F77_NAME(kuser,KUSER)
#define  Kuserid          F77_NAME(kuserid,KUSERID)
#define  Kusibr           F77_NAME(kusibr,KUSIBR)
#define  Kusigm           F77_NAME(kusigm,KUSIGM)
#define  Kuspy            F77_NAME(kuspy,KUSPY)
#define  Kustat           F77_NAME(kustat,KUSTAT)
#define  Kustop           F77_NAME(kustop,KUSTOP)
#define  Kuterm           F77_NAME(kuterm,KUTERM)
#define  Kutime           F77_NAME(kutime,KUTIME)
#define  Kutim0           F77_NAME(kutim0,KUTIM0)
                 extern SUBROUTINE Kutim0;
#define  Kutrue           F77_NAME(kutrue,KUTRUE)
#define  Kuvar            F77_NAME(kuvar,KUVAR)
#define  Kuvcre           F77_NAME(kuvcre,KUVCRE)
#ifdef CERNLIB_MSSTDCALL
                 extern type_of_call Kuvcre
                 (char *, int, char *, int, int *, int *, int *);
#else
                 extern SUBROUTINE Kuvcre;
#endif
#define  Kuvdel           F77_NAME(kuvdel,KUVDEL)
#ifdef CERNLIB_MSSTDCALL
                 extern type_of_call Kuvdel
                 ( char *, int);
#else
                 extern SUBROUTINE Kuvdel;
#endif
#define  Kuvect           F77_NAME(kuvect,KUVECT)
                 extern SUBROUTINE Kuvect;
#define  Kuvnam           F77_NAME(kuvnam,KUVNAM)
#define  Kuwhag           F77_NAME(kuwhag,KUWHAG)
#define  Kuwham           F77_NAME(kuwham,KUWHAM)
#define  Kuwhat           F77_NAME(kuwhat,KUWHAT)
#define  Kuwrit           F77_NAME(kuwrit,KUWRIT)
                 extern SUBROUTINE Kuwrit;

#define  Kxcrv2           F77_NAME(kxcrv2,KXCRV2)
                 extern SUBROUTINE Kxcrv2;

#define  Macdef           F77_NAME(macdef,MACDEF)
                 extern SUBROUTINE Macdef;

#define  Mdmenu           F77_NAME(mdmenu,MDMENU)
#define  Mhi_close        F77_NAME(mhi_close,MHI_CLOSE)
                 extern SUBROUTINE Mhi_close;
#define  Mhi_open         F77_NAME(mhi_open,MHI_OPEN)
                 extern SUBROUTINE Mhi_open;

#define  Mzwipe           F77_NAME(mzwipe,MZWIPE)
                 extern SUBROUTINE Mzwipe;

#define  Traceq           F77_NAME(traceq,TRACEQ)
                 extern SUBROUTINE Traceq;

#define  Xuflow           F77_NAME(xuflow,XUFLOW)
                 extern SUBROUTINE Xuflow;


#ifdef   IBM370

#  pragma linkage(ERRRUN,FORTRAN)

#  pragma linkage(FMEMCPY,FORTRAN)

#  pragma linkage(GOPARM,FORTRAN)

#  pragma linkage(ICLRWK,FORTRAN)
#  pragma linkage(IGINIT,FORTRAN)
#  pragma linkage(IGMENU,FORTRAN)
#  pragma linkage(IGRNG,FORTRAN)
#  pragma linkage(IGSSE,FORTRAN)
#  pragma linkage(IGSRAP,FORTRAN)
#  pragma linkage(IGWKTY,FORTRAN)

#  pragma linkage(KCEXEC,FORTRAN)

#  pragma linkage(KDIALO,FORTRAN)

#  pragma linkage(KGETAR,FORTRAN)

#  pragma linkage(KIBRES,FORTRAN)
#  pragma linkage(KICLOS,FORTRAN)
#  pragma linkage(KICOMV,FORTRAN)
#  pragma linkage(KIERRF,FORTRAN)
#  pragma linkage(KIINIT,FORTRAN)
#  pragma linkage(KILUN,FORTRAN)
#  pragma linkage(KIPAWC,FORTRAN)
#  pragma linkage(KIPIAF,FORTRAN)
#  pragma linkage(KIPRMT,FORTRAN)
#  pragma linkage(KIRTIM,FORTRAN)
#  pragma linkage(KISIGM,FORTRAN)
#  pragma linkage(KIVECT,FORTRAN)

#  pragma linkage(KMBRSET,FORTRAN)
#  pragma linkage(KMVSED,FORTRAN)
#  pragma linkage(KMVSPG,FORTRAN)
#  pragma linkage(KMVSSH,FORTRAN)

#  pragma linkage(KSVPAR,FORTRAN)

#  pragma linkage(KUACH,FORTRAN)
#  pragma linkage(KUACT,FORTRAN)
#  pragma linkage(KUALFA,FORTRAN)
#  pragma linkage(KUAPPL,FORTRAN)
#  pragma linkage(KUARGS,FORTRAN)
#  pragma linkage(KUBREK,FORTRAN)
#  pragma linkage(KUBROF,FORTRAN)
#  pragma linkage(KUBRON,FORTRAN)
#  pragma linkage(KUCLOS,FORTRAN)
#  pragma linkage(KUCMD,FORTRAN)
#  pragma linkage(KUCMDL,FORTRAN)
#  pragma linkage(KUCOMV,FORTRAN)
#  pragma linkage(KUEDIT,FORTRAN)
#  pragma linkage(KUESVR,FORTRAN)
#  pragma linkage(KUEUSR,FORTRAN)
#  pragma linkage(KUEXEC,FORTRAN)
#  pragma linkage(KUEXEL,FORTRAN)
#  pragma linkage(KUEXIT,FORTRAN)
#  pragma linkage(KUFCAS,FORTRAN)
#  pragma linkage(KUFDEF,FORTRAN)
#  pragma linkage(KUGETC,FORTRAN)
#  pragma linkage(KUGETE,FORTRAN)
#  pragma linkage(KUGETF,FORTRAN)
#  pragma linkage(KUGETI,FORTRAN)
#  pragma linkage(KUGETL,FORTRAN)
#  pragma linkage(KUGETR,FORTRAN)
#  pragma linkage(KUGETS,FORTRAN)
#  pragma linkage(KUGRFL,FORTRAN)
#  pragma linkage(KUGUID,FORTRAN)
#  pragma linkage(KUHELP,FORTRAN)
#  pragma linkage(KUHOME,FORTRAN)
#  pragma linkage(KUIDF1,FORTRAN)
#  pragma linkage(KUIDF2,FORTRAN)
#  pragma linkage(KUIDFM,FORTRAN)
#  pragma linkage(KUINIM,FORTRAN)
#  pragma linkage(KUINIT,FORTRAN)
#  pragma linkage(KUINPS,FORTRAN)
#  pragma linkage(KUINQF,FORTRAN)
#  pragma linkage(KULUN,FORTRAN)
#  pragma linkage(KUMLOC,FORTRAN)
#  pragma linkage(KUMOUT,FORTRAN)
#  pragma linkage(KUNDPV,FORTRAN)
#  pragma linkage(KUNPAR,FORTRAN)
#  pragma linkage(KUNWG,FORTRAN)
#  pragma linkage(KUOPEN,FORTRAN)
#  pragma linkage(KUPAD,FORTRAN)
#  pragma linkage(KUPAR,FORTRAN)
#  pragma linkage(KUPATH,FORTRAN)
#  pragma linkage(KUPATL,FORTRAN)
#  pragma linkage(KUPROC,FORTRAN)
#  pragma linkage(KUPROF,FORTRAN)
#  pragma linkage(KUPROI,FORTRAN)
#  pragma linkage(KUPROP,FORTRAN)
#  pragma linkage(KUPROR,FORTRAN)
#  pragma linkage(KUPROS,FORTRAN)
#  pragma linkage(KUPVAL,FORTRAN)
#  pragma linkage(KUQCAS,FORTRAN)
#  pragma linkage(KUQENV,FORTRAN)
#  pragma linkage(KUQEXE,FORTRAN)
#  pragma linkage(KUQKEY,FORTRAN)
#  pragma linkage(KUQSVR,FORTRAN)
#  pragma linkage(KUQUIT,FORTRAN)
#  pragma linkage(KUQVAR,FORTRAN)
#  pragma linkage(KUREAD,FORTRAN)
#  pragma linkage(KUSAPP,FORTRAN)
#  pragma linkage(KUSIBR,FORTRAN)
#  pragma linkage(KUSIGM,FORTRAN)
#  pragma linkage(KUSPY,FORTRAN)
#  pragma linkage(KUSTAT,FORTRAN)
#  pragma linkage(KUSTOP,FORTRAN)
#  pragma linkage(KUTERM,FORTRAN)
#  pragma linkage(KUTIME,FORTRAN)
#  pragma linkage(KUTIM0,FORTRAN)
#  pragma linkage(KUTRUE,FORTRAN)
#  pragma linkage(KUSER,FORTRAN)
#  pragma linkage(KUVAR,FORTRAN)
#  pragma linkage(KUVCRE,FORTRAN)
#  pragma linkage(KUVDEL,FORTRAN)
#  pragma linkage(KUVECT,FORTRAN)
#  pragma linkage(KUVNAM,FORTRAN)
#  pragma linkage(KUWHAG,FORTRAN)
#  pragma linkage(KUWHAM,FORTRAN)
#  pragma linkage(KUWHAT,FORTRAN)
#  pragma linkage(KUWRIT,FORTRAN)
#  pragma linkage(KXDSIG,FORTRAN)

#  pragma linkage(KXCRV2,FORTRAN)

#  pragma linkage(MACDEF,FORTRAN)

#  pragma linkage(MDMENU,FORTRAN)
#  pragma linkage(MHI_CLOSE,FORTRAN)
#  pragma linkage(MHI_OPEN,FORTRAN)

#  pragma linkage(MZWIPE,FORTRAN)

#  pragma linkage(TRACEQ,FORTRAN)

#  pragma linkage(XUFLOW,FORTRAN)

#endif


#define  MAXCMD   512           /* max length of a command line        */
#define  MAXEDT   32            /* max length of names in edit server  */
#define  MAXLEV   10            /* max levels of command name path     */
#define  MAXSVR   20            /* max number of edit server processes */


/*
 * The PAWC common is referenced through a pointer to allow the use of
 * dynamic common blocks on IBM systems.
 */

#define Pawc kc_pawc

EXTERN struct COMMON_PAWC {
  INTEGER NWPAR;
  INTEGER IXPAWC;
  INTEGER IHBOOK;
  INTEGER IXHIGZ;
  INTEGER IXKUIP;
  INTEGER IFENCE[5];
  INTEGER LQ[8];
  INTEGER DATA[999];
} *Pawc;

#define IQ(n)           Pawc->DATA[n-1]
#define  Q(n) (((REAL*)(Pawc->DATA))[n-1])